numori-ui 0.1.1 → 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/CHANGELOG.md +50 -0
- package/README.md +17 -8
- package/dist/components/Breadcrumb.js +107 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Card.js +174 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/IconTile.js +96 -0
- package/dist/components/IconTile.js.map +1 -0
- package/dist/components/SectionHeading.js +142 -0
- package/dist/components/SectionHeading.js.map +1 -0
- package/dist/components/Segmented.js +148 -0
- package/dist/components/Segmented.js.map +1 -0
- package/dist/components/index.js +61 -51
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/dist/manifest.js +5 -0
- package/dist/manifest.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Breadcrumb.vue +89 -0
- package/src/components/Card.vue +169 -0
- package/src/components/IconTile.vue +100 -0
- package/src/components/SectionHeading.vue +121 -0
- package/src/components/Segmented.vue +152 -0
- package/src/components/index.js +15 -0
- package/src/manifest.js +5 -0
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",
|
package/dist/manifest.js.map
CHANGED
|
@@ -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.
|
|
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",
|
|
@@ -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": {
|
|
@@ -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>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="align === 'center' ? 'text-center' : ''">
|
|
3
|
+
<p
|
|
4
|
+
v-if="eyebrow"
|
|
5
|
+
class="mb-3 text-sm font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400"
|
|
6
|
+
>
|
|
7
|
+
{{ eyebrow }}
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<component :is="level" :id="id" :class="titleClasses">
|
|
11
|
+
<slot name="title">{{ title }}</slot>
|
|
12
|
+
</component>
|
|
13
|
+
|
|
14
|
+
<p v-if="subtitle || $slots.subtitle" :class="subtitleClasses">
|
|
15
|
+
<slot name="subtitle">{{ subtitle }}</slot>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
/**
|
|
24
|
+
* UiSectionHeading — the eyebrow / heading / standfirst trio used at the top of
|
|
25
|
+
* a page or the start of a section.
|
|
26
|
+
*
|
|
27
|
+
* `level` and the visual `size` are independent on purpose: the heading tag
|
|
28
|
+
* follows the document outline (an `h3` nested inside an `h2` section) while the
|
|
29
|
+
* size follows the layout, so neither is sacrificed for the other. The block is
|
|
30
|
+
* layout-neutral — no outer margins or width cap — so the caller controls
|
|
31
|
+
* spacing and measure.
|
|
32
|
+
*
|
|
33
|
+
* @example Section heading
|
|
34
|
+
* <UiSectionHeading
|
|
35
|
+
* eyebrow="Pricing"
|
|
36
|
+
* title="One price, everything included"
|
|
37
|
+
* subtitle="No tiers, no add-ons."
|
|
38
|
+
* />
|
|
39
|
+
*
|
|
40
|
+
* @example Centred page hero with a nested level
|
|
41
|
+
* <UiSectionHeading centred size="lg" level="h1" title="Own your notes" />
|
|
42
|
+
*
|
|
43
|
+
* @slot title — Overrides the `title` prop for rich heading content.
|
|
44
|
+
* @slot subtitle — Overrides the `subtitle` prop.
|
|
45
|
+
* @slot default — Extra content below the standfirst, e.g. a call to action.
|
|
46
|
+
*/
|
|
47
|
+
import { computed } from 'vue'
|
|
48
|
+
|
|
49
|
+
const props = defineProps({
|
|
50
|
+
/**
|
|
51
|
+
* Small uppercase label above the heading.
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @default ''
|
|
54
|
+
*/
|
|
55
|
+
eyebrow: { type: String, default: '' },
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Heading text. Omit if using the `title` slot.
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @default ''
|
|
61
|
+
*/
|
|
62
|
+
title: { type: String, default: '' },
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Supporting paragraph below the heading.
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @default ''
|
|
68
|
+
*/
|
|
69
|
+
subtitle: { type: String, default: '' },
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Heading tag, chosen to match the document outline — not the visual size.
|
|
73
|
+
* @type {string}
|
|
74
|
+
* @default 'h2'
|
|
75
|
+
* @values 'h1' | 'h2' | 'h3' | 'h4'
|
|
76
|
+
*/
|
|
77
|
+
level: { type: String, default: 'h2' },
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Visual size of the heading, independent of `level`.
|
|
81
|
+
* @type {string}
|
|
82
|
+
* @default 'md'
|
|
83
|
+
* @values 'sm' | 'md' | 'lg'
|
|
84
|
+
*/
|
|
85
|
+
size: { type: String, default: 'md' },
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Horizontal alignment.
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @default 'left'
|
|
91
|
+
* @values 'left' | 'center'
|
|
92
|
+
*/
|
|
93
|
+
align: { type: String, default: 'left' },
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Optional id on the heading, so it can be targeted by `aria-labelledby`.
|
|
97
|
+
* @type {string}
|
|
98
|
+
* @default undefined
|
|
99
|
+
*/
|
|
100
|
+
id: { type: String, default: undefined },
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const titleClasses = computed(() => {
|
|
104
|
+
const sizeMap = {
|
|
105
|
+
sm: 'text-xl font-bold sm:text-2xl',
|
|
106
|
+
md: 'text-2xl font-bold sm:text-3xl',
|
|
107
|
+
lg: 'text-3xl font-bold sm:text-4xl',
|
|
108
|
+
}
|
|
109
|
+
return sizeMap[props.size] || sizeMap.md
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const subtitleClasses = computed(() => {
|
|
113
|
+
const sizeMap = {
|
|
114
|
+
sm: 'mt-3 text-base text-gray-600 dark:text-gray-400',
|
|
115
|
+
md: 'mt-4 text-base text-gray-600 sm:text-lg dark:text-gray-400',
|
|
116
|
+
lg: 'mt-4 text-lg text-gray-600 dark:text-gray-400',
|
|
117
|
+
}
|
|
118
|
+
const base = sizeMap[props.size] || sizeMap.md
|
|
119
|
+
return props.align === 'center' ? `${base} mx-auto` : base
|
|
120
|
+
})
|
|
121
|
+
</script>
|