@unifiedsoftware/react-ui 1.0.18 → 1.0.20
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/index.d.mts +299 -204
- package/dist/index.d.ts +299 -204
- package/dist/index.js +2180 -1375
- package/dist/index.mjs +2209 -1421
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -29,121 +29,365 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
32
52
|
|
|
33
|
-
// src/components/
|
|
34
|
-
import
|
|
35
|
-
import { forwardRef as forwardRef3, useRef as useRef2 } from "react";
|
|
36
|
-
import { mergeRefs } from "react-merge-refs";
|
|
53
|
+
// src/components/Autocomplete/Autocomplete.tsx
|
|
54
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState10 } from "react";
|
|
37
55
|
|
|
38
56
|
// src/constants/index.ts
|
|
39
57
|
var PREFIX_CLS = "us-";
|
|
40
58
|
|
|
41
|
-
// src/
|
|
42
|
-
import {
|
|
43
|
-
import { Portal as ReactPortal } from "react-portal";
|
|
44
|
-
import { jsx } from "react/jsx-runtime";
|
|
45
|
-
var Portal = forwardRef(({ children }, ref) => {
|
|
46
|
-
const portalRef = useRef(null);
|
|
47
|
-
return /* @__PURE__ */ jsx(ReactPortal, { ref: portalRef, node: document.body, children: /* @__PURE__ */ jsx("div", { className: `${PREFIX_CLS}potal`, children }) });
|
|
48
|
-
});
|
|
49
|
-
var Portal_default = Portal;
|
|
59
|
+
// src/hooks/useLocalStorage.tsx
|
|
60
|
+
import { useCallback, useEffect as useEffect2, useState } from "react";
|
|
50
61
|
|
|
51
|
-
// src/
|
|
52
|
-
import
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
import {
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
children
|
|
62
|
+
// src/hooks/useEventListener.tsx
|
|
63
|
+
import { useRef } from "react";
|
|
64
|
+
|
|
65
|
+
// src/hooks/useIsomorphicLayoutEffect.tsx
|
|
66
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
67
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
68
|
+
var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
|
|
69
|
+
|
|
70
|
+
// src/hooks/useEventListener.tsx
|
|
71
|
+
function useEventListener(handler) {
|
|
72
|
+
const savedHandler = useRef(handler);
|
|
73
|
+
useIsomorphicLayoutEffect_default(() => {
|
|
74
|
+
savedHandler.current = handler;
|
|
75
|
+
}, [handler]);
|
|
76
|
+
}
|
|
77
|
+
var useEventListener_default = useEventListener;
|
|
78
|
+
|
|
79
|
+
// src/hooks/useLocalStorage.tsx
|
|
80
|
+
function useLocalStorage(key, initialValue) {
|
|
81
|
+
const readValue = useCallback(() => {
|
|
82
|
+
if (typeof window === "undefined") {
|
|
83
|
+
return initialValue;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const item = window.localStorage.getItem(key);
|
|
87
|
+
return item ? parseJSON(item) : initialValue;
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
90
|
+
return initialValue;
|
|
81
91
|
}
|
|
92
|
+
}, [initialValue, key]);
|
|
93
|
+
const [storedValue, setStoredValue] = useState(readValue);
|
|
94
|
+
const setValue = useCallback(
|
|
95
|
+
(value) => {
|
|
96
|
+
if (typeof window == "undefined") {
|
|
97
|
+
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
101
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
102
|
+
setStoredValue(newValue);
|
|
103
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[key, storedValue]
|
|
82
109
|
);
|
|
83
|
-
|
|
84
|
-
|
|
110
|
+
useEffect2(() => {
|
|
111
|
+
setStoredValue(readValue());
|
|
112
|
+
}, []);
|
|
113
|
+
const handleStorageChange = useCallback(() => {
|
|
114
|
+
setStoredValue(readValue());
|
|
115
|
+
}, [readValue]);
|
|
116
|
+
useEventListener_default("storage", handleStorageChange);
|
|
117
|
+
useEventListener_default("local-storage", handleStorageChange);
|
|
118
|
+
return [storedValue, setValue];
|
|
119
|
+
}
|
|
120
|
+
function parseJSON(value) {
|
|
121
|
+
try {
|
|
122
|
+
return value === "undefined" ? void 0 : JSON.parse(value != null ? value : "");
|
|
123
|
+
} catch (e) {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
85
127
|
|
|
86
|
-
// src/
|
|
87
|
-
import {
|
|
88
|
-
var
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
128
|
+
// src/hooks/usePrevious.tsx
|
|
129
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
130
|
+
var usePrevious = (value) => {
|
|
131
|
+
const ref = useRef2();
|
|
132
|
+
useEffect3(() => {
|
|
133
|
+
ref.current = value;
|
|
134
|
+
});
|
|
135
|
+
return ref.current;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// src/hooks/useDisclosure.ts
|
|
139
|
+
import { useState as useState2 } from "react";
|
|
140
|
+
function useDisclosure({ defaultValue } = {}) {
|
|
141
|
+
const [isOpen, setIsOpen] = useState2(defaultValue || false);
|
|
142
|
+
const onOpen = () => {
|
|
143
|
+
setIsOpen(true);
|
|
144
|
+
};
|
|
145
|
+
const onClose = () => {
|
|
146
|
+
setIsOpen(false);
|
|
147
|
+
};
|
|
148
|
+
const onToggle = () => {
|
|
149
|
+
setIsOpen((prevState) => !prevState);
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
isOpen,
|
|
153
|
+
onOpen,
|
|
154
|
+
onClose,
|
|
155
|
+
onToggle
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var useDisclosure_default = useDisclosure;
|
|
159
|
+
|
|
160
|
+
// src/hooks/useOnClickOutside.tsx
|
|
161
|
+
import { useEffect as useEffect4 } from "react";
|
|
162
|
+
var useOnClickOutside = (ref, handler) => {
|
|
163
|
+
useEffect4(() => {
|
|
164
|
+
const listener = (event) => {
|
|
165
|
+
if (!ref.current || ref.current.contains(event.target)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
handler(event);
|
|
169
|
+
};
|
|
170
|
+
document.addEventListener("click", listener);
|
|
171
|
+
return () => {
|
|
172
|
+
document.removeEventListener("click", listener);
|
|
173
|
+
};
|
|
174
|
+
}, [ref, handler]);
|
|
175
|
+
};
|
|
176
|
+
var useOnClickOutside_default = useOnClickOutside;
|
|
177
|
+
|
|
178
|
+
// src/hooks/useStep.tsx
|
|
179
|
+
import { useCallback as useCallback2, useMemo, useState as useState3 } from "react";
|
|
180
|
+
var useStep = (maxStep) => {
|
|
181
|
+
const [currentStep, setCurrentStep] = useState3(1);
|
|
182
|
+
const canGoToNextStep = useMemo(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
183
|
+
const canGoToPrevStep = useMemo(() => currentStep - 1 >= 1, [currentStep]);
|
|
184
|
+
const setStep = useCallback2(
|
|
185
|
+
(step) => {
|
|
186
|
+
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
187
|
+
if (newStep >= 1 && newStep <= maxStep) {
|
|
188
|
+
setCurrentStep(newStep);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
throw new Error("Step not valid");
|
|
192
|
+
},
|
|
193
|
+
[maxStep, currentStep]
|
|
194
|
+
);
|
|
195
|
+
const goToNextStep = useCallback2(() => {
|
|
196
|
+
if (canGoToNextStep) {
|
|
197
|
+
setCurrentStep((step) => step + 1);
|
|
198
|
+
}
|
|
199
|
+
}, [canGoToNextStep]);
|
|
200
|
+
const goToPrevStep = useCallback2(() => {
|
|
201
|
+
if (canGoToPrevStep) {
|
|
202
|
+
setCurrentStep((step) => step - 1);
|
|
203
|
+
}
|
|
204
|
+
}, [canGoToPrevStep]);
|
|
205
|
+
const reset = useCallback2(() => {
|
|
206
|
+
setCurrentStep(1);
|
|
207
|
+
}, []);
|
|
208
|
+
return [
|
|
209
|
+
currentStep,
|
|
93
210
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
unmountOnExit: true,
|
|
101
|
-
children: /* @__PURE__ */ jsx3(Portal_default, { children: /* @__PURE__ */ jsxs(
|
|
102
|
-
"div",
|
|
103
|
-
__spreadProps(__spreadValues({
|
|
104
|
-
ref: mergeRefs([ref, nodeRef]),
|
|
105
|
-
className: clsx2(`${PREFIX_CLS}backdrop`, className),
|
|
106
|
-
tabIndex: -1
|
|
107
|
-
}, rest), {
|
|
108
|
-
children: [
|
|
109
|
-
/* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}backdrop__overlay`, onClick: onClose }),
|
|
110
|
-
children
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
) })
|
|
211
|
+
goToNextStep,
|
|
212
|
+
goToPrevStep,
|
|
213
|
+
canGoToNextStep,
|
|
214
|
+
canGoToPrevStep,
|
|
215
|
+
setStep,
|
|
216
|
+
reset
|
|
114
217
|
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
var Backdrop_default = Backdrop;
|
|
218
|
+
];
|
|
219
|
+
};
|
|
118
220
|
|
|
119
|
-
// src/
|
|
120
|
-
import
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
221
|
+
// src/hooks/useDebounce.ts
|
|
222
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
223
|
+
function useDebounce(value, delay) {
|
|
224
|
+
const [debouncedValue, setDebouncedValue] = useState4(value);
|
|
225
|
+
useEffect5(() => {
|
|
226
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
227
|
+
return () => {
|
|
228
|
+
clearTimeout(timer);
|
|
229
|
+
};
|
|
230
|
+
}, [value, delay]);
|
|
231
|
+
return debouncedValue;
|
|
232
|
+
}
|
|
233
|
+
var useDebounce_default = useDebounce;
|
|
234
|
+
|
|
235
|
+
// src/hooks/useVirtualizer/useVirtualizer.ts
|
|
236
|
+
import { useVirtualizer as useReactVirtualizer } from "@tanstack/react-virtual";
|
|
237
|
+
import { useEffect as useEffect6 } from "react";
|
|
238
|
+
function useVirtualizer(options) {
|
|
239
|
+
const {
|
|
240
|
+
parentRef,
|
|
241
|
+
total,
|
|
242
|
+
count = 0,
|
|
243
|
+
overscan = 5,
|
|
244
|
+
hasNextPage,
|
|
245
|
+
isFetchingNextPage,
|
|
246
|
+
onFetchNextPage,
|
|
247
|
+
estimateSize
|
|
248
|
+
} = options;
|
|
249
|
+
const virtualizer = useReactVirtualizer({
|
|
250
|
+
count: total ? total : hasNextPage ? count + 1 : count,
|
|
251
|
+
getScrollElement: () => parentRef.current,
|
|
252
|
+
estimateSize,
|
|
253
|
+
overscan
|
|
254
|
+
});
|
|
255
|
+
useEffect6(() => {
|
|
256
|
+
if (!onFetchNextPage)
|
|
257
|
+
return;
|
|
258
|
+
const [lastItem] = [...virtualizer.getVirtualItems()].reverse();
|
|
259
|
+
if (!lastItem) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (lastItem.index >= count - 1 && hasNextPage && !isFetchingNextPage) {
|
|
263
|
+
onFetchNextPage == null ? void 0 : onFetchNextPage();
|
|
264
|
+
}
|
|
265
|
+
}, [hasNextPage, onFetchNextPage, count, isFetchingNextPage, virtualizer.getVirtualItems()]);
|
|
266
|
+
return {
|
|
267
|
+
getVirtualItems: virtualizer.getVirtualItems,
|
|
268
|
+
getTotalSize: virtualizer.getTotalSize,
|
|
269
|
+
scrollToIndex: (index, options2) => {
|
|
270
|
+
virtualizer.scrollToIndex(index, options2);
|
|
271
|
+
},
|
|
272
|
+
scrollToOffset: (toOffset, options2) => {
|
|
273
|
+
virtualizer.scrollToOffset(toOffset, options2);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
var useVirtualizer_default = useVirtualizer;
|
|
278
|
+
|
|
279
|
+
// src/hooks/useInfiniteQuery/useInfiniteQuery.ts
|
|
280
|
+
import { useEffect as useEffect7, useState as useState5 } from "react";
|
|
281
|
+
|
|
282
|
+
// src/hooks/useInfiniteQuery/types.ts
|
|
283
|
+
var QueryStatus = /* @__PURE__ */ ((QueryStatus2) => {
|
|
284
|
+
QueryStatus2[QueryStatus2["IDLE"] = 0] = "IDLE";
|
|
285
|
+
QueryStatus2[QueryStatus2["LOADING"] = 1] = "LOADING";
|
|
286
|
+
QueryStatus2[QueryStatus2["SUCCESS"] = 2] = "SUCCESS";
|
|
287
|
+
QueryStatus2[QueryStatus2["ERROR"] = 3] = "ERROR";
|
|
288
|
+
return QueryStatus2;
|
|
289
|
+
})(QueryStatus || {});
|
|
290
|
+
|
|
291
|
+
// src/hooks/useInfiniteQuery/useInfiniteQuery.ts
|
|
292
|
+
function useInfiniteQuery(options, deps = []) {
|
|
293
|
+
const [status, setStatus] = useState5(0 /* IDLE */);
|
|
294
|
+
const [data, setData] = useState5({ pages: [] });
|
|
295
|
+
const [error, setError] = useState5();
|
|
296
|
+
const [hasNextPage, setHasNextPage] = useState5(true);
|
|
297
|
+
const [isFetchingNextPage, setIsFetchingNextPage] = useState5(false);
|
|
298
|
+
const fetchNextPage = () => __async(this, null, function* () {
|
|
299
|
+
try {
|
|
300
|
+
setStatus(1 /* LOADING */);
|
|
301
|
+
setError(void 0);
|
|
302
|
+
setIsFetchingNextPage(true);
|
|
303
|
+
const lastIndex = data.pages.length - 1;
|
|
304
|
+
const page = options.getNextPage(data.pages[lastIndex], data.pages);
|
|
305
|
+
const newPage = yield options.query({ page });
|
|
306
|
+
const newData = { pages: [...data.pages, newPage] };
|
|
307
|
+
setData(newData);
|
|
308
|
+
const newLastIndex = newData.pages.length - 1;
|
|
309
|
+
const nextPage = options.getNextPage(newData.pages[newLastIndex], newData.pages);
|
|
310
|
+
setHasNextPage(nextPage !== void 0);
|
|
311
|
+
setIsFetchingNextPage(false);
|
|
312
|
+
setStatus(2 /* SUCCESS */);
|
|
313
|
+
} catch (error2) {
|
|
314
|
+
setError(error2);
|
|
315
|
+
setStatus(3 /* ERROR */);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
useEffect7(() => {
|
|
319
|
+
const fetchData = () => __async(this, null, function* () {
|
|
320
|
+
try {
|
|
321
|
+
setStatus(1 /* LOADING */);
|
|
322
|
+
setError(void 0);
|
|
323
|
+
setIsFetchingNextPage(true);
|
|
324
|
+
const page = void 0;
|
|
325
|
+
const newPage = yield options.query({ page });
|
|
326
|
+
setData({ pages: [newPage] });
|
|
327
|
+
const nextPage = options.getNextPage(newPage, [newPage]);
|
|
328
|
+
setHasNextPage(nextPage !== void 0);
|
|
329
|
+
setIsFetchingNextPage(false);
|
|
330
|
+
setStatus(2 /* SUCCESS */);
|
|
331
|
+
} catch (error2) {
|
|
332
|
+
setError(error2);
|
|
333
|
+
setStatus(3 /* ERROR */);
|
|
132
334
|
}
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
};
|
|
136
|
-
|
|
335
|
+
});
|
|
336
|
+
fetchData();
|
|
337
|
+
}, deps);
|
|
338
|
+
return { status, data, error, hasNextPage, isFetchingNextPage, fetchNextPage };
|
|
339
|
+
}
|
|
340
|
+
var useInfiniteQuery_default = useInfiniteQuery;
|
|
137
341
|
|
|
138
|
-
// src/
|
|
139
|
-
import
|
|
140
|
-
|
|
342
|
+
// src/hooks/useElementSize/useElementSize.ts
|
|
343
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useRef as useRef3, useState as useState6 } from "react";
|
|
344
|
+
var defaultState = {
|
|
345
|
+
width: 0,
|
|
346
|
+
height: 0
|
|
347
|
+
};
|
|
348
|
+
function useElementSize(options) {
|
|
349
|
+
var _a;
|
|
350
|
+
const frameID = useRef3(0);
|
|
351
|
+
const [resize, setResize] = useState6(defaultState);
|
|
352
|
+
const observer = useMemo2(
|
|
353
|
+
() => typeof window !== "undefined" ? new ResizeObserver((entries) => {
|
|
354
|
+
const entry = entries[0];
|
|
355
|
+
if (entry) {
|
|
356
|
+
cancelAnimationFrame(frameID.current);
|
|
357
|
+
frameID.current = requestAnimationFrame(() => {
|
|
358
|
+
var _a2, _b, _c;
|
|
359
|
+
const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
|
|
360
|
+
if (target) {
|
|
361
|
+
(_c = options.callback) == null ? void 0 : _c.call(options, resize);
|
|
362
|
+
setResize({ width: entry.contentRect.width, height: entry.contentRect.height });
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}) : null,
|
|
367
|
+
[]
|
|
368
|
+
);
|
|
369
|
+
useEffect8(() => {
|
|
370
|
+
var _a2, _b;
|
|
371
|
+
const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
|
|
372
|
+
if (target) {
|
|
373
|
+
observer == null ? void 0 : observer.observe(target);
|
|
374
|
+
}
|
|
375
|
+
return () => {
|
|
376
|
+
observer == null ? void 0 : observer.disconnect();
|
|
377
|
+
if (frameID.current) {
|
|
378
|
+
cancelAnimationFrame(frameID.current);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}, [(_a = options.ref) == null ? void 0 : _a.current, options.target]);
|
|
382
|
+
return resize;
|
|
383
|
+
}
|
|
384
|
+
var useElementSize_default = useElementSize;
|
|
141
385
|
|
|
142
386
|
// src/icons/ChevronDownIcon.tsx
|
|
143
|
-
import { forwardRef
|
|
144
|
-
import { jsx
|
|
145
|
-
var ChevronDownIcon =
|
|
146
|
-
return /* @__PURE__ */
|
|
387
|
+
import { forwardRef } from "react";
|
|
388
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
389
|
+
var ChevronDownIcon = forwardRef((props, ref) => {
|
|
390
|
+
return /* @__PURE__ */ jsxs(
|
|
147
391
|
"svg",
|
|
148
392
|
__spreadProps(__spreadValues({
|
|
149
393
|
ref,
|
|
@@ -156,8 +400,8 @@ var ChevronDownIcon = forwardRef4((props, ref) => {
|
|
|
156
400
|
xmlns: "http://www.w3.org/2000/svg"
|
|
157
401
|
}, props), {
|
|
158
402
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ jsx("path", { fill: "none", d: "M0 0h24v24H0V0z" }),
|
|
404
|
+
/* @__PURE__ */ jsx("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" })
|
|
161
405
|
]
|
|
162
406
|
})
|
|
163
407
|
);
|
|
@@ -165,10 +409,10 @@ var ChevronDownIcon = forwardRef4((props, ref) => {
|
|
|
165
409
|
var ChevronDownIcon_default = ChevronDownIcon;
|
|
166
410
|
|
|
167
411
|
// src/icons/ChevronUpIcon.tsx
|
|
168
|
-
import { forwardRef as
|
|
169
|
-
import { jsx as
|
|
170
|
-
var ChevronUpIcon =
|
|
171
|
-
return /* @__PURE__ */
|
|
412
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
413
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
414
|
+
var ChevronUpIcon = forwardRef2((props, ref) => {
|
|
415
|
+
return /* @__PURE__ */ jsxs2(
|
|
172
416
|
"svg",
|
|
173
417
|
__spreadProps(__spreadValues({
|
|
174
418
|
ref,
|
|
@@ -181,8 +425,8 @@ var ChevronUpIcon = forwardRef5((props, ref) => {
|
|
|
181
425
|
xmlns: "http://www.w3.org/2000/svg"
|
|
182
426
|
}, props), {
|
|
183
427
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ jsx2("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
|
429
|
+
/* @__PURE__ */ jsx2("path", { d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" })
|
|
186
430
|
]
|
|
187
431
|
})
|
|
188
432
|
);
|
|
@@ -190,10 +434,10 @@ var ChevronUpIcon = forwardRef5((props, ref) => {
|
|
|
190
434
|
var ChevronUpIcon_default = ChevronUpIcon;
|
|
191
435
|
|
|
192
436
|
// src/icons/LoaderIcon.tsx
|
|
193
|
-
import { forwardRef as
|
|
194
|
-
import { jsx as
|
|
195
|
-
var LoaderIcon =
|
|
196
|
-
return /* @__PURE__ */
|
|
437
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
438
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
439
|
+
var LoaderIcon = forwardRef3((props, ref) => {
|
|
440
|
+
return /* @__PURE__ */ jsxs3(
|
|
197
441
|
"svg",
|
|
198
442
|
__spreadProps(__spreadValues({
|
|
199
443
|
ref,
|
|
@@ -208,93 +452,66 @@ var LoaderIcon = forwardRef6((props, ref) => {
|
|
|
208
452
|
xmlns: "http://www.w3.org/2000/svg"
|
|
209
453
|
}, props), {
|
|
210
454
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ jsx3("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
456
|
+
/* @__PURE__ */ jsx3("path", { d: "M12 3a9 9 0 1 0 9 9" })
|
|
213
457
|
]
|
|
214
458
|
})
|
|
215
459
|
);
|
|
216
460
|
});
|
|
217
461
|
var LoaderIcon_default = LoaderIcon;
|
|
218
462
|
|
|
219
|
-
// src/
|
|
220
|
-
import
|
|
221
|
-
import {
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
463
|
+
// src/icons/CloseIcon.tsx
|
|
464
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
465
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
466
|
+
var CloseIcon = forwardRef4((props, ref) => {
|
|
467
|
+
return /* @__PURE__ */ jsxs4(
|
|
468
|
+
"svg",
|
|
469
|
+
__spreadProps(__spreadValues({
|
|
470
|
+
ref,
|
|
471
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
472
|
+
width: "24",
|
|
473
|
+
height: "24",
|
|
474
|
+
viewBox: "0 0 24 24",
|
|
475
|
+
strokeWidth: "2",
|
|
476
|
+
stroke: "currentColor",
|
|
477
|
+
fill: "none",
|
|
478
|
+
strokeLinecap: "round",
|
|
479
|
+
strokeLinejoin: "round"
|
|
480
|
+
}, props), {
|
|
481
|
+
children: [
|
|
482
|
+
/* @__PURE__ */ jsx4("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
483
|
+
/* @__PURE__ */ jsx4("path", { d: "M18 6l-12 12" }),
|
|
484
|
+
/* @__PURE__ */ jsx4("path", { d: "M6 6l12 12" })
|
|
485
|
+
]
|
|
486
|
+
})
|
|
487
|
+
);
|
|
488
|
+
});
|
|
489
|
+
var CloseIcon_default = CloseIcon;
|
|
231
490
|
|
|
232
|
-
// src/
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
startContent,
|
|
246
|
-
endContent,
|
|
247
|
-
block,
|
|
248
|
-
loading,
|
|
249
|
-
disabled
|
|
250
|
-
} = _b, rest = __objRest(_b, [
|
|
251
|
-
"as",
|
|
252
|
-
"children",
|
|
253
|
-
"className",
|
|
254
|
-
"role",
|
|
255
|
-
"variant",
|
|
256
|
-
"color",
|
|
257
|
-
"size",
|
|
258
|
-
"iconOnly",
|
|
259
|
-
"startContent",
|
|
260
|
-
"endContent",
|
|
261
|
-
"block",
|
|
262
|
-
"loading",
|
|
263
|
-
"disabled"
|
|
264
|
-
]);
|
|
265
|
-
return /* @__PURE__ */ jsxs6(
|
|
266
|
-
Component,
|
|
267
|
-
__spreadProps(__spreadValues({
|
|
268
|
-
ref,
|
|
269
|
-
className: clsx5(
|
|
270
|
-
`${PREFIX_CLS}button`,
|
|
271
|
-
{
|
|
272
|
-
[`${PREFIX_CLS}button--${variant}`]: variant,
|
|
273
|
-
[`${PREFIX_CLS}button--${color}`]: color,
|
|
274
|
-
[`${PREFIX_CLS}button--${size}`]: size,
|
|
275
|
-
[`${PREFIX_CLS}button--block`]: block,
|
|
276
|
-
[`${PREFIX_CLS}button--icon-only`]: iconOnly,
|
|
277
|
-
[`${PREFIX_CLS}button--disabled`]: disabled
|
|
278
|
-
},
|
|
279
|
-
className
|
|
280
|
-
),
|
|
281
|
-
role,
|
|
282
|
-
disabled
|
|
283
|
-
}, rest), {
|
|
284
|
-
children: [
|
|
285
|
-
/* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}overlay` }),
|
|
286
|
-
/* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}outline` }),
|
|
287
|
-
loading ? /* @__PURE__ */ jsx8(Icon_default, { children: /* @__PURE__ */ jsx8(LoaderIcon_default, { className: `${PREFIX_CLS}animation-spin` }) }) : startContent,
|
|
288
|
-
/* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}button__content`, children }),
|
|
289
|
-
endContent
|
|
290
|
-
]
|
|
291
|
-
})
|
|
292
|
-
);
|
|
491
|
+
// src/utils/scroll.ts
|
|
492
|
+
var scrollToItem = (parentElement, currentElement) => {
|
|
493
|
+
const parentRect = parentElement.getBoundingClientRect();
|
|
494
|
+
const currentRect = currentElement.getBoundingClientRect();
|
|
495
|
+
const behavior = "smooth";
|
|
496
|
+
const previousElement = currentElement.previousSibling;
|
|
497
|
+
const previousRect = (previousElement == null ? void 0 : previousElement.getBoundingClientRect()) || currentRect;
|
|
498
|
+
if (parentRect.left > previousRect.left) {
|
|
499
|
+
let offset = 0;
|
|
500
|
+
if (previousElement) {
|
|
501
|
+
offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
|
|
502
|
+
}
|
|
503
|
+
parentElement.scrollTo({ behavior, left: offset });
|
|
293
504
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
505
|
+
const nextElement = currentElement.nextSibling;
|
|
506
|
+
const nextRect = (nextElement == null ? void 0 : nextElement.getBoundingClientRect()) || currentRect;
|
|
507
|
+
if (parentRect.right < nextRect.right) {
|
|
508
|
+
let offset = parentElement.scrollWidth;
|
|
509
|
+
if (nextElement) {
|
|
510
|
+
offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
|
|
511
|
+
}
|
|
512
|
+
parentElement.scrollTo({ behavior, left: offset });
|
|
513
|
+
}
|
|
514
|
+
};
|
|
298
515
|
|
|
299
516
|
// src/utils/clsx.ts
|
|
300
517
|
function toVal(mix) {
|
|
@@ -322,7 +539,7 @@ function toVal(mix) {
|
|
|
322
539
|
}
|
|
323
540
|
return str;
|
|
324
541
|
}
|
|
325
|
-
function
|
|
542
|
+
function clsx(...inputs) {
|
|
326
543
|
let i = 0, tmp, x, str = "";
|
|
327
544
|
while (i < inputs.length) {
|
|
328
545
|
if (tmp = inputs[i++]) {
|
|
@@ -334,130 +551,430 @@ function clsx6(...inputs) {
|
|
|
334
551
|
}
|
|
335
552
|
return str;
|
|
336
553
|
}
|
|
337
|
-
var clsx_default =
|
|
338
|
-
|
|
339
|
-
// src/utils/
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (parentRect.left > previousRect.left) {
|
|
347
|
-
let offset = 0;
|
|
348
|
-
if (previousElement) {
|
|
349
|
-
offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
|
|
350
|
-
}
|
|
351
|
-
parentElement.scrollTo({ behavior, left: offset });
|
|
554
|
+
var clsx_default = clsx;
|
|
555
|
+
|
|
556
|
+
// src/utils/mergeRefs.ts
|
|
557
|
+
function assignRef(ref, value) {
|
|
558
|
+
if (ref == null)
|
|
559
|
+
return;
|
|
560
|
+
if (typeof ref === "function") {
|
|
561
|
+
ref(value);
|
|
562
|
+
return;
|
|
352
563
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (nextElement) {
|
|
358
|
-
offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
|
|
359
|
-
}
|
|
360
|
-
parentElement.scrollTo({ behavior, left: offset });
|
|
564
|
+
try {
|
|
565
|
+
ref.current = value;
|
|
566
|
+
} catch (error) {
|
|
567
|
+
throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
|
|
361
568
|
}
|
|
362
|
-
}
|
|
569
|
+
}
|
|
570
|
+
function mergeRefs(...refs) {
|
|
571
|
+
return (node) => {
|
|
572
|
+
refs.forEach((ref) => {
|
|
573
|
+
assignRef(ref, node);
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
var mergeRefs_default = mergeRefs;
|
|
363
578
|
|
|
364
|
-
// src/components/
|
|
365
|
-
import
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
579
|
+
// src/components/Button/Button.tsx
|
|
580
|
+
import clsx3 from "clsx";
|
|
581
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
582
|
+
|
|
583
|
+
// src/components/Icon/Icon.tsx
|
|
584
|
+
import clsx2 from "clsx";
|
|
585
|
+
import { Children, cloneElement, forwardRef as forwardRef5 } from "react";
|
|
586
|
+
var Icon = forwardRef5(({ children, size }, ref) => {
|
|
587
|
+
const child = Children.only(children);
|
|
588
|
+
return cloneElement(child, __spreadProps(__spreadValues({
|
|
589
|
+
ref
|
|
590
|
+
}, child.props), {
|
|
591
|
+
className: clsx2(`${PREFIX_CLS}icon`, { [`${PREFIX_CLS}font-size-${size}`]: size }, child.props.className)
|
|
592
|
+
}));
|
|
370
593
|
});
|
|
371
|
-
var
|
|
594
|
+
var Icon_default = Icon;
|
|
372
595
|
|
|
373
|
-
// src/components/
|
|
374
|
-
import {
|
|
375
|
-
|
|
376
|
-
var CardHeader = forwardRef10(
|
|
596
|
+
// src/components/Button/Button.tsx
|
|
597
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
598
|
+
var Button = forwardRef6(
|
|
377
599
|
(_a, ref) => {
|
|
378
|
-
var _b = _a, {
|
|
600
|
+
var _b = _a, {
|
|
601
|
+
as: Component = "button",
|
|
602
|
+
children,
|
|
603
|
+
className,
|
|
604
|
+
role = "presentation",
|
|
605
|
+
variant = "text",
|
|
606
|
+
color = "primary",
|
|
607
|
+
size = "md",
|
|
608
|
+
iconOnly,
|
|
609
|
+
startContent,
|
|
610
|
+
endContent,
|
|
611
|
+
block,
|
|
612
|
+
loading,
|
|
613
|
+
disabled
|
|
614
|
+
} = _b, rest = __objRest(_b, [
|
|
615
|
+
"as",
|
|
616
|
+
"children",
|
|
617
|
+
"className",
|
|
618
|
+
"role",
|
|
619
|
+
"variant",
|
|
620
|
+
"color",
|
|
621
|
+
"size",
|
|
622
|
+
"iconOnly",
|
|
623
|
+
"startContent",
|
|
624
|
+
"endContent",
|
|
625
|
+
"block",
|
|
626
|
+
"loading",
|
|
627
|
+
"disabled"
|
|
628
|
+
]);
|
|
379
629
|
const prefixCls = PREFIX_CLS;
|
|
380
|
-
return /* @__PURE__ */
|
|
381
|
-
startContent && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
|
|
382
|
-
/* @__PURE__ */ jsxs7("div", { className: `${prefixCls}card-header__content`, children: [
|
|
383
|
-
/* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__title`, children: title }),
|
|
384
|
-
subtitle && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
|
|
385
|
-
] }),
|
|
386
|
-
endContent && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__end-content`, children: endContent })
|
|
387
|
-
] }));
|
|
388
|
-
}
|
|
389
|
-
);
|
|
390
|
-
var CardHeader_default = CardHeader;
|
|
391
|
-
|
|
392
|
-
// src/components/Chip/Chip.tsx
|
|
393
|
-
import clsx7 from "clsx";
|
|
394
|
-
import { forwardRef as forwardRef11 } from "react";
|
|
395
|
-
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
396
|
-
var Chip = forwardRef11(
|
|
397
|
-
(_a, ref) => {
|
|
398
|
-
var _b = _a, { as: Component = "div", children, className, variant, color, size } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
399
|
-
return /* @__PURE__ */ jsxs8(
|
|
630
|
+
return /* @__PURE__ */ jsxs5(
|
|
400
631
|
Component,
|
|
401
632
|
__spreadProps(__spreadValues({
|
|
402
633
|
ref,
|
|
403
|
-
className:
|
|
404
|
-
`${
|
|
634
|
+
className: clsx3(
|
|
635
|
+
`${prefixCls}button`,
|
|
405
636
|
{
|
|
406
|
-
[`${
|
|
407
|
-
[`${
|
|
408
|
-
[`${
|
|
637
|
+
[`${prefixCls}button--${variant}`]: variant,
|
|
638
|
+
[`${prefixCls}button--${color}`]: color,
|
|
639
|
+
[`${prefixCls}button--${size}`]: size,
|
|
640
|
+
[`${prefixCls}button--block`]: block,
|
|
641
|
+
[`${prefixCls}button--icon-only`]: iconOnly,
|
|
642
|
+
[`${prefixCls}button--disabled`]: disabled
|
|
409
643
|
},
|
|
410
644
|
className
|
|
411
|
-
)
|
|
645
|
+
),
|
|
646
|
+
role,
|
|
647
|
+
disabled
|
|
412
648
|
}, rest), {
|
|
413
649
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
children
|
|
650
|
+
/* @__PURE__ */ jsx5("div", { className: `${prefixCls}overlay` }),
|
|
651
|
+
/* @__PURE__ */ jsx5("div", { className: `${prefixCls}outline` }),
|
|
652
|
+
loading ? /* @__PURE__ */ jsx5(Icon_default, { children: /* @__PURE__ */ jsx5(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : startContent,
|
|
653
|
+
/* @__PURE__ */ jsx5("div", { className: `${prefixCls}button__content`, children }),
|
|
654
|
+
endContent
|
|
417
655
|
]
|
|
418
656
|
})
|
|
419
657
|
);
|
|
420
658
|
}
|
|
421
659
|
);
|
|
422
|
-
var Chip_default = Chip;
|
|
423
660
|
|
|
424
|
-
// src/components/
|
|
425
|
-
import { Children as Children2, useEffect, useRef as
|
|
661
|
+
// src/components/Popover/Popover.tsx
|
|
662
|
+
import { Children as Children2, cloneElement as cloneElement2, useEffect as useEffect9, useRef as useRef4, useState as useState7 } from "react";
|
|
426
663
|
|
|
427
|
-
// src/components/
|
|
664
|
+
// src/components/Portal/Portal.tsx
|
|
665
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
666
|
+
import { createPortal } from "react-dom";
|
|
667
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
668
|
+
var Portal = forwardRef7(({ children, container }, ref) => {
|
|
669
|
+
const prefixCls = PREFIX_CLS;
|
|
670
|
+
return createPortal(
|
|
671
|
+
/* @__PURE__ */ jsx6("div", { ref, className: `${prefixCls}portal`, children }),
|
|
672
|
+
container || document.body
|
|
673
|
+
);
|
|
674
|
+
});
|
|
675
|
+
var Portal_default = Portal;
|
|
676
|
+
|
|
677
|
+
// src/components/Transition/Transition.tsx
|
|
678
|
+
import clsx4 from "clsx";
|
|
679
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
680
|
+
import { CSSTransition } from "react-transition-group";
|
|
681
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
682
|
+
var Transition = forwardRef8((props, ref) => {
|
|
683
|
+
const {
|
|
684
|
+
children,
|
|
685
|
+
className,
|
|
686
|
+
nodeRef,
|
|
687
|
+
name,
|
|
688
|
+
isOpen,
|
|
689
|
+
enter = 0,
|
|
690
|
+
leave = 0,
|
|
691
|
+
mountOnEnter,
|
|
692
|
+
unmountOnExit,
|
|
693
|
+
onExited
|
|
694
|
+
} = props;
|
|
695
|
+
return /* @__PURE__ */ jsx7(
|
|
696
|
+
CSSTransition,
|
|
697
|
+
{
|
|
698
|
+
nodeRef,
|
|
699
|
+
in: isOpen,
|
|
700
|
+
appear: true,
|
|
701
|
+
timeout: { enter, exit: leave },
|
|
702
|
+
mountOnEnter,
|
|
703
|
+
unmountOnExit,
|
|
704
|
+
classNames: clsx4(name, className),
|
|
705
|
+
onExited,
|
|
706
|
+
children
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
});
|
|
710
|
+
var Transition_default = Transition;
|
|
711
|
+
|
|
712
|
+
// src/components/Popover/constans.ts
|
|
713
|
+
var POPOVER_TRANSITION_DURATION_LEAVE = 150;
|
|
714
|
+
|
|
715
|
+
// src/components/Popover/PopoverContext.tsx
|
|
428
716
|
import { createContext, useContext } from "react";
|
|
429
|
-
var
|
|
430
|
-
var
|
|
431
|
-
const context = useContext(
|
|
717
|
+
var PopoverContext = createContext(null);
|
|
718
|
+
var usePopover = () => {
|
|
719
|
+
const context = useContext(PopoverContext);
|
|
432
720
|
if (!context) {
|
|
433
|
-
throw new Error("`
|
|
721
|
+
throw new Error("`usePopover` must be used within a `<Popover />`");
|
|
434
722
|
}
|
|
435
723
|
return context;
|
|
436
724
|
};
|
|
437
|
-
var
|
|
725
|
+
var PopoverContext_default = PopoverContext;
|
|
438
726
|
|
|
439
|
-
// src/components/
|
|
440
|
-
import { jsxs as
|
|
441
|
-
var
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
727
|
+
// src/components/Popover/Popover.tsx
|
|
728
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
729
|
+
var Popover = (props) => {
|
|
730
|
+
const {
|
|
731
|
+
children,
|
|
732
|
+
target,
|
|
733
|
+
autoClose = true,
|
|
734
|
+
triggerClosable = true,
|
|
735
|
+
isOpen,
|
|
736
|
+
onOpen,
|
|
737
|
+
onClose,
|
|
738
|
+
onToggle,
|
|
739
|
+
onAfterClose
|
|
740
|
+
} = props;
|
|
741
|
+
const triggerRef = useRef4(null);
|
|
742
|
+
const contentRef = useRef4(null);
|
|
743
|
+
const [internalOpen, setInternalOpen] = useState7(props.isOpen || false);
|
|
445
744
|
const [trigger, content] = Children2.toArray(children);
|
|
745
|
+
const prefixCls = PREFIX_CLS;
|
|
446
746
|
const handleOpen = () => {
|
|
447
|
-
|
|
448
|
-
|
|
747
|
+
if (isOpen !== void 0) {
|
|
748
|
+
onOpen == null ? void 0 : onOpen();
|
|
749
|
+
} else {
|
|
750
|
+
setInternalOpen(true);
|
|
751
|
+
}
|
|
449
752
|
};
|
|
450
753
|
const handleClose = () => {
|
|
451
|
-
|
|
452
|
-
|
|
754
|
+
if (isOpen !== void 0) {
|
|
755
|
+
onClose == null ? void 0 : onClose();
|
|
756
|
+
} else {
|
|
757
|
+
setInternalOpen(false);
|
|
758
|
+
}
|
|
453
759
|
};
|
|
454
760
|
const handleToggle = () => {
|
|
455
|
-
setSelfIsOpen((prevState) => !prevState);
|
|
456
|
-
onToggle == null ? void 0 : onToggle();
|
|
457
|
-
};
|
|
458
|
-
useEffect(() => {
|
|
459
761
|
if (isOpen !== void 0) {
|
|
460
|
-
|
|
762
|
+
onToggle == null ? void 0 : onToggle();
|
|
763
|
+
} else {
|
|
764
|
+
setInternalOpen((prevState) => !prevState);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
useEffect9(() => {
|
|
768
|
+
setInternalOpen(isOpen || false);
|
|
769
|
+
}, [isOpen]);
|
|
770
|
+
return /* @__PURE__ */ jsxs6(
|
|
771
|
+
PopoverContext_default.Provider,
|
|
772
|
+
{
|
|
773
|
+
value: {
|
|
774
|
+
triggerRef,
|
|
775
|
+
contentRef,
|
|
776
|
+
target,
|
|
777
|
+
isOpen: internalOpen,
|
|
778
|
+
autoClose,
|
|
779
|
+
triggerClosable,
|
|
780
|
+
onOpen: handleOpen,
|
|
781
|
+
onClose: handleClose,
|
|
782
|
+
onToggle: handleToggle
|
|
783
|
+
},
|
|
784
|
+
children: [
|
|
785
|
+
trigger,
|
|
786
|
+
/* @__PURE__ */ jsx8(
|
|
787
|
+
Transition_default,
|
|
788
|
+
{
|
|
789
|
+
nodeRef: contentRef,
|
|
790
|
+
isOpen: internalOpen,
|
|
791
|
+
enter: 300,
|
|
792
|
+
leave: POPOVER_TRANSITION_DURATION_LEAVE,
|
|
793
|
+
name: `${prefixCls}popover`,
|
|
794
|
+
unmountOnExit: true,
|
|
795
|
+
onExited: onAfterClose,
|
|
796
|
+
children: /* @__PURE__ */ jsx8(Portal_default, { children: cloneElement2(Children2.only(content), __spreadProps(__spreadValues({}, content.props), {
|
|
797
|
+
ref: contentRef
|
|
798
|
+
})) })
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
]
|
|
802
|
+
}
|
|
803
|
+
);
|
|
804
|
+
};
|
|
805
|
+
var Popover_default = Popover;
|
|
806
|
+
|
|
807
|
+
// src/components/Popover/PopoverContent.tsx
|
|
808
|
+
import { forwardRef as forwardRef9, useCallback as useCallback3, useEffect as useEffect10, useRef as useRef5, useState as useState8 } from "react";
|
|
809
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
810
|
+
function getScrollParent(node) {
|
|
811
|
+
if (node == null) {
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
if (node.scrollHeight > node.clientHeight) {
|
|
815
|
+
return node;
|
|
816
|
+
} else {
|
|
817
|
+
return getScrollParent(node.parentNode);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
var PopoverContent = forwardRef9((props, ref) => {
|
|
821
|
+
const _a = props, { children, style, className, onClick } = _a, rest = __objRest(_a, ["children", "style", "className", "onClick"]);
|
|
822
|
+
const { triggerRef, contentRef, target, onClose } = usePopover();
|
|
823
|
+
const prefixCls = PREFIX_CLS;
|
|
824
|
+
const menuListRef = useRef5(null);
|
|
825
|
+
const [contentStyle, setContentStyle] = useState8({
|
|
826
|
+
position: "absolute",
|
|
827
|
+
top: 0,
|
|
828
|
+
left: 0,
|
|
829
|
+
visibility: "hidden"
|
|
830
|
+
});
|
|
831
|
+
const containerEl = getScrollParent(triggerRef.current) || window;
|
|
832
|
+
useElementSize_default({
|
|
833
|
+
target: containerEl,
|
|
834
|
+
callback: () => {
|
|
835
|
+
handleSize();
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
useOnClickOutside_default(contentRef, (event) => {
|
|
839
|
+
const el = triggerRef.current;
|
|
840
|
+
if (!el || el.contains(event.target))
|
|
841
|
+
return;
|
|
842
|
+
onClose();
|
|
843
|
+
});
|
|
844
|
+
const handleClick = (ev) => {
|
|
845
|
+
ev.stopPropagation();
|
|
846
|
+
onClick == null ? void 0 : onClick(ev);
|
|
847
|
+
};
|
|
848
|
+
const handleSize = useCallback3(() => {
|
|
849
|
+
var _a2, _b;
|
|
850
|
+
const popoverRect = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
851
|
+
const triggerClientRect = (_b = triggerRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
852
|
+
if (!popoverRect || !triggerClientRect || !containerEl) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const container = { innerWidth: window.innerWidth, innerHeight: window.innerHeight };
|
|
856
|
+
const triggerRect = {
|
|
857
|
+
width: triggerClientRect.width,
|
|
858
|
+
height: triggerClientRect.height,
|
|
859
|
+
top: triggerClientRect.top + window.scrollY,
|
|
860
|
+
bottom: triggerClientRect.top + triggerClientRect.height + window.scrollY,
|
|
861
|
+
left: triggerClientRect.left + window.scrollX,
|
|
862
|
+
right: triggerClientRect.left + triggerClientRect.width + window.scrollX
|
|
863
|
+
};
|
|
864
|
+
const outsideX = triggerRect.left + popoverRect.width > container.innerWidth;
|
|
865
|
+
const outsideY = triggerRect.top + popoverRect.height > container.innerHeight + window.scrollY;
|
|
866
|
+
const style2 = __spreadProps(__spreadValues({}, target && {
|
|
867
|
+
width: triggerRect.width,
|
|
868
|
+
minWidth: "auto"
|
|
869
|
+
}), {
|
|
870
|
+
position: "absolute",
|
|
871
|
+
top: outsideY ? void 0 : triggerRect.bottom,
|
|
872
|
+
bottom: outsideY ? container.innerHeight - triggerRect.top : void 0,
|
|
873
|
+
left: outsideX ? void 0 : triggerRect.left,
|
|
874
|
+
right: outsideX ? container.innerWidth - triggerRect.right : void 0,
|
|
875
|
+
visibility: void 0
|
|
876
|
+
});
|
|
877
|
+
setContentStyle(style2);
|
|
878
|
+
}, []);
|
|
879
|
+
useEffect10(() => {
|
|
880
|
+
handleSize();
|
|
881
|
+
containerEl.addEventListener("scroll", handleSize);
|
|
882
|
+
window.addEventListener("orientationchange", handleSize);
|
|
883
|
+
return () => {
|
|
884
|
+
containerEl.removeEventListener("scroll", handleSize);
|
|
885
|
+
window.removeEventListener("orientationchange", handleSize);
|
|
886
|
+
};
|
|
887
|
+
}, []);
|
|
888
|
+
return /* @__PURE__ */ jsxs7(
|
|
889
|
+
"div",
|
|
890
|
+
__spreadProps(__spreadValues({
|
|
891
|
+
ref: mergeRefs_default(menuListRef, ref),
|
|
892
|
+
className: clsx_default(`${prefixCls}popover`, className),
|
|
893
|
+
style: __spreadValues(__spreadValues({}, style), contentStyle),
|
|
894
|
+
onClick: handleClick
|
|
895
|
+
}, rest), {
|
|
896
|
+
children: [
|
|
897
|
+
/* @__PURE__ */ jsx9("div", { className: `${prefixCls}popover__overlay` }),
|
|
898
|
+
children
|
|
899
|
+
]
|
|
900
|
+
})
|
|
901
|
+
);
|
|
902
|
+
});
|
|
903
|
+
var PopoverContent_default = PopoverContent;
|
|
904
|
+
|
|
905
|
+
// src/components/Popover/PopoverTrigger.tsx
|
|
906
|
+
import { Children as Children3, cloneElement as cloneElement3, forwardRef as forwardRef10 } from "react";
|
|
907
|
+
var PopoverTrigger = forwardRef10((props, ref) => {
|
|
908
|
+
const _a = props, { children, onClick } = _a, rest = __objRest(_a, ["children", "onClick"]);
|
|
909
|
+
const { isOpen, triggerRef, triggerClosable, onOpen, onClose } = usePopover();
|
|
910
|
+
const child = Children3.only(typeof children === "function" ? children(isOpen) : children);
|
|
911
|
+
const handleClick = (ev) => {
|
|
912
|
+
var _a2, _b;
|
|
913
|
+
ev.preventDefault();
|
|
914
|
+
triggerClosable && isOpen ? onClose() : onOpen();
|
|
915
|
+
onClick == null ? void 0 : onClick(ev);
|
|
916
|
+
(_b = (_a2 = child.props).onClick) == null ? void 0 : _b.call(_a2, ev);
|
|
917
|
+
};
|
|
918
|
+
return cloneElement3(child, __spreadProps(__spreadValues(__spreadValues({}, child.props), rest), {
|
|
919
|
+
ref: mergeRefs_default(ref, triggerRef),
|
|
920
|
+
onClick: handleClick
|
|
921
|
+
}));
|
|
922
|
+
});
|
|
923
|
+
var PopoverTrigger_default = PopoverTrigger;
|
|
924
|
+
|
|
925
|
+
// src/components/Autocomplete/AutocompleteContent.tsx
|
|
926
|
+
import { Fragment as Fragment2, useEffect as useEffect12, useRef as useRef7 } from "react";
|
|
927
|
+
|
|
928
|
+
// src/components/List/List.tsx
|
|
929
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
930
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
931
|
+
var List = forwardRef11((_a, ref) => {
|
|
932
|
+
var _b = _a, { as: Component = "div", children } = _b, rest = __objRest(_b, ["as", "children"]);
|
|
933
|
+
const prefixCls = PREFIX_CLS;
|
|
934
|
+
return /* @__PURE__ */ jsx10(Component, __spreadProps(__spreadValues({ ref, className: `${prefixCls}list` }, rest), { children }));
|
|
935
|
+
});
|
|
936
|
+
var List_default = List;
|
|
937
|
+
|
|
938
|
+
// src/components/List/ListGroup.tsx
|
|
939
|
+
import { forwardRef as forwardRef15 } from "react";
|
|
940
|
+
|
|
941
|
+
// src/components/Collapse/Collapse.tsx
|
|
942
|
+
import { Children as Children4, useEffect as useEffect11, useRef as useRef6, useState as useState9 } from "react";
|
|
943
|
+
|
|
944
|
+
// src/components/Collapse/CollapseContext.tsx
|
|
945
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
946
|
+
var CollapseContext = createContext2(null);
|
|
947
|
+
var useCollapse = () => {
|
|
948
|
+
const context = useContext2(CollapseContext);
|
|
949
|
+
if (!context) {
|
|
950
|
+
throw new Error("`useCollapse` must be used within a `<Collapse />`");
|
|
951
|
+
}
|
|
952
|
+
return context;
|
|
953
|
+
};
|
|
954
|
+
var CollapseContext_default = CollapseContext;
|
|
955
|
+
|
|
956
|
+
// src/components/Collapse/Collapse.tsx
|
|
957
|
+
import { jsxs as jsxs8 } from "react/jsx-runtime";
|
|
958
|
+
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
959
|
+
const collapseRef = useRef6(null);
|
|
960
|
+
const [selfIsOpen, setSelfIsOpen] = useState9(isOpen != null ? isOpen : false);
|
|
961
|
+
const [heightAuto, setHeightAuto] = useState9(false);
|
|
962
|
+
const [trigger, content] = Children4.toArray(children);
|
|
963
|
+
const handleOpen = () => {
|
|
964
|
+
setSelfIsOpen(true);
|
|
965
|
+
onOpen == null ? void 0 : onOpen();
|
|
966
|
+
};
|
|
967
|
+
const handleClose = () => {
|
|
968
|
+
setSelfIsOpen(false);
|
|
969
|
+
onClose == null ? void 0 : onClose();
|
|
970
|
+
};
|
|
971
|
+
const handleToggle = () => {
|
|
972
|
+
setSelfIsOpen((prevState) => !prevState);
|
|
973
|
+
onToggle == null ? void 0 : onToggle();
|
|
974
|
+
};
|
|
975
|
+
useEffect11(() => {
|
|
976
|
+
if (isOpen !== void 0) {
|
|
977
|
+
setSelfIsOpen(isOpen);
|
|
461
978
|
}
|
|
462
979
|
setTimeout(() => {
|
|
463
980
|
if (isOpen) {
|
|
@@ -467,7 +984,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
467
984
|
}
|
|
468
985
|
}, 100);
|
|
469
986
|
}, [isOpen]);
|
|
470
|
-
return /* @__PURE__ */
|
|
987
|
+
return /* @__PURE__ */ jsxs8(
|
|
471
988
|
CollapseContext_default.Provider,
|
|
472
989
|
{
|
|
473
990
|
value: {
|
|
@@ -488,13 +1005,13 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
488
1005
|
var Collapse_default = Collapse;
|
|
489
1006
|
|
|
490
1007
|
// src/components/Collapse/CollapseContent.tsx
|
|
491
|
-
import
|
|
492
|
-
import { Children as
|
|
1008
|
+
import clsx5 from "clsx";
|
|
1009
|
+
import { Children as Children5, cloneElement as cloneElement4, forwardRef as forwardRef12 } from "react";
|
|
493
1010
|
var CollapseContent = forwardRef12(({ children }, ref) => {
|
|
494
1011
|
var _a, _b;
|
|
495
1012
|
const { collapseRef, isOpen, heightAuto } = useCollapse();
|
|
496
|
-
const child =
|
|
497
|
-
return
|
|
1013
|
+
const child = Children5.only(children);
|
|
1014
|
+
return cloneElement4(child, __spreadProps(__spreadValues({}, child.props), {
|
|
498
1015
|
ref: (node) => {
|
|
499
1016
|
collapseRef.current = node;
|
|
500
1017
|
if (ref !== null) {
|
|
@@ -504,18 +1021,18 @@ var CollapseContent = forwardRef12(({ children }, ref) => {
|
|
|
504
1021
|
style: __spreadProps(__spreadValues({}, child.props.style), {
|
|
505
1022
|
height: isOpen && heightAuto ? "auto" : isOpen ? (_a = collapseRef.current) == null ? void 0 : _a.scrollHeight : !isOpen && heightAuto ? (_b = collapseRef.current) == null ? void 0 : _b.scrollHeight : 0
|
|
506
1023
|
}),
|
|
507
|
-
className:
|
|
1024
|
+
className: clsx5(`${PREFIX_CLS}collapse`, child.props.className)
|
|
508
1025
|
}));
|
|
509
1026
|
});
|
|
510
1027
|
var CollapseContent_default = CollapseContent;
|
|
511
1028
|
|
|
512
1029
|
// src/components/Collapse/CollapseTrigger.tsx
|
|
513
|
-
import { Children as
|
|
1030
|
+
import { Children as Children6, cloneElement as cloneElement5, forwardRef as forwardRef13 } from "react";
|
|
514
1031
|
var CollapseTrigger = forwardRef13(({ children }, ref) => {
|
|
515
1032
|
const { collapseRef, onToggle } = useCollapse();
|
|
516
|
-
const child =
|
|
1033
|
+
const child = Children6.only(children);
|
|
517
1034
|
const _a = child.props, { onClick } = _a, rest = __objRest(_a, ["onClick"]);
|
|
518
|
-
return
|
|
1035
|
+
return cloneElement5(child, __spreadValues({
|
|
519
1036
|
ref,
|
|
520
1037
|
onClick: (event) => {
|
|
521
1038
|
if (!collapseRef.current) {
|
|
@@ -528,67 +1045,766 @@ var CollapseTrigger = forwardRef13(({ children }, ref) => {
|
|
|
528
1045
|
});
|
|
529
1046
|
var CollapseTrigger_default = CollapseTrigger;
|
|
530
1047
|
|
|
531
|
-
// src/components/
|
|
532
|
-
import
|
|
533
|
-
import {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
1048
|
+
// src/components/List/ListItem.tsx
|
|
1049
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
1050
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1051
|
+
var ListItem = forwardRef14(
|
|
1052
|
+
(_a, ref) => {
|
|
1053
|
+
var _b = _a, {
|
|
1054
|
+
as: Component = "div",
|
|
1055
|
+
className,
|
|
1056
|
+
title,
|
|
1057
|
+
subtitle,
|
|
1058
|
+
startContent,
|
|
1059
|
+
endContent,
|
|
1060
|
+
level = 1,
|
|
1061
|
+
hoverable,
|
|
1062
|
+
selected,
|
|
1063
|
+
disabled,
|
|
1064
|
+
slotProps,
|
|
1065
|
+
style,
|
|
1066
|
+
onClick
|
|
1067
|
+
} = _b, rest = __objRest(_b, [
|
|
1068
|
+
"as",
|
|
1069
|
+
"className",
|
|
1070
|
+
"title",
|
|
1071
|
+
"subtitle",
|
|
1072
|
+
"startContent",
|
|
1073
|
+
"endContent",
|
|
1074
|
+
"level",
|
|
1075
|
+
"hoverable",
|
|
1076
|
+
"selected",
|
|
1077
|
+
"disabled",
|
|
1078
|
+
"slotProps",
|
|
1079
|
+
"style",
|
|
1080
|
+
"onClick"
|
|
1081
|
+
]);
|
|
1082
|
+
var _a2, _b2;
|
|
1083
|
+
const prefixCls = PREFIX_CLS;
|
|
1084
|
+
const handleClick = (event) => {
|
|
1085
|
+
onClick == null ? void 0 : onClick(event);
|
|
1086
|
+
};
|
|
1087
|
+
return /* @__PURE__ */ jsxs9(
|
|
1088
|
+
Component,
|
|
1089
|
+
__spreadProps(__spreadValues({
|
|
1090
|
+
ref,
|
|
1091
|
+
className: clsx_default(
|
|
1092
|
+
`${prefixCls}list-item`,
|
|
1093
|
+
{
|
|
1094
|
+
[`${prefixCls}list-item--selected`]: selected,
|
|
1095
|
+
[`${prefixCls}list-item--hoverable`]: hoverable,
|
|
1096
|
+
[`${prefixCls}list-item--disabled`]: disabled
|
|
1097
|
+
},
|
|
1098
|
+
className
|
|
1099
|
+
),
|
|
1100
|
+
style: __spreadValues({
|
|
1101
|
+
paddingLeft: level <= 1 ? `var(--${prefixCls}list-item-padding-x)` : `calc(${level} * var(--${prefixCls}list-item-padding-level))`
|
|
1102
|
+
}, style),
|
|
1103
|
+
onClick: handleClick
|
|
1104
|
+
}, rest), {
|
|
1105
|
+
children: [
|
|
1106
|
+
hoverable && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}overlay` }),
|
|
1107
|
+
startContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
|
|
1108
|
+
/* @__PURE__ */ jsxs9("div", { className: `${prefixCls}list-item__content`, children: [
|
|
1109
|
+
/* @__PURE__ */ jsx11("span", __spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.title), { className: clsx_default(`${prefixCls}list-item__title`, (_a2 = slotProps == null ? void 0 : slotProps.title) == null ? void 0 : _a2.className), children: title })),
|
|
1110
|
+
/* @__PURE__ */ jsx11(
|
|
1111
|
+
"span",
|
|
1112
|
+
__spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.subtitle), {
|
|
1113
|
+
className: clsx_default(`${prefixCls}list-item__subtitle`, (_b2 = slotProps == null ? void 0 : slotProps.subtitle) == null ? void 0 : _b2.className),
|
|
1114
|
+
children: subtitle
|
|
1115
|
+
})
|
|
1116
|
+
)
|
|
1117
|
+
] }),
|
|
1118
|
+
endContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
|
|
1119
|
+
]
|
|
1120
|
+
})
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
var ListItem_default = ListItem;
|
|
1125
|
+
|
|
1126
|
+
// src/components/List/ListGroup.tsx
|
|
1127
|
+
import { Fragment, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1128
|
+
var ListGroup = forwardRef15(
|
|
1129
|
+
(_a, ref) => {
|
|
1130
|
+
var _b = _a, {
|
|
1131
|
+
children,
|
|
1132
|
+
startContent,
|
|
1133
|
+
endContent,
|
|
1134
|
+
expandVisible = true,
|
|
1135
|
+
expandPosition = "end",
|
|
1136
|
+
isOpen,
|
|
1137
|
+
onOpen,
|
|
1138
|
+
onClose,
|
|
1139
|
+
onToggle
|
|
1140
|
+
} = _b, rest = __objRest(_b, [
|
|
1141
|
+
"children",
|
|
1142
|
+
"startContent",
|
|
1143
|
+
"endContent",
|
|
1144
|
+
"expandVisible",
|
|
1145
|
+
"expandPosition",
|
|
1146
|
+
"isOpen",
|
|
1147
|
+
"onOpen",
|
|
1148
|
+
"onClose",
|
|
1149
|
+
"onToggle"
|
|
1150
|
+
]);
|
|
1151
|
+
const disclosure = isOpen !== void 0 ? { isOpen, onOpen, onClose, onToggle } : useDisclosure_default();
|
|
1152
|
+
const prefixCls = PREFIX_CLS;
|
|
1153
|
+
return /* @__PURE__ */ jsx12("div", { className: `${prefixCls}list-group`, children: /* @__PURE__ */ jsxs10(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
|
|
1154
|
+
/* @__PURE__ */ jsx12(CollapseTrigger_default, { children: /* @__PURE__ */ jsx12(
|
|
1155
|
+
ListItem_default,
|
|
1156
|
+
__spreadValues({
|
|
1157
|
+
ref,
|
|
1158
|
+
startContent: expandVisible && expandPosition === "start" ? /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsx12(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx12(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx12(ChevronDownIcon_default, {}) }),
|
|
1160
|
+
startContent
|
|
1161
|
+
] }) : startContent,
|
|
1162
|
+
endContent: expandVisible && expandPosition === "end" ? /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
1163
|
+
endContent,
|
|
1164
|
+
/* @__PURE__ */ jsx12(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx12(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx12(ChevronDownIcon_default, {}) })
|
|
1165
|
+
] }) : endContent
|
|
1166
|
+
}, rest)
|
|
1167
|
+
) }),
|
|
1168
|
+
/* @__PURE__ */ jsx12(CollapseContent_default, { children: /* @__PURE__ */ jsx12("div", { children: /* @__PURE__ */ jsx12(List_default, { children }) }) })
|
|
1169
|
+
] })) });
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
var ListGroup_default = ListGroup;
|
|
1173
|
+
|
|
1174
|
+
// src/components/ScrollArea/ScrollArea.tsx
|
|
1175
|
+
import { forwardRef as forwardRef16 } from "react";
|
|
1176
|
+
import { Scrollbars } from "react-custom-scrollbars-2";
|
|
1177
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1178
|
+
var ScrollArea = forwardRef16(({ children, autoHide = false, style }, ref) => {
|
|
1179
|
+
const prefixCls = PREFIX_CLS;
|
|
1180
|
+
const renderView = (props) => {
|
|
1181
|
+
return /* @__PURE__ */ jsx13("div", __spreadProps(__spreadValues({}, props), { className: clsx_default(`${prefixCls}scroll-area__view`, props.className) }));
|
|
541
1182
|
};
|
|
542
|
-
|
|
543
|
-
|
|
1183
|
+
const renderTrackHorizontal = (props) => {
|
|
1184
|
+
return /* @__PURE__ */ jsx13(
|
|
1185
|
+
"div",
|
|
1186
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1187
|
+
className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--horizontal`, props.className)
|
|
1188
|
+
})
|
|
1189
|
+
);
|
|
1190
|
+
};
|
|
1191
|
+
const renderTrackVertical = (props) => {
|
|
1192
|
+
return /* @__PURE__ */ jsx13(
|
|
1193
|
+
"div",
|
|
1194
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1195
|
+
className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--vertical`, props.className)
|
|
1196
|
+
})
|
|
1197
|
+
);
|
|
1198
|
+
};
|
|
1199
|
+
const renderThumbHorizontal = (props) => {
|
|
1200
|
+
return /* @__PURE__ */ jsx13(
|
|
1201
|
+
"div",
|
|
1202
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1203
|
+
className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--horizontal`, props.className)
|
|
1204
|
+
})
|
|
1205
|
+
);
|
|
1206
|
+
};
|
|
1207
|
+
const renderThumbVertical = (props) => {
|
|
1208
|
+
return /* @__PURE__ */ jsx13(
|
|
1209
|
+
"div",
|
|
1210
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1211
|
+
className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--vertical`, props.className)
|
|
1212
|
+
})
|
|
1213
|
+
);
|
|
1214
|
+
};
|
|
1215
|
+
return /* @__PURE__ */ jsx13(
|
|
1216
|
+
Scrollbars,
|
|
544
1217
|
{
|
|
545
|
-
|
|
546
|
-
className:
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
]
|
|
1218
|
+
autoHide,
|
|
1219
|
+
className: `${prefixCls}scroll-area`,
|
|
1220
|
+
renderTrackHorizontal,
|
|
1221
|
+
renderTrackVertical,
|
|
1222
|
+
renderThumbHorizontal,
|
|
1223
|
+
renderThumbVertical,
|
|
1224
|
+
renderView,
|
|
1225
|
+
style,
|
|
1226
|
+
ref: (node) => {
|
|
1227
|
+
node && assignRef(ref, node.container.firstElementChild);
|
|
1228
|
+
},
|
|
1229
|
+
children
|
|
558
1230
|
}
|
|
559
|
-
)
|
|
1231
|
+
);
|
|
560
1232
|
});
|
|
561
|
-
var
|
|
562
|
-
|
|
563
|
-
// src/components/Menu/Menu.tsx
|
|
564
|
-
import clsx13 from "clsx";
|
|
565
|
-
import { useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
1233
|
+
var ScrollArea_default = ScrollArea;
|
|
566
1234
|
|
|
567
|
-
// src/components/
|
|
568
|
-
import { createContext as
|
|
569
|
-
var
|
|
570
|
-
var
|
|
571
|
-
const context =
|
|
1235
|
+
// src/components/Autocomplete/AutocompleteContext.tsx
|
|
1236
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
1237
|
+
var AutocompleteContext = createContext3(null);
|
|
1238
|
+
var useAutocomplete = () => {
|
|
1239
|
+
const context = useContext3(AutocompleteContext);
|
|
572
1240
|
if (!context) {
|
|
573
|
-
throw new Error("`
|
|
1241
|
+
throw new Error("`useAutocomplete` must be used within a `<Autocomplete />`");
|
|
574
1242
|
}
|
|
575
1243
|
return context;
|
|
576
1244
|
};
|
|
577
|
-
var
|
|
1245
|
+
var AutocompleteContext_default = AutocompleteContext;
|
|
1246
|
+
|
|
1247
|
+
// src/components/Autocomplete/AutocompleteContent.tsx
|
|
1248
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1249
|
+
var AutocompleteContent = () => {
|
|
1250
|
+
const { data, values, offset, setOffset, keyField, textField, onItemSelect, renderItem } = useAutocomplete();
|
|
1251
|
+
const parentRef = useRef7(null);
|
|
1252
|
+
const { isOpen } = usePopover();
|
|
1253
|
+
const handleItemSelect = (item) => {
|
|
1254
|
+
var _a;
|
|
1255
|
+
onItemSelect(item);
|
|
1256
|
+
setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
|
|
1257
|
+
};
|
|
1258
|
+
useEffect12(() => {
|
|
1259
|
+
var _a;
|
|
1260
|
+
if (!isOpen)
|
|
1261
|
+
return;
|
|
1262
|
+
(_a = parentRef.current) == null ? void 0 : _a.scrollTo({ top: offset });
|
|
1263
|
+
}, [isOpen]);
|
|
1264
|
+
return /* @__PURE__ */ jsx14(
|
|
1265
|
+
ScrollArea_default,
|
|
1266
|
+
{
|
|
1267
|
+
ref: parentRef,
|
|
1268
|
+
style: {
|
|
1269
|
+
height: `200px`,
|
|
1270
|
+
width: `100%`,
|
|
1271
|
+
position: "relative"
|
|
1272
|
+
},
|
|
1273
|
+
children: /* @__PURE__ */ jsx14(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx14(Fragment2, { children: renderItem(item, {
|
|
1274
|
+
title: "",
|
|
1275
|
+
selected: values.includes(item[keyField]),
|
|
1276
|
+
hoverable: true,
|
|
1277
|
+
onClick: () => handleItemSelect(item)
|
|
1278
|
+
}) }, item[keyField])) : data.map((item) => /* @__PURE__ */ jsx14(
|
|
1279
|
+
ListItem_default,
|
|
1280
|
+
{
|
|
1281
|
+
title: item[textField],
|
|
1282
|
+
selected: values.includes(item[keyField]),
|
|
1283
|
+
hoverable: true,
|
|
1284
|
+
onClick: () => handleItemSelect(item)
|
|
1285
|
+
},
|
|
1286
|
+
item[keyField]
|
|
1287
|
+
)) })
|
|
1288
|
+
}
|
|
1289
|
+
);
|
|
1290
|
+
};
|
|
1291
|
+
var AutocompleteContent_default = AutocompleteContent;
|
|
578
1292
|
|
|
579
|
-
// src/components/
|
|
580
|
-
import
|
|
581
|
-
|
|
1293
|
+
// src/components/Autocomplete/AutocompleteVirtual.tsx
|
|
1294
|
+
import { Fragment as Fragment3, useEffect as useEffect13, useRef as useRef8 } from "react";
|
|
1295
|
+
|
|
1296
|
+
// src/components/Autocomplete/utils.ts
|
|
1297
|
+
var valueToValues = (value) => {
|
|
1298
|
+
return Array.isArray(value) ? value : value !== null ? [value] : [];
|
|
1299
|
+
};
|
|
1300
|
+
var valuesToValue = (values) => {
|
|
1301
|
+
return Array.isArray(values) ? values.length !== 0 ? values[0] : null : values;
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
// src/components/Autocomplete/AutocompleteVirtual.tsx
|
|
1305
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1306
|
+
var AutocompleteVirtual = () => {
|
|
1307
|
+
const { data, values, keyField, textField, virtual, onItemSelect, renderItem } = useAutocomplete();
|
|
1308
|
+
const parentRef = useRef8(null);
|
|
1309
|
+
const virtualizer = useVirtualizer_default(__spreadProps(__spreadValues({}, virtual), { count: data.length, parentRef }));
|
|
1310
|
+
const { isOpen } = usePopover();
|
|
1311
|
+
const handleItemSelect = (item) => {
|
|
1312
|
+
onItemSelect(item);
|
|
1313
|
+
};
|
|
1314
|
+
useEffect13(() => {
|
|
1315
|
+
if (!isOpen)
|
|
1316
|
+
return;
|
|
1317
|
+
const value = valuesToValue(values);
|
|
1318
|
+
const index = data.findIndex((item) => item[keyField] === value);
|
|
1319
|
+
virtualizer.scrollToIndex(index, { align: "start" });
|
|
1320
|
+
}, [isOpen]);
|
|
1321
|
+
if (!virtual)
|
|
1322
|
+
return null;
|
|
1323
|
+
return /* @__PURE__ */ jsx15(
|
|
1324
|
+
ScrollArea_default,
|
|
1325
|
+
{
|
|
1326
|
+
ref: parentRef,
|
|
1327
|
+
autoHide: true,
|
|
1328
|
+
style: {
|
|
1329
|
+
height: `200px`,
|
|
1330
|
+
width: `100%`,
|
|
1331
|
+
position: "relative"
|
|
1332
|
+
},
|
|
1333
|
+
children: /* @__PURE__ */ jsx15(List_default, { children: /* @__PURE__ */ jsx15(
|
|
1334
|
+
"div",
|
|
1335
|
+
{
|
|
1336
|
+
style: {
|
|
1337
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
1338
|
+
width: "100%",
|
|
1339
|
+
position: "relative"
|
|
1340
|
+
},
|
|
1341
|
+
children: virtualizer.getVirtualItems().map((virtualItem) => {
|
|
1342
|
+
const isLoaderRow = virtualItem.index > data.length - 1;
|
|
1343
|
+
const item = data[virtualItem.index];
|
|
1344
|
+
if (isLoaderRow) {
|
|
1345
|
+
return /* @__PURE__ */ jsx15(
|
|
1346
|
+
ListItem_default,
|
|
1347
|
+
{
|
|
1348
|
+
title: virtual.hasNextPage ? "Loading..." : "Nothing more to load",
|
|
1349
|
+
style: {
|
|
1350
|
+
position: "absolute",
|
|
1351
|
+
top: 0,
|
|
1352
|
+
left: 0,
|
|
1353
|
+
width: "100%",
|
|
1354
|
+
height: `${virtualItem.size}px`,
|
|
1355
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
virtualItem.index
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
if (!item) {
|
|
1362
|
+
return /* @__PURE__ */ jsx15(
|
|
1363
|
+
ListItem_default,
|
|
1364
|
+
{
|
|
1365
|
+
title: `Item ${virtualItem.index} not found`,
|
|
1366
|
+
style: {
|
|
1367
|
+
position: "absolute",
|
|
1368
|
+
top: 0,
|
|
1369
|
+
left: 0,
|
|
1370
|
+
width: "100%",
|
|
1371
|
+
height: `${virtualItem.size}px`,
|
|
1372
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
virtualItem.index
|
|
1376
|
+
);
|
|
1377
|
+
}
|
|
1378
|
+
if (renderItem) {
|
|
1379
|
+
return /* @__PURE__ */ jsx15(Fragment3, { children: renderItem(item, {
|
|
1380
|
+
title: "",
|
|
1381
|
+
selected: values.includes(item[keyField]),
|
|
1382
|
+
hoverable: true,
|
|
1383
|
+
style: {
|
|
1384
|
+
position: "absolute",
|
|
1385
|
+
top: 0,
|
|
1386
|
+
left: 0,
|
|
1387
|
+
width: "100%",
|
|
1388
|
+
height: `${virtualItem.size}px`,
|
|
1389
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
1390
|
+
},
|
|
1391
|
+
onClick: () => handleItemSelect(item)
|
|
1392
|
+
}) }, virtualItem.index);
|
|
1393
|
+
}
|
|
1394
|
+
return /* @__PURE__ */ jsx15(
|
|
1395
|
+
ListItem_default,
|
|
1396
|
+
{
|
|
1397
|
+
title: item[textField],
|
|
1398
|
+
selected: values.includes(item[keyField]),
|
|
1399
|
+
hoverable: true,
|
|
1400
|
+
style: {
|
|
1401
|
+
position: "absolute",
|
|
1402
|
+
top: 0,
|
|
1403
|
+
left: 0,
|
|
1404
|
+
width: "100%",
|
|
1405
|
+
height: `${virtualItem.size}px`,
|
|
1406
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
1407
|
+
},
|
|
1408
|
+
onClick: () => handleItemSelect(item)
|
|
1409
|
+
},
|
|
1410
|
+
virtualItem.index
|
|
1411
|
+
);
|
|
1412
|
+
})
|
|
1413
|
+
}
|
|
1414
|
+
) })
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1417
|
+
};
|
|
1418
|
+
var AutocompleteVirtual_default = AutocompleteVirtual;
|
|
1419
|
+
|
|
1420
|
+
// src/components/Autocomplete/Autocomplete.tsx
|
|
1421
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1422
|
+
var Autocomplete = (props) => {
|
|
1423
|
+
const {
|
|
1424
|
+
data,
|
|
1425
|
+
value: valueProp,
|
|
1426
|
+
keyField = "key",
|
|
1427
|
+
textField = "text",
|
|
1428
|
+
isMultiple = false,
|
|
1429
|
+
disabled,
|
|
1430
|
+
loading,
|
|
1431
|
+
disclosure: disclosureProp,
|
|
1432
|
+
virtual,
|
|
1433
|
+
placeholder,
|
|
1434
|
+
style,
|
|
1435
|
+
startContent,
|
|
1436
|
+
endContent,
|
|
1437
|
+
onFilterChange,
|
|
1438
|
+
renderItem
|
|
1439
|
+
} = props;
|
|
1440
|
+
const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
|
|
1441
|
+
const prefixCls = PREFIX_CLS;
|
|
1442
|
+
const inputRef = useRef9(null);
|
|
1443
|
+
const [filter, setFilter] = useState10("");
|
|
1444
|
+
const [search, setSearch] = useState10("");
|
|
1445
|
+
const [isSearch, setIsSearch] = useState10(false);
|
|
1446
|
+
const [focus, setFocus] = useState10(false);
|
|
1447
|
+
const values = useMemo3(() => {
|
|
1448
|
+
return valueToValues(valueProp);
|
|
1449
|
+
}, [valueProp]);
|
|
1450
|
+
const items = useMemo3(() => {
|
|
1451
|
+
return data.filter((item) => values.includes(item[keyField]));
|
|
1452
|
+
}, [data, values]);
|
|
1453
|
+
const [offset, setOffset] = useState10(0);
|
|
1454
|
+
const handleClick = () => {
|
|
1455
|
+
var _a;
|
|
1456
|
+
(_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.focus();
|
|
1457
|
+
};
|
|
1458
|
+
const handleChange = (values2) => {
|
|
1459
|
+
var _a, _b, _c, _d, _e;
|
|
1460
|
+
if (props.isMultiple) {
|
|
1461
|
+
const items2 = data.filter((item) => values2.includes(item[keyField]));
|
|
1462
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, items2);
|
|
1463
|
+
(_b = props.onValueChange) == null ? void 0 : _b.call(props, values2);
|
|
1464
|
+
} else {
|
|
1465
|
+
const newValue = valuesToValue(values2);
|
|
1466
|
+
let item = null;
|
|
1467
|
+
if (newValue !== void 0) {
|
|
1468
|
+
item = (_c = data.find((item2) => item2[keyField] === newValue)) != null ? _c : null;
|
|
1469
|
+
}
|
|
1470
|
+
(_d = props.onChange) == null ? void 0 : _d.call(props, item);
|
|
1471
|
+
(_e = props.onValueChange) == null ? void 0 : _e.call(props, newValue);
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
const handleClear = (event) => {
|
|
1475
|
+
var _a, _b, _c, _d;
|
|
1476
|
+
event.stopPropagation();
|
|
1477
|
+
setIsSearch(true);
|
|
1478
|
+
setSearch("");
|
|
1479
|
+
if (props.isMultiple) {
|
|
1480
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, []);
|
|
1481
|
+
(_b = props.onValueChange) == null ? void 0 : _b.call(props, []);
|
|
1482
|
+
} else {
|
|
1483
|
+
(_c = props.onChange) == null ? void 0 : _c.call(props, null);
|
|
1484
|
+
(_d = props.onValueChange) == null ? void 0 : _d.call(props, null);
|
|
1485
|
+
}
|
|
1486
|
+
setIsSearch(false);
|
|
1487
|
+
};
|
|
1488
|
+
const handleFilterChange = (event) => {
|
|
1489
|
+
!disclosure.isOpen && disclosure.onOpen();
|
|
1490
|
+
setIsSearch(true);
|
|
1491
|
+
setSearch(event.target.value);
|
|
1492
|
+
onFilterChange == null ? void 0 : onFilterChange(event.target.value);
|
|
1493
|
+
};
|
|
1494
|
+
const handleItemSelect = (item) => {
|
|
1495
|
+
var _a;
|
|
1496
|
+
const newValue = item[keyField];
|
|
1497
|
+
if (props.isMultiple) {
|
|
1498
|
+
const newValues = [...values];
|
|
1499
|
+
const valueIndex = values.indexOf(newValue);
|
|
1500
|
+
if (valueIndex === -1) {
|
|
1501
|
+
newValues.push(newValue);
|
|
1502
|
+
} else {
|
|
1503
|
+
newValues.splice(valueIndex, 1);
|
|
1504
|
+
}
|
|
1505
|
+
handleChange(newValues);
|
|
1506
|
+
} else {
|
|
1507
|
+
const value = valuesToValue(values);
|
|
1508
|
+
if (value !== newValue) {
|
|
1509
|
+
handleChange([newValue]);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
if (isSearch) {
|
|
1513
|
+
setFilter(search);
|
|
1514
|
+
}
|
|
1515
|
+
setIsSearch(false);
|
|
1516
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
1517
|
+
disclosure.onClose();
|
|
1518
|
+
};
|
|
1519
|
+
const handleOpen = () => {
|
|
1520
|
+
disclosure.onOpen();
|
|
1521
|
+
setFocus(true);
|
|
1522
|
+
};
|
|
1523
|
+
const handleClose = () => {
|
|
1524
|
+
disclosure.onClose();
|
|
1525
|
+
if (!props.isMultiple) {
|
|
1526
|
+
if (isSearch) {
|
|
1527
|
+
const item = items[0];
|
|
1528
|
+
if (item !== void 0) {
|
|
1529
|
+
setSearch(item[textField]);
|
|
1530
|
+
onFilterChange == null ? void 0 : onFilterChange(filter);
|
|
1531
|
+
} else {
|
|
1532
|
+
setSearch("");
|
|
1533
|
+
onFilterChange == null ? void 0 : onFilterChange(filter);
|
|
1534
|
+
}
|
|
1535
|
+
setIsSearch(false);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
useEffect14(() => {
|
|
1540
|
+
if (isSearch)
|
|
1541
|
+
return;
|
|
1542
|
+
if (!props.isMultiple) {
|
|
1543
|
+
const item = items[0];
|
|
1544
|
+
if (item !== void 0) {
|
|
1545
|
+
setSearch(item[textField]);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}, [items]);
|
|
1549
|
+
useEffect14(() => {
|
|
1550
|
+
const values2 = valueToValues(valueProp);
|
|
1551
|
+
const value = values2[0];
|
|
1552
|
+
if (value === void 0) {
|
|
1553
|
+
setSearch("");
|
|
1554
|
+
onFilterChange == null ? void 0 : onFilterChange("");
|
|
1555
|
+
}
|
|
1556
|
+
}, [valueProp]);
|
|
1557
|
+
return /* @__PURE__ */ jsx16(
|
|
1558
|
+
AutocompleteContext_default.Provider,
|
|
1559
|
+
{
|
|
1560
|
+
value: {
|
|
1561
|
+
data,
|
|
1562
|
+
values,
|
|
1563
|
+
keyField,
|
|
1564
|
+
textField,
|
|
1565
|
+
isMultiple,
|
|
1566
|
+
virtual,
|
|
1567
|
+
onChange: handleChange,
|
|
1568
|
+
onItemSelect: handleItemSelect,
|
|
1569
|
+
offset,
|
|
1570
|
+
setOffset,
|
|
1571
|
+
renderItem
|
|
1572
|
+
},
|
|
1573
|
+
children: /* @__PURE__ */ jsxs11(
|
|
1574
|
+
Popover_default,
|
|
1575
|
+
__spreadProps(__spreadValues({
|
|
1576
|
+
target: true
|
|
1577
|
+
}, disclosure), {
|
|
1578
|
+
isOpen: disclosure.isOpen,
|
|
1579
|
+
onOpen: handleOpen,
|
|
1580
|
+
onClose: handleClose,
|
|
1581
|
+
autoClose: "outside",
|
|
1582
|
+
children: [
|
|
1583
|
+
/* @__PURE__ */ jsx16(PopoverTrigger_default, { children: /* @__PURE__ */ jsxs11(
|
|
1584
|
+
"div",
|
|
1585
|
+
{
|
|
1586
|
+
className: clsx_default(`${prefixCls}input ${prefixCls}input--filterable`, {
|
|
1587
|
+
[`${prefixCls}input--focus`]: focus,
|
|
1588
|
+
[`${prefixCls}input--disabled`]: disabled
|
|
1589
|
+
}),
|
|
1590
|
+
style,
|
|
1591
|
+
onClick: handleClick,
|
|
1592
|
+
onFocus: () => {
|
|
1593
|
+
setFocus(true);
|
|
1594
|
+
},
|
|
1595
|
+
onBlur: () => {
|
|
1596
|
+
setFocus(false);
|
|
1597
|
+
},
|
|
1598
|
+
children: [
|
|
1599
|
+
/* @__PURE__ */ jsx16("div", { className: `${prefixCls}outline` }),
|
|
1600
|
+
/* @__PURE__ */ jsxs11("div", { className: `${prefixCls}input__content`, children: [
|
|
1601
|
+
startContent && /* @__PURE__ */ jsx16("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
1602
|
+
/* @__PURE__ */ jsx16(
|
|
1603
|
+
"input",
|
|
1604
|
+
{
|
|
1605
|
+
ref: inputRef,
|
|
1606
|
+
className: `${prefixCls}input__field`,
|
|
1607
|
+
value: search,
|
|
1608
|
+
placeholder,
|
|
1609
|
+
disabled,
|
|
1610
|
+
onChange: handleFilterChange
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
/* @__PURE__ */ jsxs11("div", { className: `${prefixCls}input__end-content`, children: [
|
|
1614
|
+
endContent,
|
|
1615
|
+
loading ? /* @__PURE__ */ jsx16(Icon_default, { children: /* @__PURE__ */ jsx16(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ jsx16(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ jsx16(Icon_default, { children: /* @__PURE__ */ jsx16(CloseIcon_default, {}) }) }),
|
|
1616
|
+
/* @__PURE__ */ jsx16("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx16(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx16(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx16(ChevronDownIcon_default, {}) }) })
|
|
1617
|
+
] })
|
|
1618
|
+
] })
|
|
1619
|
+
]
|
|
1620
|
+
}
|
|
1621
|
+
) }),
|
|
1622
|
+
/* @__PURE__ */ jsx16(PopoverContent_default, { children: /* @__PURE__ */ jsx16("div", { children: virtual ? /* @__PURE__ */ jsx16(AutocompleteVirtual_default, {}) : /* @__PURE__ */ jsx16(AutocompleteContent_default, {}) }) })
|
|
1623
|
+
]
|
|
1624
|
+
})
|
|
1625
|
+
)
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
};
|
|
1629
|
+
var Autocomplete_default = Autocomplete;
|
|
1630
|
+
|
|
1631
|
+
// src/components/Backdrop/Backdrop.tsx
|
|
1632
|
+
import clsx6 from "clsx";
|
|
1633
|
+
import { forwardRef as forwardRef17, useRef as useRef10 } from "react";
|
|
1634
|
+
import { mergeRefs as mergeRefs2 } from "react-merge-refs";
|
|
1635
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1636
|
+
var Backdrop = forwardRef17((props, ref) => {
|
|
1637
|
+
const _a = props, { children, className, isOpen, onClose } = _a, rest = __objRest(_a, ["children", "className", "isOpen", "onClose"]);
|
|
1638
|
+
const nodeRef = useRef10(null);
|
|
1639
|
+
return /* @__PURE__ */ jsx17(
|
|
1640
|
+
Transition_default,
|
|
1641
|
+
{
|
|
1642
|
+
nodeRef,
|
|
1643
|
+
isOpen,
|
|
1644
|
+
name: `${PREFIX_CLS}backdrop`,
|
|
1645
|
+
enter: 300,
|
|
1646
|
+
leave: 300,
|
|
1647
|
+
mountOnEnter: true,
|
|
1648
|
+
unmountOnExit: true,
|
|
1649
|
+
children: /* @__PURE__ */ jsx17(Portal_default, { children: /* @__PURE__ */ jsxs12(
|
|
1650
|
+
"div",
|
|
1651
|
+
__spreadProps(__spreadValues({
|
|
1652
|
+
ref: mergeRefs2([ref, nodeRef]),
|
|
1653
|
+
className: clsx6(`${PREFIX_CLS}backdrop`, className),
|
|
1654
|
+
tabIndex: -1
|
|
1655
|
+
}, rest), {
|
|
1656
|
+
children: [
|
|
1657
|
+
/* @__PURE__ */ jsx17("div", { className: `${PREFIX_CLS}backdrop__overlay`, onClick: onClose }),
|
|
1658
|
+
children
|
|
1659
|
+
]
|
|
1660
|
+
})
|
|
1661
|
+
) })
|
|
1662
|
+
}
|
|
1663
|
+
);
|
|
1664
|
+
});
|
|
1665
|
+
var Backdrop_default = Backdrop;
|
|
1666
|
+
|
|
1667
|
+
// src/components/Badge/Badge.tsx
|
|
1668
|
+
import clsx7 from "clsx";
|
|
1669
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1670
|
+
var Badge = ({ children, placement, content }) => {
|
|
1671
|
+
return /* @__PURE__ */ jsxs13("div", { className: clsx7(`${PREFIX_CLS}badge-wrapper`), children: [
|
|
1672
|
+
children,
|
|
1673
|
+
/* @__PURE__ */ jsx18(
|
|
1674
|
+
"div",
|
|
1675
|
+
{
|
|
1676
|
+
className: clsx7(`${PREFIX_CLS}badge`, {
|
|
1677
|
+
[`${PREFIX_CLS}badge--${placement}`]: placement
|
|
1678
|
+
}),
|
|
1679
|
+
children: content
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
] });
|
|
1683
|
+
};
|
|
1684
|
+
var Badge_default = Badge;
|
|
1685
|
+
|
|
1686
|
+
// src/components/Card/Card.tsx
|
|
1687
|
+
import { forwardRef as forwardRef18 } from "react";
|
|
1688
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1689
|
+
var Card = forwardRef18((_a, ref) => {
|
|
1690
|
+
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
1691
|
+
const prefixCls = PREFIX_CLS;
|
|
1692
|
+
return /* @__PURE__ */ jsx19(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card`, className) }, rest), { children }));
|
|
1693
|
+
});
|
|
1694
|
+
var Card_default = Card;
|
|
1695
|
+
|
|
1696
|
+
// src/components/Card/CardHeader.tsx
|
|
1697
|
+
import { forwardRef as forwardRef19 } from "react";
|
|
1698
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1699
|
+
var CardHeader = forwardRef19(
|
|
1700
|
+
(_a, ref) => {
|
|
1701
|
+
var _b = _a, { as: Component = "div", className, title, subtitle, startContent, endContent } = _b, rest = __objRest(_b, ["as", "className", "title", "subtitle", "startContent", "endContent"]);
|
|
1702
|
+
const prefixCls = PREFIX_CLS;
|
|
1703
|
+
return /* @__PURE__ */ jsxs14(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card-header`, className) }, rest), { children: [
|
|
1704
|
+
startContent && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
|
|
1705
|
+
/* @__PURE__ */ jsxs14("div", { className: `${prefixCls}card-header__content`, children: [
|
|
1706
|
+
/* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__title`, children: title }),
|
|
1707
|
+
subtitle && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
|
|
1708
|
+
] }),
|
|
1709
|
+
endContent && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__end-content`, children: endContent })
|
|
1710
|
+
] }));
|
|
1711
|
+
}
|
|
1712
|
+
);
|
|
1713
|
+
var CardHeader_default = CardHeader;
|
|
1714
|
+
|
|
1715
|
+
// src/components/Chip/Chip.tsx
|
|
1716
|
+
import clsx8 from "clsx";
|
|
1717
|
+
import { forwardRef as forwardRef20 } from "react";
|
|
1718
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1719
|
+
var Chip = forwardRef20(
|
|
1720
|
+
(_a, ref) => {
|
|
1721
|
+
var _b = _a, { as: Component = "div", children, className, variant = "text", color = "primary", size = "md" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
1722
|
+
return /* @__PURE__ */ jsxs15(
|
|
1723
|
+
Component,
|
|
1724
|
+
__spreadProps(__spreadValues({
|
|
1725
|
+
ref,
|
|
1726
|
+
className: clsx8(
|
|
1727
|
+
`${PREFIX_CLS}chip`,
|
|
1728
|
+
{
|
|
1729
|
+
[`${PREFIX_CLS}chip--${variant}`]: variant,
|
|
1730
|
+
[`${PREFIX_CLS}chip--${color}`]: color,
|
|
1731
|
+
[`${PREFIX_CLS}chip--${size}`]: size
|
|
1732
|
+
},
|
|
1733
|
+
className
|
|
1734
|
+
)
|
|
1735
|
+
}, rest), {
|
|
1736
|
+
children: [
|
|
1737
|
+
/* @__PURE__ */ jsx21("div", { className: clsx8(`${PREFIX_CLS}overlay`) }),
|
|
1738
|
+
/* @__PURE__ */ jsx21("div", { className: `${PREFIX_CLS}outline` }),
|
|
1739
|
+
children
|
|
1740
|
+
]
|
|
1741
|
+
})
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
);
|
|
1745
|
+
var Chip_default = Chip;
|
|
1746
|
+
|
|
1747
|
+
// src/components/Drawer/Drawer.tsx
|
|
1748
|
+
import clsx9 from "clsx";
|
|
1749
|
+
import { forwardRef as forwardRef21, useRef as useRef11 } from "react";
|
|
1750
|
+
import { mergeRefs as mergeRefs3 } from "react-merge-refs";
|
|
1751
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1752
|
+
var Drawer = forwardRef21((props, ref) => {
|
|
1753
|
+
const { children, className, isOpen, size = "md", position = "left", onClose } = props;
|
|
1754
|
+
const nodeRef = useRef11(null);
|
|
1755
|
+
const handleClose = () => {
|
|
1756
|
+
onClose();
|
|
1757
|
+
};
|
|
1758
|
+
return /* @__PURE__ */ jsx22(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsx22(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */ jsxs16(
|
|
1759
|
+
"div",
|
|
1760
|
+
{
|
|
1761
|
+
ref: mergeRefs3([ref, nodeRef]),
|
|
1762
|
+
className: clsx9(
|
|
1763
|
+
`${PREFIX_CLS}drawer`,
|
|
1764
|
+
{
|
|
1765
|
+
[`${PREFIX_CLS}drawer--${size}`]: size,
|
|
1766
|
+
[`${PREFIX_CLS}drawer--${position}`]: position
|
|
1767
|
+
},
|
|
1768
|
+
className
|
|
1769
|
+
),
|
|
1770
|
+
children: [
|
|
1771
|
+
/* @__PURE__ */ jsx22("div", { className: `${PREFIX_CLS}drawer__overlay` }),
|
|
1772
|
+
children
|
|
1773
|
+
]
|
|
1774
|
+
}
|
|
1775
|
+
) }) });
|
|
1776
|
+
});
|
|
1777
|
+
var Drawer_default = Drawer;
|
|
1778
|
+
|
|
1779
|
+
// src/components/Menu/Menu.tsx
|
|
1780
|
+
import clsx13 from "clsx";
|
|
1781
|
+
import { useEffect as useEffect16, useMemo as useMemo6, useState as useState11 } from "react";
|
|
1782
|
+
|
|
1783
|
+
// src/components/Menu/MenuContext.tsx
|
|
1784
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1785
|
+
var MenuContext = createContext4(null);
|
|
1786
|
+
var useMenu = () => {
|
|
1787
|
+
const context = useContext4(MenuContext);
|
|
1788
|
+
if (!context) {
|
|
1789
|
+
throw new Error("`useMenu` must be used within a `<Menu />`");
|
|
1790
|
+
}
|
|
1791
|
+
return context;
|
|
1792
|
+
};
|
|
1793
|
+
var MenuContext_default = MenuContext;
|
|
1794
|
+
|
|
1795
|
+
// src/components/Menu/MenuGroup.tsx
|
|
1796
|
+
import clsx12 from "clsx";
|
|
1797
|
+
import { useMemo as useMemo5 } from "react";
|
|
582
1798
|
|
|
583
1799
|
// src/components/Menu/MenuItem.tsx
|
|
584
1800
|
import clsx10 from "clsx";
|
|
585
|
-
import { forwardRef as
|
|
1801
|
+
import { forwardRef as forwardRef22, useContext as useContext6, useEffect as useEffect15 } from "react";
|
|
586
1802
|
|
|
587
1803
|
// src/components/Menu/MenuValueContext.tsx
|
|
588
|
-
import { createContext as
|
|
589
|
-
var MenuValueContext =
|
|
1804
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1805
|
+
var MenuValueContext = createContext5([]);
|
|
590
1806
|
var useMenuItemValue = () => {
|
|
591
|
-
const context =
|
|
1807
|
+
const context = useContext5(MenuValueContext);
|
|
592
1808
|
if (!context) {
|
|
593
1809
|
throw new Error("`useMenuValue` must be used within a `<MenuValueContext.Provider />`");
|
|
594
1810
|
}
|
|
@@ -597,12 +1813,13 @@ var useMenuItemValue = () => {
|
|
|
597
1813
|
var MenuValueContext_default = MenuValueContext;
|
|
598
1814
|
|
|
599
1815
|
// src/components/Menu/MenuItem.tsx
|
|
600
|
-
import { jsx as
|
|
601
|
-
var MenuItem =
|
|
1816
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1817
|
+
var MenuItem = forwardRef22((props, ref) => {
|
|
602
1818
|
const _a = props, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _a, rest = __objRest(_a, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
|
|
603
1819
|
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
604
|
-
const values =
|
|
1820
|
+
const values = useContext6(MenuValueContext_default);
|
|
605
1821
|
const mergedValues = [...values, value];
|
|
1822
|
+
const isSelected = menuValue[level - 1] === value;
|
|
606
1823
|
const handleClick = (event) => {
|
|
607
1824
|
if (value !== void 0) {
|
|
608
1825
|
onChange(mergedValues);
|
|
@@ -610,20 +1827,20 @@ var MenuItem = forwardRef15((props, ref) => {
|
|
|
610
1827
|
onClick == null ? void 0 : onClick(event);
|
|
611
1828
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
612
1829
|
};
|
|
613
|
-
|
|
1830
|
+
useEffect15(() => {
|
|
614
1831
|
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
615
1832
|
onOpen(values);
|
|
616
1833
|
onChange(mergedValues);
|
|
617
1834
|
}
|
|
618
1835
|
}, [value, originalValue, navMode]);
|
|
619
|
-
return /* @__PURE__ */
|
|
1836
|
+
return /* @__PURE__ */ jsxs17(
|
|
620
1837
|
Component,
|
|
621
1838
|
__spreadProps(__spreadValues({
|
|
622
1839
|
ref,
|
|
623
1840
|
className: clsx10(
|
|
624
1841
|
`${PREFIX_CLS}menu-item`,
|
|
625
1842
|
{
|
|
626
|
-
[`${PREFIX_CLS}menu-item--selected`]:
|
|
1843
|
+
[`${PREFIX_CLS}menu-item--selected`]: isSelected,
|
|
627
1844
|
[`${PREFIX_CLS}menu-item--disabled`]: disabled
|
|
628
1845
|
},
|
|
629
1846
|
className
|
|
@@ -634,9 +1851,9 @@ var MenuItem = forwardRef15((props, ref) => {
|
|
|
634
1851
|
onClick: handleClick
|
|
635
1852
|
}, rest), {
|
|
636
1853
|
children: [
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
icon && /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
1855
|
+
icon && /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
1856
|
+
/* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx23("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
|
|
640
1857
|
]
|
|
641
1858
|
})
|
|
642
1859
|
);
|
|
@@ -646,7 +1863,7 @@ var MenuItem_default = MenuItem;
|
|
|
646
1863
|
|
|
647
1864
|
// src/components/Menu/MenuSubmenu.tsx
|
|
648
1865
|
import clsx11 from "clsx";
|
|
649
|
-
import { useContext as
|
|
1866
|
+
import { useContext as useContext7, useMemo as useMemo4 } from "react";
|
|
650
1867
|
|
|
651
1868
|
// src/components/Menu/utils.ts
|
|
652
1869
|
var getOpenValuesByPathname = (pathname) => {
|
|
@@ -672,7 +1889,7 @@ var addOrRemoveValueInArray = (array, value) => {
|
|
|
672
1889
|
};
|
|
673
1890
|
|
|
674
1891
|
// src/components/Menu/MenuSubmenu.tsx
|
|
675
|
-
import { jsx as
|
|
1892
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
676
1893
|
var MenuSubmenu = (_a) => {
|
|
677
1894
|
var _b = _a, {
|
|
678
1895
|
children,
|
|
@@ -696,13 +1913,14 @@ var MenuSubmenu = (_a) => {
|
|
|
696
1913
|
"onClick"
|
|
697
1914
|
]);
|
|
698
1915
|
const { value: menuValue, openValues, expandMode, onOpen } = useMenu();
|
|
699
|
-
const values =
|
|
1916
|
+
const values = useContext7(MenuValueContext_default);
|
|
700
1917
|
const isOpen = openValues.includes(value);
|
|
701
1918
|
const mergedValues = [...values, value];
|
|
702
|
-
const
|
|
1919
|
+
const isSelected = menuValue[level - 1] === value;
|
|
1920
|
+
const content = useMemo4(() => {
|
|
703
1921
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
704
1922
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
705
|
-
return type === "item" ? /* @__PURE__ */
|
|
1923
|
+
return type === "item" ? /* @__PURE__ */ jsx24(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ jsx24(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ jsx24(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ jsx24(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
|
|
706
1924
|
});
|
|
707
1925
|
}, [items]);
|
|
708
1926
|
const handleClick = (event) => {
|
|
@@ -720,14 +1938,14 @@ var MenuSubmenu = (_a) => {
|
|
|
720
1938
|
}
|
|
721
1939
|
onClick == null ? void 0 : onClick(event);
|
|
722
1940
|
};
|
|
723
|
-
return /* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
1941
|
+
return /* @__PURE__ */ jsx24(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx24("div", { className: clsx11(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ jsxs18(Collapse_default, { isOpen, children: [
|
|
1942
|
+
/* @__PURE__ */ jsx24(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs18(
|
|
725
1943
|
"div",
|
|
726
1944
|
__spreadProps(__spreadValues({
|
|
727
1945
|
className: clsx11(
|
|
728
1946
|
`${PREFIX_CLS}menu-item`,
|
|
729
1947
|
{
|
|
730
|
-
[`${PREFIX_CLS}menu-item--selected`]:
|
|
1948
|
+
[`${PREFIX_CLS}menu-item--selected`]: isSelected || items && mergedValues.includes(menuValue)
|
|
731
1949
|
},
|
|
732
1950
|
className
|
|
733
1951
|
),
|
|
@@ -737,14 +1955,14 @@ var MenuSubmenu = (_a) => {
|
|
|
737
1955
|
onClick: handleClick
|
|
738
1956
|
}, rest), {
|
|
739
1957
|
children: [
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
icon && /* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
1959
|
+
icon && /* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
1960
|
+
/* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx24("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
|
|
1961
|
+
/* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ jsx24(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ jsx24(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
|
|
744
1962
|
]
|
|
745
1963
|
})
|
|
746
1964
|
) }),
|
|
747
|
-
/* @__PURE__ */
|
|
1965
|
+
/* @__PURE__ */ jsx24(CollapseContent_default, { children: /* @__PURE__ */ jsx24(
|
|
748
1966
|
"ul",
|
|
749
1967
|
{
|
|
750
1968
|
className: clsx11(`${PREFIX_CLS}menu`, {
|
|
@@ -758,7 +1976,7 @@ var MenuSubmenu = (_a) => {
|
|
|
758
1976
|
var MenuSubmenu_default = MenuSubmenu;
|
|
759
1977
|
|
|
760
1978
|
// src/components/Menu/MenuGroup.tsx
|
|
761
|
-
import { Fragment, jsx as
|
|
1979
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
762
1980
|
var MenuGroup = (_a) => {
|
|
763
1981
|
var _b = _a, {
|
|
764
1982
|
children,
|
|
@@ -777,14 +1995,14 @@ var MenuGroup = (_a) => {
|
|
|
777
1995
|
"level",
|
|
778
1996
|
"items"
|
|
779
1997
|
]);
|
|
780
|
-
const content =
|
|
1998
|
+
const content = useMemo5(() => {
|
|
781
1999
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
782
2000
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
783
|
-
return type === "item" ? /* @__PURE__ */
|
|
2001
|
+
return type === "item" ? /* @__PURE__ */ jsx25(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx25(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx25(MenuItem_default, __spreadValues({}, item), index);
|
|
784
2002
|
});
|
|
785
2003
|
}, [items]);
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
2004
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
2005
|
+
/* @__PURE__ */ jsxs19(
|
|
788
2006
|
"div",
|
|
789
2007
|
__spreadProps(__spreadValues({
|
|
790
2008
|
className: clsx12(`${PREFIX_CLS}menu-group`, className),
|
|
@@ -793,8 +2011,8 @@ var MenuGroup = (_a) => {
|
|
|
793
2011
|
}, style)
|
|
794
2012
|
}, rest), {
|
|
795
2013
|
children: [
|
|
796
|
-
icon && /* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
2014
|
+
icon && /* @__PURE__ */ jsx25("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
|
|
2015
|
+
/* @__PURE__ */ jsx25("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ jsx25("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
|
|
798
2016
|
]
|
|
799
2017
|
})
|
|
800
2018
|
),
|
|
@@ -804,7 +2022,7 @@ var MenuGroup = (_a) => {
|
|
|
804
2022
|
var MenuGroup_default = MenuGroup;
|
|
805
2023
|
|
|
806
2024
|
// src/components/Menu/Menu.tsx
|
|
807
|
-
import { jsx as
|
|
2025
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
808
2026
|
var Menu = (_a) => {
|
|
809
2027
|
var _b = _a, {
|
|
810
2028
|
children,
|
|
@@ -830,12 +2048,12 @@ var Menu = (_a) => {
|
|
|
830
2048
|
"onItemSelect"
|
|
831
2049
|
]);
|
|
832
2050
|
var _a2;
|
|
833
|
-
const [selfValue, setSelfValue] =
|
|
834
|
-
const [selfOpenValues, setSelfOpenValues] =
|
|
835
|
-
const content =
|
|
2051
|
+
const [selfValue, setSelfValue] = useState11((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
2052
|
+
const [selfOpenValues, setSelfOpenValues] = useState11(openValuesProp != null ? openValuesProp : []);
|
|
2053
|
+
const content = useMemo6(() => {
|
|
836
2054
|
return items == null ? void 0 : items.map((_a3, index) => {
|
|
837
2055
|
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
838
|
-
return type === "item" ? /* @__PURE__ */
|
|
2056
|
+
return type === "item" ? /* @__PURE__ */ jsx26(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx26(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ jsx26(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx26(MenuItem_default, __spreadValues({}, item), index);
|
|
839
2057
|
});
|
|
840
2058
|
}, [items]);
|
|
841
2059
|
const handleChange = (value) => {
|
|
@@ -855,17 +2073,17 @@ var Menu = (_a) => {
|
|
|
855
2073
|
const handleItemSelect = (props) => {
|
|
856
2074
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
857
2075
|
};
|
|
858
|
-
|
|
2076
|
+
useEffect16(() => {
|
|
859
2077
|
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
860
2078
|
setSelfValue(valueProp);
|
|
861
2079
|
}
|
|
862
2080
|
}, [valueProp]);
|
|
863
|
-
|
|
2081
|
+
useEffect16(() => {
|
|
864
2082
|
if (openValuesProp !== void 0) {
|
|
865
2083
|
setSelfOpenValues(openValuesProp);
|
|
866
2084
|
}
|
|
867
2085
|
}, [openValuesProp]);
|
|
868
|
-
return /* @__PURE__ */
|
|
2086
|
+
return /* @__PURE__ */ jsx26(
|
|
869
2087
|
MenuContext_default.Provider,
|
|
870
2088
|
{
|
|
871
2089
|
value: {
|
|
@@ -878,7 +2096,7 @@ var Menu = (_a) => {
|
|
|
878
2096
|
onChange: handleChange,
|
|
879
2097
|
onItemSelect: handleItemSelect
|
|
880
2098
|
},
|
|
881
|
-
children: /* @__PURE__ */
|
|
2099
|
+
children: /* @__PURE__ */ jsx26("div", __spreadProps(__spreadValues({ className: clsx13(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
|
|
882
2100
|
}
|
|
883
2101
|
);
|
|
884
2102
|
};
|
|
@@ -886,319 +2104,87 @@ Menu.displayName = "Menu";
|
|
|
886
2104
|
var Menu_default = Menu;
|
|
887
2105
|
|
|
888
2106
|
// src/components/Accordion/Accordion.tsx
|
|
889
|
-
import { forwardRef as
|
|
890
|
-
import { jsx as
|
|
891
|
-
var Accordion =
|
|
2107
|
+
import { forwardRef as forwardRef23 } from "react";
|
|
2108
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2109
|
+
var Accordion = forwardRef23((props, ref) => {
|
|
892
2110
|
const _a = props, { children, className } = _a, rest = __objRest(_a, ["children", "className"]);
|
|
893
2111
|
const prefixCls = PREFIX_CLS;
|
|
894
|
-
return /* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ jsx27("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion`, className) }, rest), { children }));
|
|
895
2113
|
});
|
|
896
2114
|
var Accordion_default = Accordion;
|
|
897
2115
|
|
|
898
2116
|
// src/components/Accordion/AccordionItem.tsx
|
|
899
|
-
import { createContext as
|
|
2117
|
+
import { createContext as createContext6, forwardRef as forwardRef24, useContext as useContext8, useId } from "react";
|
|
2118
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2119
|
+
var AccordionItemContext = createContext6(null);
|
|
2120
|
+
var useAccordionItem = () => {
|
|
2121
|
+
const context = useContext8(AccordionItemContext);
|
|
2122
|
+
if (!context) {
|
|
2123
|
+
throw new Error("`useAccordionItem` must be used within a `<AccordionItem />`");
|
|
2124
|
+
}
|
|
2125
|
+
return context;
|
|
2126
|
+
};
|
|
2127
|
+
var AccordionItem = forwardRef24((props, ref) => {
|
|
2128
|
+
const _a = props, { children, className, value: valueProp } = _a, rest = __objRest(_a, ["children", "className", "value"]);
|
|
2129
|
+
const prefixCls = PREFIX_CLS;
|
|
2130
|
+
const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
|
|
2131
|
+
const id = useId();
|
|
2132
|
+
const value = valueProp != null ? valueProp : id;
|
|
2133
|
+
return /* @__PURE__ */ jsx28(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ jsx28("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ jsx28(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
|
|
2134
|
+
});
|
|
2135
|
+
var AccordionItem_default = AccordionItem;
|
|
900
2136
|
|
|
901
|
-
// src/
|
|
902
|
-
import {
|
|
2137
|
+
// src/components/Accordion/AccordionHeader.tsx
|
|
2138
|
+
import { forwardRef as forwardRef25 } from "react";
|
|
2139
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2140
|
+
var AccordionHeader = forwardRef25((props, ref) => {
|
|
2141
|
+
const _a = props, { className, title, subtitle, startContent, endContent } = _a, rest = __objRest(_a, ["className", "title", "subtitle", "startContent", "endContent"]);
|
|
2142
|
+
const prefixCls = PREFIX_CLS;
|
|
2143
|
+
const { isOpen } = useCollapse();
|
|
2144
|
+
return /* @__PURE__ */ jsx29(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs20("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
|
|
2145
|
+
startContent && /* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
|
|
2146
|
+
/* @__PURE__ */ jsxs20("div", { className: `${prefixCls}accordion-header__content`, children: [
|
|
2147
|
+
/* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__title`, children: title }),
|
|
2148
|
+
subtitle && /* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
|
|
2149
|
+
] }),
|
|
2150
|
+
/* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ jsxs20("div", { className: "us-d-flex us-items-center us-gap-1", children: [
|
|
2151
|
+
endContent,
|
|
2152
|
+
/* @__PURE__ */ jsx29(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ jsx29(Icon_default, { children: isOpen ? /* @__PURE__ */ jsx29(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx29(ChevronDownIcon_default, {}) }) })
|
|
2153
|
+
] }) })
|
|
2154
|
+
] })) });
|
|
2155
|
+
});
|
|
2156
|
+
var AccordionHeader_default = AccordionHeader;
|
|
903
2157
|
|
|
904
|
-
// src/
|
|
905
|
-
import {
|
|
2158
|
+
// src/components/Accordion/AccordionPanel.tsx
|
|
2159
|
+
import { forwardRef as forwardRef26 } from "react";
|
|
2160
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2161
|
+
var AccordionPanel = forwardRef26((_a, ref) => {
|
|
2162
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
2163
|
+
const prefixCls = PREFIX_CLS;
|
|
2164
|
+
return /* @__PURE__ */ jsx30(CollapseContent_default, { children: /* @__PURE__ */ jsx30("div", { ref, children: /* @__PURE__ */ jsx30("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-panel`, className) }, rest), { children })) }) });
|
|
2165
|
+
});
|
|
2166
|
+
var AccordionPanel_default = AccordionPanel;
|
|
906
2167
|
|
|
907
|
-
// src/
|
|
908
|
-
import {
|
|
909
|
-
|
|
910
|
-
var
|
|
2168
|
+
// src/components/Accordion/AccordionContent.tsx
|
|
2169
|
+
import { forwardRef as forwardRef27 } from "react";
|
|
2170
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2171
|
+
var AccordionContent = forwardRef27((_a, ref) => {
|
|
2172
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
2173
|
+
const prefixCls = PREFIX_CLS;
|
|
2174
|
+
return /* @__PURE__ */ jsx31(CollapseContent_default, { children: /* @__PURE__ */ jsx31("div", { ref, children: /* @__PURE__ */ jsx31("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-content`, className) }, rest), { children })) }) });
|
|
2175
|
+
});
|
|
2176
|
+
var AccordionContent_default = AccordionContent;
|
|
911
2177
|
|
|
912
|
-
// src/
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
savedHandler.current = handler;
|
|
917
|
-
}, [handler]);
|
|
918
|
-
}
|
|
919
|
-
var useEventListener_default = useEventListener;
|
|
920
|
-
|
|
921
|
-
// src/hooks/useLocalStorage.tsx
|
|
922
|
-
function useLocalStorage(key, initialValue) {
|
|
923
|
-
const readValue = useCallback(() => {
|
|
924
|
-
if (typeof window === "undefined") {
|
|
925
|
-
return initialValue;
|
|
926
|
-
}
|
|
927
|
-
try {
|
|
928
|
-
const item = window.localStorage.getItem(key);
|
|
929
|
-
return item ? parseJSON(item) : initialValue;
|
|
930
|
-
} catch (error) {
|
|
931
|
-
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
932
|
-
return initialValue;
|
|
933
|
-
}
|
|
934
|
-
}, [initialValue, key]);
|
|
935
|
-
const [storedValue, setStoredValue] = useState3(readValue);
|
|
936
|
-
const setValue = useCallback(
|
|
937
|
-
(value) => {
|
|
938
|
-
if (typeof window == "undefined") {
|
|
939
|
-
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
940
|
-
}
|
|
941
|
-
try {
|
|
942
|
-
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
943
|
-
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
944
|
-
setStoredValue(newValue);
|
|
945
|
-
window.dispatchEvent(new Event("local-storage"));
|
|
946
|
-
} catch (error) {
|
|
947
|
-
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
948
|
-
}
|
|
949
|
-
},
|
|
950
|
-
[key, storedValue]
|
|
951
|
-
);
|
|
952
|
-
useEffect5(() => {
|
|
953
|
-
setStoredValue(readValue());
|
|
954
|
-
}, []);
|
|
955
|
-
const handleStorageChange = useCallback(() => {
|
|
956
|
-
setStoredValue(readValue());
|
|
957
|
-
}, [readValue]);
|
|
958
|
-
useEventListener_default("storage", handleStorageChange);
|
|
959
|
-
useEventListener_default("local-storage", handleStorageChange);
|
|
960
|
-
return [storedValue, setValue];
|
|
961
|
-
}
|
|
962
|
-
function parseJSON(value) {
|
|
963
|
-
try {
|
|
964
|
-
return value === "undefined" ? void 0 : JSON.parse(value != null ? value : "");
|
|
965
|
-
} catch (e) {
|
|
966
|
-
return void 0;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
// src/hooks/usePrevious.tsx
|
|
971
|
-
import { useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
972
|
-
var usePrevious = (value) => {
|
|
973
|
-
const ref = useRef6();
|
|
974
|
-
useEffect6(() => {
|
|
975
|
-
ref.current = value;
|
|
976
|
-
});
|
|
977
|
-
return ref.current;
|
|
978
|
-
};
|
|
979
|
-
|
|
980
|
-
// src/hooks/useDisclosure.ts
|
|
981
|
-
import { useState as useState4 } from "react";
|
|
982
|
-
var useDisclosure = ({ defaultValue } = {}) => {
|
|
983
|
-
const [isOpen, setIsOpen] = useState4(defaultValue || false);
|
|
984
|
-
const onOpen = () => {
|
|
985
|
-
setIsOpen(true);
|
|
986
|
-
};
|
|
987
|
-
const onClose = () => {
|
|
988
|
-
setIsOpen(false);
|
|
989
|
-
};
|
|
990
|
-
const onToggle = () => {
|
|
991
|
-
setIsOpen((prevState) => !prevState);
|
|
992
|
-
};
|
|
993
|
-
return {
|
|
994
|
-
isOpen,
|
|
995
|
-
onOpen,
|
|
996
|
-
onClose,
|
|
997
|
-
onToggle
|
|
998
|
-
};
|
|
999
|
-
};
|
|
1000
|
-
var useDisclosure_default = useDisclosure;
|
|
1001
|
-
|
|
1002
|
-
// src/hooks/useStep.tsx
|
|
1003
|
-
import { useCallback as useCallback2, useMemo as useMemo4, useState as useState5 } from "react";
|
|
1004
|
-
var useStep = (maxStep) => {
|
|
1005
|
-
const [currentStep, setCurrentStep] = useState5(1);
|
|
1006
|
-
const canGoToNextStep = useMemo4(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
1007
|
-
const canGoToPrevStep = useMemo4(() => currentStep - 1 >= 1, [currentStep]);
|
|
1008
|
-
const setStep = useCallback2(
|
|
1009
|
-
(step) => {
|
|
1010
|
-
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
1011
|
-
if (newStep >= 1 && newStep <= maxStep) {
|
|
1012
|
-
setCurrentStep(newStep);
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
throw new Error("Step not valid");
|
|
1016
|
-
},
|
|
1017
|
-
[maxStep, currentStep]
|
|
1018
|
-
);
|
|
1019
|
-
const goToNextStep = useCallback2(() => {
|
|
1020
|
-
if (canGoToNextStep) {
|
|
1021
|
-
setCurrentStep((step) => step + 1);
|
|
1022
|
-
}
|
|
1023
|
-
}, [canGoToNextStep]);
|
|
1024
|
-
const goToPrevStep = useCallback2(() => {
|
|
1025
|
-
if (canGoToPrevStep) {
|
|
1026
|
-
setCurrentStep((step) => step - 1);
|
|
1027
|
-
}
|
|
1028
|
-
}, [canGoToPrevStep]);
|
|
1029
|
-
const reset = useCallback2(() => {
|
|
1030
|
-
setCurrentStep(1);
|
|
1031
|
-
}, []);
|
|
1032
|
-
return [
|
|
1033
|
-
currentStep,
|
|
1034
|
-
{
|
|
1035
|
-
goToNextStep,
|
|
1036
|
-
goToPrevStep,
|
|
1037
|
-
canGoToNextStep,
|
|
1038
|
-
canGoToPrevStep,
|
|
1039
|
-
setStep,
|
|
1040
|
-
reset
|
|
1041
|
-
}
|
|
1042
|
-
];
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
|
-
// src/components/Accordion/AccordionItem.tsx
|
|
1046
|
-
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1047
|
-
var AccordionItemContext = createContext4(null);
|
|
1048
|
-
var useAccordionItem = () => {
|
|
1049
|
-
const context = useContext6(AccordionItemContext);
|
|
1050
|
-
if (!context) {
|
|
1051
|
-
throw new Error("`useAccordionItem` must be used within a `<AccordionItem />`");
|
|
1052
|
-
}
|
|
1053
|
-
return context;
|
|
1054
|
-
};
|
|
1055
|
-
var AccordionItem = forwardRef17((props, ref) => {
|
|
1056
|
-
const _a = props, { children, className, value: valueProp } = _a, rest = __objRest(_a, ["children", "className", "value"]);
|
|
1057
|
-
const prefixCls = PREFIX_CLS;
|
|
1058
|
-
const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
|
|
1059
|
-
const id = useId();
|
|
1060
|
-
const value = valueProp != null ? valueProp : id;
|
|
1061
|
-
return /* @__PURE__ */ jsx18(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ jsx18("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ jsx18(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
|
|
1062
|
-
});
|
|
1063
|
-
var AccordionItem_default = AccordionItem;
|
|
1064
|
-
|
|
1065
|
-
// src/components/Accordion/AccordionHeader.tsx
|
|
1066
|
-
import { forwardRef as forwardRef18 } from "react";
|
|
1067
|
-
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1068
|
-
var AccordionHeader = forwardRef18((props, ref) => {
|
|
1069
|
-
const _a = props, { className, title, subtitle, startContent, endContent } = _a, rest = __objRest(_a, ["className", "title", "subtitle", "startContent", "endContent"]);
|
|
1070
|
-
const prefixCls = PREFIX_CLS;
|
|
1071
|
-
const { isOpen } = useCollapse();
|
|
1072
|
-
return /* @__PURE__ */ jsx19(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs14("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
|
|
1073
|
-
startContent && /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
|
|
1074
|
-
/* @__PURE__ */ jsxs14("div", { className: `${prefixCls}accordion-header__content`, children: [
|
|
1075
|
-
/* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__title`, children: title }),
|
|
1076
|
-
subtitle && /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
|
|
1077
|
-
] }),
|
|
1078
|
-
/* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ jsxs14("div", { className: "us-d-flex us-items-center us-gap-1", children: [
|
|
1079
|
-
endContent,
|
|
1080
|
-
/* @__PURE__ */ jsx19(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ jsx19(Icon_default, { children: isOpen ? /* @__PURE__ */ jsx19(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx19(ChevronDownIcon_default, {}) }) })
|
|
1081
|
-
] }) })
|
|
1082
|
-
] })) });
|
|
1083
|
-
});
|
|
1084
|
-
var AccordionHeader_default = AccordionHeader;
|
|
1085
|
-
|
|
1086
|
-
// src/components/Accordion/AccordionPanel.tsx
|
|
1087
|
-
import { forwardRef as forwardRef19 } from "react";
|
|
1088
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1089
|
-
var AccordionPanel = forwardRef19((_a, ref) => {
|
|
1090
|
-
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
1091
|
-
const prefixCls = PREFIX_CLS;
|
|
1092
|
-
return /* @__PURE__ */ jsx20(CollapseContent_default, { children: /* @__PURE__ */ jsx20("div", { ref, children: /* @__PURE__ */ jsx20("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-panel`, className) }, rest), { children })) }) });
|
|
1093
|
-
});
|
|
1094
|
-
var AccordionPanel_default = AccordionPanel;
|
|
1095
|
-
|
|
1096
|
-
// src/components/Accordion/AccordionContent.tsx
|
|
1097
|
-
import { forwardRef as forwardRef20 } from "react";
|
|
1098
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1099
|
-
var AccordionContent = forwardRef20((_a, ref) => {
|
|
1100
|
-
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
1101
|
-
const prefixCls = PREFIX_CLS;
|
|
1102
|
-
return /* @__PURE__ */ jsx21(CollapseContent_default, { children: /* @__PURE__ */ jsx21("div", { ref, children: /* @__PURE__ */ jsx21("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-content`, className) }, rest), { children })) }) });
|
|
1103
|
-
});
|
|
1104
|
-
var AccordionContent_default = AccordionContent;
|
|
1105
|
-
|
|
1106
|
-
// src/components/Tabs/Tab.tsx
|
|
1107
|
-
import clsx14 from "clsx";
|
|
1108
|
-
import mergeRefs3 from "merge-refs";
|
|
1109
|
-
import { forwardRef as forwardRef21, useEffect as useEffect7, useId as useId2, useRef as useRef7 } from "react";
|
|
1110
|
-
|
|
1111
|
-
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
1112
|
-
import React3 from "react";
|
|
1113
|
-
|
|
1114
|
-
// ../../../node_modules/react-icons/lib/esm/iconContext.js
|
|
1115
|
-
import React2 from "react";
|
|
1116
|
-
var DefaultContext = {
|
|
1117
|
-
color: void 0,
|
|
1118
|
-
size: void 0,
|
|
1119
|
-
className: void 0,
|
|
1120
|
-
style: void 0,
|
|
1121
|
-
attr: void 0
|
|
1122
|
-
};
|
|
1123
|
-
var IconContext = React2.createContext && React2.createContext(DefaultContext);
|
|
1124
|
-
|
|
1125
|
-
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
1126
|
-
var __assign = function() {
|
|
1127
|
-
__assign = Object.assign || function(t) {
|
|
1128
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1129
|
-
s = arguments[i];
|
|
1130
|
-
for (var p in s)
|
|
1131
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1132
|
-
t[p] = s[p];
|
|
1133
|
-
}
|
|
1134
|
-
return t;
|
|
1135
|
-
};
|
|
1136
|
-
return __assign.apply(this, arguments);
|
|
1137
|
-
};
|
|
1138
|
-
var __rest = function(s, e) {
|
|
1139
|
-
var t = {};
|
|
1140
|
-
for (var p in s)
|
|
1141
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1142
|
-
t[p] = s[p];
|
|
1143
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1144
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1145
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1146
|
-
t[p[i]] = s[p[i]];
|
|
1147
|
-
}
|
|
1148
|
-
return t;
|
|
1149
|
-
};
|
|
1150
|
-
function Tree2Element(tree) {
|
|
1151
|
-
return tree && tree.map(function(node, i) {
|
|
1152
|
-
return React3.createElement(node.tag, __assign({
|
|
1153
|
-
key: i
|
|
1154
|
-
}, node.attr), Tree2Element(node.child));
|
|
1155
|
-
});
|
|
1156
|
-
}
|
|
1157
|
-
function GenIcon(data) {
|
|
1158
|
-
return function(props) {
|
|
1159
|
-
return React3.createElement(IconBase, __assign({
|
|
1160
|
-
attr: __assign({}, data.attr)
|
|
1161
|
-
}, props), Tree2Element(data.child));
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
function IconBase(props) {
|
|
1165
|
-
var elem = function(conf) {
|
|
1166
|
-
var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
|
|
1167
|
-
var computedSize = size || conf.size || "1em";
|
|
1168
|
-
var className;
|
|
1169
|
-
if (conf.className)
|
|
1170
|
-
className = conf.className;
|
|
1171
|
-
if (props.className)
|
|
1172
|
-
className = (className ? className + " " : "") + props.className;
|
|
1173
|
-
return React3.createElement("svg", __assign({
|
|
1174
|
-
stroke: "currentColor",
|
|
1175
|
-
fill: "currentColor",
|
|
1176
|
-
strokeWidth: "0"
|
|
1177
|
-
}, conf.attr, attr, svgProps, {
|
|
1178
|
-
className,
|
|
1179
|
-
style: __assign(__assign({
|
|
1180
|
-
color: props.color || conf.color
|
|
1181
|
-
}, conf.style), props.style),
|
|
1182
|
-
height: computedSize,
|
|
1183
|
-
width: computedSize,
|
|
1184
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1185
|
-
}), title && React3.createElement("title", null, title), props.children);
|
|
1186
|
-
};
|
|
1187
|
-
return IconContext !== void 0 ? React3.createElement(IconContext.Consumer, null, function(conf) {
|
|
1188
|
-
return elem(conf);
|
|
1189
|
-
}) : elem(DefaultContext);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
// ../../../node_modules/react-icons/tb/index.esm.js
|
|
1193
|
-
function TbX(props) {
|
|
1194
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M18 6l-12 12" } }, { "tag": "path", "attr": { "d": "M6 6l12 12" } }] })(props);
|
|
1195
|
-
}
|
|
2178
|
+
// src/components/Tabs/Tab.tsx
|
|
2179
|
+
import clsx14 from "clsx";
|
|
2180
|
+
import mergeRefs4 from "merge-refs";
|
|
2181
|
+
import { forwardRef as forwardRef28, useEffect as useEffect17, useId as useId2, useRef as useRef12 } from "react";
|
|
1196
2182
|
|
|
1197
2183
|
// src/components/Tabs/TabsContext.ts
|
|
1198
|
-
import { createContext as
|
|
1199
|
-
var TabsContext =
|
|
2184
|
+
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
2185
|
+
var TabsContext = createContext7(null);
|
|
1200
2186
|
var useTabs = () => {
|
|
1201
|
-
const context =
|
|
2187
|
+
const context = useContext9(TabsContext);
|
|
1202
2188
|
if (!context) {
|
|
1203
2189
|
throw new Error("`useTabs` must be used within a `<Tabs />`");
|
|
1204
2190
|
}
|
|
@@ -1206,8 +2192,8 @@ var useTabs = () => {
|
|
|
1206
2192
|
};
|
|
1207
2193
|
|
|
1208
2194
|
// src/components/Tabs/Tab.tsx
|
|
1209
|
-
import { jsx as
|
|
1210
|
-
var Tab =
|
|
2195
|
+
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2196
|
+
var Tab = forwardRef28(
|
|
1211
2197
|
(_a, ref) => {
|
|
1212
2198
|
var _b = _a, {
|
|
1213
2199
|
as: Component = "div",
|
|
@@ -1215,6 +2201,8 @@ var Tab = forwardRef21(
|
|
|
1215
2201
|
className,
|
|
1216
2202
|
role = "presentation",
|
|
1217
2203
|
value: valueProp,
|
|
2204
|
+
startContent,
|
|
2205
|
+
endContent,
|
|
1218
2206
|
closable,
|
|
1219
2207
|
disabled,
|
|
1220
2208
|
onClick
|
|
@@ -1224,22 +2212,25 @@ var Tab = forwardRef21(
|
|
|
1224
2212
|
"className",
|
|
1225
2213
|
"role",
|
|
1226
2214
|
"value",
|
|
2215
|
+
"startContent",
|
|
2216
|
+
"endContent",
|
|
1227
2217
|
"closable",
|
|
1228
2218
|
"disabled",
|
|
1229
2219
|
"onClick"
|
|
1230
2220
|
]);
|
|
1231
|
-
const tabRef =
|
|
2221
|
+
const tabRef = useRef12(null);
|
|
1232
2222
|
const id = useId2();
|
|
1233
2223
|
const value = valueProp != null ? valueProp : id;
|
|
1234
2224
|
const _a2 = useTabs(), { onClose, registerItem } = _a2, tabs = __objRest(_a2, ["onClose", "registerItem"]);
|
|
2225
|
+
const prefixCls = PREFIX_CLS;
|
|
1235
2226
|
const handleClick = (event) => {
|
|
1236
2227
|
const previousTab = tabs.previousTabRef.current;
|
|
1237
2228
|
const currentTab = tabRef.current;
|
|
1238
2229
|
if (!currentTab)
|
|
1239
2230
|
return;
|
|
1240
2231
|
if (previousTab) {
|
|
1241
|
-
const previousIndicator = previousTab.querySelector(`.${
|
|
1242
|
-
const currentIndicator = currentTab.querySelector(`.${
|
|
2232
|
+
const previousIndicator = previousTab.querySelector(`.${prefixCls}tab__indicator`);
|
|
2233
|
+
const currentIndicator = currentTab.querySelector(`.${prefixCls}tab__indicator`);
|
|
1243
2234
|
if (!previousIndicator || !currentIndicator)
|
|
1244
2235
|
return;
|
|
1245
2236
|
const from = {};
|
|
@@ -1270,31 +2261,35 @@ var Tab = forwardRef21(
|
|
|
1270
2261
|
event.stopPropagation();
|
|
1271
2262
|
onClose(value);
|
|
1272
2263
|
};
|
|
1273
|
-
|
|
2264
|
+
useEffect17(() => {
|
|
1274
2265
|
registerItem({ value, disabled });
|
|
1275
2266
|
if (value === tabs.value) {
|
|
1276
2267
|
tabs.previousTabRef.current = tabRef.current;
|
|
1277
2268
|
}
|
|
1278
2269
|
}, [value, tabs.value]);
|
|
1279
|
-
return /* @__PURE__ */
|
|
2270
|
+
return /* @__PURE__ */ jsxs21(
|
|
1280
2271
|
Component,
|
|
1281
2272
|
__spreadProps(__spreadValues({
|
|
1282
|
-
ref:
|
|
2273
|
+
ref: mergeRefs4(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
|
|
1283
2274
|
className: clsx14(
|
|
1284
|
-
`${
|
|
1285
|
-
{ [`${
|
|
2275
|
+
`${prefixCls}tab`,
|
|
2276
|
+
{ [`${prefixCls}tab--selected`]: value === tabs.value, [`${prefixCls}tab--disabled`]: disabled },
|
|
1286
2277
|
className
|
|
1287
2278
|
),
|
|
1288
2279
|
role,
|
|
1289
2280
|
onClick: handleClick
|
|
1290
2281
|
}, rest), {
|
|
1291
2282
|
children: [
|
|
1292
|
-
/* @__PURE__ */
|
|
1293
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsx32("div", { className: `${prefixCls}overlay`, children: /* @__PURE__ */ jsx32("div", { className: `${prefixCls}overlay__surface` }) }),
|
|
2284
|
+
/* @__PURE__ */ jsxs21("div", { className: `${prefixCls}tab__content`, children: [
|
|
2285
|
+
startContent && /* @__PURE__ */ jsx32("div", { className: `${prefixCls}tab__start-content`, children: startContent }),
|
|
1294
2286
|
children,
|
|
1295
|
-
closable && /* @__PURE__ */
|
|
2287
|
+
endContent || closable && /* @__PURE__ */ jsxs21("div", { className: `${prefixCls}tab__end-content`, children: [
|
|
2288
|
+
endContent,
|
|
2289
|
+
closable && /* @__PURE__ */ jsx32(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ jsx32(Icon_default, { children: /* @__PURE__ */ jsx32(CloseIcon_default, {}) }) })
|
|
2290
|
+
] })
|
|
1296
2291
|
] }),
|
|
1297
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx32("div", { className: `${prefixCls}tab__indicator` })
|
|
1298
2293
|
]
|
|
1299
2294
|
})
|
|
1300
2295
|
);
|
|
@@ -1303,8 +2298,8 @@ var Tab = forwardRef21(
|
|
|
1303
2298
|
|
|
1304
2299
|
// src/components/Tabs/Tabs.tsx
|
|
1305
2300
|
import clsx15 from "clsx";
|
|
1306
|
-
import { useEffect as
|
|
1307
|
-
import { jsx as
|
|
2301
|
+
import { useEffect as useEffect18, useRef as useRef13, useState as useState12 } from "react";
|
|
2302
|
+
import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1308
2303
|
var Tabs = (_a) => {
|
|
1309
2304
|
var _b = _a, {
|
|
1310
2305
|
children,
|
|
@@ -1323,11 +2318,11 @@ var Tabs = (_a) => {
|
|
|
1323
2318
|
"onChange",
|
|
1324
2319
|
"onClose"
|
|
1325
2320
|
]);
|
|
1326
|
-
const tabsRef =
|
|
1327
|
-
const tabRefs =
|
|
1328
|
-
const previousTabRef =
|
|
1329
|
-
const [selfValue, setSelfValue] =
|
|
1330
|
-
const [items, setItems] =
|
|
2321
|
+
const tabsRef = useRef13(null);
|
|
2322
|
+
const tabRefs = useRef13({});
|
|
2323
|
+
const previousTabRef = useRef13(null);
|
|
2324
|
+
const [selfValue, setSelfValue] = useState12(value != null ? value : defaultValue);
|
|
2325
|
+
const [items, setItems] = useState12([]);
|
|
1331
2326
|
const registerItem = (item) => {
|
|
1332
2327
|
setItems((prevItems) => {
|
|
1333
2328
|
const index = prevItems.findIndex((item2) => item2.value);
|
|
@@ -1354,24 +2349,24 @@ var Tabs = (_a) => {
|
|
|
1354
2349
|
const handleClose = (value2) => {
|
|
1355
2350
|
onClose == null ? void 0 : onClose(value2);
|
|
1356
2351
|
};
|
|
1357
|
-
|
|
2352
|
+
useEffect18(() => {
|
|
1358
2353
|
if (value !== void 0) {
|
|
1359
2354
|
setSelfValue(value);
|
|
1360
2355
|
scrollToTab(value);
|
|
1361
2356
|
}
|
|
1362
2357
|
}, [value]);
|
|
1363
|
-
|
|
2358
|
+
useEffect18(() => {
|
|
1364
2359
|
if (value === void 0) {
|
|
1365
2360
|
const item = items.find((tab) => !tab.disabled);
|
|
1366
2361
|
setSelfValue(item == null ? void 0 : item.value);
|
|
1367
2362
|
}
|
|
1368
2363
|
}, [value, items]);
|
|
1369
|
-
return /* @__PURE__ */
|
|
2364
|
+
return /* @__PURE__ */ jsxs22(
|
|
1370
2365
|
TabsContext.Provider,
|
|
1371
2366
|
{
|
|
1372
2367
|
value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
|
|
1373
2368
|
children: [
|
|
1374
|
-
/* @__PURE__ */
|
|
2369
|
+
/* @__PURE__ */ jsx33(
|
|
1375
2370
|
"div",
|
|
1376
2371
|
__spreadProps(__spreadValues({
|
|
1377
2372
|
ref: tabsRef,
|
|
@@ -1380,7 +2375,7 @@ var Tabs = (_a) => {
|
|
|
1380
2375
|
children
|
|
1381
2376
|
})
|
|
1382
2377
|
),
|
|
1383
|
-
/* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsx33("div", { className: `${PREFIX_CLS}divider` })
|
|
1384
2379
|
]
|
|
1385
2380
|
}
|
|
1386
2381
|
);
|
|
@@ -1388,788 +2383,573 @@ var Tabs = (_a) => {
|
|
|
1388
2383
|
|
|
1389
2384
|
// src/components/Toolbar/Toolbar.tsx
|
|
1390
2385
|
import clsx16 from "clsx";
|
|
1391
|
-
import { Fragment as
|
|
2386
|
+
import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1392
2387
|
var Toolbar = (props) => {
|
|
1393
|
-
const _a = props, {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
2388
|
+
const _a = props, {
|
|
2389
|
+
children,
|
|
2390
|
+
className,
|
|
2391
|
+
size = "md",
|
|
2392
|
+
startContent,
|
|
2393
|
+
endContent,
|
|
2394
|
+
startAction,
|
|
2395
|
+
endAction,
|
|
2396
|
+
title,
|
|
2397
|
+
subtitle
|
|
2398
|
+
} = _a, rest = __objRest(_a, [
|
|
2399
|
+
"children",
|
|
2400
|
+
"className",
|
|
2401
|
+
"size",
|
|
2402
|
+
"startContent",
|
|
2403
|
+
"endContent",
|
|
2404
|
+
"startAction",
|
|
2405
|
+
"endAction",
|
|
2406
|
+
"title",
|
|
2407
|
+
"subtitle"
|
|
2408
|
+
]);
|
|
2409
|
+
const prefixCls = PREFIX_CLS;
|
|
2410
|
+
return /* @__PURE__ */ jsxs23("div", __spreadProps(__spreadValues({ className: clsx16(`${prefixCls}toolbar`, { [`${prefixCls}toolbar--${size}`]: size }, className) }, rest), { children: [
|
|
2411
|
+
/* @__PURE__ */ jsx34("div", { className: `${prefixCls}outline-b` }),
|
|
2412
|
+
/* @__PURE__ */ jsxs23("div", { className: clsx16(`${prefixCls}toolbar__container`), children: [
|
|
2413
|
+
startContent ? /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__start-content`), children: startContent }) : startAction && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__start-action`), children: startAction }),
|
|
2414
|
+
/* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
2415
|
+
title && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__title`), children: title }),
|
|
2416
|
+
subtitle && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__subtitle`), children: subtitle })
|
|
1401
2417
|
] }) : children }),
|
|
1402
|
-
endAction && /* @__PURE__ */
|
|
2418
|
+
endContent ? /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__end-content`), children: endContent }) : endAction && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__end-action`), children: endAction })
|
|
1403
2419
|
] })
|
|
1404
2420
|
] }));
|
|
1405
2421
|
};
|
|
1406
2422
|
var Toolbar_default = Toolbar;
|
|
1407
2423
|
|
|
1408
|
-
// src/components/
|
|
1409
|
-
import {
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
)
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
2424
|
+
// src/components/TextInput/TextInput.tsx
|
|
2425
|
+
import { forwardRef as forwardRef29, useRef as useRef14, useState as useState13 } from "react";
|
|
2426
|
+
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2427
|
+
var TextInput = forwardRef29(
|
|
2428
|
+
(_a, ref) => {
|
|
2429
|
+
var _b = _a, { className, value, defaultValue, disabled, inputRef, startContent, endContent, style, onChange, onClick } = _b, rest = __objRest(_b, ["className", "value", "defaultValue", "disabled", "inputRef", "startContent", "endContent", "style", "onChange", "onClick"]);
|
|
2430
|
+
const [focus, setFocus] = useState13(false);
|
|
2431
|
+
const selfInputRef = useRef14(null);
|
|
2432
|
+
const prefixCls = PREFIX_CLS;
|
|
2433
|
+
const handleChange = (event) => {
|
|
2434
|
+
onChange == null ? void 0 : onChange(event);
|
|
2435
|
+
};
|
|
2436
|
+
const handleClick = (event) => {
|
|
2437
|
+
var _a2;
|
|
2438
|
+
onClick == null ? void 0 : onClick(event);
|
|
2439
|
+
(_a2 = selfInputRef == null ? void 0 : selfInputRef.current) == null ? void 0 : _a2.focus();
|
|
2440
|
+
};
|
|
2441
|
+
return /* @__PURE__ */ jsxs24(
|
|
2442
|
+
"div",
|
|
2443
|
+
{
|
|
2444
|
+
ref,
|
|
2445
|
+
className: clsx_default(
|
|
2446
|
+
`${prefixCls}input`,
|
|
2447
|
+
{ [`${prefixCls}input--focus`]: focus, [`${prefixCls}input--disabled`]: disabled },
|
|
2448
|
+
className
|
|
2449
|
+
),
|
|
2450
|
+
style,
|
|
2451
|
+
onFocus: () => {
|
|
2452
|
+
setFocus(true);
|
|
2453
|
+
},
|
|
2454
|
+
onBlur: () => {
|
|
2455
|
+
setFocus(false);
|
|
2456
|
+
},
|
|
2457
|
+
onClick: handleClick,
|
|
2458
|
+
children: [
|
|
2459
|
+
/* @__PURE__ */ jsx35("div", { className: `${prefixCls}outline` }),
|
|
2460
|
+
/* @__PURE__ */ jsxs24("div", { className: `${prefixCls}input__content`, children: [
|
|
2461
|
+
startContent && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
2462
|
+
/* @__PURE__ */ jsx35(
|
|
2463
|
+
"input",
|
|
2464
|
+
__spreadValues({
|
|
2465
|
+
ref: mergeRefs_default(selfInputRef, inputRef),
|
|
2466
|
+
className: `${prefixCls}input__field`,
|
|
2467
|
+
value,
|
|
2468
|
+
defaultValue,
|
|
2469
|
+
disabled,
|
|
2470
|
+
onChange: handleChange
|
|
2471
|
+
}, rest)
|
|
2472
|
+
),
|
|
2473
|
+
endContent && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}input__end-content`, children: endContent })
|
|
2474
|
+
] })
|
|
2475
|
+
]
|
|
2476
|
+
}
|
|
2477
|
+
);
|
|
2478
|
+
}
|
|
2479
|
+
);
|
|
2480
|
+
var TextInput_default = TextInput;
|
|
1424
2481
|
|
|
1425
|
-
// src/components/
|
|
1426
|
-
import
|
|
1427
|
-
import {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
data: propData,
|
|
1435
|
-
filter: filterProp,
|
|
1436
|
-
keyField: keyField2 = "key",
|
|
1437
|
-
textField: textField3 = "text",
|
|
1438
|
-
placeholder,
|
|
1439
|
-
virtual,
|
|
1440
|
-
filterable,
|
|
1441
|
-
disabled,
|
|
1442
|
-
loading,
|
|
1443
|
-
className,
|
|
1444
|
-
onChange,
|
|
1445
|
-
onFilterChange
|
|
1446
|
-
}) => {
|
|
1447
|
-
const [value, setValue] = useState7(valueProp);
|
|
1448
|
-
const [filter, setFilter] = useState7(filterProp);
|
|
1449
|
-
const handleChange = (event) => {
|
|
1450
|
-
const value2 = event.target.value || null;
|
|
1451
|
-
if (valueProp !== void 0) {
|
|
1452
|
-
onChange(value2);
|
|
1453
|
-
} else {
|
|
1454
|
-
setValue(value2);
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
const pageSize3 = virtual == null ? void 0 : virtual.pageSize;
|
|
1458
|
-
const filteredData = useRef9([]);
|
|
1459
|
-
const [state, setState] = useState7({
|
|
1460
|
-
skip: 0,
|
|
1461
|
-
total: propData.total,
|
|
1462
|
-
subsetData: propData.items.slice(0, pageSize3)
|
|
1463
|
-
});
|
|
1464
|
-
const handleFilterChange = (event) => {
|
|
1465
|
-
if (pageSize3) {
|
|
1466
|
-
filteredData.current = filterBy(propData.items.slice(), event.filter);
|
|
1467
|
-
const data = filteredData.current.slice(0, pageSize3);
|
|
1468
|
-
setState({
|
|
1469
|
-
subsetData: data,
|
|
1470
|
-
skip: 0,
|
|
1471
|
-
total: filteredData.current.length
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
const filter2 = event.filter.value;
|
|
1475
|
-
if (filterProp !== void 0) {
|
|
1476
|
-
onFilterChange == null ? void 0 : onFilterChange(filter2);
|
|
1477
|
-
} else {
|
|
1478
|
-
setFilter(filter2);
|
|
1479
|
-
}
|
|
1480
|
-
};
|
|
1481
|
-
const handlePageChange = (event) => {
|
|
1482
|
-
if (pageSize3) {
|
|
1483
|
-
const skip = event.page.skip;
|
|
1484
|
-
const take = event.page.take;
|
|
1485
|
-
const newSubsetData = filteredData.current.slice(skip, skip + take);
|
|
1486
|
-
setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
|
|
1487
|
-
}
|
|
1488
|
-
};
|
|
1489
|
-
useEffect9(() => {
|
|
1490
|
-
if (valueProp !== void 0) {
|
|
1491
|
-
setValue(valueProp);
|
|
1492
|
-
}
|
|
1493
|
-
}, [valueProp]);
|
|
1494
|
-
useEffect9(() => {
|
|
1495
|
-
setFilter(filterProp);
|
|
1496
|
-
}, [filterProp]);
|
|
1497
|
-
useEffect9(() => {
|
|
1498
|
-
if (pageSize3) {
|
|
1499
|
-
filteredData.current = propData.items.slice();
|
|
1500
|
-
}
|
|
1501
|
-
}, [propData]);
|
|
1502
|
-
return /* @__PURE__ */ jsx25(
|
|
1503
|
-
ComboBox,
|
|
1504
|
-
{
|
|
2482
|
+
// src/components/Switch/Switch.tsx
|
|
2483
|
+
import clsx17 from "clsx";
|
|
2484
|
+
import { forwardRef as forwardRef30, useEffect as useEffect19, useState as useState14 } from "react";
|
|
2485
|
+
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2486
|
+
var Switch = forwardRef30(
|
|
2487
|
+
(_a, ref) => {
|
|
2488
|
+
var _b = _a, {
|
|
2489
|
+
id,
|
|
2490
|
+
name,
|
|
1505
2491
|
value,
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
ComboBox as ComboBox2
|
|
1531
|
-
} from "@progress/kendo-react-dropdowns";
|
|
1532
|
-
import { cloneElement as cloneElement5, useCallback as useCallback3, useEffect as useEffect10, useRef as useRef10, useState as useState8 } from "react";
|
|
1533
|
-
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1534
|
-
var textField = "ContactName";
|
|
1535
|
-
var emptyItem = { [textField]: "loading ...", CustomerID: 0 };
|
|
1536
|
-
var pageSize = 10;
|
|
1537
|
-
var loadingData = [];
|
|
1538
|
-
while (loadingData.length < pageSize) {
|
|
1539
|
-
loadingData.push(__spreadValues({}, emptyItem));
|
|
1540
|
-
}
|
|
1541
|
-
var SelectServer = ({
|
|
1542
|
-
data: dataProp,
|
|
1543
|
-
value: valueProp,
|
|
1544
|
-
keyField: keyField2 = "key",
|
|
1545
|
-
textField: textField3 = "text",
|
|
1546
|
-
placeholder,
|
|
1547
|
-
virtual,
|
|
1548
|
-
filterable,
|
|
1549
|
-
filter: filterProp = "",
|
|
1550
|
-
disabled,
|
|
1551
|
-
loading,
|
|
1552
|
-
className,
|
|
1553
|
-
onChange,
|
|
1554
|
-
onDataChange,
|
|
1555
|
-
onFilterChange,
|
|
1556
|
-
getData,
|
|
1557
|
-
renderItem
|
|
1558
|
-
}) => {
|
|
1559
|
-
var _a;
|
|
1560
|
-
const dataCaching = useRef10([]);
|
|
1561
|
-
const pendingRequest = useRef10();
|
|
1562
|
-
const requestStarted = useRef10(false);
|
|
1563
|
-
const emptyItem3 = { [keyField2]: 0, [textField3]: "loading ..." };
|
|
1564
|
-
const [loadingData3, setLoadingData] = useState8([]);
|
|
1565
|
-
const [data, setData] = useState8(dataProp.items);
|
|
1566
|
-
const [total, setTotal] = useState8(0);
|
|
1567
|
-
const [value, setValue] = useState8(valueProp);
|
|
1568
|
-
const [filter, setFilter] = useState8(filterProp);
|
|
1569
|
-
const pageSize3 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
|
|
1570
|
-
const skipRef = useRef10(0);
|
|
1571
|
-
const resetCach = () => {
|
|
1572
|
-
dataCaching.current.length = 0;
|
|
1573
|
-
};
|
|
1574
|
-
const requestData = useCallback3(
|
|
1575
|
-
(state) => {
|
|
1576
|
-
const { skip } = state;
|
|
1577
|
-
if (requestStarted.current) {
|
|
1578
|
-
clearTimeout(pendingRequest.current);
|
|
1579
|
-
pendingRequest.current = setTimeout(() => {
|
|
1580
|
-
requestData(state);
|
|
1581
|
-
}, 50);
|
|
1582
|
-
return;
|
|
1583
|
-
}
|
|
1584
|
-
requestStarted.current = true;
|
|
1585
|
-
getData(state).then(({ items, total: total2 }) => {
|
|
1586
|
-
items.forEach((item, index) => {
|
|
1587
|
-
dataCaching.current[index + skip] = item;
|
|
1588
|
-
});
|
|
1589
|
-
if (skip === skipRef.current) {
|
|
1590
|
-
setData(items);
|
|
1591
|
-
setTotal(total2);
|
|
1592
|
-
onDataChange == null ? void 0 : onDataChange({ items, total: total2 });
|
|
1593
|
-
}
|
|
1594
|
-
requestStarted.current = false;
|
|
1595
|
-
}).catch(() => {
|
|
1596
|
-
requestStarted.current = false;
|
|
1597
|
-
});
|
|
1598
|
-
},
|
|
1599
|
-
[getData]
|
|
1600
|
-
);
|
|
1601
|
-
const handleFilterChange = useCallback3((event) => {
|
|
1602
|
-
const filter2 = event.filter.value;
|
|
1603
|
-
if (filterProp !== void 0) {
|
|
1604
|
-
onFilterChange == null ? void 0 : onFilterChange(filter2);
|
|
1605
|
-
} else {
|
|
1606
|
-
setFilter(filter2);
|
|
1607
|
-
}
|
|
1608
|
-
resetCach();
|
|
1609
|
-
requestData({ skip: 0, filter: filter2 });
|
|
1610
|
-
setData(loadingData3);
|
|
1611
|
-
skipRef.current = 0;
|
|
1612
|
-
}, []);
|
|
1613
|
-
const shouldRequestData = useCallback3((skip) => {
|
|
1614
|
-
for (let i = 0; i < pageSize3; i++) {
|
|
1615
|
-
if (!dataCaching.current[skip + i]) {
|
|
1616
|
-
return true;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
return false;
|
|
1620
|
-
}, []);
|
|
1621
|
-
const getCachedData = useCallback3((skip) => {
|
|
1622
|
-
const data2 = [];
|
|
1623
|
-
for (let i = 0; i < pageSize3; i++) {
|
|
1624
|
-
data2.push(dataCaching.current[i + skip] || emptyItem3);
|
|
1625
|
-
}
|
|
1626
|
-
return data2;
|
|
1627
|
-
}, []);
|
|
1628
|
-
const pageChange = useCallback3(
|
|
1629
|
-
(event) => {
|
|
1630
|
-
if (filter !== void 0) {
|
|
1631
|
-
const newSkip = event.page.skip;
|
|
1632
|
-
if (shouldRequestData(newSkip)) {
|
|
1633
|
-
requestData({ skip: newSkip, filter });
|
|
1634
|
-
}
|
|
1635
|
-
const data2 = getCachedData(newSkip);
|
|
1636
|
-
setData(data2);
|
|
1637
|
-
skipRef.current = newSkip;
|
|
1638
|
-
}
|
|
1639
|
-
},
|
|
1640
|
-
[getCachedData, requestData, shouldRequestData, filter]
|
|
1641
|
-
);
|
|
1642
|
-
const handleChange = useCallback3((event) => {
|
|
1643
|
-
const value2 = event.target.value;
|
|
1644
|
-
if (value2 && value2[textField3] === emptyItem3[textField3]) {
|
|
1645
|
-
return;
|
|
1646
|
-
}
|
|
1647
|
-
if (valueProp !== void 0) {
|
|
1648
|
-
onChange(value2);
|
|
1649
|
-
} else {
|
|
1650
|
-
setValue(value2);
|
|
1651
|
-
}
|
|
1652
|
-
}, []);
|
|
1653
|
-
const handleItemRender = (li, itemProps) => {
|
|
1654
|
-
const itemChildren = renderItem == null ? void 0 : renderItem(itemProps.dataItem);
|
|
1655
|
-
if (!itemChildren)
|
|
1656
|
-
return cloneElement5(li, li.props);
|
|
1657
|
-
return cloneElement5(li, li.props, itemChildren);
|
|
1658
|
-
};
|
|
1659
|
-
useEffect10(() => {
|
|
1660
|
-
const pageSize4 = 10;
|
|
1661
|
-
const loadingData4 = [];
|
|
1662
|
-
while (loadingData4.length < pageSize4) {
|
|
1663
|
-
loadingData4.push(emptyItem3);
|
|
1664
|
-
}
|
|
1665
|
-
setLoadingData(loadingData4);
|
|
1666
|
-
}, []);
|
|
1667
|
-
useEffect10(() => {
|
|
1668
|
-
if (valueProp !== void 0) {
|
|
1669
|
-
setValue(valueProp);
|
|
1670
|
-
}
|
|
1671
|
-
}, [valueProp]);
|
|
1672
|
-
useEffect10(() => {
|
|
1673
|
-
if (filterProp !== void 0) {
|
|
1674
|
-
setFilter(filterProp);
|
|
1675
|
-
}
|
|
1676
|
-
}, [filterProp]);
|
|
1677
|
-
useEffect10(() => {
|
|
1678
|
-
requestData({ skip: 0, filter });
|
|
1679
|
-
return () => {
|
|
1680
|
-
resetCach();
|
|
1681
|
-
};
|
|
1682
|
-
}, [filter, requestData]);
|
|
1683
|
-
useEffect10(() => {
|
|
1684
|
-
setData(dataProp.items);
|
|
1685
|
-
}, [dataProp]);
|
|
1686
|
-
return /* @__PURE__ */ jsx26(
|
|
1687
|
-
ComboBox2,
|
|
1688
|
-
{
|
|
1689
|
-
data,
|
|
1690
|
-
value,
|
|
1691
|
-
placeholder,
|
|
1692
|
-
dataItemKey: keyField2,
|
|
1693
|
-
textField: textField3,
|
|
1694
|
-
filterable,
|
|
1695
|
-
onFilterChange: handleFilterChange,
|
|
1696
|
-
virtual: {
|
|
1697
|
-
pageSize: pageSize3,
|
|
1698
|
-
skip: skipRef.current,
|
|
1699
|
-
total
|
|
1700
|
-
},
|
|
1701
|
-
disabled,
|
|
1702
|
-
loading,
|
|
1703
|
-
className,
|
|
1704
|
-
onChange: handleChange,
|
|
1705
|
-
onPageChange: pageChange,
|
|
1706
|
-
itemRender: handleItemRender
|
|
1707
|
-
}
|
|
1708
|
-
);
|
|
1709
|
-
};
|
|
1710
|
-
var SelectServer_default = SelectServer;
|
|
1711
|
-
|
|
1712
|
-
// src/components/Select/Select.tsx
|
|
1713
|
-
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1714
|
-
var Select = (props) => {
|
|
1715
|
-
return props.filterMode === "client" ? /* @__PURE__ */ jsx27(SelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx27(SelectServer_default, __spreadValues({}, props));
|
|
1716
|
-
};
|
|
1717
|
-
var Select_default = Select;
|
|
1718
|
-
|
|
1719
|
-
// src/components/Switch/Switch.tsx
|
|
1720
|
-
import clsx17 from "clsx";
|
|
1721
|
-
import { forwardRef as forwardRef23, useEffect as useEffect11, useState as useState9 } from "react";
|
|
1722
|
-
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1723
|
-
var Switch = forwardRef23(
|
|
1724
|
-
(_a, ref) => {
|
|
1725
|
-
var _b = _a, { name, value: valueProp, defaultValue, onChange: onChangeProp, disabled } = _b, rest = __objRest(_b, ["name", "value", "defaultValue", "onChange", "disabled"]);
|
|
1726
|
-
var _a2;
|
|
1727
|
-
const [selftValue, setSelfValue] = useState9((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : false);
|
|
1728
|
-
const handleChange = () => {
|
|
1729
|
-
if (disabled) {
|
|
1730
|
-
return;
|
|
1731
|
-
}
|
|
1732
|
-
onChangeProp == null ? void 0 : onChangeProp(!selftValue);
|
|
1733
|
-
setSelfValue(!selftValue);
|
|
2492
|
+
defaultValue,
|
|
2493
|
+
checked: checkedProp,
|
|
2494
|
+
defaultChecked,
|
|
2495
|
+
onChange,
|
|
2496
|
+
onCheckedChange: onCheckedChangeProp,
|
|
2497
|
+
disabled
|
|
2498
|
+
} = _b, rest = __objRest(_b, [
|
|
2499
|
+
"id",
|
|
2500
|
+
"name",
|
|
2501
|
+
"value",
|
|
2502
|
+
"defaultValue",
|
|
2503
|
+
"checked",
|
|
2504
|
+
"defaultChecked",
|
|
2505
|
+
"onChange",
|
|
2506
|
+
"onCheckedChange",
|
|
2507
|
+
"disabled"
|
|
2508
|
+
]);
|
|
2509
|
+
const [selftChecked, setSelfChecked] = useState14(checkedProp);
|
|
2510
|
+
const prefixCls = PREFIX_CLS;
|
|
2511
|
+
const handleChange = (event) => {
|
|
2512
|
+
const { value: value2, checked } = event.target;
|
|
2513
|
+
setSelfChecked(checked);
|
|
2514
|
+
onChange == null ? void 0 : onChange(value2);
|
|
2515
|
+
onCheckedChangeProp == null ? void 0 : onCheckedChangeProp(checked);
|
|
1734
2516
|
};
|
|
1735
|
-
|
|
1736
|
-
if (
|
|
1737
|
-
|
|
2517
|
+
useEffect19(() => {
|
|
2518
|
+
if (checkedProp !== void 0) {
|
|
2519
|
+
setSelfChecked(checkedProp);
|
|
1738
2520
|
}
|
|
1739
|
-
}, [
|
|
1740
|
-
return /* @__PURE__ */
|
|
2521
|
+
}, [checkedProp]);
|
|
2522
|
+
return /* @__PURE__ */ jsxs25(
|
|
1741
2523
|
"label",
|
|
1742
|
-
{
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
2524
|
+
__spreadProps(__spreadValues({
|
|
2525
|
+
ref,
|
|
2526
|
+
htmlFor: id,
|
|
2527
|
+
className: clsx17(`${prefixCls}switch`, {
|
|
2528
|
+
[`${prefixCls}switch--checked`]: !!selftChecked
|
|
2529
|
+
})
|
|
2530
|
+
}, rest), {
|
|
1747
2531
|
children: [
|
|
1748
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ jsx36(
|
|
1749
2533
|
"input",
|
|
1750
|
-
|
|
2534
|
+
{
|
|
1751
2535
|
type: "checkbox",
|
|
1752
|
-
|
|
2536
|
+
id,
|
|
1753
2537
|
name,
|
|
1754
|
-
|
|
1755
|
-
|
|
2538
|
+
value,
|
|
2539
|
+
defaultValue,
|
|
2540
|
+
checked: selftChecked,
|
|
2541
|
+
defaultChecked,
|
|
1756
2542
|
disabled,
|
|
1757
2543
|
onChange: handleChange
|
|
1758
|
-
}
|
|
2544
|
+
}
|
|
1759
2545
|
),
|
|
1760
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx36("div", { className: `${prefixCls}switch__thumb` })
|
|
1761
2547
|
]
|
|
1762
|
-
}
|
|
2548
|
+
})
|
|
1763
2549
|
);
|
|
1764
2550
|
}
|
|
1765
2551
|
);
|
|
1766
2552
|
var Switch_default = Switch;
|
|
1767
2553
|
|
|
1768
|
-
// src/components/
|
|
1769
|
-
import {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
} from "
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
var
|
|
1777
|
-
var
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
onFilterChange
|
|
1797
|
-
}) => {
|
|
1798
|
-
const [value, setValue] = useState10(valueProp);
|
|
1799
|
-
const [filter, setFilter] = useState10(filterProp);
|
|
1800
|
-
const handleChange = (event) => {
|
|
1801
|
-
onChange(event.target.value);
|
|
1802
|
-
};
|
|
1803
|
-
const pageSize3 = virtual == null ? void 0 : virtual.pageSize;
|
|
1804
|
-
const filteredData = useRef11([]);
|
|
1805
|
-
const [state, setState] = useState10({
|
|
1806
|
-
skip: 0,
|
|
1807
|
-
total: dataProp.total,
|
|
1808
|
-
subsetData: dataProp.items.slice(0, pageSize3)
|
|
1809
|
-
});
|
|
1810
|
-
const handleFilterChange = (event) => {
|
|
1811
|
-
if (pageSize3) {
|
|
1812
|
-
filteredData.current = filterBy2(dataProp.items.slice(), event.filter);
|
|
1813
|
-
const data = filteredData.current.slice(0, pageSize3);
|
|
1814
|
-
setState({
|
|
1815
|
-
subsetData: data,
|
|
1816
|
-
skip: 0,
|
|
1817
|
-
total: filteredData.current.length
|
|
1818
|
-
});
|
|
1819
|
-
}
|
|
1820
|
-
onFilterChange == null ? void 0 : onFilterChange(event.filter.value);
|
|
1821
|
-
};
|
|
1822
|
-
const pageChange = (event) => {
|
|
1823
|
-
if (pageSize3) {
|
|
1824
|
-
const skip = event.page.skip;
|
|
1825
|
-
const take = event.page.take;
|
|
1826
|
-
const newSubsetData = filteredData.current.slice(skip, skip + take);
|
|
1827
|
-
setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
|
|
1828
|
-
}
|
|
2554
|
+
// src/components/Select/Select.tsx
|
|
2555
|
+
import { useEffect as useEffect22, useMemo as useMemo7, useRef as useRef17, useState as useState15 } from "react";
|
|
2556
|
+
|
|
2557
|
+
// src/components/Select/SelectContent.tsx
|
|
2558
|
+
import { Fragment as Fragment6, useEffect as useEffect20, useRef as useRef15 } from "react";
|
|
2559
|
+
|
|
2560
|
+
// src/components/Select/SelectContext.tsx
|
|
2561
|
+
import { createContext as createContext8, useContext as useContext10 } from "react";
|
|
2562
|
+
var SelectContext = createContext8(null);
|
|
2563
|
+
var useSelect = () => {
|
|
2564
|
+
const context = useContext10(SelectContext);
|
|
2565
|
+
if (!context) {
|
|
2566
|
+
throw new Error("`useSelect` must be used within a `<Select />`");
|
|
2567
|
+
}
|
|
2568
|
+
return context;
|
|
2569
|
+
};
|
|
2570
|
+
var SelectContext_default = SelectContext;
|
|
2571
|
+
|
|
2572
|
+
// src/components/Select/SelectContent.tsx
|
|
2573
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2574
|
+
var SelectContent = () => {
|
|
2575
|
+
const { data, values, offset, setOffset, keyField, textField, onItemSelect, renderItem } = useSelect();
|
|
2576
|
+
const parentRef = useRef15(null);
|
|
2577
|
+
const { isOpen } = usePopover();
|
|
2578
|
+
const handleItemSelect = (item) => {
|
|
2579
|
+
var _a;
|
|
2580
|
+
onItemSelect(item);
|
|
2581
|
+
setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
|
|
1829
2582
|
};
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
}, [
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
filteredData.current = dataProp.items.slice();
|
|
1839
|
-
}
|
|
1840
|
-
}, [dataProp]);
|
|
1841
|
-
return /* @__PURE__ */ jsx29(
|
|
1842
|
-
MultiSelect,
|
|
2583
|
+
useEffect20(() => {
|
|
2584
|
+
var _a;
|
|
2585
|
+
if (!isOpen)
|
|
2586
|
+
return;
|
|
2587
|
+
(_a = parentRef.current) == null ? void 0 : _a.scrollTo({ top: offset });
|
|
2588
|
+
}, [isOpen]);
|
|
2589
|
+
return /* @__PURE__ */ jsx37(
|
|
2590
|
+
ScrollArea_default,
|
|
1843
2591
|
{
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
} :
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
2592
|
+
ref: parentRef,
|
|
2593
|
+
style: {
|
|
2594
|
+
height: `200px`,
|
|
2595
|
+
width: `100%`,
|
|
2596
|
+
position: "relative"
|
|
2597
|
+
},
|
|
2598
|
+
children: /* @__PURE__ */ jsx37(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx37(Fragment6, { children: renderItem(item, {
|
|
2599
|
+
title: "",
|
|
2600
|
+
selected: values.includes(item[keyField]),
|
|
2601
|
+
hoverable: true,
|
|
2602
|
+
onClick: () => handleItemSelect(item)
|
|
2603
|
+
}) }, item[keyField])) : data.map((item) => /* @__PURE__ */ jsx37(
|
|
2604
|
+
ListItem_default,
|
|
2605
|
+
{
|
|
2606
|
+
title: item[textField],
|
|
2607
|
+
selected: values.includes(item[keyField]),
|
|
2608
|
+
hoverable: true,
|
|
2609
|
+
onClick: () => handleItemSelect(item)
|
|
2610
|
+
},
|
|
2611
|
+
item[keyField]
|
|
2612
|
+
)) })
|
|
1862
2613
|
}
|
|
1863
2614
|
);
|
|
1864
2615
|
};
|
|
1865
|
-
var
|
|
2616
|
+
var SelectContent_default = SelectContent;
|
|
1866
2617
|
|
|
1867
|
-
// src/components/
|
|
1868
|
-
import {
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
onFilterChange,
|
|
1888
|
-
getData
|
|
1889
|
-
}) => {
|
|
1890
|
-
var _a;
|
|
1891
|
-
const dataCaching = useRef12([]);
|
|
1892
|
-
const pendingRequest = useRef12();
|
|
1893
|
-
const requestStarted = useRef12(false);
|
|
1894
|
-
const emptyItem3 = { [keyField2]: 0, [textField3]: "loading ..." };
|
|
1895
|
-
const [loadingData3, setLoadingData] = useState11([]);
|
|
1896
|
-
const [data, setData] = useState11(dataProp.items);
|
|
1897
|
-
const [total, setTotal] = useState11(0);
|
|
1898
|
-
const [value, setValue] = useState11(valueProp);
|
|
1899
|
-
const [filter, setFilter] = useState11(filterProp);
|
|
1900
|
-
const pageSize3 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
|
|
1901
|
-
const skipRef = useRef12(0);
|
|
1902
|
-
const resetCach = () => {
|
|
1903
|
-
dataCaching.current.length = 0;
|
|
2618
|
+
// src/components/Select/SelectVirtual.tsx
|
|
2619
|
+
import { Fragment as Fragment7, useEffect as useEffect21, useRef as useRef16 } from "react";
|
|
2620
|
+
|
|
2621
|
+
// src/components/Select/utils.ts
|
|
2622
|
+
var valueToValues2 = (value) => {
|
|
2623
|
+
return Array.isArray(value) ? value : value !== null ? [value] : [];
|
|
2624
|
+
};
|
|
2625
|
+
var valuesToValue2 = (values) => {
|
|
2626
|
+
return Array.isArray(values) ? values.length !== 0 ? values[0] : null : values;
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
// src/components/Select/SelectVirtual.tsx
|
|
2630
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2631
|
+
var SelectVirtual = () => {
|
|
2632
|
+
const { data, values, keyField, textField, virtual, onItemSelect, renderItem } = useSelect();
|
|
2633
|
+
const parentRef = useRef16(null);
|
|
2634
|
+
const virtualizer = useVirtualizer_default(__spreadProps(__spreadValues({}, virtual), { count: data.length, parentRef }));
|
|
2635
|
+
const { isOpen } = usePopover();
|
|
2636
|
+
const handleItemSelect = (item) => {
|
|
2637
|
+
onItemSelect(item);
|
|
1904
2638
|
};
|
|
1905
|
-
|
|
1906
|
-
(
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2639
|
+
useEffect21(() => {
|
|
2640
|
+
if (!isOpen)
|
|
2641
|
+
return;
|
|
2642
|
+
const value = valuesToValue2(values);
|
|
2643
|
+
const index = data.findIndex((item) => item[keyField] === value);
|
|
2644
|
+
virtualizer.scrollToIndex(index, { align: "start" });
|
|
2645
|
+
}, [isOpen]);
|
|
2646
|
+
if (!virtual)
|
|
2647
|
+
return null;
|
|
2648
|
+
return /* @__PURE__ */ jsx38(
|
|
2649
|
+
ScrollArea_default,
|
|
2650
|
+
{
|
|
2651
|
+
ref: parentRef,
|
|
2652
|
+
autoHide: true,
|
|
2653
|
+
style: {
|
|
2654
|
+
height: `200px`,
|
|
2655
|
+
width: `100%`,
|
|
2656
|
+
position: "relative"
|
|
2657
|
+
},
|
|
2658
|
+
children: /* @__PURE__ */ jsx38(List_default, { children: /* @__PURE__ */ jsx38(
|
|
2659
|
+
"div",
|
|
2660
|
+
{
|
|
2661
|
+
style: {
|
|
2662
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
2663
|
+
width: "100%",
|
|
2664
|
+
position: "relative"
|
|
2665
|
+
},
|
|
2666
|
+
children: virtualizer.getVirtualItems().map((virtualItem) => {
|
|
2667
|
+
const isLoaderRow = virtualItem.index > data.length - 1;
|
|
2668
|
+
const item = data[virtualItem.index];
|
|
2669
|
+
if (isLoaderRow) {
|
|
2670
|
+
return /* @__PURE__ */ jsx38(
|
|
2671
|
+
ListItem_default,
|
|
2672
|
+
{
|
|
2673
|
+
title: virtual.hasNextPage ? "Loading..." : "Nothing more to load",
|
|
2674
|
+
style: {
|
|
2675
|
+
position: "absolute",
|
|
2676
|
+
top: 0,
|
|
2677
|
+
left: 0,
|
|
2678
|
+
width: "100%",
|
|
2679
|
+
height: `${virtualItem.size}px`,
|
|
2680
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
2681
|
+
}
|
|
2682
|
+
},
|
|
2683
|
+
virtualItem.index
|
|
2684
|
+
);
|
|
2685
|
+
}
|
|
2686
|
+
if (!item) {
|
|
2687
|
+
return /* @__PURE__ */ jsx38(
|
|
2688
|
+
ListItem_default,
|
|
2689
|
+
{
|
|
2690
|
+
title: `Item ${virtualItem.index} not found`,
|
|
2691
|
+
style: {
|
|
2692
|
+
position: "absolute",
|
|
2693
|
+
top: 0,
|
|
2694
|
+
left: 0,
|
|
2695
|
+
width: "100%",
|
|
2696
|
+
height: `${virtualItem.size}px`,
|
|
2697
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
virtualItem.index
|
|
2701
|
+
);
|
|
2702
|
+
}
|
|
2703
|
+
if (renderItem) {
|
|
2704
|
+
return /* @__PURE__ */ jsx38(Fragment7, { children: renderItem(item, {
|
|
2705
|
+
title: "",
|
|
2706
|
+
selected: values.includes(item[keyField]),
|
|
2707
|
+
hoverable: true,
|
|
2708
|
+
style: {
|
|
2709
|
+
position: "absolute",
|
|
2710
|
+
top: 0,
|
|
2711
|
+
left: 0,
|
|
2712
|
+
width: "100%",
|
|
2713
|
+
height: `${virtualItem.size}px`,
|
|
2714
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
2715
|
+
},
|
|
2716
|
+
onClick: () => handleItemSelect(item)
|
|
2717
|
+
}) }, virtualItem.index);
|
|
2718
|
+
}
|
|
2719
|
+
return /* @__PURE__ */ jsx38(
|
|
2720
|
+
ListItem_default,
|
|
2721
|
+
{
|
|
2722
|
+
title: item[textField],
|
|
2723
|
+
selected: values.includes(item[keyField]),
|
|
2724
|
+
hoverable: true,
|
|
2725
|
+
style: {
|
|
2726
|
+
position: "absolute",
|
|
2727
|
+
top: 0,
|
|
2728
|
+
left: 0,
|
|
2729
|
+
width: "100%",
|
|
2730
|
+
height: `${virtualItem.size}px`,
|
|
2731
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
2732
|
+
},
|
|
2733
|
+
onClick: () => handleItemSelect(item)
|
|
2734
|
+
},
|
|
2735
|
+
virtualItem.index
|
|
2736
|
+
);
|
|
2737
|
+
})
|
|
1924
2738
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
requestStarted.current = false;
|
|
1928
|
-
});
|
|
1929
|
-
},
|
|
1930
|
-
[getData]
|
|
2739
|
+
) })
|
|
2740
|
+
}
|
|
1931
2741
|
);
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2742
|
+
};
|
|
2743
|
+
var SelectVirtual_default = SelectVirtual;
|
|
2744
|
+
|
|
2745
|
+
// src/components/Select/Select.tsx
|
|
2746
|
+
import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2747
|
+
var Select = (props) => {
|
|
2748
|
+
const {
|
|
2749
|
+
data,
|
|
2750
|
+
value: valueProp,
|
|
2751
|
+
keyField = "key",
|
|
2752
|
+
textField = "text",
|
|
2753
|
+
isMultiple = false,
|
|
2754
|
+
disabled,
|
|
2755
|
+
loading,
|
|
2756
|
+
disclosure: disclosureProp,
|
|
2757
|
+
virtual,
|
|
2758
|
+
placeholder,
|
|
2759
|
+
style,
|
|
2760
|
+
startContent,
|
|
2761
|
+
endContent,
|
|
2762
|
+
renderItem
|
|
2763
|
+
} = props;
|
|
2764
|
+
const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
|
|
2765
|
+
const prefixCls = PREFIX_CLS;
|
|
2766
|
+
const inputRef = useRef17(null);
|
|
2767
|
+
const [search, setSearch] = useState15("");
|
|
2768
|
+
const [isSearch, setIsSearch] = useState15(false);
|
|
2769
|
+
const [focus, setFocus] = useState15(false);
|
|
2770
|
+
const values = useMemo7(() => {
|
|
2771
|
+
return valueToValues2(valueProp);
|
|
2772
|
+
}, [valueProp]);
|
|
2773
|
+
const items = useMemo7(() => {
|
|
2774
|
+
return data.filter((item) => values.includes(item[keyField]));
|
|
2775
|
+
}, [data, values]);
|
|
2776
|
+
const [offset, setOffset] = useState15(0);
|
|
2777
|
+
const handleClick = () => {
|
|
2778
|
+
var _a;
|
|
2779
|
+
(_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.focus();
|
|
2780
|
+
};
|
|
2781
|
+
const handleChange = (values2) => {
|
|
2782
|
+
var _a, _b, _c, _d, _e;
|
|
2783
|
+
if (props.isMultiple) {
|
|
2784
|
+
const items2 = data.filter((item) => values2.includes(item[keyField]));
|
|
2785
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, items2);
|
|
2786
|
+
(_b = props.onValueChange) == null ? void 0 : _b.call(props, values2);
|
|
2787
|
+
} else {
|
|
2788
|
+
const newValue = valuesToValue2(values2);
|
|
2789
|
+
let item = null;
|
|
2790
|
+
if (newValue !== null) {
|
|
2791
|
+
item = (_c = data.find((item2) => item2[keyField] === newValue)) != null ? _c : null;
|
|
1945
2792
|
}
|
|
2793
|
+
(_d = props.onChange) == null ? void 0 : _d.call(props, item);
|
|
2794
|
+
(_e = props.onValueChange) == null ? void 0 : _e.call(props, newValue);
|
|
1946
2795
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2796
|
+
};
|
|
2797
|
+
const handleClear = (event) => {
|
|
2798
|
+
var _a, _b, _c, _d;
|
|
2799
|
+
event.stopPropagation();
|
|
2800
|
+
setIsSearch(true);
|
|
2801
|
+
setSearch("");
|
|
2802
|
+
if (props.isMultiple) {
|
|
2803
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, []);
|
|
2804
|
+
(_b = props.onValueChange) == null ? void 0 : _b.call(props, []);
|
|
2805
|
+
} else {
|
|
2806
|
+
(_c = props.onChange) == null ? void 0 : _c.call(props, null);
|
|
2807
|
+
(_d = props.onValueChange) == null ? void 0 : _d.call(props, null);
|
|
1953
2808
|
}
|
|
1954
|
-
|
|
1955
|
-
}
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
2809
|
+
setIsSearch(false);
|
|
2810
|
+
};
|
|
2811
|
+
const handleItemSelect = (item) => {
|
|
2812
|
+
var _a;
|
|
2813
|
+
const newValue = item[keyField];
|
|
2814
|
+
if (props.isMultiple) {
|
|
2815
|
+
const newValues = [...values];
|
|
2816
|
+
const valueIndex = values.indexOf(newValue);
|
|
2817
|
+
if (valueIndex === -1) {
|
|
2818
|
+
newValues.push(newValue);
|
|
2819
|
+
} else {
|
|
2820
|
+
newValues.splice(valueIndex, 1);
|
|
1961
2821
|
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2822
|
+
handleChange(newValues);
|
|
2823
|
+
} else {
|
|
2824
|
+
const value = valuesToValue2(values);
|
|
2825
|
+
if (value !== newValue) {
|
|
2826
|
+
handleChange([newValue]);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
setIsSearch(false);
|
|
2830
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
2831
|
+
disclosure.onClose();
|
|
2832
|
+
};
|
|
2833
|
+
const handleOpen = () => {
|
|
2834
|
+
disclosure.onOpen();
|
|
2835
|
+
setFocus(true);
|
|
2836
|
+
};
|
|
2837
|
+
const handleClose = () => {
|
|
2838
|
+
disclosure.onClose();
|
|
2839
|
+
if (!props.isMultiple) {
|
|
2840
|
+
if (isSearch) {
|
|
2841
|
+
const item = items[0];
|
|
2842
|
+
if (item !== void 0) {
|
|
2843
|
+
setSearch(item[textField]);
|
|
2844
|
+
} else {
|
|
2845
|
+
setSearch("");
|
|
2846
|
+
}
|
|
2847
|
+
setIsSearch(false);
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
useEffect22(() => {
|
|
2852
|
+
if (isSearch)
|
|
1971
2853
|
return;
|
|
2854
|
+
if (!props.isMultiple) {
|
|
2855
|
+
const item = items[0];
|
|
2856
|
+
if (item !== void 0) {
|
|
2857
|
+
setSearch(item[textField]);
|
|
2858
|
+
}
|
|
1972
2859
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
while (loadingData4.length < pageSize4) {
|
|
1980
|
-
loadingData4.push(emptyItem3);
|
|
2860
|
+
}, [items]);
|
|
2861
|
+
useEffect22(() => {
|
|
2862
|
+
const values2 = valueToValues2(valueProp);
|
|
2863
|
+
const value = values2[0];
|
|
2864
|
+
if (value === void 0) {
|
|
2865
|
+
setSearch("");
|
|
1981
2866
|
}
|
|
1982
|
-
setLoadingData(loadingData4);
|
|
1983
|
-
}, []);
|
|
1984
|
-
useEffect13(() => {
|
|
1985
|
-
setData(dataProp.items);
|
|
1986
|
-
}, [dataProp]);
|
|
1987
|
-
useEffect13(() => {
|
|
1988
|
-
setValue(valueProp);
|
|
1989
2867
|
}, [valueProp]);
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}, [filterProp]);
|
|
1993
|
-
useEffect13(() => {
|
|
1994
|
-
requestData({ skip: 0, filter });
|
|
1995
|
-
return () => {
|
|
1996
|
-
resetCach();
|
|
1997
|
-
};
|
|
1998
|
-
}, [filter, requestData]);
|
|
1999
|
-
return /* @__PURE__ */ jsx30(
|
|
2000
|
-
MultiSelect2,
|
|
2868
|
+
return /* @__PURE__ */ jsx39(
|
|
2869
|
+
SelectContext_default.Provider,
|
|
2001
2870
|
{
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2871
|
+
value: {
|
|
2872
|
+
data,
|
|
2873
|
+
values,
|
|
2874
|
+
keyField,
|
|
2875
|
+
textField,
|
|
2876
|
+
isMultiple,
|
|
2877
|
+
virtual,
|
|
2878
|
+
onChange: handleChange,
|
|
2879
|
+
onItemSelect: handleItemSelect,
|
|
2880
|
+
offset,
|
|
2881
|
+
setOffset,
|
|
2882
|
+
renderItem
|
|
2013
2883
|
},
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2884
|
+
children: /* @__PURE__ */ jsxs26(
|
|
2885
|
+
Popover_default,
|
|
2886
|
+
__spreadProps(__spreadValues({
|
|
2887
|
+
target: true
|
|
2888
|
+
}, disclosure), {
|
|
2889
|
+
isOpen: disclosure.isOpen,
|
|
2890
|
+
onOpen: handleOpen,
|
|
2891
|
+
onClose: handleClose,
|
|
2892
|
+
autoClose: "outside",
|
|
2893
|
+
children: [
|
|
2894
|
+
/* @__PURE__ */ jsx39(PopoverTrigger_default, { children: /* @__PURE__ */ jsxs26(
|
|
2895
|
+
"div",
|
|
2896
|
+
{
|
|
2897
|
+
className: clsx_default(`${prefixCls}input`, {
|
|
2898
|
+
[`${prefixCls}input--focus`]: focus,
|
|
2899
|
+
[`${prefixCls}input--disabled`]: disabled
|
|
2900
|
+
}),
|
|
2901
|
+
style,
|
|
2902
|
+
onClick: handleClick,
|
|
2903
|
+
onFocus: () => {
|
|
2904
|
+
setFocus(true);
|
|
2905
|
+
},
|
|
2906
|
+
onBlur: () => {
|
|
2907
|
+
setFocus(false);
|
|
2908
|
+
},
|
|
2909
|
+
children: [
|
|
2910
|
+
/* @__PURE__ */ jsx39("input", { type: "text", ref: inputRef, style: { position: "absolute", opacity: 0 } }),
|
|
2911
|
+
/* @__PURE__ */ jsx39("div", { className: `${prefixCls}outline` }),
|
|
2912
|
+
/* @__PURE__ */ jsxs26("div", { className: `${prefixCls}input__content`, children: [
|
|
2913
|
+
startContent && /* @__PURE__ */ jsx39("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
2914
|
+
/* @__PURE__ */ jsx39("div", { className: `${prefixCls}input__field`, children: search || placeholder }),
|
|
2915
|
+
/* @__PURE__ */ jsxs26("div", { className: `${prefixCls}input__end-content`, children: [
|
|
2916
|
+
endContent,
|
|
2917
|
+
loading ? /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ jsx39(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(CloseIcon_default, {}) }) }),
|
|
2918
|
+
/* @__PURE__ */ jsx39("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx39(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx39(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx39(ChevronDownIcon_default, {}) }) })
|
|
2919
|
+
] })
|
|
2920
|
+
] })
|
|
2921
|
+
]
|
|
2922
|
+
}
|
|
2923
|
+
) }),
|
|
2924
|
+
/* @__PURE__ */ jsx39(PopoverContent_default, { children: /* @__PURE__ */ jsx39("div", { children: virtual ? /* @__PURE__ */ jsx39(SelectVirtual_default, {}) : /* @__PURE__ */ jsx39(SelectContent_default, {}) }) })
|
|
2925
|
+
]
|
|
2926
|
+
})
|
|
2927
|
+
)
|
|
2019
2928
|
}
|
|
2020
2929
|
);
|
|
2021
2930
|
};
|
|
2022
|
-
var
|
|
2023
|
-
|
|
2024
|
-
// src/components/MultiSelect/MultiSelect.tsx
|
|
2025
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2026
|
-
var MultiSelect3 = (props) => {
|
|
2027
|
-
return props.filterMode === "client" ? /* @__PURE__ */ jsx31(MultiSelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx31(MultiSelectServer_default, __spreadValues({}, props));
|
|
2028
|
-
};
|
|
2029
|
-
var MultiSelect_default = MultiSelect3;
|
|
2931
|
+
var Select_default = Select;
|
|
2030
2932
|
|
|
2031
2933
|
// src/components/Field/Field.tsx
|
|
2032
|
-
import { forwardRef as
|
|
2033
|
-
import { jsx as
|
|
2034
|
-
var Field =
|
|
2934
|
+
import { forwardRef as forwardRef31 } from "react";
|
|
2935
|
+
import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2936
|
+
var Field = forwardRef31(({ children, label }, ref) => {
|
|
2035
2937
|
{
|
|
2036
2938
|
const prefixCls = PREFIX_CLS;
|
|
2037
|
-
return /* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsxs27("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
|
|
2940
|
+
/* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__label`, children: label }),
|
|
2941
|
+
/* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__content`, children })
|
|
2040
2942
|
] });
|
|
2041
2943
|
}
|
|
2042
2944
|
});
|
|
2043
2945
|
var Field_default = Field;
|
|
2044
|
-
|
|
2045
|
-
// src/components/List/List.tsx
|
|
2046
|
-
import { forwardRef as forwardRef25 } from "react";
|
|
2047
|
-
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2048
|
-
var List = forwardRef25((_a, ref) => {
|
|
2049
|
-
var _b = _a, { as: Component = "div", children } = _b, rest = __objRest(_b, ["as", "children"]);
|
|
2050
|
-
return /* @__PURE__ */ jsx33(Component, __spreadProps(__spreadValues({ ref, className: "us-list" }, rest), { children }));
|
|
2051
|
-
});
|
|
2052
|
-
var List_default = List;
|
|
2053
|
-
|
|
2054
|
-
// src/components/List/ListGroup.tsx
|
|
2055
|
-
import { forwardRef as forwardRef27 } from "react";
|
|
2056
|
-
|
|
2057
|
-
// src/components/List/ListItem.tsx
|
|
2058
|
-
import { forwardRef as forwardRef26 } from "react";
|
|
2059
|
-
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2060
|
-
var ListItem = forwardRef26(
|
|
2061
|
-
(_a, ref) => {
|
|
2062
|
-
var _b = _a, {
|
|
2063
|
-
as: Component = "div",
|
|
2064
|
-
className,
|
|
2065
|
-
title,
|
|
2066
|
-
startContent,
|
|
2067
|
-
endContent,
|
|
2068
|
-
level = 1,
|
|
2069
|
-
hoverable,
|
|
2070
|
-
selected,
|
|
2071
|
-
disabled,
|
|
2072
|
-
style,
|
|
2073
|
-
onClick
|
|
2074
|
-
} = _b, rest = __objRest(_b, [
|
|
2075
|
-
"as",
|
|
2076
|
-
"className",
|
|
2077
|
-
"title",
|
|
2078
|
-
"startContent",
|
|
2079
|
-
"endContent",
|
|
2080
|
-
"level",
|
|
2081
|
-
"hoverable",
|
|
2082
|
-
"selected",
|
|
2083
|
-
"disabled",
|
|
2084
|
-
"style",
|
|
2085
|
-
"onClick"
|
|
2086
|
-
]);
|
|
2087
|
-
const prefixCls = PREFIX_CLS;
|
|
2088
|
-
const handleClick = (event) => {
|
|
2089
|
-
onClick == null ? void 0 : onClick(event);
|
|
2090
|
-
};
|
|
2091
|
-
return /* @__PURE__ */ jsxs20(
|
|
2092
|
-
Component,
|
|
2093
|
-
__spreadProps(__spreadValues({
|
|
2094
|
-
ref,
|
|
2095
|
-
className: clsx_default(
|
|
2096
|
-
`${prefixCls}list-item`,
|
|
2097
|
-
{
|
|
2098
|
-
[`${prefixCls}list-item--selected`]: selected,
|
|
2099
|
-
[`${prefixCls}list-item--hoverable`]: hoverable,
|
|
2100
|
-
[`${prefixCls}list-item--disabled`]: disabled
|
|
2101
|
-
},
|
|
2102
|
-
className
|
|
2103
|
-
),
|
|
2104
|
-
style: __spreadValues({
|
|
2105
|
-
paddingLeft: level <= 1 ? `var(--${prefixCls}list-item-padding-x)` : `calc(${level} * var(--${prefixCls}list-item-padding-level))`
|
|
2106
|
-
}, style),
|
|
2107
|
-
onClick: handleClick
|
|
2108
|
-
}, rest), {
|
|
2109
|
-
children: [
|
|
2110
|
-
hoverable && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}overlay` }),
|
|
2111
|
-
startContent && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
|
|
2112
|
-
/* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__content`, children: /* @__PURE__ */ jsx34("span", { className: `${prefixCls}list-item__title`, children: title }) }),
|
|
2113
|
-
endContent && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
|
|
2114
|
-
]
|
|
2115
|
-
})
|
|
2116
|
-
);
|
|
2117
|
-
}
|
|
2118
|
-
);
|
|
2119
|
-
var ListItem_default = ListItem;
|
|
2120
|
-
|
|
2121
|
-
// src/components/List/ListGroup.tsx
|
|
2122
|
-
import { Fragment as Fragment3, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2123
|
-
var ListGroup = forwardRef27(
|
|
2124
|
-
(_a, ref) => {
|
|
2125
|
-
var _b = _a, {
|
|
2126
|
-
children,
|
|
2127
|
-
startContent,
|
|
2128
|
-
endContent,
|
|
2129
|
-
expandVisible = true,
|
|
2130
|
-
expandPosition = "end",
|
|
2131
|
-
isOpen,
|
|
2132
|
-
onOpen,
|
|
2133
|
-
onClose,
|
|
2134
|
-
onToggle
|
|
2135
|
-
} = _b, rest = __objRest(_b, [
|
|
2136
|
-
"children",
|
|
2137
|
-
"startContent",
|
|
2138
|
-
"endContent",
|
|
2139
|
-
"expandVisible",
|
|
2140
|
-
"expandPosition",
|
|
2141
|
-
"isOpen",
|
|
2142
|
-
"onOpen",
|
|
2143
|
-
"onClose",
|
|
2144
|
-
"onToggle"
|
|
2145
|
-
]);
|
|
2146
|
-
const disclosure = isOpen !== void 0 ? { isOpen, onOpen, onClose, onToggle } : useDisclosure_default();
|
|
2147
|
-
return /* @__PURE__ */ jsx35("div", { className: "us-list-group", children: /* @__PURE__ */ jsxs21(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
|
|
2148
|
-
/* @__PURE__ */ jsx35(CollapseTrigger_default, { children: /* @__PURE__ */ jsx35(
|
|
2149
|
-
ListItem_default,
|
|
2150
|
-
__spreadValues({
|
|
2151
|
-
ref,
|
|
2152
|
-
startContent: /* @__PURE__ */ jsxs21(Fragment3, { children: [
|
|
2153
|
-
expandVisible && expandPosition === "start" && /* @__PURE__ */ jsx35(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx35(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx35(ChevronDownIcon_default, {}) }),
|
|
2154
|
-
startContent
|
|
2155
|
-
] }),
|
|
2156
|
-
endContent: /* @__PURE__ */ jsxs21(Fragment3, { children: [
|
|
2157
|
-
endContent,
|
|
2158
|
-
expandVisible && expandPosition === "end" && /* @__PURE__ */ jsx35(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx35(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx35(ChevronDownIcon_default, {}) })
|
|
2159
|
-
] })
|
|
2160
|
-
}, rest)
|
|
2161
|
-
) }),
|
|
2162
|
-
/* @__PURE__ */ jsx35(CollapseContent_default, { children: /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(List_default, { children }) }) })
|
|
2163
|
-
] })) });
|
|
2164
|
-
}
|
|
2165
|
-
);
|
|
2166
|
-
var ListGroup_default = ListGroup;
|
|
2167
2946
|
export {
|
|
2168
2947
|
Accordion_default as Accordion,
|
|
2169
2948
|
AccordionContent_default as AccordionContent,
|
|
2170
2949
|
AccordionHeader_default as AccordionHeader,
|
|
2171
2950
|
AccordionItem_default as AccordionItem,
|
|
2172
2951
|
AccordionPanel_default as AccordionPanel,
|
|
2952
|
+
Autocomplete_default as Autocomplete,
|
|
2173
2953
|
Backdrop_default as Backdrop,
|
|
2174
2954
|
Badge_default as Badge,
|
|
2175
2955
|
Button,
|
|
@@ -2192,24 +2972,32 @@ export {
|
|
|
2192
2972
|
MenuItem_default as MenuItem,
|
|
2193
2973
|
MenuSubmenu_default as MenuSubmenu,
|
|
2194
2974
|
MenuValueContext_default as MenuValueContext,
|
|
2195
|
-
MultiSelect_default as MultiSelect,
|
|
2196
2975
|
Portal_default as Portal,
|
|
2976
|
+
QueryStatus,
|
|
2197
2977
|
ScrollArea_default as ScrollArea,
|
|
2198
2978
|
Select_default as Select,
|
|
2199
2979
|
Switch_default as Switch,
|
|
2200
2980
|
Tab,
|
|
2201
2981
|
Tabs,
|
|
2982
|
+
TextInput_default as TextInput,
|
|
2202
2983
|
Toolbar_default as Toolbar,
|
|
2203
2984
|
Transition_default as Transition,
|
|
2985
|
+
assignRef,
|
|
2204
2986
|
clsx_default as clsx,
|
|
2205
2987
|
getOpenValuesByPathname,
|
|
2988
|
+
mergeRefs_default as mergeRefs,
|
|
2206
2989
|
scrollToItem,
|
|
2207
2990
|
useAccordionItem,
|
|
2208
2991
|
useCollapse,
|
|
2992
|
+
useDebounce_default as useDebounce,
|
|
2209
2993
|
useDisclosure_default as useDisclosure,
|
|
2994
|
+
useElementSize_default as useElementSize,
|
|
2995
|
+
useInfiniteQuery_default as useInfiniteQuery,
|
|
2210
2996
|
useLocalStorage,
|
|
2211
2997
|
useMenu,
|
|
2212
2998
|
useMenuItemValue,
|
|
2999
|
+
useOnClickOutside_default as useOnClickOutside,
|
|
2213
3000
|
usePrevious,
|
|
2214
|
-
useStep
|
|
3001
|
+
useStep,
|
|
3002
|
+
useVirtualizer_default as useVirtualizer
|
|
2215
3003
|
};
|