@webstudio-is/sdk-components-react-radix 0.219.0 → 0.220.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.
@@ -1,8 +1,8 @@
1
- import { NavigationMenuIcon as t, ListIcon as o, ListItemIcon as i, TriggerIcon as a, ContentIcon as r, BoxIcon as s, ViewportIcon as c } from "@webstudio-is/icons/svg";
1
+ import { NavigationMenuIcon as t, ListIcon as o, ListItemIcon as i, TriggerIcon as a, ContentIcon as r, BoxIcon as c, ViewportIcon as s } from "@webstudio-is/icons/svg";
2
2
  import { div as e } from "@webstudio-is/sdk/normalize.css";
3
3
  import { radix as n } from "./shared/meta.js";
4
- import { propsNavigationMenu as p, propsNavigationMenuList as g, propsNavigationMenuItem as M, propsNavigationMenuTrigger as u, propsNavigationMenuContent as l, propsNavigationMenuLink as v, propsNavigationMenuViewport as N } from "./__generated__/navigation-menu.props.js";
5
- const y = {
4
+ import { propsNavigationMenu as p, propsNavigationMenuList as g, propsNavigationMenuItem as M, propsNavigationMenuTrigger as l, propsNavigationMenuContent as u, propsNavigationMenuLink as d, propsNavigationMenuViewport as v } from "./__generated__/navigation-menu.props.js";
5
+ const L = {
6
6
  icon: t,
7
7
  contentModel: {
8
8
  category: "instance",
@@ -11,7 +11,8 @@ const y = {
11
11
  },
12
12
  presetStyle: {
13
13
  div: e
14
- }
14
+ },
15
+ props: p
15
16
  }, h = {
16
17
  icon: o,
17
18
  label: "Menu List",
@@ -22,7 +23,8 @@ const y = {
22
23
  },
23
24
  presetStyle: {
24
25
  div: e
25
- }
26
+ },
27
+ props: g
26
28
  }, b = {
27
29
  icon: i,
28
30
  label: "Menu Item",
@@ -38,14 +40,16 @@ const y = {
38
40
  },
39
41
  presetStyle: {
40
42
  div: e
41
- }
43
+ },
44
+ props: M
42
45
  }, k = {
43
46
  icon: a,
44
47
  label: "Menu Trigger",
45
48
  contentModel: {
46
49
  category: "none",
47
50
  children: ["instance"]
48
- }
51
+ },
52
+ props: l
49
53
  }, w = {
50
54
  icon: r,
51
55
  label: "Menu Content",
@@ -56,16 +60,18 @@ const y = {
56
60
  },
57
61
  presetStyle: {
58
62
  div: e
59
- }
63
+ },
64
+ props: u
60
65
  }, C = {
61
- icon: s,
66
+ icon: c,
62
67
  label: "Accessible Link Wrapper",
63
68
  contentModel: {
64
69
  category: "none",
65
70
  children: ["instance"]
66
- }
67
- }, T = {
68
- icon: c,
71
+ },
72
+ props: d
73
+ }, S = {
74
+ icon: s,
69
75
  label: "Menu Viewport",
70
76
  contentModel: {
71
77
  category: "none",
@@ -73,35 +79,15 @@ const y = {
73
79
  },
74
80
  presetStyle: {
75
81
  div: e
76
- }
77
- }, V = {
78
- props: p
79
- }, S = {
80
- props: M
81
- }, f = {
82
- props: u
83
- }, x = {
84
- props: l
85
- }, A = {
82
+ },
86
83
  props: v
87
- }, W = {
88
- props: g
89
- }, B = {
90
- props: N
91
84
  };
92
85
  export {
93
- y as metaNavigationMenu,
86
+ L as metaNavigationMenu,
94
87
  w as metaNavigationMenuContent,
95
88
  b as metaNavigationMenuItem,
96
89
  C as metaNavigationMenuLink,
97
90
  h as metaNavigationMenuList,
98
91
  k as metaNavigationMenuTrigger,
99
- T as metaNavigationMenuViewport,
100
- V as propsMetaNavigationMenu,
101
- x as propsMetaNavigationMenuContent,
102
- S as propsMetaNavigationMenuItem,
103
- A as propsMetaNavigationMenuLink,
104
- W as propsMetaNavigationMenuList,
105
- f as propsMetaNavigationMenuTrigger,
106
- B as propsMetaNavigationMenuViewport
92
+ S as metaNavigationMenuViewport
107
93
  };
