@hero-design/rn-work-uikit 1.6.1 → 1.6.2-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.
package/lib/index.js CHANGED
@@ -6507,7 +6507,8 @@ var getIconTheme = function getIconTheme(theme) {
6507
6507
  warning: theme.colors.warning,
6508
6508
  disabledText: theme.colors.disabledOnDefaultGlobalSurface,
6509
6509
  invertedText: theme.colors.onDarkGlobalSurface,
6510
- muted: theme.colors.mutedOnDefaultGlobalSurface
6510
+ muted: theme.colors.mutedOnDefaultGlobalSurface,
6511
+ inactive: theme.colors.inactiveOnDefaultGlobalSurface
6511
6512
  };
6512
6513
  var sizes = {
6513
6514
  xxxsmall: theme.fontSizes.small,
@@ -7324,7 +7325,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
7324
7325
  inverted: theme.colors.onDarkGlobalSurface,
7325
7326
  archived: theme.colors.onArchivedSurface,
7326
7327
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
7327
- muted: theme.colors.mutedOnDefaultGlobalSurface
7328
+ muted: theme.colors.mutedOnDefaultGlobalSurface,
7329
+ inactive: theme.colors.inactiveOnDefaultGlobalSurface
7328
7330
  };
7329
7331
  var fontSizes = {
7330
7332
  xsmall: theme.fontSizes.xsmall,
@@ -7637,6 +7639,85 @@ var getAppCueTheme = function getAppCueTheme(theme) {
7637
7639
  };
7638
7640
  };
7639
7641
 
