numori-ui 0.2.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 (87) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +26 -21
  3. package/dist/components/Banner.js +176 -0
  4. package/dist/components/Banner.js.map +1 -0
  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/CodeBlock.js +101 -0
  12. package/dist/components/CodeBlock.js.map +1 -0
  13. package/dist/components/Dropdown.js +10 -3
  14. package/dist/components/Dropdown.js.map +1 -1
  15. package/dist/components/DropdownSubmenu.js +5 -3
  16. package/dist/components/DropdownSubmenu.js.map +1 -1
  17. package/dist/components/FileInput.js +12 -4
  18. package/dist/components/FileInput.js.map +1 -1
  19. package/dist/components/IconTile.js +5 -9
  20. package/dist/components/IconTile.js.map +1 -1
  21. package/dist/components/Input.js +6 -6
  22. package/dist/components/Input.js.map +1 -1
  23. package/dist/components/ListMenuItem.js +38 -31
  24. package/dist/components/ListMenuItem.js.map +1 -1
  25. package/dist/components/Numpad.js +4 -4
  26. package/dist/components/Numpad.js.map +1 -1
  27. package/dist/components/Popup.js +9 -3
  28. package/dist/components/Popup.js.map +1 -1
  29. package/dist/components/Radio.js +2 -7
  30. package/dist/components/Radio.js.map +1 -1
  31. package/dist/components/Segmented.js +100 -26
  32. package/dist/components/Segmented.js.map +1 -1
  33. package/dist/components/Select.js +6 -4
  34. package/dist/components/Select.js.map +1 -1
  35. package/dist/components/Spinner.js +87 -0
  36. package/dist/components/Spinner.js.map +1 -0
  37. package/dist/components/Table.js +174 -0
  38. package/dist/components/Table.js.map +1 -0
  39. package/dist/components/ThemeToggle.js +85 -0
  40. package/dist/components/ThemeToggle.js.map +1 -0
  41. package/dist/components/Toast.js +107 -0
  42. package/dist/components/Toast.js.map +1 -0
  43. package/dist/components/index.js +67 -57
  44. package/dist/components/index.js.map +1 -1
  45. package/dist/composables/useMergedClasses.js +52 -0
  46. package/dist/composables/useMergedClasses.js.map +1 -0
  47. package/dist/icons/mdi.js +10 -0
  48. package/dist/icons/mdi.js.map +1 -1
  49. package/dist/index.d.ts +6 -1
  50. package/dist/index.js +35 -30
  51. package/dist/index.js.map +1 -1
  52. package/dist/internal/controlSizes.js +21 -0
  53. package/dist/internal/controlSizes.js.map +1 -0
  54. package/dist/internal/menu.js +20 -0
  55. package/dist/internal/menu.js.map +1 -0
  56. package/dist/manifest.js +6 -1
  57. package/dist/manifest.js.map +1 -1
  58. package/package.json +2 -1
  59. package/src/components/Banner.vue +160 -0
  60. package/src/components/Button.vue +12 -19
  61. package/src/components/Card.vue +11 -12
  62. package/src/components/Checkbox.vue +2 -10
  63. package/src/components/CodeBlock.vue +99 -0
  64. package/src/components/Dropdown.vue +14 -2
  65. package/src/components/DropdownSubmenu.vue +4 -2
  66. package/src/components/FileInput.vue +19 -4
  67. package/src/components/IconTile.vue +4 -9
  68. package/src/components/Input.vue +6 -6
  69. package/src/components/ListMenuItem.vue +21 -5
  70. package/src/components/Numpad.vue +7 -4
  71. package/src/components/Popup.vue +6 -2
  72. package/src/components/Radio.vue +2 -10
  73. package/src/components/Segmented.vue +108 -38
  74. package/src/components/Select.vue +11 -2
  75. package/src/components/Spinner.vue +70 -0
  76. package/src/components/Table.vue +193 -0
  77. package/src/components/ThemeToggle.vue +81 -0
  78. package/src/components/Toast.vue +106 -0
  79. package/src/components/index.js +18 -3
  80. package/src/composables/useMergedClasses.js +49 -0
  81. package/src/icons/mdi.js +10 -0
  82. package/src/internal/controlSizes.js +17 -0
  83. package/src/internal/menu.js +16 -0
  84. package/src/manifest.js +6 -1
  85. package/dist/components/ButtonsGroup.js +0 -153
  86. package/dist/components/ButtonsGroup.js.map +0 -1
  87. package/src/components/ButtonsGroup.vue +0 -140
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <div
4
+ class="fixed left-1/2 -translate-x-1/2 z-[100] flex flex-col items-center gap-2 pointer-events-none"
5
+ :class="positionClass"
6
+ >
7
+ <TransitionGroup
8
+ enter-active-class="transition-all duration-250 ease-out"
9
+ enter-from-class="opacity-0 -translate-y-3 scale-95"
10
+ enter-to-class="opacity-100 translate-y-0 scale-100"
11
+ leave-active-class="transition-all duration-200 ease-in"
12
+ leave-from-class="opacity-100 translate-y-0 scale-100"
13
+ leave-to-class="opacity-0 -translate-y-1 scale-95"
14
+ >
15
+ <div
16
+ v-for="toast in toasts"
17
+ :key="toast.id"
18
+ class="pointer-events-auto flex items-center gap-2 px-4 py-2.5 rounded-xl shadow-lg text-sm font-medium backdrop-blur-xs"
19
+ :class="toastClass(toast.type)"
20
+ role="status"
21
+ >
22
+ <UiIcon v-if="toast.icon" :name="toast.icon" class="w-4 h-4 shrink-0" />
23
+ <span>{{ toast.message }}</span>
24
+ </div>
25
+ </TransitionGroup>
26
+ </div>
27
+ </Teleport>
28
+ </template>
29
+
30
+ <script setup>
31
+ /**
32
+ * UiToast — a stack of transient, self-dismissing messages.
33
+ *
34
+ * The presentational half of a toast system: it renders and animates a list of
35
+ * messages, teleported to `<body>` so it floats above everything and clear of
36
+ * any parent's `overflow` or stacking context. Owning the list — adding a toast,
37
+ * timing it out, removing it — is the app's job, because *when* something is
38
+ * worth announcing is application logic, not layout. Hand it a reactive array
39
+ * and mutate that array; the enter/leave transitions handle the rest.
40
+ *
41
+ * Each entry is `{ id, message, type?, icon? }`. `id` must be stable and unique
42
+ * (it keys the transition); `type` picks the colour and defaults to a neutral
43
+ * dark pill; `icon` is optional and drawn through `UiIcon`.
44
+ *
45
+ * The container does not capture pointer events, so it never blocks the UI
46
+ * underneath; only the pills themselves do. Each pill is a `role="status"`, so a
47
+ * screen reader announces it politely without stealing focus.
48
+ *
49
+ * @example
50
+ * <script setup>
51
+ * import { ref } from 'vue'
52
+ * const toasts = ref([])
53
+ * let seq = 0
54
+ * function notify(message, type = 'info') {
55
+ * const id = ++seq
56
+ * toasts.value.push({ id, message, type })
57
+ * setTimeout(() => { toasts.value = toasts.value.filter((t) => t.id !== id) }, 3000)
58
+ * }
59
+ * <\/script>
60
+ *
61
+ * <UiToast :toasts="toasts" />
62
+ * <UiButton @click="notify('Saved', 'success')">Save</UiButton>
63
+ */
64
+ import { computed } from 'vue'
65
+ import UiIcon from '../icons/Icon.vue'
66
+
67
+ const props = defineProps({
68
+ /**
69
+ * The messages to show. Each is `{ id, message, type?, icon? }`, where `id`
70
+ * is stable and unique, `type` is one of the values below (default neutral),
71
+ * and `icon` is an optional MDI name.
72
+ * @type {Array<{ id: string|number, message: string, type?: string, icon?: string }>}
73
+ * @default []
74
+ */
75
+ toasts: { type: Array, default: () => [] },
76
+
77
+ /**
78
+ * Where the stack anchors on screen.
79
+ * @type {string}
80
+ * @default 'top'
81
+ * @values 'top' | 'bottom'
82
+ */
83
+ position: { type: String, default: 'top' },
84
+ })
85
+
86
+ const positionClass = computed(() => (props.position === 'bottom' ? 'bottom-6' : 'top-6'))
87
+
88
+ /**
89
+ * Toast colours are drawn from the design tokens (`success`/`warning`/`error`)
90
+ * rather than literal Tailwind palette names, so a rebrand of those ramps
91
+ * carries through here too. Anything unrecognised falls back to a neutral pill.
92
+ * @param {string} type
93
+ */
94
+ const toastClass = (type) => {
95
+ switch (type) {
96
+ case 'success':
97
+ return 'bg-success-600/90 text-white dark:bg-success-500/90'
98
+ case 'warning':
99
+ return 'bg-warning-500/90 text-white dark:bg-warning-500/90'
100
+ case 'error':
101
+ return 'bg-error-600/90 text-white dark:bg-error-500/90'
102
+ default:
103
+ return 'bg-gray-800/90 text-white dark:bg-gray-200/90 dark:text-gray-900'
104
+ }
105
+ }
106
+ </script>
@@ -12,11 +12,12 @@
12
12
  import Alert from './Alert.vue'
