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,106 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import _sfc_main$2 from "./Button.js";
|
|
3
|
+
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, openBlock, toDisplayString, withCtx } from "vue";
|
|
4
|
+
//#region src/components/DropdownItem.vue
|
|
5
|
+
var _hoisted_1 = { class: "flex-1 text-left" };
|
|
6
|
+
var _hoisted_2 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "text-xs text-gray-400 dark:text-gray-500"
|
|
9
|
+
};
|
|
10
|
+
var _sfc_main = {
|
|
11
|
+
__name: "DropdownItem",
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* MDI icon name displayed at the start of the row.
|
|
15
|
+
* @type {string}
|
|
16
|
+
* @required
|
|
17
|
+
*/
|
|
18
|
+
icon: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Text label for the menu item.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @required
|
|
26
|
+
*/
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Optional keyboard shortcut hint displayed on the right side.
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @default ''
|
|
35
|
+
*/
|
|
36
|
+
shortcut: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Disabled state — dims the item and prevents click events.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Color theme for the item text and hover background.
|
|
51
|
+
* Use 'red' for destructive actions.
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @default 'gray'
|
|
54
|
+
* @values 'gray' | 'red' | 'green' | 'amber'
|
|
55
|
+
*/
|
|
56
|
+
color: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "gray"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
emits: ["click"],
|
|
62
|
+
setup(__props) {
|
|
63
|
+
/**
|
|
64
|
+
* UiDropdownItem — Single menu item row for use inside UiDropdown.
|
|
65
|
+
*
|
|
66
|
+
* Renders a UiButton with `variant="menu-item"` containing an icon, label,
|
|
67
|
+
* and optional keyboard shortcut hint. Supports disabled state and destructive
|
|
68
|
+
* (red) color for dangerous actions like delete.
|
|
69
|
+
*
|
|
70
|
+
* @example Standard menu item
|
|
71
|
+
* <UiDropdownItem icon="mdi:pencil" label="Edit" @click="edit" />
|
|
72
|
+
*
|
|
73
|
+
* @example Destructive item with shortcut
|
|
74
|
+
* <UiDropdownItem icon="mdi:trash-can-outline" label="Delete" color="red" shortcut="⌫" @click="del" />
|
|
75
|
+
*
|
|
76
|
+
* @example Disabled item
|
|
77
|
+
* <UiDropdownItem icon="mdi:lock" label="Locked" disabled />
|
|
78
|
+
*
|
|
79
|
+
* @emits {void} click — Emitted when the item is clicked (unless disabled)
|
|
80
|
+
*
|
|
81
|
+
* @see UiDropdown — Parent dropdown container
|
|
82
|
+
*/
|
|
83
|
+
return (_ctx, _cache) => {
|
|
84
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
85
|
+
variant: "menu-item",
|
|
86
|
+
color: __props.color,
|
|
87
|
+
disabled: __props.disabled,
|
|
88
|
+
onClick: _cache[0] || (_cache[0] = ($event) => !__props.disabled && _ctx.$emit("click"))
|
|
89
|
+
}, {
|
|
90
|
+
default: withCtx(() => [
|
|
91
|
+
createVNode(_sfc_main$1, {
|
|
92
|
+
name: __props.icon,
|
|
93
|
+
class: "w-4 h-4 block shrink-0"
|
|
94
|
+
}, null, 8, ["name"]),
|
|
95
|
+
createElementVNode("span", _hoisted_1, toDisplayString(__props.label), 1),
|
|
96
|
+
__props.shortcut ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["color", "disabled"]);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { _sfc_main as default };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=DropdownItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownItem.js","names":["$emit"],"sources":["../../src/components/DropdownItem.vue"],"sourcesContent":["<template>\n <!-- Menu item row: icon + label + optional shortcut -->\n <UiButton\n variant=\"menu-item\"\n :color=\"color\"\n :disabled=\"disabled\"\n @click=\"!disabled && $emit('click')\"\n >\n <UiIcon :name=\"icon\" class=\"w-4 h-4 block shrink-0\" />\n <span class=\"flex-1 text-left\">{{ label }}</span>\n <span v-if=\"shortcut\" class=\"text-xs text-gray-400 dark:text-gray-500\">{{ shortcut }}</span>\n </UiButton>\n</template>\n\n<script setup>\n/**\n * UiDropdownItem — Single menu item row for use inside UiDropdown.\n *\n * Renders a UiButton with `variant=\"menu-item\"` containing an icon, label,\n * and optional keyboard shortcut hint. Supports disabled state and destructive\n * (red) color for dangerous actions like delete.\n *\n * @example Standard menu item\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n *\n * @example Destructive item with shortcut\n * <UiDropdownItem icon=\"mdi:trash-can-outline\" label=\"Delete\" color=\"red\" shortcut=\"⌫\" @click=\"del\" />\n *\n * @example Disabled item\n * <UiDropdownItem icon=\"mdi:lock\" label=\"Locked\" disabled />\n *\n * @emits {void} click — Emitted when the item is clicked (unless disabled)\n *\n * @see UiDropdown — Parent dropdown container\n */\nimport UiButton from './Button.vue'\nimport UiIcon from '../icons/Icon.vue'\ndefineProps({\n /**\n * MDI icon name displayed at the start of the row.\n * @type {string}\n * @required\n */\n icon: { type: String, required: true },\n\n /**\n * Text label for the menu item.\n * @type {string}\n * @required\n */\n label: { type: String, required: true },\n\n /**\n * Optional keyboard shortcut hint displayed on the right side.\n * @type {string}\n * @default ''\n */\n shortcut: { type: String, default: '' },\n\n /**\n * Disabled state — dims the item and prevents click events.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Color theme for the item text and hover background.\n * Use 'red' for destructive actions.\n * @type {string}\n * @default 'gray'\n * @values 'gray' | 'red' | 'green' | 'amber'\n */\n color: { type: String, default: 'gray' },\n})\n\ndefineEmits(['click'])\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEE,OAAA,UAAA,GAAA,YASW,aAAA;IART,SAAQ;IACP,OAAO,QAAA;IACP,UAAU,QAAA;IACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAA,CAAG,QAAA,YAAYA,KAAAA,MAAK,OAAA;;IAE1B,SAAA,cAAsD;KAAtD,YAAsD,aAAA;MAA7C,MAAM,QAAA;MAAM,OAAM;;KAC3B,mBAAiD,QAAjD,YAAiD,gBAAf,QAAA,KAAK,GAAA,CAAA;KAC3B,QAAA,YAAZ,UAAA,GAAA,mBAA4F,QAA5F,YAA4F,gBAAlB,QAAA,QAAQ,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElementBlock, openBlock, renderSlot } from "vue";
|
|
2
|
+
//#region src/components/DropdownRow.vue
|
|
3
|
+
var _hoisted_1 = { class: "flex items-center mx-2 my-1 rounded-lg bg-gray-50 dark:bg-gray-700/40 overflow-hidden" };
|
|
4
|
+
var _sfc_main = {
|
|
5
|
+
__name: "DropdownRow",
|
|
6
|
+
setup(__props) {
|
|
7
|
+
/**
|
|
8
|
+
* UiDropdownRow — Horizontal container for placing dropdown actions side by side.
|
|
9
|
+
*
|
|
10
|
+
* Wraps child elements in a compact, rounded row with a tinted background.
|
|
11
|
+
* Children should use variant="menu-item" with flex-1 and justify-center
|
|
12
|
+
* for balanced, centered layout. A UiDivider with direction="vertical"
|
|
13
|
+
* works well between items.
|
|
14
|
+
*
|
|
15
|
+
* @example Two actions side by side
|
|
16
|
+
* <UiDropdownRow>
|
|
17
|
+
* <UiButton variant="menu-item" class="flex-1 justify-center" @click="lock">
|
|
18
|
+
* <UiIcon name="mdi:lock" class="w-4 h-4" />
|
|
19
|
+
* Lock
|
|
20
|
+
* </UiButton>
|
|
21
|
+
* <UiDivider direction="vertical" />
|
|
22
|
+
* <UiButton variant="menu-item" color="red" class="flex-1 justify-center" @click="signOut">
|
|
23
|
+
* <UiIcon name="mdi:logout" class="w-4 h-4" />
|
|
24
|
+
* Sign Out
|
|
25
|
+
* </UiButton>
|
|
26
|
+
* </UiDropdownRow>
|
|
27
|
+
*
|
|
28
|
+
* @slot default — Action buttons (and optional dividers) to lay out horizontally
|
|
29
|
+
*
|
|
30
|
+
* @see UiDropdown — Parent dropdown container
|
|
31
|
+
* @see UiDropdownItem — Standard single-row dropdown item
|
|
32
|
+
*/
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "default")]);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { _sfc_main as default };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=DropdownRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownRow.js","names":[],"sources":["../../src/components/DropdownRow.vue"],"sourcesContent":["<template>\n <!-- Horizontal row of compact dropdown actions displayed side by side -->\n <div\n class=\"flex items-center mx-2 my-1 rounded-lg bg-gray-50 dark:bg-gray-700/40 overflow-hidden\"\n >\n <slot />\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdownRow — Horizontal container for placing dropdown actions side by side.\n *\n * Wraps child elements in a compact, rounded row with a tinted background.\n * Children should use variant=\"menu-item\" with flex-1 and justify-center\n * for balanced, centered layout. A UiDivider with direction=\"vertical\"\n * works well between items.\n *\n * @example Two actions side by side\n * <UiDropdownRow>\n * <UiButton variant=\"menu-item\" class=\"flex-1 justify-center\" @click=\"lock\">\n * <UiIcon name=\"mdi:lock\" class=\"w-4 h-4\" />\n * Lock\n * </UiButton>\n * <UiDivider direction=\"vertical\" />\n * <UiButton variant=\"menu-item\" color=\"red\" class=\"flex-1 justify-center\" @click=\"signOut\">\n * <UiIcon name=\"mdi:logout\" class=\"w-4 h-4\" />\n * Sign Out\n * </UiButton>\n * </UiDropdownRow>\n *\n * @slot default — Action buttons (and optional dividers) to lay out horizontally\n *\n * @see UiDropdown — Parent dropdown container\n * @see UiDropdownItem — Standard single-row dropdown item\n */\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEE,OAAA,UAAA,GAAA,mBAIM,OAJN,YAIM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import _sfc_main$2 from "./Button.js";
|
|
3
|
+
import { Transition, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderSlot, toDisplayString, withCtx } from "vue";
|
|
4
|
+
//#region src/components/DropdownSubmenu.vue
|
|
5
|
+
var _hoisted_1 = { class: "flex-1 text-left" };
|
|
6
|
+
var _hoisted_2 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "overflow-hidden bg-gray-50 dark:bg-gray-850 border-l-2 border-primary-400 ml-5"
|
|
9
|
+
};
|
|
10
|
+
var _sfc_main = {
|
|
11
|
+
__name: "DropdownSubmenu",
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* MDI icon name displayed at the start of the trigger row.
|
|
15
|
+
* @type {string}
|
|
16
|
+
* @required
|
|
17
|
+
*/
|
|
18
|
+
icon: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Text label for the submenu trigger.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @required
|
|
26
|
+
*/
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Disabled state — prevents opening the submenu.
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Align the desktop flyout to the left (right-to-left) instead of the default right.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
alignLeft: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
setup(__props) {
|
|
51
|
+
/**
|
|
52
|
+
* UiDropdownSubmenu — Nested submenu for UiDropdown with responsive behavior.
|
|
53
|
+
*
|
|
54
|
+
* On desktop (≥640px), shows a flyout panel on hover to the left or right.
|
|
55
|
+
* On mobile (<640px), expands inline as an accordion with a left border accent.
|
|
56
|
+
* Automatically detects viewport width on mount and resize.
|
|
57
|
+
*
|
|
58
|
+
* @example Basic submenu
|
|
59
|
+
* <UiDropdownSubmenu icon="mdi:format-text" label="Text Style">
|
|
60
|
+
* <UiDropdownItem icon="mdi:format-bold" label="Bold" @click="bold" />
|
|
61
|
+
* <UiDropdownItem icon="mdi:format-italic" label="Italic" @click="italic" />
|
|
62
|
+
* </UiDropdownSubmenu>
|
|
63
|
+
*
|
|
64
|
+
* @example Left-aligned flyout
|
|
65
|
+
* <UiDropdownSubmenu icon="mdi:share" label="Share" align-left>
|
|
66
|
+
* <UiDropdownItem icon="mdi:email" label="Email" @click="shareEmail" />
|
|
67
|
+
* </UiDropdownSubmenu>
|
|
68
|
+
*
|
|
69
|
+
* @slot default — Submenu items (typically UiDropdownItem components)
|
|
70
|
+
*
|
|
71
|
+
* @see UiDropdown — Parent dropdown container
|
|
72
|
+
* @see UiDropdownItem — Standard menu item for use inside this submenu
|
|
73
|
+
*/
|
|
74
|
+
const showSub = ref(false);
|
|
75
|
+
const isMobile = ref(false);
|
|
76
|
+
const checkMobile = () => {
|
|
77
|
+
isMobile.value = window.innerWidth < 640;
|
|
78
|
+
};
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
checkMobile();
|
|
81
|
+
window.addEventListener("resize", checkMobile);
|
|
82
|
+
});
|
|
83
|
+
onUnmounted(() => {
|
|
84
|
+
window.removeEventListener("resize", checkMobile);
|
|
85
|
+
});
|
|
86
|
+
return (_ctx, _cache) => {
|
|
87
|
+
return openBlock(), createElementBlock("div", {
|
|
88
|
+
class: "relative",
|
|
89
|
+
onMouseenter: _cache[1] || (_cache[1] = ($event) => !isMobile.value && (showSub.value = true)),
|
|
90
|
+
onMouseleave: _cache[2] || (_cache[2] = ($event) => !isMobile.value && (showSub.value = false))
|
|
91
|
+
}, [
|
|
92
|
+
createVNode(_sfc_main$2, {
|
|
93
|
+
variant: "menu-item",
|
|
94
|
+
disabled: __props.disabled,
|
|
95
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showSub.value = !showSub.value)
|
|
96
|
+
}, {
|
|
97
|
+
default: withCtx(() => [
|
|
98
|
+
createVNode(_sfc_main$1, {
|
|
99
|
+
name: __props.icon,
|
|
100
|
+
class: "w-4 h-4 block shrink-0"
|
|
101
|
+
}, null, 8, ["name"]),
|
|
102
|
+
createElementVNode("span", _hoisted_1, toDisplayString(__props.label), 1),
|
|
103
|
+
createVNode(_sfc_main$1, {
|
|
104
|
+
name: isMobile.value ? showSub.value ? "mdi:chevron-up" : "mdi:chevron-down" : "mdi:chevron-right",
|
|
105
|
+
class: "w-3.5 h-3.5 block shrink-0 text-gray-400"
|
|
106
|
+
}, null, 8, ["name"])
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}, 8, ["disabled"]),
|
|
110
|
+
createVNode(Transition, {
|
|
111
|
+
"enter-active-class": "transition-all duration-100 ease-out",
|
|
112
|
+
"enter-from-class": "max-h-0 opacity-0",
|
|
113
|
+
"enter-to-class": "max-h-60 opacity-100",
|
|
114
|
+
"leave-active-class": "transition-all duration-75 ease-in",
|
|
115
|
+
"leave-from-class": "max-h-60 opacity-100",
|
|
116
|
+
"leave-to-class": "max-h-0 opacity-0"
|
|
117
|
+
}, {
|
|
118
|
+
default: withCtx(() => [showSub.value && !__props.disabled && isMobile.value ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("", true)]),
|
|
119
|
+
_: 3
|
|
120
|
+
}),
|
|
121
|
+
createVNode(Transition, {
|
|
122
|
+
"enter-active-class": "transition duration-100 ease-out",
|
|
123
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
124
|
+
"enter-to-class": "opacity-100 scale-100",
|
|
125
|
+
"leave-active-class": "transition duration-75 ease-in",
|
|
126
|
+
"leave-from-class": "opacity-100 scale-100",
|
|
127
|
+
"leave-to-class": "opacity-0 scale-95"
|
|
128
|
+
}, {
|
|
129
|
+
default: withCtx(() => [showSub.value && !__props.disabled && !isMobile.value ? (openBlock(), createElementBlock("div", {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: normalizeClass(["absolute top-0 w-52 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50", __props.alignLeft ? "right-full mr-1" : "left-full ml-1"])
|
|
132
|
+
}, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("", true)]),
|
|
133
|
+
_: 3
|
|
134
|
+
})
|
|
135
|
+
], 32);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { _sfc_main as default };
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=DropdownSubmenu.js.map
|
|
@@ -0,0 +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 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50\"\n :class=\"alignLeft ? 'right-full mr-1' : 'left-full ml-1'\"\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'\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8GA,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;;GA3HC,OAAA,UAAA,GAAA,mBAgDM,OAAA;IA/CJ,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,YAea,YAAA;KAdX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;;KAEf,SAAA,cAMM,CALE,QAAA,SAAO,CAAK,QAAA,YAAQ,CAAK,SAAA,SADjC,UAAA,GAAA,mBAMM,OAAA;;MAJJ,OAAK,eAAA,CAAC,4HACE,QAAA,YAAS,oBAAA,gBAAA,CAAA;KAEjB,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createElementBlock, createElementVNode, normalizeClass, openBlock, ref, renderSlot } from "vue";
|
|
2
|
+
//#region src/components/FileInput.vue
|
|
3
|
+
var _hoisted_1 = [
|
|
4
|
+
"accept",
|
|
5
|
+
"multiple",
|
|
6
|
+
"disabled"
|
|
7
|
+
];
|
|
8
|
+
var _sfc_main = {
|
|
9
|
+
__name: "FileInput",
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Accepted file types (MIME types or extensions), passed to the native `accept` attribute.
|
|
13
|
+
* @type {string}
|
|
14
|
+
* @default undefined
|
|
15
|
+
* @example 'image/*', '.pdf,.doc', 'video/mp4'
|
|
16
|
+
*/
|
|
17
|
+
accept: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: void 0
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Allow selecting multiple files at once.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
multiple: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Disabled state — dims the label and prevents file picker from opening.
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Maximum allowed file size in bytes. Set to 0 for no limit.
|
|
41
|
+
* Emits an 'error' event with `{ type: 'maxSize', file, message }` when exceeded.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @default 0
|
|
44
|
+
*/
|
|
45
|
+
maxSize: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 0
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emits: ["select", "error"],
|
|
51
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
52
|
+
/**
|
|
53
|
+
* UiFileInput — Hidden file input wrapped in a clickable label for custom trigger UI.
|
|
54
|
+
*
|
|
55
|
+
* The default slot provides the visible trigger content (e.g. a button or icon).
|
|
56
|
+
* Clicking anywhere in the label opens the native file picker. Supports file type
|
|
57
|
+
* filtering via `accept`, multi-file selection, and max file size validation.
|
|
58
|
+
* Exposes an `open()` method for programmatic triggering.
|
|
59
|
+
*
|
|
60
|
+
* @example Single image upload
|
|
61
|
+
* <UiFileInput accept="image/*" @select="onFile">
|
|
62
|
+
* <UiButton variant="outline">Upload Image</UiButton>
|
|
63
|
+
* </UiFileInput>
|
|
64
|
+
*
|
|
65
|
+
* @example Multiple files with size limit (5 MB)
|
|
66
|
+
* <UiFileInput multiple :max-size="5 * 1024 * 1024" @select="onFiles" @error="onError">
|
|
67
|
+
* <span>Choose files</span>
|
|
68
|
+
* </UiFileInput>
|
|
69
|
+
*
|
|
70
|
+
* @example Programmatic open via ref
|
|
71
|
+
* <UiFileInput ref="fileInput" @select="onFile"><span>Pick</span></UiFileInput>
|
|
72
|
+
* <!-- In script: fileInput.value.open() -->
|
|
73
|
+
*
|
|
74
|
+
* @emits {File | File[]} select — Emitted with the selected file(s) after validation passes
|
|
75
|
+
* @emits {{ type: string, file: File, message: string }} error — Emitted when a file exceeds the maxSize limit
|
|
76
|
+
*
|
|
77
|
+
* @slot default — Trigger content (e.g. a button or icon) that opens the file picker
|
|
78
|
+
*/
|
|
79
|
+
const props = __props;
|
|
80
|
+
const emit = __emit;
|
|
81
|
+
const inputRef = ref(null);
|
|
82
|
+
function onChange(e) {
|
|
83
|
+
const files = Array.from(e.target.files || []);
|
|
84
|
+
if (!files.length) return;
|
|
85
|
+
if (props.maxSize > 0) {
|
|
86
|
+
const oversized = files.find((f) => f.size > props.maxSize);
|
|
87
|
+
if (oversized) {
|
|
88
|
+
const maxMB = (props.maxSize / 1024 / 1024).toFixed(1);
|
|
89
|
+
emit("error", {
|
|
90
|
+
type: "maxSize",
|
|
91
|
+
file: oversized,
|
|
92
|
+
message: `File exceeds ${maxMB} MB limit`
|
|
93
|
+
});
|
|
94
|
+
e.target.value = "";
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
emit("select", props.multiple ? files : files[0]);
|
|
99
|
+
e.target.value = "";
|
|
100
|
+
}
|
|
101
|
+
__expose({
|
|
102
|
+
open: () => inputRef.value?.click(),
|
|
103
|
+
el: inputRef
|
|
104
|
+
});
|
|
105
|
+
return (_ctx, _cache) => {
|
|
106
|
+
return openBlock(), createElementBlock("label", { class: normalizeClass(["inline-flex items-center gap-2 cursor-pointer transition-colors", __props.disabled ? "opacity-50 pointer-events-none" : ""]) }, [renderSlot(_ctx.$slots, "default"), createElementVNode("input", {
|
|
107
|
+
ref_key: "inputRef",
|
|
108
|
+
ref: inputRef,
|
|
109
|
+
type: "file",
|
|
110
|
+
class: "hidden",
|
|
111
|
+
accept: __props.accept,
|
|
112
|
+
multiple: __props.multiple,
|
|
113
|
+
disabled: __props.disabled,
|
|
114
|
+
onChange
|
|
115
|
+
}, null, 40, _hoisted_1)], 2);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { _sfc_main as default };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=FileInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileInput.js","names":[],"sources":["../../src/components/FileInput.vue"],"sourcesContent":["<template>\n <!-- Clickable label wrapping a hidden file input — slot content acts as the visible trigger -->\n <label\n class=\"inline-flex items-center gap-2 cursor-pointer transition-colors\"\n :class=\"disabled ? 'opacity-50 pointer-events-none' : ''\"\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 />\n </label>\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\ndefineExpose({\n open: () => inputRef.value?.click(),\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDA,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,SAAa;GACX,YAAY,SAAS,OAAO,MAAM;GAClC,IAAI;EACN,CAAC;;GAvGC,OAAA,UAAA,GAAA,mBAcQ,SAAA,EAbN,OAAK,eAAA,CAAC,mEACE,QAAA,WAAQ,mCAAA,EAAA,CAAA,EAAA,GAAA,CAEhB,WAAQ,KAAA,QAAA,SAAA,GACR,mBAQE,SAAA;IAPI,SAAA;IAAJ,KAAI;IACJ,MAAK;IACL,OAAM;IACL,QAAQ,QAAA;IACR,UAAU,QAAA;IACV,UAAU,QAAA;IACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, normalizeClass, openBlock, renderSlot, toDisplayString } from "vue";
|
|
2
|
+
//#region src/components/FormField.vue
|
|
3
|
+
var _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "font-normal text-gray-400 dark:text-gray-600"
|
|
6
|
+
};
|
|
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
|
+
var _sfc_main = {
|
|
16
|
+
__name: "FormField",
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Label text displayed above the input.
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @default ''
|
|
22
|
+
*/
|
|
23
|
+
label: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Show "(optional)" suffix after the label.
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
optional: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Hint text displayed below the input in gray.
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @default ''
|
|
40
|
+
*/
|
|
41
|
+
hint: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Error message displayed below the input in red.
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @default ''
|
|
49
|
+
*/
|
|
50
|
+
error: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ""
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Inline label style — no bottom margin, suitable for toggle rows.
|
|
56
|
+
* @type {boolean}
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
inline: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup(__props) {
|
|
65
|
+
/**
|
|
66
|
+
* UiFormField — Label + input wrapper with optional hint and error text.
|
|
67
|
+
*
|
|
68
|
+
* Wraps any form control (UiInput, UiSelect, etc.) with a consistent label,
|
|
69
|
+
* optional "(optional)" suffix, hint text below the input, and error message.
|
|
70
|
+
* Reduces the repeated label + div + hint pattern across all form-heavy modals.
|
|
71
|
+
*
|
|
72
|
+
* @example Basic field
|
|
73
|
+
* <UiFormField label="Email">
|
|
74
|
+
* <UiInput v-model="email" type="email" />
|
|
75
|
+
* </UiFormField>
|
|
76
|
+
*
|
|
77
|
+
* @example Field with hint and optional marker
|
|
78
|
+
* <UiFormField label="Password hint" optional hint="A clue to help remember">
|
|
79
|
+
* <UiInput v-model="hint" />
|
|
80
|
+
* </UiFormField>
|
|
81
|
+
*
|
|
82
|
+
* @example Field with error
|
|
83
|
+
* <UiFormField label="Password" :error="pwError">
|
|
84
|
+
* <UiInput v-model="pw" type="password" />
|
|
85
|
+
* </UiFormField>
|
|
86
|
+
*
|
|
87
|
+
* @example Inline label style (no bottom margin)
|
|
88
|
+
* <UiFormField label="Font Ligatures" inline>
|
|
89
|
+
* <UiToggle v-model="ligatures" />
|
|
90
|
+
* </UiFormField>
|
|
91
|
+
*
|
|
92
|
+
* @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)
|
|
93
|
+
*/
|
|
94
|
+
const props = __props;
|
|
95
|
+
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
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return openBlock(), createElementBlock("div", null, [
|
|
98
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: normalizeClass(labelClasses.value)
|
|
101
|
+
}, [createTextVNode(toDisplayString(__props.label) + " ", 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_1, "(optional)")) : createCommentVNode("", true)], 2)) : createCommentVNode("", true),
|
|
102
|
+
renderSlot(_ctx.$slots, "default"),
|
|
103
|
+
__props.hint ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(__props.hint), 1)) : createCommentVNode("", true),
|
|
104
|
+
__props.error ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
|
|
105
|
+
]);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { _sfc_main as default };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +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\">{{ error }}</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 * @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)\n */\nimport { computed } from 'vue'\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CA,MAAM,QAAQ;EAqCd,MAAM,eAAe,eACnB,MAAM,SACF,+DACA,iEACN;;GAnFE,OAAA,UAAA,GAAA,mBAQM,OAAA,MAAA;IAPS,QAAA,SAAb,UAAA,GAAA,mBAGQ,SAAA;;KAHa,OAAK,eAAE,aAAA,KAAY;IACnC,GAAA,CAAA,gBAAA,gBAAA,QAAA,KAAK,IAAG,KACX,CAAA,GAAY,QAAA,YAAZ,UAAA,GAAA,mBAA4F,QAA5F,YAA2E,YAAU,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAEvF,WAAQ,KAAA,QAAA,SAAA;IACC,QAAA,QAAT,UAAA,GAAA,mBAAmF,KAAnF,YAAmF,gBAAX,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IACnE,QAAA,SAAT,UAAA,GAAA,mBAAmF,KAAnF,YAAmF,gBAAZ,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
|