@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
@@ -448,6 +448,9 @@ var useMatchesMedia = (query) => {
448
448
  };
449
449
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
450
450
 
451
+ // src/hooks/useTableLayout/useTableLayout.ts
452
+ var import_react5 = require("react");
453
+
451
454
  // src/utils/formatting.tsx
452
455
  function getDecimalPlaceholder(decimals) {
453
456
  if (!decimals || decimals <= 0) {
@@ -579,30 +582,8 @@ function formatDate(date) {
579
582
  }
580
583
  }
581
584
 
582
- // src/utils/mergeObjectArrays.ts
583
- function mergeObjectArrays(arr1, arr2) {
584
- const arr2Map = /* @__PURE__ */ new Map();
585
- for (const item of arr2) {
586
- const id = item.id;
587
- if (id !== void 0) {
588
- arr2Map.set(id, item);
589
- }
590
- }
591
- return arr1.map((item1) => {
592
- const id = item1.id;
593
- if (id !== void 0 && arr2Map.has(id)) {
594
- const item2 = arr2Map.get(id);
595
- const meta1 = item1.meta;
596
- const meta2 = item2.meta;
597
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
598
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
599
- }
600
- return item1;
601
- });
602
- }
603
-
604
585
  // src/utils/index.ts
605
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
586
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
606
587
 
607
588
  // src/utils.ts
608
589
  function findDocumentRoot(element) {
@@ -627,74 +608,366 @@ function findDocumentRoot(element) {
627
608
  return window.document.body;
628
609
  }
629
610
 
630
- // src/hooks/useTableLayout.ts
631
- var import_react5 = require("react");
632
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
633
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
611
+ // src/hooks/useTableLayout/storage.ts
612
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
613
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
614
+ var CURRENT_SCHEMA_VERSION = 2;
615
+ function getStorageKey(key) {
616
+ return `${STORAGE_PREFIX}__${key}`;
617
+ }
618
+ function getLegacyStorageKey(key) {
619
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
620
+ }
621
+ function loadPreferences(key) {
622
+ const storageKey = getStorageKey(key);
623
+ const legacyKey = getLegacyStorageKey(key);
624
+ const newData = localStorage.getItem(storageKey);
625
+ if (newData) {
626
+ try {
627
+ const parsed = JSON.parse(newData);
628
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
629
+ return parsed;
630
+ }
631
+ localStorage.removeItem(storageKey);
632
+ } catch (e) {
633
+ localStorage.removeItem(storageKey);
634
+ }
635
+ }
636
+ const legacyData = localStorage.getItem(legacyKey);
637
+ if (legacyData) {
638
+ localStorage.removeItem(legacyKey);
639
+ }
640
+ return null;
641
+ }
642
+ function savePreferences(key, preferences) {
643
+ var _a, _b, _c, _d, _e, _f, _g;
644
+ const storageKey = getStorageKey(key);
645
+ 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;
646
+ if (!hasPreferences) {
647
+ localStorage.removeItem(storageKey);
648
+ return;
649
+ }
650
+ const data = __spreadProps(__spreadValues({}, preferences), {
651
+ version: CURRENT_SCHEMA_VERSION
652
+ });
653
+ localStorage.setItem(storageKey, JSON.stringify(data));
654
+ }
655
+ function clearPreferences(key) {
656
+ const storageKey = getStorageKey(key);
657
+ const legacyKey = getLegacyStorageKey(key);
658
+ localStorage.removeItem(storageKey);
659
+ localStorage.removeItem(legacyKey);
660
+ }
661
+ function clearAllLegacyData() {
662
+ if (typeof window === "undefined") return;
663
+ const keysToRemove = [];
664
+ for (let i = 0; i < localStorage.length; i++) {
665
+ const key = localStorage.key(i);
666
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
667
+ keysToRemove.push(key);
668
+ }
669
+ }
670
+ keysToRemove.forEach((key) => {
671
+ localStorage.removeItem(key);
672
+ });
673
+ }
674
+ function hasPerformedLegacyMigration() {
675
+ if (typeof window === "undefined") return true;
676
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
677
+ }
678
+ function markLegacyMigrationComplete() {
679
+ if (typeof window === "undefined") return;
680
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
681
+ }
682
+
683
+ // src/hooks/useTableLayout/computeColumns.ts
684
+ function computeColumnVisibility(column, preferences) {
685
+ var _a, _b, _c, _d, _e, _f;
686
+ const columnId = column.id;
687
+ if (!columnId) return true;
688
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
689
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
690
+ if (!canUserToggle) {
691
+ return systemVisible;
692
+ }
693
+ if (preferences) {
694
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
695
+ return false;
696
+ }
697
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
698
+ return true;
699
+ }
700
+ }
701
+ return systemVisible;
702
+ }
703
+ function applyPreferencesToColumns(systemColumns, preferences) {
704
+ var _a;
705
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
706
+ meta: __spreadProps(__spreadValues({}, col.meta), {
707
+ // Compute visibility based on system + user preferences
708
+ visible: computeColumnVisibility(col, preferences)
709
+ })
710
+ }));
711
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
712
+ const orderMap = new Map(
713
+ preferences.columnOrder.map((id, index) => [id, index])
714
+ );
715
+ columns = columns.sort((a, b) => {
716
+ var _a2, _b;
717
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
718
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
719
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
720
+ return 0;
721
+ }
722
+ return orderA - orderB;
723
+ });
724
+ }
725
+ if (preferences == null ? void 0 : preferences.columnWidths) {
726
+ columns = columns.map((col) => {
727
+ var _a2;
728
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
729
+ if (width !== void 0) {
730
+ return __spreadProps(__spreadValues({}, col), {
731
+ size: width
732
+ });
733
+ }
734
+ return col;
735
+ });
736
+ }
737
+ return columns;
738
+ }
739
+ function extractColumnOrder(columns) {
740
+ return columns.filter((c) => c.id).map((c) => c.id);
741
+ }
742
+ function extractVisibilityChanges(columns, systemColumns) {
743
+ const hiddenByUser = [];
744
+ const shownByUser = [];
745
+ columns.forEach((col) => {
746
+ var _a, _b, _c, _d, _e, _f, _g;
747
+ if (!col.id) return;
748
+ const systemCol = systemColumns.find((c) => c.id === col.id);
749
+ if (!systemCol) return;
750
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
751
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
752
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
753
+ if (!canToggle) return;
754
+ if (systemVisible && !currentVisible) {
755
+ hiddenByUser.push(col.id);
756
+ } else if (!systemVisible && currentVisible) {
757
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
758
+ shownByUser.push(col.id);
759
+ }
760
+ }
761
+ });
762
+ return { hiddenByUser, shownByUser };
763
+ }
764
+
765
+ // src/hooks/useTableLayout/useTableLayout.ts
766
+ var hasCleanedLegacyDataThisSession = false;
634
767
  function useTableLayout(initialColumns, key, autosync = true) {
635
- const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
768
+ const [preferences, setPreferences] = (0, import_react5.useState)(null);
769
+ const [columns, setColumnsState] = (0, import_react5.useState)(
770
+ () => (
771
+ // Initialize with system columns (no preferences applied yet)
772
+ initialColumns.map((col) => __spreadValues({}, col))
773
+ )
774
+ );
636
775
  const [isReady, setIsReady] = (0, import_react5.useState)(false);
637
- const isReadyRef = (0, import_react5.useRef)(false);
638
776
  const keyRef = (0, import_react5.useRef)(key);
777
+ const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
778
+ const preferencesRef = (0, import_react5.useRef)(preferences);
779
+ const autosyncRef = (0, import_react5.useRef)(autosync);
639
780
  (0, import_react5.useEffect)(() => {
640
- isReadyRef.current = isReady;
641
781
  keyRef.current = key;
642
- }, [isReady, key]);
643
- const handleSaveLayout = (0, import_react5.useCallback)(
644
- (setter, _internal) => {
645
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
646
- setColumns((prevColumns) => {
647
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
648
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
649
- return prevColumns;
650
- }
651
- localStorage.setItem(
652
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
653
- JSON.stringify(newColumns)
654
- );
655
- return newColumns;
656
- });
657
- },
658
- []
659
- );
782
+ }, [key]);
783
+ (0, import_react5.useEffect)(() => {
784
+ initialColumnsRef.current = initialColumns;
785
+ }, [initialColumns]);
786
+ (0, import_react5.useEffect)(() => {
787
+ preferencesRef.current = preferences;
788
+ }, [preferences]);
660
789
  (0, import_react5.useEffect)(() => {
661
- if (!autosync) return;
790
+ autosyncRef.current = autosync;
791
+ }, [autosync]);
792
+ (0, import_react5.useEffect)(() => {
793
+ if (typeof window === "undefined") return;
794
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
795
+ clearAllLegacyData();
796
+ markLegacyMigrationComplete();
797
+ hasCleanedLegacyDataThisSession = true;
798
+ }
799
+ }, []);
800
+ (0, import_react5.useEffect)(() => {
801
+ if (!autosync) {
802
+ setIsReady(true);
803
+ return;
804
+ }
662
805
  if (!key) {
663
806
  setIsReady(true);
664
807
  return;
665
808
  }
666
- const savedLayout = localStorage.getItem(
667
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
809
+ const savedPrefs = loadPreferences(key);
810
+ setPreferences(savedPrefs);
811
+ const computedColumns = applyPreferencesToColumns(
812
+ initialColumns,
813
+ savedPrefs
668
814
  );
669
- if (savedLayout) {
670
- setColumns(
671
- mergeObjectArrays(
672
- initialColumns,
673
- JSON.parse(savedLayout)
674
- )
675
- );
676
- } else {
677
- localStorage.setItem(
678
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
679
- JSON.stringify(initialColumns)
680
- );
681
- setColumns((prev) => {
682
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
683
- return prev;
684
- return initialColumns;
685
- });
686
- }
815
+ setColumnsState(computedColumns);
687
816
  setIsReady(true);
688
- }, [initialColumns, key, autosync]);
689
- const getSavedLayout = (0, import_react5.useCallback)(() => {
690
- const savedLayout = localStorage.getItem(
691
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
817
+ }, [key, autosync]);
818
+ (0, import_react5.useEffect)(() => {
819
+ if (!isReady) return;
820
+ const computedColumns = applyPreferencesToColumns(
821
+ initialColumns,
822
+ preferencesRef.current
692
823
  );
693
- if (savedLayout) {
694
- return JSON.parse(savedLayout);
695
- }
696
- }, [key]);
697
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
824
+ setColumnsState(computedColumns);
825
+ }, [initialColumns, isReady]);
826
+ const persistPreferences = (0, import_react5.useCallback)(
827
+ (newPrefs) => {
828
+ if (!keyRef.current) return;
829
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
830
+ version: 2
831
+ });
832
+ setPreferences(updated);
833
+ if (autosyncRef.current) {
834
+ savePreferences(keyRef.current, updated);
835
+ }
836
+ const computedColumns = applyPreferencesToColumns(
837
+ initialColumnsRef.current,
838
+ updated
839
+ );
840
+ setColumnsState(computedColumns);
841
+ },
842
+ []
843
+ );
844
+ const hideColumn = (0, import_react5.useCallback)(
845
+ (columnId) => {
846
+ var _a, _b;
847
+ const currentPrefs = preferencesRef.current;
848
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
849
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
850
+ const newShown = currentShown.filter((id) => id !== columnId);
851
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
852
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
853
+ hiddenByUser: newHidden,
854
+ shownByUser: newShown
855
+ }));
856
+ },
857
+ [persistPreferences]
858
+ );
859
+ const showColumn = (0, import_react5.useCallback)(
860
+ (columnId) => {
861
+ var _a, _b;
862
+ const currentPrefs = preferencesRef.current;
863
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
864
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
865
+ const newHidden = currentHidden.filter((id) => id !== columnId);
866
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
867
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
868
+ hiddenByUser: newHidden,
869
+ shownByUser: newShown
870
+ }));
871
+ },
872
+ [persistPreferences]
873
+ );
874
+ const reorderColumns = (0, import_react5.useCallback)(
875
+ (columnIds) => {
876
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
877
+ columnOrder: columnIds
878
+ }));
879
+ },
880
+ [persistPreferences]
881
+ );
882
+ const setColumnWidth = (0, import_react5.useCallback)(
883
+ (columnId, width) => {
884
+ var _a;
885
+ const currentPrefs = preferencesRef.current;
886
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
887
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
888
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
889
+ }));
890
+ },
891
+ [persistPreferences]
892
+ );
893
+ const resetToDefaults = (0, import_react5.useCallback)(() => {
894
+ if (!keyRef.current) return;
895
+ clearPreferences(keyRef.current);
896
+ setPreferences(null);
897
+ const computedColumns = applyPreferencesToColumns(
898
+ initialColumnsRef.current,
899
+ null
900
+ );
901
+ setColumnsState(computedColumns);
902
+ }, []);
903
+ const getUserPreferences = (0, import_react5.useCallback)(() => {
904
+ var _a;
905
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
906
+ }, []);
907
+ const getSavedLayout = (0, import_react5.useCallback)(() => {
908
+ return columns;
909
+ }, [columns]);
910
+ const setColumns = (0, import_react5.useCallback)(
911
+ (setter) => {
912
+ setColumnsState((prev) => {
913
+ var _a, _b, _c, _d;
914
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
915
+ const newOrder = extractColumnOrder(newColumns);
916
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
917
+ newColumns,
918
+ initialColumnsRef.current
919
+ );
920
+ const existingPrefs = preferencesRef.current;
921
+ const mergedHidden = Array.from(
922
+ /* @__PURE__ */ new Set([
923
+ ...hiddenByUser,
924
+ // Keep existing hidden prefs for columns that are still hidden
925
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
926
+ var _a2;
927
+ const col = newColumns.find((c) => c.id === id);
928
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
929
+ })) != null ? _b : []
930
+ ])
931
+ );
932
+ const mergedShown = Array.from(
933
+ /* @__PURE__ */ new Set([
934
+ ...shownByUser,
935
+ // Keep existing shown prefs for columns that are still visible
936
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
937
+ var _a2;
938
+ const col = newColumns.find((c) => c.id === id);
939
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
940
+ })) != null ? _d : []
941
+ ])
942
+ );
943
+ if (keyRef.current && autosync) {
944
+ const newPrefs = {
945
+ columnOrder: newOrder,
946
+ hiddenByUser: mergedHidden,
947
+ shownByUser: mergedShown,
948
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
949
+ version: 2
950
+ };
951
+ setPreferences(newPrefs);
952
+ savePreferences(keyRef.current, newPrefs);
953
+ }
954
+ return newColumns;
955
+ });
956
+ },
957
+ [autosync]
958
+ );
959
+ return {
960
+ columns,
961
+ setColumns,
962
+ isReady,
963
+ getSavedLayout,
964
+ hideColumn,
965
+ showColumn,
966
+ reorderColumns,
967
+ setColumnWidth,
968
+ resetToDefaults,
969
+ getUserPreferences
970
+ };
698
971
  }
