@dmsi/wedgekit-react 0.0.922 → 0.0.987

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
@@ -444,6 +444,9 @@ var useMatchesMedia = (query) => {
444
444
  };
445
445
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
446
446
 
447
+ // src/hooks/useTableLayout/useTableLayout.ts
448
+ var import_react5 = require("react");
449
+
447
450
  // src/utils/formatting.tsx
448
451
  function getDecimalPlaceholder(decimals) {
449
452
  if (!decimals || decimals <= 0) {
@@ -575,30 +578,8 @@ function formatDate(date) {
575
578
  }
576
579
  }
577
580
 
578
- // src/utils/mergeObjectArrays.ts
579
- function mergeObjectArrays(arr1, arr2) {
580
- const arr2Map = /* @__PURE__ */ new Map();
581
- for (const item of arr2) {
582
- const id = item.id;
583
- if (id !== void 0) {
584
- arr2Map.set(id, item);
585
- }
586
- }
587
- return arr1.map((item1) => {
588
- const id = item1.id;
589
- if (id !== void 0 && arr2Map.has(id)) {
590
- const item2 = arr2Map.get(id);
591
- const meta1 = item1.meta;
592
- const meta2 = item2.meta;
593
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
594
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
595
- }
596
- return item1;
597
- });
598
- }
599
-
600
581
  // src/utils/index.ts
601
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
582
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
602
583
 
603
584
  // src/utils.ts
604
585
  function findDocumentRoot(element) {
@@ -623,74 +604,366 @@ function findDocumentRoot(element) {
623
604
  return window.document.body;
624
605
  }
625
606
 
626
- // src/hooks/useTableLayout.ts
627
- var import_react5 = require("react");
628
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
629
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
607
+ // src/hooks/useTableLayout/storage.ts
608
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
609
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
610
+ var CURRENT_SCHEMA_VERSION = 2;
611
+ function getStorageKey(key) {
612
+ return `${STORAGE_PREFIX}__${key}`;
613
+ }
614
+ function getLegacyStorageKey(key) {
615
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
616
+ }
617
+ function loadPreferences(key) {
618
+ const storageKey = getStorageKey(key);
619
+ const legacyKey = getLegacyStorageKey(key);
620
+ const newData = localStorage.getItem(storageKey);
621
+ if (newData) {
622
+ try {
623
+ const parsed = JSON.parse(newData);
624
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
625
+ return parsed;
626
+ }
627
+ localStorage.removeItem(storageKey);
628
+ } catch (e) {
629
+ localStorage.removeItem(storageKey);
630
+ }
631
+ }
632
+ const legacyData = localStorage.getItem(legacyKey);
633
+ if (legacyData) {
634
+ localStorage.removeItem(legacyKey);
635
+ }
636
+ return null;
637
+ }
638
+ function savePreferences(key, preferences) {
639
+ var _a, _b, _c, _d, _e, _f, _g;
640
+ const storageKey = getStorageKey(key);
641
+ 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;
642
+ if (!hasPreferences) {
643
+ localStorage.removeItem(storageKey);
644
+ return;
645
+ }
646
+ const data = __spreadProps(__spreadValues({}, preferences), {
647
+ version: CURRENT_SCHEMA_VERSION
648
+ });
649
+ localStorage.setItem(storageKey, JSON.stringify(data));
650
+ }
651
+ function clearPreferences(key) {
652
+ const storageKey = getStorageKey(key);
653
+ const legacyKey = getLegacyStorageKey(key);
654
+ localStorage.removeItem(storageKey);
655
+ localStorage.removeItem(legacyKey);
656
+ }
657
+ function clearAllLegacyData() {
658
+ if (typeof window === "undefined") return;
659
+ const keysToRemove = [];
660
+ for (let i = 0; i < localStorage.length; i++) {
661
+ const key = localStorage.key(i);
662
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
663
+ keysToRemove.push(key);
664
+ }
665
+ }
666
+ keysToRemove.forEach((key) => {
667
+ localStorage.removeItem(key);
668
+ });
669
+ }
670
+ function hasPerformedLegacyMigration() {
671
+ if (typeof window === "undefined") return true;
672
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
673
+ }
674
+ function markLegacyMigrationComplete() {
675
+ if (typeof window === "undefined") return;
676
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
677
+ }
678
+
679
+ // src/hooks/useTableLayout/computeColumns.ts
680
+ function computeColumnVisibility(column, preferences) {
681
+ var _a, _b, _c, _d, _e, _f;
682
+ const columnId = column.id;
683
+ if (!columnId) return true;
684
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
685
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
686
+ if (!canUserToggle) {
687
+ return systemVisible;
688
+ }
689
+ if (preferences) {
690
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
691
+ return false;
692
+ }
693
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
694
+ return true;
695
+ }
696
+ }
697
+ return systemVisible;
698
+ }
699
+ function applyPreferencesToColumns(systemColumns, preferences) {
700
+ var _a;
701
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
702
+ meta: __spreadProps(__spreadValues({}, col.meta), {
703
+ // Compute visibility based on system + user preferences
704
+ visible: computeColumnVisibility(col, preferences)
705
+ })
706
+ }));
707
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
708
+ const orderMap = new Map(
709
+ preferences.columnOrder.map((id, index) => [id, index])
710
+ );
711
+ columns = columns.sort((a, b) => {
712
+ var _a2, _b;
713
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
714
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
715
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
716
+ return 0;
717
+ }
718
+ return orderA - orderB;
719
+ });
720
+ }
721
+ if (preferences == null ? void 0 : preferences.columnWidths) {
722
+ columns = columns.map((col) => {
723
+ var _a2;
724
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
725
+ if (width !== void 0) {
726
+ return __spreadProps(__spreadValues({}, col), {
727
+ size: width
728
+ });
729
+ }
730
+ return col;
731
+ });
732
+ }
733
+ return columns;
734
+ }
735
+ function extractColumnOrder(columns) {
736
+ return columns.filter((c) => c.id).map((c) => c.id);
737
+ }
738
+ function extractVisibilityChanges(columns, systemColumns) {
739
+ const hiddenByUser = [];
740
+ const shownByUser = [];
741
+ columns.forEach((col) => {
742
+ var _a, _b, _c, _d, _e, _f, _g;
743
+ if (!col.id) return;
744
+ const systemCol = systemColumns.find((c) => c.id === col.id);
745
+ if (!systemCol) return;
746
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
747
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
748
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
749
+ if (!canToggle) return;
750
+ if (systemVisible && !currentVisible) {
751
+ hiddenByUser.push(col.id);
752
+ } else if (!systemVisible && currentVisible) {
753
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
754
+ shownByUser.push(col.id);
755
+ }
756
+ }
757
+ });
758
+ return { hiddenByUser, shownByUser };
759
+ }
760
+
761
+ // src/hooks/useTableLayout/useTableLayout.ts
762
+ var hasCleanedLegacyDataThisSession = false;
630
763
  function useTableLayout(initialColumns, key, autosync = true) {
631
- const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
764
+ const [preferences, setPreferences] = (0, import_react5.useState)(null);
765
+ const [columns, setColumnsState] = (0, import_react5.useState)(
766
+ () => (
767
+ // Initialize with system columns (no preferences applied yet)
768
+ initialColumns.map((col) => __spreadValues({}, col))
769
+ )
770
+ );
632
771
  const [isReady, setIsReady] = (0, import_react5.useState)(false);
633
- const isReadyRef = (0, import_react5.useRef)(false);
634
772
  const keyRef = (0, import_react5.useRef)(key);
773
+ const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
774
+ const preferencesRef = (0, import_react5.useRef)(preferences);
775
+ const autosyncRef = (0, import_react5.useRef)(autosync);
635
776
  (0, import_react5.useEffect)(() => {
636
- isReadyRef.current = isReady;
637
777
  keyRef.current = key;
638
- }, [isReady, key]);
639
- const handleSaveLayout = (0, import_react5.useCallback)(
640
- (setter, _internal) => {
641
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
642
- setColumns((prevColumns) => {
643
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
644
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
645
- return prevColumns;
646
- }
647
- localStorage.setItem(
648
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
649
- JSON.stringify(newColumns)
650
- );
651
- return newColumns;
652
- });
653
- },
654
- []
655
- );
778
+ }, [key]);
779
+ (0, import_react5.useEffect)(() => {
780
+ initialColumnsRef.current = initialColumns;
781
+ }, [initialColumns]);
782
+ (0, import_react5.useEffect)(() => {
783
+ preferencesRef.current = preferences;
784
+ }, [preferences]);
656
785
  (0, import_react5.useEffect)(() => {
657
- if (!autosync) return;
786
+ autosyncRef.current = autosync;
787
+ }, [autosync]);
788
+ (0, import_react5.useEffect)(() => {
789
+ if (typeof window === "undefined") return;
790
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
791
+ clearAllLegacyData();
792
+ markLegacyMigrationComplete();
793
+ hasCleanedLegacyDataThisSession = true;
794
+ }
795
+ }, []);
796
+ (0, import_react5.useEffect)(() => {
797
+ if (!autosync) {
798
+ setIsReady(true);
799
+ return;
800
+ }
658
801
  if (!key) {
659
802
  setIsReady(true);
660
803
  return;
661
804
  }
662
- const savedLayout = localStorage.getItem(
663
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
805
+ const savedPrefs = loadPreferences(key);
806
+ setPreferences(savedPrefs);
807
+ const computedColumns = applyPreferencesToColumns(
808
+ initialColumns,
809
+ savedPrefs
664
810
  );
665
- if (savedLayout) {
666
- setColumns(
667
- mergeObjectArrays(
668
- initialColumns,
669
- JSON.parse(savedLayout)
670
- )
671
- );
672
- } else {
673
- localStorage.setItem(
674
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
675
- JSON.stringify(initialColumns)
676
- );
677
- setColumns((prev) => {
678
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
679
- return prev;
680
- return initialColumns;
681
- });
682
- }
811
+ setColumnsState(computedColumns);
683
812
  setIsReady(true);
684
- }, [initialColumns, key, autosync]);
685
- const getSavedLayout = (0, import_react5.useCallback)(() => {
686
- const savedLayout = localStorage.getItem(
687
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
813
+ }, [key, autosync]);
814
+ (0, import_react5.useEffect)(() => {
815
+ if (!isReady) return;
816
+ const computedColumns = applyPreferencesToColumns(
817
+ initialColumns,
818
+ preferencesRef.current
688
819
  );
689
- if (savedLayout) {
690
- return JSON.parse(savedLayout);
691
- }
692
- }, [key]);
693
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
820
+ setColumnsState(computedColumns);
821
+ }, [initialColumns, isReady]);
822
+ const persistPreferences = (0, import_react5.useCallback)(
823
+ (newPrefs) => {
824
+ if (!keyRef.current) return;
825
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
826
+ version: 2
827
+ });
828
+ setPreferences(updated);
829
+ if (autosyncRef.current) {
830
+ savePreferences(keyRef.current, updated);
831
+ }
832
+ const computedColumns = applyPreferencesToColumns(
833
+ initialColumnsRef.current,
834
+ updated
835
+ );
836
+ setColumnsState(computedColumns);
837
+ },
838
+ []
839
+ );
840
+ const hideColumn = (0, import_react5.useCallback)(
841
+ (columnId) => {
842
+ var _a, _b;
843
+ const currentPrefs = preferencesRef.current;
844
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
845
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
846
+ const newShown = currentShown.filter((id) => id !== columnId);
847
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
848
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
849
+ hiddenByUser: newHidden,
850
+ shownByUser: newShown
851
+ }));
852
+ },
853
+ [persistPreferences]
854
+ );
855
+ const showColumn = (0, import_react5.useCallback)(
856
+ (columnId) => {
857
+ var _a, _b;
858
+ const currentPrefs = preferencesRef.current;
859
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
860
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
861
+ const newHidden = currentHidden.filter((id) => id !== columnId);
862
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
863
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
864
+ hiddenByUser: newHidden,
865
+ shownByUser: newShown
866
+ }));
867
+ },
868
+ [persistPreferences]
869
+ );
870
+ const reorderColumns = (0, import_react5.useCallback)(
871
+ (columnIds) => {
872
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
873
+ columnOrder: columnIds
874
+ }));
875
+ },
876
+ [persistPreferences]
877
+ );
878
+ const setColumnWidth = (0, import_react5.useCallback)(
879
+ (columnId, width) => {
880
+ var _a;
881
+ const currentPrefs = preferencesRef.current;
882
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
883
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
884
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
885
+ }));
886
+ },
887
+ [persistPreferences]
888
+ );
889
+ const resetToDefaults = (0, import_react5.useCallback)(() => {
890
+ if (!keyRef.current) return;
891
+ clearPreferences(keyRef.current);
892
+ setPreferences(null);
893
+ const computedColumns = applyPreferencesToColumns(
894
+ initialColumnsRef.current,
895
+ null
896
+ );
897
+ setColumnsState(computedColumns);
898
+ }, []);
899
+ const getUserPreferences = (0, import_react5.useCallback)(() => {
900
+ var _a;
901
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
902
+ }, []);
903
+ const getSavedLayout = (0, import_react5.useCallback)(() => {
904
+ return columns;
905
+ }, [columns]);
906
+ const setColumns = (0, import_react5.useCallback)(
907
+ (setter) => {
908
+ setColumnsState((prev) => {
909
+ var _a, _b, _c, _d;
910
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
911
+ const newOrder = extractColumnOrder(newColumns);
912
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
913
+ newColumns,
914
+ initialColumnsRef.current
915
+ );
916
+ const existingPrefs = preferencesRef.current;
917
+ const mergedHidden = Array.from(
918
+ /* @__PURE__ */ new Set([
919
+ ...hiddenByUser,
920
+ // Keep existing hidden prefs for columns that are still hidden
921
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
922
+ var _a2;
923
+ const col = newColumns.find((c) => c.id === id);
924
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
925
+ })) != null ? _b : []
926
+ ])
927
+ );
928
+ const mergedShown = Array.from(
929
+ /* @__PURE__ */ new Set([
930
+ ...shownByUser,
931
+ // Keep existing shown prefs for columns that are still visible
932
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
933
+ var _a2;
934
+ const col = newColumns.find((c) => c.id === id);
935
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
936
+ })) != null ? _d : []
937
+ ])
938
+ );
939
+ if (keyRef.current && autosync) {
940
+ const newPrefs = {
941
+ columnOrder: newOrder,
942
+ hiddenByUser: mergedHidden,
943
+ shownByUser: mergedShown,
944
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
945
+ version: 2
946
+ };
947
+ setPreferences(newPrefs);
948
+ savePreferences(keyRef.current, newPrefs);
949
+ }
950
+ return newColumns;
951
+ });
952
+ },
953
+ [autosync]
954
+ );
955
+ return {
956
+ columns,
957
+ setColumns,
958
+ isReady,
959
+ getSavedLayout,
960
+ hideColumn,
961
+ showColumn,
962
+ reorderColumns,
963
+ setColumnWidth,
964
+ resetToDefaults,
965
+ getUserPreferences
966
+ };
694
967
  }
