@hero-design/rn 7.0.6 → 7.1.0
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/.expo/packager-info.json +1 -1
- package/babel.config.js +1 -1
- package/es/index.js +148 -41
- package/lib/index.js +147 -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/__tests__/__snapshots__/Card.spec.tsx.snap +4 -4
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +4 -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/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +1 -0
- package/types/src/components/FAB/__tests__/StyledFABContainer.spec.d.ts +1 -0
- package/types/src/components/FAB/__tests__/StyledFABIcon.spec.d.ts +1 -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/.expo/packager-info.json
CHANGED
package/babel.config.js
CHANGED
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useContext, useMemo, createElement } from 'react';
|
|
2
|
-
import require$$0$1, { View, Text as Text$1 } from 'react-native';
|
|
1
|
+
import React, { useContext, useMemo, createElement, useRef, useEffect } from 'react';
|
|
2
|
+
import require$$0$1, { Dimensions, View, Text as Text$1, Animated, StyleSheet as StyleSheet$1, TouchableHighlight } from 'react-native';
|
|
3
3
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
@@ -8130,7 +8130,7 @@ Processor$1["default"] = Processor$1;
|
|
|
8130
8130
|
Root$2.registerProcessor(Processor$1);
|
|
8131
8131
|
Document$1.registerProcessor(Processor$1);
|
|
8132
8132
|
|
|
8133
|
-
var _excluded$
|
|
8133
|
+
var _excluded$4 = ["inputs"],
|
|
8134
8134
|
_excluded2 = ["inputId"];
|
|
8135
8135
|
|
|
8136
8136
|
var Declaration$1 = declaration;
|
|
@@ -8147,7 +8147,7 @@ function fromJSON$1(json, inputs) {
|
|
|
8147
8147
|
});
|
|
8148
8148
|
|
|
8149
8149
|
var ownInputs = json.inputs,
|
|
8150
|
-
defaults = _objectWithoutProperties$1(json, _excluded$
|
|
8150
|
+
defaults = _objectWithoutProperties$1(json, _excluded$4);
|
|
8151
8151
|
|
|
8152
8152
|
if (ownInputs) {
|
|
8153
8153
|
inputs = [];
|
|
@@ -9872,30 +9872,41 @@ var systemPalette = {
|
|
|
9872
9872
|
outline: palette.greyLight60
|
|
9873
9873
|
};
|
|
9874
9874
|
|
|
9875
|
+
var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
|
|
9876
|
+
|
|
9877
|
+
var scale = function scale(size) {
|
|
9878
|
+
var _Dimensions$get = Dimensions.get('window'),
|
|
9879
|
+
width = _Dimensions$get.width,
|
|
9880
|
+
height = _Dimensions$get.height;
|
|
9881
|
+
|
|
9882
|
+
var shortDimension = width < height ? width : height;
|
|
9883
|
+
return shortDimension / BASE_WIDTH * size;
|
|
9884
|
+
};
|
|
9885
|
+
|
|
9875
9886
|
var BASE$1 = 8;
|
|
9876
9887
|
var space = {
|
|
9877
|
-
xxsmall: BASE$1 * 0.25,
|
|
9878
|
-
xsmall: BASE$1 * 0.5,
|
|
9879
|
-
small: BASE$1,
|
|
9880
|
-
medium: BASE$1 * 2,
|
|
9881
|
-
large: BASE$1 * 3,
|
|
9882
|
-
xlarge: BASE$1 * 4,
|
|
9883
|
-
xxlarge: BASE$1 * 5,
|
|
9884
|
-
xxxlarge: BASE$1 * 6,
|
|
9885
|
-
xxxxlarge: BASE$1 * 7
|
|
9888
|
+
xxsmall: scale(BASE$1 * 0.25),
|
|
9889
|
+
xsmall: scale(BASE$1 * 0.5),
|
|
9890
|
+
small: scale(BASE$1),
|
|
9891
|
+
medium: scale(BASE$1 * 2),
|
|
9892
|
+
large: scale(BASE$1 * 3),
|
|
9893
|
+
xlarge: scale(BASE$1 * 4),
|
|
9894
|
+
xxlarge: scale(BASE$1 * 5),
|
|
9895
|
+
xxxlarge: scale(BASE$1 * 6),
|
|
9896
|
+
xxxxlarge: scale(BASE$1 * 7)
|
|
9886
9897
|
};
|
|
9887
9898
|
|
|
9888
9899
|
var BASE = 16;
|
|
9889
9900
|
var fontSizes = {
|
|
9890
|
-
xxxxxlarge: BASE * 2,
|
|
9891
|
-
xxxxlarge: BASE * 1.75,
|
|
9892
|
-
xxxlarge: BASE * 1.5,
|
|
9893
|
-
xxlarge: BASE * 1.25,
|
|
9894
|
-
xlarge: BASE * 1.125,
|
|
9895
|
-
large: BASE,
|
|
9896
|
-
medium: BASE * 0.875,
|
|
9897
|
-
small: BASE * 0.75,
|
|
9898
|
-
xsmall: BASE * 0.625 //
|
|
9901
|
+
xxxxxlarge: scale(BASE * 2),
|
|
9902
|
+
xxxxlarge: scale(BASE * 1.75),
|
|
9903
|
+
xxxlarge: scale(BASE * 1.5),
|
|
9904
|
+
xxlarge: scale(BASE * 1.25),
|
|
9905
|
+
xlarge: scale(BASE * 1.125),
|
|
9906
|
+
large: scale(BASE),
|
|
9907
|
+
medium: scale(BASE * 0.875),
|
|
9908
|
+
small: scale(BASE * 0.75),
|
|
9909
|
+
xsmall: scale(BASE * 0.625) // 10
|
|
9899
9910
|
|
|
9900
9911
|
};
|
|
9901
9912
|
var fontWeights = {
|
|
@@ -9966,7 +9977,7 @@ var getCardTheme = function getCardTheme(theme) {
|
|
|
9966
9977
|
"default": "12px"
|
|
9967
9978
|
};
|
|
9968
9979
|
var padding = {
|
|
9969
|
-
"default": "".concat(theme.space.
|
|
9980
|
+
"default": "".concat(theme.space.small, "px")
|
|
9970
9981
|
};
|
|
9971
9982
|
return {
|
|
9972
9983
|
radii: radii,
|
|
@@ -10047,6 +10058,25 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
10047
10058
|
};
|
|
10048
10059
|
};
|
|
10049
10060
|
|
|
10061
|
+
var getFABTheme = function getFABTheme(theme) {
|
|
10062
|
+
var colors = {
|
|
10063
|
+
buttonBackground: theme.colors.backgroundDark,
|
|
10064
|
+
icon: theme.colors.invertedText
|
|
10065
|
+
};
|
|
10066
|
+
var sizes = {
|
|
10067
|
+
width: '64px',
|
|
10068
|
+
height: '64px'
|
|
10069
|
+
};
|
|
10070
|
+
var fontSizes = {
|
|
10071
|
+
"default": "".concat(theme.fontSizes.xxxxlarge, "px")
|
|
10072
|
+
};
|
|
10073
|
+
return {
|
|
10074
|
+
fontSizes: fontSizes,
|
|
10075
|
+
colors: colors,
|
|
10076
|
+
sizes: sizes
|
|
10077
|
+
};
|
|
10078
|
+
};
|
|
10079
|
+
|
|
10050
10080
|
var getTheme = function getTheme() {
|
|
10051
10081
|
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
10052
10082
|
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
@@ -10055,21 +10085,22 @@ var getTheme = function getTheme() {
|
|
|
10055
10085
|
card: getCardTheme(theme),
|
|
10056
10086
|
divider: getDividerTheme(theme),
|
|
10057
10087
|
icon: getIconTheme(theme),
|
|
10058
|
-
typography: getTypographyTheme(theme)
|
|
10088
|
+
typography: getTypographyTheme(theme),
|
|
10089
|
+
fab: getFABTheme(theme)
|
|
10059
10090
|
}
|
|
10060
10091
|
});
|
|
10061
10092
|
};
|
|
10062
10093
|
|
|
10063
10094
|
var theme = getTheme();
|
|
10064
10095
|
|
|
10065
|
-
var _templateObject$
|
|
10096
|
+
var _templateObject$6, _templateObject2$3, _templateObject3$2, _templateObject4$2;
|
|
10066
10097
|
var BACKGROUND_INTENTS = {
|
|
10067
10098
|
success: 'successBackground',
|
|
10068
10099
|
warning: 'warningBackground',
|
|
10069
10100
|
danger: 'dangerBackground',
|
|
10070
10101
|
info: 'infoBackground'
|
|
10071
10102
|
};
|
|
10072
|
-
var StyledView = styled(View)(_templateObject$
|
|
10103
|
+
var StyledView = styled(View)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n border-width: ", ";\n border-radius: ", ";\n padding: ", ";\n\n ", ";\n"])), function (_ref) {
|
|
10073
10104
|
var theme = _ref.theme;
|
|
10074
10105
|
return theme.__hd__.badge.borderWidths["default"];
|
|
10075
10106
|
}, function (_ref2) {
|
|
@@ -10102,7 +10133,7 @@ var StyledText$1 = styled(Text$1)(_templateObject3$2 || (_templateObject3$2 = _t
|
|
|
10102
10133
|
});
|
|
10103
10134
|
});
|
|
10104
10135
|
|
|
10105
|
-
var _excluded$
|
|
10136
|
+
var _excluded$3 = ["content", "intent", "style", "testID"];
|
|
10106
10137
|
|
|
10107
10138
|
var Badge = function Badge(_ref) {
|
|
10108
10139
|
var content = _ref.content,
|
|
@@ -10110,7 +10141,7 @@ var Badge = function Badge(_ref) {
|
|
|
10110
10141
|
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
10111
10142
|
style = _ref.style,
|
|
10112
10143
|
testID = _ref.testID,
|
|
10113
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10144
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$3);
|
|
10114
10145
|
|
|
10115
10146
|
return /*#__PURE__*/React.createElement(StyledView, _extends$1({
|
|
10116
10147
|
themeIntent: intent,
|
|
@@ -10121,8 +10152,8 @@ var Badge = function Badge(_ref) {
|
|
|
10121
10152
|
}, content));
|
|
10122
10153
|
};
|
|
10123
10154
|
|
|
10124
|
-
var _templateObject$
|
|
10125
|
-
var StyledCard = styled(View)(_templateObject$
|
|
10155
|
+
var _templateObject$5;
|
|
10156
|
+
var StyledCard = styled(View)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n padding: ", ";\n"])), function (_ref) {
|
|
10126
10157
|
var theme = _ref.theme;
|
|
10127
10158
|
return theme.__hd__.card.radii["default"];
|
|
10128
10159
|
}, function (_ref2) {
|
|
@@ -10134,8 +10165,8 @@ var Card = function Card(props) {
|
|
|
10134
10165
|
return /*#__PURE__*/React.createElement(StyledCard, props);
|
|
10135
10166
|
};
|
|
10136
10167
|
|
|
10137
|
-
var _templateObject$
|
|
10138
|
-
var StyledDivider = styled(View)(_templateObject$
|
|
10168
|
+
var _templateObject$4, _templateObject2$2, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11, _templateObject12, _templateObject13;
|
|
10169
|
+
var StyledDivider = styled(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) {
|
|
10139
10170
|
var theme = _ref.theme;
|
|
10140
10171
|
return theme.__hd__.divider.borderWidths["default"];
|
|
10141
10172
|
}, function (_ref2) {
|
|
@@ -10189,14 +10220,14 @@ var StyledDivider = styled(View)(_templateObject$2 || (_templateObject$2 = _tagg
|
|
|
10189
10220
|
}
|
|
10190
10221
|
});
|
|
10191
10222
|
|
|
10192
|
-
var _excluded$
|
|
10223
|
+
var _excluded$2 = ["marginHorizontal", "marginVertical", "style", "testID"];
|
|
10193
10224
|
|
|
10194
10225
|
var Divider = function Divider(_ref) {
|
|
10195
10226
|
var marginHorizontal = _ref.marginHorizontal,
|
|
10196
10227
|
marginVertical = _ref.marginVertical,
|
|
10197
10228
|
style = _ref.style,
|
|
10198
10229
|
testID = _ref.testID,
|
|
10199
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10230
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$2);
|
|
10200
10231
|
|
|
10201
10232
|
return /*#__PURE__*/React.createElement(StyledDivider, _extends$1({
|
|
10202
10233
|
themeMarginHorizontal: marginHorizontal,
|
|
@@ -19834,9 +19865,9 @@ var heroIconConfig = {
|
|
|
19834
19865
|
preferences: preferences
|
|
19835
19866
|
};
|
|
19836
19867
|
|
|
19837
|
-
var _templateObject$
|
|
19868
|
+
var _templateObject$3, _templateObject2$1;
|
|
19838
19869
|
var HeroIcon = dist.createIconSetFromIcoMoon(heroIconConfig, 'hero-icons', 'hero-icons.ttf');
|
|
19839
|
-
var StyledHeroIcon = styled(HeroIcon)(_templateObject$
|
|
19870
|
+
var StyledHeroIcon = styled(HeroIcon)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
|
|
19840
19871
|
var themeIntent = _ref.themeIntent,
|
|
19841
19872
|
themeSize = _ref.themeSize;
|
|
19842
19873
|
return css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", "px;\n "])), function (_ref2) {
|
|
@@ -19865,8 +19896,8 @@ var Icon = function Icon(_ref) {
|
|
|
19865
19896
|
});
|
|
19866
19897
|
};
|
|
19867
19898
|
|
|
19868
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
19869
|
-
var StyledText = styled(Text$1)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
19899
|
+
var _templateObject$2, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
19900
|
+
var StyledText = styled(Text$1)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
19870
19901
|
var themeFontSize = _ref.themeFontSize,
|
|
19871
19902
|
theme = _ref.theme;
|
|
19872
19903
|
|
|
@@ -19910,7 +19941,7 @@ var StyledText = styled(Text$1)(_templateObject || (_templateObject = _taggedTem
|
|
|
19910
19941
|
}
|
|
19911
19942
|
});
|
|
19912
19943
|
|
|
19913
|
-
var _excluded = ["children", "fontSize", "fontWeight", "intent"];
|
|
19944
|
+
var _excluded$1 = ["children", "fontSize", "fontWeight", "intent"];
|
|
19914
19945
|
|
|
19915
19946
|
var Text = function Text(_ref) {
|
|
19916
19947
|
var children = _ref.children,
|
|
@@ -19920,7 +19951,7 @@ var Text = function Text(_ref) {
|
|
|
19920
19951
|
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
19921
19952
|
_ref$intent = _ref.intent,
|
|
19922
19953
|
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
19923
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
19954
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$1);
|
|
19924
19955
|
|
|
19925
19956
|
return /*#__PURE__*/React.createElement(StyledText, _extends$1({
|
|
19926
19957
|
themeFontSize: fontSize,
|
|
@@ -19933,4 +19964,80 @@ var Typography = {
|
|
|
19933
19964
|
Text: Text
|
|
19934
19965
|
};
|
|
19935
19966
|
|
|
19936
|
-
|
|
19967
|
+
var _templateObject$1;
|
|
19968
|
+
var StyledFABIcon = styled(Icon)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n"])), function (_ref) {
|
|
19969
|
+
var theme = _ref.theme;
|
|
19970
|
+
return theme.__hd__.fab.colors.icon;
|
|
19971
|
+
}, function (_ref2) {
|
|
19972
|
+
var theme = _ref2.theme;
|
|
19973
|
+
return theme.__hd__.fab.fontSizes["default"];
|
|
19974
|
+
});
|
|
19975
|
+
|
|
19976
|
+
var _excluded = ["active"];
|
|
19977
|
+
var AnimatedIcons = Animated.createAnimatedComponent(StyledFABIcon);
|
|
19978
|
+
|
|
19979
|
+
var AnimatedFABIcon = function AnimatedFABIcon(_ref) {
|
|
19980
|
+
var active = _ref.active,
|
|
19981
|
+
iconProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
19982
|
+
|
|
19983
|
+
var rotateAnimation = useRef(new Animated.Value(active ? 1 : 0));
|
|
19984
|
+
useEffect(function () {
|
|
19985
|
+
var animation = Animated.timing(rotateAnimation.current, {
|
|
19986
|
+
toValue: active ? 1 : 0,
|
|
19987
|
+
useNativeDriver: true
|
|
19988
|
+
});
|
|
19989
|
+
animation.start();
|
|
19990
|
+
return function () {
|
|
19991
|
+
animation.stop();
|
|
19992
|
+
};
|
|
19993
|
+
}, [active]);
|
|
19994
|
+
var interpolatedRotateAnimation = rotateAnimation.current.interpolate({
|
|
19995
|
+
inputRange: [0, 1],
|
|
19996
|
+
outputRange: ['0deg', '-45deg']
|
|
19997
|
+
});
|
|
19998
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
19999
|
+
style: StyleSheet$1.flatten([{
|
|
20000
|
+
transform: [{
|
|
20001
|
+
rotate: interpolatedRotateAnimation
|
|
20002
|
+
}]
|
|
20003
|
+
}])
|
|
20004
|
+
}, /*#__PURE__*/React.createElement(AnimatedIcons, iconProps));
|
|
20005
|
+
};
|
|
20006
|
+
|
|
20007
|
+
var _templateObject;
|
|
20008
|
+
var StyledFABContainer = styled(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) {
|
|
20009
|
+
var theme = _ref.theme;
|
|
20010
|
+
return theme.__hd__.fab.sizes.height;
|
|
20011
|
+
}, function (_ref2) {
|
|
20012
|
+
var theme = _ref2.theme;
|
|
20013
|
+
return theme.__hd__.fab.sizes.width;
|
|
20014
|
+
}, function (_ref3) {
|
|
20015
|
+
var theme = _ref3.theme;
|
|
20016
|
+
return theme.__hd__.fab.colors.buttonBackground;
|
|
20017
|
+
});
|
|
20018
|
+
|
|
20019
|
+
var FAB = function FAB(_ref) {
|
|
20020
|
+
var _onPress = _ref.onPress,
|
|
20021
|
+
icon = _ref.icon,
|
|
20022
|
+
animated = _ref.animated,
|
|
20023
|
+
testID = _ref.testID,
|
|
20024
|
+
active = _ref.active,
|
|
20025
|
+
style = _ref.style;
|
|
20026
|
+
return /*#__PURE__*/React.createElement(StyledFABContainer, {
|
|
20027
|
+
testID: testID,
|
|
20028
|
+
onPress: function onPress() {
|
|
20029
|
+
_onPress === null || _onPress === void 0 ? void 0 : _onPress();
|
|
20030
|
+
},
|
|
20031
|
+
activeOpacity: 0.6,
|
|
20032
|
+
style: style
|
|
20033
|
+
}, animated ? /*#__PURE__*/React.createElement(AnimatedFABIcon, {
|
|
20034
|
+
active: active,
|
|
20035
|
+
icon: icon,
|
|
20036
|
+
testID: "animatedFABIcon"
|
|
20037
|
+
}) : /*#__PURE__*/React.createElement(StyledFABIcon, {
|
|
20038
|
+
icon: icon,
|
|
20039
|
+
testID: "styledFABIcon"
|
|
20040
|
+
}));
|
|
20041
|
+
};
|
|
20042
|
+
|
|
20043
|
+
export { Badge, Card, Divider, FAB, Icon, ThemeProvider, Typography, getTheme, scale, theme, useTheme };
|
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 = [];
|
|
@@ -9881,30 +9881,41 @@ var systemPalette = {
|
|
|
9881
9881
|
outline: palette.greyLight60
|
|
9882
9882
|
};
|
|
9883
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
|
+
|
|
9884
9895
|
var BASE$1 = 8;
|
|
9885
9896
|
var space = {
|
|
9886
|
-
xxsmall: BASE$1 * 0.25,
|
|
9887
|
-
xsmall: BASE$1 * 0.5,
|
|
9888
|
-
small: BASE$1,
|
|
9889
|
-
medium: BASE$1 * 2,
|
|
9890
|
-
large: BASE$1 * 3,
|
|
9891
|
-
xlarge: BASE$1 * 4,
|
|
9892
|
-
xxlarge: BASE$1 * 5,
|
|
9893
|
-
xxxlarge: BASE$1 * 6,
|
|
9894
|
-
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)
|
|
9895
9906
|
};
|
|
9896
9907
|
|
|
9897
9908
|
var BASE = 16;
|
|
9898
9909
|
var fontSizes = {
|
|
9899
|
-
xxxxxlarge: BASE * 2,
|
|
9900
|
-
xxxxlarge: BASE * 1.75,
|
|
9901
|
-
xxxlarge: BASE * 1.5,
|
|
9902
|
-
xxlarge: BASE * 1.25,
|
|
9903
|
-
xlarge: BASE * 1.125,
|
|
9904
|
-
large: BASE,
|
|
9905
|
-
medium: BASE * 0.875,
|
|
9906
|
-
small: BASE * 0.75,
|
|
9907
|
-
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
|
|
9908
9919
|
|
|
9909
9920
|
};
|
|
9910
9921
|
var fontWeights = {
|
|
@@ -9975,7 +9986,7 @@ var getCardTheme = function getCardTheme(theme) {
|
|
|
9975
9986
|
"default": "12px"
|
|
9976
9987
|
};
|
|
9977
9988
|
var padding = {
|
|
9978
|
-
"default": "".concat(theme.space.
|
|
9989
|
+
"default": "".concat(theme.space.small, "px")
|
|
9979
9990
|
};
|
|
9980
9991
|
return {
|
|
9981
9992
|
radii: radii,
|
|
@@ -10056,6 +10067,25 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
10056
10067
|
};
|
|
10057
10068
|
};
|
|
10058
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
|
+
|
|
10059
10089
|
var getTheme = function getTheme() {
|
|
10060
10090
|
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
10061
10091
|
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
@@ -10064,21 +10094,22 @@ var getTheme = function getTheme() {
|
|
|
10064
10094
|
card: getCardTheme(theme),
|
|
10065
10095
|
divider: getDividerTheme(theme),
|
|
10066
10096
|
icon: getIconTheme(theme),
|
|
10067
|
-
typography: getTypographyTheme(theme)
|
|
10097
|
+
typography: getTypographyTheme(theme),
|
|
10098
|
+
fab: getFABTheme(theme)
|
|
10068
10099
|
}
|
|
10069
10100
|
});
|
|
10070
10101
|
};
|
|
10071
10102
|
|
|
10072
10103
|
var theme = getTheme();
|
|
10073
10104
|
|
|
10074
|
-
var _templateObject$
|
|
10105
|
+
var _templateObject$6, _templateObject2$3, _templateObject3$2, _templateObject4$2;
|
|
10075
10106
|
var BACKGROUND_INTENTS = {
|
|
10076
10107
|
success: 'successBackground',
|
|
10077
10108
|
warning: 'warningBackground',
|
|
10078
10109
|
danger: 'dangerBackground',
|
|
10079
10110
|
info: 'infoBackground'
|
|
10080
10111
|
};
|
|
10081
|
-
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) {
|
|
10082
10113
|
var theme = _ref.theme;
|
|
10083
10114
|
return theme.__hd__.badge.borderWidths["default"];
|
|
10084
10115
|
}, function (_ref2) {
|
|
@@ -10111,7 +10142,7 @@ var StyledText$1 = styled(require$$0$1.Text)(_templateObject3$2 || (_templateObj
|
|
|
10111
10142
|
});
|
|
10112
10143
|
});
|
|
10113
10144
|
|
|
10114
|
-
var _excluded$
|
|
10145
|
+
var _excluded$3 = ["content", "intent", "style", "testID"];
|
|
10115
10146
|
|
|
10116
10147
|
var Badge = function Badge(_ref) {
|
|
10117
10148
|
var content = _ref.content,
|
|
@@ -10119,7 +10150,7 @@ var Badge = function Badge(_ref) {
|
|
|
10119
10150
|
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
10120
10151
|
style = _ref.style,
|
|
10121
10152
|
testID = _ref.testID,
|
|
10122
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10153
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$3);
|
|
10123
10154
|
|
|
10124
10155
|
return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({
|
|
10125
10156
|
themeIntent: intent,
|
|
@@ -10130,8 +10161,8 @@ var Badge = function Badge(_ref) {
|
|
|
10130
10161
|
}, content));
|
|
10131
10162
|
};
|
|
10132
10163
|
|
|
10133
|
-
var _templateObject$
|
|
10134
|
-
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"])), function (_ref) {
|
|
10135
10166
|
var theme = _ref.theme;
|
|
10136
10167
|
return theme.__hd__.card.radii["default"];
|
|
10137
10168
|
}, function (_ref2) {
|
|
@@ -10143,8 +10174,8 @@ var Card = function Card(props) {
|
|
|
10143
10174
|
return /*#__PURE__*/React__default["default"].createElement(StyledCard, props);
|
|
10144
10175
|
};
|
|
10145
10176
|
|
|
10146
|
-
var _templateObject$
|
|
10147
|
-
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) {
|
|
10148
10179
|
var theme = _ref.theme;
|
|
10149
10180
|
return theme.__hd__.divider.borderWidths["default"];
|
|
10150
10181
|
}, function (_ref2) {
|
|
@@ -10198,14 +10229,14 @@ var StyledDivider = styled(require$$0$1.View)(_templateObject$2 || (_templateObj
|
|
|
10198
10229
|
}
|
|
10199
10230
|
});
|
|
10200
10231
|
|
|
10201
|
-
var _excluded$
|
|
10232
|
+
var _excluded$2 = ["marginHorizontal", "marginVertical", "style", "testID"];
|
|
10202
10233
|
|
|
10203
10234
|
var Divider = function Divider(_ref) {
|
|
10204
10235
|
var marginHorizontal = _ref.marginHorizontal,
|
|
10205
10236
|
marginVertical = _ref.marginVertical,
|
|
10206
10237
|
style = _ref.style,
|
|
10207
10238
|
testID = _ref.testID,
|
|
10208
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded$
|
|
10239
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$2);
|
|
10209
10240
|
|
|
10210
10241
|
return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({
|
|
10211
10242
|
themeMarginHorizontal: marginHorizontal,
|
|
@@ -19843,9 +19874,9 @@ var heroIconConfig = {
|
|
|
19843
19874
|
preferences: preferences
|
|
19844
19875
|
};
|
|
19845
19876
|
|
|
19846
|
-
var _templateObject$
|
|
19877
|
+
var _templateObject$3, _templateObject2$1;
|
|
19847
19878
|
var HeroIcon = dist.createIconSetFromIcoMoon(heroIconConfig, 'hero-icons', 'hero-icons.ttf');
|
|
19848
|
-
var StyledHeroIcon = styled(HeroIcon)(_templateObject$
|
|
19879
|
+
var StyledHeroIcon = styled(HeroIcon)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
|
|
19849
19880
|
var themeIntent = _ref.themeIntent,
|
|
19850
19881
|
themeSize = _ref.themeSize;
|
|
19851
19882
|
return css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", "px;\n "])), function (_ref2) {
|
|
@@ -19874,8 +19905,8 @@ var Icon = function Icon(_ref) {
|
|
|
19874
19905
|
});
|
|
19875
19906
|
};
|
|
19876
19907
|
|
|
19877
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
19878
|
-
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) {
|
|
19879
19910
|
var themeFontSize = _ref.themeFontSize,
|
|
19880
19911
|
theme = _ref.theme;
|
|
19881
19912
|
|
|
@@ -19919,7 +19950,7 @@ var StyledText = styled(require$$0$1.Text)(_templateObject || (_templateObject =
|
|
|
19919
19950
|
}
|
|
19920
19951
|
});
|
|
19921
19952
|
|
|
19922
|
-
var _excluded = ["children", "fontSize", "fontWeight", "intent"];
|
|
19953
|
+
var _excluded$1 = ["children", "fontSize", "fontWeight", "intent"];
|
|
19923
19954
|
|
|
19924
19955
|
var Text = function Text(_ref) {
|
|
19925
19956
|
var children = _ref.children,
|
|
@@ -19929,7 +19960,7 @@ var Text = function Text(_ref) {
|
|
|
19929
19960
|
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
19930
19961
|
_ref$intent = _ref.intent,
|
|
19931
19962
|
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
19932
|
-
nativeProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
19963
|
+
nativeProps = _objectWithoutProperties$1(_ref, _excluded$1);
|
|
19933
19964
|
|
|
19934
19965
|
return /*#__PURE__*/React__default["default"].createElement(StyledText, _extends$1({
|
|
19935
19966
|
themeFontSize: fontSize,
|
|
@@ -19942,12 +19973,90 @@ var Typography = {
|
|
|
19942
19973
|
Text: Text
|
|
19943
19974
|
};
|
|
19944
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
|
+
|
|
19945
20052
|
exports.Badge = Badge;
|
|
19946
20053
|
exports.Card = Card;
|
|
19947
20054
|
exports.Divider = Divider;
|
|
20055
|
+
exports.FAB = FAB;
|
|
19948
20056
|
exports.Icon = Icon;
|
|
19949
20057
|
exports.ThemeProvider = ThemeProvider;
|
|
19950
20058
|
exports.Typography = Typography;
|
|
19951
20059
|
exports.getTheme = getTheme;
|
|
20060
|
+
exports.scale = scale;
|
|
19952
20061
|
exports.theme = theme;
|
|
19953
20062
|
exports.useTheme = useTheme;
|