@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
@@ -873,6 +873,9 @@ var useMatchesMedia = (query) => {
873
873
  };
874
874
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
875
875
 
876
+ // src/hooks/useTableLayout/useTableLayout.ts
877
+ var import_react5 = require("react");
878
+
876
879
  // src/utils/formatting.tsx
877
880
  function getDecimalPlaceholder(decimals) {
878
881
  if (!decimals || decimals <= 0) {
@@ -1004,30 +1007,8 @@ function formatDate(date) {
1004
1007
  }
1005
1008
  }
1006
1009
 
1007
- // src/utils/mergeObjectArrays.ts
1008
- function mergeObjectArrays(arr1, arr2) {
1009
- const arr2Map = /* @__PURE__ */ new Map();
1010
- for (const item of arr2) {
1011
- const id = item.id;
1012
- if (id !== void 0) {
1013
- arr2Map.set(id, item);
1014
- }
1015
- }
1016
- return arr1.map((item1) => {
1017
- const id = item1.id;
1018
- if (id !== void 0 && arr2Map.has(id)) {
1019
- const item2 = arr2Map.get(id);
1020
- const meta1 = item1.meta;
1021
- const meta2 = item2.meta;
1022
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
1023
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
1024
- }
1025
- return item1;
1026
- });
1027
- }
1028
-
1029
1010
  // src/utils/index.ts
1030
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
1011
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
1031
1012
 
1032
1013
  // src/utils.ts
1033
1014
  function findDocumentRoot(element) {
@@ -1052,74 +1033,366 @@ function findDocumentRoot(element) {
1052
1033
  return window.document.body;
1053
1034
  }
1054
1035
 
1055
- // src/hooks/useTableLayout.ts
1056
- var import_react5 = require("react");
1057
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
1058
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
1036
+ // src/hooks/useTableLayout/storage.ts
1037
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
1038
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
1039
+ var CURRENT_SCHEMA_VERSION = 2;
1040
+ function getStorageKey(key) {
1041
+ return `${STORAGE_PREFIX}__${key}`;
1042
+ }
1043
+ function getLegacyStorageKey(key) {
1044
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
1045
+ }
1046
+ function loadPreferences(key) {
1047
+ const storageKey = getStorageKey(key);
1048
+ const legacyKey = getLegacyStorageKey(key);
1049
+ const newData = localStorage.getItem(storageKey);
1050
+ if (newData) {
1051
+ try {
1052
+ const parsed = JSON.parse(newData);
1053
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
1054
+ return parsed;
1055
+ }
1056
+ localStorage.removeItem(storageKey);
1057
+ } catch (e) {
1058
+ localStorage.removeItem(storageKey);
1059
+ }
1060
+ }
1061
+ const legacyData = localStorage.getItem(legacyKey);
1062
+ if (legacyData) {
1063
+ localStorage.removeItem(legacyKey);
1064
+ }
1065
+ return null;
1066
+ }
1067
+ function savePreferences(key, preferences) {
1068
+ var _a, _b, _c, _d, _e, _f, _g;
1069
+ const storageKey = getStorageKey(key);
1070
+ 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;
1071
+ if (!hasPreferences) {
1072
+ localStorage.removeItem(storageKey);
1073
+ return;
1074
+ }
1075
+ const data = __spreadProps(__spreadValues({}, preferences), {
1076
+ version: CURRENT_SCHEMA_VERSION
1077
+ });
1078
+ localStorage.setItem(storageKey, JSON.stringify(data));
1079
+ }
1080
+ function clearPreferences(key) {
1081
+ const storageKey = getStorageKey(key);
1082
+ const legacyKey = getLegacyStorageKey(key);
1083
+ localStorage.removeItem(storageKey);
1084
+ localStorage.removeItem(legacyKey);
1085
+ }
1086
+ function clearAllLegacyData() {
1087
+ if (typeof window === "undefined") return;
1088
+ const keysToRemove = [];
1089
+ for (let i = 0; i < localStorage.length; i++) {
1090
+ const key = localStorage.key(i);
1091
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
1092
+ keysToRemove.push(key);
1093
+ }
1094
+ }
1095
+ keysToRemove.forEach((key) => {
1096
+ localStorage.removeItem(key);
1097
+ });
1098
+ }
1099
+ function hasPerformedLegacyMigration() {
1100
+ if (typeof window === "undefined") return true;
1101
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
1102
+ }
1103
+ function markLegacyMigrationComplete() {
1104
+ if (typeof window === "undefined") return;
1105
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
1106
+ }
1107
+
1108
+ // src/hooks/useTableLayout/computeColumns.ts
1109
+ function computeColumnVisibility(column, preferences) {
1110
+ var _a, _b, _c, _d, _e, _f;
1111
+ const columnId = column.id;
1112
+ if (!columnId) return true;
1113
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
1114
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
1115
+ if (!canUserToggle) {
1116
+ return systemVisible;
1117
+ }
1118
+ if (preferences) {
1119
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
1120
+ return false;
1121
+ }
1122
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
1123
+ return true;
1124
+ }
1125
+ }
1126
+ return systemVisible;
1127
+ }
1128
+ function applyPreferencesToColumns(systemColumns, preferences) {
1129
+ var _a;
1130
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
1131
+ meta: __spreadProps(__spreadValues({}, col.meta), {
1132
+ // Compute visibility based on system + user preferences
1133
+ visible: computeColumnVisibility(col, preferences)
1134
+ })
1135
+ }));
1136
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
1137
+ const orderMap = new Map(
1138
+ preferences.columnOrder.map((id, index) => [id, index])
1139
+ );
1140
+ columns = columns.sort((a, b) => {
1141
+ var _a2, _b;
1142
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
1143
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
1144
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
1145
+ return 0;
1146
+ }
1147
+ return orderA - orderB;
1148
+ });
1149
+ }
1150
+ if (preferences == null ? void 0 : preferences.columnWidths) {
1151
+ columns = columns.map((col) => {
1152
+ var _a2;
1153
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
1154
+ if (width !== void 0) {
1155
+ return __spreadProps(__spreadValues({}, col), {
1156
+ size: width
1157
+ });
1158
+ }
1159
+ return col;
1160
+ });
1161
+ }
1162
+ return columns;
1163
+ }
1164
+ function extractColumnOrder(columns) {
1165
+ return columns.filter((c) => c.id).map((c) => c.id);
1166
+ }
1167
+ function extractVisibilityChanges(columns, systemColumns) {
1168
+ const hiddenByUser = [];
1169
+ const shownByUser = [];
1170
+ columns.forEach((col) => {
1171
+ var _a, _b, _c, _d, _e, _f, _g;
1172
+ if (!col.id) return;
1173
+ const systemCol = systemColumns.find((c) => c.id === col.id);
1174
+ if (!systemCol) return;
1175
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
1176
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
1177
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
1178
+ if (!canToggle) return;
1179
+ if (systemVisible && !currentVisible) {
1180
+ hiddenByUser.push(col.id);
1181
+ } else if (!systemVisible && currentVisible) {
1182
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
1183
+ shownByUser.push(col.id);
1184
+ }
1185
+ }
1186
+ });
1187
+ return { hiddenByUser, shownByUser };
1188
+ }
1189
+
1190
+ // src/hooks/useTableLayout/useTableLayout.ts
1191
+ var hasCleanedLegacyDataThisSession = false;
1059
1192
  function useTableLayout(initialColumns, key, autosync = true) {
1060
- const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
1193
+ const [preferences, setPreferences] = (0, import_react5.useState)(null);
1194
+ const [columns, setColumnsState] = (0, import_react5.useState)(
1195
+ () => (
1196
+ // Initialize with system columns (no preferences applied yet)
1197
+ initialColumns.map((col) => __spreadValues({}, col))
1198
+ )
1199
+ );
1061
1200
  const [isReady, setIsReady] = (0, import_react5.useState)(false);
1062
- const isReadyRef = (0, import_react5.useRef)(false);
1063
1201
  const keyRef = (0, import_react5.useRef)(key);
1202
+ const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
1203
+ const preferencesRef = (0, import_react5.useRef)(preferences);
1204
+ const autosyncRef = (0, import_react5.useRef)(autosync);
1064
1205
  (0, import_react5.useEffect)(() => {
1065
- isReadyRef.current = isReady;
1066
1206
  keyRef.current = key;
1067
- }, [isReady, key]);
1068
- const handleSaveLayout = (0, import_react5.useCallback)(
1069
- (setter, _internal) => {
1070
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
1071
- setColumns((prevColumns) => {
1072
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
1073
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
1074
- return prevColumns;
1075
- }
1076
- localStorage.setItem(
1077
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
1078
- JSON.stringify(newColumns)
1079
- );
1080
- return newColumns;
1081
- });
1082
- },
1083
- []
1084
- );
1207
+ }, [key]);
1085
1208
  (0, import_react5.useEffect)(() => {
1086
- if (!autosync) return;
1209
+ initialColumnsRef.current = initialColumns;
1210
+ }, [initialColumns]);
1211
+ (0, import_react5.useEffect)(() => {
1212
+ preferencesRef.current = preferences;
1213
+ }, [preferences]);
1214
+ (0, import_react5.useEffect)(() => {
1215
+ autosyncRef.current = autosync;
1216
+ }, [autosync]);
1217
+ (0, import_react5.useEffect)(() => {
1218
+ if (typeof window === "undefined") return;
1219
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
1220
+ clearAllLegacyData();
1221
+ markLegacyMigrationComplete();
1222
+ hasCleanedLegacyDataThisSession = true;
1223
+ }
1224
+ }, []);
1225
+ (0, import_react5.useEffect)(() => {
1226
+ if (!autosync) {
1227
+ setIsReady(true);
1228
+ return;
1229
+ }
1087
1230
  if (!key) {
1088
1231
  setIsReady(true);
1089
1232
  return;
1090
1233
  }
1091
- const savedLayout = localStorage.getItem(
1092
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
1234
+ const savedPrefs = loadPreferences(key);
1235
+ setPreferences(savedPrefs);
1236
+ const computedColumns = applyPreferencesToColumns(
1237
+ initialColumns,
1238
+ savedPrefs
1093
1239
  );
1094
- if (savedLayout) {
1095
- setColumns(
1096
- mergeObjectArrays(
1097
- initialColumns,
1098
- JSON.parse(savedLayout)
1099
- )
1100
- );
1101
- } else {
1102
- localStorage.setItem(
1103
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
1104
- JSON.stringify(initialColumns)
1105
- );
1106
- setColumns((prev) => {
1107
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
1108
- return prev;
1109
- return initialColumns;
1110
- });
1111
- }
1240
+ setColumnsState(computedColumns);
1112
1241
  setIsReady(true);
1113
- }, [initialColumns, key, autosync]);
1114
- const getSavedLayout = (0, import_react5.useCallback)(() => {
1115
- const savedLayout = localStorage.getItem(
1116
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
1242
+ }, [key, autosync]);
1243
+ (0, import_react5.useEffect)(() => {
1244
+ if (!isReady) return;
1245
+ const computedColumns = applyPreferencesToColumns(
1246
+ initialColumns,
1247
+ preferencesRef.current
1117
1248
  );
1118
- if (savedLayout) {
1119
- return JSON.parse(savedLayout);
1120
- }
1121
- }, [key]);
1122
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
1249
+ setColumnsState(computedColumns);
1250
+ }, [initialColumns, isReady]);
1251
+ const persistPreferences = (0, import_react5.useCallback)(
1252
+ (newPrefs) => {
1253
+ if (!keyRef.current) return;
1254
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
1255
+ version: 2
1256
+ });
1257
+ setPreferences(updated);
1258
+ if (autosyncRef.current) {
1259
+ savePreferences(keyRef.current, updated);
1260
+ }
1261
+ const computedColumns = applyPreferencesToColumns(
1262
+ initialColumnsRef.current,
1263
+ updated
1264
+ );
1265
+ setColumnsState(computedColumns);
1266
+ },
1267
+ []
1268
+ );
1269
+ const hideColumn = (0, import_react5.useCallback)(
1270
+ (columnId) => {
1271
+ var _a, _b;
1272
+ const currentPrefs = preferencesRef.current;
1273
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
1274
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
1275
+ const newShown = currentShown.filter((id) => id !== columnId);
1276
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
1277
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1278
+ hiddenByUser: newHidden,
1279
+ shownByUser: newShown
1280
+ }));
1281
+ },
1282
+ [persistPreferences]
1283
+ );
1284
+ const showColumn = (0, import_react5.useCallback)(
1285
+ (columnId) => {
1286
+ var _a, _b;
1287
+ const currentPrefs = preferencesRef.current;
1288
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
1289
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
1290
+ const newHidden = currentHidden.filter((id) => id !== columnId);
1291
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
1292
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1293
+ hiddenByUser: newHidden,
1294
+ shownByUser: newShown
1295
+ }));
1296
+ },
1297
+ [persistPreferences]
1298
+ );
1299
+ const reorderColumns = (0, import_react5.useCallback)(
1300
+ (columnIds) => {
1301
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
1302
+ columnOrder: columnIds
1303
+ }));
1304
+ },
1305
+ [persistPreferences]
1306
+ );
1307
+ const setColumnWidth = (0, import_react5.useCallback)(
1308
+ (columnId, width) => {
1309
+ var _a;
1310
+ const currentPrefs = preferencesRef.current;
1311
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
1312
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1313
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
1314
+ }));
1315
+ },
1316
+ [persistPreferences]
1317
+ );
1318
+ const resetToDefaults = (0, import_react5.useCallback)(() => {
1319
+ if (!keyRef.current) return;
1320
+ clearPreferences(keyRef.current);
1321
+ setPreferences(null);
1322
+ const computedColumns = applyPreferencesToColumns(
1323
+ initialColumnsRef.current,
1324
+ null
1325
+ );
1326
+ setColumnsState(computedColumns);
1327
+ }, []);
1328
+ const getUserPreferences = (0, import_react5.useCallback)(() => {
1329
+ var _a;
1330
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
1331
+ }, []);
1332
+ const getSavedLayout = (0, import_react5.useCallback)(() => {
1333
+ return columns;
1334
+ }, [columns]);
1335
+ const setColumns = (0, import_react5.useCallback)(
1336
+ (setter) => {
1337
+ setColumnsState((prev) => {
1338
+ var _a, _b, _c, _d;
1339
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
1340
+ const newOrder = extractColumnOrder(newColumns);
1341
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
1342
+ newColumns,
1343
+ initialColumnsRef.current
1344
+ );
1345
+ const existingPrefs = preferencesRef.current;
1346
+ const mergedHidden = Array.from(
1347
+ /* @__PURE__ */ new Set([
1348
+ ...hiddenByUser,
1349
+ // Keep existing hidden prefs for columns that are still hidden
1350
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
1351
+ var _a2;
1352
+ const col = newColumns.find((c) => c.id === id);
1353
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
1354
+ })) != null ? _b : []
1355
+ ])
1356
+ );
1357
+ const mergedShown = Array.from(
1358
+ /* @__PURE__ */ new Set([
1359
+ ...shownByUser,
1360
+ // Keep existing shown prefs for columns that are still visible
1361
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
1362
+ var _a2;
1363
+ const col = newColumns.find((c) => c.id === id);
1364
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
1365
+ })) != null ? _d : []
1366
+ ])
1367
+ );
1368
+ if (keyRef.current && autosync) {
1369
+ const newPrefs = {
1370
+ columnOrder: newOrder,
1371
+ hiddenByUser: mergedHidden,
1372
+ shownByUser: mergedShown,
1373
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
1374
+ version: 2
1375
+ };
1376
+ setPreferences(newPrefs);
1377
+ savePreferences(keyRef.current, newPrefs);
1378
+ }
1379
+ return newColumns;
1380
+ });
1381
+ },
1382
+ [autosync]
1383
+ );
1384
+ return {
1385
+ columns,
1386
+ setColumns,
1387
+ isReady,
1388
+ getSavedLayout,
1389
+ hideColumn,
1390
+ showColumn,
1391
+ reorderColumns,
1392
+ setColumnWidth,
1393
+ resetToDefaults,
1394
+ getUserPreferences
1395
+ };
1123
1396
  }
