@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,63 @@
|
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { LargeXIcon as p } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as r, PlaceholderValue as d, css as l } from "@webstudio-is/template";
|
|
4
|
+
import { radix as e } from "./shared/proxy.js";
|
|
5
|
+
import { getButtonStyle as h } from "./shared/styles.js";
|
|
6
|
+
import { spacing as t, borderRadius as s, height as a, opacity as m, boxShadow as c, zIndex as b, width as u, borderWidth as g, colors as i } from "./shared/theme.js";
|
|
7
|
+
const P = {
|
|
8
|
+
category: "radix",
|
|
9
|
+
description: "Displays rich content in a portal, triggered by a button.",
|
|
10
|
+
order: 6,
|
|
11
|
+
template: /* @__PURE__ */ n(e.Popover, { children: [
|
|
12
|
+
/* @__PURE__ */ o(e.PopoverTrigger, { children: /* @__PURE__ */ o(r.Button, { "ws:style": h("outline"), children: new d("Button") }) }),
|
|
13
|
+
/* @__PURE__ */ n(
|
|
14
|
+
e.PopoverContent,
|
|
15
|
+
{
|
|
16
|
+
"ws:style": l`
|
|
17
|
+
z-index: ${b[50]};
|
|
18
|
+
width: ${u[72]};
|
|
19
|
+
border-radius: ${s.md};
|
|
20
|
+
border: ${g.DEFAULT} solid ${i.border};
|
|
21
|
+
background-color: ${i.popover};
|
|
22
|
+
padding: ${t[4]};
|
|
23
|
+
color: ${i.popoverForeground};
|
|
24
|
+
box-shadow: ${c.md};
|
|
25
|
+
outline: none;
|
|
26
|
+
`,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ o(r.Text, { children: new d("The text you can edit") }),
|
|
29
|
+
/* @__PURE__ */ o(
|
|
30
|
+
e.PopoverClose,
|
|
31
|
+
{
|
|
32
|
+
"ws:label": "Close Button",
|
|
33
|
+
"ws:style": l`
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: ${t[4]};
|
|
36
|
+
top: ${t[4]};
|
|
37
|
+
border-radius: ${s.sm};
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
height: ${a[4]};
|
|
42
|
+
width: ${a[4]};
|
|
43
|
+
border: 0;
|
|
44
|
+
background-color: transparent;
|
|
45
|
+
outline: none;
|
|
46
|
+
&:hover {
|
|
47
|
+
opacity: ${m[100]};
|
|
48
|
+
}
|
|
49
|
+
&:focus-visible {
|
|
50
|
+
box-shadow: ${c.ring};
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
children: /* @__PURE__ */ o(r.HtmlEmbed, { "ws:label": "Close Icon", code: p })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] })
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
P as meta
|
|
63
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PopoverIcon as e, TriggerIcon as t, ContentIcon as n, ButtonElementIcon as r } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as p, button as i } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as o } from "./shared/meta.js";
|
|
4
|
+
import { propsPopover as s, propsPopoverTrigger as c, propsPopoverContent as a, propsPopoverClose as l } from "./__generated__/popover.props.js";
|
|
5
|
+
import { buttonReset as d } from "./shared/preset-styles.js";
|
|
6
|
+
const C = {
|
|
7
|
+
icon: t,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "none",
|
|
10
|
+
children: ["instance"]
|
|
11
|
+
},
|
|
12
|
+
props: c
|
|
13
|
+
}, y = {
|
|
14
|
+
icon: n,
|
|
15
|
+
contentModel: {
|
|
16
|
+
category: "none",
|
|
17
|
+
children: ["instance"],
|
|
18
|
+
descendants: [o.PopoverClose]
|
|
19
|
+
},
|
|
20
|
+
presetStyle: {
|
|
21
|
+
div: p
|
|
22
|
+
},
|
|
23
|
+
initialProps: ["side", "sideOffset", "align", "alignOffset"],
|
|
24
|
+
props: a
|
|
25
|
+
}, h = {
|
|
26
|
+
icon: e,
|
|
27
|
+
contentModel: {
|
|
28
|
+
category: "instance",
|
|
29
|
+
children: ["instance"],
|
|
30
|
+
descendants: [o.PopoverTrigger, o.PopoverContent]
|
|
31
|
+
},
|
|
32
|
+
initialProps: ["open"],
|
|
33
|
+
props: s
|
|
34
|
+
}, u = {
|
|
35
|
+
icon: r,
|
|
36
|
+
label: "Close Button",
|
|
37
|
+
contentModel: {
|
|
38
|
+
category: "none",
|
|
39
|
+
children: ["instance", "rich-text"]
|
|
40
|
+
},
|
|
41
|
+
presetStyle: {
|
|
42
|
+
button: [d, i].flat()
|
|
43
|
+
},
|
|
44
|
+
props: l
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
h as metaPopover,
|
|
48
|
+
u as metaPopoverClose,
|
|
49
|
+
y as metaPopoverContent,
|
|
50
|
+
C as metaPopoverTrigger
|
|
51
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useState as i, useEffect as m } from "react";
|
|
3
|
+
import { Item as s, Indicator as f, Root as d } from "@radix-ui/react-radio-group";
|
|
4
|
+
const I = c(({ defaultValue: r, ...t }, a) => {
|
|
5
|
+
const o = t.value ?? r ?? "", [u, e] = i(o);
|
|
6
|
+
return m(() => e(o), [o]), /* @__PURE__ */ n(d, { ...t, ref: a, value: u, onValueChange: e });
|
|
7
|
+
}), G = s, V = f;
|
|
8
|
+
export {
|
|
9
|
+
I as RadioGroup,
|
|
10
|
+
V as RadioGroupIndicator,
|
|
11
|
+
G as RadioGroupItem
|
|
12
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { css as t, $ as a, PlaceholderValue as n } from "@webstudio-is/template";
|
|
3
|
+
import { DotIcon as m } from "@webstudio-is/icons/svg";
|
|
4
|
+
import { radix as e } from "./shared/proxy.js";
|
|
5
|
+
import { spacing as d, height as p, width as b, borderRadius as h, borderWidth as u, colors as i, boxShadow as f, opacity as w } from "./shared/theme.js";
|
|
6
|
+
const r = ({
|
|
7
|
+
value: c,
|
|
8
|
+
label: s
|
|
9
|
+
}) => /* @__PURE__ */ l(
|
|
10
|
+
e.Label,
|
|
11
|
+
{
|
|
12
|
+
"ws:style": t`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: ${d[2]};
|
|
16
|
+
`,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ o(
|
|
19
|
+
e.RadioGroupItem,
|
|
20
|
+
{
|
|
21
|
+
value: c,
|
|
22
|
+
"ws:style": t`
|
|
23
|
+
aspect-ratio: 1 / 1;
|
|
24
|
+
height: ${p[4]};
|
|
25
|
+
width: ${b[4]};
|
|
26
|
+
border-radius: ${h.full};
|
|
27
|
+
border: ${u.DEFAULT} solid ${i.primary};
|
|
28
|
+
color: ${i.primary};
|
|
29
|
+
&:focus-visible {
|
|
30
|
+
outline: none;
|
|
31
|
+
box-shadow: ${f.ring};
|
|
32
|
+
}
|
|
33
|
+
&:disabled {
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
opacity: ${w[50]};
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
children: /* @__PURE__ */ o(e.RadioGroupIndicator, { children: /* @__PURE__ */ o(a.HtmlEmbed, { "ws:label": "Indicator Icon", code: m }) })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ o(a.Text, { children: new n(s) })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
), R = {
|
|
45
|
+
category: "radix",
|
|
46
|
+
order: 100,
|
|
47
|
+
description: "A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
|
|
48
|
+
template: /* @__PURE__ */ l(
|
|
49
|
+
e.RadioGroup,
|
|
50
|
+
{
|
|
51
|
+
"ws:style": t`
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: ${d[2]};
|
|
55
|
+
`,
|
|
56
|
+
children: [
|
|
57
|
+
r({ value: "default", label: "Default" }),
|
|
58
|
+
r({ value: "comfortable", label: "Comfortable" }),
|
|
59
|
+
r({ value: "compact", label: "Compact" })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
R as meta
|
|
66
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RadioGroupIcon as e, ItemIcon as t, TriggerIcon as r } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as n, button as a, span as i } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as o } from "./shared/meta.js";
|
|
4
|
+
import { buttonReset as c } from "./shared/preset-styles.js";
|
|
5
|
+
import { propsRadioGroup as p, propsRadioGroupItem as d, propsRadioGroupIndicator as s } from "./__generated__/radio-group.props.js";
|
|
6
|
+
const G = {
|
|
7
|
+
icon: e,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "instance",
|
|
10
|
+
children: ["instance"],
|
|
11
|
+
descendants: [o.RadioGroupItem]
|
|
12
|
+
},
|
|
13
|
+
states: [
|
|
14
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
15
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
16
|
+
],
|
|
17
|
+
presetStyle: {
|
|
18
|
+
div: n
|
|
19
|
+
},
|
|
20
|
+
initialProps: ["id", "class", "name", "value", "required"],
|
|
21
|
+
props: p
|
|
22
|
+
}, h = {
|
|
23
|
+
icon: t,
|
|
24
|
+
contentModel: {
|
|
25
|
+
category: "none",
|
|
26
|
+
children: ["instance"],
|
|
27
|
+
descendants: [o.RadioGroupIndicator]
|
|
28
|
+
},
|
|
29
|
+
presetStyle: {
|
|
30
|
+
button: [a, c].flat()
|
|
31
|
+
},
|
|
32
|
+
initialProps: ["value"],
|
|
33
|
+
props: d
|
|
34
|
+
}, f = {
|
|
35
|
+
icon: r,
|
|
36
|
+
contentModel: {
|
|
37
|
+
category: "none",
|
|
38
|
+
children: ["instance"]
|
|
39
|
+
},
|
|
40
|
+
presetStyle: {
|
|
41
|
+
span: i
|
|
42
|
+
},
|
|
43
|
+
props: s
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
G as metaRadioGroup,
|
|
47
|
+
f as metaRadioGroupIndicator,
|
|
48
|
+
h as metaRadioGroupItem
|
|
49
|
+
};
|
package/lib/select.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as a, useState as m, useEffect as f, useContext as g } from "react";
|
|
3
|
+
import { Viewport as C, Item as I, ItemIndicator as P, ItemText as h, Root as x, Trigger as V, Value as v, Portal as w, Content as T } from "@radix-ui/react-select";
|
|
4
|
+
import { ReactSdkContext as $, getClosestInstance as u } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const y = a(({ defaultOpen: t, defaultValue: e, ...n }, o) => {
|
|
6
|
+
const c = n.open ?? t ?? !1, [S, l] = m(c);
|
|
7
|
+
f(() => l(c), [c]);
|
|
8
|
+
const i = n.value ?? e ?? "", [d, p] = m(i);
|
|
9
|
+
return f(() => p(i), [i]), /* @__PURE__ */ r(
|
|
10
|
+
x,
|
|
11
|
+
{
|
|
12
|
+
...n,
|
|
13
|
+
open: S,
|
|
14
|
+
onOpenChange: l,
|
|
15
|
+
value: d,
|
|
16
|
+
onValueChange: p
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}), M = a((t, e) => {
|
|
20
|
+
const { renderer: n } = g($);
|
|
21
|
+
return /* @__PURE__ */ r(V, { onPointerDown: n === "canvas" ? (c) => {
|
|
22
|
+
c.preventDefault();
|
|
23
|
+
} : void 0, ref: e, ...t });
|
|
24
|
+
}), N = a((t, e) => /* @__PURE__ */ r(v, { ref: e, ...t })), b = a((t, e) => /* @__PURE__ */ r(w, { children: /* @__PURE__ */ r(T, { ref: e, ...t, position: "popper" }) })), j = C, E = I, U = P, _ = h, s = "@webstudio-is/sdk-components-react-radix", q = {
|
|
25
|
+
onNavigatorUnselect: (t, e) => {
|
|
26
|
+
for (const n of e.instancePath)
|
|
27
|
+
if (n.component === `${s}:SelectContent`) {
|
|
28
|
+
const o = u(
|
|
29
|
+
e.instancePath,
|
|
30
|
+
n,
|
|
31
|
+
`${s}:Select`
|
|
32
|
+
);
|
|
33
|
+
o && t.setMemoryProp(o, "open", void 0);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
onNavigatorSelect: (t, e) => {
|
|
37
|
+
for (const n of e.instancePath)
|
|
38
|
+
if (n.component === `${s}:SelectContent`) {
|
|
39
|
+
const o = u(
|
|
40
|
+
e.instancePath,
|
|
41
|
+
n,
|
|
42
|
+
`${s}:Select`
|
|
43
|
+
);
|
|
44
|
+
o && t.setMemoryProp(o, "open", !0);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
y as Select,
|
|
50
|
+
b as SelectContent,
|
|
51
|
+
E as SelectItem,
|
|
52
|
+
U as SelectItemIndicator,
|
|
53
|
+
_ as SelectItemText,
|
|
54
|
+
M as SelectTrigger,
|
|
55
|
+
N as SelectValue,
|
|
56
|
+
j as SelectViewport,
|
|
57
|
+
q as hooksSelect
|
|
58
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { css as i, $ as f, PlaceholderValue as w } from "@webstudio-is/template";
|
|
3
|
+
import { radix as o } from "./shared/proxy.js";
|
|
4
|
+
import { height as h, width as d, borderRadius as s, borderWidth as c, colors as e, spacing as t, fontSize as m, fontSizeLineHeight as $, boxShadow as a, opacity as g, zIndex as b } from "./shared/theme.js";
|
|
5
|
+
import { CheckMarkIcon as y } from "@webstudio-is/icons/svg";
|
|
6
|
+
const l = (u, p) => /* @__PURE__ */ n(
|
|
7
|
+
o.SelectItem,
|
|
8
|
+
{
|
|
9
|
+
value: u,
|
|
10
|
+
"ws:style": i`
|
|
11
|
+
position: relative;
|
|
12
|
+
display: flex;
|
|
13
|
+
width: ${d.full};
|
|
14
|
+
cursor: default;
|
|
15
|
+
user-select: none;
|
|
16
|
+
align-items: center;
|
|
17
|
+
border-radius: ${s.md};
|
|
18
|
+
padding: ${t[1.5]} ${t[2]} ${t[1.5]} ${t[8]};
|
|
19
|
+
font-size: ${m.sm};
|
|
20
|
+
line-height: ${$.sm};
|
|
21
|
+
outline: none;
|
|
22
|
+
&:focus {
|
|
23
|
+
background-color: ${e.accent};
|
|
24
|
+
color: ${e.accentForeground};
|
|
25
|
+
}
|
|
26
|
+
&[data-disabled] {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
opacity: ${g[50]};
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ r(
|
|
33
|
+
o.SelectItemIndicator,
|
|
34
|
+
{
|
|
35
|
+
"ws:style": i`
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: ${t[2]};
|
|
38
|
+
display: flex;
|
|
39
|
+
height: ${h[3.5]};
|
|
40
|
+
width: ${d[3.5]};
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
`,
|
|
44
|
+
children: /* @__PURE__ */ r(f.HtmlEmbed, { "ws:label": "Indicator Icon", code: y })
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ r(o.SelectItemText, { children: new w(p) })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
), z = {
|
|
51
|
+
category: "radix",
|
|
52
|
+
description: "Use within a form to give your users a list of options to choose from.",
|
|
53
|
+
order: 10,
|
|
54
|
+
template: /* @__PURE__ */ n(o.Select, { children: [
|
|
55
|
+
/* @__PURE__ */ r(
|
|
56
|
+
o.SelectTrigger,
|
|
57
|
+
{
|
|
58
|
+
"ws:style": i`
|
|
59
|
+
display: flex;
|
|
60
|
+
height: ${h[10]};
|
|
61
|
+
width: ${d.full};
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: between;
|
|
64
|
+
border-radius: ${s.md};
|
|
65
|
+
border: ${c.DEFAULT} solid ${e.input};
|
|
66
|
+
background-color: ${e.background};
|
|
67
|
+
padding: ${t[2]} ${t[3]};
|
|
68
|
+
font-size: ${m.sm};
|
|
69
|
+
line-height: ${$.sm};
|
|
70
|
+
&::placeholder {
|
|
71
|
+
color: ${e.mutedForeground};
|
|
72
|
+
}
|
|
73
|
+
&:focus-visible {
|
|
74
|
+
outline: none;
|
|
75
|
+
box-shadow: ${a.ring};
|
|
76
|
+
}
|
|
77
|
+
&:disabled {
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
opacity: ${g[50]};
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
children: /* @__PURE__ */ r(o.SelectValue, { placeholder: "Theme" })
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ r(
|
|
86
|
+
o.SelectContent,
|
|
87
|
+
{
|
|
88
|
+
"ws:style": i`
|
|
89
|
+
position: relative;
|
|
90
|
+
z-index: ${b[50]};
|
|
91
|
+
min-width: 8rem;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
border-radius: ${s.md};
|
|
94
|
+
border: ${c.DEFAULT} solid ${e.border};
|
|
95
|
+
background-color: ${e.popover};
|
|
96
|
+
color: ${e.popoverForeground};
|
|
97
|
+
box-shadow: ${a.md};
|
|
98
|
+
`,
|
|
99
|
+
children: /* @__PURE__ */ n(
|
|
100
|
+
o.SelectViewport,
|
|
101
|
+
{
|
|
102
|
+
"ws:style": i`
|
|
103
|
+
padding: ${t[1]};
|
|
104
|
+
height: var(--radix-select-trigger-height);
|
|
105
|
+
width: ${d.full};
|
|
106
|
+
min-width: var(--radix-select-trigger-width);
|
|
107
|
+
`,
|
|
108
|
+
children: [
|
|
109
|
+
l("light", "Light"),
|
|
110
|
+
l("dark", "Dark"),
|
|
111
|
+
l("system", "System")
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] })
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
z as meta
|
|
121
|
+
};
|
package/lib/select.ws.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { SelectIcon as o, TriggerIcon as c, FormTextFieldIcon as r, ViewportIcon as l, ContentIcon as i, ItemIcon as p, CheckMarkIcon as s, TextIcon as a } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { button as d, span as t, div as n } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as e } from "./shared/meta.js";
|
|
4
|
+
import { propsSelect as S, propsSelectTrigger as m, propsSelectValue as I, propsSelectViewport as g, propsSelectContent as y, propsSelectItem as h, propsSelectItemIndicator as T, propsSelectItemText as x } from "./__generated__/select.props.js";
|
|
5
|
+
const b = {
|
|
6
|
+
icon: o,
|
|
7
|
+
contentModel: {
|
|
8
|
+
category: "instance",
|
|
9
|
+
children: ["instance"],
|
|
10
|
+
descendants: [e.SelectTrigger, e.SelectContent]
|
|
11
|
+
},
|
|
12
|
+
initialProps: ["name", "value", "open", "required"],
|
|
13
|
+
props: S
|
|
14
|
+
}, f = {
|
|
15
|
+
icon: c,
|
|
16
|
+
contentModel: {
|
|
17
|
+
category: "none",
|
|
18
|
+
children: ["instance"],
|
|
19
|
+
descendants: [e.SelectValue]
|
|
20
|
+
},
|
|
21
|
+
presetStyle: { button: d },
|
|
22
|
+
props: m
|
|
23
|
+
}, w = {
|
|
24
|
+
label: "Value",
|
|
25
|
+
icon: r,
|
|
26
|
+
contentModel: {
|
|
27
|
+
category: "none",
|
|
28
|
+
children: []
|
|
29
|
+
},
|
|
30
|
+
presetStyle: { span: t },
|
|
31
|
+
initialProps: ["placeholder"],
|
|
32
|
+
props: I
|
|
33
|
+
}, v = {
|
|
34
|
+
icon: i,
|
|
35
|
+
contentModel: {
|
|
36
|
+
category: "none",
|
|
37
|
+
children: ["instance"],
|
|
38
|
+
descendants: [e.SelectViewport]
|
|
39
|
+
},
|
|
40
|
+
presetStyle: { div: n },
|
|
41
|
+
props: y
|
|
42
|
+
}, P = {
|
|
43
|
+
icon: l,
|
|
44
|
+
contentModel: {
|
|
45
|
+
category: "none",
|
|
46
|
+
children: ["instance"],
|
|
47
|
+
descendants: [e.SelectItem]
|
|
48
|
+
},
|
|
49
|
+
presetStyle: { div: n },
|
|
50
|
+
props: g
|
|
51
|
+
}, k = {
|
|
52
|
+
icon: p,
|
|
53
|
+
contentModel: {
|
|
54
|
+
category: "none",
|
|
55
|
+
children: ["instance"],
|
|
56
|
+
descendants: [e.SelectItemIndicator, e.SelectItemText]
|
|
57
|
+
},
|
|
58
|
+
presetStyle: { div: n },
|
|
59
|
+
initialProps: ["value"],
|
|
60
|
+
props: h
|
|
61
|
+
}, F = {
|
|
62
|
+
label: "Indicator",
|
|
63
|
+
icon: s,
|
|
64
|
+
contentModel: {
|
|
65
|
+
category: "none",
|
|
66
|
+
children: ["instance"]
|
|
67
|
+
},
|
|
68
|
+
presetStyle: { span: t },
|
|
69
|
+
props: T
|
|
70
|
+
}, q = {
|
|
71
|
+
label: "Item Text",
|
|
72
|
+
icon: a,
|
|
73
|
+
contentModel: {
|
|
74
|
+
category: "none",
|
|
75
|
+
children: ["instance", "rich-text"]
|
|
76
|
+
},
|
|
77
|
+
presetStyle: { span: t },
|
|
78
|
+
props: x
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
b as metaSelect,
|
|
82
|
+
v as metaSelectContent,
|
|
83
|
+
k as metaSelectItem,
|
|
84
|
+
F as metaSelectItemIndicator,
|
|
85
|
+
q as metaSelectItemText,
|
|
86
|
+
f as metaSelectTrigger,
|
|
87
|
+
w as metaSelectValue,
|
|
88
|
+
P as metaSelectViewport
|
|
89
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const o = (r, t, p) => ({
|
|
2
|
+
property: r,
|
|
3
|
+
value: { type: "unit", unit: p, value: t }
|
|
4
|
+
}), e = (r, t) => ({
|
|
5
|
+
property: r,
|
|
6
|
+
value: { type: "keyword", value: t }
|
|
7
|
+
}), d = (r, t, p, l) => ({
|
|
8
|
+
property: r,
|
|
9
|
+
value: { type: "rgb", alpha: 1, r: t, g: p, b: l }
|
|
10
|
+
}), b = [
|
|
11
|
+
{
|
|
12
|
+
property: "background-color",
|
|
13
|
+
value: { type: "keyword", value: "transparent" }
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
property: "background-image",
|
|
17
|
+
value: { type: "keyword", value: "none" }
|
|
18
|
+
},
|
|
19
|
+
o("border-top-width", 0, "px"),
|
|
20
|
+
o("border-right-width", 0, "px"),
|
|
21
|
+
o("border-bottom-width", 0, "px"),
|
|
22
|
+
o("border-left-width", 0, "px"),
|
|
23
|
+
e("border-top-style", "solid"),
|
|
24
|
+
e("border-right-style", "solid"),
|
|
25
|
+
e("border-bottom-style", "solid"),
|
|
26
|
+
e("border-left-style", "solid"),
|
|
27
|
+
d("border-top-color", 226, 232, 240),
|
|
28
|
+
d("border-right-color", 226, 232, 240),
|
|
29
|
+
d("border-bottom-color", 226, 232, 240),
|
|
30
|
+
d("border-left-color", 226, 232, 240),
|
|
31
|
+
o("padding-top", 0, "px"),
|
|
32
|
+
o("padding-right", 0, "px"),
|
|
33
|
+
o("padding-bottom", 0, "px"),
|
|
34
|
+
o("padding-left", 0, "px")
|
|
35
|
+
];
|
|
36
|
+
export {
|
|
37
|
+
b 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
|
+
};
|