@octavius2929-personal/design-system 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +261 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -271
- package/dist/index.d.ts +50 -271
- package/dist/index.js +253 -136
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,6 +26,46 @@ function useToggle(initial = false) {
|
|
|
26
26
|
// src/components/container/index.tsx
|
|
27
27
|
import { forwardRef } from "react";
|
|
28
28
|
|
|
29
|
+
// src/testing/use-test-id.ts
|
|
30
|
+
import { useMemo as useMemo2 } from "react";
|
|
31
|
+
|
|
32
|
+
// src/testing/compose.ts
|
|
33
|
+
function normalizeSegment(seg) {
|
|
34
|
+
return seg.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
function composeTestId(parts) {
|
|
37
|
+
return parts.filter((p) => typeof p === "string" && p.trim() !== "").map(normalizeSegment).join("__");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/testing/context/test-id-context.tsx
|
|
41
|
+
import { createContext, useContext, useMemo } from "react";
|
|
42
|
+
import { jsx } from "react/jsx-runtime";
|
|
43
|
+
var TestIdContext = createContext([]);
|
|
44
|
+
function TestIdProvider({ context, children }) {
|
|
45
|
+
const parent = useContext(TestIdContext);
|
|
46
|
+
const value = useMemo(
|
|
47
|
+
() => [...parent, normalizeSegment(context)].filter((seg) => seg !== ""),
|
|
48
|
+
[parent, context]
|
|
49
|
+
);
|
|
50
|
+
return /* @__PURE__ */ jsx(TestIdContext.Provider, { value, children });
|
|
51
|
+
}
|
|
52
|
+
function useTestIdContext() {
|
|
53
|
+
return useContext(TestIdContext);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/testing/use-test-id.ts
|
|
57
|
+
function useTestId(type, ownTestId) {
|
|
58
|
+
const ctx = useTestIdContext();
|
|
59
|
+
const testId = composeTestId([type, ...ctx, ownTestId]);
|
|
60
|
+
return useMemo2(
|
|
61
|
+
() => ({
|
|
62
|
+
testId,
|
|
63
|
+
slot: (name) => `${testId}__${normalizeSegment(name)}`
|
|
64
|
+
}),
|
|
65
|
+
[testId]
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
29
69
|
// src/theme/styles/sprinkles/index.css.ts
|
|
30
70
|
import { createSprinkles as _ad221 } from "@vanilla-extract/sprinkles/createRuntimeSprinkles";
|
|
31
71
|
var sprinkles = _ad221({ conditions: void 0, styles: { p: { mappings: ["padding"] }, px: { mappings: ["paddingLeft", "paddingRight"] }, py: { mappings: ["paddingTop", "paddingBottom"] }, pt: { mappings: ["paddingTop"] }, pr: { mappings: ["paddingRight"] }, pb: { mappings: ["paddingBottom"] }, pl: { mappings: ["paddingLeft"] }, m: { mappings: ["marginTop", "marginRight", "marginBottom", "marginLeft"] }, mx: { mappings: ["marginLeft", "marginRight"] }, my: { mappings: ["marginTop", "marginBottom"] }, mt: { mappings: ["marginTop"] }, mr: { mappings: ["marginRight"] }, mb: { mappings: ["marginBottom"] }, ml: { mappings: ["marginLeft"] }, bg: { mappings: ["background"] }, radius: { mappings: ["borderRadius"] }, padding: { values: { s0: { defaultClass: "sprinkles_padding_s0__qhecrd0" }, s1: { defaultClass: "sprinkles_padding_s1__qhecrd1" }, s2: { defaultClass: "sprinkles_padding_s2__qhecrd2" }, s3: { defaultClass: "sprinkles_padding_s3__qhecrd3" }, s4: { defaultClass: "sprinkles_padding_s4__qhecrd4" }, s5: { defaultClass: "sprinkles_padding_s5__qhecrd5" }, s6: { defaultClass: "sprinkles_padding_s6__qhecrd6" }, s7: { defaultClass: "sprinkles_padding_s7__qhecrd7" }, s8: { defaultClass: "sprinkles_padding_s8__qhecrd8" }, s9: { defaultClass: "sprinkles_padding_s9__qhecrd9" } } }, paddingTop: { values: { s0: { defaultClass: "sprinkles_paddingTop_s0__qhecrda" }, s1: { defaultClass: "sprinkles_paddingTop_s1__qhecrdb" }, s2: { defaultClass: "sprinkles_paddingTop_s2__qhecrdc" }, s3: { defaultClass: "sprinkles_paddingTop_s3__qhecrdd" }, s4: { defaultClass: "sprinkles_paddingTop_s4__qhecrde" }, s5: { defaultClass: "sprinkles_paddingTop_s5__qhecrdf" }, s6: { defaultClass: "sprinkles_paddingTop_s6__qhecrdg" }, s7: { defaultClass: "sprinkles_paddingTop_s7__qhecrdh" }, s8: { defaultClass: "sprinkles_paddingTop_s8__qhecrdi" }, s9: { defaultClass: "sprinkles_paddingTop_s9__qhecrdj" } } }, paddingRight: { values: { s0: { defaultClass: "sprinkles_paddingRight_s0__qhecrdk" }, s1: { defaultClass: "sprinkles_paddingRight_s1__qhecrdl" }, s2: { defaultClass: "sprinkles_paddingRight_s2__qhecrdm" }, s3: { defaultClass: "sprinkles_paddingRight_s3__qhecrdn" }, s4: { defaultClass: "sprinkles_paddingRight_s4__qhecrdo" }, s5: { defaultClass: "sprinkles_paddingRight_s5__qhecrdp" }, s6: { defaultClass: "sprinkles_paddingRight_s6__qhecrdq" }, s7: { defaultClass: "sprinkles_paddingRight_s7__qhecrdr" }, s8: { defaultClass: "sprinkles_paddingRight_s8__qhecrds" }, s9: { defaultClass: "sprinkles_paddingRight_s9__qhecrdt" } } }, paddingBottom: { values: { s0: { defaultClass: "sprinkles_paddingBottom_s0__qhecrdu" }, s1: { defaultClass: "sprinkles_paddingBottom_s1__qhecrdv" }, s2: { defaultClass: "sprinkles_paddingBottom_s2__qhecrdw" }, s3: { defaultClass: "sprinkles_paddingBottom_s3__qhecrdx" }, s4: { defaultClass: "sprinkles_paddingBottom_s4__qhecrdy" }, s5: { defaultClass: "sprinkles_paddingBottom_s5__qhecrdz" }, s6: { defaultClass: "sprinkles_paddingBottom_s6__qhecrd10" }, s7: { defaultClass: "sprinkles_paddingBottom_s7__qhecrd11" }, s8: { defaultClass: "sprinkles_paddingBottom_s8__qhecrd12" }, s9: { defaultClass: "sprinkles_paddingBottom_s9__qhecrd13" } } }, paddingLeft: { values: { s0: { defaultClass: "sprinkles_paddingLeft_s0__qhecrd14" }, s1: { defaultClass: "sprinkles_paddingLeft_s1__qhecrd15" }, s2: { defaultClass: "sprinkles_paddingLeft_s2__qhecrd16" }, s3: { defaultClass: "sprinkles_paddingLeft_s3__qhecrd17" }, s4: { defaultClass: "sprinkles_paddingLeft_s4__qhecrd18" }, s5: { defaultClass: "sprinkles_paddingLeft_s5__qhecrd19" }, s6: { defaultClass: "sprinkles_paddingLeft_s6__qhecrd1a" }, s7: { defaultClass: "sprinkles_paddingLeft_s7__qhecrd1b" }, s8: { defaultClass: "sprinkles_paddingLeft_s8__qhecrd1c" }, s9: { defaultClass: "sprinkles_paddingLeft_s9__qhecrd1d" } } }, marginTop: { values: { s0: { defaultClass: "sprinkles_marginTop_s0__qhecrd1e" }, s1: { defaultClass: "sprinkles_marginTop_s1__qhecrd1f" }, s2: { defaultClass: "sprinkles_marginTop_s2__qhecrd1g" }, s3: { defaultClass: "sprinkles_marginTop_s3__qhecrd1h" }, s4: { defaultClass: "sprinkles_marginTop_s4__qhecrd1i" }, s5: { defaultClass: "sprinkles_marginTop_s5__qhecrd1j" }, s6: { defaultClass: "sprinkles_marginTop_s6__qhecrd1k" }, s7: { defaultClass: "sprinkles_marginTop_s7__qhecrd1l" }, s8: { defaultClass: "sprinkles_marginTop_s8__qhecrd1m" }, s9: { defaultClass: "sprinkles_marginTop_s9__qhecrd1n" } } }, marginRight: { values: { s0: { defaultClass: "sprinkles_marginRight_s0__qhecrd1o" }, s1: { defaultClass: "sprinkles_marginRight_s1__qhecrd1p" }, s2: { defaultClass: "sprinkles_marginRight_s2__qhecrd1q" }, s3: { defaultClass: "sprinkles_marginRight_s3__qhecrd1r" }, s4: { defaultClass: "sprinkles_marginRight_s4__qhecrd1s" }, s5: { defaultClass: "sprinkles_marginRight_s5__qhecrd1t" }, s6: { defaultClass: "sprinkles_marginRight_s6__qhecrd1u" }, s7: { defaultClass: "sprinkles_marginRight_s7__qhecrd1v" }, s8: { defaultClass: "sprinkles_marginRight_s8__qhecrd1w" }, s9: { defaultClass: "sprinkles_marginRight_s9__qhecrd1x" } } }, marginBottom: { values: { s0: { defaultClass: "sprinkles_marginBottom_s0__qhecrd1y" }, s1: { defaultClass: "sprinkles_marginBottom_s1__qhecrd1z" }, s2: { defaultClass: "sprinkles_marginBottom_s2__qhecrd20" }, s3: { defaultClass: "sprinkles_marginBottom_s3__qhecrd21" }, s4: { defaultClass: "sprinkles_marginBottom_s4__qhecrd22" }, s5: { defaultClass: "sprinkles_marginBottom_s5__qhecrd23" }, s6: { defaultClass: "sprinkles_marginBottom_s6__qhecrd24" }, s7: { defaultClass: "sprinkles_marginBottom_s7__qhecrd25" }, s8: { defaultClass: "sprinkles_marginBottom_s8__qhecrd26" }, s9: { defaultClass: "sprinkles_marginBottom_s9__qhecrd27" } } }, marginLeft: { values: { s0: { defaultClass: "sprinkles_marginLeft_s0__qhecrd28" }, s1: { defaultClass: "sprinkles_marginLeft_s1__qhecrd29" }, s2: { defaultClass: "sprinkles_marginLeft_s2__qhecrd2a" }, s3: { defaultClass: "sprinkles_marginLeft_s3__qhecrd2b" }, s4: { defaultClass: "sprinkles_marginLeft_s4__qhecrd2c" }, s5: { defaultClass: "sprinkles_marginLeft_s5__qhecrd2d" }, s6: { defaultClass: "sprinkles_marginLeft_s6__qhecrd2e" }, s7: { defaultClass: "sprinkles_marginLeft_s7__qhecrd2f" }, s8: { defaultClass: "sprinkles_marginLeft_s8__qhecrd2g" }, s9: { defaultClass: "sprinkles_marginLeft_s9__qhecrd2h" } } }, gap: { values: { s0: { defaultClass: "sprinkles_gap_s0__qhecrd2i" }, s1: { defaultClass: "sprinkles_gap_s1__qhecrd2j" }, s2: { defaultClass: "sprinkles_gap_s2__qhecrd2k" }, s3: { defaultClass: "sprinkles_gap_s3__qhecrd2l" }, s4: { defaultClass: "sprinkles_gap_s4__qhecrd2m" }, s5: { defaultClass: "sprinkles_gap_s5__qhecrd2n" }, s6: { defaultClass: "sprinkles_gap_s6__qhecrd2o" }, s7: { defaultClass: "sprinkles_gap_s7__qhecrd2p" }, s8: { defaultClass: "sprinkles_gap_s8__qhecrd2q" }, s9: { defaultClass: "sprinkles_gap_s9__qhecrd2r" } } }, rowGap: { values: { s0: { defaultClass: "sprinkles_rowGap_s0__qhecrd2s" }, s1: { defaultClass: "sprinkles_rowGap_s1__qhecrd2t" }, s2: { defaultClass: "sprinkles_rowGap_s2__qhecrd2u" }, s3: { defaultClass: "sprinkles_rowGap_s3__qhecrd2v" }, s4: { defaultClass: "sprinkles_rowGap_s4__qhecrd2w" }, s5: { defaultClass: "sprinkles_rowGap_s5__qhecrd2x" }, s6: { defaultClass: "sprinkles_rowGap_s6__qhecrd2y" }, s7: { defaultClass: "sprinkles_rowGap_s7__qhecrd2z" }, s8: { defaultClass: "sprinkles_rowGap_s8__qhecrd30" }, s9: { defaultClass: "sprinkles_rowGap_s9__qhecrd31" } } }, columnGap: { values: { s0: { defaultClass: "sprinkles_columnGap_s0__qhecrd32" }, s1: { defaultClass: "sprinkles_columnGap_s1__qhecrd33" }, s2: { defaultClass: "sprinkles_columnGap_s2__qhecrd34" }, s3: { defaultClass: "sprinkles_columnGap_s3__qhecrd35" }, s4: { defaultClass: "sprinkles_columnGap_s4__qhecrd36" }, s5: { defaultClass: "sprinkles_columnGap_s5__qhecrd37" }, s6: { defaultClass: "sprinkles_columnGap_s6__qhecrd38" }, s7: { defaultClass: "sprinkles_columnGap_s7__qhecrd39" }, s8: { defaultClass: "sprinkles_columnGap_s8__qhecrd3a" }, s9: { defaultClass: "sprinkles_columnGap_s9__qhecrd3b" } } }, background: { values: { bg1: { defaultClass: "sprinkles_background_bg1__qhecrd3c" }, bg2: { defaultClass: "sprinkles_background_bg2__qhecrd3d" }, bg3: { defaultClass: "sprinkles_background_bg3__qhecrd3e" }, bgInset: { defaultClass: "sprinkles_background_bgInset__qhecrd3f" }, fg1: { defaultClass: "sprinkles_background_fg1__qhecrd3g" }, fg2: { defaultClass: "sprinkles_background_fg2__qhecrd3h" }, fg3: { defaultClass: "sprinkles_background_fg3__qhecrd3i" }, fgOnAccent: { defaultClass: "sprinkles_background_fgOnAccent__qhecrd3j" }, border1: { defaultClass: "sprinkles_background_border1__qhecrd3k" }, border2: { defaultClass: "sprinkles_background_border2__qhecrd3l" }, borderStrong: { defaultClass: "sprinkles_background_borderStrong__qhecrd3m" }, accent: { defaultClass: "sprinkles_background_accent__qhecrd3n" }, accentHover: { defaultClass: "sprinkles_background_accentHover__qhecrd3o" }, accentSoft: { defaultClass: "sprinkles_background_accentSoft__qhecrd3p" }, ok: { defaultClass: "sprinkles_background_ok__qhecrd3q" }, warn: { defaultClass: "sprinkles_background_warn__qhecrd3r" }, danger: { defaultClass: "sprinkles_background_danger__qhecrd3s" }, dangerHover: { defaultClass: "sprinkles_background_dangerHover__qhecrd3t" }, dangerSoft: { defaultClass: "sprinkles_background_dangerSoft__qhecrd3u" }, info: { defaultClass: "sprinkles_background_info__qhecrd3v" }, focus: { defaultClass: "sprinkles_background_focus__qhecrd3w" }, scrim: { defaultClass: "sprinkles_background_scrim__qhecrd3x" } } }, color: { values: { bg1: { defaultClass: "sprinkles_color_bg1__qhecrd3y" }, bg2: { defaultClass: "sprinkles_color_bg2__qhecrd3z" }, bg3: { defaultClass: "sprinkles_color_bg3__qhecrd40" }, bgInset: { defaultClass: "sprinkles_color_bgInset__qhecrd41" }, fg1: { defaultClass: "sprinkles_color_fg1__qhecrd42" }, fg2: { defaultClass: "sprinkles_color_fg2__qhecrd43" }, fg3: { defaultClass: "sprinkles_color_fg3__qhecrd44" }, fgOnAccent: { defaultClass: "sprinkles_color_fgOnAccent__qhecrd45" }, border1: { defaultClass: "sprinkles_color_border1__qhecrd46" }, border2: { defaultClass: "sprinkles_color_border2__qhecrd47" }, borderStrong: { defaultClass: "sprinkles_color_borderStrong__qhecrd48" }, accent: { defaultClass: "sprinkles_color_accent__qhecrd49" }, accentHover: { defaultClass: "sprinkles_color_accentHover__qhecrd4a" }, accentSoft: { defaultClass: "sprinkles_color_accentSoft__qhecrd4b" }, ok: { defaultClass: "sprinkles_color_ok__qhecrd4c" }, warn: { defaultClass: "sprinkles_color_warn__qhecrd4d" }, danger: { defaultClass: "sprinkles_color_danger__qhecrd4e" }, dangerHover: { defaultClass: "sprinkles_color_dangerHover__qhecrd4f" }, dangerSoft: { defaultClass: "sprinkles_color_dangerSoft__qhecrd4g" }, info: { defaultClass: "sprinkles_color_info__qhecrd4h" }, focus: { defaultClass: "sprinkles_color_focus__qhecrd4i" }, scrim: { defaultClass: "sprinkles_color_scrim__qhecrd4j" } } }, borderRadius: { values: { none: { defaultClass: "sprinkles_borderRadius_none__qhecrd4k" }, sm: { defaultClass: "sprinkles_borderRadius_sm__qhecrd4l" }, md: { defaultClass: "sprinkles_borderRadius_md__qhecrd4m" }, lg: { defaultClass: "sprinkles_borderRadius_lg__qhecrd4n" }, base: { defaultClass: "sprinkles_borderRadius_base__qhecrd4o" }, full: { defaultClass: "sprinkles_borderRadius_full__qhecrd4p" } } }, display: { values: { block: { defaultClass: "sprinkles_display_block__qhecrd4q" }, "inline-block": { defaultClass: "sprinkles_display_inline-block__qhecrd4r" }, flex: { defaultClass: "sprinkles_display_flex__qhecrd4s" }, "inline-flex": { defaultClass: "sprinkles_display_inline-flex__qhecrd4t" }, grid: { defaultClass: "sprinkles_display_grid__qhecrd4u" }, none: { defaultClass: "sprinkles_display_none__qhecrd4v" } } }, flexDirection: { values: { row: { defaultClass: "sprinkles_flexDirection_row__qhecrd4w" }, column: { defaultClass: "sprinkles_flexDirection_column__qhecrd4x" }, "row-reverse": { defaultClass: "sprinkles_flexDirection_row-reverse__qhecrd4y" }, "column-reverse": { defaultClass: "sprinkles_flexDirection_column-reverse__qhecrd4z" } } }, alignItems: { values: { "flex-start": { defaultClass: "sprinkles_alignItems_flex-start__qhecrd50" }, center: { defaultClass: "sprinkles_alignItems_center__qhecrd51" }, "flex-end": { defaultClass: "sprinkles_alignItems_flex-end__qhecrd52" }, stretch: { defaultClass: "sprinkles_alignItems_stretch__qhecrd53" }, baseline: { defaultClass: "sprinkles_alignItems_baseline__qhecrd54" } } }, justifyContent: { values: { "flex-start": { defaultClass: "sprinkles_justifyContent_flex-start__qhecrd55" }, center: { defaultClass: "sprinkles_justifyContent_center__qhecrd56" }, "flex-end": { defaultClass: "sprinkles_justifyContent_flex-end__qhecrd57" }, "space-between": { defaultClass: "sprinkles_justifyContent_space-between__qhecrd58" }, "space-around": { defaultClass: "sprinkles_justifyContent_space-around__qhecrd59" }, "space-evenly": { defaultClass: "sprinkles_justifyContent_space-evenly__qhecrd5a" } } }, flexWrap: { values: { nowrap: { defaultClass: "sprinkles_flexWrap_nowrap__qhecrd5b" }, wrap: { defaultClass: "sprinkles_flexWrap_wrap__qhecrd5c" } } } } });
|
|
@@ -46,11 +86,12 @@ function useStyles(props) {
|
|
|
46
86
|
}
|
|
47
87
|
|
|
48
88
|
// src/components/container/index.tsx
|
|
49
|
-
import { jsx } from "react/jsx-runtime";
|
|
50
|
-
function ContainerImpl({ as, ...props }, ref) {
|
|
89
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
90
|
+
function ContainerImpl({ as, testId, ...props }, ref) {
|
|
51
91
|
const Component = as ?? "div";
|
|
52
92
|
const { className, rest } = useStyles(props);
|
|
53
|
-
|
|
93
|
+
const { testId: dataTestId } = useTestId("layout", testId);
|
|
94
|
+
return /* @__PURE__ */ jsx2(Component, { ref, "data-testid": dataTestId, ...rest, className });
|
|
54
95
|
}
|
|
55
96
|
var ContainerForwarded = forwardRef(ContainerImpl);
|
|
56
97
|
ContainerForwarded.displayName = "Container";
|
|
@@ -60,11 +101,11 @@ var Container = ContainerForwarded;
|
|
|
60
101
|
import { forwardRef as forwardRef2 } from "react";
|
|
61
102
|
|
|
62
103
|
// src/components/typography/use-styles.ts
|
|
63
|
-
import { useMemo as
|
|
104
|
+
import { useMemo as useMemo4 } from "react";
|
|
64
105
|
|
|
65
106
|
// src/theme/context/theme-context.tsx
|
|
66
|
-
import { createContext, useContext, useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
67
|
-
import { jsx as
|
|
107
|
+
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useMemo as useMemo3, useState as useState2 } from "react";
|
|
108
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
68
109
|
var noop = () => {
|
|
69
110
|
};
|
|
70
111
|
var DEFAULT_VALUE = {
|
|
@@ -77,7 +118,7 @@ var DEFAULT_VALUE = {
|
|
|
77
118
|
toggleMode: noop,
|
|
78
119
|
cycleMode: noop
|
|
79
120
|
};
|
|
80
|
-
var ThemeContext =
|
|
121
|
+
var ThemeContext = createContext2(null);
|
|
81
122
|
function resolveSystemMode() {
|
|
82
123
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return "light";
|
|
83
124
|
if (window.matchMedia("(prefers-contrast: more)").matches) return "contrast";
|
|
@@ -131,7 +172,7 @@ function ThemeProvider({
|
|
|
131
172
|
useEffect2(() => {
|
|
132
173
|
if (persist) writeStored(storageKey, { schema, preference });
|
|
133
174
|
}, [schema, preference, persist, storageKey]);
|
|
134
|
-
const value =
|
|
175
|
+
const value = useMemo3(
|
|
135
176
|
() => ({
|
|
136
177
|
schema,
|
|
137
178
|
mode,
|
|
@@ -147,10 +188,10 @@ function ThemeProvider({
|
|
|
147
188
|
}),
|
|
148
189
|
[schema, mode, preference]
|
|
149
190
|
);
|
|
150
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ jsx3(ThemeContext.Provider, { value, children });
|
|
151
192
|
}
|
|
152
193
|
function useTheme() {
|
|
153
|
-
return
|
|
194
|
+
return useContext2(ThemeContext) ?? DEFAULT_VALUE;
|
|
154
195
|
}
|
|
155
196
|
|
|
156
197
|
// src/theme/typography.css.ts
|
|
@@ -168,7 +209,7 @@ function useStyles2({
|
|
|
168
209
|
align: align2
|
|
169
210
|
}) {
|
|
170
211
|
const { themeClass } = useTheme();
|
|
171
|
-
const className =
|
|
212
|
+
const className = useMemo4(
|
|
172
213
|
() => [
|
|
173
214
|
themeClass,
|
|
174
215
|
base,
|
|
@@ -182,7 +223,7 @@ function useStyles2({
|
|
|
182
223
|
}
|
|
183
224
|
|
|
184
225
|
// src/components/typography/index.tsx
|
|
185
|
-
import { jsx as
|
|
226
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
186
227
|
var defaultElement = {
|
|
187
228
|
display: "h1",
|
|
188
229
|
h1: "h1",
|
|
@@ -197,10 +238,11 @@ var defaultElement = {
|
|
|
197
238
|
code: "code",
|
|
198
239
|
blackletter: "span"
|
|
199
240
|
};
|
|
200
|
-
function TypographyInner({ variant: variant2, as, color: color2, align: align2, ...rest }, ref) {
|
|
241
|
+
function TypographyInner({ variant: variant2, as, color: color2, align: align2, testId, ...rest }, ref) {
|
|
201
242
|
const Component = as ?? defaultElement[variant2];
|
|
202
243
|
const { text: text2 } = useStyles2({ variant: variant2, color: color2, align: align2 });
|
|
203
|
-
|
|
244
|
+
const { testId: dataTestId } = useTestId("text", testId);
|
|
245
|
+
return /* @__PURE__ */ jsx4(Component, { ref, "data-testid": dataTestId, ...rest, className: text2 });
|
|
204
246
|
}
|
|
205
247
|
var TypographyForwarded = forwardRef2(
|
|
206
248
|
TypographyInner
|
|
@@ -217,46 +259,6 @@ function states(map) {
|
|
|
217
259
|
return active2.length > 0 ? active2.join(" ") : void 0;
|
|
218
260
|
}
|
|
219
261
|
|
|
220
|
-
// src/testing/use-test-id.ts
|
|
221
|
-
import { useMemo as useMemo4 } from "react";
|
|
222
|
-
|
|
223
|
-
// src/testing/compose.ts
|
|
224
|
-
function normalizeSegment(seg) {
|
|
225
|
-
return seg.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
226
|
-
}
|
|
227
|
-
function composeTestId(parts) {
|
|
228
|
-
return parts.filter((p) => typeof p === "string" && p.trim() !== "").map(normalizeSegment).join("__");
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// src/testing/context/test-id-context.tsx
|
|
232
|
-
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo3 } from "react";
|
|
233
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
234
|
-
var TestIdContext = createContext2([]);
|
|
235
|
-
function TestIdProvider({ context, children }) {
|
|
236
|
-
const parent = useContext2(TestIdContext);
|
|
237
|
-
const value = useMemo3(
|
|
238
|
-
() => [...parent, normalizeSegment(context)].filter((seg) => seg !== ""),
|
|
239
|
-
[parent, context]
|
|
240
|
-
);
|
|
241
|
-
return /* @__PURE__ */ jsx4(TestIdContext.Provider, { value, children });
|
|
242
|
-
}
|
|
243
|
-
function useTestIdContext() {
|
|
244
|
-
return useContext2(TestIdContext);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// src/testing/use-test-id.ts
|
|
248
|
-
function useTestId(type, ownTestId) {
|
|
249
|
-
const ctx = useTestIdContext();
|
|
250
|
-
const testId = composeTestId([type, ...ctx, ownTestId]);
|
|
251
|
-
return useMemo4(
|
|
252
|
-
() => ({
|
|
253
|
-
testId,
|
|
254
|
-
slot: (name) => `${testId}__${normalizeSegment(name)}`
|
|
255
|
-
}),
|
|
256
|
-
[testId]
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
262
|
// src/components/button/use-styles.ts
|
|
261
263
|
import { useMemo as useMemo5 } from "react";
|
|
262
264
|
|
|
@@ -360,17 +362,18 @@ function useStyles4({ vertical: vertical2, hasLabel }) {
|
|
|
360
362
|
|
|
361
363
|
// src/components/divider/index.tsx
|
|
362
364
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
363
|
-
var Divider = forwardRef4(function Divider2({ vertical: vertical2, label: label7, ...rest }, ref) {
|
|
365
|
+
var Divider = forwardRef4(function Divider2({ vertical: vertical2, label: label7, testId, ...rest }, ref) {
|
|
364
366
|
const hasLabel = label7 != null;
|
|
365
367
|
const { root: root24, line: line2, label: labelClass } = useStyles4({ vertical: vertical2, hasLabel });
|
|
368
|
+
const { testId: dataTestId, slot } = useTestId("layout", testId);
|
|
366
369
|
if (hasLabel) {
|
|
367
|
-
return /* @__PURE__ */ jsxs2("div", { ref, role: "separator", className: root24, ...rest, children: [
|
|
370
|
+
return /* @__PURE__ */ jsxs2("div", { ref, role: "separator", className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
368
371
|
/* @__PURE__ */ jsx6("span", { className: line2 }),
|
|
369
|
-
/* @__PURE__ */ jsx6("span", { className: labelClass, children: label7 }),
|
|
372
|
+
/* @__PURE__ */ jsx6("span", { className: labelClass, "data-testid": slot("label"), children: label7 }),
|
|
370
373
|
/* @__PURE__ */ jsx6("span", { className: line2 })
|
|
371
374
|
] });
|
|
372
375
|
}
|
|
373
|
-
return /* @__PURE__ */ jsx6("div", { ref, role: "separator", className: root24, ...rest });
|
|
376
|
+
return /* @__PURE__ */ jsx6("div", { ref, role: "separator", className: root24, "data-testid": dataTestId, ...rest });
|
|
374
377
|
});
|
|
375
378
|
|
|
376
379
|
// src/components/avatar/index.tsx
|
|
@@ -406,9 +409,10 @@ function useStyles5({
|
|
|
406
409
|
|
|
407
410
|
// src/components/avatar/index.tsx
|
|
408
411
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
409
|
-
var Avatar = forwardRef5(function Avatar2({ size: size3, filled, className, children, ...rest }, ref) {
|
|
412
|
+
var Avatar = forwardRef5(function Avatar2({ size: size3, filled, className, children, testId, ...rest }, ref) {
|
|
410
413
|
const { root: root24 } = useStyles5({ size: size3, filled, className });
|
|
411
|
-
|
|
414
|
+
const { testId: dataTestId } = useTestId("media", testId);
|
|
415
|
+
return /* @__PURE__ */ jsx7("span", { ref, className: root24, "data-testid": dataTestId, ...rest, children });
|
|
412
416
|
});
|
|
413
417
|
|
|
414
418
|
// src/components/badge/index.tsx
|
|
@@ -438,11 +442,12 @@ function useStyles6({
|
|
|
438
442
|
|
|
439
443
|
// src/components/badge/index.tsx
|
|
440
444
|
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
441
|
-
var Badge = forwardRef6(function Badge2({ count, tone: tone4, className, children, ...rest }, ref) {
|
|
445
|
+
var Badge = forwardRef6(function Badge2({ count, tone: tone4, className, children, testId, ...rest }, ref) {
|
|
442
446
|
const { root: root24, dot: dot3 } = useStyles6({ tone: tone4, className });
|
|
443
|
-
|
|
447
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
448
|
+
return /* @__PURE__ */ jsxs3("span", { ref, className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
444
449
|
children,
|
|
445
|
-
count != null && /* @__PURE__ */ jsx8("span", { className: dot3, children: count })
|
|
450
|
+
count != null && /* @__PURE__ */ jsx8("span", { className: dot3, "data-testid": slot("dot"), children: count })
|
|
446
451
|
] });
|
|
447
452
|
});
|
|
448
453
|
|
|
@@ -481,9 +486,10 @@ function useStyles7({
|
|
|
481
486
|
|
|
482
487
|
// src/components/progress/index.tsx
|
|
483
488
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
484
|
-
var Progress = forwardRef7(function Progress2({ variant: variant2 = "linear", value, size: size3 = 20, className, ...rest }, ref) {
|
|
489
|
+
var Progress = forwardRef7(function Progress2({ variant: variant2 = "linear", value, size: size3 = 20, className, testId, ...rest }, ref) {
|
|
485
490
|
const { track: track4, bar: bar2, spinner: spinner2 } = useStyles7({ variant: variant2, value, className });
|
|
486
491
|
const indeterminate2 = value === void 0;
|
|
492
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
487
493
|
if (variant2 === "circular") {
|
|
488
494
|
return /* @__PURE__ */ jsx9(
|
|
489
495
|
"span",
|
|
@@ -495,6 +501,8 @@ var Progress = forwardRef7(function Progress2({ variant: variant2 = "linear", va
|
|
|
495
501
|
"aria-valuemin": indeterminate2 ? void 0 : 0,
|
|
496
502
|
"aria-valuemax": indeterminate2 ? void 0 : 100,
|
|
497
503
|
style: { width: size3, height: size3 },
|
|
504
|
+
"data-testid": dataTestId,
|
|
505
|
+
"data-state": states({ indeterminate: indeterminate2 }),
|
|
498
506
|
...rest
|
|
499
507
|
}
|
|
500
508
|
);
|
|
@@ -508,8 +516,17 @@ var Progress = forwardRef7(function Progress2({ variant: variant2 = "linear", va
|
|
|
508
516
|
"aria-valuenow": indeterminate2 ? void 0 : value,
|
|
509
517
|
"aria-valuemin": indeterminate2 ? void 0 : 0,
|
|
510
518
|
"aria-valuemax": indeterminate2 ? void 0 : 100,
|
|
519
|
+
"data-testid": dataTestId,
|
|
520
|
+
"data-state": states({ indeterminate: indeterminate2 }),
|
|
511
521
|
...rest,
|
|
512
|
-
children: /* @__PURE__ */ jsx9(
|
|
522
|
+
children: /* @__PURE__ */ jsx9(
|
|
523
|
+
"div",
|
|
524
|
+
{
|
|
525
|
+
className: bar2,
|
|
526
|
+
style: indeterminate2 ? void 0 : { width: `${value}%` },
|
|
527
|
+
"data-testid": slot("bar")
|
|
528
|
+
}
|
|
529
|
+
)
|
|
513
530
|
}
|
|
514
531
|
);
|
|
515
532
|
});
|
|
@@ -573,17 +590,39 @@ function useStyles8({
|
|
|
573
590
|
|
|
574
591
|
// src/components/chip/index.tsx
|
|
575
592
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
576
|
-
var Chip = forwardRef8(function Chip2({ selected: selected3, tone: tone4, onDelete, onClick, children, ...rest }, ref) {
|
|
593
|
+
var Chip = forwardRef8(function Chip2({ selected: selected3, tone: tone4, onDelete, onClick, children, testId, ...rest }, ref) {
|
|
577
594
|
const clickable2 = Boolean(onClick);
|
|
578
595
|
const { root: root24, deleteBtn: deleteBtn2 } = useStyles8({ selected: selected3, tone: tone4, clickable: clickable2 });
|
|
596
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
579
597
|
const handleDelete = (event) => {
|
|
580
598
|
event.stopPropagation();
|
|
581
599
|
onDelete?.();
|
|
582
600
|
};
|
|
583
|
-
return /* @__PURE__ */ jsxs5(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
601
|
+
return /* @__PURE__ */ jsxs5(
|
|
602
|
+
"span",
|
|
603
|
+
{
|
|
604
|
+
ref,
|
|
605
|
+
className: root24,
|
|
606
|
+
onClick,
|
|
607
|
+
"data-testid": dataTestId,
|
|
608
|
+
"data-state": states({ selected: selected3 }),
|
|
609
|
+
...rest,
|
|
610
|
+
children: [
|
|
611
|
+
children,
|
|
612
|
+
onDelete && /* @__PURE__ */ jsx11(
|
|
613
|
+
"button",
|
|
614
|
+
{
|
|
615
|
+
type: "button",
|
|
616
|
+
className: deleteBtn2,
|
|
617
|
+
"aria-label": "Remove",
|
|
618
|
+
onClick: handleDelete,
|
|
619
|
+
"data-testid": slot("delete"),
|
|
620
|
+
children: /* @__PURE__ */ jsx11(XIcon, { size: 13 })
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
);
|
|
587
626
|
});
|
|
588
627
|
|
|
589
628
|
// src/components/checkbox/index.tsx
|
|
@@ -638,13 +677,14 @@ function useStyles9({ checked, disabled: disabled3 }) {
|
|
|
638
677
|
|
|
639
678
|
// src/components/checkbox/index.tsx
|
|
640
679
|
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
641
|
-
var Checkbox = forwardRef9(function Checkbox2({ checked = false, onChange, label: label7, disabled: disabled3 = false, id, ...rest }, ref) {
|
|
680
|
+
var Checkbox = forwardRef9(function Checkbox2({ checked = false, onChange, label: label7, disabled: disabled3 = false, id, testId, ...rest }, ref) {
|
|
642
681
|
const { root: root24, input: input6, box: box2, check: check2 } = useStyles9({ checked, disabled: disabled3 });
|
|
682
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
643
683
|
const handleChange = (e) => {
|
|
644
684
|
if (disabled3) return;
|
|
645
685
|
onChange?.(e.target.checked);
|
|
646
686
|
};
|
|
647
|
-
return /* @__PURE__ */ jsxs6("label", { className: root24, children: [
|
|
687
|
+
return /* @__PURE__ */ jsxs6("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
648
688
|
/* @__PURE__ */ jsx13(
|
|
649
689
|
"input",
|
|
650
690
|
{
|
|
@@ -698,9 +738,10 @@ function useStyles10({
|
|
|
698
738
|
|
|
699
739
|
// src/components/radio/index.tsx
|
|
700
740
|
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
701
|
-
var Radio = forwardRef10(function Radio2({ checked, onChange, label: label7, name, value, disabled: disabled3, ...rest }, ref) {
|
|
741
|
+
var Radio = forwardRef10(function Radio2({ checked, onChange, label: label7, name, value, disabled: disabled3, testId, ...rest }, ref) {
|
|
702
742
|
const { root: root24, input: input6, circle: circle2, dot: dot3, label: labelClass } = useStyles10({ disabled: disabled3 });
|
|
703
|
-
|
|
743
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
744
|
+
return /* @__PURE__ */ jsxs7("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
704
745
|
/* @__PURE__ */ jsx14(
|
|
705
746
|
"input",
|
|
706
747
|
{
|
|
@@ -752,9 +793,10 @@ function useStyles11({ checked }) {
|
|
|
752
793
|
|
|
753
794
|
// src/components/switch/index.tsx
|
|
754
795
|
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
755
|
-
var Switch = forwardRef11(function Switch2({ checked = false, onChange, label: label7, disabled: disabled3, ...rest }, ref) {
|
|
796
|
+
var Switch = forwardRef11(function Switch2({ checked = false, onChange, label: label7, disabled: disabled3, testId, ...rest }, ref) {
|
|
756
797
|
const { root: root24, input: input6, track: track4, knob: knob2, label: labelClass } = useStyles11({ checked });
|
|
757
|
-
|
|
798
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
799
|
+
return /* @__PURE__ */ jsxs8("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
758
800
|
/* @__PURE__ */ jsx15(
|
|
759
801
|
"input",
|
|
760
802
|
{
|
|
@@ -1183,9 +1225,10 @@ function useStyles15() {
|
|
|
1183
1225
|
|
|
1184
1226
|
// src/components/card/index.tsx
|
|
1185
1227
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1186
|
-
var CardRoot = forwardRef17(function Card({ children, ...rest }, ref) {
|
|
1228
|
+
var CardRoot = forwardRef17(function Card({ children, testId, ...rest }, ref) {
|
|
1187
1229
|
const { root: root24 } = useStyles15();
|
|
1188
|
-
|
|
1230
|
+
const { testId: dataTestId } = useTestId("layout", testId);
|
|
1231
|
+
return /* @__PURE__ */ jsx23("div", { ref, className: root24, "data-testid": dataTestId, ...rest, children });
|
|
1189
1232
|
});
|
|
1190
1233
|
function CardHeader({ children, ...rest }) {
|
|
1191
1234
|
const { header: header3 } = useStyles15();
|
|
@@ -1349,12 +1392,13 @@ var defaultIcons = {
|
|
|
1349
1392
|
warn: TriangleAlertIcon,
|
|
1350
1393
|
danger: CircleXIcon
|
|
1351
1394
|
};
|
|
1352
|
-
var Alert = forwardRef18(function Alert2({ severity: severity2 = "info", title, icon, className, children, ...rest }, ref) {
|
|
1395
|
+
var Alert = forwardRef18(function Alert2({ severity: severity2 = "info", title, icon, className, testId, children, ...rest }, ref) {
|
|
1353
1396
|
const styles = useStyles16({ severity: severity2, className });
|
|
1397
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
1354
1398
|
const IconComponent = icon ?? defaultIcons[severity2];
|
|
1355
|
-
return /* @__PURE__ */ jsxs16("div", { ref, role: "alert", className: styles.root, ...rest, children: [
|
|
1356
|
-
/* @__PURE__ */ jsx28("span", { className: styles.iconSlot, children: /* @__PURE__ */ jsx28(IconComponent, {}) }),
|
|
1357
|
-
/* @__PURE__ */ jsxs16("div", { className: styles.content, children: [
|
|
1399
|
+
return /* @__PURE__ */ jsxs16("div", { ref, role: "alert", className: styles.root, "data-testid": dataTestId, ...rest, children: [
|
|
1400
|
+
/* @__PURE__ */ jsx28("span", { className: styles.iconSlot, "data-testid": slot("icon"), children: /* @__PURE__ */ jsx28(IconComponent, {}) }),
|
|
1401
|
+
/* @__PURE__ */ jsxs16("div", { className: styles.content, "data-testid": slot("content"), children: [
|
|
1358
1402
|
title != null && /* @__PURE__ */ jsx28(Typography, { variant: "h4", children: title }),
|
|
1359
1403
|
children != null && /* @__PURE__ */ jsx28(Typography, { variant: "body", color: "fg2", children })
|
|
1360
1404
|
] })
|
|
@@ -1398,10 +1442,11 @@ function useStyles17({
|
|
|
1398
1442
|
// src/components/tooltip/index.tsx
|
|
1399
1443
|
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1400
1444
|
var HIDE_DELAY = 120;
|
|
1401
|
-
var Tooltip = forwardRef19(function Tooltip2({ label: label7, children, placement: placement2 }, ref) {
|
|
1445
|
+
var Tooltip = forwardRef19(function Tooltip2({ label: label7, children, placement: placement2, testId }, ref) {
|
|
1402
1446
|
const [open, setOpen] = useState5(false);
|
|
1403
1447
|
const tooltipId = useId2();
|
|
1404
1448
|
const { wrapper: wrapper4, bubble: bubble2 } = useStyles17({ placement: placement2 });
|
|
1449
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
1405
1450
|
const hideTimer = useRef2(null);
|
|
1406
1451
|
const clearHide = () => {
|
|
1407
1452
|
if (hideTimer.current) {
|
|
@@ -1440,6 +1485,7 @@ var Tooltip = forwardRef19(function Tooltip2({ label: label7, children, placemen
|
|
|
1440
1485
|
{
|
|
1441
1486
|
ref,
|
|
1442
1487
|
className: wrapper4,
|
|
1488
|
+
"data-testid": dataTestId,
|
|
1443
1489
|
onMouseEnter: show,
|
|
1444
1490
|
onMouseLeave: scheduleHide,
|
|
1445
1491
|
onFocus: show,
|
|
@@ -1453,6 +1499,7 @@ var Tooltip = forwardRef19(function Tooltip2({ label: label7, children, placemen
|
|
|
1453
1499
|
id: tooltipId,
|
|
1454
1500
|
role: "tooltip",
|
|
1455
1501
|
className: bubble2,
|
|
1502
|
+
"data-testid": slot("bubble"),
|
|
1456
1503
|
onMouseEnter: show,
|
|
1457
1504
|
onMouseLeave: scheduleHide,
|
|
1458
1505
|
children: label7
|
|
@@ -1753,9 +1800,10 @@ function useStyles20({ className }) {
|
|
|
1753
1800
|
|
|
1754
1801
|
// src/components/accordion/index.tsx
|
|
1755
1802
|
import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1756
|
-
var Accordion = forwardRef22(function Accordion2({ items, multiple = false, defaultOpen = [], className }, ref) {
|
|
1803
|
+
var Accordion = forwardRef22(function Accordion2({ items, multiple = false, defaultOpen = [], className, testId }, ref) {
|
|
1757
1804
|
const [open, setOpen] = useState7(defaultOpen);
|
|
1758
1805
|
const { root: root24, item: item3, header: header3, chevronFor, panel: panel3 } = useStyles20({ className });
|
|
1806
|
+
const { testId: dataTestId, slot } = useTestId("layout", testId);
|
|
1759
1807
|
const toggle = (id) => {
|
|
1760
1808
|
setOpen((current2) => {
|
|
1761
1809
|
const isOpen = current2.includes(id);
|
|
@@ -1763,28 +1811,49 @@ var Accordion = forwardRef22(function Accordion2({ items, multiple = false, defa
|
|
|
1763
1811
|
return multiple ? [...current2, id] : [id];
|
|
1764
1812
|
});
|
|
1765
1813
|
};
|
|
1766
|
-
return /* @__PURE__ */ jsx33("div", { ref, className: root24, children: items.map((it) => {
|
|
1814
|
+
return /* @__PURE__ */ jsx33("div", { ref, className: root24, "data-testid": dataTestId, children: items.map((it) => {
|
|
1767
1815
|
const isOpen = open.includes(it.id);
|
|
1768
1816
|
const panelId = `accordion-panel-${it.id}`;
|
|
1769
1817
|
const headerId = `accordion-header-${it.id}`;
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1818
|
+
const itemSlot = slot(`item-${it.id}`);
|
|
1819
|
+
return /* @__PURE__ */ jsxs20(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
className: item3,
|
|
1823
|
+
"data-testid": itemSlot,
|
|
1824
|
+
"data-state": states({ expanded: isOpen }),
|
|
1825
|
+
children: [
|
|
1826
|
+
/* @__PURE__ */ jsxs20(
|
|
1827
|
+
"button",
|
|
1828
|
+
{
|
|
1829
|
+
type: "button",
|
|
1830
|
+
id: headerId,
|
|
1831
|
+
className: header3,
|
|
1832
|
+
"aria-expanded": isOpen,
|
|
1833
|
+
"aria-controls": panelId,
|
|
1834
|
+
"data-testid": `${itemSlot}__trigger`,
|
|
1835
|
+
onClick: () => toggle(it.id),
|
|
1836
|
+
children: [
|
|
1837
|
+
it.title,
|
|
1838
|
+
/* @__PURE__ */ jsx33(ChevronDownIcon, { className: chevronFor(isOpen) })
|
|
1839
|
+
]
|
|
1840
|
+
}
|
|
1841
|
+
),
|
|
1842
|
+
isOpen && /* @__PURE__ */ jsx33(
|
|
1843
|
+
"div",
|
|
1844
|
+
{
|
|
1845
|
+
id: panelId,
|
|
1846
|
+
className: panel3,
|
|
1847
|
+
role: "region",
|
|
1848
|
+
"aria-labelledby": headerId,
|
|
1849
|
+
"data-testid": `${itemSlot}__panel`,
|
|
1850
|
+
children: it.content
|
|
1851
|
+
}
|
|
1852
|
+
)
|
|
1853
|
+
]
|
|
1854
|
+
},
|
|
1855
|
+
it.id
|
|
1856
|
+
);
|
|
1788
1857
|
}) });
|
|
1789
1858
|
});
|
|
1790
1859
|
|
|
@@ -1834,13 +1903,14 @@ function useStyles21({ className }) {
|
|
|
1834
1903
|
|
|
1835
1904
|
// src/components/breadcrumbs/index.tsx
|
|
1836
1905
|
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1837
|
-
var Breadcrumbs = forwardRef23(function Breadcrumbs2({ items, className, ...rest }, ref) {
|
|
1906
|
+
var Breadcrumbs = forwardRef23(function Breadcrumbs2({ items, className, testId, ...rest }, ref) {
|
|
1838
1907
|
const { root: root24, crumb: crumb2, current: current2, separator: separator2 } = useStyles21({ className });
|
|
1839
|
-
|
|
1908
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
1909
|
+
return /* @__PURE__ */ jsx35("nav", { ref, "aria-label": "Breadcrumb", className: root24, "data-testid": dataTestId, ...rest, children: items.map((item3, index) => {
|
|
1840
1910
|
const isLast = index === items.length - 1;
|
|
1841
1911
|
const key = index;
|
|
1842
1912
|
return /* @__PURE__ */ jsxs21(Fragment, { children: [
|
|
1843
|
-
isLast ? /* @__PURE__ */ jsx35("span", { className: current2, "aria-current": "page", children: item3.label }) : item3.href ? /* @__PURE__ */ jsx35("a", { className: crumb2, href: item3.href, children: item3.label }) : /* @__PURE__ */ jsx35("span", { className: crumb2, children: item3.label }),
|
|
1913
|
+
isLast ? /* @__PURE__ */ jsx35("span", { className: current2, "aria-current": "page", "data-testid": slot(`crumb-${index}`), children: item3.label }) : item3.href ? /* @__PURE__ */ jsx35("a", { className: crumb2, href: item3.href, "data-testid": slot(`crumb-${index}`), children: item3.label }) : /* @__PURE__ */ jsx35("span", { className: crumb2, "data-testid": slot(`crumb-${index}`), children: item3.label }),
|
|
1844
1914
|
!isLast && /* @__PURE__ */ jsx35("span", { className: separator2, children: /* @__PURE__ */ jsx35(ChevronRightIcon, { size: 14 }) })
|
|
1845
1915
|
] }, key);
|
|
1846
1916
|
}) });
|
|
@@ -1910,13 +1980,14 @@ function buildItems(count, page, siblingCount) {
|
|
|
1910
1980
|
if (last > first) items.push(last);
|
|
1911
1981
|
return items;
|
|
1912
1982
|
}
|
|
1913
|
-
var Pagination = forwardRef24(function Pagination2({ count, page = 1, onChange, siblingCount = 1, ...rest }, ref) {
|
|
1983
|
+
var Pagination = forwardRef24(function Pagination2({ count, page = 1, onChange, siblingCount = 1, testId, ...rest }, ref) {
|
|
1914
1984
|
const { root: root24, pageBtnFor, ellipsis: ellipsis2, nav: nav2 } = useStyles22();
|
|
1985
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
1915
1986
|
const total = Math.max(1, count);
|
|
1916
1987
|
const current2 = Math.min(Math.max(1, page), total);
|
|
1917
1988
|
const items = buildItems(total, current2, siblingCount);
|
|
1918
1989
|
const go = (n) => onChange?.(Math.min(Math.max(1, n), total));
|
|
1919
|
-
return /* @__PURE__ */ jsxs22("nav", { ref, className: root24, "aria-label": "Pagination", ...rest, children: [
|
|
1990
|
+
return /* @__PURE__ */ jsxs22("nav", { ref, className: root24, "aria-label": "Pagination", "data-testid": dataTestId, ...rest, children: [
|
|
1920
1991
|
/* @__PURE__ */ jsx37(
|
|
1921
1992
|
"button",
|
|
1922
1993
|
{
|
|
@@ -1924,20 +1995,27 @@ var Pagination = forwardRef24(function Pagination2({ count, page = 1, onChange,
|
|
|
1924
1995
|
className: nav2,
|
|
1925
1996
|
"aria-label": "Previous page",
|
|
1926
1997
|
disabled: current2 <= 1,
|
|
1998
|
+
"data-testid": slot("prev"),
|
|
1927
1999
|
onClick: () => go(current2 - 1),
|
|
1928
2000
|
children: /* @__PURE__ */ jsx37(ChevronLeftIcon, { size: 18 })
|
|
1929
2001
|
}
|
|
1930
2002
|
),
|
|
1931
2003
|
items.map(
|
|
1932
|
-
(item3, index) => item3 === "ellipsis" ? (
|
|
1933
|
-
|
|
1934
|
-
|
|
2004
|
+
(item3, index) => item3 === "ellipsis" ? /* @__PURE__ */ jsx37(
|
|
2005
|
+
"span",
|
|
2006
|
+
{
|
|
2007
|
+
className: ellipsis2,
|
|
2008
|
+
"data-testid": slot(`ellipsis-${index}`),
|
|
2009
|
+
children: "\u2026"
|
|
2010
|
+
},
|
|
2011
|
+
`ellipsis-${index}`
|
|
1935
2012
|
) : /* @__PURE__ */ jsx37(
|
|
1936
2013
|
"button",
|
|
1937
2014
|
{
|
|
1938
2015
|
type: "button",
|
|
1939
2016
|
className: pageBtnFor(item3 === current2),
|
|
1940
2017
|
"aria-current": item3 === current2 ? "page" : void 0,
|
|
2018
|
+
"data-testid": slot(`page-${item3}`),
|
|
1941
2019
|
onClick: () => go(item3),
|
|
1942
2020
|
children: item3
|
|
1943
2021
|
},
|
|
@@ -1951,6 +2029,7 @@ var Pagination = forwardRef24(function Pagination2({ count, page = 1, onChange,
|
|
|
1951
2029
|
className: nav2,
|
|
1952
2030
|
"aria-label": "Next page",
|
|
1953
2031
|
disabled: current2 >= total,
|
|
2032
|
+
"data-testid": slot("next"),
|
|
1954
2033
|
onClick: () => go(current2 + 1),
|
|
1955
2034
|
children: /* @__PURE__ */ jsx37(ChevronRightIcon, { size: 18 })
|
|
1956
2035
|
}
|
|
@@ -1991,18 +2070,28 @@ function useStyles23({ className }) {
|
|
|
1991
2070
|
|
|
1992
2071
|
// src/components/stepper/index.tsx
|
|
1993
2072
|
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1994
|
-
var Stepper = forwardRef25(function Stepper2({ steps, active: active2 = 0, className, ...rest }, ref) {
|
|
2073
|
+
var Stepper = forwardRef25(function Stepper2({ steps, active: active2 = 0, className, testId, ...rest }, ref) {
|
|
1995
2074
|
const { root: root24, step: step2, connector: connector2, markerFor, labelFor } = useStyles23({ className });
|
|
1996
|
-
|
|
2075
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2076
|
+
return /* @__PURE__ */ jsx38("div", { ref, className: root24, "data-testid": dataTestId, ...rest, children: steps.map((s, index) => {
|
|
1997
2077
|
const state = index < active2 ? "done" : index === active2 ? "active" : "upcoming";
|
|
1998
2078
|
const isActive = state === "active";
|
|
1999
2079
|
return (
|
|
2000
2080
|
// biome-ignore lint/suspicious/noArrayIndexKey: steps are a static, ordered list with no stable id.
|
|
2001
2081
|
/* @__PURE__ */ jsxs23(Fragment2, { children: [
|
|
2002
|
-
/* @__PURE__ */ jsxs23(
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2082
|
+
/* @__PURE__ */ jsxs23(
|
|
2083
|
+
"div",
|
|
2084
|
+
{
|
|
2085
|
+
className: step2,
|
|
2086
|
+
"aria-current": isActive ? "step" : void 0,
|
|
2087
|
+
"data-testid": slot(`step-${index}`),
|
|
2088
|
+
"data-state": states({ done: state === "done", active: isActive }),
|
|
2089
|
+
children: [
|
|
2090
|
+
/* @__PURE__ */ jsx38("span", { className: markerFor(state), children: state === "done" ? /* @__PURE__ */ jsx38(CheckIcon, { size: 14 }) : index + 1 }),
|
|
2091
|
+
/* @__PURE__ */ jsx38("span", { className: labelFor(isActive), children: s.label })
|
|
2092
|
+
]
|
|
2093
|
+
}
|
|
2094
|
+
),
|
|
2006
2095
|
index < steps.length - 1 && /* @__PURE__ */ jsx38("span", { "data-part": "connector", className: connector2 })
|
|
2007
2096
|
] }, index)
|
|
2008
2097
|
);
|
|
@@ -2033,8 +2122,9 @@ function useStyles24() {
|
|
|
2033
2122
|
|
|
2034
2123
|
// src/components/tabs/index.tsx
|
|
2035
2124
|
import { Fragment as Fragment3, jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2036
|
-
var Tabs = forwardRef26(function Tabs2({ items, value, onChange, ...rest }, ref) {
|
|
2125
|
+
var Tabs = forwardRef26(function Tabs2({ items, value, onChange, testId, ...rest }, ref) {
|
|
2037
2126
|
const { root: root24, tabClass, panel: panel3 } = useStyles24();
|
|
2127
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2038
2128
|
const baseId = useId4();
|
|
2039
2129
|
const tabRefs = useRef4([]);
|
|
2040
2130
|
const hasPanels = items.some((item3) => item3.content !== void 0);
|
|
@@ -2069,7 +2159,7 @@ var Tabs = forwardRef26(function Tabs2({ items, value, onChange, ...rest }, ref)
|
|
|
2069
2159
|
}
|
|
2070
2160
|
};
|
|
2071
2161
|
return /* @__PURE__ */ jsxs24(Fragment3, { children: [
|
|
2072
|
-
/* @__PURE__ */ jsx39("div", { ref, role: "tablist", className: root24, ...rest, children: items.map((item3, index) => {
|
|
2162
|
+
/* @__PURE__ */ jsx39("div", { ref, role: "tablist", className: root24, "data-testid": dataTestId, ...rest, children: items.map((item3, index) => {
|
|
2073
2163
|
const active2 = item3.value === value;
|
|
2074
2164
|
const tabbable = active2 || activeIndex === -1 && index === 0;
|
|
2075
2165
|
return /* @__PURE__ */ jsx39(
|
|
@@ -2085,6 +2175,8 @@ var Tabs = forwardRef26(function Tabs2({ items, value, onChange, ...rest }, ref)
|
|
|
2085
2175
|
"aria-controls": hasPanels ? panelId(item3.value) : void 0,
|
|
2086
2176
|
tabIndex: tabbable ? 0 : -1,
|
|
2087
2177
|
className: tabClass(active2),
|
|
2178
|
+
"data-testid": slot(`tab-${index}`),
|
|
2179
|
+
"data-state": states({ selected: active2 }),
|
|
2088
2180
|
onClick: () => onChange?.(item3.value),
|
|
2089
2181
|
onKeyDown: (event) => onKeyDown(event, index),
|
|
2090
2182
|
children: item3.label
|
|
@@ -2101,6 +2193,7 @@ var Tabs = forwardRef26(function Tabs2({ items, value, onChange, ...rest }, ref)
|
|
|
2101
2193
|
hidden: item3.value !== value,
|
|
2102
2194
|
tabIndex: 0,
|
|
2103
2195
|
className: panel3,
|
|
2196
|
+
"data-testid": slot(`panel-${item3.value}`),
|
|
2104
2197
|
children: item3.content
|
|
2105
2198
|
},
|
|
2106
2199
|
item3.value
|
|
@@ -2440,14 +2533,25 @@ function useStyles27() {
|
|
|
2440
2533
|
|
|
2441
2534
|
// src/components/snackbar/index.tsx
|
|
2442
2535
|
import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2443
|
-
var Snackbar = forwardRef29(function Snackbar2({ open, message: message2, action, onClose }, ref) {
|
|
2536
|
+
var Snackbar = forwardRef29(function Snackbar2({ open, message: message2, action, onClose, testId }, ref) {
|
|
2444
2537
|
const { root: root24, message: messageClass, closeBtn: closeBtn2 } = useStyles27();
|
|
2538
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
2445
2539
|
if (!open || typeof document === "undefined") return null;
|
|
2446
2540
|
return createPortal2(
|
|
2447
|
-
/* @__PURE__ */ jsxs27("div", { ref, role: "status", className: root24, children: [
|
|
2448
|
-
/* @__PURE__ */ jsx42("span", { className: messageClass, children: message2 }),
|
|
2541
|
+
/* @__PURE__ */ jsxs27("div", { ref, role: "status", className: root24, "data-testid": dataTestId, children: [
|
|
2542
|
+
/* @__PURE__ */ jsx42("span", { className: messageClass, "data-testid": slot("message"), children: message2 }),
|
|
2449
2543
|
action,
|
|
2450
|
-
onClose && /* @__PURE__ */ jsx42(
|
|
2544
|
+
onClose && /* @__PURE__ */ jsx42(
|
|
2545
|
+
"button",
|
|
2546
|
+
{
|
|
2547
|
+
type: "button",
|
|
2548
|
+
"aria-label": "Close",
|
|
2549
|
+
className: closeBtn2,
|
|
2550
|
+
"data-testid": slot("close"),
|
|
2551
|
+
onClick: onClose,
|
|
2552
|
+
children: /* @__PURE__ */ jsx42(XIcon, { size: 18 })
|
|
2553
|
+
}
|
|
2554
|
+
)
|
|
2451
2555
|
] }),
|
|
2452
2556
|
document.body
|
|
2453
2557
|
);
|
|
@@ -2484,14 +2588,15 @@ function useStyles28({ className }) {
|
|
|
2484
2588
|
|
|
2485
2589
|
// src/components/table/index.tsx
|
|
2486
2590
|
import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2487
|
-
function TableInner({ columns, rows, getRowKey, className, caption: caption2, ...rest }, ref) {
|
|
2591
|
+
function TableInner({ columns, rows, getRowKey, className, caption: caption2, testId, ...rest }, ref) {
|
|
2488
2592
|
const { root: root24, th: th2, td: td2, alignRight: alignRight2, caption: captionClass } = useStyles28({ className });
|
|
2593
|
+
const { testId: dataTestId, slot } = useTestId("list", testId);
|
|
2489
2594
|
const headClass = (column) => column.align === "right" ? `${th2} ${alignRight2}` : th2;
|
|
2490
2595
|
const cellClass = (column) => column.align === "right" ? `${td2} ${alignRight2}` : td2;
|
|
2491
|
-
return /* @__PURE__ */ jsxs28("table", { ref, className: root24, ...rest, children: [
|
|
2596
|
+
return /* @__PURE__ */ jsxs28("table", { ref, className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
2492
2597
|
caption2 != null && /* @__PURE__ */ jsx43("caption", { className: captionClass, children: caption2 }),
|
|
2493
2598
|
/* @__PURE__ */ jsx43("thead", { children: /* @__PURE__ */ jsx43("tr", { children: columns.map((column) => /* @__PURE__ */ jsx43("th", { scope: "col", className: headClass(column), children: column.header }, column.key)) }) }),
|
|
2494
|
-
/* @__PURE__ */ jsx43("tbody", { children: rows.map((row, index) => /* @__PURE__ */ jsx43("tr", { children: columns.map((column) => /* @__PURE__ */ jsx43("td", { className: cellClass(column), children: column.render ? column.render(row) : String(row[column.key]) }, column.key)) }, getRowKey ? getRowKey(row, index) : index)) })
|
|
2599
|
+
/* @__PURE__ */ jsx43("tbody", { children: rows.map((row, index) => /* @__PURE__ */ jsx43("tr", { "data-testid": slot(`row-${index}`), children: columns.map((column) => /* @__PURE__ */ jsx43("td", { className: cellClass(column), children: column.render ? column.render(row) : String(row[column.key]) }, column.key)) }, getRowKey ? getRowKey(row, index) : index)) })
|
|
2495
2600
|
] });
|
|
2496
2601
|
}
|
|
2497
2602
|
var TableForwarded = forwardRef30(TableInner);
|
|
@@ -2521,12 +2626,13 @@ function useStyles29({ className }) {
|
|
|
2521
2626
|
|
|
2522
2627
|
// src/components/app-bar/index.tsx
|
|
2523
2628
|
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2524
|
-
var AppBar = forwardRef31(function AppBar2({ brand: brand2, actions: actions3, className, children, ...rest }, ref) {
|
|
2629
|
+
var AppBar = forwardRef31(function AppBar2({ brand: brand2, actions: actions3, className, children, testId, ...rest }, ref) {
|
|
2525
2630
|
const styles = useStyles29({ className });
|
|
2526
|
-
|
|
2527
|
-
|
|
2631
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2632
|
+
return /* @__PURE__ */ jsxs29("header", { ref, className: styles.root, "data-testid": dataTestId, ...rest, children: [
|
|
2633
|
+
brand2 !== void 0 ? /* @__PURE__ */ jsx44("div", { className: styles.brand, "data-testid": slot("brand"), children: brand2 }) : null,
|
|
2528
2634
|
children,
|
|
2529
|
-
actions3 !== void 0 ? /* @__PURE__ */ jsx44("div", { className: styles.actions, children: actions3 }) : null
|
|
2635
|
+
actions3 !== void 0 ? /* @__PURE__ */ jsx44("div", { className: styles.actions, "data-testid": slot("actions"), children: actions3 }) : null
|
|
2530
2636
|
] });
|
|
2531
2637
|
});
|
|
2532
2638
|
|
|
@@ -2558,13 +2664,24 @@ function useStyles30({
|
|
|
2558
2664
|
|
|
2559
2665
|
// src/components/list-item/index.tsx
|
|
2560
2666
|
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2561
|
-
var ListItem = forwardRef32(function ListItem2({ leading: leading2, trailing: trailing2, selected: selected3, className, children, ...rest }, ref) {
|
|
2667
|
+
var ListItem = forwardRef32(function ListItem2({ leading: leading2, trailing: trailing2, selected: selected3, className, testId, children, ...rest }, ref) {
|
|
2562
2668
|
const styles = useStyles30({ selected: selected3, className });
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2669
|
+
const { testId: dataTestId, slot } = useTestId("list", testId);
|
|
2670
|
+
return /* @__PURE__ */ jsxs30(
|
|
2671
|
+
"div",
|
|
2672
|
+
{
|
|
2673
|
+
ref,
|
|
2674
|
+
className: styles.root,
|
|
2675
|
+
"data-testid": dataTestId,
|
|
2676
|
+
"data-state": states({ selected: selected3 }),
|
|
2677
|
+
...rest,
|
|
2678
|
+
children: [
|
|
2679
|
+
leading2 != null && /* @__PURE__ */ jsx45("span", { className: styles.leading, "data-testid": slot("leading"), children: leading2 }),
|
|
2680
|
+
/* @__PURE__ */ jsx45("span", { className: styles.content, "data-testid": slot("content"), children }),
|
|
2681
|
+
trailing2 != null && /* @__PURE__ */ jsx45("span", { className: styles.trailing, "data-testid": slot("trailing"), children: trailing2 })
|
|
2682
|
+
]
|
|
2683
|
+
}
|
|
2684
|
+
);
|
|
2568
2685
|
});
|
|
2569
2686
|
|
|
2570
2687
|
// src/components/icons/chevron-up/index.tsx
|