@dmsi/wedgekit-react 0.0.512 → 0.0.514

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 (42) hide show
  1. package/dist/{chunk-JWVZOEF5.js → chunk-YY66JVTB.js} +18 -9
  2. package/dist/{chunk-F6RZ7MUE.js → chunk-ZCIC3AIZ.js} +4 -1
  3. package/dist/components/CalendarRange.cjs +21 -9
  4. package/dist/components/CalendarRange.js +4 -4
  5. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +21 -9
  6. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +4 -4
  7. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +21 -9
  8. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +4 -4
  9. package/dist/components/DataGrid/PinnedColumns.cjs +21 -9
  10. package/dist/components/DataGrid/PinnedColumns.js +4 -4
  11. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +21 -9
  12. package/dist/components/DataGrid/TableBody/LoadingCell.js +4 -4
  13. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +21 -9
  14. package/dist/components/DataGrid/TableBody/TableBodyRow.js +4 -4
  15. package/dist/components/DataGrid/TableBody/index.cjs +21 -9
  16. package/dist/components/DataGrid/TableBody/index.js +4 -4
  17. package/dist/components/DataGrid/index.cjs +21 -9
  18. package/dist/components/DataGrid/index.js +4 -4
  19. package/dist/components/DataGrid/utils.cjs +21 -9
  20. package/dist/components/DataGrid/utils.js +4 -4
  21. package/dist/components/DataGridCell.cjs +4 -1
  22. package/dist/components/DataGridCell.js +1 -1
  23. package/dist/components/DateInput.cjs +21 -9
  24. package/dist/components/DateInput.js +4 -4
  25. package/dist/components/DateRangeInput.cjs +21 -9
  26. package/dist/components/DateRangeInput.js +4 -4
  27. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +21 -9
  28. package/dist/components/MobileDataGrid/ColumnSelector/index.js +4 -4
  29. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +21 -9
  30. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +4 -4
  31. package/dist/components/MobileDataGrid/index.cjs +21 -9
  32. package/dist/components/MobileDataGrid/index.js +4 -4
  33. package/dist/components/ProductImagePreview/index.js +2 -2
  34. package/dist/components/index.cjs +21 -9
  35. package/dist/components/index.js +4 -4
  36. package/package.json +1 -1
  37. package/src/components/DataGrid/TableBody/TableBodyRow.tsx +7 -4
  38. package/src/components/DataGrid/TableBody/index.tsx +9 -0
  39. package/src/components/DataGrid/index.tsx +4 -0
  40. package/src/components/DataGrid/types.ts +2 -0
  41. package/src/components/DataGridCell.tsx +3 -0
  42. package/dist/{chunk-IGUQFLEO.js → chunk-CDMXM5JW.js} +3 -3
