@webstudio-is/sdk-components-react-radix 0.195.0 → 0.197.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__/select.props.js +6 -0
- package/lib/__generated__/tabs.props.js +2 -2
- package/lib/accordion.template.js +95 -0
- package/lib/accordion.ws.js +53 -205
- package/lib/checkbox.template.js +63 -0
- package/lib/checkbox.ws.js +22 -119
- package/lib/collapsible.template.js +16 -0
- package/lib/collapsible.ws.js +21 -71
- package/lib/dialog.template.js +119 -0
- package/lib/dialog.ws.js +60 -237
- package/lib/label.template.js +23 -0
- package/lib/label.ws.js +12 -36
- package/lib/metas.js +48 -50
- package/lib/navigation-menu.template.js +283 -0
- package/lib/navigation-menu.ws.js +54 -420
- package/lib/popover.template.js +33 -0
- package/lib/popover.ws.js +19 -79
- package/lib/radio-group.template.js +66 -0
- package/lib/radio-group.ws.js +27 -125
- package/lib/select.template.js +121 -0
- package/lib/select.ws.js +61 -262
- 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 +1 -1
- package/lib/switch.template.js +63 -0
- package/lib/switch.ws.js +22 -106
- package/lib/tabs.template.js +66 -0
- package/lib/tabs.ws.js +36 -131
- package/lib/templates.js +28 -0
- package/lib/tooltip.template.js +33 -0
- package/lib/tooltip.ws.js +24 -84
- package/lib/types/__generated__/accordion.props.d.ts +1 -1
- package/lib/types/__generated__/checkbox.props.d.ts +1 -1
- package/lib/types/__generated__/collapsible.props.d.ts +1 -1
- package/lib/types/__generated__/dialog.props.d.ts +1 -1
- package/lib/types/__generated__/label.props.d.ts +1 -1
- package/lib/types/__generated__/navigation-menu.props.d.ts +1 -1
- package/lib/types/__generated__/popover.props.d.ts +1 -1
- package/lib/types/__generated__/radio-group.props.d.ts +1 -1
- package/lib/types/__generated__/select.props.d.ts +1 -1
- package/lib/types/__generated__/switch.props.d.ts +1 -1
- package/lib/types/__generated__/tabs.props.d.ts +1 -1
- package/lib/types/__generated__/tooltip.props.d.ts +1 -1
- package/lib/types/accordion.template.d.ts +10 -0
- package/lib/types/accordion.ws.d.ts +1 -1
- package/lib/types/checkbox.d.ts +1 -1
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +1 -1
- package/lib/types/collapsible.template.d.ts +2 -0
- package/lib/types/collapsible.ws.d.ts +1 -1
- package/lib/types/dialog.template.d.ts +10 -0
- package/lib/types/dialog.ws.d.ts +1 -9
- package/lib/types/label.template.d.ts +10 -0
- package/lib/types/label.ws.d.ts +1 -1
- package/lib/types/metas.d.ts +0 -1
- package/lib/types/navigation-menu.template.d.ts +2 -0
- package/lib/types/navigation-menu.ws.d.ts +1 -1
- package/lib/types/popover.template.d.ts +10 -0
- package/lib/types/popover.ws.d.ts +1 -9
- package/lib/types/radio-group.template.d.ts +2 -0
- package/lib/types/radio-group.ws.d.ts +1 -1
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +1 -1
- package/lib/types/shared/preset-styles.d.ts +2 -0
- package/lib/types/shared/proxy.d.ts +17 -0
- package/lib/types/shared/styles.d.ts +2 -0
- package/lib/types/shared/theme.d.ts +212 -0
- package/lib/types/{sheet.ws.d.ts → sheet.template.d.ts} +2 -2
- package/lib/types/switch.template.d.ts +2 -0
- package/lib/types/switch.ws.d.ts +1 -1
- package/lib/types/tabs.template.d.ts +2 -0
- package/lib/types/tabs.ws.d.ts +1 -1
- package/lib/types/templates.d.ts +13 -0
- package/lib/types/tooltip.template.d.ts +10 -0
- package/lib/types/tooltip.ws.d.ts +1 -9
- package/package.json +26 -23
- package/lib/sheet.ws.js +0 -217
- package/lib/theme/__generated__/tailwind-theme.js +0 -503
- package/lib/theme/styles.js +0 -52
- package/lib/theme/tailwind-classes.js +0 -474
- package/lib/types/__generated__/sheet.props.d.ts +0 -8
- package/lib/types/theme/__generated__/tailwind-theme.d.ts +0 -26
- package/lib/types/theme/styles.d.ts +0 -278
- package/lib/types/theme/tailwind-classes.d.ts +0 -104
- package/lib/types/theme/tailwind-colors.d.ts +0 -31
|
@@ -19,6 +19,12 @@ const e = {
|
|
|
19
19
|
type: "boolean",
|
|
20
20
|
description: "Indicates whether the user can interact with the element."
|
|
21
21
|
},
|
|
22
|
+
form: {
|
|
23
|
+
required: !1,
|
|
24
|
+
control: "text",
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Indicates the form that is the owner of the element."
|
|
27
|
+
},
|
|
22
28
|
name: {
|
|
23
29
|
required: !1,
|
|
24
30
|
control: "text",
|
|
@@ -524,10 +524,10 @@ Mainly so arrow navigation is done accordingly (left & right vs. up & down)
|
|
|
524
524
|
options: ["on", "off"]
|
|
525
525
|
},
|
|
526
526
|
value: {
|
|
527
|
-
description: "The value for the selected tab, if controlled",
|
|
528
527
|
required: !1,
|
|
529
528
|
control: "text",
|
|
530
|
-
type: "string"
|
|
529
|
+
type: "string",
|
|
530
|
+
description: "Defines a default value which will be displayed in the element on pageload."
|
|
531
531
|
},
|
|
532
532
|
vocab: { required: !1, control: "text", type: "string" }
|
|
533
533
|
}, t = {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { css as t, $ as o, PlaceholderValue as s } from "@webstudio-is/template";
|
|
3
|
+
import { radix as i } from "./shared/proxy.js";
|
|
4
|
+
import { borderWidth as h, colors as m, spacing as a, weights as f, height as g, width as p, transition as c, fontSize as w, fontSizeLineHeight as y } from "./shared/theme.js";
|
|
5
|
+
import { ChevronDownIcon as b } from "@webstudio-is/icons/svg";
|
|
6
|
+
const n = (d, l) => /* @__PURE__ */ r(
|
|
7
|
+
i.AccordionItem,
|
|
8
|
+
{
|
|
9
|
+
"ws:style": t`
|
|
10
|
+
border-bottom: ${h.DEFAULT} solid ${m.border};
|
|
11
|
+
`,
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
i.AccordionHeader,
|
|
15
|
+
{
|
|
16
|
+
"ws:style": t`
|
|
17
|
+
display: flex;
|
|
18
|
+
`,
|
|
19
|
+
children: /* @__PURE__ */ r(
|
|
20
|
+
i.AccordionTrigger,
|
|
21
|
+
{
|
|
22
|
+
"ws:style": t`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex: 1 1 0;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: between;
|
|
27
|
+
padding: ${a[4]} 0;
|
|
28
|
+
font-weight: ${f.medium};
|
|
29
|
+
--accordion-trigger-icon-transform: 0deg;
|
|
30
|
+
&:hover {
|
|
31
|
+
text-decoration-line: underline;
|
|
32
|
+
}
|
|
33
|
+
&[data-state="open"] {
|
|
34
|
+
--accordion-trigger-icon-transform: 180deg;
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ e(o.Text, { children: new s(d) }),
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
o.Box,
|
|
41
|
+
{
|
|
42
|
+
"ws:label": "Icon Container",
|
|
43
|
+
"ws:style": t`
|
|
44
|
+
rotate: --accordion-trigger-icon-transform;
|
|
45
|
+
height: ${g[4]};
|
|
46
|
+
width: ${p[4]};
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
transition: ${c.all};
|
|
49
|
+
transition-duration: 200ms;
|
|
50
|
+
`,
|
|
51
|
+
children: /* @__PURE__ */ e(o.HtmlEmbed, { "ws:label": "Chevron Icon", code: b })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ e(
|
|
60
|
+
i.AccordionContent,
|
|
61
|
+
{
|
|
62
|
+
"ws:style": t`
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
font-size: ${w.sm};
|
|
65
|
+
line-height: ${y.sm};
|
|
66
|
+
transition: ${c.all};
|
|
67
|
+
padding-bottom: ${a[4]};
|
|
68
|
+
`,
|
|
69
|
+
children: new s(l)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
), v = {
|
|
75
|
+
category: "radix",
|
|
76
|
+
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.",
|
|
77
|
+
order: 3,
|
|
78
|
+
template: /* @__PURE__ */ r(i.Accordion, { collapsible: !0, defaultValue: "0", children: [
|
|
79
|
+
n(
|
|
80
|
+
"Is it accessible?",
|
|
81
|
+
"Yes. It adheres to the WAI-ARIA design pattern."
|
|
82
|
+
),
|
|
83
|
+
n(
|
|
84
|
+
"Is it styled?",
|
|
85
|
+
"Yes. It comes with default styles that matches the other components' aesthetic."
|
|
86
|
+
),
|
|
87
|
+
n(
|
|
88
|
+
"Is it animated?",
|
|
89
|
+
"Yes. It's animated by default, but you can disable it if you prefer."
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
v as meta
|
|
95
|
+
};
|
package/lib/accordion.ws.js
CHANGED
|
@@ -1,183 +1,24 @@
|
|
|
1
|
-
import { AccordionIcon as
|
|
2
|
-
import { defaultStates as
|
|
3
|
-
import { h3 as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, o = [u()].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
|
-
C("center"),
|
|
25
|
-
x("between"),
|
|
26
|
-
H(4),
|
|
27
|
-
T("medium"),
|
|
28
|
-
q([$()].flat()),
|
|
29
|
-
t("--accordion-trigger-icon-transform", "0deg"),
|
|
30
|
-
w(
|
|
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
|
-
S(4),
|
|
49
|
-
M(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
|
-
I("hidden"),
|
|
75
|
-
f("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,
|
|
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 = {
|
|
82
9
|
type: "container",
|
|
83
|
-
icon:
|
|
84
|
-
presetStyle:
|
|
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.",
|
|
10
|
+
icon: t,
|
|
11
|
+
presetStyle: o,
|
|
86
12
|
constraints: [
|
|
87
13
|
{
|
|
88
14
|
relation: "descendant",
|
|
89
15
|
component: { $eq: "AccordionItem" }
|
|
90
16
|
}
|
|
91
|
-
],
|
|
92
|
-
template: [
|
|
93
|
-
{
|
|
94
|
-
type: "instance",
|
|
95
|
-
component: "Accordion",
|
|
96
|
-
props: [
|
|
97
|
-
{ type: "boolean", name: "collapsible", value: !0 },
|
|
98
|
-
{ type: "string", name: "defaultValue", value: "0" }
|
|
99
|
-
],
|
|
100
|
-
children: [
|
|
101
|
-
{
|
|
102
|
-
type: "instance",
|
|
103
|
-
component: "AccordionItem",
|
|
104
|
-
styles: o,
|
|
105
|
-
children: [
|
|
106
|
-
n({
|
|
107
|
-
children: [
|
|
108
|
-
{ type: "text", value: "Is it accessible?", placeholder: !0 }
|
|
109
|
-
]
|
|
110
|
-
}),
|
|
111
|
-
{
|
|
112
|
-
type: "instance",
|
|
113
|
-
component: "AccordionContent",
|
|
114
|
-
styles: c,
|
|
115
|
-
children: [
|
|
116
|
-
{
|
|
117
|
-
type: "text",
|
|
118
|
-
value: "Yes. It adheres to the WAI-ARIA design pattern.",
|
|
119
|
-
placeholder: !0
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
type: "instance",
|
|
127
|
-
component: "AccordionItem",
|
|
128
|
-
styles: o,
|
|
129
|
-
children: [
|
|
130
|
-
n({
|
|
131
|
-
children: [
|
|
132
|
-
{ type: "text", value: "Is it styled?", placeholder: !0 }
|
|
133
|
-
]
|
|
134
|
-
}),
|
|
135
|
-
{
|
|
136
|
-
type: "instance",
|
|
137
|
-
component: "AccordionContent",
|
|
138
|
-
styles: c,
|
|
139
|
-
children: [
|
|
140
|
-
{
|
|
141
|
-
type: "text",
|
|
142
|
-
value: "Yes. It comes with default styles that matches the other components' aesthetic.",
|
|
143
|
-
placeholder: !0
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
type: "instance",
|
|
151
|
-
component: "AccordionItem",
|
|
152
|
-
styles: o,
|
|
153
|
-
children: [
|
|
154
|
-
n({
|
|
155
|
-
children: [
|
|
156
|
-
{ type: "text", value: "Is it animated?", placeholder: !0 }
|
|
157
|
-
]
|
|
158
|
-
}),
|
|
159
|
-
{
|
|
160
|
-
type: "instance",
|
|
161
|
-
component: "AccordionContent",
|
|
162
|
-
styles: c,
|
|
163
|
-
children: [
|
|
164
|
-
{
|
|
165
|
-
type: "text",
|
|
166
|
-
value: "Yes. It's animated by default, but you can disable it if you prefer.",
|
|
167
|
-
placeholder: !0
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
17
|
]
|
|
176
|
-
},
|
|
177
|
-
category: "hidden",
|
|
18
|
+
}, v = {
|
|
178
19
|
type: "container",
|
|
179
20
|
label: "Item",
|
|
180
|
-
icon:
|
|
21
|
+
icon: e,
|
|
181
22
|
constraints: [
|
|
182
23
|
{
|
|
183
24
|
relation: "ancestor",
|
|
@@ -193,12 +34,11 @@ const r = {
|
|
|
193
34
|
}
|
|
194
35
|
],
|
|
195
36
|
indexWithinAncestor: "Accordion",
|
|
196
|
-
presetStyle:
|
|
197
|
-
},
|
|
198
|
-
category: "hidden",
|
|
37
|
+
presetStyle: o
|
|
38
|
+
}, H = {
|
|
199
39
|
type: "container",
|
|
200
40
|
label: "Item Header",
|
|
201
|
-
icon:
|
|
41
|
+
icon: n,
|
|
202
42
|
constraints: [
|
|
203
43
|
{
|
|
204
44
|
relation: "ancestor",
|
|
@@ -210,19 +50,28 @@ const r = {
|
|
|
210
50
|
}
|
|
211
51
|
],
|
|
212
52
|
presetStyle: {
|
|
213
|
-
h3: [
|
|
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
|
+
]
|
|
214
64
|
}
|
|
215
|
-
},
|
|
216
|
-
category: "hidden",
|
|
65
|
+
}, T = {
|
|
217
66
|
type: "container",
|
|
218
67
|
label: "Item Trigger",
|
|
219
|
-
icon:
|
|
68
|
+
icon: r,
|
|
220
69
|
constraints: {
|
|
221
70
|
relation: "ancestor",
|
|
222
71
|
component: { $eq: "AccordionHeader" }
|
|
223
72
|
},
|
|
224
73
|
states: [
|
|
225
|
-
...
|
|
74
|
+
...i,
|
|
226
75
|
{
|
|
227
76
|
category: "component-states",
|
|
228
77
|
label: "Open",
|
|
@@ -230,40 +79,39 @@ const r = {
|
|
|
230
79
|
}
|
|
231
80
|
],
|
|
232
81
|
presetStyle: {
|
|
233
|
-
button: [
|
|
82
|
+
button: [p, d].flat()
|
|
234
83
|
}
|
|
235
|
-
},
|
|
236
|
-
category: "hidden",
|
|
84
|
+
}, C = {
|
|
237
85
|
type: "container",
|
|
238
86
|
label: "Item Content",
|
|
239
|
-
icon:
|
|
87
|
+
icon: c,
|
|
240
88
|
constraints: {
|
|
241
89
|
relation: "ancestor",
|
|
242
90
|
component: { $eq: "AccordionItem" }
|
|
243
91
|
},
|
|
244
|
-
presetStyle:
|
|
245
|
-
},
|
|
246
|
-
props:
|
|
92
|
+
presetStyle: o
|
|
93
|
+
}, M = {
|
|
94
|
+
props: m,
|
|
247
95
|
initialProps: ["value", "collapsible"]
|
|
248
|
-
},
|
|
249
|
-
props:
|
|
96
|
+
}, x = {
|
|
97
|
+
props: l,
|
|
250
98
|
initialProps: ["value"]
|
|
251
|
-
},
|
|
252
|
-
props:
|
|
253
|
-
},
|
|
254
|
-
props:
|
|
255
|
-
},
|
|
256
|
-
props:
|
|
99
|
+
}, S = {
|
|
100
|
+
props: A
|
|
101
|
+
}, h = {
|
|
102
|
+
props: I
|
|
103
|
+
}, P = {
|
|
104
|
+
props: g
|
|
257
105
|
};
|
|
258
106
|
export {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
|
269
117
|
};
|
|
@@ -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
|
+
};
|
package/lib/checkbox.ws.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { CheckboxCheckedIcon as
|
|
2
|
-
import { defaultStates as
|
|
3
|
-
import { button as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const V = {
|
|
8
|
-
category: "radix",
|
|
9
|
-
order: 101,
|
|
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 = {
|
|
10
7
|
type: "container",
|
|
11
8
|
constraints: {
|
|
12
9
|
relation: "descendant",
|
|
13
10
|
component: { $eq: "CheckboxIndicator" }
|
|
14
11
|
},
|
|
15
|
-
icon:
|
|
16
|
-
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.",
|
|
12
|
+
icon: t,
|
|
17
13
|
states: [
|
|
18
|
-
...
|
|
14
|
+
...e,
|
|
19
15
|
{
|
|
20
16
|
label: "Checked",
|
|
21
17
|
selector: "[data-state=checked]",
|
|
@@ -28,121 +24,28 @@ const V = {
|
|
|
28
24
|
}
|
|
29
25
|
],
|
|
30
26
|
presetStyle: {
|
|
31
|
-
button: [
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
type: "instance",
|
|
36
|
-
component: "Label",
|
|
37
|
-
label: "Checkbox Field",
|
|
38
|
-
styles: [e(), l(2), t("center")].flat(),
|
|
39
|
-
children: [
|
|
40
|
-
{
|
|
41
|
-
type: "instance",
|
|
42
|
-
component: "Checkbox",
|
|
43
|
-
variables: {
|
|
44
|
-
checkboxChecked: { initialValue: !1 }
|
|
45
|
-
},
|
|
46
|
-
props: [
|
|
47
|
-
{
|
|
48
|
-
name: "checked",
|
|
49
|
-
type: "expression",
|
|
50
|
-
code: "checkboxChecked"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "onCheckedChange",
|
|
54
|
-
type: "action",
|
|
55
|
-
value: [
|
|
56
|
-
{
|
|
57
|
-
type: "execute",
|
|
58
|
-
args: ["checked"],
|
|
59
|
-
code: "checkboxChecked = checked"
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
// peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background
|
|
65
|
-
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
66
|
-
// disabled:cursor-not-allowed disabled:opacity-50
|
|
67
|
-
// data-[state=checked]:bg-primary
|
|
68
|
-
// data-[state=checked]:text-primary-foreground",
|
|
69
|
-
styles: [
|
|
70
|
-
// We are not supporting peer like styles yet
|
|
71
|
-
d(4),
|
|
72
|
-
h(4),
|
|
73
|
-
k(0),
|
|
74
|
-
m("sm"),
|
|
75
|
-
o(),
|
|
76
|
-
o("primary"),
|
|
77
|
-
b(
|
|
78
|
-
[y(), u("ring", 2, "background", 2)].flat()
|
|
79
|
-
),
|
|
80
|
-
x([C("not-allowed"), g(50)].flat()),
|
|
81
|
-
f(
|
|
82
|
-
[I("primary"), c("primaryForeground")].flat(),
|
|
83
|
-
"[data-state=checked]"
|
|
84
|
-
)
|
|
85
|
-
].flat(),
|
|
86
|
-
children: [
|
|
87
|
-
{
|
|
88
|
-
type: "instance",
|
|
89
|
-
component: "CheckboxIndicator",
|
|
90
|
-
// flex items-center justify-center text-current
|
|
91
|
-
styles: [
|
|
92
|
-
e(),
|
|
93
|
-
t("center"),
|
|
94
|
-
v("center"),
|
|
95
|
-
c("current")
|
|
96
|
-
].flat(),
|
|
97
|
-
children: [
|
|
98
|
-
{
|
|
99
|
-
type: "instance",
|
|
100
|
-
component: "HtmlEmbed",
|
|
101
|
-
label: "Indicator Icon",
|
|
102
|
-
props: [
|
|
103
|
-
{
|
|
104
|
-
type: "string",
|
|
105
|
-
name: "code",
|
|
106
|
-
value: r
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
children: []
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: "instance",
|
|
117
|
-
component: "Text",
|
|
118
|
-
label: "Checkbox Label",
|
|
119
|
-
props: [{ name: "tag", type: "string", value: "span" }],
|
|
120
|
-
children: [{ type: "text", value: "Checkbox", placeholder: !0 }]
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}, $ = {
|
|
126
|
-
category: "hidden",
|
|
27
|
+
button: [c, a].flat()
|
|
28
|
+
}
|
|
29
|
+
}, l = {
|
|
127
30
|
type: "container",
|
|
128
31
|
constraints: {
|
|
129
32
|
relation: "ancestor",
|
|
130
33
|
component: { $eq: "Checkbox" }
|
|
131
34
|
},
|
|
132
|
-
icon:
|
|
133
|
-
states:
|
|
35
|
+
icon: o,
|
|
36
|
+
states: e,
|
|
134
37
|
presetStyle: {
|
|
135
|
-
span:
|
|
38
|
+
span: n
|
|
136
39
|
}
|
|
137
|
-
},
|
|
138
|
-
props:
|
|
40
|
+
}, b = {
|
|
41
|
+
props: r,
|
|
139
42
|
initialProps: ["id", "className", "name", "value", "required", "checked"]
|
|
140
|
-
},
|
|
141
|
-
props:
|
|
43
|
+
}, C = {
|
|
44
|
+
props: s
|
|
142
45
|
};
|
|
143
46
|
export {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
47
|
+
k as metaCheckbox,
|
|
48
|
+
l as metaCheckboxIndicator,
|
|
49
|
+
b as propsMetaCheckbox,
|
|
50
|
+
C as propsMetaCheckboxIndicator
|
|
148
51
|
};
|
|
@@ -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
|
+
};
|