@plexui/vue 0.36.0 → 0.38.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/dist/es/components/Kbd/Kbd.js +41 -1
- package/dist/es/components/Kbd/Kbd.js.map +1 -1
- package/dist/es/components/Kbd/index.js +1 -1
- package/dist/es/components/Kbd/index.js.map +1 -1
- package/dist/es/components/Progress/Progress.js +32 -0
- package/dist/es/components/Progress/Progress.js.map +1 -1
- package/dist/es/components/Progress/index.js +1 -1
- package/dist/es/components/Progress/index.js.map +1 -1
- package/dist/es/components/RollingNumber/RollingNumber.js +64 -0
- package/dist/es/components/RollingNumber/RollingNumber.js.map +1 -0
- package/dist/es/components/RollingNumber/index.js +2 -0
- package/dist/es/components/RollingNumber/index.js.map +1 -0
- package/dist/es/components/Stepper/Stepper.js +10 -1
- package/dist/es/components/Stepper/Stepper.js.map +1 -1
- package/dist/types/components/Kbd/Kbd.d.ts +68 -0
- package/dist/types/components/Kbd/index.d.ts +1 -1
- package/dist/types/components/Progress/Progress.d.ts +37 -0
- package/dist/types/components/Progress/index.d.ts +1 -1
- package/dist/types/components/RollingNumber/RollingNumber.d.ts +63 -0
- package/dist/types/components/RollingNumber/index.d.ts +1 -0
- package/dist/types/components/Stepper/Stepper.d.ts +34 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h } from "vue";
|
|
1
|
+
import { defineComponent, h, onMounted, ref } from "vue";
|
|
2
2
|
import s from "@plexui/styles/components/Kbd/Kbd.module.css";
|
|
3
3
|
// Vue port of packages/ui/src/components/Kbd/Kbd.tsx. Attributes fall
|
|
4
4
|
// through to the <kbd> (and the group's <span>), as React spreads them.
|
|
@@ -23,4 +23,44 @@ export const KbdGroup = defineComponent({
|
|
|
23
23
|
return () => h("span", { class: s.Group }, slots.default?.());
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
|
+
/** Each modifier on an Apple keyboard (a symbol and its name) and on another one. `mod` is ⌘ there and Ctrl here. */
|
|
27
|
+
export const KBD_MODIFIERS = {
|
|
28
|
+
mod: { apple: { symbol: "⌘", name: "Command" }, other: { symbol: "Ctrl", name: "Ctrl" } },
|
|
29
|
+
ctrl: { apple: { symbol: "⌃", name: "Control" }, other: { symbol: "Ctrl", name: "Ctrl" } },
|
|
30
|
+
alt: { apple: { symbol: "⌥", name: "Option" }, other: { symbol: "Alt", name: "Alt" } },
|
|
31
|
+
shift: { apple: { symbol: "⇧", name: "Shift" }, other: { symbol: "Shift", name: "Shift" } },
|
|
32
|
+
};
|
|
33
|
+
/** Whether the browser runs on a Mac, an iPhone or an iPad, whose keyboards print ⌘ and ⌥. */
|
|
34
|
+
export const isApplePlatform = () => {
|
|
35
|
+
if (typeof navigator === "undefined")
|
|
36
|
+
return true;
|
|
37
|
+
const platform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent;
|
|
38
|
+
return /mac|iphone|ipad|ipod/i.test(platform);
|
|
39
|
+
};
|
|
40
|
+
const KbdModifierComponent = defineComponent({
|
|
41
|
+
name: "KbdModifier",
|
|
42
|
+
props: {
|
|
43
|
+
/** The modifier: `mod` is ⌘ on an Apple keyboard and Ctrl on another, as an app's shortcuts are. @default "mod" */
|
|
44
|
+
name: { type: String, default: "mod" },
|
|
45
|
+
/** The keyboard to print for; by default the one the browser runs on (Apple on the server). */
|
|
46
|
+
platform: { type: String, default: undefined },
|
|
47
|
+
/** Height and text size: `xs` 16px, `sm` 20px, `md` 24px. @default "sm" */
|
|
48
|
+
size: { type: String, default: "sm" },
|
|
49
|
+
/** `soft` fills the key, `outline` draws its edge; both mix the text color. @default "soft" */
|
|
50
|
+
variant: { type: String, default: "soft" },
|
|
51
|
+
},
|
|
52
|
+
setup(props) {
|
|
53
|
+
// Apple until mounted, as on the server, so hydration matches; then the browser's own keyboard
|
|
54
|
+
const apple = ref(true);
|
|
55
|
+
onMounted(() => { apple.value = isApplePlatform(); });
|
|
56
|
+
return () => {
|
|
57
|
+
const key = KBD_MODIFIERS[props.name][props.platform ?? (apple.value ? "apple" : "other")];
|
|
58
|
+
return h("kbd", { "class": s.Kbd, "data-size": props.size, "data-variant": props.variant, "data-modifier": props.name }, key.symbol === key.name
|
|
59
|
+
? key.symbol
|
|
60
|
+
: [h("span", { "aria-hidden": "true" }, key.symbol), h("span", { class: s.Name }, key.name)]);
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
/** A modifier key as the reader's keyboard prints it: ⌘ on a Mac, Ctrl elsewhere (React `Kbd.Modifier`). */
|
|
65
|
+
export const KbdModifier = KbdModifierComponent;
|
|
26
66
|
//# sourceMappingURL=Kbd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kbd.js","sourceRoot":"","sources":["../../../../src/components/Kbd/Kbd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Kbd.js","sourceRoot":"","sources":["../../../../src/components/Kbd/Kbd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAsC,MAAM,KAAK,CAAA;AAC5F,OAAO,CAAC,MAAM,8CAA8C,CAAA;AAE5D,sEAAsE;AACtE,wEAAwE;AAExE,MAAM,YAAY,GAAG,eAAe,CAAC;IACnC,IAAI,EAAE,KAAK;IACX,KAAK,EAAE;QACL,2EAA2E;QAC3E,IAAI,EAAE,EAAE,IAAI,EAAE,MAAsC,EAAE,OAAO,EAAE,IAAI,EAAE;QACrE,+FAA+F;QAC/F,OAAO,EAAE,EAAE,IAAI,EAAE,MAAsC,EAAE,OAAO,EAAE,MAAM,EAAE;KAC3E;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,GAA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AE,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,IAAI,EAAE,EACrH,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI;gBACrB,CAAC,CAAC,GAAG,CAAC,MAAM;gBACZ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnG,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,4GAA4G;AAC5G,MAAM,CAAC,MAAM,WAAW,GAAG,oBAA8F,CAAA","sourcesContent":["import { defineComponent, h, onMounted, ref, type HTMLAttributes, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/Kbd/Kbd.module.css\"\n\n// Vue port of packages/ui/src/components/Kbd/Kbd.tsx. Attributes fall\n// through to the <kbd> (and the group's <span>), as React spreads them.\n\nconst KbdComponent = defineComponent({\n name: \"Kbd\",\n props: {\n /** Height and text size: `xs` 16px, `sm` 20px, `md` 24px. @default \"sm\" */\n size: { type: String as PropType<\"xs\" | \"sm\" | \"md\">, default: \"sm\" },\n /** `soft` fills the key, `outline` draws its edge; both mix the text color. @default \"soft\" */\n variant: { type: String as PropType<\"soft\" | \"outline\">, default: \"soft\" },\n },\n setup(props, { slots }) {\n return () => h(\"kbd\", { \"class\": s.Kbd, \"data-size\": props.size, \"data-variant\": props.variant }, slots.default?.())\n },\n})\n\ntype KbdOwnProps = InstanceType<typeof KbdComponent>[\"$props\"]\n\n/** Kbd props plus the native attributes that fall through to the <kbd>. */\nexport type KbdProps = KbdOwnProps & Omit<HTMLAttributes, keyof KbdOwnProps>\n\n/** A key or a shortcut, such as ⌘K, in a tooltip, a menu item or a sentence. */\nexport const Kbd = KbdComponent as typeof KbdComponent & { new (): { $props: KbdProps } }\n\n/** Keys pressed together: a row of `Kbd` (React `Kbd.Group`). */\nexport const KbdGroup = defineComponent({\n name: \"KbdGroup\",\n setup(_props, { slots }) {\n return () => h(\"span\", { class: s.Group }, slots.default?.())\n },\n})\n\nexport type KbdGroupProps = HTMLAttributes\n\nexport type KbdModifierName = \"mod\" | \"ctrl\" | \"alt\" | \"shift\"\nexport type KbdPlatform = \"apple\" | \"other\"\n\n/** Each modifier on an Apple keyboard (a symbol and its name) and on another one. `mod` is ⌘ there and Ctrl here. */\nexport const KBD_MODIFIERS: Record<KbdModifierName, Record<KbdPlatform, { symbol: string; name: string }>> = {\n mod: { apple: { symbol: \"⌘\", name: \"Command\" }, other: { symbol: \"Ctrl\", name: \"Ctrl\" } },\n ctrl: { apple: { symbol: \"⌃\", name: \"Control\" }, other: { symbol: \"Ctrl\", name: \"Ctrl\" } },\n alt: { apple: { symbol: \"⌥\", name: \"Option\" }, other: { symbol: \"Alt\", name: \"Alt\" } },\n shift: { apple: { symbol: \"⇧\", name: \"Shift\" }, other: { symbol: \"Shift\", name: \"Shift\" } },\n}\n\n/** Whether the browser runs on a Mac, an iPhone or an iPad, whose keyboards print ⌘ and ⌥. */\nexport const isApplePlatform = () => {\n if (typeof navigator === \"undefined\") return true\n const platform = (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform || navigator.platform || navigator.userAgent\n return /mac|iphone|ipad|ipod/i.test(platform)\n}\n\nconst KbdModifierComponent = defineComponent({\n name: \"KbdModifier\",\n props: {\n /** The modifier: `mod` is ⌘ on an Apple keyboard and Ctrl on another, as an app's shortcuts are. @default \"mod\" */\n name: { type: String as PropType<KbdModifierName>, default: \"mod\" },\n /** The keyboard to print for; by default the one the browser runs on (Apple on the server). */\n platform: { type: String as PropType<KbdPlatform>, default: undefined },\n /** Height and text size: `xs` 16px, `sm` 20px, `md` 24px. @default \"sm\" */\n size: { type: String as PropType<\"xs\" | \"sm\" | \"md\">, default: \"sm\" },\n /** `soft` fills the key, `outline` draws its edge; both mix the text color. @default \"soft\" */\n variant: { type: String as PropType<\"soft\" | \"outline\">, default: \"soft\" },\n },\n setup(props) {\n // Apple until mounted, as on the server, so hydration matches; then the browser's own keyboard\n const apple = ref(true)\n onMounted(() => { apple.value = isApplePlatform() })\n return () => {\n const key = KBD_MODIFIERS[props.name][props.platform ?? (apple.value ? \"apple\" : \"other\")]\n return h(\"kbd\", { \"class\": s.Kbd, \"data-size\": props.size, \"data-variant\": props.variant, \"data-modifier\": props.name },\n key.symbol === key.name\n ? key.symbol\n : [h(\"span\", { \"aria-hidden\": \"true\" }, key.symbol), h(\"span\", { class: s.Name }, key.name)])\n }\n },\n})\n\ntype KbdModifierOwnProps = InstanceType<typeof KbdModifierComponent>[\"$props\"]\n\n/** KbdModifier props plus the native attributes that fall through to the <kbd>. */\nexport type KbdModifierProps = KbdModifierOwnProps & Omit<HTMLAttributes, keyof KbdModifierOwnProps>\n\n/** A modifier key as the reader's keyboard prints it: ⌘ on a Mac, Ctrl elsewhere (React `Kbd.Modifier`). */\nexport const KbdModifier = KbdModifierComponent as typeof KbdModifierComponent & { new (): { $props: KbdModifierProps } }\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Kbd, KbdGroup } from "./Kbd.js";
|
|
1
|
+
export { KBD_MODIFIERS, Kbd, KbdGroup, KbdModifier, isApplePlatform } from "./Kbd.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Kbd/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Kbd/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAoG,MAAM,UAAU,CAAA","sourcesContent":["export { KBD_MODIFIERS, Kbd, KbdGroup, KbdModifier, isApplePlatform, type KbdGroupProps, type KbdModifierName, type KbdModifierProps, type KbdPlatform, type KbdProps } from \"./Kbd.js\"\n"]}
|
|
@@ -14,6 +14,17 @@ const DEFAULT_MAX = 100;
|
|
|
14
14
|
const isNumber = (value) => typeof value === "number";
|
|
15
15
|
const isValidMax = (max) => isNumber(max) && !Number.isNaN(max) && max > 0;
|
|
16
16
|
const isValidValue = (value, max) => isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
|
|
17
|
+
/** The parts of a segmented bar, each clamped so their sum stays within `max`, and their sum. */
|
|
18
|
+
export const progressSegments = (segments, max) => {
|
|
19
|
+
let total = 0;
|
|
20
|
+
const parts = segments.map((segment) => {
|
|
21
|
+
const value = Math.max(0, Math.min(max - total, segment.value || 0));
|
|
22
|
+
total += value;
|
|
23
|
+
return { ...segment, value };
|
|
24
|
+
});
|
|
25
|
+
return { parts, total };
|
|
26
|
+
};
|
|
27
|
+
const segmentsLabel = (parts, max) => parts.map((part) => `${part.label ? `${part.label} ` : ""}${Math.round((part.value / max) * 100)}%`).join(", ");
|
|
17
28
|
const defaultGetValueLabel = (value, max) => `${Math.round((value / max) * 100)}%`;
|
|
18
29
|
const ProgressComponent = defineComponent({
|
|
19
30
|
name: "Progress",
|
|
@@ -27,10 +38,31 @@ const ProgressComponent = defineComponent({
|
|
|
27
38
|
max: { type: Number, default: DEFAULT_MAX },
|
|
28
39
|
/** Accessible value text for the current value. @default "<percentage>%" */
|
|
29
40
|
getValueLabel: Function,
|
|
41
|
+
/**
|
|
42
|
+
* Parts of one bar, side by side in their colors, such as paid, pending and due. The value is their sum; they
|
|
43
|
+
* take `value`'s place. A part's share is clamped so the bar never passes `max`.
|
|
44
|
+
*/
|
|
45
|
+
segments: { type: Array, default: undefined },
|
|
30
46
|
},
|
|
31
47
|
setup(props) {
|
|
32
48
|
const getValueText = (value, max) => isNumber(value) ? (props.getValueLabel ?? defaultGetValueLabel)(value, max) : undefined;
|
|
33
49
|
return () => {
|
|
50
|
+
if (props.segments) {
|
|
51
|
+
const rootMax = isValidMax(props.max) ? props.max : DEFAULT_MAX;
|
|
52
|
+
const { parts, total } = progressSegments(props.segments, rootMax);
|
|
53
|
+
return h(ProgressRoot, {
|
|
54
|
+
"modelValue": total,
|
|
55
|
+
"max": rootMax,
|
|
56
|
+
"getValueLabel": () => undefined,
|
|
57
|
+
"getValueText": (current, currentMax) => props.getValueLabel && isNumber(current) ? props.getValueLabel(current, currentMax) : segmentsLabel(parts, rootMax),
|
|
58
|
+
"class": s.Root,
|
|
59
|
+
"data-segmented": "",
|
|
60
|
+
}, {
|
|
61
|
+
default: () => parts.map((part, index) => part.value > 0
|
|
62
|
+
? h("div", { "key": index, "class": s.Segment, "data-color": part.color ?? "primary", "style": { width: `${(part.value / rootMax) * 100}%` } })
|
|
63
|
+
: null),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
34
66
|
const { value, max } = props;
|
|
35
67
|
const resolved = value == null ? null : Math.max(0, Math.min(max, value));
|
|
36
68
|
const percentage = resolved == null ? null : (resolved / max) * 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","sourceRoot":"","sources":["../../../../src/components/Progress/Progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,CAAC,MAAM,wDAAwD,CAAA;AAEtE,4EAA4E;AAC5E,6EAA6E;AAC7E,qBAAqB;AACrB,8EAA8E;AAC9E,6EAA6E;AAC7E,iEAAiE;AACjE,2EAA2E;AAC3E,2EAA2E;AAC3E,gFAAgF;AAEhF,MAAM,WAAW,GAAG,GAAG,CAAA;AAEvB,MAAM,QAAQ,GAA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Root } from \"reka-ui\"\nimport s from \"@plexui/styles/components/Progress/Progress.module.css\"\n\n// Vue port of packages/ui/src/components/Progress/Progress.tsx on Reka UI's\n// Progress. Radix and Reka differ in three places, smoothed over here so the\n// DOM matches React:\n// - Radix announces the percentage as `aria-valuetext` (via `getValueLabel`),\n// Reka as `aria-label`. Reka's label is turned off and its value text set.\n// - Radix falls back to `max = 100` for an invalid max and to an\n// indeterminate value for an invalid value. Reka keeps them and asks the\n// parent to correct them, so the same fallbacks are applied before Reka.\n// - Caller attributes still win over Reka's, as `{...restProps}` does in React.\n\nconst DEFAULT_MAX = 100\n\nconst isNumber = (value: unknown): value is number => typeof value === \"number\"\nconst isValidMax = (max: unknown): max is number => isNumber(max) && !Number.isNaN(max) && max > 0\nconst isValidValue = (value: unknown, max: number): value is number =>\n isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0\n\nconst defaultGetValueLabel = (value: number, max: number) => `${Math.round((value / max) * 100)}%`\n\nconst ProgressComponent = defineComponent({\n name: \"Progress\",\n props: {\n /**\n * Current progress value, between `0` and `max`.\n * Omit (or pass `null`) for an indeterminate state.\n */\n value: { type: Number as PropType<number | null>, default: null },\n /** Maximum value. @default 100 */\n max: { type: Number, default: DEFAULT_MAX },\n /** Accessible value text for the current value. @default \"<percentage>%\" */\n getValueLabel: Function as PropType<(value: number, max: number) => string>,\n },\n setup(props) {\n const getValueText = (value: number | null | undefined, max: number) =>\n isNumber(value) ? (props.getValueLabel ?? defaultGetValueLabel)(value, max) : undefined\n\n return () => {\n const { value, max } = props\n const resolved = value == null ? null : Math.max(0, Math.min(max, value))\n const percentage = resolved == null ? null : (resolved / max) * 100\n\n // What Radix renders for the props React hands it\n const rootMax = isValidMax(max) ? max : DEFAULT_MAX\n const rootValue = isValidValue(resolved, rootMax) ? resolved : null\n\n return h(\n ProgressRoot,\n {\n modelValue: rootValue,\n max: rootMax,\n getValueLabel: () => undefined,\n getValueText,\n class: s.Root,\n },\n {\n default: () =>\n h(ProgressIndicator, {\n \"class\": s.Indicator,\n \"style\": percentage == null ? undefined : { transform: `translateX(-${100 - percentage}%)` },\n \"data-indeterminate\": percentage == null ? \"\" : undefined,\n }),\n },\n )\n }\n },\n})\n\ntype ProgressOwnProps = InstanceType<typeof ProgressComponent>[\"$props\"]\n\n/** Progress props plus the native <div> attributes that fall through to the root, as in React. */\nexport type ProgressProps = ProgressOwnProps & Omit<HTMLAttributes, keyof ProgressOwnProps>\n\nexport const Progress = ProgressComponent as typeof ProgressComponent & { new (): { $props: ProgressProps } }\n"]}
|
|
1
|
+
{"version":3,"file":"Progress.js","sourceRoot":"","sources":["../../../../src/components/Progress/Progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,CAAC,MAAM,wDAAwD,CAAA;AAEtE,4EAA4E;AAC5E,6EAA6E;AAC7E,qBAAqB;AACrB,8EAA8E;AAC9E,6EAA6E;AAC7E,iEAAiE;AACjE,2EAA2E;AAC3E,2EAA2E;AAC3E,gFAAgF;AAEhF,MAAM,WAAW,GAAG,GAAG,CAAA;AAEvB,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAA;AAC/E,MAAM,UAAU,GAAG,CAAC,GAAY,EAAiB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAA;AAClG,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,GAAW,EAAmB,EAAE,CACpE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC,CAAA;AAavE,iGAAiG;AACjG,MAAM,CAA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C,iBAAiB,EAAE;oBACnB,OAAO,EAAE,CAAC,CAAC,SAAS;oBACpB,OAAO,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,GAAG,UAAU,IAAI,EAAE;oBAC5F,oBAAoB,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;iBAC1D,CAAC;aACL,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAqF,CAAA","sourcesContent":["import { defineComponent, h, type HTMLAttributes, type PropType } from \"vue\"\nimport { ProgressIndicator, ProgressRoot } from \"reka-ui\"\nimport s from \"@plexui/styles/components/Progress/Progress.module.css\"\n\n// Vue port of packages/ui/src/components/Progress/Progress.tsx on Reka UI's\n// Progress. Radix and Reka differ in three places, smoothed over here so the\n// DOM matches React:\n// - Radix announces the percentage as `aria-valuetext` (via `getValueLabel`),\n// Reka as `aria-label`. Reka's label is turned off and its value text set.\n// - Radix falls back to `max = 100` for an invalid max and to an\n// indeterminate value for an invalid value. Reka keeps them and asks the\n// parent to correct them, so the same fallbacks are applied before Reka.\n// - Caller attributes still win over Reka's, as `{...restProps}` does in React.\n\nconst DEFAULT_MAX = 100\n\nconst isNumber = (value: unknown): value is number => typeof value === \"number\"\nconst isValidMax = (max: unknown): max is number => isNumber(max) && !Number.isNaN(max) && max > 0\nconst isValidValue = (value: unknown, max: number): value is number =>\n isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0\n\nexport type ProgressColor = \"primary\" | \"secondary\" | \"success\" | \"warning\" | \"caution\" | \"danger\" | \"info\" | \"discovery\"\n\n/** A part of a segmented bar: its share of `max`, its color, and the name it is read with. */\nexport type ProgressSegment = {\n value: number\n /** @default \"primary\" */\n color?: ProgressColor\n /** Read out with its share, such as \"Paid 60%\" */\n label?: string\n}\n\n/** The parts of a segmented bar, each clamped so their sum stays within `max`, and their sum. */\nexport const progressSegments = (segments: ProgressSegment[], max: number) => {\n let total = 0\n const parts = segments.map((segment) => {\n const value = Math.max(0, Math.min(max - total, segment.value || 0))\n total += value\n return { ...segment, value }\n })\n return { parts, total }\n}\n\nconst segmentsLabel = (parts: ProgressSegment[], max: number) =>\n parts.map((part) => `${part.label ? `${part.label} ` : \"\"}${Math.round((part.value / max) * 100)}%`).join(\", \")\n\nconst defaultGetValueLabel = (value: number, max: number) => `${Math.round((value / max) * 100)}%`\n\nconst ProgressComponent = defineComponent({\n name: \"Progress\",\n props: {\n /**\n * Current progress value, between `0` and `max`.\n * Omit (or pass `null`) for an indeterminate state.\n */\n value: { type: Number as PropType<number | null>, default: null },\n /** Maximum value. @default 100 */\n max: { type: Number, default: DEFAULT_MAX },\n /** Accessible value text for the current value. @default \"<percentage>%\" */\n getValueLabel: Function as PropType<(value: number, max: number) => string>,\n /**\n * Parts of one bar, side by side in their colors, such as paid, pending and due. The value is their sum; they\n * take `value`'s place. A part's share is clamped so the bar never passes `max`.\n */\n segments: { type: Array as PropType<ProgressSegment[]>, default: undefined },\n },\n setup(props) {\n const getValueText = (value: number | null | undefined, max: number) =>\n isNumber(value) ? (props.getValueLabel ?? defaultGetValueLabel)(value, max) : undefined\n\n return () => {\n if (props.segments) {\n const rootMax = isValidMax(props.max) ? props.max : DEFAULT_MAX\n const { parts, total } = progressSegments(props.segments, rootMax)\n return h(\n ProgressRoot,\n {\n \"modelValue\": total,\n \"max\": rootMax,\n \"getValueLabel\": () => undefined,\n \"getValueText\": (current: number | null | undefined, currentMax: number) =>\n props.getValueLabel && isNumber(current) ? props.getValueLabel(current, currentMax) : segmentsLabel(parts, rootMax),\n \"class\": s.Root,\n \"data-segmented\": \"\",\n },\n {\n default: () => parts.map((part, index) =>\n part.value > 0\n ? h(\"div\", { \"key\": index, \"class\": s.Segment, \"data-color\": part.color ?? \"primary\", \"style\": { width: `${(part.value / rootMax) * 100}%` } })\n : null),\n },\n )\n }\n const { value, max } = props\n const resolved = value == null ? null : Math.max(0, Math.min(max, value))\n const percentage = resolved == null ? null : (resolved / max) * 100\n\n // What Radix renders for the props React hands it\n const rootMax = isValidMax(max) ? max : DEFAULT_MAX\n const rootValue = isValidValue(resolved, rootMax) ? resolved : null\n\n return h(\n ProgressRoot,\n {\n modelValue: rootValue,\n max: rootMax,\n getValueLabel: () => undefined,\n getValueText,\n class: s.Root,\n },\n {\n default: () =>\n h(ProgressIndicator, {\n \"class\": s.Indicator,\n \"style\": percentage == null ? undefined : { transform: `translateX(-${100 - percentage}%)` },\n \"data-indeterminate\": percentage == null ? \"\" : undefined,\n }),\n },\n )\n }\n },\n})\n\ntype ProgressOwnProps = InstanceType<typeof ProgressComponent>[\"$props\"]\n\n/** Progress props plus the native <div> attributes that fall through to the root, as in React. */\nexport type ProgressProps = ProgressOwnProps & Omit<HTMLAttributes, keyof ProgressOwnProps>\n\nexport const Progress = ProgressComponent as typeof ProgressComponent & { new (): { $props: ProgressProps } }\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Progress } from "./Progress.js";
|
|
1
|
+
export { Progress, progressSegments } from "./Progress.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAgE,MAAM,eAAe,CAAA","sourcesContent":["export { Progress, progressSegments, type ProgressColor, type ProgressProps, type ProgressSegment } from \"./Progress.js\"\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
import s from "@plexui/styles/components/RollingNumber/RollingNumber.module.css";
|
|
3
|
+
// Vue port of packages/ui/src/components/RollingNumber/RollingNumber.tsx: the same DOM, attributes fall through to
|
|
4
|
+
// the root <span>.
|
|
5
|
+
/** A written number's characters, each keyed by its place around the decimal separator, so a digit keeps its reel
|
|
6
|
+
* when the number grows or its fraction gets longer; digits are the locale's own (Arabic-Indic, Bengali…). */
|
|
7
|
+
export const rollingNumberParts = (value, locales = "en-US", format) => {
|
|
8
|
+
const formatter = new Intl.NumberFormat(locales, format);
|
|
9
|
+
const { locale, numberingSystem } = formatter.resolvedOptions();
|
|
10
|
+
const digitFormatter = new Intl.NumberFormat(locale, { numberingSystem, useGrouping: false });
|
|
11
|
+
const glyphs = Array.from({ length: 10 }, (_, digit) => digitFormatter.format(digit));
|
|
12
|
+
const parts = formatter.formatToParts(value);
|
|
13
|
+
let integers = parts.reduce((count, part) => count + (part.type === "integer" ? Array.from(part.value).length : 0), 0);
|
|
14
|
+
let fractions = 0;
|
|
15
|
+
const seen = {};
|
|
16
|
+
const characters = parts.flatMap((part) => Array.from(part.value).map((character) => {
|
|
17
|
+
const glyph = glyphs.indexOf(character);
|
|
18
|
+
const digit = (part.type === "integer" || part.type === "fraction") && glyph >= 0 ? glyph : null;
|
|
19
|
+
let key;
|
|
20
|
+
if (part.type === "integer")
|
|
21
|
+
key = `i${integers--}`;
|
|
22
|
+
else if (part.type === "fraction")
|
|
23
|
+
key = `f${++fractions}`;
|
|
24
|
+
else if (part.type === "group")
|
|
25
|
+
key = `g${integers}`;
|
|
26
|
+
else {
|
|
27
|
+
seen[part.type] = (seen[part.type] ?? 0) + 1;
|
|
28
|
+
key = `${part.type}${seen[part.type]}-${character}`;
|
|
29
|
+
}
|
|
30
|
+
return { character, digit, key };
|
|
31
|
+
}));
|
|
32
|
+
return { text: parts.map((part) => part.value).join(""), glyphs, characters };
|
|
33
|
+
};
|
|
34
|
+
const RollingNumberComponent = defineComponent({
|
|
35
|
+
name: "RollingNumber",
|
|
36
|
+
props: {
|
|
37
|
+
/** The number shown. A new value rolls each changed digit to it. */
|
|
38
|
+
value: { type: Number, required: true },
|
|
39
|
+
/** The locale the number is written in, as `Intl.NumberFormat` takes it; fixed, so the server writes it as the browser does. @default "en-US" */
|
|
40
|
+
locales: { type: [String, Array], default: undefined },
|
|
41
|
+
/** How the number is written: currency, percent, fraction digits, grouping, as `Intl.NumberFormat` takes it. */
|
|
42
|
+
format: { type: Object, default: undefined },
|
|
43
|
+
},
|
|
44
|
+
setup(props) {
|
|
45
|
+
return () => {
|
|
46
|
+
const { text, glyphs, characters } = rollingNumberParts(props.value, props.locales, props.format);
|
|
47
|
+
return h("span", { class: s.RollingNumber }, [
|
|
48
|
+
h("span", { class: s.Text }, text),
|
|
49
|
+
h("span", { "class": s.Visual, "aria-hidden": "true" }, characters.map(({ character, digit, key }) => digit === null
|
|
50
|
+
? h("span", { key }, character)
|
|
51
|
+
: h("span", { "key": key, "class": s.Digit, "data-digit": digit }, [
|
|
52
|
+
h("span", { class: s.Ghost }, character),
|
|
53
|
+
h("span", { class: s.Reel, style: { "--rolling-number-digit": digit } }, glyphs.map((reelDigit) => h("span", { key: reelDigit }, reelDigit))),
|
|
54
|
+
]))),
|
|
55
|
+
]);
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* A number whose digits roll to a new value, as an odometer: for a total, a balance, a count or a KPI that changes
|
|
61
|
+
* while it is watched. It reads as the written number; its reels are hidden from a screen reader.
|
|
62
|
+
*/
|
|
63
|
+
export const RollingNumber = RollingNumberComponent;
|
|
64
|
+
//# sourceMappingURL=RollingNumber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RollingNumber.js","sourceRoot":"","sources":["../../../../src/components/RollingNumber/RollingNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;AAC5E,OAAO,CAAC,MAAM,kEAAkE,CAAA;AAEhF,mHAAmH;AACnH,mBA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AAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;qBAC9I,CAAC,CACL,CAAC;aACH,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAoG,CAAA","sourcesContent":["import { defineComponent, h, type HTMLAttributes, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/RollingNumber/RollingNumber.module.css\"\n\n// Vue port of packages/ui/src/components/RollingNumber/RollingNumber.tsx: the same DOM, attributes fall through to\n// the root <span>.\n\n/** A written number's characters, each keyed by its place around the decimal separator, so a digit keeps its reel\n * when the number grows or its fraction gets longer; digits are the locale's own (Arabic-Indic, Bengali…). */\nexport const rollingNumberParts = (value: number, locales: Intl.LocalesArgument = \"en-US\", format?: Intl.NumberFormatOptions) => {\n const formatter = new Intl.NumberFormat(locales, format)\n const { locale, numberingSystem } = formatter.resolvedOptions()\n const digitFormatter = new Intl.NumberFormat(locale, { numberingSystem, useGrouping: false })\n const glyphs = Array.from({ length: 10 }, (_, digit) => digitFormatter.format(digit))\n const parts = formatter.formatToParts(value)\n let integers = parts.reduce((count, part) => count + (part.type === \"integer\" ? Array.from(part.value).length : 0), 0)\n let fractions = 0\n const seen: Record<string, number> = {}\n const characters = parts.flatMap((part) =>\n Array.from(part.value).map((character) => {\n const glyph = glyphs.indexOf(character)\n const digit = (part.type === \"integer\" || part.type === \"fraction\") && glyph >= 0 ? glyph : null\n let key: string\n if (part.type === \"integer\") key = `i${integers--}`\n else if (part.type === \"fraction\") key = `f${++fractions}`\n else if (part.type === \"group\") key = `g${integers}`\n else {\n seen[part.type] = (seen[part.type] ?? 0) + 1\n key = `${part.type}${seen[part.type]}-${character}`\n }\n return { character, digit, key }\n }),\n )\n return { text: parts.map((part) => part.value).join(\"\"), glyphs, characters }\n}\n\nconst RollingNumberComponent = defineComponent({\n name: \"RollingNumber\",\n props: {\n /** The number shown. A new value rolls each changed digit to it. */\n value: { type: Number, required: true },\n /** The locale the number is written in, as `Intl.NumberFormat` takes it; fixed, so the server writes it as the browser does. @default \"en-US\" */\n locales: { type: [String, Array] as PropType<Intl.LocalesArgument>, default: undefined },\n /** How the number is written: currency, percent, fraction digits, grouping, as `Intl.NumberFormat` takes it. */\n format: { type: Object as PropType<Intl.NumberFormatOptions>, default: undefined },\n },\n setup(props) {\n return () => {\n const { text, glyphs, characters } = rollingNumberParts(props.value, props.locales, props.format)\n return h(\"span\", { class: s.RollingNumber }, [\n h(\"span\", { class: s.Text }, text),\n h(\"span\", { \"class\": s.Visual, \"aria-hidden\": \"true\" }, characters.map(({ character, digit, key }) =>\n digit === null\n ? h(\"span\", { key }, character)\n : h(\"span\", { \"key\": key, \"class\": s.Digit, \"data-digit\": digit }, [\n h(\"span\", { class: s.Ghost }, character),\n h(\"span\", { class: s.Reel, style: { \"--rolling-number-digit\": digit } }, glyphs.map((reelDigit) => h(\"span\", { key: reelDigit }, reelDigit))),\n ]),\n )),\n ])\n }\n },\n})\n\ntype RollingNumberOwnProps = InstanceType<typeof RollingNumberComponent>[\"$props\"]\n\n/** RollingNumber props plus the native attributes that fall through to the root <span>. */\nexport type RollingNumberProps = RollingNumberOwnProps & Omit<HTMLAttributes, keyof RollingNumberOwnProps>\n\n/**\n * A number whose digits roll to a new value, as an odometer: for a total, a balance, a count or a KPI that changes\n * while it is watched. It reads as the written number; its reels are hidden from a screen reader.\n */\nexport const RollingNumber = RollingNumberComponent as typeof RollingNumberComponent & { new (): { $props: RollingNumberProps } }\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/RollingNumber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAA","sourcesContent":["export { RollingNumber, rollingNumberParts, type RollingNumberProps } from \"./RollingNumber.js\"\n"]}
|
|
@@ -45,6 +45,11 @@ const StepperComponent = defineComponent({
|
|
|
45
45
|
disabled: { type: Boolean, default: false },
|
|
46
46
|
/** Fully rounded ends. @default true */
|
|
47
47
|
pill: { type: Boolean, default: true },
|
|
48
|
+
/**
|
|
49
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
50
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
51
|
+
*/
|
|
52
|
+
showValue: { type: Boolean, default: false },
|
|
48
53
|
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
49
54
|
decrementLabel: { type: String, default: "Decrease" },
|
|
50
55
|
/** Accessible name of the increment segment. @default "Increase" */
|
|
@@ -199,12 +204,16 @@ const StepperComponent = defineComponent({
|
|
|
199
204
|
"class": [s.Stepper, attrs.class],
|
|
200
205
|
"data-disabled": props.disabled ? "" : undefined,
|
|
201
206
|
"data-pill": props.pill ? "" : undefined,
|
|
207
|
+
"data-show-value": props.showValue ? "" : undefined,
|
|
202
208
|
"onKeydown": handleKeyDown,
|
|
203
209
|
"onFocus": (event) => emit("focus", event),
|
|
204
210
|
"onBlur": (event) => emit("blur", event),
|
|
205
211
|
}, [
|
|
206
212
|
segment("decrement"),
|
|
207
|
-
|
|
213
|
+
// The spin button already reads its value, so the shown one is not read again
|
|
214
|
+
props.showValue
|
|
215
|
+
? h("span", { "class": s.Value, "aria-hidden": "true" }, String(value.value))
|
|
216
|
+
: h("span", { "class": s.Separator, "aria-hidden": "true" }),
|
|
208
217
|
segment("increment"),
|
|
209
218
|
props.name !== undefined ? h("input", { type: "hidden", name: props.name, value: value.value, disabled: props.disabled }) : null,
|
|
210
219
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../../../src/components/Stepper/Stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAiB,GAAG,EAAE,MAAM,KAAK,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ACpB,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;YAC1D,OAAO,CAAC,WAAW,CAAC;YACpB,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;SACjI,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, type PropType, ref } from \"vue\"\nimport s from \"@plexui/styles/components/Stepper/Stepper.module.css\"\nimport { Minus, Plus, RemoveTrash } from \"../Icon/index.js\"\n\n// Vue port of packages/ui/src/components/Stepper/Stepper.tsx: the same DOM (a spin button with two\n// unfocusable segments and an optional hidden input), keys, hold-to-repeat and clamped or wrapped steps.\n// React's `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`.\n\n/** Delay before a held segment starts repeating, and the time between repeats, in ms. */\nconst REPEAT_DELAY = 400\nconst REPEAT_INTERVAL = 100\n\nconst decimals = (n: number) => {\n const [, fraction = \"\"] = String(n).split(\".\")\n return fraction.length\n}\n\n/** The value one step away, clamped to the range or wrapped, without floating point drift. */\nexport const stepValue = (current: number, direction: 1 | -1, { min, max, step, wrap }: { min: number; max: number; step: number; wrap: boolean }) => {\n const precision = Math.max(decimals(step), decimals(min), decimals(current))\n const next = Number((current + direction * step).toFixed(precision))\n if (next > max) return wrap ? min : max\n if (next < min) return wrap ? max : min\n return next\n}\n\ntype Segment = \"decrement\" | \"increment\"\n\nconst StepperComponent = defineComponent({\n name: \"Stepper\",\n inheritAttrs: false,\n props: {\n /** The `id` of the stepper. */\n id: String,\n /** The controlled value. Bind with `v-model:value`. */\n value: { type: Number, default: undefined },\n /** The value when it is initially rendered. Use when you do not need to control the value. @default min */\n defaultValue: { type: Number, default: undefined },\n /** The lowest value. @default 0 */\n min: { type: Number, default: 0 },\n /** The highest value. @default 100 */\n max: { type: Number, default: 100 },\n /** The amount each step adds or removes. @default 1 */\n step: { type: Number, default: 1 },\n /** A step past `max` continues from `min`, and one below `min` from `max`. @default false */\n wrap: { type: Boolean, default: false },\n /** Holding a segment keeps stepping, as a native stepper does. @default true */\n autoRepeat: { type: Boolean, default: true },\n /** When `true`, prevents the user from interacting with the stepper. */\n disabled: { type: Boolean, default: false },\n /** Fully rounded ends. @default true */\n pill: { type: Boolean, default: true },\n /** Accessible name of the decrement segment. @default \"Decrease\" */\n decrementLabel: { type: String, default: \"Decrease\" },\n /** Accessible name of the increment segment. @default \"Increase\" */\n incrementLabel: { type: String, default: \"Increase\" },\n /**\n * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there\n * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).\n */\n onRemove: Function as PropType<() => void>,\n /** Accessible name of the decrement segment when it removes. @default \"Remove\" */\n removeLabel: { type: String, default: \"Remove\" },\n /** The name of the stepper. Submits its value with the owning form. */\n name: String,\n /** Accessible name of the value the stepper changes, when no visible label names it. */\n ariaLabel: String,\n /** The `id` of the visible label of the value the stepper changes. */\n ariaLabelledby: String,\n /** The `id` of an element that describes the stepper, such as the text that shows its value. */\n ariaDescribedby: String,\n },\n emits: {\n /** The value changed */\n \"update:value\": (value: number) => typeof value === \"number\",\n /** The value changed (React `onChange`) */\n change: (value: number) => typeof value === \"number\",\n /** The stepper gained focus */\n focus: (event: FocusEvent) => event.type === \"focus\",\n /** The stepper lost focus */\n blur: (event: FocusEvent) => event.type === \"blur\",\n },\n setup(props, { attrs, emit }) {\n const internalValue = ref(props.defaultValue ?? props.min)\n const value = computed(() => props.value ?? internalValue.value)\n const pressed = ref<Segment | null>(null)\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const commit = (next: number) => {\n if (next === value.value) return false\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n return true\n }\n\n const stepBy = (direction: 1 | -1, times = 1) => {\n let next = value.value\n for (let i = 0; i < times; i++) next = stepValue(next, direction, props)\n return commit(next)\n }\n\n const stopRepeat = () => {\n clearTimeout(timer)\n timer = undefined\n pressed.value = null\n }\n onBeforeUnmount(stopRepeat)\n\n const atMin = computed(() => !props.wrap && value.value <= props.min)\n const atMax = computed(() => !props.wrap && value.value >= props.max)\n // At the minimum the decrement segment removes the item, when the owner can remove it\n const removes = computed(() => atMin.value && props.onRemove !== undefined)\n\n const startPress = (segment: Segment, event: PointerEvent) => {\n if (event.button !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) {\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n props.onRemove?.()\n return\n }\n if (segment === \"decrement\" ? atMin.value : atMax.value) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n const direction = segment === \"decrement\" ? -1 : 1\n stepBy(direction)\n if (!props.autoRepeat) return\n const repeat = () => {\n if (props.disabled || !stepBy(direction)) return stopRepeat()\n timer = setTimeout(repeat, REPEAT_INTERVAL)\n }\n timer = setTimeout(repeat, REPEAT_DELAY)\n }\n\n // A pointer steps on press, so only a click without one (assistive technology, `element.click()`) steps here.\n const handleClick = (segment: Segment, event: MouseEvent) => {\n if (event.detail !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) return props.onRemove?.()\n stepBy(segment === \"decrement\" ? -1 : 1)\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (props.disabled || event.altKey || event.ctrlKey || event.metaKey) return\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(1, 10),\n PageDown: () => stepBy(-1, 10),\n Home: () => commit(props.min),\n End: () => commit(props.max),\n // At the minimum Delete or Backspace removes, as the trash can does; the arrows never do\n ...(removes.value && { Delete: () => props.onRemove?.(), Backspace: () => props.onRemove?.() }),\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n }\n\n const segment = (kind: Segment) => {\n const remove = kind === \"decrement\" && removes.value\n const atEnd = !remove && (kind === \"decrement\" ? atMin.value : atMax.value)\n return h(\"button\", {\n \"type\": \"button\",\n \"tabindex\": -1,\n \"aria-label\": remove ? props.removeLabel : kind === \"decrement\" ? props.decrementLabel : props.incrementLabel,\n \"aria-disabled\": atEnd || undefined,\n \"disabled\": props.disabled,\n \"class\": s.Segment,\n \"data-segment\": kind,\n \"data-remove\": remove ? \"\" : undefined,\n \"data-disabled\": atEnd || props.disabled ? \"\" : undefined,\n \"data-pressed\": pressed.value === kind && !props.disabled ? \"\" : undefined,\n // Keeps the focus where it is, as a native stepper takes none.\n \"onMousedown\": (event: MouseEvent) => event.preventDefault(),\n \"onPointerdown\": (event: PointerEvent) => startPress(kind, event),\n \"onPointerup\": stopRepeat,\n \"onPointercancel\": stopRepeat,\n \"onLostpointercapture\": stopRepeat,\n \"onClick\": (event: MouseEvent) => handleClick(kind, event),\n }, [h(remove ? RemoveTrash : kind === \"decrement\" ? Minus : Plus, { class: s.Icon })])\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"id\": props.id,\n \"role\": \"spinbutton\",\n \"tabindex\": props.disabled ? -1 : 0,\n \"aria-valuenow\": value.value,\n \"aria-valuemin\": props.min,\n \"aria-valuemax\": props.max,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-keyshortcuts\": removes.value ? \"Delete\" : undefined,\n \"aria-disabled\": props.disabled || undefined,\n \"class\": [s.Stepper, attrs.class],\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"onKeydown\": handleKeyDown,\n \"onFocus\": (event: FocusEvent) => emit(\"focus\", event),\n \"onBlur\": (event: FocusEvent) => emit(\"blur\", event),\n }, [\n segment(\"decrement\"),\n h(\"span\", { \"class\": s.Separator, \"aria-hidden\": \"true\" }),\n segment(\"increment\"),\n props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value, disabled: props.disabled }) : null,\n ])\n },\n})\n\ntype StepperOwnProps = InstanceType<typeof StepperComponent>[\"$props\"]\n\n/** Stepper props. */\nexport type StepperProps = StepperOwnProps\n\n/**\n * Two segments that decrease and increase a number, as the iOS 26 stepper does. It shows no value of its own:\n * name it with `aria-label` or `aria-labelledby` and show the value beside it. Keyboard focus lands on the\n * stepper, a spin button: Up and Down step, Page Up and Page Down step ten times, Home and End go to the range ends.\n */\nexport const Stepper = StepperComponent\n"]}
|
|
1
|
+
{"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../../../src/components/Stepper/Stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAiB,GAAG,EAAE,MAAM,KAAK,CAAA;AACvF,OAAO,CAAC,MAAM,sDAAsD,CAAA;AACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE3D,mGAAmG;AACnG,yGAAyG;AACzG,+FAA+F;AAE/F,yFAAyF;AACzF,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;IAC7B,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC9C,OAAO,QAAQ,CAAC,MAAM,CAAA;AACxB,CAAC,CAAA;AAED,8FAA8F;AAC9F,M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,CAAC,WAAW,CAAC;YACpB,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;SACjI,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, type PropType, ref } from \"vue\"\nimport s from \"@plexui/styles/components/Stepper/Stepper.module.css\"\nimport { Minus, Plus, RemoveTrash } from \"../Icon/index.js\"\n\n// Vue port of packages/ui/src/components/Stepper/Stepper.tsx: the same DOM (a spin button with two\n// unfocusable segments and an optional hidden input), keys, hold-to-repeat and clamped or wrapped steps.\n// React's `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`.\n\n/** Delay before a held segment starts repeating, and the time between repeats, in ms. */\nconst REPEAT_DELAY = 400\nconst REPEAT_INTERVAL = 100\n\nconst decimals = (n: number) => {\n const [, fraction = \"\"] = String(n).split(\".\")\n return fraction.length\n}\n\n/** The value one step away, clamped to the range or wrapped, without floating point drift. */\nexport const stepValue = (current: number, direction: 1 | -1, { min, max, step, wrap }: { min: number; max: number; step: number; wrap: boolean }) => {\n const precision = Math.max(decimals(step), decimals(min), decimals(current))\n const next = Number((current + direction * step).toFixed(precision))\n if (next > max) return wrap ? min : max\n if (next < min) return wrap ? max : min\n return next\n}\n\ntype Segment = \"decrement\" | \"increment\"\n\nconst StepperComponent = defineComponent({\n name: \"Stepper\",\n inheritAttrs: false,\n props: {\n /** The `id` of the stepper. */\n id: String,\n /** The controlled value. Bind with `v-model:value`. */\n value: { type: Number, default: undefined },\n /** The value when it is initially rendered. Use when you do not need to control the value. @default min */\n defaultValue: { type: Number, default: undefined },\n /** The lowest value. @default 0 */\n min: { type: Number, default: 0 },\n /** The highest value. @default 100 */\n max: { type: Number, default: 100 },\n /** The amount each step adds or removes. @default 1 */\n step: { type: Number, default: 1 },\n /** A step past `max` continues from `min`, and one below `min` from `max`. @default false */\n wrap: { type: Boolean, default: false },\n /** Holding a segment keeps stepping, as a native stepper does. @default true */\n autoRepeat: { type: Boolean, default: true },\n /** When `true`, prevents the user from interacting with the stepper. */\n disabled: { type: Boolean, default: false },\n /** Fully rounded ends. @default true */\n pill: { type: Boolean, default: true },\n /**\n * Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no\n * separator. Without it the stepper shows no value, as the native one. @default false\n */\n showValue: { type: Boolean, default: false },\n /** Accessible name of the decrement segment. @default \"Decrease\" */\n decrementLabel: { type: String, default: \"Decrease\" },\n /** Accessible name of the increment segment. @default \"Increase\" */\n incrementLabel: { type: String, default: \"Increase\" },\n /**\n * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there\n * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).\n */\n onRemove: Function as PropType<() => void>,\n /** Accessible name of the decrement segment when it removes. @default \"Remove\" */\n removeLabel: { type: String, default: \"Remove\" },\n /** The name of the stepper. Submits its value with the owning form. */\n name: String,\n /** Accessible name of the value the stepper changes, when no visible label names it. */\n ariaLabel: String,\n /** The `id` of the visible label of the value the stepper changes. */\n ariaLabelledby: String,\n /** The `id` of an element that describes the stepper, such as the text that shows its value. */\n ariaDescribedby: String,\n },\n emits: {\n /** The value changed */\n \"update:value\": (value: number) => typeof value === \"number\",\n /** The value changed (React `onChange`) */\n change: (value: number) => typeof value === \"number\",\n /** The stepper gained focus */\n focus: (event: FocusEvent) => event.type === \"focus\",\n /** The stepper lost focus */\n blur: (event: FocusEvent) => event.type === \"blur\",\n },\n setup(props, { attrs, emit }) {\n const internalValue = ref(props.defaultValue ?? props.min)\n const value = computed(() => props.value ?? internalValue.value)\n const pressed = ref<Segment | null>(null)\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const commit = (next: number) => {\n if (next === value.value) return false\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n return true\n }\n\n const stepBy = (direction: 1 | -1, times = 1) => {\n let next = value.value\n for (let i = 0; i < times; i++) next = stepValue(next, direction, props)\n return commit(next)\n }\n\n const stopRepeat = () => {\n clearTimeout(timer)\n timer = undefined\n pressed.value = null\n }\n onBeforeUnmount(stopRepeat)\n\n const atMin = computed(() => !props.wrap && value.value <= props.min)\n const atMax = computed(() => !props.wrap && value.value >= props.max)\n // At the minimum the decrement segment removes the item, when the owner can remove it\n const removes = computed(() => atMin.value && props.onRemove !== undefined)\n\n const startPress = (segment: Segment, event: PointerEvent) => {\n if (event.button !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) {\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n props.onRemove?.()\n return\n }\n if (segment === \"decrement\" ? atMin.value : atMax.value) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n const direction = segment === \"decrement\" ? -1 : 1\n stepBy(direction)\n if (!props.autoRepeat) return\n const repeat = () => {\n if (props.disabled || !stepBy(direction)) return stopRepeat()\n timer = setTimeout(repeat, REPEAT_INTERVAL)\n }\n timer = setTimeout(repeat, REPEAT_DELAY)\n }\n\n // A pointer steps on press, so only a click without one (assistive technology, `element.click()`) steps here.\n const handleClick = (segment: Segment, event: MouseEvent) => {\n if (event.detail !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) return props.onRemove?.()\n stepBy(segment === \"decrement\" ? -1 : 1)\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (props.disabled || event.altKey || event.ctrlKey || event.metaKey) return\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(1, 10),\n PageDown: () => stepBy(-1, 10),\n Home: () => commit(props.min),\n End: () => commit(props.max),\n // At the minimum Delete or Backspace removes, as the trash can does; the arrows never do\n ...(removes.value && { Delete: () => props.onRemove?.(), Backspace: () => props.onRemove?.() }),\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n }\n\n const segment = (kind: Segment) => {\n const remove = kind === \"decrement\" && removes.value\n const atEnd = !remove && (kind === \"decrement\" ? atMin.value : atMax.value)\n return h(\"button\", {\n \"type\": \"button\",\n \"tabindex\": -1,\n \"aria-label\": remove ? props.removeLabel : kind === \"decrement\" ? props.decrementLabel : props.incrementLabel,\n \"aria-disabled\": atEnd || undefined,\n \"disabled\": props.disabled,\n \"class\": s.Segment,\n \"data-segment\": kind,\n \"data-remove\": remove ? \"\" : undefined,\n \"data-disabled\": atEnd || props.disabled ? \"\" : undefined,\n \"data-pressed\": pressed.value === kind && !props.disabled ? \"\" : undefined,\n // Keeps the focus where it is, as a native stepper takes none.\n \"onMousedown\": (event: MouseEvent) => event.preventDefault(),\n \"onPointerdown\": (event: PointerEvent) => startPress(kind, event),\n \"onPointerup\": stopRepeat,\n \"onPointercancel\": stopRepeat,\n \"onLostpointercapture\": stopRepeat,\n \"onClick\": (event: MouseEvent) => handleClick(kind, event),\n }, [h(remove ? RemoveTrash : kind === \"decrement\" ? Minus : Plus, { class: s.Icon })])\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"id\": props.id,\n \"role\": \"spinbutton\",\n \"tabindex\": props.disabled ? -1 : 0,\n \"aria-valuenow\": value.value,\n \"aria-valuemin\": props.min,\n \"aria-valuemax\": props.max,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-keyshortcuts\": removes.value ? \"Delete\" : undefined,\n \"aria-disabled\": props.disabled || undefined,\n \"class\": [s.Stepper, attrs.class],\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"data-show-value\": props.showValue ? \"\" : undefined,\n \"onKeydown\": handleKeyDown,\n \"onFocus\": (event: FocusEvent) => emit(\"focus\", event),\n \"onBlur\": (event: FocusEvent) => emit(\"blur\", event),\n }, [\n segment(\"decrement\"),\n // The spin button already reads its value, so the shown one is not read again\n props.showValue\n ? h(\"span\", { \"class\": s.Value, \"aria-hidden\": \"true\" }, String(value.value))\n : h(\"span\", { \"class\": s.Separator, \"aria-hidden\": \"true\" }),\n segment(\"increment\"),\n props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value, disabled: props.disabled }) : null,\n ])\n },\n})\n\ntype StepperOwnProps = InstanceType<typeof StepperComponent>[\"$props\"]\n\n/** Stepper props. */\nexport type StepperProps = StepperOwnProps\n\n/**\n * Two segments that decrease and increase a number, as the iOS 26 stepper does. It shows no value of its own:\n * name it with `aria-label` or `aria-labelledby` and show the value beside it. Keyboard focus lands on the\n * stepper, a spin button: Up and Down step, Page Up and Page Down step ten times, Home and End go to the range ends.\n */\nexport const Stepper = StepperComponent\n"]}
|
|
@@ -41,4 +41,72 @@ export declare const KbdGroup: import("vue").DefineComponent<{}, () => import("v
|
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
43
|
export type KbdGroupProps = HTMLAttributes;
|
|
44
|
+
export type KbdModifierName = "mod" | "ctrl" | "alt" | "shift";
|
|
45
|
+
export type KbdPlatform = "apple" | "other";
|
|
46
|
+
/** Each modifier on an Apple keyboard (a symbol and its name) and on another one. `mod` is ⌘ there and Ctrl here. */
|
|
47
|
+
export declare const KBD_MODIFIERS: Record<KbdModifierName, Record<KbdPlatform, {
|
|
48
|
+
symbol: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}>>;
|
|
51
|
+
/** Whether the browser runs on a Mac, an iPhone or an iPad, whose keyboards print ⌘ and ⌥. */
|
|
52
|
+
export declare const isApplePlatform: () => boolean;
|
|
53
|
+
declare const KbdModifierComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
54
|
+
/** The modifier: `mod` is ⌘ on an Apple keyboard and Ctrl on another, as an app's shortcuts are. @default "mod" */
|
|
55
|
+
name: {
|
|
56
|
+
type: PropType<KbdModifierName>;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
/** The keyboard to print for; by default the one the browser runs on (Apple on the server). */
|
|
60
|
+
platform: {
|
|
61
|
+
type: PropType<KbdPlatform>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
/** Height and text size: `xs` 16px, `sm` 20px, `md` 24px. @default "sm" */
|
|
65
|
+
size: {
|
|
66
|
+
type: PropType<"xs" | "sm" | "md">;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
/** `soft` fills the key, `outline` draws its edge; both mix the text color. @default "soft" */
|
|
70
|
+
variant: {
|
|
71
|
+
type: PropType<"soft" | "outline">;
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
74
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
77
|
+
/** The modifier: `mod` is ⌘ on an Apple keyboard and Ctrl on another, as an app's shortcuts are. @default "mod" */
|
|
78
|
+
name: {
|
|
79
|
+
type: PropType<KbdModifierName>;
|
|
80
|
+
default: string;
|
|
81
|
+
};
|
|
82
|
+
/** The keyboard to print for; by default the one the browser runs on (Apple on the server). */
|
|
83
|
+
platform: {
|
|
84
|
+
type: PropType<KbdPlatform>;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
/** Height and text size: `xs` 16px, `sm` 20px, `md` 24px. @default "sm" */
|
|
88
|
+
size: {
|
|
89
|
+
type: PropType<"xs" | "sm" | "md">;
|
|
90
|
+
default: string;
|
|
91
|
+
};
|
|
92
|
+
/** `soft` fills the key, `outline` draws its edge; both mix the text color. @default "soft" */
|
|
93
|
+
variant: {
|
|
94
|
+
type: PropType<"soft" | "outline">;
|
|
95
|
+
default: string;
|
|
96
|
+
};
|
|
97
|
+
}>> & Readonly<{}>, {
|
|
98
|
+
name: KbdModifierName;
|
|
99
|
+
size: "xs" | "sm" | "md";
|
|
100
|
+
variant: "soft" | "outline";
|
|
101
|
+
platform: KbdPlatform;
|
|
102
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
103
|
+
type KbdModifierOwnProps = InstanceType<typeof KbdModifierComponent>["$props"];
|
|
104
|
+
/** KbdModifier props plus the native attributes that fall through to the <kbd>. */
|
|
105
|
+
export type KbdModifierProps = KbdModifierOwnProps & Omit<HTMLAttributes, keyof KbdModifierOwnProps>;
|
|
106
|
+
/** A modifier key as the reader's keyboard prints it: ⌘ on a Mac, Ctrl elsewhere (React `Kbd.Modifier`). */
|
|
107
|
+
export declare const KbdModifier: typeof KbdModifierComponent & {
|
|
108
|
+
new (): {
|
|
109
|
+
$props: KbdModifierProps;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
44
112
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Kbd, KbdGroup, type KbdGroupProps, type KbdProps } from "./Kbd.js";
|
|
1
|
+
export { KBD_MODIFIERS, Kbd, KbdGroup, KbdModifier, isApplePlatform, type KbdGroupProps, type KbdModifierName, type KbdModifierProps, type KbdPlatform, type KbdProps } from "./Kbd.js";
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { type HTMLAttributes, type PropType } from "vue";
|
|
2
|
+
export type ProgressColor = "primary" | "secondary" | "success" | "warning" | "caution" | "danger" | "info" | "discovery";
|
|
3
|
+
/** A part of a segmented bar: its share of `max`, its color, and the name it is read with. */
|
|
4
|
+
export type ProgressSegment = {
|
|
5
|
+
value: number;
|
|
6
|
+
/** @default "primary" */
|
|
7
|
+
color?: ProgressColor;
|
|
8
|
+
/** Read out with its share, such as "Paid 60%" */
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
/** The parts of a segmented bar, each clamped so their sum stays within `max`, and their sum. */
|
|
12
|
+
export declare const progressSegments: (segments: ProgressSegment[], max: number) => {
|
|
13
|
+
parts: {
|
|
14
|
+
value: number;
|
|
15
|
+
/** @default "primary" */
|
|
16
|
+
color?: ProgressColor;
|
|
17
|
+
/** Read out with its share, such as "Paid 60%" */
|
|
18
|
+
label?: string;
|
|
19
|
+
}[];
|
|
20
|
+
total: number;
|
|
21
|
+
};
|
|
2
22
|
declare const ProgressComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
23
|
/**
|
|
4
24
|
* Current progress value, between `0` and `max`.
|
|
@@ -15,6 +35,14 @@ declare const ProgressComponent: import("vue").DefineComponent<import("vue").Ext
|
|
|
15
35
|
};
|
|
16
36
|
/** Accessible value text for the current value. @default "<percentage>%" */
|
|
17
37
|
getValueLabel: PropType<(value: number, max: number) => string>;
|
|
38
|
+
/**
|
|
39
|
+
* Parts of one bar, side by side in their colors, such as paid, pending and due. The value is their sum; they
|
|
40
|
+
* take `value`'s place. A part's share is clamped so the bar never passes `max`.
|
|
41
|
+
*/
|
|
42
|
+
segments: {
|
|
43
|
+
type: PropType<ProgressSegment[]>;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
18
46
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
47
|
[key: string]: any;
|
|
20
48
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -33,9 +61,18 @@ declare const ProgressComponent: import("vue").DefineComponent<import("vue").Ext
|
|
|
33
61
|
};
|
|
34
62
|
/** Accessible value text for the current value. @default "<percentage>%" */
|
|
35
63
|
getValueLabel: PropType<(value: number, max: number) => string>;
|
|
64
|
+
/**
|
|
65
|
+
* Parts of one bar, side by side in their colors, such as paid, pending and due. The value is their sum; they
|
|
66
|
+
* take `value`'s place. A part's share is clamped so the bar never passes `max`.
|
|
67
|
+
*/
|
|
68
|
+
segments: {
|
|
69
|
+
type: PropType<ProgressSegment[]>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
36
72
|
}>> & Readonly<{}>, {
|
|
37
73
|
value: number | null;
|
|
38
74
|
max: number;
|
|
75
|
+
segments: ProgressSegment[];
|
|
39
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
77
|
type ProgressOwnProps = InstanceType<typeof ProgressComponent>["$props"];
|
|
41
78
|
/** Progress props plus the native <div> attributes that fall through to the root, as in React. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Progress, type ProgressProps } from "./Progress.js";
|
|
1
|
+
export { Progress, progressSegments, type ProgressColor, type ProgressProps, type ProgressSegment } from "./Progress.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type HTMLAttributes, type PropType } from "vue";
|
|
2
|
+
/** A written number's characters, each keyed by its place around the decimal separator, so a digit keeps its reel
|
|
3
|
+
* when the number grows or its fraction gets longer; digits are the locale's own (Arabic-Indic, Bengali…). */
|
|
4
|
+
export declare const rollingNumberParts: (value: number, locales?: Intl.LocalesArgument, format?: Intl.NumberFormatOptions) => {
|
|
5
|
+
text: string;
|
|
6
|
+
glyphs: string[];
|
|
7
|
+
characters: {
|
|
8
|
+
character: string;
|
|
9
|
+
digit: number | null;
|
|
10
|
+
key: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
declare const RollingNumberComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
/** The number shown. A new value rolls each changed digit to it. */
|
|
15
|
+
value: {
|
|
16
|
+
type: NumberConstructor;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
/** The locale the number is written in, as `Intl.NumberFormat` takes it; fixed, so the server writes it as the browser does. @default "en-US" */
|
|
20
|
+
locales: {
|
|
21
|
+
type: PropType<Intl.LocalesArgument>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
/** How the number is written: currency, percent, fraction digits, grouping, as `Intl.NumberFormat` takes it. */
|
|
25
|
+
format: {
|
|
26
|
+
type: PropType<Intl.NumberFormatOptions>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
+
/** The number shown. A new value rolls each changed digit to it. */
|
|
33
|
+
value: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
/** The locale the number is written in, as `Intl.NumberFormat` takes it; fixed, so the server writes it as the browser does. @default "en-US" */
|
|
38
|
+
locales: {
|
|
39
|
+
type: PropType<Intl.LocalesArgument>;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
/** How the number is written: currency, percent, fraction digits, grouping, as `Intl.NumberFormat` takes it. */
|
|
43
|
+
format: {
|
|
44
|
+
type: PropType<Intl.NumberFormatOptions>;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
}>> & Readonly<{}>, {
|
|
48
|
+
format: Intl.NumberFormatOptions;
|
|
49
|
+
locales: Intl.LocalesArgument;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
51
|
+
type RollingNumberOwnProps = InstanceType<typeof RollingNumberComponent>["$props"];
|
|
52
|
+
/** RollingNumber props plus the native attributes that fall through to the root <span>. */
|
|
53
|
+
export type RollingNumberProps = RollingNumberOwnProps & Omit<HTMLAttributes, keyof RollingNumberOwnProps>;
|
|
54
|
+
/**
|
|
55
|
+
* A number whose digits roll to a new value, as an odometer: for a total, a balance, a count or a KPI that changes
|
|
56
|
+
* while it is watched. It reads as the written number; its reels are hidden from a screen reader.
|
|
57
|
+
*/
|
|
58
|
+
export declare const RollingNumber: typeof RollingNumberComponent & {
|
|
59
|
+
new (): {
|
|
60
|
+
$props: RollingNumberProps;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RollingNumber, rollingNumberParts, type RollingNumberProps } from "./RollingNumber.js";
|
|
@@ -54,6 +54,14 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
|
|
|
54
54
|
type: BooleanConstructor;
|
|
55
55
|
default: boolean;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
59
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
60
|
+
*/
|
|
61
|
+
showValue: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
57
65
|
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
58
66
|
decrementLabel: {
|
|
59
67
|
type: StringConstructor;
|
|
@@ -141,6 +149,14 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
|
|
|
141
149
|
type: BooleanConstructor;
|
|
142
150
|
default: boolean;
|
|
143
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
154
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
155
|
+
*/
|
|
156
|
+
showValue: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
144
160
|
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
145
161
|
decrementLabel: {
|
|
146
162
|
type: StringConstructor;
|
|
@@ -185,6 +201,7 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
|
|
|
185
201
|
removeLabel: string;
|
|
186
202
|
step: number;
|
|
187
203
|
autoRepeat: boolean;
|
|
204
|
+
showValue: boolean;
|
|
188
205
|
decrementLabel: string;
|
|
189
206
|
incrementLabel: string;
|
|
190
207
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -244,6 +261,14 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
|
|
|
244
261
|
type: BooleanConstructor;
|
|
245
262
|
default: boolean;
|
|
246
263
|
};
|
|
264
|
+
/**
|
|
265
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
266
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
267
|
+
*/
|
|
268
|
+
showValue: {
|
|
269
|
+
type: BooleanConstructor;
|
|
270
|
+
default: boolean;
|
|
271
|
+
};
|
|
247
272
|
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
248
273
|
decrementLabel: {
|
|
249
274
|
type: StringConstructor;
|
|
@@ -331,6 +356,14 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
|
|
|
331
356
|
type: BooleanConstructor;
|
|
332
357
|
default: boolean;
|
|
333
358
|
};
|
|
359
|
+
/**
|
|
360
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
361
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
362
|
+
*/
|
|
363
|
+
showValue: {
|
|
364
|
+
type: BooleanConstructor;
|
|
365
|
+
default: boolean;
|
|
366
|
+
};
|
|
334
367
|
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
335
368
|
decrementLabel: {
|
|
336
369
|
type: StringConstructor;
|
|
@@ -375,6 +408,7 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
|
|
|
375
408
|
removeLabel: string;
|
|
376
409
|
step: number;
|
|
377
410
|
autoRepeat: boolean;
|
|
411
|
+
showValue: boolean;
|
|
378
412
|
decrementLabel: string;
|
|
379
413
|
incrementLabel: string;
|
|
380
414
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexui/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@maskito/core": "5.2.2",
|
|
78
78
|
"@maskito/kit": "5.2.2",
|
|
79
79
|
"@maskito/vue": "5.2.2",
|
|
80
|
-
"@plexui/styles": "^0.
|
|
80
|
+
"@plexui/styles": "^0.16.0",
|
|
81
81
|
"@tanstack/table-core": "8.21.3",
|
|
82
82
|
"@tanstack/vue-table": "8.21.3",
|
|
83
83
|
"@tiptap/core": "3.21.0",
|