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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["/**\n * Numori UI — the Numori design system as a standalone Vue 3 component library.\n *\n * This is the framework-agnostic entry point. It works in any Vue 3 app with\n * no build-tool integration at all:\n *\n * import { createApp } from 'vue'\n * import NumoriUI from 'numori-ui'\n * import './app.css' // @import \"tailwindcss\"; @import \"numori-ui/css\";\n *\n * createApp(App).use(NumoriUI).mount('#app')\n *\n * For a nicer developer experience there are two build-tool integrations that\n * register the components for you, so templates need no imports:\n *\n * - `numori-ui/nuxt` — a Nuxt module\n * - `numori-ui/vite` — a Vite plugin\n *\n * Styling is Tailwind CSS v4 and is deliberately NOT bundled as compiled CSS.\n * The components are plain utility classes, so they inherit the host app's\n * Tailwind build: one pass, one stylesheet, no duplication, and every token is\n * overridable. All the host has to do is import `numori-ui/css`, which supplies\n * the design tokens and tells Tailwind to scan this package for classes.\n */\n\nimport { components } from './components/index.js'\nimport { DEFAULT_PREFIX, prefixed } from './manifest.js'\nimport { ICON_COMPONENT_KEY } from './icons/resolver.js'\nimport { registerIcons } from './icons/registry.js'\n\nexport * from './components/index.js'\n\nexport { DEFAULT_PREFIX, COMPONENT_NAMES, componentEntries, prefixed } from './manifest.js'\nexport { registerIcons, iconRegistry, resolveIconPath } from './icons/registry.js'\nexport { provideIconComponent, useIconComponent, ICON_COMPONENT_KEY } from './icons/resolver.js'\nexport { MDI_VIEW_BOX, mdiPaths, mdiIconNames } from './icons/mdi.js'\nexport { useBackButton } from './composables/useBackButton.js'\nexport { onClickOutside } from './composables/onClickOutside.js'\nexport { useEventListener } from './composables/useEventListener.js'\n\n/**\n * Vue plugin that globally registers every Numori UI component.\n *\n * @type {import('vue').Plugin}\n *\n * @param {import('vue').App} app\n * @param {object} [options]\n * @param {string} [options.prefix='Ui']\n * Prefix for registered tags. `'Ui'` gives `<UiButton>`. Must be non-empty —\n * see the note in `install` for why.\n * @param {string[]} [options.include]\n * Register only these base names (e.g. `['Button', 'Modal']`). Note this\n * affects *global registration* only — it is not tree-shaking. To actually\n * drop unused components from the bundle, skip the plugin and import the\n * components you use directly.\n * @param {string[]} [options.exclude]\n * Skip these base names. Useful when the host has its own `<UiButton>`.\n * @param {object} [options.icons]\n * @param {import('vue').Component|string} [options.icons.component]\n * Render all icons with this component instead of the bundled inline SVGs.\n * Receives a `name` prop and must forward `class` to its root element.\n * @param {Record<string,string>} [options.icons.extra]\n * Extra icon path data to add to the bundled set, keyed by name.\n *\n * @example Default registration\n * app.use(NumoriUI)\n *\n * @example Custom prefix\n * app.use(NumoriUI, { prefix: 'N' }) // <NButton>\n *\n * @example Delegate icons to an existing icon component\n * app.use(NumoriUI, { icons: { component: MyIcon } })\n */\nexport const NumoriUI = {\n install(app, options = {}) {\n const { prefix = DEFAULT_PREFIX, include, exclude = [], icons = {} } = options\n\n // An empty prefix is rejected rather than merely discouraged. `Button`\n // renders its root as `<component :is=\"tag\">` with `tag` defaulting to\n // `'button'`, and Vue's dynamic-component lookup capitalises before\n // matching — so a globally registered `Button` would resolve `'button'`\n // back to itself and recurse until the stack blows. The failure is a bare\n // \"Maximum call stack size exceeded\" with no hint of the cause, so it is\n // much kinder to refuse up front.\n if (typeof prefix !== 'string' || prefix.length === 0) {\n throw new Error(\n '[numori-ui] `prefix` must be a non-empty string. Registering components under their ' +\n 'bare names would make <Button> resolve its own native `button` root element, ' +\n 'recursing infinitely. Use a prefix such as \"Ui\" or \"N\".',\n )\n }\n\n if (icons.extra) registerIcons(icons.extra)\n // app-level provide, so it reaches every component including those\n // teleported out of the tree (modals, select panels).\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n if (include && !include.includes(name)) continue\n if (exclude.includes(name)) continue\n app.component(prefixed(name, prefix), component)\n }\n },\n}\n\nexport default NumoriUI\n\n/**\n * Build a Vue plugin that globally registers only the components you hand it.\n *\n * `NumoriUI` is convenient but it is not tree-shakeable: to register everything\n * it has to reference everything, so `app.use(NumoriUI)` puts all 29 components\n * in your bundle (~82 kB) whether you render them or not. The `include` option\n * does not change that — it controls registration, not bundling.\n *\n * This factory is the way to get both. You import the components you want, so\n * the bundler sees exactly that set and drops the rest, and you still get global\n * tags instead of importing them into every file.\n *\n * Keys become the registered tag names verbatim, so no prefix option is needed\n * and there is no naming magic — rename in the object literal if you want a\n * different tag.\n *\n * @param {Record<string, import('vue').Component>} components\n * Map of tag name to component, e.g. `{ UiButton, UiModal }`.\n * @param {object} [options]\n * @param {object} [options.icons] Same shape as the `NumoriUI` plugin's option.\n * @returns {import('vue').Plugin}\n *\n * @example Global tags, but only two components bundled\n * import { createNumoriUI, UiButton, UiModal } from 'numori-ui'\n *\n * app.use(createNumoriUI({ UiButton, UiModal }))\n *\n * @example Registering under different tag names\n * app.use(createNumoriUI({ NButton: UiButton, NModal: UiModal }))\n */\nexport function createNumoriUI(components = {}, options = {}) {\n const { icons = {} } = options\n\n // `UiButton` renders its root as `<component :is=\"tag\">`, and Vue capitalises\n // when resolving a dynamic component. Registering it under a name that\n // case-insensitively matches one of those tags would make it resolve itself\n // and recurse until the stack overflows, reported only as \"Maximum call stack\n // size exceeded\". Cheap to catch here, miserable to debug later.\n const DYNAMIC_TAGS = ['button', 'a', 'div', 'span', 'label', 'li']\n for (const name of Object.keys(components)) {\n if (DYNAMIC_TAGS.includes(name.toLowerCase())) {\n throw new Error(\n `[numori-ui] Cannot register a component as \"${name}\": it collides with the native <${name.toLowerCase()}> ` +\n 'element that UiButton can render as its root, which would recurse infinitely. ' +\n `Use a prefixed name such as \"Ui${name}\".`,\n )\n }\n }\n\n return {\n install(app) {\n if (icons.extra) registerIcons(icons.extra)\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n app.component(name, component)\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAa,WAAW,EACtB,QAAQ,KAAK,UAAU,CAAC,GAAG;CACzB,MAAM,EAAE,SAAA,MAAyB,SAAS,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM;CASvE,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAClD,MAAM,IAAI,MACR,8NAGF;CAGF,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;CAG1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;CAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GAAG;EAC1D,IAAI,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG;EACxC,IAAI,QAAQ,SAAS,IAAI,GAAG;EAC5B,IAAI,UAAU,SAAS,MAAM,MAAM,GAAG,SAAS;CACjD;AACF,EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,aAAa,CAAC,GAAG,UAAU,CAAC,GAAG;CAC5D,MAAM,EAAE,QAAQ,CAAC,MAAM;CAOvB,MAAM,eAAe;EAAC;EAAU;EAAK;EAAO;EAAQ;EAAS;CAAI;CACjE,KAAK,MAAM,QAAQ,OAAO,KAAK,UAAU,GACvC,IAAI,aAAa,SAAS,KAAK,YAAY,CAAC,GAC1C,MAAM,IAAI,MACR,+CAA+C,KAAK,kCAAkC,KAAK,YAAY,EAAE,iHAErE,KAAK,GAC3C;CAIJ,OAAO,EACL,QAAQ,KAAK;EACX,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;EAC1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;EAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GACvD,IAAI,UAAU,MAAM,SAAS;CAEjC,EACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["/**\n * Numori UI — the Numori design system as a standalone Vue 3 component library.\n *\n * This is the framework-agnostic entry point. It works in any Vue 3 app with\n * no build-tool integration at all:\n *\n * import { createApp } from 'vue'\n * import NumoriUI from 'numori-ui'\n * import './app.css' // @import \"tailwindcss\"; @import \"numori-ui/css\";\n *\n * createApp(App).use(NumoriUI).mount('#app')\n *\n * For a nicer developer experience there are two build-tool integrations that\n * register the components for you, so templates need no imports:\n *\n * - `numori-ui/nuxt` — a Nuxt module\n * - `numori-ui/vite` — a Vite plugin\n *\n * Styling is Tailwind CSS v4 and is deliberately NOT bundled as compiled CSS.\n * The components are plain utility classes, so they inherit the host app's\n * Tailwind build: one pass, one stylesheet, no duplication, and every token is\n * overridable. All the host has to do is import `numori-ui/css`, which supplies\n * the design tokens and tells Tailwind to scan this package for classes.\n */\n\nimport { components } from './components/index.js'\nimport { DEFAULT_PREFIX, prefixed } from './manifest.js'\nimport { ICON_COMPONENT_KEY } from './icons/resolver.js'\nimport { registerIcons } from './icons/registry.js'\n\nexport * from './components/index.js'\n\nexport { DEFAULT_PREFIX, COMPONENT_NAMES, componentEntries, prefixed } from './manifest.js'\nexport { registerIcons, iconRegistry, resolveIconPath } from './icons/registry.js'\nexport { provideIconComponent, useIconComponent, ICON_COMPONENT_KEY } from './icons/resolver.js'\nexport { MDI_VIEW_BOX, mdiPaths, mdiIconNames } from './icons/mdi.js'\nexport { useBackButton } from './composables/useBackButton.js'\nexport { onClickOutside } from './composables/onClickOutside.js'\nexport { useEventListener } from './composables/useEventListener.js'\n\n/**\n * Vue plugin that globally registers every Numori UI component.\n *\n * @type {import('vue').Plugin}\n *\n * @param {import('vue').App} app\n * @param {object} [options]\n * @param {string} [options.prefix='Ui']\n * Prefix for registered tags. `'Ui'` gives `<UiButton>`. Must be non-empty —\n * see the note in `install` for why.\n * @param {string[]} [options.include]\n * Register only these base names (e.g. `['Button', 'Modal']`). Note this\n * affects *global registration* only — it is not tree-shaking. To actually\n * drop unused components from the bundle, skip the plugin and import the\n * components you use directly.\n * @param {string[]} [options.exclude]\n * Skip these base names. Useful when the host has its own `<UiButton>`.\n * @param {object} [options.icons]\n * @param {import('vue').Component|string} [options.icons.component]\n * Render all icons with this component instead of the bundled inline SVGs.\n * Receives a `name` prop and must forward `class` to its root element.\n * @param {Record<string,string>} [options.icons.extra]\n * Extra icon path data to add to the bundled set, keyed by name.\n *\n * @example Default registration\n * app.use(NumoriUI)\n *\n * @example Custom prefix\n * app.use(NumoriUI, { prefix: 'N' }) // <NButton>\n *\n * @example Delegate icons to an existing icon component\n * app.use(NumoriUI, { icons: { component: MyIcon } })\n */\nexport const NumoriUI = {\n install(app, options = {}) {\n const { prefix = DEFAULT_PREFIX, include, exclude = [], icons = {} } = options\n\n // An empty prefix is rejected rather than merely discouraged. `Button`\n // renders its root as `<component :is=\"tag\">` with `tag` defaulting to\n // `'button'`, and Vue's dynamic-component lookup capitalises before\n // matching — so a globally registered `Button` would resolve `'button'`\n // back to itself and recurse until the stack blows. The failure is a bare\n // \"Maximum call stack size exceeded\" with no hint of the cause, so it is\n // much kinder to refuse up front.\n if (typeof prefix !== 'string' || prefix.length === 0) {\n throw new Error(\n '[numori-ui] `prefix` must be a non-empty string. Registering components under their ' +\n 'bare names would make <Button> resolve its own native `button` root element, ' +\n 'recursing infinitely. Use a prefix such as \"Ui\" or \"N\".',\n )\n }\n\n if (icons.extra) registerIcons(icons.extra)\n // app-level provide, so it reaches every component including those\n // teleported out of the tree (modals, select panels).\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n if (include && !include.includes(name)) continue\n if (exclude.includes(name)) continue\n app.component(prefixed(name, prefix), component)\n }\n },\n}\n\nexport default NumoriUI\n\n/**\n * Build a Vue plugin that globally registers only the components you hand it.\n *\n * `NumoriUI` is convenient but it is not tree-shakeable: to register everything\n * it has to reference everything, so `app.use(NumoriUI)` puts all 29 components\n * in your bundle (~82 kB) whether you render them or not. The `include` option\n * does not change that — it controls registration, not bundling.\n *\n * This factory is the way to get both. You import the components you want, so\n * the bundler sees exactly that set and drops the rest, and you still get global\n * tags instead of importing them into every file.\n *\n * Keys become the registered tag names verbatim, so no prefix option is needed\n * and there is no naming magic — rename in the object literal if you want a\n * different tag.\n *\n * @param {Record<string, import('vue').Component>} components\n * Map of tag name to component, e.g. `{ UiButton, UiModal }`.\n * @param {object} [options]\n * @param {object} [options.icons] Same shape as the `NumoriUI` plugin's option.\n * @returns {import('vue').Plugin}\n *\n * @example Global tags, but only two components bundled\n * import { createNumoriUI, UiButton, UiModal } from 'numori-ui'\n *\n * app.use(createNumoriUI({ UiButton, UiModal }))\n *\n * @example Registering under different tag names\n * app.use(createNumoriUI({ NButton: UiButton, NModal: UiModal }))\n */\nexport function createNumoriUI(components = {}, options = {}) {\n const { icons = {} } = options\n\n // `UiButton` renders its root as `<component :is=\"tag\">`, and Vue capitalises\n // when resolving a dynamic component. Registering it under a name that\n // case-insensitively matches one of those tags would make it resolve itself\n // and recurse until the stack overflows, reported only as \"Maximum call stack\n // size exceeded\". Cheap to catch here, miserable to debug later.\n const DYNAMIC_TAGS = ['button', 'a', 'div', 'span', 'label', 'li']\n for (const name of Object.keys(components)) {\n if (DYNAMIC_TAGS.includes(name.toLowerCase())) {\n throw new Error(\n `[numori-ui] Cannot register a component as \"${name}\": it collides with the native <${name.toLowerCase()}> ` +\n 'element that UiButton can render as its root, which would recurse infinitely. ' +\n `Use a prefixed name such as \"Ui${name}\".`,\n )\n }\n }\n\n return {\n install(app) {\n if (icons.extra) registerIcons(icons.extra)\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n app.component(name, component)\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAa,WAAW,EACtB,QAAQ,KAAK,UAAU,CAAC,GAAG;CACzB,MAAM,EAAE,SAAA,MAAyB,SAAS,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM;CASvE,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAClD,MAAM,IAAI,MACR,8NAGF;CAGF,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;CAG1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;CAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GAAG;EAC1D,IAAI,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG;EACxC,IAAI,QAAQ,SAAS,IAAI,GAAG;EAC5B,IAAI,UAAU,SAAS,MAAM,MAAM,GAAG,SAAS;CACjD;AACF,EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,aAAa,CAAC,GAAG,UAAU,CAAC,GAAG;CAC5D,MAAM,EAAE,QAAQ,CAAC,MAAM;CAOvB,MAAM,eAAe;EAAC;EAAU;EAAK;EAAO;EAAQ;EAAS;CAAI;CACjE,KAAK,MAAM,QAAQ,OAAO,KAAK,UAAU,GACvC,IAAI,aAAa,SAAS,KAAK,YAAY,CAAC,GAC1C,MAAM,IAAI,MACR,+CAA+C,KAAK,kCAAkC,KAAK,YAAY,EAAE,iHAErE,KAAK,GAC3C;CAIJ,OAAO,EACL,QAAQ,KAAK;EACX,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;EAC1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;EAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GACvD,IAAI,UAAU,MAAM,SAAS;CAEjC,EACF;AACF"}
@@ -0,0 +1,21 @@
1
+ //#region src/internal/controlSizes.js
2
+ /**
3
+ * Size scale shared by the native checkable inputs (`UiCheckbox`, `UiRadio`).
4
+ *
5
+ * Both render a native `<input>` and size it with the same width/height classes;
6
+ * the map lived duplicated in each. A checkbox and a radio stay separate
7
+ * components because their HTML semantics differ, but their sizing does not.
8
+ *
9
+ * @param {string} size One of `sm` | `md` | `lg`. Anything else falls back to `md`.
10
+ * @returns {string} The width/height utility classes for that size.
11
+ */
12
+ var CHECKABLE_SIZES = {
13
+ sm: "w-3.5 h-3.5",
14
+ md: "w-4 h-4",
15
+ lg: "w-5 h-5"
16
+ };
17
+ var checkableSizeClass = (size) => CHECKABLE_SIZES[size] ?? CHECKABLE_SIZES.md;
18
+ //#endregion
19
+ export { CHECKABLE_SIZES, checkableSizeClass };
20
+
21
+ //# sourceMappingURL=controlSizes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controlSizes.js","names":[],"sources":["../../src/internal/controlSizes.js"],"sourcesContent":["/**\n * Size scale shared by the native checkable inputs (`UiCheckbox`, `UiRadio`).\n *\n * Both render a native `<input>` and size it with the same width/height classes;\n * the map lived duplicated in each. A checkbox and a radio stay separate\n * components because their HTML semantics differ, but their sizing does not.\n *\n * @param {string} size One of `sm` | `md` | `lg`. Anything else falls back to `md`.\n * @returns {string} The width/height utility classes for that size.\n */\nexport const CHECKABLE_SIZES = {\n sm: 'w-3.5 h-3.5',\n md: 'w-4 h-4',\n lg: 'w-5 h-5',\n}\n\nexport const checkableSizeClass = (size) => CHECKABLE_SIZES[size] ?? CHECKABLE_SIZES.md\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,kBAAkB;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,sBAAsB,SAAS,gBAAgB,SAAS,gBAAgB"}
@@ -0,0 +1,20 @@
1
+ //#region src/internal/menu.js
2
+ /**
3
+ * Shared chrome for floating menu surfaces.
4
+ *
5
+ * `UiDropdown`, `UiSelect`, `UiPopup` and `UiDropdownSubmenu` are four different
6
+ * takes on "a panel that floats over the page" — they differ in how they are
7
+ * positioned (absolute vs fixed vs teleported) and dismissed, which is why they
8
+ * remain separate components. What they share is the *look* of the panel: the
9
+ * surface colour, border, radius and shadow. That string lived copied verbatim
10
+ * in all four, so a tweak to the shared look meant editing four files and hoping
11
+ * none drifted. It now lives here.
12
+ *
13
+ * Positioning, z-index, padding and `overflow` stay at each call site, since
14
+ * those genuinely differ between the four.
15
+ */
16
+ var MENU_PANEL_CLASS = "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg";
17
+ //#endregion
18
+ export { MENU_PANEL_CLASS };
19
+
20
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.js","names":[],"sources":["../../src/internal/menu.js"],"sourcesContent":["/**\n * Shared chrome for floating menu surfaces.\n *\n * `UiDropdown`, `UiSelect`, `UiPopup` and `UiDropdownSubmenu` are four different\n * takes on \"a panel that floats over the page\" — they differ in how they are\n * positioned (absolute vs fixed vs teleported) and dismissed, which is why they\n * remain separate components. What they share is the *look* of the panel: the\n * surface colour, border, radius and shadow. That string lived copied verbatim\n * in all four, so a tweak to the shared look meant editing four files and hoping\n * none drifted. It now lives here.\n *\n * Positioning, z-index, padding and `overflow` stay at each call site, since\n * those genuinely differ between the four.\n */\nexport const MENU_PANEL_CLASS =\n 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg'\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,mBACX"}
package/dist/manifest.js CHANGED
@@ -25,11 +25,9 @@ var COMPONENT_NAMES = [
25
25
  "Banner",
26
26
  "Breadcrumb",
27
27
  "Button",
28
- "ButtonsGroup",
29
28
  "Card",
30
29
  "Checkbox",
31
30
  "CodeBlock",
32
- "ComparisonTable",
33
31
  "Divider",
34
32
  "Dropdown",
35
33
  "DropdownItem",
@@ -54,6 +52,7 @@ var COMPONENT_NAMES = [
54
52
  "Slider",
55
53
  "Spinner",
56
54
  "Stepper",
55
+ "Table",
57
56
  "ThemeToggle",
58
57
  "Toast",
59
58
  "Toggle",
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.js"],"sourcesContent":["/**\n * Component manifest — the single list of what Numori UI ships.\n *\n * Kept as plain data (no imports) so it can be consumed by things that must\n * not pull Vue or any `.vue` file into their graph: the Nuxt module and the\n * Vite plugin both run in Node at config time and only need names and paths.\n *\n * `src/components/index.js` holds the matching real imports for bundling. The\n * two are cross-checked by `scripts/verify.mjs`, so a component added in one\n * place and forgotten in the other fails the build rather than shipping\n * half-registered.\n */\n\n/** Default prefix for registered component names, e.g. `Ui` -> `<UiButton>`. */\nexport const DEFAULT_PREFIX = 'Ui'\n\n/**\n * Base names of every shipped component, without prefix or extension.\n * Order is alphabetical, matching the files on disk.\n * @type {string[]}\n */\nexport const COMPONENT_NAMES = [\n 'Alert',\n 'Avatar',\n 'Badge',\n 'Banner',\n 'Breadcrumb',\n 'Button',\n 'ButtonsGroup',\n 'Card',\n 'Checkbox',\n 'CodeBlock',\n 'ComparisonTable',\n 'Divider',\n 'Dropdown',\n 'DropdownItem',\n 'DropdownRow',\n 'DropdownSubmenu',\n 'FileInput',\n 'FormField',\n 'IconTile',\n 'Input',\n 'Kbd',\n 'ListMenu',\n 'ListMenuItem',\n 'Modal',\n 'Numpad',\n 'Popup',\n 'ProgressBar',\n 'Prompt',\n 'Radio',\n 'SectionHeading',\n 'Segmented',\n 'Select',\n 'Slider',\n 'Spinner',\n 'Stepper',\n 'ThemeToggle',\n 'Toast',\n 'Toggle',\n 'Tooltip',\n]\n\n/**\n * The icon component is listed separately: it lives outside `components/`\n * because it is the framework seam rather than a UI primitive, and the other\n * components import it directly by path.\n */\nexport const ICON_COMPONENT = { name: 'Icon', file: 'icons/Icon.vue' }\n\n/**\n * Every registerable component as `{ name, file }`, where `file` is relative\n * to `src/`. Includes the icon component.\n * @returns {Array<{ name: string, file: string }>}\n */\nexport function componentEntries() {\n return [\n ...COMPONENT_NAMES.map((name) => ({ name, file: `components/${name}.vue` })),\n ICON_COMPONENT,\n ]\n}\n\n/**\n * Apply a prefix to a base component name.\n *\n * The prefix must be non-empty; the entry points validate this. Registering\n * bare names breaks `Button`, whose root is `<component :is=\"tag\">` with `tag`\n * defaulting to `'button'` — Vue capitalises when resolving dynamic components,\n * so a registered `Button` would match its own root element and recurse.\n *\n * @param {string} name Base name, e.g. 'Button'.\n * @param {string} [prefix=DEFAULT_PREFIX] Prefix to apply, e.g. 'Ui' or 'N'.\n * @returns {string} e.g. 'UiButton'\n */\nexport function prefixed(name, prefix = DEFAULT_PREFIX) {\n return `${prefix || ''}${name}`\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,iBAAiB;;;;;;AAO9B,IAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,IAAa,iBAAiB;CAAE,MAAM;CAAQ,MAAM;AAAiB;;;;;;AAOrE,SAAgB,mBAAmB;CACjC,OAAO,CACL,GAAG,gBAAgB,KAAK,UAAU;EAAE;EAAM,MAAM,cAAc,KAAK;CAAM,EAAE,GAC3E,cACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,SAAS,MAAM,SAAA,MAAyB;CACtD,OAAO,GAAG,UAAU,KAAK;AAC3B"}
1
+ {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.js"],"sourcesContent":["/**\n * Component manifest — the single list of what Numori UI ships.\n *\n * Kept as plain data (no imports) so it can be consumed by things that must\n * not pull Vue or any `.vue` file into their graph: the Nuxt module and the\n * Vite plugin both run in Node at config time and only need names and paths.\n *\n * `src/components/index.js` holds the matching real imports for bundling. The\n * two are cross-checked by `scripts/verify.mjs`, so a component added in one\n * place and forgotten in the other fails the build rather than shipping\n * half-registered.\n */\n\n/** Default prefix for registered component names, e.g. `Ui` -> `<UiButton>`. */\nexport const DEFAULT_PREFIX = 'Ui'\n\n/**\n * Base names of every shipped component, without prefix or extension.\n * Order is alphabetical, matching the files on disk.\n * @type {string[]}\n */\nexport const COMPONENT_NAMES = [\n 'Alert',\n 'Avatar',\n 'Badge',\n 'Banner',\n 'Breadcrumb',\n 'Button',\n 'Card',\n 'Checkbox',\n 'CodeBlock',\n 'Divider',\n 'Dropdown',\n 'DropdownItem',\n 'DropdownRow',\n 'DropdownSubmenu',\n 'FileInput',\n 'FormField',\n 'IconTile',\n 'Input',\n 'Kbd',\n 'ListMenu',\n 'ListMenuItem',\n 'Modal',\n 'Numpad',\n 'Popup',\n 'ProgressBar',\n 'Prompt',\n 'Radio',\n 'SectionHeading',\n 'Segmented',\n 'Select',\n 'Slider',\n 'Spinner',\n 'Stepper',\n 'Table',\n 'ThemeToggle',\n 'Toast',\n 'Toggle',\n 'Tooltip',\n]\n\n/**\n * The icon component is listed separately: it lives outside `components/`\n * because it is the framework seam rather than a UI primitive, and the other\n * components import it directly by path.\n */\nexport const ICON_COMPONENT = { name: 'Icon', file: 'icons/Icon.vue' }\n\n/**\n * Every registerable component as `{ name, file }`, where `file` is relative\n * to `src/`. Includes the icon component.\n * @returns {Array<{ name: string, file: string }>}\n */\nexport function componentEntries() {\n return [\n ...COMPONENT_NAMES.map((name) => ({ name, file: `components/${name}.vue` })),\n ICON_COMPONENT,\n ]\n}\n\n/**\n * Apply a prefix to a base component name.\n *\n * The prefix must be non-empty; the entry points validate this. Registering\n * bare names breaks `Button`, whose root is `<component :is=\"tag\">` with `tag`\n * defaulting to `'button'` — Vue capitalises when resolving dynamic components,\n * so a registered `Button` would match its own root element and recurse.\n *\n * @param {string} name Base name, e.g. 'Button'.\n * @param {string} [prefix=DEFAULT_PREFIX] Prefix to apply, e.g. 'Ui' or 'N'.\n * @returns {string} e.g. 'UiButton'\n */\nexport function prefixed(name, prefix = DEFAULT_PREFIX) {\n return `${prefix || ''}${name}`\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,iBAAiB;;;;;;AAO9B,IAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,IAAa,iBAAiB;CAAE,MAAM;CAAQ,MAAM;AAAiB;;;;;;AAOrE,SAAgB,mBAAmB;CACjC,OAAO,CACL,GAAG,gBAAgB,KAAK,UAAU;EAAE;EAAM,MAAM,cAAc,KAAK;CAAM,EAAE,GAC3E,cACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,SAAS,MAAM,SAAA,MAAyB;CACtD,OAAO,GAAG,UAAU,KAAK;AAC3B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "numori-ui",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "description": "The Numori design system — a Tailwind 4 Vue 3 component library, consumable as a Nuxt module or a Vite plugin.",
6
6
  "author": {
7
7
  "name": "Erik Bjerke",
@@ -85,6 +85,7 @@
85
85
  "build": "node scripts/build.mjs",
86
86
  "build:lib": "vite build",
87
87
  "icons": "node scripts/extract-icons.mjs",
88
+ "playground:icons": "node scripts/playground-icons.mjs",
88
89
  "sync": "node scripts/sync-from-notes.mjs",
89
90
  "dev:nuxt": "npm --prefix playground/nuxt run dev",
90
91
  "dev:vite": "npm --prefix playground/vite run dev",
@@ -7,17 +7,28 @@
7
7
  leave-from-class="max-h-24 opacity-100"
8
8
  leave-to-class="max-h-0 opacity-0"
9
9
  >
10
- <component
11
- :is="clickable ? 'button' : 'div'"
10
+ <div
12
11
  v-if="show"
13
- class="w-full shrink-0 overflow-hidden text-xs font-medium"
14
- :class="[colorClass, clickable && 'cursor-pointer text-left']"
12
+ class="relative w-full shrink-0 overflow-hidden text-xs font-medium"
13
+ :class="colorClass"
15
14
  :style="safeArea ? { paddingTop: 'env(safe-area-inset-top, 0px)' } : undefined"
16
- :type="clickable ? 'button' : undefined"
17
15
  role="status"
18
- @click="clickable && emit('click')"
19
16
  >
20
- <div class="relative flex items-center justify-center gap-2 px-4 py-1.5">
17
+ <!-- Whole-banner click target as a full-cover button that is a *sibling*
18
+ of the dismiss button, never its ancestor. Nesting a <button> inside
19
+ a <button> is invalid HTML: the browser restructures it, so the
20
+ hydrated DOM would no longer match the server markup. -->
21
+ <button
22
+ v-if="clickable"
23
+ type="button"
24
+ class="absolute inset-0 z-0 cursor-pointer"
25
+ :aria-label="message || undefined"
26
+ @click="emit('click')"
27
+ />
28
+ <div
29
+ class="relative z-10 flex items-center justify-center gap-2 px-4 py-1.5"
30
+ :class="clickable ? 'pointer-events-none' : ''"
31
+ >
21
32
  <UiIcon v-if="icon" :name="icon" class="w-3.5 h-3.5 shrink-0" />
22
33
  <span
23
34
  ><slot>{{ message }}</slot></span
@@ -26,14 +37,14 @@
26
37
  <button
27
38
  v-if="dismissible"
28
39
  type="button"
29
- class="absolute right-3 inline-flex items-center opacity-80 hover:opacity-100"
40
+ class="pointer-events-auto absolute right-3 inline-flex items-center opacity-80 hover:opacity-100"
30
41
  :aria-label="dismissLabel"
31
42
  @click.stop="emit('dismiss')"
32
43
  >
33
44
  <UiIcon name="mdi:close" class="w-3.5 h-3.5" />
34
45
  </button>
35
46
  </div>
36
- </component>
47
+ </div>
37
48
  </Transition>
38
49
  </template>
39
50
 
@@ -53,9 +53,9 @@
53
53
  *
54
54
  * @slot default — Button content (label text, icons, or any child elements)
55
55
  */
56
- import { computed, useAttrs } from 'vue'
56
+ import { computed } from 'vue'
57
57
  import UiIcon from '../icons/Icon.vue'
58
- import { twMerge } from 'tailwind-merge'
58
+ import { useMergedClasses } from '../composables/useMergedClasses.js'
59
59
  const props = defineProps({
60
60
  /**
61
61
  * HTML element tag to render.
@@ -105,10 +105,11 @@ const props = defineProps({
105
105
  size: { type: String, default: 'md' },
106
106
 
107
107
  /**
108
- * Border-radius shape of the button.
108
+ * Border-radius shape of the button, matching `UiSegmented`'s `shape`.
109
+ * For a circular icon button, combine `shape="pill"` with `icon-only`.
109
110
  * @type {string}
110
111
  * @default 'round'
111
- * @values 'round' (rounded-lg) | 'pill' (rounded-full) | 'square' (rounded-none) | 'circle' (rounded-full) | 'none'
112
+ * @values 'round' (rounded-lg) | 'pill' (rounded-full) | 'square' (rounded-none)
112
113
  */
113
114
  shape: { type: String, default: 'round' },
114
115
 
@@ -235,13 +236,14 @@ const sizeClasses = computed(() => {
235
236
 
236
237
  // ── Shape classes ─────────────────────────────────────────
237
238
  const shapeClasses = computed(() => {
238
- if (isInlineVariant.value) return ''
239
+ // Menu/list rows are full-width, but still round their corners so the hover
240
+ // highlight is a rounded chip rather than a square that pokes past the
241
+ // rounded menu panel around them.
242
+ if (isInlineVariant.value) return 'rounded-lg'
239
243
  const map = {
240
244
  round: 'rounded-lg',
241
245
  pill: 'rounded-full',
242
246
  square: 'rounded-none',
243
- circle: 'rounded-full',
244
- none: '',
245
247
  }
246
248
  return map[props.shape] || map.round
247
249
  })
@@ -382,18 +384,9 @@ const stateClasses = computed(() => {
382
384
  return 'cursor-pointer'
383
385
  })
384
386
 
385
- // ── Merge with external classes (external wins via twMerge) ──
386
- const attrs = useAttrs()
387
-
388
- const restAttrs = computed(() => {
389
- const { class: _, ...rest } = attrs
390
- return rest
391
- })
392
-
393
- const mergedClasses = computed(() => {
394
- const externalClass = attrs.class || ''
395
- return twMerge(internalClasses.value, externalClass)
396
- })
387
+ // ── Merge external classes over internals (external wins via twMerge) ──
388
+ // A getter defers reading `internalClasses` until after its declaration below.
389
+ const { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value)
397
390
 
398
391
  // ── Assembled internal classes ────────────────────────────
399
392
  const internalClasses = computed(() => {
@@ -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)
@@ -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
  >