@dmsi/wedgekit-react 0.0.551 → 0.0.552

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.
Files changed (137) hide show
  1. package/package.json +2 -3
  2. package/src/brand.css +0 -125
  3. package/src/classNames.ts +0 -174
  4. package/src/components/AccessChangerTabItem.tsx +0 -71
  5. package/src/components/Accordion.tsx +0 -108
  6. package/src/components/Alert.tsx +0 -81
  7. package/src/components/Breadcrumbs.tsx +0 -142
  8. package/src/components/Button.tsx +0 -216
  9. package/src/components/CalendarRange.tsx +0 -628
  10. package/src/components/Caption.tsx +0 -144
  11. package/src/components/Card.tsx +0 -88
  12. package/src/components/Checkbox.tsx +0 -206
  13. package/src/components/CompactImagesPreview.tsx +0 -135
  14. package/src/components/ContentTab.tsx +0 -84
  15. package/src/components/ContentTabs.tsx +0 -136
  16. package/src/components/DMSiLogo.tsx +0 -33
  17. package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +0 -35
  18. package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +0 -74
  19. package/src/components/DataGrid/PinnedColumns.tsx +0 -183
  20. package/src/components/DataGrid/TableBody/LoadingCell.tsx +0 -44
  21. package/src/components/DataGrid/TableBody/TableBodyRow.tsx +0 -157
  22. package/src/components/DataGrid/TableBody/index.tsx +0 -185
  23. package/src/components/DataGrid/index.tsx +0 -756
  24. package/src/components/DataGrid/types.ts +0 -98
  25. package/src/components/DataGrid/utils.tsx +0 -15
  26. package/src/components/DataGridCell.tsx +0 -526
  27. package/src/components/DataTable.tsx +0 -881
  28. package/src/components/DateInput.tsx +0 -306
  29. package/src/components/DateRangeInput.tsx +0 -758
  30. package/src/components/DebugJson.tsx +0 -28
  31. package/src/components/Display.tsx +0 -66
  32. package/src/components/EditingContext.tsx +0 -43
  33. package/src/components/EmptyCartIcon.tsx +0 -18
  34. package/src/components/FilterGroup.tsx +0 -264
  35. package/src/components/FullViewportBox.tsx +0 -19
  36. package/src/components/Grid.tsx +0 -97
  37. package/src/components/Heading.tsx +0 -72
  38. package/src/components/HorizontalDivider.tsx +0 -22
  39. package/src/components/Icon.tsx +0 -39
  40. package/src/components/ImagePlaceholder.tsx +0 -22
  41. package/src/components/Input.tsx +0 -609
  42. package/src/components/InputGroup.tsx +0 -59
  43. package/src/components/Label.tsx +0 -46
  44. package/src/components/Link.tsx +0 -117
  45. package/src/components/List.tsx +0 -18
  46. package/src/components/ListGroup.tsx +0 -82
  47. package/src/components/LiveChatComponent.tsx +0 -56
  48. package/src/components/LoadingScrim.tsx +0 -33
  49. package/src/components/LogoAgilityTopBar.tsx +0 -54
  50. package/src/components/LogoDMSiTopBar.tsx +0 -33
  51. package/src/components/LogoMillworkTopBar.tsx +0 -119
  52. package/src/components/MainBar.tsx +0 -91
  53. package/src/components/MaxViewportBox.tsx +0 -19
  54. package/src/components/Menu.tsx +0 -316
  55. package/src/components/MenuOption.tsx +0 -330
  56. package/src/components/MobileDataGrid/ColumnList.tsx +0 -66
  57. package/src/components/MobileDataGrid/ColumnSelector/index.tsx +0 -97
  58. package/src/components/MobileDataGrid/GridContextProvider/GridContext.tsx +0 -25
  59. package/src/components/MobileDataGrid/GridContextProvider/index.tsx +0 -132
  60. package/src/components/MobileDataGrid/GridContextProvider/useGridContext.ts +0 -10
  61. package/src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx +0 -27
  62. package/src/components/MobileDataGrid/MobileDataGridCard/index.tsx +0 -138
  63. package/src/components/MobileDataGrid/MobileDataGridHeader.tsx +0 -81
  64. package/src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx +0 -42
  65. package/src/components/MobileDataGrid/RowDetailModalProvider/index.tsx +0 -68
  66. package/src/components/MobileDataGrid/dataGridReducer.ts +0 -55
  67. package/src/components/MobileDataGrid/index.tsx +0 -92
  68. package/src/components/MobileDataGrid/types.ts +0 -4
  69. package/src/components/Modal.tsx +0 -312
  70. package/src/components/ModalButtons.tsx +0 -62
  71. package/src/components/ModalContent.tsx +0 -31
  72. package/src/components/ModalHeader.tsx +0 -78
  73. package/src/components/ModalScrim.tsx +0 -42
  74. package/src/components/NavigationTab.tsx +0 -95
  75. package/src/components/NavigationTabs.tsx +0 -70
  76. package/src/components/NestedMenu.tsx +0 -131
  77. package/src/components/Notification.tsx +0 -128
  78. package/src/components/OptionPill.tsx +0 -139
  79. package/src/components/OrderCheckIcon.tsx +0 -19
  80. package/src/components/PDFViewer/DownloadIcon.tsx +0 -25
  81. package/src/components/PDFViewer/PDFElement.tsx +0 -90
  82. package/src/components/PDFViewer/PDFNavigation.tsx +0 -68
  83. package/src/components/PDFViewer/PDFPage.tsx +0 -34
  84. package/src/components/PDFViewer/index.tsx +0 -128
  85. package/src/components/Pagination.tsx +0 -182
  86. package/src/components/Paragraph.tsx +0 -55
  87. package/src/components/Password.tsx +0 -62
  88. package/src/components/ProductImagePreview/CarouselPagination.tsx +0 -54
  89. package/src/components/ProductImagePreview/MobileImageCarousel.tsx +0 -226
  90. package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +0 -219
  91. package/src/components/ProductImagePreview/Thumbnail.tsx +0 -55
  92. package/src/components/ProductImagePreview/ZoomWindow.tsx +0 -136
  93. package/src/components/ProductImagePreview/index.tsx +0 -182
  94. package/src/components/ProductImagePreview/useProductImagePreview.ts +0 -211
  95. package/src/components/ProjectBar.tsx +0 -82
  96. package/src/components/Radio.tsx +0 -146
  97. package/src/components/Search.tsx +0 -152
  98. package/src/components/SearchResultImage/index.tsx +0 -39
  99. package/src/components/Select.tsx +0 -114
  100. package/src/components/SideMenu.tsx +0 -30
  101. package/src/components/SideMenuGroup.tsx +0 -95
  102. package/src/components/SideMenuItem.tsx +0 -109
  103. package/src/components/SimpleTable.tsx +0 -77
  104. package/src/components/SkeletonParagraph.tsx +0 -31
  105. package/src/components/Spinner.tsx +0 -32
  106. package/src/components/Stack.tsx +0 -347
  107. package/src/components/StatusPill.tsx +0 -59
  108. package/src/components/Stepper.tsx +0 -128
  109. package/src/components/Subheader.tsx +0 -50
  110. package/src/components/Surface.tsx +0 -37
  111. package/src/components/Swatch.tsx +0 -1341
  112. package/src/components/Textarea.tsx +0 -102
  113. package/src/components/Theme.tsx +0 -27
  114. package/src/components/Time.tsx +0 -460
  115. package/src/components/Toast.tsx +0 -268
  116. package/src/components/Tooltip.tsx +0 -159
  117. package/src/components/TopBar.tsx +0 -139
  118. package/src/components/Upload.tsx +0 -107
  119. package/src/components/WorldpayIframe.tsx +0 -7
  120. package/src/components/index.ts +0 -34
  121. package/src/components/useMenuSystem.tsx +0 -456
  122. package/src/components/useMounted.tsx +0 -14
  123. package/src/darkmode.css +0 -278
  124. package/src/fonts.css +0 -23
  125. package/src/hooks/index.ts +0 -4
  126. package/src/hooks/useInfiniteScroll.tsx +0 -40
  127. package/src/hooks/useKeydown.ts +0 -42
  128. package/src/hooks/useMatchesMedia.ts +0 -18
  129. package/src/hooks/useTableLayout.ts +0 -106
  130. package/src/index.css +0 -800
  131. package/src/index.tsx +0 -5
  132. package/src/types.ts +0 -150
  133. package/src/utils/date.ts +0 -236
  134. package/src/utils/formatting.tsx +0 -81
  135. package/src/utils/index.ts +0 -4
  136. package/src/utils/mergeObjectArrays.ts +0 -18
  137. package/src/utils.ts +0 -24
