@webstudio-is/sdk-components-react-radix 0.90.0 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/lib/__generated__/accordion.props.js +6 -12
  2. package/lib/__generated__/checkbox.props.js +3 -6
  3. package/lib/__generated__/collapsible.props.js +4 -8
  4. package/lib/__generated__/dialog.props.js +8 -16
  5. package/lib/__generated__/label.props.js +2 -4
  6. package/lib/__generated__/navigation-menu.props.js +8 -16
  7. package/lib/__generated__/popover.props.js +4 -8
  8. package/lib/__generated__/radio-group.props.js +4 -8
  9. package/lib/__generated__/select.props.js +15 -19
  10. package/lib/__generated__/sheet.props.js +8 -16
  11. package/lib/__generated__/switch.props.js +3 -6
  12. package/lib/__generated__/tabs.props.js +5 -10
  13. package/lib/__generated__/tooltip.props.js +4 -8
  14. package/lib/accordion.js +7 -14
  15. package/{src/accordion.stories.tsx → lib/accordion.stories.js} +9 -12
  16. package/lib/accordion.ws.js +11 -22
  17. package/lib/checkbox.js +3 -6
  18. package/lib/checkbox.stories.js +19 -0
  19. package/lib/checkbox.ws.js +5 -10
  20. package/lib/collapsible.js +5 -10
  21. package/{src/collapsible.stories.tsx → lib/collapsible.stories.js} +9 -12
  22. package/lib/collapsible.ws.js +7 -14
  23. package/lib/components.js +13 -62
  24. package/lib/dialog.js +9 -18
  25. package/{src/dialog.stories.tsx → lib/dialog.stories.js} +9 -12
  26. package/lib/dialog.ws.js +17 -30
  27. package/lib/hooks.js +2 -4
  28. package/lib/label.js +2 -4
  29. package/lib/label.stories.js +19 -0
  30. package/lib/label.ws.js +3 -6
  31. package/lib/metas.js +55 -105
  32. package/lib/navigation-menu.js +9 -18
  33. package/{src/navigation-menu.stories.tsx → lib/navigation-menu.stories.js} +9 -12
  34. package/lib/navigation-menu.ws.js +16 -31
  35. package/lib/popover.js +5 -10
  36. package/{src/popover.stories.tsx → lib/popover.stories.js} +9 -12
  37. package/lib/popover.ws.js +7 -14
  38. package/lib/props-descriptions.js +2 -4
  39. package/lib/props.js +54 -103
  40. package/lib/radio-group.js +4 -8
  41. package/lib/radio-group.stories.js +19 -0
  42. package/lib/radio-group.ws.js +7 -14
  43. package/lib/select.js +10 -20
  44. package/{src/select.stories.tsx → lib/select.stories.js} +9 -12
  45. package/lib/select.ws.js +17 -34
  46. package/lib/sheet.js +9 -18
  47. package/{src/sheet.stories.tsx → lib/sheet.stories.js} +9 -12
  48. package/lib/sheet.ws.js +2 -4
  49. package/lib/switch.js +3 -6
  50. package/lib/switch.stories.js +19 -0
  51. package/lib/switch.ws.js +5 -10
  52. package/lib/tabs.js +6 -12
  53. package/{src/tabs.stories.tsx → lib/tabs.stories.js} +9 -12
  54. package/lib/tabs.ws.js +9 -18
  55. package/lib/theme/__generated__/tailwind-theme.js +517 -0
  56. package/lib/theme/styles.js +3 -6
  57. package/lib/theme/tailwind-classes.js +149 -301
  58. package/lib/theme/tailwind-colors.js +2 -4
  59. package/lib/tooltip.js +5 -10
  60. package/{src/tooltip.stories.tsx → lib/tooltip.stories.js} +9 -12
  61. package/lib/tooltip.ws.js +7 -14
  62. package/lib/types/__generated__/accordion.props.d.ts +1 -1
  63. package/lib/types/__generated__/checkbox.props.d.ts +1 -1
  64. package/lib/types/__generated__/collapsible.props.d.ts +1 -1
  65. package/lib/types/__generated__/dialog.props.d.ts +1 -1
  66. package/lib/types/__generated__/label.props.d.ts +1 -1
  67. package/lib/types/__generated__/navigation-menu.props.d.ts +1 -1
  68. package/lib/types/__generated__/popover.props.d.ts +1 -1
  69. package/lib/types/__generated__/radio-group.props.d.ts +1 -1
  70. package/lib/types/__generated__/select.props.d.ts +1 -1
  71. package/lib/types/__generated__/sheet.props.d.ts +1 -1
  72. package/lib/types/__generated__/switch.props.d.ts +1 -1
  73. package/lib/types/__generated__/tabs.props.d.ts +1 -1
  74. package/lib/types/__generated__/tooltip.props.d.ts +1 -1
  75. package/lib/types/accordion.d.ts +1 -1
  76. package/lib/types/sheet.d.ts +1 -1
  77. package/lib/types/theme/__generated__/tailwind-theme.d.ts +26 -0
  78. package/lib/types/theme/styles.d.ts +60 -60
  79. package/lib/types/theme/tailwind-classes.d.ts +33 -33
  80. package/package.json +20 -23
  81. package/lib/__generated__/button.props.js +0 -565
  82. package/lib/__generated__/input.props.js +0 -668
  83. package/lib/__generated__/textarea.props.js +0 -577
  84. package/lib/cjs/__generated__/accordion.props.js +0 -2645
  85. package/lib/cjs/__generated__/button.props.js +0 -585
  86. package/lib/cjs/__generated__/checkbox.props.js +0 -1103
  87. package/lib/cjs/__generated__/collapsible.props.js +0 -1050
  88. package/lib/cjs/__generated__/dialog.props.js +0 -2623
  89. package/lib/cjs/__generated__/input.props.js +0 -688
  90. package/lib/cjs/__generated__/label.props.js +0 -541
  91. package/lib/cjs/__generated__/navigation-menu.props.js +0 -2585
  92. package/lib/cjs/__generated__/popover.props.js +0 -582
  93. package/lib/cjs/__generated__/radio-group.props.js +0 -1647
  94. package/lib/cjs/__generated__/select.props.js +0 -3698
  95. package/lib/cjs/__generated__/sheet.props.js +0 -2642
  96. package/lib/cjs/__generated__/switch.props.js +0 -1103
  97. package/lib/cjs/__generated__/tabs.props.js +0 -2144
  98. package/lib/cjs/__generated__/textarea.props.js +0 -597
  99. package/lib/cjs/__generated__/tooltip.props.js +0 -593
  100. package/lib/cjs/accordion.js +0 -67
  101. package/lib/cjs/accordion.ws.js +0 -285
  102. package/lib/cjs/checkbox.js +0 -31
  103. package/lib/cjs/checkbox.ws.js +0 -174
  104. package/lib/cjs/collapsible.js +0 -53
  105. package/lib/cjs/collapsible.ws.js +0 -122
  106. package/lib/cjs/components.js +0 -82
  107. package/lib/cjs/dialog.js +0 -89
  108. package/lib/cjs/dialog.ws.js +0 -314
  109. package/lib/cjs/hooks.js +0 -43
  110. package/lib/cjs/label.js +0 -37
  111. package/lib/cjs/label.ws.js +0 -75
  112. package/lib/cjs/metas.js +0 -84
  113. package/lib/cjs/navigation-menu.js +0 -107
  114. package/lib/cjs/navigation-menu.ws.js +0 -514
  115. package/lib/cjs/package.json +0 -1
  116. package/lib/cjs/popover.js +0 -90
  117. package/lib/cjs/popover.ws.js +0 -142
  118. package/lib/cjs/props-descriptions.js +0 -56
  119. package/lib/cjs/props.js +0 -82
  120. package/lib/cjs/radio-group.js +0 -30
  121. package/lib/cjs/radio-group.ws.js +0 -191
  122. package/lib/cjs/select.js +0 -83
  123. package/lib/cjs/select.ws.js +0 -350
  124. package/lib/cjs/sheet.js +0 -96
  125. package/lib/cjs/sheet.ws.js +0 -257
  126. package/lib/cjs/switch.js +0 -27
  127. package/lib/cjs/switch.ws.js +0 -173
  128. package/lib/cjs/tabs.js +0 -59
  129. package/lib/cjs/tabs.ws.js +0 -196
  130. package/lib/cjs/theme/radix-common-types.js +0 -16
  131. package/lib/cjs/theme/styles.js +0 -96
  132. package/lib/cjs/theme/tailwind-classes.js +0 -819
  133. package/lib/cjs/theme/tailwind-colors.js +0 -45
  134. package/lib/cjs/theme/tailwind-theme.js +0 -46
  135. package/lib/cjs/tooltip.js +0 -87
  136. package/lib/cjs/tooltip.ws.js +0 -143
  137. package/lib/theme/radix-common-types.js +0 -0
  138. package/lib/theme/tailwind-theme.js +0 -16
  139. package/lib/types/__generated__/button.props.d.ts +0 -2
  140. package/lib/types/__generated__/input.props.d.ts +0 -2
  141. package/lib/types/__generated__/textarea.props.d.ts +0 -2
  142. package/lib/types/theme/radix-common-types.d.ts +0 -85
  143. package/lib/types/theme/tailwind-theme.d.ts +0 -72
  144. package/src/__generated__/accordion.props.ts +0 -2949
  145. package/src/__generated__/button.props.ts +0 -635
  146. package/src/__generated__/checkbox.props.ts +0 -1217
  147. package/src/__generated__/collapsible.props.ts +0 -1156
  148. package/src/__generated__/dialog.props.ts +0 -2923
  149. package/src/__generated__/input.props.ts +0 -748
  150. package/src/__generated__/label.props.ts +0 -585
  151. package/src/__generated__/navigation-menu.props.ts +0 -2882
  152. package/src/__generated__/popover.props.ts +0 -626
  153. package/src/__generated__/radio-group.props.ts +0 -1828
  154. package/src/__generated__/select.props.ts +0 -4130
  155. package/src/__generated__/sheet.props.ts +0 -2942
  156. package/src/__generated__/switch.props.ts +0 -1217
  157. package/src/__generated__/tabs.props.ts +0 -2386
  158. package/src/__generated__/textarea.props.ts +0 -645
  159. package/src/__generated__/tooltip.props.ts +0 -639
  160. package/src/accordion.tsx +0 -88
  161. package/src/accordion.ws.ts +0 -296
  162. package/src/checkbox.stories.ts +0 -22
  163. package/src/checkbox.tsx +0 -22
  164. package/src/checkbox.ws.ts +0 -154
  165. package/src/collapsible.tsx +0 -62
  166. package/src/collapsible.ws.ts +0 -115
  167. package/src/components.ts +0 -50
  168. package/src/dialog.tsx +0 -92
  169. package/src/dialog.ws.tsx +0 -318
  170. package/src/hooks.ts +0 -22
  171. package/src/label.stories.ts +0 -22
  172. package/src/label.tsx +0 -15
  173. package/src/label.ws.ts +0 -50
  174. package/src/metas.ts +0 -74
  175. package/src/navigation-menu.tsx +0 -130
  176. package/src/navigation-menu.ws.ts +0 -524
  177. package/src/popover.tsx +0 -96
  178. package/src/popover.ws.tsx +0 -128
  179. package/src/props-descriptions.ts +0 -43
  180. package/src/props.ts +0 -73
  181. package/src/radio-group.stories.ts +0 -22
  182. package/src/radio-group.tsx +0 -17
  183. package/src/radio-group.ws.ts +0 -178
  184. package/src/select.tsx +0 -112
  185. package/src/select.ws.ts +0 -349
  186. package/src/sheet.tsx +0 -79
  187. package/src/sheet.ws.tsx +0 -236
  188. package/src/switch.stories.ts +0 -22
  189. package/src/switch.tsx +0 -10
  190. package/src/switch.ws.ts +0 -146
  191. package/src/tabs.tsx +0 -64
  192. package/src/tabs.ws.ts +0 -198
  193. package/src/theme/radix-common-types.ts +0 -496
  194. package/src/theme/styles.ts +0 -76
  195. package/src/theme/tailwind-classes.ts +0 -1026
  196. package/src/theme/tailwind-colors.ts +0 -39
  197. package/src/theme/tailwind-theme.ts +0 -24
  198. package/src/tooltip.tsx +0 -95
  199. package/src/tooltip.ws.tsx +0 -130
