@webstudio-is/sdk-components-react-radix 0.210.0 → 0.213.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/accordion.js CHANGED
@@ -1,36 +1,37 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
2
  import { forwardRef as m } from "react";
3
3
  import { Root as f, Item as g, Header as p, Trigger as A, Content as l } from "@radix-ui/react-accordion";
4
- import { getIndexWithinAncestorFromComponentProps as u, getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
5
- const x = m((n, o) => /* @__PURE__ */ d(f, { ref: o, type: "single", ...n })), $ = m(({ value: n, ...o }, e) => {
6
- const t = u(o);
7
- return /* @__PURE__ */ d(g, { ref: e, value: n ?? t ?? "", ...o });
8
- }), k = p, v = A, w = l, r = "@webstudio-is/sdk-components-react-radix", y = {
9
- onNavigatorSelect: (n, o) => {
4
+ import { getIndexWithinAncestorFromProps as u } from "@webstudio-is/sdk/runtime";
5
+ import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
6
+ const $ = m((t, o) => /* @__PURE__ */ d(f, { ref: o, type: "single", ...t })), k = m(({ value: t, ...o }, e) => {
7
+ const n = u(o);
8
+ return /* @__PURE__ */ d(g, { ref: e, value: t ?? n ?? "", ...o });
9
+ }), v = p, w = A, y = l, c = "@webstudio-is/sdk-components-react-radix", H = {
10
+ onNavigatorSelect: (t, o) => {
10
11
  var e;
11
- for (const t of o.instancePath)
12
- if (t.component === `${r}:AccordionContent`) {
12
+ for (const n of o.instancePath)
13
+ if (n.component === `${c}:AccordionContent`) {
13
14
  const i = a(
14
15
  o.instancePath,
15
- t,
16
- `${r}:Accordion`
17
- ), c = a(
16
+ n,
17
+ `${c}:Accordion`
18
+ ), r = a(
18
19
  o.instancePath,
19
- t,
20
- `${r}:AccordionItem`
20
+ n,
21
+ `${c}:AccordionItem`
21
22
  );
22
- if (i && c) {
23
- const s = n.getPropValue(c, "value") ?? ((e = n.indexesWithinAncestors.get(c.id)) == null ? void 0 : e.toString());
24
- s && n.setMemoryProp(i, "value", s);
23
+ if (i && r) {
24
+ const s = t.getPropValue(r, "value") ?? ((e = t.indexesWithinAncestors.get(r.id)) == null ? void 0 : e.toString());
25
+ s && t.setMemoryProp(i, "value", s);
25
26
  }
26
27
  }
27
28
  }
28
29
  };
29
30
  export {
30
- x as Accordion,
31
- w as AccordionContent,
32
- k as AccordionHeader,
33
- $ as AccordionItem,
34
- v as AccordionTrigger,
35
- y as hooksAccordion
31
+ $ as Accordion,
32
+ y as AccordionContent,
33
+ v as AccordionHeader,
34
+ k as AccordionItem,
35
+ w as AccordionTrigger,
36
+ H as hooksAccordion
36
37
  };
@@ -53,7 +53,7 @@ const y = {
53
53
  )
54
54
  }
55
55
  ),
56
- /* @__PURE__ */ e(t.Text, { "ws:label": "Checkbox Label", tag: "span", children: new l("Checkbox") })
56
+ /* @__PURE__ */ e(t.Text, { "ws:label": "Checkbox Label", "ws:tag": "span", children: new l("Checkbox") })
57
57
  ]
58
58
  }
59
59
  )
@@ -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,7 +1,7 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
2
  import { MenuIcon as s, LargeXIcon as b } from "@webstudio-is/icons/svg";
