@webstudio-is/sdk-components-react-radix 0.87.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/lib/__generated__/accordion.props.js +0 -5
  2. package/lib/__generated__/button.props.js +0 -21
  3. package/lib/__generated__/checkbox.props.js +850 -0
  4. package/lib/__generated__/collapsible.props.js +0 -2
  5. package/lib/__generated__/dialog.props.js +0 -11
  6. package/lib/__generated__/label.props.js +0 -1
  7. package/lib/__generated__/navigation-menu.props.js +2104 -0
  8. package/lib/__generated__/popover.props.js +0 -3
  9. package/lib/__generated__/radio-group.props.js +1282 -0
  10. package/lib/__generated__/select.props.js +2962 -0
  11. package/lib/__generated__/sheet.props.js +0 -11
  12. package/lib/__generated__/switch.props.js +850 -0
  13. package/lib/__generated__/tabs.props.js +428 -5
  14. package/lib/__generated__/tooltip.props.js +0 -2
  15. package/lib/accordion.js +11 -4
  16. package/lib/accordion.ws.js +87 -72
  17. package/lib/checkbox.js +13 -0
  18. package/lib/checkbox.ws.js +151 -0
  19. package/lib/cjs/__generated__/accordion.props.js +0 -5
  20. package/lib/cjs/__generated__/button.props.js +0 -21
  21. package/lib/cjs/__generated__/checkbox.props.js +870 -0
  22. package/lib/cjs/__generated__/collapsible.props.js +0 -2
  23. package/lib/cjs/__generated__/dialog.props.js +0 -11
  24. package/lib/cjs/__generated__/label.props.js +0 -1
  25. package/lib/cjs/__generated__/navigation-menu.props.js +2124 -0
  26. package/lib/cjs/__generated__/popover.props.js +0 -3
  27. package/lib/cjs/__generated__/radio-group.props.js +1302 -0
  28. package/lib/cjs/__generated__/select.props.js +2982 -0
  29. package/lib/cjs/__generated__/sheet.props.js +0 -11
  30. package/lib/cjs/__generated__/switch.props.js +870 -0
  31. package/lib/cjs/__generated__/tabs.props.js +428 -5
  32. package/lib/cjs/__generated__/tooltip.props.js +0 -2
  33. package/lib/cjs/accordion.js +11 -4
  34. package/lib/cjs/accordion.ws.js +85 -71
  35. package/lib/cjs/{textarea.js → checkbox.js} +9 -6
  36. package/lib/cjs/checkbox.ws.js +172 -0
  37. package/lib/cjs/collapsible.ws.js +4 -1
  38. package/lib/cjs/components.js +27 -14
  39. package/lib/cjs/dialog.ws.js +17 -17
  40. package/lib/cjs/hooks.js +5 -1
  41. package/lib/cjs/label.ws.js +1 -1
  42. package/lib/cjs/metas.js +29 -14
  43. package/lib/cjs/navigation-menu.js +107 -0
  44. package/lib/cjs/navigation-menu.ws.js +513 -0
  45. package/lib/cjs/popover.ws.js +12 -9
  46. package/lib/cjs/props.js +27 -14
  47. package/lib/cjs/{button.js → radio-group.js} +10 -8
  48. package/lib/cjs/radio-group.ws.js +188 -0
  49. package/lib/cjs/select.js +81 -0
  50. package/lib/cjs/select.ws.js +349 -0
  51. package/lib/cjs/sheet.ws.js +87 -176
  52. package/lib/cjs/{input.js → switch.js} +8 -9
  53. package/lib/cjs/switch.ws.js +171 -0
  54. package/lib/cjs/tabs.js +2 -3
  55. package/lib/cjs/tabs.ws.js +13 -18
  56. package/lib/cjs/theme/styles.js +100 -0
  57. package/lib/cjs/theme/tailwind-classes.js +125 -16
  58. package/lib/cjs/theme/tailwind-colors.js +1 -0
  59. package/lib/cjs/tooltip.ws.js +11 -8
  60. package/lib/collapsible.ws.js +4 -1
  61. package/lib/components.js +44 -22
  62. package/lib/dialog.ws.js +17 -17
  63. package/lib/hooks.js +5 -1
  64. package/lib/label.ws.js +1 -1
  65. package/lib/metas.js +58 -24
  66. package/lib/navigation-menu.js +85 -0
  67. package/lib/navigation-menu.ws.js +500 -0
  68. package/lib/popover.ws.js +12 -9
  69. package/lib/props.js +56 -24
  70. package/lib/radio-group.js +11 -0
  71. package/lib/radio-group.ws.js +170 -0
  72. package/lib/select.js +73 -0
  73. package/lib/select.ws.js +337 -0
  74. package/lib/sheet.ws.js +88 -194
  75. package/lib/switch.js +7 -0
  76. package/lib/switch.ws.js +143 -0
  77. package/lib/tabs.js +3 -5
  78. package/lib/tabs.ws.js +14 -19
  79. package/lib/theme/styles.js +70 -0
  80. package/lib/theme/tailwind-classes.js +125 -16
  81. package/lib/theme/tailwind-colors.js +1 -0
  82. package/lib/tooltip.ws.js +11 -8
  83. package/lib/types/__generated__/checkbox.props.d.ts +3 -0
  84. package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
  85. package/lib/types/__generated__/radio-group.props.d.ts +4 -0
  86. package/lib/types/__generated__/select.props.d.ts +9 -0
  87. package/lib/types/__generated__/switch.props.d.ts +3 -0
  88. package/lib/types/checkbox.d.ts +6 -0
  89. package/lib/types/checkbox.stories.d.ts +11 -0
  90. package/lib/types/checkbox.ws.d.ts +5 -0
  91. package/lib/types/components.d.ts +5 -4
  92. package/lib/types/metas.d.ts +6 -4
  93. package/lib/types/navigation-menu.d.ts +15 -0
  94. package/lib/types/navigation-menu.ws.d.ts +15 -0
  95. package/lib/types/props.d.ts +5 -4
  96. package/lib/types/radio-group.d.ts +5 -0
  97. package/lib/types/radio-group.stories.d.ts +9 -0
  98. package/lib/types/radio-group.ws.d.ts +7 -0
  99. package/lib/types/select.d.ts +12 -0
  100. package/lib/types/select.ws.d.ts +17 -0
  101. package/lib/types/sheet.ws.d.ts +2 -15
  102. package/lib/types/switch.d.ts +4 -0
  103. package/lib/types/switch.stories.d.ts +9 -0
  104. package/lib/types/switch.ws.d.ts +5 -0
  105. package/lib/types/tabs.d.ts +3 -12
  106. package/lib/types/theme/radix-common-types.d.ts +3 -2
  107. package/lib/types/theme/styles.d.ts +215 -0
  108. package/lib/types/theme/tailwind-classes.d.ts +16 -6
  109. package/lib/types/theme/tailwind-colors.d.ts +1 -0
  110. package/lib/types/theme/tailwind-theme.d.ts +1 -1
  111. package/package.json +12 -7
  112. package/src/__generated__/accordion.props.ts +0 -5
  113. package/src/__generated__/button.props.ts +0 -21
  114. package/src/__generated__/checkbox.props.ts +948 -0
  115. package/src/__generated__/collapsible.props.ts +0 -2
  116. package/src/__generated__/dialog.props.ts +0 -11
  117. package/src/__generated__/label.props.ts +0 -1
  118. package/src/__generated__/navigation-menu.props.ts +2349 -0
  119. package/src/__generated__/popover.props.ts +0 -3
  120. package/src/__generated__/radio-group.props.ts +1429 -0
  121. package/src/__generated__/select.props.ts +3304 -0
  122. package/src/__generated__/sheet.props.ts +0 -11
  123. package/src/__generated__/switch.props.ts +948 -0
  124. package/src/__generated__/tabs.props.ts +477 -4
  125. package/src/__generated__/tooltip.props.ts +0 -2
  126. package/src/accordion.tsx +14 -7
  127. package/src/accordion.ws.ts +85 -70
  128. package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
  129. package/src/checkbox.tsx +22 -0
  130. package/src/checkbox.ws.ts +151 -0
  131. package/src/collapsible.ws.ts +4 -1
  132. package/src/components.ts +25 -12
  133. package/src/dialog.ws.tsx +15 -16
  134. package/src/hooks.ts +4 -0
  135. package/src/label.ws.ts +1 -1
  136. package/src/metas.ts +36 -12
  137. package/src/navigation-menu.stories.tsx +21 -0
  138. package/src/navigation-menu.tsx +130 -0
  139. package/src/navigation-menu.ws.ts +523 -0
  140. package/src/popover.ws.tsx +12 -9
  141. package/src/props.ts +35 -12
  142. package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
  143. package/src/radio-group.tsx +17 -0
  144. package/src/radio-group.ws.ts +174 -0
  145. package/src/select.stories.tsx +21 -0
  146. package/src/select.tsx +107 -0
  147. package/src/select.ws.ts +347 -0
  148. package/src/sheet.ws.tsx +89 -209
  149. package/src/{button.stories.ts → switch.stories.ts} +6 -19
  150. package/src/switch.tsx +10 -0
  151. package/src/switch.ws.ts +143 -0
  152. package/src/tabs.tsx +4 -17
  153. package/src/tabs.ws.ts +17 -19
  154. package/src/theme/radix-common-types.ts +3 -2
  155. package/src/theme/styles.ts +80 -0
  156. package/src/theme/tailwind-classes.ts +150 -14
  157. package/src/theme/tailwind-colors.ts +1 -0
  158. package/src/tooltip.ws.tsx +11 -8
  159. package/lib/button.js +0 -8
  160. package/lib/button.ws.js +0 -133
  161. package/lib/cjs/button.ws.js +0 -160
  162. package/lib/cjs/input.ws.js +0 -103
  163. package/lib/cjs/textarea.ws.js +0 -98
  164. package/lib/input.js +0 -8
  165. package/lib/input.ws.js +0 -75
  166. package/lib/textarea.js +0 -8
  167. package/lib/textarea.ws.js +0 -70
  168. package/lib/types/button.d.ts +0 -7
  169. package/lib/types/button.stories.d.ts +0 -20
  170. package/lib/types/button.ws.d.ts +0 -7
  171. package/lib/types/input.d.ts +0 -2
  172. package/lib/types/input.stories.d.ts +0 -20
  173. package/lib/types/input.ws.d.ts +0 -3
  174. package/lib/types/textarea.d.ts +0 -2
  175. package/lib/types/textarea.stories.d.ts +0 -14
  176. package/lib/types/textarea.ws.d.ts +0 -3
  177. package/src/button.tsx +0 -25
  178. package/src/button.ws.ts +0 -155
  179. package/src/input.tsx +0 -12
  180. package/src/input.ws.ts +0 -78
  181. package/src/textarea.tsx +0 -12
  182. package/src/textarea.ws.ts +0 -74
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,513 @@
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
+ icon: import_svg.NavigationMenuIcon,
308
+ presetStyle,
309
+ template: [
310
+ {
311
+ type: "instance",
312
+ component: "NavigationMenu",
313
+ dataSources: {
314
+ menuValue: { type: "variable", initialValue: "" }
315
+ },
316
+ props: [
317
+ { type: "dataSource", name: "value", dataSourceName: "menuValue" },
318
+ {
319
+ name: "onValueChange",
320
+ type: "action",
321
+ value: [
322
+ {
323
+ type: "execute",
324
+ args: ["value"],
325
+ code: `menuValue = value`
326
+ }
327
+ ]
328
+ }
329
+ ],
330
+ // relative
331
+ // Omiting this: z-10 flex max-w-max flex-1 items-center justify-center
332
+ styles: [tc.relative(), tc.maxW("max")].flat(),
333
+ children: [
334
+ {
335
+ type: "instance",
336
+ component: "NavigationMenuList",
337
+ styles: [
338
+ // ul defaults in tailwind
339
+ tc.p(0),
340
+ tc.m(0),
341
+ // shadcdn styles
342
+ tc.flex(),
343
+ tc.flex(1),
344
+ tc.list("none"),
345
+ tc.items("center"),
346
+ tc.justify("center"),
347
+ tc.gap(1)
348
+ ].flat(),
349
+ children: [
350
+ ...menuItem({
351
+ title: "About",
352
+ padding: 2,
353
+ children: [
354
+ {
355
+ type: "instance",
356
+ component: "Box",
357
+ styles: [
358
+ tc.bg("border"),
359
+ tc.p(4),
360
+ tc.w(48),
361
+ tc.rounded("md")
362
+ ].flat(),
363
+ children: [
364
+ {
365
+ type: "text",
366
+ value: ""
367
+ }
368
+ ]
369
+ },
370
+ ...navItemsList({ count: 3, offset: 0 })
371
+ ]
372
+ }),
373
+ ...menuItem({
374
+ title: "Components",
375
+ padding: 0,
376
+ children: [
377
+ ...navItemsList({ count: 3, offset: 3 }),
378
+ ...navItemsList({ count: 3, offset: 6 })
379
+ ]
380
+ }),
381
+ ...menuItemLink({ title: "Standalone" })
382
+ ]
383
+ },
384
+ {
385
+ type: "instance",
386
+ component: "Box",
387
+ label: "Viewport Container",
388
+ // absolute left-0 top-full flex justify-center
389
+ styles: [
390
+ tc.absolute(),
391
+ tc.left(0),
392
+ tc.top("full"),
393
+ tc.flex(),
394
+ tc.justify("center")
395
+ ].flat(),
396
+ children: [
397
+ {
398
+ type: "instance",
399
+ component: "NavigationMenuViewport",
400
+ /*
401
+ origin-top-center relative mt-1.5 w-full
402
+ overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg
403
+ h-[var(--radix-navigation-menu-viewport-height)]
404
+ w-[var(--radix-navigation-menu-viewport-width)]
405
+ // anims
406
+ [animation-duration:150ms!important] [transition-duration:150ms!important]
407
+ data-[state=open]:animate-in data-[state=closed]:animate-out
408
+ data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90
409
+ */
410
+ styles: [
411
+ tc.relative(),
412
+ tc.mt(1.5),
413
+ tc.overflow("hidden"),
414
+ tc.rounded("md"),
415
+ tc.border(),
416
+ tc.bg("popover"),
417
+ tc.text("popoverForeground"),
418
+ tc.shadow("lg"),
419
+ tc.property(
420
+ "height",
421
+ "--radix-navigation-menu-viewport-height"
422
+ ),
423
+ tc.property("width", "--radix-navigation-menu-viewport-width")
424
+ ].flat(),
425
+ children: []
426
+ }
427
+ ]
428
+ }
429
+ ]
430
+ }
431
+ ]
432
+ };
433
+ const metaNavigationMenuList = {
434
+ category: "hidden",
435
+ detachable: false,
436
+ type: "container",
437
+ icon: import_svg.ListIcon,
438
+ requiredAncestors: ["NavigationMenu"],
439
+ presetStyle,
440
+ label: "Menu List"
441
+ };
442
+ const metaNavigationMenuItem = {
443
+ category: "hidden",
444
+ type: "container",
445
+ icon: import_svg.ListItemIcon,
446
+ requiredAncestors: ["NavigationMenu"],
447
+ presetStyle,
448
+ indexWithinAncestor: "NavigationMenu",
449
+ label: "Menu Item"
450
+ };
451
+ const metaNavigationMenuTrigger = {
452
+ category: "hidden",
453
+ detachable: false,
454
+ stylable: false,
455
+ type: "container",
456
+ icon: import_svg.TriggerIcon,
457
+ requiredAncestors: ["NavigationMenuItem"],
458
+ presetStyle,
459
+ label: "Menu Trigger"
460
+ };
461
+ const metaNavigationMenuContent = {
462
+ category: "hidden",
463
+ detachable: false,
464
+ type: "container",
465
+ icon: import_svg.ContentIcon,
466
+ requiredAncestors: ["NavigationMenuItem"],
467
+ indexWithinAncestor: "NavigationMenu",
468
+ presetStyle,
469
+ label: "Menu Content"
470
+ };
471
+ const metaNavigationMenuLink = {
472
+ category: "hidden",
473
+ detachable: true,
474
+ type: "container",
475
+ stylable: false,
476
+ icon: import_svg.BoxIcon,
477
+ // https://github.com/webstudio-is/webstudio-builder/issues/2193
478
+ // requiredAncestors: ["NavigationMenuContent", "NavigationMenuItem"],
479
+ // Temporary restrict to NavigationMenu
480
+ requiredAncestors: ["NavigationMenu"],
481
+ presetStyle,
482
+ label: "Accessible Link Wrapper"
483
+ };
484
+ const metaNavigationMenuViewport = {
485
+ category: "hidden",
486
+ detachable: true,
487
+ type: "container",
488
+ icon: import_svg.ViewportIcon,
489
+ requiredAncestors: ["NavigationMenu"],
490
+ presetStyle,
491
+ label: "Menu Viewport"
492
+ };
493
+ const propsMetaNavigationMenu = {
494
+ props: import_navigation_menu.propsNavigationMenu
495
+ };
496
+ const propsMetaNavigationMenuItem = {
497
+ props: import_navigation_menu.propsNavigationMenuItem
498
+ };
499
+ const propsMetaNavigationMenuTrigger = {
500
+ props: import_navigation_menu.propsNavigationMenuTrigger
501
+ };
502
+ const propsMetaNavigationMenuContent = {
503
+ props: import_navigation_menu.propsNavigationMenuContent
504
+ };
505
+ const propsMetaNavigationMenuLink = {
506
+ props: import_navigation_menu.propsNavigationMenuLink
507
+ };
508
+ const propsMetaNavigationMenuList = {
509
+ props: import_navigation_menu.propsNavigationMenuList
510
+ };
511
+ const propsMetaNavigationMenuViewport = {
512
+ props: import_navigation_menu.propsNavigationMenuViewport
513
+ };