numori-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +23 -20
  3. package/dist/components/Banner.js +29 -32
  4. package/dist/components/Banner.js.map +1 -1
  5. package/dist/components/Button.js +10 -19
  6. package/dist/components/Button.js.map +1 -1
  7. package/dist/components/Card.js +15 -9
  8. package/dist/components/Card.js.map +1 -1
  9. package/dist/components/Checkbox.js +2 -7
  10. package/dist/components/Checkbox.js.map +1 -1
  11. package/dist/components/Dropdown.js +10 -3
  12. package/dist/components/Dropdown.js.map +1 -1
  13. package/dist/components/DropdownSubmenu.js +5 -3
  14. package/dist/components/DropdownSubmenu.js.map +1 -1
  15. package/dist/components/FileInput.js +12 -4
  16. package/dist/components/FileInput.js.map +1 -1
  17. package/dist/components/IconTile.js +5 -9
  18. package/dist/components/IconTile.js.map +1 -1
  19. package/dist/components/Input.js +6 -6
  20. package/dist/components/Input.js.map +1 -1
  21. package/dist/components/ListMenuItem.js +38 -31
  22. package/dist/components/ListMenuItem.js.map +1 -1
  23. package/dist/components/Numpad.js +4 -4
  24. package/dist/components/Numpad.js.map +1 -1
  25. package/dist/components/Popup.js +9 -3
  26. package/dist/components/Popup.js.map +1 -1
  27. package/dist/components/Radio.js +2 -7
  28. package/dist/components/Radio.js.map +1 -1
  29. package/dist/components/Segmented.js +100 -26
  30. package/dist/components/Segmented.js.map +1 -1
  31. package/dist/components/Select.js +6 -4
  32. package/dist/components/Select.js.map +1 -1
  33. package/dist/components/Table.js +174 -0
  34. package/dist/components/Table.js.map +1 -0
  35. package/dist/components/index.js +65 -67
  36. package/dist/components/index.js.map +1 -1
  37. package/dist/composables/useMergedClasses.js +52 -0
  38. package/dist/composables/useMergedClasses.js.map +1 -0
  39. package/dist/icons/mdi.js +1 -0
  40. package/dist/icons/mdi.js.map +1 -1
  41. package/dist/index.d.ts +1 -2
  42. package/dist/index.js +34 -35
  43. package/dist/index.js.map +1 -1
  44. package/dist/internal/controlSizes.js +21 -0
  45. package/dist/internal/controlSizes.js.map +1 -0
  46. package/dist/internal/menu.js +20 -0
  47. package/dist/internal/menu.js.map +1 -0
  48. package/dist/manifest.js +1 -2
  49. package/dist/manifest.js.map +1 -1
  50. package/package.json +2 -1
  51. package/src/components/Banner.vue +20 -9
  52. package/src/components/Button.vue +12 -19
  53. package/src/components/Card.vue +11 -12
  54. package/src/components/Checkbox.vue +2 -10
  55. package/src/components/Dropdown.vue +14 -2
  56. package/src/components/DropdownSubmenu.vue +4 -2
  57. package/src/components/FileInput.vue +19 -4
  58. package/src/components/IconTile.vue +4 -9
  59. package/src/components/Input.vue +6 -6
  60. package/src/components/ListMenuItem.vue +21 -5
  61. package/src/components/Numpad.vue +7 -4
  62. package/src/components/Popup.vue +6 -2
  63. package/src/components/Radio.vue +2 -10
  64. package/src/components/Segmented.vue +108 -38
  65. package/src/components/Select.vue +11 -2
  66. package/src/components/Table.vue +193 -0
  67. package/src/components/index.js +3 -6
  68. package/src/composables/useMergedClasses.js +49 -0
  69. package/src/icons/mdi.js +1 -0
  70. package/src/internal/controlSizes.js +17 -0
  71. package/src/internal/menu.js +16 -0
  72. package/src/manifest.js +1 -2
  73. package/dist/components/ButtonsGroup.js +0 -153
  74. package/dist/components/ButtonsGroup.js.map +0 -1
  75. package/dist/components/ComparisonTable.js +0 -152
  76. package/dist/components/ComparisonTable.js.map +0 -1
  77. package/src/components/ButtonsGroup.vue +0 -140
  78. package/src/components/ComparisonTable.vue +0 -141
