@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
@@ -0,0 +1,524 @@
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
+ description: "A collection of links for navigating websites.",
310
+ icon: NavigationMenuIcon,
311
+ presetStyle,
312
+
313
+ template: [
314
+ {
315
+ type: "instance",
316
+ component: "NavigationMenu",
317
+ dataSources: {
318
+ menuValue: { type: "variable", initialValue: "" },
319
+ },
320
+ props: [
321
+ { type: "dataSource", name: "value", dataSourceName: "menuValue" },
322
+ {
323
+ name: "onValueChange",
324
+ type: "action",
325
+ value: [
326
+ {
327
+ type: "execute",
328
+ args: ["value"],
329
+ code: `menuValue = value`,
330
+ },
331
+ ],
332
+ },
333
+ ],
334
+ // relative
335
+ // Omiting this: z-10 flex max-w-max flex-1 items-center justify-center
336
+ styles: [tc.relative(), tc.maxW("max")].flat(),
337
+ children: [
338
+ {
339
+ type: "instance",
340
+ component: "NavigationMenuList",
341
+ styles: [
342
+ // ul defaults in tailwind
343
+ tc.p(0),
344
+ tc.m(0),
345
+ // shadcdn styles
346
+ tc.flex(),
347
+ tc.flex(1),
348
+ tc.list("none"),
349
+ tc.items("center"),
350
+ tc.justify("center"),
351
+ tc.gap(1),
352
+ ].flat(),
353
+ children: [
354
+ ...menuItem({
355
+ title: "About",
356
+ padding: 2,
357
+ children: [
358
+ {
359
+ type: "instance",
360
+ component: "Box",
361
+ styles: [
362
+ tc.bg("border"),
363
+ tc.p(4),
364
+ tc.w(48),
365
+ tc.rounded("md"),
366
+ ].flat(),
367
+ children: [
368
+ {
369
+ type: "text",
370
+ value: "",
371
+ },
372
+ ],
373
+ },
374
+ ...navItemsList({ count: 3, offset: 0 }),
375
+ ],
376
+ }),
377
+ ...menuItem({
378
+ title: "Components",
379
+ padding: 0,
380
+ children: [
381
+ ...navItemsList({ count: 3, offset: 3 }),
382
+ ...navItemsList({ count: 3, offset: 6 }),
383
+ ],
384
+ }),
385
+ ...menuItemLink({ title: "Standalone" }),
386
+ ],
387
+ },
388
+
389
+ {
390
+ type: "instance",
391
+ component: "Box",
392
+ label: "Viewport Container",
393
+ // absolute left-0 top-full flex justify-center
394
+ styles: [
395
+ tc.absolute(),
396
+ tc.left(0),
397
+ tc.top("full"),
398
+ tc.flex(),
399
+ tc.justify("center"),
400
+ ].flat(),
401
+
402
+ children: [
403
+ {
404
+ type: "instance",
405
+ component: "NavigationMenuViewport",
406
+ /*
407
+ origin-top-center relative mt-1.5 w-full
408
+ overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg
409
+ h-[var(--radix-navigation-menu-viewport-height)]
410
+ w-[var(--radix-navigation-menu-viewport-width)]
411
+ // anims
412
+ [animation-duration:150ms!important] [transition-duration:150ms!important]
413
+ data-[state=open]:animate-in data-[state=closed]:animate-out
414
+ data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90
415
+ */
416
+ styles: [
417
+ tc.relative(),
418
+ tc.mt(1.5),
419
+ tc.overflow("hidden"),
420
+ tc.rounded("md"),
421
+ tc.border(),
422
+ tc.bg("popover"),
423
+ tc.text("popoverForeground"),
424
+ tc.shadow("lg"),
425
+ tc.property(
426
+ "height",
427
+ "--radix-navigation-menu-viewport-height"
428
+ ),
429
+ tc.property("width", "--radix-navigation-menu-viewport-width"),
430
+ ].flat(),
431
+ children: [],
432
+ },
433
+ ],
434
+ },
435
+ ],
436
+ },
437
+ ],
438
+ };
439
+
440
+ export const metaNavigationMenuList: WsComponentMeta = {
441
+ category: "hidden",
442
+ detachable: false,
443
+ type: "container",
444
+ icon: ListIcon,
445
+ requiredAncestors: ["NavigationMenu"],
446
+ presetStyle,
447
+ label: "Menu List",
448
+ };
449
+
450
+ export const metaNavigationMenuItem: WsComponentMeta = {
451
+ category: "hidden",
452
+ type: "container",
453
+ icon: ListItemIcon,
454
+ requiredAncestors: ["NavigationMenu"],
455
+ presetStyle,
456
+ indexWithinAncestor: "NavigationMenu",
457
+ label: "Menu Item",
458
+ };
459
+ export const metaNavigationMenuTrigger: WsComponentMeta = {
460
+ category: "hidden",
461
+ detachable: false,
462
+ stylable: false,
463
+ type: "container",
464
+ icon: TriggerIcon,
465
+ requiredAncestors: ["NavigationMenuItem"],
466
+ presetStyle,
467
+ label: "Menu Trigger",
468
+ };
469
+ export const metaNavigationMenuContent: WsComponentMeta = {
470
+ category: "hidden",
471
+ detachable: false,
472
+ type: "container",
473
+ icon: ContentIcon,
474
+ requiredAncestors: ["NavigationMenuItem"],
475
+ indexWithinAncestor: "NavigationMenu",
476
+ presetStyle,
477
+ label: "Menu Content",
478
+ };
479
+
480
+ export const metaNavigationMenuLink: WsComponentMeta = {
481
+ category: "hidden",
482
+ detachable: true,
483
+ type: "container",
484
+ stylable: false,
485
+ icon: BoxIcon,
486
+ // https://github.com/webstudio-is/webstudio-builder/issues/2193
487
+ // requiredAncestors: ["NavigationMenuContent", "NavigationMenuItem"],
488
+ // Temporary restrict to NavigationMenu
489
+ requiredAncestors: ["NavigationMenu"],
490
+ presetStyle,
491
+ label: "Accessible Link Wrapper",
492
+ };
493
+
494
+ export const metaNavigationMenuViewport: WsComponentMeta = {
495
+ category: "hidden",
496
+ detachable: true,
497
+ type: "container",
498
+ icon: ViewportIcon,
499
+ requiredAncestors: ["NavigationMenu"],
500
+ presetStyle,
501
+ label: "Menu Viewport",
502
+ };
503
+
504
+ export const propsMetaNavigationMenu: WsComponentPropsMeta = {
505
+ props: propsNavigationMenu,
506
+ };
507
+ export const propsMetaNavigationMenuItem: WsComponentPropsMeta = {
508
+ props: propsNavigationMenuItem,
509
+ };
510
+ export const propsMetaNavigationMenuTrigger: WsComponentPropsMeta = {
511
+ props: propsNavigationMenuTrigger,
512
+ };
513
+ export const propsMetaNavigationMenuContent: WsComponentPropsMeta = {
514
+ props: propsNavigationMenuContent,
515
+ };
516
+ export const propsMetaNavigationMenuLink: WsComponentPropsMeta = {
517
+ props: propsNavigationMenuLink,
518
+ };
519
+ export const propsMetaNavigationMenuList: WsComponentPropsMeta = {
520
+ props: propsNavigationMenuList,
521
+ };
522
+ export const propsMetaNavigationMenuViewport: WsComponentPropsMeta = {
523
+ props: propsNavigationMenuViewport,
524
+ };
@@ -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,10 +44,11 @@ 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
+ description: "Displays rich content in a portal, triggered by a button.",
51
52
  template: [
52
53
  {
53
54
  type: "instance",
@@ -73,15 +74,18 @@ export const metaPopover: WsComponentMeta = {
73
74
  {
74
75
  type: "instance",
75
76
  component: "PopoverTrigger",
76
- props: [],
77
- children: buttonTemplate({
78
- children: [{ type: "text", value: "Button" }],
79
- }),
77
+ children: [
78
+ {
79
+ type: "instance",
80
+ component: "Button",
81
+ styles: getButtonStyles("outline"),
82
+ children: [{ type: "text", value: "Button" }],
83
+ },
84
+ ],
80
85
  },
81
86
  {
82
87
  type: "instance",
83
88
  component: "PopoverContent",
84
- props: [],
85
89
  /**
86
90
  * z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none
87
91
  **/
@@ -111,7 +115,7 @@ export const metaPopover: WsComponentMeta = {
111
115
 
112
116
  export const propsMetaPopover: WsComponentPropsMeta = {
113
117
  props: propsPopover,
114
- initialProps: ["open", "modal"],
118
+ initialProps: ["open"],
115
119
  };
116
120
 
117
121
  export const propsMetaPopoverTrigger: WsComponentPropsMeta = {
@@ -0,0 +1,43 @@
1
+ const open =
2
+ "Show or hide the content of this component on the canvas. This will not affect the initial state of the component.";
3
+
4
+ const alignOffset =
5
+ "The offset in pixels from the “start“ or “end“ alignment options.";
6
+
7
+ const sideOffset =
8
+ "The distance in pixels between the Content and the Trigger.";
9
+
10
+ const side =
11
+ "The preferred alignment against the Trigger. May change when collisions occur.";
12
+
13
+ export const propsDescriptions = {
14
+ Dialog: {
15
+ open,
16
+ },
17
+ Sheet: {
18
+ open,
19
+ },
20
+ Collapsible: {
21
+ open,
22
+ },
23
+ Popover: {
24
+ open,
25
+ },
26
+ PopoverContent: {
27
+ alignOffset,
28
+ sideOffset,
29
+ side,
30
+ },
31
+ Tooltip: {
32
+ open,
33
+ delayDuration:
34
+ "The delay before the Tooltip shows after the Trigger is hovered, in milliseconds. If no value is specified, the default is 700ms",
35
+ disableHoverableContent:
36
+ "When toggled, prevents the Tooltip content from showing when the Trigger is hovered.",
37
+ },
38
+ TooltipContent: {
39
+ alignOffset,
40
+ sideOffset,
41
+ side,
42
+ },
43
+ };
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";