@webstudio-is/sdk-components-react-radix 0.0.0-5844e28 → 0.0.0-73cd6ea
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 +15 -2582
- package/lib/__generated__/checkbox.props.js +5 -1071
- package/lib/__generated__/collapsible.props.js +7 -1012
- package/lib/__generated__/dialog.props.js +10 -2585
- package/lib/__generated__/label.props.js +2 -517
- package/lib/__generated__/navigation-menu.props.js +13 -3625
- package/lib/__generated__/popover.props.js +7 -509
- package/lib/__generated__/radio-group.props.js +19 -1568
- package/lib/__generated__/select.props.js +42 -3615
- package/lib/__generated__/switch.props.js +5 -1071
- package/lib/__generated__/tabs.props.js +17 -2073
- package/lib/__generated__/tooltip.props.js +6 -503
- package/lib/accordion.js +33 -20
- package/lib/accordion.template.js +14 -14
- package/lib/accordion.ws.js +56 -93
- package/lib/checkbox.js +17 -6
- package/lib/checkbox.template.js +10 -10
- package/lib/checkbox.ws.js +26 -41
- package/lib/collapsible.js +29 -26
- package/lib/collapsible.ws.js +28 -48
- package/lib/components.js +46 -45
- package/lib/dialog.js +50 -56
- package/lib/dialog.template.js +19 -19
- package/lib/dialog.ws.js +68 -126
- package/lib/label.template.js +3 -3
- package/lib/label.ws.js +8 -15
- package/lib/metas.js +45 -44
- package/lib/navigation-menu.js +21 -20
- package/lib/navigation-menu.template.js +8 -8
- package/lib/navigation-menu.ws.js +71 -102
- package/lib/popover.js +36 -32
- package/lib/popover.template.js +50 -20
- package/lib/popover.ws.js +45 -44
- package/lib/radio-group.js +10 -7
- package/lib/radio-group.ws.js +37 -61
- package/lib/select.js +49 -37
- package/lib/select.ws.js +71 -137
- package/lib/shared/meta.js +13 -0
- package/lib/shared/preset-styles.js +29 -29
- package/lib/shared/theme.js +25 -68
- package/lib/sheet.template.js +32 -32
- package/lib/switch.js +9 -6
- package/lib/switch.template.js +9 -9
- package/lib/switch.ws.js +29 -52
- package/lib/tabs.js +50 -53
- package/lib/tabs.template.js +16 -16
- package/lib/tabs.ws.js +41 -76
- package/lib/tooltip.js +34 -31
- package/lib/tooltip.ws.js +27 -42
- package/lib/types/__generated__/popover.props.d.ts +1 -0
- package/lib/types/accordion.ws.d.ts +1 -6
- package/lib/types/checkbox.ws.d.ts +1 -3
- package/lib/types/collapsible.d.ts +2 -2
- package/lib/types/collapsible.ws.d.ts +1 -4
- package/lib/types/components.d.ts +1 -1
- package/lib/types/dialog.ws.d.ts +1 -8
- package/lib/types/label.ws.d.ts +1 -2
- package/lib/types/metas.d.ts +1 -1
- package/lib/types/navigation-menu.ws.d.ts +1 -8
- package/lib/types/popover.d.ts +1 -0
- package/lib/types/popover.ws.d.ts +2 -4
- package/lib/types/radio-group.d.ts +1 -1
- package/lib/types/radio-group.ws.d.ts +1 -4
- package/lib/types/select.d.ts +3 -3
- package/lib/types/select.ws.d.ts +1 -9
- package/lib/types/shared/meta.d.ts +1 -0
- package/lib/types/shared/preset-styles.d.ts +2 -2
- package/lib/types/shared/proxy.d.ts +1 -0
- package/lib/types/switch.ws.d.ts +1 -3
- package/lib/types/tabs.d.ts +1 -4
- package/lib/types/tabs.ws.d.ts +1 -5
- package/lib/types/tooltip.ws.d.ts +1 -4
- package/package.json +21 -27
- package/lib/props.js +0 -62
- package/lib/types/props.d.ts +0 -12
package/lib/metas.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { metaCollapsible as t, metaCollapsibleContent as o, metaCollapsibleTrigger as i } from "./collapsible.ws.js";
|
|
2
2
|
import { metaDialog as n, metaDialogClose as m, metaDialogContent as s, metaDialogDescription as l, metaDialogOverlay as g, metaDialogTitle as c, metaDialogTrigger as p } from "./dialog.ws.js";
|
|
3
|
-
import { metaPopover as C,
|
|
4
|
-
import { metaTooltip as
|
|
5
|
-
import { metaTabs as
|
|
6
|
-
import { meta as
|
|
7
|
-
import { metaAccordion as L, metaAccordionContent as k, metaAccordionHeader as G, metaAccordionItem as
|
|
8
|
-
import { metaNavigationMenu as
|
|
9
|
-
import { metaSelect as
|
|
10
|
-
import { metaSwitch as
|
|
11
|
-
import { metaCheckbox as
|
|
12
|
-
import { metaRadioGroup as
|
|
3
|
+
import { metaPopover as C, metaPopoverClose as d, metaPopoverContent as u, metaPopoverTrigger as v } from "./popover.ws.js";
|
|
4
|
+
import { metaTooltip as S, metaTooltipContent as x, metaTooltipTrigger as I } from "./tooltip.ws.js";
|
|
5
|
+
import { metaTabs as M, metaTabsContent as N, metaTabsList as f, metaTabsTrigger as h } from "./tabs.ws.js";
|
|
6
|
+
import { meta as w } from "./label.ws.js";
|
|
7
|
+
import { metaAccordion as L, metaAccordionContent as k, metaAccordionHeader as G, metaAccordionItem as R, metaAccordionTrigger as V } from "./accordion.ws.js";
|
|
8
|
+
import { metaNavigationMenu as H, metaNavigationMenuContent as O, metaNavigationMenuItem as j, metaNavigationMenuLink as q, metaNavigationMenuList as z, metaNavigationMenuTrigger as B, metaNavigationMenuViewport as E } from "./navigation-menu.ws.js";
|
|
9
|
+
import { metaSelect as J, metaSelectContent as K, metaSelectItem as Q, metaSelectItemIndicator as U, metaSelectItemText as W, metaSelectTrigger as X, metaSelectValue as Y, metaSelectViewport as Z } from "./select.ws.js";
|
|
10
|
+
import { metaSwitch as $, metaSwitchThumb as ee } from "./switch.ws.js";
|
|
11
|
+
import { metaCheckbox as te, metaCheckboxIndicator as oe } from "./checkbox.ws.js";
|
|
12
|
+
import { metaRadioGroup as re, metaRadioGroupIndicator as ne, metaRadioGroupItem as me } from "./radio-group.ws.js";
|
|
13
13
|
export {
|
|
14
14
|
L as Accordion,
|
|
15
15
|
k as AccordionContent,
|
|
16
16
|
G as AccordionHeader,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
R as AccordionItem,
|
|
18
|
+
V as AccordionTrigger,
|
|
19
|
+
te as Checkbox,
|
|
20
|
+
oe as CheckboxIndicator,
|
|
21
21
|
t as Collapsible,
|
|
22
22
|
o as CollapsibleContent,
|
|
23
23
|
i as CollapsibleTrigger,
|
|
@@ -28,35 +28,36 @@ export {
|
|
|
28
28
|
g as DialogOverlay,
|
|
29
29
|
c as DialogTitle,
|
|
30
30
|
p as DialogTrigger,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
w as Label,
|
|
32
|
+
H as NavigationMenu,
|
|
33
|
+
O as NavigationMenuContent,
|
|
34
|
+
j as NavigationMenuItem,
|
|
35
|
+
q as NavigationMenuLink,
|
|
36
|
+
z as NavigationMenuList,
|
|
37
|
+
B as NavigationMenuTrigger,
|
|
38
|
+
E as NavigationMenuViewport,
|
|
39
39
|
C as Popover,
|
|
40
|
-
d as
|
|
41
|
-
u as
|
|
42
|
-
|
|
43
|
-
re as
|
|
44
|
-
ne as
|
|
45
|
-
|
|
46
|
-
J as
|
|
47
|
-
K as
|
|
48
|
-
Q as
|
|
49
|
-
U as
|
|
50
|
-
W as
|
|
51
|
-
X as
|
|
52
|
-
Y as
|
|
53
|
-
|
|
54
|
-
$ as
|
|
55
|
-
|
|
56
|
-
M as
|
|
57
|
-
N as
|
|
58
|
-
f as
|
|
59
|
-
|
|
60
|
-
S as
|
|
61
|
-
x as
|
|
40
|
+
d as PopoverClose,
|
|
41
|
+
u as PopoverContent,
|
|
42
|
+
v as PopoverTrigger,
|
|
43
|
+
re as RadioGroup,
|
|
44
|
+
ne as RadioGroupIndicator,
|
|
45
|
+
me as RadioGroupItem,
|
|
46
|
+
J as Select,
|
|
47
|
+
K as SelectContent,
|
|
48
|
+
Q as SelectItem,
|
|
49
|
+
U as SelectItemIndicator,
|
|
50
|
+
W as SelectItemText,
|
|
51
|
+
X as SelectTrigger,
|
|
52
|
+
Y as SelectValue,
|
|
53
|
+
Z as SelectViewport,
|
|
54
|
+
$ as Switch,
|
|
55
|
+
ee as SwitchThumb,
|
|
56
|
+
M as Tabs,
|
|
57
|
+
N as TabsContent,
|
|
58
|
+
f as TabsList,
|
|
59
|
+
h as TabsTrigger,
|
|
60
|
+
S as Tooltip,
|
|
61
|
+
x as TooltipContent,
|
|
62
|
+
I as TooltipTrigger
|
|
62
63
|
};
|
package/lib/navigation-menu.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useContext as v, Children as g } from "react";
|
|
2
3
|
import * as a from "@radix-ui/react-navigation-menu";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
const { renderer: t } = f
|
|
4
|
+
import { getIndexWithinAncestorFromProps as l } from "@webstudio-is/sdk/runtime";
|
|
5
|
+
import { ReactSdkContext as f, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
|
|
6
|
+
const C = c(({ value: o, ...n }, e) => {
|
|
7
|
+
const { renderer: t } = v(f);
|
|
7
8
|
let i = o;
|
|
8
9
|
return t === "canvas" && (i = i === "" ? "-1" : i), /* @__PURE__ */ r(a.Root, { ref: e, value: i, ...n });
|
|
9
|
-
}),
|
|
10
|
+
}), P = a.List, k = a.Viewport, x = a.Content, A = c(({ value: o, ...n }, e) => {
|
|
10
11
|
const t = l(n);
|
|
11
12
|
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
13
|
}), I = c(({ children: o, ...n }, e) => {
|
|
16
|
-
const t =
|
|
14
|
+
const t = g.toArray(o)[0];
|
|
15
|
+
return /* @__PURE__ */ r(a.Link, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("a", { children: "Add link component" }) });
|
|
16
|
+
}), $ = c(({ children: o, ...n }, e) => {
|
|
17
|
+
const t = g.toArray(o)[0];
|
|
17
18
|
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
|
+
}), s = "@webstudio-is/sdk-components-react-radix", w = {
|
|
19
20
|
onNavigatorUnselect: (o, n) => {
|
|
20
21
|
for (const e of n.instancePath)
|
|
21
22
|
if (e.component === `${s}:NavigationMenuContent`) {
|
|
@@ -42,18 +43,18 @@ const p = c(({ value: o, ...n }, e) => {
|
|
|
42
43
|
);
|
|
43
44
|
if (u === void 0 || i === void 0)
|
|
44
45
|
return;
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const m = o.getPropValue(u, "value") ?? ((e = o.indexesWithinAncestors.get(u.id)) == null ? void 0 : e.toString());
|
|
47
|
+
m && o.setMemoryProp(i, "value", m);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
C as NavigationMenu,
|
|
53
|
+
x as NavigationMenuContent,
|
|
54
|
+
A as NavigationMenuItem,
|
|
55
|
+
I as NavigationMenuLink,
|
|
56
|
+
P as NavigationMenuList,
|
|
57
|
+
$ as NavigationMenuTrigger,
|
|
58
|
+
k as NavigationMenuViewport,
|
|
59
|
+
w as hooksNavigationMenu
|
|
59
60
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDownIcon as w } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
3
|
+
import { css as t, $ as n, PlaceholderValue as l } from "@webstudio-is/template";
|
|
4
4
|
import { radix as r } from "./shared/proxy.js";
|
|
5
5
|
import { getButtonStyle as u } from "./shared/styles.js";
|
|
6
|
-
import { spacing as i,
|
|
6
|
+
import { spacing as i, borderRadius as h, borderWidth as v, colors as a, boxShadow as b, height as y, width as p, transition as x, fontSize as m, weights as $, lineHeight as c } from "./shared/theme.js";
|
|
7
7
|
const k = [
|
|
8
8
|
{
|
|
9
9
|
title: "Sheet",
|
|
@@ -60,7 +60,7 @@ const k = [
|
|
|
60
60
|
flex-direction: column;
|
|
61
61
|
user-select: none;
|
|
62
62
|
gap: ${i[1]};
|
|
63
|
-
border-radius: ${
|
|
63
|
+
border-radius: ${h.md};
|
|
64
64
|
padding: ${i[3]};
|
|
65
65
|
line-height: ${c.none};
|
|
66
66
|
text-decoration-line: none;
|
|
@@ -106,7 +106,7 @@ const k = [
|
|
|
106
106
|
{
|
|
107
107
|
"ws:label": "Flex Column",
|
|
108
108
|
"ws:style": t`
|
|
109
|
-
width: ${
|
|
109
|
+
width: ${p[64]};
|
|
110
110
|
display: flex;
|
|
111
111
|
gap: ${i[4]};
|
|
112
112
|
flex-direction: column;
|
|
@@ -129,8 +129,8 @@ const k = [
|
|
|
129
129
|
"ws:style": t`
|
|
130
130
|
background-color: ${a.border};
|
|
131
131
|
padding: ${i[4]};
|
|
132
|
-
width: ${
|
|
133
|
-
border-radius: ${
|
|
132
|
+
width: ${p[48]};
|
|
133
|
+
border-radius: ${h.md};
|
|
134
134
|
`,
|
|
135
135
|
children: new l("")
|
|
136
136
|
}
|
|
@@ -174,7 +174,7 @@ const k = [
|
|
|
174
174
|
margin-left: ${i[1]};
|
|
175
175
|
rotate: var(--navigation-menu-trigger-icon-transform);
|
|
176
176
|
height: ${y[4]};
|
|
177
|
-
width: ${
|
|
177
|
+
width: ${p[4]};
|
|
178
178
|
flex-shrink: 0;
|
|
179
179
|
transition: ${x.all};
|
|
180
180
|
transition-duration: 200ms;
|
|
@@ -262,7 +262,7 @@ const k = [
|
|
|
262
262
|
position: relative;
|
|
263
263
|
margin-top: ${i[1.5]};
|
|
264
264
|
overflow: hidden;
|
|
265
|
-
border-radius: ${
|
|
265
|
+
border-radius: ${h.md};
|
|
266
266
|
border: ${v.DEFAULT} solid ${a.border};
|
|
267
267
|
background-color: ${a.popover};
|
|
268
268
|
color: ${a.popoverForeground};
|
|
@@ -1,124 +1,93 @@
|
|
|
1
|
-
import { NavigationMenuIcon as t, ListIcon as
|
|
2
|
-
import { div as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { NavigationMenuIcon as t, ListIcon as o, ListItemIcon as i, TriggerIcon as a, ContentIcon as r, BoxIcon as c, ViewportIcon as s } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as e } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as n } from "./shared/meta.js";
|
|
4
|
+
import { propsNavigationMenu as p, propsNavigationMenuList as g, propsNavigationMenuItem as M, propsNavigationMenuTrigger as l, propsNavigationMenuContent as u, propsNavigationMenuLink as d, propsNavigationMenuViewport as v } from "./__generated__/navigation-menu.props.js";
|
|
5
|
+
const L = {
|
|
6
6
|
icon: t,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
contentModel: {
|
|
8
|
+
category: "instance",
|
|
9
|
+
children: ["instance"],
|
|
10
|
+
descendants: [n.NavigationMenuList, n.NavigationMenuViewport]
|
|
9
11
|
},
|
|
10
|
-
constraints: [
|
|
11
|
-
{
|
|
12
|
-
relation: "descendant",
|
|
13
|
-
component: { $eq: "NavigationMenuList" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
relation: "descendant",
|
|
17
|
-
component: { $eq: "NavigationMenuViewport" }
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}, L = {
|
|
21
|
-
type: "container",
|
|
22
|
-
icon: e,
|
|
23
|
-
constraints: [
|
|
24
|
-
{
|
|
25
|
-
relation: "ancestor",
|
|
26
|
-
component: { $eq: "NavigationMenu" }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
relation: "descendant",
|
|
30
|
-
component: { $eq: "NavigationMenuItem" }
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
12
|
presetStyle: {
|
|
34
|
-
div:
|
|
13
|
+
div: e
|
|
35
14
|
},
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
type: "container",
|
|
15
|
+
props: p
|
|
16
|
+
}, h = {
|
|
39
17
|
icon: o,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
label: "Menu List",
|
|
19
|
+
contentModel: {
|
|
20
|
+
category: "none",
|
|
21
|
+
children: ["instance"],
|
|
22
|
+
descendants: [n.NavigationMenuItem]
|
|
43
23
|
},
|
|
44
24
|
presetStyle: {
|
|
45
|
-
div:
|
|
25
|
+
div: e
|
|
46
26
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, d = {
|
|
50
|
-
type: "container",
|
|
27
|
+
props: g
|
|
28
|
+
}, b = {
|
|
51
29
|
icon: i,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
30
|
+
label: "Menu Item",
|
|
31
|
+
indexWithinAncestor: n.NavigationMenu,
|
|
32
|
+
contentModel: {
|
|
33
|
+
category: "none",
|
|
34
|
+
children: ["instance"],
|
|
35
|
+
descendants: [
|
|
36
|
+
n.NavigationMenuTrigger,
|
|
37
|
+
n.NavigationMenuContent,
|
|
38
|
+
n.NavigationMenuLink
|
|
39
|
+
]
|
|
55
40
|
},
|
|
56
|
-
label: "Menu Trigger"
|
|
57
|
-
}, q = {
|
|
58
|
-
type: "container",
|
|
59
|
-
icon: a,
|
|
60
|
-
constraints: {
|
|
61
|
-
relation: "ancestor",
|
|
62
|
-
component: { $eq: "NavigationMenuItem" }
|
|
63
|
-
},
|
|
64
|
-
indexWithinAncestor: "NavigationMenu",
|
|
65
41
|
presetStyle: {
|
|
66
|
-
div:
|
|
42
|
+
div: e
|
|
67
43
|
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
relation: "ancestor",
|
|
79
|
-
component: { $in: ["NavigationMenuContent", "NavigationMenuItem"] }
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
label: "Accessible Link Wrapper"
|
|
44
|
+
props: M
|
|
45
|
+
}, k = {
|
|
46
|
+
icon: a,
|
|
47
|
+
label: "Menu Trigger",
|
|
48
|
+
contentModel: {
|
|
49
|
+
category: "none",
|
|
50
|
+
children: ["instance"]
|
|
51
|
+
},
|
|
52
|
+
props: l
|
|
83
53
|
}, w = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
54
|
+
icon: r,
|
|
55
|
+
label: "Menu Content",
|
|
56
|
+
contentModel: {
|
|
57
|
+
category: "none",
|
|
58
|
+
children: ["instance"],
|
|
59
|
+
descendants: [n.NavigationMenuLink]
|
|
89
60
|
},
|
|
90
61
|
presetStyle: {
|
|
91
|
-
div:
|
|
62
|
+
div: e
|
|
92
63
|
},
|
|
93
|
-
|
|
64
|
+
props: u
|
|
94
65
|
}, C = {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
66
|
+
icon: c,
|
|
67
|
+
label: "Accessible Link Wrapper",
|
|
68
|
+
contentModel: {
|
|
69
|
+
category: "none",
|
|
70
|
+
children: ["instance"]
|
|
71
|
+
},
|
|
72
|
+
props: d
|
|
98
73
|
}, S = {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
74
|
+
icon: s,
|
|
75
|
+
label: "Menu Viewport",
|
|
76
|
+
contentModel: {
|
|
77
|
+
category: "none",
|
|
78
|
+
children: ["instance"]
|
|
79
|
+
},
|
|
80
|
+
presetStyle: {
|
|
81
|
+
div: e
|
|
82
|
+
},
|
|
105
83
|
props: v
|
|
106
|
-
}, f = {
|
|
107
|
-
props: N
|
|
108
84
|
};
|
|
109
85
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
C as propsMetaNavigationMenu,
|
|
118
|
-
T as propsMetaNavigationMenuContent,
|
|
119
|
-
V as propsMetaNavigationMenuItem,
|
|
120
|
-
k as propsMetaNavigationMenuLink,
|
|
121
|
-
x as propsMetaNavigationMenuList,
|
|
122
|
-
S as propsMetaNavigationMenuTrigger,
|
|
123
|
-
f as propsMetaNavigationMenuViewport
|
|
86
|
+
L as metaNavigationMenu,
|
|
87
|
+
w as metaNavigationMenuContent,
|
|
88
|
+
b as metaNavigationMenuItem,
|
|
89
|
+
C as metaNavigationMenuLink,
|
|
90
|
+
h as metaNavigationMenuList,
|
|
91
|
+
k as metaNavigationMenuTrigger,
|
|
92
|
+
S as metaNavigationMenuViewport
|
|
124
93
|
};
|
package/lib/popover.js
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p, useState as f, useEffect as P, Children as l } from "react";
|
|
3
3
|
import * as s from "@radix-ui/react-popover";
|
|
4
4
|
import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
}),
|
|
9
|
-
|
|
5
|
+
const h = p((t, n) => {
|
|
6
|
+
const o = t.open ?? !1, [e, i] = f(o);
|
|
7
|
+
return P(() => i(o), [o]), /* @__PURE__ */ r(s.Root, { ...t, open: e, onOpenChange: i });
|
|
8
|
+
}), u = p(({ children: t, ...n }, o) => {
|
|
9
|
+
const e = l.toArray(t)[0];
|
|
10
|
+
return /* @__PURE__ */ r(s.Trigger, { asChild: !0, ref: o, ...n, children: e ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
11
|
+
}), C = p(
|
|
12
|
+
({ sideOffset: t = 4, align: n = "center", hideWhenDetached: o = !0, ...e }, i) => /* @__PURE__ */ r(s.Portal, { children: /* @__PURE__ */ r(
|
|
10
13
|
s.Content,
|
|
11
14
|
{
|
|
12
|
-
ref:
|
|
15
|
+
ref: i,
|
|
13
16
|
align: "center",
|
|
14
|
-
sideOffset:
|
|
15
|
-
hideWhenDetached:
|
|
16
|
-
...
|
|
17
|
+
sideOffset: t,
|
|
18
|
+
hideWhenDetached: o,
|
|
19
|
+
...e
|
|
17
20
|
}
|
|
18
21
|
) })
|
|
19
|
-
),
|
|
20
|
-
onNavigatorUnselect: (
|
|
21
|
-
for (const
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`${
|
|
22
|
+
), g = s.Close, c = "@webstudio-is/sdk-components-react-radix", $ = {
|
|
23
|
+
onNavigatorUnselect: (t, n) => {
|
|
24
|
+
for (const o of n.instancePath)
|
|
25
|
+
if (o.component === `${c}:PopoverContent`) {
|
|
26
|
+
const e = a(
|
|
27
|
+
n.instancePath,
|
|
28
|
+
o,
|
|
29
|
+
`${c}:Popover`
|
|
27
30
|
);
|
|
28
|
-
|
|
31
|
+
e && t.setMemoryProp(e, "open", void 0);
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
|
-
onNavigatorSelect: (
|
|
32
|
-
for (const
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`${
|
|
34
|
+
onNavigatorSelect: (t, n) => {
|
|
35
|
+
for (const o of n.instancePath)
|
|
36
|
+
if (o.component === `${c}:PopoverContent`) {
|
|
37
|
+
const e = a(
|
|
38
|
+
n.instancePath,
|
|
39
|
+
o,
|
|
40
|
+
`${c}:Popover`
|
|
38
41
|
);
|
|
39
|
-
|
|
42
|
+
e && t.setMemoryProp(e, "open", !0);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
46
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
h as Popover,
|
|
48
|
+
g as PopoverClose,
|
|
49
|
+
C as PopoverContent,
|
|
50
|
+
u as PopoverTrigger,
|
|
51
|
+
$ as hooksPopover
|
|
48
52
|
};
|
package/lib/popover.template.js
CHANGED
|
@@ -1,33 +1,63 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { LargeXIcon as p } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as r, PlaceholderValue as d, css as l } from "@webstudio-is/template";
|
|
4
|
+
import { radix as e } from "./shared/proxy.js";
|
|
5
|
+
import { getButtonStyle as h } from "./shared/styles.js";
|
|
6
|
+
import { spacing as t, borderRadius as s, height as a, opacity as m, boxShadow as c, zIndex as b, width as u, borderWidth as g, colors as i } from "./shared/theme.js";
|
|
7
|
+
const P = {
|
|
7
8
|
category: "radix",
|
|
8
9
|
description: "Displays rich content in a portal, triggered by a button.",
|
|
9
10
|
order: 6,
|
|
10
|
-
template: /* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */ o(
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
|
|
11
|
+
template: /* @__PURE__ */ n(e.Popover, { children: [
|
|
12
|
+
/* @__PURE__ */ o(e.PopoverTrigger, { children: /* @__PURE__ */ o(r.Button, { "ws:style": h("outline"), children: new d("Button") }) }),
|
|
13
|
+
/* @__PURE__ */ n(
|
|
14
|
+
e.PopoverContent,
|
|
14
15
|
{
|
|
15
|
-
"ws:style":
|
|
16
|
-
z-index: ${
|
|
17
|
-
width: ${
|
|
16
|
+
"ws:style": l`
|
|
17
|
+
z-index: ${b[50]};
|
|
18
|
+
width: ${u[72]};
|
|
18
19
|
border-radius: ${s.md};
|
|
19
|
-
border: ${
|
|
20
|
-
background-color: ${
|
|
21
|
-
padding: ${
|
|
22
|
-
color: ${
|
|
23
|
-
box-shadow: ${
|
|
20
|
+
border: ${g.DEFAULT} solid ${i.border};
|
|
21
|
+
background-color: ${i.popover};
|
|
22
|
+
padding: ${t[4]};
|
|
23
|
+
color: ${i.popoverForeground};
|
|
24
|
+
box-shadow: ${c.md};
|
|
24
25
|
outline: none;
|
|
25
26
|
`,
|
|
26
|
-
children:
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ o(r.Text, { children: new d("The text you can edit") }),
|
|
29
|
+
/* @__PURE__ */ o(
|
|
30
|
+
e.PopoverClose,
|
|
31
|
+
{
|
|
32
|
+
"ws:label": "Close Button",
|
|
33
|
+
"ws:style": l`
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: ${t[4]};
|
|
36
|
+
top: ${t[4]};
|
|
37
|
+
border-radius: ${s.sm};
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
height: ${a[4]};
|
|
42
|
+
width: ${a[4]};
|
|
43
|
+
border: 0;
|
|
44
|
+
background-color: transparent;
|
|
45
|
+
outline: none;
|
|
46
|
+
&:hover {
|
|
47
|
+
opacity: ${m[100]};
|
|
48
|
+
}
|
|
49
|
+
&:focus-visible {
|
|
50
|
+
box-shadow: ${c.ring};
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
children: /* @__PURE__ */ o(r.HtmlEmbed, { "ws:label": "Close Icon", code: p })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
27
57
|
}
|
|
28
58
|
)
|
|
29
59
|
] })
|
|
30
60
|
};
|
|
31
61
|
export {
|
|
32
|
-
|
|
62
|
+
P as meta
|
|
33
63
|
};
|