7642
+ var getFilterTriggerTheme = function getFilterTriggerTheme(theme) {
7643
+ var borderWidths = {
7644
+ wrapper: {
7645
+ filled: theme.borderWidths.medium,
7646
+ outlined: theme.borderWidths.medium,
7647
+ ghost: 0
7648
+ }
7649
+ };
7650
+ var colors = {
7651
+ wrapper: {
7652
+ activeBackground: theme.colors.highlightedSurface,
7653
+ inactiveBackground: theme.colors.neutralGlobalSurface,
7654
+ background: {
7655
+ active: {
7656
+ filled: theme.colors.highlightedSurface,
7657
+ outlined: 'transparent',
7658
+ ghost: 'transparent',
7659
+ filledLabeless: theme.colors.neutralGlobalSurface
7660
+ },
7661
+ inactive: {
7662
+ filled: theme.colors.neutralGlobalSurface,
7663
+ outlined: 'transparent',
7664
+ ghost: 'transparent'
7665
+ }
7666
+ },
7667
+ border: {
7668
+ active: {
7669
+ filled: theme.colors.highlightedSurface,
7670
+ outlined: theme.colors.primaryOutline,
7671
+ ghost: 'transparent',
7672
+ filledLabeless: theme.colors.neutralGlobalSurface
7673
+ },
7674
+ inactive: {
7675
+ filled: theme.colors.neutralGlobalSurface,
7676
+ outlined: theme.colors.secondaryOutline,
7677
+ ghost: 'transparent'
7678
+ }
7679
+ }
7680
+ }
7681
+ };
7682
+ var space = {
7683
+ wrapper: {
7684
+ "default": {
7685
+ paddingHorizontal: theme.space.smallMedium,
7686
+ paddingVertical: theme.space.xsmall
7687
+ },
7688
+ labeless: {
7689
+ paddingHorizontal: theme.space.small,
7690
+ paddingVertical: theme.space.xsmall
7691
+ },
7692
+ itemGap: theme.space.xsmall
7693
+ },
7694
+ badge: {
7695
+ labelessRight: theme.space.xxsmall,
7696
+ labelessBottom: theme.space.xxsmall
7697
+ }
7698
+ };
7699
+ var radii = {
7700
+ wrapper: {
7701
+ "default": theme.radii.xxxlarge,
7702
+ labeless: theme.radii.xlarge
7703
+ }
7704
+ };
7705
+ var sizes = {
7706
+ wrapperHeight: scale(36)
7707
+ };
7708
+ var lineHeights = {
7709
+ text: theme.lineHeights.small
7710
+ };
7711
+ return {
7712
+ colors: colors,
7713
+ space: space,
7714
+ radii: radii,
7715
+ borderWidths: borderWidths,
7716
+ sizes: sizes,
7717
+ lineHeights: lineHeights
7718
+ };
7719
+ };
7720
+
7640
7721
  var getTheme$1 = function getTheme() {
7641
7722
  var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : scale$1;
7642
7723
  var systemPallete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : swagSystemPalette$2;
@@ -7669,6 +7750,7 @@ var getTheme$1 = function getTheme() {
7669
7750
  empty: getEmptyTheme(globalTheme),
7670
7751
  error: getErrorTheme(globalTheme),
7671
7752
  fab: getFABTheme(globalTheme),
7753
+ filterTrigger: getFilterTriggerTheme(globalTheme),
7672
7754
  icon: getIconTheme(globalTheme),
7673
7755
  image: getImageTheme(globalTheme),
7674
7756
  list: getListTheme(globalTheme),
@@ -8412,7 +8494,8 @@ var COLOR_INTENTS = {
8412
8494
  warning: 'warning',
8413
8495
  'disabled-text': 'disabledText',
8414
8496
  'text-inverted': 'invertedText',
8415
- muted: 'muted'
8497
+ muted: 'muted',
8498
+ inactive: 'inactive'
8416
8499
  };
8417
8500
  var StyledHeroIcon = index$b(HeroIcon)(function (_ref) {
8418
8501
  var themeIntent = _ref.themeIntent,
@@ -8510,7 +8593,7 @@ var FONTWEIGHT_MAP$2 = {
8510
8593
  regular: 'regular',
8511
8594
  'semi-bold': 'semiBold'
8512
8595
  };
8513
- var StyledText$3 = index$b(reactNative.Text)(function (_ref) {
8596
+ var StyledText$4 = index$b(reactNative.Text)(function (_ref) {
8514
8597
  var themeFontSize = _ref.themeFontSize,
8515
8598
  themeFontWeight = _ref.themeFontWeight,
8516
8599
  themeIntent = _ref.themeIntent,
@@ -8542,7 +8625,7 @@ var Text = function Text(_ref) {
8542
8625
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8543
8626
  nativeProps = _objectWithoutProperties(_ref, _excluded$O);
8544
8627
  useDeprecation('Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.');
8545
- return /*#__PURE__*/React__namespace.default.createElement(StyledText$3, _extends$1({}, nativeProps, {
8628
+ return /*#__PURE__*/React__namespace.default.createElement(StyledText$4, _extends$1({}, nativeProps, {
8546
8629
  themeFontSize: fontSize,
8547
8630
  themeFontWeight: fontWeight,
8548
8631
  themeIntent: intent,
@@ -13728,6 +13811,16 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
13728
13811
  }) : null));
13729
13812
  };
13730
13813
 
13814
+ var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
13815
+
13816
+ // Sunday first column => 0
13817
+ // Sunday last column => 1
13818
+ var WEEK_INDEX_OFFSET = 1;
13819
+ var SUNDAY_INDEX = 6;
13820
+
13821
+ // Always render 7 rows x 6 items for consistent layout
13822
+ var TOTAL_DATES_ITEMS = 7 * 6;
13823
+
13731
13824
  var initArray = function initArray(length, func) {
13732
13825
  return Array.from(Array(length)).map(function (_, index) {
13733
13826
  return func(index);
@@ -13804,6 +13897,74 @@ var setStartOrEndDate = function setStartOrEndDate(_ref2) {
13804
13897
  endDate: undefined
13805
13898
  };
13806
13899
  };
13900
+ var shouldUseMonthPicker = function shouldUseMonthPicker(onMonthChange) {
13901
+ return onMonthChange !== noop$2;
13902
+ };
13903
+ var getCalendarDate = function getCalendarDate(_ref3) {
13904
+ var visibleDate = _ref3.visibleDate,
13905
+ _ref3$markedDates = _ref3.markedDates,
13906
+ markedDates = _ref3$markedDates === void 0 ? [] : _ref3$markedDates,
13907
+ minDate = _ref3.minDate,
13908
+ maxDate = _ref3.maxDate;
13909
+ var currentMonth = visibleDate.getMonth();
13910
+ var currentYear = visibleDate.getFullYear();
13911
+ var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
13912
+ return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
13913
+ }, {});
13914
+ var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13915
+ var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
13916
+ var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
13917
+
13918
+ // Index of day in week is shifted by 1 due to Sunday is the last column
13919
+ var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET;
13920
+ var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
13921
+ var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
13922
+ var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
13923
+ var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
13924
+ var count = lastDayIndexOfPreviousMonth - reversedIndex;
13925
+ return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
13926
+ });
13927
+ var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
13928
+ return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
13929
+ });
13930
+ var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
13931
+ return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
13932
+ });
13933
+ return {
13934
+ firstDateOfMonth: firstDateOfMonth,
13935
+ lastDateOfMonth: lastDateOfMonth,
13936
+ parsedMaskedDate: parsedMaskedDate,
13937
+ daysOfPreviousMonth: daysOfPreviousMonth,
13938
+ daysOfCurrentMonth: daysOfCurrentMonth,
13939
+ daysOfNextMonth: daysOfNextMonth
13940
+ };
13941
+ };
13942
+ var getCalendarButtonState = function getCalendarButtonState(_ref4) {
13943
+ var visibleDate = _ref4.visibleDate,
13944
+ markedDates = _ref4.markedDates,
13945
+ minDate = _ref4.minDate,
13946
+ maxDate = _ref4.maxDate;
13947
+ var _getCalendarDate = getCalendarDate({
13948
+ visibleDate: visibleDate,
13949
+ markedDates: markedDates,
13950
+ minDate: minDate,
13951
+ maxDate: maxDate
13952
+ }),
13953
+ daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
13954
+ daysOfNextMonth = _getCalendarDate.daysOfNextMonth,
13955
+ firstDateOfMonth = _getCalendarDate.firstDateOfMonth,
13956
+ lastDateOfMonth = _getCalendarDate.lastDateOfMonth;
13957
+ var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
13958
+ return date !== undefined;
13959
+ }) && minDate >= firstDateOfMonth;
13960
+ var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13961
+ return date !== undefined;
13962
+ }) || maxDate <= lastDateOfMonth;
13963
+ return {
13964
+ disablePrevButton: disablePrevButton,
13965
+ disableNextButton: disableNextButton
13966
+ };
13967
+ };
13807
13968
 
