@webstudio-is/sdk-components-react-radix 0.191.4 → 0.192.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 +250 -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 +62 -0
- package/lib/dialog.js +84 -0
- package/lib/dialog.ws.js +260 -0
- package/lib/hooks.js +23 -0
- package/lib/label.js +7 -0
- package/lib/label.ws.js +43 -0
- package/lib/metas.js +64 -0
- package/lib/navigation-menu.js +59 -0
- package/lib/navigation-menu.ws.js +475 -0
- package/lib/popover.js +48 -0
- package/lib/popover.ws.js +96 -0
- package/lib/props.js +62 -0
- package/lib/radio-group.js +9 -0
- package/lib/radio-group.ws.js +158 -0
- package/lib/select.js +46 -0
- package/lib/select.ws.js +305 -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 +183 -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/__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__/sheet.props.d.ts +8 -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.ws.d.ts +11 -0
- package/lib/types/checkbox.d.ts +9 -0
- package/lib/types/checkbox.ws.d.ts +5 -0
- package/lib/types/collapsible.d.ts +15 -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.ws.d.ts +23 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +13 -0
- package/lib/types/navigation-menu.d.ts +10 -0
- package/lib/types/navigation-menu.ws.d.ts +15 -0
- package/lib/types/popover.d.ts +15 -0
- package/lib/types/popover.ws.d.ts +15 -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.ws.d.ts +7 -0
- package/lib/types/select.d.ts +14 -0
- package/lib/types/select.ws.d.ts +17 -0
- package/lib/types/sheet.d.ts +16 -0
- package/lib/types/sheet.ws.d.ts +10 -0
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.ws.d.ts +5 -0
- package/lib/types/tabs.d.ts +12 -0
- package/lib/types/tabs.ws.d.ts +9 -0
- package/lib/types/theme/__generated__/tailwind-theme.d.ts +26 -0
- package/lib/types/theme/styles.d.ts +278 -0
- package/lib/types/theme/tailwind-classes.d.ts +104 -0
- package/lib/types/theme/tailwind-colors.d.ts +31 -0
- package/lib/types/tooltip.d.ts +15 -0
- package/lib/types/tooltip.ws.d.ts +15 -0
- package/package.json +7 -7
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { AccordionIcon as i, ItemIcon as s, HeaderIcon as l, TriggerIcon as p, ContentIcon as d, ChevronDownIcon as m } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as y } from "@webstudio-is/react-sdk";
|
|
3
|
+
import { h3 as h, button as A, div as g } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { borderB as u, overflow as f, text as I, pb as b, my as v, flex as e, items as x, justify as C, py as H, font as T, hover as w, underline as S, property as t, state as M, h as q, w as $, shrink as k, transition as Y, duration as B } from "./theme/tailwind-classes.js";
|
|
5
|
+
import { buttonReset as P } from "./theme/styles.js";
|
|
6
|
+
import { propsAccordion as R, propsAccordionItem as W, propsAccordionHeader as j, propsAccordionTrigger as D, propsAccordionContent as E } from "./__generated__/accordion.props.js";
|
|
7
|
+
const r = {
|
|
8
|
+
div: g
|
|
9
|
+
}, o = [u()].flat(), n = ({
|
|
10
|
+
children: a
|
|
11
|
+
}) => ({
|
|
12
|
+
type: "instance",
|
|
13
|
+
component: "AccordionHeader",
|
|
14
|
+
// flex
|
|
15
|
+
styles: [e()].flat(),
|
|
16
|
+
children: [
|
|
17
|
+
{
|
|
18
|
+
type: "instance",
|
|
19
|
+
component: "AccordionTrigger",
|
|
20
|
+
// flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180
|
|
21
|
+
styles: [
|
|
22
|
+
e(),
|
|
23
|
+
e(1),
|
|
24
|
+
x("center"),
|
|
25
|
+
C("between"),
|
|
26
|
+
H(4),
|
|
27
|
+
T("medium"),
|
|
28
|
+
w([S()].flat()),
|
|
29
|
+
t("--accordion-trigger-icon-transform", "0deg"),
|
|
30
|
+
M(
|
|
31
|
+
[t("--accordion-trigger-icon-transform", "180deg")],
|
|
32
|
+
"[data-state=open]"
|
|
33
|
+
)
|
|
34
|
+
].flat(),
|
|
35
|
+
children: [
|
|
36
|
+
{
|
|
37
|
+
type: "instance",
|
|
38
|
+
component: "Text",
|
|
39
|
+
children: a
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "instance",
|
|
43
|
+
component: "Box",
|
|
44
|
+
label: "Icon Container",
|
|
45
|
+
// h-4 w-4 shrink-0 transition-transform duration-200
|
|
46
|
+
styles: [
|
|
47
|
+
t("rotate", "--accordion-trigger-icon-transform"),
|
|
48
|
+
q(4),
|
|
49
|
+
$(4),
|
|
50
|
+
k(0),
|
|
51
|
+
Y("all"),
|
|
52
|
+
B(200)
|
|
53
|
+
].flat(),
|
|
54
|
+
children: [
|
|
55
|
+
{
|
|
56
|
+
type: "instance",
|
|
57
|
+
component: "HtmlEmbed",
|
|
58
|
+
label: "Chevron Icon",
|
|
59
|
+
props: [
|
|
60
|
+
{
|
|
61
|
+
type: "string",
|
|
62
|
+
name: "code",
|
|
63
|
+
value: m
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
children: []
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}), c = [
|
|
74
|
+
f("hidden"),
|
|
75
|
+
I("sm"),
|
|
76
|
+
// transition does not work with display: none
|
|
77
|
+
// tc.transition("all"),
|
|
78
|
+
b(4)
|
|
79
|
+
].flat(), K = {
|
|
80
|
+
category: "radix",
|
|
81
|
+
order: 3,
|
|
82
|
+
type: "container",
|
|
83
|
+
icon: i,
|
|
84
|
+
presetStyle: r,
|
|
85
|
+
description: "A vertically stacked set of interactive headings that each reveal an associated section of content. Clicking on the heading will open the item and close other items.",
|
|
86
|
+
template: [
|
|
87
|
+
{
|
|
88
|
+
type: "instance",
|
|
89
|
+
component: "Accordion",
|
|
90
|
+
props: [
|
|
91
|
+
{ type: "boolean", name: "collapsible", value: !0 },
|
|
92
|
+
{ type: "string", name: "defaultValue", value: "0" }
|
|
93
|
+
],
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
type: "instance",
|
|
97
|
+
component: "AccordionItem",
|
|
98
|
+
styles: o,
|
|
99
|
+
children: [
|
|
100
|
+
n({
|
|
101
|
+
children: [
|
|
102
|
+
{ type: "text", value: "Is it accessible?", placeholder: !0 }
|
|
103
|
+
]
|
|
104
|
+
}),
|
|
105
|
+
{
|
|
106
|
+
type: "instance",
|
|
107
|
+
component: "AccordionContent",
|
|
108
|
+
styles: c,
|
|
109
|
+
children: [
|
|
110
|
+
{
|
|
111
|
+
type: "text",
|
|
112
|
+
value: "Yes. It adheres to the WAI-ARIA design pattern.",
|
|
113
|
+
placeholder: !0
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
type: "instance",
|
|
121
|
+
component: "AccordionItem",
|
|
122
|
+
styles: o,
|
|
123
|
+
children: [
|
|
124
|
+
n({
|
|
125
|
+
children: [
|
|
126
|
+
{ type: "text", value: "Is it styled?", placeholder: !0 }
|
|
127
|
+
]
|
|
128
|
+
}),
|
|
129
|
+
{
|
|
130
|
+
type: "instance",
|
|
131
|
+
component: "AccordionContent",
|
|
132
|
+
styles: c,
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
type: "text",
|
|
136
|
+
value: "Yes. It comes with default styles that matches the other components' aesthetic.",
|
|
137
|
+
placeholder: !0
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "instance",
|
|
145
|
+
component: "AccordionItem",
|
|
146
|
+
styles: o,
|
|
147
|
+
children: [
|
|
148
|
+
n({
|
|
149
|
+
children: [
|
|
150
|
+
{ type: "text", value: "Is it animated?", placeholder: !0 }
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
{
|
|
154
|
+
type: "instance",
|
|
155
|
+
component: "AccordionContent",
|
|
156
|
+
styles: c,
|
|
157
|
+
children: [
|
|
158
|
+
{
|
|
159
|
+
type: "text",
|
|
160
|
+
value: "Yes. It's animated by default, but you can disable it if you prefer.",
|
|
161
|
+
placeholder: !0
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}, L = {
|
|
171
|
+
category: "hidden",
|
|
172
|
+
type: "container",
|
|
173
|
+
label: "Item",
|
|
174
|
+
icon: s,
|
|
175
|
+
constraints: {
|
|
176
|
+
relation: "ancestor",
|
|
177
|
+
component: { $eq: "Accordion" }
|
|
178
|
+
},
|
|
179
|
+
indexWithinAncestor: "Accordion",
|
|
180
|
+
presetStyle: r
|
|
181
|
+
}, N = {
|
|
182
|
+
category: "hidden",
|
|
183
|
+
type: "container",
|
|
184
|
+
label: "Item Header",
|
|
185
|
+
icon: l,
|
|
186
|
+
constraints: {
|
|
187
|
+
relation: "ancestor",
|
|
188
|
+
component: { $eq: "AccordionItem" }
|
|
189
|
+
},
|
|
190
|
+
detachable: !1,
|
|
191
|
+
presetStyle: {
|
|
192
|
+
h3: [h, v(0)].flat()
|
|
193
|
+
}
|
|
194
|
+
}, Q = {
|
|
195
|
+
category: "hidden",
|
|
196
|
+
type: "container",
|
|
197
|
+
label: "Item Trigger",
|
|
198
|
+
icon: p,
|
|
199
|
+
constraints: {
|
|
200
|
+
relation: "ancestor",
|
|
201
|
+
component: { $eq: "AccordionHeader" }
|
|
202
|
+
},
|
|
203
|
+
detachable: !1,
|
|
204
|
+
states: [
|
|
205
|
+
...y,
|
|
206
|
+
{
|
|
207
|
+
category: "component-states",
|
|
208
|
+
label: "Open",
|
|
209
|
+
selector: "[data-state=open]"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
presetStyle: {
|
|
213
|
+
button: [A, P].flat()
|
|
214
|
+
}
|
|
215
|
+
}, U = {
|
|
216
|
+
category: "hidden",
|
|
217
|
+
type: "container",
|
|
218
|
+
label: "Item Content",
|
|
219
|
+
icon: d,
|
|
220
|
+
constraints: {
|
|
221
|
+
relation: "ancestor",
|
|
222
|
+
component: { $eq: "AccordionItem" }
|
|
223
|
+
},
|
|
224
|
+
detachable: !1,
|
|
225
|
+
presetStyle: r
|
|
226
|
+
}, X = {
|
|
227
|
+
props: R,
|
|
228
|
+
initialProps: ["value", "collapsible"]
|
|
229
|
+
}, Z = {
|
|
230
|
+
props: W,
|
|
231
|
+
initialProps: ["value"]
|
|
232
|
+
}, _ = {
|
|
233
|
+
props: j
|
|
234
|
+
}, ee = {
|
|
235
|
+
props: D
|
|
236
|
+
}, te = {
|
|
237
|
+
props: E
|
|
238
|
+
};
|
|
239
|
+
export {
|
|
240
|
+
K as metaAccordion,
|
|
241
|
+
U as metaAccordionContent,
|
|
242
|
+
N as metaAccordionHeader,
|
|
243
|
+
L as metaAccordionItem,
|
|
244
|
+
Q as metaAccordionTrigger,
|
|
245
|
+
X as propsMetaAccordion,
|
|
246
|
+
te as propsMetaAccordionContent,
|
|
247
|
+
_ as propsMetaAccordionHeader,
|
|
248
|
+
Z as propsMetaAccordionItem,
|
|
249
|
+
ee as propsMetaAccordionTrigger
|
|
250
|
+
};
|
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,141 @@
|
|
|
1
|
+
import { CheckboxCheckedIcon as n, CheckMarkIcon as r, TriggerIcon as s } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as a } from "@webstudio-is/react-sdk";
|
|
3
|
+
import { button as i, span as p } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { flex as e, gap as l, items as t, h as d, w as h, shrink as b, rounded as k, border as o, focusVisible as m, outline as y, ring as u, disabled as x, cursor as f, opacity as g, state as C, bg as I, text as c, justify as v } from "./theme/tailwind-classes.js";
|
|
5
|
+
import { buttonReset as w } from "./theme/styles.js";
|
|
6
|
+
import { propsCheckbox as M, propsCheckboxIndicator as S } from "./__generated__/checkbox.props.js";
|
|
7
|
+
const j = {
|
|
8
|
+
category: "radix",
|
|
9
|
+
order: 101,
|
|
10
|
+
type: "container",
|
|
11
|
+
icon: n,
|
|
12
|
+
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.",
|
|
13
|
+
states: [
|
|
14
|
+
...a,
|
|
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: [i, w].flat()
|
|
28
|
+
},
|
|
29
|
+
template: [
|
|
30
|
+
{
|
|
31
|
+
type: "instance",
|
|
32
|
+
component: "Label",
|
|
33
|
+
label: "Checkbox Field",
|
|
34
|
+
styles: [e(), l(2), t("center")].flat(),
|
|
35
|
+
children: [
|
|
36
|
+
{
|
|
37
|
+
type: "instance",
|
|
38
|
+
component: "Checkbox",
|
|
39
|
+
variables: {
|
|
40
|
+
checkboxChecked: { initialValue: !1 }
|
|
41
|
+
},
|
|
42
|
+
props: [
|
|
43
|
+
{
|
|
44
|
+
name: "checked",
|
|
45
|
+
type: "expression",
|
|
46
|
+
code: "checkboxChecked"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "onCheckedChange",
|
|
50
|
+
type: "action",
|
|
51
|
+
value: [
|
|
52
|
+
{
|
|
53
|
+
type: "execute",
|
|
54
|
+
args: ["checked"],
|
|
55
|
+
code: "checkboxChecked = checked"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
// peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background
|
|
61
|
+
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
62
|
+
// disabled:cursor-not-allowed disabled:opacity-50
|
|
63
|
+
// data-[state=checked]:bg-primary
|
|
64
|
+
// data-[state=checked]:text-primary-foreground",
|
|
65
|
+
styles: [
|
|
66
|
+
// We are not supporting peer like styles yet
|
|
67
|
+
d(4),
|
|
68
|
+
h(4),
|
|
69
|
+
b(0),
|
|
70
|
+
k("sm"),
|
|
71
|
+
o(),
|
|
72
|
+
o("primary"),
|
|
73
|
+
m(
|
|
74
|
+
[y(), u("ring", 2, "background", 2)].flat()
|
|
75
|
+
),
|
|
76
|
+
x([f("not-allowed"), g(50)].flat()),
|
|
77
|
+
C(
|
|
78
|
+
[I("primary"), c("primaryForeground")].flat(),
|
|
79
|
+
"[data-state=checked]"
|
|
80
|
+
)
|
|
81
|
+
].flat(),
|
|
82
|
+
children: [
|
|
83
|
+
{
|
|
84
|
+
type: "instance",
|
|
85
|
+
component: "CheckboxIndicator",
|
|
86
|
+
// flex items-center justify-center text-current
|
|
87
|
+
styles: [
|
|
88
|
+
e(),
|
|
89
|
+
t("center"),
|
|
90
|
+
v("center"),
|
|
91
|
+
c("current")
|
|
92
|
+
].flat(),
|
|
93
|
+
children: [
|
|
94
|
+
{
|
|
95
|
+
type: "instance",
|
|
96
|
+
component: "HtmlEmbed",
|
|
97
|
+
label: "Indicator Icon",
|
|
98
|
+
props: [
|
|
99
|
+
{
|
|
100
|
+
type: "string",
|
|
101
|
+
name: "code",
|
|
102
|
+
value: r
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
children: []
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: "instance",
|
|
113
|
+
component: "Text",
|
|
114
|
+
label: "Checkbox Label",
|
|
115
|
+
props: [{ name: "tag", type: "string", value: "span" }],
|
|
116
|
+
children: [{ type: "text", value: "Checkbox", placeholder: !0 }]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}, q = {
|
|
122
|
+
category: "hidden",
|
|
123
|
+
type: "container",
|
|
124
|
+
detachable: !1,
|
|
125
|
+
icon: s,
|
|
126
|
+
states: a,
|
|
127
|
+
presetStyle: {
|
|
128
|
+
span: p
|
|
129
|
+
}
|
|
130
|
+
}, E = {
|
|
131
|
+
props: M,
|
|
132
|
+
initialProps: ["id", "className", "name", "value", "required", "checked"]
|
|
133
|
+
}, G = {
|
|
134
|
+
props: S
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
j as metaCheckbox,
|
|
138
|
+
q as metaCheckboxIndicator,
|
|
139
|
+
E as propsMetaCheckbox,
|
|
140
|
+
G as propsMetaCheckboxIndicator
|
|
141
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i, Children as l } from "react";
|
|
3
|
+
import { Root as a, Trigger as c, Content as p } from "@radix-ui/react-collapsible";
|
|
4
|
+
import { getClosestInstance as C } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const h = a, g = i(({ children: n, ...o }, t) => {
|
|
6
|
+
const e = l.toArray(n)[0];
|
|
7
|
+
return /* @__PURE__ */ r(c, { asChild: !0, ref: t, ...o, children: e ?? /* @__PURE__ */ r("button", { children: "Add button" }) });
|
|
8
|
+
}), u = p, s = "@webstudio-is/sdk-components-react-radix", x = {
|
|
9
|
+
onNavigatorSelect: (n, o) => {
|
|
10
|
+
for (const t of o.instancePath)
|
|
11
|
+
if (t.component === `${s}:CollapsibleContent`) {
|
|
12
|
+
const e = C(
|
|
13
|
+
o.instancePath,
|
|
14
|
+
t,
|
|
15
|
+
`${s}:Collapsible`
|
|
16
|
+
);
|
|
17
|
+
e && n.setMemoryProp(e, "open", !0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
h as Collapsible,
|
|
23
|
+
u as CollapsibleContent,
|
|
24
|
+
g as CollapsibleTrigger,
|
|
25
|
+
x as hooksCollapsible
|
|
26
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CollapsibleIcon as t, TriggerIcon as o, ContentIcon as n } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as l } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { propsCollapsible as p, propsCollapsibleTrigger as i, propsCollapsibleContent as a } from "./__generated__/collapsible.props.js";
|
|
4
|
+
import { getButtonStyles as r } from "./theme/styles.js";
|
|
5
|
+
const e = {
|
|
6
|
+
div: l
|
|
7
|
+
}, g = {
|
|
8
|
+
category: "radix",
|
|
9
|
+
order: 5,
|
|
10
|
+
type: "container",
|
|
11
|
+
presetStyle: e,
|
|
12
|
+
icon: t,
|
|
13
|
+
description: "An interactive component which expands and collapses some content, triggered by a button.",
|
|
14
|
+
template: [
|
|
15
|
+
{
|
|
16
|
+
type: "instance",
|
|
17
|
+
component: "Collapsible",
|
|
18
|
+
props: [],
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
type: "instance",
|
|
22
|
+
component: "CollapsibleTrigger",
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
type: "instance",
|
|
26
|
+
component: "Button",
|
|
27
|
+
styles: r("outline"),
|
|
28
|
+
children: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
value: "Click to toggle content",
|
|
32
|
+
placeholder: !0
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "instance",
|
|
40
|
+
component: "CollapsibleContent",
|
|
41
|
+
children: [
|
|
42
|
+
{
|
|
43
|
+
type: "instance",
|
|
44
|
+
component: "Text",
|
|
45
|
+
children: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
value: "Collapsible Content",
|
|
49
|
+
placeholder: !0
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}, b = {
|
|
59
|
+
category: "hidden",
|
|
60
|
+
type: "container",
|
|
61
|
+
icon: o,
|
|
62
|
+
stylable: !1,
|
|
63
|
+
detachable: !1
|
|
64
|
+
}, m = {
|
|
65
|
+
category: "hidden",
|
|
66
|
+
type: "container",
|
|
67
|
+
presetStyle: e,
|
|
68
|
+
icon: n,
|
|
69
|
+
detachable: !1
|
|
70
|
+
}, y = {
|
|
71
|
+
props: {
|
|
72
|
+
...p,
|
|
73
|
+
onOpenChange: {
|
|
74
|
+
type: "action",
|
|
75
|
+
control: "action",
|
|
76
|
+
required: !1
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
initialProps: ["open", "onOpenChange"]
|
|
80
|
+
}, h = {
|
|
81
|
+
props: i
|
|
82
|
+
}, u = {
|
|
83
|
+
props: a
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
g as metaCollapsible,
|
|
87
|
+
m as metaCollapsibleContent,
|
|
88
|
+
b as metaCollapsibleTrigger,
|
|
89
|
+
y as propsMetaCollapsible,
|
|
90
|
+
u as propsMetaCollapsibleContent,
|
|
91
|
+
h as propsMetaCollapsibleTrigger
|
|
92
|
+
};
|
|
@@ -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,84 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useContext as g, useEffect as h, Children as p, useRef as C } from "react";
|
|
3
|
+
import * as i from "@radix-ui/react-dialog";
|
|
4
|
+
import { ReactSdkContext as m, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const D = (t) => {
|
|
6
|
+
const { target: e } = t;
|
|
7
|
+
return !(!(e instanceof HTMLAnchorElement) || e.hasAttribute("href") === !1 || e.href === "#" || e.hasAttribute("target") && e.target === "_blank" || t.ctrlKey || t.metaKey);
|
|
8
|
+
}, A = c((t, e) => {
|
|
9
|
+
const { open: o, onOpenChange: r } = t, { renderer: s } = g(m);
|
|
10
|
+
return h(() => {
|
|
11
|
+
if (s !== void 0 || o === !1)
|
|
12
|
+
return;
|
|
13
|
+
const a = (l) => {
|
|
14
|
+
const { target: u } = l;
|
|
15
|
+
if (D(l) !== !1) {
|
|
16
|
+
if (!(u instanceof HTMLAnchorElement))
|
|
17
|
+
return !1;
|
|
18
|
+
u.closest('[role="dialog"]') && (r == null || r(!1));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return window.addEventListener("click", a), () => window.removeEventListener("click", a);
|
|
22
|
+
}, [o, r, s]), /* @__PURE__ */ n(i.Root, { ...t });
|
|
23
|
+
}), E = c(({ children: t, ...e }, o) => {
|
|
24
|
+
const r = p.toArray(t)[0];
|
|
25
|
+
return /* @__PURE__ */ n(i.Trigger, { ref: o, asChild: !0, ...e, children: r ?? /* @__PURE__ */ n("button", { children: "Add button or link" }) });
|
|
26
|
+
}), P = c((t, e) => /* @__PURE__ */ n(i.DialogPortal, { children: /* @__PURE__ */ n(i.Overlay, { ref: e, ...t }) })), T = c((t, e) => {
|
|
27
|
+
const o = C(!1), { renderer: r } = g(m);
|
|
28
|
+
return h(() => {
|
|
29
|
+
if (r !== void 0)
|
|
30
|
+
return;
|
|
31
|
+
o.current = !1;
|
|
32
|
+
const s = (a) => {
|
|
33
|
+
const { target: l } = a;
|
|
34
|
+
if (D(a) !== !1) {
|
|
35
|
+
if (!(l instanceof HTMLAnchorElement))
|
|
36
|
+
return !1;
|
|
37
|
+
l.closest('[role="dialog"]') && (o.current = !0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return window.addEventListener("click", s), () => window.removeEventListener("click", s);
|
|
41
|
+
}, [r]), /* @__PURE__ */ n(
|
|
42
|
+
i.Content,
|
|
43
|
+
{
|
|
44
|
+
ref: e,
|
|
45
|
+
...t,
|
|
46
|
+
onCloseAutoFocus: (s) => {
|
|
47
|
+
o.current && s.preventDefault();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}), L = i.Close, v = "h1", b = c(({ tag: t = v, children: e, ...o }, r) => /* @__PURE__ */ n(i.DialogTitle, { asChild: !0, children: /* @__PURE__ */ n(t, { ref: r, ...o, children: e }) })), x = i.Description, f = "@webstudio-is/sdk-components-react-radix", M = {
|
|
52
|
+
onNavigatorUnselect: (t, e) => {
|
|
53
|
+
for (const o of e.instancePath)
|
|
54
|
+
if (o.component === `${f}:DialogOverlay`) {
|
|
55
|
+
const r = d(
|
|
56
|
+
e.instancePath,
|
|
57
|
+
o,
|
|
58
|
+
`${f}:Dialog`
|
|
59
|
+
);
|
|
60
|
+
r && t.setMemoryProp(r, "open", void 0);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
onNavigatorSelect: (t, e) => {
|
|
64
|
+
for (const o of e.instancePath)
|
|
65
|
+
if (o.component === `${f}:DialogOverlay`) {
|
|
66
|
+
const r = d(
|
|
67
|
+
e.instancePath,
|
|
68
|
+
o,
|
|
69
|
+
`${f}:Dialog`
|
|
70
|
+
);
|
|
71
|
+
r && t.setMemoryProp(r, "open", !0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
A as Dialog,
|
|
77
|
+
L as DialogClose,
|
|
78
|
+
T as DialogContent,
|
|
79
|
+
x as DialogDescription,
|
|
80
|
+
P as DialogOverlay,
|
|
81
|
+
b as DialogTitle,
|
|
82
|
+
E as DialogTrigger,
|
|
83
|
+
M as hooksDialog
|
|
84
|
+
};
|