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/types/components/Forms/DatePicker/PickerCalendar/components/PickerContent.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ interface PickerContentProps {
|
|
|
9
9
|
onPrevMonth?: () => void;
|
|
10
10
|
onNextMonth?: () => void;
|
|
11
11
|
onMonthSelect?: (month: number) => void;
|
|
12
|
+
onYearSelect?: (year: number) => void;
|
|
12
13
|
}
|
|
13
14
|
declare const PickerContent: React.FC<PickerContentProps>;
|
|
14
15
|
export default PickerContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import Modal from '../../components/Modal/ModalNonCloseable';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Modal;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const NonCloseable: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -3148,7 +3148,7 @@ var areMonthsAdjacent = function (leftMonth, leftYear, rightMonth, rightYear) {
|
|
|
3148
3148
|
|
|
3149
3149
|
var DateDisplay = function (_a) {
|
|
3150
3150
|
var displayDays = _a.displayDays, viewMonthValue = _a.viewMonthValue, selectedDate = _a.selectedDate, onDateSelect = _a.onDateSelect, minDateValue = _a.minDateValue, maxDateValue = _a.maxDateValue;
|
|
3151
|
-
var isRangeMode = Array.isArray(selectedDate);
|
|
3151
|
+
var isRangeMode = Array.isArray(selectedDate) && selectedDate.length === 2;
|
|
3152
3152
|
var startRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[0]) ? new Date(selectedDate[0]) : null;
|
|
3153
3153
|
var endRangeDate = isRangeMode && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate[1]) ? new Date(selectedDate[1]) : null;
|
|
3154
3154
|
return (React.createElement("div", null,
|
|
@@ -3457,7 +3457,7 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
|
|
|
3457
3457
|
};
|
|
3458
3458
|
|
|
3459
3459
|
var PickerContent = function (_a) {
|
|
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;
|
|
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;
|
|
3461
3461
|
var _b = useCalendarLogic(
|
|
3462
3462
|
// use first selectedDate if array
|
|
3463
3463
|
Array.isArray(selectedDate)
|
|
@@ -3486,7 +3486,10 @@ var PickerContent = function (_a) {
|
|
|
3486
3486
|
handlePickerMode('date');
|
|
3487
3487
|
}, selectedDate: selectedDate, viewMonthValue: viewMonthValue, viewYearValue: viewYearValue })),
|
|
3488
3488
|
pickerMode === 'year' && (React.createElement(YearDisplay, { maxDateValue: maxDateValue, minDateValue: minDateValue, onYearSelect: function (y) {
|
|
3489
|
-
|
|
3489
|
+
if (onYearSelect)
|
|
3490
|
+
onYearSelect(y);
|
|
3491
|
+
else
|
|
3492
|
+
setViewYearValue(y);
|
|
3490
3493
|
handlePickerMode('month');
|
|
3491
3494
|
}, viewYearValue: viewYearValue, yearDisplayRange: yearDisplayRange }))));
|
|
3492
3495
|
};
|
|
@@ -3503,117 +3506,168 @@ var SinglePicker = function (_a) {
|
|
|
3503
3506
|
var RangePicker = function (_a) {
|
|
3504
3507
|
var
|
|
3505
3508
|
// pickerMode,
|
|
3506
|
-
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;
|
|
3507
3510
|
// compute initial view month/year for left and right panels from current selection
|
|
3508
3511
|
var leftInitDate = selectedDate && selectedDate[0] ? new Date(selectedDate[0]) : new Date();
|
|
3512
|
+
var rightInitDate = selectedDate && selectedDate[1] ? new Date(selectedDate[1]) : new Date();
|
|
3509
3513
|
var leftInitMonth = leftInitDate.getMonth();
|
|
3510
3514
|
var leftInitYear = leftInitDate.getFullYear();
|
|
3511
|
-
var rightInitMonth =
|
|
3512
|
-
|
|
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;
|
|
3513
3525
|
// State to track left and right panel month/year
|
|
3514
3526
|
var _b = useState(leftInitMonth), leftMonth = _b[0], setLeftMonth = _b[1];
|
|
3515
3527
|
var _c = useState(leftInitYear), leftYear = _c[0], setLeftYear = _c[1];
|
|
3516
3528
|
var _d = useState(rightInitMonth), rightMonth = _d[0], setRightMonth = _d[1];
|
|
3517
3529
|
var _e = useState(rightInitYear), rightYear = _e[0], setRightYear = _e[1];
|
|
3518
3530
|
var _f = useState(selectedDate || []), tempSelectedDate = _f[0], setTempSelectedDate = _f[1];
|
|
3519
|
-
// Sync state when initial selection changes
|
|
3520
3531
|
useEffect(function () {
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
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
|
+
useEffect(function () {
|
|
3541
|
+
if (!isPickerOpen)
|
|
3542
|
+
setTempSelectedDate(selectedDate || []);
|
|
3543
|
+
}, [isPickerOpen]);
|
|
3531
3544
|
var isAdjacent = 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
|
+
};
|
|
3532
3567
|
var handleLeftPrevMonth = function () {
|
|
3533
3568
|
if (leftMonth === 0) {
|
|
3534
|
-
|
|
3535
|
-
setLeftYear(function (prev) { return prev - 1; });
|
|
3569
|
+
ensureOrderedPickers(11, leftYear - 1, rightMonth, rightYear);
|
|
3536
3570
|
}
|
|
3537
3571
|
else {
|
|
3538
|
-
|
|
3572
|
+
ensureOrderedPickers(leftMonth - 1, leftYear, rightMonth, rightYear);
|
|
3539
3573
|
}
|
|
3540
3574
|
};
|
|
3541
3575
|
var handleLeftNextMonth = function () {
|
|
3576
|
+
var newLeftMonth = leftMonth;
|
|
3577
|
+
var newLeftYear = leftYear;
|
|
3578
|
+
var newRightMonth = rightMonth;
|
|
3579
|
+
var newRightYear = rightYear;
|
|
3542
3580
|
if (isAdjacent) {
|
|
3543
|
-
// If adjacent, move both panels forward
|
|
3581
|
+
// If adjacent, move both panels forward
|
|
3544
3582
|
if (leftMonth === 11) {
|
|
3545
|
-
|
|
3546
|
-
|
|
3583
|
+
newLeftMonth = 0;
|
|
3584
|
+
newLeftYear = leftYear + 1;
|
|
3547
3585
|
}
|
|
3548
3586
|
else {
|
|
3549
|
-
|
|
3587
|
+
newLeftMonth = leftMonth + 1;
|
|
3550
3588
|
}
|
|
3551
3589
|
if (rightMonth === 11) {
|
|
3552
|
-
|
|
3553
|
-
|
|
3590
|
+
newRightMonth = 0;
|
|
3591
|
+
newRightYear = rightYear + 1;
|
|
3554
3592
|
}
|
|
3555
3593
|
else {
|
|
3556
|
-
|
|
3594
|
+
newRightMonth = rightMonth + 1;
|
|
3557
3595
|
}
|
|
3558
3596
|
}
|
|
3559
3597
|
else {
|
|
3560
|
-
// If not adjacent, move left panel forward by 1 month
|
|
3561
3598
|
if (leftMonth === 11) {
|
|
3562
|
-
|
|
3563
|
-
|
|
3599
|
+
newLeftMonth = 0;
|
|
3600
|
+
newLeftYear = leftYear + 1;
|
|
3564
3601
|
}
|
|
3565
3602
|
else {
|
|
3566
|
-
|
|
3603
|
+
newLeftMonth = leftMonth + 1;
|
|
3567
3604
|
}
|
|
3568
3605
|
}
|
|
3606
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3569
3607
|
};
|
|
3570
3608
|
var handleRightPrevMonth = function () {
|
|
3609
|
+
var newLeftMonth = leftMonth;
|
|
3610
|
+
var newLeftYear = leftYear;
|
|
3611
|
+
var newRightMonth = rightMonth;
|
|
3612
|
+
var newRightYear = rightYear;
|
|
3571
3613
|
if (isAdjacent) {
|
|
3572
|
-
// If adjacent, move both panels backward
|
|
3614
|
+
// If adjacent, move both panels backward
|
|
3573
3615
|
if (leftMonth === 0) {
|
|
3574
|
-
|
|
3575
|
-
|
|
3616
|
+
newLeftMonth = 11;
|
|
3617
|
+
newLeftYear = leftYear - 1;
|
|
3576
3618
|
}
|
|
3577
3619
|
else {
|
|
3578
|
-
|
|
3620
|
+
newLeftMonth = leftMonth - 1;
|
|
3579
3621
|
}
|
|
3580
3622
|
if (rightMonth === 0) {
|
|
3581
|
-
|
|
3582
|
-
|
|
3623
|
+
newRightMonth = 11;
|
|
3624
|
+
newRightYear = rightYear - 1;
|
|
3583
3625
|
}
|
|
3584
3626
|
else {
|
|
3585
|
-
|
|
3627
|
+
newRightMonth = rightMonth - 1;
|
|
3586
3628
|
}
|
|
3587
3629
|
}
|
|
3588
3630
|
else {
|
|
3589
|
-
// If not adjacent, move right panel backward by 1 month
|
|
3590
3631
|
if (rightMonth === 0) {
|
|
3591
|
-
|
|
3592
|
-
|
|
3632
|
+
newRightMonth = 11;
|
|
3633
|
+
newRightYear = rightYear - 1;
|
|
3593
3634
|
}
|
|
3594
3635
|
else {
|
|
3595
|
-
|
|
3636
|
+
newRightMonth = rightMonth - 1;
|
|
3596
3637
|
}
|
|
3597
3638
|
}
|
|
3639
|
+
ensureOrderedPickers(newLeftMonth, newLeftYear, newRightMonth, newRightYear);
|
|
3598
3640
|
};
|
|
3599
3641
|
var handleRightNextMonth = function () {
|
|
3642
|
+
var newRightMonth = rightMonth;
|
|
3643
|
+
var newRightYear = rightYear;
|
|
3600
3644
|
if (rightMonth === 11) {
|
|
3601
|
-
|
|
3602
|
-
|
|
3645
|
+
newRightMonth = 0;
|
|
3646
|
+
newRightYear = rightYear + 1;
|
|
3603
3647
|
}
|
|
3604
3648
|
else {
|
|
3605
|
-
|
|
3649
|
+
newRightMonth = rightMonth + 1;
|
|
3606
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);
|
|
3607
3658
|
};
|
|
3608
3659
|
var handleDateSelect = function (date) {
|
|
3609
3660
|
if (tempSelectedDate.length >= 2) {
|
|
3610
3661
|
setTempSelectedDate([dateToInputString(date)]);
|
|
3611
3662
|
}
|
|
3612
3663
|
else {
|
|
3613
|
-
|
|
3664
|
+
var newDates = __spreadArray(__spreadArray([], tempSelectedDate, true), [dateToInputString(date)], false);
|
|
3665
|
+
if (newDates.length === 2)
|
|
3666
|
+
newDates.sort();
|
|
3667
|
+
setTempSelectedDate(newDates);
|
|
3614
3668
|
}
|
|
3615
3669
|
};
|
|
3616
|
-
var handleMonthSelect = function (
|
|
3670
|
+
var handleMonthSelect = function (dateIndex, initYear) {
|
|
3617
3671
|
return function (val) {
|
|
3618
3672
|
var selectedDates = Array.isArray(selectedDate)
|
|
3619
3673
|
? selectedDate
|
|
@@ -3631,21 +3685,31 @@ var RangePicker = function (_a) {
|
|
|
3631
3685
|
}
|
|
3632
3686
|
var selectedMonth = parseInt(selectedDates[dateIndex].slice(5, 7)) - 1;
|
|
3633
3687
|
if (val === selectedMonth) {
|
|
3634
|
-
|
|
3688
|
+
if (dateIndex === 0) {
|
|
3689
|
+
ensureOrderedPickers(selectedMonth, initYear, rightMonth, rightYear);
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
ensureOrderedPickers(leftMonth, leftYear, selectedMonth, initYear);
|
|
3693
|
+
}
|
|
3635
3694
|
}
|
|
3636
3695
|
else {
|
|
3637
3696
|
return;
|
|
3638
3697
|
}
|
|
3639
3698
|
}
|
|
3640
3699
|
else {
|
|
3641
|
-
|
|
3700
|
+
if (dateIndex === 0) {
|
|
3701
|
+
ensureOrderedPickers(val, initYear, rightMonth, rightYear);
|
|
3702
|
+
}
|
|
3703
|
+
else {
|
|
3704
|
+
ensureOrderedPickers(leftMonth, leftYear, val, initYear);
|
|
3705
|
+
}
|
|
3642
3706
|
}
|
|
3643
3707
|
};
|
|
3644
3708
|
};
|
|
3645
3709
|
return (React.createElement("div", { className: "space-y-[30px]" },
|
|
3646
3710
|
React.createElement("div", { className: "range-picker picker-body flex gap-x-[22px]" },
|
|
3647
|
-
React.createElement(PickerContent, { selectedDate: tempSelectedDate, minDate: minDate, maxDate: maxDate, onDateSelect: handleDateSelect, initialViewMonth: leftMonth, initialViewYear: leftYear, onPrevMonth: handleLeftPrevMonth, onNextMonth: handleLeftNextMonth, onMonthSelect: handleMonthSelect(
|
|
3648
|
-
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 })),
|
|
3649
3713
|
React.createElement("div", { className: "flex justify-between" },
|
|
3650
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([]); } }),
|
|
3651
3715
|
React.createElement("div", { className: "flex gap-x-2.5" },
|
|
@@ -3667,16 +3731,16 @@ var PickerCalendar = function (_a) {
|
|
|
3667
3731
|
setIsPickerOpen(isOpen);
|
|
3668
3732
|
}, [isOpen]);
|
|
3669
3733
|
return 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),
|
|
3670
|
-
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);
|
|
3671
3735
|
};
|
|
3672
3736
|
var PickerBody = function (_a) {
|
|
3673
|
-
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;
|
|
3674
3738
|
useEffect(function () {
|
|
3675
3739
|
if (!isPickerOpen) {
|
|
3676
3740
|
onClose();
|
|
3677
3741
|
}
|
|
3678
3742
|
}, [isPickerOpen]);
|
|
3679
|
-
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 }))));
|
|
3680
3744
|
};
|
|
3681
3745
|
|
|
3682
3746
|
var monthMap = [
|
|
@@ -4000,7 +4064,10 @@ function Modal(_a) {
|
|
|
4000
4064
|
modalSize = 'w-[540px]';
|
|
4001
4065
|
}
|
|
4002
4066
|
var handleClose = function (e) {
|
|
4003
|
-
if (
|
|
4067
|
+
if (onClose &&
|
|
4068
|
+
e &&
|
|
4069
|
+
e.target &&
|
|
4070
|
+
e.target.id === 'wrapper') {
|
|
4004
4071
|
onClose();
|
|
4005
4072
|
}
|
|
4006
4073
|
};
|
|
@@ -4011,7 +4078,7 @@ function Modal(_a) {
|
|
|
4011
4078
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
4012
4079
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
4013
4080
|
React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
|
|
4014
|
-
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(); } }))),
|
|
4015
4082
|
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))), document.body));
|
|
4016
4083
|
}
|
|
4017
4084
|
return null;
|
|
@@ -4080,14 +4147,14 @@ function PaginationBar(_a) {
|
|
|
4080
4147
|
setShowedPages(newPages);
|
|
4081
4148
|
}, [startIndex, totalPages]);
|
|
4082
4149
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
4083
|
-
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 })),
|
|
4084
4151
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|
|
4085
4152
|
handlePageChange(currentPage - 1);
|
|
4086
4153
|
if (showedPages[0] === currentPage)
|
|
4087
4154
|
setStartIndex(function (old) { return old - 1; });
|
|
4088
4155
|
if (!showedPages.includes(currentPage))
|
|
4089
4156
|
setStartIndex(currentPage - 2);
|
|
4090
|
-
}, 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 }),
|
|
4091
4158
|
showedPages.map(function (page) {
|
|
4092
4159
|
if (page === currentPage) {
|
|
4093
4160
|
return React.createElement(SelectedPage, { key: page, label: page.toString(), size: size });
|
|
@@ -4102,9 +4169,9 @@ function PaginationBar(_a) {
|
|
|
4102
4169
|
setStartIndex(function (old) { return old + 1; });
|
|
4103
4170
|
if (!showedPages.includes(currentPage))
|
|
4104
4171
|
setStartIndex(currentPage - 4);
|
|
4105
|
-
}, 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 }),
|
|
4106
4173
|
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handleNextRange, className: showedPages[showedPages.length - 1] === totalPages
|
|
4107
|
-
? ''
|
|
4174
|
+
? 'cursor-not-allowed'
|
|
4108
4175
|
: 'cursor-pointer', iconLeft: React.createElement(TbChevronsRight, { size: iconSize }), disabled: showedPages[showedPages.length - 1] === totalPages }))));
|
|
4109
4176
|
}
|
|
4110
4177
|
|