@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
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PolymorphicButton_default
|
|
3
|
+
} from "./KACNXPUM.jsx";
|
|
4
|
+
import {
|
|
5
|
+
cva
|
|
6
|
+
} from "./P7WPLZNA.jsx";
|
|
7
|
+
|
|
8
|
+
// src/components/button/Button.tsx
|
|
9
|
+
import {
|
|
10
|
+
mergeProps,
|
|
11
|
+
splitProps,
|
|
12
|
+
createMemo
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
|
|
15
|
+
// src/components/button/Button.styles.ts
|
|
16
|
+
var buttonVariants = cva(
|
|
17
|
+
[
|
|
18
|
+
"inline-flex items-center font-medium outline-none select-none",
|
|
19
|
+
"not-disabled:cursor-pointer",
|
|
20
|
+
"disabled:cursor-not-allowed disabled:opacity-25",
|
|
21
|
+
"aria-busy:cursor-wait",
|
|
22
|
+
"transition active:transition-none"
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
sm: "text-sm leading-tight",
|
|
28
|
+
md: "text-base leading-tight",
|
|
29
|
+
lg: "text-lg leading-tight"
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
inverse: "",
|
|
33
|
+
primary: "",
|
|
34
|
+
secondary: "",
|
|
35
|
+
tertiary: "",
|
|
36
|
+
accent: "",
|
|
37
|
+
positive: "",
|
|
38
|
+
destructive: ""
|
|
39
|
+
},
|
|
40
|
+
align: {
|
|
41
|
+
start: "justify-start",
|
|
42
|
+
center: "justify-center",
|
|
43
|
+
end: "justify-end"
|
|
44
|
+
},
|
|
45
|
+
shape: {
|
|
46
|
+
circle: "rounded-full",
|
|
47
|
+
rounded: "rounded-lg"
|
|
48
|
+
},
|
|
49
|
+
spacing: {
|
|
50
|
+
0: "gap-0 p-0",
|
|
51
|
+
xs: "gap-1.5 px-1.5 py-1.5",
|
|
52
|
+
sm: "gap-1.5 px-2 py-2",
|
|
53
|
+
md: "gap-1.5 px-3 py-2",
|
|
54
|
+
lg: "gap-1.5 px-3.5 py-2.5"
|
|
55
|
+
},
|
|
56
|
+
loading: {
|
|
57
|
+
true: "",
|
|
58
|
+
false: ""
|
|
59
|
+
},
|
|
60
|
+
stretched: {
|
|
61
|
+
true: "w-full",
|
|
62
|
+
false: "w-fit"
|
|
63
|
+
},
|
|
64
|
+
variant: {
|
|
65
|
+
fill: [
|
|
66
|
+
"not-disabled:hover:opacity-75 not-disabled:active:opacity-50",
|
|
67
|
+
"aria-[current]:opacity-75 data-expanded:opacity-75 data-open:opacity-75",
|
|
68
|
+
"focus-visible:opacity-75"
|
|
69
|
+
],
|
|
70
|
+
gray: [
|
|
71
|
+
"bg-bg-primary not-disabled:hover:bg-bg-secondary not-disabled:active:bg-bg-secondary not-disabled:active:opacity-75",
|
|
72
|
+
"aria-[current]:bg-bg-secondary data-expanded:bg-bg-secondary data-open:bg-bg-secondary",
|
|
73
|
+
"focus-visible:bg-bg-secondary"
|
|
74
|
+
],
|
|
75
|
+
ghost: [
|
|
76
|
+
"not-disabled:hover:bg-bg-primary not-disabled:active:bg-bg-primary not-disabled:active:opacity-75",
|
|
77
|
+
"aria-[current]:bg-bg-primary data-expanded:bg-bg-primary data-open:bg-bg-primary",
|
|
78
|
+
"focus-visible:bg-bg-primary"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
compoundVariants: [
|
|
83
|
+
{
|
|
84
|
+
variant: "fill",
|
|
85
|
+
color: "inverse",
|
|
86
|
+
class: "bg-bg-inverse text-fg-inverse"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
variant: "fill",
|
|
90
|
+
color: "primary",
|
|
91
|
+
class: "bg-bg-primary text-fg-body"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
variant: "fill",
|
|
95
|
+
color: "secondary",
|
|
96
|
+
class: "bg-bg-secondary text-fg-body"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
variant: "fill",
|
|
100
|
+
color: "tertiary",
|
|
101
|
+
class: "bg-bg-tertiary text-fg-body"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
variant: "fill",
|
|
105
|
+
color: "accent",
|
|
106
|
+
class: "bg-bg-accent text-light"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
variant: "fill",
|
|
110
|
+
color: "positive",
|
|
111
|
+
class: "bg-bg-positive text-light"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
variant: "fill",
|
|
115
|
+
color: "destructive",
|
|
116
|
+
class: "bg-bg-destructive text-light"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
variant: "gray",
|
|
120
|
+
color: "inverse",
|
|
121
|
+
class: "text-fg-inverse"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
variant: "gray",
|
|
125
|
+
color: "primary",
|
|
126
|
+
class: "text-fg-primary"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
variant: "gray",
|
|
130
|
+
color: "secondary",
|
|
131
|
+
class: "text-fg-secondary"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
variant: "gray",
|
|
135
|
+
color: "tertiary",
|
|
136
|
+
class: "text-fg-tertiary"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
variant: "gray",
|
|
140
|
+
color: "accent",
|
|
141
|
+
class: "text-fg-accent"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
variant: "gray",
|
|
145
|
+
color: "positive",
|
|
146
|
+
class: "text-fg-positive"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
variant: "gray",
|
|
150
|
+
color: "destructive",
|
|
151
|
+
class: "text-fg-destructive"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
color: "inverse",
|
|
156
|
+
class: "text-fg-inverse"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
variant: "ghost",
|
|
160
|
+
color: "primary",
|
|
161
|
+
class: "text-fg-primary"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
variant: "ghost",
|
|
165
|
+
color: "secondary",
|
|
166
|
+
class: "text-fg-secondary"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
color: "tertiary",
|
|
171
|
+
class: "text-fg-tertiary"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
variant: "ghost",
|
|
175
|
+
color: "accent",
|
|
176
|
+
class: "text-fg-accent"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
variant: "ghost",
|
|
180
|
+
color: "positive",
|
|
181
|
+
class: "text-fg-positive"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
variant: "ghost",
|
|
185
|
+
color: "destructive",
|
|
186
|
+
class: "text-fg-destructive"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
defaultVariants: {
|
|
190
|
+
size: "md",
|
|
191
|
+
color: "primary",
|
|
192
|
+
align: "center",
|
|
193
|
+
shape: "rounded",
|
|
194
|
+
spacing: "md",
|
|
195
|
+
variant: "fill",
|
|
196
|
+
loading: false,
|
|
197
|
+
stretched: false
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
// src/components/button/Button.tsx
|
|
203
|
+
var Button = (props) => {
|
|
204
|
+
const defaultedProps = mergeProps(
|
|
205
|
+
{
|
|
206
|
+
color: "primary"
|
|
207
|
+
},
|
|
208
|
+
props
|
|
209
|
+
);
|
|
210
|
+
const [variantProps, otherProps] = splitProps(defaultedProps, [
|
|
211
|
+
"class",
|
|
212
|
+
...buttonVariants.variantKeys
|
|
213
|
+
]);
|
|
214
|
+
const classes = createMemo(() => buttonVariants(variantProps));
|
|
215
|
+
return <PolymorphicButton_default
|
|
216
|
+
class={classes()}
|
|
217
|
+
aria-busy={variantProps.loading ? "true" : void 0}
|
|
218
|
+
{...otherProps}
|
|
219
|
+
/>;
|
|
220
|
+
};
|
|
221
|
+
var Button_default = Button;
|
|
222
|
+
|
|
223
|
+
// src/components/button/index.ts
|
|
224
|
+
var button_default = Button_default;
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
button_default
|
|
228
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/lib/style/classes.ts
|
|
2
|
+
function classes(...args) {
|
|
3
|
+
return args.flat().filter(Boolean).join(" ");
|
|
4
|
+
}
|
|
5
|
+
function falsyToString(value) {
|
|
6
|
+
return typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
7
|
+
}
|
|
8
|
+
function cva(base, config) {
|
|
9
|
+
const fn = (props) => {
|
|
10
|
+
if (config?.variants == null) return classes(base, props?.class);
|
|
11
|
+
const { variants, defaultVariants } = config;
|
|
12
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
13
|
+
const variantProp = props?.[variant];
|
|
14
|
+
const defaultVariantProp = defaultVariants?.[variant];
|
|
15
|
+
if (variantProp === null) return null;
|
|
16
|
+
const variantKey = falsyToString(variantProp) || falsyToString(
|
|
17
|
+
defaultVariantProp
|
|
18
|
+
);
|
|
19
|
+
return variants[variant]?.[variantKey];
|
|
20
|
+
});
|
|
21
|
+
const propsWithoutUndefined = Object.entries(props || {}).reduce(
|
|
22
|
+
(acc, [key, value]) => {
|
|
23
|
+
if (value !== void 0) {
|
|
24
|
+
acc[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
);
|
|
30
|
+
const getCompoundVariantClassNames = config?.compoundVariants?.reduce(
|
|
31
|
+
(acc, { class: cvClass, ...compoundVariantOptions }) => {
|
|
32
|
+
const isMatch = Object.entries(compoundVariantOptions).every(
|
|
33
|
+
([key, value]) => {
|
|
34
|
+
const currentValue = {
|
|
35
|
+
...defaultVariants,
|
|
36
|
+
...propsWithoutUndefined
|
|
37
|
+
}[key];
|
|
38
|
+
return Array.isArray(value) ? value.includes(currentValue) : currentValue === value;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return isMatch ? [...acc, cvClass] : acc;
|
|
42
|
+
},
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
return classes(
|
|
46
|
+
base,
|
|
47
|
+
getVariantClassNames,
|
|
48
|
+
getCompoundVariantClassNames,
|
|
49
|
+
props?.class
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
fn.variantKeys = config?.variants ? Object.keys(config.variants) : [];
|
|
53
|
+
return fn;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { classes, cva };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/components/polymorphic/Polymorphic.tsx
|
|
2
|
+
import {
|
|
3
|
+
createMemo,
|
|
4
|
+
splitProps,
|
|
5
|
+
untrack
|
|
6
|
+
} from "solid-js";
|
|
7
|
+
import { Dynamic } from "solid-js/web";
|
|
8
|
+
var Polymorphic = (props) => {
|
|
9
|
+
const [localProps, otherProps] = splitProps(props, ["as"]);
|
|
10
|
+
const cached = createMemo(() => localProps.as ?? "div");
|
|
11
|
+
return createMemo(() => {
|
|
12
|
+
const component = cached();
|
|
13
|
+
switch (typeof component) {
|
|
14
|
+
case "function":
|
|
15
|
+
return untrack(() => component(otherProps));
|
|
16
|
+
case "string":
|
|
17
|
+
return <Dynamic
|
|
18
|
+
component={component}
|
|
19
|
+
{...otherProps}
|
|
20
|
+
/>;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var Polymorphic_default = Polymorphic;
|
|
25
|
+
|
|
26
|
+
// src/lib/iterable.ts
|
|
27
|
+
function chain(callbacks) {
|
|
28
|
+
return (...args) => {
|
|
29
|
+
for (const callback of callbacks) callback?.(...args);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/lib/refs/mergeRefs.ts
|
|
34
|
+
function mergeRefs(...refs) {
|
|
35
|
+
return chain(refs);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/lib/tag/createIsButton.ts
|
|
39
|
+
import { createMemo as createMemo3 } from "solid-js";
|
|
40
|
+
|
|
41
|
+
// src/lib/tag/createTagName.ts
|
|
42
|
+
import { createMemo as createMemo2 } from "solid-js";
|
|
43
|
+
function createTagName(props) {
|
|
44
|
+
return createMemo2(
|
|
45
|
+
() => props.element()?.tagName.toLowerCase() ?? props.fallback
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/lib/tag/createIsButton.ts
|
|
50
|
+
var BUTTON_INPUT_TYPES = [
|
|
51
|
+
"button",
|
|
52
|
+
"color",
|
|
53
|
+
"file",
|
|
54
|
+
"image",
|
|
55
|
+
"reset",
|
|
56
|
+
"submit"
|
|
57
|
+
];
|
|
58
|
+
function isButton(tagName, type) {
|
|
59
|
+
if (tagName === "button") {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (tagName === "input" && type !== void 0) {
|
|
63
|
+
return BUTTON_INPUT_TYPES.indexOf(type) !== -1;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function createIsButton(props) {
|
|
68
|
+
const tagName = createTagName({
|
|
69
|
+
element: props.element,
|
|
70
|
+
fallback: "button"
|
|
71
|
+
});
|
|
72
|
+
return createMemo3(() => isButton(tagName(), props.type));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/components/polymorphic/PolymorphicButton.tsx
|
|
76
|
+
import {
|
|
77
|
+
createSignal,
|
|
78
|
+
splitProps as splitProps2
|
|
79
|
+
} from "solid-js";
|
|
80
|
+
var PolymorphicButton = (props) => {
|
|
81
|
+
const [ref, setRef] = createSignal(null);
|
|
82
|
+
const [localProps, otherProps] = splitProps2(props, [
|
|
83
|
+
"ref",
|
|
84
|
+
"type"
|
|
85
|
+
]);
|
|
86
|
+
const isButton2 = createIsButton({
|
|
87
|
+
element: ref,
|
|
88
|
+
type: localProps.type
|
|
89
|
+
});
|
|
90
|
+
return <Polymorphic_default
|
|
91
|
+
as="button"
|
|
92
|
+
ref={mergeRefs(setRef, localProps.ref)}
|
|
93
|
+
type={isButton2() ? "button" : void 0}
|
|
94
|
+
role={!isButton2() ? "button" : void 0}
|
|
95
|
+
{...otherProps}
|
|
96
|
+
/>;
|
|
97
|
+
};
|
|
98
|
+
var PolymorphicButton_default = PolymorphicButton;
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
Polymorphic_default,
|
|
102
|
+
PolymorphicButton_default
|
|
103
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/input/Input.tsx
|
|
6
|
+
import {
|
|
7
|
+
createMemo,
|
|
8
|
+
createSignal,
|
|
9
|
+
mergeProps,
|
|
10
|
+
Show,
|
|
11
|
+
splitProps,
|
|
12
|
+
untrack
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
|
|
15
|
+
// src/components/input/Input.styles.ts
|
|
16
|
+
var inputVariants = cva(
|
|
17
|
+
[
|
|
18
|
+
"block w-full appearance-none outline-none bg-transparent",
|
|
19
|
+
"border transition-colors duration-200",
|
|
20
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
color: {
|
|
25
|
+
danger: "border-red-500 text-red-600",
|
|
26
|
+
success: "border-green-500 text-green-600",
|
|
27
|
+
warning: "border-orange-500 text-orange-600"
|
|
28
|
+
},
|
|
29
|
+
rounded: {
|
|
30
|
+
true: "rounded-full",
|
|
31
|
+
false: "rounded-md"
|
|
32
|
+
},
|
|
33
|
+
expanded: {
|
|
34
|
+
true: "w-full",
|
|
35
|
+
false: "w-fit"
|
|
36
|
+
},
|
|
37
|
+
loading: {
|
|
38
|
+
true: "opacity-50",
|
|
39
|
+
false: ""
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
color: void 0,
|
|
44
|
+
rounded: false,
|
|
45
|
+
expanded: true,
|
|
46
|
+
loading: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// src/components/input/Input.tsx
|
|
52
|
+
var Input = (props) => {
|
|
53
|
+
const defaultedProps = mergeProps({ type: "text" }, props);
|
|
54
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
55
|
+
defaultedProps,
|
|
56
|
+
["type", "passwordReveal", "leftIcon", "rightIcon"],
|
|
57
|
+
["class", ...inputVariants.variantKeys]
|
|
58
|
+
);
|
|
59
|
+
const [showPassword, setShowPassword] = createSignal(false);
|
|
60
|
+
const computedType = createMemo(
|
|
61
|
+
() => untrack(
|
|
62
|
+
() => localProps.passwordReveal && showPassword() ? "text" : defaultedProps.type
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
const classes = createMemo(() => inputVariants(variantProps));
|
|
66
|
+
const handlePasswordToggle = () => {
|
|
67
|
+
untrack(() => setShowPassword((prev) => !prev));
|
|
68
|
+
};
|
|
69
|
+
return <div class="relative flex items-center">
|
|
70
|
+
<Show when={localProps.leftIcon}>
|
|
71
|
+
<span class="absolute left-3 top-1/2 -translate-y-1/2">
|
|
72
|
+
{localProps.leftIcon}
|
|
73
|
+
</span>
|
|
74
|
+
</Show>
|
|
75
|
+
|
|
76
|
+
<input
|
|
77
|
+
class={classes()}
|
|
78
|
+
type={computedType()}
|
|
79
|
+
aria-invalid={variantProps.color === "danger" ? "true" : void 0}
|
|
80
|
+
{...otherProps}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<Show when={localProps.passwordReveal && localProps.rightIcon}>
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
onClick={handlePasswordToggle}
|
|
87
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 outline-none"
|
|
88
|
+
aria-label={showPassword() ? "Hide password" : "Show password"}
|
|
89
|
+
>
|
|
90
|
+
{localProps.rightIcon}
|
|
91
|
+
</button>
|
|
92
|
+
</Show>
|
|
93
|
+
</div>;
|
|
94
|
+
};
|
|
95
|
+
var Input_default = Input;
|
|
96
|
+
|
|
97
|
+
// src/components/input/index.ts
|
|
98
|
+
var input_default = Input_default;
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
input_default
|
|
102
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
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, createMemo } 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
|
+
const classes = createMemo(() => buttonVariants(variantProps));
|
|
200
|
+
return createComponent(PolymorphicButton_default, mergeProps$1({
|
|
201
|
+
get ["class"]() {
|
|
202
|
+
return classes();
|
|
203
|
+
},
|
|
204
|
+
get ["aria-busy"]() {
|
|
205
|
+
return variantProps.loading ? "true" : void 0;
|
|
206
|
+
}
|
|
207
|
+
}, otherProps));
|
|
208
|
+
};
|
|
209
|
+
var Button_default = Button;
|
|
210
|
+
|
|
211
|
+
// src/components/button/index.ts
|
|
212
|
+
var button_default = Button_default;
|
|
213
|
+
|
|
214
|
+
export { button_default };
|