@webstudio-is/sdk-components-react-radix 0.185.0 → 0.191.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 (47) hide show
  1. package/lib/__generated__/accordion.props.js +2631 -0
  2. package/lib/__generated__/checkbox.props.js +1084 -0
  3. package/lib/__generated__/collapsible.props.js +1024 -0
  4. package/lib/__generated__/dialog.props.js +2599 -0
  5. package/lib/__generated__/label.props.js +519 -0
  6. package/lib/__generated__/navigation-menu.props.js +3660 -0
  7. package/lib/__generated__/popover.props.js +564 -0
  8. package/lib/__generated__/radio-group.props.js +1619 -0
  9. package/lib/__generated__/select.props.js +3681 -0
  10. package/lib/__generated__/switch.props.js +1084 -0
  11. package/lib/__generated__/tabs.props.js +2121 -0
  12. package/lib/__generated__/tooltip.props.js +575 -0
  13. package/lib/accordion.js +36 -0
  14. package/lib/accordion.ws.js +254 -0
  15. package/lib/checkbox.js +8 -0
  16. package/lib/checkbox.ws.js +141 -0
  17. package/lib/collapsible.js +26 -0
  18. package/lib/collapsible.ws.js +92 -0
  19. package/lib/components.js +60 -406
  20. package/lib/dialog.js +84 -0
  21. package/lib/dialog.ws.js +260 -0
  22. package/lib/hooks.js +20 -655
  23. package/lib/label.js +7 -0
  24. package/lib/label.ws.js +43 -0
  25. package/lib/metas.js +62 -4570
  26. package/lib/navigation-menu.js +59 -0
  27. package/lib/navigation-menu.ws.js +481 -0
  28. package/lib/popover.js +48 -0
  29. package/lib/popover.ws.js +96 -0
  30. package/lib/props.js +60 -24208
  31. package/lib/radio-group.js +9 -0
  32. package/lib/radio-group.ws.js +159 -0
  33. package/lib/select.js +46 -0
  34. package/lib/select.ws.js +308 -0
  35. package/lib/sheet.js +43 -0
  36. package/lib/sheet.ws.js +217 -0
  37. package/lib/switch.js +8 -0
  38. package/lib/switch.ws.js +140 -0
  39. package/lib/tabs.js +31 -0
  40. package/lib/tabs.ws.js +187 -0
  41. package/lib/theme/__generated__/tailwind-theme.js +503 -0
  42. package/lib/theme/styles.js +52 -0
  43. package/lib/theme/tailwind-classes.js +474 -0
  44. package/lib/tooltip.js +45 -0
  45. package/lib/tooltip.ws.js +97 -0
  46. package/lib/types/theme/styles.d.ts +92 -44
  47. package/package.json +19 -20
