@hero-design/rn 8.2.2 → 8.2.3

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 (35) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +96 -29
  3. package/lib/index.js +93 -26
  4. package/package.json +5 -5
  5. package/src/components/Box/StyledBox.tsx +8 -6
  6. package/src/components/Card/StyledCard.tsx +1 -1
  7. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +74 -0
  8. package/src/components/Card/__tests__/index.spec.tsx +2 -0
  9. package/src/components/Card/index.tsx +1 -1
  10. package/src/components/Icon/index.tsx +28 -2
  11. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +160 -0
  12. package/src/components/TextInput/__tests__/index.spec.tsx +50 -3
  13. package/src/components/TextInput/index.tsx +65 -30
  14. package/src/components/Toolbar/ToolbarGroup.tsx +20 -14
  15. package/src/components/Toolbar/ToolbarItem.tsx +9 -1
  16. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -0
  17. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +6 -0
  18. package/src/types.ts +4 -1
  19. package/src/utils/__tests__/helpers.spec.ts +22 -4
  20. package/src/utils/helpers.ts +10 -9
  21. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +1 -1
  22. package/types/components/Box/StyledBox.d.ts +2 -2
  23. package/types/components/Button/StyledButton.d.ts +1 -1
  24. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +1 -1
  25. package/types/components/Card/StyledCard.d.ts +1 -1
  26. package/types/components/Card/index.d.ts +1 -1
  27. package/types/components/Checkbox/StyledCheckbox.d.ts +1 -1
  28. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +1 -1
  29. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +1 -1
  30. package/types/components/Icon/index.d.ts +3 -3
  31. package/types/components/TextInput/StyledTextInput.d.ts +7 -7
  32. package/types/components/TextInput/index.d.ts +25 -3
  33. package/types/components/Toolbar/ToolbarItem.d.ts +6 -1
  34. package/types/types.d.ts +3 -2
  35. package/types/utils/helpers.d.ts +2 -2
