@webstudio-is/sdk-components-react-radix 0.87.1 → 0.89.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 +605 -114
- package/lib/__generated__/button.props.js +158 -47
- package/lib/__generated__/checkbox.props.js +1083 -0
- package/lib/__generated__/collapsible.props.js +234 -44
- package/lib/__generated__/dialog.props.js +611 -121
- package/lib/__generated__/input.props.js +264 -47
- package/lib/__generated__/label.props.js +123 -23
- package/lib/__generated__/navigation-menu.props.js +2565 -0
- package/lib/__generated__/popover.props.js +129 -28
- package/lib/__generated__/radio-group.props.js +1627 -0
- package/lib/__generated__/select.props.js +3678 -0
- package/lib/__generated__/sheet.props.js +591 -121
- package/lib/__generated__/switch.props.js +1083 -0
- package/lib/__generated__/tabs.props.js +906 -68
- package/lib/__generated__/textarea.props.js +177 -31
- package/lib/__generated__/tooltip.props.js +131 -29
- package/lib/accordion.js +11 -4
- package/lib/accordion.ws.js +88 -72
- package/lib/checkbox.js +13 -0
- package/lib/checkbox.ws.js +153 -0
- package/lib/cjs/__generated__/accordion.props.js +605 -114
- package/lib/cjs/__generated__/button.props.js +158 -47
- package/lib/cjs/__generated__/checkbox.props.js +1103 -0
- package/lib/cjs/__generated__/collapsible.props.js +234 -44
- package/lib/cjs/__generated__/dialog.props.js +611 -121
- package/lib/cjs/__generated__/input.props.js +264 -47
- package/lib/cjs/__generated__/label.props.js +123 -23
- package/lib/cjs/__generated__/navigation-menu.props.js +2585 -0
- package/lib/cjs/__generated__/popover.props.js +129 -28
- package/lib/cjs/__generated__/radio-group.props.js +1647 -0
- package/lib/cjs/__generated__/select.props.js +3698 -0
- package/lib/cjs/__generated__/sheet.props.js +591 -121
- package/lib/cjs/__generated__/switch.props.js +1103 -0
- package/lib/cjs/__generated__/tabs.props.js +906 -68
- package/lib/cjs/__generated__/textarea.props.js +177 -31
- package/lib/cjs/__generated__/tooltip.props.js +131 -29
- package/lib/cjs/accordion.js +11 -4
- package/lib/cjs/accordion.ws.js +86 -71
- package/lib/cjs/{textarea.js → checkbox.js} +9 -6
- package/lib/cjs/checkbox.ws.js +174 -0
- package/lib/cjs/collapsible.ws.js +5 -1
- package/lib/cjs/components.js +27 -14
- package/lib/cjs/dialog.ws.js +18 -17
- package/lib/cjs/hooks.js +5 -1
- package/lib/cjs/label.ws.js +2 -1
- package/lib/cjs/metas.js +29 -14
- package/lib/cjs/navigation-menu.js +107 -0
- package/lib/cjs/navigation-menu.ws.js +514 -0
- package/lib/cjs/popover.ws.js +13 -9
- package/lib/cjs/props-descriptions.js +56 -0
- package/lib/cjs/props.js +27 -14
- package/lib/cjs/{button.js → radio-group.js} +10 -8
- package/lib/cjs/radio-group.ws.js +191 -0
- package/lib/cjs/select.js +83 -0
- package/lib/cjs/select.ws.js +350 -0
- package/lib/cjs/sheet.ws.js +88 -176
- package/lib/cjs/{input.js → switch.js} +8 -9
- package/lib/cjs/switch.ws.js +173 -0
- package/lib/cjs/tabs.js +2 -3
- package/lib/cjs/tabs.ws.js +14 -18
- package/lib/cjs/theme/styles.js +100 -0
- package/lib/cjs/theme/tailwind-classes.js +125 -16
- package/lib/cjs/theme/tailwind-colors.js +1 -0
- package/lib/cjs/tooltip.ws.js +12 -8
- package/lib/collapsible.ws.js +5 -1
- package/lib/components.js +44 -22
- package/lib/dialog.ws.js +18 -17
- package/lib/hooks.js +5 -1
- package/lib/label.ws.js +2 -1
- package/lib/metas.js +58 -24
- package/lib/navigation-menu.js +85 -0
- package/lib/navigation-menu.ws.js +501 -0
- package/lib/popover.ws.js +13 -9
- package/lib/props-descriptions.js +36 -0
- package/lib/props.js +56 -24
- package/lib/radio-group.js +11 -0
- package/lib/radio-group.ws.js +173 -0
- package/lib/select.js +75 -0
- package/lib/select.ws.js +338 -0
- package/lib/sheet.ws.js +89 -194
- package/lib/switch.js +7 -0
- package/lib/switch.ws.js +145 -0
- package/lib/tabs.js +3 -5
- package/lib/tabs.ws.js +15 -19
- package/lib/theme/styles.js +70 -0
- package/lib/theme/tailwind-classes.js +125 -16
- package/lib/theme/tailwind-colors.js +1 -0
- package/lib/tooltip.ws.js +12 -8
- package/lib/types/__generated__/checkbox.props.d.ts +3 -0
- package/lib/types/__generated__/navigation-menu.props.d.ts +8 -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/checkbox.d.ts +6 -0
- package/lib/types/checkbox.stories.d.ts +11 -0
- package/lib/types/checkbox.ws.d.ts +5 -0
- package/lib/types/components.d.ts +5 -4
- package/lib/types/metas.d.ts +6 -4
- package/lib/types/navigation-menu.d.ts +15 -0
- package/lib/types/navigation-menu.ws.d.ts +15 -0
- package/lib/types/props-descriptions.d.ts +29 -0
- package/lib/types/props.d.ts +5 -4
- package/lib/types/radio-group.d.ts +5 -0
- package/lib/types/radio-group.stories.d.ts +9 -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.ws.d.ts +2 -15
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.stories.d.ts +9 -0
- package/lib/types/switch.ws.d.ts +5 -0
- package/lib/types/tabs.d.ts +3 -12
- package/lib/types/theme/radix-common-types.d.ts +3 -2
- package/lib/types/theme/styles.d.ts +215 -0
- package/lib/types/theme/tailwind-classes.d.ts +16 -6
- package/lib/types/theme/tailwind-colors.d.ts +1 -0
- package/lib/types/theme/tailwind-theme.d.ts +1 -1
- package/package.json +12 -7
- package/src/__generated__/accordion.props.ts +675 -108
- package/src/__generated__/button.props.ts +177 -45
- package/src/__generated__/checkbox.props.ts +1217 -0
- package/src/__generated__/collapsible.props.ts +261 -42
- package/src/__generated__/dialog.props.ts +682 -115
- package/src/__generated__/input.props.ts +292 -44
- package/src/__generated__/label.props.ts +137 -22
- package/src/__generated__/navigation-menu.props.ts +2882 -0
- package/src/__generated__/popover.props.ts +142 -24
- package/src/__generated__/radio-group.props.ts +1828 -0
- package/src/__generated__/select.props.ts +4130 -0
- package/src/__generated__/sheet.props.ts +657 -110
- package/src/__generated__/switch.props.ts +1217 -0
- package/src/__generated__/tabs.props.ts +1019 -67
- package/src/__generated__/textarea.props.ts +195 -30
- package/src/__generated__/tooltip.props.ts +145 -25
- package/src/accordion.tsx +14 -7
- package/src/accordion.ws.ts +87 -70
- package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
- package/src/checkbox.tsx +22 -0
- package/src/checkbox.ws.ts +154 -0
- package/src/collapsible.ws.ts +6 -1
- package/src/components.ts +25 -12
- package/src/dialog.ws.tsx +17 -16
- package/src/hooks.ts +4 -0
- package/src/label.ws.ts +3 -1
- package/src/metas.ts +36 -12
- package/src/navigation-menu.stories.tsx +21 -0
- package/src/navigation-menu.tsx +130 -0
- package/src/navigation-menu.ws.ts +524 -0
- package/src/popover.ws.tsx +13 -9
- package/src/props-descriptions.ts +43 -0
- package/src/props.ts +35 -12
- package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
- package/src/radio-group.tsx +17 -0
- package/src/radio-group.ws.ts +178 -0
- package/src/select.stories.tsx +21 -0
- package/src/select.tsx +112 -0
- package/src/select.ws.ts +349 -0
- package/src/sheet.ws.tsx +91 -209
- package/src/{button.stories.ts → switch.stories.ts} +6 -19
- package/src/switch.tsx +10 -0
- package/src/switch.ws.ts +146 -0
- package/src/tabs.tsx +4 -17
- package/src/tabs.ws.ts +19 -19
- package/src/theme/radix-common-types.ts +3 -2
- package/src/theme/styles.ts +80 -0
- package/src/theme/tailwind-classes.ts +150 -14
- package/src/theme/tailwind-colors.ts +1 -0
- package/src/tooltip.ws.tsx +13 -8
- package/lib/button.js +0 -8
- package/lib/button.ws.js +0 -133
- package/lib/cjs/button.ws.js +0 -160
- package/lib/cjs/input.ws.js +0 -103
- package/lib/cjs/textarea.ws.js +0 -98
- package/lib/input.js +0 -8
- package/lib/input.ws.js +0 -75
- package/lib/textarea.js +0 -8
- package/lib/textarea.ws.js +0 -70
- package/lib/types/button.d.ts +0 -7
- package/lib/types/button.stories.d.ts +0 -20
- package/lib/types/button.ws.d.ts +0 -7
- package/lib/types/input.d.ts +0 -2
- package/lib/types/input.stories.d.ts +0 -20
- package/lib/types/input.ws.d.ts +0 -3
- package/lib/types/textarea.d.ts +0 -2
- package/lib/types/textarea.stories.d.ts +0 -14
- package/lib/types/textarea.ws.d.ts +0 -3
- package/src/button.tsx +0 -25
- package/src/button.ws.ts +0 -155
- package/src/input.tsx +0 -12
- package/src/input.ws.ts +0 -78
- package/src/textarea.tsx +0 -12
- package/src/textarea.ws.ts +0 -74
package/lib/accordion.ws.js
CHANGED
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
ItemIcon,
|
|
4
4
|
HeaderIcon,
|
|
5
5
|
TriggerIcon,
|
|
6
|
-
ContentIcon
|
|
6
|
+
ContentIcon,
|
|
7
|
+
ChevronDownIcon
|
|
7
8
|
} from "@webstudio-is/icons/svg";
|
|
8
9
|
import { div, h3, button } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
10
|
import * as tc from "./theme/tailwind-classes";
|
|
11
|
+
import { buttonReset } from "./theme/styles";
|
|
10
12
|
import {
|
|
11
13
|
propsAccordion,
|
|
12
14
|
propsAccordionItem,
|
|
@@ -18,17 +20,71 @@ const presetStyle = {
|
|
|
18
20
|
div
|
|
19
21
|
};
|
|
20
22
|
const accordionItemStyles = [tc.borderB()].flat();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tc.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const createAccordionTrigger = ({
|
|
24
|
+
children
|
|
25
|
+
}) => ({
|
|
26
|
+
type: "instance",
|
|
27
|
+
component: "AccordionHeader",
|
|
28
|
+
// flex
|
|
29
|
+
styles: [tc.flex()].flat(),
|
|
30
|
+
children: [
|
|
31
|
+
{
|
|
32
|
+
type: "instance",
|
|
33
|
+
component: "AccordionTrigger",
|
|
34
|
+
// flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180
|
|
35
|
+
styles: [
|
|
36
|
+
tc.flex(),
|
|
37
|
+
tc.flex(1),
|
|
38
|
+
tc.items("center"),
|
|
39
|
+
tc.justify("between"),
|
|
40
|
+
tc.py(4),
|
|
41
|
+
tc.font("medium"),
|
|
42
|
+
tc.hover([tc.underline()].flat()),
|
|
43
|
+
tc.property("--accordion-trigger-icon-transform", "0deg"),
|
|
44
|
+
tc.state(
|
|
45
|
+
[tc.property("--accordion-trigger-icon-transform", "180deg")],
|
|
46
|
+
"[data-state=open]"
|
|
47
|
+
)
|
|
48
|
+
].flat(),
|
|
49
|
+
children: [
|
|
50
|
+
{
|
|
51
|
+
type: "instance",
|
|
52
|
+
component: "Text",
|
|
53
|
+
children
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "instance",
|
|
57
|
+
component: "Box",
|
|
58
|
+
label: "Icon Container",
|
|
59
|
+
// h-4 w-4 shrink-0 transition-transform duration-200
|
|
60
|
+
styles: [
|
|
61
|
+
tc.property("rotate", "--accordion-trigger-icon-transform"),
|
|
62
|
+
tc.h(4),
|
|
63
|
+
tc.w(4),
|
|
64
|
+
tc.shrink(0),
|
|
65
|
+
tc.transition("all"),
|
|
66
|
+
tc.duration(200)
|
|
67
|
+
].flat(),
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
type: "instance",
|
|
71
|
+
component: "HtmlEmbed",
|
|
72
|
+
label: "Chevron Icon",
|
|
73
|
+
props: [
|
|
74
|
+
{
|
|
75
|
+
type: "string",
|
|
76
|
+
name: "code",
|
|
77
|
+
value: ChevronDownIcon
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
children: []
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
});
|
|
32
88
|
const accordionContentStyles = [
|
|
33
89
|
tc.overflow("hidden"),
|
|
34
90
|
tc.text("sm"),
|
|
@@ -38,9 +94,11 @@ const accordionContentStyles = [
|
|
|
38
94
|
].flat();
|
|
39
95
|
const metaAccordion = {
|
|
40
96
|
category: "radix",
|
|
97
|
+
order: 3,
|
|
41
98
|
type: "container",
|
|
42
99
|
icon: AccordionIcon,
|
|
43
100
|
presetStyle,
|
|
101
|
+
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.",
|
|
44
102
|
template: [
|
|
45
103
|
{
|
|
46
104
|
type: "instance",
|
|
@@ -69,19 +127,9 @@ const metaAccordion = {
|
|
|
69
127
|
component: "AccordionItem",
|
|
70
128
|
styles: accordionItemStyles,
|
|
71
129
|
children: [
|
|
72
|
-
{
|
|
73
|
-
type: "
|
|
74
|
-
|
|
75
|
-
styles: accordionHeaderStyles,
|
|
76
|
-
children: [
|
|
77
|
-
{
|
|
78
|
-
type: "instance",
|
|
79
|
-
component: "AccordionTrigger",
|
|
80
|
-
styles: accordionTriggerStyles,
|
|
81
|
-
children: [{ type: "text", value: "Is it accessible?" }]
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
},
|
|
130
|
+
createAccordionTrigger({
|
|
131
|
+
children: [{ type: "text", value: "Is it accessible?" }]
|
|
132
|
+
}),
|
|
85
133
|
{
|
|
86
134
|
type: "instance",
|
|
87
135
|
component: "AccordionContent",
|
|
@@ -100,19 +148,9 @@ const metaAccordion = {
|
|
|
100
148
|
component: "AccordionItem",
|
|
101
149
|
styles: accordionItemStyles,
|
|
102
150
|
children: [
|
|
103
|
-
{
|
|
104
|
-
type: "
|
|
105
|
-
|
|
106
|
-
styles: accordionHeaderStyles,
|
|
107
|
-
children: [
|
|
108
|
-
{
|
|
109
|
-
type: "instance",
|
|
110
|
-
component: "AccordionTrigger",
|
|
111
|
-
styles: accordionTriggerStyles,
|
|
112
|
-
children: [{ type: "text", value: "Is it styled?" }]
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
},
|
|
151
|
+
createAccordionTrigger({
|
|
152
|
+
children: [{ type: "text", value: "Is it styled?" }]
|
|
153
|
+
}),
|
|
116
154
|
{
|
|
117
155
|
type: "instance",
|
|
118
156
|
component: "AccordionContent",
|
|
@@ -131,19 +169,9 @@ const metaAccordion = {
|
|
|
131
169
|
component: "AccordionItem",
|
|
132
170
|
styles: accordionItemStyles,
|
|
133
171
|
children: [
|
|
134
|
-
{
|
|
135
|
-
type: "
|
|
136
|
-
|
|
137
|
-
styles: accordionHeaderStyles,
|
|
138
|
-
children: [
|
|
139
|
-
{
|
|
140
|
-
type: "instance",
|
|
141
|
-
component: "AccordionTrigger",
|
|
142
|
-
styles: accordionTriggerStyles,
|
|
143
|
-
children: [{ type: "text", value: "Is it animated?" }]
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
},
|
|
172
|
+
createAccordionTrigger({
|
|
173
|
+
children: [{ type: "text", value: "Is it animated?" }]
|
|
174
|
+
}),
|
|
147
175
|
{
|
|
148
176
|
type: "instance",
|
|
149
177
|
component: "AccordionContent",
|
|
@@ -167,7 +195,8 @@ const metaAccordionItem = {
|
|
|
167
195
|
icon: ItemIcon,
|
|
168
196
|
requiredAncestors: ["Accordion"],
|
|
169
197
|
indexWithinAncestor: "Accordion",
|
|
170
|
-
presetStyle
|
|
198
|
+
presetStyle,
|
|
199
|
+
label: "Item"
|
|
171
200
|
};
|
|
172
201
|
const metaAccordionHeader = {
|
|
173
202
|
category: "hidden",
|
|
@@ -177,7 +206,8 @@ const metaAccordionHeader = {
|
|
|
177
206
|
detachable: false,
|
|
178
207
|
presetStyle: {
|
|
179
208
|
h3: [h3, tc.my(0)].flat()
|
|
180
|
-
}
|
|
209
|
+
},
|
|
210
|
+
label: "Item Header"
|
|
181
211
|
};
|
|
182
212
|
const metaAccordionTrigger = {
|
|
183
213
|
category: "hidden",
|
|
@@ -186,24 +216,9 @@ const metaAccordionTrigger = {
|
|
|
186
216
|
requiredAncestors: ["AccordionHeader"],
|
|
187
217
|
detachable: false,
|
|
188
218
|
presetStyle: {
|
|
189
|
-
button: [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
property: "backgroundColor",
|
|
193
|
-
value: { type: "keyword", value: "transparent" }
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
property: "backgroundImage",
|
|
197
|
-
value: { type: "keyword", value: "none" }
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
property: "cursor",
|
|
201
|
-
value: { type: "keyword", value: "pointer" }
|
|
202
|
-
},
|
|
203
|
-
tc.px(0),
|
|
204
|
-
tc.border(0)
|
|
205
|
-
].flat()
|
|
206
|
-
}
|
|
219
|
+
button: [button, buttonReset].flat()
|
|
220
|
+
},
|
|
221
|
+
label: "Item Trigger"
|
|
207
222
|
};
|
|
208
223
|
const metaAccordionContent = {
|
|
209
224
|
category: "hidden",
|
|
@@ -211,7 +226,8 @@ const metaAccordionContent = {
|
|
|
211
226
|
icon: ContentIcon,
|
|
212
227
|
requiredAncestors: ["AccordionItem"],
|
|
213
228
|
detachable: false,
|
|
214
|
-
presetStyle
|
|
229
|
+
presetStyle,
|
|
230
|
+
label: "Item Content"
|
|
215
231
|
};
|
|
216
232
|
const propsMetaAccordion = {
|
|
217
233
|
props: propsAccordion,
|
package/lib/checkbox.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import { Root, Indicator } from "@radix-ui/react-checkbox";
|
|
6
|
+
const Checkbox = forwardRef((props, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Root, { ref, ...props });
|
|
8
|
+
});
|
|
9
|
+
const CheckboxIndicator = Indicator;
|
|
10
|
+
export {
|
|
11
|
+
Checkbox,
|
|
12
|
+
CheckboxIndicator
|
|
13
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckMarkIcon,
|
|
3
|
+
CheckboxCheckedIcon,
|
|
4
|
+
TriggerIcon
|
|
5
|
+
} from "@webstudio-is/icons/svg";
|
|
6
|
+
import {
|
|
7
|
+
defaultStates
|
|
8
|
+
} from "@webstudio-is/react-sdk";
|
|
9
|
+
import { button, span } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
+
import * as tc from "./theme/tailwind-classes";
|
|
11
|
+
import { buttonReset } from "./theme/styles";
|
|
12
|
+
import {
|
|
13
|
+
propsCheckbox,
|
|
14
|
+
propsCheckboxIndicator
|
|
15
|
+
} from "./__generated__/checkbox.props";
|
|
16
|
+
const metaCheckbox = {
|
|
17
|
+
category: "radix",
|
|
18
|
+
order: 101,
|
|
19
|
+
type: "container",
|
|
20
|
+
icon: CheckboxCheckedIcon,
|
|
21
|
+
description: "Use within a form to allow your users to toggle between checked and not checked. Group checkboxes by matching their \u201CName\u201D properties. Unlike radios, any number of checkboxes in a group can be checked.",
|
|
22
|
+
states: [
|
|
23
|
+
...defaultStates,
|
|
24
|
+
{
|
|
25
|
+
label: "Checked",
|
|
26
|
+
selector: "[data-state=checked]",
|
|
27
|
+
category: "component-states"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Unchecked",
|
|
31
|
+
selector: "[data-state=unchecked]",
|
|
32
|
+
category: "component-states"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
presetStyle: {
|
|
36
|
+
button: [button, buttonReset].flat()
|
|
37
|
+
},
|
|
38
|
+
template: [
|
|
39
|
+
{
|
|
40
|
+
type: "instance",
|
|
41
|
+
component: "Label",
|
|
42
|
+
label: "Checkbox Field",
|
|
43
|
+
styles: [tc.flex(), tc.gap(2), tc.items("center")].flat(),
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
type: "instance",
|
|
47
|
+
component: "Checkbox",
|
|
48
|
+
dataSources: {
|
|
49
|
+
checkboxChecked: { type: "variable", initialValue: false }
|
|
50
|
+
},
|
|
51
|
+
props: [
|
|
52
|
+
{
|
|
53
|
+
name: "checked",
|
|
54
|
+
type: "dataSource",
|
|
55
|
+
dataSourceName: "checkboxChecked"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "onCheckedChange",
|
|
59
|
+
type: "action",
|
|
60
|
+
value: [
|
|
61
|
+
{
|
|
62
|
+
type: "execute",
|
|
63
|
+
args: ["checked"],
|
|
64
|
+
code: `checkboxChecked = checked`
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
// peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background
|
|
70
|
+
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
71
|
+
// disabled:cursor-not-allowed disabled:opacity-50
|
|
72
|
+
// data-[state=checked]:bg-primary
|
|
73
|
+
// data-[state=checked]:text-primary-foreground",
|
|
74
|
+
styles: [
|
|
75
|
+
// We are not supporting peer like styles yet
|
|
76
|
+
tc.h(4),
|
|
77
|
+
tc.w(4),
|
|
78
|
+
tc.shrink(0),
|
|
79
|
+
tc.rounded("sm"),
|
|
80
|
+
tc.border(),
|
|
81
|
+
tc.border("primary"),
|
|
82
|
+
tc.focusVisible(
|
|
83
|
+
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
84
|
+
),
|
|
85
|
+
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
|
|
86
|
+
tc.state(
|
|
87
|
+
[tc.bg("primary"), tc.text("primaryForeground")].flat(),
|
|
88
|
+
"[data-state=checked]"
|
|
89
|
+
)
|
|
90
|
+
].flat(),
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
type: "instance",
|
|
94
|
+
component: "CheckboxIndicator",
|
|
95
|
+
// flex items-center justify-center text-current
|
|
96
|
+
styles: [
|
|
97
|
+
tc.flex(),
|
|
98
|
+
tc.items("center"),
|
|
99
|
+
tc.justify("center"),
|
|
100
|
+
tc.text("current")
|
|
101
|
+
].flat(),
|
|
102
|
+
children: [
|
|
103
|
+
{
|
|
104
|
+
type: "instance",
|
|
105
|
+
component: "HtmlEmbed",
|
|
106
|
+
label: "Indicator Icon",
|
|
107
|
+
props: [
|
|
108
|
+
{
|
|
109
|
+
type: "string",
|
|
110
|
+
name: "code",
|
|
111
|
+
value: CheckMarkIcon
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
children: []
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "instance",
|
|
122
|
+
component: "Text",
|
|
123
|
+
label: "Checkbox Label",
|
|
124
|
+
props: [{ name: "tag", type: "string", value: "span" }],
|
|
125
|
+
children: [{ type: "text", value: "Checkbox" }]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
const metaCheckboxIndicator = {
|
|
132
|
+
category: "hidden",
|
|
133
|
+
type: "container",
|
|
134
|
+
detachable: false,
|
|
135
|
+
icon: TriggerIcon,
|
|
136
|
+
states: defaultStates,
|
|
137
|
+
presetStyle: {
|
|
138
|
+
span
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const propsMetaCheckbox = {
|
|
142
|
+
props: propsCheckbox,
|
|
143
|
+
initialProps: ["id", "checked", "name", "required"]
|
|
144
|
+
};
|
|
145
|
+
const propsMetaCheckboxIndicator = {
|
|
146
|
+
props: propsCheckboxIndicator
|
|
147
|
+
};
|
|
148
|
+
export {
|
|
149
|
+
metaCheckbox,
|
|
150
|
+
metaCheckboxIndicator,
|
|
151
|
+
propsMetaCheckbox,
|
|
152
|
+
propsMetaCheckboxIndicator
|
|
153
|
+
};
|