@dmsi/wedgekit-react 0.0.922 → 0.0.986

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 (142) hide show
  1. package/dist/{chunk-LFBTRFTS.js → chunk-2UNLVJU5.js} +4 -4
  2. package/dist/{chunk-PXIW3XJX.js → chunk-34J6RA4C.js} +1 -1
  3. package/dist/{chunk-NGXKXYB5.js → chunk-6FZNEFN3.js} +1 -1
  4. package/dist/{chunk-Z7XANQ47.js → chunk-6M2N7DVS.js} +4 -2
  5. package/dist/{chunk-RAJY6INK.js → chunk-BBU7JOY2.js} +1 -1
  6. package/dist/{chunk-UUKHQUSF.js → chunk-F6QO73TV.js} +1 -1
  7. package/dist/{chunk-BRCBTEQ2.js → chunk-FGXTI3WE.js} +1 -1
  8. package/dist/{chunk-EJVCDJ7U.js → chunk-HDFO56DN.js} +1 -1
  9. package/dist/{chunk-XWYDWH4W.js → chunk-HTICQWRA.js} +1 -1
  10. package/dist/{chunk-N36EJLRW.js → chunk-JZZ4LF6B.js} +2 -2
  11. package/dist/{chunk-27DJTEAB.js → chunk-MB6IRHTN.js} +1 -1
  12. package/dist/{chunk-ZACRFGND.js → chunk-NBTWFTSF.js} +94 -65
  13. package/dist/{chunk-FAW3WWOQ.js → chunk-OC5AXLJY.js} +1 -1
  14. package/dist/{chunk-VABOQRYA.js → chunk-POZD6R3P.js} +1 -1
  15. package/dist/{chunk-YYRFXTO7.js → chunk-RLJU65SD.js} +21 -29
  16. package/dist/{chunk-F7F5BKW5.js → chunk-TBZ243DS.js} +1 -1
  17. package/dist/{chunk-2EAVEFWY.js → chunk-WHWZ5VVQ.js} +3 -2
  18. package/dist/{chunk-FSXKJXPN.js → chunk-Y7RCYDF6.js} +8 -2
  19. package/dist/{chunk-BMAZBFUU.js → chunk-ZMTHWJ7F.js} +15 -2
  20. package/dist/chunk-ZRFXUER3.js +468 -0
  21. package/dist/components/Alert.cjs +15 -2
  22. package/dist/components/Alert.js +2 -2
  23. package/dist/components/Breadcrumbs.cjs +8 -2
  24. package/dist/components/Breadcrumbs.js +1 -1
  25. package/dist/components/Button.cjs +15 -2
  26. package/dist/components/Button.js +1 -1
  27. package/dist/components/CalendarRange.cjs +385 -106
  28. package/dist/components/CalendarRange.css +55 -3
  29. package/dist/components/CalendarRange.js +14 -14
  30. package/dist/components/CompactImagesPreview.cjs +7 -4
  31. package/dist/components/CompactImagesPreview.js +2 -2
  32. package/dist/components/ContentTab.cjs +15 -2
  33. package/dist/components/ContentTab.js +2 -2
  34. package/dist/components/ContentTabs.cjs +15 -2
  35. package/dist/components/ContentTabs.js +2 -2
  36. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +385 -106
  37. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +55 -3
  38. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +14 -14
  39. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +385 -106
  40. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +55 -3
  41. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +14 -14
  42. package/dist/components/DataGrid/PinnedColumns.cjs +385 -106
  43. package/dist/components/DataGrid/PinnedColumns.css +55 -3
  44. package/dist/components/DataGrid/PinnedColumns.js +14 -14
  45. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +385 -106
  46. package/dist/components/DataGrid/TableBody/LoadingCell.css +55 -3
  47. package/dist/components/DataGrid/TableBody/LoadingCell.js +14 -14
  48. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +385 -106
  49. package/dist/components/DataGrid/TableBody/TableBodyRow.css +55 -3
  50. package/dist/components/DataGrid/TableBody/TableBodyRow.js +14 -14
  51. package/dist/components/DataGrid/TableBody/index.cjs +385 -106
  52. package/dist/components/DataGrid/TableBody/index.css +55 -3
  53. package/dist/components/DataGrid/TableBody/index.js +14 -14
  54. package/dist/components/DataGrid/index.cjs +385 -106
  55. package/dist/components/DataGrid/index.css +55 -3
  56. package/dist/components/DataGrid/index.js +14 -14
  57. package/dist/components/DataGrid/utils.cjs +385 -106
  58. package/dist/components/DataGrid/utils.css +55 -3
  59. package/dist/components/DataGrid/utils.js +14 -14
  60. package/dist/components/DataGridCell.cjs +7 -4
  61. package/dist/components/DataGridCell.js +2 -2
  62. package/dist/components/DateInput.cjs +385 -106
  63. package/dist/components/DateInput.css +55 -3
  64. package/dist/components/DateInput.js +14 -14
  65. package/dist/components/DateRangeInput.cjs +385 -106
  66. package/dist/components/DateRangeInput.css +55 -3
  67. package/dist/components/DateRangeInput.js +14 -14
  68. package/dist/components/EmblaCarousel/index.cjs +94 -65
  69. package/dist/components/EmblaCarousel/index.js +1 -1
  70. package/dist/components/FilterGroup.cjs +23 -4
  71. package/dist/components/FilterGroup.js +3 -3
  72. package/dist/components/Link.cjs +8 -2
  73. package/dist/components/Link.js +1 -1
  74. package/dist/components/Menu.cjs +7 -4
  75. package/dist/components/Menu.js +2 -2
  76. package/dist/components/MenuOption.cjs +7 -4
  77. package/dist/components/MenuOption.js +2 -2
  78. package/dist/components/MobileDataGrid/ColumnList.css +55 -3
  79. package/dist/components/MobileDataGrid/ColumnList.js +4 -4
  80. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +385 -106
  81. package/dist/components/MobileDataGrid/ColumnSelector/index.css +55 -3
  82. package/dist/components/MobileDataGrid/ColumnSelector/index.js +14 -14
  83. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
  84. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
  85. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +385 -106
  86. package/dist/components/MobileDataGrid/MobileDataGridHeader.css +55 -3
  87. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +14 -14
  88. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
  89. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +24 -7
  90. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +9 -9
  91. package/dist/components/MobileDataGrid/index.cjs +386 -107
  92. package/dist/components/MobileDataGrid/index.css +55 -3
  93. package/dist/components/MobileDataGrid/index.js +14 -14
  94. package/dist/components/Modal.cjs +23 -6
  95. package/dist/components/Modal.js +6 -6
  96. package/dist/components/ModalButtons.cjs +15 -2
  97. package/dist/components/ModalButtons.js +2 -2
  98. package/dist/components/ModalHeader.cjs +17 -3
  99. package/dist/components/ModalHeader.js +2 -2
  100. package/dist/components/NavigationTab.cjs +15 -2
  101. package/dist/components/NavigationTab.js +2 -2
  102. package/dist/components/NavigationTabs.cjs +15 -2
  103. package/dist/components/NavigationTabs.js +2 -2
  104. package/dist/components/NestedMenu.cjs +22 -6
  105. package/dist/components/NestedMenu.js +3 -3
  106. package/dist/components/Notification.cjs +15 -2
  107. package/dist/components/Notification.js +1 -1
  108. package/dist/components/OptionPill.cjs +15 -2
  109. package/dist/components/OptionPill.js +2 -2
  110. package/dist/components/PDFViewer/DownloadIcon.cjs +25 -7
  111. package/dist/components/PDFViewer/DownloadIcon.js +4 -4
  112. package/dist/components/PDFViewer/PDFNavigation.cjs +15 -2
  113. package/dist/components/PDFViewer/PDFNavigation.js +2 -2
  114. package/dist/components/PDFViewer/index.cjs +40 -13
  115. package/dist/components/PDFViewer/index.js +15 -13
  116. package/dist/components/Password.cjs +7 -4
  117. package/dist/components/Password.js +2 -2
  118. package/dist/components/ProductImagePreview/index.cjs +7 -4
  119. package/dist/components/ProductImagePreview/index.js +2 -2
  120. package/dist/components/ProjectBar.cjs +7 -4
  121. package/dist/components/ProjectBar.js +2 -2
  122. package/dist/components/Stepper.cjs +61 -15
  123. package/dist/components/Stepper.js +42 -12
  124. package/dist/components/Time.js +1 -1
  125. package/dist/components/Toast.cjs +15 -2
  126. package/dist/components/Toast.js +1 -1
  127. package/dist/components/Tooltip.cjs +7 -4
  128. package/dist/components/Tooltip.js +2 -2
  129. package/dist/components/Upload.cjs +15 -2
  130. package/dist/components/Upload.js +1 -1
  131. package/dist/components/index.cjs +479 -171
  132. package/dist/components/index.css +55 -3
  133. package/dist/components/index.js +14 -14
  134. package/dist/components/useMenuSystem.cjs +7 -4
  135. package/dist/components/useMenuSystem.js +2 -2
  136. package/dist/hooks/index.cjs +346 -73
  137. package/dist/hooks/index.js +2 -2
  138. package/dist/index.css +55 -3
  139. package/dist/utils/index.cjs +1 -1
  140. package/dist/utils/index.js +1 -1
  141. package/package.json +1 -1
  142. package/dist/chunk-WOWPMA26.js +0 -170
