@hero-design/rn 7.1.1 → 7.1.2

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 (36) hide show
  1. package/.eslintrc.json +4 -3
  2. package/es/index.js +283 -113
  3. package/lib/index.js +282 -111
  4. package/package.json +4 -3
  5. package/playground/components/BottomNavigation.tsx +69 -0
  6. package/playground/components/Card.tsx +149 -70
  7. package/playground/index.tsx +3 -0
  8. package/rollup.config.js +1 -1
  9. package/src/components/BottomNavigation/StyledBottomNavigation.tsx +58 -0
  10. package/src/components/BottomNavigation/__tests__/BottomNavigation.spec.tsx +95 -0
  11. package/src/components/BottomNavigation/__tests__/__snapshots__/BottomNavigation.spec.tsx.snap +315 -0
  12. package/src/components/BottomNavigation/index.tsx +169 -0
  13. package/src/components/Icon/utils.ts +6 -0
  14. package/src/components/Typography/Text/StyledText.tsx +5 -1
  15. package/src/components/Typography/Text/index.tsx +1 -1
  16. package/src/index.ts +2 -0
  17. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +16 -0
  18. package/src/theme/components/bottomNavigation.ts +23 -0
  19. package/src/theme/components/typography.ts +1 -0
  20. package/src/theme/index.ts +3 -0
  21. package/src/utils/helpers.ts +4 -0
  22. package/types/playground/components/BottomNavigation.d.ts +2 -0
  23. package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +17 -0
  24. package/types/src/components/BottomNavigation/__tests__/BottomNavigation.spec.d.ts +1 -0
  25. package/types/src/components/BottomNavigation/index.d.ts +40 -0
  26. package/types/src/components/Icon/utils.d.ts +2 -0
  27. package/types/src/components/Typography/Text/StyledText.d.ts +1 -1
  28. package/types/src/components/Typography/Text/index.d.ts +1 -1
  29. package/types/src/index.d.ts +2 -1
  30. package/types/src/theme/components/bottomNavigation.d.ts +17 -0
  31. package/types/src/theme/components/typography.d.ts +1 -0
  32. package/types/src/theme/index.d.ts +2 -0
  33. package/types/src/utils/helpers.d.ts +2 -0
  34. package/.expo/README.md +0 -15
  35. package/.expo/packager-info.json +0 -10
  36. package/.expo/settings.json +0 -10
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var require$$0$1 = require('react-native');
7
+ var reactNativeSafeAreaContext = require('react-native-safe-area-context');
7
8
 
8
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
10
 
@@ -8139,7 +8140,7 @@ Processor$1["default"] = Processor$1;
8139
8140
  Root$2.registerProcessor(Processor$1);
8140
8141
  Document$1.registerProcessor(Processor$1);
8141
8142
 
8142
- var _excluded$4 = ["inputs"],
8143
+ var _excluded$5 = ["inputs"],
8143
8144
  _excluded2 = ["inputId"];
8144
8145
 
8145
8146
  var Declaration$1 = declaration;
@@ -8156,7 +8157,7 @@ function fromJSON$1(json, inputs) {
8156
8157
  });
8157
8158
 
8158
8159
  var ownInputs = json.inputs,
8159
- defaults = _objectWithoutProperties$1(json, _excluded$4);
8160
+ defaults = _objectWithoutProperties$1(json, _excluded$5);
8160
8161
 
8161
8162
  if (ownInputs) {
8162
8163
  inputs = [];
@@ -9981,6 +9982,27 @@ var getBadgeTheme = function getBadgeTheme(theme) {
9981
9982
  };
9982
9983
  };
9983
9984
 
