@hero-design/rn 8.61.3 → 8.62.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.
@@ -2,4 +2,4 @@
2
2
  src/index.ts → lib/index.js, es/index.js...
3
3
  (!) 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`.
4
4
  (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
5
- created lib/index.js, es/index.js in 56.1s
5
+ created lib/index.js, es/index.js in 58.2s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.62.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3030](https://github.com/Thinkei/hero-design/pull/3030) [`19693f226`](https://github.com/Thinkei/hero-design/commit/19693f22649c2130d15e1cb8b9c4bd8b47580d80) Thanks [@ttkien](https://github.com/ttkien)! - [Radio] Add extended variant
8
+
3
9
  ## 8.61.3
4
10
 
5
11
  ### Patch Changes
package/es/index.js CHANGED
@@ -2782,7 +2782,8 @@ var getListTheme = function getListTheme(theme) {
2782
2782
  listItemContainerPadding: theme.space.medium,
2783
2783
  leadingStatusMarginRight: theme.space.small,
2784
2784
  prefixContainerMarginRight: theme.space.small,
2785
- suffixContainerMarginLeft: theme.space.small
2785
+ suffixContainerMarginLeft: theme.space.small,
2786
+ childrenContainerTopMargin: theme.space.small
2786
2787
  };
2787
2788
  var radii = {
2788
2789
  item: theme.radii.medium,
@@ -15235,16 +15236,18 @@ var StyledContentContainer = index$9(View)(function () {
15235
15236
  flexGrow: 2
15236
15237
  };
15237
15238
  });
15238
- var StyledChildrenContainer = index$9(View)(function () {
15239
+ var StyledChildrenContainer = index$9(View)(function (_ref2) {
15240
+ var theme = _ref2.theme;
15239
15241
  return {
15240
15242
  flexDirection: 'column',
15241
15243
  justifyContent: 'flex-start',
15242
- alignItems: 'flex-start'
15244
+ alignItems: 'flex-start',
15245
+ marginTop: theme.__hd__.list.space.childrenContainerTopMargin
15243
15246
  };
15244
15247
  });
15245
- var StyledLeadingStatus = index$9(View)(function (_ref2) {
15246
- var theme = _ref2.theme,
15247
- themeLeadingStatusIntent = _ref2.themeLeadingStatusIntent;
15248
+ var StyledLeadingStatus = index$9(View)(function (_ref3) {
15249
+ var theme = _ref3.theme,
15250
+ themeLeadingStatusIntent = _ref3.themeLeadingStatusIntent;
15248
15251
  return {
15249
15252
  width: theme.__hd__.list.widths.leadingStatus,
15250
15253
  marginRight: theme.__hd__.list.space.leadingStatusMarginRight,
@@ -15252,14 +15255,14 @@ var StyledLeadingStatus = index$9(View)(function (_ref2) {
15252
15255
  backgroundColor: theme.__hd__.list.colors.leadingStatus[themeLeadingStatusIntent]
15253
15256
  };
15254
15257
  });
15255
- var StyledPrefixContainer$1 = index$9(View)(function (_ref3) {
15256
- var theme = _ref3.theme;
15258
+ var StyledPrefixContainer$1 = index$9(View)(function (_ref4) {
15259
+ var theme = _ref4.theme;
15257
15260
  return {
15258
15261
  marginRight: theme.__hd__.list.space.prefixContainerMarginRight
15259
15262
  };
15260
15263
  });
15261
- var StyledSuffixContainer$1 = index$9(View)(function (_ref4) {
15262
- var theme = _ref4.theme;
15264
+ var StyledSuffixContainer$1 = index$9(View)(function (_ref5) {
15265
+ var theme = _ref5.theme;
15263
15266
  return {
15264
15267
  marginLeft: theme.__hd__.list.space.suffixContainerMarginLeft
15265
15268
  };
@@ -16208,7 +16211,8 @@ var Radio = function Radio(_ref2) {
16208
16211
  subText = _ref2.subText,
16209
16212
  testID = _ref2.testID,
16210
16213
  _ref2$inactiveIntent = _ref2.inactiveIntent,
16211
- inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent;
16214
+ inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent,
16215
+ children = _ref2.children;
16212
16216
  return /*#__PURE__*/React__default.createElement(StyledRadio, {
16213
16217
  onPress: onPress,
16214
16218
  selected: checked,
@@ -16222,7 +16226,7 @@ var Radio = function Radio(_ref2) {
16222
16226
  testID: testID,
16223
16227
  themeIntent: inactiveIntent,
16224
16228
  themeChecked: checked
16225
- });
16229
+ }, children);
16226
16230
  };
16227
16231
 
16228
16232
  function getKey(option, index, keyExtractor) {
@@ -16261,7 +16265,7 @@ var RadioGroup = function RadioGroup(_ref) {
16261
16265
  return _onPress(option.value);
16262
16266
  },
16263
16267
  inactiveIntent: inactiveIntent
16264
- }));
16268
+ }, option.children));
16265
16269
  }));
16266
16270
  };
16267
16271
 
package/lib/index.js CHANGED
@@ -2812,7 +2812,8 @@ var getListTheme = function getListTheme(theme) {
2812
2812
  listItemContainerPadding: theme.space.medium,
2813
2813
  leadingStatusMarginRight: theme.space.small,
2814
2814
  prefixContainerMarginRight: theme.space.small,
2815
- suffixContainerMarginLeft: theme.space.small
2815
+ suffixContainerMarginLeft: theme.space.small,
2816
+ childrenContainerTopMargin: theme.space.small
2816
2817
  };
2817
2818
  var radii = {
2818
2819
  item: theme.radii.medium,
@@ -15265,16 +15266,18 @@ var StyledContentContainer = index$9(reactNative.View)(function () {
15265
15266
  flexGrow: 2
15266
15267
  };
15267
15268
  });
15268
- var StyledChildrenContainer = index$9(reactNative.View)(function () {
15269
+ var StyledChildrenContainer = index$9(reactNative.View)(function (_ref2) {
15270
+ var theme = _ref2.theme;
15269
15271
  return {
15270
15272
  flexDirection: 'column',
15271
15273
  justifyContent: 'flex-start',
15272
- alignItems: 'flex-start'
15274
+ alignItems: 'flex-start',
15275
+ marginTop: theme.__hd__.list.space.childrenContainerTopMargin
15273
15276
  };
15274
15277
  });
15275
- var StyledLeadingStatus = index$9(reactNative.View)(function (_ref2) {
15276
- var theme = _ref2.theme,
15277
- themeLeadingStatusIntent = _ref2.themeLeadingStatusIntent;
15278
+ var StyledLeadingStatus = index$9(reactNative.View)(function (_ref3) {
15279
+ var theme = _ref3.theme,
15280
+ themeLeadingStatusIntent = _ref3.themeLeadingStatusIntent;
15278
15281
  return {
15279
15282
  width: theme.__hd__.list.widths.leadingStatus,
15280
15283
  marginRight: theme.__hd__.list.space.leadingStatusMarginRight,
@@ -15282,14 +15285,14 @@ var StyledLeadingStatus = index$9(reactNative.View)(function (_ref2) {
15282
15285
  backgroundColor: theme.__hd__.list.colors.leadingStatus[themeLeadingStatusIntent]
15283
15286
  };
15284
15287
  });
15285
- var StyledPrefixContainer$1 = index$9(reactNative.View)(function (_ref3) {
15286
- var theme = _ref3.theme;
15288
+ var StyledPrefixContainer$1 = index$9(reactNative.View)(function (_ref4) {
15289
+ var theme = _ref4.theme;
15287
15290
  return {
15288
15291
  marginRight: theme.__hd__.list.space.prefixContainerMarginRight
15289
15292
  };
15290
15293
  });
15291
- var StyledSuffixContainer$1 = index$9(reactNative.View)(function (_ref4) {
15292
- var theme = _ref4.theme;
15294
+ var StyledSuffixContainer$1 = index$9(reactNative.View)(function (_ref5) {
15295
+ var theme = _ref5.theme;
15293
15296
  return {
15294
15297
  marginLeft: theme.__hd__.list.space.suffixContainerMarginLeft
15295
15298
  };
@@ -16238,7 +16241,8 @@ var Radio = function Radio(_ref2) {
16238
16241
  subText = _ref2.subText,
16239
16242
  testID = _ref2.testID,
16240
16243
  _ref2$inactiveIntent = _ref2.inactiveIntent,
16241
- inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent;
16244
+ inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent,
16245
+ children = _ref2.children;
16242
16246
  return /*#__PURE__*/React__default["default"].createElement(StyledRadio, {
16243
16247
  onPress: onPress,
16244
16248
  selected: checked,
@@ -16252,7 +16256,7 @@ var Radio = function Radio(_ref2) {
16252
16256
  testID: testID,
16253
16257
  themeIntent: inactiveIntent,
16254
16258
  themeChecked: checked
16255
- });
16259
+ }, children);
16256
16260
  };
16257
16261
 
16258
16262
  function getKey(option, index, keyExtractor) {
@@ -16291,7 +16295,7 @@ var RadioGroup = function RadioGroup(_ref) {
16291
16295
  return _onPress(option.value);
16292
16296
  },
16293
16297
  inactiveIntent: inactiveIntent
16294
- }));
16298
+ }, option.children));
16295
16299
  }));
16296
16300
  };
16297
16301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.61.3",
3
+ "version": "8.62.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -46,10 +46,11 @@ const StyledContentContainer = styled(View)(() => ({
46
46
  flexGrow: 2,
47
47
  }));
48
48
 
49
- const StyledChildrenContainer = styled(View)(() => ({
49
+ const StyledChildrenContainer = styled(View)(({ theme }) => ({
50
50
  flexDirection: 'column',
51
51
  justifyContent: 'flex-start',
52
52
  alignItems: 'flex-start',
53
+ marginTop: theme.__hd__.list.space.childrenContainerTopMargin,
53
54
  }));
54
55
 
55
56
  const StyledLeadingStatus = styled(View)<{
@@ -244,6 +244,7 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
244
244
  "alignItems": "flex-start",
245
245
  "flexDirection": "column",
246
246
  "justifyContent": "flex-start",
247
+ "marginTop": 8,
247
248
  },
248
249
  undefined,
249
250
  ]
@@ -1,6 +1,6 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
  import React from 'react';
3
- import type { StyleProp, ViewStyle } from 'react-native';
3
+ import { StyleProp, ViewStyle } from 'react-native';
4
4
 
5
5
  import { Circle, InnerCircle, StyledRadio } from './StyledRadio';
6
6
 
@@ -33,6 +33,10 @@ export interface RadioProps {
33
33
  * Idle background color of the Radio.
34
34
  */
35
35
  inactiveIntent?: 'light' | 'dark';
36
+ /**
37
+ * Children to be rendered inside the component.
38
+ */
39
+ children?: ReactNode;
36
40
  }
37
41
 
38
42
  const RadioCircle = ({
@@ -52,6 +56,7 @@ const Radio = ({
52
56
  subText,
53
57
  testID,
54
58
  inactiveIntent = 'light',
59
+ children,
55
60
  }: RadioProps): ReactElement => (
56
61
  <StyledRadio
57
62
  onPress={onPress}
@@ -63,7 +68,9 @@ const Radio = ({
63
68
  testID={testID}
64
69
  themeIntent={inactiveIntent}
65
70
  themeChecked={checked}
66
- />
71
+ >
72
+ {children}
73
+ </StyledRadio>
67
74
  );
68
75
 
69
76
  export default Radio;
@@ -74,7 +74,9 @@ const RadioGroup = <T,>({
74
74
  checked={option.value === value}
75
75
  onPress={() => onPress(option.value)}
76
76
  inactiveIntent={inactiveIntent}
77
- />
77
+ >
78
+ {option.children}
79
+ </Radio>
78
80
  </React.Fragment>
79
81
  ))}
80
82
  </View>
@@ -1,6 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+
1
3
  export type OptionType<T> = {
2
4
  value: T;
3
5
  text: string;
4
6
  subText?: string;
5
7
  key?: string;
8
+ children?: ReactNode;
6
9
  };
@@ -605,6 +605,7 @@ exports[`theme returns correct theme object 1`] = `
605
605
  },
