@heymantle/litho 0.0.13 → 0.0.15
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/README.md +52 -0
- package/dist/cjs/components/Card.js +1 -1
- package/dist/cjs/components/Disclosure.js +46 -15
- package/dist/cjs/components/DropZone.js +93 -37
- package/dist/cjs/components/Layout.js +4 -2
- package/dist/cjs/components/Modal.js +14 -3
- package/dist/cjs/components/Navigation.js +4 -3
- package/dist/cjs/components/Popover.js +58 -13
- package/dist/cjs/components/Select.js +4 -0
- package/dist/cjs/components/TabNavigation.js +65 -11
- package/dist/cjs/components/Table.js +27 -11
- package/dist/cjs/components/Tabs.js +33 -2
- package/dist/cjs/components/TextField.js +4 -2
- package/dist/cjs/components/ToastNotification.js +368 -0
- package/dist/cjs/components/ToastProvider.js +342 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/playwright.config.js +114 -0
- package/dist/cjs/styles/Table.js +2 -7
- package/dist/cjs/tests/visual/stories.spec.js +637 -0
- package/dist/cjs/utilities/dates.js +7 -7
- package/dist/esm/components/Card.js +1 -1
- package/dist/esm/components/Disclosure.js +36 -5
- package/dist/esm/components/DropZone.js +94 -38
- package/dist/esm/components/Layout.js +4 -2
- package/dist/esm/components/Modal.js +14 -3
- package/dist/esm/components/Navigation.js +4 -3
- package/dist/esm/components/Popover.js +58 -13
- package/dist/esm/components/Select.js +5 -1
- package/dist/esm/components/TabNavigation.js +65 -11
- package/dist/esm/components/Table.js +27 -11
- package/dist/esm/components/Tabs.js +33 -2
- package/dist/esm/components/TextField.js +4 -2
- package/dist/esm/components/ToastNotification.js +353 -0
- package/dist/esm/components/ToastProvider.js +336 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/playwright.config.js +104 -0
- package/dist/esm/styles/Table.js +2 -7
- package/dist/esm/tests/visual/stories.spec.js +633 -0
- package/dist/esm/utilities/dates.js +7 -7
- package/dist/types/components/Disclosure.d.ts.map +1 -1
- package/dist/types/components/DropZone.d.ts +2 -0
- package/dist/types/components/DropZone.d.ts.map +1 -1
- package/dist/types/components/Layout.d.ts.map +1 -1
- package/dist/types/components/Modal.d.ts.map +1 -1
- package/dist/types/components/Navigation.d.ts +1 -0
- package/dist/types/components/Navigation.d.ts.map +1 -1
- package/dist/types/components/Popover.d.ts +2 -0
- package/dist/types/components/Popover.d.ts.map +1 -1
- package/dist/types/components/Select.d.ts.map +1 -1
- package/dist/types/components/TabNavigation.d.ts.map +1 -1
- package/dist/types/components/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs.d.ts +45 -1
- package/dist/types/components/Tabs.d.ts.map +1 -1
- package/dist/types/components/TextField.d.ts +2 -0
- package/dist/types/components/TextField.d.ts.map +1 -1
- package/dist/types/components/ToastNotification.d.ts +36 -0
- package/dist/types/components/ToastNotification.d.ts.map +1 -0
- package/dist/types/components/ToastProvider.d.ts +21 -0
- package/dist/types/components/ToastProvider.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/styles/Table.d.ts.map +1 -1
- package/index.css +3 -0
- package/package.json +12 -3
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
get default () {
|
|
14
|
+
return _default;
|
|
15
|
+
},
|
|
16
|
+
get useToast () {
|
|
17
|
+
return useToast;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
21
|
+
var _react = require("react");
|
|
22
|
+
var _reactdom = require("react-dom");
|
|
23
|
+
var _ToastNotification = /*#__PURE__*/ _interop_require_default(require("./ToastNotification"));
|
|
24
|
+
var _Frame = require("./Frame");
|
|
25
|
+
var _Stack = /*#__PURE__*/ _interop_require_default(require("./Stack"));
|
|
26
|
+
function _array_like_to_array(arr, len) {
|
|
27
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
28
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
29
|
+
return arr2;
|
|
30
|
+
}
|
|
31
|
+
function _array_with_holes(arr) {
|
|
32
|
+
if (Array.isArray(arr)) return arr;
|
|
33
|
+
}
|
|
34
|
+
function _array_without_holes(arr) {
|
|
35
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
36
|
+
}
|
|
37
|
+
function _interop_require_default(obj) {
|
|
38
|
+
return obj && obj.__esModule ? obj : {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _iterable_to_array(iter) {
|
|
43
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
44
|
+
}
|
|
45
|
+
function _iterable_to_array_limit(arr, i) {
|
|
46
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
47
|
+
if (_i == null) return;
|
|
48
|
+
var _arr = [];
|
|
49
|
+
var _n = true;
|
|
50
|
+
var _d = false;
|
|
51
|
+
var _s, _e;
|
|
52
|
+
try {
|
|
53
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
54
|
+
_arr.push(_s.value);
|
|
55
|
+
if (i && _arr.length === i) break;
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_d = true;
|
|
59
|
+
_e = err;
|
|
60
|
+
} finally{
|
|
61
|
+
try {
|
|
62
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
63
|
+
} finally{
|
|
64
|
+
if (_d) throw _e;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return _arr;
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _non_iterable_spread() {
|
|
73
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
|
+
}
|
|
75
|
+
function _sliced_to_array(arr, i) {
|
|
76
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
77
|
+
}
|
|
78
|
+
function _to_consumable_array(arr) {
|
|
79
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
80
|
+
}
|
|
81
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
82
|
+
if (!o) return;
|
|
83
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
84
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
85
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
86
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
87
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
88
|
+
}
|
|
89
|
+
var ToastContext = /*#__PURE__*/ (0, _react.createContext)(null);
|
|
90
|
+
var useToast = function() {
|
|
91
|
+
var context = (0, _react.useContext)(ToastContext);
|
|
92
|
+
if (!context) {
|
|
93
|
+
// Return a no-op function if used outside provider
|
|
94
|
+
return {
|
|
95
|
+
show: function() {
|
|
96
|
+
console.warn("useToast must be used within a ToastProvider");
|
|
97
|
+
},
|
|
98
|
+
dismiss: function() {},
|
|
99
|
+
dismissAll: function() {}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return context;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* ToastProvider component that manages multiple toast notifications.
|
|
106
|
+
* Handles stacking and positioning of multiple toasts.
|
|
107
|
+
*
|
|
108
|
+
* @component
|
|
109
|
+
* @param {Object} props - The component props.
|
|
110
|
+
* @param {React.ReactNode} props.children - Child components that can use the toast system.
|
|
111
|
+
* @param {'topRight' | 'topLeft' | 'topCenter' | 'bottomRight' | 'bottomLeft' | 'bottomCenter'} [props.defaultPosition='topRight'] - Default position for toasts.
|
|
112
|
+
* @param {number} [props.maxToasts=5] - Maximum number of toasts to display at once.
|
|
113
|
+
* @param {number} [props.stackGap=2] - Gap in pixels between stacked toasts.
|
|
114
|
+
* @returns {JSX.Element} The provider component.
|
|
115
|
+
*/ function ToastProvider(param) {
|
|
116
|
+
var children = param.children, _param_defaultPosition = param.defaultPosition, defaultPosition = _param_defaultPosition === void 0 ? "topRight" : _param_defaultPosition, _param_maxToasts = param.maxToasts, maxToasts = _param_maxToasts === void 0 ? 5 : _param_maxToasts, _param_stackGap = param.stackGap, stackGap = _param_stackGap === void 0 ? 2 : _param_stackGap;
|
|
117
|
+
var _useState = _sliced_to_array((0, _react.useState)([]), 2), toasts = _useState[0], setToasts = _useState[1];
|
|
118
|
+
var _useState1 = _sliced_to_array((0, _react.useState)([]), 2), dismissingToasts = _useState1[0], setDismissingToasts = _useState1[1];
|
|
119
|
+
var _useState2 = _sliced_to_array((0, _react.useState)(null), 2), container = _useState2[0], setContainer = _useState2[1];
|
|
120
|
+
var paneIsOpen = (0, _Frame.useFrame)().paneIsOpen;
|
|
121
|
+
// Create portal container on mount
|
|
122
|
+
(0, _react.useEffect)(function() {
|
|
123
|
+
if (typeof window !== "undefined") {
|
|
124
|
+
var div = document.createElement("div");
|
|
125
|
+
div.className = "Litho-ToastProvider";
|
|
126
|
+
div.setAttribute("data-toast-container", "true");
|
|
127
|
+
document.body.appendChild(div);
|
|
128
|
+
setContainer(div);
|
|
129
|
+
return function() {
|
|
130
|
+
if (document.body.contains(div)) {
|
|
131
|
+
document.body.removeChild(div);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}, []);
|
|
136
|
+
var show = (0, _react.useCallback)(function() {
|
|
137
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
138
|
+
var prefix = options.prefix, icon = options.icon, title = options.title, subtitle = options.subtitle, _options_duration = options.duration, duration = _options_duration === void 0 ? 2000 : _options_duration, _options_position = options.position, position = _options_position === void 0 ? defaultPosition : _options_position, _options_dismissible = options.dismissible, dismissible = _options_dismissible === void 0 ? true : _options_dismissible, onDismiss = options.onDismiss, onClick = options.onClick, id = options.id;
|
|
139
|
+
if (!title) {
|
|
140
|
+
console.warn("Toast requires a title");
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
var toastId = id || "toast-".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
|
|
144
|
+
setToasts(function(prev) {
|
|
145
|
+
// Limit number of toasts
|
|
146
|
+
var newToasts = _to_consumable_array(prev).concat([
|
|
147
|
+
{
|
|
148
|
+
id: toastId,
|
|
149
|
+
prefix: prefix,
|
|
150
|
+
icon: icon,
|
|
151
|
+
title: title,
|
|
152
|
+
subtitle: subtitle,
|
|
153
|
+
duration: duration,
|
|
154
|
+
position: position,
|
|
155
|
+
dismissible: dismissible,
|
|
156
|
+
onDismiss: onDismiss,
|
|
157
|
+
onClick: onClick
|
|
158
|
+
}
|
|
159
|
+
]);
|
|
160
|
+
return newToasts.slice(-maxToasts);
|
|
161
|
+
});
|
|
162
|
+
return toastId;
|
|
163
|
+
}, [
|
|
164
|
+
defaultPosition,
|
|
165
|
+
maxToasts
|
|
166
|
+
]);
|
|
167
|
+
var dismiss = (0, _react.useCallback)(function(id) {
|
|
168
|
+
// Move toast to dismissing state for exit animation, remove from active toasts immediately
|
|
169
|
+
(0, _reactdom.flushSync)(function() {
|
|
170
|
+
setToasts(function(prev) {
|
|
171
|
+
var toast = prev.find(function(t) {
|
|
172
|
+
return t.id === id;
|
|
173
|
+
});
|
|
174
|
+
if (toast) {
|
|
175
|
+
// Add to dismissing toasts for exit animation
|
|
176
|
+
setDismissingToasts(function(prevDismissing) {
|
|
177
|
+
// Avoid duplicates
|
|
178
|
+
if (prevDismissing.find(function(t) {
|
|
179
|
+
return t.id === id;
|
|
180
|
+
})) {
|
|
181
|
+
return prevDismissing;
|
|
182
|
+
}
|
|
183
|
+
return _to_consumable_array(prevDismissing).concat([
|
|
184
|
+
toast
|
|
185
|
+
]);
|
|
186
|
+
});
|
|
187
|
+
// Remove from active toasts immediately so others slide up
|
|
188
|
+
return prev.filter(function(t) {
|
|
189
|
+
return t.id !== id;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return prev;
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
// Clean up dismissing toast after animation completes
|
|
196
|
+
setTimeout(function() {
|
|
197
|
+
setDismissingToasts(function(prev) {
|
|
198
|
+
return prev.filter(function(t) {
|
|
199
|
+
return t.id !== id;
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}, 300); // Match transition duration
|
|
203
|
+
}, []);
|
|
204
|
+
var dismissAll = (0, _react.useCallback)(function() {
|
|
205
|
+
setToasts([]);
|
|
206
|
+
}, []);
|
|
207
|
+
var handleToastDismiss = (0, _react.useCallback)(function(id, onDismiss) {
|
|
208
|
+
// Remove from state immediately so other toasts can slide up
|
|
209
|
+
dismiss(id);
|
|
210
|
+
// Call onDismiss callback after a brief delay to allow exit animation to start
|
|
211
|
+
if (onDismiss) {
|
|
212
|
+
setTimeout(function() {
|
|
213
|
+
onDismiss();
|
|
214
|
+
}, 0);
|
|
215
|
+
}
|
|
216
|
+
}, [
|
|
217
|
+
dismiss
|
|
218
|
+
]);
|
|
219
|
+
// Group toasts by position
|
|
220
|
+
var toastsByPosition = toasts.reduce(function(acc, toast) {
|
|
221
|
+
var position = toast.position || defaultPosition;
|
|
222
|
+
if (!acc[position]) {
|
|
223
|
+
acc[position] = [];
|
|
224
|
+
}
|
|
225
|
+
acc[position].push(toast);
|
|
226
|
+
return acc;
|
|
227
|
+
}, {});
|
|
228
|
+
if (!container) {
|
|
229
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
230
|
+
children: children
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(ToastContext.Provider, {
|
|
234
|
+
value: {
|
|
235
|
+
show: show,
|
|
236
|
+
dismiss: dismiss,
|
|
237
|
+
dismissAll: dismissAll
|
|
238
|
+
},
|
|
239
|
+
children: [
|
|
240
|
+
children,
|
|
241
|
+
/*#__PURE__*/ (0, _reactdom.createPortal)(/*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
242
|
+
children: [
|
|
243
|
+
dismissingToasts.map(function(toast) {
|
|
244
|
+
var position = toast.position || defaultPosition;
|
|
245
|
+
var isTop = position.startsWith("top");
|
|
246
|
+
var isBottom = position.startsWith("bottom");
|
|
247
|
+
var dismissingStyle = {
|
|
248
|
+
position: "fixed",
|
|
249
|
+
zIndex: 9998
|
|
250
|
+
};
|
|
251
|
+
if (isTop) {
|
|
252
|
+
dismissingStyle.top = "calc(12px + var(--litho-header-height))";
|
|
253
|
+
} else if (isBottom) {
|
|
254
|
+
dismissingStyle.bottom = "12px";
|
|
255
|
+
}
|
|
256
|
+
if (position.includes("Right")) {
|
|
257
|
+
if (paneIsOpen) {
|
|
258
|
+
dismissingStyle.right = "calc(12px + var(--litho-pane-width))";
|
|
259
|
+
} else {
|
|
260
|
+
dismissingStyle.right = "12px";
|
|
261
|
+
}
|
|
262
|
+
} else if (position.includes("Left")) {
|
|
263
|
+
dismissingStyle.left = "12px";
|
|
264
|
+
} else if (position.includes("Center")) {
|
|
265
|
+
dismissingStyle.left = "50%";
|
|
266
|
+
dismissingStyle.transform = "translateX(-50%)";
|
|
267
|
+
}
|
|
268
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
269
|
+
style: dismissingStyle,
|
|
270
|
+
className: "Litho-ToastProvider__DismissingToast",
|
|
271
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ToastNotification.default, {
|
|
272
|
+
prefix: toast.prefix,
|
|
273
|
+
icon: toast.icon,
|
|
274
|
+
title: toast.title,
|
|
275
|
+
subtitle: toast.subtitle,
|
|
276
|
+
duration: 0,
|
|
277
|
+
position: toast.position || defaultPosition,
|
|
278
|
+
dismissible: false,
|
|
279
|
+
fixed: false,
|
|
280
|
+
isDismissing: true,
|
|
281
|
+
onClick: toast.onClick,
|
|
282
|
+
onDismiss: function() {}
|
|
283
|
+
})
|
|
284
|
+
}, "dismissing-".concat(toast.id));
|
|
285
|
+
}),
|
|
286
|
+
Object.entries(toastsByPosition).map(function(param) {
|
|
287
|
+
var _param = _sliced_to_array(param, 2), position = _param[0], positionToasts = _param[1];
|
|
288
|
+
var isTop = position.startsWith("top");
|
|
289
|
+
var isBottom = position.startsWith("bottom");
|
|
290
|
+
var isCenter = position.includes("Center");
|
|
291
|
+
var containerStyle = {
|
|
292
|
+
position: "fixed",
|
|
293
|
+
zIndex: 9999
|
|
294
|
+
};
|
|
295
|
+
if (isTop) {
|
|
296
|
+
containerStyle.top = "calc(12px + var(--litho-header-height))"; // top-4
|
|
297
|
+
} else if (isBottom) {
|
|
298
|
+
containerStyle.bottom = "12px"; // bottom-4
|
|
299
|
+
}
|
|
300
|
+
if (position.includes("Right")) {
|
|
301
|
+
// Adjust right position when pane is open to avoid covering the pane
|
|
302
|
+
if (paneIsOpen) {
|
|
303
|
+
containerStyle.right = "calc(12px + var(--litho-pane-width))";
|
|
304
|
+
} else {
|
|
305
|
+
containerStyle.right = "12px";
|
|
306
|
+
}
|
|
307
|
+
} else if (position.includes("Left")) {
|
|
308
|
+
containerStyle.left = "12px";
|
|
309
|
+
} else if (position.includes("Center")) {
|
|
310
|
+
containerStyle.left = "50%";
|
|
311
|
+
containerStyle.transform = "translateX(-50%)";
|
|
312
|
+
}
|
|
313
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
314
|
+
style: containerStyle,
|
|
315
|
+
className: "Litho-ToastProvider__Container",
|
|
316
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Stack.default, {
|
|
317
|
+
gap: stackGap,
|
|
318
|
+
children: positionToasts.map(function(toast, index) {
|
|
319
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ToastNotification.default, {
|
|
320
|
+
prefix: toast.prefix,
|
|
321
|
+
icon: toast.icon,
|
|
322
|
+
title: toast.title,
|
|
323
|
+
subtitle: toast.subtitle,
|
|
324
|
+
duration: toast.duration,
|
|
325
|
+
position: toast.position || defaultPosition,
|
|
326
|
+
dismissible: toast.dismissible,
|
|
327
|
+
fixed: false,
|
|
328
|
+
onClick: toast.onClick,
|
|
329
|
+
onDismiss: function() {
|
|
330
|
+
return handleToastDismiss(toast.id, toast.onDismiss);
|
|
331
|
+
}
|
|
332
|
+
}, toast.id);
|
|
333
|
+
})
|
|
334
|
+
})
|
|
335
|
+
}, position);
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}), container)
|
|
339
|
+
]
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
var _default = ToastProvider;
|
package/dist/cjs/index.js
CHANGED
|
@@ -192,6 +192,12 @@ _export(exports, {
|
|
|
192
192
|
get Tip () {
|
|
193
193
|
return _Tip.default;
|
|
194
194
|
},
|
|
195
|
+
get ToastNotification () {
|
|
196
|
+
return _ToastNotification.default;
|
|
197
|
+
},
|
|
198
|
+
get ToastProvider () {
|
|
199
|
+
return _ToastProvider.default;
|
|
200
|
+
},
|
|
195
201
|
get Tooltip () {
|
|
196
202
|
return _Tooltip.default;
|
|
197
203
|
},
|
|
@@ -206,6 +212,9 @@ _export(exports, {
|
|
|
206
212
|
},
|
|
207
213
|
get useIndexResourceState () {
|
|
208
214
|
return _useIndexResourceState.useIndexResourceState;
|
|
215
|
+
},
|
|
216
|
+
get useToast () {
|
|
217
|
+
return _ToastProvider.useToast;
|
|
209
218
|
}
|
|
210
219
|
});
|
|
211
220
|
var _ActionList = /*#__PURE__*/ _interop_require_default(require("./components/ActionList"));
|
|
@@ -268,6 +277,8 @@ var _TextField = /*#__PURE__*/ _interop_require_default(require("./components/Te
|
|
|
268
277
|
var _Thumbnail = /*#__PURE__*/ _interop_require_default(require("./components/Thumbnail"));
|
|
269
278
|
var _TimePicker = /*#__PURE__*/ _interop_require_default(require("./components/TimePicker"));
|
|
270
279
|
var _Tip = /*#__PURE__*/ _interop_require_default(require("./components/Tip"));
|
|
280
|
+
var _ToastNotification = /*#__PURE__*/ _interop_require_default(require("./components/ToastNotification"));
|
|
281
|
+
var _ToastProvider = /*#__PURE__*/ _interop_require_wildcard(require("./components/ToastProvider"));
|
|
271
282
|
var _Tooltip = /*#__PURE__*/ _interop_require_default(require("./components/Tooltip"));
|
|
272
283
|
var _TopBar = /*#__PURE__*/ _interop_require_default(require("./components/TopBar"));
|
|
273
284
|
var _VerticalStack = /*#__PURE__*/ _interop_require_default(require("./components/VerticalStack"));
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _test = require("@playwright/test");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
function _object_spread(target) {
|
|
26
|
+
for(var i = 1; i < arguments.length; i++){
|
|
27
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
28
|
+
var ownKeys = Object.keys(source);
|
|
29
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
30
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
31
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
ownKeys.forEach(function(key) {
|
|
35
|
+
_define_property(target, key, source[key]);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return target;
|
|
39
|
+
}
|
|
40
|
+
function ownKeys(object, enumerableOnly) {
|
|
41
|
+
var keys = Object.keys(object);
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
44
|
+
if (enumerableOnly) {
|
|
45
|
+
symbols = symbols.filter(function(sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
keys.push.apply(keys, symbols);
|
|
50
|
+
}
|
|
51
|
+
return keys;
|
|
52
|
+
}
|
|
53
|
+
function _object_spread_props(target, source) {
|
|
54
|
+
source = source != null ? source : {};
|
|
55
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
56
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
57
|
+
} else {
|
|
58
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
59
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
64
|
+
var _default = (0, _test.defineConfig)({
|
|
65
|
+
testDir: './tests/visual',
|
|
66
|
+
// Run tests in parallel
|
|
67
|
+
fullyParallel: true,
|
|
68
|
+
// Fail the build on CI if you accidentally left test.only in the source code
|
|
69
|
+
forbidOnly: !!process.env.CI,
|
|
70
|
+
// Retry failed tests on CI
|
|
71
|
+
retries: process.env.CI ? 2 : 0,
|
|
72
|
+
// Limit parallel workers on CI
|
|
73
|
+
workers: process.env.CI ? 1 : undefined,
|
|
74
|
+
// Reporter configuration
|
|
75
|
+
reporter: process.env.CI ? 'github' : 'list',
|
|
76
|
+
// Shared settings for all projects
|
|
77
|
+
use: {
|
|
78
|
+
// Base URL for Storybook
|
|
79
|
+
baseURL: 'http://127.0.0.1:6006',
|
|
80
|
+
// Capture trace on failure
|
|
81
|
+
trace: 'on-first-retry'
|
|
82
|
+
},
|
|
83
|
+
// Snapshot naming - remove platform suffix for cross-platform baselines
|
|
84
|
+
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}',
|
|
85
|
+
// Visual comparison settings
|
|
86
|
+
expect: {
|
|
87
|
+
toHaveScreenshot: {
|
|
88
|
+
// Allow differences for anti-aliasing and sub-pixel text positioning
|
|
89
|
+
maxDiffPixelRatio: 0.04,
|
|
90
|
+
// Animation settings
|
|
91
|
+
animations: 'disabled'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// Configure projects for major browsers
|
|
95
|
+
projects: [
|
|
96
|
+
{
|
|
97
|
+
name: 'chromium',
|
|
98
|
+
use: _object_spread_props(_object_spread({}, _test.devices['Desktop Chrome']), {
|
|
99
|
+
// Consistent viewport
|
|
100
|
+
viewport: {
|
|
101
|
+
width: 1280,
|
|
102
|
+
height: 720
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
// Web server configuration - start Storybook before running tests
|
|
108
|
+
webServer: {
|
|
109
|
+
command: 'npm run storybook -- --ci --quiet',
|
|
110
|
+
url: 'http://127.0.0.1:6006',
|
|
111
|
+
reuseExistingServer: !process.env.CI,
|
|
112
|
+
timeout: 120000
|
|
113
|
+
}
|
|
114
|
+
});
|
package/dist/cjs/styles/Table.js
CHANGED
|
@@ -34,7 +34,7 @@ var headingStyles = (0, _tailwindvariants.tv)({
|
|
|
34
34
|
base: "Litho-Table-Heading py-0 px-2 @md:first:pl-3 whitespace-nowrap font-semibold! text-high text-sm dark:text-normal",
|
|
35
35
|
variants: {
|
|
36
36
|
hidden: {
|
|
37
|
-
true: "hidden opacity-0 pointer-events-none @md:
|
|
37
|
+
true: "hidden opacity-0 pointer-events-none @md:table-cell @md:opacity-100 @md:pointer-events-auto"
|
|
38
38
|
},
|
|
39
39
|
verticalAlign: {
|
|
40
40
|
top: "align-top",
|
|
@@ -474,7 +474,7 @@ var fixedColumnsStyles = (0, _tailwindvariants.tv)({
|
|
|
474
474
|
false: ""
|
|
475
475
|
},
|
|
476
476
|
firstColumns: {
|
|
477
|
-
true: "left-0",
|
|
477
|
+
true: "left-0 hidden @md:block",
|
|
478
478
|
false: "right-0 hidden @md:block"
|
|
479
479
|
},
|
|
480
480
|
selectable: {
|
|
@@ -491,11 +491,6 @@ var fixedColumnsStyles = (0, _tailwindvariants.tv)({
|
|
|
491
491
|
}
|
|
492
492
|
},
|
|
493
493
|
compoundVariants: [
|
|
494
|
-
{
|
|
495
|
-
firstColumns: true,
|
|
496
|
-
selectable: false,
|
|
497
|
-
className: "hidden @md:block"
|
|
498
|
-
},
|
|
499
494
|
{
|
|
500
495
|
firstColumns: true,
|
|
501
496
|
canScrollLeft: true,
|