@@ -2211,6 +2211,7 @@ var DataGridCell = (0, import_react11.memo)(
2211
2211
  center,
2212
2212
  width,
2213
2213
  minWidth,
2214
+ disabled,
2214
2215
  testid
2215
2216
  } = _b, props = __objRest(_b, [
2216
2217
  "id",
@@ -2229,6 +2230,7 @@ var DataGridCell = (0, import_react11.memo)(
2229
2230
  "center",
2230
2231
  "width",
2231
2232
  "minWidth",
2233
+ "disabled",
2232
2234
  "testid"
2233
2235
  ]);
2234
2236
  const Element = type === "header" ? "th" : "td";
@@ -2294,7 +2296,8 @@ var DataGridCell = (0, import_react11.memo)(
2294
2296
  paddedLeft && "pl-2",
2295
2297
  component === "icon" && "border-l",
2296
2298
  isGrabbing && "!cursor-grabbing",
2297
- component === "checkbox" || center && "justify-center"
2299
+ component === "checkbox" || center && "justify-center",
2300
+ disabled && "!text-text-primary-disabled"
2298
2301
  );
2299
2302
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2300
2303
  Element,
@@ -2687,7 +2690,8 @@ function TableBodyRow({
2687
2690
  showFilterRow,
2688
2691
  // enableColumnSelector = false,
2689
2692
  locked,
2690
- pinDirection
2693
+ pinDirection,
2694
+ disabled
2691
2695
  }) {
2692
2696
  var _a;
2693
2697
  let visibleCells;
@@ -2705,10 +2709,11 @@ function TableBodyRow({
2705
2709
  {
2706
2710
  className: (0, import_clsx11.default)(
2707
2711
  "min-h-10",
2708
- "transition-colors hover:bg-background-action-secondary-hover",
2709
- row.getIsSelected() && "!bg-background-action-secondary-hover",
2710
- isError && "!bg-background-action-critical-secondary-hover",
2711
- showFilterRow ? "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal" : "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal"
2712
+ "transition-colors",
2713
+ !disabled && "hover:bg-background-action-secondary-hover",
2714
+ row.getIsSelected() && !disabled && "!bg-background-action-secondary-hover",
2715
+ isError && !disabled && "!bg-background-action-critical-secondary-hover",
2716
+ showFilterRow && !disabled ? "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal" : "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal"
2712
2717
  ),
2713
2718
  id: id ? `${id}-row-${row.id}` : void 0,
2714
2719
  "data-testid": testid ? `${testid}-row-${row.id}` : void 0,
@@ -2818,7 +2823,9 @@ function TableBody({
2818
2823
  showFilterRow,
2819
2824
  enableColumnSelector = false,
2820
2825
  locked,
2821
- pinDirection
2826
+ pinDirection,
2827
+ rowDisabled,
2828
+ rowDisabledAccessor
2822
2829
  }) {
2823
2830
  const { rows } = table.getRowModel();
2824
2831
  const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
@@ -2911,7 +2918,8 @@ function TableBody({
2911
2918
  showFilterRow,
2912
2919
  enableColumnSelector,
2913
2920
  locked,
2914
- pinDirection
2921
+ pinDirection,
2922
+ disabled: rowDisabledAccessor ? rowDisabledAccessor(row.original) : rowDisabled
2915
2923
  },
2916
2924
  row.id
2917
2925
  );
@@ -3221,6 +3229,8 @@ function DataGrid({
3221
3229
  predeterminedLeftPins = [],
3222
3230
  predeterminedRightPins = [],
3223
3231
  useMenuDefaultMinWidth,
3232
+ rowDisabled,
3233
+ rowDisabledAccessor,
3224
3234
  ref
3225
3235
  }) {
3226
3236
  var _a, _b, _c, _d, _e, _f, _g;
@@ -3609,7 +3619,9 @@ function DataGrid({
3609
3619
  isLoadingMore,
3610
3620
  hasMore,
3611
3621
  showFilterRow,
3612
- enableColumnSelector
3622
+ enableColumnSelector,
3623
+ rowDisabled,
3624
+ rowDisabledAccessor
3613
3625
  }
3614
3626
  )
3615
3627
  ] }),
@@ -2,14 +2,13 @@ import {
2
2
  DataGrid,
3
3
  DateInput,
4
4
  MobileDataGrid
5
- } from "../chunk-JWVZOEF5.js";
5
+ } from "../chunk-YY66JVTB.js";
6
6
  import "../chunk-M7INAUAJ.js";
7
7
  import "../chunk-ELXVDRWS.js";
8
8
  import "../chunk-3UUCDNX3.js";
9
9
  import {
10
10
  ProductImagePreview
11
- } from "../chunk-IGUQFLEO.js";
12
- import "../chunk-3X3Y4TMS.js";
11
+ } from "../chunk-CDMXM5JW.js";
13
12
  import "../chunk-BQNPOGD5.js";
14
13
  import {
15
14
  SearchResultImage
@@ -17,6 +16,7 @@ import {
17
16
  import "../chunk-MBZ55T2D.js";
18
17
  import "../chunk-2IKT6IHB.js";
19
18
  import "../chunk-YCDDBSVU.js";
19
+ import "../chunk-3X3Y4TMS.js";
20
20
  import "../chunk-PRN2EQBX.js";
21
21
  import "../chunk-5YNEY3WO.js";
22
22
  import "../chunk-5IFPG6TS.js";
@@ -58,7 +58,7 @@ import {
58
58
  DataGridCell,
59
59
  DragAlongCell,
60
60
  DraggableCellHeader
61
- } from "../chunk-F6RZ7MUE.js";
61
+ } from "../chunk-ZCIC3AIZ.js";
62
62
  import {
63
63
  Menu
64
64
  } from "../chunk-TCMOGTPB.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.512",
4
+ "version": "0.0.514",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -30,6 +30,7 @@ interface TableBodyRowProps<T> {
30
30
  enableColumnSelector?: boolean;
31
31
  locked?: boolean;
32
32
  pinDirection?: "left" | "right";
33
+ disabled?: boolean;
33
34
  }
34
35
 
35
36
  export function TableBodyRow<T>({
@@ -45,6 +46,7 @@ export function TableBodyRow<T>({
45
46
  // enableColumnSelector = false,
46
47
  locked,
47
48
  pinDirection,
49
+ disabled,
48
50
  }: TableBodyRowProps<T>) {
49
51
  let visibleCells: Cell<T, unknown>[];
50
52
 
@@ -73,10 +75,11 @@ export function TableBodyRow<T>({
73
75
  key={row.id}
74
76
  className={clsx(
75
77
  "min-h-10",
76
- "transition-colors hover:bg-background-action-secondary-hover",
77
- row.getIsSelected() && "!bg-background-action-secondary-hover",
78
- isError && "!bg-background-action-critical-secondary-hover",
79
- showFilterRow
78
+ "transition-colors",
79
+ !disabled && "hover:bg-background-action-secondary-hover",
80
+ row.getIsSelected() && !disabled && "!bg-background-action-secondary-hover",
81
+ isError && !disabled && "!bg-background-action-critical-secondary-hover",
82
+ showFilterRow && !disabled
80
83
  ? "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal"
81
84
  : "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
82
85
  )}
@@ -21,6 +21,8 @@ interface TableBodyProps<TData extends RowData> {
21
21
  enableColumnSelector?: boolean;
22
22
  locked?: boolean;
23
23
  pinDirection?: "left" | "right";
24
+ rowDisabled?: boolean;
25
+ rowDisabledAccessor?: (row: TData) => boolean;
24
26
  }
25
27
  export function TableBody<T>({
26
28
  id,
@@ -37,6 +39,8 @@ export function TableBody<T>({
37
39
  enableColumnSelector = false,
38
40
  locked,
39
41
  pinDirection,
42
+ rowDisabled,
43
+ rowDisabledAccessor,
40
44
  }: TableBodyProps<T>) {
41
45
  const { rows } = table.getRowModel();
42
46
 
@@ -145,6 +149,11 @@ export function TableBody<T>({
145
149
  enableColumnSelector={enableColumnSelector}
146
150
  locked={locked}
147
151
  pinDirection={pinDirection}
152
+ disabled={
153
+ rowDisabledAccessor
154
+ ? rowDisabledAccessor(row.original as T)
155
+ : rowDisabled
156
+ }
148
157
  />
149
158
  );
150
159
  })}
@@ -87,6 +87,8 @@ export function DataGrid<T extends Record<string, unknown>>({
87
87
  predeterminedLeftPins = [],
88
88
  predeterminedRightPins = [],
89
89
  useMenuDefaultMinWidth,
90
+ rowDisabled,
91
+ rowDisabledAccessor,
90
92
  ref,
91
93
  }: DataGridProps<T>) {
92
94
  useImperativeHandle(ref, () => ({
@@ -591,6 +593,8 @@ export function DataGrid<T extends Record<string, unknown>>({
591
593
  hasMore={hasMore}
592
594
  showFilterRow={showFilterRow}
593
595
  enableColumnSelector={enableColumnSelector}
596
+ rowDisabled={rowDisabled}
597
+ rowDisabledAccessor={rowDisabledAccessor}
594
598
  />
595
599
  </table>
596
600
 
@@ -52,6 +52,8 @@ export interface DataGridProps<T extends Record<string, unknown>> {
52
52
  predeterminedLeftPins?: string[];
53
53
  predeterminedRightPins?: string[];
54
54
  useMenuDefaultMinWidth?: boolean;
55
+ rowDisabled?: boolean;
56
+ rowDisabledAccessor?: (row: T) => boolean;
55
57
  ref?: React.Ref<{ getSavedLayout: () => ColumnDef<T>[] | undefined }>;
56
58
  }
57
59
 
@@ -45,6 +45,7 @@ type DataGridCellProps = PropsWithChildren<{
45
45
  center?: boolean;
46
46
  width?: string;
47
47
  minWidth?: string;
48
+ disabled?: boolean;
48
49
  }>;
49
50
 
50
51
  export const DataGridCell = memo(
@@ -65,6 +66,7 @@ export const DataGridCell = memo(
65
66
  center,
66
67
  width,
67
68
  minWidth,
69
+ disabled,
68
70
  testid,
69
71
  ...props
70
72
  }: AsProps<Tags> & DataGridCellProps) => {
@@ -166,6 +168,7 @@ export const DataGridCell = memo(
166
168
  component === "icon" && "border-l",
167
169
  isGrabbing && "!cursor-grabbing",
168
170
  component === "checkbox" || (center && "justify-center"),
171
+ disabled && "!text-text-primary-disabled",
169
172
  );
170
173
 
171
174
  return (
@@ -1,6 +1,3 @@
1
- import {
2
- Thumbnail
3
- } from "./chunk-3X3Y4TMS.js";
4
1
  import {
5
2
  ZoomWindow
6
3
  } from "./chunk-BQNPOGD5.js";
@@ -13,6 +10,9 @@ import {
13
10
  import {
14
11
  ProductPrimaryImage
15
12
  } from "./chunk-YCDDBSVU.js";
13
+ import {
14
+ Thumbnail
15
+ } from "./chunk-3X3Y4TMS.js";
16
16
  import {
17
17
  Grid
18
18
  } from "./chunk-BWPNXY7T.js";