@plexui/vue 0.37.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.
@@ -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;AAC5E,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,GAAG,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACtH,CAAC;CACF,CAAC,CAAA;AAOF,gFAAgF;AAChF,MAAM,CAAC,MAAM,GAAG,GAAG,YAAsE,CAAA;AAEzF,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QACrB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { defineComponent, h, 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"]}
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,GAAG,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACtH,CAAC;CACF,CAAC,CAAA;AAOF,gFAAgF;AAChF,MAAM,CAAC,MAAM,GAAG,GAAG,YAAsE,CAAA;AAEzF,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QACrB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAA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AAE,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,EAAqC,MAAM,UAAU,CAAA","sourcesContent":["export { Kbd, KbdGroup, type KbdGroupProps, type KbdProps } from \"./Kbd.js\"\n"]}
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,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;AAEvE,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;AAElG,MAAM,iBAAiB,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE;QACL;;;WAGG;QACH,KAAK,EAAE,EAAE,IAAI,EAAE,MAAiC,EAAE,OAAO,EAAE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AAG,EAAE,CACZ,CAAC,CAAC,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\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,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AC,GAAG,GAAG,CAAA;YAEnE,kDAAkD;YAClD,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAA;YACnD,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;YAEnE,OAAO,CAAC,CACN,YAAY,EACZ;gBACE,UAAU,EAAE,SAAS;gBACrB,GAAG,EAAE,OAAO;gBACZ,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS;gBAC9B,YAAY;gBACZ,KAAK,EAAE,CAAC,CAAC,IAAI;aACd,EACD;gBACE,OAAO,EAAE,GAAG,EAAE,CACZ,CAAC,CAAC,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,EAAsB,MAAM,eAAe,CAAA","sourcesContent":["export { Progress, type ProgressProps } from \"./Progress.js\"\n"]}
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,C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AAC,SAAS,EAAE,EAAE,CAAC,CAAC,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,2 @@
1
+ export { RollingNumber, rollingNumberParts } from "./RollingNumber.js";
2
+ //# sourceMappingURL=index.js.map
@@ -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"]}
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.37.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.15.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",