@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/select.ws.js
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectIcon,
|
|
3
|
+
TriggerIcon,
|
|
4
|
+
FormTextFieldIcon,
|
|
5
|
+
ContentIcon,
|
|
6
|
+
ItemIcon,
|
|
7
|
+
ViewportIcon,
|
|
8
|
+
TextIcon,
|
|
9
|
+
CheckMarkIcon
|
|
10
|
+
} from "@webstudio-is/icons/svg";
|
|
11
|
+
import { button, div, span } from "@webstudio-is/react-sdk/css-normalize";
|
|
12
|
+
import * as tc from "./theme/tailwind-classes";
|
|
13
|
+
import {
|
|
14
|
+
propsSelect,
|
|
15
|
+
propsSelectContent,
|
|
16
|
+
propsSelectItem,
|
|
17
|
+
propsSelectItemIndicator,
|
|
18
|
+
propsSelectItemText,
|
|
19
|
+
propsSelectTrigger,
|
|
20
|
+
propsSelectValue,
|
|
21
|
+
propsSelectViewport
|
|
22
|
+
} from "./__generated__/select.props";
|
|
23
|
+
const presetStyle = {
|
|
24
|
+
div
|
|
25
|
+
};
|
|
26
|
+
const createSelectItem = ({
|
|
27
|
+
props,
|
|
28
|
+
children
|
|
29
|
+
}) => ({
|
|
30
|
+
type: "instance",
|
|
31
|
+
component: "SelectItem",
|
|
32
|
+
props,
|
|
33
|
+
// relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none
|
|
34
|
+
// focus:bg-accent focus:text-accent-foreground
|
|
35
|
+
// data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
|
36
|
+
styles: [
|
|
37
|
+
tc.relative(),
|
|
38
|
+
tc.flex(),
|
|
39
|
+
tc.w("full"),
|
|
40
|
+
tc.cursor("default"),
|
|
41
|
+
tc.select("none"),
|
|
42
|
+
tc.items("center"),
|
|
43
|
+
tc.rounded("md"),
|
|
44
|
+
tc.py(1.5),
|
|
45
|
+
tc.pl(8),
|
|
46
|
+
tc.pr(2),
|
|
47
|
+
tc.text("sm"),
|
|
48
|
+
tc.outline("none"),
|
|
49
|
+
tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat()),
|
|
50
|
+
tc.state(
|
|
51
|
+
[tc.pointerEvents("none"), tc.opacity(50)].flat(),
|
|
52
|
+
"[data-disabled]"
|
|
53
|
+
)
|
|
54
|
+
].flat(),
|
|
55
|
+
children: [
|
|
56
|
+
{
|
|
57
|
+
type: "instance",
|
|
58
|
+
component: "SelectItemIndicator",
|
|
59
|
+
// absolute left-2 flex h-3.5 w-3.5 items-center justify-center
|
|
60
|
+
styles: [
|
|
61
|
+
tc.absolute(),
|
|
62
|
+
tc.left(2),
|
|
63
|
+
tc.flex(),
|
|
64
|
+
tc.h(3.5),
|
|
65
|
+
tc.w(3.5),
|
|
66
|
+
tc.items("center"),
|
|
67
|
+
tc.justify("center")
|
|
68
|
+
].flat(),
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
type: "instance",
|
|
72
|
+
component: "HtmlEmbed",
|
|
73
|
+
label: "Indicator Icon",
|
|
74
|
+
props: [
|
|
75
|
+
{
|
|
76
|
+
type: "string",
|
|
77
|
+
name: "code",
|
|
78
|
+
value: CheckMarkIcon
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
children: []
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "instance",
|
|
87
|
+
component: "SelectItemText",
|
|
88
|
+
children
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
const metaSelect = {
|
|
93
|
+
category: "radix",
|
|
94
|
+
order: 10,
|
|
95
|
+
type: "container",
|
|
96
|
+
icon: SelectIcon,
|
|
97
|
+
stylable: false,
|
|
98
|
+
description: "Use within a form to give your users a list of options to choose from.",
|
|
99
|
+
template: [
|
|
100
|
+
{
|
|
101
|
+
type: "instance",
|
|
102
|
+
component: "Select",
|
|
103
|
+
dataSources: {
|
|
104
|
+
selectValue: { type: "variable", initialValue: "" },
|
|
105
|
+
selectOpen: { type: "variable", initialValue: false }
|
|
106
|
+
},
|
|
107
|
+
props: [
|
|
108
|
+
{
|
|
109
|
+
name: "value",
|
|
110
|
+
type: "dataSource",
|
|
111
|
+
dataSourceName: "selectValue"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "onValueChange",
|
|
115
|
+
type: "action",
|
|
116
|
+
value: [
|
|
117
|
+
{ type: "execute", args: ["value"], code: `selectValue = value` }
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "open",
|
|
122
|
+
type: "dataSource",
|
|
123
|
+
dataSourceName: "selectOpen"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "onOpenChange",
|
|
127
|
+
type: "action",
|
|
128
|
+
value: [
|
|
129
|
+
{ type: "execute", args: ["open"], code: `selectOpen = open` }
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
type: "instance",
|
|
136
|
+
component: "SelectTrigger",
|
|
137
|
+
// 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
|
|
138
|
+
// placeholder:text-muted-foreground
|
|
139
|
+
// focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
140
|
+
// disabled:cursor-not-allowed disabled:opacity-50
|
|
141
|
+
styles: [
|
|
142
|
+
tc.flex(),
|
|
143
|
+
tc.h(10),
|
|
144
|
+
tc.w("full"),
|
|
145
|
+
tc.items("center"),
|
|
146
|
+
tc.justify("between"),
|
|
147
|
+
tc.rounded("md"),
|
|
148
|
+
tc.border(),
|
|
149
|
+
tc.border("input"),
|
|
150
|
+
tc.bg("background"),
|
|
151
|
+
tc.px(3),
|
|
152
|
+
tc.py(2),
|
|
153
|
+
tc.text("sm"),
|
|
154
|
+
tc.state([tc.text("mutedForeground")].flat(), "::placeholder"),
|
|
155
|
+
tc.focus(
|
|
156
|
+
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
157
|
+
),
|
|
158
|
+
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
|
|
159
|
+
].flat(),
|
|
160
|
+
children: [
|
|
161
|
+
{
|
|
162
|
+
type: "instance",
|
|
163
|
+
component: "SelectValue",
|
|
164
|
+
props: [{ name: "placeholder", type: "string", value: "Theme" }],
|
|
165
|
+
children: []
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: "instance",
|
|
171
|
+
component: "SelectContent",
|
|
172
|
+
// relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md
|
|
173
|
+
// data-[state=open]:animate-in
|
|
174
|
+
// data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
175
|
+
// data-[state=open]:fade-in-0
|
|
176
|
+
// data-[state=closed]:zoom-out-95
|
|
177
|
+
// data-[state=open]:zoom-in-95
|
|
178
|
+
// data-[side=bottom]:slide-in-from-top-2
|
|
179
|
+
// data-[side=left]:slide-in-from-right-2
|
|
180
|
+
// data-[side=right]:slide-in-from-left-2
|
|
181
|
+
// data-[side=top]:slide-in-from-bottom-2
|
|
182
|
+
// position=popper
|
|
183
|
+
// data-[side=bottom]:translate-y-1
|
|
184
|
+
// data-[side=left]:-translate-x-1
|
|
185
|
+
// data-[side=right]:translate-x-1
|
|
186
|
+
// data-[side=top]:-translate-y-1
|
|
187
|
+
styles: [
|
|
188
|
+
tc.relative(),
|
|
189
|
+
tc.z(50),
|
|
190
|
+
tc.property("minWidth", "8rem"),
|
|
191
|
+
tc.overflow("hidden"),
|
|
192
|
+
tc.rounded("md"),
|
|
193
|
+
tc.border(),
|
|
194
|
+
tc.bg("popover"),
|
|
195
|
+
tc.text("popoverForeground"),
|
|
196
|
+
tc.shadow("md")
|
|
197
|
+
].flat(),
|
|
198
|
+
children: [
|
|
199
|
+
{
|
|
200
|
+
type: "instance",
|
|
201
|
+
component: "SelectViewport",
|
|
202
|
+
// p-1
|
|
203
|
+
// position=popper
|
|
204
|
+
// h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]
|
|
205
|
+
styles: [
|
|
206
|
+
tc.p(1),
|
|
207
|
+
tc.property("height", "--radix-select-trigger-height"),
|
|
208
|
+
tc.w("full"),
|
|
209
|
+
tc.property("minWidth", "--radix-select-trigger-width")
|
|
210
|
+
].flat(),
|
|
211
|
+
children: [
|
|
212
|
+
createSelectItem({
|
|
213
|
+
props: [{ name: "value", type: "string", value: "light" }],
|
|
214
|
+
children: [{ type: "text", value: "Light" }]
|
|
215
|
+
}),
|
|
216
|
+
createSelectItem({
|
|
217
|
+
props: [{ name: "value", type: "string", value: "dark" }],
|
|
218
|
+
children: [{ type: "text", value: "Dark" }]
|
|
219
|
+
}),
|
|
220
|
+
createSelectItem({
|
|
221
|
+
props: [{ name: "value", type: "string", value: "system" }],
|
|
222
|
+
children: [{ type: "text", value: "System" }]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
};
|
|
232
|
+
const metaSelectTrigger = {
|
|
233
|
+
category: "hidden",
|
|
234
|
+
type: "container",
|
|
235
|
+
icon: TriggerIcon,
|
|
236
|
+
detachable: false,
|
|
237
|
+
presetStyle: {
|
|
238
|
+
button
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const metaSelectValue = {
|
|
242
|
+
category: "hidden",
|
|
243
|
+
type: "container",
|
|
244
|
+
label: "Value",
|
|
245
|
+
icon: FormTextFieldIcon,
|
|
246
|
+
detachable: false,
|
|
247
|
+
presetStyle: {
|
|
248
|
+
span
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
const metaSelectContent = {
|
|
252
|
+
category: "hidden",
|
|
253
|
+
type: "container",
|
|
254
|
+
icon: ContentIcon,
|
|
255
|
+
detachable: false,
|
|
256
|
+
presetStyle
|
|
257
|
+
};
|
|
258
|
+
const metaSelectViewport = {
|
|
259
|
+
category: "hidden",
|
|
260
|
+
type: "container",
|
|
261
|
+
icon: ViewportIcon,
|
|
262
|
+
detachable: false,
|
|
263
|
+
presetStyle
|
|
264
|
+
};
|
|
265
|
+
const metaSelectItem = {
|
|
266
|
+
category: "hidden",
|
|
267
|
+
type: "container",
|
|
268
|
+
icon: ItemIcon,
|
|
269
|
+
requiredAncestors: ["SelectViewport"],
|
|
270
|
+
presetStyle
|
|
271
|
+
};
|
|
272
|
+
const metaSelectItemIndicator = {
|
|
273
|
+
category: "hidden",
|
|
274
|
+
type: "container",
|
|
275
|
+
label: "Indicator",
|
|
276
|
+
icon: CheckMarkIcon,
|
|
277
|
+
detachable: false,
|
|
278
|
+
requiredAncestors: ["SelectItem"],
|
|
279
|
+
presetStyle: {
|
|
280
|
+
span
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
const metaSelectItemText = {
|
|
284
|
+
category: "hidden",
|
|
285
|
+
type: "container",
|
|
286
|
+
label: "Item Text",
|
|
287
|
+
icon: TextIcon,
|
|
288
|
+
detachable: false,
|
|
289
|
+
requiredAncestors: ["SelectItem"],
|
|
290
|
+
presetStyle: {
|
|
291
|
+
span
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const propsMetaSelect = {
|
|
295
|
+
props: propsSelect,
|
|
296
|
+
initialProps: ["value", "open", "name", "required"]
|
|
297
|
+
};
|
|
298
|
+
const propsMetaSelectTrigger = {
|
|
299
|
+
props: propsSelectTrigger
|
|
300
|
+
};
|
|
301
|
+
const propsMetaSelectValue = {
|
|
302
|
+
props: propsSelectValue,
|
|
303
|
+
initialProps: ["placeholder"]
|
|
304
|
+
};
|
|
305
|
+
const propsMetaSelectContent = {
|
|
306
|
+
props: propsSelectContent
|
|
307
|
+
};
|
|
308
|
+
const propsMetaSelectViewport = {
|
|
309
|
+
props: propsSelectViewport
|
|
310
|
+
};
|
|
311
|
+
const propsMetaSelectItem = {
|
|
312
|
+
props: propsSelectItem,
|
|
313
|
+
initialProps: ["value"]
|
|
314
|
+
};
|
|
315
|
+
const propsMetaSelectItemIndicator = {
|
|
316
|
+
props: propsSelectItemIndicator
|
|
317
|
+
};
|
|
318
|
+
const propsMetaSelectItemText = {
|
|
319
|
+
props: propsSelectItemText
|
|
320
|
+
};
|
|
321
|
+
export {
|
|
322
|
+
metaSelect,
|
|
323
|
+
metaSelectContent,
|
|
324
|
+
metaSelectItem,
|
|
325
|
+
metaSelectItemIndicator,
|
|
326
|
+
metaSelectItemText,
|
|
327
|
+
metaSelectTrigger,
|
|
328
|
+
metaSelectValue,
|
|
329
|
+
metaSelectViewport,
|
|
330
|
+
propsMetaSelect,
|
|
331
|
+
propsMetaSelectContent,
|
|
332
|
+
propsMetaSelectItem,
|
|
333
|
+
propsMetaSelectItemIndicator,
|
|
334
|
+
propsMetaSelectItemText,
|
|
335
|
+
propsMetaSelectTrigger,
|
|
336
|
+
propsMetaSelectValue,
|
|
337
|
+
propsMetaSelectViewport
|
|
338
|
+
};
|
package/lib/sheet.ws.js
CHANGED
|
@@ -1,97 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HamburgerMenuIcon,
|
|
3
|
-
TriggerIcon,
|
|
4
|
-
ContentIcon,
|
|
5
|
-
OverlayIcon,
|
|
6
|
-
HeadingIcon,
|
|
7
|
-
TextIcon,
|
|
8
|
-
ButtonElementIcon
|
|
9
|
-
} from "@webstudio-is/icons/svg";
|
|
10
|
-
import {
|
|
11
|
-
} from "@webstudio-is/react-sdk";
|
|
1
|
+
import { HamburgerMenuIcon } from "@webstudio-is/icons/svg";
|
|
12
2
|
import * as tc from "./theme/tailwind-classes";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
propsSheetContent,
|
|
16
|
-
propsSheetTrigger,
|
|
17
|
-
propsSheetOverlay,
|
|
18
|
-
propsSheetClose,
|
|
19
|
-
propsSheetTitle,
|
|
20
|
-
propsSheetDescription
|
|
21
|
-
} from "./__generated__/sheet.props";
|
|
22
|
-
import { div, nav, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
|
|
23
|
-
import { template as buttonTemplate } from "./button.ws";
|
|
24
|
-
const contentPresetStyle = {
|
|
25
|
-
div,
|
|
26
|
-
nav
|
|
27
|
-
};
|
|
28
|
-
const presetStyle = {
|
|
29
|
-
div
|
|
30
|
-
};
|
|
31
|
-
const buttonPresetStyle = {
|
|
32
|
-
button
|
|
33
|
-
};
|
|
34
|
-
const titlePresetStyle = {
|
|
35
|
-
h2
|
|
36
|
-
};
|
|
37
|
-
const descriptionPresetStyle = {
|
|
38
|
-
p
|
|
39
|
-
};
|
|
40
|
-
const metaSheetTrigger = {
|
|
41
|
-
category: "hidden",
|
|
42
|
-
type: "container",
|
|
43
|
-
icon: TriggerIcon,
|
|
44
|
-
stylable: false,
|
|
45
|
-
detachable: false
|
|
46
|
-
};
|
|
47
|
-
const metaSheetContent = {
|
|
48
|
-
category: "hidden",
|
|
49
|
-
type: "container",
|
|
50
|
-
icon: ContentIcon,
|
|
51
|
-
detachable: false,
|
|
52
|
-
presetStyle: contentPresetStyle,
|
|
53
|
-
states: [
|
|
54
|
-
{ selector: "[data-side=top]", label: "Top Side" },
|
|
55
|
-
{ selector: "[data-side=right]", label: "Right Side" },
|
|
56
|
-
{ selector: "[data-side=bottom]", label: "Bottom Side" },
|
|
57
|
-
{ selector: "[data-side=left]", label: "Left Side" }
|
|
58
|
-
]
|
|
59
|
-
};
|
|
60
|
-
const metaSheetOverlay = {
|
|
61
|
-
category: "hidden",
|
|
62
|
-
type: "container",
|
|
63
|
-
presetStyle,
|
|
64
|
-
icon: OverlayIcon,
|
|
65
|
-
detachable: false
|
|
66
|
-
};
|
|
67
|
-
const metaSheetTitle = {
|
|
68
|
-
category: "hidden",
|
|
69
|
-
type: "container",
|
|
70
|
-
presetStyle: titlePresetStyle,
|
|
71
|
-
icon: HeadingIcon
|
|
72
|
-
};
|
|
73
|
-
const metaSheetDescription = {
|
|
74
|
-
category: "hidden",
|
|
75
|
-
type: "container",
|
|
76
|
-
presetStyle: descriptionPresetStyle,
|
|
77
|
-
icon: TextIcon
|
|
78
|
-
};
|
|
79
|
-
const metaSheetClose = {
|
|
80
|
-
category: "hidden",
|
|
81
|
-
type: "container",
|
|
82
|
-
presetStyle: buttonPresetStyle,
|
|
83
|
-
icon: ButtonElementIcon
|
|
84
|
-
};
|
|
85
|
-
const metaSheet = {
|
|
3
|
+
import { getButtonStyles } from "./theme/styles";
|
|
4
|
+
const meta = {
|
|
86
5
|
category: "radix",
|
|
6
|
+
order: 1,
|
|
87
7
|
type: "container",
|
|
88
8
|
icon: HamburgerMenuIcon,
|
|
89
|
-
order: 15,
|
|
90
9
|
stylable: false,
|
|
10
|
+
description: "Displays content in a menu that slides out from the side of the screen, triggered by a button. Use this component for a typical mobile hamburger menu.",
|
|
91
11
|
template: [
|
|
92
12
|
{
|
|
93
13
|
type: "instance",
|
|
94
|
-
component: "
|
|
14
|
+
component: "Dialog",
|
|
15
|
+
label: "Sheet",
|
|
95
16
|
dataSources: {
|
|
96
17
|
sheetOpen: { type: "variable", initialValue: false }
|
|
97
18
|
},
|
|
@@ -112,32 +33,35 @@ const metaSheet = {
|
|
|
112
33
|
children: [
|
|
113
34
|
{
|
|
114
35
|
type: "instance",
|
|
115
|
-
component: "
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
36
|
+
component: "DialogTrigger",
|
|
37
|
+
label: "Sheet Trigger",
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
type: "instance",
|
|
41
|
+
component: "Button",
|
|
42
|
+
styles: getButtonStyles("ghost", "icon"),
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
type: "instance",
|
|
46
|
+
component: "HtmlEmbed",
|
|
47
|
+
label: "Hamburger Menu Svg",
|
|
48
|
+
props: [
|
|
49
|
+
{
|
|
50
|
+
type: "string",
|
|
51
|
+
name: "code",
|
|
52
|
+
value: HamburgerMenuIcon
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
children: []
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
137
60
|
},
|
|
138
61
|
{
|
|
139
62
|
type: "instance",
|
|
140
|
-
component: "
|
|
63
|
+
component: "DialogOverlay",
|
|
64
|
+
label: "Sheet Overlay",
|
|
141
65
|
/**
|
|
142
66
|
* fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
|
|
143
67
|
* flex
|
|
@@ -156,7 +80,8 @@ const metaSheet = {
|
|
|
156
80
|
children: [
|
|
157
81
|
{
|
|
158
82
|
type: "instance",
|
|
159
|
-
component: "
|
|
83
|
+
component: "DialogContent",
|
|
84
|
+
label: "Sheet Content",
|
|
160
85
|
/**
|
|
161
86
|
* fixed w-full z-50
|
|
162
87
|
* grid gap-4 max-w-lg
|
|
@@ -174,71 +99,81 @@ const metaSheet = {
|
|
|
174
99
|
tc.p(6),
|
|
175
100
|
tc.shadow("lg"),
|
|
176
101
|
tc.relative(),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
)
|
|
181
|
-
tc.state(
|
|
182
|
-
[tc.ml("auto"), tc.maxW("sm"), tc.grow()].flat(),
|
|
183
|
-
"[data-side=right]"
|
|
184
|
-
),
|
|
185
|
-
tc.state([tc.mb("auto")].flat(), "[data-side=top]"),
|
|
186
|
-
tc.state([tc.mt("auto")].flat(), "[data-side=bottom]")
|
|
102
|
+
// side=left
|
|
103
|
+
tc.mr("auto"),
|
|
104
|
+
tc.maxW("sm"),
|
|
105
|
+
tc.grow()
|
|
187
106
|
].flat(),
|
|
188
107
|
children: [
|
|
189
108
|
{
|
|
190
109
|
type: "instance",
|
|
191
110
|
component: "Box",
|
|
192
|
-
label: "
|
|
193
|
-
|
|
111
|
+
label: "Navigation",
|
|
112
|
+
props: [
|
|
113
|
+
{ name: "tag", type: "string", value: "nav" },
|
|
114
|
+
{ name: "role", type: "string", value: "navigation" }
|
|
115
|
+
],
|
|
194
116
|
children: [
|
|
195
117
|
{
|
|
196
118
|
type: "instance",
|
|
197
|
-
component: "
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
**/
|
|
201
|
-
styles: [
|
|
202
|
-
tc.my(0),
|
|
203
|
-
tc.leading("none"),
|
|
204
|
-
tc.text("lg"),
|
|
205
|
-
tc.tracking("tight")
|
|
206
|
-
].flat(),
|
|
119
|
+
component: "Box",
|
|
120
|
+
label: "Sheet Header",
|
|
121
|
+
styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
|
|
207
122
|
children: [
|
|
208
123
|
{
|
|
209
|
-
type: "
|
|
210
|
-
|
|
124
|
+
type: "instance",
|
|
125
|
+
component: "DialogTitle",
|
|
126
|
+
label: "Sheet Title",
|
|
127
|
+
/**
|
|
128
|
+
* text-lg leading-none tracking-tight
|
|
129
|
+
**/
|
|
130
|
+
styles: [
|
|
131
|
+
tc.my(0),
|
|
132
|
+
tc.leading("none"),
|
|
133
|
+
tc.text("lg"),
|
|
134
|
+
tc.tracking("tight")
|
|
135
|
+
].flat(),
|
|
136
|
+
children: [
|
|
137
|
+
{
|
|
138
|
+
type: "text",
|
|
139
|
+
value: "Sheet Title"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "instance",
|
|
145
|
+
component: "DialogDescription",
|
|
146
|
+
label: "Sheet Description",
|
|
147
|
+
/**
|
|
148
|
+
* text-sm text-muted-foreground
|
|
149
|
+
**/
|
|
150
|
+
styles: [
|
|
151
|
+
tc.my(0),
|
|
152
|
+
tc.text("sm"),
|
|
153
|
+
tc.text("mutedForeground")
|
|
154
|
+
].flat(),
|
|
155
|
+
children: [
|
|
156
|
+
{
|
|
157
|
+
type: "text",
|
|
158
|
+
value: "Sheet description text you can edit"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
211
161
|
}
|
|
212
162
|
]
|
|
213
163
|
},
|
|
214
164
|
{
|
|
215
165
|
type: "instance",
|
|
216
|
-
component: "
|
|
217
|
-
/**
|
|
218
|
-
* text-sm text-muted-foreground
|
|
219
|
-
**/
|
|
220
|
-
styles: [
|
|
221
|
-
tc.my(0),
|
|
222
|
-
tc.text("sm"),
|
|
223
|
-
tc.text("mutedForeground")
|
|
224
|
-
].flat(),
|
|
166
|
+
component: "Text",
|
|
225
167
|
children: [
|
|
226
|
-
{
|
|
227
|
-
type: "text",
|
|
228
|
-
value: "sheet description text you can edit"
|
|
229
|
-
}
|
|
168
|
+
{ type: "text", value: "The text you can edit" }
|
|
230
169
|
]
|
|
231
170
|
}
|
|
232
171
|
]
|
|
233
172
|
},
|
|
234
173
|
{
|
|
235
174
|
type: "instance",
|
|
236
|
-
component: "
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
type: "instance",
|
|
241
|
-
component: "SheetClose",
|
|
175
|
+
component: "DialogClose",
|
|
176
|
+
label: "Close Button",
|
|
242
177
|
/**
|
|
243
178
|
* absolute right-4 top-4
|
|
244
179
|
* rounded-sm opacity-70
|
|
@@ -273,46 +208,6 @@ const metaSheet = {
|
|
|
273
208
|
}
|
|
274
209
|
]
|
|
275
210
|
};
|
|
276
|
-
const propsMetaSheet = {
|
|
277
|
-
props: propsSheet,
|
|
278
|
-
initialProps: ["open", "modal"]
|
|
279
|
-
};
|
|
280
|
-
const propsMetaSheetTrigger = {
|
|
281
|
-
props: propsSheetTrigger
|
|
282
|
-
};
|
|
283
|
-
const propsMetaSheetContent = {
|
|
284
|
-
props: propsSheetContent,
|
|
285
|
-
initialProps: ["side", "role", "tag"]
|
|
286
|
-
};
|
|
287
|
-
const propsMetaSheetOverlay = {
|
|
288
|
-
props: propsSheetOverlay,
|
|
289
|
-
initialProps: []
|
|
290
|
-
};
|
|
291
|
-
const propsMetaSheetClose = {
|
|
292
|
-
props: propsSheetClose,
|
|
293
|
-
initialProps: []
|
|
294
|
-
};
|
|
295
|
-
const propsMetaSheetTitle = {
|
|
296
|
-
props: propsSheetTitle,
|
|
297
|
-
initialProps: []
|
|
298
|
-
};
|
|
299
|
-
const propsMetaSheetDescription = {
|
|
300
|
-
props: propsSheetDescription,
|
|
301
|
-
initialProps: []
|
|
302
|
-
};
|
|
303
211
|
export {
|
|
304
|
-
|
|
305
|
-
metaSheetClose,
|
|
306
|
-
metaSheetContent,
|
|
307
|
-
metaSheetDescription,
|
|
308
|
-
metaSheetOverlay,
|
|
309
|
-
metaSheetTitle,
|
|
310
|
-
metaSheetTrigger,
|
|
311
|
-
propsMetaSheet,
|
|
312
|
-
propsMetaSheetClose,
|
|
313
|
-
propsMetaSheetContent,
|
|
314
|
-
propsMetaSheetDescription,
|
|
315
|
-
propsMetaSheetOverlay,
|
|
316
|
-
propsMetaSheetTitle,
|
|
317
|
-
propsMetaSheetTrigger
|
|
212
|
+
meta
|
|
318
213
|
};
|