@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.
- package/dist/{chunk-LFBTRFTS.js → chunk-2UNLVJU5.js} +4 -4
- package/dist/{chunk-PXIW3XJX.js → chunk-34J6RA4C.js} +1 -1
- package/dist/{chunk-NGXKXYB5.js → chunk-6FZNEFN3.js} +1 -1
- package/dist/{chunk-Z7XANQ47.js → chunk-6M2N7DVS.js} +4 -2
- package/dist/{chunk-RAJY6INK.js → chunk-BBU7JOY2.js} +1 -1
- package/dist/{chunk-UUKHQUSF.js → chunk-F6QO73TV.js} +1 -1
- package/dist/{chunk-BRCBTEQ2.js → chunk-FGXTI3WE.js} +1 -1
- package/dist/{chunk-EJVCDJ7U.js → chunk-HDFO56DN.js} +1 -1
- package/dist/{chunk-XWYDWH4W.js → chunk-HTICQWRA.js} +1 -1
- package/dist/{chunk-N36EJLRW.js → chunk-JZZ4LF6B.js} +2 -2
- package/dist/{chunk-27DJTEAB.js → chunk-MB6IRHTN.js} +1 -1
- package/dist/{chunk-ZACRFGND.js → chunk-NBTWFTSF.js} +94 -65
- package/dist/{chunk-FAW3WWOQ.js → chunk-OC5AXLJY.js} +1 -1
- package/dist/{chunk-VABOQRYA.js → chunk-POZD6R3P.js} +1 -1
- package/dist/{chunk-YYRFXTO7.js → chunk-RLJU65SD.js} +21 -29
- package/dist/{chunk-F7F5BKW5.js → chunk-TBZ243DS.js} +1 -1
- package/dist/{chunk-2EAVEFWY.js → chunk-WHWZ5VVQ.js} +3 -2
- package/dist/{chunk-FSXKJXPN.js → chunk-Y7RCYDF6.js} +8 -2
- package/dist/{chunk-BMAZBFUU.js → chunk-ZMTHWJ7F.js} +15 -2
- package/dist/chunk-ZRFXUER3.js +468 -0
- package/dist/components/Alert.cjs +15 -2
- package/dist/components/Alert.js +2 -2
- package/dist/components/Breadcrumbs.cjs +8 -2
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Button.cjs +15 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/CalendarRange.cjs +385 -106
- package/dist/components/CalendarRange.css +55 -3
- package/dist/components/CalendarRange.js +14 -14
- package/dist/components/CompactImagesPreview.cjs +7 -4
- package/dist/components/CompactImagesPreview.js +2 -2
- package/dist/components/ContentTab.cjs +15 -2
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +15 -2
- package/dist/components/ContentTabs.js +2 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +385 -106
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +55 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +14 -14
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +385 -106
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +55 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +14 -14
- package/dist/components/DataGrid/PinnedColumns.cjs +385 -106
- package/dist/components/DataGrid/PinnedColumns.css +55 -3
- package/dist/components/DataGrid/PinnedColumns.js +14 -14
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +385 -106
- package/dist/components/DataGrid/TableBody/LoadingCell.css +55 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.js +14 -14
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +385 -106
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +55 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +14 -14
- package/dist/components/DataGrid/TableBody/index.cjs +385 -106
- package/dist/components/DataGrid/TableBody/index.css +55 -3
- package/dist/components/DataGrid/TableBody/index.js +14 -14
- package/dist/components/DataGrid/index.cjs +385 -106
- package/dist/components/DataGrid/index.css +55 -3
- package/dist/components/DataGrid/index.js +14 -14
- package/dist/components/DataGrid/utils.cjs +385 -106
- package/dist/components/DataGrid/utils.css +55 -3
- package/dist/components/DataGrid/utils.js +14 -14
- package/dist/components/DataGridCell.cjs +7 -4
- package/dist/components/DataGridCell.js +2 -2
- package/dist/components/DateInput.cjs +385 -106
- package/dist/components/DateInput.css +55 -3
- package/dist/components/DateInput.js +14 -14
- package/dist/components/DateRangeInput.cjs +385 -106
- package/dist/components/DateRangeInput.css +55 -3
- package/dist/components/DateRangeInput.js +14 -14
- package/dist/components/EmblaCarousel/index.cjs +94 -65
- package/dist/components/EmblaCarousel/index.js +1 -1
- package/dist/components/FilterGroup.cjs +23 -4
- package/dist/components/FilterGroup.js +3 -3
- package/dist/components/Link.cjs +8 -2
- package/dist/components/Link.js +1 -1
- package/dist/components/Menu.cjs +7 -4
- package/dist/components/Menu.js +2 -2
- package/dist/components/MenuOption.cjs +7 -4
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/MobileDataGrid/ColumnList.css +55 -3
- package/dist/components/MobileDataGrid/ColumnList.js +4 -4
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +385 -106
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +55 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +14 -14
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +385 -106
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +55 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +14 -14
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +24 -7
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +9 -9
- package/dist/components/MobileDataGrid/index.cjs +386 -107
- package/dist/components/MobileDataGrid/index.css +55 -3
- package/dist/components/MobileDataGrid/index.js +14 -14
- package/dist/components/Modal.cjs +23 -6
- package/dist/components/Modal.js +6 -6
- package/dist/components/ModalButtons.cjs +15 -2
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalHeader.cjs +17 -3
- package/dist/components/ModalHeader.js +2 -2
- package/dist/components/NavigationTab.cjs +15 -2
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.cjs +15 -2
- package/dist/components/NavigationTabs.js +2 -2
- package/dist/components/NestedMenu.cjs +22 -6
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/Notification.cjs +15 -2
- package/dist/components/Notification.js +1 -1
- package/dist/components/OptionPill.cjs +15 -2
- package/dist/components/OptionPill.js +2 -2
- package/dist/components/PDFViewer/DownloadIcon.cjs +25 -7
- package/dist/components/PDFViewer/DownloadIcon.js +4 -4
- package/dist/components/PDFViewer/PDFNavigation.cjs +15 -2
- package/dist/components/PDFViewer/PDFNavigation.js +2 -2
- package/dist/components/PDFViewer/index.cjs +40 -13
- package/dist/components/PDFViewer/index.js +15 -13
- package/dist/components/Password.cjs +7 -4
- package/dist/components/Password.js +2 -2
- package/dist/components/ProductImagePreview/index.cjs +7 -4
- package/dist/components/ProductImagePreview/index.js +2 -2
- package/dist/components/ProjectBar.cjs +7 -4
- package/dist/components/ProjectBar.js +2 -2
- package/dist/components/Stepper.cjs +61 -15
- package/dist/components/Stepper.js +42 -12
- package/dist/components/Time.js +1 -1
- package/dist/components/Toast.cjs +15 -2
- package/dist/components/Toast.js +1 -1
- package/dist/components/Tooltip.cjs +7 -4
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/Upload.cjs +15 -2
- package/dist/components/Upload.js +1 -1
- package/dist/components/index.cjs +479 -171
- package/dist/components/index.css +55 -3
- package/dist/components/index.js +14 -14
- package/dist/components/useMenuSystem.cjs +7 -4
- package/dist/components/useMenuSystem.js +2 -2
- package/dist/hooks/index.cjs +346 -73
- package/dist/hooks/index.js +2 -2
- package/dist/index.css +55 -3
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-WOWPMA26.js +0 -170
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LocalStoragePrefixVersion
|
|
3
|
+
} from "./chunk-TBZ243DS.js";
|
|
4
|
+
import {
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "./chunk-ORMEWXMH.js";
|
|
8
|
+
|
|
9
|
+
// src/hooks/useKeydown.ts
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
function useKeydown(keys, isActive) {
|
|
12
|
+
function handleKeyDown(event) {
|
|
13
|
+
if (!Object.keys(keys).includes(event.key) && !Object.keys(keys).join("").includes("/"))
|
|
14
|
+
return;
|
|
15
|
+
Object.entries(keys).forEach(([key, handler]) => {
|
|
16
|
+
if (event.key !== key && !key.includes("/")) return;
|
|
17
|
+
if (key.includes("/") && key.replace("Space", " ").split("/").includes(event.key)) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
handler(event);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (event.key === key) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
handler(event);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!isActive)
|
|
30
|
+
return document.removeEventListener("keydown", handleKeyDown);
|
|
31
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
34
|
+
};
|
|
35
|
+
}, [keys, isActive]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/hooks/useInfiniteScroll.tsx
|
|
39
|
+
import { useEffect as useEffect2 } from "react";
|
|
40
|
+
function useInfiniteScroll({
|
|
41
|
+
containerRef,
|
|
42
|
+
onLoadMore,
|
|
43
|
+
isLoading,
|
|
44
|
+
offset = 50,
|
|
45
|
+
enabled = true
|
|
46
|
+
// ✅ Add this
|
|
47
|
+
}) {
|
|
48
|
+
useEffect2(() => {
|
|
49
|
+
if (!enabled) return;
|
|
50
|
+
const handleScroll = () => {
|
|
51
|
+
const el2 = containerRef.current;
|
|
52
|
+
if (!el2 || isLoading) return;
|
|
53
|
+
const { scrollTop, scrollHeight, clientHeight } = el2;
|
|
54
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - offset;
|
|
55
|
+
if (isNearBottom) {
|
|
56
|
+
onLoadMore();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const el = containerRef.current;
|
|
60
|
+
if (el) el.addEventListener("scroll", handleScroll);
|
|
61
|
+
return () => {
|
|
62
|
+
if (el) el.removeEventListener("scroll", handleScroll);
|
|
63
|
+
};
|
|
64
|
+
}, [containerRef, onLoadMore, isLoading, offset, enabled]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
68
|
+
import {
|
|
69
|
+
useState,
|
|
70
|
+
useEffect as useEffect3,
|
|
71
|
+
useCallback,
|
|
72
|
+
useRef
|
|
73
|
+
} from "react";
|
|
74
|
+
|
|
75
|
+
// src/hooks/useTableLayout/storage.ts
|
|
76
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
77
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
78
|
+
var CURRENT_SCHEMA_VERSION = 2;
|
|
79
|
+
function getStorageKey(key) {
|
|
80
|
+
return `${STORAGE_PREFIX}__${key}`;
|
|
81
|
+
}
|
|
82
|
+
function getLegacyStorageKey(key) {
|
|
83
|
+
return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
|
|
84
|
+
}
|
|
85
|
+
function loadPreferences(key) {
|
|
86
|
+
const storageKey = getStorageKey(key);
|
|
87
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
88
|
+
const newData = localStorage.getItem(storageKey);
|
|
89
|
+
if (newData) {
|
|
90
|
+
try {
|
|
91
|
+
const parsed = JSON.parse(newData);
|
|
92
|
+
if (parsed.version === CURRENT_SCHEMA_VERSION) {
|
|
93
|
+
return parsed;
|
|
94
|
+
}
|
|
95
|
+
localStorage.removeItem(storageKey);
|
|
96
|
+
} catch (e) {
|
|
97
|
+
localStorage.removeItem(storageKey);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const legacyData = localStorage.getItem(legacyKey);
|
|
101
|
+
if (legacyData) {
|
|
102
|
+
localStorage.removeItem(legacyKey);
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
function savePreferences(key, preferences) {
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
|
+
const storageKey = getStorageKey(key);
|
|
109
|
+
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;
|
|
110
|
+
if (!hasPreferences) {
|
|
111
|
+
localStorage.removeItem(storageKey);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const data = __spreadProps(__spreadValues({}, preferences), {
|
|
115
|
+
version: CURRENT_SCHEMA_VERSION
|
|
116
|
+
});
|
|
117
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
118
|
+
}
|
|
119
|
+
function clearPreferences(key) {
|
|
120
|
+
const storageKey = getStorageKey(key);
|
|
121
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
122
|
+
localStorage.removeItem(storageKey);
|
|
123
|
+
localStorage.removeItem(legacyKey);
|
|
124
|
+
}
|
|
125
|
+
function clearAllLegacyData() {
|
|
126
|
+
if (typeof window === "undefined") return;
|
|
127
|
+
const keysToRemove = [];
|
|
128
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
129
|
+
const key = localStorage.key(i);
|
|
130
|
+
if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
|
|
131
|
+
keysToRemove.push(key);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
keysToRemove.forEach((key) => {
|
|
135
|
+
localStorage.removeItem(key);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function hasPerformedLegacyMigration() {
|
|
139
|
+
if (typeof window === "undefined") return true;
|
|
140
|
+
return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
|
|
141
|
+
}
|
|
142
|
+
function markLegacyMigrationComplete() {
|
|
143
|
+
if (typeof window === "undefined") return;
|
|
144
|
+
localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/hooks/useTableLayout/computeColumns.ts
|
|
148
|
+
function computeColumnVisibility(column, preferences) {
|
|
149
|
+
var _a, _b, _c, _d, _e, _f;
|
|
150
|
+
const columnId = column.id;
|
|
151
|
+
if (!columnId) return true;
|
|
152
|
+
const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
153
|
+
const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
|
|
154
|
+
if (!canUserToggle) {
|
|
155
|
+
return systemVisible;
|
|
156
|
+
}
|
|
157
|
+
if (preferences) {
|
|
158
|
+
if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return systemVisible;
|
|
166
|
+
}
|
|
167
|
+
function applyPreferencesToColumns(systemColumns, preferences) {
|
|
168
|
+
var _a;
|
|
169
|
+
let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
|
|
170
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
171
|
+
// Compute visibility based on system + user preferences
|
|
172
|
+
visible: computeColumnVisibility(col, preferences)
|
|
173
|
+
})
|
|
174
|
+
}));
|
|
175
|
+
if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
|
|
176
|
+
const orderMap = new Map(
|
|
177
|
+
preferences.columnOrder.map((id, index) => [id, index])
|
|
178
|
+
);
|
|
179
|
+
columns = columns.sort((a, b) => {
|
|
180
|
+
var _a2, _b;
|
|
181
|
+
const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
182
|
+
const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
|
|
183
|
+
if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
return orderA - orderB;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (preferences == null ? void 0 : preferences.columnWidths) {
|
|
190
|
+
columns = columns.map((col) => {
|
|
191
|
+
var _a2;
|
|
192
|
+
const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
|
|
193
|
+
if (width !== void 0) {
|
|
194
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
195
|
+
size: width
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return col;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return columns;
|
|
202
|
+
}
|
|
203
|
+
function extractColumnOrder(columns) {
|
|
204
|
+
return columns.filter((c) => c.id).map((c) => c.id);
|
|
205
|
+
}
|
|
206
|
+
function extractVisibilityChanges(columns, systemColumns) {
|
|
207
|
+
const hiddenByUser = [];
|
|
208
|
+
const shownByUser = [];
|
|
209
|
+
columns.forEach((col) => {
|
|
210
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
211
|
+
if (!col.id) return;
|
|
212
|
+
const systemCol = systemColumns.find((c) => c.id === col.id);
|
|
213
|
+
if (!systemCol) return;
|
|
214
|
+
const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
215
|
+
const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
|
|
216
|
+
const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
|
|
217
|
+
if (!canToggle) return;
|
|
218
|
+
if (systemVisible && !currentVisible) {
|
|
219
|
+
hiddenByUser.push(col.id);
|
|
220
|
+
} else if (!systemVisible && currentVisible) {
|
|
221
|
+
if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
|
|
222
|
+
shownByUser.push(col.id);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return { hiddenByUser, shownByUser };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
230
|
+
var hasCleanedLegacyDataThisSession = false;
|
|
231
|
+
function useTableLayout(initialColumns, key, autosync = true) {
|
|
232
|
+
const [preferences, setPreferences] = useState(null);
|
|
233
|
+
const [columns, setColumnsState] = useState(
|
|
234
|
+
() => (
|
|
235
|
+
// Initialize with system columns (no preferences applied yet)
|
|
236
|
+
initialColumns.map((col) => __spreadValues({}, col))
|
|
237
|
+
)
|
|
238
|
+
);
|
|
239
|
+
const [isReady, setIsReady] = useState(false);
|
|
240
|
+
const keyRef = useRef(key);
|
|
241
|
+
const initialColumnsRef = useRef(initialColumns);
|
|
242
|
+
const preferencesRef = useRef(preferences);
|
|
243
|
+
const autosyncRef = useRef(autosync);
|
|
244
|
+
useEffect3(() => {
|
|
245
|
+
keyRef.current = key;
|
|
246
|
+
}, [key]);
|
|
247
|
+
useEffect3(() => {
|
|
248
|
+
initialColumnsRef.current = initialColumns;
|
|
249
|
+
}, [initialColumns]);
|
|
250
|
+
useEffect3(() => {
|
|
251
|
+
preferencesRef.current = preferences;
|
|
252
|
+
}, [preferences]);
|
|
253
|
+
useEffect3(() => {
|
|
254
|
+
autosyncRef.current = autosync;
|
|
255
|
+
}, [autosync]);
|
|
256
|
+
useEffect3(() => {
|
|
257
|
+
if (typeof window === "undefined") return;
|
|
258
|
+
if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
|
|
259
|
+
clearAllLegacyData();
|
|
260
|
+
markLegacyMigrationComplete();
|
|
261
|
+
hasCleanedLegacyDataThisSession = true;
|
|
262
|
+
}
|
|
263
|
+
}, []);
|
|
264
|
+
useEffect3(() => {
|
|
265
|
+
if (!autosync) {
|
|
266
|
+
setIsReady(true);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (!key) {
|
|
270
|
+
setIsReady(true);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const savedPrefs = loadPreferences(key);
|
|
274
|
+
setPreferences(savedPrefs);
|
|
275
|
+
const computedColumns = applyPreferencesToColumns(
|
|
276
|
+
initialColumns,
|
|
277
|
+
savedPrefs
|
|
278
|
+
);
|
|
279
|
+
setColumnsState(computedColumns);
|
|
280
|
+
setIsReady(true);
|
|
281
|
+
}, [key, autosync]);
|
|
282
|
+
useEffect3(() => {
|
|
283
|
+
if (!isReady) return;
|
|
284
|
+
const computedColumns = applyPreferencesToColumns(
|
|
285
|
+
initialColumns,
|
|
286
|
+
preferencesRef.current
|
|
287
|
+
);
|
|
288
|
+
setColumnsState(computedColumns);
|
|
289
|
+
}, [initialColumns, isReady]);
|
|
290
|
+
const persistPreferences = useCallback(
|
|
291
|
+
(newPrefs) => {
|
|
292
|
+
if (!keyRef.current) return;
|
|
293
|
+
const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
|
|
294
|
+
version: 2
|
|
295
|
+
});
|
|
296
|
+
setPreferences(updated);
|
|
297
|
+
if (autosyncRef.current) {
|
|
298
|
+
savePreferences(keyRef.current, updated);
|
|
299
|
+
}
|
|
300
|
+
const computedColumns = applyPreferencesToColumns(
|
|
301
|
+
initialColumnsRef.current,
|
|
302
|
+
updated
|
|
303
|
+
);
|
|
304
|
+
setColumnsState(computedColumns);
|
|
305
|
+
},
|
|
306
|
+
[]
|
|
307
|
+
);
|
|
308
|
+
const hideColumn = useCallback(
|
|
309
|
+
(columnId) => {
|
|
310
|
+
var _a, _b;
|
|
311
|
+
const currentPrefs = preferencesRef.current;
|
|
312
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
313
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
314
|
+
const newShown = currentShown.filter((id) => id !== columnId);
|
|
315
|
+
const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
|
|
316
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
317
|
+
hiddenByUser: newHidden,
|
|
318
|
+
shownByUser: newShown
|
|
319
|
+
}));
|
|
320
|
+
},
|
|
321
|
+
[persistPreferences]
|
|
322
|
+
);
|
|
323
|
+
const showColumn = useCallback(
|
|
324
|
+
(columnId) => {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
const currentPrefs = preferencesRef.current;
|
|
327
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
328
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
329
|
+
const newHidden = currentHidden.filter((id) => id !== columnId);
|
|
330
|
+
const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
|
|
331
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
332
|
+
hiddenByUser: newHidden,
|
|
333
|
+
shownByUser: newShown
|
|
334
|
+
}));
|
|
335
|
+
},
|
|
336
|
+
[persistPreferences]
|
|
337
|
+
);
|
|
338
|
+
const reorderColumns = useCallback(
|
|
339
|
+
(columnIds) => {
|
|
340
|
+
persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
|
|
341
|
+
columnOrder: columnIds
|
|
342
|
+
}));
|
|
343
|
+
},
|
|
344
|
+
[persistPreferences]
|
|
345
|
+
);
|
|
346
|
+
const setColumnWidth = useCallback(
|
|
347
|
+
(columnId, width) => {
|
|
348
|
+
var _a;
|
|
349
|
+
const currentPrefs = preferencesRef.current;
|
|
350
|
+
const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
|
|
351
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
352
|
+
columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
|
|
353
|
+
}));
|
|
354
|
+
},
|
|
355
|
+
[persistPreferences]
|
|
356
|
+
);
|
|
357
|
+
const resetToDefaults = useCallback(() => {
|
|
358
|
+
if (!keyRef.current) return;
|
|
359
|
+
clearPreferences(keyRef.current);
|
|
360
|
+
setPreferences(null);
|
|
361
|
+
const computedColumns = applyPreferencesToColumns(
|
|
362
|
+
initialColumnsRef.current,
|
|
363
|
+
null
|
|
364
|
+
);
|
|
365
|
+
setColumnsState(computedColumns);
|
|
366
|
+
}, []);
|
|
367
|
+
const getUserPreferences = useCallback(() => {
|
|
368
|
+
var _a;
|
|
369
|
+
return (_a = preferencesRef.current) != null ? _a : { version: 2 };
|
|
370
|
+
}, []);
|
|
371
|
+
const getSavedLayout = useCallback(() => {
|
|
372
|
+
return columns;
|
|
373
|
+
}, [columns]);
|
|
374
|
+
const setColumns = useCallback(
|
|
375
|
+
(setter) => {
|
|
376
|
+
setColumnsState((prev) => {
|
|
377
|
+
var _a, _b, _c, _d;
|
|
378
|
+
const newColumns = typeof setter === "function" ? setter(prev) : setter;
|
|
379
|
+
const newOrder = extractColumnOrder(newColumns);
|
|
380
|
+
const { hiddenByUser, shownByUser } = extractVisibilityChanges(
|
|
381
|
+
newColumns,
|
|
382
|
+
initialColumnsRef.current
|
|
383
|
+
);
|
|
384
|
+
const existingPrefs = preferencesRef.current;
|
|
385
|
+
const mergedHidden = Array.from(
|
|
386
|
+
/* @__PURE__ */ new Set([
|
|
387
|
+
...hiddenByUser,
|
|
388
|
+
// Keep existing hidden prefs for columns that are still hidden
|
|
389
|
+
...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
|
|
390
|
+
var _a2;
|
|
391
|
+
const col = newColumns.find((c) => c.id === id);
|
|
392
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
|
|
393
|
+
})) != null ? _b : []
|
|
394
|
+
])
|
|
395
|
+
);
|
|
396
|
+
const mergedShown = Array.from(
|
|
397
|
+
/* @__PURE__ */ new Set([
|
|
398
|
+
...shownByUser,
|
|
399
|
+
// Keep existing shown prefs for columns that are still visible
|
|
400
|
+
...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
|
|
401
|
+
var _a2;
|
|
402
|
+
const col = newColumns.find((c) => c.id === id);
|
|
403
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
|
|
404
|
+
})) != null ? _d : []
|
|
405
|
+
])
|
|
406
|
+
);
|
|
407
|
+
if (keyRef.current && autosync) {
|
|
408
|
+
const newPrefs = {
|
|
409
|
+
columnOrder: newOrder,
|
|
410
|
+
hiddenByUser: mergedHidden,
|
|
411
|
+
shownByUser: mergedShown,
|
|
412
|
+
columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
|
|
413
|
+
version: 2
|
|
414
|
+
};
|
|
415
|
+
setPreferences(newPrefs);
|
|
416
|
+
savePreferences(keyRef.current, newPrefs);
|
|
417
|
+
}
|
|
418
|
+
return newColumns;
|
|
419
|
+
});
|
|
420
|
+
},
|
|
421
|
+
[autosync]
|
|
422
|
+
);
|
|
423
|
+
return {
|
|
424
|
+
columns,
|
|
425
|
+
setColumns,
|
|
426
|
+
isReady,
|
|
427
|
+
getSavedLayout,
|
|
428
|
+
hideColumn,
|
|
429
|
+
showColumn,
|
|
430
|
+
reorderColumns,
|
|
431
|
+
setColumnWidth,
|
|
432
|
+
resetToDefaults,
|
|
433
|
+
getUserPreferences
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// src/hooks/useEditCell.tsx
|
|
438
|
+
import { useRef as useRef2, useState as useState2 } from "react";
|
|
439
|
+
function useEditCell(initialValue) {
|
|
440
|
+
const [value, setValue] = useState2(initialValue);
|
|
441
|
+
const [isEdit, setIsEdit] = useState2(false);
|
|
442
|
+
const inputRef = useRef2(null);
|
|
443
|
+
function changeToEditMode() {
|
|
444
|
+
setIsEdit(true);
|
|
445
|
+
requestAnimationFrame(() => {
|
|
446
|
+
var _a;
|
|
447
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function changeToViewMode() {
|
|
451
|
+
setIsEdit(false);
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
value,
|
|
455
|
+
setValue,
|
|
456
|
+
isEdit,
|
|
457
|
+
inputRef,
|
|
458
|
+
changeToEditMode,
|
|
459
|
+
changeToViewMode
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export {
|
|
464
|
+
useKeydown,
|
|
465
|
+
useInfiniteScroll,
|
|
466
|
+
useTableLayout,
|
|
467
|
+
useEditCell
|
|
468
|
+
};
|
|
@@ -255,7 +255,8 @@ var Button = (_a) => {
|
|
|
255
255
|
href,
|
|
256
256
|
id,
|
|
257
257
|
testid,
|
|
258
|
-
isLoading
|
|
258
|
+
isLoading,
|
|
259
|
+
fontNormal = false
|
|
259
260
|
} = _b, props = __objRest(_b, [
|
|
260
261
|
"variant",
|
|
261
262
|
"as",
|
|
@@ -271,7 +272,8 @@ var Button = (_a) => {
|
|
|
271
272
|
"href",
|
|
272
273
|
"id",
|
|
273
274
|
"testid",
|
|
274
|
-
"isLoading"
|
|
275
|
+
"isLoading",
|
|
276
|
+
"fontNormal"
|
|
275
277
|
]);
|
|
276
278
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx2.default)(
|
|
277
279
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -298,6 +300,15 @@ var Button = (_a) => {
|
|
|
298
300
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
299
301
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
300
302
|
);
|
|
303
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx2.default)(
|
|
304
|
+
"bg-transparent border-transparent",
|
|
305
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
306
|
+
"bg-transparent border-transparent",
|
|
307
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
308
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
309
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
310
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
311
|
+
);
|
|
301
312
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx2.default)(
|
|
302
313
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
303
314
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -341,6 +352,7 @@ var Button = (_a) => {
|
|
|
341
352
|
primaryVariantStyles,
|
|
342
353
|
secondaryVariantStyles,
|
|
343
354
|
tertiaryVariantStyles,
|
|
355
|
+
quarternaryOutlinedVariantStyles,
|
|
344
356
|
primaryCriticalVariantStyles,
|
|
345
357
|
secondaryCriticalVariantStyles,
|
|
346
358
|
tertiaryCriticalVariantStyles,
|
|
@@ -351,6 +363,7 @@ var Button = (_a) => {
|
|
|
351
363
|
const labelClasses = (0, import_clsx2.default)(
|
|
352
364
|
"min-h-6 flex items-center justify-center",
|
|
353
365
|
classNameLabel,
|
|
366
|
+
fontNormal && "font-normal!",
|
|
354
367
|
componentPaddingXUsingComponentGap,
|
|
355
368
|
typography.buttonLabel
|
|
356
369
|
);
|
package/dist/components/Alert.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Alert
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-6FZNEFN3.js";
|
|
4
4
|
import "../chunk-MXSJF6TW.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-ZMTHWJ7F.js";
|
|
6
6
|
import "../chunk-SBRRNFOP.js";
|
|
7
7
|
import "../chunk-BGBIXG5Y.js";
|
|
8
8
|
import "../chunk-WMPWWFUJ.js";
|
|
@@ -225,6 +225,7 @@ var Link = (_a) => {
|
|
|
225
225
|
underline = false,
|
|
226
226
|
testid,
|
|
227
227
|
active,
|
|
228
|
+
block = false,
|
|
228
229
|
addOverflow
|
|
229
230
|
} = _b, props = __objRest(_b, [
|
|
230
231
|
"as",
|
|
@@ -238,6 +239,7 @@ var Link = (_a) => {
|
|
|
238
239
|
"underline",
|
|
239
240
|
"testid",
|
|
240
241
|
"active",
|
|
242
|
+
"block",
|
|
241
243
|
"addOverflow"
|
|
242
244
|
]);
|
|
243
245
|
const Component = as;
|
|
@@ -267,7 +269,10 @@ var Link = (_a) => {
|
|
|
267
269
|
"underline decoration-[10%] underline-offset-[32%]",
|
|
268
270
|
!disabled && "hover:decoration-current",
|
|
269
271
|
!disabled && "active:decoration-decoration-underline",
|
|
270
|
-
"flex flex-col
|
|
272
|
+
"flex flex-col justify-center",
|
|
273
|
+
align === "left" && "items-start",
|
|
274
|
+
align === "center" && "items-center",
|
|
275
|
+
align === "right" && "items-end",
|
|
271
276
|
baseTransition,
|
|
272
277
|
primaryStateStyles,
|
|
273
278
|
secondaryStateStyles,
|
|
@@ -283,7 +288,8 @@ var Link = (_a) => {
|
|
|
283
288
|
align === "right" && "text-right",
|
|
284
289
|
paddingY,
|
|
285
290
|
addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden",
|
|
286
|
-
className
|
|
291
|
+
className,
|
|
292
|
+
block ? "w-full" : "w-fit"
|
|
287
293
|
)
|
|
288
294
|
}, props), {
|
|
289
295
|
style: __spreadProps(__spreadValues({}, props.style), {
|
|
@@ -252,7 +252,8 @@ var Button = (_a) => {
|
|
|
252
252
|
href,
|
|
253
253
|
id,
|
|
254
254
|
testid,
|
|
255
|
-
isLoading
|
|
255
|
+
isLoading,
|
|
256
|
+
fontNormal = false
|
|
256
257
|
} = _b, props = __objRest(_b, [
|
|
257
258
|
"variant",
|
|
258
259
|
"as",
|
|
@@ -268,7 +269,8 @@ var Button = (_a) => {
|
|
|
268
269
|
"href",
|
|
269
270
|
"id",
|
|
270
271
|
"testid",
|
|
271
|
-
"isLoading"
|
|
272
|
+
"isLoading",
|
|
273
|
+
"fontNormal"
|
|
272
274
|
]);
|
|
273
275
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx2.default)(
|
|
274
276
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -295,6 +297,15 @@ var Button = (_a) => {
|
|
|
295
297
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
296
298
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
297
299
|
);
|
|
300
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx2.default)(
|
|
301
|
+
"bg-transparent border-transparent",
|
|
302
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
303
|
+
"bg-transparent border-transparent",
|
|
304
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
305
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
306
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
307
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
308
|
+
);
|
|
298
309
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx2.default)(
|
|
299
310
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
300
311
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -338,6 +349,7 @@ var Button = (_a) => {
|
|
|
338
349
|
primaryVariantStyles,
|
|
339
350
|
secondaryVariantStyles,
|
|
340
351
|
tertiaryVariantStyles,
|
|
352
|
+
quarternaryOutlinedVariantStyles,
|
|
341
353
|
primaryCriticalVariantStyles,
|
|
342
354
|
secondaryCriticalVariantStyles,
|
|
343
355
|
tertiaryCriticalVariantStyles,
|
|
@@ -348,6 +360,7 @@ var Button = (_a) => {
|
|
|
348
360
|
const labelClasses = (0, import_clsx2.default)(
|
|
349
361
|
"min-h-6 flex items-center justify-center",
|
|
350
362
|
classNameLabel,
|
|
363
|
+
fontNormal && "font-normal!",
|
|
351
364
|
componentPaddingXUsingComponentGap,
|
|
352
365
|
typography.buttonLabel
|
|
353
366
|
);
|