@webstudio-is/sdk-components-react-radix 0.91.0 → 0.92.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 (199) hide show
  1. package/lib/__generated__/accordion.props.js +6 -12
  2. package/lib/__generated__/checkbox.props.js +3 -6
  3. package/lib/__generated__/collapsible.props.js +4 -8
  4. package/lib/__generated__/dialog.props.js +8 -16
  5. package/lib/__generated__/label.props.js +2 -4
  6. package/lib/__generated__/navigation-menu.props.js +8 -16
  7. package/lib/__generated__/popover.props.js +4 -8
  8. package/lib/__generated__/radio-group.props.js +4 -8
  9. package/lib/__generated__/select.props.js +15 -19
  10. package/lib/__generated__/sheet.props.js +8 -16
  11. package/lib/__generated__/switch.props.js +3 -6
  12. package/lib/__generated__/tabs.props.js +5 -10
  13. package/lib/__generated__/tooltip.props.js +4 -8
  14. package/lib/accordion.js +7 -14
  15. package/{src/accordion.stories.tsx → lib/accordion.stories.js} +9 -12
  16. package/lib/accordion.ws.js +11 -22
  17. package/lib/checkbox.js +3 -6
  18. package/lib/checkbox.stories.js +19 -0
  19. package/lib/checkbox.ws.js +5 -10
  20. package/lib/collapsible.js +5 -10
  21. package/{src/collapsible.stories.tsx → lib/collapsible.stories.js} +9 -12
  22. package/lib/collapsible.ws.js +7 -14
  23. package/lib/components.js +13 -62
  24. package/lib/dialog.js +9 -18
  25. package/{src/dialog.stories.tsx → lib/dialog.stories.js} +9 -12
  26. package/lib/dialog.ws.js +15 -30
  27. package/lib/hooks.js +2 -4
  28. package/lib/label.js +2 -4
  29. package/lib/label.stories.js +19 -0
  30. package/lib/label.ws.js +3 -6
  31. package/lib/metas.js +55 -105
  32. package/lib/navigation-menu.js +9 -18
  33. package/{src/navigation-menu.stories.tsx → lib/navigation-menu.stories.js} +9 -12
  34. package/lib/navigation-menu.ws.js +16 -31
  35. package/lib/popover.js +5 -10
  36. package/{src/popover.stories.tsx → lib/popover.stories.js} +9 -12
  37. package/lib/popover.ws.js +7 -14
  38. package/lib/props-descriptions.js +2 -4
  39. package/lib/props.js +54 -103
  40. package/lib/radio-group.js +4 -8
  41. package/lib/radio-group.stories.js +19 -0
  42. package/lib/radio-group.ws.js +7 -14
  43. package/lib/select.js +10 -20
  44. package/{src/select.stories.tsx → lib/select.stories.js} +9 -12
  45. package/lib/select.ws.js +17 -34
  46. package/lib/sheet.js +9 -18
  47. package/{src/sheet.stories.tsx → lib/sheet.stories.js} +9 -12
  48. package/lib/sheet.ws.js +2 -4
  49. package/lib/switch.js +3 -6
  50. package/lib/switch.stories.js +19 -0
  51. package/lib/switch.ws.js +5 -10
  52. package/lib/tabs.js +6 -12
  53. package/{src/tabs.stories.tsx → lib/tabs.stories.js} +9 -12
  54. package/lib/tabs.ws.js +9 -18
  55. package/lib/theme/__generated__/tailwind-theme.js +517 -0
  56. package/lib/theme/styles.js +3 -6
  57. package/lib/theme/tailwind-classes.js +149 -301
  58. package/lib/theme/tailwind-colors.js +2 -4
  59. package/lib/tooltip.js +5 -10
  60. package/{src/tooltip.stories.tsx → lib/tooltip.stories.js} +9 -12
  61. package/lib/tooltip.ws.js +7 -14
  62. package/lib/types/__generated__/accordion.props.d.ts +1 -1
  63. package/lib/types/__generated__/checkbox.props.d.ts +1 -1
  64. package/lib/types/__generated__/collapsible.props.d.ts +1 -1
  65. package/lib/types/__generated__/dialog.props.d.ts +1 -1
  66. package/lib/types/__generated__/label.props.d.ts +1 -1
  67. package/lib/types/__generated__/navigation-menu.props.d.ts +1 -1
  68. package/lib/types/__generated__/popover.props.d.ts +1 -1
  69. package/lib/types/__generated__/radio-group.props.d.ts +1 -1
  70. package/lib/types/__generated__/select.props.d.ts +1 -1
  71. package/lib/types/__generated__/sheet.props.d.ts +1 -1
  72. package/lib/types/__generated__/switch.props.d.ts +1 -1
  73. package/lib/types/__generated__/tabs.props.d.ts +1 -1
  74. package/lib/types/__generated__/tooltip.props.d.ts +1 -1
  75. package/lib/types/accordion.d.ts +1 -1
  76. package/lib/types/sheet.d.ts +1 -1
  77. package/lib/types/theme/__generated__/tailwind-theme.d.ts +26 -0
  78. package/lib/types/theme/styles.d.ts +60 -60
  79. package/lib/types/theme/tailwind-classes.d.ts +33 -33
  80. package/package.json +20 -23
  81. package/lib/__generated__/button.props.js +0 -565
  82. package/lib/__generated__/input.props.js +0 -668
  83. package/lib/__generated__/textarea.props.js +0 -577
  84. package/lib/cjs/__generated__/accordion.props.js +0 -2645
  85. package/lib/cjs/__generated__/button.props.js +0 -585
  86. package/lib/cjs/__generated__/checkbox.props.js +0 -1103
  87. package/lib/cjs/__generated__/collapsible.props.js +0 -1050
  88. package/lib/cjs/__generated__/dialog.props.js +0 -2623
  89. package/lib/cjs/__generated__/input.props.js +0 -688
  90. package/lib/cjs/__generated__/label.props.js +0 -541
  91. package/lib/cjs/__generated__/navigation-menu.props.js +0 -2585
  92. package/lib/cjs/__generated__/popover.props.js +0 -582
  93. package/lib/cjs/__generated__/radio-group.props.js +0 -1647
  94. package/lib/cjs/__generated__/select.props.js +0 -3698
  95. package/lib/cjs/__generated__/sheet.props.js +0 -2642
  96. package/lib/cjs/__generated__/switch.props.js +0 -1103
  97. package/lib/cjs/__generated__/tabs.props.js +0 -2144
  98. package/lib/cjs/__generated__/textarea.props.js +0 -597
  99. package/lib/cjs/__generated__/tooltip.props.js +0 -593
  100. package/lib/cjs/accordion.js +0 -67
  101. package/lib/cjs/accordion.ws.js +0 -285
  102. package/lib/cjs/checkbox.js +0 -31
  103. package/lib/cjs/checkbox.ws.js +0 -174
  104. package/lib/cjs/collapsible.js +0 -53
  105. package/lib/cjs/collapsible.ws.js +0 -122
  106. package/lib/cjs/components.js +0 -82
  107. package/lib/cjs/dialog.js +0 -89
  108. package/lib/cjs/dialog.ws.js +0 -315
  109. package/lib/cjs/hooks.js +0 -43
  110. package/lib/cjs/label.js +0 -37
  111. package/lib/cjs/label.ws.js +0 -75
  112. package/lib/cjs/metas.js +0 -84
  113. package/lib/cjs/navigation-menu.js +0 -107
  114. package/lib/cjs/navigation-menu.ws.js +0 -514
  115. package/lib/cjs/package.json +0 -1
  116. package/lib/cjs/popover.js +0 -90
  117. package/lib/cjs/popover.ws.js +0 -142
  118. package/lib/cjs/props-descriptions.js +0 -56
  119. package/lib/cjs/props.js +0 -82
  120. package/lib/cjs/radio-group.js +0 -30
  121. package/lib/cjs/radio-group.ws.js +0 -191
  122. package/lib/cjs/select.js +0 -83
  123. package/lib/cjs/select.ws.js +0 -350
  124. package/lib/cjs/sheet.js +0 -96
  125. package/lib/cjs/sheet.ws.js +0 -257
  126. package/lib/cjs/switch.js +0 -27
  127. package/lib/cjs/switch.ws.js +0 -173
  128. package/lib/cjs/tabs.js +0 -59
  129. package/lib/cjs/tabs.ws.js +0 -196
  130. package/lib/cjs/theme/radix-common-types.js +0 -16
  131. package/lib/cjs/theme/styles.js +0 -96
  132. package/lib/cjs/theme/tailwind-classes.js +0 -819
  133. package/lib/cjs/theme/tailwind-colors.js +0 -45
  134. package/lib/cjs/theme/tailwind-theme.js +0 -46
  135. package/lib/cjs/tooltip.js +0 -87
  136. package/lib/cjs/tooltip.ws.js +0 -143
  137. package/lib/theme/radix-common-types.js +0 -0
  138. package/lib/theme/tailwind-theme.js +0 -16
  139. package/lib/types/__generated__/button.props.d.ts +0 -2
  140. package/lib/types/__generated__/input.props.d.ts +0 -2
  141. package/lib/types/__generated__/textarea.props.d.ts +0 -2
  142. package/lib/types/theme/radix-common-types.d.ts +0 -85
  143. package/lib/types/theme/tailwind-theme.d.ts +0 -72
  144. package/src/__generated__/accordion.props.ts +0 -2949
  145. package/src/__generated__/button.props.ts +0 -635
  146. package/src/__generated__/checkbox.props.ts +0 -1217
  147. package/src/__generated__/collapsible.props.ts +0 -1156
  148. package/src/__generated__/dialog.props.ts +0 -2923
  149. package/src/__generated__/input.props.ts +0 -748
  150. package/src/__generated__/label.props.ts +0 -585
  151. package/src/__generated__/navigation-menu.props.ts +0 -2882
  152. package/src/__generated__/popover.props.ts +0 -626
  153. package/src/__generated__/radio-group.props.ts +0 -1828
  154. package/src/__generated__/select.props.ts +0 -4130
  155. package/src/__generated__/sheet.props.ts +0 -2942
  156. package/src/__generated__/switch.props.ts +0 -1217
  157. package/src/__generated__/tabs.props.ts +0 -2386
  158. package/src/__generated__/textarea.props.ts +0 -645
  159. package/src/__generated__/tooltip.props.ts +0 -639
  160. package/src/accordion.tsx +0 -88
  161. package/src/accordion.ws.ts +0 -296
  162. package/src/checkbox.stories.ts +0 -22
  163. package/src/checkbox.tsx +0 -22
  164. package/src/checkbox.ws.ts +0 -154
  165. package/src/collapsible.tsx +0 -62
  166. package/src/collapsible.ws.ts +0 -115
  167. package/src/components.ts +0 -50
  168. package/src/dialog.tsx +0 -92
  169. package/src/dialog.ws.tsx +0 -320
  170. package/src/hooks.ts +0 -22
  171. package/src/label.stories.ts +0 -22
  172. package/src/label.tsx +0 -15
  173. package/src/label.ws.ts +0 -50
  174. package/src/metas.ts +0 -74
  175. package/src/navigation-menu.tsx +0 -130
  176. package/src/navigation-menu.ws.ts +0 -524
  177. package/src/popover.tsx +0 -96
  178. package/src/popover.ws.tsx +0 -128
  179. package/src/props-descriptions.ts +0 -43
  180. package/src/props.ts +0 -73
  181. package/src/radio-group.stories.ts +0 -22
  182. package/src/radio-group.tsx +0 -17
  183. package/src/radio-group.ws.ts +0 -178
  184. package/src/select.tsx +0 -112
  185. package/src/select.ws.ts +0 -349
  186. package/src/sheet.tsx +0 -79
  187. package/src/sheet.ws.tsx +0 -236
  188. package/src/switch.stories.ts +0 -22
  189. package/src/switch.tsx +0 -10
  190. package/src/switch.ws.ts +0 -146
  191. package/src/tabs.tsx +0 -64
  192. package/src/tabs.ws.ts +0 -198
  193. package/src/theme/radix-common-types.ts +0 -496
  194. package/src/theme/styles.ts +0 -76
  195. package/src/theme/tailwind-classes.ts +0 -1026
  196. package/src/theme/tailwind-colors.ts +0 -39
  197. package/src/theme/tailwind-theme.ts +0 -24
  198. package/src/tooltip.tsx +0 -95
  199. package/src/tooltip.ws.tsx +0 -130
