numori-ui 0.2.0 → 0.4.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 +122 -0
- package/README.md +26 -21
- package/dist/components/Banner.js +176 -0
- package/dist/components/Banner.js.map +1 -0
- package/dist/components/Button.js +10 -19
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +15 -9
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.js +2 -7
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/CodeBlock.js +101 -0
- package/dist/components/CodeBlock.js.map +1 -0
- package/dist/components/Dropdown.js +10 -3
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/DropdownSubmenu.js +5 -3
- package/dist/components/DropdownSubmenu.js.map +1 -1
- package/dist/components/FileInput.js +12 -4
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/IconTile.js +5 -9
- package/dist/components/IconTile.js.map +1 -1
- package/dist/components/Input.js +6 -6
- package/dist/components/Input.js.map +1 -1
- package/dist/components/ListMenuItem.js +38 -31
- package/dist/components/ListMenuItem.js.map +1 -1
- package/dist/components/Numpad.js +4 -4
- package/dist/components/Numpad.js.map +1 -1
- package/dist/components/Popup.js +9 -3
- package/dist/components/Popup.js.map +1 -1
- package/dist/components/Radio.js +2 -7
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Segmented.js +100 -26
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +6 -4
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Spinner.js +87 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Table.js +174 -0
- package/dist/components/Table.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 +67 -57
- package/dist/components/index.js.map +1 -1
- package/dist/composables/useMergedClasses.js +52 -0
- package/dist/composables/useMergedClasses.js.map +1 -0
- package/dist/icons/mdi.js +10 -0
- package/dist/icons/mdi.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +35 -30
- package/dist/index.js.map +1 -1
- package/dist/internal/controlSizes.js +21 -0
- package/dist/internal/controlSizes.js.map +1 -0
- package/dist/internal/menu.js +20 -0
- package/dist/internal/menu.js.map +1 -0
- package/dist/manifest.js +6 -1
- package/dist/manifest.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Banner.vue +160 -0
- package/src/components/Button.vue +12 -19
- package/src/components/Card.vue +11 -12
- package/src/components/Checkbox.vue +2 -10
- package/src/components/CodeBlock.vue +99 -0
- package/src/components/Dropdown.vue +14 -2
- package/src/components/DropdownSubmenu.vue +4 -2
- package/src/components/FileInput.vue +19 -4
- package/src/components/IconTile.vue +4 -9
- package/src/components/Input.vue +6 -6
- package/src/components/ListMenuItem.vue +21 -5
- package/src/components/Numpad.vue +7 -4
- package/src/components/Popup.vue +6 -2
- package/src/components/Radio.vue +2 -10
- package/src/components/Segmented.vue +108 -38
- package/src/components/Select.vue +11 -2
- package/src/components/Spinner.vue +70 -0
- package/src/components/Table.vue +193 -0
- package/src/components/ThemeToggle.vue +81 -0
- package/src/components/Toast.vue +106 -0
- package/src/components/index.js +18 -3
- package/src/composables/useMergedClasses.js +49 -0
- package/src/icons/mdi.js +10 -0
- package/src/internal/controlSizes.js +17 -0
- package/src/internal/menu.js +16 -0
- package/src/manifest.js +6 -1
- package/dist/components/ButtonsGroup.js +0 -153
- package/dist/components/ButtonsGroup.js.map +0 -1
- package/src/components/ButtonsGroup.vue +0 -140
package/dist/components/Card.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useMergedClasses } from "../composables/useMergedClasses.js";
|
|
2
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, mergeProps, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
|
|
3
3
|
//#region src/components/Card.vue
|
|
4
4
|
var _hoisted_1 = {
|
|
5
5
|
key: 0,
|
|
@@ -133,11 +133,6 @@ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
|
133
133
|
* @slot footer — Optional footer, drawn below the body with a divider.
|
|
134
134
|
*/
|
|
135
135
|
const props = __props;
|
|
136
|
-
const attrs = useAttrs();
|
|
137
|
-
const restAttrs = computed(() => {
|
|
138
|
-
const { class: _class, ...rest } = attrs;
|
|
139
|
-
return rest;
|
|
140
|
-
});
|
|
141
136
|
const paddingClass = computed(() => ({
|
|
142
137
|
none: "",
|
|
143
138
|
xs: "p-3",
|
|
@@ -155,9 +150,20 @@ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
|
155
150
|
card: "shadow-card",
|
|
156
151
|
"card-hover": "shadow-card-hover"
|
|
157
152
|
})[props.shadow] ?? "shadow-card");
|
|
158
|
-
const
|
|
153
|
+
const internalClasses = computed(() => [
|
|
154
|
+
"bg-white dark:bg-gray-900",
|
|
155
|
+
props.focusRing ? "relative" : "",
|
|
156
|
+
radiusClass.value,
|
|
157
|
+
props.bordered ? "border border-gray-200 dark:border-gray-700" : "",
|
|
158
|
+
shadowClass.value,
|
|
159
|
+
props.interactive ? "transition-[transform,box-shadow,border-color] duration-300 ease-out hover:-translate-y-1 hover:shadow-card-hover motion-reduce:transition-none motion-reduce:hover:translate-y-0" : "",
|
|
160
|
+
props.highlighted ? "border-primary-400 shadow-card-hover ring-1 ring-primary-400/20 dark:border-primary-400/60 dark:ring-primary-400/25" : "",
|
|
161
|
+
props.focusRing ? "focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-primary-500 dark:focus-within:outline-primary-400" : "",
|
|
162
|
+
paddingClass.value
|
|
163
|
+
].filter(Boolean).join(" "));
|
|
164
|
+
const { mergedClasses, restAttrs } = useMergedClasses(internalClasses);
|
|
159
165
|
return (_ctx, _cache) => {
|
|
160
|
-
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({ class: mergedClasses
|
|
166
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({ class: unref(mergedClasses) }, unref(restAttrs)), {
|
|
161
167
|
default: withCtx(() => [
|
|
162
168
|
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "header")])) : createCommentVNode("", true),
|
|
163
169
|
renderSlot(_ctx.$slots, "default"),
|
|
@@ -1 +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
|
|
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 } from 'vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\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 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\n// External classes merge last so a caller's `hover:border-primary-300` wins\n// over the neutral hover border rather than doubling up.\nconst internalClasses = computed(() =>\n [\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 ]\n .filter(Boolean)\n .join(' '),\n)\n\nconst { mergedClasses, restAttrs } = useMergedClasses(internalClasses)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDA,MAAM,QAAQ;EAuEd,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;EAIA,MAAM,kBAAkB,eACtB;GACE;GACA,MAAM,YAAY,aAAa;GAC/B,YAAY;GACZ,MAAM,WAAW,gDAAgD;GACjE,YAAY;GACZ,MAAM,cACF,sLACA;GACJ,MAAM,cACF,wHACA;GACJ,MAAM,YACF,gIACA;GACJ,aAAa;EACf,CAAA,CACG,OAAO,OAAO,CAAA,CACd,KAAK,GAAG,CACb;EAEA,MAAM,EAAE,eAAe,cAAc,iBAAiB,eAAe;;GApKnE,OAAA,UAAA,GAAA,YAYY,wBAZI,QAAA,GAAG,GAAnB,WAYY,EAZU,OAAO,MAAA,aAAA,EAAa,GAAU,MAAA,SAAA,CAAS,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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkableSizeClass } from "../internal/controlSizes.js";
|
|
1
2
|
import { computed, createElementBlock, normalizeClass, openBlock } from "vue";
|
|
2
3
|
//#region src/components/Checkbox.vue
|
|
3
4
|
var _hoisted_1 = ["checked", "disabled"];
|
|
@@ -65,13 +66,7 @@ var _sfc_main = {
|
|
|
65
66
|
*/
|
|
66
67
|
const props = __props;
|
|
67
68
|
const emit = __emit;
|
|
68
|
-
const sizeClass = computed(() =>
|
|
69
|
-
switch (props.size) {
|
|
70
|
-
case "sm": return "w-3.5 h-3.5";
|
|
71
|
-
case "lg": return "w-5 h-5";
|
|
72
|
-
default: return "w-4 h-4";
|
|
73
|
-
}
|
|
74
|
-
});
|
|
69
|
+
const sizeClass = computed(() => checkableSizeClass(props.size));
|
|
75
70
|
function onChange(e) {
|
|
76
71
|
emit("update:modelValue", e.target.checked);
|
|
77
72
|
emit("change", e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":[],"sources":["../../src/components/Checkbox.vue"],"sourcesContent":["<template>\n <input\n type=\"checkbox\"\n :checked=\"modelValue ?? checked\"\n :disabled=\"disabled\"\n class=\"rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiCheckbox — Simple styled checkbox input with configurable size.\n *\n * Wraps a native `<input type=\"checkbox\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Supports both v-model (`modelValue`)\n * and uncontrolled (`checked`) usage patterns.\n *\n * @example Basic v-model checkbox\n * <UiCheckbox v-model=\"agreed\" />\n *\n * @example Small disabled checkbox\n * <UiCheckbox v-model=\"locked\" size=\"sm\" disabled />\n *\n * @example Uncontrolled with checked prop\n * <UiCheckbox :checked=\"true\" @change=\"handleChange\" />\n *\n * @emits {boolean} update:modelValue — Emitted when the checked state changes (v-model)\n * @emits {Event} change — Emitted with the native change event\n */\nimport { computed } from 'vue'\nconst props = defineProps({\n /**\n * Controlled checked state (v-model). Takes priority over `checked` when defined.\n * @type {boolean}\n * @default undefined\n */\n modelValue: { type: Boolean, default: undefined },\n\n /**\n * Uncontrolled initial checked state (used when modelValue is undefined).\n * @type {boolean}\n * @default false\n */\n checked: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the checkbox and prevents interaction.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Checkbox size controlling width and height.\n * @type {string}\n * @default 'md'\n * @values 'sm' (3.5×3.5) | 'md' (4×4) | 'lg' (5×5)\n */\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue', 'change'])\n\nconst sizeClass = computed(() =>
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":[],"sources":["../../src/components/Checkbox.vue"],"sourcesContent":["<template>\n <input\n type=\"checkbox\"\n :checked=\"modelValue ?? checked\"\n :disabled=\"disabled\"\n class=\"rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiCheckbox — Simple styled checkbox input with configurable size.\n *\n * Wraps a native `<input type=\"checkbox\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Supports both v-model (`modelValue`)\n * and uncontrolled (`checked`) usage patterns.\n *\n * @example Basic v-model checkbox\n * <UiCheckbox v-model=\"agreed\" />\n *\n * @example Small disabled checkbox\n * <UiCheckbox v-model=\"locked\" size=\"sm\" disabled />\n *\n * @example Uncontrolled with checked prop\n * <UiCheckbox :checked=\"true\" @change=\"handleChange\" />\n *\n * @emits {boolean} update:modelValue — Emitted when the checked state changes (v-model)\n * @emits {Event} change — Emitted with the native change event\n */\nimport { computed } from 'vue'\nimport { checkableSizeClass } from '../internal/controlSizes.js'\nconst props = defineProps({\n /**\n * Controlled checked state (v-model). Takes priority over `checked` when defined.\n * @type {boolean}\n * @default undefined\n */\n modelValue: { type: Boolean, default: undefined },\n\n /**\n * Uncontrolled initial checked state (used when modelValue is undefined).\n * @type {boolean}\n * @default false\n */\n checked: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the checkbox and prevents interaction.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Checkbox size controlling width and height.\n * @type {string}\n * @default 'md'\n * @values 'sm' (3.5×3.5) | 'md' (4×4) | 'lg' (5×5)\n */\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue', 'change'])\n\nconst sizeClass = computed(() => checkableSizeClass(props.size))\n\nfunction onChange(e) {\n emit('update:modelValue', e.target.checked)\n emit('change', e)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,MAAM,QAAQ;EA+Bd,MAAM,OAAO;EAEb,MAAM,YAAY,eAAe,mBAAmB,MAAM,IAAI,CAAC;EAE/D,SAAS,SAAS,GAAG;GACnB,KAAK,qBAAqB,EAAE,OAAO,OAAO;GAC1C,KAAK,UAAU,CAAC;EAClB;;GAtEE,OAAA,UAAA,GAAA,mBAOE,SAAA;IANA,MAAK;IACJ,SAAS,QAAA,cAAc,QAAA;IACvB,UAAU,QAAA;IACX,OAAK,eAAA,CAAC,wFACE,UAAA,KAAS,CAAA;IACR"}
|
|
@@ -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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEventListener } from "../composables/useEventListener.js";
|
|
2
2
|
import { onClickOutside } from "../composables/onClickOutside.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MENU_PANEL_CLASS } from "../internal/menu.js";
|
|
4
|
+
import { Transition, computed, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, vShow, withCtx, withDirectives } from "vue";
|
|
4
5
|
//#region src/components/Dropdown.vue
|
|
5
6
|
var _sfc_main = {
|
|
6
7
|
__name: "Dropdown",
|
|
@@ -92,7 +93,10 @@ var _sfc_main = {
|
|
|
92
93
|
if (props.panelClass) return props.panelClass;
|
|
93
94
|
const align = props.align === "right" ? "right-0" : "left-0";
|
|
94
95
|
const dropDir = props.drop === "up" ? "bottom-full mb-1" : "mt-1";
|
|
95
|
-
return `absolute z-50
|
|
96
|
+
return `absolute z-50 ${MENU_PANEL_CLASS} p-1 ${props.width} ${align} ${dropDir}`;
|
|
97
|
+
});
|
|
98
|
+
const panelOrigin = computed(() => {
|
|
99
|
+
return `${props.drop === "up" ? "bottom" : "top"} ${props.align === "right" ? "right" : "left"}`;
|
|
96
100
|
});
|
|
97
101
|
const transitionClasses = computed(() => {
|
|
98
102
|
if (props.drop === "up") return {
|
|
@@ -147,7 +151,10 @@ var _sfc_main = {
|
|
|
147
151
|
"leave-from-class": transitionClasses.value.leaveFrom,
|
|
148
152
|
"leave-to-class": transitionClasses.value.leaveTo
|
|
149
153
|
}, {
|
|
150
|
-
default: withCtx(() => [withDirectives(createElementVNode("div", {
|
|
154
|
+
default: withCtx(() => [withDirectives(createElementVNode("div", {
|
|
155
|
+
class: normalizeClass(panelClasses.value),
|
|
156
|
+
style: normalizeStyle({ transformOrigin: panelOrigin.value })
|
|
157
|
+
}, [renderSlot(_ctx.$slots, "default", { close })], 6), [[vShow, isOpen.value]])]),
|
|
151
158
|
_: 3
|
|
152
159
|
}, 8, [
|
|
153
160
|
"enter-active-class",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","names":[],"sources":["../../src/components/Dropdown.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\">\n <!-- Trigger slot: receives { open, toggle } for controlling the dropdown -->\n <slot name=\"trigger\" :open=\"isOpen\" :toggle=\"toggle\" />\n\n <!-- Dropdown panel with animated enter/leave transitions -->\n <Transition\n :enter-active-class=\"transitionClasses.enterActive\"\n :enter-from-class=\"transitionClasses.enterFrom\"\n :enter-to-class=\"transitionClasses.enterTo\"\n :leave-active-class=\"transitionClasses.leaveActive\"\n :leave-from-class=\"transitionClasses.leaveFrom\"\n :leave-to-class=\"transitionClasses.leaveTo\"\n >\n <div v-show=\"isOpen\" :class=\"panelClasses\">\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdown — Headless dropdown menu with configurable alignment, direction, and transitions.\n *\n * Uses a trigger slot that receives `open` state and `toggle` function, and a default\n * slot for menu content that receives a `close` function. Closes on outside click and\n * Escape key. Supports both downward and upward drop directions with matching transitions.\n * Exposes `isOpen`, `toggle()`, and `close()` for programmatic control.\n *\n * @example Basic dropdown with button trigger\n * <UiDropdown>\n * <template #trigger=\"{ toggle }\">\n * <UiButton @click=\"toggle\">Menu</UiButton>\n * </template>\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiDropdown>\n *\n * @example Right-aligned, drop-up\n * <UiDropdown align=\"right\" drop=\"up\" width=\"w-48\">\n * <template #trigger=\"{ toggle }\">\n * <UiButton variant=\"ghost\" icon-only @click=\"toggle\">\n * <UiIcon name=\"mdi:dots-vertical\" class=\"w-5 h-5\" />\n * </UiButton>\n * </template>\n * <slot />\n * </UiDropdown>\n *\n * @emits {void} open — Emitted when the dropdown opens\n * @emits {void} close — Emitted when the dropdown closes\n *\n * @slot trigger — Trigger element that opens the dropdown. Receives { open: boolean, toggle: Function }\n * @slot default — Dropdown menu content. Receives { close: Function }\n *\n * @see UiDropdownItem — Standard menu item for use inside this dropdown\n * @see UiDropdownSubmenu — Nested submenu for this dropdown\n */\nimport { ref, computed } from 'vue'\nimport { onClickOutside } from '../composables/onClickOutside.js'\nimport { useEventListener } from '../composables/useEventListener.js'\nconst props = defineProps({\n /**\n * Width class applied to the dropdown panel.\n * @type {string}\n * @default 'w-56'\n * @example 'w-48', 'w-64', 'w-72'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Horizontal alignment of the panel relative to the trigger.\n * @type {string}\n * @default 'left'\n * @values 'left' | 'right'\n */\n align: { type: String, default: 'left' },\n\n /**\n * Drop direction — 'down' opens below the trigger, 'up' opens above.\n * @type {string}\n * @default 'down'\n * @values 'down' | 'up'\n */\n drop: { type: String, default: 'down' },\n\n /**\n * Override all default panel classes (bg, border, rounded, shadow).\n * When set, the built-in panel styling is completely replaced.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n})\n\nconst emit = defineEmits(['open', 'close'])\n\nconst isOpen = ref(false)\nconst containerRef = ref(null)\n\n// Build panel positioning/styling classes, or use custom override\nconst panelClasses = computed(() => {\n if (props.panelClass) return props.panelClass\n const align = props.align === 'right' ? 'right-0' : 'left-0'\n const dropDir = props.drop === 'up' ? 'bottom-full mb-1' : 'mt-1'\n
|
|
1
|
+
{"version":3,"file":"Dropdown.js","names":[],"sources":["../../src/components/Dropdown.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\">\n <!-- Trigger slot: receives { open, toggle } for controlling the dropdown -->\n <slot name=\"trigger\" :open=\"isOpen\" :toggle=\"toggle\" />\n\n <!-- Dropdown panel with animated enter/leave transitions -->\n <Transition\n :enter-active-class=\"transitionClasses.enterActive\"\n :enter-from-class=\"transitionClasses.enterFrom\"\n :enter-to-class=\"transitionClasses.enterTo\"\n :leave-active-class=\"transitionClasses.leaveActive\"\n :leave-from-class=\"transitionClasses.leaveFrom\"\n :leave-to-class=\"transitionClasses.leaveTo\"\n >\n <div v-show=\"isOpen\" :class=\"panelClasses\" :style=\"{ transformOrigin: panelOrigin }\">\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdown — Headless dropdown menu with configurable alignment, direction, and transitions.\n *\n * Uses a trigger slot that receives `open` state and `toggle` function, and a default\n * slot for menu content that receives a `close` function. Closes on outside click and\n * Escape key. Supports both downward and upward drop directions with matching transitions.\n * Exposes `isOpen`, `toggle()`, and `close()` for programmatic control.\n *\n * @example Basic dropdown with button trigger\n * <UiDropdown>\n * <template #trigger=\"{ toggle }\">\n * <UiButton @click=\"toggle\">Menu</UiButton>\n * </template>\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiDropdown>\n *\n * @example Right-aligned, drop-up\n * <UiDropdown align=\"right\" drop=\"up\" width=\"w-48\">\n * <template #trigger=\"{ toggle }\">\n * <UiButton variant=\"ghost\" icon-only @click=\"toggle\">\n * <UiIcon name=\"mdi:dots-vertical\" class=\"w-5 h-5\" />\n * </UiButton>\n * </template>\n * <slot />\n * </UiDropdown>\n *\n * @emits {void} open — Emitted when the dropdown opens\n * @emits {void} close — Emitted when the dropdown closes\n *\n * @slot trigger — Trigger element that opens the dropdown. Receives { open: boolean, toggle: Function }\n * @slot default — Dropdown menu content. Receives { close: Function }\n *\n * @see UiDropdownItem — Standard menu item for use inside this dropdown\n * @see UiDropdownSubmenu — Nested submenu for this dropdown\n */\nimport { ref, computed } from 'vue'\nimport { onClickOutside } from '../composables/onClickOutside.js'\nimport { useEventListener } from '../composables/useEventListener.js'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Width class applied to the dropdown panel.\n * @type {string}\n * @default 'w-56'\n * @example 'w-48', 'w-64', 'w-72'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Horizontal alignment of the panel relative to the trigger.\n * @type {string}\n * @default 'left'\n * @values 'left' | 'right'\n */\n align: { type: String, default: 'left' },\n\n /**\n * Drop direction — 'down' opens below the trigger, 'up' opens above.\n * @type {string}\n * @default 'down'\n * @values 'down' | 'up'\n */\n drop: { type: String, default: 'down' },\n\n /**\n * Override all default panel classes (bg, border, rounded, shadow).\n * When set, the built-in panel styling is completely replaced.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n})\n\nconst emit = defineEmits(['open', 'close'])\n\nconst isOpen = ref(false)\nconst containerRef = ref(null)\n\n// Build panel positioning/styling classes, or use custom override\nconst panelClasses = computed(() => {\n if (props.panelClass) return props.panelClass\n const align = props.align === 'right' ? 'right-0' : 'left-0'\n const dropDir = props.drop === 'up' ? 'bottom-full mb-1' : 'mt-1'\n // `p-1` (not just `py-1`) insets the rows so their rounded hover highlight\n // reads as a chip with breathing room from the panel edge.\n return `absolute z-50 ${MENU_PANEL_CLASS} p-1 ${props.width} ${align} ${dropDir}`\n})\n\n// Inline transform-origin (not a Tailwind class, so it needs no build step to\n// take effect): the panel scales in from the corner nearest the trigger rather\n// than drifting in from its centre.\nconst panelOrigin = computed(() => {\n const y = props.drop === 'up' ? 'bottom' : 'top'\n const x = props.align === 'right' ? 'right' : 'left'\n return `${y} ${x}`\n})\n\n// Use slide-up transition for drop=\"up\", scale transition for drop=\"down\"\nconst transitionClasses = computed(() => {\n if (props.drop === 'up') {\n return {\n enterActive: 'transition ease-out duration-150',\n enterFrom: 'opacity-0 translate-y-1',\n enterTo: 'opacity-100 translate-y-0',\n leaveActive: 'transition ease-in duration-100',\n leaveFrom: 'opacity-100 translate-y-0',\n leaveTo: 'opacity-0 translate-y-1',\n }\n }\n return {\n enterActive: 'transition duration-100 ease-out',\n enterFrom: 'opacity-0 scale-95',\n enterTo: 'opacity-100 scale-100',\n leaveActive: 'transition duration-75 ease-in',\n leaveFrom: 'opacity-100 scale-100',\n leaveTo: 'opacity-0 scale-95',\n }\n})\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n emit(isOpen.value ? 'open' : 'close')\n}\n\nconst close = () => {\n if (isOpen.value) {\n isOpen.value = false\n emit('close')\n }\n}\n\nonClickOutside(containerRef, close)\n\nuseEventListener(globalThis.document, 'keydown', (e) => {\n if (e.key === 'Escape') close()\n})\n\ndefineExpose({ isOpen, toggle, close })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DA,MAAM,QAAQ;EAkCd,MAAM,OAAO;EAEb,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,eAAe,IAAI,IAAI;EAG7B,MAAM,eAAe,eAAe;GAClC,IAAI,MAAM,YAAY,OAAO,MAAM;GACnC,MAAM,QAAQ,MAAM,UAAU,UAAU,YAAY;GACpD,MAAM,UAAU,MAAM,SAAS,OAAO,qBAAqB;GAG3D,OAAO,iBAAiB,iBAAiB,OAAO,MAAM,MAAM,GAAG,MAAM,GAAG;EAC1E,CAAC;EAKD,MAAM,cAAc,eAAe;GAGjC,OAAO,GAFG,MAAM,SAAS,OAAO,WAAW,MAE/B,GADF,MAAM,UAAU,UAAU,UAAU;EAEhD,CAAC;EAGD,MAAM,oBAAoB,eAAe;GACvC,IAAI,MAAM,SAAS,MACjB,OAAO;IACL,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,WAAW;IACX,SAAS;GACX;GAEF,OAAO;IACL,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,WAAW;IACX,SAAS;GACX;EACF,CAAC;EAED,MAAM,eAAe;GACnB,OAAO,QAAQ,CAAC,OAAO;GACvB,KAAK,OAAO,QAAQ,SAAS,OAAO;EACtC;EAEA,MAAM,cAAc;GAClB,IAAI,OAAO,OAAO;IAChB,OAAO,QAAQ;IACf,KAAK,OAAO;GACd;EACF;EAEA,eAAe,cAAc,KAAK;EAElC,iBAAiB,WAAW,UAAU,YAAY,MAAM;GACtD,IAAI,EAAE,QAAQ,UAAU,MAAM;EAChC,CAAC;EAED,SAAa;GAAE;GAAQ;GAAQ;EAAM,CAAC;;GA/JpC,OAAA,UAAA,GAAA,mBAiBM,OAAA;IAjBG,SAAA;IAAJ,KAAI;IAAe,OAAM;GAE5B,GAAA,CAAA,WAAuD,KAAA,QAAA,WAAA;IAAjC,MAAM,OAAA;IAAiB;GAG7C,CAAA,GAAA,YAWa,YAAA;IAVV,sBAAoB,kBAAA,MAAkB;IACtC,oBAAkB,kBAAA,MAAkB;IACpC,kBAAgB,kBAAA,MAAkB;IAClC,sBAAoB,kBAAA,MAAkB;IACtC,oBAAkB,kBAAA,MAAkB;IACpC,kBAAgB,kBAAA,MAAkB;;IAEnC,SAAA,cAEM,CAFN,eAAA,mBAEM,OAAA;KAFgB,OAAK,eAAE,aAAA,KAAY;KAAG,OAAK,eAAA,EAAA,iBAAqB,YAAA,MAAW,CAAA;IAC/E,GAAA,CAAA,WAAuB,KAAA,QAAA,WAAA,EAAT,MAAK,CAAA,CAAA,GAAA,CAAA,GAAA,CADR,CAAA,OAAA,OAAA,KAAM,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
2
|
import _sfc_main$2 from "./Button.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MENU_PANEL_CLASS } from "../internal/menu.js";
|
|
4
|
+
import { Transition, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
4
5
|
//#region src/components/DropdownSubmenu.vue
|
|
5
6
|
var _hoisted_1 = { class: "flex-1 text-left" };
|
|
6
7
|
var _hoisted_2 = {
|
|
@@ -128,8 +129,9 @@ var _sfc_main = {
|
|
|
128
129
|
}, {
|
|
129
130
|
default: withCtx(() => [showSub.value && !__props.disabled && !isMobile.value ? (openBlock(), createElementBlock("div", {
|
|
130
131
|
key: 0,
|
|
131
|
-
class: normalizeClass(["absolute top-0 w-52
|
|
132
|
-
|
|
132
|
+
class: normalizeClass(["absolute top-0 w-52 py-1 z-50", [unref(MENU_PANEL_CLASS), __props.alignLeft ? "right-full mr-1" : "left-full ml-1"]]),
|
|
133
|
+
style: normalizeStyle({ transformOrigin: __props.alignLeft ? "top right" : "top left" })
|
|
134
|
+
}, [renderSlot(_ctx.$slots, "default")], 6)) : createCommentVNode("", true)]),
|
|
133
135
|
_: 3
|
|
134
136
|
})
|
|
135
137
|
], 32);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownSubmenu.js","names":[],"sources":["../../src/components/DropdownSubmenu.vue"],"sourcesContent":["<template>\n <!-- Hover-triggered on desktop, click-triggered on mobile -->\n <div\n class=\"relative\"\n @mouseenter=\"!isMobile && (showSub = true)\"\n @mouseleave=\"!isMobile && (showSub = false)\"\n >\n <UiButton variant=\"menu-item\" :disabled=\"disabled\" @click=\"showSub = !showSub\">\n <UiIcon :name=\"icon\" class=\"w-4 h-4 block shrink-0\" />\n <span class=\"flex-1 text-left\">{{ label }}</span>\n <UiIcon\n :name=\"isMobile ? (showSub ? 'mdi:chevron-up' : 'mdi:chevron-down') : 'mdi:chevron-right'\"\n class=\"w-3.5 h-3.5 block shrink-0 text-gray-400\"\n />\n </UiButton>\n\n <!-- Mobile: inline accordion with left border accent -->\n <Transition\n enter-active-class=\"transition-all duration-100 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-60 opacity-100\"\n leave-active-class=\"transition-all duration-75 ease-in\"\n leave-from-class=\"max-h-60 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <div\n v-if=\"showSub && !disabled && isMobile\"\n class=\"overflow-hidden bg-gray-50 dark:bg-gray-850 border-l-2 border-primary-400 ml-5\"\n >\n <slot />\n </div>\n </Transition>\n\n <!-- Desktop: flyout panel positioned left or right -->\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-if=\"showSub && !disabled && !isMobile\"\n class=\"absolute top-0 w-52
|
|
1
|
+
{"version":3,"file":"DropdownSubmenu.js","names":[],"sources":["../../src/components/DropdownSubmenu.vue"],"sourcesContent":["<template>\n <!-- Hover-triggered on desktop, click-triggered on mobile -->\n <div\n class=\"relative\"\n @mouseenter=\"!isMobile && (showSub = true)\"\n @mouseleave=\"!isMobile && (showSub = false)\"\n >\n <UiButton variant=\"menu-item\" :disabled=\"disabled\" @click=\"showSub = !showSub\">\n <UiIcon :name=\"icon\" class=\"w-4 h-4 block shrink-0\" />\n <span class=\"flex-1 text-left\">{{ label }}</span>\n <UiIcon\n :name=\"isMobile ? (showSub ? 'mdi:chevron-up' : 'mdi:chevron-down') : 'mdi:chevron-right'\"\n class=\"w-3.5 h-3.5 block shrink-0 text-gray-400\"\n />\n </UiButton>\n\n <!-- Mobile: inline accordion with left border accent -->\n <Transition\n enter-active-class=\"transition-all duration-100 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-60 opacity-100\"\n leave-active-class=\"transition-all duration-75 ease-in\"\n leave-from-class=\"max-h-60 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <div\n v-if=\"showSub && !disabled && isMobile\"\n class=\"overflow-hidden bg-gray-50 dark:bg-gray-850 border-l-2 border-primary-400 ml-5\"\n >\n <slot />\n </div>\n </Transition>\n\n <!-- Desktop: flyout panel positioned left or right -->\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-if=\"showSub && !disabled && !isMobile\"\n class=\"absolute top-0 w-52 py-1 z-50\"\n :class=\"[MENU_PANEL_CLASS, alignLeft ? 'right-full mr-1' : 'left-full ml-1']\"\n :style=\"{ transformOrigin: alignLeft ? 'top right' : 'top left' }\"\n >\n <slot />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiDropdownSubmenu — Nested submenu for UiDropdown with responsive behavior.\n *\n * On desktop (≥640px), shows a flyout panel on hover to the left or right.\n * On mobile (<640px), expands inline as an accordion with a left border accent.\n * Automatically detects viewport width on mount and resize.\n *\n * @example Basic submenu\n * <UiDropdownSubmenu icon=\"mdi:format-text\" label=\"Text Style\">\n * <UiDropdownItem icon=\"mdi:format-bold\" label=\"Bold\" @click=\"bold\" />\n * <UiDropdownItem icon=\"mdi:format-italic\" label=\"Italic\" @click=\"italic\" />\n * </UiDropdownSubmenu>\n *\n * @example Left-aligned flyout\n * <UiDropdownSubmenu icon=\"mdi:share\" label=\"Share\" align-left>\n * <UiDropdownItem icon=\"mdi:email\" label=\"Email\" @click=\"shareEmail\" />\n * </UiDropdownSubmenu>\n *\n * @slot default — Submenu items (typically UiDropdownItem components)\n *\n * @see UiDropdown — Parent dropdown container\n * @see UiDropdownItem — Standard menu item for use inside this submenu\n */\nimport { ref, onMounted, onUnmounted } from 'vue'\nimport UiButton from './Button.vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\ndefineProps({\n /**\n * MDI icon name displayed at the start of the trigger row.\n * @type {string}\n * @required\n */\n icon: { type: String, required: true },\n\n /**\n * Text label for the submenu trigger.\n * @type {string}\n * @required\n */\n label: { type: String, required: true },\n\n /**\n * Disabled state — prevents opening the submenu.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Align the desktop flyout to the left (right-to-left) instead of the default right.\n * @type {boolean}\n * @default false\n */\n alignLeft: { type: Boolean, default: false },\n})\n\nconst showSub = ref(false)\n// Track viewport width to switch between mobile accordion and desktop flyout\nconst isMobile = ref(false)\n\nconst checkMobile = () => {\n isMobile.value = window.innerWidth < 640\n}\n\nonMounted(() => {\n checkMobile()\n window.addEventListener('resize', checkMobile)\n})\n\nonUnmounted(() => {\n window.removeEventListener('resize', checkMobile)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,UAAU,IAAI,KAAK;EAEzB,MAAM,WAAW,IAAI,KAAK;EAE1B,MAAM,oBAAoB;GACxB,SAAS,QAAQ,OAAO,aAAa;EACvC;EAEA,gBAAgB;GACd,YAAY;GACZ,OAAO,iBAAiB,UAAU,WAAW;EAC/C,CAAC;EAED,kBAAkB;GAChB,OAAO,oBAAoB,UAAU,WAAW;EAClD,CAAC;;GA7HC,OAAA,UAAA,GAAA,mBAiDM,OAAA;IAhDJ,OAAM;IACL,cAAU,OAAA,OAAA,OAAA,MAAA,WAAA,CAAG,SAAA,UAAa,QAAA,QAAO;IACjC,cAAU,OAAA,OAAA,OAAA,MAAA,WAAA,CAAG,SAAA,UAAa,QAAA,QAAO;;IAElC,YAOW,aAAA;KAPD,SAAQ;KAAa,UAAU,QAAA;KAAW,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,QAAO,CAAI,QAAA;;KACpE,SAAA,cAAsD;MAAtD,YAAsD,aAAA;OAA7C,MAAM,QAAA;OAAM,OAAM;;MAC3B,mBAAiD,QAAjD,YAAiD,gBAAf,QAAA,KAAK,GAAA,CAAA;MACvC,YAGE,aAAA;OAFC,MAAM,SAAA,QAAY,QAAA,QAAO,mBAAA,qBAAA;OAC1B,OAAM;;;;;IAKV,YAca,YAAA;KAbX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;;KAEf,SAAA,cAKM,CAJE,QAAA,SAAO,CAAK,QAAA,YAAY,SAAA,SADhC,UAAA,GAAA,mBAKM,OALN,YAKM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;;;IAKZ,YAgBa,YAAA;KAfX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;;KAEf,SAAA,cAOM,CANE,QAAA,SAAO,CAAK,QAAA,YAAQ,CAAK,SAAA,SADjC,UAAA,GAAA,mBAOM,OAAA;;MALJ,OAAK,eAAA,CAAC,iCAA+B,CAC5B,MAAA,gBAAA,GAAkB,QAAA,YAAS,oBAAA,gBAAA,CAAA,CAAA;MACnC,OAAK,eAAA,EAAA,iBAAqB,QAAA,YAAS,cAAA,WAAA,CAAA;KAEpC,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementBlock, createElementVNode, normalizeClass, openBlock, ref, renderSlot } from "vue";
|
|
1
|
+
import { createElementBlock, createElementVNode, normalizeClass, openBlock, ref, renderSlot, withModifiers } from "vue";
|
|
2
2
|
//#region src/components/FileInput.vue
|
|
3
3
|
var _hoisted_1 = [
|
|
4
4
|
"accept",
|
|
@@ -98,12 +98,19 @@ var _sfc_main = {
|
|
|
98
98
|
emit("select", props.multiple ? files : files[0]);
|
|
99
99
|
e.target.value = "";
|
|
100
100
|
}
|
|
101
|
+
const open = () => inputRef.value?.click();
|
|
102
|
+
const onTriggerClick = () => {
|
|
103
|
+
if (!props.disabled) open();
|
|
104
|
+
};
|
|
101
105
|
__expose({
|
|
102
|
-
open
|
|
106
|
+
open,
|
|
103
107
|
el: inputRef
|
|
104
108
|
});
|
|
105
109
|
return (_ctx, _cache) => {
|
|
106
|
-
return openBlock(), createElementBlock("
|
|
110
|
+
return openBlock(), createElementBlock("span", {
|
|
111
|
+
class: normalizeClass(["inline-flex items-center gap-2 cursor-pointer transition-colors", __props.disabled ? "opacity-50 pointer-events-none" : ""]),
|
|
112
|
+
onClick: onTriggerClick
|
|
113
|
+
}, [renderSlot(_ctx.$slots, "default"), createElementVNode("input", {
|
|
107
114
|
ref_key: "inputRef",
|
|
108
115
|
ref: inputRef,
|
|
109
116
|
type: "file",
|
|
@@ -111,7 +118,8 @@ var _sfc_main = {
|
|
|
111
118
|
accept: __props.accept,
|
|
112
119
|
multiple: __props.multiple,
|
|
113
120
|
disabled: __props.disabled,
|
|
114
|
-
onChange
|
|
121
|
+
onChange,
|
|
122
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
|
|
115
123
|
}, null, 40, _hoisted_1)], 2);
|
|
116
124
|
};
|
|
117
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.js","names":[],"sources":["../../src/components/FileInput.vue"],"sourcesContent":["<template>\n <!-- Clickable
|
|
1
|
+
{"version":3,"file":"FileInput.js","names":[],"sources":["../../src/components/FileInput.vue"],"sourcesContent":["<template>\n <!-- Clickable wrapper around a hidden file input — slot content is the visible trigger.\n A plain <label> would not work when the slot is a <button> (or any interactive\n element): the browser skips label→control forwarding when the click lands on an\n interactive descendant, so the picker never opened. Handling the click ourselves\n makes any trigger content work. -->\n <span\n class=\"inline-flex items-center gap-2 cursor-pointer transition-colors\"\n :class=\"disabled ? 'opacity-50 pointer-events-none' : ''\"\n @click=\"onTriggerClick\"\n >\n <slot />\n <input\n ref=\"inputRef\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onChange\"\n @click.stop\n />\n </span>\n</template>\n\n<script setup>\n/**\n * UiFileInput — Hidden file input wrapped in a clickable label for custom trigger UI.\n *\n * The default slot provides the visible trigger content (e.g. a button or icon).\n * Clicking anywhere in the label opens the native file picker. Supports file type\n * filtering via `accept`, multi-file selection, and max file size validation.\n * Exposes an `open()` method for programmatic triggering.\n *\n * @example Single image upload\n * <UiFileInput accept=\"image/*\" @select=\"onFile\">\n * <UiButton variant=\"outline\">Upload Image</UiButton>\n * </UiFileInput>\n *\n * @example Multiple files with size limit (5 MB)\n * <UiFileInput multiple :max-size=\"5 * 1024 * 1024\" @select=\"onFiles\" @error=\"onError\">\n * <span>Choose files</span>\n * </UiFileInput>\n *\n * @example Programmatic open via ref\n * <UiFileInput ref=\"fileInput\" @select=\"onFile\"><span>Pick</span></UiFileInput>\n * <!-- In script: fileInput.value.open() -->\n *\n * @emits {File | File[]} select — Emitted with the selected file(s) after validation passes\n * @emits {{ type: string, file: File, message: string }} error — Emitted when a file exceeds the maxSize limit\n *\n * @slot default — Trigger content (e.g. a button or icon) that opens the file picker\n */\nimport { ref } from 'vue'\nconst props = defineProps({\n /**\n * Accepted file types (MIME types or extensions), passed to the native `accept` attribute.\n * @type {string}\n * @default undefined\n * @example 'image/*', '.pdf,.doc', 'video/mp4'\n */\n accept: { type: String, default: undefined },\n\n /**\n * Allow selecting multiple files at once.\n * @type {boolean}\n * @default false\n */\n multiple: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the label and prevents file picker from opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Maximum allowed file size in bytes. Set to 0 for no limit.\n * Emits an 'error' event with `{ type: 'maxSize', file, message }` when exceeded.\n * @type {number}\n * @default 0\n */\n maxSize: { type: Number, default: 0 },\n})\n\nconst emit = defineEmits(['select', 'error'])\n\nconst inputRef = ref(null)\n\nfunction onChange(e) {\n const files = Array.from(e.target.files || [])\n if (!files.length) return\n\n if (props.maxSize > 0) {\n const oversized = files.find((f) => f.size > props.maxSize)\n if (oversized) {\n const maxMB = (props.maxSize / 1024 / 1024).toFixed(1)\n emit('error', { type: 'maxSize', file: oversized, message: `File exceeds ${maxMB} MB limit` })\n e.target.value = ''\n return\n }\n }\n\n emit('select', props.multiple ? files : files[0])\n e.target.value = ''\n}\n\nconst open = () => inputRef.value?.click()\n\n// A click anywhere in the wrapper opens the picker. The hidden input's own\n// (programmatic) click is stopped from bubbling via `@click.stop` in the\n// template, so this never re-enters itself.\nconst onTriggerClick = () => {\n if (!props.disabled) open()\n}\n\ndefineExpose({\n open,\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,QAAQ;EAgCd,MAAM,OAAO;EAEb,MAAM,WAAW,IAAI,IAAI;EAEzB,SAAS,SAAS,GAAG;GACnB,MAAM,QAAQ,MAAM,KAAK,EAAE,OAAO,SAAS,CAAC,CAAC;GAC7C,IAAI,CAAC,MAAM,QAAQ;GAEnB,IAAI,MAAM,UAAU,GAAG;IACrB,MAAM,YAAY,MAAM,MAAM,MAAM,EAAE,OAAO,MAAM,OAAO;IAC1D,IAAI,WAAW;KACb,MAAM,SAAS,MAAM,UAAU,OAAO,KAAA,CAAM,QAAQ,CAAC;KACrD,KAAK,SAAS;MAAE,MAAM;MAAW,MAAM;MAAW,SAAS,gBAAgB,MAAM;KAAW,CAAC;KAC7F,EAAE,OAAO,QAAQ;KACjB;IACF;GACF;GAEA,KAAK,UAAU,MAAM,WAAW,QAAQ,MAAM,EAAE;GAChD,EAAE,OAAO,QAAQ;EACnB;EAEA,MAAM,aAAa,SAAS,OAAO,MAAM;EAKzC,MAAM,uBAAuB;GAC3B,IAAI,CAAC,MAAM,UAAU,KAAK;EAC5B;EAEA,SAAa;GACX;GACA,IAAI;EACN,CAAC;;GAlHC,OAAA,UAAA,GAAA,mBAgBO,QAAA;IAfL,OAAK,eAAA,CAAC,mEACE,QAAA,WAAQ,mCAAA,EAAA,CAAA;IACf,SAAO;GAER,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,GACR,mBASE,SAAA;IARI,SAAA;IAAJ,KAAI;IACJ,MAAK;IACL,OAAM;IACL,QAAQ,QAAA;IACR,UAAU,QAAA;IACV,UAAU,QAAA;IACF;IACR,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useMergedClasses } from "../composables/useMergedClasses.js";
|
|
3
|
+
import { computed, createElementBlock, createVNode, mergeProps, normalizeClass, openBlock, unref } from "vue";
|
|
4
4
|
//#region src/components/IconTile.vue
|
|
5
5
|
var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
6
6
|
__name: "IconTile",
|
|
@@ -75,14 +75,10 @@ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
|
|
|
75
75
|
error: "bg-error-100 text-error-700 dark:bg-error-400/15 dark:text-error-300",
|
|
76
76
|
blue: "bg-blue-100 text-blue-700 dark:bg-blue-400/15 dark:text-blue-300"
|
|
77
77
|
})[props.color] ?? "bg-primary-100 text-primary-700 dark:bg-primary-400/15 dark:text-primary-300");
|
|
78
|
-
const
|
|
79
|
-
const restAttrs =
|
|
80
|
-
const { class: _class, ...rest } = attrs;
|
|
81
|
-
return rest;
|
|
82
|
-
});
|
|
83
|
-
const mergedClasses = computed(() => twMerge(sizeClass.value, colorClass.value, attrs.class));
|
|
78
|
+
const internalClasses = computed(() => `${sizeClass.value} ${colorClass.value}`);
|
|
79
|
+
const { mergedClasses, restAttrs } = useMergedClasses(internalClasses);
|
|
84
80
|
return (_ctx, _cache) => {
|
|
85
|
-
return openBlock(), createElementBlock("span", mergeProps({ class: ["inline-flex items-center justify-center", mergedClasses
|
|
81
|
+
return openBlock(), createElementBlock("span", mergeProps({ class: ["inline-flex items-center justify-center", unref(mergedClasses)] }, unref(restAttrs)), [createVNode(_sfc_main$1, {
|
|
86
82
|
name: __props.icon,
|
|
87
83
|
class: normalizeClass(iconSizeClass.value),
|
|
88
84
|
"aria-hidden": "true"
|
|
@@ -1 +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
|
|
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 } from 'vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\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\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 internalClasses = computed(() => `${sizeClass.value} ${colorClass.value}`)\nconst { mergedClasses, restAttrs } = useMergedClasses(internalClasses)\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;EAOA,MAAM,kBAAkB,eAAe,GAAG,UAAU,MAAM,GAAG,WAAW,OAAO;EAC/E,MAAM,EAAE,eAAe,cAAc,iBAAiB,eAAe;;GA5FnE,OAAA,UAAA,GAAA,mBAEO,QAFP,WAEO,EAFD,OAAK,CAAC,2CAAkD,MAAA,aAAA,CAAa,EAAU,GAAA,MAAA,SAAA,CAAS,GAAA,CAC5F,YAAiE,aAAA;IAAxD,MAAM,QAAA;IAAO,OAAK,eAAE,cAAA,KAAa;IAAE,eAAY"}
|
package/dist/components/Input.js
CHANGED
|
@@ -467,11 +467,11 @@ var _sfc_main = {
|
|
|
467
467
|
})], 2)) : createCommentVNode("", true),
|
|
468
468
|
isNumber.value && __props.stepperLayout === "stacked-left" ? (openBlock(), createElementBlock("div", {
|
|
469
469
|
key: 1,
|
|
470
|
-
class: normalizeClass(["flex flex-col w-
|
|
470
|
+
class: normalizeClass(["flex flex-col w-7 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden", { "opacity-50 pointer-events-none": __props.disabled }])
|
|
471
471
|
}, [createElementVNode("button", {
|
|
472
472
|
type: "button",
|
|
473
473
|
tabindex: "-1",
|
|
474
|
-
class: "grid place-items-center w-
|
|
474
|
+
class: "grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600",
|
|
475
475
|
"aria-label": "Increase value",
|
|
476
476
|
onClick: stepUp
|
|
477
477
|
}, [createVNode(_sfc_main$1, {
|
|
@@ -480,7 +480,7 @@ var _sfc_main = {
|
|
|
480
480
|
})]), createElementVNode("button", {
|
|
481
481
|
type: "button",
|
|
482
482
|
tabindex: "-1",
|
|
483
|
-
class: "grid place-items-center w-
|
|
483
|
+
class: "grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none",
|
|
484
484
|
"aria-label": "Decrease value",
|
|
485
485
|
onClick: stepDown
|
|
486
486
|
}, [createVNode(_sfc_main$1, {
|
|
@@ -562,11 +562,11 @@ var _sfc_main = {
|
|
|
562
562
|
}, null, 8, ["name"])], 40, _hoisted_7)) : createCommentVNode("", true),
|
|
563
563
|
isNumber.value && __props.stepperLayout === "stacked-right" ? (openBlock(), createElementBlock("div", {
|
|
564
564
|
key: 8,
|
|
565
|
-
class: normalizeClass(["flex flex-col w-
|
|
565
|
+
class: normalizeClass(["flex flex-col w-7 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden", { "opacity-50 pointer-events-none": __props.disabled }])
|
|
566
566
|
}, [createElementVNode("button", {
|
|
567
567
|
type: "button",
|
|
568
568
|
tabindex: "-1",
|
|
569
|
-
class: "grid place-items-center w-
|
|
569
|
+
class: "grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600",
|
|
570
570
|
"aria-label": "Increase value",
|
|
571
571
|
onClick: stepUp
|
|
572
572
|
}, [createVNode(_sfc_main$1, {
|
|
@@ -575,7 +575,7 @@ var _sfc_main = {
|
|
|
575
575
|
})]), createElementVNode("button", {
|
|
576
576
|
type: "button",
|
|
577
577
|
tabindex: "-1",
|
|
578
|
-
class: "grid place-items-center w-
|
|
578
|
+
class: "grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none",
|
|
579
579
|
"aria-label": "Decrease value",
|
|
580
580
|
onClick: stepDown
|
|
581
581
|
}, [createVNode(_sfc_main$1, {
|