@hero-design/rn 8.88.0 → 8.89.0-alpha.1

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 (37) hide show
  1. package/es/index.js +413 -44
  2. package/lib/index.js +414 -44
  3. package/package.json +3 -2
  4. package/src/components/Calendar/CalendarRange.tsx +337 -0
  5. package/src/components/Calendar/CalendarRangeConnector.tsx +68 -0
  6. package/src/components/Calendar/CalendarRowItem.tsx +14 -3
  7. package/src/components/Calendar/StyledCalendar.tsx +23 -9
  8. package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +284 -0
  9. package/src/components/Calendar/__tests__/CalendarRangeConnector.spec.tsx +73 -0
  10. package/src/components/Calendar/__tests__/__snapshots__/CalendarRangeConnector.spec.tsx.snap +632 -0
  11. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +45 -20
  12. package/src/components/Calendar/__tests__/helper.spec.ts +110 -1
  13. package/src/components/Calendar/helpers.ts +75 -0
  14. package/src/components/Calendar/index.tsx +19 -15
  15. package/src/components/RichTextEditor/RichTextEditor.tsx +14 -20
  16. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -4
  17. package/src/index.ts +2 -0
  18. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -4
  19. package/src/theme/components/calendar.ts +6 -1
  20. package/src/theme/global/colors/ehWorkDark.ts +59 -0
  21. package/src/theme/global/index.ts +2 -0
  22. package/src/theme/index.ts +2 -0
  23. package/src/types.ts +2 -0
  24. package/stats/8.88.0/rn-stats.html +0 -2
  25. package/types/components/Calendar/CalendarRange.d.ts +23 -0
  26. package/types/components/Calendar/CalendarRangeConnector.d.ts +11 -0
  27. package/types/components/Calendar/CalendarRowItem.d.ts +3 -1
  28. package/types/components/Calendar/StyledCalendar.d.ts +2 -1
  29. package/types/components/Calendar/helpers.d.ts +15 -0
  30. package/types/components/Calendar/index.d.ts +4 -2
  31. package/types/index.d.ts +2 -2
  32. package/types/theme/components/calendar.d.ts +5 -0
  33. package/types/theme/global/colors/ehWorkDark.d.ts +49 -0
  34. package/types/theme/global/index.d.ts +2 -1
  35. package/types/theme/index.d.ts +2 -2
  36. package/types/types.d.ts +2 -1
  37. package/.turbo/turbo-build.log +0 -13
package/es/index.js CHANGED
@@ -2062,6 +2062,64 @@ var eBensBrandSystemPallete = {
2062
2062
  };
2063
2063
  var eBensSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette$1), eBensBrandSystemPallete);
2064
2064
 
