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
@@ -51,8 +51,8 @@
51
51
  * @slot header — Optional header, drawn above the body with a divider.
52
52
  * @slot footer — Optional footer, drawn below the body with a divider.
53
53
  */
54
- import { computed, useAttrs } from 'vue'
55
- import { twMerge } from 'tailwind-merge'
54
+ import { computed } from 'vue'
55
+ import { useMergedClasses } from '../composables/useMergedClasses.js'
56
56
 
57
57
  const props = defineProps({
58
58
  /**
@@ -125,12 +125,6 @@ const props = defineProps({
125
125
 
126
126
  defineOptions({ inheritAttrs: false })
127
127
 
128
- const attrs = useAttrs()
129
- const restAttrs = computed(() => {
130
- const { class: _class, ...rest } = attrs
131
- return rest
132
- })
133
-
134
128
  const paddingClass = computed(
135
129
  () => ({ none: '', xs: 'p-3', sm: 'p-4', md: 'p-5', lg: 'p-6' })[props.padding] ?? 'p-5',
136
130
  )
@@ -146,8 +140,10 @@ const shadowClass = computed(
146
140
  'shadow-card',
147
141
  )
148
142
 
149
- const mergedClasses = computed(() =>
150
- twMerge(
143
+ // External classes merge last so a caller's `hover:border-primary-300` wins
144
+ // over the neutral hover border rather than doubling up.
145
+ const internalClasses = computed(() =>
146
+ [
151
147
  'bg-white dark:bg-gray-900',
152
148
  props.focusRing ? 'relative' : '',
153
149
  radiusClass.value,
@@ -163,7 +159,10 @@ const mergedClasses = computed(() =>
163
159
  ? 'focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-primary-500 dark:focus-within:outline-primary-400'
164
160
  : '',
165
161
  paddingClass.value,
166
- attrs.class,
167
- ),
162
+ ]
163
+ .filter(Boolean)
164
+ .join(' '),
168
165
  )
166
+
167
+ const { mergedClasses, restAttrs } = useMergedClasses(internalClasses)
169
168
  </script>
@@ -30,6 +30,7 @@
30
30
  * @emits {Event} change — Emitted with the native change event
31
31
  */
32
32
  import { computed } from 'vue'
33
+ import { checkableSizeClass } from '../internal/controlSizes.js'
33
34
  const props = defineProps({
34
35
  /**
35
36
  * Controlled checked state (v-model). Takes priority over `checked` when defined.
@@ -63,16 +64,7 @@ const props = defineProps({
63
64
 
64
65
  const emit = defineEmits(['update:modelValue', 'change'])
65
66
 
66
- const sizeClass = computed(() => {
67
- switch (props.size) {
68
- case 'sm':
69
- return 'w-3.5 h-3.5'
70
- case 'lg':
71
- return 'w-5 h-5'
72
- default:
73
- return 'w-4 h-4'
74
- }
75
- })
67
+ const sizeClass = computed(() => checkableSizeClass(props.size))
76
68
 
77
69
  function onChange(e) {
78
70
  emit('update:modelValue', e.target.checked)
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <div class="group relative">
3
+ <div
4
+ v-if="label"
5
+ class="flex items-center justify-between rounded-t-xl border border-b-0 border-gray-200 bg-gray-50 px-4 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-400"
6
+ >
7
+ <span>{{ label }}</span>
8
+ </div>
9
+
10
+ <button
11
+ type="button"
12
+ class="absolute right-2 z-10 inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white/80 px-2.5 py-1.5 text-xs font-medium text-gray-600 opacity-0 backdrop-blur transition-all hover:bg-white hover:text-gray-900 focus-visible:opacity-100 group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"
13
+ :class="label ? 'top-11' : 'top-2'"
14
+ :aria-label="copied ? copiedLabel : copyLabel"
15
+ @click="copy"
16
+ >
17
+ <UiIcon
18
+ :name="copied ? 'mdi:check' : 'mdi:content-copy'"
19
+ class="size-3.5"
20
+ :class="copied ? 'text-success-600 dark:text-success-400' : ''"
21
+ />
22
+ {{ copied ? copiedLabel : copyLabel }}
23
+ </button>
24
+
25
+ <pre
26
+ class="overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700"
27
+ :class="label ? 'rounded-b-xl' : 'rounded-xl'"
28
+ ><code>{{ code }}</code></pre>
29
+ </div>
30
+ </template>
31
+
32
+ <script setup>
33
+ /**
34
+ * UiCodeBlock — a static, copyable code snippet.
35
+ *
36
+ * For code that documents itself rather than runs: install commands, config,
37
+ * import statements. A copy button fades in on hover or keyboard focus, so it
38
+ * stays out of the way while reading and confirms with a tick for a moment after
39
+ * a successful copy. An optional `label` renders a filename/language caption
40
+ * across the top.
41
+ *
42
+ * The copy uses the async Clipboard API and fails silently if it is
43
+ * unavailable (an insecure context, or permission denied) — a docs snippet
44
+ * should never throw because the clipboard was blocked. The button's labels are
45
+ * props rather than fixed strings so the component carries no baked-in language.
46
+ *
47
+ * @example
48
+ * <UiCodeBlock label="Terminal" code="npm install numori-ui" />
49
+ *
50
+ * @example Localised button labels
51
+ * <UiCodeBlock :code="snippet" :copy-label="$t('ui.copy')" :copied-label="$t('ui.copied')" />
52
+ */
53
+ import { ref } from 'vue'
54
+ import UiIcon from '../icons/Icon.vue'
55
+
56
+ const props = defineProps({
57
+ /**
58
+ * The snippet text.
59
+ * @type {string}
60
+ */
61
+ code: { type: String, required: true },
62
+
63
+ /**
64
+ * Optional filename/language caption shown above the block.
65
+ * @type {string}
66
+ * @default ''
67
+ */
68
+ label: { type: String, default: '' },
69
+
70
+ /**
71
+ * Label for the copy button in its resting state.
72
+ * @type {string}
73
+ * @default 'Copy'
74
+ */
75
+ copyLabel: { type: String, default: 'Copy' },
76
+
77
+ /**
78
+ * Label shown briefly after a successful copy.
79
+ * @type {string}
80
+ * @default 'Copied'
81
+ */
82
+ copiedLabel: { type: String, default: 'Copied' },
83
+ })
84
+
85
+ const copied = ref(false)
86
+
87
+ async function copy() {
88
+ try {
89
+ await navigator.clipboard.writeText(props.code)
90
+ copied.value = true
91
+ setTimeout(() => {
92
+ copied.value = false
93
+ }, 1600)
94
+ } catch {
95
+ // Clipboard unavailable (insecure context or denied permission); ignore
96
+ // rather than throw for a snippet whose whole job is to sit there and read.
97
+ }
98
+ }
99
+ </script>
@@ -12,7 +12,7 @@
12
12
  :leave-from-class="transitionClasses.leaveFrom"
13
13
  :leave-to-class="transitionClasses.leaveTo"
14
14
  >
15
- <div v-show="isOpen" :class="panelClasses">
15
+ <div v-show="isOpen" :class="panelClasses" :style="{ transformOrigin: panelOrigin }">
16
16
  <slot :close="close" />
17
17
  </div>
18
18
  </Transition>
@@ -59,6 +59,7 @@
59
59
  import { ref, computed } from 'vue'
60
60
  import { onClickOutside } from '../composables/onClickOutside.js'
61
61
  import { useEventListener } from '../composables/useEventListener.js'
62
+ import { MENU_PANEL_CLASS } from '../internal/menu.js'
62
63
  const props = defineProps({
63
64
  /**
64
65
  * Width class applied to the dropdown panel.
@@ -103,7 +104,18 @@ const panelClasses = computed(() => {
103
104
  if (props.panelClass) return props.panelClass
104
105
  const align = props.align === 'right' ? 'right-0' : 'left-0'
105
106
  const dropDir = props.drop === 'up' ? 'bottom-full mb-1' : 'mt-1'
106
- return `absolute z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 ${props.width} ${align} ${dropDir}`
107
+ // `p-1` (not just `py-1`) insets the rows so their rounded hover highlight
108
+ // reads as a chip with breathing room from the panel edge.
109
+ return `absolute z-50 ${MENU_PANEL_CLASS} p-1 ${props.width} ${align} ${dropDir}`
110
+ })
111
+
112
+ // Inline transform-origin (not a Tailwind class, so it needs no build step to
113
+ // take effect): the panel scales in from the corner nearest the trigger rather
114
+ // than drifting in from its centre.
115
+ const panelOrigin = computed(() => {
116
+ const y = props.drop === 'up' ? 'bottom' : 'top'
117
+ const x = props.align === 'right' ? 'right' : 'left'
118
+ return `${y} ${x}`
107
119
  })
108
120
 
109
121
  // Use slide-up transition for drop="up", scale transition for drop="down"
@@ -42,8 +42,9 @@
42
42
  >
43
43
  <div
44
44
  v-if="showSub && !disabled && !isMobile"
45
- class="absolute top-0 w-52 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50"
46
- :class="alignLeft ? 'right-full mr-1' : 'left-full ml-1'"
45
+ class="absolute top-0 w-52 py-1 z-50"
46
+ :class="[MENU_PANEL_CLASS, alignLeft ? 'right-full mr-1' : 'left-full ml-1']"
47
+ :style="{ transformOrigin: alignLeft ? 'top right' : 'top left' }"
47
48
  >
48
49
  <slot />
49
50
  </div>
@@ -78,6 +79,7 @@
78
79
  import { ref, onMounted, onUnmounted } from 'vue'
79
80
  import UiButton from './Button.vue'
80
81
  import UiIcon from '../icons/Icon.vue'
82
+ import { MENU_PANEL_CLASS } from '../internal/menu.js'
81
83
  defineProps({
82
84
  /**
83
85
  * MDI icon name displayed at the start of the trigger row.
@@ -1,8 +1,13 @@
1
1
  <template>
2
- <!-- Clickable label wrapping a hidden file input — slot content acts as the visible trigger -->
3
- <label
2
+ <!-- Clickable wrapper around a hidden file input — slot content is the visible trigger.
3
+ A plain <label> would not work when the slot is a <button> (or any interactive
4
+ element): the browser skips label→control forwarding when the click lands on an
5
+ interactive descendant, so the picker never opened. Handling the click ourselves
6
+ makes any trigger content work. -->
7
+ <span
4
8
  class="inline-flex items-center gap-2 cursor-pointer transition-colors"
5
9
  :class="disabled ? 'opacity-50 pointer-events-none' : ''"
10
+ @click="onTriggerClick"
6
11
  >
7
12
  <slot />
8
13
  <input
@@ -13,8 +18,9 @@
13
18
  :multiple="multiple"
14
19
  :disabled="disabled"
15
20
  @change="onChange"
21
+ @click.stop
16
22
  />
17
- </label>
23
+ </span>
18
24
  </template>
19
25
 
20
26
  <script setup>
@@ -100,8 +106,17 @@ function onChange(e) {
100
106
  e.target.value = ''
101
107
  }
102
108
 
109
+ const open = () => inputRef.value?.click()
110
+
111
+ // A click anywhere in the wrapper opens the picker. The hidden input's own
112
+ // (programmatic) click is stopped from bubbling via `@click.stop` in the
113
+ // template, so this never re-enters itself.
114
+ const onTriggerClick = () => {
115
+ if (!props.disabled) open()
116
+ }
117
+
103
118
  defineExpose({
104
- open: () => inputRef.value?.click(),
119
+ open,
105
120
  el: inputRef,
106
121
  })
107
122
  </script>
@@ -24,8 +24,8 @@
24
24
  * @example Success tile
25
25
  * <UiIconTile icon="mdi:check" color="success" size="sm" />
26
26
  */
27
- import { computed, useAttrs } from 'vue'
28
- import { twMerge } from 'tailwind-merge'
27
+ import { computed } from 'vue'
28
+ import { useMergedClasses } from '../composables/useMergedClasses.js'
29
29
  import UiIcon from '../icons/Icon.vue'
30
30
 
31
31
  const props = defineProps({
@@ -87,14 +87,9 @@ const colorClass = computed(
87
87
 
88
88
  defineOptions({ inheritAttrs: false })
89
89
 
90
- const attrs = useAttrs()
91
- const restAttrs = computed(() => {
92
- const { class: _class, ...rest } = attrs
93
- return rest
94
- })
95
-
96
90
  // External classes merge last so a caller's `bg-*`/`text-*` (e.g. a Tailwind
97
91
  // palette outside the semantic set) overrides the built-in tint rather than
98
92
  // colliding with it.
99
- const mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class))
93
+ const internalClasses = computed(() => `${sizeClass.value} ${colorClass.value}`)
94
+ const { mergedClasses, restAttrs } = useMergedClasses(internalClasses)
100
95
  </script>
@@ -17,13 +17,13 @@
17
17
  <!-- Number stepper: stacked up/down buttons on left -->
18
18
  <div
19
19
  v-if="isNumber && stepperLayout === 'stacked-left'"
20
- class="flex flex-col w-6 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden"
20
+ class="flex flex-col w-7 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden"
21
21
  :class="{ 'opacity-50 pointer-events-none': disabled }"
22
22
  >
23
23
  <button
24
24
  type="button"
25
25
  tabindex="-1"
26
- class="grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600"
26
+ class="grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600"
27
27
  aria-label="Increase value"
28
28
  @click="stepUp"
29
29
  >
@@ -32,7 +32,7 @@
32
32
  <button
33
33
  type="button"
34
34
  tabindex="-1"
35
- class="grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none"
35
+ class="grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none"
36
36
  aria-label="Decrease value"
37
37
  @click="stepDown"
38
38
  >
@@ -140,13 +140,13 @@
140
140
  <!-- Number stepper: stacked up/down buttons on right -->
141
141
  <div
142
142
  v-if="isNumber && stepperLayout === 'stacked-right'"
143
- class="flex flex-col w-6 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden"
143
+ class="flex flex-col w-7 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden"
144
144
  :class="{ 'opacity-50 pointer-events-none': disabled }"
145
145
  >
146
146
  <button
147
147
  type="button"
148
148
  tabindex="-1"
149
- class="grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600"
149
+ class="grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600"
150
150
  aria-label="Increase value"
151
151
  @click="stepUp"
152
152
  >
@@ -155,7 +155,7 @@
155
155
  <button
156
156
  type="button"
157
157
  tabindex="-1"
158
- class="grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none"
158
+ class="grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none"
159
159
  aria-label="Decrease value"
160
160
  @click="stepDown"
161
161
  >
@@ -1,11 +1,17 @@
1
1
  <template>
2
- <component
3
- :is="isInteractive ? 'button' : 'div'"
4
- :type="isInteractive ? 'button' : undefined"
2
+ <!-- A <div role="button"> rather than a real <button> when interactive: the
3
+ suffix slot commonly holds interactive controls (UiToggle, UiSelect —
4
+ both <button>s), and nesting a <button> inside a <button> is invalid HTML
5
+ the browser restructures, which breaks SSR hydration. A <div> can legally
6
+ contain those controls. -->
7
+ <div
5
8
  class="w-full flex items-center gap-3 text-sm text-left transition-colors"
6
9
  :class="[sizeClass, colorClass]"
7
- :disabled="isInteractive ? disabled : undefined"
10
+ :role="isInteractive ? 'button' : undefined"
11
+ :tabindex="isInteractive && !disabled ? 0 : undefined"
12
+ :aria-disabled="isInteractive && disabled ? 'true' : undefined"
8
13
  @click="handleClick"
14
+ @keydown="onKeydown"
9
15
  >
10
16
  <UiIcon
11
17
  v-if="icon"
@@ -29,7 +35,7 @@
29
35
  />
30
36
  </slot>
31
37
  </div>
32
- </component>
38
+ </div>
33
39
  </template>
34
40
 
35
41
  <script setup>
@@ -125,6 +131,16 @@ const handleClick = () => {
125
131
  }
126
132
  }
127
133
 
134
+ // Keep the row keyboard-operable now that it is a div[role=button] rather than
135
+ // a native button.
136
+ const onKeydown = (e) => {
137
+ if (!isInteractive.value || props.disabled) return
138
+ if (e.key === 'Enter' || e.key === ' ') {
139
+ e.preventDefault()
140
+ handleClick()
141
+ }
142
+ }
143
+
128
144
  const handleSuffixClick = (e) => {
129
145
  // For toggle rows, clicking the suffix (the toggle itself) should also toggle
130
146
  if (isToggle.value && !props.disabled) {
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div ref="numpadRef" class="grid grid-cols-3 gap-3 max-w-[264px] mx-auto outline-none">
2
+ <div
3
+ ref="numpadRef"
4
+ class="grid grid-cols-3 gap-3 min-w-[264px] max-w-[264px] mx-auto outline-none"
5
+ >
3
6
  <button
4
7
  v-for="n in [1, 2, 3, 4, 5, 6, 7, 8, 9]"
5
8
  :key="n"
@@ -9,7 +12,7 @@
9
12
  :class="
10
13
  pressedKey === n
11
14
  ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'
12
- : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700'
15
+ : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'
13
16
  "
14
17
  :disabled="disabled"
15
18
  @click="onDigit(n)"
@@ -29,7 +32,7 @@
29
32
  :class="
30
33
  pressedKey === 0
31
34
  ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'
32
- : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700'
35
+ : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'
33
36
  "
34
37
  :disabled="disabled"
35
38
  @click="onDigit(0)"
@@ -40,7 +43,7 @@
40
43
  <button
41
44
  type="button"
42
45
  tabindex="-1"
43
- class="h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 active:scale-95 disabled:opacity-30 disabled:pointer-events-none"
46
+ class="h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 active:scale-95 disabled:opacity-30 disabled:pointer-events-none"
44
47
  :disabled="!canDelete"
45
48
  @click="$emit('delete')"
46
49
  >
@@ -14,8 +14,8 @@
14
14
  <div
15
15
  v-if="show"
16
16
  ref="panelRef"
17
- class="absolute bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1"
18
- :class="[width, panelZ]"
17
+ class="absolute py-1"
18
+ :class="[MENU_PANEL_CLASS, width, panelZ]"
19
19
  :style="positionStyle"
20
20
  >
21
21
  <slot />
@@ -48,6 +48,7 @@
48
48
  * @slot default — Popup content
49
49
  */
50
50
  import { ref, computed, watch, nextTick } from 'vue'
51
+ import { MENU_PANEL_CLASS } from '../internal/menu.js'
51
52
  const props = defineProps({
52
53
  /**
53
54
  * Controls popup visibility.
@@ -107,6 +108,9 @@ const clampedPos = ref({ left: 0, top: 0 })
107
108
  const positionStyle = computed(() => ({
108
109
  left: clampedPos.value.left + 'px',
109
110
  top: clampedPos.value.top + 'px',
111
+ // Inline (not a Tailwind class) so the popup reliably scales in from its
112
+ // top-left corner rather than drifting in from its centre.
113
+ transformOrigin: 'top left',
110
114
  }))
111
115
 
112
116
  // Clamp the panel position so it stays within the viewport (8px margin)
@@ -23,6 +23,7 @@
23
23
  * <UiRadio v-model="selected" value="b" name="choice" />
24
24
  */
25
25
  import { computed } from 'vue'
26
+ import { checkableSizeClass } from '../internal/controlSizes.js'
26
27
  const props = defineProps({
27
28
  modelValue: { type: [String, Number, Boolean], default: null },
28
29
  value: { type: [String, Number, Boolean], required: true },
@@ -33,16 +34,7 @@ const props = defineProps({
33
34
 
34
35
  const emit = defineEmits(['update:modelValue'])
35
36
 
36
- const sizeClass = computed(() => {
37
- switch (props.size) {
38
- case 'sm':
39
- return 'w-3.5 h-3.5'
40
- case 'lg':
41
- return 'w-5 h-5'
42
- default:
43
- return 'w-4 h-4'
44
- }
45
- })
37
+ const sizeClass = computed(() => checkableSizeClass(props.size))
46
38
 
47
39
  function onChange() {
48
40
  emit('update:modelValue', props.value)