@webstudio-is/sdk-components-react-radix 0.87.0 → 0.88.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 (182) hide show
  1. package/lib/__generated__/accordion.props.js +0 -5
  2. package/lib/__generated__/button.props.js +0 -21
  3. package/lib/__generated__/checkbox.props.js +850 -0
  4. package/lib/__generated__/collapsible.props.js +0 -2
  5. package/lib/__generated__/dialog.props.js +0 -11
  6. package/lib/__generated__/label.props.js +0 -1
  7. package/lib/__generated__/navigation-menu.props.js +2104 -0
  8. package/lib/__generated__/popover.props.js +0 -3
  9. package/lib/__generated__/radio-group.props.js +1282 -0
  10. package/lib/__generated__/select.props.js +2962 -0
  11. package/lib/__generated__/sheet.props.js +0 -11
  12. package/lib/__generated__/switch.props.js +850 -0
  13. package/lib/__generated__/tabs.props.js +428 -5
  14. package/lib/__generated__/tooltip.props.js +0 -2
  15. package/lib/accordion.js +11 -4
  16. package/lib/accordion.ws.js +87 -72
  17. package/lib/checkbox.js +13 -0
  18. package/lib/checkbox.ws.js +151 -0
  19. package/lib/cjs/__generated__/accordion.props.js +0 -5
  20. package/lib/cjs/__generated__/button.props.js +0 -21
  21. package/lib/cjs/__generated__/checkbox.props.js +870 -0
  22. package/lib/cjs/__generated__/collapsible.props.js +0 -2
  23. package/lib/cjs/__generated__/dialog.props.js +0 -11
  24. package/lib/cjs/__generated__/label.props.js +0 -1
  25. package/lib/cjs/__generated__/navigation-menu.props.js +2124 -0
  26. package/lib/cjs/__generated__/popover.props.js +0 -3
  27. package/lib/cjs/__generated__/radio-group.props.js +1302 -0
  28. package/lib/cjs/__generated__/select.props.js +2982 -0
  29. package/lib/cjs/__generated__/sheet.props.js +0 -11
  30. package/lib/cjs/__generated__/switch.props.js +870 -0
  31. package/lib/cjs/__generated__/tabs.props.js +428 -5
  32. package/lib/cjs/__generated__/tooltip.props.js +0 -2
  33. package/lib/cjs/accordion.js +11 -4
  34. package/lib/cjs/accordion.ws.js +85 -71
  35. package/lib/cjs/{textarea.js → checkbox.js} +9 -6
  36. package/lib/cjs/checkbox.ws.js +172 -0
  37. package/lib/cjs/collapsible.ws.js +4 -1
  38. package/lib/cjs/components.js +27 -14
  39. package/lib/cjs/dialog.ws.js +17 -17
  40. package/lib/cjs/hooks.js +5 -1
  41. package/lib/cjs/label.ws.js +1 -1
  42. package/lib/cjs/metas.js +29 -14
  43. package/lib/cjs/navigation-menu.js +107 -0
  44. package/lib/cjs/navigation-menu.ws.js +513 -0
  45. package/lib/cjs/popover.ws.js +12 -9
  46. package/lib/cjs/props.js +27 -14
  47. package/lib/cjs/{button.js → radio-group.js} +10 -8
  48. package/lib/cjs/radio-group.ws.js +188 -0
  49. package/lib/cjs/select.js +81 -0
  50. package/lib/cjs/select.ws.js +349 -0
  51. package/lib/cjs/sheet.ws.js +87 -176
  52. package/lib/cjs/{input.js → switch.js} +8 -9
  53. package/lib/cjs/switch.ws.js +171 -0
  54. package/lib/cjs/tabs.js +2 -3
  55. package/lib/cjs/tabs.ws.js +13 -18
  56. package/lib/cjs/theme/styles.js +100 -0
  57. package/lib/cjs/theme/tailwind-classes.js +125 -16
  58. package/lib/cjs/theme/tailwind-colors.js +1 -0
  59. package/lib/cjs/tooltip.ws.js +11 -8
  60. package/lib/collapsible.ws.js +4 -1
  61. package/lib/components.js +44 -22
  62. package/lib/dialog.ws.js +17 -17
  63. package/lib/hooks.js +5 -1
  64. package/lib/label.ws.js +1 -1
  65. package/lib/metas.js +58 -24
  66. package/lib/navigation-menu.js +85 -0
  67. package/lib/navigation-menu.ws.js +500 -0
  68. package/lib/popover.ws.js +12 -9
  69. package/lib/props.js +56 -24
  70. package/lib/radio-group.js +11 -0
  71. package/lib/radio-group.ws.js +170 -0
  72. package/lib/select.js +73 -0
  73. package/lib/select.ws.js +337 -0
  74. package/lib/sheet.ws.js +88 -194
  75. package/lib/switch.js +7 -0
  76. package/lib/switch.ws.js +143 -0
  77. package/lib/tabs.js +3 -5
  78. package/lib/tabs.ws.js +14 -19
  79. package/lib/theme/styles.js +70 -0
  80. package/lib/theme/tailwind-classes.js +125 -16
  81. package/lib/theme/tailwind-colors.js +1 -0
  82. package/lib/tooltip.ws.js +11 -8
  83. package/lib/types/__generated__/checkbox.props.d.ts +3 -0
  84. package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
  85. package/lib/types/__generated__/radio-group.props.d.ts +4 -0
  86. package/lib/types/__generated__/select.props.d.ts +9 -0
  87. package/lib/types/__generated__/switch.props.d.ts +3 -0
  88. package/lib/types/checkbox.d.ts +6 -0
  89. package/lib/types/checkbox.stories.d.ts +11 -0
  90. package/lib/types/checkbox.ws.d.ts +5 -0
  91. package/lib/types/components.d.ts +5 -4
  92. package/lib/types/metas.d.ts +6 -4
  93. package/lib/types/navigation-menu.d.ts +15 -0
  94. package/lib/types/navigation-menu.ws.d.ts +15 -0
  95. package/lib/types/props.d.ts +5 -4
  96. package/lib/types/radio-group.d.ts +5 -0
  97. package/lib/types/radio-group.stories.d.ts +9 -0
  98. package/lib/types/radio-group.ws.d.ts +7 -0
  99. package/lib/types/select.d.ts +12 -0
  100. package/lib/types/select.ws.d.ts +17 -0
  101. package/lib/types/sheet.ws.d.ts +2 -15
  102. package/lib/types/switch.d.ts +4 -0
  103. package/lib/types/switch.stories.d.ts +9 -0
  104. package/lib/types/switch.ws.d.ts +5 -0
  105. package/lib/types/tabs.d.ts +3 -12
  106. package/lib/types/theme/radix-common-types.d.ts +3 -2
  107. package/lib/types/theme/styles.d.ts +215 -0
  108. package/lib/types/theme/tailwind-classes.d.ts +16 -6
  109. package/lib/types/theme/tailwind-colors.d.ts +1 -0
  110. package/lib/types/theme/tailwind-theme.d.ts +1 -1
  111. package/package.json +12 -7
  112. package/src/__generated__/accordion.props.ts +0 -5
  113. package/src/__generated__/button.props.ts +0 -21
  114. package/src/__generated__/checkbox.props.ts +948 -0
  115. package/src/__generated__/collapsible.props.ts +0 -2
  116. package/src/__generated__/dialog.props.ts +0 -11
  117. package/src/__generated__/label.props.ts +0 -1
  118. package/src/__generated__/navigation-menu.props.ts +2349 -0
  119. package/src/__generated__/popover.props.ts +0 -3
  120. package/src/__generated__/radio-group.props.ts +1429 -0
  121. package/src/__generated__/select.props.ts +3304 -0
  122. package/src/__generated__/sheet.props.ts +0 -11
  123. package/src/__generated__/switch.props.ts +948 -0
  124. package/src/__generated__/tabs.props.ts +477 -4
  125. package/src/__generated__/tooltip.props.ts +0 -2
  126. package/src/accordion.tsx +14 -7
  127. package/src/accordion.ws.ts +85 -70
  128. package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
  129. package/src/checkbox.tsx +22 -0
  130. package/src/checkbox.ws.ts +151 -0
  131. package/src/collapsible.ws.ts +4 -1
  132. package/src/components.ts +25 -12
  133. package/src/dialog.ws.tsx +15 -16
  134. package/src/hooks.ts +4 -0
  135. package/src/label.ws.ts +1 -1
  136. package/src/metas.ts +36 -12
  137. package/src/navigation-menu.stories.tsx +21 -0
  138. package/src/navigation-menu.tsx +130 -0
  139. package/src/navigation-menu.ws.ts +523 -0
  140. package/src/popover.ws.tsx +12 -9
  141. package/src/props.ts +35 -12
  142. package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
  143. package/src/radio-group.tsx +17 -0
  144. package/src/radio-group.ws.ts +174 -0
  145. package/src/select.stories.tsx +21 -0
  146. package/src/select.tsx +107 -0
  147. package/src/select.ws.ts +347 -0
  148. package/src/sheet.ws.tsx +89 -209
  149. package/src/{button.stories.ts → switch.stories.ts} +6 -19
  150. package/src/switch.tsx +10 -0
  151. package/src/switch.ws.ts +143 -0
  152. package/src/tabs.tsx +4 -17
  153. package/src/tabs.ws.ts +17 -19
  154. package/src/theme/radix-common-types.ts +3 -2
  155. package/src/theme/styles.ts +80 -0
  156. package/src/theme/tailwind-classes.ts +150 -14
  157. package/src/theme/tailwind-colors.ts +1 -0
  158. package/src/tooltip.ws.tsx +11 -8
  159. package/lib/button.js +0 -8
  160. package/lib/button.ws.js +0 -133
  161. package/lib/cjs/button.ws.js +0 -160
  162. package/lib/cjs/input.ws.js +0 -103
  163. package/lib/cjs/textarea.ws.js +0 -98
  164. package/lib/input.js +0 -8
  165. package/lib/input.ws.js +0 -75
  166. package/lib/textarea.js +0 -8
  167. package/lib/textarea.ws.js +0 -70
  168. package/lib/types/button.d.ts +0 -7
  169. package/lib/types/button.stories.d.ts +0 -20
  170. package/lib/types/button.ws.d.ts +0 -7
  171. package/lib/types/input.d.ts +0 -2
  172. package/lib/types/input.stories.d.ts +0 -20
  173. package/lib/types/input.ws.d.ts +0 -3
  174. package/lib/types/textarea.d.ts +0 -2
  175. package/lib/types/textarea.stories.d.ts +0 -14
  176. package/lib/types/textarea.ws.d.ts +0 -3
  177. package/src/button.tsx +0 -25
  178. package/src/button.ws.ts +0 -155
  179. package/src/input.tsx +0 -12
  180. package/src/input.ws.ts +0 -78
  181. package/src/textarea.tsx +0 -12
  182. package/src/textarea.ws.ts +0 -74
