@hero-design/rn 7.16.1 → 7.16.2

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.
@@ -1,9 +1,9 @@
1
- @hero-design/rn:build: cache hit, replaying output 99b83d4cdc69539a
1
+ @hero-design/rn:build: cache hit, replaying output 388181041750c1c7
2
2
  @hero-design/rn:build: $ yarn build:js && yarn build:types
3
3
  @hero-design/rn:build: $ rollup -c
4
4
  @hero-design/rn:build: 
5
5
  @hero-design/rn:build: src/index.ts → lib/index.js, es/index.js...
6
6
  @hero-design/rn:build: (!) 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`.
7
7
  @hero-design/rn:build: (!) 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
8
- @hero-design/rn:build: created lib/index.js, es/index.js in 19.2s
8
+ @hero-design/rn:build: created lib/index.js, es/index.js in 20.5s
9
9
  @hero-design/rn:build: $ tsc --noEmit false --emitDeclarationOnly
package/es/index.js CHANGED
@@ -3455,8 +3455,6 @@ var getSectionHeadingTheme = function getSectionHeadingTheme(theme) {
3455
3455
 
3456
3456
  var getSelectTheme = function getSelectTheme(theme) {
3457
3457
  var colors = {
3458
- option: theme.colors.platformBackground,
3459
- checkedOption: theme.colors.primaryBackground,
3460
3458
  footerText: theme.colors.primary
3461
3459
  };
3462
3460
  var space = {
@@ -19076,7 +19074,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
19076
19074
  style = _ref.style,
19077
19075
  testID = _ref.testID;
19078
19076
 
19079
- var _useState = useState(value),
19077
+ var _useState = useState(value || new Date()),
19080
19078
  _useState2 = _slicedToArray(_useState, 2),
19081
19079
  selectingDate = _useState2[0],
19082
19080
  setSelectingDate = _useState2[1];
@@ -19127,7 +19125,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
19127
19125
  }, confirmLabel))
19128
19126
  }, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
19129
19127
  testID: "datePickerIOS",
19130
- value: selectingDate || new Date(),
19128
+ value: selectingDate,
19131
19129
  mode: "date",
19132
19130
  onChange: function onChange(_, date) {
19133
19131
  if (date) {
@@ -19736,7 +19734,7 @@ var StyledListItemContainer = index$6(TouchableHighlight)(function (_ref3) {
19736
19734
  return {
19737
19735
  alignItems: 'center',
19738
19736
  flexDirection: 'row',
19739
- backgroundColor: themeSelected ? theme.__hd__.select.colors.checkedOption : theme.__hd__.select.colors.option,
19737
+ backgroundColor: themeSelected ? theme.__hd__.list.colors.checkedListItemContainerBackground : theme.__hd__.list.colors.listItemContainerBackground,
19740
19738
  padding: theme.__hd__.list.space.listItemContainerPadding,
19741
19739
  opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled
19742
19740
  };
@@ -20535,32 +20533,20 @@ var SectionHeading = function SectionHeading(_ref) {
20535
20533
  }, text)), rightChildren);
20536
20534
  };
20537
20535
 
20538
- var OptionWrapper = index$6(TouchableOpacity)(function (_ref) {
20539
- var theme = _ref.theme,
20540
- themeSelected = _ref.themeSelected;
20541
- return {
20542
- flexDirection: 'row',
20543
- justifyContent: 'space-between',
20544
- alignItems: 'center',
20545
- borderRadius: theme.__hd__.select.radii.option,
20546
- padding: theme.__hd__.select.space.optionPadding,
20547
- backgroundColor: themeSelected ? theme.__hd__.select.colors.checkedOption : theme.__hd__.select.colors.option
20548
- };
20549
- });
20550
- index$6(View)(function (_ref2) {
20551
- var theme = _ref2.theme;
20536
+ index$6(View)(function (_ref) {
20537
+ var theme = _ref.theme;
20552
20538
  return {
20553
20539
  marginTop: theme.__hd__.select.space.optionListSpacing
20554
20540
  };
20555
20541
  });
20556
- var FooterText = index$6(Typography.Text)(function (_ref3) {
20557
- var theme = _ref3.theme;
20542
+ var FooterText = index$6(Typography.Text)(function (_ref2) {
20543
+ var theme = _ref2.theme;
20558
20544
  return {
20559
20545
  color: theme.__hd__.select.colors.footerText
20560
20546
  };
20561
20547
  });
20562
- var StyledSearchBar = index$6(View)(function (_ref4) {
20563
- var theme = _ref4.theme;
20548
+ var StyledSearchBar = index$6(View)(function (_ref3) {
20549
+ var theme = _ref3.theme;
20564
20550
  return {
20565
20551
  marginTop: theme.__hd__.select.space.searchBarMarginTopSpacing,
20566
20552
  paddingHorizontal: theme.__hd__.select.space.searchBarHorizontalSpacing,
@@ -20658,19 +20644,15 @@ var Option$1 = function Option(_ref) {
20658
20644
  var text = _ref.text,
20659
20645
  selected = _ref.selected,
20660
20646
  onPress = _ref.onPress;
20661
- return /*#__PURE__*/React.createElement(OptionWrapper, {
20662
- themeSelected: selected,
20663
- onPress: onPress
20664
- }, /*#__PURE__*/React.createElement(View, {
20665
- style: {
20666
- flex: 1
20667
- }
20668
- }, /*#__PURE__*/React.createElement(Typography.Text, {
20669
- fontSize: "large"
20670
- }, text)), selected && /*#__PURE__*/React.createElement(Icon, {
20671
- icon: "checkmark",
20672
- size: "small"
20673
- }));
20647
+ return /*#__PURE__*/React.createElement(List.BasicItem, {
20648
+ selected: selected,
20649
+ onPress: onPress,
20650
+ title: text,
20651
+ suffix: selected ? /*#__PURE__*/React.createElement(Icon, {
20652
+ icon: "checkmark",
20653
+ size: "small"
20654
+ }) : undefined
20655
+ });
20674
20656
  };
20675
20657
 
20676
20658
  var OptionList$1 = function OptionList(_ref) {
@@ -20829,16 +20811,11 @@ var Option = function Option(_ref) {
20829
20811
  var text = _ref.text,
20830
20812
  selected = _ref.selected,
20831
20813
  onPress = _ref.onPress;
20832
- return /*#__PURE__*/React.createElement(OptionWrapper, {
20833
- themeSelected: selected,
20834
- onPress: onPress
20835
- }, /*#__PURE__*/React.createElement(View, {
20836
- style: {
20837
- flex: 1
20838
- }
20839
- }, /*#__PURE__*/React.createElement(Typography.Text, {
20840
- fontSize: "large"
20841
- }, text)));
20814
+ return /*#__PURE__*/React.createElement(List.BasicItem, {
20815
+ selected: selected,
20816
+ onPress: onPress,
20817
+ title: text
20818
+ });
20842
20819
  };
20843
20820
 
20844
20821
  var OptionList = function OptionList(_ref) {
@@ -21636,7 +21613,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21636
21613
  style = _ref.style,
21637
21614
  testID = _ref.testID;
21638
21615
 
21639
- var _useState = useState(value),
21616
+ var _useState = useState(value || new Date()),
21640
21617
  _useState2 = _slicedToArray(_useState, 2),
21641
21618
  selectingDate = _useState2[0],
21642
21619
  setSelectingDate = _useState2[1];
@@ -21688,7 +21665,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21688
21665
  }, confirmLabel))
21689
21666
  }, /*#__PURE__*/React.createElement(StyledPickerWrapper, null, /*#__PURE__*/React.createElement(DateTimePicker, {
21690
21667
  testID: "timePickerIOS",
21691
- value: selectingDate || new Date(),
21668
+ value: selectingDate,
21692
21669
  mode: "time" // Current prop is24Hour config only available for Android.
21693
21670
  // This is a work around to get the picker to display 24 hour format for iOS.
21694
21671
  ,
package/lib/index.js CHANGED
@@ -3483,8 +3483,6 @@ var getSectionHeadingTheme = function getSectionHeadingTheme(theme) {
3483
3483
 
3484
3484
  var getSelectTheme = function getSelectTheme(theme) {
3485
3485
  var colors = {
3486
- option: theme.colors.platformBackground,
3487
- checkedOption: theme.colors.primaryBackground,
3488
3486
  footerText: theme.colors.primary
3489
3487
  };
3490
3488
  var space = {
@@ -19104,7 +19102,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
19104
19102
  style = _ref.style,
19105
19103
  testID = _ref.testID;
19106
19104
 
19107
- var _useState = React.useState(value),
19105
+ var _useState = React.useState(value || new Date()),
19108
19106
  _useState2 = _slicedToArray(_useState, 2),
19109
19107
  selectingDate = _useState2[0],
19110
19108
  setSelectingDate = _useState2[1];
@@ -19155,7 +19153,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
19155
19153
  }, confirmLabel))
19156
19154
  }, /*#__PURE__*/React__default["default"].createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React__default["default"].createElement(DateTimePicker__default["default"], {
19157
19155
  testID: "datePickerIOS",
19158
- value: selectingDate || new Date(),
19156
+ value: selectingDate,
19159
19157
  mode: "date",
19160
19158
  onChange: function onChange(_, date) {
19161
19159
  if (date) {
@@ -19764,7 +19762,7 @@ var StyledListItemContainer = index$6(reactNative.TouchableHighlight)(function (
19764
19762
  return {
19765
19763
  alignItems: 'center',
19766
19764
  flexDirection: 'row',
19767
- backgroundColor: themeSelected ? theme.__hd__.select.colors.checkedOption : theme.__hd__.select.colors.option,
19765
+ backgroundColor: themeSelected ? theme.__hd__.list.colors.checkedListItemContainerBackground : theme.__hd__.list.colors.listItemContainerBackground,
19768
19766
  padding: theme.__hd__.list.space.listItemContainerPadding,
19769
19767
  opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled
19770
19768
  };
@@ -20563,32 +20561,20 @@ var SectionHeading = function SectionHeading(_ref) {
20563
20561
  }, text)), rightChildren);
20564
20562
  };
20565
20563
 
20566
- var OptionWrapper = index$6(reactNative.TouchableOpacity)(function (_ref) {
20567
- var theme = _ref.theme,
20568
- themeSelected = _ref.themeSelected;
20569
- return {
20570
- flexDirection: 'row',
20571
- justifyContent: 'space-between',
20572
- alignItems: 'center',
20573
- borderRadius: theme.__hd__.select.radii.option,
20574
- padding: theme.__hd__.select.space.optionPadding,
20575
- backgroundColor: themeSelected ? theme.__hd__.select.colors.checkedOption : theme.__hd__.select.colors.option
20576
- };
20577
- });
20578
- index$6(reactNative.View)(function (_ref2) {
20579
- var theme = _ref2.theme;
20564
+ index$6(reactNative.View)(function (_ref) {
20565
+ var theme = _ref.theme;
20580
20566
  return {
20581
20567
  marginTop: theme.__hd__.select.space.optionListSpacing
20582
20568
  };
20583
20569
  });
20584
- var FooterText = index$6(Typography.Text)(function (_ref3) {
20585
- var theme = _ref3.theme;
20570
+ var FooterText = index$6(Typography.Text)(function (_ref2) {
20571
+ var theme = _ref2.theme;
20586
20572
  return {
20587
20573
  color: theme.__hd__.select.colors.footerText
20588
20574
  };
20589
20575
  });
20590
- var StyledSearchBar = index$6(reactNative.View)(function (_ref4) {
20591
- var theme = _ref4.theme;
20576
+ var StyledSearchBar = index$6(reactNative.View)(function (_ref3) {
20577
+ var theme = _ref3.theme;
20592
20578
  return {
20593
20579
  marginTop: theme.__hd__.select.space.searchBarMarginTopSpacing,
20594
20580
  paddingHorizontal: theme.__hd__.select.space.searchBarHorizontalSpacing,
@@ -20686,19 +20672,15 @@ var Option$1 = function Option(_ref) {
20686
20672
  var text = _ref.text,
20687
20673
  selected = _ref.selected,
20688
20674
  onPress = _ref.onPress;
20689
- return /*#__PURE__*/React__default["default"].createElement(OptionWrapper, {
20690
- themeSelected: selected,
20691
- onPress: onPress
20692
- }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
20693
- style: {
20694
- flex: 1
20695
- }
20696
- }, /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
20697
- fontSize: "large"
20698
- }, text)), selected && /*#__PURE__*/React__default["default"].createElement(Icon, {
20699
- icon: "checkmark",
20700
- size: "small"
20701
- }));
20675
+ return /*#__PURE__*/React__default["default"].createElement(List.BasicItem, {
20676
+ selected: selected,
20677
+ onPress: onPress,
20678
+ title: text,
20679
+ suffix: selected ? /*#__PURE__*/React__default["default"].createElement(Icon, {
20680
+ icon: "checkmark",
20681
+ size: "small"
20682
+ }) : undefined
20683
+ });
20702
20684
  };
20703
20685
 
20704
20686
  var OptionList$1 = function OptionList(_ref) {
@@ -20857,16 +20839,11 @@ var Option = function Option(_ref) {
20857
20839
  var text = _ref.text,
20858
20840
  selected = _ref.selected,
20859
20841
  onPress = _ref.onPress;
20860
- return /*#__PURE__*/React__default["default"].createElement(OptionWrapper, {
20861
- themeSelected: selected,
20862
- onPress: onPress
20863
- }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
20864
- style: {
20865
- flex: 1
20866
- }
20867
- }, /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
20868
- fontSize: "large"
20869
- }, text)));
20842
+ return /*#__PURE__*/React__default["default"].createElement(List.BasicItem, {
20843
+ selected: selected,
20844
+ onPress: onPress,
20845
+ title: text
20846
+ });
20870
20847
  };
20871
20848
 
20872
20849
  var OptionList = function OptionList(_ref) {
@@ -21664,7 +21641,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21664
21641
  style = _ref.style,
21665
21642
  testID = _ref.testID;
21666
21643
 
21667
- var _useState = React.useState(value),
21644
+ var _useState = React.useState(value || new Date()),
21668
21645
  _useState2 = _slicedToArray(_useState, 2),
21669
21646
  selectingDate = _useState2[0],
21670
21647
  setSelectingDate = _useState2[1];
@@ -21716,7 +21693,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21716
21693
  }, confirmLabel))
21717
21694
  }, /*#__PURE__*/React__default["default"].createElement(StyledPickerWrapper, null, /*#__PURE__*/React__default["default"].createElement(DateTimePicker__default["default"], {
21718
21695
  testID: "timePickerIOS",
21719
- value: selectingDate || new Date(),
21696
+ value: selectingDate,
21720
21697
  mode: "time" // Current prop is24Hour config only available for Android.
21721
21698
  // This is a work around to get the picker to display 24 hour format for iOS.
21722
21699
  ,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.16.1",
3
+ "version": "7.16.2",
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.16.1",
23
+ "@hero-design/colors": "7.16.2",
24
24
  "date-fns": "^2.16.1",
25
25
  "events": "^3.2.0",
26
26
  "hero-editor": "^1.9.9"
@@ -23,7 +23,7 @@ const DatePickerIOS = ({
23
23
  style,
24
24
  testID,
25
25
  }: DatePickerProps) => {
26
- const [selectingDate, setSelectingDate] = useState<Date | undefined>(value);
26
+ const [selectingDate, setSelectingDate] = useState<Date>(value || new Date());
27
27
  const [open, setOpen] = useState(false);
28
28
 
29
29
  const displayValue = value ? formatDate(displayFormat, value) : '';
@@ -70,7 +70,7 @@ const DatePickerIOS = ({
70
70
  <StyledPickerWrapper>
71
71
  <DateTimePicker
72
72
  testID="datePickerIOS"
73
- value={selectingDate || new Date()}
73
+ value={selectingDate}
74
74
  mode="date"
75
75
  onChange={(_: any, date: Date | undefined) => {
76
76
  if (date) {
@@ -18,8 +18,8 @@ const StyledListItemContainer = styled(TouchableHighlight)<{
18
18
  alignItems: 'center',
19
19
  flexDirection: 'row',
20
20
  backgroundColor: themeSelected
21
- ? theme.__hd__.select.colors.checkedOption
22
- : theme.__hd__.select.colors.option,
21
+ ? theme.__hd__.list.colors.checkedListItemContainerBackground
22
+ : theme.__hd__.list.colors.listItemContainerBackground,
23
23
  padding: theme.__hd__.list.space.listItemContainerPadding,
24
24
  opacity: themeDisabled
25
25
  ? theme.__hd__.list.opacity.disabled
@@ -1,9 +1,6 @@
1
1
  import React from 'react';
2
- import { View } from 'react-native';
3
2
  import Icon from '../../Icon';
4
-
5
- import Typography from '../../Typography';
6
- import { OptionWrapper } from '../StyledSelect';
3
+ import List from '../../List';
7
4
 
8
5
  const Option = ({
9
6
  text,
@@ -14,12 +11,12 @@ const Option = ({
14
11
  selected: boolean;
15
12
  onPress: () => void;
16
13
  }) => (
17
- <OptionWrapper themeSelected={selected} onPress={onPress}>
18
- <View style={{ flex: 1 }}>
19
- <Typography.Text fontSize="large">{text}</Typography.Text>
20
- </View>
21
- {selected && <Icon icon="checkmark" size="small" />}
22
- </OptionWrapper>
14
+ <List.BasicItem
15
+ selected={selected}
16
+ onPress={onPress}
17
+ title={text}
18
+ suffix={selected ? <Icon icon="checkmark" size="small" /> : undefined}
19
+ />
23
20
  );
24
21
 
25
22
  export default Option;
@@ -2,10 +2,13 @@
2
2
 
3
3
  exports[`Option renders correctly 1`] = `
