@pathscale/ui 0.0.2 → 0.0.4
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/Autocomplete-gLkjMHrc.d.ts +28 -0
- package/dist/Field-DfUn85_1.d.ts +49 -0
- package/dist/Progress-gN0xqhAF.d.ts +64 -0
- package/dist/Steps-1miUeyCD.d.ts +34 -0
- package/dist/Table-CGa6Nop3.d.ts +39 -0
- package/dist/Timeline-Bd4SxHMT.d.ts +14 -0
- package/dist/{Upload-BrFuZ4JA.d.ts → Upload-CRljD5jf.d.ts} +1 -1
- package/dist/chunk/3VOILEMN.js +187 -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/D2BEL4SM.jsx +169 -0
- package/dist/chunk/DSTUGZW6.jsx +81 -0
- package/dist/chunk/FKSQPGOD.jsx +170 -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/LAQPAV5I.jsx +187 -0
- package/dist/chunk/MAX47D6F.js +99 -0
- package/dist/chunk/{2JGZSAW5.js → MI773TMC.js} +6 -6
- package/dist/chunk/MYERRMTM.js +200 -0
- package/dist/chunk/OSJ3P7PI.js +189 -0
- package/dist/chunk/{QLESLIWS.jsx → QHJOIUYT.jsx} +14 -7
- package/dist/chunk/QYEMOKUG.js +125 -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/VN5BKHA2.jsx +97 -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/{S3ZDSQSV.js → YDEDUOFM.js} +8 -4
- package/dist/chunk/YMO6RPS6.js +26 -0
- package/dist/components/Progress/index.d.ts +4 -38
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/Progress/index.jsx +3 -11
- 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/button/index.js +1 -1
- package/dist/components/button/index.jsx +2 -1
- 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/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/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/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/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/upload/index.d.ts +2 -2
- package/dist/components/upload/index.js +1 -1
- package/dist/components/upload/index.jsx +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +18 -8
- package/dist/index.jsx +71 -17
- package/package.json +1 -1
- package/dist/Progress-a616LgE0.d.ts +0 -5
- package/dist/chunk/QNOJ6PCD.js +0 -278
- package/dist/chunk/WCBMW2TP.jsx +0 -203
|
@@ -55,11 +55,15 @@ var Upload = (props) => {
|
|
|
55
55
|
["style", "color", "size"]
|
|
56
56
|
);
|
|
57
57
|
const handleChange = (e) => {
|
|
58
|
-
const
|
|
58
|
+
const input = e.target;
|
|
59
|
+
const files = input.files;
|
|
59
60
|
if (!files || files.length === 0) return;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if (local.onChange) {
|
|
62
|
+
if (local.multiple) {
|
|
63
|
+
local.onChange(Array.from(files));
|
|
64
|
+
} else if (files[0]) {
|
|
65
|
+
local.onChange(files[0]);
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
};
|
|
65
69
|
const handleDrop = (e) => {
|
|
@@ -67,9 +71,12 @@ var Upload = (props) => {
|
|
|
67
71
|
e.preventDefault();
|
|
68
72
|
const files = e.dataTransfer?.files;
|
|
69
73
|
if (!files || files.length === 0) return;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
if (local.onChange) {
|
|
75
|
+
if (local.multiple) {
|
|
76
|
+
local.onChange(Array.from(files));
|
|
77
|
+
} else if (files[0]) {
|
|
78
|
+
local.onChange(files[0]);
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
};
|
|
75
82
|
const handleDragOver = (e) => {
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, className, spread, mergeProps, insert, memo, effect, style, setAttribute, createComponent } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, createMemo, For } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/table/Table.styles.ts
|
|
6
|
+
var tableWrapper = cva(
|
|
7
|
+
"overflow-x-auto rounded-lg border border-gray-200 shadow"
|
|
8
|
+
);
|
|
9
|
+
var tableVariants = cva(
|
|
10
|
+
[
|
|
11
|
+
"min-w-full",
|
|
12
|
+
"text-sm text-left",
|
|
13
|
+
"divide-y divide-gray-100"
|
|
14
|
+
],
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
header: {
|
|
18
|
+
default: "bg-gray-50 font-semibold text-gray-700"
|
|
19
|
+
},
|
|
20
|
+
row: {
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
cell: {
|
|
24
|
+
default: "px-4 py-2"
|
|
25
|
+
},
|
|
26
|
+
divider: {
|
|
27
|
+
on: "border-r border-gray-200 last:border-r-0",
|
|
28
|
+
off: ""
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
header: "default",
|
|
33
|
+
row: "default",
|
|
34
|
+
cell: "default",
|
|
35
|
+
divider: "on"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// src/components/table/Table.tsx
|
|
41
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div><table><thead><tr></tr></thead><tbody>`);
|
|
42
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<th role=columnheader>`);
|
|
43
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<tr>`);
|
|
44
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<td>`);
|
|
45
|
+
var Table = (props) => {
|
|
46
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["columns", "rows", "onSort", "className", "rowKey"], Object.keys(tableVariants.variantKeys ?? {}));
|
|
47
|
+
const [sortKey, setSortKey] = createSignal(null);
|
|
48
|
+
const [sortDir, setSortDir] = createSignal("asc");
|
|
49
|
+
const data = createMemo(() => localProps.rows);
|
|
50
|
+
const baseVars = () => variantProps;
|
|
51
|
+
const wrapperClass = classes(tableWrapper(), localProps.className);
|
|
52
|
+
const tableClass = classes(tableVariants(baseVars()), localProps.className);
|
|
53
|
+
const handleHeaderClick = (colKey, isSortable) => {
|
|
54
|
+
if (!isSortable) return;
|
|
55
|
+
const newDir = sortKey() === colKey && sortDir() === "asc" ? "desc" : "asc";
|
|
56
|
+
setSortKey(() => colKey);
|
|
57
|
+
setSortDir(newDir);
|
|
58
|
+
props.onSort?.(colKey, newDir);
|
|
59
|
+
};
|
|
60
|
+
return (() => {
|
|
61
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling;
|
|
62
|
+
className(_el$, wrapperClass);
|
|
63
|
+
spread(_el$2, mergeProps(otherProps, {
|
|
64
|
+
"class": tableClass
|
|
65
|
+
}), false, true);
|
|
66
|
+
insert(_el$4, () => localProps.columns.map((col) => (() => {
|
|
67
|
+
var _el$6 = _tmpl$2();
|
|
68
|
+
_el$6.$$click = () => handleHeaderClick(col.key, col.sortable);
|
|
69
|
+
insert(_el$6, () => col.header, null);
|
|
70
|
+
insert(_el$6, (() => {
|
|
71
|
+
var _c$ = memo(() => sortKey() === col.key);
|
|
72
|
+
return () => _c$() && (sortDir() === "asc" ? " \u2191" : " \u2193");
|
|
73
|
+
})(), null);
|
|
74
|
+
effect((_p$) => {
|
|
75
|
+
var _v$ = tableVariants({
|
|
76
|
+
...baseVars(),
|
|
77
|
+
cell: variantProps.cell,
|
|
78
|
+
divider: "on"
|
|
79
|
+
}), _v$2 = col.sortable ? {
|
|
80
|
+
cursor: "pointer"
|
|
81
|
+
} : void 0, _v$3 = sortKey() === col.key ? sortDir() === "asc" ? "ascending" : "descending" : void 0;
|
|
82
|
+
_v$ !== _p$.e && className(_el$6, _p$.e = _v$);
|
|
83
|
+
_p$.t = style(_el$6, _v$2, _p$.t);
|
|
84
|
+
_v$3 !== _p$.a && setAttribute(_el$6, "aria-sort", _p$.a = _v$3);
|
|
85
|
+
return _p$;
|
|
86
|
+
}, {
|
|
87
|
+
e: void 0,
|
|
88
|
+
t: void 0,
|
|
89
|
+
a: void 0
|
|
90
|
+
});
|
|
91
|
+
return _el$6;
|
|
92
|
+
})()));
|
|
93
|
+
insert(_el$5, createComponent(For, {
|
|
94
|
+
get each() {
|
|
95
|
+
return data();
|
|
96
|
+
},
|
|
97
|
+
children: (row) => (() => {
|
|
98
|
+
var _el$7 = _tmpl$3();
|
|
99
|
+
insert(_el$7, () => localProps.columns.map((col, ci) => (() => {
|
|
100
|
+
var _el$8 = _tmpl$4();
|
|
101
|
+
insert(_el$8, () => String(row[col.key] ?? ""));
|
|
102
|
+
effect(() => className(_el$8, tableVariants({
|
|
103
|
+
...baseVars(),
|
|
104
|
+
cell: variantProps.cell,
|
|
105
|
+
divider: ci === localProps.columns.length - 1 ? "off" : "on"
|
|
106
|
+
})));
|
|
107
|
+
return _el$8;
|
|
108
|
+
})()));
|
|
109
|
+
effect(() => className(_el$7, tableVariants({
|
|
110
|
+
...baseVars(),
|
|
111
|
+
row: variantProps.row
|
|
112
|
+
})));
|
|
113
|
+
return _el$7;
|
|
114
|
+
})()
|
|
115
|
+
}));
|
|
116
|
+
return _el$;
|
|
117
|
+
})();
|
|
118
|
+
};
|
|
119
|
+
var Table_default = Table;
|
|
120
|
+
delegateEvents(["click"]);
|
|
121
|
+
|
|
122
|
+
// src/components/table/index.ts
|
|
123
|
+
var table_default = Table_default;
|
|
124
|
+
|
|
125
|
+
export { table_default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buttonVariants
|
|
3
|
+
} from "./YAQK2KFY.jsx";
|
|
4
|
+
import {
|
|
5
|
+
PolymorphicButton_default
|
|
6
|
+
} from "./KACNXPUM.jsx";
|
|
7
|
+
|
|
8
|
+
// src/components/button/Button.tsx
|
|
9
|
+
import {
|
|
10
|
+
mergeProps,
|
|
11
|
+
splitProps,
|
|
12
|
+
createMemo
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
var Button = (props) => {
|
|
15
|
+
const defaultedProps = mergeProps(
|
|
16
|
+
{
|
|
17
|
+
color: "primary"
|
|
18
|
+
},
|
|
19
|
+
props
|
|
20
|
+
);
|
|
21
|
+
const [variantProps, otherProps] = splitProps(defaultedProps, [
|
|
22
|
+
"class",
|
|
23
|
+
...buttonVariants.variantKeys
|
|
24
|
+
]);
|
|
25
|
+
const classes = createMemo(() => buttonVariants(variantProps));
|
|
26
|
+
return <PolymorphicButton_default
|
|
27
|
+
class={classes()}
|
|
28
|
+
aria-busy={variantProps.loading ? "true" : void 0}
|
|
29
|
+
{...otherProps}
|
|
30
|
+
/>;
|
|
31
|
+
};
|
|
32
|
+
var Button_default = Button;
|
|
33
|
+
|
|
34
|
+
// src/components/button/index.ts
|
|
35
|
+
var button_default = Button_default;
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
button_default
|
|
39
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/progress/Progress.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
Show,
|
|
10
|
+
createMemo
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/progress/Progress.styles.ts
|
|
14
|
+
var progressContainer = cva(
|
|
15
|
+
"relative w-full max-w-md select-none",
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
sm: "",
|
|
20
|
+
md: "",
|
|
21
|
+
lg: ""
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { size: "md" }
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var progressWrapper = cva("overflow-hidden bg-gray-200", {
|
|
28
|
+
variants: {
|
|
29
|
+
size: {
|
|
30
|
+
sm: "h-2",
|
|
31
|
+
md: "h-4",
|
|
32
|
+
lg: "h-6"
|
|
33
|
+
},
|
|
34
|
+
shape: {
|
|
35
|
+
rounded: "rounded-lg",
|
|
36
|
+
circle: "rounded-full"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "md",
|
|
41
|
+
shape: "rounded"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var progressFill = cva("h-full transition-all duration-300", {
|
|
45
|
+
variants: {
|
|
46
|
+
color: {
|
|
47
|
+
default: "bg-gray-500",
|
|
48
|
+
danger: "bg-red-500",
|
|
49
|
+
success: "bg-green-500",
|
|
50
|
+
info: "bg-blue-500",
|
|
51
|
+
warning: "bg-yellow-500"
|
|
52
|
+
},
|
|
53
|
+
variant: {
|
|
54
|
+
filled: "",
|
|
55
|
+
outlined: "bg-opacity-0 ring-1 ring-gray-300",
|
|
56
|
+
ghost: "bg-opacity-50"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
color: "default",
|
|
61
|
+
variant: "filled"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var progressLabel = cva(
|
|
65
|
+
"absolute top-0 right-0 h-full flex items-center pr-2 text-xs font-medium text-gray-700"
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// src/components/progress/Progress.tsx
|
|
69
|
+
var Progress = (props) => {
|
|
70
|
+
const [local, rest] = splitProps(props, [
|
|
71
|
+
"value",
|
|
72
|
+
"size",
|
|
73
|
+
"shape",
|
|
74
|
+
"variant",
|
|
75
|
+
"color",
|
|
76
|
+
"showValue",
|
|
77
|
+
"format",
|
|
78
|
+
"className"
|
|
79
|
+
]);
|
|
80
|
+
const val = createMemo(
|
|
81
|
+
() => typeof local.value === "number" ? Math.max(0, Math.min(100, local.value)) : null
|
|
82
|
+
);
|
|
83
|
+
const isDeterminate = () => val() !== null;
|
|
84
|
+
const labelText = createMemo(() => {
|
|
85
|
+
if (!local.showValue || val() == null) return "";
|
|
86
|
+
return local.format === "percent" ? `${val()}%` : String(val());
|
|
87
|
+
});
|
|
88
|
+
return <div
|
|
89
|
+
{...rest}
|
|
90
|
+
class={classes(progressContainer({ size: local.size }), local.className)}
|
|
91
|
+
aria-busy={!isDeterminate()}
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
class={classes(
|
|
95
|
+
progressWrapper({ size: local.size, shape: local.shape })
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<Show
|
|
99
|
+
when={isDeterminate()}
|
|
100
|
+
fallback={<div
|
|
101
|
+
class={classes(
|
|
102
|
+
progressFill({ color: local.color, variant: local.variant }),
|
|
103
|
+
"animate-pulse"
|
|
104
|
+
)}
|
|
105
|
+
style={{ width: "100%" }}
|
|
106
|
+
/>}
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
class={progressFill({
|
|
110
|
+
color: local.color,
|
|
111
|
+
variant: local.variant
|
|
112
|
+
})}
|
|
113
|
+
style={{ width: `${val()}%` }}
|
|
114
|
+
/>
|
|
115
|
+
</Show>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<Show when={local.showValue && labelText()}>
|
|
119
|
+
<div class={progressLabel()}>{labelText()}</div>
|
|
120
|
+
</Show>
|
|
121
|
+
</div>;
|
|
122
|
+
};
|
|
123
|
+
var Progress_default = Progress;
|
|
124
|
+
|
|
125
|
+
// src/components/progress/index.ts
|
|
126
|
+
var progress_default = Progress_default;
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
progress_default
|
|
130
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { PolymorphicButton_default } from './G6RG4LR7.js';
|
|
2
1
|
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
2
|
|
|
6
3
|
// src/components/button/Button.styles.ts
|
|
7
4
|
var buttonVariants = cva(
|
|
@@ -190,25 +187,4 @@ var buttonVariants = cva(
|
|
|
190
187
|
}
|
|
191
188
|
);
|
|
192
189
|
|
|
193
|
-
|
|
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 };
|
|
190
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, spread, mergeProps, insert, createComponent, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, createMemo, For, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/steps/Steps.styles.ts
|
|
6
|
+
var stepsContainer = cva("flex flex-col", {
|
|
7
|
+
variants: {
|
|
8
|
+
animated: {
|
|
9
|
+
true: "transition-all duration-300 ease-in-out",
|
|
10
|
+
false: ""
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { animated: false }
|
|
14
|
+
});
|
|
15
|
+
var navBar = cva("flex items-center justify-between mb-6");
|
|
16
|
+
var navItem = cva(
|
|
17
|
+
"relative flex-1 flex flex-col items-center",
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
clickable: {
|
|
21
|
+
true: "cursor-pointer",
|
|
22
|
+
false: "pointer-events-none"
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
true: "opacity-50 pointer-events-none",
|
|
26
|
+
false: ""
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { clickable: false, disabled: false }
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
var marker = cva(
|
|
33
|
+
"w-8 h-8 flex items-center justify-center rounded-full border-2",
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
active: {
|
|
37
|
+
true: "bg-blue-500 border-blue-500 text-white",
|
|
38
|
+
false: "bg-white border-gray-300 text-gray-600"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: { active: false }
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var line = cva("absolute top-1/2 left-full w-full h-0.5", {
|
|
45
|
+
variants: {
|
|
46
|
+
active: {
|
|
47
|
+
true: "bg-blue-500",
|
|
48
|
+
false: "bg-gray-300"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: { active: false }
|
|
52
|
+
});
|
|
53
|
+
var title = cva("mt-2 text-sm", {
|
|
54
|
+
variants: {
|
|
55
|
+
active: {
|
|
56
|
+
true: "text-blue-600 font-medium",
|
|
57
|
+
false: "text-gray-600"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: { active: false }
|
|
61
|
+
});
|
|
62
|
+
var subtitle = cva("text-xs mt-1", {
|
|
63
|
+
variants: {
|
|
64
|
+
color: {
|
|
65
|
+
default: "text-blue-500",
|
|
66
|
+
muted: "text-gray-500",
|
|
67
|
+
accent: "text-green-500"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: { color: "default" }
|
|
71
|
+
});
|
|
72
|
+
var buttonSteps = cva("px-4 py-2 bg-blue-600 text-white rounded");
|
|
73
|
+
|
|
74
|
+
// src/components/steps/Steps.tsx
|
|
75
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div><nav></nav><div>`);
|
|
76
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
|
|
77
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div><div></div><div>`);
|
|
78
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<button type=button class="px-4 py-2 border rounded">Back`);
|
|
79
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<button type=button>Next`);
|
|
80
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<button type=button class="px-4 py-2 bg-green-600 text-white rounded">Restart`);
|
|
81
|
+
var _tmpl$7 = /* @__PURE__ */ template(`<div><div class="flex justify-end gap-2 mt-6">`);
|
|
82
|
+
var Steps = (props) => {
|
|
83
|
+
const [local, variantProps, otherProps] = splitProps(props, ["steps", "animated", "initial", "value", "onStepChange", "className"], ["animated"]);
|
|
84
|
+
const isControlled = () => local.value !== void 0;
|
|
85
|
+
const [internalIndex, setInternalIndex] = createSignal(local.initial ?? 0);
|
|
86
|
+
const activeIndex = createMemo(() => isControlled() ? local.value : internalIndex());
|
|
87
|
+
const clamp = (i) => Math.max(0, Math.min(i, local.steps.length - 1));
|
|
88
|
+
const changeIndex = (i) => {
|
|
89
|
+
const idx = clamp(i);
|
|
90
|
+
if (isControlled()) local.onStepChange?.(idx);
|
|
91
|
+
else setInternalIndex(idx);
|
|
92
|
+
};
|
|
93
|
+
const next = () => changeIndex(activeIndex() + 1);
|
|
94
|
+
const back = () => changeIndex(activeIndex() - 1);
|
|
95
|
+
const isActive = (i) => i === activeIndex();
|
|
96
|
+
const isPast = (i) => i < activeIndex();
|
|
97
|
+
return (() => {
|
|
98
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
99
|
+
spread(_el$, mergeProps({
|
|
100
|
+
get ["class"]() {
|
|
101
|
+
return classes(stepsContainer({
|
|
102
|
+
animated: local.animated
|
|
103
|
+
}), local.className);
|
|
104
|
+
}
|
|
105
|
+
}, otherProps), false, true);
|
|
106
|
+
insert(_el$2, createComponent(For, {
|
|
107
|
+
get each() {
|
|
108
|
+
return local.steps;
|
|
109
|
+
},
|
|
110
|
+
children: (step, idx) => {
|
|
111
|
+
const i = idx();
|
|
112
|
+
return (() => {
|
|
113
|
+
var _el$4 = _tmpl$3(), _el$5 = _el$4.firstChild, _el$7 = _el$5.nextSibling;
|
|
114
|
+
_el$4.$$click = () => step.clickable && changeIndex(i);
|
|
115
|
+
insert(_el$5, () => step.marker ?? String(i + 1));
|
|
116
|
+
insert(_el$4, createComponent(Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return i < local.steps.length - 1;
|
|
119
|
+
},
|
|
120
|
+
get children() {
|
|
121
|
+
var _el$6 = _tmpl$2();
|
|
122
|
+
effect(() => className(_el$6, line({
|
|
123
|
+
active: isPast(i)
|
|
124
|
+
})));
|
|
125
|
+
return _el$6;
|
|
126
|
+
}
|
|
127
|
+
}), _el$7);
|
|
128
|
+
insert(_el$7, () => step.title);
|
|
129
|
+
insert(_el$4, createComponent(Show, {
|
|
130
|
+
get when() {
|
|
131
|
+
return step.subtitle;
|
|
132
|
+
},
|
|
133
|
+
get children() {
|
|
134
|
+
var _el$8 = _tmpl$2();
|
|
135
|
+
insert(_el$8, () => step.subtitle);
|
|
136
|
+
effect(() => className(_el$8, subtitle()));
|
|
137
|
+
return _el$8;
|
|
138
|
+
}
|
|
139
|
+
}), null);
|
|
140
|
+
effect((_p$) => {
|
|
141
|
+
var _v$ = navItem({
|
|
142
|
+
clickable: !!step.clickable
|
|
143
|
+
}), _v$2 = marker({
|
|
144
|
+
active: isActive(i) || isPast(i)
|
|
145
|
+
}), _v$3 = title({
|
|
146
|
+
active: isActive(i) || isPast(i)
|
|
147
|
+
});
|
|
148
|
+
_v$ !== _p$.e && className(_el$4, _p$.e = _v$);
|
|
149
|
+
_v$2 !== _p$.t && className(_el$5, _p$.t = _v$2);
|
|
150
|
+
_v$3 !== _p$.a && className(_el$7, _p$.a = _v$3);
|
|
151
|
+
return _p$;
|
|
152
|
+
}, {
|
|
153
|
+
e: void 0,
|
|
154
|
+
t: void 0,
|
|
155
|
+
a: void 0
|
|
156
|
+
});
|
|
157
|
+
return _el$4;
|
|
158
|
+
})();
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
insert(_el$3, createComponent(For, {
|
|
162
|
+
get each() {
|
|
163
|
+
return local.steps;
|
|
164
|
+
},
|
|
165
|
+
children: (step, idx) => {
|
|
166
|
+
const i = idx();
|
|
167
|
+
return createComponent(Show, {
|
|
168
|
+
get when() {
|
|
169
|
+
return isActive(i);
|
|
170
|
+
},
|
|
171
|
+
get children() {
|
|
172
|
+
var _el$9 = _tmpl$7(), _el$0 = _el$9.firstChild;
|
|
173
|
+
insert(_el$9, () => step.content, _el$0);
|
|
174
|
+
insert(_el$0, createComponent(Show, {
|
|
175
|
+
when: i > 0,
|
|
176
|
+
get children() {
|
|
177
|
+
var _el$1 = _tmpl$4();
|
|
178
|
+
_el$1.$$click = back;
|
|
179
|
+
return _el$1;
|
|
180
|
+
}
|
|
181
|
+
}), null);
|
|
182
|
+
insert(_el$0, createComponent(Show, {
|
|
183
|
+
get when() {
|
|
184
|
+
return i < local.steps.length - 1;
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
var _el$10 = _tmpl$5();
|
|
188
|
+
_el$10.$$click = next;
|
|
189
|
+
effect(() => className(_el$10, buttonSteps()));
|
|
190
|
+
return _el$10;
|
|
191
|
+
}
|
|
192
|
+
}), null);
|
|
193
|
+
insert(_el$0, createComponent(Show, {
|
|
194
|
+
get when() {
|
|
195
|
+
return i === local.steps.length - 1;
|
|
196
|
+
},
|
|
197
|
+
get children() {
|
|
198
|
+
var _el$11 = _tmpl$6();
|
|
199
|
+
_el$11.$$click = () => changeIndex(0);
|
|
200
|
+
return _el$11;
|
|
201
|
+
}
|
|
202
|
+
}), null);
|
|
203
|
+
return _el$9;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}));
|
|
208
|
+
effect(() => className(_el$2, navBar()));
|
|
209
|
+
return _el$;
|
|
210
|
+
})();
|
|
211
|
+
};
|
|
212
|
+
var Steps_default = Steps;
|
|
213
|
+
delegateEvents(["click"]);
|
|
214
|
+
|
|
215
|
+
// src/components/steps/index.ts
|
|
216
|
+
var steps_default = Steps_default;
|
|
217
|
+
|
|
218
|
+
export { steps_default };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/field/Field.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps
|
|
9
|
+
} from "solid-js";
|
|
10
|
+
|
|
11
|
+
// src/components/field/Field.styles.ts
|
|
12
|
+
var fieldWrapper = cva(
|
|
13
|
+
"flex flex-col space-y-1",
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
horizontal: {
|
|
17
|
+
true: "flex-row items-center space-x-2 space-y-0",
|
|
18
|
+
false: "flex-col"
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
sm: "text-sm",
|
|
22
|
+
md: "text-base",
|
|
23
|
+
lg: "text-lg"
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
default: "",
|
|
27
|
+
danger: "text-red-600"
|
|
28
|
+
},
|
|
29
|
+
grouped: {
|
|
30
|
+
true: "flex flex-wrap gap-2",
|
|
31
|
+
false: ""
|
|
32
|
+
},
|
|
33
|
+
groupMultiline: {
|
|
34
|
+
true: "flex-col",
|
|
35
|
+
false: "flex-row"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
compoundVariants: [
|
|
39
|
+
{ horizontal: true, grouped: true, class: "items-start" }
|
|
40
|
+
],
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
horizontal: false,
|
|
43
|
+
size: "md",
|
|
44
|
+
type: "default",
|
|
45
|
+
grouped: false,
|
|
46
|
+
groupMultiline: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
var labelStyles = cva("font-medium", {
|
|
51
|
+
variants: {
|
|
52
|
+
size: { sm: "text-sm", md: "text-base", lg: "text-lg" },
|
|
53
|
+
type: { default: "text-gray-800", danger: "text-red-600" }
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: { size: "md", type: "default" }
|
|
56
|
+
});
|
|
57
|
+
var messageStyles = cva("mt-1 text-sm", {
|
|
58
|
+
variants: {
|
|
59
|
+
type: { default: "text-gray-600", danger: "text-red-600" }
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: { type: "default" }
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// src/components/field/Field.tsx
|
|
65
|
+
var Field = (props) => {
|
|
66
|
+
const [local, variantProps, rest] = splitProps(
|
|
67
|
+
props,
|
|
68
|
+
["label", "message", "className", "children"],
|
|
69
|
+
["horizontal", "size", "type", "grouped", "groupMultiline"]
|
|
70
|
+
);
|
|
71
|
+
return <div class={classes(fieldWrapper(variantProps), local.className)} {...rest}>
|
|
72
|
+
{local.label && <label class={labelStyles(variantProps)}>
|
|
73
|
+
{local.label}
|
|
74
|
+
</label>}
|
|
75
|
+
|
|
76
|
+
{
|
|
77
|
+
/* CONTENT SLOT: now flex when horizontal */
|
|
78
|
+
}
|
|
79
|
+
<div class={classes(
|
|
80
|
+
variantProps.horizontal ? "flex items-center gap-2" : ""
|
|
81
|
+
)}>
|
|
82
|
+
{local.children}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{local.message && <span class={messageStyles(variantProps)}>
|
|
86
|
+
{local.message}
|
|
87
|
+
</span>}
|
|
88
|
+
</div>;
|
|
89
|
+
};
|
|
90
|
+
var Field_default = Field;
|
|
91
|
+
|
|
92
|
+
// src/components/field/index.ts
|
|
93
|
+
var field_default = Field_default;
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
field_default
|
|
97
|
+
};
|