@@ -0,0 +1,523 @@
1
+ import {
2
+ ContentIcon,
3
+ ListIcon,
4
+ ListItemIcon,
5
+ TriggerIcon,
6
+ BoxIcon,
7
+ ChevronDownIcon,
8
+ ViewportIcon,
9
+ NavigationMenuIcon,
10
+ } from "@webstudio-is/icons/svg";
11
+ import type {
12
+ PresetStyle,
13
+ WsComponentMeta,
14
+ WsComponentPropsMeta,
15
+ } from "@webstudio-is/react-sdk";
16
+ import { div } from "@webstudio-is/react-sdk/css-normalize";
17
+ import * as tc from "./theme/tailwind-classes";
18
+ import { getButtonStyles } from "./theme/styles";
19
+ import {
20
+ propsNavigationMenu,
21
+ propsNavigationMenuItem,
22
+ propsNavigationMenuTrigger,
23
+ propsNavigationMenuContent,
24
+ propsNavigationMenuLink,
25
+ propsNavigationMenuList,
26
+ propsNavigationMenuViewport,
27
+ } from "./__generated__/navigation-menu.props";
28
+
29
+ const presetStyle = {
30
+ div,
31
+ } satisfies PresetStyle<"div">;
32
+
33
+ const components = [
34
+ {
35
+ title: "Sheet",
36
+ href: "/docs/components/sheet",
37
+ description:
38
+ "Extends the Dialog component to display content that complements the main content of the screen.",
39
+ },
40
+ {
41
+ title: "Navigation Menu",
42
+ href: "/docs/components/navigation-menu",
43
+ description: "A collection of links for navigating websites.",
44
+ },
45
+ {
46
+ title: "Tabs",
47
+ href: "/docs/components/tabs",
48
+ description:
49
+ "A set of layered sections of content—known as tab panels—that are displayed one at a time.",
50
+ },
51
+ {
52
+ title: "Accordion",
53
+ href: "/docs/components/accordion",
54
+ description:
55
+ "A vertically stacked set of interactive headings that each reveal a section of content.",
56
+ },
57
+ {
58
+ title: "Dialog",
59
+ href: "/docs/components/dialog",
60
+ description:
61
+ "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.",
62
+ },
63
+ {
64
+ title: "Collapsible",
65
+ href: "/docs/components/collapsible",
66
+ description: "An interactive component which expands/collapses a panel.",
67
+ },
68
+
69
+ {
70
+ title: "Popover",
71
+ href: "/docs/components/popover",
72
+ description: "Displays rich content in a portal, triggered by a button.",
73
+ },
74
+
75
+ {
76
+ title: "Tooltip",
77
+ href: "/docs/components/tooltip",
78
+ description:
79
+ "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",
80
+ },
81
+
82
+ {
83
+ title: "Button",
84
+ href: "/docs/components/button",
85
+ description: "Displays a button or a component that looks like a button.",
86
+ },
87
+ ];
88
+
89
+ const navItem = (
90
+ props: (typeof components)[number]
91
+ ): NonNullable<WsComponentMeta["template"]> => [
92
+ {
93
+ type: "instance",
94
+ component: "NavigationMenuLink",
95
+ children: [
96
+ {
97
+ type: "instance",
98
+ component: "Link",
99
+ // block select-none space-y-1 rounded-md p-3 leading-none
100
+ // no-underline outline-none transition-colors
101
+ // hover:bg-accent hover:text-accent-foreground
102
+ // focus:bg-accent focus:text-accent-foreground
103
+ styles: [
104
+ tc.text("inherit"),
105
+ tc.flex(),
106
+ tc.flex("col"),
107
+ tc.select("none"),
108
+ tc.gap(1),
109
+ tc.rounded("md"),
110
+ tc.p(3),
111
+ tc.leading("none"),
112
+ tc.noUnderline(),
113
+ tc.outline("none"),
114
+ tc.hover([tc.bg("accent"), tc.text("accentForeground")].flat()),
115
+ tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat()),
116
+ ].flat(),
117
+ props: [
118
+ {
119
+ name: "href",
120
+ type: "string",
121
+ value: `https://ui.shadcn.com${props.href}`,
122
+ },
123
+ ],
124
+ children: [
125
+ {
126
+ type: "instance",
127
+ component: "Text",
128
+ // text-sm font-medium leading-none
129
+ styles: [
130
+ tc.text("sm"),
131
+ tc.font("medium"),
132
+ tc.leading("none"),
133
+ ].flat(),
134
+ children: [
135
+ {
136
+ type: "text",
137
+ value: props.title,
138
+ },
139
+ ],
140
+ },
141
+ {
142
+ type: "instance",
143
+ component: "Paragraph",
144
+ // line-clamp-2 text-sm leading-snug text-muted-foreground
145
+ styles: [
146
+ tc.m(0),
147
+ tc.lineClamp(2),
148
+ tc.text("sm"),
149
+ tc.leading("snug"),
150
+ tc.text("mutedForeground"),
151
+ ].flat(),
152
+
153
+ children: [
154
+ {
155
+ type: "text",
156
+ value: props.description,
157
+ },
158
+ ],
159
+ },
160
+ ],
161
+ },
162
+ ],
163
+ },
164
+ ];
165
+
166
+ const navItemsList = (props: {
167
+ count: number;
168
+ offset: number;
169
+ }): NonNullable<WsComponentMeta["template"]> => [
170
+ {
171
+ type: "instance",
172
+ component: "Box",
173
+ label: "Flex Column",
174
+ styles: [tc.w(64), tc.flex(), tc.gap(4), tc.flex("col")].flat(),
175
+ children: Array.from(Array(props.count), (_, index) =>
176
+ navItem(components[index + props.offset])
177
+ ).flat(),
178
+ },
179
+ ];
180
+
181
+ const menuItemLink = (props: {
182
+ title: string;
183
+ }): NonNullable<WsComponentMeta["template"]> => [
184
+ {
185
+ type: "instance",
186
+ component: "NavigationMenuItem",
187
+ children: [
188
+ {
189
+ type: "instance",
190
+ component: "NavigationMenuLink",
191
+ children: [
192
+ {
193
+ type: "instance",
194
+ component: "Link",
195
+ styles: [
196
+ getButtonStyles("ghost", "sm"),
197
+ tc.noUnderline(),
198
+ tc.text("current"),
199
+ ].flat(),
200
+ children: [{ type: "text", value: props.title }],
201
+ },
202
+ ],
203
+ },
204
+ ],
205
+ },
206
+ ];
207
+
208
+ const menuItem = (props: {
209
+ title: string;
210
+ children: NonNullable<WsComponentMeta["template"]>;
211
+ padding: 0 | 2;
212
+ }): NonNullable<WsComponentMeta["template"]> => [
213
+ {
214
+ type: "instance",
215
+ component: "NavigationMenuItem",
216
+ children: [
217
+ {
218
+ type: "instance",
219
+ component: "NavigationMenuTrigger",
220
+ children: [
221
+ {
222
+ type: "instance",
223
+ component: "Button",
224
+ styles: [
225
+ getButtonStyles("ghost", "sm"),
226
+ tc.property("--navigation-menu-trigger-icon-transform", "0deg"),
227
+ tc.state(
228
+ [
229
+ tc.property(
230
+ "--navigation-menu-trigger-icon-transform",
231
+ "180deg"
232
+ ),
233
+ ],
234
+ "[data-state=open]"
235
+ ),
236
+ ].flat(),
237
+ children: [
238
+ {
239
+ type: "instance",
240
+ component: "Text",
241
+ children: [{ type: "text", value: props.title }],
242
+ },
243
+ {
244
+ type: "instance",
245
+ component: "Box",
246
+ label: "Icon Container",
247
+ // h-4 w-4 shrink-0 transition-transform duration-200
248
+ styles: [
249
+ tc.ml(1),
250
+ tc.property(
251
+ "rotate",
252
+ "--navigation-menu-trigger-icon-transform"
253
+ ),
254
+ tc.h(4),
255
+ tc.w(4),
256
+ tc.shrink(0),
257
+ tc.transition("all"),
258
+ tc.duration(200),
259
+ ].flat(),
260
+ children: [
261
+ {
262
+ type: "instance",
263
+ component: "HtmlEmbed",
264
+ label: "Chevron Icon",
265
+ props: [
266
+ {
267
+ type: "string",
268
+ name: "code",
269
+ value: ChevronDownIcon,
270
+ },
271
+ ],
272
+ children: [],
273
+ },
274
+ ],
275
+ },
276
+ ],
277
+ },
278
+ ],
279
+ },
280
+ {
281
+ type: "instance",
282
+ component: "NavigationMenuContent",
283
+ // left-0 top-0 absolute w-max
284
+ styles: [
285
+ tc.left(0),
286
+ tc.top(0),
287
+ tc.absolute(),
288
+ tc.w("max"),
289
+ tc.p(4),
290
+ ].flat(),
291
+ children: [
292
+ {
293
+ type: "instance",
294
+ component: "Box",
295
+ label: "Content",
296
+ styles: [tc.flex(), tc.gap(4), tc.p(props.padding)].flat(),
297
+ children: props.children,
298
+ },
299
+ ],
300
+ },
301
+ ],
302
+ },
303
+ ];
304
+
305
+ export const metaNavigationMenu: WsComponentMeta = {
306
+ category: "radix",
307
+ order: 2,
308
+ type: "container",
309
+ icon: NavigationMenuIcon,
310
+ presetStyle,
311
+
312
+ template: [
313
+ {
314
+ type: "instance",
315
+ component: "NavigationMenu",
316
+ dataSources: {
317
+ menuValue: { type: "variable", initialValue: "" },
318
+ },
319
+ props: [
320
+ { type: "dataSource", name: "value", dataSourceName: "menuValue" },
321
+ {
322
+ name: "onValueChange",
323
+ type: "action",
324
+ value: [
325
+ {
326
+ type: "execute",
327
+ args: ["value"],
328
+ code: `menuValue = value`,
329
+ },
330
+ ],
331
+ },
332
+ ],
333
+ // relative
334
+ // Omiting this: z-10 flex max-w-max flex-1 items-center justify-center
335
+ styles: [tc.relative(), tc.maxW("max")].flat(),
336
+ children: [
337
+ {
338
+ type: "instance",
339
+ component: "NavigationMenuList",
340
+ styles: [
341
+ // ul defaults in tailwind
342
+ tc.p(0),
343
+ tc.m(0),
344
+ // shadcdn styles
345
+ tc.flex(),
346
+ tc.flex(1),
347
+ tc.list("none"),
348
+ tc.items("center"),
349
+ tc.justify("center"),
350
+ tc.gap(1),
351
+ ].flat(),
352
+ children: [
353
+ ...menuItem({
354
+ title: "About",
355
+ padding: 2,
356
+ children: [
357
+ {
358
+ type: "instance",
359
+ component: "Box",
360
+ styles: [
361
+ tc.bg("border"),
362
+ tc.p(4),
363
+ tc.w(48),
364
+ tc.rounded("md"),
365
+ ].flat(),
366
+ children: [
367
+ {
368
+ type: "text",
369
+ value: "",
370
+ },
371
+ ],
372
+ },
373
+ ...navItemsList({ count: 3, offset: 0 }),
374
+ ],
375
+ }),
376
+ ...menuItem({
377
+ title: "Components",
378
+ padding: 0,
379
+ children: [
380
+ ...navItemsList({ count: 3, offset: 3 }),
381
+ ...navItemsList({ count: 3, offset: 6 }),
382
+ ],
383
+ }),
384
+ ...menuItemLink({ title: "Standalone" }),
385
+ ],
386
+ },
387
+
388
+ {
389
+ type: "instance",
390
+ component: "Box",
391
+ label: "Viewport Container",
392
+ // absolute left-0 top-full flex justify-center
393
+ styles: [
394
+ tc.absolute(),
395
+ tc.left(0),
396
+ tc.top("full"),
397
+ tc.flex(),
398
+ tc.justify("center"),
399
+ ].flat(),
400
+
401
+ children: [
402
+ {
403
+ type: "instance",
404
+ component: "NavigationMenuViewport",
405
+ /*
406
+ origin-top-center relative mt-1.5 w-full
407
+ overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg
408
+ h-[var(--radix-navigation-menu-viewport-height)]
409
+ w-[var(--radix-navigation-menu-viewport-width)]
410
+ // anims
411
+ [animation-duration:150ms!important] [transition-duration:150ms!important]
412
+ data-[state=open]:animate-in data-[state=closed]:animate-out
413
+ data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90
414
+ */
415
+ styles: [
416
+ tc.relative(),
417
+ tc.mt(1.5),
418
+ tc.overflow("hidden"),
419
+ tc.rounded("md"),
420
+ tc.border(),
421
+ tc.bg("popover"),
422
+ tc.text("popoverForeground"),
423
+ tc.shadow("lg"),
424
+ tc.property(
425
+ "height",
426
+ "--radix-navigation-menu-viewport-height"
427
+ ),
428
+ tc.property("width", "--radix-navigation-menu-viewport-width"),
429
+ ].flat(),
430
+ children: [],
431
+ },
432
+ ],
433
+ },
434
+ ],
435
+ },
436
+ ],
437
+ };
438
+
439
+ export const metaNavigationMenuList: WsComponentMeta = {
440
+ category: "hidden",
441
+ detachable: false,
442
+ type: "container",
443
+ icon: ListIcon,
444
+ requiredAncestors: ["NavigationMenu"],
445
+ presetStyle,
446
+ label: "Menu List",
447
+ };
448
+
449
+ export const metaNavigationMenuItem: WsComponentMeta = {
450
+ category: "hidden",
451
+ type: "container",
452
+ icon: ListItemIcon,
453
+ requiredAncestors: ["NavigationMenu"],
454
+ presetStyle,
455
+ indexWithinAncestor: "NavigationMenu",
456
+ label: "Menu Item",
457
+ };
458
+ export const metaNavigationMenuTrigger: WsComponentMeta = {
459
+ category: "hidden",
460
+ detachable: false,
461
+ stylable: false,
462
+ type: "container",
463
+ icon: TriggerIcon,
464
+ requiredAncestors: ["NavigationMenuItem"],
465
+ presetStyle,
466
+ label: "Menu Trigger",
467
+ };
468
+ export const metaNavigationMenuContent: WsComponentMeta = {
469
+ category: "hidden",
470
+ detachable: false,
471
+ type: "container",
472
+ icon: ContentIcon,
473
+ requiredAncestors: ["NavigationMenuItem"],
474
+ indexWithinAncestor: "NavigationMenu",
475
+ presetStyle,
476
+ label: "Menu Content",
477
+ };
478
+
479
+ export const metaNavigationMenuLink: WsComponentMeta = {
480
+ category: "hidden",
481
+ detachable: true,
482
+ type: "container",
483
+ stylable: false,
484
+ icon: BoxIcon,
485
+ // https://github.com/webstudio-is/webstudio-builder/issues/2193
486
+ // requiredAncestors: ["NavigationMenuContent", "NavigationMenuItem"],
487
+ // Temporary restrict to NavigationMenu
488
+ requiredAncestors: ["NavigationMenu"],
489
+ presetStyle,
490
+ label: "Accessible Link Wrapper",
491
+ };
492
+
493
+ export const metaNavigationMenuViewport: WsComponentMeta = {
494
+ category: "hidden",
495
+ detachable: true,
496
+ type: "container",
497
+ icon: ViewportIcon,
498
+ requiredAncestors: ["NavigationMenu"],
499
+ presetStyle,
500
+ label: "Menu Viewport",
501
+ };
502
+
503
+ export const propsMetaNavigationMenu: WsComponentPropsMeta = {
504
+ props: propsNavigationMenu,
505
+ };
506
+ export const propsMetaNavigationMenuItem: WsComponentPropsMeta = {
507
+ props: propsNavigationMenuItem,
508
+ };
509
+ export const propsMetaNavigationMenuTrigger: WsComponentPropsMeta = {
510
+ props: propsNavigationMenuTrigger,
511
+ };
512
+ export const propsMetaNavigationMenuContent: WsComponentPropsMeta = {
513
+ props: propsNavigationMenuContent,
514
+ };
515
+ export const propsMetaNavigationMenuLink: WsComponentPropsMeta = {
516
+ props: propsNavigationMenuLink,
517
+ };
518
+ export const propsMetaNavigationMenuList: WsComponentPropsMeta = {
519
+ props: propsNavigationMenuList,
520
+ };
521
+ export const propsMetaNavigationMenuViewport: WsComponentPropsMeta = {
522
+ props: propsNavigationMenuViewport,
523
+ };
@@ -4,14 +4,14 @@ import {
4
4
  type WsComponentMeta,
5
5
  type WsComponentPropsMeta,
6
6
  } from "@webstudio-is/react-sdk";
