@hero-design/rn 7.26.0 → 7.27.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/.turbo/turbo-build.log +9 -9
- package/es/index.js +77 -30
- package/lib/index.js +77 -30
- package/package.json +4 -4
- package/src/components/Accordion/index.tsx +1 -1
- package/src/components/Card/index.tsx +18 -7
- package/src/components/Select/MultiSelect/index.tsx +5 -2
- package/src/components/Select/SingleSelect/index.tsx +5 -2
- package/src/components/Select/types.ts +15 -6
- package/src/components/Tabs/ScrollableTabs.tsx +2 -0
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +7 -0
- package/src/components/Tag/StyledTag.tsx +42 -11
- package/src/components/Tag/__tests__/Tag.spec.tsx +28 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +135 -0
- package/src/components/Tag/index.tsx +15 -3
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -1
- package/src/theme/components/tag.ts +1 -0
- package/src/theme/components/toolbar.ts +1 -1
- package/src/utils/hooks.ts +18 -1
- package/types/components/Card/index.d.ts +1 -1
- package/types/components/Select/MultiSelect/index.d.ts +1 -1
- package/types/components/Select/SingleSelect/index.d.ts +1 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +15 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +7 -2
- package/types/components/Tag/StyledTag.d.ts +3 -0
- package/types/components/Tag/index.d.ts +7 -2
- package/types/theme/components/tag.d.ts +1 -0
- package/types/utils/hooks.d.ts +2 -0
- package/src/components/Accordion/utils.tsx +0 -11
- package/types/components/Accordion/utils.d.ts +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[35m@hero-design/rn:build[0m: cache hit, replaying output [2m94178e9908210053[0m
|
|
2
|
+
[35m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[35m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[35m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[35m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[35m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
|
+
[35m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[35m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m23.5s[22m[39m
|
|
9
|
+
[35m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -2466,7 +2466,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2466
2466
|
danger: theme.colors.onErrorSurface,
|
|
2467
2467
|
dangerBackground: theme.colors.errorSurface,
|
|
2468
2468
|
archived: theme.colors.onArchivedSurface,
|
|
2469
|
-
archivedBackground: theme.colors.archivedSurface
|
|
2469
|
+
archivedBackground: theme.colors.archivedSurface,
|
|
2470
|
+
text: theme.colors.onDefaultGlobalSurface
|
|
2470
2471
|
};
|
|
2471
2472
|
var fonts = {
|
|
2472
2473
|
"default": theme.fonts.neutral.semiBold
|
|
@@ -2629,7 +2630,7 @@ var getToastTheme = function getToastTheme(theme) {
|
|
|
2629
2630
|
var getToolbarTheme = function getToolbarTheme(theme) {
|
|
2630
2631
|
var colors = {
|
|
2631
2632
|
background: theme.colors.defaultGlobalSurface,
|
|
2632
|
-
border: theme.colors.
|
|
2633
|
+
border: theme.colors.secondaryOutline,
|
|
2633
2634
|
primary: theme.colors.primary,
|
|
2634
2635
|
secondary: theme.colors.secondary,
|
|
2635
2636
|
info: theme.colors.info,
|
|
@@ -5630,6 +5631,20 @@ var usePrevious = function usePrevious(value) {
|
|
|
5630
5631
|
}, [value]);
|
|
5631
5632
|
return ref.current;
|
|
5632
5633
|
};
|
|
5634
|
+
function usePropsOrInternalState(initialState, state, setState) {
|
|
5635
|
+
var _React$useState = React.useState(initialState),
|
|
5636
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5637
|
+
internalState = _React$useState2[0],
|
|
5638
|
+
setInternalState = _React$useState2[1];
|
|
5639
|
+
return [state || internalState, setState || setInternalState];
|
|
5640
|
+
}
|
|
5641
|
+
var useDeprecation = function useDeprecation(message) {
|
|
5642
|
+
var cond = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
5643
|
+
useEffect(function () {
|
|
5644
|
+
// eslint-disable-next-line no-console
|
|
5645
|
+
console.warn(message);
|
|
5646
|
+
}, [message, cond]);
|
|
5647
|
+
};
|
|
5633
5648
|
|
|
5634
5649
|
var Collapse = function Collapse(_ref) {
|
|
5635
5650
|
var _ref$open = _ref.open,
|
|
@@ -6301,14 +6316,6 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
|
6301
6316
|
}, content));
|
|
6302
6317
|
};
|
|
6303
6318
|
|
|
6304
|
-
function usePropsOrInternalState(initialState, state, setState) {
|
|
6305
|
-
var _React$useState = React.useState(initialState),
|
|
6306
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6307
|
-
internalState = _React$useState2[0],
|
|
6308
|
-
setInternalState = _React$useState2[1];
|
|
6309
|
-
return [state || internalState, setState || setInternalState];
|
|
6310
|
-
}
|
|
6311
|
-
|
|
6312
6319
|
var _excluded$h = ["key"];
|
|
6313
6320
|
var Accordion = function Accordion(_ref) {
|
|
6314
6321
|
var items = _ref.items,
|
|
@@ -10505,11 +10512,12 @@ var LeftDataCard = index$a(View)(function (_ref2) {
|
|
|
10505
10512
|
|
|
10506
10513
|
var _excluded$8 = ["variant", "intent", "children"];
|
|
10507
10514
|
var Card = function Card(_ref) {
|
|
10508
|
-
var
|
|
10509
|
-
variant = _ref$variant === void 0 ? 'basic' : _ref$variant,
|
|
10515
|
+
var _variant = _ref.variant,
|
|
10510
10516
|
intent = _ref.intent,
|
|
10511
10517
|
children = _ref.children,
|
|
10512
10518
|
nativeProps = _objectWithoutProperties(_ref, _excluded$8);
|
|
10519
|
+
var variant = _variant === undefined ? 'basic' : _variant;
|
|
10520
|
+
useDeprecation("Card's variant prop is deprecated and will be removed in the next major release.\nPlease remove it or use Card.Data instead.", _variant !== undefined);
|
|
10513
10521
|
return /*#__PURE__*/React.createElement(StyledCard, _extends$1({}, nativeProps, {
|
|
10514
10522
|
themeVariant: variant,
|
|
10515
10523
|
themeIntent: intent
|
|
@@ -13008,6 +13016,7 @@ function MultiSelect(_ref) {
|
|
|
13008
13016
|
inputProps = _ref.inputProps,
|
|
13009
13017
|
onConfirm = _ref.onConfirm,
|
|
13010
13018
|
onDimiss = _ref.onDimiss,
|
|
13019
|
+
onDismiss = _ref.onDismiss,
|
|
13011
13020
|
onEndReached = _ref.onEndReached,
|
|
13012
13021
|
onQueryChange = _ref.onQueryChange,
|
|
13013
13022
|
options = _ref.options,
|
|
@@ -13019,6 +13028,7 @@ function MultiSelect(_ref) {
|
|
|
13019
13028
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
13020
13029
|
_ref$disabled = _ref.disabled,
|
|
13021
13030
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
13031
|
+
required = _ref.required,
|
|
13022
13032
|
numberOfLines = _ref.numberOfLines,
|
|
13023
13033
|
style = _ref.style,
|
|
13024
13034
|
testID = _ref.testID,
|
|
@@ -13053,7 +13063,9 @@ function MultiSelect(_ref) {
|
|
|
13053
13063
|
}
|
|
13054
13064
|
}, /*#__PURE__*/React.createElement(View, {
|
|
13055
13065
|
pointerEvents: "none"
|
|
13056
|
-
}, /*#__PURE__*/React.createElement(TextInput, _extends$1({
|
|
13066
|
+
}, /*#__PURE__*/React.createElement(TextInput, _extends$1({
|
|
13067
|
+
numberOfLines: numberOfLines
|
|
13068
|
+
}, inputProps, {
|
|
13057
13069
|
label: label,
|
|
13058
13070
|
value: displayedValue,
|
|
13059
13071
|
suffix: "arrow-down",
|
|
@@ -13061,7 +13073,7 @@ function MultiSelect(_ref) {
|
|
|
13061
13073
|
error: error,
|
|
13062
13074
|
editable: editable,
|
|
13063
13075
|
disabled: disabled,
|
|
13064
|
-
|
|
13076
|
+
required: required,
|
|
13065
13077
|
pointerEvents: "none",
|
|
13066
13078
|
style: style,
|
|
13067
13079
|
testID: testID,
|
|
@@ -13073,7 +13085,7 @@ function MultiSelect(_ref) {
|
|
|
13073
13085
|
onRequestClose: function onRequestClose() {
|
|
13074
13086
|
return setOpen(false);
|
|
13075
13087
|
},
|
|
13076
|
-
onDismiss: onDimiss,
|
|
13088
|
+
onDismiss: onDismiss || onDimiss,
|
|
13077
13089
|
header: label,
|
|
13078
13090
|
style: {
|
|
13079
13091
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
@@ -13186,6 +13198,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13186
13198
|
inputProps = _ref.inputProps,
|
|
13187
13199
|
onConfirm = _ref.onConfirm,
|
|
13188
13200
|
onDimiss = _ref.onDimiss,
|
|
13201
|
+
onDismiss = _ref.onDismiss,
|
|
13189
13202
|
onEndReached = _ref.onEndReached,
|
|
13190
13203
|
onQueryChange = _ref.onQueryChange,
|
|
13191
13204
|
options = _ref.options,
|
|
@@ -13197,6 +13210,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13197
13210
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
13198
13211
|
_ref$disabled = _ref.disabled,
|
|
13199
13212
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
13213
|
+
required = _ref.required,
|
|
13200
13214
|
numberOfLines = _ref.numberOfLines,
|
|
13201
13215
|
style = _ref.style,
|
|
13202
13216
|
testID = _ref.testID,
|
|
@@ -13222,7 +13236,9 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13222
13236
|
}
|
|
13223
13237
|
}, /*#__PURE__*/React.createElement(View, {
|
|
13224
13238
|
pointerEvents: "none"
|
|
13225
|
-
}, /*#__PURE__*/React.createElement(TextInput, _extends$1({
|
|
13239
|
+
}, /*#__PURE__*/React.createElement(TextInput, _extends$1({
|
|
13240
|
+
numberOfLines: numberOfLines
|
|
13241
|
+
}, inputProps, {
|
|
13226
13242
|
label: label,
|
|
13227
13243
|
value: displayedValue,
|
|
13228
13244
|
suffix: "arrow-down",
|
|
@@ -13230,7 +13246,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13230
13246
|
error: error,
|
|
13231
13247
|
editable: editable,
|
|
13232
13248
|
disabled: disabled,
|
|
13233
|
-
|
|
13249
|
+
required: required,
|
|
13234
13250
|
pointerEvents: "none",
|
|
13235
13251
|
style: style,
|
|
13236
13252
|
testID: testID,
|
|
@@ -13242,7 +13258,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13242
13258
|
onRequestClose: function onRequestClose() {
|
|
13243
13259
|
return setOpen(false);
|
|
13244
13260
|
},
|
|
13245
|
-
onDismiss: onDimiss,
|
|
13261
|
+
onDismiss: onDismiss || onDimiss,
|
|
13246
13262
|
header: label,
|
|
13247
13263
|
style: {
|
|
13248
13264
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
@@ -13652,6 +13668,8 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13652
13668
|
lazy = _ref2$lazy === void 0 ? false : _ref2$lazy,
|
|
13653
13669
|
_ref2$lazyPreloadDist = _ref2.lazyPreloadDistance,
|
|
13654
13670
|
lazyPreloadDistance = _ref2$lazyPreloadDist === void 0 ? 1 : _ref2$lazyPreloadDist,
|
|
13671
|
+
_ref2$swipeEnabled = _ref2.swipeEnabled,
|
|
13672
|
+
swipeEnabled = _ref2$swipeEnabled === void 0 ? true : _ref2$swipeEnabled,
|
|
13655
13673
|
componentTestID = _ref2.testID;
|
|
13656
13674
|
var flatListRef = React.useRef(null);
|
|
13657
13675
|
var pagerViewRef = React.useRef(null);
|
|
@@ -13764,7 +13782,8 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13764
13782
|
if (selectedItem) {
|
|
13765
13783
|
onTabPress(selectedItem.key);
|
|
13766
13784
|
}
|
|
13767
|
-
}
|
|
13785
|
+
},
|
|
13786
|
+
scrollEnabled: swipeEnabled
|
|
13768
13787
|
}, tabs.map(function (tab, index) {
|
|
13769
13788
|
var key = tab.key,
|
|
13770
13789
|
component = tab.component,
|
|
@@ -13809,6 +13828,8 @@ var Tabs = function Tabs(_ref2) {
|
|
|
13809
13828
|
lazy = _ref2$lazy === void 0 ? false : _ref2$lazy,
|
|
13810
13829
|
_ref2$lazyPreloadDist = _ref2.lazyPreloadDistance,
|
|
13811
13830
|
lazyPreloadDistance = _ref2$lazyPreloadDist === void 0 ? 1 : _ref2$lazyPreloadDist,
|
|
13831
|
+
_ref2$swipeEnabled = _ref2.swipeEnabled,
|
|
13832
|
+
swipeEnabled = _ref2$swipeEnabled === void 0 ? true : _ref2$swipeEnabled,
|
|
13812
13833
|
componentTestID = _ref2.testID;
|
|
13813
13834
|
var theme = useTheme$1();
|
|
13814
13835
|
var insets = useSafeAreaInsets();
|
|
@@ -13889,7 +13910,8 @@ var Tabs = function Tabs(_ref2) {
|
|
|
13889
13910
|
}
|
|
13890
13911
|
}], {
|
|
13891
13912
|
useNativeDriver: true
|
|
13892
|
-
})
|
|
13913
|
+
}),
|
|
13914
|
+
scrollEnabled: swipeEnabled
|
|
13893
13915
|
}, tabs.map(function (tab, index) {
|
|
13894
13916
|
var key = tab.key,
|
|
13895
13917
|
component = tab.component,
|
|
@@ -13910,34 +13932,57 @@ var index$2 = Object.assign(Tabs, {
|
|
|
13910
13932
|
Scroll: ScrollableTab
|
|
13911
13933
|
});
|
|
13912
13934
|
|
|
13935
|
+
var getFilledStyles = function getFilledStyles(themeIntent, theme) {
|
|
13936
|
+
return {
|
|
13937
|
+
textColor: theme.__hd__.tag.colors.text,
|
|
13938
|
+
borderColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
13939
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
13940
|
+
};
|
|
13941
|
+
};
|
|
13942
|
+
var getOutlinedStyles = function getOutlinedStyles(themeIntent, theme) {
|
|
13943
|
+
return {
|
|
13944
|
+
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
13945
|
+
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
13946
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
13947
|
+
};
|
|
13948
|
+
};
|
|
13913
13949
|
var StyledView = index$a(View)(function (_ref) {
|
|
13914
13950
|
var themeIntent = _ref.themeIntent,
|
|
13951
|
+
themeVariant = _ref.themeVariant,
|
|
13915
13952
|
theme = _ref.theme;
|
|
13953
|
+
var _ref2 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
13954
|
+
borderColor = _ref2.borderColor,
|
|
13955
|
+
backgroundColor = _ref2.backgroundColor;
|
|
13916
13956
|
return {
|
|
13917
13957
|
borderWidth: theme.__hd__.tag.borderWidths["default"],
|
|
13918
13958
|
borderRadius: theme.__hd__.tag.radii["default"],
|
|
13919
13959
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
13920
13960
|
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding,
|
|
13921
|
-
borderColor:
|
|
13922
|
-
backgroundColor:
|
|
13961
|
+
borderColor: borderColor,
|
|
13962
|
+
backgroundColor: backgroundColor
|
|
13923
13963
|
};
|
|
13924
13964
|
});
|
|
13925
|
-
var StyledText = index$a(Text$1)(function (
|
|
13926
|
-
var themeIntent =
|
|
13927
|
-
|
|
13965
|
+
var StyledText = index$a(Text$1)(function (_ref3) {
|
|
13966
|
+
var themeIntent = _ref3.themeIntent,
|
|
13967
|
+
themeVariant = _ref3.themeVariant,
|
|
13968
|
+
theme = _ref3.theme;
|
|
13969
|
+
var _ref4 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
13970
|
+
textColor = _ref4.textColor;
|
|
13928
13971
|
return {
|
|
13929
13972
|
fontFamily: theme.__hd__.tag.fonts["default"],
|
|
13930
13973
|
fontSize: theme.__hd__.tag.fontSizes["default"],
|
|
13931
|
-
color:
|
|
13974
|
+
color: textColor,
|
|
13932
13975
|
includeFontPadding: false,
|
|
13933
13976
|
textAlignVertical: 'center',
|
|
13934
13977
|
textAlign: 'center'
|
|
13935
13978
|
};
|
|
13936
13979
|
});
|
|
13937
13980
|
|
|
13938
|
-
var _excluded = ["content", "intent", "style", "testID"];
|
|
13981
|
+
var _excluded = ["content", "variant", "intent", "style", "testID"];
|
|
13939
13982
|
var Tag = function Tag(_ref) {
|
|
13940
13983
|
var content = _ref.content,
|
|
13984
|
+
_ref$variant = _ref.variant,
|
|
13985
|
+
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
13941
13986
|
_ref$intent = _ref.intent,
|
|
13942
13987
|
intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
|
|
13943
13988
|
style = _ref.style,
|
|
@@ -13945,11 +13990,13 @@ var Tag = function Tag(_ref) {
|
|
|
13945
13990
|
nativeProps = _objectWithoutProperties(_ref, _excluded);
|
|
13946
13991
|
return /*#__PURE__*/React.createElement(StyledView, _extends$1({}, nativeProps, {
|
|
13947
13992
|
themeIntent: intent,
|
|
13993
|
+
themeVariant: variant,
|
|
13948
13994
|
style: style,
|
|
13949
13995
|
testID: testID
|
|
13950
|
-
}), /*#__PURE__*/React.createElement(StyledText, {
|
|
13951
|
-
themeIntent: intent
|
|
13952
|
-
|
|
13996
|
+
}), typeof content === 'string' ? /*#__PURE__*/React.createElement(StyledText, {
|
|
13997
|
+
themeIntent: intent,
|
|
13998
|
+
themeVariant: variant
|
|
13999
|
+
}, content) : content);
|
|
13953
14000
|
};
|
|
13954
14001
|
|
|
13955
14002
|
var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
package/lib/index.js
CHANGED
|
@@ -2495,7 +2495,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2495
2495
|
danger: theme.colors.onErrorSurface,
|
|
2496
2496
|
dangerBackground: theme.colors.errorSurface,
|
|
2497
2497
|
archived: theme.colors.onArchivedSurface,
|
|
2498
|
-
archivedBackground: theme.colors.archivedSurface
|
|
2498
|
+
archivedBackground: theme.colors.archivedSurface,
|
|
2499
|
+
text: theme.colors.onDefaultGlobalSurface
|
|
2499
2500
|
};
|
|
2500
2501
|
var fonts = {
|
|
2501
2502
|
"default": theme.fonts.neutral.semiBold
|
|
@@ -2658,7 +2659,7 @@ var getToastTheme = function getToastTheme(theme) {
|
|
|
2658
2659
|
var getToolbarTheme = function getToolbarTheme(theme) {
|
|
2659
2660
|
var colors = {
|
|
2660
2661
|
background: theme.colors.defaultGlobalSurface,
|
|
2661
|
-
border: theme.colors.
|
|
2662
|
+
border: theme.colors.secondaryOutline,
|
|
2662
2663
|
primary: theme.colors.primary,
|
|
2663
2664
|
secondary: theme.colors.secondary,
|
|
2664
2665
|
info: theme.colors.info,
|
|
@@ -5659,6 +5660,20 @@ var usePrevious = function usePrevious(value) {
|
|
|
5659
5660
|
}, [value]);
|
|
5660
5661
|
return ref.current;
|
|
5661
5662
|
};
|
|
5663
|
+
function usePropsOrInternalState(initialState, state, setState) {
|
|
5664
|
+
var _React$useState = React__default["default"].useState(initialState),
|
|
5665
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5666
|
+
internalState = _React$useState2[0],
|
|
5667
|
+
setInternalState = _React$useState2[1];
|
|
5668
|
+
return [state || internalState, setState || setInternalState];
|
|
5669
|
+
}
|
|
5670
|
+
var useDeprecation = function useDeprecation(message) {
|
|
5671
|
+
var cond = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
5672
|
+
React.useEffect(function () {
|
|
5673
|
+
// eslint-disable-next-line no-console
|
|
5674
|
+
console.warn(message);
|
|
5675
|
+
}, [message, cond]);
|
|
5676
|
+
};
|
|
5662
5677
|
|
|
5663
5678
|
var Collapse = function Collapse(_ref) {
|
|
5664
5679
|
var _ref$open = _ref.open,
|
|
@@ -6330,14 +6345,6 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
|
6330
6345
|
}, content));
|
|
6331
6346
|
};
|
|
6332
6347
|
|
|
6333
|
-
function usePropsOrInternalState(initialState, state, setState) {
|
|
6334
|
-
var _React$useState = React__default["default"].useState(initialState),
|
|
6335
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6336
|
-
internalState = _React$useState2[0],
|
|
6337
|
-
setInternalState = _React$useState2[1];
|
|
6338
|
-
return [state || internalState, setState || setInternalState];
|
|
6339
|
-
}
|
|
6340
|
-
|
|
6341
6348
|
var _excluded$h = ["key"];
|
|
6342
6349
|
var Accordion = function Accordion(_ref) {
|
|
6343
6350
|
var items = _ref.items,
|
|
@@ -10534,11 +10541,12 @@ var LeftDataCard = index$a(reactNative.View)(function (_ref2) {
|
|
|
10534
10541
|
|
|
10535
10542
|
var _excluded$8 = ["variant", "intent", "children"];
|
|
10536
10543
|
var Card = function Card(_ref) {
|
|
10537
|
-
var
|
|
10538
|
-
variant = _ref$variant === void 0 ? 'basic' : _ref$variant,
|
|
10544
|
+
var _variant = _ref.variant,
|
|
10539
10545
|
intent = _ref.intent,
|
|
10540
10546
|
children = _ref.children,
|
|
10541
10547
|
nativeProps = _objectWithoutProperties(_ref, _excluded$8);
|
|
10548
|
+
var variant = _variant === undefined ? 'basic' : _variant;
|
|
10549
|
+
useDeprecation("Card's variant prop is deprecated and will be removed in the next major release.\nPlease remove it or use Card.Data instead.", _variant !== undefined);
|
|
10542
10550
|
return /*#__PURE__*/React__default["default"].createElement(StyledCard, _extends$1({}, nativeProps, {
|
|
10543
10551
|
themeVariant: variant,
|
|
10544
10552
|
themeIntent: intent
|
|
@@ -13037,6 +13045,7 @@ function MultiSelect(_ref) {
|
|
|
13037
13045
|
inputProps = _ref.inputProps,
|
|
13038
13046
|
onConfirm = _ref.onConfirm,
|
|
13039
13047
|
onDimiss = _ref.onDimiss,
|
|
13048
|
+
onDismiss = _ref.onDismiss,
|
|
13040
13049
|
onEndReached = _ref.onEndReached,
|
|
13041
13050
|
onQueryChange = _ref.onQueryChange,
|
|
13042
13051
|
options = _ref.options,
|
|
@@ -13048,6 +13057,7 @@ function MultiSelect(_ref) {
|
|
|
13048
13057
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
13049
13058
|
_ref$disabled = _ref.disabled,
|
|
13050
13059
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
13060
|
+
required = _ref.required,
|
|
13051
13061
|
numberOfLines = _ref.numberOfLines,
|
|
13052
13062
|
style = _ref.style,
|
|
13053
13063
|
testID = _ref.testID,
|
|
@@ -13082,7 +13092,9 @@ function MultiSelect(_ref) {
|
|
|
13082
13092
|
}
|
|
13083
13093
|
}, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
13084
13094
|
pointerEvents: "none"
|
|
13085
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({
|
|
13095
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({
|
|
13096
|
+
numberOfLines: numberOfLines
|
|
13097
|
+
}, inputProps, {
|
|
13086
13098
|
label: label,
|
|
13087
13099
|
value: displayedValue,
|
|
13088
13100
|
suffix: "arrow-down",
|
|
@@ -13090,7 +13102,7 @@ function MultiSelect(_ref) {
|
|
|
13090
13102
|
error: error,
|
|
13091
13103
|
editable: editable,
|
|
13092
13104
|
disabled: disabled,
|
|
13093
|
-
|
|
13105
|
+
required: required,
|
|
13094
13106
|
pointerEvents: "none",
|
|
13095
13107
|
style: style,
|
|
13096
13108
|
testID: testID,
|
|
@@ -13102,7 +13114,7 @@ function MultiSelect(_ref) {
|
|
|
13102
13114
|
onRequestClose: function onRequestClose() {
|
|
13103
13115
|
return setOpen(false);
|
|
13104
13116
|
},
|
|
13105
|
-
onDismiss: onDimiss,
|
|
13117
|
+
onDismiss: onDismiss || onDimiss,
|
|
13106
13118
|
header: label,
|
|
13107
13119
|
style: {
|
|
13108
13120
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
@@ -13215,6 +13227,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13215
13227
|
inputProps = _ref.inputProps,
|
|
13216
13228
|
onConfirm = _ref.onConfirm,
|
|
13217
13229
|
onDimiss = _ref.onDimiss,
|
|
13230
|
+
onDismiss = _ref.onDismiss,
|
|
13218
13231
|
onEndReached = _ref.onEndReached,
|
|
13219
13232
|
onQueryChange = _ref.onQueryChange,
|
|
13220
13233
|
options = _ref.options,
|
|
@@ -13226,6 +13239,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13226
13239
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
13227
13240
|
_ref$disabled = _ref.disabled,
|
|
13228
13241
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
13242
|
+
required = _ref.required,
|
|
13229
13243
|
numberOfLines = _ref.numberOfLines,
|
|
13230
13244
|
style = _ref.style,
|
|
13231
13245
|
testID = _ref.testID,
|
|
@@ -13251,7 +13265,9 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13251
13265
|
}
|
|
13252
13266
|
}, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
13253
13267
|
pointerEvents: "none"
|
|
13254
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({
|
|
13268
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextInput, _extends$1({
|
|
13269
|
+
numberOfLines: numberOfLines
|
|
13270
|
+
}, inputProps, {
|
|
13255
13271
|
label: label,
|
|
13256
13272
|
value: displayedValue,
|
|
13257
13273
|
suffix: "arrow-down",
|
|
@@ -13259,7 +13275,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13259
13275
|
error: error,
|
|
13260
13276
|
editable: editable,
|
|
13261
13277
|
disabled: disabled,
|
|
13262
|
-
|
|
13278
|
+
required: required,
|
|
13263
13279
|
pointerEvents: "none",
|
|
13264
13280
|
style: style,
|
|
13265
13281
|
testID: testID,
|
|
@@ -13271,7 +13287,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13271
13287
|
onRequestClose: function onRequestClose() {
|
|
13272
13288
|
return setOpen(false);
|
|
13273
13289
|
},
|
|
13274
|
-
onDismiss: onDimiss,
|
|
13290
|
+
onDismiss: onDismiss || onDimiss,
|
|
13275
13291
|
header: label,
|
|
13276
13292
|
style: {
|
|
13277
13293
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
@@ -13681,6 +13697,8 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13681
13697
|
lazy = _ref2$lazy === void 0 ? false : _ref2$lazy,
|
|
13682
13698
|
_ref2$lazyPreloadDist = _ref2.lazyPreloadDistance,
|
|
13683
13699
|
lazyPreloadDistance = _ref2$lazyPreloadDist === void 0 ? 1 : _ref2$lazyPreloadDist,
|
|
13700
|
+
_ref2$swipeEnabled = _ref2.swipeEnabled,
|
|
13701
|
+
swipeEnabled = _ref2$swipeEnabled === void 0 ? true : _ref2$swipeEnabled,
|
|
13684
13702
|
componentTestID = _ref2.testID;
|
|
13685
13703
|
var flatListRef = React__default["default"].useRef(null);
|
|
13686
13704
|
var pagerViewRef = React__default["default"].useRef(null);
|
|
@@ -13793,7 +13811,8 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13793
13811
|
if (selectedItem) {
|
|
13794
13812
|
onTabPress(selectedItem.key);
|
|
13795
13813
|
}
|
|
13796
|
-
}
|
|
13814
|
+
},
|
|
13815
|
+
scrollEnabled: swipeEnabled
|
|
13797
13816
|
}, tabs.map(function (tab, index) {
|
|
13798
13817
|
var key = tab.key,
|
|
13799
13818
|
component = tab.component,
|
|
@@ -13838,6 +13857,8 @@ var Tabs = function Tabs(_ref2) {
|
|
|
13838
13857
|
lazy = _ref2$lazy === void 0 ? false : _ref2$lazy,
|
|
13839
13858
|
_ref2$lazyPreloadDist = _ref2.lazyPreloadDistance,
|
|
13840
13859
|
lazyPreloadDistance = _ref2$lazyPreloadDist === void 0 ? 1 : _ref2$lazyPreloadDist,
|
|
13860
|
+
_ref2$swipeEnabled = _ref2.swipeEnabled,
|
|
13861
|
+
swipeEnabled = _ref2$swipeEnabled === void 0 ? true : _ref2$swipeEnabled,
|
|
13841
13862
|
componentTestID = _ref2.testID;
|
|
13842
13863
|
var theme = useTheme$1();
|
|
13843
13864
|
var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
@@ -13918,7 +13939,8 @@ var Tabs = function Tabs(_ref2) {
|
|
|
13918
13939
|
}
|
|
13919
13940
|
}], {
|
|
13920
13941
|
useNativeDriver: true
|
|
13921
|
-
})
|
|
13942
|
+
}),
|
|
13943
|
+
scrollEnabled: swipeEnabled
|
|
13922
13944
|
}, tabs.map(function (tab, index) {
|
|
13923
13945
|
var key = tab.key,
|
|
13924
13946
|
component = tab.component,
|
|
@@ -13939,34 +13961,57 @@ var index$2 = Object.assign(Tabs, {
|
|
|
13939
13961
|
Scroll: ScrollableTab
|
|
13940
13962
|
});
|
|
13941
13963
|
|
|
13964
|
+
var getFilledStyles = function getFilledStyles(themeIntent, theme) {
|
|
13965
|
+
return {
|
|
13966
|
+
textColor: theme.__hd__.tag.colors.text,
|
|
13967
|
+
borderColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
13968
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
13969
|
+
};
|
|
13970
|
+
};
|
|
13971
|
+
var getOutlinedStyles = function getOutlinedStyles(themeIntent, theme) {
|
|
13972
|
+
return {
|
|
13973
|
+
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
13974
|
+
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
13975
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
13976
|
+
};
|
|
13977
|
+
};
|
|
13942
13978
|
var StyledView = index$a(reactNative.View)(function (_ref) {
|
|
13943
13979
|
var themeIntent = _ref.themeIntent,
|
|
13980
|
+
themeVariant = _ref.themeVariant,
|
|
13944
13981
|
theme = _ref.theme;
|
|
13982
|
+
var _ref2 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
13983
|
+
borderColor = _ref2.borderColor,
|
|
13984
|
+
backgroundColor = _ref2.backgroundColor;
|
|
13945
13985
|
return {
|
|
13946
13986
|
borderWidth: theme.__hd__.tag.borderWidths["default"],
|
|
13947
13987
|
borderRadius: theme.__hd__.tag.radii["default"],
|
|
13948
13988
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
13949
13989
|
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding,
|
|
13950
|
-
borderColor:
|
|
13951
|
-
backgroundColor:
|
|
13990
|
+
borderColor: borderColor,
|
|
13991
|
+
backgroundColor: backgroundColor
|
|
13952
13992
|
};
|
|
13953
13993
|
});
|
|
13954
|
-
var StyledText = index$a(reactNative.Text)(function (
|
|
13955
|
-
var themeIntent =
|
|
13956
|
-
|
|
13994
|
+
var StyledText = index$a(reactNative.Text)(function (_ref3) {
|
|
13995
|
+
var themeIntent = _ref3.themeIntent,
|
|
13996
|
+
themeVariant = _ref3.themeVariant,
|
|
13997
|
+
theme = _ref3.theme;
|
|
13998
|
+
var _ref4 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
13999
|
+
textColor = _ref4.textColor;
|
|
13957
14000
|
return {
|
|
13958
14001
|
fontFamily: theme.__hd__.tag.fonts["default"],
|
|
13959
14002
|
fontSize: theme.__hd__.tag.fontSizes["default"],
|
|
13960
|
-
color:
|
|
14003
|
+
color: textColor,
|
|
13961
14004
|
includeFontPadding: false,
|
|
13962
14005
|
textAlignVertical: 'center',
|
|
13963
14006
|
textAlign: 'center'
|
|
13964
14007
|
};
|
|
13965
14008
|
});
|
|
13966
14009
|
|
|
13967
|
-
var _excluded = ["content", "intent", "style", "testID"];
|
|
14010
|
+
var _excluded = ["content", "variant", "intent", "style", "testID"];
|
|
13968
14011
|
var Tag = function Tag(_ref) {
|
|
13969
14012
|
var content = _ref.content,
|
|
14013
|
+
_ref$variant = _ref.variant,
|
|
14014
|
+
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
13970
14015
|
_ref$intent = _ref.intent,
|
|
13971
14016
|
intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
|
|
13972
14017
|
style = _ref.style,
|
|
@@ -13974,11 +14019,13 @@ var Tag = function Tag(_ref) {
|
|
|
13974
14019
|
nativeProps = _objectWithoutProperties(_ref, _excluded);
|
|
13975
14020
|
return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({}, nativeProps, {
|
|
13976
14021
|
themeIntent: intent,
|
|
14022
|
+
themeVariant: variant,
|
|
13977
14023
|
style: style,
|
|
13978
14024
|
testID: testID
|
|
13979
|
-
}), /*#__PURE__*/React__default["default"].createElement(StyledText, {
|
|
13980
|
-
themeIntent: intent
|
|
13981
|
-
|
|
14025
|
+
}), typeof content === 'string' ? /*#__PURE__*/React__default["default"].createElement(StyledText, {
|
|
14026
|
+
themeIntent: intent,
|
|
14027
|
+
themeVariant: variant
|
|
14028
|
+
}, content) : content);
|
|
13982
14029
|
};
|
|
13983
14030
|
|
|
13984
14031
|
var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.27.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/native": "^11.9.3",
|
|
22
22
|
"@emotion/react": "^11.9.3",
|
|
23
|
-
"@hero-design/colors": "7.
|
|
23
|
+
"@hero-design/colors": "7.27.0",
|
|
24
24
|
"date-fns": "^2.16.1",
|
|
25
25
|
"events": "^3.2.0",
|
|
26
26
|
"hero-editor": "^1.9.12"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@types/react-native": "^0.67.7",
|
|
59
59
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
60
60
|
"babel-plugin-inline-import": "^3.0.0",
|
|
61
|
-
"eslint-config-hd": "7.
|
|
61
|
+
"eslint-config-hd": "7.27.0",
|
|
62
62
|
"jest": "^27.3.1",
|
|
63
63
|
"react": "17.0.2",
|
|
64
64
|
"react-native": "0.65.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"rollup-plugin-copy": "^3.4.0",
|
|
73
73
|
"rollup-plugin-flow": "^1.1.1",
|
|
74
74
|
"ts-jest": "^27.0.7",
|
|
75
|
-
"prettier-config-hd": "7.
|
|
75
|
+
"prettier-config-hd": "7.27.0",
|
|
76
76
|
"rn-7-23-0": "npm:@hero-design/rn@7.23.0"
|
|
77
77
|
},
|
|
78
78
|
"prettier": "prettier-config-hd"
|
|
@@ -3,7 +3,7 @@ import type { Key, ReactElement } from 'react';
|
|
|
3
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import AccordionItem from './AccordionItem';
|
|
5
5
|
import { Spacer, StyledWrapper } from './StyledAccordion';
|
|
6
|
-
import { usePropsOrInternalState } from '
|
|
6
|
+
import { usePropsOrInternalState } from '../../utils/hooks';
|
|
7
7
|
|
|
8
8
|
export interface AccordionProps<K extends Key> {
|
|
9
9
|
/**
|
|
@@ -3,6 +3,7 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
4
4
|
import DataCard from './DataCard';
|
|
5
5
|
import { StyledCard, LeftDataCard } from './StyledCard';
|
|
6
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
6
7
|
|
|
7
8
|
interface CardProps extends ViewProps {
|
|
8
9
|
/**
|
|
@@ -30,16 +31,26 @@ interface CardProps extends ViewProps {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const Card = ({
|
|
33
|
-
variant
|
|
34
|
+
variant: _variant,
|
|
34
35
|
intent,
|
|
35
36
|
children,
|
|
36
37
|
...nativeProps
|
|
37
|
-
}: CardProps): JSX.Element =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
}: CardProps): JSX.Element => {
|
|
39
|
+
const variant: CardProps['variant'] =
|
|
40
|
+
_variant === undefined ? 'basic' : _variant;
|
|
41
|
+
|
|
42
|
+
useDeprecation(
|
|
43
|
+
"Card's variant prop is deprecated and will be removed in the next major release.\nPlease remove it or use Card.Data instead.",
|
|
44
|
+
_variant !== undefined
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<StyledCard {...nativeProps} themeVariant={variant} themeIntent={intent}>
|
|
49
|
+
{variant === 'data' && <LeftDataCard testID="data-card-indicator" />}
|
|
50
|
+
{children}
|
|
51
|
+
</StyledCard>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
43
54
|
|
|
44
55
|
export default Object.assign(Card, {
|
|
45
56
|
Data: DataCard,
|