@webstudio-is/sdk-components-react-radix 0.220.0 → 0.222.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__generated__/tabs.props.js +2 -2
- package/lib/accordion.js +35 -23
- package/lib/accordion.template.js +4 -4
- package/lib/accordion.ws.js +20 -28
- package/lib/checkbox.js +12 -16
- package/lib/checkbox.ws.js +18 -29
- package/lib/collapsible.js +29 -26
- package/lib/dialog.js +50 -56
- package/lib/dialog.ws.js +27 -28
- package/lib/label.ws.js +5 -9
- package/lib/popover.js +39 -36
- package/lib/popover.ws.js +17 -19
- package/lib/radio-group.js +10 -14
- package/lib/radio-group.ws.js +21 -33
- package/lib/select.js +49 -35
- package/lib/switch.js +9 -21
- package/lib/switch.ws.js +19 -38
- package/lib/tabs.js +46 -50
- package/lib/tabs.template.js +5 -5
- package/lib/tabs.ws.js +16 -24
- package/lib/tooltip.js +34 -31
- package/lib/types/accordion.ws.d.ts +1 -1
- package/lib/types/checkbox.ws.d.ts +1 -1
- package/lib/types/collapsible.d.ts +2 -2
- package/lib/types/dialog.ws.d.ts +1 -1
- package/lib/types/label.ws.d.ts +1 -1
- package/lib/types/popover.ws.d.ts +1 -1
- package/lib/types/radio-group.d.ts +1 -1
- package/lib/types/radio-group.ws.d.ts +1 -1
- package/lib/types/switch.ws.d.ts +1 -1
- package/lib/types/tabs.d.ts +1 -4
- package/lib/types/tabs.ws.d.ts +1 -1
- package/package.json +7 -8
package/lib/label.ws.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { LabelIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
3
2
|
import { label as r } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
-
import { props as
|
|
5
|
-
const
|
|
3
|
+
import { props as t } from "./__generated__/label.props.js";
|
|
4
|
+
const m = {
|
|
6
5
|
icon: o,
|
|
7
|
-
|
|
8
|
-
presetStyle: {
|
|
9
|
-
label: r
|
|
10
|
-
},
|
|
6
|
+
presetStyle: { label: r },
|
|
11
7
|
initialProps: ["id", "class", "for"],
|
|
12
|
-
props:
|
|
8
|
+
props: t
|
|
13
9
|
};
|
|
14
10
|
export {
|
|
15
|
-
|
|
11
|
+
m as meta
|
|
16
12
|
};
|
package/lib/popover.js
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import * as
|
|
4
|
-
import { getClosestInstance as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
}),
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p, useState as f, useEffect as P, Children as l } from "react";
|
|
3
|
+
import * as s from "@radix-ui/react-popover";
|
|
4
|
+
import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const h = p((t, n) => {
|
|
6
|
+
const o = t.open ?? !1, [e, i] = f(o);
|
|
7
|
+
return P(() => i(o), [o]), /* @__PURE__ */ r(s.Root, { ...t, open: e, onOpenChange: i });
|
|
8
|
+
}), u = p(({ children: t, ...n }, o) => {
|
|
9
|
+
const e = l.toArray(t)[0];
|
|
10
|
+
return /* @__PURE__ */ r(s.Trigger, { asChild: !0, ref: o, ...n, children: e ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
11
|
+
}), C = p(
|
|
12
|
+
({ sideOffset: t = 4, align: n = "center", hideWhenDetached: o = !0, ...e }, i) => /* @__PURE__ */ r(s.Portal, { children: /* @__PURE__ */ r(
|
|
13
|
+
s.Content,
|
|
11
14
|
{
|
|
12
|
-
ref:
|
|
15
|
+
ref: i,
|
|
13
16
|
align: "center",
|
|
14
|
-
sideOffset:
|
|
15
|
-
hideWhenDetached:
|
|
16
|
-
...
|
|
17
|
+
sideOffset: t,
|
|
18
|
+
hideWhenDetached: o,
|
|
19
|
+
...e
|
|
17
20
|
}
|
|
18
21
|
) })
|
|
19
|
-
),
|
|
20
|
-
onNavigatorUnselect: (
|
|
21
|
-
for (const
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`${
|
|
22
|
+
), g = s.Close, c = "@webstudio-is/sdk-components-react-radix", $ = {
|
|
23
|
+
onNavigatorUnselect: (t, n) => {
|
|
24
|
+
for (const o of n.instancePath)
|
|
25
|
+
if (o.component === `${c}:PopoverContent`) {
|
|
26
|
+
const e = a(
|
|
27
|
+
n.instancePath,
|
|
28
|
+
o,
|
|
29
|
+
`${c}:Popover`
|
|
27
30
|
);
|
|
28
|
-
|
|
31
|
+
e && t.setMemoryProp(e, "open", void 0);
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
|
-
onNavigatorSelect: (
|
|
32
|
-
for (const
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`${
|
|
34
|
+
onNavigatorSelect: (t, n) => {
|
|
35
|
+
for (const o of n.instancePath)
|
|
36
|
+
if (o.component === `${c}:PopoverContent`) {
|
|
37
|
+
const e = a(
|
|
38
|
+
n.instancePath,
|
|
39
|
+
o,
|
|
40
|
+
`${c}:Popover`
|
|
38
41
|
);
|
|
39
|
-
|
|
42
|
+
e && t.setMemoryProp(e, "open", !0);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
46
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
h as Popover,
|
|
48
|
+
g as PopoverClose,
|
|
49
|
+
C as PopoverContent,
|
|
50
|
+
u as PopoverTrigger,
|
|
51
|
+
$ as hooksPopover
|
|
49
52
|
};
|
package/lib/popover.ws.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { PopoverIcon as e, TriggerIcon as t, ContentIcon as n, ButtonElementIcon as r } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
import { div as s, button as i } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { div as p, button as i } from "@webstudio-is/sdk/normalize.css";
|
|
4
3
|
import { radix as o } from "./shared/meta.js";
|
|
5
|
-
import { propsPopover as
|
|
6
|
-
import { buttonReset as
|
|
7
|
-
const
|
|
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 = {
|
|
8
7
|
icon: t,
|
|
9
8
|
contentModel: {
|
|
10
9
|
category: "none",
|
|
11
10
|
children: ["instance"]
|
|
12
11
|
},
|
|
13
|
-
props:
|
|
14
|
-
},
|
|
12
|
+
props: c
|
|
13
|
+
}, y = {
|
|
15
14
|
icon: n,
|
|
16
15
|
contentModel: {
|
|
17
16
|
category: "none",
|
|
@@ -19,11 +18,11 @@ const y = {
|
|
|
19
18
|
descendants: [o.PopoverClose]
|
|
20
19
|
},
|
|
21
20
|
presetStyle: {
|
|
22
|
-
div:
|
|
21
|
+
div: p
|
|
23
22
|
},
|
|
24
23
|
initialProps: ["side", "sideOffset", "align", "alignOffset"],
|
|
25
|
-
props:
|
|
26
|
-
},
|
|
24
|
+
props: a
|
|
25
|
+
}, h = {
|
|
27
26
|
icon: e,
|
|
28
27
|
contentModel: {
|
|
29
28
|
category: "instance",
|
|
@@ -31,23 +30,22 @@ const y = {
|
|
|
31
30
|
descendants: [o.PopoverTrigger, o.PopoverContent]
|
|
32
31
|
},
|
|
33
32
|
initialProps: ["open"],
|
|
34
|
-
props:
|
|
35
|
-
},
|
|
33
|
+
props: s
|
|
34
|
+
}, u = {
|
|
36
35
|
icon: r,
|
|
37
36
|
label: "Close Button",
|
|
38
37
|
contentModel: {
|
|
39
38
|
category: "none",
|
|
40
39
|
children: ["instance", "rich-text"]
|
|
41
40
|
},
|
|
42
|
-
states: p,
|
|
43
41
|
presetStyle: {
|
|
44
|
-
button: [
|
|
42
|
+
button: [d, i].flat()
|
|
45
43
|
},
|
|
46
|
-
props:
|
|
44
|
+
props: l
|
|
47
45
|
};
|
|
48
46
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
h as metaPopover,
|
|
48
|
+
u as metaPopoverClose,
|
|
49
|
+
y as metaPopoverContent,
|
|
50
|
+
C as metaPopoverTrigger
|
|
53
51
|
};
|
package/lib/radio-group.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Item as
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
defaultProp: ""
|
|
9
|
-
});
|
|
10
|
-
return /* @__PURE__ */ m(u, { ...o, value: a, onValueChange: e, ref: t });
|
|
11
|
-
}), I = i, G = p;
|
|
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;
|
|
12
8
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
I as RadioGroup,
|
|
10
|
+
V as RadioGroupIndicator,
|
|
11
|
+
G as RadioGroupItem
|
|
16
12
|
};
|
package/lib/radio-group.ws.js
CHANGED
|
@@ -1,61 +1,49 @@
|
|
|
1
|
-
import { RadioGroupIcon as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
icon: o,
|
|
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,
|
|
9
8
|
contentModel: {
|
|
10
9
|
category: "instance",
|
|
11
10
|
children: ["instance"],
|
|
12
|
-
descendants: [
|
|
11
|
+
descendants: [o.RadioGroupItem]
|
|
13
12
|
},
|
|
14
13
|
states: [
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
label: "Checked",
|
|
18
|
-
selector: "[data-state=checked]",
|
|
19
|
-
category: "component-states"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: "Unchecked",
|
|
23
|
-
selector: "[data-state=unchecked]",
|
|
24
|
-
category: "component-states"
|
|
25
|
-
}
|
|
14
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
15
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
26
16
|
],
|
|
27
17
|
presetStyle: {
|
|
28
18
|
div: n
|
|
29
19
|
},
|
|
30
20
|
initialProps: ["id", "class", "name", "value", "required"],
|
|
31
21
|
props: p
|
|
32
|
-
},
|
|
33
|
-
icon:
|
|
22
|
+
}, h = {
|
|
23
|
+
icon: t,
|
|
34
24
|
contentModel: {
|
|
35
25
|
category: "none",
|
|
36
26
|
children: ["instance"],
|
|
37
|
-
descendants: [
|
|
27
|
+
descendants: [o.RadioGroupIndicator]
|
|
38
28
|
},
|
|
39
|
-
states: t,
|
|
40
29
|
presetStyle: {
|
|
41
|
-
button: [
|
|
30
|
+
button: [a, c].flat()
|
|
42
31
|
},
|
|
43
32
|
initialProps: ["value"],
|
|
44
33
|
props: d
|
|
45
|
-
},
|
|
46
|
-
icon:
|
|
34
|
+
}, f = {
|
|
35
|
+
icon: r,
|
|
47
36
|
contentModel: {
|
|
48
37
|
category: "none",
|
|
49
38
|
children: ["instance"]
|
|
50
39
|
},
|
|
51
|
-
states: t,
|
|
52
40
|
presetStyle: {
|
|
53
|
-
span:
|
|
41
|
+
span: i
|
|
54
42
|
},
|
|
55
|
-
props:
|
|
43
|
+
props: s
|
|
56
44
|
};
|
|
57
45
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
G as metaRadioGroup,
|
|
47
|
+
f as metaRadioGroupIndicator,
|
|
48
|
+
h as metaRadioGroupItem
|
|
61
49
|
};
|
package/lib/select.js
CHANGED
|
@@ -1,44 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Viewport as
|
|
4
|
-
import { ReactSdkContext as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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`
|
|
18
32
|
);
|
|
19
|
-
|
|
33
|
+
o && t.setMemoryProp(o, "open", void 0);
|
|
20
34
|
}
|
|
21
35
|
},
|
|
22
|
-
onNavigatorSelect: (
|
|
23
|
-
for (const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
`${
|
|
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`
|
|
29
43
|
);
|
|
30
|
-
|
|
44
|
+
o && t.setMemoryProp(o, "open", !0);
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
47
|
};
|
|
34
48
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
44
58
|
};
|
package/lib/switch.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Thumb as
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
defaultProp: !1
|
|
9
|
-
});
|
|
10
|
-
return /* @__PURE__ */ m(
|
|
11
|
-
a,
|
|
12
|
-
{
|
|
13
|
-
...o,
|
|
14
|
-
ref: t,
|
|
15
|
-
checked: r,
|
|
16
|
-
onCheckedChange: c
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}), u = h;
|
|
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;
|
|
20
8
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
C as Switch,
|
|
10
|
+
w as SwitchThumb
|
|
23
11
|
};
|
package/lib/switch.ws.js
CHANGED
|
@@ -1,59 +1,40 @@
|
|
|
1
|
-
import { SwitchIcon as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
icon: t,
|
|
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,
|
|
9
8
|
contentModel: {
|
|
10
9
|
category: "instance",
|
|
11
10
|
children: ["instance"],
|
|
12
|
-
descendants: [
|
|
11
|
+
descendants: [a.SwitchThumb]
|
|
13
12
|
},
|
|
14
13
|
states: [
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
label: "Checked",
|
|
18
|
-
selector: "[data-state=checked]",
|
|
19
|
-
category: "component-states"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: "Unchecked",
|
|
23
|
-
selector: "[data-state=unchecked]",
|
|
24
|
-
category: "component-states"
|
|
25
|
-
}
|
|
14
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
15
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
26
16
|
],
|
|
27
17
|
presetStyle: {
|
|
28
|
-
button: [
|
|
18
|
+
button: [c, n].flat()
|
|
29
19
|
},
|
|
30
20
|
initialProps: ["id", "class", "name", "value", "checked", "required"],
|
|
31
21
|
props: r
|
|
32
|
-
},
|
|
33
|
-
icon:
|
|
22
|
+
}, b = {
|
|
23
|
+
icon: t,
|
|
34
24
|
contentModel: {
|
|
35
25
|
category: "none",
|
|
36
26
|
children: ["instance"]
|
|
37
27
|
},
|
|
38
28
|
states: [
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
label: "Checked",
|
|
42
|
-
selector: "[data-state=checked]",
|
|
43
|
-
category: "component-states"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "Unchecked",
|
|
47
|
-
selector: "[data-state=unchecked]",
|
|
48
|
-
category: "component-states"
|
|
49
|
-
}
|
|
29
|
+
{ label: "Checked", selector: "[data-state=checked]" },
|
|
30
|
+
{ label: "Unchecked", selector: "[data-state=unchecked]" }
|
|
50
31
|
],
|
|
51
32
|
presetStyle: {
|
|
52
|
-
span:
|
|
33
|
+
span: o
|
|
53
34
|
},
|
|
54
|
-
props:
|
|
35
|
+
props: s
|
|
55
36
|
};
|
|
56
37
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
m as metaSwitch,
|
|
39
|
+
b as metaSwitchThumb
|
|
59
40
|
};
|
package/lib/tabs.js
CHANGED
|
@@ -1,66 +1,62 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as c, useCallback as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const t = g(n);
|
|
33
|
-
return /* @__PURE__ */ i(h, { ref: o, value: e ?? t ?? "", ...n });
|
|
34
|
-
}), r = "@webstudio-is/sdk-components-react-radix", R = {
|
|
35
|
-
onNavigatorSelect: (e, n) => {
|
|
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) => {
|
|
36
32
|
var o;
|
|
37
|
-
for (const t of
|
|
33
|
+
for (const t of e.instancePath)
|
|
38
34
|
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
39
|
-
const
|
|
40
|
-
|
|
35
|
+
const s = u(
|
|
36
|
+
e.instancePath,
|
|
41
37
|
t,
|
|
42
38
|
`${r}:Tabs`
|
|
43
|
-
),
|
|
44
|
-
|
|
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);
|
|
45
41
|
}
|
|
46
42
|
},
|
|
47
|
-
onNavigatorUnselect: (
|
|
43
|
+
onNavigatorUnselect: (n, e) => {
|
|
48
44
|
var o;
|
|
49
|
-
for (const t of
|
|
45
|
+
for (const t of e.instancePath)
|
|
50
46
|
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
51
|
-
const
|
|
52
|
-
|
|
47
|
+
const s = u(
|
|
48
|
+
e.instancePath,
|
|
53
49
|
t,
|
|
54
50
|
`${r}:Tabs`
|
|
55
|
-
),
|
|
56
|
-
|
|
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);
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
};
|
|
60
56
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
w as Tabs,
|
|
58
|
+
R as TabsContent,
|
|
59
|
+
y as TabsList,
|
|
60
|
+
A as TabsTrigger,
|
|
61
|
+
W as hooksTabs
|
|
66
62
|
};
|
package/lib/tabs.template.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { PlaceholderValue as o, css as a } from "@webstudio-is/template";
|
|
3
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
|
|
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;
|
|
@@ -10,9 +10,9 @@ const d = a`
|
|
|
10
10
|
border-radius: ${l.md};
|
|
11
11
|
padding: ${i[1.5]} ${i[3]};
|
|
12
12
|
font-size: ${h.sm};
|
|
13
|
-
line-height: ${
|
|
14
|
-
font-weight: ${
|
|
15
|
-
transition: ${
|
|
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;
|
|
@@ -37,7 +37,7 @@ 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
|
{
|