Skip to content

Commit

Permalink
feat: implement Number type
Browse files Browse the repository at this point in the history
  • Loading branch information
raichev-dima committed Dec 18, 2024
1 parent 592bc29 commit f83d64b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/formkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export { color } from './color'
export { colorpicker } from './colorpicker'
export { form } from './form'
export { month } from './month'
export { number } from './number'
export { password } from './password'
export { radio } from './radio'
export { range } from './range'
Expand Down
13 changes: 13 additions & 0 deletions packages/formkit/src/number.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { type FormKitTypeDefinition } from '@formkit/core'
import { token } from '@formkit/utils'
import { text } from './text'

/**
* Input definition for a number.
* @public
*/
export const number: FormKitTypeDefinition = {
...text,
forceTypeProp: 'number',
schemaMemoKey: token(),
}
26 changes: 26 additions & 0 deletions packages/ui/src/stories/formkit/Number.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { StoryFn } from '@storybook/vue3'
import * as types from '@vuestic/formkit'

export default {
title: 'Formkit Integration/Number',
}

export const Default: StoryFn = () => ({
setup () {
return {
types,
}
},
template: `
<div class="w-1/5 grid gap-6">
<FormKit
:type="types.number"
help="What temperature should the house be?"
label="Thermostat"
name="temperature"
value="25"
step="1"
/>
</div>
`,
})

0 comments on commit f83d64b

Please sign in to comment.