numori-ui 0.1.0 → 0.2.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.
package/dist/index.js CHANGED
@@ -1,38 +1,43 @@
1
1
  import { MDI_VIEW_BOX, mdiIconNames, mdiPaths } from "./icons/mdi.js";
2
2
  import { iconRegistry, registerIcons, resolveIconPath } from "./icons/registry.js";
3
3
  import { ICON_COMPONENT_KEY, provideIconComponent, useIconComponent } from "./icons/resolver.js";
4
- import _sfc_main$13 from "./icons/Icon.js";
4
+ import _sfc_main$15 from "./icons/Icon.js";
5
5
  import _sfc_main from "./components/Alert.js";
6
6
  import _sfc_main$1 from "./components/Avatar.js";
7
7
  import _sfc_main$2 from "./components/Badge.js";
8
- import _sfc_main$3 from "./components/Button.js";
9
- import _sfc_main$4 from "./components/ButtonsGroup.js";
10
- import _sfc_main$5 from "./components/Checkbox.js";
11
- import _sfc_main$6 from "./components/Divider.js";
8
+ import _sfc_main$3 from "./components/Breadcrumb.js";
9
+ import _sfc_main$4 from "./components/Button.js";
10
+ import _sfc_main$5 from "./components/ButtonsGroup.js";
11
+ import _sfc_main$6 from "./components/Card.js";
12
+ import _sfc_main$7 from "./components/Checkbox.js";
13
+ import _sfc_main$8 from "./components/Divider.js";
12
14
  import { useEventListener } from "./composables/useEventListener.js";
13
15
  import { onClickOutside } from "./composables/onClickOutside.js";
14
- import _sfc_main$7 from "./components/Dropdown.js";
15
- import _sfc_main$8 from "./components/DropdownItem.js";
16
- import _sfc_main$9 from "./components/DropdownRow.js";
17
- import _sfc_main$10 from "./components/DropdownSubmenu.js";
18
- import _sfc_main$11 from "./components/FileInput.js";
19
- import _sfc_main$12 from "./components/FormField.js";
20
- import _sfc_main$14 from "./components/Input.js";
21
- import _sfc_main$15 from "./components/Kbd.js";
22
- import _sfc_main$16 from "./components/ListMenu.js";
23
- import _sfc_main$17 from "./components/ListMenuItem.js";
16
+ import _sfc_main$9 from "./components/Dropdown.js";
17
+ import _sfc_main$10 from "./components/DropdownItem.js";
18
+ import _sfc_main$11 from "./components/DropdownRow.js";
19
+ import _sfc_main$12 from "./components/DropdownSubmenu.js";
20
+ import _sfc_main$13 from "./components/FileInput.js";
21
+ import _sfc_main$14 from "./components/FormField.js";
22
+ import _sfc_main$16 from "./components/IconTile.js";
23
+ import _sfc_main$17 from "./components/Input.js";
24
+ import _sfc_main$18 from "./components/Kbd.js";
25
+ import _sfc_main$19 from "./components/ListMenu.js";
26
+ import _sfc_main$20 from "./components/ListMenuItem.js";
24
27
  import { useBackButton } from "./composables/useBackButton.js";
25
- import _sfc_main$18 from "./components/Modal.js";
26
- import _sfc_main$19 from "./components/Numpad.js";
27
- import _sfc_main$20 from "./components/Popup.js";
28
- import _sfc_main$21 from "./components/ProgressBar.js";
29
- import _sfc_main$22 from "./components/Prompt.js";
30
- import _sfc_main$23 from "./components/Radio.js";
31
- import _sfc_main$24 from "./components/Select.js";
32
- import _sfc_main$25 from "./components/Slider.js";
33
- import _sfc_main$26 from "./components/Stepper.js";
34
- import _sfc_main$27 from "./components/Toggle.js";
35
- import _sfc_main$28 from "./components/Tooltip.js";
28
+ import _sfc_main$21 from "./components/Modal.js";
29
+ import _sfc_main$22 from "./components/Numpad.js";
30
+ import _sfc_main$23 from "./components/Popup.js";
31
+ import _sfc_main$24 from "./components/ProgressBar.js";
32
+ import _sfc_main$25 from "./components/Prompt.js";
33
+ import _sfc_main$26 from "./components/Radio.js";
34
+ import _sfc_main$27 from "./components/SectionHeading.js";
35
+ import _sfc_main$28 from "./components/Segmented.js";
36
+ import _sfc_main$29 from "./components/Select.js";
37
+ import _sfc_main$30 from "./components/Slider.js";
38
+ import _sfc_main$31 from "./components/Stepper.js";
39
+ import _sfc_main$32 from "./components/Toggle.js";
40
+ import _sfc_main$33 from "./components/Tooltip.js";
36
41
  import { components } from "./components/index.js";