606
606
  },
607
607
  "space": {
608
+ "childrenContainerTopMargin": 8,
608
609
  "leadingStatusMarginRight": 8,
609
610
  "listItemContainerPadding": 16,
610
611
  "prefixContainerMarginRight": 8,
@@ -18,6 +18,7 @@ const getListTheme = (theme: GlobalTheme) => {
18
18
  leadingStatusMarginRight: theme.space.small,
19
19
  prefixContainerMarginRight: theme.space.small,
20
20
  suffixContainerMarginLeft: theme.space.small,
21
+ childrenContainerTopMargin: theme.space.small,
21
22
  };
22
23
 
23
24
  const radii = {
@@ -1,5 +1,5 @@
1
- import type { ReactElement } from 'react';
2
- import type { StyleProp, ViewStyle } from 'react-native';
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
3
  export interface RadioProps {
4
4
  /**
5
5
  * Whether the radio is checked.
@@ -29,6 +29,10 @@ export interface RadioProps {
29
29
  * Idle background color of the Radio.
30
30
  */
31
31
  inactiveIntent?: 'light' | 'dark';
32
+ /**
33
+ * Children to be rendered inside the component.
34
+ */
35
+ children?: ReactNode;
32
36
  }
33
- declare const Radio: ({ text, checked, onPress, style, subText, testID, inactiveIntent, }: RadioProps) => ReactElement;
37
+ declare const Radio: ({ text, checked, onPress, style, subText, testID, inactiveIntent, children, }: RadioProps) => ReactElement;
34
38
  export default Radio;
@@ -1,6 +1,8 @@
1
+ import { ReactNode } from 'react';
1
2
  export declare type OptionType<T> = {
2
3
  value: T;
3
4
  text: string;
4
5
  subText?: string;
5
6
  key?: string;
7
+ children?: ReactNode;
6
8
  };
@@ -16,6 +16,7 @@ declare const getListTheme: (theme: GlobalTheme) => {
16
16
  leadingStatusMarginRight: number;
17
17
  prefixContainerMarginRight: number;
18
18
  suffixContainerMarginLeft: number;
19
+ childrenContainerTopMargin: number;
19
20
  };
20
21
  radii: {
21
22
  item: number;