2065
+ var ehWorkDarkPalette = {
2066
+ black: '#000000',
2067
+ white: '#ffffff',
2068
+ // Surface
2069
+ defaultGlobalSurface: '#27272A',
2070
+ neutralGlobalSurface: '#121214',
2071
+ darkGlobalSurface: '#fcfbff',
2072
+ overlayGlobalSurface: '#ffffff',
2073
+ // On Surface
2074
+ onDefaultGlobalSurface: '#ffffff',
2075
+ mutedOnDefaultGlobalSurface: '#a9a9b2',
2076
+ inactiveOnDefaultGlobalSurface: '#71717a',
2077
+ disabledOnDefaultGlobalSurface: '#52525b',
2078
+ onDarkGlobalSurface: '#121214',
2079
+ // Outline:
2080
+ primaryOutline: '#a9a9b2',
2081
+ secondaryOutline: '#3f3f46',
2082
+ inactiveOutline: '#71717a',
2083
+ disabledOutline: '#52525b',
2084
+ // Archived:
2085
+ archivedSurface: '#52525b',
2086
+ mutedArchived: '#3f3f46',
2087
+ archived: '#71717a',
2088
+ onArchivedSurface: '#a9a9b2',
2089
+ // Error:
2090
+ errorSurface: '#7a1d06',
2091
+ mutedError: '#9b2508',
2092
+ error: '#bd2d09',
2093
+ onErrorSurface: '#fecfca',
2094
+ // Warning:
2095
+ warningSurface: '#963e03',
2096
+ mutedWarning: '#c35004',
2097
+ warning: '#dc6204',
2098
+ onWarningSurface: '#fff0d5',
2099
+ // Success:
2100
+ successSurface: '#00483e',
2101
+ mutedSuccess: '#016256',
2102
+ success: '#017d6d',
2103
+ onSuccessSurface: '#a7f3e9',
2104
+ // Info:
2105
+ infoSurface: '#004a61',
2106
+ mutedInfo: '#006585',
2107
+ info: '#007da3',
2108
+ onInfoSurface: '#a0e8ff',
2109
+ // Brand:
2110
+ primary: '#cdacfe',
2111
+ onPrimary: '#fdfbff',
2112
+ secondary: '#7622d7',
2113
+ onSecondary: '#ffffff',
2114
+ defaultSurface: '#fdfbff',
2115
+ highlightedSurface: '#460078',
2116
+ pressedSurface: '#9a58fc',
2117
+ decorativePrimary: '#fdfbff',
2118
+ decorativePrimarySurface: '#74409a',
2119
+ decorativeSecondary: '#fdfbff',
2120
+ decorativeSecondarySurface: '#f0e6ff'
2121
+ };
2122
+
2065
2123
  var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