13
13
  import Avatar from './Avatar.vue'
14
14
  import Badge from './Badge.vue'
15
+ import Banner from './Banner.vue'
15
16
  import Breadcrumb from './Breadcrumb.vue'
16
17
  import Button from './Button.vue'
17
- import ButtonsGroup from './ButtonsGroup.vue'
18
18
  import Card from './Card.vue'
19
19
  import Checkbox from './Checkbox.vue'
20
+ import CodeBlock from './CodeBlock.vue'
20
21
  import Divider from './Divider.vue'
21
22
  import Dropdown from './Dropdown.vue'
22
23
  import DropdownItem from './DropdownItem.vue'
@@ -39,7 +40,11 @@ import SectionHeading from './SectionHeading.vue'
39
40
  import Segmented from './Segmented.vue'
40
41
  import Select from './Select.vue'
41
42
  import Slider from './Slider.vue'
43
+ import Spinner from './Spinner.vue'
42
44
  import Stepper from './Stepper.vue'
45
+ import Table from './Table.vue'
46
+ import ThemeToggle from './ThemeToggle.vue'
47
+ import Toast from './Toast.vue'
43
48
  import Toggle from './Toggle.vue'
44
49
  import Tooltip from './Tooltip.vue'
45
50
  import Icon from '../icons/Icon.vue'
