@pushwoosh/dumb-components 1.1.135 → 1.1.136
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/AccessForbidden/AccessForbidden.js +17 -11
- package/Alert/Alert.d.ts +1 -2
- package/Alert/Alert.js +31 -25
- package/ApplicationPreloader/ApplicationPreloader.d.ts +1 -2
- package/ApplicationPreloader/ApplicationPreloader.js +5 -4
- package/Badge/Badge.js +2 -2
- package/Banner/Banner.js +40 -24
- package/Button/Button.js +20 -9
- package/Button/RemoveButton.js +7 -6
- package/Calendar/CalendarDropdown/CalendarDropdown.js +121 -108
- package/Calendar/CalendarMonth/CalendarMonth.js +68 -66
- package/Calendar/CalendarMonthSlider/CalendarMonthSlider.d.ts +2 -2
- package/Calendar/CalendarMonthSlider/CalendarMonthSlider.js +68 -55
- package/Calendar/CalendarSuperForm/CalendarSuperForm.js +75 -70
- package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.d.ts +2 -2
- package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +3 -2
- package/Calendar/CalendarSuperForm/components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection.js +106 -88
- package/Calendar/CalendarSuperForm/components/CalendarTimeInput.d.ts +1 -2
- package/Calendar/CalendarSuperForm/components/CalendarTimeInput.js +2 -2
- package/Calendar/CalendarSuperForm/components/CalendarTimezoneSelect.js +3 -2
- package/CardMetric/CardChildren.js +9 -6
- package/CardMetric/CardCollapse.js +8 -6
- package/CardMetric/CardMetric.js +52 -33
- package/Checkbox/Checkbox.js +30 -24
- package/Chip/Chip.d.ts +6 -7
- package/Chip/Chip.js +22 -15
- package/CodeEditor/CodeEditor.d.ts +1 -2
- package/CodeEditor/CodeEditor.js +2 -2
- package/CrashScreen/CrashScreen.js +18 -10
- package/DateTimePicker/components/AutosizeInput/AutosizeInput.js +17 -13
- package/DateTimePicker/components/DatePicker/DatePicker.js +35 -32
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +31 -24
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +22 -20
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +29 -24
- package/DateTimePicker/components/DecadeView/DecadeView.js +19 -17
- package/DateTimePicker/components/Input/Input.js +2 -2
- package/DateTimePicker/components/Month/Month.js +51 -35
- package/DateTimePicker/components/MonthView/MonthView.js +21 -17
- package/DateTimePicker/components/NumberPicker/NumberPicker.js +49 -40
- package/DateTimePicker/components/PickerPlate/PickerPlate.js +17 -14
- package/DateTimePicker/components/YearView/YearView.js +22 -18
- package/Drawer/components/Drawer/Drawer.js +18 -13
- package/Drawer/components/Drawer/styles.d.ts +2 -2
- package/Drawer/components/Drawer/styles.js +5 -4
- package/Drawer/components/DrawerDocs/DrawerDocs.js +25 -20
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +28 -24
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -6
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +6 -4
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +13 -10
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +40 -31
- package/EditableField/EditableField.js +55 -43
- package/EmailTemplatePreview/EmailTemplatePreview.js +10 -8
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +28 -22
- package/EnhancedInput/EnhancedInput.d.ts +3 -4
- package/EnhancedInput/EnhancedInput.js +14 -10
- package/EnhancedInput/SearchInput.js +3 -3
- package/ExportResult/ExportResult.js +33 -23
- package/ExternalImagePreview/ExternalImagePreview.js +24 -20
- package/FieldBox/FieldBox.js +50 -37
- package/FrequencyCapping/FrequencyCappingEdit.js +41 -33
- package/FrequencyCapping/FrequencyCappingInApps.js +41 -33
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +1 -2
- package/FrequencyCapping/FrequencyCappingReadonly.js +24 -20
- package/FrequencyCapping/components/Condition/index.d.ts +1 -2
- package/FrequencyCapping/components/Condition/index.js +24 -20
- package/FrequencyCapping/components/Description/index.d.ts +2 -2
- package/FrequencyCapping/components/Description/index.js +7 -5
- package/FrequencyCapping/components/Settings/EditCappingSettings.js +28 -20
- package/FrequencyCapping/components/Settings/EditInAppCappingSettings.js +86 -71
- package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +1 -2
- package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +41 -32
- package/GetStartedPage/GetStartedPage.js +44 -25
- package/InputFile/InputFile.js +44 -35
- package/Link/Link.js +2 -2
- package/Modal/components/Modal/Modal.js +17 -12
- package/Modal/components/Modal/styles.js +5 -4
- package/Modal/components/ModalConfirm/ModalConfirm.js +33 -19
- package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +2 -2
- package/Modal/components/ModalConfirm/ModalConfirmProvider.js +8 -6
- package/Modal/components/ModalTitle/ModalTitle.js +10 -8
- package/NotificationInbox/NotificationBar.js +19 -11
- package/NotificationInbox/NotificationBell.js +15 -12
- package/NotificationInbox/NotificationInbox.js +159 -118
- package/NumberPicker/NumberPicker.js +53 -44
- package/NumberPicker/components/AutosizeInput/AutosizeInput.js +19 -15
- package/PageHeader/components/AutosizeInput/AutosizeInput.js +30 -22
- package/PageHeader/components/PageHeader/PageHeader.js +44 -27
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +51 -34
- package/PageHeader/components/PageHeaderError/PageHeaderError.js +17 -10
- package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.js +20 -16
- package/Pagination/Pagination.js +60 -49
- package/Popover/Popover.js +6 -5
- package/ProgressBar/ProgressBar.js +25 -10
- package/PushPreview/PushPreview.js +30 -22
- package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +22 -15
- package/PushPreview/components/SilentPushPreview/SilentPushPreview.js +20 -13
- package/Radio/Radio.js +32 -26
- package/RadioCard/RadioCard.js +17 -9
- package/ReCaptcha/ReCaptcha.js +2 -2
- package/RichMessageEditor/EditorEmojiPicker.js +9 -7
- package/RichMessageEditor/RichMessageEditor.js +77 -67
- package/RichMessageEditor/RichMessageViewer.js +19 -13
- package/RichMessageEditor/slate/DynamicContentElement.d.ts +1 -2
- package/RichMessageEditor/slate/DynamicContentElement.js +13 -9
- package/RichMessageEditor/slate/SlateEditor.js +9 -7
- package/RichmediaPreview/RichmediaPreview.js +13 -11
- package/Select/Select.js +10 -8
- package/SendRate/SendRateEdit.d.ts +1 -2
- package/SendRate/SendRateEdit.js +42 -34
- package/SendRate/SendRateReadonly.d.ts +1 -2
- package/SendRate/SendRateReadonly.js +24 -20
- package/SendRate/components/Condition/index.d.ts +1 -2
- package/SendRate/components/Condition/index.js +15 -13
- package/SendRate/components/Description/index.d.ts +2 -2
- package/SendRate/components/Description/index.js +30 -22
- package/SendRate/components/Settings/index.d.ts +1 -2
- package/SendRate/components/Settings/index.js +20 -14
- package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +1 -2
- package/SendRate/helpers/getReadonlySendRateHelpers.js +39 -30
- package/Skeleton/TextSkeleton.js +5 -4
- package/SortButton/SortButton.js +11 -7
- package/Spinner/Spinner.js +7 -4
- package/StatisticCard/StatisticCard.js +44 -29
- package/Switch/Switch.js +16 -13
- package/Tabs/components/Tab/Tab.d.ts +3 -4
- package/Tabs/components/Tab/Tab.js +6 -4
- package/Tabs/components/TabBar/TabBar.d.ts +3 -4
- package/Tabs/components/TabBar/TabBar.js +12 -4
- package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.d.ts +1 -2
- package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.js +27 -21
- package/Tabs/components/TabBase/TabBase.d.ts +3 -4
- package/Tabs/components/TabBase/TabBase.js +11 -6
- package/Tabs/components/TabPanel/TabPanel.js +4 -2
- package/Tabs/components/Tabs/Tabs.js +8 -4
- package/Toast/Toast.js +31 -18
- package/Toast/ToastProvider.d.ts +2 -3
- package/Toast/ToastProvider.js +10 -8
- package/Tooltip/Tooltip.js +2 -2
- package/Tooltip/TooltipTrigger.js +13 -11
- package/package.json +2 -2
- package/polyglot/__tests__/render.test.js +46 -16
- package/polyglot/liquid/render.d.ts +2 -2
- package/polyglot/liquid/render.js +7 -6
- package/polyglot/react.js +7 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { Columns } from '@pushwoosh/kit-helpers';
|
|
3
4
|
import { CellBox, DayHeader } from './styles';
|
|
4
5
|
import { addPeriod, differenceInDays, getLastDayOfMonth, getFirstDayOfWeek, isSamePeriod, compareStructs, pickDateStruct } from '../helpers';
|
|
@@ -36,74 +37,75 @@ export const CalendarMonth = ({
|
|
|
36
37
|
};
|
|
37
38
|
}, []);
|
|
38
39
|
const dayLabels = firstDayOfWeek === 0 ? ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] : ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
39
|
-
return
|
|
40
|
+
return _jsxs(Columns, {
|
|
40
41
|
"$sizes": 7,
|
|
41
|
-
"$gap": 2
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
42
|
+
"$gap": 2,
|
|
43
|
+
children: [dayLabels.map(l => _jsx(DayHeader, {
|
|
44
|
+
children: l
|
|
45
|
+
}, l)), Array.from({
|
|
46
|
+
length: days
|
|
47
|
+
}).map((_, i) => {
|
|
48
|
+
const curDay = addPeriod(firstDayDate, 'day', i);
|
|
49
|
+
let variant;
|
|
50
|
+
if (!isSamePeriod(month, curDay, 'month')) {
|
|
51
|
+
if (periodFrom && periodTo && compareStructs(periodFrom, periodTo) !== 0 && !isSamePeriod(periodFrom, periodTo, 'month')) {
|
|
52
|
+
const currentMonthStruct = {
|
|
53
|
+
year: month.year,
|
|
54
|
+
month: month.month,
|
|
55
|
+
day: 1
|
|
56
|
+
};
|
|
57
|
+
const outdatedMonthStruct = {
|
|
58
|
+
year: curDay.year,
|
|
59
|
+
month: curDay.month,
|
|
60
|
+
day: 1
|
|
61
|
+
};
|
|
62
|
+
const periodFromMonthStruct = {
|
|
63
|
+
year: periodFrom.year,
|
|
64
|
+
month: periodFrom.month,
|
|
65
|
+
day: 1
|
|
66
|
+
};
|
|
67
|
+
const periodToMonthStruct = {
|
|
68
|
+
year: periodTo.year,
|
|
69
|
+
month: periodTo.month,
|
|
70
|
+
day: 1
|
|
71
|
+
};
|
|
72
|
+
const isCurrentMonthInPeriod = compareStructs(currentMonthStruct, periodFromMonthStruct) >= 0 && compareStructs(currentMonthStruct, periodToMonthStruct) <= 0;
|
|
73
|
+
const isOutdatedMonthInPeriod = compareStructs(outdatedMonthStruct, periodFromMonthStruct) >= 0 && compareStructs(outdatedMonthStruct, periodToMonthStruct) <= 0;
|
|
74
|
+
if (isCurrentMonthInPeriod && isOutdatedMonthInPeriod) {
|
|
75
|
+
variant = 'periodOutdated';
|
|
76
|
+
} else {
|
|
77
|
+
variant = 'outdated';
|
|
78
|
+
}
|
|
75
79
|
} else {
|
|
76
80
|
variant = 'outdated';
|
|
77
81
|
}
|
|
78
|
-
} else {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} else {
|
|
85
|
-
variant = '
|
|
82
|
+
} else if (disableOnAndBefore && compareStructs(curDay, disableOnAndBefore) <= 0 || disableOnAndAfter && compareStructs(curDay, disableOnAndAfter) >= 0 || disablePeriod && compareStructs(curDay, disablePeriod[0]) >= 0 && compareStructs(curDay, disablePeriod[1]) <= 0) {
|
|
83
|
+
if (periodFrom && isSamePeriod(curDay, periodFrom, 'day')) {
|
|
84
|
+
variant = 'selectedDisabled';
|
|
85
|
+
} else {
|
|
86
|
+
variant = 'disabled';
|
|
87
|
+
}
|
|
88
|
+
} else if (selectedDay && isSamePeriod(curDay, selectedDay, 'day')) {
|
|
89
|
+
variant = 'selected';
|
|
90
|
+
} else if (periodFrom && periodTo && isSamePeriod(periodFrom, periodTo, 'day') && isSamePeriod(curDay, periodFrom, 'day')) {
|
|
91
|
+
variant = 'selected';
|
|
92
|
+
} else if (periodFrom && isSamePeriod(curDay, periodFrom, 'day')) {
|
|
93
|
+
variant = 'periodFrom';
|
|
94
|
+
} else if (periodTo && isSamePeriod(curDay, periodTo, 'day')) {
|
|
95
|
+
variant = 'periodTo';
|
|
96
|
+
} else if (highlightDay && isSamePeriod(curDay, highlightDay, 'day')) {
|
|
97
|
+
variant = 'highlighted';
|
|
98
|
+
} else if (periodFrom && periodTo && compareStructs(curDay, periodFrom) > 0 && compareStructs(curDay, periodTo) < 0) {
|
|
99
|
+
variant = 'period';
|
|
86
100
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
} else if (periodFrom && periodTo && compareStructs(curDay, periodFrom) > 0 && compareStructs(curDay, periodTo) < 0) {
|
|
98
|
-
variant = 'period';
|
|
99
|
-
}
|
|
100
|
-
return React.createElement(CellBox, {
|
|
101
|
-
key: `${curDay.year}-${curDay.month}-${curDay.day}`,
|
|
102
|
-
"$variant": variant,
|
|
103
|
-
"$isToday": isSamePeriod(curDay, today, 'day'),
|
|
104
|
-
onClick: () => onDaySelect(pickDateStruct(curDay)),
|
|
105
|
-
onMouseEnter: onDayMouseEnter ? () => onDayMouseEnter(curDay) : undefined,
|
|
106
|
-
onMouseLeave: onDayMouseLeave ? () => onDayMouseLeave(curDay) : undefined
|
|
107
|
-
}, curDay.day);
|
|
108
|
-
}));
|
|
101
|
+
return _jsx(CellBox, {
|
|
102
|
+
"$variant": variant,
|
|
103
|
+
"$isToday": isSamePeriod(curDay, today, 'day'),
|
|
104
|
+
onClick: () => onDaySelect(pickDateStruct(curDay)),
|
|
105
|
+
onMouseEnter: onDayMouseEnter ? () => onDayMouseEnter(curDay) : undefined,
|
|
106
|
+
onMouseLeave: onDayMouseLeave ? () => onDayMouseLeave(curDay) : undefined,
|
|
107
|
+
children: curDay.day
|
|
108
|
+
}, `${curDay.year}-${curDay.month}-${curDay.day}`);
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
109
111
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
2
|
import { type MonthCommonProps } from '../CalendarMonth/types';
|
|
3
3
|
import { type DateStruct } from '../types';
|
|
4
4
|
export interface CalendarMonthSliderProps extends MonthCommonProps {
|
|
@@ -6,6 +6,6 @@ export interface CalendarMonthSliderProps extends MonthCommonProps {
|
|
|
6
6
|
monthWidth?: number;
|
|
7
7
|
gap?: number;
|
|
8
8
|
visibleCount?: number;
|
|
9
|
-
renderAfter?: () =>
|
|
9
|
+
renderAfter?: () => ReactNode;
|
|
10
10
|
}
|
|
11
11
|
export declare const CalendarMonthSlider: FC<CalendarMonthSliderProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { Horizontal, usePersistentFunction, Vertical } from '@pushwoosh/kit-helpers';
|
|
3
4
|
import { ArrowIcon } from '@pushwoosh/kit-icons';
|
|
4
5
|
import { Root, Viewport, Strip, Panel, NavButtonLeft, NavButtonRight, StyledSelect } from './styles';
|
|
@@ -79,63 +80,75 @@ export const CalendarMonthSlider = ({
|
|
|
79
80
|
length: 11
|
|
80
81
|
}, (_, i) => currentYear - 5 + i);
|
|
81
82
|
const viewportWidth = `${visibleCount * monthWidth + gap * (visibleCount - 1)}px`;
|
|
82
|
-
return
|
|
83
|
+
return _jsxs(Root, {
|
|
83
84
|
style: {
|
|
84
85
|
['--slider-width']: viewportWidth,
|
|
85
86
|
['--col-width']: `${monthWidth}px`,
|
|
86
87
|
['--gap']: `${gap}px`,
|
|
87
88
|
['--shift']: `${shiftPx}px`
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
89
|
+
},
|
|
90
|
+
children: [_jsx(Viewport, {
|
|
91
|
+
children: _jsx(Strip, {
|
|
92
|
+
withTransition: inTransition,
|
|
93
|
+
onTransitionEnd: () => {
|
|
94
|
+
toBaseline(anchor);
|
|
95
|
+
},
|
|
96
|
+
children: panels.map((p, i) =>
|
|
97
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
98
|
+
_jsx(Panel, {
|
|
99
|
+
children: _jsxs(Vertical, {
|
|
100
|
+
"$gap": 4,
|
|
101
|
+
children: [_jsxs(Horizontal, {
|
|
102
|
+
"$justifyContent": "center",
|
|
103
|
+
"$gap": 6,
|
|
104
|
+
children: [_jsx(StyledSelect, {
|
|
105
|
+
value: p.month,
|
|
106
|
+
onChange: e => handleMonthChange(e, i, p),
|
|
107
|
+
children: Array.from({
|
|
108
|
+
length: 12
|
|
109
|
+
}, (_, idx) => _jsx("option", {
|
|
110
|
+
value: idx + 1,
|
|
111
|
+
children: monthName(idx + 1, 'long')
|
|
112
|
+
}, idx + 1))
|
|
113
|
+
}), _jsx(StyledSelect, {
|
|
114
|
+
value: p.year,
|
|
115
|
+
onChange: e => handleYearChange(e, i, p),
|
|
116
|
+
children: yearOptions.map(year => _jsx("option", {
|
|
117
|
+
value: year,
|
|
118
|
+
children: year
|
|
119
|
+
}, year))
|
|
120
|
+
})]
|
|
121
|
+
}), _jsx(CalendarMonth, {
|
|
122
|
+
month: p,
|
|
123
|
+
...monthProps
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
}, `${p.year}-${p.month}-${i}`))
|
|
127
|
+
})
|
|
128
|
+
}), _jsx(NavButtonLeft, {
|
|
129
|
+
children: _jsx(Button, {
|
|
130
|
+
color: "secondary",
|
|
131
|
+
size: "compact",
|
|
132
|
+
view: "ghost",
|
|
133
|
+
icon: _jsx(ArrowIcon, {
|
|
134
|
+
size: "small",
|
|
135
|
+
direction: "left"
|
|
136
|
+
}),
|
|
137
|
+
onClick: animateBackward,
|
|
138
|
+
isDisabled: inTransition
|
|
139
|
+
})
|
|
140
|
+
}), _jsx(NavButtonRight, {
|
|
141
|
+
children: _jsx(Button, {
|
|
142
|
+
color: "secondary",
|
|
143
|
+
size: "compact",
|
|
144
|
+
view: "ghost",
|
|
145
|
+
icon: _jsx(ArrowIcon, {
|
|
146
|
+
size: "small",
|
|
147
|
+
direction: "right"
|
|
148
|
+
}),
|
|
149
|
+
onClick: animateForward,
|
|
150
|
+
isDisabled: inTransition
|
|
151
|
+
})
|
|
152
|
+
}), renderAfter === null || renderAfter === void 0 ? void 0 : renderAfter()]
|
|
153
|
+
});
|
|
141
154
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
@@ -23,80 +23,85 @@ export const CalendarSuperForm = props => {
|
|
|
23
23
|
} = props;
|
|
24
24
|
const isRangePicker = mode === 'range-date' || mode === 'range-datetime';
|
|
25
25
|
const withTime = mode === 'single-datetime' || mode === 'range-datetime';
|
|
26
|
-
return
|
|
27
|
-
"$gap": 8
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
return _jsx(Vertical, {
|
|
27
|
+
"$gap": 8,
|
|
28
|
+
children: _jsx(CalendarRangePicker, {
|
|
29
|
+
disableOnAndBefore: disableOnAndBefore,
|
|
30
|
+
disableOnAndAfter: disableOnAndAfter,
|
|
31
|
+
minDays: minDays,
|
|
32
|
+
maxDays: maxDays,
|
|
33
|
+
value: isRangePicker ? value : value ? [value] : [],
|
|
34
|
+
onChange: val => {
|
|
35
|
+
if (isRangePicker) {
|
|
36
|
+
if (withTime) {
|
|
37
|
+
if (val.length === 2) {
|
|
38
|
+
onChange([{
|
|
39
|
+
...val[0],
|
|
40
|
+
hour: 0,
|
|
41
|
+
minute: 0,
|
|
42
|
+
second: 0,
|
|
43
|
+
millisecond: 0
|
|
44
|
+
}, {
|
|
45
|
+
...val[1],
|
|
46
|
+
hour: 23,
|
|
47
|
+
minute: 59,
|
|
48
|
+
second: 59,
|
|
49
|
+
millisecond: 999
|
|
50
|
+
}]);
|
|
51
|
+
} else if (val.length === 1) {
|
|
52
|
+
onChange([{
|
|
53
|
+
hour: 0,
|
|
54
|
+
minute: 0,
|
|
55
|
+
second: 0,
|
|
56
|
+
millisecond: 0,
|
|
57
|
+
...val[0]
|
|
58
|
+
}]);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
onChange(val);
|
|
62
|
+
}
|
|
63
|
+
} else if (val[0]) {
|
|
64
|
+
if (withTime) {
|
|
65
|
+
onChange({
|
|
53
66
|
hour: 0,
|
|
54
67
|
minute: 0,
|
|
55
68
|
second: 0,
|
|
56
69
|
millisecond: 0,
|
|
70
|
+
...value,
|
|
57
71
|
...val[0]
|
|
58
|
-
}
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
onChange(val[0]);
|
|
59
75
|
}
|
|
60
|
-
} else {
|
|
61
|
-
onChange(val);
|
|
62
|
-
}
|
|
63
|
-
} else if (val[0]) {
|
|
64
|
-
if (withTime) {
|
|
65
|
-
onChange({
|
|
66
|
-
hour: 0,
|
|
67
|
-
minute: 0,
|
|
68
|
-
second: 0,
|
|
69
|
-
millisecond: 0,
|
|
70
|
-
...value,
|
|
71
|
-
...val[0]
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
onChange(val[0]);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
singleMode: !isRangePicker,
|
|
79
|
-
visibleCount: visibleCount !== undefined ? visibleCount : isRangePicker ? 2 : 1,
|
|
80
|
-
monthWidth: monthWidth,
|
|
81
|
-
gap: gap,
|
|
82
|
-
renderAfter: withTime || maxDays && maxDays > 0 || footerContent ? () => {
|
|
83
|
-
return React.createElement(Vertical, {
|
|
84
|
-
"$gap": 8,
|
|
85
|
-
"$margin": {
|
|
86
|
-
top: 16
|
|
87
76
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
},
|
|
78
|
+
singleMode: !isRangePicker,
|
|
79
|
+
visibleCount: visibleCount !== undefined ? visibleCount : isRangePicker ? 2 : 1,
|
|
80
|
+
monthWidth: monthWidth,
|
|
81
|
+
gap: gap,
|
|
82
|
+
renderAfter: withTime || maxDays && maxDays > 0 || footerContent ? () => {
|
|
83
|
+
return _jsxs(Vertical, {
|
|
84
|
+
"$gap": 8,
|
|
85
|
+
"$margin": {
|
|
86
|
+
top: 16
|
|
87
|
+
},
|
|
88
|
+
children: [_jsxs(Vertical, {
|
|
89
|
+
children: [maxDays && maxDays > 0 && _jsx(Text, {
|
|
90
|
+
"$variant": "footnote",
|
|
91
|
+
"$color": Color.LOCKED,
|
|
92
|
+
children: `Max length: ${maxDays} days`
|
|
93
|
+
}), footerContent]
|
|
94
|
+
}), withTime && timezone && onChangeTimezone && _jsx(CalendarTimeAndTimezoneSection, {
|
|
95
|
+
isRangePicker: isRangePicker,
|
|
96
|
+
value: value,
|
|
97
|
+
onChange: onChange,
|
|
98
|
+
timezone: timezone,
|
|
99
|
+
onChangeTimezone: onChangeTimezone,
|
|
100
|
+
visibleCount: visibleCount
|
|
101
|
+
})]
|
|
102
|
+
});
|
|
103
|
+
} : undefined,
|
|
104
|
+
firstDayOfWeek: firstDayOfWeek
|
|
105
|
+
})
|
|
106
|
+
});
|
|
102
107
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
2
|
import { type DateStruct } from '../../../types';
|
|
3
3
|
export type RangePickerValue = [DateStruct, DateStruct] | [DateStruct] | [];
|
|
4
4
|
type CalendarRangePickerProps = {
|
|
@@ -12,7 +12,7 @@ type CalendarRangePickerProps = {
|
|
|
12
12
|
minDays?: number;
|
|
13
13
|
maxDays?: number;
|
|
14
14
|
onChange: (range: RangePickerValue) => void;
|
|
15
|
-
renderAfter?: () =>
|
|
15
|
+
renderAfter?: () => ReactNode;
|
|
16
16
|
firstDayOfWeek?: 0 | 1;
|
|
17
17
|
};
|
|
18
18
|
export declare const CalendarRangePicker: FC<CalendarRangePickerProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
2
3
|
import { getDisabledRanges } from './getDisabledRanges';
|
|
3
4
|
import { CalendarMonthSlider } from '../../../CalendarMonthSlider/CalendarMonthSlider';
|
|
4
5
|
import { compareStructs } from '../../../helpers';
|
|
@@ -25,7 +26,7 @@ export const CalendarRangePicker = ({
|
|
|
25
26
|
day: d.getDate()
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
return
|
|
29
|
+
return _jsx(CalendarMonthSlider, {
|
|
29
30
|
startMonth: startMonthRef.current,
|
|
30
31
|
visibleCount: visibleCount,
|
|
31
32
|
monthWidth: monthWidth,
|