@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/sheet.ws.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { HamburgerMenuIcon, LargeXIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import * as tc from "./theme/tailwind-classes";
|
|
4
|
-
import { getButtonStyles } from "./theme/styles";
|
|
5
|
-
export const meta = {
|
|
6
|
-
category: "radix",
|
|
7
|
-
order: 1,
|
|
8
|
-
type: "container",
|
|
9
|
-
icon: HamburgerMenuIcon,
|
|
10
|
-
stylable: false,
|
|
11
|
-
description: "Displays content in a menu that slides out from the side of the screen, triggered by a button. Use this component for a typical mobile hamburger menu.",
|
|
12
|
-
template: [
|
|
13
|
-
{
|
|
14
|
-
type: "instance",
|
|
15
|
-
component: "Dialog",
|
|
16
|
-
label: "Sheet",
|
|
17
|
-
dataSources: {
|
|
18
|
-
sheetOpen: { type: "variable", initialValue: false }
|
|
19
|
-
},
|
|
20
|
-
props: [
|
|
21
|
-
{
|
|
22
|
-
type: "dataSource",
|
|
23
|
-
name: "open",
|
|
24
|
-
dataSourceName: "sheetOpen"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "onOpenChange",
|
|
28
|
-
type: "action",
|
|
29
|
-
value: [
|
|
30
|
-
{ type: "execute", args: ["open"], code: `sheetOpen = open` }
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
children: [
|
|
35
|
-
{
|
|
36
|
-
type: "instance",
|
|
37
|
-
component: "DialogTrigger",
|
|
38
|
-
label: "Sheet Trigger",
|
|
39
|
-
children: [
|
|
40
|
-
{
|
|
41
|
-
type: "instance",
|
|
42
|
-
component: "Button",
|
|
43
|
-
styles: getButtonStyles("ghost", "icon"),
|
|
44
|
-
children: [
|
|
45
|
-
{
|
|
46
|
-
type: "instance",
|
|
47
|
-
component: "HtmlEmbed",
|
|
48
|
-
label: "Hamburger Menu Svg",
|
|
49
|
-
props: [
|
|
50
|
-
{
|
|
51
|
-
type: "string",
|
|
52
|
-
name: "code",
|
|
53
|
-
value: HamburgerMenuIcon
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
children: []
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: "instance",
|
|
64
|
-
component: "DialogOverlay",
|
|
65
|
-
label: "Sheet Overlay",
|
|
66
|
-
/**
|
|
67
|
-
* fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
|
|
68
|
-
* flex
|
|
69
|
-
**/
|
|
70
|
-
styles: [
|
|
71
|
-
tc.fixed(),
|
|
72
|
-
tc.inset(0),
|
|
73
|
-
tc.z(50),
|
|
74
|
-
tc.bg("background", 80),
|
|
75
|
-
tc.backdropBlur("sm"),
|
|
76
|
-
// To allow positioning Content
|
|
77
|
-
tc.flex(),
|
|
78
|
-
tc.flex("col"),
|
|
79
|
-
tc.overflow("auto")
|
|
80
|
-
].flat(),
|
|
81
|
-
children: [
|
|
82
|
-
{
|
|
83
|
-
type: "instance",
|
|
84
|
-
component: "DialogContent",
|
|
85
|
-
label: "Sheet Content",
|
|
86
|
-
/**
|
|
87
|
-
* fixed w-full z-50
|
|
88
|
-
* grid gap-4 max-w-lg
|
|
89
|
-
* m-auto
|
|
90
|
-
* border bg-background p-6 shadow-lg
|
|
91
|
-
**/
|
|
92
|
-
styles: [
|
|
93
|
-
tc.w("full"),
|
|
94
|
-
tc.z(50),
|
|
95
|
-
tc.flex(),
|
|
96
|
-
tc.flex("col"),
|
|
97
|
-
tc.gap(4),
|
|
98
|
-
tc.border(),
|
|
99
|
-
tc.bg("background"),
|
|
100
|
-
tc.p(6),
|
|
101
|
-
tc.shadow("lg"),
|
|
102
|
-
tc.relative(),
|
|
103
|
-
// side=left
|
|
104
|
-
tc.mr("auto"),
|
|
105
|
-
tc.maxW("sm"),
|
|
106
|
-
tc.grow()
|
|
107
|
-
].flat(),
|
|
108
|
-
children: [
|
|
109
|
-
{
|
|
110
|
-
type: "instance",
|
|
111
|
-
component: "Box",
|
|
112
|
-
label: "Navigation",
|
|
113
|
-
props: [
|
|
114
|
-
{ name: "tag", type: "string", value: "nav" },
|
|
115
|
-
{ name: "role", type: "string", value: "navigation" }
|
|
116
|
-
],
|
|
117
|
-
children: [
|
|
118
|
-
{
|
|
119
|
-
type: "instance",
|
|
120
|
-
component: "Box",
|
|
121
|
-
label: "Sheet Header",
|
|
122
|
-
styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
|
|
123
|
-
children: [
|
|
124
|
-
{
|
|
125
|
-
type: "instance",
|
|
126
|
-
component: "DialogTitle",
|
|
127
|
-
label: "Sheet Title",
|
|
128
|
-
/**
|
|
129
|
-
* text-lg leading-none tracking-tight
|
|
130
|
-
**/
|
|
131
|
-
styles: [
|
|
132
|
-
tc.my(0),
|
|
133
|
-
tc.leading("none"),
|
|
134
|
-
tc.text("lg"),
|
|
135
|
-
tc.tracking("tight")
|
|
136
|
-
].flat(),
|
|
137
|
-
children: [
|
|
138
|
-
{
|
|
139
|
-
type: "text",
|
|
140
|
-
value: "Sheet Title"
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
type: "instance",
|
|
146
|
-
component: "DialogDescription",
|
|
147
|
-
label: "Sheet Description",
|
|
148
|
-
/**
|
|
149
|
-
* text-sm text-muted-foreground
|
|
150
|
-
**/
|
|
151
|
-
styles: [
|
|
152
|
-
tc.my(0),
|
|
153
|
-
tc.text("sm"),
|
|
154
|
-
tc.text("mutedForeground")
|
|
155
|
-
].flat(),
|
|
156
|
-
children: [
|
|
157
|
-
{
|
|
158
|
-
type: "text",
|
|
159
|
-
value: "Sheet description text you can edit"
|
|
160
|
-
}
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
type: "instance",
|
|
167
|
-
component: "Text",
|
|
168
|
-
children: [
|
|
169
|
-
{ type: "text", value: "The text you can edit" }
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
type: "instance",
|
|
176
|
-
component: "DialogClose",
|
|
177
|
-
label: "Close Button",
|
|
178
|
-
/**
|
|
179
|
-
* absolute right-4 top-4
|
|
180
|
-
* rounded-sm opacity-70
|
|
181
|
-
* ring-offset-background
|
|
182
|
-
* hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
183
|
-
* flex items-center justify-center h-4 w-4
|
|
184
|
-
**/
|
|
185
|
-
styles: [
|
|
186
|
-
tc.absolute(),
|
|
187
|
-
tc.right(4),
|
|
188
|
-
tc.top(4),
|
|
189
|
-
tc.rounded("sm"),
|
|
190
|
-
tc.opacity(70),
|
|
191
|
-
tc.flex(),
|
|
192
|
-
tc.items("center"),
|
|
193
|
-
tc.justify("center"),
|
|
194
|
-
tc.h(4),
|
|
195
|
-
tc.w(4),
|
|
196
|
-
tc.border(0),
|
|
197
|
-
tc.bg("transparent"),
|
|
198
|
-
tc.outline("none"),
|
|
199
|
-
tc.hover(tc.opacity(100)),
|
|
200
|
-
tc.focus(tc.ring("ring", 2, "background", 2))
|
|
201
|
-
].flat(),
|
|
202
|
-
children: [
|
|
203
|
-
{
|
|
204
|
-
type: "instance",
|
|
205
|
-
component: "HtmlEmbed",
|
|
206
|
-
label: "Close Icon",
|
|
207
|
-
props: [
|
|
208
|
-
{
|
|
209
|
-
type: "string",
|
|
210
|
-
name: "code",
|
|
211
|
-
value: LargeXIcon
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
children: []
|
|
215
|
-
}
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
};
|
package/lib/switch.js
DELETED
package/lib/switch.stories.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 { Switch as SwitchPrimitive } from "./switch";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/Switch",
|
|
10
|
-
component: SwitchPrimitive
|
|
11
|
-
};
|
|
12
|
-
export const Switch = {
|
|
13
|
-
render: (props) => renderComponentTemplate({
|
|
14
|
-
name: "Switch",
|
|
15
|
-
props: { ...props },
|
|
16
|
-
components: { ...baseComponents, ...radixComponents },
|
|
17
|
-
metas: { ...baseMetas, ...radixMetas }
|
|
18
|
-
})
|
|
19
|
-
};
|
package/lib/switch.ws.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { SwitchIcon, TriggerIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { button, span } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import * as tc from "./theme/tailwind-classes";
|
|
8
|
-
import { buttonReset } from "./theme/styles";
|
|
9
|
-
import { propsSwitch, propsSwitchThumb } from "./__generated__/switch.props";
|
|
10
|
-
export const metaSwitch = {
|
|
11
|
-
category: "radix",
|
|
12
|
-
order: 11,
|
|
13
|
-
type: "container",
|
|
14
|
-
description: "A control that allows the user to toggle between checked and not checked.",
|
|
15
|
-
icon: SwitchIcon,
|
|
16
|
-
states: [
|
|
17
|
-
...defaultStates,
|
|
18
|
-
{
|
|
19
|
-
label: "Checked",
|
|
20
|
-
selector: "[data-state=checked]",
|
|
21
|
-
category: "component-states"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Unchecked",
|
|
25
|
-
selector: "[data-state=unchecked]",
|
|
26
|
-
category: "component-states"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
presetStyle: {
|
|
30
|
-
button: [button, buttonReset].flat()
|
|
31
|
-
},
|
|
32
|
-
template: [
|
|
33
|
-
{
|
|
34
|
-
type: "instance",
|
|
35
|
-
component: "Switch",
|
|
36
|
-
dataSources: {
|
|
37
|
-
switchChecked: { type: "variable", initialValue: false }
|
|
38
|
-
},
|
|
39
|
-
props: [
|
|
40
|
-
{
|
|
41
|
-
name: "checked",
|
|
42
|
-
type: "dataSource",
|
|
43
|
-
dataSourceName: "switchChecked"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "onCheckedChange",
|
|
47
|
-
type: "action",
|
|
48
|
-
value: [
|
|
49
|
-
{
|
|
50
|
-
type: "execute",
|
|
51
|
-
args: ["checked"],
|
|
52
|
-
code: `switchChecked = checked`
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
// peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors
|
|
58
|
-
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background
|
|
59
|
-
// disabled:cursor-not-allowed disabled:opacity-50
|
|
60
|
-
// data-[state=checked]:bg-primary
|
|
61
|
-
// data-[state=unchecked]:bg-input
|
|
62
|
-
styles: [
|
|
63
|
-
// We are not supporting peer like styles yet
|
|
64
|
-
tc.inlineFlex(),
|
|
65
|
-
tc.property("height", "24px"),
|
|
66
|
-
tc.property("width", "44px"),
|
|
67
|
-
tc.shrink(0),
|
|
68
|
-
tc.cursor("pointer"),
|
|
69
|
-
tc.items("center"),
|
|
70
|
-
tc.rounded("full"),
|
|
71
|
-
tc.border(2),
|
|
72
|
-
tc.border("transparent"),
|
|
73
|
-
tc.transition("all"),
|
|
74
|
-
tc.focusVisible(
|
|
75
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
76
|
-
),
|
|
77
|
-
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
|
|
78
|
-
tc.state([tc.bg("primary")].flat(), "[data-state=checked]"),
|
|
79
|
-
tc.state([tc.bg("input")].flat(), "[data-state=unchecked]")
|
|
80
|
-
].flat(),
|
|
81
|
-
children: [
|
|
82
|
-
{
|
|
83
|
-
type: "instance",
|
|
84
|
-
component: "SwitchThumb",
|
|
85
|
-
// pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform
|
|
86
|
-
// data-[state=checked]:translate-x-5
|
|
87
|
-
// data-[state=unchecked]:translate-x-0
|
|
88
|
-
styles: [
|
|
89
|
-
tc.pointerEvents("none"),
|
|
90
|
-
tc.block(),
|
|
91
|
-
tc.h(5),
|
|
92
|
-
tc.w(5),
|
|
93
|
-
tc.rounded("full"),
|
|
94
|
-
tc.bg("background"),
|
|
95
|
-
tc.shadow("lg"),
|
|
96
|
-
tc.transition("transform"),
|
|
97
|
-
tc.state(
|
|
98
|
-
[tc.property("transform", "translateX(20px)")].flat(),
|
|
99
|
-
"[data-state=checked]"
|
|
100
|
-
),
|
|
101
|
-
tc.state(
|
|
102
|
-
[tc.property("transform", "translateX(0px)")].flat(),
|
|
103
|
-
"[data-state=unchecked]"
|
|
104
|
-
)
|
|
105
|
-
].flat(),
|
|
106
|
-
children: []
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
};
|
|
112
|
-
export const metaSwitchThumb = {
|
|
113
|
-
category: "hidden",
|
|
114
|
-
type: "container",
|
|
115
|
-
detachable: false,
|
|
116
|
-
icon: TriggerIcon,
|
|
117
|
-
states: [
|
|
118
|
-
...defaultStates,
|
|
119
|
-
{
|
|
120
|
-
label: "Checked",
|
|
121
|
-
selector: "[data-state=checked]",
|
|
122
|
-
category: "component-states"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: "Unchecked",
|
|
126
|
-
selector: "[data-state=unchecked]",
|
|
127
|
-
category: "component-states"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
presetStyle: {
|
|
131
|
-
span
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
export const propsMetaSwitch = {
|
|
135
|
-
props: propsSwitch,
|
|
136
|
-
initialProps: ["id", "checked", "name", "required"]
|
|
137
|
-
};
|
|
138
|
-
export const propsMetaSwitchThumb = {
|
|
139
|
-
props: propsSwitchThumb
|
|
140
|
-
};
|
package/lib/tabs.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef
|
|
5
|
-
} from "react";
|
|
6
|
-
import { Root, List, Trigger, Content } from "@radix-ui/react-tabs";
|
|
7
|
-
import {
|
|
8
|
-
getClosestInstance,
|
|
9
|
-
getIndexWithinAncestorFromComponentProps
|
|
10
|
-
} from "@webstudio-is/react-sdk";
|
|
11
|
-
export const Tabs = Root;
|
|
12
|
-
export const TabsList = List;
|
|
13
|
-
export const TabsTrigger = forwardRef(({ value, ...props }, ref) => {
|
|
14
|
-
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
15
|
-
return /* @__PURE__ */ jsx(Trigger, { ref, value: value ?? index, ...props });
|
|
16
|
-
});
|
|
17
|
-
export const TabsContent = forwardRef(({ value, ...props }, ref) => {
|
|
18
|
-
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
19
|
-
return /* @__PURE__ */ jsx(Content, { ref, value: value ?? index, ...props });
|
|
20
|
-
});
|
|
21
|
-
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
22
|
-
export const hooksTabs = {
|
|
23
|
-
onNavigatorSelect: (context, event) => {
|
|
24
|
-
for (const instance of event.instancePath) {
|
|
25
|
-
if (instance.component === `${namespace}:TabsContent`) {
|
|
26
|
-
const tabs = getClosestInstance(
|
|
27
|
-
event.instancePath,
|
|
28
|
-
instance,
|
|
29
|
-
`${namespace}:Tabs`
|
|
30
|
-
);
|
|
31
|
-
const contentValue = context.getPropValue(instance.id, "value") ?? context.indexesWithinAncestors.get(instance.id)?.toString();
|
|
32
|
-
if (tabs && contentValue) {
|
|
33
|
-
context.setPropVariable(tabs.id, "value", contentValue);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
package/lib/tabs.stories.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { renderComponentTemplate } from "@webstudio-is/react-sdk";
|
|
3
|
-
import { Tabs as TabsPrimitive } from "./tabs";
|
|
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/Tabs",
|
|
10
|
-
component: TabsPrimitive
|
|
11
|
-
};
|
|
12
|
-
export const Tabs = {
|
|
13
|
-
render: () => renderComponentTemplate({
|
|
14
|
-
name: "Tabs",
|
|
15
|
-
components: { ...baseComponents, ...radixComponents },
|
|
16
|
-
metas: { ...baseMetas, ...radixMetas }
|
|
17
|
-
})
|
|
18
|
-
};
|
package/lib/tabs.ws.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
ContentIcon,
|
|
4
|
-
HeaderIcon,
|
|
5
|
-
TabsIcon,
|
|
6
|
-
TriggerIcon
|
|
7
|
-
} from "@webstudio-is/icons/svg";
|
|
8
|
-
import {
|
|
9
|
-
defaultStates
|
|
10
|
-
} from "@webstudio-is/react-sdk";
|
|
11
|
-
import { button, div } from "@webstudio-is/react-sdk/css-normalize";
|
|
12
|
-
import * as tc from "./theme/tailwind-classes";
|
|
13
|
-
import { buttonReset } from "./theme/styles";
|
|
14
|
-
import {
|
|
15
|
-
propsTabs,
|
|
16
|
-
propsTabsList,
|
|
17
|
-
propsTabsTrigger,
|
|
18
|
-
propsTabsContent
|
|
19
|
-
} from "./__generated__/tabs.props";
|
|
20
|
-
const presetStyle = {
|
|
21
|
-
div
|
|
22
|
-
};
|
|
23
|
-
const tabsTriggerStyles = [
|
|
24
|
-
tc.inlineFlex(),
|
|
25
|
-
tc.items("center"),
|
|
26
|
-
tc.justify("center"),
|
|
27
|
-
tc.whitespace("nowrap"),
|
|
28
|
-
tc.rounded("md"),
|
|
29
|
-
tc.px(3),
|
|
30
|
-
tc.py(1.5),
|
|
31
|
-
tc.text("sm"),
|
|
32
|
-
tc.font("medium"),
|
|
33
|
-
tc.transition("all"),
|
|
34
|
-
tc.focusVisible(
|
|
35
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
36
|
-
),
|
|
37
|
-
tc.disabled([tc.pointerEvents("none"), tc.opacity(50)].flat()),
|
|
38
|
-
tc.state(
|
|
39
|
-
[tc.bg("background"), tc.text("foreground"), tc.shadow("sm")].flat(),
|
|
40
|
-
"[data-state=active]"
|
|
41
|
-
)
|
|
42
|
-
].flat();
|
|
43
|
-
const tabsContentStyles = [
|
|
44
|
-
tc.mt(2),
|
|
45
|
-
tc.focusVisible(
|
|
46
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
47
|
-
)
|
|
48
|
-
].flat();
|
|
49
|
-
export const metaTabs = {
|
|
50
|
-
category: "radix",
|
|
51
|
-
order: 2,
|
|
52
|
-
type: "container",
|
|
53
|
-
icon: TabsIcon,
|
|
54
|
-
presetStyle,
|
|
55
|
-
description: "A set of panels with content that are displayed one at a time. Duplicate both a tab trigger and tab content to add more tabs. Triggers and content are connected according to their order in the Navigator.",
|
|
56
|
-
template: [
|
|
57
|
-
{
|
|
58
|
-
type: "instance",
|
|
59
|
-
component: "Tabs",
|
|
60
|
-
dataSources: {
|
|
61
|
-
tabsValue: { type: "variable", initialValue: "0" }
|
|
62
|
-
},
|
|
63
|
-
props: [
|
|
64
|
-
{ type: "dataSource", name: "value", dataSourceName: "tabsValue" },
|
|
65
|
-
{
|
|
66
|
-
name: "onValueChange",
|
|
67
|
-
type: "action",
|
|
68
|
-
value: [
|
|
69
|
-
{ type: "execute", args: ["value"], code: `tabsValue = value` }
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
children: [
|
|
74
|
-
{
|
|
75
|
-
type: "instance",
|
|
76
|
-
component: "TabsList",
|
|
77
|
-
// inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground
|
|
78
|
-
styles: [
|
|
79
|
-
tc.inlineFlex(),
|
|
80
|
-
tc.h(10),
|
|
81
|
-
tc.items("center"),
|
|
82
|
-
tc.justify("center"),
|
|
83
|
-
tc.rounded("md"),
|
|
84
|
-
tc.bg("muted"),
|
|
85
|
-
tc.p(1),
|
|
86
|
-
tc.text("mutedForeground")
|
|
87
|
-
].flat(),
|
|
88
|
-
children: [
|
|
89
|
-
{
|
|
90
|
-
type: "instance",
|
|
91
|
-
component: "TabsTrigger",
|
|
92
|
-
styles: tabsTriggerStyles,
|
|
93
|
-
children: [{ type: "text", value: "Account" }]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
type: "instance",
|
|
97
|
-
component: "TabsTrigger",
|
|
98
|
-
styles: tabsTriggerStyles,
|
|
99
|
-
children: [{ type: "text", value: "Password" }]
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: "instance",
|
|
105
|
-
component: "TabsContent",
|
|
106
|
-
styles: tabsContentStyles,
|
|
107
|
-
children: [
|
|
108
|
-
{ type: "text", value: "Make changes to your account here." }
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
type: "instance",
|
|
113
|
-
component: "TabsContent",
|
|
114
|
-
styles: tabsContentStyles,
|
|
115
|
-
children: [{ type: "text", value: "Change your password here." }]
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
};
|
|
121
|
-
export const metaTabsList = {
|
|
122
|
-
category: "hidden",
|
|
123
|
-
detachable: false,
|
|
124
|
-
type: "container",
|
|
125
|
-
icon: HeaderIcon,
|
|
126
|
-
requiredAncestors: ["Tabs"],
|
|
127
|
-
presetStyle
|
|
128
|
-
};
|
|
129
|
-
export const metaTabsTrigger = {
|
|
130
|
-
category: "hidden",
|
|
131
|
-
type: "container",
|
|
132
|
-
icon: TriggerIcon,
|
|
133
|
-
requiredAncestors: ["TabsList"],
|
|
134
|
-
invalidAncestors: ["TabsTrigger"],
|
|
135
|
-
indexWithinAncestor: "Tabs",
|
|
136
|
-
label: "Tab Trigger",
|
|
137
|
-
states: [
|
|
138
|
-
...defaultStates,
|
|
139
|
-
{
|
|
140
|
-
category: "component-states",
|
|
141
|
-
label: "Active",
|
|
142
|
-
selector: "[data-state=active]"
|
|
143
|
-
}
|
|
144
|
-
],
|
|
145
|
-
presetStyle: {
|
|
146
|
-
button: [button, buttonReset].flat()
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
export const metaTabsContent = {
|
|
150
|
-
category: "hidden",
|
|
151
|
-
type: "container",
|
|
152
|
-
label: "Tab Content",
|
|
153
|
-
icon: ContentIcon,
|
|
154
|
-
requiredAncestors: ["Tabs"],
|
|
155
|
-
indexWithinAncestor: "Tabs",
|
|
156
|
-
presetStyle
|
|
157
|
-
};
|
|
158
|
-
export const propsMetaTabs = {
|
|
159
|
-
props: propsTabs
|
|
160
|
-
};
|
|
161
|
-
export const propsMetaTabsList = {
|
|
162
|
-
props: propsTabsList
|
|
163
|
-
};
|
|
164
|
-
export const propsMetaTabsTrigger = {
|
|
165
|
-
props: propsTabsTrigger
|
|
166
|
-
};
|
|
167
|
-
export const propsMetaTabsContent = {
|
|
168
|
-
props: propsTabsContent
|
|
169
|
-
};
|