bianic-ui 2.8.0-alpha.0 → 2.8.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 +127 -60
- 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 +127 -60
- 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 +4 -3
package/dist/cjs/index.js
CHANGED
|
@@ -3150,7 +3150,7 @@ var areMonthsAdjacent = function (leftMonth, leftYear, rightMonth, rightYear) {
|
|
|
3150
3150
|
|
|
3151
3151
|
var DateDisplay = function (_a) {
|
|
3152
3152
|
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);
|
|
3153
|
+
var isRangeMode = Array.isArray(selectedDate) && selectedDate.length === 2;
|
|
3154
3154
|
var startRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[0]) ? new Date(selectedDate[0]) : null;
|
|
3155
3155
|
var endRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[1]) ? new Date(selectedDate[1]) : null;
|
|
3156
3156
|
return (React.createElement("div", null,
|
|
@@ -3459,7 +3459,7 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
|
|
|
3459
3459
|
};
|
|
3460
3460
|
|
|
3461
3461
|
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;
|
|
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, onYearSelect = _a.onYearSelect;
|
|
3463
3463
|
var _b = useCalendarLogic(
|
|
3464
3464
|
// use first selectedDate if array
|
|
3465
3465
|
Array.isArray(selectedDate)
|
|
@@ -3488,7 +3488,10 @@ var PickerContent = function (_a) {
|
|
|
3488
3488
|
handlePickerMode('date');
|
|
3489
3489
|
}, selectedDate: selectedDate, viewMonthValue: viewMonthValue, viewYearValue: viewYearValue })),
|
|
3490
3490
|
pickerMode === 'year' && (React.createElement(YearDisplay, { maxDateValue: maxDateValue, minDateValue: minDateValue, onYearSelect: function (y) {
|
|
3491
|
-
|
|
3491
|
+
if (onYearSelect)
|
|
3492
|
+
onYearSelect(y);
|
|
3493
|
+
else
|
|
3494
|
+
setViewYearValue(y);
|
|
3492
3495
|
handlePickerMode('month');
|
|
3493
3496
|
}, viewYearValue: viewYearValue, yearDisplayRange: yearDisplayRange }))));
|
|
3494
3497
|
};
|
|
@@ -3505,117 +3508,168 @@ var SinglePicker = function (_a) {
|
|
|
3505
3508
|
var RangePicker = function (_a) {
|
|
3506
3509
|
var
|
|
3507
3510
|
// pickerMode,
|
|
3508
|
-
selectedDate = _a.selectedDate, onDateChange = _a.onDateChange, onClose = _a.onClose, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
3511
|
+
selectedDate = _a.selectedDate, onDateChange = _a.onDateChange, onClose = _a.onClose, minDate = _a.minDate, maxDate = _a.maxDate, isPickerOpen = _a.isPickerOpen;
|
|
3509
3512
|
// compute initial view month/year for left and right panels from current selection
|
|
3510
3513
|
var leftInitDate = selectedDate && selectedDate[0] ? new Date(selectedDate[0]) : new Date();
|
|
3514
|
+
var rightInitDate = selectedDate && selectedDate[1] ? new Date(selectedDate[1]) : new Date();
|
|
3511
3515
|
var leftInitMonth = leftInitDate.getMonth();
|
|
3512
3516
|
var leftInitYear = leftInitDate.getFullYear();
|
|
3513
|
-
var rightInitMonth =
|
|
3514
|
-
|
|
3517
|
+
var rightInitMonth = rightInitDate
|
|
3518
|
+
? rightInitDate.getMonth()
|
|
3519
|
+
: leftInitMonth === 11
|
|
3520
|
+
? 0
|
|
3521
|
+
: leftInitMonth + 1;
|
|
3522
|
+
var rightInitYear = rightInitDate
|
|
3523
|
+
? rightInitDate.getFullYear()
|
|
3524
|
+
: leftInitMonth === 11
|
|
3525
|
+
? leftInitYear + 1
|
|
3526
|
+
: leftInitYear;
|
|
3515
3527
|
// State to track left and right panel month/year
|
|
3516
3528
|
var _b = React.useState(leftInitMonth), leftMonth = _b[0], setLeftMonth = _b[1];
|
|
3517
3529
|
var _c = React.useState(leftInitYear), leftYear = _c[0], setLeftYear = _c[1];
|
|
3518
3530
|
var _d = React.useState(rightInitMonth), rightMonth = _d[0], setRightMonth = _d[1];
|
|
3519
3531
|
var _e = React.useState(rightInitYear), rightYear = _e[0], setRightYear = _e[1];
|
|
3520
3532
|
var _f = React.useState(selectedDate || []), tempSelectedDate = _f[0], setTempSelectedDate = _f[1];
|
|
3521
|
-
// Sync state when initial selection changes
|
|
3522
3533
|
React.useEffect(function () {
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3534
|
+
// If both dates are in the same month/year, advance right picker to next month
|
|
3535
|
+
if (rightMonth === leftMonth && rightYear === leftYear) {
|
|
3536
|
+
var tempRightMonth = leftMonth === 11 ? 0 : leftMonth + 1;
|
|
3537
|
+
var tempRightYear = leftMonth === 11 ? leftYear + 1 : leftYear;
|
|
3538
|
+
setRightMonth(tempRightMonth);
|
|
3539
|
+
setRightYear(tempRightYear);
|
|
3540
|
+
}
|
|
3541
|
+
}, [leftMonth, leftYear, rightMonth, rightYear]);
|
|
3542
|
+
React.useEffect(function () {
|
|
3543
|
+
if (!isPickerOpen)
|
|
3544
|
+
setTempSelectedDate(selectedDate || []);
|
|
3545
|
+
}, [isPickerOpen]);
|
|
3533
3546
|
var isAdjacent = React.useMemo(function () { return areMonthsAdjacent(leftMonth, leftYear, rightMonth, rightYear); }, [leftMonth, leftYear, rightMonth, rightYear]);
|
|
3547
|
+
// Helper function to ensure left picker is always smaller than right picker
|
|
3548
|
+
var ensureOrderedPickers = function (newLeftMonth, newLeftYear, newRightMonth, newRightYear) {
|
|
3549
|
+
// If left year is greater than right year, swap them
|
|
3550
|
+
if (newLeftYear > newRightYear) {
|
|
3551
|
+
setLeftMonth(newRightMonth);
|
|
3552
|
+
setLeftYear(newRightYear);
|
|
3553
|
+
setRightMonth(newLeftMonth);
|
|
3554
|
+
setRightYear(newLeftYear);
|
|
3555
|
+
}
|
|
3556
|
+
// If years are equal and left month is greater than or equal to right month, swap months
|
|
3557
|
+
else if (newLeftYear === newRightYear && newLeftMonth >= newRightMonth) {
|
|
3558
|
+
setLeftMonth(newRightMonth);
|
|
3559
|
+
setRightMonth(newLeftMonth);
|
|
3560
|
+
}
|
|
3561
|
+
// Otherwise, keep the order as is
|
|
3562
|
+
else {
|
|
3563
|
+
setLeftMonth(newLeftMonth);
|
|
3564
|
+
setLeftYear(newLeftYear);
|
|
3565
|
+
setRightMonth(newRightMonth);
|
|
3566
|
+
setRightYear(newRightYear);
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3534
3569
|
var handleLeftPrevMonth = function () {
|
|
3535
3570
|
if (leftMonth === 0) {
|
|
3536
|
-
|
|
3537
|
-
setLeftYear(function (prev) { return prev - 1; });
|
|
3571
|
+
ensureOrderedPickers(11, leftYear - 1, rightMonth, rightYear);
|
|
3538
3572
|
}
|
|
3539
3573
|
else {
|
|
3540
|
-
|
|
3574
|
+
ensureOrderedPickers(leftMonth - 1, leftYear, rightMonth, rightYear);
|
|
3541
3575
|
}
|
|
3542
3576
|
};
|
|
3543
3577
|
var handleLeftNextMonth = function () {
|
|
3578
|
+
var newLeftMonth = leftMonth;
|
|
3579
|
+
var newLeftYear = leftYear;
|
|
3580
|
+
var newRightMonth = rightMonth;
|
|
3581
|
+
var newRightYear = rightYear;
|
|
3544
3582
|
if (isAdjacent) {
|
|
3545
|
-
// If adjacent, move both panels forward
|
|
3583
|
+
// If adjacent, move both panels forward
|
|
3546
3584
|
if (leftMonth === 11) {
|
|
3547
|
-
|
|
3548
|
-
|
|
3585
|
+
newLeftMonth = 0;
|
|
3586
|
+
newLeftYear = leftYear + 1;
|
|
3549
3587
|
}
|
|
3550
3588
|
else {
|
|
3551
|
-
|
|
3589
|
+
newLeftMonth = leftMonth + 1;
|
|
3552
3590
|
}
|
|
3553
3591
|
if (rightMonth === 11) {
|
|
3554
|
-
|
|
3555
|
-
|
|
3592
|
+
newRightMonth = 0;
|
|
3593
|
+
newRightYear = rightYear + 1;
|
|
3556
3594
|
}
|
|
3557
3595
|
else {
|
|
3558
|
-
|
|
3596
|
+
newRightMonth = rightMonth + 1;
|
|
3559
3597
|
}
|
|
3560
3598
|
}
|
|
3561
3599
|
else {
|
|
3562
|
-
// If not adjacent, move left panel forward by 1 month
|
|
3563
3600
|
if (leftMonth === 11) {
|
|
3564
|
-
|
|
3565
|
-
|
|
3601
|
+
newLeftMonth = 0;
|
|
3602
|
+
newLeftYear = leftYear + 1;
|
|
3566
3603
|
}
|
|
3567
3604
|
else {
|
|
3568
|
-
|
|
3605
|
+
newLeftMonth = leftMonth + 1;
|
|
3569
3606
|
}
|
|
3570
3607
|
}
|
|
3608
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3571
3609
|
};
|
|
3572
3610
|
var handleRightPrevMonth = function () {
|
|
3611
|
+
var newLeftMonth = leftMonth;
|
|
3612
|
+
var newLeftYear = leftYear;
|
|
3613
|
+
var newRightMonth = rightMonth;
|
|
3614
|
+
var newRightYear = rightYear;
|
|
3573
3615
|
if (isAdjacent) {
|
|
3574
|
-
// If adjacent, move both panels backward
|
|
3616
|
+
// If adjacent, move both panels backward
|
|
3575
3617
|
if (leftMonth === 0) {
|
|
3576
|
-
|
|
3577
|
-
|
|
3618
|
+
newLeftMonth = 11;
|
|
3619
|
+
newLeftYear = leftYear - 1;
|
|
3578
3620
|
}
|
|
3579
3621
|
else {
|
|
3580
|
-
|
|
3622
|
+
newLeftMonth = leftMonth - 1;
|
|
3581
3623
|
}
|
|
3582
3624
|
if (rightMonth === 0) {
|
|
3583
|
-
|
|
3584
|
-
|
|
3625
|
+
newRightMonth = 11;
|
|
3626
|
+
newRightYear = rightYear - 1;
|
|
3585
3627
|
}
|
|
3586
3628
|
else {
|
|
3587
|
-
|
|
3629
|
+
newRightMonth = rightMonth - 1;
|
|
3588
3630
|
}
|
|
3589
3631
|
}
|
|
3590
3632
|
else {
|
|
3591
|
-
// If not adjacent, move right panel backward by 1 month
|
|
3592
3633
|
if (rightMonth === 0) {
|
|
3593
|
-
|
|
3594
|
-
|
|
3634
|
+
newRightMonth = 11;
|
|
3635
|
+
newRightYear = rightYear - 1;
|
|
3595
3636
|
}
|
|
3596
3637
|
else {
|
|
3597
|
-
|
|
3638
|
+
newRightMonth = rightMonth - 1;
|
|
3598
3639
|
}
|
|
3599
3640
|
}
|
|
3641
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3600
3642
|
};
|
|
3601
3643
|
var handleRightNextMonth = function () {
|
|
3644
|
+
var newRightMonth = rightMonth;
|
|
3645
|
+
var newRightYear = rightYear;
|
|
3602
3646
|
if (rightMonth === 11) {
|
|
3603
|
-
|
|
3604
|
-
|
|
3647
|
+
newRightMonth = 0;
|
|
3648
|
+
newRightYear = rightYear + 1;
|
|
3605
3649
|
}
|
|
3606
3650
|
else {
|
|
3607
|
-
|
|
3651
|
+
newRightMonth = rightMonth + 1;
|
|
3608
3652
|
}
|
|
3653
|
+
ensureOrderedPickers(leftMonth, leftYear, newRightMonth, newRightYear);
|
|
3654
|
+
};
|
|
3655
|
+
var handleYearSelectLeft = function (year) {
|
|
3656
|
+
ensureOrderedPickers(leftMonth, year, rightMonth, rightYear);
|
|
3657
|
+
};
|
|
3658
|
+
var handleYearSelectRight = function (year) {
|
|
3659
|
+
ensureOrderedPickers(leftMonth, leftYear, rightMonth, year);
|
|
3609
3660
|
};
|
|
3610
3661
|
var handleDateSelect = function (date) {
|
|
3611
3662
|
if (tempSelectedDate.length >= 2) {
|
|
3612
3663
|
setTempSelectedDate([dateToInputString(date)]);
|
|
3613
3664
|
}
|
|
3614
3665
|
else {
|
|
3615
|
-
|
|
3666
|
+
var newDates = __spreadArray(__spreadArray([], tempSelectedDate, true), [dateToInputString(date)], false);
|
|
3667
|
+
if (newDates.length === 2)
|
|
3668
|
+
newDates.sort();
|
|
3669
|
+
setTempSelectedDate(newDates);
|
|
3616
3670
|
}
|
|
3617
3671
|
};
|
|
3618
|
-
var handleMonthSelect = function (
|
|
3672
|
+
var handleMonthSelect = function (dateIndex, initYear) {
|
|
3619
3673
|
return function (val) {
|
|
3620
3674
|
var selectedDates = Array.isArray(selectedDate)
|
|
3621
3675
|
? selectedDate
|
|
@@ -3633,21 +3687,31 @@ var RangePicker = function (_a) {
|
|
|
3633
3687
|
}
|
|
3634
3688
|
var selectedMonth = parseInt(selectedDates[dateIndex].slice(5, 7)) - 1;
|
|
3635
3689
|
if (val === selectedMonth) {
|
|
3636
|
-
|
|
3690
|
+
if (dateIndex === 0) {
|
|
3691
|
+
ensureOrderedPickers(selectedMonth, initYear, rightMonth, rightYear);
|
|
3692
|
+
}
|
|
3693
|
+
else {
|
|
3694
|
+
ensureOrderedPickers(leftMonth, leftYear, selectedMonth, initYear);
|
|
3695
|
+
}
|
|
3637
3696
|
}
|
|
3638
3697
|
else {
|
|
3639
3698
|
return;
|
|
3640
3699
|
}
|
|
3641
3700
|
}
|
|
3642
3701
|
else {
|
|
3643
|
-
|
|
3702
|
+
if (dateIndex === 0) {
|
|
3703
|
+
ensureOrderedPickers(val, initYear, rightMonth, rightYear);
|
|
3704
|
+
}
|
|
3705
|
+
else {
|
|
3706
|
+
ensureOrderedPickers(leftMonth, leftYear, val, initYear);
|
|
3707
|
+
}
|
|
3644
3708
|
}
|
|
3645
3709
|
};
|
|
3646
3710
|
};
|
|
3647
3711
|
return (React.createElement("div", { className: "space-y-[30px]" },
|
|
3648
3712
|
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(
|
|
3713
|
+
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 }),
|
|
3714
|
+
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
3715
|
React.createElement("div", { className: "flex justify-between" },
|
|
3652
3716
|
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
3717
|
React.createElement("div", { className: "flex gap-x-2.5" },
|
|
@@ -3669,16 +3733,16 @@ var PickerCalendar = function (_a) {
|
|
|
3669
3733
|
setIsPickerOpen(isOpen);
|
|
3670
3734
|
}, [isOpen]);
|
|
3671
3735
|
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);
|
|
3736
|
+
React.createElement(PickerBody, { selectedDate: selectedDate, minDate: minDate, maxDate: maxDate, onDateChange: onDateChange, isPickerOpen: isPickerOpen, pickerVariant: pickerVariant, onClose: onClose, isOpen: isOpen })), document.body);
|
|
3673
3737
|
};
|
|
3674
3738
|
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;
|
|
3739
|
+
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
3740
|
React.useEffect(function () {
|
|
3677
3741
|
if (!isPickerOpen) {
|
|
3678
3742
|
onClose();
|
|
3679
3743
|
}
|
|
3680
3744
|
}, [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 }))));
|
|
3745
|
+
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
3746
|
};
|
|
3683
3747
|
|
|
3684
3748
|
var monthMap = [
|
|
@@ -4002,7 +4066,10 @@ function Modal(_a) {
|
|
|
4002
4066
|
modalSize = 'w-[540px]';
|
|
4003
4067
|
}
|
|
4004
4068
|
var handleClose = function (e) {
|
|
4005
|
-
if (
|
|
4069
|
+
if (onClose &&
|
|
4070
|
+
e &&
|
|
4071
|
+
e.target &&
|
|
4072
|
+
e.target.id === 'wrapper') {
|
|
4006
4073
|
onClose();
|
|
4007
4074
|
}
|
|
4008
4075
|
};
|
|
@@ -4013,7 +4080,7 @@ function Modal(_a) {
|
|
|
4013
4080
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
4014
4081
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
4015
4082
|
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(); } })),
|
|
4083
|
+
onClose && (React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } }))),
|
|
4017
4084
|
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))), document.body));
|
|
4018
4085
|
}
|
|
4019
4086
|
return null;
|
|
@@ -4082,14 +4149,14 @@ function PaginationBar(_a) {
|
|
|
4082
4149
|
setShowedPages(newPages);
|
|
4083
4150
|
}, [startIndex, totalPages]);
|
|
4084
4151
|
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 })),
|
|
4152
|
+
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
4153
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|
|
4087
4154
|
handlePageChange(currentPage - 1);
|
|
4088
4155
|
if (showedPages[0] === currentPage)
|
|
4089
4156
|
setStartIndex(function (old) { return old - 1; });
|
|
4090
4157
|
if (!showedPages.includes(currentPage))
|
|
4091
4158
|
setStartIndex(currentPage - 2);
|
|
4092
|
-
}, className: currentPage === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
|
|
4159
|
+
}, className: currentPage === 1 ? 'cursor-not-allowed' : 'cursor-pointer', iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
|
|
4093
4160
|
showedPages.map(function (page) {
|
|
4094
4161
|
if (page === currentPage) {
|
|
4095
4162
|
return React.createElement(SelectedPage, { key: page, label: page.toString(), size: size });
|
|
@@ -4104,9 +4171,9 @@ function PaginationBar(_a) {
|
|
|
4104
4171
|
setStartIndex(function (old) { return old + 1; });
|
|
4105
4172
|
if (!showedPages.includes(currentPage))
|
|
4106
4173
|
setStartIndex(currentPage - 4);
|
|
4107
|
-
}, className: currentPage === totalPages ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages }),
|
|
4174
|
+
}, className: currentPage === totalPages ? 'cursor-not-allowed' : 'cursor-pointer', iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages }),
|
|
4108
4175
|
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handleNextRange, className: showedPages[showedPages.length - 1] === totalPages
|
|
4109
|
-
? ''
|
|
4176
|
+
? 'cursor-not-allowed'
|
|
4110
4177
|
: 'cursor-pointer', iconLeft: React.createElement(TbChevronsRight, { size: iconSize }), disabled: showedPages[showedPages.length - 1] === totalPages }))));
|
|
4111
4178
|
}
|
|
4112
4179
|
|