@@ -1,115 +0,0 @@
1
- import {
2
- CollapsibleIcon,
3
- TriggerIcon,
4
- ContentIcon,
5
- } from "@webstudio-is/icons/svg";
6
- import type {
7
- PresetStyle,
8
- WsComponentMeta,
9
- WsComponentPropsMeta,
10
- } from "@webstudio-is/react-sdk";
11
- import { div } from "@webstudio-is/react-sdk/css-normalize";
12
- import {
13
- propsCollapsible,
14
- propsCollapsibleContent,
15
- propsCollapsibleTrigger,
16
- } from "./__generated__/collapsible.props";
17
- import { getButtonStyles } from "./theme/styles";
18
-
19
- const presetStyle = {
20
- div,
21
- } satisfies PresetStyle<"div">;
22
-
23
- export const metaCollapsible: WsComponentMeta = {
24
- category: "radix",
25
- order: 5,
26
- type: "container",
27
- presetStyle,
28
- icon: CollapsibleIcon,
29
- description:
30
- "An interactive component which expands and collapses some content, triggered by a button.",
31
- template: [
32
- {
33
- type: "instance",
34
- component: "Collapsible",
35
- dataSources: {
36
- collapsibleOpen: { type: "variable", initialValue: false },
37
- },
38
- props: [
39
- {
40
- type: "dataSource",
41
- name: "open",
42
- dataSourceName: "collapsibleOpen",
43
- },
44
- {
45
- name: "onOpenChange",
46
- type: "action",
47
- value: [
48
- { type: "execute", args: ["open"], code: `collapsibleOpen = open` },
49
- ],
50
- },
51
- ],
52
- children: [
53
- {
54
- type: "instance",
55
- component: "CollapsibleTrigger",
56
- children: [
57
- {
58
- type: "instance",
59
- component: "Button",
60
- styles: getButtonStyles("outline"),
61
- children: [{ type: "text", value: "Click to toggle content" }],
62
- },
63
- ],
64
- },
65
- {
66
- type: "instance",
67
- component: "CollapsibleContent",
68
- children: [
69
- {
70
- type: "instance",
71
- component: "Text",
72
- children: [{ type: "text", value: "Collapsible Content" }],
73
- },
74
- ],
75
- },
76
- ],
77
- },
78
- ],
79
- };
80
-
81
- export const metaCollapsibleTrigger: WsComponentMeta = {
82
- category: "hidden",
83
- type: "container",
84
- icon: TriggerIcon,
85
- stylable: false,
86
- detachable: false,
87
- };
88
-
89
- export const metaCollapsibleContent: WsComponentMeta = {
90
- category: "hidden",
91
- type: "container",
92
- presetStyle,
93
- icon: ContentIcon,
94
- detachable: false,
95
- };
96
-
97
- export const propsMetaCollapsible: WsComponentPropsMeta = {
98
- props: {
99
- ...propsCollapsible,
100
- onOpenChange: {
101
- type: "action",
102
- control: "action",
103
- required: false,
104
- },
105
- },
106
- initialProps: ["open", "onOpenChange"],
107
- };
108
-
109
- export const propsMetaCollapsibleTrigger: WsComponentPropsMeta = {
110
- props: propsCollapsibleTrigger,
111
- };
112
-
113
- export const propsMetaCollapsibleContent: WsComponentPropsMeta = {
114
- props: propsCollapsibleContent,
115
- };
package/src/components.ts DELETED
@@ -1,50 +0,0 @@
1
- export {
2
- Collapsible,
3
- CollapsibleTrigger,
4
- CollapsibleContent,
5
- } from "./collapsible";
6
- export {
7
- Dialog,
8
- DialogTrigger,
9
- DialogOverlay,
10
- DialogContent,
11
- DialogClose,
12
- DialogTitle,
13
- DialogDescription,
14
- } from "./dialog";
15
- export { Popover, PopoverTrigger, PopoverContent } from "./popover";
16
- export { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
17
- export { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
18
- export { Label } from "./label";
19
- export {
20
- Accordion,
21
- AccordionItem,
22
- AccordionHeader,
23
- AccordionTrigger,
24
- AccordionContent,
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.tsx DELETED
@@ -1,92 +0,0 @@
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 ComponentPropsWithoutRef,
6
- type ReactNode,
7
- forwardRef,
8
- Children,
9
- } from "react";
10
- import * as DialogPrimitive from "@radix-ui/react-dialog";
11
- import { getClosestInstance, type Hook } from "@webstudio-is/react-sdk";
12
-
13
- // wrap in forwardRef because Root is functional component without ref
14
- export const Dialog = forwardRef<
15
- HTMLDivElement,
16
- Omit<ComponentPropsWithoutRef<typeof DialogPrimitive.Root>, "defaultOpen">
17
- >((props, _ref) => {
18
- return <DialogPrimitive.Root {...props} />;
19
- });
20
-
21
- /**
22
- * We're not exposing the 'asChild' property for the Trigger.
23
- * Instead, we're enforcing 'asChild=true' for the Trigger and making it style-less.
24
- * This avoids situations where the Trigger inadvertently passes all styles to its child,
25
- * which would prevent us from displaying styles properly in the builder.
26
- */
27
- export const DialogTrigger = forwardRef<
28
- HTMLButtonElement,
29
- { children: ReactNode }
30
- >(({ children, ...props }, ref) => {
31
- const firstChild = Children.toArray(children)[0];
32
-
33
- return (
34
- <DialogPrimitive.Trigger ref={ref} asChild={true} {...props}>
35
- {firstChild ?? <button>Add button or link</button>}
36
- </DialogPrimitive.Trigger>
37
- );
38
- });
39
-
40
- export const DialogOverlay = forwardRef<
41
- HTMLDivElement,
42
- ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
43
- >((props, ref) => {
44
- return (
45
- <DialogPrimitive.DialogPortal>
46
- <DialogPrimitive.Overlay ref={ref} {...props} />
47
- </DialogPrimitive.DialogPortal>
48
- );
49
- });
50
-
51
- export const DialogContent = DialogPrimitive.Content;
52
- export const DialogClose = DialogPrimitive.Close;
53
- export const DialogTitle = DialogPrimitive.Title;
54
- export const DialogDescription = DialogPrimitive.Description;
55
-
56
- /* BUILDER HOOKS */
57
-
58
- const namespace = "@webstudio-is/sdk-components-react-radix";
59
-
60
- // For each DialogOverlay component within the selection,
61
- // we identify its closest parent Dialog component
62
- // and update its open prop bound to variable.
63
- export const hooksDialog: Hook = {
64
- onNavigatorUnselect: (context, event) => {
65
- for (const instance of event.instancePath) {
66
- if (instance.component === `${namespace}:DialogOverlay`) {
67
- const dialog = getClosestInstance(
68
- event.instancePath,
69
- instance,
70
- `${namespace}:Dialog`
71
- );
72
- if (dialog) {
73
- context.setPropVariable(dialog.id, "open", false);
74
- }
75
- }
76
- }
77
- },
78
- onNavigatorSelect: (context, event) => {
79
- for (const instance of event.instancePath) {
80
- if (instance.component === `${namespace}:DialogOverlay`) {
81
- const dialog = getClosestInstance(
82
- event.instancePath,
83
- instance,
84
- `${namespace}:Dialog`
85
- );
86
- if (dialog) {
87
- context.setPropVariable(dialog.id, "open", true);
88
- }
89
- }
90
- }
91
- },
92
- };
package/src/dialog.ws.tsx DELETED
@@ -1,318 +0,0 @@
1
- import {
2
- DialogIcon,
3
- TriggerIcon,
4
- ContentIcon,
5
- OverlayIcon,
6
- HeadingIcon,
7
- TextIcon,
8
- ButtonElementIcon,
9
- LargeXIcon,
10
- } from "@webstudio-is/icons/svg";
11
- import {
12
- type PresetStyle,
13
- type WsComponentMeta,
14
- type WsComponentPropsMeta,
15
- } from "@webstudio-is/react-sdk";
16
- import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
17
- import * as tc from "./theme/tailwind-classes";
18
- import {
19
- propsDialog,
20
- propsDialogContent,
21
- propsDialogTrigger,
22
- propsDialogOverlay,
23
- propsDialogClose,
24
- propsDialogTitle,
25
- propsDialogDescription,
26
- } from "./__generated__/dialog.props";
27
- import { buttonReset, getButtonStyles } from "./theme/styles";
28
-
29
- const presetStyle = {
30
- div,
31
- } satisfies PresetStyle<"div">;
32
-
33
- const titlePresetStyle = {
34
- h2,
35
- } satisfies PresetStyle<"h2">;
36
-
37
- const descriptionPresetStyle = {
38
- p,
39
- } satisfies PresetStyle<"p">;
40
-
41
- // @todo add [data-state] to button and link
42
- export const metaDialogTrigger: WsComponentMeta = {
43
- category: "hidden",
44
- type: "container",
45
- icon: TriggerIcon,
46
- stylable: false,
47
- detachable: false,
48
- };
49
-
50
- export const metaDialogContent: WsComponentMeta = {
51
- category: "hidden",
52
- type: "container",
53
- presetStyle,
54
- icon: ContentIcon,
55
- detachable: false,
56
- };
57
-
58
- export const metaDialogOverlay: WsComponentMeta = {
59
- category: "hidden",
60
- type: "container",
61
- presetStyle,
62
- icon: OverlayIcon,
63
- detachable: false,
64
- };
65
-
66
- export const metaDialogTitle: WsComponentMeta = {
67
- category: "hidden",
68
- type: "container",
69
- presetStyle: titlePresetStyle,
70
- icon: HeadingIcon,
71
- };
72
-
73
- export const metaDialogDescription: WsComponentMeta = {
74
- category: "hidden",
75
- type: "container",
76
- presetStyle: descriptionPresetStyle,
77
- icon: TextIcon,
78
- };
79
-
80
- export const metaDialogClose: WsComponentMeta = {
81
- category: "hidden",
82
- type: "container",
83
- presetStyle: {
84
- button: [buttonReset, button].flat(),
85
- },
86
- icon: ButtonElementIcon,
87
- label: "Close Button",
88
- };
89
-
90
- /**
91
- * Styles source without animations:
92
- * https://github.com/shadcn-ui/ui/blob/main/apps/www/registry/default/ui/dialog.tsx
93
- *
94
- * Attributions
95
- * MIT License
96
- * Copyright (c) 2023 shadcn
97
- **/
98
- export const metaDialog: WsComponentMeta = {
99
- category: "radix",
100
- order: 4,
101
- type: "container",
102
- icon: DialogIcon,
103
- stylable: false,
104
- description:
105
- "Displays content with an overlay that covers the window, triggered by a button. Clicking the overlay will close the dialog.",
106
- template: [
107
- {
108
- type: "instance",
109
- component: "Dialog",
110
- dataSources: {
111
- dialogOpen: { type: "variable", initialValue: false },
112
- },
113
- props: [
114
- {
115
- type: "dataSource",
116
- name: "open",
117
- dataSourceName: "dialogOpen",
118
- },
119
- {
120
- name: "onOpenChange",
121
- type: "action",
122
- value: [
123
- { type: "execute", args: ["open"], code: `dialogOpen = open` },
124
- ],
125
- },
126
- ],
127
- children: [
128
- {
129
- type: "instance",
130
- component: "DialogTrigger",
131
- children: [
132
- {
133
- type: "instance",
134
- component: "Button",
135
- styles: getButtonStyles("outline"),
136
- children: [{ type: "text", value: "Button" }],
137
- },
138
- ],
139
- },
140
- {
141
- type: "instance",
142
- component: "DialogOverlay",
143
- /**
144
- * fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
145
- * flex
146
- **/
147
- styles: [
148
- tc.fixed(),
149
- tc.inset(0),
150
- tc.z(50),
151
- tc.bg("background", 80),
152
- tc.backdropBlur("sm"),
153
- // To allow positioning Content
154
- tc.flex(),
155
- tc.overflow("auto"),
156
- ].flat(),
157
- children: [
158
- {
159
- type: "instance",
160
- component: "DialogContent",
161
- /**
162
- * fixed w-full z-50
163
- * grid gap-4 max-w-lg
164
- * m-auto
165
- * border bg-background p-6 shadow-lg
166
- **/
167
- styles: [
168
- tc.w("full"),
169
- tc.z(50),
170
- tc.flex(),
171
- tc.flex("col"),
172
- tc.gap(4),
173
- tc.m("auto"),
174
- tc.maxW("lg"),
175
- tc.border(),
176
- tc.bg("background"),
177
- tc.p(6),
178
- tc.shadow("lg"),
179
- tc.relative(),
180
- ].flat(),
181
- children: [
182
- {
183
- type: "instance",
184
- component: "Box",
185
- label: "Dialog Header",
186
- styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
187
- children: [
188
- {
189
- type: "instance",
190
- component: "DialogTitle",
191
- /**
192
- * text-lg leading-none tracking-tight
193
- **/
194
- styles: [
195
- tc.my(0),
196
- tc.leading("none"),
197
- tc.text("lg"),
198
- tc.tracking("tight"),
199
- ].flat(),
200
- children: [
201
- {
202
- type: "text",
203
- value: "Dialog Title",
204
- },
205
- ],
206
- },
207
- {
208
- type: "instance",
209
- component: "DialogDescription",
210
- /**
211
- * text-sm text-muted-foreground
212
- **/
213
- styles: [
214
- tc.my(0),
215
- tc.text("sm"),
216
- tc.text("mutedForeground"),
217
- ].flat(),
218
- children: [
219
- {
220
- type: "text",
221
- value: "Dialog description text you can edit",
222
- },
223
- ],
224
- },
225
- ],
226
- },
227
-
228
- {
229
- type: "instance",
230
- component: "Text",
231
- children: [{ type: "text", value: "The text you can edit" }],
232
- },
233
-
234
- {
235
- type: "instance",
236
- component: "DialogClose",
237
- /**
238
- * absolute right-4 top-4
239
- * rounded-sm opacity-70
240
- * ring-offset-background
241
- * hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
242
- * flex items-center justify-center h-4 w-4
243
- **/
244
- styles: [
245
- tc.absolute(),
246
- tc.right(4),
247
- tc.top(4),
248
- tc.rounded("sm"),
249
- tc.opacity(70),
250
- tc.flex(),
251
- tc.items("center"),
252
- tc.justify("center"),
253
- tc.h(4),
254
- tc.w(4),
255
- tc.border(0),
256
- tc.bg("transparent"),
257
- tc.outline("none"),
258
- tc.hover(tc.opacity(100)),
259
- tc.focus(tc.ring("ring", 2, "background", 2)),
260
- ].flat(),
261
- children: [
262
- {
263
- type: "instance",
264
- component: "HtmlEmbed",
265
- label: "Close Icon",
266
- props: [
267
- {
268
- type: "string",
269
- name: "code",
270
- value: LargeXIcon,
271
- },
272
- ],
273
- children: [],
274
- },
275
- ],
276
- },
277
- ],
278
- },
279
- ],
280
- },
281
- ],
282
- },
283
- ],
284
- };
285
-
286
- export const propsMetaDialog: WsComponentPropsMeta = {
287
- props: propsDialog,
288
- initialProps: ["open"],
289
- };
290
-
291
- export const propsMetaDialogTrigger: WsComponentPropsMeta = {
292
- props: propsDialogTrigger,
293
- };
294
-
295
- export const propsMetaDialogContent: WsComponentPropsMeta = {
296
- props: propsDialogContent,
297
- initialProps: [],
298
- };
299
-
300
- export const propsMetaDialogOverlay: WsComponentPropsMeta = {
301
- props: propsDialogOverlay,
302
- initialProps: [],
303
- };
304
-
305
- export const propsMetaDialogClose: WsComponentPropsMeta = {
306
- props: propsDialogClose,
307
- initialProps: [],
308
- };
309
-
310
- export const propsMetaDialogTitle: WsComponentPropsMeta = {
311
- props: propsDialogTitle,
312
- initialProps: [],
313
- };
314
-
315
- export const propsMetaDialogDescription: WsComponentPropsMeta = {
316
- props: propsDialogDescription,
317
- initialProps: [],
318
- };
package/src/hooks.ts DELETED
@@ -1,22 +0,0 @@
1
- import type { Hook } from "@webstudio-is/react-sdk";
2
- import { hooksCollapsible } from "./collapsible";
3
- import { hooksTabs } from "./tabs";
4
- import { hooksDialog } from "./dialog";
5
- import { hooksPopover } from "./popover";
6
- import { hooksSheet } from "./sheet";
7
- import { hooksTooltip } from "./tooltip";
8
- import { hooksAccordion } from "./accordion";
9
- import { hooksNavigationMenu } from "./navigation-menu";
10
- import { hooksSelect } from "./select";
11
-
12
- export const hooks: Hook[] = [
13
- hooksCollapsible,
14
- hooksTabs,
15
- hooksDialog,
16
- hooksPopover,
17
- hooksSheet,
18
- hooksTooltip,
19
- hooksAccordion,
20
- hooksNavigationMenu,
21
- hooksSelect,
22
- ];
@@ -1,22 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { renderComponentTemplate } from "@webstudio-is/react-sdk";
3
- import { Label as LabelPrimitive } from "./label";
4
- import * as baseComponents from "@webstudio-is/sdk-components-react";
5
- import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
6
- import * as radixComponents from "./components";
7
- import * as radixMetas from "./metas";
8
-
9
- export default {
10
- title: "Components/Label",
11
- component: LabelPrimitive,
12
- } satisfies Meta<typeof LabelPrimitive>;
13
-
14
- export const Label: StoryObj<typeof LabelPrimitive> = {
15
- render: (props) =>
16
- renderComponentTemplate({
17
- name: "Label",
18
- props: { ...props },
19
- components: { ...baseComponents, ...radixComponents },
20
- metas: { ...baseMetas, ...radixMetas },
21
- }),
22
- };
package/src/label.tsx DELETED
@@ -1,15 +0,0 @@
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
- forwardRef,
6
- type ComponentPropsWithoutRef,
7
- type ElementRef,
8
- } from "react";
9
-
10
- import * as LabelPrimitive from "@radix-ui/react-label";
11
-
12
- export const Label = forwardRef<
13
- ElementRef<typeof LabelPrimitive.Root>,
14
- Omit<ComponentPropsWithoutRef<typeof LabelPrimitive.Root>, "asChild">
15
- >((props, ref) => <LabelPrimitive.Root ref={ref} {...props} />);
package/src/label.ws.ts DELETED
@@ -1,50 +0,0 @@
1
- import { LabelIcon } from "@webstudio-is/icons/svg";
2
- import {
3
- defaultStates,
4
- type PresetStyle,
5
- type WsComponentMeta,
6
- type WsComponentPropsMeta,
7
- } from "@webstudio-is/react-sdk";
8
- import { label } from "@webstudio-is/react-sdk/css-normalize";
9
- import { props } from "./__generated__/label.props";
10
- import * as tc from "./theme/tailwind-classes";
11
-
12
- const presetStyle = {
13
- label,
14
- } satisfies PresetStyle<"label">;
15
-
16
- export const meta: WsComponentMeta = {
17
- category: "radix",
18
- order: 102,
19
- type: "container",
20
- icon: LabelIcon,
21
- presetStyle,
22
- states: defaultStates,
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.",
25
- template: [
26
- {
27
- type: "instance",
28
- component: "Label",
29
- styles: [
30
- // text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70
31
- tc.text("sm"),
32
- tc.font("medium"),
33
- tc.leading("none"),
34
- // We are not supporting peer like styles yet
35
- ].flat(),
36
- children: [{ type: "text", value: "Form Label" }],
37
- },
38
- ],
39
- };
40
-
41
- export const propsMeta: WsComponentPropsMeta = {
42
- props: {
43
- ...props,
44
- htmlFor: {
45
- ...props.htmlFor,
46
- label: "For",
47
- },
48
- },
49
- initialProps: ["id", "htmlFor"],
50
- };