numori-ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +17 -8
- package/dist/components/Breadcrumb.js +107 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Card.js +174 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/IconTile.js +96 -0
- package/dist/components/IconTile.js.map +1 -0
- package/dist/components/SectionHeading.js +142 -0
- package/dist/components/SectionHeading.js.map +1 -0
- package/dist/components/Segmented.js +148 -0
- package/dist/components/Segmented.js.map +1 -0
- package/dist/components/index.js +61 -51
- package/dist/components/index.js.map +1 -1
- package/dist/icons/Icon.js +9 -6
- package/dist/icons/Icon.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/dist/manifest.js +5 -0
- package/dist/manifest.js.map +1 -1
- package/package.json +4 -3
- package/src/components/Breadcrumb.vue +89 -0
- package/src/components/Card.vue +169 -0
- package/src/components/IconTile.vue +100 -0
- package/src/components/SectionHeading.vue +121 -0
- package/src/components/Segmented.vue +152 -0
- package/src/components/index.js +15 -0
- package/src/icons/Icon.vue +7 -2
- package/src/manifest.js +5 -0
|
@@ -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"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
|
|
3
|
+
//#region src/components/Segmented.vue
|
|
4
|
+
var _hoisted_1 = ["aria-label"];
|
|
5
|
+
var _hoisted_2 = [
|
|
6
|
+
"aria-pressed",
|
|
7
|
+
"disabled",
|
|
8
|
+
"onClick"
|
|
9
|
+
];
|
|
10
|
+
var activeTextClass = "text-white";
|
|
11
|
+
var idleTextClass = "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100";
|
|
12
|
+
var _sfc_main = {
|
|
13
|
+
__name: "Segmented",
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* Selected value (v-model), matched against each option's `value`.
|
|
17
|
+
* @type {string | number}
|
|
18
|
+
* @default undefined
|
|
19
|
+
*/
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: [String, Number],
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* The options. Each is `{ value, label, icon?, disabled? }`.
|
|
26
|
+
* @type {Array<{ value: string|number, label: string, icon?: string, disabled?: boolean }>}
|
|
27
|
+
*/
|
|
28
|
+
options: {
|
|
29
|
+
type: Array,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Size preset controlling padding and font size.
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @default 'md'
|
|
36
|
+
* @values 'sm' | 'md'
|
|
37
|
+
*/
|
|
38
|
+
size: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "md"
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Corner shape of the track and pill.
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @default 'pill'
|
|
46
|
+
* @values 'pill' | 'rounded'
|
|
47
|
+
*/
|
|
48
|
+
shape: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "pill"
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Accessible name for the group. Omit if you label it with an external
|
|
54
|
+
* heading via `aria-labelledby` (which falls through to the root).
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @default undefined
|
|
57
|
+
*/
|
|
58
|
+
ariaLabel: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: void 0
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
emits: ["update:modelValue"],
|
|
64
|
+
setup(__props, { emit: __emit }) {
|
|
65
|
+
/**
|
|
66
|
+
* UiSegmented — a segmented control: pick one of a few named options from a row
|
|
67
|
+
* of buttons, with a pill that slides to the active choice.
|
|
68
|
+
*
|
|
69
|
+
* This is a set of toggle buttons (`role="group"` + `aria-pressed`), not a
|
|
70
|
+
* switch, because the choice is between named options rather than on/off — "the
|
|
71
|
+
* second option is off" is not something a screen reader should say. Segments
|
|
72
|
+
* are equal width so the pill can slide by whole columns.
|
|
73
|
+
*
|
|
74
|
+
* For an on/off control use `UiToggle`; for many options or a searchable list
|
|
75
|
+
* use `UiSelect`.
|
|
76
|
+
*
|
|
77
|
+
* @example Billing period
|
|
78
|
+
* <UiSegmented
|
|
79
|
+
* v-model="billing"
|
|
80
|
+
* :options="[
|
|
81
|
+
* { value: 'monthly', label: 'Monthly' },
|
|
82
|
+
* { value: 'yearly', label: 'Yearly' },
|
|
83
|
+
* ]"
|
|
84
|
+
* aria-label="Billing period"
|
|
85
|
+
* />
|
|
86
|
+
*
|
|
87
|
+
* @example With icons and a labelled-by heading
|
|
88
|
+
* <h2 id="view-h" class="sr-only">View</h2>
|
|
89
|
+
* <UiSegmented v-model="view" :options="views" aria-labelledby="view-h" />
|
|
90
|
+
*
|
|
91
|
+
* @emits {string|number} update:modelValue — the chosen option's `value`
|
|
92
|
+
*/
|
|
93
|
+
const props = __props;
|
|
94
|
+
const emit = __emit;
|
|
95
|
+
const count = computed(() => props.options?.length || 1);
|
|
96
|
+
const isActive = (option) => option.value === props.modelValue;
|
|
97
|
+
const activeIndex = computed(() => {
|
|
98
|
+
const i = (props.options ?? []).findIndex((o) => o.value === props.modelValue);
|
|
99
|
+
return i === -1 ? 0 : i;
|
|
100
|
+
});
|
|
101
|
+
function select(option, index) {
|
|
102
|
+
if (option.disabled) return;
|
|
103
|
+
emit("update:modelValue", option.value);
|
|
104
|
+
}
|
|
105
|
+
const trackClass = computed(() => props.shape === "rounded" ? "rounded-xl" : "rounded-full");
|
|
106
|
+
const buttonShapeClass = computed(() => props.shape === "rounded" ? "rounded-lg" : "rounded-full");
|
|
107
|
+
const pillClass = computed(() => props.shape === "rounded" ? "rounded-lg" : "rounded-full");
|
|
108
|
+
const buttonSizeClass = computed(() => props.size === "sm" ? "px-3 py-1 text-xs" : "px-4 py-1.5 text-sm");
|
|
109
|
+
const iconSizeClass = computed(() => props.size === "sm" ? "size-3.5" : "size-4");
|
|
110
|
+
const pillStyle = computed(() => ({
|
|
111
|
+
width: `calc((100% - 0.5rem) / ${count.value})`,
|
|
112
|
+
transform: `translateX(calc(${activeIndex.value} * 100%))`
|
|
113
|
+
}));
|
|
114
|
+
return (_ctx, _cache) => {
|
|
115
|
+
return openBlock(), createElementBlock("div", {
|
|
116
|
+
role: "group",
|
|
117
|
+
"aria-label": __props.ariaLabel,
|
|
118
|
+
class: normalizeClass(["relative inline-grid p-1", [trackClass.value, "border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900"]]),
|
|
119
|
+
style: normalizeStyle({ gridTemplateColumns: `repeat(${count.value}, minmax(0, 1fr))` })
|
|
120
|
+
}, [createElementVNode("span", {
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
class: normalizeClass(["pointer-events-none absolute bottom-1 left-1 top-1 bg-primary-500 shadow-sm transition-transform duration-300 ease-out motion-reduce:transition-none", pillClass.value]),
|
|
123
|
+
style: normalizeStyle(pillStyle.value)
|
|
124
|
+
}, null, 6), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
|
|
125
|
+
return openBlock(), createElementBlock("button", {
|
|
126
|
+
key: option.value,
|
|
127
|
+
type: "button",
|
|
128
|
+
"aria-pressed": isActive(option) ? "true" : "false",
|
|
129
|
+
disabled: option.disabled,
|
|
130
|
+
class: normalizeClass(["relative z-10 inline-flex items-center justify-center gap-1.5 font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50", [
|
|
131
|
+
buttonSizeClass.value,
|
|
132
|
+
buttonShapeClass.value,
|
|
133
|
+
isActive(option) ? activeTextClass : idleTextClass
|
|
134
|
+
]]),
|
|
135
|
+
onClick: ($event) => select(option, index)
|
|
136
|
+
}, [option.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
137
|
+
key: 0,
|
|
138
|
+
name: option.icon,
|
|
139
|
+
class: normalizeClass(iconSizeClass.value)
|
|
140
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(option.label), 1)], 10, _hoisted_2);
|
|
141
|
+
}), 128))], 14, _hoisted_1);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
//#endregion
|
|
146
|
+
export { _sfc_main as default };
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=Segmented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Segmented.js","names":[],"sources":["../../src/components/Segmented.vue"],"sourcesContent":["<template>\n <div\n role=\"group\"\n :aria-label=\"ariaLabel\"\n class=\"relative inline-grid p-1\"\n :class=\"[trackClass, 'border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900']\"\n :style=\"{ gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` }\"\n >\n <!--\n A single pill slides between segments rather than each segment owning its\n own background, so the movement animates. Segments are equal-width, so the\n pill's width is one column and it translates by whole columns. `top/bottom/\n left` inset it inside the track's padding; `%` in translateX resolves\n against the pill's own (one-column) width.\n -->\n <span\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute bottom-1 left-1 top-1 bg-primary-500 shadow-sm transition-transform duration-300 ease-out motion-reduce:transition-none\"\n :class=\"pillClass\"\n :style=\"pillStyle\"\n />\n\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n type=\"button\"\n :aria-pressed=\"isActive(option) ? 'true' : 'false'\"\n :disabled=\"option.disabled\"\n class=\"relative z-10 inline-flex items-center justify-center gap-1.5 font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50\"\n :class=\"[\n buttonSizeClass,\n buttonShapeClass,\n isActive(option) ? activeTextClass : idleTextClass,\n ]\"\n @click=\"select(option, index)\"\n >\n <UiIcon v-if=\"option.icon\" :name=\"option.icon\" :class=\"iconSizeClass\" />\n {{ option.label }}\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSegmented — a segmented control: pick one of a few named options from a row\n * of buttons, with a pill that slides to the active choice.\n *\n * This is a set of toggle buttons (`role=\"group\"` + `aria-pressed`), not a\n * switch, because the choice is between named options rather than on/off — \"the\n * second option is off\" is not something a screen reader should say. Segments\n * are equal width so the pill can slide by whole columns.\n *\n * For an on/off control use `UiToggle`; for many options or a searchable list\n * use `UiSelect`.\n *\n * @example Billing period\n * <UiSegmented\n * v-model=\"billing\"\n * :options=\"[\n * { value: 'monthly', label: 'Monthly' },\n * { value: 'yearly', label: 'Yearly' },\n * ]\"\n * aria-label=\"Billing period\"\n * />\n *\n * @example With icons and a labelled-by heading\n * <h2 id=\"view-h\" class=\"sr-only\">View</h2>\n * <UiSegmented v-model=\"view\" :options=\"views\" aria-labelledby=\"view-h\" />\n *\n * @emits {string|number} update:modelValue — the chosen option's `value`\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Selected value (v-model), matched against each option's `value`.\n * @type {string | number}\n * @default undefined\n */\n modelValue: { type: [String, Number], default: undefined },\n\n /**\n * The options. Each is `{ value, label, icon?, disabled? }`.\n * @type {Array<{ value: string|number, label: string, icon?: string, disabled?: boolean }>}\n */\n options: { type: Array, required: true },\n\n /**\n * Size preset controlling padding and font size.\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Corner shape of the track and pill.\n * @type {string}\n * @default 'pill'\n * @values 'pill' | 'rounded'\n */\n shape: { type: String, default: 'pill' },\n\n /**\n * Accessible name for the group. Omit if you label it with an external\n * heading via `aria-labelledby` (which falls through to the root).\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst count = computed(() => props.options?.length || 1)\n\nconst isActive = (option) => option.value === props.modelValue\n\nconst activeIndex = computed(() => {\n const i = (props.options ?? []).findIndex((o) => o.value === props.modelValue)\n return i === -1 ? 0 : i\n})\n\nfunction select(option, index) {\n if (option.disabled) return\n emit('update:modelValue', option.value)\n // index is accepted for symmetry with the template call site; the value is\n // what identifies the option.\n void index\n}\n\nconst trackClass = computed(() => (props.shape === 'rounded' ? 'rounded-xl' : 'rounded-full'))\nconst buttonShapeClass = computed(() => (props.shape === 'rounded' ? 'rounded-lg' : 'rounded-full'))\nconst pillClass = computed(() => (props.shape === 'rounded' ? 'rounded-lg' : 'rounded-full'))\n\nconst buttonSizeClass = computed(() =>\n props.size === 'sm' ? 'px-3 py-1 text-xs' : 'px-4 py-1.5 text-sm',\n)\nconst iconSizeClass = computed(() => (props.size === 'sm' ? 'size-3.5' : 'size-4'))\n\nconst activeTextClass = 'text-white'\nconst idleTextClass =\n 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100'\n\nconst pillStyle = computed(() => ({\n // Track padding is p-1 (0.25rem) each side, so the usable width is\n // `100% - 0.5rem`; one segment is that divided by the option count.\n width: `calc((100% - 0.5rem) / ${count.value})`,\n transform: `translateX(calc(${activeIndex.value} * 100%))`,\n}))\n</script>\n"],"mappings":";;;;;;;;;AA6IA,IAAM,kBAAkB;AACxB,IAAM,gBACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EArEF,MAAM,QAAQ;EAuCd,MAAM,OAAO;EAEb,MAAM,QAAQ,eAAe,MAAM,SAAS,UAAU,CAAC;EAEvD,MAAM,YAAY,WAAW,OAAO,UAAU,MAAM;EAEpD,MAAM,cAAc,eAAe;GACjC,MAAM,KAAK,MAAM,WAAW,CAAC,EAAA,CAAG,WAAW,MAAM,EAAE,UAAU,MAAM,UAAU;GAC7E,OAAO,MAAM,KAAK,IAAI;EACxB,CAAC;EAED,SAAS,OAAO,QAAQ,OAAO;GAC7B,IAAI,OAAO,UAAU;GACrB,KAAK,qBAAqB,OAAO,KAAK;EAIxC;EAEA,MAAM,aAAa,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EAC7F,MAAM,mBAAmB,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EACnG,MAAM,YAAY,eAAgB,MAAM,UAAU,YAAY,eAAe,cAAe;EAE5F,MAAM,kBAAkB,eACtB,MAAM,SAAS,OAAO,sBAAsB,qBAC9C;EACA,MAAM,gBAAgB,eAAgB,MAAM,SAAS,OAAO,aAAa,QAAS;EAMlF,MAAM,YAAY,gBAAgB;GAGhC,OAAO,0BAA0B,MAAM,MAAM;GAC7C,WAAW,mBAAmB,YAAY,MAAM;EAClD,EAAE;;GArJA,OAAA,UAAA,GAAA,mBAsCM,OAAA;IArCJ,MAAK;IACJ,cAAY,QAAA;IACb,OAAK,eAAA,CAAC,4BAA0B,CACvB,WAAA,OAAU,yEAAA,CAAA,CAAA;IAClB,OAAK,eAAA,EAAA,qBAAA,UAAmC,MAAA,MAAK,mBAAA,CAAA;GAS9C,GAAA,CAAA,mBAKE,QAAA;IAJA,eAAY;IACZ,OAAK,eAAA,CAAC,wJACE,UAAA,KAAS,CAAA;IAChB,OAAK,eAAE,UAAA,KAAS;GAGnB,GAAA,MAAA,CAAA,IAAA,UAAA,IAAA,GAAA,mBAgBS,UAAA,MAAA,WAfmB,QAAA,UAAlB,QAAQ,UAAK;IADvB,OAAA,UAAA,GAAA,mBAgBS,UAAA;KAdN,KAAK,OAAO;KACb,MAAK;KACJ,gBAAc,SAAS,MAAM,IAAA,SAAA;KAC7B,UAAU,OAAO;KAClB,OAAK,eAAA,CAAC,iJAA+I;MACnI,gBAAA;MAAyB,iBAAA;MAA0B,SAAS,MAAM,IAAI,kBAAkB;;KAKzG,UAAK,WAAE,OAAO,QAAQ,KAAK;IAEd,GAAA,CAAA,OAAO,QAArB,UAAA,GAAA,YAAwE,aAAA;;KAA5C,MAAM,OAAO;KAAO,OAAK,eAAE,cAAA,KAAa;IAAI,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,gBAAA,MACxE,gBAAG,OAAO,KAAK,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA"}
|
package/dist/components/index.js
CHANGED
|
@@ -2,31 +2,36 @@ import _sfc_main from "../icons/Icon.js";
|
|
|
2
2
|
import _sfc_main$1 from "./Alert.js";
|
|
3
3
|
import _sfc_main$2 from "./Avatar.js";
|
|
4
4
|
import _sfc_main$3 from "./Badge.js";
|
|
5
|
-
import _sfc_main$4 from "./
|
|
6
|
-
import _sfc_main$5 from "./
|
|
7
|
-
import _sfc_main$6 from "./
|
|
8
|
-
import _sfc_main$7 from "./
|
|
9
|
-
import _sfc_main$8 from "./
|
|
10
|
-
import _sfc_main$9 from "./
|
|
11
|
-
import _sfc_main$10 from "./
|
|
12
|
-
import _sfc_main$11 from "./
|
|
13
|
-
import _sfc_main$12 from "./
|
|
14
|
-
import _sfc_main$13 from "./
|
|
15
|
-
import _sfc_main$14 from "./
|
|
16
|
-
import _sfc_main$15 from "./
|
|
17
|
-
import _sfc_main$16 from "./
|
|
18
|
-
import _sfc_main$17 from "./
|
|
19
|
-
import _sfc_main$18 from "./
|
|
20
|
-
import _sfc_main$19 from "./
|
|
21
|
-
import _sfc_main$20 from "./
|
|
22
|
-
import _sfc_main$21 from "./
|
|
23
|
-
import _sfc_main$22 from "./
|
|
24
|
-
import _sfc_main$23 from "./
|
|
25
|
-
import _sfc_main$24 from "./
|
|
26
|
-
import _sfc_main$25 from "./
|
|
27
|
-
import _sfc_main$26 from "./
|
|
28
|
-
import _sfc_main$27 from "./
|
|
29
|
-
import _sfc_main$28 from "./
|
|
5
|
+
import _sfc_main$4 from "./Breadcrumb.js";
|
|
6
|
+
import _sfc_main$5 from "./Button.js";
|
|
7
|
+
import _sfc_main$6 from "./ButtonsGroup.js";
|
|
8
|
+
import _sfc_main$7 from "./Card.js";
|
|
9
|
+
import _sfc_main$8 from "./Checkbox.js";
|
|
10
|
+
import _sfc_main$9 from "./Divider.js";
|
|
11
|
+
import _sfc_main$10 from "./Dropdown.js";
|
|
12
|
+
import _sfc_main$11 from "./DropdownItem.js";
|
|
13
|
+
import _sfc_main$12 from "./DropdownRow.js";
|
|
14
|
+
import _sfc_main$13 from "./DropdownSubmenu.js";
|
|
15
|
+
import _sfc_main$14 from "./FileInput.js";
|
|
16
|
+
import _sfc_main$15 from "./FormField.js";
|
|
17
|
+
import _sfc_main$16 from "./IconTile.js";
|
|
18
|
+
import _sfc_main$17 from "./Input.js";
|
|
19
|
+
import _sfc_main$18 from "./Kbd.js";
|
|
20
|
+
import _sfc_main$19 from "./ListMenu.js";
|
|
21
|
+
import _sfc_main$20 from "./ListMenuItem.js";
|
|
22
|
+
import _sfc_main$21 from "./Modal.js";
|
|
23
|
+
import _sfc_main$22 from "./Numpad.js";
|
|
24
|
+
import _sfc_main$23 from "./Popup.js";
|
|
25
|
+
import _sfc_main$24 from "./ProgressBar.js";
|
|
26
|
+
import _sfc_main$25 from "./Prompt.js";
|
|
27
|
+
import _sfc_main$26 from "./Radio.js";
|
|
28
|
+
import _sfc_main$27 from "./SectionHeading.js";
|
|
29
|
+
import _sfc_main$28 from "./Segmented.js";
|
|
30
|
+
import _sfc_main$29 from "./Select.js";
|
|
31
|
+
import _sfc_main$30 from "./Slider.js";
|
|
32
|
+
import _sfc_main$31 from "./Stepper.js";
|
|
33
|
+
import _sfc_main$32 from "./Toggle.js";
|
|
34
|
+
import _sfc_main$33 from "./Tooltip.js";
|
|
30
35
|
//#region src/components/index.js
|
|
31
36
|
/**
|
|
32
37
|
* Real component imports, re-exported under the default `Ui` prefix.
|
|
@@ -48,34 +53,39 @@ var components = {
|
|
|
48
53
|
Alert: _sfc_main$1,
|
|
49
54
|
Avatar: _sfc_main$2,
|
|
50
55
|
Badge: _sfc_main$3,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
Breadcrumb: _sfc_main$4,
|
|
57
|
+
Button: _sfc_main$5,
|
|
58
|
+
ButtonsGroup: _sfc_main$6,
|
|
59
|
+
Card: _sfc_main$7,
|
|
60
|
+
Checkbox: _sfc_main$8,
|
|
61
|
+
Divider: _sfc_main$9,
|
|
62
|
+
Dropdown: _sfc_main$10,
|
|
63
|
+
DropdownItem: _sfc_main$11,
|
|
64
|
+
DropdownRow: _sfc_main$12,
|
|
65
|
+
DropdownSubmenu: _sfc_main$13,
|
|
66
|
+
FileInput: _sfc_main$14,
|
|
67
|
+
FormField: _sfc_main$15,
|
|
68
|
+
IconTile: _sfc_main$16,
|
|
69
|
+
Input: _sfc_main$17,
|
|
70
|
+
Kbd: _sfc_main$18,
|
|
71
|
+
ListMenu: _sfc_main$19,
|
|
72
|
+
ListMenuItem: _sfc_main$20,
|
|
73
|
+
Modal: _sfc_main$21,
|
|
74
|
+
Numpad: _sfc_main$22,
|
|
75
|
+
Popup: _sfc_main$23,
|
|
76
|
+
ProgressBar: _sfc_main$24,
|
|
77
|
+
Prompt: _sfc_main$25,
|
|
78
|
+
Radio: _sfc_main$26,
|
|
79
|
+
SectionHeading: _sfc_main$27,
|
|
80
|
+
Segmented: _sfc_main$28,
|
|
81
|
+
Select: _sfc_main$29,
|
|
82
|
+
Slider: _sfc_main$30,
|
|
83
|
+
Stepper: _sfc_main$31,
|
|
84
|
+
Toggle: _sfc_main$32,
|
|
85
|
+
Tooltip: _sfc_main$33,
|
|
76
86
|
Icon: _sfc_main
|
|
77
87
|
};
|
|
78
88
|
//#endregion
|
|
79
|
-
export { _sfc_main$1 as UiAlert, _sfc_main$2 as UiAvatar, _sfc_main$3 as UiBadge, _sfc_main$4 as
|
|
89
|
+
export { _sfc_main$1 as UiAlert, _sfc_main$2 as UiAvatar, _sfc_main$3 as UiBadge, _sfc_main$4 as UiBreadcrumb, _sfc_main$5 as UiButton, _sfc_main$6 as UiButtonsGroup, _sfc_main$7 as UiCard, _sfc_main$8 as UiCheckbox, _sfc_main$9 as UiDivider, _sfc_main$10 as UiDropdown, _sfc_main$11 as UiDropdownItem, _sfc_main$12 as UiDropdownRow, _sfc_main$13 as UiDropdownSubmenu, _sfc_main$14 as UiFileInput, _sfc_main$15 as UiFormField, _sfc_main as UiIcon, _sfc_main$16 as UiIconTile, _sfc_main$17 as UiInput, _sfc_main$18 as UiKbd, _sfc_main$19 as UiListMenu, _sfc_main$20 as UiListMenuItem, _sfc_main$21 as UiModal, _sfc_main$22 as UiNumpad, _sfc_main$23 as UiPopup, _sfc_main$24 as UiProgressBar, _sfc_main$25 as UiPrompt, _sfc_main$26 as UiRadio, _sfc_main$27 as UiSectionHeading, _sfc_main$28 as UiSegmented, _sfc_main$29 as UiSelect, _sfc_main$30 as UiSlider, _sfc_main$31 as UiStepper, _sfc_main$32 as UiToggle, _sfc_main$33 as UiTooltip, components };
|
|
80
90
|
|
|
81
91
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.js"],"sourcesContent":["/**\n * Real component imports, re-exported under the default `Ui` prefix.\n *\n * The prefix is baked into the export names so that `import { UiButton }`\n * reads the same as `<UiButton>` in a template. Consumers who register the\n * library with a different prefix still import these names — only the\n * globally registered tag changes.\n *\n * `../manifest.js` carries the same list as plain data for build-time\n * consumers; `scripts/verify.mjs` keeps the two in sync.\n */\nimport Alert from './Alert.vue'\nimport Avatar from './Avatar.vue'\nimport Badge from './Badge.vue'\nimport Button from './Button.vue'\nimport ButtonsGroup from './ButtonsGroup.vue'\nimport Checkbox from './Checkbox.vue'\nimport Divider from './Divider.vue'\nimport Dropdown from './Dropdown.vue'\nimport DropdownItem from './DropdownItem.vue'\nimport DropdownRow from './DropdownRow.vue'\nimport DropdownSubmenu from './DropdownSubmenu.vue'\nimport FileInput from './FileInput.vue'\nimport FormField from './FormField.vue'\nimport Input from './Input.vue'\nimport Kbd from './Kbd.vue'\nimport ListMenu from './ListMenu.vue'\nimport ListMenuItem from './ListMenuItem.vue'\nimport Modal from './Modal.vue'\nimport Numpad from './Numpad.vue'\nimport Popup from './Popup.vue'\nimport ProgressBar from './ProgressBar.vue'\nimport Prompt from './Prompt.vue'\nimport Radio from './Radio.vue'\nimport Select from './Select.vue'\nimport Slider from './Slider.vue'\nimport Stepper from './Stepper.vue'\nimport Toggle from './Toggle.vue'\nimport Tooltip from './Tooltip.vue'\nimport Icon from '../icons/Icon.vue'\n\nexport {\n Alert as UiAlert,\n Avatar as UiAvatar,\n Badge as UiBadge,\n Button as UiButton,\n ButtonsGroup as UiButtonsGroup,\n Checkbox as UiCheckbox,\n Divider as UiDivider,\n Dropdown as UiDropdown,\n DropdownItem as UiDropdownItem,\n DropdownRow as UiDropdownRow,\n DropdownSubmenu as UiDropdownSubmenu,\n FileInput as UiFileInput,\n FormField as UiFormField,\n Input as UiInput,\n Kbd as UiKbd,\n ListMenu as UiListMenu,\n ListMenuItem as UiListMenuItem,\n Modal as UiModal,\n Numpad as UiNumpad,\n Popup as UiPopup,\n ProgressBar as UiProgressBar,\n Prompt as UiPrompt,\n Radio as UiRadio,\n Select as UiSelect,\n Slider as UiSlider,\n Stepper as UiStepper,\n Toggle as UiToggle,\n Tooltip as UiTooltip,\n Icon as UiIcon,\n}\n\n/**\n * Base-name -> component map, used by the Vue plugin to register everything\n * under whatever prefix the host chose.\n * @type {Record<string, import('vue').Component>}\n */\nexport const components = {\n Alert,\n Avatar,\n Badge,\n Button,\n ButtonsGroup,\n Checkbox,\n Divider,\n Dropdown,\n DropdownItem,\n DropdownRow,\n DropdownSubmenu,\n FileInput,\n FormField,\n Input,\n Kbd,\n ListMenu,\n ListMenuItem,\n Modal,\n Numpad,\n Popup,\n ProgressBar,\n Prompt,\n Radio,\n Select,\n Slider,\n Stepper,\n Toggle,\n Tooltip,\n Icon,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.js"],"sourcesContent":["/**\n * Real component imports, re-exported under the default `Ui` prefix.\n *\n * The prefix is baked into the export names so that `import { UiButton }`\n * reads the same as `<UiButton>` in a template. Consumers who register the\n * library with a different prefix still import these names — only the\n * globally registered tag changes.\n *\n * `../manifest.js` carries the same list as plain data for build-time\n * consumers; `scripts/verify.mjs` keeps the two in sync.\n */\nimport Alert from './Alert.vue'\nimport Avatar from './Avatar.vue'\nimport Badge from './Badge.vue'\nimport Breadcrumb from './Breadcrumb.vue'\nimport Button from './Button.vue'\nimport ButtonsGroup from './ButtonsGroup.vue'\nimport Card from './Card.vue'\nimport Checkbox from './Checkbox.vue'\nimport Divider from './Divider.vue'\nimport Dropdown from './Dropdown.vue'\nimport DropdownItem from './DropdownItem.vue'\nimport DropdownRow from './DropdownRow.vue'\nimport DropdownSubmenu from './DropdownSubmenu.vue'\nimport FileInput from './FileInput.vue'\nimport FormField from './FormField.vue'\nimport IconTile from './IconTile.vue'\nimport Input from './Input.vue'\nimport Kbd from './Kbd.vue'\nimport ListMenu from './ListMenu.vue'\nimport ListMenuItem from './ListMenuItem.vue'\nimport Modal from './Modal.vue'\nimport Numpad from './Numpad.vue'\nimport Popup from './Popup.vue'\nimport ProgressBar from './ProgressBar.vue'\nimport Prompt from './Prompt.vue'\nimport Radio from './Radio.vue'\nimport SectionHeading from './SectionHeading.vue'\nimport Segmented from './Segmented.vue'\nimport Select from './Select.vue'\nimport Slider from './Slider.vue'\nimport Stepper from './Stepper.vue'\nimport Toggle from './Toggle.vue'\nimport Tooltip from './Tooltip.vue'\nimport Icon from '../icons/Icon.vue'\n\nexport {\n Alert as UiAlert,\n Avatar as UiAvatar,\n Badge as UiBadge,\n Breadcrumb as UiBreadcrumb,\n Button as UiButton,\n ButtonsGroup as UiButtonsGroup,\n Card as UiCard,\n Checkbox as UiCheckbox,\n Divider as UiDivider,\n Dropdown as UiDropdown,\n DropdownItem as UiDropdownItem,\n DropdownRow as UiDropdownRow,\n DropdownSubmenu as UiDropdownSubmenu,\n FileInput as UiFileInput,\n FormField as UiFormField,\n IconTile as UiIconTile,\n Input as UiInput,\n Kbd as UiKbd,\n ListMenu as UiListMenu,\n ListMenuItem as UiListMenuItem,\n Modal as UiModal,\n Numpad as UiNumpad,\n Popup as UiPopup,\n ProgressBar as UiProgressBar,\n Prompt as UiPrompt,\n Radio as UiRadio,\n SectionHeading as UiSectionHeading,\n Segmented as UiSegmented,\n Select as UiSelect,\n Slider as UiSlider,\n Stepper as UiStepper,\n Toggle as UiToggle,\n Tooltip as UiTooltip,\n Icon as UiIcon,\n}\n\n/**\n * Base-name -> component map, used by the Vue plugin to register everything\n * under whatever prefix the host chose.\n * @type {Record<string, import('vue').Component>}\n */\nexport const components = {\n Alert,\n Avatar,\n Badge,\n Breadcrumb,\n Button,\n ButtonsGroup,\n Card,\n Checkbox,\n Divider,\n Dropdown,\n DropdownItem,\n DropdownRow,\n DropdownSubmenu,\n FileInput,\n FormField,\n IconTile,\n Input,\n Kbd,\n ListMenu,\n ListMenuItem,\n Modal,\n Numpad,\n Popup,\n ProgressBar,\n Prompt,\n Radio,\n SectionHeading,\n Segmented,\n Select,\n Slider,\n Stepper,\n Toggle,\n Tooltip,\n Icon,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAa,aAAa;CACxB,OAAA;CACA,QAAA;CACA,OAAA;CACA,YAAA;CACA,QAAA;CACA,cAAA;CACA,MAAA;CACA,UAAA;CACA,SAAA;CACA,UAAA;CACA,cAAA;CACA,aAAA;CACA,iBAAA;CACA,WAAA;CACA,WAAA;CACA,UAAA;CACA,OAAA;CACA,KAAA;CACA,UAAA;CACA,cAAA;CACA,OAAA;CACA,QAAA;CACA,OAAA;CACA,aAAA;CACA,QAAA;CACA,OAAA;CACA,gBAAA;CACA,WAAA;CACA,QAAA;CACA,QAAA;CACA,SAAA;CACA,QAAA;CACA,SAAA;CACA,MAAA;AACF"}
|
package/dist/icons/Icon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MDI_VIEW_BOX } from "./mdi.js";
|
|
2
2
|
import { resolveIconPath } from "./registry.js";
|
|
3
3
|
import { useIconComponent } from "./resolver.js";
|
|
4
|
-
import { computed, defineComponent, h } from "vue";
|
|
4
|
+
import { computed, defineComponent, h, resolveComponent } from "vue";
|
|
5
5
|
//#region src/icons/Icon.vue
|
|
6
6
|
/**
|
|
7
7
|
* UiIcon — renders an icon by name, either from the bundled Material Design
|
|
@@ -92,11 +92,14 @@ name: {
|
|
|
92
92
|
return rest;
|
|
93
93
|
});
|
|
94
94
|
return () => {
|
|
95
|
-
if (hostComponent)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
if (hostComponent) {
|
|
96
|
+
const comp = typeof hostComponent === "string" ? resolveComponent(hostComponent) : hostComponent;
|
|
97
|
+
return h(comp, {
|
|
98
|
+
...restAttrs.value,
|
|
99
|
+
name: props.name,
|
|
100
|
+
class: sizeClass.value
|
|
101
|
+
});
|
|
102
|
+
}
|
|
100
103
|
if (path.value) return h("svg", {
|
|
101
104
|
...restAttrs.value,
|
|
102
105
|
class: sizeClass.value,
|
package/dist/icons/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","names":[],"sources":["../../src/icons/Icon.vue"],"sourcesContent":["<script>\n/**\n * UiIcon — renders an icon by name, either from the bundled Material Design\n * Icons subset or through a host-supplied icon component.\n *\n * This is the seam that lets Numori UI stay framework-agnostic. Numori Notes\n * used `<Icon>` from `@nuxt/icon`, which only exists inside Nuxt; this\n * component gives the same ergonomics with no framework coupling:\n *\n * - **Default** — draws inline SVG from the MDI paths bundled in `mdi.js`.\n * Zero dependencies, zero network requests, SSR-safe.\n * - **Overridden** — if the host provided a component (via the plugin's\n * `icons.component` option or `provideIconComponent`), every icon is\n * delegated to it, so an app that already ships an icon system does not end\n * up with two.\n *\n * Only the icons the library itself needs are bundled. To draw others without\n * replacing the whole renderer, add them with `registerIcons()`.\n *\n * Sizing and colour come from classes, exactly as they did before: the class you\n * pass lands on the rendered element, and the SVG fills with `currentColor`, so\n * `text-*` utilities colour icons the same way they colour text.\n *\n * ---\n *\n * Why a render function instead of a `<template>`:\n *\n * `viewBox` is case-sensitive, and Vue's SSR runtime lowercases the keys of a\n * merged prop bag — `ssrRenderAttrs({ viewBox })` emits `viewbox=\"…\"`. Because\n * this `<svg>` also needs a dynamic `class`, a template always goes through that\n * path, and no amount of writing `viewBox` in the template survives it. Browsers\n * paper over it (the HTML parser's foreign-content attribute adjustment maps\n * `viewbox` back to `viewBox`), but the emitted markup is still invalid SVG and\n * breaks anything that parses it as XML or post-processes the HTML.\n *\n * Building the vnode directly keeps the prop object intact, so the attribute is\n * serialised with its real casing on both the server and the client. This is the\n * only component in the library that emits raw SVG, so it is the only one that\n * has to care.\n *\n * @example\n * <UiIcon name=\"mdi:check\" class=\"w-4 h-4\" />\n *\n * @example Inherits the parent's text colour\n * <span class=\"text-primary-600\"><UiIcon name=\"mdi:alert-circle\" class=\"w-5 h-5\" /></span>\n */\nimport { computed, defineComponent, h } from 'vue'\nimport { MDI_VIEW_BOX } from './mdi.js'\nimport { resolveIconPath } from './registry.js'\nimport { useIconComponent } from './resolver.js'\n\nexport default defineComponent({\n name: 'UiIcon',\n\n // Attributes are placed deliberately: `class` is merged into the sizing\n // logic below, and everything else is forwarded to whichever element wins.\n inheritAttrs: false,\n\n props: {\n /**\n * Icon name. The bundled set uses the `mdi:` prefix, e.g. `'mdi:check'`.\n * A bare name (`'check'`) is also accepted and treated as MDI.\n *\n * Optional rather than required on purpose. Several components pass an\n * optional icon prop straight through (`<UiIcon :name=\"icon\" />`), so\n * requiring it would emit a Vue warning every time a caller legitimately\n * omitted the icon. An empty or missing name renders the placeholder\n * branch, which reserves the same box without drawing anything.\n */\n name: { type: String, default: '' },\n },\n\n setup(props, { attrs }) {\n // Read at setup time: injection is not available inside a render function.\n const hostComponent = useIconComponent()\n\n /**\n * Icons are sized by the caller, so the incoming `class` is kept verbatim.\n * A default square is added only when the caller supplied no dimensions,\n * which stops an un-sized icon collapsing to zero height.\n */\n const sizeClass = computed(() => {\n const external = attrs.class || ''\n const hasSize = /(^|\\s)(w-|h-|size-)/.test(String(external))\n return [hasSize ? '' : 'w-4 h-4', 'inline-block shrink-0', external].filter(Boolean)\n })\n\n /**\n * Resolved through the registry rather than the generated map directly, so\n * icons added at runtime with `registerIcons()` are found too.\n */\n const path = computed(() => (props.name ? resolveIconPath(props.name) : null))\n\n /** Forwarded attributes minus `class`, which sizeClass already absorbed. */\n const restAttrs = computed(() => {\n const { class: _class, ...rest } = attrs\n return rest\n })\n\n return () => {\n // 1. Host-supplied renderer wins, so the app keeps one icon pipeline.\n // A string is allowed and resolves as a globally registered component,\n // which is how the Nuxt module forwards e.g. @nuxt/icon's <Icon>.\n if (hostComponent) {\n return h(
|
|
1
|
+
{"version":3,"file":"Icon.js","names":[],"sources":["../../src/icons/Icon.vue"],"sourcesContent":["<script>\n/**\n * UiIcon — renders an icon by name, either from the bundled Material Design\n * Icons subset or through a host-supplied icon component.\n *\n * This is the seam that lets Numori UI stay framework-agnostic. Numori Notes\n * used `<Icon>` from `@nuxt/icon`, which only exists inside Nuxt; this\n * component gives the same ergonomics with no framework coupling:\n *\n * - **Default** — draws inline SVG from the MDI paths bundled in `mdi.js`.\n * Zero dependencies, zero network requests, SSR-safe.\n * - **Overridden** — if the host provided a component (via the plugin's\n * `icons.component` option or `provideIconComponent`), every icon is\n * delegated to it, so an app that already ships an icon system does not end\n * up with two.\n *\n * Only the icons the library itself needs are bundled. To draw others without\n * replacing the whole renderer, add them with `registerIcons()`.\n *\n * Sizing and colour come from classes, exactly as they did before: the class you\n * pass lands on the rendered element, and the SVG fills with `currentColor`, so\n * `text-*` utilities colour icons the same way they colour text.\n *\n * ---\n *\n * Why a render function instead of a `<template>`:\n *\n * `viewBox` is case-sensitive, and Vue's SSR runtime lowercases the keys of a\n * merged prop bag — `ssrRenderAttrs({ viewBox })` emits `viewbox=\"…\"`. Because\n * this `<svg>` also needs a dynamic `class`, a template always goes through that\n * path, and no amount of writing `viewBox` in the template survives it. Browsers\n * paper over it (the HTML parser's foreign-content attribute adjustment maps\n * `viewbox` back to `viewBox`), but the emitted markup is still invalid SVG and\n * breaks anything that parses it as XML or post-processes the HTML.\n *\n * Building the vnode directly keeps the prop object intact, so the attribute is\n * serialised with its real casing on both the server and the client. This is the\n * only component in the library that emits raw SVG, so it is the only one that\n * has to care.\n *\n * @example\n * <UiIcon name=\"mdi:check\" class=\"w-4 h-4\" />\n *\n * @example Inherits the parent's text colour\n * <span class=\"text-primary-600\"><UiIcon name=\"mdi:alert-circle\" class=\"w-5 h-5\" /></span>\n */\nimport { computed, defineComponent, h, resolveComponent } from 'vue'\nimport { MDI_VIEW_BOX } from './mdi.js'\nimport { resolveIconPath } from './registry.js'\nimport { useIconComponent } from './resolver.js'\n\nexport default defineComponent({\n name: 'UiIcon',\n\n // Attributes are placed deliberately: `class` is merged into the sizing\n // logic below, and everything else is forwarded to whichever element wins.\n inheritAttrs: false,\n\n props: {\n /**\n * Icon name. The bundled set uses the `mdi:` prefix, e.g. `'mdi:check'`.\n * A bare name (`'check'`) is also accepted and treated as MDI.\n *\n * Optional rather than required on purpose. Several components pass an\n * optional icon prop straight through (`<UiIcon :name=\"icon\" />`), so\n * requiring it would emit a Vue warning every time a caller legitimately\n * omitted the icon. An empty or missing name renders the placeholder\n * branch, which reserves the same box without drawing anything.\n */\n name: { type: String, default: '' },\n },\n\n setup(props, { attrs }) {\n // Read at setup time: injection is not available inside a render function.\n const hostComponent = useIconComponent()\n\n /**\n * Icons are sized by the caller, so the incoming `class` is kept verbatim.\n * A default square is added only when the caller supplied no dimensions,\n * which stops an un-sized icon collapsing to zero height.\n */\n const sizeClass = computed(() => {\n const external = attrs.class || ''\n const hasSize = /(^|\\s)(w-|h-|size-)/.test(String(external))\n return [hasSize ? '' : 'w-4 h-4', 'inline-block shrink-0', external].filter(Boolean)\n })\n\n /**\n * Resolved through the registry rather than the generated map directly, so\n * icons added at runtime with `registerIcons()` are found too.\n */\n const path = computed(() => (props.name ? resolveIconPath(props.name) : null))\n\n /** Forwarded attributes minus `class`, which sizeClass already absorbed. */\n const restAttrs = computed(() => {\n const { class: _class, ...rest } = attrs\n return rest\n })\n\n return () => {\n // 1. Host-supplied renderer wins, so the app keeps one icon pipeline.\n // A string is allowed and resolves as a globally registered component,\n // which is how the Nuxt module forwards e.g. @nuxt/icon's <Icon>.\n if (hostComponent) {\n // A string names a globally registered component (e.g. @nuxt/icon's\n // <Icon>). In a render function that must be resolved explicitly:\n // h('Icon', …) would emit a literal <Icon> element, not the component.\n const comp =\n typeof hostComponent === 'string' ? resolveComponent(hostComponent) : hostComponent\n return h(comp, {\n ...restAttrs.value,\n name: props.name,\n class: sizeClass.value,\n })\n }\n\n // 2. Bundled inline SVG. `currentColor` makes colour inherit from text.\n if (path.value) {\n return h(\n 'svg',\n {\n ...restAttrs.value,\n class: sizeClass.value,\n viewBox: MDI_VIEW_BOX,\n xmlns: 'http://www.w3.org/2000/svg',\n fill: 'currentColor',\n 'aria-hidden': 'true',\n focusable: 'false',\n },\n [h('path', { d: path.value })],\n )\n }\n\n // 3. Unknown name: hold the same box so layout does not shift, and stay\n // invisible rather than rendering a broken glyph.\n return h('span', {\n ...restAttrs.value,\n class: sizeClass.value,\n 'aria-hidden': 'true',\n })\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAK,YAAa,gBAAa;CAC7B,MAAM;CAIN,cAAc;CAEd,OAAO;;;;;;;;;;;AAWL,MAAM;EAAE,MAAM;EAAQ,SAAS;CAAG,EACpC;CAEA,MAAM,OAAO,EAAE,SAAS;EAEtB,MAAM,gBAAgB,iBAAiB;;;;;;EAOvC,MAAM,YAAY,eAAe;GAC/B,MAAM,WAAW,MAAM,SAAS;GAEhC,OAAO;IADS,sBAAsB,KAAK,OAAO,QAAQ,CAC5C,IAAI,KAAK;IAAW;IAAyB;GAAQ,CAAC,CAAC,OAAO,OAAO;EACrF,CAAC;;;;;EAMD,MAAM,OAAO,eAAgB,MAAM,OAAO,gBAAgB,MAAM,IAAI,IAAI,IAAK;;EAG7E,MAAM,YAAY,eAAe;GAC/B,MAAM,EAAE,OAAO,QAAQ,GAAG,SAAS;GACnC,OAAO;EACT,CAAC;EAED,aAAa;GAIX,IAAI,eAAe;IAIjB,MAAM,OACJ,OAAO,kBAAkB,WAAW,iBAAiB,aAAa,IAAI;IACxE,OAAO,EAAE,MAAM;KACb,GAAG,UAAU;KACb,MAAM,MAAM;KACZ,OAAO,UAAU;IACnB,CAAC;GACH;GAGA,IAAI,KAAK,OACP,OAAO,EACL,OACA;IACE,GAAG,UAAU;IACb,OAAO,UAAU;IACjB,SAAS;IACT,OAAO;IACP,MAAM;IACN,eAAe;IACf,WAAW;GACb,GACA,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC,CAC/B;GAKF,OAAO,EAAE,QAAQ;IACf,GAAG,UAAU;IACb,OAAO,UAAU;IACjB,eAAe;GACjB,CAAC;EACH;CACF;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,10 @@ type UiComponent = Component
|
|
|
10
10
|
export declare const UiAlert: UiComponent
|
|
11
11
|
export declare const UiAvatar: UiComponent
|
|
12
12
|
export declare const UiBadge: UiComponent
|
|
13
|
+
export declare const UiBreadcrumb: UiComponent
|
|
13
14
|
export declare const UiButton: UiComponent
|
|
14
15
|
export declare const UiButtonsGroup: UiComponent
|
|
16
|
+
export declare const UiCard: UiComponent
|
|
15
17
|
export declare const UiCheckbox: UiComponent
|
|
16
18
|
export declare const UiDivider: UiComponent
|
|
17
19
|
export declare const UiDropdown: UiComponent
|
|
@@ -20,6 +22,7 @@ export declare const UiDropdownRow: UiComponent
|
|
|
20
22
|
export declare const UiDropdownSubmenu: UiComponent
|
|
21
23
|
export declare const UiFileInput: UiComponent
|
|
22
24
|
export declare const UiFormField: UiComponent
|
|
25
|
+
export declare const UiIconTile: UiComponent
|
|
23
26
|
export declare const UiInput: UiComponent
|
|
24
27
|
export declare const UiKbd: UiComponent
|
|
25
28
|
export declare const UiListMenu: UiComponent
|
|
@@ -30,6 +33,8 @@ export declare const UiPopup: UiComponent
|
|
|
30
33
|
export declare const UiProgressBar: UiComponent
|
|
31
34
|
export declare const UiPrompt: UiComponent
|
|
32
35
|
export declare const UiRadio: UiComponent
|
|
36
|
+
export declare const UiSectionHeading: UiComponent
|
|
37
|
+
export declare const UiSegmented: UiComponent
|
|
33
38
|
export declare const UiSelect: UiComponent
|
|
34
39
|
export declare const UiSlider: UiComponent
|
|
35
40
|
export declare const UiStepper: UiComponent
|