@webstudio-is/sdk-components-react-radix 0.94.0 → 0.96.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.
- package/lib/components.js +278 -35
- package/lib/hooks.js +475 -11
- package/lib/metas.js +4616 -58
- package/lib/props.js +23280 -57
- package/lib/types/theme/tailwind-classes.d.ts +1 -1
- package/package.json +17 -13
- package/lib/__generated__/accordion.props.js +0 -2619
- package/lib/__generated__/checkbox.props.js +0 -1080
- package/lib/__generated__/collapsible.props.js +0 -1026
- package/lib/__generated__/dialog.props.js +0 -2595
- package/lib/__generated__/label.props.js +0 -519
- package/lib/__generated__/navigation-menu.props.js +0 -2557
- package/lib/__generated__/popover.props.js +0 -558
- package/lib/__generated__/radio-group.props.js +0 -1623
- package/lib/__generated__/select.props.js +0 -3674
- package/lib/__generated__/sheet.props.js +0 -2614
- package/lib/__generated__/switch.props.js +0 -1080
- package/lib/__generated__/tabs.props.js +0 -2119
- package/lib/__generated__/tooltip.props.js +0 -569
- package/lib/accordion.js +0 -51
- package/lib/accordion.stories.js +0 -18
- package/lib/accordion.ws.js +0 -259
- package/lib/checkbox.js +0 -10
- package/lib/checkbox.stories.js +0 -19
- package/lib/checkbox.ws.js +0 -148
- package/lib/collapsible.js +0 -31
- package/lib/collapsible.stories.js +0 -18
- package/lib/collapsible.ws.js +0 -103
- package/lib/dialog.js +0 -53
- package/lib/dialog.stories.js +0 -18
- package/lib/dialog.ws.js +0 -289
- package/lib/label.js +0 -7
- package/lib/label.stories.js +0 -19
- package/lib/label.ws.js +0 -44
- package/lib/navigation-menu.js +0 -76
- package/lib/navigation-menu.stories.js +0 -18
- package/lib/navigation-menu.ws.js +0 -486
- package/lib/popover.js +0 -58
- package/lib/popover.stories.js +0 -18
- package/lib/popover.ws.js +0 -110
- package/lib/props-descriptions.js +0 -34
- package/lib/radio-group.js +0 -7
- package/lib/radio-group.stories.js +0 -19
- package/lib/radio-group.ws.js +0 -166
- package/lib/select.js +0 -65
- package/lib/select.stories.js +0 -18
- package/lib/select.ws.js +0 -321
- package/lib/sheet.js +0 -59
- package/lib/sheet.stories.js +0 -18
- package/lib/sheet.ws.js +0 -225
- package/lib/switch.js +0 -4
- package/lib/switch.stories.js +0 -19
- package/lib/switch.ws.js +0 -140
- package/lib/tabs.js +0 -38
- package/lib/tabs.stories.js +0 -18
- package/lib/tabs.ws.js +0 -169
- package/lib/theme/__generated__/tailwind-theme.js +0 -517
- package/lib/theme/styles.js +0 -63
- package/lib/theme/tailwind-classes.js +0 -651
- package/lib/theme/tailwind-colors.js +0 -23
- package/lib/tooltip.js +0 -55
- package/lib/tooltip.stories.js +0 -18
- package/lib/tooltip.ws.js +0 -111
package/lib/components.js
CHANGED
|
@@ -1,48 +1,291 @@
|
|
|
1
|
-
|
|
1
|
+
// src/collapsible.tsx
|
|
2
|
+
import {
|
|
3
|
+
forwardRef,
|
|
4
|
+
Children
|
|
5
|
+
} from "react";
|
|
6
|
+
import { Root, Trigger, Content } from "@radix-ui/react-collapsible";
|
|
7
|
+
import { getClosestInstance } from "@webstudio-is/react-sdk";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var Collapsible = Root;
|
|
10
|
+
var CollapsibleTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
11
|
+
const firstChild = Children.toArray(children)[0];
|
|
12
|
+
return /* @__PURE__ */ jsx(Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button" }) });
|
|
13
|
+
});
|
|
14
|
+
var CollapsibleContent = Content;
|
|
15
|
+
|
|
16
|
+
// src/dialog.tsx
|
|
17
|
+
import {
|
|
18
|
+
forwardRef as forwardRef2,
|
|
19
|
+
Children as Children2
|
|
20
|
+
} from "react";
|
|
21
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
22
|
+
import { getClosestInstance as getClosestInstance2 } from "@webstudio-is/react-sdk";
|
|
23
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
24
|
+
var Dialog = forwardRef2((props, _ref) => {
|
|
25
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Root, { ...props });
|
|
26
|
+
});
|
|
27
|
+
var DialogTrigger = forwardRef2(({ children, ...props }, ref) => {
|
|
28
|
+
const firstChild = Children2.toArray(children)[0];
|
|
29
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Trigger, { ref, asChild: true, ...props, children: firstChild ?? /* @__PURE__ */ jsx2("button", { children: "Add button or link" }) });
|
|
30
|
+
});
|
|
31
|
+
var DialogOverlay = forwardRef2((props, ref) => {
|
|
32
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.DialogPortal, { children: /* @__PURE__ */ jsx2(DialogPrimitive.Overlay, { ref, ...props }) });
|
|
33
|
+
});
|
|
34
|
+
var DialogContent = DialogPrimitive.Content;
|
|
35
|
+
var DialogClose = DialogPrimitive.Close;
|
|
36
|
+
var DialogTitle = DialogPrimitive.Title;
|
|
37
|
+
var DialogDescription = DialogPrimitive.Description;
|
|
38
|
+
|
|
39
|
+
// src/popover.tsx
|
|
40
|
+
import {
|
|
41
|
+
forwardRef as forwardRef3,
|
|
42
|
+
Children as Children3
|
|
43
|
+
} from "react";
|
|
44
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
45
|
+
import { getClosestInstance as getClosestInstance3 } from "@webstudio-is/react-sdk";
|
|
46
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
47
|
+
var Popover = forwardRef3((props, _ref) => {
|
|
48
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Root, { ...props });
|
|
49
|
+
});
|
|
50
|
+
var PopoverTrigger = forwardRef3(({ children, ...props }, ref) => {
|
|
51
|
+
const firstChild = Children3.toArray(children)[0];
|
|
52
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx3("button", { children: "Add button or link" }) });
|
|
53
|
+
});
|
|
54
|
+
var PopoverContent = forwardRef3(
|
|
55
|
+
({ sideOffset = 4, align = "center", hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
|
|
56
|
+
PopoverPrimitive.Content,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
align: "center",
|
|
60
|
+
sideOffset,
|
|
61
|
+
hideWhenDetached,
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
) })
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// src/tooltip.tsx
|
|
68
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
69
|
+
import { getClosestInstance as getClosestInstance4 } from "@webstudio-is/react-sdk";
|
|
70
|
+
import {
|
|
71
|
+
forwardRef as forwardRef4,
|
|
72
|
+
Children as Children4
|
|
73
|
+
} from "react";
|
|
74
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
75
|
+
var Tooltip = forwardRef4((props, _ref) => {
|
|
76
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx4(TooltipPrimitive.Root, { ...props }) });
|
|
77
|
+
});
|
|
78
|
+
var TooltipTrigger = forwardRef4(({ children, ...props }, ref) => {
|
|
79
|
+
const firstChild = Children4.toArray(children)[0];
|
|
80
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx4("button", { children: "Add button or link" }) });
|
|
81
|
+
});
|
|
82
|
+
var TooltipContent = forwardRef4(({ sideOffset = 4, hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx4(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
|
|
83
|
+
TooltipPrimitive.Content,
|
|
84
|
+
{
|
|
85
|
+
ref,
|
|
86
|
+
hideWhenDetached,
|
|
87
|
+
sideOffset,
|
|
88
|
+
...props
|
|
89
|
+
}
|
|
90
|
+
) }));
|
|
91
|
+
|
|
92
|
+
// src/tabs.tsx
|
|
93
|
+
import {
|
|
94
|
+
forwardRef as forwardRef5
|
|
95
|
+
} from "react";
|
|
96
|
+
import { Root as Root5, List, Trigger as Trigger5, Content as Content5 } from "@radix-ui/react-tabs";
|
|
97
|
+
import {
|
|
98
|
+
getClosestInstance as getClosestInstance5,
|
|
99
|
+
getIndexWithinAncestorFromComponentProps
|
|
100
|
+
} from "@webstudio-is/react-sdk";
|
|
101
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
102
|
+
var Tabs = Root5;
|
|
103
|
+
var TabsList = List;
|
|
104
|
+
var TabsTrigger = forwardRef5(({ value, ...props }, ref) => {
|
|
105
|
+
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
106
|
+
return /* @__PURE__ */ jsx5(Trigger5, { ref, value: value ?? index, ...props });
|
|
107
|
+
});
|
|
108
|
+
var TabsContent = forwardRef5(({ value, ...props }, ref) => {
|
|
109
|
+
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
110
|
+
return /* @__PURE__ */ jsx5(Content5, { ref, value: value ?? index, ...props });
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// src/label.tsx
|
|
114
|
+
import {
|
|
115
|
+
forwardRef as forwardRef6
|
|
116
|
+
} from "react";
|
|
117
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
118
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
119
|
+
var Label = forwardRef6((props, ref) => /* @__PURE__ */ jsx6(LabelPrimitive.Root, { ref, ...props }));
|
|
120
|
+
|
|
121
|
+
// src/accordion.tsx
|
|
122
|
+
import {
|
|
123
|
+
forwardRef as forwardRef7
|
|
124
|
+
} from "react";
|
|
125
|
+
import {
|
|
126
|
+
Root as Root7,
|
|
127
|
+
Item,
|
|
128
|
+
Header,
|
|
129
|
+
Trigger as Trigger6,
|
|
130
|
+
Content as Content6
|
|
131
|
+
} from "@radix-ui/react-accordion";
|
|
132
|
+
import {
|
|
133
|
+
getClosestInstance as getClosestInstance6,
|
|
134
|
+
getIndexWithinAncestorFromComponentProps as getIndexWithinAncestorFromComponentProps2
|
|
135
|
+
} from "@webstudio-is/react-sdk";
|
|
136
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
137
|
+
var Accordion = forwardRef7((props, ref) => {
|
|
138
|
+
return /* @__PURE__ */ jsx7(Root7, { ref, type: "single", ...props });
|
|
139
|
+
});
|
|
140
|
+
var AccordionItem = forwardRef7(({ value, ...props }, ref) => {
|
|
141
|
+
const index = getIndexWithinAncestorFromComponentProps2(props);
|
|
142
|
+
return /* @__PURE__ */ jsx7(Item, { ref, value: value ?? index, ...props });
|
|
143
|
+
});
|
|
144
|
+
var AccordionHeader = Header;
|
|
145
|
+
var AccordionTrigger = Trigger6;
|
|
146
|
+
var AccordionContent = Content6;
|
|
147
|
+
|
|
148
|
+
// src/navigation-menu.tsx
|
|
149
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
150
|
+
import {
|
|
151
|
+
getClosestInstance as getClosestInstance7,
|
|
152
|
+
getIndexWithinAncestorFromComponentProps as getIndexWithinAncestorFromComponentProps3,
|
|
153
|
+
ReactSdkContext
|
|
154
|
+
} from "@webstudio-is/react-sdk";
|
|
155
|
+
import {
|
|
156
|
+
Children as Children5,
|
|
157
|
+
forwardRef as forwardRef8,
|
|
158
|
+
useContext
|
|
159
|
+
} from "react";
|
|
160
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
161
|
+
var NavigationMenu = forwardRef8(({ value: propsValue, ...props }, ref) => {
|
|
162
|
+
const { renderer } = useContext(ReactSdkContext);
|
|
163
|
+
let value = propsValue;
|
|
164
|
+
if (renderer === "canvas") {
|
|
165
|
+
value = value === "" ? "-1" : value;
|
|
166
|
+
}
|
|
167
|
+
return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Root, { ref, value, ...props });
|
|
168
|
+
});
|
|
169
|
+
var NavigationMenuList = NavigationMenuPrimitive.List;
|
|
170
|
+
var NavigationMenuViewport = NavigationMenuPrimitive.Viewport;
|
|
171
|
+
var NavigationMenuContent = NavigationMenuPrimitive.Content;
|
|
172
|
+
var NavigationMenuItem = forwardRef8(({ value, ...props }, ref) => {
|
|
173
|
+
const index = getIndexWithinAncestorFromComponentProps3(props);
|
|
174
|
+
return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Item, { ref, value: value ?? index, ...props });
|
|
175
|
+
});
|
|
176
|
+
var NavigationMenuLink = forwardRef8(({ children, ...props }, ref) => {
|
|
177
|
+
const firstChild = Children5.toArray(children)[0];
|
|
178
|
+
return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Link, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx8("a", { children: "Add link component" }) });
|
|
179
|
+
});
|
|
180
|
+
var NavigationMenuTrigger = forwardRef8(({ children, ...props }, ref) => {
|
|
181
|
+
const firstChild = Children5.toArray(children)[0];
|
|
182
|
+
return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx8("button", { children: "Add button or link" }) });
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// src/select.tsx
|
|
186
|
+
import {
|
|
187
|
+
forwardRef as forwardRef9
|
|
188
|
+
} from "react";
|
|
189
|
+
import {
|
|
190
|
+
Root as Root9,
|
|
191
|
+
Value,
|
|
192
|
+
Trigger as Trigger8,
|
|
193
|
+
Content as Content8,
|
|
194
|
+
Item as Item3,
|
|
195
|
+
ItemIndicator,
|
|
196
|
+
ItemText,
|
|
197
|
+
Portal as Portal3,
|
|
198
|
+
Viewport as Viewport2
|
|
199
|
+
} from "@radix-ui/react-select";
|
|
200
|
+
import { getClosestInstance as getClosestInstance8 } from "@webstudio-is/react-sdk";
|
|
201
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
202
|
+
var Select = forwardRef9(({ value, ...props }, _ref) => {
|
|
203
|
+
if (value === "") {
|
|
204
|
+
value = void 0;
|
|
205
|
+
}
|
|
206
|
+
return /* @__PURE__ */ jsx9(Root9, { value, ...props });
|
|
207
|
+
});
|
|
208
|
+
var SelectTrigger = Trigger8;
|
|
209
|
+
var SelectValue = forwardRef9((props, ref) => {
|
|
210
|
+
return /* @__PURE__ */ jsx9(Value, { ref, ...props });
|
|
211
|
+
});
|
|
212
|
+
var SelectContent = forwardRef9((props, ref) => {
|
|
213
|
+
return /* @__PURE__ */ jsx9(Portal3, { children: /* @__PURE__ */ jsx9(Content8, { ref, ...props, position: "popper" }) });
|
|
214
|
+
});
|
|
215
|
+
var SelectViewport = Viewport2;
|
|
216
|
+
var SelectItem = Item3;
|
|
217
|
+
var SelectItemIndicator = ItemIndicator;
|
|
218
|
+
var SelectItemText = ItemText;
|
|
219
|
+
|
|
220
|
+
// src/switch.tsx
|
|
221
|
+
import { Root as Root10, Thumb } from "@radix-ui/react-switch";
|
|
222
|
+
var Switch = Root10;
|
|
223
|
+
var SwitchThumb = Thumb;
|
|
224
|
+
|
|
225
|
+
// src/checkbox.tsx
|
|
226
|
+
import {
|
|
227
|
+
forwardRef as forwardRef10
|
|
228
|
+
} from "react";
|
|
229
|
+
import { Root as Root11, Indicator } from "@radix-ui/react-checkbox";
|
|
230
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
231
|
+
var Checkbox = forwardRef10((props, ref) => {
|
|
232
|
+
return /* @__PURE__ */ jsx10(Root11, { ref, ...props });
|
|
233
|
+
});
|
|
234
|
+
var CheckboxIndicator = Indicator;
|
|
235
|
+
|
|
236
|
+
// src/radio-group.tsx
|
|
237
|
+
import "react";
|
|
238
|
+
import { Root as Root12, Item as Item4, Indicator as Indicator2 } from "@radix-ui/react-radio-group";
|
|
239
|
+
var RadioGroup = Root12;
|
|
240
|
+
var RadioGroupItem = Item4;
|
|
241
|
+
var RadioGroupIndicator = Indicator2;
|
|
2
242
|
export {
|
|
243
|
+
Accordion,
|
|
244
|
+
AccordionContent,
|
|
245
|
+
AccordionHeader,
|
|
246
|
+
AccordionItem,
|
|
247
|
+
AccordionTrigger,
|
|
248
|
+
Checkbox,
|
|
249
|
+
CheckboxIndicator,
|
|
3
250
|
Collapsible,
|
|
251
|
+
CollapsibleContent,
|
|
4
252
|
CollapsibleTrigger,
|
|
5
|
-
CollapsibleContent
|
|
6
|
-
} from "./collapsible";
|
|
7
|
-
export {
|
|
8
253
|
Dialog,
|
|
9
|
-
DialogTrigger,
|
|
10
|
-
DialogOverlay,
|
|
11
|
-
DialogContent,
|
|
12
254
|
DialogClose,
|
|
255
|
+
DialogContent,
|
|
256
|
+
DialogDescription,
|
|
257
|
+
DialogOverlay,
|
|
13
258
|
DialogTitle,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export { Popover, PopoverTrigger, PopoverContent } from "./popover";
|
|
17
|
-
export { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
|
|
18
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
|
|
19
|
-
export { Label } from "./label";
|
|
20
|
-
export {
|
|
21
|
-
Accordion,
|
|
22
|
-
AccordionItem,
|
|
23
|
-
AccordionHeader,
|
|
24
|
-
AccordionTrigger,
|
|
25
|
-
AccordionContent
|
|
26
|
-
} from "./accordion";
|
|
27
|
-
export {
|
|
259
|
+
DialogTrigger,
|
|
260
|
+
Label,
|
|
28
261
|
NavigationMenu,
|
|
29
|
-
NavigationMenuList,
|
|
30
|
-
NavigationMenuItem,
|
|
31
|
-
NavigationMenuTrigger,
|
|
32
262
|
NavigationMenuContent,
|
|
263
|
+
NavigationMenuItem,
|
|
33
264
|
NavigationMenuLink,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
265
|
+
NavigationMenuList,
|
|
266
|
+
NavigationMenuTrigger,
|
|
267
|
+
NavigationMenuViewport,
|
|
268
|
+
Popover,
|
|
269
|
+
PopoverContent,
|
|
270
|
+
PopoverTrigger,
|
|
271
|
+
RadioGroup,
|
|
272
|
+
RadioGroupIndicator,
|
|
273
|
+
RadioGroupItem,
|
|
37
274
|
Select,
|
|
38
|
-
SelectTrigger,
|
|
39
|
-
SelectValue,
|
|
40
|
-
SelectViewport,
|
|
41
275
|
SelectContent,
|
|
42
276
|
SelectItem,
|
|
43
277
|
SelectItemIndicator,
|
|
44
|
-
SelectItemText
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
278
|
+
SelectItemText,
|
|
279
|
+
SelectTrigger,
|
|
280
|
+
SelectValue,
|
|
281
|
+
SelectViewport,
|
|
282
|
+
Switch,
|
|
283
|
+
SwitchThumb,
|
|
284
|
+
Tabs,
|
|
285
|
+
TabsContent,
|
|
286
|
+
TabsList,
|
|
287
|
+
TabsTrigger,
|
|
288
|
+
Tooltip,
|
|
289
|
+
TooltipContent,
|
|
290
|
+
TooltipTrigger
|
|
291
|
+
};
|