@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.cjs
CHANGED
|
@@ -108,7 +108,47 @@ function useToggle(initial = false) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// src/components/container/index.tsx
|
|
111
|
+
var import_react5 = require("react");
|
|
112
|
+
|
|
113
|
+
// src/testing/use-test-id.ts
|
|
114
|
+
var import_react4 = require("react");
|
|
115
|
+
|
|
116
|
+
// src/testing/compose.ts
|
|
117
|
+
function normalizeSegment(seg) {
|
|
118
|
+
return seg.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
119
|
+
}
|
|
120
|
+
function composeTestId(parts) {
|
|
121
|
+
return parts.filter((p) => typeof p === "string" && p.trim() !== "").map(normalizeSegment).join("__");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/testing/context/test-id-context.tsx
|
|
111
125
|
var import_react3 = require("react");
|
|
126
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
127
|
+
var TestIdContext = (0, import_react3.createContext)([]);
|
|
128
|
+
function TestIdProvider({ context, children }) {
|
|
129
|
+
const parent = (0, import_react3.useContext)(TestIdContext);
|
|
130
|
+
const value = (0, import_react3.useMemo)(
|
|
131
|
+
() => [...parent, normalizeSegment(context)].filter((seg) => seg !== ""),
|
|
132
|
+
[parent, context]
|
|
133
|
+
);
|
|
134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TestIdContext.Provider, { value, children });
|
|
135
|
+
}
|
|
136
|
+
function useTestIdContext() {
|
|
137
|
+
return (0, import_react3.useContext)(TestIdContext);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/testing/use-test-id.ts
|
|
141
|
+
function useTestId(type, ownTestId) {
|
|
142
|
+
const ctx = useTestIdContext();
|
|
143
|
+
const testId = composeTestId([type, ...ctx, ownTestId]);
|
|
144
|
+
return (0, import_react4.useMemo)(
|
|
145
|
+
() => ({
|
|
146
|
+
testId,
|
|
147
|
+
slot: (name) => `${testId}__${normalizeSegment(name)}`
|
|
148
|
+
}),
|
|
149
|
+
[testId]
|
|
150
|
+
);
|
|
151
|
+
}
|
|
112
152
|
|
|
113
153
|
// src/theme/styles/sprinkles/index.css.ts
|
|
114
154
|
var import_createRuntimeSprinkles = require("@vanilla-extract/sprinkles/createRuntimeSprinkles");
|
|
@@ -130,25 +170,26 @@ function useStyles(props) {
|
|
|
130
170
|
}
|
|
131
171
|
|
|
132
172
|
// src/components/container/index.tsx
|
|
133
|
-
var
|
|
134
|
-
function ContainerImpl({ as, ...props }, ref) {
|
|
173
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
174
|
+
function ContainerImpl({ as, testId, ...props }, ref) {
|
|
135
175
|
const Component = as ?? "div";
|
|
136
176
|
const { className, rest } = useStyles(props);
|
|
137
|
-
|
|
177
|
+
const { testId: dataTestId } = useTestId("layout", testId);
|
|
178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ref, "data-testid": dataTestId, ...rest, className });
|
|
138
179
|
}
|
|
139
|
-
var ContainerForwarded = (0,
|
|
180
|
+
var ContainerForwarded = (0, import_react5.forwardRef)(ContainerImpl);
|
|
140
181
|
ContainerForwarded.displayName = "Container";
|
|
141
182
|
var Container = ContainerForwarded;
|
|
142
183
|
|
|
143
184
|
// src/components/typography/index.tsx
|
|
144
|
-
var
|
|
185
|
+
var import_react8 = require("react");
|
|
145
186
|
|
|
146
187
|
// src/components/typography/use-styles.ts
|
|
147
|
-
var
|
|
188
|
+
var import_react7 = require("react");
|
|
148
189
|
|
|
149
190
|
// src/theme/context/theme-context.tsx
|
|
150
|
-
var
|
|
151
|
-
var
|
|
191
|
+
var import_react6 = require("react");
|
|
192
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
152
193
|
var noop = () => {
|
|
153
194
|
};
|
|
154
195
|
var DEFAULT_VALUE = {
|
|
@@ -161,7 +202,7 @@ var DEFAULT_VALUE = {
|
|
|
161
202
|
toggleMode: noop,
|
|
162
203
|
cycleMode: noop
|
|
163
204
|
};
|
|
164
|
-
var ThemeContext = (0,
|
|
205
|
+
var ThemeContext = (0, import_react6.createContext)(null);
|
|
165
206
|
function resolveSystemMode() {
|
|
166
207
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return "light";
|
|
167
208
|
if (window.matchMedia("(prefers-contrast: more)").matches) return "contrast";
|
|
@@ -191,14 +232,14 @@ function ThemeProvider({
|
|
|
191
232
|
storageKey = "ds-theme",
|
|
192
233
|
persist = true
|
|
193
234
|
}) {
|
|
194
|
-
const [schema, setSchema] = (0,
|
|
235
|
+
const [schema, setSchema] = (0, import_react6.useState)(
|
|
195
236
|
() => persist && readStored(storageKey)?.schema || defaultSchema
|
|
196
237
|
);
|
|
197
|
-
const [preference, setPreference] = (0,
|
|
238
|
+
const [preference, setPreference] = (0, import_react6.useState)(
|
|
198
239
|
() => (persist ? readStored(storageKey)?.preference : null) ?? defaultMode
|
|
199
240
|
);
|
|
200
|
-
const [systemMode, setSystemMode] = (0,
|
|
201
|
-
(0,
|
|
241
|
+
const [systemMode, setSystemMode] = (0, import_react6.useState)(resolveSystemMode);
|
|
242
|
+
(0, import_react6.useEffect)(() => {
|
|
202
243
|
if (preference !== "system") return;
|
|
203
244
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
204
245
|
const mqls = ["(prefers-contrast: more)", "(prefers-color-scheme: dark)"].map(
|
|
@@ -212,10 +253,10 @@ function ThemeProvider({
|
|
|
212
253
|
};
|
|
213
254
|
}, [preference]);
|
|
214
255
|
const mode = preference === "system" ? systemMode : preference;
|
|
215
|
-
(0,
|
|
256
|
+
(0, import_react6.useEffect)(() => {
|
|
216
257
|
if (persist) writeStored(storageKey, { schema, preference });
|
|
217
258
|
}, [schema, preference, persist, storageKey]);
|
|
218
|
-
const value = (0,
|
|
259
|
+
const value = (0, import_react6.useMemo)(
|
|
219
260
|
() => ({
|
|
220
261
|
schema,
|
|
221
262
|
mode,
|
|
@@ -231,10 +272,10 @@ function ThemeProvider({
|
|
|
231
272
|
}),
|
|
232
273
|
[schema, mode, preference]
|
|
233
274
|
);
|
|
234
|
-
return /* @__PURE__ */ (0,
|
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ThemeContext.Provider, { value, children });
|
|
235
276
|
}
|
|
236
277
|
function useTheme() {
|
|
237
|
-
return (0,
|
|
278
|
+
return (0, import_react6.useContext)(ThemeContext) ?? DEFAULT_VALUE;
|
|
238
279
|
}
|
|
239
280
|
|
|
240
281
|
// src/theme/typography.css.ts
|
|
@@ -252,7 +293,7 @@ function useStyles2({
|
|
|
252
293
|
align: align2
|
|
253
294
|
}) {
|
|
254
295
|
const { themeClass } = useTheme();
|
|
255
|
-
const className = (0,
|
|
296
|
+
const className = (0, import_react7.useMemo)(
|
|
256
297
|
() => [
|
|
257
298
|
themeClass,
|
|
258
299
|
base,
|
|
@@ -266,7 +307,7 @@ function useStyles2({
|
|
|
266
307
|
}
|
|
267
308
|
|
|
268
309
|
// src/components/typography/index.tsx
|
|
269
|
-
var
|
|
310
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
270
311
|
var defaultElement = {
|
|
271
312
|
display: "h1",
|
|
272
313
|
h1: "h1",
|
|
@@ -281,12 +322,13 @@ var defaultElement = {
|
|
|
281
322
|
code: "code",
|
|
282
323
|
blackletter: "span"
|
|
283
324
|
};
|
|
284
|
-
function TypographyInner({ variant: variant2, as, color: color2, align: align2, ...rest }, ref) {
|
|
325
|
+
function TypographyInner({ variant: variant2, as, color: color2, align: align2, testId, ...rest }, ref) {
|
|
285
326
|
const Component = as ?? defaultElement[variant2];
|
|
286
327
|
const { text: text2 } = useStyles2({ variant: variant2, color: color2, align: align2 });
|
|
287
|
-
|
|
328
|
+
const { testId: dataTestId } = useTestId("text", testId);
|
|
329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ref, "data-testid": dataTestId, ...rest, className: text2 });
|
|
288
330
|
}
|
|
289
|
-
var TypographyForwarded = (0,
|
|
331
|
+
var TypographyForwarded = (0, import_react8.forwardRef)(
|
|
290
332
|
TypographyInner
|
|
291
333
|
);
|
|
292
334
|
TypographyForwarded.displayName = "Typography";
|
|
@@ -301,46 +343,6 @@ function states(map) {
|
|
|
301
343
|
return active2.length > 0 ? active2.join(" ") : void 0;
|
|
302
344
|
}
|
|
303
345
|
|
|
304
|
-
// src/testing/use-test-id.ts
|
|
305
|
-
var import_react8 = require("react");
|
|
306
|
-
|
|
307
|
-
// src/testing/compose.ts
|
|
308
|
-
function normalizeSegment(seg) {
|
|
309
|
-
return seg.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
310
|
-
}
|
|
311
|
-
function composeTestId(parts) {
|
|
312
|
-
return parts.filter((p) => typeof p === "string" && p.trim() !== "").map(normalizeSegment).join("__");
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// src/testing/context/test-id-context.tsx
|
|
316
|
-
var import_react7 = require("react");
|
|
317
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
318
|
-
var TestIdContext = (0, import_react7.createContext)([]);
|
|
319
|
-
function TestIdProvider({ context, children }) {
|
|
320
|
-
const parent = (0, import_react7.useContext)(TestIdContext);
|
|
321
|
-
const value = (0, import_react7.useMemo)(
|
|
322
|
-
() => [...parent, normalizeSegment(context)].filter((seg) => seg !== ""),
|
|
323
|
-
[parent, context]
|
|
324
|
-
);
|
|
325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TestIdContext.Provider, { value, children });
|
|
326
|
-
}
|
|
327
|
-
function useTestIdContext() {
|
|
328
|
-
return (0, import_react7.useContext)(TestIdContext);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// src/testing/use-test-id.ts
|
|
332
|
-
function useTestId(type, ownTestId) {
|
|
333
|
-
const ctx = useTestIdContext();
|
|
334
|
-
const testId = composeTestId([type, ...ctx, ownTestId]);
|
|
335
|
-
return (0, import_react8.useMemo)(
|
|
336
|
-
() => ({
|
|
337
|
-
testId,
|
|
338
|
-
slot: (name) => `${testId}__${normalizeSegment(name)}`
|
|
339
|
-
}),
|
|
340
|
-
[testId]
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
346
|
// src/components/button/use-styles.ts
|
|
345
347
|
var import_react9 = require("react");
|
|
346
348
|
|
|
@@ -444,17 +446,18 @@ function useStyles4({ vertical: vertical2, hasLabel }) {
|
|
|
444
446
|
|
|
445
447
|
// src/components/divider/index.tsx
|
|
446
448
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
447
|
-
var Divider = (0, import_react12.forwardRef)(function Divider2({ vertical: vertical2, label: label7, ...rest }, ref) {
|
|
449
|
+
var Divider = (0, import_react12.forwardRef)(function Divider2({ vertical: vertical2, label: label7, testId, ...rest }, ref) {
|
|
448
450
|
const hasLabel = label7 != null;
|
|
449
451
|
const { root: root24, line: line2, label: labelClass } = useStyles4({ vertical: vertical2, hasLabel });
|
|
452
|
+
const { testId: dataTestId, slot } = useTestId("layout", testId);
|
|
450
453
|
if (hasLabel) {
|
|
451
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, role: "separator", className: root24, ...rest, children: [
|
|
454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, role: "separator", className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
452
455
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: line2 }),
|
|
453
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: labelClass, children: label7 }),
|
|
456
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: labelClass, "data-testid": slot("label"), children: label7 }),
|
|
454
457
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: line2 })
|
|
455
458
|
] });
|
|
456
459
|
}
|
|
457
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, role: "separator", className: root24, ...rest });
|
|
460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, role: "separator", className: root24, "data-testid": dataTestId, ...rest });
|
|
458
461
|
});
|
|
459
462
|
|
|
460
463
|
// src/components/avatar/index.tsx
|
|
@@ -490,9 +493,10 @@ function useStyles5({
|
|
|
490
493
|
|
|
491
494
|
// src/components/avatar/index.tsx
|
|
492
495
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
493
|
-
var Avatar = (0, import_react14.forwardRef)(function Avatar2({ size: size3, filled, className, children, ...rest }, ref) {
|
|
496
|
+
var Avatar = (0, import_react14.forwardRef)(function Avatar2({ size: size3, filled, className, children, testId, ...rest }, ref) {
|
|
494
497
|
const { root: root24 } = useStyles5({ size: size3, filled, className });
|
|
495
|
-
|
|
498
|
+
const { testId: dataTestId } = useTestId("media", testId);
|
|
499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { ref, className: root24, "data-testid": dataTestId, ...rest, children });
|
|
496
500
|
});
|
|
497
501
|
|
|
498
502
|
// src/components/badge/index.tsx
|
|
@@ -522,11 +526,12 @@ function useStyles6({
|
|
|
522
526
|
|
|
523
527
|
// src/components/badge/index.tsx
|
|
524
528
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
525
|
-
var Badge = (0, import_react16.forwardRef)(function Badge2({ count, tone: tone4, className, children, ...rest }, ref) {
|
|
529
|
+
var Badge = (0, import_react16.forwardRef)(function Badge2({ count, tone: tone4, className, children, testId, ...rest }, ref) {
|
|
526
530
|
const { root: root24, dot: dot3 } = useStyles6({ tone: tone4, className });
|
|
527
|
-
|
|
531
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { ref, className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
528
533
|
children,
|
|
529
|
-
count != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: dot3, children: count })
|
|
534
|
+
count != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: dot3, "data-testid": slot("dot"), children: count })
|
|
530
535
|
] });
|
|
531
536
|
});
|
|
532
537
|
|
|
@@ -565,9 +570,10 @@ function useStyles7({
|
|
|
565
570
|
|
|
566
571
|
// src/components/progress/index.tsx
|
|
567
572
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
568
|
-
var Progress = (0, import_react18.forwardRef)(function Progress2({ variant: variant2 = "linear", value, size: size3 = 20, className, ...rest }, ref) {
|
|
573
|
+
var Progress = (0, import_react18.forwardRef)(function Progress2({ variant: variant2 = "linear", value, size: size3 = 20, className, testId, ...rest }, ref) {
|
|
569
574
|
const { track: track4, bar: bar2, spinner: spinner2 } = useStyles7({ variant: variant2, value, className });
|
|
570
575
|
const indeterminate2 = value === void 0;
|
|
576
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
571
577
|
if (variant2 === "circular") {
|
|
572
578
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
573
579
|
"span",
|
|
@@ -579,6 +585,8 @@ var Progress = (0, import_react18.forwardRef)(function Progress2({ variant: vari
|
|
|
579
585
|
"aria-valuemin": indeterminate2 ? void 0 : 0,
|
|
580
586
|
"aria-valuemax": indeterminate2 ? void 0 : 100,
|
|
581
587
|
style: { width: size3, height: size3 },
|
|
588
|
+
"data-testid": dataTestId,
|
|
589
|
+
"data-state": states({ indeterminate: indeterminate2 }),
|
|
582
590
|
...rest
|
|
583
591
|
}
|
|
584
592
|
);
|
|
@@ -592,8 +600,17 @@ var Progress = (0, import_react18.forwardRef)(function Progress2({ variant: vari
|
|
|
592
600
|
"aria-valuenow": indeterminate2 ? void 0 : value,
|
|
593
601
|
"aria-valuemin": indeterminate2 ? void 0 : 0,
|
|
594
602
|
"aria-valuemax": indeterminate2 ? void 0 : 100,
|
|
603
|
+
"data-testid": dataTestId,
|
|
604
|
+
"data-state": states({ indeterminate: indeterminate2 }),
|
|
595
605
|
...rest,
|
|
596
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
606
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
607
|
+
"div",
|
|
608
|
+
{
|
|
609
|
+
className: bar2,
|
|
610
|
+
style: indeterminate2 ? void 0 : { width: `${value}%` },
|
|
611
|
+
"data-testid": slot("bar")
|
|
612
|
+
}
|
|
613
|
+
)
|
|
597
614
|
}
|
|
598
615
|
);
|
|
599
616
|
});
|
|
@@ -657,17 +674,39 @@ function useStyles8({
|
|
|
657
674
|
|
|
658
675
|
// src/components/chip/index.tsx
|
|
659
676
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
660
|
-
var Chip = (0, import_react20.forwardRef)(function Chip2({ selected: selected3, tone: tone4, onDelete, onClick, children, ...rest }, ref) {
|
|
677
|
+
var Chip = (0, import_react20.forwardRef)(function Chip2({ selected: selected3, tone: tone4, onDelete, onClick, children, testId, ...rest }, ref) {
|
|
661
678
|
const clickable2 = Boolean(onClick);
|
|
662
679
|
const { root: root24, deleteBtn: deleteBtn2 } = useStyles8({ selected: selected3, tone: tone4, clickable: clickable2 });
|
|
680
|
+
const { testId: dataTestId, slot } = useTestId("media", testId);
|
|
663
681
|
const handleDelete = (event) => {
|
|
664
682
|
event.stopPropagation();
|
|
665
683
|
onDelete?.();
|
|
666
684
|
};
|
|
667
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
686
|
+
"span",
|
|
687
|
+
{
|
|
688
|
+
ref,
|
|
689
|
+
className: root24,
|
|
690
|
+
onClick,
|
|
691
|
+
"data-testid": dataTestId,
|
|
692
|
+
"data-state": states({ selected: selected3 }),
|
|
693
|
+
...rest,
|
|
694
|
+
children: [
|
|
695
|
+
children,
|
|
696
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
697
|
+
"button",
|
|
698
|
+
{
|
|
699
|
+
type: "button",
|
|
700
|
+
className: deleteBtn2,
|
|
701
|
+
"aria-label": "Remove",
|
|
702
|
+
onClick: handleDelete,
|
|
703
|
+
"data-testid": slot("delete"),
|
|
704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(XIcon, { size: 13 })
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
);
|
|
671
710
|
});
|
|
672
711
|
|
|
673
712
|
// src/components/checkbox/index.tsx
|
|
@@ -722,13 +761,14 @@ function useStyles9({ checked, disabled: disabled3 }) {
|
|
|
722
761
|
|
|
723
762
|
// src/components/checkbox/index.tsx
|
|
724
763
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
725
|
-
var Checkbox = (0, import_react22.forwardRef)(function Checkbox2({ checked = false, onChange, label: label7, disabled: disabled3 = false, id, ...rest }, ref) {
|
|
764
|
+
var Checkbox = (0, import_react22.forwardRef)(function Checkbox2({ checked = false, onChange, label: label7, disabled: disabled3 = false, id, testId, ...rest }, ref) {
|
|
726
765
|
const { root: root24, input: input6, box: box2, check: check2 } = useStyles9({ checked, disabled: disabled3 });
|
|
766
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
727
767
|
const handleChange = (e) => {
|
|
728
768
|
if (disabled3) return;
|
|
729
769
|
onChange?.(e.target.checked);
|
|
730
770
|
};
|
|
731
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: root24, children: [
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
732
772
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
733
773
|
"input",
|
|
734
774
|
{
|
|
@@ -782,9 +822,10 @@ function useStyles10({
|
|
|
782
822
|
|
|
783
823
|
// src/components/radio/index.tsx
|
|
784
824
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
785
|
-
var Radio = (0, import_react24.forwardRef)(function Radio2({ checked, onChange, label: label7, name, value, disabled: disabled3, ...rest }, ref) {
|
|
825
|
+
var Radio = (0, import_react24.forwardRef)(function Radio2({ checked, onChange, label: label7, name, value, disabled: disabled3, testId, ...rest }, ref) {
|
|
786
826
|
const { root: root24, input: input6, circle: circle2, dot: dot3, label: labelClass } = useStyles10({ disabled: disabled3 });
|
|
787
|
-
|
|
827
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
788
829
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
789
830
|
"input",
|
|
790
831
|
{
|
|
@@ -836,9 +877,10 @@ function useStyles11({ checked }) {
|
|
|
836
877
|
|
|
837
878
|
// src/components/switch/index.tsx
|
|
838
879
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
839
|
-
var Switch = (0, import_react26.forwardRef)(function Switch2({ checked = false, onChange, label: label7, disabled: disabled3, ...rest }, ref) {
|
|
880
|
+
var Switch = (0, import_react26.forwardRef)(function Switch2({ checked = false, onChange, label: label7, disabled: disabled3, testId, ...rest }, ref) {
|
|
840
881
|
const { root: root24, input: input6, track: track4, knob: knob2, label: labelClass } = useStyles11({ checked });
|
|
841
|
-
|
|
882
|
+
const { testId: dataTestId } = useTestId("toggle", testId);
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: root24, "data-testid": dataTestId, "data-state": states({ checked, disabled: disabled3 }), children: [
|
|
842
884
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
843
885
|
"input",
|
|
844
886
|
{
|
|
@@ -1267,9 +1309,10 @@ function useStyles15() {
|
|
|
1267
1309
|
|
|
1268
1310
|
// src/components/card/index.tsx
|
|
1269
1311
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1270
|
-
var CardRoot = (0, import_react36.forwardRef)(function Card({ children, ...rest }, ref) {
|
|
1312
|
+
var CardRoot = (0, import_react36.forwardRef)(function Card({ children, testId, ...rest }, ref) {
|
|
1271
1313
|
const { root: root24 } = useStyles15();
|
|
1272
|
-
|
|
1314
|
+
const { testId: dataTestId } = useTestId("layout", testId);
|
|
1315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: root24, "data-testid": dataTestId, ...rest, children });
|
|
1273
1316
|
});
|
|
1274
1317
|
function CardHeader({ children, ...rest }) {
|
|
1275
1318
|
const { header: header3 } = useStyles15();
|
|
@@ -1433,12 +1476,13 @@ var defaultIcons = {
|
|
|
1433
1476
|
warn: TriangleAlertIcon,
|
|
1434
1477
|
danger: CircleXIcon
|
|
1435
1478
|
};
|
|
1436
|
-
var Alert = (0, import_react38.forwardRef)(function Alert2({ severity: severity2 = "info", title, icon, className, children, ...rest }, ref) {
|
|
1479
|
+
var Alert = (0, import_react38.forwardRef)(function Alert2({ severity: severity2 = "info", title, icon, className, testId, children, ...rest }, ref) {
|
|
1437
1480
|
const styles = useStyles16({ severity: severity2, className });
|
|
1481
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
1438
1482
|
const IconComponent = icon ?? defaultIcons[severity2];
|
|
1439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref, role: "alert", className: styles.root, ...rest, children: [
|
|
1440
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: styles.iconSlot, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(IconComponent, {}) }),
|
|
1441
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: styles.content, children: [
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref, role: "alert", className: styles.root, "data-testid": dataTestId, ...rest, children: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: styles.iconSlot, "data-testid": slot("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(IconComponent, {}) }),
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: styles.content, "data-testid": slot("content"), children: [
|
|
1442
1486
|
title != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Typography, { variant: "h4", children: title }),
|
|
1443
1487
|
children != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Typography, { variant: "body", color: "fg2", children })
|
|
1444
1488
|
] })
|
|
@@ -1475,10 +1519,11 @@ function useStyles17({
|
|
|
1475
1519
|
// src/components/tooltip/index.tsx
|
|
1476
1520
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1477
1521
|
var HIDE_DELAY = 120;
|
|
1478
|
-
var Tooltip = (0, import_react40.forwardRef)(function Tooltip2({ label: label7, children, placement: placement2 }, ref) {
|
|
1522
|
+
var Tooltip = (0, import_react40.forwardRef)(function Tooltip2({ label: label7, children, placement: placement2, testId }, ref) {
|
|
1479
1523
|
const [open, setOpen] = (0, import_react40.useState)(false);
|
|
1480
1524
|
const tooltipId = (0, import_react40.useId)();
|
|
1481
1525
|
const { wrapper: wrapper4, bubble: bubble2 } = useStyles17({ placement: placement2 });
|
|
1526
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
1482
1527
|
const hideTimer = (0, import_react40.useRef)(null);
|
|
1483
1528
|
const clearHide = () => {
|
|
1484
1529
|
if (hideTimer.current) {
|
|
@@ -1517,6 +1562,7 @@ var Tooltip = (0, import_react40.forwardRef)(function Tooltip2({ label: label7,
|
|
|
1517
1562
|
{
|
|
1518
1563
|
ref,
|
|
1519
1564
|
className: wrapper4,
|
|
1565
|
+
"data-testid": dataTestId,
|
|
1520
1566
|
onMouseEnter: show,
|
|
1521
1567
|
onMouseLeave: scheduleHide,
|
|
1522
1568
|
onFocus: show,
|
|
@@ -1530,6 +1576,7 @@ var Tooltip = (0, import_react40.forwardRef)(function Tooltip2({ label: label7,
|
|
|
1530
1576
|
id: tooltipId,
|
|
1531
1577
|
role: "tooltip",
|
|
1532
1578
|
className: bubble2,
|
|
1579
|
+
"data-testid": slot("bubble"),
|
|
1533
1580
|
onMouseEnter: show,
|
|
1534
1581
|
onMouseLeave: scheduleHide,
|
|
1535
1582
|
children: label7
|
|
@@ -1830,9 +1877,10 @@ function useStyles20({ className }) {
|
|
|
1830
1877
|
|
|
1831
1878
|
// src/components/accordion/index.tsx
|
|
1832
1879
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1833
|
-
var Accordion = (0, import_react46.forwardRef)(function Accordion2({ items, multiple = false, defaultOpen = [], className }, ref) {
|
|
1880
|
+
var Accordion = (0, import_react46.forwardRef)(function Accordion2({ items, multiple = false, defaultOpen = [], className, testId }, ref) {
|
|
1834
1881
|
const [open, setOpen] = (0, import_react46.useState)(defaultOpen);
|
|
1835
1882
|
const { root: root24, item: item3, header: header3, chevronFor, panel: panel3 } = useStyles20({ className });
|
|
1883
|
+
const { testId: dataTestId, slot } = useTestId("layout", testId);
|
|
1836
1884
|
const toggle = (id) => {
|
|
1837
1885
|
setOpen((current2) => {
|
|
1838
1886
|
const isOpen = current2.includes(id);
|
|
@@ -1840,28 +1888,49 @@ var Accordion = (0, import_react46.forwardRef)(function Accordion2({ items, mult
|
|
|
1840
1888
|
return multiple ? [...current2, id] : [id];
|
|
1841
1889
|
});
|
|
1842
1890
|
};
|
|
1843
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref, className: root24, children: items.map((it) => {
|
|
1891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref, className: root24, "data-testid": dataTestId, children: items.map((it) => {
|
|
1844
1892
|
const isOpen = open.includes(it.id);
|
|
1845
1893
|
const panelId = `accordion-panel-${it.id}`;
|
|
1846
1894
|
const headerId = `accordion-header-${it.id}`;
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1895
|
+
const itemSlot = slot(`item-${it.id}`);
|
|
1896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
1897
|
+
"div",
|
|
1898
|
+
{
|
|
1899
|
+
className: item3,
|
|
1900
|
+
"data-testid": itemSlot,
|
|
1901
|
+
"data-state": states({ expanded: isOpen }),
|
|
1902
|
+
children: [
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
1904
|
+
"button",
|
|
1905
|
+
{
|
|
1906
|
+
type: "button",
|
|
1907
|
+
id: headerId,
|
|
1908
|
+
className: header3,
|
|
1909
|
+
"aria-expanded": isOpen,
|
|
1910
|
+
"aria-controls": panelId,
|
|
1911
|
+
"data-testid": `${itemSlot}__trigger`,
|
|
1912
|
+
onClick: () => toggle(it.id),
|
|
1913
|
+
children: [
|
|
1914
|
+
it.title,
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChevronDownIcon, { className: chevronFor(isOpen) })
|
|
1916
|
+
]
|
|
1917
|
+
}
|
|
1918
|
+
),
|
|
1919
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1920
|
+
"div",
|
|
1921
|
+
{
|
|
1922
|
+
id: panelId,
|
|
1923
|
+
className: panel3,
|
|
1924
|
+
role: "region",
|
|
1925
|
+
"aria-labelledby": headerId,
|
|
1926
|
+
"data-testid": `${itemSlot}__panel`,
|
|
1927
|
+
children: it.content
|
|
1928
|
+
}
|
|
1929
|
+
)
|
|
1930
|
+
]
|
|
1931
|
+
},
|
|
1932
|
+
it.id
|
|
1933
|
+
);
|
|
1865
1934
|
}) });
|
|
1866
1935
|
});
|
|
1867
1936
|
|
|
@@ -1911,13 +1980,14 @@ function useStyles21({ className }) {
|
|
|
1911
1980
|
|
|
1912
1981
|
// src/components/breadcrumbs/index.tsx
|
|
1913
1982
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1914
|
-
var Breadcrumbs = (0, import_react48.forwardRef)(function Breadcrumbs2({ items, className, ...rest }, ref) {
|
|
1983
|
+
var Breadcrumbs = (0, import_react48.forwardRef)(function Breadcrumbs2({ items, className, testId, ...rest }, ref) {
|
|
1915
1984
|
const { root: root24, crumb: crumb2, current: current2, separator: separator2 } = useStyles21({ className });
|
|
1916
|
-
|
|
1985
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
1986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("nav", { ref, "aria-label": "Breadcrumb", className: root24, "data-testid": dataTestId, ...rest, children: items.map((item3, index) => {
|
|
1917
1987
|
const isLast = index === items.length - 1;
|
|
1918
1988
|
const key = index;
|
|
1919
1989
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react48.Fragment, { children: [
|
|
1920
|
-
isLast ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: current2, "aria-current": "page", children: item3.label }) : item3.href ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("a", { className: crumb2, href: item3.href, children: item3.label }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: crumb2, children: item3.label }),
|
|
1990
|
+
isLast ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: current2, "aria-current": "page", "data-testid": slot(`crumb-${index}`), children: item3.label }) : item3.href ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("a", { className: crumb2, href: item3.href, "data-testid": slot(`crumb-${index}`), children: item3.label }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: crumb2, "data-testid": slot(`crumb-${index}`), children: item3.label }),
|
|
1921
1991
|
!isLast && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: separator2, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronRightIcon, { size: 14 }) })
|
|
1922
1992
|
] }, key);
|
|
1923
1993
|
}) });
|
|
@@ -1987,13 +2057,14 @@ function buildItems(count, page, siblingCount) {
|
|
|
1987
2057
|
if (last > first) items.push(last);
|
|
1988
2058
|
return items;
|
|
1989
2059
|
}
|
|
1990
|
-
var Pagination = (0, import_react50.forwardRef)(function Pagination2({ count, page = 1, onChange, siblingCount = 1, ...rest }, ref) {
|
|
2060
|
+
var Pagination = (0, import_react50.forwardRef)(function Pagination2({ count, page = 1, onChange, siblingCount = 1, testId, ...rest }, ref) {
|
|
1991
2061
|
const { root: root24, pageBtnFor, ellipsis: ellipsis2, nav: nav2 } = useStyles22();
|
|
2062
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
1992
2063
|
const total = Math.max(1, count);
|
|
1993
2064
|
const current2 = Math.min(Math.max(1, page), total);
|
|
1994
2065
|
const items = buildItems(total, current2, siblingCount);
|
|
1995
2066
|
const go = (n) => onChange?.(Math.min(Math.max(1, n), total));
|
|
1996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("nav", { ref, className: root24, "aria-label": "Pagination", ...rest, children: [
|
|
2067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("nav", { ref, className: root24, "aria-label": "Pagination", "data-testid": dataTestId, ...rest, children: [
|
|
1997
2068
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
1998
2069
|
"button",
|
|
1999
2070
|
{
|
|
@@ -2001,20 +2072,27 @@ var Pagination = (0, import_react50.forwardRef)(function Pagination2({ count, pa
|
|
|
2001
2072
|
className: nav2,
|
|
2002
2073
|
"aria-label": "Previous page",
|
|
2003
2074
|
disabled: current2 <= 1,
|
|
2075
|
+
"data-testid": slot("prev"),
|
|
2004
2076
|
onClick: () => go(current2 - 1),
|
|
2005
2077
|
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronLeftIcon, { size: 18 })
|
|
2006
2078
|
}
|
|
2007
2079
|
),
|
|
2008
2080
|
items.map(
|
|
2009
|
-
(item3, index) => item3 === "ellipsis" ? (
|
|
2010
|
-
|
|
2011
|
-
|
|
2081
|
+
(item3, index) => item3 === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2082
|
+
"span",
|
|
2083
|
+
{
|
|
2084
|
+
className: ellipsis2,
|
|
2085
|
+
"data-testid": slot(`ellipsis-${index}`),
|
|
2086
|
+
children: "\u2026"
|
|
2087
|
+
},
|
|
2088
|
+
`ellipsis-${index}`
|
|
2012
2089
|
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2013
2090
|
"button",
|
|
2014
2091
|
{
|
|
2015
2092
|
type: "button",
|
|
2016
2093
|
className: pageBtnFor(item3 === current2),
|
|
2017
2094
|
"aria-current": item3 === current2 ? "page" : void 0,
|
|
2095
|
+
"data-testid": slot(`page-${item3}`),
|
|
2018
2096
|
onClick: () => go(item3),
|
|
2019
2097
|
children: item3
|
|
2020
2098
|
},
|
|
@@ -2028,6 +2106,7 @@ var Pagination = (0, import_react50.forwardRef)(function Pagination2({ count, pa
|
|
|
2028
2106
|
className: nav2,
|
|
2029
2107
|
"aria-label": "Next page",
|
|
2030
2108
|
disabled: current2 >= total,
|
|
2109
|
+
"data-testid": slot("next"),
|
|
2031
2110
|
onClick: () => go(current2 + 1),
|
|
2032
2111
|
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronRightIcon, { size: 18 })
|
|
2033
2112
|
}
|
|
@@ -2068,18 +2147,28 @@ function useStyles23({ className }) {
|
|
|
2068
2147
|
|
|
2069
2148
|
// src/components/stepper/index.tsx
|
|
2070
2149
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2071
|
-
var Stepper = (0, import_react52.forwardRef)(function Stepper2({ steps, active: active2 = 0, className, ...rest }, ref) {
|
|
2150
|
+
var Stepper = (0, import_react52.forwardRef)(function Stepper2({ steps, active: active2 = 0, className, testId, ...rest }, ref) {
|
|
2072
2151
|
const { root: root24, step: step2, connector: connector2, markerFor, labelFor } = useStyles23({ className });
|
|
2073
|
-
|
|
2152
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { ref, className: root24, "data-testid": dataTestId, ...rest, children: steps.map((s, index) => {
|
|
2074
2154
|
const state = index < active2 ? "done" : index === active2 ? "active" : "upcoming";
|
|
2075
2155
|
const isActive = state === "active";
|
|
2076
2156
|
return (
|
|
2077
2157
|
// biome-ignore lint/suspicious/noArrayIndexKey: steps are a static, ordered list with no stable id.
|
|
2078
2158
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react52.Fragment, { children: [
|
|
2079
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2160
|
+
"div",
|
|
2161
|
+
{
|
|
2162
|
+
className: step2,
|
|
2163
|
+
"aria-current": isActive ? "step" : void 0,
|
|
2164
|
+
"data-testid": slot(`step-${index}`),
|
|
2165
|
+
"data-state": states({ done: state === "done", active: isActive }),
|
|
2166
|
+
children: [
|
|
2167
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: markerFor(state), children: state === "done" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CheckIcon, { size: 14 }) : index + 1 }),
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: labelFor(isActive), children: s.label })
|
|
2169
|
+
]
|
|
2170
|
+
}
|
|
2171
|
+
),
|
|
2083
2172
|
index < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "data-part": "connector", className: connector2 })
|
|
2084
2173
|
] }, index)
|
|
2085
2174
|
);
|
|
@@ -2110,8 +2199,9 @@ function useStyles24() {
|
|
|
2110
2199
|
|
|
2111
2200
|
// src/components/tabs/index.tsx
|
|
2112
2201
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2113
|
-
var Tabs = (0, import_react54.forwardRef)(function Tabs2({ items, value, onChange, ...rest }, ref) {
|
|
2202
|
+
var Tabs = (0, import_react54.forwardRef)(function Tabs2({ items, value, onChange, testId, ...rest }, ref) {
|
|
2114
2203
|
const { root: root24, tabClass, panel: panel3 } = useStyles24();
|
|
2204
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2115
2205
|
const baseId = (0, import_react54.useId)();
|
|
2116
2206
|
const tabRefs = (0, import_react54.useRef)([]);
|
|
2117
2207
|
const hasPanels = items.some((item3) => item3.content !== void 0);
|
|
@@ -2146,7 +2236,7 @@ var Tabs = (0, import_react54.forwardRef)(function Tabs2({ items, value, onChang
|
|
|
2146
2236
|
}
|
|
2147
2237
|
};
|
|
2148
2238
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
2149
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref, role: "tablist", className: root24, ...rest, children: items.map((item3, index) => {
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref, role: "tablist", className: root24, "data-testid": dataTestId, ...rest, children: items.map((item3, index) => {
|
|
2150
2240
|
const active2 = item3.value === value;
|
|
2151
2241
|
const tabbable = active2 || activeIndex === -1 && index === 0;
|
|
2152
2242
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -2162,6 +2252,8 @@ var Tabs = (0, import_react54.forwardRef)(function Tabs2({ items, value, onChang
|
|
|
2162
2252
|
"aria-controls": hasPanels ? panelId(item3.value) : void 0,
|
|
2163
2253
|
tabIndex: tabbable ? 0 : -1,
|
|
2164
2254
|
className: tabClass(active2),
|
|
2255
|
+
"data-testid": slot(`tab-${index}`),
|
|
2256
|
+
"data-state": states({ selected: active2 }),
|
|
2165
2257
|
onClick: () => onChange?.(item3.value),
|
|
2166
2258
|
onKeyDown: (event) => onKeyDown(event, index),
|
|
2167
2259
|
children: item3.label
|
|
@@ -2178,6 +2270,7 @@ var Tabs = (0, import_react54.forwardRef)(function Tabs2({ items, value, onChang
|
|
|
2178
2270
|
hidden: item3.value !== value,
|
|
2179
2271
|
tabIndex: 0,
|
|
2180
2272
|
className: panel3,
|
|
2273
|
+
"data-testid": slot(`panel-${item3.value}`),
|
|
2181
2274
|
children: item3.content
|
|
2182
2275
|
},
|
|
2183
2276
|
item3.value
|
|
@@ -2505,14 +2598,25 @@ function useStyles27() {
|
|
|
2505
2598
|
|
|
2506
2599
|
// src/components/snackbar/index.tsx
|
|
2507
2600
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2508
|
-
var Snackbar = (0, import_react60.forwardRef)(function Snackbar2({ open, message: message2, action, onClose }, ref) {
|
|
2601
|
+
var Snackbar = (0, import_react60.forwardRef)(function Snackbar2({ open, message: message2, action, onClose, testId }, ref) {
|
|
2509
2602
|
const { root: root24, message: messageClass, closeBtn: closeBtn2 } = useStyles27();
|
|
2603
|
+
const { testId: dataTestId, slot } = useTestId("feedback", testId);
|
|
2510
2604
|
if (!open || typeof document === "undefined") return null;
|
|
2511
2605
|
return (0, import_react_dom2.createPortal)(
|
|
2512
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref, role: "status", className: root24, children: [
|
|
2513
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: messageClass, children: message2 }),
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref, role: "status", className: root24, "data-testid": dataTestId, children: [
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: messageClass, "data-testid": slot("message"), children: message2 }),
|
|
2514
2608
|
action,
|
|
2515
|
-
onClose && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2609
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2610
|
+
"button",
|
|
2611
|
+
{
|
|
2612
|
+
type: "button",
|
|
2613
|
+
"aria-label": "Close",
|
|
2614
|
+
className: closeBtn2,
|
|
2615
|
+
"data-testid": slot("close"),
|
|
2616
|
+
onClick: onClose,
|
|
2617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(XIcon, { size: 18 })
|
|
2618
|
+
}
|
|
2619
|
+
)
|
|
2516
2620
|
] }),
|
|
2517
2621
|
document.body
|
|
2518
2622
|
);
|
|
@@ -2549,14 +2653,15 @@ function useStyles28({ className }) {
|
|
|
2549
2653
|
|
|
2550
2654
|
// src/components/table/index.tsx
|
|
2551
2655
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2552
|
-
function TableInner({ columns, rows, getRowKey, className, caption: caption2, ...rest }, ref) {
|
|
2656
|
+
function TableInner({ columns, rows, getRowKey, className, caption: caption2, testId, ...rest }, ref) {
|
|
2553
2657
|
const { root: root24, th: th2, td: td2, alignRight: alignRight2, caption: captionClass } = useStyles28({ className });
|
|
2658
|
+
const { testId: dataTestId, slot } = useTestId("list", testId);
|
|
2554
2659
|
const headClass = (column) => column.align === "right" ? `${th2} ${alignRight2}` : th2;
|
|
2555
2660
|
const cellClass = (column) => column.align === "right" ? `${td2} ${alignRight2}` : td2;
|
|
2556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { ref, className: root24, ...rest, children: [
|
|
2661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { ref, className: root24, "data-testid": dataTestId, ...rest, children: [
|
|
2557
2662
|
caption2 != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("caption", { className: captionClass, children: caption2 }),
|
|
2558
2663
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { scope: "col", className: headClass(column), children: column.header }, column.key)) }) }),
|
|
2559
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: cellClass(column), children: column.render ? column.render(row) : String(row[column.key]) }, column.key)) }, getRowKey ? getRowKey(row, index) : index)) })
|
|
2664
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { "data-testid": slot(`row-${index}`), children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: cellClass(column), children: column.render ? column.render(row) : String(row[column.key]) }, column.key)) }, getRowKey ? getRowKey(row, index) : index)) })
|
|
2560
2665
|
] });
|
|
2561
2666
|
}
|
|
2562
2667
|
var TableForwarded = (0, import_react62.forwardRef)(TableInner);
|
|
@@ -2586,12 +2691,13 @@ function useStyles29({ className }) {
|
|
|
2586
2691
|
|
|
2587
2692
|
// src/components/app-bar/index.tsx
|
|
2588
2693
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2589
|
-
var AppBar = (0, import_react64.forwardRef)(function AppBar2({ brand: brand2, actions: actions3, className, children, ...rest }, ref) {
|
|
2694
|
+
var AppBar = (0, import_react64.forwardRef)(function AppBar2({ brand: brand2, actions: actions3, className, children, testId, ...rest }, ref) {
|
|
2590
2695
|
const styles = useStyles29({ className });
|
|
2591
|
-
|
|
2592
|
-
|
|
2696
|
+
const { testId: dataTestId, slot } = useTestId("nav", testId);
|
|
2697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("header", { ref, className: styles.root, "data-testid": dataTestId, ...rest, children: [
|
|
2698
|
+
brand2 !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.brand, "data-testid": slot("brand"), children: brand2 }) : null,
|
|
2593
2699
|
children,
|
|
2594
|
-
actions3 !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.actions, children: actions3 }) : null
|
|
2700
|
+
actions3 !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.actions, "data-testid": slot("actions"), children: actions3 }) : null
|
|
2595
2701
|
] });
|
|
2596
2702
|
});
|
|
2597
2703
|
|
|
@@ -2623,13 +2729,24 @@ function useStyles30({
|
|
|
2623
2729
|
|
|
2624
2730
|
// src/components/list-item/index.tsx
|
|
2625
2731
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2626
|
-
var ListItem = (0, import_react66.forwardRef)(function ListItem2({ leading: leading2, trailing: trailing2, selected: selected3, className, children, ...rest }, ref) {
|
|
2732
|
+
var ListItem = (0, import_react66.forwardRef)(function ListItem2({ leading: leading2, trailing: trailing2, selected: selected3, className, testId, children, ...rest }, ref) {
|
|
2627
2733
|
const styles = useStyles30({ selected: selected3, className });
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2734
|
+
const { testId: dataTestId, slot } = useTestId("list", testId);
|
|
2735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
2736
|
+
"div",
|
|
2737
|
+
{
|
|
2738
|
+
ref,
|
|
2739
|
+
className: styles.root,
|
|
2740
|
+
"data-testid": dataTestId,
|
|
2741
|
+
"data-state": states({ selected: selected3 }),
|
|
2742
|
+
...rest,
|
|
2743
|
+
children: [
|
|
2744
|
+
leading2 != null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: styles.leading, "data-testid": slot("leading"), children: leading2 }),
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: styles.content, "data-testid": slot("content"), children }),
|
|
2746
|
+
trailing2 != null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: styles.trailing, "data-testid": slot("trailing"), children: trailing2 })
|
|
2747
|
+
]
|
|
2748
|
+
}
|
|
2749
|
+
);
|
|
2633
2750
|
});
|
|
2634
2751
|
|
|
2635
2752
|
// src/components/icons/chevron-up/index.tsx
|