2066
2124
  var horizontalScale = function horizontalScale(size) {
2067
2125
  if (Platform.OS === 'web') {
@@ -2628,9 +2686,13 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2628
2686
  background: theme.colors.defaultGlobalSurface,
2629
2687
  border: theme.colors.primaryOutline,
2630
2688
  primary: theme.colors.primary,
2631
- inverted: theme.colors.onDarkGlobalSurface
2689
+ inverted: theme.colors.onDarkGlobalSurface,
2690
+ rowItem: {
2691
+ selected: theme.colors.primary,
2692
+ highlighted: theme.colors.highlightedSurface
2693
+ }
2632
2694
  };
2633
- var cellSize = theme.sizes.xxxlarge;
2695
+ var cellSize = theme.sizes.xxxxlarge;
2634
2696
  var markSize = theme.sizes.xsmall;
2635
2697
  var sizes = {
2636
2698
  cellWidth: cellSize,
@@ -2645,7 +2707,8 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2645
2707
  headerVerticalPadding: theme.space.medium,
2646
2708
  headerHorizontalPadding: theme.space.smallMedium,
2647
2709
  headerMarginRight: theme.space.small,
2648
- iosPickerMarginVertical: theme.space['5xlarge']
2710
+ iosPickerMarginVertical: theme.space['5xlarge'],
2711
+ cellPadding: theme.space.xlarge
2649
2712
  };
2650
2713
  var radii = {
2651
2714
  "default": theme.radii.rounded
@@ -12859,17 +12922,18 @@ var StyledCalendarDayNameCell = index$a(View)(function (_ref3) {
12859
12922
  var StyledCalendarCell = index$a(TouchableOpacity)(function (_ref4) {
12860
12923
  var theme = _ref4.theme,
12861
12924
  _ref4$variant = _ref4.variant,
12862
- variant = _ref4$variant === void 0 ? 'default' : _ref4$variant,
12863
- themeItemWidth = _ref4.themeItemWidth;
12925
+ variant = _ref4$variant === void 0 ? 'default' : _ref4$variant;
12864
12926
  return {
12865
12927
  borderColor: theme.__hd__.calendar.colors.border,
12866
12928
  borderWidth: variant === 'current' ? 1 : 0,
12867
- borderRadius: theme.__hd__.calendar.radii["default"],
12929
+ borderRadius: variant === 'highlighted' ? undefined : theme.__hd__.calendar.radii["default"],
12868
12930
  alignItems: 'center',
12869
12931
  justifyContent: 'center',
12870
- backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.primary : undefined,
12871
- width: themeItemWidth || theme.__hd__.calendar.sizes.cellCircleWidth,
12872
- height: theme.__hd__.calendar.sizes.cellCircleHeight
12932
+ backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.rowItem.selected : 'transparent',
12933
+ width: '100%',
12934
+ height: '100%',
12935
+ maxWidth: theme.__hd__.calendar.sizes.cellWidth,
12936
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12873
12937
  };
12874
12938
  });
12875
12939
  var StyledCalendarRow = index$a(View)(function (_ref5) {
@@ -12877,18 +12941,24 @@ var StyledCalendarRow = index$a(View)(function (_ref5) {
12877
12941
  return {
12878
12942
  flexDirection: 'row',
12879
12943
  paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
12880
- flexWrap: 'wrap'
12944
+ flexWrap: 'wrap',
12945
+ justifyContent: 'center',
12946
+ alignItems: 'center'
12881
12947
  };
12882
12948
  });
12883
12949
  var StyledCalendarRowItem = index$a(View)(function (_ref6) {
12884
12950
  var theme = _ref6.theme,
12885
- themeItemWidth = _ref6.themeItemWidth;
12951
+ themeItemWidth = _ref6.themeItemWidth,
12952
+ isHighlighted = _ref6.isHighlighted;
12886
12953
  return {
12887
12954
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12955
+ lineHeight: 0,
12888
12956
  alignItems: 'center',
12889
12957
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12890
- height: theme.__hd__.calendar.sizes.cellHeight,
12891
- justifyContent: 'center'
12958
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12959
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight,
12960
+ justifyContent: 'center',
12961
+ backgroundColor: isHighlighted ? theme.__hd__.calendar.colors.rowItem.highlighted : undefined
12892
12962
  };
12893
12963
  });
12894
12964
  var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
@@ -12898,7 +12968,8 @@ var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
12898
12968
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12899
12969
  alignItems: 'center',
12900
12970
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12901
- height: theme.__hd__.calendar.sizes.cellHeight
12971
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12972
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12902
12973
  };
12903
12974
  });
12904
12975
  var StyledMark = index$a(View)(function (_ref8) {
@@ -12918,8 +12989,10 @@ var StyledMark = index$a(View)(function (_ref8) {
12918
12989
  var getCellVariant = function getCellVariant() {
12919
12990
  var isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12920
12991
  var isCurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12992
+ var isHighlighted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12921
12993
  if (isSelected) return 'selected';
12922
12994
  if (isCurrent) return 'current';
12995
+ if (isHighlighted) return 'highlighted';
12923
12996
  return 'default';
12924
12997
  };
12925
12998
  var CalendarRowItem = function CalendarRowItem(_ref) {
@@ -12931,12 +13004,14 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
12931
13004
  textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
12932
13005
  _ref$marked = _ref.marked,
12933
13006
  marked = _ref$marked === void 0 ? false : _ref$marked,
12934
- itemWidth = _ref.itemWidth;
13007
+ itemWidth = _ref.itemWidth,
13008
+ isHighlighted = _ref.isHighlighted;
12935
13009
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
12936
13010
  testID: "calendar-date-cell",
12937
- themeItemWidth: itemWidth
13011
+ themeItemWidth: itemWidth,
13012
+ isHighlighted: isHighlighted
12938
13013
  }, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
12939
- variant: getCellVariant(isSelected, isCurrent),
13014
+ variant: getCellVariant(isSelected, isCurrent, isHighlighted),
12940
13015
  onPress: onPress
12941
13016
  }, /*#__PURE__*/React__default.createElement(Typography.Body, {
12942
13017
  variant: "small",
@@ -12955,6 +13030,14 @@ var initArray = function initArray(length, func) {
12955
13030
  var isEqDate = function isEqDate(dateA, dateB) {
12956
13031
  return (dateA === null || dateA === void 0 ? void 0 : dateA.toDateString()) === (dateB === null || dateB === void 0 ? void 0 : dateB.toDateString());
12957
13032
  };
13033
+ var isDateInRange = function isDateInRange(_ref) {
13034
+ var date = _ref.date,
13035
+ range = _ref.range;
13036
+ if (!range || range.startDate === undefined || range.endDate === undefined) {
13037
+ return false;
13038
+ }
13039
+ return date >= range.startDate && date <= range.endDate;
13040
+ };
12958
13041
  var getValidDate = function getValidDate(date, minDate, maxDate) {
12959
13042
  if (minDate === undefined && maxDate === undefined) {
12960
13043
  return date;
@@ -12970,6 +13053,297 @@ var getValidDate = function getValidDate(date, minDate, maxDate) {
12970
13053
  }
12971
13054
  return undefined;
12972
13055
  };
13056
+ var setStartOrEndDate = function setStartOrEndDate(_ref2) {
13057
+ var date = _ref2.date,
13058
+ startDate = _ref2.startDate,
13059
+ endDate = _ref2.endDate;
13060
+ // Prevent selecting same date
13061
+ if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
13062
+ return {
13063
+ startDate: startDate,
13064
+ endDate: endDate
13065
+ };
13066
+ }
13067
+ // No start date yet - set as start
13068
+ if (!startDate) {
13069
+ return {
13070
+ startDate: date,
13071
+ endDate: undefined
13072
+ };
13073
+ }
13074
+ // Have start but no end - set as end and reorder if needed
13075
+ if (!endDate) {
13076
+ return date < startDate ? {
13077
+ startDate: date,
13078
+ endDate: startDate
13079
+ } : {
13080
+ startDate: startDate,
13081
+ endDate: date
13082
+ };
13083
+ }
13084
+ // Clicking within range - start new selection
13085
+ if (date >= startDate && date <= endDate) {
13086
+ return {
13087
+ startDate: date,
13088
+ endDate: undefined
13089
+ };
13090
+ }
13091
+ // Clicking outside range - extend range
13092
+ return date < startDate ? {
13093
+ startDate: date,
13094
+ endDate: endDate
13095
+ } : {
13096
+ startDate: startDate,
13097
+ endDate: date
13098
+ };
13099
+ };
13100
+
13101
+ var SelectedDate = function SelectedDate(_ref) {
13102
+ var date = _ref.date,
13103
+ onPress = _ref.onPress,
13104
+ marked = _ref.marked,
13105
+ isStart = _ref.isStart,
13106
+ showConnector = _ref.showConnector,
13107
+ itemWidth = _ref.itemWidth;
13108
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13109
+ themeItemWidth: itemWidth,
13110
+ testID: "calendar-date-cell"
13111
+ }, showConnector ? /*#__PURE__*/React__default.createElement(Box, {
13112
+ testID: "range-connector",
13113
+ style: _objectSpread2(_objectSpread2({
13114
+ width: '50%',
13115
+ height: '100%'
13116
+ }, StyleSheet$1.absoluteFillObject), {}, {
13117
+ transform: isStart ? [{
13118
+ translateX: itemWidth ? itemWidth / 2 : 0
13119
+ }] : undefined
13120
+ }),
13121
+ bgColor: "highlightedSurface"
13122
+ }) : null, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
13123
+ testID: "selected-date-cell",
13124
+ variant: "selected",
13125
+ onPress: onPress
13126
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13127
+ variant: "small",
13128
+ intent: "inverted"
13129
+ }, date ? date.getDate() : ''), marked ? /*#__PURE__*/React__default.createElement(StyledMark, {
13130
+ testID: "calendar-date-mark",
13131
+ variant: "inverted"
13132
+ }) : null));
13133
+ };
13134
+
13135
+ var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
13136
+ // Sunday first column => 0
13137
+ // Sunday last column => 1
13138
+ var WEEK_INDEX_OFFSET$1 = 1;
13139
+ var SUNDAY_INDEX$1 = 6;
13140
+ // Always render 7 rows x 6 items for consistent layout
13141
+ var TOTAL_DATES_ITEMS$1 = 7 * 6;
13142
+ var CalendarRange = function CalendarRange(_ref) {
13143
+ var value = _ref.value,
13144
+ visibleDate = _ref.visibleDate,
13145
+ onChange = _ref.onChange,
13146
+ _ref$onPreviousPress = _ref.onPreviousPress,
13147
+ onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
13148
+ _ref$onNextPress = _ref.onNextPress,
13149
+ onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
13150
+ _ref$onTitlePress = _ref.onTitlePress,
13151
+ onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
13152
+ minDate = _ref.minDate,
13153
+ maxDate = _ref.maxDate,
13154
+ _ref$markedDates = _ref.markedDates,
13155
+ markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
13156
+ testID = _ref.testID,
13157
+ _ref$onMonthChange = _ref.onMonthChange,
13158
+ onMonthChange = _ref$onMonthChange === void 0 ? noop$1 : _ref$onMonthChange,
13159
+ _ref$onToggleMonthPic = _ref.onToggleMonthPicker,
13160
+ onToggleMonthPicker = _ref$onToggleMonthPic === void 0 ? noop$1 : _ref$onToggleMonthPic,
13161
+ monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
13162
+ monthPickerCancelLabel = _ref.monthPickerCancelLabel;
13163
+ var theme = useTheme();
13164
+ var currentMonth = visibleDate.getMonth();
13165
+ var currentYear = visibleDate.getFullYear();
13166
+ var now = new Date();
13167
+ var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
13168
+ return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
13169
+ }, {});
13170
+ var _useState = useState(false),
13171
+ _useState2 = _slicedToArray(_useState, 2),
13172
+ monthPickerVisible = _useState2[0],
13173
+ setMonthPickerVisible = _useState2[1];
13174
+ var _useState3 = useState(0),
13175
+ _useState4 = _slicedToArray(_useState3, 2),
13176
+ contentHeight = _useState4[0],
13177
+ setContentHeight = _useState4[1];
13178
+ var _useState5 = useState(0),
13179
+ _useState6 = _slicedToArray(_useState5, 2),
13180
+ contentWidth = _useState6[0],
13181
+ setContentWidth = _useState6[1];
13182
+ var calendarItemWidth = useMemo(function () {
13183
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13184
+ }, [contentWidth, theme]);
13185
+ var useMonthPicker = onMonthChange !== noop$1;
13186
+ var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13187
+ var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
13188
+ var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
13189
+ // Index of day in week is shifted by 1 due to Sunday is the last column
13190
+ var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
13191
+ var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
13192
+ var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
13193
+ var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
13194
+ var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
13195
+ var count = lastDayIndexOfPreviousMonth - reversedIndex;
13196
+ return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
13197
+ });
13198
+ var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
13199
+ return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
13200
+ });
13201
+ var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
13202
+ return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
13203
+ });
13204
+ var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
13205
+ return date !== undefined;
13206
+ }) && minDate >= firstDateOfMonth;
13207
+ var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13208
+ return date !== undefined;
13209
+ }) || maxDate <= lastDateOfMonth;
13210
+ var onDateChange = function onDateChange(date) {
13211
+ var newDateRange = setStartOrEndDate({
13212
+ date: date,
13213
+ startDate: value === null || value === void 0 ? void 0 : value.startDate,
13214
+ endDate: value === null || value === void 0 ? void 0 : value.endDate
13215
+ });
13216
+ onChange === null || onChange === void 0 || onChange(newDateRange);
13217
+ };
13218
+ var renderDateCell = function renderDateCell(_ref2) {
13219
+ var date = _ref2.date,
13220
+ isCurrentMonth = _ref2.isCurrentMonth;
13221
+ if (!date) {
13222
+ return /*#__PURE__*/React__default.createElement(StyledDisabledCalendarRowItem, {
13223
+ themeItemWidth: calendarItemWidth,
13224
+ testID: "calendar-disabled-cell"
13225
+ });
13226
+ }
13227
+ if (isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date)) {
13228
+ return /*#__PURE__*/React__default.createElement(SelectedDate, {
13229
+ isStart: isEqDate(date, value === null || value === void 0 ? void 0 : value.startDate),
13230
+ showConnector: !!(value !== null && value !== void 0 && value.startDate) && !!(value !== null && value !== void 0 && value.endDate),
13231
+ key: date.toDateString(),
13232
+ date: date,
13233
+ onPress: function onPress() {
13234
+ return onDateChange(date);
13235
+ },
13236
+ marked: parsedMaskedDate[date.toDateString()],
13237
+ itemWidth: calendarItemWidth
13238
+ });
13239
+ }
13240
+ return /*#__PURE__*/React__default.createElement(CalendarRowItem, {
13241
+ itemWidth: calendarItemWidth,
13242
+ key: date.toDateString(),
13243
+ date: date,
13244
+ isCurrent: isEqDate(now, date),
13245
+ isSelected: isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date),
13246
+ isHighlighted: isDateInRange({
13247
+ date: date,
13248
+ range: value
13249
+ }),
13250
+ onPress: function onPress() {
13251
+ return onDateChange(date);
13252
+ },
13253
+ marked: parsedMaskedDate[date.toDateString()],
13254
+ textIntent: isCurrentMonth ? undefined : 'subdued'
13255
+ });
13256
+ };
13257
+ var onLayout = function onLayout(e) {
13258
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13259
+ width = _e$nativeEvent$layout.width,
13260
+ height = _e$nativeEvent$layout.height;
13261
+ setContentHeight(height);
13262
+ setContentWidth(width);
13263
+ };
13264
+ return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13265
+ testID: testID
13266
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13267
+ value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13268
+ testID: "calendar-month-picker",
13269
+ onPress: function onPress() {
13270
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
13271
+ setMonthPickerVisible(!monthPickerVisible);
13272
+ }
13273
+ }, /*#__PURE__*/React__default.createElement(Box, {
13274
+ flexDirection: "row",
13275
+ justifyContent: "center",
13276
+ alignItems: "center"
13277
+ }, /*#__PURE__*/React__default.createElement(Typography.Title, {
13278
+ level: "h5",
13279
+ style: {
13280
+ textAlign: 'center',
13281
+ marginRight: theme.__hd__.calendar.space.headerMarginRight
13282
+ }
13283
+ }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13284
+ icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13285
+ size: "small"
13286
+ }))),
13287
+ onPreviousPress: onPreviousPress,
13288
+ onNextPress: onNextPress,
13289
+ onPress: useMonthPicker ? undefined : onTitlePress,
13290
+ previousDisabled: disablePrevButton,
13291
+ nextDisabled: disableNextButton,
13292
+ fontSize: "large"
13293
+ })), Platform.OS === 'ios' && monthPickerVisible ? /*#__PURE__*/React__default.createElement(Box, {
13294
+ style: {
13295
+ overflow: 'hidden'
13296
+ }
13297
+ }, /*#__PURE__*/React__default.createElement(MonthYearPickerViewIOS, {
13298
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13299
+ minimumDate: minDate,
13300
+ maximumDate: maxDate,
13301
+ onChange: onMonthChange,
13302
+ style: {
13303
+ height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
13304
+ marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
13305
+ width: contentWidth
13306
+ }
13307
+ })) : /*#__PURE__*/React__default.createElement(Box, {
13308
+ onLayout: onLayout
13309
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
13310
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13311
+ key: day
13312
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarDayNameCell, {
13313
+ themeItemWidth: calendarItemWidth
13314
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13315
+ variant: "small"
13316
+ }, day)));
13317
+ })), /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
13318
+ return renderDateCell({
13319
+ date: date,
13320
+ isCurrentMonth: false
13321
+ });
13322
+ }), daysOfCurrentMonth.map(function (date) {
13323
+ return renderDateCell({
13324
+ date: date,
13325
+ isCurrentMonth: true
13326
+ });
13327
+ }), daysOfNextMonth.map(function (date) {
13328
+ return renderDateCell({
13329
+ date: date,
13330
+ isCurrentMonth: false
13331
+ });
13332
+ })), Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default.createElement(MonthYearPickerDialogueAndroid, {
13333
+ doneButtonLabel: monthPickerConfirmLabel,
13334
+ cancelButtonLabel: monthPickerCancelLabel,
13335
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13336
+ minimumDate: minDate,
13337
+ maximumDate: maxDate,
13338
+ onChange: function onChange(action, date) {
13339
+ setMonthPickerVisible(false);
13340
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
13341
+ if (action === 'dateSetAction' && !!date) {
13342
+ onMonthChange(date);
13343
+ }
13344
+ }
13345
+ })));
13346
+ };
12973
13347
 
