@webstudio-is/sdk-components-react-radix 0.0.0-021f2d4
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/LICENSE +661 -0
- package/README.md +4 -0
- package/lib/__generated__/accordion.props.js +2631 -0
- package/lib/__generated__/checkbox.props.js +1084 -0
- package/lib/__generated__/collapsible.props.js +1024 -0
- package/lib/__generated__/dialog.props.js +2599 -0
- package/lib/__generated__/label.props.js +519 -0
- package/lib/__generated__/navigation-menu.props.js +3660 -0
- package/lib/__generated__/popover.props.js +564 -0
- package/lib/__generated__/radio-group.props.js +1619 -0
- package/lib/__generated__/select.props.js +3687 -0
- package/lib/__generated__/switch.props.js +1084 -0
- package/lib/__generated__/tabs.props.js +2121 -0
- package/lib/__generated__/tooltip.props.js +575 -0
- package/lib/accordion.js +36 -0
- package/lib/accordion.template.js +95 -0
- package/lib/accordion.ws.js +117 -0
- package/lib/checkbox.js +8 -0
- package/lib/checkbox.template.js +63 -0
- package/lib/checkbox.ws.js +51 -0
- package/lib/collapsible.js +37 -0
- package/lib/collapsible.template.js +16 -0
- package/lib/collapsible.ws.js +59 -0
- package/lib/components.js +62 -0
- package/lib/dialog.js +102 -0
- package/lib/dialog.template.js +119 -0
- package/lib/dialog.ws.js +138 -0
- package/lib/hooks.js +21 -0
- package/lib/label.js +7 -0
- package/lib/label.template.js +23 -0
- package/lib/label.ws.js +19 -0
- package/lib/metas.js +62 -0
- package/lib/navigation-menu.js +59 -0
- package/lib/navigation-menu.template.js +283 -0
- package/lib/navigation-menu.ws.js +124 -0
- package/lib/popover.js +48 -0
- package/lib/popover.template.js +33 -0
- package/lib/popover.ws.js +50 -0
- package/lib/props.js +62 -0
- package/lib/radio-group.js +9 -0
- package/lib/radio-group.template.js +66 -0
- package/lib/radio-group.ws.js +73 -0
- package/lib/select.js +46 -0
- package/lib/select.template.js +121 -0
- package/lib/select.ws.js +155 -0
- 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 +8 -0
- package/lib/switch.template.js +63 -0
- package/lib/switch.ws.js +63 -0
- package/lib/tabs.js +65 -0
- package/lib/tabs.template.js +66 -0
- package/lib/tabs.ws.js +88 -0
- package/lib/templates.js +28 -0
- package/lib/tooltip.js +45 -0
- package/lib/tooltip.template.js +33 -0
- package/lib/tooltip.ws.js +50 -0
- package/lib/types/__generated__/accordion.props.d.ts +6 -0
- package/lib/types/__generated__/checkbox.props.d.ts +3 -0
- package/lib/types/__generated__/collapsible.props.d.ts +4 -0
- package/lib/types/__generated__/dialog.props.d.ts +8 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
- package/lib/types/__generated__/popover.props.d.ts +4 -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/__generated__/tabs.props.d.ts +5 -0
- package/lib/types/__generated__/tooltip.props.d.ts +4 -0
- package/lib/types/accordion.d.ts +11 -0
- package/lib/types/accordion.template.d.ts +10 -0
- package/lib/types/accordion.ws.d.ts +11 -0
- package/lib/types/checkbox.d.ts +9 -0
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +5 -0
- package/lib/types/collapsible.d.ts +15 -0
- package/lib/types/collapsible.template.d.ts +2 -0
- package/lib/types/collapsible.ws.d.ts +7 -0
- package/lib/types/components.d.ts +12 -0
- package/lib/types/dialog.d.ts +23 -0
- package/lib/types/dialog.template.d.ts +10 -0
- package/lib/types/dialog.ws.d.ts +15 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.template.d.ts +10 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +12 -0
- package/lib/types/navigation-menu.d.ts +10 -0
- package/lib/types/navigation-menu.template.d.ts +2 -0
- package/lib/types/navigation-menu.ws.d.ts +15 -0
- package/lib/types/popover.d.ts +15 -0
- package/lib/types/popover.template.d.ts +10 -0
- package/lib/types/popover.ws.d.ts +7 -0
- package/lib/types/props-descriptions.d.ts +29 -0
- package/lib/types/props.d.ts +12 -0
- package/lib/types/radio-group.d.ts +5 -0
- package/lib/types/radio-group.template.d.ts +2 -0
- package/lib/types/radio-group.ws.d.ts +7 -0
- package/lib/types/select.d.ts +14 -0
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +17 -0
- package/lib/types/shared/preset-styles.d.ts +2 -0
- package/lib/types/shared/proxy.d.ts +15 -0
- package/lib/types/shared/styles.d.ts +2 -0
- package/lib/types/shared/theme.d.ts +212 -0
- package/lib/types/sheet.template.d.ts +10 -0
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.template.d.ts +2 -0
- package/lib/types/switch.ws.d.ts +5 -0
- package/lib/types/tabs.d.ts +13 -0
- package/lib/types/tabs.template.d.ts +2 -0
- package/lib/types/tabs.ws.d.ts +9 -0
- package/lib/types/templates.d.ts +13 -0
- package/lib/types/tooltip.d.ts +15 -0
- package/lib/types/tooltip.template.d.ts +10 -0
- package/lib/types/tooltip.ws.d.ts +7 -0
- package/package.json +85 -0
package/lib/select.ws.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { SelectIcon as o, TriggerIcon as n, FormTextFieldIcon as c, ContentIcon as r, ViewportIcon as p, ItemIcon as a, CheckMarkIcon as s, TextIcon as l } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { button as i, span as e, div as t } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { propsSelect as m, propsSelectTrigger as S, propsSelectValue as I, propsSelectContent as d, propsSelectViewport as q, propsSelectItem as y, propsSelectItemIndicator as $, propsSelectItemText as T } from "./__generated__/select.props.js";
|
|
4
|
+
const M = {
|
|
5
|
+
type: "container",
|
|
6
|
+
icon: o,
|
|
7
|
+
constraints: [
|
|
8
|
+
{
|
|
9
|
+
relation: "descendant",
|
|
10
|
+
component: { $eq: "SelectTrigger" }
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
relation: "descendant",
|
|
14
|
+
component: { $eq: "SelectContent" }
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}, x = {
|
|
18
|
+
type: "container",
|
|
19
|
+
icon: n,
|
|
20
|
+
presetStyle: {
|
|
21
|
+
button: i
|
|
22
|
+
},
|
|
23
|
+
constraints: [
|
|
24
|
+
{
|
|
25
|
+
relation: "ancestor",
|
|
26
|
+
component: { $eq: "Select" }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
relation: "descendant",
|
|
30
|
+
component: { $eq: "SelectValue" }
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}, C = {
|
|
34
|
+
type: "container",
|
|
35
|
+
label: "Value",
|
|
36
|
+
icon: c,
|
|
37
|
+
presetStyle: {
|
|
38
|
+
span: e
|
|
39
|
+
},
|
|
40
|
+
constraints: {
|
|
41
|
+
relation: "ancestor",
|
|
42
|
+
component: { $eq: "SelectTrigger" }
|
|
43
|
+
}
|
|
44
|
+
}, w = {
|
|
45
|
+
type: "container",
|
|
46
|
+
icon: r,
|
|
47
|
+
presetStyle: {
|
|
48
|
+
div: t
|
|
49
|
+
},
|
|
50
|
+
constraints: [
|
|
51
|
+
{
|
|
52
|
+
relation: "ancestor",
|
|
53
|
+
component: { $eq: "Select" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
relation: "descendant",
|
|
57
|
+
component: { $eq: "SelectViewport" }
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}, b = {
|
|
61
|
+
type: "container",
|
|
62
|
+
icon: p,
|
|
63
|
+
presetStyle: {
|
|
64
|
+
div: t
|
|
65
|
+
},
|
|
66
|
+
constraints: [
|
|
67
|
+
{
|
|
68
|
+
relation: "ancestor",
|
|
69
|
+
component: { $eq: "SelectContent" }
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
relation: "descendant",
|
|
73
|
+
component: { $eq: "SelectItem" }
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}, f = {
|
|
77
|
+
type: "container",
|
|
78
|
+
icon: a,
|
|
79
|
+
constraints: [
|
|
80
|
+
{
|
|
81
|
+
relation: "ancestor",
|
|
82
|
+
component: { $eq: "SelectViewport" }
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
relation: "descendant",
|
|
86
|
+
component: { $eq: "SelectItemIndicator" }
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
relation: "descendant",
|
|
90
|
+
component: { $eq: "SelectItemText" }
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
presetStyle: {
|
|
94
|
+
div: t
|
|
95
|
+
}
|
|
96
|
+
}, v = {
|
|
97
|
+
type: "container",
|
|
98
|
+
label: "Indicator",
|
|
99
|
+
icon: s,
|
|
100
|
+
constraints: {
|
|
101
|
+
relation: "ancestor",
|
|
102
|
+
component: { $eq: "SelectItem" }
|
|
103
|
+
},
|
|
104
|
+
presetStyle: {
|
|
105
|
+
span: e
|
|
106
|
+
}
|
|
107
|
+
}, P = {
|
|
108
|
+
type: "container",
|
|
109
|
+
label: "Item Text",
|
|
110
|
+
icon: l,
|
|
111
|
+
constraints: {
|
|
112
|
+
relation: "ancestor",
|
|
113
|
+
component: { $eq: "SelectItem" }
|
|
114
|
+
},
|
|
115
|
+
presetStyle: {
|
|
116
|
+
span: e
|
|
117
|
+
}
|
|
118
|
+
}, h = {
|
|
119
|
+
props: m,
|
|
120
|
+
initialProps: ["name", "value", "open", "required"]
|
|
121
|
+
}, k = {
|
|
122
|
+
props: S
|
|
123
|
+
}, F = {
|
|
124
|
+
props: I,
|
|
125
|
+
initialProps: ["placeholder"]
|
|
126
|
+
}, j = {
|
|
127
|
+
props: d
|
|
128
|
+
}, z = {
|
|
129
|
+
props: q
|
|
130
|
+
}, A = {
|
|
131
|
+
props: y,
|
|
132
|
+
initialProps: ["value"]
|
|
133
|
+
}, B = {
|
|
134
|
+
props: $
|
|
135
|
+
}, D = {
|
|
136
|
+
props: T
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
M as metaSelect,
|
|
140
|
+
w as metaSelectContent,
|
|
141
|
+
f as metaSelectItem,
|
|
142
|
+
v as metaSelectItemIndicator,
|
|
143
|
+
P as metaSelectItemText,
|
|
144
|
+
x as metaSelectTrigger,
|
|
145
|
+
C as metaSelectValue,
|
|
146
|
+
b as metaSelectViewport,
|
|
147
|
+
h as propsMetaSelect,
|
|
148
|
+
j as propsMetaSelectContent,
|
|
149
|
+
A as propsMetaSelectItem,
|
|
150
|
+
B as propsMetaSelectItemIndicator,
|
|
151
|
+
D as propsMetaSelectItemText,
|
|
152
|
+
k as propsMetaSelectTrigger,
|
|
153
|
+
F as propsMetaSelectValue,
|
|
154
|
+
z as propsMetaSelectViewport
|
|
155
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const o = (e, r, p) => ({
|
|
2
|
+
property: e,
|
|
3
|
+
value: { type: "unit", unit: p, value: r }
|
|
4
|
+
}), t = (e, r) => ({
|
|
5
|
+
property: e,
|
|
6
|
+
value: { type: "keyword", value: r }
|
|
7
|
+
}), d = (e, r, p, l) => ({
|
|
8
|
+
property: e,
|
|
9
|
+
value: { type: "rgb", alpha: 1, r, g: p, b: l }
|
|
10
|
+
}), i = [
|
|
11
|
+
{
|
|
12
|
+
property: "backgroundColor",
|
|
13
|
+
value: { type: "keyword", value: "transparent" }
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
property: "backgroundImage",
|
|
17
|
+
value: { type: "keyword", value: "none" }
|
|
18
|
+
},
|
|
19
|
+
o("borderTopWidth", 0, "px"),
|
|
20
|
+
o("borderRightWidth", 0, "px"),
|
|
21
|
+
o("borderBottomWidth", 0, "px"),
|
|
22
|
+
o("borderLeftWidth", 0, "px"),
|
|
23
|
+
t("borderTopStyle", "solid"),
|
|
24
|
+
t("borderRightStyle", "solid"),
|
|
25
|
+
t("borderBottomStyle", "solid"),
|
|
26
|
+
t("borderLeftStyle", "solid"),
|
|
27
|
+
d("borderTopColor", 226, 232, 240),
|
|
28
|
+
d("borderRightColor", 226, 232, 240),
|
|
29
|
+
d("borderBottomColor", 226, 232, 240),
|
|
30
|
+
d("borderLeftColor", 226, 232, 240),
|
|
31
|
+
o("paddingTop", 0, "px"),
|
|
32
|
+
o("paddingRight", 0, "px"),
|
|
33
|
+
o("paddingBottom", 0, "px"),
|
|
34
|
+
o("paddingLeft", 0, "px")
|
|
35
|
+
];
|
|
36
|
+
export {
|
|
37
|
+
i as buttonReset
|
|
38
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { css as n } from "@webstudio-is/template";
|
|
2
|
+
import { colors as o, borderRadius as s, fontSize as c, fontSizeLineHeight as u, weights as l, boxShadow as a, opacity as h, borderWidth as g, height as d, spacing as t } from "./theme.js";
|
|
3
|
+
const $ = n`
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
background-color: transparent;
|
|
8
|
+
border: 0 solid ${o.border};
|
|
9
|
+
border-radius: ${s.md};
|
|
10
|
+
font-size: ${c.sm};
|
|
11
|
+
line-height: ${u.sm};
|
|
12
|
+
font-weight: ${l.medium};
|
|
13
|
+
&:focus-visible {
|
|
14
|
+
outline: 2px solid transparent;
|
|
15
|
+
outline-offset: 2px;
|
|
16
|
+
box-shadow: ${a.ring};
|
|
17
|
+
}
|
|
18
|
+
&:disabled {
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
opacity: ${h[50]};
|
|
21
|
+
}
|
|
22
|
+
`, p = n`
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: ${o.accent};
|
|
25
|
+
color: ${o.accentForeground};
|
|
26
|
+
}
|
|
27
|
+
`, f = n`
|
|
28
|
+
border: ${g.DEFAULT} solid ${o.input};
|
|
29
|
+
background-color: ${o.background};
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: ${o.accent};
|
|
32
|
+
color: ${o.accentForeground};
|
|
33
|
+
}
|
|
34
|
+
`, b = n`
|
|
35
|
+
height: ${d[10]};
|
|
36
|
+
padding: ${t[2]} ${t[4]};
|
|
37
|
+
`, m = n`
|
|
38
|
+
height: ${d[9]};
|
|
39
|
+
border-radius: ${s.md};
|
|
40
|
+
padding: 0 ${t[3]};
|
|
41
|
+
`, y = n`
|
|
42
|
+
height: ${t[10]};
|
|
43
|
+
width: ${t[10]};
|
|
44
|
+
padding: ${t[0]} ${t[1.5]};
|
|
45
|
+
`, B = (r, i = "default") => {
|
|
46
|
+
const e = [...$];
|
|
47
|
+
return r === "ghost" && e.push(...p), r === "outline" && e.push(...f), i === "default" && e.push(...b), i === "sm" && e.push(...m), i === "icon" && e.push(...y), e;
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
B as getButtonStyle
|
|
51
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
sm: "0.875rem",
|
|
3
|
+
lg: "1.125rem"
|
|
4
|
+
}, t = {
|
|
5
|
+
sm: "1.25rem",
|
|
6
|
+
lg: "1.75rem"
|
|
7
|
+
}, p = {
|
|
8
|
+
none: "1",
|
|
9
|
+
snug: "1.375"
|
|
10
|
+
}, s = {
|
|
11
|
+
medium: "500"
|
|
12
|
+
}, g = {
|
|
13
|
+
tight: "-0.025em"
|
|
14
|
+
}, m = {
|
|
15
|
+
0: "0px",
|
|
16
|
+
1: "0.25rem",
|
|
17
|
+
2: "0.5rem",
|
|
18
|
+
3: "0.75rem",
|
|
19
|
+
4: "1rem",
|
|
20
|
+
5: "1.25rem",
|
|
21
|
+
6: "1.5rem",
|
|
22
|
+
7: "1.75rem",
|
|
23
|
+
8: "2rem",
|
|
24
|
+
9: "2.25rem",
|
|
25
|
+
10: "2.5rem",
|
|
26
|
+
11: "2.75rem",
|
|
27
|
+
12: "3rem",
|
|
28
|
+
14: "3.5rem",
|
|
29
|
+
16: "4rem",
|
|
30
|
+
20: "5rem",
|
|
31
|
+
24: "6rem",
|
|
32
|
+
28: "7rem",
|
|
33
|
+
32: "8rem",
|
|
34
|
+
36: "9rem",
|
|
35
|
+
40: "10rem",
|
|
36
|
+
44: "11rem",
|
|
37
|
+
48: "12rem",
|
|
38
|
+
52: "13rem",
|
|
39
|
+
56: "14rem",
|
|
40
|
+
60: "15rem",
|
|
41
|
+
64: "16rem",
|
|
42
|
+
72: "18rem",
|
|
43
|
+
80: "20rem",
|
|
44
|
+
96: "24rem",
|
|
45
|
+
px: "1px",
|
|
46
|
+
"0.5": "0.125rem",
|
|
47
|
+
"1.5": "0.375rem",
|
|
48
|
+
"2.5": "0.625rem",
|
|
49
|
+
"3.5": "0.875rem"
|
|
50
|
+
}, c = {
|
|
51
|
+
...m,
|
|
52
|
+
full: "100%"
|
|
53
|
+
}, x = {
|
|
54
|
+
...m,
|
|
55
|
+
full: "100%"
|
|
56
|
+
}, i = {
|
|
57
|
+
0: "0rem",
|
|
58
|
+
xs: "20rem",
|
|
59
|
+
sm: "24rem",
|
|
60
|
+
md: "28rem",
|
|
61
|
+
lg: "32rem",
|
|
62
|
+
xl: "36rem",
|
|
63
|
+
prose: "65ch"
|
|
64
|
+
}, b = {
|
|
65
|
+
0: "0px",
|
|
66
|
+
2: "2px",
|
|
67
|
+
4: "4px",
|
|
68
|
+
8: "8px",
|
|
69
|
+
DEFAULT: "1px"
|
|
70
|
+
}, d = {
|
|
71
|
+
sm: "0.125rem",
|
|
72
|
+
md: "0.375rem",
|
|
73
|
+
full: "9999px"
|
|
74
|
+
}, r = {
|
|
75
|
+
transparent: "transparent",
|
|
76
|
+
current: "currentColor",
|
|
77
|
+
inherit: "inherit",
|
|
78
|
+
popover: "rgb(255, 255, 255)",
|
|
79
|
+
popoverForeground: "rgb(2, 8, 23)",
|
|
80
|
+
border: "rgb(226, 232, 240)",
|
|
81
|
+
background: "rgb(255, 255, 255)",
|
|
82
|
+
foreground: "hsl(222.2 84% 4.9%)",
|
|
83
|
+
ring: "rgb(148, 163, 184)",
|
|
84
|
+
mutedForeground: "rgb(100, 116, 139)",
|
|
85
|
+
muted: "hsl(210 40% 96.1%)",
|
|
86
|
+
primary: "rgb(15, 23, 42)",
|
|
87
|
+
primaryForeground: "hsl(210 40% 98%)",
|
|
88
|
+
destructive: "rgb(239, 68, 68)",
|
|
89
|
+
destructiveForeground: "rgb(248, 250, 252)",
|
|
90
|
+
accent: "rgb(241, 245, 249)",
|
|
91
|
+
accentForeground: "rgb(15, 23, 42)",
|
|
92
|
+
input: "rgb(226, 232, 240)",
|
|
93
|
+
secondary: "rgb(241, 245, 249)",
|
|
94
|
+
secondaryForeground: "rgb(15, 23, 42)"
|
|
95
|
+
}, u = {
|
|
96
|
+
all: "all 150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
97
|
+
transform: "transform 150ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
98
|
+
}, l = {
|
|
99
|
+
0: "0",
|
|
100
|
+
5: "0.05",
|
|
101
|
+
10: "0.1",
|
|
102
|
+
20: "0.2",
|
|
103
|
+
25: "0.25",
|
|
104
|
+
30: "0.3",
|
|
105
|
+
40: "0.4",
|
|
106
|
+
50: "0.5",
|
|
107
|
+
60: "0.6",
|
|
108
|
+
70: "0.7",
|
|
109
|
+
75: "0.75",
|
|
110
|
+
80: "0.8",
|
|
111
|
+
90: "0.9",
|
|
112
|
+
95: "0.95",
|
|
113
|
+
100: "1"
|
|
114
|
+
}, n = {
|
|
115
|
+
0: "0px",
|
|
116
|
+
1: "1px",
|
|
117
|
+
2: "2px",
|
|
118
|
+
4: "4px",
|
|
119
|
+
8: "8px",
|
|
120
|
+
DEFAULT: "3px"
|
|
121
|
+
}, e = {
|
|
122
|
+
0: "0px",
|
|
123
|
+
1: "1px",
|
|
124
|
+
2: "2px",
|
|
125
|
+
4: "4px",
|
|
126
|
+
8: "8px"
|
|
127
|
+
}, a = {
|
|
128
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
129
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
130
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
131
|
+
// 0 0 0 ringOffsetWidth ringOffsetColor
|
|
132
|
+
// 0 0 0 ringWidth + ringOffsetWidth ringColor
|
|
133
|
+
ring: `0 0 0 ${e[2]} ${r.background}, 0 0 0 calc(${n[2]} + ${e[2]}) ${r.ring}`
|
|
134
|
+
}, h = {
|
|
135
|
+
0: "0",
|
|
136
|
+
10: "10",
|
|
137
|
+
20: "20",
|
|
138
|
+
30: "30",
|
|
139
|
+
40: "40",
|
|
140
|
+
50: "50"
|
|
141
|
+
}, f = {
|
|
142
|
+
sm: "blur(0 1px 2px 0 rgb(0 0 0 / 0.05))"
|
|
143
|
+
};
|
|
144
|
+
export {
|
|
145
|
+
f as blur,
|
|
146
|
+
d as borderRadius,
|
|
147
|
+
b as borderWidth,
|
|
148
|
+
a as boxShadow,
|
|
149
|
+
r as colors,
|
|
150
|
+
o as fontSize,
|
|
151
|
+
t as fontSizeLineHeight,
|
|
152
|
+
x as height,
|
|
153
|
+
g as letterSpacing,
|
|
154
|
+
p as lineHeight,
|
|
155
|
+
i as maxWidth,
|
|
156
|
+
l as opacity,
|
|
157
|
+
m as spacing,
|
|
158
|
+
u as transition,
|
|
159
|
+
s as weights,
|
|
160
|
+
c as width,
|
|
161
|
+
h as zIndex
|
|
162
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { MenuIcon as s, LargeXIcon as b } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as t, css as i, PlaceholderValue as n } from "@webstudio-is/template";
|
|
4
|
+
import { radix as o } from "./shared/proxy.js";
|
|
5
|
+
import { zIndex as d, blur as p, width as u, spacing as l, borderWidth as w, colors as a, boxShadow as c, maxWidth as f, fontSize as g, lineHeight as x, letterSpacing as $, fontSizeLineHeight as y, borderRadius as S, opacity as h, height as m } from "./shared/theme.js";
|
|
6
|
+
import { getButtonStyle as D } from "./shared/styles.js";
|
|
7
|
+
const B = {
|
|
8
|
+
category: "radix",
|
|
9
|
+
icon: s,
|
|
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.",
|
|
11
|
+
order: 1,
|
|
12
|
+
template: /* @__PURE__ */ r(o.Dialog, { "ws:label": "Sheet", children: [
|
|
13
|
+
/* @__PURE__ */ e(o.DialogTrigger, { "ws:label": "Sheet Trigger", children: /* @__PURE__ */ e(t.Button, { "ws:style": D("ghost", "icon"), children: /* @__PURE__ */ e(t.HtmlEmbed, { "ws:label": "Hamburger Menu Svg", code: s }) }) }),
|
|
14
|
+
/* @__PURE__ */ e(
|
|
15
|
+
o.DialogOverlay,
|
|
16
|
+
{
|
|
17
|
+
"ws:label": "Sheet Overlay",
|
|
18
|
+
"ws:style": i`
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0;
|
|
21
|
+
z-index: ${d[50]};
|
|
22
|
+
background-color: rgb(255 255 255 / 0.8);
|
|
23
|
+
backdrop-filter: ${p.sm};
|
|
24
|
+
/* To allow positioning Content */
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
`,
|
|
29
|
+
children: /* @__PURE__ */ r(
|
|
30
|
+
o.DialogContent,
|
|
31
|
+
{
|
|
32
|
+
"ws:label": "Sheet Content",
|
|
33
|
+
"ws:style": i`
|
|
34
|
+
width: ${u.full};
|
|
35
|
+
z-index: ${d[50]};
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: ${l[4]};
|
|
39
|
+
border: ${w.DEFAULT} solid ${a.border};
|
|
40
|
+
background-color: ${a.background};
|
|
41
|
+
padding: ${l[6]};
|
|
42
|
+
box-shadow: ${c.lg};
|
|
43
|
+
position: relative;
|
|
44
|
+
/* side=left */
|
|
45
|
+
margin-right: auto;
|
|
46
|
+
max-width: ${f.sm};
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
`,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ r(t.Box, { "ws:label": "Navigation", tag: "nav", role: "navigation", children: [
|
|
51
|
+
/* @__PURE__ */ r(
|
|
52
|
+
t.Box,
|
|
53
|
+
{
|
|
54
|
+
"ws:label": "Sheet Header",
|
|
55
|
+
"ws:style": i`
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: ${l[2]};
|
|
59
|
+
`,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
o.DialogTitle,
|
|
63
|
+
{
|
|
64
|
+
"ws:label": "Sheet Title",
|
|
65
|
+
"ws:style": i`
|
|
66
|
+
font-size: ${g.lg};
|
|
67
|
+
line-height: ${x.none};
|
|
68
|
+
letter-spacing: ${$.tight};
|
|
69
|
+
margin: 0;
|
|
70
|
+
`,
|
|
71
|
+
children: new n("Sheet Title")
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ e(
|
|
75
|
+
o.DialogDescription,
|
|
76
|
+
{
|
|
77
|
+
"ws:label": "Sheet Description",
|
|
78
|
+
"ws:style": i`
|
|
79
|
+
font-size: ${g.sm};
|
|
80
|
+
line-height: ${y.sm};
|
|
81
|
+
color: ${a.mutedForeground};
|
|
82
|
+
margin: 0;
|
|
83
|
+
`,
|
|
84
|
+
children: new n("Sheet description text you can edit")
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ e(t.Text, { children: new n("The text you can edit") })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
o.DialogClose,
|
|
94
|
+
{
|
|
95
|
+
"ws:label": "Close Button",
|
|
96
|
+
"ws:style": i`
|
|
97
|
+
position: absolute;
|
|
98
|
+
right: ${l[4]};
|
|
99
|
+
top: ${l[4]};
|
|
100
|
+
border-radius: ${S.sm};
|
|
101
|
+
opacity: ${h[70]};
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
height: ${m[4]};
|
|
106
|
+
width: ${m[4]};
|
|
107
|
+
border: 0;
|
|
108
|
+
background-color: transparent;
|
|
109
|
+
outline: none;
|
|
110
|
+
&:hover {
|
|
111
|
+
opacity: ${h[100]};
|
|
112
|
+
}
|
|
113
|
+
&:focus-visible {
|
|
114
|
+
box-shadow: ${c.ring};
|
|
115
|
+
}
|
|
116
|
+
`,
|
|
117
|
+
children: /* @__PURE__ */ e(t.HtmlEmbed, { "ws:label": "Close Icon", code: b })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
B as meta
|
|
129
|
+
};
|
package/lib/switch.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { Root as c, Thumb as h } from "@radix-ui/react-switch";
|
|
4
|
+
const d = f(({ defaultChecked: o, checked: r, ...t }, m) => /* @__PURE__ */ e(c, { ...t, ref: m, defaultChecked: r ?? o })), n = h;
|
|
5
|
+
export {
|
|
6
|
+
d as Switch,
|
|
7
|
+
n as SwitchThumb
|
|
8
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { css as r } from "@webstudio-is/template";
|
|
3
|
+
import { radix as e } from "./shared/proxy.js";
|
|
4
|
+
import { borderRadius as a, borderWidth as d, transition as i, boxShadow as n, opacity as s, colors as t, height as c, width as l } from "./shared/theme.js";
|
|
5
|
+
const m = {
|
|
6
|
+
category: "radix",
|
|
7
|
+
description: "A control that allows the user to toggle between checked and not checked.",
|
|
8
|
+
order: 11,
|
|
9
|
+
template: /* @__PURE__ */ o(
|
|
10
|
+
e.Switch,
|
|
11
|
+
{
|
|
12
|
+
"ws:style": r`
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
height: 24px;
|
|
15
|
+
width: 44px;
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
align-items: center;
|
|
19
|
+
border-radius: ${a.full};
|
|
20
|
+
border: ${d[2]} solid transparent;
|
|
21
|
+
transition: ${i.all};
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
outline: none;
|
|
24
|
+
box-shadow: ${n.ring};
|
|
25
|
+
}
|
|
26
|
+
&:disabled {
|
|
27
|
+
cursor: not-allowed;
|
|
28
|
+
opacity: ${s[50]};
|
|
29
|
+
}
|
|
30
|
+
&[data-state="checked"] {
|
|
31
|
+
background-color: ${t.primary};
|
|
32
|
+
}
|
|
33
|
+
&[data-state="unchecked"] {
|
|
34
|
+
background-color: ${t.input};
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
children: /* @__PURE__ */ o(
|
|
38
|
+
e.SwitchThumb,
|
|
39
|
+
{
|
|
40
|
+
"ws:style": r`
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
display: block;
|
|
43
|
+
height: ${c[5]};
|
|
44
|
+
width: ${l[5]};
|
|
45
|
+
border-radius: ${a.full};
|
|
46
|
+
background-color: ${t.background};
|
|
47
|
+
box-shadow: ${n.lg};
|
|
48
|
+
transition: ${i.transform};
|
|
49
|
+
&[data-state="checked"] {
|
|
50
|
+
transform: translateX(20px);
|
|
51
|
+
}
|
|
52
|
+
&[data-state="unchecked"] {
|
|
53
|
+
transform: translateX(0px);
|
|
54
|
+
}
|
|
55
|
+
`
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
m as meta
|
|
63
|
+
};
|
package/lib/switch.ws.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SwitchIcon as e, TriggerIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
3
|
+
import { button as c, span as a } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { buttonReset as s } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsSwitch as n, propsSwitchThumb as r } from "./__generated__/switch.props.js";
|
|
6
|
+
const d = {
|
|
7
|
+
type: "container",
|
|
8
|
+
constraints: {
|
|
9
|
+
relation: "descendant",
|
|
10
|
+
component: { $eq: "SwitchThumb" }
|
|
11
|
+
},
|
|
12
|
+
icon: e,
|
|
13
|
+
states: [
|
|
14
|
+
...t,
|
|
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: [c, s].flat()
|
|
28
|
+
}
|
|
29
|
+
}, u = {
|
|
30
|
+
type: "container",
|
|
31
|
+
constraints: {
|
|
32
|
+
relation: "ancestor",
|
|
33
|
+
component: { $eq: "Switch" }
|
|
34
|
+
},
|
|
35
|
+
icon: o,
|
|
36
|
+
states: [
|
|
37
|
+
...t,
|
|
38
|
+
{
|
|
39
|
+
label: "Checked",
|
|
40
|
+
selector: "[data-state=checked]",
|
|
41
|
+
category: "component-states"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Unchecked",
|
|
45
|
+
selector: "[data-state=unchecked]",
|
|
46
|
+
category: "component-states"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
presetStyle: {
|
|
50
|
+
span: a
|
|
51
|
+
}
|
|
52
|
+
}, S = {
|
|
53
|
+
props: n,
|
|
54
|
+
initialProps: ["id", "className", "name", "value", "checked", "required"]
|
|
55
|
+
}, b = {
|
|
56
|
+
props: r
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
d as metaSwitch,
|
|
60
|
+
u as metaSwitchThumb,
|
|
61
|
+
S as propsMetaSwitch,
|
|
62
|
+
b as propsMetaSwitchThumb
|
|
63
|
+
};
|