@pathscale/ui 0.1.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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/Avatar-CzIirpVq.d.ts +33 -0
- package/dist/Button-BOYHKShy.d.ts +63 -0
- package/dist/Input-CvNxe1rq.d.ts +34 -0
- package/dist/Textarea-5_oQknZn.d.ts +37 -0
- package/dist/chunk/3MUBOGZG.js +213 -0
- package/dist/chunk/EB7KXR65.js +102 -0
- package/dist/chunk/G6RG4LR7.js +87 -0
- package/dist/chunk/HEJAQSH5.jsx +100 -0
- package/dist/chunk/HKS7ET6T.js +56 -0
- package/dist/chunk/KACNXPUM.jsx +103 -0
- package/dist/chunk/NLD5D3P7.jsx +94 -0
- package/dist/chunk/P7WPLZNA.jsx +59 -0
- package/dist/chunk/UTRNHAP4.js +95 -0
- package/dist/chunk/VMEDFWWG.js +102 -0
- package/dist/chunk/WB6NEEQV.jsx +107 -0
- package/dist/chunk/YZ3ID3UY.jsx +226 -0
- package/dist/classes-B_S9K-9I.d.ts +13 -0
- package/dist/components/avatar/index.d.ts +8 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/index.jsx +7 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/index.jsx +8 -0
- package/dist/components/input/index.d.ts +8 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/index.jsx +7 -0
- package/dist/components/polymorphic/index.d.ts +35 -0
- package/dist/components/polymorphic/index.js +1 -0
- package/dist/components/polymorphic/index.jsx +8 -0
- package/dist/components/textarea/index.d.ts +8 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/index.jsx +7 -0
- package/dist/index.css +73 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/index.jsx +20 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 pathscale
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, ComponentProps } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const avatarVariants: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
size: {
|
|
7
|
+
sm: string;
|
|
8
|
+
md: string;
|
|
9
|
+
lg: string;
|
|
10
|
+
};
|
|
11
|
+
shape: {
|
|
12
|
+
circle: string;
|
|
13
|
+
rounded: string;
|
|
14
|
+
};
|
|
15
|
+
variant: {
|
|
16
|
+
filled: string;
|
|
17
|
+
outlined: string;
|
|
18
|
+
ghost: string;
|
|
19
|
+
};
|
|
20
|
+
}> & ClassProps) | undefined): string;
|
|
21
|
+
variantKeys: ("size" | "shape" | "variant")[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type AvatarVariantProps = VariantProps<typeof avatarVariants>;
|
|
25
|
+
type AvatarProps = AvatarVariantProps & ClassProps & ComponentProps<"img"> & {
|
|
26
|
+
src?: string;
|
|
27
|
+
dataSrc?: string;
|
|
28
|
+
alt?: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
};
|
|
31
|
+
declare const Avatar: Component<AvatarProps>;
|
|
32
|
+
|
|
33
|
+
export { Avatar as A, type AvatarProps as a, avatarVariants as b };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as solid_js from 'solid-js';
|
|
2
|
+
import { ValidComponent } from 'solid-js';
|
|
3
|
+
import { PolymorphicProps, PolymorphicButtonSharedProps, PolymorphicButtonElementProps } from './components/polymorphic/index.js';
|
|
4
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
5
|
+
|
|
6
|
+
declare const buttonVariants: {
|
|
7
|
+
(props?: (ConfigVariants<{
|
|
8
|
+
size: {
|
|
9
|
+
sm: string;
|
|
10
|
+
md: string;
|
|
11
|
+
lg: string;
|
|
12
|
+
};
|
|
13
|
+
color: {
|
|
14
|
+
inverse: string;
|
|
15
|
+
primary: string;
|
|
16
|
+
secondary: string;
|
|
17
|
+
tertiary: string;
|
|
18
|
+
accent: string;
|
|
19
|
+
positive: string;
|
|
20
|
+
destructive: string;
|
|
21
|
+
};
|
|
22
|
+
align: {
|
|
23
|
+
start: string;
|
|
24
|
+
center: string;
|
|
25
|
+
end: string;
|
|
26
|
+
};
|
|
27
|
+
shape: {
|
|
28
|
+
circle: string;
|
|
29
|
+
rounded: string;
|
|
30
|
+
};
|
|
31
|
+
spacing: {
|
|
32
|
+
0: string;
|
|
33
|
+
xs: string;
|
|
34
|
+
sm: string;
|
|
35
|
+
md: string;
|
|
36
|
+
lg: string;
|
|
37
|
+
};
|
|
38
|
+
loading: {
|
|
39
|
+
true: string;
|
|
40
|
+
false: string;
|
|
41
|
+
};
|
|
42
|
+
stretched: {
|
|
43
|
+
true: string;
|
|
44
|
+
false: string;
|
|
45
|
+
};
|
|
46
|
+
variant: {
|
|
47
|
+
fill: string[];
|
|
48
|
+
gray: string[];
|
|
49
|
+
ghost: string[];
|
|
50
|
+
};
|
|
51
|
+
}> & ClassProps) | undefined): string;
|
|
52
|
+
variantKeys: ("size" | "color" | "align" | "shape" | "spacing" | "loading" | "stretched" | "variant")[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
56
|
+
type ButtonSharedProps<T extends ValidComponent = "button"> = PolymorphicButtonSharedProps<T> & ClassProps;
|
|
57
|
+
type ButtonElementProps = PolymorphicButtonElementProps & ButtonSharedProps & {
|
|
58
|
+
"aria-busy": "true" | undefined;
|
|
59
|
+
};
|
|
60
|
+
type ButtonProps<T extends ValidComponent = "button"> = Partial<ButtonVariantProps> & Partial<ButtonSharedProps<T>>;
|
|
61
|
+
declare const Button: <T extends ValidComponent = "button">(props: PolymorphicProps<T, ButtonProps<T>>) => solid_js.JSX.Element;
|
|
62
|
+
|
|
63
|
+
export { Button as B, type ButtonElementProps as a, type ButtonProps as b, type ButtonSharedProps as c, type ButtonVariantProps as d };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentProps, JSX } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const inputVariants: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
color: {
|
|
7
|
+
danger: string;
|
|
8
|
+
success: string;
|
|
9
|
+
warning: string;
|
|
10
|
+
};
|
|
11
|
+
rounded: {
|
|
12
|
+
true: string;
|
|
13
|
+
false: string;
|
|
14
|
+
};
|
|
15
|
+
expanded: {
|
|
16
|
+
true: string;
|
|
17
|
+
false: string;
|
|
18
|
+
};
|
|
19
|
+
loading: {
|
|
20
|
+
true: string;
|
|
21
|
+
false: string;
|
|
22
|
+
};
|
|
23
|
+
}> & ClassProps) | undefined): string;
|
|
24
|
+
variantKeys: ("color" | "rounded" | "loading" | "expanded")[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type InputProps = Partial<VariantProps<typeof inputVariants> & ClassProps & ComponentProps<"input">> & {
|
|
28
|
+
leftIcon?: JSX.Element;
|
|
29
|
+
rightIcon?: JSX.Element;
|
|
30
|
+
passwordReveal?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare const Input: (props: InputProps) => JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { Input as I, type InputProps as a };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, ComponentProps } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const textareaVariants: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
size: {
|
|
7
|
+
sm: string;
|
|
8
|
+
md: string;
|
|
9
|
+
lg: string;
|
|
10
|
+
};
|
|
11
|
+
color: {
|
|
12
|
+
primary: string;
|
|
13
|
+
info: string;
|
|
14
|
+
success: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
danger: string;
|
|
17
|
+
};
|
|
18
|
+
loading: {
|
|
19
|
+
true: string;
|
|
20
|
+
false: string;
|
|
21
|
+
};
|
|
22
|
+
resize: {
|
|
23
|
+
none: string;
|
|
24
|
+
both: string;
|
|
25
|
+
x: string;
|
|
26
|
+
y: string;
|
|
27
|
+
};
|
|
28
|
+
}> & ClassProps) | undefined): string;
|
|
29
|
+
variantKeys: ("size" | "color" | "loading" | "resize")[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type TextareaProps = VariantProps<typeof textareaVariants> & ClassProps & ComponentProps<"textarea"> & {
|
|
33
|
+
hasCounter?: boolean;
|
|
34
|
+
};
|
|
35
|
+
declare const Textarea: Component<TextareaProps>;
|
|
36
|
+
|
|
37
|
+
export { Textarea as T, type TextareaProps as a };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { PolymorphicButton_default } from './G6RG4LR7.js';
|
|
2
|
+
import { cva } from './HKS7ET6T.js';
|
|
3
|
+
import { createComponent, mergeProps as mergeProps$1 } from 'solid-js/web';
|
|
4
|
+
import { mergeProps, splitProps } from 'solid-js';
|
|
5
|
+
|
|
6
|
+
// src/components/button/Button.styles.ts
|
|
7
|
+
var buttonVariants = cva(
|
|
8
|
+
[
|
|
9
|
+
"inline-flex items-center font-medium outline-none select-none",
|
|
10
|
+
"not-disabled:cursor-pointer",
|
|
11
|
+
"disabled:cursor-not-allowed disabled:opacity-25",
|
|
12
|
+
"aria-busy:cursor-wait",
|
|
13
|
+
"transition active:transition-none"
|
|
14
|
+
],
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "text-sm leading-tight",
|
|
19
|
+
md: "text-base leading-tight",
|
|
20
|
+
lg: "text-lg leading-tight"
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
inverse: "",
|
|
24
|
+
primary: "",
|
|
25
|
+
secondary: "",
|
|
26
|
+
tertiary: "",
|
|
27
|
+
accent: "",
|
|
28
|
+
positive: "",
|
|
29
|
+
destructive: ""
|
|
30
|
+
},
|
|
31
|
+
align: {
|
|
32
|
+
start: "justify-start",
|
|
33
|
+
center: "justify-center",
|
|
34
|
+
end: "justify-end"
|
|
35
|
+
},
|
|
36
|
+
shape: {
|
|
37
|
+
circle: "rounded-full",
|
|
38
|
+
rounded: "rounded-lg"
|
|
39
|
+
},
|
|
40
|
+
spacing: {
|
|
41
|
+
0: "gap-0 p-0",
|
|
42
|
+
xs: "gap-1.5 px-1.5 py-1.5",
|
|
43
|
+
sm: "gap-1.5 px-2 py-2",
|
|
44
|
+
md: "gap-1.5 px-3 py-2",
|
|
45
|
+
lg: "gap-1.5 px-3.5 py-2.5"
|
|
46
|
+
},
|
|
47
|
+
loading: {
|
|
48
|
+
true: "",
|
|
49
|
+
false: ""
|
|
50
|
+
},
|
|
51
|
+
stretched: {
|
|
52
|
+
true: "w-full",
|
|
53
|
+
false: "w-fit"
|
|
54
|
+
},
|
|
55
|
+
variant: {
|
|
56
|
+
fill: [
|
|
57
|
+
"not-disabled:hover:opacity-75 not-disabled:active:opacity-50",
|
|
58
|
+
"aria-[current]:opacity-75 data-expanded:opacity-75 data-open:opacity-75",
|
|
59
|
+
"focus-visible:opacity-75"
|
|
60
|
+
],
|
|
61
|
+
gray: [
|
|
62
|
+
"bg-bg-primary not-disabled:hover:bg-bg-secondary not-disabled:active:bg-bg-secondary not-disabled:active:opacity-75",
|
|
63
|
+
"aria-[current]:bg-bg-secondary data-expanded:bg-bg-secondary data-open:bg-bg-secondary",
|
|
64
|
+
"focus-visible:bg-bg-secondary"
|
|
65
|
+
],
|
|
66
|
+
ghost: [
|
|
67
|
+
"not-disabled:hover:bg-bg-primary not-disabled:active:bg-bg-primary not-disabled:active:opacity-75",
|
|
68
|
+
"aria-[current]:bg-bg-primary data-expanded:bg-bg-primary data-open:bg-bg-primary",
|
|
69
|
+
"focus-visible:bg-bg-primary"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
compoundVariants: [
|
|
74
|
+
{
|
|
75
|
+
variant: "fill",
|
|
76
|
+
color: "inverse",
|
|
77
|
+
class: "bg-bg-inverse text-fg-inverse"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
variant: "fill",
|
|
81
|
+
color: "primary",
|
|
82
|
+
class: "bg-bg-primary text-fg-body"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: "fill",
|
|
86
|
+
color: "secondary",
|
|
87
|
+
class: "bg-bg-secondary text-fg-body"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
variant: "fill",
|
|
91
|
+
color: "tertiary",
|
|
92
|
+
class: "bg-bg-tertiary text-fg-body"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: "fill",
|
|
96
|
+
color: "accent",
|
|
97
|
+
class: "bg-bg-accent text-light"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
variant: "fill",
|
|
101
|
+
color: "positive",
|
|
102
|
+
class: "bg-bg-positive text-light"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
variant: "fill",
|
|
106
|
+
color: "destructive",
|
|
107
|
+
class: "bg-bg-destructive text-light"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
variant: "gray",
|
|
111
|
+
color: "inverse",
|
|
112
|
+
class: "text-fg-inverse"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
variant: "gray",
|
|
116
|
+
color: "primary",
|
|
117
|
+
class: "text-fg-primary"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
variant: "gray",
|
|
121
|
+
color: "secondary",
|
|
122
|
+
class: "text-fg-secondary"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
variant: "gray",
|
|
126
|
+
color: "tertiary",
|
|
127
|
+
class: "text-fg-tertiary"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
variant: "gray",
|
|
131
|
+
color: "accent",
|
|
132
|
+
class: "text-fg-accent"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
variant: "gray",
|
|
136
|
+
color: "positive",
|
|
137
|
+
class: "text-fg-positive"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
variant: "gray",
|
|
141
|
+
color: "destructive",
|
|
142
|
+
class: "text-fg-destructive"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
color: "inverse",
|
|
147
|
+
class: "text-fg-inverse"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
variant: "ghost",
|
|
151
|
+
color: "primary",
|
|
152
|
+
class: "text-fg-primary"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
color: "secondary",
|
|
157
|
+
class: "text-fg-secondary"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
variant: "ghost",
|
|
161
|
+
color: "tertiary",
|
|
162
|
+
class: "text-fg-tertiary"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
variant: "ghost",
|
|
166
|
+
color: "accent",
|
|
167
|
+
class: "text-fg-accent"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
variant: "ghost",
|
|
171
|
+
color: "positive",
|
|
172
|
+
class: "text-fg-positive"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
variant: "ghost",
|
|
176
|
+
color: "destructive",
|
|
177
|
+
class: "text-fg-destructive"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
defaultVariants: {
|
|
181
|
+
size: "md",
|
|
182
|
+
color: "primary",
|
|
183
|
+
align: "center",
|
|
184
|
+
shape: "rounded",
|
|
185
|
+
spacing: "md",
|
|
186
|
+
variant: "fill",
|
|
187
|
+
loading: false,
|
|
188
|
+
stretched: false
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// src/components/button/Button.tsx
|
|
194
|
+
var Button = (props) => {
|
|
195
|
+
const defaultedProps = mergeProps({
|
|
196
|
+
color: "primary"
|
|
197
|
+
}, props);
|
|
198
|
+
const [variantProps, otherProps] = splitProps(defaultedProps, ["class", ...buttonVariants.variantKeys]);
|
|
199
|
+
return createComponent(PolymorphicButton_default, mergeProps$1({
|
|
200
|
+
get ["class"]() {
|
|
201
|
+
return buttonVariants(variantProps);
|
|
202
|
+
},
|
|
203
|
+
get ["aria-busy"]() {
|
|
204
|
+
return variantProps.loading ? "true" : void 0;
|
|
205
|
+
}
|
|
206
|
+
}, otherProps));
|
|
207
|
+
};
|
|
208
|
+
var Button_default = Button;
|
|
209
|
+
|
|
210
|
+
// src/components/button/index.ts
|
|
211
|
+
var button_default = Button_default;
|
|
212
|
+
|
|
213
|
+
export { button_default };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, createMemo, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/textarea/Textarea.styles.ts
|
|
6
|
+
var textareaVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"block w-full rounded-md border bg-white px-3 py-2 text-sm",
|
|
9
|
+
"text-gray-900 placeholder-gray-400",
|
|
10
|
+
"focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent",
|
|
11
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12
|
+
],
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "text-sm py-1.5",
|
|
17
|
+
md: "text-base py-2",
|
|
18
|
+
lg: "text-lg py-3"
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
primary: "border-blue-500",
|
|
22
|
+
info: "border-cyan-500",
|
|
23
|
+
success: "border-green-500",
|
|
24
|
+
warning: "border-yellow-500",
|
|
25
|
+
danger: "border-red-500"
|
|
26
|
+
},
|
|
27
|
+
loading: {
|
|
28
|
+
true: "opacity-50 cursor-wait",
|
|
29
|
+
false: ""
|
|
30
|
+
},
|
|
31
|
+
resize: {
|
|
32
|
+
none: "resize-none",
|
|
33
|
+
both: "resize",
|
|
34
|
+
x: "resize-x",
|
|
35
|
+
y: "resize-y"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
size: "md",
|
|
40
|
+
color: "primary",
|
|
41
|
+
loading: false,
|
|
42
|
+
resize: "y"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// src/components/textarea/Textarea.tsx
|
|
48
|
+
var _tmpl$ = /* @__PURE__ */ template(`<small> / `);
|
|
49
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div class="relative w-full"><textarea>`);
|
|
50
|
+
var Textarea = (props) => {
|
|
51
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["hasCounter", "value", "onInput", "onFocus", "onBlur", "maxLength"], ["class", ...textareaVariants.variantKeys]);
|
|
52
|
+
const [isFocused, setFocused] = createSignal(false);
|
|
53
|
+
const valueLength = createMemo(() => typeof localProps.value === "string" ? localProps.value.length : 0);
|
|
54
|
+
const showCounter = createMemo(() => localProps.maxLength && localProps.hasCounter);
|
|
55
|
+
return (() => {
|
|
56
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild;
|
|
57
|
+
_el$2.addEventListener("blur", (e) => {
|
|
58
|
+
setFocused(false);
|
|
59
|
+
typeof localProps.onBlur === "function" && localProps.onBlur(e);
|
|
60
|
+
});
|
|
61
|
+
_el$2.addEventListener("focus", (e) => {
|
|
62
|
+
setFocused(true);
|
|
63
|
+
typeof localProps.onFocus === "function" && localProps.onFocus(e);
|
|
64
|
+
});
|
|
65
|
+
spread(_el$2, mergeProps({
|
|
66
|
+
get ["class"]() {
|
|
67
|
+
return textareaVariants(variantProps);
|
|
68
|
+
},
|
|
69
|
+
get value() {
|
|
70
|
+
return localProps.value;
|
|
71
|
+
},
|
|
72
|
+
get maxLength() {
|
|
73
|
+
return localProps.maxLength;
|
|
74
|
+
},
|
|
75
|
+
get onInput() {
|
|
76
|
+
return localProps.onInput;
|
|
77
|
+
},
|
|
78
|
+
get ["aria-invalid"]() {
|
|
79
|
+
return variantProps.color === "danger" ? "true" : void 0;
|
|
80
|
+
}
|
|
81
|
+
}, otherProps), false, false);
|
|
82
|
+
insert(_el$, createComponent(Show, {
|
|
83
|
+
get when() {
|
|
84
|
+
return showCounter();
|
|
85
|
+
},
|
|
86
|
+
get children() {
|
|
87
|
+
var _el$3 = _tmpl$(), _el$4 = _el$3.firstChild;
|
|
88
|
+
insert(_el$3, valueLength, _el$4);
|
|
89
|
+
insert(_el$3, () => localProps.maxLength, null);
|
|
90
|
+
effect(() => className(_el$3, classes("absolute bottom-1 right-2 text-xs text-gray-500 transition-opacity", isFocused() ? "opacity-100" : "opacity-0")));
|
|
91
|
+
return _el$3;
|
|
92
|
+
}
|
|
93
|
+
}), null);
|
|
94
|
+
return _el$;
|
|
95
|
+
})();
|
|
96
|
+
};
|
|
97
|
+
var Textarea_default = Textarea;
|
|
98
|
+
|
|
99
|
+
// src/components/textarea/index.ts
|
|
100
|
+
var textarea_default = Textarea_default;
|
|
101
|
+
|
|
102
|
+
export { textarea_default };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createComponent, Dynamic, mergeProps } from 'solid-js/web';
|
|
2
|
+
import { splitProps, createMemo, untrack, createSignal } from 'solid-js';
|
|
3
|
+
|
|
4
|
+
// src/components/polymorphic/Polymorphic.tsx
|
|
5
|
+
var Polymorphic = (props) => {
|
|
6
|
+
const [localProps, otherProps] = splitProps(props, ["as"]);
|
|
7
|
+
const cached = createMemo(() => localProps.as ?? "div");
|
|
8
|
+
return createMemo(() => {
|
|
9
|
+
const component = cached();
|
|
10
|
+
switch (typeof component) {
|
|
11
|
+
case "function":
|
|
12
|
+
return untrack(() => component(otherProps));
|
|
13
|
+
case "string":
|
|
14
|
+
return createComponent(Dynamic, mergeProps({
|
|
15
|
+
component
|
|
16
|
+
}, otherProps));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var Polymorphic_default = Polymorphic;
|
|
21
|
+
|
|
22
|
+
// src/lib/iterable.ts
|
|
23
|
+
function chain(callbacks) {
|
|
24
|
+
return (...args) => {
|
|
25
|
+
for (const callback of callbacks) callback?.(...args);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/lib/refs/mergeRefs.ts
|
|
30
|
+
function mergeRefs(...refs) {
|
|
31
|
+
return chain(refs);
|
|
32
|
+
}
|
|
33
|
+
function createTagName(props) {
|
|
34
|
+
return createMemo(
|
|
35
|
+
() => props.element()?.tagName.toLowerCase() ?? props.fallback
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/lib/tag/createIsButton.ts
|
|
40
|
+
var BUTTON_INPUT_TYPES = [
|
|
41
|
+
"button",
|
|
42
|
+
"color",
|
|
43
|
+
"file",
|
|
44
|
+
"image",
|
|
45
|
+
"reset",
|
|
46
|
+
"submit"
|
|
47
|
+
];
|
|
48
|
+
function isButton(tagName, type) {
|
|
49
|
+
if (tagName === "button") {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (tagName === "input" && type !== void 0) {
|
|
53
|
+
return BUTTON_INPUT_TYPES.indexOf(type) !== -1;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
function createIsButton(props) {
|
|
58
|
+
const tagName = createTagName({
|
|
59
|
+
element: props.element,
|
|
60
|
+
fallback: "button"
|
|
61
|
+
});
|
|
62
|
+
return createMemo(() => isButton(tagName(), props.type));
|
|
63
|
+
}
|
|
64
|
+
var PolymorphicButton = (props) => {
|
|
65
|
+
const [ref, setRef] = createSignal(null);
|
|
66
|
+
const [localProps, otherProps] = splitProps(props, ["ref", "type"]);
|
|
67
|
+
const isButton2 = createIsButton({
|
|
68
|
+
element: ref,
|
|
69
|
+
type: localProps.type
|
|
70
|
+
});
|
|
71
|
+
return createComponent(Polymorphic_default, mergeProps({
|
|
72
|
+
as: "button",
|
|
73
|
+
ref(r$) {
|
|
74
|
+
var _ref$ = mergeRefs(setRef, localProps.ref);
|
|
75
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
76
|
+
},
|
|
77
|
+
get type() {
|
|
78
|
+
return isButton2() ? "button" : void 0;
|
|
79
|
+
},
|
|
80
|
+
get role() {
|
|
81
|
+
return !isButton2() ? "button" : void 0;
|
|
82
|
+
}
|
|
83
|
+
}, otherProps));
|
|
84
|
+
};
|
|
85
|
+
var PolymorphicButton_default = PolymorphicButton;
|
|
86
|
+
|
|
87
|
+
export { PolymorphicButton_default, Polymorphic_default };
|