1124
1397
 
1125
1398
  // src/hooks/useEditCell.tsx
@@ -3715,7 +3988,8 @@ function DataGrid({
3715
3988
  const {
3716
3989
  columns: tableColumns,
3717
3990
  setColumns: setTableColumns,
3718
- getSavedLayout
3991
+ getSavedLayout,
3992
+ resetToDefaults
3719
3993
  } = useTableLayout(columns, id != null ? id : testid);
3720
3994
  const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
3721
3995
  tableColumns.map((c) => c.id)
@@ -3743,21 +4017,8 @@ function DataGrid({
3743
4017
  [tableColumns]
3744
4018
  );
3745
4019
  const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
3746
- setTableColumns((prev) => {
3747
- columns.forEach((column) => {
3748
- var _a2, _b2;
3749
- const columnId = column.id;
3750
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
3751
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3752
- if (persistedIndex !== -1) {
3753
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3754
- visible: isVisible
3755
- });
3756
- }
3757
- });
3758
- return [...prev];
3759
- }, true);
3760
- }, [columns, setTableColumns]);
4020
+ resetToDefaults();
4021
+ }, [resetToDefaults]);
3761
4022
  (0, import_react17.useEffect)(() => {
3762
4023
  updateColumnVisibility(true);
3763
4024
  }, [updateColumnVisibility]);
@@ -3793,14 +4054,18 @@ function DataGrid({
3793
4054
  const toggleColumnVisibility = (0, import_react17.useCallback)(
3794
4055
  (columnId, isVisible) => {
3795
4056
  setTableColumns((prev) => {
3796
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3797
- if (persistedIndex !== -1) {
3798
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3799
- visible: isVisible
3800
- });
3801
- }
3802
- return [...prev];
3803
- }, true);
4057
+ const newColumns = prev.map((col) => {
4058
+ if (col.id === columnId) {
4059
+ return __spreadProps(__spreadValues({}, col), {
4060
+ meta: __spreadProps(__spreadValues({}, col.meta), {
4061
+ visible: isVisible
4062
+ })
4063
+ });
4064
+ }
4065
+ return col;
4066
+ });
4067
+ return newColumns;
4068
+ });
3804
4069
  },
3805
4070
  [setTableColumns]
3806
4071
  );
@@ -4448,7 +4713,8 @@ var Button = (_a) => {
4448
4713
  href,
4449
4714
  id,
4450
4715
  testid,
4451
- isLoading
4716
+ isLoading,
4717
+ fontNormal = false
4452
4718
  } = _b, props = __objRest(_b, [
4453
4719
  "variant",
4454
4720
  "as",
@@ -4464,7 +4730,8 @@ var Button = (_a) => {
4464
4730
  "href",
4465
4731
  "id",
4466
4732
  "testid",
4467
- "isLoading"
4733
+ "isLoading",
4734
+ "fontNormal"
4468
4735
  ]);
4469
4736
  const primaryVariantStyles = variant === "primary" && (0, import_clsx20.default)(
4470
4737
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -4491,6 +4758,15 @@ var Button = (_a) => {
4491
4758
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
4492
4759
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4493
4760
  );
4761
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx20.default)(
4762
+ "bg-transparent border-transparent",
4763
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
4764
+ "bg-transparent border-transparent",
4765
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
4766
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
4767
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
4768
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4769
+ );
4494
4770
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx20.default)(
4495
4771
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
4496
4772
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -4534,6 +4810,7 @@ var Button = (_a) => {
4534
4810
  primaryVariantStyles,
4535
4811
  secondaryVariantStyles,
4536
4812
  tertiaryVariantStyles,
4813
+ quarternaryOutlinedVariantStyles,
4537
4814
  primaryCriticalVariantStyles,
4538
4815
  secondaryCriticalVariantStyles,
4539
4816
  tertiaryCriticalVariantStyles,
@@ -4544,6 +4821,7 @@ var Button = (_a) => {
4544
4821
  const labelClasses = (0, import_clsx20.default)(
4545
4822
  "min-h-6 flex items-center justify-center",
4546
4823
  classNameLabel,
4824
+ fontNormal && "font-normal!",
4547
4825
  componentPaddingXUsingComponentGap,
4548
4826
  typography.buttonLabel
4549
4827
  );
@@ -5951,7 +6229,7 @@ var import_react36 = require("react");
5951
6229
  var import_jsx_runtime52 = require("react/jsx-runtime");
5952
6230
 
5953
6231
  // src/components/EmblaCarousel/index.tsx
5954
- var import_react39 = require("react");
6232
+ var import_react39 = __toESM(require("react"), 1);
5955
6233
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
5956
6234
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
5957
6235
 
@@ -6300,7 +6578,8 @@ var ModalHeader = ({
6300
6578
  id,
6301
6579
  "data-testid": testid,
6302
6580
  className: (0, import_clsx39.default)(
6303
- "flex justify-between items-center",
6581
+ "flex items-center",
6582
+ headerIconAlign === void 0 && "justify-between",
6304
6583
  headerIconAlign === "center" && "justify-center",
6305
6584
  headerIconAlign === "right" && "justify-end",
6306
6585
  headerIconAlign === "left" && "justify-start",
@@ -6824,7 +7103,7 @@ function RowDetailModalProvider() {
6824
7103
  iconOnly: true,
6825
7104
  variant: "tertiary",
6826
7105
  onClick: closeRowDetail,
6827
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { name: "x", size: 24 }) })
7106
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { name: "close", size: 24 }) })
6828
7107
  }
6829
7108
  )
6830
7109
  ]