37
42
  import { COMPONENT_NAMES, DEFAULT_PREFIX, componentEntries, prefixed } from "./manifest.js";
38
43
  //#region src/index.js
@@ -152,6 +157,6 @@ function createNumoriUI(components = {}, options = {}) {
152
157
  } };
153
158
  }
154
159
  //#endregion
155
- export { COMPONENT_NAMES, DEFAULT_PREFIX, ICON_COMPONENT_KEY, MDI_VIEW_BOX, NumoriUI, NumoriUI as default, _sfc_main as UiAlert, _sfc_main$1 as UiAvatar, _sfc_main$2 as UiBadge, _sfc_main$3 as UiButton, _sfc_main$4 as UiButtonsGroup, _sfc_main$5 as UiCheckbox, _sfc_main$6 as UiDivider, _sfc_main$7 as UiDropdown, _sfc_main$8 as UiDropdownItem, _sfc_main$9 as UiDropdownRow, _sfc_main$10 as UiDropdownSubmenu, _sfc_main$11 as UiFileInput, _sfc_main$12 as UiFormField, _sfc_main$13 as UiIcon, _sfc_main$14 as UiInput, _sfc_main$15 as UiKbd, _sfc_main$16 as UiListMenu, _sfc_main$17 as UiListMenuItem, _sfc_main$18 as UiModal, _sfc_main$19 as UiNumpad, _sfc_main$20 as UiPopup, _sfc_main$21 as UiProgressBar, _sfc_main$22 as UiPrompt, _sfc_main$23 as UiRadio, _sfc_main$24 as UiSelect, _sfc_main$25 as UiSlider, _sfc_main$26 as UiStepper, _sfc_main$27 as UiToggle, _sfc_main$28 as UiTooltip, componentEntries, components, createNumoriUI, iconRegistry, mdiIconNames, mdiPaths, onClickOutside, prefixed, provideIconComponent, registerIcons, resolveIconPath, useBackButton, useEventListener, useIconComponent };
160
+ export { COMPONENT_NAMES, DEFAULT_PREFIX, ICON_COMPONENT_KEY, MDI_VIEW_BOX, NumoriUI, NumoriUI as default, _sfc_main as UiAlert, _sfc_main$1 as UiAvatar, _sfc_main$2 as UiBadge, _sfc_main$3 as UiBreadcrumb, _sfc_main$4 as UiButton, _sfc_main$5 as UiButtonsGroup, _sfc_main$6 as UiCard, _sfc_main$7 as UiCheckbox, _sfc_main$8 as UiDivider, _sfc_main$9 as UiDropdown, _sfc_main$10 as UiDropdownItem, _sfc_main$11 as UiDropdownRow, _sfc_main$12 as UiDropdownSubmenu, _sfc_main$13 as UiFileInput, _sfc_main$14 as UiFormField, _sfc_main$15 as UiIcon, _sfc_main$16 as UiIconTile, _sfc_main$17 as UiInput, _sfc_main$18 as UiKbd, _sfc_main$19 as UiListMenu, _sfc_main$20 as UiListMenuItem, _sfc_main$21 as UiModal, _sfc_main$22 as UiNumpad, _sfc_main$23 as UiPopup, _sfc_main$24 as UiProgressBar, _sfc_main$25 as UiPrompt, _sfc_main$26 as UiRadio, _sfc_main$27 as UiSectionHeading, _sfc_main$28 as UiSegmented, _sfc_main$29 as UiSelect, _sfc_main$30 as UiSlider, _sfc_main$31 as UiStepper, _sfc_main$32 as UiToggle, _sfc_main$33 as UiTooltip, componentEntries, components, createNumoriUI, iconRegistry, mdiIconNames, mdiPaths, onClickOutside, prefixed, provideIconComponent, registerIcons, resolveIconPath, useBackButton, useEventListener, useIconComponent };
156
161
 