13808
13969
  var SelectedDate = function SelectedDate(_ref) {
13809
13970
  var date = _ref.date,
@@ -13839,14 +14000,36 @@ var SelectedDate = function SelectedDate(_ref) {
13839
14000
  }) : null));
13840
14001
  };
13841
14002
 
13842
- var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
13843
- // Sunday first column => 0
13844
- // Sunday last column => 1
13845
- var WEEK_INDEX_OFFSET$1 = 1;
13846
- var SUNDAY_INDEX$1 = 6;
14003
+ var useCalendarLayout = function useCalendarLayout() {
14004
+ var theme = useTheme();
14005
+ var _useState = React.useState(0),
14006
+ _useState2 = _slicedToArray(_useState, 2),
14007
+ contentHeight = _useState2[0],
14008
+ setContentHeight = _useState2[1];
14009
+ var calendarItemHeight = contentHeight - theme.__hd__.calendar.space.iosPickerMarginVertical * 2;
14010
+ var _useState3 = React.useState(0),
14011
+ _useState4 = _slicedToArray(_useState3, 2),
14012
+ contentWidth = _useState4[0],
14013
+ setContentWidth = _useState4[1];
14014
+ var calendarItemWidth = React.useMemo(function () {
14015
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
14016
+ }, [contentWidth, theme]);
14017
+ var onLayout = React.useCallback(function (e) {
14018
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
14019
+ width = _e$nativeEvent$layout.width,
14020
+ height = _e$nativeEvent$layout.height;
14021
+ setContentHeight(height);
14022
+ setContentWidth(width);
14023
+ }, []);
14024
+ return {
14025
+ onLayout: onLayout,
14026
+ contentHeight: contentHeight,
14027
+ calendarItemHeight: calendarItemHeight,
14028
+ contentWidth: contentWidth,
14029
+ calendarItemWidth: calendarItemWidth
14030
+ };
14031
+ };
13847
14032
 
13848
- // Always render 7 rows x 6 items for consistent layout
13849
- var TOTAL_DATES_ITEMS$1 = 7 * 6;
13850
14033
  var CalendarRange = function CalendarRange(_ref) {
13851
14034
  var value = _ref.value,
13852
14035
  visibleDate = _ref.visibleDate,
@@ -13869,53 +14052,35 @@ var CalendarRange = function CalendarRange(_ref) {
13869
14052
  monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
13870
14053
  monthPickerCancelLabel = _ref.monthPickerCancelLabel;
13871
14054
  var theme = useTheme();
13872
- var currentMonth = visibleDate.getMonth();
13873
- var currentYear = visibleDate.getFullYear();
13874
- var now = new Date();
13875
- var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
13876
- return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
13877
- }, {});
13878
14055
  var _useState = React.useState(false),
13879
14056
  _useState2 = _slicedToArray(_useState, 2),
13880
14057
  monthPickerVisible = _useState2[0],
13881
14058
  setMonthPickerVisible = _useState2[1];
