@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,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/table/Table.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
createMemo,
|
|
10
|
+
createSignal,
|
|
11
|
+
For
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/table/Table.styles.ts
|
|
15
|
+
var tableWrapper = cva(
|
|
16
|
+
"overflow-x-auto rounded-lg border border-gray-200 shadow"
|
|
17
|
+
);
|
|
18
|
+
var tableVariants = cva(
|
|
19
|
+
[
|
|
20
|
+
"min-w-full",
|
|
21
|
+
"text-sm text-left",
|
|
22
|
+
"divide-y divide-gray-100"
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
header: {
|
|
27
|
+
default: "bg-gray-50 font-semibold text-gray-700"
|
|
28
|
+
},
|
|
29
|
+
row: {
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
cell: {
|
|
33
|
+
default: "px-4 py-2"
|
|
34
|
+
},
|
|
35
|
+
divider: {
|
|
36
|
+
on: "border-r border-gray-200 last:border-r-0",
|
|
37
|
+
off: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
header: "default",
|
|
42
|
+
row: "default",
|
|
43
|
+
cell: "default",
|
|
44
|
+
divider: "on"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/components/table/Table.tsx
|
|
50
|
+
var Table = (props) => {
|
|
51
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
52
|
+
props,
|
|
53
|
+
["columns", "rows", "onSort", "className", "rowKey"],
|
|
54
|
+
Object.keys(tableVariants.variantKeys ?? {})
|
|
55
|
+
);
|
|
56
|
+
const [sortKey, setSortKey] = createSignal(null);
|
|
57
|
+
const [sortDir, setSortDir] = createSignal("asc");
|
|
58
|
+
const data = createMemo(() => localProps.rows);
|
|
59
|
+
const baseVars = () => variantProps;
|
|
60
|
+
const wrapperClass = classes(
|
|
61
|
+
tableWrapper(),
|
|
62
|
+
localProps.className
|
|
63
|
+
);
|
|
64
|
+
const tableClass = classes(
|
|
65
|
+
tableVariants(baseVars()),
|
|
66
|
+
localProps.className
|
|
67
|
+
);
|
|
68
|
+
const handleHeaderClick = (colKey, isSortable) => {
|
|
69
|
+
if (!isSortable) return;
|
|
70
|
+
const newDir = sortKey() === colKey && sortDir() === "asc" ? "desc" : "asc";
|
|
71
|
+
setSortKey(() => colKey);
|
|
72
|
+
setSortDir(newDir);
|
|
73
|
+
props.onSort?.(colKey, newDir);
|
|
74
|
+
};
|
|
75
|
+
return <div class={wrapperClass}>
|
|
76
|
+
<table {...otherProps} class={tableClass}>
|
|
77
|
+
<thead>
|
|
78
|
+
<tr>
|
|
79
|
+
{localProps.columns.map((col) => <th
|
|
80
|
+
class={tableVariants({ ...baseVars(), cell: variantProps.cell, divider: "on" })}
|
|
81
|
+
onClick={() => handleHeaderClick(col.key, col.sortable)}
|
|
82
|
+
style={col.sortable ? { cursor: "pointer" } : void 0}
|
|
83
|
+
role="columnheader"
|
|
84
|
+
aria-sort={sortKey() === col.key ? sortDir() === "asc" ? "ascending" : "descending" : void 0}
|
|
85
|
+
>
|
|
86
|
+
{col.header}
|
|
87
|
+
{sortKey() === col.key && (sortDir() === "asc" ? " \u2191" : " \u2193")}
|
|
88
|
+
</th>)}
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody>
|
|
92
|
+
<For each={data()}>
|
|
93
|
+
{(row) => <tr
|
|
94
|
+
class={tableVariants({ ...baseVars(), row: variantProps.row })}
|
|
95
|
+
>
|
|
96
|
+
{localProps.columns.map((col, ci) => <td
|
|
97
|
+
class={tableVariants({
|
|
98
|
+
...baseVars(),
|
|
99
|
+
cell: variantProps.cell,
|
|
100
|
+
divider: ci === localProps.columns.length - 1 ? "off" : "on"
|
|
101
|
+
})}
|
|
102
|
+
>
|
|
103
|
+
{String(row[col.key] ?? "")}
|
|
104
|
+
</td>)}
|
|
105
|
+
</tr>}
|
|
106
|
+
</For>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
109
|
+
</div>;
|
|
110
|
+
};
|
|
111
|
+
var Table_default = Table;
|
|
112
|
+
|
|
113
|
+
// src/components/table/index.ts
|
|
114
|
+
var table_default = Table_default;
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
table_default
|
|
118
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { createSignal, For, onMount, onCleanup, Show } from 'solid-js';
|
|
3
|
+
import { delegateEvents, template, insert, createComponent, mergeProps, effect, className, use } from 'solid-js/web';
|
|
4
|
+
|
|
5
|
+
var [toasts, setToasts] = createSignal([]);
|
|
6
|
+
var toastStore = {
|
|
7
|
+
toasts,
|
|
8
|
+
add(toast2) {
|
|
9
|
+
const id = crypto.randomUUID();
|
|
10
|
+
setToasts((prev) => [...prev, { ...toast2, id }]);
|
|
11
|
+
return id;
|
|
12
|
+
},
|
|
13
|
+
remove(id) {
|
|
14
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
15
|
+
},
|
|
16
|
+
clear() {
|
|
17
|
+
setToasts([]);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/components/toast/toast-api.ts
|
|
22
|
+
function createToastApi() {
|
|
23
|
+
const show = (message, options = {}) => {
|
|
24
|
+
return toastStore.add({ ...options, message });
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
show,
|
|
28
|
+
success: (msg, opts) => show(msg, { ...opts, type: "success" }),
|
|
29
|
+
error: (msg, opts) => show(msg, { ...opts, type: "error" }),
|
|
30
|
+
info: (msg, opts) => show(msg, { ...opts, type: "info" }),
|
|
31
|
+
warning: (msg, opts) => show(msg, { ...opts, type: "warning" }),
|
|
32
|
+
clear: toastStore.clear
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/components/toast/utils/remove-element.ts
|
|
37
|
+
function removeElement(el) {
|
|
38
|
+
if (typeof el.remove === "function") {
|
|
39
|
+
el.remove();
|
|
40
|
+
} else {
|
|
41
|
+
el.parentNode?.removeChild(el);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/components/toast/utils/timer.ts
|
|
46
|
+
var Timer = class {
|
|
47
|
+
callback;
|
|
48
|
+
delay;
|
|
49
|
+
startedAt;
|
|
50
|
+
timer;
|
|
51
|
+
constructor(callback, delay) {
|
|
52
|
+
this.callback = callback;
|
|
53
|
+
this.delay = delay;
|
|
54
|
+
this.startedAt = Date.now();
|
|
55
|
+
this.timer = window.setTimeout(callback, delay);
|
|
56
|
+
}
|
|
57
|
+
pause() {
|
|
58
|
+
this.stop();
|
|
59
|
+
this.delay -= Date.now() - this.startedAt;
|
|
60
|
+
}
|
|
61
|
+
resume() {
|
|
62
|
+
this.stop();
|
|
63
|
+
this.startedAt = Date.now();
|
|
64
|
+
this.timer = window.setTimeout(this.callback, this.delay);
|
|
65
|
+
}
|
|
66
|
+
stop() {
|
|
67
|
+
clearTimeout(this.timer);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/components/toast/Toast.styles.ts
|
|
72
|
+
var toastWrapperClass = cva(
|
|
73
|
+
"relative flex items-start gap-3 px-4 py-3 rounded-2xl shadow-lg transition-all duration-300 w-full",
|
|
74
|
+
{
|
|
75
|
+
variants: {
|
|
76
|
+
type: {
|
|
77
|
+
default: "bg-gray-700 text-white",
|
|
78
|
+
success: "bg-green-600 text-white",
|
|
79
|
+
error: "bg-red-600 text-white",
|
|
80
|
+
info: "bg-blue-600 text-white",
|
|
81
|
+
warning: "bg-yellow-400 text-black"
|
|
82
|
+
},
|
|
83
|
+
visible: {
|
|
84
|
+
true: "opacity-100 translate-y-0",
|
|
85
|
+
false: "opacity-0 -translate-y-2 pointer-events-none"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
type: "default",
|
|
90
|
+
visible: true
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
// src/components/toast/Toast.tsx
|
|
96
|
+
var _tmpl$ = /* @__PURE__ */ template(`<button class="absolute top-2 right-2 text-white/80 hover:text-white transition"aria-label="Close toast">\xD7`);
|
|
97
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div role=alert>`);
|
|
98
|
+
var Toast = (props) => {
|
|
99
|
+
const [visible, setVisible] = createSignal(false);
|
|
100
|
+
let rootRef;
|
|
101
|
+
let timer = null;
|
|
102
|
+
const close = () => {
|
|
103
|
+
timer?.stop();
|
|
104
|
+
setVisible(false);
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
props.onClose?.();
|
|
107
|
+
if (rootRef) removeElement(rootRef);
|
|
108
|
+
}, 150);
|
|
109
|
+
};
|
|
110
|
+
onMount(() => {
|
|
111
|
+
setVisible(true);
|
|
112
|
+
if (props.duration !== false) {
|
|
113
|
+
timer = new Timer(close, props.duration || 4e3);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
onCleanup(() => {
|
|
117
|
+
timer?.stop();
|
|
118
|
+
});
|
|
119
|
+
return (() => {
|
|
120
|
+
var _el$ = _tmpl$2();
|
|
121
|
+
_el$.$$click = () => props.dismissible && close();
|
|
122
|
+
var _ref$ = rootRef;
|
|
123
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
124
|
+
insert(_el$, createComponent(Show, {
|
|
125
|
+
get when() {
|
|
126
|
+
return props.dismissible;
|
|
127
|
+
},
|
|
128
|
+
get children() {
|
|
129
|
+
return _tmpl$();
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
effect((_p$) => {
|
|
133
|
+
var _v$ = toastWrapperClass({
|
|
134
|
+
type: props.type || "default",
|
|
135
|
+
visible: visible()
|
|
136
|
+
}), _v$2 = props.message;
|
|
137
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
138
|
+
_v$2 !== _p$.t && (_el$.innerHTML = _p$.t = _v$2);
|
|
139
|
+
return _p$;
|
|
140
|
+
}, {
|
|
141
|
+
e: void 0,
|
|
142
|
+
t: void 0
|
|
143
|
+
});
|
|
144
|
+
return _el$;
|
|
145
|
+
})();
|
|
146
|
+
};
|
|
147
|
+
var Toast_default = Toast;
|
|
148
|
+
delegateEvents(["click"]);
|
|
149
|
+
|
|
150
|
+
// src/components/toast/Toaster.tsx
|
|
151
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div class="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2 w-[300px] max-w-full">`);
|
|
152
|
+
var Toaster = () => {
|
|
153
|
+
return (() => {
|
|
154
|
+
var _el$ = _tmpl$3();
|
|
155
|
+
insert(_el$, createComponent(For, {
|
|
156
|
+
get each() {
|
|
157
|
+
return toastStore.toasts();
|
|
158
|
+
},
|
|
159
|
+
children: (toast2) => createComponent(Toast_default, mergeProps(toast2, {
|
|
160
|
+
onClose: () => toastStore.remove(toast2.id)
|
|
161
|
+
}))
|
|
162
|
+
}));
|
|
163
|
+
return _el$;
|
|
164
|
+
})();
|
|
165
|
+
};
|
|
166
|
+
var Toaster_default = Toaster;
|
|
167
|
+
|
|
168
|
+
// src/components/toast/index.ts
|
|
169
|
+
var toast = createToastApi();
|
|
170
|
+
var toast_default = toast;
|
|
171
|
+
|
|
172
|
+
export { Toaster_default, toast, toast_default };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/tabs/Tabs.tsx
|
|
6
|
+
import {
|
|
7
|
+
createSignal,
|
|
8
|
+
splitProps,
|
|
9
|
+
For,
|
|
10
|
+
Show,
|
|
11
|
+
createMemo
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/tabs/Tabs.styles.ts
|
|
15
|
+
var tabsNavVariants = cva(
|
|
16
|
+
"flex text-sm font-medium text-gray-600 dark:text-gray-300",
|
|
17
|
+
{
|
|
18
|
+
variants: {
|
|
19
|
+
type: {
|
|
20
|
+
basic: "",
|
|
21
|
+
boxed: "flex gap-2",
|
|
22
|
+
toggle: "inline-flex rounded-md p-1",
|
|
23
|
+
"toggle-rounded": "inline-flex rounded-full p-1"
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: "text-xs gap-1",
|
|
27
|
+
md: "text-sm gap-2",
|
|
28
|
+
lg: "text-base gap-3"
|
|
29
|
+
},
|
|
30
|
+
alignment: {
|
|
31
|
+
left: "justify-start",
|
|
32
|
+
center: "justify-center",
|
|
33
|
+
right: "justify-end"
|
|
34
|
+
},
|
|
35
|
+
expanded: {
|
|
36
|
+
true: "w-full",
|
|
37
|
+
false: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
type: "basic",
|
|
42
|
+
size: "md",
|
|
43
|
+
alignment: "left",
|
|
44
|
+
expanded: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
var tabTriggerVariants = cva(
|
|
49
|
+
"inline-flex items-center justify-center whitespace-nowrap font-medium text-sm transition-colors",
|
|
50
|
+
{
|
|
51
|
+
variants: {
|
|
52
|
+
size: {
|
|
53
|
+
sm: "text-xs px-2 py-1",
|
|
54
|
+
md: "text-sm px-3 py-2",
|
|
55
|
+
lg: "text-base px-4 py-3"
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
basic: "border-b-2 transition-colors hover:text-blue-600",
|
|
59
|
+
boxed: "rounded-t px-4 py-2 hover:text-blue-600",
|
|
60
|
+
toggle: "border -ml-px px-4 py-2 transition-colors first:ml-0 first:rounded-l-md last:rounded-r-md",
|
|
61
|
+
"toggle-rounded": "border -ml-px first:ml-0 first:rounded-l-full last:rounded-r-full transition-colors"
|
|
62
|
+
},
|
|
63
|
+
active: {
|
|
64
|
+
true: "",
|
|
65
|
+
false: ""
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
true: "opacity-50 cursor-not-allowed pointer-events-none",
|
|
69
|
+
false: ""
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
compoundVariants: [
|
|
73
|
+
{
|
|
74
|
+
type: "basic",
|
|
75
|
+
active: true,
|
|
76
|
+
class: "border-blue-600 text-blue-600"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "basic",
|
|
80
|
+
active: false,
|
|
81
|
+
class: "border-transparent text-gray-500 dark:text-gray-400"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "boxed",
|
|
85
|
+
active: true,
|
|
86
|
+
class: "border-x border-t border-b-0 border-gray-400 dark:border-gray-600 text-blue-600"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "boxed",
|
|
90
|
+
active: false,
|
|
91
|
+
class: "border-b border-transparent text-gray-500 dark:text-gray-400 hover:text-blue-600"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "toggle",
|
|
95
|
+
active: true,
|
|
96
|
+
class: "bg-blue-600 text-white border-blue-600"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "toggle",
|
|
100
|
+
active: false,
|
|
101
|
+
class: "bg-transparent text-gray-600 dark:text-gray-300 border-gray-300 dark:border-gray-600"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "toggle-rounded",
|
|
105
|
+
active: true,
|
|
106
|
+
class: "bg-blue-600 text-white border-blue-600"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "toggle-rounded",
|
|
110
|
+
active: false,
|
|
111
|
+
class: "bg-transparent text-gray-600 dark:text-gray-300 border-gray-300 dark:border-gray-600"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
active: false,
|
|
116
|
+
disabled: false
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
// src/components/tabs/Tabs.tsx
|
|
122
|
+
var Tabs = (props) => {
|
|
123
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
124
|
+
props,
|
|
125
|
+
["items", "value", "onChange"],
|
|
126
|
+
["size", "type", "alignment", "expanded"]
|
|
127
|
+
);
|
|
128
|
+
const [internalActive, setInternalActive] = createSignal(local.value ?? 0);
|
|
129
|
+
const isControlled = () => local.value !== void 0;
|
|
130
|
+
const active = createMemo(
|
|
131
|
+
() => isControlled() ? local.value : internalActive()
|
|
132
|
+
);
|
|
133
|
+
const handleChange = (i) => {
|
|
134
|
+
const item = local.items[i];
|
|
135
|
+
if (!item || item.disabled) return;
|
|
136
|
+
if (!isControlled()) {
|
|
137
|
+
setInternalActive(i);
|
|
138
|
+
}
|
|
139
|
+
local.onChange?.(i);
|
|
140
|
+
};
|
|
141
|
+
return <div {...otherProps}>
|
|
142
|
+
<nav class={tabsNavVariants(variantProps)}>
|
|
143
|
+
<ul class="flex gap-0">
|
|
144
|
+
<For each={local.items}>
|
|
145
|
+
{(tab, i) => <li>
|
|
146
|
+
<button
|
|
147
|
+
class={tabTriggerVariants({
|
|
148
|
+
type: variantProps.type ?? "basic",
|
|
149
|
+
size: variantProps.size ?? "md",
|
|
150
|
+
active: i() === active(),
|
|
151
|
+
disabled: tab.disabled
|
|
152
|
+
})}
|
|
153
|
+
onClick={() => handleChange(i())}
|
|
154
|
+
>
|
|
155
|
+
{tab.label}
|
|
156
|
+
</button>
|
|
157
|
+
</li>}
|
|
158
|
+
</For>
|
|
159
|
+
</ul>
|
|
160
|
+
</nav>
|
|
161
|
+
<div class="pt-4">
|
|
162
|
+
<Show when={local.items[active()]}>
|
|
163
|
+
{local.items[active()]?.content}
|
|
164
|
+
</Show>
|
|
165
|
+
</div>
|
|
166
|
+
</div>;
|
|
167
|
+
};
|
|
168
|
+
var Tabs_default = Tabs;
|
|
169
|
+
|
|
170
|
+
// src/components/tabs/index.ts
|
|
171
|
+
var tabs_default = Tabs_default;
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
tabs_default
|
|
175
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/steps/Steps.tsx
|
|
7
|
+
import {
|
|
8
|
+
createSignal,
|
|
9
|
+
splitProps,
|
|
10
|
+
For,
|
|
11
|
+
Show,
|
|
12
|
+
createMemo
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
|
|
15
|
+
// src/components/steps/Steps.styles.ts
|
|
16
|
+
var stepsContainer = cva("flex flex-col", {
|
|
17
|
+
variants: {
|
|
18
|
+
animated: {
|
|
19
|
+
true: "transition-all duration-300 ease-in-out",
|
|
20
|
+
false: ""
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { animated: false }
|
|
24
|
+
});
|
|
25
|
+
var navBar = cva("flex items-center justify-between mb-6");
|
|
26
|
+
var navItem = cva(
|
|
27
|
+
"relative flex-1 flex flex-col items-center",
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
clickable: {
|
|
31
|
+
true: "cursor-pointer",
|
|
32
|
+
false: "pointer-events-none"
|
|
33
|
+
},
|
|
34
|
+
disabled: {
|
|
35
|
+
true: "opacity-50 pointer-events-none",
|
|
36
|
+
false: ""
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: { clickable: false, disabled: false }
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
var marker = cva(
|
|
43
|
+
"w-8 h-8 flex items-center justify-center rounded-full border-2",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
active: {
|
|
47
|
+
true: "bg-blue-500 border-blue-500 text-white",
|
|
48
|
+
false: "bg-white border-gray-300 text-gray-600"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: { active: false }
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
var line = cva("absolute top-1/2 left-full w-full h-0.5", {
|
|
55
|
+
variants: {
|
|
56
|
+
active: {
|
|
57
|
+
true: "bg-blue-500",
|
|
58
|
+
false: "bg-gray-300"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: { active: false }
|
|
62
|
+
});
|
|
63
|
+
var title = cva("mt-2 text-sm", {
|
|
64
|
+
variants: {
|
|
65
|
+
active: {
|
|
66
|
+
true: "text-blue-600 font-medium",
|
|
67
|
+
false: "text-gray-600"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: { active: false }
|
|
71
|
+
});
|
|
72
|
+
var subtitle = cva("text-xs mt-1", {
|
|
73
|
+
variants: {
|
|
74
|
+
color: {
|
|
75
|
+
default: "text-blue-500",
|
|
76
|
+
muted: "text-gray-500",
|
|
77
|
+
accent: "text-green-500"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: { color: "default" }
|
|
81
|
+
});
|
|
82
|
+
var buttonSteps = cva("px-4 py-2 bg-blue-600 text-white rounded");
|
|
83
|
+
|
|
84
|
+
// src/components/steps/Steps.tsx
|
|
85
|
+
var Steps = (props) => {
|
|
86
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
87
|
+
props,
|
|
88
|
+
["steps", "animated", "initial", "value", "onStepChange", "className"],
|
|
89
|
+
["animated"]
|
|
90
|
+
);
|
|
91
|
+
const isControlled = () => local.value !== void 0;
|
|
92
|
+
const [internalIndex, setInternalIndex] = createSignal(local.initial ?? 0);
|
|
93
|
+
const activeIndex = createMemo(
|
|
94
|
+
() => isControlled() ? local.value : internalIndex()
|
|
95
|
+
);
|
|
96
|
+
const clamp = (i) => Math.max(0, Math.min(i, local.steps.length - 1));
|
|
97
|
+
const changeIndex = (i) => {
|
|
98
|
+
const idx = clamp(i);
|
|
99
|
+
if (isControlled()) local.onStepChange?.(idx);
|
|
100
|
+
else setInternalIndex(idx);
|
|
101
|
+
};
|
|
102
|
+
const next = () => changeIndex(activeIndex() + 1);
|
|
103
|
+
const back = () => changeIndex(activeIndex() - 1);
|
|
104
|
+
const isActive = (i) => i === activeIndex();
|
|
105
|
+
const isPast = (i) => i < activeIndex();
|
|
106
|
+
return <div
|
|
107
|
+
class={classes(
|
|
108
|
+
stepsContainer({ animated: local.animated }),
|
|
109
|
+
local.className
|
|
110
|
+
)}
|
|
111
|
+
{...otherProps}
|
|
112
|
+
>
|
|
113
|
+
<nav class={navBar()}>
|
|
114
|
+
<For each={local.steps}>
|
|
115
|
+
{(step, idx) => {
|
|
116
|
+
const i = idx();
|
|
117
|
+
return <div
|
|
118
|
+
class={navItem({ clickable: !!step.clickable })}
|
|
119
|
+
onClick={() => step.clickable && changeIndex(i)}
|
|
120
|
+
>
|
|
121
|
+
<div class={marker({ active: isActive(i) || isPast(i) })}>
|
|
122
|
+
{step.marker ?? String(i + 1)}
|
|
123
|
+
</div>
|
|
124
|
+
<Show when={i < local.steps.length - 1}>
|
|
125
|
+
<div class={line({ active: isPast(i) })} />
|
|
126
|
+
</Show>
|
|
127
|
+
<div class={title({ active: isActive(i) || isPast(i) })}>
|
|
128
|
+
{step.title}
|
|
129
|
+
</div>
|
|
130
|
+
<Show when={step.subtitle}>
|
|
131
|
+
<div class={subtitle()}>{step.subtitle}</div>
|
|
132
|
+
</Show>
|
|
133
|
+
</div>;
|
|
134
|
+
}}
|
|
135
|
+
</For>
|
|
136
|
+
</nav>
|
|
137
|
+
<div>
|
|
138
|
+
<For each={local.steps}>
|
|
139
|
+
{(step, idx) => {
|
|
140
|
+
const i = idx();
|
|
141
|
+
return <Show when={isActive(i)}>
|
|
142
|
+
<div>
|
|
143
|
+
{step.content}
|
|
144
|
+
<div class="flex justify-end gap-2 mt-6">
|
|
145
|
+
<Show when={i > 0}>
|
|
146
|
+
<button
|
|
147
|
+
type="button"
|
|
148
|
+
class="px-4 py-2 border rounded"
|
|
149
|
+
onClick={back}
|
|
150
|
+
>
|
|
151
|
+
Back
|
|
152
|
+
</button>
|
|
153
|
+
</Show>
|
|
154
|
+
<Show when={i < local.steps.length - 1}>
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
class={buttonSteps()}
|
|
158
|
+
onClick={next}
|
|
159
|
+
>
|
|
160
|
+
Next
|
|
161
|
+
</button>
|
|
162
|
+
</Show>
|
|
163
|
+
<Show when={i === local.steps.length - 1}>
|
|
164
|
+
<button
|
|
165
|
+
type="button"
|
|
166
|
+
class="px-4 py-2 bg-green-600 text-white rounded"
|
|
167
|
+
onClick={() => changeIndex(0)}
|
|
168
|
+
>
|
|
169
|
+
Restart
|
|
170
|
+
</button>
|
|
171
|
+
</Show>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</Show>;
|
|
175
|
+
}}
|
|
176
|
+
</For>
|
|
177
|
+
</div>
|
|
178
|
+
</div>;
|
|
179
|
+
};
|
|
180
|
+
var Steps_default = Steps;
|
|
181
|
+
|
|
182
|
+
// src/components/steps/index.ts
|
|
183
|
+
var steps_default = Steps_default;
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
steps_default
|
|
187
|
+
};
|