package/lib/hooks.js CHANGED
@@ -1,658 +1,23 @@
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 {
8
- getClosestInstance,
9
- getInstanceSelectorById
10
- } from "@webstudio-is/react-sdk/runtime";
11
- import { jsx } from "react/jsx-runtime";
12
- var CollapsibleTrigger = forwardRef(({ children, ...props }, ref) => {
13
- const firstChild = Children.toArray(children)[0];
14
- return /* @__PURE__ */ jsx(Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button" }) });
15
- });
16
- var namespace = "@webstudio-is/sdk-components-react-radix";
17
- var hooksCollapsible = {
18
- onNavigatorSelect: (context, event) => {
19
- for (const instance of event.instancePath) {
20
- if (instance.component === `${namespace}:CollapsibleContent`) {
21
- const collapsible = getClosestInstance(
22
- event.instancePath,
23
- instance,
24
- `${namespace}:Collapsible`
25
- );
26
- if (collapsible) {
27
- const instanceSelector = getInstanceSelectorById(
28
- event.instanceSelector,
29
- collapsible.id
30
- );
31
- context.setMemoryProp(instanceSelector, "open", true);
32
- }
33
- }
34
- }
35
- }
36
- };
37
-
38
- // src/tabs.tsx
39
- import {
40
- forwardRef as forwardRef2
41
- } from "react";
42
- import { Root as Root2, List, Trigger as Trigger2, Content as Content2 } from "@radix-ui/react-tabs";
43
- import {
44
- getClosestInstance as getClosestInstance2,
45
- getIndexWithinAncestorFromComponentProps,
46
- getInstanceSelectorById as getInstanceSelectorById2
47
- } from "@webstudio-is/react-sdk/runtime";
48
- import { jsx as jsx2 } from "react/jsx-runtime";
49
- var TabsTrigger = forwardRef2(({ value, ...props }, ref) => {
50
- const index = getIndexWithinAncestorFromComponentProps(props);
51
- return /* @__PURE__ */ jsx2(Trigger2, { ref, value: value ?? index ?? "", ...props });
52
- });
53
- var TabsContent = forwardRef2(({ value, ...props }, ref) => {
54
- const index = getIndexWithinAncestorFromComponentProps(props);
55
- return /* @__PURE__ */ jsx2(Content2, { ref, value: value ?? index ?? "", ...props });
56
- });
57
- var namespace2 = "@webstudio-is/sdk-components-react-radix";
58
- var hooksTabs = {
59
- onNavigatorSelect: (context, event) => {
60
- for (const instance of event.instancePath) {
61
- if (instance.component === `${namespace2}:TabsContent`) {
62
- const tabs = getClosestInstance2(
63
- event.instancePath,
64
- instance,
65
- `${namespace2}:Tabs`
66
- );
67
- const contentValue = context.getPropValue(instance.id, "value") ?? context.indexesWithinAncestors.get(instance.id)?.toString();
68
- if (tabs && contentValue) {
69
- const instanceSelector = getInstanceSelectorById2(
70
- event.instanceSelector,
71
- tabs.id
72
- );
73
- context.setMemoryProp(instanceSelector, "value", contentValue);
74
- }
75
- }
76
- }
77
- }
78
- };
79
-
80
- // src/dialog.tsx
81
- import {
82
- forwardRef as forwardRef3,
83
- Children as Children2,
84
- useEffect,
85
- useRef,
86
- useContext
87
- } from "react";
88
- import * as DialogPrimitive from "@radix-ui/react-dialog";
89
- import {
90
- ReactSdkContext,
91
- getClosestInstance as getClosestInstance3,
92
- getInstanceSelectorById as getInstanceSelectorById3
93
- } from "@webstudio-is/react-sdk/runtime";
94
- import { jsx as jsx3 } from "react/jsx-runtime";
95
- var willNavigate = (event) => {
96
- const { target } = event;
97
- if (target instanceof HTMLAnchorElement === false) {
98
- return false;
99
- }
100
- if (target.hasAttribute("href") === false) {
101
- return false;
102
- }
103
- if (target.href === "#") {
104
- return false;
105
- }
106
- if (target.hasAttribute("target") && target.target === "_blank") {
107
- return false;
108
- }
109
- if (event.ctrlKey || event.metaKey) {
110
- return false;
111
- }
112
- return true;
113
- };
114
- var Dialog = forwardRef3((props, _ref) => {
115
- const { open, onOpenChange } = props;
116
- const { renderer } = useContext(ReactSdkContext);
117
- useEffect(() => {
118
- if (renderer !== void 0) {
119
- return;
120
- }
121
- if (open === false) {
122
- return;
123
- }
124
- const handleClick = (event) => {
125
- const { target } = event;
126
- if (willNavigate(event) === false) {
127
- return;
128
- }
129
- if (target instanceof HTMLAnchorElement === false) {
130
- return false;
131
- }
132
- if (target.closest('[role="dialog"]')) {
133
- onOpenChange?.(false);
134
- }
135
- };
136
- window.addEventListener("click", handleClick);
137
- return () => window.removeEventListener("click", handleClick);
138
- }, [open, onOpenChange, renderer]);
139
- return /* @__PURE__ */ jsx3(DialogPrimitive.Root, { ...props });
140
- });
141
- var DialogTrigger = forwardRef3(({ children, ...props }, ref) => {
142
- const firstChild = Children2.toArray(children)[0];
143
- return /* @__PURE__ */ jsx3(DialogPrimitive.Trigger, { ref, asChild: true, ...props, children: firstChild ?? /* @__PURE__ */ jsx3("button", { children: "Add button or link" }) });
144
- });
145
- var DialogOverlay = forwardRef3((props, ref) => {
146
- return /* @__PURE__ */ jsx3(DialogPrimitive.DialogPortal, { children: /* @__PURE__ */ jsx3(DialogPrimitive.Overlay, { ref, ...props }) });
147
- });
148
- var DialogContent = forwardRef3((props, ref) => {
149
- const preventAutoFocusOnClose = useRef(false);
150
- const { renderer } = useContext(ReactSdkContext);
151
- useEffect(() => {
152
- if (renderer !== void 0) {
153
- return;
154
- }
155
- preventAutoFocusOnClose.current = false;
156
- const handleClick = (event) => {
157
- const { target } = event;
158
- if (willNavigate(event) === false) {
159
- return;
160
- }
161
- if (target instanceof HTMLAnchorElement === false) {
162
- return false;
163
- }
164
- if (target.closest('[role="dialog"]')) {
165
- preventAutoFocusOnClose.current = true;
166
- }
167
- };
168
- window.addEventListener("click", handleClick);
169
- return () => window.removeEventListener("click", handleClick);
170
- }, [renderer]);
171
- return /* @__PURE__ */ jsx3(
172
- DialogPrimitive.Content,
173
- {
174
- ref,
175
- ...props,
176
- onCloseAutoFocus: (event) => {
177
- if (preventAutoFocusOnClose.current) {
178
- event.preventDefault();
179
- }
180
- }
181
- }
182
- );
183
- });
184
- var defaultTag = "h1";
185
- var DialogTitle2 = forwardRef3(({ tag: Tag = defaultTag, children, ...props }, ref) => /* @__PURE__ */ jsx3(DialogPrimitive.DialogTitle, { asChild: true, children: /* @__PURE__ */ jsx3(Tag, { ref, ...props, children }) }));
186
- var namespace3 = "@webstudio-is/sdk-components-react-radix";
187
- var hooksDialog = {
188
- onNavigatorUnselect: (context, event) => {
189
- for (const instance of event.instancePath) {
190
- if (instance.component === `${namespace3}:DialogOverlay`) {
191
- const dialog = getClosestInstance3(
192
- event.instancePath,
193
- instance,
194
- `${namespace3}:Dialog`
195
- );
196
- if (dialog) {
197
- const instanceSelector = getInstanceSelectorById3(
198
- event.instanceSelector,
199
- dialog.id
200
- );
201
- context.setMemoryProp(instanceSelector, "open", void 0);
202
- }
203
- }
204
- }
205
- },
206
- onNavigatorSelect: (context, event) => {
207
- for (const instance of event.instancePath) {
208
- if (instance.component === `${namespace3}:DialogOverlay`) {
209
- const dialog = getClosestInstance3(
210
- event.instancePath,
211
- instance,
212
- `${namespace3}:Dialog`
213
- );
214
- if (dialog) {
215
- const instanceSelector = getInstanceSelectorById3(
216
- event.instanceSelector,
217
- dialog.id
218
- );
219
- context.setMemoryProp(instanceSelector, "open", true);
220
- }
221
- }
222
- }
223
- }
224
- };
225
-
226
- // src/popover.tsx
227
- import {
228
- forwardRef as forwardRef4,
229
- Children as Children3
230
- } from "react";
231
- import * as PopoverPrimitive from "@radix-ui/react-popover";
232
- import {
233
- getClosestInstance as getClosestInstance4,
234
- getInstanceSelectorById as getInstanceSelectorById4
235
- } from "@webstudio-is/react-sdk/runtime";
236
- import { jsx as jsx4 } from "react/jsx-runtime";
237
- var Popover = forwardRef4((props, _ref) => {
238
- return /* @__PURE__ */ jsx4(PopoverPrimitive.Root, { ...props });
239
- });
240
- var PopoverTrigger = forwardRef4(({ children, ...props }, ref) => {
241
- const firstChild = Children3.toArray(children)[0];
242
- return /* @__PURE__ */ jsx4(PopoverPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx4("button", { children: "Add button or link" }) });
243
- });
244
- var PopoverContent = forwardRef4(
245
- ({ sideOffset = 4, align = "center", hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
246
- PopoverPrimitive.Content,
247
- {
248
- ref,
249
- align: "center",
250
- sideOffset,
251
- hideWhenDetached,
252
- ...props
253
- }
254
- ) })
255
- );
256
- var namespace4 = "@webstudio-is/sdk-components-react-radix";
257
- var hooksPopover = {
258
- onNavigatorUnselect: (context, event) => {
259
- for (const instance of event.instancePath) {
260
- if (instance.component === `${namespace4}:PopoverContent`) {
261
- const popover = getClosestInstance4(
262
- event.instancePath,
263
- instance,
264
- `${namespace4}:Popover`
265
- );
266
- if (popover) {
267
- const instanceSelector = getInstanceSelectorById4(
268
- event.instanceSelector,
269
- popover.id
270
- );
271
- context.setMemoryProp(instanceSelector, "open", void 0);
272
- }
273
- }
274
- }
275
- },
276
- onNavigatorSelect: (context, event) => {
277
- for (const instance of event.instancePath) {
278
- if (instance.component === `${namespace4}:PopoverContent`) {
279
- const popover = getClosestInstance4(
280
- event.instancePath,
281
- instance,
282
- `${namespace4}:Popover`
283
- );
284
- if (popover) {
285
- const instanceSelector = getInstanceSelectorById4(
286
- event.instanceSelector,
287
- popover.id
288
- );
289
- context.setMemoryProp(instanceSelector, "open", true);
290
- }
291
- }
292
- }
293
- }
294
- };
295
-
296
- // src/sheet.tsx
297
- import {
298
- forwardRef as forwardRef5
299
- } from "react";
300
- import {
301
- getClosestInstance as getClosestInstance5,
302
- getInstanceSelectorById as getInstanceSelectorById5
303
- } from "@webstudio-is/react-sdk/runtime";
304
- import { jsx as jsx5 } from "react/jsx-runtime";
305
- var SheetContent = forwardRef5(
306
- ({ tag = "nav", side = "left", role = "navigation", children, ...props }, ref) => {
307
- const Tag = tag;
308
- return /* @__PURE__ */ jsx5(
309
- DialogContent,
310
- {
311
- asChild: true,
312
- "data-side": side,
313
- role,
314
- ...props,
315
- children: /* @__PURE__ */ jsx5(Tag, { ref, children })
316
- }
317
- );
318
- }
319
- );
320
- var namespace5 = "@webstudio-is/sdk-components-react-radix";
321
- var hooksSheet = {
322
- onNavigatorUnselect: (context, event) => {
323
- for (const instance of event.instancePath) {
324
- if (instance.component === `${namespace5}:SheetOverlay`) {
325
- const sheet = getClosestInstance5(
326
- event.instancePath,
327
- instance,
328
- `${namespace5}:Sheet`
329
- );
330
- if (sheet) {
331
- const instanceSelector = getInstanceSelectorById5(
332
- event.instanceSelector,
333
- sheet.id
334
- );
335
- context.setMemoryProp(instanceSelector, "open", void 0);
336
- }
337
- }
338
- }
339
- },
340
- onNavigatorSelect: (context, event) => {
341
- for (const instance of event.instancePath) {
342
- if (instance.component === `${namespace5}:SheetOverlay`) {
343
- const sheet = getClosestInstance5(
344
- event.instancePath,
345
- instance,
346
- `${namespace5}:Sheet`
347
- );
348
- if (sheet) {
349
- const instanceSelector = getInstanceSelectorById5(
350
- event.instanceSelector,
351
- sheet.id
352
- );
353
- context.setMemoryProp(instanceSelector, "open", true);
354
- }
355
- }
356
- }
357
- }
358
- };
359
-
360
- // src/tooltip.tsx
361
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
362
- import {
363
- getClosestInstance as getClosestInstance6,
364
- getInstanceSelectorById as getInstanceSelectorById6
365
- } from "@webstudio-is/react-sdk/runtime";
366
- import {
367
- forwardRef as forwardRef6,
368
- Children as Children4
369
- } from "react";
370
- import { jsx as jsx6 } from "react/jsx-runtime";
371
- var Tooltip = forwardRef6((props, _ref) => {
372
- return /* @__PURE__ */ jsx6(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx6(TooltipPrimitive.Root, { ...props }) });
373
- });
374
- var TooltipTrigger = forwardRef6(({ children, ...props }, ref) => {
375
- const firstChild = Children4.toArray(children)[0];
376
- return /* @__PURE__ */ jsx6(TooltipPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx6("button", { children: "Add button or link" }) });
377
- });
378
- var TooltipContent = forwardRef6(({ sideOffset = 4, hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx6(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx6(
379
- TooltipPrimitive.Content,
380
- {
381
- ref,
382
- hideWhenDetached,
383
- sideOffset,
384
- ...props
385
- }
386
- ) }));
387
- var namespace6 = "@webstudio-is/sdk-components-react-radix";
388
- var hooksTooltip = {
389
- onNavigatorUnselect: (context, event) => {
390
- for (const instance of event.instancePath) {
391
- if (instance.component === `${namespace6}:TooltipContent`) {
392
- const tooltip = getClosestInstance6(
393
- event.instancePath,
394
- instance,
395
- `${namespace6}:Tooltip`
396
- );
397
- if (tooltip) {
398
- const instanceSelector = getInstanceSelectorById6(
399
- event.instanceSelector,
400
- tooltip.id
401
- );
402
- context.setMemoryProp(instanceSelector, "open", void 0);
403
- }
404
- }
405
- }
406
- },
407
- onNavigatorSelect: (context, event) => {
408
- for (const instance of event.instancePath) {
409
- if (instance.component === `${namespace6}:TooltipContent`) {
410
- const tooltip = getClosestInstance6(
411
- event.instancePath,
412
- instance,
413
- `${namespace6}:Tooltip`
414
- );
415
- if (tooltip) {
416
- const instanceSelector = getInstanceSelectorById6(
417
- event.instanceSelector,
418
- tooltip.id
419
- );
420
- context.setMemoryProp(instanceSelector, "open", true);
421
- }
422
- }
423
- }
424
- }
425
- };
426
-
427
- // src/accordion.tsx
428
- import {
429
- forwardRef as forwardRef7
430
- } from "react";
431
- import {
432
- Root as Root6,
433
- Item,
434
- Header,
435
- Trigger as Trigger6,
436
- Content as Content6
437
- } from "@radix-ui/react-accordion";
438
- import {
439
- getClosestInstance as getClosestInstance7,
440
- getIndexWithinAncestorFromComponentProps as getIndexWithinAncestorFromComponentProps2,
441
- getInstanceSelectorById as getInstanceSelectorById7
442
- } from "@webstudio-is/react-sdk/runtime";
443
- import { jsx as jsx7 } from "react/jsx-runtime";
444
- var Accordion = forwardRef7((props, ref) => {
445
- return /* @__PURE__ */ jsx7(Root6, { ref, type: "single", ...props });
446
- });
447
- var AccordionItem = forwardRef7(({ value, ...props }, ref) => {
448
- const index = getIndexWithinAncestorFromComponentProps2(props);
449
- return /* @__PURE__ */ jsx7(Item, { ref, value: value ?? index ?? "", ...props });
450
- });
451
- var namespace7 = "@webstudio-is/sdk-components-react-radix";
452
- var hooksAccordion = {
453
- onNavigatorSelect: (context, event) => {
454
- for (const instance of event.instancePath) {
455
- if (instance.component === `${namespace7}:AccordionContent`) {
456
- const accordion = getClosestInstance7(
457
- event.instancePath,
458
- instance,
459
- `${namespace7}:Accordion`
460
- );
461
- const item = getClosestInstance7(
462
- event.instancePath,
463
- instance,
464
- `${namespace7}:AccordionItem`
465
- );
466
- if (accordion && item) {
467
- const itemValue = context.getPropValue(item.id, "value") ?? context.indexesWithinAncestors.get(item.id)?.toString();
468
- if (itemValue) {
469
- const instanceSelector = getInstanceSelectorById7(
470
- event.instanceSelector,
471
- accordion.id
472
- );
473
- context.setMemoryProp(instanceSelector, "value", itemValue);
474
- }
475
- }
476
- }
477
- }
478
- }
479
- };
480
-
481
- // src/navigation-menu.tsx
482
- import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
483
- import {
484
- getClosestInstance as getClosestInstance8,
485
- getIndexWithinAncestorFromComponentProps as getIndexWithinAncestorFromComponentProps3,
486
- getInstanceSelectorById as getInstanceSelectorById8,
487
- ReactSdkContext as ReactSdkContext2
488
- } from "@webstudio-is/react-sdk/runtime";
489
- import {
490
- Children as Children5,
491
- forwardRef as forwardRef8,
492
- useContext as useContext2
493
- } from "react";
494
- import { jsx as jsx8 } from "react/jsx-runtime";
495
- var NavigationMenu = forwardRef8(({ value: propsValue, ...props }, ref) => {
496
- const { renderer } = useContext2(ReactSdkContext2);
497
- let value = propsValue;
498
- if (renderer === "canvas") {
499
- value = value === "" ? "-1" : value;
500
- }
501
- return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Root, { ref, value, ...props });
502
- });
503
- var NavigationMenuItem = forwardRef8(({ value, ...props }, ref) => {
504
- const index = getIndexWithinAncestorFromComponentProps3(props);
505
- return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Item, { ref, value: value ?? index, ...props });
506
- });
507
- var NavigationMenuLink = forwardRef8(({ children, ...props }, ref) => {
508
- const firstChild = Children5.toArray(children)[0];
509
- return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Link, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx8("a", { children: "Add link component" }) });
510
- });
511
- var NavigationMenuTrigger = forwardRef8(({ children, ...props }, ref) => {
512
- const firstChild = Children5.toArray(children)[0];
513
- return /* @__PURE__ */ jsx8(NavigationMenuPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx8("button", { children: "Add button or link" }) });
514
- });
515
- var namespace8 = "@webstudio-is/sdk-components-react-radix";
516
- var hooksNavigationMenu = {
517
- onNavigatorUnselect: (context, event) => {
518
- for (const instance of event.instancePath) {
519
- if (instance.component === `${namespace8}:NavigationMenuContent`) {
520
- const menu = getClosestInstance8(
521
- event.instancePath,
522
- instance,
523
- `${namespace8}:NavigationMenu`
524
- );
525
- if (menu) {
526
- const menuSelector = getInstanceSelectorById8(
527
- event.instanceSelector,
528
- menu.id
529
- );
530
- context.setMemoryProp(menuSelector, "value", void 0);
531
- }
532
- }
533
- }
534
- },
535
- onNavigatorSelect: (context, event) => {
536
- for (const instance of event.instancePath) {
537
- if (instance.component === `${namespace8}:NavigationMenuContent`) {
538
- const menu = getClosestInstance8(
539
- event.instancePath,
540
- instance,
541
- `${namespace8}:NavigationMenu`
542
- );
543
- const menuItem = getClosestInstance8(
544
- event.instancePath,
545
- instance,
546
- `${namespace8}:NavigationMenuItem`
547
- );
548
- if (menuItem === void 0 || menu === void 0) {
549
- return;
550
- }
551
- const contentValue = context.getPropValue(menuItem.id, "value") ?? context.indexesWithinAncestors.get(menuItem.id)?.toString();
552
- if (contentValue) {
553
- const menuSelector = getInstanceSelectorById8(
554
- event.instanceSelector,
555
- menu.id
556
- );
557
- context.setMemoryProp(menuSelector, "value", contentValue);
558
- }
559
- }
560
- }
561
- }
562
- };
563
-
564
- // src/select.tsx
565
- import {
566
- forwardRef as forwardRef9,
567
- useContext as useContext3
568
- } from "react";
569
- import {
570
- Root as Root8,
571
- Value,
572
- Trigger as Trigger8,
573
- Content as Content8,
574
- Item as Item3,
575
- ItemIndicator,
576
- ItemText,
577
- Portal as Portal3,
578
- Viewport as Viewport2
579
- } from "@radix-ui/react-select";
580
- import {
581
- getClosestInstance as getClosestInstance9,
582
- getInstanceSelectorById as getInstanceSelectorById9,
583
- ReactSdkContext as ReactSdkContext3
584
- } from "@webstudio-is/react-sdk/runtime";
585
- import { jsx as jsx9 } from "react/jsx-runtime";
586
- var Select = forwardRef9(
587
- ({ value, defaultValue, ...props }, _ref) => {
588
- return /* @__PURE__ */ jsx9(Root8, { ...props, defaultValue: value ?? defaultValue });
589
- }
590
- );
591
- var SelectTrigger = forwardRef9((props, ref) => {
592
- const { renderer } = useContext3(ReactSdkContext3);
593
- const onPointerDown = renderer === "canvas" ? (event) => {
594
- event.preventDefault();
595
- } : void 0;
596
- return /* @__PURE__ */ jsx9(Trigger8, { onPointerDown, ref, ...props });
597
- });
598
- var SelectValue = forwardRef9((props, ref) => {
599
- return /* @__PURE__ */ jsx9(Value, { ref, ...props });
600
- });
601
- var SelectContent = forwardRef9((props, ref) => {
602
- return /* @__PURE__ */ jsx9(Portal3, { children: /* @__PURE__ */ jsx9(Content8, { ref, ...props, position: "popper" }) });
603
- });
604
- var namespace9 = "@webstudio-is/sdk-components-react-radix";
605
- var hooksSelect = {
606
- onNavigatorUnselect: (context, event) => {
607
- for (const instance of event.instancePath) {
608
- if (instance.component === `${namespace9}:SelectContent`) {
609
- const select = getClosestInstance9(
610
- event.instancePath,
611
- instance,
612
- `${namespace9}:Select`
613
- );
614
- if (select) {
615
- const instanceSelector = getInstanceSelectorById9(
616
- event.instanceSelector,
617
- select.id
618
- );
619
- context.setMemoryProp(instanceSelector, "open", void 0);
620
- }
621
- }
622
- }
623
- },
624
- onNavigatorSelect: (context, event) => {
625
- for (const instance of event.instancePath) {
626
- if (instance.component === `${namespace9}:SelectContent`) {
627
- const select = getClosestInstance9(
628
- event.instancePath,
629
- instance,
630
- `${namespace9}:Select`
631
- );
632
- if (select) {
633
- const instanceSelector = getInstanceSelectorById9(
634
- event.instanceSelector,
635
- select.id
636
- );
637
- context.setMemoryProp(instanceSelector, "open", true);
638
- }
639
- }
640
- }
641
- }
642
- };
643
-
644
- // src/hooks.ts
645
- var hooks = [
646
- hooksCollapsible,
647
- hooksTabs,
648
- hooksDialog,
649
- hooksPopover,
650
- hooksSheet,
651
- hooksTooltip,
652
- hooksAccordion,
653
- hooksNavigationMenu,
654
- hooksSelect
1
+ import { hooksCollapsible as o } from "./collapsible.js";
2
+ import { hooksTabs as r } from "./tabs.js";
3
+ import { hooksDialog as m } from "./dialog.js";
4
+ import { hooksPopover as i } from "./popover.js";
5
+ import { hooksSheet as t } from "./sheet.js";
6
+ import { hooksTooltip as p } from "./tooltip.js";
7
+ import { hooksAccordion as s } from "./accordion.js";
8
+ import { hooksNavigationMenu as h } from "./navigation-menu.js";
9
+ import { hooksSelect as k } from "./select.js";
10
+ const S = [
11
+ o,
12
+ r,
13
+ m,
14
+ i,
15
+ t,
16
+ p,
17
+ s,
18
+ h,
19
+ k
655
20
  ];
656
21
  export {
657
- hooks
22
+ S as hooks
658
23
  };
package/lib/label.js ADDED
@@ -0,0 +1,7 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ import * as i from "@radix-ui/react-label";
4
+ const a = t((o, r) => /* @__PURE__ */ m(i.Root, { ref: r, ...o }));
5
+ export {
6
+ a as Label
7
+ };