@webstudio-is/sdk-components-react-radix 0.95.0 → 0.97.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/components.js +278 -35
- package/lib/hooks.js +475 -11
- package/lib/metas.js +4616 -58
- package/lib/props.js +23280 -57
- package/lib/types/theme/tailwind-classes.d.ts +4 -4
- package/package.json +9 -9
- package/lib/__generated__/accordion.props.js +0 -2619
- package/lib/__generated__/checkbox.props.js +0 -1080
- package/lib/__generated__/collapsible.props.js +0 -1026
- package/lib/__generated__/dialog.props.js +0 -2595
- package/lib/__generated__/label.props.js +0 -519
- package/lib/__generated__/navigation-menu.props.js +0 -2557
- package/lib/__generated__/popover.props.js +0 -558
- package/lib/__generated__/radio-group.props.js +0 -1623
- package/lib/__generated__/select.props.js +0 -3674
- package/lib/__generated__/sheet.props.js +0 -2614
- package/lib/__generated__/switch.props.js +0 -1080
- package/lib/__generated__/tabs.props.js +0 -2119
- package/lib/__generated__/tooltip.props.js +0 -569
- package/lib/accordion.js +0 -51
- package/lib/accordion.stories.js +0 -18
- package/lib/accordion.ws.js +0 -259
- package/lib/checkbox.js +0 -10
- package/lib/checkbox.stories.js +0 -19
- package/lib/checkbox.ws.js +0 -148
- package/lib/collapsible.js +0 -31
- package/lib/collapsible.stories.js +0 -18
- package/lib/collapsible.ws.js +0 -103
- package/lib/dialog.js +0 -53
- package/lib/dialog.stories.js +0 -18
- package/lib/dialog.ws.js +0 -289
- package/lib/label.js +0 -7
- package/lib/label.stories.js +0 -19
- package/lib/label.ws.js +0 -44
- package/lib/navigation-menu.js +0 -76
- package/lib/navigation-menu.stories.js +0 -18
- package/lib/navigation-menu.ws.js +0 -486
- package/lib/popover.js +0 -58
- package/lib/popover.stories.js +0 -18
- package/lib/popover.ws.js +0 -110
- package/lib/props-descriptions.js +0 -34
- package/lib/radio-group.js +0 -7
- package/lib/radio-group.stories.js +0 -19
- package/lib/radio-group.ws.js +0 -166
- package/lib/select.js +0 -65
- package/lib/select.stories.js +0 -18
- package/lib/select.ws.js +0 -321
- package/lib/sheet.js +0 -59
- package/lib/sheet.stories.js +0 -18
- package/lib/sheet.ws.js +0 -225
- package/lib/switch.js +0 -4
- package/lib/switch.stories.js +0 -19
- package/lib/switch.ws.js +0 -140
- package/lib/tabs.js +0 -38
- package/lib/tabs.stories.js +0 -18
- package/lib/tabs.ws.js +0 -169
- package/lib/theme/__generated__/tailwind-theme.js +0 -517
- package/lib/theme/styles.js +0 -63
- package/lib/theme/tailwind-classes.js +0 -651
- package/lib/theme/tailwind-colors.js +0 -23
- package/lib/tooltip.js +0 -55
- package/lib/tooltip.stories.js +0 -18
- package/lib/tooltip.ws.js +0 -111
package/lib/radio-group.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { renderComponentTemplate } from "@webstudio-is/react-sdk";
|
|
3
|
-
import * as baseComponents from "@webstudio-is/sdk-components-react";
|
|
4
|
-
import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
|
|
5
|
-
import * as radixComponents from "./components";
|
|
6
|
-
import * as radixMetas from "./metas";
|
|
7
|
-
import { RadioGroup as RadioGroupPrimitive } from "./radio-group";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/RadioGroup",
|
|
10
|
-
component: RadioGroupPrimitive
|
|
11
|
-
};
|
|
12
|
-
export const RadioGroup = {
|
|
13
|
-
render: (props) => renderComponentTemplate({
|
|
14
|
-
name: "RadioGroup",
|
|
15
|
-
props: { ...props },
|
|
16
|
-
components: { ...baseComponents, ...radixComponents },
|
|
17
|
-
metas: { ...baseMetas, ...radixMetas }
|
|
18
|
-
})
|
|
19
|
-
};
|
package/lib/radio-group.ws.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
ItemIcon,
|
|
4
|
-
RadioCheckedIcon,
|
|
5
|
-
RadioDotIcon,
|
|
6
|
-
TriggerIcon
|
|
7
|
-
} from "@webstudio-is/icons/svg";
|
|
8
|
-
import {
|
|
9
|
-
defaultStates,
|
|
10
|
-
WsEmbedTemplate
|
|
11
|
-
} from "@webstudio-is/react-sdk";
|
|
12
|
-
import { button, div, span } from "@webstudio-is/react-sdk/css-normalize";
|
|
13
|
-
import * as tc from "./theme/tailwind-classes";
|
|
14
|
-
import { buttonReset } from "./theme/styles";
|
|
15
|
-
import {
|
|
16
|
-
propsRadioGroup,
|
|
17
|
-
propsRadioGroupIndicator,
|
|
18
|
-
propsRadioGroupItem
|
|
19
|
-
} from "./__generated__/radio-group.props";
|
|
20
|
-
const createRadioGroupItem = ({
|
|
21
|
-
value,
|
|
22
|
-
label
|
|
23
|
-
}) => ({
|
|
24
|
-
type: "instance",
|
|
25
|
-
component: "Label",
|
|
26
|
-
// flex items-center space-x-2
|
|
27
|
-
styles: [tc.flex(), tc.items("center"), tc.gap(2)].flat(),
|
|
28
|
-
children: [
|
|
29
|
-
{
|
|
30
|
-
type: "instance",
|
|
31
|
-
component: "RadioGroupItem",
|
|
32
|
-
props: [{ name: "value", type: "string", value }],
|
|
33
|
-
// aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background
|
|
34
|
-
// focus:outline-none
|
|
35
|
-
// focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
36
|
-
// disabled:cursor-not-allowed disabled:opacity-50
|
|
37
|
-
styles: [
|
|
38
|
-
tc.aspect("square"),
|
|
39
|
-
tc.h(4),
|
|
40
|
-
tc.w(4),
|
|
41
|
-
tc.rounded("full"),
|
|
42
|
-
tc.border(),
|
|
43
|
-
tc.border("primary"),
|
|
44
|
-
tc.text("primary"),
|
|
45
|
-
tc.focusVisible(
|
|
46
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
47
|
-
),
|
|
48
|
-
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
|
|
49
|
-
].flat(),
|
|
50
|
-
children: [
|
|
51
|
-
{
|
|
52
|
-
type: "instance",
|
|
53
|
-
component: "RadioGroupIndicator",
|
|
54
|
-
children: [
|
|
55
|
-
{
|
|
56
|
-
type: "instance",
|
|
57
|
-
component: "HtmlEmbed",
|
|
58
|
-
label: "Indicator Icon",
|
|
59
|
-
props: [
|
|
60
|
-
{
|
|
61
|
-
type: "string",
|
|
62
|
-
name: "code",
|
|
63
|
-
value: RadioDotIcon
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
children: []
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "instance",
|
|
74
|
-
component: "Text",
|
|
75
|
-
children: [{ type: "text", value: label }]
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
export const metaRadioGroup = {
|
|
80
|
-
category: "radix",
|
|
81
|
-
order: 100,
|
|
82
|
-
type: "container",
|
|
83
|
-
description: "A set of checkable buttons\u2014known as radio buttons\u2014where no more than one of the buttons can be checked at a time.",
|
|
84
|
-
icon: RadioCheckedIcon,
|
|
85
|
-
states: [
|
|
86
|
-
...defaultStates,
|
|
87
|
-
{
|
|
88
|
-
label: "Checked",
|
|
89
|
-
selector: "[data-state=checked]",
|
|
90
|
-
category: "component-states"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: "Unchecked",
|
|
94
|
-
selector: "[data-state=unchecked]",
|
|
95
|
-
category: "component-states"
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
presetStyle: {
|
|
99
|
-
div
|
|
100
|
-
},
|
|
101
|
-
template: [
|
|
102
|
-
{
|
|
103
|
-
type: "instance",
|
|
104
|
-
component: "RadioGroup",
|
|
105
|
-
dataSources: {
|
|
106
|
-
radioGroupValue: { type: "variable", initialValue: "" }
|
|
107
|
-
},
|
|
108
|
-
// grid gap-2
|
|
109
|
-
styles: [tc.flex(), tc.flex("col"), tc.gap(2)].flat(),
|
|
110
|
-
props: [
|
|
111
|
-
{
|
|
112
|
-
type: "dataSource",
|
|
113
|
-
name: "value",
|
|
114
|
-
dataSourceName: "radioGroupValue"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "onValueChange",
|
|
118
|
-
type: "action",
|
|
119
|
-
value: [
|
|
120
|
-
{
|
|
121
|
-
type: "execute",
|
|
122
|
-
args: ["value"],
|
|
123
|
-
code: `radioGroupValue = value`
|
|
124
|
-
}
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
children: [
|
|
129
|
-
createRadioGroupItem({ value: "default", label: "Default" }),
|
|
130
|
-
createRadioGroupItem({ value: "comfortable", label: "Comfortable" }),
|
|
131
|
-
createRadioGroupItem({ value: "compact", label: "Compact" })
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
};
|
|
136
|
-
export const metaRadioGroupItem = {
|
|
137
|
-
category: "hidden",
|
|
138
|
-
type: "container",
|
|
139
|
-
requiredAncestors: ["RadioGroup"],
|
|
140
|
-
icon: ItemIcon,
|
|
141
|
-
states: defaultStates,
|
|
142
|
-
presetStyle: {
|
|
143
|
-
button: [button, buttonReset].flat()
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
export const metaRadioGroupIndicator = {
|
|
147
|
-
category: "hidden",
|
|
148
|
-
type: "container",
|
|
149
|
-
detachable: false,
|
|
150
|
-
icon: TriggerIcon,
|
|
151
|
-
states: defaultStates,
|
|
152
|
-
presetStyle: {
|
|
153
|
-
span
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
export const propsMetaRadioGroup = {
|
|
157
|
-
props: propsRadioGroup,
|
|
158
|
-
initialProps: ["id", "value", "name", "required"]
|
|
159
|
-
};
|
|
160
|
-
export const propsMetaRadioGroupItem = {
|
|
161
|
-
props: propsRadioGroupItem,
|
|
162
|
-
initialProps: ["value"]
|
|
163
|
-
};
|
|
164
|
-
export const propsMetaRadioGroupIndicator = {
|
|
165
|
-
props: propsRadioGroupIndicator
|
|
166
|
-
};
|
package/lib/select.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef
|
|
5
|
-
} from "react";
|
|
6
|
-
import {
|
|
7
|
-
Root,
|
|
8
|
-
Value,
|
|
9
|
-
Trigger,
|
|
10
|
-
Content,
|
|
11
|
-
Item,
|
|
12
|
-
ItemIndicator,
|
|
13
|
-
ItemText,
|
|
14
|
-
Portal,
|
|
15
|
-
Viewport
|
|
16
|
-
} from "@radix-ui/react-select";
|
|
17
|
-
import { getClosestInstance } from "@webstudio-is/react-sdk";
|
|
18
|
-
export const Select = forwardRef(({ value, ...props }, _ref) => {
|
|
19
|
-
if (value === "") {
|
|
20
|
-
value = void 0;
|
|
21
|
-
}
|
|
22
|
-
return /* @__PURE__ */ jsx(Root, { value, ...props });
|
|
23
|
-
});
|
|
24
|
-
export const SelectTrigger = Trigger;
|
|
25
|
-
export const SelectValue = forwardRef((props, ref) => {
|
|
26
|
-
return /* @__PURE__ */ jsx(Value, { ref, ...props });
|
|
27
|
-
});
|
|
28
|
-
export const SelectContent = forwardRef((props, ref) => {
|
|
29
|
-
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { ref, ...props, position: "popper" }) });
|
|
30
|
-
});
|
|
31
|
-
export const SelectViewport = Viewport;
|
|
32
|
-
export const SelectItem = Item;
|
|
33
|
-
export const SelectItemIndicator = ItemIndicator;
|
|
34
|
-
export const SelectItemText = ItemText;
|
|
35
|
-
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
36
|
-
export const hooksSelect = {
|
|
37
|
-
onNavigatorUnselect: (context, event) => {
|
|
38
|
-
for (const instance of event.instancePath) {
|
|
39
|
-
if (instance.component === `${namespace}:SelectContent`) {
|
|
40
|
-
const select = getClosestInstance(
|
|
41
|
-
event.instancePath,
|
|
42
|
-
instance,
|
|
43
|
-
`${namespace}:Select`
|
|
44
|
-
);
|
|
45
|
-
if (select) {
|
|
46
|
-
context.setPropVariable(select.id, "open", false);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
onNavigatorSelect: (context, event) => {
|
|
52
|
-
for (const instance of event.instancePath) {
|
|
53
|
-
if (instance.component === `${namespace}:SelectContent`) {
|
|
54
|
-
const select = getClosestInstance(
|
|
55
|
-
event.instancePath,
|
|
56
|
-
instance,
|
|
57
|
-
`${namespace}:Select`
|
|
58
|
-
);
|
|
59
|
-
if (select) {
|
|
60
|
-
context.setPropVariable(select.id, "open", true);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
package/lib/select.stories.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { renderComponentTemplate } from "@webstudio-is/react-sdk";
|
|
3
|
-
import { Select as SelectPrimitive } from "./select";
|
|
4
|
-
import * as baseComponents from "@webstudio-is/sdk-components-react";
|
|
5
|
-
import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
|
|
6
|
-
import * as radixComponents from "./components";
|
|
7
|
-
import * as radixMetas from "./metas";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/Select",
|
|
10
|
-
component: SelectPrimitive
|
|
11
|
-
};
|
|
12
|
-
export const Select = {
|
|
13
|
-
render: () => renderComponentTemplate({
|
|
14
|
-
name: "Select",
|
|
15
|
-
components: { ...baseComponents, ...radixComponents },
|
|
16
|
-
metas: { ...baseMetas, ...radixMetas }
|
|
17
|
-
})
|
|
18
|
-
};
|
package/lib/select.ws.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
SelectIcon,
|
|
4
|
-
TriggerIcon,
|
|
5
|
-
FormTextFieldIcon,
|
|
6
|
-
ContentIcon,
|
|
7
|
-
ItemIcon,
|
|
8
|
-
ViewportIcon,
|
|
9
|
-
TextIcon,
|
|
10
|
-
CheckMarkIcon
|
|
11
|
-
} from "@webstudio-is/icons/svg";
|
|
12
|
-
import { button, div, span } from "@webstudio-is/react-sdk/css-normalize";
|
|
13
|
-
import * as tc from "./theme/tailwind-classes";
|
|
14
|
-
import {
|
|
15
|
-
propsSelect,
|
|
16
|
-
propsSelectContent,
|
|
17
|
-
propsSelectItem,
|
|
18
|
-
propsSelectItemIndicator,
|
|
19
|
-
propsSelectItemText,
|
|
20
|
-
propsSelectTrigger,
|
|
21
|
-
propsSelectValue,
|
|
22
|
-
propsSelectViewport
|
|
23
|
-
} from "./__generated__/select.props";
|
|
24
|
-
const presetStyle = {
|
|
25
|
-
div
|
|
26
|
-
};
|
|
27
|
-
const createSelectItem = ({
|
|
28
|
-
props,
|
|
29
|
-
children
|
|
30
|
-
}) => ({
|
|
31
|
-
type: "instance",
|
|
32
|
-
component: "SelectItem",
|
|
33
|
-
props,
|
|
34
|
-
// relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none
|
|
35
|
-
// focus:bg-accent focus:text-accent-foreground
|
|
36
|
-
// data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
|
37
|
-
styles: [
|
|
38
|
-
tc.relative(),
|
|
39
|
-
tc.flex(),
|
|
40
|
-
tc.w("full"),
|
|
41
|
-
tc.cursor("default"),
|
|
42
|
-
tc.select("none"),
|
|
43
|
-
tc.items("center"),
|
|
44
|
-
tc.rounded("md"),
|
|
45
|
-
tc.py(1.5),
|
|
46
|
-
tc.pl(8),
|
|
47
|
-
tc.pr(2),
|
|
48
|
-
tc.text("sm"),
|
|
49
|
-
tc.outline("none"),
|
|
50
|
-
tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat()),
|
|
51
|
-
tc.state(
|
|
52
|
-
[tc.pointerEvents("none"), tc.opacity(50)].flat(),
|
|
53
|
-
"[data-disabled]"
|
|
54
|
-
)
|
|
55
|
-
].flat(),
|
|
56
|
-
children: [
|
|
57
|
-
{
|
|
58
|
-
type: "instance",
|
|
59
|
-
component: "SelectItemIndicator",
|
|
60
|
-
// absolute left-2 flex h-3.5 w-3.5 items-center justify-center
|
|
61
|
-
styles: [
|
|
62
|
-
tc.absolute(),
|
|
63
|
-
tc.left(2),
|
|
64
|
-
tc.flex(),
|
|
65
|
-
tc.h(3.5),
|
|
66
|
-
tc.w(3.5),
|
|
67
|
-
tc.items("center"),
|
|
68
|
-
tc.justify("center")
|
|
69
|
-
].flat(),
|
|
70
|
-
children: [
|
|
71
|
-
{
|
|
72
|
-
type: "instance",
|
|
73
|
-
component: "HtmlEmbed",
|
|
74
|
-
label: "Indicator Icon",
|
|
75
|
-
props: [
|
|
76
|
-
{
|
|
77
|
-
type: "string",
|
|
78
|
-
name: "code",
|
|
79
|
-
value: CheckMarkIcon
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
children: []
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
type: "instance",
|
|
88
|
-
component: "SelectItemText",
|
|
89
|
-
children
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
});
|
|
93
|
-
export const metaSelect = {
|
|
94
|
-
category: "radix",
|
|
95
|
-
order: 10,
|
|
96
|
-
type: "container",
|
|
97
|
-
icon: SelectIcon,
|
|
98
|
-
stylable: false,
|
|
99
|
-
description: "Use within a form to give your users a list of options to choose from.",
|
|
100
|
-
template: [
|
|
101
|
-
{
|
|
102
|
-
type: "instance",
|
|
103
|
-
component: "Select",
|
|
104
|
-
dataSources: {
|
|
105
|
-
selectValue: { type: "variable", initialValue: "" },
|
|
106
|
-
selectOpen: { type: "variable", initialValue: false }
|
|
107
|
-
},
|
|
108
|
-
props: [
|
|
109
|
-
{
|
|
110
|
-
name: "value",
|
|
111
|
-
type: "dataSource",
|
|
112
|
-
dataSourceName: "selectValue"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "onValueChange",
|
|
116
|
-
type: "action",
|
|
117
|
-
value: [
|
|
118
|
-
{ type: "execute", args: ["value"], code: `selectValue = value` }
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "open",
|
|
123
|
-
type: "dataSource",
|
|
124
|
-
dataSourceName: "selectOpen"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "onOpenChange",
|
|
128
|
-
type: "action",
|
|
129
|
-
value: [
|
|
130
|
-
{ type: "execute", args: ["open"], code: `selectOpen = open` }
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
children: [
|
|
135
|
-
{
|
|
136
|
-
type: "instance",
|
|
137
|
-
component: "SelectTrigger",
|
|
138
|
-
// flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background
|
|
139
|
-
// placeholder:text-muted-foreground
|
|
140
|
-
// focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
141
|
-
// disabled:cursor-not-allowed disabled:opacity-50
|
|
142
|
-
styles: [
|
|
143
|
-
tc.flex(),
|
|
144
|
-
tc.h(10),
|
|
145
|
-
tc.w("full"),
|
|
146
|
-
tc.items("center"),
|
|
147
|
-
tc.justify("between"),
|
|
148
|
-
tc.rounded("md"),
|
|
149
|
-
tc.border(),
|
|
150
|
-
tc.border("input"),
|
|
151
|
-
tc.bg("background"),
|
|
152
|
-
tc.px(3),
|
|
153
|
-
tc.py(2),
|
|
154
|
-
tc.text("sm"),
|
|
155
|
-
tc.state([tc.text("mutedForeground")].flat(), "::placeholder"),
|
|
156
|
-
tc.focus(
|
|
157
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
158
|
-
),
|
|
159
|
-
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
|
|
160
|
-
].flat(),
|
|
161
|
-
children: [
|
|
162
|
-
{
|
|
163
|
-
type: "instance",
|
|
164
|
-
component: "SelectValue",
|
|
165
|
-
props: [{ name: "placeholder", type: "string", value: "Theme" }],
|
|
166
|
-
children: []
|
|
167
|
-
}
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
type: "instance",
|
|
172
|
-
component: "SelectContent",
|
|
173
|
-
// relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md
|
|
174
|
-
// data-[state=open]:animate-in
|
|
175
|
-
// data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
176
|
-
// data-[state=open]:fade-in-0
|
|
177
|
-
// data-[state=closed]:zoom-out-95
|
|
178
|
-
// data-[state=open]:zoom-in-95
|
|
179
|
-
// data-[side=bottom]:slide-in-from-top-2
|
|
180
|
-
// data-[side=left]:slide-in-from-right-2
|
|
181
|
-
// data-[side=right]:slide-in-from-left-2
|
|
182
|
-
// data-[side=top]:slide-in-from-bottom-2
|
|
183
|
-
// position=popper
|
|
184
|
-
// data-[side=bottom]:translate-y-1
|
|
185
|
-
// data-[side=left]:-translate-x-1
|
|
186
|
-
// data-[side=right]:translate-x-1
|
|
187
|
-
// data-[side=top]:-translate-y-1
|
|
188
|
-
styles: [
|
|
189
|
-
tc.relative(),
|
|
190
|
-
tc.z(50),
|
|
191
|
-
tc.property("minWidth", "8rem"),
|
|
192
|
-
tc.overflow("hidden"),
|
|
193
|
-
tc.rounded("md"),
|
|
194
|
-
tc.border(),
|
|
195
|
-
tc.bg("popover"),
|
|
196
|
-
tc.text("popoverForeground"),
|
|
197
|
-
tc.shadow("md")
|
|
198
|
-
].flat(),
|
|
199
|
-
children: [
|
|
200
|
-
{
|
|
201
|
-
type: "instance",
|
|
202
|
-
component: "SelectViewport",
|
|
203
|
-
// p-1
|
|
204
|
-
// position=popper
|
|
205
|
-
// h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]
|
|
206
|
-
styles: [
|
|
207
|
-
tc.p(1),
|
|
208
|
-
tc.property("height", "--radix-select-trigger-height"),
|
|
209
|
-
tc.w("full"),
|
|
210
|
-
tc.property("minWidth", "--radix-select-trigger-width")
|
|
211
|
-
].flat(),
|
|
212
|
-
children: [
|
|
213
|
-
createSelectItem({
|
|
214
|
-
props: [{ name: "value", type: "string", value: "light" }],
|
|
215
|
-
children: [{ type: "text", value: "Light" }]
|
|
216
|
-
}),
|
|
217
|
-
createSelectItem({
|
|
218
|
-
props: [{ name: "value", type: "string", value: "dark" }],
|
|
219
|
-
children: [{ type: "text", value: "Dark" }]
|
|
220
|
-
}),
|
|
221
|
-
createSelectItem({
|
|
222
|
-
props: [{ name: "value", type: "string", value: "system" }],
|
|
223
|
-
children: [{ type: "text", value: "System" }]
|
|
224
|
-
})
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
]
|
|
228
|
-
}
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
};
|
|
233
|
-
export const metaSelectTrigger = {
|
|
234
|
-
category: "hidden",
|
|
235
|
-
type: "container",
|
|
236
|
-
icon: TriggerIcon,
|
|
237
|
-
detachable: false,
|
|
238
|
-
presetStyle: {
|
|
239
|
-
button
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
export const metaSelectValue = {
|
|
243
|
-
category: "hidden",
|
|
244
|
-
type: "container",
|
|
245
|
-
label: "Value",
|
|
246
|
-
icon: FormTextFieldIcon,
|
|
247
|
-
detachable: false,
|
|
248
|
-
presetStyle: {
|
|
249
|
-
span
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
export const metaSelectContent = {
|
|
253
|
-
category: "hidden",
|
|
254
|
-
type: "container",
|
|
255
|
-
icon: ContentIcon,
|
|
256
|
-
detachable: false,
|
|
257
|
-
presetStyle
|
|
258
|
-
};
|
|
259
|
-
export const metaSelectViewport = {
|
|
260
|
-
category: "hidden",
|
|
261
|
-
type: "container",
|
|
262
|
-
icon: ViewportIcon,
|
|
263
|
-
detachable: false,
|
|
264
|
-
presetStyle
|
|
265
|
-
};
|
|
266
|
-
export const metaSelectItem = {
|
|
267
|
-
category: "hidden",
|
|
268
|
-
type: "container",
|
|
269
|
-
icon: ItemIcon,
|
|
270
|
-
requiredAncestors: ["SelectViewport"],
|
|
271
|
-
presetStyle
|
|
272
|
-
};
|
|
273
|
-
export const metaSelectItemIndicator = {
|
|
274
|
-
category: "hidden",
|
|
275
|
-
type: "container",
|
|
276
|
-
label: "Indicator",
|
|
277
|
-
icon: CheckMarkIcon,
|
|
278
|
-
detachable: false,
|
|
279
|
-
requiredAncestors: ["SelectItem"],
|
|
280
|
-
presetStyle: {
|
|
281
|
-
span
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
export const metaSelectItemText = {
|
|
285
|
-
category: "hidden",
|
|
286
|
-
type: "container",
|
|
287
|
-
label: "Item Text",
|
|
288
|
-
icon: TextIcon,
|
|
289
|
-
detachable: false,
|
|
290
|
-
requiredAncestors: ["SelectItem"],
|
|
291
|
-
presetStyle: {
|
|
292
|
-
span
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
export const propsMetaSelect = {
|
|
296
|
-
props: propsSelect,
|
|
297
|
-
initialProps: ["value", "open", "name", "required"]
|
|
298
|
-
};
|
|
299
|
-
export const propsMetaSelectTrigger = {
|
|
300
|
-
props: propsSelectTrigger
|
|
301
|
-
};
|
|
302
|
-
export const propsMetaSelectValue = {
|
|
303
|
-
props: propsSelectValue,
|
|
304
|
-
initialProps: ["placeholder"]
|
|
305
|
-
};
|
|
306
|
-
export const propsMetaSelectContent = {
|
|
307
|
-
props: propsSelectContent
|
|
308
|
-
};
|
|
309
|
-
export const propsMetaSelectViewport = {
|
|
310
|
-
props: propsSelectViewport
|
|
311
|
-
};
|
|
312
|
-
export const propsMetaSelectItem = {
|
|
313
|
-
props: propsSelectItem,
|
|
314
|
-
initialProps: ["value"]
|
|
315
|
-
};
|
|
316
|
-
export const propsMetaSelectItemIndicator = {
|
|
317
|
-
props: propsSelectItemIndicator
|
|
318
|
-
};
|
|
319
|
-
export const propsMetaSelectItemText = {
|
|
320
|
-
props: propsSelectItemText
|
|
321
|
-
};
|
package/lib/sheet.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef
|
|
5
|
-
} from "react";
|
|
6
|
-
import { getClosestInstance } from "@webstudio-is/react-sdk";
|
|
7
|
-
import * as Dialog from "./dialog";
|
|
8
|
-
export const Sheet = Dialog.Dialog;
|
|
9
|
-
export const SheetTrigger = Dialog.DialogTrigger;
|
|
10
|
-
export const SheetOverlay = Dialog.DialogOverlay;
|
|
11
|
-
export const SheetClose = Dialog.DialogClose;
|
|
12
|
-
export const SheetTitle = Dialog.DialogTitle;
|
|
13
|
-
export const SheetDescription = Dialog.DialogDescription;
|
|
14
|
-
export const SheetContent = forwardRef(
|
|
15
|
-
({ tag = "nav", side = "left", role = "navigation", children, ...props }, ref) => {
|
|
16
|
-
const Tag = tag;
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
Dialog.DialogContent,
|
|
19
|
-
{
|
|
20
|
-
asChild: true,
|
|
21
|
-
"data-side": side,
|
|
22
|
-
role,
|
|
23
|
-
...props,
|
|
24
|
-
children: /* @__PURE__ */ jsx(Tag, { ref, children })
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
30
|
-
export const hooksSheet = {
|
|
31
|
-
onNavigatorUnselect: (context, event) => {
|
|
32
|
-
for (const instance of event.instancePath) {
|
|
33
|
-
if (instance.component === `${namespace}:SheetOverlay`) {
|
|
34
|
-
const sheet = getClosestInstance(
|
|
35
|
-
event.instancePath,
|
|
36
|
-
instance,
|
|
37
|
-
`${namespace}:Sheet`
|
|
38
|
-
);
|
|
39
|
-
if (sheet) {
|
|
40
|
-
context.setPropVariable(sheet.id, "open", false);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
onNavigatorSelect: (context, event) => {
|
|
46
|
-
for (const instance of event.instancePath) {
|
|
47
|
-
if (instance.component === `${namespace}:SheetOverlay`) {
|
|
48
|
-
const sheet = getClosestInstance(
|
|
49
|
-
event.instancePath,
|
|
50
|
-
instance,
|
|
51
|
-
`${namespace}:Sheet`
|
|
52
|
-
);
|
|
53
|
-
if (sheet) {
|
|
54
|
-
context.setPropVariable(sheet.id, "open", true);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
package/lib/sheet.stories.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { renderComponentTemplate } from "@webstudio-is/react-sdk";
|
|
3
|
-
import { Sheet as SheetPrimitive } from "./sheet";
|
|
4
|
-
import * as baseComponents from "@webstudio-is/sdk-components-react";
|
|
5
|
-
import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
|
|
6
|
-
import * as radixComponents from "./components";
|
|
7
|
-
import * as radixMetas from "./metas";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/Sheet",
|
|
10
|
-
component: SheetPrimitive
|
|
11
|
-
};
|
|
12
|
-
export const Sheet = {
|
|
13
|
-
render: () => renderComponentTemplate({
|
|
14
|
-
name: "Sheet",
|
|
15
|
-
components: { ...baseComponents, ...radixComponents },
|
|
16
|
-
metas: { ...baseMetas, ...radixMetas }
|
|
17
|
-
})
|
|
18
|
-
};
|