@@ -1,9 +1,9 @@
1
- @hero-design/rn:build: cache hit, replaying output d7aa160db70d0015
2
- @hero-design/rn:build: $ yarn build:js && yarn build:types
3
- @hero-design/rn:build: $ rollup -c
4
- @hero-design/rn:build: 
5
- @hero-design/rn:build: src/index.ts → lib/index.js, es/index.js...
6
- @hero-design/rn:build: (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
7
- @hero-design/rn:build: (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
8
- @hero-design/rn:build: created lib/index.js, es/index.js in 21.6s
9
- @hero-design/rn:build: $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
1
+ @hero-design/rn:build: cache hit, replaying output e72791422bc29fc3
2
+ @hero-design/rn:build: $ yarn build:js && yarn build:types
3
+ @hero-design/rn:build: $ rollup -c
4
+ @hero-design/rn:build: 
5
+ @hero-design/rn:build: src/index.ts → lib/index.js, es/index.js...
6
+ @hero-design/rn:build: (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
7
+ @hero-design/rn:build: (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
8
+ @hero-design/rn:build: created lib/index.js, es/index.js in 32.4s
9
+ @hero-design/rn:build: $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as reactNative from 'react-native';
2
- import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, ScrollView, Modal, TextInput as TextInput$1, PanResponder, TouchableHighlight, InteractionManager, useWindowDimensions, Keyboard, SectionList, FlatList, LayoutAnimation, RefreshControl as RefreshControl$1 } from 'react-native';
2
+ import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, ScrollView, Modal, TextInput as TextInput$2, PanResponder, TouchableHighlight, InteractionManager, useWindowDimensions, Keyboard, SectionList, FlatList, LayoutAnimation, RefreshControl as RefreshControl$1 } from 'react-native';
3
3
  import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, useLayoutEffect, useImperativeHandle } from 'react';
4
4
  import { createIconSet } from 'react-native-vector-icons';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -6230,21 +6230,45 @@ var Icon = function Icon(_ref) {
6230
6230
  intent = _ref$intent === void 0 ? 'text' : _ref$intent,
6231
6231
  testID = _ref.testID,
6232
6232
  _ref$spin = _ref.spin,
6233
- spin = _ref$spin === void 0 ? false : _ref$spin;
6233
+ spin = _ref$spin === void 0 ? false : _ref$spin,
6234
+ accessibilityLabel = _ref.accessibilityLabel,
6235
+ accessibilityHint = _ref.accessibilityHint,
6236
+ accessibilityRole = _ref.accessibilityRole,
6237
+ accessibilityState = _ref.accessibilityState,
6238
+ accessibilityValue = _ref.accessibilityValue,
6239
+ accessibilityLiveRegion = _ref.accessibilityLiveRegion,
6240
+ accessibilityElementsHidden = _ref.accessibilityElementsHidden,
6241
+ accessible = _ref.accessible,
6242
+ accessibilityIgnoresInvertColors = _ref.accessibilityIgnoresInvertColors,
6243
+ accessibilityViewIsModal = _ref.accessibilityViewIsModal,
6244
+ accessibilityActions = _ref.accessibilityActions;
6234
6245
  useDeprecation("".concat(icon, " icon is deprecated and will be removed in the next major release, please use ").concat(icon.replace('carat', 'caret'), " instead."), icon.startsWith('carat'));
6235
- return spin ? /*#__PURE__*/React.createElement(AnimatedIcon, {
6246
+ var accessibilityProps = {
6247
+ accessibilityLabel: accessibilityLabel,
6248
+ accessibilityHint: accessibilityHint,
6249
+ accessibilityRole: accessibilityRole,
6250
+ accessibilityState: accessibilityState,
6251
+ accessibilityValue: accessibilityValue,
6252
+ accessibilityLiveRegion: accessibilityLiveRegion,
6253
+ accessibilityElementsHidden: accessibilityElementsHidden,
6254
+ accessible: accessible,
6255
+ accessibilityIgnoresInvertColors: accessibilityIgnoresInvertColors,
6256
+ accessibilityViewIsModal: accessibilityViewIsModal,
6257
+ accessibilityActions: accessibilityActions
6258
+ };
6259
+ return spin ? /*#__PURE__*/React.createElement(AnimatedIcon, _extends$1({
6236
6260
  name: icon,
6237
6261
  themeIntent: intent,
6238
6262
  themeSize: size,
6239
6263
  style: style,
6240
6264
  testID: testID
6241
- }) : /*#__PURE__*/React.createElement(StyledHeroIcon, {
6265
+ }, accessibilityProps)) : /*#__PURE__*/React.createElement(StyledHeroIcon, _extends$1({
6242
6266
  name: icon,
6243
6267
  themeIntent: intent,
6244
6268
  themeSize: size,
6245
6269
  style: style,
6246
6270
  testID: testID
6247
- });
6271
+ }, accessibilityProps));
6248
6272
  };
6249
6273
  Icon.List = IconList;
6250
6274
 
@@ -6825,20 +6849,20 @@ var StyledBottomBarText = index$a(Typography.Text)(function (_ref3) {
6825
6849
 
6826
6850
  var isIOS = Platform.OS === 'ios';
6827
6851
  var isAndroid = Platform.OS === 'android';
6828
- var pick = function pick(keys, props) {
6852
+ function pick(keys, obj) {
6829
6853
  return keys.filter(function (key) {
6830
- return key in props;
6854
+ return key in obj;
6831
6855
  }).reduce(function (result, cur) {
6832
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, props[cur]));
6856
+ return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
6833
6857
  }, {});
6834
- };
6835
- var omit = function omit(keys, props) {
6836
- var result = props;
6858
+ }
6859
+ function omit(keys, obj) {
6860
+ var result = obj;
6837
6861
  keys.forEach(function (key) {
6838
6862
  delete result[key];
6839
6863
  });
6840
6864
  return result;
6841
- };
6865
+ }
6842
6866
 
6843
6867
  var _excluded$f = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
6844
6868
  var getInactiveIcon = function getInactiveIcon(icon) {
@@ -10650,7 +10674,7 @@ var StyledHelperText = index$a(Typography.Text)(function (_ref10) {
10650
10674
  fontSize: theme.__hd__.textInput.fontSizes.error
10651
10675
  };
10652
10676
  });
10653
- var StyledTextInput = index$a(TextInput$1)(function (_ref11) {
10677
+ var StyledTextInput = index$a(TextInput$2)(function (_ref11) {
10654
10678
  var theme = _ref11.theme;
10655
10679
  return {
10656
10680
  textAlignVertical: 'center',
@@ -10727,7 +10751,7 @@ var getVariant$1 = function getVariant(_ref) {
10727
10751
  // Fix issue: Placeholder is not shown on iOS when multiline is true
10728
10752
  // https://github.com/callstack/react-native-paper/pull/3331
10729
10753
  var EMPTY_PLACEHOLDER_VALUE = ' ';
10730
- var TextInput = function TextInput(_ref2) {
10754
+ var TextInput = function TextInput(_ref2, ref) {
10731
10755
  var _ref3;
10732
10756
  var label = _ref2.label,
10733
10757
  prefix = _ref2.prefix,
@@ -10767,6 +10791,35 @@ var TextInput = function TextInput(_ref2) {
10767
10791
  });
10768
10792
  var shouldShowMaxLength = maxLength !== undefined;
10769
10793
  var theme = useTheme();
10794
+ var innerTextInput = React.useRef();
10795
+ React.useImperativeHandle(ref, function () {
10796
+ return {
10797
+ // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
10798
+ getNativeTextInputRef: function getNativeTextInputRef() {
10799
+ return innerTextInput.current;
10800
+ },
10801
+ focus: function focus() {
10802
+ var _innerTextInput$curre;
10803
+ (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 ? void 0 : _innerTextInput$curre.focus();
10804
+ },
10805
+ clear: function clear() {
10806
+ var _innerTextInput$curre2;
10807
+ return (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 ? void 0 : _innerTextInput$curre2.clear();
10808
+ },
10809
+ setNativeProps: function setNativeProps(args) {
10810
+ var _innerTextInput$curre3;
10811
+ return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.setNativeProps(args);
10812
+ },
10813
+ isFocused: function isFocused() {
10814
+ var _innerTextInput$curre4;
10815
+ return ((_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.isFocused()) || false;
10816
+ },
10817
+ blur: function blur() {
10818
+ var _innerTextInput$curre5;
10819
+ return (_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.blur();
10820
+ }
10821
+ };
10822
+ }, [innerTextInput]);
10770
10823
  var _useMemo = useMemo(function () {
10771
10824
  if (!textStyle) {
10772
10825
  return {};
@@ -10846,7 +10899,11 @@ var TextInput = function TextInput(_ref2) {
10846
10899
  testID: "input-label",
10847
10900
  fontSize: "medium",
10848
10901
  themeVariant: variant
10849
- }, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
10902
+ }, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
10903
+ ref: function ref(reference) {
10904
+ innerTextInput.current = reference;
10905
+ }
10906
+ }))), typeof actualSuffix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
10850
10907
  intent: variant === 'disabled' ? 'disabled-text' : 'text',
10851
10908
  testID: "input-suffix",
10852
10909
  icon: actualSuffix,
@@ -10864,6 +10921,7 @@ var TextInput = function TextInput(_ref2) {
10864
10921
  fontSize: "small"
10865
10922
  }, displayText.length, "/", maxLength)), !!helpText && /*#__PURE__*/React.createElement(StyledHelperText, null, helpText)));
10866
10923
  };
10924
+ var TextInput$1 = /*#__PURE__*/React.forwardRef(TextInput);
10867
10925
 
10868
10926
  var DatePickerAndroid = function DatePickerAndroid(_ref) {
10869
10927
  var value = _ref.value,
@@ -10895,7 +10953,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
10895
10953
  }, /*#__PURE__*/React.createElement(View, {
10896
10954
  pointerEvents: "none",
10897
10955
  testID: "datePickerInputAndroid"
10898
- }, /*#__PURE__*/React.createElement(TextInput, {
10956
+ }, /*#__PURE__*/React.createElement(TextInput$1, {
10899
10957
  label: label,
10900
10958
  value: displayValue,
10901
10959
  suffix: "calendar-dates-outlined",
@@ -10963,7 +11021,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
10963
11021
  }, /*#__PURE__*/React.createElement(View, {
10964
11022
  pointerEvents: "none",
10965
11023
  testID: "datePickerInputIOS"
10966
- }, /*#__PURE__*/React.createElement(TextInput, {
11024
+ }, /*#__PURE__*/React.createElement(TextInput$1, {
10967
11025
  label: label,
10968
11026
  value: displayValue,
10969
11027
  suffix: "calendar-dates-outlined",
@@ -11917,7 +11975,7 @@ var StyledFilledMask = index$a(View)(function (_ref5) {
11917
11975
  backgroundColor: theme.__hd__.pinInput.colors[themeState]
11918
11976
  };
11919
11977
  });
11920
- var StyledHiddenInput = index$a(TextInput$1)(function (_ref6) {
11978
+ var StyledHiddenInput = index$a(TextInput$2)(function (_ref6) {
11921
11979
  var themePinLength = _ref6.themePinLength,
11922
11980
  theme = _ref6.theme;
11923
11981
  var cellWidth = theme.__hd__.pinInput.sizes.cellWidth;
@@ -13029,7 +13087,7 @@ function MultiSelect(_ref) {
13029
13087
  }
13030
13088
  }, /*#__PURE__*/React.createElement(View, {
13031
13089
  pointerEvents: "none"
13032
- }, /*#__PURE__*/React.createElement(TextInput, _extends$1({}, inputProps, {
13090
+ }, /*#__PURE__*/React.createElement(TextInput$1, _extends$1({}, inputProps, {
13033
13091
  label: label,
13034
13092
  value: displayedValue,
13035
13093
  suffix: "arrow-down",
@@ -13077,7 +13135,7 @@ function MultiSelect(_ref) {
13077
13135
  (_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 ? void 0 : _sectionListRef$curre.scrollToLocation(scrollParams);
13078
13136
  }
13079
13137
  }
13080
- }, onQueryChange && /*#__PURE__*/React.createElement(StyledSearchBar, null, /*#__PURE__*/React.createElement(TextInput, {
13138
+ }, onQueryChange && /*#__PURE__*/React.createElement(StyledSearchBar, null, /*#__PURE__*/React.createElement(TextInput$1, {
13081
13139
  editable: true,
13082
13140
  placeholder: "Search",
13083
13141
  suffix: "search-outlined",
@@ -13205,7 +13263,7 @@ var SingleSelect = function SingleSelect(_ref) {
13205
13263
  }
13206
13264
  }, /*#__PURE__*/React.createElement(View, {
13207
13265
  pointerEvents: "none"
13208
- }, /*#__PURE__*/React.createElement(TextInput, _extends$1({}, inputProps, {
13266
+ }, /*#__PURE__*/React.createElement(TextInput$1, _extends$1({}, inputProps, {
13209
13267
  label: label,
13210
13268
  value: displayedValue,
13211
13269
  suffix: "arrow-down",
@@ -13237,7 +13295,7 @@ var SingleSelect = function SingleSelect(_ref) {
13237
13295
  (_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 ? void 0 : _sectionListRef$curre.scrollToLocation(scrollParams);
13238
13296
  }
13239
13297
  }
13240
- }, onQueryChange && /*#__PURE__*/React.createElement(StyledSearchBar, null, /*#__PURE__*/React.createElement(TextInput, {
13298
+ }, onQueryChange && /*#__PURE__*/React.createElement(StyledSearchBar, null, /*#__PURE__*/React.createElement(TextInput$1, {
13241
13299
  editable: true,
13242
13300
  placeholder: "Search",
13243
13301
  suffix: "search-outlined",
@@ -13978,7 +14036,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
13978
14036
  }, /*#__PURE__*/React.createElement(View, {
13979
14037
  pointerEvents: "none",
13980
14038
  testID: "timePickerInputAndroid"
13981
- }, /*#__PURE__*/React.createElement(TextInput, {
14039
+ }, /*#__PURE__*/React.createElement(TextInput$1, {
13982
14040
  label: label,
13983
14041
  value: displayValue,
13984
14042
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -14046,7 +14104,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
14046
14104
  }, /*#__PURE__*/React.createElement(View, {
14047
14105
  pointerEvents: "none",
14048
14106
  testID: "timePickerInputIOS"
14049
- }, /*#__PURE__*/React.createElement(TextInput, {
14107
+ }, /*#__PURE__*/React.createElement(TextInput$1, {
14050
14108
  label: label,
14051
14109
  value: displayValue,
14052
14110
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -14446,10 +14504,12 @@ var ToolbarItem = function ToolbarItem(_ref) {
14446
14504
  _ref$intent = _ref.intent,
14447
14505
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14448
14506
  _ref$disabled = _ref.disabled,
14449
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
14507
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
14508
+ style = _ref.style;
14450
14509
  return /*#__PURE__*/React.createElement(ToolbarItemWrapper, {
14451
14510
  onPress: onPress,
14452
- disabled: disabled
14511
+ disabled: disabled,
14512
+ style: style
14453
14513
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
14454
14514
  icon: icon,
14455
14515
  size: label ? 'medium' : 'large',
@@ -14458,7 +14518,8 @@ var ToolbarItem = function ToolbarItem(_ref) {
14458
14518
  }) : null, label ? /*#__PURE__*/React.createElement(Typography.Text, {
14459
14519
  fontSize: icon ? 'small' : 'large',
14460
14520
  fontWeight: "semi-bold",
14461
- intent: disabled ? 'subdued' : intent
14521
+ intent: disabled ? 'subdued' : intent,
14522
+ maxFontSizeMultiplier: 2
14462
14523
  }, label) : null);
14463
14524
  };
14464
14525
 
@@ -14467,6 +14528,9 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
14467
14528
  align = _ref$align === void 0 ? 'right' : _ref$align,
14468
14529
  _ref$items = _ref.items,
14469
14530
  items = _ref$items === void 0 ? [] : _ref$items;
14531
+ // set maxWidth prevents overflow of items
14532
+ // issue: https://github.com/Thinkei/hero-design/issues/1619
14533
+ var maxWidth = items.length > 0 ? "".concat(100 / items.length, "%") : undefined;
14470
14534
  return /*#__PURE__*/React.createElement(ToolbarGroupWrapper, {
14471
14535
  align: align
14472
14536
  }, items.map(function (_ref2) {
@@ -14481,7 +14545,10 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
14481
14545
  icon: icon,
14482
14546
  intent: intent,
14483
14547
  onPress: onPress,
14484
- disabled: disabled
14548
+ disabled: disabled,
14549
+ style: {
14550
+ maxWidth: maxWidth
14551
+ }
14485
14552
  });
14486
14553
  }));
14487
14554
  };
@@ -30880,4 +30947,4 @@ var index = Object.assign(RichTextEditor$1, {
30880
30947
  Toolbar: EditorToolbar
30881
30948
  });
30882
30949
 
30883
- export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, index$8 as Card, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, index$6 as FAB, Icon, Image, List, PinInput, Progress, CompoundRadio as Radio, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Slider, Spinner, 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, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, workSystemPalette };
30950
+ export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, index$8 as Card, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, index$6 as FAB, Icon, Image, List, PinInput, Progress, CompoundRadio as Radio, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Slider, Spinner, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput$1 as TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, workSystemPalette };
package/lib/index.js CHANGED
@@ -6259,21 +6259,45 @@ var Icon = function Icon(_ref) {
6259
6259
  intent = _ref$intent === void 0 ? 'text' : _ref$intent,
6260
6260
  testID = _ref.testID,
6261
6261
  _ref$spin = _ref.spin,
6262
- spin = _ref$spin === void 0 ? false : _ref$spin;
6262
+ spin = _ref$spin === void 0 ? false : _ref$spin,
6263
+ accessibilityLabel = _ref.accessibilityLabel,
6264
+ accessibilityHint = _ref.accessibilityHint,
6265
+ accessibilityRole = _ref.accessibilityRole,
6266
+ accessibilityState = _ref.accessibilityState,
6267
+ accessibilityValue = _ref.accessibilityValue,
6268
+ accessibilityLiveRegion = _ref.accessibilityLiveRegion,
6269
+ accessibilityElementsHidden = _ref.accessibilityElementsHidden,
6270
+ accessible = _ref.accessible,
6271
+ accessibilityIgnoresInvertColors = _ref.accessibilityIgnoresInvertColors,
6272
+ accessibilityViewIsModal = _ref.accessibilityViewIsModal,
6273
+ accessibilityActions = _ref.accessibilityActions;
6263
6274
  useDeprecation("".concat(icon, " icon is deprecated and will be removed in the next major release, please use ").concat(icon.replace('carat', 'caret'), " instead."), icon.startsWith('carat'));
6264
- return spin ? /*#__PURE__*/React__default["default"].createElement(AnimatedIcon, {
6275
+ var accessibilityProps = {
6276
+ accessibilityLabel: accessibilityLabel,
6277
+ accessibilityHint: accessibilityHint,
6278
+ accessibilityRole: accessibilityRole,
6279
+ accessibilityState: accessibilityState,
6280
+ accessibilityValue: accessibilityValue,
6281
+ accessibilityLiveRegion: accessibilityLiveRegion,
6282
+ accessibilityElementsHidden: accessibilityElementsHidden,
6283
+ accessible: accessible,
6284
+ accessibilityIgnoresInvertColors: accessibilityIgnoresInvertColors,
6285
+ accessibilityViewIsModal: accessibilityViewIsModal,
6286
+ accessibilityActions: accessibilityActions
6287
+ };
6288
+ return spin ? /*#__PURE__*/React__default["default"].createElement(AnimatedIcon, _extends$1({
6265
6289
  name: icon,
6266
6290
  themeIntent: intent,
6267
6291
  themeSize: size,
6268
6292
  style: style,
6269
6293
  testID: testID
6270
- }) : /*#__PURE__*/React__default["default"].createElement(StyledHeroIcon, {
6294
+ }, accessibilityProps)) : /*#__PURE__*/React__default["default"].createElement(StyledHeroIcon, _extends$1({
6271
6295
  name: icon,
6272
6296
  themeIntent: intent,
6273
6297
  themeSize: size,
6274
6298
  style: style,
6275
6299
  testID: testID
6276
- });
6300
+ }, accessibilityProps));
6277
6301
  };
6278
6302
  Icon.List = IconList;
6279
6303
 
@@ -6854,20 +6878,20 @@ var StyledBottomBarText = index$a(Typography.Text)(function (_ref3) {
6854
6878
 
6855
6879
  var isIOS = reactNative.Platform.OS === 'ios';
6856
6880
  var isAndroid = reactNative.Platform.OS === 'android';
6857
- var pick = function pick(keys, props) {
6881
+ function pick(keys, obj) {
6858
6882
  return keys.filter(function (key) {
6859
- return key in props;
6883
+ return key in obj;
6860
6884
  }).reduce(function (result, cur) {
6861
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, props[cur]));
6885
+ return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
6862
6886
  }, {});
6863
- };
6864
- var omit = function omit(keys, props) {
6865
- var result = props;
6887
+ }
6888
+ function omit(keys, obj) {
6889
+ var result = obj;
6866
6890
  keys.forEach(function (key) {
6867
6891
  delete result[key];
6868
6892
  });
6869
6893
  return result;
6870
- };
6894
+ }
6871
6895
 
6872
6896
  var _excluded$f = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
6873
6897
  var getInactiveIcon = function getInactiveIcon(icon) {
@@ -10756,7 +10780,7 @@ var getVariant$1 = function getVariant(_ref) {
10756
10780
  // Fix issue: Placeholder is not shown on iOS when multiline is true
10757
10781
  // https://github.com/callstack/react-native-paper/pull/3331
10758
10782
  var EMPTY_PLACEHOLDER_VALUE = ' ';
10759
- var TextInput = function TextInput(_ref2) {
10783
+ var TextInput = function TextInput(_ref2, ref) {
10760
10784
  var _ref3;
10761
10785
  var label = _ref2.label,
10762
10786
  prefix = _ref2.prefix,
@@ -10796,6 +10820,35 @@ var TextInput = function TextInput(_ref2) {
10796
10820
  });
10797
10821
  var shouldShowMaxLength = maxLength !== undefined;
10798
10822
  var theme = useTheme();
10823
+ var innerTextInput = React__default["default"].useRef();
10824
+ React__default["default"].useImperativeHandle(ref, function () {
10825
+ return {
10826
+ // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
10827
+ getNativeTextInputRef: function getNativeTextInputRef() {
10828
+ return innerTextInput.current;
10829
+ },
10830
+ focus: function focus() {
10831
+ var _innerTextInput$curre;
10832
+ (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 ? void 0 : _innerTextInput$curre.focus();
10833
+ },
10834
+ clear: function clear() {
10835
+ var _innerTextInput$curre2;
10836
+ return (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 ? void 0 : _innerTextInput$curre2.clear();
10837
+ },
10838
+ setNativeProps: function setNativeProps(args) {
10839
+ var _innerTextInput$curre3;
10840
+ return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.setNativeProps(args);
10841
+ },
10842
+ isFocused: function isFocused() {
10843
+ var _innerTextInput$curre4;
10844
+ return ((_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.isFocused()) || false;
10845
+ },
10846
+ blur: function blur() {
10847
+ var _innerTextInput$curre5;
10848
+ return (_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.blur();
10849
+ }
10850
+ };
10851
+ }, [innerTextInput]);
10799
10852
  var _useMemo = React.useMemo(function () {
10800
10853
  if (!textStyle) {
10801
10854
  return {};
@@ -10875,7 +10928,11 @@ var TextInput = function TextInput(_ref2) {
10875
10928
  testID: "input-label",
10876
10929
  fontSize: "medium",
10877
10930
  themeVariant: variant
10878
- }, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
10931
+ }, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
10932
+ ref: function ref(reference) {
10933
+ innerTextInput.current = reference;
10934
+ }
10935
+ }))), typeof actualSuffix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
10879
10936
  intent: variant === 'disabled' ? 'disabled-text' : 'text',
10880
10937
  testID: "input-suffix",
10881
10938
  icon: actualSuffix,
@@ -10893,6 +10950,7 @@ var TextInput = function TextInput(_ref2) {
10893
10950
  fontSize: "small"
10894
10951
  }, displayText.length, "/", maxLength)), !!helpText && /*#__PURE__*/React__default["default"].createElement(StyledHelperText, null, helpText)));
10895
10952
  };
10953
+ var TextInput$1 = /*#__PURE__*/React__default["default"].forwardRef(TextInput);
10896
10954
 
10897
10955
  var DatePickerAndroid = function DatePickerAndroid(_ref) {
10898
10956
  var value = _ref.value,
@@ -10924,7 +10982,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
10924
10982
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
10925
10983
  pointerEvents: "none",
10926
10984
  testID: "datePickerInputAndroid"
10927
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, {
10985
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
10928
10986
  label: label,
10929
10987
  value: displayValue,
10930
10988
  suffix: "calendar-dates-outlined",
@@ -10992,7 +11050,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
10992
11050
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
10993
11051
  pointerEvents: "none",
10994
11052
  testID: "datePickerInputIOS"
10995
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, {
11053
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
10996
11054
  label: label,
10997
11055
  value: displayValue,
10998
11056
  suffix: "calendar-dates-outlined",
@@ -13058,7 +13116,7 @@ function MultiSelect(_ref) {
13058
13116
  }
13059
13117
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
13060
13118
  pointerEvents: "none"
13061
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({}, inputProps, {
13119
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, _extends$1({}, inputProps, {
13062
13120
  label: label,
13063
13121
  value: displayedValue,
13064
13122
  suffix: "arrow-down",
@@ -13106,7 +13164,7 @@ function MultiSelect(_ref) {
13106
13164
  (_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 ? void 0 : _sectionListRef$curre.scrollToLocation(scrollParams);
13107
13165
  }
13108
13166
  }
13109
- }, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput, {
13167
+ }, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
13110
13168
  editable: true,
13111
13169
  placeholder: "Search",
13112
13170
  suffix: "search-outlined",
@@ -13234,7 +13292,7 @@ var SingleSelect = function SingleSelect(_ref) {
13234
13292
  }
13235
13293
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
13236
13294
  pointerEvents: "none"
13237
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({}, inputProps, {
13295
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, _extends$1({}, inputProps, {
13238
13296
  label: label,
13239
13297
  value: displayedValue,
13240
13298
  suffix: "arrow-down",
@@ -13266,7 +13324,7 @@ var SingleSelect = function SingleSelect(_ref) {
13266
13324
  (_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 ? void 0 : _sectionListRef$curre.scrollToLocation(scrollParams);
13267
13325
  }
13268
13326
  }
13269
- }, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput, {
13327
+ }, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
13270
13328
  editable: true,
13271
13329
  placeholder: "Search",
13272
13330
  suffix: "search-outlined",
@@ -14007,7 +14065,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
14007
14065
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
14008
14066
  pointerEvents: "none",
14009
14067
  testID: "timePickerInputAndroid"
14010
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, {
14068
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
14011
14069
  label: label,
14012
14070
  value: displayValue,
14013
14071
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -14075,7 +14133,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
14075
14133
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
14076
14134
  pointerEvents: "none",
14077
14135
  testID: "timePickerInputIOS"
14078
- }, /*#__PURE__*/React__default["default"].createElement(TextInput, {
14136
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput$1, {
14079
14137
  label: label,
14080
14138
  value: displayValue,
14081
14139
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -14475,10 +14533,12 @@ var ToolbarItem = function ToolbarItem(_ref) {
14475
14533
  _ref$intent = _ref.intent,
14476
14534
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14477
14535
  _ref$disabled = _ref.disabled,
14478
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
14536
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
14537
+ style = _ref.style;
14479
14538
  return /*#__PURE__*/React__default["default"].createElement(ToolbarItemWrapper, {
14480
14539
  onPress: onPress,
14481
- disabled: disabled
14540
+ disabled: disabled,
14541
+ style: style
14482
14542
  }, icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
14483
14543
  icon: icon,
14484
14544
  size: label ? 'medium' : 'large',
@@ -14487,7 +14547,8 @@ var ToolbarItem = function ToolbarItem(_ref) {
14487
14547
  }) : null, label ? /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
14488
14548
  fontSize: icon ? 'small' : 'large',
14489
14549
  fontWeight: "semi-bold",
14490
- intent: disabled ? 'subdued' : intent
14550
+ intent: disabled ? 'subdued' : intent,
14551
+ maxFontSizeMultiplier: 2
14491
14552
  }, label) : null);
14492
14553
  };
14493
14554
 
@@ -14496,6 +14557,9 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
14496
14557
  align = _ref$align === void 0 ? 'right' : _ref$align,
14497
14558
  _ref$items = _ref.items,
14498
14559
  items = _ref$items === void 0 ? [] : _ref$items;
14560
+ // set maxWidth prevents overflow of items
14561
+ // issue: https://github.com/Thinkei/hero-design/issues/1619
14562
+ var maxWidth = items.length > 0 ? "".concat(100 / items.length, "%") : undefined;
14499
14563
  return /*#__PURE__*/React__default["default"].createElement(ToolbarGroupWrapper, {
14500
14564
  align: align
14501
14565
  }, items.map(function (_ref2) {
@@ -14510,7 +14574,10 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
14510
14574
  icon: icon,
14511
14575
  intent: intent,
14512
14576
  onPress: onPress,
14513
- disabled: disabled
14577
+ disabled: disabled,
14578
+ style: {
14579
+ maxWidth: maxWidth
14580
+ }
14514
14581
  });
14515
14582
  }));
14516
14583
  };
@@ -30944,7 +31011,7 @@ exports.Swipeable = index$5;
30944
31011
  exports.Switch = index$3;
30945
31012
  exports.Tabs = index$2;
30946
31013
  exports.Tag = Tag;
30947
- exports.TextInput = TextInput;
31014
+ exports.TextInput = TextInput$1;
30948
31015
  exports.ThemeProvider = ThemeProvider;
30949
31016
  exports.ThemeSwitcher = ThemeSwitcher;
30950
31017
  exports.TimePicker = TimePicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.2.2",
3
+ "version": "8.2.3",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.2.2",
24
+ "@hero-design/colors": "8.2.3",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -44,7 +44,7 @@
44
44
  "@babel/preset-typescript": "^7.17.12",
45
45
  "@babel/runtime": "^7.18.9",
46
46
  "@emotion/jest": "^11.9.3",
47
- "@hero-design/eslint-plugin": "8.2.2",
47
+ "@hero-design/eslint-plugin": "8.2.3",
48
48
  "@react-native-community/datetimepicker": "^3.5.2",
49
49
  "@react-native-community/slider": "4.1.12",
50
50
  "@rollup/plugin-babel": "^5.3.1",
@@ -60,9 +60,9 @@
60
60
  "@types/react-native": "^0.67.7",
61
61
  "@types/react-native-vector-icons": "^6.4.10",
62
62
  "babel-plugin-inline-import": "^3.0.0",
63
- "eslint-config-hd": "8.2.2",
63
+ "eslint-config-hd": "8.2.3",
64
64
  "jest": "^27.3.1",
65
- "prettier-config-hd": "8.2.2",
65
+ "prettier-config-hd": "8.2.3",
66
66
  "react": "18.0.0",
67
67
  "react-native": "0.69.7",
68
68
  "react-native-gesture-handler": "~2.1.0",
@@ -1,7 +1,7 @@
1
1
  import styled from '@emotion/native';
2
2
  import { Theme } from '@emotion/react';
3
3
  import { View } from 'react-native';
4
- import { StyleProps, ThemeScale } from './types';
4
+ import { FlexStyleProps, StyleProps, ThemeScale } from './types';
5
5
  import { pick } from '../../utils/helpers';
6
6
  import config, { ConfigType, flexPropsKey } from './config';
7
7
 
@@ -44,10 +44,12 @@ const mapStylePropToThemeValue = (theme: Theme, props: StyleProps) => {
44
44
 
45
45
  const configKeys = Object.keys(config) as Array<keyof ConfigType>;
46
46
 
47
- const StyledBox = styled(View)<StyleProps>(({ theme, ...otherProps }) => {
48
- const styleProps = pick(configKeys, otherProps);
49
- const flexProps = pick([...flexPropsKey], otherProps);
50
- return { ...mapStylePropToThemeValue(theme, styleProps), ...flexProps };
51
- });
47
+ const StyledBox = styled(View)<StyleProps & FlexStyleProps>(
48
+ ({ theme, ...otherProps }) => {
49
+ const styleProps = pick(configKeys, otherProps);
50
+ const flexProps = pick([...flexPropsKey], otherProps);
51
+ return { ...mapStylePropToThemeValue(theme, styleProps), ...flexProps };
52
+ }
53
+ );
52
54
 
53
55
  export { StyledBox };
@@ -2,7 +2,7 @@ import { View } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
 
4
4
  const StyledCard = styled(View)<{
5
- themeIntent?: 'primary' | 'success' | 'warning';
5
+ themeIntent?: 'primary' | 'success' | 'warning' | 'danger' | 'archived';
6
6
  }>(({ theme, themeIntent }) => ({
7
7
  ...(themeIntent !== undefined && {
8
8
  backgroundColor: theme.__hd__.card.colors[themeIntent],