695
968
 
696
969
  // src/hooks/useEditCell.tsx
@@ -3175,7 +3448,8 @@ function DataGrid({
3175
3448
  const {
3176
3449
  columns: tableColumns,
3177
3450
  setColumns: setTableColumns,
3178
- getSavedLayout
3451
+ getSavedLayout,
3452
+ resetToDefaults
3179
3453
  } = useTableLayout(columns, id != null ? id : testid);
3180
3454
  const [columnOrder, setColumnOrder] = (0, import_react16.useState)(
3181
3455
  tableColumns.map((c) => c.id)
@@ -3203,21 +3477,8 @@ function DataGrid({
3203
3477
  [tableColumns]
3204
3478
  );
3205
3479
  const resetDefaultColumnVisibility = (0, import_react16.useCallback)(() => {
3206
- setTableColumns((prev) => {
3207
- columns.forEach((column) => {
3208
- var _a2, _b2;
3209
- const columnId = column.id;
3210
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
3211
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3212
- if (persistedIndex !== -1) {
3213
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3214
- visible: isVisible
3215
- });
3216
- }
3217
- });
3218
- return [...prev];
3219
- }, true);
3220
- }, [columns, setTableColumns]);
3480
+ resetToDefaults();
3481
+ }, [resetToDefaults]);
3221
3482
  (0, import_react16.useEffect)(() => {
3222
3483
  updateColumnVisibility(true);
3223
3484
  }, [updateColumnVisibility]);
