@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.
Files changed (144) hide show
  1. package/AccessForbidden/AccessForbidden.js +17 -11
  2. package/Alert/Alert.d.ts +1 -2
  3. package/Alert/Alert.js +31 -25
  4. package/ApplicationPreloader/ApplicationPreloader.d.ts +1 -2
  5. package/ApplicationPreloader/ApplicationPreloader.js +5 -4
  6. package/Badge/Badge.js +2 -2
  7. package/Banner/Banner.js +40 -24
  8. package/Button/Button.js +20 -9
  9. package/Button/RemoveButton.js +7 -6
  10. package/Calendar/CalendarDropdown/CalendarDropdown.js +121 -108
  11. package/Calendar/CalendarMonth/CalendarMonth.js +68 -66
  12. package/Calendar/CalendarMonthSlider/CalendarMonthSlider.d.ts +2 -2
  13. package/Calendar/CalendarMonthSlider/CalendarMonthSlider.js +68 -55
  14. package/Calendar/CalendarSuperForm/CalendarSuperForm.js +75 -70
  15. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.d.ts +2 -2
  16. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +3 -2
  17. package/Calendar/CalendarSuperForm/components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection.js +106 -88
  18. package/Calendar/CalendarSuperForm/components/CalendarTimeInput.d.ts +1 -2
  19. package/Calendar/CalendarSuperForm/components/CalendarTimeInput.js +2 -2
  20. package/Calendar/CalendarSuperForm/components/CalendarTimezoneSelect.js +3 -2
  21. package/CardMetric/CardChildren.js +9 -6
  22. package/CardMetric/CardCollapse.js +8 -6
  23. package/CardMetric/CardMetric.js +52 -33
  24. package/Checkbox/Checkbox.js +30 -24
  25. package/Chip/Chip.d.ts +6 -7
  26. package/Chip/Chip.js +22 -15
  27. package/CodeEditor/CodeEditor.d.ts +1 -2
  28. package/CodeEditor/CodeEditor.js +2 -2
  29. package/CrashScreen/CrashScreen.js +18 -10
  30. package/DateTimePicker/components/AutosizeInput/AutosizeInput.js +17 -13
  31. package/DateTimePicker/components/DatePicker/DatePicker.js +35 -32
  32. package/DateTimePicker/components/DatePickerField/DatePickerField.js +31 -24
  33. package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +22 -20
  34. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +29 -24
  35. package/DateTimePicker/components/DecadeView/DecadeView.js +19 -17
  36. package/DateTimePicker/components/Input/Input.js +2 -2
  37. package/DateTimePicker/components/Month/Month.js +51 -35
  38. package/DateTimePicker/components/MonthView/MonthView.js +21 -17
  39. package/DateTimePicker/components/NumberPicker/NumberPicker.js +49 -40
  40. package/DateTimePicker/components/PickerPlate/PickerPlate.js +17 -14
  41. package/DateTimePicker/components/YearView/YearView.js +22 -18
  42. package/Drawer/components/Drawer/Drawer.js +18 -13
  43. package/Drawer/components/Drawer/styles.d.ts +2 -2
  44. package/Drawer/components/Drawer/styles.js +5 -4
  45. package/Drawer/components/DrawerDocs/DrawerDocs.js +25 -20
  46. package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +28 -24
  47. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -6
  48. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +6 -4
  49. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +13 -10
  50. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +40 -31
  51. package/EditableField/EditableField.js +55 -43
  52. package/EmailTemplatePreview/EmailTemplatePreview.js +10 -8
  53. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +28 -22
  54. package/EnhancedInput/EnhancedInput.d.ts +3 -4
  55. package/EnhancedInput/EnhancedInput.js +14 -10
  56. package/EnhancedInput/SearchInput.js +3 -3
  57. package/ExportResult/ExportResult.js +33 -23
  58. package/ExternalImagePreview/ExternalImagePreview.js +24 -20
  59. package/FieldBox/FieldBox.js +50 -37
  60. package/FrequencyCapping/FrequencyCappingEdit.js +41 -33
  61. package/FrequencyCapping/FrequencyCappingInApps.js +41 -33
  62. package/FrequencyCapping/FrequencyCappingReadonly.d.ts +1 -2
  63. package/FrequencyCapping/FrequencyCappingReadonly.js +24 -20
  64. package/FrequencyCapping/components/Condition/index.d.ts +1 -2
  65. package/FrequencyCapping/components/Condition/index.js +24 -20
  66. package/FrequencyCapping/components/Description/index.d.ts +2 -2
  67. package/FrequencyCapping/components/Description/index.js +7 -5
  68. package/FrequencyCapping/components/Settings/EditCappingSettings.js +28 -20
  69. package/FrequencyCapping/components/Settings/EditInAppCappingSettings.js +86 -71
  70. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +1 -2
  71. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +41 -32
  72. package/GetStartedPage/GetStartedPage.js +44 -25
  73. package/InputFile/InputFile.js +44 -35
  74. package/Link/Link.js +2 -2
  75. package/Modal/components/Modal/Modal.js +17 -12
  76. package/Modal/components/Modal/styles.js +5 -4
  77. package/Modal/components/ModalConfirm/ModalConfirm.js +33 -19
  78. package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +2 -2
  79. package/Modal/components/ModalConfirm/ModalConfirmProvider.js +8 -6
  80. package/Modal/components/ModalTitle/ModalTitle.js +10 -8
  81. package/NotificationInbox/NotificationBar.js +19 -11
  82. package/NotificationInbox/NotificationBell.js +15 -12
  83. package/NotificationInbox/NotificationInbox.js +159 -118
  84. package/NumberPicker/NumberPicker.js +53 -44
  85. package/NumberPicker/components/AutosizeInput/AutosizeInput.js +19 -15
  86. package/PageHeader/components/AutosizeInput/AutosizeInput.js +30 -22
  87. package/PageHeader/components/PageHeader/PageHeader.js +44 -27
  88. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +51 -34
  89. package/PageHeader/components/PageHeaderError/PageHeaderError.js +17 -10
  90. package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.js +20 -16
  91. package/Pagination/Pagination.js +60 -49
  92. package/Popover/Popover.js +6 -5
  93. package/ProgressBar/ProgressBar.js +25 -10
  94. package/PushPreview/PushPreview.js +30 -22
  95. package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +22 -15
  96. package/PushPreview/components/SilentPushPreview/SilentPushPreview.js +20 -13
  97. package/Radio/Radio.js +32 -26
  98. package/RadioCard/RadioCard.js +17 -9
  99. package/ReCaptcha/ReCaptcha.js +2 -2
  100. package/RichMessageEditor/EditorEmojiPicker.js +9 -7
  101. package/RichMessageEditor/RichMessageEditor.js +77 -67
  102. package/RichMessageEditor/RichMessageViewer.js +19 -13
  103. package/RichMessageEditor/slate/DynamicContentElement.d.ts +1 -2
  104. package/RichMessageEditor/slate/DynamicContentElement.js +13 -9
  105. package/RichMessageEditor/slate/SlateEditor.js +9 -7
  106. package/RichmediaPreview/RichmediaPreview.js +13 -11
  107. package/Select/Select.js +10 -8
  108. package/SendRate/SendRateEdit.d.ts +1 -2
  109. package/SendRate/SendRateEdit.js +42 -34
  110. package/SendRate/SendRateReadonly.d.ts +1 -2
  111. package/SendRate/SendRateReadonly.js +24 -20
  112. package/SendRate/components/Condition/index.d.ts +1 -2
  113. package/SendRate/components/Condition/index.js +15 -13
  114. package/SendRate/components/Description/index.d.ts +2 -2
  115. package/SendRate/components/Description/index.js +30 -22
  116. package/SendRate/components/Settings/index.d.ts +1 -2
  117. package/SendRate/components/Settings/index.js +20 -14
  118. package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +1 -2
  119. package/SendRate/helpers/getReadonlySendRateHelpers.js +39 -30
  120. package/Skeleton/TextSkeleton.js +5 -4
  121. package/SortButton/SortButton.js +11 -7
  122. package/Spinner/Spinner.js +7 -4
  123. package/StatisticCard/StatisticCard.js +44 -29
  124. package/Switch/Switch.js +16 -13
  125. package/Tabs/components/Tab/Tab.d.ts +3 -4
  126. package/Tabs/components/Tab/Tab.js +6 -4
  127. package/Tabs/components/TabBar/TabBar.d.ts +3 -4
  128. package/Tabs/components/TabBar/TabBar.js +12 -4
  129. package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.d.ts +1 -2
  130. package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.js +27 -21
  131. package/Tabs/components/TabBase/TabBase.d.ts +3 -4
  132. package/Tabs/components/TabBase/TabBase.js +11 -6
  133. package/Tabs/components/TabPanel/TabPanel.js +4 -2
  134. package/Tabs/components/Tabs/Tabs.js +8 -4
  135. package/Toast/Toast.js +31 -18
  136. package/Toast/ToastProvider.d.ts +2 -3
  137. package/Toast/ToastProvider.js +10 -8
  138. package/Tooltip/Tooltip.js +2 -2
  139. package/Tooltip/TooltipTrigger.js +13 -11
  140. package/package.json +2 -2
  141. package/polyglot/__tests__/render.test.js +46 -16
  142. package/polyglot/liquid/render.d.ts +2 -2
  143. package/polyglot/liquid/render.js +7 -6
  144. package/polyglot/react.js +7 -5