9985
+ var getBottomNavigationTheme = function getBottomNavigationTheme(theme) {
9986
+ var colors = {
9987
+ shadow: theme.colors.backgroundDark,
9988
+ background: theme.colors.platformBackground
9989
+ };
9990
+ var sizes = {
9991
+ height: 72
9992
+ };
9993
+ var shadows = {
9994
+ offset: "0px 3px",
9995
+ opacity: 0.27,
9996
+ radius: "4.65px",
9997
+ elevation: 10
9998
+ };
9999
+ return {
10000
+ colors: colors,
10001
+ shadows: shadows,
10002
+ sizes: sizes
10003
+ };
10004
+ };
10005
+
9984
10006
  var getCardTheme = function getCardTheme(theme) {
9985
10007
  var radii = {
9986
10008
  "default": "12px"
@@ -10040,7 +10062,8 @@ var getIconTheme = function getIconTheme(theme) {
10040
10062
  var getTypographyTheme = function getTypographyTheme(theme) {
10041
10063
  var colors = {
10042
10064
  body: theme.colors.text,
10043
- subdued: theme.colors.disabledText
10065
+ subdued: theme.colors.disabledText,
10066
+ primary: theme.colors.primary
10044
10067
  };
10045
10068
  var fontSizes = {
10046
10069
  small: theme.fontSizes.small,
@@ -10091,6 +10114,7 @@ var getTheme = function getTheme() {
10091
10114
  return _objectSpread2(_objectSpread2({}, theme), {}, {
10092
10115
  __hd__: {
10093
10116
  badge: getBadgeTheme(theme),
10117
+ bottomNavigation: getBottomNavigationTheme(theme),
10094
10118
  card: getCardTheme(theme),
10095
10119
  divider: getDividerTheme(theme),
10096
10120
  icon: getIconTheme(theme),
@@ -10102,14 +10126,14 @@ var getTheme = function getTheme() {
10102
10126
 
10103
10127
  var theme = getTheme();
10104
10128
 
10105
- var _templateObject$6, _templateObject2$3, _templateObject3$2, _templateObject4$2;
10129
+ var _templateObject$7, _templateObject2$4, _templateObject3$3, _templateObject4$3;
10106
10130
  var BACKGROUND_INTENTS = {
10107
10131
  success: 'successBackground',
10108
10132
  warning: 'warningBackground',
10109
10133
  danger: 'dangerBackground',
10110
10134
  info: 'infoBackground'
10111
10135
  };
10112
- var StyledView = styled(require$$0$1.View)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n border-width: ", ";\n border-radius: ", ";\n padding: ", ";\n\n ", ";\n"])), function (_ref) {
10136
+ var StyledView = styled(require$$0$1.View)(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteral(["\n border-width: ", ";\n border-radius: ", ";\n padding: ", ";\n\n ", ";\n"])), function (_ref) {
10113
10137
  var theme = _ref.theme;
10114
10138
  return theme.__hd__.badge.borderWidths["default"];
10115
10139
  }, function (_ref2) {
@@ -10120,7 +10144,7 @@ var StyledView = styled(require$$0$1.View)(_templateObject$6 || (_templateObject
10120
10144
  return theme.__hd__.badge.padding["default"];
10121
10145
  }, function (_ref4) {
10122
10146
  var themeIntent = _ref4.themeIntent;
10123
- return css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: ", ";\n "])), function (_ref5) {
10147
+ return css(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: ", ";\n "])), function (_ref5) {
10124
10148
  var theme = _ref5.theme;
10125
10149
  return theme.__hd__.badge.colors[themeIntent];
10126
10150
  }, function (_ref6) {
@@ -10128,7 +10152,7 @@ var StyledView = styled(require$$0$1.View)(_templateObject$6 || (_templateObject
10128
10152
  return theme.__hd__.badge.colors[BACKGROUND_INTENTS[themeIntent]];
10129
10153
  });
10130
10154
  });
10131
- var StyledText$1 = styled(require$$0$1.Text)(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteral(["\n font-weight: ", ";\n font-size: ", ";\n\n ", ";\n"])), function (_ref7) {
10155
+ var StyledText$1 = styled(require$$0$1.Text)(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteral(["\n font-weight: ", ";\n font-size: ", ";\n\n ", ";\n"])), function (_ref7) {
10132
10156
  var theme = _ref7.theme;
10133
10157
  return theme.__hd__.badge.fontWeights["default"];
10134
10158
  }, function (_ref8) {
@@ -10136,13 +10160,13 @@ var StyledText$1 = styled(require$$0$1.Text)(_templateObject3$2 || (_templateObj
10136
10160
  return theme.__hd__.badge.fontSizes["default"];
10137
10161
  }, function (_ref9) {
10138
10162
  var themeIntent = _ref9.themeIntent;
10139
- return css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteral(["\n color: ", ";\n "])), function (_ref10) {
10163
+ return css(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteral(["\n color: ", ";\n "])), function (_ref10) {
10140
10164
  var theme = _ref10.theme;
10141
10165
  return theme.__hd__.badge.colors[themeIntent];
10142
10166
  });
10143
10167
  });
10144
10168
 
10145
- var _excluded$3 = ["content", "intent", "style", "testID"];
10169
+ var _excluded$4 = ["content", "intent", "style", "testID"];
10146
10170
 
10147
10171
  var Badge = function Badge(_ref) {
10148
10172
  var content = _ref.content,
@@ -10150,7 +10174,7 @@ var Badge = function Badge(_ref) {
10150
10174
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
10151
10175
  style = _ref.style,
10152
10176
  testID = _ref.testID,
10153
- nativeProps = _objectWithoutProperties$1(_ref, _excluded$3);
10177
+ nativeProps = _objectWithoutProperties$1(_ref, _excluded$4);
10154
10178
 
10155
10179
  return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({
10156
10180
  themeIntent: intent,
@@ -10161,91 +10185,6 @@ var Badge = function Badge(_ref) {
10161
10185
  }, content));
10162
10186
  };
10163
10187
 
10164
- var _templateObject$5;
10165
- var StyledCard = styled(require$$0$1.View)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n padding: ", ";\n overflow: hidden;\n"])), function (_ref) {
10166
- var theme = _ref.theme;
10167
- return theme.__hd__.card.radii["default"];
10168
- }, function (_ref2) {
10169
- var theme = _ref2.theme;
10170
- return theme.__hd__.card.padding["default"];
10171
- });
10172
-
10173
- var Card = function Card(props) {
10174
- return /*#__PURE__*/React__default["default"].createElement(StyledCard, props);
10175
- };
10176
-
10177
- var _templateObject$4, _templateObject2$2, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11, _templateObject12, _templateObject13;
10178
- var StyledDivider = styled(require$$0$1.View)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n border-bottom-width: ", ";\n border-bottom-color: ", ";\n max-width: 100%;\n\n ", "\n\n ", "\n"])), function (_ref) {
10179
- var theme = _ref.theme;
10180
- return theme.__hd__.divider.borderWidths["default"];
10181
- }, function (_ref2) {
10182
- var theme = _ref2.theme;
10183
- return theme.__hd__.divider.colors["default"];
10184
- }, function (_ref3) {
10185
- var themeMarginHorizontal = _ref3.themeMarginHorizontal,
10186
- theme = _ref3.theme;
10187
-
10188
- switch (themeMarginHorizontal) {
10189
- case undefined:
10190
- return css(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral([""])));
10191
-
10192
- case 'xsmall':
10193
- return css(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xsmall);
10194
-
10195
- case 'small':
10196
- return css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.small);
10197
-
10198
- case 'medium':
10199
- return css(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.medium);
10200
-
10201
- case 'large':
10202
- return css(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.large);
10203
-
10204
- case 'xlarge':
10205
- return css(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xlarge);
10206
- }
10207
- }, function (_ref4) {
10208
- var themeMarginVertical = _ref4.themeMarginVertical,
10209
- theme = _ref4.theme;
10210
-
10211
- switch (themeMarginVertical) {
10212
- case undefined:
10213
- return css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral([""])));
10214
-
10215
- case 'xsmall':
10216
- return css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xsmall);
10217
-
10218
- case 'small':
10219
- return css(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.small);
10220
-
10221
- case 'medium':
10222
- return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.medium);
10223
-
10224
- case 'large':
10225
- return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.large);
10226
-
10227
- case 'xlarge':
10228
- return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xlarge);
10229
- }
10230
- });
10231
-
10232
- var _excluded$2 = ["marginHorizontal", "marginVertical", "style", "testID"];
10233
-
10234
- var Divider = function Divider(_ref) {
10235
- var marginHorizontal = _ref.marginHorizontal,
10236
- marginVertical = _ref.marginVertical,
10237
- style = _ref.style,
10238
- testID = _ref.testID,
10239
- nativeProps = _objectWithoutProperties$1(_ref, _excluded$2);
10240
-
10241
- return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({
10242
- themeMarginHorizontal: marginHorizontal,
10243
- themeMarginVertical: marginVertical,
10244
- style: style,
10245
- testID: testID
10246
- }, nativeProps));
10247
- };
10248
-
10249
10188
  var dist = {};
10250
10189
 
10251
10190
  function _interopRequireDefault$5(obj) {
@@ -19874,12 +19813,12 @@ var heroIconConfig = {
19874
19813
  preferences: preferences
19875
19814
  };
19876
19815
 
19877
- var _templateObject$3, _templateObject2$1;
19816
+ var _templateObject$6, _templateObject2$3;
19878
19817
  var HeroIcon = dist.createIconSetFromIcoMoon(heroIconConfig, 'hero-icons', 'hero-icons.ttf');
19879
- var StyledHeroIcon = styled(HeroIcon)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
19818
+ var StyledHeroIcon = styled(HeroIcon)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
19880
19819
  var themeIntent = _ref.themeIntent,
19881
19820
  themeSize = _ref.themeSize;
19882
- return css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", "px;\n "])), function (_ref2) {
19821
+ return css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", "px;\n "])), function (_ref2) {
19883
19822
  var theme = _ref2.theme;
19884
19823
  return theme.__hd__.icon.colors[themeIntent];
19885
19824
  }, function (_ref3) {
@@ -19905,23 +19844,29 @@ var Icon = function Icon(_ref) {
19905
19844
  });
19906
19845
  };
