@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
@@ -944,6 +944,9 @@ var useMatchesMedia = (query) => {
944
944
  };
945
945
  var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
946
946
 
947
+ // src/hooks/useTableLayout/useTableLayout.ts
948
+ var import_react6 = require("react");
949
+
947
950
  // src/utils/date.ts
948
951
  function isValidDate(dateString) {
949
952
  const date = new Date(dateString);
@@ -1042,30 +1045,8 @@ function formatDate(date) {
1042
1045
  }
1043
1046
  }
1044
1047
 
1045
- // src/utils/mergeObjectArrays.ts
1046
- function mergeObjectArrays(arr1, arr2) {
1047
- const arr2Map = /* @__PURE__ */ new Map();
1048
- for (const item of arr2) {
1049
- const id = item.id;
1050
- if (id !== void 0) {
1051
- arr2Map.set(id, item);
1052
- }
1053
- }
1054
- return arr1.map((item1) => {
1055
- const id = item1.id;
1056
- if (id !== void 0 && arr2Map.has(id)) {
1057
- const item2 = arr2Map.get(id);
1058
- const meta1 = item1.meta;
1059
- const meta2 = item2.meta;
1060
- const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
1061
- return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
1062
- }
1063
- return item1;
1064
- });
1065
- }
1066
-
1067
1048
  // src/utils/index.ts
1068
- var LocalStoragePrefixVersion = `dmsi-acc-v1.1.4`;
1049
+ var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
1069
1050
 
1070
1051
  // src/utils.ts
