numori-ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +18 -19
  3. package/dist/components/AppShell.js +234 -0
  4. package/dist/components/AppShell.js.map +1 -0
  5. package/dist/components/Checkbox.js +11 -2
  6. package/dist/components/Checkbox.js.map +1 -1
  7. package/dist/components/CopyField.js +195 -0
  8. package/dist/components/CopyField.js.map +1 -0
  9. package/dist/components/DescriptionList.js +116 -0
  10. package/dist/components/DescriptionList.js.map +1 -0
  11. package/dist/components/EmptyState.js +123 -0
  12. package/dist/components/EmptyState.js.map +1 -0
  13. package/dist/components/FormField.js +43 -13
  14. package/dist/components/FormField.js.map +1 -1
  15. package/dist/components/Input.js +15 -1
  16. package/dist/components/Input.js.map +1 -1
  17. package/dist/components/PageHeader.js +106 -0
  18. package/dist/components/PageHeader.js.map +1 -0
  19. package/dist/components/Pagination.js +236 -0
  20. package/dist/components/Pagination.js.map +1 -0
  21. package/dist/components/Segmented.js +10 -2
  22. package/dist/components/Segmented.js.map +1 -1
  23. package/dist/components/Select.js +10 -1
  24. package/dist/components/Select.js.map +1 -1
  25. package/dist/components/Sidebar.js +69 -0
  26. package/dist/components/Sidebar.js.map +1 -0
  27. package/dist/components/SidebarGroup.js +50 -0
  28. package/dist/components/SidebarGroup.js.map +1 -0
  29. package/dist/components/SidebarItem.js +167 -0
  30. package/dist/components/SidebarItem.js.map +1 -0
  31. package/dist/components/StatCard.js +185 -0
  32. package/dist/components/StatCard.js.map +1 -0
  33. package/dist/components/Table.js +182 -50
  34. package/dist/components/Table.js.map +1 -1
  35. package/dist/components/Tabs.js +216 -0
  36. package/dist/components/Tabs.js.map +1 -0
  37. package/dist/components/Toggle.js +11 -2
  38. package/dist/components/Toggle.js.map +1 -1
  39. package/dist/components/index.js +97 -80
  40. package/dist/components/index.js.map +1 -1
  41. package/dist/icons/mdi.js +10 -0
  42. package/dist/icons/mdi.js.map +1 -1
  43. package/dist/index.d.ts +12 -1
  44. package/dist/index.js +50 -39
  45. package/dist/index.js.map +1 -1
  46. package/dist/internal/formField.js +26 -0
  47. package/dist/internal/formField.js.map +1 -0
  48. package/dist/manifest.js +11 -0
  49. package/dist/manifest.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/components/AppShell.vue +231 -0
  52. package/src/components/Checkbox.vue +5 -0
  53. package/src/components/CopyField.vue +178 -0
  54. package/src/components/DescriptionList.vue +114 -0
  55. package/src/components/EmptyState.vue +107 -0
  56. package/src/components/FormField.vue +37 -4
  57. package/src/components/Input.vue +9 -0
  58. package/src/components/PageHeader.vue +102 -0
  59. package/src/components/Pagination.vue +199 -0
  60. package/src/components/Segmented.vue +5 -0
  61. package/src/components/Select.vue +5 -0
  62. package/src/components/Sidebar.vue +61 -0
  63. package/src/components/SidebarGroup.vue +43 -0
  64. package/src/components/SidebarItem.vue +159 -0
  65. package/src/components/StatCard.vue +165 -0
  66. package/src/components/Table.vue +148 -18
  67. package/src/components/Tabs.vue +217 -0
  68. package/src/components/Toggle.vue +5 -0
  69. package/src/components/index.js +33 -5
  70. package/src/icons/mdi.js +10 -0
  71. package/src/internal/formField.js +23 -0
  72. package/src/manifest.js +11 -0