7
+ import { div } from "@webstudio-is/react-sdk/css-normalize";
7
8
  import * as tc from "./theme/tailwind-classes";
9
+ import { getButtonStyles } from "./theme/styles";
8
10
  import {
9
11
  propsPopover,
10
12
  propsPopoverContent,
11
13
  propsPopoverTrigger,
12
14
  } from "./__generated__/popover.props";
13
- import { div } from "@webstudio-is/react-sdk/css-normalize";
14
- import { template as buttonTemplate } from "./button.ws";
15
15
 
16
16
  const presetStyle = {
17
17
  div,
@@ -44,9 +44,9 @@ export const metaPopoverContent: WsComponentMeta = {
44
44
  **/
45
45
  export const metaPopover: WsComponentMeta = {
46
46
  category: "radix",
47
+ order: 6,
47
48
  type: "container",
48
49
  icon: PopoverIcon,
49
- order: 15,
50
50
  stylable: false,
51
51
  template: [
52
52
  {
@@ -73,15 +73,18 @@ export const metaPopover: WsComponentMeta = {
73
73
  {
74
74
  type: "instance",
75
75
  component: "PopoverTrigger",
76
- props: [],
77
- children: buttonTemplate({
78
- children: [{ type: "text", value: "Button" }],
79
- }),
76
+ children: [
77
+ {
78
+ type: "instance",
79
+ component: "Button",
80
+ styles: getButtonStyles("outline"),
81
+ children: [{ type: "text", value: "Button" }],
82
+ },
83
+ ],
80
84
  },
81
85
  {
82
86
  type: "instance",
83
87
  component: "PopoverContent",
84
- props: [],
85
88
  /**
86
89
  * z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none
87
90
  **/
@@ -111,7 +114,7 @@ export const metaPopover: WsComponentMeta = {
111
114
 
112
115
  export const propsMetaPopover: WsComponentPropsMeta = {
113
116
  props: propsPopover,
114
- initialProps: ["open", "modal"],
117
+ initialProps: ["open"],
115
118
  };
116
119
 
117
120
  export const propsMetaPopoverTrigger: WsComponentPropsMeta = {
package/src/props.ts CHANGED
@@ -22,24 +22,12 @@ export {
22
22
  propsMetaTooltipTrigger as TooltipTrigger,
23
23
  propsMetaTooltipContent as TooltipContent,
24
24
  } from "./tooltip.ws";
25
- export {
26
- propsMetaSheet as Sheet,
27
- propsMetaSheetTrigger as SheetTrigger,
28
- propsMetaSheetOverlay as SheetOverlay,
29
- propsMetaSheetContent as SheetContent,
30
- propsMetaSheetClose as SheetClose,
31
- propsMetaSheetTitle as SheetTitle,
32
- propsMetaSheetDescription as SheetDescription,
33
- } from "./sheet.ws";
34
25
  export {
35
26
  propsMetaTabs as Tabs,
36
27
  propsMetaTabsList as TabsList,
37
28
  propsMetaTabsTrigger as TabsTrigger,
38
29
  propsMetaTabsContent as TabsContent,
39
30
  } from "./tabs.ws";
40
- export { propsMeta as Button } from "./button.ws";
41
- export { propsMeta as Input } from "./input.ws";
42
- export { propsMeta as Textarea } from "./textarea.ws";
43
31
  export { propsMeta as Label } from "./label.ws";
44
32
  export {
45
33
  propsMetaAccordion as Accordion,
@@ -48,3 +36,38 @@ export {
48
36
  propsMetaAccordionTrigger as AccordionTrigger,
49
37
  propsMetaAccordionContent as AccordionContent,
50
38
  } from "./accordion.ws";
39
+
40
+ export {
41
+ propsMetaNavigationMenu as NavigationMenu,
42
+ propsMetaNavigationMenuList as NavigationMenuList,
43
+ propsMetaNavigationMenuItem as NavigationMenuItem,
44
+ propsMetaNavigationMenuTrigger as NavigationMenuTrigger,
45
+ propsMetaNavigationMenuContent as NavigationMenuContent,
46
+ propsMetaNavigationMenuLink as NavigationMenuLink,
47
+ propsMetaNavigationMenuViewport as NavigationMenuViewport,
48
+ } from "./navigation-menu.ws";
49
+
50
+ export {
51
+ propsMetaSelect as Select,
52
+ propsMetaSelectTrigger as SelectTrigger,
53
+ propsMetaSelectValue as SelectValue,
54
+ propsMetaSelectViewport as SelectViewport,
55
+ propsMetaSelectContent as SelectContent,
56
+ propsMetaSelectItem as SelectItem,
57
+ propsMetaSelectItemIndicator as SelectItemIndicator,
58
+ propsMetaSelectItemText as SelectItemText,
59
+ } from "./select.ws";
60
+
61
+ export {
62
+ propsMetaSwitch as Switch,
63
+ propsMetaSwitchThumb as SwitchThumb,
64
+ } from "./switch.ws";
65
+ export {
66
+ propsMetaCheckbox as Checkbox,
67
+ propsMetaCheckboxIndicator as CheckboxIndicator,
68
+ } from "./checkbox.ws";
69
+ export {
70
+ propsMetaRadioGroup as RadioGroup,
71
+ propsMetaRadioGroupItem as RadioGroupItem,
72
+ propsMetaRadioGroupIndicator as RadioGroupIndicator,
73
+ } from "./radio-group.ws";
@@ -1,29 +1,20 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { renderComponentTemplate } from "@webstudio-is/react-sdk";
3
- import { Input as InputPrimitive } from "./input";
4
3
  import * as baseComponents from "@webstudio-is/sdk-components-react";
5
4
  import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
6
5
  import * as radixComponents from "./components";
7
6
  import * as radixMetas from "./metas";
7
+ import { RadioGroup as RadioGroupPrimitive } from "./radio-group";
8
8
 
9
9
  export default {
10
- title: "Components/Input",
11
- component: InputPrimitive,
12
- argTypes: {
13
- placeholder: {
14
- type: "string",
15
- },
16
- type: {
17
- options: ["text", "file"],
18
- control: { type: "select" },
19
- },
20
- },
21
- } satisfies Meta<typeof InputPrimitive>;
10
+ title: "Components/RadioGroup",
11
+ component: RadioGroupPrimitive,
12
+ } satisfies Meta<typeof RadioGroupPrimitive>;
22
13
 
23
- export const Input: StoryObj<typeof InputPrimitive> = {
14
+ export const RadioGroup: StoryObj<typeof RadioGroupPrimitive> = {
24
15
  render: (props) =>
25
16
  renderComponentTemplate({
26
- name: "Input",
17
+ name: "RadioGroup",
27
18
  props: { ...props },
28
19
  components: { ...baseComponents, ...radixComponents },
29
20
  metas: { ...baseMetas, ...radixMetas },
@@ -0,0 +1,17 @@
1
+ import {
2
+ type ForwardRefExoticComponent,
3
+ type ComponentPropsWithRef,
4
+ } from "react";
5
+ import { Root, Item, Indicator } from "@radix-ui/react-radio-group";
6
+
7
+ export const RadioGroup: ForwardRefExoticComponent<
8
+ ComponentPropsWithRef<typeof Root>
9
+ > = Root;
10
+
11
+ export const RadioGroupItem: ForwardRefExoticComponent<
12
+ ComponentPropsWithRef<typeof Item>
13
+ > = Item;
14
+
15
+ export const RadioGroupIndicator: ForwardRefExoticComponent<
16
+ ComponentPropsWithRef<typeof Indicator>
17
+ > = Indicator;