@@ -1,152 +0,0 @@
1
- "use client";
2
- import {
3
- ReactNode,
4
- RefObject,
5
- useEffect,
6
- useId,
7
- useRef,
8
- useState,
9
- } from "react";
10
- import { Input, InputBaseProps } from "./Input";
11
-
12
- export interface SearchProps {
13
- id?: string;
14
- testid?: string;
15
- renderMenu?: (props: {
16
- id?: string;
17
- testid?: string;
18
- positionTo: RefObject<HTMLElement | null> | undefined;
19
- show: boolean;
20
- setShow: (value: boolean) => void;
21
- topOffset?: number | null;
22
- autoFocusOff?: boolean;
23
- menuName?: string;
24
- }) => ReactNode;
25
- value?: string;
26
- autocompletePadding?: boolean;
27
- }
28
-
29
- export const Search = ({
30
- id,
31
- testid,
32
- label,
33
- error,
34
- children,
35
- readOnly,
36
- renderMenu,
37
- onClick,
38
- wrapperClassName,
39
- removeRoundness,
40
- autocompletePadding = false,
41
- ...props
42
- }: Omit<InputBaseProps, "after" | "id"> & SearchProps) => {
43
- const inputRef = useRef<HTMLInputElement>(null);
44
- const inputContainerRef = useRef(null);
45
- const preventFocusOnInitialRender = useRef(true);
46
- const [show, setShow] = useState(false);
47
- const [clearing, setClearing] = useState(false);
48
- const uniqueId = useId();
49
- const searchMenuName = `search-menu-${uniqueId}`;
50
-
51
- useEffect(() => {
52
- if (preventFocusOnInitialRender.current) {
53
- preventFocusOnInitialRender.current = false;
54
- return;
55
- }
56
-
57
- inputRef.current?.focus();
58
- }, [props.value]);
59
-
60
- return (
61
- <>
62
- <Input
63
- id={id}
64
- testid={testid}
65
- variant="search"
66
- inputContainerRef={inputContainerRef}
67
- ref={inputRef}
68
- label={label}
69
- wrapperClassName={wrapperClassName}
70
- autocompletePadding={autocompletePadding}
71
- onClick={(e) => {
72
- if (props.disabled || readOnly) {
73
- return;
74
- }
75
-
76
- if (clearing) {
77
- setClearing(false);
78
- return;
79
- }
80
-
81
- onClick?.(e);
82
- setShow(!show);
83
- }}
84
- onClear={() => {
85
- setClearing(true);
86
- }}
87
- onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
88
- setShow(true);
89
-
90
- if (["ArrowUp", "ArrowDown"].includes(e.key)) {
91
- e.preventDefault();
92
-
93
- const menu = document.querySelector<HTMLElement>(
94
- `[data-menu="${searchMenuName}"]`,
95
- );
96
- const selectedMenuOption =
97
- menu?.querySelector<HTMLElement>("[data-selected]");
98
-
99
- if (selectedMenuOption) {
100
- const allMenuOptions = Array.from(
101
- menu?.querySelectorAll<HTMLElement>('[role="menuitem"]') || [],
102
- );
103
- const currentIndex = allMenuOptions.indexOf(selectedMenuOption);
104
-
105
- let targetOption: HTMLElement | undefined;
106
-
107
- if (e.key === "ArrowDown") {
108
- targetOption =
109
- allMenuOptions[currentIndex + 1] || allMenuOptions[0]; // Wrap to first
110
- } else {
111
- targetOption =
112
- allMenuOptions[currentIndex - 1] ||
113
- allMenuOptions[allMenuOptions.length - 1]; // Wrap to last
114
- }
115
-
116
- targetOption?.focus();
117
- } else {
118
- const toFocusMenuOption =
119
- e.key === "ArrowDown"
120
- ? menu?.querySelector<HTMLElement>('[role="menuitem"]')
121
- : menu?.querySelector<HTMLElement>(
122
- '[role="menuitem"]:last-child',
123
- );
124
-
125
- toFocusMenuOption?.focus();
126
- }
127
- }
128
- }}
129
- error={error}
130
- readOnly={readOnly}
131
- removeRoundness={removeRoundness}
132
- focus={renderMenu && show}
133
- {...props}
134
- />
135
-
136
- {renderMenu
137
- ? renderMenu({
138
- id: id ? `${id}-menu` : undefined,
139
- testid: testid ? `${testid}-menu` : undefined,
140
- positionTo: inputContainerRef,
141
- show,
142
- setShow,
143
- topOffset: props.caption ? -16 : null,
144
- autoFocusOff: true,
145
- menuName: searchMenuName,
146
- })
147
- : children}
148
- </>
149
- );
150
- };
151
-
152
- Search.displayName = "Search";
@@ -1,39 +0,0 @@
1
- import { useState } from "react";
2
- import { ImagePlaceholder } from "../ImagePlaceholder";
3
-
4
- export type SearchResultImageProps = {
5
- width?: number;
6
- height?: number;
7
- src?: string | null;
8
- alt: string;
9
- className?: string;
10
- };
11
-
12
- export function SearchResultImage({
13
- width = 20,
14
- height = 20,
15
- src,
16
- alt,
17
- }: SearchResultImageProps) {
18
- const [imageError, setImageError] = useState(false);
19
-
20
- const showPlaceholder = imageError || !src;
21
-
22
- return (
23
- <>
24
- {showPlaceholder ? (
25
- <ImagePlaceholder width={width} height={height} />
26
- ) : (
27
- <img
28
- src={src}
29
- alt={alt}
30
- width={width}
31
- height={height}
32
- draggable={false}
33
- loading="lazy"
34
- onError={() => setImageError(true)}
35
- />
36
- )}
37
- </>
38
- );
39
- }
@@ -1,114 +0,0 @@
1
- "use client";
2
- import { ReactNode, RefObject, useEffect, useRef, useState } from "react";
3
- import { InputBase, InputBaseProps } from "./Input";
4
- import { Icon } from "./Icon";
5
- import clsx from "clsx";
6
-
7
- export interface SelectProps {
8
- id?: string;
9
- testid?: string;
10
- renderMenu?: (props: {
11
- id?: string;
12
- testid?: string;
13
- positionTo: RefObject<HTMLElement | null> | undefined;
14
- show: boolean;
15
- setShow: (value: boolean) => void;
16
- topOffset?: number | null;
17
- }) => ReactNode;
18
- displayValue?: string;
19
- }
20
-
21
- export const Select = ({
22
- id,
23
- testid,
24
- label,
25
- error,
26
- children,
27
- readOnly,
28
- renderMenu,
29
- onClick,
30
- className,
31
- wrapperClassName,
32
- removeRoundness,
33
- displayValue,
34
- value,
35
- ...props
36
- }: Omit<InputBaseProps, "after" | "id"> & SelectProps) => {
37
- const inputRef = useRef<HTMLInputElement>(null);
38
- const inputContainerRef = useRef(null);
39
- const preventFocusOnInitialRender = useRef(true);
40
- const [show, setShow] = useState(false);
41
-
42
- useEffect(() => {
43
- if (preventFocusOnInitialRender.current) {
44
- preventFocusOnInitialRender.current = false;
45
- return;
46
- }
47
-
48
- inputRef.current?.focus();
49
- }, [value]);
50
-
51
- return (
52
- <>
53
- <InputBase
54
- id={id}
55
- testid={testid}
56
- inputContainerRef={inputContainerRef}
57
- ref={inputRef}
58
- label={label}
59
- after={
60
- !readOnly && (
61
- <span
62
- className={clsx(
63
- props.disabled
64
- ? "text-icon-action-primary-disabled"
65
- : "text-icon-action-primary-normal",
66
- "contents",
67
- )}
68
- >
69
- <Icon name="keyboard_arrow_down" />
70
- </span>
71
- )
72
- }
73
- maxLength={0}
74
- className={clsx("!caret-transparent !cursor-default", className)}
75
- wrapperClassName={wrapperClassName}
76
- onKeyDown={(e) => {
77
- const openKeys = ["Enter", "Space", " "];
78
-
79
- if (openKeys.includes(e.key)) {
80
- e.preventDefault();
81
- (e.target as HTMLElement).click();
82
- }
83
- }}
84
- onClick={(e) => {
85
- if (props.disabled || readOnly) {
86
- return;
87
- }
88
-
89
- setShow(!show);
90
- onClick?.(e);
91
- }}
92
- error={error}
93
- readOnly={readOnly}
94
- removeRoundness={removeRoundness}
95
- focus={show}
96
- onChange={(e) => props.onChange?.(e)}
97
- {...props}
98
- value={displayValue ?? value ?? (props.onChange ? "" : undefined)}
99
- />
100
-
101
- {renderMenu
102
- ? renderMenu({
103
- id: id ? `${id}-menu` : undefined,
104
- positionTo: inputContainerRef,
105
- show,
106
- setShow,
107
- topOffset: props.caption ? -16 : null,
108
- })
109
- : children}
110
- </>
111
- );
112
- };
113
-
114
- Select.displayName = "Select";
@@ -1,30 +0,0 @@
1
- import { PropsWithChildren } from "react";
2
- import clsx from "clsx";
3
-
4
- type SideMenuProps = PropsWithChildren<{
5
- cardStyle?: boolean;
6
- id?: string;
7
- testid?: string;
8
- }>;
9
-
10
- export const SideMenu = ({
11
- children,
12
- cardStyle = false,
13
- id,
14
- testid,
15
- }: SideMenuProps) => {
16
- return (
17
- <div
18
- id={id}
19
- data-testid={testid}
20
- className={clsx(
21
- "flex flex-col",
22
- cardStyle &&
23
- "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding rounded shadow-4 bg-background-primary-normal",
24
- )}
25
- >
26
- {children}
27
- </div>
28
- );
29
- };
30
- SideMenu.displayName = "SideMenu";
@@ -1,95 +0,0 @@
1
- "use client";
2
-
3
- import clsx from "clsx";
4
- import { PropsWithChildren, useEffect, useState } from "react";
5
- import { Label } from "./Label";
6
- import { baseTransition } from "../classNames";
7
- import { Stack } from "./Stack";
8
- import { Icon } from "./Icon";
9
-
10
- export type SideMenuGroupProps = PropsWithChildren<{
11
- id?: string;
12
- testid?: string;
13
- label?: string;
14
- groupIndentLevel?: 1 | 2 | 3 | 4;
15
- collapsed?: boolean;
16
- disabled?: boolean;
17
- }>;
18
-
19
- export const SideMenuGroup = ({
20
- id,
21
- testid,
22
- label,
23
- groupIndentLevel = 1,
24
- collapsed = false,
25
- disabled = false,
26
- children,
27
- }: SideMenuGroupProps) => {
28
- const [internalCollapsed, setInternalCollapsed] = useState(collapsed);
29
-
30
- useEffect(() => {
31
- setInternalCollapsed(collapsed);
32
- }, [collapsed]);
33
-
34
- const toggleCollapse = () => {
35
- if (!disabled) setInternalCollapsed((prev) => !prev);
36
- };
37
-
38
- const enabledDisabledStyles = disabled
39
- ? clsx("text-text-action-disabled pointer-events-none")
40
- : clsx("text-text-primary-normal");
41
-
42
- const additionalAttr = {
43
- "data-disabled": disabled || null,
44
- };
45
-
46
- return (
47
- <>
48
- <div
49
- id={id}
50
- data-testid={testid}
51
- className={clsx(
52
- "group/sm-group flex rounded cursor-pointer",
53
- "bg-transparent",
54
- "hover:bg-background-action-secondary-hover hover:text-text-action-hover",
55
- "active:bg-background-action-secondary-active active:text-text-action-active",
56
- baseTransition,
57
- enabledDisabledStyles,
58
- )}
59
- onClick={toggleCollapse}
60
- {...additionalAttr}
61
- >
62
- <Stack
63
- id={id ? `${id}-stack` : undefined}
64
- horizontal
65
- items="center"
66
- sizing="component"
67
- padding
68
- >
69
- {groupIndentLevel === 2 && <div className="pl-6" />}
70
- {groupIndentLevel === 3 && <div className="pl-13" />}
71
- {groupIndentLevel === 4 && <div className="pl-20" />}
72
-
73
- <Icon
74
- name="keyboard_arrow_down"
75
- className={clsx(
76
- "transition duration-100 ease-in-out",
77
- "pointer-events-none",
78
- {
79
- "rotate-180": !internalCollapsed,
80
- },
81
- )}
82
- size={24}
83
- />
84
-
85
- <Label id={id ? `${id}-label` : undefined} testid={testid ? `${testid}-label` : undefined} padded>
86
- {label}
87
- </Label>
88
- </Stack>
89
- </div>
90
- {!internalCollapsed && children}
91
- </>
92
- );
93
- };
94
-
95
- SideMenuGroup.displayName = "SideMenuGroup";
@@ -1,109 +0,0 @@
1
- import clsx from "clsx";
2
- import { baseTransition, componentPaddingMinus2pxBorder } from "../classNames";
3
- import { Stack } from "./Stack";
4
- import { Paragraph } from "./Paragraph";
5
-
6
- export type SideMenuItemProps = {
7
- id?: string;
8
- as?: React.ElementType;
9
- testid?: string;
10
- label?: string;
11
- leftIcon?: React.ReactNode;
12
- rightIcon?: React.ReactNode;
13
- href?: string;
14
- groupIndentLevel?: 1 | 2 | 3 | 4 | 5;
15
- selected?: boolean;
16
- disabled?: boolean;
17
- onClick?: () => void;
18
- };
19
-
20
- export const SideMenuItem = ({
21
- id,
22
- as = "a",
23
- testid,
24
- label,
25
- leftIcon,
26
- rightIcon,
27
- href,
28
- groupIndentLevel,
29
- selected = false,
30
- disabled = false,
31
- onClick,
32
- }: SideMenuItemProps) => {
33
- const unselectedStateStyles =
34
- !selected && !disabled && clsx("border-transparent");
35
-
36
- const unselectedDisabledStateStyles =
37
- !selected && disabled && clsx("bg-transparent border-transparent");
38
-
39
- const selectedStateStyles =
40
- selected &&
41
- !disabled &&
42
- clsx(
43
- "bg-background-action-secondary-hover border-border-action-normal",
44
- "hover:border-border-action-hover",
45
- "active:border-border-action-active",
46
- );
47
-
48
- const selectedDisabledStateStyles =
49
- selected &&
50
- disabled &&
51
- clsx(
52
- "bg-background-action-secondary-disabled border-border-action-disabled",
53
- );
54
-
55
- const enabledDisabledStyles = disabled
56
- ? clsx("text-text-action-disabled pointer-events-none")
57
- : clsx("text-text-primary-normal");
58
- const Element = as;
59
- return (
60
- <Element
61
- id={id}
62
- data-testid={testid}
63
- href={href}
64
- className={clsx(
65
- "group flex w-full rounded border-2 cursor-pointer",
66
- "hover:bg-background-action-secondary-hover hover:text-text-action-hover",
67
- "active:bg-background-action-secondary-active active:text-text-action-active",
68
- baseTransition,
69
- componentPaddingMinus2pxBorder,
70
- unselectedStateStyles,
71
- unselectedDisabledStateStyles,
72
- selectedStateStyles,
73
- selectedDisabledStateStyles,
74
- enabledDisabledStyles,
75
- )}
76
- onClick={onClick}
77
- >
78
- <Stack
79
- id={id ? `${id}-stack` : undefined}
80
- horizontal
81
- items="center"
82
- sizing="component"
83
- >
84
- {groupIndentLevel === 2 && <div className="pl-6" />}
85
- {groupIndentLevel === 3 && <div className="pl-13" />}
86
- {groupIndentLevel === 4 && <div className="pl-20" />}
87
- {groupIndentLevel === 5 && <div className="pl-27" />}
88
-
89
- {leftIcon && leftIcon}
90
-
91
- {!leftIcon && groupIndentLevel && <div className="w-6 h-6" />}
92
-
93
- <Paragraph
94
- id={id ? `${id}-label` : undefined}
95
- testid={testid ? `${testid}-label` : undefined}
96
- as="span"
97
- padded
98
- className="mr-auto !leading-6"
99
- >
100
- {label}
101
- </Paragraph>
102
-
103
- {rightIcon && rightIcon}
104
- </Stack>
105
- </Element>
106
- );
107
- };
108
-
109
- SideMenuItem.displayName = "SideMenuItem";
@@ -1,77 +0,0 @@
1
- import { ColumnDef } from "@tanstack/react-table";
2
- import { ReactNode } from "react";
3
- import { Subheader } from "./Subheader";
4
- import clsx from "clsx";
5
- import { Stack } from "./Stack";
6
-
7
- type SimpleTableProps<T> = {
8
- columns: ColumnDef<T>[];
9
- data: T[];
10
- /** Optional additional rows appended after the main data (e.g. totals) */
11
- additionalRows?: T[] | null;
12
- };
13
-
14
- export function SimpleTable<T extends Record<string, unknown>>({
15
- columns,
16
- data,
17
- additionalRows,
18
- }: SimpleTableProps<T>) {
19
- const allRows =
20
- additionalRows && additionalRows.length > 0
21
- ? [...data, ...additionalRows]
22
- : data;
23
-
24
- return (
25
- <Stack elevation={4} rounded overflowX="hidden" overflowY="hidden">
26
- <table className="w-full border-collapse text-left text-sm border overflow-hidden rounded border-border-primary-normal">
27
- <thead>
28
- <tr className="bg-background-primary-normal divide-x divide-border-primary-normal">
29
- {columns.map((column, index) => (
30
- <th
31
- key={index}
32
- scope="col"
33
- className={clsx(
34
- "p-mobile-layout-padding desktop:p-desktop-layout-padding font-semibold text-text-primary-normal",
35
- column.meta?.headerWidth ? column.meta.headerWidth : "w-2/3",
36
- )}
37
- >
38
- <Subheader>{column.header?.toString()}</Subheader>
39
- </th>
40
- ))}
41
- </tr>
42
- </thead>
43
- <tbody>
44
- {allRows.map((row, rowIndex) => (
45
- <tr
46
- key={rowIndex}
47
- className="border-t border-border-primary-normal divide-x divide-border-primary-normal"
48
- >
49
- {columns.map((column, colIndex) => {
50
- const rawValue = column.id
51
- ? (row as Record<string, unknown>)[column.id]
52
- : null;
53
- const cellValue: ReactNode = (rawValue as ReactNode) ?? null;
54
- return (
55
- <td
56
- key={colIndex}
57
- className={clsx(
58
- "p-mobile-layout-padding desktop:p-desktop-layout-padding align-middle text-text-primary-normal",
59
- column.meta?.headerWidth,
60
- )}
61
- >
62
- {cellValue !== null && cellValue !== undefined
63
- ? typeof cellValue === "string" ||
64
- typeof cellValue === "number"
65
- ? cellValue.toString()
66
- : cellValue
67
- : ""}
68
- </td>
69
- );
70
- })}
71
- </tr>
72
- ))}
73
- </tbody>
74
- </table>
75
- </Stack>
76
- );
77
- }
@@ -1,31 +0,0 @@
1
- interface SkeletonParagraphProps {
2
- /** Optional custom class names to further style/size the skeleton */
3
- className?: string;
4
- /** Height of the skeleton (tailwind height utility), defaults to h-6 */
5
- heightClassName?: string;
6
- /** Size of the skeleton, affects widthClassName */
7
- size?: "small" | "medium" | "large";
8
- }
9
-
10
- /**
11
- * A shimmering paragraph skeleton placeholder.
12
- * Provides an animated left-to-right shimmer to indicate loading text content.
13
- */
14
- export function SkeletonParagraph({
15
- className = "",
16
- heightClassName = "h-6",
17
- size = "large",
18
- }: SkeletonParagraphProps) {
19
- const sizeClassMap: Record<string, string> = {
20
- small: "min-w-10 w-1/4",
21
- medium: "min-w-20 w-1/2",
22
- large: "min-w-32 w-full",
23
- };
24
- return (
25
- <div
26
- aria-label="Loading content"
27
- role="status"
28
- className={`skeleton-paragraph ${heightClassName} ${sizeClassMap[size]} rounded-xs ${className}`}
29
- />
30
- );
31
- }
@@ -1,32 +0,0 @@
1
- import React from "react";
2
-
3
- type SpinnerProps = {
4
- size?: "small" | "large";
5
- testid?: string;
6
- };
7
-
8
- export const Spinner: React.FC<SpinnerProps> = ({ size = "small", testid }) => {
9
- const dimension = size === "large" ? 48 : 24;
10
- return (
11
- <svg
12
- data-testid={testid}
13
- width={dimension}
14
- height={dimension}
15
- viewBox="0 0 24 24"
16
- xmlns="http://www.w3.org/2000/svg"
17
- fill="#1D1E1E"
18
- className="spinner"
19
- aria-label="Loading"
20
- >
21
- <circle cx="12" cy="4" r="2" opacity="1" />
22
- <circle cx="17.666" cy="6.334" r="2" opacity="0.125" />
23
- <circle cx="20" cy="12" r="2" opacity="0.25" />
24
- <circle cx="17.666" cy="17.666" r="2" opacity="0.375" />
25
- <circle cx="12" cy="20" r="2" opacity="0.5" />
26
- <circle cx="6.334" cy="17.666" r="2" opacity="0.625" />
27
- <circle cx="4" cy="12" r="2" opacity="0.75" />
28
- <circle cx="6.334" cy="6.334" r="2" opacity="0.875" />
29
- </svg>
30
- );
31
- };
32
- Spinner.displayName = "Spinner";