@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
@@ -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,6 +120,7 @@ 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,
@@ -95,19 +152,9 @@ export const metaAccordion: WsComponentMeta = {
95
152
  component: "AccordionItem",
96
153
  styles: accordionItemStyles,
97
154
  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
- },
155
+ createAccordionTrigger({
156
+ children: [{ type: "text", value: "Is it accessible?" }],
157
+ }),
111
158
  {
112
159
  type: "instance",
113
160
  component: "AccordionContent",
@@ -127,19 +174,9 @@ export const metaAccordion: WsComponentMeta = {
127
174
  component: "AccordionItem",
128
175
  styles: accordionItemStyles,
129
176
  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
- },
177
+ createAccordionTrigger({
178
+ children: [{ type: "text", value: "Is it styled?" }],
179
+ }),
143
180
  {
144
181
  type: "instance",
145
182
  component: "AccordionContent",
@@ -160,19 +197,9 @@ export const metaAccordion: WsComponentMeta = {
160
197
  component: "AccordionItem",
161
198
  styles: accordionItemStyles,
162
199
  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
- },
200
+ createAccordionTrigger({
201
+ children: [{ type: "text", value: "Is it animated?" }],
202
+ }),
176
203
  {
177
204
  type: "instance",
178
205
  component: "AccordionContent",
@@ -199,6 +226,7 @@ export const metaAccordionItem: WsComponentMeta = {
199
226
  requiredAncestors: ["Accordion"],
200
227
  indexWithinAncestor: "Accordion",
201
228
  presetStyle,
229
+ label: "Item",
202
230
  };
203
231
 
204
232
  export const metaAccordionHeader: WsComponentMeta = {
@@ -210,6 +238,7 @@ export const metaAccordionHeader: WsComponentMeta = {
210
238
  presetStyle: {
211
239
  h3: [h3, tc.my(0)].flat(),
212
240
  },
241
+ label: "Item Header",
213
242
  };
214
243
 
215
244
  export const metaAccordionTrigger: WsComponentMeta = {
@@ -219,24 +248,9 @@ export const metaAccordionTrigger: WsComponentMeta = {
219
248
  requiredAncestors: ["AccordionHeader"],
220
249
  detachable: false,
221
250
  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(),
251
+ button: [button, buttonReset].flat(),
239
252
  },
253
+ label: "Item Trigger",
240
254
  };
241
255
 
242
256
  export const metaAccordionContent: WsComponentMeta = {
@@ -246,6 +260,7 @@ export const metaAccordionContent: WsComponentMeta = {
246
260
  requiredAncestors: ["AccordionItem"],
247
261
  detachable: false,
248
262
  presetStyle,
263
+ label: "Item Content",
249
264
  };
250
265
 
251
266
  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,151 @@
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
+ states: [
25
+ ...defaultStates,
26
+ {
27
+ label: "Checked",
28
+ selector: "[data-state=checked]",
29
+ category: "component-states",
30
+ },
31
+ {
32
+ label: "Unchecked",
33
+ selector: "[data-state=unchecked]",
34
+ category: "component-states",
35
+ },
36
+ ],
37
+ presetStyle: {
38
+ button: [button, buttonReset].flat(),
39
+ },
40
+ template: [
41
+ {
42
+ type: "instance",
43
+ component: "Label",
44
+ label: "Checkbox Field",
45
+ styles: [tc.flex(), tc.gap(2), tc.items("center")].flat(),
46
+ children: [
47
+ {
48
+ type: "instance",
49
+ component: "Checkbox",
50
+ dataSources: {
51
+ checkboxChecked: { type: "variable", initialValue: false },
52
+ },
53
+ props: [
54
+ {
55
+ name: "checked",
56
+ type: "dataSource",
57
+ dataSourceName: "checkboxChecked",
58
+ },
59
+ {
60
+ name: "onCheckedChange",
61
+ type: "action",
62
+ value: [
63
+ {
64
+ type: "execute",
65
+ args: ["checked"],
66
+ code: `checkboxChecked = checked`,
67
+ },
68
+ ],
69
+ },
70
+ ],
71
+ // peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background
72
+ // focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
73
+ // disabled:cursor-not-allowed disabled:opacity-50
74
+ // data-[state=checked]:bg-primary
75
+ // data-[state=checked]:text-primary-foreground",
76
+ styles: [
77
+ // We are not supporting peer like styles yet
78
+ tc.h(4),
79
+ tc.w(4),
80
+ tc.shrink(0),
81
+ tc.rounded("sm"),
82
+ tc.border(),
83
+ tc.border("primary"),
84
+ tc.focusVisible(
85
+ [tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
86
+ ),
87
+ tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
88
+ tc.state(
89
+ [tc.bg("primary"), tc.text("primaryForeground")].flat(),
90
+ "[data-state=checked]"
91
+ ),
92
+ ].flat(),
93
+ children: [
94
+ {
95
+ type: "instance",
96
+ component: "CheckboxIndicator",
97
+ // flex items-center justify-center text-current
98
+ styles: [
99
+ tc.flex(),
100
+ tc.items("center"),
101
+ tc.justify("center"),
102
+ tc.text("current"),
103
+ ].flat(),
104
+ children: [
105
+ {
106
+ type: "instance",
107
+ component: "HtmlEmbed",
108
+ label: "Indicator Icon",
109
+ props: [
110
+ {
111
+ type: "string",
112
+ name: "code",
113
+ value: CheckMarkIcon,
114
+ },
115
+ ],
116
+ children: [],
117
+ },
118
+ ],
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ type: "instance",
124
+ component: "Text",
125
+ label: "Checkbox Label",
126
+ props: [{ name: "tag", type: "string", value: "span" }],
127
+ children: [{ type: "text", value: "Checkbox" }],
128
+ },
129
+ ],
130
+ },
131
+ ],
132
+ };
133
+
134
+ export const metaCheckboxIndicator: WsComponentMeta = {
135
+ category: "hidden",
136
+ type: "container",
137
+ icon: TriggerIcon,
138
+ states: defaultStates,
139
+ presetStyle: {
140
+ span,
141
+ },
142
+ };
143
+
144
+ export const propsMetaCheckbox: WsComponentPropsMeta = {
145
+ props: propsCheckbox,
146
+ initialProps: ["id", "checked", "name", "required"],
147
+ };
148
+
149
+ export const propsMetaCheckboxIndicator: WsComponentPropsMeta = {
150
+ props: propsCheckboxIndicator,
151
+ };
@@ -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,6 +22,7 @@ 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,
@@ -53,6 +55,7 @@ export const metaCollapsible: WsComponentMeta = {
53
55
  {
54
56
  type: "instance",
55
57
  component: "Button",
58
+ styles: getButtonStyles("outline"),
56
59
  children: [{ type: "text", value: "Click to toggle content" }],
57
60
  },
58
61
  ],
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,9 +98,9 @@ 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
105
  template: [
106
106
  {
@@ -127,15 +127,18 @@ export const metaDialog: WsComponentMeta = {
127
127
  {
128
128
  type: "instance",
129
129
  component: "DialogTrigger",
130
- props: [],
131
- children: buttonTemplate({
132
- children: [{ type: "text", value: "Button" }],
133
- }),
130
+ children: [
131
+ {
132
+ type: "instance",
133
+ component: "Button",
134
+ styles: getButtonStyles("outline"),
135
+ children: [{ type: "text", value: "Button" }],
136
+ },
137
+ ],
134
138
  },
135
139
  {
136
140
  type: "instance",
137
141
  component: "DialogOverlay",
138
- props: [],
139
142
  /**
140
143
  * fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
141
144
  * flex
@@ -148,12 +151,12 @@ export const metaDialog: WsComponentMeta = {
148
151
  tc.backdropBlur("sm"),
149
152
  // To allow positioning Content
150
153
  tc.flex(),
154
+ tc.overflow("auto"),
151
155
  ].flat(),
152
156
  children: [
153
157
  {
154
158
  type: "instance",
155
159
  component: "DialogContent",
156
- props: [],
157
160
  /**
158
161
  * fixed w-full z-50
159
162
  * grid gap-4 max-w-lg
@@ -179,13 +182,11 @@ export const metaDialog: WsComponentMeta = {
179
182
  type: "instance",
180
183
  component: "Box",
181
184
  label: "Dialog Header",
182
- props: [],
183
185
  styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
184
186
  children: [
185
187
  {
186
188
  type: "instance",
187
189
  component: "DialogTitle",
188
- props: [],
189
190
  /**
190
191
  * text-lg leading-none tracking-tight
191
192
  **/
@@ -205,7 +206,6 @@ export const metaDialog: WsComponentMeta = {
205
206
  {
206
207
  type: "instance",
207
208
  component: "DialogDescription",
208
- props: [],
209
209
  /**
210
210
  * text-sm text-muted-foreground
211
211
  **/
@@ -217,7 +217,7 @@ export const metaDialog: WsComponentMeta = {
217
217
  children: [
218
218
  {
219
219
  type: "text",
220
- value: "dialog description text you can edit",
220
+ value: "Dialog description text you can edit",
221
221
  },
222
222
  ],
223
223
  },
@@ -233,7 +233,6 @@ export const metaDialog: WsComponentMeta = {
233
233
  {
234
234
  type: "instance",
235
235
  component: "DialogClose",
236
- props: [],
237
236
  /**
238
237
  * absolute right-4 top-4
239
238
  * rounded-sm opacity-70
@@ -271,7 +270,7 @@ export const metaDialog: WsComponentMeta = {
271
270
 
272
271
  export const propsMetaDialog: WsComponentPropsMeta = {
273
272
  props: propsDialog,
274
- initialProps: ["open", "modal"],
273
+ initialProps: ["open"],
275
274
  };
276
275
 
277
276
  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,11 @@ 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
23
  template: [
24
24
  {
25
25
  type: "instance",