@pushwoosh/dumb-components 4.0.0 → 4.1.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.
@@ -27,10 +27,12 @@ export const CalendarSuperForm = props => {
27
27
  gap,
28
28
  firstDayOfWeek,
29
29
  initialVisibleMonth,
30
- footerContent
30
+ footerContent,
31
+ limitHint
31
32
  } = props;
32
33
  const isRangePicker = mode === 'range-date' || mode === 'range-datetime';
33
34
  const withTime = mode === 'single-datetime' || mode === 'range-datetime';
35
+ const notice = limitHint ?? (maxDays && maxDays > 0 ? `Max length: ${maxDays} days` : undefined);
34
36
  return _jsx(Vertical, {
35
37
  "$gap": 8,
36
38
  children: _jsx(CalendarRangePicker, {
@@ -87,17 +89,17 @@ export const CalendarSuperForm = props => {
87
89
  visibleCount: visibleCount !== undefined ? visibleCount : isRangePicker ? 2 : 1,
88
90
  monthWidth: monthWidth,
89
91
  gap: gap,
90
- renderAfter: withTime || maxDays && maxDays > 0 || footerContent ? () => {
92
+ renderAfter: withTime || notice || footerContent ? () => {
91
93
  return _jsxs(Vertical, {
92
94
  "$gap": 8,
93
95
  "$margin": {
94
96
  top: 16
95
97
  },
96
98
  children: [_jsxs(Vertical, {
97
- children: [maxDays && maxDays > 0 && _jsx(Text, {
99
+ children: [notice && _jsx(Text, {
98
100
  "$variant": "footnote",
99
101
  "$color": Color.LOCKED,
100
- children: `Max length: ${maxDays} days`
102
+ children: notice
101
103
  }), footerContent]
102
104
  }), withTime && timezone && onChangeTimezone && _jsx(CalendarTimeAndTimezoneSection, {
103
105
  isRangePicker: isRangePicker,
@@ -18,6 +18,8 @@ interface BaseProps {
18
18
  initialVisibleMonth?: DateStruct;
19
19
  /** Custom footer node rendered below the calendar and the min/max-days notice. */
20
20
  footerContent?: ReactNode;
21
+ /** Replaces the default `Max length: N days` notice, e.g. `Limitation: last 12 months | Max length: 3 months`. */
22
+ limitHint?: ReactNode;
21
23
  }
22
24
  /** Selection mode of {@link CalendarSuperForm}: single vs range, date-only vs date-time. */
23
25
  export type CalendarMode = 'single-date' | 'single-datetime' | 'range-date' | 'range-datetime';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",