@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
@@ -476,6 +476,9 @@ var useMatchesMedia = (query) => {
476
476
  };
477
477
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
478
478
 
479
+ // src/hooks/useTableLayout/useTableLayout.ts
480
+ var import_react5 = require("react");
481
+
479
482
  // src/utils/formatting.tsx
480
483
  function getDecimalPlaceholder(decimals) {
481
484
  if (!decimals || decimals <= 0) {
@@ -607,30 +610,8 @@ function formatDate(date) {
607
610
  }
608
611
  }
609
612
 
610
- // src/utils/mergeObjectArrays.ts
611
- function mergeObjectArrays(arr1, arr2) {
612
- const arr2Map = /* @__PURE__ */ new Map();
613
- for (const item of arr2) {
614
- const id = item.id;
615
- if (id !== void 0) {
616
- arr2Map.set(id, item);
617
- }
618
- }
619
- return arr1.map((item1) => {
620
- const id = item1.id;
621
- if (id !== void 0 && arr2Map.has(id)) {
622
- const item2 = arr2Map.get(id);
623
- const meta1 = item1.meta;
624
- const meta2 = item2.meta;
625
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
626
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
627
- }
628
- return item1;
629
- });
630
- }
631
-
632
613
  // src/utils/index.ts
633
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
614
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
634
615
 
635
616
  // src/utils.ts
636
617
  function findDocumentRoot(element) {
@@ -655,74 +636,366 @@ function findDocumentRoot(element) {
655
636
  return window.document.body;
656
637
  }
657
638
 
658
- // src/hooks/useTableLayout.ts
659
- var import_react5 = require("react");
660
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
661
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
639
+ // src/hooks/useTableLayout/storage.ts
640
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
641
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
642
+ var CURRENT_SCHEMA_VERSION = 2;
643
+ function getStorageKey(key) {
644
+ return `${STORAGE_PREFIX}__${key}`;
645
+ }
646
+ function getLegacyStorageKey(key) {
647
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
648
+ }
649
+ function loadPreferences(key) {
650
+ const storageKey = getStorageKey(key);
651
+ const legacyKey = getLegacyStorageKey(key);
652
+ const newData = localStorage.getItem(storageKey);
653
+ if (newData) {
654
+ try {
655
+ const parsed = JSON.parse(newData);
656
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
657
+ return parsed;
658
+ }
659
+ localStorage.removeItem(storageKey);
660
+ } catch (e) {
661
+ localStorage.removeItem(storageKey);
662
+ }
663
+ }
664
+ const legacyData = localStorage.getItem(legacyKey);
665
+ if (legacyData) {
666
+ localStorage.removeItem(legacyKey);
667
+ }
668
+ return null;
669
+ }
670
+ function savePreferences(key, preferences) {
671
+ var _a, _b, _c, _d, _e, _f, _g;
672
+ const storageKey = getStorageKey(key);
673
+ 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;
674
+ if (!hasPreferences) {
675
+ localStorage.removeItem(storageKey);
676
+ return;
677
+ }
678
+ const data = __spreadProps(__spreadValues({}, preferences), {
679
+ version: CURRENT_SCHEMA_VERSION
680
+ });
681
+ localStorage.setItem(storageKey, JSON.stringify(data));
682
+ }
683
+ function clearPreferences(key) {
684
+ const storageKey = getStorageKey(key);
685
+ const legacyKey = getLegacyStorageKey(key);
686
+ localStorage.removeItem(storageKey);
687
+ localStorage.removeItem(legacyKey);
688
+ }
689
+ function clearAllLegacyData() {
690
+ if (typeof window === "undefined") return;
691
+ const keysToRemove = [];
692
+ for (let i = 0; i < localStorage.length; i++) {
693
+ const key = localStorage.key(i);
694
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
695
+ keysToRemove.push(key);
696
+ }
697
+ }
698
+ keysToRemove.forEach((key) => {
699
+ localStorage.removeItem(key);
700
+ });
701
+ }
702
+ function hasPerformedLegacyMigration() {
703
+ if (typeof window === "undefined") return true;
704
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
705
+ }
706
+ function markLegacyMigrationComplete() {
707
+ if (typeof window === "undefined") return;
708
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
709
+ }
710
+
711
+ // src/hooks/useTableLayout/computeColumns.ts
712
+ function computeColumnVisibility(column, preferences) {
713
+ var _a, _b, _c, _d, _e, _f;
714
+ const columnId = column.id;
715
+ if (!columnId) return true;
716
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
717
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
718
+ if (!canUserToggle) {
719
+ return systemVisible;
720
+ }
721
+ if (preferences) {
722
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
723
+ return false;
724
+ }
725
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
726
+ return true;
727
+ }
728
+ }
729
+ return systemVisible;
730
+ }
731
+ function applyPreferencesToColumns(systemColumns, preferences) {
732
+ var _a;
733
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
734
+ meta: __spreadProps(__spreadValues({}, col.meta), {
735
+ // Compute visibility based on system + user preferences
736
+ visible: computeColumnVisibility(col, preferences)
737
+ })
738
+ }));
739
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
740
+ const orderMap = new Map(
741
+ preferences.columnOrder.map((id, index) => [id, index])
742
+ );
743
+ columns = columns.sort((a, b) => {
744
+ var _a2, _b;
745
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
746
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
747
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
748
+ return 0;
749
+ }
750
+ return orderA - orderB;
751
+ });
752
+ }
753
+ if (preferences == null ? void 0 : preferences.columnWidths) {
754
+ columns = columns.map((col) => {
755
+ var _a2;
756
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
757
+ if (width !== void 0) {
758
+ return __spreadProps(__spreadValues({}, col), {
759
+ size: width
760
+ });
761
+ }
762
+ return col;
763
+ });
764
+ }
765
+ return columns;
766
+ }
767
+ function extractColumnOrder(columns) {
768
+ return columns.filter((c) => c.id).map((c) => c.id);
769
+ }
770
+ function extractVisibilityChanges(columns, systemColumns) {
771
+ const hiddenByUser = [];
772
+ const shownByUser = [];
773
+ columns.forEach((col) => {
774
+ var _a, _b, _c, _d, _e, _f, _g;
775
+ if (!col.id) return;
776
+ const systemCol = systemColumns.find((c) => c.id === col.id);
777
+ if (!systemCol) return;
778
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
779
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
780
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
781
+ if (!canToggle) return;
782
+ if (systemVisible && !currentVisible) {
783
+ hiddenByUser.push(col.id);
784
+ } else if (!systemVisible && currentVisible) {
785
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
786
+ shownByUser.push(col.id);
787
+ }
788
+ }
789
+ });
790
+ return { hiddenByUser, shownByUser };
791
+ }
792
+
793
+ // src/hooks/useTableLayout/useTableLayout.ts
794
+ var hasCleanedLegacyDataThisSession = false;
662
795
  function useTableLayout(initialColumns, key, autosync = true) {
663
- const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
796
+ const [preferences, setPreferences] = (0, import_react5.useState)(null);
797
+ const [columns, setColumnsState] = (0, import_react5.useState)(
798
+ () => (
799
+ // Initialize with system columns (no preferences applied yet)
800
+ initialColumns.map((col) => __spreadValues({}, col))
801
+ )
802
+ );
664
803
  const [isReady, setIsReady] = (0, import_react5.useState)(false);
665
- const isReadyRef = (0, import_react5.useRef)(false);
666
804
  const keyRef = (0, import_react5.useRef)(key);
805
+ const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
806
+ const preferencesRef = (0, import_react5.useRef)(preferences);
807
+ const autosyncRef = (0, import_react5.useRef)(autosync);
667
808
  (0, import_react5.useEffect)(() => {
668
- isReadyRef.current = isReady;
669
809
  keyRef.current = key;
670
- }, [isReady, key]);
671
- const handleSaveLayout = (0, import_react5.useCallback)(
672
- (setter, _internal) => {
673
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
674
- setColumns((prevColumns) => {
675
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
676
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
677
- return prevColumns;
678
- }
679
- localStorage.setItem(
680
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
681
- JSON.stringify(newColumns)
682
- );
683
- return newColumns;
684
- });
685
- },
686
- []
687
- );
810
+ }, [key]);
811
+ (0, import_react5.useEffect)(() => {
812
+ initialColumnsRef.current = initialColumns;
813
+ }, [initialColumns]);
814
+ (0, import_react5.useEffect)(() => {
815
+ preferencesRef.current = preferences;
816
+ }, [preferences]);
688
817
  (0, import_react5.useEffect)(() => {
689
- if (!autosync) return;
818
+ autosyncRef.current = autosync;
819
+ }, [autosync]);
820
+ (0, import_react5.useEffect)(() => {
821
+ if (typeof window === "undefined") return;
822
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
823
+ clearAllLegacyData();
824
+ markLegacyMigrationComplete();
825
+ hasCleanedLegacyDataThisSession = true;
826
+ }
827
+ }, []);
828
+ (0, import_react5.useEffect)(() => {
829
+ if (!autosync) {
830
+ setIsReady(true);
831
+ return;
832
+ }
690
833
  if (!key) {
691
834
  setIsReady(true);
692
835
  return;
693
836
  }
694
- const savedLayout = localStorage.getItem(
695
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
837
+ const savedPrefs = loadPreferences(key);
838
+ setPreferences(savedPrefs);
839
+ const computedColumns = applyPreferencesToColumns(
840
+ initialColumns,
841
+ savedPrefs
696
842
  );
697
- if (savedLayout) {
698
- setColumns(
699
- mergeObjectArrays(
700
- initialColumns,
701
- JSON.parse(savedLayout)
702
- )
703
- );
704
- } else {
705
- localStorage.setItem(
706
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
707
- JSON.stringify(initialColumns)
708
- );
709
- setColumns((prev) => {
710
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
711
- return prev;
712
- return initialColumns;
713
- });
714
- }
843
+ setColumnsState(computedColumns);
715
844
  setIsReady(true);
716
- }, [initialColumns, key, autosync]);
717
- const getSavedLayout = (0, import_react5.useCallback)(() => {
718
- const savedLayout = localStorage.getItem(
719
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
845
+ }, [key, autosync]);
846
+ (0, import_react5.useEffect)(() => {
847
+ if (!isReady) return;
848
+ const computedColumns = applyPreferencesToColumns(
849
+ initialColumns,
850
+ preferencesRef.current
720
851
  );
721
- if (savedLayout) {
722
- return JSON.parse(savedLayout);
723
- }
724
- }, [key]);
725
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
852
+ setColumnsState(computedColumns);
853
+ }, [initialColumns, isReady]);
854
+ const persistPreferences = (0, import_react5.useCallback)(
855
+ (newPrefs) => {
856
+ if (!keyRef.current) return;
857
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
858
+ version: 2
859
+ });
860
+ setPreferences(updated);
861
+ if (autosyncRef.current) {
862
+ savePreferences(keyRef.current, updated);
863
+ }
864
+ const computedColumns = applyPreferencesToColumns(
865
+ initialColumnsRef.current,
866
+ updated
867
+ );
868
+ setColumnsState(computedColumns);
869
+ },
870
+ []
871
+ );
872
+ const hideColumn = (0, import_react5.useCallback)(
873
+ (columnId) => {
874
+ var _a, _b;
875
+ const currentPrefs = preferencesRef.current;
876
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
877
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
878
+ const newShown = currentShown.filter((id) => id !== columnId);
879
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
880
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
881
+ hiddenByUser: newHidden,
882
+ shownByUser: newShown
883
+ }));
884
+ },
885
+ [persistPreferences]
886
+ );
887
+ const showColumn = (0, import_react5.useCallback)(
888
+ (columnId) => {
889
+ var _a, _b;
890
+ const currentPrefs = preferencesRef.current;
891
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
892
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
893
+ const newHidden = currentHidden.filter((id) => id !== columnId);
894
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
895
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
896
+ hiddenByUser: newHidden,
897
+ shownByUser: newShown
898
+ }));
899
+ },
900
+ [persistPreferences]
901
+ );
902
+ const reorderColumns = (0, import_react5.useCallback)(
903
+ (columnIds) => {
904
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
905
+ columnOrder: columnIds
906
+ }));
907
+ },
908
+ [persistPreferences]
909
+ );
910
+ const setColumnWidth = (0, import_react5.useCallback)(
911
+ (columnId, width) => {
912
+ var _a;
913
+ const currentPrefs = preferencesRef.current;
914
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
915
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
916
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
917
+ }));
918
+ },
919
+ [persistPreferences]
920
+ );
921
+ const resetToDefaults = (0, import_react5.useCallback)(() => {
922
+ if (!keyRef.current) return;
923
+ clearPreferences(keyRef.current);
924
+ setPreferences(null);
925
+ const computedColumns = applyPreferencesToColumns(
926
+ initialColumnsRef.current,
927
+ null
928
+ );
929
+ setColumnsState(computedColumns);
930
+ }, []);
931
+ const getUserPreferences = (0, import_react5.useCallback)(() => {
932
+ var _a;
933
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
934
+ }, []);
935
+ const getSavedLayout = (0, import_react5.useCallback)(() => {
936
+ return columns;
937
+ }, [columns]);
938
+ const setColumns = (0, import_react5.useCallback)(
939
+ (setter) => {
940
+ setColumnsState((prev) => {
941
+ var _a, _b, _c, _d;
942
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
943
+ const newOrder = extractColumnOrder(newColumns);
944
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
945
+ newColumns,
946
+ initialColumnsRef.current
947
+ );
948
+ const existingPrefs = preferencesRef.current;
949
+ const mergedHidden = Array.from(
950
+ /* @__PURE__ */ new Set([
951
+ ...hiddenByUser,
952
+ // Keep existing hidden prefs for columns that are still hidden
953
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
954
+ var _a2;
955
+ const col = newColumns.find((c) => c.id === id);
956
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
957
+ })) != null ? _b : []
958
+ ])
959
+ );
960
+ const mergedShown = Array.from(
961
+ /* @__PURE__ */ new Set([
962
+ ...shownByUser,
963
+ // Keep existing shown prefs for columns that are still visible
964
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
965
+ var _a2;
966
+ const col = newColumns.find((c) => c.id === id);
967
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
968
+ })) != null ? _d : []
969
+ ])
970
+ );
971
+ if (keyRef.current && autosync) {
972
+ const newPrefs = {
973
+ columnOrder: newOrder,
974
+ hiddenByUser: mergedHidden,
975
+ shownByUser: mergedShown,
976
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
977
+ version: 2
978
+ };
979
+ setPreferences(newPrefs);
980
+ savePreferences(keyRef.current, newPrefs);
981
+ }
982
+ return newColumns;
983
+ });
984
+ },
985
+ [autosync]
986
+ );
987
+ return {
988
+ columns,
989
+ setColumns,
990
+ isReady,
991
+ getSavedLayout,
992
+ hideColumn,
993
+ showColumn,
994
+ reorderColumns,
995
+ setColumnWidth,
996
+ resetToDefaults,
997
+ getUserPreferences
998
+ };
726
999
  }
