@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,13 +1,32 @@
|
|
|
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 { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/container'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) })
|
|
11
|
+
|
|
12
|
+
export interface ContainerProps {
|
|
13
|
+
/**
|
|
14
|
+
* The element or component this component should render as.
|
|
15
|
+
* @defaultValue 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: any
|
|
18
|
+
class?: any
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ContainerSlots {
|
|
22
|
+
default(props?: {}): any
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
extendDevtoolsMeta({ example: 'ContainerExample' })
|
|
7
26
|
</script>
|
|
8
27
|
|
|
9
28
|
<script setup lang="ts">
|
|
10
|
-
import { Primitive } from '
|
|
29
|
+
import { Primitive } from 'reka-ui'
|
|
11
30
|
|
|
12
31
|
const props = defineProps<ContainerProps>()
|
|
13
32
|
defineSlots<ContainerSlots>()
|
|
@@ -1,21 +1,157 @@
|
|
|
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 { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/context-menu'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
|
9
|
+
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) })
|
|
14
|
+
|
|
15
|
+
type ContextMenuVariants = VariantProps<typeof contextMenu>
|
|
16
|
+
|
|
17
|
+
export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
18
|
+
label?: string
|
|
19
|
+
icon?: string
|
|
20
|
+
color?: ContextMenuVariants['color']
|
|
21
|
+
avatar?: AvatarProps
|
|
22
|
+
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
23
|
+
kbds?: KbdProps['value'][] | KbdProps[]
|
|
24
|
+
/**
|
|
25
|
+
* The item type.
|
|
26
|
+
* @defaultValue 'link'
|
|
27
|
+
*/
|
|
28
|
+
type?: 'label' | 'separator' | 'link' | 'checkbox'
|
|
29
|
+
slot?: string
|
|
30
|
+
loading?: boolean
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
checked?: boolean
|
|
33
|
+
open?: boolean
|
|
34
|
+
defaultOpen?: boolean
|
|
35
|
+
children?: ContextMenuItem[] | ContextMenuItem[][]
|
|
36
|
+
onSelect?(e: Event): void
|
|
37
|
+
onUpdateChecked?(checked: boolean): void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'> {
|
|
41
|
+
size?: ContextMenuVariants['size']
|
|
42
|
+
items?: T[] | T[][]
|
|
43
|
+
/**
|
|
44
|
+
* The icon displayed when an item is checked.
|
|
45
|
+
* @defaultValue appConfig.ui.icons.check
|
|
46
|
+
*/
|
|
47
|
+
checkedIcon?: string
|
|
48
|
+
/**
|
|
49
|
+
* The icon displayed when an item is loading.
|
|
50
|
+
* @defaultValue appConfig.ui.icons.loading
|
|
51
|
+
*/
|
|
52
|
+
loadingIcon?: string
|
|
53
|
+
/** The content of the menu. */
|
|
54
|
+
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
55
|
+
/**
|
|
56
|
+
* Render the menu in a portal.
|
|
57
|
+
* @defaultValue true
|
|
58
|
+
*/
|
|
59
|
+
portal?: boolean
|
|
60
|
+
/**
|
|
61
|
+
* The key used to get the label from the item.
|
|
62
|
+
* @defaultValue 'label'
|
|
63
|
+
*/
|
|
64
|
+
labelKey?: string
|
|
65
|
+
disabled?: boolean
|
|
66
|
+
class?: any
|
|
67
|
+
ui?: PartialString<typeof contextMenu.slots>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ContextMenuEmits extends ContextMenuRootEmits {}
|
|
71
|
+
|
|
72
|
+
type SlotProps<T> = (props: { item: T, active?: boolean, index: number }) => any
|
|
73
|
+
|
|
74
|
+
export type ContextMenuSlots<T extends { slot?: string }> = {
|
|
75
|
+
'default'(props?: {}): any
|
|
76
|
+
'item': SlotProps<T>
|
|
77
|
+
'item-leading': SlotProps<T>
|
|
78
|
+
'item-label': SlotProps<T>
|
|
79
|
+
'item-trailing': SlotProps<T>
|
|
80
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
81
|
+
|
|
82
|
+
extendDevtoolsMeta({
|
|
83
|
+
example: 'ContextMenuExample',
|
|
84
|
+
ignoreProps: ['items'],
|
|
85
|
+
defaultProps: {
|
|
86
|
+
items: [
|
|
87
|
+
[{
|
|
88
|
+
label: 'My account',
|
|
89
|
+
avatar: {
|
|
90
|
+
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
|
|
91
|
+
}
|
|
92
|
+
}],
|
|
93
|
+
[{
|
|
94
|
+
label: 'Appearance',
|
|
95
|
+
children: [{
|
|
96
|
+
label: 'System',
|
|
97
|
+
icon: 'i-lucide-monitor'
|
|
98
|
+
}, {
|
|
99
|
+
label: 'Light',
|
|
100
|
+
icon: 'i-lucide-sun'
|
|
101
|
+
}, {
|
|
102
|
+
label: 'Dark',
|
|
103
|
+
icon: 'i-lucide-moon'
|
|
104
|
+
}]
|
|
105
|
+
}],
|
|
106
|
+
[{
|
|
107
|
+
label: 'Show Sidebar',
|
|
108
|
+
kbds: ['meta', 'S']
|
|
109
|
+
}, {
|
|
110
|
+
label: 'Show Toolbar',
|
|
111
|
+
kbds: ['shift', 'meta', 'D']
|
|
112
|
+
}, {
|
|
113
|
+
label: 'Collapse Pinned Tabs',
|
|
114
|
+
disabled: true
|
|
115
|
+
}], [{
|
|
116
|
+
label: 'Refresh the Page'
|
|
117
|
+
}, {
|
|
118
|
+
label: 'Clear Cookies and Refresh'
|
|
119
|
+
}, {
|
|
120
|
+
label: 'Clear Cache and Refresh'
|
|
121
|
+
}, {
|
|
122
|
+
type: 'separator'
|
|
123
|
+
}, {
|
|
124
|
+
label: 'Developer',
|
|
125
|
+
children: [[{
|
|
126
|
+
label: 'View Source',
|
|
127
|
+
kbds: ['option', 'meta', 'U']
|
|
128
|
+
}, {
|
|
129
|
+
label: 'Developer Tools',
|
|
130
|
+
kbds: ['option', 'meta', 'I']
|
|
131
|
+
}], [{
|
|
132
|
+
label: 'Inspect Elements',
|
|
133
|
+
kbds: ['option', 'meta', 'C']
|
|
134
|
+
}], [{
|
|
135
|
+
label: 'JavaScript Console',
|
|
136
|
+
kbds: ['option', 'meta', 'J']
|
|
137
|
+
}]]
|
|
138
|
+
}]
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
})
|
|
7
142
|
</script>
|
|
8
143
|
|
|
9
144
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
|
10
145
|
import { computed, toRef } from 'vue'
|
|
11
|
-
import { ContextMenuRoot, ContextMenuTrigger, useForwardPropsEmits } from '
|
|
146
|
+
import { ContextMenuRoot, ContextMenuTrigger, useForwardPropsEmits } from 'reka-ui'
|
|
12
147
|
import { reactivePick } from '@vueuse/core'
|
|
13
|
-
import UContextMenuContent from './ContextMenuContent.vue'
|
|
14
148
|
import { omit } from '../utils'
|
|
149
|
+
import UContextMenuContent from './ContextMenuContent.vue'
|
|
15
150
|
|
|
16
151
|
const props = withDefaults(defineProps<ContextMenuProps<T>>(), {
|
|
17
152
|
portal: true,
|
|
18
|
-
modal: true
|
|
153
|
+
modal: true,
|
|
154
|
+
labelKey: 'label'
|
|
19
155
|
})
|
|
20
156
|
const emits = defineEmits<ContextMenuEmits>()
|
|
21
157
|
const slots = defineSlots<ContextMenuSlots<T>>()
|
|
@@ -31,17 +167,20 @@ const ui = computed(() => contextMenu({
|
|
|
31
167
|
|
|
32
168
|
<template>
|
|
33
169
|
<ContextMenuRoot v-bind="rootProps">
|
|
34
|
-
<ContextMenuTrigger v-if="!!slots.default" as-child :disabled="disabled">
|
|
170
|
+
<ContextMenuTrigger v-if="!!slots.default" as-child :disabled="disabled" :class="props.class">
|
|
35
171
|
<slot />
|
|
36
172
|
</ContextMenuTrigger>
|
|
37
173
|
|
|
38
174
|
<UContextMenuContent
|
|
39
|
-
:class="ui.content({ class: [props.class, props.ui?.content] })"
|
|
175
|
+
:class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })"
|
|
40
176
|
:ui="ui"
|
|
41
177
|
:ui-override="props.ui"
|
|
42
178
|
v-bind="contentProps"
|
|
43
179
|
:items="items"
|
|
44
180
|
:portal="portal"
|
|
181
|
+
:label-key="labelKey"
|
|
182
|
+
:checked-icon="checkedIcon"
|
|
183
|
+
:loading-icon="loadingIcon"
|
|
45
184
|
>
|
|
46
185
|
<template v-for="(_, name) in proxySlots" #[name]="slotData: any">
|
|
47
186
|
<slot :name="name" v-bind="slotData" />
|
|
@@ -1,22 +1,41 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { ContextMenuContentProps as RekaContextMenuContentProps, ContextMenuContentEmits as RekaContextMenuContentEmits } from 'reka-ui'
|
|
4
|
+
import theme from '#build/ui/context-menu'
|
|
5
|
+
import type { KbdProps, AvatarProps, ContextMenuItem, ContextMenuSlots } from '../types'
|
|
6
|
+
|
|
7
|
+
const _contextMenu = tv(theme)()
|
|
8
|
+
|
|
9
|
+
interface ContextMenuContentProps<T> extends Omit<RekaContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
|
|
10
|
+
items?: T[] | T[][]
|
|
11
|
+
portal?: boolean
|
|
12
|
+
sub?: boolean
|
|
13
|
+
labelKey: string
|
|
14
|
+
checkedIcon?: string
|
|
15
|
+
loadingIcon?: string
|
|
16
|
+
class?: any
|
|
17
|
+
ui: typeof _contextMenu
|
|
18
|
+
uiOverride?: any
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ContextMenuContentEmits extends RekaContextMenuContentEmits {}
|
|
5
22
|
</script>
|
|
6
23
|
|
|
7
24
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
|
8
25
|
import { computed } from 'vue'
|
|
9
|
-
import { ContextMenu } from '
|
|
10
|
-
import { useForwardPropsEmits } from '
|
|
26
|
+
import { ContextMenu } from 'reka-ui/namespaced'
|
|
27
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
11
28
|
import { reactiveOmit, createReusableTemplate } from '@vueuse/core'
|
|
12
29
|
import { useAppConfig } from '#imports'
|
|
30
|
+
import { omit, get } from '../utils'
|
|
31
|
+
import { pickLinkProps } from '../utils/link'
|
|
13
32
|
import ULinkBase from './LinkBase.vue'
|
|
14
33
|
import ULink from './Link.vue'
|
|
15
34
|
import UAvatar from './Avatar.vue'
|
|
16
35
|
import UIcon from './Icon.vue'
|
|
17
36
|
import UKbd from './Kbd.vue'
|
|
18
|
-
|
|
19
|
-
import
|
|
37
|
+
// eslint-disable-next-line import/no-self-import
|
|
38
|
+
import UContextMenuContent from './ContextMenuContent.vue'
|
|
20
39
|
|
|
21
40
|
const props = defineProps<ContextMenuContentProps<T>>()
|
|
22
41
|
const emits = defineEmits<ContextMenuContentEmits>()
|
|
@@ -35,25 +54,30 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
35
54
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
36
55
|
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
37
56
|
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
38
|
-
<
|
|
39
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, active })" />
|
|
57
|
+
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
|
|
58
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
|
|
59
|
+
<UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
|
|
40
60
|
</slot>
|
|
41
61
|
|
|
42
|
-
<span v-if="item.
|
|
62
|
+
<span v-if="get(item, props.labelKey as string) || !!slots[item.slot ? `${item.slot}-label`: 'item-label']" :class="ui.itemLabel({ class: uiOverride?.itemLabel, active })">
|
|
43
63
|
<slot :name="item.slot ? `${item.slot}-label`: 'item-label'" :item="(item as T)" :active="active" :index="index">
|
|
44
|
-
{{ item.
|
|
64
|
+
{{ get(item, props.labelKey as string) }}
|
|
45
65
|
</slot>
|
|
46
66
|
|
|
47
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, active })" />
|
|
67
|
+
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
|
|
48
68
|
</span>
|
|
49
69
|
|
|
50
|
-
<span
|
|
70
|
+
<span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
|
|
51
71
|
<slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
52
|
-
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, active })" />
|
|
72
|
+
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
|
|
53
73
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
|
|
54
74
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
55
75
|
</span>
|
|
56
76
|
</slot>
|
|
77
|
+
|
|
78
|
+
<ContextMenu.ItemIndicator as-child>
|
|
79
|
+
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color })" />
|
|
80
|
+
</ContextMenu.ItemIndicator>
|
|
57
81
|
</span>
|
|
58
82
|
</slot>
|
|
59
83
|
</DefineItemTemplate>
|
|
@@ -71,8 +95,8 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
71
95
|
as="button"
|
|
72
96
|
type="button"
|
|
73
97
|
:disabled="item.disabled"
|
|
74
|
-
:text-value="item.
|
|
75
|
-
:class="ui.item({ class: uiOverride?.item })"
|
|
98
|
+
:text-value="get(item, props.labelKey as string)"
|
|
99
|
+
:class="ui.item({ class: uiOverride?.item, color: item?.color })"
|
|
76
100
|
>
|
|
77
101
|
<ReuseItemTemplate :item="item" :index="index" />
|
|
78
102
|
</ContextMenu.SubTrigger>
|
|
@@ -85,6 +109,9 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
85
109
|
:portal="portal"
|
|
86
110
|
:items="item.children"
|
|
87
111
|
:align-offset="-4"
|
|
112
|
+
:label-key="labelKey"
|
|
113
|
+
:checked-icon="checkedIcon"
|
|
114
|
+
:loading-icon="loadingIcon"
|
|
88
115
|
v-bind="item.content"
|
|
89
116
|
>
|
|
90
117
|
<template v-for="(_, name) in proxySlots" #[name]="slotData: any">
|
|
@@ -92,9 +119,26 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
92
119
|
</template>
|
|
93
120
|
</UContextMenuContent>
|
|
94
121
|
</ContextMenu.Sub>
|
|
95
|
-
<ContextMenu.
|
|
122
|
+
<ContextMenu.CheckboxItem
|
|
123
|
+
v-else-if="item.type === 'checkbox'"
|
|
124
|
+
:checked="item.checked"
|
|
125
|
+
:disabled="item.disabled"
|
|
126
|
+
:text-value="get(item, props.labelKey as string)"
|
|
127
|
+
:class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
|
|
128
|
+
@update:checked="item.onUpdateChecked"
|
|
129
|
+
@select="item.onSelect"
|
|
130
|
+
>
|
|
131
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
132
|
+
</ContextMenu.CheckboxItem>
|
|
133
|
+
<ContextMenu.Item
|
|
134
|
+
v-else
|
|
135
|
+
as-child
|
|
136
|
+
:disabled="item.disabled"
|
|
137
|
+
:text-value="get(item, props.labelKey as string)"
|
|
138
|
+
@select="item.onSelect"
|
|
139
|
+
>
|
|
96
140
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<ContextMenuItem, 'type'>)" custom>
|
|
97
|
-
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active })">
|
|
141
|
+
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active, color: item?.color })">
|
|
98
142
|
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
99
143
|
</ULinkBase>
|
|
100
144
|
</ULink>
|
|
@@ -1,43 +1,96 @@
|
|
|
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 { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
|
|
4
|
+
import type { DialogContentProps } from 'reka-ui'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/drawer'
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const drawer = tv({ extend: tv(theme), ...(appConfig.ui?.drawer || {}) })
|
|
13
|
+
|
|
14
|
+
export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'defaultOpen' | 'direction' | 'dismissible' | 'fadeFromIndex' | 'fixed' | 'modal' | 'nested' | 'direction' | 'open' | 'scrollLockTimeout' | 'shouldScaleBackground' | 'snapPoints'> {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'div'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
title?: string
|
|
21
|
+
description?: string
|
|
22
|
+
/** The content of the drawer. */
|
|
23
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
24
|
+
/**
|
|
25
|
+
* Render an overlay behind the drawer.
|
|
26
|
+
* @defaultValue true
|
|
27
|
+
*/
|
|
28
|
+
overlay?: boolean
|
|
29
|
+
/**
|
|
30
|
+
* Render a handle on the drawer.
|
|
31
|
+
* @defaultValue true
|
|
32
|
+
*/
|
|
33
|
+
handle?: boolean
|
|
34
|
+
/**
|
|
35
|
+
* Render the drawer in a portal.
|
|
36
|
+
* @defaultValue true
|
|
37
|
+
*/
|
|
38
|
+
portal?: boolean
|
|
39
|
+
class?: any
|
|
40
|
+
ui?: Partial<typeof drawer.slots>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface DrawerEmits extends DrawerRootEmits {}
|
|
44
|
+
|
|
45
|
+
export interface DrawerSlots {
|
|
46
|
+
default(props?: {}): any
|
|
47
|
+
handle(props?: {}): any
|
|
48
|
+
content(props?: {}): any
|
|
49
|
+
header(props?: {}): any
|
|
50
|
+
title(props?: {}): any
|
|
51
|
+
description(props?: {}): any
|
|
52
|
+
body(props?: {}): any
|
|
53
|
+
footer(props?: {}): any
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
extendDevtoolsMeta({ example: 'DrawerExample' })
|
|
7
57
|
</script>
|
|
8
58
|
|
|
9
59
|
<script setup lang="ts">
|
|
10
|
-
import { toRef } from 'vue'
|
|
11
|
-
import { useForwardPropsEmits } from '
|
|
60
|
+
import { computed, toRef } from 'vue'
|
|
61
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
12
62
|
import { DrawerRoot, DrawerTrigger, DrawerPortal, DrawerOverlay, DrawerContent, DrawerTitle, DrawerDescription } from 'vaul-vue'
|
|
13
63
|
import { reactivePick } from '@vueuse/core'
|
|
14
64
|
|
|
15
65
|
const props = withDefaults(defineProps<DrawerProps>(), {
|
|
66
|
+
direction: 'bottom',
|
|
16
67
|
portal: true,
|
|
17
|
-
overlay: true
|
|
68
|
+
overlay: true,
|
|
69
|
+
handle: true
|
|
18
70
|
})
|
|
19
71
|
const emits = defineEmits<DrawerEmits>()
|
|
20
72
|
const slots = defineSlots<DrawerSlots>()
|
|
21
73
|
|
|
22
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'activeSnapPoint', 'closeThreshold', 'defaultOpen', 'dismissible', 'fadeFromIndex', 'fixed', 'modal', 'nested', 'open', 'scrollLockTimeout', 'shouldScaleBackground', 'snapPoints'), emits)
|
|
74
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'activeSnapPoint', 'closeThreshold', 'defaultOpen', 'dismissible', 'fadeFromIndex', 'fixed', 'modal', 'nested', 'direction', 'open', 'scrollLockTimeout', 'shouldScaleBackground', 'snapPoints'), emits)
|
|
23
75
|
const contentProps = toRef(() => props.content)
|
|
24
76
|
|
|
25
|
-
|
|
26
|
-
|
|
77
|
+
const ui = computed(() => drawer({
|
|
78
|
+
direction: props.direction
|
|
79
|
+
}))
|
|
27
80
|
</script>
|
|
28
81
|
|
|
29
82
|
<template>
|
|
30
83
|
<DrawerRoot v-bind="rootProps">
|
|
31
|
-
<DrawerTrigger v-if="!!slots.default" as-child>
|
|
84
|
+
<DrawerTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
32
85
|
<slot />
|
|
33
86
|
</DrawerTrigger>
|
|
34
87
|
|
|
35
88
|
<DrawerPortal :disabled="!portal">
|
|
36
89
|
<DrawerOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
37
90
|
|
|
38
|
-
<DrawerContent :class="ui.content({ class: [props.class, props.ui?.content] })" v-bind="contentProps">
|
|
91
|
+
<DrawerContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps">
|
|
39
92
|
<slot name="handle">
|
|
40
|
-
<div :class="ui.handle({ class: props.ui?.handle })" />
|
|
93
|
+
<div v-if="handle" :class="ui.handle({ class: props.ui?.handle })" />
|
|
41
94
|
</slot>
|
|
42
95
|
|
|
43
96
|
<slot name="content">
|