@webstudio-is/sdk-components-react-radix 0.210.0 → 0.212.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 +23 -22
- package/lib/checkbox.template.js +1 -1
- package/lib/navigation-menu.js +21 -20
- package/lib/sheet.template.js +13 -13
- package/lib/tabs.js +40 -39
- package/lib/types/shared/proxy.d.ts +1 -0
- package/package.json +8 -8
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 {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
12
|
-
if (
|
|
12
|
+
for (const n of o.instancePath)
|
|
13
|
+
if (n.component === `${c}:AccordionContent`) {
|
|
13
14
|
const i = a(
|
|
14
15
|
o.instancePath,
|
|
15
|
-
|
|
16
|
-
`${
|
|
17
|
-
),
|
|
16
|
+
n,
|
|
17
|
+
`${c}:Accordion`
|
|
18
|
+
), r = a(
|
|
18
19
|
o.instancePath,
|
|
19
|
-
|
|
20
|
-
`${
|
|
20
|
+
n,
|
|
21
|
+
`${c}:AccordionItem`
|
|
21
22
|
);
|
|
22
|
-
if (i &&
|
|
23
|
-
const s =
|
|
24
|
-
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
};
|
package/lib/checkbox.template.js
CHANGED
package/lib/navigation-menu.js
CHANGED
|
@@ -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 {
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
const { renderer: t } = f
|
|
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
|
-
}),
|
|
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 =
|
|
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
|
|
46
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
};
|
package/lib/sheet.template.js
CHANGED
|
@@ -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
|
|
4
|
-
import { radix as
|
|
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(
|
|
13
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
50
|
+
/* @__PURE__ */ r(o.Box, { "ws:label": "Navigation", "ws:tag": "nav", children: [
|
|
51
51
|
/* @__PURE__ */ r(
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
90
|
+
/* @__PURE__ */ e(o.Text, { children: new n("The text you can edit") })
|
|
91
91
|
] }),
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
|
-
|
|
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(
|
|
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
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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:
|
|
12
|
-
}), s =
|
|
13
|
-
async (
|
|
14
|
-
await
|
|
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
|
-
|
|
20
|
+
p,
|
|
20
21
|
{
|
|
21
22
|
ref: o,
|
|
22
|
-
...
|
|
23
|
-
value:
|
|
23
|
+
...n,
|
|
24
|
+
value: t,
|
|
24
25
|
onValueChange: s
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
|
-
}),
|
|
28
|
-
const
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
30
|
-
}),
|
|
31
|
-
const
|
|
32
|
-
return /* @__PURE__ */ i(
|
|
33
|
-
}), r = "@webstudio-is/sdk-components-react-radix",
|
|
34
|
-
onNavigatorSelect: (e,
|
|
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
|
|
37
|
-
if (
|
|
37
|
+
for (const t of n.instancePath)
|
|
38
|
+
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
38
39
|
const a = l(
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
n.instancePath,
|
|
41
|
+
t,
|
|
41
42
|
`${r}:Tabs`
|
|
42
|
-
), s = e.getPropValue(
|
|
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,
|
|
47
|
+
onNavigatorUnselect: (e, n) => {
|
|
47
48
|
var o;
|
|
48
|
-
for (const
|
|
49
|
-
if (
|
|
49
|
+
for (const t of n.instancePath)
|
|
50
|
+
if (t.component === `${r}:TabsContent` || t.component === `${r}:TabsTrigger`) {
|
|
50
51
|
const a = l(
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
n.instancePath,
|
|
53
|
+
t,
|
|
53
54
|
`${r}:Tabs`
|
|
54
|
-
), s = e.getPropValue(
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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.
|
|
3
|
+
"version": "0.212.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.
|
|
62
|
-
"@webstudio-is/
|
|
63
|
-
"@webstudio-is/
|
|
64
|
-
"@webstudio-is/
|
|
61
|
+
"@webstudio-is/css-engine": "0.212.0",
|
|
62
|
+
"@webstudio-is/react-sdk": "0.212.0",
|
|
63
|
+
"@webstudio-is/icons": "0.212.0",
|
|
64
|
+
"@webstudio-is/sdk": "0.212.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",
|
|
73
|
+
"@webstudio-is/sdk-components-react": "0.212.0",
|
|
72
74
|
"@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
75
|
"@webstudio-is/tsconfig": "1.0.7",
|
|
76
|
-
"@webstudio-is/template": "0.
|
|
76
|
+
"@webstudio-is/template": "0.212.0"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"build": "vite build --config ../../vite.sdk-components.config.ts",
|