numori-ui 0.1.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/LICENSE +651 -0
- package/README.md +466 -0
- package/dist/components/Alert.js +137 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/Avatar.js +133 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.js +93 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Button.js +428 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/ButtonsGroup.js +153 -0
- package/dist/components/ButtonsGroup.js.map +1 -0
- package/dist/components/Checkbox.js +93 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Divider.js +79 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Dropdown.js +166 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/DropdownItem.js +106 -0
- package/dist/components/DropdownItem.js.map +1 -0
- package/dist/components/DropdownRow.js +41 -0
- package/dist/components/DropdownRow.js.map +1 -0
- package/dist/components/DropdownSubmenu.js +142 -0
- package/dist/components/DropdownSubmenu.js.map +1 -0
- package/dist/components/FileInput.js +122 -0
- package/dist/components/FileInput.js.map +1 -0
- package/dist/components/FormField.js +112 -0
- package/dist/components/FormField.js.map +1 -0
- package/dist/components/Input.js +603 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Kbd.js +35 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/ListMenu.js +143 -0
- package/dist/components/ListMenu.js.map +1 -0
- package/dist/components/ListMenuItem.js +189 -0
- package/dist/components/ListMenuItem.js.map +1 -0
- package/dist/components/Modal.js +206 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/Numpad.js +123 -0
- package/dist/components/Numpad.js.map +1 -0
- package/dist/components/Popup.js +170 -0
- package/dist/components/Popup.js.map +1 -0
- package/dist/components/ProgressBar.js +118 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/Prompt.js +201 -0
- package/dist/components/Prompt.js.map +1 -0
- package/dist/components/Radio.js +81 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/Select.js +441 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Slider.js +116 -0
- package/dist/components/Slider.js.map +1 -0
- package/dist/components/Stepper.js +65 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/Toggle.js +133 -0
- package/dist/components/Toggle.js.map +1 -0
- package/dist/components/Tooltip.js +120 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/index.js +81 -0
- package/dist/components/index.js.map +1 -0
- package/dist/composables/onClickOutside.js +51 -0
- package/dist/composables/onClickOutside.js.map +1 -0
- package/dist/composables/useBackButton.js +98 -0
- package/dist/composables/useBackButton.js.map +1 -0
- package/dist/composables/useEventListener.js +63 -0
- package/dist/composables/useEventListener.js.map +1 -0
- package/dist/icons/Icon.js +120 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/mdi.js +69 -0
- package/dist/icons/mdi.js.map +1 -0
- package/dist/icons/registry.js +63 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/icons/resolver.js +49 -0
- package/dist/icons/resolver.js.map +1 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +157 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.js +89 -0
- package/dist/manifest.js.map +1 -0
- package/dist/numori-ui.css +184 -0
- package/dist/nuxt.d.ts +35 -0
- package/dist/nuxt.mjs +243 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.mjs +187 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +138 -0
- package/src/components/Alert.vue +127 -0
- package/src/components/Avatar.vue +100 -0
- package/src/components/Badge.vue +77 -0
- package/src/components/Button.vue +419 -0
- package/src/components/ButtonsGroup.vue +140 -0
- package/src/components/Checkbox.vue +81 -0
- package/src/components/Divider.vue +64 -0
- package/src/components/Dropdown.vue +150 -0
- package/src/components/DropdownItem.vue +78 -0
- package/src/components/DropdownRow.vue +37 -0
- package/src/components/DropdownSubmenu.vue +127 -0
- package/src/components/FileInput.vue +107 -0
- package/src/components/FormField.vue +86 -0
- package/src/components/Input.vue +619 -0
- package/src/components/Kbd.vue +30 -0
- package/src/components/ListMenu.vue +127 -0
- package/src/components/ListMenuItem.vue +171 -0
- package/src/components/Modal.vue +209 -0
- package/src/components/Numpad.vue +118 -0
- package/src/components/Popup.vue +156 -0
- package/src/components/ProgressBar.vue +107 -0
- package/src/components/Prompt.vue +161 -0
- package/src/components/Radio.vue +50 -0
- package/src/components/Select.vue +470 -0
- package/src/components/Slider.vue +93 -0
- package/src/components/Stepper.vue +53 -0
- package/src/components/Toggle.vue +125 -0
- package/src/components/Tooltip.vue +113 -0
- package/src/components/index.js +109 -0
- package/src/composables/onClickOutside.js +61 -0
- package/src/composables/useBackButton.js +98 -0
- package/src/composables/useEventListener.js +65 -0
- package/src/icons/Icon.vue +139 -0
- package/src/icons/mdi.js +67 -0
- package/src/icons/registry.js +64 -0
- package/src/icons/resolver.js +48 -0
- package/src/index.js +167 -0
- package/src/manifest.js +86 -0
- package/src/nuxt.js +315 -0
- package/src/style.css +20 -0
- package/src/tailwind.css +18 -0
- package/src/theme.css +172 -0
- package/src/vite.js +235 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createElementBlock, openBlock, renderSlot } from "vue";
|
|
2
|
+
//#region src/components/Kbd.vue
|
|
3
|
+
var _hoisted_1 = { class: "px-3 py-1 bg-gray-100 dark:bg-gray-800 rounded text-sm font-mono text-gray-900 dark:text-gray-400" };
|
|
4
|
+
var _sfc_main = {
|
|
5
|
+
__name: "Kbd",
|
|
6
|
+
setup(__props) {
|
|
7
|
+
/**
|
|
8
|
+
* UiKbd — Keyboard shortcut badge for displaying key combinations.
|
|
9
|
+
*
|
|
10
|
+
* Renders a styled `<kbd>` element with monospace font and subtle background,
|
|
11
|
+
* matching the app's light/dark theme. Used in help screens and shortcut hints.
|
|
12
|
+
*
|
|
13
|
+
* @example Single key
|
|
14
|
+
* <UiKbd>Enter</UiKbd>
|
|
15
|
+
*
|
|
16
|
+
* @example Key combination
|
|
17
|
+
* <UiKbd>Ctrl+S</UiKbd>
|
|
18
|
+
*
|
|
19
|
+
* @example In a shortcut row
|
|
20
|
+
* <div class="flex justify-between">
|
|
21
|
+
* <span>Save</span>
|
|
22
|
+
* <UiKbd>{{ modLabel }}+S</UiKbd>
|
|
23
|
+
* </div>
|
|
24
|
+
*
|
|
25
|
+
* @slot default — Key text or combination to display
|
|
26
|
+
*/
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
return openBlock(), createElementBlock("kbd", _hoisted_1, [renderSlot(_ctx.$slots, "default")]);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { _sfc_main as default };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=Kbd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.js","names":[],"sources":["../../src/components/Kbd.vue"],"sourcesContent":["<template>\n <kbd\n class=\"px-3 py-1 bg-gray-100 dark:bg-gray-800 rounded text-sm font-mono text-gray-900 dark:text-gray-400\"\n >\n <slot />\n </kbd>\n</template>\n\n<script setup>\n/**\n * UiKbd — Keyboard shortcut badge for displaying key combinations.\n *\n * Renders a styled `<kbd>` element with monospace font and subtle background,\n * matching the app's light/dark theme. Used in help screens and shortcut hints.\n *\n * @example Single key\n * <UiKbd>Enter</UiKbd>\n *\n * @example Key combination\n * <UiKbd>Ctrl+S</UiKbd>\n *\n * @example In a shortcut row\n * <div class=\"flex justify-between\">\n * <span>Save</span>\n * <UiKbd>{{ modLabel }}+S</UiKbd>\n * </div>\n *\n * @slot default — Key text or combination to display\n */\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;GACE,OAAA,UAAA,GAAA,mBAIM,OAJN,YAIM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, openBlock, renderSlot, toDisplayString } from "vue";
|
|
2
|
+
//#region src/components/ListMenu.vue
|
|
3
|
+
var _sfc_main = {
|
|
4
|
+
__name: "ListMenu",
|
|
5
|
+
props: {
|
|
6
|
+
/**
|
|
7
|
+
* Section label displayed above the list in uppercase.
|
|
8
|
+
* @type {string}
|
|
9
|
+
* @default ''
|
|
10
|
+
*/
|
|
11
|
+
label: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Use danger/red styling for the container border, background, and label.
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
danger: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Border radius preset for the container.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @default 'xl'
|
|
28
|
+
* @values 'xl' | 'lg' | 'none'
|
|
29
|
+
*/
|
|
30
|
+
rounded: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "xl"
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Visual preset that adjusts container styling for different contexts.
|
|
36
|
+
* - 'default' — Standard bordered list with gray background
|
|
37
|
+
* - 'settings' — White bg, subtle border, inset label — ideal for settings panels
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @default 'default'
|
|
40
|
+
* @values 'default' | 'settings'
|
|
41
|
+
*/
|
|
42
|
+
preset: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "default"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
setup(__props) {
|
|
48
|
+
/**
|
|
49
|
+
* UiListMenu — Grouped list container for UiListMenuItem rows.
|
|
50
|
+
*
|
|
51
|
+
* A versatile container for grouped rows of any kind: clickable actions,
|
|
52
|
+
* settings with toggles/selects, informational rows, or mixed content.
|
|
53
|
+
* Supports an optional uppercase section label, a danger (red) color scheme,
|
|
54
|
+
* and visual presets for different contexts.
|
|
55
|
+
*
|
|
56
|
+
* @example Action list
|
|
57
|
+
* <UiListMenu label="Account">
|
|
58
|
+
* <UiListMenuItem icon="mdi:account" clickable>Profile</UiListMenuItem>
|
|
59
|
+
* <UiListMenuItem icon="mdi:lock" clickable>Security</UiListMenuItem>
|
|
60
|
+
* </UiListMenu>
|
|
61
|
+
*
|
|
62
|
+
* @example Settings panel preset with mixed content
|
|
63
|
+
* <UiListMenu label="Display" preset="settings">
|
|
64
|
+
* <UiListMenuItem icon="mdi:translate" label="Language">
|
|
65
|
+
* <template #suffix><UiSelect ... /></template>
|
|
66
|
+
* </UiListMenuItem>
|
|
67
|
+
* <UiListMenuItem icon="mdi:wrap" label="Word Wrap">
|
|
68
|
+
* <template #suffix><UiToggle ... /></template>
|
|
69
|
+
* </UiListMenuItem>
|
|
70
|
+
* </UiListMenu>
|
|
71
|
+
*
|
|
72
|
+
* @example Danger zone
|
|
73
|
+
* <UiListMenu label="Danger Zone" danger>
|
|
74
|
+
* <UiListMenuItem icon="mdi:trash-can" danger clickable>Delete Account</UiListMenuItem>
|
|
75
|
+
* </UiListMenu>
|
|
76
|
+
*
|
|
77
|
+
* @slot default — List items (typically UiListMenuItem components)
|
|
78
|
+
*
|
|
79
|
+
* @see UiListMenuItem — Row item designed for use inside this list
|
|
80
|
+
*/
|
|
81
|
+
const props = __props;
|
|
82
|
+
const shapeClass = computed(() => {
|
|
83
|
+
const map = {
|
|
84
|
+
xl: "rounded-xl",
|
|
85
|
+
lg: "rounded-lg",
|
|
86
|
+
none: ""
|
|
87
|
+
};
|
|
88
|
+
return map[props.rounded] ?? map.xl;
|
|
89
|
+
});
|
|
90
|
+
const childRadiusClass = computed(() => {
|
|
91
|
+
const map = {
|
|
92
|
+
xl: "[&>*:first-child]:rounded-t-xl [&>*:last-child]:rounded-b-xl",
|
|
93
|
+
lg: "[&>*:first-child]:rounded-t-lg [&>*:last-child]:rounded-b-lg",
|
|
94
|
+
none: ""
|
|
95
|
+
};
|
|
96
|
+
return map[props.rounded] ?? map.xl;
|
|
97
|
+
});
|
|
98
|
+
const containerClass = computed(() => {
|
|
99
|
+
if (props.danger) return "bg-red-50/50 dark:bg-red-900/10 border border-red-100 dark:border-red-900/30 divide-red-100 dark:divide-red-900/30";
|
|
100
|
+
const presetMap = {
|
|
101
|
+
default: "bg-gray-50 dark:bg-gray-900 border border-gray-100 dark:border-gray-800 divide-gray-100 dark:divide-gray-800",
|
|
102
|
+
settings: "bg-white dark:bg-gray-800/40 border border-gray-200/80 dark:border-gray-700/50 divide-gray-100 dark:divide-gray-700/40"
|
|
103
|
+
};
|
|
104
|
+
return presetMap[props.preset] ?? presetMap.default;
|
|
105
|
+
});
|
|
106
|
+
const labelSizeClass = computed(() => {
|
|
107
|
+
const map = {
|
|
108
|
+
default: "text-[10px]",
|
|
109
|
+
settings: "text-[11px]"
|
|
110
|
+
};
|
|
111
|
+
return map[props.preset] ?? map.default;
|
|
112
|
+
});
|
|
113
|
+
const labelPaddingClass = computed(() => {
|
|
114
|
+
const map = {
|
|
115
|
+
default: "px-1",
|
|
116
|
+
settings: "px-1"
|
|
117
|
+
};
|
|
118
|
+
return map[props.preset] ?? map.default;
|
|
119
|
+
});
|
|
120
|
+
const labelColorClass = computed(() => {
|
|
121
|
+
if (props.danger) return "text-red-400 dark:text-red-600";
|
|
122
|
+
return "text-gray-400 dark:text-gray-500";
|
|
123
|
+
});
|
|
124
|
+
return (_ctx, _cache) => {
|
|
125
|
+
return openBlock(), createElementBlock("div", null, [__props.label ? (openBlock(), createElementBlock("p", {
|
|
126
|
+
key: 0,
|
|
127
|
+
class: normalizeClass(["font-medium uppercase tracking-wider mb-1.5", [
|
|
128
|
+
labelSizeClass.value,
|
|
129
|
+
labelColorClass.value,
|
|
130
|
+
labelPaddingClass.value
|
|
131
|
+
]])
|
|
132
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(["divide-y", [
|
|
133
|
+
shapeClass.value,
|
|
134
|
+
containerClass.value,
|
|
135
|
+
childRadiusClass.value
|
|
136
|
+
]]) }, [renderSlot(_ctx.$slots, "default")], 2)]);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
export { _sfc_main as default };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=ListMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListMenu.js","names":[],"sources":["../../src/components/ListMenu.vue"],"sourcesContent":["<template>\n <div>\n <!-- Optional section label above the list -->\n <p\n v-if=\"label\"\n class=\"font-medium uppercase tracking-wider mb-1.5\"\n :class=\"[labelSizeClass, labelColorClass, labelPaddingClass]\"\n >\n {{ label }}\n </p>\n <div class=\"divide-y\" :class=\"[shapeClass, containerClass, childRadiusClass]\">\n <slot />\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiListMenu — Grouped list container for UiListMenuItem rows.\n *\n * A versatile container for grouped rows of any kind: clickable actions,\n * settings with toggles/selects, informational rows, or mixed content.\n * Supports an optional uppercase section label, a danger (red) color scheme,\n * and visual presets for different contexts.\n *\n * @example Action list\n * <UiListMenu label=\"Account\">\n * <UiListMenuItem icon=\"mdi:account\" clickable>Profile</UiListMenuItem>\n * <UiListMenuItem icon=\"mdi:lock\" clickable>Security</UiListMenuItem>\n * </UiListMenu>\n *\n * @example Settings panel preset with mixed content\n * <UiListMenu label=\"Display\" preset=\"settings\">\n * <UiListMenuItem icon=\"mdi:translate\" label=\"Language\">\n * <template #suffix><UiSelect ... /></template>\n * </UiListMenuItem>\n * <UiListMenuItem icon=\"mdi:wrap\" label=\"Word Wrap\">\n * <template #suffix><UiToggle ... /></template>\n * </UiListMenuItem>\n * </UiListMenu>\n *\n * @example Danger zone\n * <UiListMenu label=\"Danger Zone\" danger>\n * <UiListMenuItem icon=\"mdi:trash-can\" danger clickable>Delete Account</UiListMenuItem>\n * </UiListMenu>\n *\n * @slot default — List items (typically UiListMenuItem components)\n *\n * @see UiListMenuItem — Row item designed for use inside this list\n */\nimport { computed } from 'vue'\nconst props = defineProps({\n /**\n * Section label displayed above the list in uppercase.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Use danger/red styling for the container border, background, and label.\n * @type {boolean}\n * @default false\n */\n danger: { type: Boolean, default: false },\n\n /**\n * Border radius preset for the container.\n * @type {string}\n * @default 'xl'\n * @values 'xl' | 'lg' | 'none'\n */\n rounded: { type: String, default: 'xl' },\n\n /**\n * Visual preset that adjusts container styling for different contexts.\n * - 'default' — Standard bordered list with gray background\n * - 'settings' — White bg, subtle border, inset label — ideal for settings panels\n * @type {string}\n * @default 'default'\n * @values 'default' | 'settings'\n */\n preset: { type: String, default: 'default' },\n})\n\nconst shapeClass = computed(() => {\n const map = { xl: 'rounded-xl', lg: 'rounded-lg', none: '' }\n return map[props.rounded] ?? map.xl\n})\n\nconst childRadiusClass = computed(() => {\n const map = {\n xl: '[&>*:first-child]:rounded-t-xl [&>*:last-child]:rounded-b-xl',\n lg: '[&>*:first-child]:rounded-t-lg [&>*:last-child]:rounded-b-lg',\n none: '',\n }\n return map[props.rounded] ?? map.xl\n})\n\nconst containerClass = computed(() => {\n if (props.danger) {\n return 'bg-red-50/50 dark:bg-red-900/10 border border-red-100 dark:border-red-900/30 divide-red-100 dark:divide-red-900/30'\n }\n const presetMap = {\n default:\n 'bg-gray-50 dark:bg-gray-900 border border-gray-100 dark:border-gray-800 divide-gray-100 dark:divide-gray-800',\n settings:\n 'bg-white dark:bg-gray-800/40 border border-gray-200/80 dark:border-gray-700/50 divide-gray-100 dark:divide-gray-700/40',\n }\n return presetMap[props.preset] ?? presetMap.default\n})\n\nconst labelSizeClass = computed(() => {\n const map = { default: 'text-[10px]', settings: 'text-[11px]' }\n return map[props.preset] ?? map.default\n})\n\nconst labelPaddingClass = computed(() => {\n const map = { default: 'px-1', settings: 'px-1' }\n return map[props.preset] ?? map.default\n})\n\nconst labelColorClass = computed(() => {\n if (props.danger) return 'text-red-400 dark:text-red-600'\n return 'text-gray-400 dark:text-gray-500'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,MAAM,QAAQ;EAkCd,MAAM,aAAa,eAAe;GAChC,MAAM,MAAM;IAAE,IAAI;IAAc,IAAI;IAAc,MAAM;GAAG;GAC3D,OAAO,IAAI,MAAM,YAAY,IAAI;EACnC,CAAC;EAED,MAAM,mBAAmB,eAAe;GACtC,MAAM,MAAM;IACV,IAAI;IACJ,IAAI;IACJ,MAAM;GACR;GACA,OAAO,IAAI,MAAM,YAAY,IAAI;EACnC,CAAC;EAED,MAAM,iBAAiB,eAAe;GACpC,IAAI,MAAM,QACR,OAAO;GAET,MAAM,YAAY;IAChB,SACE;IACF,UACE;GACJ;GACA,OAAO,UAAU,MAAM,WAAW,UAAU;EAC9C,CAAC;EAED,MAAM,iBAAiB,eAAe;GACpC,MAAM,MAAM;IAAE,SAAS;IAAe,UAAU;GAAc;GAC9D,OAAO,IAAI,MAAM,WAAW,IAAI;EAClC,CAAC;EAED,MAAM,oBAAoB,eAAe;GACvC,MAAM,MAAM;IAAE,SAAS;IAAQ,UAAU;GAAO;GAChD,OAAO,IAAI,MAAM,WAAW,IAAI;EAClC,CAAC;EAED,MAAM,kBAAkB,eAAe;GACrC,IAAI,MAAM,QAAQ,OAAO;GACzB,OAAO;EACT,CAAC;;GA5HC,OAAA,UAAA,GAAA,mBAYM,OAAA,MAAA,CATI,QAAA,SADR,UAAA,GAAA,mBAMI,KAAA;;IAJF,OAAK,eAAA,CAAC,+CAA6C;KAC1C,eAAA;KAAgB,gBAAA;KAAiB,kBAAA;IAAiB,CAAA,CAAA;GAExD,GAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAEV,mBAEM,OAAA,EAFD,OAAK,eAAA,CAAC,YAAU;IAAU,WAAA;IAAY,eAAA;IAAgB,iBAAA;GAAgB,CAAA,CAAA,EAAA,GAAA,CACzE,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx, withModifiers } from "vue";
|
|
3
|
+
//#region src/components/ListMenuItem.vue
|
|
4
|
+
var _hoisted_1 = { class: "flex-1 min-w-0" };
|
|
5
|
+
var _hoisted_2 = { class: "block truncate" };
|
|
6
|
+
var _hoisted_3 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "block text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5"
|
|
9
|
+
};
|
|
10
|
+
var _sfc_main = {
|
|
11
|
+
__name: "ListMenuItem",
|
|
12
|
+
props: {
|
|
13
|
+
/** MDI icon name displayed at the start of the row. */
|
|
14
|
+
icon: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
/** Custom CSS class override for the icon element. */
|
|
19
|
+
iconClass: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
/** Whether this item is a clickable action (renders as button with hover states + chevron). */
|
|
24
|
+
clickable: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Toggle state. When set to a boolean, the row becomes a tappable toggle.
|
|
30
|
+
* Clicking anywhere emits `update:toggle` with the inverted value.
|
|
31
|
+
*/
|
|
32
|
+
toggle: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Reference to a UiSelect component instance. When provided, the row becomes
|
|
38
|
+
* tappable and clicking anywhere opens the select dropdown.
|
|
39
|
+
*/
|
|
40
|
+
selectRef: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: void 0
|
|
43
|
+
},
|
|
44
|
+
/** Show a chevron-right icon as the trailing suffix (only when clickable). */
|
|
45
|
+
chevron: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
/** Danger/red styling for destructive actions. */
|
|
50
|
+
danger: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
/** Disabled state — dims the item and prevents interaction. */
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
/** Optional hint text displayed below the label. */
|
|
60
|
+
hint: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: ""
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Size preset for padding and icon dimensions.
|
|
66
|
+
* @values 'md' | 'sm'
|
|
67
|
+
*/
|
|
68
|
+
size: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "md"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
emits: ["click", "update:toggle"],
|
|
74
|
+
setup(__props, { emit: __emit }) {
|
|
75
|
+
/**
|
|
76
|
+
* UiListMenuItem — Single row item for use inside UiListMenu.
|
|
77
|
+
*
|
|
78
|
+
* A versatile row component that can serve as:
|
|
79
|
+
* - A clickable action row (set `clickable`)
|
|
80
|
+
* - A toggle row where tapping anywhere toggles (set `toggle`)
|
|
81
|
+
* - A select row where tapping anywhere opens the select (set `selectRef`)
|
|
82
|
+
* - A static row hosting suffix controls (default)
|
|
83
|
+
*
|
|
84
|
+
* @example Clickable action row
|
|
85
|
+
* <UiListMenuItem icon="mdi:account" clickable @click="goProfile">Profile</UiListMenuItem>
|
|
86
|
+
*
|
|
87
|
+
* @example Toggle row (whole row is tappable)
|
|
88
|
+
* <UiListMenuItem icon="mdi:wrap" :toggle="wordWrap" @update:toggle="wordWrap = $event">
|
|
89
|
+
* Word Wrap
|
|
90
|
+
* <template #suffix><UiToggle :model-value="wordWrap" readonly /></template>
|
|
91
|
+
* </UiListMenuItem>
|
|
92
|
+
*
|
|
93
|
+
* @example Select row (whole row opens the select)
|
|
94
|
+
* <UiListMenuItem icon="mdi:translate" :select-ref="langRef">
|
|
95
|
+
* Language
|
|
96
|
+
* <template #suffix><UiSelect ref="langRef" ... /></template>
|
|
97
|
+
* </UiListMenuItem>
|
|
98
|
+
*
|
|
99
|
+
* @emits {void} click — Emitted when a clickable item is clicked
|
|
100
|
+
* @emits {boolean} update:toggle — Emitted with the new value when a toggle row is tapped
|
|
101
|
+
*
|
|
102
|
+
* @slot default — Label text
|
|
103
|
+
* @slot suffix — Trailing content (toggle, select, badge, etc.)
|
|
104
|
+
*
|
|
105
|
+
* @see UiListMenu — Parent container for grouping list items
|
|
106
|
+
*/
|
|
107
|
+
const props = __props;
|
|
108
|
+
const emit = __emit;
|
|
109
|
+
const isToggle = computed(() => props.toggle !== void 0);
|
|
110
|
+
const isSelect = computed(() => props.selectRef !== void 0);
|
|
111
|
+
const isInteractive = computed(() => props.clickable || isToggle.value || isSelect.value);
|
|
112
|
+
const handleClick = () => {
|
|
113
|
+
if (props.disabled) return;
|
|
114
|
+
if (isToggle.value) emit("update:toggle", !props.toggle);
|
|
115
|
+
else if (isSelect.value) props.selectRef?.toggle?.();
|
|
116
|
+
else if (props.clickable) emit("click");
|
|
117
|
+
};
|
|
118
|
+
const handleSuffixClick = (e) => {
|
|
119
|
+
if (isToggle.value && !props.disabled) {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
emit("update:toggle", !props.toggle);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (isSelect.value) {
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (props.clickable) e.stopPropagation();
|
|
129
|
+
};
|
|
130
|
+
const sizeClass = computed(() => {
|
|
131
|
+
const map = {
|
|
132
|
+
md: "px-4 py-3",
|
|
133
|
+
sm: "px-3 py-2.5"
|
|
134
|
+
};
|
|
135
|
+
return map[props.size] ?? map.md;
|
|
136
|
+
});
|
|
137
|
+
const iconSizeClass = computed(() => {
|
|
138
|
+
const map = {
|
|
139
|
+
md: "w-[18px] h-[18px]",
|
|
140
|
+
sm: "w-4 h-4"
|
|
141
|
+
};
|
|
142
|
+
return map[props.size] ?? map.md;
|
|
143
|
+
});
|
|
144
|
+
const defaultIconColorClass = computed(() => {
|
|
145
|
+
if (props.danger) return "text-red-500 dark:text-red-400";
|
|
146
|
+
return "text-gray-400 dark:text-gray-500";
|
|
147
|
+
});
|
|
148
|
+
const colorClass = computed(() => {
|
|
149
|
+
if (props.disabled) return "opacity-40 cursor-not-allowed";
|
|
150
|
+
if (!isInteractive.value) return props.danger ? "text-red-600 dark:text-red-400" : "text-gray-700 dark:text-gray-300";
|
|
151
|
+
if (props.danger) return "text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 active:bg-red-100 dark:active:bg-red-900/30 cursor-pointer";
|
|
152
|
+
return "text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/40 active:bg-gray-100 dark:active:bg-gray-700/60 cursor-pointer";
|
|
153
|
+
});
|
|
154
|
+
return (_ctx, _cache) => {
|
|
155
|
+
return openBlock(), createBlock(resolveDynamicComponent(isInteractive.value ? "button" : "div"), {
|
|
156
|
+
type: isInteractive.value ? "button" : void 0,
|
|
157
|
+
class: normalizeClass(["w-full flex items-center gap-3 text-sm text-left transition-colors", [sizeClass.value, colorClass.value]]),
|
|
158
|
+
disabled: isInteractive.value ? __props.disabled : void 0,
|
|
159
|
+
onClick: handleClick
|
|
160
|
+
}, {
|
|
161
|
+
default: withCtx(() => [
|
|
162
|
+
__props.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
163
|
+
key: 0,
|
|
164
|
+
name: __props.icon,
|
|
165
|
+
class: normalizeClass(["shrink-0", [iconSizeClass.value, __props.iconClass || defaultIconColorClass.value]])
|
|
166
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
167
|
+
createElementVNode("span", _hoisted_1, [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "default")]), __props.hint ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)]),
|
|
168
|
+
createElementVNode("div", {
|
|
169
|
+
class: "shrink-0 flex items-center",
|
|
170
|
+
onClick: withModifiers(handleSuffixClick, ["stop"])
|
|
171
|
+
}, [renderSlot(_ctx.$slots, "suffix", {}, () => [__props.clickable && __props.chevron ? (openBlock(), createBlock(_sfc_main$1, {
|
|
172
|
+
key: 0,
|
|
173
|
+
name: "mdi:chevron-right",
|
|
174
|
+
class: normalizeClass(["w-4 h-4", __props.danger ? "text-red-300 dark:text-red-800" : "text-gray-300 dark:text-gray-600"])
|
|
175
|
+
}, null, 8, ["class"])) : createCommentVNode("", true)])])
|
|
176
|
+
]),
|
|
177
|
+
_: 3
|
|
178
|
+
}, 8, [
|
|
179
|
+
"type",
|
|
180
|
+
"class",
|
|
181
|
+
"disabled"
|
|
182
|
+
]);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
export { _sfc_main as default };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=ListMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListMenuItem.js","names":[],"sources":["../../src/components/ListMenuItem.vue"],"sourcesContent":["<template>\n <component\n :is=\"isInteractive ? 'button' : 'div'\"\n :type=\"isInteractive ? 'button' : undefined\"\n class=\"w-full flex items-center gap-3 text-sm text-left transition-colors\"\n :class=\"[sizeClass, colorClass]\"\n :disabled=\"isInteractive ? disabled : undefined\"\n @click=\"handleClick\"\n >\n <UiIcon\n v-if=\"icon\"\n :name=\"icon\"\n class=\"shrink-0\"\n :class=\"[iconSizeClass, iconClass || defaultIconColorClass]\"\n />\n <span class=\"flex-1 min-w-0\">\n <span class=\"block truncate\"><slot /></span>\n <span v-if=\"hint\" class=\"block text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5\">{{\n hint\n }}</span>\n </span>\n <div class=\"shrink-0 flex items-center\" @click.stop=\"handleSuffixClick\">\n <slot name=\"suffix\">\n <UiIcon\n v-if=\"clickable && chevron\"\n name=\"mdi:chevron-right\"\n class=\"w-4 h-4\"\n :class=\"danger ? 'text-red-300 dark:text-red-800' : 'text-gray-300 dark:text-gray-600'\"\n />\n </slot>\n </div>\n </component>\n</template>\n\n<script setup>\n/**\n * UiListMenuItem — Single row item for use inside UiListMenu.\n *\n * A versatile row component that can serve as:\n * - A clickable action row (set `clickable`)\n * - A toggle row where tapping anywhere toggles (set `toggle`)\n * - A select row where tapping anywhere opens the select (set `selectRef`)\n * - A static row hosting suffix controls (default)\n *\n * @example Clickable action row\n * <UiListMenuItem icon=\"mdi:account\" clickable @click=\"goProfile\">Profile</UiListMenuItem>\n *\n * @example Toggle row (whole row is tappable)\n * <UiListMenuItem icon=\"mdi:wrap\" :toggle=\"wordWrap\" @update:toggle=\"wordWrap = $event\">\n * Word Wrap\n * <template #suffix><UiToggle :model-value=\"wordWrap\" readonly /></template>\n * </UiListMenuItem>\n *\n * @example Select row (whole row opens the select)\n * <UiListMenuItem icon=\"mdi:translate\" :select-ref=\"langRef\">\n * Language\n * <template #suffix><UiSelect ref=\"langRef\" ... /></template>\n * </UiListMenuItem>\n *\n * @emits {void} click — Emitted when a clickable item is clicked\n * @emits {boolean} update:toggle — Emitted with the new value when a toggle row is tapped\n *\n * @slot default — Label text\n * @slot suffix — Trailing content (toggle, select, badge, etc.)\n *\n * @see UiListMenu — Parent container for grouping list items\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /** MDI icon name displayed at the start of the row. */\n icon: { type: String, default: '' },\n\n /** Custom CSS class override for the icon element. */\n iconClass: { type: String, default: '' },\n\n /** Whether this item is a clickable action (renders as button with hover states + chevron). */\n clickable: { type: Boolean, default: false },\n\n /**\n * Toggle state. When set to a boolean, the row becomes a tappable toggle.\n * Clicking anywhere emits `update:toggle` with the inverted value.\n */\n toggle: { type: Boolean, default: undefined },\n\n /**\n * Reference to a UiSelect component instance. When provided, the row becomes\n * tappable and clicking anywhere opens the select dropdown.\n */\n selectRef: { type: Object, default: undefined },\n\n /** Show a chevron-right icon as the trailing suffix (only when clickable). */\n chevron: { type: Boolean, default: true },\n\n /** Danger/red styling for destructive actions. */\n danger: { type: Boolean, default: false },\n\n /** Disabled state — dims the item and prevents interaction. */\n disabled: { type: Boolean, default: false },\n\n /** Optional hint text displayed below the label. */\n hint: { type: String, default: '' },\n\n /**\n * Size preset for padding and icon dimensions.\n * @values 'md' | 'sm'\n */\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['click', 'update:toggle'])\n\nconst isToggle = computed(() => props.toggle !== undefined)\nconst isSelect = computed(() => props.selectRef !== undefined)\nconst isInteractive = computed(() => props.clickable || isToggle.value || isSelect.value)\n\nconst handleClick = () => {\n if (props.disabled) return\n if (isToggle.value) {\n emit('update:toggle', !props.toggle)\n } else if (isSelect.value) {\n props.selectRef?.toggle?.()\n } else if (props.clickable) {\n emit('click')\n }\n}\n\nconst handleSuffixClick = (e) => {\n // For toggle rows, clicking the suffix (the toggle itself) should also toggle\n if (isToggle.value && !props.disabled) {\n e.stopPropagation()\n emit('update:toggle', !props.toggle)\n return\n }\n // For select rows, let the select handle its own click (it calls toggleOpen)\n // but stop propagation so the row doesn't double-open\n if (isSelect.value) {\n e.stopPropagation()\n return\n }\n // For clickable rows, stop propagation so suffix controls work independently\n if (props.clickable) {\n e.stopPropagation()\n }\n}\n\nconst sizeClass = computed(() => {\n const map = { md: 'px-4 py-3', sm: 'px-3 py-2.5' }\n return map[props.size] ?? map.md\n})\n\nconst iconSizeClass = computed(() => {\n const map = { md: 'w-[18px] h-[18px]', sm: 'w-4 h-4' }\n return map[props.size] ?? map.md\n})\n\nconst defaultIconColorClass = computed(() => {\n if (props.danger) return 'text-red-500 dark:text-red-400'\n return 'text-gray-400 dark:text-gray-500'\n})\n\nconst colorClass = computed(() => {\n if (props.disabled) return 'opacity-40 cursor-not-allowed'\n if (!isInteractive.value) {\n return props.danger ? 'text-red-600 dark:text-red-400' : 'text-gray-700 dark:text-gray-300'\n }\n if (props.danger)\n return 'text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 active:bg-red-100 dark:active:bg-red-900/30 cursor-pointer'\n return 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/40 active:bg-gray-100 dark:active:bg-gray-700/60 cursor-pointer'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEA,MAAM,QAAQ;EAyCd,MAAM,OAAO;EAEb,MAAM,WAAW,eAAe,MAAM,WAAW,KAAA,CAAS;EAC1D,MAAM,WAAW,eAAe,MAAM,cAAc,KAAA,CAAS;EAC7D,MAAM,gBAAgB,eAAe,MAAM,aAAa,SAAS,SAAS,SAAS,KAAK;EAExF,MAAM,oBAAoB;GACxB,IAAI,MAAM,UAAU;GACpB,IAAI,SAAS,OACX,KAAK,iBAAiB,CAAC,MAAM,MAAM;QAC9B,IAAI,SAAS,OAClB,MAAM,WAAW,SAAS;QACrB,IAAI,MAAM,WACf,KAAK,OAAO;EAEhB;EAEA,MAAM,qBAAqB,MAAM;GAE/B,IAAI,SAAS,SAAS,CAAC,MAAM,UAAU;IACrC,EAAE,gBAAgB;IAClB,KAAK,iBAAiB,CAAC,MAAM,MAAM;IACnC;GACF;GAGA,IAAI,SAAS,OAAO;IAClB,EAAE,gBAAgB;IAClB;GACF;GAEA,IAAI,MAAM,WACR,EAAE,gBAAgB;EAEtB;EAEA,MAAM,YAAY,eAAe;GAC/B,MAAM,MAAM;IAAE,IAAI;IAAa,IAAI;GAAc;GACjD,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC;EAED,MAAM,gBAAgB,eAAe;GACnC,MAAM,MAAM;IAAE,IAAI;IAAqB,IAAI;GAAU;GACrD,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC;EAED,MAAM,wBAAwB,eAAe;GAC3C,IAAI,MAAM,QAAQ,OAAO;GACzB,OAAO;EACT,CAAC;EAED,MAAM,aAAa,eAAe;GAChC,IAAI,MAAM,UAAU,OAAO;GAC3B,IAAI,CAAC,cAAc,OACjB,OAAO,MAAM,SAAS,mCAAmC;GAE3D,IAAI,MAAM,QACR,OAAO;GACT,OAAO;EACT,CAAC;;GAxKC,OAAA,UAAA,GAAA,YA8BY,wBA7BL,cAAA,QAAa,WAAA,KAAA,GAAA;IACjB,MAAM,cAAA,QAAa,WAAc,KAAA;IAClC,OAAK,eAAA,CAAC,sEAAoE,CACjE,UAAA,OAAW,WAAA,KAAU,CAAA,CAAA;IAC7B,UAAU,cAAA,QAAgB,QAAA,WAAW,KAAA;IACrC,SAAO;;IAER,SAAA,cAKE;KAJM,QAAA,QADR,UAAA,GAAA,YAKE,aAAA;;MAHC,MAAM,QAAA;MACP,OAAK,eAAA,CAAC,YAAU,CACP,cAAA,OAAe,QAAA,aAAa,sBAAA,KAAqB,CAAA,CAAA;;KAE5D,mBAKO,QALP,YAKO,CAJL,mBAA4C,QAA5C,YAA4C,CAAf,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,GACzB,QAAA,QAAZ,UAAA,GAAA,mBAES,QAFT,YAES,gBADP,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;KAGR,mBASM,OAAA;MATD,OAAM;MAA8B,SAAK,cAAO,mBAAiB,CAAA,MAAA,CAAA;KACpE,GAAA,CAAA,WAOO,KAAA,QAAA,UAAA,CAAA,SAAA,CALG,QAAA,aAAa,QAAA,WADrB,UAAA,GAAA,YAKE,aAAA;;MAHA,MAAK;MACL,OAAK,eAAA,CAAC,WACE,QAAA,SAAM,mCAAA,kCAAA,CAAA"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { useBackButton } from "../composables/useBackButton.js";
|
|
2
|
+
import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, normalizeClass, onBeforeUnmount, openBlock, renderSlot, watch, withCtx, withModifiers } from "vue";
|
|
3
|
+
//#region src/components/Modal.vue
|
|
4
|
+
var _sfc_main = {
|
|
5
|
+
__name: "Modal",
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* Controls modal visibility. Use with v-model or :show + @close.
|
|
9
|
+
* @type {boolean}
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
show: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Maximum width preset for the modal panel.
|
|
18
|
+
* @type {string}
|
|
19
|
+
* @default 'sm'
|
|
20
|
+
* @values 'xs' (20rem) | 'sm' (24rem) | 'md' (28rem) | 'lg' (32rem) | 'xl' (36rem) | '2xl' (42rem) | '3xl' (48rem) | '4xl' (56rem) | '5xl' (64rem) | 'full'
|
|
21
|
+
*/
|
|
22
|
+
maxWidth: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "sm"
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Whether the modal goes fullscreen on mobile viewports.
|
|
28
|
+
* When true, the panel fills the screen on mobile and respects safe area insets.
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
fullscreenMobile: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Persistent mode — prevents closing when clicking the backdrop overlay.
|
|
38
|
+
* @type {boolean}
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
persistent: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Additional CSS classes applied to the modal panel element.
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @default ''
|
|
49
|
+
*/
|
|
50
|
+
panelClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ""
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Z-index class for the backdrop and modal layers.
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @default 'z-50'
|
|
58
|
+
*/
|
|
59
|
+
z: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "z-50"
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Padding class around the modal panel (applied to the backdrop container).
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @default 'md:p-4'
|
|
67
|
+
*/
|
|
68
|
+
padding: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "md:p-4"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
emits: ["close"],
|
|
74
|
+
setup(__props, { emit: __emit }) {
|
|
75
|
+
/**
|
|
76
|
+
* UiModal — Teleported modal dialog with backdrop, configurable max-width, and enter/leave transitions.
|
|
77
|
+
*
|
|
78
|
+
* Renders a centered overlay panel teleported to `<body>`. Supports ten max-width presets
|
|
79
|
+
* (xs through 5xl and full-screen), persistent mode to prevent backdrop-click dismissal,
|
|
80
|
+
* and customizable z-index and padding. The panel uses a scale+fade transition on enter/leave.
|
|
81
|
+
*
|
|
82
|
+
* @example Basic modal
|
|
83
|
+
* <UiModal :show="isOpen" @close="isOpen = false">
|
|
84
|
+
* <div class="p-6">Hello!</div>
|
|
85
|
+
* </UiModal>
|
|
86
|
+
*
|
|
87
|
+
* @example Large persistent modal
|
|
88
|
+
* <UiModal :show="showEditor" max-width="3xl" persistent>
|
|
89
|
+
* <ModalHeader @close="showEditor = false" />
|
|
90
|
+
* <div class="p-6">Editor content</div>
|
|
91
|
+
* </UiModal>
|
|
92
|
+
*
|
|
93
|
+
* @example Full-screen modal
|
|
94
|
+
* <UiModal :show="showFull" max-width="full">
|
|
95
|
+
* <div class="h-full">Full screen content</div>
|
|
96
|
+
* </UiModal>
|
|
97
|
+
*
|
|
98
|
+
* @example Non-fullscreen on mobile
|
|
99
|
+
* <UiModal :show="isOpen" :fullscreen-mobile="false" @close="isOpen = false">
|
|
100
|
+
* <div class="p-6">Centered on all screens</div>
|
|
101
|
+
* </UiModal>
|
|
102
|
+
*
|
|
103
|
+
* @emits {void} close — Emitted when the modal should close (backdrop click or programmatic)
|
|
104
|
+
*
|
|
105
|
+
* @slot default — Modal content
|
|
106
|
+
*/
|
|
107
|
+
const props = __props;
|
|
108
|
+
const emit = __emit;
|
|
109
|
+
const { register: registerBack, unregister: unregisterBack } = useBackButton();
|
|
110
|
+
let backHandlerId = null;
|
|
111
|
+
watch(() => props.show, (visible) => {
|
|
112
|
+
if (visible) backHandlerId = registerBack(() => {
|
|
113
|
+
if (props.persistent) return false;
|
|
114
|
+
emit("close");
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
else if (backHandlerId !== null) {
|
|
118
|
+
unregisterBack(backHandlerId);
|
|
119
|
+
backHandlerId = null;
|
|
120
|
+
}
|
|
121
|
+
}, { immediate: true });
|
|
122
|
+
onBeforeUnmount(() => {
|
|
123
|
+
if (backHandlerId !== null) {
|
|
124
|
+
unregisterBack(backHandlerId);
|
|
125
|
+
backHandlerId = null;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const zClass = computed(() => props.z);
|
|
129
|
+
const paddingClass = computed(() => props.padding);
|
|
130
|
+
const backdropClass = computed(() => {
|
|
131
|
+
if (props.fullscreenMobile) return "bg-transparent md:bg-black/50";
|
|
132
|
+
return "bg-black/50 p-4";
|
|
133
|
+
});
|
|
134
|
+
const mobileLayoutClass = computed(() => {
|
|
135
|
+
if (props.maxWidth === "full") return "fixed inset-0";
|
|
136
|
+
if (props.fullscreenMobile) return "fixed inset-0 modal-panel--safe-area md:static md:inset-auto";
|
|
137
|
+
return "relative max-h-[calc(100vh-2rem)] md:static";
|
|
138
|
+
});
|
|
139
|
+
const maxWidthClass = computed(() => {
|
|
140
|
+
if (props.maxWidth === "full") return "w-full h-full";
|
|
141
|
+
const map = {
|
|
142
|
+
xs: "md:max-w-xs",
|
|
143
|
+
sm: "md:max-w-sm",
|
|
144
|
+
md: "md:max-w-md",
|
|
145
|
+
lg: "md:max-w-lg",
|
|
146
|
+
xl: "md:max-w-xl",
|
|
147
|
+
"2xl": "md:max-w-2xl",
|
|
148
|
+
"3xl": "md:max-w-3xl",
|
|
149
|
+
"4xl": "md:max-w-4xl",
|
|
150
|
+
"5xl": "md:max-w-5xl"
|
|
151
|
+
};
|
|
152
|
+
if (props.fullscreenMobile) return `md:w-full ${map[props.maxWidth] || map.sm}`;
|
|
153
|
+
return `w-full ${map[props.maxWidth] || map.sm}`;
|
|
154
|
+
});
|
|
155
|
+
const roundedClass = computed(() => {
|
|
156
|
+
if (props.maxWidth === "full") return "rounded-none";
|
|
157
|
+
if (props.fullscreenMobile) return "rounded-none md:rounded-lg";
|
|
158
|
+
return "rounded-lg";
|
|
159
|
+
});
|
|
160
|
+
return (_ctx, _cache) => {
|
|
161
|
+
return openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, {
|
|
162
|
+
"enter-active-class": "transition ease-out duration-200",
|
|
163
|
+
"enter-from-class": "opacity-0",
|
|
164
|
+
"enter-to-class": "opacity-100",
|
|
165
|
+
"leave-active-class": "transition ease-in duration-150",
|
|
166
|
+
"leave-from-class": "opacity-100",
|
|
167
|
+
"leave-to-class": "opacity-0"
|
|
168
|
+
}, {
|
|
169
|
+
default: withCtx(() => [__props.show ? (openBlock(), createElementBlock("div", {
|
|
170
|
+
key: 0,
|
|
171
|
+
class: normalizeClass(["fixed inset-0 flex items-center justify-center", [
|
|
172
|
+
zClass.value,
|
|
173
|
+
paddingClass.value,
|
|
174
|
+
backdropClass.value
|
|
175
|
+
]]),
|
|
176
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => !__props.persistent && _ctx.$emit("close"), ["self"]))
|
|
177
|
+
}, [createVNode(Transition, {
|
|
178
|
+
"enter-active-class": "transition ease-out duration-300",
|
|
179
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
180
|
+
"enter-to-class": "opacity-100 scale-100",
|
|
181
|
+
"leave-active-class": "transition ease-in duration-200",
|
|
182
|
+
"leave-from-class": "opacity-100 scale-100",
|
|
183
|
+
"leave-to-class": "opacity-0 scale-95",
|
|
184
|
+
appear: ""
|
|
185
|
+
}, {
|
|
186
|
+
default: withCtx(() => [__props.show ? (openBlock(), createElementBlock("div", {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: normalizeClass(["modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col", [
|
|
189
|
+
__props.panelClass,
|
|
190
|
+
maxWidthClass.value,
|
|
191
|
+
roundedClass.value,
|
|
192
|
+
mobileLayoutClass.value
|
|
193
|
+
]]),
|
|
194
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
|
|
195
|
+
}, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("", true)]),
|
|
196
|
+
_: 3
|
|
197
|
+
})], 2)) : createCommentVNode("", true)]),
|
|
198
|
+
_: 3
|
|
199
|
+
})]);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
//#endregion
|
|
204
|
+
export { _sfc_main as default };
|
|
205
|
+
|
|
206
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["$emit"],"sources":["../../src/components/Modal.vue"],"sourcesContent":["<template>\n <!-- Teleported to body to avoid z-index stacking context issues -->\n <Teleport to=\"body\">\n <!-- Backdrop overlay with fade transition -->\n <Transition\n enter-active-class=\"transition ease-out duration-200\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition ease-in duration-150\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\"\n >\n <div\n v-if=\"show\"\n class=\"fixed inset-0 flex items-center justify-center\"\n :class=\"[zClass, paddingClass, backdropClass]\"\n @click.self=\"!persistent && $emit('close')\"\n >\n <Transition\n enter-active-class=\"transition ease-out duration-300\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition ease-in duration-200\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n appear\n >\n <div\n v-if=\"show\"\n class=\"modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col\"\n :class=\"[panelClass, maxWidthClass, roundedClass, mobileLayoutClass]\"\n @click.stop\n >\n <slot />\n </div>\n </Transition>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<script setup>\n/**\n * UiModal — Teleported modal dialog with backdrop, configurable max-width, and enter/leave transitions.\n *\n * Renders a centered overlay panel teleported to `<body>`. Supports ten max-width presets\n * (xs through 5xl and full-screen), persistent mode to prevent backdrop-click dismissal,\n * and customizable z-index and padding. The panel uses a scale+fade transition on enter/leave.\n *\n * @example Basic modal\n * <UiModal :show=\"isOpen\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Hello!</div>\n * </UiModal>\n *\n * @example Large persistent modal\n * <UiModal :show=\"showEditor\" max-width=\"3xl\" persistent>\n * <ModalHeader @close=\"showEditor = false\" />\n * <div class=\"p-6\">Editor content</div>\n * </UiModal>\n *\n * @example Full-screen modal\n * <UiModal :show=\"showFull\" max-width=\"full\">\n * <div class=\"h-full\">Full screen content</div>\n * </UiModal>\n *\n * @example Non-fullscreen on mobile\n * <UiModal :show=\"isOpen\" :fullscreen-mobile=\"false\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Centered on all screens</div>\n * </UiModal>\n *\n * @emits {void} close — Emitted when the modal should close (backdrop click or programmatic)\n *\n * @slot default — Modal content\n */\nimport { computed, watch, onBeforeUnmount } from 'vue'\nimport { useBackButton } from '../composables/useBackButton.js'\nconst props = defineProps({\n /**\n * Controls modal visibility. Use with v-model or :show + @close.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Maximum width preset for the modal panel.\n * @type {string}\n * @default 'sm'\n * @values 'xs' (20rem) | 'sm' (24rem) | 'md' (28rem) | 'lg' (32rem) | 'xl' (36rem) | '2xl' (42rem) | '3xl' (48rem) | '4xl' (56rem) | '5xl' (64rem) | 'full'\n */\n maxWidth: { type: String, default: 'sm' },\n\n /**\n * Whether the modal goes fullscreen on mobile viewports.\n * When true, the panel fills the screen on mobile and respects safe area insets.\n * @type {boolean}\n * @default true\n */\n fullscreenMobile: { type: Boolean, default: true },\n\n /**\n * Persistent mode — prevents closing when clicking the backdrop overlay.\n * @type {boolean}\n * @default false\n */\n persistent: { type: Boolean, default: false },\n\n /**\n * Additional CSS classes applied to the modal panel element.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n\n /**\n * Z-index class for the backdrop and modal layers.\n * @type {string}\n * @default 'z-50'\n */\n z: { type: String, default: 'z-50' },\n\n /**\n * Padding class around the modal panel (applied to the backdrop container).\n * @type {string}\n * @default 'md:p-4'\n */\n padding: { type: String, default: 'md:p-4' },\n})\n\nconst emit = defineEmits(['close'])\n\n// ── Back-button interception (Capacitor) ──\nconst { register: registerBack, unregister: unregisterBack } = useBackButton()\nlet backHandlerId = null\n\nwatch(\n () => props.show,\n (visible) => {\n if (visible) {\n backHandlerId = registerBack(() => {\n if (props.persistent) return false\n emit('close')\n return true\n })\n } else if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n})\n\nconst zClass = computed(() => props.z)\nconst paddingClass = computed(() => props.padding)\n\nconst backdropClass = computed(() => {\n if (props.fullscreenMobile) {\n return 'bg-transparent md:bg-black/50'\n }\n return 'bg-black/50 p-4'\n})\n\nconst mobileLayoutClass = computed(() => {\n if (props.maxWidth === 'full') return 'fixed inset-0'\n\n if (props.fullscreenMobile) {\n return 'fixed inset-0 modal-panel--safe-area md:static md:inset-auto'\n }\n // Non-fullscreen on mobile: centered dialog with max-height\n return 'relative max-h-[calc(100vh-2rem)] md:static'\n})\n\nconst maxWidthClass = computed(() => {\n if (props.maxWidth === 'full') return 'w-full h-full'\n\n const map = {\n xs: 'md:max-w-xs',\n sm: 'md:max-w-sm',\n md: 'md:max-w-md',\n lg: 'md:max-w-lg',\n xl: 'md:max-w-xl',\n '2xl': 'md:max-w-2xl',\n '3xl': 'md:max-w-3xl',\n '4xl': 'md:max-w-4xl',\n '5xl': 'md:max-w-5xl',\n }\n\n if (props.fullscreenMobile) {\n return `md:w-full ${map[props.maxWidth] || map.sm}`\n }\n return `w-full ${map[props.maxWidth] || map.sm}`\n})\n\nconst roundedClass = computed(() => {\n if (props.maxWidth === 'full') return 'rounded-none'\n\n if (props.fullscreenMobile) {\n return 'rounded-none md:rounded-lg'\n }\n return 'rounded-lg'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EA,MAAM,QAAQ;EAqDd,MAAM,OAAO;EAGb,MAAM,EAAE,UAAU,cAAc,YAAY,mBAAmB,cAAc;EAC7E,IAAI,gBAAgB;EAEpB,YACQ,MAAM,OACX,YAAY;GACX,IAAI,SACF,gBAAgB,mBAAmB;IACjC,IAAI,MAAM,YAAY,OAAO;IAC7B,KAAK,OAAO;IACZ,OAAO;GACT,CAAC;QACI,IAAI,kBAAkB,MAAM;IACjC,eAAe,aAAa;IAC5B,gBAAgB;GAClB;EACF,GACA,EAAE,WAAW,KAAK,CACpB;EAEA,sBAAsB;GACpB,IAAI,kBAAkB,MAAM;IAC1B,eAAe,aAAa;IAC5B,gBAAgB;GAClB;EACF,CAAC;EAED,MAAM,SAAS,eAAe,MAAM,CAAC;EACrC,MAAM,eAAe,eAAe,MAAM,OAAO;EAEjD,MAAM,gBAAgB,eAAe;GACnC,IAAI,MAAM,kBACR,OAAO;GAET,OAAO;EACT,CAAC;EAED,MAAM,oBAAoB,eAAe;GACvC,IAAI,MAAM,aAAa,QAAQ,OAAO;GAEtC,IAAI,MAAM,kBACR,OAAO;GAGT,OAAO;EACT,CAAC;EAED,MAAM,gBAAgB,eAAe;GACnC,IAAI,MAAM,aAAa,QAAQ,OAAO;GAEtC,MAAM,MAAM;IACV,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;GACT;GAEA,IAAI,MAAM,kBACR,OAAO,aAAa,IAAI,MAAM,aAAa,IAAI;GAEjD,OAAO,UAAU,IAAI,MAAM,aAAa,IAAI;EAC9C,CAAC;EAED,MAAM,eAAe,eAAe;GAClC,IAAI,MAAM,aAAa,QAAQ,OAAO;GAEtC,IAAI,MAAM,kBACR,OAAO;GAET,OAAO;EACT,CAAC;;GA7MC,OAAA,UAAA,GAAA,YAoCW,UAAA,EApCD,IAAG,OAAM,GAAA,CAEjB,YAiCa,YAAA;IAhCX,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;IACf,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;;IAEf,SAAA,cAwBM,CAvBE,QAAA,QADR,UAAA,GAAA,mBAwBM,OAAA;;KAtBJ,OAAK,eAAA,CAAC,kDAAgD;MAC7C,OAAA;MAAQ,aAAA;MAAc,cAAA;KAAa,CAAA,CAAA;KAC3C,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,WAAA,CAAQ,QAAA,cAAcA,KAAAA,MAAK,OAAA,GAAA,CAAA,MAAA,CAAA;IAEjC,GAAA,CAAA,YAiBa,YAAA;KAhBX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,QAAA;;KAEA,SAAA,cAOM,CANE,QAAA,QADR,UAAA,GAAA,mBAOM,OAAA;;MALJ,OAAK,eAAA,CAAC,uEAAqE;OAClE,QAAA;OAAY,cAAA;OAAe,aAAA;OAAc,kBAAA;MAAiB,CAAA,CAAA;MAClE,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;KAEX,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
|