@webstudio-is/sdk-components-react-radix 0.85.0 → 0.87.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__/accordion.props.js +2134 -0
- package/lib/__generated__/button.props.js +454 -0
- package/lib/__generated__/dialog.props.js +0 -7
- package/lib/__generated__/input.props.js +451 -0
- package/lib/__generated__/label.props.js +421 -0
- package/lib/__generated__/popover.props.js +0 -7
- package/lib/__generated__/sheet.props.js +0 -7
- package/lib/__generated__/textarea.props.js +431 -0
- package/lib/__generated__/tooltip.props.js +0 -7
- package/lib/accordion.js +51 -0
- package/lib/accordion.ws.js +243 -0
- package/lib/button.js +8 -0
- package/lib/button.ws.js +133 -0
- package/lib/cjs/__generated__/accordion.props.js +2154 -0
- package/lib/cjs/__generated__/button.props.js +474 -0
- package/lib/cjs/__generated__/dialog.props.js +0 -7
- package/lib/cjs/__generated__/input.props.js +471 -0
- package/lib/cjs/__generated__/label.props.js +441 -0
- package/lib/cjs/__generated__/popover.props.js +0 -7
- package/lib/cjs/__generated__/sheet.props.js +0 -7
- package/lib/cjs/__generated__/textarea.props.js +451 -0
- package/lib/cjs/__generated__/tooltip.props.js +0 -7
- package/lib/cjs/accordion.js +60 -0
- package/lib/cjs/accordion.ws.js +261 -0
- package/lib/cjs/button.js +28 -0
- package/lib/cjs/button.ws.js +160 -0
- package/lib/cjs/collapsible.js +2 -16
- package/lib/cjs/collapsible.ws.js +1 -8
- package/lib/cjs/components.js +14 -0
- package/lib/cjs/dialog.js +38 -6
- package/lib/cjs/dialog.ws.js +15 -26
- package/lib/cjs/hooks.js +15 -1
- package/lib/cjs/input.js +28 -0
- package/lib/cjs/input.ws.js +103 -0
- package/lib/cjs/label.js +37 -0
- package/lib/cjs/label.ws.js +74 -0
- package/lib/cjs/metas.js +14 -0
- package/lib/cjs/popover.js +37 -5
- package/lib/cjs/popover.ws.js +15 -18
- package/lib/cjs/props.js +14 -0
- package/lib/cjs/sheet.js +34 -1
- package/lib/cjs/sheet.ws.js +33 -19
- package/lib/cjs/tabs.js +20 -1
- package/lib/cjs/tabs.ws.js +3 -25
- package/lib/cjs/textarea.js +28 -0
- package/lib/cjs/textarea.ws.js +98 -0
- package/lib/cjs/theme/tailwind-classes.js +186 -23
- package/lib/cjs/theme/tailwind-colors.js +10 -1
- package/lib/cjs/tooltip.js +36 -4
- package/lib/cjs/tooltip.ws.js +15 -18
- package/lib/collapsible.js +2 -16
- package/lib/collapsible.ws.js +1 -8
- package/lib/components.js +20 -0
- package/lib/dialog.js +38 -6
- package/lib/dialog.ws.js +15 -26
- package/lib/hooks.js +15 -1
- package/lib/input.js +8 -0
- package/lib/input.ws.js +75 -0
- package/lib/label.js +9 -0
- package/lib/label.ws.js +46 -0
- package/lib/metas.js +20 -0
- package/lib/popover.js +37 -5
- package/lib/popover.ws.js +15 -18
- package/lib/props.js +20 -0
- package/lib/sheet.js +34 -1
- package/lib/sheet.ws.js +33 -19
- package/lib/tabs.js +24 -2
- package/lib/tabs.ws.js +3 -25
- package/lib/textarea.js +8 -0
- package/lib/textarea.ws.js +70 -0
- package/lib/theme/tailwind-classes.js +191 -24
- package/lib/theme/tailwind-colors.js +10 -1
- package/lib/tooltip.js +36 -4
- package/lib/tooltip.ws.js +15 -18
- package/lib/types/__generated__/accordion.props.d.ts +6 -0
- package/lib/types/__generated__/button.props.d.ts +2 -0
- package/lib/types/__generated__/input.props.d.ts +2 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/textarea.props.d.ts +2 -0
- package/lib/types/accordion.d.ts +12 -0
- package/lib/types/accordion.ws.d.ts +11 -0
- package/lib/types/button.d.ts +7 -0
- package/lib/types/button.stories.d.ts +20 -0
- package/lib/types/button.ws.d.ts +7 -0
- package/lib/types/components.d.ts +5 -0
- package/lib/types/dialog.d.ts +5 -11
- package/lib/types/input.d.ts +2 -0
- package/lib/types/input.stories.d.ts +20 -0
- package/lib/types/input.ws.d.ts +3 -0
- package/lib/types/label.d.ts +3 -0
- package/lib/types/label.stories.d.ts +9 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +5 -0
- package/lib/types/popover.d.ts +4 -10
- package/lib/types/props.d.ts +5 -0
- package/lib/types/sheet.d.ts +4 -4
- package/lib/types/tabs.d.ts +2 -0
- package/lib/types/textarea.d.ts +2 -0
- package/lib/types/textarea.stories.d.ts +14 -0
- package/lib/types/textarea.ws.d.ts +3 -0
- package/lib/types/theme/tailwind-classes.d.ts +16 -5
- package/lib/types/theme/tailwind-colors.d.ts +9 -0
- package/lib/types/tooltip.d.ts +3 -9
- package/package.json +9 -7
- package/src/__generated__/accordion.props.ts +2382 -0
- package/src/__generated__/button.props.ts +503 -0
- package/src/__generated__/dialog.props.ts +0 -7
- package/src/__generated__/input.props.ts +500 -0
- package/src/__generated__/label.props.ts +470 -0
- package/src/__generated__/popover.props.ts +0 -7
- package/src/__generated__/sheet.props.ts +0 -7
- package/src/__generated__/textarea.props.ts +480 -0
- package/src/__generated__/tooltip.props.ts +0 -7
- package/src/accordion.stories.tsx +21 -0
- package/src/accordion.tsx +81 -0
- package/src/accordion.ws.ts +270 -0
- package/src/button.stories.ts +35 -0
- package/src/button.tsx +25 -0
- package/src/button.ws.ts +155 -0
- package/src/collapsible.tsx +2 -16
- package/src/collapsible.ws.ts +1 -8
- package/src/components.ts +11 -0
- package/src/dialog.stories.tsx +21 -0
- package/src/dialog.tsx +50 -24
- package/src/dialog.ws.tsx +15 -26
- package/src/hooks.ts +15 -1
- package/src/input.stories.ts +31 -0
- package/src/input.tsx +12 -0
- package/src/input.ws.ts +78 -0
- package/src/label.stories.ts +22 -0
- package/src/label.tsx +15 -0
- package/src/label.ws.ts +48 -0
- package/src/metas.ts +11 -0
- package/src/popover.stories.tsx +21 -0
- package/src/popover.tsx +49 -23
- package/src/popover.ws.tsx +15 -18
- package/src/props.ts +11 -0
- package/src/sheet.tsx +39 -0
- package/src/sheet.ws.tsx +33 -19
- package/src/tabs.tsx +32 -1
- package/src/tabs.ws.ts +1 -23
- package/src/textarea.stories.ts +27 -0
- package/src/textarea.tsx +12 -0
- package/src/textarea.ws.ts +74 -0
- package/src/theme/tailwind-classes.ts +233 -38
- package/src/theme/tailwind-colors.ts +9 -16
- package/src/tooltip.stories.tsx +21 -0
- package/src/tooltip.tsx +46 -20
- package/src/tooltip.ws.tsx +15 -18
package/lib/cjs/tooltip.js
CHANGED
|
@@ -30,15 +30,16 @@ var tooltip_exports = {};
|
|
|
30
30
|
__export(tooltip_exports, {
|
|
31
31
|
Tooltip: () => Tooltip,
|
|
32
32
|
TooltipContent: () => TooltipContent,
|
|
33
|
-
TooltipTrigger: () => TooltipTrigger
|
|
33
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
34
|
+
hooksTooltip: () => hooksTooltip
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(tooltip_exports);
|
|
36
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
38
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
39
|
+
var import_react_sdk = require("@webstudio-is/react-sdk");
|
|
38
40
|
var import_react = require("react");
|
|
39
|
-
const Tooltip = (0, import_react.forwardRef)((
|
|
40
|
-
|
|
41
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Root, { open, ...props }) });
|
|
41
|
+
const Tooltip = (0, import_react.forwardRef)((props, _ref) => {
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Root, { ...props }) });
|
|
42
43
|
});
|
|
43
44
|
const TooltipTrigger = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
|
|
44
45
|
const firstChild = import_react.Children.toArray(children)[0];
|
|
@@ -53,3 +54,34 @@ const TooltipContent = (0, import_react.forwardRef)(({ sideOffset = 4, hideWhenD
|
|
|
53
54
|
...props
|
|
54
55
|
}
|
|
55
56
|
) }));
|
|
57
|
+
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
58
|
+
const hooksTooltip = {
|
|
59
|
+
onNavigatorUnselect: (context, event) => {
|
|
60
|
+
for (const instance of event.instancePath) {
|
|
61
|
+
if (instance.component === `${namespace}:TooltipContent`) {
|
|
62
|
+
const tooltip = (0, import_react_sdk.getClosestInstance)(
|
|
63
|
+
event.instancePath,
|
|
64
|
+
instance,
|
|
65
|
+
`${namespace}:Tooltip`
|
|
66
|
+
);
|
|
67
|
+
if (tooltip) {
|
|
68
|
+
context.setPropVariable(tooltip.id, "open", false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
onNavigatorSelect: (context, event) => {
|
|
74
|
+
for (const instance of event.instancePath) {
|
|
75
|
+
if (instance.component === `${namespace}:TooltipContent`) {
|
|
76
|
+
const tooltip = (0, import_react_sdk.getClosestInstance)(
|
|
77
|
+
event.instancePath,
|
|
78
|
+
instance,
|
|
79
|
+
`${namespace}:Tooltip`
|
|
80
|
+
);
|
|
81
|
+
if (tooltip) {
|
|
82
|
+
context.setPropVariable(tooltip.id, "open", true);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
package/lib/cjs/tooltip.ws.js
CHANGED
|
@@ -41,32 +41,27 @@ var import_react_sdk = require("@webstudio-is/react-sdk");
|
|
|
41
41
|
var tc = __toESM(require("./theme/tailwind-classes"), 1);
|
|
42
42
|
var import_tooltip = require("./__generated__/tooltip.props");
|
|
43
43
|
var import_css_normalize = require("@webstudio-is/react-sdk/css-normalize");
|
|
44
|
+
var import_button = require("./button.ws");
|
|
44
45
|
const presetStyle = {
|
|
45
46
|
div: import_css_normalize.div
|
|
46
47
|
};
|
|
47
48
|
const metaTooltipTrigger = {
|
|
48
49
|
category: "hidden",
|
|
49
50
|
detachable: false,
|
|
50
|
-
invalidAncestors: [],
|
|
51
51
|
type: "container",
|
|
52
|
-
label: "Tooltip Trigger",
|
|
53
52
|
icon: import_svg.TriggerIcon,
|
|
54
53
|
stylable: false
|
|
55
54
|
};
|
|
56
55
|
const metaTooltipContent = {
|
|
57
56
|
category: "hidden",
|
|
58
57
|
detachable: false,
|
|
59
|
-
invalidAncestors: [],
|
|
60
58
|
type: "container",
|
|
61
59
|
presetStyle,
|
|
62
|
-
label: "Tooltip Content",
|
|
63
60
|
icon: import_svg.ContentIcon
|
|
64
61
|
};
|
|
65
62
|
const metaTooltip = {
|
|
66
63
|
category: "radix",
|
|
67
|
-
invalidAncestors: [],
|
|
68
64
|
type: "container",
|
|
69
|
-
label: "Tooltip",
|
|
70
65
|
icon: import_svg.TooltipIcon,
|
|
71
66
|
order: 15,
|
|
72
67
|
stylable: false,
|
|
@@ -75,14 +70,20 @@ const metaTooltip = {
|
|
|
75
70
|
type: "instance",
|
|
76
71
|
component: "Tooltip",
|
|
77
72
|
dataSources: {
|
|
78
|
-
|
|
79
|
-
isOpen: { type: "variable", initialValue: "initial" }
|
|
73
|
+
tooltipOpen: { type: "variable", initialValue: false }
|
|
80
74
|
},
|
|
81
75
|
props: [
|
|
82
76
|
{
|
|
83
77
|
type: "dataSource",
|
|
84
|
-
name: "
|
|
85
|
-
dataSourceName: "
|
|
78
|
+
name: "open",
|
|
79
|
+
dataSourceName: "tooltipOpen"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "onOpenChange",
|
|
83
|
+
type: "action",
|
|
84
|
+
value: [
|
|
85
|
+
{ type: "execute", args: ["open"], code: `tooltipOpen = open` }
|
|
86
|
+
]
|
|
86
87
|
}
|
|
87
88
|
],
|
|
88
89
|
children: [
|
|
@@ -90,13 +91,9 @@ const metaTooltip = {
|
|
|
90
91
|
type: "instance",
|
|
91
92
|
component: "TooltipTrigger",
|
|
92
93
|
props: [],
|
|
93
|
-
children:
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
component: "Button",
|
|
97
|
-
children: [{ type: "text", value: "Button" }]
|
|
98
|
-
}
|
|
99
|
-
]
|
|
94
|
+
children: (0, import_button.template)({
|
|
95
|
+
children: [{ type: "text", value: "Button" }]
|
|
96
|
+
})
|
|
100
97
|
},
|
|
101
98
|
{
|
|
102
99
|
type: "instance",
|
|
@@ -131,7 +128,7 @@ const metaTooltip = {
|
|
|
131
128
|
};
|
|
132
129
|
const propsMetaTooltip = {
|
|
133
130
|
props: import_tooltip.propsTooltip,
|
|
134
|
-
initialProps: ["
|
|
131
|
+
initialProps: ["open", "delayDuration", "disableHoverableContent"]
|
|
135
132
|
};
|
|
136
133
|
const propsMetaTooltipTrigger = {
|
|
137
134
|
props: import_tooltip.propsTooltipTrigger
|
package/lib/collapsible.js
CHANGED
|
@@ -13,25 +13,11 @@ const CollapsibleTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
|
13
13
|
const CollapsibleContent = Content;
|
|
14
14
|
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
15
15
|
const hooksCollapsible = {
|
|
16
|
-
onNavigatorUnselect: (context, event) => {
|
|
17
|
-
for (const instance of event.instanceSelection) {
|
|
18
|
-
if (instance.component === `${namespace}:CollapsibleContent`) {
|
|
19
|
-
const collapsible = getClosestInstance(
|
|
20
|
-
event.instanceSelection,
|
|
21
|
-
instance,
|
|
22
|
-
`${namespace}:Collapsible`
|
|
23
|
-
);
|
|
24
|
-
if (collapsible) {
|
|
25
|
-
context.setPropVariable(collapsible.id, "open", false);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
16
|
onNavigatorSelect: (context, event) => {
|
|
31
|
-
for (const instance of event.
|
|
17
|
+
for (const instance of event.instancePath) {
|
|
32
18
|
if (instance.component === `${namespace}:CollapsibleContent`) {
|
|
33
19
|
const collapsible = getClosestInstance(
|
|
34
|
-
event.
|
|
20
|
+
event.instancePath,
|
|
35
21
|
instance,
|
|
36
22
|
`${namespace}:Collapsible`
|
|
37
23
|
);
|
package/lib/collapsible.ws.js
CHANGED
|
@@ -16,7 +16,6 @@ const metaCollapsible = {
|
|
|
16
16
|
category: "radix",
|
|
17
17
|
type: "container",
|
|
18
18
|
presetStyle,
|
|
19
|
-
label: "Collapsible",
|
|
20
19
|
icon: CollapsibleIcon,
|
|
21
20
|
template: [
|
|
22
21
|
{
|
|
@@ -35,11 +34,7 @@ const metaCollapsible = {
|
|
|
35
34
|
name: "onOpenChange",
|
|
36
35
|
type: "action",
|
|
37
36
|
value: [
|
|
38
|
-
{
|
|
39
|
-
type: "execute",
|
|
40
|
-
args: ["open"],
|
|
41
|
-
code: `collapsibleOpen = open`
|
|
42
|
-
}
|
|
37
|
+
{ type: "execute", args: ["open"], code: `collapsibleOpen = open` }
|
|
43
38
|
]
|
|
44
39
|
}
|
|
45
40
|
],
|
|
@@ -73,7 +68,6 @@ const metaCollapsible = {
|
|
|
73
68
|
const metaCollapsibleTrigger = {
|
|
74
69
|
category: "hidden",
|
|
75
70
|
type: "container",
|
|
76
|
-
label: "Collapsible Trigger",
|
|
77
71
|
icon: TriggerIcon,
|
|
78
72
|
stylable: false,
|
|
79
73
|
detachable: false
|
|
@@ -82,7 +76,6 @@ const metaCollapsibleContent = {
|
|
|
82
76
|
category: "hidden",
|
|
83
77
|
type: "container",
|
|
84
78
|
presetStyle,
|
|
85
|
-
label: "Collapsible Content",
|
|
86
79
|
icon: ContentIcon,
|
|
87
80
|
detachable: false
|
|
88
81
|
};
|
package/lib/components.js
CHANGED
|
@@ -24,7 +24,24 @@ import {
|
|
|
24
24
|
SheetDescription
|
|
25
25
|
} from "./sheet";
|
|
26
26
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
|
|
27
|
+
import { Button } from "./button";
|
|
28
|
+
import { Input } from "./input";
|
|
29
|
+
import { Textarea } from "./textarea";
|
|
30
|
+
import { Label } from "./label";
|
|
31
|
+
import {
|
|
32
|
+
Accordion,
|
|
33
|
+
AccordionItem,
|
|
34
|
+
AccordionHeader,
|
|
35
|
+
AccordionTrigger,
|
|
36
|
+
AccordionContent
|
|
37
|
+
} from "./accordion";
|
|
27
38
|
export {
|
|
39
|
+
Accordion,
|
|
40
|
+
AccordionContent,
|
|
41
|
+
AccordionHeader,
|
|
42
|
+
AccordionItem,
|
|
43
|
+
AccordionTrigger,
|
|
44
|
+
Button,
|
|
28
45
|
Collapsible,
|
|
29
46
|
CollapsibleContent,
|
|
30
47
|
CollapsibleTrigger,
|
|
@@ -35,6 +52,8 @@ export {
|
|
|
35
52
|
DialogOverlay,
|
|
36
53
|
DialogTitle,
|
|
37
54
|
DialogTrigger,
|
|
55
|
+
Input,
|
|
56
|
+
Label,
|
|
38
57
|
Popover,
|
|
39
58
|
PopoverContent,
|
|
40
59
|
PopoverTrigger,
|
|
@@ -49,6 +68,7 @@ export {
|
|
|
49
68
|
TabsContent,
|
|
50
69
|
TabsList,
|
|
51
70
|
TabsTrigger,
|
|
71
|
+
Textarea,
|
|
52
72
|
Tooltip,
|
|
53
73
|
TooltipContent,
|
|
54
74
|
TooltipTrigger
|
package/lib/dialog.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
2
|
import {
|
|
4
3
|
forwardRef,
|
|
5
4
|
Children
|
|
6
5
|
} from "react";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
7
|
+
import { getClosestInstance } from "@webstudio-is/react-sdk";
|
|
8
|
+
const Dialog = forwardRef((props, _ref) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...props });
|
|
10
10
|
});
|
|
11
11
|
const DialogTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
12
12
|
const firstChild = Children.toArray(children)[0];
|
|
13
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { asChild: true, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
|
|
13
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { ref, asChild: true, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
|
|
14
14
|
});
|
|
15
15
|
const DialogOverlay = forwardRef((props, ref) => {
|
|
16
16
|
return /* @__PURE__ */ jsx(DialogPrimitive.DialogPortal, { children: /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { ref, ...props }) });
|
|
@@ -19,6 +19,37 @@ const DialogContent = DialogPrimitive.Content;
|
|
|
19
19
|
const DialogClose = DialogPrimitive.Close;
|
|
20
20
|
const DialogTitle = DialogPrimitive.Title;
|
|
21
21
|
const DialogDescription = DialogPrimitive.Description;
|
|
22
|
+
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
23
|
+
const hooksDialog = {
|
|
24
|
+
onNavigatorUnselect: (context, event) => {
|
|
25
|
+
for (const instance of event.instancePath) {
|
|
26
|
+
if (instance.component === `${namespace}:DialogOverlay`) {
|
|
27
|
+
const dialog = getClosestInstance(
|
|
28
|
+
event.instancePath,
|
|
29
|
+
instance,
|
|
30
|
+
`${namespace}:Dialog`
|
|
31
|
+
);
|
|
32
|
+
if (dialog) {
|
|
33
|
+
context.setPropVariable(dialog.id, "open", false);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onNavigatorSelect: (context, event) => {
|
|
39
|
+
for (const instance of event.instancePath) {
|
|
40
|
+
if (instance.component === `${namespace}:DialogOverlay`) {
|
|
41
|
+
const dialog = getClosestInstance(
|
|
42
|
+
event.instancePath,
|
|
43
|
+
instance,
|
|
44
|
+
`${namespace}:Dialog`
|
|
45
|
+
);
|
|
46
|
+
if (dialog) {
|
|
47
|
+
context.setPropVariable(dialog.id, "open", true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
22
53
|
export {
|
|
23
54
|
Dialog,
|
|
24
55
|
DialogClose,
|
|
@@ -26,5 +57,6 @@ export {
|
|
|
26
57
|
DialogDescription,
|
|
27
58
|
DialogOverlay,
|
|
28
59
|
DialogTitle,
|
|
29
|
-
DialogTrigger
|
|
60
|
+
DialogTrigger,
|
|
61
|
+
hooksDialog
|
|
30
62
|
};
|
package/lib/dialog.ws.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
propsDialogTitle,
|
|
20
20
|
propsDialogDescription
|
|
21
21
|
} from "./__generated__/dialog.props";
|
|
22
|
+
import { template as buttonTemplate } from "./button.ws";
|
|
22
23
|
import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
|
|
23
24
|
const presetStyle = {
|
|
24
25
|
div
|
|
@@ -34,60 +35,46 @@ const descriptionPresetStyle = {
|
|
|
34
35
|
};
|
|
35
36
|
const metaDialogTrigger = {
|
|
36
37
|
category: "hidden",
|
|
37
|
-
invalidAncestors: [],
|
|
38
38
|
type: "container",
|
|
39
|
-
label: "Dialog Trigger",
|
|
40
39
|
icon: TriggerIcon,
|
|
41
40
|
stylable: false,
|
|
42
41
|
detachable: false
|
|
43
42
|
};
|
|
44
43
|
const metaDialogContent = {
|
|
45
44
|
category: "hidden",
|
|
46
|
-
invalidAncestors: [],
|
|
47
45
|
type: "container",
|
|
48
|
-
label: "Dialog Content",
|
|
49
46
|
presetStyle,
|
|
50
47
|
icon: ContentIcon,
|
|
51
48
|
detachable: false
|
|
52
49
|
};
|
|
53
50
|
const metaDialogOverlay = {
|
|
54
51
|
category: "hidden",
|
|
55
|
-
invalidAncestors: [],
|
|
56
52
|
type: "container",
|
|
57
|
-
label: "Dialog Overlay",
|
|
58
53
|
presetStyle,
|
|
59
54
|
icon: OverlayIcon,
|
|
60
55
|
detachable: false
|
|
61
56
|
};
|
|
62
57
|
const metaDialogTitle = {
|
|
63
58
|
category: "hidden",
|
|
64
|
-
invalidAncestors: [],
|
|
65
59
|
type: "container",
|
|
66
60
|
presetStyle: titlePresetStyle,
|
|
67
|
-
label: "Dialog Title",
|
|
68
61
|
icon: HeadingIcon
|
|
69
62
|
};
|
|
70
63
|
const metaDialogDescription = {
|
|
71
64
|
category: "hidden",
|
|
72
|
-
invalidAncestors: [],
|
|
73
65
|
type: "container",
|
|
74
66
|
presetStyle: descriptionPresetStyle,
|
|
75
|
-
label: "Dialog Description",
|
|
76
67
|
icon: TextIcon
|
|
77
68
|
};
|
|
78
69
|
const metaDialogClose = {
|
|
79
70
|
category: "hidden",
|
|
80
|
-
invalidAncestors: [],
|
|
81
71
|
type: "container",
|
|
82
72
|
presetStyle: buttonPresetStyle,
|
|
83
|
-
label: "Dialog Close",
|
|
84
73
|
icon: ButtonElementIcon
|
|
85
74
|
};
|
|
86
75
|
const metaDialog = {
|
|
87
76
|
category: "radix",
|
|
88
|
-
invalidAncestors: [],
|
|
89
77
|
type: "container",
|
|
90
|
-
label: "Dialog",
|
|
91
78
|
icon: DialogIcon,
|
|
92
79
|
order: 15,
|
|
93
80
|
stylable: false,
|
|
@@ -96,14 +83,20 @@ const metaDialog = {
|
|
|
96
83
|
type: "instance",
|
|
97
84
|
component: "Dialog",
|
|
98
85
|
dataSources: {
|
|
99
|
-
|
|
100
|
-
isOpen: { type: "variable", initialValue: "initial" }
|
|
86
|
+
dialogOpen: { type: "variable", initialValue: false }
|
|
101
87
|
},
|
|
102
88
|
props: [
|
|
103
89
|
{
|
|
104
90
|
type: "dataSource",
|
|
105
|
-
name: "
|
|
106
|
-
dataSourceName: "
|
|
91
|
+
name: "open",
|
|
92
|
+
dataSourceName: "dialogOpen"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "onOpenChange",
|
|
96
|
+
type: "action",
|
|
97
|
+
value: [
|
|
98
|
+
{ type: "execute", args: ["open"], code: `dialogOpen = open` }
|
|
99
|
+
]
|
|
107
100
|
}
|
|
108
101
|
],
|
|
109
102
|
children: [
|
|
@@ -111,13 +104,9 @@ const metaDialog = {
|
|
|
111
104
|
type: "instance",
|
|
112
105
|
component: "DialogTrigger",
|
|
113
106
|
props: [],
|
|
114
|
-
children:
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
component: "Button",
|
|
118
|
-
children: [{ type: "text", value: "Button" }]
|
|
119
|
-
}
|
|
120
|
-
]
|
|
107
|
+
children: buttonTemplate({
|
|
108
|
+
children: [{ type: "text", value: "Button" }]
|
|
109
|
+
})
|
|
121
110
|
},
|
|
122
111
|
{
|
|
123
112
|
type: "instance",
|
|
@@ -255,7 +244,7 @@ const metaDialog = {
|
|
|
255
244
|
};
|
|
256
245
|
const propsMetaDialog = {
|
|
257
246
|
props: propsDialog,
|
|
258
|
-
initialProps: ["
|
|
247
|
+
initialProps: ["open", "modal"]
|
|
259
248
|
};
|
|
260
249
|
const propsMetaDialogTrigger = {
|
|
261
250
|
props: propsDialogTrigger
|
package/lib/hooks.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { hooksCollapsible } from "./collapsible";
|
|
2
|
-
|
|
2
|
+
import { hooksTabs } from "./tabs";
|
|
3
|
+
import { hooksDialog } from "./dialog";
|
|
4
|
+
import { hooksPopover } from "./popover";
|
|
5
|
+
import { hooksSheet } from "./sheet";
|
|
6
|
+
import { hooksTooltip } from "./tooltip";
|
|
7
|
+
import { hooksAccordion } from "./accordion";
|
|
8
|
+
const hooks = [
|
|
9
|
+
hooksCollapsible,
|
|
10
|
+
hooksTabs,
|
|
11
|
+
hooksDialog,
|
|
12
|
+
hooksPopover,
|
|
13
|
+
hooksSheet,
|
|
14
|
+
hooksTooltip,
|
|
15
|
+
hooksAccordion
|
|
16
|
+
];
|
|
3
17
|
export {
|
|
4
18
|
hooks
|
|
5
19
|
};
|
package/lib/input.js
ADDED
package/lib/input.ws.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { FormTextFieldIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "@webstudio-is/react-sdk";
|
|
5
|
+
import { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
6
|
+
import { props } from "./__generated__/input.props";
|
|
7
|
+
import * as tc from "./theme/tailwind-classes";
|
|
8
|
+
const presetStyle = {
|
|
9
|
+
input
|
|
10
|
+
};
|
|
11
|
+
const meta = {
|
|
12
|
+
category: "radix",
|
|
13
|
+
type: "control",
|
|
14
|
+
invalidAncestors: ["Button"],
|
|
15
|
+
icon: FormTextFieldIcon,
|
|
16
|
+
presetStyle,
|
|
17
|
+
states: [
|
|
18
|
+
...defaultStates,
|
|
19
|
+
{ selector: ":disabled", label: "Disabled" },
|
|
20
|
+
{ selector: "::placeholder", label: "Placeholder" },
|
|
21
|
+
{ selector: "::file-selector-button", label: "File Selector Button" },
|
|
22
|
+
// @todo share https://github.com/webstudio-is/webstudio-builder/issues/2102
|
|
23
|
+
{ selector: ":valid", label: "Valid" },
|
|
24
|
+
{ selector: ":invalid", label: "Invalid" },
|
|
25
|
+
{ selector: ":required", label: "Required" },
|
|
26
|
+
{ selector: ":optional", label: "Optional" },
|
|
27
|
+
{ selector: ":enabled", label: "Enabled" },
|
|
28
|
+
{ selector: ":read-only", label: "Read Only" },
|
|
29
|
+
{ selector: ":read-write", label: "Read Write" }
|
|
30
|
+
],
|
|
31
|
+
order: 1,
|
|
32
|
+
template: [
|
|
33
|
+
{
|
|
34
|
+
type: "instance",
|
|
35
|
+
component: "Input",
|
|
36
|
+
styles: [
|
|
37
|
+
// flex h-10 w-full rounded-md border border-input bg-background
|
|
38
|
+
// px-3 py-2 text-sm
|
|
39
|
+
// ring-offset-background
|
|
40
|
+
// file:border-0 file:bg-transparent file:text-sm file:font-medium
|
|
41
|
+
// placeholder:text-muted-foreground
|
|
42
|
+
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
43
|
+
// disabled:cursor-not-allowed disabled:opacity-50"
|
|
44
|
+
tc.flex(),
|
|
45
|
+
tc.h(10),
|
|
46
|
+
tc.w("full"),
|
|
47
|
+
tc.rounded("md"),
|
|
48
|
+
tc.border(),
|
|
49
|
+
tc.border("input"),
|
|
50
|
+
tc.bg("background"),
|
|
51
|
+
tc.px(3),
|
|
52
|
+
tc.py(2),
|
|
53
|
+
tc.text("sm"),
|
|
54
|
+
tc.state(
|
|
55
|
+
[tc.border(0), tc.bg("transparent"), tc.font("medium")].flat(),
|
|
56
|
+
"::file-selector-button"
|
|
57
|
+
),
|
|
58
|
+
tc.state(tc.text("mutedForeground"), "::placeholder"),
|
|
59
|
+
tc.focusVisible(
|
|
60
|
+
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
61
|
+
),
|
|
62
|
+
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
|
|
63
|
+
].flat(),
|
|
64
|
+
children: []
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
const propsMeta = {
|
|
69
|
+
props,
|
|
70
|
+
initialProps: ["id", "name", "type", "placeholder", "required", "autoFocus"]
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
meta,
|
|
74
|
+
propsMeta
|
|
75
|
+
};
|
package/lib/label.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
6
|
+
const Label = forwardRef((props, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, ...props }));
|
|
7
|
+
export {
|
|
8
|
+
Label
|
|
9
|
+
};
|
package/lib/label.ws.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LabelIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "@webstudio-is/react-sdk";
|
|
5
|
+
import { label } from "@webstudio-is/react-sdk/css-normalize";
|
|
6
|
+
import { props } from "./__generated__/label.props";
|
|
7
|
+
import * as tc from "./theme/tailwind-classes";
|
|
8
|
+
const presetStyle = {
|
|
9
|
+
label
|
|
10
|
+
};
|
|
11
|
+
const meta = {
|
|
12
|
+
category: "radix",
|
|
13
|
+
type: "container",
|
|
14
|
+
icon: LabelIcon,
|
|
15
|
+
presetStyle,
|
|
16
|
+
states: defaultStates,
|
|
17
|
+
order: 1,
|
|
18
|
+
template: [
|
|
19
|
+
{
|
|
20
|
+
type: "instance",
|
|
21
|
+
component: "Label",
|
|
22
|
+
styles: [
|
|
23
|
+
// text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70
|
|
24
|
+
tc.text("sm"),
|
|
25
|
+
tc.font("medium"),
|
|
26
|
+
tc.leading("none")
|
|
27
|
+
// We are not supporting peer like styles yet
|
|
28
|
+
].flat(),
|
|
29
|
+
children: [{ type: "text", value: "Form Label" }]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
const propsMeta = {
|
|
34
|
+
props: {
|
|
35
|
+
...props,
|
|
36
|
+
htmlFor: {
|
|
37
|
+
...props.htmlFor,
|
|
38
|
+
label: "For"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
initialProps: ["id", "htmlFor"]
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
meta,
|
|
45
|
+
propsMeta
|
|
46
|
+
};
|
package/lib/metas.js
CHANGED
|
@@ -37,7 +37,24 @@ import {
|
|
|
37
37
|
metaTabsTrigger,
|
|
38
38
|
metaTabsContent
|
|
39
39
|
} from "./tabs.ws";
|
|
40
|
+
import { meta } from "./button.ws";
|
|
41
|
+
import { meta as meta2 } from "./input.ws";
|
|
42
|
+
import { meta as meta3 } from "./textarea.ws";
|
|
43
|
+
import { meta as meta4 } from "./label.ws";
|
|
44
|
+
import {
|
|
45
|
+
metaAccordion,
|
|
46
|
+
metaAccordionItem,
|
|
47
|
+
metaAccordionHeader,
|
|
48
|
+
metaAccordionTrigger,
|
|
49
|
+
metaAccordionContent
|
|
50
|
+
} from "./accordion.ws";
|
|
40
51
|
export {
|
|
52
|
+
metaAccordion as Accordion,
|
|
53
|
+
metaAccordionContent as AccordionContent,
|
|
54
|
+
metaAccordionHeader as AccordionHeader,
|
|
55
|
+
metaAccordionItem as AccordionItem,
|
|
56
|
+
metaAccordionTrigger as AccordionTrigger,
|
|
57
|
+
meta as Button,
|
|
41
58
|
metaCollapsible as Collapsible,
|
|
42
59
|
metaCollapsibleContent as CollapsibleContent,
|
|
43
60
|
metaCollapsibleTrigger as CollapsibleTrigger,
|
|
@@ -48,6 +65,8 @@ export {
|
|
|
48
65
|
metaDialogOverlay as DialogOverlay,
|
|
49
66
|
metaDialogTitle as DialogTitle,
|
|
50
67
|
metaDialogTrigger as DialogTrigger,
|
|
68
|
+
meta2 as Input,
|
|
69
|
+
meta4 as Label,
|
|
51
70
|
metaPopover as Popover,
|
|
52
71
|
metaPopoverContent as PopoverContent,
|
|
53
72
|
metaPopoverTrigger as PopoverTrigger,
|
|
@@ -62,6 +81,7 @@ export {
|
|
|
62
81
|
metaTabsContent as TabsContent,
|
|
63
82
|
metaTabsList as TabsList,
|
|
64
83
|
metaTabsTrigger as TabsTrigger,
|
|
84
|
+
meta3 as Textarea,
|
|
65
85
|
metaTooltip as Tooltip,
|
|
66
86
|
metaTooltipContent as TooltipContent,
|
|
67
87
|
metaTooltipTrigger as TooltipTrigger
|