@hero-design/rn 7.0.5 → 7.1.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/babel.config.js +1 -1
- package/es/index.js +150 -41
- package/lib/index.js +149 -38
- package/package.json +3 -3
- package/playground/components/Card.tsx +74 -91
- package/playground/components/FAB.tsx +49 -0
- package/playground/index.tsx +3 -1
- package/src/components/Card/StyledCard.tsx +1 -0
- package/src/components/Card/__tests__/__snapshots__/Card.spec.tsx.snap +5 -4
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +5 -4
- package/src/components/FAB/AnimatedFABIcon.tsx +47 -0
- package/src/components/FAB/StyledFABContainer.tsx +14 -0
- package/src/components/FAB/StyledFABIcon.tsx +9 -0
- package/src/components/FAB/__tests__/AnimatedFABIcon.spec.tsx +20 -0
- package/src/components/FAB/__tests__/StyledFABContainer.spec.tsx +18 -0
- package/src/components/FAB/__tests__/StyledFABIcon.spec.tsx +16 -0
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +71 -0
- package/src/components/FAB/__tests__/__snapshots__/StyledFABContainer.spec.tsx.snap +46 -0
- package/src/components/FAB/__tests__/__snapshots__/StyledFABIcon.spec.tsx.snap +21 -0
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +120 -0
- package/src/components/FAB/__tests__/index.spec.tsx +58 -0
- package/src/components/FAB/index.tsx +56 -0
- package/src/components/Icon/index.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +14 -1
- package/src/theme/components/card.ts +1 -1
- package/src/theme/components/fab.ts +21 -0
- package/src/theme/global/space.ts +11 -9
- package/src/theme/global/typography.ts +11 -9
- package/src/theme/index.ts +3 -0
- package/src/utils/__tests__/scale.spec.ts +26 -0
- package/src/utils/scale.ts +10 -0
- package/testUtils/setup.ts +4 -0
- package/types/playground/components/FAB.d.ts +2 -0
- package/types/src/components/FAB/AnimatedFABIcon.d.ts +6 -0
- package/types/src/components/FAB/StyledFABContainer.d.ts +3 -0
- package/types/src/components/FAB/StyledFABIcon.d.ts +3 -0
- package/types/{components/ExampleComponent/__tests__/StyledView.spec.d.ts → src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts} +0 -0
- package/types/src/components/{Typography/Text/__test__/StyledText.spec.d.ts → FAB/__tests__/StyledFABContainer.spec.d.ts} +0 -0
- package/types/src/components/{Typography/Text/__test__/index.spec.d.ts → FAB/__tests__/StyledFABIcon.spec.d.ts} +0 -0
- package/types/src/components/FAB/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/FAB/index.d.ts +30 -0
- package/types/src/components/Icon/index.d.ts +1 -1
- package/types/src/index.d.ts +3 -1
- package/types/src/theme/components/fab.d.ts +15 -0
- package/types/src/theme/index.d.ts +2 -0
- package/types/src/utils/__tests__/scale.spec.d.ts +1 -0
- package/types/src/utils/scale.d.ts +2 -0
- package/types/components/ExampleComponent/StyledView.d.ts +0 -7
- package/types/components/ExampleComponent/index.d.ts +0 -16
- package/types/index.d.ts +0 -4
- package/types/styled-components.d.ts +0 -6
- package/types/theme/colors.d.ts +0 -24
- package/types/theme/components/demoStyle.d.ts +0 -11
- package/types/theme/components/exampleComponent.d.ts +0 -14
- package/types/theme/global/colors.d.ts +0 -24
- package/types/theme/global/index.d.ts +0 -58
- package/types/theme/global/space.d.ts +0 -12
- package/types/theme/global/typography.d.ts +0 -21
- package/types/theme/index.d.ts +0 -11
- package/types/theme/space.d.ts +0 -12
- package/types/theme/typography.d.ts +0 -21
package/lib/index.js
CHANGED
|
@@ -8139,7 +8139,7 @@ Processor$1["default"] = Processor$1;
|
|
|
8139
8139
|
Root$2.registerProcessor(Processor$1);
|
|
8140
8140
|
Document$1.registerProcessor(Processor$1);
|
|
8141
8141
|
|
|
8142
|
-
var _excluded$
|
|
8142
|
+
var _excluded$4 = ["inputs"],
|
|
8143
8143
|
_excluded2 = ["inputId"];
|
|
8144
8144
|
|
|
8145
8145
|
var Declaration$1 = declaration;
|
|
@@ -8156,7 +8156,7 @@ function fromJSON$1(json, inputs) {
|
|
|
8156
8156
|
});
|
|
8157
8157
|
|
|
8158
8158
|
var ownInputs = json.inputs,
|
|
8159
|
-
defaults = _objectWithoutProperties$1(json, _excluded$
|
|
8159
|
+
defaults = _objectWithoutProperties$1(json, _excluded$4);
|
|
8160
8160
|
|
|
8161
8161
|
if (ownInputs) {
|
|
8162
8162
|
inputs = [];
|
|
@@ -9789,6 +9789,7 @@ var palette = {
|
|
|
9789
9789
|
greenDark30: '#017d6d',
|
|
9790
9790
|
greenDark75: '#002d27',
|
|
9791
9791
|
greenLight30: '#4dcaba',
|
|
9792
|
+
greenLight75: '#c0ece6',
|
|
9792
9793
|
greenLight90: '#e6f7f5',
|
|
9793
9794
|
grey: '#a3a6ac',
|
|
9794
9795
|
greyDark15: '#8b8d92',
|
|
@@ -9828,6 +9829,7 @@ var palette = {
|
|
|
9828
9829
|
redDark15: '#bd2d09',
|
|
9829
9830
|
redDark30: '#9b2508',
|
|
9830
9831
|
redDark75: '#380d03',
|
|
9832
|
+
redLight15: '#e35330',
|
|
9831
9833
|
redLight30: '#e87254',
|
|
9832
9834
|
redLight60: '#f2ae9d',
|
|
9833
9835
|
redLight75: '#f7cdc2',
|
|
@@ -9879,30 +9881,41 @@ var systemPalette = {
|
|
|
9879
9881
|
outline: palette.greyLight60
|
|
9880
9882
|
};
|
|
9881
9883
|
|
|
9884
|
+
var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
|
|
9885
|
+
|
|
9886
|
+
var scale = function scale(size) {
|
|
9887
|
+
var _Dimensions$get = require$$0$1.Dimensions.get('window'),
|
|
9888
|
+
width = _Dimensions$get.width,
|
|
9889
|
+
height = _Dimensions$get.height;
|
|
9890
|
+
|
|
9891
|
+
var shortDimension = width < height ? width : height;
|
|
9892
|
+
return shortDimension / BASE_WIDTH * size;
|
|
9893
|
+
};
|
|
9894
|
+
|
|
9882
9895
|
var BASE$1 = 8;
|
|
9883
9896
|
var space = {
|
|
9884
|
-
xxsmall: BASE$1 * 0.25,
|
|
9885
|
-
xsmall: BASE$1 * 0.5,
|
|
9886
|
-
small: BASE$1,
|
|
9887
|
-
medium: BASE$1 * 2,
|
|
9888
|
-
large: BASE$1 * 3,
|
|
9889
|
-
xlarge: BASE$1 * 4,
|
|
9890
|
-
xxlarge: BASE$1 * 5,
|
|
9891
|
-
xxxlarge: BASE$1 * 6,
|
|
9892
|
-
xxxxlarge: BASE$1 * 7
|
|
9897
|
+
xxsmall: scale(BASE$1 * 0.25),
|
|
9898
|
+
xsmall: scale(BASE$1 * 0.5),
|
|
9899
|
+
small: scale(BASE$1),
|
|
9900
|
+
medium: scale(BASE$1 * 2),
|
|
9901
|
+
large: scale(BASE$1 * 3),
|
|
9902
|
+
xlarge: scale(BASE$1 * 4),
|
|
9903
|
+
xxlarge: scale(BASE$1 * 5),
|
|
9904
|
+
xxxlarge: scale(BASE$1 * 6),
|
|
9905
|
+
xxxxlarge: scale(BASE$1 * 7)
|
|
9893
9906
|
};
|
|
9894
9907
|
|
|
9895
9908
|
var BASE = 16;
|
|
9896
9909
|
var fontSizes = {
|
|
9897
|
-
xxxxxlarge: BASE * 2,
|
|
9898
|
-
xxxxlarge: BASE * 1.75,
|
|
9899
|
-
xxxlarge: BASE * 1.5,
|
|
9900
|
-
xxlarge: BASE * 1.25,
|
|
9901
|
-
xlarge: BASE * 1.125,
|
|
9902
|
-
large: BASE,
|
|
9903
|
-
medium: BASE * 0.875,
|
|
9904
|
-
small: BASE * 0.75,
|
|
9905
|
-
xsmall: BASE * 0.625 //
|
|
9910
|
+
xxxxxlarge: scale(BASE * 2),
|
|
9911
|
+
xxxxlarge: scale(BASE * 1.75),
|
|
9912
|
+
xxxlarge: scale(BASE * 1.5),
|
|
9913
|
+
xxlarge: scale(BASE * 1.25),
|
|
9914
|
+
xlarge: scale(BASE * 1.125),
|
|
9915
|
+
large: scale(BASE),
|
|
9916
|
+
medium: scale(BASE * 0.875),
|
|
9917
|
+
small: scale(BASE * 0.75),
|
|
9918
|
+
xsmall: scale(BASE * 0.625) // 10
|
|
9906
9919
|
|
|
9907
9920
|
};
|
|
9908
9921
|
var fontWeights = {
|
|
@@ -9973,7 +9986,7 @@ var getCardTheme = function getCardTheme(theme) {
|
|
|
9973
9986
|
"default": "12px"
|
|
9974
9987
|
};
|
|
9975
9988
|
var padding = {
|
|
9976
|
-
"default": "".concat(theme.space.
|
|
9989
|
+
"default": "".concat(theme.space.small, "px")
|
|
9977
9990
|
};
|
|
9978
9991
|
return {
|
|
9979
9992
|
radii: radii,
|
|
@@ -10054,6 +10067,25 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
10054
10067
|
};
|
|
10055
10068
|
};
|
|
10056
10069
|
|
|
10070
|
+
var getFABTheme = function getFABTheme(theme) {
|
|
10071
|
+
var colors = {
|
|
10072
|
+
buttonBackground: theme.colors.backgroundDark,
|
|
10073
|
+
icon: theme.colors.invertedText
|
|
10074
|
+
};
|
|
10075
|
+
var sizes = {
|
|
10076
|
+
width: '64px',
|
|
10077
|
+
height: '64px'
|
|
10078
|
+
};
|
|
10079
|
+
var fontSizes = {
|
|
10080
|
+
"default": "".concat(theme.fontSizes.xxxxlarge, "px")
|
|
10081
|
+
};
|
|
10082
|
+
return {
|
|
10083
|
+
fontSizes: fontSizes,
|
|
10084
|
+
colors: colors,
|
|
10085
|
+
sizes: sizes
|
|
10086
|
+
};
|
|
10087
|
+
};
|
|
10088
|
+
|
|
10057
10089
|
var getTheme = function getTheme() {
|
|
10058
10090
|
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
10059
10091
|
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
@@ -10062,21 +10094,22 @@ var getTheme = function getTheme() {
|
|
|
10062
10094
|
card: getCardTheme(theme),
|
|
10063
10095
|
divider: getDividerTheme(theme),
|
|
10064
10096
|
icon: getIconTheme(theme),
|
|
10065
|
-
typography: getTypographyTheme(theme)
|
|
10097
|
+
typography: getTypographyTheme(theme),
|
|
10098
|
+
fab: getFABTheme(theme)
|
|
10066
10099
|
}
|
|
10067
10100
|
});
|
|
10068
10101
|
};
|
|
10069
10102
|
|
|
10070
10103
|
var theme = getTheme();
|
|
10071
10104
|
|
|
10072
|
-
var _templateObject$
|
|
10105
|
+
var _templateObject$6, _templateObject2$3, _templateObject3$2, _templateObject4$2;
|
|
10073
10106
|
var BACKGROUND_INTENTS = {
|
|
10074
10107
|
success: 'successBackground',
|
|
10075
10108
|
warning: 'warningBackground',
|
|
10076
10109
|
danger: 'dangerBackground',
|
|
10077
10110
|
info: 'infoBackground'
|
|
10078
10111
|
};
|
|
10079
|
-
var StyledView = styled(require$$0$1.View)(_templateObject$
|
|
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) {
|
|
10080
10113
|
var theme = _ref.theme;
|
|
10081
10114
|
return theme.__hd__.badge.borderWidths["default"];
|
|
10082
10115
|
}, function (_ref2) {
|
|
@@ -10109,7 +10142,7 @@ var StyledText$1 = styled(require$$0$1.Text)(_templateObject3$2 || (_templateObj
|
|
|
10109
10142
|
});
|
|
10110
10143
|
});
|
|
10111
10144
|
|
|
10112
|
-
var _excluded$
|
|
10145
|
+
var _excluded$3 = ["content", "intent", "style", "testID"];
|
|
10113
10146
|
|
|
10114
10147
|
var Badge = function Badge(_ref) {
|
|
10115
10148
|
var content = _ref.content,
|
|
@@ -10117,7 +10150,7 @@ var Badge = function Badge(_ref) {
|
|
|
10117
10150
|
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
10118
10151
|
style = _ref.style,
|
|
10119
10152
|
testID = _ref.testID,
|
|
10120
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10153
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$3);
|
|
10121
10154
|
|
|
10122
10155
|
return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({
|
|
10123
10156
|
themeIntent: intent,
|
|
@@ -10128,8 +10161,8 @@ var Badge = function Badge(_ref) {
|
|
|
10128
10161
|
}, content));
|
|
10129
10162
|
};
|
|
10130
10163
|
|
|
10131
|
-
var _templateObject$
|
|
10132
|
-
var StyledCard = styled(require$$0$1.View)(_templateObject$
|
|
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) {
|
|
10133
10166
|
var theme = _ref.theme;
|
|
10134
10167
|
return theme.__hd__.card.radii["default"];
|
|
10135
10168
|
}, function (_ref2) {
|
|
@@ -10141,8 +10174,8 @@ var Card = function Card(props) {
|
|
|
10141
10174
|
return /*#__PURE__*/React__default["default"].createElement(StyledCard, props);
|
|
10142
10175
|
};
|
|
10143
10176
|
|
|
10144
|
-
var _templateObject$
|
|
10145
|
-
var StyledDivider = styled(require$$0$1.View)(_templateObject$
|
|
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) {
|
|
10146
10179
|
var theme = _ref.theme;
|
|
10147
10180
|
return theme.__hd__.divider.borderWidths["default"];
|
|
10148
10181
|
}, function (_ref2) {
|
|
@@ -10196,14 +10229,14 @@ var StyledDivider = styled(require$$0$1.View)(_templateObject$2 || (_templateObj
|
|
|
10196
10229
|
}
|
|
10197
10230
|
});
|
|
10198
10231
|
|
|
10199
|
-
var _excluded$
|
|
10232
|
+
var _excluded$2 = ["marginHorizontal", "marginVertical", "style", "testID"];
|
|
10200
10233
|
|
|
10201
10234
|
var Divider = function Divider(_ref) {
|
|
10202
10235
|
var marginHorizontal = _ref.marginHorizontal,
|
|
10203
10236
|
marginVertical = _ref.marginVertical,
|
|
10204
10237
|
style = _ref.style,
|
|
10205
10238
|
testID = _ref.testID,
|
|
10206
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10239
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$2);
|
|
10207
10240
|
|
|
10208
10241
|
return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({
|
|
10209
10242
|
themeMarginHorizontal: marginHorizontal,
|
|
@@ -19841,9 +19874,9 @@ var heroIconConfig = {
|
|
|
19841
19874
|
preferences: preferences
|
|
19842
19875
|
};
|
|
19843
19876
|
|
|
19844
|
-
var _templateObject$
|
|
19877
|
+
var _templateObject$3, _templateObject2$1;
|
|
19845
19878
|
var HeroIcon = dist.createIconSetFromIcoMoon(heroIconConfig, 'hero-icons', 'hero-icons.ttf');
|
|
19846
|
-
var StyledHeroIcon = styled(HeroIcon)(_templateObject$
|
|
19879
|
+
var StyledHeroIcon = styled(HeroIcon)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
|
|
19847
19880
|
var themeIntent = _ref.themeIntent,
|
|
19848
19881
|
themeSize = _ref.themeSize;
|
|
19849
19882
|
return css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", "px;\n "])), function (_ref2) {
|
|
@@ -19872,8 +19905,8 @@ var Icon = function Icon(_ref) {
|
|
|
19872
19905
|
});
|
|
19873
19906
|
};
|
|
19874
19907
|
|
|
19875
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
19876
|
-
var StyledText = styled(require$$0$1.Text)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
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) {
|
|
19877
19910
|
var themeFontSize = _ref.themeFontSize,
|
|
19878
19911
|
theme = _ref.theme;
|
|
19879
19912
|
|
|
@@ -19917,7 +19950,7 @@ var StyledText = styled(require$$0$1.Text)(_templateObject || (_templateObject =
|
|
|
19917
19950
|
}
|
|
19918
19951
|
});
|
|
19919
19952
|
|
|
19920
|
-
var _excluded = ["children", "fontSize", "fontWeight", "intent"];
|
|
19953
|
+
var _excluded$1 = ["children", "fontSize", "fontWeight", "intent"];
|
|
19921
19954
|
|
|
19922
19955
|
var Text = function Text(_ref) {
|
|
19923
19956
|
var children = _ref.children,
|
|
@@ -19927,7 +19960,7 @@ var Text = function Text(_ref) {
|
|
|
19927
19960
|
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
19928
19961
|
_ref$intent = _ref.intent,
|
|
19929
19962
|
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
19930
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
19963
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$1);
|
|
19931
19964
|
|
|
19932
19965
|
return /*#__PURE__*/React__default["default"].createElement(StyledText, _extends$1({
|
|
19933
19966
|
themeFontSize: fontSize,
|
|
@@ -19940,12 +19973,90 @@ var Typography = {
|
|
|
19940
19973
|
Text: Text
|
|
19941
19974
|
};
|
|
19942
19975
|
|
|
19976
|
+
var _templateObject$1;
|
|
19977
|
+
var StyledFABIcon = styled(Icon)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n"])), function (_ref) {
|
|
19978
|
+
var theme = _ref.theme;
|
|
19979
|
+
return theme.__hd__.fab.colors.icon;
|
|
19980
|
+
}, function (_ref2) {
|
|
19981
|
+
var theme = _ref2.theme;
|
|
19982
|
+
return theme.__hd__.fab.fontSizes["default"];
|
|
19983
|
+
});
|
|
19984
|
+
|
|
19985
|
+
var _excluded = ["active"];
|
|
19986
|
+
var AnimatedIcons = require$$0$1.Animated.createAnimatedComponent(StyledFABIcon);
|
|
19987
|
+
|
|
19988
|
+
var AnimatedFABIcon = function AnimatedFABIcon(_ref) {
|
|
19989
|
+
var active = _ref.active,
|
|
19990
|
+
iconProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
19991
|
+
|
|
19992
|
+
var rotateAnimation = React.useRef(new require$$0$1.Animated.Value(active ? 1 : 0));
|
|
19993
|
+
React.useEffect(function () {
|
|
19994
|
+
var animation = require$$0$1.Animated.timing(rotateAnimation.current, {
|
|
19995
|
+
toValue: active ? 1 : 0,
|
|
19996
|
+
useNativeDriver: true
|
|
19997
|
+
});
|
|
19998
|
+
animation.start();
|
|
19999
|
+
return function () {
|
|
20000
|
+
animation.stop();
|
|
20001
|
+
};
|
|
20002
|
+
}, [active]);
|
|
20003
|
+
var interpolatedRotateAnimation = rotateAnimation.current.interpolate({
|
|
20004
|
+
inputRange: [0, 1],
|
|
20005
|
+
outputRange: ['0deg', '-45deg']
|
|
20006
|
+
});
|
|
20007
|
+
return /*#__PURE__*/React__default["default"].createElement(require$$0$1.Animated.View, {
|
|
20008
|
+
style: require$$0$1.StyleSheet.flatten([{
|
|
20009
|
+
transform: [{
|
|
20010
|
+
rotate: interpolatedRotateAnimation
|
|
20011
|
+
}]
|
|
20012
|
+
}])
|
|
20013
|
+
}, /*#__PURE__*/React__default["default"].createElement(AnimatedIcons, iconProps));
|
|
20014
|
+
};
|
|
20015
|
+
|
|
20016
|
+
var _templateObject;
|
|
20017
|
+
var StyledFABContainer = styled(require$$0$1.TouchableHighlight)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", ";\n width: ", ";\n background-color: ", ";\n border-radius: 999px;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n"])), function (_ref) {
|
|
20018
|
+
var theme = _ref.theme;
|
|
20019
|
+
return theme.__hd__.fab.sizes.height;
|
|
20020
|
+
}, function (_ref2) {
|
|
20021
|
+
var theme = _ref2.theme;
|
|
20022
|
+
return theme.__hd__.fab.sizes.width;
|
|
20023
|
+
}, function (_ref3) {
|
|
20024
|
+
var theme = _ref3.theme;
|
|
20025
|
+
return theme.__hd__.fab.colors.buttonBackground;
|
|
20026
|
+
});
|
|
20027
|
+
|
|
20028
|
+
var FAB = function FAB(_ref) {
|
|
20029
|
+
var _onPress = _ref.onPress,
|
|
20030
|
+
icon = _ref.icon,
|
|
20031
|
+
animated = _ref.animated,
|
|
20032
|
+
testID = _ref.testID,
|
|
20033
|
+
active = _ref.active,
|
|
20034
|
+
style = _ref.style;
|
|
20035
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledFABContainer, {
|
|
20036
|
+
testID: testID,
|
|
20037
|
+
onPress: function onPress() {
|
|
20038
|
+
_onPress === null || _onPress === void 0 ? void 0 : _onPress();
|
|
20039
|
+
},
|
|
20040
|
+
activeOpacity: 0.6,
|
|
20041
|
+
style: style
|
|
20042
|
+
}, animated ? /*#__PURE__*/React__default["default"].createElement(AnimatedFABIcon, {
|
|
20043
|
+
active: active,
|
|
20044
|
+
icon: icon,
|
|
20045
|
+
testID: "animatedFABIcon"
|
|
20046
|
+
}) : /*#__PURE__*/React__default["default"].createElement(StyledFABIcon, {
|
|
20047
|
+
icon: icon,
|
|
20048
|
+
testID: "styledFABIcon"
|
|
20049
|
+
}));
|
|
20050
|
+
};
|
|
20051
|
+
|
|
19943
20052
|
exports.Badge = Badge;
|
|
19944
20053
|
exports.Card = Card;
|
|
19945
20054
|
exports.Divider = Divider;
|
|
20055
|
+
exports.FAB = FAB;
|
|
19946
20056
|
exports.Icon = Icon;
|
|
19947
20057
|
exports.ThemeProvider = ThemeProvider;
|
|
19948
20058
|
exports.Typography = Typography;
|
|
19949
20059
|
exports.getTheme = getTheme;
|
|
20060
|
+
exports.scale = scale;
|
|
19950
20061
|
exports.theme = theme;
|
|
19951
20062
|
exports.useTheme = useTheme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"publish:npm": "yarn publish --access public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@hero-design/colors": "7.
|
|
21
|
+
"@hero-design/colors": "7.1.1",
|
|
22
22
|
"styled-components": "6.0.0-alpha.5"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/core": "^7.17.5",
|
|
31
31
|
"@babel/preset-env": "^7.16.11",
|
|
32
32
|
"@babel/preset-react": "^7.16.7",
|
|
33
|
-
"@babel/preset-typescript": "^7.
|
|
33
|
+
"@babel/preset-typescript": "^7.17.12",
|
|
34
34
|
"@react-navigation/native": "^6.0.10",
|
|
35
35
|
"@react-navigation/native-stack": "^6.6.2",
|
|
36
36
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { View, ViewProps, StyleSheet } from 'react-native';
|
|
3
3
|
import { palette } from '@hero-design/colors';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{...props}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
4
|
+
import {
|
|
5
|
+
useTheme,
|
|
6
|
+
scale,
|
|
7
|
+
Card,
|
|
8
|
+
Typography,
|
|
9
|
+
Icon,
|
|
10
|
+
Divider,
|
|
11
|
+
} from '../../src/index';
|
|
15
12
|
|
|
16
13
|
const Screen = View;
|
|
14
|
+
|
|
17
15
|
type DashboardCardProps = ViewProps & {
|
|
18
16
|
icon: ComponentProps<typeof Icon>['icon'];
|
|
19
17
|
title: string;
|
|
@@ -25,19 +23,28 @@ const DashboardCard = ({
|
|
|
25
23
|
icon,
|
|
26
24
|
title,
|
|
27
25
|
subtitle,
|
|
28
|
-
}: DashboardCardProps) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
}: DashboardCardProps) => {
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
return (
|
|
29
|
+
<Card style={style}>
|
|
30
|
+
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
|
31
|
+
<Icon icon={icon} />
|
|
32
|
+
</View>
|
|
33
|
+
<View
|
|
34
|
+
style={{
|
|
35
|
+
flex: 1,
|
|
36
|
+
justifyContent: 'flex-end',
|
|
37
|
+
margin: theme.space.small,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
41
|
+
{title}
|
|
42
|
+
</Typography.Text>
|
|
43
|
+
<Typography.Text fontSize="medium">{subtitle}</Typography.Text>
|
|
44
|
+
</View>
|
|
45
|
+
</Card>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
41
48
|
|
|
42
49
|
const InductionCard = (props: ViewProps) => (
|
|
43
50
|
<DashboardCard
|
|
@@ -59,13 +66,13 @@ const PoliciesCard = (props: ViewProps) => (
|
|
|
59
66
|
const CertificationsCard = (props: ViewProps) => (
|
|
60
67
|
<DashboardCard
|
|
61
68
|
icon="file-certified"
|
|
62
|
-
title="
|
|
69
|
+
title="Certifications"
|
|
63
70
|
subtitle="1 to update"
|
|
64
71
|
{...props}
|
|
65
72
|
/>
|
|
66
73
|
);
|
|
67
74
|
|
|
68
|
-
const
|
|
75
|
+
const RostersCard = (props: ViewProps) => {
|
|
69
76
|
const theme = useTheme();
|
|
70
77
|
const { style, ...otherProps } = props;
|
|
71
78
|
return (
|
|
@@ -74,39 +81,30 @@ const Payslip = (props: ViewProps) => {
|
|
|
74
81
|
style={StyleSheet.flatten([
|
|
75
82
|
{
|
|
76
83
|
flexDirection: 'row',
|
|
77
|
-
alignItems: '
|
|
78
|
-
backgroundColor: palette.
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
backgroundColor: palette.greyLight90,
|
|
79
86
|
},
|
|
80
87
|
style,
|
|
81
88
|
])}
|
|
82
89
|
>
|
|
83
|
-
<View>
|
|
90
|
+
<View style={{ padding: theme.space.small }}>
|
|
84
91
|
<View
|
|
85
92
|
style={{
|
|
86
93
|
padding: theme.space.small,
|
|
87
|
-
backgroundColor:
|
|
94
|
+
backgroundColor: theme.colors.infoLight,
|
|
88
95
|
borderRadius: 999,
|
|
89
|
-
alignContent: 'stretch',
|
|
90
96
|
}}
|
|
91
97
|
>
|
|
92
|
-
<Icon icon="
|
|
98
|
+
<Icon icon="calendar-clock" />
|
|
93
99
|
</View>
|
|
94
100
|
</View>
|
|
95
101
|
<View style={{ flex: 1, marginLeft: theme.space.small }}>
|
|
96
|
-
<Typography.Text fontSize="
|
|
102
|
+
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
97
103
|
Rosters
|
|
98
104
|
</Typography.Text>
|
|
99
|
-
<Typography.Text fontSize="
|
|
100
|
-
</View>
|
|
101
|
-
<View
|
|
102
|
-
style={{
|
|
103
|
-
alignItems: 'center',
|
|
104
|
-
alignContent: 'center',
|
|
105
|
-
justifyContent: 'center',
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
<Icon icon="arrow-right" />
|
|
105
|
+
<Typography.Text fontSize="large">3 shifts this week</Typography.Text>
|
|
109
106
|
</View>
|
|
107
|
+
<Icon icon="arrow-right" />
|
|
110
108
|
</Card>
|
|
111
109
|
);
|
|
112
110
|
};
|
|
@@ -129,58 +127,53 @@ const MyLeaveCard = (props: ViewProps) => {
|
|
|
129
127
|
])}
|
|
130
128
|
>
|
|
131
129
|
<View
|
|
132
|
-
testID="header"
|
|
133
130
|
style={{
|
|
134
|
-
|
|
135
|
-
marginTop: theme.space.small,
|
|
131
|
+
padding: theme.space.medium,
|
|
136
132
|
justifyContent: 'space-between',
|
|
137
133
|
flexDirection: 'row',
|
|
138
134
|
}}
|
|
139
135
|
>
|
|
140
|
-
<Typography.Text fontSize="
|
|
136
|
+
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
141
137
|
My Leave
|
|
142
138
|
</Typography.Text>
|
|
143
|
-
|
|
144
139
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
145
|
-
<Typography.Text fontWeight="semi-bold">
|
|
140
|
+
<Typography.Text fontSize="large" fontWeight="semi-bold">
|
|
141
|
+
Add / view
|
|
142
|
+
</Typography.Text>
|
|
146
143
|
<Icon
|
|
147
144
|
icon="circle-add-outlined"
|
|
148
145
|
size="xsmall"
|
|
149
|
-
style={{
|
|
146
|
+
style={{ marginLeft: theme.space.small }}
|
|
150
147
|
/>
|
|
151
148
|
</View>
|
|
152
149
|
</View>
|
|
153
|
-
<Divider
|
|
154
|
-
<View
|
|
155
|
-
<Typography.Text
|
|
150
|
+
<Divider />
|
|
151
|
+
<View style={{ padding: theme.space.medium }}>
|
|
152
|
+
<Typography.Text
|
|
153
|
+
fontSize="large"
|
|
154
|
+
fontWeight="semi-bold"
|
|
155
|
+
style={{ marginBottom: theme.space.small }}
|
|
156
|
+
>
|
|
156
157
|
Leave Balances
|
|
157
158
|
</Typography.Text>
|
|
158
|
-
<View
|
|
159
|
-
|
|
160
|
-
style={{ flexDirection: 'row', justifyContent: 'space-between' }}
|
|
161
|
-
>
|
|
162
|
-
<Typography.Text>Jury Duty</Typography.Text>
|
|
159
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
160
|
+
<Typography.Text fontSize="large">Jury Duty</Typography.Text>
|
|
163
161
|
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
164
162
|
</View>
|
|
165
|
-
<View
|
|
166
|
-
|
|
167
|
-
style={{ flexDirection: 'row', justifyContent: 'space-between' }}
|
|
168
|
-
>
|
|
169
|
-
<Typography.Text>Annual Leave</Typography.Text>
|
|
163
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
164
|
+
<Typography.Text fontSize="large">Annual Leave</Typography.Text>
|
|
170
165
|
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
171
166
|
</View>
|
|
172
|
-
<View
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<Typography.Text>Values Champion Award</Typography.Text>
|
|
167
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
168
|
+
<Typography.Text fontSize="large">
|
|
169
|
+
Values Champion Award
|
|
170
|
+
</Typography.Text>
|
|
177
171
|
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
178
172
|
</View>
|
|
179
|
-
<View
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
<Typography.Text>Family and Domestic</Typography.Text>
|
|
173
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
174
|
+
<Typography.Text fontSize="large">
|
|
175
|
+
Family and Domestic
|
|
176
|
+
</Typography.Text>
|
|
184
177
|
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
185
178
|
</View>
|
|
186
179
|
</View>
|
|
@@ -191,13 +184,12 @@ const MyLeaveCard = (props: ViewProps) => {
|
|
|
191
184
|
const CardPlayground = () => {
|
|
192
185
|
const theme = useTheme();
|
|
193
186
|
return (
|
|
194
|
-
<Screen>
|
|
195
|
-
<View style={{ flexDirection: 'row', height:
|
|
196
|
-
<View style={{ flex: 1 }}>
|
|
187
|
+
<Screen style={{ padding: theme.space.medium }}>
|
|
188
|
+
<View style={{ flexDirection: 'row', height: scale(216) }}>
|
|
189
|
+
<View style={{ flex: 1, marginRight: theme.space.medium }}>
|
|
197
190
|
<InductionCard
|
|
198
191
|
style={{
|
|
199
192
|
flex: 1,
|
|
200
|
-
margin: theme.space.small,
|
|
201
193
|
backgroundColor: theme.colors.primaryLight,
|
|
202
194
|
}}
|
|
203
195
|
/>
|
|
@@ -206,31 +198,22 @@ const CardPlayground = () => {
|
|
|
206
198
|
<PoliciesCard
|
|
207
199
|
style={{
|
|
208
200
|
flex: 1,
|
|
209
|
-
backgroundColor:
|
|
210
|
-
|
|
201
|
+
backgroundColor: theme.colors.infoLight,
|
|
202
|
+
marginBottom: theme.space.medium,
|
|
211
203
|
}}
|
|
212
204
|
testID="policies"
|
|
213
205
|
/>
|
|
214
206
|
<CertificationsCard
|
|
215
207
|
style={{
|
|
216
208
|
flex: 1,
|
|
217
|
-
|
|
218
|
-
backgroundColor: palette.dodgerBlueLight75,
|
|
209
|
+
backgroundColor: theme.colors.infoLight,
|
|
219
210
|
}}
|
|
220
211
|
testID="certifications"
|
|
221
212
|
/>
|
|
222
213
|
</View>
|
|
223
214
|
</View>
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
margin: theme.space.small,
|
|
227
|
-
}}
|
|
228
|
-
/>
|
|
229
|
-
<MyLeaveCard
|
|
230
|
-
style={{
|
|
231
|
-
margin: theme.space.small,
|
|
232
|
-
}}
|
|
233
|
-
/>
|
|
215
|
+
<RostersCard style={{ marginTop: theme.space.medium }} />
|
|
216
|
+
<MyLeaveCard style={{ marginTop: theme.space.medium }} />
|
|
234
217
|
</Screen>
|
|
235
218
|
);
|
|
236
219
|
};
|