@webstudio-is/sdk-components-react-radix 0.87.1 → 0.89.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 +605 -114
- package/lib/__generated__/button.props.js +158 -47
- package/lib/__generated__/checkbox.props.js +1083 -0
- package/lib/__generated__/collapsible.props.js +234 -44
- package/lib/__generated__/dialog.props.js +611 -121
- package/lib/__generated__/input.props.js +264 -47
- package/lib/__generated__/label.props.js +123 -23
- package/lib/__generated__/navigation-menu.props.js +2565 -0
- package/lib/__generated__/popover.props.js +129 -28
- package/lib/__generated__/radio-group.props.js +1627 -0
- package/lib/__generated__/select.props.js +3678 -0
- package/lib/__generated__/sheet.props.js +591 -121
- package/lib/__generated__/switch.props.js +1083 -0
- package/lib/__generated__/tabs.props.js +906 -68
- package/lib/__generated__/textarea.props.js +177 -31
- package/lib/__generated__/tooltip.props.js +131 -29
- package/lib/accordion.js +11 -4
- package/lib/accordion.ws.js +88 -72
- package/lib/checkbox.js +13 -0
- package/lib/checkbox.ws.js +153 -0
- package/lib/cjs/__generated__/accordion.props.js +605 -114
- package/lib/cjs/__generated__/button.props.js +158 -47
- package/lib/cjs/__generated__/checkbox.props.js +1103 -0
- package/lib/cjs/__generated__/collapsible.props.js +234 -44
- package/lib/cjs/__generated__/dialog.props.js +611 -121
- package/lib/cjs/__generated__/input.props.js +264 -47
- package/lib/cjs/__generated__/label.props.js +123 -23
- package/lib/cjs/__generated__/navigation-menu.props.js +2585 -0
- package/lib/cjs/__generated__/popover.props.js +129 -28
- package/lib/cjs/__generated__/radio-group.props.js +1647 -0
- package/lib/cjs/__generated__/select.props.js +3698 -0
- package/lib/cjs/__generated__/sheet.props.js +591 -121
- package/lib/cjs/__generated__/switch.props.js +1103 -0
- package/lib/cjs/__generated__/tabs.props.js +906 -68
- package/lib/cjs/__generated__/textarea.props.js +177 -31
- package/lib/cjs/__generated__/tooltip.props.js +131 -29
- package/lib/cjs/accordion.js +11 -4
- package/lib/cjs/accordion.ws.js +86 -71
- package/lib/cjs/{textarea.js → checkbox.js} +9 -6
- package/lib/cjs/checkbox.ws.js +174 -0
- package/lib/cjs/collapsible.ws.js +5 -1
- package/lib/cjs/components.js +27 -14
- package/lib/cjs/dialog.ws.js +18 -17
- package/lib/cjs/hooks.js +5 -1
- package/lib/cjs/label.ws.js +2 -1
- package/lib/cjs/metas.js +29 -14
- package/lib/cjs/navigation-menu.js +107 -0
- package/lib/cjs/navigation-menu.ws.js +514 -0
- package/lib/cjs/popover.ws.js +13 -9
- package/lib/cjs/props-descriptions.js +56 -0
- package/lib/cjs/props.js +27 -14
- package/lib/cjs/{button.js → radio-group.js} +10 -8
- package/lib/cjs/radio-group.ws.js +191 -0
- package/lib/cjs/select.js +83 -0
- package/lib/cjs/select.ws.js +350 -0
- package/lib/cjs/sheet.ws.js +88 -176
- package/lib/cjs/{input.js → switch.js} +8 -9
- package/lib/cjs/switch.ws.js +173 -0
- package/lib/cjs/tabs.js +2 -3
- package/lib/cjs/tabs.ws.js +14 -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 +12 -8
- package/lib/collapsible.ws.js +5 -1
- package/lib/components.js +44 -22
- package/lib/dialog.ws.js +18 -17
- package/lib/hooks.js +5 -1
- package/lib/label.ws.js +2 -1
- package/lib/metas.js +58 -24
- package/lib/navigation-menu.js +85 -0
- package/lib/navigation-menu.ws.js +501 -0
- package/lib/popover.ws.js +13 -9
- package/lib/props-descriptions.js +36 -0
- package/lib/props.js +56 -24
- package/lib/radio-group.js +11 -0
- package/lib/radio-group.ws.js +173 -0
- package/lib/select.js +75 -0
- package/lib/select.ws.js +338 -0
- package/lib/sheet.ws.js +89 -194
- package/lib/switch.js +7 -0
- package/lib/switch.ws.js +145 -0
- package/lib/tabs.js +3 -5
- package/lib/tabs.ws.js +15 -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 +12 -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-descriptions.d.ts +29 -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 +14 -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 +675 -108
- package/src/__generated__/button.props.ts +177 -45
- package/src/__generated__/checkbox.props.ts +1217 -0
- package/src/__generated__/collapsible.props.ts +261 -42
- package/src/__generated__/dialog.props.ts +682 -115
- package/src/__generated__/input.props.ts +292 -44
- package/src/__generated__/label.props.ts +137 -22
- package/src/__generated__/navigation-menu.props.ts +2882 -0
- package/src/__generated__/popover.props.ts +142 -24
- package/src/__generated__/radio-group.props.ts +1828 -0
- package/src/__generated__/select.props.ts +4130 -0
- package/src/__generated__/sheet.props.ts +657 -110
- package/src/__generated__/switch.props.ts +1217 -0
- package/src/__generated__/tabs.props.ts +1019 -67
- package/src/__generated__/textarea.props.ts +195 -30
- package/src/__generated__/tooltip.props.ts +145 -25
- package/src/accordion.tsx +14 -7
- package/src/accordion.ws.ts +87 -70
- package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
- package/src/checkbox.tsx +22 -0
- package/src/checkbox.ws.ts +154 -0
- package/src/collapsible.ws.ts +6 -1
- package/src/components.ts +25 -12
- package/src/dialog.ws.tsx +17 -16
- package/src/hooks.ts +4 -0
- package/src/label.ws.ts +3 -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 +524 -0
- package/src/popover.ws.tsx +13 -9
- package/src/props-descriptions.ts +43 -0
- 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 +178 -0
- package/src/select.stories.tsx +21 -0
- package/src/select.tsx +112 -0
- package/src/select.ws.ts +349 -0
- package/src/sheet.ws.tsx +91 -209
- package/src/{button.stories.ts → switch.stories.ts} +6 -19
- package/src/switch.tsx +10 -0
- package/src/switch.ws.ts +146 -0
- package/src/tabs.tsx +4 -17
- package/src/tabs.ws.ts +19 -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 +13 -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/src/button.ws.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { ButtonElementIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
EmbedTemplateInstance,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "@webstudio-is/react-sdk";
|
|
9
|
-
import { button } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
-
import { props } from "./__generated__/button.props";
|
|
11
|
-
import * as tc from "./theme/tailwind-classes";
|
|
12
|
-
|
|
13
|
-
const presetStyle = {
|
|
14
|
-
button,
|
|
15
|
-
} satisfies PresetStyle<"button">;
|
|
16
|
-
|
|
17
|
-
export const template = (props?: {
|
|
18
|
-
props?: EmbedTemplateInstance["props"];
|
|
19
|
-
children?: WsComponentMeta["template"];
|
|
20
|
-
}): NonNullable<WsComponentMeta["template"]> => [
|
|
21
|
-
{
|
|
22
|
-
type: "instance",
|
|
23
|
-
component: "Button",
|
|
24
|
-
styles: [
|
|
25
|
-
// 'inline-flex items-center justify-center rounded-md text-sm font-medium
|
|
26
|
-
// ring-offset-background transition-colors
|
|
27
|
-
// focus-visible:outline-none focus-visible:ring-2
|
|
28
|
-
// focus-visible:ring-ring focus-visible:ring-offset-2
|
|
29
|
-
// disabled:pointer-events-none disabled:opacity-50'
|
|
30
|
-
tc.border(0),
|
|
31
|
-
tc.bg("transparent"),
|
|
32
|
-
tc.inlineFlex(),
|
|
33
|
-
tc.items("center"),
|
|
34
|
-
tc.justify("center"),
|
|
35
|
-
tc.rounded("md"),
|
|
36
|
-
tc.text("sm"),
|
|
37
|
-
tc.font("medium"),
|
|
38
|
-
tc.focusVisible(
|
|
39
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
40
|
-
),
|
|
41
|
-
tc.state([tc.pointerEvents("none"), tc.opacity(50)].flat(), ":disabled"),
|
|
42
|
-
|
|
43
|
-
// VARIANT
|
|
44
|
-
// default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
45
|
-
tc.state(
|
|
46
|
-
[tc.bg("primary"), tc.text("primaryForeground")].flat(),
|
|
47
|
-
"[data-variant=default]"
|
|
48
|
-
),
|
|
49
|
-
tc.state(
|
|
50
|
-
[[tc.bg("primary", 90)].flat()].flat(),
|
|
51
|
-
"[data-variant=default]:hover"
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
// destructive:'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
55
|
-
tc.state(
|
|
56
|
-
[tc.bg("destructive"), tc.text("destructiveForeground")].flat(),
|
|
57
|
-
"[data-variant=destructive]"
|
|
58
|
-
),
|
|
59
|
-
tc.state(
|
|
60
|
-
[[tc.bg("destructive", 90)].flat()].flat(),
|
|
61
|
-
"[data-variant=destructive]:hover"
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
// outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
65
|
-
tc.state(
|
|
66
|
-
[tc.border(), tc.border("input"), tc.bg("background")].flat(),
|
|
67
|
-
"[data-variant=outline]"
|
|
68
|
-
),
|
|
69
|
-
tc.state(
|
|
70
|
-
[[tc.bg("accent", 90), tc.text("accentForeground")].flat()].flat(),
|
|
71
|
-
"[data-variant=outline]:hover"
|
|
72
|
-
),
|
|
73
|
-
|
|
74
|
-
// secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
75
|
-
tc.state(
|
|
76
|
-
[tc.bg("secondary"), tc.text("secondaryForeground")].flat(),
|
|
77
|
-
"[data-variant=secondary]"
|
|
78
|
-
),
|
|
79
|
-
tc.state(
|
|
80
|
-
[[tc.bg("secondary", 80)].flat()].flat(),
|
|
81
|
-
"[data-variant=secondary]:hover"
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
// ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
85
|
-
tc.state(
|
|
86
|
-
[[tc.bg("accent"), tc.text("accentForeground")].flat()].flat(),
|
|
87
|
-
"[data-variant=ghost]:hover"
|
|
88
|
-
),
|
|
89
|
-
|
|
90
|
-
// link: 'text-primary underline-offset-4 hover:underline',
|
|
91
|
-
tc.state(
|
|
92
|
-
[tc.text("primary"), tc.underlineOffset(4)].flat(),
|
|
93
|
-
"[data-variant=link]"
|
|
94
|
-
),
|
|
95
|
-
tc.state([[tc.underline()].flat()].flat(), "[data-variant=link]:hover"),
|
|
96
|
-
|
|
97
|
-
// SIZE
|
|
98
|
-
// default: 'h-10 px-4 py-2',
|
|
99
|
-
tc.state([tc.h(10), tc.px(4), tc.py(2)].flat(), "[data-size=default]"),
|
|
100
|
-
|
|
101
|
-
// sm: 'h-9 rounded-md px-3',
|
|
102
|
-
tc.state([tc.h(10), tc.px(3)].flat(), "[data-size=sm]"),
|
|
103
|
-
|
|
104
|
-
// lg: 'h-11 rounded-md px-8',
|
|
105
|
-
tc.state([tc.h(11), tc.px(8)].flat(), "[data-size=lg]"),
|
|
106
|
-
|
|
107
|
-
// icon: 'h-10 w-10',
|
|
108
|
-
tc.state([tc.h(10), tc.w(10)].flat(), "[data-size=icon]"),
|
|
109
|
-
].flat(),
|
|
110
|
-
|
|
111
|
-
children: props?.children ?? [{ type: "text", value: "Button" }],
|
|
112
|
-
props: props?.props,
|
|
113
|
-
},
|
|
114
|
-
];
|
|
115
|
-
|
|
116
|
-
export const meta: WsComponentMeta = {
|
|
117
|
-
category: "radix",
|
|
118
|
-
type: "container",
|
|
119
|
-
invalidAncestors: ["Button"],
|
|
120
|
-
icon: ButtonElementIcon,
|
|
121
|
-
presetStyle,
|
|
122
|
-
states: [
|
|
123
|
-
...defaultStates,
|
|
124
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
125
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
126
|
-
|
|
127
|
-
{ selector: "[data-variant=default]", label: "Default" },
|
|
128
|
-
{ selector: "[data-variant=default]:hover", label: "Default Hover" },
|
|
129
|
-
|
|
130
|
-
{ selector: "[data-variant=destructive]", label: "Destructive" },
|
|
131
|
-
{
|
|
132
|
-
selector: "[data-variant=destructive]:hover",
|
|
133
|
-
label: "Destructive Hover",
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
{ selector: "[data-variant=outline]", label: "Outline" },
|
|
137
|
-
{ selector: "[data-variant=outline]:hover", label: "Outline Hover" },
|
|
138
|
-
|
|
139
|
-
{ selector: "[data-variant=secondary]", label: "Secondary" },
|
|
140
|
-
{ selector: "[data-variant=secondary]:hover", label: "Secondary Hover" },
|
|
141
|
-
|
|
142
|
-
{ selector: "[data-variant=ghost]", label: "Ghost" },
|
|
143
|
-
{ selector: "[data-variant=ghost]:hover", label: "Ghost Hover" },
|
|
144
|
-
|
|
145
|
-
{ selector: "[data-variant=link]", label: "Link" },
|
|
146
|
-
{ selector: "[data-variant=link]:hover", label: "Link Hover" },
|
|
147
|
-
],
|
|
148
|
-
order: 1,
|
|
149
|
-
template: template(),
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
153
|
-
props,
|
|
154
|
-
initialProps: ["id", "type", "variant", "size", "aria-label"],
|
|
155
|
-
};
|
package/src/input.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
|
-
// We can't use .displayName until this is merged https://github.com/styleguidist/react-docgen-typescript/pull/449
|
|
3
|
-
|
|
4
|
-
import { forwardRef, type ComponentPropsWithoutRef } from "react";
|
|
5
|
-
|
|
6
|
-
export const Input = forwardRef<
|
|
7
|
-
HTMLInputElement,
|
|
8
|
-
ComponentPropsWithoutRef<"input">
|
|
9
|
-
// Make sure children are not passed down to an input, because this will result in error.
|
|
10
|
-
>(({ children: _children, ...props }, ref) => {
|
|
11
|
-
return <input ref={ref} {...props} />;
|
|
12
|
-
});
|
package/src/input.ws.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { FormTextFieldIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/input.props";
|
|
10
|
-
import * as tc from "./theme/tailwind-classes";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
input,
|
|
14
|
-
} satisfies PresetStyle<"input">;
|
|
15
|
-
|
|
16
|
-
export const meta: WsComponentMeta = {
|
|
17
|
-
category: "radix",
|
|
18
|
-
type: "control",
|
|
19
|
-
invalidAncestors: ["Button"],
|
|
20
|
-
icon: FormTextFieldIcon,
|
|
21
|
-
presetStyle,
|
|
22
|
-
states: [
|
|
23
|
-
...defaultStates,
|
|
24
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
25
|
-
{ selector: "::placeholder", label: "Placeholder" },
|
|
26
|
-
{ selector: "::file-selector-button", label: "File Selector Button" },
|
|
27
|
-
// @todo share https://github.com/webstudio-is/webstudio-builder/issues/2102
|
|
28
|
-
{ selector: ":valid", label: "Valid" },
|
|
29
|
-
{ selector: ":invalid", label: "Invalid" },
|
|
30
|
-
{ selector: ":required", label: "Required" },
|
|
31
|
-
{ selector: ":optional", label: "Optional" },
|
|
32
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
33
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
34
|
-
{ selector: ":read-write", label: "Read Write" },
|
|
35
|
-
],
|
|
36
|
-
order: 1,
|
|
37
|
-
template: [
|
|
38
|
-
{
|
|
39
|
-
type: "instance",
|
|
40
|
-
component: "Input",
|
|
41
|
-
styles: [
|
|
42
|
-
// flex h-10 w-full rounded-md border border-input bg-background
|
|
43
|
-
// px-3 py-2 text-sm
|
|
44
|
-
// ring-offset-background
|
|
45
|
-
// file:border-0 file:bg-transparent file:text-sm file:font-medium
|
|
46
|
-
// placeholder:text-muted-foreground
|
|
47
|
-
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
48
|
-
// disabled:cursor-not-allowed disabled:opacity-50"
|
|
49
|
-
tc.flex(),
|
|
50
|
-
tc.h(10),
|
|
51
|
-
tc.w("full"),
|
|
52
|
-
tc.rounded("md"),
|
|
53
|
-
tc.border(),
|
|
54
|
-
tc.border("input"),
|
|
55
|
-
tc.bg("background"),
|
|
56
|
-
tc.px(3),
|
|
57
|
-
tc.py(2),
|
|
58
|
-
tc.text("sm"),
|
|
59
|
-
tc.state(
|
|
60
|
-
[tc.border(0), tc.bg("transparent"), tc.font("medium")].flat(),
|
|
61
|
-
"::file-selector-button"
|
|
62
|
-
),
|
|
63
|
-
tc.state(tc.text("mutedForeground"), "::placeholder"),
|
|
64
|
-
tc.focusVisible(
|
|
65
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
66
|
-
),
|
|
67
|
-
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
|
|
68
|
-
].flat(),
|
|
69
|
-
|
|
70
|
-
children: [],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
76
|
-
props,
|
|
77
|
-
initialProps: ["id", "name", "type", "placeholder", "required", "autoFocus"],
|
|
78
|
-
};
|
package/src/textarea.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
|
-
// We can't use .displayName until this is merged https://github.com/styleguidist/react-docgen-typescript/pull/449
|
|
3
|
-
|
|
4
|
-
import { forwardRef, type ComponentPropsWithoutRef } from "react";
|
|
5
|
-
|
|
6
|
-
export const Textarea = forwardRef<
|
|
7
|
-
HTMLTextAreaElement,
|
|
8
|
-
ComponentPropsWithoutRef<"textarea">
|
|
9
|
-
// Make sure children are not passed down to an input, because this will result in error.
|
|
10
|
-
>(({ children: _children, ...props }, ref) => {
|
|
11
|
-
return <textarea ref={ref} {...props} />;
|
|
12
|
-
});
|
package/src/textarea.ws.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { FormTextAreaIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { textarea } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/textarea.props";
|
|
10
|
-
import * as tc from "./theme/tailwind-classes";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
textarea,
|
|
14
|
-
} satisfies PresetStyle<"textarea">;
|
|
15
|
-
|
|
16
|
-
export const meta: WsComponentMeta = {
|
|
17
|
-
category: "radix",
|
|
18
|
-
type: "control",
|
|
19
|
-
invalidAncestors: ["Button"],
|
|
20
|
-
icon: FormTextAreaIcon,
|
|
21
|
-
presetStyle,
|
|
22
|
-
states: [
|
|
23
|
-
...defaultStates,
|
|
24
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
25
|
-
{ selector: "::placeholder", label: "Placeholder" },
|
|
26
|
-
// @todo share https://github.com/webstudio-is/webstudio-builder/issues/2102
|
|
27
|
-
{ selector: ":valid", label: "Valid" },
|
|
28
|
-
{ selector: ":invalid", label: "Invalid" },
|
|
29
|
-
{ selector: ":required", label: "Required" },
|
|
30
|
-
{ selector: ":optional", label: "Optional" },
|
|
31
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
32
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
33
|
-
{ selector: ":read-write", label: "Read Write" },
|
|
34
|
-
],
|
|
35
|
-
order: 1,
|
|
36
|
-
template: [
|
|
37
|
-
{
|
|
38
|
-
type: "instance",
|
|
39
|
-
component: "Textarea",
|
|
40
|
-
styles: [
|
|
41
|
-
// flex min-h-[80px] w-full rounded-md
|
|
42
|
-
// border border-input bg-background
|
|
43
|
-
// px-3 py-2 text-sm ring-offset-background
|
|
44
|
-
// placeholder:text-muted-foreground
|
|
45
|
-
// focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
46
|
-
// focus-visible:ring-offset-2
|
|
47
|
-
// disabled:cursor-not-allowed disabled:opacity-50
|
|
48
|
-
|
|
49
|
-
tc.flex(),
|
|
50
|
-
tc.minH(20),
|
|
51
|
-
tc.w("full"),
|
|
52
|
-
tc.rounded("md"),
|
|
53
|
-
tc.border(),
|
|
54
|
-
tc.border("input"),
|
|
55
|
-
tc.bg("background"),
|
|
56
|
-
tc.px(3),
|
|
57
|
-
tc.py(2),
|
|
58
|
-
tc.text("sm"),
|
|
59
|
-
tc.state(tc.text("mutedForeground"), "::placeholder"),
|
|
60
|
-
tc.focusVisible(
|
|
61
|
-
[tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
|
|
62
|
-
),
|
|
63
|
-
tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat()),
|
|
64
|
-
].flat(),
|
|
65
|
-
|
|
66
|
-
children: [],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
72
|
-
props,
|
|
73
|
-
initialProps: ["id", "name", "placeholder", "required", "autoFocus"],
|
|
74
|
-
};
|