@pathscale/ui 0.0.1 → 0.0.3
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/Accordion-JZGWxBMK.d.ts +27 -0
- package/dist/Autocomplete-gLkjMHrc.d.ts +28 -0
- package/dist/Checkbox-BjaweaOH.d.ts +40 -0
- package/dist/Field-DfUn85_1.d.ts +49 -0
- package/dist/{Input-BQbTzjIO.d.ts → Input-C1bm4HGf.d.ts} +1 -1
- package/dist/Pagination-CJtlFMHy.d.ts +43 -0
- package/dist/Progress-gN0xqhAF.d.ts +64 -0
- package/dist/Select-CWCDBvec.d.ts +44 -0
- package/dist/Steps-1miUeyCD.d.ts +34 -0
- package/dist/Switch-BiKX7HZ2.d.ts +72 -0
- package/dist/Table-CGa6Nop3.d.ts +39 -0
- package/dist/Tabs-BEnRV6GG.d.ts +42 -0
- package/dist/Tag-BPrhn-Ne.d.ts +42 -0
- package/dist/Timeline-Bd4SxHMT.d.ts +14 -0
- package/dist/Tooltip-BfPongoz.d.ts +53 -0
- package/dist/Upload-BrFuZ4JA.d.ts +39 -0
- package/dist/chunk/3IHANYRN.js +98 -0
- package/dist/chunk/3VOILEMN.js +187 -0
- package/dist/chunk/4TWLQ3IA.js +103 -0
- package/dist/chunk/6SBH3KSM.jsx +96 -0
- package/dist/chunk/7ROVLN3J.js +175 -0
- package/dist/chunk/BBDVIXAH.jsx +194 -0
- package/dist/chunk/{4RCWSX7S.jsx → C4745OZS.jsx} +7 -7
- package/dist/chunk/C4YO33NN.jsx +179 -0
- package/dist/chunk/CJZGTNJZ.js +115 -0
- package/dist/chunk/D2BEL4SM.jsx +169 -0
- package/dist/chunk/DBQ7IOPU.js +189 -0
- package/dist/chunk/DNTGSCVF.jsx +100 -0
- package/dist/chunk/DSTUGZW6.jsx +81 -0
- package/dist/chunk/ELRAUORW.jsx +179 -0
- package/dist/chunk/FKSQPGOD.jsx +170 -0
- package/dist/chunk/FPUQ25SO.js +137 -0
- package/dist/chunk/GLEAR2TS.jsx +160 -0
- package/dist/chunk/GMIXRYN3.js +138 -0
- package/dist/chunk/HWAGW5N4.jsx +118 -0
- package/dist/chunk/JWRGKHDO.js +172 -0
- package/dist/chunk/KV6LTJHI.jsx +175 -0
- package/dist/chunk/LAQPAV5I.jsx +187 -0
- package/dist/chunk/LI3HCFL7.jsx +132 -0
- package/dist/chunk/MAX47D6F.js +99 -0
- package/dist/chunk/{2JGZSAW5.js → MI773TMC.js} +6 -6
- package/dist/chunk/MMTAND25.jsx +126 -0
- package/dist/chunk/MXG3MBEN.jsx +148 -0
- package/dist/chunk/MYERRMTM.js +200 -0
- package/dist/chunk/NZKPDBTE.js +118 -0
- package/dist/chunk/OSJ3P7PI.js +189 -0
- package/dist/chunk/P2L6LFLS.js +144 -0
- package/dist/chunk/QLESLIWS.jsx +110 -0
- package/dist/chunk/QONDPQ2I.jsx +105 -0
- package/dist/chunk/QYEMOKUG.js +125 -0
- package/dist/chunk/S3ZDSQSV.js +98 -0
- package/dist/chunk/SCJSBRV2.jsx +39 -0
- package/dist/chunk/STKRVQR6.jsx +130 -0
- package/dist/chunk/{NZZRKP74.js → TFLJI242.js} +1 -25
- package/dist/chunk/TT2JYGLU.js +218 -0
- package/dist/chunk/V6Y5E7BL.js +133 -0
- package/dist/chunk/VN5BKHA2.jsx +97 -0
- package/dist/chunk/WOT36Q7O.js +166 -0
- package/dist/chunk/WUZETUQR.js +92 -0
- package/dist/chunk/XD34JKSU.jsx +201 -0
- package/dist/chunk/{GA2HCFRS.jsx → YAQK2KFY.jsx} +1 -35
- package/dist/chunk/YMO6RPS6.js +26 -0
- package/dist/components/Progress/index.d.ts +4 -39
- package/dist/components/Progress/index.js +1 -278
- package/dist/components/Progress/index.jsx +4 -199
- package/dist/components/accordion/index.d.ts +5 -24
- package/dist/components/accordion/index.js +1 -118
- package/dist/components/accordion/index.jsx +3 -100
- package/dist/components/autocomplete/index.d.ts +8 -0
- package/dist/components/autocomplete/index.js +1 -0
- package/dist/components/autocomplete/index.jsx +7 -0
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.jsx +3 -3
- package/dist/components/breadcrumb/index.d.ts +2 -2
- package/dist/components/breadcrumb/index.js +1 -133
- package/dist/components/breadcrumb/index.jsx +4 -120
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.jsx +2 -1
- package/dist/components/checkbox/index.d.ts +5 -37
- package/dist/components/checkbox/index.js +1 -137
- package/dist/components/checkbox/index.jsx +3 -143
- package/dist/components/dropdown/index.d.ts +43 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/dropdown/index.jsx +12 -0
- package/dist/components/field/index.d.ts +7 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/field/index.jsx +7 -0
- package/dist/components/input/index.d.ts +2 -2
- package/dist/components/menu/index.d.ts +66 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/menu/index.jsx +11 -0
- package/dist/components/navbar/index.d.ts +74 -0
- package/dist/components/navbar/index.js +1 -0
- package/dist/components/navbar/index.jsx +11 -0
- package/dist/components/pagination/index.d.ts +5 -40
- package/dist/components/pagination/index.js +1 -189
- package/dist/components/pagination/index.jsx +3 -174
- package/dist/components/select/index.d.ts +5 -41
- package/dist/components/select/index.js +1 -98
- package/dist/components/select/index.jsx +3 -91
- package/dist/components/steps/index.d.ts +8 -0
- package/dist/components/steps/index.js +1 -0
- package/dist/components/steps/index.jsx +7 -0
- package/dist/components/switch/index.d.ts +5 -69
- package/dist/components/switch/index.js +1 -144
- package/dist/components/switch/index.jsx +3 -155
- package/dist/components/table/index.d.ts +8 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.jsx +7 -0
- package/dist/components/tabs/index.d.ts +5 -39
- package/dist/components/tabs/index.js +1 -166
- package/dist/components/tabs/index.jsx +3 -170
- package/dist/components/tag/index.d.ts +5 -39
- package/dist/components/tag/index.js +1 -115
- package/dist/components/tag/index.jsx +3 -127
- package/dist/components/timeline/index.d.ts +7 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/timeline/index.jsx +7 -0
- package/dist/components/toast/index.d.ts +24 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/index.jsx +11 -0
- package/dist/components/tooltip/index.d.ts +5 -50
- package/dist/components/tooltip/index.js +1 -103
- package/dist/components/tooltip/index.jsx +3 -95
- package/dist/components/upload/index.d.ts +5 -36
- package/dist/components/upload/index.js +1 -98
- package/dist/components/upload/index.jsx +3 -105
- package/dist/index.d.ts +22 -2
- package/dist/index.js +23 -2
- package/dist/index.jsx +108 -8
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/toast/toast.store.ts
|
|
6
|
+
import { createSignal } from "solid-js";
|
|
7
|
+
var [toasts, setToasts] = createSignal([]);
|
|
8
|
+
var toastStore = {
|
|
9
|
+
toasts,
|
|
10
|
+
add(toast2) {
|
|
11
|
+
const id = crypto.randomUUID();
|
|
12
|
+
setToasts((prev) => [...prev, { ...toast2, id }]);
|
|
13
|
+
return id;
|
|
14
|
+
},
|
|
15
|
+
remove(id) {
|
|
16
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
17
|
+
},
|
|
18
|
+
clear() {
|
|
19
|
+
setToasts([]);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/components/toast/toast-api.ts
|
|
24
|
+
function createToastApi() {
|
|
25
|
+
const show = (message, options = {}) => {
|
|
26
|
+
return toastStore.add({ ...options, message });
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
show,
|
|
30
|
+
success: (msg, opts) => show(msg, { ...opts, type: "success" }),
|
|
31
|
+
error: (msg, opts) => show(msg, { ...opts, type: "error" }),
|
|
32
|
+
info: (msg, opts) => show(msg, { ...opts, type: "info" }),
|
|
33
|
+
warning: (msg, opts) => show(msg, { ...opts, type: "warning" }),
|
|
34
|
+
clear: toastStore.clear
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/components/toast/Toaster.tsx
|
|
39
|
+
import { For } from "solid-js";
|
|
40
|
+
|
|
41
|
+
// src/components/toast/Toast.tsx
|
|
42
|
+
import {
|
|
43
|
+
createSignal as createSignal2,
|
|
44
|
+
onMount,
|
|
45
|
+
onCleanup,
|
|
46
|
+
Show
|
|
47
|
+
} from "solid-js";
|
|
48
|
+
|
|
49
|
+
// src/components/toast/utils/remove-element.ts
|
|
50
|
+
function removeElement(el) {
|
|
51
|
+
if (typeof el.remove === "function") {
|
|
52
|
+
el.remove();
|
|
53
|
+
} else {
|
|
54
|
+
el.parentNode?.removeChild(el);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/components/toast/utils/timer.ts
|
|
59
|
+
var Timer = class {
|
|
60
|
+
callback;
|
|
61
|
+
delay;
|
|
62
|
+
startedAt;
|
|
63
|
+
timer;
|
|
64
|
+
constructor(callback, delay) {
|
|
65
|
+
this.callback = callback;
|
|
66
|
+
this.delay = delay;
|
|
67
|
+
this.startedAt = Date.now();
|
|
68
|
+
this.timer = window.setTimeout(callback, delay);
|
|
69
|
+
}
|
|
70
|
+
pause() {
|
|
71
|
+
this.stop();
|
|
72
|
+
this.delay -= Date.now() - this.startedAt;
|
|
73
|
+
}
|
|
74
|
+
resume() {
|
|
75
|
+
this.stop();
|
|
76
|
+
this.startedAt = Date.now();
|
|
77
|
+
this.timer = window.setTimeout(this.callback, this.delay);
|
|
78
|
+
}
|
|
79
|
+
stop() {
|
|
80
|
+
clearTimeout(this.timer);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/components/toast/Toast.styles.ts
|
|
85
|
+
var toastWrapperClass = cva(
|
|
86
|
+
"relative flex items-start gap-3 px-4 py-3 rounded-2xl shadow-lg transition-all duration-300 w-full",
|
|
87
|
+
{
|
|
88
|
+
variants: {
|
|
89
|
+
type: {
|
|
90
|
+
default: "bg-gray-700 text-white",
|
|
91
|
+
success: "bg-green-600 text-white",
|
|
92
|
+
error: "bg-red-600 text-white",
|
|
93
|
+
info: "bg-blue-600 text-white",
|
|
94
|
+
warning: "bg-yellow-400 text-black"
|
|
95
|
+
},
|
|
96
|
+
visible: {
|
|
97
|
+
true: "opacity-100 translate-y-0",
|
|
98
|
+
false: "opacity-0 -translate-y-2 pointer-events-none"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: {
|
|
102
|
+
type: "default",
|
|
103
|
+
visible: true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// src/components/toast/Toast.tsx
|
|
109
|
+
var Toast = (props) => {
|
|
110
|
+
const [visible, setVisible] = createSignal2(false);
|
|
111
|
+
let rootRef;
|
|
112
|
+
let timer = null;
|
|
113
|
+
const close = () => {
|
|
114
|
+
timer?.stop();
|
|
115
|
+
setVisible(false);
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
props.onClose?.();
|
|
118
|
+
if (rootRef) removeElement(rootRef);
|
|
119
|
+
}, 150);
|
|
120
|
+
};
|
|
121
|
+
onMount(() => {
|
|
122
|
+
setVisible(true);
|
|
123
|
+
if (props.duration !== false) {
|
|
124
|
+
timer = new Timer(close, props.duration || 4e3);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
onCleanup(() => {
|
|
128
|
+
timer?.stop();
|
|
129
|
+
});
|
|
130
|
+
return <div
|
|
131
|
+
ref={rootRef}
|
|
132
|
+
class={toastWrapperClass({
|
|
133
|
+
type: props.type || "default",
|
|
134
|
+
visible: visible()
|
|
135
|
+
})}
|
|
136
|
+
role="alert"
|
|
137
|
+
onClick={() => props.dismissible && close()}
|
|
138
|
+
innerHTML={props.message}
|
|
139
|
+
>
|
|
140
|
+
<Show when={props.dismissible}>
|
|
141
|
+
<button
|
|
142
|
+
class="absolute top-2 right-2 text-white/80 hover:text-white transition"
|
|
143
|
+
aria-label="Close toast"
|
|
144
|
+
>
|
|
145
|
+
×
|
|
146
|
+
</button>
|
|
147
|
+
</Show>
|
|
148
|
+
</div>;
|
|
149
|
+
};
|
|
150
|
+
var Toast_default = Toast;
|
|
151
|
+
|
|
152
|
+
// src/components/toast/Toaster.tsx
|
|
153
|
+
var Toaster = () => {
|
|
154
|
+
return <div class="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2 w-[300px] max-w-full">
|
|
155
|
+
<For each={toastStore.toasts()}>
|
|
156
|
+
{(toast2) => <Toast_default {...toast2} onClose={() => toastStore.remove(toast2.id)} />}
|
|
157
|
+
</For>
|
|
158
|
+
</div>;
|
|
159
|
+
};
|
|
160
|
+
var Toaster_default = Toaster;
|
|
161
|
+
|
|
162
|
+
// src/components/toast/index.ts
|
|
163
|
+
var toast = createToastApi();
|
|
164
|
+
var toast_default = toast;
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
Toaster_default,
|
|
168
|
+
toast,
|
|
169
|
+
toast_default
|
|
170
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, effect, className, setAttribute, use } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, createEffect, 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 cursor-pointer",
|
|
9
|
+
"select-none",
|
|
10
|
+
"disabled:cursor-not-allowed 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-primary",
|
|
21
|
+
success: "text-green-600",
|
|
22
|
+
warning: "text-yellow-600",
|
|
23
|
+
danger: "text-red-600"
|
|
24
|
+
},
|
|
25
|
+
checked: {
|
|
26
|
+
true: "",
|
|
27
|
+
false: ""
|
|
28
|
+
},
|
|
29
|
+
indeterminate: {
|
|
30
|
+
true: "",
|
|
31
|
+
false: ""
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
size: "md",
|
|
36
|
+
color: "primary",
|
|
37
|
+
checked: false,
|
|
38
|
+
indeterminate: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// src/components/checkbox/Checkbox.tsx
|
|
44
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span class="absolute top-1/2 left-1/2 w-2 h-0.5 bg-white -translate-x-1/2 -translate-y-1/2"aria-hidden=true>`);
|
|
45
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<span class=ml-2>`);
|
|
46
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<label role=checkbox><input type=checkbox class="peer absolute opacity-0 w-4 h-4"aria-hidden=true><span>`);
|
|
47
|
+
var Checkbox = (props) => {
|
|
48
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["label", "indeterminate", "type", "onChange", "onFocus", "onBlur", "checked", "disabled", "aria-label", "aria-describedby"], ["class", ...checkboxVariants.variantKeys]);
|
|
49
|
+
let inputRef;
|
|
50
|
+
const checkboxClasses = createMemo(() => checkboxVariants(variantProps));
|
|
51
|
+
const markerClasses = createMemo(() => classes("inline-block w-4 h-4 border border-gray-400 rounded-sm peer-checked:bg-current", localProps.indeterminate ? "bg-gray-400 relative" : ""));
|
|
52
|
+
const handleChange = (e) => {
|
|
53
|
+
untrack(() => {
|
|
54
|
+
if (typeof localProps.onChange === "function") {
|
|
55
|
+
localProps.onChange(e);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const handleFocus = (e) => {
|
|
60
|
+
untrack(() => {
|
|
61
|
+
if (typeof localProps.onFocus === "function") {
|
|
62
|
+
localProps.onFocus(e);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const handleBlur = (e) => {
|
|
67
|
+
untrack(() => {
|
|
68
|
+
if (typeof localProps.onBlur === "function") {
|
|
69
|
+
localProps.onBlur(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
createEffect(() => {
|
|
74
|
+
if (inputRef) {
|
|
75
|
+
untrack(() => {
|
|
76
|
+
inputRef.indeterminate = !!localProps.indeterminate;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return (() => {
|
|
81
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
82
|
+
var _ref$ = inputRef;
|
|
83
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : inputRef = _el$2;
|
|
84
|
+
spread(_el$2, mergeProps({
|
|
85
|
+
get checked() {
|
|
86
|
+
return localProps.checked;
|
|
87
|
+
},
|
|
88
|
+
get disabled() {
|
|
89
|
+
return localProps.disabled;
|
|
90
|
+
}
|
|
91
|
+
}, otherProps, {
|
|
92
|
+
"onChange": handleChange,
|
|
93
|
+
"onFocus": handleFocus,
|
|
94
|
+
"onBlur": handleBlur
|
|
95
|
+
}), false, false);
|
|
96
|
+
insert(_el$3, createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return localProps.indeterminate;
|
|
99
|
+
},
|
|
100
|
+
get children() {
|
|
101
|
+
return _tmpl$();
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
insert(_el$, createComponent(Show, {
|
|
105
|
+
get when() {
|
|
106
|
+
return localProps.label;
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
var _el$5 = _tmpl$2();
|
|
110
|
+
insert(_el$5, () => localProps.label);
|
|
111
|
+
return _el$5;
|
|
112
|
+
}
|
|
113
|
+
}), null);
|
|
114
|
+
effect((_p$) => {
|
|
115
|
+
var _v$ = checkboxClasses(), _v$2 = localProps.indeterminate ? "mixed" : localProps.checked, _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = markerClasses();
|
|
116
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
117
|
+
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
118
|
+
_v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
|
|
119
|
+
_v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
|
|
120
|
+
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
121
|
+
return _p$;
|
|
122
|
+
}, {
|
|
123
|
+
e: void 0,
|
|
124
|
+
t: void 0,
|
|
125
|
+
a: void 0,
|
|
126
|
+
o: void 0,
|
|
127
|
+
i: void 0
|
|
128
|
+
});
|
|
129
|
+
return _el$;
|
|
130
|
+
})();
|
|
131
|
+
};
|
|
132
|
+
var Checkbox_default = Checkbox;
|
|
133
|
+
|
|
134
|
+
// src/components/checkbox/index.ts
|
|
135
|
+
var checkbox_default = Checkbox_default;
|
|
136
|
+
|
|
137
|
+
export { checkbox_default };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/switch/Switch.tsx
|
|
6
|
+
import {
|
|
7
|
+
createSignal,
|
|
8
|
+
splitProps,
|
|
9
|
+
createMemo,
|
|
10
|
+
untrack
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/switch/Switch.styles.ts
|
|
14
|
+
var switchVariants = cva(
|
|
15
|
+
"switch inline-flex items-center gap-2 select-none",
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
sm: "text-sm",
|
|
20
|
+
md: "text-base",
|
|
21
|
+
lg: "text-lg"
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
true: "opacity-50 cursor-not-allowed",
|
|
25
|
+
false: ""
|
|
26
|
+
},
|
|
27
|
+
rounded: {
|
|
28
|
+
true: "",
|
|
29
|
+
false: ""
|
|
30
|
+
},
|
|
31
|
+
outlined: {
|
|
32
|
+
true: "",
|
|
33
|
+
false: ""
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
size: "md",
|
|
38
|
+
disabled: false,
|
|
39
|
+
rounded: true,
|
|
40
|
+
outlined: false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var checkVariants = cva(
|
|
45
|
+
[
|
|
46
|
+
"relative transition-colors duration-200",
|
|
47
|
+
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
48
|
+
].join(" "),
|
|
49
|
+
{
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
sm: "w-8 h-4 after:w-3 after:h-3 after:left-0.5 after:top-0.5 peer-checked:after:translate-x-4",
|
|
53
|
+
md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
|
|
54
|
+
lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
|
|
55
|
+
},
|
|
56
|
+
color: {
|
|
57
|
+
blue: "peer-checked:bg-blue-500",
|
|
58
|
+
green: "peer-checked:bg-green-500",
|
|
59
|
+
red: "peer-checked:bg-red-500",
|
|
60
|
+
yellow: "peer-checked:bg-yellow-400",
|
|
61
|
+
gray: "peer-checked:bg-gray-500"
|
|
62
|
+
},
|
|
63
|
+
passiveColor: {
|
|
64
|
+
blue: "bg-blue-200",
|
|
65
|
+
green: "bg-green-200",
|
|
66
|
+
red: "bg-red-200",
|
|
67
|
+
yellow: "bg-yellow-200",
|
|
68
|
+
gray: "bg-gray-300"
|
|
69
|
+
},
|
|
70
|
+
rounded: {
|
|
71
|
+
true: "rounded-full after:rounded-full",
|
|
72
|
+
false: "rounded-md after:rounded-sm"
|
|
73
|
+
},
|
|
74
|
+
outlined: {
|
|
75
|
+
true: "ring-2 ring-inset ring-white",
|
|
76
|
+
false: ""
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
size: "md",
|
|
81
|
+
color: "blue",
|
|
82
|
+
passiveColor: "gray",
|
|
83
|
+
rounded: true,
|
|
84
|
+
outlined: false
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// src/components/switch/Switch.tsx
|
|
90
|
+
var Switch = (props) => {
|
|
91
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
92
|
+
props,
|
|
93
|
+
[
|
|
94
|
+
"children",
|
|
95
|
+
"checked",
|
|
96
|
+
"defaultChecked",
|
|
97
|
+
"onChange",
|
|
98
|
+
"name",
|
|
99
|
+
"required",
|
|
100
|
+
"disabled",
|
|
101
|
+
"aria-label",
|
|
102
|
+
"aria-describedby"
|
|
103
|
+
],
|
|
104
|
+
["size", "rounded", "outlined", "color", "passiveColor"]
|
|
105
|
+
);
|
|
106
|
+
const isControlled = localProps.checked !== void 0;
|
|
107
|
+
const [internalChecked, setInternalChecked] = createSignal(
|
|
108
|
+
localProps.defaultChecked ?? false
|
|
109
|
+
);
|
|
110
|
+
const checkedValue = createMemo(
|
|
111
|
+
() => untrack(() => isControlled ? localProps.checked : internalChecked())
|
|
112
|
+
);
|
|
113
|
+
const switchClasses = createMemo(() => switchVariants(variantProps));
|
|
114
|
+
const checkClasses = createMemo(
|
|
115
|
+
() => checkVariants({
|
|
116
|
+
size: variantProps.size,
|
|
117
|
+
color: variantProps.color,
|
|
118
|
+
passiveColor: variantProps.passiveColor,
|
|
119
|
+
rounded: variantProps.rounded,
|
|
120
|
+
outlined: variantProps.outlined
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
const handleChange = (e) => {
|
|
124
|
+
const next = e.currentTarget.checked;
|
|
125
|
+
untrack(() => {
|
|
126
|
+
if (!isControlled) setInternalChecked(next);
|
|
127
|
+
localProps.onChange?.(next);
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
return <label
|
|
131
|
+
class={switchClasses()}
|
|
132
|
+
role="switch"
|
|
133
|
+
aria-checked={checkedValue()}
|
|
134
|
+
aria-label={localProps["aria-label"]}
|
|
135
|
+
aria-describedby={localProps["aria-describedby"]}
|
|
136
|
+
>
|
|
137
|
+
<input
|
|
138
|
+
type="checkbox"
|
|
139
|
+
class="sr-only peer"
|
|
140
|
+
checked={checkedValue()}
|
|
141
|
+
onChange={handleChange}
|
|
142
|
+
name={localProps.name}
|
|
143
|
+
required={localProps.required}
|
|
144
|
+
disabled={localProps.disabled}
|
|
145
|
+
aria-hidden="true"
|
|
146
|
+
{...otherProps}
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<span class={checkClasses()} />
|
|
150
|
+
<span class="control-label">{localProps.children}</span>
|
|
151
|
+
</label>;
|
|
152
|
+
};
|
|
153
|
+
var Switch_default = Switch;
|
|
154
|
+
|
|
155
|
+
// src/components/switch/index.ts
|
|
156
|
+
var switch_default = Switch_default;
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
switch_default
|
|
160
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, effect, className, memo } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/progress/Progress.styles.ts
|
|
6
|
+
var progressContainer = cva(
|
|
7
|
+
"relative w-full max-w-md select-none",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "",
|
|
12
|
+
md: "",
|
|
13
|
+
lg: ""
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: { size: "md" }
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
var progressWrapper = cva("overflow-hidden bg-gray-200", {
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
sm: "h-2",
|
|
23
|
+
md: "h-4",
|
|
24
|
+
lg: "h-6"
|
|
25
|
+
},
|
|
26
|
+
shape: {
|
|
27
|
+
rounded: "rounded-lg",
|
|
28
|
+
circle: "rounded-full"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
size: "md",
|
|
33
|
+
shape: "rounded"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var progressFill = cva("h-full transition-all duration-300", {
|
|
37
|
+
variants: {
|
|
38
|
+
color: {
|
|
39
|
+
default: "bg-gray-500",
|
|
40
|
+
danger: "bg-red-500",
|
|
41
|
+
success: "bg-green-500",
|
|
42
|
+
info: "bg-blue-500",
|
|
43
|
+
warning: "bg-yellow-500"
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
filled: "",
|
|
47
|
+
outlined: "bg-opacity-0 ring-1 ring-gray-300",
|
|
48
|
+
ghost: "bg-opacity-50"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
color: "default",
|
|
53
|
+
variant: "filled"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var progressLabel = cva(
|
|
57
|
+
"absolute top-0 right-0 h-full flex items-center pr-2 text-xs font-medium text-gray-700"
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// src/components/progress/Progress.tsx
|
|
61
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
62
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><div>`);
|
|
63
|
+
var Progress = (props) => {
|
|
64
|
+
const [local, rest] = splitProps(props, ["value", "size", "shape", "variant", "color", "showValue", "format", "className"]);
|
|
65
|
+
const val = createMemo(() => typeof local.value === "number" ? Math.max(0, Math.min(100, local.value)) : null);
|
|
66
|
+
const isDeterminate = () => val() !== null;
|
|
67
|
+
const labelText = createMemo(() => {
|
|
68
|
+
if (!local.showValue || val() == null) return "";
|
|
69
|
+
return local.format === "percent" ? `${val()}%` : String(val());
|
|
70
|
+
});
|
|
71
|
+
return (() => {
|
|
72
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild;
|
|
73
|
+
spread(_el$, mergeProps(rest, {
|
|
74
|
+
get ["class"]() {
|
|
75
|
+
return classes(progressContainer({
|
|
76
|
+
size: local.size
|
|
77
|
+
}), local.className);
|
|
78
|
+
},
|
|
79
|
+
get ["aria-busy"]() {
|
|
80
|
+
return !isDeterminate();
|
|
81
|
+
}
|
|
82
|
+
}), false, true);
|
|
83
|
+
insert(_el$2, createComponent(Show, {
|
|
84
|
+
get when() {
|
|
85
|
+
return isDeterminate();
|
|
86
|
+
},
|
|
87
|
+
get fallback() {
|
|
88
|
+
return (() => {
|
|
89
|
+
var _el$5 = _tmpl$();
|
|
90
|
+
_el$5.style.setProperty("width", "100%");
|
|
91
|
+
effect(() => className(_el$5, classes(progressFill({
|
|
92
|
+
color: local.color,
|
|
93
|
+
variant: local.variant
|
|
94
|
+
}), "animate-pulse")));
|
|
95
|
+
return _el$5;
|
|
96
|
+
})();
|
|
97
|
+
},
|
|
98
|
+
get children() {
|
|
99
|
+
var _el$3 = _tmpl$();
|
|
100
|
+
effect((_p$) => {
|
|
101
|
+
var _v$ = progressFill({
|
|
102
|
+
color: local.color,
|
|
103
|
+
variant: local.variant
|
|
104
|
+
}), _v$2 = `${val()}%`;
|
|
105
|
+
_v$ !== _p$.e && className(_el$3, _p$.e = _v$);
|
|
106
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$3.style.setProperty("width", _v$2) : _el$3.style.removeProperty("width"));
|
|
107
|
+
return _p$;
|
|
108
|
+
}, {
|
|
109
|
+
e: void 0,
|
|
110
|
+
t: void 0
|
|
111
|
+
});
|
|
112
|
+
return _el$3;
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
insert(_el$, createComponent(Show, {
|
|
116
|
+
get when() {
|
|
117
|
+
return memo(() => !!local.showValue)() && labelText();
|
|
118
|
+
},
|
|
119
|
+
get children() {
|
|
120
|
+
var _el$4 = _tmpl$();
|
|
121
|
+
insert(_el$4, labelText);
|
|
122
|
+
effect(() => className(_el$4, progressLabel()));
|
|
123
|
+
return _el$4;
|
|
124
|
+
}
|
|
125
|
+
}), null);
|
|
126
|
+
effect(() => className(_el$2, classes(progressWrapper({
|
|
127
|
+
size: local.size,
|
|
128
|
+
shape: local.shape
|
|
129
|
+
}))));
|
|
130
|
+
return _el$;
|
|
131
|
+
})();
|
|
132
|
+
};
|
|
133
|
+
var Progress_default = Progress;
|
|
134
|
+
|
|
135
|
+
// src/components/progress/index.ts
|
|
136
|
+
var progress_default = Progress_default;
|
|
137
|
+
|
|
138
|
+
export { progress_default };
|