package/src/manifest.js CHANGED
@@ -26,11 +26,9 @@ export const COMPONENT_NAMES = [
26
26
  'Banner',
27
27
  'Breadcrumb',
28
28
  'Button',
29
- 'ButtonsGroup',
30
29
  'Card',
31
30
  'Checkbox',
32
31
  'CodeBlock',
33
- 'ComparisonTable',
34
32
  'Divider',
35
33
  'Dropdown',
36
34
  'DropdownItem',
@@ -55,6 +53,7 @@ export const COMPONENT_NAMES = [
55
53
  'Slider',
56
54
  'Spinner',
57
55
  'Stepper',
56
+ 'Table',
58
57
  'ThemeToggle',
59
58
  'Toast',
60
59
  'Toggle',
@@ -1,153 +0,0 @@
1
- import _sfc_main$1 from "../icons/Icon.js";
2
- import _sfc_main$2 from "./Button.js";
3
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, normalizeClass, openBlock, renderList, toDisplayString, withCtx } from "vue";
4
- //#region src/components/ButtonsGroup.vue
5
- var _hoisted_1 = { key: 1 };
6
- var _sfc_main = {
7
- __name: "ButtonsGroup",
8
- props: {
9
- /**
10
- * Currently selected option value (v-model).
11
- * @type {string | number | boolean}
12
- * @default ''
13
- */
14
- modelValue: {
15
- type: [
16
- String,
17
- Number,
18
- Boolean
19
- ],
20
- default: ""
21
- },
22
- /**
23
- * Array of option objects: `{ value, icon?, label?, title? }`.
24
- * At least `value` is required. Provide `icon` for toolbar mode, `label` for tabs.
25
- * @type {Array<{ value: string|number, icon?: string, label?: string, title?: string }>}
26
- * @required
27
- */
28
- options: {
29
- type: Array,
30
- required: true
31
- },
32
- /**
33
- * Visual style of the group.
34
- * - 'toolbar': compact icon toggles with gray background
35
- * - 'tabs': text-based tabs with lighter background and smaller buttons
36
- * @type {string}
37
- * @default 'toolbar'
38
- * @values 'toolbar' | 'tabs'
39
- */
40
- variant: {
41
- type: String,
42
- default: "toolbar"
43
- },
44
- /**
45
- * Icon size class applied to icons in toolbar mode.
46
- * @type {string}
47
- * @default 'w-5 h-5'
48
- */
49
- iconClass: {
50
- type: String,
51
- default: "w-5 h-5"
52
- },
53
- /**
54
- * Button size for toolbar variant (tabs always use 'xs').
55
- * @type {string}
56
- * @default 'md'
57
- * @values 'xs' | 'sm' | 'md'
58
- */
59
- size: {
60
- type: String,
61
- default: "md"
62
- },
63
- /**
64
- * Full-width mode. Defaults to true for tabs, false for toolbar.
65
- * @type {boolean}
66
- * @default undefined (auto-detected from variant)
67
- */
68
- block: {
69
- type: Boolean,
70
- default: void 0
71
- }
72
- },
73
- emits: ["update:modelValue"],
74
- setup(__props) {
75
- /**
76
- * UiButtonsGroup — Segmented toggle button group for single-select options.
77
- *
78
- * Renders a row of UiButton elements styled as a connected group (toolbar or tabs).
79
- * Only one option can be active at a time (radio-like behavior via v-model).
80
- * Supports icon-only toolbar mode and text-based tab mode with automatic sizing,
81
- * rounding, and active/inactive styling.
82
- *
83
- * @example Toolbar with icons
84
- * <UiButtonsGroup v-model="view" :options="[
85
- * { value: 'grid', icon: 'mdi:view-grid' },
86
- * { value: 'list', icon: 'mdi:view-list' },
87
- * ]" />
88
- *
89
- * @example Tab-style text group
90
- * <UiButtonsGroup v-model="tab" variant="tabs" :options="[
91
- * { value: 'all', label: 'All' },
92
- * { value: 'active', label: 'Active' },
93
- * { value: 'archived', label: 'Archived' },
94
- * ]" />
95
- *
96
- * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected
97
- *
98
- * @see UiButton — Underlying button component used for each option
99
- */
100
- const props = __props;
101
- const isBlock = computed(() => props.block ?? props.variant === "tabs");
102
- const wrapperClass = computed(() => isBlock.value ? "flex items-center rounded-lg" : "inline-flex items-center rounded-lg");
103
- const containerClass = computed(() => props.variant === "tabs" ? "bg-gray-100 dark:bg-gray-800 p-0.5" : "bg-gray-200/50 dark:bg-gray-800");
104
- const buttonSize = computed(() => props.variant === "tabs" ? "xs" : props.size);
105
- const roundingClass = (idx) => {
106
- const last = props.options.length - 1;
107
- const radius = props.variant === "tabs" ? "md" : "lg";
108
- if (props.options.length === 1) return `rounded-${radius}`;
109
- if (idx === 0) return `rounded-l-${radius} rounded-r-none`;
110
- if (idx === last) return `rounded-r-${radius} rounded-l-none`;
111
- return "rounded-none";
112
- };
113
- const activeClass = computed(() => props.variant === "tabs" ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-200 shadow-sm hover:bg-white dark:hover:bg-gray-700" : "bg-white dark:bg-gray-700 text-primary-600 dark:text-primary-400 shadow-sm hover:bg-white dark:hover:bg-gray-700");
114
- const inactiveClass = computed(() => props.variant === "tabs" ? "text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200/50 dark:hover:bg-gray-700/50" : "text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-300/40 dark:hover:bg-gray-700/50");
115
- return (_ctx, _cache) => {
116
- return openBlock(), createElementBlock("div", {
117
- class: normalizeClass([wrapperClass.value, containerClass.value]),
118
- role: "group"
119
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt, idx) => {
120
- return openBlock(), createBlock(_sfc_main$2, {
121
- key: opt.value,
122
- variant: "ghost",
123
- "icon-only": !opt.label,
124
- size: buttonSize.value,
125
- class: normalizeClass([
126
- roundingClass(idx),
127
- __props.modelValue === opt.value ? activeClass.value : inactiveClass.value,
128
- opt.label ? "flex-1" : ""
129
- ]),
130
- title: opt.title || opt.label || "",
131
- onClick: ($event) => _ctx.$emit("update:modelValue", opt.value)
132
- }, {
133
- default: withCtx(() => [opt.icon ? (openBlock(), createBlock(_sfc_main$1, {
134
- key: 0,
135
- name: opt.icon,
136
- class: normalizeClass([__props.iconClass, "block"])
137
- }, null, 8, ["name", "class"])) : createCommentVNode("", true), opt.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(opt.label), 1)) : createCommentVNode("", true)]),
138
- _: 2
139
- }, 1032, [
140
- "icon-only",
141
- "size",
142
- "class",
143
- "title",
144
- "onClick"
145
- ]);
146
- }), 128))], 2);
147
- };
148
- }
149
- };
150
- //#endregion
151
- export { _sfc_main as default };
152
-
153
- //# sourceMappingURL=ButtonsGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonsGroup.js","names":["$emit"],"sources":["../../src/components/ButtonsGroup.vue"],"sourcesContent":["<template>\n <!-- Segmented button group rendered as a flex row with role=\"group\" -->\n <div :class=\"[wrapperClass, containerClass]\" role=\"group\">\n <UiButton\n v-for=\"(opt, idx) in options\"\n :key=\"opt.value\"\n variant=\"ghost\"\n :icon-only=\"!opt.label\"\n :size=\"buttonSize\"\n :class=\"[\n roundingClass(idx),\n modelValue === opt.value ? activeClass : inactiveClass,\n opt.label ? 'flex-1' : '',\n ]\"\n :title=\"opt.title || opt.label || ''\"\n @click=\"$emit('update:modelValue', opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" :class=\"iconClass\" class=\"block\" />\n <span v-if=\"opt.label\">{{ opt.label }}</span>\n </UiButton>\n </div>\n</template>\n\n<script setup>\n/**\n * UiButtonsGroup — Segmented toggle button group for single-select options.\n *\n * Renders a row of UiButton elements styled as a connected group (toolbar or tabs).\n * Only one option can be active at a time (radio-like behavior via v-model).\n * Supports icon-only toolbar mode and text-based tab mode with automatic sizing,\n * rounding, and active/inactive styling.\n *\n * @example Toolbar with icons\n * <UiButtonsGroup v-model=\"view\" :options=\"[\n * { value: 'grid', icon: 'mdi:view-grid' },\n * { value: 'list', icon: 'mdi:view-list' },\n * ]\" />\n *\n * @example Tab-style text group\n * <UiButtonsGroup v-model=\"tab\" variant=\"tabs\" :options=\"[\n * { value: 'all', label: 'All' },\n * { value: 'active', label: 'Active' },\n * { value: 'archived', label: 'Archived' },\n * ]\" />\n *\n * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected\n *\n * @see UiButton — Underlying button component used for each option\n */\nimport { computed } from 'vue'\nimport UiButton from './Button.vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Currently selected option value (v-model).\n * @type {string | number | boolean}\n * @default ''\n */\n modelValue: { type: [String, Number, Boolean], default: '' },\n\n /**\n * Array of option objects: `{ value, icon?, label?, title? }`.\n * At least `value` is required. Provide `icon` for toolbar mode, `label` for tabs.\n * @type {Array<{ value: string|number, icon?: string, label?: string, title?: string }>}\n * @required\n */\n options: { type: Array, required: true },\n\n /**\n * Visual style of the group.\n * - 'toolbar': compact icon toggles with gray background\n * - 'tabs': text-based tabs with lighter background and smaller buttons\n * @type {string}\n * @default 'toolbar'\n * @values 'toolbar' | 'tabs'\n */\n variant: { type: String, default: 'toolbar' },\n\n /**\n * Icon size class applied to icons in toolbar mode.\n * @type {string}\n * @default 'w-5 h-5'\n */\n iconClass: { type: String, default: 'w-5 h-5' },\n\n /**\n * Button size for toolbar variant (tabs always use 'xs').\n * @type {string}\n * @default 'md'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Full-width mode. Defaults to true for tabs, false for toolbar.\n * @type {boolean}\n * @default undefined (auto-detected from variant)\n */\n block: { type: Boolean, default: undefined },\n})\n\ndefineEmits(['update:modelValue'])\n\n// Block defaults to true for tabs (full-width) and false for toolbar (inline)\nconst isBlock = computed(() => props.block ?? props.variant === 'tabs')\n\nconst wrapperClass = computed(() =>\n isBlock.value ? 'flex items-center rounded-lg' : 'inline-flex items-center rounded-lg',\n)\n\nconst containerClass = computed(() =>\n props.variant === 'tabs'\n ? 'bg-gray-100 dark:bg-gray-800 p-0.5'\n : 'bg-gray-200/50 dark:bg-gray-800',\n)\n\nconst buttonSize = computed(() => (props.variant === 'tabs' ? 'xs' : props.size))\n\n// Apply rounding only to first/last buttons; middle buttons get rounded-none\nconst roundingClass = (idx) => {\n const last = props.options.length - 1\n const radius = props.variant === 'tabs' ? 'md' : 'lg'\n if (props.options.length === 1) return `rounded-${radius}`\n if (idx === 0) return `rounded-l-${radius} rounded-r-none`\n if (idx === last) return `rounded-r-${radius} rounded-l-none`\n return 'rounded-none'\n}\n\nconst activeClass = computed(() =>\n props.variant === 'tabs'\n ? 'bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-200 shadow-sm hover:bg-white dark:hover:bg-gray-700'\n : 'bg-white dark:bg-gray-700 text-primary-600 dark:text-primary-400 shadow-sm hover:bg-white dark:hover:bg-gray-700',\n)\n\nconst inactiveClass = computed(() =>\n props.variant === 'tabs'\n ? 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200/50 dark:hover:bg-gray-700/50'\n : 'text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-300/40 dark:hover:bg-gray-700/50',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDA,MAAM,QAAQ;EAoDd,MAAM,UAAU,eAAe,MAAM,SAAS,MAAM,YAAY,MAAM;EAEtE,MAAM,eAAe,eACnB,QAAQ,QAAQ,iCAAiC,qCACnD;EAEA,MAAM,iBAAiB,eACrB,MAAM,YAAY,SACd,uCACA,iCACN;EAEA,MAAM,aAAa,eAAgB,MAAM,YAAY,SAAS,OAAO,MAAM,IAAK;EAGhF,MAAM,iBAAiB,QAAQ;GAC7B,MAAM,OAAO,MAAM,QAAQ,SAAS;GACpC,MAAM,SAAS,MAAM,YAAY,SAAS,OAAO;GACjD,IAAI,MAAM,QAAQ,WAAW,GAAG,OAAO,WAAW;GAClD,IAAI,QAAQ,GAAG,OAAO,aAAa,OAAO;GAC1C,IAAI,QAAQ,MAAM,OAAO,aAAa,OAAO;GAC7C,OAAO;EACT;EAEA,MAAM,cAAc,eAClB,MAAM,YAAY,SACd,+GACA,kHACN;EAEA,MAAM,gBAAgB,eACpB,MAAM,YAAY,SACd,iIACA,8HACN;;GAxIE,OAAA,UAAA,GAAA,mBAkBM,OAAA;IAlBA,OAAK,eAAA,CAAG,aAAA,OAAc,eAAA,KAAc,CAAA;IAAG,MAAK;GAChD,GAAA,EAAA,UAAA,IAAA,GAAA,mBAgBW,UAAA,MAAA,WAfY,QAAA,UAAb,KAAK,QAAG;IADlB,OAAA,UAAA,GAAA,YAgBW,aAAA;KAdR,KAAK,IAAI;KACV,SAAQ;KACP,aAAS,CAAG,IAAI;KAChB,MAAM,WAAA;KACN,OAAK,eAAA;MAAY,cAAc,GAAG;MAAW,QAAA,eAAe,IAAI,QAAQ,YAAA,QAAc,cAAA;MAAuB,IAAI,QAAK,WAAA;;KAKtH,OAAO,IAAI,SAAS,IAAI,SAAK;KAC7B,UAAK,WAAEA,KAAAA,MAAK,qBAAsB,IAAI,KAAK;;KAE5C,SAAA,cAA4E,CAA9D,IAAI,QAAlB,UAAA,GAAA,YAA4E,aAAA;;MAAnD,MAAM,IAAI;MAAO,OAAK,eAAA,CAAE,QAAA,WAAiB,OAAO,CAAA;KAC7D,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,IAAI,SAAhB,UAAA,GAAA,mBAA6C,QAAA,YAAA,gBAAnB,IAAI,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -1,152 +0,0 @@
1
- import _sfc_main$1 from "../icons/Icon.js";
2
- import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, openBlock, renderList, toDisplayString } from "vue";
3
- //#region src/components/ComparisonTable.vue
4
- var _hoisted_1 = { class: "overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700" };
5
- var _hoisted_2 = { class: "w-full min-w-2xl border-collapse text-left text-sm" };
6
- var _hoisted_3 = { class: "sr-only" };
7
- var _hoisted_4 = { class: "border-b border-gray-200 dark:border-gray-700" };
8
- var _hoisted_5 = {
9
- scope: "col",
10
- class: "px-5 py-4 font-semibold text-gray-500 dark:text-gray-400"
11
- };
12
- var _hoisted_6 = { class: "sr-only" };
13
- var _hoisted_7 = {
14
- scope: "col",
15
- class: "w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200"
16
- };
17
- var _hoisted_8 = {
18
- scope: "col",
19
- class: "w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300"
20
- };
21
- var _hoisted_9 = {
22
- scope: "row",
23
- class: "px-5 py-4 font-medium text-gray-900 dark:text-gray-100"
24
- };
25
- var _hoisted_10 = { class: "bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200" };
26
- var _hoisted_11 = { class: "flex items-start gap-2" };
27
- var _hoisted_12 = { class: "px-5 py-4 text-gray-600 dark:text-gray-400" };
28
- var _hoisted_13 = { class: "flex items-start gap-2" };
29
- var _sfc_main = {
30
- __name: "ComparisonTable",
31
- props: {
32
- /**
33
- * Table summary for assistive technology. Rendered visually hidden.
34
- * @type {string}
35
- */
36
- caption: {
37
- type: String,
38
- required: true
39
- },
40
- /**
41
- * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`
42
- * should be stable if present, and falls back to the row index.
43
- * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}
44
- */
45
- rows: {
46
- type: Array,
47
- required: true
48
- },
49
- /**
50
- * Heading for the accented (primary) column.
51
- * @type {string}
52
- */
53
- primaryLabel: {
54
- type: String,
55
- required: true
56
- },
57
- /**
58
- * Heading for the comparison (secondary) column.
59
- * @type {string}
60
- */
61
- secondaryLabel: {
62
- type: String,
63
- required: true
64
- },
65
- /**
66
- * Accessible name for the otherwise-blank first column.
67
- * @type {string}
68
- * @default 'Feature'
69
- */
70
- featureLabel: {
71
- type: String,
72
- default: "Feature"
73
- },
74
- /**
75
- * MDI icon marking each primary-column cell.
76
- * @type {string}
77
- * @default 'mdi:check-circle'
78
- */
79
- primaryIcon: {
80
- type: String,
81
- default: "mdi:check-circle"
82
- },
83
- /**
84
- * MDI icon marking each secondary-column cell.
85
- * @type {string}
86
- * @default 'mdi:minus-circle-outline'
87
- */
88
- secondaryIcon: {
89
- type: String,
90
- default: "mdi:minus-circle-outline"
91
- }
92
- },
93
- setup(__props) {
94
- /**
95
- * UiComparisonTable — a two-way, feature-by-feature comparison.
96
- *
97
- * A real `<table>`, not a grid of divs, because it is tabular data: the
98
- * `<caption>`, `scope="col"` headers and `scope="row"` feature cells are what let
99
- * a screen reader announce a whole row together ("Open source · yes · no")
100
- * instead of reading three disconnected columns. The first (feature) column
101
- * header is visually blank but named for assistive technology.
102
- *
103
- * The layout favours one column — the "primary" one is tinted with the accent —
104
- * for the common "us versus the usual way" table. The leading icons are
105
- * decorative; the cell text carries the meaning, so nothing depends on colour or
106
- * glyph alone. It scrolls horizontally on narrow screens rather than crushing
107
- * the columns.
108
- *
109
- * @example
110
- * <UiComparisonTable
111
- * caption="How Numori compares"
112
- * primary-label="Numori"
113
- * secondary-label="The usual suite"
114
- * feature-label="Feature"
115
- * :rows="[
116
- * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },
117
- * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },
118
- * ]"
119
- * />
120
- */
121
- return (_ctx, _cache) => {
122
- return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("table", _hoisted_2, [
123
- createElementVNode("caption", _hoisted_3, toDisplayString(__props.caption), 1),
124
- createElementVNode("thead", null, [createElementVNode("tr", _hoisted_4, [
125
- createElementVNode("th", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(__props.featureLabel), 1)]),
126
- createElementVNode("th", _hoisted_7, toDisplayString(__props.primaryLabel), 1),
127
- createElementVNode("th", _hoisted_8, toDisplayString(__props.secondaryLabel), 1)
128
- ])]),
129
- createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row, index) => {
130
- return openBlock(), createElementBlock("tr", {
131
- key: row.key ?? index,
132
- 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"
133
- }, [
134
- createElementVNode("th", _hoisted_9, toDisplayString(row.feature), 1),
135
- createElementVNode("td", _hoisted_10, [createElementVNode("span", _hoisted_11, [createVNode(_sfc_main$1, {
136
- name: __props.primaryIcon,
137
- class: "mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400"
138
- }, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.primary), 1)])]),
139
- createElementVNode("td", _hoisted_12, [createElementVNode("span", _hoisted_13, [createVNode(_sfc_main$1, {
140
- name: __props.secondaryIcon,
141
- class: "mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500"
142
- }, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.secondary), 1)])])
143
- ]);
144
- }), 128))])
145
- ])]);
146
- };
147
- }
148
- };
149
- //#endregion
150
- export { _sfc_main as default };
151
-
152
- //# sourceMappingURL=ComparisonTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComparisonTable.js","names":[],"sources":["../../src/components/ComparisonTable.vue"],"sourcesContent":["<template>\n <div class=\"overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700\">\n <table class=\"w-full min-w-2xl border-collapse text-left text-sm\">\n <caption class=\"sr-only\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr class=\"border-b border-gray-200 dark:border-gray-700\">\n <th scope=\"col\" class=\"px-5 py-4 font-semibold text-gray-500 dark:text-gray-400\">\n <span class=\"sr-only\">{{ featureLabel }}</span>\n </th>\n <th\n scope=\"col\"\n class=\"w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200\"\n >\n {{ primaryLabel }}\n </th>\n <th scope=\"col\" class=\"w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300\">\n {{ secondaryLabel }}\n </th>\n </tr>\n </thead>\n\n <tbody>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"row.key ?? 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 >\n <th scope=\"row\" class=\"px-5 py-4 font-medium text-gray-900 dark:text-gray-100\">\n {{ row.feature }}\n </th>\n\n <td\n class=\"bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200\"\n >\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"primaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400\"\n />\n {{ row.primary }}\n </span>\n </td>\n\n <td class=\"px-5 py-4 text-gray-600 dark:text-gray-400\">\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"secondaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500\"\n />\n {{ row.secondary }}\n </span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<script setup>\n/**\n * UiComparisonTable — a two-way, feature-by-feature comparison.\n *\n * A real `<table>`, not a grid of divs, because it is tabular data: the\n * `<caption>`, `scope=\"col\"` headers and `scope=\"row\"` feature cells are what let\n * a screen reader announce a whole row together (\"Open source · yes · no\")\n * instead of reading three disconnected columns. The first (feature) column\n * header is visually blank but named for assistive technology.\n *\n * The layout favours one column — the \"primary\" one is tinted with the accent —\n * for the common \"us versus the usual way\" table. The leading icons are\n * decorative; the cell text carries the meaning, so nothing depends on colour or\n * glyph alone. It scrolls horizontally on narrow screens rather than crushing\n * the columns.\n *\n * @example\n * <UiComparisonTable\n * caption=\"How Numori compares\"\n * primary-label=\"Numori\"\n * secondary-label=\"The usual suite\"\n * feature-label=\"Feature\"\n * :rows=\"[\n * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },\n * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },\n * ]\"\n * />\n */\nimport UiIcon from '../icons/Icon.vue'\n\ndefineProps({\n /**\n * Table summary for assistive technology. Rendered visually hidden.\n * @type {string}\n */\n caption: { type: String, required: true },\n\n /**\n * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`\n * should be stable if present, and falls back to the row index.\n * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}\n */\n rows: { type: Array, required: true },\n\n /**\n * Heading for the accented (primary) column.\n * @type {string}\n */\n primaryLabel: { type: String, required: true },\n\n /**\n * Heading for the comparison (secondary) column.\n * @type {string}\n */\n secondaryLabel: { type: String, required: true },\n\n /**\n * Accessible name for the otherwise-blank first column.\n * @type {string}\n * @default 'Feature'\n */\n featureLabel: { type: String, default: 'Feature' },\n\n /**\n * MDI icon marking each primary-column cell.\n * @type {string}\n * @default 'mdi:check-circle'\n */\n primaryIcon: { type: String, default: 'mdi:check-circle' },\n\n /**\n * MDI icon marking each secondary-column cell.\n * @type {string}\n * @default 'mdi:minus-circle-outline'\n */\n secondaryIcon: { type: String, default: 'mdi:minus-circle-outline' },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACE,OAAA,UAAA,GAAA,mBA2DM,OA3DN,YA2DM,CA1DJ,mBAyDQ,SAzDR,YAyDQ;IAxDN,mBAIU,WAJV,YAIU,gBAFN,QAAA,OAAO,GAAA,CAAA;IAIX,mBAeQ,SAAA,MAAA,CAdN,mBAaK,MAbL,YAaK;KAZH,mBAEK,MAFL,YAEK,CADH,mBAA+C,QAA/C,YAA+C,gBAAtB,QAAA,YAAY,GAAA,CAAA,CAAA,CAAA;KAEvC,mBAKK,MALL,YAKK,gBADA,QAAA,YAAY,GAAA,CAAA;KAEjB,mBAEK,MAFL,YAEK,gBADA,QAAA,cAAc,GAAA,CAAA;;IAKvB,mBAgCQ,SAAA,MAAA,EA/BN,UAAA,IAAA,GAAA,mBA8BK,UAAA,MAAA,WA7BoB,QAAA,OAAf,KAAK,UAAK;KADpB,OAAA,UAAA,GAAA,mBA8BK,MAAA;MA5BF,KAAK,IAAI,OAAO;MACjB,OAAM;;MAEN,mBAEK,MAFL,YAEK,gBADA,IAAI,OAAO,GAAA,CAAA;MAGhB,mBAUK,MAVL,aAUK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MAIlB,mBAQK,MARL,aAQK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,SAAS,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -1,140 +0,0 @@
1
- <template>
2
- <!-- Segmented button group rendered as a flex row with role="group" -->
3
- <div :class="[wrapperClass, containerClass]" role="group">
4
- <UiButton
5
- v-for="(opt, idx) in options"
6
- :key="opt.value"
7
- variant="ghost"
8
- :icon-only="!opt.label"
9
- :size="buttonSize"
10
- :class="[
11
- roundingClass(idx),
12
- modelValue === opt.value ? activeClass : inactiveClass,
13
- opt.label ? 'flex-1' : '',
14
- ]"
15
- :title="opt.title || opt.label || ''"
16
- @click="$emit('update:modelValue', opt.value)"
17
- >
18
- <UiIcon v-if="opt.icon" :name="opt.icon" :class="iconClass" class="block" />
19
- <span v-if="opt.label">{{ opt.label }}</span>
20
- </UiButton>
21
- </div>
22
- </template>
23
-
24
- <script setup>
25
- /**
26
- * UiButtonsGroup — Segmented toggle button group for single-select options.
27
- *
28
- * Renders a row of UiButton elements styled as a connected group (toolbar or tabs).
29
- * Only one option can be active at a time (radio-like behavior via v-model).
30
- * Supports icon-only toolbar mode and text-based tab mode with automatic sizing,
31
- * rounding, and active/inactive styling.
32
- *
33
- * @example Toolbar with icons
34
- * <UiButtonsGroup v-model="view" :options="[
35
- * { value: 'grid', icon: 'mdi:view-grid' },
36
- * { value: 'list', icon: 'mdi:view-list' },
37
- * ]" />
38
- *
39
- * @example Tab-style text group
40
- * <UiButtonsGroup v-model="tab" variant="tabs" :options="[
41
- * { value: 'all', label: 'All' },
42
- * { value: 'active', label: 'Active' },
43
- * { value: 'archived', label: 'Archived' },
44
- * ]" />
45
- *
46
- * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected
47
- *
48
- * @see UiButton — Underlying button component used for each option
49
- */
50
- import { computed } from 'vue'
51
- import UiButton from './Button.vue'
52
- import UiIcon from '../icons/Icon.vue'
53
- const props = defineProps({
54
- /**
55
- * Currently selected option value (v-model).
56
- * @type {string | number | boolean}
57
- * @default ''
58
- */
59
- modelValue: { type: [String, Number, Boolean], default: '' },
60
-
61
- /**
62
- * Array of option objects: `{ value, icon?, label?, title? }`.
63
- * At least `value` is required. Provide `icon` for toolbar mode, `label` for tabs.
64
- * @type {Array<{ value: string|number, icon?: string, label?: string, title?: string }>}
65
- * @required
66
- */
67
- options: { type: Array, required: true },
68
-
69
- /**
70
- * Visual style of the group.
71
- * - 'toolbar': compact icon toggles with gray background
72
- * - 'tabs': text-based tabs with lighter background and smaller buttons
73
- * @type {string}
74
- * @default 'toolbar'
75
- * @values 'toolbar' | 'tabs'
76
- */
77
- variant: { type: String, default: 'toolbar' },
78
-
79
- /**
80
- * Icon size class applied to icons in toolbar mode.
81
- * @type {string}
82
- * @default 'w-5 h-5'
83
- */
84
- iconClass: { type: String, default: 'w-5 h-5' },
85
-
86
- /**
87
- * Button size for toolbar variant (tabs always use 'xs').
88
- * @type {string}
89
- * @default 'md'
90
- * @values 'xs' | 'sm' | 'md'
91
- */
92
- size: { type: String, default: 'md' },
93
-
94
- /**
95
- * Full-width mode. Defaults to true for tabs, false for toolbar.
96
- * @type {boolean}
97
- * @default undefined (auto-detected from variant)
98
- */
99
- block: { type: Boolean, default: undefined },
100
- })
101
-
102
- defineEmits(['update:modelValue'])
103
-
104
- // Block defaults to true for tabs (full-width) and false for toolbar (inline)
105
- const isBlock = computed(() => props.block ?? props.variant === 'tabs')
106
-
107
- const wrapperClass = computed(() =>
108
- isBlock.value ? 'flex items-center rounded-lg' : 'inline-flex items-center rounded-lg',
109
- )
110
-
111
- const containerClass = computed(() =>
112
- props.variant === 'tabs'
113
- ? 'bg-gray-100 dark:bg-gray-800 p-0.5'
114
- : 'bg-gray-200/50 dark:bg-gray-800',
115
- )
116
-
117
- const buttonSize = computed(() => (props.variant === 'tabs' ? 'xs' : props.size))
118
-
119
- // Apply rounding only to first/last buttons; middle buttons get rounded-none
120
- const roundingClass = (idx) => {
121
- const last = props.options.length - 1
122
- const radius = props.variant === 'tabs' ? 'md' : 'lg'
123
- if (props.options.length === 1) return `rounded-${radius}`
124
- if (idx === 0) return `rounded-l-${radius} rounded-r-none`
125
- if (idx === last) return `rounded-r-${radius} rounded-l-none`
126
- return 'rounded-none'
127
- }
128
-
129
- const activeClass = computed(() =>
130
- props.variant === 'tabs'
131
- ? 'bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-200 shadow-sm hover:bg-white dark:hover:bg-gray-700'
132
- : 'bg-white dark:bg-gray-700 text-primary-600 dark:text-primary-400 shadow-sm hover:bg-white dark:hover:bg-gray-700',
133
- )
134
-
135
- const inactiveClass = computed(() =>
136
- props.variant === 'tabs'
137
- ? 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200/50 dark:hover:bg-gray-700/50'
138
- : 'text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-300/40 dark:hover:bg-gray-700/50',
139
- )
140
- </script>
@@ -1,141 +0,0 @@
1
- <template>
2
- <div class="overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700">
3
- <table class="w-full min-w-2xl border-collapse text-left text-sm">
4
- <caption class="sr-only">
5
- {{
6
- caption
7
- }}
8
- </caption>
9
-
10
- <thead>
11
- <tr class="border-b border-gray-200 dark:border-gray-700">
12
- <th scope="col" class="px-5 py-4 font-semibold text-gray-500 dark:text-gray-400">
13
- <span class="sr-only">{{ featureLabel }}</span>
14
- </th>
15
- <th
16
- scope="col"
17
- class="w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200"
18
- >
19
- {{ primaryLabel }}
20
- </th>
21
- <th scope="col" class="w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300">
22
- {{ secondaryLabel }}
23
- </th>
24
- </tr>
25
- </thead>
26
-
27
- <tbody>
28
- <tr
29
- v-for="(row, index) in rows"
30
- :key="row.key ?? index"
31
- 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"
32
- >
33
- <th scope="row" class="px-5 py-4 font-medium text-gray-900 dark:text-gray-100">
34
- {{ row.feature }}
35
- </th>
36
-
37
- <td
38
- class="bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200"
39
- >
40
- <span class="flex items-start gap-2">
41
- <UiIcon
42
- :name="primaryIcon"
43
- class="mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400"
44
- />
45
- {{ row.primary }}
46
- </span>
47
- </td>
48
-
49
- <td class="px-5 py-4 text-gray-600 dark:text-gray-400">
50
- <span class="flex items-start gap-2">
51
- <UiIcon
52
- :name="secondaryIcon"
53
- class="mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500"
54
- />
55
- {{ row.secondary }}
56
- </span>
57
- </td>
58
- </tr>
59
- </tbody>
60
- </table>
61
- </div>
62
- </template>
63
-
64
- <script setup>
65
- /**
66
- * UiComparisonTable — a two-way, feature-by-feature comparison.
67
- *
68
- * A real `<table>`, not a grid of divs, because it is tabular data: the
69
- * `<caption>`, `scope="col"` headers and `scope="row"` feature cells are what let
70
- * a screen reader announce a whole row together ("Open source · yes · no")
71
- * instead of reading three disconnected columns. The first (feature) column
72
- * header is visually blank but named for assistive technology.
73
- *
74
- * The layout favours one column — the "primary" one is tinted with the accent —
75
- * for the common "us versus the usual way" table. The leading icons are
76
- * decorative; the cell text carries the meaning, so nothing depends on colour or
77
- * glyph alone. It scrolls horizontally on narrow screens rather than crushing
78
- * the columns.
79
- *
80
- * @example
81
- * <UiComparisonTable
82
- * caption="How Numori compares"
83
- * primary-label="Numori"
84
- * secondary-label="The usual suite"
85
- * feature-label="Feature"
86
- * :rows="[
87
- * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },
88
- * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },
89
- * ]"
90
- * />
91
- */
92
- import UiIcon from '../icons/Icon.vue'
93
-
94
- defineProps({
95
- /**
96
- * Table summary for assistive technology. Rendered visually hidden.
97
- * @type {string}
98
- */
99
- caption: { type: String, required: true },
100
-
101
- /**
102
- * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`
103
- * should be stable if present, and falls back to the row index.
104
- * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}
105
- */
106
- rows: { type: Array, required: true },
107
-
108
- /**
109
- * Heading for the accented (primary) column.
110
- * @type {string}
111
- */
112
- primaryLabel: { type: String, required: true },
113
-
114
- /**
115
- * Heading for the comparison (secondary) column.
116
- * @type {string}
117
- */
118
- secondaryLabel: { type: String, required: true },
119
-
120
- /**
121
- * Accessible name for the otherwise-blank first column.
122
- * @type {string}
123
- * @default 'Feature'
124
- */
125
- featureLabel: { type: String, default: 'Feature' },
126
-
127
- /**
128
- * MDI icon marking each primary-column cell.
129
- * @type {string}
130
- * @default 'mdi:check-circle'
131
- */
132
- primaryIcon: { type: String, default: 'mdi:check-circle' },
133
-
134
- /**
135
- * MDI icon marking each secondary-column cell.
136
- * @type {string}
137
- * @default 'mdi:minus-circle-outline'
138
- */
139
- secondaryIcon: { type: String, default: 'mdi:minus-circle-outline' },
140
- })
141
- </script>