bianic-ui 2.8.0-alpha.0 → 2.8.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +130 -65
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/components/PickerContent.d.ts +1 -0
- package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/components/RangePicker.d.ts +1 -0
- package/dist/cjs/types/components/Modal/ModalNonCloseable.d.ts +2 -0
- package/dist/cjs/types/stories/Modal/ModalNonCloseable.stories.d.ts +13 -0
- package/dist/esm/index.js +130 -65
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/components/PickerContent.d.ts +1 -0
- package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/components/RangePicker.d.ts +1 -0
- package/dist/esm/types/components/Modal/ModalNonCloseable.d.ts +2 -0
- package/dist/esm/types/stories/Modal/ModalNonCloseable.stories.d.ts +13 -0
- package/package.json +5 -3
package/dist/cjs/index.js
CHANGED
|
@@ -2115,14 +2115,12 @@ function MenuItem(_a) {
|
|
|
2115
2115
|
: 'right-0 translate-x-full';
|
|
2116
2116
|
var currentZIndex = zIndex + 10;
|
|
2117
2117
|
return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return !disabled && setIsHovered(true); }, onMouseLeave: function () { return !disabled && setIsHovered(false); } },
|
|
2118
|
-
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] ".concat(itemClass, " ").concat(disabled ? 'cursor-not-allowed' : 'hover:bg-bia-blue-pastel'), role: "button", "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: function (e) {
|
|
2118
|
+
React.createElement("div", __assign({ className: "relative flex items-center bg-bia-white py-[5px] ".concat(itemClass, " ").concat(disabled ? 'cursor-not-allowed' : 'hover:bg-bia-blue-pastel'), role: "button", "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: function (e) {
|
|
2119
2119
|
if (disabled)
|
|
2120
2120
|
return;
|
|
2121
2121
|
inheritedOnClick();
|
|
2122
2122
|
onClick(e);
|
|
2123
|
-
}, onKeyDown: function () { }, style: {
|
|
2124
|
-
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
2125
|
-
} }, props),
|
|
2123
|
+
}, onKeyDown: function () { }, style: { zIndex: currentZIndex + 15 } }, props),
|
|
2126
2124
|
isWithChecked && (React.createElement("div", { className: "mr-[5px] aspect-square w-[14px]" }, isChecked && React.createElement(TbCheck, { className: "text-primary-black", size: 14 }))),
|
|
2127
2125
|
React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-black') }, label),
|
|
2128
2126
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
@@ -2771,7 +2769,7 @@ function DropdownItem(_a) {
|
|
|
2771
2769
|
: 'right-0 translate-x-full';
|
|
2772
2770
|
var currentZIndex = zIndex + 10;
|
|
2773
2771
|
return (React.createElement("div", { className: "bianic-dropdown-item group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[5px] last:rounded-b-radius-sm last:pb-[5px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
|
|
2774
|
-
React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: { zIndex: currentZIndex + 15 }, onClick: function (e) { return onClickItem(e, value); }, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
|
|
2772
|
+
React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap bg-bia-white px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: { zIndex: currentZIndex + 15 }, onClick: function (e) { return onClickItem(e, value); }, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
|
|
2775
2773
|
content,
|
|
2776
2774
|
React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
|
|
2777
2775
|
children && (React.createElement(DropdownContNoAnchor, { className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), onClose: onClose, open: isHovered, onClickItem: function (e, value) { return onClickItem(e, value); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children))));
|
|
@@ -3150,7 +3148,7 @@ var areMonthsAdjacent = function (leftMonth, leftYear, rightMonth, rightYear) {
|
|
|
3150
3148
|
|
|
3151
3149
|
var DateDisplay = function (_a) {
|
|
3152
3150
|
var displayDays = _a.displayDays, viewMonthValue = _a.viewMonthValue, selectedDate = _a.selectedDate, onDateSelect = _a.onDateSelect, minDateValue = _a.minDateValue, maxDateValue = _a.maxDateValue;
|
|
3153
|
-
var isRangeMode = Array.isArray(selectedDate);
|
|
3151
|
+
var isRangeMode = Array.isArray(selectedDate) && selectedDate.length === 2;
|
|
3154
3152
|
var startRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[0]) ? new Date(selectedDate[0]) : null;
|
|
3155
3153
|
var endRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[1]) ? new Date(selectedDate[1]) : null;
|
|
3156
3154
|
return (React.createElement("div", null,
|
|
@@ -3459,7 +3457,7 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
|
|
|
3459
3457
|
};
|
|
3460
3458
|
|
|
3461
3459
|
var PickerContent = function (_a) {
|
|
3462
|
-
var selectedDate = _a.selectedDate, onDateSelect = _a.onDateSelect, initialViewMonth = _a.initialViewMonth, initialViewYear = _a.initialViewYear, minDate = _a.minDate, maxDate = _a.maxDate, onPrevMonth = _a.onPrevMonth, onNextMonth = _a.onNextMonth, onMonthSelect = _a.onMonthSelect;
|
|
3460
|
+
var selectedDate = _a.selectedDate, onDateSelect = _a.onDateSelect, initialViewMonth = _a.initialViewMonth, initialViewYear = _a.initialViewYear, minDate = _a.minDate, maxDate = _a.maxDate, onPrevMonth = _a.onPrevMonth, onNextMonth = _a.onNextMonth, onMonthSelect = _a.onMonthSelect, onYearSelect = _a.onYearSelect;
|
|
3463
3461
|
var _b = useCalendarLogic(
|
|
3464
3462
|
// use first selectedDate if array
|
|
3465
3463
|
Array.isArray(selectedDate)
|
|
@@ -3488,7 +3486,10 @@ var PickerContent = function (_a) {
|
|
|
3488
3486
|
handlePickerMode('date');
|
|
3489
3487
|
}, selectedDate: selectedDate, viewMonthValue: viewMonthValue, viewYearValue: viewYearValue })),
|
|
3490
3488
|
pickerMode === 'year' && (React.createElement(YearDisplay, { maxDateValue: maxDateValue, minDateValue: minDateValue, onYearSelect: function (y) {
|
|
3491
|
-
|
|
3489
|
+
if (onYearSelect)
|
|
3490
|
+
onYearSelect(y);
|
|
3491
|
+
else
|
|
3492
|
+
setViewYearValue(y);
|
|
3492
3493
|
handlePickerMode('month');
|
|
3493
3494
|
}, viewYearValue: viewYearValue, yearDisplayRange: yearDisplayRange }))));
|
|
3494
3495
|
};
|
|
@@ -3505,117 +3506,168 @@ var SinglePicker = function (_a) {
|
|
|
3505
3506
|
var RangePicker = function (_a) {
|
|
3506
3507
|
var
|
|
3507
3508
|
// pickerMode,
|
|
3508
|
-
selectedDate = _a.selectedDate, onDateChange = _a.onDateChange, onClose = _a.onClose, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
3509
|
+
selectedDate = _a.selectedDate, onDateChange = _a.onDateChange, onClose = _a.onClose, minDate = _a.minDate, maxDate = _a.maxDate, isPickerOpen = _a.isPickerOpen;
|
|
3509
3510
|
// compute initial view month/year for left and right panels from current selection
|
|
3510
3511
|
var leftInitDate = selectedDate && selectedDate[0] ? new Date(selectedDate[0]) : new Date();
|
|
3512
|
+
var rightInitDate = selectedDate && selectedDate[1] ? new Date(selectedDate[1]) : new Date();
|
|
3511
3513
|
var leftInitMonth = leftInitDate.getMonth();
|
|
3512
3514
|
var leftInitYear = leftInitDate.getFullYear();
|
|
3513
|
-
var rightInitMonth =
|
|
3514
|
-
|
|
3515
|
+
var rightInitMonth = rightInitDate
|
|
3516
|
+
? rightInitDate.getMonth()
|
|
3517
|
+
: leftInitMonth === 11
|
|
3518
|
+
? 0
|
|
3519
|
+
: leftInitMonth + 1;
|
|
3520
|
+
var rightInitYear = rightInitDate
|
|
3521
|
+
? rightInitDate.getFullYear()
|
|
3522
|
+
: leftInitMonth === 11
|
|
3523
|
+
? leftInitYear + 1
|
|
3524
|
+
: leftInitYear;
|
|
3515
3525
|
// State to track left and right panel month/year
|
|
3516
3526
|
var _b = React.useState(leftInitMonth), leftMonth = _b[0], setLeftMonth = _b[1];
|
|
3517
3527
|
var _c = React.useState(leftInitYear), leftYear = _c[0], setLeftYear = _c[1];
|
|
3518
3528
|
var _d = React.useState(rightInitMonth), rightMonth = _d[0], setRightMonth = _d[1];
|
|
3519
3529
|
var _e = React.useState(rightInitYear), rightYear = _e[0], setRightYear = _e[1];
|
|
3520
3530
|
var _f = React.useState(selectedDate || []), tempSelectedDate = _f[0], setTempSelectedDate = _f[1];
|
|
3521
|
-
// Sync state when initial selection changes
|
|
3522
3531
|
React.useEffect(function () {
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3532
|
+
// If both dates are in the same month/year, advance right picker to next month
|
|
3533
|
+
if (rightMonth === leftMonth && rightYear === leftYear) {
|
|
3534
|
+
var tempRightMonth = leftMonth === 11 ? 0 : leftMonth + 1;
|
|
3535
|
+
var tempRightYear = leftMonth === 11 ? leftYear + 1 : leftYear;
|
|
3536
|
+
setRightMonth(tempRightMonth);
|
|
3537
|
+
setRightYear(tempRightYear);
|
|
3538
|
+
}
|
|
3539
|
+
}, [leftMonth, leftYear, rightMonth, rightYear]);
|
|
3540
|
+
React.useEffect(function () {
|
|
3541
|
+
if (!isPickerOpen)
|
|
3542
|
+
setTempSelectedDate(selectedDate || []);
|
|
3543
|
+
}, [isPickerOpen]);
|
|
3533
3544
|
var isAdjacent = React.useMemo(function () { return areMonthsAdjacent(leftMonth, leftYear, rightMonth, rightYear); }, [leftMonth, leftYear, rightMonth, rightYear]);
|
|
3545
|
+
// Helper function to ensure left picker is always smaller than right picker
|
|
3546
|
+
var ensureOrderedPickers = function (newLeftMonth, newLeftYear, newRightMonth, newRightYear) {
|
|
3547
|
+
// If left year is greater than right year, swap them
|
|
3548
|
+
if (newLeftYear > newRightYear) {
|
|
3549
|
+
setLeftMonth(newRightMonth);
|
|
3550
|
+
setLeftYear(newRightYear);
|
|
3551
|
+
setRightMonth(newLeftMonth);
|
|
3552
|
+
setRightYear(newLeftYear);
|
|
3553
|
+
}
|
|
3554
|
+
// If years are equal and left month is greater than or equal to right month, swap months
|
|
3555
|
+
else if (newLeftYear === newRightYear && newLeftMonth >= newRightMonth) {
|
|
3556
|
+
setLeftMonth(newRightMonth);
|
|
3557
|
+
setRightMonth(newLeftMonth);
|
|
3558
|
+
}
|
|
3559
|
+
// Otherwise, keep the order as is
|
|
3560
|
+
else {
|
|
3561
|
+
setLeftMonth(newLeftMonth);
|
|
3562
|
+
setLeftYear(newLeftYear);
|
|
3563
|
+
setRightMonth(newRightMonth);
|
|
3564
|
+
setRightYear(newRightYear);
|
|
3565
|
+
}
|
|
3566
|
+
};
|
|
3534
3567
|
var handleLeftPrevMonth = function () {
|
|
3535
3568
|
if (leftMonth === 0) {
|
|
3536
|
-
|
|
3537
|
-
setLeftYear(function (prev) { return prev - 1; });
|
|
3569
|
+
ensureOrderedPickers(11, leftYear - 1, rightMonth, rightYear);
|
|
3538
3570
|
}
|
|
3539
3571
|
else {
|
|
3540
|
-
|
|
3572
|
+
ensureOrderedPickers(leftMonth - 1, leftYear, rightMonth, rightYear);
|
|
3541
3573
|
}
|
|
3542
3574
|
};
|
|
3543
3575
|
var handleLeftNextMonth = function () {
|
|
3576
|
+
var newLeftMonth = leftMonth;
|
|
3577
|
+
var newLeftYear = leftYear;
|
|
3578
|
+
var newRightMonth = rightMonth;
|
|
3579
|
+
var newRightYear = rightYear;
|
|
3544
3580
|
if (isAdjacent) {
|
|
3545
|
-
// If adjacent, move both panels forward
|
|
3581
|
+
// If adjacent, move both panels forward
|
|
3546
3582
|
if (leftMonth === 11) {
|
|
3547
|
-
|
|
3548
|
-
|
|
3583
|
+
newLeftMonth = 0;
|
|
3584
|
+
newLeftYear = leftYear + 1;
|
|
3549
3585
|
}
|
|
3550
3586
|
else {
|
|
3551
|
-
|
|
3587
|
+
newLeftMonth = leftMonth + 1;
|
|
3552
3588
|
}
|
|
3553
3589
|
if (rightMonth === 11) {
|
|
3554
|
-
|
|
3555
|
-
|
|
3590
|
+
newRightMonth = 0;
|
|
3591
|
+
newRightYear = rightYear + 1;
|
|
3556
3592
|
}
|
|
3557
3593
|
else {
|
|
3558
|
-
|
|
3594
|
+
newRightMonth = rightMonth + 1;
|
|
3559
3595
|
}
|
|
3560
3596
|
}
|
|
3561
3597
|
else {
|
|
3562
|
-
// If not adjacent, move left panel forward by 1 month
|
|
3563
3598
|
if (leftMonth === 11) {
|
|
3564
|
-
|
|
3565
|
-
|
|
3599
|
+
newLeftMonth = 0;
|
|
3600
|
+
newLeftYear = leftYear + 1;
|
|
3566
3601
|
}
|
|
3567
3602
|
else {
|
|
3568
|
-
|
|
3603
|
+
newLeftMonth = leftMonth + 1;
|
|
3569
3604
|
}
|
|
3570
3605
|
}
|
|
3606
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3571
3607
|
};
|
|
3572
3608
|
var handleRightPrevMonth = function () {
|
|
3609
|
+
var newLeftMonth = leftMonth;
|
|
3610
|
+
var newLeftYear = leftYear;
|
|
3611
|
+
var newRightMonth = rightMonth;
|
|
3612
|
+
var newRightYear = rightYear;
|
|
3573
3613
|
if (isAdjacent) {
|
|
3574
|
-
// If adjacent, move both panels backward
|
|
3614
|
+
// If adjacent, move both panels backward
|
|
3575
3615
|
if (leftMonth === 0) {
|
|
3576
|
-
|
|
3577
|
-
|
|
3616
|
+
newLeftMonth = 11;
|
|
3617
|
+
newLeftYear = leftYear - 1;
|
|
3578
3618
|
}
|
|
3579
3619
|
else {
|
|
3580
|
-
|
|
3620
|
+
newLeftMonth = leftMonth - 1;
|
|
3581
3621
|
}
|
|
3582
3622
|
if (rightMonth === 0) {
|
|
3583
|
-
|
|
3584
|
-
|
|
3623
|
+
newRightMonth = 11;
|
|
3624
|
+
newRightYear = rightYear - 1;
|
|
3585
3625
|
}
|
|
3586
3626
|
else {
|
|
3587
|
-
|
|
3627
|
+
newRightMonth = rightMonth - 1;
|
|
3588
3628
|
}
|
|
3589
3629
|
}
|
|
3590
3630
|
else {
|
|
3591
|
-
// If not adjacent, move right panel backward by 1 month
|
|
3592
3631
|
if (rightMonth === 0) {
|
|
3593
|
-
|
|
3594
|
-
|
|
3632
|
+
newRightMonth = 11;
|
|
3633
|
+
newRightYear = rightYear - 1;
|
|
3595
3634
|
}
|
|
3596
3635
|
else {
|
|
3597
|
-
|
|
3636
|
+
newRightMonth = rightMonth - 1;
|
|
3598
3637
|
}
|
|
3599
3638
|
}
|
|
3639
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3600
3640
|
};
|
|
3601
3641
|
var handleRightNextMonth = function () {
|
|
3642
|
+
var newRightMonth = rightMonth;
|
|
3643
|
+
var newRightYear = rightYear;
|
|
3602
3644
|
if (rightMonth === 11) {
|
|
3603
|
-
|
|
3604
|
-
|
|
3645
|
+
newRightMonth = 0;
|
|
3646
|
+
newRightYear = rightYear + 1;
|
|
3605
3647
|
}
|
|
3606
3648
|
else {
|
|
3607
|
-
|
|
3649
|
+
newRightMonth = rightMonth + 1;
|
|
3608
3650
|
}
|
|
3651
|
+
ensureOrderedPickers(leftMonth, leftYear, newRightMonth, newRightYear);
|
|
3652
|
+
};
|
|
3653
|
+
var handleYearSelectLeft = function (year) {
|
|
3654
|
+
ensureOrderedPickers(leftMonth, year, rightMonth, rightYear);
|
|
3655
|
+
};
|
|
3656
|
+
var handleYearSelectRight = function (year) {
|
|
3657
|
+
ensureOrderedPickers(leftMonth, leftYear, rightMonth, year);
|
|
3609
3658
|
};
|
|
3610
3659
|
var handleDateSelect = function (date) {
|
|
3611
3660
|
if (tempSelectedDate.length >= 2) {
|
|
3612
3661
|
setTempSelectedDate([dateToInputString(date)]);
|
|
3613
3662
|
}
|
|
3614
3663
|
else {
|
|
3615
|
-
|
|
3664
|
+
var newDates = __spreadArray(__spreadArray([], tempSelectedDate, true), [dateToInputString(date)], false);
|
|
3665
|
+
if (newDates.length === 2)
|
|
3666
|
+
newDates.sort();
|
|
3667
|
+
setTempSelectedDate(newDates);
|
|
3616
3668
|
}
|
|
3617
3669
|
};
|
|
3618
|
-
var handleMonthSelect = function (
|
|
3670
|
+
var handleMonthSelect = function (dateIndex, initYear) {
|
|
3619
3671
|
return function (val) {
|
|
3620
3672
|
var selectedDates = Array.isArray(selectedDate)
|
|
3621
3673
|
? selectedDate
|
|
@@ -3633,21 +3685,31 @@ var RangePicker = function (_a) {
|
|
|
3633
3685
|
}
|
|
3634
3686
|
var selectedMonth = parseInt(selectedDates[dateIndex].slice(5, 7)) - 1;
|
|
3635
3687
|
if (val === selectedMonth) {
|
|
3636
|
-
|
|
3688
|
+
if (dateIndex === 0) {
|
|
3689
|
+
ensureOrderedPickers(selectedMonth, initYear, rightMonth, rightYear);
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
ensureOrderedPickers(leftMonth, leftYear, selectedMonth, initYear);
|
|
3693
|
+
}
|
|
3637
3694
|
}
|
|
3638
3695
|
else {
|
|
3639
3696
|
return;
|
|
3640
3697
|
}
|
|
3641
3698
|
}
|
|
3642
3699
|
else {
|
|
3643
|
-
|
|
3700
|
+
if (dateIndex === 0) {
|
|
3701
|
+
ensureOrderedPickers(val, initYear, rightMonth, rightYear);
|
|
3702
|
+
}
|
|
3703
|
+
else {
|
|
3704
|
+
ensureOrderedPickers(leftMonth, leftYear, val, initYear);
|
|
3705
|
+
}
|
|
3644
3706
|
}
|
|
3645
3707
|
};
|
|
3646
3708
|
};
|
|
3647
3709
|
return (React.createElement("div", { className: "space-y-[30px]" },
|
|
3648
3710
|
React.createElement("div", { className: "range-picker picker-body flex gap-x-[22px]" },
|
|
3649
|
-
React.createElement(PickerContent, { selectedDate: tempSelectedDate, minDate: minDate, maxDate: maxDate, onDateSelect: handleDateSelect, initialViewMonth: leftMonth, initialViewYear: leftYear, onPrevMonth: handleLeftPrevMonth, onNextMonth: handleLeftNextMonth, onMonthSelect: handleMonthSelect(
|
|
3650
|
-
React.createElement(PickerContent, { selectedDate: tempSelectedDate, minDate: minDate, maxDate: maxDate, onDateSelect: handleDateSelect, initialViewMonth: rightMonth, initialViewYear: rightYear, onPrevMonth: handleRightPrevMonth, onNextMonth: handleRightNextMonth, onMonthSelect: handleMonthSelect(
|
|
3711
|
+
React.createElement(PickerContent, { selectedDate: tempSelectedDate, minDate: minDate, maxDate: maxDate, onDateSelect: handleDateSelect, initialViewMonth: leftMonth, initialViewYear: leftYear, onPrevMonth: handleLeftPrevMonth, onNextMonth: handleLeftNextMonth, onMonthSelect: handleMonthSelect(0, leftYear), onYearSelect: handleYearSelectLeft }),
|
|
3712
|
+
React.createElement(PickerContent, { selectedDate: tempSelectedDate, minDate: minDate, maxDate: maxDate, onDateSelect: handleDateSelect, initialViewMonth: rightMonth, initialViewYear: rightYear, onPrevMonth: handleRightPrevMonth, onNextMonth: handleRightNextMonth, onMonthSelect: handleMonthSelect(1, rightYear), onYearSelect: handleYearSelectRight })),
|
|
3651
3713
|
React.createElement("div", { className: "flex justify-between" },
|
|
3652
3714
|
React.createElement(Button, { label: "Reset", size: "sm", variant: "primary-outlined", iconLeft: React.createElement(TbRefresh, { className: "text-bia-blue", size: 14 }), onClick: function () { return setTempSelectedDate([]); } }),
|
|
3653
3715
|
React.createElement("div", { className: "flex gap-x-2.5" },
|
|
@@ -3669,16 +3731,16 @@ var PickerCalendar = function (_a) {
|
|
|
3669
3731
|
setIsPickerOpen(isOpen);
|
|
3670
3732
|
}, [isOpen]);
|
|
3671
3733
|
return reactDom.createPortal(React.createElement("div", __assign({ className: "bianic-datepicker-calendar absolute rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] text-bia-black shadow-md ".concat(className), ref: pickerCalendarRef, style: __assign(__assign({ zIndex: zIndex, display: isPickerOpen ? 'flex' : 'none' }, positionStyle), style) }, restProps),
|
|
3672
|
-
React.createElement(PickerBody, { selectedDate: selectedDate, minDate: minDate, maxDate: maxDate, onDateChange: onDateChange, isPickerOpen: isPickerOpen, pickerVariant: pickerVariant, onClose: onClose })), document.body);
|
|
3734
|
+
React.createElement(PickerBody, { selectedDate: selectedDate, minDate: minDate, maxDate: maxDate, onDateChange: onDateChange, isPickerOpen: isPickerOpen, pickerVariant: pickerVariant, onClose: onClose, isOpen: isOpen })), document.body);
|
|
3673
3735
|
};
|
|
3674
3736
|
var PickerBody = function (_a) {
|
|
3675
|
-
var selectedDate = _a.selectedDate, minDate = _a.minDate, maxDate = _a.maxDate, onDateChange = _a.onDateChange, isPickerOpen = _a.isPickerOpen, _b = _a.pickerVariant, pickerVariant = _b === void 0 ? 'range' : _b, onClose = _a.onClose;
|
|
3737
|
+
var selectedDate = _a.selectedDate, minDate = _a.minDate, maxDate = _a.maxDate, onDateChange = _a.onDateChange, isPickerOpen = _a.isPickerOpen, _b = _a.pickerVariant, pickerVariant = _b === void 0 ? 'range' : _b, onClose = _a.onClose, isOpen = _a.isOpen;
|
|
3676
3738
|
React.useEffect(function () {
|
|
3677
3739
|
if (!isPickerOpen) {
|
|
3678
3740
|
onClose();
|
|
3679
3741
|
}
|
|
3680
3742
|
}, [isPickerOpen]);
|
|
3681
|
-
return (React.createElement("div", { className: "picker-body flex gap-x-5" }, pickerVariant === 'single' ? (React.createElement(SinglePicker, { selectedDate: selectedDate, onDateChange: onDateChange, minDate: minDate, maxDate: maxDate })) : (React.createElement(RangePicker, { selectedDate: selectedDate, onDateChange: onDateChange, minDate: minDate, maxDate: maxDate, onClose: onClose }))));
|
|
3743
|
+
return (React.createElement("div", { className: "picker-body flex gap-x-5" }, pickerVariant === 'single' ? (React.createElement(SinglePicker, { selectedDate: selectedDate, onDateChange: onDateChange, minDate: minDate, maxDate: maxDate })) : (React.createElement(RangePicker, { selectedDate: selectedDate, onDateChange: onDateChange, minDate: minDate, maxDate: maxDate, onClose: onClose, isPickerOpen: isOpen }))));
|
|
3682
3744
|
};
|
|
3683
3745
|
|
|
3684
3746
|
var monthMap = [
|
|
@@ -4002,7 +4064,10 @@ function Modal(_a) {
|
|
|
4002
4064
|
modalSize = 'w-[540px]';
|
|
4003
4065
|
}
|
|
4004
4066
|
var handleClose = function (e) {
|
|
4005
|
-
if (
|
|
4067
|
+
if (onClose &&
|
|
4068
|
+
e &&
|
|
4069
|
+
e.target &&
|
|
4070
|
+
e.target.id === 'wrapper') {
|
|
4006
4071
|
onClose();
|
|
4007
4072
|
}
|
|
4008
4073
|
};
|
|
@@ -4013,7 +4078,7 @@ function Modal(_a) {
|
|
|
4013
4078
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
4014
4079
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
4015
4080
|
React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
|
|
4016
|
-
React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } })),
|
|
4081
|
+
onClose && (React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } }))),
|
|
4017
4082
|
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))), document.body));
|
|
4018
4083
|
}
|
|
4019
4084
|
return null;
|
|
@@ -4082,14 +4147,14 @@ function PaginationBar(_a) {
|
|
|
4082
4147
|
setShowedPages(newPages);
|
|
4083
4148
|
}, [startIndex, totalPages]);
|
|
4084
4149
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
4085
|
-
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
|
|
4150
|
+
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? ' cursor-not-allowed' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
|
|
4086
4151
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|
|
4087
4152
|
handlePageChange(currentPage - 1);
|
|
4088
4153
|
if (showedPages[0] === currentPage)
|
|
4089
4154
|
setStartIndex(function (old) { return old - 1; });
|
|
4090
4155
|
if (!showedPages.includes(currentPage))
|
|
4091
4156
|
setStartIndex(currentPage - 2);
|
|
4092
|
-
}, className: currentPage === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
|
|
4157
|
+
}, className: currentPage === 1 ? 'cursor-not-allowed' : 'cursor-pointer', iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
|
|
4093
4158
|
showedPages.map(function (page) {
|
|
4094
4159
|
if (page === currentPage) {
|
|
4095
4160
|
return React.createElement(SelectedPage, { key: page, label: page.toString(), size: size });
|
|
@@ -4104,9 +4169,9 @@ function PaginationBar(_a) {
|
|
|
4104
4169
|
setStartIndex(function (old) { return old + 1; });
|
|
4105
4170
|
if (!showedPages.includes(currentPage))
|
|
4106
4171
|
setStartIndex(currentPage - 4);
|
|
4107
|
-
}, className: currentPage === totalPages ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages }),
|
|
4172
|
+
}, className: currentPage === totalPages ? 'cursor-not-allowed' : 'cursor-pointer', iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages }),
|
|
4108
4173
|
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handleNextRange, className: showedPages[showedPages.length - 1] === totalPages
|
|
4109
|
-
? ''
|
|
4174
|
+
? 'cursor-not-allowed'
|
|
4110
4175
|
: 'cursor-pointer', iconLeft: React.createElement(TbChevronsRight, { size: iconSize }), disabled: showedPages[showedPages.length - 1] === totalPages }))));
|
|
4111
4176
|
}
|
|
4112
4177
|
|