19907
19846
 
19908
- var _templateObject$2, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
19909
- var StyledText = styled(require$$0$1.Text)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
19847
+ var IconList = ['activate', 'add-person', 'adjustment', 'alignment', 'bank', 'bell', 'billing', 'bookmark', 'box-check', 'box', 'buildings', 'cake', 'calendar-clock', 'calendar', 'carat-down-small', 'carat-down', 'carat-left', 'carat-right', 'carat-up', 'circle-add', 'circle-cancel', 'circle-check', 'circle-down', 'circle-info', 'circle-left', 'circle-ok', 'circle-pencil', 'circle-question', 'circle-remove', 'circle-right', 'circle-up', 'circle-warning', 'clock', 'cloud-download', 'cloud-upload', 'cog', 'coin', 'contacts', 'credit-card', 'diamond', 'direction-arrows', 'directory', 'document', 'dollar-coin-shine', 'double-buildings', 'edit-template', 'envelope', 'expense', 'eye-circle', 'eye-invisible', 'eye', 'face-meh', 'face-sad', 'face-smiley', 'feed', 'feedbacks', 'file-certified', 'file-clone', 'file-copy', 'file-csv', 'file-dispose', 'file-doc', 'file-excel', 'file-export', 'file-lock', 'file-pdf', 'file-powerpoint', 'file-search', 'file-secured', 'file-sheets', 'file-slide', 'file-verified', 'file-word', 'file', 'folder-user', 'folder', 'funnel-filter', 'global-dollar', 'globe', 'graduation-cap', 'graph', 'happy-sun', 'health-bag', 'heart', 'home', 'image', 'import', 'incident-siren', 'instapay', 'list', 'loading', 'loading-2', 'location', 'lock', 'media-content', 'menu', 'moneybag', 'moon', 'multiple-stars', 'multiple-users', 'node', 'open-folder', 'paperclip', 'payment-summary', 'pencil', 'phone', 'piggy-bank', 'plane', 'play-circle', 'print', 'raising-hands', 'reply', 'reschedule', 'rostering', 'save', 'schedule', 'search-person', 'send', 'speaker', 'star-medal', 'star', 'steps-circle', 'stopwatch', 'suitcase', 'survey', 'switch', 'tag', 'target', 'teams', 'timesheet', 'touch-id', 'trash-bin', 'unlock', 'user', 'video-1', 'video-2', 'activate-outlined', 'add-person-outlined', 'add-section-outlined', 'add-time-outlined', 'add', 'adjustment-outlined', 'alignment-2-outlined', 'alignment-outlined', 'all-caps', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'at-sign', 'bell-outlined', 'billing-outlined', 'body-outlined', 'bold', 'bookmark-outlined', 'box-check-outlined', 'box-outlined', 'bullet-points', 'cake-outlined', 'calendar-dates-outlined', 'calendar-star-outlined', 'camera-outlined', 'cancel', 'checkmark', 'circle-add-outlined', 'circle-cancel-outlined', 'circle-down-outlined', 'circle-info-outlined', 'circle-left-outlined', 'circle-ok-outlined', 'circle-question-outlined', 'circle-remove-outlined', 'circle-right-outlined', 'circle-up-outlined', 'circle-warning-outlined', 'clock-2-outlined', 'clock-outlined', 'cog-outlined', 'coin-outlined', 'comment-outlined', 'contacts-outlined', 'credit-card-outlined', 'direction-arrows-outlined', 'directory-outlined', 'document-outlined', 'dollar-coin-shine-outlined', 'dollar-sign', 'double-buildings-outlined', 'double-left-arrows', 'double-right-arrows', 'download-outlined', 'edit-template-outlined', 'email-outlined', 'enter-arrow', 'envelope-outlined', 'expense-outlined', 'external-link', 'eye-invisible-outlined', 'eye-outlined', 'face-id', 'face-meh-outlined', 'face-open-smiley-outlined', 'face-sad-outlined', 'face-smiley-outlined', 'feed-outlined', 'file-certified-outlined', 'file-clone-outlined', 'file-copy-outlined', 'file-dispose-outlined', 'file-download-outlined', 'file-export-outlined', 'file-lock-outlined', 'file-outlined', 'file-search-outlined', 'file-secured-outlined', 'file-verified-outlined', 'folder-outlined', 'folder-user-outlined', 'funnel-filter-outline', 'graph-outlined', 'happy-sun-outlined', 'health-bag-outlined', 'heart-outlined', 'home-outlined', 'image-outlined', 'import-outlined', 'instapay-outlined', 'italic', 'link-1', 'link-2', 'list-outlined', 'location-outlined', 'lock-outlined', 'locked-file-outlined', 'log-out', 'media-content-outlined', 'menu-close', 'menu-expand', 'menu-fold-outlined', 'menu-unfold-outlined', 'moneybag-outlined', 'moon-outlined', 'more-horizontal', 'more-vertical', 'multiple-folders-outlined', 'multiple-users-outlined', 'node-outlined', 'number-points', 'number', 'payment-summary-outlined', 'payslip-outlined', 'pencil-outlined', 'percentage', 'phone-outlined', 'piggy-bank-outlined', 'plane-outlined', 'play-circle-outlined', 'print-outlined', 'qr-code-outlined', 're-assign', 'refresh', 'remove', 'reply-outlined', 'restart', 'return-arrow', 'rostering-outlined', 'save-outlined', 'schedule-outlined', 'search-outlined', 'send-outlined', 'share-1', 'share-2', 'single-down-arrow', 'single-left-arrow', 'single-right-arrow', 'single-up-arrow', 'speaker-outlined', 'star-outlined', 'stopwatch-outlined', 'strikethrough', 'survey-outlined', 'switch-outlined', 'sync', 'target-outlined', 'timesheet-outlined', 'transfer', 'trash-bin-outlined', 'unavailable', 'underline', 'unlock-outlined', 'upload-outlined', 'user-outlined', 'video-1-outlined', 'video-2-outlined'];
19848
+
19849
+ var isHeroIcon = function isHeroIcon(x) {
19850
+ return IconList.includes(x);
19851
+ };
19852
+
19853
+ var _templateObject$5, _templateObject2$2, _templateObject3$2, _templateObject4$2, _templateObject5$2, _templateObject6$2, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1;
19854
+ var StyledText = styled(require$$0$1.Text)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
19910
19855
  var themeFontSize = _ref.themeFontSize,