@@ -0,0 +1,106 @@
1
+ import { useMergedClasses } from "../composables/useMergedClasses.js";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, mergeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
3
+ //#region src/components/PageHeader.vue
4
+ var _hoisted_1 = {
5
+ key: 0,
6
+ class: "mb-3"
7
+ };
8
+ var _hoisted_2 = { class: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" };
9
+ var _hoisted_3 = { class: "min-w-0 flex-1" };
10
+ var _hoisted_4 = { class: "flex flex-wrap items-center gap-x-3 gap-y-2" };
11
+ var _hoisted_5 = {
12
+ key: 0,
13
+ class: "mt-1 max-w-3xl text-sm text-gray-600 dark:text-gray-400"
14
+ };
15
+ var _hoisted_6 = {
16
+ key: 0,
17
+ class: "flex shrink-0 flex-wrap items-center gap-2"
18
+ };
19
+ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
20
+ __name: "PageHeader",
21
+ props: {
22
+ /**
23
+ * Page title.
24
+ * @type {string}
25
+ * @default ''
26
+ */
27
+ title: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ /**
32
+ * One line explaining the page.
33
+ * @type {string}
34
+ * @default ''
35
+ */
36
+ description: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ /**
41
+ * Heading level of the title.
42
+ * @type {number}
43
+ * @default 1
44
+ * @values 1 | 2 | 3
45
+ */
46
+ level: {
47
+ type: Number,
48
+ default: 1
49
+ },
50
+ /**
51
+ * Draw a rule below the header.
52
+ * @type {boolean}
53
+ * @default false
54
+ */
55
+ bordered: {
56
+ type: Boolean,
57
+ default: false
58
+ }
59
+ },
60
+ setup(__props) {
61
+ /**
62
+ * UiPageHeader — the title block at the top of an application page: optional
63
+ * breadcrumb, heading, badges, a line of description and the page's actions.
64
+ *
65
+ * Actions sit to the right on wide screens and wrap below the title on narrow
66
+ * ones. The heading is an `<h1>` by default; lower it with `level` when the
67
+ * header sits inside a section that already has one.
68
+ *
69
+ * @example
70
+ * <UiPageHeader title="Apps" description="Every application that syncs through this service.">
71
+ * <template #actions>
72
+ * <UiButton><UiIcon name="mdi:plus" class="size-4" />New app</UiButton>
73
+ * </template>
74
+ * </UiPageHeader>
75
+ *
76
+ * @example With breadcrumb and a status badge
77
+ * <UiPageHeader title="notes">
78
+ * <template #breadcrumb><UiBreadcrumb :items="crumbs" /></template>
79
+ * <template #meta><UiBadge color="green">Active</UiBadge></template>
80
+ * </UiPageHeader>
81
+ *
82
+ * @slot title — Rich title content (overrides `title`).
83
+ * @slot meta — Inline content after the title, such as badges.
84
+ * @slot description — Rich description (overrides `description`).
85
+ * @slot breadcrumb — Content above the title, usually a `UiBreadcrumb`.
86
+ * @slot actions — Buttons for the page's primary actions.
87
+ */
88
+ const props = __props;
89
+ const headingTag = computed(() => `h${[
90
+ 1,
91
+ 2,
92
+ 3
93
+ ].includes(props.level) ? props.level : 1}`);
94
+ const { mergedClasses, restAttrs } = useMergedClasses(() => props.bordered ? "mb-6 border-b border-gray-200 pb-5 dark:border-gray-800" : "mb-6");
95
+ return (_ctx, _cache) => {
96
+ return openBlock(), createElementBlock("div", mergeProps({ class: unref(mergedClasses) }, unref(restAttrs)), [_ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "breadcrumb")])) : createCommentVNode("", true), createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [(openBlock(), createBlock(resolveDynamicComponent(headingTag.value), { class: "min-w-0 truncate text-2xl font-semibold tracking-tight text-gray-900 dark:text-gray-50" }, {
97
+ default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])]),
98
+ _: 3
99
+ })), renderSlot(_ctx.$slots, "meta")]), __props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("p", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])])) : createCommentVNode("", true)]), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)])], 16);
100
+ };
101
+ }
102
+ });
103
+ //#endregion
104
+ export { _sfc_main as default };
105
+
106
+ //# sourceMappingURL=PageHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeader.js","names":["$slots"],"sources":["../../src/components/PageHeader.vue"],"sourcesContent":["<template>\n <div :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <div v-if=\"$slots.breadcrumb\" class=\"mb-3\">\n <slot name=\"breadcrumb\" />\n </div>\n\n <div class=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2\">\n <component\n :is=\"headingTag\"\n class=\"min-w-0 truncate text-2xl font-semibold tracking-tight text-gray-900 dark:text-gray-50\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </component>\n <slot name=\"meta\" />\n </div>\n <p\n v-if=\"description || $slots.description\"\n class=\"mt-1 max-w-3xl text-sm text-gray-600 dark:text-gray-400\"\n >\n <slot name=\"description\">{{ description }}</slot>\n </p>\n </div>\n\n <div v-if=\"$slots.actions\" class=\"flex shrink-0 flex-wrap items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiPageHeader — the title block at the top of an application page: optional\n * breadcrumb, heading, badges, a line of description and the page's actions.\n *\n * Actions sit to the right on wide screens and wrap below the title on narrow\n * ones. The heading is an `<h1>` by default; lower it with `level` when the\n * header sits inside a section that already has one.\n *\n * @example\n * <UiPageHeader title=\"Apps\" description=\"Every application that syncs through this service.\">\n * <template #actions>\n * <UiButton><UiIcon name=\"mdi:plus\" class=\"size-4\" />New app</UiButton>\n * </template>\n * </UiPageHeader>\n *\n * @example With breadcrumb and a status badge\n * <UiPageHeader title=\"notes\">\n * <template #breadcrumb><UiBreadcrumb :items=\"crumbs\" /></template>\n * <template #meta><UiBadge color=\"green\">Active</UiBadge></template>\n * </UiPageHeader>\n *\n * @slot title — Rich title content (overrides `title`).\n * @slot meta — Inline content after the title, such as badges.\n * @slot description — Rich description (overrides `description`).\n * @slot breadcrumb — Content above the title, usually a `UiBreadcrumb`.\n * @slot actions — Buttons for the page's primary actions.\n */\nimport { computed } from 'vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\nconst props = defineProps({\n /**\n * Page title.\n * @type {string}\n * @default ''\n */\n title: { type: String, default: '' },\n\n /**\n * One line explaining the page.\n * @type {string}\n * @default ''\n */\n description: { type: String, default: '' },\n\n /**\n * Heading level of the title.\n * @type {number}\n * @default 1\n * @values 1 | 2 | 3\n */\n level: { type: Number, default: 1 },\n\n /**\n * Draw a rule below the header.\n * @type {boolean}\n * @default false\n */\n bordered: { type: Boolean, default: false },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst headingTag = computed(() => `h${[1, 2, 3].includes(props.level) ? props.level : 1}`)\n\nconst { mergedClasses, restAttrs } = useMergedClasses(() =>\n props.bordered ? 'mb-6 border-b border-gray-200 pb-5 dark:border-gray-800' : 'mb-6',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DA,MAAM,QAAQ;EAiCd,MAAM,aAAa,eAAe,IAAI;GAAC;GAAG;GAAG;EAAC,CAAC,CAAC,SAAS,MAAM,KAAK,IAAI,MAAM,QAAQ,GAAG;EAEzF,MAAM,EAAE,eAAe,cAAc,uBACnC,MAAM,WAAW,4DAA4D,MAC/E;;GAnGE,OAAA,UAAA,GAAA,mBA4BM,OA5BN,WA4BM,EA5BA,OAAO,MAAA,aAAA,EAAa,GAAU,MAAA,SAAA,CAAS,GAAA,CAChCA,KAAAA,OAAO,cAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAA0B,KAAA,QAAA,YAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAG5B,mBAsBM,OAtBN,YAsBM,CArBJ,mBAgBM,OAhBN,YAgBM,CAfJ,mBAQM,OARN,YAQM,EAPJ,UAAA,GAAA,YAKY,wBAJL,WAAA,KAAU,GAAA,EACf,OAAM,yFAAwF,GAAA;IAE9F,SAAA,cAAqC,CAArC,WAAqC,KAAA,QAAA,SAAA,CAAA,SAAA,CAAf,gBAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;GAE7B,CAAA,IAAA,WAAoB,KAAA,QAAA,MAAA,CAAA,CAAA,GAGd,QAAA,eAAeA,KAAAA,OAAO,eAD9B,UAAA,GAAA,mBAKI,KALJ,YAKI,CADF,WAAiD,KAAA,QAAA,eAAA,CAAA,SAAA,CAArB,gBAAA,gBAAA,QAAA,WAAW,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,GAIhCA,KAAAA,OAAO,WAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAAuB,KAAA,QAAA,SAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,CAAA,GAAA,EAAA"}
@@ -0,0 +1,236 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, openBlock, renderList, toDisplayString } from "vue";
3
+ //#region src/components/Pagination.vue
4
+ var _hoisted_1 = ["aria-label"];
5
+ var _hoisted_2 = {
6
+ key: 0,
7
+ class: "text-sm text-gray-500 tabular-nums dark:text-gray-400"
8
+ };
9
+ var _hoisted_3 = { key: 1 };
10
+ var _hoisted_4 = {
11
+ key: 2,
12
+ class: "flex items-center gap-1"
13
+ };
14
+ var _hoisted_5 = ["disabled", "aria-label"];
15
+ var _hoisted_6 = {
16
+ key: 0,
17
+ class: "inline-flex size-9 items-center justify-center text-sm text-gray-400 dark:text-gray-500",
18
+ "aria-hidden": "true"
19
+ };
20
+ var _hoisted_7 = [
21
+ "aria-current",
22
+ "aria-label",
23
+ "onClick"
24
+ ];
25
+ var _hoisted_8 = ["disabled", "aria-label"];
26
+ var buttonBase = "inline-flex size-9 items-center justify-center rounded-lg text-sm font-medium tabular-nums transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500";
27
+ var _sfc_main = {
28
+ __name: "Pagination",
29
+ props: {
30
+ /**
31
+ * Current page, 1-based.
32
+ * @type {number}
33
+ * @default 1
34
+ */
35
+ page: {
36
+ type: Number,
37
+ default: 1
38
+ },
39
+ /**
40
+ * Items per page.
41
+ * @type {number}
42
+ * @default 20
43
+ */
44
+ pageSize: {
45
+ type: Number,
46
+ default: 20
47
+ },
48
+ /**
49
+ * Total number of items.
50
+ * @type {number}
51
+ */
52
+ total: {
53
+ type: Number,
54
+ required: true
55
+ },
56
+ /**
57
+ * Pages shown either side of the current one.
58
+ * @type {number}
59
+ * @default 1
60
+ */
61
+ siblings: {
62
+ type: Number,
63
+ default: 1
64
+ },
65
+ /**
66
+ * Show the "from–to of total" summary.
67
+ * @type {boolean}
68
+ * @default true
69
+ */
70
+ showSummary: {
71
+ type: Boolean,
72
+ default: true
73
+ },
74
+ /**
75
+ * Builds the summary text from the 1-based range shown and the total.
76
+ * @type {(from: number, to: number, total: number) => string}
77
+ */
78
+ formatSummary: {
79
+ type: Function,
80
+ default: (from, to, total) => total === 0 ? "No items" : `${from}–${to} of ${total}`
81
+ },
82
+ /**
83
+ * Builds each page button's accessible label.
84
+ * @type {(page: number) => string}
85
+ */
86
+ formatPageLabel: {
87
+ type: Function,
88
+ default: (page) => `Page ${page}`
89
+ },
90
+ /**
91
+ * Accessible label of the previous button.
92
+ * @type {string}
93
+ * @default 'Previous page'
94
+ */
95
+ previousLabel: {
96
+ type: String,
97
+ default: "Previous page"
98
+ },
99
+ /**
100
+ * Accessible label of the next button.
101
+ * @type {string}
102
+ * @default 'Next page'
103
+ */
104
+ nextLabel: {
105
+ type: String,
106
+ default: "Next page"
107
+ },
108
+ /**
109
+ * Accessible name of the navigation landmark.
110
+ * @type {string}
111
+ * @default 'Pagination'
112
+ */
113
+ ariaLabel: {
114
+ type: String,
115
+ default: "Pagination"
116
+ }
117
+ },
118
+ emits: ["update:page"],
119
+ setup(__props, { emit: __emit }) {
120
+ /**
121
+ * UiPagination — page controls for a long list, with a "21–40 of 134" summary.
122
+ *
123
+ * Shows the first and last page, the current page and `siblings` pages either
124
+ * side of it, collapsing the rest into gaps, so the control stays the same
125
+ * width however many pages there are. On narrow screens only the current page
126
+ * and the arrows remain.
127
+ *
128
+ * Bind `v-model:page`; the component never fetches anything. All visible text
129
+ * is configurable for localisation.
130
+ *
131
+ * @example
132
+ * <UiPagination v-model:page="page" :page-size="20" :total="134" />
133
+ *
134
+ * @example Localised
135
+ * <UiPagination
136
+ * v-model:page="page"
137
+ * :total="total"
138
+ * previous-label="Anterior"
139
+ * next-label="Siguiente"
140
+ * :format-summary="(from, to, total) => `${from}–${to} de ${total}`"
141
+ * />
142
+ *
143
+ * @emits {number} update:page — The requested page (1-based).
144
+ */
145
+ const props = __props;
146
+ const emit = __emit;
147
+ const pageCount = computed(() => Math.max(1, Math.ceil(Math.max(0, props.total) / Math.max(1, props.pageSize))));
148
+ const current = computed(() => Math.min(Math.max(1, props.page), pageCount.value));
149
+ const summaryText = computed(() => {
150
+ const total = Math.max(0, props.total);
151
+ const from = total === 0 ? 0 : (current.value - 1) * props.pageSize + 1;
152
+ const to = Math.min(total, current.value * props.pageSize);
153
+ return props.formatSummary(from, to, total);
154
+ });
155
+ /** First, last, current ± siblings, with gaps where pages are skipped. */
156
+ const items = computed(() => {
157
+ const last = pageCount.value;
158
+ const start = Math.max(2, current.value - props.siblings);
159
+ const end = Math.min(last - 1, current.value + props.siblings);
160
+ const out = [{
161
+ type: "page",
162
+ page: 1,
163
+ key: "p1"
164
+ }];
165
+ if (start > 2) out.push({
166
+ type: "gap",
167
+ key: "gap-start"
168
+ });
169
+ for (let p = start; p <= end; p++) out.push({
170
+ type: "page",
171
+ page: p,
172
+ key: `p${p}`
173
+ });
174
+ if (end < last - 1) out.push({
175
+ type: "gap",
176
+ key: "gap-end"
177
+ });
178
+ if (last > 1) out.push({
179
+ type: "page",
180
+ page: last,
181
+ key: `p${last}`
182
+ });
183
+ return out;
184
+ });
185
+ function go(page) {
186
+ const next = Math.min(Math.max(1, page), pageCount.value);
187
+ if (next !== current.value) emit("update:page", next);
188
+ }
189
+ const navClass = `${buttonBase} text-gray-600 hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100`;
190
+ const pageClass = (page) => page === current.value ? `${buttonBase} bg-primary-600 text-white dark:bg-primary-500 dark:text-gray-950` : `${buttonBase} text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800`;
191
+ return (_ctx, _cache) => {
192
+ return openBlock(), createElementBlock("nav", {
193
+ "aria-label": __props.ariaLabel,
194
+ class: "flex flex-col items-center justify-between gap-3 sm:flex-row"
195
+ }, [__props.showSummary ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(summaryText.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_3)), pageCount.value > 1 ? (openBlock(), createElementBlock("ul", _hoisted_4, [
196
+ createElementVNode("li", null, [createElementVNode("button", {
197
+ type: "button",
198
+ class: normalizeClass(navClass),
199
+ disabled: current.value <= 1,
200
+ "aria-label": __props.previousLabel,
201
+ onClick: _cache[0] || (_cache[0] = ($event) => go(current.value - 1))
202
+ }, [createVNode(_sfc_main$1, {
203
+ name: "mdi:chevron-left",
204
+ class: "size-4"
205
+ })], 8, _hoisted_5)]),
206
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
207
+ return openBlock(), createElementBlock("li", {
208
+ key: item.key,
209
+ class: normalizeClass(item.page === current.value ? "" : "hidden sm:block")
210
+ }, [item.type === "gap" ? (openBlock(), createElementBlock("span", _hoisted_6, "…")) : (openBlock(), createElementBlock("button", {
211
+ key: 1,
212
+ type: "button",
213
+ class: normalizeClass(pageClass(item.page)),
214
+ "aria-current": item.page === current.value ? "page" : void 0,
215
+ "aria-label": __props.formatPageLabel(item.page),
216
+ onClick: ($event) => go(item.page)
217
+ }, toDisplayString(item.page), 11, _hoisted_7))], 2);
218
+ }), 128)),
219
+ createElementVNode("li", null, [createElementVNode("button", {
220
+ type: "button",
221
+ class: normalizeClass(navClass),
222
+ disabled: current.value >= pageCount.value,
223
+ "aria-label": __props.nextLabel,
224
+ onClick: _cache[1] || (_cache[1] = ($event) => go(current.value + 1))
225
+ }, [createVNode(_sfc_main$1, {
226
+ name: "mdi:chevron-right",
227
+ class: "size-4"
228
+ })], 8, _hoisted_8)])
229
+ ])) : createCommentVNode("", true)], 8, _hoisted_1);
230
+ };
231
+ }
232
+ };
233
+ //#endregion
234
+ export { _sfc_main as default };
235
+
236
+ //# sourceMappingURL=Pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.js","names":[],"sources":["../../src/components/Pagination.vue"],"sourcesContent":["<template>\n <nav :aria-label=\"ariaLabel\" class=\"flex flex-col items-center justify-between gap-3 sm:flex-row\">\n <p v-if=\"showSummary\" class=\"text-sm text-gray-500 tabular-nums dark:text-gray-400\">\n {{ summaryText }}\n </p>\n <span v-else />\n\n <ul v-if=\"pageCount > 1\" class=\"flex items-center gap-1\">\n <li>\n <button\n type=\"button\"\n :class=\"navClass\"\n :disabled=\"current <= 1\"\n :aria-label=\"previousLabel\"\n @click=\"go(current - 1)\"\n >\n <UiIcon name=\"mdi:chevron-left\" class=\"size-4\" />\n </button>\n </li>\n <li\n v-for=\"item in items\"\n :key=\"item.key\"\n :class=\"item.page === current ? '' : 'hidden sm:block'\"\n >\n <span\n v-if=\"item.type === 'gap'\"\n class=\"inline-flex size-9 items-center justify-center text-sm text-gray-400 dark:text-gray-500\"\n aria-hidden=\"true\"\n >…</span\n >\n <button\n v-else\n type=\"button\"\n :class=\"pageClass(item.page)\"\n :aria-current=\"item.page === current ? 'page' : undefined\"\n :aria-label=\"formatPageLabel(item.page)\"\n @click=\"go(item.page)\"\n >\n {{ item.page }}\n </button>\n </li>\n <li>\n <button\n type=\"button\"\n :class=\"navClass\"\n :disabled=\"current >= pageCount\"\n :aria-label=\"nextLabel\"\n @click=\"go(current + 1)\"\n >\n <UiIcon name=\"mdi:chevron-right\" class=\"size-4\" />\n </button>\n </li>\n </ul>\n </nav>\n</template>\n\n<script setup>\n/**\n * UiPagination — page controls for a long list, with a \"21–40 of 134\" summary.\n *\n * Shows the first and last page, the current page and `siblings` pages either\n * side of it, collapsing the rest into gaps, so the control stays the same\n * width however many pages there are. On narrow screens only the current page\n * and the arrows remain.\n *\n * Bind `v-model:page`; the component never fetches anything. All visible text\n * is configurable for localisation.\n *\n * @example\n * <UiPagination v-model:page=\"page\" :page-size=\"20\" :total=\"134\" />\n *\n * @example Localised\n * <UiPagination\n * v-model:page=\"page\"\n * :total=\"total\"\n * previous-label=\"Anterior\"\n * next-label=\"Siguiente\"\n * :format-summary=\"(from, to, total) => `${from}–${to} de ${total}`\"\n * />\n *\n * @emits {number} update:page — The requested page (1-based).\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Current page, 1-based.\n * @type {number}\n * @default 1\n */\n page: { type: Number, default: 1 },\n\n /**\n * Items per page.\n * @type {number}\n * @default 20\n */\n pageSize: { type: Number, default: 20 },\n\n /**\n * Total number of items.\n * @type {number}\n */\n total: { type: Number, required: true },\n\n /**\n * Pages shown either side of the current one.\n * @type {number}\n * @default 1\n */\n siblings: { type: Number, default: 1 },\n\n /**\n * Show the \"from–to of total\" summary.\n * @type {boolean}\n * @default true\n */\n showSummary: { type: Boolean, default: true },\n\n /**\n * Builds the summary text from the 1-based range shown and the total.\n * @type {(from: number, to: number, total: number) => string}\n */\n formatSummary: {\n type: Function,\n default: (from, to, total) => (total === 0 ? 'No items' : `${from}–${to} of ${total}`),\n },\n\n /**\n * Builds each page button's accessible label.\n * @type {(page: number) => string}\n */\n formatPageLabel: { type: Function, default: (page) => `Page ${page}` },\n\n /**\n * Accessible label of the previous button.\n * @type {string}\n * @default 'Previous page'\n */\n previousLabel: { type: String, default: 'Previous page' },\n\n /**\n * Accessible label of the next button.\n * @type {string}\n * @default 'Next page'\n */\n nextLabel: { type: String, default: 'Next page' },\n\n /**\n * Accessible name of the navigation landmark.\n * @type {string}\n * @default 'Pagination'\n */\n ariaLabel: { type: String, default: 'Pagination' },\n})\n\nconst emit = defineEmits(['update:page'])\n\nconst pageCount = computed(() =>\n Math.max(1, Math.ceil(Math.max(0, props.total) / Math.max(1, props.pageSize))),\n)\nconst current = computed(() => Math.min(Math.max(1, props.page), pageCount.value))\n\nconst summaryText = computed(() => {\n const total = Math.max(0, props.total)\n const from = total === 0 ? 0 : (current.value - 1) * props.pageSize + 1\n const to = Math.min(total, current.value * props.pageSize)\n return props.formatSummary(from, to, total)\n})\n\n/** First, last, current ± siblings, with gaps where pages are skipped. */\nconst items = computed(() => {\n const last = pageCount.value\n const start = Math.max(2, current.value - props.siblings)\n const end = Math.min(last - 1, current.value + props.siblings)\n const out = [{ type: 'page', page: 1, key: 'p1' }]\n if (start > 2) out.push({ type: 'gap', key: 'gap-start' })\n for (let p = start; p <= end; p++) out.push({ type: 'page', page: p, key: `p${p}` })\n if (end < last - 1) out.push({ type: 'gap', key: 'gap-end' })\n if (last > 1) out.push({ type: 'page', page: last, key: `p${last}` })\n return out\n})\n\nfunction go(page) {\n const next = Math.min(Math.max(1, page), pageCount.value)\n if (next !== current.value) emit('update:page', next)\n}\n\nconst buttonBase =\n 'inline-flex size-9 items-center justify-center rounded-lg text-sm font-medium tabular-nums transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500'\n\nconst navClass = `${buttonBase} text-gray-600 hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100`\n\nconst pageClass = (page) =>\n page === current.value\n ? `${buttonBase} bg-primary-600 text-white dark:bg-primary-500 dark:text-gray-950`\n : `${buttonBase} text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800`\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6LA,IAAM,aACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AG,KAAK,IAAI;KAEjB,GAAA,gBAAA,KAAK,IAAI,GAAA,IAAA,UAAA,EAAA,GAAA,CAAA;;IAGhB,mBAUK,MAAA,MAAA,CATH,mBAQS,UAAA;KAPP,MAAK;KACJ,OAAK,eAAE,QAAQ;KACf,UAAU,QAAA,SAAW,UAAA;KACrB,cAAY,QAAA;KACZ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,QAAA,QAAO,CAAA;IAElB,GAAA,CAAA,YAAkD,aAAA;KAA1C,MAAK;KAAoB,OAAM"}
@@ -1,7 +1,12 @@
1
1
  import _sfc_main$1 from "../icons/Icon.js";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
