@hero-design/rn 6.7.4-1 → 7.0.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/.eslintrc.json +11 -2
- package/app.json +4 -0
- package/babel.config.js +15 -1
- package/es/index.js +96 -50
- package/jest.config.js +4 -0
- package/lib/index.js +96 -49
- package/package.json +16 -6
- package/playground/components/Card.tsx +52 -0
- package/playground/components/Divider.tsx +13 -0
- package/playground/index.tsx +4 -2
- package/src/components/Card/StyledCard.tsx +9 -0
- package/src/components/Card/__tests__/Card.spec.tsx +36 -0
- package/src/components/{ExampleComponent/__tests__/StyledView.spec.tsx → Card/__tests__/StyledCard.spec.tsx} +4 -9
- package/src/components/Card/__tests__/__snapshots__/Card.spec.tsx.snap +39 -0
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +18 -0
- package/src/components/Card/index.tsx +9 -0
- package/src/components/Divider/StyledDivider.tsx +70 -0
- package/src/components/Divider/__tests__/StyledDivider.spec.tsx +42 -0
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +165 -0
- package/src/components/Divider/index.tsx +22 -0
- package/src/index.ts +4 -4
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +89 -0
- package/src/theme/__tests__/index.spec.ts +7 -0
- package/src/theme/components/card.ts +15 -0
- package/src/theme/components/divider.ts +23 -0
- package/src/theme/global/borders.ts +3 -0
- package/src/theme/global/colors.ts +3 -1
- package/src/theme/global/index.ts +2 -0
- package/src/theme/index.ts +6 -3
- package/tsconfig.json +4 -0
- package/types/components/Card/StyledCard.d.ts +3 -0
- package/types/components/Card/__tests__/Card.spec.d.ts +1 -0
- package/types/components/Card/__tests__/StyledCard.spec.d.ts +1 -0
- package/types/components/Card/index.d.ts +5 -0
- package/types/components/Divider/StyledDivider.d.ts +7 -0
- package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +1 -0
- package/types/components/Divider/index.d.ts +12 -0
- package/types/index.d.ts +4 -3
- package/types/theme/__tests__/index.spec.d.ts +1 -0
- package/types/theme/components/card.d.ts +10 -0
- package/types/theme/components/divider.d.ts +17 -0
- package/types/theme/global/borders.d.ts +4 -0
- package/types/theme/global/colors.d.ts +2 -0
- package/types/theme/global/index.d.ts +5 -0
- package/types/theme/index.d.ts +4 -2
- package/playground/components/ExampleComponent.tsx +0 -8
- package/src/components/ExampleComponent/StyledView.tsx +0 -68
- package/src/components/ExampleComponent/__tests__/__snapshots__/StyledView.spec.tsx.snap +0 -23
- package/src/components/ExampleComponent/index.tsx +0 -26
- package/src/theme/components/exampleComponent.ts +0 -19
package/.eslintrc.json
CHANGED
|
@@ -23,7 +23,13 @@
|
|
|
23
23
|
"import/resolver": {
|
|
24
24
|
"node": {
|
|
25
25
|
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"eslint-import-resolver-custom-alias": {
|
|
28
|
+
"alias": {
|
|
29
|
+
"styled-components-native": "./src/styled-components.ts"
|
|
30
|
+
},
|
|
31
|
+
"extensions": [".ts",".tsx"]
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
},
|
|
29
35
|
"rules": {
|
|
@@ -35,12 +41,15 @@
|
|
|
35
41
|
{ "extensions": [".js", ".jsx", ".tsx"] }
|
|
36
42
|
],
|
|
37
43
|
"import/prefer-default-export": 0,
|
|
38
|
-
"import/extensions": 0
|
|
44
|
+
"import/extensions": 0,
|
|
45
|
+
"no-use-before-define": 0,
|
|
46
|
+
"@typescript-eslint/no-use-before-define": 2
|
|
39
47
|
},
|
|
40
48
|
"overrides": [
|
|
41
49
|
{
|
|
42
50
|
"files": ["*.ts", "*.tsx"],
|
|
43
51
|
"rules": {
|
|
52
|
+
"no-undef": 0,
|
|
44
53
|
"consistent-return": 0,
|
|
45
54
|
"default-case": 0,
|
|
46
55
|
"no-underscore-dangle": [2, { "allow": ["__hd__"] }]
|
package/app.json
CHANGED
package/babel.config.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
module.exports = function(api) {
|
|
1
|
+
module.exports = function (api) {
|
|
2
2
|
const isFromRollup = api.caller(
|
|
3
3
|
caller => caller && caller.name === '@rollup/plugin-babel'
|
|
4
4
|
);
|
|
5
5
|
|
|
6
|
+
const plugins = [
|
|
7
|
+
[
|
|
8
|
+
require.resolve('babel-plugin-module-resolver'),
|
|
9
|
+
{
|
|
10
|
+
root: ['.'],
|
|
11
|
+
alias: {
|
|
12
|
+
'styled-components-native': './src/styled-components.ts',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
];
|
|
17
|
+
|
|
6
18
|
if (isFromRollup) {
|
|
7
19
|
return {
|
|
8
20
|
presets: [
|
|
@@ -10,10 +22,12 @@ module.exports = function(api) {
|
|
|
10
22
|
['@babel/preset-typescript', { isTSX: true, allExtensions: true }],
|
|
11
23
|
'@babel/preset-react',
|
|
12
24
|
],
|
|
25
|
+
plugins,
|
|
13
26
|
};
|
|
14
27
|
}
|
|
15
28
|
|
|
16
29
|
return {
|
|
17
30
|
presets: ['babel-preset-expo'],
|
|
31
|
+
plugins,
|
|
18
32
|
};
|
|
19
33
|
};
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useMemo, createElement } from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
@@ -9843,11 +9843,13 @@ var systemPalette = {
|
|
|
9843
9843
|
warning: palette.orange,
|
|
9844
9844
|
warningDark: palette.orangeDark15,
|
|
9845
9845
|
warningBackground: palette.orangeLight90,
|
|
9846
|
-
platformBackground: palette.
|
|
9846
|
+
platformBackground: palette.white,
|
|
9847
|
+
backgroundLight: palette.greyLight95,
|
|
9847
9848
|
backgroundDark: palette.greyDark75,
|
|
9848
9849
|
text: palette.greyDark75,
|
|
9849
9850
|
disabledText: palette.greyDark15,
|
|
9850
|
-
invertedText: palette.white
|
|
9851
|
+
invertedText: palette.white,
|
|
9852
|
+
outline: palette.greyLight60
|
|
9851
9853
|
};
|
|
9852
9854
|
|
|
9853
9855
|
var BASE$1 = 8;
|
|
@@ -9886,28 +9888,50 @@ var lineHeights = {
|
|
|
9886
9888
|
xsmall: fontSizes.xsmall + 8
|
|
9887
9889
|
};
|
|
9888
9890
|
|
|
9891
|
+
var borderWidths = {
|
|
9892
|
+
base: 1
|
|
9893
|
+
};
|
|
9894
|
+
|
|
9889
9895
|
var globalTheme = {
|
|
9890
9896
|
colors: _objectSpread2({}, systemPalette),
|
|
9891
9897
|
space: space,
|
|
9892
9898
|
fontSizes: fontSizes,
|
|
9893
9899
|
fontWeights: fontWeights,
|
|
9894
|
-
lineHeights: lineHeights
|
|
9900
|
+
lineHeights: lineHeights,
|
|
9901
|
+
borderWidths: borderWidths
|
|
9895
9902
|
};
|
|
9896
9903
|
|
|
9897
|
-
var
|
|
9904
|
+
var getDividerTheme = function getDividerTheme(theme) {
|
|
9898
9905
|
var colors = {
|
|
9899
|
-
|
|
9900
|
-
dangerBg: theme.colors.dangerBackground,
|
|
9901
|
-
warningBg: theme.colors.warningBackground
|
|
9906
|
+
"default": theme.colors.outline
|
|
9902
9907
|
};
|
|
9903
9908
|
var space = {
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9909
|
+
xsmall: "".concat(theme.space.xsmall, "px"),
|
|
9910
|
+
small: "".concat(theme.space.small, "px"),
|
|
9911
|
+
medium: "".concat(theme.space.medium, "px"),
|
|
9912
|
+
large: "".concat(theme.space.large, "px"),
|
|
9913
|
+
xlarge: "".concat(theme.space.xlarge, "px")
|
|
9914
|
+
};
|
|
9915
|
+
var borderWiths = {
|
|
9916
|
+
"default": "".concat(theme.borderWidths.base, "px")
|
|
9907
9917
|
};
|
|
9908
9918
|
return {
|
|
9909
9919
|
colors: colors,
|
|
9910
|
-
space: space
|
|
9920
|
+
space: space,
|
|
9921
|
+
borderWiths: borderWiths
|
|
9922
|
+
};
|
|
9923
|
+
};
|
|
9924
|
+
|
|
9925
|
+
var getCardTheme = function getCardTheme(theme) {
|
|
9926
|
+
var radii = {
|
|
9927
|
+
"default": "12px"
|
|
9928
|
+
};
|
|
9929
|
+
var padding = {
|
|
9930
|
+
"default": "".concat(theme.space.medium, "px")
|
|
9931
|
+
};
|
|
9932
|
+
return {
|
|
9933
|
+
radii: radii,
|
|
9934
|
+
padding: padding
|
|
9911
9935
|
};
|
|
9912
9936
|
};
|
|
9913
9937
|
|
|
@@ -9915,67 +9939,89 @@ var getTheme = function getTheme() {
|
|
|
9915
9939
|
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
9916
9940
|
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
9917
9941
|
__hd__: {
|
|
9918
|
-
|
|
9942
|
+
divider: getDividerTheme(theme),
|
|
9943
|
+
card: getCardTheme(theme)
|
|
9919
9944
|
}
|
|
9920
9945
|
});
|
|
9921
9946
|
};
|
|
9922
9947
|
|
|
9923
9948
|
var theme = getTheme();
|
|
9924
9949
|
|
|
9925
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
9926
|
-
var
|
|
9927
|
-
var
|
|
9950
|
+
var _templateObject$1, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
9951
|
+
var StyledDivider = styled(View)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n border-bottom-width: ", ";\n border-bottom-color: ", ";\n max-width: 100%;\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
9952
|
+
var theme = _ref.theme;
|
|
9953
|
+
return theme.__hd__.divider.borderWiths["default"];
|
|
9954
|
+
}, function (_ref2) {
|
|
9955
|
+
var theme = _ref2.theme;
|
|
9956
|
+
return theme.__hd__.divider.colors["default"];
|
|
9957
|
+
}, function (_ref3) {
|
|
9958
|
+
var themeMarginHorizontal = _ref3.themeMarginHorizontal,
|
|
9959
|
+
theme = _ref3.theme;
|
|
9960
|
+
|
|
9961
|
+
switch (themeMarginHorizontal) {
|
|
9962
|
+
case undefined:
|
|
9963
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
9964
|
+
|
|
9965
|
+
case 'xsmall':
|
|
9966
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xsmall);
|
|
9928
9967
|
|
|
9929
|
-
switch (themeSize) {
|
|
9930
9968
|
case 'small':
|
|
9931
|
-
return css(
|
|
9969
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.small);
|
|
9932
9970
|
|
|
9933
9971
|
case 'medium':
|
|
9934
|
-
return css(
|
|
9972
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.medium);
|
|
9935
9973
|
|
|
9936
9974
|
case 'large':
|
|
9937
|
-
return css(
|
|
9975
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.large);
|
|
9976
|
+
|
|
9977
|
+
case 'xlarge':
|
|
9978
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xlarge);
|
|
9938
9979
|
}
|
|
9939
|
-
}, function (
|
|
9940
|
-
var
|
|
9941
|
-
theme =
|
|
9980
|
+
}, function (_ref4) {
|
|
9981
|
+
var themeMarginVertical = _ref4.themeMarginVertical,
|
|
9982
|
+
theme = _ref4.theme;
|
|
9983
|
+
|
|
9984
|
+
switch (themeMarginVertical) {
|
|
9985
|
+
case undefined:
|
|
9986
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral([""])));
|
|
9987
|
+
|
|
9988
|
+
case 'xsmall':
|
|
9989
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xsmall);
|
|
9942
9990
|
|
|
9943
|
-
switch (themeMargin) {
|
|
9944
9991
|
case 'small':
|
|
9945
|
-
return css(
|
|
9992
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.small);
|
|
9946
9993
|
|
|
9947
9994
|
case 'medium':
|
|
9948
|
-
return css(
|
|
9995
|
+
return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.medium);
|
|
9949
9996
|
|
|
9950
9997
|
case 'large':
|
|
9951
|
-
return css(
|
|
9952
|
-
}
|
|
9953
|
-
}, function (_ref3) {
|
|
9954
|
-
var themeBgColor = _ref3.themeBgColor,
|
|
9955
|
-
theme = _ref3.theme;
|
|
9998
|
+
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.large);
|
|
9956
9999
|
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
10000
|
+
case 'xlarge':
|
|
10001
|
+
return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xlarge);
|
|
10002
|
+
}
|
|
10003
|
+
});
|
|
9960
10004
|
|
|
9961
|
-
|
|
9962
|
-
|
|
10005
|
+
var Divider = function Divider(_ref) {
|
|
10006
|
+
var marginHorizontal = _ref.marginHorizontal,
|
|
10007
|
+
marginVertical = _ref.marginVertical;
|
|
10008
|
+
return /*#__PURE__*/React.createElement(StyledDivider, {
|
|
10009
|
+
themeMarginHorizontal: marginHorizontal,
|
|
10010
|
+
themeMarginVertical: marginVertical
|
|
10011
|
+
});
|
|
10012
|
+
};
|
|
9963
10013
|
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
10014
|
+
var _templateObject;
|
|
10015
|
+
var StyledCard = styled(View)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: ", ";\n padding: ", ";\n"])), function (_ref) {
|
|
10016
|
+
var theme = _ref.theme;
|
|
10017
|
+
return theme.__hd__.card.radii["default"];
|
|
10018
|
+
}, function (_ref2) {
|
|
10019
|
+
var theme = _ref2.theme;
|
|
10020
|
+
return theme.__hd__.card.padding["default"];
|
|
9967
10021
|
});
|
|
9968
10022
|
|
|
9969
|
-
var
|
|
9970
|
-
|
|
9971
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
9972
|
-
margin = _ref.margin,
|
|
9973
|
-
bgColor = _ref.bgColor;
|
|
9974
|
-
return /*#__PURE__*/React.createElement(Square, {
|
|
9975
|
-
themeSize: size,
|
|
9976
|
-
themeMargin: margin,
|
|
9977
|
-
themeBgColor: bgColor
|
|
9978
|
-
}, /*#__PURE__*/React.createElement(Text, null, "Square with ".concat(size, " size, ").concat(margin, " margin and ").concat(bgColor, " background.")));
|
|
10023
|
+
var Card = function Card(props) {
|
|
10024
|
+
return /*#__PURE__*/React.createElement(StyledCard, props);
|
|
9979
10025
|
};
|
|
9980
10026
|
|
|
9981
|
-
export {
|
|
10027
|
+
export { Card, Divider, ThemeProvider, getTheme, theme, useTheme };
|
package/jest.config.js
CHANGED
|
@@ -15,4 +15,8 @@ module.exports = {
|
|
|
15
15
|
testPathIgnorePatterns: ['\\.snap$', '<rootDir>/node_modules/'],
|
|
16
16
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
17
17
|
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
|
|
18
|
+
roots: ['<rootDir>/src'],
|
|
19
|
+
moduleNameMapper: {
|
|
20
|
+
'styled-components-native': '<rootDir>/src/styled-components.ts',
|
|
21
|
+
},
|
|
18
22
|
};
|
package/lib/index.js
CHANGED
|
@@ -9851,11 +9851,13 @@ var systemPalette = {
|
|
|
9851
9851
|
warning: palette.orange,
|
|
9852
9852
|
warningDark: palette.orangeDark15,
|
|
9853
9853
|
warningBackground: palette.orangeLight90,
|
|
9854
|
-
platformBackground: palette.
|
|
9854
|
+
platformBackground: palette.white,
|
|
9855
|
+
backgroundLight: palette.greyLight95,
|
|
9855
9856
|
backgroundDark: palette.greyDark75,
|
|
9856
9857
|
text: palette.greyDark75,
|
|
9857
9858
|
disabledText: palette.greyDark15,
|
|
9858
|
-
invertedText: palette.white
|
|
9859
|
+
invertedText: palette.white,
|
|
9860
|
+
outline: palette.greyLight60
|
|
9859
9861
|
};
|
|
9860
9862
|
|
|
9861
9863
|
var BASE$1 = 8;
|
|
@@ -9894,28 +9896,50 @@ var lineHeights = {
|
|
|
9894
9896
|
xsmall: fontSizes.xsmall + 8
|
|
9895
9897
|
};
|
|
9896
9898
|
|
|
9899
|
+
var borderWidths = {
|
|
9900
|
+
base: 1
|
|
9901
|
+
};
|
|
9902
|
+
|
|
9897
9903
|
var globalTheme = {
|
|
9898
9904
|
colors: _objectSpread2({}, systemPalette),
|
|
9899
9905
|
space: space,
|
|
9900
9906
|
fontSizes: fontSizes,
|
|
9901
9907
|
fontWeights: fontWeights,
|
|
9902
|
-
lineHeights: lineHeights
|
|
9908
|
+
lineHeights: lineHeights,
|
|
9909
|
+
borderWidths: borderWidths
|
|
9903
9910
|
};
|
|
9904
9911
|
|
|
9905
|
-
var
|
|
9912
|
+
var getDividerTheme = function getDividerTheme(theme) {
|
|
9906
9913
|
var colors = {
|
|
9907
|
-
|
|
9908
|
-
dangerBg: theme.colors.dangerBackground,
|
|
9909
|
-
warningBg: theme.colors.warningBackground
|
|
9914
|
+
"default": theme.colors.outline
|
|
9910
9915
|
};
|
|
9911
9916
|
var space = {
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9917
|
+
xsmall: "".concat(theme.space.xsmall, "px"),
|
|
9918
|
+
small: "".concat(theme.space.small, "px"),
|
|
9919
|
+
medium: "".concat(theme.space.medium, "px"),
|
|
9920
|
+
large: "".concat(theme.space.large, "px"),
|
|
9921
|
+
xlarge: "".concat(theme.space.xlarge, "px")
|
|
9922
|
+
};
|
|
9923
|
+
var borderWiths = {
|
|
9924
|
+
"default": "".concat(theme.borderWidths.base, "px")
|
|
9915
9925
|
};
|
|
9916
9926
|
return {
|
|
9917
9927
|
colors: colors,
|
|
9918
|
-
space: space
|
|
9928
|
+
space: space,
|
|
9929
|
+
borderWiths: borderWiths
|
|
9930
|
+
};
|
|
9931
|
+
};
|
|
9932
|
+
|
|
9933
|
+
var getCardTheme = function getCardTheme(theme) {
|
|
9934
|
+
var radii = {
|
|
9935
|
+
"default": "12px"
|
|
9936
|
+
};
|
|
9937
|
+
var padding = {
|
|
9938
|
+
"default": "".concat(theme.space.medium, "px")
|
|
9939
|
+
};
|
|
9940
|
+
return {
|
|
9941
|
+
radii: radii,
|
|
9942
|
+
padding: padding
|
|
9919
9943
|
};
|
|
9920
9944
|
};
|
|
9921
9945
|
|
|
@@ -9923,70 +9947,93 @@ var getTheme = function getTheme() {
|
|
|
9923
9947
|
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
9924
9948
|
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
9925
9949
|
__hd__: {
|
|
9926
|
-
|
|
9950
|
+
divider: getDividerTheme(theme),
|
|
9951
|
+
card: getCardTheme(theme)
|
|
9927
9952
|
}
|
|
9928
9953
|
});
|
|
9929
9954
|
};
|
|
9930
9955
|
|
|
9931
9956
|
var theme = getTheme();
|
|
9932
9957
|
|
|
9933
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
9934
|
-
var
|
|
9935
|
-
var
|
|
9958
|
+
var _templateObject$1, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
9959
|
+
var StyledDivider = styled(reactNative$1.View)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n border-bottom-width: ", ";\n border-bottom-color: ", ";\n max-width: 100%;\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
9960
|
+
var theme = _ref.theme;
|
|
9961
|
+
return theme.__hd__.divider.borderWiths["default"];
|
|
9962
|
+
}, function (_ref2) {
|
|
9963
|
+
var theme = _ref2.theme;
|
|
9964
|
+
return theme.__hd__.divider.colors["default"];
|
|
9965
|
+
}, function (_ref3) {
|
|
9966
|
+
var themeMarginHorizontal = _ref3.themeMarginHorizontal,
|
|
9967
|
+
theme = _ref3.theme;
|
|
9968
|
+
|
|
9969
|
+
switch (themeMarginHorizontal) {
|
|
9970
|
+
case undefined:
|
|
9971
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
9972
|
+
|
|
9973
|
+
case 'xsmall':
|
|
9974
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xsmall);
|
|
9936
9975
|
|
|
9937
|
-
switch (themeSize) {
|
|
9938
9976
|
case 'small':
|
|
9939
|
-
return css(
|
|
9977
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.small);
|
|
9940
9978
|
|
|
9941
9979
|
case 'medium':
|
|
9942
|
-
return css(
|
|
9980
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.medium);
|
|
9943
9981
|
|
|
9944
9982
|
case 'large':
|
|
9945
|
-
return css(
|
|
9983
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.large);
|
|
9984
|
+
|
|
9985
|
+
case 'xlarge':
|
|
9986
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-horizontal: ", ";\n "])), theme.__hd__.divider.space.xlarge);
|
|
9946
9987
|
}
|
|
9947
|
-
}, function (
|
|
9948
|
-
var
|
|
9949
|
-
theme =
|
|
9988
|
+
}, function (_ref4) {
|
|
9989
|
+
var themeMarginVertical = _ref4.themeMarginVertical,
|
|
9990
|
+
theme = _ref4.theme;
|
|
9991
|
+
|
|
9992
|
+
switch (themeMarginVertical) {
|
|
9993
|
+
case undefined:
|
|
9994
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral([""])));
|
|
9995
|
+
|
|
9996
|
+
case 'xsmall':
|
|
9997
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xsmall);
|
|
9950
9998
|
|
|
9951
|
-
switch (themeMargin) {
|
|
9952
9999
|
case 'small':
|
|
9953
|
-
return css(
|
|
10000
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.small);
|
|
9954
10001
|
|
|
9955
10002
|
case 'medium':
|
|
9956
|
-
return css(
|
|
10003
|
+
return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.medium);
|
|
9957
10004
|
|
|
9958
10005
|
case 'large':
|
|
9959
|
-
return css(
|
|
9960
|
-
}
|
|
9961
|
-
}, function (_ref3) {
|
|
9962
|
-
var themeBgColor = _ref3.themeBgColor,
|
|
9963
|
-
theme = _ref3.theme;
|
|
10006
|
+
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.large);
|
|
9964
10007
|
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
10008
|
+
case 'xlarge':
|
|
10009
|
+
return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-vertical: ", ";\n "])), theme.__hd__.divider.space.xlarge);
|
|
10010
|
+
}
|
|
10011
|
+
});
|
|
9968
10012
|
|
|
9969
|
-
|
|
9970
|
-
|
|
10013
|
+
var Divider = function Divider(_ref) {
|
|
10014
|
+
var marginHorizontal = _ref.marginHorizontal,
|
|
10015
|
+
marginVertical = _ref.marginVertical;
|
|
10016
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledDivider, {
|
|
10017
|
+
themeMarginHorizontal: marginHorizontal,
|
|
10018
|
+
themeMarginVertical: marginVertical
|
|
10019
|
+
});
|
|
10020
|
+
};
|
|
9971
10021
|
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
10022
|
+
var _templateObject;
|
|
10023
|
+
var StyledCard = styled(reactNative$1.View)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: ", ";\n padding: ", ";\n"])), function (_ref) {
|
|
10024
|
+
var theme = _ref.theme;
|
|
10025
|
+
return theme.__hd__.card.radii["default"];
|
|
10026
|
+
}, function (_ref2) {
|
|
10027
|
+
var theme = _ref2.theme;
|
|
10028
|
+
return theme.__hd__.card.padding["default"];
|
|
9975
10029
|
});
|
|
9976
10030
|
|
|
9977
|
-
var
|
|
9978
|
-
|
|
9979
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
9980
|
-
margin = _ref.margin,
|
|
9981
|
-
bgColor = _ref.bgColor;
|
|
9982
|
-
return /*#__PURE__*/React__default["default"].createElement(Square, {
|
|
9983
|
-
themeSize: size,
|
|
9984
|
-
themeMargin: margin,
|
|
9985
|
-
themeBgColor: bgColor
|
|
9986
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactNative$1.Text, null, "Square with ".concat(size, " size, ").concat(margin, " margin and ").concat(bgColor, " background.")));
|
|
10031
|
+
var Card = function Card(props) {
|
|
10032
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledCard, props);
|
|
9987
10033
|
};
|
|
9988
10034
|
|
|
9989
|
-
exports.
|
|
10035
|
+
exports.Card = Card;
|
|
10036
|
+
exports.Divider = Divider;
|
|
9990
10037
|
exports.ThemeProvider = ThemeProvider;
|
|
9991
10038
|
exports.getTheme = getTheme;
|
|
9992
10039
|
exports.theme = theme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"lint": "eslint src playground --ext .js,.jsx,.ts,.tsx --ignore-path ../../.gitignore",
|
|
10
10
|
"type-check": "tsc --noEmit",
|
|
11
11
|
"dev": "expo start",
|
|
12
|
-
"test": "jest --runInBand",
|
|
12
|
+
"test": "jest --runInBand --watch",
|
|
13
|
+
"test:ci": "jest --runInBand --logHeapUsage",
|
|
13
14
|
"build:js": "rollup -c",
|
|
14
15
|
"build:types": "tsc --noEmit false --emitDeclarationOnly",
|
|
15
16
|
"build": "yarn build:js && yarn build:types",
|
|
16
17
|
"publish:npm": "yarn publish --access public"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@hero-design/colors": "
|
|
20
|
+
"@hero-design/colors": "7.0.1",
|
|
20
21
|
"styled-components": "6.0.0-alpha.5"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"@types/styled-components-react-native": "^5.1.3",
|
|
46
47
|
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
47
48
|
"@typescript-eslint/parser": "^5.12.1",
|
|
49
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
48
50
|
"eslint": "^8.9.0",
|
|
49
51
|
"eslint-config-airbnb": "^19.0.4",
|
|
50
52
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -67,18 +69,26 @@
|
|
|
67
69
|
},
|
|
68
70
|
"nx": {
|
|
69
71
|
"targets": {
|
|
72
|
+
"type-check": {
|
|
73
|
+
"dependsOn": [
|
|
74
|
+
{
|
|
75
|
+
"target": "build:types",
|
|
76
|
+
"projects": "dependencies"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
70
80
|
"lint": {
|
|
71
81
|
"dependsOn": [
|
|
72
82
|
{
|
|
73
|
-
"target": "build",
|
|
83
|
+
"target": "build:js",
|
|
74
84
|
"projects": "dependencies"
|
|
75
85
|
}
|
|
76
86
|
]
|
|
77
87
|
},
|
|
78
|
-
"
|
|
88
|
+
"test:ci": {
|
|
79
89
|
"dependsOn": [
|
|
80
90
|
{
|
|
81
|
-
"target": "build
|
|
91
|
+
"target": "build",
|
|
82
92
|
"projects": "dependencies"
|
|
83
93
|
}
|
|
84
94
|
]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Card, useTheme } from '../../src/index';
|
|
4
|
+
|
|
5
|
+
const CardPlayground = () => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return (
|
|
8
|
+
<View
|
|
9
|
+
style={{
|
|
10
|
+
flex: 1,
|
|
11
|
+
marginVertical: theme.space.xxxxlarge,
|
|
12
|
+
marginHorizontal: theme.space.xxxxlarge,
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<Card
|
|
16
|
+
style={{
|
|
17
|
+
flex: 1,
|
|
18
|
+
backgroundColor: theme.colors.backgroundDark,
|
|
19
|
+
padding: theme.space.medium,
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<Card
|
|
23
|
+
style={{ flex: 1, backgroundColor: theme.colors.backgroundLight }}
|
|
24
|
+
/>
|
|
25
|
+
<Card
|
|
26
|
+
style={{ flex: 1, backgroundColor: theme.colors.infoBackground }}
|
|
27
|
+
/>
|
|
28
|
+
<Card style={{ flex: 1, backgroundColor: theme.colors.primaryLight }} />
|
|
29
|
+
</Card>
|
|
30
|
+
|
|
31
|
+
<Card
|
|
32
|
+
style={{
|
|
33
|
+
flex: 1,
|
|
34
|
+
backgroundColor: theme.colors.backgroundDark,
|
|
35
|
+
padding: theme.space.medium,
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
marginTop: theme.space.large,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<Card
|
|
41
|
+
style={{ flex: 1, backgroundColor: theme.colors.backgroundLight }}
|
|
42
|
+
/>
|
|
43
|
+
<Card
|
|
44
|
+
style={{ flex: 1, backgroundColor: theme.colors.infoBackground }}
|
|
45
|
+
/>
|
|
46
|
+
<Card style={{ flex: 1, backgroundColor: theme.colors.primaryLight }} />
|
|
47
|
+
</Card>
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default CardPlayground;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Divider } from '../../src/index';
|
|
4
|
+
|
|
5
|
+
const DividerPlayground = () => (
|
|
6
|
+
<View>
|
|
7
|
+
<Divider marginHorizontal="xlarge" marginVertical="medium" />
|
|
8
|
+
<Divider marginHorizontal="large" marginVertical="large" />
|
|
9
|
+
<Divider marginHorizontal="medium" marginVertical="xlarge" />
|
|
10
|
+
</View>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default DividerPlayground;
|
package/playground/index.tsx
CHANGED
|
@@ -3,14 +3,16 @@ import { NavigationContainer, DefaultTheme } from '@react-navigation/native'; //
|
|
|
3
3
|
import { createNativeStackNavigator } from '@react-navigation/native-stack'; // eslint-disable-line import/no-extraneous-dependencies
|
|
4
4
|
import { SafeAreaView, FlatList, Text, ListRenderItemInfo } from 'react-native';
|
|
5
5
|
import { ThemeProvider, theme, useTheme } from '../src/index';
|
|
6
|
-
import
|
|
6
|
+
import DividerPlayground from './components/Divider';
|
|
7
|
+
import CardPlayground from './components/Card';
|
|
7
8
|
|
|
8
9
|
type ComponentEntry = { name: string; component: React.FC };
|
|
9
10
|
|
|
10
11
|
const Stack = createNativeStackNavigator();
|
|
11
12
|
|
|
12
13
|
const components: ComponentEntry[] = [
|
|
13
|
-
{ name: '
|
|
14
|
+
{ name: 'Divider', component: DividerPlayground },
|
|
15
|
+
{ name: 'Card', component: CardPlayground },
|
|
14
16
|
];
|
|
15
17
|
|
|
16
18
|
const ComponentItem = ({
|