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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","names":["$slots"],"sources":["../../src/components/Card.vue"],"sourcesContent":["<template>\n <!-- Dynamic root element — renders as div, article, section, or a link via :is -->\n <component :is=\"tag\" :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <!-- Optional header region, separated from the body by a hairline rule -->\n <div v-if=\"$slots.header\" class=\"mb-4 border-b border-gray-100 pb-4 dark:border-gray-800\">\n <slot name=\"header\" />\n </div>\n\n <slot />\n\n <!-- Optional footer region, pushed to the bottom in a flex-column card -->\n <div v-if=\"$slots.footer\" class=\"mt-auto border-t border-gray-100 pt-4 dark:border-gray-800\">\n <slot name=\"footer\" />\n </div>\n </component>\n</template>\n\n<script setup>\n/**\n * UiCard — the surface primitive: a bordered, rounded container with the\n * design system's card elevation, dark-mode surface, and optional interactive\n * and highlighted states.\n *\n * It is the shell only. Card lays out header / default / footer slots but takes\n * no view over their contents, so product cards, blog cards, pricing tiers and\n * link tiles can all share one surface while keeping their own internals.\n *\n * Renders as any element via `tag`, so a whole card can be a single link\n * (`tag=\"a\"`) or an article. External Tailwind classes are merged with\n * `tailwind-merge`, so a caller's `hover:border-primary-300` wins over the\n * neutral hover border added by `interactive` rather than doubling up.\n *\n * @example Basic card\n * <UiCard>\n * <h3 class=\"font-semibold\">Title</h3>\n * <p class=\"text-sm text-gray-600 dark:text-gray-400\">Body copy.</p>\n * </UiCard>\n *\n * @example Interactive card that is one big link (stretched-link pattern)\n * <UiCard tag=\"article\" interactive focus-ring>\n * <h3><a href=\"/x\" class=\"after:absolute after:inset-0\">Title</a></h3>\n * </UiCard>\n *\n * @example Highlighted pricing tier with a footer action\n * <UiCard highlighted padding=\"lg\" class=\"flex h-full flex-col\">\n * …\n * <template #footer><UiButton block>Choose</UiButton></template>\n * </UiCard>\n *\n * @slot default — Card body.\n * @slot header — Optional header, drawn above the body with a divider.\n * @slot footer — Optional footer, drawn below the body with a divider.\n */\nimport { computed, useAttrs } from 'vue'\nimport { twMerge } from 'tailwind-merge'\n\nconst props = defineProps({\n /**\n * HTML element (or globally registered component name) to render as.\n * @type {string}\n * @default 'div'\n * @values 'div' | 'article' | 'section' | 'a' | 'li' | any valid tag\n */\n tag: { type: String, default: 'div' },\n\n /**\n * Inner padding.\n * @type {string}\n * @default 'md'\n * @values 'none' | 'xs' | 'sm' | 'md' | 'lg'\n */\n padding: { type: String, default: 'md' },\n\n /**\n * Corner radius.\n * @type {string}\n * @default '2xl'\n * @values 'lg' | 'xl' | '2xl'\n */\n radius: { type: String, default: '2xl' },\n\n /**\n * Base drop shadow. `interactive` raises this to `card-hover` on hover.\n * @type {string}\n * @default 'card'\n * @values 'none' | 'card' | 'card-hover'\n */\n shadow: { type: String, default: 'card' },\n\n /**\n * Draw the surface border. On by default; turn off for cards that sit on a\n * tinted panel and provide their own separation.\n * @type {boolean}\n * @default true\n */\n bordered: { type: Boolean, default: true },\n\n /**\n * Hover affordance: a small lift and a stronger shadow, with the transition\n * disabled under `prefers-reduced-motion`. Border-color is included in the\n * transition but left untinted, so add a `hover:border-*` (or `group-hover:\n * border-*`) class to colour the border on hover.\n * @type {boolean}\n * @default false\n */\n interactive: { type: Boolean, default: false },\n\n /**\n * Recommended / featured state: accent border and a raised shadow, for the\n * one card in a group that should draw the eye.\n * @type {boolean}\n * @default false\n */\n highlighted: { type: Boolean, default: false },\n\n /**\n * Lift the focus ring to the card when a single descendant link is stretched\n * over the whole surface (the `after:absolute after:inset-0` pattern). The\n * card becomes the positioning context and shows the ring on focus-within.\n * @type {boolean}\n * @default false\n */\n focusRing: { type: Boolean, default: false },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst restAttrs = computed(() => {\n const { class: _class, ...rest } = attrs\n return rest\n})\n\nconst paddingClass = computed(\n () => ({ none: '', xs: 'p-3', sm: 'p-4', md: 'p-5', lg: 'p-6' })[props.padding] ?? 'p-5',\n)\n\nconst radiusClass = computed(\n () =>\n ({ lg: 'rounded-lg', xl: 'rounded-xl', '2xl': 'rounded-2xl' })[props.radius] ?? 'rounded-2xl',\n)\n\nconst shadowClass = computed(\n () =>\n ({ none: '', card: 'shadow-card', 'card-hover': 'shadow-card-hover' })[props.shadow] ??\n 'shadow-card',\n)\n\nconst mergedClasses = computed(() =>\n twMerge(\n 'bg-white dark:bg-gray-900',\n props.focusRing ? 'relative' : '',\n radiusClass.value,\n props.bordered ? 'border border-gray-200 dark:border-gray-700' : '',\n shadowClass.value,\n props.interactive\n ? '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'\n : '',\n props.highlighted\n ? 'border-primary-400 shadow-card-hover ring-1 ring-primary-400/20 dark:border-primary-400/60 dark:ring-primary-400/25'\n : '',\n props.focusRing\n ? 'focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-primary-500 dark:focus-within:outline-primary-400'\n : '',\n paddingClass.value,\n attrs.class,\n ),\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDA,MAAM,QAAQ;EAuEd,MAAM,QAAQ,SAAS;EACvB,MAAM,YAAY,eAAe;GAC/B,MAAM,EAAE,OAAO,QAAQ,GAAG,SAAS;GACnC,OAAO;EACT,CAAC;EAED,MAAM,eAAe,gBACZ;GAAE,MAAM;GAAI,IAAI;GAAO,IAAI;GAAO,IAAI;GAAO,IAAI;EAAM,EAAA,CAAG,MAAM,YAAY,KACrF;EAEA,MAAM,cAAc,gBAEf;GAAE,IAAI;GAAc,IAAI;GAAc,OAAO;EAAc,EAAA,CAAG,MAAM,WAAW,aACpF;EAEA,MAAM,cAAc,gBAEf;GAAE,MAAM;GAAI,MAAM;GAAe,cAAc;EAAoB,EAAA,CAAG,MAAM,WAC7E,aACJ;EAEA,MAAM,gBAAgB,eACpB,QACE,6BACA,MAAM,YAAY,aAAa,IAC/B,YAAY,OACZ,MAAM,WAAW,gDAAgD,IACjE,YAAY,OACZ,MAAM,cACF,sLACA,IACJ,MAAM,cACF,wHACA,IACJ,MAAM,YACF,gIACA,IACJ,aAAa,OACb,MAAM,KACR,CACF;;GArKE,OAAA,UAAA,GAAA,YAYY,wBAZI,QAAA,GAAG,GAAnB,WAYY,EAZU,OAAO,cAAA,MAAa,GAAU,UAAA,KAAS,GAAA;IAE3D,SAAA,cAEM;KAFKA,KAAAA,OAAO,UAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAAsB,KAAA,QAAA,QAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAGxB,WAAQ,KAAA,QAAA,SAAA;KAGGA,KAAAA,OAAO,UAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAAsB,KAAA,QAAA,QAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, openBlock, ref, toDisplayString } from "vue";
|
|
3
|
+
//#region src/components/CodeBlock.vue
|
|
4
|
+
var _hoisted_1 = { class: "group relative" };
|
|
5
|
+
var _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex items-center justify-between rounded-t-xl border border-b-0 border-gray-200 bg-gray-50 px-4 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-400"
|
|
8
|
+
};
|
|
9
|
+
var _hoisted_3 = ["aria-label"];
|
|
10
|
+
var _sfc_main = {
|
|
11
|
+
__name: "CodeBlock",
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* The snippet text.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
code: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Optional filename/language caption shown above the block.
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @default ''
|
|
25
|
+
*/
|
|
26
|
+
label: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Label for the copy button in its resting state.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @default 'Copy'
|
|
34
|
+
*/
|
|
35
|
+
copyLabel: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "Copy"
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Label shown briefly after a successful copy.
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @default 'Copied'
|
|
43
|
+
*/
|
|
44
|
+
copiedLabel: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "Copied"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
setup(__props) {
|
|
50
|
+
/**
|
|
51
|
+
* UiCodeBlock — a static, copyable code snippet.
|
|
52
|
+
*
|
|
53
|
+
* For code that documents itself rather than runs: install commands, config,
|
|
54
|
+
* import statements. A copy button fades in on hover or keyboard focus, so it
|
|
55
|
+
* stays out of the way while reading and confirms with a tick for a moment after
|
|
56
|
+
* a successful copy. An optional `label` renders a filename/language caption
|
|
57
|
+
* across the top.
|
|
58
|
+
*
|
|
59
|
+
* The copy uses the async Clipboard API and fails silently if it is
|
|
60
|
+
* unavailable (an insecure context, or permission denied) — a docs snippet
|
|
61
|
+
* should never throw because the clipboard was blocked. The button's labels are
|
|
62
|
+
* props rather than fixed strings so the component carries no baked-in language.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <UiCodeBlock label="Terminal" code="npm install numori-ui" />
|
|
66
|
+
*
|
|
67
|
+
* @example Localised button labels
|
|
68
|
+
* <UiCodeBlock :code="snippet" :copy-label="$t('ui.copy')" :copied-label="$t('ui.copied')" />
|
|
69
|
+
*/
|
|
70
|
+
const props = __props;
|
|
71
|
+
const copied = ref(false);
|
|
72
|
+
async function copy() {
|
|
73
|
+
try {
|
|
74
|
+
await navigator.clipboard.writeText(props.code);
|
|
75
|
+
copied.value = true;
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
copied.value = false;
|
|
78
|
+
}, 1600);
|
|
79
|
+
} catch {}
|
|
80
|
+
}
|
|
81
|
+
return (_ctx, _cache) => {
|
|
82
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
83
|
+
__props.label ? (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("span", null, toDisplayString(__props.label), 1)])) : createCommentVNode("", true),
|
|
84
|
+
createElementVNode("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
class: normalizeClass(["absolute right-2 z-10 inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white/80 px-2.5 py-1.5 text-xs font-medium text-gray-600 opacity-0 backdrop-blur transition-all hover:bg-white hover:text-gray-900 focus-visible:opacity-100 group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100", __props.label ? "top-11" : "top-2"]),
|
|
87
|
+
"aria-label": copied.value ? __props.copiedLabel : __props.copyLabel,
|
|
88
|
+
onClick: copy
|
|
89
|
+
}, [createVNode(_sfc_main$1, {
|
|
90
|
+
name: copied.value ? "mdi:check" : "mdi:content-copy",
|
|
91
|
+
class: normalizeClass(["size-3.5", copied.value ? "text-success-600 dark:text-success-400" : ""])
|
|
92
|
+
}, null, 8, ["name", "class"]), createTextVNode(" " + toDisplayString(copied.value ? __props.copiedLabel : __props.copyLabel), 1)], 10, _hoisted_3),
|
|
93
|
+
createElementVNode("pre", { class: normalizeClass(["overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700", __props.label ? "rounded-b-xl" : "rounded-xl"]) }, [createElementVNode("code", null, toDisplayString(__props.code), 1)], 2)
|
|
94
|
+
]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { _sfc_main as default };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/components/CodeBlock.vue"],"sourcesContent":["<template>\n <div class=\"group relative\">\n <div\n v-if=\"label\"\n class=\"flex items-center justify-between rounded-t-xl border border-b-0 border-gray-200 bg-gray-50 px-4 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-400\"\n >\n <span>{{ label }}</span>\n </div>\n\n <button\n type=\"button\"\n class=\"absolute right-2 z-10 inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white/80 px-2.5 py-1.5 text-xs font-medium text-gray-600 opacity-0 backdrop-blur transition-all hover:bg-white hover:text-gray-900 focus-visible:opacity-100 group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100\"\n :class=\"label ? 'top-11' : 'top-2'\"\n :aria-label=\"copied ? copiedLabel : copyLabel\"\n @click=\"copy\"\n >\n <UiIcon\n :name=\"copied ? 'mdi:check' : 'mdi:content-copy'\"\n class=\"size-3.5\"\n :class=\"copied ? 'text-success-600 dark:text-success-400' : ''\"\n />\n {{ copied ? copiedLabel : copyLabel }}\n </button>\n\n <pre\n class=\"overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700\"\n :class=\"label ? 'rounded-b-xl' : 'rounded-xl'\"\n ><code>{{ code }}</code></pre>\n </div>\n</template>\n\n<script setup>\n/**\n * UiCodeBlock — a static, copyable code snippet.\n *\n * For code that documents itself rather than runs: install commands, config,\n * import statements. A copy button fades in on hover or keyboard focus, so it\n * stays out of the way while reading and confirms with a tick for a moment after\n * a successful copy. An optional `label` renders a filename/language caption\n * across the top.\n *\n * The copy uses the async Clipboard API and fails silently if it is\n * unavailable (an insecure context, or permission denied) — a docs snippet\n * should never throw because the clipboard was blocked. The button's labels are\n * props rather than fixed strings so the component carries no baked-in language.\n *\n * @example\n * <UiCodeBlock label=\"Terminal\" code=\"npm install numori-ui\" />\n *\n * @example Localised button labels\n * <UiCodeBlock :code=\"snippet\" :copy-label=\"$t('ui.copy')\" :copied-label=\"$t('ui.copied')\" />\n */\nimport { ref } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * The snippet text.\n * @type {string}\n */\n code: { type: String, required: true },\n\n /**\n * Optional filename/language caption shown above the block.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Label for the copy button in its resting state.\n * @type {string}\n * @default 'Copy'\n */\n copyLabel: { type: String, default: 'Copy' },\n\n /**\n * Label shown briefly after a successful copy.\n * @type {string}\n * @default 'Copied'\n */\n copiedLabel: { type: String, default: 'Copied' },\n})\n\nconst copied = ref(false)\n\nasync function copy() {\n try {\n await navigator.clipboard.writeText(props.code)\n copied.value = true\n setTimeout(() => {\n copied.value = false\n }, 1600)\n } catch {\n // Clipboard unavailable (insecure context or denied permission); ignore\n // rather than throw for a snippet whose whole job is to sit there and read.\n }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,MAAM,QAAQ;EA6Bd,MAAM,SAAS,IAAI,KAAK;EAExB,eAAe,OAAO;GACpB,IAAI;IACF,MAAM,UAAU,UAAU,UAAU,MAAM,IAAI;IAC9C,OAAO,QAAQ;IACf,iBAAiB;KACf,OAAO,QAAQ;IACjB,GAAG,IAAI;GACT,QAAQ,CAGR;EACF;;GAhGE,OAAA,UAAA,GAAA,mBA2BM,OA3BN,YA2BM;IAzBI,QAAA,SADR,UAAA,GAAA,mBAKM,OALN,YAKM,CADJ,mBAAwB,QAAA,MAAA,gBAAf,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGhB,mBAaS,UAAA;KAZP,MAAK;KACL,OAAK,eAAA,CAAC,gYACE,QAAA,QAAK,WAAA,OAAA,CAAA;KACZ,cAAY,OAAA,QAAS,QAAA,cAAc,QAAA;KACnC,SAAO;IAER,GAAA,CAAA,YAIE,aAAA;KAHC,MAAM,OAAA,QAAM,cAAA;KACb,OAAK,eAAA,CAAC,YACE,OAAA,QAAM,2CAAA,EAAA,CAAA;IACd,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,OAAA,QAAS,QAAA,cAAc,QAAA,SAAS,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA;IAGrC,mBAG8B,OAAA,EAF5B,OAAK,eAAA,CAAC,yHACE,QAAA,QAAK,iBAAA,YAAA,CAAA,EAAA,GAAA,CACd,mBAAuB,QAAA,MAAA,gBAAd,QAAA,IAAI,GAAA,CAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, openBlock, renderList, toDisplayString } from "vue";
|
|
3
|
+
//#region src/components/ComparisonTable.vue
|
|
4
|
+
var _hoisted_1 = { class: "overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700" };
|
|
5
|
+
var _hoisted_2 = { class: "w-full min-w-2xl border-collapse text-left text-sm" };
|
|
6
|
+
var _hoisted_3 = { class: "sr-only" };
|
|
7
|
+
var _hoisted_4 = { class: "border-b border-gray-200 dark:border-gray-700" };
|
|
8
|
+
var _hoisted_5 = {
|
|
9
|
+
scope: "col",
|
|
10
|
+
class: "px-5 py-4 font-semibold text-gray-500 dark:text-gray-400"
|
|
11
|
+
};
|
|
12
|
+
var _hoisted_6 = { class: "sr-only" };
|
|
13
|
+
var _hoisted_7 = {
|
|
14
|
+
scope: "col",
|
|
15
|
+
class: "w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200"
|
|
16
|
+
};
|
|
17
|
+
var _hoisted_8 = {
|
|
18
|
+
scope: "col",
|
|
19
|
+
class: "w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300"
|
|
20
|
+
};
|
|
21
|
+
var _hoisted_9 = {
|
|
22
|
+
scope: "row",
|
|
23
|
+
class: "px-5 py-4 font-medium text-gray-900 dark:text-gray-100"
|
|
24
|
+
};
|
|
25
|
+
var _hoisted_10 = { class: "bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200" };
|
|
26
|
+
var _hoisted_11 = { class: "flex items-start gap-2" };
|
|
27
|
+
var _hoisted_12 = { class: "px-5 py-4 text-gray-600 dark:text-gray-400" };
|
|
28
|
+
var _hoisted_13 = { class: "flex items-start gap-2" };
|
|
29
|
+
var _sfc_main = {
|
|
30
|
+
__name: "ComparisonTable",
|
|
31
|
+
props: {
|
|
32
|
+
/**
|
|
33
|
+
* Table summary for assistive technology. Rendered visually hidden.
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
caption: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`
|
|
42
|
+
* should be stable if present, and falls back to the row index.
|
|
43
|
+
* @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}
|
|
44
|
+
*/
|
|
45
|
+
rows: {
|
|
46
|
+
type: Array,
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Heading for the accented (primary) column.
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
primaryLabel: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Heading for the comparison (secondary) column.
|
|
59
|
+
* @type {string}
|
|
60
|
+
*/
|
|
61
|
+
secondaryLabel: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Accessible name for the otherwise-blank first column.
|
|
67
|
+
* @type {string}
|
|
68
|
+
* @default 'Feature'
|
|
69
|
+
*/
|
|
70
|
+
featureLabel: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "Feature"
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* MDI icon marking each primary-column cell.
|
|
76
|
+
* @type {string}
|
|
77
|
+
* @default 'mdi:check-circle'
|
|
78
|
+
*/
|
|
79
|
+
primaryIcon: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "mdi:check-circle"
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* MDI icon marking each secondary-column cell.
|
|
85
|
+
* @type {string}
|
|
86
|
+
* @default 'mdi:minus-circle-outline'
|
|
87
|
+
*/
|
|
88
|
+
secondaryIcon: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: "mdi:minus-circle-outline"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
setup(__props) {
|
|
94
|
+
/**
|
|
95
|
+
* UiComparisonTable — a two-way, feature-by-feature comparison.
|
|
96
|
+
*
|
|
97
|
+
* A real `<table>`, not a grid of divs, because it is tabular data: the
|
|
98
|
+
* `<caption>`, `scope="col"` headers and `scope="row"` feature cells are what let
|
|
99
|
+
* a screen reader announce a whole row together ("Open source · yes · no")
|
|
100
|
+
* instead of reading three disconnected columns. The first (feature) column
|
|
101
|
+
* header is visually blank but named for assistive technology.
|
|
102
|
+
*
|
|
103
|
+
* The layout favours one column — the "primary" one is tinted with the accent —
|
|
104
|
+
* for the common "us versus the usual way" table. The leading icons are
|
|
105
|
+
* decorative; the cell text carries the meaning, so nothing depends on colour or
|
|
106
|
+
* glyph alone. It scrolls horizontally on narrow screens rather than crushing
|
|
107
|
+
* the columns.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* <UiComparisonTable
|
|
111
|
+
* caption="How Numori compares"
|
|
112
|
+
* primary-label="Numori"
|
|
113
|
+
* secondary-label="The usual suite"
|
|
114
|
+
* feature-label="Feature"
|
|
115
|
+
* :rows="[
|
|
116
|
+
* { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },
|
|
117
|
+
* { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },
|
|
118
|
+
* ]"
|
|
119
|
+
* />
|
|
120
|
+
*/
|
|
121
|
+
return (_ctx, _cache) => {
|
|
122
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("table", _hoisted_2, [
|
|
123
|
+
createElementVNode("caption", _hoisted_3, toDisplayString(__props.caption), 1),
|
|
124
|
+
createElementVNode("thead", null, [createElementVNode("tr", _hoisted_4, [
|
|
125
|
+
createElementVNode("th", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(__props.featureLabel), 1)]),
|
|
126
|
+
createElementVNode("th", _hoisted_7, toDisplayString(__props.primaryLabel), 1),
|
|
127
|
+
createElementVNode("th", _hoisted_8, toDisplayString(__props.secondaryLabel), 1)
|
|
128
|
+
])]),
|
|
129
|
+
createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row, index) => {
|
|
130
|
+
return openBlock(), createElementBlock("tr", {
|
|
131
|
+
key: row.key ?? index,
|
|
132
|
+
class: "border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60"
|
|
133
|
+
}, [
|
|
134
|
+
createElementVNode("th", _hoisted_9, toDisplayString(row.feature), 1),
|
|
135
|
+
createElementVNode("td", _hoisted_10, [createElementVNode("span", _hoisted_11, [createVNode(_sfc_main$1, {
|
|
136
|
+
name: __props.primaryIcon,
|
|
137
|
+
class: "mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400"
|
|
138
|
+
}, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.primary), 1)])]),
|
|
139
|
+
createElementVNode("td", _hoisted_12, [createElementVNode("span", _hoisted_13, [createVNode(_sfc_main$1, {
|
|
140
|
+
name: __props.secondaryIcon,
|
|
141
|
+
class: "mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500"
|
|
142
|
+
}, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.secondary), 1)])])
|
|
143
|
+
]);
|
|
144
|
+
}), 128))])
|
|
145
|
+
])]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { _sfc_main as default };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=ComparisonTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComparisonTable.js","names":[],"sources":["../../src/components/ComparisonTable.vue"],"sourcesContent":["<template>\n <div class=\"overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700\">\n <table class=\"w-full min-w-2xl border-collapse text-left text-sm\">\n <caption class=\"sr-only\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr class=\"border-b border-gray-200 dark:border-gray-700\">\n <th scope=\"col\" class=\"px-5 py-4 font-semibold text-gray-500 dark:text-gray-400\">\n <span class=\"sr-only\">{{ featureLabel }}</span>\n </th>\n <th\n scope=\"col\"\n class=\"w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200\"\n >\n {{ primaryLabel }}\n </th>\n <th scope=\"col\" class=\"w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300\">\n {{ secondaryLabel }}\n </th>\n </tr>\n </thead>\n\n <tbody>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"row.key ?? index\"\n class=\"border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60\"\n >\n <th scope=\"row\" class=\"px-5 py-4 font-medium text-gray-900 dark:text-gray-100\">\n {{ row.feature }}\n </th>\n\n <td\n class=\"bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200\"\n >\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"primaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400\"\n />\n {{ row.primary }}\n </span>\n </td>\n\n <td class=\"px-5 py-4 text-gray-600 dark:text-gray-400\">\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"secondaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500\"\n />\n {{ row.secondary }}\n </span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<script setup>\n/**\n * UiComparisonTable — a two-way, feature-by-feature comparison.\n *\n * A real `<table>`, not a grid of divs, because it is tabular data: the\n * `<caption>`, `scope=\"col\"` headers and `scope=\"row\"` feature cells are what let\n * a screen reader announce a whole row together (\"Open source · yes · no\")\n * instead of reading three disconnected columns. The first (feature) column\n * header is visually blank but named for assistive technology.\n *\n * The layout favours one column — the \"primary\" one is tinted with the accent —\n * for the common \"us versus the usual way\" table. The leading icons are\n * decorative; the cell text carries the meaning, so nothing depends on colour or\n * glyph alone. It scrolls horizontally on narrow screens rather than crushing\n * the columns.\n *\n * @example\n * <UiComparisonTable\n * caption=\"How Numori compares\"\n * primary-label=\"Numori\"\n * secondary-label=\"The usual suite\"\n * feature-label=\"Feature\"\n * :rows=\"[\n * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },\n * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },\n * ]\"\n * />\n */\nimport UiIcon from '../icons/Icon.vue'\n\ndefineProps({\n /**\n * Table summary for assistive technology. Rendered visually hidden.\n * @type {string}\n */\n caption: { type: String, required: true },\n\n /**\n * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`\n * should be stable if present, and falls back to the row index.\n * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}\n */\n rows: { type: Array, required: true },\n\n /**\n * Heading for the accented (primary) column.\n * @type {string}\n */\n primaryLabel: { type: String, required: true },\n\n /**\n * Heading for the comparison (secondary) column.\n * @type {string}\n */\n secondaryLabel: { type: String, required: true },\n\n /**\n * Accessible name for the otherwise-blank first column.\n * @type {string}\n * @default 'Feature'\n */\n featureLabel: { type: String, default: 'Feature' },\n\n /**\n * MDI icon marking each primary-column cell.\n * @type {string}\n * @default 'mdi:check-circle'\n */\n primaryIcon: { type: String, default: 'mdi:check-circle' },\n\n /**\n * MDI icon marking each secondary-column cell.\n * @type {string}\n * @default 'mdi:minus-circle-outline'\n */\n secondaryIcon: { type: String, default: 'mdi:minus-circle-outline' },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACE,OAAA,UAAA,GAAA,mBA2DM,OA3DN,YA2DM,CA1DJ,mBAyDQ,SAzDR,YAyDQ;IAxDN,mBAIU,WAJV,YAIU,gBAFN,QAAA,OAAO,GAAA,CAAA;IAIX,mBAeQ,SAAA,MAAA,CAdN,mBAaK,MAbL,YAaK;KAZH,mBAEK,MAFL,YAEK,CADH,mBAA+C,QAA/C,YAA+C,gBAAtB,QAAA,YAAY,GAAA,CAAA,CAAA,CAAA;KAEvC,mBAKK,MALL,YAKK,gBADA,QAAA,YAAY,GAAA,CAAA;KAEjB,mBAEK,MAFL,YAEK,gBADA,QAAA,cAAc,GAAA,CAAA;;IAKvB,mBAgCQ,SAAA,MAAA,EA/BN,UAAA,IAAA,GAAA,mBA8BK,UAAA,MAAA,WA7BoB,QAAA,OAAf,KAAK,UAAK;KADpB,OAAA,UAAA,GAAA,mBA8BK,MAAA;MA5BF,KAAK,IAAI,OAAO;MACjB,OAAM;;MAEN,mBAEK,MAFL,YAEK,gBADA,IAAI,OAAO,GAAA,CAAA;MAGhB,mBAUK,MAVL,aAUK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MAIlB,mBAQK,MARL,aAQK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,SAAS,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { computed, createElementBlock, createVNode, mergeProps, normalizeClass, openBlock, useAttrs } from "vue";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
//#region src/components/IconTile.vue
|
|
5
|
+
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
6
|
+
__name: "IconTile",
|
|
7
|
+
props: {
|
|
8
|
+
/**
|
|
9
|
+
* MDI icon name.
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
icon: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Tint colour from the semantic palette.
|
|
18
|
+
* @type {string}
|
|
19
|
+
* @default 'primary'
|
|
20
|
+
* @values 'primary' | 'gray' | 'success' | 'warning' | 'error' | 'blue'
|
|
21
|
+
*/
|
|
22
|
+
color: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "primary"
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Tile size (the radius scales with it).
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @default 'md'
|
|
30
|
+
* @values 'sm' | 'md' | 'lg' | 'xl'
|
|
31
|
+
*/
|
|
32
|
+
size: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "md"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
setup(__props) {
|
|
38
|
+
/**
|
|
39
|
+
* UiIconTile — a small rounded, tinted tile holding a single icon: the motif
|
|
40
|
+
* that stands in for a product logo or marks a feature next to a heading.
|
|
41
|
+
*
|
|
42
|
+
* Decorative by default — the icon is `aria-hidden`, on the assumption that a
|
|
43
|
+
* label sits next to it in text. The tint uses the design system's semantic
|
|
44
|
+
* colours; for a colour outside that set (a Tailwind palette, say) pass the
|
|
45
|
+
* `bg-*`/`text-*` classes directly and they override the built-in tint via
|
|
46
|
+
* `tailwind-merge`.
|
|
47
|
+
*
|
|
48
|
+
* @example Primary feature tile
|
|
49
|
+
* <UiIconTile icon="mdi:shield-lock-outline" />
|
|
50
|
+
*
|
|
51
|
+
* @example Large product mark in a custom colour
|
|
52
|
+
* <UiIconTile icon="mdi:note-text-outline" size="lg" class="bg-sky-100 text-sky-700" />
|
|
53
|
+
*
|
|
54
|
+
* @example Success tile
|
|
55
|
+
* <UiIconTile icon="mdi:check" color="success" size="sm" />
|
|
56
|
+
*/
|
|
57
|
+
const props = __props;
|
|
58
|
+
const sizeClass = computed(() => ({
|
|
59
|
+
sm: "size-9 rounded-lg",
|
|
60
|
+
md: "size-11 rounded-xl",
|
|
61
|
+
lg: "size-14 rounded-2xl",
|
|
62
|
+
xl: "size-16 rounded-2xl"
|
|
63
|
+
})[props.size] ?? "size-11 rounded-xl");
|
|
64
|
+
const iconSizeClass = computed(() => ({
|
|
65
|
+
sm: "size-5",
|
|
66
|
+
md: "size-6",
|
|
67
|
+
lg: "size-8",
|
|
68
|
+
xl: "size-9"
|
|
69
|
+
})[props.size] ?? "size-6");
|
|
70
|
+
const colorClass = computed(() => ({
|
|
71
|
+
primary: "bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300",
|
|
72
|
+
gray: "bg-gray-100 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",
|
|
73
|
+
success: "bg-success-100 text-success-700 dark:bg-success-400/15 dark:text-success-300",
|
|
74
|
+
warning: "bg-warning-100 text-warning-700 dark:bg-warning-400/15 dark:text-warning-300",
|
|
75
|
+
error: "bg-error-100 text-error-700 dark:bg-error-400/15 dark:text-error-300",
|
|
76
|
+
blue: "bg-blue-100 text-blue-700 dark:bg-blue-400/15 dark:text-blue-300"
|
|
77
|
+
})[props.color] ?? "bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300");
|
|
78
|
+
const attrs = useAttrs();
|
|
79
|
+
const restAttrs = computed(() => {
|
|
80
|
+
const { class: _class, ...rest } = attrs;
|
|
81
|
+
return rest;
|
|
82
|
+
});
|
|
83
|
+
const mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class));
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return openBlock(), createElementBlock("span", mergeProps({ class: ["inline-flex items-center justify-center", mergedClasses.value] }, restAttrs.value), [createVNode(_sfc_main$1, {
|
|
86
|
+
name: __props.icon,
|
|
87
|
+
class: normalizeClass(iconSizeClass.value),
|
|
88
|
+
"aria-hidden": "true"
|
|
89
|
+
}, null, 8, ["name", "class"])], 16);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
//#endregion
|
|
94
|
+
export { _sfc_main as default };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=IconTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconTile.js","names":[],"sources":["../../src/components/IconTile.vue"],"sourcesContent":["<template>\n <span class=\"inline-flex items-center justify-center\" :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <UiIcon :name=\"icon\" :class=\"iconSizeClass\" aria-hidden=\"true\" />\n </span>\n</template>\n\n<script setup>\n/**\n * UiIconTile — a small rounded, tinted tile holding a single icon: the motif\n * that stands in for a product logo or marks a feature next to a heading.\n *\n * Decorative by default — the icon is `aria-hidden`, on the assumption that a\n * label sits next to it in text. The tint uses the design system's semantic\n * colours; for a colour outside that set (a Tailwind palette, say) pass the\n * `bg-*`/`text-*` classes directly and they override the built-in tint via\n * `tailwind-merge`.\n *\n * @example Primary feature tile\n * <UiIconTile icon=\"mdi:shield-lock-outline\" />\n *\n * @example Large product mark in a custom colour\n * <UiIconTile icon=\"mdi:note-text-outline\" size=\"lg\" class=\"bg-sky-100 text-sky-700\" />\n *\n * @example Success tile\n * <UiIconTile icon=\"mdi:check\" color=\"success\" size=\"sm\" />\n */\nimport { computed, useAttrs } from 'vue'\nimport { twMerge } from 'tailwind-merge'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * MDI icon name.\n * @type {string}\n */\n icon: { type: String, required: true },\n\n /**\n * Tint colour from the semantic palette.\n * @type {string}\n * @default 'primary'\n * @values 'primary' | 'gray' | 'success' | 'warning' | 'error' | 'blue'\n */\n color: { type: String, default: 'primary' },\n\n /**\n * Tile size (the radius scales with it).\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md' | 'lg' | 'xl'\n */\n size: { type: String, default: 'md' },\n})\n\nconst sizeClass = computed(\n () =>\n ({\n sm: 'size-9 rounded-lg',\n md: 'size-11 rounded-xl',\n lg: 'size-14 rounded-2xl',\n xl: 'size-16 rounded-2xl',\n })[props.size] ?? 'size-11 rounded-xl',\n)\n\nconst iconSizeClass = computed(\n () =>\n ({\n sm: 'size-5',\n md: 'size-6',\n lg: 'size-8',\n xl: 'size-9',\n })[props.size] ?? 'size-6',\n)\n\nconst colorClass = computed(\n () =>\n ({\n primary: 'bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300',\n gray: 'bg-gray-100 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200',\n success: 'bg-success-100 text-success-700 dark:bg-success-400/15 dark:text-success-300',\n warning: 'bg-warning-100 text-warning-700 dark:bg-warning-400/15 dark:text-warning-300',\n error: 'bg-error-100 text-error-700 dark:bg-error-400/15 dark:text-error-300',\n blue: 'bg-blue-100 text-blue-700 dark:bg-blue-400/15 dark:text-blue-300',\n })[props.color] ??\n 'bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300',\n)\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst restAttrs = computed(() => {\n const { class: _class, ...rest } = attrs\n return rest\n})\n\n// External classes merge last so a caller's `bg-*`/`text-*` (e.g. a Tailwind\n// palette outside the semantic set) overrides the built-in tint rather than\n// colliding with it.\nconst mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class))\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,QAAQ;EAwBd,MAAM,YAAY,gBAEb;GACC,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN,EAAA,CAAG,MAAM,SAAS,oBACtB;EAEA,MAAM,gBAAgB,gBAEjB;GACC,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN,EAAA,CAAG,MAAM,SAAS,QACtB;EAEA,MAAM,aAAa,gBAEd;GACC,SAAS;GACT,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACP,MAAM;EACR,EAAA,CAAG,MAAM,UACT,8EACJ;EAIA,MAAM,QAAQ,SAAS;EACvB,MAAM,YAAY,eAAe;GAC/B,MAAM,EAAE,OAAO,QAAQ,GAAG,SAAS;GACnC,OAAO;EACT,CAAC;EAKD,MAAM,gBAAgB,eAAe,QAAQ,UAAU,OAAO,WAAW,OAAO,MAAM,KAAK,CAAC;;GAjG1F,OAAA,UAAA,GAAA,mBAEO,QAFP,WAEO,EAFD,OAAK,CAAC,2CAAkD,cAAA,KAAa,EAAU,GAAA,UAAA,KAAS,GAAA,CAC5F,YAAiE,aAAA;IAAxD,MAAM,QAAA;IAAO,OAAK,eAAE,cAAA,KAAa;IAAE,eAAY"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx } from "vue";
|
|
2
|
+
//#region src/components/SectionHeading.vue
|
|
3
|
+
var _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "mb-3 text-sm font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400"
|
|
6
|
+
};
|
|
7
|
+
var _sfc_main = {
|
|
8
|
+
__name: "SectionHeading",
|
|
9
|
+
props: {
|
|
10
|
+
/**
|
|
11
|
+
* Small uppercase label above the heading.
|
|
12
|
+
* @type {string}
|
|
13
|
+
* @default ''
|
|
14
|
+
*/
|
|
15
|
+
eyebrow: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Heading text. Omit if using the `title` slot.
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @default ''
|
|
23
|
+
*/
|
|
24
|
+
title: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Supporting paragraph below the heading.
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @default ''
|
|
32
|
+
*/
|
|
33
|
+
subtitle: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Heading tag, chosen to match the document outline — not the visual size.
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @default 'h2'
|
|
41
|
+
* @values 'h1' | 'h2' | 'h3' | 'h4'
|
|
42
|
+
*/
|
|
43
|
+
level: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "h2"
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Visual size of the heading, independent of `level`.
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @default 'md'
|
|
51
|
+
* @values 'sm' | 'md' | 'lg'
|
|
52
|
+
*/
|
|
53
|
+
size: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "md"
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Horizontal alignment.
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @default 'left'
|
|
61
|
+
* @values 'left' | 'center'
|
|
62
|
+
*/
|
|
63
|
+
align: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "left"
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Optional id on the heading, so it can be targeted by `aria-labelledby`.
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @default undefined
|
|
71
|
+
*/
|
|
72
|
+
id: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: void 0
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
setup(__props) {
|
|
78
|
+
/**
|
|
79
|
+
* UiSectionHeading — the eyebrow / heading / standfirst trio used at the top of
|
|
80
|
+
* a page or the start of a section.
|
|
81
|
+
*
|
|
82
|
+
* `level` and the visual `size` are independent on purpose: the heading tag
|
|
83
|
+
* follows the document outline (an `h3` nested inside an `h2` section) while the
|
|
84
|
+
* size follows the layout, so neither is sacrificed for the other. The block is
|
|
85
|
+
* layout-neutral — no outer margins or width cap — so the caller controls
|
|
86
|
+
* spacing and measure.
|
|
87
|
+
*
|
|
88
|
+
* @example Section heading
|
|
89
|
+
* <UiSectionHeading
|
|
90
|
+
* eyebrow="Pricing"
|
|
91
|
+
* title="One price, everything included"
|
|
92
|
+
* subtitle="No tiers, no add-ons."
|
|
93
|
+
* />
|
|
94
|
+
*
|
|
95
|
+
* @example Centred page hero with a nested level
|
|
96
|
+
* <UiSectionHeading centred size="lg" level="h1" title="Own your notes" />
|
|
97
|
+
*
|
|
98
|
+
* @slot title — Overrides the `title` prop for rich heading content.
|
|
99
|
+
* @slot subtitle — Overrides the `subtitle` prop.
|
|
100
|
+
* @slot default — Extra content below the standfirst, e.g. a call to action.
|
|
101
|
+
*/
|
|
102
|
+
const props = __props;
|
|
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
|
+
const subtitleClasses = computed(() => {
|
|
112
|
+
const sizeMap = {
|
|
113
|
+
sm: "mt-3 text-base text-gray-600 dark:text-gray-400",
|
|
114
|
+
md: "mt-4 text-base text-gray-600 sm:text-lg dark:text-gray-400",
|
|
115
|
+
lg: "mt-4 text-lg text-gray-600 dark:text-gray-400"
|
|
116
|
+
};
|
|
117
|
+
const base = sizeMap[props.size] || sizeMap.md;
|
|
118
|
+
return props.align === "center" ? `${base} mx-auto` : base;
|
|
119
|
+
});
|
|
120
|
+
return (_ctx, _cache) => {
|
|
121
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(__props.align === "center" ? "text-center" : "") }, [
|
|
122
|
+
__props.eyebrow ? (openBlock(), createElementBlock("p", _hoisted_1, toDisplayString(__props.eyebrow), 1)) : createCommentVNode("", true),
|
|
123
|
+
(openBlock(), createBlock(resolveDynamicComponent(__props.level), {
|
|
124
|
+
id: __props.id,
|
|
125
|
+
class: normalizeClass(titleClasses.value)
|
|
126
|
+
}, {
|
|
127
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])]),
|
|
128
|
+
_: 3
|
|
129
|
+
}, 8, ["id", "class"])),
|
|
130
|
+
__props.subtitle || _ctx.$slots.subtitle ? (openBlock(), createElementBlock("p", {
|
|
131
|
+
key: 1,
|
|
132
|
+
class: normalizeClass(subtitleClasses.value)
|
|
133
|
+
}, [renderSlot(_ctx.$slots, "subtitle", {}, () => [createTextVNode(toDisplayString(__props.subtitle), 1)])], 2)) : createCommentVNode("", true),
|
|
134
|
+
renderSlot(_ctx.$slots, "default")
|
|
135
|
+
], 2);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { _sfc_main as default };
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=SectionHeading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionHeading.js","names":["$slots"],"sources":["../../src/components/SectionHeading.vue"],"sourcesContent":["<template>\n <div :class=\"align === 'center' ? 'text-center' : ''\">\n <p\n v-if=\"eyebrow\"\n class=\"mb-3 text-sm font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400\"\n >\n {{ eyebrow }}\n </p>\n\n <component :is=\"level\" :id=\"id\" :class=\"titleClasses\">\n <slot name=\"title\">{{ title }}</slot>\n </component>\n\n <p v-if=\"subtitle || $slots.subtitle\" :class=\"subtitleClasses\">\n <slot name=\"subtitle\">{{ subtitle }}</slot>\n </p>\n\n <slot />\n </div>\n</template>\n\n<script setup>\n/**\n * UiSectionHeading — the eyebrow / heading / standfirst trio used at the top of\n * a page or the start of a section.\n *\n * `level` and the visual `size` are independent on purpose: the heading tag\n * follows the document outline (an `h3` nested inside an `h2` section) while the\n * size follows the layout, so neither is sacrificed for the other. The block is\n * layout-neutral — no outer margins or width cap — so the caller controls\n * spacing and measure.\n *\n * @example Section heading\n * <UiSectionHeading\n * eyebrow=\"Pricing\"\n * title=\"One price, everything included\"\n * subtitle=\"No tiers, no add-ons.\"\n * />\n *\n * @example Centred page hero with a nested level\n * <UiSectionHeading centred size=\"lg\" level=\"h1\" title=\"Own your notes\" />\n *\n * @slot title — Overrides the `title` prop for rich heading content.\n * @slot subtitle — Overrides the `subtitle` prop.\n * @slot default — Extra content below the standfirst, e.g. a call to action.\n */\nimport { computed } from 'vue'\n\nconst props = defineProps({\n /**\n * Small uppercase label above the heading.\n * @type {string}\n * @default ''\n */\n eyebrow: { type: String, default: '' },\n\n /**\n * Heading text. Omit if using the `title` slot.\n * @type {string}\n * @default ''\n */\n title: { type: String, default: '' },\n\n /**\n * Supporting paragraph below the heading.\n * @type {string}\n * @default ''\n */\n subtitle: { type: String, default: '' },\n\n /**\n * Heading tag, chosen to match the document outline — not the visual size.\n * @type {string}\n * @default 'h2'\n * @values 'h1' | 'h2' | 'h3' | 'h4'\n */\n level: { type: String, default: 'h2' },\n\n /**\n * Visual size of the heading, independent of `level`.\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md' | 'lg'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Horizontal alignment.\n * @type {string}\n * @default 'left'\n * @values 'left' | 'center'\n */\n align: { type: String, default: 'left' },\n\n /**\n * Optional id on the heading, so it can be targeted by `aria-labelledby`.\n * @type {string}\n * @default undefined\n */\n id: { type: String, default: undefined },\n})\n\nconst titleClasses = computed(() => {\n const sizeMap = {\n sm: 'text-xl font-bold sm:text-2xl',\n md: 'text-2xl font-bold sm:text-3xl',\n lg: 'text-3xl font-bold sm:text-4xl',\n }\n return sizeMap[props.size] || sizeMap.md\n})\n\nconst subtitleClasses = computed(() => {\n const sizeMap = {\n sm: 'mt-3 text-base text-gray-600 dark:text-gray-400',\n md: 'mt-4 text-base text-gray-600 sm:text-lg dark:text-gray-400',\n lg: 'mt-4 text-lg text-gray-600 dark:text-gray-400',\n }\n const base = sizeMap[props.size] || sizeMap.md\n return props.align === 'center' ? `${base} mx-auto` : base\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDA,MAAM,QAAQ;EAsDd,MAAM,eAAe,eAAe;GAClC,MAAM,UAAU;IACd,IAAI;IACJ,IAAI;IACJ,IAAI;GACN;GACA,OAAO,QAAQ,MAAM,SAAS,QAAQ;EACxC,CAAC;EAED,MAAM,kBAAkB,eAAe;GACrC,MAAM,UAAU;IACd,IAAI;IACJ,IAAI;IACJ,IAAI;GACN;GACA,MAAM,OAAO,QAAQ,MAAM,SAAS,QAAQ;GAC5C,OAAO,MAAM,UAAU,WAAW,GAAG,KAAK,YAAY;EACxD,CAAC;;GAtHC,OAAA,UAAA,GAAA,mBAiBM,OAAA,EAjBA,OAAK,eAAE,QAAA,UAAK,WAAA,gBAAA,EAAA,EAAA,GAAA;IAER,QAAA,WADR,UAAA,GAAA,mBAKI,KALJ,YAKI,gBADC,QAAA,OAAO,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAGZ,UAAA,GAAA,YAEY,wBAFI,QAAA,KAAK,GAAA;KAAG,IAAI,QAAA;KAAK,OAAK,eAAE,aAAA,KAAY;;KAClD,SAAA,cAAqC,CAArC,WAAqC,KAAA,QAAA,SAAA,CAAA,SAAA,CAAf,gBAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;IAGpB,QAAA,YAAYA,KAAAA,OAAO,YAA5B,UAAA,GAAA,mBAEI,KAAA;;KAFmC,OAAK,eAAE,gBAAA,KAAe;IAC3D,GAAA,CAAA,WAA2C,KAAA,QAAA,YAAA,CAAA,SAAA,CAAlB,gBAAA,gBAAA,QAAA,QAAQ,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGnC,WAAQ,KAAA,QAAA,SAAA"}
|