@webstudio-is/sdk-components-react-radix 0.185.0 → 0.191.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +92 -44
  47. package/package.json +19 -20
@@ -0,0 +1,254 @@
1
+ import { AccordionIcon as a, ItemIcon as s, HeaderIcon as l, TriggerIcon as d, ContentIcon as p, 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 u } from "@webstudio-is/sdk/normalize.css";
4
+ import { borderB as g, 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 q, hover as T, underline as w, property as t, state as S, h as M, 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: u
9
+ }, o = [g()].flat(), n = ({
10
+ children: i
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
+ q("medium"),
28
+ T([w()].flat()),
29
+ t("--accordion-trigger-icon-transform", "0deg"),
30
+ S(
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: i
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
+ M(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: a,
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
+ requiredAncestors: ["Accordion"],
176
+ constraints: {
177
+ relation: "ancestor",
178
+ component: { $eq: "Accordion" }
179
+ },
180
+ indexWithinAncestor: "Accordion",
181
+ presetStyle: r
182
+ }, N = {
183
+ category: "hidden",
184
+ type: "container",
185
+ label: "Item Header",
186
+ icon: l,
187
+ requiredAncestors: ["AccordionItem"],
188
+ constraints: {
189
+ relation: "ancestor",
190
+ component: { $eq: "AccordionItem" }
191
+ },
192
+ detachable: !1,
193
+ presetStyle: {
194
+ h3: [h, v(0)].flat()
195
+ }
196
+ }, Q = {
197
+ category: "hidden",
198
+ type: "container",
199
+ label: "Item Trigger",
200
+ icon: d,
201
+ requiredAncestors: ["AccordionHeader"],
202
+ constraints: {
203
+ relation: "ancestor",
204
+ component: { $eq: "AccordionHeader" }
205
+ },
206
+ detachable: !1,
207
+ states: [
208
+ ...y,
209
+ {
210
+ category: "component-states",
211
+ label: "Open",
212
+ selector: "[data-state=open]"
213
+ }
214
+ ],
215
+ presetStyle: {
216
+ button: [A, P].flat()
217
+ }
218
+ }, U = {
219
+ category: "hidden",
220
+ type: "container",
221
+ label: "Item Content",
222
+ icon: p,
223
+ requiredAncestors: ["AccordionItem"],
224
+ constraints: {
225
+ relation: "ancestor",
226
+ component: { $eq: "AccordionItem" }
227
+ },
228
+ detachable: !1,
229
+ presetStyle: r
230
+ }, X = {
231
+ props: R,
232
+ initialProps: ["value", "collapsible"]
233
+ }, Z = {
234
+ props: W,
235
+ initialProps: ["value"]
236
+ }, _ = {
237
+ props: j
238
+ }, ee = {
239
+ props: D
240
+ }, te = {
241
+ props: E
242
+ };
243
+ export {
244
+ K as metaAccordion,
245
+ U as metaAccordionContent,
246
+ N as metaAccordionHeader,
247
+ L as metaAccordionItem,
248
+ Q as metaAccordionTrigger,
249
+ X as propsMetaAccordion,
250
+ te as propsMetaAccordionContent,
251
+ _ as propsMetaAccordionHeader,
252
+ Z as propsMetaAccordionItem,
253
+ ee as propsMetaAccordionTrigger
254
+ };
@@ -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
+ };