@wallarm-org/design-system 2.1.2-rc-fix-filter-cascade-tooltip.1 → 2.1.3

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.
@@ -1,4 +1,4 @@
1
- import type { FC, ReactNode, Ref } from 'react';
1
+ import { type FC, type ReactNode, type Ref } from 'react';
2
2
  export interface DrawerContentProps {
3
3
  children: ReactNode;
4
4
  asChild?: boolean;
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
+ import { useContext } from "react";
3
4
  import { Dialog } from "@ark-ui/react/dialog";
4
5
  import { cn } from "../../utils/cn.js";
5
6
  import { useTestId } from "../../utils/testId.js";
@@ -9,11 +10,13 @@ import { useNestedSameKindCount } from "./DrawerNestingContext.js";
9
10
  import { DrawerOverlay } from "./DrawerOverlay.js";
10
11
  import { DrawerPortal } from "./DrawerPortal.js";
11
12
  import { DrawerPositioner } from "./DrawerPositioner.js";
13
+ import { DrawerAncestorIdsContext } from "./DrawerRoot.js";
12
14
  const DrawerContent = (t0)=>{
13
- const $ = c(21);
15
+ const $ = c(27);
14
16
  const { children, asChild, ref } = t0;
15
17
  const testId = useTestId("content");
16
- const { width, isResizing, overlay } = useDrawerContext();
18
+ const { width, isResizing, overlay, contentId } = useDrawerContext();
19
+ const ancestorIds = useContext(DrawerAncestorIdsContext);
17
20
  const nestedSameKindCount = useNestedSameKindCount();
18
21
  let t1;
19
22
  if ($[0] !== overlay) {
@@ -42,48 +45,68 @@ const DrawerContent = (t0)=>{
42
45
  } else t4 = $[6];
43
46
  const t5 = t4;
44
47
  let t6;
45
- if ($[7] !== asChild || $[8] !== children || $[9] !== ref || $[10] !== t2 || $[11] !== t3 || $[12] !== t5 || $[13] !== testId) {
46
- t6 = /*#__PURE__*/ jsx(Dialog.Content, {
48
+ if ($[7] !== ancestorIds || $[8] !== contentId) {
49
+ t6 = [
50
+ ...ancestorIds,
51
+ contentId
52
+ ];
53
+ $[7] = ancestorIds;
54
+ $[8] = contentId;
55
+ $[9] = t6;
56
+ } else t6 = $[9];
57
+ let t7;
58
+ if ($[10] !== children || $[11] !== t6) {
59
+ t7 = /*#__PURE__*/ jsx(DrawerAncestorIdsContext.Provider, {
60
+ value: t6,
61
+ children: children
62
+ });
63
+ $[10] = children;
64
+ $[11] = t6;
65
+ $[12] = t7;
66
+ } else t7 = $[12];
67
+ let t8;
68
+ if ($[13] !== asChild || $[14] !== ref || $[15] !== t2 || $[16] !== t3 || $[17] !== t5 || $[18] !== t7 || $[19] !== testId) {
69
+ t8 = /*#__PURE__*/ jsx(Dialog.Content, {
47
70
  ref: ref,
48
71
  "data-testid": testId,
49
72
  "data-has-nested-same": t2,
50
73
  className: t3,
51
74
  style: t5,
52
75
  asChild: asChild,
53
- children: children
76
+ children: t7
54
77
  });
55
- $[7] = asChild;
56
- $[8] = children;
57
- $[9] = ref;
58
- $[10] = t2;
59
- $[11] = t3;
60
- $[12] = t5;
61
- $[13] = testId;
62
- $[14] = t6;
63
- } else t6 = $[14];
64
- let t7;
65
- if ($[15] !== isResizing || $[16] !== t6) {
66
- t7 = /*#__PURE__*/ jsx(DrawerPositioner, {
78
+ $[13] = asChild;
79
+ $[14] = ref;
80
+ $[15] = t2;
81
+ $[16] = t3;
82
+ $[17] = t5;
83
+ $[18] = t7;
84
+ $[19] = testId;
85
+ $[20] = t8;
86
+ } else t8 = $[20];
87
+ let t9;
88
+ if ($[21] !== isResizing || $[22] !== t8) {
89
+ t9 = /*#__PURE__*/ jsx(DrawerPositioner, {
67
90
  isResizing: isResizing,
68
- children: t6
91
+ children: t8
69
92
  });
70
- $[15] = isResizing;
71
- $[16] = t6;
72
- $[17] = t7;
73
- } else t7 = $[17];
74
- let t8;
75
- if ($[18] !== t1 || $[19] !== t7) {
76
- t8 = /*#__PURE__*/ jsxs(DrawerPortal, {
93
+ $[21] = isResizing;
94
+ $[22] = t8;
95
+ $[23] = t9;
96
+ } else t9 = $[23];
97
+ let t10;
98
+ if ($[24] !== t1 || $[25] !== t9) {
99
+ t10 = /*#__PURE__*/ jsxs(DrawerPortal, {
77
100
  children: [
78
101
  t1,
79
- t7
102
+ t9
80
103
  ]
81
104
  });
82
- $[18] = t1;
83
- $[19] = t7;
84
- $[20] = t8;
85
- } else t8 = $[20];
86
- return t8;
105
+ $[24] = t1;
106
+ $[25] = t9;
107
+ $[26] = t10;
108
+ } else t10 = $[26];
109
+ return t10;
87
110
  };
88
111
  DrawerContent.displayName = "DrawerContent";
89
112
  export { DrawerContent };
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
- import { useState } from "react";
3
+ import { useId, useState } from "react";
4
4
  import { useControlled } from "../../../hooks/index.js";
5
5
  import { DRAWER_SIZES, DRAWER_WIDTH_CONSTRAINTS } from "../constants.js";
6
6
  import { DrawerNestingProvider } from "../DrawerNestingContext.js";
7
7
  import { DrawerContext } from "./DrawerContext.js";
8
8
  const DrawerProvider = (t0)=>{
9
- const $ = c(22);
9
+ const $ = c(23);
10
10
  const { children, kind, open, onOpenChange, closeOnEscape, overlay, modal, width: t1, minWidth: t2, maxWidth: t3 } = t0;
11
11
  const initialWidth = void 0 === t1 ? DRAWER_SIZES.small : t1;
12
12
  const minWidth = void 0 === t2 ? DRAWER_WIDTH_CONSTRAINTS.min : t2;
@@ -22,6 +22,7 @@ const DrawerProvider = (t0)=>{
22
22
  } else t4 = $[1];
23
23
  const [t5, setIsOpenUncontrolled] = useControlled(t4);
24
24
  const isOpen = void 0 === t5 ? false : t5;
25
+ const contentId = useId();
25
26
  const [width, setWidth] = useState(initialWidth);
26
27
  const [isResizing, setIsResizing] = useState(false);
27
28
  let t6;
@@ -36,13 +37,14 @@ const DrawerProvider = (t0)=>{
36
37
  } else t6 = $[4];
37
38
  const handleOpenChange = t6;
38
39
  let t7;
39
- if ($[5] !== closeOnEscape || $[6] !== handleOpenChange || $[7] !== isOpen || $[8] !== isResizing || $[9] !== maxWidth || $[10] !== minWidth || $[11] !== modal || $[12] !== overlay || $[13] !== width) {
40
+ if ($[5] !== closeOnEscape || $[6] !== contentId || $[7] !== handleOpenChange || $[8] !== isOpen || $[9] !== isResizing || $[10] !== maxWidth || $[11] !== minWidth || $[12] !== modal || $[13] !== overlay || $[14] !== width) {
40
41
  t7 = {
41
42
  isOpen,
42
43
  onOpenChange: handleOpenChange,
43
44
  closeOnEscape,
44
45
  overlay,
45
46
  modal,
47
+ contentId,
46
48
  width,
47
49
  setWidth,
48
50
  isResizing,
@@ -51,39 +53,40 @@ const DrawerProvider = (t0)=>{
51
53
  maxWidth
52
54
  };
53
55
  $[5] = closeOnEscape;
54
- $[6] = handleOpenChange;
55
- $[7] = isOpen;
56
- $[8] = isResizing;
57
- $[9] = maxWidth;
58
- $[10] = minWidth;
59
- $[11] = modal;
60
- $[12] = overlay;
61
- $[13] = width;
62
- $[14] = t7;
63
- } else t7 = $[14];
56
+ $[6] = contentId;
57
+ $[7] = handleOpenChange;
58
+ $[8] = isOpen;
59
+ $[9] = isResizing;
60
+ $[10] = maxWidth;
61
+ $[11] = minWidth;
62
+ $[12] = modal;
63
+ $[13] = overlay;
64
+ $[14] = width;
65
+ $[15] = t7;
66
+ } else t7 = $[15];
64
67
  const contextValue = t7;
65
68
  let t8;
66
- if ($[15] !== children || $[16] !== isOpen || $[17] !== kind) {
69
+ if ($[16] !== children || $[17] !== isOpen || $[18] !== kind) {
67
70
  t8 = /*#__PURE__*/ jsx(DrawerNestingProvider, {
68
71
  kind: kind,
69
72
  open: isOpen,
70
73
  children: children
71
74
  });
72
- $[15] = children;
73
- $[16] = isOpen;
74
- $[17] = kind;
75
- $[18] = t8;
76
- } else t8 = $[18];
75
+ $[16] = children;
76
+ $[17] = isOpen;
77
+ $[18] = kind;
78
+ $[19] = t8;
79
+ } else t8 = $[19];
77
80
  let t9;
78
- if ($[19] !== contextValue || $[20] !== t8) {
81
+ if ($[20] !== contextValue || $[21] !== t8) {
79
82
  t9 = /*#__PURE__*/ jsx(DrawerContext.Provider, {
80
83
  value: contextValue,
81
84
  children: t8
82
85
  });
83
- $[19] = contextValue;
84
- $[20] = t8;
85
- $[21] = t9;
86
- } else t9 = $[21];
86
+ $[20] = contextValue;
87
+ $[21] = t8;
88
+ $[22] = t9;
89
+ } else t9 = $[22];
87
90
  return t9;
88
91
  };
89
92
  export { DrawerProvider };
@@ -4,6 +4,8 @@ export interface DrawerContextValue {
4
4
  closeOnEscape: boolean;
5
5
  overlay: boolean;
6
6
  modal: boolean;
7
+ /** Id of the Ark dialog content node — this overlay's layer in zag's layer stack */
8
+ contentId: string;
7
9
  width: number | string;
8
10
  setWidth: (value: number | string) => void;
9
11
  isResizing: boolean;
@@ -1,5 +1,19 @@
1
- import type { FC, ReactNode } from 'react';
2
- import { type DialogInteractOutsideEvent as DrawerInteractOutsideEvent } from '@ark-ui/react/dialog';
1
+ import { type FC, type ReactNode } from 'react';
2
+ import { Dialog, type DialogInteractOutsideEvent as DrawerInteractOutsideEvent } from '@ark-ui/react/dialog';
3
+ type LayerDismissRequest = Parameters<NonNullable<Dialog.RootProps['onRequestDismiss']>>[0];
4
+ /**
5
+ * Content ids of the Drawer/Dialog contents this one is rendered inside (React tree, not DOM —
6
+ * Ark portals every content to <body>). Provided by DrawerContent, not the root: Ark's Dialog.Root
7
+ * renders no DOM, so a sibling of the content is not a descendant of the layer.
8
+ */
9
+ export declare const DrawerAncestorIdsContext: import("react").Context<readonly string[]>;
10
+ /**
11
+ * Since zag-js 1.43.1 a dialog that mounts while its content node exists registers its layer
12
+ * synchronously. When a Dialog closes in the same commit a sibling Drawer opens (Create → Continue),
13
+ * the new drawer lands above the closing layer, and removing that layer dismisses every layer above
14
+ * it. Only a React-ancestor Drawer/Dialog may dismiss this one; unrelated layers can't.
15
+ */
16
+ export declare const keepOpenUnlessAncestorCloses: (ancestorIds: readonly string[]) => (event: LayerDismissRequest) => void;
3
17
  interface DrawerRootProps {
4
18
  children: ReactNode;
5
19
  closeOnEscape: boolean;
@@ -1,11 +1,23 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
+ import { createContext, useContext } from "react";
3
4
  import { Dialog } from "@ark-ui/react/dialog";
4
5
  import { useDrawerContext } from "./DrawerContext/index.js";
6
+ const DrawerAncestorIdsContext = /*#__PURE__*/ createContext([]);
7
+ const EXITING_DIALOG_LAYER = '[data-scope="dialog"][data-part="content"][data-state="closed"]';
8
+ const keepOpenUnlessAncestorCloses = (ancestorIds)=>(event)=>{
9
+ const targetId = event.detail.targetLayer?.id;
10
+ if (!targetId || !ancestorIds.includes(targetId)) event.preventDefault();
11
+ };
12
+ const ignoreProgrammaticFocusOutside = (modal)=>(event)=>{
13
+ const target = event.detail.originalEvent.target;
14
+ if (modal || target instanceof Element && target.closest(EXITING_DIALOG_LAYER)) event.preventDefault();
15
+ };
5
16
  const DrawerRoot = (t0)=>{
6
- const $ = c(11);
17
+ const $ = c(20);
7
18
  const { children, closeOnEscape, closeOnOutsideClick, modal, onInteractOutside, onEscapeKeyDown } = t0;
8
- const { isOpen, onOpenChange } = useDrawerContext();
19
+ const { isOpen, onOpenChange, contentId } = useDrawerContext();
20
+ const ancestorIds = useContext(DrawerAncestorIdsContext);
9
21
  let t1;
10
22
  if ($[0] !== onOpenChange) {
11
23
  t1 = (t2)=>{
@@ -17,30 +29,56 @@ const DrawerRoot = (t0)=>{
17
29
  } else t1 = $[1];
18
30
  const handleOpenChange = t1;
19
31
  let t2;
20
- if ($[2] !== children || $[3] !== closeOnEscape || $[4] !== closeOnOutsideClick || $[5] !== handleOpenChange || $[6] !== isOpen || $[7] !== modal || $[8] !== onEscapeKeyDown || $[9] !== onInteractOutside) {
21
- t2 = /*#__PURE__*/ jsx(Dialog.Root, {
32
+ if ($[2] !== contentId) {
33
+ t2 = {
34
+ content: contentId
35
+ };
36
+ $[2] = contentId;
37
+ $[3] = t2;
38
+ } else t2 = $[3];
39
+ let t3;
40
+ if ($[4] !== ancestorIds) {
41
+ t3 = keepOpenUnlessAncestorCloses(ancestorIds);
42
+ $[4] = ancestorIds;
43
+ $[5] = t3;
44
+ } else t3 = $[5];
45
+ let t4;
46
+ if ($[6] !== modal) {
47
+ t4 = ignoreProgrammaticFocusOutside(modal);
48
+ $[6] = modal;
49
+ $[7] = t4;
50
+ } else t4 = $[7];
51
+ let t5;
52
+ if ($[8] !== children || $[9] !== closeOnEscape || $[10] !== closeOnOutsideClick || $[11] !== handleOpenChange || $[12] !== isOpen || $[13] !== modal || $[14] !== onEscapeKeyDown || $[15] !== onInteractOutside || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
53
+ t5 = /*#__PURE__*/ jsx(Dialog.Root, {
54
+ ids: t2,
22
55
  open: isOpen,
23
56
  onOpenChange: handleOpenChange,
24
57
  closeOnEscape: closeOnEscape,
25
58
  closeOnInteractOutside: closeOnOutsideClick,
26
59
  modal: modal,
60
+ onRequestDismiss: t3,
61
+ onFocusOutside: t4,
27
62
  onInteractOutside: onInteractOutside,
28
63
  onEscapeKeyDown: onEscapeKeyDown,
29
64
  lazyMount: true,
30
65
  unmountOnExit: true,
31
66
  children: children
32
67
  });
33
- $[2] = children;
34
- $[3] = closeOnEscape;
35
- $[4] = closeOnOutsideClick;
36
- $[5] = handleOpenChange;
37
- $[6] = isOpen;
38
- $[7] = modal;
39
- $[8] = onEscapeKeyDown;
40
- $[9] = onInteractOutside;
41
- $[10] = t2;
42
- } else t2 = $[10];
43
- return t2;
68
+ $[8] = children;
69
+ $[9] = closeOnEscape;
70
+ $[10] = closeOnOutsideClick;
71
+ $[11] = handleOpenChange;
72
+ $[12] = isOpen;
73
+ $[13] = modal;
74
+ $[14] = onEscapeKeyDown;
75
+ $[15] = onInteractOutside;
76
+ $[16] = t2;
77
+ $[17] = t3;
78
+ $[18] = t4;
79
+ $[19] = t5;
80
+ } else t5 = $[19];
81
+ return t5;
44
82
  };
45
83
  DrawerRoot.displayName = "DrawerRoot";
46
- export { DrawerRoot };
84
+ export { DrawerAncestorIdsContext, DrawerRoot, keepOpenUnlessAncestorCloses };
@@ -8,6 +8,7 @@ const useMasterCell = (columnId, rowId)=>{
8
8
  let t0;
9
9
  if ($[0] !== onMasterCellClick || $[1] !== rowId) {
10
10
  t0 = (e)=>{
11
+ if (!e.currentTarget.contains(e.target)) return;
11
12
  if (e.target.closest("[data-master-cell-action]")) return;
12
13
  onMasterCellClick?.(rowId);
13
14
  };
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "2.1.1",
3
- "generatedAt": "2026-10-08T07:30:13.430Z",
2
+ "version": "2.1.2",
3
+ "generatedAt": "2026-10-08T08:49:41.082Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
@@ -28693,6 +28693,7 @@
28693
28693
  },
28694
28694
  {
28695
28695
  "name": "Drawer",
28696
+ "description": "Content ids of the Drawer/Dialog contents this one is rendered inside (React tree, not DOM —\nArk portals every content to <body>). Provided by DrawerContent, not the root: Ark's Dialog.Root\nrenders no DOM, so a sibling of the content is not a descendant of the layer.",
28696
28697
  "importPath": "@wallarm-org/design-system/Drawer",
28697
28698
  "props": [
28698
28699
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "2.1.2-rc-fix-filter-cascade-tooltip.1",
3
+ "version": "2.1.3",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",