@@ -1,4 +1,5 @@
1
- import React, { useState, useEffect } from 'react';
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 React.createElement(CalendarBox, {
27
- "$disabled": isDisabled
28
- }, view === 'month' && React.createElement(Vertical, {
29
- "$gap": 16
30
- }, React.createElement(MonthView, {
31
- month: month,
32
- activeDay: value ? format(value, 'year-month-day') : undefined,
33
- userInputDay: userInputDay,
34
- minDate: minDate,
35
- maxDate: maxDate,
36
- onChange: setMonth,
37
- onDaySelect: onChange,
38
- onShowYear: () => setView('year'),
39
- onShowDecade: () => setView('decade')
40
- }), slotAfterMonth && slotAfterMonth()), view === 'year' && React.createElement(YearView, {
41
- year: format(month, 'year'),
42
- activeDay: value ? format(value, 'year-month-day') : undefined,
43
- onChange: setMonth,
44
- onSelect: newMon => {
45
- setMonth(newMon);
46
- setView('month');
47
- }
48
- }), view === 'decade' && React.createElement(DecadeView, {
49
- value: format(month, 'year'),
50
- activeDay: value ? format(value, 'year-month-day') : undefined,
51
- onChange: setMonth,
52
- onSelect: newYear => {
53
- setMonth(newYear);
54
- setView('year');
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 React, { useState, useEffect } from 'react';
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 React.createElement(React.Fragment, null, React.createElement(InputFrame, {
52
- ref: refs.setReference,
53
- "$gap": 8,
54
- "$error": error,
55
- "$empty": !value,
56
- onClick: () => setShowPicker(!showPicker)
57
- }, React.createElement(CalendarIcon, {
58
- size: "medium",
59
- view: "lined"
60
- }), value ? React.createElement(React.Fragment, null, format(value, 'day '), monthName(get(value, 'month'), 'long'), format(value, ' year')) : React.createElement(Lang, {
61
- message: "DUMB.DATE_TIME_PICKER.SELECT_DATE"
62
- })), showPicker && React.createElement("div", {
63
- ref: refs.setFloating,
64
- style: {
65
- ...floatingStyles,
66
- zIndex
67
- }
68
- }, React.createElement(DatePicker, {
69
- value: value,
70
- minDate: minDate,
71
- maxDate: maxDate,
72
- onChange: onSelect
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 React from 'react';
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 React.createElement(DatePicker, {
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: () => React.createElement(Collapse, {
39
- expanded: !!value
40
- }, React.createElement(Horizontal, {
41
- "$padding": "0 16px",
42
- "$gap": 8
43
- }, React.createElement(NumberPicker, {
44
- placeholder: "00",
45
- value: date.getUTCHours(),
46
- onChange: handleChangeHour
47
- }), React.createElement(NumberPicker, {
48
- placeholder: "00",
49
- value: date.getUTCMinutes(),
50
- onChange: handleChangeMinutes
51
- }), React.createElement(NumberPicker, {
52
- placeholder: "00",
53
- value: date.getUTCSeconds(),
54
- onChange: handleChangeSeconds
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 React, { useState, useEffect } from 'react';
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 React.createElement(React.Fragment, null, React.createElement(InputFrame, {
59
- ref: refs.setReference,
60
- "$empty": !value,
61
- "$error": error,
62
- "$gap": 8,
63
- onClick: () => setShowPicker(!showPicker)
64
- }, React.createElement(CalendarIcon, {
65
- size: "medium",
66
- view: "lined"
67
- }), value ? `${day} ${month} ${year} ${hours}:${minutes}` : React.createElement(Lang, {
68
- message: "DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME"
69
- })), showPicker && React.createElement("div", {
70
- ref: refs.setFloating,
71
- style: {
72
- ...floatingStyles,
73
- zIndex
74
- }
75
- }, React.createElement(DateTimePicker, {
76
- value: value,
77
- minDate: minDate,
78
- maxDate: maxDate,
79
- onChange: onSelect
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 React from 'react';
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 React.createElement(PickerPlate, {
16
+ return _jsx(PickerPlate, {
17
17
  onPrev: () => onChange(format(addPeriod(value, 'year', -12), 'year')),
18
- onNext: () => onChange(format(addPeriod(value, 'year', 12), 'year'))
19
- }, React.createElement(Columns, {
20
- "$sizes": 4,
21
- "$gap": 4
22
- }, Array.from({
23
- length: 12
24
- }).map((_, i) => {
25
- const year = firstYear + i;
26
- return React.createElement(CellBox, {
27
- key: year,
28
- height: "59px",
29
- "$isActive": year === activeDayYear,
30
- onClick: () => onSelect(format(setPeriod(value, 'year', year), 'year'))
31
- }, year);
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 React from 'react';
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 React.createElement(InputStyled, {
9
+ return _jsx(InputStyled, {
10
10
  type: "text",
11
11
  disabled: isDisabled,
12
12
  style: {
@@ -1,4 +1,5 @@
1
- import React, { useMemo } from 'react';
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 React.createElement(Columns, {
28
+ return _jsxs(Columns, {
28
29
  "$sizes": 7,
29
- "$gap": 4
30
- }, React.createElement(DayHeader, null, React.createElement(Lang, {
31
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SUN"
32
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
33
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_MON"
34
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
35
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_TUE"
36
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
37
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_WED"
38
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
39
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_THU"
40
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
41
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_FRI"
42
- })), React.createElement(DayHeader, null, React.createElement(Lang, {
43
- message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SAT"
44
- })), Array.from({
45
- length: days
46
- }).map((_, i) => {
47
- const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
48
- const isDisabled = isInRange({
49
- value: curDay,
50
- minDate: minDate,
51
- maxDate: maxDate
52
- });
53
- return React.createElement(CellBox, {
54
- key: `${curDay}`,
55
- "$isActive": !!activeDay && isSamePeriod(curDay, activeDay, 'day'),
56
- "$isDisabled": isDisabled,
57
- "$secondary": !isSamePeriod(month, curDay, 'month'),
58
- "$secondActive": !!userInputDay && isSamePeriod(curDay, userInputDay, 'day'),
59
- onClick: () => onDaySelect(format(curDay, 'year-month-day'))
60
- }, curDay.getUTCDate());
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 React from 'react';
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 React.createElement(PickerPlate, {
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: React.createElement(Horizontal, {
23
- "$gap": 4
24
- }, React.createElement(DateInfo, {
25
- onClick: onShowYear
26
- }, monthName(+format(month, 'month'))), React.createElement(DateInfo, {
27
- onClick: onShowDecade
28
- }, format(month, 'year')))
29
- }, React.createElement(Month, {
30
- month: month,
31
- activeDay: activeDay,
32
- userInputDay: userInputDay,
33
- minDate: minDate,
34
- maxDate: maxDate,
35
- onDaySelect: onDaySelect
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 React, { useRef, useState, useEffect } from 'react';
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 React.createElement(SingleInputFrame, {
83
+ return _jsxs(SingleInputFrame, {
83
84
  ref: ref,
84
85
  "$hasHint": !!hint,
85
- "$isDisabled": isDisabled
86
- }, React.createElement(InputComponent, {
87
- value: localValue,
88
- placeholder: placeholder,
89
- isDisabled: isDisabled,
90
- onChange: handleChange,
91
- onKeyDown: handleKeyDown,
92
- onKeyUp: resetAutoDiff,
93
- onBlur: event => {
94
- let blurValue = intVal(event.target.value);
95
- const minValueValid = minValue === undefined || blurValue >= minValue;
96
- const maxValueValid = maxValue === undefined || blurValue <= maxValue;
97
- if (!maxValueValid) {
98
- blurValue = maxValue;
99
- } else if (!minValueValid) {
100
- blurValue = minValue;
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
- onChange(blurValue);
103
- setLocalValue(blurValue.toString());
104
- }
105
- }), hint && React.createElement(Hint, null, hint), React.createElement(Vertical, {
106
- "$gap": 1
107
- }, React.createElement("div", null, React.createElement(ChevronIcon, {
108
- direction: "up",
109
- size: "small",
110
- "aria-disabled": "true",
111
- onClick: () => onChangeDiff(step),
112
- onMouseDown: () => setAutoDiff(step),
113
- onMouseUp: resetAutoDiff,
114
- onMouseLeave: resetAutoDiff
115
- })), React.createElement("div", null, React.createElement(ChevronIcon, {
116
- size: "small",
117
- direction: "down",
118
- "aria-disabled": isDisabled,
119
- onClick: () => onChangeDiff(-1 * step),
120
- onMouseDown: () => setAutoDiff(-1 * step),
121
- onMouseUp: resetAutoDiff,
122
- onMouseLeave: resetAutoDiff
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 React from 'react';
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 React.createElement(Vertical, {
12
- "$gap": 16
13
- }, React.createElement(Horizontal, {
14
- "$justifyContent": "space-between"
15
- }, slot, React.createElement(Horizontal, {
16
- "$gap": 4
17
- }, React.createElement(Arrow, {
18
- direction: "left",
19
- onClick: onPrev
20
- }), React.createElement(Arrow, {
21
- direction: "right",
22
- onClick: onNext
23
- }))), children);
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
  }