package/lib/popover.js CHANGED
@@ -1,48 +1,49 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as c, Children as P } from "react";
3
- import * as s from "@radix-ui/react-popover";
4
- import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
5
- const l = c((o, t) => /* @__PURE__ */ n(s.Root, { ...o })), v = c(({ children: o, ...t }, e) => {
3
+ import * as i from "@radix-ui/react-popover";
4
+ import { getClosestInstance as p } from "@webstudio-is/react-sdk/runtime";
5
+ const v = c((o, t) => /* @__PURE__ */ n(i.Root, { ...o })), d = c(({ children: o, ...t }, e) => {
6
6
  const r = P.toArray(o)[0];
7
- return /* @__PURE__ */ n(s.Trigger, { asChild: !0, ref: e, ...t, children: r ?? /* @__PURE__ */ n("button", { children: "Add button or link" }) });
7
+ return /* @__PURE__ */ n(i.Trigger, { asChild: !0, ref: e, ...t, children: r ?? /* @__PURE__ */ n("button", { children: "Add button or link" }) });
8
8
  }), h = c(
9
- ({ sideOffset: o = 4, align: t = "center", hideWhenDetached: e = !0, ...r }, p) => /* @__PURE__ */ n(s.Portal, { children: /* @__PURE__ */ n(
10
- s.Content,
9
+ ({ sideOffset: o = 4, align: t = "center", hideWhenDetached: e = !0, ...r }, a) => /* @__PURE__ */ n(i.Portal, { children: /* @__PURE__ */ n(
10
+ i.Content,
11
11
  {
12
- ref: p,
12
+ ref: a,
13
13
  align: "center",
14
14
  sideOffset: o,
15
15
  hideWhenDetached: e,
16
16
  ...r
17
17
  }
18
18
  ) })
19
- ), i = "@webstudio-is/sdk-components-react-radix", g = {
19
+ ), C = i.Close, s = "@webstudio-is/sdk-components-react-radix", g = {
20
20
  onNavigatorUnselect: (o, t) => {
21
21
  for (const e of t.instancePath)
22
- if (e.component === `${i}:PopoverContent`) {
23
- const r = a(
22
+ if (e.component === `${s}:PopoverContent`) {
23
+ const r = p(
24
24
  t.instancePath,
25
25
  e,
26
- `${i}:Popover`
26
+ `${s}:Popover`
27
27
  );
28
28
  r && o.setMemoryProp(r, "open", void 0);
29
29
  }
30
30
  },
31
31
  onNavigatorSelect: (o, t) => {
32
32
  for (const e of t.instancePath)
33
- if (e.component === `${i}:PopoverContent`) {
34
- const r = a(
33
+ if (e.component === `${s}:PopoverContent`) {
34
+ const r = p(
35
35
  t.instancePath,
36
36
  e,
37
- `${i}:Popover`
37
+ `${s}:Popover`
38
38
  );
39
39
  r && o.setMemoryProp(r, "open", !0);
40
40
  }
41
41
  }
42
42
  };
43
43
  export {
44
- l as Popover,
44
+ v as Popover,
45
+ C as PopoverClose,
45
46
  h as PopoverContent,
46
- v as PopoverTrigger,
47
+ d as PopoverTrigger,
47
48
  g as hooksPopover
48
49
  };
@@ -1,33 +1,63 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { $ as t, PlaceholderValue as d, css as n } from "@webstudio-is/template";
3
- import { radix as r } from "./shared/proxy.js";
4
- import { getButtonStyle as l } from "./shared/styles.js";
5
- import { zIndex as a, width as p, borderRadius as s, borderWidth as c, colors as e, spacing as m, boxShadow as h } from "./shared/theme.js";
6
- const w = {
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 = {
7
8
  category: "radix",
8
9
  description: "Displays rich content in a portal, triggered by a button.",
9
10
  order: 6,
10
- template: /* @__PURE__ */ i(r.Popover, { children: [
11
- /* @__PURE__ */ o(r.PopoverTrigger, { children: /* @__PURE__ */ o(t.Button, { "ws:style": l("outline"), children: new d("Button") }) }),
12
- /* @__PURE__ */ o(
13
- r.PopoverContent,
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,
14
15
  {
15
- "ws:style": n`
16
- z-index: ${a[50]};
17
- width: ${p[72]};
16
+ "ws:style": l`
17
+ z-index: ${b[50]};
18
+ width: ${u[72]};
18
19
  border-radius: ${s.md};
19
- border: ${c.DEFAULT} solid ${e.border};
20
- background-color: ${e.popover};
21
- padding: ${m[4]};
22
- color: ${e.popoverForeground};
23
- box-shadow: ${h.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};
24
25
  outline: none;
25
26
  `,
26
- children: /* @__PURE__ */ o(t.Text, { children: new d("The text you can edit") })
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
+ ]
27
57
  }
28
58
  )
29
59
  ] })
30
60
  };
31
61
  export {
32
- w as meta
62
+ P as meta
33
63
  };
package/lib/popover.ws.js CHANGED
@@ -1,43 +1,53 @@
1
- import { PopoverIcon as e, TriggerIcon as n, ContentIcon as r } from "@webstudio-is/icons/svg";
2
- import { div as t } from "@webstudio-is/sdk/normalize.css";
1
+ import { PopoverIcon as e, TriggerIcon as t, ContentIcon as n, ButtonElementIcon as r } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as p } from "@webstudio-is/sdk";
3
+ import { div as s, button as i } from "@webstudio-is/sdk/normalize.css";
3
4
  import { radix as o } from "./shared/meta.js";
4
- import { propsPopover as p, propsPopoverTrigger as i, propsPopoverContent as s } from "./__generated__/popover.props.js";
5
- const v = {
6
- icon: n,
5
+ import { propsPopover as c, propsPopoverTrigger as a, propsPopoverContent as l, propsPopoverClose as d } from "./__generated__/popover.props.js";
6
+ import { buttonReset as m } from "./shared/preset-styles.js";
7
+ const y = {
8
+ icon: t,
7
9
  contentModel: {
8
10
  category: "none",
9
11
  children: ["instance"]
10
- }
11
- }, d = {
12
- icon: r,
12
+ },
13
+ props: a
14
+ }, h = {
15
+ icon: n,
13
16
  contentModel: {
14
17
  category: "none",
15
- children: ["instance"]
18
+ children: ["instance"],
19
+ descendants: [o.PopoverClose]
16
20
  },
17
21
  presetStyle: {
18
- div: t
19
- }
20
- }, l = {
22
+ div: s
23
+ },
24
+ initialProps: ["side", "sideOffset", "align", "alignOffset"],
25
+ props: l
26
+ }, b = {
21
27
  icon: e,
22
28
  contentModel: {
23
29
  category: "instance",
24
30
  children: ["instance"],
25
31
  descendants: [o.PopoverTrigger, o.PopoverContent]
26
- }
27
- }, m = {
28
- props: p,
29
- initialProps: ["open"]
30
- }, f = {
31
- props: i
32
- }, M = {
33
- props: s,
34
- initialProps: ["side", "sideOffset", "align", "alignOffset"]
32
+ },
33
+ initialProps: ["open"],
34
+ props: c
35
+ }, I = {
36
+ icon: r,
37
+ label: "Close Button",
38
+ contentModel: {
39
+ category: "none",
40
+ children: ["instance", "rich-text"]
41
+ },
42
+ states: p,
43
+ presetStyle: {
44
+ button: [m, i].flat()
45
+ },
46
+ props: d
35
47
  };
36
48
  export {
37
- l as metaPopover,
38
- d as metaPopoverContent,
39
- v as metaPopoverTrigger,
40
- m as propsMetaPopover,
41
- M as propsMetaPopoverContent,
42
- f as propsMetaPopoverTrigger
49
+ b as metaPopover,
50
+ I as metaPopoverClose,
51
+ h as metaPopoverContent,
52
+ y as metaPopoverTrigger
43
53
  };
@@ -1,9 +1,16 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import { Item as d, Indicator as p, Root as e } from "@radix-ui/react-radio-group";
4
- const u = m(({ value: o, defaultValue: r, ...t }, a) => /* @__PURE__ */ i(e, { ...t, defaultValue: o ?? r, ref: a })), R = d, s = p;
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ import { Item as i, Indicator as p, Root as u } from "@radix-ui/react-radio-group";
4
+ import { useControllableState as d } from "@radix-ui/react-use-controllable-state";
5
+ const R = n(({ defaultValue: r, ...o }, t) => {
6
+ const [a, e] = d({
7
+ prop: o.value ?? r ?? "",
8
+ defaultProp: ""
9
+ });
10
+ return /* @__PURE__ */ m(u, { ...o, value: a, onValueChange: e, ref: t });
11
+ }), I = i, G = p;
5
12
  export {
6
- u as RadioGroup,
7
- s as RadioGroupIndicator,
8
- R as RadioGroupItem
13
+ R as RadioGroup,
14
+ G as RadioGroupIndicator,
15
+ I as RadioGroupItem
9
16
  };
@@ -1,18 +1,18 @@
1
- import { RadioGroupIcon as e, ItemIcon as a, TriggerIcon as r } from "@webstudio-is/icons/svg";
2
- import { defaultStates as o } from "@webstudio-is/sdk";
3
- import { div as n, button as s, span as c } from "@webstudio-is/sdk/normalize.css";
4
- import { radix as t } from "./shared/meta.js";
5
- import { buttonReset as p } from "./shared/preset-styles.js";
6
- import { propsRadioGroup as i, propsRadioGroupItem as d, propsRadioGroupIndicator as m } from "./__generated__/radio-group.props.js";
1
+ import { RadioGroupIcon as o, ItemIcon as r, TriggerIcon as a } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/sdk";
3
+ import { div as n, button as c, span as s } from "@webstudio-is/sdk/normalize.css";
4
+ import { radix as e } from "./shared/meta.js";
5
+ import { buttonReset as i } from "./shared/preset-styles.js";
6
+ import { propsRadioGroup as p, propsRadioGroupItem as d, propsRadioGroupIndicator as l } from "./__generated__/radio-group.props.js";
7
7
  const y = {
8
- icon: e,
8
+ icon: o,
9
9
  contentModel: {
10
10
  category: "instance",
11
11
  children: ["instance"],
12
- descendants: [t.RadioGroupItem]
12
+ descendants: [e.RadioGroupItem]
13
13
  },
14
14
  states: [
15
- ...o,
15
+ ...t,
16
16
  {
17
17
  label: "Checked",
18
18
  selector: "[data-state=checked]",
@@ -26,42 +26,36 @@ const y = {
26
26
  ],
27
27
  presetStyle: {
28
28
  div: n
29
- }
29
+ },
30
+ initialProps: ["id", "class", "name", "value", "required"],
31
+ props: p
30
32
  }, g = {
31
- icon: a,
33
+ icon: r,
32
34
  contentModel: {
33
35
  category: "none",
34
36
  children: ["instance"],
35
- descendants: [t.RadioGroupIndicator]
37
+ descendants: [e.RadioGroupIndicator]
36
38
  },
37
- states: o,
39
+ states: t,
38
40
  presetStyle: {
39
- button: [s, p].flat()
40
- }
41
+ button: [c, i].flat()
42
+ },
43
+ initialProps: ["value"],
44
+ props: d
41
45
  }, h = {
42
- icon: r,
46
+ icon: a,
43
47
  contentModel: {
44
48
  category: "none",
45
49
  children: ["instance"]
46
50
  },
47
- states: o,
51
+ states: t,
48
52
  presetStyle: {
49
- span: c
50
- }
51
- }, M = {
52
- props: i,
53
- initialProps: ["id", "className", "name", "value", "required"]
54
- }, b = {
55
- props: d,
56
- initialProps: ["value"]
57
- }, k = {
58
- props: m
53
+ span: s
54
+ },
55
+ props: l
59
56
  };
60
57
  export {
61
58
  y as metaRadioGroup,
62
59
  h as metaRadioGroupIndicator,
63
- g as metaRadioGroupItem,
64
- M as propsMetaRadioGroup,
65
- k as propsMetaRadioGroupIndicator,
66
- b as propsMetaRadioGroupItem
60
+ g as metaRadioGroupItem
67
61
  };
package/lib/select.ws.js CHANGED
@@ -1,44 +1,44 @@
1
- import { SelectIcon as o, TriggerIcon as c, FormTextFieldIcon as r, ViewportIcon as l, ContentIcon as p, ItemIcon as s, CheckMarkIcon as a, TextIcon as i } from "@webstudio-is/icons/svg";
2
- import { button as S, span as t, div as n } from "@webstudio-is/sdk/normalize.css";
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
3
  import { radix as e } from "./shared/meta.js";
4
- import { propsSelect as d, propsSelectTrigger as m, propsSelectValue as I, propsSelectViewport as g, propsSelectContent as M, propsSelectItem as y, propsSelectItemIndicator as T, propsSelectItemText as h } from "./__generated__/select.props.js";
5
- const w = {
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
6
  icon: o,
7
7
  contentModel: {
8
8
  category: "instance",
9
9
  children: ["instance"],
10
10
  descendants: [e.SelectTrigger, e.SelectContent]
11
- }
12
- }, b = {
11
+ },
12
+ initialProps: ["name", "value", "open", "required"],
13
+ props: S
14
+ }, f = {
13
15
  icon: c,
14
16
  contentModel: {
15
17
  category: "none",
16
18
  children: ["instance"],
17
19
  descendants: [e.SelectValue]
18
20
  },
19
- presetStyle: {
20
- button: S
21
- }
22
- }, f = {
21
+ presetStyle: { button: d },
22
+ props: m
23
+ }, w = {
23
24
  label: "Value",
24
25
  icon: r,
25
26
  contentModel: {
26
27
  category: "none",
27
28
  children: []
28
29
  },
29
- presetStyle: {
30
- span: t
31
- }
30
+ presetStyle: { span: t },
31
+ initialProps: ["placeholder"],
32
+ props: I
32
33
  }, v = {
33
- icon: p,
34
+ icon: i,
34
35
  contentModel: {
35
36
  category: "none",
36
37
  children: ["instance"],
37
38
  descendants: [e.SelectViewport]
38
39
  },
39
- presetStyle: {
40
- div: n
41
- }
40
+ presetStyle: { div: n },
41
+ props: y
42
42
  }, P = {
43
43
  icon: l,
44
44
  contentModel: {
@@ -46,74 +46,44 @@ const w = {
46
46
  children: ["instance"],
47
47
  descendants: [e.SelectItem]
48
48
  },
49
- presetStyle: {
50
- div: n
51
- }
49
+ presetStyle: { div: n },
50
+ props: g
52
51
  }, k = {
53
- icon: s,
52
+ icon: p,
54
53
  contentModel: {
55
54
  category: "none",
56
55
  children: ["instance"],
57
56
  descendants: [e.SelectItemIndicator, e.SelectItemText]
58
57
  },
59
- presetStyle: {
60
- div: n
61
- }
58
+ presetStyle: { div: n },
59
+ initialProps: ["value"],
60
+ props: h
62
61
  }, F = {
63
62
  label: "Indicator",
64
- icon: a,
63
+ icon: s,
65
64
  contentModel: {
66
65
  category: "none",
67
66
  children: ["instance"]
68
67
  },
69
- presetStyle: {
70
- span: t
71
- }
68
+ presetStyle: { span: t },
69
+ props: T
72
70
  }, q = {
73
71
  label: "Item Text",
74
- icon: i,
72
+ icon: a,
75
73
  contentModel: {
76
74
  category: "none",
77
75
  children: ["instance", "rich-text"]
78
76
  },
79
- presetStyle: {
80
- span: t
81
- }
82
- }, j = {
83
- props: d,
84
- initialProps: ["name", "value", "open", "required"]
85
- }, z = {
86
- props: m
87
- }, A = {
88
- props: I,
89
- initialProps: ["placeholder"]
90
- }, B = {
91
- props: M
92
- }, D = {
93
- props: g
94
- }, E = {
95
- props: y,
96
- initialProps: ["value"]
97
- }, G = {
98
- props: T
99
- }, H = {
100
- props: h
77
+ presetStyle: { span: t },
78
+ props: x
101
79
  };
102
80
  export {
103
- w as metaSelect,
81
+ b as metaSelect,
104
82
  v as metaSelectContent,
105
83
  k as metaSelectItem,
106
84
  F as metaSelectItemIndicator,
107
85
  q as metaSelectItemText,
108
- b as metaSelectTrigger,
109
- f as metaSelectValue,
110
- P as metaSelectViewport,
111
- j as propsMetaSelect,
112
- B as propsMetaSelectContent,
113
- E as propsMetaSelectItem,
114
- G as propsMetaSelectItemIndicator,
115
- H as propsMetaSelectItemText,
116
- z as propsMetaSelectTrigger,
117
- A as propsMetaSelectValue,
118
- D as propsMetaSelectViewport
86
+ f as metaSelectTrigger,
87
+ w as metaSelectValue,
88
+ P as metaSelectViewport
119
89
  };
package/lib/switch.js CHANGED
@@ -1,8 +1,23 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as m } from "react/jsx-runtime";
2
2
  import { forwardRef as f } from "react";
3
- import { Thumb as c, Root as h } from "@radix-ui/react-switch";
4
- const d = f(({ defaultChecked: o, checked: r, ...t }, m) => /* @__PURE__ */ e(h, { ...t, ref: m, defaultChecked: r ?? o })), n = c;
3
+ import { Thumb as h, Root as a } from "@radix-ui/react-switch";
4
+ import { useControllableState as n } from "@radix-ui/react-use-controllable-state";
5
+ const d = f(({ defaultChecked: e, ...o }, t) => {
6
+ const [r, c] = n({
7
+ prop: o.checked ?? e ?? !1,
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;
5
20
  export {
6
21
  d as Switch,
7
- n as SwitchThumb
22
+ u as SwitchThumb
8
23
  };