@ai-matrx/design-system 0.43.0 → 0.44.0
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/CHANGELOG.md +18 -0
- package/dist/content-transfer.cjs +39 -0
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +39 -0
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +39 -0
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +41 -2
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +39 -0
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +43 -4
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +39 -0
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +76 -37
- package/dist/data-table/index.js.map +1 -1
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -157,6 +157,15 @@ function useIsMobile() {
|
|
|
157
157
|
return isMobile;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// src/layer-front.ts
|
|
161
|
+
var LAYER_FRONT_EVENT = "matrx:layer-front";
|
|
162
|
+
function announceLayerFront(element) {
|
|
163
|
+
if (typeof document === "undefined") return;
|
|
164
|
+
document.dispatchEvent(
|
|
165
|
+
new CustomEvent(LAYER_FRONT_EVENT, { detail: { element } })
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
160
169
|
// src/dialog.tsx
|
|
161
170
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
162
171
|
var DialogWindowedByDefaultContext = React4.createContext(false);
|
|
@@ -227,6 +236,8 @@ var DialogContent = React4.forwardRef(
|
|
|
227
236
|
dismissOnOutsideClick = false,
|
|
228
237
|
onInteractOutside,
|
|
229
238
|
onEscapeKeyDown,
|
|
239
|
+
onPointerDownCapture,
|
|
240
|
+
onFocusCapture,
|
|
230
241
|
style,
|
|
231
242
|
...props
|
|
232
243
|
}, ref) => {
|
|
@@ -239,6 +250,24 @@ var DialogContent = React4.forwardRef(
|
|
|
239
250
|
const [containerEl, setContainerEl] = React4.useState(
|
|
240
251
|
null
|
|
241
252
|
);
|
|
253
|
+
const stacks = windowed && windowedByDefault;
|
|
254
|
+
const [behind, setBehind] = React4.useState(false);
|
|
255
|
+
React4.useEffect(() => {
|
|
256
|
+
if (!stacks || !containerEl) return;
|
|
257
|
+
const onFront = (event) => {
|
|
258
|
+
const element = event.detail?.element ?? null;
|
|
259
|
+
if (element && (element === containerEl || containerEl.contains(element))) return;
|
|
260
|
+
setBehind(true);
|
|
261
|
+
};
|
|
262
|
+
document.addEventListener(LAYER_FRONT_EVENT, onFront);
|
|
263
|
+
announceLayerFront(containerEl);
|
|
264
|
+
return () => document.removeEventListener(LAYER_FRONT_EVENT, onFront);
|
|
265
|
+
}, [stacks, containerEl]);
|
|
266
|
+
const bringToFront = () => {
|
|
267
|
+
if (!stacks || !containerEl) return;
|
|
268
|
+
setBehind(false);
|
|
269
|
+
announceLayerFront(containerEl);
|
|
270
|
+
};
|
|
242
271
|
const [offset, setOffset] = React4.useState({ x: 0, y: 0 });
|
|
243
272
|
const dragRef = React4.useRef(null);
|
|
244
273
|
const handle = React4.useMemo(() => {
|
|
@@ -297,10 +326,20 @@ var DialogContent = React4.forwardRef(
|
|
|
297
326
|
// z=1000); staying below that boundary makes a newly focused window
|
|
298
327
|
// usable without coupling the two systems.
|
|
299
328
|
!isModal && !windowedByDefault && "z-[900]",
|
|
329
|
+
// Another layer came to the front after this window (layer-front.ts).
|
|
330
|
+
stacks && behind && "z-[999]",
|
|
300
331
|
// Without an overlay the card needs its own separation from the page.
|
|
301
332
|
windowed && "shadow-2xl ring-1 ring-border/60"
|
|
302
333
|
),
|
|
303
334
|
style: windowed && (offset.x !== 0 || offset.y !== 0) ? { ...style, translate: `${offset.x}px ${offset.y}px` } : style,
|
|
335
|
+
onPointerDownCapture: (event) => {
|
|
336
|
+
onPointerDownCapture?.(event);
|
|
337
|
+
if (behind) bringToFront();
|
|
338
|
+
},
|
|
339
|
+
onFocusCapture: (event) => {
|
|
340
|
+
onFocusCapture?.(event);
|
|
341
|
+
if (behind) bringToFront();
|
|
342
|
+
},
|
|
304
343
|
onInteractOutside: (event) => {
|
|
305
344
|
onInteractOutside?.(event);
|
|
306
345
|
if (windowed && !dismissOnOutsideClick) event.preventDefault();
|