@webstudio-is/sdk-components-react-radix 0.0.0-017f1bd
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 +64 -0
- package/lib/__generated__/checkbox.props.js +18 -0
- package/lib/__generated__/collapsible.props.js +19 -0
- package/lib/__generated__/dialog.props.js +24 -0
- package/lib/__generated__/label.props.js +4 -0
- package/lib/__generated__/navigation-menu.props.js +48 -0
- package/lib/__generated__/popover.props.js +62 -0
- package/lib/__generated__/radio-group.props.js +70 -0
- package/lib/__generated__/select.props.js +114 -0
- package/lib/__generated__/switch.props.js +18 -0
- package/lib/__generated__/tabs.props.js +65 -0
- package/lib/__generated__/tooltip.props.js +78 -0
- package/lib/accordion.js +49 -0
- package/lib/accordion.template.js +95 -0
- package/lib/accordion.ws.js +80 -0
- package/lib/checkbox.js +19 -0
- package/lib/checkbox.template.js +63 -0
- package/lib/checkbox.ws.js +36 -0
- package/lib/collapsible.js +40 -0
- package/lib/collapsible.template.js +16 -0
- package/lib/collapsible.ws.js +39 -0
- package/lib/components.js +63 -0
- package/lib/dialog.js +96 -0
- package/lib/dialog.template.js +119 -0
- package/lib/dialog.ws.js +80 -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 +12 -0
- package/lib/metas.js +63 -0
- package/lib/navigation-menu.js +60 -0
- package/lib/navigation-menu.template.js +283 -0
- package/lib/navigation-menu.ws.js +93 -0
- package/lib/popover.js +52 -0
- package/lib/popover.template.js +63 -0
- package/lib/popover.ws.js +51 -0
- package/lib/radio-group.js +12 -0
- package/lib/radio-group.template.js +66 -0
- package/lib/radio-group.ws.js +49 -0
- package/lib/select.js +58 -0
- package/lib/select.template.js +121 -0
- package/lib/select.ws.js +89 -0
- package/lib/shared/meta.js +13 -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 +119 -0
- package/lib/sheet.template.js +129 -0
- package/lib/switch.js +11 -0
- package/lib/switch.template.js +63 -0
- package/lib/switch.ws.js +40 -0
- package/lib/tabs.js +62 -0
- package/lib/tabs.template.js +66 -0
- package/lib/tabs.ws.js +53 -0
- package/lib/templates.js +28 -0
- package/lib/tooltip.js +48 -0
- package/lib/tooltip.template.js +33 -0
- package/lib/tooltip.ws.js +35 -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 +5 -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 +6 -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 +3 -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 +4 -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 +8 -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 +2 -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 +8 -0
- package/lib/types/popover.d.ts +16 -0
- package/lib/types/popover.template.d.ts +10 -0
- package/lib/types/popover.ws.d.ts +5 -0
- package/lib/types/props-descriptions.d.ts +29 -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 +4 -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 +9 -0
- package/lib/types/shared/meta.d.ts +1 -0
- package/lib/types/shared/preset-styles.d.ts +2 -0
- package/lib/types/shared/proxy.d.ts +16 -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 +3 -0
- package/lib/types/tabs.d.ts +10 -0
- package/lib/types/tabs.template.d.ts +2 -0
- package/lib/types/tabs.ws.d.ts +5 -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 +4 -0
- package/package.json +79 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
const n = {
|
|
2
|
+
sm: "0.875rem",
|
|
3
|
+
lg: "1.125rem"
|
|
4
|
+
}, t = {
|
|
5
|
+
sm: "1.25rem"
|
|
6
|
+
}, g = {
|
|
7
|
+
none: "1",
|
|
8
|
+
snug: "1.375"
|
|
9
|
+
}, s = {
|
|
10
|
+
medium: "500"
|
|
11
|
+
}, c = {
|
|
12
|
+
tight: "-0.025em"
|
|
13
|
+
}, m = {
|
|
14
|
+
0: "0px",
|
|
15
|
+
1: "0.25rem",
|
|
16
|
+
2: "0.5rem",
|
|
17
|
+
3: "0.75rem",
|
|
18
|
+
4: "1rem",
|
|
19
|
+
5: "1.25rem",
|
|
20
|
+
6: "1.5rem",
|
|
21
|
+
7: "1.75rem",
|
|
22
|
+
8: "2rem",
|
|
23
|
+
9: "2.25rem",
|
|
24
|
+
10: "2.5rem",
|
|
25
|
+
11: "2.75rem",
|
|
26
|
+
12: "3rem",
|
|
27
|
+
14: "3.5rem",
|
|
28
|
+
16: "4rem",
|
|
29
|
+
20: "5rem",
|
|
30
|
+
24: "6rem",
|
|
31
|
+
28: "7rem",
|
|
32
|
+
32: "8rem",
|
|
33
|
+
36: "9rem",
|
|
34
|
+
40: "10rem",
|
|
35
|
+
44: "11rem",
|
|
36
|
+
48: "12rem",
|
|
37
|
+
52: "13rem",
|
|
38
|
+
56: "14rem",
|
|
39
|
+
60: "15rem",
|
|
40
|
+
64: "16rem",
|
|
41
|
+
72: "18rem",
|
|
42
|
+
80: "20rem",
|
|
43
|
+
96: "24rem",
|
|
44
|
+
px: "1px",
|
|
45
|
+
"0.5": "0.125rem",
|
|
46
|
+
"1.5": "0.375rem",
|
|
47
|
+
"2.5": "0.625rem",
|
|
48
|
+
"3.5": "0.875rem"
|
|
49
|
+
}, p = {
|
|
50
|
+
...m,
|
|
51
|
+
full: "100%"
|
|
52
|
+
}, i = {
|
|
53
|
+
...m
|
|
54
|
+
}, b = {
|
|
55
|
+
sm: "24rem",
|
|
56
|
+
lg: "32rem"
|
|
57
|
+
}, x = {
|
|
58
|
+
2: "2px",
|
|
59
|
+
DEFAULT: "1px"
|
|
60
|
+
}, d = {
|
|
61
|
+
sm: "0.125rem",
|
|
62
|
+
md: "0.375rem",
|
|
63
|
+
full: "9999px"
|
|
64
|
+
}, r = {
|
|
65
|
+
popover: "rgb(255, 255, 255)",
|
|
66
|
+
popoverForeground: "rgb(2, 8, 23)",
|
|
67
|
+
border: "rgb(226, 232, 240)",
|
|
68
|
+
background: "rgb(255, 255, 255)",
|
|
69
|
+
foreground: "hsl(222.2 84% 4.9%)",
|
|
70
|
+
ring: "rgb(148, 163, 184)",
|
|
71
|
+
mutedForeground: "rgb(100, 116, 139)",
|
|
72
|
+
muted: "hsl(210 40% 96.1%)",
|
|
73
|
+
primary: "rgb(15, 23, 42)",
|
|
74
|
+
primaryForeground: "hsl(210 40% 98%)",
|
|
75
|
+
accent: "rgb(241, 245, 249)",
|
|
76
|
+
accentForeground: "rgb(15, 23, 42)",
|
|
77
|
+
input: "rgb(226, 232, 240)"
|
|
78
|
+
}, l = {
|
|
79
|
+
all: "all 150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
80
|
+
transform: "transform 150ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
81
|
+
}, u = {
|
|
82
|
+
50: "0.5",
|
|
83
|
+
70: "0.7",
|
|
84
|
+
100: "1"
|
|
85
|
+
}, o = {
|
|
86
|
+
2: "2px"
|
|
87
|
+
}, e = {
|
|
88
|
+
2: "2px"
|
|
89
|
+
}, a = {
|
|
90
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
91
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
92
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
93
|
+
// 0 0 0 ringOffsetWidth ringOffsetColor
|
|
94
|
+
// 0 0 0 ringWidth + ringOffsetWidth ringColor
|
|
95
|
+
ring: `0 0 0 ${e[2]} ${r.background}, 0 0 0 calc(${o[2]} + ${e[2]}) ${r.ring}`
|
|
96
|
+
}, h = {
|
|
97
|
+
50: "50"
|
|
98
|
+
}, f = {
|
|
99
|
+
sm: "blur(0 1px 2px 0 rgb(0 0 0 / 0.05))"
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
f as blur,
|
|
103
|
+
d as borderRadius,
|
|
104
|
+
x as borderWidth,
|
|
105
|
+
a as boxShadow,
|
|
106
|
+
r as colors,
|
|
107
|
+
n as fontSize,
|
|
108
|
+
t as fontSizeLineHeight,
|
|
109
|
+
i as height,
|
|
110
|
+
c as letterSpacing,
|
|
111
|
+
g as lineHeight,
|
|
112
|
+
b as maxWidth,
|
|
113
|
+
u as opacity,
|
|
114
|
+
m as spacing,
|
|
115
|
+
l as transition,
|
|
116
|
+
s as weights,
|
|
117
|
+
p as width,
|
|
118
|
+
h as zIndex
|
|
119
|
+
};
|
|
@@ -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 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
|
+
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(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
|
+
/* @__PURE__ */ e(
|
|
15
|
+
t.DialogOverlay,
|
|
16
|
+
{
|
|
17
|
+
"ws:label": "Sheet Overlay",
|
|
18
|
+
"ws:style": i`
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0;
|
|
21
|
+
z-index: ${m[50]};
|
|
22
|
+
background-color: rgb(255 255 255 / 0.8);
|
|
23
|
+
backdrop-filter: ${S.sm};
|
|
24
|
+
/* To allow positioning Content */
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
`,
|
|
29
|
+
children: /* @__PURE__ */ r(
|
|
30
|
+
t.DialogContent,
|
|
31
|
+
{
|
|
32
|
+
"ws:label": "Sheet Content",
|
|
33
|
+
"ws:style": i`
|
|
34
|
+
width: ${x.full};
|
|
35
|
+
z-index: ${m[50]};
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: ${l[4]};
|
|
39
|
+
border: ${$.DEFAULT} solid ${a.border};
|
|
40
|
+
background-color: ${a.background};
|
|
41
|
+
padding: ${l[6]};
|
|
42
|
+
box-shadow: ${h.lg};
|
|
43
|
+
position: relative;
|
|
44
|
+
/* side=left */
|
|
45
|
+
margin-right: auto;
|
|
46
|
+
max-width: ${y.sm};
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
`,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ r(o.Box, { "ws:label": "Navigation", "ws:tag": "nav", children: [
|
|
51
|
+
/* @__PURE__ */ r(
|
|
52
|
+
o.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
|
+
t.DialogTitle,
|
|
63
|
+
{
|
|
64
|
+
"ws:label": "Sheet Title",
|
|
65
|
+
"ws:style": i`
|
|
66
|
+
font-size: ${d.lg};
|
|
67
|
+
line-height: ${p.none};
|
|
68
|
+
letter-spacing: ${u.tight};
|
|
69
|
+
margin: 0;
|
|
70
|
+
`,
|
|
71
|
+
children: new n("Sheet Title")
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ e(
|
|
75
|
+
t.DialogDescription,
|
|
76
|
+
{
|
|
77
|
+
"ws:label": "Sheet Description",
|
|
78
|
+
"ws:style": i`
|
|
79
|
+
font-size: ${d.sm};
|
|
80
|
+
line-height: ${w.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(o.Text, { children: new n("The text you can edit") })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
t.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: ${f.sm};
|
|
101
|
+
opacity: ${c[70]};
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
height: ${g[4]};
|
|
106
|
+
width: ${g[4]};
|
|
107
|
+
border: 0;
|
|
108
|
+
background-color: transparent;
|
|
109
|
+
outline: none;
|
|
110
|
+
&:hover {
|
|
111
|
+
opacity: ${c[100]};
|
|
112
|
+
}
|
|
113
|
+
&:focus-visible {
|
|
114
|
+
box-shadow: ${h.ring};
|
|
115
|
+
}
|
|
116
|
+
`,
|
|
117
|
+
children: /* @__PURE__ */ e(o.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,11 @@
|
|
|
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;
|
|
8
|
+
export {
|
|
9
|
+
C as Switch,
|
|
10
|
+
w as SwitchThumb
|
|
11
|
+
};
|
|
@@ -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 { 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
|
+
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: ${c[2]} solid transparent;
|
|
21
|
+
transition: ${n.all};
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
outline: none;
|
|
24
|
+
box-shadow: ${i.ring};
|
|
25
|
+
}
|
|
26
|
+
&:disabled {
|
|
27
|
+
cursor: not-allowed;
|
|
28
|
+
opacity: ${l[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: ${d[5]};
|
|
44
|
+
width: ${s[5]};
|
|
45
|
+
border-radius: ${a.full};
|
|
46
|
+
background-color: ${t.background};
|
|
47
|
+
box-shadow: ${i.lg};
|
|
48
|
+
transition: ${n.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,40 @@
|
|
|
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 = {
|
|
7
|
+
icon: e,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "instance",
|
|
10
|
+
children: ["instance"],
|
|
11
|
+
descendants: [a.SwitchThumb]
|
|
12
|
+
},
|
|
13
|
+
states: [
|
|
14
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
15
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
16
|
+
],
|
|
17
|
+
presetStyle: {
|
|
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"]
|
|
27
|
+
},
|
|
28
|
+
states: [
|
|
29
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
30
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
31
|
+
],
|
|
32
|
+
presetStyle: {
|
|
33
|
+
span: o
|
|
34
|
+
},
|
|
35
|
+
props: s
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
m as metaSwitch,
|
|
39
|
+
b as metaSwitchThumb
|
|
40
|
+
};
|
package/lib/tabs.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
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) => {
|
|
32
|
+
var o;
|
|
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,
|
|
38
|
+
`${r}:Tabs`
|
|
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);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
onNavigatorUnselect: (n, e) => {
|
|
44
|
+
var o;
|
|
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,
|
|
50
|
+
`${r}:Tabs`
|
|
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);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
w as Tabs,
|
|
58
|
+
R as TabsContent,
|
|
59
|
+
y as TabsList,
|
|
60
|
+
A as TabsTrigger,
|
|
61
|
+
W as hooksTabs
|
|
62
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { PlaceholderValue as o, css as a } from "@webstudio-is/template";
|
|
3
|
+
import { radix as e } from "./shared/proxy.js";
|
|
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
|
+
const d = a`
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
border-radius: ${l.md};
|
|
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
|
+
&:focus-visible {
|
|
17
|
+
outline: 2px solid transparent;
|
|
18
|
+
outline-offset: 2px;
|
|
19
|
+
box-shadow: ${r.ring};
|
|
20
|
+
}
|
|
21
|
+
&:disabled {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
opacity: ${m[50]};
|
|
24
|
+
}
|
|
25
|
+
&[data-state="active"] {
|
|
26
|
+
background-color: ${n.background};
|
|
27
|
+
color: ${n.foreground};
|
|
28
|
+
box-shadow: ${r.sm};
|
|
29
|
+
}
|
|
30
|
+
`, c = a`
|
|
31
|
+
margin-top: ${i[2]};
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
outline: none;
|
|
34
|
+
box-shadow: ${r.ring};
|
|
35
|
+
}
|
|
36
|
+
`, x = {
|
|
37
|
+
category: "radix",
|
|
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
|
+
order: 2,
|
|
40
|
+
template: /* @__PURE__ */ s(e.Tabs, { value: "0", children: [
|
|
41
|
+
/* @__PURE__ */ s(
|
|
42
|
+
e.TabsList,
|
|
43
|
+
{
|
|
44
|
+
"ws:style": a`
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
height: ${g[10]};
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
border-radius: ${l.md};
|
|
50
|
+
background-color: ${n.muted};
|
|
51
|
+
padding: ${i[1]};
|
|
52
|
+
color: ${n.mutedForeground};
|
|
53
|
+
`,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ t(e.TabsTrigger, { "ws:style": d, children: new o("Account") }),
|
|
56
|
+
/* @__PURE__ */ t(e.TabsTrigger, { "ws:style": d, children: new o("Password") })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ t(e.TabsContent, { "ws:style": c, children: new o("Make changes to your account here.") }),
|
|
61
|
+
/* @__PURE__ */ t(e.TabsContent, { "ws:style": c, children: new o("Change your password here.") })
|
|
62
|
+
] })
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
x as meta
|
|
66
|
+
};
|
package/lib/tabs.ws.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TabsIcon as n, HeaderIcon as o, TriggerIcon as s, ContentIcon as r } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as e, button as a } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as t } from "./shared/meta.js";
|
|
4
|
+
import { buttonReset as c } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsTabs as i, propsTabsList as p, propsTabsTrigger as b, propsTabsContent as T } from "./__generated__/tabs.props.js";
|
|
6
|
+
const y = {
|
|
7
|
+
icon: n,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "instance",
|
|
10
|
+
children: ["instance"],
|
|
11
|
+
descendants: [t.TabsList, t.TabsContent]
|
|
12
|
+
},
|
|
13
|
+
presetStyle: { div: e },
|
|
14
|
+
props: i
|
|
15
|
+
}, f = {
|
|
16
|
+
icon: o,
|
|
17
|
+
contentModel: {
|
|
18
|
+
category: "none",
|
|
19
|
+
children: ["instance"],
|
|
20
|
+
descendants: [t.TabsTrigger]
|
|
21
|
+
},
|
|
22
|
+
presetStyle: { div: e },
|
|
23
|
+
props: p
|
|
24
|
+
}, x = {
|
|
25
|
+
icon: s,
|
|
26
|
+
label: "Tab Trigger",
|
|
27
|
+
indexWithinAncestor: t.Tabs,
|
|
28
|
+
contentModel: {
|
|
29
|
+
category: "none",
|
|
30
|
+
children: ["instance", "rich-text"]
|
|
31
|
+
},
|
|
32
|
+
states: [{ label: "Active", selector: "[data-state=active]" }],
|
|
33
|
+
presetStyle: {
|
|
34
|
+
button: [a, c].flat()
|
|
35
|
+
},
|
|
36
|
+
props: b
|
|
37
|
+
}, C = {
|
|
38
|
+
label: "Tab Content",
|
|
39
|
+
icon: r,
|
|
40
|
+
indexWithinAncestor: t.Tabs,
|
|
41
|
+
contentModel: {
|
|
42
|
+
category: "none",
|
|
43
|
+
children: ["instance", "rich-text"]
|
|
44
|
+
},
|
|
45
|
+
presetStyle: { div: e },
|
|
46
|
+
props: T
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
y as metaTabs,
|
|
50
|
+
C as metaTabsContent,
|
|
51
|
+
f as metaTabsList,
|
|
52
|
+
x as metaTabsTrigger
|
|
53
|
+
};
|
package/lib/templates.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { meta as a } from "./label.template.js";
|
|
2
|
+
import { meta as r } from "./tabs.template.js";
|
|
3
|
+
import { meta as p } from "./sheet.template.js";
|
|
4
|
+
import { meta as x } from "./dialog.template.js";
|
|
5
|
+
import { meta as i } from "./switch.template.js";
|
|
6
|
+
import { meta as c } from "./checkbox.template.js";
|
|
7
|
+
import { meta as h } from "./collapsible.template.js";
|
|
8
|
+
import { meta as S } from "./accordion.template.js";
|
|
9
|
+
import { meta as g } from "./tooltip.template.js";
|
|
10
|
+
import { meta as v } from "./popover.template.js";
|
|
11
|
+
import { meta as T } from "./radio-group.template.js";
|
|
12
|
+
import { meta as w } from "./select.template.js";
|
|
13
|
+
import { meta as D } from "./navigation-menu.template.js";
|
|
14
|
+
export {
|
|
15
|
+
S as Accordion,
|
|
16
|
+
c as Checkbox,
|
|
17
|
+
h as Collapsible,
|
|
18
|
+
x as Dialog,
|
|
19
|
+
a as Label,
|
|
20
|
+
D as NavigationMenu,
|
|
21
|
+
v as Popover,
|
|
22
|
+
T as RadioGroup,
|
|
23
|
+
w as Select,
|
|
24
|
+
p as Sheet,
|
|
25
|
+
i as Switch,
|
|
26
|
+
r as Tabs,
|
|
27
|
+
g as Tooltip
|
|
28
|
+
};
|
package/lib/tooltip.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "@radix-ui/react-tooltip";
|
|
3
|
+
import { getClosestInstance as p } from "@webstudio-is/react-sdk/runtime";
|
|
4
|
+
import { forwardRef as c, useState as l, useEffect as f, Children as d } from "react";
|
|
5
|
+
const T = c((n, e) => {
|
|
6
|
+
const o = n.open ?? !1, [t, a] = l(o);
|
|
7
|
+
return f(() => a(o), [o]), /* @__PURE__ */ r(i.Provider, { children: /* @__PURE__ */ r(i.Root, { ...n, open: t, onOpenChange: a }) });
|
|
8
|
+
}), C = c(({ children: n, ...e }, o) => {
|
|
9
|
+
const t = d.toArray(n)[0];
|
|
10
|
+
return /* @__PURE__ */ r(i.Trigger, { asChild: !0, ref: o, ...e, children: t ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
11
|
+
}), P = c(({ sideOffset: n = 4, hideWhenDetached: e = !0, ...o }, t) => /* @__PURE__ */ r(i.Portal, { children: /* @__PURE__ */ r(
|
|
12
|
+
i.Content,
|
|
13
|
+
{
|
|
14
|
+
ref: t,
|
|
15
|
+
hideWhenDetached: e,
|
|
16
|
+
sideOffset: n,
|
|
17
|
+
...o
|
|
18
|
+
}
|
|
19
|
+
) })), s = "@webstudio-is/sdk-components-react-radix", g = {
|
|
20
|
+
onNavigatorUnselect: (n, e) => {
|
|
21
|
+
for (const o of e.instancePath)
|
|
22
|
+
if (o.component === `${s}:TooltipContent`) {
|
|
23
|
+
const t = p(
|
|
24
|
+
e.instancePath,
|
|
25
|
+
o,
|
|
26
|
+
`${s}:Tooltip`
|
|
27
|
+
);
|
|
28
|
+
t && n.setMemoryProp(t, "open", void 0);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onNavigatorSelect: (n, e) => {
|
|
32
|
+
for (const o of e.instancePath)
|
|
33
|
+
if (o.component === `${s}:TooltipContent`) {
|
|
34
|
+
const t = p(
|
|
35
|
+
e.instancePath,
|
|
36
|
+
o,
|
|
37
|
+
`${s}:Tooltip`
|
|
38
|
+
);
|
|
39
|
+
t && n.setMemoryProp(t, "open", !0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
T as Tooltip,
|
|
45
|
+
P as TooltipContent,
|
|
46
|
+
C as TooltipTrigger,
|
|
47
|
+
g as hooksTooltip
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { $ as t, PlaceholderValue as r, css as l } from "@webstudio-is/template";
|
|
3
|
+
import { radix as e } from "./shared/proxy.js";
|
|
4
|
+
import { getButtonStyle as s } from "./shared/styles.js";
|
|
5
|
+
import { zIndex as a, borderRadius as h, colors as i, spacing as n, fontSize as p, fontSizeLineHeight as c, boxShadow as m } from "./shared/theme.js";
|
|
6
|
+
const $ = {
|
|
7
|
+
category: "radix",
|
|
8
|
+
description: "Displays content that is related to the trigger, when the trigger is hovered with the mouse or focused with the keyboard. You are reading an example of a tooltip right now.",
|
|
9
|
+
order: 7,
|
|
10
|
+
template: /* @__PURE__ */ d(e.Tooltip, { children: [
|
|
11
|
+
/* @__PURE__ */ o(e.TooltipTrigger, { children: /* @__PURE__ */ o(t.Button, { "ws:style": s("outline"), children: new r("Button") }) }),
|
|
12
|
+
/* @__PURE__ */ o(
|
|
13
|
+
e.TooltipContent,
|
|
14
|
+
{
|
|
15
|
+
"ws:style": l`
|
|
16
|
+
z-index: ${a[50]};
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
border-radius: ${h.md};
|
|
19
|
+
background-color: ${i.popover};
|
|
20
|
+
padding: ${n[1.5]} ${n[3]};
|
|
21
|
+
font-size: ${p.sm};
|
|
22
|
+
line-height: ${c.sm};
|
|
23
|
+
color: ${i.popoverForeground};
|
|
24
|
+
box-shadow: ${m.md};
|
|
25
|
+
`,
|
|
26
|
+
children: /* @__PURE__ */ o(t.Text, { children: new r("The text you can edit") })
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] })
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
$ as meta
|
|
33
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TooltipIcon as t, TriggerIcon as n, ContentIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as i } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as o } from "./shared/meta.js";
|
|
4
|
+
import { propsTooltip as r, propsTooltipTrigger as p, propsTooltipContent as c } from "./__generated__/tooltip.props.js";
|
|
5
|
+
const g = {
|
|
6
|
+
icon: n,
|
|
7
|
+
contentModel: {
|
|
8
|
+
category: "none",
|
|
9
|
+
children: ["instance"]
|
|
10
|
+
},
|
|
11
|
+
props: p
|
|
12
|
+
}, T = {
|
|
13
|
+
icon: e,
|
|
14
|
+
contentModel: {
|
|
15
|
+
category: "none",
|
|
16
|
+
children: ["instance"]
|
|
17
|
+
},
|
|
18
|
+
presetStyle: { div: i },
|
|
19
|
+
initialProps: ["side", "sideOffset", "align", "alignOffset"],
|
|
20
|
+
props: c
|
|
21
|
+
}, m = {
|
|
22
|
+
icon: t,
|
|
23
|
+
contentModel: {
|
|
24
|
+
category: "instance",
|
|
25
|
+
children: ["instance"],
|
|
26
|
+
descendants: [o.TooltipTrigger, o.TooltipContent]
|
|
27
|
+
},
|
|
28
|
+
initialProps: ["open", "delayDuration", "disableHoverableContent"],
|
|
29
|
+
props: r
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
m as metaTooltip,
|
|
33
|
+
T as metaTooltipContent,
|
|
34
|
+
g as metaTooltipTrigger
|
|
35
|
+
};
|