@@ -1,514 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var navigation_menu_ws_exports = {};
30
- __export(navigation_menu_ws_exports, {
31
- metaNavigationMenu: () => metaNavigationMenu,
32
- metaNavigationMenuContent: () => metaNavigationMenuContent,
33
- metaNavigationMenuItem: () => metaNavigationMenuItem,
34
- metaNavigationMenuLink: () => metaNavigationMenuLink,
35
- metaNavigationMenuList: () => metaNavigationMenuList,
36
- metaNavigationMenuTrigger: () => metaNavigationMenuTrigger,
37
- metaNavigationMenuViewport: () => metaNavigationMenuViewport,
38
- propsMetaNavigationMenu: () => propsMetaNavigationMenu,
39
- propsMetaNavigationMenuContent: () => propsMetaNavigationMenuContent,
40
- propsMetaNavigationMenuItem: () => propsMetaNavigationMenuItem,
41
- propsMetaNavigationMenuLink: () => propsMetaNavigationMenuLink,
42
- propsMetaNavigationMenuList: () => propsMetaNavigationMenuList,
43
- propsMetaNavigationMenuTrigger: () => propsMetaNavigationMenuTrigger,
44
- propsMetaNavigationMenuViewport: () => propsMetaNavigationMenuViewport
45
- });
46
- module.exports = __toCommonJS(navigation_menu_ws_exports);
47
- var import_svg = require("@webstudio-is/icons/svg");
48
- var import_css_normalize = require("@webstudio-is/react-sdk/css-normalize");
49
- var tc = __toESM(require("./theme/tailwind-classes"), 1);
50
- var import_styles = require("./theme/styles");
51
- var import_navigation_menu = require("./__generated__/navigation-menu.props");
52
- const presetStyle = {
53
- div: import_css_normalize.div
54
- };
55
- const components = [
56
- {
57
- title: "Sheet",
58
- href: "/docs/components/sheet",
59
- description: "Extends the Dialog component to display content that complements the main content of the screen."
60
- },
61
- {
62
- title: "Navigation Menu",
63
- href: "/docs/components/navigation-menu",
64
- description: "A collection of links for navigating websites."
65
- },
66
- {
67
- title: "Tabs",
68
- href: "/docs/components/tabs",
69
- description: "A set of layered sections of content\u2014known as tab panels\u2014that are displayed one at a time."
70
- },
71
- {
72
- title: "Accordion",
73
- href: "/docs/components/accordion",
74
- description: "A vertically stacked set of interactive headings that each reveal a section of content."
75
- },
76
- {
77
- title: "Dialog",
78
- href: "/docs/components/dialog",
79
- description: "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert."
80
- },
81
- {
82
- title: "Collapsible",
83
- href: "/docs/components/collapsible",
84
- description: "An interactive component which expands/collapses a panel."
85
- },
86
- {
87
- title: "Popover",
88
- href: "/docs/components/popover",
89
- description: "Displays rich content in a portal, triggered by a button."
90
- },
91
- {
92
- title: "Tooltip",
93
- href: "/docs/components/tooltip",
94
- description: "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it."
95
- },
96
- {
97
- title: "Button",
98
- href: "/docs/components/button",
99
- description: "Displays a button or a component that looks like a button."
100
- }
101
- ];
102
- const navItem = (props) => [
103
- {
104
- type: "instance",
105
- component: "NavigationMenuLink",
106
- children: [
107
- {
108
- type: "instance",
109
- component: "Link",
110
- // block select-none space-y-1 rounded-md p-3 leading-none
111
- // no-underline outline-none transition-colors
112
- // hover:bg-accent hover:text-accent-foreground
113
- // focus:bg-accent focus:text-accent-foreground
114
- styles: [
115
- tc.text("inherit"),
116
- tc.flex(),
117
- tc.flex("col"),
118
- tc.select("none"),
119
- tc.gap(1),
120
- tc.rounded("md"),
121
- tc.p(3),
122
- tc.leading("none"),
123
- tc.noUnderline(),
124
- tc.outline("none"),
125
- tc.hover([tc.bg("accent"), tc.text("accentForeground")].flat()),
126
- tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat())
127
- ].flat(),
128
- props: [
129
- {
130
- name: "href",
131
- type: "string",
132
- value: `https://ui.shadcn.com${props.href}`
133
- }
134
- ],
135
- children: [
136
- {
137
- type: "instance",
138
- component: "Text",
139
- // text-sm font-medium leading-none
140
- styles: [
141
- tc.text("sm"),
142
- tc.font("medium"),
143
- tc.leading("none")
144
- ].flat(),
145
- children: [
146
- {
147
- type: "text",
148
- value: props.title
149
- }
150
- ]
151
- },
152
- {
153
- type: "instance",
154
- component: "Paragraph",
155
- // line-clamp-2 text-sm leading-snug text-muted-foreground
156
- styles: [
157
- tc.m(0),
158
- tc.lineClamp(2),
159
- tc.text("sm"),
160
- tc.leading("snug"),
161
- tc.text("mutedForeground")
162
- ].flat(),
163
- children: [
164
- {
165
- type: "text",
166
- value: props.description
167
- }
168
- ]
169
- }
170
- ]
171
- }
172
- ]
173
- }
174
- ];
175
- const navItemsList = (props) => [
176
- {
177
- type: "instance",
178
- component: "Box",
179
- label: "Flex Column",
180
- styles: [tc.w(64), tc.flex(), tc.gap(4), tc.flex("col")].flat(),
181
- children: Array.from(
182
- Array(props.count),
183
- (_, index) => navItem(components[index + props.offset])
184
- ).flat()
185
- }
186
- ];
187
- const menuItemLink = (props) => [
188
- {
189
- type: "instance",
190
- component: "NavigationMenuItem",
191
- children: [
192
- {
193
- type: "instance",
194
- component: "NavigationMenuLink",
195
- children: [
196
- {
197
- type: "instance",
198
- component: "Link",
199
- styles: [
200
- (0, import_styles.getButtonStyles)("ghost", "sm"),
201
- tc.noUnderline(),
202
- tc.text("current")
203
- ].flat(),
204
- children: [{ type: "text", value: props.title }]
205
- }
206
- ]
207
- }
208
- ]
209
- }
210
- ];
211
- const menuItem = (props) => [
212
- {
213
- type: "instance",
214
- component: "NavigationMenuItem",
215
- children: [
216
- {
217
- type: "instance",
218
- component: "NavigationMenuTrigger",
219
- children: [
220
- {
221
- type: "instance",
222
- component: "Button",
223
- styles: [
224
- (0, import_styles.getButtonStyles)("ghost", "sm"),
225
- tc.property("--navigation-menu-trigger-icon-transform", "0deg"),
226
- tc.state(
227
- [
228
- tc.property(
229
- "--navigation-menu-trigger-icon-transform",
230
- "180deg"
231
- )
232
- ],
233
- "[data-state=open]"
234
- )
235
- ].flat(),
236
- children: [
237
- {
238
- type: "instance",
239
- component: "Text",
240
- children: [{ type: "text", value: props.title }]
241
- },
242
- {
243
- type: "instance",
244
- component: "Box",
245
- label: "Icon Container",
246
- // h-4 w-4 shrink-0 transition-transform duration-200
247
- styles: [
248
- tc.ml(1),
249
- tc.property(
250
- "rotate",
251
- "--navigation-menu-trigger-icon-transform"
252
- ),
253
- tc.h(4),
254
- tc.w(4),
255
- tc.shrink(0),
256
- tc.transition("all"),
257
- tc.duration(200)
258
- ].flat(),
259
- children: [
260
- {
261
- type: "instance",
262
- component: "HtmlEmbed",
263
- label: "Chevron Icon",
264
- props: [
265
- {
266
- type: "string",
267
- name: "code",
268
- value: import_svg.ChevronDownIcon
269
- }
270
- ],
271
- children: []
272
- }
273
- ]
274
- }
275
- ]
276
- }
277
- ]
278
- },
279
- {
280
- type: "instance",
281
- component: "NavigationMenuContent",
282
- // left-0 top-0 absolute w-max
283
- styles: [
284
- tc.left(0),
285
- tc.top(0),
286
- tc.absolute(),
287
- tc.w("max"),
288
- tc.p(4)
289
- ].flat(),
290
- children: [
291
- {
292
- type: "instance",
293
- component: "Box",
294
- label: "Content",
295
- styles: [tc.flex(), tc.gap(4), tc.p(props.padding)].flat(),
296
- children: props.children
297
- }
298
- ]
299
- }
300
- ]
301
- }
302
- ];
303
- const metaNavigationMenu = {
304
- category: "radix",
305
- order: 2,
306
- type: "container",
307
- description: "A collection of links for navigating websites.",
308
- icon: import_svg.NavigationMenuIcon,
309
- presetStyle,
310
- template: [
311
- {
312
- type: "instance",
313
- component: "NavigationMenu",
314
- dataSources: {
315
- menuValue: { type: "variable", initialValue: "" }
316
- },
317
- props: [
318
- { type: "dataSource", name: "value", dataSourceName: "menuValue" },
319
- {
320
- name: "onValueChange",
321
- type: "action",
322
- value: [
323
- {
324
- type: "execute",
325
- args: ["value"],
326
- code: `menuValue = value`
327
- }
328
- ]
329
- }
330
- ],
331
- // relative
332
- // Omiting this: z-10 flex max-w-max flex-1 items-center justify-center
333
- styles: [tc.relative(), tc.maxW("max")].flat(),
334
- children: [
335
- {
336
- type: "instance",
337
- component: "NavigationMenuList",
338
- styles: [
339
- // ul defaults in tailwind
340
- tc.p(0),
341
- tc.m(0),
342
- // shadcdn styles
343
- tc.flex(),
344
- tc.flex(1),
345
- tc.list("none"),
346
- tc.items("center"),
347
- tc.justify("center"),
348
- tc.gap(1)
349
- ].flat(),
350
- children: [
351
- ...menuItem({
352
- title: "About",
353
- padding: 2,
354
- children: [
355
- {
356
- type: "instance",
357
- component: "Box",
358
- styles: [
359
- tc.bg("border"),
360
- tc.p(4),
361
- tc.w(48),
362
- tc.rounded("md")
363
- ].flat(),
364
- children: [
365
- {
366
- type: "text",
367
- value: ""
368
- }
369
- ]
370
- },
371
- ...navItemsList({ count: 3, offset: 0 })
372
- ]
373
- }),
374
- ...menuItem({
375
- title: "Components",
376
- padding: 0,
377
- children: [
378
- ...navItemsList({ count: 3, offset: 3 }),
379
- ...navItemsList({ count: 3, offset: 6 })
380
- ]
381
- }),
382
- ...menuItemLink({ title: "Standalone" })
383
- ]
384
- },
385
- {
386
- type: "instance",
387
- component: "Box",
388
- label: "Viewport Container",
389
- // absolute left-0 top-full flex justify-center
390
- styles: [
391
- tc.absolute(),
392
- tc.left(0),
393
- tc.top("full"),
394
- tc.flex(),
395
- tc.justify("center")
396
- ].flat(),
397
- children: [
398
- {
399
- type: "instance",
400
- component: "NavigationMenuViewport",
401
- /*
402
- origin-top-center relative mt-1.5 w-full
403
- overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg
404
- h-[var(--radix-navigation-menu-viewport-height)]
405
- w-[var(--radix-navigation-menu-viewport-width)]
406
- // anims
407
- [animation-duration:150ms!important] [transition-duration:150ms!important]
408
- data-[state=open]:animate-in data-[state=closed]:animate-out
409
- data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90
410
- */
411
- styles: [
412
- tc.relative(),
413
- tc.mt(1.5),
414
- tc.overflow("hidden"),
415
- tc.rounded("md"),
416
- tc.border(),
417
- tc.bg("popover"),
418
- tc.text("popoverForeground"),
419
- tc.shadow("lg"),
420
- tc.property(
421
- "height",
422
- "--radix-navigation-menu-viewport-height"
423
- ),
424
- tc.property("width", "--radix-navigation-menu-viewport-width")
425
- ].flat(),
426
- children: []
427
- }
428
- ]
429
- }
430
- ]
431
- }
432
- ]
433
- };
434
- const metaNavigationMenuList = {
435
- category: "hidden",
436
- detachable: false,
437
- type: "container",
438
- icon: import_svg.ListIcon,
439
- requiredAncestors: ["NavigationMenu"],
440
- presetStyle,
441
- label: "Menu List"
442
- };
443
- const metaNavigationMenuItem = {
444
- category: "hidden",
445
- type: "container",
446
- icon: import_svg.ListItemIcon,
447
- requiredAncestors: ["NavigationMenu"],
448
- presetStyle,
449
- indexWithinAncestor: "NavigationMenu",
450
- label: "Menu Item"
451
- };
452
- const metaNavigationMenuTrigger = {
453
- category: "hidden",
454
- detachable: false,
455
- stylable: false,
456
- type: "container",
457
- icon: import_svg.TriggerIcon,
458
- requiredAncestors: ["NavigationMenuItem"],
459
- presetStyle,
460
- label: "Menu Trigger"
461
- };
462
- const metaNavigationMenuContent = {
463
- category: "hidden",
464
- detachable: false,
465
- type: "container",
466
- icon: import_svg.ContentIcon,
467
- requiredAncestors: ["NavigationMenuItem"],
468
- indexWithinAncestor: "NavigationMenu",
469
- presetStyle,
470
- label: "Menu Content"
471
- };
472
- const metaNavigationMenuLink = {
473
- category: "hidden",
474
- detachable: true,
475
- type: "container",
476
- stylable: false,
477
- icon: import_svg.BoxIcon,
478
- // https://github.com/webstudio-is/webstudio-builder/issues/2193
479
- // requiredAncestors: ["NavigationMenuContent", "NavigationMenuItem"],
480
- // Temporary restrict to NavigationMenu
481
- requiredAncestors: ["NavigationMenu"],
482
- presetStyle,
483
- label: "Accessible Link Wrapper"
484
- };
485
- const metaNavigationMenuViewport = {
486
- category: "hidden",
487
- detachable: true,
488
- type: "container",
489
- icon: import_svg.ViewportIcon,
490
- requiredAncestors: ["NavigationMenu"],
491
- presetStyle,
492
- label: "Menu Viewport"
493
- };
494
- const propsMetaNavigationMenu = {
495
- props: import_navigation_menu.propsNavigationMenu
496
- };
497
- const propsMetaNavigationMenuItem = {
498
- props: import_navigation_menu.propsNavigationMenuItem
499
- };
500
- const propsMetaNavigationMenuTrigger = {
501
- props: import_navigation_menu.propsNavigationMenuTrigger
502
- };
503
- const propsMetaNavigationMenuContent = {
504
- props: import_navigation_menu.propsNavigationMenuContent
505
- };
506
- const propsMetaNavigationMenuLink = {
507
- props: import_navigation_menu.propsNavigationMenuLink
508
- };
509
- const propsMetaNavigationMenuList = {
510
- props: import_navigation_menu.propsNavigationMenuList
511
- };
512
- const propsMetaNavigationMenuViewport = {
513
- props: import_navigation_menu.propsNavigationMenuViewport
514
- };
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,90 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var popover_exports = {};
30
- __export(popover_exports, {
31
- Popover: () => Popover,
32
- PopoverContent: () => PopoverContent,
33
- PopoverTrigger: () => PopoverTrigger,
34
- hooksPopover: () => hooksPopover
35
- });
36
- module.exports = __toCommonJS(popover_exports);
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
- var import_react = require("react");
39
- var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
40
- var import_react_sdk = require("@webstudio-is/react-sdk");
41
- const Popover = (0, import_react.forwardRef)((props, _ref) => {
42
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverPrimitive.Root, { ...props });
43
- });
44
- const PopoverTrigger = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
45
- const firstChild = import_react.Children.toArray(children)[0];
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "Add button or link" }) });
47
- });
48
- const PopoverContent = (0, import_react.forwardRef)(
49
- ({ sideOffset = 4, align = "center", hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
- PopoverPrimitive.Content,
51
- {
52
- ref,
53
- align: "center",
54
- sideOffset,
55
- hideWhenDetached,
56
- ...props
57
- }
58
- ) })
59
- );
60
- const namespace = "@webstudio-is/sdk-components-react-radix";
61
- const hooksPopover = {
62
- onNavigatorUnselect: (context, event) => {
63
- for (const instance of event.instancePath) {
64
- if (instance.component === `${namespace}:PopoverContent`) {
65
- const popover = (0, import_react_sdk.getClosestInstance)(
66
- event.instancePath,
67
- instance,
68
- `${namespace}:Popover`
69
- );
70
- if (popover) {
71
- context.setPropVariable(popover.id, "open", false);
72
- }
73
- }
74
- }
75
- },
76
- onNavigatorSelect: (context, event) => {
77
- for (const instance of event.instancePath) {
78
- if (instance.component === `${namespace}:PopoverContent`) {
79
- const popover = (0, import_react_sdk.getClosestInstance)(
80
- event.instancePath,
81
- instance,
82
- `${namespace}:Popover`
83
- );
84
- if (popover) {
85
- context.setPropVariable(popover.id, "open", true);
86
- }
87
- }
88
- }
89
- }
90
- };