13882
- var _useState3 = React.useState(0),
13883
- _useState4 = _slicedToArray(_useState3, 2),
13884
- contentHeight = _useState4[0],
13885
- setContentHeight = _useState4[1];
13886
- var _useState5 = React.useState(0),
13887
- _useState6 = _slicedToArray(_useState5, 2),
13888
- contentWidth = _useState6[0],
13889
- setContentWidth = _useState6[1];
13890
- var calendarItemWidth = React.useMemo(function () {
13891
- return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13892
- }, [contentWidth, theme]);
13893
- var useMonthPicker = onMonthChange !== noop$2;
13894
- var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13895
- var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
13896
- var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
13897
-
13898
- // Index of day in week is shifted by 1 due to Sunday is the last column
13899
- var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
13900
- var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
13901
- var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
13902
- var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
13903
- var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
13904
- var count = lastDayIndexOfPreviousMonth - reversedIndex;
13905
- return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
13906
- });
13907
- var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
13908
- return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
13909
- });
13910
- var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
13911
- return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
13912
- });
13913
- var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
13914
- return date !== undefined;
13915
- }) && minDate >= firstDateOfMonth;
13916
- var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13917
- return date !== undefined;
13918
- }) || maxDate <= lastDateOfMonth;
14059
+ var _useCalendarLayout = useCalendarLayout(),
14060
+ onLayout = _useCalendarLayout.onLayout,
14061
+ contentHeight = _useCalendarLayout.contentHeight,
14062
+ contentWidth = _useCalendarLayout.contentWidth,
14063
+ calendarItemWidth = _useCalendarLayout.calendarItemWidth;
14064
+ var _getCalendarDate = getCalendarDate({
14065
+ visibleDate: visibleDate,
14066
+ markedDates: markedDates,
14067
+ minDate: minDate,
14068
+ maxDate: maxDate,
14069
+ onMonthChange: onMonthChange
14070
+ }),
14071
+ parsedMaskedDate = _getCalendarDate.parsedMaskedDate,
14072
+ daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
14073
+ daysOfCurrentMonth = _getCalendarDate.daysOfCurrentMonth,
14074
+ daysOfNextMonth = _getCalendarDate.daysOfNextMonth;
14075
+ var _getCalendarButtonSta = getCalendarButtonState({
14076
+ visibleDate: visibleDate,
14077
+ minDate: minDate,
14078
+ maxDate: maxDate
14079
+ }),
14080
+ disablePrevButton = _getCalendarButtonSta.disablePrevButton,
14081
+ disableNextButton = _getCalendarButtonSta.disableNextButton;
14082
+ var shouldShowMonthPicker = shouldUseMonthPicker(onMonthChange);
14083
+ var now = new Date();
13919
14084
  var onDateChange = function onDateChange(date) {
13920
14085
  var newDateRange = setStartOrEndDate({
13921
14086
  date: date,
@@ -13963,17 +14128,10 @@ var CalendarRange = function CalendarRange(_ref) {
13963
14128
  textIntent: isCurrentMonth ? undefined : 'subdued'
13964
14129
  });
13965
14130
  };
13966
- var onLayout = function onLayout(e) {
13967
- var _e$nativeEvent$layout = e.nativeEvent.layout,
13968
- width = _e$nativeEvent$layout.width,
13969
- height = _e$nativeEvent$layout.height;
13970
- setContentHeight(height);
13971
- setContentWidth(width);
13972
- };
13973
14131
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, {
13974
14132
  testID: testID
13975
14133
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
13976
- value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
14134
+ value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
13977
14135
  testID: "calendar-month-picker",
13978
14136
  onPress: function onPress() {
13979
14137
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13995,7 +14153,7 @@ var CalendarRange = function CalendarRange(_ref) {
13995
14153
  }))),
13996
14154
  onPreviousPress: onPreviousPress,
13997
14155
  onNextPress: onNextPress,
13998
- onPress: useMonthPicker ? undefined : onTitlePress,
14156
+ onPress: shouldShowMonthPicker ? undefined : onTitlePress,
13999
14157
  previousDisabled: disablePrevButton,
14000
14158
  nextDisabled: disableNextButton,
14001
14159
  fontSize: "large"
@@ -14015,7 +14173,7 @@ var CalendarRange = function CalendarRange(_ref) {
14015
14173
  }
14016
14174
  })) : /*#__PURE__*/React__namespace.default.createElement(Box, {
14017
14175
  onLayout: onLayout
14018
- }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
14176
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
14019
14177
  return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
14020
14178
  key: day
14021
14179
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarDayNameCell, {
@@ -14055,14 +14213,6 @@ var CalendarRange = function CalendarRange(_ref) {
14055
14213
  })));
14056
14214
  };
14057
14215
 
