@duskmoon-dev/components 0.3.3 → 0.4.1
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/README.md +142 -2
- package/dist/classes/chat.d.ts +9 -1
- package/dist/classes/console-page.d.ts +16 -0
- package/dist/classes/dropdown.d.ts +5 -5
- package/dist/classes/fab.d.ts +11 -0
- package/dist/classes/index.d.ts +5 -0
- package/dist/classes/index.js +180 -34
- package/dist/classes/megamenu.d.ts +10 -0
- package/dist/classes/otp-input.d.ts +12 -0
- package/dist/classes/popover.d.ts +1 -3
- package/dist/classes/swap.d.ts +12 -0
- package/dist/classes/tree-select.d.ts +6 -6
- package/dist/components/app/index.js +128 -68
- package/dist/components/avatar/Avatar.types.d.ts +1 -1
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.types.d.ts +8 -0
- package/dist/components/button/index.js +253 -24
- package/dist/components/calendar/index.js +44 -19
- package/dist/components/chat/Chat.d.ts +9 -1
- package/dist/components/chat/Chat.types.d.ts +26 -0
- package/dist/components/chat/index.js +92 -3
- package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
- package/dist/components/color-picker/index.js +206 -9
- package/dist/components/console-page/ConsolePage.d.ts +2 -0
- package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
- package/dist/components/console-page/index.d.ts +2 -0
- package/dist/components/console-page/index.js +205 -0
- package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
- package/dist/components/date-picker/index.js +537 -35
- package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
- package/dist/components/dm-date-picker/index.js +545 -43
- package/dist/components/dm-drawer/index.js +253 -24
- package/dist/components/dm-layout/index.js +391 -24
- package/dist/components/dm-menu/index.js +380 -13
- package/dist/components/dm-page-header/index.js +404 -114
- package/dist/components/dm-pro-table/index.js +1195 -368
- package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
- package/dist/components/dm-query/index.js +943 -188
- package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
- package/dist/components/dm-search/index.js +929 -163
- package/dist/components/dm-table/index.js +1013 -247
- package/dist/components/dm-toolbar/index.js +400 -110
- package/dist/components/dm-truncate/index.js +115 -35
- package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
- package/dist/components/dropdown/index.js +400 -110
- package/dist/components/fab/Fab.d.ts +4 -0
- package/dist/components/fab/Fab.types.d.ts +25 -0
- package/dist/components/fab/index.d.ts +2 -0
- package/dist/components/fab/index.js +480 -0
- package/dist/components/form/Form.types.d.ts +1 -0
- package/dist/components/form/index.js +14 -3
- package/dist/components/json-schema-form/JsonSchemaForm.d.ts +19 -0
- package/dist/components/json-schema-form/JsonSchemaWidget.d.ts +14 -0
- package/dist/components/json-schema-form/index.d.ts +8 -0
- package/dist/components/json-schema-form/index.js +7661 -0
- package/dist/components/json-schema-form/json-form-widgets.d.ts +26 -0
- package/dist/components/json-schema-form/json-schema-form.d.ts +50 -0
- package/dist/components/megamenu/Megamenu.d.ts +2 -0
- package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
- package/dist/components/megamenu/index.d.ts +2 -0
- package/dist/components/megamenu/index.js +214 -0
- package/dist/components/modal/index.js +128 -68
- package/dist/components/otp-input/OtpInput.d.ts +2 -0
- package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
- package/dist/components/otp-input/index.d.ts +2 -0
- package/dist/components/otp-input/index.js +112 -0
- package/dist/components/popconfirm/index.js +255 -26
- package/dist/components/popover/index.js +24 -4
- package/dist/components/select/index.js +12 -0
- package/dist/components/swap/Swap.d.ts +3 -0
- package/dist/components/swap/Swap.types.d.ts +22 -0
- package/dist/components/swap/index.d.ts +2 -0
- package/dist/components/swap/index.js +109 -0
- package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
- package/dist/components/time-picker/index.js +167 -29
- package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
- package/dist/components/tooltip/index.js +107 -27
- package/dist/components/tour/index.js +253 -24
- package/dist/components/tree-select/index.js +8 -8
- package/dist/components/upload/Upload.types.d.ts +1 -0
- package/dist/components/upload/index.js +2 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3343 -1633
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +1359 -865
- package/package.json +31 -5
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
// src/components/dm-query/DmQuery.tsx
|
|
4
4
|
import {
|
|
5
|
-
forwardRef as
|
|
6
|
-
useImperativeHandle as
|
|
7
|
-
useRef as
|
|
8
|
-
useState as
|
|
5
|
+
forwardRef as forwardRef6,
|
|
6
|
+
useImperativeHandle as useImperativeHandle4,
|
|
7
|
+
useRef as useRef3,
|
|
8
|
+
useState as useState7
|
|
9
9
|
} from "react";
|
|
10
10
|
|
|
11
11
|
// src/components/dm-search/DmSearch.tsx
|
|
12
12
|
import {
|
|
13
|
-
forwardRef as
|
|
14
|
-
useEffect,
|
|
15
|
-
useImperativeHandle as
|
|
16
|
-
useMemo as
|
|
17
|
-
useState as
|
|
13
|
+
forwardRef as forwardRef5,
|
|
14
|
+
useEffect as useEffect2,
|
|
15
|
+
useImperativeHandle as useImperativeHandle3,
|
|
16
|
+
useMemo as useMemo4,
|
|
17
|
+
useState as useState6
|
|
18
18
|
} from "react";
|
|
19
19
|
|
|
20
20
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
@@ -58,6 +58,10 @@ function getDmSearchClasses({
|
|
|
58
58
|
return cn(dmSearchBaseClass, compact && dmSearchCompactClass, collapsed && dmSearchCollapsedClass, className);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// src/components/button/Button.tsx
|
|
62
|
+
import React from "react";
|
|
63
|
+
import { createPortal } from "react-dom";
|
|
64
|
+
|
|
61
65
|
// src/classes/button.ts
|
|
62
66
|
var buttonBaseClass = "btn";
|
|
63
67
|
var buttonColorClasses = {
|
|
@@ -81,7 +85,7 @@ var buttonAppearanceClasses = {
|
|
|
81
85
|
};
|
|
82
86
|
var buttonShapeClasses = {
|
|
83
87
|
rect: "",
|
|
84
|
-
circle: "btn-circle",
|
|
88
|
+
circle: "btn-circle btn-icon",
|
|
85
89
|
square: "btn-square"
|
|
86
90
|
};
|
|
87
91
|
var buttonSizeClasses = {
|
|
@@ -101,11 +105,14 @@ function getButtonClasses({
|
|
|
101
105
|
isLoading,
|
|
102
106
|
className
|
|
103
107
|
}) {
|
|
104
|
-
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
108
|
+
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], shape === "circle" && size === "xs" && "btn-icon-sm", shape === "circle" && size === "sm" && "btn-icon-sm", shape === "circle" && size === "lg" && "btn-icon-lg", block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
// src/components/button/Button.tsx
|
|
108
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
112
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
113
|
+
function isPromiseLike(value) {
|
|
114
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
115
|
+
}
|
|
109
116
|
function Button({
|
|
110
117
|
color = "primary",
|
|
111
118
|
appearance = "filled",
|
|
@@ -119,8 +126,155 @@ function Button({
|
|
|
119
126
|
children,
|
|
120
127
|
disabled,
|
|
121
128
|
ref,
|
|
129
|
+
confirm,
|
|
130
|
+
onClick,
|
|
122
131
|
...props
|
|
123
132
|
}) {
|
|
133
|
+
const buttonRef = React.useRef(null);
|
|
134
|
+
const popoverRef = React.useRef(null);
|
|
135
|
+
const cancelRef = React.useRef(null);
|
|
136
|
+
const approvalRef = React.useRef("idle");
|
|
137
|
+
const pendingRef = React.useRef(false);
|
|
138
|
+
const actionRef = React.useRef(0);
|
|
139
|
+
const operationRef = React.useRef(0);
|
|
140
|
+
const mountedRef = React.useRef(false);
|
|
141
|
+
const [portalTarget, setPortalTarget] = React.useState(null);
|
|
142
|
+
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
143
|
+
const [confirmError, setConfirmError] = React.useState(false);
|
|
144
|
+
const generatedId = React.useId().replace(/:/g, "");
|
|
145
|
+
const popoverId = `button-confirm-${generatedId}`;
|
|
146
|
+
const titleId = `${popoverId}-title`;
|
|
147
|
+
const descriptionId = `${popoverId}-description`;
|
|
148
|
+
const anchor = `--${popoverId}-anchor`;
|
|
149
|
+
const hasConfirm = Boolean(confirm);
|
|
150
|
+
const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
|
|
151
|
+
const title = confirmation ? confirmation.title : "Confirm action";
|
|
152
|
+
const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
|
|
153
|
+
const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
|
|
154
|
+
const hasContent = content !== undefined && content !== null && content !== false && content !== "";
|
|
155
|
+
const mergedRef = React.useCallback((node) => {
|
|
156
|
+
buttonRef.current = node;
|
|
157
|
+
if (!node) {
|
|
158
|
+
if (typeof ref === "function")
|
|
159
|
+
ref(null);
|
|
160
|
+
else if (ref)
|
|
161
|
+
ref.current = null;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const cleanup = typeof ref === "function" ? ref(node) : undefined;
|
|
165
|
+
if (ref && typeof ref !== "function")
|
|
166
|
+
ref.current = node;
|
|
167
|
+
return () => {
|
|
168
|
+
buttonRef.current = null;
|
|
169
|
+
if (typeof cleanup === "function")
|
|
170
|
+
cleanup();
|
|
171
|
+
else if (typeof ref === "function")
|
|
172
|
+
ref(null);
|
|
173
|
+
else if (ref)
|
|
174
|
+
ref.current = null;
|
|
175
|
+
};
|
|
176
|
+
}, [ref]);
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
mountedRef.current = true;
|
|
179
|
+
return () => {
|
|
180
|
+
mountedRef.current = false;
|
|
181
|
+
operationRef.current += 1;
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
React.useEffect(() => {
|
|
185
|
+
operationRef.current += 1;
|
|
186
|
+
approvalRef.current = "idle";
|
|
187
|
+
setConfirmError(false);
|
|
188
|
+
setPortalTarget(hasConfirm ? document.body : null);
|
|
189
|
+
}, [hasConfirm]);
|
|
190
|
+
function closePopover() {
|
|
191
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
192
|
+
popoverRef.current.hidePopover();
|
|
193
|
+
}
|
|
194
|
+
buttonRef.current?.focus();
|
|
195
|
+
}
|
|
196
|
+
function handleClick(event) {
|
|
197
|
+
if (!confirm) {
|
|
198
|
+
onClick?.(event);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (approvalRef.current === "native") {
|
|
202
|
+
approvalRef.current = "idle";
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (approvalRef.current === "action") {
|
|
206
|
+
approvalRef.current = "idle";
|
|
207
|
+
let result;
|
|
208
|
+
try {
|
|
209
|
+
result = onClick?.(event);
|
|
210
|
+
} catch {
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
pendingRef.current = false;
|
|
213
|
+
setConfirmError(true);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (!isPromiseLike(result)) {
|
|
217
|
+
pendingRef.current = false;
|
|
218
|
+
closePopover();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const userPreventedDefault = event.defaultPrevented;
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
setConfirmLoading(true);
|
|
224
|
+
const action = actionRef.current;
|
|
225
|
+
const operation = operationRef.current;
|
|
226
|
+
Promise.resolve(result).then(() => {
|
|
227
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
228
|
+
return;
|
|
229
|
+
pendingRef.current = false;
|
|
230
|
+
setConfirmLoading(false);
|
|
231
|
+
if (operation !== operationRef.current)
|
|
232
|
+
return;
|
|
233
|
+
closePopover();
|
|
234
|
+
if (!userPreventedDefault && !buttonRef.current?.disabled) {
|
|
235
|
+
approvalRef.current = "native";
|
|
236
|
+
buttonRef.current?.click();
|
|
237
|
+
approvalRef.current = "idle";
|
|
238
|
+
}
|
|
239
|
+
}, () => {
|
|
240
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
241
|
+
return;
|
|
242
|
+
pendingRef.current = false;
|
|
243
|
+
setConfirmLoading(false);
|
|
244
|
+
if (operation !== operationRef.current)
|
|
245
|
+
return;
|
|
246
|
+
setConfirmError(true);
|
|
247
|
+
cancelRef.current?.focus();
|
|
248
|
+
});
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
if (disabled || isLoading || pendingRef.current)
|
|
253
|
+
return;
|
|
254
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
255
|
+
closePopover();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
setConfirmError(false);
|
|
259
|
+
popoverRef.current?.showPopover();
|
|
260
|
+
cancelRef.current?.focus();
|
|
261
|
+
}
|
|
262
|
+
function handleConfirm(event) {
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
event.stopPropagation();
|
|
265
|
+
const trigger = buttonRef.current;
|
|
266
|
+
if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
|
|
267
|
+
return;
|
|
268
|
+
setConfirmError(false);
|
|
269
|
+
pendingRef.current = true;
|
|
270
|
+
actionRef.current += 1;
|
|
271
|
+
approvalRef.current = "action";
|
|
272
|
+
trigger.click();
|
|
273
|
+
if (approvalRef.current === "action") {
|
|
274
|
+
approvalRef.current = "idle";
|
|
275
|
+
pendingRef.current = false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
124
278
|
const classes = getButtonClasses({
|
|
125
279
|
color,
|
|
126
280
|
appearance,
|
|
@@ -130,34 +284,526 @@ function Button({
|
|
|
130
284
|
isLoading,
|
|
131
285
|
className
|
|
132
286
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
...props,
|
|
287
|
+
const confirmClasses = getButtonClasses({
|
|
288
|
+
color,
|
|
289
|
+
size: "sm",
|
|
290
|
+
isLoading: confirmLoading
|
|
291
|
+
});
|
|
292
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
140
293
|
children: [
|
|
141
|
-
|
|
142
|
-
|
|
294
|
+
/* @__PURE__ */ jsxs("button", {
|
|
295
|
+
ref: confirm ? mergedRef : ref,
|
|
296
|
+
className: classes,
|
|
297
|
+
disabled: disabled || isLoading,
|
|
298
|
+
"aria-busy": isLoading,
|
|
299
|
+
"aria-disabled": disabled || isLoading,
|
|
300
|
+
...props,
|
|
301
|
+
style: confirm ? { ...props.style, anchorName: anchor } : props.style,
|
|
302
|
+
"aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
|
|
303
|
+
"aria-controls": confirm ? popoverId : props["aria-controls"],
|
|
304
|
+
onClick: confirm ? handleClick : onClick,
|
|
305
|
+
children: [
|
|
306
|
+
isLoading && /* @__PURE__ */ jsx("span", {
|
|
307
|
+
className: "btn-spinner"
|
|
308
|
+
}),
|
|
309
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
|
|
310
|
+
className: "btn-icon-left",
|
|
311
|
+
children: leftIcon
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx("span", {
|
|
314
|
+
className: "btn-content",
|
|
315
|
+
children
|
|
316
|
+
}),
|
|
317
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
|
|
318
|
+
className: "btn-icon-right",
|
|
319
|
+
children: rightIcon
|
|
320
|
+
})
|
|
321
|
+
]
|
|
143
322
|
}),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
323
|
+
confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs("form", {
|
|
324
|
+
id: popoverId,
|
|
325
|
+
ref: popoverRef,
|
|
326
|
+
popover: "auto",
|
|
327
|
+
role: "dialog",
|
|
328
|
+
"aria-labelledby": hasTitle ? titleId : undefined,
|
|
329
|
+
"aria-label": hasTitle ? undefined : "Confirm action",
|
|
330
|
+
"aria-describedby": hasContent ? descriptionId : undefined,
|
|
331
|
+
className: "popover popover-confirm popover-bottom",
|
|
332
|
+
style: { positionAnchor: anchor },
|
|
333
|
+
onSubmit: handleConfirm,
|
|
334
|
+
onClick: (event) => event.stopPropagation(),
|
|
335
|
+
onToggle: (event) => {
|
|
336
|
+
if (!event.currentTarget.matches(":popover-open")) {
|
|
337
|
+
operationRef.current += 1;
|
|
338
|
+
if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
|
|
339
|
+
buttonRef.current?.focus();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
children: [
|
|
344
|
+
hasTitle && /* @__PURE__ */ jsx("div", {
|
|
345
|
+
className: "popover-header",
|
|
346
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
347
|
+
id: titleId,
|
|
348
|
+
className: "popover-title",
|
|
349
|
+
children: title
|
|
350
|
+
})
|
|
351
|
+
}),
|
|
352
|
+
hasContent && /* @__PURE__ */ jsx("div", {
|
|
353
|
+
id: descriptionId,
|
|
354
|
+
className: "popover-body",
|
|
355
|
+
children: content
|
|
356
|
+
}),
|
|
357
|
+
confirmError && /* @__PURE__ */ jsx("div", {
|
|
358
|
+
role: "alert",
|
|
359
|
+
className: "popover-body",
|
|
360
|
+
children: "The action failed. Please try again."
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ jsxs("div", {
|
|
363
|
+
className: "popover-footer",
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ jsx("button", {
|
|
366
|
+
ref: cancelRef,
|
|
367
|
+
type: "button",
|
|
368
|
+
className: "btn btn-text btn-sm",
|
|
369
|
+
popoverTarget: popoverId,
|
|
370
|
+
popoverTargetAction: "hide",
|
|
371
|
+
disabled: confirmLoading,
|
|
372
|
+
children: confirmation?.cancelText ?? "Cancel"
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ jsx("button", {
|
|
375
|
+
type: "submit",
|
|
376
|
+
className: confirmClasses,
|
|
377
|
+
disabled: disabled || isLoading || confirmLoading,
|
|
378
|
+
"aria-busy": confirmLoading,
|
|
379
|
+
children: confirmation?.confirmText ?? "Confirm"
|
|
380
|
+
})
|
|
381
|
+
]
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
}), portalTarget)
|
|
385
|
+
]
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
// src/components/date-picker/DatePicker.tsx
|
|
389
|
+
import { forwardRef as forwardRef2, useMemo as useMemo2, useState as useState3 } from "react";
|
|
390
|
+
|
|
391
|
+
// src/components/calendar/Calendar.tsx
|
|
392
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
393
|
+
|
|
394
|
+
// src/classes/calendar.ts
|
|
395
|
+
var calendarBaseClass = "datepicker calendar";
|
|
396
|
+
var calendarHeaderClass = "calendar-header";
|
|
397
|
+
var calendarTitleClass = "calendar-title";
|
|
398
|
+
var calendarControlsClass = "calendar-controls";
|
|
399
|
+
var calendarNavClass = "calendar-nav";
|
|
400
|
+
var calendarModeClass = "calendar-mode";
|
|
401
|
+
var calendarWeekdaysClass = "calendar-weekdays";
|
|
402
|
+
var calendarWeekdayClass = "calendar-weekday";
|
|
403
|
+
var calendarBodyClass = "calendar-body";
|
|
404
|
+
var calendarDateGridClass = "calendar-date-grid";
|
|
405
|
+
var calendarMonthGridClass = "calendar-month-grid";
|
|
406
|
+
var calendarCellContentClass = "calendar-cell-content";
|
|
407
|
+
function getCalendarClasses({
|
|
408
|
+
fullscreen = true,
|
|
409
|
+
mode = "month",
|
|
410
|
+
className
|
|
411
|
+
}) {
|
|
412
|
+
return cn(calendarBaseClass, fullscreen ? "calendar-fullscreen" : "calendar-card", mode === "year" && "calendar-year-mode", className);
|
|
413
|
+
}
|
|
414
|
+
function getCalendarCellClasses({
|
|
415
|
+
selected,
|
|
416
|
+
today,
|
|
417
|
+
outside,
|
|
418
|
+
disabled,
|
|
419
|
+
className
|
|
420
|
+
}) {
|
|
421
|
+
return cn("calendar-cell", selected && "calendar-cell-selected", today && "calendar-cell-today", outside && "calendar-cell-outside", disabled && "calendar-cell-disabled", className);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/components/calendar/Calendar.tsx
|
|
425
|
+
import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
426
|
+
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
427
|
+
var MONTHS = [
|
|
428
|
+
"Jan",
|
|
429
|
+
"Feb",
|
|
430
|
+
"Mar",
|
|
431
|
+
"Apr",
|
|
432
|
+
"May",
|
|
433
|
+
"Jun",
|
|
434
|
+
"Jul",
|
|
435
|
+
"Aug",
|
|
436
|
+
"Sep",
|
|
437
|
+
"Oct",
|
|
438
|
+
"Nov",
|
|
439
|
+
"Dec"
|
|
440
|
+
];
|
|
441
|
+
function pad(value) {
|
|
442
|
+
return String(value).padStart(2, "0");
|
|
443
|
+
}
|
|
444
|
+
function formatDate(date) {
|
|
445
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
446
|
+
}
|
|
447
|
+
function formatMonth(date) {
|
|
448
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-01`;
|
|
449
|
+
}
|
|
450
|
+
function parseDate(value) {
|
|
451
|
+
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
452
|
+
return new Date(value.getFullYear(), value.getMonth(), value.getDate());
|
|
453
|
+
}
|
|
454
|
+
if (typeof value === "string" && value.length > 0) {
|
|
455
|
+
const [year, month = "1", day = "1"] = value.split("-");
|
|
456
|
+
const parsed = new Date(Number(year), Number(month) - 1, Number(day));
|
|
457
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
458
|
+
return parsed;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
const today = new Date;
|
|
462
|
+
return new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
463
|
+
}
|
|
464
|
+
function addMonths(date, amount) {
|
|
465
|
+
return new Date(date.getFullYear(), date.getMonth() + amount, 1);
|
|
466
|
+
}
|
|
467
|
+
function addYears(date, amount) {
|
|
468
|
+
return new Date(date.getFullYear() + amount, date.getMonth(), 1);
|
|
469
|
+
}
|
|
470
|
+
function startOfCalendarGrid(panelDate) {
|
|
471
|
+
const firstOfMonth = new Date(panelDate.getFullYear(), panelDate.getMonth(), 1);
|
|
472
|
+
const start = new Date(firstOfMonth);
|
|
473
|
+
start.setDate(firstOfMonth.getDate() - firstOfMonth.getDay());
|
|
474
|
+
return start;
|
|
475
|
+
}
|
|
476
|
+
function buildDateGrid(panelDate) {
|
|
477
|
+
const start = startOfCalendarGrid(panelDate);
|
|
478
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
479
|
+
const date = new Date(start);
|
|
480
|
+
date.setDate(start.getDate() + index);
|
|
481
|
+
return date;
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function isSameMonth(left, right) {
|
|
485
|
+
return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
|
|
486
|
+
}
|
|
487
|
+
function isOutsideRange(date, validRange) {
|
|
488
|
+
if (!validRange) {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
const current = formatDate(date);
|
|
492
|
+
const start = formatDate(parseDate(validRange[0]));
|
|
493
|
+
const end = formatDate(parseDate(validRange[1]));
|
|
494
|
+
return current < start || current > end;
|
|
495
|
+
}
|
|
496
|
+
function Header({
|
|
497
|
+
panelDate,
|
|
498
|
+
mode,
|
|
499
|
+
setPanelDate,
|
|
500
|
+
setMode
|
|
501
|
+
}) {
|
|
502
|
+
const title = mode === "year" ? String(panelDate.getFullYear()) : `${MONTHS[panelDate.getMonth()]} ${panelDate.getFullYear()}`;
|
|
503
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
504
|
+
className: calendarHeaderClass,
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsx2("button", {
|
|
507
|
+
type: "button",
|
|
508
|
+
className: calendarNavClass,
|
|
509
|
+
"aria-label": "Previous panel",
|
|
510
|
+
onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, -1) : addMonths(panelDate, -1), mode),
|
|
511
|
+
children: /* @__PURE__ */ jsx2("svg", {
|
|
512
|
+
"aria-hidden": "true",
|
|
513
|
+
focusable: "false",
|
|
514
|
+
width: "16",
|
|
515
|
+
height: "16",
|
|
516
|
+
viewBox: "0 0 24 24",
|
|
517
|
+
fill: "none",
|
|
518
|
+
stroke: "currentColor",
|
|
519
|
+
strokeWidth: "2",
|
|
520
|
+
strokeLinecap: "round",
|
|
521
|
+
strokeLinejoin: "round",
|
|
522
|
+
children: /* @__PURE__ */ jsx2("path", {
|
|
523
|
+
d: "m15 18-6-6 6-6"
|
|
524
|
+
})
|
|
525
|
+
})
|
|
147
526
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
className:
|
|
150
|
-
children
|
|
527
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
528
|
+
className: calendarControlsClass,
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ jsx2("div", {
|
|
531
|
+
className: calendarTitleClass,
|
|
532
|
+
children: title
|
|
533
|
+
}),
|
|
534
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
535
|
+
className: calendarModeClass,
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ jsx2("button", {
|
|
538
|
+
type: "button",
|
|
539
|
+
"aria-pressed": mode === "month",
|
|
540
|
+
onClick: () => setMode("month"),
|
|
541
|
+
children: "Month"
|
|
542
|
+
}),
|
|
543
|
+
/* @__PURE__ */ jsx2("button", {
|
|
544
|
+
type: "button",
|
|
545
|
+
"aria-pressed": mode === "year",
|
|
546
|
+
onClick: () => setMode("year"),
|
|
547
|
+
children: "Year"
|
|
548
|
+
})
|
|
549
|
+
]
|
|
550
|
+
})
|
|
551
|
+
]
|
|
151
552
|
}),
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
553
|
+
/* @__PURE__ */ jsx2("button", {
|
|
554
|
+
type: "button",
|
|
555
|
+
className: calendarNavClass,
|
|
556
|
+
"aria-label": "Next panel",
|
|
557
|
+
onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, 1) : addMonths(panelDate, 1), mode),
|
|
558
|
+
children: /* @__PURE__ */ jsx2("svg", {
|
|
559
|
+
"aria-hidden": "true",
|
|
560
|
+
focusable: "false",
|
|
561
|
+
width: "16",
|
|
562
|
+
height: "16",
|
|
563
|
+
viewBox: "0 0 24 24",
|
|
564
|
+
fill: "none",
|
|
565
|
+
stroke: "currentColor",
|
|
566
|
+
strokeWidth: "2",
|
|
567
|
+
strokeLinecap: "round",
|
|
568
|
+
strokeLinejoin: "round",
|
|
569
|
+
children: /* @__PURE__ */ jsx2("path", {
|
|
570
|
+
d: "m9 18 6-6-6-6"
|
|
571
|
+
})
|
|
572
|
+
})
|
|
155
573
|
})
|
|
156
574
|
]
|
|
157
575
|
});
|
|
158
576
|
}
|
|
159
|
-
|
|
160
|
-
|
|
577
|
+
var Calendar = forwardRef(({
|
|
578
|
+
className,
|
|
579
|
+
value,
|
|
580
|
+
defaultValue,
|
|
581
|
+
mode,
|
|
582
|
+
defaultMode = "month",
|
|
583
|
+
fullscreen = true,
|
|
584
|
+
validRange,
|
|
585
|
+
disabledDate,
|
|
586
|
+
dateCellRender,
|
|
587
|
+
dateFullCellRender,
|
|
588
|
+
monthCellRender,
|
|
589
|
+
monthFullCellRender,
|
|
590
|
+
cellRender,
|
|
591
|
+
fullCellRender,
|
|
592
|
+
headerRender,
|
|
593
|
+
onChange,
|
|
594
|
+
onSelect,
|
|
595
|
+
onPanelChange,
|
|
596
|
+
...props
|
|
597
|
+
}, ref) => {
|
|
598
|
+
const selectedDate = parseDate(value ?? defaultValue);
|
|
599
|
+
const [innerValue, setInnerValue] = useState(() => formatDate(selectedDate));
|
|
600
|
+
const [panelDate, setInnerPanelDate] = useState(selectedDate);
|
|
601
|
+
const [innerMode, setInnerMode] = useState(mode ?? defaultMode);
|
|
602
|
+
const currentMode = mode ?? innerMode;
|
|
603
|
+
const currentValue = value === undefined ? innerValue : formatDate(parseDate(value));
|
|
604
|
+
const today = useMemo(() => formatDate(new Date), []);
|
|
605
|
+
const dateGrid = useMemo(() => buildDateGrid(panelDate), [panelDate]);
|
|
606
|
+
function emitPanelChange(nextDate, nextMode = currentMode) {
|
|
607
|
+
setInnerPanelDate(nextDate);
|
|
608
|
+
onPanelChange?.(formatDate(nextDate), nextMode);
|
|
609
|
+
}
|
|
610
|
+
function setCalendarMode(nextMode) {
|
|
611
|
+
if (mode === undefined) {
|
|
612
|
+
setInnerMode(nextMode);
|
|
613
|
+
}
|
|
614
|
+
onPanelChange?.(formatDate(panelDate), nextMode);
|
|
615
|
+
}
|
|
616
|
+
function commitValue(nextDate, source) {
|
|
617
|
+
const nextValue = source === "month" ? formatMonth(nextDate) : formatDate(nextDate);
|
|
618
|
+
if (disabledDate?.(nextValue) || isOutsideRange(nextDate, validRange)) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (value === undefined) {
|
|
622
|
+
setInnerValue(nextValue);
|
|
623
|
+
}
|
|
624
|
+
setInnerPanelDate(nextDate);
|
|
625
|
+
onSelect?.(nextValue, { source });
|
|
626
|
+
onChange?.(nextValue);
|
|
627
|
+
}
|
|
628
|
+
function renderDateCell(date) {
|
|
629
|
+
const dateValue = formatDate(date);
|
|
630
|
+
const originNode = /* @__PURE__ */ jsxs2("div", {
|
|
631
|
+
className: calendarCellContentClass,
|
|
632
|
+
children: [
|
|
633
|
+
/* @__PURE__ */ jsx2("span", {
|
|
634
|
+
children: date.getDate()
|
|
635
|
+
}),
|
|
636
|
+
dateCellRender?.(dateValue)
|
|
637
|
+
]
|
|
638
|
+
});
|
|
639
|
+
const info = {
|
|
640
|
+
originNode,
|
|
641
|
+
today,
|
|
642
|
+
type: "month"
|
|
643
|
+
};
|
|
644
|
+
const content = fullCellRender?.(dateValue, info) ?? dateFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
|
|
645
|
+
const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
|
|
646
|
+
return /* @__PURE__ */ jsx2("button", {
|
|
647
|
+
type: "button",
|
|
648
|
+
"aria-label": dateValue,
|
|
649
|
+
disabled,
|
|
650
|
+
className: getCalendarCellClasses({
|
|
651
|
+
selected: dateValue === currentValue,
|
|
652
|
+
today: dateValue === today,
|
|
653
|
+
outside: !isSameMonth(date, panelDate),
|
|
654
|
+
disabled
|
|
655
|
+
}),
|
|
656
|
+
onClick: () => commitValue(date, "date"),
|
|
657
|
+
children: content
|
|
658
|
+
}, dateValue);
|
|
659
|
+
}
|
|
660
|
+
function renderMonthCell(month) {
|
|
661
|
+
const date = new Date(panelDate.getFullYear(), month, 1);
|
|
662
|
+
const dateValue = formatMonth(date);
|
|
663
|
+
const originNode = /* @__PURE__ */ jsxs2("div", {
|
|
664
|
+
className: calendarCellContentClass,
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ jsx2("span", {
|
|
667
|
+
children: MONTHS[month]
|
|
668
|
+
}),
|
|
669
|
+
monthCellRender?.(dateValue)
|
|
670
|
+
]
|
|
671
|
+
});
|
|
672
|
+
const info = {
|
|
673
|
+
originNode,
|
|
674
|
+
today,
|
|
675
|
+
type: "year"
|
|
676
|
+
};
|
|
677
|
+
const content = fullCellRender?.(dateValue, info) ?? monthFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
|
|
678
|
+
const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
|
|
679
|
+
return /* @__PURE__ */ jsx2("button", {
|
|
680
|
+
type: "button",
|
|
681
|
+
"aria-label": dateValue,
|
|
682
|
+
disabled,
|
|
683
|
+
className: getCalendarCellClasses({
|
|
684
|
+
selected: dateValue === formatMonth(parseDate(currentValue)),
|
|
685
|
+
today: dateValue === formatMonth(new Date),
|
|
686
|
+
disabled
|
|
687
|
+
}),
|
|
688
|
+
onClick: () => commitValue(date, "month"),
|
|
689
|
+
children: content
|
|
690
|
+
}, dateValue);
|
|
691
|
+
}
|
|
692
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
693
|
+
...props,
|
|
694
|
+
ref,
|
|
695
|
+
className: getCalendarClasses({
|
|
696
|
+
fullscreen,
|
|
697
|
+
mode: currentMode,
|
|
698
|
+
className
|
|
699
|
+
}),
|
|
700
|
+
children: [
|
|
701
|
+
headerRender ? headerRender({
|
|
702
|
+
value: formatDate(panelDate),
|
|
703
|
+
type: currentMode,
|
|
704
|
+
onChange: (nextValue) => emitPanelChange(parseDate(nextValue)),
|
|
705
|
+
onTypeChange: setCalendarMode
|
|
706
|
+
}) : /* @__PURE__ */ jsx2(Header, {
|
|
707
|
+
panelDate,
|
|
708
|
+
mode: currentMode,
|
|
709
|
+
setPanelDate: emitPanelChange,
|
|
710
|
+
setMode: setCalendarMode
|
|
711
|
+
}),
|
|
712
|
+
/* @__PURE__ */ jsx2("div", {
|
|
713
|
+
className: calendarBodyClass,
|
|
714
|
+
children: currentMode === "month" ? /* @__PURE__ */ jsxs2(Fragment2, {
|
|
715
|
+
children: [
|
|
716
|
+
/* @__PURE__ */ jsx2("div", {
|
|
717
|
+
className: calendarWeekdaysClass,
|
|
718
|
+
"aria-hidden": "true",
|
|
719
|
+
children: WEEKDAYS.map((weekday) => /* @__PURE__ */ jsx2("span", {
|
|
720
|
+
className: calendarWeekdayClass,
|
|
721
|
+
children: weekday
|
|
722
|
+
}, weekday))
|
|
723
|
+
}),
|
|
724
|
+
/* @__PURE__ */ jsx2("div", {
|
|
725
|
+
className: calendarDateGridClass,
|
|
726
|
+
children: dateGrid.map(renderDateCell)
|
|
727
|
+
})
|
|
728
|
+
]
|
|
729
|
+
}) : /* @__PURE__ */ jsx2("div", {
|
|
730
|
+
className: calendarMonthGridClass,
|
|
731
|
+
children: MONTHS.map((_, month) => renderMonthCell(month))
|
|
732
|
+
})
|
|
733
|
+
})
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
Calendar.displayName = "Calendar";
|
|
738
|
+
// src/components/date-picker/usePickerDropdown.ts
|
|
739
|
+
import { useEffect, useId, useImperativeHandle, useRef, useState as useState2 } from "react";
|
|
740
|
+
function usePickerDropdown({
|
|
741
|
+
open,
|
|
742
|
+
defaultOpen,
|
|
743
|
+
disabled,
|
|
744
|
+
onOpenChange,
|
|
745
|
+
ref
|
|
746
|
+
}) {
|
|
747
|
+
const rootRef = useRef(null);
|
|
748
|
+
const inputRef = useRef(null);
|
|
749
|
+
const skipFocus = useRef(false);
|
|
750
|
+
const panelId = useId();
|
|
751
|
+
const [innerOpen, setInnerOpen] = useState2(Boolean(defaultOpen));
|
|
752
|
+
const visible = !disabled && (open ?? innerOpen);
|
|
753
|
+
useImperativeHandle(ref, () => rootRef.current, []);
|
|
754
|
+
function setVisible(next) {
|
|
755
|
+
if (disabled || next === visible)
|
|
756
|
+
return;
|
|
757
|
+
if (open === undefined)
|
|
758
|
+
setInnerOpen(next);
|
|
759
|
+
onOpenChange?.(next);
|
|
760
|
+
}
|
|
761
|
+
function closeAndFocus() {
|
|
762
|
+
skipFocus.current = true;
|
|
763
|
+
inputRef.current?.focus();
|
|
764
|
+
skipFocus.current = false;
|
|
765
|
+
setVisible(false);
|
|
766
|
+
}
|
|
767
|
+
useEffect(() => {
|
|
768
|
+
function handleOutside(event) {
|
|
769
|
+
if (visible && !rootRef.current?.contains(event.target))
|
|
770
|
+
setVisible(false);
|
|
771
|
+
}
|
|
772
|
+
function handleKeyDown(event) {
|
|
773
|
+
if (event.defaultPrevented || !rootRef.current?.contains(event.target))
|
|
774
|
+
return;
|
|
775
|
+
if (event.key === "Escape" && visible) {
|
|
776
|
+
event.preventDefault();
|
|
777
|
+
closeAndFocus();
|
|
778
|
+
} else if (event.key === "ArrowDown" && event.target === inputRef.current) {
|
|
779
|
+
event.preventDefault();
|
|
780
|
+
setVisible(true);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
document.addEventListener("pointerdown", handleOutside);
|
|
784
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
785
|
+
return () => {
|
|
786
|
+
document.removeEventListener("pointerdown", handleOutside);
|
|
787
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
788
|
+
};
|
|
789
|
+
});
|
|
790
|
+
return {
|
|
791
|
+
rootRef,
|
|
792
|
+
inputRef,
|
|
793
|
+
panelId,
|
|
794
|
+
visible,
|
|
795
|
+
setVisible,
|
|
796
|
+
closeAndFocus,
|
|
797
|
+
onInputFocus: () => {
|
|
798
|
+
if (!skipFocus.current)
|
|
799
|
+
setVisible(true);
|
|
800
|
+
},
|
|
801
|
+
onRootBlur: (event) => {
|
|
802
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
803
|
+
setVisible(false);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
}
|
|
161
807
|
|
|
162
808
|
// src/classes/date-picker.ts
|
|
163
809
|
var datePickerBaseClass = "datepicker";
|
|
@@ -206,7 +852,7 @@ function getDatePickerDropdownClasses({
|
|
|
206
852
|
}
|
|
207
853
|
|
|
208
854
|
// src/components/date-picker/DatePicker.tsx
|
|
209
|
-
import { jsx as
|
|
855
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
210
856
|
function todayValue(picker) {
|
|
211
857
|
const today = new Date;
|
|
212
858
|
const year = today.getFullYear();
|
|
@@ -245,9 +891,10 @@ function placeholderForPicker(picker) {
|
|
|
245
891
|
function normalizeDateValue(value) {
|
|
246
892
|
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
247
893
|
}
|
|
248
|
-
var DatePickerRoot =
|
|
894
|
+
var DatePickerRoot = forwardRef2(({
|
|
249
895
|
allowClear,
|
|
250
896
|
className,
|
|
897
|
+
inputProps,
|
|
251
898
|
defaultOpen,
|
|
252
899
|
defaultValue,
|
|
253
900
|
disabled,
|
|
@@ -266,19 +913,19 @@ var DatePickerRoot = forwardRef(({
|
|
|
266
913
|
value,
|
|
267
914
|
...props
|
|
268
915
|
}, ref) => {
|
|
916
|
+
const [calendarMode, setCalendarMode] = useState3("month");
|
|
269
917
|
const isValueControlled = value !== undefined;
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
|
|
918
|
+
const [innerValue, setInnerValue] = useState3(() => normalizeDateValue(defaultValue));
|
|
919
|
+
const dropdown = usePickerDropdown({
|
|
920
|
+
open,
|
|
921
|
+
defaultOpen,
|
|
922
|
+
disabled,
|
|
923
|
+
onOpenChange,
|
|
924
|
+
ref
|
|
925
|
+
});
|
|
273
926
|
const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
|
|
274
|
-
const visible
|
|
927
|
+
const { visible, setVisible } = dropdown;
|
|
275
928
|
const inputType = inputTypeForPicker(picker);
|
|
276
|
-
function setVisible(nextOpen) {
|
|
277
|
-
if (!isOpenControlled) {
|
|
278
|
-
setInnerOpen(nextOpen);
|
|
279
|
-
}
|
|
280
|
-
onOpenChange?.(nextOpen);
|
|
281
|
-
}
|
|
282
929
|
function emitChange(nextValue) {
|
|
283
930
|
if (nextValue && disabledDate?.(nextValue)) {
|
|
284
931
|
return;
|
|
@@ -288,10 +935,17 @@ var DatePickerRoot = forwardRef(({
|
|
|
288
935
|
}
|
|
289
936
|
onChange?.(nextValue, nextValue ?? "");
|
|
290
937
|
}
|
|
291
|
-
|
|
292
|
-
|
|
938
|
+
function selectValue(nextValue) {
|
|
939
|
+
if (disabledDate?.(nextValue))
|
|
940
|
+
return;
|
|
941
|
+
emitChange(nextValue);
|
|
942
|
+
dropdown.closeAndFocus();
|
|
943
|
+
}
|
|
944
|
+
const presetItems = useMemo2(() => presets ?? [], [presets]);
|
|
945
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
293
946
|
...props,
|
|
294
|
-
ref,
|
|
947
|
+
ref: dropdown.rootRef,
|
|
948
|
+
onBlur: dropdown.onRootBlur,
|
|
295
949
|
className: getDatePickerClasses({
|
|
296
950
|
size,
|
|
297
951
|
status,
|
|
@@ -301,7 +955,11 @@ var DatePickerRoot = forwardRef(({
|
|
|
301
955
|
className
|
|
302
956
|
}),
|
|
303
957
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ jsx3("input", {
|
|
959
|
+
...inputProps,
|
|
960
|
+
ref: dropdown.inputRef,
|
|
961
|
+
"aria-haspopup": "dialog",
|
|
962
|
+
"aria-controls": visible ? dropdown.panelId : undefined,
|
|
305
963
|
className: datePickerInputClass,
|
|
306
964
|
disabled,
|
|
307
965
|
type: inputType,
|
|
@@ -309,15 +967,15 @@ var DatePickerRoot = forwardRef(({
|
|
|
309
967
|
placeholder: placeholder ?? placeholderForPicker(picker),
|
|
310
968
|
onFocus: (event) => {
|
|
311
969
|
onFocus?.(event);
|
|
312
|
-
|
|
970
|
+
dropdown.onInputFocus();
|
|
313
971
|
},
|
|
314
972
|
onBlur: (event) => {
|
|
315
973
|
onBlur?.(event);
|
|
316
|
-
setVisible(false);
|
|
317
974
|
},
|
|
975
|
+
onClick: () => setVisible(true),
|
|
318
976
|
onChange: (event) => emitChange(event.currentTarget.value || undefined)
|
|
319
977
|
}),
|
|
320
|
-
allowClear && currentValue && !disabled ? /* @__PURE__ */
|
|
978
|
+
allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
321
979
|
type: "button",
|
|
322
980
|
className: datePickerClearClass,
|
|
323
981
|
"aria-label": "Clear date",
|
|
@@ -325,26 +983,95 @@ var DatePickerRoot = forwardRef(({
|
|
|
325
983
|
onClick: () => emitChange(undefined),
|
|
326
984
|
children: "x"
|
|
327
985
|
}) : null,
|
|
328
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ jsx3("button", {
|
|
987
|
+
type: "button",
|
|
329
988
|
className: datePickerIconClass,
|
|
330
|
-
"aria-
|
|
989
|
+
"aria-label": "Open date picker",
|
|
990
|
+
"aria-haspopup": "dialog",
|
|
991
|
+
"aria-expanded": visible,
|
|
992
|
+
"aria-controls": visible ? dropdown.panelId : undefined,
|
|
993
|
+
disabled,
|
|
994
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
995
|
+
onClick: () => setVisible(!visible),
|
|
996
|
+
children: /* @__PURE__ */ jsxs3("svg", {
|
|
997
|
+
"aria-hidden": "true",
|
|
998
|
+
focusable: "false",
|
|
999
|
+
width: "18",
|
|
1000
|
+
height: "18",
|
|
1001
|
+
viewBox: "0 0 24 24",
|
|
1002
|
+
fill: "none",
|
|
1003
|
+
stroke: "currentColor",
|
|
1004
|
+
strokeWidth: "1.75",
|
|
1005
|
+
strokeLinecap: "round",
|
|
1006
|
+
strokeLinejoin: "round",
|
|
1007
|
+
children: [
|
|
1008
|
+
/* @__PURE__ */ jsx3("rect", {
|
|
1009
|
+
x: "3",
|
|
1010
|
+
y: "5",
|
|
1011
|
+
width: "18",
|
|
1012
|
+
height: "16",
|
|
1013
|
+
rx: "2"
|
|
1014
|
+
}),
|
|
1015
|
+
/* @__PURE__ */ jsx3("path", {
|
|
1016
|
+
d: "M8 3v4M16 3v4M3 10h18"
|
|
1017
|
+
})
|
|
1018
|
+
]
|
|
1019
|
+
})
|
|
331
1020
|
}),
|
|
332
|
-
|
|
1021
|
+
visible ? /* @__PURE__ */ jsxs3("div", {
|
|
1022
|
+
id: dropdown.panelId,
|
|
1023
|
+
role: "dialog",
|
|
1024
|
+
"aria-label": "Choose date",
|
|
333
1025
|
className: getDatePickerDropdownClasses({ open: visible }),
|
|
334
1026
|
children: [
|
|
335
|
-
|
|
1027
|
+
picker === "date" || picker === "month" ? /* @__PURE__ */ jsx3(Calendar, {
|
|
1028
|
+
fullscreen: false,
|
|
1029
|
+
value: currentValue,
|
|
1030
|
+
mode: picker === "month" ? "year" : calendarMode,
|
|
1031
|
+
onPanelChange: (_, mode) => {
|
|
1032
|
+
if (picker === "date")
|
|
1033
|
+
setCalendarMode(mode);
|
|
1034
|
+
},
|
|
1035
|
+
disabledDate: (date) => {
|
|
1036
|
+
if (!disabledDate)
|
|
1037
|
+
return false;
|
|
1038
|
+
if (picker === "month")
|
|
1039
|
+
return disabledDate(date.slice(0, 7));
|
|
1040
|
+
if (calendarMode === "year") {
|
|
1041
|
+
const [year, month] = date.split("-").map(Number);
|
|
1042
|
+
const days = new Date(year, month, 0).getDate();
|
|
1043
|
+
return Array.from({ length: days }, (_, index) => `${date.slice(0, 7)}-${String(index + 1).padStart(2, "0")}`).every((day) => disabledDate(day));
|
|
1044
|
+
}
|
|
1045
|
+
return disabledDate(date);
|
|
1046
|
+
},
|
|
1047
|
+
onSelect: (date, info) => {
|
|
1048
|
+
if (picker === "date" && info.source === "month") {
|
|
1049
|
+
setCalendarMode("month");
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
selectValue(picker === "month" ? date.slice(0, 7) : date);
|
|
1053
|
+
}
|
|
1054
|
+
}) : /* @__PURE__ */ jsx3("input", {
|
|
1055
|
+
type: inputType,
|
|
1056
|
+
"aria-label": placeholderForPicker(picker),
|
|
1057
|
+
value: currentValue ?? "",
|
|
1058
|
+
onChange: (event) => selectValue(event.currentTarget.value)
|
|
1059
|
+
}),
|
|
1060
|
+
presetItems.map((preset, index) => /* @__PURE__ */ jsx3("button", {
|
|
336
1061
|
type: "button",
|
|
337
1062
|
className: datePickerPresetClass,
|
|
338
1063
|
onMouseDown: (event) => event.preventDefault(),
|
|
339
|
-
|
|
1064
|
+
disabled: Boolean(disabledDate?.(preset.value)),
|
|
1065
|
+
onClick: () => selectValue(preset.value),
|
|
340
1066
|
children: preset.label
|
|
341
1067
|
}, index)),
|
|
342
|
-
showNow ? /* @__PURE__ */
|
|
1068
|
+
showNow ? /* @__PURE__ */ jsx3("div", {
|
|
343
1069
|
className: datePickerFooterClass,
|
|
344
|
-
children: /* @__PURE__ */
|
|
1070
|
+
children: /* @__PURE__ */ jsx3("button", {
|
|
345
1071
|
type: "button",
|
|
346
1072
|
onMouseDown: (event) => event.preventDefault(),
|
|
347
|
-
|
|
1073
|
+
disabled: Boolean(disabledDate?.(todayValue(picker))),
|
|
1074
|
+
onClick: () => selectValue(todayValue(picker)),
|
|
348
1075
|
children: "Now"
|
|
349
1076
|
})
|
|
350
1077
|
}) : null
|
|
@@ -354,9 +1081,10 @@ var DatePickerRoot = forwardRef(({
|
|
|
354
1081
|
});
|
|
355
1082
|
});
|
|
356
1083
|
DatePickerRoot.displayName = "DatePicker";
|
|
357
|
-
var RangePicker =
|
|
1084
|
+
var RangePicker = forwardRef2(({
|
|
358
1085
|
allowClear,
|
|
359
1086
|
className,
|
|
1087
|
+
inputProps,
|
|
360
1088
|
defaultValue,
|
|
361
1089
|
disabled,
|
|
362
1090
|
disabledDate,
|
|
@@ -370,7 +1098,7 @@ var RangePicker = forwardRef(({
|
|
|
370
1098
|
...props
|
|
371
1099
|
}, ref) => {
|
|
372
1100
|
const isControlled = value !== undefined;
|
|
373
|
-
const [innerValue, setInnerValue] =
|
|
1101
|
+
const [innerValue, setInnerValue] = useState3(defaultValue ?? [undefined, undefined]);
|
|
374
1102
|
const currentValue = isControlled ? value : innerValue;
|
|
375
1103
|
const inputType = inputTypeForPicker(picker);
|
|
376
1104
|
function emitChange(nextValue) {
|
|
@@ -385,7 +1113,7 @@ var RangePicker = forwardRef(({
|
|
|
385
1113
|
function updateIndex(index, nextItem) {
|
|
386
1114
|
emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
|
|
387
1115
|
}
|
|
388
|
-
return /* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
389
1117
|
...props,
|
|
390
1118
|
ref,
|
|
391
1119
|
className: getDatePickerClasses({
|
|
@@ -397,7 +1125,8 @@ var RangePicker = forwardRef(({
|
|
|
397
1125
|
className
|
|
398
1126
|
}),
|
|
399
1127
|
children: [
|
|
400
|
-
/* @__PURE__ */
|
|
1128
|
+
/* @__PURE__ */ jsx3("input", {
|
|
1129
|
+
...inputProps,
|
|
401
1130
|
className: datePickerInputClass,
|
|
402
1131
|
disabled,
|
|
403
1132
|
type: inputType,
|
|
@@ -405,11 +1134,13 @@ var RangePicker = forwardRef(({
|
|
|
405
1134
|
placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
|
|
406
1135
|
onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
|
|
407
1136
|
}),
|
|
408
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ jsx3("span", {
|
|
409
1138
|
className: datePickerSeparatorClass,
|
|
410
1139
|
children: separator
|
|
411
1140
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ jsx3("input", {
|
|
1142
|
+
...inputProps,
|
|
1143
|
+
id: inputProps?.id ? `${inputProps.id}-end` : undefined,
|
|
413
1144
|
className: datePickerInputClass,
|
|
414
1145
|
disabled,
|
|
415
1146
|
type: inputType,
|
|
@@ -417,7 +1148,7 @@ var RangePicker = forwardRef(({
|
|
|
417
1148
|
placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
|
|
418
1149
|
onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
|
|
419
1150
|
}),
|
|
420
|
-
allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */
|
|
1151
|
+
allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
421
1152
|
type: "button",
|
|
422
1153
|
className: datePickerClearClass,
|
|
423
1154
|
"aria-label": "Clear date range",
|
|
@@ -429,7 +1160,7 @@ var RangePicker = forwardRef(({
|
|
|
429
1160
|
});
|
|
430
1161
|
RangePicker.displayName = "DatePicker.RangePicker";
|
|
431
1162
|
function withPicker(picker, displayName) {
|
|
432
|
-
const Picker =
|
|
1163
|
+
const Picker = forwardRef2((props, ref) => /* @__PURE__ */ jsx3(DatePickerRoot, {
|
|
433
1164
|
...props,
|
|
434
1165
|
ref,
|
|
435
1166
|
picker
|
|
@@ -446,10 +1177,10 @@ var DatePicker = Object.assign(DatePickerRoot, {
|
|
|
446
1177
|
});
|
|
447
1178
|
// src/components/input/Input.tsx
|
|
448
1179
|
import {
|
|
449
|
-
forwardRef as
|
|
450
|
-
useImperativeHandle,
|
|
451
|
-
useRef,
|
|
452
|
-
useState as
|
|
1180
|
+
forwardRef as forwardRef3,
|
|
1181
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1182
|
+
useRef as useRef2,
|
|
1183
|
+
useState as useState4
|
|
453
1184
|
} from "react";
|
|
454
1185
|
|
|
455
1186
|
// src/classes/input.ts
|
|
@@ -538,14 +1269,14 @@ function getTextAreaCountClasses({ exceeded }) {
|
|
|
538
1269
|
}
|
|
539
1270
|
|
|
540
1271
|
// src/components/input/Input.tsx
|
|
541
|
-
import { jsx as
|
|
1272
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
542
1273
|
function toTextValue(value) {
|
|
543
1274
|
if (Array.isArray(value)) {
|
|
544
1275
|
return value.join(",");
|
|
545
1276
|
}
|
|
546
1277
|
return value == null ? "" : String(value);
|
|
547
1278
|
}
|
|
548
|
-
var InputRoot =
|
|
1279
|
+
var InputRoot = forwardRef3(({
|
|
549
1280
|
allowClear,
|
|
550
1281
|
className,
|
|
551
1282
|
defaultValue,
|
|
@@ -560,12 +1291,12 @@ var InputRoot = forwardRef2(({
|
|
|
560
1291
|
variant = "outlined",
|
|
561
1292
|
...props
|
|
562
1293
|
}, ref) => {
|
|
563
|
-
const inputRef =
|
|
564
|
-
const [internalValue, setInternalValue] =
|
|
1294
|
+
const inputRef = useRef2(null);
|
|
1295
|
+
const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
|
|
565
1296
|
const isControlled = value !== undefined;
|
|
566
1297
|
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
567
1298
|
const hasAffix = prefix != null || suffix != null || allowClear;
|
|
568
|
-
|
|
1299
|
+
useImperativeHandle2(ref, () => inputRef.current);
|
|
569
1300
|
function handleChange(event) {
|
|
570
1301
|
if (!isControlled) {
|
|
571
1302
|
setInternalValue(event.currentTarget.value);
|
|
@@ -588,7 +1319,7 @@ var InputRoot = forwardRef2(({
|
|
|
588
1319
|
});
|
|
589
1320
|
input.focus();
|
|
590
1321
|
}
|
|
591
|
-
const control = /* @__PURE__ */
|
|
1322
|
+
const control = /* @__PURE__ */ jsx4("input", {
|
|
592
1323
|
...props,
|
|
593
1324
|
ref: inputRef,
|
|
594
1325
|
type,
|
|
@@ -601,22 +1332,22 @@ var InputRoot = forwardRef2(({
|
|
|
601
1332
|
return control;
|
|
602
1333
|
}
|
|
603
1334
|
const showClear = allowClear && !disabled && currentValue.length > 0;
|
|
604
|
-
return /* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ jsxs4("span", {
|
|
605
1336
|
className: getInputWrapperClasses({ affixed: hasAffix }),
|
|
606
1337
|
children: [
|
|
607
|
-
prefix != null ? /* @__PURE__ */
|
|
1338
|
+
prefix != null ? /* @__PURE__ */ jsx4("span", {
|
|
608
1339
|
className: inputPrefixClass,
|
|
609
1340
|
children: prefix
|
|
610
1341
|
}) : null,
|
|
611
1342
|
control,
|
|
612
|
-
showClear ? /* @__PURE__ */
|
|
1343
|
+
showClear ? /* @__PURE__ */ jsx4("button", {
|
|
613
1344
|
type: "button",
|
|
614
1345
|
className: inputClearClass,
|
|
615
1346
|
"aria-label": "Clear input",
|
|
616
1347
|
onClick: handleClear,
|
|
617
1348
|
children: "x"
|
|
618
1349
|
}) : null,
|
|
619
|
-
suffix != null ? /* @__PURE__ */
|
|
1350
|
+
suffix != null ? /* @__PURE__ */ jsx4("span", {
|
|
620
1351
|
className: inputSuffixClass,
|
|
621
1352
|
children: suffix
|
|
622
1353
|
}) : null
|
|
@@ -624,7 +1355,7 @@ var InputRoot = forwardRef2(({
|
|
|
624
1355
|
});
|
|
625
1356
|
});
|
|
626
1357
|
InputRoot.displayName = "Input";
|
|
627
|
-
var Search =
|
|
1358
|
+
var Search = forwardRef3(({
|
|
628
1359
|
className,
|
|
629
1360
|
disabled,
|
|
630
1361
|
enterButton,
|
|
@@ -633,8 +1364,8 @@ var Search = forwardRef2(({
|
|
|
633
1364
|
onSearch,
|
|
634
1365
|
...props
|
|
635
1366
|
}, ref) => {
|
|
636
|
-
const inputRef =
|
|
637
|
-
|
|
1367
|
+
const inputRef = useRef2(null);
|
|
1368
|
+
useImperativeHandle2(ref, () => inputRef.current);
|
|
638
1369
|
function emitSearch(event) {
|
|
639
1370
|
onSearch?.(inputRef.current?.value ?? "", event);
|
|
640
1371
|
}
|
|
@@ -645,16 +1376,16 @@ var Search = forwardRef2(({
|
|
|
645
1376
|
}
|
|
646
1377
|
}
|
|
647
1378
|
const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
|
|
648
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ jsxs4("span", {
|
|
649
1380
|
className: getSearchWrapperClasses({ className }),
|
|
650
1381
|
children: [
|
|
651
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsx4(InputRoot, {
|
|
652
1383
|
...props,
|
|
653
1384
|
ref: inputRef,
|
|
654
1385
|
disabled,
|
|
655
1386
|
onKeyDown: handleKeyDown
|
|
656
1387
|
}),
|
|
657
|
-
enterButton || loading ? /* @__PURE__ */
|
|
1388
|
+
enterButton || loading ? /* @__PURE__ */ jsx4("button", {
|
|
658
1389
|
type: "button",
|
|
659
1390
|
className: inputSearchButtonClass,
|
|
660
1391
|
disabled: disabled || loading,
|
|
@@ -666,10 +1397,10 @@ var Search = forwardRef2(({
|
|
|
666
1397
|
});
|
|
667
1398
|
});
|
|
668
1399
|
Search.displayName = "Input.Search";
|
|
669
|
-
var Password =
|
|
670
|
-
const [visible, setVisible] =
|
|
1400
|
+
var Password = forwardRef3(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
|
|
1401
|
+
const [visible, setVisible] = useState4(false);
|
|
671
1402
|
const type = visible ? "text" : "password";
|
|
672
|
-
const toggle = visibilityToggle ? /* @__PURE__ */
|
|
1403
|
+
const toggle = visibilityToggle ? /* @__PURE__ */ jsx4("button", {
|
|
673
1404
|
type: "button",
|
|
674
1405
|
className: inputPasswordToggleClass,
|
|
675
1406
|
disabled,
|
|
@@ -679,9 +1410,9 @@ var Password = forwardRef2(({ className, disabled, visibilityToggle = true, ...p
|
|
|
679
1410
|
},
|
|
680
1411
|
children: visible ? "Hide" : "Show"
|
|
681
1412
|
}) : undefined;
|
|
682
|
-
return /* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ jsx4("span", {
|
|
683
1414
|
className: getPasswordWrapperClasses({ className }),
|
|
684
|
-
children: /* @__PURE__ */
|
|
1415
|
+
children: /* @__PURE__ */ jsx4(InputRoot, {
|
|
685
1416
|
...props,
|
|
686
1417
|
ref,
|
|
687
1418
|
disabled,
|
|
@@ -691,7 +1422,7 @@ var Password = forwardRef2(({ className, disabled, visibilityToggle = true, ...p
|
|
|
691
1422
|
});
|
|
692
1423
|
});
|
|
693
1424
|
Password.displayName = "Input.Password";
|
|
694
|
-
var TextArea =
|
|
1425
|
+
var TextArea = forwardRef3(({
|
|
695
1426
|
autoSize,
|
|
696
1427
|
className,
|
|
697
1428
|
defaultValue,
|
|
@@ -705,7 +1436,7 @@ var TextArea = forwardRef2(({
|
|
|
705
1436
|
variant = "outlined",
|
|
706
1437
|
...props
|
|
707
1438
|
}, ref) => {
|
|
708
|
-
const [internalValue, setInternalValue] =
|
|
1439
|
+
const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
|
|
709
1440
|
const isControlled = value !== undefined;
|
|
710
1441
|
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
711
1442
|
const count = currentValue.length;
|
|
@@ -716,7 +1447,7 @@ var TextArea = forwardRef2(({
|
|
|
716
1447
|
}
|
|
717
1448
|
onChange?.(event);
|
|
718
1449
|
}
|
|
719
|
-
const control = /* @__PURE__ */
|
|
1450
|
+
const control = /* @__PURE__ */ jsx4("textarea", {
|
|
720
1451
|
...props,
|
|
721
1452
|
ref,
|
|
722
1453
|
className: getTextAreaClasses({
|
|
@@ -734,11 +1465,11 @@ var TextArea = forwardRef2(({
|
|
|
734
1465
|
if (!showCount) {
|
|
735
1466
|
return control;
|
|
736
1467
|
}
|
|
737
|
-
return /* @__PURE__ */
|
|
1468
|
+
return /* @__PURE__ */ jsxs4("span", {
|
|
738
1469
|
className: textAreaWrapperClass,
|
|
739
1470
|
children: [
|
|
740
1471
|
control,
|
|
741
|
-
/* @__PURE__ */
|
|
1472
|
+
/* @__PURE__ */ jsxs4("span", {
|
|
742
1473
|
className: getTextAreaCountClasses({ exceeded }),
|
|
743
1474
|
children: [
|
|
744
1475
|
count,
|
|
@@ -749,7 +1480,7 @@ var TextArea = forwardRef2(({
|
|
|
749
1480
|
});
|
|
750
1481
|
});
|
|
751
1482
|
TextArea.displayName = "Input.TextArea";
|
|
752
|
-
var Group =
|
|
1483
|
+
var Group = forwardRef3(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
753
1484
|
...props,
|
|
754
1485
|
ref,
|
|
755
1486
|
className: cn(inputGroupClass, className),
|
|
@@ -763,7 +1494,7 @@ var Input = Object.assign(InputRoot, {
|
|
|
763
1494
|
Group
|
|
764
1495
|
});
|
|
765
1496
|
// src/components/select/Select.tsx
|
|
766
|
-
import
|
|
1497
|
+
import React5, { forwardRef as forwardRef4, useMemo as useMemo3, useState as useState5 } from "react";
|
|
767
1498
|
|
|
768
1499
|
// src/classes/select.ts
|
|
769
1500
|
var selectContainerClass = "select-container";
|
|
@@ -819,7 +1550,7 @@ function getSelectOptionClasses({
|
|
|
819
1550
|
}
|
|
820
1551
|
|
|
821
1552
|
// src/components/select/Select.tsx
|
|
822
|
-
import { jsx as
|
|
1553
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
823
1554
|
function isGroup(option) {
|
|
824
1555
|
return "options" in option;
|
|
825
1556
|
}
|
|
@@ -844,8 +1575,8 @@ function normalizeMultiValue(value) {
|
|
|
844
1575
|
}
|
|
845
1576
|
function optionsFromChildren(children) {
|
|
846
1577
|
const result = [];
|
|
847
|
-
|
|
848
|
-
if (!
|
|
1578
|
+
React5.Children.forEach(children, (child) => {
|
|
1579
|
+
if (!React5.isValidElement(child)) {
|
|
849
1580
|
return;
|
|
850
1581
|
}
|
|
851
1582
|
if (child.type === Option) {
|
|
@@ -895,25 +1626,31 @@ function filterOptions(options, searchValue, filterOption) {
|
|
|
895
1626
|
function renderValue(option) {
|
|
896
1627
|
return option ? optionLabel(option) : null;
|
|
897
1628
|
}
|
|
898
|
-
var Option =
|
|
1629
|
+
var Option = forwardRef4(({ children, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
899
1630
|
...props,
|
|
900
1631
|
ref,
|
|
901
1632
|
children
|
|
902
1633
|
}));
|
|
903
1634
|
Option.displayName = "Select.Option";
|
|
904
|
-
var OptGroup =
|
|
1635
|
+
var OptGroup = forwardRef4(({ children, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
905
1636
|
...props,
|
|
906
1637
|
ref,
|
|
907
1638
|
children
|
|
908
1639
|
}));
|
|
909
1640
|
OptGroup.displayName = "Select.OptGroup";
|
|
910
|
-
var SelectRoot =
|
|
1641
|
+
var SelectRoot = forwardRef4(({
|
|
911
1642
|
allowClear,
|
|
1643
|
+
"aria-describedby": ariaDescribedBy,
|
|
1644
|
+
"aria-errormessage": ariaErrorMessage,
|
|
1645
|
+
"aria-invalid": ariaInvalid,
|
|
1646
|
+
"aria-label": ariaLabel,
|
|
1647
|
+
"aria-labelledby": ariaLabelledBy,
|
|
912
1648
|
children,
|
|
913
1649
|
className,
|
|
914
1650
|
defaultValue,
|
|
915
1651
|
disabled,
|
|
916
1652
|
filterOption,
|
|
1653
|
+
id,
|
|
917
1654
|
loading,
|
|
918
1655
|
mode,
|
|
919
1656
|
onChange,
|
|
@@ -926,11 +1663,11 @@ var SelectRoot = forwardRef3(({
|
|
|
926
1663
|
...props
|
|
927
1664
|
}, ref) => {
|
|
928
1665
|
const multiple = mode === "multiple" || mode === "tags";
|
|
929
|
-
const sourceOptions =
|
|
930
|
-
const flatOptions =
|
|
931
|
-
const [open, setOpen] =
|
|
932
|
-
const [searchValue, setSearchValue] =
|
|
933
|
-
const [internalValue, setInternalValue] =
|
|
1666
|
+
const sourceOptions = useMemo3(() => options ?? optionsFromChildren(children), [children, options]);
|
|
1667
|
+
const flatOptions = useMemo3(() => flattenOptions(sourceOptions), [sourceOptions]);
|
|
1668
|
+
const [open, setOpen] = useState5(false);
|
|
1669
|
+
const [searchValue, setSearchValue] = useState5("");
|
|
1670
|
+
const [internalValue, setInternalValue] = useState5(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
|
|
934
1671
|
const controlled = value !== undefined;
|
|
935
1672
|
const currentValue = controlled ? value : internalValue;
|
|
936
1673
|
const selectedValues = multiple ? normalizeMultiValue(currentValue) : normalizeSingleValue(currentValue) === undefined ? [] : [normalizeSingleValue(currentValue)];
|
|
@@ -987,7 +1724,7 @@ var SelectRoot = forwardRef3(({
|
|
|
987
1724
|
}
|
|
988
1725
|
function renderOption(option) {
|
|
989
1726
|
const selected = selectedKeys.has(valueKey(option.value));
|
|
990
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsx5("button", {
|
|
991
1728
|
type: "button",
|
|
992
1729
|
role: "option",
|
|
993
1730
|
"aria-selected": selected,
|
|
@@ -1006,11 +1743,11 @@ var SelectRoot = forwardRef3(({
|
|
|
1006
1743
|
if (!isGroup(option)) {
|
|
1007
1744
|
return renderOption(option);
|
|
1008
1745
|
}
|
|
1009
|
-
return /* @__PURE__ */
|
|
1746
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1010
1747
|
className: cn(selectGroupClass, option.className),
|
|
1011
1748
|
role: "group",
|
|
1012
1749
|
children: [
|
|
1013
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1014
1751
|
className: selectGroupLabelClass,
|
|
1015
1752
|
children: option.label
|
|
1016
1753
|
}),
|
|
@@ -1019,11 +1756,11 @@ var SelectRoot = forwardRef3(({
|
|
|
1019
1756
|
}, `group-${index}`);
|
|
1020
1757
|
});
|
|
1021
1758
|
}
|
|
1022
|
-
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
1759
|
+
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx5("span", {
|
|
1023
1760
|
className: selectTagClass,
|
|
1024
1761
|
children: renderValue(option)
|
|
1025
1762
|
}, valueKey(option.value))) : renderValue(selectedOptions[0]);
|
|
1026
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1027
1764
|
...props,
|
|
1028
1765
|
ref,
|
|
1029
1766
|
className: getSelectContainerClasses({
|
|
@@ -1034,41 +1771,47 @@ var SelectRoot = forwardRef3(({
|
|
|
1034
1771
|
className
|
|
1035
1772
|
}),
|
|
1036
1773
|
children: [
|
|
1037
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ jsxs5("button", {
|
|
1038
1775
|
type: "button",
|
|
1776
|
+
id,
|
|
1039
1777
|
className: getSelectClasses({ size, status, disabled }),
|
|
1040
1778
|
disabled: disabled || loading,
|
|
1779
|
+
"aria-describedby": ariaDescribedBy,
|
|
1780
|
+
"aria-errormessage": ariaErrorMessage,
|
|
1781
|
+
"aria-invalid": ariaInvalid,
|
|
1782
|
+
"aria-label": ariaLabel,
|
|
1783
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1041
1784
|
"aria-haspopup": "listbox",
|
|
1042
1785
|
"aria-expanded": open,
|
|
1043
1786
|
onClick: () => setOpen((current) => !current),
|
|
1044
1787
|
children: [
|
|
1045
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ jsx5("span", {
|
|
1046
1789
|
className: selectSelectionClass,
|
|
1047
|
-
children: hasValue ? selection : /* @__PURE__ */
|
|
1790
|
+
children: hasValue ? selection : /* @__PURE__ */ jsx5("span", {
|
|
1048
1791
|
className: selectPlaceholderClass,
|
|
1049
1792
|
children: placeholder
|
|
1050
1793
|
})
|
|
1051
1794
|
}),
|
|
1052
|
-
/* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ jsx5("span", {
|
|
1053
1796
|
className: selectIconClass,
|
|
1054
1797
|
"aria-hidden": "true",
|
|
1055
1798
|
children: "v"
|
|
1056
1799
|
})
|
|
1057
1800
|
]
|
|
1058
1801
|
}),
|
|
1059
|
-
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */
|
|
1802
|
+
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx5("button", {
|
|
1060
1803
|
type: "button",
|
|
1061
1804
|
className: selectClearClass,
|
|
1062
1805
|
"aria-label": "Clear selection",
|
|
1063
1806
|
onClick: clearValue,
|
|
1064
1807
|
children: "x"
|
|
1065
1808
|
}) : null,
|
|
1066
|
-
open ? /* @__PURE__ */
|
|
1809
|
+
open ? /* @__PURE__ */ jsxs5("div", {
|
|
1067
1810
|
className: selectDropdownClass,
|
|
1068
1811
|
role: "listbox",
|
|
1069
1812
|
"aria-multiselectable": multiple || undefined,
|
|
1070
1813
|
children: [
|
|
1071
|
-
searchable ? /* @__PURE__ */
|
|
1814
|
+
searchable ? /* @__PURE__ */ jsx5("input", {
|
|
1072
1815
|
className: selectSearchClass,
|
|
1073
1816
|
value: searchValue,
|
|
1074
1817
|
placeholder: typeof placeholder === "string" ? placeholder : undefined,
|
|
@@ -1080,7 +1823,7 @@ var SelectRoot = forwardRef3(({
|
|
|
1080
1823
|
}
|
|
1081
1824
|
}
|
|
1082
1825
|
}) : null,
|
|
1083
|
-
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */
|
|
1826
|
+
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx5("div", {
|
|
1084
1827
|
className: selectEmptyClass,
|
|
1085
1828
|
children: "No data"
|
|
1086
1829
|
})
|
|
@@ -1094,7 +1837,7 @@ var Select = SelectRoot;
|
|
|
1094
1837
|
Select.Option = Option;
|
|
1095
1838
|
Select.OptGroup = OptGroup;
|
|
1096
1839
|
// src/components/dm-search/DmSearch.tsx
|
|
1097
|
-
import { jsx as
|
|
1840
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1098
1841
|
function initialValues(items, searchParams, useSearchParams = true) {
|
|
1099
1842
|
return items.reduce((acc, item) => {
|
|
1100
1843
|
const defaultValue = item.search.extraProps?.value ?? item.search.formProps?.initialValue;
|
|
@@ -1118,7 +1861,7 @@ function renderField({
|
|
|
1118
1861
|
return item.search.render?.(value, setValue, item) ?? null;
|
|
1119
1862
|
}
|
|
1120
1863
|
if (item.search.type === "select") {
|
|
1121
|
-
return /* @__PURE__ */
|
|
1864
|
+
return /* @__PURE__ */ jsx6(Select, {
|
|
1122
1865
|
...extraProps,
|
|
1123
1866
|
disabled: Boolean(loading || extraProps.disabled),
|
|
1124
1867
|
value,
|
|
@@ -1127,25 +1870,25 @@ function renderField({
|
|
|
1127
1870
|
});
|
|
1128
1871
|
}
|
|
1129
1872
|
if (item.search.type === "dateRange") {
|
|
1130
|
-
return /* @__PURE__ */
|
|
1873
|
+
return /* @__PURE__ */ jsx6(DatePicker.RangePicker, {
|
|
1131
1874
|
...extraProps,
|
|
1132
1875
|
value,
|
|
1133
1876
|
onChange: (nextValue) => setValue(nextValue)
|
|
1134
1877
|
});
|
|
1135
1878
|
}
|
|
1136
1879
|
if (item.search.type === "date") {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1880
|
+
return /* @__PURE__ */ jsx6(DatePicker, {
|
|
1138
1881
|
...extraProps,
|
|
1139
1882
|
value,
|
|
1140
1883
|
onChange: (nextValue) => setValue(nextValue)
|
|
1141
1884
|
});
|
|
1142
1885
|
}
|
|
1143
1886
|
if (item.search.type === "radio" || item.search.type === "checkbox") {
|
|
1144
|
-
return /* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
1145
1888
|
role: item.search.type === "radio" ? "radiogroup" : "group",
|
|
1146
|
-
children: optionList(extraProps).map((option) => /* @__PURE__ */
|
|
1889
|
+
children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs6("label", {
|
|
1147
1890
|
children: [
|
|
1148
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ jsx6("input", {
|
|
1149
1892
|
type: item.search.type,
|
|
1150
1893
|
disabled: loading,
|
|
1151
1894
|
checked: item.search.type === "checkbox" ? Array.isArray(value) && value.includes(option.value) : value === option.value,
|
|
@@ -1163,7 +1906,7 @@ function renderField({
|
|
|
1163
1906
|
}, String(option.value)))
|
|
1164
1907
|
});
|
|
1165
1908
|
}
|
|
1166
|
-
return /* @__PURE__ */
|
|
1909
|
+
return /* @__PURE__ */ jsx6(Input, {
|
|
1167
1910
|
...extraProps,
|
|
1168
1911
|
type: item.search.type === "input-number" ? "number" : "text",
|
|
1169
1912
|
disabled: Boolean(loading || extraProps.disabled),
|
|
@@ -1177,8 +1920,11 @@ function renderField({
|
|
|
1177
1920
|
}
|
|
1178
1921
|
});
|
|
1179
1922
|
}
|
|
1180
|
-
var DmSearch =
|
|
1923
|
+
var DmSearch = forwardRef5(({
|
|
1181
1924
|
items = [],
|
|
1925
|
+
values: controlledValues,
|
|
1926
|
+
onValuesChange,
|
|
1927
|
+
onReset,
|
|
1182
1928
|
onSearch,
|
|
1183
1929
|
extra,
|
|
1184
1930
|
fastFilterItem,
|
|
@@ -1187,27 +1933,37 @@ var DmSearch = forwardRef4(({
|
|
|
1187
1933
|
compact = false,
|
|
1188
1934
|
searchParams,
|
|
1189
1935
|
loading = false,
|
|
1936
|
+
noValidate,
|
|
1190
1937
|
enableDefaultPlaceHolder = false,
|
|
1191
1938
|
className
|
|
1192
1939
|
}, ref) => {
|
|
1193
|
-
const allItems =
|
|
1194
|
-
const [collapsed, setCollapsed] =
|
|
1195
|
-
const [
|
|
1940
|
+
const allItems = useMemo4(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
|
|
1941
|
+
const [collapsed, setCollapsed] = useState6(defaultCollapsed);
|
|
1942
|
+
const [internalValues, setValues] = useState6(() => initialValues(allItems, searchParams));
|
|
1943
|
+
const controlled = controlledValues !== undefined;
|
|
1944
|
+
const values = controlled ? controlledValues : internalValues;
|
|
1196
1945
|
const visibleItems = collapsed ? allItems.slice(0, 1) : allItems;
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1946
|
+
useEffect2(() => {
|
|
1947
|
+
if (!controlled)
|
|
1948
|
+
setValues(initialValues(allItems, searchParams));
|
|
1949
|
+
}, [allItems, searchParams, controlled]);
|
|
1200
1950
|
function reset(useSearchParams = false) {
|
|
1201
1951
|
const nextValues = initialValues(allItems, searchParams, useSearchParams);
|
|
1202
|
-
|
|
1952
|
+
if (!controlled)
|
|
1953
|
+
setValues(nextValues);
|
|
1954
|
+
if (onReset)
|
|
1955
|
+
onReset(nextValues);
|
|
1956
|
+
else if (controlled)
|
|
1957
|
+
onValuesChange?.(nextValues);
|
|
1203
1958
|
return nextValues;
|
|
1204
1959
|
}
|
|
1205
|
-
|
|
1960
|
+
useImperativeHandle3(ref, () => ({
|
|
1206
1961
|
onReset: () => {
|
|
1207
1962
|
reset(false);
|
|
1208
1963
|
}
|
|
1209
1964
|
}));
|
|
1210
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsxs6("form", {
|
|
1966
|
+
noValidate,
|
|
1211
1967
|
id: "searchForm",
|
|
1212
1968
|
className: getDmSearchClasses({ compact, collapsed, className }),
|
|
1213
1969
|
onSubmit: (event) => {
|
|
@@ -1215,53 +1971,63 @@ var DmSearch = forwardRef4(({
|
|
|
1215
1971
|
onSearch?.(values);
|
|
1216
1972
|
},
|
|
1217
1973
|
children: [
|
|
1218
|
-
fastFilterItem ? /* @__PURE__ */
|
|
1974
|
+
fastFilterItem ? /* @__PURE__ */ jsx6("div", {
|
|
1219
1975
|
className: dmSearchFastFilterClass,
|
|
1220
1976
|
children: fastFilterItem.title
|
|
1221
1977
|
}) : null,
|
|
1222
|
-
/* @__PURE__ */
|
|
1978
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1223
1979
|
className: dmSearchFieldsClass,
|
|
1224
|
-
children: visibleItems.map((item) =>
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1980
|
+
children: visibleItems.map((item) => {
|
|
1981
|
+
const Field = item.search.type === "custom" ? "div" : "label";
|
|
1982
|
+
return /* @__PURE__ */ jsxs6(Field, {
|
|
1983
|
+
className: dmSearchFieldClass,
|
|
1984
|
+
children: [
|
|
1985
|
+
compact ? null : /* @__PURE__ */ jsx6("span", {
|
|
1986
|
+
children: item.title
|
|
1987
|
+
}),
|
|
1988
|
+
renderField({
|
|
1989
|
+
item,
|
|
1990
|
+
value: values[item.dataIndex],
|
|
1991
|
+
loading,
|
|
1992
|
+
enableDefaultPlaceHolder,
|
|
1993
|
+
setValue: (value) => {
|
|
1994
|
+
const nextValues = { ...values, [item.dataIndex]: value };
|
|
1995
|
+
if (!controlled)
|
|
1996
|
+
setValues(nextValues);
|
|
1997
|
+
onValuesChange?.(nextValues);
|
|
1998
|
+
}
|
|
1999
|
+
})
|
|
2000
|
+
]
|
|
2001
|
+
}, item.key);
|
|
2002
|
+
})
|
|
1242
2003
|
}),
|
|
1243
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
1244
2005
|
className: dmSearchActionsClass,
|
|
1245
2006
|
children: [
|
|
1246
|
-
/* @__PURE__ */
|
|
2007
|
+
/* @__PURE__ */ jsx6(Button, {
|
|
1247
2008
|
type: "submit",
|
|
1248
2009
|
isLoading: loading,
|
|
1249
2010
|
children: "Search"
|
|
1250
2011
|
}),
|
|
1251
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsx6(Button, {
|
|
1252
2013
|
type: "button",
|
|
1253
2014
|
color: "secondary",
|
|
1254
2015
|
appearance: "outline",
|
|
1255
|
-
onClick: () =>
|
|
2016
|
+
onClick: () => {
|
|
2017
|
+
const nextValues = reset(false);
|
|
2018
|
+
if (!onReset)
|
|
2019
|
+
onSearch?.(nextValues);
|
|
2020
|
+
},
|
|
1256
2021
|
children: "Reset"
|
|
1257
2022
|
}),
|
|
1258
|
-
!hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */
|
|
2023
|
+
!hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx6(Button, {
|
|
1259
2024
|
type: "button",
|
|
1260
2025
|
color: "secondary",
|
|
1261
2026
|
appearance: "text",
|
|
1262
2027
|
onClick: () => {
|
|
1263
2028
|
setCollapsed((current) => !current);
|
|
1264
|
-
|
|
2029
|
+
if (!controlled)
|
|
2030
|
+
setValues(initialValues(allItems, searchParams));
|
|
1265
2031
|
},
|
|
1266
2032
|
children: collapsed ? "Expand" : "Collapse"
|
|
1267
2033
|
}) : null,
|
|
@@ -1273,7 +2039,7 @@ var DmSearch = forwardRef4(({
|
|
|
1273
2039
|
});
|
|
1274
2040
|
DmSearch.displayName = "DmSearch";
|
|
1275
2041
|
// src/components/dm-query/DmQuery.tsx
|
|
1276
|
-
import { jsx as
|
|
2042
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1277
2043
|
function toSearchItem(item) {
|
|
1278
2044
|
return {
|
|
1279
2045
|
key: item.key,
|
|
@@ -1282,11 +2048,12 @@ function toSearchItem(item) {
|
|
|
1282
2048
|
search: {
|
|
1283
2049
|
type: item.type,
|
|
1284
2050
|
extraProps: item.extraProps,
|
|
1285
|
-
formProps: item.customProps
|
|
2051
|
+
formProps: item.customProps,
|
|
2052
|
+
render: item.render
|
|
1286
2053
|
}
|
|
1287
2054
|
};
|
|
1288
2055
|
}
|
|
1289
|
-
var DmQuery =
|
|
2056
|
+
var DmQuery = forwardRef6(({
|
|
1290
2057
|
queryItem,
|
|
1291
2058
|
fastFilterItem,
|
|
1292
2059
|
collapsed = false,
|
|
@@ -1294,35 +2061,23 @@ var DmQuery = forwardRef5(({
|
|
|
1294
2061
|
onSearch,
|
|
1295
2062
|
...props
|
|
1296
2063
|
}, ref) => {
|
|
1297
|
-
const searchRef =
|
|
1298
|
-
const [selectedItem, setSelectedItem] =
|
|
2064
|
+
const searchRef = useRef3(null);
|
|
2065
|
+
const [selectedItem, setSelectedItem] = useState7(queryItem[0]);
|
|
1299
2066
|
const items = selectedItem ? [toSearchItem(selectedItem)] : queryItem.map(toSearchItem);
|
|
1300
|
-
|
|
2067
|
+
useImperativeHandle4(ref, () => ({
|
|
1301
2068
|
onReset: () => searchRef.current?.onReset(),
|
|
1302
2069
|
retractChange: (value, data = queryItem) => {
|
|
1303
2070
|
setSelectedItem(data.find((item) => item.name === value || item.key === value));
|
|
1304
2071
|
}
|
|
1305
2072
|
}));
|
|
1306
|
-
return /* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ jsx7(DmSearch, {
|
|
1307
2074
|
...props,
|
|
1308
2075
|
ref: searchRef,
|
|
1309
|
-
defaultCollapsed: collapsed,
|
|
2076
|
+
defaultCollapsed: props.defaultCollapsed ?? collapsed,
|
|
1310
2077
|
items: collapsed ? queryItem.map(toSearchItem) : items,
|
|
1311
2078
|
fastFilterItem: fastFilterItem ? toSearchItem(fastFilterItem) : undefined,
|
|
1312
2079
|
onSearch,
|
|
1313
|
-
|
|
1314
|
-
children: [
|
|
1315
|
-
props.extra,
|
|
1316
|
-
/* @__PURE__ */ jsx6("button", {
|
|
1317
|
-
type: "button",
|
|
1318
|
-
hidden: true,
|
|
1319
|
-
onClick: () => {
|
|
1320
|
-
searchRef.current?.onReset();
|
|
1321
|
-
onReset?.();
|
|
1322
|
-
}
|
|
1323
|
-
})
|
|
1324
|
-
]
|
|
1325
|
-
})
|
|
2080
|
+
onReset
|
|
1326
2081
|
});
|
|
1327
2082
|
});
|
|
1328
2083
|
DmQuery.displayName = "DmQuery";
|