numori-ui 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/README.md +36 -34
  3. package/dist/components/AppShell.js +234 -0
  4. package/dist/components/AppShell.js.map +1 -0
  5. package/dist/components/Banner.js +29 -32
  6. package/dist/components/Banner.js.map +1 -1
  7. package/dist/components/Button.js +10 -19
  8. package/dist/components/Button.js.map +1 -1
  9. package/dist/components/Card.js +15 -9
  10. package/dist/components/Card.js.map +1 -1
  11. package/dist/components/Checkbox.js +13 -9
  12. package/dist/components/Checkbox.js.map +1 -1
  13. package/dist/components/CopyField.js +195 -0
  14. package/dist/components/CopyField.js.map +1 -0
  15. package/dist/components/DescriptionList.js +116 -0
  16. package/dist/components/DescriptionList.js.map +1 -0
  17. package/dist/components/Dropdown.js +10 -3
  18. package/dist/components/Dropdown.js.map +1 -1
  19. package/dist/components/DropdownSubmenu.js +5 -3
  20. package/dist/components/DropdownSubmenu.js.map +1 -1
  21. package/dist/components/EmptyState.js +123 -0
  22. package/dist/components/EmptyState.js.map +1 -0
  23. package/dist/components/FileInput.js +12 -4
  24. package/dist/components/FileInput.js.map +1 -1
  25. package/dist/components/FormField.js +43 -13
  26. package/dist/components/FormField.js.map +1 -1
  27. package/dist/components/IconTile.js +5 -9
  28. package/dist/components/IconTile.js.map +1 -1
  29. package/dist/components/Input.js +21 -7
  30. package/dist/components/Input.js.map +1 -1
  31. package/dist/components/ListMenuItem.js +38 -31
  32. package/dist/components/ListMenuItem.js.map +1 -1
  33. package/dist/components/Numpad.js +4 -4
  34. package/dist/components/Numpad.js.map +1 -1
  35. package/dist/components/PageHeader.js +106 -0
  36. package/dist/components/PageHeader.js.map +1 -0
  37. package/dist/components/Pagination.js +236 -0
  38. package/dist/components/Pagination.js.map +1 -0
  39. package/dist/components/Popup.js +9 -3
  40. package/dist/components/Popup.js.map +1 -1
  41. package/dist/components/Radio.js +2 -7
  42. package/dist/components/Radio.js.map +1 -1
  43. package/dist/components/Segmented.js +109 -27
  44. package/dist/components/Segmented.js.map +1 -1
  45. package/dist/components/Select.js +16 -5
  46. package/dist/components/Select.js.map +1 -1
  47. package/dist/components/Sidebar.js +69 -0
  48. package/dist/components/Sidebar.js.map +1 -0
  49. package/dist/components/SidebarGroup.js +50 -0
  50. package/dist/components/SidebarGroup.js.map +1 -0
  51. package/dist/components/SidebarItem.js +167 -0
  52. package/dist/components/SidebarItem.js.map +1 -0
  53. package/dist/components/StatCard.js +185 -0
  54. package/dist/components/StatCard.js.map +1 -0
  55. package/dist/components/Table.js +306 -0
  56. package/dist/components/Table.js.map +1 -0
  57. package/dist/components/Tabs.js +216 -0
  58. package/dist/components/Tabs.js.map +1 -0
  59. package/dist/components/Toggle.js +11 -2
  60. package/dist/components/Toggle.js.map +1 -1
  61. package/dist/components/index.js +91 -76
  62. package/dist/components/index.js.map +1 -1
  63. package/dist/composables/useMergedClasses.js +52 -0
  64. package/dist/composables/useMergedClasses.js.map +1 -0
  65. package/dist/icons/mdi.js +11 -0
  66. package/dist/icons/mdi.js.map +1 -1
  67. package/dist/index.d.ts +13 -3
  68. package/dist/index.js +47 -37
  69. package/dist/index.js.map +1 -1
  70. package/dist/internal/controlSizes.js +21 -0
  71. package/dist/internal/controlSizes.js.map +1 -0
  72. package/dist/internal/formField.js +26 -0
  73. package/dist/internal/formField.js.map +1 -0
  74. package/dist/internal/menu.js +20 -0
  75. package/dist/internal/menu.js.map +1 -0
  76. package/dist/manifest.js +12 -2
  77. package/dist/manifest.js.map +1 -1
  78. package/package.json +2 -1
  79. package/src/components/AppShell.vue +231 -0
  80. package/src/components/Banner.vue +20 -9
  81. package/src/components/Button.vue +12 -19
  82. package/src/components/Card.vue +11 -12
  83. package/src/components/Checkbox.vue +7 -10
  84. package/src/components/CopyField.vue +178 -0
  85. package/src/components/DescriptionList.vue +114 -0
  86. package/src/components/Dropdown.vue +14 -2
  87. package/src/components/DropdownSubmenu.vue +4 -2
  88. package/src/components/EmptyState.vue +107 -0
  89. package/src/components/FileInput.vue +19 -4
  90. package/src/components/FormField.vue +37 -4
  91. package/src/components/IconTile.vue +4 -9
  92. package/src/components/Input.vue +15 -6
  93. package/src/components/ListMenuItem.vue +21 -5
  94. package/src/components/Numpad.vue +7 -4
  95. package/src/components/PageHeader.vue +102 -0
  96. package/src/components/Pagination.vue +199 -0
  97. package/src/components/Popup.vue +6 -2
  98. package/src/components/Radio.vue +2 -10
  99. package/src/components/Segmented.vue +113 -38
  100. package/src/components/Select.vue +16 -2
  101. package/src/components/Sidebar.vue +61 -0
  102. package/src/components/SidebarGroup.vue +43 -0
  103. package/src/components/SidebarItem.vue +159 -0
  104. package/src/components/StatCard.vue +165 -0
  105. package/src/components/Table.vue +323 -0
  106. package/src/components/Tabs.vue +217 -0
  107. package/src/components/Toggle.vue +5 -0
  108. package/src/components/index.js +36 -11
  109. package/src/composables/useMergedClasses.js +49 -0
  110. package/src/icons/mdi.js +11 -0
  111. package/src/internal/controlSizes.js +17 -0
  112. package/src/internal/formField.js +23 -0
  113. package/src/internal/menu.js +16 -0
  114. package/src/manifest.js +12 -2
  115. package/dist/components/ButtonsGroup.js +0 -153
  116. package/dist/components/ButtonsGroup.js.map +0 -1
  117. package/dist/components/ComparisonTable.js +0 -152
  118. package/dist/components/ComparisonTable.js.map +0 -1
  119. package/src/components/ButtonsGroup.vue +0 -140
  120. package/src/components/ComparisonTable.vue +0 -141
