numori-ui 0.1.1 → 0.3.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 +90 -0
- package/README.md +20 -9
- package/dist/components/Banner.js +179 -0
- package/dist/components/Banner.js.map +1 -0
- 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/CodeBlock.js +101 -0
- package/dist/components/CodeBlock.js.map +1 -0
- package/dist/components/ComparisonTable.js +152 -0
- package/dist/components/ComparisonTable.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/Spinner.js +87 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/ThemeToggle.js +85 -0
- package/dist/components/ThemeToggle.js.map +1 -0
- package/dist/components/Toast.js +107 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/index.js +73 -51
- package/dist/components/index.js.map +1 -1
- package/dist/icons/mdi.js +9 -0
- package/dist/icons/mdi.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +38 -27
- package/dist/index.js.map +1 -1
- package/dist/manifest.js +11 -0
- package/dist/manifest.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Banner.vue +149 -0
- package/src/components/Breadcrumb.vue +89 -0
- package/src/components/Card.vue +169 -0
- package/src/components/CodeBlock.vue +99 -0
- package/src/components/ComparisonTable.vue +141 -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/Spinner.vue +70 -0
- package/src/components/ThemeToggle.vue +81 -0
- package/src/components/Toast.vue +106 -0
- package/src/components/index.js +33 -0
- package/src/icons/mdi.js +9 -0
- package/src/manifest.js +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Numori UI are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
While the library is pre-1.0, minor versions may add components and options; patch
|
|
8
|
+
versions are fixes.
|
|
9
|
+
|
|
10
|
+
## [0.3.0] — 2026-08-31
|
|
11
|
+
|
|
12
|
+
Six new components, bringing the library to 39 components (40 registered tags,
|
|
13
|
+
including `UiIcon`). All additions are backward compatible. These were extracted
|
|
14
|
+
from the wider Numori ecosystem — the notes app and the marketing site — where
|
|
15
|
+
the same patterns had been rebuilt more than once.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`UiToast`** — a teleported stack of transient, self-dismissing messages with
|
|
20
|
+
enter/leave transitions. Presentational only: the host owns the list and its
|
|
21
|
+
timing and mutates a reactive array. Entries are `{ id, message, type?, icon? }`;
|
|
22
|
+
`type` maps to the `success` / `warning` / `error` tokens with a neutral
|
|
23
|
+
default. The container ignores pointer events so it never blocks the UI, and
|
|
24
|
+
each pill is a polite `role="status"`.
|
|
25
|
+
- **`UiBanner`** — a full-width status strip that slides in above the content
|
|
26
|
+
(offline notices, verification prompts, update prompts). Driven by `show`, with
|
|
27
|
+
a semantic `color`, optional `icon` and message slot, top safe-area padding by
|
|
28
|
+
default, and optional `clickable` / `dismissible` affordances that emit `click`
|
|
29
|
+
and `dismiss`.
|
|
30
|
+
- **`UiSpinner`** — the loading glyph `UiButton` uses, as a standalone primitive.
|
|
31
|
+
Five `size`s, colour inherited via `text-*`. Decorative by default; pass a
|
|
32
|
+
`label` and it becomes a live `role="status"` region.
|
|
33
|
+
- **`UiThemeToggle`** — a stateless light/dark icon button. Takes `isDark` and
|
|
34
|
+
emits `toggle`, leaving persistence to the host (`@nuxtjs/color-mode`, VueUse,
|
|
35
|
+
or hand-written); the sun and moon share a cell and cross-fade with a rotation.
|
|
36
|
+
- **`UiCodeBlock`** — a static, copyable snippet with an optional filename
|
|
37
|
+
caption and a copy button that fades in on hover or focus. Uses the async
|
|
38
|
+
Clipboard API and fails silently where it is unavailable; button labels are
|
|
39
|
+
props, so no language is baked in.
|
|
40
|
+
- **`UiComparisonTable`** — a data-driven, accessible two-way comparison built on
|
|
41
|
+
a real `<table>` (`<caption>`, `scope` headers) with one column accented.
|
|
42
|
+
Decorative leading icons; the cell text carries the meaning.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- README component list, groupings and counts updated for the six additions.
|
|
47
|
+
- Type declarations (`dist/index.d.ts`) now export the six new components.
|
|
48
|
+
|
|
49
|
+
## [0.2.0] — 2026-08-31
|
|
50
|
+
|
|
51
|
+
Five new components, bringing the library to 33 components (34 registered tags,
|
|
52
|
+
including `UiIcon`). All additions are backward compatible.
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- **`UiCard`** — the surface primitive: a bordered, rounded, elevated container
|
|
57
|
+
with optional `header` / default / `footer` slots. Renders as any element via
|
|
58
|
+
`tag` (so a whole card can be a link), with `interactive` (hover lift),
|
|
59
|
+
`highlighted` (accent border) and `focusRing` (for the stretched-link pattern)
|
|
60
|
+
states, plus `padding`, `radius`, `shadow` and `bordered` options. External
|
|
61
|
+
classes merge via `tailwind-merge`, so a caller's hover border wins over the
|
|
62
|
+
default.
|
|
63
|
+
- **`UiSectionHeading`** — eyebrow / heading / standfirst trio. The heading tag
|
|
64
|
+
(`level`) follows the document outline while the visual `size` is set
|
|
65
|
+
separately; supports `align`, `id` and `title` / `subtitle` / default slots.
|
|
66
|
+
- **`UiBreadcrumb`** — navigation trail whose final item renders as
|
|
67
|
+
`aria-current="page"` text rather than a link. Links render through `linkTag`
|
|
68
|
+
(e.g. a router link component), separators are decorative, and an `item` scoped
|
|
69
|
+
slot allows full control of each entry.
|
|
70
|
+
- **`UiSegmented`** — segmented single-select control with a pill that slides to
|
|
71
|
+
the active option. A group of `aria-pressed` toggle buttons (not a switch),
|
|
72
|
+
with `size` and `shape` options; bind with `v-model`.
|
|
73
|
+
- **`UiIconTile`** — a rounded, tinted tile holding a single icon, for product
|
|
74
|
+
marks and feature glyphs. Semantic `color` palette and four `size`s; pass
|
|
75
|
+
`bg-*`/`text-*` classes to use a colour outside the semantic set (merged via
|
|
76
|
+
`tailwind-merge`).
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- README component list and counts updated for the five additions.
|
|
81
|
+
- Type declarations (`dist/index.d.ts`) now export the five new components.
|
|
82
|
+
|
|
83
|
+
## [0.1.1]
|
|
84
|
+
|
|
85
|
+
- First published release: 28 components (29 registered tags), consumable as a
|
|
86
|
+
Nuxt module, a Vite plugin or a framework-agnostic Vue plugin.
|
|
87
|
+
|
|
88
|
+
[0.3.0]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.3.0
|
|
89
|
+
[0.2.0]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.2.0
|
|
90
|
+
[0.1.1]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.1.1
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Numori UI
|
|
2
2
|
|
|
3
|
-
The Numori design system as a standalone Vue 3 component library.
|
|
3
|
+
The Numori design system as a standalone Vue 3 component library. 39 components, Tailwind CSS v4, no
|
|
4
4
|
TypeScript, consumable as a **Nuxt module** or a **Vite plugin**.
|
|
5
5
|
|
|
6
6
|
Extracted from [Numori Notes](https://github.com/Numori-Ecosystem/Numori-Notes), where these
|
|
@@ -133,7 +133,7 @@ import './style.css'
|
|
|
133
133
|
createApp(App).use(createNumoriUI({ UiButton, UiModal })).mount('#app')
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
There is also `app.use(NumoriUI)`, which registers all
|
|
136
|
+
There is also `app.use(NumoriUI)`, which registers all 40 components in one line — convenient for
|
|
137
137
|
prototyping, but it bundles all of them. See [Tree-shaking](#tree-shaking).
|
|
138
138
|
|
|
139
139
|
## Styling
|
|
@@ -235,8 +235,8 @@ external, so the numbers are Numori UI's own code:
|
|
|
235
235
|
only import what a template references, so nothing further is needed — verified by checking that
|
|
236
236
|
`Numpad`, `Popup` and `Prompt` are absent from the Nuxt playground's client bundle.
|
|
237
237
|
|
|
238
|
-
**`app.use(NumoriUI)` is the one path that is not tree-shakeable.** To register all
|
|
239
|
-
has to reference all
|
|
238
|
+
**`app.use(NumoriUI)` is the one path that is not tree-shakeable.** To register all 40 components it
|
|
239
|
+
has to reference all 40, so they all end up in your bundle. The `include` option does not change
|
|
240
240
|
this — it controls registration, not bundling. Use `createNumoriUI` instead when size matters:
|
|
241
241
|
|
|
242
242
|
```js
|
|
@@ -297,7 +297,8 @@ export default defineNuxtConfig({
|
|
|
297
297
|
Every component is documented with JSDoc at the top of its source file, including props, events,
|
|
298
298
|
slots and worked examples. Prefixes below assume the default `Ui`.
|
|
299
299
|
|
|
300
|
-
**Actions** — `UiButton` (8 variants × 6 colours × 5 sizes × 5 shapes), `UiButtonsGroup
|
|
300
|
+
**Actions** — `UiButton` (8 variants × 6 colours × 5 sizes × 5 shapes), `UiButtonsGroup`,
|
|
301
|
+
`UiSegmented` (single-select with a sliding pill), `UiThemeToggle` (stateless light/dark button)
|
|
301
302
|
|
|
302
303
|
**Forms** — `UiInput` (text, number with steppers, password with toggle, email, phone, textarea,
|
|
303
304
|
built-in validation), `UiSelect` (searchable, groupable, teleported panel), `UiCheckbox`, `UiRadio`,
|
|
@@ -306,9 +307,13 @@ built-in validation), `UiSelect` (searchable, groupable, teleported panel), `UiC
|
|
|
306
307
|
**Overlays** — `UiModal` (teleported, fullscreen-on-mobile, safe-area aware), `UiPrompt`,
|
|
307
308
|
`UiDropdown`, `UiDropdownItem`, `UiDropdownRow`, `UiDropdownSubmenu`, `UiPopup`, `UiTooltip`
|
|
308
309
|
|
|
309
|
-
**Feedback** — `UiAlert`, `UiBadge`, `UiProgressBar`
|
|
310
|
+
**Feedback** — `UiAlert`, `UiBadge`, `UiProgressBar`, `UiSpinner` (loading glyph),
|
|
311
|
+
`UiToast` (transient message stack), `UiBanner` (full-width status strip)
|
|
310
312
|
|
|
311
|
-
**Layout & display** — `
|
|
313
|
+
**Layout & display** — `UiCard` (the surface primitive, with interactive and highlighted states),
|
|
314
|
+
`UiSectionHeading` (eyebrow / heading / standfirst), `UiBreadcrumb`, `UiIconTile` (tinted icon tile),
|
|
315
|
+
`UiComparisonTable` (accessible two-way comparison), `UiCodeBlock` (copyable snippet), `UiListMenu`,
|
|
316
|
+
`UiListMenuItem`, `UiDivider`, `UiAvatar`, `UiKbd`, `UiIcon`
|
|
312
317
|
|
|
313
318
|
External classes always win. `UiButton` merges them with
|
|
314
319
|
[tailwind-merge](https://github.com/dcastil/tailwind-merge), so `class="bg-gray-100"` genuinely
|
|
@@ -381,7 +386,7 @@ app.use(NumoriUI, {
|
|
|
381
386
|
})
|
|
382
387
|
```
|
|
383
388
|
|
|
384
|
-
Registers all
|
|
389
|
+
Registers all 40 components, and bundles all of them — reach for `createNumoriUI` when that matters:
|
|
385
390
|
|
|
386
391
|
```js
|
|
387
392
|
app.use(createNumoriUI({ UiButton, UiModal }, { icons: { component: MyIcon } }))
|
|
@@ -415,7 +420,7 @@ into the component on the source path but emit a _second_ CSS file on the bundle
|
|
|
415
420
|
with one CSS import in some setups and two in others.
|
|
416
421
|
|
|
417
422
|
**SSR-safe.** Numori Notes is a client-only SPA and never exercised server rendering, so the
|
|
418
|
-
extraction fixed several components that touched `document` or `window` during setup. All
|
|
423
|
+
extraction fixed several components that touched `document` or `window` during setup. All 33 render
|
|
419
424
|
under strict SSR with no DOM globals, verified on every build.
|
|
420
425
|
|
|
421
426
|
## Development
|
|
@@ -454,6 +459,12 @@ npm run icons && npm run build && npm test
|
|
|
454
459
|
It reports anything it could not translate mechanically and exits non-zero, so an upstream change
|
|
455
460
|
that outgrows the codemod fails loudly instead of shipping broken.
|
|
456
461
|
|
|
462
|
+
## Changelog
|
|
463
|
+
|
|
464
|
+
See [CHANGELOG.md](./CHANGELOG.md) for the release history. The current release is
|
|
465
|
+
**0.3.0**, which adds `UiToast`, `UiBanner`, `UiSpinner`, `UiThemeToggle`, `UiCodeBlock` and
|
|
466
|
+
`UiComparisonTable`.
|
|
467
|
+
|
|
457
468
|
## Licence and attribution
|
|
458
469
|
|
|
459
470
|
Numori UI is licensed under [AGPL-3.0](./LICENSE), matching the rest of the Numori ecosystem. Note
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx, withModifiers } from "vue";
|
|
3
|
+
//#region src/components/Banner.vue
|
|
4
|
+
var _hoisted_1 = { class: "relative flex items-center justify-center gap-2 px-4 py-1.5" };
|
|
5
|
+
var _hoisted_2 = ["aria-label"];
|
|
6
|
+
var _sfc_main = {
|
|
7
|
+
__name: "Banner",
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the banner is shown. Drive this from the condition it reports;
|
|
11
|
+
* toggling it runs the slide-in / collapse-out transition.
|
|
12
|
+
* @type {boolean}
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
show: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Colour of the bar.
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @default 'info'
|
|
23
|
+
* @values 'info' | 'success' | 'warning' | 'error' | 'neutral'
|
|
24
|
+
*/
|
|
25
|
+
color: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "info"
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Optional MDI icon shown before the message.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @default ''
|
|
33
|
+
*/
|
|
34
|
+
icon: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Message text. Ignored when the default slot is used.
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @default ''
|
|
42
|
+
*/
|
|
43
|
+
message: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Makes the whole bar a button that emits `click`.
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
clickable: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Adds a close control that emits `dismiss`.
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
dismissible: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Accessible label for the dismiss control.
|
|
67
|
+
* @type {string}
|
|
68
|
+
* @default 'Dismiss'
|
|
69
|
+
*/
|
|
70
|
+
dismissLabel: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "Dismiss"
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Pads for the top safe-area inset, for a banner pinned to the top of the
|
|
76
|
+
* screen. Turn off when the banner sits lower in the layout.
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
safeArea: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
emits: ["click", "dismiss"],
|
|
86
|
+
setup(__props, { emit: __emit }) {
|
|
87
|
+
/**
|
|
88
|
+
* UiBanner — a full-width status strip that slides in above the content.
|
|
89
|
+
*
|
|
90
|
+
* The shape shared by "you're offline", "your email isn't verified" and "a new
|
|
91
|
+
* version is available": a thin, edge-to-edge bar that expands into view, states
|
|
92
|
+
* one thing with an optional icon, and collapses away when the condition clears.
|
|
93
|
+
* Mount it permanently and drive `show` from the condition; the height/opacity
|
|
94
|
+
* transition does the appearing and disappearing.
|
|
95
|
+
*
|
|
96
|
+
* It sits at the top of the layout, so it honours the top safe-area inset by
|
|
97
|
+
* default — on a notched phone the padding keeps the text out from under the
|
|
98
|
+
* status bar. Turn `safeArea` off for a banner that is not at the very top.
|
|
99
|
+
*
|
|
100
|
+
* Two optional affordances: `clickable` turns the whole bar into a button (for
|
|
101
|
+
* "tap here to verify"), and `dismissible` adds a close control. They emit
|
|
102
|
+
* `click` and `dismiss` respectively — the parent decides what those mean.
|
|
103
|
+
*
|
|
104
|
+
* Colour is a small semantic set rather than free-form, so banners stay
|
|
105
|
+
* consistent across apps; pass `bg-*`/`text-*` classes to step outside it.
|
|
106
|
+
*
|
|
107
|
+
* @example Offline notice
|
|
108
|
+
* <UiBanner :show="offline" color="warning" icon="mdi:wifi-off"
|
|
109
|
+
* message="You're offline — changes will sync when you reconnect" />
|
|
110
|
+
*
|
|
111
|
+
* @example Tappable call to action
|
|
112
|
+
* <UiBanner :show="!verified" color="info" icon="mdi:email-alert-outline"
|
|
113
|
+
* clickable message="Your email is not verified — tap here to verify"
|
|
114
|
+
* @click="openVerify" />
|
|
115
|
+
*/
|
|
116
|
+
const props = __props;
|
|
117
|
+
const emit = __emit;
|
|
118
|
+
/**
|
|
119
|
+
* Banner colours come from the design tokens so a rebrand carries through.
|
|
120
|
+
* `info` uses the primary ramp; `neutral` is the surface grey.
|
|
121
|
+
*/
|
|
122
|
+
const COLORS = {
|
|
123
|
+
info: "bg-primary-600 dark:bg-primary-700 text-white",
|
|
124
|
+
success: "bg-success-600 dark:bg-success-700 text-white",
|
|
125
|
+
warning: "bg-warning-500 dark:bg-warning-600 text-white",
|
|
126
|
+
error: "bg-error-600 dark:bg-error-700 text-white",
|
|
127
|
+
neutral: "bg-gray-800 dark:bg-gray-700 text-white"
|
|
128
|
+
};
|
|
129
|
+
const colorClass = computed(() => COLORS[props.color] || COLORS.info);
|
|
130
|
+
return (_ctx, _cache) => {
|
|
131
|
+
return openBlock(), createBlock(Transition, {
|
|
132
|
+
"enter-active-class": "transition-all duration-300 ease-out",
|
|
133
|
+
"enter-from-class": "max-h-0 opacity-0",
|
|
134
|
+
"enter-to-class": "max-h-24 opacity-100",
|
|
135
|
+
"leave-active-class": "transition-all duration-200 ease-in",
|
|
136
|
+
"leave-from-class": "max-h-24 opacity-100",
|
|
137
|
+
"leave-to-class": "max-h-0 opacity-0"
|
|
138
|
+
}, {
|
|
139
|
+
default: withCtx(() => [__props.show ? (openBlock(), createBlock(resolveDynamicComponent(__props.clickable ? "button" : "div"), {
|
|
140
|
+
key: 0,
|
|
141
|
+
class: normalizeClass(["w-full shrink-0 overflow-hidden text-xs font-medium", [colorClass.value, __props.clickable && "cursor-pointer text-left"]]),
|
|
142
|
+
style: normalizeStyle(__props.safeArea ? { paddingTop: "env(safe-area-inset-top, 0px)" } : void 0),
|
|
143
|
+
type: __props.clickable ? "button" : void 0,
|
|
144
|
+
role: "status",
|
|
145
|
+
onClick: _cache[1] || (_cache[1] = ($event) => __props.clickable && emit("click"))
|
|
146
|
+
}, {
|
|
147
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [
|
|
148
|
+
__props.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
149
|
+
key: 0,
|
|
150
|
+
name: __props.icon,
|
|
151
|
+
class: "w-3.5 h-3.5 shrink-0"
|
|
152
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
153
|
+
createElementVNode("span", null, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.message), 1)])]),
|
|
154
|
+
__props.dismissible ? (openBlock(), createElementBlock("button", {
|
|
155
|
+
key: 1,
|
|
156
|
+
type: "button",
|
|
157
|
+
class: "absolute right-3 inline-flex items-center opacity-80 hover:opacity-100",
|
|
158
|
+
"aria-label": __props.dismissLabel,
|
|
159
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("dismiss"), ["stop"]))
|
|
160
|
+
}, [createVNode(_sfc_main$1, {
|
|
161
|
+
name: "mdi:close",
|
|
162
|
+
class: "w-3.5 h-3.5"
|
|
163
|
+
})], 8, _hoisted_2)) : createCommentVNode("", true)
|
|
164
|
+
])]),
|
|
165
|
+
_: 3
|
|
166
|
+
}, 8, [
|
|
167
|
+
"class",
|
|
168
|
+
"style",
|
|
169
|
+
"type"
|
|
170
|
+
])) : createCommentVNode("", true)]),
|
|
171
|
+
_: 3
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
export { _sfc_main as default };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","names":[],"sources":["../../src/components/Banner.vue"],"sourcesContent":["<template>\n <Transition\n enter-active-class=\"transition-all duration-300 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-24 opacity-100\"\n leave-active-class=\"transition-all duration-200 ease-in\"\n leave-from-class=\"max-h-24 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <component\n :is=\"clickable ? 'button' : 'div'\"\n v-if=\"show\"\n class=\"w-full shrink-0 overflow-hidden text-xs font-medium\"\n :class=\"[colorClass, clickable && 'cursor-pointer text-left']\"\n :style=\"safeArea ? { paddingTop: 'env(safe-area-inset-top, 0px)' } : undefined\"\n :type=\"clickable ? 'button' : undefined\"\n role=\"status\"\n @click=\"clickable && emit('click')\"\n >\n <div class=\"relative flex items-center justify-center gap-2 px-4 py-1.5\">\n <UiIcon v-if=\"icon\" :name=\"icon\" class=\"w-3.5 h-3.5 shrink-0\" />\n <span\n ><slot>{{ message }}</slot></span\n >\n\n <button\n v-if=\"dismissible\"\n type=\"button\"\n class=\"absolute right-3 inline-flex items-center opacity-80 hover:opacity-100\"\n :aria-label=\"dismissLabel\"\n @click.stop=\"emit('dismiss')\"\n >\n <UiIcon name=\"mdi:close\" class=\"w-3.5 h-3.5\" />\n </button>\n </div>\n </component>\n </Transition>\n</template>\n\n<script setup>\n/**\n * UiBanner — a full-width status strip that slides in above the content.\n *\n * The shape shared by \"you're offline\", \"your email isn't verified\" and \"a new\n * version is available\": a thin, edge-to-edge bar that expands into view, states\n * one thing with an optional icon, and collapses away when the condition clears.\n * Mount it permanently and drive `show` from the condition; the height/opacity\n * transition does the appearing and disappearing.\n *\n * It sits at the top of the layout, so it honours the top safe-area inset by\n * default — on a notched phone the padding keeps the text out from under the\n * status bar. Turn `safeArea` off for a banner that is not at the very top.\n *\n * Two optional affordances: `clickable` turns the whole bar into a button (for\n * \"tap here to verify\"), and `dismissible` adds a close control. They emit\n * `click` and `dismiss` respectively — the parent decides what those mean.\n *\n * Colour is a small semantic set rather than free-form, so banners stay\n * consistent across apps; pass `bg-*`/`text-*` classes to step outside it.\n *\n * @example Offline notice\n * <UiBanner :show=\"offline\" color=\"warning\" icon=\"mdi:wifi-off\"\n * message=\"You're offline — changes will sync when you reconnect\" />\n *\n * @example Tappable call to action\n * <UiBanner :show=\"!verified\" color=\"info\" icon=\"mdi:email-alert-outline\"\n * clickable message=\"Your email is not verified — tap here to verify\"\n * @click=\"openVerify\" />\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Whether the banner is shown. Drive this from the condition it reports;\n * toggling it runs the slide-in / collapse-out transition.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Colour of the bar.\n * @type {string}\n * @default 'info'\n * @values 'info' | 'success' | 'warning' | 'error' | 'neutral'\n */\n color: { type: String, default: 'info' },\n\n /**\n * Optional MDI icon shown before the message.\n * @type {string}\n * @default ''\n */\n icon: { type: String, default: '' },\n\n /**\n * Message text. Ignored when the default slot is used.\n * @type {string}\n * @default ''\n */\n message: { type: String, default: '' },\n\n /**\n * Makes the whole bar a button that emits `click`.\n * @type {boolean}\n * @default false\n */\n clickable: { type: Boolean, default: false },\n\n /**\n * Adds a close control that emits `dismiss`.\n * @type {boolean}\n * @default false\n */\n dismissible: { type: Boolean, default: false },\n\n /**\n * Accessible label for the dismiss control.\n * @type {string}\n * @default 'Dismiss'\n */\n dismissLabel: { type: String, default: 'Dismiss' },\n\n /**\n * Pads for the top safe-area inset, for a banner pinned to the top of the\n * screen. Turn off when the banner sits lower in the layout.\n * @type {boolean}\n * @default true\n */\n safeArea: { type: Boolean, default: true },\n})\n\nconst emit = defineEmits(['click', 'dismiss'])\n\n/**\n * Banner colours come from the design tokens so a rebrand carries through.\n * `info` uses the primary ramp; `neutral` is the surface grey.\n */\nconst COLORS = {\n info: 'bg-primary-600 dark:bg-primary-700 text-white',\n success: 'bg-success-600 dark:bg-success-700 text-white',\n warning: 'bg-warning-500 dark:bg-warning-600 text-white',\n error: 'bg-error-600 dark:bg-error-700 text-white',\n neutral: 'bg-gray-800 dark:bg-gray-700 text-white',\n}\n\nconst colorClass = computed(() => COLORS[props.color] || COLORS.info)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEA,MAAM,QAAQ;EA6Dd,MAAM,OAAO;;;;;EAMb,MAAM,SAAS;GACb,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACP,SAAS;EACX;EAEA,MAAM,aAAa,eAAe,OAAO,MAAM,UAAU,OAAO,IAAI;;GAlJlE,OAAA,UAAA,GAAA,YAmCa,YAAA;IAlCX,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;IACf,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;;IAEf,SAAA,cA0BY,CAxBJ,QAAA,QAFR,UAAA,GAAA,YA0BY,wBAzBL,QAAA,YAAS,WAAA,KAAA,GAAA;;KAEd,OAAK,eAAA,CAAC,uDAAqD,CAClD,WAAA,OAAY,QAAA,aAAS,0BAAA,CAAA,CAAA;KAC7B,OAAK,eAAE,QAAA,WAAQ,EAAA,YAAA,gCAAA,IAAqD,KAAA,CAAS;KAC7E,MAAM,QAAA,YAAS,WAAc,KAAA;KAC9B,MAAK;KACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,aAAa,KAAI,OAAA;;KAEzB,SAAA,cAeM,CAfN,mBAeM,OAfN,YAeM;MAdU,QAAA,QAAd,UAAA,GAAA,YAAgE,aAAA;;OAA3C,MAAM,QAAA;OAAM,OAAM;;MACvC,mBAEC,QAAA,MAAA,CADE,WAA0B,KAAA,QAAA,WAAA,CAAA,SAAA,CAAjB,gBAAA,gBAAA,QAAA,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MAIX,QAAA,eADR,UAAA,GAAA,mBAQS,UAAA;;OANP,MAAK;OACL,OAAM;OACL,cAAY,QAAA;OACZ,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,WAAO,KAAI,SAAA,GAAA,CAAA,MAAA,CAAA;MAEjB,GAAA,CAAA,YAA+C,aAAA;OAAvC,MAAK;OAAY,OAAM"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, openBlock, renderList, renderSlot, resolveDynamicComponent, toDisplayString, withCtx } from "vue";
|
|
3
|
+
//#region src/components/Breadcrumb.vue
|
|
4
|
+
var _hoisted_1 = ["aria-label"];
|
|
5
|
+
var _hoisted_2 = { class: "flex flex-wrap items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400" };
|
|
6
|
+
var _hoisted_3 = {
|
|
7
|
+
key: 1,
|
|
8
|
+
"aria-current": "page",
|
|
9
|
+
class: "font-medium text-gray-900 dark:text-gray-200"
|
|
10
|
+
};
|
|
11
|
+
var _sfc_main = {
|
|
12
|
+
__name: "Breadcrumb",
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* Trail entries, ordered from the root down. Each is
|
|
16
|
+
* `{ label, to?, href? }`; the final entry always renders as plain text.
|
|
17
|
+
* @type {Array<{ label: string, to?: any, href?: string }>}
|
|
18
|
+
*/
|
|
19
|
+
items: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Accessible name for the surrounding `<nav>`.
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @default 'Breadcrumb'
|
|
27
|
+
*/
|
|
28
|
+
ariaLabel: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "Breadcrumb"
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Element or globally registered component used for linked entries.
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @default 'a'
|
|
36
|
+
*/
|
|
37
|
+
linkTag: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "a"
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* MDI icon drawn between entries.
|
|
43
|
+
* @type {string}
|
|
44
|
+
* @default 'mdi:chevron-right'
|
|
45
|
+
*/
|
|
46
|
+
separatorIcon: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "mdi:chevron-right"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
setup(__props) {
|
|
52
|
+
/**
|
|
53
|
+
* UiBreadcrumb — the trail from the site root down to the current page.
|
|
54
|
+
*
|
|
55
|
+
* The final item always renders as text with `aria-current="page"`, never a
|
|
56
|
+
* link: pointing a link at the page you are already on is noise for keyboard and
|
|
57
|
+
* screen-reader users. Separators are decorative icons.
|
|
58
|
+
*
|
|
59
|
+
* Links are rendered with `linkTag`, so a router link component can be used
|
|
60
|
+
* instead of a plain anchor — pass `link-tag="NuxtLink"` (or `RouterLink`) and
|
|
61
|
+
* give each item a `to`. For anything more involved, the `item` scoped slot
|
|
62
|
+
* hands back `{ item, index, isLast }` for full control of each entry.
|
|
63
|
+
*
|
|
64
|
+
* @example Anchor links
|
|
65
|
+
* <UiBreadcrumb
|
|
66
|
+
* :items="[
|
|
67
|
+
* { label: 'Home', href: '/' },
|
|
68
|
+
* { label: 'Docs', href: '/docs' },
|
|
69
|
+
* { label: 'Buttons' },
|
|
70
|
+
* ]"
|
|
71
|
+
* />
|
|
72
|
+
*
|
|
73
|
+
* @example Router links
|
|
74
|
+
* <UiBreadcrumb link-tag="NuxtLink" :items="[{ label: 'Products', to: '/products' }, { label: product.name }]" />
|
|
75
|
+
*
|
|
76
|
+
* @slot item — Override a single entry. Scope: `{ item, index, isLast }`.
|
|
77
|
+
*/
|
|
78
|
+
return (_ctx, _cache) => {
|
|
79
|
+
return openBlock(), createElementBlock("nav", { "aria-label": __props.ariaLabel }, [createElementVNode("ol", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
80
|
+
return openBlock(), createElementBlock("li", {
|
|
81
|
+
key: item.label,
|
|
82
|
+
class: "flex items-center gap-1.5"
|
|
83
|
+
}, [index > 0 ? (openBlock(), createBlock(_sfc_main$1, {
|
|
84
|
+
key: 0,
|
|
85
|
+
name: __props.separatorIcon,
|
|
86
|
+
class: "size-4 text-gray-400 dark:text-gray-600"
|
|
87
|
+
}, null, 8, ["name"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "item", {
|
|
88
|
+
item,
|
|
89
|
+
index,
|
|
90
|
+
isLast: index === __props.items.length - 1
|
|
91
|
+
}, () => [(item.to || item.href) && index < __props.items.length - 1 ? (openBlock(), createBlock(resolveDynamicComponent(__props.linkTag), {
|
|
92
|
+
key: 0,
|
|
93
|
+
to: item.to,
|
|
94
|
+
href: item.href,
|
|
95
|
+
class: "rounded transition-colors hover:text-gray-900 dark:hover:text-gray-100"
|
|
96
|
+
}, {
|
|
97
|
+
default: withCtx(() => [createTextVNode(toDisplayString(item.label), 1)]),
|
|
98
|
+
_: 2
|
|
99
|
+
}, 1032, ["to", "href"])) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(item.label), 1))])]);
|
|
100
|
+
}), 128))])], 8, _hoisted_1);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { _sfc_main as default };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../src/components/Breadcrumb.vue"],"sourcesContent":["<template>\n <nav :aria-label=\"ariaLabel\">\n <ol class=\"flex flex-wrap items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400\">\n <li v-for=\"(item, index) in items\" :key=\"item.label\" class=\"flex items-center gap-1.5\">\n <UiIcon\n v-if=\"index > 0\"\n :name=\"separatorIcon\"\n class=\"size-4 text-gray-400 dark:text-gray-600\"\n />\n\n <slot name=\"item\" :item=\"item\" :index=\"index\" :is-last=\"index === items.length - 1\">\n <component\n :is=\"linkTag\"\n v-if=\"(item.to || item.href) && index < items.length - 1\"\n :to=\"item.to\"\n :href=\"item.href\"\n class=\"rounded transition-colors hover:text-gray-900 dark:hover:text-gray-100\"\n >\n {{ item.label }}\n </component>\n\n <span v-else aria-current=\"page\" class=\"font-medium text-gray-900 dark:text-gray-200\">\n {{ item.label }}\n </span>\n </slot>\n </li>\n </ol>\n </nav>\n</template>\n\n<script setup>\n/**\n * UiBreadcrumb — the trail from the site root down to the current page.\n *\n * The final item always renders as text with `aria-current=\"page\"`, never a\n * link: pointing a link at the page you are already on is noise for keyboard and\n * screen-reader users. Separators are decorative icons.\n *\n * Links are rendered with `linkTag`, so a router link component can be used\n * instead of a plain anchor — pass `link-tag=\"NuxtLink\"` (or `RouterLink`) and\n * give each item a `to`. For anything more involved, the `item` scoped slot\n * hands back `{ item, index, isLast }` for full control of each entry.\n *\n * @example Anchor links\n * <UiBreadcrumb\n * :items=\"[\n * { label: 'Home', href: '/' },\n * { label: 'Docs', href: '/docs' },\n * { label: 'Buttons' },\n * ]\"\n * />\n *\n * @example Router links\n * <UiBreadcrumb link-tag=\"NuxtLink\" :items=\"[{ label: 'Products', to: '/products' }, { label: product.name }]\" />\n *\n * @slot item — Override a single entry. Scope: `{ item, index, isLast }`.\n */\nimport UiIcon from '../icons/Icon.vue'\n\ndefineProps({\n /**\n * Trail entries, ordered from the root down. Each is\n * `{ label, to?, href? }`; the final entry always renders as plain text.\n * @type {Array<{ label: string, to?: any, href?: string }>}\n */\n items: { type: Array, required: true },\n\n /**\n * Accessible name for the surrounding `<nav>`.\n * @type {string}\n * @default 'Breadcrumb'\n */\n ariaLabel: { type: String, default: 'Breadcrumb' },\n\n /**\n * Element or globally registered component used for linked entries.\n * @type {string}\n * @default 'a'\n */\n linkTag: { type: String, default: 'a' },\n\n /**\n * MDI icon drawn between entries.\n * @type {string}\n * @default 'mdi:chevron-right'\n */\n separatorIcon: { type: String, default: 'mdi:chevron-right' },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACE,OAAA,UAAA,GAAA,mBA0BM,OAAA,EA1BA,cAAY,QAAA,UAAS,GAAA,CACzB,mBAwBK,MAxBL,YAwBK,EAvBH,UAAA,IAAA,GAAA,mBAsBK,UAAA,MAAA,WAtBuB,QAAA,QAAhB,MAAM,UAAK;IAAvB,OAAA,UAAA,GAAA,mBAsBK,MAAA;KAtB+B,KAAK,KAAK;KAAO,OAAM;IAEjD,GAAA,CAAA,QAAK,KADb,UAAA,GAAA,YAIE,aAAA;;KAFC,MAAM,QAAA;KACP,OAAM;IAGR,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,WAcO,KAAA,QAAA,QAAA;KAdkB;KAAc;KAAQ,QAAS,UAAU,QAAA,MAAM,SAAM;IAA9E,SAcO,EAXI,KAAK,MAAM,KAAK,SAAS,QAAQ,QAAA,MAAM,SAAM,KAFtD,UAAA,GAAA,YAQY,wBAPL,QAAA,OAAO,GAAA;;KAEX,IAAI,KAAK;KACT,MAAM,KAAK;KACZ,OAAM;;KAEN,SAAA,cAAgB,CAAb,gBAAA,gBAAA,KAAK,KAAK,GAAA,CAAA,CAAA,CAAA;;IAGf,GAAA,MAAA,CAAA,MAAA,MAAA,CAAA,MAAA,UAAA,GAAA,mBAEO,QAFP,YAEO,gBADF,KAAK,KAAK,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, mergeProps, openBlock, renderSlot, resolveDynamicComponent, useAttrs, withCtx } from "vue";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
//#region src/components/Card.vue
|
|
4
|
+
var _hoisted_1 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "mb-4 border-b border-gray-100 pb-4 dark:border-gray-800"
|
|
7
|
+
};
|
|
8
|
+
var _hoisted_2 = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "mt-auto border-t border-gray-100 pt-4 dark:border-gray-800"
|
|
11
|
+
};
|
|
12
|
+
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
13
|
+
__name: "Card",
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* HTML element (or globally registered component name) to render as.
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @default 'div'
|
|
19
|
+
* @values 'div' | 'article' | 'section' | 'a' | 'li' | any valid tag
|
|
20
|
+
*/
|
|
21
|
+
tag: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "div"
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Inner padding.
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @default 'md'
|
|
29
|
+
* @values 'none' | 'xs' | 'sm' | 'md' | 'lg'
|
|
30
|
+
*/
|
|
31
|
+
padding: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "md"
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Corner radius.
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @default '2xl'
|
|
39
|
+
* @values 'lg' | 'xl' | '2xl'
|
|
40
|
+
*/
|
|
41
|
+
radius: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "2xl"
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Base drop shadow. `interactive` raises this to `card-hover` on hover.
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @default 'card'
|
|
49
|
+
* @values 'none' | 'card' | 'card-hover'
|
|
50
|
+
*/
|
|
51
|
+
shadow: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "card"
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Draw the surface border. On by default; turn off for cards that sit on a
|
|
57
|
+
* tinted panel and provide their own separation.
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
bordered: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: true
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Hover affordance: a small lift and a stronger shadow, with the transition
|
|
67
|
+
* disabled under `prefers-reduced-motion`. Border-color is included in the
|
|
68
|
+
* transition but left untinted, so add a `hover:border-*` (or `group-hover:
|
|
69
|
+
* border-*`) class to colour the border on hover.
|
|
70
|
+
* @type {boolean}
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
interactive: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Recommended / featured state: accent border and a raised shadow, for the
|
|
79
|
+
* one card in a group that should draw the eye.
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
highlighted: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Lift the focus ring to the card when a single descendant link is stretched
|
|
89
|
+
* over the whole surface (the `after:absolute after:inset-0` pattern). The
|
|
90
|
+
* card becomes the positioning context and shows the ring on focus-within.
|
|
91
|
+
* @type {boolean}
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
focusRing: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
setup(__props) {
|
|
100
|
+
/**
|
|
101
|
+
* UiCard — the surface primitive: a bordered, rounded container with the
|
|
102
|
+
* design system's card elevation, dark-mode surface, and optional interactive
|
|
103
|
+
* and highlighted states.
|
|
104
|
+
*
|
|
105
|
+
* It is the shell only. Card lays out header / default / footer slots but takes
|
|
106
|
+
* no view over their contents, so product cards, blog cards, pricing tiers and
|
|
107
|
+
* link tiles can all share one surface while keeping their own internals.
|
|
108
|
+
*
|
|
109
|
+
* Renders as any element via `tag`, so a whole card can be a single link
|
|
110
|
+
* (`tag="a"`) or an article. External Tailwind classes are merged with
|
|
111
|
+
* `tailwind-merge`, so a caller's `hover:border-primary-300` wins over the
|
|
112
|
+
* neutral hover border added by `interactive` rather than doubling up.
|
|
113
|
+
*
|
|
114
|
+
* @example Basic card
|
|
115
|
+
* <UiCard>
|
|
116
|
+
* <h3 class="font-semibold">Title</h3>
|
|
117
|
+
* <p class="text-sm text-gray-600 dark:text-gray-400">Body copy.</p>
|
|
118
|
+
* </UiCard>
|
|
119
|
+
*
|
|
120
|
+
* @example Interactive card that is one big link (stretched-link pattern)
|
|
121
|
+
* <UiCard tag="article" interactive focus-ring>
|
|
122
|
+
* <h3><a href="/x" class="after:absolute after:inset-0">Title</a></h3>
|
|
123
|
+
* </UiCard>
|
|
124
|
+
*
|
|
125
|
+
* @example Highlighted pricing tier with a footer action
|
|
126
|
+
* <UiCard highlighted padding="lg" class="flex h-full flex-col">
|
|
127
|
+
* …
|
|
128
|
+
* <template #footer><UiButton block>Choose</UiButton></template>
|
|
129
|
+
* </UiCard>
|
|
130
|
+
*
|
|
131
|
+
* @slot default — Card body.
|
|
132
|
+
* @slot header — Optional header, drawn above the body with a divider.
|
|
133
|
+
* @slot footer — Optional footer, drawn below the body with a divider.
|
|
134
|
+
*/
|
|
135
|
+
const props = __props;
|
|
136
|
+
const attrs = useAttrs();
|
|
137
|
+
const restAttrs = computed(() => {
|
|
138
|
+
const { class: _class, ...rest } = attrs;
|
|
139
|
+
return rest;
|
|
140
|
+
});
|
|
141
|
+
const paddingClass = computed(() => ({
|
|
142
|
+
none: "",
|
|
143
|
+
xs: "p-3",
|
|
144
|
+
sm: "p-4",
|
|
145
|
+
md: "p-5",
|
|
146
|
+
lg: "p-6"
|
|
147
|
+
})[props.padding] ?? "p-5");
|
|
148
|
+
const radiusClass = computed(() => ({
|
|
149
|
+
lg: "rounded-lg",
|
|
150
|
+
xl: "rounded-xl",
|
|
151
|
+
"2xl": "rounded-2xl"
|
|
152
|
+
})[props.radius] ?? "rounded-2xl");
|
|
153
|
+
const shadowClass = computed(() => ({
|
|
154
|
+
none: "",
|
|
155
|
+
card: "shadow-card",
|
|
156
|
+
"card-hover": "shadow-card-hover"
|
|
157
|
+
})[props.shadow] ?? "shadow-card");
|
|
158
|
+
const mergedClasses = computed(() => twMerge("bg-white dark:bg-gray-900", props.focusRing ? "relative" : "", radiusClass.value, props.bordered ? "border border-gray-200 dark:border-gray-700" : "", shadowClass.value, props.interactive ? "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" : "", props.highlighted ? "border-primary-400 shadow-card-hover ring-1 ring-primary-400/20 dark:border-primary-400/60 dark:ring-primary-400/25" : "", props.focusRing ? "focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-primary-500 dark:focus-within:outline-primary-400" : "", paddingClass.value, attrs.class));
|
|
159
|
+
return (_ctx, _cache) => {
|
|
160
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({ class: mergedClasses.value }, restAttrs.value), {
|
|
161
|
+
default: withCtx(() => [
|
|
162
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "header")])) : createCommentVNode("", true),
|
|
163
|
+
renderSlot(_ctx.$slots, "default"),
|
|
164
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "footer")])) : createCommentVNode("", true)
|
|
165
|
+
]),
|
|
166
|
+
_: 3
|
|
167
|
+
}, 16, ["class"]);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
//#endregion
|
|
172
|
+
export { _sfc_main as default };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=Card.js.map
|