Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
900cbae
add: initial docs for currency and unit inputs
chrisladams Feb 28, 2024
3026917
Merge branch 'master' into feature/currency
chrisladams Feb 28, 2024
883298d
fix: updates to currency examples
chrisladams Mar 4, 2024
550fa3d
docs: adds examples for option groups
Apr 25, 2024
4461b1f
docs: removes ungrouped options from citiesByState
Apr 25, 2024
20f2255
docs: adds changelog for FormKit Pro v.0.123.1
Apr 25, 2024
76c2478
docs: Adds changelog for FormKit Pro v0.123.2
Apr 26, 2024
c920369
docs: adds changelog for FormKit Pro v0.123.3
Apr 26, 2024
bcc828b
docs: adds changelog for FormKit Pro v0.123.4
Apr 26, 2024
52d8bce
docs: Adds changelog for FormKit Pro v0.123.5
Apr 26, 2024
b4cf017
docs: adds changelog for FormKit Pro v0.123.6
Apr 27, 2024
7d1c21f
docs: adds new bronze sponsor logo
devoidofgenius May 1, 2024
a5621db
docs: correct resizing placed on wrong logo
devoidofgenius May 1, 2024
8d812e0
docs:removes old sponsors from community page
devoidofgenius May 2, 2024
cc1ddbd
docs: removes unit docs for now
May 6, 2024
6d3d633
Merge branch 'master' into feature/currency-with-no-unit
May 7, 2024
08f5c98
docs: updates currency docs
May 7, 2024
675832a
docs: updates currency docs
May 7, 2024
d4ffaac
docs:
May 7, 2024
760b7b0
docs: updates currency docs, adds changelog for FormKit Pro v0.124.0
May 7, 2024
2652ef8
docs: removes currency example from docs
May 7, 2024
73263d2
docs: adds changelog for FormKit Pro v.0.124.1
May 7, 2024
d2b0092
docs: adds docs for FormKit Pro v0.124.2
May 7, 2024
5943f97
docs: adds changelog for FormKit Pro v0.125.0
May 8, 2024
055edc0
docs: removes reverse mask example
May 8, 2024
acc5532
docs: adds changelog for FormKit Pro v0.125.1
May 9, 2024
059279f
docs: adds keyboard interactions table to currency input
May 10, 2024
aa4eefc
docs: makes slight edit to keyboard interactions for currency input
May 10, 2024
c658cbf
docs: adds more pro changelogs
andrew-boyd May 10, 2024
33b2cb0
docs: adds changelog for FormKit Pro v0.125.4
May 10, 2024
216a6c5
feat: 1.6.3 changelog
justin-schroeder May 14, 2024
dc0ab8a
docs: updates pro changelog and adds colorpicker alpha example
andrew-boyd May 14, 2024
f11bfc7
chore: fix heading level in changelog
andrew-boyd May 14, 2024
c3f4a1b
docs: adds changelog for pro
andrew-boyd May 14, 2024
60e92e4
docs: adds changelog for formkit pro v0.125.7
May 14, 2024
71f9f7b
added typebox plugin docs
crishoj May 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
630 changes: 630 additions & 0 deletions .examples/_data/citiesByState.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions .examples/autocomplete-pro/autocomplete-option-groups.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script setup>
import citiesByState from './citiesByState.js'
</script>

<template>
<FormKit type="form" #default="{ value }" :actions="false">
<FormKit
type="autocomplete"
name="most_populous_cities"
label="Choose your favorite countries"
placeholder="New York, Los Angeles..."
:options="citiesByState"
multiple
popover
/>
<pre wrap>{{ value }}</pre>
</FormKit>
</template>

<style></style>
16 changes: 16 additions & 0 deletions .examples/colorpicker/alpha.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<FormKit type="form" #default="{ value }" :actions="false">
<!-- %partial% -->
<FormKit
type="colorpicker"
name="color"
value="rgba(255, 0, 0, 0.5)"
alpha="false"
popover
value-format="rgba"
/>
<!-- %partial% -->

<pre wrap>{{ value }}</pre>
</FormKit>
</template>
21 changes: 21 additions & 0 deletions .examples/currency/currency-default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup>
import { ref } from 'vue'
const value = ref(false)
</script>

<template>
<!--
FormKit forms auto-collect values of children inputs.
Wrap the example in a form so we can display the form values.
-->
<FormKit type="form" #default="{ value }" :actions="false">
<!-- %partial%::html:: -->
<FormKit
type="currency"
name="currency"
value="12345678.90"
/>
<!-- %partial%::html:: -->
<pre wrap>{{ value }}</pre>
</FormKit>
</template>
28 changes: 28 additions & 0 deletions .examples/currency/currency-props-explore.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script setup>
import { ref } from 'vue'
const value = ref(false)
</script>