19911
19856
  theme = _ref.theme;
19912
19857
 
19913
19858
  switch (themeFontSize) {
19914
19859
  case 'small':
19915
- return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.small, theme.__hd__.typography.lineHeights.small, theme.__hd__.typography.fontSizes.small * 0.03);
19860
+ return css(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.small, theme.__hd__.typography.lineHeights.small, theme.__hd__.typography.fontSizes.small * 0.03);
19916
19861
 
19917
19862
  case 'medium':
19918
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.medium, theme.__hd__.typography.lineHeights.medium, theme.__hd__.typography.fontSizes.medium * 0.03);
19863
+ return css(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.medium, theme.__hd__.typography.lineHeights.medium, theme.__hd__.typography.fontSizes.medium * 0.03);
19919
19864
 
19920
19865
  case 'large':
19921
- return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.large, theme.__hd__.typography.lineHeights.large, theme.__hd__.typography.fontSizes.large * 0.03);
19866
+ return css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.large, theme.__hd__.typography.lineHeights.large, theme.__hd__.typography.fontSizes.large * 0.03);
19922
19867
 
19923
19868
  case 'xlarge':
19924
- return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.xlarge, theme.__hd__.typography.lineHeights.xlarge, theme.__hd__.typography.fontSizes.xlarge * 0.03);
19869
+ return css(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n letter-spacing: ", "px;\n "])), theme.__hd__.typography.fontSizes.xlarge, theme.__hd__.typography.lineHeights.xlarge, theme.__hd__.typography.fontSizes.xlarge * 0.03);
19925
19870
  }
