@webstudio-is/sdk-components-react-radix 0.0.0-021f2d4

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 (120) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +4 -0
  3. package/lib/__generated__/accordion.props.js +2631 -0
  4. package/lib/__generated__/checkbox.props.js +1084 -0
  5. package/lib/__generated__/collapsible.props.js +1024 -0
  6. package/lib/__generated__/dialog.props.js +2599 -0
  7. package/lib/__generated__/label.props.js +519 -0
  8. package/lib/__generated__/navigation-menu.props.js +3660 -0
  9. package/lib/__generated__/popover.props.js +564 -0
  10. package/lib/__generated__/radio-group.props.js +1619 -0
  11. package/lib/__generated__/select.props.js +3687 -0
  12. package/lib/__generated__/switch.props.js +1084 -0
  13. package/lib/__generated__/tabs.props.js +2121 -0
  14. package/lib/__generated__/tooltip.props.js +575 -0
  15. package/lib/accordion.js +36 -0
  16. package/lib/accordion.template.js +95 -0
  17. package/lib/accordion.ws.js +117 -0
  18. package/lib/checkbox.js +8 -0
  19. package/lib/checkbox.template.js +63 -0
  20. package/lib/checkbox.ws.js +51 -0
  21. package/lib/collapsible.js +37 -0
  22. package/lib/collapsible.template.js +16 -0
  23. package/lib/collapsible.ws.js +59 -0
  24. package/lib/components.js +62 -0
  25. package/lib/dialog.js +102 -0
  26. package/lib/dialog.template.js +119 -0
  27. package/lib/dialog.ws.js +138 -0
  28. package/lib/hooks.js +21 -0
  29. package/lib/label.js +7 -0
  30. package/lib/label.template.js +23 -0
  31. package/lib/label.ws.js +19 -0
  32. package/lib/metas.js +62 -0
  33. package/lib/navigation-menu.js +59 -0
  34. package/lib/navigation-menu.template.js +283 -0
  35. package/lib/navigation-menu.ws.js +124 -0
  36. package/lib/popover.js +48 -0
  37. package/lib/popover.template.js +33 -0
  38. package/lib/popover.ws.js +50 -0
  39. package/lib/props.js +62 -0
  40. package/lib/radio-group.js +9 -0
  41. package/lib/radio-group.template.js +66 -0
  42. package/lib/radio-group.ws.js +73 -0
  43. package/lib/select.js +46 -0
  44. package/lib/select.template.js +121 -0
  45. package/lib/select.ws.js +155 -0
  46. package/lib/shared/preset-styles.js +38 -0
  47. package/lib/shared/proxy.js +5 -0
  48. package/lib/shared/styles.js +51 -0
  49. package/lib/shared/theme.js +162 -0
  50. package/lib/sheet.template.js +129 -0
  51. package/lib/switch.js +8 -0
  52. package/lib/switch.template.js +63 -0
  53. package/lib/switch.ws.js +63 -0
  54. package/lib/tabs.js +65 -0
  55. package/lib/tabs.template.js +66 -0
  56. package/lib/tabs.ws.js +88 -0
  57. package/lib/templates.js +28 -0
  58. package/lib/tooltip.js +45 -0
  59. package/lib/tooltip.template.js +33 -0
  60. package/lib/tooltip.ws.js +50 -0
  61. package/lib/types/__generated__/accordion.props.d.ts +6 -0
  62. package/lib/types/__generated__/checkbox.props.d.ts +3 -0
  63. package/lib/types/__generated__/collapsible.props.d.ts +4 -0
  64. package/lib/types/__generated__/dialog.props.d.ts +8 -0
  65. package/lib/types/__generated__/label.props.d.ts +2 -0
  66. package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
  67. package/lib/types/__generated__/popover.props.d.ts +4 -0
  68. package/lib/types/__generated__/radio-group.props.d.ts +4 -0
  69. package/lib/types/__generated__/select.props.d.ts +9 -0
  70. package/lib/types/__generated__/switch.props.d.ts +3 -0
  71. package/lib/types/__generated__/tabs.props.d.ts +5 -0
  72. package/lib/types/__generated__/tooltip.props.d.ts +4 -0
  73. package/lib/types/accordion.d.ts +11 -0
  74. package/lib/types/accordion.template.d.ts +10 -0
  75. package/lib/types/accordion.ws.d.ts +11 -0
  76. package/lib/types/checkbox.d.ts +9 -0
  77. package/lib/types/checkbox.template.d.ts +2 -0
  78. package/lib/types/checkbox.ws.d.ts +5 -0
  79. package/lib/types/collapsible.d.ts +15 -0
  80. package/lib/types/collapsible.template.d.ts +2 -0
  81. package/lib/types/collapsible.ws.d.ts +7 -0
  82. package/lib/types/components.d.ts +12 -0
  83. package/lib/types/dialog.d.ts +23 -0
  84. package/lib/types/dialog.template.d.ts +10 -0
  85. package/lib/types/dialog.ws.d.ts +15 -0
  86. package/lib/types/hooks.d.ts +2 -0
  87. package/lib/types/label.d.ts +2 -0
  88. package/lib/types/label.template.d.ts +10 -0
  89. package/lib/types/label.ws.d.ts +3 -0
  90. package/lib/types/metas.d.ts +12 -0
  91. package/lib/types/navigation-menu.d.ts +10 -0
  92. package/lib/types/navigation-menu.template.d.ts +2 -0
  93. package/lib/types/navigation-menu.ws.d.ts +15 -0
  94. package/lib/types/popover.d.ts +15 -0
  95. package/lib/types/popover.template.d.ts +10 -0
  96. package/lib/types/popover.ws.d.ts +7 -0
  97. package/lib/types/props-descriptions.d.ts +29 -0
  98. package/lib/types/props.d.ts +12 -0
  99. package/lib/types/radio-group.d.ts +5 -0
  100. package/lib/types/radio-group.template.d.ts +2 -0
  101. package/lib/types/radio-group.ws.d.ts +7 -0
  102. package/lib/types/select.d.ts +14 -0
  103. package/lib/types/select.template.d.ts +2 -0
  104. package/lib/types/select.ws.d.ts +17 -0
  105. package/lib/types/shared/preset-styles.d.ts +2 -0
  106. package/lib/types/shared/proxy.d.ts +15 -0
  107. package/lib/types/shared/styles.d.ts +2 -0
  108. package/lib/types/shared/theme.d.ts +212 -0
  109. package/lib/types/sheet.template.d.ts +10 -0
  110. package/lib/types/switch.d.ts +4 -0
  111. package/lib/types/switch.template.d.ts +2 -0
  112. package/lib/types/switch.ws.d.ts +5 -0
  113. package/lib/types/tabs.d.ts +13 -0
  114. package/lib/types/tabs.template.d.ts +2 -0
  115. package/lib/types/tabs.ws.d.ts +9 -0
  116. package/lib/types/templates.d.ts +13 -0
  117. package/lib/types/tooltip.d.ts +15 -0
  118. package/lib/types/tooltip.template.d.ts +10 -0
  119. package/lib/types/tooltip.ws.d.ts +7 -0
  120. package/package.json +85 -0
@@ -0,0 +1,124 @@
1
+ import { NavigationMenuIcon as t, ListIcon as e, ListItemIcon as o, TriggerIcon as i, ContentIcon as a, BoxIcon as r, ViewportIcon as p } from "@webstudio-is/icons/svg";
2
+ import { div as n } from "@webstudio-is/sdk/normalize.css";
3
+ import { propsNavigationMenu as s, propsNavigationMenuItem as c, propsNavigationMenuTrigger as M, propsNavigationMenuContent as g, propsNavigationMenuLink as u, propsNavigationMenuList as v, propsNavigationMenuViewport as N } from "./__generated__/navigation-menu.props.js";
4
+ const y = {
5
+ type: "container",
6
+ icon: t,
7
+ presetStyle: {
8
+ div: n
9
+ },
10
+ constraints: [
11
+ {
12
+ relation: "descendant",
13
+ component: { $eq: "NavigationMenuList" }
14
+ },
15
+ {
16
+ relation: "descendant",
17
+ component: { $eq: "NavigationMenuViewport" }
18
+ }
19
+ ]
20
+ }, L = {
21
+ type: "container",
22
+ icon: e,
23
+ constraints: [
24
+ {
25
+ relation: "ancestor",
26
+ component: { $eq: "NavigationMenu" }
27
+ },
28
+ {
29
+ relation: "descendant",
30
+ component: { $eq: "NavigationMenuItem" }
31
+ }
32
+ ],
33
+ presetStyle: {
34
+ div: n
35
+ },
36
+ label: "Menu List"
37
+ }, $ = {
38
+ type: "container",
39
+ icon: o,
40
+ constraints: {
41
+ relation: "ancestor",
42
+ component: { $eq: "NavigationMenuList" }
43
+ },
44
+ presetStyle: {
45
+ div: n
46
+ },
47
+ indexWithinAncestor: "NavigationMenu",
48
+ label: "Menu Item"
49
+ }, d = {
50
+ type: "container",
51
+ icon: i,
52
+ constraints: {
53
+ relation: "ancestor",
54
+ component: { $eq: "NavigationMenuItem" }
55
+ },
56
+ label: "Menu Trigger"
57
+ }, q = {
58
+ type: "container",
59
+ icon: a,
60
+ constraints: {
61
+ relation: "ancestor",
62
+ component: { $eq: "NavigationMenuItem" }
63
+ },
64
+ indexWithinAncestor: "NavigationMenu",
65
+ presetStyle: {
66
+ div: n
67
+ },
68
+ label: "Menu Content"
69
+ }, b = {
70
+ type: "container",
71
+ icon: r,
72
+ constraints: [
73
+ {
74
+ relation: "ancestor",
75
+ component: { $eq: "NavigationMenu" }
76
+ },
77
+ {
78
+ relation: "ancestor",
79
+ component: { $in: ["NavigationMenuContent", "NavigationMenuItem"] }
80
+ }
81
+ ],
82
+ label: "Accessible Link Wrapper"
83
+ }, w = {
84
+ type: "container",
85
+ icon: p,
86
+ constraints: {
87
+ relation: "ancestor",
88
+ component: { $eq: "NavigationMenu" }
89
+ },
90
+ presetStyle: {
91
+ div: n
92
+ },
93
+ label: "Menu Viewport"
94
+ }, C = {
95
+ props: s
96
+ }, V = {
97
+ props: c
98
+ }, S = {
99
+ props: M
100
+ }, T = {
101
+ props: g
102
+ }, k = {
103
+ props: u
104
+ }, x = {
105
+ props: v
106
+ }, f = {
107
+ props: N
108
+ };
109
+ export {
110
+ y as metaNavigationMenu,
111
+ q as metaNavigationMenuContent,
112
+ $ as metaNavigationMenuItem,
113
+ b as metaNavigationMenuLink,
114
+ L as metaNavigationMenuList,
115
+ d as metaNavigationMenuTrigger,
116
+ w as metaNavigationMenuViewport,
117
+ C as propsMetaNavigationMenu,
118
+ T as propsMetaNavigationMenuContent,
119
+ V as propsMetaNavigationMenuItem,
120
+ k as propsMetaNavigationMenuLink,
121
+ x as propsMetaNavigationMenuList,
122
+ S as propsMetaNavigationMenuTrigger,
123
+ f as propsMetaNavigationMenuViewport
124
+ };
package/lib/popover.js ADDED
@@ -0,0 +1,48 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as c, Children as P } from "react";
3
+ import * as s from "@radix-ui/react-popover";
4
+ import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
5
+ const l = c((o, t) => /* @__PURE__ */ n(s.Root, { ...o })), v = c(({ children: o, ...t }, e) => {
6
+ const r = P.toArray(o)[0];
7
+ return /* @__PURE__ */ n(s.Trigger, { asChild: !0, ref: e, ...t, children: r ?? /* @__PURE__ */ n("button", { children: "Add button or link" }) });
8
+ }), h = c(
9
+ ({ sideOffset: o = 4, align: t = "center", hideWhenDetached: e = !0, ...r }, p) => /* @__PURE__ */ n(s.Portal, { children: /* @__PURE__ */ n(
10
+ s.Content,
11
+ {
12
+ ref: p,
13
+ align: "center",
14
+ sideOffset: o,
15
+ hideWhenDetached: e,
16
+ ...r
17
+ }
18
+ ) })
19
+ ), i = "@webstudio-is/sdk-components-react-radix", g = {
20
+ onNavigatorUnselect: (o, t) => {
21
+ for (const e of t.instancePath)
22
+ if (e.component === `${i}:PopoverContent`) {
23
+ const r = a(
24
+ t.instancePath,
25
+ e,
26
+ `${i}:Popover`
27
+ );
28
+ r && o.setMemoryProp(r, "open", void 0);
29
+ }
30
+ },
31
+ onNavigatorSelect: (o, t) => {
32
+ for (const e of t.instancePath)
33
+ if (e.component === `${i}:PopoverContent`) {
34
+ const r = a(
35
+ t.instancePath,
36
+ e,
37
+ `${i}:Popover`
38
+ );
39
+ r && o.setMemoryProp(r, "open", !0);
40
+ }
41
+ }
42
+ };
43
+ export {
44
+ l as Popover,
45
+ h as PopoverContent,
46
+ v as PopoverTrigger,
47
+ g as hooksPopover
48
+ };
@@ -0,0 +1,33 @@
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import { $ as t, PlaceholderValue as d, css as n } from "@webstudio-is/template";
3
+ import { radix as r } from "./shared/proxy.js";
4
+ import { getButtonStyle as l } from "./shared/styles.js";
5
+ import { zIndex as a, width as p, borderRadius as s, borderWidth as c, colors as e, spacing as m, boxShadow as h } from "./shared/theme.js";
6
+ const w = {
7
+ category: "radix",
8
+ description: "Displays rich content in a portal, triggered by a button.",
9
+ order: 6,
10
+ template: /* @__PURE__ */ i(r.Popover, { children: [
11
+ /* @__PURE__ */ o(r.PopoverTrigger, { children: /* @__PURE__ */ o(t.Button, { "ws:style": l("outline"), children: new d("Button") }) }),
12
+ /* @__PURE__ */ o(
13
+ r.PopoverContent,
14
+ {
15
+ "ws:style": n`
16
+ z-index: ${a[50]};
17
+ width: ${p[72]};
18
+ border-radius: ${s.md};
19
+ border: ${c.DEFAULT} solid ${e.border};
20
+ background-color: ${e.popover};
21
+ padding: ${m[4]};
22
+ color: ${e.popoverForeground};
23
+ box-shadow: ${h.md};
24
+ outline: none;
25
+ `,
26
+ children: /* @__PURE__ */ o(t.Text, { children: new d("The text you can edit") })
27
+ }
28
+ )
29
+ ] })
30
+ };
31
+ export {
32
+ w as meta
33
+ };
@@ -0,0 +1,50 @@
1
+ import { TriggerIcon as o, ContentIcon as e, PopoverIcon as n } from "@webstudio-is/icons/svg";
2
+ import { div as t } from "@webstudio-is/sdk/normalize.css";
3
+ import { propsPopover as r, propsPopoverTrigger as p, propsPopoverContent as i } from "./__generated__/popover.props.js";
4
+ const P = {
5
+ type: "container",
6
+ icon: o,
7
+ constraints: {
8
+ relation: "ancestor",
9
+ component: { $eq: "Popover" }
10
+ }
11
+ }, v = {
12
+ type: "container",
13
+ presetStyle: {
14
+ div: t
15
+ },
16
+ icon: e,
17
+ constraints: {
18
+ relation: "ancestor",
19
+ component: { $eq: "Popover" }
20
+ }
21
+ }, m = {
22
+ type: "container",
23
+ icon: n,
24
+ constraints: [
25
+ {
26
+ relation: "descendant",
27
+ component: { $eq: "PopoverTrigger" }
28
+ },
29
+ {
30
+ relation: "descendant",
31
+ component: { $eq: "PopoverContent" }
32
+ }
33
+ ]
34
+ }, g = {
35
+ props: r,
36
+ initialProps: ["open"]
37
+ }, l = {
38
+ props: p
39
+ }, d = {
40
+ props: i,
41
+ initialProps: ["side", "sideOffset", "align", "alignOffset"]
42
+ };
43
+ export {
44
+ m as metaPopover,
45
+ v as metaPopoverContent,
46
+ P as metaPopoverTrigger,
47
+ g as propsMetaPopover,
48
+ d as propsMetaPopoverContent,
49
+ l as propsMetaPopoverTrigger
50
+ };
package/lib/props.js ADDED
@@ -0,0 +1,62 @@
1
+ import { propsMetaCollapsible as a, propsMetaCollapsibleContent as t, propsMetaCollapsibleTrigger as r } from "./collapsible.ws.js";
2
+ import { propsMetaDialog as s, propsMetaDialogClose as i, propsMetaDialogContent as n, propsMetaDialogDescription as l, propsMetaDialogOverlay as M, propsMetaDialogTitle as g, propsMetaDialogTrigger as c } from "./dialog.ws.js";
3
+ import { propsMetaPopover as C, propsMetaPopoverContent as m, propsMetaPopoverTrigger as d } from "./popover.ws.js";
4
+ import { propsMetaTooltip as v, propsMetaTooltipContent as b, propsMetaTooltipTrigger as S } from "./tooltip.ws.js";
5
+ import { propsMetaTabs as I, propsMetaTabsContent as D, propsMetaTabsList as N, propsMetaTabsTrigger as f } from "./tabs.ws.js";
6
+ import { propsMeta as A } from "./label.ws.js";
7
+ import { propsMetaAccordion as L, propsMetaAccordionContent as k, propsMetaAccordionHeader as G, propsMetaAccordionItem as P, propsMetaAccordionTrigger as R } from "./accordion.ws.js";
8
+ import { propsMetaNavigationMenu as y, propsMetaNavigationMenuContent as H, propsMetaNavigationMenuItem as O, propsMetaNavigationMenuLink as j, propsMetaNavigationMenuList as q, propsMetaNavigationMenuTrigger as z, propsMetaNavigationMenuViewport as B } from "./navigation-menu.ws.js";
9
+ import { propsMetaSelect as F, propsMetaSelectContent as J, propsMetaSelectItem as K, propsMetaSelectItemIndicator as Q, propsMetaSelectItemText as U, propsMetaSelectTrigger as W, propsMetaSelectValue as X, propsMetaSelectViewport as Y } from "./select.ws.js";
10
+ import { propsMetaSwitch as _, propsMetaSwitchThumb as $ } from "./switch.ws.js";
11
+ import { propsMetaCheckbox as eo, propsMetaCheckboxIndicator as ao } from "./checkbox.ws.js";
12
+ import { propsMetaRadioGroup as ro, propsMetaRadioGroupIndicator as po, propsMetaRadioGroupItem as so } from "./radio-group.ws.js";
13
+ export {
14
+ L as Accordion,
15
+ k as AccordionContent,
16
+ G as AccordionHeader,
17
+ P as AccordionItem,
18
+ R as AccordionTrigger,
19
+ eo as Checkbox,
20
+ ao as CheckboxIndicator,
21
+ a as Collapsible,
22
+ t as CollapsibleContent,
23
+ r as CollapsibleTrigger,
24
+ s as Dialog,
25
+ i as DialogClose,
26
+ n as DialogContent,
27
+ l as DialogDescription,
28
+ M as DialogOverlay,
29
+ g as DialogTitle,
30
+ c as DialogTrigger,
31
+ A as Label,
32
+ y as NavigationMenu,
33
+ H as NavigationMenuContent,
34
+ O as NavigationMenuItem,
35
+ j as NavigationMenuLink,
36
+ q as NavigationMenuList,
37
+ z as NavigationMenuTrigger,
38
+ B as NavigationMenuViewport,
39
+ C as Popover,
40
+ m as PopoverContent,
41
+ d as PopoverTrigger,
42
+ ro as RadioGroup,
43
+ po as RadioGroupIndicator,
44
+ so as RadioGroupItem,
45
+ F as Select,
46
+ J as SelectContent,
47
+ K as SelectItem,
48
+ Q as SelectItemIndicator,
49
+ U as SelectItemText,
50
+ W as SelectTrigger,
51
+ X as SelectValue,
52
+ Y as SelectViewport,
53
+ _ as Switch,
54
+ $ as SwitchThumb,
55
+ I as Tabs,
56
+ D as TabsContent,
57
+ N as TabsList,
58
+ f as TabsTrigger,
59
+ v as Tooltip,
60
+ b as TooltipContent,
61
+ S as TooltipTrigger
62
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { Root as d, Item as p, Indicator as e } from "@radix-ui/react-radio-group";
4
+ const u = m(({ value: o, defaultValue: r, ...t }, a) => /* @__PURE__ */ i(d, { ...t, defaultValue: o ?? r, ref: a })), R = p, s = e;
5
+ export {
6
+ u as RadioGroup,
7
+ s as RadioGroupIndicator,
8
+ R as RadioGroupItem
9
+ };
@@ -0,0 +1,66 @@
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
+ import { css as t, $ as a, PlaceholderValue as n } from "@webstudio-is/template";
3
+ import { DotIcon as m } from "@webstudio-is/icons/svg";
4
+ import { radix as e } from "./shared/proxy.js";
5
+ import { spacing as d, height as p, width as b, borderRadius as h, borderWidth as u, colors as i, boxShadow as f, opacity as w } from "./shared/theme.js";
6
+ const r = ({
7
+ value: c,
8
+ label: s
9
+ }) => /* @__PURE__ */ l(
10
+ e.Label,
11
+ {
12
+ "ws:style": t`
13
+ display: flex;
14
+ align-items: center;
15
+ gap: ${d[2]};
16
+ `,
17
+ children: [
18
+ /* @__PURE__ */ o(
19
+ e.RadioGroupItem,
20
+ {
21
+ value: c,
22
+ "ws:style": t`
23
+ aspect-ratio: 1 / 1;
24
+ height: ${p[4]};
25
+ width: ${b[4]};
26
+ border-radius: ${h.full};
27
+ border: ${u.DEFAULT} solid ${i.primary};
28
+ color: ${i.primary};
29
+ &:focus-visible {
30
+ outline: none;
31
+ box-shadow: ${f.ring};
32
+ }
33
+ &:disabled {
34
+ cursor: not-allowed;
35
+ opacity: ${w[50]};
36
+ }
37
+ `,
38
+ children: /* @__PURE__ */ o(e.RadioGroupIndicator, { children: /* @__PURE__ */ o(a.HtmlEmbed, { "ws:label": "Indicator Icon", code: m }) })
39
+ }
40
+ ),
41
+ /* @__PURE__ */ o(a.Text, { children: new n(s) })
42
+ ]
43
+ }
44
+ ), R = {
45
+ category: "radix",
46
+ order: 100,
47
+ description: "A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
48
+ template: /* @__PURE__ */ l(
49
+ e.RadioGroup,
50
+ {
51
+ "ws:style": t`
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: ${d[2]};
55
+ `,
56
+ children: [
57
+ r({ value: "default", label: "Default" }),
58
+ r({ value: "comfortable", label: "Comfortable" }),
59
+ r({ value: "compact", label: "Compact" })
60
+ ]
61
+ }
62
+ )
63
+ };
64
+ export {
65
+ R as meta
66
+ };
@@ -0,0 +1,73 @@
1
+ import { RadioGroupIcon as t, ItemIcon as e, TriggerIcon as a } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as o } from "@webstudio-is/sdk";
3
+ import { div as r, button as n, span as p } from "@webstudio-is/sdk/normalize.css";
4
+ import { buttonReset as s } from "./shared/preset-styles.js";
5
+ import { propsRadioGroup as i, propsRadioGroupItem as c, propsRadioGroupIndicator as d } from "./__generated__/radio-group.props.js";
6
+ const I = {
7
+ type: "container",
8
+ constraints: {
9
+ relation: "descendant",
10
+ component: { $eq: "RadioGroupItem" }
11
+ },
12
+ icon: t,
13
+ states: [
14
+ ...o,
15
+ {
16
+ label: "Checked",
17
+ selector: "[data-state=checked]",
18
+ category: "component-states"
19
+ },
20
+ {
21
+ label: "Unchecked",
22
+ selector: "[data-state=unchecked]",
23
+ category: "component-states"
24
+ }
25
+ ],
26
+ presetStyle: {
27
+ div: r
28
+ }
29
+ }, y = {
30
+ type: "container",
31
+ constraints: [
32
+ {
33
+ relation: "ancestor",
34
+ component: { $eq: "RadioGroup" }
35
+ },
36
+ {
37
+ relation: "descendant",
38
+ component: { $eq: "RadioGroupIndicator" }
39
+ }
40
+ ],
41
+ icon: e,
42
+ states: o,
43
+ presetStyle: {
44
+ button: [n, s].flat()
45
+ }
46
+ }, f = {
47
+ type: "container",
48
+ icon: a,
49
+ constraints: {
50
+ relation: "ancestor",
51
+ component: { $eq: "RadioGroupItem" }
52
+ },
53
+ states: o,
54
+ presetStyle: {
55
+ span: p
56
+ }
57
+ }, b = {
58
+ props: i,
59
+ initialProps: ["id", "className", "name", "value", "required"]
60
+ }, q = {
61
+ props: c,
62
+ initialProps: ["value"]
63
+ }, g = {
64
+ props: d
65
+ };
66
+ export {
67
+ I as metaRadioGroup,
68
+ f as metaRadioGroupIndicator,
69
+ y as metaRadioGroupItem,
70
+ b as propsMetaRadioGroup,
71
+ g as propsMetaRadioGroupIndicator,
72
+ q as propsMetaRadioGroupItem
73
+ };
package/lib/select.js ADDED
@@ -0,0 +1,46 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as s, useContext as l } from "react";
3
+ import { Root as m, Trigger as p, Value as f, Portal as S, Content as d, Viewport as u, Item as I, ItemIndicator as P, ItemText as g } from "@radix-ui/react-select";
4
+ import { ReactSdkContext as x, getClosestInstance as i } from "@webstudio-is/react-sdk/runtime";
5
+ const v = s(
6
+ ({ value: e, defaultValue: t, ...o }, n) => /* @__PURE__ */ c(m, { ...o, defaultValue: e ?? t })
7
+ ), T = s((e, t) => {
8
+ const { renderer: o } = l(x);
9
+ return /* @__PURE__ */ c(p, { onPointerDown: o === "canvas" ? (a) => {
10
+ a.preventDefault();
11
+ } : void 0, ref: t, ...e });
12
+ }), $ = s((e, t) => /* @__PURE__ */ c(f, { ref: t, ...e })), k = s((e, t) => /* @__PURE__ */ c(S, { children: /* @__PURE__ */ c(d, { ref: t, ...e, position: "popper" }) })), D = u, R = I, y = P, M = g, r = "@webstudio-is/sdk-components-react-radix", N = {
13
+ onNavigatorUnselect: (e, t) => {
14
+ for (const o of t.instancePath)
15
+ if (o.component === `${r}:SelectContent`) {
16
+ const n = i(
17
+ t.instancePath,
18
+ o,
19
+ `${r}:Select`
20
+ );
21
+ n && e.setMemoryProp(n, "open", void 0);
22
+ }
23
+ },
24
+ onNavigatorSelect: (e, t) => {
25
+ for (const o of t.instancePath)
26
+ if (o.component === `${r}:SelectContent`) {
27
+ const n = i(
28
+ t.instancePath,
29
+ o,
30
+ `${r}:Select`
31
+ );
32
+ n && e.setMemoryProp(n, "open", !0);
33
+ }
34
+ }
35
+ };
36
+ export {
37
+ v as Select,
38
+ k as SelectContent,
39
+ R as SelectItem,
40
+ y as SelectItemIndicator,
41
+ M as SelectItemText,
42
+ T as SelectTrigger,
43
+ $ as SelectValue,
44
+ D as SelectViewport,
45
+ N as hooksSelect
46
+ };
@@ -0,0 +1,121 @@
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import { css as i, $ as f, PlaceholderValue as w } from "@webstudio-is/template";
3
+ import { radix as o } from "./shared/proxy.js";
4
+ import { height as h, width as d, borderRadius as s, borderWidth as c, colors as e, spacing as t, fontSize as m, fontSizeLineHeight as $, boxShadow as a, opacity as g, zIndex as b } from "./shared/theme.js";
5
+ import { CheckMarkIcon as y } from "@webstudio-is/icons/svg";
6
+ const l = (u, p) => /* @__PURE__ */ n(
7
+ o.SelectItem,
8
+ {
9
+ value: u,
10
+ "ws:style": i`
11
+ position: relative;
12
+ display: flex;
13
+ width: ${d.full};
14
+ cursor: default;
15
+ user-select: none;
16
+ align-items: center;
17
+ border-radius: ${s.md};
18
+ padding: ${t[1.5]} ${t[2]} ${t[1.5]} ${t[8]};
19
+ font-size: ${m.sm};
20
+ line-height: ${$.sm};
21
+ outline: none;
22
+ &:focus {
23
+ background-color: ${e.accent};
24
+ color: ${e.accentForeground};
25
+ }
26
+ &[data-disabled] {
27
+ pointer-events: none;
28
+ opacity: ${g[50]};
29
+ }
30
+ `,
31
+ children: [
32
+ /* @__PURE__ */ r(
33
+ o.SelectItemIndicator,
34
+ {
35
+ "ws:style": i`
36
+ position: absolute;
37
+ left: ${t[2]};
38
+ display: flex;
39
+ height: ${h[3.5]};
40
+ width: ${d[3.5]};
41
+ align-items: center;
42
+ justify-content: center;
43
+ `,
44
+ children: /* @__PURE__ */ r(f.HtmlEmbed, { "ws:label": "Indicator Icon", code: y })
45
+ }
46
+ ),
47
+ /* @__PURE__ */ r(o.SelectItemText, { children: new w(p) })
48
+ ]
49
+ }
50
+ ), z = {
51
+ category: "radix",
52
+ description: "Use within a form to give your users a list of options to choose from.",
53
+ order: 10,
54
+ template: /* @__PURE__ */ n(o.Select, { children: [
55
+ /* @__PURE__ */ r(
56
+ o.SelectTrigger,
57
+ {
58
+ "ws:style": i`
59
+ display: flex;
60
+ height: ${h[10]};
61
+ width: ${d.full};
62
+ align-items: center;
63
+ justify-content: between;
64
+ border-radius: ${s.md};
65
+ border: ${c.DEFAULT} solid ${e.input};
66
+ background-color: ${e.background};
67
+ padding: ${t[2]} ${t[3]};
68
+ font-size: ${m.sm};
69
+ line-height: ${$.sm};
70
+ &::placeholder {
71
+ color: ${e.mutedForeground};
72
+ }
73
+ &:focus-visible {
74
+ outline: none;
75
+ box-shadow: ${a.ring};
76
+ }
77
+ &:disabled {
78
+ cursor: not-allowed;
79
+ opacity: ${g[50]};
80
+ }
81
+ `,
82
+ children: /* @__PURE__ */ r(o.SelectValue, { placeholder: "Theme" })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ r(
86
+ o.SelectContent,
87
+ {
88
+ "ws:style": i`
89
+ position: relative;
90
+ z-index: ${b[50]};
91
+ min-width: 8rem;
92
+ overflow: hidden;
93
+ border-radius: ${s.md};
94
+ border: ${c.DEFAULT} solid ${e.border};
95
+ background-color: ${e.popover};
96
+ color: ${e.popoverForeground};
97
+ box-shadow: ${a.md};
98
+ `,
99
+ children: /* @__PURE__ */ n(
100
+ o.SelectViewport,
101
+ {
102
+ "ws:style": i`
103
+ padding: ${t[1]};
104
+ height: var(--radix-select-trigger-height);
105
+ width: ${d.full};
106
+ min-width: var(--radix-select-trigger-width);
107
+ `,
108
+ children: [
109
+ l("light", "Light"),
110
+ l("dark", "Dark"),
111
+ l("system", "System")
112
+ ]
113
+ }
114
+ )
115
+ }
116
+ )
117
+ ] })
118
+ };
119
+ export {
120
+ z as meta
121
+ };