@webstudio-is/sdk-components-react-radix 0.0.0-021f2d4
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/LICENSE +661 -0
- package/README.md +4 -0
- 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 +3687 -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.template.js +95 -0
- package/lib/accordion.ws.js +117 -0
- package/lib/checkbox.js +8 -0
- package/lib/checkbox.template.js +63 -0
- package/lib/checkbox.ws.js +51 -0
- package/lib/collapsible.js +37 -0
- package/lib/collapsible.template.js +16 -0
- package/lib/collapsible.ws.js +59 -0
- package/lib/components.js +62 -0
- package/lib/dialog.js +102 -0
- package/lib/dialog.template.js +119 -0
- package/lib/dialog.ws.js +138 -0
- package/lib/hooks.js +21 -0
- package/lib/label.js +7 -0
- package/lib/label.template.js +23 -0
- package/lib/label.ws.js +19 -0
- package/lib/metas.js +62 -0
- package/lib/navigation-menu.js +59 -0
- package/lib/navigation-menu.template.js +283 -0
- package/lib/navigation-menu.ws.js +124 -0
- package/lib/popover.js +48 -0
- package/lib/popover.template.js +33 -0
- package/lib/popover.ws.js +50 -0
- package/lib/props.js +62 -0
- package/lib/radio-group.js +9 -0
- package/lib/radio-group.template.js +66 -0
- package/lib/radio-group.ws.js +73 -0
- package/lib/select.js +46 -0
- package/lib/select.template.js +121 -0
- package/lib/select.ws.js +155 -0
- package/lib/shared/preset-styles.js +38 -0
- package/lib/shared/proxy.js +5 -0
- package/lib/shared/styles.js +51 -0
- package/lib/shared/theme.js +162 -0
- package/lib/sheet.template.js +129 -0
- package/lib/switch.js +8 -0
- package/lib/switch.template.js +63 -0
- package/lib/switch.ws.js +63 -0
- package/lib/tabs.js +65 -0
- package/lib/tabs.template.js +66 -0
- package/lib/tabs.ws.js +88 -0
- package/lib/templates.js +28 -0
- package/lib/tooltip.js +45 -0
- package/lib/tooltip.template.js +33 -0
- package/lib/tooltip.ws.js +50 -0
- package/lib/types/__generated__/accordion.props.d.ts +6 -0
- package/lib/types/__generated__/checkbox.props.d.ts +3 -0
- package/lib/types/__generated__/collapsible.props.d.ts +4 -0
- package/lib/types/__generated__/dialog.props.d.ts +8 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
- package/lib/types/__generated__/popover.props.d.ts +4 -0
- package/lib/types/__generated__/radio-group.props.d.ts +4 -0
- package/lib/types/__generated__/select.props.d.ts +9 -0
- package/lib/types/__generated__/switch.props.d.ts +3 -0
- package/lib/types/__generated__/tabs.props.d.ts +5 -0
- package/lib/types/__generated__/tooltip.props.d.ts +4 -0
- package/lib/types/accordion.d.ts +11 -0
- package/lib/types/accordion.template.d.ts +10 -0
- package/lib/types/accordion.ws.d.ts +11 -0
- package/lib/types/checkbox.d.ts +9 -0
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +5 -0
- package/lib/types/collapsible.d.ts +15 -0
- package/lib/types/collapsible.template.d.ts +2 -0
- package/lib/types/collapsible.ws.d.ts +7 -0
- package/lib/types/components.d.ts +12 -0
- package/lib/types/dialog.d.ts +23 -0
- package/lib/types/dialog.template.d.ts +10 -0
- package/lib/types/dialog.ws.d.ts +15 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.template.d.ts +10 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +12 -0
- package/lib/types/navigation-menu.d.ts +10 -0
- package/lib/types/navigation-menu.template.d.ts +2 -0
- package/lib/types/navigation-menu.ws.d.ts +15 -0
- package/lib/types/popover.d.ts +15 -0
- package/lib/types/popover.template.d.ts +10 -0
- package/lib/types/popover.ws.d.ts +7 -0
- package/lib/types/props-descriptions.d.ts +29 -0
- package/lib/types/props.d.ts +12 -0
- package/lib/types/radio-group.d.ts +5 -0
- package/lib/types/radio-group.template.d.ts +2 -0
- package/lib/types/radio-group.ws.d.ts +7 -0
- package/lib/types/select.d.ts +14 -0
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +17 -0
- package/lib/types/shared/preset-styles.d.ts +2 -0
- package/lib/types/shared/proxy.d.ts +15 -0
- package/lib/types/shared/styles.d.ts +2 -0
- package/lib/types/shared/theme.d.ts +212 -0
- package/lib/types/sheet.template.d.ts +10 -0
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.template.d.ts +2 -0
- package/lib/types/switch.ws.d.ts +5 -0
- package/lib/types/tabs.d.ts +13 -0
- package/lib/types/tabs.template.d.ts +2 -0
- package/lib/types/tabs.ws.d.ts +9 -0
- package/lib/types/templates.d.ts +13 -0
- package/lib/types/tooltip.d.ts +15 -0
- package/lib/types/tooltip.template.d.ts +10 -0
- package/lib/types/tooltip.ws.d.ts +7 -0
- package/package.json +85 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { AccordionIcon as t, ItemIcon as e, HeaderIcon as n, TriggerIcon as r, ContentIcon as c } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as i } from "@webstudio-is/sdk";
|
|
3
|
+
import { h3 as a, button as p, div as s } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { buttonReset as d } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsAccordion as m, propsAccordionItem as l, propsAccordionHeader as A, propsAccordionTrigger as I, propsAccordionContent as g } from "./__generated__/accordion.props.js";
|
|
6
|
+
const o = {
|
|
7
|
+
div: s
|
|
8
|
+
}, f = {
|
|
9
|
+
type: "container",
|
|
10
|
+
icon: t,
|
|
11
|
+
presetStyle: o,
|
|
12
|
+
constraints: [
|
|
13
|
+
{
|
|
14
|
+
relation: "descendant",
|
|
15
|
+
component: { $eq: "AccordionItem" }
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}, v = {
|
|
19
|
+
type: "container",
|
|
20
|
+
label: "Item",
|
|
21
|
+
icon: e,
|
|
22
|
+
constraints: [
|
|
23
|
+
{
|
|
24
|
+
relation: "ancestor",
|
|
25
|
+
component: { $eq: "Accordion" }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
relation: "descendant",
|
|
29
|
+
component: { $eq: "AccordionHeader" }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
relation: "descendant",
|
|
33
|
+
component: { $eq: "AccordionContent" }
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
indexWithinAncestor: "Accordion",
|
|
37
|
+
presetStyle: o
|
|
38
|
+
}, H = {
|
|
39
|
+
type: "container",
|
|
40
|
+
label: "Item Header",
|
|
41
|
+
icon: n,
|
|
42
|
+
constraints: [
|
|
43
|
+
{
|
|
44
|
+
relation: "ancestor",
|
|
45
|
+
component: { $eq: "AccordionItem" }
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
relation: "descendant",
|
|
49
|
+
component: { $eq: "AccordionTrigger" }
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
presetStyle: {
|
|
53
|
+
h3: [
|
|
54
|
+
...a,
|
|
55
|
+
{
|
|
56
|
+
property: "marginTop",
|
|
57
|
+
value: { type: "unit", unit: "px", value: 0 }
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
property: "marginBottom",
|
|
61
|
+
value: { type: "unit", unit: "px", value: 0 }
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}, T = {
|
|
66
|
+
type: "container",
|
|
67
|
+
label: "Item Trigger",
|
|
68
|
+
icon: r,
|
|
69
|
+
constraints: {
|
|
70
|
+
relation: "ancestor",
|
|
71
|
+
component: { $eq: "AccordionHeader" }
|
|
72
|
+
},
|
|
73
|
+
states: [
|
|
74
|
+
...i,
|
|
75
|
+
{
|
|
76
|
+
category: "component-states",
|
|
77
|
+
label: "Open",
|
|
78
|
+
selector: "[data-state=open]"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
presetStyle: {
|
|
82
|
+
button: [p, d].flat()
|
|
83
|
+
}
|
|
84
|
+
}, C = {
|
|
85
|
+
type: "container",
|
|
86
|
+
label: "Item Content",
|
|
87
|
+
icon: c,
|
|
88
|
+
constraints: {
|
|
89
|
+
relation: "ancestor",
|
|
90
|
+
component: { $eq: "AccordionItem" }
|
|
91
|
+
},
|
|
92
|
+
presetStyle: o
|
|
93
|
+
}, M = {
|
|
94
|
+
props: m,
|
|
95
|
+
initialProps: ["value", "collapsible"]
|
|
96
|
+
}, x = {
|
|
97
|
+
props: l,
|
|
98
|
+
initialProps: ["value"]
|
|
99
|
+
}, S = {
|
|
100
|
+
props: A
|
|
101
|
+
}, h = {
|
|
102
|
+
props: I
|
|
103
|
+
}, P = {
|
|
104
|
+
props: g
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
f as metaAccordion,
|
|
108
|
+
C as metaAccordionContent,
|
|
109
|
+
H as metaAccordionHeader,
|
|
110
|
+
v as metaAccordionItem,
|
|
111
|
+
T as metaAccordionTrigger,
|
|
112
|
+
M as propsMetaAccordion,
|
|
113
|
+
P as propsMetaAccordionContent,
|
|
114
|
+
S as propsMetaAccordionHeader,
|
|
115
|
+
x as propsMetaAccordionItem,
|
|
116
|
+
h as propsMetaAccordionTrigger
|
|
117
|
+
};
|
package/lib/checkbox.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { Root as m, Indicator as d } from "@radix-ui/react-checkbox";
|
|
4
|
+
const p = f(({ checked: o, defaultChecked: r, ...t }, e) => /* @__PURE__ */ c(m, { ...t, ref: e, defaultChecked: o ?? r })), x = d;
|
|
5
|
+
export {
|
|
6
|
+
p as Checkbox,
|
|
7
|
+
x as CheckboxIndicator
|
|
8
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { CheckMarkIcon as a } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { css as o, $ as t, PlaceholderValue as l } from "@webstudio-is/template";
|
|
4
|
+
import { radix as r } from "./shared/proxy.js";
|
|
5
|
+
import { spacing as s, height as d, width as n, borderRadius as h, borderWidth as b, colors as i, boxShadow as m, opacity as p } from "./shared/theme.js";
|
|
6
|
+
const y = {
|
|
7
|
+
category: "radix",
|
|
8
|
+
description: "Use within a form to allow your users to toggle between checked and not checked. Group checkboxes by matching their “Name” properties. Unlike radios, any number of checkboxes in a group can be checked.",
|
|
9
|
+
order: 101,
|
|
10
|
+
template: /* @__PURE__ */ c(
|
|
11
|
+
r.Label,
|
|
12
|
+
{
|
|
13
|
+
"ws:label": "Checkbox Field",
|
|
14
|
+
"ws:style": o`
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: ${s[2]};
|
|
17
|
+
align-items: center;
|
|
18
|
+
`,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ e(
|
|
21
|
+
r.Checkbox,
|
|
22
|
+
{
|
|
23
|
+
"ws:style": o`
|
|
24
|
+
height: ${d[4]};
|
|
25
|
+
width: ${n[4]};
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
border-radius: ${h.sm};
|
|
28
|
+
border: ${b.DEFAULT} solid ${i.primary};
|
|
29
|
+
&:focus-visible {
|
|
30
|
+
outline: none;
|
|
31
|
+
box-shadow: ${m.ring};
|
|
32
|
+
}
|
|
33
|
+
&:disabled {
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
opacity: ${p[50]};
|
|
36
|
+
}
|
|
37
|
+
&[data-state="checked"] {
|
|
38
|
+
background-color: ${i.primary};
|
|
39
|
+
color: ${i.primaryForeground};
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
children: /* @__PURE__ */ e(
|
|
43
|
+
r.CheckboxIndicator,
|
|
44
|
+
{
|
|
45
|
+
"ws:style": o`
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
color: currentColor;
|
|
50
|
+
`,
|
|
51
|
+
children: /* @__PURE__ */ e(t.HtmlEmbed, { "ws:label": "Indicator Icon", code: a })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ e(t.Text, { "ws:label": "Checkbox Label", tag: "span", children: new l("Checkbox") })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
y as meta
|
|
63
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CheckboxCheckedIcon as t, TriggerIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as e } from "@webstudio-is/sdk";
|
|
3
|
+
import { button as c, span as n } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { buttonReset as a } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsCheckbox as r, propsCheckboxIndicator as s } from "./__generated__/checkbox.props.js";
|
|
6
|
+
const k = {
|
|
7
|
+
type: "container",
|
|
8
|
+
constraints: {
|
|
9
|
+
relation: "descendant",
|
|
10
|
+
component: { $eq: "CheckboxIndicator" }
|
|
11
|
+
},
|
|
12
|
+
icon: t,
|
|
13
|
+
states: [
|
|
14
|
+
...e,
|
|
15
|
+
{
|
|
16
|
+
label: "Checked",
|
|
17
|
+
selector: "[data-state=checked]",
|
|
18
|
+
category: "component-states"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Unchecked",
|
|
22
|
+
selector: "[data-state=unchecked]",
|
|
23
|
+
category: "component-states"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
presetStyle: {
|
|
27
|
+
button: [c, a].flat()
|
|
28
|
+
}
|
|
29
|
+
}, l = {
|
|
30
|
+
type: "container",
|
|
31
|
+
constraints: {
|
|
32
|
+
relation: "ancestor",
|
|
33
|
+
component: { $eq: "Checkbox" }
|
|
34
|
+
},
|
|
35
|
+
icon: o,
|
|
36
|
+
states: e,
|
|
37
|
+
presetStyle: {
|
|
38
|
+
span: n
|
|
39
|
+
}
|
|
40
|
+
}, b = {
|
|
41
|
+
props: r,
|
|
42
|
+
initialProps: ["id", "className", "name", "value", "required", "checked"]
|
|
43
|
+
}, C = {
|
|
44
|
+
props: s
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
k as metaCheckbox,
|
|
48
|
+
l as metaCheckboxIndicator,
|
|
49
|
+
b as propsMetaCheckbox,
|
|
50
|
+
C as propsMetaCheckboxIndicator
|
|
51
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as r, Children as a } from "react";
|
|
3
|
+
import { Root as c, Trigger as p, Content as C } from "@radix-ui/react-collapsible";
|
|
4
|
+
import { getClosestInstance as l } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const h = c, g = r(({ children: e, ...o }, t) => {
|
|
6
|
+
const n = a.toArray(e)[0];
|
|
7
|
+
return /* @__PURE__ */ i(p, { asChild: !0, ref: t, ...o, children: n ?? /* @__PURE__ */ i("button", { children: "Add button" }) });
|
|
8
|
+
}), u = C, s = "@webstudio-is/sdk-components-react-radix", P = {
|
|
9
|
+
onNavigatorSelect: (e, o) => {
|
|
10
|
+
for (const t of o.instancePath)
|
|
11
|
+
if (t.component === `${s}:CollapsibleContent`) {
|
|
12
|
+
const n = l(
|
|
13
|
+
o.instancePath,
|
|
14
|
+
t,
|
|
15
|
+
`${s}:Collapsible`
|
|
16
|
+
);
|
|
17
|
+
n && e.setMemoryProp(n, "open", !0);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
onNavigatorUnselect: (e, o) => {
|
|
21
|
+
for (const t of o.instancePath)
|
|
22
|
+
if (t.component === `${s}:CollapsibleContent`) {
|
|
23
|
+
const n = l(
|
|
24
|
+
o.instancePath,
|
|
25
|
+
t,
|
|
26
|
+
`${s}:Collapsible`
|
|
27
|
+
);
|
|
28
|
+
n && e.setMemoryProp(n, "open", void 0);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
h as Collapsible,
|
|
34
|
+
u as CollapsibleContent,
|
|
35
|
+
g as CollapsibleTrigger,
|
|
36
|
+
P as hooksCollapsible
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { $ as o, PlaceholderValue as l } from "@webstudio-is/template";
|
|
3
|
+
import { radix as t } from "./shared/proxy.js";
|
|
4
|
+
import { getButtonStyle as r } from "./shared/styles.js";
|
|
5
|
+
const p = {
|
|
6
|
+
category: "radix",
|
|
7
|
+
description: "An interactive component which expands and collapses some content, triggered by a button.",
|
|
8
|
+
order: 5,
|
|
9
|
+
template: /* @__PURE__ */ n(t.Collapsible, { children: [
|
|
10
|
+
/* @__PURE__ */ e(t.CollapsibleTrigger, { children: /* @__PURE__ */ e(o.Button, { "ws:style": r("outline"), children: new l("Click to toggle content") }) }),
|
|
11
|
+
/* @__PURE__ */ e(t.CollapsibleContent, { children: /* @__PURE__ */ e(o.Text, { children: new l("Collapsible Content") }) })
|
|
12
|
+
] })
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as meta
|
|
16
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CollapsibleIcon as e, TriggerIcon as n, ContentIcon as t } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as o } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { propsCollapsible as l, propsCollapsibleTrigger as p, propsCollapsibleContent as r } from "./__generated__/collapsible.props.js";
|
|
4
|
+
const c = {
|
|
5
|
+
type: "container",
|
|
6
|
+
constraints: [
|
|
7
|
+
{
|
|
8
|
+
relation: "descendant",
|
|
9
|
+
component: { $eq: "CollapsibleTrigger" }
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
relation: "descendant",
|
|
13
|
+
component: { $eq: "CollapsibleContent" }
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
presetStyle: {
|
|
17
|
+
div: o
|
|
18
|
+
},
|
|
19
|
+
icon: e
|
|
20
|
+
}, C = {
|
|
21
|
+
type: "container",
|
|
22
|
+
icon: n,
|
|
23
|
+
constraints: {
|
|
24
|
+
relation: "ancestor",
|
|
25
|
+
component: { $eq: "Collapsible" }
|
|
26
|
+
}
|
|
27
|
+
}, b = {
|
|
28
|
+
type: "container",
|
|
29
|
+
presetStyle: {
|
|
30
|
+
div: o
|
|
31
|
+
},
|
|
32
|
+
icon: t,
|
|
33
|
+
constraints: {
|
|
34
|
+
relation: "ancestor",
|
|
35
|
+
component: { $eq: "Collapsible" }
|
|
36
|
+
}
|
|
37
|
+
}, m = {
|
|
38
|
+
props: {
|
|
39
|
+
...l,
|
|
40
|
+
onOpenChange: {
|
|
41
|
+
type: "action",
|
|
42
|
+
control: "action",
|
|
43
|
+
required: !1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
initialProps: ["open", "onOpenChange"]
|
|
47
|
+
}, g = {
|
|
48
|
+
props: p
|
|
49
|
+
}, d = {
|
|
50
|
+
props: r
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
c as metaCollapsible,
|
|
54
|
+
b as metaCollapsibleContent,
|
|
55
|
+
C as metaCollapsibleTrigger,
|
|
56
|
+
m as propsMetaCollapsible,
|
|
57
|
+
d as propsMetaCollapsibleContent,
|
|
58
|
+
g as propsMetaCollapsibleTrigger
|
|
59
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Collapsible as t, CollapsibleContent as r, CollapsibleTrigger as i } from "./collapsible.js";
|
|
2
|
+
import { Dialog as a, DialogClose as l, DialogContent as g, DialogDescription as p, DialogOverlay as c, DialogTitle as m, DialogTrigger as T } from "./dialog.js";
|
|
3
|
+
import { Popover as C, PopoverContent as d, PopoverTrigger as f } from "./popover.js";
|
|
4
|
+
import { Tooltip as b, TooltipContent as s, TooltipTrigger as v } from "./tooltip.js";
|
|
5
|
+
import { Tabs as I, TabsContent as D, TabsList as M, TabsTrigger as N } from "./tabs.js";
|
|
6
|
+
import { Label as A } from "./label.js";
|
|
7
|
+
import { Accordion as L, AccordionContent as k, AccordionHeader as G, AccordionItem as P, AccordionTrigger as R } from "./accordion.js";
|
|
8
|
+
import { NavigationMenu as y, NavigationMenuContent as H, NavigationMenuItem as O, NavigationMenuLink as j, NavigationMenuList as q, NavigationMenuTrigger as z, NavigationMenuViewport as B } from "./navigation-menu.js";
|
|
9
|
+
import { Select as F, SelectContent as J, SelectItem as K, SelectItemIndicator as Q, SelectItemText as U, SelectTrigger as W, SelectValue as X, SelectViewport as Y } from "./select.js";
|
|
10
|
+
import { Switch as _, SwitchThumb as $ } from "./switch.js";
|
|
11
|
+
import { Checkbox as eo, CheckboxIndicator as to } from "./checkbox.js";
|
|
12
|
+
import { RadioGroup as io, RadioGroupIndicator as no, RadioGroupItem as ao } from "./radio-group.js";
|
|
13
|
+
export {
|
|
14
|
+
L as Accordion,
|
|
15
|
+
k as AccordionContent,
|
|
16
|
+
G as AccordionHeader,
|
|
17
|
+
P as AccordionItem,
|
|
18
|
+
R as AccordionTrigger,
|
|
19
|
+
eo as Checkbox,
|
|
20
|
+
to as CheckboxIndicator,
|
|
21
|
+
t as Collapsible,
|
|
22
|
+
r as CollapsibleContent,
|
|
23
|
+
i as CollapsibleTrigger,
|
|
24
|
+
a as Dialog,
|
|
25
|
+
l as DialogClose,
|
|
26
|
+
g as DialogContent,
|
|
27
|
+
p as DialogDescription,
|
|
28
|
+
c as DialogOverlay,
|
|
29
|
+
m as DialogTitle,
|
|
30
|
+
T as DialogTrigger,
|
|
31
|
+
A as Label,
|
|
32
|
+
y as NavigationMenu,
|
|
33
|
+
H as NavigationMenuContent,
|
|
34
|
+
O as NavigationMenuItem,
|
|
35
|
+
j as NavigationMenuLink,
|
|
36
|
+
q as NavigationMenuList,
|
|
37
|
+
z as NavigationMenuTrigger,
|
|
38
|
+
B as NavigationMenuViewport,
|
|
39
|
+
C as Popover,
|
|
40
|
+
d as PopoverContent,
|
|
41
|
+
f as PopoverTrigger,
|
|
42
|
+
io as RadioGroup,
|
|
43
|
+
no as RadioGroupIndicator,
|
|
44
|
+
ao as RadioGroupItem,
|
|
45
|
+
F as Select,
|
|
46
|
+
J as SelectContent,
|
|
47
|
+
K as SelectItem,
|
|
48
|
+
Q as SelectItemIndicator,
|
|
49
|
+
U as SelectItemText,
|
|
50
|
+
W as SelectTrigger,
|
|
51
|
+
X as SelectValue,
|
|
52
|
+
Y as SelectViewport,
|
|
53
|
+
_ as Switch,
|
|
54
|
+
$ as SwitchThumb,
|
|
55
|
+
I as Tabs,
|
|
56
|
+
D as TabsContent,
|
|
57
|
+
M as TabsList,
|
|
58
|
+
N as TabsTrigger,
|
|
59
|
+
b as Tooltip,
|
|
60
|
+
s as TooltipContent,
|
|
61
|
+
v as TooltipTrigger
|
|
62
|
+
};
|
package/lib/dialog.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useContext as h, useCallback as D, useEffect as m, Children as v, useRef as k } from "react";
|
|
3
|
+
import * as a from "@radix-ui/react-dialog";
|
|
4
|
+
import { ReactSdkContext as p, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
import { useControllableState as w } from "@radix-ui/react-use-controllable-state";
|
|
6
|
+
import y from "await-interaction-response";
|
|
7
|
+
const C = (t) => {
|
|
8
|
+
const { target: e } = t;
|
|
9
|
+
return !(!(e instanceof HTMLAnchorElement) || e.hasAttribute("href") === !1 || e.href === "#" || e.hasAttribute("target") && e.target === "_blank" || t.ctrlKey || t.metaKey);
|
|
10
|
+
}, O = c((t, e) => {
|
|
11
|
+
const { renderer: o } = h(p), [n, s] = w({
|
|
12
|
+
prop: t.open,
|
|
13
|
+
defaultProp: !1,
|
|
14
|
+
onChange: t.onOpenChange
|
|
15
|
+
}), r = D(
|
|
16
|
+
async (l) => {
|
|
17
|
+
await y(), s(l);
|
|
18
|
+
},
|
|
19
|
+
[s]
|
|
20
|
+
);
|
|
21
|
+
return m(() => {
|
|
22
|
+
if (o !== void 0 || n === !1)
|
|
23
|
+
return;
|
|
24
|
+
const l = (u) => {
|
|
25
|
+
const { target: g } = u;
|
|
26
|
+
if (C(u) !== !1) {
|
|
27
|
+
if (!(g instanceof HTMLAnchorElement))
|
|
28
|
+
return !1;
|
|
29
|
+
g.closest('[role="dialog"]') && (r == null || r(!1));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return window.addEventListener("click", l), () => window.removeEventListener("click", l);
|
|
33
|
+
}, [n, r, o]), /* @__PURE__ */ i(
|
|
34
|
+
a.Root,
|
|
35
|
+
{
|
|
36
|
+
...t,
|
|
37
|
+
onOpenChange: r,
|
|
38
|
+
open: n
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}), x = c(({ children: t, ...e }, o) => {
|
|
42
|
+
const n = v.toArray(t)[0];
|
|
43
|
+
return /* @__PURE__ */ i(a.Trigger, { ref: o, asChild: !0, ...e, children: n ?? /* @__PURE__ */ i("button", { children: "Add button or link" }) });
|
|
44
|
+
}), M = c((t, e) => /* @__PURE__ */ i(a.DialogPortal, { children: /* @__PURE__ */ i(a.Overlay, { ref: e, ...t }) })), R = c((t, e) => {
|
|
45
|
+
const o = k(!1), { renderer: n } = h(p);
|
|
46
|
+
return m(() => {
|
|
47
|
+
if (n !== void 0)
|
|
48
|
+
return;
|
|
49
|
+
o.current = !1;
|
|
50
|
+
const s = (r) => {
|
|
51
|
+
const { target: l } = r;
|
|
52
|
+
if (C(r) !== !1) {
|
|
53
|
+
if (!(l instanceof HTMLAnchorElement))
|
|
54
|
+
return !1;
|
|
55
|
+
l.closest('[role="dialog"]') && (o.current = !0);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return window.addEventListener("click", s), () => window.removeEventListener("click", s);
|
|
59
|
+
}, [n]), /* @__PURE__ */ i(
|
|
60
|
+
a.Content,
|
|
61
|
+
{
|
|
62
|
+
ref: e,
|
|
63
|
+
...t,
|
|
64
|
+
onCloseAutoFocus: (s) => {
|
|
65
|
+
o.current && s.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}), $ = a.Close, A = "h1", N = c(({ tag: t = A, children: e, ...o }, n) => /* @__PURE__ */ i(a.DialogTitle, { asChild: !0, children: /* @__PURE__ */ i(t, { ref: n, ...o, children: e }) })), S = a.Description, f = "@webstudio-is/sdk-components-react-radix", F = {
|
|
70
|
+
onNavigatorUnselect: (t, e) => {
|
|
71
|
+
for (const o of e.instancePath)
|
|
72
|
+
if (o.component === `${f}:DialogOverlay`) {
|
|
73
|
+
const n = d(
|
|
74
|
+
e.instancePath,
|
|
75
|
+
o,
|
|
76
|
+
`${f}:Dialog`
|
|
77
|
+
);
|
|
78
|
+
n && t.setMemoryProp(n, "open", void 0);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onNavigatorSelect: (t, e) => {
|
|
82
|
+
for (const o of e.instancePath)
|
|
83
|
+
if (o.component === `${f}:DialogOverlay`) {
|
|
84
|
+
const n = d(
|
|
85
|
+
e.instancePath,
|
|
86
|
+
o,
|
|
87
|
+
`${f}:Dialog`
|
|
88
|
+
);
|
|
89
|
+
n && t.setMemoryProp(n, "open", !0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
O as Dialog,
|
|
95
|
+
$ as DialogClose,
|
|
96
|
+
R as DialogContent,
|
|
97
|
+
S as DialogDescription,
|
|
98
|
+
M as DialogOverlay,
|
|
99
|
+
N as DialogTitle,
|
|
100
|
+
x as DialogTrigger,
|
|
101
|
+
F as hooksDialog
|
|
102
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { LargeXIcon as p } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as l, PlaceholderValue as r, css as i } from "@webstudio-is/template";
|
|
4
|
+
import { radix as o } from "./shared/proxy.js";
|
|
5
|
+
import { zIndex as d, blur as m, width as u, spacing as t, maxWidth as w, borderWidth as $, colors as a, boxShadow as s, fontSize as c, lineHeight as y, letterSpacing as b, fontSizeLineHeight as x, borderRadius as f, opacity as g, height as h } from "./shared/theme.js";
|
|
6
|
+
import { getButtonStyle as D } from "./shared/styles.js";
|
|
7
|
+
const S = {
|
|
8
|
+
category: "radix",
|
|
9
|
+
description: "Displays content with an overlay that covers the window, triggered by a button. Clicking the overlay will close the dialog.",
|
|
10
|
+
order: 4,
|
|
11
|
+
template: /* @__PURE__ */ n(o.Dialog, { children: [
|
|
12
|
+
/* @__PURE__ */ e(o.DialogTrigger, { children: /* @__PURE__ */ e(l.Button, { "ws:style": D("outline"), children: new r("Button") }) }),
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
o.DialogOverlay,
|
|
15
|
+
{
|
|
16
|
+
"ws:style": i`
|
|
17
|
+
position: fixed;
|
|
18
|
+
inset: 0;
|
|
19
|
+
z-index: ${d[50]};
|
|
20
|
+
background-color: rgb(255 255 255 / 0.8);
|
|
21
|
+
backdrop-filter: ${m.sm};
|
|
22
|
+
/* To allow positioning Content */
|
|
23
|
+
display: flex;
|
|
24
|
+
overflow: auto;
|
|
25
|
+
`,
|
|
26
|
+
children: /* @__PURE__ */ n(
|
|
27
|
+
o.DialogContent,
|
|
28
|
+
{
|
|
29
|
+
"ws:style": i`
|
|
30
|
+
width: ${u.full};
|
|
31
|
+
z-index: ${d[50]};
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: ${t[4]};
|
|
35
|
+
margin: auto;
|
|
36
|
+
max-width: ${w.lg};
|
|
37
|
+
border: ${$.DEFAULT} solid ${a.border};
|
|
38
|
+
background-color: ${a.background};
|
|
39
|
+
padding: ${t[6]};
|
|
40
|
+
box-shadow: ${s.lg};
|
|
41
|
+
position: relative;
|
|
42
|
+
`,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ n(
|
|
45
|
+
l.Box,
|
|
46
|
+
{
|
|
47
|
+
"ws:label": "Dialog Header",
|
|
48
|
+
"ws:style": i`
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: ${t[2]};
|
|
52
|
+
`,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
o.DialogTitle,
|
|
56
|
+
{
|
|
57
|
+
"ws:style": i`
|
|
58
|
+
font-size: ${c.lg};
|
|
59
|
+
line-height: ${y.none};
|
|
60
|
+
letter-spacing: ${b.tight};
|
|
61
|
+
margin: 0;
|
|
62
|
+
`,
|
|
63
|
+
children: new r("Dialog Title you can edit")
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ e(
|
|
67
|
+
o.DialogDescription,
|
|
68
|
+
{
|
|
69
|
+
"ws:style": i`
|
|
70
|
+
font-size: ${c.sm};
|
|
71
|
+
line-height: ${x.sm};
|
|
72
|
+
color: ${a.mutedForeground};
|
|
73
|
+
margin: 0;
|
|
74
|
+
`,
|
|
75
|
+
children: new r("Dialog description text you can edit")
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ e(l.Text, { children: new r("The text you can edit") }),
|
|
82
|
+
/* @__PURE__ */ e(
|
|
83
|
+
o.DialogClose,
|
|
84
|
+
{
|
|
85
|
+
"ws:label": "Close Button",
|
|
86
|
+
"ws:style": i`
|
|
87
|
+
position: absolute;
|
|
88
|
+
right: ${t[4]};
|
|
89
|
+
top: ${t[4]};
|
|
90
|
+
border-radius: ${f.sm};
|
|
91
|
+
opacity: ${g[70]};
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
height: ${h[4]};
|
|
96
|
+
width: ${h[4]};
|
|
97
|
+
border: 0;
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
outline: none;
|
|
100
|
+
&:hover {
|
|
101
|
+
opacity: ${g[100]};
|
|
102
|
+
}
|
|
103
|
+
&:focus-visible {
|
|
104
|
+
box-shadow: ${s.ring};
|
|
105
|
+
}
|
|
106
|
+
`,
|
|
107
|
+
children: /* @__PURE__ */ e(l.HtmlEmbed, { "ws:label": "Close Icon", code: p })
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] })
|
|
116
|
+
};
|
|
117
|
+
export {
|
|
118
|
+
S as meta
|
|
119
|
+
};
|