@payfit/unity-components 2.12.10 → 2.13.1
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/esm/components/timeline/Timeline.context.d.ts +16 -0
- package/dist/esm/components/timeline/Timeline.context.js +23 -0
- package/dist/esm/components/timeline/Timeline.d.ts +49 -0
- package/dist/esm/components/timeline/Timeline.js +37 -0
- package/dist/esm/components/timeline/Timeline.utils.d.ts +7 -0
- package/dist/esm/components/timeline/Timeline.utils.js +9 -0
- package/dist/esm/components/timeline/Timeline.variants.d.ts +169 -0
- package/dist/esm/components/timeline/Timeline.variants.js +121 -0
- package/dist/esm/components/timeline/parts/TimelineMarker.d.ts +22 -0
- package/dist/esm/components/timeline/parts/TimelineMarker.js +26 -0
- package/dist/esm/components/timeline/parts/TimelineStep.context.d.ts +13 -0
- package/dist/esm/components/timeline/parts/TimelineStep.context.js +21 -0
- package/dist/esm/components/timeline/parts/TimelineStep.d.ts +38 -0
- package/dist/esm/components/timeline/parts/TimelineStep.js +52 -0
- package/dist/esm/components/timeline/parts/TimelineStepContent.context.d.ts +18 -0
- package/dist/esm/components/timeline/parts/TimelineStepContent.context.js +22 -0
- package/dist/esm/components/timeline/parts/TimelineStepContent.d.ts +27 -0
- package/dist/esm/components/timeline/parts/TimelineStepContent.js +18 -0
- package/dist/esm/components/timeline/parts/TimelineStepDescription.d.ts +11 -0
- package/dist/esm/components/timeline/parts/TimelineStepDescription.js +8 -0
- package/dist/esm/components/timeline/parts/TimelineStepHeader.d.ts +24 -0
- package/dist/esm/components/timeline/parts/TimelineStepHeader.js +37 -0
- package/dist/esm/components/timeline/parts/check.svg.js +5 -0
- package/dist/esm/hooks/use-breakpoint-listener.d.ts +34 -0
- package/dist/esm/hooks/use-breakpoint-listener.js +17 -5
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +329 -317
- package/i18n/en-GB.json +4 -0
- package/i18n/es-ES.json +4 -0
- package/i18n/fr-FR.json +4 -0
- package/package.json +17 -17
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Global Timeline configuration context
|
|
4
|
+
* Provides orientation and type to all nested Timeline components (TimelineStep, TimelineMarker, etc.)
|
|
5
|
+
*
|
|
6
|
+
* Note: This context is separate from TimelineStepContentContext to maintain single responsibility:
|
|
7
|
+
* - TimelineContext: Global configuration (orientation, type) - used by all components
|
|
8
|
+
* - TimelineStepContentContext: Content-specific data (statusSlot) - used only within TimelineStepContent
|
|
9
|
+
*/
|
|
10
|
+
export interface TimelineContextValue {
|
|
11
|
+
orientation: 'vertical' | 'horizontal';
|
|
12
|
+
type: 'default' | 'numbered';
|
|
13
|
+
}
|
|
14
|
+
export declare const TimelineContext: import('react').Context<TimelineContextValue | null>;
|
|
15
|
+
export declare function TimelineProvider({ children, orientation, type, }: PropsWithChildren<TimelineContextValue>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function useTimelineContext(): TimelineContextValue;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as r, useContext as m } from "react";
|
|
3
|
+
const t = r(null);
|
|
4
|
+
function s({
|
|
5
|
+
children: e,
|
|
6
|
+
orientation: n,
|
|
7
|
+
type: o
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ i(t.Provider, { value: { orientation: n, type: o }, children: e });
|
|
10
|
+
}
|
|
11
|
+
function c() {
|
|
12
|
+
const e = m(t);
|
|
13
|
+
if (!e)
|
|
14
|
+
throw new Error(
|
|
15
|
+
"useTimelineContext must be used within a Timeline component. Make sure to wrap your TimelineStep components with <Timeline>."
|
|
16
|
+
);
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
t as TimelineContext,
|
|
21
|
+
s as TimelineProvider,
|
|
22
|
+
c as useTimelineContext
|
|
23
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { timeline } from './Timeline.variants.js';
|
|
4
|
+
export type TimelineProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Accessible label for the timeline (required for screen readers)
|
|
7
|
+
* @example "Order progress" | "Setup steps" | "Declaration timeline"
|
|
8
|
+
*/
|
|
9
|
+
'aria-label': string;
|
|
10
|
+
/**
|
|
11
|
+
* Custom progress description for screen readers (visually hidden)
|
|
12
|
+
* Optional. Provides context about overall progress in the timeline.
|
|
13
|
+
* @example "Step 2 of 4, 1 completed" | "3 out of 5 steps completed"
|
|
14
|
+
*/
|
|
15
|
+
customProgressLabel?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Orientation of the timeline
|
|
18
|
+
* @default 'vertical'
|
|
19
|
+
*/
|
|
20
|
+
orientation?: VariantProps<typeof timeline>['orientation'];
|
|
21
|
+
/**
|
|
22
|
+
* Type of timeline markers
|
|
23
|
+
* @default 'default'
|
|
24
|
+
*/
|
|
25
|
+
type?: 'default' | 'numbered';
|
|
26
|
+
/**
|
|
27
|
+
* Additional CSS classes
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Timeline steps
|
|
32
|
+
*/
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Timeline component displays chronological events in vertical or horizontal orientation
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <Timeline orientation="vertical" type="numbered">
|
|
40
|
+
* <TimelineStep state="completed" stepNumber={1}>
|
|
41
|
+
* <TimelineStepHeader title="Step 1" subtitle="January 15, 2024" />
|
|
42
|
+
* <TimelineStepDescription>
|
|
43
|
+
* Description of the step
|
|
44
|
+
* </TimelineStepDescription>
|
|
45
|
+
* </TimelineStep>
|
|
46
|
+
* </Timeline>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare const Timeline: import('react').ForwardRefExoticComponent<TimelineProps & import('react').RefAttributes<HTMLOListElement | HTMLUListElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { useId as c } from "react-aria";
|
|
4
|
+
import { TimelineProvider as p } from "./Timeline.context.js";
|
|
5
|
+
import { timeline as u } from "./Timeline.variants.js";
|
|
6
|
+
const v = f(
|
|
7
|
+
({
|
|
8
|
+
"aria-label": o,
|
|
9
|
+
customProgressLabel: i,
|
|
10
|
+
orientation: r = "vertical",
|
|
11
|
+
type: l = "default",
|
|
12
|
+
className: s,
|
|
13
|
+
children: n
|
|
14
|
+
}, e) => {
|
|
15
|
+
const m = c();
|
|
16
|
+
return /* @__PURE__ */ d(p, { orientation: r, type: l, children: [
|
|
17
|
+
i && /* @__PURE__ */ a("div", { id: m, className: "uy:sr-only", children: i }),
|
|
18
|
+
/* @__PURE__ */ a(
|
|
19
|
+
l === "numbered" ? "ol" : "ul",
|
|
20
|
+
{
|
|
21
|
+
ref: (t) => {
|
|
22
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
23
|
+
},
|
|
24
|
+
className: u({ orientation: r, className: s }),
|
|
25
|
+
"aria-label": o,
|
|
26
|
+
"aria-describedby": i ? m : void 0,
|
|
27
|
+
"aria-orientation": r,
|
|
28
|
+
children: n
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
v.displayName = "Timeline";
|
|
35
|
+
export {
|
|
36
|
+
v as Timeline
|
|
37
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns true if the Timeline is in horizontal orientation on desktop breakpoints
|
|
3
|
+
* Used to determine statusSlot positioning:
|
|
4
|
+
* - Horizontal + Desktop: statusSlot at bottom of content
|
|
5
|
+
* - Other cases: statusSlot next to title
|
|
6
|
+
*/
|
|
7
|
+
export declare const useIsHorizontalDesktop: () => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useBreakpointListener as e, isDesktopBreakpoint as n } from "../../hooks/use-breakpoint-listener.js";
|
|
2
|
+
import { useTimelineContext as r } from "./Timeline.context.js";
|
|
3
|
+
const p = () => {
|
|
4
|
+
const { orientation: o } = r(), t = e();
|
|
5
|
+
return o === "horizontal" && n(t);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
p as useIsHorizontalDesktop
|
|
9
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export declare const timeline: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
orientation: {
|
|
3
|
+
vertical: string;
|
|
4
|
+
horizontal: string;
|
|
5
|
+
};
|
|
6
|
+
}, undefined, "uy:flex uy:list-none uy:m-0 uy:p-0", {
|
|
7
|
+
orientation: {
|
|
8
|
+
vertical: string;
|
|
9
|
+
horizontal: string;
|
|
10
|
+
};
|
|
11
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
12
|
+
orientation: {
|
|
13
|
+
vertical: string;
|
|
14
|
+
horizontal: string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, "uy:flex uy:list-none uy:m-0 uy:p-0", unknown, unknown, undefined>>;
|
|
17
|
+
export declare const timelineStep: import('tailwind-variants').TVReturnType<{
|
|
18
|
+
orientation: {
|
|
19
|
+
vertical: string;
|
|
20
|
+
horizontal: string;
|
|
21
|
+
};
|
|
22
|
+
}, undefined, "uy:flex uy:m-0 uy:p-0 uy:gap-200", {
|
|
23
|
+
orientation: {
|
|
24
|
+
vertical: string;
|
|
25
|
+
horizontal: string;
|
|
26
|
+
};
|
|
27
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
28
|
+
orientation: {
|
|
29
|
+
vertical: string;
|
|
30
|
+
horizontal: string;
|
|
31
|
+
};
|
|
32
|
+
}, undefined, "uy:flex uy:m-0 uy:p-0 uy:gap-200", unknown, unknown, undefined>>;
|
|
33
|
+
export declare const timelineMarker: import('tailwind-variants').TVReturnType<{
|
|
34
|
+
state: {
|
|
35
|
+
completed: {
|
|
36
|
+
ball: string;
|
|
37
|
+
line: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
};
|
|
40
|
+
current: {
|
|
41
|
+
ball: string;
|
|
42
|
+
line: string;
|
|
43
|
+
number: string;
|
|
44
|
+
};
|
|
45
|
+
pending: {
|
|
46
|
+
ball: string;
|
|
47
|
+
line: string;
|
|
48
|
+
number: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
type: {
|
|
52
|
+
default: {};
|
|
53
|
+
numbered: {
|
|
54
|
+
ball: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
orientation: {
|
|
58
|
+
vertical: {
|
|
59
|
+
container: string;
|
|
60
|
+
line: string;
|
|
61
|
+
};
|
|
62
|
+
horizontal: {
|
|
63
|
+
container: string;
|
|
64
|
+
line: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
container: string;
|
|
69
|
+
ball: string[];
|
|
70
|
+
line: string;
|
|
71
|
+
icon: string;
|
|
72
|
+
number: string[];
|
|
73
|
+
}, undefined, {
|
|
74
|
+
state: {
|
|
75
|
+
completed: {
|
|
76
|
+
ball: string;
|
|
77
|
+
line: string;
|
|
78
|
+
icon: string;
|
|
79
|
+
};
|
|
80
|
+
current: {
|
|
81
|
+
ball: string;
|
|
82
|
+
line: string;
|
|
83
|
+
number: string;
|
|
84
|
+
};
|
|
85
|
+
pending: {
|
|
86
|
+
ball: string;
|
|
87
|
+
line: string;
|
|
88
|
+
number: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
type: {
|
|
92
|
+
default: {};
|
|
93
|
+
numbered: {
|
|
94
|
+
ball: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
orientation: {
|
|
98
|
+
vertical: {
|
|
99
|
+
container: string;
|
|
100
|
+
line: string;
|
|
101
|
+
};
|
|
102
|
+
horizontal: {
|
|
103
|
+
container: string;
|
|
104
|
+
line: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
container: string;
|
|
109
|
+
ball: string[];
|
|
110
|
+
line: string;
|
|
111
|
+
icon: string;
|
|
112
|
+
number: string[];
|
|
113
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
114
|
+
state: {
|
|
115
|
+
completed: {
|
|
116
|
+
ball: string;
|
|
117
|
+
line: string;
|
|
118
|
+
icon: string;
|
|
119
|
+
};
|
|
120
|
+
current: {
|
|
121
|
+
ball: string;
|
|
122
|
+
line: string;
|
|
123
|
+
number: string;
|
|
124
|
+
};
|
|
125
|
+
pending: {
|
|
126
|
+
ball: string;
|
|
127
|
+
line: string;
|
|
128
|
+
number: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
type: {
|
|
132
|
+
default: {};
|
|
133
|
+
numbered: {
|
|
134
|
+
ball: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
orientation: {
|
|
138
|
+
vertical: {
|
|
139
|
+
container: string;
|
|
140
|
+
line: string;
|
|
141
|
+
};
|
|
142
|
+
horizontal: {
|
|
143
|
+
container: string;
|
|
144
|
+
line: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
}, {
|
|
148
|
+
container: string;
|
|
149
|
+
ball: string[];
|
|
150
|
+
line: string;
|
|
151
|
+
icon: string;
|
|
152
|
+
number: string[];
|
|
153
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
154
|
+
export declare const timelineContent: import('tailwind-variants').TVReturnType<{
|
|
155
|
+
orientation: {
|
|
156
|
+
vertical: string;
|
|
157
|
+
horizontal: string;
|
|
158
|
+
};
|
|
159
|
+
}, undefined, "uy:flex uy:flex-col uy:gap-100 uy:items-start", {
|
|
160
|
+
orientation: {
|
|
161
|
+
vertical: string;
|
|
162
|
+
horizontal: string;
|
|
163
|
+
};
|
|
164
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
165
|
+
orientation: {
|
|
166
|
+
vertical: string;
|
|
167
|
+
horizontal: string;
|
|
168
|
+
};
|
|
169
|
+
}, undefined, "uy:flex uy:flex-col uy:gap-100 uy:items-start", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { uyTv as e } from "@payfit/unity-themes";
|
|
2
|
+
const r = e({
|
|
3
|
+
base: "uy:flex uy:list-none uy:m-0 uy:p-0",
|
|
4
|
+
variants: {
|
|
5
|
+
orientation: {
|
|
6
|
+
vertical: "uy:flex-col",
|
|
7
|
+
// Horizontal: vertical on mobile (xs/sm), horizontal on desktop (md+)
|
|
8
|
+
horizontal: "uy:flex-col uy:md:flex-row"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
orientation: "vertical"
|
|
13
|
+
}
|
|
14
|
+
}), u = e({
|
|
15
|
+
base: "uy:flex uy:m-0 uy:p-0 uy:gap-200",
|
|
16
|
+
variants: {
|
|
17
|
+
orientation: {
|
|
18
|
+
vertical: "uy:flex-row uy:w-full uy:items-stretch",
|
|
19
|
+
// Horizontal: renders as vertical on mobile, horizontal on desktop
|
|
20
|
+
horizontal: "uy:flex-row uy:w-full uy:items-stretch uy:md:flex-col uy:md:flex-1 uy:md:min-w-0 uy:md:w-auto"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
orientation: "vertical"
|
|
25
|
+
}
|
|
26
|
+
}), n = e({
|
|
27
|
+
slots: {
|
|
28
|
+
container: "uy:flex uy:items-center uy:w-300",
|
|
29
|
+
ball: [
|
|
30
|
+
"uy:flex uy:items-center uy:justify-center",
|
|
31
|
+
"uy:w-250 uy:h-250 uy:rounded-full",
|
|
32
|
+
"uy:border-2 uy:border-solid",
|
|
33
|
+
"uy:flex-shrink-0"
|
|
34
|
+
],
|
|
35
|
+
line: "uy:flex-1",
|
|
36
|
+
icon: "uy:w-250 uy:h-250",
|
|
37
|
+
number: [
|
|
38
|
+
"uy:typography-body-small-strong",
|
|
39
|
+
"uy:flex uy:items-center uy:justify-center",
|
|
40
|
+
"uy:w-full uy:h-full"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
variants: {
|
|
44
|
+
state: {
|
|
45
|
+
completed: {
|
|
46
|
+
ball: "uy:bg-surface-primary-active uy:border-transparent uy:w-300 uy:h-300",
|
|
47
|
+
line: "uy:border-border-primary uy:border-solid",
|
|
48
|
+
icon: "uy:text-content-inverted"
|
|
49
|
+
},
|
|
50
|
+
current: {
|
|
51
|
+
ball: "uy:bg-transparent uy:border-border-primary-enabled",
|
|
52
|
+
line: "uy:border-border-neutral uy:border-dashed",
|
|
53
|
+
number: "uy:text-content-primary-active"
|
|
54
|
+
},
|
|
55
|
+
pending: {
|
|
56
|
+
ball: "uy:bg-transparent uy:border-border-neutral",
|
|
57
|
+
line: "uy:border-border-neutral uy:border-dashed",
|
|
58
|
+
number: "uy:text-content-neutral-lowest"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
type: {
|
|
62
|
+
default: {},
|
|
63
|
+
numbered: {
|
|
64
|
+
// Numbered type always uses 24px balls (w-300 h-300) to accommodate numbers
|
|
65
|
+
ball: "uy:w-300 uy:h-300"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
orientation: {
|
|
69
|
+
vertical: {
|
|
70
|
+
container: "uy:flex-col uy:self-stretch",
|
|
71
|
+
line: "uy:min-h-200 uy:w-0 uy:border-l-2"
|
|
72
|
+
},
|
|
73
|
+
// Horizontal: renders as vertical on mobile, horizontal on desktop
|
|
74
|
+
horizontal: {
|
|
75
|
+
container: "uy:flex-col uy:self-stretch uy:md:flex-row uy:md:w-full uy:md:h-300 uy:md:self-auto",
|
|
76
|
+
line: "uy:min-h-200 uy:w-0 uy:border-l-2 uy:md:min-h-0 uy:md:min-w-200 uy:md:h-0 uy:md:w-auto uy:md:border-l-0 uy:md:border-t-2"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
compoundVariants: [
|
|
81
|
+
{
|
|
82
|
+
state: "current",
|
|
83
|
+
type: "numbered",
|
|
84
|
+
className: {
|
|
85
|
+
ball: "uy:bg-surface-primary uy:border-transparent",
|
|
86
|
+
number: "uy:text-content-inverted-active"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
state: "pending",
|
|
91
|
+
type: "numbered",
|
|
92
|
+
className: {
|
|
93
|
+
ball: "uy:bg-surface-neutral-lowest uy:border-border-neutral-low",
|
|
94
|
+
number: "uy:text-content-neutral"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
state: "pending",
|
|
100
|
+
type: "default",
|
|
101
|
+
orientation: "vertical"
|
|
102
|
+
}
|
|
103
|
+
}), y = e({
|
|
104
|
+
base: "uy:flex uy:flex-col uy:gap-100 uy:items-start",
|
|
105
|
+
variants: {
|
|
106
|
+
orientation: {
|
|
107
|
+
vertical: "uy:flex-1 uy:pb-300",
|
|
108
|
+
// Horizontal: renders as vertical on mobile (pb-300), horizontal on desktop (pr-400)
|
|
109
|
+
horizontal: "uy:flex-1 uy:pb-300 uy:md:pb-0 uy:md:pr-400"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
defaultVariants: {
|
|
113
|
+
orientation: "vertical"
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export {
|
|
117
|
+
r as timeline,
|
|
118
|
+
y as timelineContent,
|
|
119
|
+
n as timelineMarker,
|
|
120
|
+
u as timelineStep
|
|
121
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
+
import { timelineMarker } from '../Timeline.variants.js';
|
|
3
|
+
export type TimelineMarkerProps = {
|
|
4
|
+
/**
|
|
5
|
+
* State of the timeline step
|
|
6
|
+
* @default 'pending'
|
|
7
|
+
*/
|
|
8
|
+
state?: VariantProps<typeof timelineMarker>['state'];
|
|
9
|
+
/**
|
|
10
|
+
* Step number to display (for numbered timelines)
|
|
11
|
+
*/
|
|
12
|
+
stepNumber?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Additional CSS classes
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* TimelineMarker displays the visual indicator for a timeline step
|
|
20
|
+
* Shows a check icon when completed, a number for numbered timelines, or an empty circle
|
|
21
|
+
*/
|
|
22
|
+
export declare const TimelineMarker: import('react').ForwardRefExoticComponent<TimelineMarkerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { useTimelineContext as N } from "../Timeline.context.js";
|
|
4
|
+
import { timelineMarker as k } from "../Timeline.variants.js";
|
|
5
|
+
import v from "./check.svg.js";
|
|
6
|
+
const x = f(
|
|
7
|
+
({ state: i = "pending", stepNumber: r, className: m }, t) => {
|
|
8
|
+
const { type: n, orientation: s } = N(), { container: d, icon: l, ball: c, number: h, line: p } = k({
|
|
9
|
+
state: i,
|
|
10
|
+
type: n,
|
|
11
|
+
orientation: s,
|
|
12
|
+
className: m
|
|
13
|
+
}), a = i === "completed", u = n === "numbered" && !a && r !== void 0;
|
|
14
|
+
return /* @__PURE__ */ o("div", { ref: t, className: d(), "aria-hidden": "true", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: c(), children: [
|
|
16
|
+
a && /* @__PURE__ */ e(v, { className: l(), "aria-hidden": "true" }),
|
|
17
|
+
u && /* @__PURE__ */ e("span", { className: h(), "aria-hidden": "true", children: r })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ e("div", { className: p(), "data-timeline-line": !0 })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
x.displayName = "TimelineMarker";
|
|
24
|
+
export {
|
|
25
|
+
x as TimelineMarker
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type TimelineStepContextValue = {
|
|
3
|
+
/**
|
|
4
|
+
* Unique ID for the step label, used for aria-labelledby
|
|
5
|
+
*/
|
|
6
|
+
labelId: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function TimelineStepProvider({ labelId, children, }: {
|
|
9
|
+
labelId: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function useTimelineStepContext(): TimelineStepContextValue;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as o, useContext as r } from "react";
|
|
3
|
+
const t = o(null);
|
|
4
|
+
function l({
|
|
5
|
+
labelId: e,
|
|
6
|
+
children: n
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ i(t.Provider, { value: { labelId: e }, children: n });
|
|
9
|
+
}
|
|
10
|
+
function p() {
|
|
11
|
+
const e = r(t);
|
|
12
|
+
if (!e)
|
|
13
|
+
throw new Error(
|
|
14
|
+
"useTimelineStepContext must be used within TimelineStepProvider"
|
|
15
|
+
);
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
l as TimelineStepProvider,
|
|
20
|
+
p as useTimelineStepContext
|
|
21
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type TimelineStepProps = {
|
|
3
|
+
/**
|
|
4
|
+
* State of the timeline step
|
|
5
|
+
* @default 'pending'
|
|
6
|
+
*/
|
|
7
|
+
state?: 'completed' | 'current' | 'pending';
|
|
8
|
+
/**
|
|
9
|
+
* Step number for numbered timelines
|
|
10
|
+
*/
|
|
11
|
+
stepNumber?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Additional CSS classes
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional status slot to display next to the title (vertical orientation or horizontal mobile)
|
|
18
|
+
* or at the bottom of the content (horizontal desktop)
|
|
19
|
+
* Typically a Badge component, but can be any ReactNode
|
|
20
|
+
*/
|
|
21
|
+
statusSlot?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional action slot for links or actions
|
|
24
|
+
* Displayed after the description and statusSlot
|
|
25
|
+
* Typically a Link component, but can be any ReactNode
|
|
26
|
+
*/
|
|
27
|
+
actionSlot?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Step content (typically TimelineStepHeader, TimelineStepDescription, etc.)
|
|
30
|
+
*/
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* TimelineStep represents a single step in the timeline
|
|
35
|
+
* Automatically renders the TimelineMarker with the correct state and stepNumber
|
|
36
|
+
* Announces the step status to screen readers using i18n translations
|
|
37
|
+
*/
|
|
38
|
+
export declare const TimelineStep: import('react').ForwardRefExoticComponent<TimelineStepProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, useId as o } from "react";
|
|
3
|
+
import { useIntl as y } from "react-intl";
|
|
4
|
+
import { useTimelineContext as M } from "../Timeline.context.js";
|
|
5
|
+
import { timelineStep as b } from "../Timeline.variants.js";
|
|
6
|
+
import { TimelineMarker as T } from "./TimelineMarker.js";
|
|
7
|
+
import { TimelineStepProvider as I } from "./TimelineStep.context.js";
|
|
8
|
+
import { TimelineStepContent as S } from "./TimelineStepContent.js";
|
|
9
|
+
const x = g(
|
|
10
|
+
({
|
|
11
|
+
state: t = "pending",
|
|
12
|
+
stepNumber: s,
|
|
13
|
+
className: m,
|
|
14
|
+
statusSlot: a,
|
|
15
|
+
actionSlot: l,
|
|
16
|
+
children: d
|
|
17
|
+
}, p) => {
|
|
18
|
+
const i = y(), { orientation: c } = M(), n = o(), r = o(), f = {
|
|
19
|
+
completed: i.formatMessage({
|
|
20
|
+
id: "unity:component:timeline:state:completed",
|
|
21
|
+
defaultMessage: "Completed"
|
|
22
|
+
}),
|
|
23
|
+
current: i.formatMessage({
|
|
24
|
+
id: "unity:component:timeline:state:current",
|
|
25
|
+
defaultMessage: "In progress"
|
|
26
|
+
}),
|
|
27
|
+
pending: i.formatMessage({
|
|
28
|
+
id: "unity:component:timeline:state:pending",
|
|
29
|
+
defaultMessage: "Pending"
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ u(
|
|
33
|
+
"li",
|
|
34
|
+
{
|
|
35
|
+
ref: p,
|
|
36
|
+
className: b({ orientation: c, className: m }),
|
|
37
|
+
"aria-current": t === "current" ? "step" : void 0,
|
|
38
|
+
"aria-labelledby": n,
|
|
39
|
+
"aria-describedby": r,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ e(T, { state: t, stepNumber: s }),
|
|
42
|
+
/* @__PURE__ */ e("span", { id: r, className: "uy:sr-only", children: f[t] }),
|
|
43
|
+
/* @__PURE__ */ e(I, { labelId: n, children: /* @__PURE__ */ e(S, { statusSlot: a, actionSlot: l, children: d }) })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
x.displayName = "TimelineStep";
|
|
50
|
+
export {
|
|
51
|
+
x as TimelineStep
|
|
52
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* TimelineStepContent-specific context
|
|
4
|
+
* Provides content data (statusSlot) to nested components like TimelineStepHeader
|
|
5
|
+
*
|
|
6
|
+
* Note: This context is separate from TimelineContext to maintain single responsibility:
|
|
7
|
+
* - TimelineContext: Global configuration (orientation, type) - used by all components
|
|
8
|
+
* - TimelineStepContentContext: Content-specific data (statusSlot) - scoped to TimelineStepContent only
|
|
9
|
+
*
|
|
10
|
+
* This separation ensures that content-level data doesn't pollute the global Timeline context
|
|
11
|
+
* and allows TimelineStepContent to manage its own internal state independently.
|
|
12
|
+
*/
|
|
13
|
+
export interface TimelineStepContentContextValue {
|
|
14
|
+
statusSlot?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const TimelineStepContentContext: import('react').Context<TimelineStepContentContextValue | null>;
|
|
17
|
+
export declare function TimelineStepContentProvider({ children, statusSlot, }: PropsWithChildren<TimelineStepContentContextValue>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function useTimelineStepContentContext(): TimelineStepContentContextValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as i, createContext as r } from "react";
|
|
3
|
+
const t = r(null);
|
|
4
|
+
function C({
|
|
5
|
+
children: e,
|
|
6
|
+
statusSlot: n
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ o(t.Provider, { value: { statusSlot: n }, children: e });
|
|
9
|
+
}
|
|
10
|
+
function l() {
|
|
11
|
+
const e = i(t);
|
|
12
|
+
if (!e)
|
|
13
|
+
throw new Error(
|
|
14
|
+
"useTimelineStepContentContext must be used within TimelineStepContent"
|
|
15
|
+
);
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
t as TimelineStepContentContext,
|
|
20
|
+
C as TimelineStepContentProvider,
|
|
21
|
+
l as useTimelineStepContentContext
|
|
22
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type TimelineStepContentProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Additional CSS classes
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Content to display (typically TimelineStepHeader, TimelineStepDescription, etc.)
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional status slot to display next to the title (vertical orientation or horizontal mobile)
|
|
13
|
+
* or at the bottom of the content (horizontal desktop)
|
|
14
|
+
* Typically a Badge component, but can be any ReactNode
|
|
15
|
+
*/
|
|
16
|
+
statusSlot?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Optional action slot for links or actions
|
|
19
|
+
* Displayed after the description and statusSlot
|
|
20
|
+
* Typically a Link component, but can be any ReactNode
|
|
21
|
+
*/
|
|
22
|
+
actionSlot?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* TimelineStepContent wraps the content area of a timeline step
|
|
26
|
+
*/
|
|
27
|
+
export declare const TimelineStepContent: import('react').ForwardRefExoticComponent<TimelineStepContentProps & import('react').RefAttributes<HTMLDivElement>>;
|