19926
19871
  }, function (_ref2) {
19927
19872
  var themeFontWeight = _ref2.themeFontWeight,
@@ -19929,13 +19874,13 @@ var StyledText = styled(require$$0$1.Text)(_templateObject$2 || (_templateObject
19929
19874
 
19930
19875
  switch (themeFontWeight) {
19931
19876
  case 'light':
19932
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.light);
19877
+ return css(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.light);
19933
19878
 
19934
19879
  case 'regular':
19935
- return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.regular);
19880
+ return css(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.regular);
19936
19881
 
19937
19882
  case 'semi-bold':
19938
- return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.semiBold);
19883
+ return css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral(["\n font-weight: ", ";\n "])), theme.__hd__.typography.fontWeights.semiBold);
19939
19884
  }
19940
19885
  }, function (_ref3) {
19941
19886
  var themeIntent = _ref3.themeIntent,
@@ -19943,14 +19888,17 @@ var StyledText = styled(require$$0$1.Text)(_templateObject$2 || (_templateObject
19943
19888
 
19944
19889
  switch (themeIntent) {
19945
19890
  case 'body':
19946
- return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.__hd__.typography.colors.body);
19891
+ return css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.__hd__.typography.colors.body);
19947
19892
 
19948
19893
  case 'subdued':
19949
- return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.__hd__.typography.colors.subdued);
19894
+ return css(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.__hd__.typography.colors.subdued);
19895
+
19896
+ case 'primary':
19897
+ return css(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.__hd__.typography.colors.primary);
19950
19898
  }
