@trsys-tech/matrix-library 1.1.3 → 1.1.6

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/tabs.es.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsx as a } from "react/jsx-runtime";
1
+ import { jsx as m } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
- import { Root as f, Content as x, List as s, Trigger as i } from "@radix-ui/react-tabs";
3
+ import { Root as d, Content as x, List as i, Trigger as s } from "@radix-ui/react-tabs";
4
4
  import { cn as r } from "./utils.es.js";
5
- const u = f, d = o.forwardRef(({ className: t, ...e }, m) => /* @__PURE__ */ a(
6
- s,
5
+ const y = d, b = o.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ m(
6
+ i,
7
7
  {
8
- ref: m,
8
+ ref: a,
9
9
  className: r(
10
- "mtx-inline-flex mtx-h-8 mtx-w-full mtx-overflow-auto mtx-thin-scrollbar mtx-items-center mtx-justify-start mtx-bg-background mtx-p-0 mtx-text-muted-foreground md:mtx-[box-shadow:inset_0_-oklch(var(--gray-300))]",
10
+ "mtx-inline-flex mtx-h-8 mtx-w-full mtx-overflow-auto mtx-thin-scrollbar mtx-items-center mtx-justify-start mtx-bg-background mtx-p-0 mtx-text-muted-foreground md:mtx-[box-shadow:inset_0_-oklch(var(--gray-300))] data-[orientation=horizontal]:mtx-border-b data-[orientation=horizontal]:mtx-border-b-gray-300",
11
11
  t
12
12
  ),
13
13
  ...e
14
14
  }
15
15
  ));
16
- d.displayName = s.displayName;
17
- const b = o.forwardRef(({ className: t, hasAlert: e, ...m }, n) => /* @__PURE__ */ a(
18
- i,
16
+ b.displayName = i.displayName;
17
+ const f = o.forwardRef(({ className: t, hasAlert: e, ...a }, n) => /* @__PURE__ */ m(
18
+ s,
19
19
  {
20
20
  ref: n,
21
21
  className: r(
@@ -23,18 +23,18 @@ const b = o.forwardRef(({ className: t, hasAlert: e, ...m }, n) => /* @__PURE__
23
23
  t,
24
24
  e && "mtx-relative before:mtx-content-[''] before:mtx-block before:mtx-absolute before:mtx-top-0 before:mtx-right-0 before:mtx-z-10 before:mtx-bg-danger before:mtx-w-2 before:mtx-h-2 before:mtx-rounded"
25
25
  ),
26
- ...m
26
+ ...a
27
27
  }
28
28
  ));
29
- b.displayName = i.displayName;
29
+ f.displayName = s.displayName;
30
30
  const l = o.forwardRef(
31
- ({ className: t, ...e }, m) => /* @__PURE__ */ a(x, { ref: m, className: r("mtx-mt-2", t), ...e })
31
+ ({ className: t, ...e }, a) => /* @__PURE__ */ m(x, { ref: a, className: r("mtx-mt-2", t), ...e })
32
32
  );
33
33
  l.displayName = x.displayName;
34
34
  export {
35
- u as Tabs,
35
+ y as Tabs,
36
36
  l as TabsContent,
37
- d as TabsList,
38
- b as TabsTrigger
37
+ b as TabsList,
38
+ f as TabsTrigger
39
39
  };
40
40
  //# sourceMappingURL=tabs.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.es.js","sources":["../src/components/tabs/Tabs.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport {\r\n Content,\r\n List,\r\n Root,\r\n TabsContentProps,\r\n TabsListProps,\r\n TabsProps,\r\n TabsTriggerProps as RadixTabsTriggerProps,\r\n Trigger,\r\n} from \"@radix-ui/react-tabs\";\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst Tabs = Root;\r\n\r\nconst TabsList = React.forwardRef<React.ElementRef<typeof List>, React.ComponentPropsWithoutRef<typeof List>>(({ className, ...props }, ref) => (\r\n <List\r\n ref={ref}\r\n className={cn(\r\n \"mtx-inline-flex mtx-h-8 mtx-w-full mtx-overflow-auto mtx-thin-scrollbar mtx-items-center mtx-justify-start mtx-bg-background mtx-p-0 mtx-text-muted-foreground md:mtx-[box-shadow:inset_0_-oklch(var(--gray-300))]\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nTabsList.displayName = List.displayName;\r\n\r\ntype TabsTriggerProps = RadixTabsTriggerProps & {\r\n hasAlert?: boolean;\r\n};\r\n\r\nconst TabsTrigger = React.forwardRef<React.ElementRef<typeof Trigger>, TabsTriggerProps>(({ className, hasAlert, ...props }, ref) => (\r\n <Trigger\r\n ref={ref}\r\n className={cn(\r\n \"mtx-inline-flex mtx-items-center mtx-justify-center mtx-whitespace-nowrap mtx-h-full mtx-px-3 mtx-py-1 mtx-text-sm mtx-font-medium disabled:mtx-pointer-events-none disabled:mtx-opacity-50 data-[state=active]:mtx-text-foreground data-[state=active]:mtx-font-bold data-[state=active]:mtx-border-b-2 data-[state=active]:mtx-border-primary\",\r\n className,\r\n hasAlert &&\r\n \"mtx-relative before:mtx-content-[''] before:mtx-block before:mtx-absolute before:mtx-top-0 before:mtx-right-0 before:mtx-z-10 before:mtx-bg-danger before:mtx-w-2 before:mtx-h-2 before:mtx-rounded\",\r\n )}\r\n {...props}\r\n />\r\n));\r\nTabsTrigger.displayName = Trigger.displayName;\r\n\r\nconst TabsContent = React.forwardRef<React.ElementRef<typeof Content>, React.ComponentPropsWithoutRef<typeof Content>>(\r\n ({ className, ...props }, ref) => <Content ref={ref} className={cn(\"mtx-mt-2\", className)} {...props} />,\r\n);\r\nTabsContent.displayName = Content.displayName;\r\n\r\nexport {\r\n Tabs,\r\n TabsList,\r\n TabsTrigger,\r\n TabsContent,\r\n type TabsProps,\r\n type TabsListProps,\r\n type RadixTabsTriggerProps as TabsTriggerProps,\r\n type TabsContentProps,\r\n};\r\n"],"names":["Tabs","Root","TabsList","React","className","props","ref","jsx","List","cn","TabsTrigger","hasAlert","Trigger","TabsContent","Content"],"mappings":";;;;AAeA,MAAMA,IAAOC,GAEPC,IAAWC,EAAM,WAAuF,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACtI,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAS,cAAcM,EAAK;AAM5B,MAAME,IAAcP,EAAM,WAA+D,CAAC,EAAE,WAAAC,GAAW,UAAAO,GAAU,GAAGN,KAASC,MAC3H,gBAAAC;AAAA,EAACK;AAAA,EAAA;AAAA,IACC,KAAAN;AAAA,IACA,WAAWG;AAAA,MACT;AAAA,MACAL;AAAA,MACAO,KACE;AAAA,IAAA;AAAA,IAEH,GAAGN;AAAA,EAAA;AACN,CACD;AACDK,EAAY,cAAcE,EAAQ;AAElC,MAAMC,IAAcV,EAAM;AAAA,EACxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAAQ,gBAAAC,EAACO,GAAA,EAAQ,KAAAR,GAAU,WAAWG,EAAG,YAAYL,CAAS,GAAI,GAAGC,EAAA,CAAO;AACxG;AACAQ,EAAY,cAAcC,EAAQ;"}
1
+ {"version":3,"file":"tabs.es.js","sources":["../src/components/tabs/Tabs.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport {\r\n Content,\r\n List,\r\n Root,\r\n TabsContentProps,\r\n TabsListProps,\r\n TabsProps,\r\n TabsTriggerProps as RadixTabsTriggerProps,\r\n Trigger,\r\n} from \"@radix-ui/react-tabs\";\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst Tabs = Root;\r\n\r\nconst TabsList = React.forwardRef<React.ElementRef<typeof List>, React.ComponentPropsWithoutRef<typeof List>>(({ className, ...props }, ref) => (\r\n <List\r\n ref={ref}\r\n className={cn(\r\n \"mtx-inline-flex mtx-h-8 mtx-w-full mtx-overflow-auto mtx-thin-scrollbar mtx-items-center mtx-justify-start mtx-bg-background mtx-p-0 mtx-text-muted-foreground md:mtx-[box-shadow:inset_0_-oklch(var(--gray-300))] data-[orientation=horizontal]:mtx-border-b data-[orientation=horizontal]:mtx-border-b-gray-300\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nTabsList.displayName = List.displayName;\r\n\r\ntype TabsTriggerProps = RadixTabsTriggerProps & {\r\n hasAlert?: boolean;\r\n};\r\n\r\nconst TabsTrigger = React.forwardRef<React.ElementRef<typeof Trigger>, TabsTriggerProps>(({ className, hasAlert, ...props }, ref) => (\r\n <Trigger\r\n ref={ref}\r\n className={cn(\r\n \"mtx-inline-flex mtx-items-center mtx-justify-center mtx-whitespace-nowrap mtx-h-full mtx-px-3 mtx-py-1 mtx-text-sm mtx-font-medium disabled:mtx-pointer-events-none disabled:mtx-opacity-50 data-[state=active]:mtx-text-foreground data-[state=active]:mtx-font-bold data-[state=active]:mtx-border-b-2 data-[state=active]:mtx-border-primary\",\r\n className,\r\n hasAlert &&\r\n \"mtx-relative before:mtx-content-[''] before:mtx-block before:mtx-absolute before:mtx-top-0 before:mtx-right-0 before:mtx-z-10 before:mtx-bg-danger before:mtx-w-2 before:mtx-h-2 before:mtx-rounded\",\r\n )}\r\n {...props}\r\n />\r\n));\r\nTabsTrigger.displayName = Trigger.displayName;\r\n\r\nconst TabsContent = React.forwardRef<React.ElementRef<typeof Content>, React.ComponentPropsWithoutRef<typeof Content>>(\r\n ({ className, ...props }, ref) => <Content ref={ref} className={cn(\"mtx-mt-2\", className)} {...props} />,\r\n);\r\nTabsContent.displayName = Content.displayName;\r\n\r\nexport {\r\n Tabs,\r\n TabsList,\r\n TabsTrigger,\r\n TabsContent,\r\n type TabsProps,\r\n type TabsListProps,\r\n type RadixTabsTriggerProps as TabsTriggerProps,\r\n type TabsContentProps,\r\n};\r\n"],"names":["Tabs","Root","TabsList","React","className","props","ref","jsx","List","cn","TabsTrigger","hasAlert","Trigger","TabsContent","Content"],"mappings":";;;;AAeA,MAAMA,IAAOC,GAEPC,IAAWC,EAAM,WAAuF,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACtI,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAS,cAAcM,EAAK;AAM5B,MAAME,IAAcP,EAAM,WAA+D,CAAC,EAAE,WAAAC,GAAW,UAAAO,GAAU,GAAGN,KAASC,MAC3H,gBAAAC;AAAA,EAACK;AAAA,EAAA;AAAA,IACC,KAAAN;AAAA,IACA,WAAWG;AAAA,MACT;AAAA,MACAL;AAAA,MACAO,KACE;AAAA,IAAA;AAAA,IAEH,GAAGN;AAAA,EAAA;AACN,CACD;AACDK,EAAY,cAAcE,EAAQ;AAElC,MAAMC,IAAcV,EAAM;AAAA,EACxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAAQ,gBAAAC,EAACO,GAAA,EAAQ,KAAAR,GAAU,WAAWG,EAAG,YAAYL,CAAS,GAAI,GAAGC,EAAA,CAAO;AACxG;AACAQ,EAAY,cAAcC,EAAQ;"}
@@ -1,182 +1,328 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import f from "react";
3
- import { cn as n } from "./utils.es.js";
4
- function b({ item: l, color: x }) {
5
- const r = l.status ?? "pending";
6
- return /* @__PURE__ */ o("span", { className: "mtx-block mtx-size-5", "data-status": r, style: { color: x }, children: [
7
- /* @__PURE__ */ o(
8
- "svg",
1
+ import { jsxs as a, jsx as e, Fragment as B } from "react/jsx-runtime";
2
+ import k, { useMemo as b } from "react";
3
+ import { cn as f } from "./utils.es.js";
4
+ import { Skeleton as r } from "./skeleton.es.js";
5
+ const $ = ({ item: m, color: d, size: x }) => {
6
+ const s = m.status ?? "pending";
7
+ return /* @__PURE__ */ a(
8
+ "span",
9
+ {
10
+ className: "mtx-block mtx-size-5 data-[size=sm]:mtx-size-4 data-[size=lg]:mtx-size-6",
11
+ "data-size": x,
12
+ "data-status": s,
13
+ style: { color: d },
14
+ children: [
15
+ /* @__PURE__ */ a(
16
+ "svg",
17
+ {
18
+ viewBox: "0 0 24 24",
19
+ "aria-hidden": "true",
20
+ focusable: "false",
21
+ className: "mtx-block mtx-size-full mtx-fill-none mtx-stroke-current mtx-stroke-[1.25] mtx-stroke-linecap-round mtx-stroke-linejoin-round",
22
+ children: [
23
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10.5", className: "mtx-fill-background" }),
24
+ s === "completed" && /* @__PURE__ */ e("path", { d: "m7 12 3 3 7-7" }),
25
+ s === "error" && /* @__PURE__ */ e("path", { d: "m8 8 8 8m0-8-8 8" }),
26
+ s === "active" && /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6", fill: "currentColor", stroke: "none" })
27
+ ]
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e("span", { className: "mtx-sr-only", children: m.statusLabel ?? s })
31
+ ]
32
+ }
33
+ );
34
+ }, D = ({ items: m, visibleBranches: d, superRow: x, markerRow: s, size: g }) => {
35
+ const z = b(() => g === "sm" ? "M1" : g === "lg" ? "M3" : "M2", [g]);
36
+ return /* @__PURE__ */ a(B, { children: [
37
+ m.map((n, i) => /* @__PURE__ */ a(
38
+ "li",
9
39
  {
10
- viewBox: "0 0 24 24",
40
+ className: "mtx-relative mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-rows-[subgrid]",
41
+ style: { gridColumn: i + 1 },
11
42
  "aria-hidden": "true",
12
- focusable: "false",
13
- className: "mtx-block mtx-size-full mtx-fill-none mtx-stroke-current mtx-stroke-[1.25] mtx-stroke-linecap-round mtx-stroke-linejoin-round",
43
+ "data-slot": "timeline-skeleton-item",
14
44
  children: [
15
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10.5", className: "mtx-fill-background" }),
16
- r === "completed" && /* @__PURE__ */ e("path", { d: "m7 12 3 3 7-7" }),
17
- r === "error" && /* @__PURE__ */ e("path", { d: "m8 8 8 8m0-8-8 8" }),
18
- r === "active" && /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6", fill: "currentColor", stroke: "none" })
45
+ /* @__PURE__ */ a("div", { className: "mtx-min-h-8 mtx-self-end mtx-pb-2 mtx-pt-1 mtx-pr-3", style: { gridRow: x }, children: [
46
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-3 mtx-w-14" }),
47
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-16 mtx-mt-1" })
48
+ ] }),
49
+ i > 0 && /* @__PURE__ */ e(
50
+ "span",
51
+ {
52
+ className: "mtx-absolute mtx-top-2.5 group-data-[size=sm]:mtx-top-2 group-data-[size=lg]:mtx-top-3 mtx-w-[calc(100%-20px)] mtx-left-[calc(-100%+20px)] group-data-[size=sm]:mtx-w-[calc(100%-16px)] group-data-[size=sm]:mtx-left-[calc(-100%+16px)] group-data-[size=lg]:mtx-w-[calc(100%-24px)] group-data-[size=lg]:mtx-left-[calc(-100%+24px)] mtx-z-10 mtx-h-0.5 mtx-bg-primary/10 mtx-animate-pulse",
53
+ style: { gridRow: s }
54
+ }
55
+ ),
56
+ /* @__PURE__ */ e(
57
+ r,
58
+ {
59
+ className: "mtx-z-20 mtx-rounded-full mtx-size-5 group-data-[size=sm]:mtx-size-4 group-data-[size=lg]:mtx-size-6",
60
+ style: { gridRow: s },
61
+ "aria-hidden": "true"
62
+ }
63
+ ),
64
+ /* @__PURE__ */ a("div", { className: "mtx-pt-1 mtx-pr-3", style: { gridRow: s + 1 }, children: [
65
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-16" }),
66
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-12 mtx-mt-1" })
67
+ ] }),
68
+ /* @__PURE__ */ e("div", { className: "mtx-pr-3 mtx-pt-5", style: { gridRow: s + 2 }, children: /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-16" }) })
19
69
  ]
20
- }
21
- ),
22
- /* @__PURE__ */ e("span", { className: "mtx-sr-only", children: l.statusLabel ?? r })
23
- ] });
24
- }
25
- const $ = f.forwardRef(
26
- ({ items: l, branches: x = [], title: r, activeColor: h, completedColor: w, errorColor: c, inactiveColor: N, minItemWidth: u = 112, className: k, style: y, ...R }, z) => {
27
- const p = f.useId(), d = x.flatMap((t) => {
28
- const s = l.findIndex((m) => m.id === t.from);
29
- return s >= 0 && s < l.length - 1 ? [{ branch: t, index: s }] : [];
30
- }), v = d.length * 2 + 1, i = v + 1, g = (t) => t.color ?? `var(--timeline-${t.status ?? "pending"})`, T = {
31
- "--timeline-active": h ?? "oklch(var(--mtx-primary))",
32
- "--timeline-completed": w ?? "oklch(var(--mtx-success))",
33
- "--timeline-error": c ?? "oklch(var(--mtx-danger))",
34
- "--timeline-pending": N ?? "oklch(var(--mtx-gray-400))",
35
- ...y
36
- };
37
- return /* @__PURE__ */ o("div", { ...R, ref: z, className: n("mtx-text-foreground mtx-text-xs", k), style: T, children: [
38
- r != null && /* @__PURE__ */ e("div", { id: p, className: "mtx-mb-4 mtx-text-sm mtx-font-bold", children: r }),
39
- /* @__PURE__ */ e(
40
- "div",
41
- {
42
- className: "mtx-overflow-x-auto mtx-p-0.5 focus-visible:mtx-outline-2 focus-visible:mtx-outline-offset-2 focus-visible:mtx-outline-[var(--timeline-active)]",
43
- role: "region",
44
- "aria-label": "Timeline",
45
- tabIndex: 0,
46
- children: /* @__PURE__ */ o(
47
- "ol",
70
+ },
71
+ `skeleton-item-${n.id}`
72
+ )),
73
+ d.map(({ branch: n, index: i }, u) => /* @__PURE__ */ a(
74
+ "li",
75
+ {
76
+ className: "mtx-pointer-events-none mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-cols-[subgrid] mtx-grid-rows-[subgrid]",
77
+ style: { gridColumn: `${i + 1} / -1` },
78
+ "aria-hidden": "true",
79
+ "data-slot": "timeline-skeleton-branch",
80
+ children: [
81
+ /* @__PURE__ */ a("div", { className: "mtx-col-[-2_/_-1] mtx-self-end mtx-pb-2", style: { gridRow: u * 2 + 1 }, children: [
82
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-3 mtx-w-14" }),
83
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-16 mtx-mt-1" }),
84
+ /* @__PURE__ */ e(r, { "aria-hidden": "true", className: "mtx-h-2 mtx-w-16 mtx-mt-1" })
85
+ ] }),
86
+ /* @__PURE__ */ e(
87
+ "div",
48
88
  {
49
- className: "mtx-m-0 mtx-grid mtx-list-none mtx-isolate mtx-p-0",
50
- "aria-labelledby": r != null ? p : void 0,
51
- "aria-label": r == null ? "Timeline steps" : void 0,
89
+ className: "mtx-relative mtx-col-[1_/_-1] mtx-mb-[9px] group-data-[size=sm]:mtx-mb-[7px] group-data-[size=lg]:mtx-mb-[11px] mtx-ml-3 mtx-mt-2.5 group-data-[size=sm]:mtx-mt-2 group-data-[size=lg]:mtx-mt-3 mtx-overflow-visible mtx-fill-none mtx-stroke-2 mtx-stroke-current mtx-z-[-1]",
52
90
  style: {
53
- gridTemplateColumns: `repeat(${Math.max(1, l.length)}, minmax(0, 1fr))`,
54
- gridTemplateRows: `${"auto 24px ".repeat(d.length)}auto 24px auto auto`,
55
- minWidth: l.length * (Number.isFinite(u) ? Math.max(48, u) : 112)
91
+ gridRow: `${u * 2 + 2} / ${s + 1}`,
92
+ width: `calc(100% - 100% / ${m.length - i})`,
93
+ color: "oklch(var(--mtx-primary) / 0.1)"
56
94
  },
57
- children: [
58
- l.map((t, s) => {
59
- const m = l[s - 1], a = t.connectorColor === !1 ? void 0 : t.connectorColor ?? (m?.status === "completed" && t.status !== "pending" && t.status !== void 0 ? g(m) : void 0);
60
- return /* @__PURE__ */ o(
61
- "li",
62
- {
63
- className: "mtx-relative mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-rows-[subgrid] ",
64
- style: { gridColumn: s + 1 },
65
- "aria-current": t.status === "active" ? "step" : void 0,
66
- children: [
67
- /* @__PURE__ */ o(
68
- "div",
69
- {
70
- className: "mtx-min-h-8 mtx-break-words mtx-self-end mtx-pb-2 mtx-pr-3 mtx-text-ss mtx-leading-3 mtx-text-muted-foreground empty:mtx-p-0",
71
- style: { gridRow: v },
72
- children: [
73
- t.superTitle != null && /* @__PURE__ */ e("div", { children: t.superTitle }),
74
- t.superSubtitle != null && /* @__PURE__ */ e("div", { className: "mtx-font-semibold", children: t.superSubtitle })
75
- ]
76
- }
77
- ),
78
- s > 0 && /* @__PURE__ */ e(
79
- "span",
80
- {
81
- "aria-hidden": "true",
82
- className: "mtx-absolute mtx-top-2.5 mtx-left-[calc(-100%+12px)] mtx-z-10 mtx-h-0.5 mtx-w-full mtx-bg-[var(--timeline-pending)]",
83
- style: { gridRow: i, backgroundColor: a }
84
- }
85
- ),
86
- /* @__PURE__ */ e("div", { className: "mtx-z-20 mtx-size-5", style: { gridRow: i }, children: /* @__PURE__ */ e(b, { item: t, color: g(t) }) }),
87
- /* @__PURE__ */ o("div", { className: "mtx-break-words mtx-pt-2.5 mtx-pr-3 mtx-leading-[1.4]", style: { gridRow: i + 1 }, children: [
88
- /* @__PURE__ */ e("div", { className: n("mtx-font-medium", (t.status ?? "pending") === "pending" && "mtx-text-text-400"), children: t.label }),
89
- t.subData != null && /* @__PURE__ */ e("div", { className: "mtx-mt-0.5 mtx-text-ss", children: t.subData })
90
- ] }),
91
- /* @__PURE__ */ e(
92
- "div",
93
- {
94
- className: "mtx-break-words mtx-pr-3 mtx-pt-5 mtx-text-ss mtx-font-medium mtx-text-muted-foreground empty:mtx-p-0",
95
- style: { gridRow: i + 2 },
96
- children: t.footer
97
- }
98
- )
99
- ]
100
- },
101
- t.id
102
- );
103
- }),
104
- d.map(({ branch: t, index: s }, m) => {
105
- const a = t.active ? t.activeColor ?? t.color ?? c ?? "var(--timeline-error)" : "var(--timeline-pending)";
106
- return /* @__PURE__ */ o(
107
- "li",
108
- {
109
- className: n(
110
- "mtx-pointer-events-none mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-cols-[subgrid] mtx-grid-rows-[subgrid]",
111
- t.active && "mtx-z-10"
112
- ),
113
- "data-active": t.active || void 0,
114
- style: { gridColumn: `${s + 1} / -1` },
115
- "aria-current": t.status === "active" ? "step" : void 0,
116
- children: [
117
- /* @__PURE__ */ o("span", { className: "mtx-sr-only", children: [
118
- "Branch from ",
119
- l[s].label,
120
- ": "
121
- ] }),
122
- /* @__PURE__ */ o(
123
- "div",
124
- {
125
- className: "mtx-pointer-events-auto mtx-col-[-2_/_-1] mtx-self-end mtx-break-words mtx-pb-2",
126
- style: { gridRow: m * 2 + 1, color: t.active ? a : void 0 },
127
- children: [
128
- t.superTitle != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-text-ss mtx-text-muted-foreground", children: t.superTitle }),
129
- t.superSubtitle != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-pb-2 mtx-pr-3 mtx-text-ss mtx-font-semibold mtx-text-muted-foreground", children: t.superSubtitle }),
130
- /* @__PURE__ */ e("div", { className: n("mtx-font-medium", (t.status ?? "pending") === "pending" && "mtx-text-text-400"), children: t.label }),
131
- t.subData != null && /* @__PURE__ */ e("div", { className: "mtx-mt-0.5 mtx-text-ss", children: t.subData }),
132
- t.footer != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-pr-3 mtx-pt-1 mtx-text-ss mtx-font-bold mtx-text-muted-foreground", children: t.footer })
133
- ]
134
- }
135
- ),
136
- /* @__PURE__ */ e(
137
- "div",
138
- {
139
- className: "mtx-relative mtx-col-[1_/_-1] mtx-mb-[13px] mtx-ml-3 mtx-mt-[11px] mtx-overflow-visible mtx-fill-none mtx-stroke-2 mtx-stroke-current mtx-z-[-1]",
140
- "aria-hidden": "true",
141
- style: {
142
- gridRow: `${m * 2 + 2} / ${i + 1}`,
143
- width: `calc(100% - 100% / ${l.length - s})`,
144
- color: a
145
- },
146
- children: /* @__PURE__ */ e(
147
- "svg",
95
+ children: /* @__PURE__ */ e("svg", { focusable: "false", viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "mtx-absolute mtx-size-full mtx-overflow-visible", children: /* @__PURE__ */ e(
96
+ "path",
97
+ {
98
+ d: `${z} 100 H${45 / (m.length - i - 1)} L${80 / (m.length - i - 1)} 0 H97`,
99
+ vectorEffect: "non-scaling-stroke"
100
+ }
101
+ ) })
102
+ }
103
+ ),
104
+ /* @__PURE__ */ e(
105
+ r,
106
+ {
107
+ className: "mtx-col-[-2_/_-1] mtx-z-[2] mtx-rounded-full mtx-size-5 group-data-[size=sm]:mtx-size-4 group-data-[size=lg]:mtx-size-6",
108
+ style: { gridRow: u * 2 + 2 },
109
+ "aria-hidden": "true"
110
+ }
111
+ )
112
+ ]
113
+ },
114
+ `skeleton-branch-${n.id}`
115
+ ))
116
+ ] });
117
+ }, H = k.forwardRef(
118
+ ({
119
+ items: m,
120
+ branches: d = [],
121
+ title: x,
122
+ loading: s = !1,
123
+ activeColor: g,
124
+ completedColor: z,
125
+ errorColor: n,
126
+ inactiveColor: i,
127
+ minItemWidth: u = 112,
128
+ size: c = "md",
129
+ className: R,
130
+ style: _,
131
+ ...T
132
+ }, C) => {
133
+ const N = k.useId(), v = b(
134
+ () => d.flatMap((t) => {
135
+ const l = m.findIndex((o) => o.id === t.from);
136
+ return l >= 0 && l < m.length - 1 ? [{ branch: t, index: l }] : [];
137
+ }),
138
+ [d, m]
139
+ ), w = v.length * 2 + 1, p = w + 1, y = (t) => t.color ?? `var(--timeline-${t.status ?? "pending"})`, M = {
140
+ "--timeline-active": g ?? "oklch(var(--mtx-primary))",
141
+ "--timeline-completed": z ?? "oklch(var(--mtx-success))",
142
+ "--timeline-error": n ?? "oklch(var(--mtx-danger))",
143
+ "--timeline-pending": i ?? "oklch(var(--mtx-gray-400))",
144
+ ..._
145
+ }, S = b(() => {
146
+ const t = v.length;
147
+ switch (c) {
148
+ case "sm":
149
+ return `${"auto 16px ".repeat(t)}auto 16px auto auto`;
150
+ case "lg":
151
+ return `${"auto 24px ".repeat(t)}auto 24px auto auto`;
152
+ default:
153
+ return `${"auto 20px ".repeat(t)}auto 20px auto auto`;
154
+ }
155
+ }, [c, v.length]);
156
+ return /* @__PURE__ */ a(
157
+ "div",
158
+ {
159
+ ...T,
160
+ ref: C,
161
+ className: f("mtx-group mtx-text-foreground mtx-text-xs data-[size=sm]:mtx-text-ss data-[size=lg]:mtx-text-sm", R),
162
+ "data-size": c,
163
+ style: M,
164
+ "aria-busy": s || void 0,
165
+ children: [
166
+ x != null && /* @__PURE__ */ e("div", { id: N, className: "mtx-mb-4 mtx-text-sm group-data-[size=sm]:mtx-text-xs group-data-[size=lg]:mtx-text-lg mtx-font-bold", children: x }),
167
+ /* @__PURE__ */ e(
168
+ "div",
169
+ {
170
+ className: "mtx-overflow-x-auto mtx-p-0.5 focus-visible:mtx-outline-2 focus-visible:mtx-outline-offset-2 focus-visible:mtx-outline-[var(--timeline-active)]",
171
+ role: "region",
172
+ "aria-label": "Timeline",
173
+ tabIndex: 0,
174
+ children: /* @__PURE__ */ a(
175
+ "ol",
176
+ {
177
+ className: "mtx-m-0 mtx-grid mtx-list-none mtx-isolate mtx-p-0",
178
+ "aria-labelledby": x != null ? N : void 0,
179
+ "aria-label": x == null ? "Timeline steps" : void 0,
180
+ "data-loading": s || void 0,
181
+ style: {
182
+ gridTemplateColumns: `repeat(${Math.max(1, m.length)}, minmax(0, 1fr))`,
183
+ gridTemplateRows: S,
184
+ minWidth: m.length * (Number.isFinite(u) ? Math.max(48, u) : 112)
185
+ },
186
+ children: [
187
+ s && /* @__PURE__ */ e(D, { items: m, visibleBranches: v, superRow: w, markerRow: p, size: c }),
188
+ !s && m.map((t, l) => {
189
+ const o = m[l - 1], h = t.connectorColor === !1 ? void 0 : t.connectorColor ?? (o?.status === "completed" && t.status !== "pending" && t.status !== void 0 ? y(o) : void 0);
190
+ return /* @__PURE__ */ a(
191
+ "li",
192
+ {
193
+ className: "mtx-relative mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-rows-[subgrid] ",
194
+ style: { gridColumn: l + 1 },
195
+ "aria-current": t.status === "active" ? "step" : void 0,
196
+ children: [
197
+ /* @__PURE__ */ a(
198
+ "div",
148
199
  {
149
- focusable: "false",
150
- viewBox: "0 0 100 100",
151
- preserveAspectRatio: "none",
152
- className: "mtx-absolute mtx-size-full mtx-overflow-visible",
200
+ className: "mtx-min-h-8 mtx-break-words mtx-self-end mtx-pb-2 mtx-mt-1 mtx-pr-3 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs mtx-text-muted-foreground empty:mtx-p-0",
201
+ style: { gridRow: w },
202
+ children: [
203
+ t.superTitle != null && /* @__PURE__ */ e("div", { children: t.superTitle }),
204
+ t.superSubtitle != null && /* @__PURE__ */ e("div", { className: "mtx-font-semibold", children: t.superSubtitle })
205
+ ]
206
+ }
207
+ ),
208
+ l > 0 && /* @__PURE__ */ e(
209
+ "span",
210
+ {
211
+ "aria-hidden": "true",
212
+ className: "mtx-absolute mtx-top-2.5 group-data-[size=sm]:mtx-top-2 group-data-[size=lg]:mtx-top-3 mtx-left-[calc(-100%+12px)] mtx-z-10 mtx-h-0.5 mtx-w-full mtx-bg-[var(--timeline-pending)]",
213
+ style: { gridRow: p, backgroundColor: h }
214
+ }
215
+ ),
216
+ /* @__PURE__ */ e(
217
+ "div",
218
+ {
219
+ className: "mtx-z-20 mtx-size-5 group-data-[size=sm]:mtx-size-4 group-data-[size=lg]:mtx-size-6",
220
+ style: { gridRow: p },
221
+ children: /* @__PURE__ */ e($, { item: t, color: y(t), size: c })
222
+ }
223
+ ),
224
+ /* @__PURE__ */ a("div", { className: "mtx-break-words mtx-pt-1 mtx-pr-3 mtx-leading-[1.4]", style: { gridRow: p + 1 }, children: [
225
+ /* @__PURE__ */ e("div", { className: f("mtx-font-medium", (t.status ?? "pending") === "pending" && "mtx-text-text-400"), children: t.label }),
226
+ t.subData != null && /* @__PURE__ */ e("div", { className: "mtx-mt-0.5 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs", children: t.subData })
227
+ ] }),
228
+ /* @__PURE__ */ e(
229
+ "div",
230
+ {
231
+ className: "mtx-break-words mtx-pr-3 mtx-pt-5 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs mtx-font-medium mtx-text-muted-foreground empty:mtx-p-0",
232
+ style: { gridRow: p + 2 },
233
+ children: t.footer
234
+ }
235
+ )
236
+ ]
237
+ },
238
+ t.id
239
+ );
240
+ }),
241
+ !s && v.map(({ branch: t, index: l }, o) => {
242
+ const h = t.active ? t.activeColor ?? t.color ?? n ?? "var(--timeline-error)" : "var(--timeline-pending)";
243
+ return /* @__PURE__ */ a(
244
+ "li",
245
+ {
246
+ className: f(
247
+ "mtx-pointer-events-none mtx-grid mtx-min-w-0 mtx-row-span-full mtx-grid-cols-[subgrid] mtx-grid-rows-[subgrid]",
248
+ t.active && "mtx-z-10"
249
+ ),
250
+ "data-active": t.active || void 0,
251
+ style: { gridColumn: `${l + 1} / -1` },
252
+ "aria-current": t.status === "active" ? "step" : void 0,
253
+ children: [
254
+ /* @__PURE__ */ a("span", { className: "mtx-sr-only", children: [
255
+ "Branch from ",
256
+ m[l].label,
257
+ ": "
258
+ ] }),
259
+ /* @__PURE__ */ a(
260
+ "div",
261
+ {
262
+ className: "mtx-pointer-events-auto mtx-col-[-2_/_-1] mtx-self-end mtx-break-words mtx-pb-2",
263
+ style: { gridRow: o * 2 + 1, color: t.active ? h : void 0 },
264
+ children: [
265
+ t.superTitle != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs mtx-text-muted-foreground", children: t.superTitle }),
266
+ t.superSubtitle != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-pb-2 mtx-pr-3 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs mtx-font-semibold mtx-text-muted-foreground", children: t.superSubtitle }),
267
+ /* @__PURE__ */ e("div", { className: f("mtx-font-medium", (t.status ?? "pending") === "pending" && "mtx-text-text-400"), children: t.label }),
268
+ t.subData != null && /* @__PURE__ */ e("div", { className: "mtx-mt-0.5 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs", children: t.subData }),
269
+ t.footer != null && /* @__PURE__ */ e("div", { className: "mtx-break-words mtx-pr-3 mtx-pt-1 mtx-text-ss group-data-[size=sm]:mtx-text-[0.5rem] group-data-[size=sm]:mtx-leading-3 group-data-[size=lg]:mtx-text-xs mtx-font-bold mtx-text-muted-foreground", children: t.footer })
270
+ ]
271
+ }
272
+ ),
273
+ /* @__PURE__ */ e(
274
+ "div",
275
+ {
276
+ className: "mtx-relative mtx-col-[1_/_-1] mtx-mb-[9px] group-data-[size=sm]:mtx-mb-[7px] group-data-[size=lg]:mtx-mb-[11px] mtx-ml-3 mtx-mt-2.5 group-data-[size=sm]:mtx-mt-2 group-data-[size=lg]:mtx-mt-3 mtx-overflow-visible mtx-fill-none mtx-stroke-2 mtx-stroke-current mtx-z-[-1]",
277
+ "aria-hidden": "true",
278
+ style: {
279
+ gridRow: `${o * 2 + 2} / ${p + 1}`,
280
+ width: `calc(100% - 100% / ${m.length - l})`,
281
+ color: h
282
+ },
153
283
  children: /* @__PURE__ */ e(
154
- "path",
284
+ "svg",
155
285
  {
156
- d: `M0 100 H${45 / (l.length - s - 1)} L${80 / (l.length - s - 1)} 0 H100`,
157
- vectorEffect: "non-scaling-stroke"
286
+ focusable: "false",
287
+ viewBox: "0 0 100 100",
288
+ preserveAspectRatio: "none",
289
+ className: "mtx-absolute mtx-size-full mtx-overflow-visible",
290
+ children: /* @__PURE__ */ e(
291
+ "path",
292
+ {
293
+ d: `M0 100 H${45 / (m.length - l - 1)} L${80 / (m.length - l - 1)} 0 H100`,
294
+ vectorEffect: "non-scaling-stroke"
295
+ }
296
+ )
158
297
  }
159
298
  )
160
299
  }
300
+ ),
301
+ /* @__PURE__ */ e(
302
+ "div",
303
+ {
304
+ className: "mtx-col-[-2_/_-1] mtx-z-[2] mtx-size-5 group-data-[size=sm]:mtx-size-4 group-data-[size=lg]:mtx-size-6",
305
+ style: { gridRow: o * 2 + 2 },
306
+ children: /* @__PURE__ */ e($, { item: t, color: h, size: c })
307
+ }
161
308
  )
162
- }
163
- ),
164
- /* @__PURE__ */ e("div", { className: "mtx-col-[-2_/_-1] mtx-z-[2] mtx-size-5", style: { gridRow: m * 2 + 2 }, children: /* @__PURE__ */ e(b, { item: t, color: a }) })
165
- ]
166
- },
167
- `branch-${t.id}`
168
- );
169
- })
170
- ]
309
+ ]
310
+ },
311
+ `branch-${t.id}`
312
+ );
313
+ })
314
+ ]
315
+ }
316
+ )
171
317
  }
172
318
  )
173
- }
174
- )
175
- ] });
319
+ ]
320
+ }
321
+ );
176
322
  }
177
323
  );
178
- $.displayName = "Timeline";
324
+ H.displayName = "Timeline";
179
325
  export {
180
- $ as Timeline
326
+ H as Timeline
181
327
  };
182
328
  //# sourceMappingURL=timeline.es.js.map