@timmbr/ui 1.17.0 → 1.17.2

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,13 +1,10 @@
1
1
  import * as React from 'react';
2
- import type { ProgressStepItem, StepperProps } from '../Stepper.types';
2
+ import type { StepperProps } from '../Stepper.types';
3
3
  export interface ProgressStepperProps {
4
- steps: ProgressStepItem[];
4
+ steps: StepperProps['steps'];
5
5
  current: number;
6
6
  status?: StepperProps['status'];
7
7
  className?: string;
8
8
  }
9
- export declare function ProgressStepper({ steps, current, status, className }: ProgressStepperProps): React.JSX.Element;
10
- export declare namespace ProgressStepper {
11
- var displayName: string;
12
- }
9
+ export declare const ProgressStepper: React.ForwardRefExoticComponent<ProgressStepperProps & React.RefAttributes<HTMLOListElement>>;
13
10
  //# sourceMappingURL=ProgressStepper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/subcomponents/ProgressStepper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,gBAAgB,EAAa,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElF,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAkB,EAAE,SAAS,EAAE,EAAE,oBAAoB,qBAgEtG;yBAhEe,eAAe"}
1
+ {"version":3,"file":"ProgressStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/subcomponents/ProgressStepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAehE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,eAAe,+FAyE3B,CAAC"}
@@ -1,5 +1,5 @@
1
- "use client";
2
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
3
  import { cn } from '@timmbr/utils';
4
4
  import { Check, X } from '@timmbr/icons';
5
5
  import { stepProgressConnectorVariants, stepProgressIndicatorVariants, stepProgressBadgeVariants } from '../Stepper.styles.js';
@@ -9,24 +9,24 @@ function stateOf(index, current, status) {
9
9
  if (index === current) return status === "error" ? "error" : "current";
10
10
  return "upcoming";
11
11
  }
12
- function resolveBadgeText(step, state) {
13
- if (step.statusLabel) return step.statusLabel;
14
- if (state === "complete") return "Completed";
15
- if (state === "current") return "In Progress";
16
- if (state === "error") return "Failed";
17
- return "Pending";
18
- }
19
- function ProgressStepper({ steps, current, status = "default", className }) {
20
- return /* @__PURE__ */ jsx(
12
+ const DEFAULT_BADGE_LABELS = {
13
+ complete: "Completed",
14
+ current: "In Progress",
15
+ error: "Failed",
16
+ upcoming: "Pending"
17
+ };
18
+ const ProgressStepper = React.forwardRef(
19
+ ({ steps, current, status = "default", className }, ref) => /* @__PURE__ */ jsx(
21
20
  "ol",
22
21
  {
22
+ ref,
23
23
  "data-slot": "stepper",
24
24
  "data-variant": "progress",
25
- "data-orientation": "horizontal",
26
25
  className: cn("flex items-start font-sans", className),
27
26
  children: steps.map((step, index) => {
28
27
  const state = stateOf(index, current, status);
29
28
  const isLast = index === steps.length - 1;
29
+ const badgeLabel = step.statusLabel ?? DEFAULT_BADGE_LABELS[state];
30
30
  return /* @__PURE__ */ jsxs(
31
31
  "li",
32
32
  {
@@ -38,31 +38,31 @@ function ProgressStepper({ steps, current, status = "default", className }) {
38
38
  "span",
39
39
  {
40
40
  "aria-hidden": "true",
41
- className: stepProgressConnectorVariants({ state })
41
+ className: cn(stepProgressConnectorVariants({ state }), "top-[42px]")
42
42
  }
43
43
  ),
44
- /* @__PURE__ */ jsx("span", { className: stepProgressIndicatorVariants({ state }), "aria-hidden": "true", children: state === "complete" ? /* @__PURE__ */ jsx(Check, { size: 16, strokeWidth: 2.5 }) : state === "error" ? /* @__PURE__ */ jsx(X, { size: 16, strokeWidth: 2.5 }) : step.icon ?? index + 1 }),
45
- /* @__PURE__ */ jsxs("span", { className: "mt-3 min-w-0 px-1", children: [
46
- /* @__PURE__ */ jsxs("span", { className: "block text-caption font-medium uppercase tracking-wide text-muted-foreground", children: [
47
- "Step ",
48
- index + 1
49
- ] }),
44
+ /* @__PURE__ */ jsxs("span", { className: "mb-1.5 block text-caption-lg font-medium uppercase tracking-wider text-muted-foreground", children: [
45
+ "Step ",
46
+ index + 1
47
+ ] }),
48
+ /* @__PURE__ */ jsx("span", { className: stepProgressIndicatorVariants({ state }), "aria-hidden": "true", children: state === "complete" ? /* @__PURE__ */ jsx(Check, { size: 18, strokeWidth: 2.5 }) : state === "error" ? /* @__PURE__ */ jsx(X, { size: 18, strokeWidth: 2.5 }) : step.icon ? step.icon : /* @__PURE__ */ jsx("span", { className: "text-body-2 font-semibold tabular-nums", children: index + 1 }) }),
49
+ /* @__PURE__ */ jsxs("span", { className: "mt-2.5 min-w-0 px-1", children: [
50
50
  /* @__PURE__ */ jsxs(
51
51
  "span",
52
52
  {
53
53
  className: cn(
54
- "mt-0.5 block text-body-2 font-bold",
54
+ "block text-body-2 font-semibold",
55
55
  state === "upcoming" ? "text-muted-foreground" : "text-foreground",
56
56
  state === "error" && "text-destructive"
57
57
  ),
58
58
  children: [
59
59
  step.label,
60
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: state === "complete" ? " (completed)" : state === "error" ? " (failed)" : "" })
60
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: state === "complete" ? " (completed)" : state === "error" ? " (failed)" : state === "current" ? " (in progress)" : " (pending)" })
61
61
  ]
62
62
  }
63
63
  ),
64
64
  step.description && /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-caption-lg text-muted-foreground", children: step.description }),
65
- /* @__PURE__ */ jsx("span", { className: cn("mt-2 inline-block", stepProgressBadgeVariants({ state })), children: resolveBadgeText(step, state) })
65
+ /* @__PURE__ */ jsx("span", { className: cn("mt-1.5 inline-flex", stepProgressBadgeVariants({ state })), children: badgeLabel })
66
66
  ] })
67
67
  ]
68
68
  },
@@ -70,8 +70,8 @@ function ProgressStepper({ steps, current, status = "default", className }) {
70
70
  );
71
71
  })
72
72
  }
73
- );
74
- }
73
+ )
74
+ );
75
75
  ProgressStepper.displayName = "ProgressStepper";
76
76
 
77
77
  export { ProgressStepper };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmbr/ui",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "High-performance, Next.js App Router-compatible UI design system components for Timmbr",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -51,10 +51,10 @@
51
51
  "@tiptap/extension-text-align": "^2.11.0",
52
52
  "@tiptap/extension-placeholder": "^2.11.0",
53
53
  "@tiptap/extension-character-count": "^2.11.0",
54
+ "@timmbr/motion": "1.2.6",
54
55
  "@timmbr/theme": "1.3.0",
56
+ "@timmbr/icons": "1.6.1",
55
57
  "@timmbr/hooks": "1.3.0",
56
- "@timmbr/icons": "1.6.0",
57
- "@timmbr/motion": "1.2.5",
58
58
  "@timmbr/utils": "1.6.0"
59
59
  },
60
60
  "peerDependencies": {