@webstudio-is/sdk-components-react-radix 0.189.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.
Files changed (47) hide show
  1. package/lib/__generated__/accordion.props.js +2631 -0
  2. package/lib/__generated__/checkbox.props.js +1084 -0
  3. package/lib/__generated__/collapsible.props.js +1024 -0
  4. package/lib/__generated__/dialog.props.js +2599 -0
  5. package/lib/__generated__/label.props.js +519 -0
  6. package/lib/__generated__/navigation-menu.props.js +3660 -0
  7. package/lib/__generated__/popover.props.js +564 -0
  8. package/lib/__generated__/radio-group.props.js +1619 -0
  9. package/lib/__generated__/select.props.js +3681 -0
  10. package/lib/__generated__/switch.props.js +1084 -0
  11. package/lib/__generated__/tabs.props.js +2121 -0
  12. package/lib/__generated__/tooltip.props.js +575 -0
  13. package/lib/accordion.js +36 -0
  14. package/lib/accordion.ws.js +254 -0
  15. package/lib/checkbox.js +8 -0
  16. package/lib/checkbox.ws.js +141 -0
  17. package/lib/collapsible.js +26 -0
  18. package/lib/collapsible.ws.js +92 -0
  19. package/lib/components.js +60 -406
  20. package/lib/dialog.js +84 -0
  21. package/lib/dialog.ws.js +260 -0
  22. package/lib/hooks.js +20 -655
  23. package/lib/label.js +7 -0
  24. package/lib/label.ws.js +43 -0
  25. package/lib/metas.js +62 -4570
  26. package/lib/navigation-menu.js +59 -0
  27. package/lib/navigation-menu.ws.js +481 -0
  28. package/lib/popover.js +48 -0
  29. package/lib/popover.ws.js +96 -0
  30. package/lib/props.js +60 -24208
  31. package/lib/radio-group.js +9 -0
  32. package/lib/radio-group.ws.js +159 -0
  33. package/lib/select.js +46 -0
  34. package/lib/select.ws.js +308 -0
  35. package/lib/sheet.js +43 -0
  36. package/lib/sheet.ws.js +217 -0
  37. package/lib/switch.js +8 -0
  38. package/lib/switch.ws.js +140 -0
  39. package/lib/tabs.js +31 -0
  40. package/lib/tabs.ws.js +187 -0
  41. package/lib/theme/__generated__/tailwind-theme.js +503 -0
  42. package/lib/theme/styles.js +52 -0
  43. package/lib/theme/tailwind-classes.js +474 -0
  44. package/lib/tooltip.js +45 -0
  45. package/lib/tooltip.ws.js +97 -0
  46. package/lib/types/theme/styles.d.ts +44 -44
  47. package/package.json +10 -11
