@webstudio-is/sdk-components-react-radix 0.87.1 → 0.89.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.
Files changed (192) hide show
  1. package/lib/__generated__/accordion.props.js +605 -114
  2. package/lib/__generated__/button.props.js +158 -47
  3. package/lib/__generated__/checkbox.props.js +1083 -0
  4. package/lib/__generated__/collapsible.props.js +234 -44
  5. package/lib/__generated__/dialog.props.js +611 -121
  6. package/lib/__generated__/input.props.js +264 -47
  7. package/lib/__generated__/label.props.js +123 -23
  8. package/lib/__generated__/navigation-menu.props.js +2565 -0
  9. package/lib/__generated__/popover.props.js +129 -28
  10. package/lib/__generated__/radio-group.props.js +1627 -0
  11. package/lib/__generated__/select.props.js +3678 -0
  12. package/lib/__generated__/sheet.props.js +591 -121
  13. package/lib/__generated__/switch.props.js +1083 -0
  14. package/lib/__generated__/tabs.props.js +906 -68
  15. package/lib/__generated__/textarea.props.js +177 -31
  16. package/lib/__generated__/tooltip.props.js +131 -29
  17. package/lib/accordion.js +11 -4
  18. package/lib/accordion.ws.js +88 -72
  19. package/lib/checkbox.js +13 -0
  20. package/lib/checkbox.ws.js +153 -0
  21. package/lib/cjs/__generated__/accordion.props.js +605 -114
  22. package/lib/cjs/__generated__/button.props.js +158 -47
  23. package/lib/cjs/__generated__/checkbox.props.js +1103 -0
  24. package/lib/cjs/__generated__/collapsible.props.js +234 -44
  25. package/lib/cjs/__generated__/dialog.props.js +611 -121
  26. package/lib/cjs/__generated__/input.props.js +264 -47
  27. package/lib/cjs/__generated__/label.props.js +123 -23
  28. package/lib/cjs/__generated__/navigation-menu.props.js +2585 -0
  29. package/lib/cjs/__generated__/popover.props.js +129 -28
  30. package/lib/cjs/__generated__/radio-group.props.js +1647 -0
  31. package/lib/cjs/__generated__/select.props.js +3698 -0
  32. package/lib/cjs/__generated__/sheet.props.js +591 -121
  33. package/lib/cjs/__generated__/switch.props.js +1103 -0
  34. package/lib/cjs/__generated__/tabs.props.js +906 -68
  35. package/lib/cjs/__generated__/textarea.props.js +177 -31
  36. package/lib/cjs/__generated__/tooltip.props.js +131 -29
  37. package/lib/cjs/accordion.js +11 -4
  38. package/lib/cjs/accordion.ws.js +86 -71
  39. package/lib/cjs/{textarea.js → checkbox.js} +9 -6
  40. package/lib/cjs/checkbox.ws.js +174 -0
  41. package/lib/cjs/collapsible.ws.js +5 -1
  42. package/lib/cjs/components.js +27 -14
  43. package/lib/cjs/dialog.ws.js +18 -17
  44. package/lib/cjs/hooks.js +5 -1
  45. package/lib/cjs/label.ws.js +2 -1
  46. package/lib/cjs/metas.js +29 -14
  47. package/lib/cjs/navigation-menu.js +107 -0
  48. package/lib/cjs/navigation-menu.ws.js +514 -0
  49. package/lib/cjs/popover.ws.js +13 -9
  50. package/lib/cjs/props-descriptions.js +56 -0
  51. package/lib/cjs/props.js +27 -14
  52. package/lib/cjs/{button.js → radio-group.js} +10 -8
  53. package/lib/cjs/radio-group.ws.js +191 -0
  54. package/lib/cjs/select.js +83 -0
  55. package/lib/cjs/select.ws.js +350 -0
  56. package/lib/cjs/sheet.ws.js +88 -176
  57. package/lib/cjs/{input.js → switch.js} +8 -9
  58. package/lib/cjs/switch.ws.js +173 -0
  59. package/lib/cjs/tabs.js +2 -3
  60. package/lib/cjs/tabs.ws.js +14 -18
  61. package/lib/cjs/theme/styles.js +100 -0
  62. package/lib/cjs/theme/tailwind-classes.js +125 -16
  63. package/lib/cjs/theme/tailwind-colors.js +1 -0
  64. package/lib/cjs/tooltip.ws.js +12 -8
  65. package/lib/collapsible.ws.js +5 -1
  66. package/lib/components.js +44 -22
  67. package/lib/dialog.ws.js +18 -17
  68. package/lib/hooks.js +5 -1
  69. package/lib/label.ws.js +2 -1
  70. package/lib/metas.js +58 -24
  71. package/lib/navigation-menu.js +85 -0
  72. package/lib/navigation-menu.ws.js +501 -0
  73. package/lib/popover.ws.js +13 -9
  74. package/lib/props-descriptions.js +36 -0
  75. package/lib/props.js +56 -24
  76. package/lib/radio-group.js +11 -0
  77. package/lib/radio-group.ws.js +173 -0
  78. package/lib/select.js +75 -0
  79. package/lib/select.ws.js +338 -0
  80. package/lib/sheet.ws.js +89 -194
  81. package/lib/switch.js +7 -0
  82. package/lib/switch.ws.js +145 -0
  83. package/lib/tabs.js +3 -5
  84. package/lib/tabs.ws.js +15 -19
  85. package/lib/theme/styles.js +70 -0
  86. package/lib/theme/tailwind-classes.js +125 -16
  87. package/lib/theme/tailwind-colors.js +1 -0
  88. package/lib/tooltip.ws.js +12 -8
  89. package/lib/types/__generated__/checkbox.props.d.ts +3 -0
  90. package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
  91. package/lib/types/__generated__/radio-group.props.d.ts +4 -0
  92. package/lib/types/__generated__/select.props.d.ts +9 -0
  93. package/lib/types/__generated__/switch.props.d.ts +3 -0
  94. package/lib/types/checkbox.d.ts +6 -0
  95. package/lib/types/checkbox.stories.d.ts +11 -0
  96. package/lib/types/checkbox.ws.d.ts +5 -0
  97. package/lib/types/components.d.ts +5 -4
  98. package/lib/types/metas.d.ts +6 -4
  99. package/lib/types/navigation-menu.d.ts +15 -0
  100. package/lib/types/navigation-menu.ws.d.ts +15 -0
  101. package/lib/types/props-descriptions.d.ts +29 -0
  102. package/lib/types/props.d.ts +5 -4
  103. package/lib/types/radio-group.d.ts +5 -0
  104. package/lib/types/radio-group.stories.d.ts +9 -0
  105. package/lib/types/radio-group.ws.d.ts +7 -0
  106. package/lib/types/select.d.ts +14 -0
  107. package/lib/types/select.ws.d.ts +17 -0
  108. package/lib/types/sheet.ws.d.ts +2 -15
  109. package/lib/types/switch.d.ts +4 -0
  110. package/lib/types/switch.stories.d.ts +9 -0
  111. package/lib/types/switch.ws.d.ts +5 -0
  112. package/lib/types/tabs.d.ts +3 -12
  113. package/lib/types/theme/radix-common-types.d.ts +3 -2
  114. package/lib/types/theme/styles.d.ts +215 -0
  115. package/lib/types/theme/tailwind-classes.d.ts +16 -6
  116. package/lib/types/theme/tailwind-colors.d.ts +1 -0
  117. package/lib/types/theme/tailwind-theme.d.ts +1 -1
  118. package/package.json +12 -7
  119. package/src/__generated__/accordion.props.ts +675 -108
  120. package/src/__generated__/button.props.ts +177 -45
  121. package/src/__generated__/checkbox.props.ts +1217 -0
  122. package/src/__generated__/collapsible.props.ts +261 -42
  123. package/src/__generated__/dialog.props.ts +682 -115
  124. package/src/__generated__/input.props.ts +292 -44
  125. package/src/__generated__/label.props.ts +137 -22
  126. package/src/__generated__/navigation-menu.props.ts +2882 -0
  127. package/src/__generated__/popover.props.ts +142 -24
  128. package/src/__generated__/radio-group.props.ts +1828 -0
  129. package/src/__generated__/select.props.ts +4130 -0
  130. package/src/__generated__/sheet.props.ts +657 -110
  131. package/src/__generated__/switch.props.ts +1217 -0
  132. package/src/__generated__/tabs.props.ts +1019 -67
  133. package/src/__generated__/textarea.props.ts +195 -30
  134. package/src/__generated__/tooltip.props.ts +145 -25
  135. package/src/accordion.tsx +14 -7
  136. package/src/accordion.ws.ts +87 -70
  137. package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
  138. package/src/checkbox.tsx +22 -0
  139. package/src/checkbox.ws.ts +154 -0
  140. package/src/collapsible.ws.ts +6 -1
  141. package/src/components.ts +25 -12
  142. package/src/dialog.ws.tsx +17 -16
  143. package/src/hooks.ts +4 -0
  144. package/src/label.ws.ts +3 -1
  145. package/src/metas.ts +36 -12
  146. package/src/navigation-menu.stories.tsx +21 -0
  147. package/src/navigation-menu.tsx +130 -0
  148. package/src/navigation-menu.ws.ts +524 -0
  149. package/src/popover.ws.tsx +13 -9
  150. package/src/props-descriptions.ts +43 -0
  151. package/src/props.ts +35 -12
  152. package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
  153. package/src/radio-group.tsx +17 -0
  154. package/src/radio-group.ws.ts +178 -0
  155. package/src/select.stories.tsx +21 -0
  156. package/src/select.tsx +112 -0
  157. package/src/select.ws.ts +349 -0
  158. package/src/sheet.ws.tsx +91 -209
  159. package/src/{button.stories.ts → switch.stories.ts} +6 -19
  160. package/src/switch.tsx +10 -0
  161. package/src/switch.ws.ts +146 -0
  162. package/src/tabs.tsx +4 -17
  163. package/src/tabs.ws.ts +19 -19
  164. package/src/theme/radix-common-types.ts +3 -2
  165. package/src/theme/styles.ts +80 -0
  166. package/src/theme/tailwind-classes.ts +150 -14
  167. package/src/theme/tailwind-colors.ts +1 -0
  168. package/src/tooltip.ws.tsx +13 -8
  169. package/lib/button.js +0 -8
  170. package/lib/button.ws.js +0 -133
  171. package/lib/cjs/button.ws.js +0 -160
  172. package/lib/cjs/input.ws.js +0 -103
  173. package/lib/cjs/textarea.ws.js +0 -98
  174. package/lib/input.js +0 -8
  175. package/lib/input.ws.js +0 -75
  176. package/lib/textarea.js +0 -8
  177. package/lib/textarea.ws.js +0 -70
  178. package/lib/types/button.d.ts +0 -7
  179. package/lib/types/button.stories.d.ts +0 -20
  180. package/lib/types/button.ws.d.ts +0 -7
  181. package/lib/types/input.d.ts +0 -2
  182. package/lib/types/input.stories.d.ts +0 -20
  183. package/lib/types/input.ws.d.ts +0 -3
  184. package/lib/types/textarea.d.ts +0 -2
  185. package/lib/types/textarea.stories.d.ts +0 -14
  186. package/lib/types/textarea.ws.d.ts +0 -3
  187. package/src/button.tsx +0 -25
  188. package/src/button.ws.ts +0 -155
  189. package/src/input.tsx +0 -12
  190. package/src/input.ws.ts +0 -78
  191. package/src/textarea.tsx +0 -12
  192. package/src/textarea.ws.ts +0 -74
