@eslamdevui/ui 3.2.0 → 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/alert.ts +5 -0
- package/.nuxt/ui/auth-form.ts +20 -0
- package/.nuxt/ui/badge.ts +5 -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/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +5 -0
- package/.nuxt/ui/carousel.ts +5 -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 +341 -0
- package/.nuxt/ui/content/content-search-button.ts +6 -0
- package/.nuxt/ui/content/content-search.ts +6 -0
- package/.nuxt/ui/content/content-surround.ts +39 -0
- package/.nuxt/ui/content/content-toc.ts +150 -0
- package/.nuxt/ui/content/index.ts +5 -0
- package/.nuxt/ui/content-navigation.ts +6 -4
- package/.nuxt/ui/content-surround.ts +5 -0
- package/.nuxt/ui/dashboard-navbar.ts +5 -0
- package/.nuxt/ui/dashboard-sidebar-collapse.ts +5 -0
- package/.nuxt/ui/dashboard-sidebar-toggle.ts +5 -0
- package/.nuxt/ui/dashboard-sidebar.ts +10 -0
- package/.nuxt/ui/error.ts +9 -0
- 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 +80 -2
- package/.nuxt/ui/input-menu.ts +9 -0
- package/.nuxt/ui/input-number.ts +5 -0
- package/.nuxt/ui/input-tags.ts +9 -0
- package/.nuxt/ui/input.ts +9 -0
- 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/prose/a.ts +6 -0
- package/.nuxt/ui/prose/accordion-item.ts +3 -0
- package/.nuxt/ui/prose/accordion.ts +6 -0
- package/.nuxt/ui/prose/badge.ts +3 -0
- package/.nuxt/ui/prose/blockquote.ts +3 -0
- package/.nuxt/ui/prose/callout.ts +129 -0
- package/.nuxt/ui/prose/card-group.ts +3 -0
- package/.nuxt/ui/prose/card.ts +119 -0
- package/.nuxt/ui/prose/code-collapse.ts +19 -0
- package/.nuxt/ui/prose/code-group.ts +13 -0
- package/.nuxt/ui/prose/code-icon.ts +66 -0
- package/.nuxt/ui/prose/code-preview.ts +14 -0
- package/.nuxt/ui/prose/code-tree.ts +28 -0
- package/.nuxt/ui/prose/code.ts +27 -0
- package/.nuxt/ui/prose/collapsible.ts +12 -0
- package/.nuxt/ui/prose/em.ts +3 -0
- package/.nuxt/ui/prose/field-group.ts +3 -0
- package/.nuxt/ui/prose/field.ts +11 -0
- package/.nuxt/ui/prose/h1.ts +6 -0
- package/.nuxt/ui/prose/h2.ts +14 -0
- package/.nuxt/ui/prose/h3.ts +14 -0
- package/.nuxt/ui/prose/h4.ts +6 -0
- package/.nuxt/ui/prose/hr.ts +3 -0
- package/.nuxt/ui/prose/icon.ts +3 -0
- package/.nuxt/ui/prose/img.ts +3 -0
- package/.nuxt/ui/prose/index.ts +41 -0
- package/.nuxt/ui/prose/kbd.ts +3 -0
- package/.nuxt/ui/prose/li.ts +3 -0
- package/.nuxt/ui/prose/ol.ts +3 -0
- package/.nuxt/ui/prose/p.ts +3 -0
- package/.nuxt/ui/prose/pre.ts +17 -0
- package/.nuxt/ui/prose/steps.ts +19 -0
- package/.nuxt/ui/prose/strong.ts +3 -0
- package/.nuxt/ui/prose/table.ts +6 -0
- package/.nuxt/ui/prose/tabs-item.ts +3 -0
- package/.nuxt/ui/prose/tabs.ts +5 -0
- package/.nuxt/ui/prose/tbody.ts +3 -0
- package/.nuxt/ui/prose/td.ts +3 -0
- package/.nuxt/ui/prose/th.ts +3 -0
- package/.nuxt/ui/prose/thead.ts +3 -0
- package/.nuxt/ui/prose/tr.ts +3 -0
- package/.nuxt/ui/prose/ul.ts +3 -0
- package/.nuxt/ui/select-menu.ts +9 -0
- package/.nuxt/ui/select.ts +9 -0
- package/.nuxt/ui/textarea.ts +9 -0
- package/.nuxt/ui/toast.ts +5 -0
- package/.nuxt/ui/user.ts +106 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/AuthForm.vue +195 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +85 -0
- 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/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/ChatPalette.vue +32 -0
- package/dist/runtime/components/ChatPalette.vue.d.ts +24 -0
- package/dist/runtime/components/ChatPrompt.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue.d.ts +3 -3
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -1
- 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/Header.vue +137 -0
- package/dist/runtime/components/Header.vue.d.ts +72 -0
- package/dist/runtime/components/InputMenu.vue.d.ts +3 -3
- package/dist/runtime/components/Main.vue +23 -0
- package/dist/runtime/components/Main.vue.d.ts +20 -0
- 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/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/SelectMenu.vue.d.ts +3 -3
- package/dist/runtime/components/Tabs.vue +1 -0
- package/dist/runtime/components/User.vue +69 -0
- package/dist/runtime/components/User.vue.d.ts +46 -0
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +57 -11
- package/dist/runtime/components/content/ContentSurround.vue +2 -2
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +45 -52
- package/dist/runtime/components/content/ContentToc.vue +27 -15
- package/dist/runtime/components/content/ContentToc.vue.d.ts +79 -81
- package/dist/runtime/types/index.d.ts +33 -0
- package/dist/runtime/types/index.js +33 -0
- 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/.nuxt/ui/prose.ts +0 -321
package/.nuxt/ui/user.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const orientation = [
|
|
2
|
+
"horizontal",
|
|
3
|
+
"vertical"
|
|
4
|
+
] as const
|
|
5
|
+
|
|
6
|
+
const size = [
|
|
7
|
+
"3xs",
|
|
8
|
+
"2xs",
|
|
9
|
+
"xs",
|
|
10
|
+
"sm",
|
|
11
|
+
"md",
|
|
12
|
+
"lg",
|
|
13
|
+
"xl",
|
|
14
|
+
"2xl",
|
|
15
|
+
"3xl"
|
|
16
|
+
] as const
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
"slots": {
|
|
20
|
+
"root": "relative group/user",
|
|
21
|
+
"wrapper": "",
|
|
22
|
+
"name": "font-medium",
|
|
23
|
+
"description": "text-muted",
|
|
24
|
+
"avatar": "shrink-0"
|
|
25
|
+
},
|
|
26
|
+
"variants": {
|
|
27
|
+
"orientation": {
|
|
28
|
+
"horizontal": {
|
|
29
|
+
"root": "flex items-center"
|
|
30
|
+
},
|
|
31
|
+
"vertical": {
|
|
32
|
+
"root": "flex flex-col"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"to": {
|
|
36
|
+
"true": {
|
|
37
|
+
"name": [
|
|
38
|
+
"text-default peer-hover:text-highlighted",
|
|
39
|
+
"transition-colors"
|
|
40
|
+
],
|
|
41
|
+
"description": [
|
|
42
|
+
"peer-hover:text-toned",
|
|
43
|
+
"transition-colors"
|
|
44
|
+
],
|
|
45
|
+
"avatar": "transform transition-transform duration-200 group-hover/user:scale-115"
|
|
46
|
+
},
|
|
47
|
+
"false": {
|
|
48
|
+
"name": "text-highlighted",
|
|
49
|
+
"description": ""
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"size": {
|
|
53
|
+
"3xs": {
|
|
54
|
+
"root": "gap-1",
|
|
55
|
+
"wrapper": "flex items-center gap-1",
|
|
56
|
+
"name": "text-xs",
|
|
57
|
+
"description": "text-xs"
|
|
58
|
+
},
|
|
59
|
+
"2xs": {
|
|
60
|
+
"root": "gap-1.5",
|
|
61
|
+
"wrapper": "flex items-center gap-1.5",
|
|
62
|
+
"name": "text-xs",
|
|
63
|
+
"description": "text-xs"
|
|
64
|
+
},
|
|
65
|
+
"xs": {
|
|
66
|
+
"root": "gap-1.5",
|
|
67
|
+
"wrapper": "flex items-center gap-1.5",
|
|
68
|
+
"name": "text-xs",
|
|
69
|
+
"description": "text-xs"
|
|
70
|
+
},
|
|
71
|
+
"sm": {
|
|
72
|
+
"root": "gap-2",
|
|
73
|
+
"name": "text-xs",
|
|
74
|
+
"description": "text-xs"
|
|
75
|
+
},
|
|
76
|
+
"md": {
|
|
77
|
+
"root": "gap-2",
|
|
78
|
+
"name": "text-sm",
|
|
79
|
+
"description": "text-xs"
|
|
80
|
+
},
|
|
81
|
+
"lg": {
|
|
82
|
+
"root": "gap-2.5",
|
|
83
|
+
"name": "text-sm",
|
|
84
|
+
"description": "text-sm"
|
|
85
|
+
},
|
|
86
|
+
"xl": {
|
|
87
|
+
"root": "gap-2.5",
|
|
88
|
+
"name": "text-base",
|
|
89
|
+
"description": "text-sm"
|
|
90
|
+
},
|
|
91
|
+
"2xl": {
|
|
92
|
+
"root": "gap-3",
|
|
93
|
+
"name": "text-base",
|
|
94
|
+
"description": "text-base"
|
|
95
|
+
},
|
|
96
|
+
"3xl": {
|
|
97
|
+
"root": "gap-3",
|
|
98
|
+
"name": "text-lg",
|
|
99
|
+
"description": "text-base"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"defaultVariants": {
|
|
104
|
+
"size": "md" as typeof size[number]
|
|
105
|
+
}
|
|
106
|
+
}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, hasNuxtModule, addComponentsDir, addImportsDir, installModule } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates } from './shared/ui.
|
|
3
|
+
import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates } from './shared/ui.DErCA3YU.mjs';
|
|
4
4
|
import '../dist/runtime/utils/index.js';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'scule';
|
|
@@ -8,7 +8,7 @@ import 'tailwindcss/colors';
|
|
|
8
8
|
import 'knitwork';
|
|
9
9
|
|
|
10
10
|
const name = "@eslamdevui/ui";
|
|
11
|
-
const version = "3.2.
|
|
11
|
+
const version = "3.2.1";
|
|
12
12
|
|
|
13
13
|
const module = defineNuxtModule({
|
|
14
14
|
meta: {
|
|
@@ -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
|
+
};
|
|
@@ -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>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import theme from '#build/ui/banner';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { ButtonProps, LinkProps, ComponentConfig } from '../types';
|
|
4
|
+
type Banner = ComponentConfig<typeof theme, AppConfig, 'banner'>;
|
|
5
|
+
export interface BannerProps {
|
|
6
|
+
/**
|
|
7
|
+
* The element or component this component should render as.
|
|
8
|
+
* @defaultValue 'div'
|
|
9
|
+
*/
|
|
10
|
+
as?: any;
|
|
11
|
+
/**
|
|
12
|
+
* A unique id saved to local storage to remember if the banner has been dismissed.
|
|
13
|
+
* Change this value to show the banner again.
|
|
14
|
+
* @defaultValue '1'
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The icon displayed next to the title.
|
|
19
|
+
* @IconifyIcon
|
|
20
|
+
*/
|
|
21
|
+
icon?: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Display a list of actions next to the title.
|
|
25
|
+
* `{ color: 'neutral', size: 'xs' }`{lang="ts-type"}
|
|
26
|
+
*/
|
|
27
|
+
actions?: ButtonProps[];
|
|
28
|
+
to?: LinkProps['to'];
|
|
29
|
+
target?: LinkProps['target'];
|
|
30
|
+
/**
|
|
31
|
+
* @defaultValue 'primary'
|
|
32
|
+
*/
|
|
33
|
+
color?: Banner['variants']['color'];
|
|
34
|
+
/**
|
|
35
|
+
* Display a close button to dismiss the banner.
|
|
36
|
+
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
37
|
+
* @emits `close`
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
close?: boolean | Partial<ButtonProps>;
|
|
41
|
+
/**
|
|
42
|
+
* The icon displayed in the close button.
|
|
43
|
+
* @defaultValue appConfig.ui.icons.close
|
|
44
|
+
* @IconifyIcon
|
|
45
|
+
*/
|
|
46
|
+
closeIcon?: string;
|
|
47
|
+
class?: any;
|
|
48
|
+
ui?: Banner['slots'];
|
|
49
|
+
}
|
|
50
|
+
export interface BannerSlots {
|
|
51
|
+
leading(props?: {}): any;
|
|
52
|
+
title(props?: {}): any;
|
|
53
|
+
actions(props?: {}): any;
|
|
54
|
+
close(props: {
|
|
55
|
+
ui: any;
|
|
56
|
+
}): any;
|
|
57
|
+
}
|
|
58
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<BannerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
+
close: (...args: any[]) => void;
|
|
60
|
+
}, string, import("vue").PublicProps, Readonly<BannerProps> & Readonly<{
|
|
61
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
62
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, BannerSlots>;
|
|
63
|
+
export default _default;
|
|
64
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
65
|
+
new (): {
|
|
66
|
+
$slots: S;
|
|
67
|
+
};
|
|
68
|
+
};
|