727
1000
 
728
1001
  // src/hooks/useEditCell.tsx
@@ -3318,7 +3591,8 @@ function DataGrid({
3318
3591
  const {
3319
3592
  columns: tableColumns,
3320
3593
  setColumns: setTableColumns,
3321
- getSavedLayout
3594
+ getSavedLayout,
3595
+ resetToDefaults
3322
3596
  } = useTableLayout(columns, id != null ? id : testid);
3323
3597
  const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
3324
3598
  tableColumns.map((c) => c.id)
@@ -3346,21 +3620,8 @@ function DataGrid({
3346
3620
  [tableColumns]
3347
3621
  );
3348
3622
  const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
3349
- setTableColumns((prev) => {
3350
- columns.forEach((column) => {
3351
- var _a2, _b2;
3352
- const columnId = column.id;
3353
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
3354
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3355
- if (persistedIndex !== -1) {
3356
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3357
- visible: isVisible
3358
- });
3359
- }
3360
- });
3361
- return [...prev];
3362
- }, true);
3363
- }, [columns, setTableColumns]);
3623
+ resetToDefaults();
3624
+ }, [resetToDefaults]);
3364
3625
  (0, import_react17.useEffect)(() => {
3365
3626
  updateColumnVisibility(true);
3366
3627
  }, [updateColumnVisibility]);
