@rockshin/tao-ui 0.0.39 → 0.0.40
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 +12 -0
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/checkbox/checkbox.css +4 -0
- package/dist/components/checkbox/checkbox.d.ts +8 -6
- package/dist/components/checkbox/checkbox.js +184 -111
- package/dist/components/collapsible/collapsible.d.ts +6 -6
- package/dist/components/context-menu/context-menu.d.ts +3 -3
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +1 -1
- package/dist/components/date-picker/calendar/calendar-grid.js +47 -35
- package/dist/components/date-picker/calendar/calendar-header.d.ts +2 -2
- package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
- package/dist/components/date-picker/calendar/month-grid.js +1 -0
- package/dist/components/date-picker/calendar/time-panel.d.ts +2 -2
- package/dist/components/date-picker/calendar/time-panel.js +10 -7
- package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
- package/dist/components/date-picker/calendar/year-grid.js +1 -0
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.d.ts +7 -6
- package/dist/components/date-picker/date-picker.js +52 -5
- package/dist/components/date-picker/presets.d.ts +1 -1
- package/dist/components/date-picker/range-picker.d.ts +6 -5
- package/dist/components/date-picker/range-picker.js +124 -28
- package/dist/components/date-picker/types.d.ts +1 -1
- package/dist/components/drawer/drawer.d.ts +4 -4
- package/dist/components/drawer/drawer.js +125 -111
- package/dist/components/dropdown/dropdown.d.ts +8 -8
- package/dist/components/form/form-context.d.ts +1 -1
- package/dist/components/form/form-item.d.ts +3 -3
- package/dist/components/form/form.d.ts +3 -3
- package/dist/components/form/index.d.ts +2 -2
- package/dist/components/form-actions/form-actions.d.ts +2 -2
- package/dist/components/form-field/form-field-view.d.ts +2 -2
- package/dist/components/form-field/form-field.d.ts +2 -2
- package/dist/components/form-section/form-section.d.ts +2 -2
- package/dist/components/input/input.d.ts +2 -2
- package/dist/components/input/input.js +1 -1
- package/dist/components/input-number/input-number.d.ts +6 -7
- package/dist/components/input-number/input-number.js +91 -65
- package/dist/components/menu/menu-render.d.ts +1 -1
- package/dist/components/modal/confirm-dialog.d.ts +4 -4
- package/dist/components/modal/confirm.d.ts +1 -1
- package/dist/components/modal/index.d.ts +8 -8
- package/dist/components/modal/modal.d.ts +6 -6
- package/dist/components/modal/modal.js +115 -101
- package/dist/components/modal/use-modal.d.ts +2 -2
- package/dist/components/pagination/pagination.d.ts +3 -3
- package/dist/components/popconfirm/popconfirm.d.ts +5 -5
- package/dist/components/popconfirm/popconfirm.js +74 -61
- package/dist/components/popover/popover.d.ts +4 -4
- package/dist/components/popover/popover.js +124 -115
- package/dist/components/radio/radio.d.ts +9 -6
- package/dist/components/radio/radio.js +210 -116
- package/dist/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/components/select/mobile-select.d.ts +3 -3
- package/dist/components/select/mobile-select.js +3 -1
- package/dist/components/select/select-icons.d.ts +5 -5
- package/dist/components/select/select-model.d.ts +1 -1
- package/dist/components/select/select-searchable-list.d.ts +2 -2
- package/dist/components/select/select-tags.d.ts +3 -3
- package/dist/components/select/select-types.d.ts +2 -2
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/use-select-selection.d.ts +3 -3
- package/dist/components/sonner/index.d.ts +1 -1
- package/dist/components/sonner/sonner.d.ts +5 -4
- package/dist/components/spinner/spinner.d.ts +5 -5
- package/dist/components/spinner/spinner.js +106 -99
- package/dist/components/splitter/splitter.d.ts +3 -3
- package/dist/components/status-icon/status-icon.d.ts +1 -1
- package/dist/components/steps/steps-icons.d.ts +4 -4
- package/dist/components/steps/steps.d.ts +3 -3
- package/dist/components/steps/use-display-steps.d.ts +1 -1
- package/dist/components/switch/switch.d.ts +4 -3
- package/dist/components/switch/switch.js +134 -86
- package/dist/components/table/table-filter.d.ts +2 -2
- package/dist/components/table/table-icons.d.ts +6 -6
- package/dist/components/table/table-model.d.ts +2 -2
- package/dist/components/table/table-summary.d.ts +5 -5
- package/dist/components/table/table-types.d.ts +3 -3
- package/dist/components/table/table.d.ts +6 -6
- package/dist/components/table/use-table-data.d.ts +1 -1
- package/dist/components/tabs/tabs.d.ts +5 -5
- package/dist/components/tabs/tabs.js +72 -65
- package/dist/components/tag/tag.d.ts +4 -4
- package/dist/components/tag/tag.js +38 -35
- package/dist/components/textarea/textarea.d.ts +2 -2
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/docs/component-docs.d.ts +1 -1
- package/dist/docs/components/alert.doc.d.ts +1 -1
- package/dist/docs/components/button.doc.d.ts +1 -1
- package/dist/docs/components/popover.doc.d.ts +1 -1
- package/dist/docs/components/tooltip.doc.d.ts +4 -4
- package/dist/docs/index.d.ts +2 -2
- package/dist/entries/alert.d.ts +1 -1
- package/dist/entries/breadcrumb.d.ts +1 -1
- package/dist/entries/button.d.ts +1 -1
- package/dist/entries/checkbox.d.ts +1 -1
- package/dist/entries/collapsible.d.ts +1 -1
- package/dist/entries/context-menu.d.ts +1 -1
- package/dist/entries/date-picker.d.ts +1 -1
- package/dist/entries/drawer.d.ts +1 -1
- package/dist/entries/dropdown.d.ts +1 -1
- package/dist/entries/form-actions.d.ts +1 -1
- package/dist/entries/form-field.d.ts +1 -1
- package/dist/entries/form-layout.d.ts +1 -1
- package/dist/entries/form-section.d.ts +1 -1
- package/dist/entries/form.d.ts +1 -1
- package/dist/entries/input-number.d.ts +1 -1
- package/dist/entries/input.d.ts +1 -1
- package/dist/entries/modal.d.ts +1 -1
- package/dist/entries/number-input.d.ts +1 -1
- package/dist/entries/pagination.d.ts +1 -1
- package/dist/entries/popconfirm.d.ts +1 -1
- package/dist/entries/popover.d.ts +1 -1
- package/dist/entries/provider.d.ts +1 -1
- package/dist/entries/radio.d.ts +1 -1
- package/dist/entries/range-picker.d.ts +1 -1
- package/dist/entries/scroll-area.d.ts +1 -1
- package/dist/entries/select.d.ts +1 -1
- package/dist/entries/sonner.d.ts +1 -1
- package/dist/entries/spinner.d.ts +1 -1
- package/dist/entries/splitter.d.ts +1 -1
- package/dist/entries/stack.d.ts +1 -1
- package/dist/entries/steps.d.ts +1 -1
- package/dist/entries/switch.d.ts +1 -1
- package/dist/entries/table.d.ts +1 -1
- package/dist/entries/tabs.d.ts +1 -1
- package/dist/entries/tag.d.ts +1 -1
- package/dist/entries/textarea.d.ts +1 -1
- package/dist/entries/tooltip.d.ts +1 -1
- package/dist/index.d.ts +40 -40
- package/dist/layouts/form-layout/form-layout.d.ts +2 -2
- package/dist/layouts/stack/stack.d.ts +3 -3
- package/dist/number-input/format.d.ts +1 -1
- package/dist/number-input/index.d.ts +4 -4
- package/dist/number-input/number-input.d.ts +2 -2
- package/dist/number-input/use-number-input.d.ts +1 -1
- package/dist/provider/tao-provider.d.ts +3 -3
- package/dist/utils/dialog-content.d.ts +1 -1
- package/package.json +38 -38
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
4
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
5
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
|
+
import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
6
6
|
import { TaoPortalScope, useTaoConfig } from "../../provider/tao-provider.js";
|
|
7
7
|
import { useIsMobile } from "../../utils/breakpoint.js";
|
|
8
8
|
import { cx } from "../../utils/semantic.js";
|
|
@@ -18,6 +18,10 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
18
18
|
'Start date',
|
|
19
19
|
'End date'
|
|
20
20
|
], separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange, className, style, classNames, styles } = props;
|
|
21
|
+
const popupId = useId();
|
|
22
|
+
const popupRef = useRef(null);
|
|
23
|
+
const [keyboardFocusRequested, setKeyboardFocusRequested] = useState(false);
|
|
24
|
+
const returnFocusRef = useRef(null);
|
|
21
25
|
const ctx = useTaoConfig();
|
|
22
26
|
const resolvedSize = size ?? ctx.size;
|
|
23
27
|
const resolvedVariant = variant ?? ctx.variant;
|
|
@@ -99,31 +103,32 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
99
103
|
isOpen
|
|
100
104
|
]);
|
|
101
105
|
useEffect(()=>{
|
|
102
|
-
if (void 0 !== controlledValueKey) setInteraction({
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
if (void 0 !== controlledValueKey) setInteraction((current)=>({
|
|
107
|
+
phase: 'idle',
|
|
108
|
+
activeInput: 'pickingEnd' === current.phase ? 'start' : current.activeInput
|
|
109
|
+
}));
|
|
106
110
|
}, [
|
|
107
111
|
controlledValueKey
|
|
108
112
|
]);
|
|
109
113
|
const [viewDateStart, setViewDateStart] = useState(()=>resolvedValue?.[0] ?? resolvedValue?.[1] ?? dayjs());
|
|
110
114
|
const wasOpenRef = useRef(false);
|
|
111
115
|
useEffect(()=>{
|
|
112
|
-
if (isOpen && !wasOpenRef.current) setViewDateStart(resolvedValue?.[0] ?? resolvedValue?.[1] ?? dayjs());
|
|
116
|
+
if (isOpen && !wasOpenRef.current) setViewDateStart(resolvedValue?.['end' === interaction.activeInput ? 1 : 0] ?? resolvedValue?.[0] ?? resolvedValue?.[1] ?? dayjs());
|
|
113
117
|
wasOpenRef.current = isOpen;
|
|
114
118
|
}, [
|
|
115
119
|
isOpen,
|
|
116
|
-
resolvedValue
|
|
120
|
+
resolvedValue,
|
|
121
|
+
interaction.activeInput
|
|
117
122
|
]);
|
|
118
123
|
const viewDateEnd = viewDateStart.add(1, 'month');
|
|
119
124
|
const rangeStart = 'pickingEnd' === interaction.phase ? interaction.start : resolvedValue?.[0] ?? null;
|
|
120
125
|
const rangeEnd = 'pickingEnd' === interaction.phase ? null : resolvedValue?.[1] ?? null;
|
|
121
126
|
const hoverDate = 'pickingEnd' === interaction.phase ? interaction.hover : null;
|
|
122
127
|
const setHoverDate = useCallback((hover)=>{
|
|
123
|
-
setInteraction((
|
|
124
|
-
...
|
|
128
|
+
setInteraction((current_0)=>'pickingEnd' === current_0.phase ? {
|
|
129
|
+
...current_0,
|
|
125
130
|
hover
|
|
126
|
-
} :
|
|
131
|
+
} : current_0);
|
|
127
132
|
}, []);
|
|
128
133
|
const handleDateSelect = useCallback((date_0)=>{
|
|
129
134
|
if (startDisabled || endDisabled) {
|
|
@@ -213,7 +218,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
213
218
|
useEffect(()=>setInputEnd(displayEnd), [
|
|
214
219
|
displayEnd
|
|
215
220
|
]);
|
|
216
|
-
const commitInputValue = useCallback((position_0)=>{
|
|
221
|
+
const commitInputValue = useCallback((position_0, keepPopupOpen = false)=>{
|
|
217
222
|
if ('start' === position_0 ? startDisabled : endDisabled) return;
|
|
218
223
|
const text = ('start' === position_0 ? inputStart : inputEnd).trim();
|
|
219
224
|
const currentValue = 'start' === position_0 ? displayStart : displayEnd;
|
|
@@ -238,10 +243,10 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
238
243
|
phase: 'idle',
|
|
239
244
|
activeInput: position_0
|
|
240
245
|
});
|
|
241
|
-
if (parsed) setViewDateStart(parsed);
|
|
246
|
+
if (parsed && !keepPopupOpen) setViewDateStart(parsed);
|
|
242
247
|
if ('start' === position_0) setInputStart(isValueControlled ? displayStart : nextStrings[0]);
|
|
243
248
|
else setInputEnd(isValueControlled ? displayEnd : nextStrings[1]);
|
|
244
|
-
if (nextStart && nextEnd) setOpen(false);
|
|
249
|
+
if (nextStart && nextEnd && !keepPopupOpen) setOpen(false);
|
|
245
250
|
}, [
|
|
246
251
|
isDateBlocked,
|
|
247
252
|
startDisabled,
|
|
@@ -403,8 +408,46 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
403
408
|
})
|
|
404
409
|
]
|
|
405
410
|
});
|
|
411
|
+
const controlAria = {
|
|
412
|
+
'aria-label': props['aria-label'],
|
|
413
|
+
'aria-labelledby': props['aria-labelledby'],
|
|
414
|
+
'aria-describedby': props['aria-describedby'],
|
|
415
|
+
'aria-errormessage': props['aria-errormessage'],
|
|
416
|
+
'aria-invalid': 'error' === status ? true : props['aria-invalid'],
|
|
417
|
+
'aria-haspopup': 'dialog',
|
|
418
|
+
'aria-expanded': isOpen
|
|
419
|
+
};
|
|
420
|
+
const activeDate = 'end' === interaction.activeInput ? rangeEnd : rangeStart;
|
|
421
|
+
const focusCalendar = useCallback(()=>{
|
|
422
|
+
const popup = popupRef.current;
|
|
423
|
+
if (!popup) return;
|
|
424
|
+
const selectedDate = activeDate && !isDateBlocked(activeDate) ? activeDate : null;
|
|
425
|
+
if (selectedDate && !selectedDate.isSame(viewDateStart, 'month') && !selectedDate.isSame(viewDateStart.add(1, 'month'), 'month')) return void setViewDateStart(selectedDate);
|
|
426
|
+
let target = selectedDate ? popup.querySelector(`[data-tao-calendar-cell-button][aria-label="${selectedDate.format('YYYY-MM-DD')}"]:not([data-tao-other-month]):not(:disabled)`) : null;
|
|
427
|
+
target ??= popup.querySelector('[data-tao-calendar-cell-button][tabindex="0"]:not(:disabled)') ?? popup.querySelector('button[aria-pressed="true"]:not(:disabled)') ?? popup.querySelector('button:not(:disabled)');
|
|
428
|
+
target?.focus();
|
|
429
|
+
setKeyboardFocusRequested(false);
|
|
430
|
+
}, [
|
|
431
|
+
activeDate,
|
|
432
|
+
isDateBlocked,
|
|
433
|
+
viewDateStart
|
|
434
|
+
]);
|
|
435
|
+
useEffect(()=>{
|
|
436
|
+
if (isOpen && keyboardFocusRequested) focusCalendar();
|
|
437
|
+
}, [
|
|
438
|
+
isOpen,
|
|
439
|
+
keyboardFocusRequested,
|
|
440
|
+
focusCalendar
|
|
441
|
+
]);
|
|
442
|
+
const openFromKeyboard = ()=>{
|
|
443
|
+
commitInputValue(interaction.activeInput, true);
|
|
444
|
+
setKeyboardFocusRequested(true);
|
|
445
|
+
if (!isOpen) setOpen(true);
|
|
446
|
+
};
|
|
406
447
|
const mobileTrigger = /*#__PURE__*/ jsxs("button", {
|
|
407
448
|
ref: mobileTriggerRef,
|
|
449
|
+
id: props.id,
|
|
450
|
+
...controlAria,
|
|
408
451
|
type: "button",
|
|
409
452
|
"data-tao-control": "",
|
|
410
453
|
"data-tao-range-trigger": "",
|
|
@@ -451,6 +494,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
451
494
|
const desktopTrigger = /*#__PURE__*/ jsxs("div", {
|
|
452
495
|
"data-tao-control": "",
|
|
453
496
|
"data-tao-range-trigger": "",
|
|
497
|
+
onClick: ()=>!resolvedDisabled && setOpen(!isOpen),
|
|
454
498
|
"data-tao-size": resolvedSize,
|
|
455
499
|
"data-tao-variant": resolvedVariant,
|
|
456
500
|
"data-tao-error": 'error' === status || void 0,
|
|
@@ -461,8 +505,27 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
461
505
|
...style
|
|
462
506
|
},
|
|
463
507
|
children: [
|
|
508
|
+
/*#__PURE__*/ jsx("span", {
|
|
509
|
+
hidden: true,
|
|
510
|
+
id: `${popupId}-start-label`,
|
|
511
|
+
children: placeholder[0]
|
|
512
|
+
}),
|
|
513
|
+
/*#__PURE__*/ jsx("span", {
|
|
514
|
+
hidden: true,
|
|
515
|
+
id: `${popupId}-end-label`,
|
|
516
|
+
children: placeholder[1]
|
|
517
|
+
}),
|
|
464
518
|
/*#__PURE__*/ jsx("input", {
|
|
465
519
|
ref: startInputRef,
|
|
520
|
+
id: props.id,
|
|
521
|
+
...controlAria,
|
|
522
|
+
role: "combobox",
|
|
523
|
+
"aria-expanded": isOpen,
|
|
524
|
+
"aria-autocomplete": "none",
|
|
525
|
+
"aria-required": props['aria-required'],
|
|
526
|
+
"aria-controls": isOpen ? popupId : void 0,
|
|
527
|
+
"aria-label": props['aria-label'] ? `${props['aria-label']} ${placeholder[0]}` : props.id || props['aria-labelledby'] ? void 0 : placeholder[0],
|
|
528
|
+
"aria-labelledby": props['aria-labelledby'] ? `${props['aria-labelledby']} ${popupId}-start-label` : void 0,
|
|
466
529
|
"data-tao-range-input": "",
|
|
467
530
|
"data-tao-active": 'start' === interaction.activeInput && isOpen || void 0,
|
|
468
531
|
className: classNames?.input,
|
|
@@ -470,20 +533,27 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
470
533
|
value: inputStart,
|
|
471
534
|
placeholder: placeholder[0],
|
|
472
535
|
disabled: startDisabled,
|
|
473
|
-
"aria-invalid": 'error' === status || void 0,
|
|
474
536
|
onFocus: ()=>{
|
|
537
|
+
returnFocusRef.current = startInputRef.current;
|
|
475
538
|
setInteraction({
|
|
476
539
|
phase: 'idle',
|
|
477
540
|
activeInput: 'start'
|
|
478
541
|
});
|
|
479
542
|
},
|
|
480
543
|
onChange: (event_1)=>setInputStart(event_1.target.value),
|
|
481
|
-
onBlur: ()=>
|
|
482
|
-
|
|
483
|
-
if (
|
|
484
|
-
|
|
544
|
+
onBlur: (event_2)=>{
|
|
545
|
+
const enteringCalendar = event_2.relatedTarget instanceof HTMLElement && !!popupRef.current?.contains(event_2.relatedTarget);
|
|
546
|
+
if (enteringCalendar && keyboardFocusRequested) return;
|
|
547
|
+
commitInputValue('start', enteringCalendar);
|
|
548
|
+
},
|
|
549
|
+
onKeyDown: (event_3)=>{
|
|
550
|
+
if ('ArrowDown' === event_3.key) {
|
|
551
|
+
event_3.preventDefault();
|
|
552
|
+
openFromKeyboard();
|
|
553
|
+
} else if ('Enter' === event_3.key) {
|
|
554
|
+
event_3.preventDefault();
|
|
485
555
|
commitInputValue('start');
|
|
486
|
-
} else if ('Escape' ===
|
|
556
|
+
} else if ('Escape' === event_3.key) {
|
|
487
557
|
setInputStart(displayStart);
|
|
488
558
|
setOpen(false);
|
|
489
559
|
}
|
|
@@ -497,6 +567,15 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
497
567
|
}),
|
|
498
568
|
/*#__PURE__*/ jsx("input", {
|
|
499
569
|
ref: endInputRef,
|
|
570
|
+
id: props.id ? `${props.id}-end` : void 0,
|
|
571
|
+
...controlAria,
|
|
572
|
+
role: "combobox",
|
|
573
|
+
"aria-expanded": isOpen,
|
|
574
|
+
"aria-autocomplete": "none",
|
|
575
|
+
"aria-required": props['aria-required'],
|
|
576
|
+
"aria-controls": isOpen ? popupId : void 0,
|
|
577
|
+
"aria-label": props['aria-label'] ? `${props['aria-label']} ${placeholder[1]}` : props.id || props['aria-labelledby'] ? void 0 : placeholder[1],
|
|
578
|
+
"aria-labelledby": props['aria-labelledby'] ? `${props['aria-labelledby']} ${popupId}-end-label` : void 0,
|
|
500
579
|
"data-tao-range-input": "",
|
|
501
580
|
"data-tao-active": 'end' === interaction.activeInput && isOpen || void 0,
|
|
502
581
|
className: classNames?.input,
|
|
@@ -504,20 +583,27 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
504
583
|
value: inputEnd,
|
|
505
584
|
placeholder: placeholder[1],
|
|
506
585
|
disabled: endDisabled,
|
|
507
|
-
"aria-invalid": 'error' === status || void 0,
|
|
508
586
|
onFocus: ()=>{
|
|
587
|
+
returnFocusRef.current = endInputRef.current;
|
|
509
588
|
setInteraction({
|
|
510
589
|
phase: 'idle',
|
|
511
590
|
activeInput: 'end'
|
|
512
591
|
});
|
|
513
592
|
},
|
|
514
|
-
onChange: (
|
|
515
|
-
onBlur: ()=>
|
|
516
|
-
|
|
517
|
-
if (
|
|
518
|
-
|
|
593
|
+
onChange: (event_4)=>setInputEnd(event_4.target.value),
|
|
594
|
+
onBlur: (event_5)=>{
|
|
595
|
+
const enteringCalendar_0 = event_5.relatedTarget instanceof HTMLElement && !!popupRef.current?.contains(event_5.relatedTarget);
|
|
596
|
+
if (enteringCalendar_0 && keyboardFocusRequested) return;
|
|
597
|
+
commitInputValue('end', enteringCalendar_0);
|
|
598
|
+
},
|
|
599
|
+
onKeyDown: (event_6)=>{
|
|
600
|
+
if ('ArrowDown' === event_6.key) {
|
|
601
|
+
event_6.preventDefault();
|
|
602
|
+
openFromKeyboard();
|
|
603
|
+
} else if ('Enter' === event_6.key) {
|
|
604
|
+
event_6.preventDefault();
|
|
519
605
|
commitInputValue('end');
|
|
520
|
-
} else if ('Escape' ===
|
|
606
|
+
} else if ('Escape' === event_6.key) {
|
|
521
607
|
setInputEnd(displayEnd);
|
|
522
608
|
setOpen(false);
|
|
523
609
|
}
|
|
@@ -543,7 +629,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
543
629
|
open: isOpen,
|
|
544
630
|
onOpenChange: setOpen,
|
|
545
631
|
children: [
|
|
546
|
-
/*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_c8444160.
|
|
632
|
+
/*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_c8444160.Anchor, {
|
|
547
633
|
asChild: true,
|
|
548
634
|
children: desktopTrigger
|
|
549
635
|
}),
|
|
@@ -551,12 +637,22 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
551
637
|
children: /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
552
638
|
asChild: true,
|
|
553
639
|
children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_c8444160.Content, {
|
|
640
|
+
id: popupId,
|
|
641
|
+
ref: popupRef,
|
|
642
|
+
"aria-label": props['aria-label'] ?? 'Select date range',
|
|
554
643
|
"data-tao-picker-dropdown": "",
|
|
555
644
|
sideOffset: 4,
|
|
556
645
|
align: "start",
|
|
557
646
|
className: classNames?.popup,
|
|
558
647
|
style: styles?.popup,
|
|
559
|
-
onOpenAutoFocus: (
|
|
648
|
+
onOpenAutoFocus: (event_7)=>{
|
|
649
|
+
event_7.preventDefault();
|
|
650
|
+
if (keyboardFocusRequested) focusCalendar();
|
|
651
|
+
},
|
|
652
|
+
onCloseAutoFocus: (event_8)=>{
|
|
653
|
+
event_8.preventDefault();
|
|
654
|
+
if (document.activeElement === document.body || popupRef.current?.contains(document.activeElement)) (returnFocusRef.current ?? startInputRef.current)?.focus();
|
|
655
|
+
},
|
|
560
656
|
children: panelContent
|
|
561
657
|
})
|
|
562
658
|
})
|
|
@@ -5,7 +5,7 @@ export interface PickerRef {
|
|
|
5
5
|
nativeElement: HTMLElement | null;
|
|
6
6
|
}
|
|
7
7
|
import type { ReactNode } from 'react';
|
|
8
|
-
import type { TaoSize, TaoVariant } from '../../provider/tao-provider';
|
|
8
|
+
import type { TaoSize, TaoVariant } from '../../provider/tao-provider.js';
|
|
9
9
|
export type PickerMode = 'date' | 'month' | 'year';
|
|
10
10
|
export type PanelMode = 'date' | 'month' | 'year' | 'decade';
|
|
11
11
|
export interface TimeConfig {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
1
|
+
import { type AriaAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
3
3
|
import './drawer.css';
|
|
4
4
|
export type DrawerPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
5
5
|
export type DrawerSize = 'default' | 'large';
|
|
@@ -9,7 +9,7 @@ export interface DrawerResizableConfig {
|
|
|
9
9
|
onResizeStart?: () => void;
|
|
10
10
|
onResizeEnd?: () => void;
|
|
11
11
|
}
|
|
12
|
-
export interface DrawerProps {
|
|
12
|
+
export interface DrawerProps extends Pick<AriaAttributes, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> {
|
|
13
13
|
open: boolean;
|
|
14
14
|
onClose?: () => void;
|
|
15
15
|
title?: ReactNode;
|
|
@@ -47,4 +47,4 @@ export interface DrawerProps {
|
|
|
47
47
|
classNames?: SemanticClassNames<DrawerSemanticPart>;
|
|
48
48
|
styles?: SemanticStyles<DrawerSemanticPart>;
|
|
49
49
|
}
|
|
50
|
-
export declare function Drawer({ open, onClose, title, extra, footer, placement, size, width, height, closable, closeIcon, maskClosable, mask, keyboard, resizable, afterOpenChange, afterClose, destroyOnHidden, children, classNames, styles: stylesProp, }: DrawerProps): import("react
|
|
50
|
+
export declare function Drawer({ open, onClose, title, extra, footer, placement, size, width, height, closable, closeIcon, maskClosable, mask, keyboard, resizable, afterOpenChange, afterClose, destroyOnHidden, children, classNames, styles: stylesProp, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, }: DrawerProps): import("react").JSX.Element;
|
|
@@ -13,8 +13,8 @@ const SIZE_PRESET = {
|
|
|
13
13
|
};
|
|
14
14
|
const MIN_DRAG_SIZE = 200;
|
|
15
15
|
function Drawer(t0) {
|
|
16
|
-
const $ = c(
|
|
17
|
-
const { open, onClose, title, extra, footer, placement: t1, size, width, height, closable: t2, closeIcon, maskClosable: t3, mask: t4, keyboard: t5, resizable, afterOpenChange, afterClose, destroyOnHidden: t6, children, classNames, styles: stylesProp } = t0;
|
|
16
|
+
const $ = c(97);
|
|
17
|
+
const { open, onClose, title, extra, footer, placement: t1, size, width, height, closable: t2, closeIcon, maskClosable: t3, mask: t4, keyboard: t5, resizable, afterOpenChange, afterClose, destroyOnHidden: t6, children, classNames, styles: stylesProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy } = t0;
|
|
18
18
|
const placement = void 0 === t1 ? "right" : t1;
|
|
19
19
|
const closable = void 0 === t2 ? true : t2;
|
|
20
20
|
const maskClosable = void 0 === t3 ? true : t3;
|
|
@@ -167,16 +167,25 @@ function Drawer(t0) {
|
|
|
167
167
|
$[33] = t16;
|
|
168
168
|
} else t16 = $[33];
|
|
169
169
|
let t17;
|
|
170
|
-
if ($[34] !==
|
|
171
|
-
t17 =
|
|
170
|
+
if ($[34] !== ariaLabel || $[35] !== ariaLabelledBy) {
|
|
171
|
+
t17 = ariaLabel || ariaLabelledBy ? {
|
|
172
|
+
"aria-labelledby": ariaLabelledBy
|
|
173
|
+
} : {};
|
|
174
|
+
$[34] = ariaLabel;
|
|
175
|
+
$[35] = ariaLabelledBy;
|
|
176
|
+
$[36] = t17;
|
|
177
|
+
} else t17 = $[36];
|
|
178
|
+
let t18;
|
|
179
|
+
if ($[37] !== keyboard) {
|
|
180
|
+
t18 = (e_2)=>{
|
|
172
181
|
if (!keyboard) e_2.preventDefault();
|
|
173
182
|
};
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
} else
|
|
177
|
-
let
|
|
178
|
-
if ($[
|
|
179
|
-
|
|
183
|
+
$[37] = keyboard;
|
|
184
|
+
$[38] = t18;
|
|
185
|
+
} else t18 = $[38];
|
|
186
|
+
let t19;
|
|
187
|
+
if ($[39] !== classNames?.dragger || $[40] !== isResizable || $[41] !== onDraggerPointerDown || $[42] !== onDraggerPointerMove || $[43] !== onDraggerPointerUp || $[44] !== placement || $[45] !== stylesProp?.dragger) {
|
|
188
|
+
t19 = isResizable && /*#__PURE__*/ jsx("div", {
|
|
180
189
|
"data-tao-drawer-dragger": "",
|
|
181
190
|
"data-tao-placement": placement,
|
|
182
191
|
className: cx(classNames?.dragger),
|
|
@@ -185,18 +194,18 @@ function Drawer(t0) {
|
|
|
185
194
|
onPointerMove: onDraggerPointerMove,
|
|
186
195
|
onPointerUp: onDraggerPointerUp
|
|
187
196
|
});
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
} else
|
|
197
|
-
let
|
|
198
|
-
if ($[
|
|
199
|
-
|
|
197
|
+
$[39] = classNames?.dragger;
|
|
198
|
+
$[40] = isResizable;
|
|
199
|
+
$[41] = onDraggerPointerDown;
|
|
200
|
+
$[42] = onDraggerPointerMove;
|
|
201
|
+
$[43] = onDraggerPointerUp;
|
|
202
|
+
$[44] = placement;
|
|
203
|
+
$[45] = stylesProp?.dragger;
|
|
204
|
+
$[46] = t19;
|
|
205
|
+
} else t19 = $[46];
|
|
206
|
+
let t20;
|
|
207
|
+
if ($[47] !== classNames?.close || $[48] !== classNames?.extra || $[49] !== classNames?.header || $[50] !== classNames?.title || $[51] !== closable || $[52] !== closeIcon || $[53] !== extra || $[54] !== onClose || $[55] !== showHeader || $[56] !== stylesProp?.close || $[57] !== stylesProp?.extra || $[58] !== stylesProp?.header || $[59] !== stylesProp?.title || $[60] !== title) {
|
|
208
|
+
t20 = showHeader && /*#__PURE__*/ jsxs("div", {
|
|
200
209
|
"data-tao-drawer-header": "",
|
|
201
210
|
className: cx(classNames?.header),
|
|
202
211
|
style: stylesProp?.header,
|
|
@@ -234,59 +243,59 @@ function Drawer(t0) {
|
|
|
234
243
|
})
|
|
235
244
|
]
|
|
236
245
|
});
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
} else
|
|
253
|
-
const
|
|
254
|
-
let
|
|
255
|
-
if ($[
|
|
256
|
-
|
|
257
|
-
$[59] = t20;
|
|
258
|
-
$[60] = t21;
|
|
259
|
-
} else t21 = $[60];
|
|
260
|
-
const t22 = stylesProp?.body;
|
|
261
|
-
let t23;
|
|
262
|
-
if ($[61] !== children || $[62] !== t21 || $[63] !== t22) {
|
|
263
|
-
t23 = /*#__PURE__*/ jsx("div", {
|
|
264
|
-
"data-tao-drawer-body": "",
|
|
265
|
-
className: t21,
|
|
266
|
-
style: t22,
|
|
267
|
-
children: children
|
|
268
|
-
});
|
|
269
|
-
$[61] = children;
|
|
246
|
+
$[47] = classNames?.close;
|
|
247
|
+
$[48] = classNames?.extra;
|
|
248
|
+
$[49] = classNames?.header;
|
|
249
|
+
$[50] = classNames?.title;
|
|
250
|
+
$[51] = closable;
|
|
251
|
+
$[52] = closeIcon;
|
|
252
|
+
$[53] = extra;
|
|
253
|
+
$[54] = onClose;
|
|
254
|
+
$[55] = showHeader;
|
|
255
|
+
$[56] = stylesProp?.close;
|
|
256
|
+
$[57] = stylesProp?.extra;
|
|
257
|
+
$[58] = stylesProp?.header;
|
|
258
|
+
$[59] = stylesProp?.title;
|
|
259
|
+
$[60] = title;
|
|
260
|
+
$[61] = t20;
|
|
261
|
+
} else t20 = $[61];
|
|
262
|
+
const t21 = classNames?.body;
|
|
263
|
+
let t22;
|
|
264
|
+
if ($[62] !== t21) {
|
|
265
|
+
t22 = cx(t21);
|
|
270
266
|
$[62] = t21;
|
|
271
267
|
$[63] = t22;
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
} else t22 = $[63];
|
|
269
|
+
const t23 = stylesProp?.body;
|
|
274
270
|
let t24;
|
|
275
|
-
if ($[
|
|
276
|
-
t24 =
|
|
271
|
+
if ($[64] !== children || $[65] !== t22 || $[66] !== t23) {
|
|
272
|
+
t24 = /*#__PURE__*/ jsx("div", {
|
|
273
|
+
"data-tao-drawer-body": "",
|
|
274
|
+
className: t22,
|
|
275
|
+
style: t23,
|
|
276
|
+
children: children
|
|
277
|
+
});
|
|
278
|
+
$[64] = children;
|
|
279
|
+
$[65] = t22;
|
|
280
|
+
$[66] = t23;
|
|
281
|
+
$[67] = t24;
|
|
282
|
+
} else t24 = $[67];
|
|
283
|
+
let t25;
|
|
284
|
+
if ($[68] !== classNames?.footer || $[69] !== footer || $[70] !== stylesProp?.footer) {
|
|
285
|
+
t25 = null != footer && /*#__PURE__*/ jsx("div", {
|
|
277
286
|
"data-tao-drawer-footer": "",
|
|
278
287
|
className: cx(classNames?.footer),
|
|
279
288
|
style: stylesProp?.footer,
|
|
280
289
|
children: footer
|
|
281
290
|
});
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
} else
|
|
287
|
-
let
|
|
288
|
-
if ($[
|
|
289
|
-
|
|
291
|
+
$[68] = classNames?.footer;
|
|
292
|
+
$[69] = footer;
|
|
293
|
+
$[70] = stylesProp?.footer;
|
|
294
|
+
$[71] = t25;
|
|
295
|
+
} else t25 = $[71];
|
|
296
|
+
let t26;
|
|
297
|
+
if ($[72] !== ariaDescribedBy || $[73] !== ariaLabel || $[74] !== contentStyle || $[75] !== forceMount || $[76] !== keepAlive || $[77] !== open || $[78] !== placement || $[79] !== t16 || $[80] !== t17 || $[81] !== t18 || $[82] !== t19 || $[83] !== t20 || $[84] !== t24 || $[85] !== t25) {
|
|
298
|
+
t26 = /*#__PURE__*/ jsxs(DialogContent, {
|
|
290
299
|
open: open,
|
|
291
300
|
keepAlive: keepAlive,
|
|
292
301
|
contentRef: contentRef,
|
|
@@ -295,65 +304,70 @@ function Drawer(t0) {
|
|
|
295
304
|
"data-tao-placement": placement,
|
|
296
305
|
style: contentStyle,
|
|
297
306
|
className: t16,
|
|
298
|
-
"aria-
|
|
299
|
-
|
|
307
|
+
"aria-label": ariaLabel,
|
|
308
|
+
...t17,
|
|
309
|
+
"aria-describedby": ariaDescribedBy,
|
|
310
|
+
onEscapeKeyDown: t18,
|
|
300
311
|
onPointerDownOutside: preventParentOutsideDismiss,
|
|
301
312
|
onInteractOutside: preventParentOutsideDismiss,
|
|
302
313
|
children: [
|
|
303
|
-
t18,
|
|
304
314
|
t19,
|
|
305
|
-
|
|
306
|
-
t24
|
|
315
|
+
t20,
|
|
316
|
+
t24,
|
|
317
|
+
t25
|
|
307
318
|
]
|
|
308
319
|
});
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
320
|
+
$[72] = ariaDescribedBy;
|
|
321
|
+
$[73] = ariaLabel;
|
|
322
|
+
$[74] = contentStyle;
|
|
323
|
+
$[75] = forceMount;
|
|
324
|
+
$[76] = keepAlive;
|
|
325
|
+
$[77] = open;
|
|
326
|
+
$[78] = placement;
|
|
327
|
+
$[79] = t16;
|
|
328
|
+
$[80] = t17;
|
|
329
|
+
$[81] = t18;
|
|
330
|
+
$[82] = t19;
|
|
331
|
+
$[83] = t20;
|
|
332
|
+
$[84] = t24;
|
|
333
|
+
$[85] = t25;
|
|
334
|
+
$[86] = t26;
|
|
335
|
+
} else t26 = $[86];
|
|
336
|
+
let t27;
|
|
337
|
+
if ($[87] !== t14 || $[88] !== t26) {
|
|
338
|
+
t27 = /*#__PURE__*/ jsxs(TaoPortalScope, {
|
|
325
339
|
children: [
|
|
326
340
|
t14,
|
|
327
|
-
|
|
341
|
+
t26
|
|
328
342
|
]
|
|
329
343
|
});
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
} else
|
|
334
|
-
let
|
|
335
|
-
if ($[
|
|
336
|
-
|
|
344
|
+
$[87] = t14;
|
|
345
|
+
$[88] = t26;
|
|
346
|
+
$[89] = t27;
|
|
347
|
+
} else t27 = $[89];
|
|
348
|
+
let t28;
|
|
349
|
+
if ($[90] !== forceMount || $[91] !== t27) {
|
|
350
|
+
t28 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Portal, {
|
|
337
351
|
forceMount: forceMount,
|
|
338
|
-
children:
|
|
352
|
+
children: t27
|
|
339
353
|
});
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
} else
|
|
344
|
-
let
|
|
345
|
-
if ($[
|
|
346
|
-
|
|
354
|
+
$[90] = forceMount;
|
|
355
|
+
$[91] = t27;
|
|
356
|
+
$[92] = t28;
|
|
357
|
+
} else t28 = $[92];
|
|
358
|
+
let t29;
|
|
359
|
+
if ($[93] !== open || $[94] !== t13 || $[95] !== t28) {
|
|
360
|
+
t29 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Root, {
|
|
347
361
|
open: open,
|
|
348
362
|
onOpenChange: t13,
|
|
349
|
-
children:
|
|
363
|
+
children: t28
|
|
350
364
|
});
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
} else
|
|
356
|
-
return
|
|
365
|
+
$[93] = open;
|
|
366
|
+
$[94] = t13;
|
|
367
|
+
$[95] = t28;
|
|
368
|
+
$[96] = t29;
|
|
369
|
+
} else t29 = $[96];
|
|
370
|
+
return t29;
|
|
357
371
|
}
|
|
358
372
|
function CloseIcon() {
|
|
359
373
|
const $ = c(1);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
import { type TaoSize } from '../../provider/tao-provider';
|
|
3
|
-
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
|
-
import { type ButtonProps } from '../button/button';
|
|
5
|
-
import { type MenuProps, type MenuSemanticPart } from '../menu/menu-render';
|
|
2
|
+
import { type TaoSize } from '../../provider/tao-provider.js';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
4
|
+
import { type ButtonProps } from '../button/button.js';
|
|
5
|
+
import { type MenuProps, type MenuSemanticPart } from '../menu/menu-render.js';
|
|
6
6
|
import './dropdown.css';
|
|
7
7
|
export type DropdownSemanticPart = MenuSemanticPart;
|
|
8
|
-
export type { MenuDividerType, MenuGroupType, MenuItem, MenuItemType, MenuProps, } from '../menu/menu-render';
|
|
8
|
+
export type { MenuDividerType, MenuGroupType, MenuItem, MenuItemType, MenuProps, } from '../menu/menu-render.js';
|
|
9
9
|
export type DropdownPlacement = 'bottom' | 'bottomLeft' | 'bottomRight' | 'top' | 'topLeft' | 'topRight';
|
|
10
10
|
export type DropdownTrigger = 'click' | 'hover' | 'contextMenu';
|
|
11
11
|
export interface DropdownProps {
|
|
@@ -38,8 +38,8 @@ export interface DropdownButtonProps extends Omit<DropdownProps, 'children'> {
|
|
|
38
38
|
variant?: ButtonProps['variant'];
|
|
39
39
|
size?: TaoSize;
|
|
40
40
|
}
|
|
41
|
-
export declare function Dropdown(props: DropdownProps): import("react
|
|
41
|
+
export declare function Dropdown(props: DropdownProps): import("react").JSX.Element;
|
|
42
42
|
export declare namespace Dropdown {
|
|
43
|
-
|
|
43
|
+
export { DropdownButton as Button };
|
|
44
44
|
}
|
|
45
|
-
declare function DropdownButton({ children, onClick, icon, variant, size, menu, ...dropdownRest }: DropdownButtonProps): import("react
|
|
45
|
+
declare function DropdownButton({ children, onClick, icon, variant, size, menu, ...dropdownRest }: DropdownButtonProps): import("react").JSX.Element;
|