@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,28 +0,0 @@
1
- "use client";
2
- import { useState } from "react";
3
-
4
- export function DebugJson({ data, id }: { data: unknown; id: string }) {
5
- const [open, setOpen] = useState(false);
6
-
7
- if (process.env.NODE_ENV !== "development") {
8
- return null;
9
- }
10
-
11
- return (
12
- <div
13
- id={id}
14
- className="p-2 rounded bg-neutral-100 border border-red-500 my-4"
15
- >
16
- <button
17
- id={id ? `${id}-toggle-button` : undefined}
18
- onClick={() => setOpen((prev) => !prev)}
19
- className="px-4 py-2 border rounded bg-white"
20
- >
21
- {open ? "Hide JSON" : "Show JSON"}
22
- </button>
23
- {open && <pre className="mt-4">{JSON.stringify(data, null, 4)}</pre>}
24
- </div>
25
- );
26
- }
27
-
28
- DebugJson.displayName = "DebugJson";
@@ -1,66 +0,0 @@
1
- import clsx from "clsx";
2
- import { AsProps, TextAttributes, TypographyProps } from "../types";
3
- import { typography } from "../classNames";
4
-
5
- type Tags = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "p";
6
-
7
- type DisplayVariant = "display1" | "display2";
8
-
9
- type DisplayProps = {
10
- as?: Tags;
11
- variant?: DisplayVariant;
12
- id?: string;
13
- testid?: string;
14
- } & AsProps<Tags> &
15
- TextAttributes &
16
- TypographyProps;
17
-
18
- export const Display = ({
19
- className,
20
- children,
21
- as,
22
- color,
23
- align,
24
- variant = "display1",
25
- id,
26
- testid,
27
- ...props
28
- }: DisplayProps) => {
29
- const defaultElement = variant === "display1" ? "h1" : "h2";
30
- const Element = as ?? defaultElement;
31
-
32
- return (
33
- <Element
34
- id={id}
35
- data-testid={testid}
36
- className={clsx(
37
- typography[variant],
38
- className,
39
- align === "left" && "text-left",
40
- align === "center" && "text-center",
41
- align === "right" && "text-right",
42
- )}
43
- style={{
44
- ...props.style,
45
- color: color ? `var(--color-${color})` : undefined,
46
- }}
47
- {...props}
48
- >
49
- {children}
50
- </Element>
51
- );
52
- };
53
-
54
- Display.displayName = "Display";
55
-
56
- // Backward compatibility exports
57
- export const Display1 = (props: Omit<DisplayProps, "variant">) => (
58
- <Display {...props} variant="display1" />
59
- );
60
-
61
- export const Display2 = (props: Omit<DisplayProps, "variant">) => (
62
- <Display {...props} variant="display2" />
63
- );
64
-
65
- Display1.displayName = "Display1";
66
- Display2.displayName = "Display2";
@@ -1,43 +0,0 @@
1
- "use client";
2
-
3
- import { createContext, PropsWithChildren, useState } from "react";
4
-
5
- type EditingContextType<T> = {
6
- data: T[];
7
- setData: (row: number, key: string, value: string) => void;
8
- };
9
-
10
- // TODO: Update "any" we shouldn't have this for typesafe devx
11
- export const EditingContext = createContext<EditingContextType<unknown>>({
12
- data: [],
13
- setData: (/**row: number, key: string, value: string */) => {
14
- // console.log(row, key, value);
15
- // TODO: Implement setData logic
16
- },
17
- });
18
-
19
- type EditingProviderProps<T> = PropsWithChildren<{ data: T[] }>;
20
-
21
- export const EditingProvider = <T,>({
22
- data,
23
- children,
24
- }: EditingProviderProps<T>) => {
25
- const [actual, setData] = useState<T[]>(data);
26
-
27
- const context: EditingContextType<T> = {
28
- data: actual,
29
- setData: (row: number, key: string, value: string) => {
30
- setData((prev) => {
31
- const newData = [...prev];
32
- newData[row] = {
33
- ...newData[row],
34
- [key]: value,
35
- };
36
-
37
- return newData;
38
- });
39
- },
40
- };
41
-
42
- return <EditingContext value={context}>{children}</EditingContext>;
43
- };
@@ -1,18 +0,0 @@
1
- export function EmptyCartIcon() {
2
- return (
3
- <svg
4
- width="211"
5
- height="196"
6
- viewBox="0 0 211 196"
7
- fill="none"
8
- xmlns="http://www.w3.org/2000/svg"
9
- >
10
- <path
11
- fill-rule="evenodd"
12
- clip-rule="evenodd"
13
- d="M54.5305 76.3333H137.059L154.793 141.333L22.0305 141.333L54.5305 76.3333ZM3.60295 152.73C7.57878 159.165 14.4688 163 22.0305 163L160.697 163L167.381 187.516C168.67 192.228 172.95 195.5 177.835 195.5H199.502C205.493 195.5 210.335 190.647 210.335 184.667C210.335 178.687 205.493 173.833 199.502 173.833H186.112L155.79 62.6508C154.5 57.9383 150.221 54.6667 145.335 54.6667L47.8354 54.6667C43.7296 54.6667 39.9813 56.985 38.1396 60.6575L2.64963 131.648C-0.741211 138.419 -0.372879 146.295 3.60295 152.73ZM150.75 33C159.72 33 167 25.7308 167 16.75C167 7.76917 159.72 0.5 150.75 0.5C141.78 0.5 134.5 7.76917 134.5 16.75C134.5 25.7308 141.78 33 150.75 33ZM58.6666 16.75C58.6666 25.7308 51.3866 33 42.4166 33C33.4466 33 26.1666 25.7308 26.1666 16.75C26.1666 7.76917 33.4466 0.5 42.4166 0.5C51.3866 0.5 58.6666 7.76917 58.6666 16.75Z"
14
- fill="#6B6D6D"
15
- />
16
- </svg>
17
- );
18
- }
@@ -1,264 +0,0 @@
1
- "use client";
2
-
3
- import { ComponentProps, useState, Children, isValidElement } from "react";
4
- import { Label } from "./Label";
5
-
6
- import { Checkbox } from "./Checkbox";
7
- import { OptionPill } from "./OptionPill";
8
- import clsx from "clsx";
9
- import { Link } from "./Link";
10
- import { Search } from "./Search";
11
- import {
12
- baseTransition,
13
- componentGap,
14
- componentPaddingBottom,
15
- componentPaddingY,
16
- layoutGroupGap,
17
- layoutPaddingBottom,
18
- } from "../classNames";
19
- import { Icon } from "./Icon";
20
-
21
- type FilterGroupProps = {
22
- id?: string;
23
- testid?: string;
24
- label: string;
25
- open?: boolean;
26
- showMore?: boolean;
27
- type?: "link" | "checkbox" | "summary";
28
- onShowMore?: () => void;
29
- onClearAll?: () => void;
30
- } & (
31
- | {
32
- showSearchField: true;
33
- searchValue: string;
34
- onSearchChange: React.ChangeEventHandler<HTMLInputElement>;
35
- }
36
- | {
37
- showSearchField?: false | undefined;
38
- searchValue?: string;
39
- onSearchChange?: React.ChangeEventHandler<HTMLInputElement>;
40
- }
41
- );
42
-
43
- export const FilterGroup = ({
44
- id,
45
- testid,
46
- label,
47
- type = "link",
48
- open = false,
49
- showMore = false,
50
- onShowMore,
51
- onClearAll,
52
- children,
53
- showSearchField = false,
54
- searchValue,
55
- onSearchChange,
56
- ...props
57
- }: ComponentProps<"div"> & FilterGroupProps) => {
58
- const isSummary = type === "summary";
59
- const [internalExpanded, setInternalExpanded] = useState(open);
60
- const [showAllItems, setShowAllItems] = useState(false);
61
- const isExpanded = open || internalExpanded;
62
- const childArray = Children.toArray(children).filter(isValidElement);
63
- const shouldShowAll = isSummary || showAllItems;
64
- const visibleChildren = childArray.slice(
65
- 0,
66
- shouldShowAll ? childArray.length : 5,
67
- );
68
- const showShowMoreLink =
69
- showMore &&
70
- !isSummary &&
71
- childArray.length > 5 &&
72
- !showAllItems &&
73
- isExpanded;
74
-
75
- return (
76
- <div
77
- id={id}
78
- data-testid={testid}
79
- {...props}
80
- className={clsx(
81
- "border-b border-border-primary-normal",
82
- isSummary ? layoutPaddingBottom : componentPaddingBottom,
83
- )}
84
- >
85
- <div
86
- className={clsx(
87
- "flex items-center justify-between cursor-pointer",
88
- layoutGroupGap,
89
- )}
90
- onClick={handleToggleExpanded}
91
- >
92
- <Label>{label}</Label>
93
-
94
- {type !== "summary" ? (
95
- <Icon
96
- name="keyboard_arrow_down"
97
- className={clsx(
98
- baseTransition.replace(
99
- "transition-colors",
100
- "transition-transform",
101
- ),
102
- isExpanded && "rotate-180",
103
- "text-icon-action-primary-normal",
104
- )}
105
- />
106
- ) : (
107
- <Link
108
- id={id ? `${id}-clear-all` : undefined}
109
- testid={testid ? `${testid}-clear-all` : undefined}
110
- className={clsx("block", componentPaddingY)}
111
- onClick={handleClearAll}
112
- >
113
- Clear All
114
- </Link>
115
- )}
116
- </div>
117
-
118
- <div
119
- className={clsx(
120
- "grid",
121
- baseTransition.replace(
122
- "transition-colors",
123
- "transition-[grid-template-rows]",
124
- ),
125
- isExpanded || isSummary ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
126
- )}
127
- >
128
- <div
129
- className={clsx(
130
- "overflow-hidden",
131
- componentGap,
132
- (isExpanded || isSummary || internalExpanded) &&
133
- "mt-mobile-component-gap desktop:mt-desktop-component-gap compact:mt-desktop-compact-component-gap",
134
- )}
135
- >
136
- {!isSummary && showSearchField && (
137
- <Search
138
- id={id ? `${id}-search` : undefined}
139
- testid={testid ? `${testid}-search` : undefined}
140
- style={{ marginBottom: "2px" }}
141
- onChange={onSearchChange}
142
- value={searchValue}
143
- />
144
- )}
145
-
146
- <div className={clsx(isSummary && `flex flex-col ${componentGap}`)}>
147
- {visibleChildren}
148
- </div>
149
- {showShowMoreLink && (
150
- <Link
151
- id={id ? `${id}-show-more` : undefined}
152
- testid={testid ? `${testid}-show-more` : undefined}
153
- className={clsx("block", "!items-start", componentPaddingY)}
154
- onClick={handleOnShowMore}
155
- >
156
- Show More
157
- </Link>
158
- )}
159
- </div>
160
- </div>
161
- </div>
162
- );
163
-
164
- function handleOnShowMore(e: React.MouseEvent<HTMLElement>) {
165
- e.stopPropagation();
166
- setShowAllItems(true);
167
- onShowMore?.();
168
- }
169
-
170
- function handleToggleExpanded(e: React.MouseEvent<HTMLElement>) {
171
- if (type === "summary") return;
172
- e.stopPropagation();
173
- setInternalExpanded(!internalExpanded);
174
- }
175
-
176
- function handleClearAll(e: React.MouseEvent<HTMLElement>) {
177
- e.stopPropagation();
178
- onClearAll?.();
179
- }
180
- };
181
-
182
- type FilterGroupItemProps = {
183
- id?: string;
184
- testid?: string;
185
- count?: number;
186
- type?: FilterGroupProps["type"];
187
- };
188
-
189
- export const FilterGroupItem = ({
190
- id,
191
- testid,
192
- type = "link",
193
- children,
194
- onClick,
195
- ...props
196
- }: ComponentProps<React.ElementType> & FilterGroupItemProps) => {
197
- return (
198
- <div
199
- id={id}
200
- data-testid={testid}
201
- onClick={handleClick}
202
- {...props}
203
- className={clsx(
204
- "flex items-center justify-between *:first:flex-1 cursor-pointer",
205
- type !== "summary"
206
- ? "*:first:py-mobile-component-padding *:first:desktop:py-desktop-component-padding *:first:compact:py-desktop-compact-component-padding"
207
- : "",
208
- )}
209
- >
210
- <FilterGroupItemChildComponent
211
- {...props}
212
- id={id ? `${id}-child` : undefined}
213
- data-testid={testid ? `${testid}-child` : undefined}
214
- type={type}
215
- count={props.count}
216
- >
217
- <span className="flex items-center justify-between w-full">
218
- {children}
219
-
220
- {type !== "summary" && props.count && <span>({props.count})</span>}
221
- </span>
222
- </FilterGroupItemChildComponent>
223
- </div>
224
- );
225
-
226
- function handleClick(e: React.MouseEvent<HTMLElement>) {
227
- e.stopPropagation();
228
- onClick?.();
229
- }
230
- };
231
-
232
- const FilterGroupItemChildComponent = ({
233
- type = "link",
234
- children,
235
- ...props
236
- }: ComponentProps<React.ElementType> & {
237
- type: FilterGroupItemProps["type"];
238
- }) => {
239
- if (type === "checkbox") {
240
- return (
241
- <Checkbox
242
- paragraphClassName="w-full"
243
- label={children as string}
244
- {...props}
245
- />
246
- );
247
- }
248
-
249
- if (type === "summary") {
250
- return (
251
- <div>
252
- <OptionPill removable {...props}>
253
- {children}
254
- </OptionPill>
255
- </div>
256
- );
257
- }
258
-
259
- return (
260
- <Link variant="secondary" {...props}>
261
- {children}
262
- </Link>
263
- );
264
- };
@@ -1,19 +0,0 @@
1
- export function FullViewportLayout({
2
- children,
3
- id,
4
- testid,
5
- }: {
6
- children: React.ReactNode;
7
- id?: string;
8
- testid?: string;
9
- }) {
10
- return (
11
- <div
12
- id={id}
13
- data-testid={testid}
14
- className="flex flex-col min-h-screen min-w-screen p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding items-center justify-center bg-background-grouped-secondary-normal"
15
- >
16
- {children}
17
- </div>
18
- );
19
- }
@@ -1,97 +0,0 @@
1
- import { ComponentProps } from "react";
2
- import { Sizing } from "../types";
3
- import clsx from "clsx";
4
-
5
- type Breakpoint = "compact" | "desktop";
6
-
7
- export type GridColumnCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
8
-
9
- export type GridProps = {
10
- children: React.ReactNode;
11
- /** Design system sizing context controlling gap + optional padding token sets */
12
- sizing?: Sizing;
13
- /** Adds the sizing-based padding classes when true */
14
- padding?: boolean;
15
- /** Base column count applied at all breakpoints unless overridden */
16
- columns: GridColumnCount;
17
- /** Explicit responsive column overrides. e.g. { mobile:2, desktop-compact:3, desktop:6 } */
18
- responsive?: Partial<Record<Breakpoint, GridColumnCount>>;
19
- id?: string;
20
- testid?: string;
21
- className?: string;
22
- style?: ComponentProps<"div">["style"];
23
- } & Omit<ComponentProps<"div">, "className">;
24
-
25
- // Mapping helpers for sizing tokens -> gap & padding classes (centralised to reduce repetition)
26
- const GAP_BY_SIZING: Partial<Record<Sizing, string>> = {
27
- none: "gap-0",
28
- "layout-group":
29
- "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
30
- layout:
31
- "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
32
- container:
33
- "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
34
- component:
35
- "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap",
36
- };
37
-
38
- const PADDING_BY_SIZING: Partial<Record<Sizing, string>> = {
39
- none: "p-0",
40
- container:
41
- "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
42
- layout:
43
- "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
44
- "layout-group":
45
- "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
46
- component:
47
- "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
48
- };
49
-
50
- /** Build column classes from provided props. No child-count heuristics. */
51
- const buildColumnClasses = (
52
- base: GridColumnCount,
53
- responsive?: Partial<Record<Breakpoint, GridColumnCount>>,
54
- ): string => {
55
- const classes: string[] = [`grid-cols-${base}`];
56
- if (responsive) {
57
- (
58
- Object.entries(responsive) as Array<[Breakpoint, GridColumnCount]>
59
- ).forEach(([bp, value]) => {
60
- if (value && value > 0) classes.push(`${bp}:grid-cols-${value}`);
61
- });
62
- }
63
- return classes.join(" ");
64
- };
65
-
66
- export const Grid = ({
67
- children,
68
- sizing = "container",
69
- padding,
70
- columns,
71
- responsive,
72
- id,
73
- testid,
74
- style,
75
- className,
76
- ...rest
77
- }: GridProps) => {
78
- const columnClasses = buildColumnClasses(columns, responsive);
79
-
80
- return (
81
- <div
82
- id={id}
83
- data-testid={testid}
84
- style={style}
85
- {...rest}
86
- className={clsx(
87
- "w-full grid",
88
- GAP_BY_SIZING[sizing] ?? GAP_BY_SIZING.container,
89
- padding && (PADDING_BY_SIZING[sizing] ?? PADDING_BY_SIZING.container),
90
- columnClasses,
91
- className,
92
- )}
93
- >
94
- {children}
95
- </div>
96
- );
97
- };
@@ -1,72 +0,0 @@
1
- import clsx from "clsx";
2
- import { AsProps, TextAttributes, TypographyProps } from "../types";
3
- import { typography } from "../classNames";
4
-
5
- type Tags = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "p";
6
-
7
- type HeadingVariant = "heading1" | "heading2" | "heading3";
8
-
9
- type HeadingProps = {
10
- as?: Tags;
11
- variant?: HeadingVariant;
12
- id?: string;
13
- testid?: string;
14
- } & AsProps<Tags> &
15
- TextAttributes &
16
- TypographyProps;
17
-
18
- export const Heading = ({
19
- className,
20
- children,
21
- as,
22
- color,
23
- align,
24
- variant = "heading1",
25
- id,
26
- testid,
27
- ...props
28
- }: HeadingProps) => {
29
- const defaultElement =
30
- variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
31
- const Element = as ?? defaultElement;
32
-
33
- return (
34
- <Element
35
- id={id}
36
- data-testid={testid}
37
- className={clsx(
38
- typography[variant],
39
- className,
40
- align === "left" && "text-left",
41
- align === "center" && "text-center",
42
- align === "right" && "text-right",
43
- )}
44
- style={{
45
- ...props.style,
46
- color: color ? `var(--color-${color})` : undefined,
47
- }}
48
- {...props}
49
- >
50
- {children}
51
- </Element>
52
- );
53
- };
54
-
55
- Heading.displayName = "Heading";
56
-
57
- // Backward compatibility exports
58
- export const Heading1 = (props: Omit<HeadingProps, "variant">) => (
59
- <Heading {...props} variant="heading1" />
60
- );
61
-
62
- export const Heading2 = (props: Omit<HeadingProps, "variant">) => (
63
- <Heading {...props} variant="heading2" />
64
- );
65
-
66
- export const Heading3 = (props: Omit<HeadingProps, "variant">) => (
67
- <Heading {...props} variant="heading3" />
68
- );
69
-
70
- Heading1.displayName = "Heading1";
71
- Heading2.displayName = "Heading2";
72
- Heading3.displayName = "Heading3";
@@ -1,22 +0,0 @@
1
- import clsx from "clsx";
2
- import type { HTMLAttributes } from "react";
3
-
4
- type HorizontalDividerProps = HTMLAttributes<HTMLHRElement> & {
5
- testid?: string;
6
- hideOnMobile?: boolean;
7
- };
8
-
9
- export function HorizontalDivider({ id, testid, hideOnMobile, className, ...rest }: HorizontalDividerProps) {
10
- return (
11
- <hr
12
- id={id}
13
- data-testid={testid}
14
- className={clsx(
15
- "w-full border-t border-border-primary-normal",
16
- hideOnMobile && "hidden desktop:block",
17
- className
18
- )}
19
- {...rest}
20
- />
21
- );
22
- }
@@ -1,39 +0,0 @@
1
- import clsx from "clsx";
2
- import { IconSize } from "../types";
3
- import { ComponentProps } from "react";
4
-
5
- type IconProps = {
6
- name: string;
7
- size?: IconSize;
8
- variant?: "outline" | "filled";
9
- testid?: string;
10
- } & Omit<ComponentProps<"span">, "name">;
11
-
12
- export function Icon({
13
- name,
14
- size = 24,
15
- variant = "outline",
16
- testid,
17
- ...props
18
- }: IconProps) {
19
- const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
20
- const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
21
- return (
22
- <span
23
- {...props}
24
- data-testid={testid}
25
- className={clsx(
26
- "icon",
27
- `icon-${size}`,
28
- // size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
29
- props.className,
30
- )}
31
- style={{
32
- fontVariationSettings: variantStyle + `, ${weightStyle}`,
33
- ...props.style,
34
- }}
35
- >
36
- {name}
37
- </span>
38
- );
39
- }
@@ -1,22 +0,0 @@
1
- import { SVGProps, useId } from "react";
2
- export function ImagePlaceholder(props: SVGProps<SVGSVGElement>) {
3
- const clipId = useId();
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width={242}
8
- height={243}
9
- fill="none"
10
- {...props}
11
- >
12
- <g clipPath={`url(#${clipId})`}>
13
- <rect width={props.width} height={props.width} fill="#F7F7F7" rx={2} />
14
- </g>
15
- <defs>
16
- <clipPath id={clipId}>
17
- <rect width={props.width} height={props.width} fill="#fff" rx={2} />
18
- </clipPath>
19
- </defs>
20
- </svg>
21
- );
22
- }