@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
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import type { AcceptableValue } from 'reka-ui'
|
|
5
|
+
import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
|
|
6
|
+
import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
|
|
7
|
+
import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
|
|
8
|
+
import type { AutoHeightOptionsType } from 'embla-carousel-auto-height'
|
|
9
|
+
import type { ClassNamesOptionsType } from 'embla-carousel-class-names'
|
|
10
|
+
import type { FadeOptionsType } from 'embla-carousel-fade'
|
|
11
|
+
import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
|
|
12
|
+
import _appConfig from '#build/app.config'
|
|
13
|
+
import theme from '#build/ui/carousel'
|
|
14
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
15
|
+
import type { ButtonProps } from '../types'
|
|
16
|
+
import type { PartialString } from '../types/utils'
|
|
17
|
+
|
|
18
|
+
const appConfig = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
|
|
19
|
+
|
|
20
|
+
const carousel = tv({ extend: tv(theme), ...(appConfig.ui?.carousel || {}) })
|
|
21
|
+
|
|
22
|
+
type CarouselVariants = VariantProps<typeof carousel>
|
|
23
|
+
|
|
24
|
+
export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
|
25
|
+
/**
|
|
26
|
+
* The element or component this component should render as.
|
|
27
|
+
* @defaultValue 'div'
|
|
28
|
+
*/
|
|
29
|
+
as?: any
|
|
30
|
+
/**
|
|
31
|
+
* Configure the prev button when arrows are enabled.
|
|
32
|
+
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
|
|
33
|
+
*/
|
|
34
|
+
prev?: ButtonProps
|
|
35
|
+
/**
|
|
36
|
+
* The icon displayed in the prev button.
|
|
37
|
+
* @defaultValue appConfig.ui.icons.arrowLeft
|
|
38
|
+
*/
|
|
39
|
+
prevIcon?: string
|
|
40
|
+
/**
|
|
41
|
+
* Configure the next button when arrows are enabled.
|
|
42
|
+
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
|
|
43
|
+
*/
|
|
44
|
+
next?: ButtonProps
|
|
45
|
+
/**
|
|
46
|
+
* The icon displayed in the next button.
|
|
47
|
+
* @defaultValue appConfig.ui.icons.arrowRight
|
|
48
|
+
*/
|
|
49
|
+
nextIcon?: string
|
|
50
|
+
/**
|
|
51
|
+
* Display prev and next buttons to scroll the carousel.
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
arrows?: boolean
|
|
55
|
+
/**
|
|
56
|
+
* Display dots to scroll to a specific slide.
|
|
57
|
+
* @defaultValue false
|
|
58
|
+
*/
|
|
59
|
+
dots?: boolean
|
|
60
|
+
orientation?: CarouselVariants['orientation']
|
|
61
|
+
items?: T[]
|
|
62
|
+
/**
|
|
63
|
+
* Enable Autoplay plugin
|
|
64
|
+
* @link https://www.embla-carousel.com/plugins/autoplay/
|
|
65
|
+
*/
|
|
66
|
+
autoplay?: boolean | AutoplayOptionsType
|
|
67
|
+
/**
|
|
68
|
+
* Enable Auto Scroll plugin
|
|
69
|
+
* @link https://www.embla-carousel.com/plugins/auto-scroll/
|
|
70
|
+
*/
|
|
71
|
+
autoScroll?: boolean | AutoScrollOptionsType
|
|
72
|
+
/**
|
|
73
|
+
* Enable Auto Height plugin
|
|
74
|
+
* @link https://www.embla-carousel.com/plugins/auto-height/
|
|
75
|
+
*/
|
|
76
|
+
autoHeight?: boolean | AutoHeightOptionsType
|
|
77
|
+
/**
|
|
78
|
+
* Enable Class Names plugin
|
|
79
|
+
* @link https://www.embla-carousel.com/plugins/class-names/
|
|
80
|
+
*/
|
|
81
|
+
classNames?: boolean | ClassNamesOptionsType
|
|
82
|
+
/**
|
|
83
|
+
* Enable Fade plugin
|
|
84
|
+
* @link https://www.embla-carousel.com/plugins/fade/
|
|
85
|
+
*/
|
|
86
|
+
fade?: boolean | FadeOptionsType
|
|
87
|
+
/**
|
|
88
|
+
* Enable Wheel Gestures plugin
|
|
89
|
+
* @link https://www.embla-carousel.com/plugins/wheel-gestures/
|
|
90
|
+
*/
|
|
91
|
+
wheelGestures?: boolean | WheelGesturesPluginOptions
|
|
92
|
+
class?: any
|
|
93
|
+
ui?: PartialString<typeof carousel.slots>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type CarouselSlots<T> = {
|
|
97
|
+
default(props: { item: T, index: number }): any
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
extendDevtoolsMeta({ example: 'CarouselExample' })
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<script setup lang="ts" generic="T extends AcceptableValue">
|
|
104
|
+
import { computed, ref, watch, onMounted } from 'vue'
|
|
105
|
+
import useEmblaCarousel from 'embla-carousel-vue'
|
|
106
|
+
import { Primitive, useForwardProps } from 'reka-ui'
|
|
107
|
+
import { reactivePick, computedAsync } from '@vueuse/core'
|
|
108
|
+
import { useAppConfig } from '#imports'
|
|
109
|
+
import { useLocale } from '../composables/useLocale'
|
|
110
|
+
import UButton from './Button.vue'
|
|
111
|
+
|
|
112
|
+
const props = withDefaults(defineProps<CarouselProps<T>>(), {
|
|
113
|
+
orientation: 'horizontal',
|
|
114
|
+
arrows: false,
|
|
115
|
+
dots: false,
|
|
116
|
+
// Embla Options
|
|
117
|
+
active: true,
|
|
118
|
+
align: 'center',
|
|
119
|
+
breakpoints: () => ({}),
|
|
120
|
+
containScroll: 'trimSnaps',
|
|
121
|
+
dragFree: false,
|
|
122
|
+
dragThreshold: 10,
|
|
123
|
+
duration: 25,
|
|
124
|
+
inViewThreshold: 0,
|
|
125
|
+
loop: false,
|
|
126
|
+
skipSnaps: false,
|
|
127
|
+
slidesToScroll: 1,
|
|
128
|
+
startIndex: 0,
|
|
129
|
+
watchDrag: true,
|
|
130
|
+
watchResize: true,
|
|
131
|
+
watchSlides: true,
|
|
132
|
+
watchFocus: true,
|
|
133
|
+
// Embla Plugins
|
|
134
|
+
autoplay: false,
|
|
135
|
+
autoScroll: false,
|
|
136
|
+
autoHeight: false,
|
|
137
|
+
classNames: false,
|
|
138
|
+
fade: false,
|
|
139
|
+
wheelGestures: false
|
|
140
|
+
})
|
|
141
|
+
defineSlots<CarouselSlots<T>>()
|
|
142
|
+
|
|
143
|
+
const appConfig = useAppConfig()
|
|
144
|
+
const { dir, t } = useLocale()
|
|
145
|
+
const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
|
|
146
|
+
|
|
147
|
+
const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft))
|
|
148
|
+
const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight))
|
|
149
|
+
|
|
150
|
+
const ui = computed(() => carousel({
|
|
151
|
+
orientation: props.orientation
|
|
152
|
+
}))
|
|
153
|
+
|
|
154
|
+
const options = computed<EmblaOptionsType>(() => ({
|
|
155
|
+
...(props.fade ? { align: 'center', containScroll: false } : {}),
|
|
156
|
+
...rootProps.value,
|
|
157
|
+
axis: props.orientation === 'horizontal' ? 'x' : 'y',
|
|
158
|
+
direction: dir.value === 'rtl' ? 'rtl' : 'ltr'
|
|
159
|
+
}))
|
|
160
|
+
|
|
161
|
+
const plugins = computedAsync<EmblaPluginType[]>(async () => {
|
|
162
|
+
const plugins = []
|
|
163
|
+
|
|
164
|
+
if (props.autoplay) {
|
|
165
|
+
const AutoplayPlugin = await import('embla-carousel-autoplay').then(r => r.default)
|
|
166
|
+
plugins.push(AutoplayPlugin(typeof props.autoplay === 'boolean' ? {} : props.autoplay))
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (props.autoScroll) {
|
|
170
|
+
const AutoScrollPlugin = await import('embla-carousel-auto-scroll').then(r => r.default)
|
|
171
|
+
plugins.push(AutoScrollPlugin(typeof props.autoScroll === 'boolean' ? {} : props.autoScroll))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (props.autoHeight) {
|
|
175
|
+
const AutoHeightPlugin = await import('embla-carousel-auto-height').then(r => r.default)
|
|
176
|
+
plugins.push(AutoHeightPlugin(typeof props.autoHeight === 'boolean' ? {} : props.autoHeight))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (props.classNames) {
|
|
180
|
+
const ClassNamesPlugin = await import('embla-carousel-class-names').then(r => r.default)
|
|
181
|
+
plugins.push(ClassNamesPlugin(typeof props.classNames === 'boolean' ? {} : props.classNames))
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (props.fade) {
|
|
185
|
+
const FadePlugin = await import('embla-carousel-fade').then(r => r.default)
|
|
186
|
+
plugins.push(FadePlugin(typeof props.fade === 'boolean' ? {} : props.fade))
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (props.wheelGestures) {
|
|
190
|
+
const { WheelGesturesPlugin } = await import('embla-carousel-wheel-gestures')
|
|
191
|
+
plugins.push(WheelGesturesPlugin(typeof props.wheelGestures === 'boolean' ? {} : props.wheelGestures))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return plugins
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value)
|
|
198
|
+
|
|
199
|
+
watch([options, plugins], () => {
|
|
200
|
+
emblaApi.value?.reInit(options.value, plugins.value)
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
function scrollPrev() {
|
|
204
|
+
emblaApi.value?.scrollPrev()
|
|
205
|
+
}
|
|
206
|
+
function scrollNext() {
|
|
207
|
+
emblaApi.value?.scrollNext()
|
|
208
|
+
}
|
|
209
|
+
function scrollTo(index: number) {
|
|
210
|
+
emblaApi.value?.scrollTo(index)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function onKeyDown(event: KeyboardEvent) {
|
|
214
|
+
const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
|
|
215
|
+
const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
|
|
216
|
+
|
|
217
|
+
if (event.key === prevKey) {
|
|
218
|
+
event.preventDefault()
|
|
219
|
+
scrollPrev()
|
|
220
|
+
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (event.key === nextKey) {
|
|
225
|
+
event.preventDefault()
|
|
226
|
+
scrollNext()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const canScrollNext = ref(false)
|
|
231
|
+
const canScrollPrev = ref(false)
|
|
232
|
+
const selectedIndex = ref<number>(0)
|
|
233
|
+
const scrollSnaps = ref<number[]>([])
|
|
234
|
+
|
|
235
|
+
function onInit(api: EmblaCarouselType) {
|
|
236
|
+
scrollSnaps.value = api?.scrollSnapList() || []
|
|
237
|
+
}
|
|
238
|
+
function onSelect(api: EmblaCarouselType) {
|
|
239
|
+
canScrollNext.value = api?.canScrollNext() || false
|
|
240
|
+
canScrollPrev.value = api?.canScrollPrev() || false
|
|
241
|
+
selectedIndex.value = api?.selectedScrollSnap() || 0
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
onMounted(() => {
|
|
245
|
+
if (!emblaApi.value) {
|
|
246
|
+
return
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
emblaApi.value?.on('init', onInit)
|
|
250
|
+
emblaApi.value?.on('init', onSelect)
|
|
251
|
+
emblaApi.value?.on('reInit', onInit)
|
|
252
|
+
emblaApi.value?.on('reInit', onSelect)
|
|
253
|
+
emblaApi.value?.on('select', onSelect)
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
defineExpose({
|
|
257
|
+
emblaRef,
|
|
258
|
+
emblaApi
|
|
259
|
+
})
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<template>
|
|
263
|
+
<Primitive
|
|
264
|
+
:as="as"
|
|
265
|
+
role="region"
|
|
266
|
+
aria-roledescription="carousel"
|
|
267
|
+
tabindex="0"
|
|
268
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
269
|
+
@keydown="onKeyDown"
|
|
270
|
+
>
|
|
271
|
+
<div ref="emblaRef" :class="ui.viewport({ class: props.ui?.viewport })">
|
|
272
|
+
<div :class="ui.container({ class: props.ui?.container })">
|
|
273
|
+
<div
|
|
274
|
+
v-for="(item, index) in items"
|
|
275
|
+
:key="index"
|
|
276
|
+
role="group"
|
|
277
|
+
aria-roledescription="slide"
|
|
278
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
279
|
+
>
|
|
280
|
+
<slot :item="item" :index="index" />
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div v-if="arrows || dots" :class="ui.controls({ class: props.ui?.controls })">
|
|
286
|
+
<div v-if="arrows" :class="ui.arrows({ class: props.ui?.arrows })">
|
|
287
|
+
<UButton
|
|
288
|
+
:disabled="!canScrollPrev"
|
|
289
|
+
:icon="prevIcon"
|
|
290
|
+
size="md"
|
|
291
|
+
color="neutral"
|
|
292
|
+
variant="outline"
|
|
293
|
+
:aria-label="t('carousel.prev')"
|
|
294
|
+
v-bind="typeof prev === 'object' ? prev : undefined"
|
|
295
|
+
:class="ui.prev({ class: props.ui?.prev })"
|
|
296
|
+
@click="scrollPrev"
|
|
297
|
+
/>
|
|
298
|
+
<UButton
|
|
299
|
+
:disabled="!canScrollNext"
|
|
300
|
+
:icon="nextIcon"
|
|
301
|
+
size="md"
|
|
302
|
+
color="neutral"
|
|
303
|
+
variant="outline"
|
|
304
|
+
:aria-label="t('carousel.next')"
|
|
305
|
+
v-bind="typeof next === 'object' ? next : undefined"
|
|
306
|
+
:class="ui.next({ class: props.ui?.next })"
|
|
307
|
+
@click="scrollNext"
|
|
308
|
+
/>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div v-if="dots" :class="ui.dots({ class: props.ui?.dots })">
|
|
312
|
+
<template v-for="(_, index) in scrollSnaps" :key="index">
|
|
313
|
+
<button
|
|
314
|
+
:aria-label="t('carousel.goto', { slide: index + 1 })"
|
|
315
|
+
:class="ui.dot({ class: props.ui?.dot, active: selectedIndex === index })"
|
|
316
|
+
@click="scrollTo(index)"
|
|
317
|
+
/>
|
|
318
|
+
</template>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
</Primitive>
|
|
322
|
+
</template>
|
|
@@ -1,47 +1,79 @@
|
|
|
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 { CheckboxRootProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/checkbox'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
|
|
12
|
+
|
|
13
|
+
type CheckboxVariants = VariantProps<typeof checkbox>
|
|
14
|
+
|
|
15
|
+
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
label?: string
|
|
22
|
+
description?: string
|
|
23
|
+
color?: CheckboxVariants['color']
|
|
24
|
+
size?: CheckboxVariants['size']
|
|
25
|
+
/**
|
|
26
|
+
* The icon displayed when checked.
|
|
27
|
+
* @defaultValue appConfig.ui.icons.check
|
|
28
|
+
*/
|
|
29
|
+
icon?: string
|
|
30
|
+
/**
|
|
31
|
+
* The icon displayed when the checkbox is indeterminate.
|
|
32
|
+
* @defaultValue appConfig.ui.icons.minus
|
|
33
|
+
*/
|
|
34
|
+
indeterminateIcon?: string
|
|
35
|
+
class?: any
|
|
36
|
+
ui?: Partial<typeof checkbox.slots>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type CheckboxEmits = {
|
|
40
|
+
change: [payload: Event]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CheckboxSlots {
|
|
44
|
+
label(props: { label?: string }): any
|
|
45
|
+
description(props: { description?: string }): any
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
extendDevtoolsMeta({ defaultProps: { label: 'Check me!' } })
|
|
7
49
|
</script>
|
|
8
50
|
|
|
9
51
|
<script setup lang="ts">
|
|
10
52
|
import { computed, useId } from 'vue'
|
|
11
|
-
import { CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from '
|
|
53
|
+
import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'reka-ui'
|
|
12
54
|
import { reactivePick } from '@vueuse/core'
|
|
13
55
|
import { useAppConfig } from '#imports'
|
|
14
56
|
import { useFormField } from '../composables/useFormField'
|
|
57
|
+
import UIcon from './Icon.vue'
|
|
15
58
|
|
|
16
59
|
const props = defineProps<CheckboxProps>()
|
|
17
60
|
const slots = defineSlots<CheckboxSlots>()
|
|
18
61
|
const emits = defineEmits<CheckboxEmits>()
|
|
19
62
|
|
|
20
|
-
const modelValue = defineModel<boolean |
|
|
63
|
+
const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
|
|
21
64
|
|
|
22
|
-
const rootProps = useForwardProps(reactivePick(props, 'required', 'value'))
|
|
65
|
+
const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
|
|
23
66
|
|
|
24
67
|
const appConfig = useAppConfig()
|
|
25
68
|
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<CheckboxProps>(props)
|
|
26
69
|
const id = _id.value ?? useId()
|
|
27
70
|
|
|
28
|
-
const indeterminate = computed(() => (modelValue.value === undefined && props.indeterminate))
|
|
29
|
-
|
|
30
|
-
const checked = computed({
|
|
31
|
-
get() {
|
|
32
|
-
return indeterminate.value ? 'indeterminate' : modelValue.value
|
|
33
|
-
},
|
|
34
|
-
set(value) {
|
|
35
|
-
modelValue.value = value === 'indeterminate' ? undefined : value
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
71
|
const ui = computed(() => checkbox({
|
|
40
72
|
size: size.value,
|
|
41
73
|
color: color.value,
|
|
42
74
|
required: props.required,
|
|
43
75
|
disabled: disabled.value,
|
|
44
|
-
checked: (modelValue.value ?? props.defaultValue)
|
|
76
|
+
checked: Boolean(modelValue.value ?? props.defaultValue)
|
|
45
77
|
}))
|
|
46
78
|
|
|
47
79
|
function onUpdate(value: any) {
|
|
@@ -53,23 +85,25 @@ function onUpdate(value: any) {
|
|
|
53
85
|
}
|
|
54
86
|
</script>
|
|
55
87
|
|
|
88
|
+
<!-- eslint-disable vue/no-template-shadow -->
|
|
56
89
|
<template>
|
|
57
|
-
<
|
|
90
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
58
91
|
<div :class="ui.container({ class: props.ui?.container })">
|
|
59
92
|
<CheckboxRoot
|
|
60
93
|
:id="id"
|
|
61
|
-
v-model:checked="checked"
|
|
62
|
-
:default-checked="defaultValue"
|
|
63
94
|
v-bind="rootProps"
|
|
95
|
+
v-model="modelValue"
|
|
64
96
|
:name="name"
|
|
65
97
|
:disabled="disabled"
|
|
66
98
|
:class="ui.base({ class: props.ui?.base })"
|
|
67
|
-
@update:
|
|
99
|
+
@update:model-value="onUpdate"
|
|
68
100
|
>
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
<template #default="{ modelValue }">
|
|
102
|
+
<CheckboxIndicator as-child>
|
|
103
|
+
<UIcon v-if="modelValue === 'indeterminate'" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
|
|
104
|
+
<UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
|
|
105
|
+
</CheckboxIndicator>
|
|
106
|
+
</template>
|
|
73
107
|
</CheckboxRoot>
|
|
74
108
|
</div>
|
|
75
109
|
|
|
@@ -85,5 +119,5 @@ function onUpdate(value: any) {
|
|
|
85
119
|
</slot>
|
|
86
120
|
</p>
|
|
87
121
|
</div>
|
|
88
|
-
</
|
|
122
|
+
</Primitive>
|
|
89
123
|
</template>
|
|
@@ -1,16 +1,54 @@
|
|
|
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/chip'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) })
|
|
11
|
+
|
|
12
|
+
type ChipVariants = VariantProps<typeof chip>
|
|
13
|
+
|
|
14
|
+
export interface ChipProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'div'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
/** Display some text inside the chip. */
|
|
21
|
+
text?: string | number
|
|
22
|
+
color?: ChipVariants['color']
|
|
23
|
+
size?: ChipVariants['size']
|
|
24
|
+
position?: ChipVariants['position']
|
|
25
|
+
/** When `true`, translate the chip at the edge for non rounded elements. */
|
|
26
|
+
inset?: boolean
|
|
27
|
+
/** When `true`, render the chip relatively to the parent. */
|
|
28
|
+
standalone?: boolean
|
|
29
|
+
class?: any
|
|
30
|
+
ui?: Partial<typeof chip.slots>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ChipEmits {
|
|
34
|
+
(e: 'update:show', payload: boolean): void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ChipSlots {
|
|
38
|
+
default(props?: {}): any
|
|
39
|
+
content(props?: {}): any
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
extendDevtoolsMeta({ example: 'ChipExample' })
|
|
7
43
|
</script>
|
|
8
44
|
|
|
9
45
|
<script setup lang="ts">
|
|
10
46
|
import { computed } from 'vue'
|
|
11
|
-
import { Primitive } from '
|
|
47
|
+
import { Primitive, Slot } from 'reka-ui'
|
|
12
48
|
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
13
49
|
|
|
50
|
+
defineOptions({ inheritAttrs: false })
|
|
51
|
+
|
|
14
52
|
const props = withDefaults(defineProps<ChipProps>(), {
|
|
15
53
|
inset: false,
|
|
16
54
|
standalone: false
|
|
@@ -32,7 +70,9 @@ const ui = computed(() => chip({
|
|
|
32
70
|
|
|
33
71
|
<template>
|
|
34
72
|
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
35
|
-
<
|
|
73
|
+
<Slot v-bind="$attrs">
|
|
74
|
+
<slot />
|
|
75
|
+
</Slot>
|
|
36
76
|
|
|
37
77
|
<span v-if="show" :class="ui.base({ class: props.ui?.base })">
|
|
38
78
|
<slot name="content">
|
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/collapsible'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
|
|
12
|
+
|
|
13
|
+
export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
class?: any
|
|
20
|
+
ui?: Partial<typeof collapsible.slots>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CollapsibleEmits extends CollapsibleRootEmits {}
|
|
24
|
+
|
|
25
|
+
export interface CollapsibleSlots {
|
|
26
|
+
default(props: { open: boolean }): any
|
|
27
|
+
content(props?: {}): any
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
extendDevtoolsMeta({ example: 'CollapsibleExample' })
|
|
7
31
|
</script>
|
|
8
32
|
|
|
9
33
|
<script setup lang="ts">
|
|
10
|
-
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from '
|
|
34
|
+
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from 'reka-ui'
|
|
11
35
|
import { reactivePick } from '@vueuse/core'
|
|
12
36
|
|
|
13
37
|
const props = defineProps<CollapsibleProps>()
|
|
14
38
|
const emits = defineEmits<CollapsibleEmits>()
|
|
15
39
|
const slots = defineSlots<CollapsibleSlots>()
|
|
16
40
|
|
|
17
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled'), emits)
|
|
41
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled', 'unmountOnHide'), emits)
|
|
18
42
|
|
|
19
43
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
20
44
|
const ui = collapsible()
|