@dmsi/wedgekit-react 0.0.26 → 0.0.28
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/{chunk-KDEPZ6I7.js → chunk-2S2Z3L56.js} +5 -1
- package/dist/{chunk-TU55CHXU.js → chunk-4JLU7TAC.js} +3 -1
- package/dist/{chunk-Z2LOGSGE.js → chunk-4N2PED4P.js} +15 -3
- package/dist/{chunk-U42SKNR6.js → chunk-57WRM337.js} +68 -30
- package/dist/{chunk-ZFGGZXB6.js → chunk-AY7ELVQY.js} +5 -2
- package/dist/{chunk-I2UVVKQI.js → chunk-CHTO7PW4.js} +3 -2
- package/dist/{chunk-WIDBAFBU.js → chunk-FWPJ73IK.js} +3 -1
- package/dist/{chunk-5TLFMKSR.js → chunk-INYI65WW.js} +15 -5
- package/dist/{chunk-TJ44JJCB.js → chunk-J6LETUNM.js} +5 -2
- package/dist/{chunk-T6HZARR7.js → chunk-MZJS2ZAU.js} +6 -3
- package/dist/{chunk-ZCBSLV7U.js → chunk-O4M2GISS.js} +5 -2
- package/dist/{chunk-OUTEIXV4.js → chunk-OUSNH76S.js} +11 -3
- package/dist/{chunk-YDREJNAS.js → chunk-PDDZ5PMY.js} +18 -4
- package/dist/{chunk-4RD5ZF2V.js → chunk-QBIEU25R.js} +10 -4
- package/dist/chunk-QUPHLL7D.js +61 -0
- package/dist/{chunk-OISE6NMA.js → chunk-QV2EFOYF.js} +17 -6
- package/dist/{chunk-YZQNTOIF.js → chunk-QZGUMB7T.js} +10 -5
- package/dist/{chunk-S7R37IUP.js → chunk-S5K22XTH.js} +5 -2
- package/dist/{chunk-GCPJH5R6.js → chunk-S5KPS4IQ.js} +22 -7
- package/dist/{chunk-VELXLFMJ.js → chunk-SAMX4YGM.js} +4 -1
- package/dist/{chunk-TWP6YSFO.js → chunk-SKHSGGO3.js} +14 -6
- package/dist/chunk-TVDFTRGL.js +57 -0
- package/dist/{chunk-N32PXOA5.js → chunk-UT7XCBZF.js} +9 -4
- package/dist/{chunk-L4UM372R.js → chunk-VC3R5EUH.js} +3 -0
- package/dist/{chunk-UIQ733QP.js → chunk-VG4EPHJA.js} +7 -3
- package/dist/components/Breadcrumbs.cjs +29 -9
- package/dist/components/Breadcrumbs.js +29 -9
- package/dist/components/Button.cjs +6 -3
- package/dist/components/Button.js +1 -1
- package/dist/components/CalendarRange.cjs +11 -3
- package/dist/components/CalendarRange.js +1 -1
- package/dist/components/Caption.cjs +53 -9
- package/dist/components/Caption.js +53 -9
- package/dist/components/Checkbox.cjs +15 -6
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/ContentTab.cjs +20 -7
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +32 -18
- package/dist/components/ContentTabs.js +14 -13
- package/dist/components/DMSiLogo.cjs +22 -4
- package/dist/components/DMSiLogo.js +9 -5
- package/dist/components/DataGrid.cjs +374 -243
- package/dist/components/DataGrid.js +283 -226
- package/dist/components/DataGridCell.cjs +79 -21
- package/dist/components/DataGridCell.js +7 -7
- package/dist/components/DataTable.cjs +197 -139
- package/dist/components/DataTable.js +197 -139
- package/dist/components/DateInput.cjs +36 -10
- package/dist/components/DateInput.js +7 -3
- package/dist/components/DateRangeInput.cjs +36 -10
- package/dist/components/DateRangeInput.js +7 -3
- package/dist/components/DebugJson.cjs +21 -13
- package/dist/components/DebugJson.js +21 -13
- package/dist/components/Display.cjs +5 -2
- package/dist/components/Display.js +1 -1
- package/dist/components/EditingContext.cjs +4 -1
- package/dist/components/EditingContext.js +4 -1
- package/dist/components/FilterGroup.cjs +102 -32
- package/dist/components/FilterGroup.js +41 -17
- package/dist/components/FullViewportBox.cjs +10 -2
- package/dist/components/FullViewportBox.js +10 -2
- package/dist/components/Grid.cjs +3 -1
- package/dist/components/Grid.js +3 -1
- package/dist/components/Heading.cjs +5 -2
- package/dist/components/Heading.js +1 -1
- package/dist/components/HorizontalDivider.cjs +2 -2
- package/dist/components/HorizontalDivider.js +2 -2
- package/dist/components/Input.cjs +21 -7
- package/dist/components/Input.js +2 -2
- package/dist/components/InputGroup.cjs +13 -6
- package/dist/components/InputGroup.js +9 -5
- package/dist/components/Label.cjs +5 -2
- package/dist/components/Label.js +1 -1
- package/dist/components/List.cjs +3 -2
- package/dist/components/List.js +3 -2
- package/dist/components/LogoAgilityTopBar.cjs +22 -4
- package/dist/components/LogoAgilityTopBar.js +9 -5
- package/dist/components/LogoDMSiTopBar.cjs +22 -4
- package/dist/components/LogoDMSiTopBar.js +1 -1
- package/dist/components/LogoMillworkTopBar.cjs +22 -4
- package/dist/components/LogoMillworkTopBar.js +9 -5
- package/dist/components/MainBar.cjs +2 -0
- package/dist/components/MainBar.js +2 -0
- package/dist/components/Menu.cjs +3 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/MenuOption.cjs +28 -7
- package/dist/components/MenuOption.js +3 -3
- package/dist/components/MobileDataGrid.cjs +101 -46
- package/dist/components/MobileDataGrid.js +23 -11
- package/dist/components/Modal.cjs +96 -51
- package/dist/components/Modal.js +19 -7
- package/dist/components/ModalButtons.cjs +43 -26
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalContent.cjs +3 -1
- package/dist/components/ModalContent.js +1 -1
- package/dist/components/ModalHeader.cjs +40 -25
- package/dist/components/ModalHeader.js +3 -3
- package/dist/components/ModalScrim.cjs +3 -1
- package/dist/components/ModalScrim.js +1 -1
- package/dist/components/NavigationTab.cjs +9 -3
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.cjs +15 -7
- package/dist/components/NavigationTabs.js +8 -6
- package/dist/components/NestedMenu.cjs +28 -7
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/Notification.cjs +84 -38
- package/dist/components/Notification.js +8 -4
- package/dist/components/OptionPill.cjs +24 -6
- package/dist/components/OptionPill.js +3 -3
- package/dist/components/Paragraph.cjs +7 -3
- package/dist/components/Paragraph.js +1 -1
- package/dist/components/Password.cjs +33 -11
- package/dist/components/Password.js +14 -6
- package/dist/components/ProjectBar.cjs +3 -1
- package/dist/components/ProjectBar.js +3 -1
- package/dist/components/Radio.cjs +13 -7
- package/dist/components/Radio.js +7 -5
- package/dist/components/Search.cjs +34 -12
- package/dist/components/Search.js +3 -3
- package/dist/components/Select.cjs +25 -7
- package/dist/components/Select.js +3 -3
- package/dist/components/SideMenu.cjs +6 -1
- package/dist/components/SideMenu.js +6 -1
- package/dist/components/SideMenuGroup.cjs +96 -49
- package/dist/components/SideMenuGroup.js +31 -19
- package/dist/components/SideMenuItem.cjs +99 -43
- package/dist/components/SideMenuItem.js +32 -12
- package/dist/components/Stack.cjs +91 -30
- package/dist/components/Stack.js +1 -1
- package/dist/components/StatusPill.cjs +13 -6
- package/dist/components/StatusPill.js +9 -5
- package/dist/components/Stepper.cjs +35 -17
- package/dist/components/Stepper.js +11 -10
- package/dist/components/Subheader.cjs +5 -2
- package/dist/components/Subheader.js +1 -1
- package/dist/components/Surface.cjs +5 -2
- package/dist/components/Surface.js +5 -2
- package/dist/components/Swatch.cjs +1544 -1308
- package/dist/components/Swatch.js +1469 -1275
- package/dist/components/Textarea.cjs +5 -2
- package/dist/components/Textarea.js +5 -2
- package/dist/components/Theme.cjs +3 -2
- package/dist/components/Theme.js +1 -1
- package/dist/components/Time.cjs +98 -40
- package/dist/components/Time.js +18 -6
- package/dist/components/Toast.cjs +38 -15
- package/dist/components/Toast.js +23 -10
- package/dist/components/Tooltip.cjs +5 -4
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/TopBar.cjs +16 -8
- package/dist/components/TopBar.js +12 -5
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +24 -15
- package/src/components/Button.tsx +7 -3
- package/src/components/CalendarRange.tsx +9 -0
- package/src/components/Caption.tsx +36 -6
- package/src/components/Checkbox.tsx +7 -2
- package/src/components/ContentTab.tsx +13 -3
- package/src/components/ContentTabs.tsx +11 -8
- package/src/components/DMSiLogo.tsx +2 -1
- package/src/components/DataGrid.tsx +85 -23
- package/src/components/DataGridCell.tsx +15 -2
- package/src/components/DataTable.tsx +64 -14
- package/src/components/DateInput.tsx +5 -1
- package/src/components/DateRangeInput.tsx +5 -1
- package/src/components/DebugJson.tsx +7 -3
- package/src/components/Display.tsx +3 -0
- package/src/components/EditingContext.tsx +8 -6
- package/src/components/FilterGroup.tsx +23 -3
- package/src/components/FullViewportBox.tsx +6 -1
- package/src/components/Grid.tsx +3 -0
- package/src/components/Heading.tsx +3 -0
- package/src/components/HorizontalDivider.tsx +4 -2
- package/src/components/Input.tsx +19 -10
- package/src/components/InputGroup.tsx +8 -4
- package/src/components/Label.tsx +3 -0
- package/src/components/Link.tsx +1 -0
- package/src/components/List.tsx +7 -1
- package/src/components/LogoAgilityTopBar.tsx +2 -1
- package/src/components/LogoDMSiTopBar.tsx +2 -1
- package/src/components/LogoMillworkTopBar.tsx +2 -1
- package/src/components/MainBar.tsx +3 -0
- package/src/components/Menu.tsx +3 -0
- package/src/components/MenuOption.tsx +72 -58
- package/src/components/MobileDataGrid.tsx +15 -4
- package/src/components/Modal.tsx +10 -1
- package/src/components/ModalButtons.tsx +12 -1
- package/src/components/ModalContent.tsx +3 -0
- package/src/components/ModalHeader.tsx +16 -6
- package/src/components/ModalScrim.tsx +3 -0
- package/src/components/NavigationTab.tsx +6 -3
- package/src/components/NavigationTabs.tsx +5 -2
- package/src/components/Notification.tsx +4 -0
- package/src/components/OptionPill.tsx +9 -1
- package/src/components/Paragraph.tsx +3 -0
- package/src/components/Password.tsx +9 -3
- package/src/components/ProjectBar.tsx +3 -0
- package/src/components/Radio.tsx +3 -2
- package/src/components/Search.tsx +56 -41
- package/src/components/Select.tsx +6 -1
- package/src/components/SideMenu.tsx +7 -1
- package/src/components/SideMenuGroup.tsx +13 -2
- package/src/components/SideMenuItem.tsx +15 -2
- package/src/components/Stack.tsx +8 -3
- package/src/components/StatusPill.tsx +4 -2
- package/src/components/Stepper.tsx +5 -5
- package/src/components/Subheader.tsx +3 -0
- package/src/components/Surface.tsx +3 -0
- package/src/components/Swatch.tsx +415 -140
- package/src/components/Textarea.tsx +6 -3
- package/src/components/Theme.tsx +3 -1
- package/src/components/Time.tsx +21 -5
- package/src/components/Toast.tsx +29 -14
- package/src/components/Tooltip.tsx +46 -32
- package/src/components/TopBar.tsx +7 -3
- package/dist/chunk-DBYSGYST.js +0 -47
- package/dist/chunk-UK3WG7HQ.js +0 -48
package/src/components/Input.tsx
CHANGED
|
@@ -41,6 +41,7 @@ export type InputFormatting = {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export type InputBaseProps = {
|
|
44
|
+
id?: string;
|
|
44
45
|
after?: ReactNode;
|
|
45
46
|
before?: ReactNode;
|
|
46
47
|
label?: string;
|
|
@@ -55,9 +56,10 @@ export type InputBaseProps = {
|
|
|
55
56
|
wrapperClassName?: string;
|
|
56
57
|
focus?: boolean;
|
|
57
58
|
} & InputFormatting &
|
|
58
|
-
Omit<ComponentProps<"input">, "align">;
|
|
59
|
+
Omit<ComponentProps<"input">, "align" | "id">;
|
|
59
60
|
|
|
60
61
|
export const InputBase = ({
|
|
62
|
+
id,
|
|
61
63
|
before,
|
|
62
64
|
after,
|
|
63
65
|
type,
|
|
@@ -80,6 +82,7 @@ export const InputBase = ({
|
|
|
80
82
|
"data-focus": focus || null,
|
|
81
83
|
};
|
|
82
84
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
85
|
+
const inputId = `${id}-input`;
|
|
83
86
|
|
|
84
87
|
useEffect(() => {
|
|
85
88
|
const input = inputRef.current;
|
|
@@ -126,6 +129,8 @@ export const InputBase = ({
|
|
|
126
129
|
|
|
127
130
|
return (
|
|
128
131
|
<label
|
|
132
|
+
id={id}
|
|
133
|
+
htmlFor={inputId}
|
|
129
134
|
ref={inputContainerRef}
|
|
130
135
|
className={clsx(
|
|
131
136
|
"w-full flex flex-col",
|
|
@@ -140,6 +145,7 @@ export const InputBase = ({
|
|
|
140
145
|
{label && (
|
|
141
146
|
<div className={clsx("flex items-center", componentGap)}>
|
|
142
147
|
<Label
|
|
148
|
+
id={id ? `${id}-label` : undefined}
|
|
143
149
|
className={clsx(
|
|
144
150
|
props.disabled || props.readOnly
|
|
145
151
|
? "cursor-default"
|
|
@@ -179,7 +185,7 @@ export const InputBase = ({
|
|
|
179
185
|
required={required}
|
|
180
186
|
{...props}
|
|
181
187
|
{...attributes}
|
|
182
|
-
id={
|
|
188
|
+
id={inputId}
|
|
183
189
|
className={clsx(
|
|
184
190
|
"flex-1 outline-none w-full max-w-full min-h-6 min-w-0",
|
|
185
191
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
@@ -196,7 +202,7 @@ export const InputBase = ({
|
|
|
196
202
|
{after}
|
|
197
203
|
</div>
|
|
198
204
|
|
|
199
|
-
{caption}
|
|
205
|
+
{caption && <div id={id ? `${id}-caption` : undefined}>{caption}</div>}
|
|
200
206
|
</label>
|
|
201
207
|
);
|
|
202
208
|
};
|
|
@@ -210,6 +216,7 @@ export const Input = ({
|
|
|
210
216
|
onChange,
|
|
211
217
|
onBlur,
|
|
212
218
|
onClear,
|
|
219
|
+
id,
|
|
213
220
|
...props
|
|
214
221
|
}: Omit<ComponentProps<"input">, "value" | "onChange" | "align" | "children"> &
|
|
215
222
|
InputBaseProps & {
|
|
@@ -250,8 +257,9 @@ export const Input = ({
|
|
|
250
257
|
const getInputProps = () => {
|
|
251
258
|
const baseProps = {
|
|
252
259
|
...props,
|
|
260
|
+
id,
|
|
253
261
|
...getDecimalPlaceholder(decimals),
|
|
254
|
-
value: propValue
|
|
262
|
+
value: propValue,
|
|
255
263
|
};
|
|
256
264
|
|
|
257
265
|
switch (variant) {
|
|
@@ -318,6 +326,7 @@ export const Input = ({
|
|
|
318
326
|
const hasValue = displayValue.length > 0;
|
|
319
327
|
return hasValue && !props.readOnly ? (
|
|
320
328
|
<Icon
|
|
329
|
+
id={id ? `${id}-clear-button` : undefined}
|
|
321
330
|
name="close"
|
|
322
331
|
onClick={handleSearchReset}
|
|
323
332
|
className="cursor-pointer absolute right-2 bottom-2/4 translate-y-2/4"
|
|
@@ -330,9 +339,9 @@ export const Input = ({
|
|
|
330
339
|
|
|
331
340
|
case "uom":
|
|
332
341
|
return uom ? (
|
|
333
|
-
|
|
342
|
+
<span className="text-text-secondary-normal uppercase">
|
|
334
343
|
{uom.slice(0, 4)}
|
|
335
|
-
|
|
344
|
+
</span>
|
|
336
345
|
) : null;
|
|
337
346
|
|
|
338
347
|
case "percentage":
|
|
@@ -460,12 +469,12 @@ Input.displayName = "Input";
|
|
|
460
469
|
|
|
461
470
|
// Legacy component exports for backward compatibility
|
|
462
471
|
export const Finder = (
|
|
463
|
-
props: Omit<ComponentProps<"input">, "value" | "align" | "children"> &
|
|
472
|
+
props: Omit<ComponentProps<"input">, "value" | "align" | "children" | "id"> &
|
|
464
473
|
InputBaseProps & { value?: string | number },
|
|
465
474
|
) => <Input {...props} variant="finder" />;
|
|
466
475
|
|
|
467
476
|
export const UOM = (
|
|
468
|
-
props: Omit<ComponentProps<"input">, "value" | "align" | "children"> &
|
|
477
|
+
props: Omit<ComponentProps<"input">, "value" | "align" | "children" | "id"> &
|
|
469
478
|
InputBaseProps & {
|
|
470
479
|
uom: string;
|
|
471
480
|
value?: string | number;
|
|
@@ -475,7 +484,7 @@ export const UOM = (
|
|
|
475
484
|
export const Currency = (
|
|
476
485
|
props: Omit<
|
|
477
486
|
ComponentProps<"input">,
|
|
478
|
-
"value" | "onChange" | "align" | "children"
|
|
487
|
+
"value" | "onChange" | "align" | "children" | "id"
|
|
479
488
|
> &
|
|
480
489
|
InputBaseProps & {
|
|
481
490
|
value?: number;
|
|
@@ -498,7 +507,7 @@ export const Currency = (
|
|
|
498
507
|
};
|
|
499
508
|
|
|
500
509
|
export const Percentage = (
|
|
501
|
-
props: Omit<ComponentProps<"input">, "value" | "align" | "children"> &
|
|
510
|
+
props: Omit<ComponentProps<"input">, "value" | "align" | "children" | "id"> &
|
|
502
511
|
InputBaseProps & {
|
|
503
512
|
value?: string | number;
|
|
504
513
|
},
|
|
@@ -6,6 +6,7 @@ import { useId } from "react";
|
|
|
6
6
|
import { componentGap, layoutGap } from "../classNames";
|
|
7
7
|
|
|
8
8
|
type InputGroupProps = {
|
|
9
|
+
id?: string;
|
|
9
10
|
label: string;
|
|
10
11
|
orientation?: "vertical" | "horizontal";
|
|
11
12
|
error?: boolean;
|
|
@@ -13,6 +14,7 @@ type InputGroupProps = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export const InputGroup = ({
|
|
17
|
+
id,
|
|
16
18
|
label,
|
|
17
19
|
orientation = "horizontal",
|
|
18
20
|
error = false,
|
|
@@ -20,14 +22,16 @@ export const InputGroup = ({
|
|
|
20
22
|
caption,
|
|
21
23
|
...props
|
|
22
24
|
}: ComponentProps<"div"> & InputGroupProps) => {
|
|
23
|
-
const
|
|
25
|
+
const internalId = useId();
|
|
26
|
+
const labelId = `${id}-label`;
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
|
-
<div {...props} className={clsx("flex flex-col", componentGap)}>
|
|
29
|
+
<div id={id} {...props} className={clsx("flex flex-col", componentGap)}>
|
|
27
30
|
<Label
|
|
31
|
+
id={labelId}
|
|
28
32
|
as="label"
|
|
29
33
|
className={clsx({ "!text-text-primary-error": error })}
|
|
30
|
-
htmlFor={
|
|
34
|
+
htmlFor={internalId}
|
|
31
35
|
>
|
|
32
36
|
{label}
|
|
33
37
|
</Label>
|
|
@@ -43,7 +47,7 @@ export const InputGroup = ({
|
|
|
43
47
|
{children}
|
|
44
48
|
</div>
|
|
45
49
|
|
|
46
|
-
{caption}
|
|
50
|
+
{caption && <div id={id ? `${id}-caption` : undefined}>{caption}</div>}
|
|
47
51
|
</div>
|
|
48
52
|
);
|
|
49
53
|
};
|
package/src/components/Label.tsx
CHANGED
|
@@ -5,6 +5,7 @@ export type Tags = "span" | "label" | "p" | "a";
|
|
|
5
5
|
|
|
6
6
|
type LabelProps = {
|
|
7
7
|
as?: Tags;
|
|
8
|
+
id?: string;
|
|
8
9
|
} & AsProps<Tags> &
|
|
9
10
|
TextAttributes &
|
|
10
11
|
TypographyProps;
|
|
@@ -15,11 +16,13 @@ export const Label = ({
|
|
|
15
16
|
className,
|
|
16
17
|
color,
|
|
17
18
|
align,
|
|
19
|
+
id,
|
|
18
20
|
...props
|
|
19
21
|
}: LabelProps) => {
|
|
20
22
|
const Element = as;
|
|
21
23
|
return (
|
|
22
24
|
<Element
|
|
25
|
+
id={id}
|
|
23
26
|
className={clsx(
|
|
24
27
|
typography.label,
|
|
25
28
|
align === "left" && "text-left",
|
package/src/components/Link.tsx
CHANGED
package/src/components/List.tsx
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
export function List({
|
|
2
2
|
children,
|
|
3
3
|
ordered,
|
|
4
|
+
id,
|
|
4
5
|
}: {
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
ordered?: boolean;
|
|
8
|
+
id?: string;
|
|
7
9
|
}) {
|
|
8
10
|
const Element = ordered ? "ol" : "ul";
|
|
9
|
-
return
|
|
11
|
+
return (
|
|
12
|
+
<Element id={id} className="list-disc list-inside">
|
|
13
|
+
{children}
|
|
14
|
+
</Element>
|
|
15
|
+
);
|
|
10
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function LogoMillworkTopBar() {
|
|
1
|
+
export function LogoMillworkTopBar(props: React.SVGProps<SVGSVGElement>) {
|
|
2
2
|
return (
|
|
3
3
|
<svg
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -6,6 +6,7 @@ export function LogoMillworkTopBar() {
|
|
|
6
6
|
height="25"
|
|
7
7
|
viewBox="0 0 94 25"
|
|
8
8
|
fill="none"
|
|
9
|
+
{...props}
|
|
9
10
|
>
|
|
10
11
|
<mask
|
|
11
12
|
id="mask0_4555_1132"
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "../classNames";
|
|
10
10
|
|
|
11
11
|
type MainBarProps = {
|
|
12
|
+
id?: string;
|
|
12
13
|
leftContent?: ReactNode;
|
|
13
14
|
rightContent?: ReactNode;
|
|
14
15
|
mobileLeftContent?: ReactNode;
|
|
@@ -19,6 +20,7 @@ type MainBarProps = {
|
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const MainBar = ({
|
|
23
|
+
id,
|
|
22
24
|
leftContent: left,
|
|
23
25
|
rightContent: right,
|
|
24
26
|
mobileLeftContent: mobileLeft,
|
|
@@ -32,6 +34,7 @@ export const MainBar = ({
|
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<div
|
|
37
|
+
id={id}
|
|
35
38
|
className={clsx(
|
|
36
39
|
"min-h-mobile-container-padding",
|
|
37
40
|
"bg-background-brand-normal items-center justify-between",
|
package/src/components/Menu.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { useMatchesMobile } from "./useMatchesMedia";
|
|
|
17
17
|
export type MenuPosition = "right" | "bottom" | "bottom-right";
|
|
18
18
|
|
|
19
19
|
type MenuProps = {
|
|
20
|
+
id?: string;
|
|
20
21
|
positionTo?: RefObject<HTMLElement | null>;
|
|
21
22
|
mobilePositionTo?: RefObject<HTMLElement | null>;
|
|
22
23
|
show?: boolean;
|
|
@@ -32,6 +33,7 @@ type MenuProps = {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
export const Menu = ({
|
|
36
|
+
id,
|
|
35
37
|
children,
|
|
36
38
|
className,
|
|
37
39
|
ref,
|
|
@@ -125,6 +127,7 @@ export const Menu = ({
|
|
|
125
127
|
show &&
|
|
126
128
|
createPortal(
|
|
127
129
|
<div
|
|
130
|
+
id={id}
|
|
128
131
|
ref={setRefs}
|
|
129
132
|
className={clsx(
|
|
130
133
|
"shadow-4 rounded-base bg-background-grouped-primary-normal overflow-x-hidden overflow-y-auto flex flex-col outline-0",
|
|
@@ -11,6 +11,7 @@ import { MenuPosition } from "./Menu";
|
|
|
11
11
|
import { useMatchesMobile } from "./useMatchesMedia";
|
|
12
12
|
|
|
13
13
|
type BaseProps = PropsWithChildren<{
|
|
14
|
+
id?: string;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
value?: string;
|
|
16
17
|
before?: ReactNode;
|
|
@@ -20,45 +21,47 @@ type BaseProps = PropsWithChildren<{
|
|
|
20
21
|
mobilePositionTo?: RefObject<HTMLElement | null>;
|
|
21
22
|
selected?: boolean;
|
|
22
23
|
currentSubMenuLevel?: number | null;
|
|
23
|
-
}> &
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
24
|
+
}> &
|
|
25
|
+
(
|
|
26
|
+
| {
|
|
27
|
+
subMenu: (props: {
|
|
28
|
+
menuId: string;
|
|
29
|
+
positionTo?: RefObject<HTMLDivElement>;
|
|
30
|
+
mobilePositionTo?: RefObject<HTMLElement | null>;
|
|
31
|
+
position?: MenuPosition;
|
|
32
|
+
subMenuLevel: number;
|
|
33
|
+
mobileBackMenuOption?: () => ReactNode;
|
|
34
|
+
mobileHide?: boolean;
|
|
35
|
+
}) => ReactNode;
|
|
36
|
+
subMenuLevel?: number;
|
|
37
|
+
onSubMenuHover: (menuId: string, level: number) => void;
|
|
38
|
+
onSubMenuLeave: (level: number) => void;
|
|
39
|
+
onSubMenuEnter: () => void;
|
|
40
|
+
toggleMenu: (id: string, level: number) => void;
|
|
41
|
+
activeMenu: string;
|
|
42
|
+
closeSubMenuLevel: (level: number) => void;
|
|
43
|
+
}
|
|
44
|
+
| {
|
|
45
|
+
subMenu?: undefined;
|
|
46
|
+
subMenuLevel?: number;
|
|
47
|
+
onSubMenuHover?: (menuId: string, level: number) => void;
|
|
48
|
+
onSubMenuLeave?: (level: number) => void;
|
|
49
|
+
onSubMenuEnter?: () => void;
|
|
50
|
+
toggleMenu?: (id: string, level: number) => void;
|
|
51
|
+
closeSubMenuLevel?: (level: number) => void;
|
|
52
|
+
activeMenu?: string;
|
|
53
|
+
}
|
|
54
|
+
) &
|
|
55
|
+
(
|
|
56
|
+
| {
|
|
57
|
+
highlightMatchingText: true;
|
|
58
|
+
menuValue: string;
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
highlightMatchingText?: false | undefined;
|
|
62
|
+
menuValue?: string;
|
|
63
|
+
}
|
|
64
|
+
);
|
|
62
65
|
|
|
63
66
|
type ActionProps = BaseProps & {
|
|
64
67
|
variant: "action";
|
|
@@ -71,6 +74,7 @@ type NormalProps = BaseProps & {
|
|
|
71
74
|
type MenuOptionProps = ActionProps | NormalProps;
|
|
72
75
|
|
|
73
76
|
export const MenuOption = ({
|
|
77
|
+
id,
|
|
74
78
|
children,
|
|
75
79
|
disabled = false,
|
|
76
80
|
variant = "normal",
|
|
@@ -91,7 +95,7 @@ export const MenuOption = ({
|
|
|
91
95
|
activeMenu,
|
|
92
96
|
mobilePositionTo,
|
|
93
97
|
highlightMatchingText = false,
|
|
94
|
-
menuValue
|
|
98
|
+
menuValue,
|
|
95
99
|
}: MenuOptionProps) => {
|
|
96
100
|
const uniqueId = useId();
|
|
97
101
|
const internalRef = useRef(null);
|
|
@@ -158,14 +162,15 @@ export const MenuOption = ({
|
|
|
158
162
|
const disabledStyles =
|
|
159
163
|
disabled && clsx("bg-transparent cursor-default pointer-events-none");
|
|
160
164
|
|
|
161
|
-
const renderChildren =
|
|
162
|
-
|
|
163
|
-
highlightMatch(children, menuValue)
|
|
164
|
-
|
|
165
|
+
const renderChildren =
|
|
166
|
+
typeof children === "string" && highlightMatchingText
|
|
167
|
+
? highlightMatch(children, menuValue)
|
|
168
|
+
: children;
|
|
165
169
|
|
|
166
170
|
return (
|
|
167
171
|
<>
|
|
168
172
|
<div
|
|
173
|
+
id={id}
|
|
169
174
|
ref={actualRef}
|
|
170
175
|
className={clsx(
|
|
171
176
|
"flex items-center cursor-pointer w-full text-left relative outline-none",
|
|
@@ -183,7 +188,7 @@ export const MenuOption = ({
|
|
|
183
188
|
onClick={() => {
|
|
184
189
|
onClick?.(menuId.current, (value || children) as string);
|
|
185
190
|
if (subMenu) {
|
|
186
|
-
toggleMenu(menuId.current, subMenuLevel)
|
|
191
|
+
toggleMenu(menuId.current, subMenuLevel);
|
|
187
192
|
}
|
|
188
193
|
}}
|
|
189
194
|
onMouseEnter={handleMouseEnter}
|
|
@@ -193,10 +198,7 @@ export const MenuOption = ({
|
|
|
193
198
|
role="menuitem"
|
|
194
199
|
aria-haspopup={subMenu ? "menu" : undefined}
|
|
195
200
|
>
|
|
196
|
-
|
|
197
|
-
{before && (
|
|
198
|
-
<div className="shrink-0 flex items-center">{before}</div>
|
|
199
|
-
)}
|
|
201
|
+
{before && <div className="shrink-0 flex items-center">{before}</div>}
|
|
200
202
|
|
|
201
203
|
{variant === "action" ? (
|
|
202
204
|
<Label padded className={textLabelStyles}>
|
|
@@ -212,13 +214,21 @@ export const MenuOption = ({
|
|
|
212
214
|
</div>
|
|
213
215
|
|
|
214
216
|
{subMenu && (
|
|
215
|
-
<div
|
|
216
|
-
onMouseEnter={handleSubMenuEnter}
|
|
217
|
+
<div
|
|
218
|
+
onMouseEnter={handleSubMenuEnter}
|
|
217
219
|
onMouseLeave={handleMouseLeave}
|
|
218
220
|
data-submenu-parent={menuId.current}
|
|
219
221
|
data-menu-level={subMenuLevel + 1}
|
|
220
222
|
>
|
|
221
|
-
{subMenu({
|
|
223
|
+
{subMenu({
|
|
224
|
+
menuId: menuId.current,
|
|
225
|
+
positionTo: actualRef,
|
|
226
|
+
mobilePositionTo,
|
|
227
|
+
position: "right",
|
|
228
|
+
subMenuLevel,
|
|
229
|
+
mobileBackMenuOption,
|
|
230
|
+
mobileHide: isMobile && activeMenu !== menuId.current,
|
|
231
|
+
})}
|
|
222
232
|
</div>
|
|
223
233
|
)}
|
|
224
234
|
</>
|
|
@@ -230,7 +240,7 @@ export const MenuOption = ({
|
|
|
230
240
|
}
|
|
231
241
|
|
|
232
242
|
if (subMenu && after !== null) {
|
|
233
|
-
return <Icon name="chevron_right"
|
|
243
|
+
return <Icon name="chevron_right" />;
|
|
234
244
|
}
|
|
235
245
|
}
|
|
236
246
|
|
|
@@ -241,15 +251,16 @@ export const MenuOption = ({
|
|
|
241
251
|
|
|
242
252
|
return (
|
|
243
253
|
<MenuOption
|
|
254
|
+
id={id ? `${id}-back` : undefined}
|
|
244
255
|
onClick={() => {
|
|
245
|
-
closeSubMenuLevel?.(currentSubMenuLevel ?? 0)
|
|
256
|
+
closeSubMenuLevel?.(currentSubMenuLevel ?? 0);
|
|
246
257
|
}}
|
|
247
258
|
variant="action"
|
|
248
259
|
before={<Icon name="chevron_left" />}
|
|
249
260
|
>
|
|
250
261
|
Back
|
|
251
262
|
</MenuOption>
|
|
252
|
-
)
|
|
263
|
+
);
|
|
253
264
|
}
|
|
254
265
|
};
|
|
255
266
|
|
|
@@ -260,7 +271,10 @@ function highlightMatch(text: string, searchValue?: string): React.ReactNode {
|
|
|
260
271
|
return text;
|
|
261
272
|
}
|
|
262
273
|
|
|
263
|
-
const regex = new RegExp(
|
|
274
|
+
const regex = new RegExp(
|
|
275
|
+
`(${searchValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
|
|
276
|
+
"gi",
|
|
277
|
+
);
|
|
264
278
|
const parts = text.split(regex);
|
|
265
279
|
|
|
266
280
|
return parts.map((part, index) =>
|
|
@@ -270,6 +284,6 @@ function highlightMatch(text: string, searchValue?: string): React.ReactNode {
|
|
|
270
284
|
</span>
|
|
271
285
|
) : (
|
|
272
286
|
part
|
|
273
|
-
)
|
|
287
|
+
),
|
|
274
288
|
);
|
|
275
|
-
}
|
|
289
|
+
}
|
|
@@ -24,6 +24,7 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
24
24
|
getId,
|
|
25
25
|
renderLink,
|
|
26
26
|
renderChevron,
|
|
27
|
+
id,
|
|
27
28
|
}: {
|
|
28
29
|
columns: MobileColumnDef<T>[];
|
|
29
30
|
data: T[];
|
|
@@ -31,9 +32,11 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
31
32
|
getId: (data: T) => string | number | undefined;
|
|
32
33
|
renderLink?: (data: T) => React.ReactNode;
|
|
33
34
|
renderChevron?: (data: T) => React.ReactNode;
|
|
35
|
+
id?: string;
|
|
34
36
|
} & ComponentProps<"div">) {
|
|
35
37
|
return (
|
|
36
38
|
<div
|
|
39
|
+
id={id}
|
|
37
40
|
className={clsx(
|
|
38
41
|
"rounded",
|
|
39
42
|
"overflow-hidden",
|
|
@@ -42,9 +45,13 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
42
45
|
"overflow-y-scroll scrollbar-thin",
|
|
43
46
|
)}
|
|
44
47
|
>
|
|
45
|
-
<MobileDataGridHeader
|
|
48
|
+
<MobileDataGridHeader
|
|
49
|
+
id={id ? `${id}-header` : undefined}
|
|
50
|
+
header={header}
|
|
51
|
+
/>
|
|
46
52
|
{data.map((item) => (
|
|
47
53
|
<MobileDataGridCard
|
|
54
|
+
id={id ? `${id}-card-${getId(item)}` : undefined}
|
|
48
55
|
data={item}
|
|
49
56
|
key={getId(item)}
|
|
50
57
|
columns={columns}
|
|
@@ -56,9 +63,9 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
56
63
|
);
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
function MobileDataGridHeader({ header }: { header: string }) {
|
|
66
|
+
function MobileDataGridHeader({ header, id }: { header: string; id?: string }) {
|
|
60
67
|
return (
|
|
61
|
-
<div className="sticky top-0">
|
|
68
|
+
<div id={id} className="sticky top-0">
|
|
62
69
|
<Theme theme="brand">
|
|
63
70
|
<Stack
|
|
64
71
|
horizontal
|
|
@@ -82,25 +89,29 @@ function MobileDataGridCard<T extends RowData>({
|
|
|
82
89
|
columns,
|
|
83
90
|
renderLink,
|
|
84
91
|
renderChevron,
|
|
92
|
+
id,
|
|
85
93
|
}: {
|
|
86
94
|
data: T;
|
|
87
95
|
columns: MobileColumnDef<T>[];
|
|
88
96
|
renderLink?: (data: T) => React.ReactNode;
|
|
89
97
|
renderChevron?: (data: T) => React.ReactNode;
|
|
98
|
+
id?: string;
|
|
90
99
|
}) {
|
|
91
100
|
return (
|
|
92
|
-
<div>
|
|
101
|
+
<div id={id}>
|
|
93
102
|
<Stack sizing="component" padding>
|
|
94
103
|
<Stack horizontal horizontalMobile items="center" justify="between">
|
|
95
104
|
{renderLink && renderLink(data)}
|
|
96
105
|
<Stack horizontal horizontalMobile items="center" justify="end">
|
|
97
106
|
<Button
|
|
107
|
+
id={id ? `${id}-docs-button` : undefined}
|
|
98
108
|
iconOnly
|
|
99
109
|
variant="tertiary"
|
|
100
110
|
onClick={() => console.log("Edit", data.id)}
|
|
101
111
|
leftIcon={<Icon name="docs" />}
|
|
102
112
|
></Button>
|
|
103
113
|
<Button
|
|
114
|
+
id={id ? `${id}-swap-button` : undefined}
|
|
104
115
|
iconOnly
|
|
105
116
|
variant="tertiary"
|
|
106
117
|
onClick={() => console.log("Edit", data.id)}
|
package/src/components/Modal.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { useMatchesMobile } from "./useMatchesMedia";
|
|
|
13
13
|
import { useMounted } from "./useMounted";
|
|
14
14
|
|
|
15
15
|
type ModalProps = PropsWithChildren<{
|
|
16
|
+
id?: string;
|
|
16
17
|
title?: string;
|
|
17
18
|
open?: boolean;
|
|
18
19
|
size?: "small" | "medium" | "large" | "x-large";
|
|
@@ -102,6 +103,7 @@ const sizes = {
|
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
export const Modal = ({
|
|
106
|
+
id,
|
|
105
107
|
title,
|
|
106
108
|
open = false,
|
|
107
109
|
size = "small",
|
|
@@ -228,12 +230,14 @@ export const Modal = ({
|
|
|
228
230
|
|
|
229
231
|
return createPortal(
|
|
230
232
|
<ModalScrim
|
|
233
|
+
id={id ? `${id}-scrim` : undefined}
|
|
231
234
|
size={size}
|
|
232
235
|
ref={bgRef}
|
|
233
236
|
show={open}
|
|
234
237
|
onClick={backgroundClickHandler}
|
|
235
238
|
>
|
|
236
239
|
<div
|
|
240
|
+
id={id}
|
|
237
241
|
ref={modalRef}
|
|
238
242
|
className={clsx(
|
|
239
243
|
"bg-white shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
@@ -245,18 +249,23 @@ export const Modal = ({
|
|
|
245
249
|
onClick={(e) => e.stopPropagation()}
|
|
246
250
|
>
|
|
247
251
|
<ModalHeader
|
|
252
|
+
id={id ? `${id}-header` : undefined}
|
|
248
253
|
title={title}
|
|
249
254
|
onClose={handleClose}
|
|
250
255
|
hideCloseIcon={hideCloseIcon}
|
|
251
256
|
headerIcon={headerIcon}
|
|
252
257
|
/>
|
|
253
258
|
{children && (
|
|
254
|
-
<ModalContent
|
|
259
|
+
<ModalContent
|
|
260
|
+
id={id ? `${id}-content` : undefined}
|
|
261
|
+
fixedHeightScrolling={computedFixedHeightScrolling}
|
|
262
|
+
>
|
|
255
263
|
{children}
|
|
256
264
|
</ModalContent>
|
|
257
265
|
)}
|
|
258
266
|
{showButtons && (
|
|
259
267
|
<ModalButtons
|
|
268
|
+
id={id ? `${id}-buttons` : undefined}
|
|
260
269
|
onClose={handleClose}
|
|
261
270
|
onContinue={onContinue}
|
|
262
271
|
customActions={customActions}
|