@@ -3396,14 +3657,18 @@ function DataGrid({
3396
3657
  const toggleColumnVisibility = (0, import_react17.useCallback)(
3397
3658
  (columnId, isVisible) => {
3398
3659
  setTableColumns((prev) => {
3399
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3400
- if (persistedIndex !== -1) {
3401
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3402
- visible: isVisible
3403
- });
3404
- }
3405
- return [...prev];
3406
- }, true);
3660
+ const newColumns = prev.map((col) => {
3661
+ if (col.id === columnId) {
3662
+ return __spreadProps(__spreadValues({}, col), {
3663
+ meta: __spreadProps(__spreadValues({}, col.meta), {
3664
+ visible: isVisible
3665
+ })
3666
+ });
3667
+ }
3668
+ return col;
3669
+ });
3670
+ return newColumns;
3671
+ });
3407
3672
  },
3408
3673
  [setTableColumns]
3409
3674
  );
@@ -4175,7 +4440,8 @@ var Button = (_a) => {
4175
4440
  href,
4176
4441
  id,
4177
4442
  testid,
4178
- isLoading
4443
+ isLoading,
4444
+ fontNormal = false
4179
4445
  } = _b, props = __objRest(_b, [
4180
4446
  "variant",
4181
4447
  "as",
@@ -4191,7 +4457,8 @@ var Button = (_a) => {
4191
4457
  "href",
4192
4458
  "id",
4193
4459
  "testid",
4194
- "isLoading"
4460
+ "isLoading",
4461
+ "fontNormal"
4195
4462
  ]);
4196
4463
  const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
4197
4464
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -4218,6 +4485,15 @@ var Button = (_a) => {
4218
4485
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
4219
4486
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4220
4487
  );
4488
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
4489
+ "bg-transparent border-transparent",
4490
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
4491
+ "bg-transparent border-transparent",
4492
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
4493
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
4494
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
4495
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4496
+ );
4221
4497
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
4222
4498
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
4223
4499
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -4261,6 +4537,7 @@ var Button = (_a) => {
4261
4537
  primaryVariantStyles,
4262
4538
  secondaryVariantStyles,
4263
4539
  tertiaryVariantStyles,
4540
+ quarternaryOutlinedVariantStyles,
4264
4541
  primaryCriticalVariantStyles,
4265
4542
  secondaryCriticalVariantStyles,
4266
4543
  tertiaryCriticalVariantStyles,
@@ -4271,6 +4548,7 @@ var Button = (_a) => {
4271
4548
  const labelClasses = (0, import_clsx18.default)(
4272
4549
  "min-h-6 flex items-center justify-center",
4273
4550
  classNameLabel,
4551
+ fontNormal && "font-normal!",
4274
4552
  componentPaddingXUsingComponentGap,
4275
4553
  typography.buttonLabel
4276
4554
  );
@@ -6066,7 +6344,8 @@ var ModalHeader = ({
6066
6344
  id,
6067
6345
  "data-testid": testid,
6068
6346
  className: (0, import_clsx26.default)(
6069
- "flex justify-between items-center",
6347
+ "flex items-center",
6348
+ headerIconAlign === void 0 && "justify-between",
6070
6349
  headerIconAlign === "center" && "justify-center",
6071
6350
  headerIconAlign === "right" && "justify-end",
6072
6351
  headerIconAlign === "left" && "justify-start",
@@ -6590,7 +6869,7 @@ function RowDetailModalProvider() {
6590
6869
  iconOnly: true,
6591
6870
  variant: "tertiary",
6592
6871
  onClick: closeRowDetail,
6593
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: "x", size: 24 }) })
6872
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: "close", size: 24 }) })
6594
6873
  }
