@pathscale/ui 0.0.5 → 0.0.6
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/dist/{Checkbox-BjaweaOH.d.ts → Checkbox-CzeDsQLA.d.ts} +3 -11
- package/dist/{Input-BQbTzjIO.d.ts → Input-X4gwIB-F.d.ts} +9 -1
- package/dist/{Switch-3IXS_68H.d.ts → Switch-B6dN2G97.d.ts} +13 -9
- package/dist/chunk/{4TWLQ3IA.js → 5KABSQPM.js} +10 -2
- package/dist/chunk/{GLEAR2TS.jsx → 5R7S7TXL.jsx} +36 -17
- package/dist/chunk/{P2L6LFLS.js → 6B7HOWQD.js} +40 -19
- package/dist/chunk/DGI3XY32.jsx +157 -0
- package/dist/chunk/F33TSIEQ.jsx +181 -0
- package/dist/chunk/FNXIOJJY.js +156 -0
- package/dist/chunk/OMRJVDZV.js +173 -0
- package/dist/chunk/VLJEQN2A.js +130 -0
- package/dist/chunk/{DNTGSCVF.jsx → YM2NLFQE.jsx} +1 -1
- package/dist/chunk/Z5DP7GYE.jsx +155 -0
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.jsx +1 -1
- package/dist/components/input/index.d.ts +7 -5
- package/dist/components/input/index.js +1 -1
- package/dist/components/input/index.jsx +3 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/index.jsx +1 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.jsx +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.jsx +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/index.jsx +15 -15
- package/package.json +1 -1
- package/dist/chunk/3IHANYRN.js +0 -98
- package/dist/chunk/6SBH3KSM.jsx +0 -96
- package/dist/chunk/FPUQ25SO.js +0 -137
- package/dist/chunk/MXG3MBEN.jsx +0 -148
- package/dist/chunk/N7BXP7EI.jsx +0 -102
- package/dist/chunk/T2DPPLBQ.js +0 -100
- /package/dist/components/{Progress → progress}/index.d.ts +0 -0
- /package/dist/components/{Progress → progress}/index.js +0 -0
- /package/dist/components/{Progress → progress}/index.jsx +0 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/select/Select.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
Show,
|
|
10
|
+
createMemo,
|
|
11
|
+
untrack
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/select/Select.styles.ts
|
|
15
|
+
var selectVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"flex items-center appearance-none",
|
|
18
|
+
"border outline-none",
|
|
19
|
+
"transition bg-white text-gray-700",
|
|
20
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
21
|
+
"pl-3"
|
|
22
|
+
// margen izquierdo por defecto
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
sm: "text-sm py-1 px-2",
|
|
28
|
+
md: "text-base py-2 px-3",
|
|
29
|
+
lg: "text-lg py-2 px-4"
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
primary: "border border-gray-300 focus:border-primary",
|
|
33
|
+
info: "border border-blue-500 focus:border-blue-600",
|
|
34
|
+
success: "border border-green-500 focus:border-green-600",
|
|
35
|
+
warning: "border border-yellow-500 focus:border-yellow-600",
|
|
36
|
+
danger: "border border-red-500 focus:border-red-600"
|
|
37
|
+
},
|
|
38
|
+
loading: {
|
|
39
|
+
true: "cursor-wait opacity-75",
|
|
40
|
+
false: ""
|
|
41
|
+
},
|
|
42
|
+
expanded: {
|
|
43
|
+
true: "w-full",
|
|
44
|
+
false: "w-fit"
|
|
45
|
+
},
|
|
46
|
+
rounded: {
|
|
47
|
+
true: "rounded",
|
|
48
|
+
false: "rounded-none"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
size: "md",
|
|
53
|
+
color: "primary",
|
|
54
|
+
loading: false,
|
|
55
|
+
expanded: false,
|
|
56
|
+
rounded: false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
var wrapperClass = "relative w-full group cursor-pointer";
|
|
61
|
+
var selectPaddingClass = "w-full pr-8";
|
|
62
|
+
var caretIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors";
|
|
63
|
+
var spinnerIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 animate-spin pointer-events-none";
|
|
64
|
+
var getIconColor = (color) => {
|
|
65
|
+
switch (color) {
|
|
66
|
+
case "success":
|
|
67
|
+
return "text-green-500 group-hover:text-green-600";
|
|
68
|
+
case "danger":
|
|
69
|
+
return "text-red-500 group-hover:text-red-600";
|
|
70
|
+
case "warning":
|
|
71
|
+
return "text-yellow-500 group-hover:text-yellow-600";
|
|
72
|
+
case "info":
|
|
73
|
+
return "text-blue-500 group-hover:text-blue-600";
|
|
74
|
+
case "primary":
|
|
75
|
+
default:
|
|
76
|
+
return "text-gray-500 group-hover:text-gray-700";
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var getSpinnerColor = (color) => {
|
|
80
|
+
switch (color) {
|
|
81
|
+
case "success":
|
|
82
|
+
return "text-green-500";
|
|
83
|
+
case "danger":
|
|
84
|
+
return "text-red-500";
|
|
85
|
+
case "warning":
|
|
86
|
+
return "text-yellow-500";
|
|
87
|
+
case "info":
|
|
88
|
+
return "text-blue-500";
|
|
89
|
+
case "primary":
|
|
90
|
+
default:
|
|
91
|
+
return "text-gray-500";
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/components/select/CaretDownIcon.tsx
|
|
96
|
+
var CaretDownIcon = (props) => <svg
|
|
97
|
+
class={`${caretIconBaseClass} ${props.class ?? ""}`}
|
|
98
|
+
fill="none"
|
|
99
|
+
stroke="currentColor"
|
|
100
|
+
stroke-width="2"
|
|
101
|
+
viewBox="0 0 24 24"
|
|
102
|
+
>
|
|
103
|
+
<path d="M6 9l6 6 6-6" />
|
|
104
|
+
</svg>;
|
|
105
|
+
var CaretDownIcon_default = CaretDownIcon;
|
|
106
|
+
|
|
107
|
+
// src/components/select/SpinnerIcon.tsx
|
|
108
|
+
var SpinnerIcon = (props) => <svg
|
|
109
|
+
class={`${spinnerIconBaseClass} ${props.class ?? ""}`}
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
fill="none"
|
|
112
|
+
viewBox="0 0 24 24"
|
|
113
|
+
stroke-width="2"
|
|
114
|
+
>
|
|
115
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" />
|
|
116
|
+
<path
|
|
117
|
+
class="opacity-75"
|
|
118
|
+
fill="currentColor"
|
|
119
|
+
d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
|
|
120
|
+
/>
|
|
121
|
+
</svg>;
|
|
122
|
+
var SpinnerIcon_default = SpinnerIcon;
|
|
123
|
+
|
|
124
|
+
// src/components/select/Select.tsx
|
|
125
|
+
var Select = (props) => {
|
|
126
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
127
|
+
props,
|
|
128
|
+
["placeholder", "value", "nativeSize", "onChange", "onFocus", "onBlur"],
|
|
129
|
+
["class", ...selectVariants.variantKeys]
|
|
130
|
+
);
|
|
131
|
+
const empty = createMemo(
|
|
132
|
+
() => untrack(() => localProps.value === null || localProps.value === void 0)
|
|
133
|
+
);
|
|
134
|
+
const selectClass = createMemo(
|
|
135
|
+
() => classes(
|
|
136
|
+
selectVariants(variantProps),
|
|
137
|
+
variantProps.class,
|
|
138
|
+
selectPaddingClass
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
return <div class={wrapperClass}>
|
|
142
|
+
<select
|
|
143
|
+
class={selectClass()}
|
|
144
|
+
size={localProps.nativeSize}
|
|
145
|
+
value={localProps.value}
|
|
146
|
+
onChange={localProps.onChange}
|
|
147
|
+
onFocus={localProps.onFocus}
|
|
148
|
+
onBlur={localProps.onBlur}
|
|
149
|
+
{...otherProps}
|
|
150
|
+
>
|
|
151
|
+
<Show when={localProps.placeholder && empty()}>
|
|
152
|
+
<option value="" disabled hidden>
|
|
153
|
+
{localProps.placeholder}
|
|
154
|
+
</option>
|
|
155
|
+
</Show>
|
|
156
|
+
{props.children}
|
|
157
|
+
</select>
|
|
158
|
+
|
|
159
|
+
<Show when={variantProps.loading}>
|
|
160
|
+
<SpinnerIcon_default
|
|
161
|
+
class={`${spinnerIconBaseClass} ${getSpinnerColor(
|
|
162
|
+
variantProps.color
|
|
163
|
+
)}`}
|
|
164
|
+
/>
|
|
165
|
+
</Show>
|
|
166
|
+
|
|
167
|
+
<Show when={!variantProps.loading}>
|
|
168
|
+
<CaretDownIcon_default
|
|
169
|
+
class={`${caretIconBaseClass} ${getIconColor(variantProps.color)}`}
|
|
170
|
+
/>
|
|
171
|
+
</Show>
|
|
172
|
+
</div>;
|
|
173
|
+
};
|
|
174
|
+
var Select_default = Select;
|
|
175
|
+
|
|
176
|
+
// src/components/select/index.ts
|
|
177
|
+
var select_default = Select_default;
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
select_default
|
|
181
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, createComponent, template, className, insert, addEventListener, effect, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { Show, mergeProps, splitProps, createSignal } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/input/Input.styles.ts
|
|
6
|
+
var inputWrapperClass = "relative flex items-center";
|
|
7
|
+
var inputVariants = cva(
|
|
8
|
+
[
|
|
9
|
+
"block w-full appearance-none outline-none bg-transparent",
|
|
10
|
+
"border transition-colors duration-200",
|
|
11
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12
|
+
],
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
color: {
|
|
16
|
+
danger: "border-red-500 text-red-600",
|
|
17
|
+
success: "border-green-500 text-green-600",
|
|
18
|
+
warning: "border-orange-500 text-orange-600"
|
|
19
|
+
},
|
|
20
|
+
rounded: {
|
|
21
|
+
true: "rounded-full",
|
|
22
|
+
false: "rounded-md"
|
|
23
|
+
},
|
|
24
|
+
expanded: {
|
|
25
|
+
true: "w-full",
|
|
26
|
+
false: "w-fit"
|
|
27
|
+
},
|
|
28
|
+
loading: {
|
|
29
|
+
true: "opacity-50",
|
|
30
|
+
false: ""
|
|
31
|
+
},
|
|
32
|
+
hasLeftIcon: {
|
|
33
|
+
true: "pl-10",
|
|
34
|
+
false: "pl-4"
|
|
35
|
+
},
|
|
36
|
+
hasRightIcon: {
|
|
37
|
+
true: "pr-10",
|
|
38
|
+
false: "pr-4"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
color: void 0,
|
|
43
|
+
rounded: false,
|
|
44
|
+
expanded: true,
|
|
45
|
+
loading: false,
|
|
46
|
+
hasLeftIcon: false,
|
|
47
|
+
hasRightIcon: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
var iconLeftClass = "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-gray-400";
|
|
52
|
+
var iconRightClass = "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400";
|
|
53
|
+
var iconButtonClass = "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500";
|
|
54
|
+
var _tmpl$ = /* @__PURE__ */ template(`<svg viewBox="64 64 896 896"tabIndex=-1 width=1em height=1em fill=currentColor aria-hidden=true><path d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"></path><path d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z">`);
|
|
55
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<svg viewBox="64 64 896 896"tabIndex=-1 width=1em height=1em fill=currentColor aria-hidden=true><path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z">`);
|
|
56
|
+
var EyeIcon = (props) => {
|
|
57
|
+
return createComponent(Show, {
|
|
58
|
+
get when() {
|
|
59
|
+
return props.invisible;
|
|
60
|
+
},
|
|
61
|
+
get fallback() {
|
|
62
|
+
return createComponent(EyeOpen, {});
|
|
63
|
+
},
|
|
64
|
+
get children() {
|
|
65
|
+
return createComponent(EyeInvisible, {});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
var EyeInvisible = () => _tmpl$();
|
|
70
|
+
var EyeOpen = () => _tmpl$2();
|
|
71
|
+
var EyeIcon_default = EyeIcon;
|
|
72
|
+
|
|
73
|
+
// src/components/input/Input.tsx
|
|
74
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span>`);
|
|
75
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<button type=button>`);
|
|
76
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div><input>`);
|
|
77
|
+
var Input = (props) => {
|
|
78
|
+
const defaultedProps = mergeProps({
|
|
79
|
+
type: "text"
|
|
80
|
+
}, props);
|
|
81
|
+
const [localProps, variantProps, otherProps] = splitProps(defaultedProps, ["type", "passwordReveal", "leftIcon", "rightIcon", "class", "value", "onInput", "placeholder", "name"], ["color", "rounded", "expanded", "loading", "hasLeftIcon", "hasRightIcon"]);
|
|
82
|
+
const [showPassword, setShowPassword] = createSignal(false);
|
|
83
|
+
const resolvedType = () => localProps.passwordReveal && showPassword() ? "text" : localProps.type ?? "text";
|
|
84
|
+
const inputClass = inputVariants({
|
|
85
|
+
...variantProps,
|
|
86
|
+
hasLeftIcon: !!localProps.leftIcon,
|
|
87
|
+
hasRightIcon: !!(localProps.rightIcon || localProps.passwordReveal),
|
|
88
|
+
class: localProps.class
|
|
89
|
+
});
|
|
90
|
+
return (() => {
|
|
91
|
+
var _el$ = _tmpl$32(), _el$3 = _el$.firstChild;
|
|
92
|
+
className(_el$, inputWrapperClass);
|
|
93
|
+
insert(_el$, createComponent(Show, {
|
|
94
|
+
get when() {
|
|
95
|
+
return localProps.leftIcon;
|
|
96
|
+
},
|
|
97
|
+
get children() {
|
|
98
|
+
var _el$2 = _tmpl$3();
|
|
99
|
+
className(_el$2, iconLeftClass);
|
|
100
|
+
insert(_el$2, () => localProps.leftIcon);
|
|
101
|
+
return _el$2;
|
|
102
|
+
}
|
|
103
|
+
}), _el$3);
|
|
104
|
+
addEventListener(_el$3, "input", localProps.onInput, true);
|
|
105
|
+
className(_el$3, inputClass);
|
|
106
|
+
insert(_el$, createComponent(Show, {
|
|
107
|
+
get when() {
|
|
108
|
+
return localProps.passwordReveal && !localProps.rightIcon;
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
var _el$4 = _tmpl$22();
|
|
112
|
+
_el$4.$$click = () => setShowPassword((p) => !p);
|
|
113
|
+
className(_el$4, iconButtonClass);
|
|
114
|
+
insert(_el$4, createComponent(EyeIcon_default, {
|
|
115
|
+
get invisible() {
|
|
116
|
+
return showPassword();
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
return _el$4;
|
|
120
|
+
}
|
|
121
|
+
}), null);
|
|
122
|
+
insert(_el$, createComponent(Show, {
|
|
123
|
+
get when() {
|
|
124
|
+
return localProps.rightIcon && !localProps.passwordReveal;
|
|
125
|
+
},
|
|
126
|
+
get children() {
|
|
127
|
+
var _el$5 = _tmpl$3();
|
|
128
|
+
className(_el$5, iconRightClass);
|
|
129
|
+
insert(_el$5, () => localProps.rightIcon);
|
|
130
|
+
return _el$5;
|
|
131
|
+
}
|
|
132
|
+
}), null);
|
|
133
|
+
effect((_p$) => {
|
|
134
|
+
var _v$ = resolvedType(), _v$2 = variantProps.color === "danger" ? "true" : void 0, _v$3 = localProps.placeholder, _v$4 = localProps.name;
|
|
135
|
+
_v$ !== _p$.e && setAttribute(_el$3, "type", _p$.e = _v$);
|
|
136
|
+
_v$2 !== _p$.t && setAttribute(_el$3, "aria-invalid", _p$.t = _v$2);
|
|
137
|
+
_v$3 !== _p$.a && setAttribute(_el$3, "placeholder", _p$.a = _v$3);
|
|
138
|
+
_v$4 !== _p$.o && setAttribute(_el$3, "name", _p$.o = _v$4);
|
|
139
|
+
return _p$;
|
|
140
|
+
}, {
|
|
141
|
+
e: void 0,
|
|
142
|
+
t: void 0,
|
|
143
|
+
a: void 0,
|
|
144
|
+
o: void 0
|
|
145
|
+
});
|
|
146
|
+
effect(() => _el$3.value = localProps.value);
|
|
147
|
+
return _el$;
|
|
148
|
+
})();
|
|
149
|
+
};
|
|
150
|
+
var Input_default = Input;
|
|
151
|
+
delegateEvents(["input", "click"]);
|
|
152
|
+
|
|
153
|
+
// src/components/input/index.ts
|
|
154
|
+
var input_default = Input_default;
|
|
155
|
+
|
|
156
|
+
export { EyeIcon_default, input_default };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, className, spread, mergeProps, insert, createComponent, memo, effect, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, untrack, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/select/Select.styles.ts
|
|
6
|
+
var selectVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"flex items-center appearance-none",
|
|
9
|
+
"border outline-none",
|
|
10
|
+
"transition bg-white text-gray-700",
|
|
11
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
12
|
+
"pl-3"
|
|
13
|
+
// margen izquierdo por defecto
|
|
14
|
+
],
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "text-sm py-1 px-2",
|
|
19
|
+
md: "text-base py-2 px-3",
|
|
20
|
+
lg: "text-lg py-2 px-4"
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
primary: "border border-gray-300 focus:border-primary",
|
|
24
|
+
info: "border border-blue-500 focus:border-blue-600",
|
|
25
|
+
success: "border border-green-500 focus:border-green-600",
|
|
26
|
+
warning: "border border-yellow-500 focus:border-yellow-600",
|
|
27
|
+
danger: "border border-red-500 focus:border-red-600"
|
|
28
|
+
},
|
|
29
|
+
loading: {
|
|
30
|
+
true: "cursor-wait opacity-75",
|
|
31
|
+
false: ""
|
|
32
|
+
},
|
|
33
|
+
expanded: {
|
|
34
|
+
true: "w-full",
|
|
35
|
+
false: "w-fit"
|
|
36
|
+
},
|
|
37
|
+
rounded: {
|
|
38
|
+
true: "rounded",
|
|
39
|
+
false: "rounded-none"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: "md",
|
|
44
|
+
color: "primary",
|
|
45
|
+
loading: false,
|
|
46
|
+
expanded: false,
|
|
47
|
+
rounded: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
var wrapperClass = "relative w-full group cursor-pointer";
|
|
52
|
+
var selectPaddingClass = "w-full pr-8";
|
|
53
|
+
var caretIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors";
|
|
54
|
+
var spinnerIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 animate-spin pointer-events-none";
|
|
55
|
+
var getIconColor = (color) => {
|
|
56
|
+
switch (color) {
|
|
57
|
+
case "success":
|
|
58
|
+
return "text-green-500 group-hover:text-green-600";
|
|
59
|
+
case "danger":
|
|
60
|
+
return "text-red-500 group-hover:text-red-600";
|
|
61
|
+
case "warning":
|
|
62
|
+
return "text-yellow-500 group-hover:text-yellow-600";
|
|
63
|
+
case "info":
|
|
64
|
+
return "text-blue-500 group-hover:text-blue-600";
|
|
65
|
+
case "primary":
|
|
66
|
+
default:
|
|
67
|
+
return "text-gray-500 group-hover:text-gray-700";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var getSpinnerColor = (color) => {
|
|
71
|
+
switch (color) {
|
|
72
|
+
case "success":
|
|
73
|
+
return "text-green-500";
|
|
74
|
+
case "danger":
|
|
75
|
+
return "text-red-500";
|
|
76
|
+
case "warning":
|
|
77
|
+
return "text-yellow-500";
|
|
78
|
+
case "info":
|
|
79
|
+
return "text-blue-500";
|
|
80
|
+
case "primary":
|
|
81
|
+
default:
|
|
82
|
+
return "text-gray-500";
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var _tmpl$ = /* @__PURE__ */ template(`<svg fill=none stroke=currentColor stroke-width=2 viewBox="0 0 24 24"><path d="M6 9l6 6 6-6">`);
|
|
86
|
+
var CaretDownIcon = (props) => (() => {
|
|
87
|
+
var _el$ = _tmpl$();
|
|
88
|
+
effect(() => setAttribute(_el$, "class", `${caretIconBaseClass} ${props.class ?? ""}`));
|
|
89
|
+
return _el$;
|
|
90
|
+
})();
|
|
91
|
+
var CaretDownIcon_default = CaretDownIcon;
|
|
92
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg fill=none viewBox="0 0 24 24"stroke-width=2><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z">`);
|
|
93
|
+
var SpinnerIcon = (props) => (() => {
|
|
94
|
+
var _el$ = _tmpl$2();
|
|
95
|
+
effect(() => setAttribute(_el$, "class", `${spinnerIconBaseClass} ${props.class ?? ""}`));
|
|
96
|
+
return _el$;
|
|
97
|
+
})();
|
|
98
|
+
var SpinnerIcon_default = SpinnerIcon;
|
|
99
|
+
|
|
100
|
+
// src/components/select/Select.tsx
|
|
101
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<option value disabled hidden>`);
|
|
102
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<div><select>`);
|
|
103
|
+
var Select = (props) => {
|
|
104
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["placeholder", "value", "nativeSize", "onChange", "onFocus", "onBlur"], ["class", ...selectVariants.variantKeys]);
|
|
105
|
+
const empty = createMemo(() => untrack(() => localProps.value === null || localProps.value === void 0));
|
|
106
|
+
const selectClass = createMemo(() => classes(selectVariants(variantProps), variantProps.class, selectPaddingClass));
|
|
107
|
+
return (() => {
|
|
108
|
+
var _el$ = _tmpl$22(), _el$2 = _el$.firstChild;
|
|
109
|
+
className(_el$, wrapperClass);
|
|
110
|
+
spread(_el$2, mergeProps({
|
|
111
|
+
get ["class"]() {
|
|
112
|
+
return selectClass();
|
|
113
|
+
},
|
|
114
|
+
get size() {
|
|
115
|
+
return localProps.nativeSize;
|
|
116
|
+
},
|
|
117
|
+
get value() {
|
|
118
|
+
return localProps.value;
|
|
119
|
+
},
|
|
120
|
+
get onChange() {
|
|
121
|
+
return localProps.onChange;
|
|
122
|
+
},
|
|
123
|
+
get onFocus() {
|
|
124
|
+
return localProps.onFocus;
|
|
125
|
+
},
|
|
126
|
+
get onBlur() {
|
|
127
|
+
return localProps.onBlur;
|
|
128
|
+
}
|
|
129
|
+
}, otherProps), false, true);
|
|
130
|
+
insert(_el$2, createComponent(Show, {
|
|
131
|
+
get when() {
|
|
132
|
+
return memo(() => !!localProps.placeholder)() && empty();
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
var _el$3 = _tmpl$3();
|
|
136
|
+
insert(_el$3, () => localProps.placeholder);
|
|
137
|
+
return _el$3;
|
|
138
|
+
}
|
|
139
|
+
}), null);
|
|
140
|
+
insert(_el$2, () => props.children, null);
|
|
141
|
+
insert(_el$, createComponent(Show, {
|
|
142
|
+
get when() {
|
|
143
|
+
return variantProps.loading;
|
|
144
|
+
},
|
|
145
|
+
get children() {
|
|
146
|
+
return createComponent(SpinnerIcon_default, {
|
|
147
|
+
get ["class"]() {
|
|
148
|
+
return `${spinnerIconBaseClass} ${getSpinnerColor(variantProps.color)}`;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}), null);
|
|
153
|
+
insert(_el$, createComponent(Show, {
|
|
154
|
+
get when() {
|
|
155
|
+
return !variantProps.loading;
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return createComponent(CaretDownIcon_default, {
|
|
159
|
+
get ["class"]() {
|
|
160
|
+
return `${caretIconBaseClass} ${getIconColor(variantProps.color)}`;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}), null);
|
|
165
|
+
return _el$;
|
|
166
|
+
})();
|
|
167
|
+
};
|
|
168
|
+
var Select_default = Select;
|
|
169
|
+
|
|
170
|
+
// src/components/select/index.ts
|
|
171
|
+
var select_default = Select_default;
|
|
172
|
+
|
|
173
|
+
export { select_default };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { template, use, className, spread, mergeProps, insert, createComponent, memo, effect, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, Show, untrack } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/checkbox/Checkbox.styles.ts
|
|
6
|
+
var checkboxVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"relative inline-flex items-center gap-2 select-none",
|
|
9
|
+
"cursor-pointer disabled:cursor-default peer-disabled:cursor-default",
|
|
10
|
+
"peer-disabled:opacity-50"
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
sm: "text-sm",
|
|
16
|
+
md: "text-base",
|
|
17
|
+
lg: "text-lg"
|
|
18
|
+
},
|
|
19
|
+
color: {
|
|
20
|
+
primary: "text-blue-600",
|
|
21
|
+
success: "text-green-600",
|
|
22
|
+
warning: "text-yellow-600",
|
|
23
|
+
danger: "text-red-600"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
size: "md",
|
|
28
|
+
color: "primary"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
var checkboxMarkerVariants = cva([
|
|
33
|
+
"inline-flex items-center justify-center w-5 h-5 rounded-sm border",
|
|
34
|
+
"transition-colors duration-200",
|
|
35
|
+
"border-gray-400 text-gray-800 dark:text-gray-200",
|
|
36
|
+
"peer-disabled:opacity-50"
|
|
37
|
+
]);
|
|
38
|
+
var checkboxInputClass = "peer absolute opacity-0 w-4 h-4";
|
|
39
|
+
var checkboxLabelClass = "ml-2 text-gray-800 dark:text-gray-200";
|
|
40
|
+
var _tmpl$ = /* @__PURE__ */ template(`<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-3.5 h-3.5"><polyline points="20 6 9 17 4 12">`);
|
|
41
|
+
var CheckIcon = () => _tmpl$();
|
|
42
|
+
var CheckIcon_default = CheckIcon;
|
|
43
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-3.5 h-3.5"><line x1=5 y1=12 x2=19 y2=12>`);
|
|
44
|
+
var MinusIcon = () => _tmpl$2();
|
|
45
|
+
var MinusIcon_default = MinusIcon;
|
|
46
|
+
|
|
47
|
+
// src/components/checkbox/Checkbox.tsx
|
|
48
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span>`);
|
|
49
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<label role=checkbox><input type=checkbox aria-hidden=true><span>`);
|
|
50
|
+
var Checkbox = (props) => {
|
|
51
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["label", "indeterminate", "defaultChecked", "checked", "onChange", "onFocus", "onBlur", "disabled"], ["class", ...checkboxVariants.variantKeys]);
|
|
52
|
+
const [status, setStatus] = createSignal(localProps.indeterminate ? "indeterminate" : localProps.defaultChecked ? "checked" : "unchecked");
|
|
53
|
+
const handleChange = (e) => {
|
|
54
|
+
const input = e.currentTarget;
|
|
55
|
+
if (input.indeterminate) {
|
|
56
|
+
input.indeterminate = false;
|
|
57
|
+
input.checked = true;
|
|
58
|
+
setStatus("checked");
|
|
59
|
+
} else {
|
|
60
|
+
setStatus(input.checked ? "checked" : "unchecked");
|
|
61
|
+
}
|
|
62
|
+
untrack(() => {
|
|
63
|
+
if (typeof localProps.onChange === "function") {
|
|
64
|
+
localProps.onChange(e);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return (() => {
|
|
69
|
+
var _el$ = _tmpl$22(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
70
|
+
use((el) => {
|
|
71
|
+
if (status() === "indeterminate") {
|
|
72
|
+
el.indeterminate = true;
|
|
73
|
+
}
|
|
74
|
+
}, _el$2);
|
|
75
|
+
className(_el$2, checkboxInputClass);
|
|
76
|
+
spread(_el$2, mergeProps({
|
|
77
|
+
get checked() {
|
|
78
|
+
return status() === "checked";
|
|
79
|
+
},
|
|
80
|
+
get disabled() {
|
|
81
|
+
return localProps.disabled;
|
|
82
|
+
}
|
|
83
|
+
}, otherProps, {
|
|
84
|
+
"onChange": handleChange,
|
|
85
|
+
get onFocus() {
|
|
86
|
+
return localProps.onFocus;
|
|
87
|
+
},
|
|
88
|
+
get onBlur() {
|
|
89
|
+
return localProps.onBlur;
|
|
90
|
+
}
|
|
91
|
+
}), false, false);
|
|
92
|
+
insert(_el$3, createComponent(Show, {
|
|
93
|
+
get when() {
|
|
94
|
+
return status() !== "unchecked";
|
|
95
|
+
},
|
|
96
|
+
get children() {
|
|
97
|
+
return memo(() => status() === "indeterminate")() ? createComponent(MinusIcon_default, {}) : createComponent(CheckIcon_default, {});
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
insert(_el$, createComponent(Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return localProps.label;
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
var _el$4 = _tmpl$3();
|
|
106
|
+
className(_el$4, checkboxLabelClass);
|
|
107
|
+
insert(_el$4, () => localProps.label);
|
|
108
|
+
return _el$4;
|
|
109
|
+
}
|
|
110
|
+
}), null);
|
|
111
|
+
effect((_p$) => {
|
|
112
|
+
var _v$ = checkboxVariants(), _v$2 = status() === "indeterminate" ? "mixed" : status() === "checked", _v$3 = checkboxMarkerVariants();
|
|
113
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
114
|
+
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
115
|
+
_v$3 !== _p$.a && className(_el$3, _p$.a = _v$3);
|
|
116
|
+
return _p$;
|
|
117
|
+
}, {
|
|
118
|
+
e: void 0,
|
|
119
|
+
t: void 0,
|
|
120
|
+
a: void 0
|
|
121
|
+
});
|
|
122
|
+
return _el$;
|
|
123
|
+
})();
|
|
124
|
+
};
|
|
125
|
+
var Checkbox_default = Checkbox;
|
|
126
|
+
|
|
127
|
+
// src/components/checkbox/index.ts
|
|
128
|
+
var checkbox_default = Checkbox_default;
|
|
129
|
+
|
|
130
|
+
export { checkbox_default };
|