@webstudio-is/sdk-components-react-radix 0.0.0-017f1bd
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/LICENSE +661 -0
- package/README.md +4 -0
- package/lib/__generated__/accordion.props.js +64 -0
- package/lib/__generated__/checkbox.props.js +18 -0
- package/lib/__generated__/collapsible.props.js +19 -0
- package/lib/__generated__/dialog.props.js +24 -0
- package/lib/__generated__/label.props.js +4 -0
- package/lib/__generated__/navigation-menu.props.js +48 -0
- package/lib/__generated__/popover.props.js +62 -0
- package/lib/__generated__/radio-group.props.js +70 -0
- package/lib/__generated__/select.props.js +114 -0
- package/lib/__generated__/switch.props.js +18 -0
- package/lib/__generated__/tabs.props.js +65 -0
- package/lib/__generated__/tooltip.props.js +78 -0
- package/lib/accordion.js +49 -0
- package/lib/accordion.template.js +95 -0
- package/lib/accordion.ws.js +80 -0
- package/lib/checkbox.js +19 -0
- package/lib/checkbox.template.js +63 -0
- package/lib/checkbox.ws.js +36 -0
- package/lib/collapsible.js +40 -0
- package/lib/collapsible.template.js +16 -0
- package/lib/collapsible.ws.js +39 -0
- package/lib/components.js +63 -0
- package/lib/dialog.js +96 -0
- package/lib/dialog.template.js +119 -0
- package/lib/dialog.ws.js +80 -0
- package/lib/hooks.js +21 -0
- package/lib/label.js +7 -0
- package/lib/label.template.js +23 -0
- package/lib/label.ws.js +12 -0
- package/lib/metas.js +63 -0
- package/lib/navigation-menu.js +60 -0
- package/lib/navigation-menu.template.js +283 -0
- package/lib/navigation-menu.ws.js +93 -0
- package/lib/popover.js +52 -0
- package/lib/popover.template.js +63 -0
- package/lib/popover.ws.js +51 -0
- package/lib/radio-group.js +12 -0
- package/lib/radio-group.template.js +66 -0
- package/lib/radio-group.ws.js +49 -0
- package/lib/select.js +58 -0
- package/lib/select.template.js +121 -0
- package/lib/select.ws.js +89 -0
- package/lib/shared/meta.js +13 -0
- package/lib/shared/preset-styles.js +38 -0
- package/lib/shared/proxy.js +5 -0
- package/lib/shared/styles.js +51 -0
- package/lib/shared/theme.js +119 -0
- package/lib/sheet.template.js +129 -0
- package/lib/switch.js +11 -0
- package/lib/switch.template.js +63 -0
- package/lib/switch.ws.js +40 -0
- package/lib/tabs.js +62 -0
- package/lib/tabs.template.js +66 -0
- package/lib/tabs.ws.js +53 -0
- package/lib/templates.js +28 -0
- package/lib/tooltip.js +48 -0
- package/lib/tooltip.template.js +33 -0
- package/lib/tooltip.ws.js +35 -0
- package/lib/types/__generated__/accordion.props.d.ts +6 -0
- package/lib/types/__generated__/checkbox.props.d.ts +3 -0
- package/lib/types/__generated__/collapsible.props.d.ts +4 -0
- package/lib/types/__generated__/dialog.props.d.ts +8 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
- package/lib/types/__generated__/popover.props.d.ts +5 -0
- package/lib/types/__generated__/radio-group.props.d.ts +4 -0
- package/lib/types/__generated__/select.props.d.ts +9 -0
- package/lib/types/__generated__/switch.props.d.ts +3 -0
- package/lib/types/__generated__/tabs.props.d.ts +5 -0
- package/lib/types/__generated__/tooltip.props.d.ts +4 -0
- package/lib/types/accordion.d.ts +11 -0
- package/lib/types/accordion.template.d.ts +10 -0
- package/lib/types/accordion.ws.d.ts +6 -0
- package/lib/types/checkbox.d.ts +9 -0
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +3 -0
- package/lib/types/collapsible.d.ts +15 -0
- package/lib/types/collapsible.template.d.ts +2 -0
- package/lib/types/collapsible.ws.d.ts +4 -0
- package/lib/types/components.d.ts +12 -0
- package/lib/types/dialog.d.ts +23 -0
- package/lib/types/dialog.template.d.ts +10 -0
- package/lib/types/dialog.ws.d.ts +8 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.template.d.ts +10 -0
- package/lib/types/label.ws.d.ts +2 -0
- package/lib/types/metas.d.ts +12 -0
- package/lib/types/navigation-menu.d.ts +10 -0
- package/lib/types/navigation-menu.template.d.ts +2 -0
- package/lib/types/navigation-menu.ws.d.ts +8 -0
- package/lib/types/popover.d.ts +16 -0
- package/lib/types/popover.template.d.ts +10 -0
- package/lib/types/popover.ws.d.ts +5 -0
- package/lib/types/props-descriptions.d.ts +29 -0
- package/lib/types/radio-group.d.ts +5 -0
- package/lib/types/radio-group.template.d.ts +2 -0
- package/lib/types/radio-group.ws.d.ts +4 -0
- package/lib/types/select.d.ts +14 -0
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +9 -0
- package/lib/types/shared/meta.d.ts +1 -0
- package/lib/types/shared/preset-styles.d.ts +2 -0
- package/lib/types/shared/proxy.d.ts +16 -0
- package/lib/types/shared/styles.d.ts +2 -0
- package/lib/types/shared/theme.d.ts +212 -0
- package/lib/types/sheet.template.d.ts +10 -0
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.template.d.ts +2 -0
- package/lib/types/switch.ws.d.ts +3 -0
- package/lib/types/tabs.d.ts +10 -0
- package/lib/types/tabs.template.d.ts +2 -0
- package/lib/types/tabs.ws.d.ts +5 -0
- package/lib/types/templates.d.ts +13 -0
- package/lib/types/tooltip.d.ts +15 -0
- package/lib/types/tooltip.template.d.ts +10 -0
- package/lib/types/tooltip.ws.d.ts +4 -0
- package/package.json +79 -0
package/lib/dialog.ws.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DialogIcon as t, TriggerIcon as n, OverlayIcon as i, ContentIcon as r, ButtonElementIcon as c, HeadingIcon as l, TextIcon as a } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { div as e, button as s, h2 as p, p as g } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { radix as o } from "./shared/meta.js";
|
|
4
|
+
import { propsDialog as D, propsDialogTrigger as d, propsDialogOverlay as m, propsDialogContent as y, propsDialogClose as h, propsDialogTitle as C, propsDialogDescription as T } from "./__generated__/dialog.props.js";
|
|
5
|
+
import { buttonReset as I } from "./shared/preset-styles.js";
|
|
6
|
+
const S = {
|
|
7
|
+
icon: n,
|
|
8
|
+
contentModel: {
|
|
9
|
+
category: "none",
|
|
10
|
+
children: ["instance"]
|
|
11
|
+
},
|
|
12
|
+
props: d
|
|
13
|
+
}, b = {
|
|
14
|
+
icon: i,
|
|
15
|
+
contentModel: {
|
|
16
|
+
category: "none",
|
|
17
|
+
children: ["instance"],
|
|
18
|
+
descendants: [o.DialogContent]
|
|
19
|
+
},
|
|
20
|
+
presetStyle: { div: e },
|
|
21
|
+
props: m
|
|
22
|
+
}, O = {
|
|
23
|
+
icon: r,
|
|
24
|
+
contentModel: {
|
|
25
|
+
category: "none",
|
|
26
|
+
children: ["instance"],
|
|
27
|
+
descendants: [
|
|
28
|
+
o.DialogTitle,
|
|
29
|
+
o.DialogDescription,
|
|
30
|
+
o.DialogClose
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
presetStyle: { div: e },
|
|
34
|
+
props: y
|
|
35
|
+
}, B = {
|
|
36
|
+
icon: l,
|
|
37
|
+
contentModel: {
|
|
38
|
+
category: "none",
|
|
39
|
+
children: ["instance", "rich-text"]
|
|
40
|
+
},
|
|
41
|
+
presetStyle: { h2: p },
|
|
42
|
+
props: C
|
|
43
|
+
}, E = {
|
|
44
|
+
icon: a,
|
|
45
|
+
contentModel: {
|
|
46
|
+
category: "none",
|
|
47
|
+
children: ["instance", "rich-text"]
|
|
48
|
+
},
|
|
49
|
+
presetStyle: { p: g },
|
|
50
|
+
props: T
|
|
51
|
+
}, H = {
|
|
52
|
+
icon: c,
|
|
53
|
+
label: "Close Button",
|
|
54
|
+
contentModel: {
|
|
55
|
+
category: "none",
|
|
56
|
+
children: ["instance", "rich-text"]
|
|
57
|
+
},
|
|
58
|
+
presetStyle: {
|
|
59
|
+
button: [I, s].flat()
|
|
60
|
+
},
|
|
61
|
+
props: h
|
|
62
|
+
}, P = {
|
|
63
|
+
icon: t,
|
|
64
|
+
contentModel: {
|
|
65
|
+
category: "instance",
|
|
66
|
+
children: ["instance"],
|
|
67
|
+
descendants: [o.DialogTrigger, o.DialogOverlay]
|
|
68
|
+
},
|
|
69
|
+
initialProps: ["open"],
|
|
70
|
+
props: D
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
P as metaDialog,
|
|
74
|
+
H as metaDialogClose,
|
|
75
|
+
O as metaDialogContent,
|
|
76
|
+
E as metaDialogDescription,
|
|
77
|
+
b as metaDialogOverlay,
|
|
78
|
+
B as metaDialogTitle,
|
|
79
|
+
S as metaDialogTrigger
|
|
80
|
+
};
|
package/lib/hooks.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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 { hooksTooltip as t } from "./tooltip.js";
|
|
6
|
+
import { hooksAccordion as p } from "./accordion.js";
|
|
7
|
+
import { hooksNavigationMenu as s } from "./navigation-menu.js";
|
|
8
|
+
import { hooksSelect as h } from "./select.js";
|
|
9
|
+
const g = [
|
|
10
|
+
o,
|
|
11
|
+
r,
|
|
12
|
+
m,
|
|
13
|
+
i,
|
|
14
|
+
t,
|
|
15
|
+
p,
|
|
16
|
+
s,
|
|
17
|
+
h
|
|
18
|
+
];
|
|
19
|
+
export {
|
|
20
|
+
g as hooks
|
|
21
|
+
};
|
package/lib/label.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { PlaceholderValue as t, css as o } from "@webstudio-is/template";
|
|
3
|
+
import { radix as i } from "./shared/proxy.js";
|
|
4
|
+
import { fontSize as r, lineHeight as n, weights as h } from "./shared/theme.js";
|
|
5
|
+
const p = {
|
|
6
|
+
category: "radix",
|
|
7
|
+
description: "An accessible label to describe the purpose of an input. Match the “For” property on the label with the “ID” of the input to connect them.",
|
|
8
|
+
order: 102,
|
|
9
|
+
template: /* @__PURE__ */ e(
|
|
10
|
+
i.Label,
|
|
11
|
+
{
|
|
12
|
+
"ws:style": o`
|
|
13
|
+
font-size: ${r.sm};
|
|
14
|
+
line-height: ${n.none};
|
|
15
|
+
font-weight: ${h.medium};
|
|
16
|
+
`,
|
|
17
|
+
children: new t("Form Label")
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
p as meta
|
|
23
|
+
};
|
package/lib/label.ws.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LabelIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { label as r } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { props as t } from "./__generated__/label.props.js";
|
|
4
|
+
const m = {
|
|
5
|
+
icon: o,
|
|
6
|
+
presetStyle: { label: r },
|
|
7
|
+
initialProps: ["id", "class", "for"],
|
|
8
|
+
props: t
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
m as meta
|
|
12
|
+
};
|
package/lib/metas.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { metaCollapsible as t, metaCollapsibleContent as o, metaCollapsibleTrigger as i } from "./collapsible.ws.js";
|
|
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, 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
|
+
export {
|
|
14
|
+
L as Accordion,
|
|
15
|
+
k as AccordionContent,
|
|
16
|
+
G as AccordionHeader,
|
|
17
|
+
R as AccordionItem,
|
|
18
|
+
V as AccordionTrigger,
|
|
19
|
+
te as Checkbox,
|
|
20
|
+
oe as CheckboxIndicator,
|
|
21
|
+
t as Collapsible,
|
|
22
|
+
o as CollapsibleContent,
|
|
23
|
+
i as CollapsibleTrigger,
|
|
24
|
+
n as Dialog,
|
|
25
|
+
m as DialogClose,
|
|
26
|
+
s as DialogContent,
|
|
27
|
+
l as DialogDescription,
|
|
28
|
+
g as DialogOverlay,
|
|
29
|
+
c as DialogTitle,
|
|
30
|
+
p as DialogTrigger,
|
|
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
|
+
C as Popover,
|
|
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
|
|
63
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useContext as v, Children as g } from "react";
|
|
3
|
+
import * as a from "@radix-ui/react-navigation-menu";
|
|
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);
|
|
8
|
+
let i = o;
|
|
9
|
+
return t === "canvas" && (i = i === "" ? "-1" : i), /* @__PURE__ */ r(a.Root, { ref: e, value: i, ...n });
|
|
10
|
+
}), P = a.List, k = a.Viewport, x = a.Content, A = c(({ value: o, ...n }, e) => {
|
|
11
|
+
const t = l(n);
|
|
12
|
+
return /* @__PURE__ */ r(a.Item, { ref: e, value: o ?? t, ...n });
|
|
13
|
+
}), I = c(({ children: o, ...n }, e) => {
|
|
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];
|
|
18
|
+
return /* @__PURE__ */ r(a.Trigger, { asChild: !0, ref: e, ...n, children: t ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
19
|
+
}), s = "@webstudio-is/sdk-components-react-radix", w = {
|
|
20
|
+
onNavigatorUnselect: (o, n) => {
|
|
21
|
+
for (const e of n.instancePath)
|
|
22
|
+
if (e.component === `${s}:NavigationMenuContent`) {
|
|
23
|
+
const t = d(
|
|
24
|
+
n.instancePath,
|
|
25
|
+
e,
|
|
26
|
+
`${s}:NavigationMenu`
|
|
27
|
+
);
|
|
28
|
+
t && o.setMemoryProp(t, "value", void 0);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onNavigatorSelect: (o, n) => {
|
|
32
|
+
var e;
|
|
33
|
+
for (const t of n.instancePath)
|
|
34
|
+
if (t.component === `${s}:NavigationMenuContent`) {
|
|
35
|
+
const i = d(
|
|
36
|
+
n.instancePath,
|
|
37
|
+
t,
|
|
38
|
+
`${s}:NavigationMenu`
|
|
39
|
+
), u = d(
|
|
40
|
+
n.instancePath,
|
|
41
|
+
t,
|
|
42
|
+
`${s}:NavigationMenuItem`
|
|
43
|
+
);
|
|
44
|
+
if (u === void 0 || i === void 0)
|
|
45
|
+
return;
|
|
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);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
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
|
|
60
|
+
};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDownIcon as w } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { css as t, $ as n, PlaceholderValue as l } from "@webstudio-is/template";
|
|
4
|
+
import { radix as r } from "./shared/proxy.js";
|
|
5
|
+
import { getButtonStyle as u } from "./shared/styles.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
|
+
const k = [
|
|
8
|
+
{
|
|
9
|
+
title: "Sheet",
|
|
10
|
+
href: "/docs/components/sheet",
|
|
11
|
+
description: "Extends the Dialog component to display content that complements the main content of the screen."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: "Navigation Menu",
|
|
15
|
+
href: "/docs/components/navigation-menu",
|
|
16
|
+
description: "A collection of links for navigating websites."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "Tabs",
|
|
20
|
+
href: "/docs/components/tabs",
|
|
21
|
+
description: "A set of layered sections of content—known as tab panels—that are displayed one at a time."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Accordion",
|
|
25
|
+
href: "/docs/components/accordion",
|
|
26
|
+
description: "A vertically stacked set of interactive headings that each reveal a section of content."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "Dialog",
|
|
30
|
+
href: "/docs/components/dialog",
|
|
31
|
+
description: "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: "Collapsible",
|
|
35
|
+
href: "/docs/components/collapsible",
|
|
36
|
+
description: "An interactive component which expands/collapses a panel."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Popover",
|
|
40
|
+
href: "/docs/components/popover",
|
|
41
|
+
description: "Displays rich content in a portal, triggered by a button."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Tooltip",
|
|
45
|
+
href: "/docs/components/tooltip",
|
|
46
|
+
description: "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: "Button",
|
|
50
|
+
href: "/docs/components/button",
|
|
51
|
+
description: "Displays a button or a component that looks like a button."
|
|
52
|
+
}
|
|
53
|
+
], M = (o) => /* @__PURE__ */ e(r.NavigationMenuLink, { children: /* @__PURE__ */ s(
|
|
54
|
+
n.Link,
|
|
55
|
+
{
|
|
56
|
+
href: `https://ui.shadcn.com${o.href}`,
|
|
57
|
+
"ws:style": t`
|
|
58
|
+
color: inherit;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
user-select: none;
|
|
62
|
+
gap: ${i[1]};
|
|
63
|
+
border-radius: ${h.md};
|
|
64
|
+
padding: ${i[3]};
|
|
65
|
+
line-height: ${c.none};
|
|
66
|
+
text-decoration-line: none;
|
|
67
|
+
outline: none;
|
|
68
|
+
&:hover,
|
|
69
|
+
&:focus {
|
|
70
|
+
background-color: ${a.accent};
|
|
71
|
+
color: ${a.accentForeground};
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
n.Text,
|
|
77
|
+
{
|
|
78
|
+
"ws:style": t`
|
|
79
|
+
font-size: ${m.sm};
|
|
80
|
+
font-weight: ${$.medium};
|
|
81
|
+
line-height: ${c.none};
|
|
82
|
+
`,
|
|
83
|
+
children: new l(o.title)
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ e(
|
|
87
|
+
n.Paragraph,
|
|
88
|
+
{
|
|
89
|
+
"ws:style": t`
|
|
90
|
+
margin: 0;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
display: -webkit-box;
|
|
93
|
+
-webkit-box-orient: vertical;
|
|
94
|
+
-webkit-line-clamp: 2;
|
|
95
|
+
font-size: ${m.sm};
|
|
96
|
+
line-height: ${c.snug};
|
|
97
|
+
color: ${a.mutedForeground};
|
|
98
|
+
`,
|
|
99
|
+
children: new l(o.description)
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) }, o.title), d = (o) => /* @__PURE__ */ e(
|
|
105
|
+
n.Box,
|
|
106
|
+
{
|
|
107
|
+
"ws:label": "Flex Column",
|
|
108
|
+
"ws:style": t`
|
|
109
|
+
width: ${p[64]};
|
|
110
|
+
display: flex;
|
|
111
|
+
gap: ${i[4]};
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
`,
|
|
114
|
+
children: k.slice(o.offset, o.offset + o.count).map(M)
|
|
115
|
+
}
|
|
116
|
+
), C = /* @__PURE__ */ s(
|
|
117
|
+
n.Box,
|
|
118
|
+
{
|
|
119
|
+
"ws:label": "Content",
|
|
120
|
+
"ws:style": t`
|
|
121
|
+
display: flex;
|
|
122
|
+
gap: ${i[4]};
|
|
123
|
+
padding: ${i[2]};
|
|
124
|
+
`,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ e(
|
|
127
|
+
n.Box,
|
|
128
|
+
{
|
|
129
|
+
"ws:style": t`
|
|
130
|
+
background-color: ${a.border};
|
|
131
|
+
padding: ${i[4]};
|
|
132
|
+
width: ${p[48]};
|
|
133
|
+
border-radius: ${h.md};
|
|
134
|
+
`,
|
|
135
|
+
children: new l("")
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
d({ count: 3, offset: 0 })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
), A = /* @__PURE__ */ s(
|
|
142
|
+
n.Box,
|
|
143
|
+
{
|
|
144
|
+
"ws:label": "Content",
|
|
145
|
+
"ws:style": t`
|
|
146
|
+
display: flex;
|
|
147
|
+
gap: ${i[4]};
|
|
148
|
+
`,
|
|
149
|
+
children: [
|
|
150
|
+
d({ count: 3, offset: 3 }),
|
|
151
|
+
d({ count: 3, offset: 6 })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
), g = (o, f) => /* @__PURE__ */ s(r.NavigationMenuItem, { children: [
|
|
155
|
+
/* @__PURE__ */ e(r.NavigationMenuTrigger, { children: /* @__PURE__ */ s(
|
|
156
|
+
n.Button,
|
|
157
|
+
{
|
|
158
|
+
"ws:style": [
|
|
159
|
+
...u("ghost", "sm"),
|
|
160
|
+
...t`
|
|
161
|
+
--navigation-menu-trigger-icon-transform: 0deg;
|
|
162
|
+
&[data-state="open"] {
|
|
163
|
+
--navigation-menu-trigger-icon-transform: 180deg;
|
|
164
|
+
}
|
|
165
|
+
`
|
|
166
|
+
],
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ e(n.Text, { children: new l(o) }),
|
|
169
|
+
/* @__PURE__ */ e(
|
|
170
|
+
n.Box,
|
|
171
|
+
{
|
|
172
|
+
"ws:label": "Icon Container",
|
|
173
|
+
"ws:style": t`
|
|
174
|
+
margin-left: ${i[1]};
|
|
175
|
+
rotate: var(--navigation-menu-trigger-icon-transform);
|
|
176
|
+
height: ${y[4]};
|
|
177
|
+
width: ${p[4]};
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
transition: ${x.all};
|
|
180
|
+
transition-duration: 200ms;
|
|
181
|
+
`,
|
|
182
|
+
children: /* @__PURE__ */ e(n.HtmlEmbed, { "ws:label": "Chevron Icon", code: w })
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
) }),
|
|
188
|
+
/* @__PURE__ */ e(
|
|
189
|
+
r.NavigationMenuContent,
|
|
190
|
+
{
|
|
191
|
+
"ws:style": t`
|
|
192
|
+
left: 0;
|
|
193
|
+
top: 0;
|
|
194
|
+
positon: absolute;
|
|
195
|
+
width: max-content;
|
|
196
|
+
padding: ${i[4]};
|
|
197
|
+
`,
|
|
198
|
+
children: f
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] }), N = (o) => /* @__PURE__ */ e(r.NavigationMenuItem, { children: /* @__PURE__ */ e(r.NavigationMenuLink, { children: /* @__PURE__ */ e(
|
|
202
|
+
n.Link,
|
|
203
|
+
{
|
|
204
|
+
"ws:style": [
|
|
205
|
+
...u("ghost", "sm"),
|
|
206
|
+
...t`
|
|
207
|
+
text-decoration-line: none;
|
|
208
|
+
color: currentColor;
|
|
209
|
+
`
|
|
210
|
+
],
|
|
211
|
+
children: new l(o)
|
|
212
|
+
}
|
|
213
|
+
) }) }), S = {
|
|
214
|
+
category: "radix",
|
|
215
|
+
description: "A collection of links for navigating websites.",
|
|
216
|
+
order: 2,
|
|
217
|
+
template: /* @__PURE__ */ s(
|
|
218
|
+
r.NavigationMenu,
|
|
219
|
+
{
|
|
220
|
+
"ws:style": t`
|
|
221
|
+
position: relative;
|
|
222
|
+
max-width: max-content;
|
|
223
|
+
`,
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ s(
|
|
226
|
+
r.NavigationMenuList,
|
|
227
|
+
{
|
|
228
|
+
"ws:style": t`
|
|
229
|
+
/* ul defaults in tailwind */
|
|
230
|
+
padding: 0;
|
|
231
|
+
margin: 0;
|
|
232
|
+
/* shadcdn styles */
|
|
233
|
+
display: flex;
|
|
234
|
+
flex: 1 1 0;
|
|
235
|
+
list-style-type: none;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
gap: ${i[1]};
|
|
239
|
+
`,
|
|
240
|
+
children: [
|
|
241
|
+
g("About", C),
|
|
242
|
+
g("Components", A),
|
|
243
|
+
N("Standalone")
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ e(
|
|
248
|
+
n.Box,
|
|
249
|
+
{
|
|
250
|
+
"ws:label": "Viewport Container",
|
|
251
|
+
"ws:style": t`
|
|
252
|
+
position: absolute;
|
|
253
|
+
left: 0;
|
|
254
|
+
top: 100%;
|
|
255
|
+
display: flex;
|
|
256
|
+
justify-content: center;
|
|
257
|
+
`,
|
|
258
|
+
children: /* @__PURE__ */ e(
|
|
259
|
+
r.NavigationMenuViewport,
|
|
260
|
+
{
|
|
261
|
+
"ws:style": t`
|
|
262
|
+
position: relative;
|
|
263
|
+
margin-top: ${i[1.5]};
|
|
264
|
+
overflow: hidden;
|
|
265
|
+
border-radius: ${h.md};
|
|
266
|
+
border: ${v.DEFAULT} solid ${a.border};
|
|
267
|
+
background-color: ${a.popover};
|
|
268
|
+
color: ${a.popoverForeground};
|
|
269
|
+
box-shadow: ${b.lg};
|
|
270
|
+
height: var(--radix-navigation-menu-viewport-height);
|
|
271
|
+
width: var(--radix-navigation-menu-viewport-width);
|
|
272
|
+
`
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
};
|
|
281
|
+
export {
|
|
282
|
+
S as meta
|
|
283
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
icon: t,
|
|
7
|
+
contentModel: {
|
|
8
|
+
category: "instance",
|
|
9
|
+
children: ["instance"],
|
|
10
|
+
descendants: [n.NavigationMenuList, n.NavigationMenuViewport]
|
|
11
|
+
},
|
|
12
|
+
presetStyle: {
|
|
13
|
+
div: e
|
|
14
|
+
},
|
|
15
|
+
props: p
|
|
16
|
+
}, h = {
|
|
17
|
+
icon: o,
|
|
18
|
+
label: "Menu List",
|
|
19
|
+
contentModel: {
|
|
20
|
+
category: "none",
|
|
21
|
+
children: ["instance"],
|
|
22
|
+
descendants: [n.NavigationMenuItem]
|
|
23
|
+
},
|
|
24
|
+
presetStyle: {
|
|
25
|
+
div: e
|
|
26
|
+
},
|
|
27
|
+
props: g
|
|
28
|
+
}, b = {
|
|
29
|
+
icon: i,
|
|
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
|
+
]
|
|
40
|
+
},
|
|
41
|
+
presetStyle: {
|
|
42
|
+
div: e
|
|
43
|
+
},
|
|
44
|
+
props: M
|
|
45
|
+
}, k = {
|
|
46
|
+
icon: a,
|
|
47
|
+
label: "Menu Trigger",
|
|
48
|
+
contentModel: {
|
|
49
|
+
category: "none",
|
|
50
|
+
children: ["instance"]
|
|
51
|
+
},
|
|
52
|
+
props: l
|
|
53
|
+
}, w = {
|
|
54
|
+
icon: r,
|
|
55
|
+
label: "Menu Content",
|
|
56
|
+
contentModel: {
|
|
57
|
+
category: "none",
|
|
58
|
+
children: ["instance"],
|
|
59
|
+
descendants: [n.NavigationMenuLink]
|
|
60
|
+
},
|
|
61
|
+
presetStyle: {
|
|
62
|
+
div: e
|
|
63
|
+
},
|
|
64
|
+
props: u
|
|
65
|
+
}, C = {
|
|
66
|
+
icon: c,
|
|
67
|
+
label: "Accessible Link Wrapper",
|
|
68
|
+
contentModel: {
|
|
69
|
+
category: "none",
|
|
70
|
+
children: ["instance"]
|
|
71
|
+
},
|
|
72
|
+
props: d
|
|
73
|
+
}, S = {
|
|
74
|
+
icon: s,
|
|
75
|
+
label: "Menu Viewport",
|
|
76
|
+
contentModel: {
|
|
77
|
+
category: "none",
|
|
78
|
+
children: ["instance"]
|
|
79
|
+
},
|
|
80
|
+
presetStyle: {
|
|
81
|
+
div: e
|
|
82
|
+
},
|
|
83
|
+
props: v
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
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
|
|
93
|
+
};
|
package/lib/popover.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import * as s from "@radix-ui/react-popover";
|
|
4
|
+
import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
|
|
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(
|
|
13
|
+
s.Content,
|
|
14
|
+
{
|
|
15
|
+
ref: i,
|
|
16
|
+
align: "center",
|
|
17
|
+
sideOffset: t,
|
|
18
|
+
hideWhenDetached: o,
|
|
19
|
+
...e
|
|
20
|
+
}
|
|
21
|
+
) })
|
|
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`
|
|
30
|
+
);
|
|
31
|
+
e && t.setMemoryProp(e, "open", void 0);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
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`
|
|
41
|
+
);
|
|
42
|
+
e && t.setMemoryProp(e, "open", !0);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
h as Popover,
|
|
48
|
+
g as PopoverClose,
|
|
49
|
+
C as PopoverContent,
|
|
50
|
+
u as PopoverTrigger,
|
|
51
|
+
$ as hooksPopover
|
|
52
|
+
};
|