699
972
 
700
973
  // src/hooks/useEditCell.tsx
@@ -3290,7 +3563,8 @@ function DataGrid({
3290
3563
  const {
3291
3564
  columns: tableColumns,
3292
3565
  setColumns: setTableColumns,
3293
- getSavedLayout
3566
+ getSavedLayout,
3567
+ resetToDefaults
3294
3568
  } = useTableLayout(columns, id != null ? id : testid);
3295
3569
  const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
3296
3570
  tableColumns.map((c) => c.id)
@@ -3318,21 +3592,8 @@ function DataGrid({
3318
3592
  [tableColumns]
3319
3593
  );
3320
3594
  const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
3321
- setTableColumns((prev) => {
3322
- columns.forEach((column) => {
3323
- var _a2, _b2;
3324
- const columnId = column.id;
3325
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
3326
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3327
- if (persistedIndex !== -1) {
3328
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3329
- visible: isVisible
3330
- });
3331
- }
3332
- });
3333
- return [...prev];
3334
- }, true);
3335
- }, [columns, setTableColumns]);
3595
+ resetToDefaults();
3596
+ }, [resetToDefaults]);
3336
3597
  (0, import_react17.useEffect)(() => {
3337
3598
  updateColumnVisibility(true);
3338
3599
  }, [updateColumnVisibility]);