1071
1052
  function findDocumentRoot(element) {
@@ -1090,74 +1071,366 @@ function findDocumentRoot(element) {
1090
1071
  return window.document.body;
1091
1072
  }
1092
1073
 
1093
- // src/hooks/useTableLayout.ts
1094
- var import_react6 = require("react");
1095
- var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
1096
- var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
1074
+ // src/hooks/useTableLayout/storage.ts
1075
+ var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
1076
+ var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
1077
+ var CURRENT_SCHEMA_VERSION = 2;
1078
+ function getStorageKey(key) {
1079
+ return `${STORAGE_PREFIX}__${key}`;
1080
+ }
1081
+ function getLegacyStorageKey(key) {
1082
+ return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
1083
+ }
1084
+ function loadPreferences(key) {
1085
+ const storageKey = getStorageKey(key);
1086
+ const legacyKey = getLegacyStorageKey(key);
1087
+ const newData = localStorage.getItem(storageKey);
1088
+ if (newData) {
1089
+ try {
1090
+ const parsed = JSON.parse(newData);
1091
+ if (parsed.version === CURRENT_SCHEMA_VERSION) {
1092
+ return parsed;
1093
+ }
1094
+ localStorage.removeItem(storageKey);
1095
+ } catch (e) {
1096
+ localStorage.removeItem(storageKey);
1097
+ }
1098
+ }
1099
+ const legacyData = localStorage.getItem(legacyKey);
1100
+ if (legacyData) {
1101
+ localStorage.removeItem(legacyKey);
1102
+ }
1103
+ return null;
1104
+ }
1105
+ function savePreferences(key, preferences) {
1106
+ var _a, _b, _c, _d, _e, _f, _g;
1107
+ const storageKey = getStorageKey(key);
1108
+ 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;
1109
+ if (!hasPreferences) {
1110
+ localStorage.removeItem(storageKey);
1111
+ return;
1112
+ }
1113
+ const data = __spreadProps(__spreadValues({}, preferences), {
1114
+ version: CURRENT_SCHEMA_VERSION
1115
+ });
1116
+ localStorage.setItem(storageKey, JSON.stringify(data));
1117
+ }
1118
+ function clearPreferences(key) {
1119
+ const storageKey = getStorageKey(key);
1120
+ const legacyKey = getLegacyStorageKey(key);
1121
+ localStorage.removeItem(storageKey);
1122
+ localStorage.removeItem(legacyKey);
1123
+ }
1124
+ function clearAllLegacyData() {
1125
+ if (typeof window === "undefined") return;
1126
+ const keysToRemove = [];
1127
+ for (let i = 0; i < localStorage.length; i++) {
1128
+ const key = localStorage.key(i);
1129
+ if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
1130
+ keysToRemove.push(key);
1131
+ }
1132
+ }
1133
+ keysToRemove.forEach((key) => {
1134
+ localStorage.removeItem(key);
1135
+ });
1136
+ }
1137
+ function hasPerformedLegacyMigration() {
1138
+ if (typeof window === "undefined") return true;
1139
+ return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
1140
+ }
1141
+ function markLegacyMigrationComplete() {
1142
+ if (typeof window === "undefined") return;
1143
+ localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
1144
+ }
1145
+
1146
+ // src/hooks/useTableLayout/computeColumns.ts
1147
+ function computeColumnVisibility(column, preferences) {
1148
+ var _a, _b, _c, _d, _e, _f;
1149
+ const columnId = column.id;
1150
+ if (!columnId) return true;
1151
+ const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
1152
+ const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
1153
+ if (!canUserToggle) {
1154
+ return systemVisible;
1155
+ }
1156
+ if (preferences) {
1157
+ if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
1158
+ return false;
1159
+ }
1160
+ if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
1161
+ return true;
1162
+ }
1163
+ }
1164
+ return systemVisible;
1165
+ }
1166
+ function applyPreferencesToColumns(systemColumns, preferences) {
1167
+ var _a;
1168
+ let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
1169
+ meta: __spreadProps(__spreadValues({}, col.meta), {
1170
+ // Compute visibility based on system + user preferences
1171
+ visible: computeColumnVisibility(col, preferences)
1172
+ })
1173
+ }));
1174
+ if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
1175
+ const orderMap = new Map(
1176
+ preferences.columnOrder.map((id, index) => [id, index])
1177
+ );
1178
+ columns = columns.sort((a, b) => {
1179
+ var _a2, _b;
1180
+ const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
1181
+ const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
1182
+ if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
1183
+ return 0;
1184
+ }
1185
+ return orderA - orderB;
1186
+ });
1187
+ }
1188
+ if (preferences == null ? void 0 : preferences.columnWidths) {
1189
+ columns = columns.map((col) => {
1190
+ var _a2;
1191
+ const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
1192
+ if (width !== void 0) {
1193
+ return __spreadProps(__spreadValues({}, col), {
1194
+ size: width
1195
+ });
1196
+ }
1197
+ return col;
1198
+ });
1199
+ }
1200
+ return columns;
1201
+ }
1202
+ function extractColumnOrder(columns) {
1203
+ return columns.filter((c) => c.id).map((c) => c.id);
1204
+ }
1205
+ function extractVisibilityChanges(columns, systemColumns) {
1206
+ const hiddenByUser = [];
1207
+ const shownByUser = [];
1208
+ columns.forEach((col) => {
1209
+ var _a, _b, _c, _d, _e, _f, _g;
1210
+ if (!col.id) return;
1211
+ const systemCol = systemColumns.find((c) => c.id === col.id);
1212
+ if (!systemCol) return;
1213
+ const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
1214
+ const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
1215
+ const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
1216
+ if (!canToggle) return;
1217
+ if (systemVisible && !currentVisible) {
1218
+ hiddenByUser.push(col.id);
1219
+ } else if (!systemVisible && currentVisible) {
1220
+ if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
1221
+ shownByUser.push(col.id);
1222
+ }
1223
+ }
1224
+ });
1225
+ return { hiddenByUser, shownByUser };
1226
+ }
1227
+
1228
+ // src/hooks/useTableLayout/useTableLayout.ts
1229
+ var hasCleanedLegacyDataThisSession = false;
1097
1230
  function useTableLayout(initialColumns, key, autosync = true) {
1098
- const [columns, setColumns] = (0, import_react6.useState)(initialColumns);
1231
+ const [preferences, setPreferences] = (0, import_react6.useState)(null);
1232
+ const [columns, setColumnsState] = (0, import_react6.useState)(
1233
+ () => (
1234
+ // Initialize with system columns (no preferences applied yet)
1235
+ initialColumns.map((col) => __spreadValues({}, col))
1236
+ )
1237
+ );
1099
1238
  const [isReady, setIsReady] = (0, import_react6.useState)(false);
1100
- const isReadyRef = (0, import_react6.useRef)(false);
1101
1239
  const keyRef = (0, import_react6.useRef)(key);
1240
+ const initialColumnsRef = (0, import_react6.useRef)(initialColumns);
1241
+ const preferencesRef = (0, import_react6.useRef)(preferences);
1242
+ const autosyncRef = (0, import_react6.useRef)(autosync);
1102
1243
  (0, import_react6.useEffect)(() => {
1103
- isReadyRef.current = isReady;
1104
1244
  keyRef.current = key;
1105
- }, [isReady, key]);
1106
- const handleSaveLayout = (0, import_react6.useCallback)(
1107
- (setter, _internal) => {
1108
- if (!isReadyRef.current && !_internal || !keyRef.current) return;
1109
- setColumns((prevColumns) => {
1110
- const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
1111
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
1112
- return prevColumns;
1113
- }
1114
- localStorage.setItem(
1115
- getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
1116
- JSON.stringify(newColumns)
1117
- );
1118
- return newColumns;
1119
- });
1120
- },
1121
- []
1122
- );
1245
+ }, [key]);
1246
+ (0, import_react6.useEffect)(() => {
1247
+ initialColumnsRef.current = initialColumns;
1248
+ }, [initialColumns]);
1249
+ (0, import_react6.useEffect)(() => {
1250
+ preferencesRef.current = preferences;
1251
+ }, [preferences]);
1123
1252
  (0, import_react6.useEffect)(() => {
1124
- if (!autosync) return;
1253
+ autosyncRef.current = autosync;
1254
+ }, [autosync]);
1255
+ (0, import_react6.useEffect)(() => {
1256
+ if (typeof window === "undefined") return;
1257
+ if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
1258
+ clearAllLegacyData();
1259
+ markLegacyMigrationComplete();
1260
+ hasCleanedLegacyDataThisSession = true;
1261
+ }
1262
+ }, []);
1263
+ (0, import_react6.useEffect)(() => {
1264
+ if (!autosync) {
1265
+ setIsReady(true);
1266
+ return;
1267
+ }
1125
1268
  if (!key) {
1126
1269
  setIsReady(true);
1127
1270
  return;
1128
1271
  }
1129
- const savedLayout = localStorage.getItem(
1130
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
1272
+ const savedPrefs = loadPreferences(key);
1273
+ setPreferences(savedPrefs);
1274
+ const computedColumns = applyPreferencesToColumns(
1275
+ initialColumns,
1276
+ savedPrefs
1131
1277
  );
1132
- if (savedLayout) {
1133
- setColumns(
1134
- mergeObjectArrays(
1135
- initialColumns,
1136
- JSON.parse(savedLayout)
1137
- )
1138
- );
1139
- } else {
1140
- localStorage.setItem(
1141
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
1142
- JSON.stringify(initialColumns)
1143
- );
1144
- setColumns((prev) => {
1145
- if (JSON.stringify(initialColumns) === JSON.stringify(prev))
1146
- return prev;
1147
- return initialColumns;
1148
- });
1149
- }
1278
+ setColumnsState(computedColumns);
1150
1279
  setIsReady(true);
1151
- }, [initialColumns, key, autosync]);
1152
- const getSavedLayout = (0, import_react6.useCallback)(() => {
1153
- const savedLayout = localStorage.getItem(
1154
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
1280
+ }, [key, autosync]);
1281
+ (0, import_react6.useEffect)(() => {
1282
+ if (!isReady) return;
1283
+ const computedColumns = applyPreferencesToColumns(
1284
+ initialColumns,
1285
+ preferencesRef.current
1155
1286
  );
1156
- if (savedLayout) {
1157
- return JSON.parse(savedLayout);
1158
- }
1159
- }, [key]);
1160
- return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
1287
+ setColumnsState(computedColumns);
1288
+ }, [initialColumns, isReady]);
1289
+ const persistPreferences = (0, import_react6.useCallback)(
1290
+ (newPrefs) => {
1291
+ if (!keyRef.current) return;
1292
+ const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
1293
+ version: 2
1294
+ });
1295
+ setPreferences(updated);
1296
+ if (autosyncRef.current) {
1297
+ savePreferences(keyRef.current, updated);
1298
+ }
1299
+ const computedColumns = applyPreferencesToColumns(
1300
+ initialColumnsRef.current,
1301
+ updated
1302
+ );
1303
+ setColumnsState(computedColumns);
1304
+ },
1305
+ []
1306
+ );
1307
+ const hideColumn = (0, import_react6.useCallback)(
1308
+ (columnId) => {
1309
+ var _a, _b;
1310
+ const currentPrefs = preferencesRef.current;
1311
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
1312
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
1313
+ const newShown = currentShown.filter((id) => id !== columnId);
1314
+ const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
1315
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1316
+ hiddenByUser: newHidden,
1317
+ shownByUser: newShown
1318
+ }));
1319
+ },
1320
+ [persistPreferences]
1321
+ );
1322
+ const showColumn = (0, import_react6.useCallback)(
1323
+ (columnId) => {
1324
+ var _a, _b;
1325
+ const currentPrefs = preferencesRef.current;
1326
+ const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
1327
+ const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
1328
+ const newHidden = currentHidden.filter((id) => id !== columnId);
1329
+ const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
1330
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1331
+ hiddenByUser: newHidden,
1332
+ shownByUser: newShown
1333
+ }));
1334
+ },
1335
+ [persistPreferences]
1336
+ );
1337
+ const reorderColumns = (0, import_react6.useCallback)(
1338
+ (columnIds) => {
1339
+ persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
1340
+ columnOrder: columnIds
1341
+ }));
1342
+ },
1343
+ [persistPreferences]
1344
+ );
1345
+ const setColumnWidth = (0, import_react6.useCallback)(
1346
+ (columnId, width) => {
1347
+ var _a;
1348
+ const currentPrefs = preferencesRef.current;
1349
+ const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
1350
+ persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
1351
+ columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
1352
+ }));
1353
+ },
1354
+ [persistPreferences]
1355
+ );
1356
+ const resetToDefaults = (0, import_react6.useCallback)(() => {
1357
+ if (!keyRef.current) return;
1358
+ clearPreferences(keyRef.current);
1359
+ setPreferences(null);
1360
+ const computedColumns = applyPreferencesToColumns(
1361
+ initialColumnsRef.current,
1362
+ null
1363
+ );
1364
+ setColumnsState(computedColumns);
1365
+ }, []);
1366
+ const getUserPreferences = (0, import_react6.useCallback)(() => {
1367
+ var _a;
1368
+ return (_a = preferencesRef.current) != null ? _a : { version: 2 };
1369
+ }, []);
1370
+ const getSavedLayout = (0, import_react6.useCallback)(() => {
1371
+ return columns;
1372
+ }, [columns]);
1373
+ const setColumns = (0, import_react6.useCallback)(
1374
+ (setter) => {
1375
+ setColumnsState((prev) => {
1376
+ var _a, _b, _c, _d;
1377
+ const newColumns = typeof setter === "function" ? setter(prev) : setter;
1378
+ const newOrder = extractColumnOrder(newColumns);
1379
+ const { hiddenByUser, shownByUser } = extractVisibilityChanges(
1380
+ newColumns,
1381
+ initialColumnsRef.current
1382
+ );
1383
+ const existingPrefs = preferencesRef.current;
1384
+ const mergedHidden = Array.from(
1385
+ /* @__PURE__ */ new Set([
1386
+ ...hiddenByUser,
1387
+ // Keep existing hidden prefs for columns that are still hidden
1388
+ ...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
1389
+ var _a2;
1390
+ const col = newColumns.find((c) => c.id === id);
1391
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
1392
+ })) != null ? _b : []
1393
+ ])
1394
+ );
1395
+ const mergedShown = Array.from(
1396
+ /* @__PURE__ */ new Set([
1397
+ ...shownByUser,
1398
+ // Keep existing shown prefs for columns that are still visible
1399
+ ...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
1400
+ var _a2;
1401
+ const col = newColumns.find((c) => c.id === id);
1402
+ return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
1403
+ })) != null ? _d : []
1404
+ ])
1405
+ );
1406
+ if (keyRef.current && autosync) {
1407
+ const newPrefs = {
1408
+ columnOrder: newOrder,
1409
+ hiddenByUser: mergedHidden,
1410
+ shownByUser: mergedShown,
1411
+ columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
1412
+ version: 2
1413
+ };
1414
+ setPreferences(newPrefs);
1415
+ savePreferences(keyRef.current, newPrefs);
1416
+ }
1417
+ return newColumns;
1418
+ });
1419
+ },
1420
+ [autosync]
1421
+ );
1422
+ return {
1423
+ columns,
1424
+ setColumns,
1425
+ isReady,
1426
+ getSavedLayout,
1427
+ hideColumn,
1428
+ showColumn,
1429
+ reorderColumns,
1430
+ setColumnWidth,
1431
+ resetToDefaults,
1432
+ getUserPreferences
1433
+ };
1161
1434
  }