4
4
  <View
5
+ accessibilityState={
6
+ Object {
7
+ "disabled": false,
8
+ }
9
+ }
5
10
  accessible={true}
6
- collapsable={false}
7
11
  focusable={true}
8
- nativeID="animatedComponent"
9
12
  onClick={[Function]}
10
13
  onResponderGrant={[Function]}
11
14
  onResponderMove={[Function]}
@@ -14,22 +17,26 @@ exports[`Option renders correctly 1`] = `
14
17
  onResponderTerminationRequest={[Function]}
15
18
  onStartShouldSetResponder={[Function]}
16
19
  style={
17
- Object {
18
- "alignItems": "center",
19
- "backgroundColor": "#f1e9fb",
20
- "borderRadius": 4,
21
- "flexDirection": "row",
22
- "justifyContent": "space-between",
23
- "opacity": 1,
24
- "padding": 16,
25
- }
20
+ Array [
21
+ Object {
22
+ "alignItems": "center",
23
+ "backgroundColor": "#f1e9fb",
24
+ "flexDirection": "row",
25
+ "opacity": 1,
26
+ "padding": 16,
27
+ },
28
+ undefined,
29
+ ]
26
30
  }
27
31
  >
28
32
  <View
29
33
  style={
30
- Object {
31
- "flex": 1,
32
- }
34
+ Array [
35
+ Object {
36
+ "flex": 1,
37
+ },
38
+ undefined,
39
+ ]
33
40
  }
34
41
  >
35
42
  <Text
@@ -52,19 +59,30 @@ exports[`Option renders correctly 1`] = `
52
59
  testOption
53
60
  </Text>
54
61
  </View>
55
- <HeroIcon
56
- name="checkmark"
62
+ <View
57
63
  style={
58
64
  Array [
59
65
  Object {
60
- "color": "#292a2b",
61
- "fontSize": 20,
66
+ "marginLeft": 8,
62
67
  },
63
68
  undefined,
64
69
  ]
65
70
  }
66
- themeIntent="text"
67
- themeSize="small"
68
- />
71
+ >
72
+ <HeroIcon
73
+ name="checkmark"
74
+ style={
75
+ Array [
76
+ Object {
77
+ "color": "#292a2b",
78
+ "fontSize": 20,
79
+ },
80
+ undefined,
81
+ ]
82
+ }
83
+ themeIntent="text"
84
+ themeSize="small"
85
+ />
86
+ </View>
69
87
  </View>
70
88
  `;