@@ -3368,14 +3629,18 @@ function DataGrid({
3368
3629
  const toggleColumnVisibility = (0, import_react17.useCallback)(
3369
3630
  (columnId, isVisible) => {
3370
3631
  setTableColumns((prev) => {
3371
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3372
- if (persistedIndex !== -1) {
3373
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3374
- visible: isVisible
3375
- });
3376
- }
3377
- return [...prev];
3378
- }, true);
3632
+ const newColumns = prev.map((col) => {
3633
+ if (col.id === columnId) {
3634
+ return __spreadProps(__spreadValues({}, col), {
3635
+ meta: __spreadProps(__spreadValues({}, col.meta), {
3636
+ visible: isVisible
3637
+ })
3638
+ });
3639
+ }
3640
+ return col;
3641
+ });
3642
+ return newColumns;
3643
+ });
3379
3644
  },
3380
3645
  [setTableColumns]
3381
3646
  );
@@ -4147,7 +4412,8 @@ var Button = (_a) => {
4147
4412
  href,
4148
4413
  id,
4149
4414
  testid,
4150
- isLoading
4415
+ isLoading,
4416
+ fontNormal = false
4151
4417
  } = _b, props = __objRest(_b, [
4152
4418
  "variant",
4153
4419
  "as",
@@ -4163,7 +4429,8 @@ var Button = (_a) => {
4163
4429
  "href",
4164
4430
  "id",
4165
4431
  "testid",
4166
- "isLoading"
4432
+ "isLoading",
4433
+ "fontNormal"
4167
4434
  ]);
4168
4435
  const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
4169
4436
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -4190,6 +4457,15 @@ var Button = (_a) => {
4190
4457
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
4191
4458
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4192
4459
  );
4460
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
4461
+ "bg-transparent border-transparent",
4462
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
4463
+ "bg-transparent border-transparent",
4464
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
4465
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
4466
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
4467
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4468
+ );
4193
4469
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
4194
4470
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
4195
4471
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -4233,6 +4509,7 @@ var Button = (_a) => {
4233
4509
  primaryVariantStyles,
4234
4510
  secondaryVariantStyles,
4235
4511
  tertiaryVariantStyles,
4512
+ quarternaryOutlinedVariantStyles,
4236
4513
  primaryCriticalVariantStyles,
4237
4514
  secondaryCriticalVariantStyles,
4238
4515
  tertiaryCriticalVariantStyles,
@@ -4243,6 +4520,7 @@ var Button = (_a) => {
4243
4520
  const labelClasses = (0, import_clsx18.default)(
4244
4521
  "min-h-6 flex items-center justify-center",
4245
4522
  classNameLabel,
4523
+ fontNormal && "font-normal!",
4246
4524
  componentPaddingXUsingComponentGap,
4247
4525
  typography.buttonLabel
4248
4526
  );
@@ -4883,7 +5161,8 @@ var ModalHeader = ({
4883
5161
  id,
4884
5162
  "data-testid": testid,
4885
5163
  className: (0, import_clsx25.default)(
4886
- "flex justify-between items-center",
5164
+ "flex items-center",
5165
+ headerIconAlign === void 0 && "justify-between",
4887
5166
  headerIconAlign === "center" && "justify-center",
4888
5167
  headerIconAlign === "right" && "justify-end",
4889
5168
  headerIconAlign === "left" && "justify-start",
@@ -5714,7 +5993,7 @@ var import_react39 = require("react");
5714
5993
  var import_jsx_runtime65 = require("react/jsx-runtime");
5715
5994
 
5716
5995
  // src/components/EmblaCarousel/index.tsx
5717
- var import_react42 = require("react");
5996
+ var import_react42 = __toESM(require("react"), 1);
5718
5997
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
5719
5998
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
5720
5999