157
162
  //# sourceMappingURL=index.js.map
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"}
package/dist/manifest.js CHANGED
@@ -22,8 +22,10 @@ var COMPONENT_NAMES = [
22
22
  "Alert",
23
23
  "Avatar",
24
24
  "Badge",
25
+ "Breadcrumb",
25
26
  "Button",
26
27
  "ButtonsGroup",
28
+ "Card",
27
29
  "Checkbox",
28
30
  "Divider",
29
31
  "Dropdown",
@@ -32,6 +34,7 @@ var COMPONENT_NAMES = [
32
34
  "DropdownSubmenu",
33
35
  "FileInput",
34
36
  "FormField",
37
+ "IconTile",
35
38
  "Input",
36
39
  "Kbd",
37
40
  "ListMenu",
@@ -42,6 +45,8 @@ var COMPONENT_NAMES = [
42
45
  "ProgressBar",
43
46
  "Prompt",
44
47
  "Radio",
48
+ "SectionHeading",
49
+ "Segmented",
45
50
  "Select",
46
51
  "Slider",
47
52
  "Stepper",
@@ -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 'Button',\n 'ButtonsGroup',\n 'Checkbox',\n 'Divider',\n 'Dropdown',\n 'DropdownItem',\n 'DropdownRow',\n 'DropdownSubmenu',\n 'FileInput',\n 'FormField',\n 'Input',\n 'Kbd',\n 'ListMenu',\n 'ListMenuItem',\n 'Modal',\n 'Numpad',\n 'Popup',\n 'ProgressBar',\n 'Prompt',\n 'Radio',\n 'Select',\n 'Slider',\n 'Stepper',\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;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 'Breadcrumb',\n 'Button',\n 'ButtonsGroup',\n 'Card',\n 'Checkbox',\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 'Stepper',\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;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.1.0",
4
+ "version": "0.2.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",
@@ -19,7 +19,7 @@
19
19
  "url": "https://theprocedural.com"
20
20
  }
21
21
  ],
22
- "license": "AGPL-3.0",
22
+ "license": "AGPL-3.0-or-later",
23
23
  "homepage": "https://github.com/Numori-Ecosystem/Numori-UI",
24
24
  "repository": {
25
25
  "type": "git",
@@ -75,6 +75,7 @@
75
75
  "dist",
76
76
  "src",
77
77
  "README.md",
78
+ "CHANGELOG.md",
78
79
  "LICENSE"
79
80
  ],
80
81
  "engines": {
@@ -123,8 +124,8 @@
123
124
  },
124
125
  "devDependencies": {
125
126
  "@eslint/js": "^10.0.1",
126
- "@nuxt/kit": "^4.5.2",
127
127
  "@iconify-json/mdi": "^1.2.3",
128
+ "@nuxt/kit": "^4.5.2",
128
129
  "@vitejs/plugin-vue": "^6.0.8",
129
130
  "eslint": "^10.8.0",
130
131
  "eslint-plugin-vue": "^10.10.0",
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <nav :aria-label="ariaLabel">
3
+ <ol class="flex flex-wrap items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400">
4
+ <li v-for="(item, index) in items" :key="item.label" class="flex items-center gap-1.5">
5
+ <UiIcon
6
+ v-if="index > 0"
7
+ :name="separatorIcon"
8
+ class="size-4 text-gray-400 dark:text-gray-600"
9
+ />
10
+
11
+ <slot name="item" :item="item" :index="index" :is-last="index === items.length - 1">
12
+ <component
13
+ :is="linkTag"
14
+ v-if="(item.to || item.href) && index < items.length - 1"
15
+ :to="item.to"
16
+ :href="item.href"
17
+ class="rounded transition-colors hover:text-gray-900 dark:hover:text-gray-100"
18
+ >
19
+ {{ item.label }}
20
+ </component>
21
+
22
+ <span v-else aria-current="page" class="font-medium text-gray-900 dark:text-gray-200">
23
+ {{ item.label }}
24
+ </span>
25
+ </slot>
26
+ </li>
27
+ </ol>
28
+ </nav>
29
+ </template>
30
+
31
+ <script setup>
32
+ /**
33
+ * UiBreadcrumb — the trail from the site root down to the current page.
34
+ *
35
+ * The final item always renders as text with `aria-current="page"`, never a
36
+ * link: pointing a link at the page you are already on is noise for keyboard and
37
+ * screen-reader users. Separators are decorative icons.
38
+ *
39
+ * Links are rendered with `linkTag`, so a router link component can be used
40
+ * instead of a plain anchor — pass `link-tag="NuxtLink"` (or `RouterLink`) and
41
+ * give each item a `to`. For anything more involved, the `item` scoped slot
42
+ * hands back `{ item, index, isLast }` for full control of each entry.
43
+ *
44
+ * @example Anchor links
45
+ * <UiBreadcrumb
46
+ * :items="[
47
+ * { label: 'Home', href: '/' },
48
+ * { label: 'Docs', href: '/docs' },
49
+ * { label: 'Buttons' },
50
+ * ]"
51
+ * />
52
+ *
53
+ * @example Router links
54
+ * <UiBreadcrumb link-tag="NuxtLink" :items="[{ label: 'Products', to: '/products' }, { label: product.name }]" />
55
+ *
56
+ * @slot item — Override a single entry. Scope: `{ item, index, isLast }`.
57
+ */
58
+ import UiIcon from '../icons/Icon.vue'
59
+
60
+ defineProps({
61
+ /**
62
+ * Trail entries, ordered from the root down. Each is
63
+ * `{ label, to?, href? }`; the final entry always renders as plain text.
64
+ * @type {Array<{ label: string, to?: any, href?: string }>}
65
+ */
66
+ items: { type: Array, required: true },
67
+
68
+ /**
69
+ * Accessible name for the surrounding `<nav>`.
70
+ * @type {string}
71
+ * @default 'Breadcrumb'
72
+ */
73
+ ariaLabel: { type: String, default: 'Breadcrumb' },
74
+
75
+ /**
76
+ * Element or globally registered component used for linked entries.
77
+ * @type {string}
78
+ * @default 'a'
79
+ */
80
+ linkTag: { type: String, default: 'a' },
81
+
82
+ /**
83
+ * MDI icon drawn between entries.
84
+ * @type {string}
85
+ * @default 'mdi:chevron-right'
86
+ */
87
+ separatorIcon: { type: String, default: 'mdi:chevron-right' },
88
+ })
89
+ </script>
@@ -0,0 +1,169 @@
1
+ <template>
2
+ <!-- Dynamic root element — renders as div, article, section, or a link via :is -->
3
+ <component :is="tag" :class="mergedClasses" v-bind="restAttrs">
4
+ <!-- Optional header region, separated from the body by a hairline rule -->
5
+ <div v-if="$slots.header" class="mb-4 border-b border-gray-100 pb-4 dark:border-gray-800">
6
+ <slot name="header" />
7
+ </div>
8
+
9
+ <slot />
10
+
11
+ <!-- Optional footer region, pushed to the bottom in a flex-column card -->
12
+ <div v-if="$slots.footer" class="mt-auto border-t border-gray-100 pt-4 dark:border-gray-800">
13
+ <slot name="footer" />
14
+ </div>
15
+ </component>
16
+ </template>
17
+
18
+ <script setup>
19
+ /**
20
+ * UiCard — the surface primitive: a bordered, rounded container with the
21
+ * design system's card elevation, dark-mode surface, and optional interactive
22
+ * and highlighted states.
23
+ *
24
+ * It is the shell only. Card lays out header / default / footer slots but takes
25
+ * no view over their contents, so product cards, blog cards, pricing tiers and
26
+ * link tiles can all share one surface while keeping their own internals.
27
+ *
28
+ * Renders as any element via `tag`, so a whole card can be a single link
29
+ * (`tag="a"`) or an article. External Tailwind classes are merged with
30
+ * `tailwind-merge`, so a caller's `hover:border-primary-300` wins over the
31
+ * neutral hover border added by `interactive` rather than doubling up.
32
+ *
33
+ * @example Basic card
34
+ * <UiCard>
35
+ * <h3 class="font-semibold">Title</h3>
36
+ * <p class="text-sm text-gray-600 dark:text-gray-400">Body copy.</p>
37
+ * </UiCard>
38
+ *
39
+ * @example Interactive card that is one big link (stretched-link pattern)
40
+ * <UiCard tag="article" interactive focus-ring>
41
+ * <h3><a href="/x" class="after:absolute after:inset-0">Title</a></h3>
42
+ * </UiCard>
43
+ *
44
+ * @example Highlighted pricing tier with a footer action
45
+ * <UiCard highlighted padding="lg" class="flex h-full flex-col">
46
+ * …
47
+ * <template #footer><UiButton block>Choose</UiButton></template>
48
+ * </UiCard>
49
+ *
50
+ * @slot default — Card body.
51
+ * @slot header — Optional header, drawn above the body with a divider.
52
+ * @slot footer — Optional footer, drawn below the body with a divider.
53
+ */
54
+ import { computed, useAttrs } from 'vue'
55
+ import { twMerge } from 'tailwind-merge'
56
+
57
+ const props = defineProps({
58
+ /**
59
+ * HTML element (or globally registered component name) to render as.
60
+ * @type {string}
61
+ * @default 'div'
62
+ * @values 'div' | 'article' | 'section' | 'a' | 'li' | any valid tag
63
+ */
64
+ tag: { type: String, default: 'div' },
65
+
66
+ /**
67
+ * Inner padding.
68
+ * @type {string}
69
+ * @default 'md'
70
+ * @values 'none' | 'xs' | 'sm' | 'md' | 'lg'
71
+ */
72
+ padding: { type: String, default: 'md' },
73
+
74
+ /**
75
+ * Corner radius.
76
+ * @type {string}
77
+ * @default '2xl'
78
+ * @values 'lg' | 'xl' | '2xl'
79
+ */
80
+ radius: { type: String, default: '2xl' },
81
+
82
+ /**
83
+ * Base drop shadow. `interactive` raises this to `card-hover` on hover.
84
+ * @type {string}
85
+ * @default 'card'
86
+ * @values 'none' | 'card' | 'card-hover'
87
+ */
88
+ shadow: { type: String, default: 'card' },
89
+
90
+ /**
91
+ * Draw the surface border. On by default; turn off for cards that sit on a
92
+ * tinted panel and provide their own separation.
93
+ * @type {boolean}
94
+ * @default true
95
+ */
96
+ bordered: { type: Boolean, default: true },
97
+
98
+ /**
99
+ * Hover affordance: a small lift and a stronger shadow, with the transition
100
+ * disabled under `prefers-reduced-motion`. Border-color is included in the
101
+ * transition but left untinted, so add a `hover:border-*` (or `group-hover:
102
+ * border-*`) class to colour the border on hover.
103
+ * @type {boolean}
104
+ * @default false
105
+ */
106
+ interactive: { type: Boolean, default: false },
107
+
108
+ /**
109
+ * Recommended / featured state: accent border and a raised shadow, for the
110
+ * one card in a group that should draw the eye.
111
+ * @type {boolean}
112
+ * @default false
113
+ */
114
+ highlighted: { type: Boolean, default: false },
115
+
116
+ /**
117
+ * Lift the focus ring to the card when a single descendant link is stretched
118
+ * over the whole surface (the `after:absolute after:inset-0` pattern). The
119
+ * card becomes the positioning context and shows the ring on focus-within.
120
+ * @type {boolean}
121
+ * @default false
122
+ */
123
+ focusRing: { type: Boolean, default: false },
124
+ })
125
+
126
+ defineOptions({ inheritAttrs: false })
127
+
128
+ const attrs = useAttrs()
129
+ const restAttrs = computed(() => {
130
+ const { class: _class, ...rest } = attrs
131
+ return rest
132
+ })
133
+
134
+ const paddingClass = computed(
135
+ () => ({ none: '', xs: 'p-3', sm: 'p-4', md: 'p-5', lg: 'p-6' })[props.padding] ?? 'p-5',
136
+ )
137
+
138
+ const radiusClass = computed(
139
+ () =>
140
+ ({ lg: 'rounded-lg', xl: 'rounded-xl', '2xl': 'rounded-2xl' })[props.radius] ?? 'rounded-2xl',
141
+ )
142
+
143
+ const shadowClass = computed(
144
+ () =>
145
+ ({ none: '', card: 'shadow-card', 'card-hover': 'shadow-card-hover' })[props.shadow] ??
146
+ 'shadow-card',
147
+ )
148
+
149
+ const mergedClasses = computed(() =>
150
+ twMerge(
151
+ 'bg-white dark:bg-gray-900',
152
+ props.focusRing ? 'relative' : '',
153
+ radiusClass.value,
154
+ props.bordered ? 'border border-gray-200 dark:border-gray-700' : '',
155
+ shadowClass.value,
156
+ props.interactive
157
+ ? 'transition-[transform,box-shadow,border-color] duration-300 ease-out hover:-translate-y-1 hover:shadow-card-hover motion-reduce:transition-none motion-reduce:hover:translate-y-0'
158
+ : '',
159
+ props.highlighted
160
+ ? 'border-primary-400 shadow-card-hover ring-1 ring-primary-400/20 dark:border-primary-400/60 dark:ring-primary-400/25'
161
+ : '',
162
+ props.focusRing
163
+ ? 'focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-primary-500 dark:focus-within:outline-primary-400'
164
+ : '',
165
+ paddingClass.value,
166
+ attrs.class,
167
+ ),
168
+ )
169
+ </script>
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <span class="inline-flex items-center justify-center" :class="mergedClasses" v-bind="restAttrs">
3
+ <UiIcon :name="icon" :class="iconSizeClass" aria-hidden="true" />
4
+ </span>
5
+ </template>
6
+
7
+ <script setup>
8
+ /**
9
+ * UiIconTile — a small rounded, tinted tile holding a single icon: the motif
10
+ * that stands in for a product logo or marks a feature next to a heading.
11
+ *
12
+ * Decorative by default — the icon is `aria-hidden`, on the assumption that a
13
+ * label sits next to it in text. The tint uses the design system's semantic
14
+ * colours; for a colour outside that set (a Tailwind palette, say) pass the
15
+ * `bg-*`/`text-*` classes directly and they override the built-in tint via
16
+ * `tailwind-merge`.
17
+ *
18
+ * @example Primary feature tile
19
+ * <UiIconTile icon="mdi:shield-lock-outline" />
20
+ *
21
+ * @example Large product mark in a custom colour
22
+ * <UiIconTile icon="mdi:note-text-outline" size="lg" class="bg-sky-100 text-sky-700" />
23
+ *
24
+ * @example Success tile
25
+ * <UiIconTile icon="mdi:check" color="success" size="sm" />
26
+ */
27
+ import { computed, useAttrs } from 'vue'
28
+ import { twMerge } from 'tailwind-merge'
29
+ import UiIcon from '../icons/Icon.vue'
30
+
31
+ const props = defineProps({
32
+ /**
33
+ * MDI icon name.
34
+ * @type {string}
35
+ */
36
+ icon: { type: String, required: true },
37
+
38
+ /**
39
+ * Tint colour from the semantic palette.
40
+ * @type {string}
41
+ * @default 'primary'
42
+ * @values 'primary' | 'gray' | 'success' | 'warning' | 'error' | 'blue'
43
+ */
44
+ color: { type: String, default: 'primary' },
45
+
46
+ /**
47
+ * Tile size (the radius scales with it).
48
+ * @type {string}
49
+ * @default 'md'
50
+ * @values 'sm' | 'md' | 'lg' | 'xl'
51
+ */
52
+ size: { type: String, default: 'md' },
53
+ })
54
+
55
+ const sizeClass = computed(
56
+ () =>
57
+ ({
58
+ sm: 'size-9 rounded-lg',
59
+ md: 'size-11 rounded-xl',
60
+ lg: 'size-14 rounded-2xl',
61
+ xl: 'size-16 rounded-2xl',
62
+ })[props.size] ?? 'size-11 rounded-xl',
63
+ )
64
+
65
+ const iconSizeClass = computed(
66
+ () =>
67
+ ({
68
+ sm: 'size-5',
69
+ md: 'size-6',
70
+ lg: 'size-8',
71
+ xl: 'size-9',
72
+ })[props.size] ?? 'size-6',
73
+ )
74
+
75
+ const colorClass = computed(
76
+ () =>
77
+ ({
78
+ primary: 'bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300',
79
+ gray: 'bg-gray-100 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200',
80
+ success: 'bg-success-100 text-success-700 dark:bg-success-400/15 dark:text-success-300',
81
+ warning: 'bg-warning-100 text-warning-700 dark:bg-warning-400/15 dark:text-warning-300',
82
+ error: 'bg-error-100 text-error-700 dark:bg-error-400/15 dark:text-error-300',
83
+ blue: 'bg-blue-100 text-blue-700 dark:bg-blue-400/15 dark:text-blue-300',
84
+ })[props.color] ??
85
+ 'bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300',
86
+ )
87
+
88
+ defineOptions({ inheritAttrs: false })
89
+
90
+ const attrs = useAttrs()
91
+ const restAttrs = computed(() => {
92
+ const { class: _class, ...rest } = attrs
93
+ return rest
94
+ })
95
+
96
+ // External classes merge last so a caller's `bg-*`/`text-*` (e.g. a Tailwind
97
+ // palette outside the semantic set) overrides the built-in tint rather than
98
+ // colliding with it.
99
+ const mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class))
100
+ </script>