<template>
<!--
FormKit forms auto-collect values of children inputs.
Wrap the example in a form so we can display the form values.
-->
<FormKit type="form" #default="{ value }" :actions="false">
<!-- %partial%::html:: -->
<FormKit
type="currency"
name="currency"
min="-10"
max="1000"
step="0.0001"
currency="USD"
displayLocale="en-US"
decimals="4"
minDecimals="2"
value="123.1234"
/>
<!-- %partial%::html:: -->
<pre wrap>{{ value }}</pre>
</FormKit>
</template>
47 changes: 47 additions & 0 deletions .examples/currency/currency-simple-locale.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script setup>
import { ref } from 'vue'
const value = ref(false)
</script>

<template>
<!--
FormKit forms auto-collect values of children inputs.
Wrap the example in a form so we can display the form values.
-->
<FormKit type="form" #default="{ value }" :actions="false">
<!-- %partial%::html:: -->
<FormKit
type="currency"
currency="USD"
display-locale="en"
name="usd"
value="12345678.90"
/>

<FormKit
type="currency"
currency="EUR"
display-locale="de"
name="eur"
value="12345678.90"
/>

<FormKit
type="currency"
currency="INR"
display-locale="en-IN"
name="inr"
value="12345678.90"
/>

<FormKit
type="currency"
currency="CNY"
display-locale="zh-CN"
name="cny"
value="12345678.90"
/>
<!-- %partial%::html:: -->
<pre wrap>{{ value }}</pre>
</FormKit>
</template>
20 changes: 20 additions & 0 deletions .examples/dropdown/dropdown-option-groups.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script setup>
import citiesByState from './citiesByState.js'
</script>

<template>
<FormKit type="form" #default="{ value }" :actions="false">
<FormKit
type="dropdown"
name="most_populous_cities"
label="Choose your favorite countries"
placeholder="New York, Los Angeles..."
:options="citiesByState"
multiple
popover
/>
<pre wrap>{{ value }}</pre>
</FormKit>
</template>

<style></style>
19 changes: 19 additions & 0 deletions .examples/taglist/taglist-option-groups.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup>
import citiesByState from './citiesByState.js'
</script>

<template>
<FormKit type="form" #default="{ value }" :actions="false">
<FormKit
type="taglist"
name="most_populous_cities"
label="Choose your favorite countries"
placeholder="New York, Los Angeles..."
:options="citiesByState"
multiple
/>
<pre wrap>{{ value }}</pre>
</FormKit>
</template>

<style></style>
50 changes: 50 additions & 0 deletions .examples/typebox/errors.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script setup>
import { createTypeboxPlugin } from '@formkit/typebox'
import { Type } from '@sinclair/typebox'
import { TypeCompiler } from '@sinclair/typebox/compiler'

// some setup code
const typeboxSchema = Type.Object({
personalInfo: Type.Object({
firstName: Type.String({ minLength: 3, maxLength: 25 }),
lastName: Type.String({ minLength: 3, maxLength: 25 }),
}),
missingField: Type.Number()
})
const [typeboxPlugin, submitHandler] = createTypeboxPlugin(typeboxSchema, async () => { await new Promise((r) => setTimeout(r, 2000))})

// In a real app, you'd likely get the errors from
// your server, but for this example we'll do the
// parsing and retrieve the errors here.
function setupFormNode(node) {
const invalidValues = {personalInfo: { firstName: 'A', lastName: 'K' },
missingField: 'not a number'
}
const checker = TypeCompiler.Compile(typeboxSchema)
const errors = checker.Errors(invalidValues)
// pass the ValueErrorIterator from Typebox to the setTypeboxErrors method
// which is added by the Typebox plugin.
node.setTypeboxErrors(errors)
}
</script>

<template>
<h1 class="text-2xl font-bold mb-2">Errors set with node.setTypeboxErrors()</h1>
<p class="text-base mb-4">
This form cannot be successfully submitted because
the form fields do not match the provided schema.<br>
This is done to illustrate hydration of form-level errors.<br>
Do not actually do this. :)
</p>
<FormKit
type="form"
@node="setupFormNode"
:plugins="[typeboxPlugin]"
@submit="submitHandler"
>
<FormKit type="group" name="personalInfo">
<FormKit type="text" name="firstName" label="First Name" />
<FormKit type="text" name="lastName" label="Last Name" />
</FormKit>
</FormKit>
</template>
3 changes: 3 additions & 0 deletions .examples/typebox/importMap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typebox": "https://cdn.jsdelivr.net/npm/@sinclair/[email protected]/build/cjs/index.min.js"
}
51 changes: 51 additions & 0 deletions .examples/typebox/validation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script setup>
import { createTypeboxPlugin } from '@formkit/typebox'
import { Type } from '@sinclair/typebox'
import { FormatRegistry } from '@sinclair/typebox'

// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
const emailPattern = /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
FormatRegistry.Set('email', (value) => emailPattern.test(value))

const typeboxSchema = Type.Object({
personalInfo: Type.Object({
firstName: Type.String({minLength: 3, maxLength: 25}),
lastName: Type.String({minLength: 3, maxLength: 25}),
}),
email: Type.String({format: 'email'}),
arrayMin: Type.Array(Type.String(), {min: 2}),
})

const [typeboxPlugin, submitHandler] = createTypeboxPlugin(
typeboxSchema,
async (formData) => {
// fake submit handler, but this is where you
// do something with your valid data.
await new Promise((r) => setTimeout(r, 2000))
alert('Form was submitted!')
console.log(formData)
}
)
</script>

<template>
<h1>Validation from Typebox schema</h1>
<FormKit type="form" :plugins="[typeboxPlugin]" @submit="submitHandler">
<FormKit type="group" name="personalInfo">
<FormKit
validation-visibility="live"
type="text"
name="firstName"
label="First Name"
/>
<FormKit type="text" name="lastName" label="Last Name" />
</FormKit>
<FormKit type="text" name="email" label="Your email" />
<FormKit
type="checkbox"
name="arrayMin"
label="Typebox features"
:options="['Validation', 'Type-Safety', 'Reusability']"
/>
</FormKit>
</template>
63 changes: 63 additions & 0 deletions .examples/typebox/with-formkit-validation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup>
import { createTypeboxPlugin } from '@formkit/typebox'
import { Type } from '@sinclair/typebox'
import { FormatRegistry } from '@sinclair/typebox'

// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
const emailPattern = /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
FormatRegistry.Set('email', (value) => emailPattern.test(value))

const typeboxSchema = Type.Object({
personalInfo: Type.Object({
firstName: Type.String({minLength: 3, maxLength: 25}),
lastName: Type.String({minLength: 3, maxLength: 25}),
}),
email: Type.string({format: 'email'}),
arrayMin: Type.Array(Type.String(), {min: 2}),
})

const [typeboxPlugin, submitHandler] = createTypeboxPlugin(
typeboxSchema,
async (formData) => {
// fake submit handler, but this is where you
// do something with your valid data.
await new Promise((r) => setTimeout(r, 2000))
alert('Form was submitted!')
console.log(formData)
}
)
</script>

<template>
<h1 class="text-2xl font-bold mb-4">Typebox with FormKit Validation</h1>
<FormKit type="form" :plugins="[typeboxPlugin]" @submit="submitHandler">
<FormKit type="group" name="personalInfo">
<FormKit
validation="required|length:3,25"
validation-visibility="live"
type="text"
name="firstName"
label="First name"
/>
<FormKit
validation="required|length:3,25"
type="text"
name="lastName"
label="Last name"
/>
</FormKit>
<FormKit
validation="required|email"
type="text"
name="email"
label="Your email"
/>
<FormKit
validation="required|min:2"
type="checkbox"
name="arrayMin"
label="Typebox features"
:options="['Validation', 'Type-Safety', 'Reusability']"
/>
</FormKit>
</template>
25 changes: 25 additions & 0 deletions .examples/unit/unit-default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup>
import { ref } from 'vue'
const value = ref(false)
</script>

<template>
<!--
FormKit forms auto-collect values of children inputs.
Wrap the example in a form so we can display the form values.
-->
<FormKit type="form" #default="{ value }" :actions="false">
<!-- %partial%::html:: -->
<FormKit type="unit" unit="percent" name="percent" value="123.45" />

<FormKit type="unit" unit="fahrenheit" name="fahrenheit" value="123.45" />

<FormKit type="unit" unit="gigabyte" name="gigabyte" value="123.45" />

<FormKit type="unit" unit="kilogram" name="kilogram" displayLocale="de-DE" value="123.45" />

<FormKit type="unit" unit="fluid-ounce" name="fluid-ounce" value="123.45" />
<!-- %partial%::html:: -->
<pre wrap>{{ value }}</pre>
</FormKit>
</template>
Loading