@@ -0,0 +1,185 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import _sfc_main$2 from "./Card.js";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, openBlock, renderSlot, toDisplayString, withCtx } from "vue";
4
+ //#region src/components/StatCard.vue
5
+ var _hoisted_1 = { class: "flex items-start justify-between gap-3" };
6
+ var _hoisted_2 = { class: "min-w-0" };
7
+ var _hoisted_3 = { class: "truncate text-sm font-medium text-gray-500 dark:text-gray-400" };
8
+ var _hoisted_4 = { class: "mt-1 text-2xl font-semibold tracking-tight text-gray-900 tabular-nums dark:text-gray-50" };
9
+ var _hoisted_5 = {
10
+ key: 0,
11
+ class: "inline-block h-7 w-16 animate-pulse rounded-md bg-gray-200 align-middle motion-reduce:animate-none dark:bg-gray-800",
12
+ "aria-hidden": "true"
13
+ };
14
+ var _hoisted_6 = {
15
+ key: 0,
16
+ class: "mt-3 flex flex-wrap items-center gap-2 text-xs"
17
+ };
18
+ var _hoisted_7 = {
19
+ key: 1,
20
+ class: "text-gray-500 dark:text-gray-400"
21
+ };
22
+ var _sfc_main = {
23
+ __name: "StatCard",
24
+ props: {
25
+ /**
26
+ * What the number measures.
27
+ * @type {string}
28
+ * @default ''
29
+ */
30
+ label: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ /**
35
+ * The number (or pre-formatted string).
36
+ * @type {string | number}
37
+ * @default ''
38
+ */
39
+ value: {
40
+ type: [String, Number],
41
+ default: ""
42
+ },
43
+ /**
44
+ * Secondary line, such as a time window or a unit.
45
+ * @type {string}
46
+ * @default ''
47
+ */
48
+ hint: {
49
+ type: String,
50
+ default: ""
51
+ },
52
+ /**
53
+ * MDI icon in a tinted tile.
54
+ * @type {string}
55
+ * @default ''
56
+ */
57
+ icon: {
58
+ type: String,
59
+ default: ""
60
+ },
61
+ /**
62
+ * Icon tile tint.
63
+ * @type {string}
64
+ * @default 'primary'
65
+ * @values 'primary' | 'success' | 'warning' | 'error' | 'gray'
66
+ */
67
+ color: {
68
+ type: String,
69
+ default: "primary"
70
+ },
71
+ /**
72
+ * Change to show next to the hint, e.g. `'+12%'`. Empty hides it.
73
+ * @type {string}
74
+ * @default ''
75
+ */
76
+ delta: {
77
+ type: String,
78
+ default: ""
79
+ },
80
+ /**
81
+ * Direction of the change, which picks the arrow.
82
+ * @type {string}
83
+ * @default 'flat'
84
+ * @values 'up' | 'down' | 'flat'
85
+ */
86
+ trend: {
87
+ type: String,
88
+ default: "flat"
89
+ },
90
+ /**
91
+ * Delta colour. `'auto'` makes up green and down red.
92
+ * @type {string}
93
+ * @default 'auto'
94
+ * @values 'auto' | 'green' | 'red' | 'gray'
95
+ */
96
+ deltaColor: {
97
+ type: String,
98
+ default: "auto"
99
+ },
100
+ /**
101
+ * Show a placeholder instead of the value.
102
+ * @type {boolean}
103
+ * @default false
104
+ */
105
+ loading: {
106
+ type: Boolean,
107
+ default: false
108
+ }
109
+ },
110
+ setup(__props) {
111
+ /**
112
+ * UiStatCard — a single headline number for dashboards: label, value, an
113
+ * optional tinted icon, a trend delta and a hint line.
114
+ *
115
+ * Built on `UiCard`, so external classes merge onto the card surface. While
116
+ * `loading`, the value is replaced by a pulsing placeholder of the same height
117
+ * so a grid of cards doesn't jump when data arrives.
118
+ *
119
+ * The delta's colour follows `trend` (up is green, down is red) unless
120
+ * `deltaColor` says otherwise — for metrics where going up is bad, such as
121
+ * error counts, pass `delta-color="red"` with `trend="up"`.
122
+ *
123
+ * @example
124
+ * <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
125
+ * <UiStatCard label="Connections" :value="128" icon="mdi:lan-connect" />
126
+ * <UiStatCard label="Documents" value="4,210" icon="mdi:file-document-outline" color="success" />
127
+ * <UiStatCard label="Access denials" :value="3" trend="up" delta="+2" delta-color="red" hint="last hour" />
128
+ * </div>
129
+ *
130
+ * @slot value — Rich value content (overrides `value`).
131
+ * @slot default — Extra content in the footer line.
132
+ */
133
+ const props = __props;
134
+ const toneClass = computed(() => ({
135
+ primary: "bg-primary-50 text-primary-600 dark:bg-primary-400/10 dark:text-primary-300",
136
+ success: "bg-success-50 text-success-700 dark:bg-success-400/10 dark:text-success-300",
137
+ warning: "bg-warning-50 text-warning-700 dark:bg-warning-400/10 dark:text-warning-300",
138
+ error: "bg-red-50 text-red-600 dark:bg-red-400/10 dark:text-red-300",
139
+ gray: "bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"
140
+ })[props.color] ?? "bg-primary-50 text-primary-600 dark:bg-primary-400/10 dark:text-primary-300");
141
+ const trendIcon = computed(() => ({
142
+ up: "mdi:trending-up",
143
+ down: "mdi:trending-down"
144
+ })[props.trend] ?? "mdi:trending-neutral");
145
+ const deltaClass = computed(() => {
146
+ return {
147
+ green: "text-success-700 dark:text-success-400",
148
+ red: "text-red-600 dark:text-red-400"
149
+ }[props.deltaColor === "auto" ? {
150
+ up: "green",
151
+ down: "red"
152
+ }[props.trend] || "gray" : props.deltaColor] ?? "text-gray-500 dark:text-gray-400";
153
+ });
154
+ return (_ctx, _cache) => {
155
+ return openBlock(), createBlock(_sfc_main$2, {
156
+ padding: "sm",
157
+ "aria-busy": __props.loading ? "true" : void 0
158
+ }, {
159
+ default: withCtx(() => [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("p", _hoisted_3, toDisplayString(__props.label), 1), createElementVNode("p", _hoisted_4, [__props.loading ? (openBlock(), createElementBlock("span", _hoisted_5)) : renderSlot(_ctx.$slots, "value", {}, () => [createTextVNode(toDisplayString(__props.value), 1)], void 0, 1)])]), __props.icon ? (openBlock(), createElementBlock("span", {
160
+ key: 0,
161
+ class: normalizeClass(["inline-flex size-9 shrink-0 items-center justify-center rounded-xl", toneClass.value]),
162
+ "aria-hidden": "true"
163
+ }, [createVNode(_sfc_main$1, {
164
+ name: __props.icon,
165
+ class: "size-5"
166
+ }, null, 8, ["name"])], 2)) : createCommentVNode("", true)]), __props.hint || __props.delta || _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_6, [
167
+ __props.delta ? (openBlock(), createElementBlock("span", {
168
+ key: 0,
169
+ class: normalizeClass(["inline-flex items-center gap-1 font-medium", deltaClass.value])
170
+ }, [createVNode(_sfc_main$1, {
171
+ name: trendIcon.value,
172
+ class: "size-3.5"
173
+ }, null, 8, ["name"]), createTextVNode(" " + toDisplayString(__props.delta), 1)], 2)) : createCommentVNode("", true),
174
+ __props.hint ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(__props.hint), 1)) : createCommentVNode("", true),
175
+ renderSlot(_ctx.$slots, "default")
176
+ ])) : createCommentVNode("", true)]),
177
+ _: 3
178
+ }, 8, ["aria-busy"]);
179
+ };
180
+ }
181
+ };
182
+ //#endregion
183
+ export { _sfc_main as default };
184
+
185
+ //# sourceMappingURL=StatCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatCard.js","names":["$slots"],"sources":["../../src/components/StatCard.vue"],"sourcesContent":["<template>\n <UiCard padding=\"sm\" :aria-busy=\"loading ? 'true' : undefined\">\n <div class=\"flex items-start justify-between gap-3\">\n <div class=\"min-w-0\">\n <p class=\"truncate text-sm font-medium text-gray-500 dark:text-gray-400\">{{ label }}</p>\n <p\n class=\"mt-1 text-2xl font-semibold tracking-tight text-gray-900 tabular-nums dark:text-gray-50\"\n >\n <span\n v-if=\"loading\"\n class=\"inline-block h-7 w-16 animate-pulse rounded-md bg-gray-200 align-middle motion-reduce:animate-none dark:bg-gray-800\"\n aria-hidden=\"true\"\n />\n <slot v-else name=\"value\">{{ value }}</slot>\n </p>\n </div>\n <span\n v-if=\"icon\"\n class=\"inline-flex size-9 shrink-0 items-center justify-center rounded-xl\"\n :class=\"toneClass\"\n aria-hidden=\"true\"\n >\n <UiIcon :name=\"icon\" class=\"size-5\" />\n </span>\n </div>\n\n <div\n v-if=\"hint || delta || $slots.default\"\n class=\"mt-3 flex flex-wrap items-center gap-2 text-xs\"\n >\n <span v-if=\"delta\" class=\"inline-flex items-center gap-1 font-medium\" :class=\"deltaClass\">\n <UiIcon :name=\"trendIcon\" class=\"size-3.5\" />\n {{ delta }}\n </span>\n <span v-if=\"hint\" class=\"text-gray-500 dark:text-gray-400\">{{ hint }}</span>\n <slot />\n </div>\n </UiCard>\n</template>\n\n<script setup>\n/**\n * UiStatCard — a single headline number for dashboards: label, value, an\n * optional tinted icon, a trend delta and a hint line.\n *\n * Built on `UiCard`, so external classes merge onto the card surface. While\n * `loading`, the value is replaced by a pulsing placeholder of the same height\n * so a grid of cards doesn't jump when data arrives.\n *\n * The delta's colour follows `trend` (up is green, down is red) unless\n * `deltaColor` says otherwise — for metrics where going up is bad, such as\n * error counts, pass `delta-color=\"red\"` with `trend=\"up\"`.\n *\n * @example\n * <div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n * <UiStatCard label=\"Connections\" :value=\"128\" icon=\"mdi:lan-connect\" />\n * <UiStatCard label=\"Documents\" value=\"4,210\" icon=\"mdi:file-document-outline\" color=\"success\" />\n * <UiStatCard label=\"Access denials\" :value=\"3\" trend=\"up\" delta=\"+2\" delta-color=\"red\" hint=\"last hour\" />\n * </div>\n *\n * @slot value — Rich value content (overrides `value`).\n * @slot default — Extra content in the footer line.\n */\nimport { computed } from 'vue'\nimport UiCard from './Card.vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * What the number measures.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * The number (or pre-formatted string).\n * @type {string | number}\n * @default ''\n */\n value: { type: [String, Number], default: '' },\n\n /**\n * Secondary line, such as a time window or a unit.\n * @type {string}\n * @default ''\n */\n hint: { type: String, default: '' },\n\n /**\n * MDI icon in a tinted tile.\n * @type {string}\n * @default ''\n */\n icon: { type: String, default: '' },\n\n /**\n * Icon tile tint.\n * @type {string}\n * @default 'primary'\n * @values 'primary' | 'success' | 'warning' | 'error' | 'gray'\n */\n color: { type: String, default: 'primary' },\n\n /**\n * Change to show next to the hint, e.g. `'+12%'`. Empty hides it.\n * @type {string}\n * @default ''\n */\n delta: { type: String, default: '' },\n\n /**\n * Direction of the change, which picks the arrow.\n * @type {string}\n * @default 'flat'\n * @values 'up' | 'down' | 'flat'\n */\n trend: { type: String, default: 'flat' },\n\n /**\n * Delta colour. `'auto'` makes up green and down red.\n * @type {string}\n * @default 'auto'\n * @values 'auto' | 'green' | 'red' | 'gray'\n */\n deltaColor: { type: String, default: 'auto' },\n\n /**\n * Show a placeholder instead of the value.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n})\n\nconst toneClass = computed(\n () =>\n ({\n primary: 'bg-primary-50 text-primary-600 dark:bg-primary-400/10 dark:text-primary-300',\n success: 'bg-success-50 text-success-700 dark:bg-success-400/10 dark:text-success-300',\n warning: 'bg-warning-50 text-warning-700 dark:bg-warning-400/10 dark:text-warning-300',\n error: 'bg-red-50 text-red-600 dark:bg-red-400/10 dark:text-red-300',\n gray: 'bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400',\n })[props.color] ??\n 'bg-primary-50 text-primary-600 dark:bg-primary-400/10 dark:text-primary-300',\n)\n\nconst trendIcon = computed(\n () =>\n ({ up: 'mdi:trending-up', down: 'mdi:trending-down' })[props.trend] ?? 'mdi:trending-neutral',\n)\n\nconst deltaClass = computed(() => {\n const tone =\n props.deltaColor === 'auto'\n ? { up: 'green', down: 'red' }[props.trend] || 'gray'\n : props.deltaColor\n return (\n {\n green: 'text-success-700 dark:text-success-400',\n red: 'text-red-600 dark:text-red-400',\n }[tone] ?? 'text-gray-500 dark:text-gray-400'\n )\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEA,MAAM,QAAQ;EAoEd,MAAM,YAAY,gBAEb;GACC,SAAS;GACT,SAAS;GACT,SAAS;GACT,OAAO;GACP,MAAM;EACR,EAAA,CAAG,MAAM,UACT,6EACJ;EAEA,MAAM,YAAY,gBAEb;GAAE,IAAI;GAAmB,MAAM;EAAoB,EAAA,CAAG,MAAM,UAAU,sBAC3E;EAEA,MAAM,aAAa,eAAe;GAKhC,OACE;IACE,OAAO;IACP,KAAK;GACP,EAPA,MAAM,eAAe,SACjB;IAAE,IAAI;IAAS,MAAM;GAAM,EAAE,MAAM,UAAU,SAC7C,MAAM,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AA,SAAA"}
@@ -0,0 +1,306 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, withKeys } from "vue";
3
+ //#region src/components/Table.vue
4
+ var _hoisted_1 = ["aria-busy"];
5
+ var _hoisted_2 = { class: "w-full border-collapse text-sm" };
6
+ var _hoisted_3 = { class: "border-b border-gray-200 dark:border-gray-700" };
7
+ var _hoisted_4 = ["aria-sort"];
8
+ var _hoisted_5 = ["onClick"];
9
+ var _hoisted_6 = { key: 0 };
10
+ var _hoisted_7 = ["colspan"];
11
+ var _hoisted_8 = [
12
+ "tabindex",
13
+ "onClick",
14
+ "onKeydown"
15
+ ];
16
+ var _hoisted_9 = { key: 1 };
17
+ var _hoisted_10 = ["colspan"];
18
+ var _hoisted_11 = { class: "sr-only" };
19
+ var _hoisted_12 = {
20
+ key: 0,
21
+ class: "absolute inset-0 flex items-center justify-center bg-white/60 dark:bg-gray-950/50"
22
+ };
23
+ var _hoisted_13 = { class: "sr-only" };
24
+ var _sfc_main = {
25
+ __name: "Table",
26
+ props: {
27
+ /**
28
+ * Column definitions, left to right. Each is
29
+ * `{ key, label?, align?, header?, highlight?, icon?, width?, sortable? }`:
30
+ * - `key` — the row field this column reads.
31
+ * - `label` — the column heading.
32
+ * - `align` — `'left'` (default) | `'center'` | `'right'`.
33
+ * - `header` — render this column's cells as row headers (`<th scope="row">`).
34
+ * - `highlight` — accent-tint the column (the featured column in a comparison).
35
+ * - `icon` — MDI icon shown before each value in the column.
36
+ * - `width` — optional width utility class, e.g. `'w-2/5'`.
37
+ * - `sortable` — make the heading a sort button.
38
+ * @type {Array<{ key: string, label?: string, align?: string, header?: boolean, highlight?: boolean, icon?: string, width?: string, sortable?: boolean }>}
39
+ */
40
+ columns: {
41
+ type: Array,
42
+ required: true
43
+ },
44
+ /**
45
+ * Row objects, each keyed by the column `key`s.
46
+ * @type {Array<Record<string, unknown>>}
47
+ */
48
+ rows: {
49
+ type: Array,
50
+ required: true
51
+ },
52
+ /**
53
+ * Table caption. Rendered as a real `<caption>` for accessibility; visible by
54
+ * default, or visually hidden with `hideCaption`.
55
+ * @type {string}
56
+ * @default ''
57
+ */
58
+ caption: {
59
+ type: String,
60
+ default: ""
61
+ },
62
+ /**
63
+ * Keep the caption for assistive technology but hide it visually.
64
+ * @type {boolean}
65
+ * @default false
66
+ */
67
+ hideCaption: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ /**
72
+ * Row field used as the `v-for` key; falls back to the row index.
73
+ * @type {string}
74
+ * @default 'key'
75
+ */
76
+ rowKey: {
77
+ type: String,
78
+ default: "key"
79
+ },
80
+ /**
81
+ * Key of the currently sorted column.
82
+ * @type {string}
83
+ * @default ''
84
+ */
85
+ sortKey: {
86
+ type: String,
87
+ default: ""
88
+ },
89
+ /**
90
+ * Direction of the current sort.
91
+ * @type {string}
92
+ * @default 'asc'
93
+ * @values 'asc' | 'desc'
94
+ */
95
+ sortDirection: {
96
+ type: String,
97
+ default: "asc"
98
+ },
99
+ /**
100
+ * Show a loading state.
101
+ * @type {boolean}
102
+ * @default false
103
+ */
104
+ loading: {
105
+ type: Boolean,
106
+ default: false
107
+ },
108
+ /**
109
+ * Text for screen readers while loading.
110
+ * @type {string}
111
+ * @default 'Loading'
112
+ */
113
+ loadingText: {
114
+ type: String,
115
+ default: "Loading"
116
+ },
117
+ /**
118
+ * Shown when `rows` is empty.
119
+ * @type {string}
120
+ * @default 'Nothing to show'
121
+ */
122
+ emptyText: {
123
+ type: String,
124
+ default: "Nothing to show"
125
+ },
126
+ /**
127
+ * Make rows focusable and emit `row-click` on click or Enter.
128
+ * @type {boolean}
129
+ * @default false
130
+ */
131
+ clickableRows: {
132
+ type: Boolean,
133
+ default: false
134
+ }
135
+ },
136
+ emits: ["sort", "row-click"],
137
+ setup(__props, { emit: __emit }) {
138
+ /**
139
+ * UiTable — a data table with sensible defaults, sortable columns, empty and
140
+ * loading states, and a built-in comparison mode.
141
+ *
142
+ * Drive it with `columns` and `rows`: each column names a `key`, and each row
143
+ * is an object keyed by those column keys. It renders a real, accessible
144
+ * `<table>` (`<caption>`, `scope="col"` headers) that scrolls horizontally on
145
+ * narrow screens rather than crushing its columns.
146
+ *
147
+ * **Sorting** is controlled: mark columns `sortable`, pass the current
148
+ * `sort-key` / `sort-direction`, and handle the `sort` event — the table does
149
+ * not reorder rows itself, so server-side and client-side sorting work the
150
+ * same way. Sorted headers carry `aria-sort`.
151
+ *
152
+ * **Empty and loading.** With no rows, `emptyText` (or the `#empty` slot) is
153
+ * shown. `loading` shows a spinner in place of the rows, or dims the existing
154
+ * rows while they refresh.
155
+ *
156
+ * **Comparison** is just a configuration, not a separate component: mark the
157
+ * label column `header: true` (so it renders as a `<th scope="row">`), give the
158
+ * column you want to feature `highlight: true` (accent tint), and hand each
159
+ * value column an `icon` (e.g. a tick for the highlighted column, a dash for
160
+ * the others). For full control of a cell, use the `#cell` scoped slot.
161
+ *
162
+ * @example A plain data table
163
+ * <UiTable
164
+ * caption="Team"
165
+ * :columns="[
166
+ * { key: 'name', label: 'Name' },
167
+ * { key: 'role', label: 'Role' },
168
+ * { key: 'commits', label: 'Commits', align: 'right' },
169
+ * ]"
170
+ * :rows="[
171
+ * { name: 'Ada Lovelace', role: 'Engineer', commits: 128 },
172
+ * { name: 'Grace Hopper', role: 'Lead', commits: 342 },
173
+ * ]"
174
+ * />
175
+ *
176
+ * @example Sortable, clickable rows
177
+ * <UiTable
178
+ * :columns="[{ key: 'id', label: 'Id', sortable: true }, { key: 'size', label: 'Size', align: 'right', sortable: true }]"
179
+ * :rows="docs"
180
+ * :sort-key="sort.key"
181
+ * :sort-direction="sort.direction"
182
+ * :loading="pending"
183
+ * empty-text="No documents stored yet"
184
+ * clickable-rows
185
+ * @sort="sort = $event"
186
+ * @row-click="open($event)"
187
+ * />
188
+ *
189
+ * @example A comparison table
190
+ * <UiTable
191
+ * caption="How Numori compares"
192
+ * :columns="[
193
+ * { key: 'feature', label: 'Feature', header: true },
194
+ * { key: 'numori', label: 'Numori', highlight: true, icon: 'mdi:check-circle' },
195
+ * { key: 'usual', label: 'The usual', icon: 'mdi:minus-circle-outline' },
196
+ * ]"
197
+ * :rows="[
198
+ * { feature: 'Open source', numori: 'Entire ecosystem', usual: 'The client, sometimes' },
199
+ * ]"
200
+ * />
201
+ *
202
+ * @emits {{ key: string, direction: 'asc' | 'desc' }} sort — A sortable header was clicked.
203
+ * @emits {object} row-click — A row was clicked or activated with Enter (`clickableRows`).
204
+ *
205
+ * @slot caption — Rich caption content (overrides the `caption` prop).
206
+ * @slot cell — Custom cell content. Scope: `{ row, column, value }`.
207
+ * @slot empty — Content shown when there are no rows.
208
+ */
209
+ const props = __props;
210
+ const emit = __emit;
211
+ const alignClass = (align) => align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left";
212
+ const ariaSort = (col) => props.sortKey === col.key ? props.sortDirection === "desc" ? "descending" : "ascending" : "none";
213
+ const sortIcon = (col) => props.sortKey !== col.key ? "mdi:unfold-more-horizontal" : props.sortDirection === "desc" ? "mdi:arrow-down" : "mdi:arrow-up";
214
+ function toggleSort(col) {
215
+ const direction = props.sortKey === col.key && props.sortDirection === "asc" ? "desc" : "asc";
216
+ emit("sort", {
217
+ key: col.key,
218
+ direction
219
+ });
220
+ }
221
+ return (_ctx, _cache) => {
222
+ return openBlock(), createElementBlock("div", {
223
+ class: "relative overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700",
224
+ "aria-busy": __props.loading ? "true" : void 0
225
+ }, [createElementVNode("table", _hoisted_2, [
226
+ __props.caption || _ctx.$slots.caption ? (openBlock(), createElementBlock("caption", {
227
+ key: 0,
228
+ class: normalizeClass(__props.hideCaption ? "sr-only" : "caption-top px-5 py-4 text-left text-sm font-semibold text-gray-900 dark:text-gray-100")
229
+ }, [renderSlot(_ctx.$slots, "caption", {}, () => [createTextVNode(toDisplayString(__props.caption), 1)])], 2)) : createCommentVNode("", true),
230
+ createElementVNode("thead", null, [createElementVNode("tr", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (col) => {
231
+ return openBlock(), createElementBlock("th", {
232
+ key: col.key,
233
+ scope: "col",
234
+ class: normalizeClass(["px-5 py-4 font-semibold", [
235
+ alignClass(col.align),
236
+ col.highlight ? "bg-primary-50 text-primary-800 dark:bg-primary-400/10 dark:text-primary-200" : "text-gray-600 dark:text-gray-300",
237
+ col.width
238
+ ]]),
239
+ "aria-sort": col.sortable ? ariaSort(col) : void 0
240
+ }, [col.sortable ? (openBlock(), createElementBlock("button", {
241
+ key: 0,
242
+ type: "button",
243
+ class: normalizeClass(["group inline-flex items-center gap-1 rounded hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:hover:text-gray-100", col.align === "right" ? "flex-row-reverse" : ""]),
244
+ onClick: ($event) => toggleSort(col)
245
+ }, [createElementVNode("span", null, toDisplayString(col.label), 1), createVNode(_sfc_main$1, {
246
+ name: sortIcon(col),
247
+ class: normalizeClass(["size-3.5 shrink-0", __props.sortKey === col.key ? "text-gray-700 dark:text-gray-200" : "text-gray-300 group-hover:text-gray-500 dark:text-gray-600 dark:group-hover:text-gray-400"])
248
+ }, null, 8, ["name", "class"])], 10, _hoisted_5)) : col.label ? (openBlock(), createElementBlock("span", {
249
+ key: 1,
250
+ class: normalizeClass(col.header && !col.label ? "sr-only" : "")
251
+ }, toDisplayString(col.label), 3)) : createCommentVNode("", true)], 10, _hoisted_4);
252
+ }), 128))])]),
253
+ createElementVNode("tbody", null, [
254
+ __props.rows.length === 0 && !__props.loading ? (openBlock(), createElementBlock("tr", _hoisted_6, [createElementVNode("td", {
255
+ colspan: __props.columns.length,
256
+ class: "px-5 py-10 text-center text-gray-500 dark:text-gray-400"
257
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText), 1)])], 8, _hoisted_7)])) : createCommentVNode("", true),
258
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row, index) => {
259
+ return openBlock(), createElementBlock("tr", {
260
+ key: row[__props.rowKey] ?? index,
261
+ class: normalizeClass(["border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60", __props.clickableRows ? "cursor-pointer focus-visible:bg-gray-50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary-500 dark:focus-visible:bg-gray-900/60" : ""]),
262
+ tabindex: __props.clickableRows ? 0 : void 0,
263
+ onClick: ($event) => __props.clickableRows && emit("row-click", row),
264
+ onKeydown: withKeys(($event) => __props.clickableRows && emit("row-click", row), ["enter"])
265
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (col) => {
266
+ return openBlock(), createElementBlock(Fragment, { key: col.key }, [col.header ? (openBlock(), createElementBlock("th", {
267
+ key: 0,
268
+ scope: "row",
269
+ class: normalizeClass(["px-5 py-4 font-medium text-gray-900 dark:text-gray-100", alignClass(col.align)])
270
+ }, [renderSlot(_ctx.$slots, "cell", {
271
+ row,
272
+ column: col,
273
+ value: row[col.key]
274
+ }, () => [createTextVNode(toDisplayString(row[col.key]), 1)])], 2)) : (openBlock(), createElementBlock("td", {
275
+ key: 1,
276
+ class: normalizeClass(["px-5 py-4", [alignClass(col.align), col.highlight ? "bg-primary-50/50 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200" : "text-gray-600 dark:text-gray-400"]])
277
+ }, [renderSlot(_ctx.$slots, "cell", {
278
+ row,
279
+ column: col,
280
+ value: row[col.key]
281
+ }, () => [createElementVNode("span", { class: normalizeClass(col.icon ? "flex items-start gap-2" : "") }, [col.icon ? (openBlock(), createBlock(_sfc_main$1, {
282
+ key: 0,
283
+ name: col.icon,
284
+ class: normalizeClass(["mt-0.5 size-4 shrink-0", col.highlight ? "text-success-600 dark:text-success-400" : "text-gray-400 dark:text-gray-500"])
285
+ }, null, 8, ["name", "class"])) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(row[col.key]), 1)], 2)])], 2))], 64);
286
+ }), 128))], 42, _hoisted_8);
287
+ }), 128)),
288
+ __props.loading && __props.rows.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_9, [createElementVNode("td", {
289
+ colspan: __props.columns.length,
290
+ class: "px-5 py-10 text-center"
291
+ }, [createVNode(_sfc_main$1, {
292
+ name: "mdi:loading",
293
+ class: "inline size-5 animate-spin text-gray-400"
294
+ }), createElementVNode("span", _hoisted_11, toDisplayString(__props.loadingText), 1)], 8, _hoisted_10)])) : createCommentVNode("", true)
295
+ ])
296
+ ]), __props.loading && __props.rows.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12, [createVNode(_sfc_main$1, {
297
+ name: "mdi:loading",
298
+ class: "size-5 animate-spin text-gray-500"
299
+ }), createElementVNode("span", _hoisted_13, toDisplayString(__props.loadingText), 1)])) : createCommentVNode("", true)], 8, _hoisted_1);
300
+ };
301
+ }
302
+ };
303
+ //#endregion
304
+ export { _sfc_main as default };
305
+
306
+ //# sourceMappingURL=Table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.js","names":["$slots"],"sources":["../../src/components/Table.vue"],"sourcesContent":["<template>\n <div\n class=\"relative overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700\"\n :aria-busy=\"loading ? 'true' : undefined\"\n >\n <table class=\"w-full border-collapse text-sm\">\n <caption\n v-if=\"caption || $slots.caption\"\n :class=\"\n hideCaption\n ? 'sr-only'\n : 'caption-top px-5 py-4 text-left text-sm font-semibold text-gray-900 dark:text-gray-100'\n \"\n >\n <slot name=\"caption\">{{ caption }}</slot>\n </caption>\n\n <thead>\n <tr class=\"border-b border-gray-200 dark:border-gray-700\">\n <th\n v-for=\"col in columns\"\n :key=\"col.key\"\n scope=\"col\"\n class=\"px-5 py-4 font-semibold\"\n :class=\"[\n alignClass(col.align),\n col.highlight\n ? 'bg-primary-50 text-primary-800 dark:bg-primary-400/10 dark:text-primary-200'\n : 'text-gray-600 dark:text-gray-300',\n col.width,\n ]\"\n :aria-sort=\"col.sortable ? ariaSort(col) : undefined\"\n >\n <button\n v-if=\"col.sortable\"\n type=\"button\"\n class=\"group inline-flex items-center gap-1 rounded hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:hover:text-gray-100\"\n :class=\"col.align === 'right' ? 'flex-row-reverse' : ''\"\n @click=\"toggleSort(col)\"\n >\n <span>{{ col.label }}</span>\n <UiIcon\n :name=\"sortIcon(col)\"\n class=\"size-3.5 shrink-0\"\n :class=\"\n sortKey === col.key\n ? 'text-gray-700 dark:text-gray-200'\n : 'text-gray-300 group-hover:text-gray-500 dark:text-gray-600 dark:group-hover:text-gray-400'\n \"\n />\n </button>\n <span v-else-if=\"col.label\" :class=\"col.header && !col.label ? 'sr-only' : ''\">{{\n col.label\n }}</span>\n </th>\n </tr>\n </thead>\n\n <tbody>\n <tr v-if=\"rows.length === 0 && !loading\">\n <td\n :colspan=\"columns.length\"\n class=\"px-5 py-10 text-center text-gray-500 dark:text-gray-400\"\n >\n <slot name=\"empty\">{{ emptyText }}</slot>\n </td>\n </tr>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"row[rowKey] ?? index\"\n class=\"border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60\"\n :class=\"\n clickableRows\n ? 'cursor-pointer focus-visible:bg-gray-50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary-500 dark:focus-visible:bg-gray-900/60'\n : ''\n \"\n :tabindex=\"clickableRows ? 0 : undefined\"\n @click=\"clickableRows && emit('row-click', row)\"\n @keydown.enter=\"clickableRows && emit('row-click', row)\"\n >\n <template v-for=\"col in columns\" :key=\"col.key\">\n <!-- Header columns render as row headers (<th scope=\"row\">), e.g. the\n feature column of a comparison table. -->\n <th\n v-if=\"col.header\"\n scope=\"row\"\n class=\"px-5 py-4 font-medium text-gray-900 dark:text-gray-100\"\n :class=\"alignClass(col.align)\"\n >\n <slot name=\"cell\" :row=\"row\" :column=\"col\" :value=\"row[col.key]\">\n {{ row[col.key] }}\n </slot>\n </th>\n <td\n v-else\n class=\"px-5 py-4\"\n :class=\"[\n alignClass(col.align),\n col.highlight\n ? 'bg-primary-50/50 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200'\n : 'text-gray-600 dark:text-gray-400',\n ]\"\n >\n <slot name=\"cell\" :row=\"row\" :column=\"col\" :value=\"row[col.key]\">\n <span :class=\"col.icon ? 'flex items-start gap-2' : ''\">\n <UiIcon\n v-if=\"col.icon\"\n :name=\"col.icon\"\n class=\"mt-0.5 size-4 shrink-0\"\n :class=\"\n col.highlight\n ? 'text-success-600 dark:text-success-400'\n : 'text-gray-400 dark:text-gray-500'\n \"\n />\n {{ row[col.key] }}\n </span>\n </slot>\n </td>\n </template>\n </tr>\n <tr v-if=\"loading && rows.length === 0\">\n <td :colspan=\"columns.length\" class=\"px-5 py-10 text-center\">\n <UiIcon name=\"mdi:loading\" class=\"inline size-5 animate-spin text-gray-400\" />\n <span class=\"sr-only\">{{ loadingText }}</span>\n </td>\n </tr>\n </tbody>\n </table>\n\n <!-- Refreshing existing rows: dim them rather than replacing them. -->\n <div\n v-if=\"loading && rows.length > 0\"\n class=\"absolute inset-0 flex items-center justify-center bg-white/60 dark:bg-gray-950/50\"\n >\n <UiIcon name=\"mdi:loading\" class=\"size-5 animate-spin text-gray-500\" />\n <span class=\"sr-only\">{{ loadingText }}</span>\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiTable — a data table with sensible defaults, sortable columns, empty and\n * loading states, and a built-in comparison mode.\n *\n * Drive it with `columns` and `rows`: each column names a `key`, and each row\n * is an object keyed by those column keys. It renders a real, accessible\n * `<table>` (`<caption>`, `scope=\"col\"` headers) that scrolls horizontally on\n * narrow screens rather than crushing its columns.\n *\n * **Sorting** is controlled: mark columns `sortable`, pass the current\n * `sort-key` / `sort-direction`, and handle the `sort` event — the table does\n * not reorder rows itself, so server-side and client-side sorting work the\n * same way. Sorted headers carry `aria-sort`.\n *\n * **Empty and loading.** With no rows, `emptyText` (or the `#empty` slot) is\n * shown. `loading` shows a spinner in place of the rows, or dims the existing\n * rows while they refresh.\n *\n * **Comparison** is just a configuration, not a separate component: mark the\n * label column `header: true` (so it renders as a `<th scope=\"row\">`), give the\n * column you want to feature `highlight: true` (accent tint), and hand each\n * value column an `icon` (e.g. a tick for the highlighted column, a dash for\n * the others). For full control of a cell, use the `#cell` scoped slot.\n *\n * @example A plain data table\n * <UiTable\n * caption=\"Team\"\n * :columns=\"[\n * { key: 'name', label: 'Name' },\n * { key: 'role', label: 'Role' },\n * { key: 'commits', label: 'Commits', align: 'right' },\n * ]\"\n * :rows=\"[\n * { name: 'Ada Lovelace', role: 'Engineer', commits: 128 },\n * { name: 'Grace Hopper', role: 'Lead', commits: 342 },\n * ]\"\n * />\n *\n * @example Sortable, clickable rows\n * <UiTable\n * :columns=\"[{ key: 'id', label: 'Id', sortable: true }, { key: 'size', label: 'Size', align: 'right', sortable: true }]\"\n * :rows=\"docs\"\n * :sort-key=\"sort.key\"\n * :sort-direction=\"sort.direction\"\n * :loading=\"pending\"\n * empty-text=\"No documents stored yet\"\n * clickable-rows\n * @sort=\"sort = $event\"\n * @row-click=\"open($event)\"\n * />\n *\n * @example A comparison table\n * <UiTable\n * caption=\"How Numori compares\"\n * :columns=\"[\n * { key: 'feature', label: 'Feature', header: true },\n * { key: 'numori', label: 'Numori', highlight: true, icon: 'mdi:check-circle' },\n * { key: 'usual', label: 'The usual', icon: 'mdi:minus-circle-outline' },\n * ]\"\n * :rows=\"[\n * { feature: 'Open source', numori: 'Entire ecosystem', usual: 'The client, sometimes' },\n * ]\"\n * />\n *\n * @emits {{ key: string, direction: 'asc' | 'desc' }} sort — A sortable header was clicked.\n * @emits {object} row-click — A row was clicked or activated with Enter (`clickableRows`).\n *\n * @slot caption — Rich caption content (overrides the `caption` prop).\n * @slot cell — Custom cell content. Scope: `{ row, column, value }`.\n * @slot empty — Content shown when there are no rows.\n */\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Column definitions, left to right. Each is\n * `{ key, label?, align?, header?, highlight?, icon?, width?, sortable? }`:\n * - `key` — the row field this column reads.\n * - `label` — the column heading.\n * - `align` — `'left'` (default) | `'center'` | `'right'`.\n * - `header` — render this column's cells as row headers (`<th scope=\"row\">`).\n * - `highlight` — accent-tint the column (the featured column in a comparison).\n * - `icon` — MDI icon shown before each value in the column.\n * - `width` — optional width utility class, e.g. `'w-2/5'`.\n * - `sortable` — make the heading a sort button.\n * @type {Array<{ key: string, label?: string, align?: string, header?: boolean, highlight?: boolean, icon?: string, width?: string, sortable?: boolean }>}\n */\n columns: { type: Array, required: true },\n\n /**\n * Row objects, each keyed by the column `key`s.\n * @type {Array<Record<string, unknown>>}\n */\n rows: { type: Array, required: true },\n\n /**\n * Table caption. Rendered as a real `<caption>` for accessibility; visible by\n * default, or visually hidden with `hideCaption`.\n * @type {string}\n * @default ''\n */\n caption: { type: String, default: '' },\n\n /**\n * Keep the caption for assistive technology but hide it visually.\n * @type {boolean}\n * @default false\n */\n hideCaption: { type: Boolean, default: false },\n\n /**\n * Row field used as the `v-for` key; falls back to the row index.\n * @type {string}\n * @default 'key'\n */\n rowKey: { type: String, default: 'key' },\n\n /**\n * Key of the currently sorted column.\n * @type {string}\n * @default ''\n */\n sortKey: { type: String, default: '' },\n\n /**\n * Direction of the current sort.\n * @type {string}\n * @default 'asc'\n * @values 'asc' | 'desc'\n */\n sortDirection: { type: String, default: 'asc' },\n\n /**\n * Show a loading state.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n\n /**\n * Text for screen readers while loading.\n * @type {string}\n * @default 'Loading'\n */\n loadingText: { type: String, default: 'Loading' },\n\n /**\n * Shown when `rows` is empty.\n * @type {string}\n * @default 'Nothing to show'\n */\n emptyText: { type: String, default: 'Nothing to show' },\n\n /**\n * Make rows focusable and emit `row-click` on click or Enter.\n * @type {boolean}\n * @default false\n */\n clickableRows: { type: Boolean, default: false },\n})\n\nconst emit = defineEmits(['sort', 'row-click'])\n\nconst alignClass = (align) =>\n align === 'right' ? 'text-right' : align === 'center' ? 'text-center' : 'text-left'\n\nconst ariaSort = (col) =>\n props.sortKey === col.key ? (props.sortDirection === 'desc' ? 'descending' : 'ascending') : 'none'\n\nconst sortIcon = (col) =>\n props.sortKey !== col.key\n ? 'mdi:unfold-more-horizontal'\n : props.sortDirection === 'desc'\n ? 'mdi:arrow-down'\n : 'mdi:arrow-up'\n\nfunction toggleSort(col) {\n const direction = props.sortKey === col.key && props.sortDirection === 'asc' ? 'desc' : 'asc'\n emit('sort', { key: col.key, direction })\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuNA,MAAM,QAAQ;EAwFd,MAAM,OAAO;EAEb,MAAM,cAAc,UAClB,UAAU,UAAU,eAAe,UAAU,WAAW,gBAAgB;EAE1E,MAAM,YAAY,QAChB,MAAM,YAAY,IAAI,MAAO,MAAM,kBAAkB,SAAS,eAAe,cAAe;EAE9F,MAAM,YAAY,QAChB,MAAM,YAAY,IAAI,MAClB,+BACA,MAAM,kBAAkB,SACtB,mBACA;EAER,SAAS,WAAW,KAAK;GACvB,MAAM,YAAY,MAAM,YAAY,IAAI,OAAO,MAAM,kBAAkB,QAAQ,SAAS;GACxF,KAAK,QAAQ;IAAE,KAAK,IAAI;IAAK;GAAU,CAAC;EAC1C;;GAhUE,OAAA,UAAA,GAAA,mBAyIM,OAAA;IAxIJ,OAAM;IACL,aAAW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