@@ -112,6 +112,9 @@ var useMatchesMedia = (query) => {
112
112
  };
113
113
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
114
114
 
115
+ // src/hooks/useTableLayout/useTableLayout.ts
116
+ var import_react4 = require("react");
117
+
115
118
  // src/utils/formatting.tsx
116
119
  function getDecimalPlaceholder(decimals) {
117
120
  if (!decimals || decimals <= 0) {
@@ -243,30 +246,8 @@ function formatDate(date) {
243
246
  }
244
247
  }
245
248
 
246
- // src/utils/mergeObjectArrays.ts
247
- function mergeObjectArrays(arr1, arr2) {
248
- const arr2Map = /* @__PURE__ */ new Map();
249
- for (const item of arr2) {
250
- const id = item.id;
251
- if (id !== void 0) {
252
- arr2Map.set(id, item);
253
- }
254
- }
255
- return arr1.map((item1) => {
256
- const id = item1.id;
257
- if (id !== void 0 && arr2Map.has(id)) {
258
- const item2 = arr2Map.get(id);
259
- const meta1 = item1.meta;
260
- const meta2 = item2.meta;
261
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
262
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
263
- }
264
- return item1;
265
- });
266
- }
267
-
268
249
  // src/utils/index.ts
269
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
250
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
270
251
 
271
252
  // src/utils.ts
272
253
  function findDocumentRoot(element) {
@@ -291,74 +272,366 @@ function findDocumentRoot(element) {
291
272
  return window.document.body;
292
273
  }
293
274
 
294
- // src/hooks/useTableLayout.ts
295
- var import_react4 = require("react");
296
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
297
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
275
+ // src/hooks/useTableLayout/storage.ts
276
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
277
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
278
+ var CURRENT_SCHEMA_VERSION = 2;
279
+ function getStorageKey(key) {
280
+ return `${STORAGE_PREFIX}__${key}`;
281
+ }
282
+ function getLegacyStorageKey(key) {
283
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
284
+ }
285
+ function loadPreferences(key) {
286
+ const storageKey = getStorageKey(key);
287
+ const legacyKey = getLegacyStorageKey(key);
288
+ const newData = localStorage.getItem(storageKey);
289
+ if (newData) {
290
+ try {
291
+ const parsed = JSON.parse(newData);
292
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
293
+ return parsed;
294
+ }
295
+ localStorage.removeItem(storageKey);
296
+ } catch (e) {
297
+ localStorage.removeItem(storageKey);
298
+ }
299
+ }
300
+ const legacyData = localStorage.getItem(legacyKey);
301
+ if (legacyData) {
302
+ localStorage.removeItem(legacyKey);
303
+ }
304
+ return null;
305
+ }
306
+ function savePreferences(key, preferences) {
307
+ var _a, _b, _c, _d, _e, _f, _g;
308
+ const storageKey = getStorageKey(key);
309
+ const hasPreferences = ((_b = (_a = preferences.columnOrder) == null ? void 0 : _a.length) != null ? _b : 0) > 0 || ((_d = (_c = preferences.hiddenByUser) == null ? void 0 : _c.length) != null ? _d : 0) > 0 || ((_f = (_e = preferences.shownByUser) == null ? void 0 : _e.length) != null ? _f : 0) > 0 || Object.keys((_g = preferences.columnWidths) != null ? _g : {}).length > 0;
310
+ if (!hasPreferences) {
311
+ localStorage.removeItem(storageKey);
312
+ return;
313
+ }
314
+ const data = __spreadProps(__spreadValues({}, preferences), {
315
+ version: CURRENT_SCHEMA_VERSION
316
+ });
317
+ localStorage.setItem(storageKey, JSON.stringify(data));
318
+ }
319
+ function clearPreferences(key) {
320
+ const storageKey = getStorageKey(key);
321
+ const legacyKey = getLegacyStorageKey(key);
322
+ localStorage.removeItem(storageKey);
323
+ localStorage.removeItem(legacyKey);
324
+ }
325
+ function clearAllLegacyData() {
326
+ if (typeof window === "undefined") return;
327
+ const keysToRemove = [];
328
+ for (let i = 0; i < localStorage.length; i++) {
329
+ const key = localStorage.key(i);
330
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
331
+ keysToRemove.push(key);
332
+ }
333
+ }
334
+ keysToRemove.forEach((key) => {
335
+ localStorage.removeItem(key);
336
+ });
337
+ }
338
+ function hasPerformedLegacyMigration() {
339
+ if (typeof window === "undefined") return true;
340
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
341
+ }
342
+ function markLegacyMigrationComplete() {
343
+ if (typeof window === "undefined") return;
344
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
345
+ }
346
+
347
+ // src/hooks/useTableLayout/computeColumns.ts
348
+ function computeColumnVisibility(column, preferences) {
349
+ var _a, _b, _c, _d, _e, _f;
350
+ const columnId = column.id;
351
+ if (!columnId) return true;
352
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
353
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
354
+ if (!canUserToggle) {
355
+ return systemVisible;
356
+ }
357
+ if (preferences) {
358
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
359
+ return false;
360
+ }
361
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
362
+ return true;
363
+ }
364
+ }
365
+ return systemVisible;
366
+ }
367
+ function applyPreferencesToColumns(systemColumns, preferences) {
368
+ var _a;
369
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
370
+ meta: __spreadProps(__spreadValues({}, col.meta), {
371
+ // Compute visibility based on system + user preferences
372
+ visible: computeColumnVisibility(col, preferences)
373
+ })
374
+ }));
375
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
376
+ const orderMap = new Map(
377
+ preferences.columnOrder.map((id, index) => [id, index])
378
+ );
379
+ columns = columns.sort((a, b) => {
380
+ var _a2, _b;
381
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
382
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
383
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
384
+ return 0;
385
+ }
386
+ return orderA - orderB;
387
+ });
388
+ }
389
+ if (preferences == null ? void 0 : preferences.columnWidths) {
390
+ columns = columns.map((col) => {
391
+ var _a2;
392
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
393
+ if (width !== void 0) {
394
+ return __spreadProps(__spreadValues({}, col), {
395
+ size: width
396
+ });
397
+ }
398
+ return col;
399
+ });
400
+ }
401
+ return columns;
402
+ }
403
+ function extractColumnOrder(columns) {
404
+ return columns.filter((c) => c.id).map((c) => c.id);
405
+ }
406
+ function extractVisibilityChanges(columns, systemColumns) {
407
+ const hiddenByUser = [];
408
+ const shownByUser = [];
409
+ columns.forEach((col) => {
410
+ var _a, _b, _c, _d, _e, _f, _g;
411
+ if (!col.id) return;
412
+ const systemCol = systemColumns.find((c) => c.id === col.id);
413
+ if (!systemCol) return;
414
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
415
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
416
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
417
+ if (!canToggle) return;
418
+ if (systemVisible && !currentVisible) {
419
+ hiddenByUser.push(col.id);
420
+ } else if (!systemVisible && currentVisible) {
421
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
422
+ shownByUser.push(col.id);
423
+ }
424
+ }
425
+ });
426
+ return { hiddenByUser, shownByUser };
427
+ }
428
+
429
+ // src/hooks/useTableLayout/useTableLayout.ts
430
+ var hasCleanedLegacyDataThisSession = false;
298
431
  function useTableLayout(initialColumns, key, autosync = true) {
299
- const [columns, setColumns] = (0, import_react4.useState)(initialColumns);
432
+ const [preferences, setPreferences] = (0, import_react4.useState)(null);
433
+ const [columns, setColumnsState] = (0, import_react4.useState)(
434
+ () => (
435
+ // Initialize with system columns (no preferences applied yet)
436
+ initialColumns.map((col) => __spreadValues({}, col))
437
+ )
438
+ );
300
439
  const [isReady, setIsReady] = (0, import_react4.useState)(false);
301
- const isReadyRef = (0, import_react4.useRef)(false);
302
440
  const keyRef = (0, import_react4.useRef)(key);
441
+ const initialColumnsRef = (0, import_react4.useRef)(initialColumns);
442
+ const preferencesRef = (0, import_react4.useRef)(preferences);
443
+ const autosyncRef = (0, import_react4.useRef)(autosync);
303
444
  (0, import_react4.useEffect)(() => {
304
- isReadyRef.current = isReady;
305
445
  keyRef.current = key;
306
- }, [isReady, key]);
307
- const handleSaveLayout = (0, import_react4.useCallback)(
308
- (setter, _internal) => {
309
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
310
- setColumns((prevColumns) => {
311
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
312
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
313
- return prevColumns;
314
- }
315
- localStorage.setItem(
316
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
317
- JSON.stringify(newColumns)
318
- );
319
- return newColumns;
320
- });
321
- },
322
- []
323
- );
446
+ }, [key]);
447
+ (0, import_react4.useEffect)(() => {
448
+ initialColumnsRef.current = initialColumns;
449
+ }, [initialColumns]);
450
+ (0, import_react4.useEffect)(() => {
451
+ preferencesRef.current = preferences;
452
+ }, [preferences]);
324
453
  (0, import_react4.useEffect)(() => {
325
- if (!autosync) return;
454
+ autosyncRef.current = autosync;
455
+ }, [autosync]);
456
+ (0, import_react4.useEffect)(() => {
457
+ if (typeof window === "undefined") return;
458
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
459
+ clearAllLegacyData();
460
+ markLegacyMigrationComplete();
461
+ hasCleanedLegacyDataThisSession = true;
462
+ }
463
+ }, []);
464
+ (0, import_react4.useEffect)(() => {
465
+ if (!autosync) {
466
+ setIsReady(true);
467
+ return;
468
+ }
326
469
  if (!key) {
327
470
  setIsReady(true);
328
471
  return;
329
472
  }
330
- const savedLayout = localStorage.getItem(
331
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
473
+ const savedPrefs = loadPreferences(key);
474
+ setPreferences(savedPrefs);
475
+ const computedColumns = applyPreferencesToColumns(
476
+ initialColumns,
477
+ savedPrefs
332
478
  );
333
- if (savedLayout) {
334
- setColumns(
335
- mergeObjectArrays(
336
- initialColumns,
337
- JSON.parse(savedLayout)
338
- )
339
- );
340
- } else {
341
- localStorage.setItem(
342
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
343
- JSON.stringify(initialColumns)
344
- );
345
- setColumns((prev) => {
346
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
347
- return prev;
348
- return initialColumns;
349
- });
350
- }
479
+ setColumnsState(computedColumns);
351
480
  setIsReady(true);
352
- }, [initialColumns, key, autosync]);
353
- const getSavedLayout = (0, import_react4.useCallback)(() => {
354
- const savedLayout = localStorage.getItem(
355
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
481
+ }, [key, autosync]);
482
+ (0, import_react4.useEffect)(() => {
483
+ if (!isReady) return;
484
+ const computedColumns = applyPreferencesToColumns(
485
+ initialColumns,
486
+ preferencesRef.current
356
487
  );
357
- if (savedLayout) {
358
- return JSON.parse(savedLayout);
359
- }
360
- }, [key]);
361
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
488
+ setColumnsState(computedColumns);
489
+ }, [initialColumns, isReady]);
490
+ const persistPreferences = (0, import_react4.useCallback)(
491
+ (newPrefs) => {
492
+ if (!keyRef.current) return;
493
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
494
+ version: 2
495
+ });
496
+ setPreferences(updated);
497
+ if (autosyncRef.current) {
498
+ savePreferences(keyRef.current, updated);
499
+ }
500
+ const computedColumns = applyPreferencesToColumns(
501
+ initialColumnsRef.current,
502
+ updated
503
+ );
504
+ setColumnsState(computedColumns);
505
+ },
506
+ []
507
+ );
508
+ const hideColumn = (0, import_react4.useCallback)(
509
+ (columnId) => {
510
+ var _a, _b;
511
+ const currentPrefs = preferencesRef.current;
512
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
513
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
514
+ const newShown = currentShown.filter((id) => id !== columnId);
515
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
516
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
517
+ hiddenByUser: newHidden,
518
+ shownByUser: newShown
519
+ }));
520
+ },
521
+ [persistPreferences]
522
+ );
523
+ const showColumn = (0, import_react4.useCallback)(
524
+ (columnId) => {
525
+ var _a, _b;
526
+ const currentPrefs = preferencesRef.current;
527
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
528
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
529
+ const newHidden = currentHidden.filter((id) => id !== columnId);
530
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
531
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
532
+ hiddenByUser: newHidden,
533
+ shownByUser: newShown
534
+ }));
535
+ },
536
+ [persistPreferences]
537
+ );
538
+ const reorderColumns = (0, import_react4.useCallback)(
539
+ (columnIds) => {
540
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
541
+ columnOrder: columnIds
542
+ }));
543
+ },
544
+ [persistPreferences]
545
+ );
546
+ const setColumnWidth = (0, import_react4.useCallback)(
547
+ (columnId, width) => {
548
+ var _a;
549
+ const currentPrefs = preferencesRef.current;
550
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
551
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
552
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
553
+ }));
554
+ },
555
+ [persistPreferences]
556
+ );
557
+ const resetToDefaults = (0, import_react4.useCallback)(() => {
558
+ if (!keyRef.current) return;
559
+ clearPreferences(keyRef.current);
560
+ setPreferences(null);
561
+ const computedColumns = applyPreferencesToColumns(
562
+ initialColumnsRef.current,
563
+ null
564
+ );
565
+ setColumnsState(computedColumns);
566
+ }, []);
567
+ const getUserPreferences = (0, import_react4.useCallback)(() => {
568
+ var _a;
569
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
570
+ }, []);
571
+ const getSavedLayout = (0, import_react4.useCallback)(() => {
572
+ return columns;
573
+ }, [columns]);
574
+ const setColumns = (0, import_react4.useCallback)(
575
+ (setter) => {
576
+ setColumnsState((prev) => {
577
+ var _a, _b, _c, _d;
578
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
579
+ const newOrder = extractColumnOrder(newColumns);
580
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
581
+ newColumns,
582
+ initialColumnsRef.current
583
+ );
584
+ const existingPrefs = preferencesRef.current;
585
+ const mergedHidden = Array.from(
586
+ /* @__PURE__ */ new Set([
587
+ ...hiddenByUser,
588
+ // Keep existing hidden prefs for columns that are still hidden
589
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
590
+ var _a2;
591
+ const col = newColumns.find((c) => c.id === id);
592
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
593
+ })) != null ? _b : []
594
+ ])
595
+ );
596
+ const mergedShown = Array.from(
597
+ /* @__PURE__ */ new Set([
598
+ ...shownByUser,
599
+ // Keep existing shown prefs for columns that are still visible
600
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
601
+ var _a2;
602
+ const col = newColumns.find((c) => c.id === id);
603
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
604
+ })) != null ? _d : []
605
+ ])
606
+ );
607
+ if (keyRef.current && autosync) {
608
+ const newPrefs = {
609
+ columnOrder: newOrder,
610
+ hiddenByUser: mergedHidden,
611
+ shownByUser: mergedShown,
612
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
613
+ version: 2
614
+ };
615
+ setPreferences(newPrefs);
616
+ savePreferences(keyRef.current, newPrefs);
617
+ }
618
+ return newColumns;
619
+ });
620
+ },
621
+ [autosync]
622
+ );
623
+ return {
624
+ columns,
625
+ setColumns,
626
+ isReady,
627
+ getSavedLayout,
628
+ hideColumn,
629
+ showColumn,
630
+ reorderColumns,
631
+ setColumnWidth,
632
+ resetToDefaults,
633
+ getUserPreferences
634
+ };
362
635
  }
