@nuxt/ui 3.0.0-alpha.0 → 3.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/accordion.ts +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/calendar.ts +85 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/color-picker.ts +39 -0
- package/.nuxt/ui/command-palette.ts +50 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +48 -0
- package/.nuxt/ui/input-menu.ts +410 -0
- package/.nuxt/ui/input-number.ts +204 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/pin-input.ts +145 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +316 -0
- package/.nuxt/ui/select.ts +315 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/stepper.ts +180 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +129 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/README.md +75 -54
- package/cli/commands/{init.mjs → make/component.mjs} +5 -5
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/templates.mjs +52 -7
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +82802 -0
- package/dist/chunks/component-meta.mjs +82800 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/B1fTd_Rf.js +1 -0
- package/dist/client/devtools/_nuxt/CSUxkedg.js +1 -0
- package/dist/client/devtools/_nuxt/CbRTGpb7.js +1 -0
- package/dist/client/devtools/_nuxt/YQTlxbcT.js +53 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DXXceQev.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +54 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/StepperExample.vue +44 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +223 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +38 -7
- package/dist/module.d.ts +38 -7
- package/dist/module.json +4 -3
- package/dist/module.mjs +180 -2617
- package/dist/runtime/components/Accordion.vue +95 -11
- package/dist/runtime/components/Alert.vue +69 -10
- package/dist/runtime/components/App.vue +28 -5
- package/dist/runtime/components/Avatar.vue +57 -12
- package/dist/runtime/components/AvatarGroup.vue +34 -7
- package/dist/runtime/components/Badge.vue +61 -9
- package/dist/runtime/components/Breadcrumb.vue +93 -16
- package/dist/runtime/components/Button.vue +78 -12
- package/dist/runtime/components/ButtonGroup.vue +35 -8
- package/dist/runtime/components/Calendar.vue +190 -0
- package/dist/runtime/components/Card.vue +29 -7
- package/dist/runtime/components/Carousel.vue +322 -0
- package/dist/runtime/components/Checkbox.vue +64 -30
- package/dist/runtime/components/Chip.vue +48 -8
- package/dist/runtime/components/Collapsible.vue +32 -8
- package/dist/runtime/components/ColorPicker.vue +265 -0
- package/dist/runtime/components/CommandPalette.vue +207 -88
- package/dist/runtime/components/Container.vue +26 -7
- package/dist/runtime/components/ContextMenu.vue +150 -11
- package/dist/runtime/components/ContextMenuContent.vue +63 -19
- package/dist/runtime/components/Drawer.vue +68 -15
- package/dist/runtime/components/DropdownMenu.vue +147 -12
- package/dist/runtime/components/DropdownMenuContent.vue +69 -19
- package/dist/runtime/components/Form.vue +80 -42
- package/dist/runtime/components/FormField.vue +58 -21
- package/dist/runtime/components/Icon.vue +13 -3
- package/dist/runtime/components/Input.vue +61 -12
- package/dist/runtime/components/InputMenu.vue +247 -53
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +31 -7
- package/dist/runtime/components/Link.vue +148 -21
- package/dist/runtime/components/LinkBase.vue +21 -8
- package/dist/runtime/components/Modal.vue +90 -15
- package/dist/runtime/components/NavigationMenu.vue +234 -69
- package/dist/runtime/components/Pagination.vue +124 -15
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +66 -11
- package/dist/runtime/components/Progress.vue +67 -12
- package/dist/runtime/components/RadioGroup.vue +78 -9
- package/dist/runtime/components/Select.vue +155 -26
- package/dist/runtime/components/SelectMenu.vue +245 -63
- package/dist/runtime/components/Separator.vue +42 -7
- package/dist/runtime/components/Skeleton.vue +22 -7
- package/dist/runtime/components/Slideover.vue +88 -15
- package/dist/runtime/components/Slider.vue +37 -7
- package/dist/runtime/components/Stepper.vue +171 -0
- package/dist/runtime/components/Switch.vue +58 -14
- package/dist/runtime/components/Table.vue +262 -0
- package/dist/runtime/components/Tabs.vue +97 -17
- package/dist/runtime/components/Textarea.vue +55 -9
- package/dist/runtime/components/Toast.vue +66 -9
- package/dist/runtime/components/Toaster.vue +57 -21
- package/dist/runtime/components/Tooltip.vue +49 -10
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -8
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +2 -2
- package/dist/runtime/composables/useButtonGroup.d.ts +5 -5
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useFormField.d.ts +13 -6
- package/dist/runtime/composables/useFormField.js +12 -7
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useModal.d.ts +2 -2
- package/dist/runtime/composables/useSlideover.d.ts +2 -2
- package/dist/runtime/composables/useToast.d.ts +2 -2
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +53 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +52 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +52 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +52 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +52 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +53 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +52 -0
- package/dist/runtime/locale/index.d.ts +19 -0
- package/dist/runtime/locale/index.js +19 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +52 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +52 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +52 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +52 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +52 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +52 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +52 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +52 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +52 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +52 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +52 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +52 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/plugins/modal.d.ts +2 -0
- package/dist/runtime/plugins/slideover.d.ts +2 -0
- package/dist/runtime/types/form.d.ts +10 -4
- package/dist/runtime/types/index.d.ts +50 -42
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +54 -0
- package/dist/runtime/types/utils.d.ts +8 -3
- package/dist/runtime/utils/form.d.ts +7 -5
- package/dist/runtime/utils/form.js +117 -28
- package/dist/runtime/utils/index.d.ts +2 -1
- package/dist/runtime/utils/index.js +16 -0
- package/dist/runtime/utils/link.d.ts +25 -55
- package/dist/runtime/utils/link.js +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +208 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.CwmIkD_Y.cjs +3269 -0
- package/dist/shared/ui.D_93iuwH.mjs +3262 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +49 -0
- package/dist/unplugin.d.mts +49 -0
- package/dist/unplugin.d.ts +49 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +103 -37
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/assets/css/animations.css +0 -1
- package/dist/runtime/components/Accordion.vue.d.ts +0 -492
- package/dist/runtime/components/Alert.vue.d.ts +0 -548
- package/dist/runtime/components/App.vue.d.ts +0 -25
- package/dist/runtime/components/Avatar.vue.d.ts +0 -384
- package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -381
- package/dist/runtime/components/Badge.vue.d.ts +0 -422
- package/dist/runtime/components/Breadcrumb.vue.d.ts +0 -307
- package/dist/runtime/components/Button.vue.d.ts +0 -949
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -182
- package/dist/runtime/components/Card.vue.d.ts +0 -191
- package/dist/runtime/components/Checkbox.vue.d.ts +0 -819
- package/dist/runtime/components/Chip.vue.d.ts +0 -590
- package/dist/runtime/components/Collapsible.vue.d.ts +0 -159
- package/dist/runtime/components/CommandPalette.vue.d.ts +0 -684
- package/dist/runtime/components/Container.vue.d.ts +0 -27
- package/dist/runtime/components/ContextMenu.vue.d.ts +0 -796
- package/dist/runtime/components/Drawer.vue.d.ts +0 -343
- package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -815
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Form.vue.d.ts +0 -39
- package/dist/runtime/components/FormField.vue.d.ts +0 -356
- package/dist/runtime/components/Icon.vue.d.ts +0 -17
- package/dist/runtime/components/Input.vue.d.ts +0 -1137
- package/dist/runtime/components/InputMenu.vue.d.ts +0 -2121
- package/dist/runtime/components/Kbd.vue.d.ts +0 -169
- package/dist/runtime/components/Link.vue.d.ts +0 -76
- package/dist/runtime/components/LinkBase.vue.d.ts +0 -49
- package/dist/runtime/components/Modal.vue.d.ts +0 -319
- package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -1789
- package/dist/runtime/components/Pagination.vue.d.ts +0 -295
- package/dist/runtime/components/Popover.vue.d.ts +0 -197
- package/dist/runtime/components/Progress.vue.d.ts +0 -1781
- package/dist/runtime/components/RadioGroup.vue.d.ts +0 -1715
- package/dist/runtime/components/Select.vue.d.ts +0 -1569
- package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1661
- package/dist/runtime/components/Separator.vue.d.ts +0 -0
- package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
- package/dist/runtime/components/Slideover.vue.d.ts +0 -375
- package/dist/runtime/components/Slider.vue.d.ts +0 -0
- package/dist/runtime/components/Switch.vue.d.ts +0 -1676
- package/dist/runtime/components/Tabs.vue.d.ts +0 -934
- package/dist/runtime/components/Textarea.vue.d.ts +0 -1133
- package/dist/runtime/components/Toast.vue.d.ts +0 -0
- package/dist/runtime/components/Toaster.vue.d.ts +0 -362
- package/dist/runtime/components/Tooltip.vue.d.ts +0 -248
- package/dist/runtime/types/component.d.ts +0 -17
- package/dist/runtime/types/component.js +0 -0
- /package/dist/runtime/{components/ContextMenuContent.vue.d.ts → types/locale.js} +0 -0
|
@@ -1,16 +1,56 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/form-field'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { formField: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const formField = tv({ extend: tv(theme), ...(appConfig.ui?.formField || {}) })
|
|
11
|
+
|
|
12
|
+
type FormFieldVariants = VariantProps<typeof formField>
|
|
13
|
+
|
|
14
|
+
export interface FormFieldProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'div'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
/** The name of the FormField. Also used to match form errors. */
|
|
21
|
+
name?: string
|
|
22
|
+
/** A regular expression to match form error names. */
|
|
23
|
+
errorPattern?: RegExp
|
|
24
|
+
label?: string
|
|
25
|
+
description?: string
|
|
26
|
+
help?: string
|
|
27
|
+
error?: string | boolean
|
|
28
|
+
hint?: string
|
|
29
|
+
size?: FormFieldVariants['size']
|
|
30
|
+
required?: boolean
|
|
31
|
+
eagerValidation?: boolean
|
|
32
|
+
validateOnInputDelay?: number
|
|
33
|
+
class?: any
|
|
34
|
+
ui?: Partial<typeof formField.slots>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface FormFieldSlots {
|
|
38
|
+
label(props: { label?: string }): any
|
|
39
|
+
hint(props: { hint?: string }): any
|
|
40
|
+
description(props: { description?: string }): any
|
|
41
|
+
help(props: { help?: string }): any
|
|
42
|
+
error(props: { error?: string | boolean }): any
|
|
43
|
+
default(props: { error?: string | boolean }): any
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
extendDevtoolsMeta({ example: 'FormFieldExample', defaultProps: { label: 'Label' } })
|
|
7
47
|
</script>
|
|
8
48
|
|
|
9
49
|
<script setup lang="ts">
|
|
10
50
|
import { computed, ref, inject, provide, type Ref, useId } from 'vue'
|
|
11
|
-
import { Label } from '
|
|
12
|
-
import { formFieldInjectionKey } from '../composables/useFormField'
|
|
13
|
-
import type { FormError } from '../types/form'
|
|
51
|
+
import { Primitive, Label } from 'reka-ui'
|
|
52
|
+
import { formFieldInjectionKey, inputIdInjectionKey } from '../composables/useFormField'
|
|
53
|
+
import type { FormError, FormFieldInjectedOptions } from '../types/form'
|
|
14
54
|
|
|
15
55
|
const props = defineProps<FormFieldProps>()
|
|
16
56
|
const slots = defineSlots<FormFieldSlots>()
|
|
@@ -22,27 +62,24 @@ const ui = computed(() => formField({
|
|
|
22
62
|
|
|
23
63
|
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
|
24
64
|
|
|
25
|
-
const error = computed(() =>
|
|
26
|
-
return (props.error && typeof props.error === 'string')
|
|
27
|
-
|| typeof props.error === 'boolean'
|
|
28
|
-
? props.error
|
|
29
|
-
: formErrors?.value?.find(error => error.name === props.name)?.message
|
|
30
|
-
})
|
|
65
|
+
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern)))?.message)
|
|
31
66
|
|
|
32
67
|
const id = ref(useId())
|
|
33
68
|
|
|
69
|
+
provide(inputIdInjectionKey, id)
|
|
70
|
+
|
|
34
71
|
provide(formFieldInjectionKey, computed(() => ({
|
|
35
|
-
id: id.value,
|
|
36
72
|
error: error.value,
|
|
37
73
|
name: props.name,
|
|
38
74
|
size: props.size,
|
|
39
75
|
eagerValidation: props.eagerValidation,
|
|
40
|
-
validateOnInputDelay: props.validateOnInputDelay
|
|
41
|
-
|
|
76
|
+
validateOnInputDelay: props.validateOnInputDelay,
|
|
77
|
+
errorPattern: props.errorPattern
|
|
78
|
+
}) as FormFieldInjectedOptions<FormFieldProps>))
|
|
42
79
|
</script>
|
|
43
80
|
|
|
44
81
|
<template>
|
|
45
|
-
<
|
|
82
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
46
83
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
47
84
|
<div v-if="label || !!slots.label" :class="ui.labelWrapper({ class: props.ui?.labelWrapper })">
|
|
48
85
|
<Label :for="id" :class="ui.label({ class: props.ui?.label })">
|
|
@@ -64,7 +101,7 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
64
101
|
</p>
|
|
65
102
|
</div>
|
|
66
103
|
|
|
67
|
-
<div :class="[label && ui.container({ class: props.ui?.container })]">
|
|
104
|
+
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
|
|
68
105
|
<slot :error="error" />
|
|
69
106
|
|
|
70
107
|
<p v-if="(typeof error === 'string' && error) || !!slots.error" :class="ui.error({ class: props.ui?.error })">
|
|
@@ -78,5 +115,5 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
78
115
|
</slot>
|
|
79
116
|
</p>
|
|
80
117
|
</div>
|
|
81
|
-
</
|
|
118
|
+
</Primitive>
|
|
82
119
|
</template>
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
name: string
|
|
4
|
+
mode?: 'svg' | 'css'
|
|
5
|
+
size?: string | number
|
|
6
|
+
customize?: (
|
|
7
|
+
content: string,
|
|
8
|
+
name?: string,
|
|
9
|
+
prefix?: string,
|
|
10
|
+
provider?: string
|
|
11
|
+
) => string
|
|
12
|
+
}
|
|
3
13
|
</script>
|
|
4
14
|
|
|
5
15
|
<script setup lang="ts">
|
|
6
|
-
import { useForwardProps } from '
|
|
16
|
+
import { useForwardProps } from 'reka-ui'
|
|
7
17
|
import { reactivePick } from '@vueuse/core'
|
|
8
18
|
|
|
9
19
|
const props = defineProps<IconProps>()
|
|
@@ -1,18 +1,66 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputHTMLAttributes } from 'vue'
|
|
3
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/input'
|
|
7
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
+
import type { AvatarProps } from '../types'
|
|
9
|
+
import type { PartialString } from '../types/utils'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { input: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const input = tv({ extend: tv(theme), ...(appConfig.ui?.input || {}) })
|
|
14
|
+
|
|
15
|
+
type InputVariants = VariantProps<typeof input>
|
|
16
|
+
|
|
17
|
+
export interface InputProps extends UseComponentIconsProps {
|
|
18
|
+
/**
|
|
19
|
+
* The element or component this component should render as.
|
|
20
|
+
* @defaultValue 'div'
|
|
21
|
+
*/
|
|
22
|
+
as?: any
|
|
23
|
+
id?: string
|
|
24
|
+
name?: string
|
|
25
|
+
type?: InputHTMLAttributes['type']
|
|
26
|
+
/** The placeholder text when the input is empty. */
|
|
27
|
+
placeholder?: string
|
|
28
|
+
color?: InputVariants['color']
|
|
29
|
+
variant?: InputVariants['variant']
|
|
30
|
+
size?: InputVariants['size']
|
|
31
|
+
required?: boolean
|
|
32
|
+
autocomplete?: InputHTMLAttributes['autocomplete']
|
|
33
|
+
autofocus?: boolean
|
|
34
|
+
autofocusDelay?: number
|
|
35
|
+
disabled?: boolean
|
|
36
|
+
/** Highlight the ring color like a focus state. */
|
|
37
|
+
highlight?: boolean
|
|
38
|
+
class?: any
|
|
39
|
+
ui?: PartialString<typeof input.slots>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface InputEmits {
|
|
43
|
+
(e: 'update:modelValue', payload: string | number): void
|
|
44
|
+
(e: 'blur', event: FocusEvent): void
|
|
45
|
+
(e: 'change', event: Event): void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface InputSlots {
|
|
49
|
+
leading(props?: {}): any
|
|
50
|
+
default(props?: {}): any
|
|
51
|
+
trailing(props?: {}): any
|
|
52
|
+
}
|
|
7
53
|
</script>
|
|
8
54
|
|
|
9
55
|
<script setup lang="ts">
|
|
10
56
|
import { ref, computed, onMounted } from 'vue'
|
|
57
|
+
import { Primitive } from 'reka-ui'
|
|
11
58
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
12
59
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
13
60
|
import { useFormField } from '../composables/useFormField'
|
|
14
|
-
import UIcon from './Icon.vue'
|
|
15
61
|
import { looseToNumber } from '../utils'
|
|
62
|
+
import UIcon from './Icon.vue'
|
|
63
|
+
import UAvatar from './Avatar.vue'
|
|
16
64
|
|
|
17
65
|
defineOptions({ inheritAttrs: false })
|
|
18
66
|
|
|
@@ -39,7 +87,7 @@ const ui = computed(() => input({
|
|
|
39
87
|
size: inputSize?.value,
|
|
40
88
|
loading: props.loading,
|
|
41
89
|
highlight: highlight.value,
|
|
42
|
-
leading: isLeading.value || !!slots.leading,
|
|
90
|
+
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
43
91
|
trailing: isTrailing.value || !!slots.trailing,
|
|
44
92
|
buttonGroup: orientation.value
|
|
45
93
|
}))
|
|
@@ -105,7 +153,7 @@ onMounted(() => {
|
|
|
105
153
|
</script>
|
|
106
154
|
|
|
107
155
|
<template>
|
|
108
|
-
<
|
|
156
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
109
157
|
<input
|
|
110
158
|
:id="id"
|
|
111
159
|
ref="inputRef"
|
|
@@ -125,9 +173,10 @@ onMounted(() => {
|
|
|
125
173
|
|
|
126
174
|
<slot />
|
|
127
175
|
|
|
128
|
-
<span v-if="isLeading || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
176
|
+
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
129
177
|
<slot name="leading">
|
|
130
|
-
<UIcon v-if="leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
178
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
179
|
+
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
131
180
|
</slot>
|
|
132
181
|
</span>
|
|
133
182
|
|
|
@@ -136,5 +185,5 @@ onMounted(() => {
|
|
|
136
185
|
<UIcon v-if="trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
137
186
|
</slot>
|
|
138
187
|
</span>
|
|
139
|
-
</
|
|
188
|
+
</Primitive>
|
|
140
189
|
</template>
|