@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 { useState, useEffect } from 'react';
|
|
2
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
3
4
|
import { format } from '../../helpers';
|
|
4
5
|
import { CalendarBox } from '../../styles';
|
|
@@ -23,35 +24,37 @@ export function DatePicker(props) {
|
|
|
23
24
|
setView('month');
|
|
24
25
|
}
|
|
25
26
|
}, [userInputDay]);
|
|
26
|
-
return
|
|
27
|
-
"$disabled": isDisabled
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
return _jsxs(CalendarBox, {
|
|
28
|
+
"$disabled": isDisabled,
|
|
29
|
+
children: [view === 'month' && _jsxs(Vertical, {
|
|
30
|
+
"$gap": 16,
|
|
31
|
+
children: [_jsx(MonthView, {
|
|
32
|
+
month: month,
|
|
33
|
+
activeDay: value ? format(value, 'year-month-day') : undefined,
|
|
34
|
+
userInputDay: userInputDay,
|
|
35
|
+
minDate: minDate,
|
|
36
|
+
maxDate: maxDate,
|
|
37
|
+
onChange: setMonth,
|
|
38
|
+
onDaySelect: onChange,
|
|
39
|
+
onShowYear: () => setView('year'),
|
|
40
|
+
onShowDecade: () => setView('decade')
|
|
41
|
+
}), slotAfterMonth && slotAfterMonth()]
|
|
42
|
+
}), view === 'year' && _jsx(YearView, {
|
|
43
|
+
year: format(month, 'year'),
|
|
44
|
+
activeDay: value ? format(value, 'year-month-day') : undefined,
|
|
45
|
+
onChange: setMonth,
|
|
46
|
+
onSelect: newMon => {
|
|
47
|
+
setMonth(newMon);
|
|
48
|
+
setView('month');
|
|
49
|
+
}
|
|
50
|
+
}), view === 'decade' && _jsx(DecadeView, {
|
|
51
|
+
value: format(month, 'year'),
|
|
52
|
+
activeDay: value ? format(value, 'year-month-day') : undefined,
|
|
53
|
+
onChange: setMonth,
|
|
54
|
+
onSelect: newYear => {
|
|
55
|
+
setMonth(newYear);
|
|
56
|
+
setView('year');
|
|
57
|
+
}
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
57
60
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { useFloating, offset, autoPlacement } from '@floating-ui/react-dom';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
4
5
|
import { format, monthName, get } from '../../helpers';
|
|
5
6
|
import { Lang } from '../../polyglot';
|
|
@@ -48,27 +49,33 @@ export function DatePickerField(props) {
|
|
|
48
49
|
setShowPicker(false);
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
return _jsxs(_Fragment, {
|
|
53
|
+
children: [_jsxs(InputFrame, {
|
|
54
|
+
ref: refs.setReference,
|
|
55
|
+
"$gap": 8,
|
|
56
|
+
"$error": error,
|
|
57
|
+
"$empty": !value,
|
|
58
|
+
onClick: () => setShowPicker(!showPicker),
|
|
59
|
+
children: [_jsx(CalendarIcon, {
|
|
60
|
+
size: "medium",
|
|
61
|
+
view: "lined"
|
|
62
|
+
}), value ? _jsxs(_Fragment, {
|
|
63
|
+
children: [format(value, 'day '), monthName(get(value, 'month'), 'long'), format(value, ' year')]
|
|
64
|
+
}) : _jsx(Lang, {
|
|
65
|
+
message: "DUMB.DATE_TIME_PICKER.SELECT_DATE"
|
|
66
|
+
})]
|
|
67
|
+
}), showPicker && _jsx("div", {
|
|
68
|
+
ref: refs.setFloating,
|
|
69
|
+
style: {
|
|
70
|
+
...floatingStyles,
|
|
71
|
+
zIndex
|
|
72
|
+
},
|
|
73
|
+
children: _jsx(DatePicker, {
|
|
74
|
+
value: value,
|
|
75
|
+
minDate: minDate,
|
|
76
|
+
maxDate: maxDate,
|
|
77
|
+
onChange: onSelect
|
|
78
|
+
})
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
74
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Collapse, Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { format, createUTCDate } from '../../helpers';
|
|
4
4
|
import { DatePicker } from '../DatePicker';
|
|
@@ -29,29 +29,31 @@ export function DateTimePicker(props) {
|
|
|
29
29
|
date.setUTCSeconds(seconds);
|
|
30
30
|
onChange(date.toUTCString());
|
|
31
31
|
};
|
|
32
|
-
return
|
|
32
|
+
return _jsx(DatePicker, {
|
|
33
33
|
value: format(date, 'year-month-dayThour:minute:second'),
|
|
34
34
|
userInputDay: userInputDay,
|
|
35
35
|
minDate: minDate,
|
|
36
36
|
maxDate: maxDate,
|
|
37
37
|
onChange: handleChange,
|
|
38
|
-
slotAfterMonth: () =>
|
|
39
|
-
expanded: !!value
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
slotAfterMonth: () => _jsx(Collapse, {
|
|
39
|
+
expanded: !!value,
|
|
40
|
+
children: _jsxs(Horizontal, {
|
|
41
|
+
"$padding": "0 16px",
|
|
42
|
+
"$gap": 8,
|
|
43
|
+
children: [_jsx(NumberPicker, {
|
|
44
|
+
placeholder: "00",
|
|
45
|
+
value: date.getUTCHours(),
|
|
46
|
+
onChange: handleChangeHour
|
|
47
|
+
}), _jsx(NumberPicker, {
|
|
48
|
+
placeholder: "00",
|
|
49
|
+
value: date.getUTCMinutes(),
|
|
50
|
+
onChange: handleChangeMinutes
|
|
51
|
+
}), _jsx(NumberPicker, {
|
|
52
|
+
placeholder: "00",
|
|
53
|
+
value: date.getUTCSeconds(),
|
|
54
|
+
onChange: handleChangeSeconds
|
|
55
|
+
})]
|
|
56
|
+
})
|
|
57
|
+
})
|
|
56
58
|
});
|
|
57
59
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { useFloating, offset, autoPlacement } from '@floating-ui/react-dom';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
4
5
|
import { useUTCDate } from './helpers';
|
|
5
6
|
import { Lang } from '../../polyglot';
|
|
@@ -55,27 +56,31 @@ export function DateTimePickerField(props) {
|
|
|
55
56
|
hours,
|
|
56
57
|
minutes
|
|
57
58
|
} = useUTCDate(value);
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
return _jsxs(_Fragment, {
|
|
60
|
+
children: [_jsxs(InputFrame, {
|
|
61
|
+
ref: refs.setReference,
|
|
62
|
+
"$empty": !value,
|
|
63
|
+
"$error": error,
|
|
64
|
+
"$gap": 8,
|
|
65
|
+
onClick: () => setShowPicker(!showPicker),
|
|
66
|
+
children: [_jsx(CalendarIcon, {
|
|
67
|
+
size: "medium",
|
|
68
|
+
view: "lined"
|
|
69
|
+
}), value ? `${day} ${month} ${year} ${hours}:${minutes}` : _jsx(Lang, {
|
|
70
|
+
message: "DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME"
|
|
71
|
+
})]
|
|
72
|
+
}), showPicker && _jsx("div", {
|
|
73
|
+
ref: refs.setFloating,
|
|
74
|
+
style: {
|
|
75
|
+
...floatingStyles,
|
|
76
|
+
zIndex
|
|
77
|
+
},
|
|
78
|
+
children: _jsx(DateTimePicker, {
|
|
79
|
+
value: value,
|
|
80
|
+
minDate: minDate,
|
|
81
|
+
maxDate: maxDate,
|
|
82
|
+
onChange: onSelect
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
81
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Columns } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { format, parseStringToArray, addPeriod, setPeriod } from '../../helpers';
|
|
4
4
|
import { CellBox } from '../../styles';
|
|
@@ -13,21 +13,23 @@ export function DecadeView(props) {
|
|
|
13
13
|
const [activeDayYear] = parseStringToArray(activeDay || '');
|
|
14
14
|
const valueYear = +value;
|
|
15
15
|
const firstYear = valueYear - valueYear % 12;
|
|
16
|
-
return
|
|
16
|
+
return _jsx(PickerPlate, {
|
|
17
17
|
onPrev: () => onChange(format(addPeriod(value, 'year', -12), 'year')),
|
|
18
|
-
onNext: () => onChange(format(addPeriod(value, 'year', 12), 'year'))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
onNext: () => onChange(format(addPeriod(value, 'year', 12), 'year')),
|
|
19
|
+
children: _jsx(Columns, {
|
|
20
|
+
"$sizes": 4,
|
|
21
|
+
"$gap": 4,
|
|
22
|
+
children: Array.from({
|
|
23
|
+
length: 12
|
|
24
|
+
}).map((_, i) => {
|
|
25
|
+
const year = firstYear + i;
|
|
26
|
+
return _jsx(CellBox, {
|
|
27
|
+
height: "59px",
|
|
28
|
+
"$isActive": year === activeDayYear,
|
|
29
|
+
onClick: () => onSelect(format(setPeriod(value, 'year', year), 'year')),
|
|
30
|
+
children: year
|
|
31
|
+
}, year);
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
});
|
|
33
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InputStyled } from './styles';
|
|
3
3
|
export function Input(props) {
|
|
4
4
|
const {
|
|
@@ -6,7 +6,7 @@ export function Input(props) {
|
|
|
6
6
|
isDisabled,
|
|
7
7
|
...rest
|
|
8
8
|
} = props;
|
|
9
|
-
return
|
|
9
|
+
return _jsx(InputStyled, {
|
|
10
10
|
type: "text",
|
|
11
11
|
disabled: isDisabled,
|
|
12
12
|
style: {
|
|
@@ -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 { format, firstDayOfWeek, parseStringToDate, differenceInDays, isSamePeriod, isInRange } from '../../helpers';
|
|
4
5
|
import { Lang } from '../../polyglot';
|
|
@@ -24,39 +25,54 @@ export function Month(props) {
|
|
|
24
25
|
const daysInCalendar = differenceInDays(firstDayOfLastWeek, firstDayOfFirstWeek) + 7;
|
|
25
26
|
return [firstDayOfFirstWeek, daysInCalendar];
|
|
26
27
|
}, [month]);
|
|
27
|
-
return
|
|
28
|
+
return _jsxs(Columns, {
|
|
28
29
|
"$sizes": 7,
|
|
29
|
-
"$gap": 4
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
30
|
+
"$gap": 4,
|
|
31
|
+
children: [_jsx(DayHeader, {
|
|
32
|
+
children: _jsx(Lang, {
|
|
33
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SUN"
|
|
34
|
+
})
|
|
35
|
+
}), _jsx(DayHeader, {
|
|
36
|
+
children: _jsx(Lang, {
|
|
37
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_MON"
|
|
38
|
+
})
|
|
39
|
+
}), _jsx(DayHeader, {
|
|
40
|
+
children: _jsx(Lang, {
|
|
41
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_TUE"
|
|
42
|
+
})
|
|
43
|
+
}), _jsx(DayHeader, {
|
|
44
|
+
children: _jsx(Lang, {
|
|
45
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_WED"
|
|
46
|
+
})
|
|
47
|
+
}), _jsx(DayHeader, {
|
|
48
|
+
children: _jsx(Lang, {
|
|
49
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_THU"
|
|
50
|
+
})
|
|
51
|
+
}), _jsx(DayHeader, {
|
|
52
|
+
children: _jsx(Lang, {
|
|
53
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_FRI"
|
|
54
|
+
})
|
|
55
|
+
}), _jsx(DayHeader, {
|
|
56
|
+
children: _jsx(Lang, {
|
|
57
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SAT"
|
|
58
|
+
})
|
|
59
|
+
}), Array.from({
|
|
60
|
+
length: days
|
|
61
|
+
}).map((_, i) => {
|
|
62
|
+
const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
|
|
63
|
+
const isDisabled = isInRange({
|
|
64
|
+
value: curDay,
|
|
65
|
+
minDate: minDate,
|
|
66
|
+
maxDate: maxDate
|
|
67
|
+
});
|
|
68
|
+
return _jsx(CellBox, {
|
|
69
|
+
"$isActive": !!activeDay && isSamePeriod(curDay, activeDay, 'day'),
|
|
70
|
+
"$isDisabled": isDisabled,
|
|
71
|
+
"$secondary": !isSamePeriod(month, curDay, 'month'),
|
|
72
|
+
"$secondActive": !!userInputDay && isSamePeriod(curDay, userInputDay, 'day'),
|
|
73
|
+
onClick: () => onDaySelect(format(curDay, 'year-month-day')),
|
|
74
|
+
children: curDay.getUTCDate()
|
|
75
|
+
}, `${curDay}`);
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
62
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { addPeriod, format, monthName } from '../../helpers';
|
|
4
4
|
import { DateInfo } from '../../styles';
|
|
@@ -16,22 +16,26 @@ export function MonthView(props) {
|
|
|
16
16
|
onShowDecade,
|
|
17
17
|
onChange
|
|
18
18
|
} = props;
|
|
19
|
-
return
|
|
19
|
+
return _jsx(PickerPlate, {
|
|
20
20
|
onPrev: () => onChange(format(addPeriod(month, 'month', -1), 'year-month')),
|
|
21
21
|
onNext: () => onChange(format(addPeriod(month, 'month', 1), 'year-month')),
|
|
22
|
-
slot:
|
|
23
|
-
"$gap": 4
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
slot: _jsxs(Horizontal, {
|
|
23
|
+
"$gap": 4,
|
|
24
|
+
children: [_jsx(DateInfo, {
|
|
25
|
+
onClick: onShowYear,
|
|
26
|
+
children: monthName(+format(month, 'month'))
|
|
27
|
+
}), _jsx(DateInfo, {
|
|
28
|
+
onClick: onShowDecade,
|
|
29
|
+
children: format(month, 'year')
|
|
30
|
+
})]
|
|
31
|
+
}),
|
|
32
|
+
children: _jsx(Month, {
|
|
33
|
+
month: month,
|
|
34
|
+
activeDay: activeDay,
|
|
35
|
+
userInputDay: userInputDay,
|
|
36
|
+
minDate: minDate,
|
|
37
|
+
maxDate: maxDate,
|
|
38
|
+
onDaySelect: onDaySelect
|
|
39
|
+
})
|
|
40
|
+
});
|
|
37
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
2
3
|
import { Vertical, useMount, usePersistentFunction } from '@pushwoosh/kit-helpers';
|
|
3
4
|
import { ChevronIcon } from '@pushwoosh/kit-icons';
|
|
4
5
|
import { intVal, isStringInteger } from './helpers';
|
|
@@ -79,46 +80,54 @@ export function NumberPicker({
|
|
|
79
80
|
};
|
|
80
81
|
const resetAutoDiff = () => setAutoDiff(0);
|
|
81
82
|
const InputComponent = autoSize ? AutosizeInput : Input;
|
|
82
|
-
return
|
|
83
|
+
return _jsxs(SingleInputFrame, {
|
|
83
84
|
ref: ref,
|
|
84
85
|
"$hasHint": !!hint,
|
|
85
|
-
"$isDisabled": isDisabled
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
"$isDisabled": isDisabled,
|
|
87
|
+
children: [_jsx(InputComponent, {
|
|
88
|
+
value: localValue,
|
|
89
|
+
placeholder: placeholder,
|
|
90
|
+
isDisabled: isDisabled,
|
|
91
|
+
onChange: handleChange,
|
|
92
|
+
onKeyDown: handleKeyDown,
|
|
93
|
+
onKeyUp: resetAutoDiff,
|
|
94
|
+
onBlur: event => {
|
|
95
|
+
let blurValue = intVal(event.target.value);
|
|
96
|
+
const minValueValid = minValue === undefined || blurValue >= minValue;
|
|
97
|
+
const maxValueValid = maxValue === undefined || blurValue <= maxValue;
|
|
98
|
+
if (!maxValueValid) {
|
|
99
|
+
blurValue = maxValue;
|
|
100
|
+
} else if (!minValueValid) {
|
|
101
|
+
blurValue = minValue;
|
|
102
|
+
}
|
|
103
|
+
onChange(blurValue);
|
|
104
|
+
setLocalValue(blurValue.toString());
|
|
101
105
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
106
|
+
}), hint && _jsx(Hint, {
|
|
107
|
+
children: hint
|
|
108
|
+
}), _jsxs(Vertical, {
|
|
109
|
+
"$gap": 1,
|
|
110
|
+
children: [_jsx("div", {
|
|
111
|
+
children: _jsx(ChevronIcon, {
|
|
112
|
+
direction: "up",
|
|
113
|
+
size: "small",
|
|
114
|
+
"aria-disabled": "true",
|
|
115
|
+
onClick: () => onChangeDiff(step),
|
|
116
|
+
onMouseDown: () => setAutoDiff(step),
|
|
117
|
+
onMouseUp: resetAutoDiff,
|
|
118
|
+
onMouseLeave: resetAutoDiff
|
|
119
|
+
})
|
|
120
|
+
}), _jsx("div", {
|
|
121
|
+
children: _jsx(ChevronIcon, {
|
|
122
|
+
size: "small",
|
|
123
|
+
direction: "down",
|
|
124
|
+
"aria-disabled": isDisabled,
|
|
125
|
+
onClick: () => onChangeDiff(-1 * step),
|
|
126
|
+
onMouseDown: () => setAutoDiff(-1 * step),
|
|
127
|
+
onMouseUp: resetAutoDiff,
|
|
128
|
+
onMouseLeave: resetAutoDiff
|
|
129
|
+
})
|
|
130
|
+
})]
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
124
133
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Vertical, Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { Arrow } from './styles';
|
|
4
4
|
export function PickerPlate(props) {
|
|
@@ -8,17 +8,20 @@ export function PickerPlate(props) {
|
|
|
8
8
|
onPrev,
|
|
9
9
|
onNext
|
|
10
10
|
} = props;
|
|
11
|
-
return
|
|
12
|
-
"$gap": 16
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
return _jsxs(Vertical, {
|
|
12
|
+
"$gap": 16,
|
|
13
|
+
children: [_jsxs(Horizontal, {
|
|
14
|
+
"$justifyContent": "space-between",
|
|
15
|
+
children: [slot, _jsxs(Horizontal, {
|
|
16
|
+
"$gap": 4,
|
|
17
|
+
children: [_jsx(Arrow, {
|
|
18
|
+
direction: "left",
|
|
19
|
+
onClick: onPrev
|
|
20
|
+
}), _jsx(Arrow, {
|
|
21
|
+
direction: "right",
|
|
22
|
+
onClick: onNext
|
|
23
|
+
})]
|
|
24
|
+
})]
|
|
25
|
+
}), children]
|
|
26
|
+
});
|
|
24
27
|
}
|