2
+ import { useFormField } from "../internal/formField.js";
3
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString, unref } from "vue";
3
4
  //#region src/components/Segmented.vue
4
- var _hoisted_1 = ["aria-label"];
5
+ var _hoisted_1 = [
6
+ "aria-label",
7
+ "aria-labelledby",
8
+ "aria-describedby"
9
+ ];
5
10
  var _hoisted_2 = [
6
11
  "aria-pressed",
7
12
  "disabled",
@@ -146,6 +151,7 @@ var _sfc_main = {
146
151
  */
147
152
  const props = __props;
148
153
  const emit = __emit;
154
+ const field = useFormField();
149
155
  const count = computed(() => props.options?.length || 1);
150
156
  const isActive = (option) => option.value === props.modelValue;
151
157
  const activeIndex = computed(() => {
@@ -184,6 +190,8 @@ var _sfc_main = {
184
190
  return openBlock(), createElementBlock("div", {
185
191
  role: "group",
186
192
  "aria-label": __props.ariaLabel,
193
+ "aria-labelledby": __props.ariaLabel ? void 0 : unref(field)?.labelId,
194
+ "aria-describedby": unref(field)?.describedBy.value,
187
195
  class: normalizeClass(["relative p-1", [
188
196
  __props.block ? "grid w-full" : "inline-grid",
189
197
  radiusClass.value,
@@ -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 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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AA,KAAa;IACxD,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,OAAO,SAAnB,UAAA,GAAA,mBAAmD,QAAA,YAAA,gBAAtB,OAAO,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,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 :aria-labelledby=\"ariaLabel ? undefined : field?.labelId\"\n :aria-describedby=\"field?.describedBy.value\"\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'\nimport { useFormField } from '../internal/formField.js'\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 field = useFormField()\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":";;;;;;;;;;;;;;;;AAyNA,IAAM,gBACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAlHF,MAAM,QAAQ;EA8Dd,MAAM,OAAO;EAEb,MAAM,QAAQ,aAAa;EAE3B,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,W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MAAA,CAAA,IAAA,UAAA,IAAA,GAAA,mBAaS,UAAA,MAAA,WAZU,QAAA,UAAV,WAAM;IADf,OAAA,UAAA,GAAA,mBAaS,UAAA;KAXN,KAAK,OAAO;KACb,MAAK;KACJ,gBAAc,SAAS,MAAM,IAAA,SAAA;KAC7B,UAAU,OAAO;KACjB,OAAO,OAAO,SAAS,KAAA;KACxB,OAAK,eAAA,CAAC,iJAA+I;MAC5I,gBAAA;MAAiB,YAAA;MAAa,SAAS,MAAM,IAAI,gBAAA,QAAkB;KAAa,CAAA,CAAA;KACxF,UAAK,WAAE,OAAO,MAAM;IAEP,GAAA,CAAA,OAAO,QAArB,UAAA,GAAA,YAAwE,aAAA;;KAA5C,MAAM,OAAO;KAAO,OAAK,eAAE,cAAA,KAAa;IACxD,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,OAAO,SAAnB,UAAA,GAAA,mBAAmD,QAAA,YAAA,gBAAtB,OAAO,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA"}
@@ -1,4 +1,5 @@
1
1
  import _sfc_main$1 from "../icons/Icon.js";
2
+ import { useFormField } from "../internal/formField.js";
2
3
  import { MENU_PANEL_CLASS } from "../internal/menu.js";
3
4
  import { Fragment, 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";
4
5
  //#region src/components/Select.vue
@@ -7,7 +8,12 @@ var _hoisted_2 = {
7
8
  key: 0,
8
9
  class: "w-4"
9
10
  };
10
- var _hoisted_3 = ["disabled", "aria-label"];
11
+ var _hoisted_3 = [
12
+ "id",
13
+ "aria-describedby",
14
+ "disabled",
15
+ "aria-label"
16
+ ];
11
17
  var _hoisted_4 = {
12
18
  key: 0,
13
19
  class: "flex items-center gap-2 truncate text-gray-400 dark:text-gray-500"
@@ -178,6 +184,7 @@ var _sfc_main = {
178
184
  */
179
185
  const props = __props;
180
186
  const emit = __emit;
187
+ const field = useFormField();
181
188
  const containerRef = ref(null);
182
189
  const triggerRef = ref(null);
183
190
  const searchRef = ref(null);
@@ -365,9 +372,11 @@ var _sfc_main = {
365
372
  ])]);
366
373
  }), 128))], 2),
367
374
  createElementVNode("button", {
375
+ id: unref(field)?.controlId.value,
368
376
  ref_key: "triggerRef",
369
377
  ref: triggerRef,
370
378
  type: "button",
379
+ "aria-describedby": unref(field)?.describedBy.value,
371
380
  disabled: __props.disabled || __props.loading,
372
381
  "aria-label": __props.ariaLabel,
373
382
  class: normalizeClass([triggerClasses.value, __props.disabled || __props.loading ? "opacity-50 cursor-not-allowed" : ""]),
@@ -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] 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.removeEventListener('click', onDocumentClick, true)\n stopTracking()\n})\n\ndefineExpose({ toggle, close, isOpen })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgLA,MAAM,QAAQ;EAkFd,MAAM,OAAO;EAEb,MAAM,eAAe,IAAI,IAAI;EAC7B,MAAM,aAAa,IAAI,IAAI;EAC3B,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,cAAc,IAAI,EAAE;EAC1B,MAAM,gBAAgB,IAAI,CAAC;EAC3B,MAAM,aAAa,IAAI,CAAC,CAAC;EAKzB,MAAM,mBAAmB;GACvB,MAAM,KAAK,WAAW;GACtB,IAAI,CAAC,IAAI;GACT,MAAM,OAAO,GAAG,sBAAsB;GACtC,MAAM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AI,KAAK,GAAG,IAAI,WAAQ,WAAA,QAAA,CAAA,CAAA;QAC5C,UAAK,WAAE,OAAO,IAAI,KAAK;OAEV,GAAA,CAAA,IAAI,QAAlB,UAAA,GAAA,YAAoE,aAAA;;QAA3C,MAAM,IAAI;QAAM,OAAM;OAC/C,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,mBAOM,OAPN,aAOM,CANJ,mBAA2D,QAA3D,aAA2D,gBAAnB,IAAI,KAAK,GAAA,CAAA,GAEzC,IAAI,YADZ,UAAA,GAAA,mBAIC,QAJD,aAIC,gBADK,IAAI,QAAQ,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,CAAA,GAAA,IAAA,WAAA;;KArEpB,CAAA,GAAA,GAAA,EAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,OAAA,OAAA,KAAM,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 :id=\"field?.controlId.value\"\n ref=\"triggerRef\"\n type=\"button\"\n :aria-describedby=\"field?.describedBy.value\"\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'\nimport { useFormField } from '../internal/formField.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 field = useFormField()\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.removeEventListener('click', onDocumentClick, true)\n stopTracking()\n})\n\ndefineExpose({ toggle, close, isOpen })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmLA,MAAM,QAAQ;EAkFd,MAAM,OAAO;EAEb,MAAM,QAAQ,aAAa;EAE3B,MAAM,eAAe,IAAI,IAAI;EAC7B,MAAM,aAAa,IAAI,IAAI;EAC3B,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,cAAc,IAAI,EAAE;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