@webstudio-is/sdk-components-react-radix 0.0.0-588fe22 → 0.0.0-73cd6ea

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