3
- import { $ as t, css as i, PlaceholderValue as n } from "@webstudio-is/template";
4
- import { radix as o } from "./shared/proxy.js";
3
+ import { $ as o, css as i, PlaceholderValue as n } from "@webstudio-is/template";
4
+ import { radix as t } from "./shared/proxy.js";
5
5
  import { zIndex as d, blur as p, width as u, spacing as l, borderWidth as w, colors as a, boxShadow as c, maxWidth as f, fontSize as g, lineHeight as x, letterSpacing as $, fontSizeLineHeight as y, borderRadius as S, opacity as h, height as m } from "./shared/theme.js";
6
6
  import { getButtonStyle as D } from "./shared/styles.js";
7
7
  const B = {
@@ -9,10 +9,10 @@ const B = {
9
9
  icon: s,
10
10
  description: "Displays content in a menu that slides out from the side of the screen, triggered by a button. Use this component for a typical mobile hamburger menu.",
11
11
  order: 1,
12
- template: /* @__PURE__ */ r(o.Dialog, { "ws:label": "Sheet", children: [
13
- /* @__PURE__ */ e(o.DialogTrigger, { "ws:label": "Sheet Trigger", children: /* @__PURE__ */ e(t.Button, { "ws:style": D("ghost", "icon"), children: /* @__PURE__ */ e(t.HtmlEmbed, { "ws:label": "Hamburger Menu Svg", code: s }) }) }),
12
+ template: /* @__PURE__ */ r(t.Dialog, { "ws:label": "Sheet", children: [
13
+ /* @__PURE__ */ e(t.DialogTrigger, { "ws:label": "Sheet Trigger", children: /* @__PURE__ */ e(o.Button, { "ws:style": D("ghost", "icon"), children: /* @__PURE__ */ e(o.HtmlEmbed, { "ws:label": "Hamburger Menu Svg", code: s }) }) }),
14
14
  /* @__PURE__ */ e(
15
- o.DialogOverlay,
15
+ t.DialogOverlay,
16
16
  {
17
17
  "ws:label": "Sheet Overlay",
18
18
  "ws:style": i`
@@ -27,7 +27,7 @@ const B = {
27
27
  overflow: auto;
28
28
  `,
29
29
  children: /* @__PURE__ */ r(
30
- o.DialogContent,
30
+ t.DialogContent,
31
31
  {
32
32
  "ws:label": "Sheet Content",
33
33
  "ws:style": i`
@@ -47,9 +47,9 @@ const B = {
47
47
  flex-grow: 1;
48
48
  `,
49
49
  children: [
50
- /* @__PURE__ */ r(t.Box, { "ws:label": "Navigation", tag: "nav", role: "navigation", children: [
50
+ /* @__PURE__ */ r(o.Box, { "ws:label": "Navigation", "ws:tag": "nav", children: [
51
51
  /* @__PURE__ */ r(
52
- t.Box,
52
+ o.Box,
53
53
  {
54
54
  "ws:label": "Sheet Header",
55
55
  "ws:style": i`
@@ -59,7 +59,7 @@ const B = {
59
59
  `,
60
60
  children: [
61
61
  /* @__PURE__ */ e(
62
- o.DialogTitle,
62
+ t.DialogTitle,
63
63
  {
64
64
  "ws:label": "Sheet Title",
65
65
  "ws:style": i`
@@ -72,7 +72,7 @@ const B = {
72
72
  }
73
73
  ),
74
74
  /* @__PURE__ */ e(
75
- o.DialogDescription,
75
+ t.DialogDescription,
76
76
  {
77
77
  "ws:label": "Sheet Description",
78
78
  "ws:style": i`
@@ -87,10 +87,10 @@ const B = {
87
87
  ]
88
88
  }
89
89
  ),
90
- /* @__PURE__ */ e(t.Text, { children: new n("The text you can edit") })
90
+ /* @__PURE__ */ e(o.Text, { children: new n("The text you can edit") })
91
91
  ] }),
92
92
  /* @__PURE__ */ e(
93
- o.DialogClose,
93
+ t.DialogClose,
94
94
  {
95
95
  "ws:label": "Close Button",
96
96
  "ws:style": i`
@@ -114,7 +114,7 @@ const B = {
114
114
  box-shadow: ${c.ring};
115
115
  }
116
116
  `,
117
- children: /* @__PURE__ */ e(t.HtmlEmbed, { "ws:label": "Close Icon", code: b })
117
+ children: /* @__PURE__ */ e(o.HtmlEmbed, { "ws:label": "Close Icon", code: b })
118
118
  }
119
119
  )
120
120
  ]
package/lib/tabs.js CHANGED
@@ -1,65 +1,66 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as c, useCallback as m } from "react";
3
- import { Root as f, List as b, Trigger as p, Content as T } from "@radix-ui/react-tabs";
4
- import { getIndexWithinAncestorFromComponentProps as g, getClosestInstance as l } from "@webstudio-is/react-sdk/runtime";
5
- import { useControllableState as d } from "@radix-ui/react-use-controllable-state";
6
- import h from "await-interaction-response";
7
- const S = c(({ defaultValue: e, ...t }, o) => {
8
- const [n, a] = d({
9
- prop: t.value,
2
+ import u from "await-interaction-response";
3
+ import { forwardRef as c, useCallback as f } from "react";
4
+ import { useControllableState as b } from "@radix-ui/react-use-controllable-state";
5
+ import { Root as p, List as T, Trigger as d, Content as h } from "@radix-ui/react-tabs";
6
+ import { getIndexWithinAncestorFromProps as g } from "@webstudio-is/sdk/runtime";
7
+ import { getClosestInstance as l } from "@webstudio-is/react-sdk/runtime";
8
+ const k = c(({ defaultValue: e, ...n }, o) => {
9
+ const [t, a] = b({
10
+ prop: n.value,
10
11
  defaultProp: e,
11
- onChange: t.onValueChange
12
- }), s = m(
13
- async (u) => {
14
- await h(), a(u);
12
+ onChange: n.onValueChange
13
+ }), s = f(
14
+ async (m) => {
15
+ await u(), a(m);
15
16
  },
16
17
  [a]
17
18
  );
18
19
  return /* @__PURE__ */ i(
19
- f,
20
+ p,
20
21
  {
21
22
  ref: o,
22
- ...t,
23
- value: n,
23
+ ...n,
24
+ value: t,
24
25
  onValueChange: s
25
26
  }
26
27
  );
27
- }), k = b, w = c(({ value: e, ...t }, o) => {
28
- const n = g(t);
29
- return /* @__PURE__ */ i(p, { ref: o, value: e ?? n ?? "", ...t });
30
- }), y = c(({ value: e, ...t }, o) => {
31
- const n = g(t);
32
- return /* @__PURE__ */ i(T, { ref: o, value: e ?? n ?? "", ...t });
33
- }), r = "@webstudio-is/sdk-components-react-radix", A = {
34
- onNavigatorSelect: (e, t) => {
28
+ }), w = T, y = c(({ value: e, ...n }, o) => {
29
+ const t = g(n);
30
+ return /* @__PURE__ */ i(d, { ref: o, value: e ?? t ?? "", ...n });
31
+ }), A = c(({ value: e, ...n }, o) => {
32
+ const t = g(n);
33
+ return /* @__PURE__ */ i(h, { ref: o, value: e ?? t ?? "", ...n });
34
+ }), r = "@webstudio-is/sdk-components-react-radix", R = {
35
+ onNavigatorSelect: (e, n) => {
35
36
  var o;
36
- for (const n of t.instancePath)
37
- if (n.component === `${r}:TabsContent` || n.component === `${r}:TabsTrigger`) {
37
+ for (const t of n.instancePath)
38
+ if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
38
39
  const a = l(
39
- t.instancePath,
40
- n,
40
+ n.instancePath,
41
+ t,
41
42
  `${r}:Tabs`
42
- ), s = e.getPropValue(n, "value") ?? ((o = e.indexesWithinAncestors.get(n.id)) == null ? void 0 : o.toString());
43
+ ), s = e.getPropValue(t, "value") ?? ((o = e.indexesWithinAncestors.get(t.id)) == null ? void 0 : o.toString());
43
44
  a && s && e.setMemoryProp(a, "value", s);
44
45
  }
45
46
  },
46
- onNavigatorUnselect: (e, t) => {
47
+ onNavigatorUnselect: (e, n) => {
47
48
  var o;
48
- for (const n of t.instancePath)
49
- if (n.component === `${r}:TabsContent` || n.component === `${r}:TabsTrigger`) {
49
+ for (const t of n.instancePath)
50
+ if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
50
51
  const a = l(
51
- t.instancePath,
52
- n,
52
+ n.instancePath,
53
+ t,
53
54
  `${r}:Tabs`
54
- ), s = e.getPropValue(n, "value") ?? ((o = e.indexesWithinAncestors.get(n.id)) == null ? void 0 : o.toString());
55
+ ), s = e.getPropValue(t, "value") ?? ((o = e.indexesWithinAncestors.get(t.id)) == null ? void 0 : o.toString());
55
56
  a && s && e.setMemoryProp(a, "value", void 0);
56
57
  }
57
58
  }
58
59
  };
59
60
  export {
60
- S as Tabs,
61
- y as TabsContent,
62
- k as TabsList,
63
- w as TabsTrigger,
64
- A as hooksTabs
61
+ k as Tabs,
62
+ A as TabsContent,
63
+ w as TabsList,
64
+ y as TabsTrigger,
65
+ R as hooksTabs
65
66
  };
@@ -3,6 +3,7 @@ export declare const radix: Record<string, {
3
3
  } & ((props: Record<string, unknown> & Record<`${string}:expression`, string> & {
4
4
  "ws:id"?: string;
5
5
  "ws:label"?: string;
6
+ "ws:tag"?: string;
6
7
  "ws:style"?: import("@webstudio-is/template").TemplateStyleDecl[];
7
8
  "ws:show"?: boolean | {
8
9
  chunks: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react-radix",
3
- "version": "0.210.0",
3
+ "version": "0.213.0",
4
4
  "description": "Webstudio wrapper for radix library",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -58,22 +58,22 @@
58
58
  "@radix-ui/react-tooltip": "^1.1.8",
59
59
  "@radix-ui/react-use-controllable-state": "^1.1.0",
60
60
  "await-interaction-response": "^0.0.2",
61
- "@webstudio-is/css-engine": "0.210.0",
62
- "@webstudio-is/icons": "0.210.0",
63
- "@webstudio-is/sdk": "0.210.0",
64
- "@webstudio-is/react-sdk": "0.210.0"
61
+ "@webstudio-is/react-sdk": "0.213.0",
62
+ "@webstudio-is/css-engine": "0.213.0",
63
+ "@webstudio-is/icons": "0.213.0",
64
+ "@webstudio-is/sdk": "0.213.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/react": "^18.2.70",
68
68
  "@types/react-dom": "^18.2.25",
69
69
  "react": "18.3.0-canary-14898b6a9-20240318",
70
70
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
71
+ "@webstudio-is/css-data": "0.0.0",
71
72
  "@webstudio-is/generate-arg-types": "0.0.0",
72
73
  "@webstudio-is/sdk-cli": "^0.94.0",
73
- "@webstudio-is/css-data": "0.0.0",
74
- "@webstudio-is/sdk-components-react": "0.210.0",
75
- "@webstudio-is/tsconfig": "1.0.7",
76
- "@webstudio-is/template": "0.210.0"
74
+ "@webstudio-is/template": "0.213.0",
75
+ "@webstudio-is/sdk-components-react": "0.213.0",
76
+ "@webstudio-is/tsconfig": "1.0.7"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "vite build --config ../../vite.sdk-components.config.ts",