@@ -48,11 +53,12 @@ export {
48
53
  Alert as UiAlert,
49
54
  Avatar as UiAvatar,
50
55
  Badge as UiBadge,
56
+ Banner as UiBanner,
51
57
  Breadcrumb as UiBreadcrumb,
52
58
  Button as UiButton,
53
- ButtonsGroup as UiButtonsGroup,
54
59
  Card as UiCard,
55
60
  Checkbox as UiCheckbox,
61
+ CodeBlock as UiCodeBlock,
56
62
  Divider as UiDivider,
57
63
  Dropdown as UiDropdown,
58
64
  DropdownItem as UiDropdownItem,
@@ -75,7 +81,11 @@ export {
75
81
  Segmented as UiSegmented,
76
82
  Select as UiSelect,
77
83
  Slider as UiSlider,
84
+ Spinner as UiSpinner,
78
85
  Stepper as UiStepper,
86
+ Table as UiTable,
87
+ ThemeToggle as UiThemeToggle,
88
+ Toast as UiToast,
79
89
  Toggle as UiToggle,
80
90
  Tooltip as UiTooltip,
81
91
  Icon as UiIcon,
@@ -90,11 +100,12 @@ export const components = {
90
100
  Alert,
91
101
  Avatar,
92
102
  Badge,
103
+ Banner,
93
104
  Breadcrumb,
94
105
  Button,
95
- ButtonsGroup,
96
106
  Card,
97
107
  Checkbox,
108
+ CodeBlock,
98
109
  Divider,
99
110
  Dropdown,
100
111
  DropdownItem,
@@ -117,7 +128,11 @@ export const components = {
117
128
  Segmented,
118
129
  Select,
119
130
  Slider,
131
+ Spinner,
120
132
  Stepper,
133
+ Table,
134
+ ThemeToggle,
135
+ Toast,
121
136
  Toggle,
122
137
  Tooltip,
123
138
  Icon,
@@ -0,0 +1,49 @@
1
+ import { computed, useAttrs, toValue } from 'vue'
2
+ import { twMerge } from 'tailwind-merge'
3
+
4
+ /**
5
+ * useMergedClasses — merge a component's internal Tailwind classes with the
6
+ * caller's `class`, letting the caller win, and split the remaining attributes
7
+ * off for forwarding.
8
+ *
9
+ * This is the shared half of the "external classes override internals" pattern
10
+ * that UiButton, UiCard and UiIconTile all implement identically: bind
11
+ * `mergedClasses` to the root element's `:class`, spread `restAttrs` onto it
12
+ * with `v-bind`, and declare `defineOptions({ inheritAttrs: false })` in the
13
+ * component so Vue does not also apply `class` a second time.
14
+ *
15
+ * `tailwind-merge` resolves conflicts by keeping the last occurrence, and the
16
+ * caller's `class` is always passed last — so `bg-gray-100` from the outside
17
+ * beats a built-in `bg-primary-600` rather than both landing on the element.
18
+ * Passing the internal classes as one space-joined string is equivalent to
19
+ * passing them as separate arguments; twMerge tokenises either the same way.
20
+ *
21
+ * `defineOptions` is a compiler macro and cannot live in a composable, so each
22
+ * consuming SFC still declares `inheritAttrs: false` itself. Everything else —
23
+ * `useAttrs`, the class/rest split, and the merge — lives here.
24
+ *
25
+ * @param {import('vue').MaybeRefOrGetter<string>} internal
26
+ * The component's own classes, as a ref, getter, or plain string. A getter is
27
+ * the safest form when the internal classes are a `computed` declared later
28
+ * in setup, since it defers evaluation past that declaration.
29
+ * @returns {{ mergedClasses: import('vue').ComputedRef<string>, restAttrs: import('vue').ComputedRef<Record<string, unknown>> }}
30
+ * `mergedClasses` for the root `:class`; `restAttrs` (everything except
31
+ * `class`) for `v-bind`.
32
+ *
33
+ * @example
34
+ * defineOptions({ inheritAttrs: false })
35
+ * const internal = computed(() => `inline-flex ${sizeClass.value} ${colorClass.value}`)
36
+ * const { mergedClasses, restAttrs } = useMergedClasses(internal)
37
+ */
38
+ export function useMergedClasses(internal) {
39
+ const attrs = useAttrs()
40
+
41
+ const restAttrs = computed(() => {
42
+ const { class: _class, ...rest } = attrs
43
+ return rest
44
+ })
45
+
46
+ const mergedClasses = computed(() => twMerge(toValue(internal), attrs.class))
47
+
48
+ return { mergedClasses, restAttrs }
49
+ }
package/src/icons/mdi.js CHANGED
@@ -25,13 +25,16 @@ export const mdiPaths = {
25
25
  'check': "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
26
26
  'check-circle': "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8z",
27
27
  'chevron-down': "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z",
28
+ 'chevron-left': "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z",
28
29
  'chevron-right': "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z",
29
30
  'chevron-up': "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z",
30
31
  'close': "M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z",
31
32
  'close-circle': "M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12S6.47 2 12 2m3.59 5L12 10.59L8.41 7L7 8.41L10.59 12L7 15.59L8.41 17L12 13.41L15.59 17L17 15.59L13.41 12L17 8.41z",
33
+ 'content-copy': "M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z",
32
34
  'delete': "M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6z",
33
35
  'dots-vertical': "M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2",
34
36
  'email': "m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2",
37
+ 'email-alert-outline': "M24 7h-2v6h2zm0 8h-2v2h2zm-4-9c0-1.1-.9-2-2-2H2C.9 4 0 4.9 0 6v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2zm-2 0l-8 5l-8-5zm0 12H2V8l8 5l8-5z",
35
38
  'eraser': "m16.24 3.56l4.95 4.94c.78.79.78 2.05 0 2.84L12 20.53a4.01 4.01 0 0 1-5.66 0L2.81 17c-.78-.79-.78-2.05 0-2.84l10.6-10.6c.79-.78 2.05-.78 2.83 0M4.22 15.58l3.54 3.53c.78.79 2.04.79 2.83 0l3.53-3.53l-4.95-4.95z",
36
39
  'eye-off-outline': "M2 5.27L3.28 4L20 20.72L18.73 22l-3.08-3.08c-1.15.38-2.37.58-3.65.58c-5 0-9.27-3.11-11-7.5c.69-1.76 1.79-3.31 3.19-4.54zM12 9a3 3 0 0 1 3 3a3 3 0 0 1-.17 1L11 9.17A3 3 0 0 1 12 9m0-4.5c5 0 9.27 3.11 11 7.5a11.8 11.8 0 0 1-4 5.19l-1.42-1.43A9.86 9.86 0 0 0 20.82 12A9.82 9.82 0 0 0 12 6.5c-1.09 0-2.16.18-3.16.5L7.3 5.47c1.44-.62 3.03-.97 4.7-.97M3.18 12A9.82 9.82 0 0 0 12 17.5c.69 0 1.37-.07 2-.21L11.72 15A3.064 3.064 0 0 1 9 12.28L5.6 8.87c-.99.85-1.82 1.91-2.42 3.13",
37
40
  'eye-outline': "M12 9a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3m0-4.5c5 0 9.27 3.11 11 7.5c-1.73 4.39-6 7.5-11 7.5S2.73 16.39 1 12c1.73-4.39 6-7.5 11-7.5M3.18 12a9.821 9.821 0 0 0 17.64 0a9.821 9.821 0 0 0-17.64 0",
@@ -43,15 +46,22 @@ export const mdiPaths = {
43
46
  'lock': "M12 17a2 2 0 0 0 2-2a2 2 0 0 0-2-2a2 2 0 0 0-2 2a2 2 0 0 0 2 2m6-9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h1V6a5 5 0 0 1 5-5a5 5 0 0 1 5 5v2zm-6-5a3 3 0 0 0-3 3v2h6V6a3 3 0 0 0-3-3",
44
47
  'logout': "m17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5M4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z",
45
48
  'minus': "M19 13H5v-2h14z",
49
+ 'minus-circle-outline': "M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2M7 13h10v-2H7",
50
+ 'note-text-outline': "M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9zm4 16H5V5h9v5h5m-2 4H7v-2h10m-3 5H7v-2h7",
46
51
  'pen': "M20.71 7.04c-.34.34-.67.67-.68 1c-.03.32.31.65.63.96c.48.5.95.95.93 1.44s-.53 1-1.04 1.5l-4.13 4.14L15 14.66l4.25-4.24l-.96-.96l-1.42 1.41l-3.75-3.75l3.84-3.83c.39-.39 1.04-.39 1.41 0l2.34 2.34c.39.37.39 1.02 0 1.41M3 17.25l9.56-9.57l3.75 3.75L6.75 21H3z",
47
52
  'pencil': "M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z",
48
53
  'plus': "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z",
49
54
  'share': "m21 12l-7-7v4C7 10 4 15 3 20c2.5-3.5 6-5.1 11-5.1V19z",
55
+ 'shield-lock-outline': "M21 11c0 5.55-3.84 10.74-9 12c-5.16-1.26-9-6.45-9-12V5l9-4l9 4zm-9 10c3.75-1 7-5.46 7-9.78V6.3l-7-3.12L5 6.3v4.92C5 15.54 8.25 20 12 21m2.8-10V9.5C14.8 8.1 13.4 7 12 7S9.2 8.1 9.2 9.5V11c-.6 0-1.2.6-1.2 1.2v3.5c0 .7.6 1.3 1.2 1.3h5.5c.7 0 1.3-.6 1.3-1.2v-3.5c0-.7-.6-1.3-1.2-1.3m-1.3 0h-3V9.5c0-.8.7-1.3 1.5-1.3s1.5.5 1.5 1.3z",
56
+ 'sync': "M12 18a6 6 0 0 1-6-6c0-1 .25-1.97.7-2.8L5.24 7.74A7.93 7.93 0 0 0 4 12a8 8 0 0 0 8 8v3l4-4l-4-4m0-11V1L8 5l4 4V6a6 6 0 0 1 6 6c0 1-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12a8 8 0 0 0-8-8",
50
57
  'translate': "m12.87 15.07l-2.54-2.51l.03-.03A17.5 17.5 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35C8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5l3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7l1.62-4.33L19.12 17z",
51
58
  'trash-can': "M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zm0 5h2v9H9zm4 0h2v9h-2z",
52
59
  'trash-can-outline': "M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zM7 6h10v13H7zm2 2v9h2V8zm4 0v9h2V8z",
53
60
  'view-grid': "M3 11h8V3H3m0 18h8v-8H3m10 8h8v-8h-8m0-10v8h8V3",
54
61
  'view-list': "M9 5v4h12V5M9 19h12v-4H9m0-1h12v-4H9M4 9h4V5H4m0 14h4v-4H4m0-1h4v-4H4z",
62
+ 'weather-night': "m17.75 4.09l-2.53 1.94l.91 3.06l-2.63-1.81l-2.63 1.81l.91-3.06l-2.53-1.94L12.44 4l1.06-3l1.06 3zm3.5 6.91l-1.64 1.25l.59 1.98l-1.7-1.17l-1.7 1.17l.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95zm-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85c-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14c.4-.4.82-.76 1.27-1.08c.75-.53 1.93.36 1.85 1.19c-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82c-2.81 3.14-2.7 7.96.31 10.98c3.02 3.01 7.84 3.12 10.98.31",
63
+ 'weather-sunny': "M12 7a5 5 0 0 1 5 5a5 5 0 0 1-5 5a5 5 0 0 1-5-5a5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3m0-7l2.39 3.42C13.65 5.15 12.84 5 12 5s-1.65.15-2.39.42zM3.34 7l4.16-.35A7.2 7.2 0 0 0 5.94 8.5c-.44.74-.69 1.5-.83 2.29zm.02 10l1.76-3.77a7.13 7.13 0 0 0 2.38 4.14zM20.65 7l-1.77 3.79a7.02 7.02 0 0 0-2.38-4.15zm-.01 10l-4.14.36c.59-.51 1.12-1.14 1.54-1.86c.42-.73.69-1.5.83-2.29zM12 22l-2.41-3.44c.74.27 1.55.44 2.41.44c.82 0 1.63-.17 2.37-.44z",
64
+ 'wifi-off': "M2.28 3L1 4.27l1.47 1.47c-.43.26-.86.55-1.27.86L3 9c.53-.4 1.08-.75 1.66-1.07l2.23 2.23c-.74.34-1.45.75-2.09 1.24l1.8 2.4c.78-.58 1.66-1.03 2.6-1.33L11.75 15c-1.25.07-2.41.5-3.35 1.2L12 21l2.46-3.27L17.74 21L19 19.72M12 3c-2.15 0-4.2.38-6.1 1.07l2.39 2.4C9.5 6.16 10.72 6 12 6c3.38 0 6.5 1.11 9 3l1.8-2.4C19.79 4.34 16.06 3 12 3m0 6c-.38 0-.75 0-1.12.05l3.19 3.2c1.22.28 2.36.82 3.33 1.55l1.8-2.4C17.2 9.89 14.7 9 12 9",
55
65
  'wrap': "M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3l4 3v-2h2c2.95 0 4-1.27 4-4c0-2.72-1-4-4-4H3z",
56
66
  }
57
67
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Size scale shared by the native checkable inputs (`UiCheckbox`, `UiRadio`).
3
+ *
4
+ * Both render a native `<input>` and size it with the same width/height classes;
5
+ * the map lived duplicated in each. A checkbox and a radio stay separate
6
+ * components because their HTML semantics differ, but their sizing does not.
7
+ *
8
+ * @param {string} size One of `sm` | `md` | `lg`. Anything else falls back to `md`.
9
+ * @returns {string} The width/height utility classes for that size.
10
+ */
11
+ export const CHECKABLE_SIZES = {
12
+ sm: 'w-3.5 h-3.5',
13
+ md: 'w-4 h-4',
14
+ lg: 'w-5 h-5',
15
+ }
16
+
17
+ export const checkableSizeClass = (size) => CHECKABLE_SIZES[size] ?? CHECKABLE_SIZES.md
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared chrome for floating menu surfaces.
3
+ *
4
+ * `UiDropdown`, `UiSelect`, `UiPopup` and `UiDropdownSubmenu` are four different
5
+ * takes on "a panel that floats over the page" — they differ in how they are
6
+ * positioned (absolute vs fixed vs teleported) and dismissed, which is why they
7
+ * remain separate components. What they share is the *look* of the panel: the
8
+ * surface colour, border, radius and shadow. That string lived copied verbatim
9
+ * in all four, so a tweak to the shared look meant editing four files and hoping
10
+ * none drifted. It now lives here.
11
+ *
12
+ * Positioning, z-index, padding and `overflow` stay at each call site, since
13
+ * those genuinely differ between the four.
14
+ */
15
+ export const MENU_PANEL_CLASS =
16
+ 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg'
package/src/manifest.js CHANGED
@@ -23,11 +23,12 @@ export const COMPONENT_NAMES = [
23
23
  'Alert',
24
24
  'Avatar',
25
25
  'Badge',
26
+ 'Banner',
26
27
  'Breadcrumb',
27
28
  'Button',
28
- 'ButtonsGroup',
29
29
  'Card',
30
30
  'Checkbox',
31
+ 'CodeBlock',
31
32
  'Divider',
32
33
  'Dropdown',
33
34
  'DropdownItem',
@@ -50,7 +51,11 @@ export const COMPONENT_NAMES = [
50
51
  'Segmented',
51
52
  'Select',
52
53
  'Slider',
54
+ 'Spinner',
53
55
  'Stepper',
56
+ 'Table',
57
+ 'ThemeToggle',
58
+ 'Toast',
54
59
  'Toggle',
55
60
  'Tooltip',
56
61
  ]
@@ -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,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>