@hero-design/rn 6.7.2 → 6.7.4-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 +10 -2
- package/.expo/README.md +15 -0
- package/.expo/packager-info.json +10 -0
- package/.expo/settings.json +10 -0
- package/es/index.js +63 -80
- package/lib/index.js +63 -79
- package/package.json +7 -3
- package/playground/components/ExampleComponent.tsx +8 -0
- package/playground/index.tsx +77 -17
- package/src/components/ExampleComponent/StyledView.tsx +16 -22
- package/src/components/ExampleComponent/__tests__/StyledView.spec.tsx +6 -3
- package/src/components/ExampleComponent/__tests__/__snapshots__/StyledView.spec.tsx.snap +4 -4
- package/src/components/ExampleComponent/index.tsx +5 -5
- package/src/index.ts +3 -3
- package/src/styled-components.ts +14 -0
- package/src/styled.d.ts +3 -4
- package/src/theme/components/exampleComponent.ts +19 -0
- package/src/theme/{colors.ts → global/colors.ts} +1 -1
- package/src/theme/global/index.ts +19 -0
- package/src/theme/{space.ts → global/space.ts} +0 -0
- package/src/theme/{typography.ts → global/typography.ts} +5 -5
- package/src/theme/index.ts +15 -19
- package/tsconfig.json +2 -1
- package/types/components/ExampleComponent/StyledView.d.ts +4 -9
- package/types/components/ExampleComponent/index.d.ts +3 -3
- package/types/index.d.ts +3 -3
- package/types/styled-components.d.ts +6 -0
- package/types/theme/components/exampleComponent.d.ts +14 -0
- package/types/theme/{colors.d.ts → global/colors.d.ts} +0 -0
- package/types/theme/global/index.d.ts +58 -0
- package/types/theme/{space.d.ts → global/space.d.ts} +0 -0
- package/types/theme/{typography.d.ts → global/typography.d.ts} +0 -0
- package/types/theme/index.d.ts +8 -145
- package/src/theme/components/demoStyle.ts +0 -16
- package/types/theme/components/demoStyle.d.ts +0 -11
package/.eslintrc.json
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
"es2021": true,
|
|
5
5
|
"jest": true
|
|
6
6
|
},
|
|
7
|
-
"extends": [
|
|
7
|
+
"extends": [
|
|
8
|
+
"plugin:prettier/recommended",
|
|
9
|
+
"plugin:react/recommended",
|
|
10
|
+
"airbnb",
|
|
11
|
+
"prettier"
|
|
12
|
+
],
|
|
8
13
|
"parser": "@typescript-eslint/parser",
|
|
9
14
|
"parserOptions": {
|
|
10
15
|
"ecmaFeatures": {
|
|
@@ -22,6 +27,8 @@
|
|
|
22
27
|
}
|
|
23
28
|
},
|
|
24
29
|
"rules": {
|
|
30
|
+
"react/jsx-props-no-spreading": 0,
|
|
31
|
+
"react/require-default-props": 0,
|
|
25
32
|
"react/function-component-definition": 0,
|
|
26
33
|
"react/jsx-filename-extension": [
|
|
27
34
|
1,
|
|
@@ -35,7 +42,8 @@
|
|
|
35
42
|
"files": ["*.ts", "*.tsx"],
|
|
36
43
|
"rules": {
|
|
37
44
|
"consistent-return": 0,
|
|
38
|
-
"default-case": 0
|
|
45
|
+
"default-case": 0,
|
|
46
|
+
"no-underscore-dangle": [2, { "allow": ["__hd__"] }]
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
]
|
package/.expo/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
> Why do I have a folder named ".expo" in my project?
|
|
2
|
+
|
|
3
|
+
The ".expo" folder is created when an Expo project is started using "expo start" command.
|
|
4
|
+
|
|
5
|
+
> What do the files contain?
|
|
6
|
+
|
|
7
|
+
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
|
|
8
|
+
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
|
|
9
|
+
- "settings.json": contains the server configuration that is used to serve the application manifest.
|
|
10
|
+
|
|
11
|
+
> Should I commit the ".expo" folder?
|
|
12
|
+
|
|
13
|
+
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
|
|
14
|
+
|
|
15
|
+
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
|
package/es/index.js
CHANGED
|
@@ -9182,7 +9182,7 @@ var addTag = function addTag(arg) {
|
|
|
9182
9182
|
return arg;
|
|
9183
9183
|
};
|
|
9184
9184
|
|
|
9185
|
-
function css(styles) {
|
|
9185
|
+
function css$1(styles) {
|
|
9186
9186
|
var interpolations = [];
|
|
9187
9187
|
|
|
9188
9188
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -9225,7 +9225,7 @@ function constructWithOptions(componentConstructor, tag, options) {
|
|
|
9225
9225
|
interpolations[_i - 1] = arguments[_i];
|
|
9226
9226
|
}
|
|
9227
9227
|
|
|
9228
|
-
return componentConstructor(tag, options, css.apply(void 0, __spreadArray([initialStyles], __read(interpolations), false)));
|
|
9228
|
+
return componentConstructor(tag, options, css$1.apply(void 0, __spreadArray([initialStyles], __read(interpolations), false)));
|
|
9229
9229
|
};
|
|
9230
9230
|
/* Modify/inject new props at runtime */
|
|
9231
9231
|
|
|
@@ -9272,7 +9272,7 @@ function mergeTheme(theme, outerTheme) {
|
|
|
9272
9272
|
*/
|
|
9273
9273
|
|
|
9274
9274
|
|
|
9275
|
-
function ThemeProvider(props) {
|
|
9275
|
+
function ThemeProvider$1(props) {
|
|
9276
9276
|
var outerTheme = useContext(ThemeContext);
|
|
9277
9277
|
var themeContext = useMemo(function () {
|
|
9278
9278
|
return mergeTheme(props.theme, outerTheme);
|
|
@@ -9405,7 +9405,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
|
|
|
9405
9405
|
return targetComponent;
|
|
9406
9406
|
}
|
|
9407
9407
|
|
|
9408
|
-
var useTheme = function useTheme() {
|
|
9408
|
+
var useTheme$1 = function useTheme() {
|
|
9409
9409
|
return useContext(ThemeContext);
|
|
9410
9410
|
};
|
|
9411
9411
|
|
|
@@ -9724,21 +9724,26 @@ var baseStyled = function baseStyled(tag) {
|
|
|
9724
9724
|
|
|
9725
9725
|
|
|
9726
9726
|
var aliases = ['ActivityIndicator', 'ActivityIndicatorIOS', 'ART', 'Button', 'DatePickerIOS', 'DrawerLayoutAndroid', 'FlatList', 'Image', 'ImageBackground', 'ImageEditor', 'ImageStore', 'KeyboardAvoidingView', 'ListView', 'MapView', 'Modal', 'NavigatorIOS', 'Picker', 'PickerIOS', 'Pressable', 'ProgressBarAndroid', 'ProgressViewIOS', 'RecyclerViewBackedScrollView', 'RefreshControl', 'SafeAreaView', 'ScrollView', 'SectionList', 'SegmentedControlIOS', 'Slider', 'SliderIOS', 'SnapshotViewIOS', 'StatusBar', 'SwipeableListView', 'Switch', 'SwitchAndroid', 'SwitchIOS', 'TabBarIOS', 'Text', 'TextInput', 'ToastAndroid', 'ToolbarAndroid', 'Touchable', 'TouchableHighlight', 'TouchableNativeFeedback', 'TouchableOpacity', 'TouchableWithoutFeedback', 'View', 'ViewPagerAndroid', 'VirtualizedList', 'WebView'];
|
|
9727
|
-
var styled = baseStyled;
|
|
9727
|
+
var styled$1 = baseStyled;
|
|
9728
9728
|
/* Define a getter for each alias which simply gets the reactNative component
|
|
9729
9729
|
* and passes it to styled */
|
|
9730
9730
|
|
|
9731
9731
|
aliases.forEach(function (alias) {
|
|
9732
|
-
return Object.defineProperty(styled, alias, {
|
|
9732
|
+
return Object.defineProperty(styled$1, alias, {
|
|
9733
9733
|
enumerable: true,
|
|
9734
9734
|
configurable: false,
|
|
9735
9735
|
get: function get() {
|
|
9736
9736
|
// @ts-expect-error supporting old imports in some cases
|
|
9737
|
-
return styled(reactNative[alias]);
|
|
9737
|
+
return styled$1(reactNative[alias]);
|
|
9738
9738
|
}
|
|
9739
9739
|
});
|
|
9740
9740
|
});
|
|
9741
9741
|
|
|
9742
|
+
var styled = styled$1,
|
|
9743
|
+
useTheme = useTheme$1,
|
|
9744
|
+
css = css$1,
|
|
9745
|
+
ThemeProvider = ThemeProvider$1;
|
|
9746
|
+
|
|
9742
9747
|
var palette = {
|
|
9743
9748
|
black: '#000000',
|
|
9744
9749
|
blue: '#1dbeee',
|
|
@@ -9821,41 +9826,6 @@ var palette = {
|
|
|
9821
9826
|
yellowLight60: '#fdf1a1',
|
|
9822
9827
|
yellowLight90: '#fffbe8'
|
|
9823
9828
|
};
|
|
9824
|
-
({
|
|
9825
|
-
primary: palette.violet,
|
|
9826
|
-
primaryDark: palette.violetDark30,
|
|
9827
|
-
primaryLight: palette.violetLight30,
|
|
9828
|
-
primaryBackground: palette.violetLight90,
|
|
9829
|
-
platformBackground: palette.greyLight85,
|
|
9830
|
-
backgroundDark: palette.black,
|
|
9831
|
-
backgroundLight: palette.white,
|
|
9832
|
-
info: palette.dodgerBlue,
|
|
9833
|
-
infoDark: palette.dodgerBlueDark30,
|
|
9834
|
-
infoLight: palette.dodgerBlueLight30,
|
|
9835
|
-
infoBackground: palette.dodgerBlueLight90,
|
|
9836
|
-
success: palette.green,
|
|
9837
|
-
successDark: palette.greenDark30,
|
|
9838
|
-
successLight: palette.greenLight30,
|
|
9839
|
-
successBackground: palette.greenLight90,
|
|
9840
|
-
danger: palette.red,
|
|
9841
|
-
dangerDark: palette.redDark30,
|
|
9842
|
-
dangerLight: palette.redLight30,
|
|
9843
|
-
dangerBackground: palette.redLight90,
|
|
9844
|
-
warning: palette.orange,
|
|
9845
|
-
warningDark: palette.orangeDark30,
|
|
9846
|
-
warningLight: palette.orangeLight30,
|
|
9847
|
-
warningBackground: palette.orangeLight90,
|
|
9848
|
-
error: palette.pink,
|
|
9849
|
-
errorDark: palette.pinkDark30,
|
|
9850
|
-
errorLight: palette.pinkLight30,
|
|
9851
|
-
errorBackground: palette.pinkLight90,
|
|
9852
|
-
headingText: palette.black,
|
|
9853
|
-
text: palette.greyDark45,
|
|
9854
|
-
subduedText: palette.greyDark30,
|
|
9855
|
-
disabledText: palette.grey,
|
|
9856
|
-
outline: palette.greyLight60,
|
|
9857
|
-
disabledBackground: palette.greyLight60
|
|
9858
|
-
});
|
|
9859
9829
|
|
|
9860
9830
|
var systemPalette = {
|
|
9861
9831
|
primary: palette.violet,
|
|
@@ -9916,34 +9886,47 @@ var lineHeights = {
|
|
|
9916
9886
|
xsmall: fontSizes.xsmall + 8
|
|
9917
9887
|
};
|
|
9918
9888
|
|
|
9919
|
-
var
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
warningBg: systemPalette.warningBackground
|
|
9923
|
-
};
|
|
9924
|
-
var demoStyleSpace = {
|
|
9925
|
-
smallMargin: space.xxsmall,
|
|
9926
|
-
mediumMargin: space.medium,
|
|
9927
|
-
largeMargin: space.xxxxlarge
|
|
9928
|
-
};
|
|
9929
|
-
|
|
9930
|
-
var theme = {
|
|
9931
|
-
colors: _objectSpread2(_objectSpread2(_objectSpread2({}, palette), systemPalette), {}, {
|
|
9932
|
-
demoStyle: demoStyleColors
|
|
9933
|
-
}),
|
|
9934
|
-
space: _objectSpread2(_objectSpread2({}, space), {}, {
|
|
9935
|
-
demoStyle: demoStyleSpace
|
|
9936
|
-
}),
|
|
9889
|
+
var globalTheme = {
|
|
9890
|
+
colors: _objectSpread2({}, systemPalette),
|
|
9891
|
+
space: space,
|
|
9937
9892
|
fontSizes: fontSizes,
|
|
9938
9893
|
fontWeights: fontWeights,
|
|
9939
9894
|
lineHeights: lineHeights
|
|
9940
9895
|
};
|
|
9941
9896
|
|
|
9897
|
+
var getExampleComponentTheme = function getExampleComponentTheme(theme) {
|
|
9898
|
+
var colors = {
|
|
9899
|
+
primaryBg: theme.colors.primaryLight,
|
|
9900
|
+
dangerBg: theme.colors.dangerBackground,
|
|
9901
|
+
warningBg: theme.colors.warningBackground
|
|
9902
|
+
};
|
|
9903
|
+
var space = {
|
|
9904
|
+
smallMargin: theme.space.xxsmall,
|
|
9905
|
+
mediumMargin: theme.space.medium,
|
|
9906
|
+
largeMargin: theme.space.xxxxlarge
|
|
9907
|
+
};
|
|
9908
|
+
return {
|
|
9909
|
+
colors: colors,
|
|
9910
|
+
space: space
|
|
9911
|
+
};
|
|
9912
|
+
};
|
|
9913
|
+
|
|
9914
|
+
var getTheme = function getTheme() {
|
|
9915
|
+
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
9916
|
+
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
9917
|
+
__hd__: {
|
|
9918
|
+
exampleComponent: getExampleComponentTheme(theme)
|
|
9919
|
+
}
|
|
9920
|
+
});
|
|
9921
|
+
};
|
|
9922
|
+
|
|
9923
|
+
var theme = getTheme();
|
|
9924
|
+
|
|
9942
9925
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
9943
9926
|
var Square = styled(View)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
9944
|
-
var
|
|
9927
|
+
var themeSize = _ref.themeSize;
|
|
9945
9928
|
|
|
9946
|
-
switch (
|
|
9929
|
+
switch (themeSize) {
|
|
9947
9930
|
case 'small':
|
|
9948
9931
|
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 50px;\n width: 200px;\n "])));
|
|
9949
9932
|
|
|
@@ -9954,45 +9937,45 @@ var Square = styled(View)(_templateObject || (_templateObject = _taggedTemplateL
|
|
|
9954
9937
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 150px;\n width: 300px;\n "])));
|
|
9955
9938
|
}
|
|
9956
9939
|
}, function (_ref2) {
|
|
9957
|
-
var
|
|
9940
|
+
var themeMargin = _ref2.themeMargin,
|
|
9958
9941
|
theme = _ref2.theme;
|
|
9959
9942
|
|
|
9960
|
-
switch (
|
|
9943
|
+
switch (themeMargin) {
|
|
9961
9944
|
case 'small':
|
|
9962
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9945
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.smallMargin);
|
|
9963
9946
|
|
|
9964
9947
|
case 'medium':
|
|
9965
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9948
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.mediumMargin);
|
|
9966
9949
|
|
|
9967
9950
|
case 'large':
|
|
9968
|
-
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9951
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.largeMargin);
|
|
9969
9952
|
}
|
|
9970
9953
|
}, function (_ref3) {
|
|
9971
|
-
var
|
|
9954
|
+
var themeBgColor = _ref3.themeBgColor,
|
|
9972
9955
|
theme = _ref3.theme;
|
|
9973
9956
|
|
|
9974
|
-
switch (
|
|
9957
|
+
switch (themeBgColor) {
|
|
9975
9958
|
case 'primary':
|
|
9976
|
-
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9959
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.primaryBg);
|
|
9977
9960
|
|
|
9978
9961
|
case 'danger':
|
|
9979
|
-
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9962
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.dangerBg);
|
|
9980
9963
|
|
|
9981
9964
|
case 'warning':
|
|
9982
|
-
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9965
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.warningBg);
|
|
9983
9966
|
}
|
|
9984
9967
|
});
|
|
9985
9968
|
|
|
9986
9969
|
var ExampleComponent = function ExampleComponent(_ref) {
|
|
9987
|
-
var _ref$
|
|
9988
|
-
|
|
9989
|
-
|
|
9970
|
+
var _ref$size = _ref.size,
|
|
9971
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
9972
|
+
margin = _ref.margin,
|
|
9990
9973
|
bgColor = _ref.bgColor;
|
|
9991
9974
|
return /*#__PURE__*/React.createElement(Square, {
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
}, /*#__PURE__*/React.createElement(Text, null, "Square with ".concat(
|
|
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.")));
|
|
9996
9979
|
};
|
|
9997
9980
|
|
|
9998
|
-
export { ExampleComponent, ThemeProvider, theme, useTheme };
|
|
9981
|
+
export { ExampleComponent, ThemeProvider, getTheme, theme, useTheme };
|
package/lib/index.js
CHANGED
|
@@ -9190,7 +9190,7 @@ var addTag = function addTag(arg) {
|
|
|
9190
9190
|
return arg;
|
|
9191
9191
|
};
|
|
9192
9192
|
|
|
9193
|
-
function css(styles) {
|
|
9193
|
+
function css$1(styles) {
|
|
9194
9194
|
var interpolations = [];
|
|
9195
9195
|
|
|
9196
9196
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -9233,7 +9233,7 @@ function constructWithOptions(componentConstructor, tag, options) {
|
|
|
9233
9233
|
interpolations[_i - 1] = arguments[_i];
|
|
9234
9234
|
}
|
|
9235
9235
|
|
|
9236
|
-
return componentConstructor(tag, options, css.apply(void 0, __spreadArray([initialStyles], __read(interpolations), false)));
|
|
9236
|
+
return componentConstructor(tag, options, css$1.apply(void 0, __spreadArray([initialStyles], __read(interpolations), false)));
|
|
9237
9237
|
};
|
|
9238
9238
|
/* Modify/inject new props at runtime */
|
|
9239
9239
|
|
|
@@ -9280,7 +9280,7 @@ function mergeTheme(theme, outerTheme) {
|
|
|
9280
9280
|
*/
|
|
9281
9281
|
|
|
9282
9282
|
|
|
9283
|
-
function ThemeProvider(props) {
|
|
9283
|
+
function ThemeProvider$1(props) {
|
|
9284
9284
|
var outerTheme = React.useContext(ThemeContext);
|
|
9285
9285
|
var themeContext = React.useMemo(function () {
|
|
9286
9286
|
return mergeTheme(props.theme, outerTheme);
|
|
@@ -9413,7 +9413,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
|
|
|
9413
9413
|
return targetComponent;
|
|
9414
9414
|
}
|
|
9415
9415
|
|
|
9416
|
-
var useTheme = function useTheme() {
|
|
9416
|
+
var useTheme$1 = function useTheme() {
|
|
9417
9417
|
return React.useContext(ThemeContext);
|
|
9418
9418
|
};
|
|
9419
9419
|
|
|
@@ -9732,21 +9732,26 @@ var baseStyled = function baseStyled(tag) {
|
|
|
9732
9732
|
|
|
9733
9733
|
|
|
9734
9734
|
var aliases = ['ActivityIndicator', 'ActivityIndicatorIOS', 'ART', 'Button', 'DatePickerIOS', 'DrawerLayoutAndroid', 'FlatList', 'Image', 'ImageBackground', 'ImageEditor', 'ImageStore', 'KeyboardAvoidingView', 'ListView', 'MapView', 'Modal', 'NavigatorIOS', 'Picker', 'PickerIOS', 'Pressable', 'ProgressBarAndroid', 'ProgressViewIOS', 'RecyclerViewBackedScrollView', 'RefreshControl', 'SafeAreaView', 'ScrollView', 'SectionList', 'SegmentedControlIOS', 'Slider', 'SliderIOS', 'SnapshotViewIOS', 'StatusBar', 'SwipeableListView', 'Switch', 'SwitchAndroid', 'SwitchIOS', 'TabBarIOS', 'Text', 'TextInput', 'ToastAndroid', 'ToolbarAndroid', 'Touchable', 'TouchableHighlight', 'TouchableNativeFeedback', 'TouchableOpacity', 'TouchableWithoutFeedback', 'View', 'ViewPagerAndroid', 'VirtualizedList', 'WebView'];
|
|
9735
|
-
var styled = baseStyled;
|
|
9735
|
+
var styled$1 = baseStyled;
|
|
9736
9736
|
/* Define a getter for each alias which simply gets the reactNative component
|
|
9737
9737
|
* and passes it to styled */
|
|
9738
9738
|
|
|
9739
9739
|
aliases.forEach(function (alias) {
|
|
9740
|
-
return Object.defineProperty(styled, alias, {
|
|
9740
|
+
return Object.defineProperty(styled$1, alias, {
|
|
9741
9741
|
enumerable: true,
|
|
9742
9742
|
configurable: false,
|
|
9743
9743
|
get: function get() {
|
|
9744
9744
|
// @ts-expect-error supporting old imports in some cases
|
|
9745
|
-
return styled(reactNative[alias]);
|
|
9745
|
+
return styled$1(reactNative[alias]);
|
|
9746
9746
|
}
|
|
9747
9747
|
});
|
|
9748
9748
|
});
|
|
9749
9749
|
|
|
9750
|
+
var styled = styled$1,
|
|
9751
|
+
useTheme = useTheme$1,
|
|
9752
|
+
css = css$1,
|
|
9753
|
+
ThemeProvider = ThemeProvider$1;
|
|
9754
|
+
|
|
9750
9755
|
var palette = {
|
|
9751
9756
|
black: '#000000',
|
|
9752
9757
|
blue: '#1dbeee',
|
|
@@ -9829,41 +9834,6 @@ var palette = {
|
|
|
9829
9834
|
yellowLight60: '#fdf1a1',
|
|
9830
9835
|
yellowLight90: '#fffbe8'
|
|
9831
9836
|
};
|
|
9832
|
-
({
|
|
9833
|
-
primary: palette.violet,
|
|
9834
|
-
primaryDark: palette.violetDark30,
|
|
9835
|
-
primaryLight: palette.violetLight30,
|
|
9836
|
-
primaryBackground: palette.violetLight90,
|
|
9837
|
-
platformBackground: palette.greyLight85,
|
|
9838
|
-
backgroundDark: palette.black,
|
|
9839
|
-
backgroundLight: palette.white,
|
|
9840
|
-
info: palette.dodgerBlue,
|
|
9841
|
-
infoDark: palette.dodgerBlueDark30,
|
|
9842
|
-
infoLight: palette.dodgerBlueLight30,
|
|
9843
|
-
infoBackground: palette.dodgerBlueLight90,
|
|
9844
|
-
success: palette.green,
|
|
9845
|
-
successDark: palette.greenDark30,
|
|
9846
|
-
successLight: palette.greenLight30,
|
|
9847
|
-
successBackground: palette.greenLight90,
|
|
9848
|
-
danger: palette.red,
|
|
9849
|
-
dangerDark: palette.redDark30,
|
|
9850
|
-
dangerLight: palette.redLight30,
|
|
9851
|
-
dangerBackground: palette.redLight90,
|
|
9852
|
-
warning: palette.orange,
|
|
9853
|
-
warningDark: palette.orangeDark30,
|
|
9854
|
-
warningLight: palette.orangeLight30,
|
|
9855
|
-
warningBackground: palette.orangeLight90,
|
|
9856
|
-
error: palette.pink,
|
|
9857
|
-
errorDark: palette.pinkDark30,
|
|
9858
|
-
errorLight: palette.pinkLight30,
|
|
9859
|
-
errorBackground: palette.pinkLight90,
|
|
9860
|
-
headingText: palette.black,
|
|
9861
|
-
text: palette.greyDark45,
|
|
9862
|
-
subduedText: palette.greyDark30,
|
|
9863
|
-
disabledText: palette.grey,
|
|
9864
|
-
outline: palette.greyLight60,
|
|
9865
|
-
disabledBackground: palette.greyLight60
|
|
9866
|
-
});
|
|
9867
9837
|
|
|
9868
9838
|
var systemPalette = {
|
|
9869
9839
|
primary: palette.violet,
|
|
@@ -9924,34 +9894,47 @@ var lineHeights = {
|
|
|
9924
9894
|
xsmall: fontSizes.xsmall + 8
|
|
9925
9895
|
};
|
|
9926
9896
|
|
|
9927
|
-
var
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
warningBg: systemPalette.warningBackground
|
|
9931
|
-
};
|
|
9932
|
-
var demoStyleSpace = {
|
|
9933
|
-
smallMargin: space.xxsmall,
|
|
9934
|
-
mediumMargin: space.medium,
|
|
9935
|
-
largeMargin: space.xxxxlarge
|
|
9936
|
-
};
|
|
9937
|
-
|
|
9938
|
-
var theme = {
|
|
9939
|
-
colors: _objectSpread2(_objectSpread2(_objectSpread2({}, palette), systemPalette), {}, {
|
|
9940
|
-
demoStyle: demoStyleColors
|
|
9941
|
-
}),
|
|
9942
|
-
space: _objectSpread2(_objectSpread2({}, space), {}, {
|
|
9943
|
-
demoStyle: demoStyleSpace
|
|
9944
|
-
}),
|
|
9897
|
+
var globalTheme = {
|
|
9898
|
+
colors: _objectSpread2({}, systemPalette),
|
|
9899
|
+
space: space,
|
|
9945
9900
|
fontSizes: fontSizes,
|
|
9946
9901
|
fontWeights: fontWeights,
|
|
9947
9902
|
lineHeights: lineHeights
|
|
9948
9903
|
};
|
|
9949
9904
|
|
|
9905
|
+
var getExampleComponentTheme = function getExampleComponentTheme(theme) {
|
|
9906
|
+
var colors = {
|
|
9907
|
+
primaryBg: theme.colors.primaryLight,
|
|
9908
|
+
dangerBg: theme.colors.dangerBackground,
|
|
9909
|
+
warningBg: theme.colors.warningBackground
|
|
9910
|
+
};
|
|
9911
|
+
var space = {
|
|
9912
|
+
smallMargin: theme.space.xxsmall,
|
|
9913
|
+
mediumMargin: theme.space.medium,
|
|
9914
|
+
largeMargin: theme.space.xxxxlarge
|
|
9915
|
+
};
|
|
9916
|
+
return {
|
|
9917
|
+
colors: colors,
|
|
9918
|
+
space: space
|
|
9919
|
+
};
|
|
9920
|
+
};
|
|
9921
|
+
|
|
9922
|
+
var getTheme = function getTheme() {
|
|
9923
|
+
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalTheme;
|
|
9924
|
+
return _objectSpread2(_objectSpread2({}, theme), {}, {
|
|
9925
|
+
__hd__: {
|
|
9926
|
+
exampleComponent: getExampleComponentTheme(theme)
|
|
9927
|
+
}
|
|
9928
|
+
});
|
|
9929
|
+
};
|
|
9930
|
+
|
|
9931
|
+
var theme = getTheme();
|
|
9932
|
+
|
|
9950
9933
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
9951
9934
|
var Square = styled(reactNative$1.View)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
9952
|
-
var
|
|
9935
|
+
var themeSize = _ref.themeSize;
|
|
9953
9936
|
|
|
9954
|
-
switch (
|
|
9937
|
+
switch (themeSize) {
|
|
9955
9938
|
case 'small':
|
|
9956
9939
|
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 50px;\n width: 200px;\n "])));
|
|
9957
9940
|
|
|
@@ -9962,48 +9945,49 @@ var Square = styled(reactNative$1.View)(_templateObject || (_templateObject = _t
|
|
|
9962
9945
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 150px;\n width: 300px;\n "])));
|
|
9963
9946
|
}
|
|
9964
9947
|
}, function (_ref2) {
|
|
9965
|
-
var
|
|
9948
|
+
var themeMargin = _ref2.themeMargin,
|
|
9966
9949
|
theme = _ref2.theme;
|
|
9967
9950
|
|
|
9968
|
-
switch (
|
|
9951
|
+
switch (themeMargin) {
|
|
9969
9952
|
case 'small':
|
|
9970
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9953
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.smallMargin);
|
|
9971
9954
|
|
|
9972
9955
|
case 'medium':
|
|
9973
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9956
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.mediumMargin);
|
|
9974
9957
|
|
|
9975
9958
|
case 'large':
|
|
9976
|
-
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.space.
|
|
9959
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: ", "px;\n "])), theme.__hd__.exampleComponent.space.largeMargin);
|
|
9977
9960
|
}
|
|
9978
9961
|
}, function (_ref3) {
|
|
9979
|
-
var
|
|
9962
|
+
var themeBgColor = _ref3.themeBgColor,
|
|
9980
9963
|
theme = _ref3.theme;
|
|
9981
9964
|
|
|
9982
|
-
switch (
|
|
9965
|
+
switch (themeBgColor) {
|
|
9983
9966
|
case 'primary':
|
|
9984
|
-
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9967
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.primaryBg);
|
|
9985
9968
|
|
|
9986
9969
|
case 'danger':
|
|
9987
|
-
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9970
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.dangerBg);
|
|
9988
9971
|
|
|
9989
9972
|
case 'warning':
|
|
9990
|
-
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.colors.
|
|
9973
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), theme.__hd__.exampleComponent.colors.warningBg);
|
|
9991
9974
|
}
|
|
9992
9975
|
});
|
|
9993
9976
|
|
|
9994
9977
|
var ExampleComponent = function ExampleComponent(_ref) {
|
|
9995
|
-
var _ref$
|
|
9996
|
-
|
|
9997
|
-
|
|
9978
|
+
var _ref$size = _ref.size,
|
|
9979
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
9980
|
+
margin = _ref.margin,
|
|
9998
9981
|
bgColor = _ref.bgColor;
|
|
9999
9982
|
return /*#__PURE__*/React__default["default"].createElement(Square, {
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactNative$1.Text, null, "Square with ".concat(
|
|
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.")));
|
|
10004
9987
|
};
|
|
10005
9988
|
|
|
10006
9989
|
exports.ExampleComponent = ExampleComponent;
|
|
10007
9990
|
exports.ThemeProvider = ThemeProvider;
|
|
9991
|
+
exports.getTheme = getTheme;
|
|
10008
9992
|
exports.theme = theme;
|
|
10009
9993
|
exports.useTheme = useTheme;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "6.7.
|
|
3
|
+
"version": "6.7.4-1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --ignore-path ../../.gitignore",
|
|
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
12
|
"test": "jest --runInBand",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"publish:npm": "yarn publish --access public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@hero-design/colors": "6.7.
|
|
19
|
+
"@hero-design/colors": "6.7.4-1",
|
|
20
20
|
"styled-components": "6.0.0-alpha.5"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"@babel/preset-env": "^7.16.11",
|
|
29
29
|
"@babel/preset-react": "^7.16.7",
|
|
30
30
|
"@babel/preset-typescript": "^7.16.7",
|
|
31
|
+
"@react-navigation/native": "^6.0.10",
|
|
32
|
+
"@react-navigation/native-stack": "^6.6.2",
|
|
31
33
|
"@rollup/plugin-babel": "^5.3.1",
|
|
32
34
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
33
35
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -56,6 +58,8 @@
|
|
|
56
58
|
"prettier": "^2.5.1",
|
|
57
59
|
"react": "17.0.2",
|
|
58
60
|
"react-native": "0.65.1",
|
|
61
|
+
"react-native-safe-area-context": "^4.2.5",
|
|
62
|
+
"react-native-screens": "^3.13.1",
|
|
59
63
|
"react-test-renderer": "17.0.2",
|
|
60
64
|
"rollup": "^2.68.0",
|
|
61
65
|
"ts-jest": "^27.0.7",
|