@eslamdevui/ui 3.2.0-beta.2 → 3.2.1
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/auth-form.ts +20 -0
- package/.nuxt/ui/banner.ts +105 -0
- package/.nuxt/ui/blog-post.ts +140 -0
- package/.nuxt/ui/blog-posts.ts +14 -0
- package/.nuxt/ui/changelog-version.ts +41 -0
- package/.nuxt/ui/changelog-versions.ts +8 -0
- package/.nuxt/ui/chat-palette.ts +8 -0
- package/.nuxt/ui/content/content-navigation.ts +6 -4
- package/.nuxt/ui/content-navigation.ts +6 -4
- package/.nuxt/ui/footer-columns.ts +28 -0
- package/.nuxt/ui/footer.ts +11 -0
- package/.nuxt/ui/header.ts +30 -0
- package/.nuxt/ui/index.ts +32 -1
- package/.nuxt/ui/main.ts +3 -0
- package/.nuxt/ui/page-accordion.ts +7 -0
- package/.nuxt/ui/page-anchors.ts +30 -0
- package/.nuxt/ui/page-aside.ts +10 -0
- package/.nuxt/ui/page-body.ts +3 -0
- package/.nuxt/ui/page-card.ts +276 -0
- package/.nuxt/ui/page-columns.ts +3 -0
- package/.nuxt/ui/page-cta.ts +72 -0
- package/.nuxt/ui/page-feature.ts +31 -0
- package/.nuxt/ui/page-grid.ts +3 -0
- package/.nuxt/ui/page-header.ts +18 -0
- package/.nuxt/ui/page-hero.ts +46 -0
- package/.nuxt/ui/page-links.ts +25 -0
- package/.nuxt/ui/page-list.ts +8 -0
- package/.nuxt/ui/page-logos.ts +15 -0
- package/.nuxt/ui/page-marquee.ts +66 -0
- package/.nuxt/ui/page-section.ts +88 -0
- package/.nuxt/ui/page.ts +32 -0
- package/.nuxt/ui/pricing-plan.ts +101 -0
- package/.nuxt/ui/pricing-plans.ts +27 -0
- package/.nuxt/ui/pricing-table.ts +51 -0
- package/.nuxt/ui/user.ts +106 -0
- package/LICENSE.md +9 -9
- package/README.md +147 -147
- package/cli/commands/make/component.mjs +95 -95
- package/cli/commands/make/index.mjs +14 -14
- package/cli/commands/make/locale.mjs +64 -64
- package/cli/index.mjs +15 -15
- package/cli/package.json +13 -13
- package/cli/templates.mjs +236 -236
- package/cli/utils.mjs +31 -31
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +36 -36
- package/dist/runtime/components/Alert.vue +46 -46
- package/dist/runtime/components/App.vue +10 -10
- package/dist/runtime/components/AuthForm.vue +195 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +85 -0
- package/dist/runtime/components/Avatar.vue +27 -27
- package/dist/runtime/components/AvatarGroup.vue +4 -4
- package/dist/runtime/components/Badge.vue +16 -16
- package/dist/runtime/components/Banner.vue +113 -0
- package/dist/runtime/components/Banner.vue.d.ts +68 -0
- package/dist/runtime/components/BlogPost.vue +141 -0
- package/dist/runtime/components/BlogPost.vue.d.ts +59 -0
- package/dist/runtime/components/BlogPosts.vue +33 -0
- package/dist/runtime/components/BlogPosts.vue.d.ts +30 -0
- package/dist/runtime/components/Breadcrumb.vue +32 -32
- package/dist/runtime/components/Button.vue +28 -28
- package/dist/runtime/components/ButtonGroup.vue +3 -3
- package/dist/runtime/components/Calendar.vue +74 -74
- package/dist/runtime/components/Card.vue +13 -13
- package/dist/runtime/components/Carousel.vue +58 -58
- package/dist/runtime/components/ChangelogVersion.vue +165 -0
- package/dist/runtime/components/ChangelogVersion.vue.d.ts +58 -0
- package/dist/runtime/components/ChangelogVersions.vue +54 -0
- package/dist/runtime/components/ChangelogVersions.vue.d.ts +74 -0
- package/dist/runtime/components/ChatMessage.vue +35 -35
- package/dist/runtime/components/ChatMessages.vue +55 -55
- package/dist/runtime/components/ChatPalette.vue +32 -0
- package/dist/runtime/components/ChatPalette.vue.d.ts +24 -0
- package/dist/runtime/components/ChatPrompt.vue +26 -26
- package/dist/runtime/components/ChatPrompt.vue.d.ts +1 -1
- package/dist/runtime/components/ChatPromptSubmit.vue +10 -10
- package/dist/runtime/components/Checkbox.vue +33 -33
- package/dist/runtime/components/CheckboxGroup.vue +32 -32
- package/dist/runtime/components/Chip.vue +11 -11
- package/dist/runtime/components/Collapsible.vue +9 -9
- package/dist/runtime/components/ColorPicker.vue +30 -30
- package/dist/runtime/components/CommandPalette.vue +117 -117
- package/dist/runtime/components/CommandPalette.vue.d.ts +3 -3
- package/dist/runtime/components/Container.vue +3 -3
- package/dist/runtime/components/ContextMenu.vue +22 -22
- package/dist/runtime/components/ContextMenuContent.vue +105 -105
- package/dist/runtime/components/DashboardGroup.vue +3 -3
- package/dist/runtime/components/DashboardNavbar.vue +40 -40
- package/dist/runtime/components/DashboardPanel.vue +27 -27
- package/dist/runtime/components/DashboardResizeHandle.vue +7 -7
- package/dist/runtime/components/DashboardSearch.vue +20 -20
- package/dist/runtime/components/DashboardSearchButton.vue +43 -43
- package/dist/runtime/components/DashboardSidebar.vue +74 -74
- package/dist/runtime/components/DashboardSidebarCollapse.vue +7 -7
- package/dist/runtime/components/DashboardSidebarToggle.vue +7 -7
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -1
- package/dist/runtime/components/Drawer.vue +55 -55
- package/dist/runtime/components/DropdownMenu.vue +24 -24
- package/dist/runtime/components/DropdownMenuContent.vue +107 -107
- package/dist/runtime/components/Error.vue +22 -22
- package/dist/runtime/components/Error.vue.d.ts +1 -1
- package/dist/runtime/components/Footer.vue +44 -0
- package/dist/runtime/components/Footer.vue.d.ts +29 -0
- package/dist/runtime/components/FooterColumns.vue +68 -0
- package/dist/runtime/components/FooterColumns.vue.d.ts +52 -0
- package/dist/runtime/components/Form.vue +8 -8
- package/dist/runtime/components/FormField.vue +37 -37
- package/dist/runtime/components/Header.vue +137 -0
- package/dist/runtime/components/Header.vue.d.ts +72 -0
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +34 -34
- package/dist/runtime/components/InputMenu.vue +163 -163
- package/dist/runtime/components/InputMenu.vue.d.ts +3 -3
- package/dist/runtime/components/InputNumber.vue +49 -49
- package/dist/runtime/components/InputTags.vue +55 -55
- package/dist/runtime/components/Kbd.vue +5 -5
- package/dist/runtime/components/Link.vue +14 -14
- package/dist/runtime/components/LinkBase.vue +8 -8
- package/dist/runtime/components/Main.vue +23 -0
- package/dist/runtime/components/Main.vue.d.ts +20 -0
- package/dist/runtime/components/Modal.vue +69 -69
- package/dist/runtime/components/NavigationMenu.vue +166 -166
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Page.vue +37 -0
- package/dist/runtime/components/Page.vue.d.ts +25 -0
- package/dist/runtime/components/PageAccordion.vue +26 -0
- package/dist/runtime/components/PageAccordion.vue.d.ts +21 -0
- package/dist/runtime/components/PageAnchors.vue +50 -0
- package/dist/runtime/components/PageAnchors.vue.d.ts +42 -0
- package/dist/runtime/components/PageAside.vue +36 -0
- package/dist/runtime/components/PageAside.vue.d.ts +27 -0
- package/dist/runtime/components/PageBody.vue +23 -0
- package/dist/runtime/components/PageBody.vue.d.ts +18 -0
- package/dist/runtime/components/PageCTA.vue +58 -0
- package/dist/runtime/components/PageCTA.vue.d.ts +49 -0
- package/dist/runtime/components/PageCard.vue +121 -0
- package/dist/runtime/components/PageCard.vue.d.ts +71 -0
- package/dist/runtime/components/PageColumns.vue +23 -0
- package/dist/runtime/components/PageColumns.vue.d.ts +18 -0
- package/dist/runtime/components/PageFeature.vue +71 -0
- package/dist/runtime/components/PageFeature.vue.d.ts +43 -0
- package/dist/runtime/components/PageGrid.vue +23 -0
- package/dist/runtime/components/PageGrid.vue.d.ts +18 -0
- package/dist/runtime/components/PageHeader.vue +58 -0
- package/dist/runtime/components/PageHeader.vue.d.ts +35 -0
- package/dist/runtime/components/PageHero.vue +67 -0
- package/dist/runtime/components/PageHero.vue.d.ts +49 -0
- package/dist/runtime/components/PageLinks.vue +55 -0
- package/dist/runtime/components/PageLinks.vue.d.ts +44 -0
- package/dist/runtime/components/PageList.vue +24 -0
- package/dist/runtime/components/PageList.vue.d.ts +21 -0
- package/dist/runtime/components/PageLogos.vue +64 -0
- package/dist/runtime/components/PageLogos.vue.d.ts +32 -0
- package/dist/runtime/components/PageMarquee.vue +40 -0
- package/dist/runtime/components/PageMarquee.vue.d.ts +30 -0
- package/dist/runtime/components/PageSection.vue +88 -0
- package/dist/runtime/components/PageSection.vue.d.ts +64 -0
- package/dist/runtime/components/Pagination.vue +47 -47
- package/dist/runtime/components/PinInput.vue +20 -20
- package/dist/runtime/components/Popover.vue +17 -17
- package/dist/runtime/components/PricingPlan.vue +129 -0
- package/dist/runtime/components/PricingPlan.vue.d.ts +109 -0
- package/dist/runtime/components/PricingPlans.vue +45 -0
- package/dist/runtime/components/PricingPlans.vue.d.ts +41 -0
- package/dist/runtime/components/PricingTable.vue +235 -0
- package/dist/runtime/components/PricingTable.vue.d.ts +98 -0
- package/dist/runtime/components/Progress.vue +19 -19
- package/dist/runtime/components/RadioGroup.vue +43 -43
- package/dist/runtime/components/Select.vue +96 -96
- package/dist/runtime/components/SelectMenu.vue +130 -130
- package/dist/runtime/components/SelectMenu.vue.d.ts +3 -3
- package/dist/runtime/components/Separator.vue +15 -15
- package/dist/runtime/components/Skeleton.vue +10 -10
- package/dist/runtime/components/Slideover.vue +76 -76
- package/dist/runtime/components/Slider.vue +27 -27
- package/dist/runtime/components/Stepper.vue +51 -51
- package/dist/runtime/components/Switch.vue +33 -33
- package/dist/runtime/components/Table.vue +77 -77
- package/dist/runtime/components/Tabs.vue +38 -37
- package/dist/runtime/components/Textarea.vue +33 -33
- package/dist/runtime/components/Timeline.vue +38 -38
- package/dist/runtime/components/Toast.vue +69 -69
- package/dist/runtime/components/Toaster.vue +28 -28
- package/dist/runtime/components/Tooltip.vue +19 -19
- package/dist/runtime/components/Tree.vue +60 -60
- package/dist/runtime/components/User.vue +69 -0
- package/dist/runtime/components/User.vue.d.ts +46 -0
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue +2 -2
- package/dist/runtime/components/color-mode/ColorModeButton.vue +16 -16
- package/dist/runtime/components/color-mode/ColorModeImage.vue +2 -2
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +19 -19
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue +19 -19
- package/dist/runtime/components/content/ContentNavigation.vue +109 -109
- package/dist/runtime/components/content/ContentSearch.vue +25 -25
- package/dist/runtime/components/content/ContentSearchButton.vue +38 -38
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +58 -12
- package/dist/runtime/components/content/ContentSurround.vue +31 -31
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +52 -59
- package/dist/runtime/components/content/ContentToc.vue +88 -76
- package/dist/runtime/components/content/ContentToc.vue.d.ts +86 -88
- package/dist/runtime/components/locale/LocaleSelect.vue +20 -20
- package/dist/runtime/components/prose/A.vue +3 -3
- package/dist/runtime/components/prose/Accordion.vue +5 -5
- package/dist/runtime/components/prose/AccordionItem.vue +5 -5
- package/dist/runtime/components/prose/Badge.vue +3 -3
- package/dist/runtime/components/prose/Blockquote.vue +3 -3
- package/dist/runtime/components/prose/Callout.vue +27 -27
- package/dist/runtime/components/prose/Card.vue +43 -43
- package/dist/runtime/components/prose/CardGroup.vue +3 -3
- package/dist/runtime/components/prose/Code.vue +3 -3
- package/dist/runtime/components/prose/CodeCollapse.vue +16 -16
- package/dist/runtime/components/prose/CodeGroup.vue +15 -15
- package/dist/runtime/components/prose/CodeIcon.vue +1 -1
- package/dist/runtime/components/prose/CodePreview.vue +9 -9
- package/dist/runtime/components/prose/CodeTree.vue +61 -61
- package/dist/runtime/components/prose/Collapsible.vue +15 -15
- package/dist/runtime/components/prose/Em.vue +1 -1
- package/dist/runtime/components/prose/Field.vue +23 -23
- package/dist/runtime/components/prose/FieldGroup.vue +3 -3
- package/dist/runtime/components/prose/H1.vue +6 -6
- package/dist/runtime/components/prose/H2.vue +10 -10
- package/dist/runtime/components/prose/H3.vue +10 -10
- package/dist/runtime/components/prose/H4.vue +6 -6
- package/dist/runtime/components/prose/Hr.vue +1 -1
- package/dist/runtime/components/prose/Icon.vue +1 -1
- package/dist/runtime/components/prose/Img.vue +8 -8
- package/dist/runtime/components/prose/Kbd.vue +1 -1
- package/dist/runtime/components/prose/Li.vue +3 -3
- package/dist/runtime/components/prose/Ol.vue +3 -3
- package/dist/runtime/components/prose/P.vue +3 -3
- package/dist/runtime/components/prose/Pre.vue +20 -20
- package/dist/runtime/components/prose/Script.vue +3 -3
- package/dist/runtime/components/prose/Steps.vue +3 -3
- package/dist/runtime/components/prose/Strong.vue +3 -3
- package/dist/runtime/components/prose/Table.vue +5 -5
- package/dist/runtime/components/prose/Tabs.vue +14 -14
- package/dist/runtime/components/prose/TabsItem.vue +5 -5
- package/dist/runtime/components/prose/Tbody.vue +3 -3
- package/dist/runtime/components/prose/Td.vue +3 -3
- package/dist/runtime/components/prose/Th.vue +3 -3
- package/dist/runtime/components/prose/Thead.vue +3 -3
- package/dist/runtime/components/prose/Tr.vue +3 -3
- package/dist/runtime/components/prose/Ul.vue +3 -3
- package/dist/runtime/components/prose/callout/Caution.vue +3 -3
- package/dist/runtime/components/prose/callout/Note.vue +3 -3
- package/dist/runtime/components/prose/callout/Tip.vue +3 -3
- package/dist/runtime/components/prose/callout/Warning.vue +3 -3
- package/dist/runtime/inertia/components/Link.vue +12 -12
- package/dist/runtime/inertia/components/LinkBase.vue +15 -15
- package/dist/runtime/types/app.config.d.ts +6 -6
- package/dist/runtime/types/index.d.ts +33 -0
- package/dist/runtime/types/index.js +33 -0
- package/dist/runtime/vue/components/Icon.vue +1 -1
- package/dist/runtime/vue/components/Link.vue +31 -31
- package/dist/runtime/vue/components/color-mode/ColorModeButton.vue +7 -7
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +7 -7
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +7 -7
- package/dist/shared/{ui.DQZ75GCP.mjs → ui.DErCA3YU.mjs} +1247 -50
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
- package/vue-plugin.d.ts +5 -5
- package/.nuxt/ui/prose.ts +0 -321
|
@@ -39,50 +39,50 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.alert || {} }
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<template>
|
|
42
|
-
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
43
|
-
<slot name="leading">
|
|
44
|
-
<UAvatar v-if="avatar" :size="props.ui?.avatarSize || ui.avatarSize()" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
|
45
|
-
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
46
|
-
</slot>
|
|
47
|
-
|
|
48
|
-
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
49
|
-
<div v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
50
|
-
<slot name="title">
|
|
51
|
-
{{ title }}
|
|
52
|
-
</slot>
|
|
53
|
-
</div>
|
|
54
|
-
<div v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
55
|
-
<slot name="description">
|
|
56
|
-
{{ description }}
|
|
57
|
-
</slot>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<div v-if="orientation === 'vertical' && (actions?.length || !!slots.actions)" :class="ui.actions({ class: props.ui?.actions })">
|
|
61
|
-
<slot name="actions">
|
|
62
|
-
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
63
|
-
</slot>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
|
|
68
|
-
<template v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions)">
|
|
69
|
-
<slot name="actions">
|
|
70
|
-
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
71
|
-
</slot>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<slot name="close" :ui="ui">
|
|
75
|
-
<UButton
|
|
76
|
-
v-if="close"
|
|
77
|
-
:icon="closeIcon || appConfig.ui.icons.close"
|
|
78
|
-
color="neutral"
|
|
79
|
-
variant="link"
|
|
80
|
-
:aria-label="t('alert.close')"
|
|
81
|
-
v-bind="typeof close === 'object' ? close : {}"
|
|
82
|
-
:class="ui.close({ class: props.ui?.close })"
|
|
83
|
-
@click="emits('update:open', false)"
|
|
84
|
-
/>
|
|
85
|
-
</slot>
|
|
86
|
-
</div>
|
|
87
|
-
</Primitive>
|
|
42
|
+
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
43
|
+
<slot name="leading">
|
|
44
|
+
<UAvatar v-if="avatar" :size="props.ui?.avatarSize || ui.avatarSize()" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
|
45
|
+
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
46
|
+
</slot>
|
|
47
|
+
|
|
48
|
+
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
49
|
+
<div v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
50
|
+
<slot name="title">
|
|
51
|
+
{{ title }}
|
|
52
|
+
</slot>
|
|
53
|
+
</div>
|
|
54
|
+
<div v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
55
|
+
<slot name="description">
|
|
56
|
+
{{ description }}
|
|
57
|
+
</slot>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div v-if="orientation === 'vertical' && (actions?.length || !!slots.actions)" :class="ui.actions({ class: props.ui?.actions })">
|
|
61
|
+
<slot name="actions">
|
|
62
|
+
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
63
|
+
</slot>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
|
|
68
|
+
<template v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions)">
|
|
69
|
+
<slot name="actions">
|
|
70
|
+
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
71
|
+
</slot>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<slot name="close" :ui="ui">
|
|
75
|
+
<UButton
|
|
76
|
+
v-if="close"
|
|
77
|
+
:icon="closeIcon || appConfig.ui.icons.close"
|
|
78
|
+
color="neutral"
|
|
79
|
+
variant="link"
|
|
80
|
+
:aria-label="t('alert.close')"
|
|
81
|
+
v-bind="typeof close === 'object' ? close : {}"
|
|
82
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
83
|
+
@click="emits('update:open', false)"
|
|
84
|
+
/>
|
|
85
|
+
</slot>
|
|
86
|
+
</div>
|
|
87
|
+
</Primitive>
|
|
88
88
|
</template>
|
|
@@ -31,14 +31,14 @@ provide(portalTargetInjectionKey, portal);
|
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<template>
|
|
34
|
-
<ConfigProvider :use-id="() => useId()" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
35
|
-
<TooltipProvider v-bind="tooltipProps">
|
|
36
|
-
<UToaster v-if="toaster !== null" v-bind="toasterProps">
|
|
37
|
-
<slot />
|
|
38
|
-
</UToaster>
|
|
39
|
-
<slot v-else />
|
|
40
|
-
|
|
41
|
-
<UOverlayProvider />
|
|
42
|
-
</TooltipProvider>
|
|
43
|
-
</ConfigProvider>
|
|
34
|
+
<ConfigProvider :use-id="() => useId()" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
35
|
+
<TooltipProvider v-bind="tooltipProps">
|
|
36
|
+
<UToaster v-if="toaster !== null" v-bind="toasterProps">
|
|
37
|
+
<slot />
|
|
38
|
+
</UToaster>
|
|
39
|
+
<slot v-else />
|
|
40
|
+
|
|
41
|
+
<UOverlayProvider />
|
|
42
|
+
</TooltipProvider>
|
|
43
|
+
</ConfigProvider>
|
|
44
44
|
</template>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/auth-form";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactive, ref, computed, useTemplateRef } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { omit } from "../utils";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useLocalePro } from "../composables/useLocalePro";
|
|
11
|
+
import { tv } from "../utils/tv";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
icon: { type: String, required: false },
|
|
15
|
+
title: { type: String, required: false },
|
|
16
|
+
description: { type: String, required: false },
|
|
17
|
+
fields: { type: Array, required: false },
|
|
18
|
+
providers: { type: Array, required: false },
|
|
19
|
+
separator: { type: [String, Object], required: false, default: "or" },
|
|
20
|
+
submit: { type: Object, required: false },
|
|
21
|
+
schema: { type: null, required: false },
|
|
22
|
+
validate: { type: Function, required: false },
|
|
23
|
+
validateOn: { type: Array, required: false },
|
|
24
|
+
validateOnInputDelay: { type: Number, required: false },
|
|
25
|
+
disabled: { type: Boolean, required: false },
|
|
26
|
+
loading: { type: Boolean, required: false, default: false },
|
|
27
|
+
class: { type: null, required: false },
|
|
28
|
+
ui: { type: null, required: false }
|
|
29
|
+
});
|
|
30
|
+
const emits = defineEmits(["submit"]);
|
|
31
|
+
const slots = defineSlots();
|
|
32
|
+
const { t } = useLocalePro();
|
|
33
|
+
const appConfig = useAppConfig();
|
|
34
|
+
const formRef = useTemplateRef("formRef");
|
|
35
|
+
const passwordVisibility = ref(false);
|
|
36
|
+
const state = reactive({});
|
|
37
|
+
props.fields?.forEach((f) => {
|
|
38
|
+
state[f.name] = f.defaultValue;
|
|
39
|
+
});
|
|
40
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.authForm || {} })());
|
|
41
|
+
defineExpose({ formRef, state });
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
46
|
+
<div v-if="icon || !!slots.icon || (title || !!slots.title) || (description || !!slots.description) || !!slots.header" :class="ui.header({ class: props.ui?.header })">
|
|
47
|
+
<slot name="header">
|
|
48
|
+
<div v-if="icon || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
49
|
+
<slot name="leading">
|
|
50
|
+
<UIcon v-if="icon" :name="icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
51
|
+
</slot>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
55
|
+
<slot name="title">
|
|
56
|
+
{{ title }}
|
|
57
|
+
</slot>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
61
|
+
<slot name="description">
|
|
62
|
+
{{ description }}
|
|
63
|
+
</slot>
|
|
64
|
+
</div>
|
|
65
|
+
</slot>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div :class="ui.body({ class: props.ui?.body })">
|
|
69
|
+
<div v-if="providers?.length || !!slots.providers" :class="ui.providers({ class: props.ui?.providers })">
|
|
70
|
+
<slot name="providers">
|
|
71
|
+
<UButton
|
|
72
|
+
v-for="(provider, index) in providers"
|
|
73
|
+
:key="index"
|
|
74
|
+
block
|
|
75
|
+
color="neutral"
|
|
76
|
+
variant="subtle"
|
|
77
|
+
v-bind="provider"
|
|
78
|
+
/>
|
|
79
|
+
</slot>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<USeparator
|
|
83
|
+
v-if="providers?.length && fields?.length"
|
|
84
|
+
v-bind="typeof separator === 'object' ? separator : { label: separator }"
|
|
85
|
+
:class="ui.separator({ class: props.ui?.separator })"
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<UForm
|
|
89
|
+
v-if="fields?.length"
|
|
90
|
+
ref="formRef"
|
|
91
|
+
:state="state"
|
|
92
|
+
:schema="schema"
|
|
93
|
+
:validate="validate"
|
|
94
|
+
:validate-on="validateOn"
|
|
95
|
+
:class="ui.form({ class: props.ui?.form })"
|
|
96
|
+
:disabled="disabled"
|
|
97
|
+
@submit="emits('submit', $event)"
|
|
98
|
+
>
|
|
99
|
+
<UFormField
|
|
100
|
+
v-for="field in fields"
|
|
101
|
+
:key="field.name"
|
|
102
|
+
:label="field.type === 'checkbox' ? '' : field.label ?? ''"
|
|
103
|
+
:description="field.description"
|
|
104
|
+
:help="field.help"
|
|
105
|
+
:hint="field.hint"
|
|
106
|
+
:name="field.name"
|
|
107
|
+
:size="field.size"
|
|
108
|
+
:required="field.required"
|
|
109
|
+
>
|
|
110
|
+
<slot :name="`${field.name}-field`" v-bind="{ state, field }">
|
|
111
|
+
<UCheckbox
|
|
112
|
+
v-if="field.type === 'checkbox'"
|
|
113
|
+
v-model="state[field.name]"
|
|
114
|
+
:class="ui.checkbox({ class: props.ui?.checkbox })"
|
|
115
|
+
v-bind="omit(field, ['description', 'help', 'hint', 'size'])"
|
|
116
|
+
/>
|
|
117
|
+
<USelectMenu
|
|
118
|
+
v-else-if="field.type === 'select'"
|
|
119
|
+
v-model="state[field.name]"
|
|
120
|
+
:class="ui.select({ class: props.ui?.select })"
|
|
121
|
+
v-bind="omit(field, ['description', 'help', 'hint', 'size'])"
|
|
122
|
+
/>
|
|
123
|
+
<UInput
|
|
124
|
+
v-else-if="field.type === 'password'"
|
|
125
|
+
v-model="state[field.name]"
|
|
126
|
+
:class="ui.password({ class: props.ui?.password })"
|
|
127
|
+
:type="passwordVisibility ? 'text' : 'password'"
|
|
128
|
+
v-bind="omit(field, ['label', 'description', 'help', 'hint', 'size', 'type', 'required', 'defaultValue'])"
|
|
129
|
+
:ui="{ root: 'w-full' }"
|
|
130
|
+
>
|
|
131
|
+
<template #trailing>
|
|
132
|
+
<UButton
|
|
133
|
+
color="neutral"
|
|
134
|
+
variant="link"
|
|
135
|
+
size="sm"
|
|
136
|
+
:icon="passwordVisibility ? appConfig.ui.icons.eyeOff : appConfig.ui.icons.eye"
|
|
137
|
+
:aria-label="passwordVisibility ? t('authForm.hidePassword') : t('authForm.showPassword')"
|
|
138
|
+
:aria-pressed="passwordVisibility"
|
|
139
|
+
aria-controls="password"
|
|
140
|
+
@click="passwordVisibility = !passwordVisibility"
|
|
141
|
+
/>
|
|
142
|
+
</template>
|
|
143
|
+
</UInput>
|
|
144
|
+
<UPinInput
|
|
145
|
+
v-else-if="field.type === 'otp'"
|
|
146
|
+
:id="field.name"
|
|
147
|
+
v-model="state[field.name]"
|
|
148
|
+
:class="ui.otp({ class: props.ui?.otp })"
|
|
149
|
+
otp
|
|
150
|
+
v-bind="field.otp"
|
|
151
|
+
/>
|
|
152
|
+
<UInput
|
|
153
|
+
v-else
|
|
154
|
+
v-model="state[field.name]"
|
|
155
|
+
:class="ui.input({ class: props.ui?.input })"
|
|
156
|
+
v-bind="omit(field, ['label', 'description', 'help', 'hint', 'size', 'required', 'defaultValue'])"
|
|
157
|
+
/>
|
|
158
|
+
</slot>
|
|
159
|
+
|
|
160
|
+
<template v-if="!!slots[`${field.name}-label`]" #label>
|
|
161
|
+
<slot :name="`${field.name}-label`" />
|
|
162
|
+
</template>
|
|
163
|
+
<template v-if="!!slots[`${field.name}-description`]" #description>
|
|
164
|
+
<slot :name="`${field.name}-description`" />
|
|
165
|
+
</template>
|
|
166
|
+
<template v-if="!!slots[`${field.name}-hint`]" #hint>
|
|
167
|
+
<slot :name="`${field.name}-hint`" />
|
|
168
|
+
</template>
|
|
169
|
+
<template v-if="!!slots[`${field.name}-help`]" #help>
|
|
170
|
+
<slot :name="`${field.name}-help`" />
|
|
171
|
+
</template>
|
|
172
|
+
<template v-if="!!slots[`${field.name}-error`]" #error>
|
|
173
|
+
<slot :name="`${field.name}-error`" />
|
|
174
|
+
</template>
|
|
175
|
+
</UFormField>
|
|
176
|
+
|
|
177
|
+
<slot v-if="!!slots.validation" name="validation" />
|
|
178
|
+
|
|
179
|
+
<slot name="submit" :loading="loading">
|
|
180
|
+
<UButton
|
|
181
|
+
type="submit"
|
|
182
|
+
:label="t('authForm.submit')"
|
|
183
|
+
block
|
|
184
|
+
:loading="loading"
|
|
185
|
+
v-bind="submit"
|
|
186
|
+
/>
|
|
187
|
+
</slot>
|
|
188
|
+
</UForm>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
192
|
+
<slot name="footer" />
|
|
193
|
+
</div>
|
|
194
|
+
</Primitive>
|
|
195
|
+
</template>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import theme from '#build/ui/auth-form';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { ButtonProps, FormProps, FormFieldProps, FormSchema, FormSubmitEvent, SeparatorProps, ComponentConfig, PinInputProps } from '../types';
|
|
4
|
+
type AuthForm = ComponentConfig<typeof theme, AppConfig, 'authForm'>;
|
|
5
|
+
type AuthFormField = FormFieldProps & {
|
|
6
|
+
name: string;
|
|
7
|
+
type?: 'checkbox' | 'select' | 'password' | 'text' | 'otp';
|
|
8
|
+
defaultValue?: any;
|
|
9
|
+
otp?: PinInputProps;
|
|
10
|
+
};
|
|
11
|
+
export interface AuthFormProps<T extends FormSchema = FormSchema<object>, F extends AuthFormField = AuthFormField> {
|
|
12
|
+
/**
|
|
13
|
+
* The element or component this component should render as.
|
|
14
|
+
* @defaultValue 'div'
|
|
15
|
+
*/
|
|
16
|
+
as?: any;
|
|
17
|
+
/**
|
|
18
|
+
* The icon displayed above the title.
|
|
19
|
+
* @IconifyIcon
|
|
20
|
+
*/
|
|
21
|
+
icon?: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
fields?: F[];
|
|
25
|
+
/**
|
|
26
|
+
* Display a list of Button under the description.
|
|
27
|
+
* `{ color: 'neutral', variant: 'subtle', block: true }`{lang="ts-type"}
|
|
28
|
+
*/
|
|
29
|
+
providers?: ButtonProps[];
|
|
30
|
+
/**
|
|
31
|
+
* The text displayed in the separator.
|
|
32
|
+
* @defaultValue 'or'
|
|
33
|
+
*/
|
|
34
|
+
separator?: string | SeparatorProps;
|
|
35
|
+
/**
|
|
36
|
+
* Display a submit button at the bottom of the form.
|
|
37
|
+
* `{ label: 'Continue', block: true }`{lang="ts-type"}
|
|
38
|
+
*/
|
|
39
|
+
submit?: ButtonProps;
|
|
40
|
+
schema?: T;
|
|
41
|
+
validate?: FormProps<T>['validate'];
|
|
42
|
+
validateOn?: FormProps<T>['validateOn'];
|
|
43
|
+
validateOnInputDelay?: FormProps<T>['validateOnInputDelay'];
|
|
44
|
+
disabled?: FormProps<T>['disabled'];
|
|
45
|
+
loading?: ButtonProps['loading'];
|
|
46
|
+
class?: any;
|
|
47
|
+
ui?: AuthForm['slots'];
|
|
48
|
+
}
|
|
49
|
+
export type AuthFormEmits<T extends object> = {
|
|
50
|
+
submit: [payload: FormSubmitEvent<T>];
|
|
51
|
+
};
|
|
52
|
+
type DynamicFieldSlots<T, F, SlotProps = {
|
|
53
|
+
field: F;
|
|
54
|
+
state: T;
|
|
55
|
+
}> = Record<string, (props: SlotProps) => any> & Record<`${keyof T extends string ? keyof T : never}-field`, (props: SlotProps) => any>;
|
|
56
|
+
type DynamicFormFieldSlots<T> = Record<string, (props?: {}) => any> & Record<`${keyof T extends string ? keyof T : never}-${'label' | 'description' | 'hint' | 'help' | 'error'}`, (props?: {}) => any>;
|
|
57
|
+
export type AuthFormSlots<T extends object = object, F extends AuthFormField = AuthFormField> = {
|
|
58
|
+
header(props?: {}): any;
|
|
59
|
+
leading(props?: {}): any;
|
|
60
|
+
title(props?: {}): any;
|
|
61
|
+
description(props?: {}): any;
|
|
62
|
+
providers(props?: {}): any;
|
|
63
|
+
validation(props?: {}): any;
|
|
64
|
+
submit(props: {
|
|
65
|
+
loading: boolean;
|
|
66
|
+
}): any;
|
|
67
|
+
footer(props?: {}): any;
|
|
68
|
+
} & DynamicFieldSlots<T, F> & DynamicFormFieldSlots<T>;
|
|
69
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AuthFormProps<FormSchema<object>, AuthFormField>, {
|
|
70
|
+
formRef: Readonly<import("vue").ShallowRef<any>>;
|
|
71
|
+
state: Record<string, any>;
|
|
72
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
73
|
+
submit: (payload: FormSubmitEvent<any>) => any;
|
|
74
|
+
}, string, import("vue").PublicProps, Readonly<AuthFormProps<FormSchema<object>, AuthFormField>> & Readonly<{
|
|
75
|
+
onSubmit?: ((payload: FormSubmitEvent<any>) => any) | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
loading: boolean;
|
|
78
|
+
separator: string | SeparatorProps;
|
|
79
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AuthFormSlots<object, AuthFormField>>;
|
|
80
|
+
export default _default;
|
|
81
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
82
|
+
new (): {
|
|
83
|
+
$slots: S;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -53,31 +53,31 @@ function onError() {
|
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<template>
|
|
56
|
-
<component
|
|
57
|
-
:is="props.chip ? UChip : Primitive"
|
|
58
|
-
:as="as"
|
|
59
|
-
v-bind="props.chip ? typeof props.chip === 'object' ? { inset: true, ...props.chip } : { inset: true } : {}"
|
|
60
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
61
|
-
:style="props.style"
|
|
62
|
-
>
|
|
63
|
-
<component
|
|
64
|
-
:is="ImageComponent"
|
|
65
|
-
v-if="src && !error"
|
|
66
|
-
role="img"
|
|
67
|
-
:src="src"
|
|
68
|
-
:alt="alt"
|
|
69
|
-
:width="sizePx"
|
|
70
|
-
:height="sizePx"
|
|
71
|
-
v-bind="$attrs"
|
|
72
|
-
:class="ui.image({ class: props.ui?.image })"
|
|
73
|
-
@error="onError"
|
|
74
|
-
/>
|
|
75
|
-
|
|
76
|
-
<Slot v-else v-bind="$attrs">
|
|
77
|
-
<slot>
|
|
78
|
-
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
79
|
-
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || "\xA0" }}</span>
|
|
80
|
-
</slot>
|
|
81
|
-
</Slot>
|
|
82
|
-
</component>
|
|
56
|
+
<component
|
|
57
|
+
:is="props.chip ? UChip : Primitive"
|
|
58
|
+
:as="as"
|
|
59
|
+
v-bind="props.chip ? typeof props.chip === 'object' ? { inset: true, ...props.chip } : { inset: true } : {}"
|
|
60
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
61
|
+
:style="props.style"
|
|
62
|
+
>
|
|
63
|
+
<component
|
|
64
|
+
:is="ImageComponent"
|
|
65
|
+
v-if="src && !error"
|
|
66
|
+
role="img"
|
|
67
|
+
:src="src"
|
|
68
|
+
:alt="alt"
|
|
69
|
+
:width="sizePx"
|
|
70
|
+
:height="sizePx"
|
|
71
|
+
v-bind="$attrs"
|
|
72
|
+
:class="ui.image({ class: props.ui?.image })"
|
|
73
|
+
@error="onError"
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<Slot v-else v-bind="$attrs">
|
|
77
|
+
<slot>
|
|
78
|
+
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
79
|
+
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || "\xA0" }}</span>
|
|
80
|
+
</slot>
|
|
81
|
+
</Slot>
|
|
82
|
+
</component>
|
|
83
83
|
</template>
|
|
@@ -58,8 +58,8 @@ provide(avatarGroupInjectionKey, computed(() => ({
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
62
|
-
<UAvatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" />
|
|
63
|
-
<component :is="avatar" v-for="(avatar, count) in visibleAvatars" :key="count" :class="ui.base({ class: props.ui?.base })" />
|
|
64
|
-
</Primitive>
|
|
61
|
+
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
62
|
+
<UAvatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" />
|
|
63
|
+
<component :is="avatar" v-for="(avatar, count) in visibleAvatars" :key="count" :class="ui.base({ class: props.ui?.base })" />
|
|
64
|
+
</Primitive>
|
|
65
65
|
</template>
|
|
@@ -41,20 +41,20 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.badge || {} }
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<template>
|
|
44
|
-
<Primitive :as="as" :class="ui.base({ class: [props.ui?.base, props.class] })">
|
|
45
|
-
<slot name="leading">
|
|
46
|
-
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
47
|
-
<UAvatar v-else-if="!!avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
48
|
-
</slot>
|
|
49
|
-
|
|
50
|
-
<slot>
|
|
51
|
-
<span v-if="label !== void 0 && label !== null" :class="ui.label({ class: props.ui?.label })">
|
|
52
|
-
{{ label }}
|
|
53
|
-
</span>
|
|
54
|
-
</slot>
|
|
55
|
-
|
|
56
|
-
<slot name="trailing">
|
|
57
|
-
<UIcon v-if="isTrailing && trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
58
|
-
</slot>
|
|
59
|
-
</Primitive>
|
|
44
|
+
<Primitive :as="as" :class="ui.base({ class: [props.ui?.base, props.class] })">
|
|
45
|
+
<slot name="leading">
|
|
46
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
47
|
+
<UAvatar v-else-if="!!avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
48
|
+
</slot>
|
|
49
|
+
|
|
50
|
+
<slot>
|
|
51
|
+
<span v-if="label !== void 0 && label !== null" :class="ui.label({ class: props.ui?.label })">
|
|
52
|
+
{{ label }}
|
|
53
|
+
</span>
|
|
54
|
+
</slot>
|
|
55
|
+
|
|
56
|
+
<slot name="trailing">
|
|
57
|
+
<UIcon v-if="isTrailing && trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
58
|
+
</slot>
|
|
59
|
+
</Primitive>
|
|
60
60
|
</template>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/banner";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, watch } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useHead, useAppConfig } from "#imports";
|
|
9
|
+
import { useLocalePro } from "../composables/useLocalePro";
|
|
10
|
+
import { tv } from "../utils/tv";
|
|
11
|
+
defineOptions({ inheritAttrs: false });
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
id: { type: String, required: false },
|
|
15
|
+
icon: { type: String, required: false },
|
|
16
|
+
title: { type: String, required: false },
|
|
17
|
+
actions: { type: Array, required: false },
|
|
18
|
+
to: { type: null, required: false },
|
|
19
|
+
target: { type: [String, Object, null], required: false },
|
|
20
|
+
color: { type: null, required: false },
|
|
21
|
+
close: { type: [Boolean, Object], required: false },
|
|
22
|
+
closeIcon: { type: String, required: false },
|
|
23
|
+
class: { type: null, required: false },
|
|
24
|
+
ui: { type: null, required: false }
|
|
25
|
+
});
|
|
26
|
+
const slots = defineSlots();
|
|
27
|
+
const emits = defineEmits(["close"]);
|
|
28
|
+
const { t } = useLocalePro();
|
|
29
|
+
const appConfig = useAppConfig();
|
|
30
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.banner || {} })({
|
|
31
|
+
color: props.color,
|
|
32
|
+
to: !!props.to
|
|
33
|
+
}));
|
|
34
|
+
const id = computed(() => `banner-${props.id || "1"}`);
|
|
35
|
+
watch(id, (newId) => {
|
|
36
|
+
if (typeof document === "undefined" || typeof localStorage === "undefined") return;
|
|
37
|
+
const isClosed = localStorage.getItem(newId) === "true";
|
|
38
|
+
const htmlElement = document.querySelector("html");
|
|
39
|
+
htmlElement?.classList.toggle("hide-banner", isClosed);
|
|
40
|
+
});
|
|
41
|
+
useHead({
|
|
42
|
+
script: [{
|
|
43
|
+
key: "prehydrate-template-banner",
|
|
44
|
+
innerHTML: `
|
|
45
|
+
if (localStorage.getItem('${id.value}') === 'true') {
|
|
46
|
+
document.querySelector('html').classList.add('hide-banner')
|
|
47
|
+
}`.replace(/\s+/g, " "),
|
|
48
|
+
type: "text/javascript"
|
|
49
|
+
}]
|
|
50
|
+
});
|
|
51
|
+
function onClose() {
|
|
52
|
+
localStorage.setItem(id.value, "true");
|
|
53
|
+
document.querySelector("html")?.classList.add("hide-banner");
|
|
54
|
+
emits("close");
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<Primitive :as="as" class="banner" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
60
|
+
<ULink
|
|
61
|
+
v-if="to"
|
|
62
|
+
:aria-label="title"
|
|
63
|
+
v-bind="{ to, target, ...$attrs }"
|
|
64
|
+
class="focus:outline-none"
|
|
65
|
+
tabindex="-1"
|
|
66
|
+
raw
|
|
67
|
+
>
|
|
68
|
+
<span class="absolute inset-0 " aria-hidden="true" />
|
|
69
|
+
</ULink>
|
|
70
|
+
|
|
71
|
+
<UContainer :class="ui.container({ class: props.ui?.container })">
|
|
72
|
+
<div :class="ui.left({ class: props.ui?.left })" />
|
|
73
|
+
|
|
74
|
+
<div :class="ui.center({ class: props.ui?.center })">
|
|
75
|
+
<slot name="leading">
|
|
76
|
+
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
77
|
+
</slot>
|
|
78
|
+
|
|
79
|
+
<div v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
80
|
+
<slot name="title">
|
|
81
|
+
{{ title }}
|
|
82
|
+
</slot>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div v-if="actions?.length" :class="ui.actions({ class: props.ui?.actions })">
|
|
86
|
+
<slot name="actions">
|
|
87
|
+
<UButton v-for="(action, index) in actions" :key="index" color="neutral" size="xs" v-bind="action" />
|
|
88
|
+
</slot>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div :class="ui.right({ class: props.ui?.right })">
|
|
93
|
+
<slot name="close" :ui="ui">
|
|
94
|
+
<UButton
|
|
95
|
+
v-if="close"
|
|
96
|
+
:icon="closeIcon || appConfig.ui.icons.close"
|
|
97
|
+
size="md"
|
|
98
|
+
color="neutral"
|
|
99
|
+
variant="ghost"
|
|
100
|
+
:aria-label="t('banner.close')"
|
|
101
|
+
v-bind="typeof close === 'object' ? close : {}"
|
|
102
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
103
|
+
@click="onClose"
|
|
104
|
+
/>
|
|
105
|
+
</slot>
|
|
106
|
+
</div>
|
|
107
|
+
</UContainer>
|
|
108
|
+
</Primitive>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.hide-banner .banner{display:none}
|
|
113
|
+
</style>
|