363
636
 
364
637
  // src/hooks/useEditCell.tsx
@@ -2972,7 +3245,8 @@ var Button = (_a) => {
2972
3245
  href,
2973
3246
  id,
2974
3247
  testid,
2975
- isLoading
3248
+ isLoading,
3249
+ fontNormal = false
2976
3250
  } = _b, props = __objRest(_b, [
2977
3251
  "variant",
2978
3252
  "as",
@@ -2988,7 +3262,8 @@ var Button = (_a) => {
2988
3262
  "href",
2989
3263
  "id",
2990
3264
  "testid",
2991
- "isLoading"
3265
+ "isLoading",
3266
+ "fontNormal"
2992
3267
  ]);
2993
3268
  const primaryVariantStyles = variant === "primary" && (0, import_clsx13.default)(
2994
3269
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -3015,6 +3290,15 @@ var Button = (_a) => {
3015
3290
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
3016
3291
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
3017
3292
  );
3293
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx13.default)(
3294
+ "bg-transparent border-transparent",
3295
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
3296
+ "bg-transparent border-transparent",
3297
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
3298
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
3299
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
3300
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
3301
+ );
3018
3302
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx13.default)(
3019
3303
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
3020
3304
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -3058,6 +3342,7 @@ var Button = (_a) => {
3058
3342
  primaryVariantStyles,
3059
3343
  secondaryVariantStyles,
3060
3344
  tertiaryVariantStyles,
3345
+ quarternaryOutlinedVariantStyles,
3061
3346
  primaryCriticalVariantStyles,
3062
3347
  secondaryCriticalVariantStyles,
3063
3348
  tertiaryCriticalVariantStyles,
@@ -3068,6 +3353,7 @@ var Button = (_a) => {
3068
3353
  const labelClasses = (0, import_clsx13.default)(
3069
3354
  "min-h-6 flex items-center justify-center",
3070
3355
  classNameLabel,
3356
+ fontNormal && "font-normal!",
3071
3357
  componentPaddingXUsingComponentGap,
3072
3358
  typography.buttonLabel
3073
3359
  );
@@ -4173,7 +4459,8 @@ var ModalHeader = ({
4173
4459
  id,
4174
4460
  "data-testid": testid,
4175
4461
  className: (0, import_clsx21.default)(
4176
- "flex justify-between items-center",
4462
+ "flex items-center",
4463
+ headerIconAlign === void 0 && "justify-between",
4177
4464
  headerIconAlign === "center" && "justify-center",
4178
4465
  headerIconAlign === "right" && "justify-end",
4179
4466
  headerIconAlign === "left" && "justify-start",
@@ -5007,7 +5294,7 @@ var import_react35 = require("react");
5007
5294
  var import_jsx_runtime58 = require("react/jsx-runtime");
5008
5295
 
5009
5296
  // src/components/EmblaCarousel/index.tsx
5010
- var import_react38 = require("react");
5297
+ var import_react38 = __toESM(require("react"), 1);
5011
5298
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
5012
5299
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
5013
5300
 
@@ -5660,7 +5947,8 @@ function DataGrid({
5660
5947
  const {
5661
5948
  columns: tableColumns,
5662
5949
  setColumns: setTableColumns,
5663
- getSavedLayout
5950
+ getSavedLayout,
5951
+ resetToDefaults
5664
5952
  } = useTableLayout(columns, id != null ? id : testid);
5665
5953
  const [columnOrder, setColumnOrder] = (0, import_react43.useState)(
5666
5954
  tableColumns.map((c) => c.id)
@@ -5688,21 +5976,8 @@ function DataGrid({
5688
5976
  [tableColumns]
5689
5977
  );
5690
5978
  const resetDefaultColumnVisibility = (0, import_react43.useCallback)(() => {
5691
- setTableColumns((prev) => {
5692
- columns.forEach((column) => {
5693
- var _a2, _b2;
5694
- const columnId = column.id;
5695
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
5696
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
5697
- if (persistedIndex !== -1) {
5698
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
5699
- visible: isVisible
5700
- });
5701
- }
5702
- });
5703
- return [...prev];
5704
- }, true);
5705
- }, [columns, setTableColumns]);
5979
+ resetToDefaults();
5980
+ }, [resetToDefaults]);
5706
5981
  (0, import_react43.useEffect)(() => {
5707
5982
  updateColumnVisibility(true);
5708
5983
  }, [updateColumnVisibility]);
@@ -5738,14 +6013,18 @@ function DataGrid({
5738
6013
  const toggleColumnVisibility = (0, import_react43.useCallback)(
5739
6014
  (columnId, isVisible) => {
5740
6015
  setTableColumns((prev) => {
5741
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
5742
- if (persistedIndex !== -1) {
5743
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
5744
- visible: isVisible
5745
- });
5746
- }
5747
- return [...prev];
5748
- }, true);
6016
+ const newColumns = prev.map((col) => {
6017
+ if (col.id === columnId) {
6018
+ return __spreadProps(__spreadValues({}, col), {
6019
+ meta: __spreadProps(__spreadValues({}, col.meta), {
6020
+ visible: isVisible
6021
+ })
6022
+ });
6023
+ }
6024
+ return col;
6025
+ });
6026
+ return newColumns;
6027
+ });
5749
6028
  },
5750
6029
  [setTableColumns]
5751
6030
  );