@dmsi/wedgekit-react 0.0.26 → 0.0.27
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
|
@@ -49,6 +49,7 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
49
49
|
import { Switch } from "@headlessui/react";
|
|
50
50
|
|
|
51
51
|
export interface DataTableProps {
|
|
52
|
+
id?: string;
|
|
52
53
|
data: OrderRow[];
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -239,20 +240,26 @@ export const EditingProvider = ({ data, children }: EditingProviderProps) => {
|
|
|
239
240
|
});
|
|
240
241
|
},
|
|
241
242
|
};
|
|
242
|
-
return
|
|
243
|
+
return (
|
|
244
|
+
<EditingContext.Provider value={context}>
|
|
245
|
+
{children}
|
|
246
|
+
</EditingContext.Provider>
|
|
247
|
+
);
|
|
243
248
|
};
|
|
244
|
-
export const DataTable = ({ data }: DataTableProps) => {
|
|
249
|
+
export const DataTable = ({ id, data }: DataTableProps) => {
|
|
245
250
|
return (
|
|
246
251
|
<EditingProvider data={data}>
|
|
247
|
-
<DataTableInternals />
|
|
252
|
+
<DataTableInternals id={id} />
|
|
248
253
|
</EditingProvider>
|
|
249
254
|
);
|
|
250
255
|
};
|
|
251
256
|
|
|
252
257
|
const DraggableTableHeader = ({
|
|
253
258
|
header,
|
|
259
|
+
id,
|
|
254
260
|
}: {
|
|
255
261
|
header: Header<OrderRow, unknown>;
|
|
262
|
+
id?: string;
|
|
256
263
|
}) => {
|
|
257
264
|
const { attributes, isDragging, listeners, setNodeRef, transform } =
|
|
258
265
|
useSortable({
|
|
@@ -271,6 +278,7 @@ const DraggableTableHeader = ({
|
|
|
271
278
|
|
|
272
279
|
return (
|
|
273
280
|
<th
|
|
281
|
+
id={id}
|
|
274
282
|
colSpan={header.colSpan}
|
|
275
283
|
ref={setNodeRef}
|
|
276
284
|
style={style}
|
|
@@ -285,6 +293,7 @@ const DraggableTableHeader = ({
|
|
|
285
293
|
{header.isPlaceholder ? null : (
|
|
286
294
|
<div className="flex space-x-1 justify-start items-center">
|
|
287
295
|
<button
|
|
296
|
+
id={id ? `${id}-drag-handle` : undefined}
|
|
288
297
|
className="cursor-grab shrink-0"
|
|
289
298
|
{...attributes}
|
|
290
299
|
{...listeners}
|
|
@@ -313,15 +322,22 @@ const DraggableTableHeader = ({
|
|
|
313
322
|
</div>
|
|
314
323
|
<div>
|
|
315
324
|
{header.column.getCanFilter() ? (
|
|
316
|
-
<Filter
|
|
325
|
+
<Filter
|
|
326
|
+
id={id ? `${id}-filter` : undefined}
|
|
327
|
+
column={header.column}
|
|
328
|
+
/>
|
|
317
329
|
) : (
|
|
318
330
|
<div className="invisible">
|
|
319
|
-
<Filter
|
|
331
|
+
<Filter
|
|
332
|
+
id={id ? `${id}-filter` : undefined}
|
|
333
|
+
column={header.column}
|
|
334
|
+
/>
|
|
320
335
|
</div>
|
|
321
336
|
)}
|
|
322
337
|
</div>
|
|
323
338
|
</div>
|
|
324
339
|
<div
|
|
340
|
+
id={id ? `${id}-sort-button` : undefined}
|
|
325
341
|
className="shrink-0 cursor-pointer"
|
|
326
342
|
onClick={header.column.getToggleSortingHandler()}
|
|
327
343
|
>
|
|
@@ -341,9 +357,11 @@ const DraggableTableHeader = ({
|
|
|
341
357
|
const DragAlongCell = ({
|
|
342
358
|
cell,
|
|
343
359
|
setValue,
|
|
360
|
+
id,
|
|
344
361
|
}: {
|
|
345
362
|
cell: Cell<OrderRow, unknown>;
|
|
346
363
|
setValue: (row: number, key: string, value: string) => void;
|
|
364
|
+
id?: string;
|
|
347
365
|
}) => {
|
|
348
366
|
const { isDragging, setNodeRef, transform } = useSortable({
|
|
349
367
|
id: cell.column.id,
|
|
@@ -360,6 +378,7 @@ const DragAlongCell = ({
|
|
|
360
378
|
|
|
361
379
|
return (
|
|
362
380
|
<EditCell
|
|
381
|
+
id={id}
|
|
363
382
|
ref={setNodeRef}
|
|
364
383
|
style={style}
|
|
365
384
|
cell={cell}
|
|
@@ -375,7 +394,7 @@ const DragAlongCell = ({
|
|
|
375
394
|
);
|
|
376
395
|
};
|
|
377
396
|
|
|
378
|
-
const DataTableInternals = () => {
|
|
397
|
+
const DataTableInternals = ({ id }: { id?: string }) => {
|
|
379
398
|
// use state client bullshit
|
|
380
399
|
|
|
381
400
|
const { data, setValue } = useContext(EditingContext);
|
|
@@ -445,8 +464,11 @@ const DataTableInternals = () => {
|
|
|
445
464
|
onDragEnd={handleDragEnd}
|
|
446
465
|
sensors={sensors}
|
|
447
466
|
>
|
|
448
|
-
<div>
|
|
449
|
-
<div
|
|
467
|
+
<div id={id}>
|
|
468
|
+
<div
|
|
469
|
+
id={id ? `${id}-column-visibility` : undefined}
|
|
470
|
+
className="border border-gray-300 rounded p-3 m-4 max-w-xl min-w-0"
|
|
471
|
+
>
|
|
450
472
|
<p className="mb-3 font-semibold">Show/Hide Columns</p>
|
|
451
473
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-2">
|
|
452
474
|
{table.getAllColumns().map((column) => (
|
|
@@ -455,6 +477,7 @@ const DataTableInternals = () => {
|
|
|
455
477
|
key={column.id}
|
|
456
478
|
>
|
|
457
479
|
<Toggle
|
|
480
|
+
id={id ? `${id}-toggle-${column.id}` : undefined}
|
|
458
481
|
enabled={column.getIsVisible()}
|
|
459
482
|
onToggle={(checked) =>
|
|
460
483
|
column.getToggleVisibilityHandler()({
|
|
@@ -481,7 +504,11 @@ const DataTableInternals = () => {
|
|
|
481
504
|
strategy={horizontalListSortingStrategy}
|
|
482
505
|
>
|
|
483
506
|
{headerGroup.headers.map((header) => (
|
|
484
|
-
<DraggableTableHeader
|
|
507
|
+
<DraggableTableHeader
|
|
508
|
+
key={header.id}
|
|
509
|
+
id={id ? `${id}-header-${header.id}` : undefined}
|
|
510
|
+
header={header}
|
|
511
|
+
/>
|
|
485
512
|
))}
|
|
486
513
|
</SortableContext>
|
|
487
514
|
</tr>
|
|
@@ -501,6 +528,7 @@ const DataTableInternals = () => {
|
|
|
501
528
|
>
|
|
502
529
|
<DragAlongCell
|
|
503
530
|
key={cell.id}
|
|
531
|
+
id={id ? `${id}-cell-${cell.id}` : undefined}
|
|
504
532
|
cell={cell}
|
|
505
533
|
setValue={setValue}
|
|
506
534
|
/>
|
|
@@ -511,9 +539,13 @@ const DataTableInternals = () => {
|
|
|
511
539
|
</tbody>
|
|
512
540
|
</table>
|
|
513
541
|
</div>
|
|
514
|
-
<div
|
|
542
|
+
<div
|
|
543
|
+
id={id ? `${id}-pagination` : undefined}
|
|
544
|
+
className="flex flex-col gap-6 md:flex-row items-center md:gap-2 w-full justify-between p-2"
|
|
545
|
+
>
|
|
515
546
|
<div className="flex flex-row items-center">
|
|
516
547
|
<button
|
|
548
|
+
id={id ? `${id}-first-page` : undefined}
|
|
517
549
|
className={clsx(
|
|
518
550
|
"group flex items-center justify-center h-8 w-8 border border-gray-500/50 text-gray-700 rounded p-1 hover:bg-dmsi-blue hover:text-white transition-colors cursor-pointer border-r-0 rounded-r-none",
|
|
519
551
|
{
|
|
@@ -526,6 +558,7 @@ const DataTableInternals = () => {
|
|
|
526
558
|
<i className="w-4 h-4 group-disabled:stroke-gray-400" />
|
|
527
559
|
</button>
|
|
528
560
|
<button
|
|
561
|
+
id={id ? `${id}-prev-page` : undefined}
|
|
529
562
|
className={clsx(
|
|
530
563
|
"-mr-px group flex items-center justify-center h-8 w-8 border border-gray-500/50 text-gray-700 p-1 hover:bg-dmsi-blue hover:text-white transition-colors cursor-pointer",
|
|
531
564
|
{
|
|
@@ -542,11 +575,12 @@ const DataTableInternals = () => {
|
|
|
542
575
|
const current = table.getState().pagination.pageIndex;
|
|
543
576
|
const index = current - 2 + i;
|
|
544
577
|
const active = index === current;
|
|
545
|
-
if (index < 0) return;
|
|
546
|
-
if (index > table.getPageCount() - 1) return;
|
|
578
|
+
if (index < 0) return null;
|
|
579
|
+
if (index > table.getPageCount() - 1) return null;
|
|
547
580
|
return (
|
|
548
581
|
<button
|
|
549
582
|
key={i}
|
|
583
|
+
id={id ? `${id}-page-${index + 1}` : undefined}
|
|
550
584
|
className={clsx(
|
|
551
585
|
"group h-8 w-8 border-y border-gray-500/50 text-gray-700 p-1 hover:bg-dmsi-blue hover:text-white transition-colors cursor-pointer flex items-center justify-center",
|
|
552
586
|
{
|
|
@@ -562,6 +596,7 @@ const DataTableInternals = () => {
|
|
|
562
596
|
},
|
|
563
597
|
)}
|
|
564
598
|
<button
|
|
599
|
+
id={id ? `${id}-next-page` : undefined}
|
|
565
600
|
className={clsx(
|
|
566
601
|
"-ml-px group flex items-center justify-center h-8 w-8 border border-gray-500/50 text-gray-700 p-1 hover:bg-dmsi-blue hover:text-white transition-colors cursor-pointer border-r-0 group",
|
|
567
602
|
{
|
|
@@ -574,6 +609,7 @@ const DataTableInternals = () => {
|
|
|
574
609
|
<i className="w-4 h-4 group-disabled:stroke-gray-400 " />
|
|
575
610
|
</button>
|
|
576
611
|
<button
|
|
612
|
+
id={id ? `${id}-last-page` : undefined}
|
|
577
613
|
className={clsx(
|
|
578
614
|
"group flex items-center justify-center h-8 w-8 border border-gray-500/50 text-gray-700 rounded rounded-l-none p-1 hover:bg-dmsi-blue hover:text-white transition-colors cursor-pointer",
|
|
579
615
|
{
|
|
@@ -597,6 +633,7 @@ const DataTableInternals = () => {
|
|
|
597
633
|
<span className="flex items-center gap-2">
|
|
598
634
|
Page:
|
|
599
635
|
<input
|
|
636
|
+
id={id ? `${id}-page-input` : undefined}
|
|
600
637
|
type="number"
|
|
601
638
|
min="1"
|
|
602
639
|
max={table.getPageCount()}
|
|
@@ -610,6 +647,7 @@ const DataTableInternals = () => {
|
|
|
610
647
|
</span>
|
|
611
648
|
</div>
|
|
612
649
|
<select
|
|
650
|
+
id={id ? `${id}-pagesize-select` : undefined}
|
|
613
651
|
className="border border-gray-500 px-2 py-1 rounded"
|
|
614
652
|
value={table.getState().pagination.pageSize}
|
|
615
653
|
onChange={(e) => {
|
|
@@ -634,12 +672,14 @@ function EditCell({
|
|
|
634
672
|
setValue,
|
|
635
673
|
style,
|
|
636
674
|
ref,
|
|
675
|
+
id,
|
|
637
676
|
}: {
|
|
638
677
|
className?: string;
|
|
639
678
|
cell: Cell<OrderRow, unknown>;
|
|
640
679
|
setValue: (row: number, key: string, value: string) => void;
|
|
641
680
|
style: CSSProperties;
|
|
642
681
|
ref: (node: HTMLElement | null) => void;
|
|
682
|
+
id?: string;
|
|
643
683
|
}) {
|
|
644
684
|
const [editing, setEditing] = useState(false);
|
|
645
685
|
const value = cell.getValue();
|
|
@@ -665,6 +705,7 @@ function EditCell({
|
|
|
665
705
|
|
|
666
706
|
return (
|
|
667
707
|
<td
|
|
708
|
+
id={id}
|
|
668
709
|
key={cell.id}
|
|
669
710
|
className={clsx(
|
|
670
711
|
className,
|
|
@@ -677,6 +718,7 @@ function EditCell({
|
|
|
677
718
|
{isString && editing && (
|
|
678
719
|
<div className="flex flex-row gap-1">
|
|
679
720
|
<input
|
|
721
|
+
id={id ? `${id}-input` : undefined}
|
|
680
722
|
type="text"
|
|
681
723
|
value={editedValue}
|
|
682
724
|
onChange={onEditValue}
|
|
@@ -685,6 +727,7 @@ function EditCell({
|
|
|
685
727
|
className="border px-2 py-0.5 rounded inline min-w-0 shrink border-neutral-400 focus:outline-neutral-300 bg-white"
|
|
686
728
|
/>
|
|
687
729
|
<button
|
|
730
|
+
id={id ? `${id}-save-button` : undefined}
|
|
688
731
|
onClick={onStopEdit}
|
|
689
732
|
className="border cursor-pointer px-2 py-0.5 rounded flex items-center justify-center w-12 border-dmsi-blue text-dmsi-blue bg-white"
|
|
690
733
|
>
|
|
@@ -705,16 +748,17 @@ function EditCell({
|
|
|
705
748
|
);
|
|
706
749
|
}
|
|
707
750
|
|
|
708
|
-
function Filter({ column }: { column: Column<OrderRow
|
|
751
|
+
function Filter({ column, id }: { column: Column<OrderRow>; id?: string }) {
|
|
709
752
|
const columnFilterValue = column.getFilterValue();
|
|
710
753
|
|
|
711
754
|
const { filterVariant } = column.columnDef.meta ?? {};
|
|
712
755
|
|
|
713
756
|
return filterVariant === "range" ? (
|
|
714
|
-
<div>
|
|
757
|
+
<div id={id}>
|
|
715
758
|
<div className="flex space-x-2">
|
|
716
759
|
{/* See faceted column filters example for min max values functionality */}
|
|
717
760
|
<input
|
|
761
|
+
id={id ? `${id}-min` : undefined}
|
|
718
762
|
className="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-neutral-400 sm:text-sm/6"
|
|
719
763
|
type="number"
|
|
720
764
|
value={(columnFilterValue as [number, number])?.[0] ?? ""}
|
|
@@ -728,6 +772,7 @@ function Filter({ column }: { column: Column<OrderRow> }) {
|
|
|
728
772
|
placeholder={`Min`}
|
|
729
773
|
/>
|
|
730
774
|
<input
|
|
775
|
+
id={id ? `${id}-max` : undefined}
|
|
731
776
|
className="block w-full rounded-md bg-white px-3 py-0.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-neutral-400 sm:text-sm/6"
|
|
732
777
|
type="number"
|
|
733
778
|
value={(columnFilterValue as [number, number])?.[1] ?? ""}
|
|
@@ -745,6 +790,7 @@ function Filter({ column }: { column: Column<OrderRow> }) {
|
|
|
745
790
|
</div>
|
|
746
791
|
) : filterVariant === "select" ? (
|
|
747
792
|
<select
|
|
793
|
+
id={id}
|
|
748
794
|
className="block min-w-36 w-full rounded-md bg-white px-2 py-2 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-neutral-400 sm:text-sm/6"
|
|
749
795
|
onChange={(e) => column.setFilterValue(e.target.value)}
|
|
750
796
|
value={columnFilterValue?.toString()}
|
|
@@ -757,6 +803,7 @@ function Filter({ column }: { column: Column<OrderRow> }) {
|
|
|
757
803
|
</select>
|
|
758
804
|
) : (
|
|
759
805
|
<input
|
|
806
|
+
id={id}
|
|
760
807
|
className="block min-w-36 w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-neutral-400 sm:text-sm/6"
|
|
761
808
|
onChange={(e) => column.setFilterValue(e.target.value)}
|
|
762
809
|
placeholder={column.columnDef.header?.toString() ?? "..."}
|
|
@@ -814,12 +861,15 @@ Switch.displayName = "Switch";
|
|
|
814
861
|
export default function Toggle({
|
|
815
862
|
enabled,
|
|
816
863
|
onToggle,
|
|
864
|
+
id,
|
|
817
865
|
}: {
|
|
818
866
|
enabled: boolean;
|
|
819
867
|
onToggle: (enabled: boolean) => void;
|
|
868
|
+
id?: string;
|
|
820
869
|
}) {
|
|
821
870
|
return (
|
|
822
871
|
<Switch
|
|
872
|
+
id={id}
|
|
823
873
|
checked={enabled}
|
|
824
874
|
onChange={onToggle}
|
|
825
875
|
className="group relative flex h-4 w-7 cursor-pointer rounded-full p-0.5 transition-colors duration-200 ease-in-out focus:outline-none data-[focus]:outline-1 data-[focus]:outline-white bg-neutral-900/10 data-[checked]:bg-dmsi-blue"
|
|
@@ -5,7 +5,8 @@ import { CalendarRange } from "./CalendarRange";
|
|
|
5
5
|
import { Icon } from "./Icon";
|
|
6
6
|
import { findDocumentRoot } from "../utils";
|
|
7
7
|
|
|
8
|
-
type DateInputProps = InputBaseProps & {
|
|
8
|
+
type DateInputProps = Omit<InputBaseProps, "id"> & {
|
|
9
|
+
id?: string;
|
|
9
10
|
/**
|
|
10
11
|
* Value in the format "YYYY-MM-DD" or empty string.
|
|
11
12
|
* When enableRangeInSingleMode is true, this should be in format "YYYY-MM-DD|YYYY-MM-DD"
|
|
@@ -32,6 +33,7 @@ type DateInputProps = InputBaseProps & {
|
|
|
32
33
|
label?: string; // Optional label for the input
|
|
33
34
|
};
|
|
34
35
|
export const DateInput = ({
|
|
36
|
+
id,
|
|
35
37
|
value,
|
|
36
38
|
onChange,
|
|
37
39
|
placeholder = "MM/DD/YYYY",
|
|
@@ -141,6 +143,7 @@ export const DateInput = ({
|
|
|
141
143
|
return (
|
|
142
144
|
<div className="relative">
|
|
143
145
|
<InputBase
|
|
146
|
+
id={id}
|
|
144
147
|
ref={(el) => {
|
|
145
148
|
triggerRef.current = el;
|
|
146
149
|
}}
|
|
@@ -171,6 +174,7 @@ export const DateInput = ({
|
|
|
171
174
|
}}
|
|
172
175
|
>
|
|
173
176
|
<CalendarRange
|
|
177
|
+
id={id ? `${id}-calendar` : undefined}
|
|
174
178
|
from={from}
|
|
175
179
|
to={to || from}
|
|
176
180
|
onChange={handleDateChange}
|
|
@@ -5,7 +5,8 @@ import { CalendarRange } from "./CalendarRange";
|
|
|
5
5
|
import { Icon } from "./Icon";
|
|
6
6
|
import { findDocumentRoot } from "../utils";
|
|
7
7
|
|
|
8
|
-
type DateRangeInputProps = InputBaseProps & {
|
|
8
|
+
type DateRangeInputProps = Omit<InputBaseProps, "id"> & {
|
|
9
|
+
id?: string;
|
|
9
10
|
/**
|
|
10
11
|
* Value in the format "YYYY-MM-DD|YYYY-MM-DD" or empty string
|
|
11
12
|
*/
|
|
@@ -28,6 +29,7 @@ type DateRangeInputProps = InputBaseProps & {
|
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export const DateRangeInput = ({
|
|
32
|
+
id,
|
|
31
33
|
value,
|
|
32
34
|
onChange,
|
|
33
35
|
placeholder = "MM/DD/YYYY - MM/DD/YYYY",
|
|
@@ -133,6 +135,7 @@ export const DateRangeInput = ({
|
|
|
133
135
|
return (
|
|
134
136
|
<div className="relative">
|
|
135
137
|
<InputBase
|
|
138
|
+
id={id}
|
|
136
139
|
ref={(el) => {
|
|
137
140
|
triggerRef.current = el;
|
|
138
141
|
}}
|
|
@@ -163,6 +166,7 @@ export const DateRangeInput = ({
|
|
|
163
166
|
}}
|
|
164
167
|
>
|
|
165
168
|
<CalendarRange
|
|
169
|
+
id={id ? `${id}-calendar` : undefined}
|
|
166
170
|
from={from}
|
|
167
171
|
to={to}
|
|
168
172
|
onChange={handleRangeChange}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
|
|
4
|
-
export function DebugJson({ data }: { data: unknown }) {
|
|
4
|
+
export function DebugJson({ data, id }: { data: unknown; id: string }) {
|
|
5
5
|
const [open, setOpen] = useState(false);
|
|
6
6
|
|
|
7
7
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -9,8 +9,12 @@ export function DebugJson({ data }: { data: unknown }) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
id={id}
|
|
14
|
+
className="p-2 rounded bg-neutral-100 border border-red-500 my-4"
|
|
15
|
+
>
|
|
13
16
|
<button
|
|
17
|
+
id={id ? `${id}-toggle-button` : undefined}
|
|
14
18
|
onClick={() => setOpen((prev) => !prev)}
|
|
15
19
|
className="px-4 py-2 border rounded bg-white"
|
|
16
20
|
>
|
|
@@ -21,4 +25,4 @@ export function DebugJson({ data }: { data: unknown }) {
|
|
|
21
25
|
);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
DebugJson.displayName = "
|
|
28
|
+
DebugJson.displayName = "DebugJson";
|
|
@@ -9,6 +9,7 @@ type DisplayVariant = "display1" | "display2";
|
|
|
9
9
|
type DisplayProps = {
|
|
10
10
|
as?: Tags;
|
|
11
11
|
variant?: DisplayVariant;
|
|
12
|
+
id?: string;
|
|
12
13
|
} & AsProps<Tags> &
|
|
13
14
|
TextAttributes &
|
|
14
15
|
TypographyProps;
|
|
@@ -20,6 +21,7 @@ export const Display = ({
|
|
|
20
21
|
color,
|
|
21
22
|
align,
|
|
22
23
|
variant = "display1",
|
|
24
|
+
id,
|
|
23
25
|
...props
|
|
24
26
|
}: DisplayProps) => {
|
|
25
27
|
const defaultElement = variant === "display1" ? "h1" : "h2";
|
|
@@ -27,6 +29,7 @@ export const Display = ({
|
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
31
|
<Element
|
|
32
|
+
id={id}
|
|
30
33
|
className={clsx(
|
|
31
34
|
typography[variant],
|
|
32
35
|
className,
|
|
@@ -7,6 +7,7 @@ type EditingContextType<T> = {
|
|
|
7
7
|
setData: (row: number, key: string, value: string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
// TODO: Update "any" we shouldn't have this for typesafe devx
|
|
10
11
|
export const EditingContext = createContext<EditingContextType<any>>({
|
|
11
12
|
data: [],
|
|
12
13
|
setData: (row: number, key: string, value: string) => {
|
|
@@ -16,14 +17,15 @@ export const EditingContext = createContext<EditingContextType<any>>({
|
|
|
16
17
|
|
|
17
18
|
type EditingProviderProps<T> = PropsWithChildren<{ data: T[] }>;
|
|
18
19
|
|
|
19
|
-
export const EditingProvider = <T,>({
|
|
20
|
-
|
|
20
|
+
export const EditingProvider = <T,>({
|
|
21
|
+
data,
|
|
22
|
+
children,
|
|
23
|
+
}: EditingProviderProps<T>) => {
|
|
21
24
|
const [actual, setData] = useState<T[]>(data);
|
|
22
|
-
|
|
25
|
+
|
|
23
26
|
const context: EditingContextType<T> = {
|
|
24
27
|
data: actual,
|
|
25
|
-
setData: (row: number, key: string, value: string) =>
|
|
26
|
-
{
|
|
28
|
+
setData: (row: number, key: string, value: string) => {
|
|
27
29
|
setData((prev) => {
|
|
28
30
|
const newData = [...prev];
|
|
29
31
|
newData[row] = {
|
|
@@ -37,4 +39,4 @@ export const EditingProvider = <T,>({ data, children }: EditingProviderProps<T>)
|
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
return <EditingContext value={context}>{children}</EditingContext>;
|
|
40
|
-
};
|
|
42
|
+
};
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { Icon } from "./Icon";
|
|
20
20
|
|
|
21
21
|
type FilterGroupProps = {
|
|
22
|
+
id?: string;
|
|
22
23
|
label: string;
|
|
23
24
|
open?: boolean;
|
|
24
25
|
showMore?: boolean;
|
|
@@ -39,6 +40,7 @@ type FilterGroupProps = {
|
|
|
39
40
|
);
|
|
40
41
|
|
|
41
42
|
export const FilterGroup = ({
|
|
43
|
+
id,
|
|
42
44
|
label,
|
|
43
45
|
type = "link",
|
|
44
46
|
open = false,
|
|
@@ -70,6 +72,7 @@ export const FilterGroup = ({
|
|
|
70
72
|
|
|
71
73
|
return (
|
|
72
74
|
<div
|
|
75
|
+
id={id}
|
|
73
76
|
{...props}
|
|
74
77
|
className={clsx(
|
|
75
78
|
"border-b border-border-primary-normal",
|
|
@@ -99,6 +102,7 @@ export const FilterGroup = ({
|
|
|
99
102
|
/>
|
|
100
103
|
) : (
|
|
101
104
|
<Link
|
|
105
|
+
id={id ? `${id}-clear-all` : undefined}
|
|
102
106
|
className={clsx("block", componentPaddingY)}
|
|
103
107
|
onClick={handleClearAll}
|
|
104
108
|
>
|
|
@@ -127,7 +131,8 @@ export const FilterGroup = ({
|
|
|
127
131
|
>
|
|
128
132
|
{!isSummary && showSearchField && (
|
|
129
133
|
<Search
|
|
130
|
-
|
|
134
|
+
id={id ? `${id}-search` : undefined}
|
|
135
|
+
style={{ marginBottom: "2px" }}
|
|
131
136
|
onChange={onSearchChange}
|
|
132
137
|
value={searchValue}
|
|
133
138
|
/>
|
|
@@ -138,6 +143,7 @@ export const FilterGroup = ({
|
|
|
138
143
|
</div>
|
|
139
144
|
{showShowMoreLink && (
|
|
140
145
|
<Link
|
|
146
|
+
id={id ? `${id}-show-more` : undefined}
|
|
141
147
|
className={clsx("block", "!items-start", componentPaddingY)}
|
|
142
148
|
onClick={handleOnShowMore}
|
|
143
149
|
>
|
|
@@ -168,11 +174,13 @@ export const FilterGroup = ({
|
|
|
168
174
|
};
|
|
169
175
|
|
|
170
176
|
type FilterGroupItemProps = {
|
|
177
|
+
id?: string;
|
|
171
178
|
count?: number;
|
|
172
179
|
type?: FilterGroupProps["type"];
|
|
173
180
|
};
|
|
174
181
|
|
|
175
182
|
export const FilterGroupItem = ({
|
|
183
|
+
id,
|
|
176
184
|
type = "link",
|
|
177
185
|
children,
|
|
178
186
|
onClick,
|
|
@@ -180,6 +188,7 @@ export const FilterGroupItem = ({
|
|
|
180
188
|
}: ComponentProps<React.ElementType> & FilterGroupItemProps) => {
|
|
181
189
|
return (
|
|
182
190
|
<div
|
|
191
|
+
id={id}
|
|
183
192
|
onClick={handleClick}
|
|
184
193
|
{...props}
|
|
185
194
|
className={clsx(
|
|
@@ -189,7 +198,12 @@ export const FilterGroupItem = ({
|
|
|
189
198
|
: "",
|
|
190
199
|
)}
|
|
191
200
|
>
|
|
192
|
-
<FilterGroupItemChildComponent
|
|
201
|
+
<FilterGroupItemChildComponent
|
|
202
|
+
{...props}
|
|
203
|
+
id={id ? `${id}-child` : undefined}
|
|
204
|
+
type={type}
|
|
205
|
+
count={props.count}
|
|
206
|
+
>
|
|
193
207
|
<span className="flex items-center justify-between w-full">
|
|
194
208
|
{children}
|
|
195
209
|
|
|
@@ -213,7 +227,13 @@ const FilterGroupItemChildComponent = ({
|
|
|
213
227
|
type: FilterGroupItemProps["type"];
|
|
214
228
|
}) => {
|
|
215
229
|
if (type === "checkbox") {
|
|
216
|
-
return
|
|
230
|
+
return (
|
|
231
|
+
<Checkbox
|
|
232
|
+
paragraphClassName="w-full"
|
|
233
|
+
label={children as string}
|
|
234
|
+
{...props}
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
217
237
|
}
|
|
218
238
|
|
|
219
239
|
if (type === "summary") {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export function FullViewportLayout({
|
|
2
2
|
children,
|
|
3
|
+
id,
|
|
3
4
|
}: {
|
|
4
5
|
children: React.ReactNode;
|
|
6
|
+
id?: string;
|
|
5
7
|
}) {
|
|
6
8
|
return (
|
|
7
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
id={id}
|
|
11
|
+
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"
|
|
12
|
+
>
|
|
8
13
|
{children}
|
|
9
14
|
</div>
|
|
10
15
|
);
|
package/src/components/Grid.tsx
CHANGED
|
@@ -8,6 +8,7 @@ type GridProps = {
|
|
|
8
8
|
padding?: boolean;
|
|
9
9
|
hasSideMenu?: boolean;
|
|
10
10
|
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
11
|
+
id?: string;
|
|
11
12
|
} & Omit<ComponentProps<"div">, "className">;
|
|
12
13
|
|
|
13
14
|
// Grid class configuration maps for better maintainability
|
|
@@ -87,10 +88,12 @@ export const Grid = ({
|
|
|
87
88
|
padding,
|
|
88
89
|
hasSideMenu = false,
|
|
89
90
|
columns,
|
|
91
|
+
id,
|
|
90
92
|
}: GridProps) => {
|
|
91
93
|
const childCount = Children.count(children);
|
|
92
94
|
return (
|
|
93
95
|
<div
|
|
96
|
+
id={id}
|
|
94
97
|
className={clsx(
|
|
95
98
|
padding &&
|
|
96
99
|
sizing === "container" &&
|
|
@@ -9,6 +9,7 @@ type HeadingVariant = "heading1" | "heading2" | "heading3";
|
|
|
9
9
|
type HeadingProps = {
|
|
10
10
|
as?: Tags;
|
|
11
11
|
variant?: HeadingVariant;
|
|
12
|
+
id?: string;
|
|
12
13
|
} & AsProps<Tags> &
|
|
13
14
|
TextAttributes &
|
|
14
15
|
TypographyProps;
|
|
@@ -20,6 +21,7 @@ export const Heading = ({
|
|
|
20
21
|
color,
|
|
21
22
|
align,
|
|
22
23
|
variant = "heading1",
|
|
24
|
+
id,
|
|
23
25
|
...props
|
|
24
26
|
}: HeadingProps) => {
|
|
25
27
|
const defaultElement =
|
|
@@ -28,6 +30,7 @@ export const Heading = ({
|
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
32
|
<Element
|
|
33
|
+
id={id}
|
|
31
34
|
className={clsx(
|
|
32
35
|
typography[variant],
|
|
33
36
|
className,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export function HorizontalDivider() {
|
|
2
|
-
return
|
|
1
|
+
export function HorizontalDivider({ id }: { id?: string }) {
|
|
2
|
+
return (
|
|
3
|
+
<hr id={id} className="w-full border-t border-border-primary-normal" />
|
|
4
|
+
);
|
|
3
5
|
}
|