@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
package/lib/cjs/metas.js CHANGED
@@ -23,7 +23,8 @@ __export(metas_exports, {
23
23
  AccordionHeader: () => import_accordion.metaAccordionHeader,
24
24
  AccordionItem: () => import_accordion.metaAccordionItem,
25
25
  AccordionTrigger: () => import_accordion.metaAccordionTrigger,
26
- Button: () => import_button.meta,
26
+ Checkbox: () => import_checkbox.metaCheckbox,
27
+ CheckboxIndicator: () => import_checkbox.metaCheckboxIndicator,
27
28
  Collapsible: () => import_collapsible.metaCollapsible,
28
29
  CollapsibleContent: () => import_collapsible.metaCollapsibleContent,
29
30
  CollapsibleTrigger: () => import_collapsible.metaCollapsibleTrigger,
@@ -34,23 +35,35 @@ __export(metas_exports, {
34
35
  DialogOverlay: () => import_dialog.metaDialogOverlay,
35
36
  DialogTitle: () => import_dialog.metaDialogTitle,
36
37
  DialogTrigger: () => import_dialog.metaDialogTrigger,
37
- Input: () => import_input.meta,
38
38
  Label: () => import_label.meta,
39
+ NavigationMenu: () => import_navigation_menu.metaNavigationMenu,
40
+ NavigationMenuContent: () => import_navigation_menu.metaNavigationMenuContent,
41
+ NavigationMenuItem: () => import_navigation_menu.metaNavigationMenuItem,
42
+ NavigationMenuLink: () => import_navigation_menu.metaNavigationMenuLink,
43
+ NavigationMenuList: () => import_navigation_menu.metaNavigationMenuList,
44
+ NavigationMenuTrigger: () => import_navigation_menu.metaNavigationMenuTrigger,
45
+ NavigationMenuViewport: () => import_navigation_menu.metaNavigationMenuViewport,
39
46
  Popover: () => import_popover.metaPopover,
40
47
  PopoverContent: () => import_popover.metaPopoverContent,
41
48
  PopoverTrigger: () => import_popover.metaPopoverTrigger,
42
- Sheet: () => import_sheet.metaSheet,
43
- SheetClose: () => import_sheet.metaSheetClose,
44
- SheetContent: () => import_sheet.metaSheetContent,
45
- SheetDescription: () => import_sheet.metaSheetDescription,
46
- SheetOverlay: () => import_sheet.metaSheetOverlay,
47
- SheetTitle: () => import_sheet.metaSheetTitle,
48
- SheetTrigger: () => import_sheet.metaSheetTrigger,
49
+ RadioGroup: () => import_radio_group.metaRadioGroup,
50
+ RadioGroupIndicator: () => import_radio_group.metaRadioGroupIndicator,
51
+ RadioGroupItem: () => import_radio_group.metaRadioGroupItem,
52
+ Select: () => import_select.metaSelect,
53
+ SelectContent: () => import_select.metaSelectContent,
54
+ SelectItem: () => import_select.metaSelectItem,
55
+ SelectItemIndicator: () => import_select.metaSelectItemIndicator,
56
+ SelectItemText: () => import_select.metaSelectItemText,
57
+ SelectTrigger: () => import_select.metaSelectTrigger,
58
+ SelectValue: () => import_select.metaSelectValue,
59
+ SelectViewport: () => import_select.metaSelectViewport,
60
+ Sheet: () => import_sheet.meta,
61
+ Switch: () => import_switch.metaSwitch,
62
+ SwitchThumb: () => import_switch.metaSwitchThumb,
49
63
  Tabs: () => import_tabs.metaTabs,
50
64
  TabsContent: () => import_tabs.metaTabsContent,
51
65
  TabsList: () => import_tabs.metaTabsList,
52
66
  TabsTrigger: () => import_tabs.metaTabsTrigger,
53
- Textarea: () => import_textarea.meta,
54
67
  Tooltip: () => import_tooltip.metaTooltip,
55
68
  TooltipContent: () => import_tooltip.metaTooltipContent,
56
69
  TooltipTrigger: () => import_tooltip.metaTooltipTrigger
@@ -58,12 +71,14 @@ __export(metas_exports, {
58
71
  module.exports = __toCommonJS(metas_exports);
59
72
  var import_collapsible = require("./collapsible.ws");
60
73
  var import_dialog = require("./dialog.ws");
74
+ var import_sheet = require("./sheet.ws");
61
75
  var import_popover = require("./popover.ws");
62
76
  var import_tooltip = require("./tooltip.ws");
63
- var import_sheet = require("./sheet.ws");
64
77
  var import_tabs = require("./tabs.ws");
65
- var import_button = require("./button.ws");
66
- var import_input = require("./input.ws");
67
- var import_textarea = require("./textarea.ws");
68
78
  var import_label = require("./label.ws");
69
79
  var import_accordion = require("./accordion.ws");
80
+ var import_navigation_menu = require("./navigation-menu.ws");
81
+ var import_select = require("./select.ws");
82
+ var import_switch = require("./switch.ws");
83
+ var import_checkbox = require("./checkbox.ws");
84
+ var import_radio_group = require("./radio-group.ws");
@@ -0,0 +1,107 @@
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_exports = {};
30
+ __export(navigation_menu_exports, {
31
+ NavigationMenu: () => NavigationMenu,
32
+ NavigationMenuContent: () => NavigationMenuContent,
33
+ NavigationMenuItem: () => NavigationMenuItem,
34
+ NavigationMenuLink: () => NavigationMenuLink,
35
+ NavigationMenuList: () => NavigationMenuList,
36
+ NavigationMenuTrigger: () => NavigationMenuTrigger,
37
+ NavigationMenuViewport: () => NavigationMenuViewport,
38
+ hooksNavigationMenu: () => hooksNavigationMenu
39
+ });
40
+ module.exports = __toCommonJS(navigation_menu_exports);
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var NavigationMenuPrimitive = __toESM(require("@radix-ui/react-navigation-menu"), 1);
43
+ var import_react_sdk = require("@webstudio-is/react-sdk");
44
+ var import_react = require("react");
45
+ const NavigationMenu = (0, import_react.forwardRef)(({ value: propsValue, ...props }, ref) => {
46
+ const { renderer } = (0, import_react.useContext)(import_react_sdk.ReactSdkContext);
47
+ let value = propsValue;
48
+ if (renderer === "canvas") {
49
+ value = value === "" ? "-1" : value;
50
+ }
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationMenuPrimitive.Root, { ref, value, ...props });
52
+ });
53
+ const NavigationMenuList = NavigationMenuPrimitive.List;
54
+ const NavigationMenuViewport = NavigationMenuPrimitive.Viewport;
55
+ const NavigationMenuContent = NavigationMenuPrimitive.Content;
56
+ const NavigationMenuItem = (0, import_react.forwardRef)(({ value, ...props }, ref) => {
57
+ const index = (0, import_react_sdk.getIndexWithinAncestorFromComponentProps)(props);
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationMenuPrimitive.Item, { ref, value: value ?? index, ...props });
59
+ });
60
+ const NavigationMenuLink = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
61
+ const firstChild = import_react.Children.toArray(children)[0];
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationMenuPrimitive.Link, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { children: "Add link component" }) });
63
+ });
64
+ const NavigationMenuTrigger = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
65
+ const firstChild = import_react.Children.toArray(children)[0];
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationMenuPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "Add button or link" }) });
67
+ });
68
+ const namespace = "@webstudio-is/sdk-components-react-radix";
69
+ const hooksNavigationMenu = {
70
+ onNavigatorUnselect: (context, event) => {
71
+ for (const instance of event.instancePath) {
72
+ if (instance.component === `${namespace}:NavigationMenuContent`) {
73
+ const menu = (0, import_react_sdk.getClosestInstance)(
74
+ event.instancePath,
75
+ instance,
76
+ `${namespace}:NavigationMenu`
77
+ );
78
+ if (menu) {
79
+ context.setPropVariable(menu.id, "value", "");
80
+ }
81
+ }
82
+ }
83
+ },
84
+ onNavigatorSelect: (context, event) => {
85
+ for (const instance of event.instancePath) {
86
+ if (instance.component === `${namespace}:NavigationMenuContent`) {
87
+ const menu = (0, import_react_sdk.getClosestInstance)(
88
+ event.instancePath,
89
+ instance,
90
+ `${namespace}:NavigationMenu`
91
+ );
92
+ const menuItem = (0, import_react_sdk.getClosestInstance)(
93
+ event.instancePath,
94
+ instance,
95
+ `${namespace}:NavigationMenuItem`
96
+ );
97
+ if (menuItem === void 0 || menu === void 0) {
98
+ return;
99
+ }
100
+ const contentValue = context.getPropValue(menuItem.id, "value") ?? context.indexesWithinAncestors.get(menuItem.id)?.toString();
101
+ if (contentValue) {
102
+ context.setPropVariable(menu.id, "value", contentValue);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ };
@@ -0,0 +1,514 @@
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
+ };