@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
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, memo, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/field/Field.styles.ts
|
|
6
|
+
var fieldWrapper = cva(
|
|
7
|
+
"flex flex-col space-y-1",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
horizontal: {
|
|
11
|
+
true: "flex-row items-center space-x-2 space-y-0",
|
|
12
|
+
false: "flex-col"
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
sm: "text-sm",
|
|
16
|
+
md: "text-base",
|
|
17
|
+
lg: "text-lg"
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
default: "",
|
|
21
|
+
danger: "text-red-600"
|
|
22
|
+
},
|
|
23
|
+
grouped: {
|
|
24
|
+
true: "flex flex-wrap gap-2",
|
|
25
|
+
false: ""
|
|
26
|
+
},
|
|
27
|
+
groupMultiline: {
|
|
28
|
+
true: "flex-col",
|
|
29
|
+
false: "flex-row"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
compoundVariants: [
|
|
33
|
+
{ horizontal: true, grouped: true, class: "items-start" }
|
|
34
|
+
],
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
horizontal: false,
|
|
37
|
+
size: "md",
|
|
38
|
+
type: "default",
|
|
39
|
+
grouped: false,
|
|
40
|
+
groupMultiline: false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var labelStyles = cva("font-medium", {
|
|
45
|
+
variants: {
|
|
46
|
+
size: { sm: "text-sm", md: "text-base", lg: "text-lg" },
|
|
47
|
+
type: { default: "text-gray-800", danger: "text-red-600" }
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: { size: "md", type: "default" }
|
|
50
|
+
});
|
|
51
|
+
var messageStyles = cva("mt-1 text-sm", {
|
|
52
|
+
variants: {
|
|
53
|
+
type: { default: "text-gray-600", danger: "text-red-600" }
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: { type: "default" }
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/components/field/Field.tsx
|
|
59
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div><div>`);
|
|
60
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<label>`);
|
|
61
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span>`);
|
|
62
|
+
var Field = (props) => {
|
|
63
|
+
const [local, variantProps, rest] = splitProps(props, ["label", "message", "className", "children"], ["horizontal", "size", "type", "grouped", "groupMultiline"]);
|
|
64
|
+
return (() => {
|
|
65
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
|
|
66
|
+
spread(_el$, mergeProps({
|
|
67
|
+
get ["class"]() {
|
|
68
|
+
return classes(fieldWrapper(variantProps), local.className);
|
|
69
|
+
}
|
|
70
|
+
}, rest), false, true);
|
|
71
|
+
insert(_el$, (() => {
|
|
72
|
+
var _c$ = memo(() => !!local.label);
|
|
73
|
+
return () => _c$() && (() => {
|
|
74
|
+
var _el$3 = _tmpl$2();
|
|
75
|
+
insert(_el$3, () => local.label);
|
|
76
|
+
effect(() => className(_el$3, labelStyles(variantProps)));
|
|
77
|
+
return _el$3;
|
|
78
|
+
})();
|
|
79
|
+
})(), _el$2);
|
|
80
|
+
insert(_el$2, () => local.children);
|
|
81
|
+
insert(_el$, (() => {
|
|
82
|
+
var _c$2 = memo(() => !!local.message);
|
|
83
|
+
return () => _c$2() && (() => {
|
|
84
|
+
var _el$4 = _tmpl$3();
|
|
85
|
+
insert(_el$4, () => local.message);
|
|
86
|
+
effect(() => className(_el$4, messageStyles(variantProps)));
|
|
87
|
+
return _el$4;
|
|
88
|
+
})();
|
|
89
|
+
})(), null);
|
|
90
|
+
effect(() => className(_el$2, classes(variantProps.horizontal ? "flex items-center gap-2" : "")));
|
|
91
|
+
return _el$;
|
|
92
|
+
})();
|
|
93
|
+
};
|
|
94
|
+
var Field_default = Field;
|
|
95
|
+
|
|
96
|
+
// src/components/field/index.ts
|
|
97
|
+
var field_default = Field_default;
|
|
98
|
+
|
|
99
|
+
export { field_default };
|
|
@@ -2,7 +2,7 @@ import { cva } from './HKS7ET6T.js';
|
|
|
2
2
|
import { template, insert, createComponent, spread, mergeProps as mergeProps$1, effect, className } from 'solid-js/web';
|
|
3
3
|
import { mergeProps, splitProps, createSignal, createEffect, untrack, createMemo, Show } from 'solid-js';
|
|
4
4
|
|
|
5
|
-
// src/components/
|
|
5
|
+
// src/components/avatar/Avatar.styles.ts
|
|
6
6
|
var avatarVariants = cva(
|
|
7
7
|
[
|
|
8
8
|
"flex items-center justify-center mx-1",
|
|
@@ -36,7 +36,7 @@ var avatarVariants = cva(
|
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
// src/components/
|
|
39
|
+
// src/components/avatar/utils.ts
|
|
40
40
|
function parseCaption(alt) {
|
|
41
41
|
if (!alt) return "";
|
|
42
42
|
const parts = alt.split(" ");
|
|
@@ -46,7 +46,7 @@ function parseCaption(alt) {
|
|
|
46
46
|
return "";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// src/components/
|
|
49
|
+
// src/components/avatar/Avatar.tsx
|
|
50
50
|
var _tmpl$ = /* @__PURE__ */ template(`<img class="size-full object-cover">`);
|
|
51
51
|
var _tmpl$2 = /* @__PURE__ */ template(`<figure>`);
|
|
52
52
|
var _tmpl$3 = /* @__PURE__ */ template(`<figcaption>`);
|
|
@@ -101,7 +101,7 @@ var Avatar = (rawProps) => {
|
|
|
101
101
|
};
|
|
102
102
|
var Avatar_default = Avatar;
|
|
103
103
|
|
|
104
|
-
// src/components/
|
|
105
|
-
var
|
|
104
|
+
// src/components/avatar/index.ts
|
|
105
|
+
var avatar_default = Avatar_default;
|
|
106
106
|
|
|
107
|
-
export {
|
|
107
|
+
export { avatar_default };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, className, insert, createComponent, effect, use } from 'solid-js/web';
|
|
3
|
+
import { createSignal, createEffect, onCleanup, Show, For } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/autocomplete/Autocomplete.styles.ts
|
|
6
|
+
var autocompleteWrapperClass = "relative w-full";
|
|
7
|
+
var inputBoxClass = cva(
|
|
8
|
+
"w-full rounded-md border border-gray-300 px-4 py-2 text-sm outline-none transition-colors",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
state: {
|
|
12
|
+
default: "bg-white text-gray-800 hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",
|
|
13
|
+
disabled: "bg-gray-100 text-gray-400 cursor-not-allowed"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
sm: "text-sm py-1 px-2",
|
|
17
|
+
md: "text-sm py-2 px-4",
|
|
18
|
+
lg: "text-base py-3 px-4"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
state: "default",
|
|
23
|
+
size: "md"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var dropdownMenuClass = cva(
|
|
28
|
+
"absolute left-0 right-0 z-10 mt-1 rounded-md border border-gray-200 bg-white shadow-md max-h-60 overflow-auto text-sm",
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
isOpen: {
|
|
32
|
+
true: "block",
|
|
33
|
+
false: "hidden"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
isOpen: true
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
var dropdownItemClass = cva(
|
|
42
|
+
"w-full text-left px-4 py-2 cursor-pointer transition-colors",
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
active: {
|
|
46
|
+
true: "bg-blue-500 text-white",
|
|
47
|
+
false: "hover:bg-gray-100 text-gray-800"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
active: false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
var dropdownEmptyClass = "px-4 py-2 text-sm text-gray-500";
|
|
56
|
+
var labelClass = "block text-sm font-medium text-gray-700 mb-1";
|
|
57
|
+
|
|
58
|
+
// src/components/autocomplete/Autocomplete.tsx
|
|
59
|
+
var _tmpl$ = /* @__PURE__ */ template(`<label>`);
|
|
60
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
|
|
61
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div><input type=text autocomplete=off>`);
|
|
62
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div>No data available`);
|
|
63
|
+
var Autocomplete = (props) => {
|
|
64
|
+
const [search, setSearch] = createSignal(props.value?.toString() || "");
|
|
65
|
+
const [isOpen, setIsOpen] = createSignal(false);
|
|
66
|
+
const [filtered, setFiltered] = createSignal(props.items);
|
|
67
|
+
const [highlightIndex, setHighlightIndex] = createSignal(-1);
|
|
68
|
+
let wrapperRef;
|
|
69
|
+
const filterItems = (val) => {
|
|
70
|
+
const lower = val.toLowerCase();
|
|
71
|
+
setFiltered(props.items.filter((item) => item.toString().toLowerCase().includes(lower)));
|
|
72
|
+
};
|
|
73
|
+
const handleInput = (e) => {
|
|
74
|
+
const val = e.target.value;
|
|
75
|
+
setSearch(val);
|
|
76
|
+
filterItems(val);
|
|
77
|
+
setIsOpen(true);
|
|
78
|
+
setHighlightIndex(-1);
|
|
79
|
+
};
|
|
80
|
+
const handleKeyDown = (e) => {
|
|
81
|
+
if (!isOpen()) return;
|
|
82
|
+
if (e.key === "ArrowDown") {
|
|
83
|
+
setHighlightIndex((prev) => Math.min(prev + 1, filtered().length - 1));
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
}
|
|
86
|
+
if (e.key === "ArrowUp") {
|
|
87
|
+
setHighlightIndex((prev) => Math.max(prev - 1, 0));
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
}
|
|
90
|
+
if (e.key === "Enter" && filtered()[highlightIndex()]) {
|
|
91
|
+
const selected = filtered()[highlightIndex()];
|
|
92
|
+
setSearch(selected?.toString() ?? "");
|
|
93
|
+
props.onChange?.(selected);
|
|
94
|
+
setIsOpen(false);
|
|
95
|
+
}
|
|
96
|
+
if (e.key === "Escape") {
|
|
97
|
+
setIsOpen(false);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handleSelect = (item) => {
|
|
101
|
+
setSearch(item.toString());
|
|
102
|
+
props.onChange?.(item);
|
|
103
|
+
setIsOpen(false);
|
|
104
|
+
};
|
|
105
|
+
const handleClickOutside = (e) => {
|
|
106
|
+
if (!wrapperRef?.contains(e.target)) {
|
|
107
|
+
setIsOpen(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
createEffect(() => {
|
|
111
|
+
if (props.value !== void 0) {
|
|
112
|
+
setSearch(props.value.toString());
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
createEffect(() => {
|
|
116
|
+
document.addEventListener("click", handleClickOutside);
|
|
117
|
+
onCleanup(() => {
|
|
118
|
+
document.removeEventListener("click", handleClickOutside);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
return (() => {
|
|
122
|
+
var _el$ = _tmpl$3(), _el$3 = _el$.firstChild;
|
|
123
|
+
var _ref$ = wrapperRef;
|
|
124
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : wrapperRef = _el$;
|
|
125
|
+
className(_el$, autocompleteWrapperClass);
|
|
126
|
+
insert(_el$, createComponent(Show, {
|
|
127
|
+
get when() {
|
|
128
|
+
return props.label;
|
|
129
|
+
},
|
|
130
|
+
get children() {
|
|
131
|
+
var _el$2 = _tmpl$();
|
|
132
|
+
className(_el$2, labelClass);
|
|
133
|
+
insert(_el$2, () => props.label);
|
|
134
|
+
return _el$2;
|
|
135
|
+
}
|
|
136
|
+
}), _el$3);
|
|
137
|
+
_el$3.addEventListener("focus", () => setIsOpen(true));
|
|
138
|
+
_el$3.$$keydown = handleKeyDown;
|
|
139
|
+
_el$3.$$input = handleInput;
|
|
140
|
+
insert(_el$, createComponent(Show, {
|
|
141
|
+
get when() {
|
|
142
|
+
return isOpen();
|
|
143
|
+
},
|
|
144
|
+
get children() {
|
|
145
|
+
var _el$4 = _tmpl$2();
|
|
146
|
+
insert(_el$4, createComponent(Show, {
|
|
147
|
+
get when() {
|
|
148
|
+
return filtered().length > 0;
|
|
149
|
+
},
|
|
150
|
+
get fallback() {
|
|
151
|
+
return (() => {
|
|
152
|
+
var _el$5 = _tmpl$4();
|
|
153
|
+
className(_el$5, dropdownEmptyClass);
|
|
154
|
+
return _el$5;
|
|
155
|
+
})();
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return createComponent(For, {
|
|
159
|
+
get each() {
|
|
160
|
+
return filtered();
|
|
161
|
+
},
|
|
162
|
+
children: (item, i) => (() => {
|
|
163
|
+
var _el$6 = _tmpl$2();
|
|
164
|
+
_el$6.$$mousedown = () => handleSelect(item);
|
|
165
|
+
insert(_el$6, item);
|
|
166
|
+
effect(() => className(_el$6, dropdownItemClass({
|
|
167
|
+
active: i() === highlightIndex()
|
|
168
|
+
})));
|
|
169
|
+
return _el$6;
|
|
170
|
+
})()
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
effect(() => className(_el$4, dropdownMenuClass()));
|
|
175
|
+
return _el$4;
|
|
176
|
+
}
|
|
177
|
+
}), null);
|
|
178
|
+
effect((_p$) => {
|
|
179
|
+
var _v$ = props.disabled, _v$2 = inputBoxClass({
|
|
180
|
+
size: props.size,
|
|
181
|
+
state: props.state ?? (props.disabled ? "disabled" : "default")
|
|
182
|
+
});
|
|
183
|
+
_v$ !== _p$.e && (_el$3.disabled = _p$.e = _v$);
|
|
184
|
+
_v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
|
|
185
|
+
return _p$;
|
|
186
|
+
}, {
|
|
187
|
+
e: void 0,
|
|
188
|
+
t: void 0
|
|
189
|
+
});
|
|
190
|
+
effect(() => _el$3.value = search());
|
|
191
|
+
return _el$;
|
|
192
|
+
})();
|
|
193
|
+
};
|
|
194
|
+
var Autocomplete_default = Autocomplete;
|
|
195
|
+
delegateEvents(["input", "keydown", "mousedown"]);
|
|
196
|
+
|
|
197
|
+
// src/components/autocomplete/index.ts
|
|
198
|
+
var autocomplete_default = Autocomplete_default;
|
|
199
|
+
|
|
200
|
+
export { autocomplete_default };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, Dynamic, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/navbar/Navbar.styles.ts
|
|
6
|
+
var navbarStyles = cva("flex items-center px-4", {
|
|
7
|
+
variants: {
|
|
8
|
+
color: {
|
|
9
|
+
info: "bg-blue-500 text-white",
|
|
10
|
+
primary: "bg-indigo-600 text-white",
|
|
11
|
+
success: "bg-green-500 text-white",
|
|
12
|
+
light: "bg-white text-gray-800"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
color: "info"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var navbarItemStyles = cva(
|
|
20
|
+
"px-3 py-2 rounded transition-colors",
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
active: {
|
|
24
|
+
true: "font-semibold border-b-2 border-current",
|
|
25
|
+
false: "hover:bg-gray-200"
|
|
26
|
+
},
|
|
27
|
+
tag: {
|
|
28
|
+
div: "",
|
|
29
|
+
a: ""
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
active: false,
|
|
34
|
+
tag: "div"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
var navbarDropdownStyles = cva("relative", {
|
|
39
|
+
variants: {
|
|
40
|
+
hoverable: {
|
|
41
|
+
true: "group",
|
|
42
|
+
false: ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
hoverable: false
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var dropdownMenuStyles = cva(
|
|
50
|
+
"absolute mt-2 bg-white text-gray-800 rounded shadow-lg hidden group-hover:block",
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
align: {
|
|
54
|
+
left: "left-0",
|
|
55
|
+
right: "right-0"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
align: "left"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
cva("", {
|
|
64
|
+
variants: {
|
|
65
|
+
rounded: {
|
|
66
|
+
true: "rounded-full",
|
|
67
|
+
false: ""
|
|
68
|
+
},
|
|
69
|
+
size: {
|
|
70
|
+
sm: "w-6 h-6",
|
|
71
|
+
md: "w-8 h-8",
|
|
72
|
+
lg: "w-12 h-12"
|
|
73
|
+
},
|
|
74
|
+
bordered: {
|
|
75
|
+
true: "border border-gray-200",
|
|
76
|
+
false: ""
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
rounded: false,
|
|
81
|
+
size: "md",
|
|
82
|
+
bordered: false
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// src/components/navbar/Navbar.tsx
|
|
87
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div class="flex-shrink-0 mr-4">`);
|
|
88
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div class="flex-1 flex items-center space-x-2">`);
|
|
89
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div class="flex-1 flex justify-end space-x-2">`);
|
|
90
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<nav>`);
|
|
91
|
+
var Navbar = (props) => {
|
|
92
|
+
const [local, variantProps, other] = splitProps(props, ["class", "className", "brand", "start", "end"], Object.keys(navbarStyles.variantKeys ?? {}));
|
|
93
|
+
return (() => {
|
|
94
|
+
var _el$ = _tmpl$4();
|
|
95
|
+
spread(_el$, mergeProps({
|
|
96
|
+
get ["class"]() {
|
|
97
|
+
return classes(navbarStyles({
|
|
98
|
+
color: variantProps.color
|
|
99
|
+
}), local.class, local.className);
|
|
100
|
+
}
|
|
101
|
+
}, other), false, true);
|
|
102
|
+
insert(_el$, createComponent(Show, {
|
|
103
|
+
get when() {
|
|
104
|
+
return local.brand;
|
|
105
|
+
},
|
|
106
|
+
get children() {
|
|
107
|
+
var _el$2 = _tmpl$();
|
|
108
|
+
insert(_el$2, () => local.brand);
|
|
109
|
+
return _el$2;
|
|
110
|
+
}
|
|
111
|
+
}), null);
|
|
112
|
+
insert(_el$, createComponent(Show, {
|
|
113
|
+
get when() {
|
|
114
|
+
return local.start;
|
|
115
|
+
},
|
|
116
|
+
get children() {
|
|
117
|
+
var _el$3 = _tmpl$2();
|
|
118
|
+
insert(_el$3, () => local.start);
|
|
119
|
+
return _el$3;
|
|
120
|
+
}
|
|
121
|
+
}), null);
|
|
122
|
+
insert(_el$, createComponent(Show, {
|
|
123
|
+
get when() {
|
|
124
|
+
return local.end;
|
|
125
|
+
},
|
|
126
|
+
get children() {
|
|
127
|
+
var _el$4 = _tmpl$3();
|
|
128
|
+
insert(_el$4, () => local.end);
|
|
129
|
+
return _el$4;
|
|
130
|
+
}
|
|
131
|
+
}), null);
|
|
132
|
+
return _el$;
|
|
133
|
+
})();
|
|
134
|
+
};
|
|
135
|
+
var Navbar_default = Navbar;
|
|
136
|
+
var NavbarItem = (props) => {
|
|
137
|
+
const [local, variantProps, other] = splitProps(props, ["class", "className", "active", "href", "tag", "to", "children"], Object.keys(navbarItemStyles.variantKeys ?? {}));
|
|
138
|
+
const Tag = local.tag === "a" || local.href || local.to ? "a" : "div";
|
|
139
|
+
return createComponent(Dynamic, mergeProps({
|
|
140
|
+
component: Tag,
|
|
141
|
+
get ["class"]() {
|
|
142
|
+
return classes(navbarItemStyles({
|
|
143
|
+
active: !!local.active,
|
|
144
|
+
tag: local.tag ?? (Tag === "a" ? "a" : "div")
|
|
145
|
+
}), local.class, local.className);
|
|
146
|
+
},
|
|
147
|
+
get href() {
|
|
148
|
+
return local.href ?? local.to;
|
|
149
|
+
}
|
|
150
|
+
}, other, {
|
|
151
|
+
get children() {
|
|
152
|
+
return local.children;
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
};
|
|
156
|
+
var NavbarItem_default = NavbarItem;
|
|
157
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<div>`);
|
|
158
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<div><div class=cursor-pointer>`);
|
|
159
|
+
var NavbarDropdown = (props) => {
|
|
160
|
+
const [local, variantProps, other] = splitProps(props, ["class", "className", "label", "hoverable", "children"], [...Object.keys(navbarDropdownStyles.variantKeys ?? {}), ...Object.keys(dropdownMenuStyles.variantKeys ?? {})]);
|
|
161
|
+
return (() => {
|
|
162
|
+
var _el$ = _tmpl$22(), _el$2 = _el$.firstChild;
|
|
163
|
+
spread(_el$, mergeProps({
|
|
164
|
+
get ["class"]() {
|
|
165
|
+
return classes(navbarDropdownStyles({
|
|
166
|
+
hoverable: !!local.hoverable
|
|
167
|
+
}), local.class, local.className);
|
|
168
|
+
}
|
|
169
|
+
}, other), false, true);
|
|
170
|
+
insert(_el$2, () => local.label);
|
|
171
|
+
insert(_el$, createComponent(Show, {
|
|
172
|
+
get when() {
|
|
173
|
+
return local.hoverable;
|
|
174
|
+
},
|
|
175
|
+
get children() {
|
|
176
|
+
var _el$3 = _tmpl$5();
|
|
177
|
+
insert(_el$3, () => local.children);
|
|
178
|
+
effect(() => className(_el$3, dropdownMenuStyles({
|
|
179
|
+
align: variantProps.align
|
|
180
|
+
})));
|
|
181
|
+
return _el$3;
|
|
182
|
+
}
|
|
183
|
+
}), null);
|
|
184
|
+
return _el$;
|
|
185
|
+
})();
|
|
186
|
+
};
|
|
187
|
+
var NavbarDropdown_default = NavbarDropdown;
|
|
188
|
+
|
|
189
|
+
export { NavbarDropdown_default, NavbarItem_default, Navbar_default };
|