@webstudio-is/sdk-components-react-radix 0.0.0-588fe22 → 0.0.0-73cd6ea
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 +15 -2582
- package/lib/__generated__/checkbox.props.js +5 -1071
- package/lib/__generated__/collapsible.props.js +7 -1012
- package/lib/__generated__/dialog.props.js +10 -2585
- package/lib/__generated__/label.props.js +2 -517
- package/lib/__generated__/navigation-menu.props.js +13 -3625
- package/lib/__generated__/popover.props.js +7 -509
- package/lib/__generated__/radio-group.props.js +19 -1568
- package/lib/__generated__/select.props.js +42 -3615
- package/lib/__generated__/switch.props.js +5 -1071
- package/lib/__generated__/tabs.props.js +17 -2073
- package/lib/__generated__/tooltip.props.js +6 -503
- package/lib/accordion.js +33 -20
- package/lib/accordion.template.js +14 -14
- package/lib/accordion.ws.js +56 -93
- package/lib/checkbox.js +17 -6
- package/lib/checkbox.template.js +10 -10
- package/lib/checkbox.ws.js +26 -41
- package/lib/collapsible.js +29 -26
- package/lib/collapsible.ws.js +28 -48
- package/lib/components.js +46 -45
- package/lib/dialog.js +50 -56
- package/lib/dialog.template.js +19 -19
- package/lib/dialog.ws.js +68 -126
- package/lib/label.template.js +3 -3
- package/lib/label.ws.js +8 -15
- package/lib/metas.js +45 -44
- package/lib/navigation-menu.js +21 -20
- package/lib/navigation-menu.template.js +8 -8
- package/lib/navigation-menu.ws.js +71 -102
- package/lib/popover.js +36 -32
- package/lib/popover.template.js +50 -20
- package/lib/popover.ws.js +45 -44
- package/lib/radio-group.js +10 -7
- package/lib/radio-group.ws.js +37 -61
- package/lib/select.js +49 -37
- package/lib/select.ws.js +71 -137
- package/lib/shared/meta.js +13 -0
- package/lib/shared/preset-styles.js +29 -29
- package/lib/shared/theme.js +25 -68
- package/lib/sheet.template.js +32 -32
- package/lib/switch.js +9 -6
- package/lib/switch.template.js +9 -9
- package/lib/switch.ws.js +29 -52
- package/lib/tabs.js +50 -53
- package/lib/tabs.template.js +16 -16
- package/lib/tabs.ws.js +41 -76
- package/lib/tooltip.js +34 -31
- package/lib/tooltip.ws.js +27 -42
- package/lib/types/__generated__/popover.props.d.ts +1 -0
- package/lib/types/accordion.ws.d.ts +1 -6
- package/lib/types/checkbox.ws.d.ts +1 -3
- package/lib/types/collapsible.d.ts +2 -2
- package/lib/types/collapsible.ws.d.ts +1 -4
- package/lib/types/components.d.ts +1 -1
- package/lib/types/dialog.ws.d.ts +1 -8
- package/lib/types/label.ws.d.ts +1 -2
- package/lib/types/metas.d.ts +1 -1
- package/lib/types/navigation-menu.ws.d.ts +1 -8
- package/lib/types/popover.d.ts +1 -0
- package/lib/types/popover.ws.d.ts +2 -4
- package/lib/types/radio-group.d.ts +1 -1
- package/lib/types/radio-group.ws.d.ts +1 -4
- package/lib/types/select.d.ts +3 -3
- package/lib/types/select.ws.d.ts +1 -9
- package/lib/types/shared/meta.d.ts +1 -0
- package/lib/types/shared/preset-styles.d.ts +2 -2
- package/lib/types/shared/proxy.d.ts +4 -5
- package/lib/types/switch.ws.d.ts +1 -3
- package/lib/types/tabs.d.ts +1 -4
- package/lib/types/tabs.ws.d.ts +1 -5
- package/lib/types/tooltip.ws.d.ts +1 -4
- package/package.json +21 -27
- package/lib/props.js +0 -62
- package/lib/types/props.d.ts +0 -12
package/lib/shared/theme.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = {
|
|
2
2
|
sm: "0.875rem",
|
|
3
3
|
lg: "1.125rem"
|
|
4
4
|
}, t = {
|
|
5
|
-
sm: "1.25rem"
|
|
6
|
-
|
|
7
|
-
}, p = {
|
|
5
|
+
sm: "1.25rem"
|
|
6
|
+
}, g = {
|
|
8
7
|
none: "1",
|
|
9
8
|
snug: "1.375"
|
|
10
9
|
}, s = {
|
|
11
10
|
medium: "500"
|
|
12
|
-
},
|
|
11
|
+
}, c = {
|
|
13
12
|
tight: "-0.025em"
|
|
14
13
|
}, m = {
|
|
15
14
|
0: "0px",
|
|
@@ -47,34 +46,22 @@ const o = {
|
|
|
47
46
|
"1.5": "0.375rem",
|
|
48
47
|
"2.5": "0.625rem",
|
|
49
48
|
"3.5": "0.875rem"
|
|
50
|
-
},
|
|
51
|
-
...m,
|
|
52
|
-
full: "100%"
|
|
53
|
-
}, x = {
|
|
49
|
+
}, p = {
|
|
54
50
|
...m,
|
|
55
51
|
full: "100%"
|
|
56
52
|
}, i = {
|
|
57
|
-
|
|
58
|
-
xs: "20rem",
|
|
59
|
-
sm: "24rem",
|
|
60
|
-
md: "28rem",
|
|
61
|
-
lg: "32rem",
|
|
62
|
-
xl: "36rem",
|
|
63
|
-
prose: "65ch"
|
|
53
|
+
...m
|
|
64
54
|
}, b = {
|
|
65
|
-
|
|
55
|
+
sm: "24rem",
|
|
56
|
+
lg: "32rem"
|
|
57
|
+
}, x = {
|
|
66
58
|
2: "2px",
|
|
67
|
-
4: "4px",
|
|
68
|
-
8: "8px",
|
|
69
59
|
DEFAULT: "1px"
|
|
70
60
|
}, d = {
|
|
71
61
|
sm: "0.125rem",
|
|
72
62
|
md: "0.375rem",
|
|
73
63
|
full: "9999px"
|
|
74
64
|
}, r = {
|
|
75
|
-
transparent: "transparent",
|
|
76
|
-
current: "currentColor",
|
|
77
|
-
inherit: "inherit",
|
|
78
65
|
popover: "rgb(255, 255, 255)",
|
|
79
66
|
popoverForeground: "rgb(2, 8, 23)",
|
|
80
67
|
border: "rgb(226, 232, 240)",
|
|
@@ -85,58 +72,28 @@ const o = {
|
|
|
85
72
|
muted: "hsl(210 40% 96.1%)",
|
|
86
73
|
primary: "rgb(15, 23, 42)",
|
|
87
74
|
primaryForeground: "hsl(210 40% 98%)",
|
|
88
|
-
destructive: "rgb(239, 68, 68)",
|
|
89
|
-
destructiveForeground: "rgb(248, 250, 252)",
|
|
90
75
|
accent: "rgb(241, 245, 249)",
|
|
91
76
|
accentForeground: "rgb(15, 23, 42)",
|
|
92
|
-
input: "rgb(226, 232, 240)"
|
|
93
|
-
|
|
94
|
-
secondaryForeground: "rgb(15, 23, 42)"
|
|
95
|
-
}, u = {
|
|
77
|
+
input: "rgb(226, 232, 240)"
|
|
78
|
+
}, l = {
|
|
96
79
|
all: "all 150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
97
80
|
transform: "transform 150ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
98
|
-
},
|
|
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",
|
|
81
|
+
}, u = {
|
|
106
82
|
50: "0.5",
|
|
107
|
-
60: "0.6",
|
|
108
83
|
70: "0.7",
|
|
109
|
-
75: "0.75",
|
|
110
|
-
80: "0.8",
|
|
111
|
-
90: "0.9",
|
|
112
|
-
95: "0.95",
|
|
113
84
|
100: "1"
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
1: "1px",
|
|
117
|
-
2: "2px",
|
|
118
|
-
4: "4px",
|
|
119
|
-
8: "8px",
|
|
120
|
-
DEFAULT: "3px"
|
|
85
|
+
}, o = {
|
|
86
|
+
2: "2px"
|
|
121
87
|
}, e = {
|
|
122
|
-
|
|
123
|
-
1: "1px",
|
|
124
|
-
2: "2px",
|
|
125
|
-
4: "4px",
|
|
126
|
-
8: "8px"
|
|
88
|
+
2: "2px"
|
|
127
89
|
}, a = {
|
|
128
90
|
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
129
91
|
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
130
92
|
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
131
93
|
// 0 0 0 ringOffsetWidth ringOffsetColor
|
|
132
94
|
// 0 0 0 ringWidth + ringOffsetWidth ringColor
|
|
133
|
-
ring: `0 0 0 ${e[2]} ${r.background}, 0 0 0 calc(${
|
|
95
|
+
ring: `0 0 0 ${e[2]} ${r.background}, 0 0 0 calc(${o[2]} + ${e[2]}) ${r.ring}`
|
|
134
96
|
}, h = {
|
|
135
|
-
0: "0",
|
|
136
|
-
10: "10",
|
|
137
|
-
20: "20",
|
|
138
|
-
30: "30",
|
|
139
|
-
40: "40",
|
|
140
97
|
50: "50"
|
|
141
98
|
}, f = {
|
|
142
99
|
sm: "blur(0 1px 2px 0 rgb(0 0 0 / 0.05))"
|
|
@@ -144,19 +101,19 @@ const o = {
|
|
|
144
101
|
export {
|
|
145
102
|
f as blur,
|
|
146
103
|
d as borderRadius,
|
|
147
|
-
|
|
104
|
+
x as borderWidth,
|
|
148
105
|
a as boxShadow,
|
|
149
106
|
r as colors,
|
|
150
|
-
|
|
107
|
+
n as fontSize,
|
|
151
108
|
t as fontSizeLineHeight,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
109
|
+
i as height,
|
|
110
|
+
c as letterSpacing,
|
|
111
|
+
g as lineHeight,
|
|
112
|
+
b as maxWidth,
|
|
113
|
+
u as opacity,
|
|
157
114
|
m as spacing,
|
|
158
|
-
|
|
115
|
+
l as transition,
|
|
159
116
|
s as weights,
|
|
160
|
-
|
|
117
|
+
p as width,
|
|
161
118
|
h as zIndex
|
|
162
119
|
};
|
package/lib/sheet.template.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { MenuIcon as s, LargeXIcon as b } from "@webstudio-is/icons/svg";
|
|
3
|
-
import { $ as
|
|
4
|
-
import { radix as
|
|
5
|
-
import {
|
|
3
|
+
import { $ as o, PlaceholderValue as n, css as i } from "@webstudio-is/template";
|
|
4
|
+
import { radix as t } from "./shared/proxy.js";
|
|
5
|
+
import { fontSize as d, lineHeight as p, letterSpacing as u, fontSizeLineHeight as w, colors as a, spacing as l, borderRadius as f, opacity as c, height as g, boxShadow as h, width as x, zIndex as m, borderWidth as $, maxWidth as y, blur as S } from "./shared/theme.js";
|
|
6
6
|
import { getButtonStyle as D } from "./shared/styles.js";
|
|
7
7
|
const B = {
|
|
8
8
|
category: "radix",
|
|
9
9
|
icon: s,
|
|
10
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
11
|
order: 1,
|
|
12
|
-
template: /* @__PURE__ */ r(
|
|
13
|
-
/* @__PURE__ */ e(
|
|
12
|
+
template: /* @__PURE__ */ r(t.Dialog, { "ws:label": "Sheet", children: [
|
|
13
|
+
/* @__PURE__ */ e(t.DialogTrigger, { "ws:label": "Sheet Trigger", children: /* @__PURE__ */ e(o.Button, { "ws:style": D("ghost", "icon"), children: /* @__PURE__ */ e(o.HtmlEmbed, { "ws:label": "Hamburger Menu Svg", code: s }) }) }),
|
|
14
14
|
/* @__PURE__ */ e(
|
|
15
|
-
|
|
15
|
+
t.DialogOverlay,
|
|
16
16
|
{
|
|
17
17
|
"ws:label": "Sheet Overlay",
|
|
18
18
|
"ws:style": i`
|
|
19
19
|
position: fixed;
|
|
20
20
|
inset: 0;
|
|
21
|
-
z-index: ${
|
|
21
|
+
z-index: ${m[50]};
|
|
22
22
|
background-color: rgb(255 255 255 / 0.8);
|
|
23
|
-
backdrop-filter: ${
|
|
23
|
+
backdrop-filter: ${S.sm};
|
|
24
24
|
/* To allow positioning Content */
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-direction: column;
|
|
27
27
|
overflow: auto;
|
|
28
28
|
`,
|
|
29
29
|
children: /* @__PURE__ */ r(
|
|
30
|
-
|
|
30
|
+
t.DialogContent,
|
|
31
31
|
{
|
|
32
32
|
"ws:label": "Sheet Content",
|
|
33
33
|
"ws:style": i`
|
|
34
|
-
width: ${
|
|
35
|
-
z-index: ${
|
|
34
|
+
width: ${x.full};
|
|
35
|
+
z-index: ${m[50]};
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
38
|
gap: ${l[4]};
|
|
39
|
-
border: ${
|
|
39
|
+
border: ${$.DEFAULT} solid ${a.border};
|
|
40
40
|
background-color: ${a.background};
|
|
41
41
|
padding: ${l[6]};
|
|
42
|
-
box-shadow: ${
|
|
42
|
+
box-shadow: ${h.lg};
|
|
43
43
|
position: relative;
|
|
44
44
|
/* side=left */
|
|
45
45
|
margin-right: auto;
|
|
46
|
-
max-width: ${
|
|
46
|
+
max-width: ${y.sm};
|
|
47
47
|
flex-grow: 1;
|
|
48
48
|
`,
|
|
49
49
|
children: [
|
|
50
|
-
/* @__PURE__ */ r(
|
|
50
|
+
/* @__PURE__ */ r(o.Box, { "ws:label": "Navigation", "ws:tag": "nav", children: [
|
|
51
51
|
/* @__PURE__ */ r(
|
|
52
|
-
|
|
52
|
+
o.Box,
|
|
53
53
|
{
|
|
54
54
|
"ws:label": "Sheet Header",
|
|
55
55
|
"ws:style": i`
|
|
@@ -59,25 +59,25 @@ const B = {
|
|
|
59
59
|
`,
|
|
60
60
|
children: [
|
|
61
61
|
/* @__PURE__ */ e(
|
|
62
|
-
|
|
62
|
+
t.DialogTitle,
|
|
63
63
|
{
|
|
64
64
|
"ws:label": "Sheet Title",
|
|
65
65
|
"ws:style": i`
|
|
66
|
-
font-size: ${
|
|
67
|
-
line-height: ${
|
|
68
|
-
letter-spacing: ${
|
|
66
|
+
font-size: ${d.lg};
|
|
67
|
+
line-height: ${p.none};
|
|
68
|
+
letter-spacing: ${u.tight};
|
|
69
69
|
margin: 0;
|
|
70
70
|
`,
|
|
71
71
|
children: new n("Sheet Title")
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
74
|
/* @__PURE__ */ e(
|
|
75
|
-
|
|
75
|
+
t.DialogDescription,
|
|
76
76
|
{
|
|
77
77
|
"ws:label": "Sheet Description",
|
|
78
78
|
"ws:style": i`
|
|
79
|
-
font-size: ${
|
|
80
|
-
line-height: ${
|
|
79
|
+
font-size: ${d.sm};
|
|
80
|
+
line-height: ${w.sm};
|
|
81
81
|
color: ${a.mutedForeground};
|
|
82
82
|
margin: 0;
|
|
83
83
|
`,
|
|
@@ -87,34 +87,34 @@ const B = {
|
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
|
-
/* @__PURE__ */ e(
|
|
90
|
+
/* @__PURE__ */ e(o.Text, { children: new n("The text you can edit") })
|
|
91
91
|
] }),
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
|
-
|
|
93
|
+
t.DialogClose,
|
|
94
94
|
{
|
|
95
95
|
"ws:label": "Close Button",
|
|
96
96
|
"ws:style": i`
|
|
97
97
|
position: absolute;
|
|
98
98
|
right: ${l[4]};
|
|
99
99
|
top: ${l[4]};
|
|
100
|
-
border-radius: ${
|
|
101
|
-
opacity: ${
|
|
100
|
+
border-radius: ${f.sm};
|
|
101
|
+
opacity: ${c[70]};
|
|
102
102
|
display: flex;
|
|
103
103
|
align-items: center;
|
|
104
104
|
justify-content: center;
|
|
105
|
-
height: ${
|
|
106
|
-
width: ${
|
|
105
|
+
height: ${g[4]};
|
|
106
|
+
width: ${g[4]};
|
|
107
107
|
border: 0;
|
|
108
108
|
background-color: transparent;
|
|
109
109
|
outline: none;
|
|
110
110
|
&:hover {
|
|
111
|
-
opacity: ${
|
|
111
|
+
opacity: ${c[100]};
|
|
112
112
|
}
|
|
113
113
|
&:focus-visible {
|
|
114
|
-
box-shadow: ${
|
|
114
|
+
box-shadow: ${h.ring};
|
|
115
115
|
}
|
|
116
116
|
`,
|
|
117
|
-
children: /* @__PURE__ */ e(
|
|
117
|
+
children: /* @__PURE__ */ e(o.HtmlEmbed, { "ws:label": "Close Icon", code: b })
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
]
|
package/lib/switch.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useState as n, useEffect as s } from "react";
|
|
3
|
+
import { Thumb as d, Root as u } from "@radix-ui/react-switch";
|
|
4
|
+
const C = m(({ defaultChecked: o, ...t }, r) => {
|
|
5
|
+
const e = t.checked ?? o ?? !1, [h, c] = n(e);
|
|
6
|
+
return s(() => c(e), [e]), /* @__PURE__ */ f(u, { ...t, ref: r, checked: h, onCheckedChange: c });
|
|
7
|
+
}), w = d;
|
|
5
8
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
C as Switch,
|
|
10
|
+
w as SwitchThumb
|
|
8
11
|
};
|
package/lib/switch.template.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { css as r } from "@webstudio-is/template";
|
|
3
3
|
import { radix as e } from "./shared/proxy.js";
|
|
4
|
-
import {
|
|
4
|
+
import { height as d, width as s, borderRadius as a, colors as t, boxShadow as i, transition as n, borderWidth as c, opacity as l } from "./shared/theme.js";
|
|
5
5
|
const m = {
|
|
6
6
|
category: "radix",
|
|
7
7
|
description: "A control that allows the user to toggle between checked and not checked.",
|
|
@@ -17,15 +17,15 @@ const m = {
|
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
align-items: center;
|
|
19
19
|
border-radius: ${a.full};
|
|
20
|
-
border: ${
|
|
21
|
-
transition: ${
|
|
20
|
+
border: ${c[2]} solid transparent;
|
|
21
|
+
transition: ${n.all};
|
|
22
22
|
&:focus-visible {
|
|
23
23
|
outline: none;
|
|
24
|
-
box-shadow: ${
|
|
24
|
+
box-shadow: ${i.ring};
|
|
25
25
|
}
|
|
26
26
|
&:disabled {
|
|
27
27
|
cursor: not-allowed;
|
|
28
|
-
opacity: ${
|
|
28
|
+
opacity: ${l[50]};
|
|
29
29
|
}
|
|
30
30
|
&[data-state="checked"] {
|
|
31
31
|
background-color: ${t.primary};
|
|
@@ -40,12 +40,12 @@ const m = {
|
|
|
40
40
|
"ws:style": r`
|
|
41
41
|
pointer-events: none;
|
|
42
42
|
display: block;
|
|
43
|
-
height: ${
|
|
44
|
-
width: ${
|
|
43
|
+
height: ${d[5]};
|
|
44
|
+
width: ${s[5]};
|
|
45
45
|
border-radius: ${a.full};
|
|
46
46
|
background-color: ${t.background};
|
|
47
|
-
box-shadow: ${
|
|
48
|
-
transition: ${
|
|
47
|
+
box-shadow: ${i.lg};
|
|
48
|
+
transition: ${n.transform};
|
|
49
49
|
&[data-state="checked"] {
|
|
50
50
|
transform: translateX(20px);
|
|
51
51
|
}
|
package/lib/switch.ws.js
CHANGED
|
@@ -1,63 +1,40 @@
|
|
|
1
|
-
import { SwitchIcon as e, TriggerIcon as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { buttonReset as
|
|
5
|
-
import { propsSwitch as
|
|
6
|
-
const
|
|
7
|
-
type: "container",
|
|
8
|
-
constraints: {
|
|
9
|
-
relation: "descendant",
|
|
10
|
-
component: { $eq: "SwitchThumb" }
|
|
11
|
-
},
|
|
1
|
+
import { SwitchIcon as e, TriggerIcon as t } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { button as c, span as o } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as a } from "./shared/meta.js";
|
|
4
|
+
import { buttonReset as n } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsSwitch as r, propsSwitchThumb as s } from "./__generated__/switch.props.js";
|
|
6
|
+
const m = {
|
|
12
7
|
icon: e,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "instance",
|
|
10
|
+
children: ["instance"],
|
|
11
|
+
descendants: [a.SwitchThumb]
|
|
12
|
+
},
|
|
13
13
|
states: [
|
|
14
|
-
|
|
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
|
-
}
|
|
14
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
15
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
25
16
|
],
|
|
26
17
|
presetStyle: {
|
|
27
|
-
button: [c,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
button: [c, n].flat()
|
|
19
|
+
},
|
|
20
|
+
initialProps: ["id", "class", "name", "value", "checked", "required"],
|
|
21
|
+
props: r
|
|
22
|
+
}, b = {
|
|
23
|
+
icon: t,
|
|
24
|
+
contentModel: {
|
|
25
|
+
category: "none",
|
|
26
|
+
children: ["instance"]
|
|
34
27
|
},
|
|
35
|
-
icon: o,
|
|
36
28
|
states: [
|
|
37
|
-
|
|
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
|
-
}
|
|
29
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
30
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
48
31
|
],
|
|
49
32
|
presetStyle: {
|
|
50
|
-
span:
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
props: n,
|
|
54
|
-
initialProps: ["id", "className", "name", "value", "checked", "required"]
|
|
55
|
-
}, b = {
|
|
56
|
-
props: r
|
|
33
|
+
span: o
|
|
34
|
+
},
|
|
35
|
+
props: s
|
|
57
36
|
};
|
|
58
37
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
S as propsMetaSwitch,
|
|
62
|
-
b as propsMetaSwitchThumb
|
|
38
|
+
m as metaSwitch,
|
|
39
|
+
b as metaSwitchThumb
|
|
63
40
|
};
|
package/lib/tabs.js
CHANGED
|
@@ -1,65 +1,62 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
}),
|
|
28
|
-
const
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
return /* @__PURE__ */ i(T, { ref: o, value: e ?? n ?? "", ...t });
|
|
33
|
-
}), r = "@webstudio-is/sdk-components-react-radix", A = {
|
|
34
|
-
onNavigatorSelect: (e, t) => {
|
|
2
|
+
import f from "await-interaction-response";
|
|
3
|
+
import { forwardRef as c, useState as b, useEffect as T, useCallback as d } from "react";
|
|
4
|
+
import { List as p, Root as h, Trigger as v, Content as P } from "@radix-ui/react-tabs";
|
|
5
|
+
import { getIndexWithinAncestorFromProps as l } from "@webstudio-is/sdk/runtime";
|
|
6
|
+
import { getClosestInstance as u } from "@webstudio-is/react-sdk/runtime";
|
|
7
|
+
const w = c(
|
|
8
|
+
({ defaultValue: n, ...e }, o) => {
|
|
9
|
+
const t = e.value ?? n ?? "", [s, a] = b(t);
|
|
10
|
+
T(() => a(t), [t]);
|
|
11
|
+
const m = d(async (g) => {
|
|
12
|
+
await f(), a(g);
|
|
13
|
+
}, []);
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
h,
|
|
16
|
+
{
|
|
17
|
+
ref: o,
|
|
18
|
+
...e,
|
|
19
|
+
value: s,
|
|
20
|
+
onValueChange: m
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
), y = p, A = c(({ value: n, ...e }, o) => {
|
|
25
|
+
const t = l(e);
|
|
26
|
+
return /* @__PURE__ */ i(v, { ref: o, value: n ?? t ?? "", ...e });
|
|
27
|
+
}), R = c(({ value: n, ...e }, o) => {
|
|
28
|
+
const t = l(e);
|
|
29
|
+
return /* @__PURE__ */ i(P, { ref: o, value: n ?? t ?? "", ...e });
|
|
30
|
+
}), r = "@webstudio-is/sdk-components-react-radix", W = {
|
|
31
|
+
onNavigatorSelect: (n, e) => {
|
|
35
32
|
var o;
|
|
36
|
-
for (const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
for (const t of e.instancePath)
|
|
34
|
+
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
35
|
+
const s = u(
|
|
36
|
+
e.instancePath,
|
|
37
|
+
t,
|
|
41
38
|
`${r}:Tabs`
|
|
42
|
-
),
|
|
43
|
-
|
|
39
|
+
), a = n.getPropValue(t, "value") ?? ((o = n.indexesWithinAncestors.get(t.id)) == null ? void 0 : o.toString());
|
|
40
|
+
s && a && n.setMemoryProp(s, "value", a);
|
|
44
41
|
}
|
|
45
42
|
},
|
|
46
|
-
onNavigatorUnselect: (
|
|
43
|
+
onNavigatorUnselect: (n, e) => {
|
|
47
44
|
var o;
|
|
48
|
-
for (const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
for (const t of e.instancePath)
|
|
46
|
+
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
47
|
+
const s = u(
|
|
48
|
+
e.instancePath,
|
|
49
|
+
t,
|
|
53
50
|
`${r}:Tabs`
|
|
54
|
-
),
|
|
55
|
-
|
|
51
|
+
), a = n.getPropValue(t, "value") ?? ((o = n.indexesWithinAncestors.get(t.id)) == null ? void 0 : o.toString());
|
|
52
|
+
s && a && n.setMemoryProp(s, "value", void 0);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
};
|
|
59
56
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
w as Tabs,
|
|
58
|
+
R as TabsContent,
|
|
59
|
+
y as TabsList,
|
|
60
|
+
A as TabsTrigger,
|
|
61
|
+
W as hooksTabs
|
|
65
62
|
};
|
package/lib/tabs.template.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { PlaceholderValue as o, css as a } from "@webstudio-is/template";
|
|
3
3
|
import { radix as e } from "./shared/proxy.js";
|
|
4
|
-
import {
|
|
4
|
+
import { height as g, borderRadius as l, colors as n, spacing as i, fontSize as h, fontSizeLineHeight as b, weights as p, transition as u, boxShadow as r, opacity as m } from "./shared/theme.js";
|
|
5
5
|
const d = a`
|
|
6
6
|
display: inline-flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
white-space: nowrap;
|
|
10
10
|
border-radius: ${l.md};
|
|
11
|
-
padding: ${
|
|
12
|
-
font-size: ${
|
|
13
|
-
line-height: ${
|
|
14
|
-
font-weight: ${
|
|
15
|
-
transition: ${
|
|
11
|
+
padding: ${i[1.5]} ${i[3]};
|
|
12
|
+
font-size: ${h.sm};
|
|
13
|
+
line-height: ${b.sm};
|
|
14
|
+
font-weight: ${p.medium};
|
|
15
|
+
transition: ${u.all};
|
|
16
16
|
&:focus-visible {
|
|
17
17
|
outline: 2px solid transparent;
|
|
18
18
|
outline-offset: 2px;
|
|
@@ -20,15 +20,15 @@ const d = a`
|
|
|
20
20
|
}
|
|
21
21
|
&:disabled {
|
|
22
22
|
pointer-events: none;
|
|
23
|
-
opacity: ${
|
|
23
|
+
opacity: ${m[50]};
|
|
24
24
|
}
|
|
25
25
|
&[data-state="active"] {
|
|
26
|
-
background-color: ${
|
|
27
|
-
color: ${
|
|
26
|
+
background-color: ${n.background};
|
|
27
|
+
color: ${n.foreground};
|
|
28
28
|
box-shadow: ${r.sm};
|
|
29
29
|
}
|
|
30
30
|
`, c = a`
|
|
31
|
-
margin-top: ${
|
|
31
|
+
margin-top: ${i[2]};
|
|
32
32
|
&:focus-visible {
|
|
33
33
|
outline: none;
|
|
34
34
|
box-shadow: ${r.ring};
|
|
@@ -37,19 +37,19 @@ const d = a`
|
|
|
37
37
|
category: "radix",
|
|
38
38
|
description: "A set of panels with content that are displayed one at a time. Duplicate both a tab trigger and tab content to add more tabs. Triggers and content are connected according to their order in the Navigator.",
|
|
39
39
|
order: 2,
|
|
40
|
-
template: /* @__PURE__ */ s(e.Tabs, {
|
|
40
|
+
template: /* @__PURE__ */ s(e.Tabs, { value: "0", children: [
|
|
41
41
|
/* @__PURE__ */ s(
|
|
42
42
|
e.TabsList,
|
|
43
43
|
{
|
|
44
44
|
"ws:style": a`
|
|
45
45
|
display: inline-flex;
|
|
46
|
-
height: ${
|
|
46
|
+
height: ${g[10]};
|
|
47
47
|
align-items: center;
|
|
48
48
|
justify-content: center;
|
|
49
49
|
border-radius: ${l.md};
|
|
50
|
-
background-color: ${
|
|
51
|
-
padding: ${
|
|
52
|
-
color: ${
|
|
50
|
+
background-color: ${n.muted};
|
|
51
|
+
padding: ${i[1]};
|
|
52
|
+
color: ${n.mutedForeground};
|
|
53
53
|
`,
|
|
54
54
|
children: [
|
|
55
55
|
/* @__PURE__ */ t(e.TabsTrigger, { "ws:style": d, children: new o("Account") }),
|