19951
19899
  });
19952
19900
 
19953
- var _excluded$1 = ["children", "fontSize", "fontWeight", "intent"];
19901
+ var _excluded$3 = ["children", "fontSize", "fontWeight", "intent"];
19954
19902
 
19955
19903
  var Text = function Text(_ref) {
19956
19904
  var children = _ref.children,
@@ -19960,7 +19908,7 @@ var Text = function Text(_ref) {
19960
19908
  fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
19961
19909
  _ref$intent = _ref.intent,
19962
19910
  intent = _ref$intent === void 0 ? 'body' : _ref$intent,
19963
- nativeProps = _objectWithoutProperties$1(_ref, _excluded$1);
19911
+ nativeProps = _objectWithoutProperties$1(_ref, _excluded$3);
19964
19912
 
19965
19913
  return /*#__PURE__*/React__default["default"].createElement(StyledText, _extends$1({
19966
19914
  themeFontSize: fontSize,
@@ -19973,6 +19921,228 @@ var Typography = {
19973
19921
  Text: Text
19974
19922
  };
19975
19923
 
19924
+ var _templateObject$4, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1;
19925
+ var BottomNavigationTab = styled(require$$0$1.View)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n flex: 1;\n display: ", ";\n"])), function (_ref) {
19926
+ var themeVisibility = _ref.themeVisibility;
19927
+ return themeVisibility === false ? 'none' : 'flex';
19928
+ });
19929
+ var BottomNavigationContainer = styled(require$$0$1.View)(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n flex: 1;\n overflow: hidden;\n"])));
19930
+ var ContentWrapper = styled(require$$0$1.View)(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n flex: 1;\n"])));
19931
+ var BottomBarWrapper = styled(require$$0$1.View)(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n height: ", "px;\n padding-bottom: ", "px;\n padding-left: ", "px;\n padding-right: ", "px;\n background-color: ", ";\n shadow-color: ", ";\n shadow-offset: ", ";\n shadow-opacity: ", ";\n shadow-radius: ", ";\n elevation: ", ";\n"])), function (_ref2) {
19932
+ var theme = _ref2.theme,
19933
+ themeInsets = _ref2.themeInsets;
19934
+ return theme.__hd__.bottomNavigation.sizes.height + themeInsets.bottom;
19935
+ }, function (_ref3) {
19936
+ var themeInsets = _ref3.themeInsets;
19937
+ return themeInsets.bottom;
19938
+ }, function (_ref4) {
19939
+ var themeInsets = _ref4.themeInsets;
19940
+ return Math.max(themeInsets.left, themeInsets.right);
19941
+ }, function (_ref5) {
19942
+ var themeInsets = _ref5.themeInsets;
19943
+ return Math.max(themeInsets.left, themeInsets.right);
19944
+ }, function (_ref6) {
19945
+ var theme = _ref6.theme;
19946
+ return theme.__hd__.bottomNavigation.colors.background;
19947
+ }, function (_ref7) {
19948
+ var theme = _ref7.theme;
19949
+ return theme.__hd__.bottomNavigation.colors.shadow;
19950
+ }, function (_ref8) {
19951
+ var theme = _ref8.theme;
19952
+ return theme.__hd__.bottomNavigation.shadows.offset;
19953
+ }, function (_ref9) {
19954
+ var theme = _ref9.theme;
19955
+ return theme.__hd__.bottomNavigation.shadows.opacity;
19956
+ }, function (_ref10) {
19957
+ var theme = _ref10.theme;
19958
+ return theme.__hd__.bottomNavigation.shadows.radius;
19959
+ }, function (_ref11) {
19960
+ var theme = _ref11.theme;
19961
+ return theme.__hd__.bottomNavigation.shadows.elevation;
19962
+ });
19963
+ var BottomBar = styled(require$$0$1.View)(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n flex: 1;\n flex-direction: row;\n overflow: hidden;\n align-items: center;\n"])));
19964
+ var BottomBarItem = styled(require$$0$1.View)(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["\n flex: 1;\n align-items: center;\n"])));
19965
+
19966
+ var isIOS = require$$0$1.Platform.OS === 'ios';
19967
+ require$$0$1.Platform.OS === 'android';
19968
+
19969
+ var _excluded$2 = ["onChange", "renderActiveTabOnly", "selectedTabKey", "tabs"];
19970
+
19971
+ var getInactiveIcon = function getInactiveIcon(icon) {
19972
+ var inactiveIcon = "".concat(icon, "-outlined");
19973
+ return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
19974
+ };
19975
+
19976
+ var BottomNavigation = function BottomNavigation(_ref) {
19977
+ var onChange = _ref.onChange,
19978
+ _ref$renderActiveTabO = _ref.renderActiveTabOnly,
19979
+ renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
19980
+ selectedTabKey = _ref.selectedTabKey,
19981
+ tabs = _ref.tabs,
19982
+ nativeProps = _objectWithoutProperties$1(_ref, _excluded$2);
19983
+
19984
+ var theme = useTheme();
19985
+ var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
19986
+ /**
19987
+ * List of loaded tabs, tabs will be loaded when navigated to.
19988
+ */
19989
+
19990
+ var _React$useState = React__default["default"].useState([selectedTabKey]),
19991
+ _React$useState2 = _slicedToArray(_React$useState, 2),
19992
+ loaded = _React$useState2[0],
19993
+ setLoaded = _React$useState2[1];
19994
+
19995
+ if (!loaded.includes(selectedTabKey)) {
19996
+ // Set the current tab to be loaded if it was not loaded before
19997
+ setLoaded(function (loadedState) {
19998
+ return [].concat(_toConsumableArray$1(loadedState), [selectedTabKey]);
19999
+ });
20000
+ }
20001
+
20002
+ return /*#__PURE__*/React__default["default"].createElement(BottomNavigationContainer, nativeProps, /*#__PURE__*/React__default["default"].createElement(ContentWrapper, null, tabs.map(function (tab) {
20003
+ var key = tab.key,
20004
+ component = tab.component;
20005
+ var active = selectedTabKey === key;
20006
+
20007
+ if (renderActiveTabOnly && !active) {
20008
+ return null;
20009
+ }
20010
+
20011
+ if (!loaded.includes(key)) {
20012
+ // Don't render a screen if we've never navigated to it
20013
+ return null;
20014
+ }
20015
+
20016
+ return /*#__PURE__*/React__default["default"].createElement(BottomNavigationTab, {
20017
+ key: key,
20018
+ testID: "route-screen-".concat(selectedTabKey),
20019
+ pointerEvents: active ? 'auto' : 'none',
20020
+ accessibilityElementsHidden: !active,
20021
+ importantForAccessibility: active ? 'auto' : 'no-hide-descendants',
20022
+ collapsable: false,
20023
+ removeClippedSubviews: // On iOS, set removeClippedSubviews to true only when not focused
20024
+ // This is an workaround for a bug where the clipped view never re-appears.
20025
+ isIOS ? selectedTabKey !== key : true,
20026
+ themeVisibility: active
20027
+ }, component);
20028
+ })), /*#__PURE__*/React__default["default"].createElement(BottomBarWrapper, {
20029
+ themeInsets: insets
20030
+ }, /*#__PURE__*/React__default["default"].createElement(BottomBar, null, tabs.map(function (tab) {
20031
+ var key = tab.key,
20032
+ icon = tab.icon,
20033
+ title = tab.title,
20034
+ testID = tab.testID;
20035
+ var active = selectedTabKey === key;
20036
+ var inactiveIcon = getInactiveIcon(icon);
20037
+ return /*#__PURE__*/React__default["default"].createElement(require$$0$1.TouchableWithoutFeedback, {
20038
+ key: key,
20039
+ onPress: function onPress() {
20040
+ if (key !== selectedTabKey) {
20041
+ onChange(key);
20042
+ }
20043
+ },
20044
+ testID: testID
20045
+ }, /*#__PURE__*/React__default["default"].createElement(BottomBarItem, null, /*#__PURE__*/React__default["default"].createElement(Icon, {
20046
+ icon: active ? icon : inactiveIcon,
20047
+ intent: active ? 'primary' : 'text',
20048
+ testID: "hero-icon-".concat(icon)
20049
+ }), title && /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
20050
+ fontSize: "small",
20051
+ fontWeight: "semi-bold",
20052
+ intent: active ? 'primary' : 'body',
20053
+ style: {
20054
+ marginTop: theme.space.xsmall
20055
+ },
20056
+ numberOfLines: 1
20057
+ }, title)));
20058
+ }))));
20059
+ };
20060
+
20061
+ var _templateObject$3;
20062
+ var StyledCard = styled(require$$0$1.View)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n border-radius: ", ";\n padding: ", ";\n overflow: hidden;\n"])), function (_ref) {
20063
+ var theme = _ref.theme;
20064
+ return theme.__hd__.card.radii["default"];
20065
+ }, function (_ref2) {
20066
+ var theme = _ref2.theme;
20067
+ return theme.__hd__.card.padding["default"];
20068
+ });
20069
+
20070
+ var Card = function Card(props) {
20071
+ return /*#__PURE__*/React__default["default"].createElement(StyledCard, props);
20072
+ };
20073
+
20074
+ var _templateObject$2, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
20075
+ var StyledDivider = styled(require$$0$1.View)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n border-bottom-width: ", ";\n border-bottom-color: ", ";\n max-width: 100%;\n\n ", "\n\n ", "\n"])), function (_ref) {
20076
+ var theme = _ref.theme;
20077
+ return theme.__hd__.divider.borderWidths["default"];
20078
+ }, function (_ref2) {
20079
+ var theme = _ref2.theme;
20080
+ return theme.__hd__.divider.colors["default"];
20081
+ }, function (_ref3) {
20082
+ var themeMarginHorizontal = _ref3.themeMarginHorizontal,
20083
+ theme = _ref3.theme;
20084
+
20085
+ switch (themeMarginHorizontal) {
20086
+ case undefined:
20087
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
20088
+
20089
+ case 'xsmall':
20090
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xsmall);
20091
+
20092
+ case 'small':
20093
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.small);
20094
+
20095
+ case 'medium':
20096
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.medium);
20097
+
20098
+ case 'large':
20099
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.large);
20100
+
20101
+ case 'xlarge':
20102
+ return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xlarge);
20103
+ }
20104
+ }, function (_ref4) {
20105
+ var themeMarginVertical = _ref4.themeMarginVertical,
20106
+ theme = _ref4.theme;
20107
+
20108
+ switch (themeMarginVertical) {
20109
+ case undefined:
20110
+ return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral([""])));
20111
+
20112
+ case 'xsmall':
20113
+ return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xsmall);
20114
+
20115
+ case 'small':
20116
+ return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.small);
20117
+
20118
+ case 'medium':
20119
+ return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.medium);
20120
+
20121
+ case 'large':
20122
+ return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.large);
20123
+
20124
+ case 'xlarge':
20125
+ return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xlarge);
20126
+ }
20127
+ });
20128
+
20129
+ var _excluded$1 = ["marginHorizontal", "marginVertical", "style", "testID"];
20130
+
20131
+ var Divider = function Divider(_ref) {
20132
+ var marginHorizontal = _ref.marginHorizontal,
20133
+ marginVertical = _ref.marginVertical,
20134
+ style = _ref.style,
20135
+ testID = _ref.testID,
20136
+ nativeProps = _objectWithoutProperties$1(_ref, _excluded$1);
20137
+
20138
+ return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({
20139
+ themeMarginHorizontal: marginHorizontal,
20140
+ themeMarginVertical: marginVertical,
20141
+ style: style,
20142
+ testID: testID
20143
+ }, nativeProps));
20144
+ };
20145
+
19976
20146
  var _templateObject$1;