14058
- var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
14059
- // Sunday first column => 0
14060
- // Sunday last column => 1
14061
- var WEEK_INDEX_OFFSET = 1;
14062
- var SUNDAY_INDEX = 6;
14063
-
14064
- // Always render 7 rows x 6 items for consistent layout
14065
- var TOTAL_DATES_ITEMS = 7 * 6;
14066
14216
  var Calendar = function Calendar(_ref) {
14067
14217
  var value = _ref.value,
14068
14218
  visibleDate = _ref.visibleDate,
@@ -14085,64 +14235,39 @@ var Calendar = function Calendar(_ref) {
14085
14235
  monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
14086
14236
  monthPickerCancelLabel = _ref.monthPickerCancelLabel;
14087
14237
  var theme = useTheme();
14088
- var currentMonth = visibleDate.getMonth();
14089
- var currentYear = visibleDate.getFullYear();
14090
- var now = new Date();
14091
- var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
14092
- return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
14093
- }, {});
14238
+ var _useCalendarLayout = useCalendarLayout(),
14239
+ onLayout = _useCalendarLayout.onLayout,
14240
+ contentHeight = _useCalendarLayout.contentHeight,
14241
+ contentWidth = _useCalendarLayout.contentWidth,
14242
+ calendarItemWidth = _useCalendarLayout.calendarItemWidth;
14243
+ var _getCalendarDate = getCalendarDate({
14244
+ visibleDate: visibleDate,
14245
+ markedDates: markedDates,
14246
+ minDate: minDate,
14247
+ maxDate: maxDate,
14248
+ onMonthChange: onMonthChange
14249
+ }),
14250
+ parsedMaskedDate = _getCalendarDate.parsedMaskedDate,
14251
+ daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
14252
+ daysOfCurrentMonth = _getCalendarDate.daysOfCurrentMonth,
14253
+ daysOfNextMonth = _getCalendarDate.daysOfNextMonth;
14254
+ var _getCalendarButtonSta = getCalendarButtonState({
14255
+ visibleDate: visibleDate,
14256
+ minDate: minDate,
14257
+ maxDate: maxDate
14258
+ }),
14259
+ disablePrevButton = _getCalendarButtonSta.disablePrevButton,
14260
+ disableNextButton = _getCalendarButtonSta.disableNextButton;
14261
+ var shouldShowMonthPicker = shouldUseMonthPicker(onMonthChange);
14094
14262
  var _useState = React.useState(false),
14095
14263
  _useState2 = _slicedToArray(_useState, 2),
14096
14264
  monthPickerVisible = _useState2[0],
14097
14265
  setMonthPickerVisible = _useState2[1];
14098
- var _useState3 = React.useState(0),
14099
- _useState4 = _slicedToArray(_useState3, 2),
14100
- contentHeight = _useState4[0],
14101
- setContentHeight = _useState4[1];
14102
- var _useState5 = React.useState(0),
14103
- _useState6 = _slicedToArray(_useState5, 2),
14104
- contentWidth = _useState6[0],
14105
- setContentWidth = _useState6[1];
14106
- var calendarItemWidth = React.useMemo(function () {
14107
- return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
14108
- }, [contentWidth, theme]);
14109
- var useMonthPicker = onMonthChange !== noop$2;
14110
- var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
14111
- var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
14112
- var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
14113
-
14114
- // Index of day in week is shifted by 1 due to Sunday is the last column
14115
- var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET;
14116
- var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
14117
- var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
14118
- var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
14119
- var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
14120
- var count = lastDayIndexOfPreviousMonth - reversedIndex;
14121
- return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
14122
- });
14123
- var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
14124
- return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
14125
- });
14126
- var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
14127
- return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
14128
- });
14129
- var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
14130
- return date !== undefined;
14131
- }) && minDate >= firstDateOfMonth;
14132
- var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
14133
- return date !== undefined;
14134
- }) || maxDate <= lastDateOfMonth;
14135
- var onLayout = function onLayout(e) {
14136
- var _e$nativeEvent$layout = e.nativeEvent.layout,
14137
- width = _e$nativeEvent$layout.width,
14138
- height = _e$nativeEvent$layout.height;
14139
- setContentHeight(height);
14140
- setContentWidth(width);
14141
- };
14266
+ var now = new Date();
14142
14267
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, {
14143
14268
  testID: testID
14144
14269
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
14145
- value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
14270
+ value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
14146
14271
  testID: "calendar-month-picker",
14147
14272
  onPress: function onPress() {
14148
14273
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -14164,7 +14289,7 @@ var Calendar = function Calendar(_ref) {
14164
14289
  }))),
14165
14290
  onPreviousPress: onPreviousPress,
14166
14291
  onNextPress: onNextPress,