@@ -3253,14 +3514,18 @@ function DataGrid({
3253
3514
  const toggleColumnVisibility = (0, import_react16.useCallback)(
3254
3515
  (columnId, isVisible) => {
3255
3516
  setTableColumns((prev) => {
3256
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3257
- if (persistedIndex !== -1) {
3258
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3259
- visible: isVisible
3260
- });
3261
- }
3262
- return [...prev];
3263
- }, true);
3517
+ const newColumns = prev.map((col) => {
3518
+ if (col.id === columnId) {
3519
+ return __spreadProps(__spreadValues({}, col), {
3520
+ meta: __spreadProps(__spreadValues({}, col.meta), {
3521
+ visible: isVisible
3522
+ })
3523
+ });
3524
+ }
3525
+ return col;
3526
+ });
3527
+ return newColumns;
3528
+ });
3264
3529
  },
3265
3530
  [setTableColumns]
3266
3531
  );
@@ -4032,7 +4297,8 @@ var Button = (_a) => {
4032
4297
  href,
4033
4298
  id,
4034
4299
  testid,
4035
- isLoading
4300
+ isLoading,
4301
+ fontNormal = false
4036
4302
  } = _b, props = __objRest(_b, [
4037
4303
  "variant",
4038
4304
  "as",
@@ -4048,7 +4314,8 @@ var Button = (_a) => {
4048
4314
  "href",
4049
4315
  "id",
4050
4316
  "testid",
4051
- "isLoading"
4317
+ "isLoading",
4318
+ "fontNormal"
4052
4319
  ]);
4053
4320
  const primaryVariantStyles = variant === "primary" && (0, import_clsx17.default)(
4054
4321
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -4075,6 +4342,15 @@ var Button = (_a) => {
4075
4342
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
4076
4343
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4077
4344
  );
4345
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx17.default)(
4346
+ "bg-transparent border-transparent",
4347
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
4348
+ "bg-transparent border-transparent",
4349
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
4350
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
4351
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
4352
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4353
+ );
4078
4354
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx17.default)(
4079
4355
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
4080
4356
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -4118,6 +4394,7 @@ var Button = (_a) => {
4118
4394
  primaryVariantStyles,
4119
4395
  secondaryVariantStyles,
4120
4396
  tertiaryVariantStyles,
4397
+ quarternaryOutlinedVariantStyles,
4121
4398
  primaryCriticalVariantStyles,
4122
4399
  secondaryCriticalVariantStyles,
4123
4400
  tertiaryCriticalVariantStyles,
@@ -4128,6 +4405,7 @@ var Button = (_a) => {
4128
4405
  const labelClasses = (0, import_clsx17.default)(
4129
4406
  "min-h-6 flex items-center justify-center",
4130
4407
  classNameLabel,
4408
+ fontNormal && "font-normal!",
4131
4409
  componentPaddingXUsingComponentGap,
4132
4410
  typography.buttonLabel
4133
4411
  );
@@ -5233,7 +5511,8 @@ var ModalHeader = ({
5233
5511
  id,
5234
5512
  "data-testid": testid,
5235
5513
  className: (0, import_clsx25.default)(
5236
- "flex justify-between items-center",
5514
+ "flex items-center",
5515
+ headerIconAlign === void 0 && "justify-between",
5237
5516
  headerIconAlign === "center" && "justify-center",
5238
5517
  headerIconAlign === "right" && "justify-end",
5239
5518
  headerIconAlign === "left" && "justify-start",
@@ -6064,7 +6343,7 @@ var import_react39 = require("react");
6064
6343
  var import_jsx_runtime65 = require("react/jsx-runtime");
6065
6344
 
6066
6345
  // src/components/EmblaCarousel/index.tsx
6067
- var import_react42 = require("react");
6346
+ var import_react42 = __toESM(require("react"), 1);
6068
6347
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
6069
6348
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
6070
6349