@@ -0,0 +1,9 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { Root as d, Item as p, Indicator as e } from "@radix-ui/react-radio-group";
4
+ const u = m(({ value: o, defaultValue: r, ...t }, a) => /* @__PURE__ */ i(d, { ...t, defaultValue: o ?? r, ref: a })), R = p, s = e;
5
+ export {
6
+ u as RadioGroup,
7
+ s as RadioGroupIndicator,
8
+ R as RadioGroupItem
9
+ };
@@ -0,0 +1,159 @@
1
+ import { RadioCheckedIcon as c, ItemIcon as i, TriggerIcon as s, RadioDotIcon as l } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as o } from "@webstudio-is/react-sdk";
3
+ import { div as d, button as u, span as m } from "@webstudio-is/sdk/normalize.css";
4
+ import { flex as t, gap as r, items as y, aspect as b, h as f, w as h, rounded as G, border as a, text as R, focusVisible as I, outline as g, ring as v, disabled as k, cursor as x, opacity as V } from "./theme/tailwind-classes.js";
5
+ import { buttonReset as C } from "./theme/styles.js";
6
+ import { propsRadioGroup as q, propsRadioGroupItem as w, propsRadioGroupIndicator as S } from "./__generated__/radio-group.props.js";
7
+ const e = ({
8
+ value: n,
9
+ label: p
10
+ }) => ({
11
+ type: "instance",
12
+ component: "Label",
13
+ // flex items-center space-x-2
14
+ styles: [t(), y("center"), r(2)].flat(),
15
+ children: [
16
+ {
17
+ type: "instance",
18
+ component: "RadioGroupItem",
19
+ props: [{ name: "value", type: "string", value: n }],
20
+ // aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background
21
+ // focus:outline-none
22
+ // focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
23
+ // disabled:cursor-not-allowed disabled:opacity-50
24
+ styles: [
25
+ b("square"),
26
+ f(4),
27
+ h(4),
28
+ G("full"),
29
+ a(),
30
+ a("primary"),
31
+ R("primary"),
32
+ I(
33
+ [g(), v("ring", 2, "background", 2)].flat()
34
+ ),
35
+ k([x("not-allowed"), V(50)].flat())
36
+ ].flat(),
37
+ children: [
38
+ {
39
+ type: "instance",
40
+ component: "RadioGroupIndicator",
41
+ children: [
42
+ {
43
+ type: "instance",
44
+ component: "HtmlEmbed",
45
+ label: "Indicator Icon",
46
+ props: [
47
+ {
48
+ type: "string",
49
+ name: "code",
50
+ value: l
51
+ }
52
+ ],
53
+ children: []
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ type: "instance",
61
+ component: "Text",
62
+ children: [{ type: "text", value: p, placeholder: !0 }]
63
+ }
64
+ ]
65
+ }), H = {
66
+ category: "radix",
67
+ order: 100,
68
+ type: "container",
69
+ description: "A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
70
+ icon: c,
71
+ states: [
72
+ ...o,
73
+ {
74
+ label: "Checked",
75
+ selector: "[data-state=checked]",
76
+ category: "component-states"
77
+ },
78
+ {
79
+ label: "Unchecked",
80
+ selector: "[data-state=unchecked]",
81
+ category: "component-states"
82
+ }
83
+ ],
84
+ presetStyle: {
85
+ div: d
86
+ },
87
+ template: [
88
+ {
89
+ type: "instance",
90
+ component: "RadioGroup",
91
+ variables: {
92
+ radioGroupValue: { initialValue: "" }
93
+ },
94
+ // grid gap-2
95
+ styles: [t(), t("col"), r(2)].flat(),
96
+ props: [
97
+ {
98
+ type: "expression",
99
+ name: "value",
100
+ code: "radioGroupValue"
101
+ },
102
+ {
103
+ name: "onValueChange",
104
+ type: "action",
105
+ value: [
106
+ {
107
+ type: "execute",
108
+ args: ["value"],
109
+ code: "radioGroupValue = value"
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ children: [
115
+ e({ value: "default", label: "Default" }),
116
+ e({ value: "comfortable", label: "Comfortable" }),
117
+ e({ value: "compact", label: "Compact" })
118
+ ]
119
+ }
120
+ ]
121
+ }, L = {
122
+ category: "hidden",
123
+ type: "container",
124
+ requiredAncestors: ["RadioGroup"],
125
+ constraints: {
126
+ relation: "ancestor",
127
+ component: { $eq: "RadioGroup" }
128
+ },
129
+ icon: i,
130
+ states: o,
131
+ presetStyle: {
132
+ button: [u, C].flat()
133
+ }
134
+ }, N = {
135
+ category: "hidden",
136
+ type: "container",
137
+ detachable: !1,
138
+ icon: s,
139
+ states: o,
140
+ presetStyle: {
141
+ span: m
142
+ }
143
+ }, U = {
144
+ props: q,
145
+ initialProps: ["id", "className", "name", "value", "required"]
146
+ }, $ = {
147
+ props: w,
148
+ initialProps: ["value"]
149
+ }, j = {
150
+ props: S
151
+ };
152
+ export {
153
+ H as metaRadioGroup,
154
+ N as metaRadioGroupIndicator,
155
+ L as metaRadioGroupItem,
156
+ U as propsMetaRadioGroup,
157
+ j as propsMetaRadioGroupIndicator,
158
+ $ as propsMetaRadioGroupItem
159
+ };
package/lib/select.js ADDED
@@ -0,0 +1,46 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as s, useContext as l } from "react";
3
+ import { Root as m, Trigger as p, Value as f, Portal as S, Content as d, Viewport as u, Item as I, ItemIndicator as P, ItemText as g } from "@radix-ui/react-select";
4
+ import { ReactSdkContext as x, getClosestInstance as i } from "@webstudio-is/react-sdk/runtime";
5
+ const v = s(
6
+ ({ value: e, defaultValue: t, ...o }, n) => /* @__PURE__ */ c(m, { ...o, defaultValue: e ?? t })
7
+ ), T = s((e, t) => {
8
+ const { renderer: o } = l(x);
9
+ return /* @__PURE__ */ c(p, { onPointerDown: o === "canvas" ? (a) => {
10
+ a.preventDefault();
11
+ } : void 0, ref: t, ...e });
12
+ }), $ = s((e, t) => /* @__PURE__ */ c(f, { ref: t, ...e })), k = s((e, t) => /* @__PURE__ */ c(S, { children: /* @__PURE__ */ c(d, { ref: t, ...e, position: "popper" }) })), D = u, R = I, y = P, M = g, r = "@webstudio-is/sdk-components-react-radix", N = {
13
+ onNavigatorUnselect: (e, t) => {
14
+ for (const o of t.instancePath)
15
+ if (o.component === `${r}:SelectContent`) {
16
+ const n = i(
17
+ t.instancePath,
18
+ o,
19
+ `${r}:Select`
20
+ );
21
+ n && e.setMemoryProp(n, "open", void 0);
22
+ }
23
+ },
24
+ onNavigatorSelect: (e, t) => {
25
+ for (const o of t.instancePath)
26
+ if (o.component === `${r}:SelectContent`) {
27
+ const n = i(
28
+ t.instancePath,
29
+ o,
30
+ `${r}:Select`
31
+ );
32
+ n && e.setMemoryProp(n, "open", !0);
33
+ }
34
+ }
35
+ };
36
+ export {
37
+ v as Select,
38
+ k as SelectContent,
39
+ R as SelectItem,
40
+ y as SelectItemIndicator,
41
+ M as SelectItemText,
42
+ T as SelectTrigger,
43
+ $ as SelectValue,
44
+ D as SelectViewport,
45
+ N as hooksSelect
46
+ };
@@ -0,0 +1,308 @@
1
+ import { SelectIcon as V, TriggerIcon as w, FormTextFieldIcon as T, ContentIcon as M, ViewportIcon as q, ItemIcon as C, CheckMarkIcon as d, TextIcon as k } from "@webstudio-is/icons/svg";
2
+ import { button as F, span as s, div as A } from "@webstudio-is/sdk/normalize.css";
3
+ import { flex as c, h as m, w as t, items as l, justify as u, rounded as a, border as o, bg as p, px as P, py as y, text as e, state as h, focus as S, outline as g, ring as $, disabled as E, cursor as I, opacity as f, relative as v, z as W, property as n, overflow as j, shadow as z, p as D, select as H, pl as L, pr as U, pointerEvents as B, absolute as G, left as J } from "./theme/tailwind-classes.js";
4
+ import { propsSelect as K, propsSelectTrigger as N, propsSelectValue as O, propsSelectContent as Q, propsSelectViewport as R, propsSelectItem as X, propsSelectItemIndicator as Y, propsSelectItemText as Z } from "./__generated__/select.props.js";
5
+ const i = {
6
+ div: A
7
+ }, r = ({
8
+ props: b,
9
+ children: x
10
+ }) => ({
11
+ type: "instance",
12
+ component: "SelectItem",
13
+ props: b,
14
+ // relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none
15
+ // focus:bg-accent focus:text-accent-foreground
16
+ // data-[disabled]:pointer-events-none data-[disabled]:opacity-50
17
+ styles: [
18
+ v(),
19
+ c(),
20
+ t("full"),
21
+ I("default"),
22
+ H(),
23
+ l("center"),
24
+ a("md"),
25
+ y(1.5),
26
+ L(8),
27
+ U(2),
28
+ e("sm"),
29
+ g(),
30
+ S([p("accent"), e("accentForeground")].flat()),
31
+ h(
32
+ [B("none"), f(50)].flat(),
33
+ "[data-disabled]"
34
+ )
35
+ ].flat(),
36
+ children: [
37
+ {
38
+ type: "instance",
39
+ component: "SelectItemIndicator",
40
+ // absolute left-2 flex h-3.5 w-3.5 items-center justify-center
41
+ styles: [
42
+ G(),
43
+ J(2),
44
+ c(),
45
+ m(3.5),
46
+ t(3.5),
47
+ l("center"),
48
+ u("center")
49
+ ].flat(),
50
+ children: [
51
+ {
52
+ type: "instance",
53
+ component: "HtmlEmbed",
54
+ label: "Indicator Icon",
55
+ props: [
56
+ {
57
+ type: "string",
58
+ name: "code",
59
+ value: d
60
+ }
61
+ ],
62
+ children: []
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ type: "instance",
68
+ component: "SelectItemText",
69
+ children: x
70
+ }
71
+ ]
72
+ }), ne = {
73
+ category: "radix",
74
+ order: 10,
75
+ type: "container",
76
+ icon: V,
77
+ stylable: !1,
78
+ description: "Use within a form to give your users a list of options to choose from.",
79
+ template: [
80
+ {
81
+ type: "instance",
82
+ component: "Select",
83
+ variables: {
84
+ selectValue: { initialValue: "" }
85
+ },
86
+ props: [
87
+ {
88
+ name: "value",
89
+ type: "expression",
90
+ code: "selectValue"
91
+ },
92
+ {
93
+ name: "onValueChange",
94
+ type: "action",
95
+ value: [
96
+ { type: "execute", args: ["value"], code: "selectValue = value" }
97
+ ]
98
+ }
99
+ ],
100
+ children: [
101
+ {
102
+ type: "instance",
103
+ component: "SelectTrigger",
104
+ // flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background
105
+ // placeholder:text-muted-foreground
106
+ // focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
107
+ // disabled:cursor-not-allowed disabled:opacity-50
108
+ styles: [
109
+ c(),
110
+ m(10),
111
+ t("full"),
112
+ l("center"),
113
+ u("between"),
114
+ a("md"),
115
+ o(),
116
+ o("input"),
117
+ p("background"),
118
+ P(3),
119
+ y(2),
120
+ e("sm"),
121
+ h([e("mutedForeground")].flat(), "::placeholder"),
122
+ S(
123
+ [g(), $("ring", 2, "background", 2)].flat()
124
+ ),
125
+ E([I("not-allowed"), f(50)].flat())
126
+ ].flat(),
127
+ children: [
128
+ {
129
+ type: "instance",
130
+ component: "SelectValue",
131
+ props: [{ name: "placeholder", type: "string", value: "Theme" }],
132
+ children: []
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ type: "instance",
138
+ component: "SelectContent",
139
+ // relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md
140
+ // data-[state=open]:animate-in
141
+ // data-[state=closed]:animate-out data-[state=closed]:fade-out-0
142
+ // data-[state=open]:fade-in-0
143
+ // data-[state=closed]:zoom-out-95
144
+ // data-[state=open]:zoom-in-95
145
+ // data-[side=bottom]:slide-in-from-top-2
146
+ // data-[side=left]:slide-in-from-right-2
147
+ // data-[side=right]:slide-in-from-left-2
148
+ // data-[side=top]:slide-in-from-bottom-2
149
+ // position=popper
150
+ // data-[side=bottom]:translate-y-1
151
+ // data-[side=left]:-translate-x-1
152
+ // data-[side=right]:translate-x-1
153
+ // data-[side=top]:-translate-y-1
154
+ styles: [
155
+ v(),
156
+ W(50),
157
+ n("minWidth", "8rem"),
158
+ j("hidden"),
159
+ a("md"),
160
+ o(),
161
+ p("popover"),
162
+ e("popoverForeground"),
163
+ z("md")
164
+ ].flat(),
165
+ children: [
166
+ {
167
+ type: "instance",
168
+ component: "SelectViewport",
169
+ // p-1
170
+ // position=popper
171
+ // h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]
172
+ styles: [
173
+ D(1),
174
+ n("height", "--radix-select-trigger-height"),
175
+ t("full"),
176
+ n("minWidth", "--radix-select-trigger-width")
177
+ ].flat(),
178
+ children: [
179
+ r({
180
+ props: [{ name: "value", type: "string", value: "light" }],
181
+ children: [
182
+ { type: "text", value: "Light", placeholder: !0 }
183
+ ]
184
+ }),
185
+ r({
186
+ props: [{ name: "value", type: "string", value: "dark" }],
187
+ children: [
188
+ { type: "text", value: "Dark", placeholder: !0 }
189
+ ]
190
+ }),
191
+ r({
192
+ props: [{ name: "value", type: "string", value: "system" }],
193
+ children: [
194
+ { type: "text", value: "System", placeholder: !0 }
195
+ ]
196
+ })
197
+ ]
198
+ }
199
+ ]
200
+ }
201
+ ]
202
+ }
203
+ ]
204
+ }, re = {
205
+ category: "hidden",
206
+ type: "container",
207
+ icon: w,
208
+ detachable: !1,
209
+ presetStyle: {
210
+ button: F
211
+ }
212
+ }, ce = {
213
+ category: "hidden",
214
+ type: "container",
215
+ label: "Value",
216
+ icon: T,
217
+ detachable: !1,
218
+ presetStyle: {
219
+ span: s
220
+ }
221
+ }, le = {
222
+ category: "hidden",
223
+ type: "container",
224
+ icon: M,
225
+ detachable: !1,
226
+ presetStyle: i
227
+ }, ae = {
228
+ category: "hidden",
229
+ type: "container",
230
+ icon: q,
231
+ detachable: !1,
232
+ presetStyle: i
233
+ }, pe = {
234
+ category: "hidden",
235
+ type: "container",
236
+ icon: C,
237
+ requiredAncestors: ["SelectViewport"],
238
+ constraints: {
239
+ relation: "ancestor",
240
+ component: { $eq: "SelectViewport" }
241
+ },
242
+ presetStyle: i
243
+ }, se = {
244
+ category: "hidden",
245
+ type: "container",
246
+ label: "Indicator",
247
+ icon: d,
248
+ detachable: !1,
249
+ requiredAncestors: ["SelectItem"],
250
+ constraints: {
251
+ relation: "ancestor",
252
+ component: { $eq: "SelectItem" }
253
+ },
254
+ presetStyle: {
255
+ span: s
256
+ }
257
+ }, ie = {
258
+ category: "hidden",
259
+ type: "container",
260
+ label: "Item Text",
261
+ icon: k,
262
+ detachable: !1,
263
+ requiredAncestors: ["SelectItem"],
264
+ constraints: {
265
+ relation: "ancestor",
266
+ component: { $eq: "SelectItem" }
267
+ },
268
+ presetStyle: {
269
+ span: s
270
+ }
271
+ }, de = {
272
+ props: K,
273
+ initialProps: ["name", "value", "open", "required"]
274
+ }, me = {
275
+ props: N
276
+ }, ue = {
277
+ props: O,
278
+ initialProps: ["placeholder"]
279
+ }, ye = {
280
+ props: Q
281
+ }, he = {
282
+ props: R
283
+ }, Se = {
284
+ props: X,
285
+ initialProps: ["value"]
286
+ }, ge = {
287
+ props: Y
288
+ }, Ie = {
289
+ props: Z
290
+ };
291
+ export {
292
+ ne as metaSelect,
293
+ le as metaSelectContent,
294
+ pe as metaSelectItem,
295
+ se as metaSelectItemIndicator,
296
+ ie as metaSelectItemText,
297
+ re as metaSelectTrigger,
298
+ ce as metaSelectValue,
299
+ ae as metaSelectViewport,
300
+ de as propsMetaSelect,
301
+ ye as propsMetaSelectContent,
302
+ Se as propsMetaSelectItem,
303
+ ge as propsMetaSelectItemIndicator,
304
+ Ie as propsMetaSelectItemText,
305
+ me as propsMetaSelectTrigger,
306
+ ue as propsMetaSelectValue,
307
+ he as propsMetaSelectViewport
308
+ };
package/lib/sheet.js ADDED
@@ -0,0 +1,43 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
3
+ import { getClosestInstance as r } from "@webstudio-is/react-sdk/runtime";
4
+ import { DialogContent as h } from "./dialog.js";
5
+ f(
6
+ ({ tag: n = "nav", side: t = "left", role: e = "navigation", children: o, ...i }, c) => /* @__PURE__ */ s(
7
+ h,
8
+ {
9
+ asChild: !0,
10
+ "data-side": t,
11
+ role: e,
12
+ ...i,
13
+ children: /* @__PURE__ */ s(n, { ref: c, children: o })
14
+ }
15
+ )
16
+ );
17
+ const a = "@webstudio-is/sdk-components-react-radix", P = {
18
+ onNavigatorUnselect: (n, t) => {
19
+ for (const e of t.instancePath)
20
+ if (e.component === `${a}:SheetOverlay`) {
21
+ const o = r(
22
+ t.instancePath,
23
+ e,
24
+ `${a}:Sheet`
25
+ );
26
+ o && n.setMemoryProp(o, "open", void 0);
27
+ }
28
+ },
29
+ onNavigatorSelect: (n, t) => {
30
+ for (const e of t.instancePath)
31
+ if (e.component === `${a}:SheetOverlay`) {
32
+ const o = r(
33
+ t.instancePath,
34
+ e,
35
+ `${a}:Sheet`
36
+ );
37
+ o && n.setMemoryProp(o, "open", !0);
38
+ }
39
+ }
40
+ };
41
+ export {
42
+ P as hooksSheet
43
+ };