12974
13348
  var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
12975
13349
  // Sunday first column => 0
@@ -13019,8 +13393,8 @@ var Calendar = function Calendar(_ref) {
13019
13393
  contentWidth = _useState6[0],
13020
13394
  setContentWidth = _useState6[1];
13021
13395
  var calendarItemWidth = useMemo(function () {
13022
- return contentWidth > 0 ? contentWidth / 7 : undefined;
13023
- }, [contentWidth]);
13396
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13397
+ }, [contentWidth, theme]);
13024
13398
  var useMonthPicker = onMonthChange !== noop$1;
13025
13399
  var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13026
13400
  var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
@@ -13046,6 +13420,13 @@ var Calendar = function Calendar(_ref) {
13046
13420
  var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13047
13421
  return date !== undefined;
13048
13422
  }) || maxDate <= lastDateOfMonth;
13423
+ var onLayout = function onLayout(e) {
13424
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13425
+ width = _e$nativeEvent$layout.width,
13426
+ height = _e$nativeEvent$layout.height;
13427
+ setContentHeight(height);
13428
+ setContentWidth(width);
13429
+ };
13049
13430
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13050
13431
  testID: testID
13051
13432
  }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
@@ -13090,13 +13471,7 @@ var Calendar = function Calendar(_ref) {
13090
13471
  width: contentWidth
13091
13472
  }
