@webstudio-is/sdk-components-react-radix 0.87.0 → 0.88.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 +0 -5
- package/lib/__generated__/button.props.js +0 -21
- package/lib/__generated__/checkbox.props.js +850 -0
- package/lib/__generated__/collapsible.props.js +0 -2
- package/lib/__generated__/dialog.props.js +0 -11
- package/lib/__generated__/label.props.js +0 -1
- package/lib/__generated__/navigation-menu.props.js +2104 -0
- package/lib/__generated__/popover.props.js +0 -3
- package/lib/__generated__/radio-group.props.js +1282 -0
- package/lib/__generated__/select.props.js +2962 -0
- package/lib/__generated__/sheet.props.js +0 -11
- package/lib/__generated__/switch.props.js +850 -0
- package/lib/__generated__/tabs.props.js +428 -5
- package/lib/__generated__/tooltip.props.js +0 -2
- package/lib/accordion.js +11 -4
- package/lib/accordion.ws.js +87 -72
- package/lib/checkbox.js +13 -0
- package/lib/checkbox.ws.js +151 -0
- package/lib/cjs/__generated__/accordion.props.js +0 -5
- package/lib/cjs/__generated__/button.props.js +0 -21
- package/lib/cjs/__generated__/checkbox.props.js +870 -0
- package/lib/cjs/__generated__/collapsible.props.js +0 -2
- package/lib/cjs/__generated__/dialog.props.js +0 -11
- package/lib/cjs/__generated__/label.props.js +0 -1
- package/lib/cjs/__generated__/navigation-menu.props.js +2124 -0
- package/lib/cjs/__generated__/popover.props.js +0 -3
- package/lib/cjs/__generated__/radio-group.props.js +1302 -0
- package/lib/cjs/__generated__/select.props.js +2982 -0
- package/lib/cjs/__generated__/sheet.props.js +0 -11
- package/lib/cjs/__generated__/switch.props.js +870 -0
- package/lib/cjs/__generated__/tabs.props.js +428 -5
- package/lib/cjs/__generated__/tooltip.props.js +0 -2
- package/lib/cjs/accordion.js +11 -4
- package/lib/cjs/accordion.ws.js +85 -71
- package/lib/cjs/{textarea.js → checkbox.js} +9 -6
- package/lib/cjs/checkbox.ws.js +172 -0
- package/lib/cjs/collapsible.ws.js +4 -1
- package/lib/cjs/components.js +27 -14
- package/lib/cjs/dialog.ws.js +17 -17
- package/lib/cjs/hooks.js +5 -1
- package/lib/cjs/label.ws.js +1 -1
- package/lib/cjs/metas.js +29 -14
- package/lib/cjs/navigation-menu.js +107 -0
- package/lib/cjs/navigation-menu.ws.js +513 -0
- package/lib/cjs/popover.ws.js +12 -9
- package/lib/cjs/props.js +27 -14
- package/lib/cjs/{button.js → radio-group.js} +10 -8
- package/lib/cjs/radio-group.ws.js +188 -0
- package/lib/cjs/select.js +81 -0
- package/lib/cjs/select.ws.js +349 -0
- package/lib/cjs/sheet.ws.js +87 -176
- package/lib/cjs/{input.js → switch.js} +8 -9
- package/lib/cjs/switch.ws.js +171 -0
- package/lib/cjs/tabs.js +2 -3
- package/lib/cjs/tabs.ws.js +13 -18
- package/lib/cjs/theme/styles.js +100 -0
- package/lib/cjs/theme/tailwind-classes.js +125 -16
- package/lib/cjs/theme/tailwind-colors.js +1 -0
- package/lib/cjs/tooltip.ws.js +11 -8
- package/lib/collapsible.ws.js +4 -1
- package/lib/components.js +44 -22
- package/lib/dialog.ws.js +17 -17
- package/lib/hooks.js +5 -1
- package/lib/label.ws.js +1 -1
- package/lib/metas.js +58 -24
- package/lib/navigation-menu.js +85 -0
- package/lib/navigation-menu.ws.js +500 -0
- package/lib/popover.ws.js +12 -9
- package/lib/props.js +56 -24
- package/lib/radio-group.js +11 -0
- package/lib/radio-group.ws.js +170 -0
- package/lib/select.js +73 -0
- package/lib/select.ws.js +337 -0
- package/lib/sheet.ws.js +88 -194
- package/lib/switch.js +7 -0
- package/lib/switch.ws.js +143 -0
- package/lib/tabs.js +3 -5
- package/lib/tabs.ws.js +14 -19
- package/lib/theme/styles.js +70 -0
- package/lib/theme/tailwind-classes.js +125 -16
- package/lib/theme/tailwind-colors.js +1 -0
- package/lib/tooltip.ws.js +11 -8
- package/lib/types/__generated__/checkbox.props.d.ts +3 -0
- package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
- package/lib/types/__generated__/radio-group.props.d.ts +4 -0
- package/lib/types/__generated__/select.props.d.ts +9 -0
- package/lib/types/__generated__/switch.props.d.ts +3 -0
- package/lib/types/checkbox.d.ts +6 -0
- package/lib/types/checkbox.stories.d.ts +11 -0
- package/lib/types/checkbox.ws.d.ts +5 -0
- package/lib/types/components.d.ts +5 -4
- package/lib/types/metas.d.ts +6 -4
- package/lib/types/navigation-menu.d.ts +15 -0
- package/lib/types/navigation-menu.ws.d.ts +15 -0
- package/lib/types/props.d.ts +5 -4
- package/lib/types/radio-group.d.ts +5 -0
- package/lib/types/radio-group.stories.d.ts +9 -0
- package/lib/types/radio-group.ws.d.ts +7 -0
- package/lib/types/select.d.ts +12 -0
- package/lib/types/select.ws.d.ts +17 -0
- package/lib/types/sheet.ws.d.ts +2 -15
- package/lib/types/switch.d.ts +4 -0
- package/lib/types/switch.stories.d.ts +9 -0
- package/lib/types/switch.ws.d.ts +5 -0
- package/lib/types/tabs.d.ts +3 -12
- package/lib/types/theme/radix-common-types.d.ts +3 -2
- package/lib/types/theme/styles.d.ts +215 -0
- package/lib/types/theme/tailwind-classes.d.ts +16 -6
- package/lib/types/theme/tailwind-colors.d.ts +1 -0
- package/lib/types/theme/tailwind-theme.d.ts +1 -1
- package/package.json +12 -7
- package/src/__generated__/accordion.props.ts +0 -5
- package/src/__generated__/button.props.ts +0 -21
- package/src/__generated__/checkbox.props.ts +948 -0
- package/src/__generated__/collapsible.props.ts +0 -2
- package/src/__generated__/dialog.props.ts +0 -11
- package/src/__generated__/label.props.ts +0 -1
- package/src/__generated__/navigation-menu.props.ts +2349 -0
- package/src/__generated__/popover.props.ts +0 -3
- package/src/__generated__/radio-group.props.ts +1429 -0
- package/src/__generated__/select.props.ts +3304 -0
- package/src/__generated__/sheet.props.ts +0 -11
- package/src/__generated__/switch.props.ts +948 -0
- package/src/__generated__/tabs.props.ts +477 -4
- package/src/__generated__/tooltip.props.ts +0 -2
- package/src/accordion.tsx +14 -7
- package/src/accordion.ws.ts +85 -70
- package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
- package/src/checkbox.tsx +22 -0
- package/src/checkbox.ws.ts +151 -0
- package/src/collapsible.ws.ts +4 -1
- package/src/components.ts +25 -12
- package/src/dialog.ws.tsx +15 -16
- package/src/hooks.ts +4 -0
- package/src/label.ws.ts +1 -1
- package/src/metas.ts +36 -12
- package/src/navigation-menu.stories.tsx +21 -0
- package/src/navigation-menu.tsx +130 -0
- package/src/navigation-menu.ws.ts +523 -0
- package/src/popover.ws.tsx +12 -9
- package/src/props.ts +35 -12
- package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
- package/src/radio-group.tsx +17 -0
- package/src/radio-group.ws.ts +174 -0
- package/src/select.stories.tsx +21 -0
- package/src/select.tsx +107 -0
- package/src/select.ws.ts +347 -0
- package/src/sheet.ws.tsx +89 -209
- package/src/{button.stories.ts → switch.stories.ts} +6 -19
- package/src/switch.tsx +10 -0
- package/src/switch.ws.ts +143 -0
- package/src/tabs.tsx +4 -17
- package/src/tabs.ws.ts +17 -19
- package/src/theme/radix-common-types.ts +3 -2
- package/src/theme/styles.ts +80 -0
- package/src/theme/tailwind-classes.ts +150 -14
- package/src/theme/tailwind-colors.ts +1 -0
- package/src/tooltip.ws.tsx +11 -8
- package/lib/button.js +0 -8
- package/lib/button.ws.js +0 -133
- package/lib/cjs/button.ws.js +0 -160
- package/lib/cjs/input.ws.js +0 -103
- package/lib/cjs/textarea.ws.js +0 -98
- package/lib/input.js +0 -8
- package/lib/input.ws.js +0 -75
- package/lib/textarea.js +0 -8
- package/lib/textarea.ws.js +0 -70
- package/lib/types/button.d.ts +0 -7
- package/lib/types/button.stories.d.ts +0 -20
- package/lib/types/button.ws.d.ts +0 -7
- package/lib/types/input.d.ts +0 -2
- package/lib/types/input.stories.d.ts +0 -20
- package/lib/types/input.ws.d.ts +0 -3
- package/lib/types/textarea.d.ts +0 -2
- package/lib/types/textarea.stories.d.ts +0 -14
- package/lib/types/textarea.ws.d.ts +0 -3
- package/src/button.tsx +0 -25
- package/src/button.ws.ts +0 -155
- package/src/input.tsx +0 -12
- package/src/input.ws.ts +0 -78
- package/src/textarea.tsx +0 -12
- package/src/textarea.ws.ts +0 -74
package/lib/collapsible.ws.js
CHANGED
|
@@ -3,17 +3,19 @@ import {
|
|
|
3
3
|
TriggerIcon,
|
|
4
4
|
ContentIcon
|
|
5
5
|
} from "@webstudio-is/icons/svg";
|
|
6
|
+
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
6
7
|
import {
|
|
7
8
|
propsCollapsible,
|
|
8
9
|
propsCollapsibleContent,
|
|
9
10
|
propsCollapsibleTrigger
|
|
10
11
|
} from "./__generated__/collapsible.props";
|
|
11
|
-
import {
|
|
12
|
+
import { getButtonStyles } from "./theme/styles";
|
|
12
13
|
const presetStyle = {
|
|
13
14
|
div
|
|
14
15
|
};
|
|
15
16
|
const metaCollapsible = {
|
|
16
17
|
category: "radix",
|
|
18
|
+
order: 5,
|
|
17
19
|
type: "container",
|
|
18
20
|
presetStyle,
|
|
19
21
|
icon: CollapsibleIcon,
|
|
@@ -46,6 +48,7 @@ const metaCollapsible = {
|
|
|
46
48
|
{
|
|
47
49
|
type: "instance",
|
|
48
50
|
component: "Button",
|
|
51
|
+
styles: getButtonStyles("outline"),
|
|
49
52
|
children: [{ type: "text", value: "Click to toggle content" }]
|
|
50
53
|
}
|
|
51
54
|
]
|
package/lib/components.js
CHANGED
|
@@ -14,19 +14,7 @@ import {
|
|
|
14
14
|
} from "./dialog";
|
|
15
15
|
import { Popover, PopoverTrigger, PopoverContent } from "./popover";
|
|
16
16
|
import { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
|
|
17
|
-
import {
|
|
18
|
-
Sheet,
|
|
19
|
-
SheetTrigger,
|
|
20
|
-
SheetOverlay,
|
|
21
|
-
SheetContent,
|
|
22
|
-
SheetClose,
|
|
23
|
-
SheetTitle,
|
|
24
|
-
SheetDescription
|
|
25
|
-
} from "./sheet";
|
|
26
17
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
|
|
27
|
-
import { Button } from "./button";
|
|
28
|
-
import { Input } from "./input";
|
|
29
|
-
import { Textarea } from "./textarea";
|
|
30
18
|
import { Label } from "./label";
|
|
31
19
|
import {
|
|
32
20
|
Accordion,
|
|
@@ -35,13 +23,36 @@ import {
|
|
|
35
23
|
AccordionTrigger,
|
|
36
24
|
AccordionContent
|
|
37
25
|
} from "./accordion";
|
|
26
|
+
import {
|
|
27
|
+
NavigationMenu,
|
|
28
|
+
NavigationMenuList,
|
|
29
|
+
NavigationMenuItem,
|
|
30
|
+
NavigationMenuTrigger,
|
|
31
|
+
NavigationMenuContent,
|
|
32
|
+
NavigationMenuLink,
|
|
33
|
+
NavigationMenuViewport
|
|
34
|
+
} from "./navigation-menu";
|
|
35
|
+
import {
|
|
36
|
+
Select,
|
|
37
|
+
SelectTrigger,
|
|
38
|
+
SelectValue,
|
|
39
|
+
SelectViewport,
|
|
40
|
+
SelectContent,
|
|
41
|
+
SelectItem,
|
|
42
|
+
SelectItemIndicator,
|
|
43
|
+
SelectItemText
|
|
44
|
+
} from "./select";
|
|
45
|
+
import { Switch, SwitchThumb } from "./switch";
|
|
46
|
+
import { Checkbox, CheckboxIndicator } from "./checkbox";
|
|
47
|
+
import { RadioGroup, RadioGroupItem, RadioGroupIndicator } from "./radio-group";
|
|
38
48
|
export {
|
|
39
49
|
Accordion,
|
|
40
50
|
AccordionContent,
|
|
41
51
|
AccordionHeader,
|
|
42
52
|
AccordionItem,
|
|
43
53
|
AccordionTrigger,
|
|
44
|
-
|
|
54
|
+
Checkbox,
|
|
55
|
+
CheckboxIndicator,
|
|
45
56
|
Collapsible,
|
|
46
57
|
CollapsibleContent,
|
|
47
58
|
CollapsibleTrigger,
|
|
@@ -52,23 +63,34 @@ export {
|
|
|
52
63
|
DialogOverlay,
|
|
53
64
|
DialogTitle,
|
|
54
65
|
DialogTrigger,
|
|
55
|
-
Input,
|
|
56
66
|
Label,
|
|
67
|
+
NavigationMenu,
|
|
68
|
+
NavigationMenuContent,
|
|
69
|
+
NavigationMenuItem,
|
|
70
|
+
NavigationMenuLink,
|
|
71
|
+
NavigationMenuList,
|
|
72
|
+
NavigationMenuTrigger,
|
|
73
|
+
NavigationMenuViewport,
|
|
57
74
|
Popover,
|
|
58
75
|
PopoverContent,
|
|
59
76
|
PopoverTrigger,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
RadioGroup,
|
|
78
|
+
RadioGroupIndicator,
|
|
79
|
+
RadioGroupItem,
|
|
80
|
+
Select,
|
|
81
|
+
SelectContent,
|
|
82
|
+
SelectItem,
|
|
83
|
+
SelectItemIndicator,
|
|
84
|
+
SelectItemText,
|
|
85
|
+
SelectTrigger,
|
|
86
|
+
SelectValue,
|
|
87
|
+
SelectViewport,
|
|
88
|
+
Switch,
|
|
89
|
+
SwitchThumb,
|
|
67
90
|
Tabs,
|
|
68
91
|
TabsContent,
|
|
69
92
|
TabsList,
|
|
70
93
|
TabsTrigger,
|
|
71
|
-
Textarea,
|
|
72
94
|
Tooltip,
|
|
73
95
|
TooltipContent,
|
|
74
96
|
TooltipTrigger
|
package/lib/dialog.ws.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@webstudio-is/icons/svg";
|
|
10
10
|
import {
|
|
11
11
|
} from "@webstudio-is/react-sdk";
|
|
12
|
+
import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
|
|
12
13
|
import * as tc from "./theme/tailwind-classes";
|
|
13
14
|
import {
|
|
14
15
|
propsDialog,
|
|
@@ -19,8 +20,7 @@ import {
|
|
|
19
20
|
propsDialogTitle,
|
|
20
21
|
propsDialogDescription
|
|
21
22
|
} from "./__generated__/dialog.props";
|
|
22
|
-
import {
|
|
23
|
-
import { div, button, h2, p } from "@webstudio-is/react-sdk/css-normalize";
|
|
23
|
+
import { getButtonStyles } from "./theme/styles";
|
|
24
24
|
const presetStyle = {
|
|
25
25
|
div
|
|
26
26
|
};
|
|
@@ -70,13 +70,14 @@ const metaDialogClose = {
|
|
|
70
70
|
category: "hidden",
|
|
71
71
|
type: "container",
|
|
72
72
|
presetStyle: buttonPresetStyle,
|
|
73
|
-
icon: ButtonElementIcon
|
|
73
|
+
icon: ButtonElementIcon,
|
|
74
|
+
label: "Close Button"
|
|
74
75
|
};
|
|
75
76
|
const metaDialog = {
|
|
76
77
|
category: "radix",
|
|
78
|
+
order: 4,
|
|
77
79
|
type: "container",
|
|
78
80
|
icon: DialogIcon,
|
|
79
|
-
order: 15,
|
|
80
81
|
stylable: false,
|
|
81
82
|
template: [
|
|
82
83
|
{
|
|
@@ -103,15 +104,18 @@ const metaDialog = {
|
|
|
103
104
|
{
|
|
104
105
|
type: "instance",
|
|
105
106
|
component: "DialogTrigger",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
children: [
|
|
108
|
+
{
|
|
109
|
+
type: "instance",
|
|
110
|
+
component: "Button",
|
|
111
|
+
styles: getButtonStyles("outline"),
|
|
112
|
+
children: [{ type: "text", value: "Button" }]
|
|
113
|
+
}
|
|
114
|
+
]
|
|
110
115
|
},
|
|
111
116
|
{
|
|
112
117
|
type: "instance",
|
|
113
118
|
component: "DialogOverlay",
|
|
114
|
-
props: [],
|
|
115
119
|
/**
|
|
116
120
|
* fixed inset-0 z-50 bg-background/80 backdrop-blur-sm
|
|
117
121
|
* flex
|
|
@@ -123,13 +127,13 @@ const metaDialog = {
|
|
|
123
127
|
tc.bg("background", 80),
|
|
124
128
|
tc.backdropBlur("sm"),
|
|
125
129
|
// To allow positioning Content
|
|
126
|
-
tc.flex()
|
|
130
|
+
tc.flex(),
|
|
131
|
+
tc.overflow("auto")
|
|
127
132
|
].flat(),
|
|
128
133
|
children: [
|
|
129
134
|
{
|
|
130
135
|
type: "instance",
|
|
131
136
|
component: "DialogContent",
|
|
132
|
-
props: [],
|
|
133
137
|
/**
|
|
134
138
|
* fixed w-full z-50
|
|
135
139
|
* grid gap-4 max-w-lg
|
|
@@ -155,13 +159,11 @@ const metaDialog = {
|
|
|
155
159
|
type: "instance",
|
|
156
160
|
component: "Box",
|
|
157
161
|
label: "Dialog Header",
|
|
158
|
-
props: [],
|
|
159
162
|
styles: [tc.flex(), tc.flex("col"), tc.gap(1)].flat(),
|
|
160
163
|
children: [
|
|
161
164
|
{
|
|
162
165
|
type: "instance",
|
|
163
166
|
component: "DialogTitle",
|
|
164
|
-
props: [],
|
|
165
167
|
/**
|
|
166
168
|
* text-lg leading-none tracking-tight
|
|
167
169
|
**/
|
|
@@ -181,7 +183,6 @@ const metaDialog = {
|
|
|
181
183
|
{
|
|
182
184
|
type: "instance",
|
|
183
185
|
component: "DialogDescription",
|
|
184
|
-
props: [],
|
|
185
186
|
/**
|
|
186
187
|
* text-sm text-muted-foreground
|
|
187
188
|
**/
|
|
@@ -193,7 +194,7 @@ const metaDialog = {
|
|
|
193
194
|
children: [
|
|
194
195
|
{
|
|
195
196
|
type: "text",
|
|
196
|
-
value: "
|
|
197
|
+
value: "Dialog description text you can edit"
|
|
197
198
|
}
|
|
198
199
|
]
|
|
199
200
|
}
|
|
@@ -207,7 +208,6 @@ const metaDialog = {
|
|
|
207
208
|
{
|
|
208
209
|
type: "instance",
|
|
209
210
|
component: "DialogClose",
|
|
210
|
-
props: [],
|
|
211
211
|
/**
|
|
212
212
|
* absolute right-4 top-4
|
|
213
213
|
* rounded-sm opacity-70
|
|
@@ -244,7 +244,7 @@ const metaDialog = {
|
|
|
244
244
|
};
|
|
245
245
|
const propsMetaDialog = {
|
|
246
246
|
props: propsDialog,
|
|
247
|
-
initialProps: ["open"
|
|
247
|
+
initialProps: ["open"]
|
|
248
248
|
};
|
|
249
249
|
const propsMetaDialogTrigger = {
|
|
250
250
|
props: propsDialogTrigger
|
package/lib/hooks.js
CHANGED
|
@@ -5,6 +5,8 @@ import { hooksPopover } from "./popover";
|
|
|
5
5
|
import { hooksSheet } from "./sheet";
|
|
6
6
|
import { hooksTooltip } from "./tooltip";
|
|
7
7
|
import { hooksAccordion } from "./accordion";
|
|
8
|
+
import { hooksNavigationMenu } from "./navigation-menu";
|
|
9
|
+
import { hooksSelect } from "./select";
|
|
8
10
|
const hooks = [
|
|
9
11
|
hooksCollapsible,
|
|
10
12
|
hooksTabs,
|
|
@@ -12,7 +14,9 @@ const hooks = [
|
|
|
12
14
|
hooksPopover,
|
|
13
15
|
hooksSheet,
|
|
14
16
|
hooksTooltip,
|
|
15
|
-
hooksAccordion
|
|
17
|
+
hooksAccordion,
|
|
18
|
+
hooksNavigationMenu,
|
|
19
|
+
hooksSelect
|
|
16
20
|
];
|
|
17
21
|
export {
|
|
18
22
|
hooks
|
package/lib/label.ws.js
CHANGED
package/lib/metas.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
metaDialogTitle,
|
|
13
13
|
metaDialogDescription
|
|
14
14
|
} from "./dialog.ws";
|
|
15
|
+
import { meta } from "./sheet.ws";
|
|
15
16
|
import {
|
|
16
17
|
metaPopover,
|
|
17
18
|
metaPopoverTrigger,
|
|
@@ -22,25 +23,13 @@ import {
|
|
|
22
23
|
metaTooltipTrigger,
|
|
23
24
|
metaTooltipContent
|
|
24
25
|
} from "./tooltip.ws";
|
|
25
|
-
import {
|
|
26
|
-
metaSheet,
|
|
27
|
-
metaSheetTrigger,
|
|
28
|
-
metaSheetOverlay,
|
|
29
|
-
metaSheetContent,
|
|
30
|
-
metaSheetClose,
|
|
31
|
-
metaSheetTitle,
|
|
32
|
-
metaSheetDescription
|
|
33
|
-
} from "./sheet.ws";
|
|
34
26
|
import {
|
|
35
27
|
metaTabs,
|
|
36
28
|
metaTabsList,
|
|
37
29
|
metaTabsTrigger,
|
|
38
30
|
metaTabsContent
|
|
39
31
|
} from "./tabs.ws";
|
|
40
|
-
import { meta } from "./
|
|
41
|
-
import { meta as meta2 } from "./input.ws";
|
|
42
|
-
import { meta as meta3 } from "./textarea.ws";
|
|
43
|
-
import { meta as meta4 } from "./label.ws";
|
|
32
|
+
import { meta as meta2 } from "./label.ws";
|
|
44
33
|
import {
|
|
45
34
|
metaAccordion,
|
|
46
35
|
metaAccordionItem,
|
|
@@ -48,13 +37,46 @@ import {
|
|
|
48
37
|
metaAccordionTrigger,
|
|
49
38
|
metaAccordionContent
|
|
50
39
|
} from "./accordion.ws";
|
|
40
|
+
import {
|
|
41
|
+
metaNavigationMenu,
|
|
42
|
+
metaNavigationMenuList,
|
|
43
|
+
metaNavigationMenuItem,
|
|
44
|
+
metaNavigationMenuTrigger,
|
|
45
|
+
metaNavigationMenuContent,
|
|
46
|
+
metaNavigationMenuLink,
|
|
47
|
+
metaNavigationMenuViewport
|
|
48
|
+
} from "./navigation-menu.ws";
|
|
49
|
+
import {
|
|
50
|
+
metaSelect,
|
|
51
|
+
metaSelectTrigger,
|
|
52
|
+
metaSelectValue,
|
|
53
|
+
metaSelectViewport,
|
|
54
|
+
metaSelectContent,
|
|
55
|
+
metaSelectItem,
|
|
56
|
+
metaSelectItemIndicator,
|
|
57
|
+
metaSelectItemText
|
|
58
|
+
} from "./select.ws";
|
|
59
|
+
import {
|
|
60
|
+
metaSwitch,
|
|
61
|
+
metaSwitchThumb
|
|
62
|
+
} from "./switch.ws";
|
|
63
|
+
import {
|
|
64
|
+
metaCheckbox,
|
|
65
|
+
metaCheckboxIndicator
|
|
66
|
+
} from "./checkbox.ws";
|
|
67
|
+
import {
|
|
68
|
+
metaRadioGroup,
|
|
69
|
+
metaRadioGroupItem,
|
|
70
|
+
metaRadioGroupIndicator
|
|
71
|
+
} from "./radio-group.ws";
|
|
51
72
|
export {
|
|
52
73
|
metaAccordion as Accordion,
|
|
53
74
|
metaAccordionContent as AccordionContent,
|
|
54
75
|
metaAccordionHeader as AccordionHeader,
|
|
55
76
|
metaAccordionItem as AccordionItem,
|
|
56
77
|
metaAccordionTrigger as AccordionTrigger,
|
|
57
|
-
|
|
78
|
+
metaCheckbox as Checkbox,
|
|
79
|
+
metaCheckboxIndicator as CheckboxIndicator,
|
|
58
80
|
metaCollapsible as Collapsible,
|
|
59
81
|
metaCollapsibleContent as CollapsibleContent,
|
|
60
82
|
metaCollapsibleTrigger as CollapsibleTrigger,
|
|
@@ -65,23 +87,35 @@ export {
|
|
|
65
87
|
metaDialogOverlay as DialogOverlay,
|
|
66
88
|
metaDialogTitle as DialogTitle,
|
|
67
89
|
metaDialogTrigger as DialogTrigger,
|
|
68
|
-
meta2 as
|
|
69
|
-
|
|
90
|
+
meta2 as Label,
|
|
91
|
+
metaNavigationMenu as NavigationMenu,
|
|
92
|
+
metaNavigationMenuContent as NavigationMenuContent,
|
|
93
|
+
metaNavigationMenuItem as NavigationMenuItem,
|
|
94
|
+
metaNavigationMenuLink as NavigationMenuLink,
|
|
95
|
+
metaNavigationMenuList as NavigationMenuList,
|
|
96
|
+
metaNavigationMenuTrigger as NavigationMenuTrigger,
|
|
97
|
+
metaNavigationMenuViewport as NavigationMenuViewport,
|
|
70
98
|
metaPopover as Popover,
|
|
71
99
|
metaPopoverContent as PopoverContent,
|
|
72
100
|
metaPopoverTrigger as PopoverTrigger,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
metaRadioGroup as RadioGroup,
|
|
102
|
+
metaRadioGroupIndicator as RadioGroupIndicator,
|
|
103
|
+
metaRadioGroupItem as RadioGroupItem,
|
|
104
|
+
metaSelect as Select,
|
|
105
|
+
metaSelectContent as SelectContent,
|
|
106
|
+
metaSelectItem as SelectItem,
|
|
107
|
+
metaSelectItemIndicator as SelectItemIndicator,
|
|
108
|
+
metaSelectItemText as SelectItemText,
|
|
109
|
+
metaSelectTrigger as SelectTrigger,
|
|
110
|
+
metaSelectValue as SelectValue,
|
|
111
|
+
metaSelectViewport as SelectViewport,
|
|
112
|
+
meta as Sheet,
|
|
113
|
+
metaSwitch as Switch,
|
|
114
|
+
metaSwitchThumb as SwitchThumb,
|
|
80
115
|
metaTabs as Tabs,
|
|
81
116
|
metaTabsContent as TabsContent,
|
|
82
117
|
metaTabsList as TabsList,
|
|
83
118
|
metaTabsTrigger as TabsTrigger,
|
|
84
|
-
meta3 as Textarea,
|
|
85
119
|
metaTooltip as Tooltip,
|
|
86
120
|
metaTooltipContent as TooltipContent,
|
|
87
121
|
metaTooltipTrigger as TooltipTrigger
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
3
|
+
import {
|
|
4
|
+
getClosestInstance,
|
|
5
|
+
getIndexWithinAncestorFromComponentProps,
|
|
6
|
+
ReactSdkContext
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import {
|
|
9
|
+
Children,
|
|
10
|
+
forwardRef,
|
|
11
|
+
useContext
|
|
12
|
+
} from "react";
|
|
13
|
+
const NavigationMenu = forwardRef(({ value: propsValue, ...props }, ref) => {
|
|
14
|
+
const { renderer } = useContext(ReactSdkContext);
|
|
15
|
+
let value = propsValue;
|
|
16
|
+
if (renderer === "canvas") {
|
|
17
|
+
value = value === "" ? "-1" : value;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Root, { ref, value, ...props });
|
|
20
|
+
});
|
|
21
|
+
const NavigationMenuList = NavigationMenuPrimitive.List;
|
|
22
|
+
const NavigationMenuViewport = NavigationMenuPrimitive.Viewport;
|
|
23
|
+
const NavigationMenuContent = NavigationMenuPrimitive.Content;
|
|
24
|
+
const NavigationMenuItem = forwardRef(({ value, ...props }, ref) => {
|
|
25
|
+
const index = getIndexWithinAncestorFromComponentProps(props);
|
|
26
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Item, { ref, value: value ?? index, ...props });
|
|
27
|
+
});
|
|
28
|
+
const NavigationMenuLink = forwardRef(({ children, ...props }, ref) => {
|
|
29
|
+
const firstChild = Children.toArray(children)[0];
|
|
30
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Link, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("a", { children: "Add link component" }) });
|
|
31
|
+
});
|
|
32
|
+
const NavigationMenuTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
33
|
+
const firstChild = Children.toArray(children)[0];
|
|
34
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
|
|
35
|
+
});
|
|
36
|
+
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
37
|
+
const hooksNavigationMenu = {
|
|
38
|
+
onNavigatorUnselect: (context, event) => {
|
|
39
|
+
for (const instance of event.instancePath) {
|
|
40
|
+
if (instance.component === `${namespace}:NavigationMenuContent`) {
|
|
41
|
+
const menu = getClosestInstance(
|
|
42
|
+
event.instancePath,
|
|
43
|
+
instance,
|
|
44
|
+
`${namespace}:NavigationMenu`
|
|
45
|
+
);
|
|
46
|
+
if (menu) {
|
|
47
|
+
context.setPropVariable(menu.id, "value", "");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
onNavigatorSelect: (context, event) => {
|
|
53
|
+
for (const instance of event.instancePath) {
|
|
54
|
+
if (instance.component === `${namespace}:NavigationMenuContent`) {
|
|
55
|
+
const menu = getClosestInstance(
|
|
56
|
+
event.instancePath,
|
|
57
|
+
instance,
|
|
58
|
+
`${namespace}:NavigationMenu`
|
|
59
|
+
);
|
|
60
|
+
const menuItem = getClosestInstance(
|
|
61
|
+
event.instancePath,
|
|
62
|
+
instance,
|
|
63
|
+
`${namespace}:NavigationMenuItem`
|
|
64
|
+
);
|
|
65
|
+
if (menuItem === void 0 || menu === void 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const contentValue = context.getPropValue(menuItem.id, "value") ?? context.indexesWithinAncestors.get(menuItem.id)?.toString();
|
|
69
|
+
if (contentValue) {
|
|
70
|
+
context.setPropVariable(menu.id, "value", contentValue);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
NavigationMenu,
|
|
78
|
+
NavigationMenuContent,
|
|
79
|
+
NavigationMenuItem,
|
|
80
|
+
NavigationMenuLink,
|
|
81
|
+
NavigationMenuList,
|
|
82
|
+
NavigationMenuTrigger,
|
|
83
|
+
NavigationMenuViewport,
|
|
84
|
+
hooksNavigationMenu
|
|
85
|
+
};
|