numori-ui 0.3.0 → 0.5.0
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/CHANGELOG.md +148 -0
- package/README.md +36 -34
- package/dist/components/AppShell.js +234 -0
- package/dist/components/AppShell.js.map +1 -0
- package/dist/components/Banner.js +29 -32
- package/dist/components/Banner.js.map +1 -1
- package/dist/components/Button.js +10 -19
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +15 -9
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.js +13 -9
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/CopyField.js +195 -0
- package/dist/components/CopyField.js.map +1 -0
- package/dist/components/DescriptionList.js +116 -0
- package/dist/components/DescriptionList.js.map +1 -0
- package/dist/components/Dropdown.js +10 -3
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/DropdownSubmenu.js +5 -3
- package/dist/components/DropdownSubmenu.js.map +1 -1
- package/dist/components/EmptyState.js +123 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/FileInput.js +12 -4
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/FormField.js +43 -13
- package/dist/components/FormField.js.map +1 -1
- package/dist/components/IconTile.js +5 -9
- package/dist/components/IconTile.js.map +1 -1
- package/dist/components/Input.js +21 -7
- package/dist/components/Input.js.map +1 -1
- package/dist/components/ListMenuItem.js +38 -31
- package/dist/components/ListMenuItem.js.map +1 -1
- package/dist/components/Numpad.js +4 -4
- package/dist/components/Numpad.js.map +1 -1
- package/dist/components/PageHeader.js +106 -0
- package/dist/components/PageHeader.js.map +1 -0
- package/dist/components/Pagination.js +236 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Popup.js +9 -3
- package/dist/components/Popup.js.map +1 -1
- package/dist/components/Radio.js +2 -7
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Segmented.js +109 -27
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +16 -5
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Sidebar.js +69 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/SidebarGroup.js +50 -0
- package/dist/components/SidebarGroup.js.map +1 -0
- package/dist/components/SidebarItem.js +167 -0
- package/dist/components/SidebarItem.js.map +1 -0
- package/dist/components/StatCard.js +185 -0
- package/dist/components/StatCard.js.map +1 -0
- package/dist/components/Table.js +306 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.js +216 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Toggle.js +11 -2
- package/dist/components/Toggle.js.map +1 -1
- package/dist/components/index.js +91 -76
- package/dist/components/index.js.map +1 -1
- package/dist/composables/useMergedClasses.js +52 -0
- package/dist/composables/useMergedClasses.js.map +1 -0
- package/dist/icons/mdi.js +11 -0
- package/dist/icons/mdi.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +47 -37
- package/dist/index.js.map +1 -1
- package/dist/internal/controlSizes.js +21 -0
- package/dist/internal/controlSizes.js.map +1 -0
- package/dist/internal/formField.js +26 -0
- package/dist/internal/formField.js.map +1 -0
- package/dist/internal/menu.js +20 -0
- package/dist/internal/menu.js.map +1 -0
- package/dist/manifest.js +12 -2
- package/dist/manifest.js.map +1 -1
- package/package.json +2 -1
- package/src/components/AppShell.vue +231 -0
- package/src/components/Banner.vue +20 -9
- package/src/components/Button.vue +12 -19
- package/src/components/Card.vue +11 -12
- package/src/components/Checkbox.vue +7 -10
- package/src/components/CopyField.vue +178 -0
- package/src/components/DescriptionList.vue +114 -0
- package/src/components/Dropdown.vue +14 -2
- package/src/components/DropdownSubmenu.vue +4 -2
- package/src/components/EmptyState.vue +107 -0
- package/src/components/FileInput.vue +19 -4
- package/src/components/FormField.vue +37 -4
- package/src/components/IconTile.vue +4 -9
- package/src/components/Input.vue +15 -6
- package/src/components/ListMenuItem.vue +21 -5
- package/src/components/Numpad.vue +7 -4
- package/src/components/PageHeader.vue +102 -0
- package/src/components/Pagination.vue +199 -0
- package/src/components/Popup.vue +6 -2
- package/src/components/Radio.vue +2 -10
- package/src/components/Segmented.vue +113 -38
- package/src/components/Select.vue +16 -2
- package/src/components/Sidebar.vue +61 -0
- package/src/components/SidebarGroup.vue +43 -0
- package/src/components/SidebarItem.vue +159 -0
- package/src/components/StatCard.vue +165 -0
- package/src/components/Table.vue +323 -0
- package/src/components/Tabs.vue +217 -0
- package/src/components/Toggle.vue +5 -0
- package/src/components/index.js +36 -11
- package/src/composables/useMergedClasses.js +49 -0
- package/src/icons/mdi.js +11 -0
- package/src/internal/controlSizes.js +17 -0
- package/src/internal/formField.js +23 -0
- package/src/internal/menu.js +16 -0
- package/src/manifest.js +12 -2
- package/dist/components/ButtonsGroup.js +0 -153
- package/dist/components/ButtonsGroup.js.map +0 -1
- package/dist/components/ComparisonTable.js +0 -152
- package/dist/components/ComparisonTable.js.map +0 -1
- package/src/components/ButtonsGroup.vue +0 -140
- package/src/components/ComparisonTable.vue +0 -141
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useMergedClasses } from "../composables/useMergedClasses.js";
|
|
2
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, mergeProps, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, unref } from "vue";
|
|
3
|
+
//#region src/components/DescriptionList.vue
|
|
4
|
+
var _hoisted_1 = { class: "text-sm font-medium text-gray-500 dark:text-gray-400" };
|
|
5
|
+
var _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "mt-0.5 block text-xs font-normal text-gray-400 dark:text-gray-500"
|
|
8
|
+
};
|
|
9
|
+
var _hoisted_3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "text-gray-400 dark:text-gray-500"
|
|
12
|
+
};
|
|
13
|
+
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
14
|
+
__name: "DescriptionList",
|
|
15
|
+
props: {
|
|
16
|
+
/**
|
|
17
|
+
* Pairs to show. Each is `{ label, value, key?, hint?, mono? }`; `mono`
|
|
18
|
+
* renders the value in a monospace font that breaks anywhere (ids, keys).
|
|
19
|
+
* @type {Array<{ label: string, value?: unknown, key?: string, hint?: string, mono?: boolean }>}
|
|
20
|
+
*/
|
|
21
|
+
items: {
|
|
22
|
+
type: Array,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Arrangement of each pair.
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @default 'inline'
|
|
29
|
+
* @values 'inline' | 'stacked' | 'grid'
|
|
30
|
+
*/
|
|
31
|
+
layout: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "inline"
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Dividers between rows (ignored by `grid`).
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
divided: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Shown in place of an empty value.
|
|
46
|
+
* @type {string}
|
|
47
|
+
* @default '—'
|
|
48
|
+
*/
|
|
49
|
+
emptyText: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "—"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setup(__props) {
|
|
55
|
+
/**
|
|
56
|
+
* UiDescriptionList — label / value pairs, such as a record's details or a
|
|
57
|
+
* service's settings, rendered as a real `<dl>`.
|
|
58
|
+
*
|
|
59
|
+
* Three layouts:
|
|
60
|
+
* - `inline` (default): label in a narrow left column, value beside it, one
|
|
61
|
+
* pair per row with dividers. Stacks on narrow screens.
|
|
62
|
+
* - `stacked`: label above value, one pair per row.
|
|
63
|
+
* - `grid`: label above value, pairs flowing into two columns.
|
|
64
|
+
*
|
|
65
|
+
* Empty values (`null`, `undefined`, `''`) render `emptyText` so a missing
|
|
66
|
+
* setting reads as deliberate rather than as a rendering bug. Use the `#value`
|
|
67
|
+
* slot to render badges, links or copy fields.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* <UiDescriptionList
|
|
71
|
+
* :items="[
|
|
72
|
+
* { label: 'App id', value: 'notes', mono: true },
|
|
73
|
+
* { label: 'Storage', value: 'postgres' },
|
|
74
|
+
* { label: 'Audience', value: null, hint: 'Optional app/aud claim' },
|
|
75
|
+
* ]"
|
|
76
|
+
* />
|
|
77
|
+
*
|
|
78
|
+
* @example Custom value rendering
|
|
79
|
+
* <UiDescriptionList :items="items">
|
|
80
|
+
* <template #value="{ item, value }">
|
|
81
|
+
* <UiBadge v-if="item.key === 'status'" color="green">{{ value }}</UiBadge>
|
|
82
|
+
* <template v-else>{{ value }}</template>
|
|
83
|
+
* </template>
|
|
84
|
+
* </UiDescriptionList>
|
|
85
|
+
*
|
|
86
|
+
* @slot value — Custom value content. Scope: `{ item, value }`.
|
|
87
|
+
*/
|
|
88
|
+
const props = __props;
|
|
89
|
+
const isEmpty = (value) => value === null || value === void 0 || value === "";
|
|
90
|
+
const rowClass = computed(() => {
|
|
91
|
+
if (props.layout === "grid") return "";
|
|
92
|
+
if (props.layout === "stacked") return "py-3 first:pt-0 last:pb-0";
|
|
93
|
+
return "py-3 first:pt-0 last:pb-0 sm:grid sm:grid-cols-3 sm:gap-4";
|
|
94
|
+
});
|
|
95
|
+
const internalClasses = computed(() => {
|
|
96
|
+
if (props.layout === "grid") return "grid gap-x-6 gap-y-4 sm:grid-cols-2";
|
|
97
|
+
return props.divided ? "divide-y divide-gray-100 dark:divide-gray-800" : "";
|
|
98
|
+
});
|
|
99
|
+
const { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value);
|
|
100
|
+
return (_ctx, _cache) => {
|
|
101
|
+
return openBlock(), createElementBlock("dl", mergeProps({ class: unref(mergedClasses) }, unref(restAttrs)), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
102
|
+
return openBlock(), createElementBlock("div", {
|
|
103
|
+
key: item.key ?? item.label ?? index,
|
|
104
|
+
class: normalizeClass(rowClass.value)
|
|
105
|
+
}, [createElementVNode("dt", _hoisted_1, [createTextVNode(toDisplayString(item.label) + " ", 1), item.hint ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(item.hint), 1)) : createCommentVNode("", true)]), createElementVNode("dd", { class: normalizeClass(["min-w-0 text-sm text-gray-900 dark:text-gray-100", [item.mono ? "font-mono text-[13px] break-all" : "break-words", __props.layout === "inline" ? "mt-1 sm:col-span-2 sm:mt-0" : "mt-1"]]) }, [renderSlot(_ctx.$slots, "value", {
|
|
106
|
+
item,
|
|
107
|
+
value: item.value
|
|
108
|
+
}, () => [isEmpty(item.value) ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.emptyText), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(item.value), 1)], 64))])], 2)], 2);
|
|
109
|
+
}), 128))], 16);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//#endregion
|
|
114
|
+
export { _sfc_main as default };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=DescriptionList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionList.js","names":[],"sources":["../../src/components/DescriptionList.vue"],"sourcesContent":["<template>\n <dl :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <div v-for=\"(item, index) in items\" :key=\"item.key ?? item.label ?? index\" :class=\"rowClass\">\n <dt class=\"text-sm font-medium text-gray-500 dark:text-gray-400\">\n {{ item.label }}\n <span\n v-if=\"item.hint\"\n class=\"mt-0.5 block text-xs font-normal text-gray-400 dark:text-gray-500\"\n >{{ item.hint }}</span\n >\n </dt>\n <dd\n class=\"min-w-0 text-sm text-gray-900 dark:text-gray-100\"\n :class=\"[\n item.mono ? 'font-mono text-[13px] break-all' : 'break-words',\n layout === 'inline' ? 'mt-1 sm:col-span-2 sm:mt-0' : 'mt-1',\n ]\"\n >\n <slot name=\"value\" :item=\"item\" :value=\"item.value\">\n <span v-if=\"isEmpty(item.value)\" class=\"text-gray-400 dark:text-gray-500\">{{\n emptyText\n }}</span>\n <template v-else>{{ item.value }}</template>\n </slot>\n </dd>\n </div>\n </dl>\n</template>\n\n<script setup>\n/**\n * UiDescriptionList — label / value pairs, such as a record's details or a\n * service's settings, rendered as a real `<dl>`.\n *\n * Three layouts:\n * - `inline` (default): label in a narrow left column, value beside it, one\n * pair per row with dividers. Stacks on narrow screens.\n * - `stacked`: label above value, one pair per row.\n * - `grid`: label above value, pairs flowing into two columns.\n *\n * Empty values (`null`, `undefined`, `''`) render `emptyText` so a missing\n * setting reads as deliberate rather than as a rendering bug. Use the `#value`\n * slot to render badges, links or copy fields.\n *\n * @example\n * <UiDescriptionList\n * :items=\"[\n * { label: 'App id', value: 'notes', mono: true },\n * { label: 'Storage', value: 'postgres' },\n * { label: 'Audience', value: null, hint: 'Optional app/aud claim' },\n * ]\"\n * />\n *\n * @example Custom value rendering\n * <UiDescriptionList :items=\"items\">\n * <template #value=\"{ item, value }\">\n * <UiBadge v-if=\"item.key === 'status'\" color=\"green\">{{ value }}</UiBadge>\n * <template v-else>{{ value }}</template>\n * </template>\n * </UiDescriptionList>\n *\n * @slot value — Custom value content. Scope: `{ item, value }`.\n */\nimport { computed } from 'vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\nconst props = defineProps({\n /**\n * Pairs to show. Each is `{ label, value, key?, hint?, mono? }`; `mono`\n * renders the value in a monospace font that breaks anywhere (ids, keys).\n * @type {Array<{ label: string, value?: unknown, key?: string, hint?: string, mono?: boolean }>}\n */\n items: { type: Array, required: true },\n\n /**\n * Arrangement of each pair.\n * @type {string}\n * @default 'inline'\n * @values 'inline' | 'stacked' | 'grid'\n */\n layout: { type: String, default: 'inline' },\n\n /**\n * Dividers between rows (ignored by `grid`).\n * @type {boolean}\n * @default true\n */\n divided: { type: Boolean, default: true },\n\n /**\n * Shown in place of an empty value.\n * @type {string}\n * @default '—'\n */\n emptyText: { type: String, default: '—' },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst isEmpty = (value) => value === null || value === undefined || value === ''\n\nconst rowClass = computed(() => {\n if (props.layout === 'grid') return ''\n if (props.layout === 'stacked') return 'py-3 first:pt-0 last:pb-0'\n return 'py-3 first:pt-0 last:pb-0 sm:grid sm:grid-cols-3 sm:gap-4'\n})\n\nconst internalClasses = computed(() => {\n if (props.layout === 'grid') return 'grid gap-x-6 gap-y-4 sm:grid-cols-2'\n return props.divided ? 'divide-y divide-gray-100 dark:divide-gray-800' : ''\n})\n\nconst { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,MAAM,QAAQ;EAiCd,MAAM,WAAW,UAAU,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;EAE9E,MAAM,WAAW,eAAe;GAC9B,IAAI,MAAM,WAAW,QAAQ,OAAO;GACpC,IAAI,MAAM,WAAW,WAAW,OAAO;GACvC,OAAO;EACT,CAAC;EAED,MAAM,kBAAkB,eAAe;GACrC,IAAI,MAAM,WAAW,QAAQ,OAAO;GACpC,OAAO,MAAM,UAAU,kDAAkD;EAC3E,CAAC;EAED,MAAM,EAAE,eAAe,cAAc,uBAAuB,gBAAgB,KAAK;;GA/G/E,OAAA,UAAA,GAAA,mBAyBK,MAzBL,WAyBK,EAzBA,OAAO,MAAA,aAAA,EAAa,GAAU,MAAA,SAAA,CAAS,GAAA,EAC1C,UAAA,IAAA,GAAA,mBAuBM,UAAA,MAAA,WAvBuB,QAAA,QAAhB,MAAM,UAAK;IAAxB,OAAA,UAAA,GAAA,mBAuBM,OAAA;KAvB+B,KAAK,KAAK,OAAO,KAAK,SAAS;KAAQ,OAAK,eAAE,SAAA,KAAQ;IACzF,GAAA,CAAA,mBAOK,MAPL,YAOK,CANA,gBAAA,gBAAA,KAAK,KAAK,IAAG,KAChB,CAAA,GACQ,KAAK,QADb,UAAA,GAAA,mBAIC,QAJD,YAIC,gBADK,KAAK,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,GAGjB,mBAaK,MAAA,EAZH,OAAK,eAAA,CAAC,oDAAkD,CACpC,KAAK,OAAI,oCAAA,eAAgE,QAAA,WAAM,WAAA,+BAAA,MAAA,CAAA,CAAA,EAAA,GAAA,CAKnG,WAKO,KAAA,QAAA,SAAA;KALmB;KAAO,OAAO,KAAK;IAA7C,SAKO,CAJO,QAAQ,KAAK,KAAK,KAA9B,UAAA,GAAA,mBAES,QAFT,YAES,gBADP,QAAA,SAAS,GAAA,CAAA,MAEX,UAAA,GAAA,mBAA4C,UAAA,EAAA,KAAA,EAAA,GAAA,CAAxB,gBAAA,gBAAA,KAAK,KAAK,GAAA,CAAA,CAAA,GAAA,EAAA,EAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEventListener } from "../composables/useEventListener.js";
|
|
2
2
|
import { onClickOutside } from "../composables/onClickOutside.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MENU_PANEL_CLASS } from "../internal/menu.js";
|
|
4
|
+
import { Transition, computed, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, vShow, withCtx, withDirectives } from "vue";
|
|
4
5
|
//#region src/components/Dropdown.vue
|
|
5
6
|
var _sfc_main = {
|
|
6
7
|
__name: "Dropdown",
|
|
@@ -92,7 +93,10 @@ var _sfc_main = {
|
|
|
92
93
|
if (props.panelClass) return props.panelClass;
|
|
93
94
|
const align = props.align === "right" ? "right-0" : "left-0";
|
|
94
95
|
const dropDir = props.drop === "up" ? "bottom-full mb-1" : "mt-1";
|
|
95
|
-
return `absolute z-50
|
|
96
|
+
return `absolute z-50 ${MENU_PANEL_CLASS} p-1 ${props.width} ${align} ${dropDir}`;
|
|
97
|
+
});
|
|
98
|
+
const panelOrigin = computed(() => {
|
|
99
|
+
return `${props.drop === "up" ? "bottom" : "top"} ${props.align === "right" ? "right" : "left"}`;
|
|
96
100
|
});
|
|
97
101
|
const transitionClasses = computed(() => {
|
|
98
102
|
if (props.drop === "up") return {
|
|
@@ -147,7 +151,10 @@ var _sfc_main = {
|
|
|
147
151
|
"leave-from-class": transitionClasses.value.leaveFrom,
|
|
148
152
|
"leave-to-class": transitionClasses.value.leaveTo
|
|
149
153
|
}, {
|
|
150
|
-
default: withCtx(() => [withDirectives(createElementVNode("div", {
|
|
154
|
+
default: withCtx(() => [withDirectives(createElementVNode("div", {
|
|
155
|
+
class: normalizeClass(panelClasses.value),
|
|
156
|
+
style: normalizeStyle({ transformOrigin: panelOrigin.value })
|
|
157
|
+
}, [renderSlot(_ctx.$slots, "default", { close })], 6), [[vShow, isOpen.value]])]),
|
|
151
158
|
_: 3
|
|
152
159
|
}, 8, [
|
|
153
160
|
"enter-active-class",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","names":[],"sources":["../../src/components/Dropdown.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\">\n <!-- Trigger slot: receives { open, toggle } for controlling the dropdown -->\n <slot name=\"trigger\" :open=\"isOpen\" :toggle=\"toggle\" />\n\n <!-- Dropdown panel with animated enter/leave transitions -->\n <Transition\n :enter-active-class=\"transitionClasses.enterActive\"\n :enter-from-class=\"transitionClasses.enterFrom\"\n :enter-to-class=\"transitionClasses.enterTo\"\n :leave-active-class=\"transitionClasses.leaveActive\"\n :leave-from-class=\"transitionClasses.leaveFrom\"\n :leave-to-class=\"transitionClasses.leaveTo\"\n >\n <div v-show=\"isOpen\" :class=\"panelClasses\">\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdown — Headless dropdown menu with configurable alignment, direction, and transitions.\n *\n * Uses a trigger slot that receives `open` state and `toggle` function, and a default\n * slot for menu content that receives a `close` function. Closes on outside click and\n * Escape key. Supports both downward and upward drop directions with matching transitions.\n * Exposes `isOpen`, `toggle()`, and `close()` for programmatic control.\n *\n * @example Basic dropdown with button trigger\n * <UiDropdown>\n * <template #trigger=\"{ toggle }\">\n * <UiButton @click=\"toggle\">Menu</UiButton>\n * </template>\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiDropdown>\n *\n * @example Right-aligned, drop-up\n * <UiDropdown align=\"right\" drop=\"up\" width=\"w-48\">\n * <template #trigger=\"{ toggle }\">\n * <UiButton variant=\"ghost\" icon-only @click=\"toggle\">\n * <UiIcon name=\"mdi:dots-vertical\" class=\"w-5 h-5\" />\n * </UiButton>\n * </template>\n * <slot />\n * </UiDropdown>\n *\n * @emits {void} open — Emitted when the dropdown opens\n * @emits {void} close — Emitted when the dropdown closes\n *\n * @slot trigger — Trigger element that opens the dropdown. Receives { open: boolean, toggle: Function }\n * @slot default — Dropdown menu content. Receives { close: Function }\n *\n * @see UiDropdownItem — Standard menu item for use inside this dropdown\n * @see UiDropdownSubmenu — Nested submenu for this dropdown\n */\nimport { ref, computed } from 'vue'\nimport { onClickOutside } from '../composables/onClickOutside.js'\nimport { useEventListener } from '../composables/useEventListener.js'\nconst props = defineProps({\n /**\n * Width class applied to the dropdown panel.\n * @type {string}\n * @default 'w-56'\n * @example 'w-48', 'w-64', 'w-72'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Horizontal alignment of the panel relative to the trigger.\n * @type {string}\n * @default 'left'\n * @values 'left' | 'right'\n */\n align: { type: String, default: 'left' },\n\n /**\n * Drop direction — 'down' opens below the trigger, 'up' opens above.\n * @type {string}\n * @default 'down'\n * @values 'down' | 'up'\n */\n drop: { type: String, default: 'down' },\n\n /**\n * Override all default panel classes (bg, border, rounded, shadow).\n * When set, the built-in panel styling is completely replaced.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n})\n\nconst emit = defineEmits(['open', 'close'])\n\nconst isOpen = ref(false)\nconst containerRef = ref(null)\n\n// Build panel positioning/styling classes, or use custom override\nconst panelClasses = computed(() => {\n if (props.panelClass) return props.panelClass\n const align = props.align === 'right' ? 'right-0' : 'left-0'\n const dropDir = props.drop === 'up' ? 'bottom-full mb-1' : 'mt-1'\n
|
|
1
|
+
{"version":3,"file":"Dropdown.js","names":[],"sources":["../../src/components/Dropdown.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\">\n <!-- Trigger slot: receives { open, toggle } for controlling the dropdown -->\n <slot name=\"trigger\" :open=\"isOpen\" :toggle=\"toggle\" />\n\n <!-- Dropdown panel with animated enter/leave transitions -->\n <Transition\n :enter-active-class=\"transitionClasses.enterActive\"\n :enter-from-class=\"transitionClasses.enterFrom\"\n :enter-to-class=\"transitionClasses.enterTo\"\n :leave-active-class=\"transitionClasses.leaveActive\"\n :leave-from-class=\"transitionClasses.leaveFrom\"\n :leave-to-class=\"transitionClasses.leaveTo\"\n >\n <div v-show=\"isOpen\" :class=\"panelClasses\" :style=\"{ transformOrigin: panelOrigin }\">\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdown — Headless dropdown menu with configurable alignment, direction, and transitions.\n *\n * Uses a trigger slot that receives `open` state and `toggle` function, and a default\n * slot for menu content that receives a `close` function. Closes on outside click and\n * Escape key. Supports both downward and upward drop directions with matching transitions.\n * Exposes `isOpen`, `toggle()`, and `close()` for programmatic control.\n *\n * @example Basic dropdown with button trigger\n * <UiDropdown>\n * <template #trigger=\"{ toggle }\">\n * <UiButton @click=\"toggle\">Menu</UiButton>\n * </template>\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiDropdown>\n *\n * @example Right-aligned, drop-up\n * <UiDropdown align=\"right\" drop=\"up\" width=\"w-48\">\n * <template #trigger=\"{ toggle }\">\n * <UiButton variant=\"ghost\" icon-only @click=\"toggle\">\n * <UiIcon name=\"mdi:dots-vertical\" class=\"w-5 h-5\" />\n * </UiButton>\n * </template>\n * <slot />\n * </UiDropdown>\n *\n * @emits {void} open — Emitted when the dropdown opens\n * @emits {void} close — Emitted when the dropdown closes\n *\n * @slot trigger — Trigger element that opens the dropdown. Receives { open: boolean, toggle: Function }\n * @slot default — Dropdown menu content. Receives { close: Function }\n *\n * @see UiDropdownItem — Standard menu item for use inside this dropdown\n * @see UiDropdownSubmenu — Nested submenu for this dropdown\n */\nimport { ref, computed } from 'vue'\nimport { onClickOutside } from '../composables/onClickOutside.js'\nimport { useEventListener } from '../composables/useEventListener.js'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Width class applied to the dropdown panel.\n * @type {string}\n * @default 'w-56'\n * @example 'w-48', 'w-64', 'w-72'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Horizontal alignment of the panel relative to the trigger.\n * @type {string}\n * @default 'left'\n * @values 'left' | 'right'\n */\n align: { type: String, default: 'left' },\n\n /**\n * Drop direction — 'down' opens below the trigger, 'up' opens above.\n * @type {string}\n * @default 'down'\n * @values 'down' | 'up'\n */\n drop: { type: String, default: 'down' },\n\n /**\n * Override all default panel classes (bg, border, rounded, shadow).\n * When set, the built-in panel styling is completely replaced.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n})\n\nconst emit = defineEmits(['open', 'close'])\n\nconst isOpen = ref(false)\nconst containerRef = ref(null)\n\n// Build panel positioning/styling classes, or use custom override\nconst panelClasses = computed(() => {\n if (props.panelClass) return props.panelClass\n const align = props.align === 'right' ? 'right-0' : 'left-0'\n const dropDir = props.drop === 'up' ? 'bottom-full mb-1' : 'mt-1'\n // `p-1` (not just `py-1`) insets the rows so their rounded hover highlight\n // reads as a chip with breathing room from the panel edge.\n return `absolute z-50 ${MENU_PANEL_CLASS} p-1 ${props.width} ${align} ${dropDir}`\n})\n\n// Inline transform-origin (not a Tailwind class, so it needs no build step to\n// take effect): the panel scales in from the corner nearest the trigger rather\n// than drifting in from its centre.\nconst panelOrigin = computed(() => {\n const y = props.drop === 'up' ? 'bottom' : 'top'\n const x = props.align === 'right' ? 'right' : 'left'\n return `${y} ${x}`\n})\n\n// Use slide-up transition for drop=\"up\", scale transition for drop=\"down\"\nconst transitionClasses = computed(() => {\n if (props.drop === 'up') {\n return {\n enterActive: 'transition ease-out duration-150',\n enterFrom: 'opacity-0 translate-y-1',\n enterTo: 'opacity-100 translate-y-0',\n leaveActive: 'transition ease-in duration-100',\n leaveFrom: 'opacity-100 translate-y-0',\n leaveTo: 'opacity-0 translate-y-1',\n }\n }\n return {\n enterActive: 'transition duration-100 ease-out',\n enterFrom: 'opacity-0 scale-95',\n enterTo: 'opacity-100 scale-100',\n leaveActive: 'transition duration-75 ease-in',\n leaveFrom: 'opacity-100 scale-100',\n leaveTo: 'opacity-0 scale-95',\n }\n})\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n emit(isOpen.value ? 'open' : 'close')\n}\n\nconst close = () => {\n if (isOpen.value) {\n isOpen.value = false\n emit('close')\n }\n}\n\nonClickOutside(containerRef, close)\n\nuseEventListener(globalThis.document, 'keydown', (e) => {\n if (e.key === 'Escape') close()\n})\n\ndefineExpose({ isOpen, toggle, close })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DA,MAAM,QAAQ;EAkCd,MAAM,OAAO;EAEb,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,eAAe,IAAI,IAAI;EAG7B,MAAM,eAAe,eAAe;GAClC,IAAI,MAAM,YAAY,OAAO,MAAM;GACnC,MAAM,QAAQ,MAAM,UAAU,UAAU,YAAY;GACpD,MAAM,UAAU,MAAM,SAAS,OAAO,qBAAqB;GAG3D,OAAO,iBAAiB,iBAAiB,OAAO,MAAM,MAAM,GAAG,MAAM,GAAG;EAC1E,CAAC;EAKD,MAAM,cAAc,eAAe;GAGjC,OAAO,GAFG,MAAM,SAAS,OAAO,WAAW,MAE/B,GADF,MAAM,UAAU,UAAU,UAAU;EAEhD,CAAC;EAGD,MAAM,oBAAoB,eAAe;GACvC,IAAI,MAAM,SAAS,MACjB,OAAO;IACL,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,WAAW;IACX,SAAS;GACX;GAEF,OAAO;IACL,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,WAAW;IACX,SAAS;GACX;EACF,CAAC;EAED,MAAM,eAAe;GACnB,OAAO,QAAQ,CAAC,OAAO;GACvB,KAAK,OAAO,QAAQ,SAAS,OAAO;EACtC;EAEA,MAAM,cAAc;GAClB,IAAI,OAAO,OAAO;IAChB,OAAO,QAAQ;IACf,KAAK,OAAO;GACd;EACF;EAEA,eAAe,cAAc,KAAK;EAElC,iBAAiB,WAAW,UAAU,YAAY,MAAM;GACtD,IAAI,EAAE,QAAQ,UAAU,MAAM;EAChC,CAAC;EAED,SAAa;GAAE;GAAQ;GAAQ;EAAM,CAAC;;GA/JpC,OAAA,UAAA,GAAA,mBAiBM,OAAA;IAjBG,SAAA;IAAJ,KAAI;IAAe,OAAM;GAE5B,GAAA,CAAA,WAAuD,KAAA,QAAA,WAAA;IAAjC,MAAM,OAAA;IAAiB;GAG7C,CAAA,GAAA,YAWa,YAAA;IAVV,sBAAoB,kBAAA,MAAkB;IACtC,oBAAkB,kBAAA,MAAkB;IACpC,kBAAgB,kBAAA,MAAkB;IAClC,sBAAoB,kBAAA,MAAkB;IACtC,oBAAkB,kBAAA,MAAkB;IACpC,kBAAgB,kBAAA,MAAkB;;IAEnC,SAAA,cAEM,CAFN,eAAA,mBAEM,OAAA;KAFgB,OAAK,eAAE,aAAA,KAAY;KAAG,OAAK,eAAA,EAAA,iBAAqB,YAAA,MAAW,CAAA;IAC/E,GAAA,CAAA,WAAuB,KAAA,QAAA,WAAA,EAAT,MAAK,CAAA,CAAA,GAAA,CAAA,GAAA,CADR,CAAA,OAAA,OAAA,KAAM,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
2
|
import _sfc_main$2 from "./Button.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MENU_PANEL_CLASS } from "../internal/menu.js";
|
|
4
|
+
import { Transition, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
4
5
|
//#region src/components/DropdownSubmenu.vue
|
|
5
6
|
var _hoisted_1 = { class: "flex-1 text-left" };
|
|
6
7
|
var _hoisted_2 = {
|
|
@@ -128,8 +129,9 @@ var _sfc_main = {
|
|
|
128
129
|
}, {
|
|
129
130
|
default: withCtx(() => [showSub.value && !__props.disabled && !isMobile.value ? (openBlock(), createElementBlock("div", {
|
|
130
131
|
key: 0,
|
|
131
|
-
class: normalizeClass(["absolute top-0 w-52
|
|
132
|
-
|
|
132
|
+
class: normalizeClass(["absolute top-0 w-52 py-1 z-50", [unref(MENU_PANEL_CLASS), __props.alignLeft ? "right-full mr-1" : "left-full ml-1"]]),
|
|
133
|
+
style: normalizeStyle({ transformOrigin: __props.alignLeft ? "top right" : "top left" })
|
|
134
|
+
}, [renderSlot(_ctx.$slots, "default")], 6)) : createCommentVNode("", true)]),
|
|
133
135
|
_: 3
|
|
134
136
|
})
|
|
135
137
|
], 32);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownSubmenu.js","names":[],"sources":["../../src/components/DropdownSubmenu.vue"],"sourcesContent":["<template>\n <!-- Hover-triggered on desktop, click-triggered on mobile -->\n <div\n class=\"relative\"\n @mouseenter=\"!isMobile && (showSub = true)\"\n @mouseleave=\"!isMobile && (showSub = false)\"\n >\n <UiButton variant=\"menu-item\" :disabled=\"disabled\" @click=\"showSub = !showSub\">\n <UiIcon :name=\"icon\" class=\"w-4 h-4 block shrink-0\" />\n <span class=\"flex-1 text-left\">{{ label }}</span>\n <UiIcon\n :name=\"isMobile ? (showSub ? 'mdi:chevron-up' : 'mdi:chevron-down') : 'mdi:chevron-right'\"\n class=\"w-3.5 h-3.5 block shrink-0 text-gray-400\"\n />\n </UiButton>\n\n <!-- Mobile: inline accordion with left border accent -->\n <Transition\n enter-active-class=\"transition-all duration-100 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-60 opacity-100\"\n leave-active-class=\"transition-all duration-75 ease-in\"\n leave-from-class=\"max-h-60 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <div\n v-if=\"showSub && !disabled && isMobile\"\n class=\"overflow-hidden bg-gray-50 dark:bg-gray-850 border-l-2 border-primary-400 ml-5\"\n >\n <slot />\n </div>\n </Transition>\n\n <!-- Desktop: flyout panel positioned left or right -->\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-if=\"showSub && !disabled && !isMobile\"\n class=\"absolute top-0 w-52
|
|
1
|
+
{"version":3,"file":"DropdownSubmenu.js","names":[],"sources":["../../src/components/DropdownSubmenu.vue"],"sourcesContent":["<template>\n <!-- Hover-triggered on desktop, click-triggered on mobile -->\n <div\n class=\"relative\"\n @mouseenter=\"!isMobile && (showSub = true)\"\n @mouseleave=\"!isMobile && (showSub = false)\"\n >\n <UiButton variant=\"menu-item\" :disabled=\"disabled\" @click=\"showSub = !showSub\">\n <UiIcon :name=\"icon\" class=\"w-4 h-4 block shrink-0\" />\n <span class=\"flex-1 text-left\">{{ label }}</span>\n <UiIcon\n :name=\"isMobile ? (showSub ? 'mdi:chevron-up' : 'mdi:chevron-down') : 'mdi:chevron-right'\"\n class=\"w-3.5 h-3.5 block shrink-0 text-gray-400\"\n />\n </UiButton>\n\n <!-- Mobile: inline accordion with left border accent -->\n <Transition\n enter-active-class=\"transition-all duration-100 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-60 opacity-100\"\n leave-active-class=\"transition-all duration-75 ease-in\"\n leave-from-class=\"max-h-60 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <div\n v-if=\"showSub && !disabled && isMobile\"\n class=\"overflow-hidden bg-gray-50 dark:bg-gray-850 border-l-2 border-primary-400 ml-5\"\n >\n <slot />\n </div>\n </Transition>\n\n <!-- Desktop: flyout panel positioned left or right -->\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-if=\"showSub && !disabled && !isMobile\"\n class=\"absolute top-0 w-52 py-1 z-50\"\n :class=\"[MENU_PANEL_CLASS, alignLeft ? 'right-full mr-1' : 'left-full ml-1']\"\n :style=\"{ transformOrigin: alignLeft ? 'top right' : 'top left' }\"\n >\n <slot />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdownSubmenu — Nested submenu for UiDropdown with responsive behavior.\n *\n * On desktop (≥640px), shows a flyout panel on hover to the left or right.\n * On mobile (<640px), expands inline as an accordion with a left border accent.\n * Automatically detects viewport width on mount and resize.\n *\n * @example Basic submenu\n * <UiDropdownSubmenu icon=\"mdi:format-text\" label=\"Text Style\">\n * <UiDropdownItem icon=\"mdi:format-bold\" label=\"Bold\" @click=\"bold\" />\n * <UiDropdownItem icon=\"mdi:format-italic\" label=\"Italic\" @click=\"italic\" />\n * </UiDropdownSubmenu>\n *\n * @example Left-aligned flyout\n * <UiDropdownSubmenu icon=\"mdi:share\" label=\"Share\" align-left>\n * <UiDropdownItem icon=\"mdi:email\" label=\"Email\" @click=\"shareEmail\" />\n * </UiDropdownSubmenu>\n *\n * @slot default — Submenu items (typically UiDropdownItem components)\n *\n * @see UiDropdown — Parent dropdown container\n * @see UiDropdownItem — Standard menu item for use inside this submenu\n */\nimport { ref, onMounted, onUnmounted } from 'vue'\nimport UiButton from './Button.vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\ndefineProps({\n /**\n * MDI icon name displayed at the start of the trigger row.\n * @type {string}\n * @required\n */\n icon: { type: String, required: true },\n\n /**\n * Text label for the submenu trigger.\n * @type {string}\n * @required\n */\n label: { type: String, required: true },\n\n /**\n * Disabled state — prevents opening the submenu.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Align the desktop flyout to the left (right-to-left) instead of the default right.\n * @type {boolean}\n * @default false\n */\n alignLeft: { type: Boolean, default: false },\n})\n\nconst showSub = ref(false)\n// Track viewport width to switch between mobile accordion and desktop flyout\nconst isMobile = ref(false)\n\nconst checkMobile = () => {\n isMobile.value = window.innerWidth < 640\n}\n\nonMounted(() => {\n checkMobile()\n window.addEventListener('resize', checkMobile)\n})\n\nonUnmounted(() => {\n window.removeEventListener('resize', checkMobile)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,UAAU,IAAI,KAAK;EAEzB,MAAM,WAAW,IAAI,KAAK;EAE1B,MAAM,oBAAoB;GACxB,SAAS,QAAQ,OAAO,aAAa;EACvC;EAEA,gBAAgB;GACd,YAAY;GACZ,OAAO,iBAAiB,UAAU,WAAW;EAC/C,CAAC;EAED,kBAAkB;GAChB,OAAO,oBAAoB,UAAU,WAAW;EAClD,CAAC;;GA7HC,OAAA,UAAA,GAAA,mBAiDM,OAAA;IAhDJ,OAAM;IACL,cAAU,OAAA,OAAA,OAAA,MAAA,WAAA,CAAG,SAAA,UAAa,QAAA,QAAO;IACjC,cAAU,OAAA,OAAA,OAAA,MAAA,WAAA,CAAG,SAAA,UAAa,QAAA,QAAO;;IAElC,YAOW,aAAA;KAPD,SAAQ;KAAa,UAAU,QAAA;KAAW,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,QAAO,CAAI,QAAA;;KACpE,SAAA,cAAsD;MAAtD,YAAsD,aAAA;OAA7C,MAAM,QAAA;OAAM,OAAM;;MAC3B,mBAAiD,QAAjD,YAAiD,gBAAf,QAAA,KAAK,GAAA,CAAA;MACvC,YAGE,aAAA;OAFC,MAAM,SAAA,QAAY,QAAA,QAAO,mBAAA,qBAAA;OAC1B,OAAM;;;;;IAKV,YAca,YAAA;KAbX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;;KAEf,SAAA,cAKM,CAJE,QAAA,SAAO,CAAK,QAAA,YAAY,SAAA,SADhC,UAAA,GAAA,mBAKM,OALN,YAKM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;;;IAKZ,YAgBa,YAAA;KAfX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;;KAEf,SAAA,cAOM,CANE,QAAA,SAAO,CAAK,QAAA,YAAQ,CAAK,SAAA,SADjC,UAAA,GAAA,mBAOM,OAAA;;MALJ,OAAK,eAAA,CAAC,iCAA+B,CAC5B,MAAA,gBAAA,GAAkB,QAAA,YAAS,oBAAA,gBAAA,CAAA,CAAA;MACnC,OAAK,eAAA,EAAA,iBAAqB,QAAA,YAAS,cAAA,WAAA,CAAA;KAEpC,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { useMergedClasses } from "../composables/useMergedClasses.js";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, mergeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
|
|
4
|
+
//#region src/components/EmptyState.vue
|
|
5
|
+
var _hoisted_1 = {
|
|
6
|
+
class: "mx-auto flex size-12 items-center justify-center rounded-2xl bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-500",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
};
|
|
9
|
+
var _hoisted_2 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "mx-auto mt-1 max-w-sm text-sm text-gray-500 dark:text-gray-400"
|
|
12
|
+
};
|
|
13
|
+
var _hoisted_3 = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "mt-5 flex flex-wrap justify-center gap-2"
|
|
16
|
+
};
|
|
17
|
+
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
18
|
+
__name: "EmptyState",
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* Short statement of the state, e.g. "No apps yet".
|
|
22
|
+
* @type {string}
|
|
23
|
+
* @default ''
|
|
24
|
+
*/
|
|
25
|
+
title: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* One line explaining why, or what to do.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @default ''
|
|
33
|
+
*/
|
|
34
|
+
description: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* MDI icon.
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @default 'mdi:inbox-outline'
|
|
42
|
+
*/
|
|
43
|
+
icon: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "mdi:inbox-outline"
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Tighter vertical padding, for use inside cards and tables.
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
compact: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Dashed outline around the state, for standalone use on a page.
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
bordered: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Element used for the title.
|
|
67
|
+
* @type {string}
|
|
68
|
+
* @default 'h3'
|
|
69
|
+
* @values 'h2' | 'h3' | 'h4' | 'p'
|
|
70
|
+
*/
|
|
71
|
+
headingTag: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "h3"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
setup(__props) {
|
|
77
|
+
/**
|
|
78
|
+
* UiEmptyState — what a list, table or page shows when there is nothing in it
|
|
79
|
+
* yet: an icon, a short title, one line of explanation and the action that
|
|
80
|
+
* fixes it.
|
|
81
|
+
*
|
|
82
|
+
* Say why it is empty and what to do next, rather than only that it is empty.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* <UiEmptyState
|
|
86
|
+
* icon="mdi:sync"
|
|
87
|
+
* title="No apps yet"
|
|
88
|
+
* description="Register an app to give its clients a place to sync."
|
|
89
|
+
* >
|
|
90
|
+
* <UiButton><UiIcon name="mdi:plus" class="size-4" />New app</UiButton>
|
|
91
|
+
* </UiEmptyState>
|
|
92
|
+
*
|
|
93
|
+
* @slot default — Actions.
|
|
94
|
+
* @slot icon — Custom icon content.
|
|
95
|
+
* @slot description — Rich description (overrides `description`).
|
|
96
|
+
*/
|
|
97
|
+
const props = __props;
|
|
98
|
+
const internalClasses = computed(() => [
|
|
99
|
+
"text-center",
|
|
100
|
+
props.compact ? "px-4 py-6" : "px-6 py-12",
|
|
101
|
+
props.bordered ? "rounded-2xl border-2 border-dashed border-gray-200 dark:border-gray-700" : ""
|
|
102
|
+
].filter(Boolean).join(" "));
|
|
103
|
+
const { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value);
|
|
104
|
+
return (_ctx, _cache) => {
|
|
105
|
+
return openBlock(), createElementBlock("div", mergeProps({ class: unref(mergedClasses) }, unref(restAttrs)), [
|
|
106
|
+
createElementVNode("div", _hoisted_1, [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$1, {
|
|
107
|
+
name: __props.icon,
|
|
108
|
+
class: "size-6"
|
|
109
|
+
}, null, 8, ["name"])])]),
|
|
110
|
+
(openBlock(), createBlock(resolveDynamicComponent(__props.headingTag), { class: "mt-4 text-sm font-semibold text-gray-900 dark:text-gray-100" }, {
|
|
111
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
|
|
112
|
+
_: 1
|
|
113
|
+
})),
|
|
114
|
+
__props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("p", _hoisted_2, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])])) : createCommentVNode("", true),
|
|
115
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("", true)
|
|
116
|
+
], 16);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
//#endregion
|
|
121
|
+
export { _sfc_main as default };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=EmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.js","names":["$slots"],"sources":["../../src/components/EmptyState.vue"],"sourcesContent":["<template>\n <div :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <div\n class=\"mx-auto flex size-12 items-center justify-center rounded-2xl bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-500\"\n aria-hidden=\"true\"\n >\n <slot name=\"icon\"><UiIcon :name=\"icon\" class=\"size-6\" /></slot>\n </div>\n <component :is=\"headingTag\" class=\"mt-4 text-sm font-semibold text-gray-900 dark:text-gray-100\">\n {{ title }}\n </component>\n <p\n v-if=\"description || $slots.description\"\n class=\"mx-auto mt-1 max-w-sm text-sm text-gray-500 dark:text-gray-400\"\n >\n <slot name=\"description\">{{ description }}</slot>\n </p>\n <div v-if=\"$slots.default\" class=\"mt-5 flex flex-wrap justify-center gap-2\">\n <slot />\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiEmptyState — what a list, table or page shows when there is nothing in it\n * yet: an icon, a short title, one line of explanation and the action that\n * fixes it.\n *\n * Say why it is empty and what to do next, rather than only that it is empty.\n *\n * @example\n * <UiEmptyState\n * icon=\"mdi:sync\"\n * title=\"No apps yet\"\n * description=\"Register an app to give its clients a place to sync.\"\n * >\n * <UiButton><UiIcon name=\"mdi:plus\" class=\"size-4\" />New app</UiButton>\n * </UiEmptyState>\n *\n * @slot default — Actions.\n * @slot icon — Custom icon content.\n * @slot description — Rich description (overrides `description`).\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\nconst props = defineProps({\n /**\n * Short statement of the state, e.g. \"No apps yet\".\n * @type {string}\n * @default ''\n */\n title: { type: String, default: '' },\n\n /**\n * One line explaining why, or what to do.\n * @type {string}\n * @default ''\n */\n description: { type: String, default: '' },\n\n /**\n * MDI icon.\n * @type {string}\n * @default 'mdi:inbox-outline'\n */\n icon: { type: String, default: 'mdi:inbox-outline' },\n\n /**\n * Tighter vertical padding, for use inside cards and tables.\n * @type {boolean}\n * @default false\n */\n compact: { type: Boolean, default: false },\n\n /**\n * Dashed outline around the state, for standalone use on a page.\n * @type {boolean}\n * @default false\n */\n bordered: { type: Boolean, default: false },\n\n /**\n * Element used for the title.\n * @type {string}\n * @default 'h3'\n * @values 'h2' | 'h3' | 'h4' | 'p'\n */\n headingTag: { type: String, default: 'h3' },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst internalClasses = computed(() =>\n [\n 'text-center',\n props.compact ? 'px-4 py-6' : 'px-6 py-12',\n props.bordered ? 'rounded-2xl border-2 border-dashed border-gray-200 dark:border-gray-700' : '',\n ]\n .filter(Boolean)\n .join(' '),\n)\n\nconst { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDA,MAAM,QAAQ;EA+Cd,MAAM,kBAAkB,eACtB;GACE;GACA,MAAM,UAAU,cAAc;GAC9B,MAAM,WAAW,4EAA4E;EAC/F,CAAA,CACG,OAAO,OAAO,CAAA,CACd,KAAK,GAAG,CACb;EAEA,MAAM,EAAE,eAAe,cAAc,uBAAuB,gBAAgB,KAAK;;GAxG/E,OAAA,UAAA,GAAA,mBAmBM,OAnBN,WAmBM,EAnBA,OAAO,MAAA,aAAA,EAAa,GAAU,MAAA,SAAA,CAAS,GAAA;IAC3C,mBAKM,OALN,YAKM,CADJ,WAA+D,KAAA,QAAA,QAAA,CAAA,SAAA,CAA7C,YAAsC,aAAA;KAA7B,MAAM,QAAA;KAAM,OAAM;;KAE/C,UAAA,GAAA,YAEY,wBAFI,QAAA,UAAU,GAAA,EAAE,OAAM,8DAA6D,GAAA;KAC7F,SAAA,cAAW,CAAR,gBAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA;;;IAGF,QAAA,eAAeA,KAAAA,OAAO,eAD9B,UAAA,GAAA,mBAKI,KALJ,YAKI,CADF,WAAiD,KAAA,QAAA,eAAA,CAAA,SAAA,CAArB,gBAAA,gBAAA,QAAA,WAAW,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAE9BA,KAAAA,OAAO,WAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementBlock, createElementVNode, normalizeClass, openBlock, ref, renderSlot } from "vue";
|
|
1
|
+
import { createElementBlock, createElementVNode, normalizeClass, openBlock, ref, renderSlot, withModifiers } from "vue";
|
|
2
2
|
//#region src/components/FileInput.vue
|
|
3
3
|
var _hoisted_1 = [
|
|
4
4
|
"accept",
|
|
@@ -98,12 +98,19 @@ var _sfc_main = {
|
|
|
98
98
|
emit("select", props.multiple ? files : files[0]);
|
|
99
99
|
e.target.value = "";
|
|
100
100
|
}
|
|
101
|
+
const open = () => inputRef.value?.click();
|
|
102
|
+
const onTriggerClick = () => {
|
|
103
|
+
if (!props.disabled) open();
|
|
104
|
+
};
|
|
101
105
|
__expose({
|
|
102
|
-
open
|
|
106
|
+
open,
|
|
103
107
|
el: inputRef
|
|
104
108
|
});
|
|
105
109
|
return (_ctx, _cache) => {
|
|
106
|
-
return openBlock(), createElementBlock("
|
|
110
|
+
return openBlock(), createElementBlock("span", {
|
|
111
|
+
class: normalizeClass(["inline-flex items-center gap-2 cursor-pointer transition-colors", __props.disabled ? "opacity-50 pointer-events-none" : ""]),
|
|
112
|
+
onClick: onTriggerClick
|
|
113
|
+
}, [renderSlot(_ctx.$slots, "default"), createElementVNode("input", {
|
|
107
114
|
ref_key: "inputRef",
|
|
108
115
|
ref: inputRef,
|
|
109
116
|
type: "file",
|
|
@@ -111,7 +118,8 @@ var _sfc_main = {
|
|
|
111
118
|
accept: __props.accept,
|
|
112
119
|
multiple: __props.multiple,
|
|
113
120
|
disabled: __props.disabled,
|
|
114
|
-
onChange
|
|
121
|
+
onChange,
|
|
122
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
|
|
115
123
|
}, null, 40, _hoisted_1)], 2);
|
|
116
124
|
};
|
|
117
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.js","names":[],"sources":["../../src/components/FileInput.vue"],"sourcesContent":["<template>\n <!-- Clickable
|
|
1
|
+
{"version":3,"file":"FileInput.js","names":[],"sources":["../../src/components/FileInput.vue"],"sourcesContent":["<template>\n <!-- Clickable wrapper around a hidden file input — slot content is the visible trigger.\n A plain <label> would not work when the slot is a <button> (or any interactive\n element): the browser skips label→control forwarding when the click lands on an\n interactive descendant, so the picker never opened. Handling the click ourselves\n makes any trigger content work. -->\n <span\n class=\"inline-flex items-center gap-2 cursor-pointer transition-colors\"\n :class=\"disabled ? 'opacity-50 pointer-events-none' : ''\"\n @click=\"onTriggerClick\"\n >\n <slot />\n <input\n ref=\"inputRef\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onChange\"\n @click.stop\n />\n </span>\n</template>\n\n<script setup>\n/**\n * UiFileInput — Hidden file input wrapped in a clickable label for custom trigger UI.\n *\n * The default slot provides the visible trigger content (e.g. a button or icon).\n * Clicking anywhere in the label opens the native file picker. Supports file type\n * filtering via `accept`, multi-file selection, and max file size validation.\n * Exposes an `open()` method for programmatic triggering.\n *\n * @example Single image upload\n * <UiFileInput accept=\"image/*\" @select=\"onFile\">\n * <UiButton variant=\"outline\">Upload Image</UiButton>\n * </UiFileInput>\n *\n * @example Multiple files with size limit (5 MB)\n * <UiFileInput multiple :max-size=\"5 * 1024 * 1024\" @select=\"onFiles\" @error=\"onError\">\n * <span>Choose files</span>\n * </UiFileInput>\n *\n * @example Programmatic open via ref\n * <UiFileInput ref=\"fileInput\" @select=\"onFile\"><span>Pick</span></UiFileInput>\n * <!-- In script: fileInput.value.open() -->\n *\n * @emits {File | File[]} select — Emitted with the selected file(s) after validation passes\n * @emits {{ type: string, file: File, message: string }} error — Emitted when a file exceeds the maxSize limit\n *\n * @slot default — Trigger content (e.g. a button or icon) that opens the file picker\n */\nimport { ref } from 'vue'\nconst props = defineProps({\n /**\n * Accepted file types (MIME types or extensions), passed to the native `accept` attribute.\n * @type {string}\n * @default undefined\n * @example 'image/*', '.pdf,.doc', 'video/mp4'\n */\n accept: { type: String, default: undefined },\n\n /**\n * Allow selecting multiple files at once.\n * @type {boolean}\n * @default false\n */\n multiple: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the label and prevents file picker from opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Maximum allowed file size in bytes. Set to 0 for no limit.\n * Emits an 'error' event with `{ type: 'maxSize', file, message }` when exceeded.\n * @type {number}\n * @default 0\n */\n maxSize: { type: Number, default: 0 },\n})\n\nconst emit = defineEmits(['select', 'error'])\n\nconst inputRef = ref(null)\n\nfunction onChange(e) {\n const files = Array.from(e.target.files || [])\n if (!files.length) return\n\n if (props.maxSize > 0) {\n const oversized = files.find((f) => f.size > props.maxSize)\n if (oversized) {\n const maxMB = (props.maxSize / 1024 / 1024).toFixed(1)\n emit('error', { type: 'maxSize', file: oversized, message: `File exceeds ${maxMB} MB limit` })\n e.target.value = ''\n return\n }\n }\n\n emit('select', props.multiple ? files : files[0])\n e.target.value = ''\n}\n\nconst open = () => inputRef.value?.click()\n\n// A click anywhere in the wrapper opens the picker. The hidden input's own\n// (programmatic) click is stopped from bubbling via `@click.stop` in the\n// template, so this never re-enters itself.\nconst onTriggerClick = () => {\n if (!props.disabled) open()\n}\n\ndefineExpose({\n open,\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,QAAQ;EAgCd,MAAM,OAAO;EAEb,MAAM,WAAW,IAAI,IAAI;EAEzB,SAAS,SAAS,GAAG;GACnB,MAAM,QAAQ,MAAM,KAAK,EAAE,OAAO,SAAS,CAAC,CAAC;GAC7C,IAAI,CAAC,MAAM,QAAQ;GAEnB,IAAI,MAAM,UAAU,GAAG;IACrB,MAAM,YAAY,MAAM,MAAM,MAAM,EAAE,OAAO,MAAM,OAAO;IAC1D,IAAI,WAAW;KACb,MAAM,SAAS,MAAM,UAAU,OAAO,KAAA,CAAM,QAAQ,CAAC;KACrD,KAAK,SAAS;MAAE,MAAM;MAAW,MAAM;MAAW,SAAS,gBAAgB,MAAM;KAAW,CAAC;KAC7F,EAAE,OAAO,QAAQ;KACjB;IACF;GACF;GAEA,KAAK,UAAU,MAAM,WAAW,QAAQ,MAAM,EAAE;GAChD,EAAE,OAAO,QAAQ;EACnB;EAEA,MAAM,aAAa,SAAS,OAAO,MAAM;EAKzC,MAAM,uBAAuB;GAC3B,IAAI,CAAC,MAAM,UAAU,KAAK;EAC5B;EAEA,SAAa;GACX;GACA,IAAI;EACN,CAAC;;GAlHC,OAAA,UAAA,GAAA,mBAgBO,QAAA;IAfL,OAAK,eAAA,CAAC,mEACE,QAAA,WAAQ,mCAAA,EAAA,CAAA;IACf,SAAO;GAER,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,GACR,mBASE,SAAA;IARI,SAAA;IAAJ,KAAI;IACJ,MAAK;IACL,OAAM;IACL,QAAQ,QAAA;IACR,UAAU,QAAA;IACV,UAAU,QAAA;IACF;IACR,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FORM_FIELD_KEY } from "../internal/formField.js";
|
|
2
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, normalizeClass, openBlock, provide, renderSlot, toDisplayString, useId } from "vue";
|
|
2
3
|
//#region src/components/FormField.vue
|
|
3
|
-
var _hoisted_1 =
|
|
4
|
+
var _hoisted_1 = ["for"];
|
|
5
|
+
var _hoisted_2 = {
|
|
4
6
|
key: 0,
|
|
5
7
|
class: "font-normal text-gray-400 dark:text-gray-600"
|
|
6
8
|
};
|
|
7
|
-
var _hoisted_2 = {
|
|
8
|
-
key: 1,
|
|
9
|
-
class: "text-xs text-gray-500 dark:text-gray-500 mt-1"
|
|
10
|
-
};
|
|
11
|
-
var _hoisted_3 = {
|
|
12
|
-
key: 2,
|
|
13
|
-
class: "text-xs text-red-600 dark:text-red-400 mt-1"
|
|
14
|
-
};
|
|
15
9
|
var _sfc_main = {
|
|
16
10
|
__name: "FormField",
|
|
17
11
|
props: {
|
|
@@ -59,6 +53,16 @@ var _sfc_main = {
|
|
|
59
53
|
inline: {
|
|
60
54
|
type: Boolean,
|
|
61
55
|
default: false
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Id of the control the label points at. Generated when omitted; set it
|
|
59
|
+
* when the control is not a Numori UI form component.
|
|
60
|
+
* @type {string}
|
|
61
|
+
* @default ''
|
|
62
|
+
*/
|
|
63
|
+
for: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: ""
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
setup(__props) {
|
|
@@ -89,19 +93,45 @@ var _sfc_main = {
|
|
|
89
93
|
* <UiToggle v-model="ligatures" />
|
|
90
94
|
* </UiFormField>
|
|
91
95
|
*
|
|
96
|
+
* The label is associated with the control: UiInput, UiSelect, UiToggle,
|
|
97
|
+
* UiCheckbox and UiSegmented pick up the field's id, so the label, hint and
|
|
98
|
+
* error are announced by screen readers and clicking the label focuses the
|
|
99
|
+
* control. For any other control, give it the id passed as `for`.
|
|
100
|
+
*
|
|
92
101
|
* @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)
|
|
93
102
|
*/
|
|
94
103
|
const props = __props;
|
|
104
|
+
const uid = useId();
|
|
105
|
+
const controlId = computed(() => props.for || `${uid}-control`);
|
|
106
|
+
const labelId = `${uid}-label`;
|
|
107
|
+
const hintId = `${uid}-hint`;
|
|
108
|
+
const errorId = `${uid}-error`;
|
|
109
|
+
provide(FORM_FIELD_KEY, {
|
|
110
|
+
controlId,
|
|
111
|
+
labelId,
|
|
112
|
+
describedBy: computed(() => [props.hint ? hintId : null, props.error ? errorId : null].filter(Boolean).join(" ") || void 0),
|
|
113
|
+
invalid: computed(() => !!props.error)
|
|
114
|
+
});
|
|
95
115
|
const labelClasses = computed(() => props.inline ? "block text-sm font-medium text-gray-700 dark:text-gray-400" : "block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1");
|
|
96
116
|
return (_ctx, _cache) => {
|
|
97
117
|
return openBlock(), createElementBlock("div", null, [
|
|
98
118
|
__props.label ? (openBlock(), createElementBlock("label", {
|
|
99
119
|
key: 0,
|
|
120
|
+
id: labelId,
|
|
121
|
+
for: controlId.value,
|
|
100
122
|
class: normalizeClass(labelClasses.value)
|
|
101
|
-
}, [createTextVNode(toDisplayString(__props.label) + " ", 1), __props.optional ? (openBlock(), createElementBlock("span",
|
|
123
|
+
}, [createTextVNode(toDisplayString(__props.label) + " ", 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_2, "(optional)")) : createCommentVNode("", true)], 10, _hoisted_1)) : createCommentVNode("", true),
|
|
102
124
|
renderSlot(_ctx.$slots, "default"),
|
|
103
|
-
__props.hint ? (openBlock(), createElementBlock("p",
|
|
104
|
-
|
|
125
|
+
__props.hint ? (openBlock(), createElementBlock("p", {
|
|
126
|
+
key: 1,
|
|
127
|
+
id: hintId,
|
|
128
|
+
class: "text-xs text-gray-500 dark:text-gray-500 mt-1"
|
|
129
|
+
}, toDisplayString(__props.hint), 1)) : createCommentVNode("", true),
|
|
130
|
+
__props.error ? (openBlock(), createElementBlock("p", {
|
|
131
|
+
key: 2,
|
|
132
|
+
id: errorId,
|
|
133
|
+
class: "text-xs text-red-600 dark:text-red-400 mt-1"
|
|
134
|
+
}, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
|
|
105
135
|
]);
|
|
106
136
|
};
|
|
107
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","names":[],"sources":["../../src/components/FormField.vue"],"sourcesContent":["<template>\n <div>\n <label v-if=\"label\" :class=\"labelClasses\">\n {{ label }}\n <span v-if=\"optional\" class=\"font-normal text-gray-400 dark:text-gray-600\">(optional)</span>\n </label>\n <slot />\n <p v-if=\"hint\" class=\"text-xs text-gray-500 dark:text-gray-500 mt-1\">{{ hint }}</p>\n <p v-if=\"error\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\"
|
|
1
|
+
{"version":3,"file":"FormField.js","names":[],"sources":["../../src/components/FormField.vue"],"sourcesContent":["<template>\n <div>\n <label v-if=\"label\" :id=\"labelId\" :for=\"controlId\" :class=\"labelClasses\">\n {{ label }}\n <span v-if=\"optional\" class=\"font-normal text-gray-400 dark:text-gray-600\">(optional)</span>\n </label>\n <slot />\n <p v-if=\"hint\" :id=\"hintId\" class=\"text-xs text-gray-500 dark:text-gray-500 mt-1\">{{ hint }}</p>\n <p v-if=\"error\" :id=\"errorId\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">\n {{ error }}\n </p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiFormField — Label + input wrapper with optional hint and error text.\n *\n * Wraps any form control (UiInput, UiSelect, etc.) with a consistent label,\n * optional \"(optional)\" suffix, hint text below the input, and error message.\n * Reduces the repeated label + div + hint pattern across all form-heavy modals.\n *\n * @example Basic field\n * <UiFormField label=\"Email\">\n * <UiInput v-model=\"email\" type=\"email\" />\n * </UiFormField>\n *\n * @example Field with hint and optional marker\n * <UiFormField label=\"Password hint\" optional hint=\"A clue to help remember\">\n * <UiInput v-model=\"hint\" />\n * </UiFormField>\n *\n * @example Field with error\n * <UiFormField label=\"Password\" :error=\"pwError\">\n * <UiInput v-model=\"pw\" type=\"password\" />\n * </UiFormField>\n *\n * @example Inline label style (no bottom margin)\n * <UiFormField label=\"Font Ligatures\" inline>\n * <UiToggle v-model=\"ligatures\" />\n * </UiFormField>\n *\n * The label is associated with the control: UiInput, UiSelect, UiToggle,\n * UiCheckbox and UiSegmented pick up the field's id, so the label, hint and\n * error are announced by screen readers and clicking the label focuses the\n * control. For any other control, give it the id passed as `for`.\n *\n * @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)\n */\nimport { computed, provide, useId } from 'vue'\nimport { FORM_FIELD_KEY } from '../internal/formField.js'\nconst props = defineProps({\n /**\n * Label text displayed above the input.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Show \"(optional)\" suffix after the label.\n * @type {boolean}\n * @default false\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Hint text displayed below the input in gray.\n * @type {string}\n * @default ''\n */\n hint: { type: String, default: '' },\n\n /**\n * Error message displayed below the input in red.\n * @type {string}\n * @default ''\n */\n error: { type: String, default: '' },\n\n /**\n * Inline label style — no bottom margin, suitable for toggle rows.\n * @type {boolean}\n * @default false\n */\n inline: { type: Boolean, default: false },\n\n /**\n * Id of the control the label points at. Generated when omitted; set it\n * when the control is not a Numori UI form component.\n * @type {string}\n * @default ''\n */\n for: { type: String, default: '' },\n})\n\nconst uid = useId()\nconst controlId = computed(() => props.for || `${uid}-control`)\nconst labelId = `${uid}-label`\nconst hintId = `${uid}-hint`\nconst errorId = `${uid}-error`\n\nprovide(FORM_FIELD_KEY, {\n controlId,\n labelId,\n describedBy: computed(\n () =>\n [props.hint ? hintId : null, props.error ? errorId : null].filter(Boolean).join(' ') ||\n undefined,\n ),\n invalid: computed(() => !!props.error),\n})\n\nconst labelClasses = computed(() =>\n props.inline\n ? 'block text-sm font-medium text-gray-700 dark:text-gray-400'\n : 'block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,MAAM,QAAQ;EA6Cd,MAAM,MAAM,MAAM;EAClB,MAAM,YAAY,eAAe,MAAM,OAAO,GAAG,IAAI,SAAS;EAC9D,MAAM,UAAU,GAAG,IAAI;EACvB,MAAM,SAAS,GAAG,IAAI;EACtB,MAAM,UAAU,GAAG,IAAI;EAEvB,QAAQ,gBAAgB;GACtB;GACA;GACA,aAAa,eAET,CAAC,MAAM,OAAO,SAAS,MAAM,MAAM,QAAQ,UAAU,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KACnF,KAAA,CACJ;GACA,SAAS,eAAe,CAAC,CAAC,MAAM,KAAK;EACvC,CAAC;EAED,MAAM,eAAe,eACnB,MAAM,SACF,+DACA,iEACN;;GApHE,OAAA,UAAA,GAAA,mBAUM,OAAA,MAAA;IATS,QAAA,SAAb,UAAA,GAAA,mBAGQ,SAAA;;KAHa,IAAI;KAAU,KAAK,UAAA;KAAY,OAAK,eAAE,aAAA,KAAY;IAClE,GAAA,CAAA,gBAAA,gBAAA,QAAA,KAAK,IAAG,KACX,CAAA,GAAY,QAAA,YAAZ,UAAA,GAAA,mBAA4F,QAA5F,YAA2E,YAAU,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,IAAA,IAAA;IAEvF,WAAQ,KAAA,QAAA,SAAA;IACC,QAAA,QAAT,UAAA,GAAA,mBAAgG,KAAA;;KAAhF,IAAI;KAAQ,OAAM;IAAmD,GAAA,gBAAA,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAChF,QAAA,SAAT,UAAA,GAAA,mBAEI,KAAA;;KAFa,IAAI;KAAS,OAAM;IAC/B,GAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useMergedClasses } from "../composables/useMergedClasses.js";
|
|
3
|
+
import { computed, createElementBlock, createVNode, mergeProps, normalizeClass, openBlock, unref } from "vue";
|
|
4
4
|
//#region src/components/IconTile.vue
|
|
5
5
|
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
6
6
|
__name: "IconTile",
|
|
@@ -75,14 +75,10 @@ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
|
75
75
|
error: "bg-error-100 text-error-700 dark:bg-error-400/15 dark:text-error-300",
|
|
76
76
|
blue: "bg-blue-100 text-blue-700 dark:bg-blue-400/15 dark:text-blue-300"
|
|
77
77
|
})[props.color] ?? "bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300");
|
|
78
|
-
const
|
|
79
|
-
const restAttrs =
|
|
80
|
-
const { class: _class, ...rest } = attrs;
|
|
81
|
-
return rest;
|
|
82
|
-
});
|
|
83
|
-
const mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class));
|
|
78
|
+
const internalClasses = computed(() => `${sizeClass.value} ${colorClass.value}`);
|
|
79
|
+
const { mergedClasses, restAttrs } = useMergedClasses(internalClasses);
|
|
84
80
|
return (_ctx, _cache) => {
|
|
85
|
-
return openBlock(), createElementBlock("span", mergeProps({ class: ["inline-flex items-center justify-center", mergedClasses
|
|
81
|
+
return openBlock(), createElementBlock("span", mergeProps({ class: ["inline-flex items-center justify-center", unref(mergedClasses)] }, unref(restAttrs)), [createVNode(_sfc_main$1, {
|
|
86
82
|
name: __props.icon,
|
|
87
83
|
class: normalizeClass(iconSizeClass.value),
|
|
88
84
|
"aria-hidden": "true"
|