14167
- onPress: useMonthPicker ? undefined : onTitlePress,
14292
+ onPress: shouldShowMonthPicker ? undefined : onTitlePress,
14168
14293
  previousDisabled: disablePrevButton,
14169
14294
  nextDisabled: disableNextButton,
14170
14295
  fontSize: "large"
@@ -15548,7 +15673,7 @@ var StyledTextWrapper$1 = index$b(reactNative.View)(function () {
15548
15673
  height: '100%'
15549
15674
  };
15550
15675
  });
15551
- var StyledText$2 = index$b(Typography.Body)(function (_ref2) {
15676
+ var StyledText$3 = index$b(Typography.Body)(function (_ref2) {
15552
15677
  var themeSize = _ref2.themeSize,
15553
15678
  theme = _ref2.theme;
15554
15679
  return _objectSpread2({
@@ -15603,7 +15728,7 @@ var Avatar = function Avatar(_ref) {
15603
15728
  themeIntent: intent,
15604
15729
  themeSize: size,
15605
15730
  style: style
15606
- }, (source === undefined || hasImageError) && /*#__PURE__*/React__namespace.default.createElement(StyledTextWrapper$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledText$2, {
15731
+ }, (source === undefined || hasImageError) && /*#__PURE__*/React__namespace.default.createElement(StyledTextWrapper$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledText$3, {
15607
15732
  themeSize: size
15608
15733
  }, title)), source !== undefined && /*#__PURE__*/React__namespace.default.createElement(StyledImage$1, {
15609
15734
  resizeMode: "cover",
@@ -15819,7 +15944,7 @@ var StyledView$1 = index$b(reactNative.Animated.View)(function (_ref) {
15819
15944
  borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : theme.__hd__.badge.colors[themeIntent]
15820
15945
  };
15821
15946
  });
15822
- var StyledText$1 = index$b(Typography.Caption)(function (_ref2) {
15947
+ var StyledText$2 = index$b(Typography.Caption)(function (_ref2) {
15823
15948
  var theme = _ref2.theme,
15824
15949
  themeSize = _ref2.themeSize;
15825
15950
  return {
@@ -16009,7 +16134,7 @@ var Badge = function Badge(_ref) {
16009
16134
  icon: icon,
16010
16135
  themeSize: size,
16011
16136
  intent: "text-inverted"
16012
- }) : /*#__PURE__*/React__namespace.default.createElement(StyledText$1, {
16137
+ }) : /*#__PURE__*/React__namespace.default.createElement(StyledText$2, {
16013
16138
  themeSize: size
16014
16139
  }, content));
16015
16140
  };
@@ -24734,7 +24859,7 @@ var StyledContent = index$b(reactNative.View)(function (_ref2) {
24734
24859
  alignItems: 'center'
24735
24860
  };
24736
24861
  });
24737
- var StyledBadge$1 = index$b(reactNative.View)(function (_ref3) {
24862
+ var StyledBadge$2 = index$b(reactNative.View)(function (_ref3) {
24738
24863
  var theme = _ref3.theme;
24739
24864
  return {
24740
24865
  right: theme.__hd__.mapPin.space.iconRight,
@@ -24822,7 +24947,7 @@ var MapPin = function MapPin(_ref) {
24822
24947
  icon: icon,
24823
24948
  size: "xsmall",
24824
24949
  testID: testID ? "".concat(testID, "-icon") : undefined
24825
- })), badgeIcon && /*#__PURE__*/React__namespace.default.createElement(StyledBadge$1, {
24950
+ })), badgeIcon && /*#__PURE__*/React__namespace.default.createElement(StyledBadge$2, {
24826
24951
  testID: testID ? "".concat(testID, "-badge") : undefined
24827
24952
  }, /*#__PURE__*/React__namespace.default.createElement(StyledBadgeIcon, {
24828
24953
  icon: badgeIcon,
@@ -27015,7 +27140,7 @@ var StyledView = index$b(reactNative.View)(function (_ref) {
27015
27140
  paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
27016
27141
  };
27017
27142
  });
27018
- var StyledText = index$b(Typography.Caption)(function (_ref2) {
27143
+ var StyledText$1 = index$b(Typography.Caption)(function (_ref2) {
27019
27144
  var themeIntent = _ref2.themeIntent,
27020
27145
  theme = _ref2.theme;
27021
27146
  return {
@@ -27041,7 +27166,7 @@ var Tag = function Tag(_ref) {
27041
27166
  themeIntent: intent,
27042
27167
  style: style,
27043
27168
  testID: testID
27044
- }), typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledText, {
27169
+ }), typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledText$1, {
27045
27170
  themeIntent: intent,
27046
27171
  fontWeight: "semi-bold"
27047
27172
  }, content) : content);
@@ -27134,8 +27259,7 @@ var StyledInputContainer$1 = index$b(reactNative.View)(function (_ref8) {
27134
27259
  backgroundColor: theme.__hd__.toolbar.colors.inputContainerBackground,
27135
27260
  borderRadius: theme.__hd__.toolbar.radii.messageContainer,
27136
27261
  height: theme.__hd__.toolbar.sizes.messageInputHeight,
27137
- paddingHorizontal: theme.__hd__.toolbar.space.messageInputPaddingHorizontal,
27138
- paddingVertical: theme.__hd__.toolbar.space.messageInputPaddingVertical
27262
+ paddingHorizontal: theme.__hd__.toolbar.space.messageInputPaddingHorizontal
27139
27263
  };
27140
27264
  });
27141
27265
  var StyledInput$1 = index$b(reactNative.TextInput)(function (_ref9) {
@@ -46705,7 +46829,7 @@ var StyledHandlerContainer = index$b(reactNative.View)(function (_ref5) {
46705
46829
  paddingVertical: theme.__hd__.search.space.inputVerticalPadding
46706
46830
  };
46707
46831
  });
46708
- var StyledBadge = index$b(Badge$1)(function (_ref6) {
46832
+ var StyledBadge$1 = index$b(Badge$1)(function (_ref6) {
46709
46833
  var theme = _ref6.theme;
46710
46834
  return {
46711
46835
  position: 'absolute',
@@ -46907,12 +47031,12 @@ var renderBadge = function renderBadge(props) {
46907
47031
  var content = props.content,
46908
47032
  icon = props.icon,
46909
47033
  rest = _objectWithoutProperties(props, _excluded$4);
46910
- if (content) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge, _extends$1({
47034
+ if (content) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge$1, _extends$1({
46911
47035
  intent: "primary",
46912
47036
  content: content,
46913
47037
  size: "small"
46914
47038
  }, rest));
46915
- if (icon) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge, _extends$1({
47039
+ if (icon) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge$1, _extends$1({
46916
47040
  intent: "primary",
46917
47041
  icon: icon,
46918
47042
  size: "small"
@@ -47022,6 +47146,122 @@ var FloatingIsland = function FloatingIsland(_ref2) {
47022
47146
  }));
47023
47147
  };
47024
47148
 
47149
+ var getBackgroundColor = function getBackgroundColor(theme, themeIsActive, themeHasLabel, themeVariant) {
47150
+ var colors = theme.__hd__.filterTrigger.colors;
47151
+ if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
47152
+ return colors.wrapper.background.active.filledLabeless;
47153
+ }
47154
+ var state = themeIsActive ? 'active' : 'inactive';
47155
+ return colors.wrapper.background[state][themeVariant];
47156
+ };
47157
+ var getBorderStyles = function getBorderStyles(theme, themeIsActive, themeHasLabel, themeVariant) {
47158
+ var _theme$__hd__$filterT = theme.__hd__.filterTrigger,
47159
+ colors = _theme$__hd__$filterT.colors,
47160
+ borderWidths = _theme$__hd__$filterT.borderWidths,
47161
+ radii = _theme$__hd__$filterT.radii;
47162
+ var borderColor;
47163
+ if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
47164
+ borderColor = colors.wrapper.border.active.filledLabeless;
47165
+ } else {
47166
+ var state = themeIsActive ? 'active' : 'inactive';
47167
+ borderColor = colors.wrapper.border[state][themeVariant];
47168
+ }
47169
+ return {
47170
+ borderWidth: borderWidths.wrapper[themeVariant],
47171
+ borderColor: borderColor,
47172
+ borderRadius: themeHasLabel ? radii.wrapper["default"] : radii.wrapper.labeless
47173
+ };
47174
+ };
47175
+ var getSpacingStyles = function getSpacingStyles(theme, themeHasLabel) {
47176
+ var space = theme.__hd__.filterTrigger.space;
47177
+ var paddingConfig = themeHasLabel ? space.wrapper["default"] : space.wrapper.labeless;
47178
+ return {
47179
+ gap: space.wrapper.itemGap,
47180
+ paddingHorizontal: paddingConfig.paddingHorizontal,
47181
+ paddingVertical: paddingConfig.paddingVertical
47182
+ };
47183
+ };
47184
+ var StyledFilterWrapper = index$b(reactNative.TouchableOpacity)(function (_ref) {
47185
+ var theme = _ref.theme,
47186
+ themeActive = _ref.themeActive,
47187
+ themeVariant = _ref.themeVariant,
47188
+ themeHasLabel = _ref.themeHasLabel;
47189
+ return _objectSpread2(_objectSpread2({
47190
+ position: 'relative',
47191
+ flexDirection: 'row',
47192
+ alignItems: 'center',
47193
+ justifyContent: 'center',
47194
+ alignSelf: 'flex-start',
47195
+ height: theme.__hd__.filterTrigger.sizes.wrapperHeight,
47196
+ backgroundColor: getBackgroundColor(theme, themeActive, themeHasLabel, themeVariant)
47197
+ }, getBorderStyles(theme, themeActive, themeHasLabel, themeVariant)), getSpacingStyles(theme, themeHasLabel));
47198
+ });
47199
+ var StyledBadge = index$b(Badge$1)(function (_ref2) {
47200
+ var theme = _ref2.theme,
47201
+ themeHasLabel = _ref2.themeHasLabel;
47202
+ return _objectSpread2({
47203
+ position: 'absolute'
47204
+ }, themeHasLabel ? {
47205
+ right: 0,
47206
+ bottom: 0
47207
+ } : {
47208
+ right: -theme.__hd__.filterTrigger.space.badge.labelessRight,
47209
+ bottom: -theme.__hd__.filterTrigger.space.badge.labelessBottom
47210
+ });
47211
+ });
47212
+ var StyledText = index$b(Typography.Body)(function (_ref3) {
47213
+ var theme = _ref3.theme;
47214
+ return {
47215
+ lineHeight: theme.__hd__.filterTrigger.lineHeights.text,
47216
+ textAlignVertical: 'center',
47217
+ includeFontPadding: false
47218
+ };
47219
+ });
47220
+
47221
+ var FilterTrigger = function FilterTrigger(_ref) {
47222
+ var label = _ref.label,
47223
+ _ref$active = _ref.active,
47224
+ active = _ref$active === void 0 ? false : _ref$active,
47225
+ _ref$filterCount = _ref.filterCount,
47226
+ filterCount = _ref$filterCount === void 0 ? 0 : _ref$filterCount,
47227
+ _ref$variant = _ref.variant,
47228
+ variant = _ref$variant === void 0 ? 'filled' : _ref$variant,
47229
+ suffix = _ref.suffix,
47230
+ onPress = _ref.onPress,
47231
+ testID = _ref.testID,
47232
+ style = _ref.style;
47233
+ var shouldShowBadge = filterCount > 0 && active;
47234
+ var iconIntent = active ? 'text' : 'inactive';
47235
+ var typographyVariant = active ? 'small-bold' : 'small';
47236
+ return /*#__PURE__*/React__namespace.default.createElement(StyledFilterWrapper, {
47237
+ testID: testID,
47238
+ style: style,
47239
+ themeActive: active,
47240
+ themeVariant: variant,
47241
+ onPress: onPress,
47242
+ themeHasLabel: !!label
47243
+ }, label ? /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledText, {
47244
+ variant: typographyVariant
47245
+ }, label), shouldShowBadge && /*#__PURE__*/React__namespace.default.createElement(Badge$1, {
47246
+ content: filterCount,
47247
+ size: "small"
47248
+ }), suffix && /*#__PURE__*/React__namespace.default.createElement(Icon, {
47249
+ icon: suffix,
47250
+ size: "xxxsmall",
47251
+ intent: iconIntent,
47252
+ testID: "".concat(testID, "-suffix")
47253
+ })) : /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, suffix && /*#__PURE__*/React__namespace.default.createElement(Icon, {
47254
+ icon: suffix,
47255
+ size: "xsmall",
47256
+ intent: iconIntent,
47257
+ testID: "".concat(testID, "-suffix")
47258
+ }), shouldShowBadge && /*#__PURE__*/React__namespace.default.createElement(StyledBadge, {
47259
+ content: filterCount,
47260
+ size: "small",
47261
+ themeHasLabel: !!label
47262
+ })));
47263
+ };
47264
+
47025
47265
  var getZIndexByState = function getZIndexByState(_ref) {
47026
47266
  var themeFocused = _ref.themeFocused,
47027
47267
  themeHasError = _ref.themeHasError;
@@ -67159,6 +67399,7 @@ exports.Drawer = index$8;
67159
67399
  exports.Empty = Empty;
67160
67400
  exports.Error = ErrorComponent;
67161
67401
  exports.FAB = FAB;
67402
+ exports.FilterTrigger = FilterTrigger;
67162
67403
  exports.FlatListWithFAB = FlatListWithFAB;
67163
67404
  exports.FloatingIsland = FloatingIsland;
67164
67405
  exports.FormGroup = FormGroup;