1162
1435
 
1163
1436
  // src/hooks/useEditCell.tsx
@@ -3291,7 +3564,8 @@ function DataGrid({
3291
3564
  const {
3292
3565
  columns: tableColumns,
3293
3566
  setColumns: setTableColumns,
3294
- getSavedLayout
3567
+ getSavedLayout,
3568
+ resetToDefaults
3295
3569
  } = useTableLayout(columns, id != null ? id : testid);
3296
3570
  const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
3297
3571
  tableColumns.map((c) => c.id)
@@ -3319,21 +3593,8 @@ function DataGrid({
3319
3593
  [tableColumns]
3320
3594
  );
3321
3595
  const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
3322
- setTableColumns((prev) => {
3323
- columns.forEach((column) => {
3324
- var _a2, _b2;
3325
- const columnId = column.id;
3326
- const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
3327
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3328
- if (persistedIndex !== -1) {
3329
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3330
- visible: isVisible
3331
- });
3332
- }
3333
- });
3334
- return [...prev];
3335
- }, true);
3336
- }, [columns, setTableColumns]);
3596
+ resetToDefaults();
3597
+ }, [resetToDefaults]);
3337
3598
  (0, import_react17.useEffect)(() => {
3338
3599
  updateColumnVisibility(true);
3339
3600
  }, [updateColumnVisibility]);
@@ -3369,14 +3630,18 @@ function DataGrid({
3369
3630
  const toggleColumnVisibility = (0, import_react17.useCallback)(
3370
3631
  (columnId, isVisible) => {
3371
3632
  setTableColumns((prev) => {
3372
- const persistedIndex = prev.findIndex((col) => col.id === columnId);
3373
- if (persistedIndex !== -1) {
3374
- prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
3375
- visible: isVisible
3376
- });
3377
- }
3378
- return [...prev];
3379
- }, true);
3633
+ const newColumns = prev.map((col) => {
3634
+ if (col.id === columnId) {
3635
+ return __spreadProps(__spreadValues({}, col), {
3636
+ meta: __spreadProps(__spreadValues({}, col.meta), {
3637
+ visible: isVisible
3638
+ })
3639
+ });
3640
+ }
3641
+ return col;
3642
+ });
3643
+ return newColumns;
3644
+ });
3380
3645
  },
3381
3646
  [setTableColumns]
3382
3647
  );
@@ -4148,7 +4413,8 @@ var Button = (_a) => {
4148
4413
  href,
4149
4414
  id,
4150
4415
  testid,
4151
- isLoading
4416
+ isLoading,
4417
+ fontNormal = false
4152
4418
  } = _b, props = __objRest(_b, [
4153
4419
  "variant",
4154
4420
  "as",
@@ -4164,7 +4430,8 @@ var Button = (_a) => {
4164
4430
  "href",
4165
4431
  "id",
4166
4432
  "testid",
4167
- "isLoading"
4433
+ "isLoading",
4434
+ "fontNormal"
4168
4435
  ]);
4169
4436
  const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
4170
4437
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
@@ -4191,6 +4458,15 @@ var Button = (_a) => {
4191
4458
  "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
4192
4459
  "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4193
4460
  );
4461
+ const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
4462
+ "bg-transparent border-transparent",
4463
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
4464
+ "bg-transparent border-transparent",
4465
+ "hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
4466
+ "focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
4467
+ "active:bg-transparent active:border-transparent active:text-text-primary-active",
4468
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
4469
+ );
4194
4470
  const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
4195
4471
  (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
4196
4472
  "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
@@ -4234,6 +4510,7 @@ var Button = (_a) => {
4234
4510
  primaryVariantStyles,
4235
4511
  secondaryVariantStyles,
4236
4512
  tertiaryVariantStyles,
4513
+ quarternaryOutlinedVariantStyles,
4237
4514
  primaryCriticalVariantStyles,
4238
4515
  secondaryCriticalVariantStyles,
4239
4516
  tertiaryCriticalVariantStyles,
@@ -4244,6 +4521,7 @@ var Button = (_a) => {
4244
4521
  const labelClasses = (0, import_clsx18.default)(
4245
4522
  "min-h-6 flex items-center justify-center",
4246
4523
  classNameLabel,
4524
+ fontNormal && "font-normal!",
4247
4525
  componentPaddingXUsingComponentGap,
4248
4526
  typography.buttonLabel
4249
4527
  );
@@ -4518,7 +4796,8 @@ var ModalHeader = ({
4518
4796
  id,
4519
4797
  "data-testid": testid,
4520
4798
  className: (0, import_clsx24.default)(
4521
- "flex justify-between items-center",
4799
+ "flex items-center",
4800
+ headerIconAlign === void 0 && "justify-between",
4522
4801
  headerIconAlign === "center" && "justify-center",
4523
4802
  headerIconAlign === "right" && "justify-end",
4524
4803
  headerIconAlign === "left" && "justify-start",
@@ -5349,7 +5628,7 @@ var import_react38 = require("react");
5349
5628
  var import_jsx_runtime64 = require("react/jsx-runtime");
5350
5629
 
5351
5630
  // src/components/EmblaCarousel/index.tsx
5352
- var import_react41 = require("react");
5631
+ var import_react41 = __toESM(require("react"), 1);
5353
5632
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
5354
5633
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
5355
5634