@@ -38,10 +38,10 @@ __export(tooltip_ws_exports, {
38
38
  module.exports = __toCommonJS(tooltip_ws_exports);
39
39
  var import_svg = require("@webstudio-is/icons/svg");
40
40
  var import_react_sdk = require("@webstudio-is/react-sdk");
41
+ var import_css_normalize = require("@webstudio-is/react-sdk/css-normalize");
41
42
  var tc = __toESM(require("./theme/tailwind-classes"), 1);
42
43
  var import_tooltip = require("./__generated__/tooltip.props");
43
- var import_css_normalize = require("@webstudio-is/react-sdk/css-normalize");
44
- var import_button = require("./button.ws");
44
+ var import_styles = require("./theme/styles");
45
45
  const presetStyle = {
46
46
  div: import_css_normalize.div
47
47
  };
@@ -61,10 +61,11 @@ const metaTooltipContent = {
61
61
  };
62
62
  const metaTooltip = {
63
63
  category: "radix",
64
+ order: 7,
64
65
  type: "container",
65
66
  icon: import_svg.TooltipIcon,
66
- order: 15,
67
67
  stylable: false,
68
+ description: "Displays content that is related to the trigger, when the trigger is hovered with the mouse or focused with the keyboard. You are reading an example of a tooltip right now.",
68
69
  template: [
69
70
  {
70
71
  type: "instance",
@@ -90,15 +91,18 @@ const metaTooltip = {
90
91
  {
91
92
  type: "instance",
92
93
  component: "TooltipTrigger",
93
- props: [],
94
- children: (0, import_button.template)({
95
- children: [{ type: "text", value: "Button" }]
96
- })
94
+ children: [
95
+ {
96
+ type: "instance",
97
+ component: "Button",
98
+ styles: (0, import_styles.getButtonStyles)("outline"),
99
+ children: [{ type: "text", value: "Button" }]
100
+ }
101
+ ]
97
102
  },
98
103
  {
99
104
  type: "instance",
100
105
  component: "TooltipContent",
101
- props: [],
102
106
  /**
103
107
  * z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md
104
108
  **/
@@ -3,20 +3,23 @@ import {
3
3
  TriggerIcon,
4
4
  ContentIcon
5
5
  } from "@webstudio-is/icons/svg";
6
+ import { div } from "@webstudio-is/react-sdk/css-normalize";
6
7
  import {
7
8
  propsCollapsible,
8
9
  propsCollapsibleContent,
9
10
  propsCollapsibleTrigger
10
11
  } from "./__generated__/collapsible.props";
11
- import { div } from "@webstudio-is/react-sdk/css-normalize";
12
+ import { getButtonStyles } from "./theme/styles";
12
13
  const presetStyle = {
13
14
  div
14
15
  };
15
16
  const metaCollapsible = {
16
17
  category: "radix",
18
+ order: 5,
17
19
  type: "container",
18
20
  presetStyle,
19
21
  icon: CollapsibleIcon,
22
+ description: "An interactive component which expands and collapses some content, triggered by a button.",
20
23
  template: [
21
24
  {
22
25
  type: "instance",
@@ -46,6 +49,7 @@ const metaCollapsible = {
46
49
  {
47
50
  type: "instance",
48
51
  component: "Button",
52
+ styles: getButtonStyles("outline"),
49
53
  children: [{ type: "text", value: "Click to toggle content" }]
50
54
  }
51
55
  ]
package/lib/components.js CHANGED
@@ -14,19 +14,7 @@ import {
14
14
  } from "./dialog";
15
15
  import { Popover, PopoverTrigger, PopoverContent } from "./popover";
16
16
  import { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
17
- import {
18
- Sheet,
19
- SheetTrigger,
20
- SheetOverlay,
21
- SheetContent,
22
- SheetClose,
23
- SheetTitle,
24
- SheetDescription
25
- } from "./sheet";
26
17
  import { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
27
- import { Button } from "./button";
28
- import { Input } from "./input";
29
- import { Textarea } from "./textarea";
30
18
  import { Label } from "./label";
31
19
  import {
32
20
  Accordion,
@@ -35,13 +23,36 @@ import {
35
23
  AccordionTrigger,
36
24
  AccordionContent
37
25
  } from "./accordion";
26
+ import {
27
+ NavigationMenu,
28
+ NavigationMenuList,
29
+ NavigationMenuItem,
30
+ NavigationMenuTrigger,
31
+ NavigationMenuContent,
32
+ NavigationMenuLink,
33
+ NavigationMenuViewport
34
+ } from "./navigation-menu";
35
+ import {
36
+ Select,
37
+ SelectTrigger,
38
+ SelectValue,
39
+ SelectViewport,
40
+ SelectContent,
41
+ SelectItem,
42
+ SelectItemIndicator,
43
+ SelectItemText
44
+ } from "./select";
45
+ import { Switch, SwitchThumb } from "./switch";
46
+ import { Checkbox, CheckboxIndicator } from "./checkbox";
47
+ import { RadioGroup, RadioGroupItem, RadioGroupIndicator } from "./radio-group";
38
48
  export {
39
49
  Accordion,
40
50
  AccordionContent,
41
51
  AccordionHeader,
42
52
  AccordionItem,
43
53
  AccordionTrigger,
44
- Button,
54
+ Checkbox,
55
+ CheckboxIndicator,
45
56
  Collapsible,
46
57
  CollapsibleContent,
47
58
  CollapsibleTrigger,
@@ -52,23 +63,34 @@ export {
52
63
  DialogOverlay,
53
64
  DialogTitle,
54
65
  DialogTrigger,
55
- Input,
56
66
  Label,
67
+ NavigationMenu,
68
+ NavigationMenuContent,
69
+ NavigationMenuItem,
70
+ NavigationMenuLink,
71
+ NavigationMenuList,
72
+ NavigationMenuTrigger,
73
+ NavigationMenuViewport,
57
74
  Popover,
58
75
  PopoverContent,
59
76
  PopoverTrigger,
60
- Sheet,
61
- SheetClose,
62
- SheetContent,
63
- SheetDescription,
64
- SheetOverlay,
65
- SheetTitle,
66
- SheetTrigger,
77
+ RadioGroup,
78
+ RadioGroupIndicator,
79
+ RadioGroupItem,
80
+ Select,
81
+ SelectContent,
82
+ SelectItem,
83
+ SelectItemIndicator,
84
+ SelectItemText,
85
+ SelectTrigger,
86
+ SelectValue,
87
+ SelectViewport,
88
+ Switch,
89
+ SwitchThumb,
67
90
  Tabs,
68
91
  TabsContent,
69
92
  TabsList,
70
93
  TabsTrigger,
71
- Textarea,
72
94
  Tooltip,
73
95
  TooltipContent,
74
96
  TooltipTrigger
package/lib/dialog.ws.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  } from "@webstudio-is/icons/svg";
10
10
  import {
11
11
  } from "@webstudio-is/react-sdk";
12
+ import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
12
13
  import * as tc from "./theme/tailwind-classes";
13
14
  import {
14
15
  propsDialog,
@@ -19,8 +20,7 @@ import {
19
20
  propsDialogTitle,
20
21
  propsDialogDescription
21
22
  } from "./__generated__/dialog.props";
22
- import { template as buttonTemplate } from "./button.ws";
23
- import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
23
+ import { getButtonStyles } from "./theme/styles";
24
24
  const presetStyle = {
25
25
  div
26
26
  };
@@ -70,14 +70,16 @@ const metaDialogClose = {
70
70
  category: "hidden",
71
71
  type: "container",
72
72
  presetStyle: buttonPresetStyle,
73
- icon: ButtonElementIcon
73
+ icon: ButtonElementIcon,
74
+ label: "Close Button"
74
75
  };
75
76
  const metaDialog = {
76
77
  category: "radix",
78
+ order: 4,
77
79
  type: "container",
78
80
  icon: DialogIcon,
79
- order: 15,
80
81
  stylable: false,
82
+ description: "Displays content with an overlay that covers the window, triggered by a button. Clicking the overlay will close the dialog.",
81
83
  template: [
82
84
  {
83
85
  type: "instance",
@@ -103,15 +105,18 @@ const metaDialog = {
103
105
  {
104
106
  type: "instance",
105
107
  component: "DialogTrigger",
106
- props: [],
107
- children: buttonTemplate({
108
- children: [{ type: "text", value: "Button" }]
109
- })
108
+ children: [
109
+ {
110
+ type: "instance",
111
+ component: "Button",
112
+ styles: getButtonStyles("outline"),
113
+ children: [{ type: "text", value: "Button" }]
114
+ }
115
+ ]
110
116
  },
111
117
  {
112
118
  type: "instance",
113
119
  component: "DialogOverlay",
114
- props: [],
115
120
  /**
116
121
  * fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
117
122
  * flex
@@ -123,13 +128,13 @@ const metaDialog = {
123
128
  tc.bg("background", 80),
124
129
  tc.backdropBlur("sm"),
125
130
  // To allow positioning Content
126
- tc.flex()
131
+ tc.flex(),
132
+ tc.overflow("auto")
127
133
  ].flat(),
128
134
  children: [
129
135
  {
130
136
  type: "instance",
131
137
  component: "DialogContent",
132
- props: [],
133
138
  /**
134
139
  * fixed w-full z-50
135
140
  * grid gap-4 max-w-lg
@@ -155,13 +160,11 @@ const metaDialog = {
155
160
  type: "instance",
156
161
  component: "Box",
157
162
  label: "Dialog Header",
158
- props: [],
159
163
  styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
160
164
  children: [
161
165
  {
162
166
  type: "instance",
163
167
  component: "DialogTitle",
164
- props: [],
165
168
  /**
166
169
  * text-lg leading-none tracking-tight
167
170
  **/
@@ -181,7 +184,6 @@ const metaDialog = {
181
184
  {
182
185
  type: "instance",
183
186
  component: "DialogDescription",
184
- props: [],
185
187
  /**
186
188
  * text-sm text-muted-foreground
187
189
  **/
@@ -193,7 +195,7 @@ const metaDialog = {
193
195
  children: [
194
196
  {
195
197
  type: "text",
196
- value: "dialog description text you can edit"
198
+ value: "Dialog description text you can edit"
197
199
  }
198
200
  ]
199
201
  }
@@ -207,7 +209,6 @@ const metaDialog = {
207
209
  {
208
210
  type: "instance",
209
211
  component: "DialogClose",
210
- props: [],
211
212
  /**
212
213
  * absolute right-4 top-4
213
214
  * rounded-sm opacity-70
@@ -244,7 +245,7 @@ const metaDialog = {
244
245
  };
245
246
  const propsMetaDialog = {
246
247
  props: propsDialog,
247
- initialProps: ["open", "modal"]
248
+ initialProps: ["open"]
248
249
  };
249
250
  const propsMetaDialogTrigger = {
250
251
  props: propsDialogTrigger
package/lib/hooks.js CHANGED
@@ -5,6 +5,8 @@ import { hooksPopover } from "./popover";
5
5
  import { hooksSheet } from "./sheet";
6
6
  import { hooksTooltip } from "./tooltip";
7
7
  import { hooksAccordion } from "./accordion";
8
+ import { hooksNavigationMenu } from "./navigation-menu";
9
+ import { hooksSelect } from "./select";
8
10
  const hooks = [
9
11
  hooksCollapsible,
10
12
  hooksTabs,
@@ -12,7 +14,9 @@ const hooks = [
12
14
  hooksPopover,
13
15
  hooksSheet,
14
16
  hooksTooltip,
15
- hooksAccordion
17
+ hooksAccordion,
18
+ hooksNavigationMenu,
19
+ hooksSelect
16
20
  ];
17
21
  export {
18
22
  hooks
package/lib/label.ws.js CHANGED
@@ -10,11 +10,12 @@ const presetStyle = {
10
10
  };
11
11
  const meta = {
12
12
  category: "radix",
13
+ order: 102,
13
14
  type: "container",
14
15
  icon: LabelIcon,
15
16
  presetStyle,
16
17
  states: defaultStates,
17
- order: 1,
18
+ description: "An accessible label to describe the purpose of an input. Match the \u201CFor\u201D property on the label with the \u201CID\u201D of the input to connect them.",
18
19
  template: [
19
20
  {
20
21
  type: "instance",
package/lib/metas.js CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  metaDialogTitle,
13
13
  metaDialogDescription
14
14
  } from "./dialog.ws";
15
+ import { meta } from "./sheet.ws";
15
16
  import {
16
17
  metaPopover,
17
18
  metaPopoverTrigger,
@@ -22,25 +23,13 @@ import {
22
23
  metaTooltipTrigger,
23
24
  metaTooltipContent
24
25
  } from "./tooltip.ws";
25
- import {
26
- metaSheet,
27
- metaSheetTrigger,
28
- metaSheetOverlay,
29
- metaSheetContent,
30
- metaSheetClose,
31
- metaSheetTitle,
32
- metaSheetDescription
33
- } from "./sheet.ws";
34
26
  import {
35
27
  metaTabs,
36
28
  metaTabsList,
37
29
  metaTabsTrigger,
38
30
  metaTabsContent
39
31
  } from "./tabs.ws";
40
- import { meta } from "./button.ws";
41
- import { meta as meta2 } from "./input.ws";
42
- import { meta as meta3 } from "./textarea.ws";
43
- import { meta as meta4 } from "./label.ws";
32
+ import { meta as meta2 } from "./label.ws";
44
33
  import {
45
34
  metaAccordion,
46
35
  metaAccordionItem,
@@ -48,13 +37,46 @@ import {
48
37
  metaAccordionTrigger,
49
38
  metaAccordionContent
50
39
  } from "./accordion.ws";
40
+ import {
41
+ metaNavigationMenu,
42
+ metaNavigationMenuList,
43
+ metaNavigationMenuItem,
44
+ metaNavigationMenuTrigger,
45
+ metaNavigationMenuContent,
46
+ metaNavigationMenuLink,
47
+ metaNavigationMenuViewport
48
+ } from "./navigation-menu.ws";
49
+ import {
50
+ metaSelect,
51
+ metaSelectTrigger,
52
+ metaSelectValue,
53
+ metaSelectViewport,
54
+ metaSelectContent,
55
+ metaSelectItem,
56
+ metaSelectItemIndicator,
57
+ metaSelectItemText
58
+ } from "./select.ws";
59
+ import {
60
+ metaSwitch,
61
+ metaSwitchThumb
62
+ } from "./switch.ws";
63
+ import {
64
+ metaCheckbox,
65
+ metaCheckboxIndicator
66
+ } from "./checkbox.ws";
67
+ import {
68
+ metaRadioGroup,
69
+ metaRadioGroupItem,
70
+ metaRadioGroupIndicator
71
+ } from "./radio-group.ws";
51
72
  export {
52
73
  metaAccordion as Accordion,
53
74
  metaAccordionContent as AccordionContent,
54
75
  metaAccordionHeader as AccordionHeader,
55
76
  metaAccordionItem as AccordionItem,
56
77
  metaAccordionTrigger as AccordionTrigger,
57
- meta as Button,
78
+ metaCheckbox as Checkbox,
79
+ metaCheckboxIndicator as CheckboxIndicator,
58
80
  metaCollapsible as Collapsible,
59
81
  metaCollapsibleContent as CollapsibleContent,
60
82
  metaCollapsibleTrigger as CollapsibleTrigger,
@@ -65,23 +87,35 @@ export {
65
87
  metaDialogOverlay as DialogOverlay,
66
88
  metaDialogTitle as DialogTitle,
67
89
  metaDialogTrigger as DialogTrigger,
68
- meta2 as Input,
69
- meta4 as Label,
90
+ meta2 as Label,
91
+ metaNavigationMenu as NavigationMenu,
92
+ metaNavigationMenuContent as NavigationMenuContent,
93
+ metaNavigationMenuItem as NavigationMenuItem,
94
+ metaNavigationMenuLink as NavigationMenuLink,
95
+ metaNavigationMenuList as NavigationMenuList,
96
+ metaNavigationMenuTrigger as NavigationMenuTrigger,
97
+ metaNavigationMenuViewport as NavigationMenuViewport,
70
98
  metaPopover as Popover,
71
99
  metaPopoverContent as PopoverContent,
72
100
  metaPopoverTrigger as PopoverTrigger,
73
- metaSheet as Sheet,
74
- metaSheetClose as SheetClose,
75
- metaSheetContent as SheetContent,
76
- metaSheetDescription as SheetDescription,
77
- metaSheetOverlay as SheetOverlay,
78
- metaSheetTitle as SheetTitle,
79
- metaSheetTrigger as SheetTrigger,
101
+ metaRadioGroup as RadioGroup,
102
+ metaRadioGroupIndicator as RadioGroupIndicator,
103
+ metaRadioGroupItem as RadioGroupItem,
104
+ metaSelect as Select,
105
+ metaSelectContent as SelectContent,
106
+ metaSelectItem as SelectItem,
107
+ metaSelectItemIndicator as SelectItemIndicator,
108
+ metaSelectItemText as SelectItemText,
109
+ metaSelectTrigger as SelectTrigger,
110
+ metaSelectValue as SelectValue,
111
+ metaSelectViewport as SelectViewport,
112
+ meta as Sheet,
113
+ metaSwitch as Switch,
114
+ metaSwitchThumb as SwitchThumb,
80
115
  metaTabs as Tabs,
81
116
  metaTabsContent as TabsContent,
82
117
  metaTabsList as TabsList,
83
118
  metaTabsTrigger as TabsTrigger,
84
- meta3 as Textarea,
85
119
  metaTooltip as Tooltip,
86
120
  metaTooltipContent as TooltipContent,
87
121
  metaTooltipTrigger as TooltipTrigger
@@ -0,0 +1,85 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
3
+ import {
4
+ getClosestInstance,
5
+ getIndexWithinAncestorFromComponentProps,
6
+ ReactSdkContext
7
+ } from "@webstudio-is/react-sdk";
8
+ import {
9
+ Children,
10
+ forwardRef,
11
+ useContext
12
+ } from "react";
13
+ const NavigationMenu = forwardRef(({ value: propsValue, ...props }, ref) => {
14
+ const { renderer } = useContext(ReactSdkContext);
15
+ let value = propsValue;
16
+ if (renderer === "canvas") {
17
+ value = value === "" ? "-1" : value;
18
+ }
19
+ return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Root, { ref, value, ...props });
20
+ });
21
+ const NavigationMenuList = NavigationMenuPrimitive.List;
22
+ const NavigationMenuViewport = NavigationMenuPrimitive.Viewport;
23
+ const NavigationMenuContent = NavigationMenuPrimitive.Content;
24
+ const NavigationMenuItem = forwardRef(({ value, ...props }, ref) => {
25
+ const index = getIndexWithinAncestorFromComponentProps(props);
26
+ return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Item, { ref, value: value ?? index, ...props });
27
+ });
28
+ const NavigationMenuLink = forwardRef(({ children, ...props }, ref) => {
29
+ const firstChild = Children.toArray(children)[0];
30
+ return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Link, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("a", { children: "Add link component" }) });
31
+ });
32
+ const NavigationMenuTrigger = forwardRef(({ children, ...props }, ref) => {
33
+ const firstChild = Children.toArray(children)[0];
34
+ return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
35
+ });
36
+ const namespace = "@webstudio-is/sdk-components-react-radix";
37
+ const hooksNavigationMenu = {
38
+ onNavigatorUnselect: (context, event) => {
39
+ for (const instance of event.instancePath) {
40
+ if (instance.component === `${namespace}:NavigationMenuContent`) {
41
+ const menu = getClosestInstance(
42
+ event.instancePath,
43
+ instance,
44
+ `${namespace}:NavigationMenu`
45
+ );
46
+ if (menu) {
47
+ context.setPropVariable(menu.id, "value", "");
48
+ }
49
+ }
50
+ }
51
+ },
52
+ onNavigatorSelect: (context, event) => {
53
+ for (const instance of event.instancePath) {
54
+ if (instance.component === `${namespace}:NavigationMenuContent`) {
55
+ const menu = getClosestInstance(
56
+ event.instancePath,
57
+ instance,
58
+ `${namespace}:NavigationMenu`
59
+ );
60
+ const menuItem = getClosestInstance(
61
+ event.instancePath,
62
+ instance,
63
+ `${namespace}:NavigationMenuItem`
64
+ );
65
+ if (menuItem === void 0 || menu === void 0) {
66
+ return;
67
+ }
68
+ const contentValue = context.getPropValue(menuItem.id, "value") ?? context.indexesWithinAncestors.get(menuItem.id)?.toString();
69
+ if (contentValue) {
70
+ context.setPropVariable(menu.id, "value", contentValue);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ };
76
+ export {
77
+ NavigationMenu,
78
+ NavigationMenuContent,
79
+ NavigationMenuItem,
80
+ NavigationMenuLink,
81
+ NavigationMenuList,
82
+ NavigationMenuTrigger,
83
+ NavigationMenuViewport,
84
+ hooksNavigationMenu
85
+ };