6595
6874
  )
6596
6875
  ]
@@ -8660,7 +8939,7 @@ function AccessCardGroup(props) {
8660
8939
  }
8661
8940
 
8662
8941
  // src/components/EmblaCarousel/index.tsx
8663
- var import_react43 = require("react");
8942
+ var import_react43 = __toESM(require("react"), 1);
8664
8943
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
8665
8944
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
8666
8945
 
@@ -8681,7 +8960,7 @@ var useSelectedSnapDisplay = (emblaApi) => {
8681
8960
  const [selectedSnap, setSelectedSnap] = (0, import_react41.useState)(0);
8682
8961
  const [snapCount, setSnapCount] = (0, import_react41.useState)(0);
8683
8962
  const updateScrollSnapState = (0, import_react41.useCallback)((emblaApi2) => {
8684
- setSnapCount(emblaApi2.slideNodes().length);
8963
+ setSnapCount(emblaApi2.snapList().length);
8685
8964
  setSelectedSnap(emblaApi2.selectedSnap());
8686
8965
  }, []);
8687
8966
  (0, import_react41.useEffect)(() => {
@@ -8826,6 +9105,26 @@ var EmblaCarousel = ({
8826
9105
  options,
8827
9106
  autoplay ? [autoplayPlugin] : []
8828
9107
  );
9108
+ const emblaRootRef = (0, import_react43.useRef)(null);
9109
+ const [emblaHeight, setEmblaHeight] = import_react43.default.useState(
9110
+ void 0
9111
+ );
9112
+ (0, import_react43.useEffect)(() => {
9113
+ if (!emblaApi || !leftRightChevrons) return;
9114
+ const updateHeight = () => {
9115
+ const selectedIndex = emblaApi.selectedSnap();
9116
+ const slide = emblaApi.slideNodes()[selectedIndex];
9117
+ if (slide && emblaRootRef.current) {
9118
+ setEmblaHeight(slide.offsetHeight);
9119
+ }
9120
+ };
9121
+ updateHeight();
9122
+ emblaApi.on("select", updateHeight).on("reinit", updateHeight);
9123
+ return () => {
9124
+ emblaApi.off("select", updateHeight);
9125
+ emblaApi.off("reinit", updateHeight);
9126
+ };
9127
+ }, [emblaApi, leftRightChevrons]);
8829
9128
  (0, import_react43.useEffect)(() => {
8830
9129
  var _a, _b;
8831
9130
  if (!emblaApi || !autoplay) return;
@@ -8899,72 +9198,81 @@ var EmblaCarousel = ({
8899
9198
  onNextButtonClick();
8900
9199
  (_b = (_a = emblaApi == null ? void 0 : emblaApi.plugins()) == null ? void 0 : _a.autoplay) == null ? void 0 : _b.reset();
8901
9200
  };
8902
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { className: "w-full m-auto grid gap-4 relative", "data-testid": testid, children: [
8903
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "embla__viewport overflow-hidden", ref: emblaRef, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8904
- "div",
8905
- {
8906
- className: (0, import_clsx45.default)(
8907
- "embla__container flex touch-pan-y touch-pinch-zoom",
8908
- !leftRightChevrons && "pb-3"
8909
- ),
8910
- children
8911
- }
8912
- ) }),
8913
- !leftRightChevrons ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "justify-between hidden desktop:flex", children: [
8914
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center gap-2", children: [
8915
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8916
- PrevButton,
8917
- {
8918
- circleChevron: true,
8919
- onClick: handlePrev,
8920
- disabled: prevBtnDisabled
8921
- }
8922
- ),
8923
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8924
- NextButton,
9201
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
9202
+ "section",
9203
+ {
9204
+ className: "w-full m-auto grid gap-4 relative",
9205
+ "data-testid": testid,
9206
+ ref: leftRightChevrons ? emblaRootRef : void 0,
9207
+ style: leftRightChevrons && emblaHeight ? { height: emblaHeight, transition: "height 0.3s ease" } : void 0,
9208
+ children: [
9209
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "embla__viewport overflow-hidden", ref: emblaRef, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9210
+ "div",
8925
9211
  {
8926
- circleChevron: true,
8927
- onClick: handleNext,
8928
- disabled: nextBtnDisabled
9212
+ className: (0, import_clsx45.default)(
9213
+ "embla__container flex touch-pan-y touch-pinch-zoom",
9214
+ !leftRightChevrons && "desktop:pb-3 gap-2"
9215
+ ),
9216
+ children
8929
9217
  }
8930
- )
8931
- ] }),
8932
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8933
- SelectedSnapDisplay,
8934
- {
8935
- selectedSnap,
8936
- snapCount
8937
- }
8938
- )
8939
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
8940
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8941
- PrevButton,
8942
- {
8943
- className: "absolute top-1/2 -translate-y-1/2 left-0 border-transparent! size-10! desktop:size-12!",
8944
- iconClassName: (0, import_clsx45.default)(
8945
- "size-6! desktop:size-8!",
8946
- chevronThemeColor && "text-text-link-normal group-hover:text-text-link-hover group-active:text-text-link-active",
8947
- !chevronThemeColor && "text-white group-hover:text-text-link-normal group-active:text-text-link-active"
8948
- ),
8949
- onClick: handlePrev,
8950
- disabled: prevBtnDisabled
8951
- }
8952
- ),
8953
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8954
- NextButton,
8955
- {
8956
- className: "absolute top-1/2 -translate-y-1/2 right-0 border-transparent! size-10! desktop:size-12!",
8957
- iconClassName: (0, import_clsx45.default)(
8958
- "size-6! desktop:size-8!",
8959
- chevronThemeColor && "text-text-link-normal group-hover:text-text-link-hover group-active:text-text-link-active",
8960
- !chevronThemeColor && "text-white group-hover:text-text-link-normal group-active:text-text-link-active"
9218
+ ) }),
9219
+ !leftRightChevrons ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "justify-between hidden desktop:flex", children: [
9220
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center gap-2", children: [
9221
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9222
+ PrevButton,
9223
+ {
9224
+ circleChevron: true,
9225
+ onClick: handlePrev,
9226
+ disabled: prevBtnDisabled
9227
+ }
9228
+ ),
9229
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9230
+ NextButton,
9231
+ {
9232
+ circleChevron: true,
9233
+ onClick: handleNext,
9234
+ disabled: nextBtnDisabled
9235
+ }
9236
+ )
9237
+ ] }),
9238
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9239
+ SelectedSnapDisplay,
9240
+ {
9241
+ selectedSnap,
9242
+ snapCount
9243
+ }
9244
+ )
9245
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
9246
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9247
+ PrevButton,
9248
+ {
9249
+ className: "absolute top-1/2 -translate-y-1/2 left-0 border-transparent! size-10! desktop:size-12!",
9250
+ iconClassName: (0, import_clsx45.default)(
9251
+ "size-6! desktop:size-8!",
9252
+ chevronThemeColor && "text-text-link-normal group-hover:text-text-link-hover group-active:text-text-link-active",
9253
+ !chevronThemeColor && "text-white group-hover:text-text-link-normal group-active:text-text-link-active"
9254
+ ),
9255
+ onClick: handlePrev,
9256
+ disabled: prevBtnDisabled
9257
+ }
8961
9258
  ),
8962
- onClick: handleNext,
8963
- disabled: nextBtnDisabled
8964
- }
8965
- )
8966
- ] })
8967
- ] });
9259
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
9260
+ NextButton,
9261
+ {
9262
+ className: "absolute top-1/2 -translate-y-1/2 right-0 border-transparent! size-10! desktop:size-12!",
9263
+ iconClassName: (0, import_clsx45.default)(
9264
+ "size-6! desktop:size-8!",
9265
+ chevronThemeColor && "text-text-link-normal group-hover:text-text-link-hover group-active:text-text-link-active",
9266
+ !chevronThemeColor && "text-white group-hover:text-text-link-normal group-active:text-text-link-active"
9267
+ ),
9268
+ onClick: handleNext,
9269
+ disabled: nextBtnDisabled
9270
+ }
9271
+ )
9272
+ ] })
9273
+ ]
9274
+ }
9275
+ );
8968
9276
  };
8969
9277
  // Annotate the CommonJS export names for ESM import in node:
8970
9278
  0 && (module.exports = {