@dmsi/wedgekit-react 0.0.140 → 0.0.141
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-4OS6APPF.js → chunk-4LXG6QNT.js} +2 -1
- package/dist/{chunk-KS4RDR6P.js → chunk-4NCDT5ZY.js} +21 -8
- package/dist/{chunk-R5TLUWDD.js → chunk-4T3DRGLF.js} +32 -30
- package/dist/{chunk-QZGUMB7T.js → chunk-4VTOTNKJ.js} +3 -0
- package/dist/{chunk-Y4HUYAI5.js → chunk-56Y5DDG3.js} +5 -2
- package/dist/{chunk-D2YP2BTN.js → chunk-5GOJRLQO.js} +10 -4
- package/dist/{chunk-J6LETUNM.js → chunk-AZ7LVLOK.js} +5 -2
- package/dist/{chunk-TTO4PL7Y.js → chunk-BATIOCXB.js} +7 -4
- package/dist/{chunk-CG2NIXZE.js → chunk-C4JGTH6G.js} +7 -3
- package/dist/{chunk-O4M2GISS.js → chunk-CYZL57LH.js} +5 -2
- package/dist/{chunk-6HIALT5L.js → chunk-E7D24OHM.js} +14 -5
- package/dist/{chunk-3ZUSYRI7.js → chunk-EPQLWHCL.js} +2 -2
- package/dist/{chunk-AY7ELVQY.js → chunk-EUXB3XKL.js} +5 -2
- package/dist/{chunk-6DONKNDT.js → chunk-EWGHVZL5.js} +2 -0
- package/dist/{chunk-VH3EJNVE.js → chunk-FFU6FB3K.js} +6 -3
- package/dist/{chunk-H6LXXGX6.js → chunk-FKMKHLQH.js} +6 -3
- package/dist/{chunk-4F6VQXKY.js → chunk-GG5JOFS6.js} +2 -1
- package/dist/{chunk-XCIBYDVK.js → chunk-GXSXCEAA.js} +25 -14
- package/dist/{chunk-VG4EPHJA.js → chunk-HVI3CL7Y.js} +6 -3
- package/dist/{chunk-AOELEEUS.js → chunk-I6GEUF6Y.js} +6 -3
- package/dist/{chunk-Z36QJ7ZF.js → chunk-J4E6Q5TM.js} +12 -9
- package/dist/{chunk-S5K22XTH.js → chunk-JWCT72WR.js} +5 -2
- package/dist/{chunk-QNQ5K7NW.js → chunk-LM5MKBPM.js} +8 -3
- package/dist/{chunk-EO3JJWFW.js → chunk-N6JVLYEE.js} +6 -3
- package/dist/{chunk-IGQVA7SC.js → chunk-NKUETCDA.js} +5 -2
- package/dist/{chunk-PCCJ7L3N.js → chunk-NMVSRA5Y.js} +12 -4
- package/dist/{chunk-X62XGQY7.js → chunk-NW2C4DL4.js} +18 -15
- package/dist/{chunk-OB3URVCR.js → chunk-PMBEIP24.js} +5 -1
- package/dist/{chunk-6UI5GABI.js → chunk-R7ELP5C5.js} +8 -5
- package/dist/{chunk-FWPJ73IK.js → chunk-SYEJVSE4.js} +3 -1
- package/dist/{chunk-WT5XXW6G.js → chunk-WFQEE2OO.js} +9 -4
- package/dist/{chunk-QTD7K43M.js → chunk-WSS2DFTP.js} +8 -6
- package/dist/{chunk-37TJJQL3.js → chunk-YR7JUKYO.js} +3 -0
- package/dist/{chunk-4JLU7TAC.js → chunk-ZFOANBWG.js} +3 -1
- package/dist/{chunk-P242H6OU.js → chunk-ZGFQN47L.js} +5 -2
- package/dist/components/AccessChangerTabItem.cjs +10 -4
- package/dist/components/AccessChangerTabItem.js +2 -2
- package/dist/components/Accordion.cjs +23 -11
- package/dist/components/Accordion.js +5 -5
- package/dist/components/Breadcrumbs.cjs +19 -8
- package/dist/components/Breadcrumbs.js +10 -5
- package/dist/components/Button.cjs +6 -3
- package/dist/components/Button.js +1 -1
- package/dist/components/CalendarRange.cjs +16 -5
- package/dist/components/CalendarRange.js +2 -2
- package/dist/components/Caption.cjs +18 -6
- package/dist/components/Caption.js +2 -2
- package/dist/components/Card.cjs +2 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.cjs +18 -7
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/ContentTab.cjs +22 -16
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +27 -18
- package/dist/components/ContentTabs.js +7 -4
- package/dist/components/DataGridCell.cjs +73 -39
- package/dist/components/DataGridCell.js +8 -8
- package/dist/components/DateInput.cjs +55 -35
- package/dist/components/DateInput.js +8 -4
- package/dist/components/DateRangeInput.cjs +55 -35
- package/dist/components/DateRangeInput.js +8 -4
- package/dist/components/Display.cjs +5 -2
- package/dist/components/Display.js +1 -1
- package/dist/components/FilterGroup.cjs +85 -44
- package/dist/components/FilterGroup.js +20 -10
- package/dist/components/FullViewportBox.cjs +3 -1
- package/dist/components/FullViewportBox.js +3 -1
- 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 +1 -1
- package/dist/components/Icon.cjs +5 -2
- package/dist/components/Icon.js +1 -1
- package/dist/components/Input.cjs +40 -32
- package/dist/components/Input.js +3 -3
- package/dist/components/InputGroup.cjs +11 -4
- package/dist/components/InputGroup.js +7 -3
- package/dist/components/Label.cjs +5 -2
- package/dist/components/Label.js +1 -1
- package/dist/components/Link.cjs +6 -3
- package/dist/components/Link.js +1 -1
- package/dist/components/List.cjs +3 -2
- package/dist/components/List.js +3 -2
- package/dist/components/LoadingScrim.cjs +4 -2
- package/dist/components/LoadingScrim.js +3 -2
- 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 +19 -7
- package/dist/components/MenuOption.js +4 -4
- package/dist/components/MobileDataGrid.cjs +42 -18
- package/dist/components/MobileDataGrid.js +18 -11
- package/dist/components/Modal.cjs +38 -12
- package/dist/components/Modal.js +8 -8
- package/dist/components/ModalButtons.cjs +16 -6
- package/dist/components/ModalButtons.js +3 -3
- package/dist/components/ModalContent.cjs +3 -1
- package/dist/components/ModalContent.js +1 -1
- package/dist/components/ModalHeader.cjs +21 -9
- package/dist/components/ModalHeader.js +4 -4
- package/dist/components/ModalScrim.cjs +3 -1
- package/dist/components/ModalScrim.js +1 -1
- package/dist/components/NavigationTab.cjs +14 -5
- package/dist/components/NavigationTab.js +3 -3
- package/dist/components/NavigationTabs.cjs +17 -6
- package/dist/components/NavigationTabs.js +6 -4
- package/dist/components/NestedMenu.cjs +23 -9
- package/dist/components/NestedMenu.js +8 -6
- package/dist/components/Notification.cjs +32 -13
- package/dist/components/Notification.js +9 -5
- package/dist/components/OptionPill.cjs +21 -7
- package/dist/components/OptionPill.js +4 -4
- package/dist/components/PDFViewer.cjs +73 -29
- package/dist/components/PDFViewer.js +26 -20
- package/dist/components/Paragraph.cjs +6 -3
- package/dist/components/Paragraph.js +1 -1
- package/dist/components/Password.cjs +50 -37
- package/dist/components/Password.js +13 -8
- package/dist/components/PaymentOnAccountModal.cjs +135 -69
- package/dist/components/PaymentOnAccountModal.js +21 -21
- package/dist/components/ProjectBar.cjs +3 -1
- package/dist/components/ProjectBar.js +3 -1
- package/dist/components/Radio.cjs +12 -6
- package/dist/components/Radio.js +2 -2
- package/dist/components/Search.cjs +44 -32
- package/dist/components/Search.js +4 -4
- package/dist/components/Select.cjs +43 -32
- package/dist/components/Select.js +4 -4
- package/dist/components/SelectPaymentMethod.cjs +67 -29
- package/dist/components/SelectPaymentMethod.js +12 -12
- package/dist/components/SideMenu.cjs +3 -1
- package/dist/components/SideMenu.js +3 -1
- package/dist/components/SideMenuGroup.cjs +19 -8
- package/dist/components/SideMenuGroup.js +6 -4
- package/dist/components/SideMenuItem.cjs +15 -6
- package/dist/components/SideMenuItem.js +5 -2
- package/dist/components/Spinner.cjs +2 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Stack.cjs +6 -3
- package/dist/components/Stack.js +1 -1
- package/dist/components/StatusPill.cjs +12 -6
- package/dist/components/StatusPill.js +8 -5
- package/dist/components/Stepper.cjs +54 -38
- package/dist/components/Stepper.js +12 -7
- package/dist/components/Subheader.cjs +5 -2
- package/dist/components/Subheader.js +1 -1
- package/dist/components/Swatch.cjs +22 -10
- package/dist/components/Swatch.js +4 -4
- package/dist/components/Textarea.cjs +4 -1
- package/dist/components/Textarea.js +4 -1
- package/dist/components/Theme.cjs +2 -0
- package/dist/components/Theme.js +1 -1
- package/dist/components/Time.cjs +52 -36
- package/dist/components/Time.js +10 -5
- package/dist/components/Toast.cjs +29 -12
- package/dist/components/Toast.js +11 -6
- package/dist/components/Tooltip.cjs +3 -0
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/TopBar.cjs +11 -4
- package/dist/components/TopBar.js +11 -4
- package/dist/components/Upload.cjs +30 -15
- package/dist/components/Upload.js +16 -10
- package/dist/components/index.cjs +221 -84
- package/dist/components/index.js +80 -38
- package/dist/index.css +24 -4
- package/package.json +1 -1
- package/src/components/Accordion.tsx +5 -2
- package/src/components/Breadcrumbs.tsx +9 -2
- package/src/components/Button.tsx +4 -1
- package/src/components/CalendarRange.tsx +9 -0
- package/src/components/Caption.tsx +11 -1
- package/src/components/Card.tsx +3 -2
- package/src/components/Checkbox.tsx +5 -0
- package/src/components/ContentTab.tsx +14 -12
- package/src/components/ContentTabs.tsx +6 -2
- package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +4 -1
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +7 -0
- package/src/components/DataGrid/PinnedColumns.tsx +8 -1
- package/src/components/DataGrid/TableBody/LoadingCell.tsx +7 -3
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +7 -1
- package/src/components/DataGrid/TableBody/index.tsx +7 -1
- package/src/components/DataGrid/index.tsx +18 -2
- package/src/components/DataGrid/types.ts +1 -0
- package/src/components/DataGridCell.tsx +12 -0
- package/src/components/DateInput.tsx +4 -0
- package/src/components/DateRangeInput.tsx +4 -0
- package/src/components/Display.tsx +3 -0
- package/src/components/FilterGroup.tsx +10 -0
- package/src/components/FullViewportBox.tsx +3 -0
- package/src/components/Grid.tsx +3 -0
- package/src/components/Heading.tsx +3 -0
- package/src/components/HorizontalDivider.tsx +2 -2
- package/src/components/Icon.tsx +3 -0
- package/src/components/Input.tsx +32 -36
- package/src/components/InputGroup.tsx +6 -2
- package/src/components/Label.tsx +3 -0
- package/src/components/Link.tsx +3 -0
- package/src/components/List.tsx +3 -1
- package/src/components/LoadingScrim.tsx +2 -1
- package/src/components/MainBar.tsx +3 -0
- package/src/components/Menu.tsx +3 -0
- package/src/components/MenuOption.tsx +4 -0
- package/src/components/MobileDataGrid.tsx +12 -3
- package/src/components/Modal.tsx +7 -0
- package/src/components/ModalButtons.tsx +5 -0
- package/src/components/ModalContent.tsx +3 -0
- package/src/components/ModalHeader.tsx +5 -1
- package/src/components/ModalScrim.tsx +3 -0
- package/src/components/NavigationTab.tsx +3 -0
- package/src/components/NavigationTabs.tsx +7 -3
- package/src/components/NestedMenu.tsx +5 -2
- package/src/components/Notification.tsx +4 -0
- package/src/components/OptionPill.tsx +5 -0
- package/src/components/PDFViewer.tsx +16 -8
- package/src/components/Paragraph.tsx +3 -0
- package/src/components/Password.tsx +7 -2
- package/src/components/PaymentOnAccountModal.tsx +6 -2
- package/src/components/ProjectBar.tsx +3 -0
- package/src/components/Radio.tsx +4 -1
- package/src/components/Search.tsx +5 -0
- package/src/components/Select.tsx +4 -0
- package/src/components/SelectPaymentMethod.tsx +17 -3
- package/src/components/SideMenu.tsx +3 -0
- package/src/components/SideMenuGroup.tsx +4 -1
- package/src/components/SideMenuItem.tsx +4 -0
- package/src/components/Spinner.tsx +3 -1
- package/src/components/Stack.tsx +3 -0
- package/src/components/StatusPill.tsx +4 -1
- package/src/components/Stepper.tsx +6 -1
- package/src/components/Subheader.tsx +3 -0
- package/src/components/Textarea.tsx +4 -1
- package/src/components/Theme.tsx +3 -0
- package/src/components/Time.tsx +7 -1
- package/src/components/Toast.tsx +8 -3
- package/src/components/Tooltip.tsx +4 -0
- package/src/components/TopBar.tsx +7 -2
- package/src/components/Upload.tsx +10 -4
package/src/components/Label.tsx
CHANGED
|
@@ -6,6 +6,7 @@ export type Tags = "span" | "label" | "p" | "a";
|
|
|
6
6
|
type LabelProps = {
|
|
7
7
|
as?: Tags;
|
|
8
8
|
id?: string;
|
|
9
|
+
testid?: string;
|
|
9
10
|
} & AsProps<Tags> &
|
|
10
11
|
TextAttributes &
|
|
11
12
|
TypographyProps;
|
|
@@ -17,12 +18,14 @@ export const Label = ({
|
|
|
17
18
|
color,
|
|
18
19
|
align,
|
|
19
20
|
id,
|
|
21
|
+
testid,
|
|
20
22
|
...props
|
|
21
23
|
}: LabelProps) => {
|
|
22
24
|
const Element = as;
|
|
23
25
|
return (
|
|
24
26
|
<Element
|
|
25
27
|
id={id}
|
|
28
|
+
data-testid={testid}
|
|
26
29
|
className={clsx(
|
|
27
30
|
typography.label,
|
|
28
31
|
align === "left" && "text-left",
|
package/src/components/Link.tsx
CHANGED
|
@@ -14,6 +14,7 @@ export type LinkProps = AsProps &
|
|
|
14
14
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
15
15
|
underline?: boolean;
|
|
16
16
|
id?: string;
|
|
17
|
+
testid?: string;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export const Link = ({
|
|
@@ -26,6 +27,7 @@ export const Link = ({
|
|
|
26
27
|
paddedY,
|
|
27
28
|
align,
|
|
28
29
|
underline = false,
|
|
30
|
+
testid,
|
|
29
31
|
...props
|
|
30
32
|
}: LinkProps) => {
|
|
31
33
|
const Component = as;
|
|
@@ -100,6 +102,7 @@ export const Link = ({
|
|
|
100
102
|
}}
|
|
101
103
|
aria-disabled={disabled}
|
|
102
104
|
tabIndex={disabled ? -1 : undefined}
|
|
105
|
+
data-testid={testid}
|
|
103
106
|
/>
|
|
104
107
|
);
|
|
105
108
|
};
|
package/src/components/List.tsx
CHANGED
|
@@ -2,14 +2,16 @@ export function List({
|
|
|
2
2
|
children,
|
|
3
3
|
ordered,
|
|
4
4
|
id,
|
|
5
|
+
testid,
|
|
5
6
|
}: {
|
|
6
7
|
children: React.ReactNode;
|
|
7
8
|
ordered?: boolean;
|
|
8
9
|
id?: string;
|
|
10
|
+
testid?: string;
|
|
9
11
|
}) {
|
|
10
12
|
const Element = ordered ? "ol" : "ul";
|
|
11
13
|
return (
|
|
12
|
-
<Element id={id} className="list-disc list-inside">
|
|
14
|
+
<Element id={id} data-testid={testid} className="list-disc list-inside">
|
|
13
15
|
{children}
|
|
14
16
|
</Element>
|
|
15
17
|
);
|
|
@@ -11,7 +11,7 @@ import { Spinner } from "./Spinner";
|
|
|
11
11
|
* @example
|
|
12
12
|
* <LoadingScrim />
|
|
13
13
|
*/
|
|
14
|
-
export function LoadingScrim({ className }: { className?: string }) {
|
|
14
|
+
export function LoadingScrim({ className, testid }: { className?: string, testid?: string }) {
|
|
15
15
|
return (
|
|
16
16
|
<div
|
|
17
17
|
className={clsx(
|
|
@@ -21,6 +21,7 @@ export function LoadingScrim({ className }: { className?: string }) {
|
|
|
21
21
|
aria-modal="true"
|
|
22
22
|
role="dialog"
|
|
23
23
|
tabIndex={-1}
|
|
24
|
+
data-testid={testid}
|
|
24
25
|
>
|
|
25
26
|
<div className="flex items-center justify-center">
|
|
26
27
|
<Spinner size="large" />
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
type MainBarProps = {
|
|
12
12
|
id?: string;
|
|
13
|
+
testid?: string;
|
|
13
14
|
leftContent?: ReactNode;
|
|
14
15
|
rightContent?: ReactNode;
|
|
15
16
|
mobileLeftContent?: ReactNode;
|
|
@@ -21,6 +22,7 @@ type MainBarProps = {
|
|
|
21
22
|
|
|
22
23
|
export const MainBar = ({
|
|
23
24
|
id,
|
|
25
|
+
testid,
|
|
24
26
|
leftContent: left,
|
|
25
27
|
rightContent: right,
|
|
26
28
|
mobileLeftContent: mobileLeft,
|
|
@@ -35,6 +37,7 @@ export const MainBar = ({
|
|
|
35
37
|
return (
|
|
36
38
|
<div
|
|
37
39
|
id={id}
|
|
40
|
+
data-testid={testid}
|
|
38
41
|
className={clsx(
|
|
39
42
|
"min-h-mobile-container-padding",
|
|
40
43
|
"bg-background-brand-normal items-center justify-between",
|
package/src/components/Menu.tsx
CHANGED
|
@@ -18,6 +18,7 @@ export type MenuPosition = "right" | "bottom" | "bottom-right";
|
|
|
18
18
|
|
|
19
19
|
type MenuProps = {
|
|
20
20
|
id?: string;
|
|
21
|
+
testid?: string;
|
|
21
22
|
positionTo?: RefObject<HTMLElement | null>;
|
|
22
23
|
mobilePositionTo?: RefObject<HTMLElement | null>;
|
|
23
24
|
show?: boolean;
|
|
@@ -34,6 +35,7 @@ type MenuProps = {
|
|
|
34
35
|
|
|
35
36
|
export const Menu = ({
|
|
36
37
|
id,
|
|
38
|
+
testid,
|
|
37
39
|
children,
|
|
38
40
|
className,
|
|
39
41
|
ref,
|
|
@@ -128,6 +130,7 @@ export const Menu = ({
|
|
|
128
130
|
createPortal(
|
|
129
131
|
<div
|
|
130
132
|
id={id}
|
|
133
|
+
data-testid={testid}
|
|
131
134
|
ref={setRefs}
|
|
132
135
|
className={clsx(
|
|
133
136
|
"shadow-4 rounded-base bg-background-grouped-primary-normal overflow-x-hidden overflow-y-auto flex flex-col outline-0",
|
|
@@ -12,6 +12,7 @@ import { useMatchesMobile } from "../hooks";
|
|
|
12
12
|
|
|
13
13
|
type BaseProps = PropsWithChildren<{
|
|
14
14
|
id?: string;
|
|
15
|
+
testid?: string;
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
value?: string;
|
|
17
18
|
before?: ReactNode;
|
|
@@ -75,6 +76,7 @@ type MenuOptionProps = ActionProps | NormalProps;
|
|
|
75
76
|
|
|
76
77
|
export const MenuOption = ({
|
|
77
78
|
id,
|
|
79
|
+
testid,
|
|
78
80
|
children,
|
|
79
81
|
disabled = false,
|
|
80
82
|
variant = "normal",
|
|
@@ -184,6 +186,7 @@ export const MenuOption = ({
|
|
|
184
186
|
<>
|
|
185
187
|
<div
|
|
186
188
|
id={id}
|
|
189
|
+
data-testid={testid}
|
|
187
190
|
ref={actualRef}
|
|
188
191
|
className={clsx(
|
|
189
192
|
"flex items-center cursor-pointer w-full text-left relative outline-none",
|
|
@@ -257,6 +260,7 @@ export const MenuOption = ({
|
|
|
257
260
|
return (
|
|
258
261
|
<MenuOption
|
|
259
262
|
id={id ? `${id}-back` : undefined}
|
|
263
|
+
testid={testid ? `${testid}-back` : undefined}
|
|
260
264
|
onClick={() => {
|
|
261
265
|
closeSubMenuLevel?.(currentSubMenuLevel ?? 0);
|
|
262
266
|
}}
|
|
@@ -25,6 +25,7 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
25
25
|
renderLink,
|
|
26
26
|
renderChevron,
|
|
27
27
|
id,
|
|
28
|
+
testid,
|
|
28
29
|
}: {
|
|
29
30
|
columns: MobileColumnDef<T>[];
|
|
30
31
|
data: T[];
|
|
@@ -33,10 +34,12 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
33
34
|
renderLink?: (data: T) => React.ReactNode;
|
|
34
35
|
renderChevron?: (data: T) => React.ReactNode;
|
|
35
36
|
id?: string;
|
|
37
|
+
testid?: string;
|
|
36
38
|
} & ComponentProps<"div">) {
|
|
37
39
|
return (
|
|
38
40
|
<div
|
|
39
41
|
id={id}
|
|
42
|
+
data-testid={testid}
|
|
40
43
|
className={clsx(
|
|
41
44
|
"rounded",
|
|
42
45
|
"overflow-hidden",
|
|
@@ -47,11 +50,13 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
47
50
|
>
|
|
48
51
|
<MobileDataGridHeader
|
|
49
52
|
id={id ? `${id}-header` : undefined}
|
|
53
|
+
testid={testid ? `${testid}-header` : undefined}
|
|
50
54
|
header={header}
|
|
51
55
|
/>
|
|
52
56
|
{data.map((item) => (
|
|
53
57
|
<MobileDataGridCard
|
|
54
58
|
id={id ? `${id}-card-${getId(item)}` : undefined}
|
|
59
|
+
testid={testid ? `${testid}-card-${getId(item)}` : undefined}
|
|
55
60
|
data={item}
|
|
56
61
|
key={getId(item)}
|
|
57
62
|
columns={columns}
|
|
@@ -63,9 +68,9 @@ export function MobileDataGrid<T extends RowData>({
|
|
|
63
68
|
);
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
function MobileDataGridHeader({ header, id }: { header: string; id?: string }) {
|
|
71
|
+
function MobileDataGridHeader({ header, id, testid }: { header: string; id?: string; testid?: string }) {
|
|
67
72
|
return (
|
|
68
|
-
<div id={id} className="sticky top-0">
|
|
73
|
+
<div id={id} data-testid={testid} className="sticky top-0">
|
|
69
74
|
<Theme theme="brand">
|
|
70
75
|
<Stack
|
|
71
76
|
horizontal
|
|
@@ -90,21 +95,24 @@ function MobileDataGridCard<T extends RowData>({
|
|
|
90
95
|
renderLink,
|
|
91
96
|
renderChevron,
|
|
92
97
|
id,
|
|
98
|
+
testid
|
|
93
99
|
}: {
|
|
94
100
|
data: T;
|
|
95
101
|
columns: MobileColumnDef<T>[];
|
|
96
102
|
renderLink?: (data: T) => React.ReactNode;
|
|
97
103
|
renderChevron?: (data: T) => React.ReactNode;
|
|
98
104
|
id?: string;
|
|
105
|
+
testid?: string;
|
|
99
106
|
}) {
|
|
100
107
|
return (
|
|
101
|
-
<div id={id}>
|
|
108
|
+
<div id={id} data-testid={testid}>
|
|
102
109
|
<Stack sizing="component" padding>
|
|
103
110
|
<Stack horizontal horizontalMobile items="center" justify="between">
|
|
104
111
|
{renderLink && renderLink(data)}
|
|
105
112
|
<Stack horizontal horizontalMobile items="center" justify="end">
|
|
106
113
|
<Button
|
|
107
114
|
id={id ? `${id}-docs-button` : undefined}
|
|
115
|
+
testid={testid ? `${testid}-docs-button` : undefined}
|
|
108
116
|
iconOnly
|
|
109
117
|
variant="tertiary"
|
|
110
118
|
onClick={() => console.log("Edit", data.id)}
|
|
@@ -112,6 +120,7 @@ function MobileDataGridCard<T extends RowData>({
|
|
|
112
120
|
></Button>
|
|
113
121
|
<Button
|
|
114
122
|
id={id ? `${id}-swap-button` : undefined}
|
|
123
|
+
testid={testid ? `${testid}-swap-button` : undefined}
|
|
115
124
|
iconOnly
|
|
116
125
|
variant="tertiary"
|
|
117
126
|
onClick={() => console.log("Edit", data.id)}
|
package/src/components/Modal.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { useMounted } from "./useMounted";
|
|
|
14
14
|
|
|
15
15
|
type ModalProps = PropsWithChildren<{
|
|
16
16
|
id?: string;
|
|
17
|
+
testid?: string;
|
|
17
18
|
title?: string;
|
|
18
19
|
open?: boolean;
|
|
19
20
|
size?: "small" | "medium" | "large" | "x-large";
|
|
@@ -104,6 +105,7 @@ const sizes = {
|
|
|
104
105
|
|
|
105
106
|
export const Modal = ({
|
|
106
107
|
id,
|
|
108
|
+
testid,
|
|
107
109
|
title,
|
|
108
110
|
open = false,
|
|
109
111
|
size = "small",
|
|
@@ -231,6 +233,7 @@ export const Modal = ({
|
|
|
231
233
|
return createPortal(
|
|
232
234
|
<ModalScrim
|
|
233
235
|
id={id ? `${id}-scrim` : undefined}
|
|
236
|
+
testid={testid ? `${testid}-scrim` : undefined}
|
|
234
237
|
size={size}
|
|
235
238
|
ref={bgRef}
|
|
236
239
|
show={open}
|
|
@@ -238,6 +241,7 @@ export const Modal = ({
|
|
|
238
241
|
>
|
|
239
242
|
<div
|
|
240
243
|
id={id}
|
|
244
|
+
data-testid={testid}
|
|
241
245
|
ref={modalRef}
|
|
242
246
|
className={clsx(
|
|
243
247
|
"bg-white shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
@@ -250,6 +254,7 @@ export const Modal = ({
|
|
|
250
254
|
>
|
|
251
255
|
<ModalHeader
|
|
252
256
|
id={id ? `${id}-header` : undefined}
|
|
257
|
+
testid={testid ? `${testid}-header` : undefined}
|
|
253
258
|
title={title}
|
|
254
259
|
onClose={handleClose}
|
|
255
260
|
hideCloseIcon={hideCloseIcon}
|
|
@@ -258,6 +263,7 @@ export const Modal = ({
|
|
|
258
263
|
{children && (
|
|
259
264
|
<ModalContent
|
|
260
265
|
id={id ? `${id}-content` : undefined}
|
|
266
|
+
testid={testid ? `${testid}-content` : undefined}
|
|
261
267
|
fixedHeightScrolling={computedFixedHeightScrolling}
|
|
262
268
|
>
|
|
263
269
|
{children}
|
|
@@ -266,6 +272,7 @@ export const Modal = ({
|
|
|
266
272
|
{showButtons && (
|
|
267
273
|
<ModalButtons
|
|
268
274
|
id={id ? `${id}-buttons` : undefined}
|
|
275
|
+
testid={testid ? `${testid}-buttons` : undefined}
|
|
269
276
|
onClose={handleClose}
|
|
270
277
|
onContinue={onContinue}
|
|
271
278
|
customActions={customActions}
|
|
@@ -10,6 +10,7 @@ type ModalButtonsProps = {
|
|
|
10
10
|
sampleWidth?: boolean;
|
|
11
11
|
customActions?: React.ReactNode;
|
|
12
12
|
id?: string;
|
|
13
|
+
testid?: string;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export const ModalButtons = ({
|
|
@@ -17,10 +18,12 @@ export const ModalButtons = ({
|
|
|
17
18
|
onContinue,
|
|
18
19
|
customActions,
|
|
19
20
|
id,
|
|
21
|
+
testid
|
|
20
22
|
}: ModalButtonsProps) => {
|
|
21
23
|
return (
|
|
22
24
|
<div
|
|
23
25
|
id={id}
|
|
26
|
+
data-testid={testid}
|
|
24
27
|
className={clsx(
|
|
25
28
|
"border-t border-neutral-300 flex justify-end",
|
|
26
29
|
layoutPaddding,
|
|
@@ -31,6 +34,7 @@ export const ModalButtons = ({
|
|
|
31
34
|
<>
|
|
32
35
|
<Button
|
|
33
36
|
id={id ? `${id}-close-button` : undefined}
|
|
37
|
+
testid={testid ? `${testid}-close-button` : undefined}
|
|
34
38
|
variant="secondary"
|
|
35
39
|
leftIcon={<Icon name="close" size={24} />}
|
|
36
40
|
onClick={onClose}
|
|
@@ -41,6 +45,7 @@ export const ModalButtons = ({
|
|
|
41
45
|
|
|
42
46
|
<Button
|
|
43
47
|
id={id ? `${id}-continue-button` : undefined}
|
|
48
|
+
testid={testid ? `${testid}-continue-button` : undefined}
|
|
44
49
|
variant="primary"
|
|
45
50
|
leftIcon={<Icon name="check" size={24} />}
|
|
46
51
|
className="max-sm:w-full"
|
|
@@ -4,16 +4,19 @@ import { layoutPaddding } from "../classNames";
|
|
|
4
4
|
export interface ModalContentProps {
|
|
5
5
|
fixedHeightScrolling?: boolean;
|
|
6
6
|
id?: string;
|
|
7
|
+
testid?: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export function ModalContent({
|
|
10
11
|
fixedHeightScrolling,
|
|
11
12
|
children,
|
|
12
13
|
id,
|
|
14
|
+
testid
|
|
13
15
|
}: React.PropsWithChildren<ModalContentProps>) {
|
|
14
16
|
return (
|
|
15
17
|
<div
|
|
16
18
|
id={id}
|
|
19
|
+
data-testid={testid}
|
|
17
20
|
className={clsx(
|
|
18
21
|
"flex-grow desktop:flex-grow-0",
|
|
19
22
|
layoutPaddding,
|
|
@@ -11,6 +11,7 @@ type ModalHeaderProps = {
|
|
|
11
11
|
headerIcon?: React.ReactNode;
|
|
12
12
|
onClose?: () => void;
|
|
13
13
|
id?: string;
|
|
14
|
+
testid?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const ModalHeader = ({
|
|
@@ -19,10 +20,12 @@ export const ModalHeader = ({
|
|
|
19
20
|
headerIcon,
|
|
20
21
|
onClose,
|
|
21
22
|
id,
|
|
23
|
+
testid,
|
|
22
24
|
}: ModalHeaderProps) => {
|
|
23
25
|
return (
|
|
24
26
|
<div
|
|
25
27
|
id={id}
|
|
28
|
+
data-testid={testid}
|
|
26
29
|
className={clsx(
|
|
27
30
|
"flex justify-between items-center",
|
|
28
31
|
layoutPaddding,
|
|
@@ -32,7 +35,7 @@ export const ModalHeader = ({
|
|
|
32
35
|
<div className={clsx("flex items-center", layoutGroupGap)}>
|
|
33
36
|
{headerIcon}
|
|
34
37
|
{title && (
|
|
35
|
-
<Heading2 id={id ? `${id}-title` : undefined} as="p">
|
|
38
|
+
<Heading2 id={id ? `${id}-title` : undefined} testid={testid ? `${testid}-title` : undefined} as="p">
|
|
36
39
|
{title}
|
|
37
40
|
</Heading2>
|
|
38
41
|
)}
|
|
@@ -41,6 +44,7 @@ export const ModalHeader = ({
|
|
|
41
44
|
{!hideCloseIcon && (
|
|
42
45
|
<Button
|
|
43
46
|
id={id ? `${id}-close-button` : undefined}
|
|
47
|
+
testid={testid ? `${testid}-close-button` : undefined}
|
|
44
48
|
iconOnly
|
|
45
49
|
variant="tertiary"
|
|
46
50
|
onClick={onClose}
|
|
@@ -8,6 +8,7 @@ type ModalScrimProps = PropsWithChildren<{
|
|
|
8
8
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
9
9
|
ref?: React.Ref<HTMLDivElement>;
|
|
10
10
|
id?: string;
|
|
11
|
+
testid?: string;
|
|
11
12
|
}>;
|
|
12
13
|
|
|
13
14
|
export const ModalScrim = ({
|
|
@@ -17,10 +18,12 @@ export const ModalScrim = ({
|
|
|
17
18
|
onClick,
|
|
18
19
|
ref,
|
|
19
20
|
id,
|
|
21
|
+
testid,
|
|
20
22
|
}: ModalScrimProps) => {
|
|
21
23
|
return (
|
|
22
24
|
<div
|
|
23
25
|
id={id}
|
|
26
|
+
data-testid={testid}
|
|
24
27
|
className={clsx(
|
|
25
28
|
"overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center desktop:p-4 group bg-neutral-600/50 fixed opacity-0",
|
|
26
29
|
!show && " pointer-events-none",
|
|
@@ -5,6 +5,7 @@ import { CSSProperties } from "react";
|
|
|
5
5
|
|
|
6
6
|
export type NavigationTabProps = {
|
|
7
7
|
id?: string;
|
|
8
|
+
testid?: string;
|
|
8
9
|
label?: string;
|
|
9
10
|
onClick?: () => void;
|
|
10
11
|
selected?: boolean;
|
|
@@ -16,6 +17,7 @@ export type NavigationTabProps = {
|
|
|
16
17
|
|
|
17
18
|
export const NavigationTab = ({
|
|
18
19
|
id,
|
|
20
|
+
testid,
|
|
19
21
|
label,
|
|
20
22
|
onClick,
|
|
21
23
|
selected = false,
|
|
@@ -65,6 +67,7 @@ export const NavigationTab = ({
|
|
|
65
67
|
return (
|
|
66
68
|
<Button
|
|
67
69
|
id={id}
|
|
70
|
+
testid={testid}
|
|
68
71
|
variant="tertiary-critical"
|
|
69
72
|
colorClassName={textClassName}
|
|
70
73
|
className={clsx(
|
|
@@ -6,6 +6,7 @@ import { componentGap } from "../classNames";
|
|
|
6
6
|
|
|
7
7
|
type Tab = {
|
|
8
8
|
id?: string;
|
|
9
|
+
testid?: string;
|
|
9
10
|
label: string;
|
|
10
11
|
href?: string;
|
|
11
12
|
content?: ReactNode;
|
|
@@ -13,6 +14,7 @@ type Tab = {
|
|
|
13
14
|
|
|
14
15
|
export type NavigationTabsProps = {
|
|
15
16
|
id?: string;
|
|
17
|
+
testid?: string;
|
|
16
18
|
tabs: Tab[];
|
|
17
19
|
onTabChange?: (tabId: string) => void;
|
|
18
20
|
colorPrimitives?: "dmsi" | "agility";
|
|
@@ -20,11 +22,12 @@ export type NavigationTabsProps = {
|
|
|
20
22
|
|
|
21
23
|
export const NavigationTabs = ({
|
|
22
24
|
id,
|
|
25
|
+
testid,
|
|
23
26
|
tabs,
|
|
24
27
|
onTabChange,
|
|
25
28
|
colorPrimitives = "dmsi",
|
|
26
29
|
}: NavigationTabsProps) => {
|
|
27
|
-
const [selectedTab, setSelectedTab] = useState<string>(tabs[0]?.id);
|
|
30
|
+
const [selectedTab, setSelectedTab] = useState<string>(tabs[0]?.id!);
|
|
28
31
|
|
|
29
32
|
const handleTabClick = (id: string) => {
|
|
30
33
|
setSelectedTab(id);
|
|
@@ -35,7 +38,7 @@ export const NavigationTabs = ({
|
|
|
35
38
|
const selectedTabHasHref = tabs.find((tab) => tab.id === selectedTab)?.href;
|
|
36
39
|
|
|
37
40
|
return (
|
|
38
|
-
<div id={id}>
|
|
41
|
+
<div id={id} data-testid={testid}>
|
|
39
42
|
<div>
|
|
40
43
|
<div
|
|
41
44
|
className={clsx(
|
|
@@ -47,9 +50,10 @@ export const NavigationTabs = ({
|
|
|
47
50
|
<NavigationTab
|
|
48
51
|
key={tab.id}
|
|
49
52
|
id={id ? `${id}-tab-${tab.id}` : undefined}
|
|
53
|
+
testid={testid ? `${testid}-tab-${tab.id}` : undefined}
|
|
50
54
|
label={tab.label}
|
|
51
55
|
selected={selectedTab === tab.id}
|
|
52
|
-
onClick={() => handleTabClick(tab.id)}
|
|
56
|
+
onClick={() => handleTabClick(tab.id!)}
|
|
53
57
|
colorPrimitives={colorPrimitives}
|
|
54
58
|
href={tab.href}
|
|
55
59
|
/>
|
|
@@ -19,10 +19,11 @@ export type NestedMenuEntry = {
|
|
|
19
19
|
export type NestedMenuProps = {
|
|
20
20
|
currentMenu: NestedMenuEntry; // Current menu entry, if any
|
|
21
21
|
onMenuClick: (entry: NestedMenuEntry | null) => void; // Callback when a menu item is clicked. tailing
|
|
22
|
+
testid?: string;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export function NestedMenu(props: NestedMenuProps) {
|
|
25
|
-
const { onMenuClick, currentMenu } = props;
|
|
26
|
+
const { onMenuClick, currentMenu, testid } = props;
|
|
26
27
|
const [selectedIndex, setSelectedIndex] = useState<number>(0);
|
|
27
28
|
|
|
28
29
|
useKeydown(
|
|
@@ -68,6 +69,7 @@ export function NestedMenu(props: NestedMenuProps) {
|
|
|
68
69
|
return (
|
|
69
70
|
<div className="flex flex-col w-full">
|
|
70
71
|
<MenuOption
|
|
72
|
+
testid={testid ? `${testid}-back` : undefined}
|
|
71
73
|
variant="action"
|
|
72
74
|
before={<Icon name="chevron_left" className="icon" size={24} />}
|
|
73
75
|
onClick={() => handleMenuClick(currentMenu.previousMenu ?? null, true)}
|
|
@@ -77,11 +79,12 @@ export function NestedMenu(props: NestedMenuProps) {
|
|
|
77
79
|
? currentMenu.previousMenu.label
|
|
78
80
|
: "Main Menu"}
|
|
79
81
|
</MenuOption>
|
|
80
|
-
<MenuOption variant="action">
|
|
82
|
+
<MenuOption variant="action" testid={testid ? `${testid}-title` : undefined}>
|
|
81
83
|
{currentMenu.title ?? currentMenu.label}
|
|
82
84
|
</MenuOption>
|
|
83
85
|
{(currentMenu.subEntries || []).map((item, idx) => (
|
|
84
86
|
<MenuOption
|
|
87
|
+
testid={testid ? `${testid}-${item.label}` : undefined}
|
|
85
88
|
key={item.id}
|
|
86
89
|
variant="normal"
|
|
87
90
|
onClick={() => handleMenuClick(item)}
|
|
@@ -12,6 +12,7 @@ import { Stack } from "./Stack";
|
|
|
12
12
|
|
|
13
13
|
export interface NotificationProps {
|
|
14
14
|
id?: string;
|
|
15
|
+
testid?: string;
|
|
15
16
|
variant?: "success" | "warning" | "error" | "info";
|
|
16
17
|
title?: string;
|
|
17
18
|
message?: string;
|
|
@@ -61,6 +62,7 @@ const variants = {
|
|
|
61
62
|
|
|
62
63
|
export const Notification = ({
|
|
63
64
|
id,
|
|
65
|
+
testid,
|
|
64
66
|
variant = "success",
|
|
65
67
|
title,
|
|
66
68
|
message,
|
|
@@ -82,6 +84,7 @@ export const Notification = ({
|
|
|
82
84
|
return (
|
|
83
85
|
<div
|
|
84
86
|
id={id}
|
|
87
|
+
data-testid={testid}
|
|
85
88
|
className={clsx(
|
|
86
89
|
"flex gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-desktop-compact-layout-gap justify-between items-center border-2 rounded-sm w-full p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding bg-white max-w-240",
|
|
87
90
|
className,
|
|
@@ -112,6 +115,7 @@ export const Notification = ({
|
|
|
112
115
|
|
|
113
116
|
<Button
|
|
114
117
|
id={id ? `${id}-close-button` : undefined}
|
|
118
|
+
testid={testid ? `${testid}-close-button` : undefined}
|
|
115
119
|
iconOnly
|
|
116
120
|
variant="tertiary"
|
|
117
121
|
onClick={() => setVisible(false)}
|
|
@@ -13,6 +13,7 @@ import { Icon } from "./Icon";
|
|
|
13
13
|
|
|
14
14
|
type OptionPillProps = {
|
|
15
15
|
id?: string;
|
|
16
|
+
testid?: string;
|
|
16
17
|
selected?: boolean;
|
|
17
18
|
onClick?: () => void;
|
|
18
19
|
onRemove?: () => void;
|
|
@@ -22,6 +23,7 @@ type OptionPillProps = {
|
|
|
22
23
|
|
|
23
24
|
export const OptionPill = ({
|
|
24
25
|
id,
|
|
26
|
+
testid,
|
|
25
27
|
selected = false,
|
|
26
28
|
onClick,
|
|
27
29
|
onRemove,
|
|
@@ -63,6 +65,7 @@ export const OptionPill = ({
|
|
|
63
65
|
return (
|
|
64
66
|
<div
|
|
65
67
|
id={id}
|
|
68
|
+
data-testid={testid}
|
|
66
69
|
onClick={handleOnClick}
|
|
67
70
|
{...props}
|
|
68
71
|
{...additionalAttributes}
|
|
@@ -79,6 +82,7 @@ export const OptionPill = ({
|
|
|
79
82
|
>
|
|
80
83
|
<Label
|
|
81
84
|
id={id ? `${id}-label` : undefined}
|
|
85
|
+
testid={testid ? `${testid}-label` : undefined}
|
|
82
86
|
padded
|
|
83
87
|
className={componentPaddingYUsingComponentGap}
|
|
84
88
|
>
|
|
@@ -88,6 +92,7 @@ export const OptionPill = ({
|
|
|
88
92
|
{removable && (
|
|
89
93
|
<Button
|
|
90
94
|
id={id ? `${id}-remove-button` : undefined}
|
|
95
|
+
testid={testid ? `${testid}-remove-button` : undefined}
|
|
91
96
|
onClick={handleOnRemove}
|
|
92
97
|
disabled={disabled}
|
|
93
98
|
className={clsx(
|
|
@@ -13,10 +13,11 @@ type PDFViewerProps = {
|
|
|
13
13
|
onClose: () => void;
|
|
14
14
|
encodedPdfs: { fileName: string; base64: string }[];
|
|
15
15
|
customActions?: React.ReactNode;
|
|
16
|
+
testid?: string;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export function PDFViewer(props: PDFViewerProps) {
|
|
19
|
-
const { isOpen, onClose, encodedPdfs, customActions } = props;
|
|
20
|
+
const { isOpen, onClose, encodedPdfs, customActions, testid } = props;
|
|
20
21
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
21
22
|
const [isDownloading, setIsDownloading] = useState(false);
|
|
22
23
|
|
|
@@ -39,19 +40,21 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<Modal
|
|
43
|
+
testid={testid}
|
|
42
44
|
open={isOpen}
|
|
43
45
|
onClose={onClose}
|
|
44
46
|
showButtons={!!customActions}
|
|
45
47
|
customActions={customActions}
|
|
46
48
|
headerIcon={
|
|
47
|
-
<DownloadIcon onClick={handleDownload} isDownloading={isDownloading} />
|
|
49
|
+
<DownloadIcon testid={testid ? `${testid}-download-icon` : undefined} onClick={handleDownload} isDownloading={isDownloading} />
|
|
48
50
|
}
|
|
49
51
|
>
|
|
50
52
|
<Stack sizing="layout">
|
|
51
|
-
<PDFElement b64={encodedPdfs[currentIndex].base64} />
|
|
53
|
+
<PDFElement testid={testid} b64={encodedPdfs[currentIndex].base64} />
|
|
52
54
|
<Stack horizontal overflowX="auto" sizing="layout-group">
|
|
53
55
|
{encodedPdfs.map((pdf, index) => (
|
|
54
56
|
<Button
|
|
57
|
+
testid={testid ? `${testid}-${pdf.fileName}-button` : undefined}
|
|
55
58
|
variant={index === currentIndex ? "primary" : "secondary"}
|
|
56
59
|
key={`${pdf.fileName}-${index}`}
|
|
57
60
|
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
@@ -81,12 +84,15 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
81
84
|
function DownloadIcon({
|
|
82
85
|
onClick,
|
|
83
86
|
isDownloading,
|
|
87
|
+
testid
|
|
84
88
|
}: {
|
|
85
89
|
onClick: () => void;
|
|
86
90
|
isDownloading?: boolean;
|
|
91
|
+
testid?: string;
|
|
87
92
|
}) {
|
|
88
93
|
return (
|
|
89
94
|
<Button
|
|
95
|
+
testid={testid}
|
|
90
96
|
iconOnly
|
|
91
97
|
variant="tertiary"
|
|
92
98
|
leftIcon={<Icon name={isDownloading ? "cached" : "download"} />}
|
|
@@ -95,7 +101,7 @@ function DownloadIcon({
|
|
|
95
101
|
);
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
function PDFElement({ b64 }: { b64: string }) {
|
|
104
|
+
function PDFElement({ b64, testid }: { b64: string, testid?: string }) {
|
|
99
105
|
const [page, setPage] = useState(1);
|
|
100
106
|
const canvasRef = useRef(null);
|
|
101
107
|
|
|
@@ -109,11 +115,12 @@ function PDFElement({ b64 }: { b64: string }) {
|
|
|
109
115
|
|
|
110
116
|
return (
|
|
111
117
|
<div className="flex flex-col space-y-4">
|
|
112
|
-
{pdfDocument ? <canvas ref={canvasRef} /> : <div>Loading PDF...</div>}
|
|
118
|
+
{pdfDocument ? <canvas data-testid={testid ? `${testid}-pdf-content` : undefined} ref={canvasRef} /> : <div data-testid={testid ? `${testid}-pdf-loading` : undefined}>Loading PDF...</div>}
|
|
113
119
|
{pdfDocument?.numPages && pdfDocument.numPages > 1 && (
|
|
114
|
-
<ul className="flex flex-row justify-between items-center">
|
|
120
|
+
<ul className="flex flex-row justify-between items-center" data-testid={testid ? `${testid}-pdf-pagination` : undefined}>
|
|
115
121
|
<li className="previous">
|
|
116
122
|
<button
|
|
123
|
+
data-testid={testid ? `${testid}-pdf-pagination-previous-button` : undefined}
|
|
117
124
|
disabled={page === 1}
|
|
118
125
|
onClick={() => setPage(page - 1)}
|
|
119
126
|
className="not-disabled:cursor-pointer not-disabled:hover:underline "
|
|
@@ -121,11 +128,12 @@ function PDFElement({ b64 }: { b64: string }) {
|
|
|
121
128
|
<Caption>Previous</Caption>
|
|
122
129
|
</button>
|
|
123
130
|
</li>
|
|
124
|
-
<li className="text-label-desktop text-text-on-action-primary-normal">
|
|
125
|
-
Page {page} of {pdfDocument!.numPages}
|
|
131
|
+
<li data-testid={testid ? `${testid}-pdf-pagination-text` : undefined} className="text-label-desktop text-text-on-action-primary-normal">
|
|
132
|
+
Page <span data-testid={testid ? `${testid}-pdf-pagination-page-${page}` : undefined}>{page}</span> of <span data-testid={testid ? `${testid}-pdf-pagination-total-page-${pdfDocument!.numPages}` : undefined}>{pdfDocument!.numPages}</span>
|
|
126
133
|
</li>
|
|
127
134
|
<li className="next">
|
|
128
135
|
<button
|
|
136
|
+
data-testid={testid ? `${testid}-pdf-pagination-next-button` : undefined}
|
|
129
137
|
disabled={page === pdfDocument!.numPages}
|
|
130
138
|
onClick={() => setPage(page + 1)}
|
|
131
139
|
className="not-disabled:cursor-pointer not-disabled:hover:underline "
|