@pathscale/ui 0.0.1
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-B50OLXuV.d.ts +63 -0
- package/dist/Input-BQbTzjIO.d.ts +34 -0
- package/dist/Textarea-Cpdk7m6S.d.ts +37 -0
- package/dist/chunk/2JGZSAW5.js +107 -0
- package/dist/chunk/4RCWSX7S.jsx +101 -0
- package/dist/chunk/EB7KXR65.js +102 -0
- package/dist/chunk/G6RG4LR7.js +87 -0
- package/dist/chunk/GA2HCFRS.jsx +228 -0
- package/dist/chunk/HKS7ET6T.js +56 -0
- package/dist/chunk/KACNXPUM.jsx +103 -0
- package/dist/chunk/N7BXP7EI.jsx +102 -0
- package/dist/chunk/NZZRKP74.js +214 -0
- package/dist/chunk/P7WPLZNA.jsx +59 -0
- package/dist/chunk/T2DPPLBQ.js +100 -0
- package/dist/chunk/WB6NEEQV.jsx +107 -0
- package/dist/classes-B_S9K-9I.d.ts +13 -0
- package/dist/components/Progress/index.d.ts +42 -0
- package/dist/components/Progress/index.js +278 -0
- package/dist/components/Progress/index.jsx +202 -0
- package/dist/components/accordion/index.d.ts +27 -0
- package/dist/components/accordion/index.js +118 -0
- package/dist/components/accordion/index.jsx +104 -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/breadcrumb/index.d.ts +47 -0
- package/dist/components/breadcrumb/index.js +133 -0
- package/dist/components/breadcrumb/index.jsx +125 -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/checkbox/index.d.ts +40 -0
- package/dist/components/checkbox/index.js +137 -0
- package/dist/components/checkbox/index.jsx +147 -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/pagination/index.d.ts +43 -0
- package/dist/components/pagination/index.js +189 -0
- package/dist/components/pagination/index.jsx +178 -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/select/index.d.ts +44 -0
- package/dist/components/select/index.js +98 -0
- package/dist/components/select/index.jsx +95 -0
- package/dist/components/switch/index.d.ts +72 -0
- package/dist/components/switch/index.js +144 -0
- package/dist/components/switch/index.jsx +159 -0
- package/dist/components/tabs/index.d.ts +42 -0
- package/dist/components/tabs/index.js +166 -0
- package/dist/components/tabs/index.jsx +174 -0
- package/dist/components/tag/index.d.ts +42 -0
- package/dist/components/tag/index.js +115 -0
- package/dist/components/tag/index.jsx +131 -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/components/tooltip/index.d.ts +53 -0
- package/dist/components/tooltip/index.js +103 -0
- package/dist/components/tooltip/index.jsx +99 -0
- package/dist/components/upload/index.d.ts +39 -0
- package/dist/components/upload/index.js +98 -0
- package/dist/components/upload/index.jsx +109 -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 +67 -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" | "shape" | "variant" | "loading" | "align" | "color" | "spacing" | "stretched")[];
|
|
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: ("rounded" | "loading" | "color" | "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" | "loading" | "color" | "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,107 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { template, insert, createComponent, spread, mergeProps as mergeProps$1, effect, className } from 'solid-js/web';
|
|
3
|
+
import { mergeProps, splitProps, createSignal, createEffect, untrack, createMemo, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/Avatar/Avatar.styles.ts
|
|
6
|
+
var avatarVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"flex items-center justify-center mx-1",
|
|
9
|
+
"font-medium outline-none select-none transition active:transition-none",
|
|
10
|
+
"not-disabled:cursor-pointer",
|
|
11
|
+
"disabled:cursor-not-allowed disabled:opacity-25",
|
|
12
|
+
"aria-busy:cursor-wait"
|
|
13
|
+
],
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
sm: "size-8 text-sm",
|
|
18
|
+
md: "size-16 text-base",
|
|
19
|
+
lg: "size-24 text-lg"
|
|
20
|
+
},
|
|
21
|
+
shape: {
|
|
22
|
+
circle: "rounded-full overflow-hidden",
|
|
23
|
+
rounded: "rounded-lg overflow-hidden"
|
|
24
|
+
},
|
|
25
|
+
variant: {
|
|
26
|
+
filled: "bg-gray-200 text-gray-800",
|
|
27
|
+
outlined: "border-2 border-gray-300 text-gray-800",
|
|
28
|
+
ghost: "text-gray-800"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
size: "md",
|
|
33
|
+
shape: "circle",
|
|
34
|
+
variant: "filled"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// src/components/Avatar/utils.ts
|
|
40
|
+
function parseCaption(alt) {
|
|
41
|
+
if (!alt) return "";
|
|
42
|
+
const parts = alt.split(" ");
|
|
43
|
+
if (parts.length >= 2 && parts[0] && parts[1]) {
|
|
44
|
+
return `${parts[0][0] ?? ""}${parts[1][0] ?? ""}`;
|
|
45
|
+
}
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/components/Avatar/Avatar.tsx
|
|
50
|
+
var _tmpl$ = /* @__PURE__ */ template(`<img class="size-full object-cover">`);
|
|
51
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<figure>`);
|
|
52
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<figcaption>`);
|
|
53
|
+
var Avatar = (rawProps) => {
|
|
54
|
+
const props = mergeProps({
|
|
55
|
+
alt: "User Avatar"
|
|
56
|
+
}, rawProps);
|
|
57
|
+
const [variantProps, otherProps] = splitProps(props, ["class", ...avatarVariants.variantKeys]);
|
|
58
|
+
const [source, setSource] = createSignal(props.src || props.dataSrc);
|
|
59
|
+
createEffect(() => {
|
|
60
|
+
untrack(() => {
|
|
61
|
+
if (import.meta.env.PROD && props.dataSrc) {
|
|
62
|
+
setSource(props.dataSrc);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const styles = createMemo(() => ({
|
|
67
|
+
background: untrack(() => source() ? "" : props.class ?? "bg-blue-500"),
|
|
68
|
+
text: untrack(() => source() ? "" : props.text ?? "text-white")
|
|
69
|
+
}));
|
|
70
|
+
const caption = createMemo(() => parseCaption(props.alt));
|
|
71
|
+
return (() => {
|
|
72
|
+
var _el$ = _tmpl$2();
|
|
73
|
+
insert(_el$, createComponent(Show, {
|
|
74
|
+
get when() {
|
|
75
|
+
return source();
|
|
76
|
+
},
|
|
77
|
+
get fallback() {
|
|
78
|
+
return (() => {
|
|
79
|
+
var _el$3 = _tmpl$3();
|
|
80
|
+
insert(_el$3, caption);
|
|
81
|
+
effect(() => className(_el$3, styles().text));
|
|
82
|
+
return _el$3;
|
|
83
|
+
})();
|
|
84
|
+
},
|
|
85
|
+
get children() {
|
|
86
|
+
var _el$2 = _tmpl$();
|
|
87
|
+
spread(_el$2, mergeProps$1({
|
|
88
|
+
get src() {
|
|
89
|
+
return source();
|
|
90
|
+
},
|
|
91
|
+
get ["data-src"]() {
|
|
92
|
+
return props.dataSrc;
|
|
93
|
+
}
|
|
94
|
+
}, otherProps), false, false);
|
|
95
|
+
return _el$2;
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
effect(() => className(_el$, avatarVariants(variantProps)));
|
|
99
|
+
return _el$;
|
|
100
|
+
})();
|
|
101
|
+
};
|
|
102
|
+
var Avatar_default = Avatar;
|
|
103
|
+
|
|
104
|
+
// src/components/Avatar/index.ts
|
|
105
|
+
var Avatar_default2 = Avatar_default;
|
|
106
|
+
|
|
107
|
+
export { Avatar_default2 as Avatar_default };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/Avatar/Avatar.tsx
|
|
6
|
+
import {
|
|
7
|
+
createSignal,
|
|
8
|
+
createMemo,
|
|
9
|
+
createEffect,
|
|
10
|
+
mergeProps,
|
|
11
|
+
splitProps,
|
|
12
|
+
Show,
|
|
13
|
+
untrack
|
|
14
|
+
} from "solid-js";
|
|
15
|
+
|
|
16
|
+
// src/components/Avatar/Avatar.styles.ts
|
|
17
|
+
var avatarVariants = cva(
|
|
18
|
+
[
|
|
19
|
+
"flex items-center justify-center mx-1",
|
|
20
|
+
"font-medium outline-none select-none transition active:transition-none",
|
|
21
|
+
"not-disabled:cursor-pointer",
|
|
22
|
+
"disabled:cursor-not-allowed disabled:opacity-25",
|
|
23
|
+
"aria-busy:cursor-wait"
|
|
24
|
+
],
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
size: {
|
|
28
|
+
sm: "size-8 text-sm",
|
|
29
|
+
md: "size-16 text-base",
|
|
30
|
+
lg: "size-24 text-lg"
|
|
31
|
+
},
|
|
32
|
+
shape: {
|
|
33
|
+
circle: "rounded-full overflow-hidden",
|
|
34
|
+
rounded: "rounded-lg overflow-hidden"
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
filled: "bg-gray-200 text-gray-800",
|
|
38
|
+
outlined: "border-2 border-gray-300 text-gray-800",
|
|
39
|
+
ghost: "text-gray-800"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: "md",
|
|
44
|
+
shape: "circle",
|
|
45
|
+
variant: "filled"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// src/components/Avatar/utils.ts
|
|
51
|
+
function parseCaption(alt) {
|
|
52
|
+
if (!alt) return "";
|
|
53
|
+
const parts = alt.split(" ");
|
|
54
|
+
if (parts.length >= 2 && parts[0] && parts[1]) {
|
|
55
|
+
return `${parts[0][0] ?? ""}${parts[1][0] ?? ""}`;
|
|
56
|
+
}
|
|
57
|
+
return "";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/components/Avatar/Avatar.tsx
|
|
61
|
+
var Avatar = (rawProps) => {
|
|
62
|
+
const props = mergeProps({ alt: "User Avatar" }, rawProps);
|
|
63
|
+
const [variantProps, otherProps] = splitProps(props, [
|
|
64
|
+
"class",
|
|
65
|
+
...avatarVariants.variantKeys
|
|
66
|
+
]);
|
|
67
|
+
const [source, setSource] = createSignal(props.src || props.dataSrc);
|
|
68
|
+
createEffect(() => {
|
|
69
|
+
untrack(() => {
|
|
70
|
+
if (import.meta.env.PROD && props.dataSrc) {
|
|
71
|
+
setSource(props.dataSrc);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
const styles = createMemo(() => ({
|
|
76
|
+
background: untrack(() => source() ? "" : props.class ?? "bg-blue-500"),
|
|
77
|
+
text: untrack(() => source() ? "" : props.text ?? "text-white")
|
|
78
|
+
}));
|
|
79
|
+
const caption = createMemo(() => parseCaption(props.alt));
|
|
80
|
+
return <figure class={avatarVariants(variantProps)}>
|
|
81
|
+
<Show
|
|
82
|
+
when={source()}
|
|
83
|
+
fallback={<figcaption class={styles().text}>{caption()}</figcaption>}
|
|
84
|
+
>
|
|
85
|
+
<img
|
|
86
|
+
src={source()}
|
|
87
|
+
data-src={props.dataSrc}
|
|
88
|
+
class="size-full object-cover"
|
|
89
|
+
{...otherProps}
|
|
90
|
+
/>
|
|
91
|
+
</Show>
|
|
92
|
+
</figure>;
|
|
93
|
+
};
|
|
94
|
+
var Avatar_default = Avatar;
|
|
95
|
+
|
|
96
|
+
// src/components/Avatar/index.ts
|
|
97
|
+
var Avatar_default2 = Avatar_default;
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
Avatar_default2 as Avatar_default
|
|
101
|
+
};
|
|
@@ -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 };
|