19977
20147
  var StyledFABIcon = styled(Icon)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n"])), function (_ref) {
19978
20148
  var theme = _ref.theme;
@@ -20050,6 +20220,7 @@ var FAB = function FAB(_ref) {
20050
20220
  };
20051
20221
 
20052
20222
  exports.Badge = Badge;
20223
+ exports.BottomNavigation = BottomNavigation;
20053
20224
  exports.Card = Card;
20054
20225
  exports.Divider = Divider;
20055
20226
  exports.FAB = FAB;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
- "types": "types/index.d.ts",
7
+ "types": "types/src/index.d.ts",
8
8
  "scripts": {
9
9
  "lint": "eslint src playground --ext .js,.jsx,.ts,.tsx --ignore-path ../../.gitignore",
10
10
  "type-check": "tsc --noEmit",
@@ -18,12 +18,13 @@
18
18
  "publish:npm": "yarn publish --access public"
19
19
  },
20
20
  "dependencies": {
21
- "@hero-design/colors": "7.1.1",
21
+ "@hero-design/colors": "7.1.2",
22
22
  "styled-components": "6.0.0-alpha.5"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "17.0.2",
26
26
  "react-native": "0.65.1",
27
+ "react-native-safe-area-context": "^4.2.5",
27
28
  "react-native-vector-icons": "^9.1.0"
28
29
  },
29
30
  "devDependencies": {