@solidxai/core-ui 0.1.5-beta.10 → 0.1.5-beta.11
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/components/auth/SolidOTPVerify.d.ts +3 -0
- package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -0
- package/dist/components/auth/SolidOTPVerify.js +67 -0
- package/dist/components/auth/SolidOTPVerify.js.map +1 -0
- package/dist/components/auth/SolidOTPVerify.tsx +133 -0
- package/dist/components/common/AuthBanner.js.map +1 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +2 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +1 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.js +50 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +1 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +22 -15
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.tsx +14 -2
- package/dist/nextAuth/authProviders.d.ts +4 -0
- package/dist/nextAuth/authProviders.d.ts.map +1 -0
- package/dist/nextAuth/authProviders.js +198 -0
- package/dist/nextAuth/authProviders.js.map +1 -0
- package/dist/nextAuth/authProviders.tsx +232 -0
- package/dist/nextAuth/handleLogout.d.ts +2 -0
- package/dist/nextAuth/handleLogout.d.ts.map +1 -0
- package/dist/nextAuth/handleLogout.js +36 -0
- package/dist/nextAuth/handleLogout.js.map +1 -0
- package/dist/nextAuth/handleLogout.tsx +39 -0
- package/dist/nextAuth/refreshAccessToken.d.ts +2 -0
- package/dist/nextAuth/refreshAccessToken.d.ts.map +1 -0
- package/dist/nextAuth/refreshAccessToken.js +24 -0
- package/dist/nextAuth/refreshAccessToken.js.map +1 -0
- package/dist/nextAuth/refreshAccessToken.tsx +28 -0
- package/dist/redux/features/settingsSlice.d.ts +20 -0
- package/dist/redux/features/settingsSlice.d.ts.map +1 -0
- package/dist/redux/features/settingsSlice.js +39 -0
- package/dist/redux/features/settingsSlice.js.map +1 -0
- package/dist/redux/features/settingsSlice.ts +60 -0
- package/package.json +1 -1
- package/dist/components/auth/AuthTabs.d.ts +0 -14
- package/dist/components/auth/AuthTabs.d.ts.map +0 -1
- package/dist/components/auth/AuthTabs.js +0 -19
- package/dist/components/auth/AuthTabs.js.map +0 -1
- package/dist/components/auth/AuthTabs.tsx +0 -38
- package/dist/components/common/SolidErrorStatePage.d.ts +0 -12
- package/dist/components/common/SolidErrorStatePage.d.ts.map +0 -1
- package/dist/components/common/SolidErrorStatePage.js +0 -16
- package/dist/components/common/SolidErrorStatePage.js.map +0 -1
- package/dist/components/common/SolidErrorStatePage.tsx +0 -55
- package/dist/components/core/list/PLAN.md +0 -92
- package/dist/components/core/list/SolidDataTable.d.ts +0 -58
- package/dist/components/core/list/SolidDataTable.d.ts.map +0 -1
- package/dist/components/core/list/SolidDataTable.js +0 -141
- package/dist/components/core/list/SolidDataTable.js.map +0 -1
- package/dist/components/core/list/SolidDataTable.tsx +0 -314
- package/dist/components/core/list/SolidDataTablePagination.d.ts +0 -15
- package/dist/components/core/list/SolidDataTablePagination.d.ts.map +0 -1
- package/dist/components/core/list/SolidDataTablePagination.js +0 -22
- package/dist/components/core/list/SolidDataTablePagination.js.map +0 -1
- package/dist/components/core/list/SolidDataTablePagination.tsx +0 -71
- package/dist/components/layout/AdminTopHeader.d.ts +0 -2
- package/dist/components/layout/AdminTopHeader.d.ts.map +0 -1
- package/dist/components/layout/AdminTopHeader.js +0 -68
- package/dist/components/layout/AdminTopHeader.js.map +0 -1
- package/dist/components/layout/AdminTopHeader.tsx +0 -135
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts +0 -24
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.js +0 -224
- package/dist/components/shad-cn-ui/SolidAutocomplete.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.tsx +0 -339
- package/dist/components/shad-cn-ui/SolidButton.d.ts +0 -14
- package/dist/components/shad-cn-ui/SolidButton.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidButton.js +0 -36
- package/dist/components/shad-cn-ui/SolidButton.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidButton.tsx +0 -54
- package/dist/components/shad-cn-ui/SolidInput.d.ts +0 -5
- package/dist/components/shad-cn-ui/SolidInput.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidInput.js +0 -35
- package/dist/components/shad-cn-ui/SolidInput.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidInput.tsx +0 -12
- package/dist/components/shad-cn-ui/SolidNumberInput.d.ts +0 -10
- package/dist/components/shad-cn-ui/SolidNumberInput.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidNumberInput.js +0 -33
- package/dist/components/shad-cn-ui/SolidNumberInput.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidNumberInput.tsx +0 -24
- package/dist/components/shad-cn-ui/SolidSelect.d.ts +0 -16
- package/dist/components/shad-cn-ui/SolidSelect.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidSelect.js +0 -26
- package/dist/components/shad-cn-ui/SolidSelect.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidSelect.tsx +0 -65
- package/dist/components/shad-cn-ui/SolidTabs.d.ts +0 -18
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/SolidTabs.js +0 -22
- package/dist/components/shad-cn-ui/SolidTabs.js.map +0 -1
- package/dist/components/shad-cn-ui/SolidTabs.tsx +0 -73
- package/dist/components/shad-cn-ui/index.d.ts +0 -7
- package/dist/components/shad-cn-ui/index.d.ts.map +0 -1
- package/dist/components/shad-cn-ui/index.js +0 -7
- package/dist/components/shad-cn-ui/index.js.map +0 -1
- package/dist/components/shad-cn-ui/index.ts +0 -6
- package/dist/components/solid-ui/SolidButton.d.ts +0 -14
- package/dist/components/solid-ui/SolidButton.d.ts.map +0 -1
- package/dist/components/solid-ui/SolidButton.js +0 -36
- package/dist/components/solid-ui/SolidButton.js.map +0 -1
- package/dist/components/solid-ui/SolidButton.tsx +0 -54
- package/dist/components/solid-ui/SolidTabs.d.ts +0 -18
- package/dist/components/solid-ui/SolidTabs.d.ts.map +0 -1
- package/dist/components/solid-ui/SolidTabs.js +0 -22
- package/dist/components/solid-ui/SolidTabs.js.map +0 -1
- package/dist/components/solid-ui/SolidTabs.tsx +0 -73
- package/dist/components/solid-ui/index.d.ts +0 -3
- package/dist/components/solid-ui/index.d.ts.map +0 -1
- package/dist/components/solid-ui/index.js +0 -3
- package/dist/components/solid-ui/index.js.map +0 -1
- package/dist/components/solid-ui/index.ts +0 -2
- package/dist/resources/images/errors/error-astronaut-404.png +0 -0
- package/dist/resources/shadcn-base.css +0 -3200
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
type SolidAutocompleteProps = {
|
|
4
|
-
value?: any;
|
|
5
|
-
suggestions?: any[];
|
|
6
|
-
completeMethod?: (event: { query: string }) => void | Promise<void>;
|
|
7
|
-
onChange?: (event: { value: any }) => void;
|
|
8
|
-
onSelect?: (event: { value: any }) => void;
|
|
9
|
-
field?: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
className?: string;
|
|
12
|
-
inputClassName?: string;
|
|
13
|
-
dropdown?: boolean;
|
|
14
|
-
forceSelection?: boolean;
|
|
15
|
-
multiple?: boolean;
|
|
16
|
-
maxVisibleChips?: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function cx(...parts: Array<string | false | undefined>) {
|
|
20
|
-
return parts.filter(Boolean).join(" ");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getDisplayValue(value: any, field: string) {
|
|
24
|
-
if (value == null) return "";
|
|
25
|
-
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
26
|
-
if (typeof value === "object") {
|
|
27
|
-
const direct = value?.[field];
|
|
28
|
-
if (direct != null) return String(direct);
|
|
29
|
-
if (value?.label != null) return String(value.label);
|
|
30
|
-
}
|
|
31
|
-
return "";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function SolidAutocomplete({
|
|
35
|
-
value,
|
|
36
|
-
suggestions = [],
|
|
37
|
-
completeMethod,
|
|
38
|
-
onChange,
|
|
39
|
-
onSelect,
|
|
40
|
-
field = "label",
|
|
41
|
-
placeholder,
|
|
42
|
-
className,
|
|
43
|
-
inputClassName,
|
|
44
|
-
dropdown,
|
|
45
|
-
forceSelection,
|
|
46
|
-
multiple,
|
|
47
|
-
maxVisibleChips = 2,
|
|
48
|
-
}: SolidAutocompleteProps) {
|
|
49
|
-
const rootRef = useRef<HTMLDivElement | null>(null);
|
|
50
|
-
const completeTimerRef = useRef<number | null>(null);
|
|
51
|
-
const [open, setOpen] = useState(false);
|
|
52
|
-
const [manageOpen, setManageOpen] = useState(false);
|
|
53
|
-
const [query, setQuery] = useState("");
|
|
54
|
-
const [activeIndex, setActiveIndex] = useState(-1);
|
|
55
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (multiple) return;
|
|
59
|
-
if (!value || typeof value === "string") {
|
|
60
|
-
setQuery(typeof value === "string" ? value : "");
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
setQuery("");
|
|
64
|
-
}, [value, field, multiple]);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
return () => {
|
|
68
|
-
if (completeTimerRef.current) {
|
|
69
|
-
window.clearTimeout(completeTimerRef.current);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}, []);
|
|
73
|
-
|
|
74
|
-
const runCompleteMethod = (nextQuery: string, immediate = false) => {
|
|
75
|
-
if (!completeMethod) return;
|
|
76
|
-
if (completeTimerRef.current) {
|
|
77
|
-
window.clearTimeout(completeTimerRef.current);
|
|
78
|
-
completeTimerRef.current = null;
|
|
79
|
-
}
|
|
80
|
-
if (immediate) {
|
|
81
|
-
void completeMethod({ query: nextQuery });
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
completeTimerRef.current = window.setTimeout(() => {
|
|
85
|
-
void completeMethod({ query: nextQuery });
|
|
86
|
-
}, 140);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
function handleOutsideClick(event: MouseEvent) {
|
|
91
|
-
if (!rootRef.current) return;
|
|
92
|
-
if (!rootRef.current.contains(event.target as Node)) {
|
|
93
|
-
setOpen(false);
|
|
94
|
-
setManageOpen(false);
|
|
95
|
-
setIsFocused(false);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
document.addEventListener("mousedown", handleOutsideClick);
|
|
99
|
-
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
100
|
-
}, []);
|
|
101
|
-
|
|
102
|
-
const normalizedSuggestions = useMemo(
|
|
103
|
-
() =>
|
|
104
|
-
(suggestions || []).map((item) => ({
|
|
105
|
-
raw: item,
|
|
106
|
-
label: getDisplayValue(item, field),
|
|
107
|
-
})),
|
|
108
|
-
[suggestions, field]
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const selectedItems = useMemo(() => {
|
|
112
|
-
if (multiple) {
|
|
113
|
-
if (!Array.isArray(value)) return [];
|
|
114
|
-
return value.filter((item) => item !== null && item !== undefined && item !== "");
|
|
115
|
-
}
|
|
116
|
-
if (!value || typeof value === "string") return [];
|
|
117
|
-
return [value];
|
|
118
|
-
}, [multiple, value]);
|
|
119
|
-
|
|
120
|
-
const visibleSelectedItems = selectedItems.slice(0, maxVisibleChips);
|
|
121
|
-
const hiddenSelectedItems = selectedItems.slice(maxVisibleChips);
|
|
122
|
-
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (multiple && hiddenSelectedItems.length === 0 && manageOpen) {
|
|
125
|
-
setManageOpen(false);
|
|
126
|
-
}
|
|
127
|
-
}, [multiple, hiddenSelectedItems.length, manageOpen]);
|
|
128
|
-
|
|
129
|
-
const toItemKey = (item: any, index: number) => {
|
|
130
|
-
if (item && typeof item === "object") {
|
|
131
|
-
if (item.value !== undefined && item.value !== null) return String(item.value);
|
|
132
|
-
if (item.id !== undefined && item.id !== null) return String(item.id);
|
|
133
|
-
}
|
|
134
|
-
const label = getDisplayValue(item, field);
|
|
135
|
-
return label ? `${label}-${index}` : String(index);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const toComparableKey = (item: any) => {
|
|
139
|
-
if (item && typeof item === "object") {
|
|
140
|
-
if (item.value !== undefined && item.value !== null) return `value:${String(item.value)}`;
|
|
141
|
-
if (item.id !== undefined && item.id !== null) return `id:${String(item.id)}`;
|
|
142
|
-
}
|
|
143
|
-
return `label:${getDisplayValue(item, field)}`;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const removeSelectedAt = (index: number) => {
|
|
147
|
-
if (multiple) {
|
|
148
|
-
const existing = Array.isArray(value) ? [...value] : [];
|
|
149
|
-
existing.splice(index, 1);
|
|
150
|
-
onChange?.({ value: existing });
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
onChange?.({ value: null });
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const clearAllSelected = () => {
|
|
157
|
-
onChange?.({ value: multiple ? [] : null });
|
|
158
|
-
setManageOpen(false);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const commitSelection = (item: any) => {
|
|
162
|
-
if (multiple) {
|
|
163
|
-
const existing = Array.isArray(value) ? [...value] : [];
|
|
164
|
-
const exists = existing.some((entry) => toComparableKey(entry) === toComparableKey(item));
|
|
165
|
-
if (!exists) {
|
|
166
|
-
onChange?.({ value: [...existing, item] });
|
|
167
|
-
}
|
|
168
|
-
setQuery("");
|
|
169
|
-
setOpen(false);
|
|
170
|
-
setManageOpen(false);
|
|
171
|
-
setActiveIndex(-1);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
setQuery("");
|
|
175
|
-
onChange?.({ value: item });
|
|
176
|
-
onSelect?.({ value: item });
|
|
177
|
-
setOpen(false);
|
|
178
|
-
setManageOpen(false);
|
|
179
|
-
setActiveIndex(-1);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<div ref={rootRef} className={cx("solid-autocomplete", className)}>
|
|
184
|
-
<div className={cx("solid-autocomplete-control solid-autocomplete-chip-control", isFocused && "is-focused")}>
|
|
185
|
-
{visibleSelectedItems.map((item, index) => (
|
|
186
|
-
<span key={toItemKey(item, index)} className="solid-autocomplete-chip">
|
|
187
|
-
<span className="solid-autocomplete-chip-label">{getDisplayValue(item, field)}</span>
|
|
188
|
-
<button
|
|
189
|
-
type="button"
|
|
190
|
-
className="solid-autocomplete-chip-remove"
|
|
191
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
192
|
-
onClick={() => removeSelectedAt(index)}
|
|
193
|
-
aria-label="Remove selection"
|
|
194
|
-
>
|
|
195
|
-
<i className="pi pi-times" />
|
|
196
|
-
</button>
|
|
197
|
-
</span>
|
|
198
|
-
))}
|
|
199
|
-
{multiple && hiddenSelectedItems.length > 0 && (
|
|
200
|
-
<button
|
|
201
|
-
type="button"
|
|
202
|
-
className="solid-autocomplete-chip-manage"
|
|
203
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
204
|
-
onClick={() => {
|
|
205
|
-
setOpen(false);
|
|
206
|
-
setManageOpen((prev) => !prev);
|
|
207
|
-
}}
|
|
208
|
-
>
|
|
209
|
-
+{hiddenSelectedItems.length} more
|
|
210
|
-
</button>
|
|
211
|
-
)}
|
|
212
|
-
<input
|
|
213
|
-
className={cx("solid-input solid-autocomplete-input solid-autocomplete-inline-input", inputClassName)}
|
|
214
|
-
value={query}
|
|
215
|
-
placeholder={selectedItems.length > 0 ? "" : placeholder}
|
|
216
|
-
onFocus={() => {
|
|
217
|
-
setIsFocused(true);
|
|
218
|
-
setOpen(true);
|
|
219
|
-
setManageOpen(false);
|
|
220
|
-
runCompleteMethod(query, true);
|
|
221
|
-
}}
|
|
222
|
-
onChange={(event) => {
|
|
223
|
-
const next = event.target.value;
|
|
224
|
-
setQuery(next);
|
|
225
|
-
setOpen(true);
|
|
226
|
-
setManageOpen(false);
|
|
227
|
-
runCompleteMethod(next, false);
|
|
228
|
-
}}
|
|
229
|
-
onClick={() => {
|
|
230
|
-
setOpen(true);
|
|
231
|
-
setManageOpen(false);
|
|
232
|
-
}}
|
|
233
|
-
onBlur={() => {
|
|
234
|
-
setIsFocused(false);
|
|
235
|
-
if (!forceSelection) return;
|
|
236
|
-
const matched = normalizedSuggestions.find(
|
|
237
|
-
(item) => item.label.toLowerCase() === query.toLowerCase()
|
|
238
|
-
);
|
|
239
|
-
if (matched) {
|
|
240
|
-
onChange?.({ value: matched.raw });
|
|
241
|
-
setQuery("");
|
|
242
|
-
}
|
|
243
|
-
}}
|
|
244
|
-
onKeyDown={(event) => {
|
|
245
|
-
if (!open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
246
|
-
setOpen(true);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (!normalizedSuggestions.length) return;
|
|
250
|
-
if (event.key === "ArrowDown") {
|
|
251
|
-
event.preventDefault();
|
|
252
|
-
setActiveIndex((prev) => (prev + 1) % normalizedSuggestions.length);
|
|
253
|
-
}
|
|
254
|
-
if (event.key === "ArrowUp") {
|
|
255
|
-
event.preventDefault();
|
|
256
|
-
setActiveIndex((prev) =>
|
|
257
|
-
prev <= 0 ? normalizedSuggestions.length - 1 : prev - 1
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
if (event.key === "Enter" && activeIndex >= 0) {
|
|
261
|
-
event.preventDefault();
|
|
262
|
-
commitSelection(normalizedSuggestions[activeIndex].raw);
|
|
263
|
-
}
|
|
264
|
-
if (event.key === "Backspace" && !query && selectedItems.length > 0) {
|
|
265
|
-
event.preventDefault();
|
|
266
|
-
removeSelectedAt(selectedItems.length - 1);
|
|
267
|
-
}
|
|
268
|
-
}}
|
|
269
|
-
/>
|
|
270
|
-
{dropdown && (
|
|
271
|
-
<button
|
|
272
|
-
type="button"
|
|
273
|
-
className="solid-autocomplete-trigger"
|
|
274
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
275
|
-
onClick={() => {
|
|
276
|
-
const nextOpen = !open;
|
|
277
|
-
setOpen(nextOpen);
|
|
278
|
-
if (nextOpen) {
|
|
279
|
-
setManageOpen(false);
|
|
280
|
-
}
|
|
281
|
-
if (nextOpen) {
|
|
282
|
-
runCompleteMethod(query, true);
|
|
283
|
-
}
|
|
284
|
-
}}
|
|
285
|
-
aria-label="Toggle suggestions"
|
|
286
|
-
>
|
|
287
|
-
<i className={open ? "pi pi-chevron-up" : "pi pi-chevron-down"} />
|
|
288
|
-
</button>
|
|
289
|
-
)}
|
|
290
|
-
</div>
|
|
291
|
-
|
|
292
|
-
{multiple && manageOpen && selectedItems.length > 0 && (
|
|
293
|
-
<div className="solid-autocomplete-manager-panel">
|
|
294
|
-
<div className="solid-autocomplete-manager-header">
|
|
295
|
-
<div className="solid-autocomplete-manager-title">Selected ({selectedItems.length})</div>
|
|
296
|
-
<button type="button" className="solid-autocomplete-manager-clear" onClick={clearAllSelected}>
|
|
297
|
-
Clear all
|
|
298
|
-
</button>
|
|
299
|
-
</div>
|
|
300
|
-
<div className="solid-autocomplete-manager-body">
|
|
301
|
-
{selectedItems.map((item, index) => (
|
|
302
|
-
<span key={`managed-${toItemKey(item, index)}`} className="solid-autocomplete-chip">
|
|
303
|
-
<span className="solid-autocomplete-chip-label">{getDisplayValue(item, field)}</span>
|
|
304
|
-
<button
|
|
305
|
-
type="button"
|
|
306
|
-
className="solid-autocomplete-chip-remove"
|
|
307
|
-
onClick={() => removeSelectedAt(index)}
|
|
308
|
-
aria-label="Remove selection"
|
|
309
|
-
>
|
|
310
|
-
<i className="pi pi-times" />
|
|
311
|
-
</button>
|
|
312
|
-
</span>
|
|
313
|
-
))}
|
|
314
|
-
</div>
|
|
315
|
-
</div>
|
|
316
|
-
)}
|
|
317
|
-
|
|
318
|
-
{open && normalizedSuggestions.length > 0 && (
|
|
319
|
-
<div className="solid-autocomplete-panel" role="listbox">
|
|
320
|
-
{normalizedSuggestions.map((item, index) => (
|
|
321
|
-
<button
|
|
322
|
-
key={`${item.label}-${index}`}
|
|
323
|
-
type="button"
|
|
324
|
-
className={cx(
|
|
325
|
-
"solid-autocomplete-option",
|
|
326
|
-
activeIndex === index && "is-active"
|
|
327
|
-
)}
|
|
328
|
-
onMouseEnter={() => setActiveIndex(index)}
|
|
329
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
330
|
-
onClick={() => commitSelection(item.raw)}
|
|
331
|
-
>
|
|
332
|
-
{item.label}
|
|
333
|
-
</button>
|
|
334
|
-
))}
|
|
335
|
-
</div>
|
|
336
|
-
)}
|
|
337
|
-
</div>
|
|
338
|
-
);
|
|
339
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type SolidButtonVariant = "primary" | "secondary" | "ghost" | "outline" | "destructive";
|
|
3
|
-
type SolidButtonSize = "sm" | "md" | "lg";
|
|
4
|
-
type SolidButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
-
variant?: SolidButtonVariant;
|
|
6
|
-
size?: SolidButtonSize;
|
|
7
|
-
fullWidth?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
9
|
-
leftIcon?: React.ReactNode;
|
|
10
|
-
rightIcon?: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export declare function SolidButton({ variant, size, fullWidth, loading, leftIcon, rightIcon, className, disabled, children, type, ...props }: SolidButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=SolidButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidButton.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,kBAAkB,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AACxF,KAAK,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,KAAK,gBAAgB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACtE,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,OAAmB,EACnB,IAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAe,EACf,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAuBlB"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
function cx() {
|
|
25
|
-
var parts = [];
|
|
26
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
27
|
-
parts[_i] = arguments[_i];
|
|
28
|
-
}
|
|
29
|
-
return parts.filter(Boolean).join(" ");
|
|
30
|
-
}
|
|
31
|
-
export function SolidButton(_a) {
|
|
32
|
-
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, fullWidth = _a.fullWidth, loading = _a.loading, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, className = _a.className, disabled = _a.disabled, children = _a.children, _d = _a.type, type = _d === void 0 ? "button" : _d, props = __rest(_a, ["variant", "size", "fullWidth", "loading", "leftIcon", "rightIcon", "className", "disabled", "children", "type"]);
|
|
33
|
-
var isDisabled = disabled || loading;
|
|
34
|
-
return (_jsxs("button", __assign({ type: type, className: cx("solid-btn", "solid-btn--".concat(variant), "solid-btn--".concat(size), fullWidth && "solid-btn--full", loading && "is-loading", className), disabled: isDisabled }, props, { children: [loading && _jsx("span", { className: "solid-btn-spinner", "aria-hidden": "true" }), !loading && leftIcon ? _jsx("span", { className: "solid-btn-icon", children: leftIcon }) : null, _jsx("span", { className: "solid-btn-label", children: children }), !loading && rightIcon ? _jsx("span", { className: "solid-btn-icon", children: rightIcon }) : null] })));
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=SolidButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidButton.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,EAAE;IAAC,eAA2C;SAA3C,UAA2C,EAA3C,qBAA2C,EAA3C,IAA2C;QAA3C,0BAA2C;;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAYT;IAXjB,IAAA,eAAmB,EAAnB,OAAO,mBAAG,SAAS,KAAA,EACnB,YAAW,EAAX,IAAI,mBAAG,IAAI,KAAA,EACX,SAAS,eAAA,EACT,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,YAAe,EAAf,IAAI,mBAAG,QAAQ,KAAA,EACZ,KAAK,cAXkB,iHAY3B,CADS;IAER,IAAM,UAAU,GAAG,QAAQ,IAAI,OAAO,CAAC;IAEvC,OAAO,CACL,2BACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,WAAW,EACX,qBAAc,OAAO,CAAE,EACvB,qBAAc,IAAI,CAAE,EACpB,SAAS,IAAI,iBAAiB,EAC9B,OAAO,IAAI,YAAY,EACvB,SAAS,CACV,EACD,QAAQ,EAAE,UAAU,IAChB,KAAK,eAER,OAAO,IAAI,eAAM,SAAS,EAAC,mBAAmB,iBAAa,MAAM,GAAG,EACpE,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,YAAE,QAAQ,GAAQ,CAAC,CAAC,CAAC,IAAI,EACjF,eAAM,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAQ,EAClD,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,YAAE,SAAS,GAAQ,CAAC,CAAC,CAAC,IAAI,KAC5E,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from \"react\";\n\ntype SolidButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"outline\" | \"destructive\";\ntype SolidButtonSize = \"sm\" | \"md\" | \"lg\";\n\ntype SolidButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n variant?: SolidButtonVariant;\n size?: SolidButtonSize;\n fullWidth?: boolean;\n loading?: boolean;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n};\n\nfunction cx(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport function SolidButton({\n variant = \"primary\",\n size = \"md\",\n fullWidth,\n loading,\n leftIcon,\n rightIcon,\n className,\n disabled,\n children,\n type = \"button\",\n ...props\n}: SolidButtonProps) {\n const isDisabled = disabled || loading;\n\n return (\n <button\n type={type}\n className={cx(\n \"solid-btn\",\n `solid-btn--${variant}`,\n `solid-btn--${size}`,\n fullWidth && \"solid-btn--full\",\n loading && \"is-loading\",\n className\n )}\n disabled={isDisabled}\n {...props}\n >\n {loading && <span className=\"solid-btn-spinner\" aria-hidden=\"true\" />}\n {!loading && leftIcon ? <span className=\"solid-btn-icon\">{leftIcon}</span> : null}\n <span className=\"solid-btn-label\">{children}</span>\n {!loading && rightIcon ? <span className=\"solid-btn-icon\">{rightIcon}</span> : null}\n </button>\n );\n}\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
type SolidButtonVariant = "primary" | "secondary" | "ghost" | "outline" | "destructive";
|
|
4
|
-
type SolidButtonSize = "sm" | "md" | "lg";
|
|
5
|
-
|
|
6
|
-
type SolidButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
|
-
variant?: SolidButtonVariant;
|
|
8
|
-
size?: SolidButtonSize;
|
|
9
|
-
fullWidth?: boolean;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
leftIcon?: React.ReactNode;
|
|
12
|
-
rightIcon?: React.ReactNode;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function cx(...parts: Array<string | false | undefined>) {
|
|
16
|
-
return parts.filter(Boolean).join(" ");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function SolidButton({
|
|
20
|
-
variant = "primary",
|
|
21
|
-
size = "md",
|
|
22
|
-
fullWidth,
|
|
23
|
-
loading,
|
|
24
|
-
leftIcon,
|
|
25
|
-
rightIcon,
|
|
26
|
-
className,
|
|
27
|
-
disabled,
|
|
28
|
-
children,
|
|
29
|
-
type = "button",
|
|
30
|
-
...props
|
|
31
|
-
}: SolidButtonProps) {
|
|
32
|
-
const isDisabled = disabled || loading;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<button
|
|
36
|
-
type={type}
|
|
37
|
-
className={cx(
|
|
38
|
-
"solid-btn",
|
|
39
|
-
`solid-btn--${variant}`,
|
|
40
|
-
`solid-btn--${size}`,
|
|
41
|
-
fullWidth && "solid-btn--full",
|
|
42
|
-
loading && "is-loading",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
disabled={isDisabled}
|
|
46
|
-
{...props}
|
|
47
|
-
>
|
|
48
|
-
{loading && <span className="solid-btn-spinner" aria-hidden="true" />}
|
|
49
|
-
{!loading && leftIcon ? <span className="solid-btn-icon">{leftIcon}</span> : null}
|
|
50
|
-
<span className="solid-btn-label">{children}</span>
|
|
51
|
-
{!loading && rightIcon ? <span className="solid-btn-icon">{rightIcon}</span> : null}
|
|
52
|
-
</button>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type SolidInputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
3
|
-
export declare function SolidInput({ className, ...props }: SolidInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export {};
|
|
5
|
-
//# sourceMappingURL=SolidInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidInput.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,eAAe,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAMnE,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAElE"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
function cx() {
|
|
25
|
-
var parts = [];
|
|
26
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
27
|
-
parts[_i] = arguments[_i];
|
|
28
|
-
}
|
|
29
|
-
return parts.filter(Boolean).join(" ");
|
|
30
|
-
}
|
|
31
|
-
export function SolidInput(_a) {
|
|
32
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
33
|
-
return _jsx("input", __assign({ className: cx("solid-input", className) }, props));
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=SolidInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidInput.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,EAAE;IAAC,eAA2C;SAA3C,UAA2C,EAA3C,qBAA2C,EAA3C,IAA2C;QAA3C,0BAA2C;;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAwC;IAAtC,IAAA,SAAS,eAAA,EAAK,KAAK,cAArB,aAAuB,CAAF;IAC9C,OAAO,yBAAO,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,IAAM,KAAK,EAAI,CAAC;AACvE,CAAC","sourcesContent":["import React from \"react\";\n\ntype SolidInputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nfunction cx(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport function SolidInput({ className, ...props }: SolidInputProps) {\n return <input className={cx(\"solid-input\", className)} {...props} />;\n}\n\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
type SolidInputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
4
|
-
|
|
5
|
-
function cx(...parts: Array<string | false | undefined>) {
|
|
6
|
-
return parts.filter(Boolean).join(" ");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function SolidInput({ className, ...props }: SolidInputProps) {
|
|
10
|
-
return <input className={cx("solid-input", className)} {...props} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type SolidNumberInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> & {
|
|
3
|
-
value?: number | string | null;
|
|
4
|
-
onChange?: (event: {
|
|
5
|
-
value: number | null;
|
|
6
|
-
}) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function SolidNumberInput({ value, onChange, ...props }: SolidNumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=SolidNumberInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidNumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidNumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACrG,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,2CAcpF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { SolidInput } from "./SolidInput";
|
|
25
|
-
export function SolidNumberInput(_a) {
|
|
26
|
-
var value = _a.value, onChange = _a.onChange, props = __rest(_a, ["value", "onChange"]);
|
|
27
|
-
var normalizedValue = value !== null && value !== void 0 ? value : "";
|
|
28
|
-
return (_jsx(SolidInput, __assign({}, props, { type: "number", value: normalizedValue, onChange: function (event) {
|
|
29
|
-
var raw = event.target.value;
|
|
30
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({ value: raw === "" ? null : Number(raw) });
|
|
31
|
-
} })));
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=SolidNumberInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidNumberInput.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidNumberInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,MAAM,UAAU,gBAAgB,CAAC,EAAoD;IAAlD,IAAA,KAAK,WAAA,EAAE,QAAQ,cAAA,EAAK,KAAK,cAA3B,qBAA6B,CAAF;IAC1D,IAAM,eAAe,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;IAEpC,OAAO,CACL,KAAC,UAAU,eACL,KAAK,IACT,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,UAAC,KAAK;YACd,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAC/B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC,IACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from \"react\";\nimport { SolidInput } from \"./SolidInput\";\n\ntype SolidNumberInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"value\"> & {\n value?: number | string | null;\n onChange?: (event: { value: number | null }) => void;\n};\n\nexport function SolidNumberInput({ value, onChange, ...props }: SolidNumberInputProps) {\n const normalizedValue = value ?? \"\";\n\n return (\n <SolidInput\n {...props}\n type=\"number\"\n value={normalizedValue}\n onChange={(event) => {\n const raw = event.target.value;\n onChange?.({ value: raw === \"\" ? null : Number(raw) });\n }}\n />\n );\n}\n\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SolidInput } from "./SolidInput";
|
|
3
|
-
|
|
4
|
-
type SolidNumberInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> & {
|
|
5
|
-
value?: number | string | null;
|
|
6
|
-
onChange?: (event: { value: number | null }) => void;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function SolidNumberInput({ value, onChange, ...props }: SolidNumberInputProps) {
|
|
10
|
-
const normalizedValue = value ?? "";
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<SolidInput
|
|
14
|
-
{...props}
|
|
15
|
-
type="number"
|
|
16
|
-
value={normalizedValue}
|
|
17
|
-
onChange={(event) => {
|
|
18
|
-
const raw = event.target.value;
|
|
19
|
-
onChange?.({ value: raw === "" ? null : Number(raw) });
|
|
20
|
-
}}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type SolidSelectOption = Record<string, any>;
|
|
2
|
-
type SolidSelectProps = {
|
|
3
|
-
value?: any;
|
|
4
|
-
options?: SolidSelectOption[];
|
|
5
|
-
optionLabel?: string;
|
|
6
|
-
optionValue?: string;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
onChange?: (event: {
|
|
11
|
-
value: any;
|
|
12
|
-
}) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare function SolidSelect({ value, options, optionLabel, optionValue, placeholder, className, disabled, onChange, }: SolidSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=SolidSelect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidSelect.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidSelect.tsx"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE7C,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;CAC5C,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAY,EACZ,WAAqB,EACrB,WAAqB,EACrB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE,gBAAgB,2CAmClB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
function cx() {
|
|
3
|
-
var parts = [];
|
|
4
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5
|
-
parts[_i] = arguments[_i];
|
|
6
|
-
}
|
|
7
|
-
return parts.filter(Boolean).join(" ");
|
|
8
|
-
}
|
|
9
|
-
export function SolidSelect(_a) {
|
|
10
|
-
var value = _a.value, _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.optionLabel, optionLabel = _c === void 0 ? "label" : _c, _d = _a.optionValue, optionValue = _d === void 0 ? "value" : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, onChange = _a.onChange;
|
|
11
|
-
var normalized = options.map(function (option, index) {
|
|
12
|
-
var _a;
|
|
13
|
-
return ({
|
|
14
|
-
key: String(index),
|
|
15
|
-
label: (_a = option === null || option === void 0 ? void 0 : option[optionLabel]) !== null && _a !== void 0 ? _a : "",
|
|
16
|
-
value: option === null || option === void 0 ? void 0 : option[optionValue],
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
var selectedIndex = normalized.findIndex(function (item) { return item.value === value; });
|
|
20
|
-
var selectedKey = selectedIndex >= 0 ? normalized[selectedIndex].key : "";
|
|
21
|
-
return (_jsxs("div", { className: cx("solid-select-wrap", className), children: [_jsxs("select", { className: "solid-select", value: selectedKey, disabled: disabled, onChange: function (event) {
|
|
22
|
-
var next = normalized.find(function (item) { return item.key === event.target.value; });
|
|
23
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({ value: next === null || next === void 0 ? void 0 : next.value });
|
|
24
|
-
}, children: [_jsx("option", { value: "", disabled: true, children: placeholder || "Select" }), normalized.map(function (item) { return (_jsx("option", { value: item.key, children: item.label }, item.key)); })] }), _jsx("span", { className: "solid-select-icon", "aria-hidden": "true", children: _jsx("i", { className: "pi pi-chevron-down" }) })] }));
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=SolidSelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidSelect.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidSelect.tsx"],"names":[],"mappings":";AAeA,SAAS,EAAE;IAAC,eAA2C;SAA3C,UAA2C,EAA3C,qBAA2C,EAA3C,IAA2C;QAA3C,0BAA2C;;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAST;QARjB,KAAK,WAAA,EACL,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EACZ,mBAAqB,EAArB,WAAW,mBAAG,OAAO,KAAA,EACrB,mBAAqB,EAArB,WAAW,mBAAG,OAAO,KAAA,EACrB,WAAW,iBAAA,EACX,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,QAAQ,cAAA;IAER,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,KAAK;;QAAK,OAAA,CAAC;YACjD,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;YAClB,KAAK,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,WAAW,CAAC,mCAAI,EAAE;YAClC,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,WAAW,CAAC;SAC7B,CAAC,CAAA;KAAA,CAAC,CAAC;IAEJ,IAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,KAAK,KAAK,EAApB,CAAoB,CAAC,CAAC;IAC3E,IAAM,WAAW,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAE5E,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,aAChD,kBACE,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,UAAC,KAAK;oBACd,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,MAAM,CAAC,KAAK,EAA/B,CAA+B,CAAC,CAAC;oBACxE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,EAAE,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE,CAAC,CAAC;gBACrC,CAAC,aAED,iBAAQ,KAAK,EAAC,EAAE,EAAC,QAAQ,kBACtB,WAAW,IAAI,QAAQ,GACjB,EACR,UAAU,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CACxB,iBAAuB,KAAK,EAAE,IAAI,CAAC,GAAG,YACnC,IAAI,CAAC,KAAK,IADA,IAAI,CAAC,GAAG,CAEZ,CACV,EAJyB,CAIzB,CAAC,IACK,EACT,eAAM,SAAS,EAAC,mBAAmB,iBAAa,MAAM,YACpD,YAAG,SAAS,EAAC,oBAAoB,GAAG,GAC/B,IACH,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from \"react\";\n\ntype SolidSelectOption = Record<string, any>;\n\ntype SolidSelectProps = {\n value?: any;\n options?: SolidSelectOption[];\n optionLabel?: string;\n optionValue?: string;\n placeholder?: string;\n className?: string;\n disabled?: boolean;\n onChange?: (event: { value: any }) => void;\n};\n\nfunction cx(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport function SolidSelect({\n value,\n options = [],\n optionLabel = \"label\",\n optionValue = \"value\",\n placeholder,\n className,\n disabled,\n onChange,\n}: SolidSelectProps) {\n const normalized = options.map((option, index) => ({\n key: String(index),\n label: option?.[optionLabel] ?? \"\",\n value: option?.[optionValue],\n }));\n\n const selectedIndex = normalized.findIndex((item) => item.value === value);\n const selectedKey = selectedIndex >= 0 ? normalized[selectedIndex].key : \"\";\n\n return (\n <div className={cx(\"solid-select-wrap\", className)}>\n <select\n className=\"solid-select\"\n value={selectedKey}\n disabled={disabled}\n onChange={(event) => {\n const next = normalized.find((item) => item.key === event.target.value);\n onChange?.({ value: next?.value });\n }}\n >\n <option value=\"\" disabled>\n {placeholder || \"Select\"}\n </option>\n {normalized.map((item) => (\n <option key={item.key} value={item.key}>\n {item.label}\n </option>\n ))}\n </select>\n <span className=\"solid-select-icon\" aria-hidden=\"true\">\n <i className=\"pi pi-chevron-down\" />\n </span>\n </div>\n );\n}\n\n"]}
|