13092
13473
  })) : /*#__PURE__*/React__default.createElement(Box, {
13093
- onLayout: Platform.OS === 'ios' ? function (e) {
13094
- var _e$nativeEvent$layout = e.nativeEvent.layout,
13095
- width = _e$nativeEvent$layout.width,
13096
- height = _e$nativeEvent$layout.height;
13097
- setContentHeight(height);
13098
- setContentWidth(width);
13099
- } : undefined
13474
+ onLayout: onLayout
13100
13475
  }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
13101
13476
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13102
13477
  key: day
@@ -13167,6 +13542,9 @@ var Calendar = function Calendar(_ref) {
13167
13542
  }
13168
13543
  })));
13169
13544
  };
13545
+ var Calendar$1 = Object.assign(Calendar, {
13546
+ Range: CalendarRange
13547
+ });
13170
13548
 
13171
13549
  var StyledDataCard = index$a(View)(function (_ref) {
13172
13550
  var theme = _ref.theme;
@@ -14582,7 +14960,7 @@ var InternalCalendar = function InternalCalendar(_ref) {
14582
14960
  _useState4 = _slicedToArray(_useState3, 2),
14583
14961
  selectingDate = _useState4[0],
14584
14962
  setSelectingDate = _useState4[1];
14585
- return /*#__PURE__*/React__default.createElement(Calendar, {
14963
+ return /*#__PURE__*/React__default.createElement(Calendar$1, {
14586
14964
  testID: "calendar",
14587
14965
  value: selectingDate,
14588
14966
  visibleDate: visibleDate,
@@ -39244,10 +39622,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39244
39622
  _React$useState2 = _slicedToArray(_React$useState, 2),
39245
39623
  inputSize = _React$useState2[0],
39246
39624
  setInputSize = _React$useState2[1];
39247
- var _React$useState3 = React__default.useState(0),
39248
- _React$useState4 = _slicedToArray(_React$useState3, 2),
39249
- labelWidth = _React$useState4[0],
39250
- setLabelWidth = _React$useState4[1];
39251
39625
  var focusAnimation = useRef(new Animated.Value(0)).current;
39252
39626
  useEffect(function () {
39253
39627
  Animated.timing(focusAnimation, {
@@ -39268,10 +39642,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39268
39642
  });
39269
39643
  });
39270
39644
  }, []);
39271
- var onLabelLayout = useCallback(function (event) {
39272
- var width = event.nativeEvent.layout.width;
39273
- setLabelWidth(width);
39274
- }, []);
39275
39645
  useEffect(function () {
39276
39646
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
39277
39647
  return setIsFocused(true);
@@ -39398,12 +39768,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
39398
39768
  transform: [{
39399
39769
  translateY: focusAnimation.interpolate({
39400
39770
  inputRange: [0, 1],
39401
- outputRange: [inputSize.height / 2, 0]
39771
+ outputRange: [inputSize.height / 2, theme.space.xsmall]
39402
39772
  })
39403
39773
  }, {
39404
39774
  translateX: focusAnimation.interpolate({
39405
39775
  inputRange: [0, 1],
39406
- outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
39776
+ outputRange: [theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
39407
39777
  })
39408
39778
  }, {
39409
39779
  scale: focusAnimation.interpolate({
@@ -39412,19 +39782,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
39412
39782
  })
39413
39783
  }]
39414
39784
  }]
39415
- }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39785
+ }, !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39416
39786
  style: {
39417
39787
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39418
39788
  },
39789
+ testID: "input-label",
39419
39790
  themeState: state
39420
- }, "*"), !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39791
+ }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39421
39792
  style: {
39422
39793
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39423
39794
  },
39424
- testID: "input-label",
39425
- themeState: state,
39426
- onLayout: onLabelLayout
39427
- }, label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39795
+ themeState: state
39796
+ }, "*"), label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39428
39797
  onLayout: onLayout
39429
39798
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
39430
39799
  themeState: state,
@@ -40033,4 +40402,4 @@ var FloatingIsland = function FloatingIsland(_ref2) {
40033
40402
  }));
40034
40403
  };
40035
40404
 
40036
- export { Accordion, Alert, AppCue, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, Card$1 as Card, index$8 as Carousel, Checkbox, Chip, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, ErrorComponent as Error, FAB, FlatListWithFAB, FloatingIsland, HeroDesignProvider, Icon, Image, List, index$6 as MapPin, PageControl, PinInput, Portal$1 as Portal, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, ScrollViewWithFAB, Search, SectionHeading, SectionListWithFAB, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette as swagLightSystemPalette, swagSystemPalette$1 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };
40405
+ export { Accordion, Alert, AppCue, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar$1 as Calendar, Card$1 as Card, index$8 as Carousel, Checkbox, Chip, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, ErrorComponent as Error, FAB, FlatListWithFAB, FloatingIsland, HeroDesignProvider, Icon, Image, List, index$6 as MapPin, PageControl, PinInput, Portal$1 as Portal, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, ScrollViewWithFAB, Search, SectionHeading, SectionListWithFAB, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, ehWorkDarkPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette as swagLightSystemPalette, swagSystemPalette$1 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };