@webstudio-is/sdk-components-react-radix 0.0.0-5844e28 → 0.0.0-73cd6ea

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 (75) hide show
  1. package/lib/__generated__/accordion.props.js +15 -2582
  2. package/lib/__generated__/checkbox.props.js +5 -1071
  3. package/lib/__generated__/collapsible.props.js +7 -1012
  4. package/lib/__generated__/dialog.props.js +10 -2585
  5. package/lib/__generated__/label.props.js +2 -517
  6. package/lib/__generated__/navigation-menu.props.js +13 -3625
  7. package/lib/__generated__/popover.props.js +7 -509
  8. package/lib/__generated__/radio-group.props.js +19 -1568
  9. package/lib/__generated__/select.props.js +42 -3615
  10. package/lib/__generated__/switch.props.js +5 -1071
  11. package/lib/__generated__/tabs.props.js +17 -2073
  12. package/lib/__generated__/tooltip.props.js +6 -503
  13. package/lib/accordion.js +33 -20
  14. package/lib/accordion.template.js +14 -14
  15. package/lib/accordion.ws.js +56 -93
  16. package/lib/checkbox.js +17 -6
  17. package/lib/checkbox.template.js +10 -10
  18. package/lib/checkbox.ws.js +26 -41
  19. package/lib/collapsible.js +29 -26
  20. package/lib/collapsible.ws.js +28 -48
  21. package/lib/components.js +46 -45
  22. package/lib/dialog.js +50 -56
  23. package/lib/dialog.template.js +19 -19
  24. package/lib/dialog.ws.js +68 -126
  25. package/lib/label.template.js +3 -3
  26. package/lib/label.ws.js +8 -15
  27. package/lib/metas.js +45 -44
  28. package/lib/navigation-menu.js +21 -20
  29. package/lib/navigation-menu.template.js +8 -8
  30. package/lib/navigation-menu.ws.js +71 -102
  31. package/lib/popover.js +36 -32
  32. package/lib/popover.template.js +50 -20
  33. package/lib/popover.ws.js +45 -44
  34. package/lib/radio-group.js +10 -7
  35. package/lib/radio-group.ws.js +37 -61
  36. package/lib/select.js +49 -37
  37. package/lib/select.ws.js +71 -137
  38. package/lib/shared/meta.js +13 -0
  39. package/lib/shared/preset-styles.js +29 -29
  40. package/lib/shared/theme.js +25 -68
  41. package/lib/sheet.template.js +32 -32
  42. package/lib/switch.js +9 -6
  43. package/lib/switch.template.js +9 -9
  44. package/lib/switch.ws.js +29 -52
  45. package/lib/tabs.js +50 -53
  46. package/lib/tabs.template.js +16 -16
  47. package/lib/tabs.ws.js +41 -76
  48. package/lib/tooltip.js +34 -31
  49. package/lib/tooltip.ws.js +27 -42
  50. package/lib/types/__generated__/popover.props.d.ts +1 -0
  51. package/lib/types/accordion.ws.d.ts +1 -6
  52. package/lib/types/checkbox.ws.d.ts +1 -3
  53. package/lib/types/collapsible.d.ts +2 -2
  54. package/lib/types/collapsible.ws.d.ts +1 -4
  55. package/lib/types/components.d.ts +1 -1
  56. package/lib/types/dialog.ws.d.ts +1 -8
  57. package/lib/types/label.ws.d.ts +1 -2
  58. package/lib/types/metas.d.ts +1 -1
  59. package/lib/types/navigation-menu.ws.d.ts +1 -8
  60. package/lib/types/popover.d.ts +1 -0
  61. package/lib/types/popover.ws.d.ts +2 -4
  62. package/lib/types/radio-group.d.ts +1 -1
  63. package/lib/types/radio-group.ws.d.ts +1 -4
  64. package/lib/types/select.d.ts +3 -3
  65. package/lib/types/select.ws.d.ts +1 -9
  66. package/lib/types/shared/meta.d.ts +1 -0
  67. package/lib/types/shared/preset-styles.d.ts +2 -2
  68. package/lib/types/shared/proxy.d.ts +1 -0
  69. package/lib/types/switch.ws.d.ts +1 -3
  70. package/lib/types/tabs.d.ts +1 -4
  71. package/lib/types/tabs.ws.d.ts +1 -5
  72. package/lib/types/tooltip.ws.d.ts +1 -4
  73. package/package.json +21 -27
  74. package/lib/props.js +0 -62
  75. package/lib/types/props.d.ts +0 -12
package/lib/metas.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import { metaCollapsible as t, metaCollapsibleContent as o, metaCollapsibleTrigger as i } from "./collapsible.ws.js";
2
2
  import { metaDialog as n, metaDialogClose as m, metaDialogContent as s, metaDialogDescription as l, metaDialogOverlay as g, metaDialogTitle as c, metaDialogTrigger as p } from "./dialog.ws.js";
3
- import { metaPopover as C, metaPopoverContent as d, metaPopoverTrigger as u } from "./popover.ws.js";
4
- import { metaTooltip as b, metaTooltipContent as S, metaTooltipTrigger as x } from "./tooltip.ws.js";
5
- import { metaTabs as D, metaTabsContent as M, metaTabsList as N, metaTabsTrigger as f } from "./tabs.ws.js";
6
- import { meta as A } from "./label.ws.js";
7
- import { metaAccordion as L, metaAccordionContent as k, metaAccordionHeader as G, metaAccordionItem as P, metaAccordionTrigger as R } from "./accordion.ws.js";
8
- import { metaNavigationMenu as y, metaNavigationMenuContent as H, metaNavigationMenuItem as O, metaNavigationMenuLink as j, metaNavigationMenuList as q, metaNavigationMenuTrigger as z, metaNavigationMenuViewport as B } from "./navigation-menu.ws.js";
9
- import { metaSelect as F, metaSelectContent as J, metaSelectItem as K, metaSelectItemIndicator as Q, metaSelectItemText as U, metaSelectTrigger as W, metaSelectValue as X, metaSelectViewport as Y } from "./select.ws.js";
10
- import { metaSwitch as _, metaSwitchThumb as $ } from "./switch.ws.js";
11
- import { metaCheckbox as ae, metaCheckboxIndicator as te } from "./checkbox.ws.js";
12
- import { metaRadioGroup as ie, metaRadioGroupIndicator as re, metaRadioGroupItem as ne } from "./radio-group.ws.js";
3
+ import { metaPopover as C, metaPopoverClose as d, metaPopoverContent as u, metaPopoverTrigger as v } from "./popover.ws.js";
4
+ import { metaTooltip as S, metaTooltipContent as x, metaTooltipTrigger as I } from "./tooltip.ws.js";
5
+ import { metaTabs as M, metaTabsContent as N, metaTabsList as f, metaTabsTrigger as h } from "./tabs.ws.js";
6
+ import { meta as w } from "./label.ws.js";
7
+ import { metaAccordion as L, metaAccordionContent as k, metaAccordionHeader as G, metaAccordionItem as R, metaAccordionTrigger as V } from "./accordion.ws.js";
8
+ import { metaNavigationMenu as H, metaNavigationMenuContent as O, metaNavigationMenuItem as j, metaNavigationMenuLink as q, metaNavigationMenuList as z, metaNavigationMenuTrigger as B, metaNavigationMenuViewport as E } from "./navigation-menu.ws.js";
9
+ import { metaSelect as J, metaSelectContent as K, metaSelectItem as Q, metaSelectItemIndicator as U, metaSelectItemText as W, metaSelectTrigger as X, metaSelectValue as Y, metaSelectViewport as Z } from "./select.ws.js";
10
+ import { metaSwitch as $, metaSwitchThumb as ee } from "./switch.ws.js";
11
+ import { metaCheckbox as te, metaCheckboxIndicator as oe } from "./checkbox.ws.js";
12
+ import { metaRadioGroup as re, metaRadioGroupIndicator as ne, metaRadioGroupItem as me } from "./radio-group.ws.js";
13
13
  export {
14
14
  L as Accordion,
15
15
  k as AccordionContent,
16
16
  G as AccordionHeader,
17
- P as AccordionItem,
18
- R as AccordionTrigger,
19
- ae as Checkbox,
20
- te as CheckboxIndicator,
17
+ R as AccordionItem,
18
+ V as AccordionTrigger,
19
+ te as Checkbox,
20
+ oe as CheckboxIndicator,
21
21
  t as Collapsible,
22
22
  o as CollapsibleContent,
23
23
  i as CollapsibleTrigger,
@@ -28,35 +28,36 @@ export {
28
28
  g as DialogOverlay,
29
29
  c as DialogTitle,
30
30
  p 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,
31
+ w as Label,
32
+ H as NavigationMenu,
33
+ O as NavigationMenuContent,
34
+ j as NavigationMenuItem,
35
+ q as NavigationMenuLink,
36
+ z as NavigationMenuList,
37
+ B as NavigationMenuTrigger,
38
+ E as NavigationMenuViewport,
39
39
  C as Popover,
40
- d as PopoverContent,
41
- u as PopoverTrigger,
42
- ie as RadioGroup,
43
- re as RadioGroupIndicator,
44
- ne 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
- D as Tabs,
56
- M as TabsContent,
57
- N as TabsList,
58
- f as TabsTrigger,
59
- b as Tooltip,
60
- S as TooltipContent,
61
- x as TooltipTrigger
40
+ d as PopoverClose,
41
+ u as PopoverContent,
42
+ v as PopoverTrigger,
43
+ re as RadioGroup,
44
+ ne as RadioGroupIndicator,
45
+ me as RadioGroupItem,
46
+ J as Select,
47
+ K as SelectContent,
48
+ Q as SelectItem,
49
+ U as SelectItemIndicator,
50
+ W as SelectItemText,
51
+ X as SelectTrigger,
52
+ Y as SelectValue,
53
+ Z as SelectViewport,
54
+ $ as Switch,
55
+ ee as SwitchThumb,
56
+ M as Tabs,
57
+ N as TabsContent,
58
+ f as TabsList,
59
+ h as TabsTrigger,
60
+ S as Tooltip,
61
+ x as TooltipContent,
62
+ I as TooltipTrigger
62
63
  };
@@ -1,21 +1,22 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as c, useContext as v, Children as g } from "react";
2
3
  import * as a from "@radix-ui/react-navigation-menu";
3
- import { ReactSdkContext as v, getIndexWithinAncestorFromComponentProps as l, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
4
- import { forwardRef as c, useContext as f, Children as m } from "react";
5
- const p = c(({ value: o, ...n }, e) => {
6
- const { renderer: t } = f(v);
4
+ import { getIndexWithinAncestorFromProps as l } from "@webstudio-is/sdk/runtime";
5
+ import { ReactSdkContext as f, getClosestInstance as d } from "@webstudio-is/react-sdk/runtime";
6
+ const C = c(({ value: o, ...n }, e) => {
7
+ const { renderer: t } = v(f);
7
8
  let i = o;
8
9
  return t === "canvas" && (i = i === "" ? "-1" : i), /* @__PURE__ */ r(a.Root, { ref: e, value: i, ...n });
9
- }), C = a.List, P = a.Viewport, k = a.Content, x = c(({ value: o, ...n }, e) => {
10
+ }), P = a.List, k = a.Viewport, x = a.Content, A = c(({ value: o, ...n }, e) => {
10
11
  const t = l(n);
11
12
  return /* @__PURE__ */ r(a.Item, { ref: e, value: o ?? t, ...n });
12
- }), A = c(({ children: o, ...n }, e) => {
13
- const t = m.toArray(o)[0];
14
- return /* @__PURE__ */ r(a.Link, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("a", { children: "Add link component" }) });
15
13
  }), I = c(({ children: o, ...n }, e) => {
16
- const t = m.toArray(o)[0];
14
+ const t = g.toArray(o)[0];
15
+ return /* @__PURE__ */ r(a.Link, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("a", { children: "Add link component" }) });
16
+ }), $ = c(({ children: o, ...n }, e) => {
17
+ const t = g.toArray(o)[0];
17
18
  return /* @__PURE__ */ r(a.Trigger, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
18
- }), s = "@webstudio-is/sdk-components-react-radix", $ = {
19
+ }), s = "@webstudio-is/sdk-components-react-radix", w = {
19
20
  onNavigatorUnselect: (o, n) => {
20
21
  for (const e of n.instancePath)
21
22
  if (e.component === `${s}:NavigationMenuContent`) {
@@ -42,18 +43,18 @@ const p = c(({ value: o, ...n }, e) => {
42
43
  );
43
44
  if (u === void 0 || i === void 0)
44
45
  return;
45
- const g = o.getPropValue(u, "value") ?? ((e = o.indexesWithinAncestors.get(u.id)) == null ? void 0 : e.toString());
46
- g && o.setMemoryProp(i, "value", g);
46
+ const m = o.getPropValue(u, "value") ?? ((e = o.indexesWithinAncestors.get(u.id)) == null ? void 0 : e.toString());
47
+ m && o.setMemoryProp(i, "value", m);
47
48
  }
48
49
  }
49
50
  };
50
51
  export {
51
- p as NavigationMenu,
52
- k as NavigationMenuContent,
53
- x as NavigationMenuItem,
54
- A as NavigationMenuLink,
55
- C as NavigationMenuList,
56
- I as NavigationMenuTrigger,
57
- P as NavigationMenuViewport,
58
- $ as hooksNavigationMenu
52
+ C as NavigationMenu,
53
+ x as NavigationMenuContent,
54
+ A as NavigationMenuItem,
55
+ I as NavigationMenuLink,
56
+ P as NavigationMenuList,
57
+ $ as NavigationMenuTrigger,
58
+ k as NavigationMenuViewport,
59
+ w as hooksNavigationMenu
59
60
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import { ChevronDownIcon as w } from "@webstudio-is/icons/svg";
3
- import { $ as n, css as t, PlaceholderValue as l } from "@webstudio-is/template";
3
+ import { css as t, $ as n, PlaceholderValue as l } from "@webstudio-is/template";
4
4
  import { radix as r } from "./shared/proxy.js";
5
5
  import { getButtonStyle as u } from "./shared/styles.js";
6
- import { spacing as i, colors as a, width as h, borderRadius as p, borderWidth as v, boxShadow as b, height as y, transition as x, lineHeight as c, fontSize as m, weights as $ } from "./shared/theme.js";
6
+ import { spacing as i, borderRadius as h, borderWidth as v, colors as a, boxShadow as b, height as y, width as p, transition as x, fontSize as m, weights as $, lineHeight as c } from "./shared/theme.js";
7
7
  const k = [
8
8
  {
9
9
  title: "Sheet",
@@ -60,7 +60,7 @@ const k = [
60
60
  flex-direction: column;
61
61
  user-select: none;
62
62
  gap: ${i[1]};
63
- border-radius: ${p.md};
63
+ border-radius: ${h.md};
64
64
  padding: ${i[3]};
65
65
  line-height: ${c.none};
66
66
  text-decoration-line: none;
@@ -106,7 +106,7 @@ const k = [
106
106
  {
107
107
  "ws:label": "Flex Column",
108
108
  "ws:style": t`
109
- width: ${h[64]};
109
+ width: ${p[64]};
110
110
  display: flex;
111
111
  gap: ${i[4]};
112
112
  flex-direction: column;
@@ -129,8 +129,8 @@ const k = [
129
129
  "ws:style": t`
130
130
  background-color: ${a.border};
131
131
  padding: ${i[4]};
132
- width: ${h[48]};
133
- border-radius: ${p.md};
132
+ width: ${p[48]};
133
+ border-radius: ${h.md};
134
134
  `,
135
135
  children: new l("")
136
136
  }
@@ -174,7 +174,7 @@ const k = [
174
174
  margin-left: ${i[1]};
175
175
  rotate: var(--navigation-menu-trigger-icon-transform);
176
176
  height: ${y[4]};
177
- width: ${h[4]};
177
+ width: ${p[4]};
178
178
  flex-shrink: 0;
179
179
  transition: ${x.all};
180
180
  transition-duration: 200ms;
@@ -262,7 +262,7 @@ const k = [
262
262
  position: relative;
263
263
  margin-top: ${i[1.5]};
264
264
  overflow: hidden;
265
- border-radius: ${p.md};
265
+ border-radius: ${h.md};
266
266
  border: ${v.DEFAULT} solid ${a.border};
267
267
  background-color: ${a.popover};
268
268
  color: ${a.popoverForeground};
@@ -1,124 +1,93 @@
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",
1
+ import { NavigationMenuIcon as t, ListIcon as o, ListItemIcon as i, TriggerIcon as a, ContentIcon as r, BoxIcon as c, ViewportIcon as s } from "@webstudio-is/icons/svg";
2
+ import { div as e } from "@webstudio-is/sdk/normalize.css";
3
+ import { radix as n } from "./shared/meta.js";
4
+ import { propsNavigationMenu as p, propsNavigationMenuList as g, propsNavigationMenuItem as M, propsNavigationMenuTrigger as l, propsNavigationMenuContent as u, propsNavigationMenuLink as d, propsNavigationMenuViewport as v } from "./__generated__/navigation-menu.props.js";
5
+ const L = {
6
6
  icon: t,
7
- presetStyle: {
8
- div: n
7
+ contentModel: {
8
+ category: "instance",
9
+ children: ["instance"],
10
+ descendants: [n.NavigationMenuList, n.NavigationMenuViewport]
9
11
  },
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
12
  presetStyle: {
34
- div: n
13
+ div: e
35
14
  },
36
- label: "Menu List"
37
- }, $ = {
38
- type: "container",
15
+ props: p
16
+ }, h = {
39
17
  icon: o,
40
- constraints: {
41
- relation: "ancestor",
42
- component: { $eq: "NavigationMenuList" }
18
+ label: "Menu List",
19
+ contentModel: {
20
+ category: "none",
21
+ children: ["instance"],
22
+ descendants: [n.NavigationMenuItem]
43
23
  },
44
24
  presetStyle: {
45
- div: n
25
+ div: e
46
26
  },
47
- indexWithinAncestor: "NavigationMenu",
48
- label: "Menu Item"
49
- }, d = {
50
- type: "container",
27
+ props: g
28
+ }, b = {
51
29
  icon: i,
52
- constraints: {
53
- relation: "ancestor",
54
- component: { $eq: "NavigationMenuItem" }
30
+ label: "Menu Item",
31
+ indexWithinAncestor: n.NavigationMenu,
32
+ contentModel: {
33
+ category: "none",
34
+ children: ["instance"],
35
+ descendants: [
36
+ n.NavigationMenuTrigger,
37
+ n.NavigationMenuContent,
38
+ n.NavigationMenuLink
39
+ ]
55
40
  },
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
41
  presetStyle: {
66
- div: n
42
+ div: e
67
43
  },
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"
44
+ props: M
45
+ }, k = {
46
+ icon: a,
47
+ label: "Menu Trigger",
48
+ contentModel: {
49
+ category: "none",
50
+ children: ["instance"]
51
+ },
52
+ props: l
83
53
  }, w = {
84
- type: "container",
85
- icon: p,
86
- constraints: {
87
- relation: "ancestor",
88
- component: { $eq: "NavigationMenu" }
54
+ icon: r,
55
+ label: "Menu Content",
56
+ contentModel: {
57
+ category: "none",
58
+ children: ["instance"],
59
+ descendants: [n.NavigationMenuLink]
89
60
  },
90
61
  presetStyle: {
91
- div: n
62
+ div: e
92
63
  },
93
- label: "Menu Viewport"
64
+ props: u
94
65
  }, C = {
95
- props: s
96
- }, V = {
97
- props: c
66
+ icon: c,
67
+ label: "Accessible Link Wrapper",
68
+ contentModel: {
69
+ category: "none",
70
+ children: ["instance"]
71
+ },
72
+ props: d
98
73
  }, S = {
99
- props: M
100
- }, T = {
101
- props: g
102
- }, k = {
103
- props: u
104
- }, x = {
74
+ icon: s,
75
+ label: "Menu Viewport",
76
+ contentModel: {
77
+ category: "none",
78
+ children: ["instance"]
79
+ },
80
+ presetStyle: {
81
+ div: e
82
+ },
105
83
  props: v
106
- }, f = {
107
- props: N
108
84
  };
109
85
  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
86
+ L as metaNavigationMenu,
87
+ w as metaNavigationMenuContent,
88
+ b as metaNavigationMenuItem,
89
+ C as metaNavigationMenuLink,
90
+ h as metaNavigationMenuList,
91
+ k as metaNavigationMenuTrigger,
92
+ S as metaNavigationMenuViewport
124
93
  };
package/lib/popover.js CHANGED
@@ -1,48 +1,52 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as c, Children as P } from "react";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as p, useState as f, useEffect as P, Children as l } from "react";
3
3
  import * as s from "@radix-ui/react-popover";
4
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(
5
+ const h = p((t, n) => {
6
+ const o = t.open ?? !1, [e, i] = f(o);
7
+ return P(() => i(o), [o]), /* @__PURE__ */ r(s.Root, { ...t, open: e, onOpenChange: i });
8
+ }), u = p(({ children: t, ...n }, o) => {
9
+ const e = l.toArray(t)[0];
10
+ return /* @__PURE__ */ r(s.Trigger, { asChild: !0, ref: o, ...n, children: e ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
11
+ }), C = p(
12
+ ({ sideOffset: t = 4, align: n = "center", hideWhenDetached: o = !0, ...e }, i) => /* @__PURE__ */ r(s.Portal, { children: /* @__PURE__ */ r(
10
13
  s.Content,
11
14
  {
12
- ref: p,
15
+ ref: i,
13
16
  align: "center",
14
- sideOffset: o,
15
- hideWhenDetached: e,
16
- ...r
17
+ sideOffset: t,
18
+ hideWhenDetached: o,
19
+ ...e
17
20
  }
18
21
  ) })
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`
22
+ ), g = s.Close, c = "@webstudio-is/sdk-components-react-radix", $ = {
23
+ onNavigatorUnselect: (t, n) => {
24
+ for (const o of n.instancePath)
25
+ if (o.component === `${c}:PopoverContent`) {
26
+ const e = a(
27
+ n.instancePath,
28
+ o,
29
+ `${c}:Popover`
27
30
  );
28
- r && o.setMemoryProp(r, "open", void 0);
31
+ e && t.setMemoryProp(e, "open", void 0);
29
32
  }
30
33
  },
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`
34
+ onNavigatorSelect: (t, n) => {
35
+ for (const o of n.instancePath)
36
+ if (o.component === `${c}:PopoverContent`) {
37
+ const e = a(
38
+ n.instancePath,
39
+ o,
40
+ `${c}:Popover`
38
41
  );
39
- r && o.setMemoryProp(r, "open", !0);
42
+ e && t.setMemoryProp(e, "open", !0);
40
43
  }
41
44
  }
42
45
  };
43
46
  export {
44
- l as Popover,
45
- h as PopoverContent,
46
- v as PopoverTrigger,
47
- g as hooksPopover
47
+ h as Popover,
48
+ g as PopoverClose,
49
+ C as PopoverContent,
50
+ u as PopoverTrigger,
51
+ $ as hooksPopover
48
52
  };
@@ -1,33 +1,63 @@
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 = {
1
+ import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
+ import { LargeXIcon as p } from "@webstudio-is/icons/svg";
3
+ import { $ as r, PlaceholderValue as d, css as l } from "@webstudio-is/template";
4
+ import { radix as e } from "./shared/proxy.js";
5
+ import { getButtonStyle as h } from "./shared/styles.js";
6
+ import { spacing as t, borderRadius as s, height as a, opacity as m, boxShadow as c, zIndex as b, width as u, borderWidth as g, colors as i } from "./shared/theme.js";
7
+ const P = {
7
8
  category: "radix",
8
9
  description: "Displays rich content in a portal, triggered by a button.",
9
10
  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,
11
+ template: /* @__PURE__ */ n(e.Popover, { children: [
12
+ /* @__PURE__ */ o(e.PopoverTrigger, { children: /* @__PURE__ */ o(r.Button, { "ws:style": h("outline"), children: new d("Button") }) }),
13
+ /* @__PURE__ */ n(
14
+ e.PopoverContent,
14
15
  {
15
- "ws:style": n`
16
- z-index: ${a[50]};
17
- width: ${p[72]};
16
+ "ws:style": l`
17
+ z-index: ${b[50]};
18
+ width: ${u[72]};
18
19
  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};
20
+ border: ${g.DEFAULT} solid ${i.border};
21
+ background-color: ${i.popover};
22
+ padding: ${t[4]};
23
+ color: ${i.popoverForeground};
24
+ box-shadow: ${c.md};
24
25
  outline: none;
25
26
  `,
26
- children: /* @__PURE__ */ o(t.Text, { children: new d("The text you can edit") })
27
+ children: [
28
+ /* @__PURE__ */ o(r.Text, { children: new d("The text you can edit") }),
29
+ /* @__PURE__ */ o(
30
+ e.PopoverClose,
31
+ {
32
+ "ws:label": "Close Button",
33
+ "ws:style": l`
34
+ position: absolute;
35
+ right: ${t[4]};
36
+ top: ${t[4]};
37
+ border-radius: ${s.sm};
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ height: ${a[4]};
42
+ width: ${a[4]};
43
+ border: 0;
44
+ background-color: transparent;
45
+ outline: none;
46
+ &:hover {
47
+ opacity: ${m[100]};
48
+ }
49
+ &:focus-visible {
50
+ box-shadow: ${c.ring};
51
+ }
52
+ `,
53
+ children: /* @__PURE__ */ o(r.HtmlEmbed, { "ws:label": "Close Icon", code: p })
54
+ }
55
+ )
56
+ ]
27
57
  }
28
58
  )
29
59
  ] })
30
60
  };
31
61
  export {
32
- w as meta
62
+ P as meta
33
63
  };