@webstudio-is/sdk-components-react-radix 0.83.0 → 0.85.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/__generated__/dialog.props.js +2120 -0
- package/lib/__generated__/popover.props.js +468 -0
- package/lib/__generated__/sheet.props.js +2159 -0
- package/lib/__generated__/tabs.props.js +1286 -0
- package/lib/__generated__/tooltip.props.js +478 -0
- package/lib/cjs/__generated__/dialog.props.js +2140 -0
- package/lib/cjs/__generated__/popover.props.js +488 -0
- package/lib/cjs/__generated__/sheet.props.js +2179 -0
- package/lib/cjs/__generated__/tabs.props.js +1306 -0
- package/lib/cjs/__generated__/tooltip.props.js +498 -0
- package/lib/cjs/collapsible.js +34 -4
- package/lib/cjs/collapsible.ws.js +14 -9
- package/lib/cjs/components.js +30 -1
- package/lib/cjs/dialog.js +57 -0
- package/lib/cjs/dialog.ws.js +311 -0
- package/lib/cjs/hooks.js +25 -0
- package/lib/cjs/metas.js +30 -1
- package/lib/cjs/popover.js +58 -0
- package/lib/cjs/popover.ws.js +141 -0
- package/lib/cjs/props.js +30 -1
- package/lib/cjs/sheet.js +63 -0
- package/lib/cjs/sheet.ws.js +317 -0
- package/lib/cjs/tabs.js +41 -0
- package/lib/cjs/tabs.ws.js +213 -0
- package/lib/cjs/theme/radix-common-types.js +16 -0
- package/lib/cjs/theme/tailwind-classes.js +547 -0
- package/lib/cjs/theme/tailwind-colors.js +35 -0
- package/lib/cjs/theme/tailwind-theme.js +46 -0
- package/lib/cjs/tooltip.js +55 -0
- package/lib/cjs/tooltip.ws.js +142 -0
- package/lib/collapsible.js +35 -7
- package/lib/collapsible.ws.js +19 -10
- package/lib/components.js +46 -1
- package/lib/dialog.js +30 -0
- package/lib/dialog.ws.js +298 -0
- package/lib/hooks.js +5 -0
- package/lib/metas.js +59 -1
- package/lib/popover.js +31 -0
- package/lib/popover.ws.js +116 -0
- package/lib/props.js +59 -1
- package/lib/sheet.js +35 -0
- package/lib/sheet.ws.js +304 -0
- package/lib/tabs.js +24 -0
- package/lib/tabs.ws.js +193 -0
- package/lib/theme/radix-common-types.js +0 -0
- package/lib/theme/tailwind-classes.js +527 -0
- package/lib/theme/tailwind-colors.js +15 -0
- package/lib/theme/tailwind-theme.js +16 -0
- package/lib/tooltip.js +28 -0
- package/lib/tooltip.ws.js +117 -0
- package/lib/types/__generated__/dialog.props.d.ts +8 -0
- package/lib/types/__generated__/popover.props.d.ts +4 -0
- package/lib/types/__generated__/sheet.props.d.ts +8 -0
- package/lib/types/__generated__/tabs.props.d.ts +5 -0
- package/lib/types/__generated__/tooltip.props.d.ts +4 -0
- package/lib/types/collapsible.d.ts +4 -3
- package/lib/types/components.d.ts +5 -0
- package/lib/types/dialog.d.ts +25 -0
- package/lib/types/dialog.ws.d.ts +23 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/metas.d.ts +5 -0
- package/lib/types/popover.d.ts +21 -0
- package/lib/types/popover.ws.d.ts +15 -0
- package/lib/types/props.d.ts +5 -0
- package/lib/types/sheet.d.ts +15 -0
- package/lib/types/sheet.ws.d.ts +23 -0
- package/lib/types/tabs.d.ts +15 -0
- package/lib/types/tabs.ws.d.ts +9 -0
- package/lib/types/theme/radix-common-types.d.ts +84 -0
- package/lib/types/theme/tailwind-classes.d.ts +83 -0
- package/lib/types/theme/tailwind-colors.d.ts +21 -0
- package/lib/types/theme/tailwind-theme.d.ts +72 -0
- package/lib/types/tooltip.d.ts +21 -0
- package/lib/types/tooltip.ws.d.ts +15 -0
- package/package.json +23 -6
- package/src/__generated__/dialog.props.ts +2363 -0
- package/src/__generated__/popover.props.ts +515 -0
- package/src/__generated__/sheet.props.ts +2402 -0
- package/src/__generated__/tabs.props.ts +1434 -0
- package/src/__generated__/tooltip.props.ts +526 -0
- package/src/collapsible.stories.tsx +21 -0
- package/src/collapsible.tsx +44 -21
- package/src/collapsible.ws.ts +21 -10
- package/src/components.ts +21 -0
- package/src/dialog.tsx +66 -0
- package/src/dialog.ws.tsx +315 -0
- package/src/hooks.ts +4 -0
- package/src/metas.ts +34 -0
- package/src/popover.tsx +70 -0
- package/src/popover.ws.tsx +127 -0
- package/src/props.ts +34 -0
- package/src/sheet.stories.tsx +21 -0
- package/src/sheet.tsx +40 -0
- package/src/sheet.ws.tsx +326 -0
- package/src/tabs.stories.tsx +21 -0
- package/src/tabs.tsx +46 -0
- package/src/tabs.ws.ts +211 -0
- package/src/theme/radix-common-types.ts +495 -0
- package/src/theme/tailwind-classes.ts +695 -0
- package/src/theme/tailwind-colors.ts +45 -0
- package/src/theme/tailwind-theme.ts +24 -0
- package/src/tooltip.tsx +69 -0
- package/src/tooltip.ws.tsx +128 -0
package/lib/metas.js
CHANGED
|
@@ -3,8 +3,66 @@ import {
|
|
|
3
3
|
metaCollapsibleTrigger,
|
|
4
4
|
metaCollapsibleContent
|
|
5
5
|
} from "./collapsible.ws";
|
|
6
|
+
import {
|
|
7
|
+
metaDialog,
|
|
8
|
+
metaDialogTrigger,
|
|
9
|
+
metaDialogOverlay,
|
|
10
|
+
metaDialogContent,
|
|
11
|
+
metaDialogClose,
|
|
12
|
+
metaDialogTitle,
|
|
13
|
+
metaDialogDescription
|
|
14
|
+
} from "./dialog.ws";
|
|
15
|
+
import {
|
|
16
|
+
metaPopover,
|
|
17
|
+
metaPopoverTrigger,
|
|
18
|
+
metaPopoverContent
|
|
19
|
+
} from "./popover.ws";
|
|
20
|
+
import {
|
|
21
|
+
metaTooltip,
|
|
22
|
+
metaTooltipTrigger,
|
|
23
|
+
metaTooltipContent
|
|
24
|
+
} from "./tooltip.ws";
|
|
25
|
+
import {
|
|
26
|
+
metaSheet,
|
|
27
|
+
metaSheetTrigger,
|
|
28
|
+
metaSheetOverlay,
|
|
29
|
+
metaSheetContent,
|
|
30
|
+
metaSheetClose,
|
|
31
|
+
metaSheetTitle,
|
|
32
|
+
metaSheetDescription
|
|
33
|
+
} from "./sheet.ws";
|
|
34
|
+
import {
|
|
35
|
+
metaTabs,
|
|
36
|
+
metaTabsList,
|
|
37
|
+
metaTabsTrigger,
|
|
38
|
+
metaTabsContent
|
|
39
|
+
} from "./tabs.ws";
|
|
6
40
|
export {
|
|
7
41
|
metaCollapsible as Collapsible,
|
|
8
42
|
metaCollapsibleContent as CollapsibleContent,
|
|
9
|
-
metaCollapsibleTrigger as CollapsibleTrigger
|
|
43
|
+
metaCollapsibleTrigger as CollapsibleTrigger,
|
|
44
|
+
metaDialog as Dialog,
|
|
45
|
+
metaDialogClose as DialogClose,
|
|
46
|
+
metaDialogContent as DialogContent,
|
|
47
|
+
metaDialogDescription as DialogDescription,
|
|
48
|
+
metaDialogOverlay as DialogOverlay,
|
|
49
|
+
metaDialogTitle as DialogTitle,
|
|
50
|
+
metaDialogTrigger as DialogTrigger,
|
|
51
|
+
metaPopover as Popover,
|
|
52
|
+
metaPopoverContent as PopoverContent,
|
|
53
|
+
metaPopoverTrigger as PopoverTrigger,
|
|
54
|
+
metaSheet as Sheet,
|
|
55
|
+
metaSheetClose as SheetClose,
|
|
56
|
+
metaSheetContent as SheetContent,
|
|
57
|
+
metaSheetDescription as SheetDescription,
|
|
58
|
+
metaSheetOverlay as SheetOverlay,
|
|
59
|
+
metaSheetTitle as SheetTitle,
|
|
60
|
+
metaSheetTrigger as SheetTrigger,
|
|
61
|
+
metaTabs as Tabs,
|
|
62
|
+
metaTabsContent as TabsContent,
|
|
63
|
+
metaTabsList as TabsList,
|
|
64
|
+
metaTabsTrigger as TabsTrigger,
|
|
65
|
+
metaTooltip as Tooltip,
|
|
66
|
+
metaTooltipContent as TooltipContent,
|
|
67
|
+
metaTooltipTrigger as TooltipTrigger
|
|
10
68
|
};
|
package/lib/popover.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
Children
|
|
6
|
+
} from "react";
|
|
7
|
+
const Popover = forwardRef(({ open: openProp, isOpen, ...props }, ref) => {
|
|
8
|
+
const open = openProp ?? (isOpen === "open" ? true : isOpen === "closed" ? false : void 0);
|
|
9
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { open, ...props });
|
|
10
|
+
});
|
|
11
|
+
const PopoverTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
12
|
+
const firstChild = Children.toArray(children)[0];
|
|
13
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
|
|
14
|
+
});
|
|
15
|
+
const PopoverContent = forwardRef(
|
|
16
|
+
({ sideOffset = 4, align = "center", hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
17
|
+
PopoverPrimitive.Content,
|
|
18
|
+
{
|
|
19
|
+
ref,
|
|
20
|
+
align: "center",
|
|
21
|
+
sideOffset,
|
|
22
|
+
hideWhenDetached,
|
|
23
|
+
...props
|
|
24
|
+
}
|
|
25
|
+
) })
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
Popover,
|
|
29
|
+
PopoverContent,
|
|
30
|
+
PopoverTrigger
|
|
31
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { PopoverIcon, TriggerIcon, ContentIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
} from "@webstudio-is/react-sdk";
|
|
4
|
+
import * as tc from "./theme/tailwind-classes";
|
|
5
|
+
import {
|
|
6
|
+
propsPopover,
|
|
7
|
+
propsPopoverContent,
|
|
8
|
+
propsPopoverTrigger
|
|
9
|
+
} from "./__generated__/popover.props";
|
|
10
|
+
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
11
|
+
const presetStyle = {
|
|
12
|
+
div
|
|
13
|
+
};
|
|
14
|
+
const metaPopoverTrigger = {
|
|
15
|
+
category: "hidden",
|
|
16
|
+
invalidAncestors: [],
|
|
17
|
+
type: "container",
|
|
18
|
+
label: "Popover Trigger",
|
|
19
|
+
icon: TriggerIcon,
|
|
20
|
+
stylable: false,
|
|
21
|
+
detachable: false
|
|
22
|
+
};
|
|
23
|
+
const metaPopoverContent = {
|
|
24
|
+
category: "hidden",
|
|
25
|
+
invalidAncestors: [],
|
|
26
|
+
type: "container",
|
|
27
|
+
presetStyle,
|
|
28
|
+
label: "Popover Content",
|
|
29
|
+
icon: ContentIcon,
|
|
30
|
+
detachable: false
|
|
31
|
+
};
|
|
32
|
+
const metaPopover = {
|
|
33
|
+
category: "radix",
|
|
34
|
+
invalidAncestors: [],
|
|
35
|
+
type: "container",
|
|
36
|
+
label: "Popover",
|
|
37
|
+
icon: PopoverIcon,
|
|
38
|
+
order: 15,
|
|
39
|
+
stylable: false,
|
|
40
|
+
template: [
|
|
41
|
+
{
|
|
42
|
+
type: "instance",
|
|
43
|
+
component: "Popover",
|
|
44
|
+
dataSources: {
|
|
45
|
+
// We don't have support for boolean or undefined, instead of binding on open we bind on a string
|
|
46
|
+
isOpen: { type: "variable", initialValue: "initial" }
|
|
47
|
+
},
|
|
48
|
+
props: [
|
|
49
|
+
{
|
|
50
|
+
type: "dataSource",
|
|
51
|
+
name: "isOpen",
|
|
52
|
+
dataSourceName: "isOpen"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
children: [
|
|
56
|
+
{
|
|
57
|
+
type: "instance",
|
|
58
|
+
component: "PopoverTrigger",
|
|
59
|
+
props: [],
|
|
60
|
+
children: [
|
|
61
|
+
{
|
|
62
|
+
type: "instance",
|
|
63
|
+
component: "Button",
|
|
64
|
+
children: [{ type: "text", value: "Button" }]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "instance",
|
|
70
|
+
component: "PopoverContent",
|
|
71
|
+
props: [],
|
|
72
|
+
/**
|
|
73
|
+
* z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none
|
|
74
|
+
**/
|
|
75
|
+
styles: [
|
|
76
|
+
tc.z(50),
|
|
77
|
+
tc.w(72),
|
|
78
|
+
tc.rounded("md"),
|
|
79
|
+
tc.border(),
|
|
80
|
+
tc.bg("popover"),
|
|
81
|
+
tc.p(4),
|
|
82
|
+
tc.text("popoverForeground"),
|
|
83
|
+
tc.shadow("md"),
|
|
84
|
+
tc.outline("none")
|
|
85
|
+
].flat(),
|
|
86
|
+
children: [
|
|
87
|
+
{
|
|
88
|
+
type: "instance",
|
|
89
|
+
component: "Text",
|
|
90
|
+
children: [{ type: "text", value: "The text you can edit" }]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
const propsMetaPopover = {
|
|
99
|
+
props: propsPopover,
|
|
100
|
+
initialProps: ["isOpen", "modal"]
|
|
101
|
+
};
|
|
102
|
+
const propsMetaPopoverTrigger = {
|
|
103
|
+
props: propsPopoverTrigger
|
|
104
|
+
};
|
|
105
|
+
const propsMetaPopoverContent = {
|
|
106
|
+
props: propsPopoverContent,
|
|
107
|
+
initialProps: ["side", "sideOffset", "align", "alignOffset"]
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
metaPopover,
|
|
111
|
+
metaPopoverContent,
|
|
112
|
+
metaPopoverTrigger,
|
|
113
|
+
propsMetaPopover,
|
|
114
|
+
propsMetaPopoverContent,
|
|
115
|
+
propsMetaPopoverTrigger
|
|
116
|
+
};
|
package/lib/props.js
CHANGED
|
@@ -3,8 +3,66 @@ import {
|
|
|
3
3
|
propsMetaCollapsibleTrigger,
|
|
4
4
|
propsMetaCollapsibleContent
|
|
5
5
|
} from "./collapsible.ws";
|
|
6
|
+
import {
|
|
7
|
+
propsMetaDialog,
|
|
8
|
+
propsMetaDialogTrigger,
|
|
9
|
+
propsMetaDialogOverlay,
|
|
10
|
+
propsMetaDialogContent,
|
|
11
|
+
propsMetaDialogClose,
|
|
12
|
+
propsMetaDialogTitle,
|
|
13
|
+
propsMetaDialogDescription
|
|
14
|
+
} from "./dialog.ws";
|
|
15
|
+
import {
|
|
16
|
+
propsMetaPopover,
|
|
17
|
+
propsMetaPopoverTrigger,
|
|
18
|
+
propsMetaPopoverContent
|
|
19
|
+
} from "./popover.ws";
|
|
20
|
+
import {
|
|
21
|
+
propsMetaTooltip,
|
|
22
|
+
propsMetaTooltipTrigger,
|
|
23
|
+
propsMetaTooltipContent
|
|
24
|
+
} from "./tooltip.ws";
|
|
25
|
+
import {
|
|
26
|
+
propsMetaSheet,
|
|
27
|
+
propsMetaSheetTrigger,
|
|
28
|
+
propsMetaSheetOverlay,
|
|
29
|
+
propsMetaSheetContent,
|
|
30
|
+
propsMetaSheetClose,
|
|
31
|
+
propsMetaSheetTitle,
|
|
32
|
+
propsMetaSheetDescription
|
|
33
|
+
} from "./sheet.ws";
|
|
34
|
+
import {
|
|
35
|
+
propsMetaTabs,
|
|
36
|
+
propsMetaTabsList,
|
|
37
|
+
propsMetaTabsTrigger,
|
|
38
|
+
propsMetaTabsContent
|
|
39
|
+
} from "./tabs.ws";
|
|
6
40
|
export {
|
|
7
41
|
propsMetaCollapsible as Collapsible,
|
|
8
42
|
propsMetaCollapsibleContent as CollapsibleContent,
|
|
9
|
-
propsMetaCollapsibleTrigger as CollapsibleTrigger
|
|
43
|
+
propsMetaCollapsibleTrigger as CollapsibleTrigger,
|
|
44
|
+
propsMetaDialog as Dialog,
|
|
45
|
+
propsMetaDialogClose as DialogClose,
|
|
46
|
+
propsMetaDialogContent as DialogContent,
|
|
47
|
+
propsMetaDialogDescription as DialogDescription,
|
|
48
|
+
propsMetaDialogOverlay as DialogOverlay,
|
|
49
|
+
propsMetaDialogTitle as DialogTitle,
|
|
50
|
+
propsMetaDialogTrigger as DialogTrigger,
|
|
51
|
+
propsMetaPopover as Popover,
|
|
52
|
+
propsMetaPopoverContent as PopoverContent,
|
|
53
|
+
propsMetaPopoverTrigger as PopoverTrigger,
|
|
54
|
+
propsMetaSheet as Sheet,
|
|
55
|
+
propsMetaSheetClose as SheetClose,
|
|
56
|
+
propsMetaSheetContent as SheetContent,
|
|
57
|
+
propsMetaSheetDescription as SheetDescription,
|
|
58
|
+
propsMetaSheetOverlay as SheetOverlay,
|
|
59
|
+
propsMetaSheetTitle as SheetTitle,
|
|
60
|
+
propsMetaSheetTrigger as SheetTrigger,
|
|
61
|
+
propsMetaTabs as Tabs,
|
|
62
|
+
propsMetaTabsContent as TabsContent,
|
|
63
|
+
propsMetaTabsList as TabsList,
|
|
64
|
+
propsMetaTabsTrigger as TabsTrigger,
|
|
65
|
+
propsMetaTooltip as Tooltip,
|
|
66
|
+
propsMetaTooltipContent as TooltipContent,
|
|
67
|
+
propsMetaTooltipTrigger as TooltipTrigger
|
|
10
68
|
};
|
package/lib/sheet.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import * as Dialog from "./dialog";
|
|
6
|
+
const Sheet = Dialog.Dialog;
|
|
7
|
+
const SheetTrigger = Dialog.DialogTrigger;
|
|
8
|
+
const SheetOverlay = Dialog.DialogOverlay;
|
|
9
|
+
const SheetClose = Dialog.DialogClose;
|
|
10
|
+
const SheetTitle = Dialog.DialogTitle;
|
|
11
|
+
const SheetDescription = Dialog.DialogDescription;
|
|
12
|
+
const SheetContent = forwardRef(
|
|
13
|
+
({ tag = "nav", side = "left", role = "navigation", children, ...props }, ref) => {
|
|
14
|
+
const Tag = tag;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Dialog.DialogContent,
|
|
17
|
+
{
|
|
18
|
+
asChild: true,
|
|
19
|
+
"data-side": side,
|
|
20
|
+
role,
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ jsx(Tag, { ref, children })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
Sheet,
|
|
29
|
+
SheetClose,
|
|
30
|
+
SheetContent,
|
|
31
|
+
SheetDescription,
|
|
32
|
+
SheetOverlay,
|
|
33
|
+
SheetTitle,
|
|
34
|
+
SheetTrigger
|
|
35
|
+
};
|
package/lib/sheet.ws.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HamburgerMenuIcon,
|
|
3
|
+
TriggerIcon,
|
|
4
|
+
ContentIcon,
|
|
5
|
+
OverlayIcon,
|
|
6
|
+
HeadingIcon,
|
|
7
|
+
TextIcon,
|
|
8
|
+
ButtonElementIcon
|
|
9
|
+
} from "@webstudio-is/icons/svg";
|
|
10
|
+
import {
|
|
11
|
+
} from "@webstudio-is/react-sdk";
|
|
12
|
+
import * as tc from "./theme/tailwind-classes";
|
|
13
|
+
import {
|
|
14
|
+
propsSheet,
|
|
15
|
+
propsSheetContent,
|
|
16
|
+
propsSheetTrigger,
|
|
17
|
+
propsSheetOverlay,
|
|
18
|
+
propsSheetClose,
|
|
19
|
+
propsSheetTitle,
|
|
20
|
+
propsSheetDescription
|
|
21
|
+
} from "./__generated__/sheet.props";
|
|
22
|
+
import { div, nav, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
|
|
23
|
+
const contentPresetStyle = {
|
|
24
|
+
div,
|
|
25
|
+
nav
|
|
26
|
+
};
|
|
27
|
+
const presetStyle = {
|
|
28
|
+
div
|
|
29
|
+
};
|
|
30
|
+
const buttonPresetStyle = {
|
|
31
|
+
button
|
|
32
|
+
};
|
|
33
|
+
const titlePresetStyle = {
|
|
34
|
+
h2
|
|
35
|
+
};
|
|
36
|
+
const descriptionPresetStyle = {
|
|
37
|
+
p
|
|
38
|
+
};
|
|
39
|
+
const metaSheetTrigger = {
|
|
40
|
+
category: "hidden",
|
|
41
|
+
type: "container",
|
|
42
|
+
label: "Sheet Trigger",
|
|
43
|
+
icon: TriggerIcon,
|
|
44
|
+
stylable: false,
|
|
45
|
+
detachable: false
|
|
46
|
+
};
|
|
47
|
+
const metaSheetContent = {
|
|
48
|
+
category: "hidden",
|
|
49
|
+
type: "container",
|
|
50
|
+
label: "Sheet Content",
|
|
51
|
+
icon: ContentIcon,
|
|
52
|
+
detachable: false,
|
|
53
|
+
presetStyle: contentPresetStyle,
|
|
54
|
+
states: [
|
|
55
|
+
{ selector: "[data-side=top]", label: "Top Side" },
|
|
56
|
+
{ selector: "[data-side=right]", label: "Right Side" },
|
|
57
|
+
{ selector: "[data-side=bottom]", label: "Bottom Side" },
|
|
58
|
+
{ selector: "[data-side=left]", label: "Left Side" }
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
const metaSheetOverlay = {
|
|
62
|
+
category: "hidden",
|
|
63
|
+
type: "container",
|
|
64
|
+
presetStyle,
|
|
65
|
+
label: "Sheet Overlay",
|
|
66
|
+
icon: OverlayIcon,
|
|
67
|
+
detachable: false
|
|
68
|
+
};
|
|
69
|
+
const metaSheetTitle = {
|
|
70
|
+
category: "hidden",
|
|
71
|
+
type: "container",
|
|
72
|
+
presetStyle: titlePresetStyle,
|
|
73
|
+
label: "Sheet Title",
|
|
74
|
+
icon: HeadingIcon
|
|
75
|
+
};
|
|
76
|
+
const metaSheetDescription = {
|
|
77
|
+
category: "hidden",
|
|
78
|
+
type: "container",
|
|
79
|
+
presetStyle: descriptionPresetStyle,
|
|
80
|
+
label: "Sheet Description",
|
|
81
|
+
icon: TextIcon
|
|
82
|
+
};
|
|
83
|
+
const metaSheetClose = {
|
|
84
|
+
category: "hidden",
|
|
85
|
+
type: "container",
|
|
86
|
+
presetStyle: buttonPresetStyle,
|
|
87
|
+
label: "Sheet Close",
|
|
88
|
+
icon: ButtonElementIcon
|
|
89
|
+
};
|
|
90
|
+
const metaSheet = {
|
|
91
|
+
category: "radix",
|
|
92
|
+
type: "container",
|
|
93
|
+
label: "Sheet",
|
|
94
|
+
icon: HamburgerMenuIcon,
|
|
95
|
+
order: 15,
|
|
96
|
+
stylable: false,
|
|
97
|
+
template: [
|
|
98
|
+
{
|
|
99
|
+
type: "instance",
|
|
100
|
+
component: "Sheet",
|
|
101
|
+
dataSources: {
|
|
102
|
+
// We don't have support for boolean or undefined, instead of binding on open we bind on a string
|
|
103
|
+
isOpen: { type: "variable", initialValue: "initial" }
|
|
104
|
+
},
|
|
105
|
+
props: [
|
|
106
|
+
{
|
|
107
|
+
type: "dataSource",
|
|
108
|
+
name: "isOpen",
|
|
109
|
+
dataSourceName: "isOpen"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
children: [
|
|
113
|
+
{
|
|
114
|
+
type: "instance",
|
|
115
|
+
component: "SheetTrigger",
|
|
116
|
+
children: [
|
|
117
|
+
{
|
|
118
|
+
type: "instance",
|
|
119
|
+
component: "Button",
|
|
120
|
+
children: [{ type: "text", value: "Button" }]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: "instance",
|
|
126
|
+
component: "SheetOverlay",
|
|
127
|
+
/**
|
|
128
|
+
* fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
|
|
129
|
+
* flex
|
|
130
|
+
**/
|
|
131
|
+
styles: [
|
|
132
|
+
tc.fixed(),
|
|
133
|
+
tc.inset(0),
|
|
134
|
+
tc.z(50),
|
|
135
|
+
tc.bg("background", 80),
|
|
136
|
+
tc.backdropBlur("sm"),
|
|
137
|
+
// To allow positioning Content
|
|
138
|
+
tc.flex(),
|
|
139
|
+
tc.flex("col"),
|
|
140
|
+
tc.overflow("auto")
|
|
141
|
+
].flat(),
|
|
142
|
+
children: [
|
|
143
|
+
{
|
|
144
|
+
type: "instance",
|
|
145
|
+
component: "SheetContent",
|
|
146
|
+
/**
|
|
147
|
+
* fixed w-full z-50
|
|
148
|
+
* grid gap-4 max-w-lg
|
|
149
|
+
* m-auto
|
|
150
|
+
* border bg-background p-6 shadow-lg
|
|
151
|
+
**/
|
|
152
|
+
styles: [
|
|
153
|
+
tc.w("full"),
|
|
154
|
+
tc.z(50),
|
|
155
|
+
tc.flex(),
|
|
156
|
+
tc.flex("col"),
|
|
157
|
+
tc.gap(4),
|
|
158
|
+
tc.border(),
|
|
159
|
+
tc.bg("background"),
|
|
160
|
+
tc.p(6),
|
|
161
|
+
tc.shadow("lg"),
|
|
162
|
+
tc.relative(),
|
|
163
|
+
tc.state(
|
|
164
|
+
[tc.mr("auto"), tc.maxW("sm"), tc.grow()].flat(),
|
|
165
|
+
"[data-side=left]"
|
|
166
|
+
),
|
|
167
|
+
tc.state(
|
|
168
|
+
[tc.ml("auto"), tc.maxW("sm"), tc.grow()].flat(),
|
|
169
|
+
"[data-side=right]"
|
|
170
|
+
),
|
|
171
|
+
tc.state([tc.mb("auto")].flat(), "[data-side=top]"),
|
|
172
|
+
tc.state([tc.mt("auto")].flat(), "[data-side=bottom]")
|
|
173
|
+
].flat(),
|
|
174
|
+
children: [
|
|
175
|
+
{
|
|
176
|
+
type: "instance",
|
|
177
|
+
component: "Box",
|
|
178
|
+
label: "Sheet Header",
|
|
179
|
+
styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
|
|
180
|
+
children: [
|
|
181
|
+
{
|
|
182
|
+
type: "instance",
|
|
183
|
+
component: "SheetTitle",
|
|
184
|
+
/**
|
|
185
|
+
* text-lg leading-none tracking-tight
|
|
186
|
+
**/
|
|
187
|
+
styles: [
|
|
188
|
+
tc.my(0),
|
|
189
|
+
tc.leading("none"),
|
|
190
|
+
tc.text("lg"),
|
|
191
|
+
tc.tracking("tight")
|
|
192
|
+
].flat(),
|
|
193
|
+
children: [
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
value: "Sheet Title"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "instance",
|
|
202
|
+
component: "SheetDescription",
|
|
203
|
+
/**
|
|
204
|
+
* text-sm text-muted-foreground
|
|
205
|
+
**/
|
|
206
|
+
styles: [
|
|
207
|
+
tc.my(0),
|
|
208
|
+
tc.text("sm"),
|
|
209
|
+
tc.text("mutedForeground")
|
|
210
|
+
].flat(),
|
|
211
|
+
children: [
|
|
212
|
+
{
|
|
213
|
+
type: "text",
|
|
214
|
+
value: "sheet description text you can edit"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: "instance",
|
|
222
|
+
component: "Text",
|
|
223
|
+
children: [{ type: "text", value: "The text you can edit" }]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: "instance",
|
|
227
|
+
component: "SheetClose",
|
|
228
|
+
/**
|
|
229
|
+
* absolute right-4 top-4
|
|
230
|
+
* rounded-sm opacity-70
|
|
231
|
+
* ring-offset-background
|
|
232
|
+
* hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
233
|
+
* flex items-center justify-center h-4 w-4
|
|
234
|
+
**/
|
|
235
|
+
styles: [
|
|
236
|
+
tc.absolute(),
|
|
237
|
+
tc.right(4),
|
|
238
|
+
tc.top(4),
|
|
239
|
+
tc.rounded("sm"),
|
|
240
|
+
tc.opacity(70),
|
|
241
|
+
tc.flex(),
|
|
242
|
+
tc.items("center"),
|
|
243
|
+
tc.justify("center"),
|
|
244
|
+
tc.h(4),
|
|
245
|
+
tc.w(4),
|
|
246
|
+
tc.border(0),
|
|
247
|
+
tc.bg("transparent"),
|
|
248
|
+
tc.outline("none"),
|
|
249
|
+
tc.hover(tc.opacity(100)),
|
|
250
|
+
tc.focus(tc.ring("ring", 2, "background", 2))
|
|
251
|
+
].flat(),
|
|
252
|
+
children: [{ type: "text", value: "\u2715" }]
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
};
|
|
262
|
+
const propsMetaSheet = {
|
|
263
|
+
props: propsSheet,
|
|
264
|
+
initialProps: ["isOpen", "modal"]
|
|
265
|
+
};
|
|
266
|
+
const propsMetaSheetTrigger = {
|
|
267
|
+
props: propsSheetTrigger
|
|
268
|
+
};
|
|
269
|
+
const propsMetaSheetContent = {
|
|
270
|
+
props: propsSheetContent,
|
|
271
|
+
initialProps: ["side", "role", "tag"]
|
|
272
|
+
};
|
|
273
|
+
const propsMetaSheetOverlay = {
|
|
274
|
+
props: propsSheetOverlay,
|
|
275
|
+
initialProps: []
|
|
276
|
+
};
|
|
277
|
+
const propsMetaSheetClose = {
|
|
278
|
+
props: propsSheetClose,
|
|
279
|
+
initialProps: []
|
|
280
|
+
};
|
|
281
|
+
const propsMetaSheetTitle = {
|
|
282
|
+
props: propsSheetTitle,
|
|
283
|
+
initialProps: []
|
|
284
|
+
};
|
|
285
|
+
const propsMetaSheetDescription = {
|
|
286
|
+
props: propsSheetDescription,
|
|
287
|
+
initialProps: []
|
|
288
|
+
};
|
|
289
|
+
export {
|
|
290
|
+
metaSheet,
|
|
291
|
+
metaSheetClose,
|
|
292
|
+
metaSheetContent,
|
|
293
|
+
metaSheetDescription,
|
|
294
|
+
metaSheetOverlay,
|
|
295
|
+
metaSheetTitle,
|
|
296
|
+
metaSheetTrigger,
|
|
297
|
+
propsMetaSheet,
|
|
298
|
+
propsMetaSheetClose,
|
|
299
|
+
propsMetaSheetContent,
|
|
300
|
+
propsMetaSheetDescription,
|
|
301
|
+
propsMetaSheetOverlay,
|
|
302
|
+
propsMetaSheetTitle,
|
|
303
|
+
propsMetaSheetTrigger
|
|
304
|
+
};
|
package/lib/tabs.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef,
|
|
4
|
+
Children
|
|
5
|
+
} from "react";
|
|
6
|
+
import { Root, List, Trigger, Content } from "@radix-ui/react-tabs";
|
|
7
|
+
import { getIndexWithinAncestorFromComponentProps } from "@webstudio-is/react-sdk";
|
|
8
|
+
const Tabs = Root;
|
|
9
|
+
const TabsList = List;
|
|
10
|
+
const TabsTrigger = forwardRef(({ value, children, ...props }, ref) => {
|
|
11
|
+
const firstChild = Children.toArray(children)[0];
|
|
12
|
+
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
13
|
+
return /* @__PURE__ */ jsx(Trigger, { ref, value: value ?? index, asChild: true, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button" }) });
|
|
14
|
+
});
|
|
15
|
+
const TabsContent = forwardRef(({ value, ...props }, ref) => {
|
|
16
|
+
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
17
|
+
return /* @__PURE__ */ jsx(Content, { ref, value: value ?? index, ...props });
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
Tabs,
|
|
21
|
+
TabsContent,
|
|
22
|
+
TabsList,
|
|
23
|
+
TabsTrigger
|
|
24
|
+
};
|