@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
@@ -4,15 +4,18 @@ import {
4
4
  HeaderIcon,
5
5
  TriggerIcon,
6
6
  ContentIcon,
7
+ ChevronDownIcon,
7
8
  } from "@webstudio-is/icons/svg";
8
9
  import type {
9
10
  EmbedTemplateStyleDecl,
10
11
  PresetStyle,
11
12
  WsComponentMeta,
12
13
  WsComponentPropsMeta,
14
+ WsEmbedTemplate,
13
15
  } from "@webstudio-is/react-sdk";
14
16
  import { div, h3, button } from "@webstudio-is/react-sdk/css-normalize";
15
17
  import * as tc from "./theme/tailwind-classes";
18
+ import { buttonReset } from "./theme/styles";
16
19
  import {
17
20
  propsAccordion,
18
21
  propsAccordionItem,
@@ -37,20 +40,73 @@ const presetStyle = {
37
40
  // border-b
38
41
  const accordionItemStyles: EmbedTemplateStyleDecl[] = [tc.borderB()].flat();
39
42
 
40
- // flex
41
- const accordionHeaderStyles: EmbedTemplateStyleDecl[] = [tc.flex()].flat();
42
-
43
- // flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180
44
- const accordionTriggerStyles: EmbedTemplateStyleDecl[] = [
45
- tc.flex(),
46
- tc.flex(1),
47
- tc.items("center"),
48
- tc.justify("between"),
49
- tc.py(4),
50
- tc.font("medium"),
51
- tc.transition("all"),
52
- tc.hover([tc.underline()].flat()),
53
- ].flat();
43
+ const createAccordionTrigger = ({
44
+ children,
45
+ }: {
46
+ children: WsEmbedTemplate;
47
+ }): WsEmbedTemplate[number] => ({
48
+ type: "instance",
49
+ component: "AccordionHeader",
50
+ // flex
51
+ styles: [tc.flex()].flat(),
52
+ children: [
53
+ {
54
+ type: "instance",
55
+ component: "AccordionTrigger",
56
+ // flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180
57
+ styles: [
58
+ tc.flex(),
59
+ tc.flex(1),
60
+ tc.items("center"),
61
+ tc.justify("between"),
62
+ tc.py(4),
63
+ tc.font("medium"),
64
+ tc.hover([tc.underline()].flat()),
65
+ tc.property("--accordion-trigger-icon-transform", "0deg"),
66
+ tc.state(
67
+ [tc.property("--accordion-trigger-icon-transform", "180deg")],
68
+ "[data-state=open]"
69
+ ),
70
+ ].flat(),
71
+ children: [
72
+ {
73
+ type: "instance",
74
+ component: "Text",
75
+ children,
76
+ },
77
+ {
78
+ type: "instance",
79
+ component: "Box",
80
+ label: "Icon Container",
81
+ // h-4 w-4 shrink-0 transition-transform duration-200
82
+ styles: [
83
+ tc.property("rotate", "--accordion-trigger-icon-transform"),
84
+ tc.h(4),
85
+ tc.w(4),
86
+ tc.shrink(0),
87
+ tc.transition("all"),
88
+ tc.duration(200),
89
+ ].flat(),
90
+ children: [
91
+ {
92
+ type: "instance",
93
+ component: "HtmlEmbed",
94
+ label: "Chevron Icon",
95
+ props: [
96
+ {
97
+ type: "string",
98
+ name: "code",
99
+ value: ChevronDownIcon,
100
+ },
101
+ ],
102
+ children: [],
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ },
108
+ ],
109
+ });
54
110
 
55
111
  // overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down
56
112
  // pb-4 pt-0
@@ -64,9 +120,12 @@ const accordionContentStyles: EmbedTemplateStyleDecl[] = [
64
120
 
65
121
  export const metaAccordion: WsComponentMeta = {
66
122
  category: "radix",
123
+ order: 3,
67
124
  type: "container",
68
125
  icon: AccordionIcon,
69
126
  presetStyle,
127
+ description:
128
+ "A vertically stacked set of interactive headings that each reveal an associated section of content. Clicking on the heading will open the item and close other items.",
70
129
  template: [
71
130
  {
72
131
  type: "instance",
@@ -95,19 +154,9 @@ export const metaAccordion: WsComponentMeta = {
95
154
  component: "AccordionItem",
96
155
  styles: accordionItemStyles,
97
156
  children: [
98
- {
99
- type: "instance",
100
- component: "AccordionHeader",
101
- styles: accordionHeaderStyles,
102
- children: [
103
- {
104
- type: "instance",
105
- component: "AccordionTrigger",
106
- styles: accordionTriggerStyles,
107
- children: [{ type: "text", value: "Is it accessible?" }],
108
- },
109
- ],
110
- },
157
+ createAccordionTrigger({
158
+ children: [{ type: "text", value: "Is it accessible?" }],
159
+ }),
111
160
  {
112
161
  type: "instance",
113
162
  component: "AccordionContent",
@@ -127,19 +176,9 @@ export const metaAccordion: WsComponentMeta = {
127
176
  component: "AccordionItem",
128
177
  styles: accordionItemStyles,
129
178
  children: [
130
- {
131
- type: "instance",
132
- component: "AccordionHeader",
133
- styles: accordionHeaderStyles,
134
- children: [
135
- {
136
- type: "instance",
137
- component: "AccordionTrigger",
138
- styles: accordionTriggerStyles,
139
- children: [{ type: "text", value: "Is it styled?" }],
140
- },
141
- ],
142
- },
179
+ createAccordionTrigger({
180
+ children: [{ type: "text", value: "Is it styled?" }],
181
+ }),
143
182
  {
144
183
  type: "instance",
145
184
  component: "AccordionContent",
@@ -160,19 +199,9 @@ export const metaAccordion: WsComponentMeta = {
160
199
  component: "AccordionItem",
161
200
  styles: accordionItemStyles,
162
201
  children: [
163
- {
164
- type: "instance",
165
- component: "AccordionHeader",
166
- styles: accordionHeaderStyles,
167
- children: [
168
- {
169
- type: "instance",
170
- component: "AccordionTrigger",
171
- styles: accordionTriggerStyles,
172
- children: [{ type: "text", value: "Is it animated?" }],
173
- },
174
- ],
175
- },
202
+ createAccordionTrigger({
203
+ children: [{ type: "text", value: "Is it animated?" }],
204
+ }),
176
205
  {
177
206
  type: "instance",
178
207
  component: "AccordionContent",
@@ -199,6 +228,7 @@ export const metaAccordionItem: WsComponentMeta = {
199
228
  requiredAncestors: ["Accordion"],
200
229
  indexWithinAncestor: "Accordion",
201
230
  presetStyle,
231
+ label: "Item",
202
232
  };
203
233
 
204
234
  export const metaAccordionHeader: WsComponentMeta = {
@@ -210,6 +240,7 @@ export const metaAccordionHeader: WsComponentMeta = {
210
240
  presetStyle: {
211
241
  h3: [h3, tc.my(0)].flat(),
212
242
  },
243
+ label: "Item Header",
213
244
  };
214
245
 
215
246
  export const metaAccordionTrigger: WsComponentMeta = {
@@ -219,24 +250,9 @@ export const metaAccordionTrigger: WsComponentMeta = {
219
250
  requiredAncestors: ["AccordionHeader"],
220
251
  detachable: false,
221
252
  presetStyle: {
222
- button: [
223
- button,
224
- {
225
- property: "backgroundColor",
226
- value: { type: "keyword", value: "transparent" },
227
- } as const,
228
- {
229
- property: "backgroundImage",
230
- value: { type: "keyword", value: "none" },
231
- } as const,
232
- {
233
- property: "cursor",
234
- value: { type: "keyword", value: "pointer" },
235
- } as const,
236
- tc.px(0),
237
- tc.border(0),
238
- ].flat(),
253
+ button: [button, buttonReset].flat(),
239
254
  },
255
+ label: "Item Trigger",
240
256
  };
241
257
 
242
258
  export const metaAccordionContent: WsComponentMeta = {
@@ -246,6 +262,7 @@ export const metaAccordionContent: WsComponentMeta = {
246
262
  requiredAncestors: ["AccordionItem"],
247
263
  detachable: false,
248
264
  presetStyle,
265
+ label: "Item Content",
249
266
  };
250
267
 
251
268
  export const propsMetaAccordion: WsComponentPropsMeta = {
@@ -1,25 +1,20 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { renderComponentTemplate } from "@webstudio-is/react-sdk";
3
- import { Textarea as TextareaPrimitive } from "./textarea";
4
3
  import * as baseComponents from "@webstudio-is/sdk-components-react";
5
4
  import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
6
5
  import * as radixComponents from "./components";
7
6
  import * as radixMetas from "./metas";
7
+ import { Checkbox as CheckboxPrimitive } from "./checkbox";
8
8
 
9
9
  export default {
10
- title: "Components/Textarea",
11
- component: TextareaPrimitive,
12
- argTypes: {
13
- placeholder: {
14
- type: "string",
15
- },
16
- },
17
- } satisfies Meta<typeof TextareaPrimitive>;
10
+ title: "Components/Checkbox",
11
+ component: CheckboxPrimitive,
12
+ } satisfies Meta<typeof CheckboxPrimitive>;
18
13
 
19
- export const Textarea: StoryObj<typeof TextareaPrimitive> = {
14
+ export const Checkbox: StoryObj<typeof CheckboxPrimitive> = {
20
15
  render: (props) =>
21
16
  renderComponentTemplate({
22
- name: "Textarea",
17
+ name: "Checkbox",
23
18
  props: { ...props },
24
19
  components: { ...baseComponents, ...radixComponents },
25
20
  metas: { ...baseMetas, ...radixMetas },
@@ -0,0 +1,22 @@
1
+ /* eslint-disable react/display-name */
2
+ // We can't use .displayName until this is merged https://github.com/styleguidist/react-docgen-typescript/pull/449
3
+
4
+ import {
5
+ type ForwardRefExoticComponent,
6
+ type ComponentPropsWithRef,
7
+ forwardRef,
8
+ } from "react";
9
+ import { Root, Indicator } from "@radix-ui/react-checkbox";
10
+
11
+ export const Checkbox = forwardRef<
12
+ HTMLButtonElement,
13
+ // radix checked has complex named type which cannot be parsed
14
+ // cast to boolean
15
+ Omit<ComponentPropsWithRef<typeof Root>, "checked"> & { checked: boolean }
16
+ >((props, ref) => {
17
+ return <Root ref={ref} {...props} />;
18
+ });
19
+
20
+ export const CheckboxIndicator: ForwardRefExoticComponent<
21
+ ComponentPropsWithRef<typeof Indicator>
22
+ > = Indicator;
@@ -0,0 +1,154 @@
1
+ import {
2
+ CheckMarkIcon,
3
+ CheckboxCheckedIcon,
4
+ TriggerIcon,
5
+ } from "@webstudio-is/icons/svg";
6
+ import {
7
+ defaultStates,
8
+ type WsComponentMeta,
9
+ type WsComponentPropsMeta,
10
+ } from "@webstudio-is/react-sdk";
11
+ import { button, span } from "@webstudio-is/react-sdk/css-normalize";
12
+ import * as tc from "./theme/tailwind-classes";
13
+ import { buttonReset } from "./theme/styles";
14
+ import {
15
+ propsCheckbox,
16
+ propsCheckboxIndicator,
17
+ } from "./__generated__/checkbox.props";
18
+
19
+ export const metaCheckbox: WsComponentMeta = {
20
+ category: "radix",
21
+ order: 101,
22
+ type: "container",
23
+ icon: CheckboxCheckedIcon,
24
+ description:
25
+ "Use within a form to allow your users to toggle between checked and not checked. Group checkboxes by matching their “Name” properties. Unlike radios, any number of checkboxes in a group can be checked.",
26
+ states: [
27
+ ...defaultStates,
28
+ {
29
+ label: "Checked",
30
+ selector: "[data-state=checked]",
31
+ category: "component-states",
32
+ },
33
+ {
34
+ label: "Unchecked",
35
+ selector: "[data-state=unchecked]",
36
+ category: "component-states",
37
+ },
38
+ ],
39
+ presetStyle: {
40
+ button: [button, buttonReset].flat(),
41
+ },
42
+ template: [
43
+ {
44
+ type: "instance",
45
+ component: "Label",
46
+ label: "Checkbox Field",
47
+ styles: [tc.flex(), tc.gap(2), tc.items("center")].flat(),
48
+ children: [
49
+ {
50
+ type: "instance",
51
+ component: "Checkbox",
52
+ dataSources: {
53
+ checkboxChecked: { type: "variable", initialValue: false },
54
+ },
55
+ props: [
56
+ {
57
+ name: "checked",
58
+ type: "dataSource",
59
+ dataSourceName: "checkboxChecked",
60
+ },
61
+ {
62
+ name: "onCheckedChange",
63
+ type: "action",
64
+ value: [
65
+ {
66
+ type: "execute",
67
+ args: ["checked"],
68
+ code: `checkboxChecked = checked`,
69
+ },
70
+ ],
71
+ },
72
+ ],
73
+ // peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background
74
+ // focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
75
+ // disabled:cursor-not-allowed disabled:opacity-50
76
+ // data-[state=checked]:bg-primary
77
+ // data-[state=checked]:text-primary-foreground",
78
+ styles: [
79
+ // We are not supporting peer like styles yet
80
+ tc.h(4),
81
+ tc.w(4),
82
+ tc.shrink(0),
83
+ tc.rounded("sm"),
84
+ tc.border(),
85
+ tc.border("primary"),
86
+ tc.focusVisible(
87
+ [tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
88
+ ),
89
+ tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
90
+ tc.state(
91
+ [tc.bg("primary"), tc.text("primaryForeground")].flat(),
92
+ "[data-state=checked]"
93
+ ),
94
+ ].flat(),
95
+ children: [
96
+ {
97
+ type: "instance",
98
+ component: "CheckboxIndicator",
99
+ // flex items-center justify-center text-current
100
+ styles: [
101
+ tc.flex(),
102
+ tc.items("center"),
103
+ tc.justify("center"),
104
+ tc.text("current"),
105
+ ].flat(),
106
+ children: [
107
+ {
108
+ type: "instance",
109
+ component: "HtmlEmbed",
110
+ label: "Indicator Icon",
111
+ props: [
112
+ {
113
+ type: "string",
114
+ name: "code",
115
+ value: CheckMarkIcon,
116
+ },
117
+ ],
118
+ children: [],
119
+ },
120
+ ],
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ type: "instance",
126
+ component: "Text",
127
+ label: "Checkbox Label",
128
+ props: [{ name: "tag", type: "string", value: "span" }],
129
+ children: [{ type: "text", value: "Checkbox" }],
130
+ },
131
+ ],
132
+ },
133
+ ],
134
+ };
135
+
136
+ export const metaCheckboxIndicator: WsComponentMeta = {
137
+ category: "hidden",
138
+ type: "container",
139
+ detachable: false,
140
+ icon: TriggerIcon,
141
+ states: defaultStates,
142
+ presetStyle: {
143
+ span,
144
+ },
145
+ };
146
+
147
+ export const propsMetaCheckbox: WsComponentPropsMeta = {
148
+ props: propsCheckbox,
149
+ initialProps: ["id", "checked", "name", "required"],
150
+ };
151
+
152
+ export const propsMetaCheckboxIndicator: WsComponentPropsMeta = {
153
+ props: propsCheckboxIndicator,
154
+ };
@@ -8,12 +8,13 @@ import type {
8
8
  WsComponentMeta,
9
9
  WsComponentPropsMeta,
10
10
  } from "@webstudio-is/react-sdk";
11
+ import { div } from "@webstudio-is/react-sdk/css-normalize";
11
12
  import {
12
13
  propsCollapsible,
13
14
  propsCollapsibleContent,
14
15
  propsCollapsibleTrigger,
15
16
  } from "./__generated__/collapsible.props";
16
- import { div } from "@webstudio-is/react-sdk/css-normalize";
17
+ import { getButtonStyles } from "./theme/styles";
17
18
 
18
19
  const presetStyle = {
19
20
  div,
@@ -21,9 +22,12 @@ const presetStyle = {
21
22
 
22
23
  export const metaCollapsible: WsComponentMeta = {
23
24
  category: "radix",
25
+ order: 5,
24
26
  type: "container",
25
27
  presetStyle,
26
28
  icon: CollapsibleIcon,
29
+ description:
30
+ "An interactive component which expands and collapses some content, triggered by a button.",
27
31
  template: [
28
32
  {
29
33
  type: "instance",
@@ -53,6 +57,7 @@ export const metaCollapsible: WsComponentMeta = {
53
57
  {
54
58
  type: "instance",
55
59
  component: "Button",
60
+ styles: getButtonStyles("outline"),
56
61
  children: [{ type: "text", value: "Click to toggle content" }],
57
62
  },
58
63
  ],
package/src/components.ts CHANGED
@@ -14,19 +14,7 @@ export {
14
14
  } from "./dialog";
15
15
  export { Popover, PopoverTrigger, PopoverContent } from "./popover";
16
16
  export { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
17
- export {
18
- Sheet,
19
- SheetTrigger,
20
- SheetOverlay,
21
- SheetContent,
22
- SheetClose,
23
- SheetTitle,
24
- SheetDescription,
25
- } from "./sheet";
26
17
  export { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
27
- export { Button } from "./button";
28
- export { Input } from "./input";
29
- export { Textarea } from "./textarea";
30
18
  export { Label } from "./label";
31
19
  export {
32
20
  Accordion,
@@ -35,3 +23,28 @@ export {
35
23
  AccordionTrigger,
36
24
  AccordionContent,
37
25
  } from "./accordion";
26
+
27
+ export {
28
+ NavigationMenu,
29
+ NavigationMenuList,
30
+ NavigationMenuItem,
31
+ NavigationMenuTrigger,
32
+ NavigationMenuContent,
33
+ NavigationMenuLink,
34
+ NavigationMenuViewport,
35
+ } from "./navigation-menu";
36
+
37
+ export {
38
+ Select,
39
+ SelectTrigger,
40
+ SelectValue,
41
+ SelectViewport,
42
+ SelectContent,
43
+ SelectItem,
44
+ SelectItemIndicator,
45
+ SelectItemText,
46
+ } from "./select";
47
+
48
+ export { Switch, SwitchThumb } from "./switch";
49
+ export { Checkbox, CheckboxIndicator } from "./checkbox";
50
+ export { RadioGroup, RadioGroupItem, RadioGroupIndicator } from "./radio-group";
package/src/dialog.ws.tsx CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  type WsComponentMeta,
13
13
  type WsComponentPropsMeta,
14
14
  } from "@webstudio-is/react-sdk";
15
+ import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
15
16
  import * as tc from "./theme/tailwind-classes";
16
17
  import {
17
18
  propsDialog,
@@ -22,9 +23,7 @@ import {
22
23
  propsDialogTitle,
23
24
  propsDialogDescription,
24
25
  } from "./__generated__/dialog.props";
25
- import { template as buttonTemplate } from "./button.ws";
26
-
27
- import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
26
+ import { getButtonStyles } from "./theme/styles";
28
27
 
29
28
  const presetStyle = {
30
29
  div,
@@ -86,6 +85,7 @@ export const metaDialogClose: WsComponentMeta = {
86
85
  type: "container",
87
86
  presetStyle: buttonPresetStyle,
88
87
  icon: ButtonElementIcon,
88
+ label: "Close Button",
89
89
  };
90
90
 
91
91
  /**
@@ -98,10 +98,12 @@ export const metaDialogClose: WsComponentMeta = {
98
98
  **/
99
99
  export const metaDialog: WsComponentMeta = {
100
100
  category: "radix",
101
+ order: 4,
101
102
  type: "container",
102
103
  icon: DialogIcon,
103
- order: 15,
104
104
  stylable: false,
105
+ description:
106
+ "Displays content with an overlay that covers the window, triggered by a button. Clicking the overlay will close the dialog.",
105
107
  template: [
106
108
  {
107
109
  type: "instance",
@@ -127,15 +129,18 @@ export const metaDialog: WsComponentMeta = {
127
129
  {
128
130
  type: "instance",
129
131
  component: "DialogTrigger",
130
- props: [],
131
- children: buttonTemplate({
132
- children: [{ type: "text", value: "Button" }],
133
- }),
132
+ children: [
133
+ {
134
+ type: "instance",
135
+ component: "Button",
136
+ styles: getButtonStyles("outline"),
137
+ children: [{ type: "text", value: "Button" }],
138
+ },
139
+ ],
134
140
  },
135
141
  {
136
142
  type: "instance",
137
143
  component: "DialogOverlay",
138
- props: [],
139
144
  /**
140
145
  * fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
141
146
  * flex
@@ -148,12 +153,12 @@ export const metaDialog: WsComponentMeta = {
148
153
  tc.backdropBlur("sm"),
149
154
  // To allow positioning Content
150
155
  tc.flex(),
156
+ tc.overflow("auto"),
151
157
  ].flat(),
152
158
  children: [
153
159
  {
154
160
  type: "instance",
155
161
  component: "DialogContent",
156
- props: [],
157
162
  /**
158
163
  * fixed w-full z-50
159
164
  * grid gap-4 max-w-lg
@@ -179,13 +184,11 @@ export const metaDialog: WsComponentMeta = {
179
184
  type: "instance",
180
185
  component: "Box",
181
186
  label: "Dialog Header",
182
- props: [],
183
187
  styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
184
188
  children: [
185
189
  {
186
190
  type: "instance",
187
191
  component: "DialogTitle",
188
- props: [],
189
192
  /**
190
193
  * text-lg leading-none tracking-tight
191
194
  **/
@@ -205,7 +208,6 @@ export const metaDialog: WsComponentMeta = {
205
208
  {
206
209
  type: "instance",
207
210
  component: "DialogDescription",
208
- props: [],
209
211
  /**
210
212
  * text-sm text-muted-foreground
211
213
  **/
@@ -217,7 +219,7 @@ export const metaDialog: WsComponentMeta = {
217
219
  children: [
218
220
  {
219
221
  type: "text",
220
- value: "dialog description text you can edit",
222
+ value: "Dialog description text you can edit",
221
223
  },
222
224
  ],
223
225
  },
@@ -233,7 +235,6 @@ export const metaDialog: WsComponentMeta = {
233
235
  {
234
236
  type: "instance",
235
237
  component: "DialogClose",
236
- props: [],
237
238
  /**
238
239
  * absolute right-4 top-4
239
240
  * rounded-sm opacity-70
@@ -271,7 +272,7 @@ export const metaDialog: WsComponentMeta = {
271
272
 
272
273
  export const propsMetaDialog: WsComponentPropsMeta = {
273
274
  props: propsDialog,
274
- initialProps: ["open", "modal"],
275
+ initialProps: ["open"],
275
276
  };
276
277
 
277
278
  export const propsMetaDialogTrigger: WsComponentPropsMeta = {
package/src/hooks.ts CHANGED
@@ -6,6 +6,8 @@ import { hooksPopover } from "./popover";
6
6
  import { hooksSheet } from "./sheet";
7
7
  import { hooksTooltip } from "./tooltip";
8
8
  import { hooksAccordion } from "./accordion";
9
+ import { hooksNavigationMenu } from "./navigation-menu";
10
+ import { hooksSelect } from "./select";
9
11
 
10
12
  export const hooks: Hook[] = [
11
13
  hooksCollapsible,
@@ -15,4 +17,6 @@ export const hooks: Hook[] = [
15
17
  hooksSheet,
16
18
  hooksTooltip,
17
19
  hooksAccordion,
20
+ hooksNavigationMenu,
21
+ hooksSelect,
18
22
  ];
package/src/label.ws.ts CHANGED
@@ -15,11 +15,13 @@ const presetStyle = {
15
15
 
16
16
  export const meta: WsComponentMeta = {
17
17
  category: "radix",
18
+ order: 102,
18
19
  type: "container",
19
20
  icon: LabelIcon,
20
21
  presetStyle,
21
22
  states: defaultStates,
22
- order: 1,
23
+ description:
24
+ "An accessible label to describe the purpose of an input. Match the “For” property on the label with the “ID” of the input to connect them.",
23
25
  template: [
24
26
  {
25
27
  type: "instance",