numori-ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/README.md +23 -20
- package/dist/components/Banner.js +29 -32
- package/dist/components/Banner.js.map +1 -1
- package/dist/components/Button.js +10 -19
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +15 -9
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.js +2 -7
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Dropdown.js +10 -3
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/DropdownSubmenu.js +5 -3
- package/dist/components/DropdownSubmenu.js.map +1 -1
- package/dist/components/FileInput.js +12 -4
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/IconTile.js +5 -9
- package/dist/components/IconTile.js.map +1 -1
- package/dist/components/Input.js +6 -6
- package/dist/components/Input.js.map +1 -1
- package/dist/components/ListMenuItem.js +38 -31
- package/dist/components/ListMenuItem.js.map +1 -1
- package/dist/components/Numpad.js +4 -4
- package/dist/components/Numpad.js.map +1 -1
- package/dist/components/Popup.js +9 -3
- package/dist/components/Popup.js.map +1 -1
- package/dist/components/Radio.js +2 -7
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Segmented.js +100 -26
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +6 -4
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Table.js +174 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/index.js +65 -67
- package/dist/components/index.js.map +1 -1
- package/dist/composables/useMergedClasses.js +52 -0
- package/dist/composables/useMergedClasses.js.map +1 -0
- package/dist/icons/mdi.js +1 -0
- package/dist/icons/mdi.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +34 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/controlSizes.js +21 -0
- package/dist/internal/controlSizes.js.map +1 -0
- package/dist/internal/menu.js +20 -0
- package/dist/internal/menu.js.map +1 -0
- package/dist/manifest.js +1 -2
- package/dist/manifest.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Banner.vue +20 -9
- package/src/components/Button.vue +12 -19
- package/src/components/Card.vue +11 -12
- package/src/components/Checkbox.vue +2 -10
- package/src/components/Dropdown.vue +14 -2
- package/src/components/DropdownSubmenu.vue +4 -2
- package/src/components/FileInput.vue +19 -4
- package/src/components/IconTile.vue +4 -9
- package/src/components/Input.vue +6 -6
- package/src/components/ListMenuItem.vue +21 -5
- package/src/components/Numpad.vue +7 -4
- package/src/components/Popup.vue +6 -2
- package/src/components/Radio.vue +2 -10
- package/src/components/Segmented.vue +108 -38
- package/src/components/Select.vue +11 -2
- package/src/components/Table.vue +193 -0
- package/src/components/index.js +3 -6
- package/src/composables/useMergedClasses.js +49 -0
- package/src/icons/mdi.js +1 -0
- package/src/internal/controlSizes.js +17 -0
- package/src/internal/menu.js +16 -0
- package/src/manifest.js +1 -2
- package/dist/components/ButtonsGroup.js +0 -153
- package/dist/components/ButtonsGroup.js.map +0 -1
- package/dist/components/ComparisonTable.js +0 -152
- package/dist/components/ComparisonTable.js.map +0 -1
- package/src/components/ButtonsGroup.vue +0 -140
- package/src/components/ComparisonTable.vue +0 -141
|
@@ -73,7 +73,7 @@ var _sfc_main = {
|
|
|
73
73
|
return openBlock(), createElementBlock("div", {
|
|
74
74
|
ref_key: "numpadRef",
|
|
75
75
|
ref: numpadRef,
|
|
76
|
-
class: "grid grid-cols-3 gap-3 max-w-[264px] mx-auto outline-none"
|
|
76
|
+
class: "grid grid-cols-3 gap-3 min-w-[264px] max-w-[264px] mx-auto outline-none"
|
|
77
77
|
}, [
|
|
78
78
|
(openBlock(), createElementBlock(Fragment, null, renderList([
|
|
79
79
|
1,
|
|
@@ -90,7 +90,7 @@ var _sfc_main = {
|
|
|
90
90
|
key: n,
|
|
91
91
|
type: "button",
|
|
92
92
|
tabindex: "-1",
|
|
93
|
-
class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === n ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-
|
|
93
|
+
class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === n ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600"]),
|
|
94
94
|
disabled: __props.disabled,
|
|
95
95
|
onClick: ($event) => onDigit(n)
|
|
96
96
|
}, toDisplayString(n), 11, _hoisted_1);
|
|
@@ -99,14 +99,14 @@ var _sfc_main = {
|
|
|
99
99
|
createElementVNode("button", {
|
|
100
100
|
type: "button",
|
|
101
101
|
tabindex: "-1",
|
|
102
|
-
class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === 0 ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-
|
|
102
|
+
class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === 0 ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600"]),
|
|
103
103
|
disabled: __props.disabled,
|
|
104
104
|
onClick: _cache[0] || (_cache[0] = ($event) => onDigit(0))
|
|
105
105
|
}, " 0 ", 10, _hoisted_2),
|
|
106
106
|
createElementVNode("button", {
|
|
107
107
|
type: "button",
|
|
108
108
|
tabindex: "-1",
|
|
109
|
-
class: "h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-
|
|
109
|
+
class: "h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 active:scale-95 disabled:opacity-30 disabled:pointer-events-none",
|
|
110
110
|
disabled: !__props.canDelete,
|
|
111
111
|
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("delete"))
|
|
112
112
|
}, [createVNode(_sfc_main$1, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Numpad.js","names":["$emit"],"sources":["../../src/components/Numpad.vue"],"sourcesContent":["<template>\n <div
|
|
1
|
+
{"version":3,"file":"Numpad.js","names":["$emit"],"sources":["../../src/components/Numpad.vue"],"sourcesContent":["<template>\n <div\n ref=\"numpadRef\"\n class=\"grid grid-cols-3 gap-3 min-w-[264px] max-w-[264px] mx-auto outline-none\"\n >\n <button\n v-for=\"n in [1, 2, 3, 4, 5, 6, 7, 8, 9]\"\n :key=\"n\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === n\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(n)\"\n >\n {{ n }}\n </button>\n\n <!-- Bottom-left slot (e.g. biometrics button) -->\n <slot name=\"bottom-left\">\n <div />\n </slot>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === 0\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(0)\"\n >\n 0\n </button>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 active:scale-95 disabled:opacity-30 disabled:pointer-events-none\"\n :disabled=\"!canDelete\"\n @click=\"$emit('delete')\"\n >\n <UiIcon name=\"mdi:backspace-outline\" class=\"w-6 h-6\" />\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiNumpad — A numeric keypad primitive for PIN entry and similar use cases.\n *\n * Emits digit presses and delete actions. Supports physical keyboard input\n * with visual key highlighting. Exposes a bottom-left slot for custom actions\n * (e.g. biometrics button).\n *\n * @example Basic usage\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\" />\n *\n * @example With biometrics slot\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\">\n * <template #bottom-left>\n * <button @click=\"useBiometrics\">🔒</button>\n * </template>\n * </UiNumpad>\n */\nimport { ref } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { useEventListener } from '../composables/useEventListener.js'\n\nconst props = defineProps({\n /** Whether the numpad is disabled */\n disabled: { type: Boolean, default: false },\n /** Whether the delete button is enabled */\n canDelete: { type: Boolean, default: false },\n /** Whether the numpad listens for keyboard input globally */\n captureKeyboard: { type: Boolean, default: false },\n})\n\nconst emit = defineEmits(['digit', 'delete'])\n\nconst numpadRef = ref(null)\nconst pressedKey = ref(null)\n\nconst onDigit = (digit) => {\n if (props.disabled) return\n emit('digit', digit)\n}\n\nconst handleKeydown = (e) => {\n if (props.disabled) return\n\n if (/^[0-9]$/.test(e.key)) {\n e.preventDefault()\n const digit = Number(e.key)\n pressedKey.value = digit\n setTimeout(() => {\n pressedKey.value = null\n }, 150)\n onDigit(digit)\n return\n }\n\n if (e.key === 'Backspace') {\n e.preventDefault()\n emit('delete')\n }\n}\n\n// Global keyboard capture, bound only while `captureKeyboard` is set.\n// The target is a getter so it re-evaluates when the prop changes, and is\n// nullish during SSR — useEventListener skips nullish targets and tears the\n// listener down with the component, so no manual cleanup is needed.\nuseEventListener(() => (props.captureKeyboard ? globalThis.window : null), 'keydown', handleKeydown)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EA,MAAM,QAAQ;EASd,MAAM,OAAO;EAEb,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,aAAa,IAAI,IAAI;EAE3B,MAAM,WAAW,UAAU;GACzB,IAAI,MAAM,UAAU;GACpB,KAAK,SAAS,KAAK;EACrB;EAEA,MAAM,iBAAiB,MAAM;GAC3B,IAAI,MAAM,UAAU;GAEpB,IAAI,UAAU,KAAK,EAAE,GAAG,GAAG;IACzB,EAAE,eAAe;IACjB,MAAM,QAAQ,OAAO,EAAE,GAAG;IAC1B,WAAW,QAAQ;IACnB,iBAAiB;KACf,WAAW,QAAQ;IACrB,GAAG,GAAG;IACN,QAAQ,KAAK;IACb;GACF;GAEA,IAAI,EAAE,QAAQ,aAAa;IACzB,EAAE,eAAe;IACjB,KAAK,QAAQ;GACf;EACF;EAMA,uBAAwB,MAAM,kBAAkB,WAAW,SAAS,MAAO,WAAW,aAAa;;GAtHjG,OAAA,UAAA,GAAA,mBAkDM,OAAA;IAjDA,SAAA;IAAJ,KAAI;IACJ,OAAM;;KAEN,UAAA,GAAA,mBAeS,UAAA,MAAA,WAdK;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA,IAAL,MAAC;KADV,OAAA,mBAeS,UAAA;MAbN,KAAK;MACN,MAAK;MACL,UAAS;MACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAe,IAAA,6FAAA,oJAAA,CAAA;MAK/B,UAAU,QAAA;MACV,UAAK,WAAE,QAAQ,CAAC;KAEd,GAAA,gBAAA,CAAC,GAAA,IAAA,UAAA;;IAIN,WAEO,KAAA,QAAA,eAAA,CAAA,SAAA,CADL,OAAA,OAAA,OAAA,KAAA,mBAAO,OAAA,MAAA,MAAA,EAAA,EAAA,CAAA;IAGT,mBAaS,UAAA;KAZP,MAAK;KACL,UAAS;KACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAU,IAAA,6FAAA,oJAAA,CAAA;KAK1B,UAAU,QAAA;KACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAO,CAAA;IAChB,GAAA,OAED,IAAA,UAAA;IAEA,mBAQS,UAAA;KAPP,MAAK;KACL,UAAS;KACT,OAAM;KACL,UAAQ,CAAG,QAAA;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,QAAA;IAEb,GAAA,CAAA,YAAuD,aAAA;KAA/C,MAAK;KAAwB,OAAM"}
|
package/dist/components/Popup.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MENU_PANEL_CLASS } from "../internal/menu.js";
|
|
2
|
+
import { Transition, computed, createCommentVNode, createElementBlock, createVNode, nextTick, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, unref, watch, withCtx } from "vue";
|
|
2
3
|
//#region src/components/Popup.vue
|
|
3
4
|
var _sfc_main = {
|
|
4
5
|
__name: "Popup",
|
|
@@ -99,7 +100,8 @@ var _sfc_main = {
|
|
|
99
100
|
});
|
|
100
101
|
const positionStyle = computed(() => ({
|
|
101
102
|
left: clampedPos.value.left + "px",
|
|
102
|
-
top: clampedPos.value.top + "px"
|
|
103
|
+
top: clampedPos.value.top + "px",
|
|
104
|
+
transformOrigin: "top left"
|
|
103
105
|
}));
|
|
104
106
|
const updatePosition = () => {
|
|
105
107
|
const left = props.x;
|
|
@@ -156,7 +158,11 @@ var _sfc_main = {
|
|
|
156
158
|
key: 0,
|
|
157
159
|
ref_key: "panelRef",
|
|
158
160
|
ref: panelRef,
|
|
159
|
-
class: normalizeClass(["absolute
|
|
161
|
+
class: normalizeClass(["absolute py-1", [
|
|
162
|
+
unref(MENU_PANEL_CLASS),
|
|
163
|
+
__props.width,
|
|
164
|
+
__props.panelZ
|
|
165
|
+
]]),
|
|
160
166
|
style: normalizeStyle(positionStyle.value)
|
|
161
167
|
}, [renderSlot(_ctx.$slots, "default")], 6)) : createCommentVNode("", true)]),
|
|
162
168
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","names":["$emit"],"sources":["../../src/components/Popup.vue"],"sourcesContent":["<template>\n <div>\n <!-- Invisible full-screen backdrop to capture outside clicks -->\n <div v-if=\"show\" class=\"fixed inset-0\" :class=\"backdropZ\" @click=\"$emit('close')\" />\n <!-- Animated popup panel positioned at (x, y + offsetY) -->\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=\"show\"\n ref=\"panelRef\"\n class=\"absolute
|
|
1
|
+
{"version":3,"file":"Popup.js","names":["$emit"],"sources":["../../src/components/Popup.vue"],"sourcesContent":["<template>\n <div>\n <!-- Invisible full-screen backdrop to capture outside clicks -->\n <div v-if=\"show\" class=\"fixed inset-0\" :class=\"backdropZ\" @click=\"$emit('close')\" />\n <!-- Animated popup panel positioned at (x, y + offsetY) -->\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=\"show\"\n ref=\"panelRef\"\n class=\"absolute py-1\"\n :class=\"[MENU_PANEL_CLASS, width, panelZ]\"\n :style=\"positionStyle\"\n >\n <slot />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiPopup — Absolutely positioned popup panel with viewport-aware clamping.\n *\n * Renders a floating panel at the given (x, y) coordinates relative to its offset parent.\n * Automatically clamps position to keep the panel within the visible viewport with an 8px margin.\n * Includes an invisible full-screen backdrop that emits 'close' on click.\n *\n * @example Context menu popup\n * <UiPopup :show=\"showMenu\" :x=\"menuX\" :y=\"menuY\" @close=\"showMenu = false\">\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiPopup>\n *\n * @example Popup with offset and custom width\n * <UiPopup :show=\"open\" :x=\"posX\" :y=\"posY\" :offset-y=\"8\" width=\"w-64\" @close=\"open = false\">\n * <div class=\"p-3\">Custom content</div>\n * </UiPopup>\n *\n * @emits {void} close — Emitted when the backdrop is clicked to dismiss the popup\n *\n * @slot default — Popup content\n */\nimport { ref, computed, watch, nextTick } from 'vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Controls popup visibility.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Horizontal position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n x: { type: Number, default: 0 },\n\n /**\n * Vertical position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n y: { type: Number, default: 0 },\n\n /**\n * Additional vertical offset added to the y position (e.g. to clear a trigger element).\n * @type {number}\n * @default 0\n */\n offsetY: { type: Number, default: 0 },\n\n /**\n * Width class for the popup panel.\n * @type {string}\n * @default 'w-56'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Z-index class for the popup panel.\n * @type {string}\n * @default 'z-50'\n */\n panelZ: { type: String, default: 'z-50' },\n\n /**\n * Z-index class for the invisible backdrop behind the panel.\n * @type {string}\n * @default 'z-40'\n */\n backdropZ: { type: String, default: 'z-40' },\n})\n\ndefineEmits(['close'])\n\nconst panelRef = ref(null)\nconst clampedPos = ref({ left: 0, top: 0 })\n\nconst positionStyle = computed(() => ({\n left: clampedPos.value.left + 'px',\n top: clampedPos.value.top + 'px',\n // Inline (not a Tailwind class) so the popup reliably scales in from its\n // top-left corner rather than drifting in from its centre.\n transformOrigin: 'top left',\n}))\n\n// Clamp the panel position so it stays within the viewport (8px margin)\nconst updatePosition = () => {\n const left = props.x\n const top = props.y + props.offsetY\n\n nextTick(() => {\n const el = panelRef.value\n if (!el) return\n\n const parent = el.offsetParent || document.body\n const parentRect = parent.getBoundingClientRect()\n const panelW = el.offsetWidth\n const panelH = el.offsetHeight\n const viewW = window.innerWidth\n const viewH = window.innerHeight\n\n // Convert to viewport coords, clamp, convert back\n let absLeft = parentRect.left + left\n let absTop = parentRect.top + top\n\n const margin = 8\n if (absLeft + panelW > viewW - margin) absLeft = viewW - panelW - margin\n if (absLeft < margin) absLeft = margin\n if (absTop + panelH > viewH - margin) absTop = viewH - panelH - margin\n if (absTop < margin) absTop = margin\n\n clampedPos.value = {\n left: absLeft - parentRect.left,\n top: absTop - parentRect.top,\n }\n })\n}\n\nwatch(\n () => [props.show, props.x, props.y, props.offsetY],\n () => {\n if (props.show) {\n // Set initial position immediately so the panel renders near the right spot\n clampedPos.value = { left: props.x, top: props.y + props.offsetY }\n updatePosition()\n }\n },\n { immediate: true },\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,QAAX,UAAA,GAAA,mBAAoF,OAAA;;IAAnE,OAAK,eAAA,CAAC,iBAAwB,QAAA,SAAS,CAAA;IAAG,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,OAAA;GAEvE,GAAA,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,YAiBa,YAAA;IAhBX,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;IACf,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;;IAEf,SAAA,cAQM,CAPE,QAAA,QADR,UAAA,GAAA,mBAQM,OAAA;;KANA,SAAA;KAAJ,KAAI;KACJ,OAAK,eAAA,CAAC,iBAAe;MACZ,MAAA,gBAAA;MAAkB,QAAA;MAAO,QAAA;KAAM,CAAA,CAAA;KACvC,OAAK,eAAE,cAAA,KAAa;IAErB,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
|
package/dist/components/Radio.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkableSizeClass } from "../internal/controlSizes.js";
|
|
1
2
|
import { computed, createElementBlock, normalizeClass, openBlock } from "vue";
|
|
2
3
|
//#region src/components/Radio.vue
|
|
3
4
|
var _hoisted_1 = [
|
|
@@ -52,13 +53,7 @@ var _sfc_main = {
|
|
|
52
53
|
*/
|
|
53
54
|
const props = __props;
|
|
54
55
|
const emit = __emit;
|
|
55
|
-
const sizeClass = computed(() =>
|
|
56
|
-
switch (props.size) {
|
|
57
|
-
case "sm": return "w-3.5 h-3.5";
|
|
58
|
-
case "lg": return "w-5 h-5";
|
|
59
|
-
default: return "w-4 h-4";
|
|
60
|
-
}
|
|
61
|
-
});
|
|
56
|
+
const sizeClass = computed(() => checkableSizeClass(props.size));
|
|
62
57
|
function onChange() {
|
|
63
58
|
emit("update:modelValue", props.value);
|
|
64
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":[],"sources":["../../src/components/Radio.vue"],"sourcesContent":["<template>\n <input\n type=\"radio\"\n :checked=\"modelValue === value\"\n :disabled=\"disabled\"\n :name=\"name\"\n :value=\"value\"\n class=\"rounded-full border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiRadio — Simple styled radio input with configurable size.\n *\n * Wraps a native `<input type=\"radio\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Use with v-model for group selection.\n *\n * @example Radio group\n * <UiRadio v-model=\"selected\" value=\"a\" name=\"choice\" />\n * <UiRadio v-model=\"selected\" value=\"b\" name=\"choice\" />\n */\nimport { computed } from 'vue'\nconst props = defineProps({\n modelValue: { type: [String, Number, Boolean], default: null },\n value: { type: [String, Number, Boolean], required: true },\n name: { type: String, default: undefined },\n disabled: { type: Boolean, default: false },\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst sizeClass = computed(() =>
|
|
1
|
+
{"version":3,"file":"Radio.js","names":[],"sources":["../../src/components/Radio.vue"],"sourcesContent":["<template>\n <input\n type=\"radio\"\n :checked=\"modelValue === value\"\n :disabled=\"disabled\"\n :name=\"name\"\n :value=\"value\"\n class=\"rounded-full border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiRadio — Simple styled radio input with configurable size.\n *\n * Wraps a native `<input type=\"radio\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Use with v-model for group selection.\n *\n * @example Radio group\n * <UiRadio v-model=\"selected\" value=\"a\" name=\"choice\" />\n * <UiRadio v-model=\"selected\" value=\"b\" name=\"choice\" />\n */\nimport { computed } from 'vue'\nimport { checkableSizeClass } from '../internal/controlSizes.js'\nconst props = defineProps({\n modelValue: { type: [String, Number, Boolean], default: null },\n value: { type: [String, Number, Boolean], required: true },\n name: { type: String, default: undefined },\n disabled: { type: Boolean, default: false },\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst sizeClass = computed(() => checkableSizeClass(props.size))\n\nfunction onChange() {\n emit('update:modelValue', props.value)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,YAAY,eAAe,mBAAmB,MAAM,IAAI,CAAC;EAE/D,SAAS,WAAW;GAClB,KAAK,qBAAqB,MAAM,KAAK;EACvC;;GAvCE,OAAA,UAAA,GAAA,mBASE,SAAA;IARA,MAAK;IACJ,SAAS,QAAA,eAAe,QAAA;IACxB,UAAU,QAAA;IACV,MAAM,QAAA;IACN,OAAO,QAAA;IACR,OAAK,eAAA,CAAC,6FACE,UAAA,KAAS,CAAA;IACR"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode,
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
|
|
3
3
|
//#region src/components/Segmented.vue
|
|
4
4
|
var _hoisted_1 = ["aria-label"];
|
|
5
5
|
var _hoisted_2 = [
|
|
6
6
|
"aria-pressed",
|
|
7
7
|
"disabled",
|
|
8
|
+
"title",
|
|
8
9
|
"onClick"
|
|
9
10
|
];
|
|
10
|
-
var
|
|
11
|
+
var _hoisted_3 = { key: 1 };
|
|
11
12
|
var idleTextClass = "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100";
|
|
12
13
|
var _sfc_main = {
|
|
13
14
|
__name: "Segmented",
|
|
@@ -22,14 +23,30 @@ var _sfc_main = {
|
|
|
22
23
|
default: void 0
|
|
23
24
|
},
|
|
24
25
|
/**
|
|
25
|
-
* The options. Each is `{ value, label
|
|
26
|
-
*
|
|
26
|
+
* The options. Each is `{ value, label?, icon?, disabled?, title? }`. Provide
|
|
27
|
+
* `label` for text segments, `icon` for icon-only segments, or both. `title`
|
|
28
|
+
* sets the native tooltip (useful for icon-only segments).
|
|
29
|
+
* @type {Array<{ value: string|number, label?: string, icon?: string, disabled?: boolean, title?: string }>}
|
|
27
30
|
*/
|
|
28
31
|
options: {
|
|
29
32
|
type: Array,
|
|
30
33
|
required: true
|
|
31
34
|
},
|
|
32
35
|
/**
|
|
36
|
+
* Active-segment appearance, mirroring the equivalent `UiButton` variants so
|
|
37
|
+
* the two feel like one family. The sliding indicator animates in every case.
|
|
38
|
+
* - 'solid' — a filled accent indicator; the active label goes white (default).
|
|
39
|
+
* - 'outline' — a bordered accent indicator; the active label takes the accent.
|
|
40
|
+
* - 'ghost' — a soft tinted indicator; the active label takes the accent.
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @default 'solid'
|
|
43
|
+
* @values 'solid' | 'outline' | 'ghost'
|
|
44
|
+
*/
|
|
45
|
+
variant: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "solid"
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
33
50
|
* Size preset controlling padding and font size.
|
|
34
51
|
* @type {string}
|
|
35
52
|
* @default 'md'
|
|
@@ -40,16 +57,27 @@ var _sfc_main = {
|
|
|
40
57
|
default: "md"
|
|
41
58
|
},
|
|
42
59
|
/**
|
|
43
|
-
* Corner shape of the track and
|
|
60
|
+
* Corner shape of the track, indicator, and segments. Matches `UiButton`'s
|
|
61
|
+
* `shape` naming.
|
|
44
62
|
* @type {string}
|
|
45
63
|
* @default 'pill'
|
|
46
|
-
* @values 'pill' | '
|
|
64
|
+
* @values 'pill' | 'round' | 'square'
|
|
47
65
|
*/
|
|
48
66
|
shape: {
|
|
49
67
|
type: String,
|
|
50
68
|
default: "pill"
|
|
51
69
|
},
|
|
52
70
|
/**
|
|
71
|
+
* Full-width mode — the control fills its container and segments share the
|
|
72
|
+
* width equally.
|
|
73
|
+
* @type {boolean}
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
block: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
53
81
|
* Accessible name for the group. Omit if you label it with an external
|
|
54
82
|
* heading via `aria-labelledby` (which falls through to the root).
|
|
55
83
|
* @type {string}
|
|
@@ -64,17 +92,32 @@ var _sfc_main = {
|
|
|
64
92
|
setup(__props, { emit: __emit }) {
|
|
65
93
|
/**
|
|
66
94
|
* UiSegmented — a segmented control: pick one of a few named options from a row
|
|
67
|
-
* of
|
|
95
|
+
* of segments, with an indicator that slides to the active choice.
|
|
68
96
|
*
|
|
69
97
|
* This is a set of toggle buttons (`role="group"` + `aria-pressed`), not a
|
|
70
98
|
* switch, because the choice is between named options rather than on/off — "the
|
|
71
99
|
* second option is off" is not something a screen reader should say. Segments
|
|
72
|
-
* are equal width so the
|
|
100
|
+
* are equal width so the indicator can slide by whole columns, and the slide
|
|
101
|
+
* animates in both variants.
|
|
102
|
+
*
|
|
103
|
+
* The `variant` values match `UiButton`'s — `solid`, `outline`, `ghost` — so a
|
|
104
|
+
* segmented control sits alongside buttons as part of one visual family. The
|
|
105
|
+
* indicator slides (and animates) to the active choice in every variant.
|
|
106
|
+
*
|
|
107
|
+
* - `variant="solid"` (default) — a filled accent indicator; the active label
|
|
108
|
+
* goes white. Like a solid button.
|
|
109
|
+
* - `variant="outline"` — a bordered accent indicator; the active label takes
|
|
110
|
+
* the accent colour. Like an outline button.
|
|
111
|
+
* - `variant="ghost"` — a soft tinted indicator; the active label takes the
|
|
112
|
+
* accent colour. Like a ghost button.
|
|
113
|
+
*
|
|
114
|
+
* `shape` controls the corners — `pill`, `round`, or `square` (matching
|
|
115
|
+
* `UiButton`) — and the indicator matches the track's radius.
|
|
73
116
|
*
|
|
74
117
|
* For an on/off control use `UiToggle`; for many options or a searchable list
|
|
75
118
|
* use `UiSelect`.
|
|
76
119
|
*
|
|
77
|
-
* @example Billing period
|
|
120
|
+
* @example Billing period (solid, the default)
|
|
78
121
|
* <UiSegmented
|
|
79
122
|
* v-model="billing"
|
|
80
123
|
* :options="[
|
|
@@ -84,9 +127,20 @@ var _sfc_main = {
|
|
|
84
127
|
* aria-label="Billing period"
|
|
85
128
|
* />
|
|
86
129
|
*
|
|
87
|
-
* @example
|
|
88
|
-
* <
|
|
89
|
-
*
|
|
130
|
+
* @example Icon toolbar (outline, square corners)
|
|
131
|
+
* <UiSegmented
|
|
132
|
+
* v-model="view"
|
|
133
|
+
* variant="outline"
|
|
134
|
+
* shape="square"
|
|
135
|
+
* :options="[
|
|
136
|
+
* { value: 'grid', icon: 'mdi:view-grid', title: 'Grid' },
|
|
137
|
+
* { value: 'list', icon: 'mdi:view-list', title: 'List' },
|
|
138
|
+
* ]"
|
|
139
|
+
* aria-label="View"
|
|
140
|
+
* />
|
|
141
|
+
*
|
|
142
|
+
* @example Full-width ghost tabs
|
|
143
|
+
* <UiSegmented v-model="tab" variant="ghost" block :options="tabs" />
|
|
90
144
|
*
|
|
91
145
|
* @emits {string|number} update:modelValue — the chosen option's `value`
|
|
92
146
|
*/
|
|
@@ -98,16 +152,31 @@ var _sfc_main = {
|
|
|
98
152
|
const i = (props.options ?? []).findIndex((o) => o.value === props.modelValue);
|
|
99
153
|
return i === -1 ? 0 : i;
|
|
100
154
|
});
|
|
101
|
-
function select(option
|
|
155
|
+
function select(option) {
|
|
102
156
|
if (option.disabled) return;
|
|
103
157
|
emit("update:modelValue", option.value);
|
|
104
158
|
}
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
159
|
+
const gridStyle = computed(() => ({ gridTemplateColumns: `repeat(${count.value}, minmax(0, 1fr))` }));
|
|
160
|
+
const radiusClass = computed(() => {
|
|
161
|
+
const map = {
|
|
162
|
+
pill: "rounded-full",
|
|
163
|
+
round: "rounded-lg",
|
|
164
|
+
square: "rounded-none"
|
|
165
|
+
};
|
|
166
|
+
return map[props.shape] ?? map.pill;
|
|
167
|
+
});
|
|
108
168
|
const buttonSizeClass = computed(() => props.size === "sm" ? "px-3 py-1 text-xs" : "px-4 py-1.5 text-sm");
|
|
109
169
|
const iconSizeClass = computed(() => props.size === "sm" ? "size-3.5" : "size-4");
|
|
110
|
-
const
|
|
170
|
+
const indicatorClass = computed(() => {
|
|
171
|
+
const map = {
|
|
172
|
+
solid: "bg-primary-600 shadow-sm",
|
|
173
|
+
outline: "border border-primary-500",
|
|
174
|
+
ghost: "bg-primary-50 dark:bg-primary-900/20"
|
|
175
|
+
};
|
|
176
|
+
return map[props.variant] ?? map.solid;
|
|
177
|
+
});
|
|
178
|
+
const activeTextClass = computed(() => props.variant === "solid" ? "text-white" : "text-primary-600 dark:text-primary-400");
|
|
179
|
+
const indicatorStyle = computed(() => ({
|
|
111
180
|
width: `calc((100% - 0.5rem) / ${count.value})`,
|
|
112
181
|
transform: `translateX(calc(${activeIndex.value} * 100%))`
|
|
113
182
|
}));
|
|
@@ -115,29 +184,34 @@ var _sfc_main = {
|
|
|
115
184
|
return openBlock(), createElementBlock("div", {
|
|
116
185
|
role: "group",
|
|
117
186
|
"aria-label": __props.ariaLabel,
|
|
118
|
-
class: normalizeClass(["relative
|
|
119
|
-
|
|
187
|
+
class: normalizeClass(["relative p-1", [
|
|
188
|
+
__props.block ? "grid w-full" : "inline-grid",
|
|
189
|
+
radiusClass.value,
|
|
190
|
+
"border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900"
|
|
191
|
+
]]),
|
|
192
|
+
style: normalizeStyle(gridStyle.value)
|
|
120
193
|
}, [createElementVNode("span", {
|
|
121
194
|
"aria-hidden": "true",
|
|
122
|
-
class: normalizeClass(["pointer-events-none absolute bottom-1 left-1 top-1
|
|
123
|
-
style: normalizeStyle(
|
|
124
|
-
}, null, 6), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option
|
|
195
|
+
class: normalizeClass(["pointer-events-none absolute bottom-1 left-1 top-1 shadow-sm transition-transform duration-300 ease-out motion-reduce:transition-none", [radiusClass.value, indicatorClass.value]]),
|
|
196
|
+
style: normalizeStyle(indicatorStyle.value)
|
|
197
|
+
}, null, 6), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
125
198
|
return openBlock(), createElementBlock("button", {
|
|
126
199
|
key: option.value,
|
|
127
200
|
type: "button",
|
|
128
201
|
"aria-pressed": isActive(option) ? "true" : "false",
|
|
129
202
|
disabled: option.disabled,
|
|
203
|
+
title: option.title || void 0,
|
|
130
204
|
class: normalizeClass(["relative z-10 inline-flex items-center justify-center gap-1.5 font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50", [
|
|
131
205
|
buttonSizeClass.value,
|
|
132
|
-
|
|
133
|
-
isActive(option) ? activeTextClass : idleTextClass
|
|
206
|
+
radiusClass.value,
|
|
207
|
+
isActive(option) ? activeTextClass.value : idleTextClass
|
|
134
208
|
]]),
|
|
135
|
-
onClick: ($event) => select(option
|
|
209
|
+
onClick: ($event) => select(option)
|
|
136
210
|
}, [option.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
137
211
|
key: 0,
|
|
138
212
|
name: option.icon,
|
|
139
213
|
class: normalizeClass(iconSizeClass.value)
|
|
140
|
-
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
214
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true), option.label ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(option.label), 1)) : createCommentVNode("", true)], 10, _hoisted_2);
|
|
141
215
|
}), 128))], 14, _hoisted_1);
|
|
142
216
|
};
|
|
143
217
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Segmented.js","names":[],"sources":["../../src/components/Segmented.vue"],"sourcesContent":["<template>\n <div\n role=\"group\"\n :aria-label=\"ariaLabel\"\n class=\"relative inline-grid p-1\"\n :class=\"[trackClass, 'border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900']\"\n :style=\"{ gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` }\"\n >\n <!--\n A single pill slides between segments rather than each segment owning its\n own background, so the movement animates. Segments are equal-width, so the\n pill's width is one column and it translates by whole columns. `top/bottom/\n left` inset it inside the track's padding; `%` in translateX resolves\n against the pill's own (one-column) width.\n -->\n <span\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute bottom-1 left-1 top-1 bg-primary-500 shadow-sm transition-transform duration-300 ease-out motion-reduce:transition-none\"\n :class=\"pillClass\"\n :style=\"pillStyle\"\n />\n\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n type=\"button\"\n :aria-pressed=\"isActive(option) ? 'true' : 'false'\"\n :disabled=\"option.disabled\"\n class=\"relative z-10 inline-flex items-center justify-center gap-1.5 font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50\"\n :class=\"[\n buttonSizeClass,\n buttonShapeClass,\n isActive(option) ? activeTextClass : idleTextClass,\n ]\"\n @click=\"select(option, index)\"\n >\n <UiIcon v-if=\"option.icon\" :name=\"option.icon\" :class=\"iconSizeClass\" />\n {{ option.label }}\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSegmented — a segmented control: pick one of a few named options from a row\n * of buttons, with a pill that slides to the active choice.\n *\n * This is a set of toggle buttons (`role=\"group\"` + `aria-pressed`), not a\n * switch, because the choice is between named options rather than on/off — \"the\n * second option is off\" is not something a screen reader should say. Segments\n * are equal width so the pill can slide by whole columns.\n *\n * For an on/off control use `UiToggle`; for many options or a searchable list\n * use `UiSelect`.\n *\n * @example Billing period\n * <UiSegmented\n * v-model=\"billing\"\n * :options=\"[\n * { value: 'monthly', label: 'Monthly' },\n * { value: 'yearly', label: 'Yearly' },\n * ]\"\n * aria-label=\"Billing period\"\n * />\n *\n * @example With icons and a labelled-by heading\n * <h2 id=\"view-h\" class=\"sr-only\">View</h2>\n * <UiSegmented v-model=\"view\" :options=\"views\" aria-labelledby=\"view-h\" />\n *\n * @emits {string|number} update:modelValue — the chosen option's `value`\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Selected value (v-model), matched against each option's `value`.\n * @type {string | number}\n * @default undefined\n */\n modelValue: { type: [String, Number], default: undefined },\n\n /**\n * The options. Each is `{ value, label, icon?, disabled? }`.\n * @type {Array<{ value: string|number, label: string, icon?: string, disabled?: boolean }>}\n */\n options: { type: Array, required: true },\n\n /**\n * Size preset controlling padding and font size.\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Corner shape of the track and pill.\n * @type {string}\n * @default 'pill'\n * @values 'pill' | 'rounded'\n */\n shape: { type: String, default: 'pill' },\n\n /**\n * Accessible name for the group. Omit if you label it with an external\n * heading via `aria-labelledby` (which falls through to the root).\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst count = computed(() => props.options?.length || 1)\n\nconst isActive = (option) => option.value === props.modelValue\n\nconst activeIndex = computed(() => {\n const i = (props.options ?? []).findIndex((o) => o.value === props.modelValue)\n return i === -1 ? 0 : i\n})\n\nfunction select(option, index) {\n if (option.disabled) return\n emit('update:modelValue', option.value)\n // index is accepted for symmetry with the template call site; the value is\n // what identifies the option.\n void index\n}\n\nconst trackClass = computed(() => (props.shape === 'rounded' ? 'rounded-xl' : 'rounded-full'))\nconst buttonShapeClass = computed(() => (props.shape === 'rounded' ? 'rounded-lg' : 'rounded-full'))\nconst pillClass = computed(() => (props.shape === 'rounded' ? 'rounded-lg' : 'rounded-full'))\n\nconst buttonSizeClass = computed(() =>\n props.size === 'sm' ? 'px-3 py-1 text-xs' : 'px-4 py-1.5 text-sm',\n)\nconst iconSizeClass = computed(() => (props.size === 'sm' ? 'size-3.5' : 'size-4'))\n\nconst activeTextClass = 'text-white'\nconst idleTextClass =\n 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100'\n\nconst pillStyle = computed(() => ({\n // Track padding is p-1 (0.25rem) each side, so the usable width is\n // `100% - 0.5rem`; one segment is that divided by the option count.\n width: `calc((100% - 0.5rem) / ${count.value})`,\n transform: `translateX(calc(${activeIndex.value} * 100%))`,\n}))\n</script>\n"],"mappings":";;;;;;;;;AA6IA,IAAM,kBAAkB;AACxB,IAAM,gBACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EArEF,MAAM,QAAQ;EAuCd,MAAM,OAAO;EAEb,MAAM,QAAQ,eAAe,MAAM,SAAS,UAAU,CAAC;EAEvD,MAAM,YAAY,WAAW,OAAO,UAAU,MAAM;EAEpD,MAAM,cAAc,eAAe;GACjC,MAAM,KAAK,MAAM,WAAW,CAAC,EAAA,CAAG,WAAW,MAAM,EAAE,UAAU,MAAM,UAAU;GAC7E,OAAO,MAAM,KAAK,IAAI;EACxB,CAAC;EAED,SAAS,OAAO,QAAQ,OAAO;GAC7B,IAAI,OAAO,UAAU;GACrB,KAAK,qBAAqB,OAAO,KAAK;EAIxC;EAEA,MAAM,aAAa,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EAC7F,MAAM,mBAAmB,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EACnG,MAAM,YAAY,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EAE5F,MAAM,kBAAkB,eACtB,MAAM,SAAS,OAAO,sBAAsB,qBAC9C;EACA,MAAM,gBAAgB,eAAgB,MAAM,SAAS,OAAO,aAAa,QAAS;EAMlF,MAAM,YAAY,gBAAgB;GAGhC,OAAO,0BAA0B,MAAM,MAAM;GAC7C,WAAW,mBAAmB,YAAY,MAAM;EAClD,EAAE;;GArJA,OAAA,UAAA,GAAA,mBAsCM,OAAA;IArCJ,MAAK;IACJ,cAAY,QAAA;IACb,OAAK,eAAA,CAAC,4BAA0B,CACvB,WAAA,OAAU,yEAAA,CAAA,CAAA;IAClB,OAAK,eAAA,EAAA,qBAAA,UAAmC,MAAA,MAAK,mBAAA,CAAA;GAS9C,GAAA,CAAA,mBAKE,QAAA;IAJA,eAAY;IACZ,OAAK,eAAA,CAAC,wJACE,UAAA,KAAS,CAAA;IAChB,OAAK,eAAE,UAAA,KAAS;GAGnB,GAAA,MAAA,CAAA,IAAA,UAAA,IAAA,GAAA,mBAgBS,UAAA,MAAA,WAfmB,QAAA,UAAlB,QAAQ,UAAK;IADvB,OAAA,UAAA,GAAA,mBAgBS,UAAA;KAdN,KAAK,OAAO;KACb,MAAK;KACJ,gBAAc,SAAS,MAAM,IAAA,SAAA;KAC7B,UAAU,OAAO;KAClB,OAAK,eAAA,CAAC,iJAA+I;MACnI,gBAAA;MAAyB,iBAAA;MAA0B,SAAS,MAAM,IAAI,kBAAkB;;KAKzG,UAAK,WAAE,OAAO,QAAQ,KAAK;IAEd,GAAA,CAAA,OAAO,QAArB,UAAA,GAAA,YAAwE,aAAA;;KAA5C,MAAM,OAAO;KAAO,OAAK,eAAE,cAAA,KAAa;IAAI,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,gBAAA,MACxE,gBAAG,OAAO,KAAK,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA"}
|
|
1
|
+
{"version":3,"file":"Segmented.js","names":[],"sources":["../../src/components/Segmented.vue"],"sourcesContent":["<template>\n <div\n role=\"group\"\n :aria-label=\"ariaLabel\"\n class=\"relative p-1\"\n :class=\"[\n block ? 'grid w-full' : 'inline-grid',\n radiusClass,\n 'border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900',\n ]\"\n :style=\"gridStyle\"\n >\n <!--\n A single indicator slides between segments, so changing the selection\n animates in every variant. Segments are equal-width grid columns, so the\n indicator is one column wide and translates by whole columns. The variant\n only changes how the indicator looks (accent fill vs raised surface); the\n sliding mechanism is shared.\n -->\n <span\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute bottom-1 left-1 top-1 shadow-sm transition-transform duration-300 ease-out motion-reduce:transition-none\"\n :class=\"[radiusClass, indicatorClass]\"\n :style=\"indicatorStyle\"\n />\n\n <button\n v-for=\"option in options\"\n :key=\"option.value\"\n type=\"button\"\n :aria-pressed=\"isActive(option) ? 'true' : 'false'\"\n :disabled=\"option.disabled\"\n :title=\"option.title || undefined\"\n class=\"relative z-10 inline-flex items-center justify-center gap-1.5 font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50\"\n :class=\"[buttonSizeClass, radiusClass, isActive(option) ? activeTextClass : idleTextClass]\"\n @click=\"select(option)\"\n >\n <UiIcon v-if=\"option.icon\" :name=\"option.icon\" :class=\"iconSizeClass\" />\n <span v-if=\"option.label\">{{ option.label }}</span>\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSegmented — a segmented control: pick one of a few named options from a row\n * of segments, with an indicator that slides to the active choice.\n *\n * This is a set of toggle buttons (`role=\"group\"` + `aria-pressed`), not a\n * switch, because the choice is between named options rather than on/off — \"the\n * second option is off\" is not something a screen reader should say. Segments\n * are equal width so the indicator can slide by whole columns, and the slide\n * animates in both variants.\n *\n * The `variant` values match `UiButton`'s — `solid`, `outline`, `ghost` — so a\n * segmented control sits alongside buttons as part of one visual family. The\n * indicator slides (and animates) to the active choice in every variant.\n *\n * - `variant=\"solid\"` (default) — a filled accent indicator; the active label\n * goes white. Like a solid button.\n * - `variant=\"outline\"` — a bordered accent indicator; the active label takes\n * the accent colour. Like an outline button.\n * - `variant=\"ghost\"` — a soft tinted indicator; the active label takes the\n * accent colour. Like a ghost button.\n *\n * `shape` controls the corners — `pill`, `round`, or `square` (matching\n * `UiButton`) — and the indicator matches the track's radius.\n *\n * For an on/off control use `UiToggle`; for many options or a searchable list\n * use `UiSelect`.\n *\n * @example Billing period (solid, the default)\n * <UiSegmented\n * v-model=\"billing\"\n * :options=\"[\n * { value: 'monthly', label: 'Monthly' },\n * { value: 'yearly', label: 'Yearly' },\n * ]\"\n * aria-label=\"Billing period\"\n * />\n *\n * @example Icon toolbar (outline, square corners)\n * <UiSegmented\n * v-model=\"view\"\n * variant=\"outline\"\n * shape=\"square\"\n * :options=\"[\n * { value: 'grid', icon: 'mdi:view-grid', title: 'Grid' },\n * { value: 'list', icon: 'mdi:view-list', title: 'List' },\n * ]\"\n * aria-label=\"View\"\n * />\n *\n * @example Full-width ghost tabs\n * <UiSegmented v-model=\"tab\" variant=\"ghost\" block :options=\"tabs\" />\n *\n * @emits {string|number} update:modelValue — the chosen option's `value`\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Selected value (v-model), matched against each option's `value`.\n * @type {string | number}\n * @default undefined\n */\n modelValue: { type: [String, Number], default: undefined },\n\n /**\n * The options. Each is `{ value, label?, icon?, disabled?, title? }`. Provide\n * `label` for text segments, `icon` for icon-only segments, or both. `title`\n * sets the native tooltip (useful for icon-only segments).\n * @type {Array<{ value: string|number, label?: string, icon?: string, disabled?: boolean, title?: string }>}\n */\n options: { type: Array, required: true },\n\n /**\n * Active-segment appearance, mirroring the equivalent `UiButton` variants so\n * the two feel like one family. The sliding indicator animates in every case.\n * - 'solid' — a filled accent indicator; the active label goes white (default).\n * - 'outline' — a bordered accent indicator; the active label takes the accent.\n * - 'ghost' — a soft tinted indicator; the active label takes the accent.\n * @type {string}\n * @default 'solid'\n * @values 'solid' | 'outline' | 'ghost'\n */\n variant: { type: String, default: 'solid' },\n\n /**\n * Size preset controlling padding and font size.\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Corner shape of the track, indicator, and segments. Matches `UiButton`'s\n * `shape` naming.\n * @type {string}\n * @default 'pill'\n * @values 'pill' | 'round' | 'square'\n */\n shape: { type: String, default: 'pill' },\n\n /**\n * Full-width mode — the control fills its container and segments share the\n * width equally.\n * @type {boolean}\n * @default false\n */\n block: { type: Boolean, default: false },\n\n /**\n * Accessible name for the group. Omit if you label it with an external\n * heading via `aria-labelledby` (which falls through to the root).\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst count = computed(() => props.options?.length || 1)\n\nconst isActive = (option) => option.value === props.modelValue\n\nconst activeIndex = computed(() => {\n const i = (props.options ?? []).findIndex((o) => o.value === props.modelValue)\n return i === -1 ? 0 : i\n})\n\nfunction select(option) {\n if (option.disabled) return\n emit('update:modelValue', option.value)\n}\n\nconst gridStyle = computed(() => ({\n gridTemplateColumns: `repeat(${count.value}, minmax(0, 1fr))`,\n}))\n\n// ── Shape ─────────────────────────────────────────────────\n// The track, the sliding indicator, and the segments all share one radius so\n// the indicator's corners match the holder's rather than reading as a tighter\n// (or looser) curve inside it.\nconst radiusClass = computed(() => {\n const map = { pill: 'rounded-full', round: 'rounded-lg', square: 'rounded-none' }\n return map[props.shape] ?? map.pill\n})\n\n// ── Size ──────────────────────────────────────────────────\nconst buttonSizeClass = computed(() =>\n props.size === 'sm' ? 'px-3 py-1 text-xs' : 'px-4 py-1.5 text-sm',\n)\nconst iconSizeClass = computed(() => (props.size === 'sm' ? 'size-3.5' : 'size-4'))\n\n// ── Variant: indicator look + active label colour ─────────\n// These mirror UiButton's solid / outline / ghost variants (primary colour) so\n// a segmented control reads as part of the same family as the buttons near it.\nconst indicatorClass = computed(() => {\n const map = {\n solid: 'bg-primary-600 shadow-sm',\n outline: 'border border-primary-500',\n ghost: 'bg-primary-50 dark:bg-primary-900/20',\n }\n return map[props.variant] ?? map.solid\n})\nconst activeTextClass = computed(() =>\n props.variant === 'solid' ? 'text-white' : 'text-primary-600 dark:text-primary-400',\n)\nconst idleTextClass =\n 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100'\n\nconst indicatorStyle = computed(() => ({\n // Track padding is p-1 (0.25rem) each side, so the usable width is\n // `100% - 0.5rem`; one segment is that divided by the option count.\n width: `calc((100% - 0.5rem) / ${count.value})`,\n transform: `translateX(calc(${activeIndex.value} * 100%))`,\n}))\n</script>\n"],"mappings":";;;;;;;;;;;AAoNA,IAAM,gBACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhHF,MAAM,QAAQ;EA8Dd,MAAM,OAAO;EAEb,MAAM,QAAQ,eAAe,MAAM,SAAS,UAAU,CAAC;EAEvD,MAAM,YAAY,WAAW,OAAO,UAAU,MAAM;EAEpD,MAAM,cAAc,eAAe;GACjC,MAAM,KAAK,MAAM,WAAW,CAAC,EAAA,CAAG,WAAW,MAAM,EAAE,UAAU,MAAM,UAAU;GAC7E,OAAO,MAAM,KAAK,IAAI;EACxB,CAAC;EAED,SAAS,OAAO,QAAQ;GACtB,IAAI,OAAO,UAAU;GACrB,KAAK,qBAAqB,OAAO,KAAK;EACxC;EAEA,MAAM,YAAY,gBAAgB,EAChC,qBAAqB,UAAU,MAAM,MAAM,mBAC7C,EAAE;EAMF,MAAM,cAAc,eAAe;GACjC,MAAM,MAAM;IAAE,MAAM;IAAgB,OAAO;IAAc,QAAQ;GAAe;GAChF,OAAO,IAAI,MAAM,UAAU,IAAI;EACjC,CAAC;EAGD,MAAM,kBAAkB,eACtB,MAAM,SAAS,OAAO,sBAAsB,qBAC9C;EACA,MAAM,gBAAgB,eAAgB,MAAM,SAAS,OAAO,aAAa,QAAS;EAKlF,MAAM,iBAAiB,eAAe;GACpC,MAAM,MAAM;IACV,OAAO;IACP,SAAS;IACT,OAAO;GACT;GACA,OAAO,IAAI,MAAM,YAAY,IAAI;EACnC,CAAC;EACD,MAAM,kBAAkB,eACtB,MAAM,YAAY,UAAU,eAAe,wCAC7C;EAIA,MAAM,iBAAiB,gBAAgB;GAGrC,OAAO,0BAA0B,MAA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Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, toDisplayString, unref, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
3
4
|
//#region src/components/Select.vue
|
|
4
5
|
var _hoisted_1 = { class: "inline-flex items-center gap-2" };
|
|
5
6
|
var _hoisted_2 = {
|
|
@@ -194,7 +195,8 @@ var _sfc_main = {
|
|
|
194
195
|
const openUp = spaceBelow < 260 && rect.top > spaceBelow;
|
|
195
196
|
const style = {
|
|
196
197
|
left: `${rect.left}px`,
|
|
197
|
-
minWidth: `${rect.width}px
|
|
198
|
+
minWidth: `${rect.width}px`,
|
|
199
|
+
transformOrigin: openUp ? "bottom center" : "top center"
|
|
198
200
|
};
|
|
199
201
|
if (props.block) style.width = `${rect.width}px`;
|
|
200
202
|
if (openUp) style.bottom = `${window.innerHeight - rect.top + 4}px`;
|
|
@@ -396,7 +398,7 @@ var _sfc_main = {
|
|
|
396
398
|
default: withCtx(() => [withDirectives(createElementVNode("div", {
|
|
397
399
|
ref_key: "panelRef",
|
|
398
400
|
ref: panelRef,
|
|
399
|
-
class: "fixed z-[60]
|
|
401
|
+
class: normalizeClass(["fixed z-[60] overflow-hidden", unref(MENU_PANEL_CLASS)]),
|
|
400
402
|
style: normalizeStyle(panelStyle.value)
|
|
401
403
|
}, [__props.searchable ? (openBlock(), createElementBlock("div", _hoisted_5, [withDirectives(createElementVNode("input", {
|
|
402
404
|
ref_key: "searchRef",
|
|
@@ -428,7 +430,7 @@ var _sfc_main = {
|
|
|
428
430
|
class: "w-4 h-4 shrink-0"
|
|
429
431
|
}, null, 8, ["name"])) : createCommentVNode("", true), createElementVNode("div", _hoisted_15, [createElementVNode("span", _hoisted_16, toDisplayString(opt.label), 1), opt.subtitle ? (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(opt.subtitle), 1)) : createCommentVNode("", true)])], 10, _hoisted_14);
|
|
430
432
|
}), 128))], 64);
|
|
431
|
-
}), 128))])],
|
|
433
|
+
}), 128))])], 6), [[vShow, isOpen.value]])]),
|
|
432
434
|
_: 1
|
|
433
435
|
})]))
|
|
434
436
|
], 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":[],"sources":["../../src/components/Select.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\" :class=\"!block ? 'inline-block' : ''\">\n <!-- Hidden sizer: measures the widest option label so the trigger never shrinks below it -->\n <div\n ref=\"sizerRef\"\n aria-hidden=\"true\"\n class=\"invisible absolute h-0 overflow-hidden pointer-events-none whitespace-nowrap\"\n :class=\"sizerTextClass\"\n >\n <span v-for=\"opt in normalizedOptions\" :key=\"opt.value\" class=\"block\">\n <span class=\"inline-flex items-center gap-2\">\n <span v-if=\"opt.icon\" class=\"w-4\" />\n {{ opt.label }}\n <!-- account for chevron + padding -->\n <span class=\"w-4\" />\n </span>\n </span>\n </div>\n\n <!-- Trigger button: shows selected value, placeholder, or loading spinner -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"disabled || loading\"\n :aria-label=\"ariaLabel\"\n :class=\"[triggerClasses, disabled || loading ? 'opacity-50 cursor-not-allowed' : '']\"\n :style=\"autoMinWidth\"\n @click=\"toggleOpen\"\n >\n <span\n v-if=\"loading\"\n class=\"flex items-center gap-2 truncate text-gray-400 dark:text-gray-500\"\n >\n <UiIcon :name=\"spinner\" class=\"w-4 h-4 animate-spin shrink-0\" />\n <span>{{ loadingText }}</span>\n </span>\n <template v-else>\n <span\n class=\"flex items-center gap-2 truncate\"\n :class=\"selectedLabel ? '' : 'text-gray-400 dark:text-gray-500'\"\n >\n <UiIcon v-if=\"selectedIcon\" :name=\"selectedIcon\" class=\"w-4 h-4 shrink-0\" />\n {{ selectedLabel || placeholder || 'Select...' }}\n </span>\n </template>\n <UiIcon\n name=\"mdi:chevron-down\"\n class=\"w-4 h-4 shrink-0 text-gray-400 transition-transform\"\n :class=\"{ 'rotate-180': isOpen }\"\n />\n </button>\n\n <!-- Dropdown panel: teleported to <body> and fixed-positioned so it is never\n clipped by an ancestor with overflow (e.g. a scrollable modal body). -->\n <Teleport to=\"body\">\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-show=\"isOpen\"\n ref=\"panelRef\"\n class=\"fixed z-[60] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden\"\n :style=\"panelStyle\"\n >\n <!-- Search input for filtering options -->\n <div v-if=\"searchable\" class=\"p-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchQuery\"\n type=\"text\"\n placeholder=\"Search...\"\n class=\"w-full px-2.5 py-1.5 text-sm border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-300 outline-none focus:ring-1 focus:ring-primary-500 placeholder-gray-400\"\n @keydown.escape=\"close\"\n @keydown.enter.prevent=\"selectFirst\"\n />\n </div>\n <!-- Options list: ungrouped flat list or grouped sections -->\n <ul class=\"max-h-64 overflow-y-auto py-1\">\n <li\n v-if=\"filteredOptions.length === 0 && filteredGroups.length === 0\"\n class=\"px-3 py-2 text-sm text-gray-400 dark:text-gray-500\"\n >\n No results\n </li>\n\n <!-- Ungrouped options -->\n <template v-if=\"filteredGroups.length === 0\">\n <li\n v-for=\"opt in filteredOptions\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n\n <!-- Grouped options -->\n <template v-else>\n <template v-for=\"group in filteredGroups\" :key=\"group.label\">\n <li\n class=\"px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 select-none\"\n >\n {{ group.label }}\n </li>\n <li\n v-for=\"opt in group.options\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n </template>\n </ul>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSelect — Custom dropdown select component with search, grouping, icons, and loading state.\n *\n * Renders a styled trigger button that opens a dropdown panel with filterable options.\n * Supports flat option lists and grouped options (via `group` key on option objects).\n * Includes keyboard navigation (Escape to close, Enter to select first match),\n * automatic drop-up when near the bottom of the viewport, and a loading spinner state.\n *\n * @example Basic select\n * <UiSelect v-model=\"color\" :options=\"['Red', 'Green', 'Blue']\" placeholder=\"Pick a color\" />\n *\n * @example Searchable select with object options\n * <UiSelect v-model=\"lang\" :options=\"[{ value: 'en', label: 'English' }, { value: 'es', label: 'Spanish' }]\" searchable />\n *\n * @example Grouped options with icons\n * <UiSelect v-model=\"tool\" :options=\"[\n * { value: 'pen', label: 'Pen', icon: 'mdi:pen', group: 'Drawing' },\n * { value: 'eraser', label: 'Eraser', icon: 'mdi:eraser', group: 'Drawing' },\n * { value: 'text', label: 'Text', icon: 'mdi:format-text', group: 'Insert' },\n * ]\" searchable />\n *\n * @example Loading state\n * <UiSelect v-model=\"val\" :options=\"[]\" :loading=\"true\" loading-text=\"Fetching...\" />\n *\n * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected\n */\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Currently selected value (v-model).\n * @type {string | number | boolean | null}\n * @default ''\n */\n modelValue: { type: [String, Number, Boolean, null], default: '' },\n\n /**\n * Array of selectable options. Each item can be:\n * - A primitive (string/number) used as both value and label\n * - An object: `{ value, label, icon?, group? }`\n * @type {Array}\n * @default []\n */\n options: { type: Array, default: () => [] },\n\n /**\n * Placeholder text shown when no option is selected.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Enable a search input inside the dropdown for filtering options.\n * @type {boolean}\n * @default false\n */\n searchable: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the trigger and prevents opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Trigger button size controlling padding and font.\n * @type {string}\n * @default 'md'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Full-width mode — trigger stretches to fill its container.\n * @type {boolean}\n * @default true\n */\n block: { type: Boolean, default: true },\n\n /**\n * Accessible label for the trigger button.\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Loading state — shows a spinner and disables interaction.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n\n /**\n * Text displayed next to the spinner during loading.\n * @type {string}\n * @default 'Loading...'\n */\n loadingText: { type: String, default: 'Loading...' },\n\n /**\n * MDI icon name for the loading spinner.\n * @type {string}\n * @default 'mdi:loading'\n */\n spinner: { type: String, default: 'mdi:loading' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst containerRef = ref(null)\nconst triggerRef = ref(null)\nconst searchRef = ref(null)\nconst sizerRef = ref(null)\nconst panelRef = ref(null)\nconst isOpen = ref(false)\nconst searchQuery = ref('')\nconst measuredWidth = ref(0)\nconst panelStyle = ref({})\n\n// Position the teleported panel under (or above) the trigger using fixed\n// coordinates so it overlays everything and is never clipped by a scrollable\n// ancestor. Re-run on scroll/resize while open so it stays anchored.\nconst reposition = () => {\n const el = triggerRef.value\n if (!el) return\n const rect = el.getBoundingClientRect()\n const spaceBelow = window.innerHeight - rect.bottom\n const openUp = spaceBelow < 260 && rect.top > spaceBelow\n const style = { left: `${rect.left}px`, minWidth: `${rect.width}px` }\n if (props.block) style.width = `${rect.width}px`\n if (openUp) style.bottom = `${window.innerHeight - rect.top + 4}px`\n else style.top = `${rect.bottom + 4}px`\n panelStyle.value = style\n}\n\nconst startTracking = () => {\n window.addEventListener('scroll', reposition, true)\n window.addEventListener('resize', reposition)\n}\nconst stopTracking = () => {\n window.removeEventListener('scroll', reposition, true)\n window.removeEventListener('resize', reposition)\n}\n\n// Text class for the hidden sizer — must match the trigger's font size\nconst sizerTextClass = computed(() => {\n const map = { xs: 'text-xs', sm: 'text-sm', md: 'text-sm' }\n return map[props.size] || 'text-sm'\n})\n\n// Measure the widest option on mount and when options change\nconst measureSizer = () => {\n if (!sizerRef.value) {\n measuredWidth.value = 0\n return\n }\n measuredWidth.value = sizerRef.value.scrollWidth\n}\n\nonMounted(measureSizer)\nwatch(\n () => props.options,\n () => nextTick(measureSizer),\n { deep: true },\n)\n\n// Auto min-width style: ensures trigger never shrinks below the widest option\nconst autoMinWidth = computed(() => {\n if (!measuredWidth.value) return undefined\n // Add padding for the trigger's horizontal padding + border\n const padMap = { xs: 28, sm: 24, md: 30 }\n const pad = padMap[props.size] || 30\n return { minWidth: `${measuredWidth.value + pad}px` }\n})\n\n// ── Normalize options ────────────────────────────────────\n// Convert primitive options (string/number) into { value, label, subtitle, icon, group } objects\nconst normalizedOptions = computed(() =>\n props.options.map((opt) =>\n typeof opt === 'object' && opt !== null\n ? {\n value: opt.value,\n label: opt.label ?? String(opt.value),\n subtitle: opt.subtitle || '',\n icon: opt.icon || '',\n group: opt.group || '',\n }\n : { value: opt, label: String(opt), subtitle: '', icon: '', group: '' },\n ),\n)\n\n// ── Filtering ────────────────────────────────────────────\n// Apply search query filter against option labels (case-insensitive)\nconst filteredNormalized = computed(() => {\n if (!searchQuery.value) return normalizedOptions.value\n const q = searchQuery.value.toLowerCase()\n return normalizedOptions.value.filter(\n (opt) => opt.label.toLowerCase().includes(q) || opt.subtitle.toLowerCase().includes(q),\n )\n})\n\n// ── Grouping ─────────────────────────────────────────────\n// Detect if any option has a group key to enable grouped rendering\nconst hasGroups = computed(() => normalizedOptions.value.some((o) => o.group))\n\n// Build grouped structure: Map<groupLabel, { label, options[] }>\nconst filteredGroups = computed(() => {\n if (!hasGroups.value) return []\n const map = new Map()\n for (const opt of filteredNormalized.value) {\n const key = opt.group || ''\n if (!map.has(key)) map.set(key, { label: key, options: [] })\n map.get(key).options.push(opt)\n }\n return [...map.values()].filter((g) => g.options.length > 0)\n})\n\nconst filteredOptions = computed(() => {\n if (hasGroups.value) return []\n return filteredNormalized.value\n})\n\n// ── Selected display ─────────────────────────────────────\nconst selectedOpt = computed(() =>\n normalizedOptions.value.find((o) => o.value === props.modelValue),\n)\nconst selectedLabel = computed(() => selectedOpt.value?.label || '')\nconst selectedIcon = computed(() => selectedOpt.value?.icon || '')\n\n// ── Styling ──────────────────────────────────────────────\nconst triggerClasses = computed(() => {\n const base =\n 'flex items-center justify-between gap-2 text-left border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-400 outline-none transition-colors focus:ring-2 focus:ring-primary-500 focus:border-primary-500'\n const width = props.block ? 'w-full' : ''\n const sizeMap = {\n xs: 'px-2.5 py-1.5 text-xs rounded-md border-gray-200 dark:border-gray-700',\n sm: 'px-2 py-1 text-sm rounded-lg border-gray-300 dark:border-gray-600',\n md: 'px-3 py-2 text-sm rounded-lg border-gray-300 dark:border-gray-700',\n }\n return `${base} ${width} ${sizeMap[props.size] || sizeMap.md}`\n})\n\nconst optionClass = (value) =>\n props.modelValue === value\n ? 'bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300'\n : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'\n\n// ── Interactions ─────────────────────────────────────────\n// Toggle dropdown open/close, auto-detect drop direction, and focus search input\nconst toggleOpen = () => {\n if (props.disabled || props.loading) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n searchQuery.value = ''\n reposition()\n startTracking()\n nextTick(() => {\n reposition()\n if (props.searchable) searchRef.value?.focus()\n })\n } else {\n stopTracking()\n }\n}\n\nconst select = (value) => {\n emit('update:modelValue', value)\n close()\n}\n\nconst selectFirst = () => {\n const pool = hasGroups.value\n ? filteredGroups.value.flatMap((g) => g.options)\n : filteredOptions.value\n if (pool.length) select(pool[0].value)\n}\n\nconst close = () => {\n isOpen.value = false\n searchQuery.value = ''\n stopTracking()\n}\n\n// Programmatic toggle for parent row clicks.\n// Uses a skip flag to prevent the race with the document click handler:\n// when the row is clicked, the capture-phase listener fires first (closing the dropdown),\n// then the row handler calls toggle(). The flag lets us detect this and skip the re-open.\nlet skipNextOpen = false\nconst toggle = () => {\n if (props.disabled || props.loading) return\n if (skipNextOpen) {\n skipNextOpen = false\n return\n }\n toggleOpen()\n}\n\nconst closeFromOutside = () => {\n if (isOpen.value) skipNextOpen = true\n close()\n setTimeout(() => {\n skipNextOpen = false\n }, 0)\n}\n\nconst onDocumentClick = (e) => {\n // The panel is teleported to <body>, so clicks inside it are NOT inside the\n // container — check both before treating a click as \"outside\".\n if (containerRef.value?.contains(e.target)) return\n if (panelRef.value?.contains(e.target)) return\n closeFromOutside()\n}\n\nonMounted(() => document.addEventListener('click', onDocumentClick, true))\nonBeforeUnmount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M,CAAA,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":[],"sources":["../../src/components/Select.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\" :class=\"!block ? 'inline-block' : ''\">\n <!-- Hidden sizer: measures the widest option label so the trigger never shrinks below it -->\n <div\n ref=\"sizerRef\"\n aria-hidden=\"true\"\n class=\"invisible absolute h-0 overflow-hidden pointer-events-none whitespace-nowrap\"\n :class=\"sizerTextClass\"\n >\n <span v-for=\"opt in normalizedOptions\" :key=\"opt.value\" class=\"block\">\n <span class=\"inline-flex items-center gap-2\">\n <span v-if=\"opt.icon\" class=\"w-4\" />\n {{ opt.label }}\n <!-- account for chevron + padding -->\n <span class=\"w-4\" />\n </span>\n </span>\n </div>\n\n <!-- Trigger button: shows selected value, placeholder, or loading spinner -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"disabled || loading\"\n :aria-label=\"ariaLabel\"\n :class=\"[triggerClasses, disabled || loading ? 'opacity-50 cursor-not-allowed' : '']\"\n :style=\"autoMinWidth\"\n @click=\"toggleOpen\"\n >\n <span\n v-if=\"loading\"\n class=\"flex items-center gap-2 truncate text-gray-400 dark:text-gray-500\"\n >\n <UiIcon :name=\"spinner\" class=\"w-4 h-4 animate-spin shrink-0\" />\n <span>{{ loadingText }}</span>\n </span>\n <template v-else>\n <span\n class=\"flex items-center gap-2 truncate\"\n :class=\"selectedLabel ? '' : 'text-gray-400 dark:text-gray-500'\"\n >\n <UiIcon v-if=\"selectedIcon\" :name=\"selectedIcon\" class=\"w-4 h-4 shrink-0\" />\n {{ selectedLabel || placeholder || 'Select...' }}\n </span>\n </template>\n <UiIcon\n name=\"mdi:chevron-down\"\n class=\"w-4 h-4 shrink-0 text-gray-400 transition-transform\"\n :class=\"{ 'rotate-180': isOpen }\"\n />\n </button>\n\n <!-- Dropdown panel: teleported to <body> and fixed-positioned so it is never\n clipped by an ancestor with overflow (e.g. a scrollable modal body). -->\n <Teleport to=\"body\">\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-show=\"isOpen\"\n ref=\"panelRef\"\n class=\"fixed z-[60] overflow-hidden\"\n :class=\"MENU_PANEL_CLASS\"\n :style=\"panelStyle\"\n >\n <!-- Search input for filtering options -->\n <div v-if=\"searchable\" class=\"p-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchQuery\"\n type=\"text\"\n placeholder=\"Search...\"\n class=\"w-full px-2.5 py-1.5 text-sm border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-300 outline-none focus:ring-1 focus:ring-primary-500 placeholder-gray-400\"\n @keydown.escape=\"close\"\n @keydown.enter.prevent=\"selectFirst\"\n />\n </div>\n <!-- Options list: ungrouped flat list or grouped sections -->\n <ul class=\"max-h-64 overflow-y-auto py-1\">\n <li\n v-if=\"filteredOptions.length === 0 && filteredGroups.length === 0\"\n class=\"px-3 py-2 text-sm text-gray-400 dark:text-gray-500\"\n >\n No results\n </li>\n\n <!-- Ungrouped options -->\n <template v-if=\"filteredGroups.length === 0\">\n <li\n v-for=\"opt in filteredOptions\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n\n <!-- Grouped options -->\n <template v-else>\n <template v-for=\"group in filteredGroups\" :key=\"group.label\">\n <li\n class=\"px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 select-none\"\n >\n {{ group.label }}\n </li>\n <li\n v-for=\"opt in group.options\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n </template>\n </ul>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSelect — Custom dropdown select component with search, grouping, icons, and loading state.\n *\n * Renders a styled trigger button that opens a dropdown panel with filterable options.\n * Supports flat option lists and grouped options (via `group` key on option objects).\n * Includes keyboard navigation (Escape to close, Enter to select first match),\n * automatic drop-up when near the bottom of the viewport, and a loading spinner state.\n *\n * @example Basic select\n * <UiSelect v-model=\"color\" :options=\"['Red', 'Green', 'Blue']\" placeholder=\"Pick a color\" />\n *\n * @example Searchable select with object options\n * <UiSelect v-model=\"lang\" :options=\"[{ value: 'en', label: 'English' }, { value: 'es', label: 'Spanish' }]\" searchable />\n *\n * @example Grouped options with icons\n * <UiSelect v-model=\"tool\" :options=\"[\n * { value: 'pen', label: 'Pen', icon: 'mdi:pen', group: 'Drawing' },\n * { value: 'eraser', label: 'Eraser', icon: 'mdi:eraser', group: 'Drawing' },\n * { value: 'text', label: 'Text', icon: 'mdi:format-text', group: 'Insert' },\n * ]\" searchable />\n *\n * @example Loading state\n * <UiSelect v-model=\"val\" :options=\"[]\" :loading=\"true\" loading-text=\"Fetching...\" />\n *\n * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected\n */\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Currently selected value (v-model).\n * @type {string | number | boolean | null}\n * @default ''\n */\n modelValue: { type: [String, Number, Boolean, null], default: '' },\n\n /**\n * Array of selectable options. Each item can be:\n * - A primitive (string/number) used as both value and label\n * - An object: `{ value, label, icon?, group? }`\n * @type {Array}\n * @default []\n */\n options: { type: Array, default: () => [] },\n\n /**\n * Placeholder text shown when no option is selected.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Enable a search input inside the dropdown for filtering options.\n * @type {boolean}\n * @default false\n */\n searchable: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the trigger and prevents opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Trigger button size controlling padding and font.\n * @type {string}\n * @default 'md'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Full-width mode — trigger stretches to fill its container.\n * @type {boolean}\n * @default true\n */\n block: { type: Boolean, default: true },\n\n /**\n * Accessible label for the trigger button.\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Loading state — shows a spinner and disables interaction.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n\n /**\n * Text displayed next to the spinner during loading.\n * @type {string}\n * @default 'Loading...'\n */\n loadingText: { type: String, default: 'Loading...' },\n\n /**\n * MDI icon name for the loading spinner.\n * @type {string}\n * @default 'mdi:loading'\n */\n spinner: { type: String, default: 'mdi:loading' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst containerRef = ref(null)\nconst triggerRef = ref(null)\nconst searchRef = ref(null)\nconst sizerRef = ref(null)\nconst panelRef = ref(null)\nconst isOpen = ref(false)\nconst searchQuery = ref('')\nconst measuredWidth = ref(0)\nconst panelStyle = ref({})\n\n// Position the teleported panel under (or above) the trigger using fixed\n// coordinates so it overlays everything and is never clipped by a scrollable\n// ancestor. Re-run on scroll/resize while open so it stays anchored.\nconst reposition = () => {\n const el = triggerRef.value\n if (!el) return\n const rect = el.getBoundingClientRect()\n const spaceBelow = window.innerHeight - rect.bottom\n const openUp = spaceBelow < 260 && rect.top > spaceBelow\n // Inline transform-origin (not a Tailwind class) so the panel reliably scales\n // in from the edge nearest the trigger — top when dropping down, bottom when\n // dropping up — instead of drifting in from its centre.\n const style = {\n left: `${rect.left}px`,\n minWidth: `${rect.width}px`,\n transformOrigin: openUp ? 'bottom center' : 'top center',\n }\n if (props.block) style.width = `${rect.width}px`\n if (openUp) style.bottom = `${window.innerHeight - rect.top + 4}px`\n else style.top = `${rect.bottom + 4}px`\n panelStyle.value = style\n}\n\nconst startTracking = () => {\n window.addEventListener('scroll', reposition, true)\n window.addEventListener('resize', reposition)\n}\nconst stopTracking = () => {\n window.removeEventListener('scroll', reposition, true)\n window.removeEventListener('resize', reposition)\n}\n\n// Text class for the hidden sizer — must match the trigger's font size\nconst sizerTextClass = computed(() => {\n const map = { xs: 'text-xs', sm: 'text-sm', md: 'text-sm' }\n return map[props.size] || 'text-sm'\n})\n\n// Measure the widest option on mount and when options change\nconst measureSizer = () => {\n if (!sizerRef.value) {\n measuredWidth.value = 0\n return\n }\n measuredWidth.value = sizerRef.value.scrollWidth\n}\n\nonMounted(measureSizer)\nwatch(\n () => props.options,\n () => nextTick(measureSizer),\n { deep: true },\n)\n\n// Auto min-width style: ensures trigger never shrinks below the widest option\nconst autoMinWidth = computed(() => {\n if (!measuredWidth.value) return undefined\n // Add padding for the trigger's horizontal padding + border\n const padMap = { xs: 28, sm: 24, md: 30 }\n const pad = padMap[props.size] || 30\n return { minWidth: `${measuredWidth.value + pad}px` }\n})\n\n// ── Normalize options ────────────────────────────────────\n// Convert primitive options (string/number) into { value, label, subtitle, icon, group } objects\nconst normalizedOptions = computed(() =>\n props.options.map((opt) =>\n typeof opt === 'object' && opt !== null\n ? {\n value: opt.value,\n label: opt.label ?? String(opt.value),\n subtitle: opt.subtitle || '',\n icon: opt.icon || '',\n group: opt.group || '',\n }\n : { value: opt, label: String(opt), subtitle: '', icon: '', group: '' },\n ),\n)\n\n// ── Filtering ────────────────────────────────────────────\n// Apply search query filter against option labels (case-insensitive)\nconst filteredNormalized = computed(() => {\n if (!searchQuery.value) return normalizedOptions.value\n const q = searchQuery.value.toLowerCase()\n return normalizedOptions.value.filter(\n (opt) => opt.label.toLowerCase().includes(q) || opt.subtitle.toLowerCase().includes(q),\n )\n})\n\n// ── Grouping ─────────────────────────────────────────────\n// Detect if any option has a group key to enable grouped rendering\nconst hasGroups = computed(() => normalizedOptions.value.some((o) => o.group))\n\n// Build grouped structure: Map<groupLabel, { label, options[] }>\nconst filteredGroups = computed(() => {\n if (!hasGroups.value) return []\n const map = new Map()\n for (const opt of filteredNormalized.value) {\n const key = opt.group || ''\n if (!map.has(key)) map.set(key, { label: key, options: [] })\n map.get(key).options.push(opt)\n }\n return [...map.values()].filter((g) => g.options.length > 0)\n})\n\nconst filteredOptions = computed(() => {\n if (hasGroups.value) return []\n return filteredNormalized.value\n})\n\n// ── Selected display ─────────────────────────────────────\nconst selectedOpt = computed(() =>\n normalizedOptions.value.find((o) => o.value === props.modelValue),\n)\nconst selectedLabel = computed(() => selectedOpt.value?.label || '')\nconst selectedIcon = computed(() => selectedOpt.value?.icon || '')\n\n// ── Styling ──────────────────────────────────────────────\nconst triggerClasses = computed(() => {\n const base =\n 'flex items-center justify-between gap-2 text-left border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-400 outline-none transition-colors focus:ring-2 focus:ring-primary-500 focus:border-primary-500'\n const width = props.block ? 'w-full' : ''\n const sizeMap = {\n xs: 'px-2.5 py-1.5 text-xs rounded-md border-gray-200 dark:border-gray-700',\n sm: 'px-2 py-1 text-sm rounded-lg border-gray-300 dark:border-gray-600',\n md: 'px-3 py-2 text-sm rounded-lg border-gray-300 dark:border-gray-700',\n }\n return `${base} ${width} ${sizeMap[props.size] || sizeMap.md}`\n})\n\nconst optionClass = (value) =>\n props.modelValue === value\n ? 'bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300'\n : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'\n\n// ── Interactions ─────────────────────────────────────────\n// Toggle dropdown open/close, auto-detect drop direction, and focus search input\nconst toggleOpen = () => {\n if (props.disabled || props.loading) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n searchQuery.value = ''\n reposition()\n startTracking()\n nextTick(() => {\n reposition()\n if (props.searchable) searchRef.value?.focus()\n })\n } else {\n stopTracking()\n }\n}\n\nconst select = (value) => {\n emit('update:modelValue', value)\n close()\n}\n\nconst selectFirst = () => {\n const pool = hasGroups.value\n ? filteredGroups.value.flatMap((g) => g.options)\n : filteredOptions.value\n if (pool.length) select(pool[0].value)\n}\n\nconst close = () => {\n isOpen.value = false\n searchQuery.value = ''\n stopTracking()\n}\n\n// Programmatic toggle for parent row clicks.\n// Uses a skip flag to prevent the race with the document click handler:\n// when the row is clicked, the capture-phase listener fires first (closing the dropdown),\n// then the row handler calls toggle(). The flag lets us detect this and skip the re-open.\nlet skipNextOpen = false\nconst toggle = () => {\n if (props.disabled || props.loading) return\n if (skipNextOpen) {\n skipNextOpen = false\n return\n }\n toggleOpen()\n}\n\nconst closeFromOutside = () => {\n if (isOpen.value) skipNextOpen = true\n close()\n setTimeout(() => {\n skipNextOpen = false\n }, 0)\n}\n\nconst onDocumentClick = (e) => {\n // The panel is teleported to <body>, so clicks inside it are NOT inside the\n // container — check both before treating a click as \"outside\".\n if (containerRef.value?.contains(e.target)) return\n if (panelRef.value?.contains(e.target)) return\n closeFromOutside()\n}\n\nonMounted(() => document.addEventListener('click', onDocumentClick, true))\nonBeforeUnmount(() => {\n document.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