@webstudio-is/sdk-components-react-radix 0.185.0 → 0.191.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/lib/__generated__/accordion.props.js +2631 -0
- package/lib/__generated__/checkbox.props.js +1084 -0
- package/lib/__generated__/collapsible.props.js +1024 -0
- package/lib/__generated__/dialog.props.js +2599 -0
- package/lib/__generated__/label.props.js +519 -0
- package/lib/__generated__/navigation-menu.props.js +3660 -0
- package/lib/__generated__/popover.props.js +564 -0
- package/lib/__generated__/radio-group.props.js +1619 -0
- package/lib/__generated__/select.props.js +3681 -0
- package/lib/__generated__/switch.props.js +1084 -0
- package/lib/__generated__/tabs.props.js +2121 -0
- package/lib/__generated__/tooltip.props.js +575 -0
- package/lib/accordion.js +36 -0
- package/lib/accordion.ws.js +254 -0
- package/lib/checkbox.js +8 -0
- package/lib/checkbox.ws.js +141 -0
- package/lib/collapsible.js +26 -0
- package/lib/collapsible.ws.js +92 -0
- package/lib/components.js +60 -406
- package/lib/dialog.js +84 -0
- package/lib/dialog.ws.js +260 -0
- package/lib/hooks.js +20 -655
- package/lib/label.js +7 -0
- package/lib/label.ws.js +43 -0
- package/lib/metas.js +62 -4570
- package/lib/navigation-menu.js +59 -0
- package/lib/navigation-menu.ws.js +481 -0
- package/lib/popover.js +48 -0
- package/lib/popover.ws.js +96 -0
- package/lib/props.js +60 -24208
- package/lib/radio-group.js +9 -0
- package/lib/radio-group.ws.js +159 -0
- package/lib/select.js +46 -0
- package/lib/select.ws.js +308 -0
- package/lib/sheet.js +43 -0
- package/lib/sheet.ws.js +217 -0
- package/lib/switch.js +8 -0
- package/lib/switch.ws.js +140 -0
- package/lib/tabs.js +31 -0
- package/lib/tabs.ws.js +187 -0
- package/lib/theme/__generated__/tailwind-theme.js +503 -0
- package/lib/theme/styles.js +52 -0
- package/lib/theme/tailwind-classes.js +474 -0
- package/lib/tooltip.js +45 -0
- package/lib/tooltip.ws.js +97 -0
- package/lib/types/theme/styles.d.ts +92 -44
- package/package.json +19 -20
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "@radix-ui/react-navigation-menu";
|
|
3
|
+
import { ReactSdkContext as v, getIndexWithinAncestorFromComponentProps as l, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
|
|
4
|
+
import { forwardRef as c, useContext as f, Children as m } from "react";
|
|
5
|
+
const p = c(({ value: o, ...n }, e) => {
|
|
6
|
+
const { renderer: t } = f(v);
|
|
7
|
+
let i = o;
|
|
8
|
+
return t === "canvas" && (i = i === "" ? "-1" : i), /* @__PURE__ */ r(a.Root, { ref: e, value: i, ...n });
|
|
9
|
+
}), C = a.List, P = a.Viewport, k = a.Content, x = c(({ value: o, ...n }, e) => {
|
|
10
|
+
const t = l(n);
|
|
11
|
+
return /* @__PURE__ */ r(a.Item, { ref: e, value: o ?? t, ...n });
|
|
12
|
+
}), A = c(({ children: o, ...n }, e) => {
|
|
13
|
+
const t = m.toArray(o)[0];
|
|
14
|
+
return /* @__PURE__ */ r(a.Link, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("a", { children: "Add link component" }) });
|
|
15
|
+
}), I = c(({ children: o, ...n }, e) => {
|
|
16
|
+
const t = m.toArray(o)[0];
|
|
17
|
+
return /* @__PURE__ */ r(a.Trigger, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
18
|
+
}), s = "@webstudio-is/sdk-components-react-radix", $ = {
|
|
19
|
+
onNavigatorUnselect: (o, n) => {
|
|
20
|
+
for (const e of n.instancePath)
|
|
21
|
+
if (e.component === `${s}:NavigationMenuContent`) {
|
|
22
|
+
const t = d(
|
|
23
|
+
n.instancePath,
|
|
24
|
+
e,
|
|
25
|
+
`${s}:NavigationMenu`
|
|
26
|
+
);
|
|
27
|
+
t && o.setMemoryProp(t, "value", void 0);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onNavigatorSelect: (o, n) => {
|
|
31
|
+
var e;
|
|
32
|
+
for (const t of n.instancePath)
|
|
33
|
+
if (t.component === `${s}:NavigationMenuContent`) {
|
|
34
|
+
const i = d(
|
|
35
|
+
n.instancePath,
|
|
36
|
+
t,
|
|
37
|
+
`${s}:NavigationMenu`
|
|
38
|
+
), u = d(
|
|
39
|
+
n.instancePath,
|
|
40
|
+
t,
|
|
41
|
+
`${s}:NavigationMenuItem`
|
|
42
|
+
);
|
|
43
|
+
if (u === void 0 || i === void 0)
|
|
44
|
+
return;
|
|
45
|
+
const g = o.getPropValue(u, "value") ?? ((e = o.indexesWithinAncestors.get(u.id)) == null ? void 0 : e.toString());
|
|
46
|
+
g && o.setMemoryProp(i, "value", g);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
p as NavigationMenu,
|
|
52
|
+
k as NavigationMenuContent,
|
|
53
|
+
x as NavigationMenuItem,
|
|
54
|
+
A as NavigationMenuLink,
|
|
55
|
+
C as NavigationMenuList,
|
|
56
|
+
I as NavigationMenuTrigger,
|
|
57
|
+
P as NavigationMenuViewport,
|
|
58
|
+
$ as hooksNavigationMenu
|
|
59
|
+
};
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { NavigationMenuIcon as x, ListIcon as w, ListItemIcon as I, TriggerIcon as A, ContentIcon as k, BoxIcon as L, ViewportIcon as C, ChevronDownIcon as q } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as T } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { relative as m, maxW as B, p as a, m as h, flex as n, list as $, items as V, justify as u, gap as s, bg as r, w as c, rounded as d, absolute as v, left as y, top as f, mt as D, overflow as F, border as S, text as t, shadow as W, property as i, noUnderline as M, state as E, ml as P, h as j, shrink as H, transition as U, duration as _, select as z, leading as l, outline as G, hover as J, focus as K, font as O, lineClamp as Q } from "./theme/tailwind-classes.js";
|
|
4
|
+
import { getButtonStyles as N } from "./theme/styles.js";
|
|
5
|
+
import { propsNavigationMenu as R, propsNavigationMenuItem as X, propsNavigationMenuTrigger as Y, propsNavigationMenuContent as Z, propsNavigationMenuLink as ee, propsNavigationMenuList as te, propsNavigationMenuViewport as ne } from "./__generated__/navigation-menu.props.js";
|
|
6
|
+
const o = {
|
|
7
|
+
div: T
|
|
8
|
+
}, oe = [
|
|
9
|
+
{
|
|
10
|
+
title: "Sheet",
|
|
11
|
+
href: "/docs/components/sheet",
|
|
12
|
+
description: "Extends the Dialog component to display content that complements the main content of the screen."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: "Navigation Menu",
|
|
16
|
+
href: "/docs/components/navigation-menu",
|
|
17
|
+
description: "A collection of links for navigating websites."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "Tabs",
|
|
21
|
+
href: "/docs/components/tabs",
|
|
22
|
+
description: "A set of layered sections of content—known as tab panels—that are displayed one at a time."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Accordion",
|
|
26
|
+
href: "/docs/components/accordion",
|
|
27
|
+
description: "A vertically stacked set of interactive headings that each reveal a section of content."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Dialog",
|
|
31
|
+
href: "/docs/components/dialog",
|
|
32
|
+
description: "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Collapsible",
|
|
36
|
+
href: "/docs/components/collapsible",
|
|
37
|
+
description: "An interactive component which expands/collapses a panel."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Popover",
|
|
41
|
+
href: "/docs/components/popover",
|
|
42
|
+
description: "Displays rich content in a portal, triggered by a button."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "Tooltip",
|
|
46
|
+
href: "/docs/components/tooltip",
|
|
47
|
+
description: "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Button",
|
|
51
|
+
href: "/docs/components/button",
|
|
52
|
+
description: "Displays a button or a component that looks like a button."
|
|
53
|
+
}
|
|
54
|
+
], ie = (e) => [
|
|
55
|
+
{
|
|
56
|
+
type: "instance",
|
|
57
|
+
component: "NavigationMenuLink",
|
|
58
|
+
children: [
|
|
59
|
+
{
|
|
60
|
+
type: "instance",
|
|
61
|
+
component: "Link",
|
|
62
|
+
// block select-none space-y-1 rounded-md p-3 leading-none
|
|
63
|
+
// no-underline outline-none transition-colors
|
|
64
|
+
// hover:bg-accent hover:text-accent-foreground
|
|
65
|
+
// focus:bg-accent focus:text-accent-foreground
|
|
66
|
+
styles: [
|
|
67
|
+
t("inherit"),
|
|
68
|
+
n(),
|
|
69
|
+
n("col"),
|
|
70
|
+
z(),
|
|
71
|
+
s(1),
|
|
72
|
+
d("md"),
|
|
73
|
+
a(3),
|
|
74
|
+
l("none"),
|
|
75
|
+
M(),
|
|
76
|
+
G(),
|
|
77
|
+
J([r("accent"), t("accentForeground")].flat()),
|
|
78
|
+
K([r("accent"), t("accentForeground")].flat())
|
|
79
|
+
].flat(),
|
|
80
|
+
props: [
|
|
81
|
+
{
|
|
82
|
+
name: "href",
|
|
83
|
+
type: "string",
|
|
84
|
+
value: `https://ui.shadcn.com${e.href}`
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
children: [
|
|
88
|
+
{
|
|
89
|
+
type: "instance",
|
|
90
|
+
component: "Text",
|
|
91
|
+
// text-sm font-medium leading-none
|
|
92
|
+
styles: [
|
|
93
|
+
t("sm"),
|
|
94
|
+
O("medium"),
|
|
95
|
+
l("none")
|
|
96
|
+
].flat(),
|
|
97
|
+
children: [
|
|
98
|
+
{
|
|
99
|
+
type: "text",
|
|
100
|
+
value: e.title,
|
|
101
|
+
placeholder: !0
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "instance",
|
|
107
|
+
component: "Paragraph",
|
|
108
|
+
// line-clamp-2 text-sm leading-snug text-muted-foreground
|
|
109
|
+
styles: [
|
|
110
|
+
h(0),
|
|
111
|
+
Q(2),
|
|
112
|
+
t("sm"),
|
|
113
|
+
l("snug"),
|
|
114
|
+
t("mutedForeground")
|
|
115
|
+
].flat(),
|
|
116
|
+
children: [
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
value: e.description,
|
|
120
|
+
placeholder: !0
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
], p = (e) => [
|
|
129
|
+
{
|
|
130
|
+
type: "instance",
|
|
131
|
+
component: "Box",
|
|
132
|
+
label: "Flex Column",
|
|
133
|
+
styles: [c(64), n(), s(4), n("col")].flat(),
|
|
134
|
+
children: Array.from(
|
|
135
|
+
Array(e.count),
|
|
136
|
+
(re, b) => ie(oe[b + e.offset])
|
|
137
|
+
).flat()
|
|
138
|
+
}
|
|
139
|
+
], ae = (e) => [
|
|
140
|
+
{
|
|
141
|
+
type: "instance",
|
|
142
|
+
component: "NavigationMenuItem",
|
|
143
|
+
children: [
|
|
144
|
+
{
|
|
145
|
+
type: "instance",
|
|
146
|
+
component: "NavigationMenuLink",
|
|
147
|
+
children: [
|
|
148
|
+
{
|
|
149
|
+
type: "instance",
|
|
150
|
+
component: "Link",
|
|
151
|
+
styles: [
|
|
152
|
+
N("ghost", "sm"),
|
|
153
|
+
M(),
|
|
154
|
+
t("current")
|
|
155
|
+
].flat(),
|
|
156
|
+
children: [{ type: "text", value: e.title, placeholder: !0 }]
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
], g = (e) => [
|
|
163
|
+
{
|
|
164
|
+
type: "instance",
|
|
165
|
+
component: "NavigationMenuItem",
|
|
166
|
+
children: [
|
|
167
|
+
{
|
|
168
|
+
type: "instance",
|
|
169
|
+
component: "NavigationMenuTrigger",
|
|
170
|
+
children: [
|
|
171
|
+
{
|
|
172
|
+
type: "instance",
|
|
173
|
+
component: "Button",
|
|
174
|
+
styles: [
|
|
175
|
+
N("ghost", "sm"),
|
|
176
|
+
i("--navigation-menu-trigger-icon-transform", "0deg"),
|
|
177
|
+
E(
|
|
178
|
+
[
|
|
179
|
+
i(
|
|
180
|
+
"--navigation-menu-trigger-icon-transform",
|
|
181
|
+
"180deg"
|
|
182
|
+
)
|
|
183
|
+
],
|
|
184
|
+
"[data-state=open]"
|
|
185
|
+
)
|
|
186
|
+
].flat(),
|
|
187
|
+
children: [
|
|
188
|
+
{
|
|
189
|
+
type: "instance",
|
|
190
|
+
component: "Text",
|
|
191
|
+
children: [
|
|
192
|
+
{ type: "text", value: e.title, placeholder: !0 }
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
type: "instance",
|
|
197
|
+
component: "Box",
|
|
198
|
+
label: "Icon Container",
|
|
199
|
+
// h-4 w-4 shrink-0 transition-transform duration-200
|
|
200
|
+
styles: [
|
|
201
|
+
P(1),
|
|
202
|
+
i(
|
|
203
|
+
"rotate",
|
|
204
|
+
"--navigation-menu-trigger-icon-transform"
|
|
205
|
+
),
|
|
206
|
+
j(4),
|
|
207
|
+
c(4),
|
|
208
|
+
H(0),
|
|
209
|
+
U("all"),
|
|
210
|
+
_(200)
|
|
211
|
+
].flat(),
|
|
212
|
+
children: [
|
|
213
|
+
{
|
|
214
|
+
type: "instance",
|
|
215
|
+
component: "HtmlEmbed",
|
|
216
|
+
label: "Chevron Icon",
|
|
217
|
+
props: [
|
|
218
|
+
{
|
|
219
|
+
type: "string",
|
|
220
|
+
name: "code",
|
|
221
|
+
value: q
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
children: []
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
type: "instance",
|
|
234
|
+
component: "NavigationMenuContent",
|
|
235
|
+
// left-0 top-0 absolute w-max
|
|
236
|
+
styles: [
|
|
237
|
+
y(0),
|
|
238
|
+
f(0),
|
|
239
|
+
v(),
|
|
240
|
+
c("max"),
|
|
241
|
+
a(4)
|
|
242
|
+
].flat(),
|
|
243
|
+
children: [
|
|
244
|
+
{
|
|
245
|
+
type: "instance",
|
|
246
|
+
component: "Box",
|
|
247
|
+
label: "Content",
|
|
248
|
+
styles: [n(), s(4), a(e.padding)].flat(),
|
|
249
|
+
children: e.children
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
], me = {
|
|
256
|
+
category: "radix",
|
|
257
|
+
order: 2,
|
|
258
|
+
type: "container",
|
|
259
|
+
description: "A collection of links for navigating websites.",
|
|
260
|
+
icon: x,
|
|
261
|
+
presetStyle: o,
|
|
262
|
+
template: [
|
|
263
|
+
{
|
|
264
|
+
type: "instance",
|
|
265
|
+
component: "NavigationMenu",
|
|
266
|
+
props: [],
|
|
267
|
+
// relative
|
|
268
|
+
// Omiting this: z-10 flex max-w-max flex-1 items-center justify-center
|
|
269
|
+
styles: [m(), B("max")].flat(),
|
|
270
|
+
children: [
|
|
271
|
+
{
|
|
272
|
+
type: "instance",
|
|
273
|
+
component: "NavigationMenuList",
|
|
274
|
+
styles: [
|
|
275
|
+
// ul defaults in tailwind
|
|
276
|
+
a(0),
|
|
277
|
+
h(0),
|
|
278
|
+
// shadcdn styles
|
|
279
|
+
n(),
|
|
280
|
+
n(1),
|
|
281
|
+
$("none"),
|
|
282
|
+
V("center"),
|
|
283
|
+
u("center"),
|
|
284
|
+
s(1)
|
|
285
|
+
].flat(),
|
|
286
|
+
children: [
|
|
287
|
+
...g({
|
|
288
|
+
title: "About",
|
|
289
|
+
padding: 2,
|
|
290
|
+
children: [
|
|
291
|
+
{
|
|
292
|
+
type: "instance",
|
|
293
|
+
component: "Box",
|
|
294
|
+
styles: [
|
|
295
|
+
r("border"),
|
|
296
|
+
a(4),
|
|
297
|
+
c(48),
|
|
298
|
+
d("md")
|
|
299
|
+
].flat(),
|
|
300
|
+
children: [
|
|
301
|
+
{
|
|
302
|
+
type: "text",
|
|
303
|
+
value: "",
|
|
304
|
+
placeholder: !0
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
...p({ count: 3, offset: 0 })
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
...g({
|
|
312
|
+
title: "Components",
|
|
313
|
+
padding: 0,
|
|
314
|
+
children: [
|
|
315
|
+
...p({ count: 3, offset: 3 }),
|
|
316
|
+
...p({ count: 3, offset: 6 })
|
|
317
|
+
]
|
|
318
|
+
}),
|
|
319
|
+
...ae({ title: "Standalone" })
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
type: "instance",
|
|
324
|
+
component: "Box",
|
|
325
|
+
label: "Viewport Container",
|
|
326
|
+
// absolute left-0 top-full flex justify-center
|
|
327
|
+
styles: [
|
|
328
|
+
v(),
|
|
329
|
+
y(0),
|
|
330
|
+
f("full"),
|
|
331
|
+
n(),
|
|
332
|
+
u("center")
|
|
333
|
+
].flat(),
|
|
334
|
+
children: [
|
|
335
|
+
{
|
|
336
|
+
type: "instance",
|
|
337
|
+
component: "NavigationMenuViewport",
|
|
338
|
+
/*
|
|
339
|
+
origin-top-center relative mt-1.5 w-full
|
|
340
|
+
overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg
|
|
341
|
+
h-[var(--radix-navigation-menu-viewport-height)]
|
|
342
|
+
w-[var(--radix-navigation-menu-viewport-width)]
|
|
343
|
+
// anims
|
|
344
|
+
[animation-duration:150ms!important] [transition-duration:150ms!important]
|
|
345
|
+
data-[state=open]:animate-in data-[state=closed]:animate-out
|
|
346
|
+
data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90
|
|
347
|
+
*/
|
|
348
|
+
styles: [
|
|
349
|
+
m(),
|
|
350
|
+
D(1.5),
|
|
351
|
+
F("hidden"),
|
|
352
|
+
d("md"),
|
|
353
|
+
S(),
|
|
354
|
+
r("popover"),
|
|
355
|
+
t("popoverForeground"),
|
|
356
|
+
W("lg"),
|
|
357
|
+
i(
|
|
358
|
+
"height",
|
|
359
|
+
"--radix-navigation-menu-viewport-height"
|
|
360
|
+
),
|
|
361
|
+
i("width", "--radix-navigation-menu-viewport-width")
|
|
362
|
+
].flat(),
|
|
363
|
+
children: []
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
}, ue = {
|
|
371
|
+
category: "hidden",
|
|
372
|
+
detachable: !1,
|
|
373
|
+
type: "container",
|
|
374
|
+
icon: w,
|
|
375
|
+
requiredAncestors: ["NavigationMenu"],
|
|
376
|
+
constraints: {
|
|
377
|
+
relation: "ancestor",
|
|
378
|
+
component: { $eq: "NavigationMenu" }
|
|
379
|
+
},
|
|
380
|
+
presetStyle: o,
|
|
381
|
+
label: "Menu List"
|
|
382
|
+
}, ge = {
|
|
383
|
+
category: "hidden",
|
|
384
|
+
type: "container",
|
|
385
|
+
icon: I,
|
|
386
|
+
requiredAncestors: ["NavigationMenu"],
|
|
387
|
+
constraints: {
|
|
388
|
+
relation: "ancestor",
|
|
389
|
+
component: { $eq: "NavigationMenu" }
|
|
390
|
+
},
|
|
391
|
+
presetStyle: o,
|
|
392
|
+
indexWithinAncestor: "NavigationMenu",
|
|
393
|
+
label: "Menu Item"
|
|
394
|
+
}, he = {
|
|
395
|
+
category: "hidden",
|
|
396
|
+
detachable: !1,
|
|
397
|
+
stylable: !1,
|
|
398
|
+
type: "container",
|
|
399
|
+
icon: A,
|
|
400
|
+
requiredAncestors: ["NavigationMenuItem"],
|
|
401
|
+
constraints: {
|
|
402
|
+
relation: "ancestor",
|
|
403
|
+
component: { $eq: "NavigationMenuItem" }
|
|
404
|
+
},
|
|
405
|
+
presetStyle: o,
|
|
406
|
+
label: "Menu Trigger"
|
|
407
|
+
}, ve = {
|
|
408
|
+
category: "hidden",
|
|
409
|
+
detachable: !1,
|
|
410
|
+
type: "container",
|
|
411
|
+
icon: k,
|
|
412
|
+
requiredAncestors: ["NavigationMenuItem"],
|
|
413
|
+
constraints: {
|
|
414
|
+
relation: "ancestor",
|
|
415
|
+
component: { $eq: "NavigationMenuItem" }
|
|
416
|
+
},
|
|
417
|
+
indexWithinAncestor: "NavigationMenu",
|
|
418
|
+
presetStyle: o,
|
|
419
|
+
label: "Menu Content"
|
|
420
|
+
}, ye = {
|
|
421
|
+
category: "hidden",
|
|
422
|
+
detachable: !0,
|
|
423
|
+
type: "container",
|
|
424
|
+
stylable: !1,
|
|
425
|
+
icon: L,
|
|
426
|
+
requiredAncestors: ["NavigationMenu"],
|
|
427
|
+
constraints: [
|
|
428
|
+
{
|
|
429
|
+
relation: "ancestor",
|
|
430
|
+
component: { $eq: "NavigationMenu" }
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
relation: "ancestor",
|
|
434
|
+
component: { $in: ["NavigationMenuContent", "NavigationMenuItem"] }
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
presetStyle: o,
|
|
438
|
+
label: "Accessible Link Wrapper"
|
|
439
|
+
}, fe = {
|
|
440
|
+
category: "hidden",
|
|
441
|
+
detachable: !0,
|
|
442
|
+
type: "container",
|
|
443
|
+
icon: C,
|
|
444
|
+
requiredAncestors: ["NavigationMenu"],
|
|
445
|
+
constraints: {
|
|
446
|
+
relation: "ancestor",
|
|
447
|
+
component: { $eq: "NavigationMenu" }
|
|
448
|
+
},
|
|
449
|
+
presetStyle: o,
|
|
450
|
+
label: "Menu Viewport"
|
|
451
|
+
}, Me = {
|
|
452
|
+
props: R
|
|
453
|
+
}, Ne = {
|
|
454
|
+
props: X
|
|
455
|
+
}, be = {
|
|
456
|
+
props: Y
|
|
457
|
+
}, xe = {
|
|
458
|
+
props: Z
|
|
459
|
+
}, we = {
|
|
460
|
+
props: ee
|
|
461
|
+
}, Ie = {
|
|
462
|
+
props: te
|
|
463
|
+
}, Ae = {
|
|
464
|
+
props: ne
|
|
465
|
+
};
|
|
466
|
+
export {
|
|
467
|
+
me as metaNavigationMenu,
|
|
468
|
+
ve as metaNavigationMenuContent,
|
|
469
|
+
ge as metaNavigationMenuItem,
|
|
470
|
+
ye as metaNavigationMenuLink,
|
|
471
|
+
ue as metaNavigationMenuList,
|
|
472
|
+
he as metaNavigationMenuTrigger,
|
|
473
|
+
fe as metaNavigationMenuViewport,
|
|
474
|
+
Me as propsMetaNavigationMenu,
|
|
475
|
+
xe as propsMetaNavigationMenuContent,
|
|
476
|
+
Ne as propsMetaNavigationMenuItem,
|
|
477
|
+
we as propsMetaNavigationMenuLink,
|
|
478
|
+
Ie as propsMetaNavigationMenuList,
|
|
479
|
+
be as propsMetaNavigationMenuTrigger,
|
|
480
|
+
Ae as propsMetaNavigationMenuViewport
|
|
481
|
+
};
|
package/lib/popover.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, Children as P } from "react";
|
|
3
|
+
import * as s from "@radix-ui/react-popover";
|
|
4
|
+
import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const l = c((o, t) => /* @__PURE__ */ n(s.Root, { ...o })), v = c(({ children: o, ...t }, e) => {
|
|
6
|
+
const r = P.toArray(o)[0];
|
|
7
|
+
return /* @__PURE__ */ n(s.Trigger, { asChild: !0, ref: e, ...t, children: r ?? /* @__PURE__ */ n("button", { children: "Add button or link" }) });
|
|
8
|
+
}), h = c(
|
|
9
|
+
({ sideOffset: o = 4, align: t = "center", hideWhenDetached: e = !0, ...r }, p) => /* @__PURE__ */ n(s.Portal, { children: /* @__PURE__ */ n(
|
|
10
|
+
s.Content,
|
|
11
|
+
{
|
|
12
|
+
ref: p,
|
|
13
|
+
align: "center",
|
|
14
|
+
sideOffset: o,
|
|
15
|
+
hideWhenDetached: e,
|
|
16
|
+
...r
|
|
17
|
+
}
|
|
18
|
+
) })
|
|
19
|
+
), i = "@webstudio-is/sdk-components-react-radix", g = {
|
|
20
|
+
onNavigatorUnselect: (o, t) => {
|
|
21
|
+
for (const e of t.instancePath)
|
|
22
|
+
if (e.component === `${i}:PopoverContent`) {
|
|
23
|
+
const r = a(
|
|
24
|
+
t.instancePath,
|
|
25
|
+
e,
|
|
26
|
+
`${i}:Popover`
|
|
27
|
+
);
|
|
28
|
+
r && o.setMemoryProp(r, "open", void 0);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onNavigatorSelect: (o, t) => {
|
|
32
|
+
for (const e of t.instancePath)
|
|
33
|
+
if (e.component === `${i}:PopoverContent`) {
|
|
34
|
+
const r = a(
|
|
35
|
+
t.instancePath,
|
|
36
|
+
e,
|
|
37
|
+
`${i}:Popover`
|
|
38
|
+
);
|
|
39
|
+
r && o.setMemoryProp(r, "open", !0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
l as Popover,
|
|
45
|
+
h as PopoverContent,
|
|
46
|
+
v as PopoverTrigger,
|
|
47
|
+
g as hooksPopover
|
|
48
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { TriggerIcon as e, ContentIcon as o, PopoverIcon as t } from "@webstudio-is/icons/svg";
|
|
2
|
+
import "@webstudio-is/react-sdk";
|
|
3
|
+
import { div as r } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { z as n, w as p, rounded as i, border as a, bg as s, p as c, text as l, shadow as d, outline as m } from "./theme/tailwind-classes.js";
|
|
5
|
+
import { getButtonStyles as y } from "./theme/styles.js";
|
|
6
|
+
import { propsPopover as g, propsPopoverTrigger as v, propsPopoverContent as P } from "./__generated__/popover.props.js";
|
|
7
|
+
const f = {
|
|
8
|
+
div: r
|
|
9
|
+
}, B = {
|
|
10
|
+
category: "hidden",
|
|
11
|
+
type: "container",
|
|
12
|
+
icon: e,
|
|
13
|
+
stylable: !1,
|
|
14
|
+
detachable: !1
|
|
15
|
+
}, I = {
|
|
16
|
+
category: "hidden",
|
|
17
|
+
type: "container",
|
|
18
|
+
presetStyle: f,
|
|
19
|
+
icon: o,
|
|
20
|
+
detachable: !1
|
|
21
|
+
}, M = {
|
|
22
|
+
category: "radix",
|
|
23
|
+
order: 6,
|
|
24
|
+
type: "container",
|
|
25
|
+
icon: t,
|
|
26
|
+
stylable: !1,
|
|
27
|
+
description: "Displays rich content in a portal, triggered by a button.",
|
|
28
|
+
template: [
|
|
29
|
+
{
|
|
30
|
+
type: "instance",
|
|
31
|
+
component: "Popover",
|
|
32
|
+
props: [],
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
type: "instance",
|
|
36
|
+
component: "PopoverTrigger",
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
type: "instance",
|
|
40
|
+
component: "Button",
|
|
41
|
+
styles: y("outline"),
|
|
42
|
+
children: [{ type: "text", value: "Button", placeholder: !0 }]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "instance",
|
|
48
|
+
component: "PopoverContent",
|
|
49
|
+
/**
|
|
50
|
+
* z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none
|
|
51
|
+
**/
|
|
52
|
+
styles: [
|
|
53
|
+
n(50),
|
|
54
|
+
p(72),
|
|
55
|
+
i("md"),
|
|
56
|
+
a(),
|
|
57
|
+
s("popover"),
|
|
58
|
+
c(4),
|
|
59
|
+
l("popoverForeground"),
|
|
60
|
+
d("md"),
|
|
61
|
+
m()
|
|
62
|
+
].flat(),
|
|
63
|
+
children: [
|
|
64
|
+
{
|
|
65
|
+
type: "instance",
|
|
66
|
+
component: "Text",
|
|
67
|
+
children: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
value: "The text you can edit",
|
|
71
|
+
placeholder: !0
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}, w = {
|
|
81
|
+
props: g,
|
|
82
|
+
initialProps: ["open"]
|
|
83
|
+
}, O = {
|
|
84
|
+
props: v
|
|
85
|
+
}, S = {
|
|
86
|
+
props: P,
|
|
87
|
+
initialProps: ["side", "sideOffset", "align", "alignOffset"]
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
M as metaPopover,
|
|
91
|
+
I as metaPopoverContent,
|
|
92
|
+
B as metaPopoverTrigger,
|
|
93
|
+
w as propsMetaPopover,
|
|
94
|
+
S as propsMetaPopoverContent,
|
|
95
|
+
O as propsMetaPopoverTrigger
|
|
96
|
+
};
|