@wallarm-org/design-system 2.4.0 → 2.4.1-rc-fix-code-snippet-fullscreen-in-dialog.1
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.
|
@@ -2,10 +2,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
+
import { trackDismissableElement } from "@zag-js/dismissable";
|
|
6
|
+
import { trapFocus } from "@zag-js/focus-trap";
|
|
5
7
|
import { cn } from "../../../utils/cn.js";
|
|
6
8
|
import { useTestId } from "../../../utils/testId.js";
|
|
7
|
-
const FULLSCREEN_CLASSES = "fixed inset-16
|
|
8
|
-
const BACKDROP_CLASSES = "fixed inset-0
|
|
9
|
+
const FULLSCREEN_CLASSES = cn("fixed inset-16 m-0 w-auto h-auto min-w-0 min-h-0 max-w-[none] max-h-[none]", "z-[calc(var(--drawer-positioner-z-index)+(var(--layer-index,0)*var(--drawer-level-ratio)))]");
|
|
10
|
+
const BACKDROP_CLASSES = cn("fixed inset-0 backdrop-blur-xs bg-component-dialog-overlay", "z-[calc(var(--drawer-overlay-z-index)+(var(--layer-index,0)*var(--drawer-level-ratio)))]");
|
|
9
11
|
const HOST_CLASSES = "contents";
|
|
10
12
|
const noop = ()=>{};
|
|
11
13
|
const subscribeNoop = ()=>noop;
|
|
@@ -18,7 +20,7 @@ const createHost = ()=>{
|
|
|
18
20
|
return host;
|
|
19
21
|
};
|
|
20
22
|
const CodeSnippetFrame = (t0)=>{
|
|
21
|
-
const $ = c(
|
|
23
|
+
const $ = c(45);
|
|
22
24
|
let children;
|
|
23
25
|
let className;
|
|
24
26
|
let isFullscreen;
|
|
@@ -96,96 +98,129 @@ const CodeSnippetFrame = (t0)=>{
|
|
|
96
98
|
useLayoutEffect(t3, t4);
|
|
97
99
|
let t5;
|
|
98
100
|
let t6;
|
|
99
|
-
if ($[15] !==
|
|
101
|
+
if ($[15] !== host || $[16] !== isFullscreen || $[17] !== setIsFullscreen) {
|
|
100
102
|
t5 = ()=>{
|
|
101
|
-
if (!isFullscreen) return;
|
|
102
|
-
const
|
|
103
|
-
|
|
103
|
+
if (!isFullscreen || !host) return;
|
|
104
|
+
const options = {
|
|
105
|
+
onRequestDismiss: (event)=>{
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
setIsFullscreen(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const untrack = trackDismissableElement(host, options);
|
|
111
|
+
const untrap = trapFocus(host);
|
|
112
|
+
return ()=>{
|
|
113
|
+
untrap();
|
|
114
|
+
untrack();
|
|
104
115
|
};
|
|
105
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
106
|
-
return ()=>document.removeEventListener("keydown", handleKeyDown);
|
|
107
116
|
};
|
|
108
117
|
t6 = [
|
|
109
118
|
isFullscreen,
|
|
119
|
+
host,
|
|
110
120
|
setIsFullscreen
|
|
111
121
|
];
|
|
112
|
-
$[15] =
|
|
113
|
-
$[16] =
|
|
114
|
-
$[17] =
|
|
115
|
-
$[18] =
|
|
122
|
+
$[15] = host;
|
|
123
|
+
$[16] = isFullscreen;
|
|
124
|
+
$[17] = setIsFullscreen;
|
|
125
|
+
$[18] = t5;
|
|
126
|
+
$[19] = t6;
|
|
116
127
|
} else {
|
|
117
|
-
t5 = $[
|
|
118
|
-
t6 = $[
|
|
128
|
+
t5 = $[18];
|
|
129
|
+
t6 = $[19];
|
|
119
130
|
}
|
|
120
131
|
useEffect(t5, t6);
|
|
121
132
|
let t7;
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
let t8;
|
|
134
|
+
if ($[20] !== isFullscreen || $[21] !== setIsFullscreen) {
|
|
135
|
+
t7 = ()=>{
|
|
136
|
+
if (!isFullscreen) return;
|
|
137
|
+
const handleKeyDown = (event_0)=>{
|
|
138
|
+
if ("Escape" === event_0.key && !event_0.defaultPrevented) setIsFullscreen(false);
|
|
139
|
+
};
|
|
140
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
141
|
+
return ()=>document.removeEventListener("keydown", handleKeyDown);
|
|
142
|
+
};
|
|
143
|
+
t8 = [
|
|
144
|
+
isFullscreen,
|
|
145
|
+
setIsFullscreen
|
|
146
|
+
];
|
|
147
|
+
$[20] = isFullscreen;
|
|
148
|
+
$[21] = setIsFullscreen;
|
|
149
|
+
$[22] = t7;
|
|
150
|
+
$[23] = t8;
|
|
151
|
+
} else {
|
|
152
|
+
t7 = $[22];
|
|
153
|
+
t8 = $[23];
|
|
154
|
+
}
|
|
155
|
+
useEffect(t7, t8);
|
|
156
|
+
let t9;
|
|
157
|
+
if ($[24] !== backdropTestId || $[25] !== isFullscreen || $[26] !== setIsFullscreen) {
|
|
158
|
+
t9 = isFullscreen ? /*#__PURE__*/ jsx("div", {
|
|
124
159
|
"aria-hidden": "true",
|
|
125
160
|
"data-testid": backdropTestId,
|
|
126
161
|
className: BACKDROP_CLASSES,
|
|
127
162
|
onClick: ()=>setIsFullscreen(false)
|
|
128
163
|
}) : null;
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
} else
|
|
134
|
-
const
|
|
135
|
-
let
|
|
136
|
-
if ($[
|
|
137
|
-
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else
|
|
142
|
-
let
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
164
|
+
$[24] = backdropTestId;
|
|
165
|
+
$[25] = isFullscreen;
|
|
166
|
+
$[26] = setIsFullscreen;
|
|
167
|
+
$[27] = t9;
|
|
168
|
+
} else t9 = $[27];
|
|
169
|
+
const t10 = isFullscreen && FULLSCREEN_CLASSES;
|
|
170
|
+
let t11;
|
|
171
|
+
if ($[28] !== className || $[29] !== t10) {
|
|
172
|
+
t11 = cn(className, t10);
|
|
173
|
+
$[28] = className;
|
|
174
|
+
$[29] = t10;
|
|
175
|
+
$[30] = t11;
|
|
176
|
+
} else t11 = $[30];
|
|
177
|
+
let t12;
|
|
178
|
+
if ($[31] !== children || $[32] !== props || $[33] !== ref || $[34] !== t11) {
|
|
179
|
+
t12 = /*#__PURE__*/ jsx("div", {
|
|
145
180
|
...props,
|
|
146
181
|
ref: ref,
|
|
147
|
-
className:
|
|
182
|
+
className: t11,
|
|
148
183
|
children: children
|
|
149
184
|
});
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
} else
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
185
|
+
$[31] = children;
|
|
186
|
+
$[32] = props;
|
|
187
|
+
$[33] = ref;
|
|
188
|
+
$[34] = t11;
|
|
189
|
+
$[35] = t12;
|
|
190
|
+
} else t12 = $[35];
|
|
191
|
+
let t13;
|
|
192
|
+
if ($[36] !== t12 || $[37] !== t9) {
|
|
193
|
+
t13 = /*#__PURE__*/ jsxs(Fragment, {
|
|
159
194
|
children: [
|
|
160
|
-
|
|
161
|
-
|
|
195
|
+
t9,
|
|
196
|
+
t12
|
|
162
197
|
]
|
|
163
198
|
});
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
} else
|
|
168
|
-
const frame =
|
|
169
|
-
let
|
|
170
|
-
if ($[
|
|
171
|
-
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
} else
|
|
177
|
-
let
|
|
178
|
-
if ($[
|
|
179
|
-
|
|
199
|
+
$[36] = t12;
|
|
200
|
+
$[37] = t9;
|
|
201
|
+
$[38] = t13;
|
|
202
|
+
} else t13 = $[38];
|
|
203
|
+
const frame = t13;
|
|
204
|
+
let t14;
|
|
205
|
+
if ($[39] !== frame || $[40] !== host || $[41] !== portalReady) {
|
|
206
|
+
t14 = portalReady && host ? /*#__PURE__*/ createPortal(frame, host) : frame;
|
|
207
|
+
$[39] = frame;
|
|
208
|
+
$[40] = host;
|
|
209
|
+
$[41] = portalReady;
|
|
210
|
+
$[42] = t14;
|
|
211
|
+
} else t14 = $[42];
|
|
212
|
+
let t15;
|
|
213
|
+
if ($[43] !== t14) {
|
|
214
|
+
t15 = /*#__PURE__*/ jsx("div", {
|
|
180
215
|
ref: placeholderRef,
|
|
181
216
|
"data-slot": "code-snippet-frame",
|
|
182
217
|
className: HOST_CLASSES,
|
|
183
|
-
children:
|
|
218
|
+
children: t14
|
|
184
219
|
});
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
} else
|
|
188
|
-
return
|
|
220
|
+
$[43] = t14;
|
|
221
|
+
$[44] = t15;
|
|
222
|
+
} else t15 = $[44];
|
|
223
|
+
return t15;
|
|
189
224
|
};
|
|
190
225
|
CodeSnippetFrame.displayName = "CodeSnippetFrame";
|
|
191
226
|
export { CodeSnippetFrame };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
3
|
-
"generatedAt": "2026-10-
|
|
2
|
+
"version": "2.4.0",
|
|
3
|
+
"generatedAt": "2026-10-13T08:54:16.915Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -20392,6 +20392,11 @@
|
|
|
20392
20392
|
"name": "LongDocument",
|
|
20393
20393
|
"code": "() => <LongDocumentDemo />",
|
|
20394
20394
|
"description": "2 000 read-only lines clamped by `maxLines` — the top of the envelope the colour painter is\nbuilt for, where `readOnly` still lets the text be selected, searched and copied."
|
|
20395
|
+
},
|
|
20396
|
+
{
|
|
20397
|
+
"name": "FullscreenInsideDrawer",
|
|
20398
|
+
"code": "() => {\n const [value, setValue] = useState(jsonCode);\n\n return (\n <Drawer>\n <DrawerTrigger asChild>\n <Button variant='outline' color='neutral'>\n Open Drawer\n </Button>\n </DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Rule</DrawerTitle>\n </DrawerHeader>\n <DrawerBody>\n <CodeEditorRoot value={value} onChange={setValue} language='json'>\n <CodeSnippetHeader>\n <CodeSnippetTitle>rule.json</CodeSnippetTitle>\n <CodeSnippetActions>\n <CodeSnippetFullscreenButton />\n <CodeSnippetCopyButton />\n </CodeSnippetActions>\n </CodeSnippetHeader>\n <CodeEditorContent lineNumbers aria-label='Rule JSON' />\n </CodeEditorRoot>\n </DrawerBody>\n </DrawerContent>\n </Drawer>\n );\n}",
|
|
20399
|
+
"description": "Fullscreen opened from a modal `Drawer` stacks above it: the editor and its buttons take\npointer and keyboard input, and Escape leaves fullscreen while the drawer stays open."
|
|
20395
20400
|
}
|
|
20396
20401
|
]
|
|
20397
20402
|
},
|
|
@@ -24930,6 +24935,11 @@
|
|
|
24930
24935
|
"name": "WithFoldingAndShowMore",
|
|
24931
24936
|
"code": "() => (\n <CodeSnippetAdapterProvider adapter={loadShikiAdapter}>\n <CodeSnippetRoot\n code={foldableResponseCode}\n language='http'\n startingLineNumber={100}\n maxLines={6}\n folds={getHttpFolds(foldableResponseCode, { startingLineNumber: 100 })}\n >\n <CodeSnippetContent>\n <CodeSnippetLineNumbers />\n <CodeSnippetCode />\n </CodeSnippetContent>\n </CodeSnippetRoot>\n </CodeSnippetAdapterProvider>\n)",
|
|
24932
24937
|
"description": "Folds, `maxLines` and `startingLineNumber` together — fold line numbers are absolute, so\n`getHttpFolds` has to be given the same offset the gutter uses."
|
|
24938
|
+
},
|
|
24939
|
+
{
|
|
24940
|
+
"name": "FullscreenInsideDrawer",
|
|
24941
|
+
"code": "() => (\n <Drawer>\n <DrawerTrigger asChild>\n <Button variant='outline' color='neutral'>\n Open Drawer\n </Button>\n </DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Request</DrawerTitle>\n </DrawerHeader>\n <DrawerBody>\n <CodeSnippetRoot code={jsonCode} language='json'>\n <CodeSnippetHeader>\n <CodeSnippetTitle>package.json</CodeSnippetTitle>\n <CodeSnippetActions>\n <CodeSnippetFullscreenButton />\n <CodeSnippetCopyButton />\n </CodeSnippetActions>\n </CodeSnippetHeader>\n <CodeSnippetContent>\n <CodeSnippetCode />\n </CodeSnippetContent>\n </CodeSnippetRoot>\n </DrawerBody>\n </DrawerContent>\n </Drawer>\n)",
|
|
24942
|
+
"description": "Fullscreen opened from a modal `Drawer` stacks above it as a nested layer: its buttons stay\nclickable, and Escape or a backdrop click leaves fullscreen while the drawer stays open."
|
|
24933
24943
|
}
|
|
24934
24944
|
]
|
|
24935
24945
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wallarm-org/design-system",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1-rc-fix-code-snippet-fullscreen-in-dialog.1",
|
|
4
4
|
"description": "Core design system library with React components and Storybook documentation",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -167,7 +167,9 @@
|
|
|
167
167
|
"@tanstack/react-table": "9.2.4",
|
|
168
168
|
"@tanstack/react-virtual": "3.14.13",
|
|
169
169
|
"@zag-js/cascade-select": "1.43.3",
|
|
170
|
+
"@zag-js/dismissable": "1.43.3",
|
|
170
171
|
"@zag-js/file-utils": "1.43.3",
|
|
172
|
+
"@zag-js/focus-trap": "1.43.3",
|
|
171
173
|
"@zag-js/react": "1.43.3",
|
|
172
174
|
"class-variance-authority": "0.7.1",
|
|
173
175
|
"clsx": "2.1.1",
|