@utilitywarehouse/hearth-react-native 0.20.0 → 0.22.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.
Files changed (143) hide show
  1. package/.storybook/manager.ts +1 -0
  2. package/.storybook/preview.tsx +1 -0
  3. package/.turbo/turbo-build.log +1 -1
  4. package/.turbo/turbo-lint.log +13 -13
  5. package/CHANGELOG.md +272 -0
  6. package/build/components/BodyText/BodyText.js +12 -5
  7. package/build/components/BodyText/BodyText.props.d.ts +5 -19
  8. package/build/components/Box/Box.js +23 -3
  9. package/build/components/Box/Box.props.d.ts +3 -95
  10. package/build/components/Card/Card.props.d.ts +4 -11
  11. package/build/components/Card/CardRoot.js +0 -1
  12. package/build/components/Checkbox/Checkbox.d.ts +1 -1
  13. package/build/components/Checkbox/Checkbox.js +2 -2
  14. package/build/components/Checkbox/Checkbox.props.d.ts +2 -0
  15. package/build/components/Container/Container.props.d.ts +2 -78
  16. package/build/components/DateInput/DateInput.d.ts +1 -1
  17. package/build/components/DateInput/DateInput.js +2 -2
  18. package/build/components/DateInput/DateInput.props.d.ts +15 -1
  19. package/build/components/DateInput/DateInputSegment.d.ts +1 -1
  20. package/build/components/DateInput/DateInputSegment.js +2 -2
  21. package/build/components/DetailText/DetailText.js +14 -13
  22. package/build/components/DetailText/DetailText.props.d.ts +4 -17
  23. package/build/components/Flex/Flex.js +3 -1
  24. package/build/components/Flex/Flex.props.d.ts +2 -2
  25. package/build/components/Heading/Heading.js +34 -13
  26. package/build/components/Heading/Heading.props.d.ts +4 -18
  27. package/build/components/Modal/Modal.js +1 -1
  28. package/build/components/Radio/Radio.d.ts +1 -1
  29. package/build/components/Radio/Radio.js +2 -2
  30. package/build/components/Radio/Radio.props.d.ts +2 -0
  31. package/build/core/themes.d.ts +188 -8
  32. package/build/core/themes.js +18 -2
  33. package/build/hooks/useStyleProps.js +22 -5
  34. package/build/tokens/color.d.ts +4 -0
  35. package/build/tokens/color.js +2 -0
  36. package/build/tokens/components/dark/modal.d.ts +6 -0
  37. package/build/tokens/components/dark/modal.js +6 -0
  38. package/build/tokens/components/dark/navigation.d.ts +1 -0
  39. package/build/tokens/components/dark/navigation.js +1 -0
  40. package/build/tokens/components/light/modal.d.ts +6 -0
  41. package/build/tokens/components/light/modal.js +6 -0
  42. package/build/tokens/components/light/navigation.d.ts +1 -0
  43. package/build/tokens/components/light/navigation.js +1 -0
  44. package/build/tokens/components/light/skeleton.d.ts +1 -1
  45. package/build/tokens/components/light/skeleton.js +1 -1
  46. package/build/tokens/font.d.ts +2 -0
  47. package/build/tokens/font.js +2 -0
  48. package/build/tokens/line-height.d.ts +2 -0
  49. package/build/tokens/line-height.js +2 -0
  50. package/build/tokens/primitive.d.ts +4 -0
  51. package/build/tokens/primitive.js +4 -0
  52. package/build/tokens/semantic-dark.d.ts +1 -0
  53. package/build/tokens/semantic-dark.js +1 -0
  54. package/build/tokens/semantic-light.d.ts +1 -0
  55. package/build/tokens/semantic-light.js +1 -0
  56. package/build/tokens/typography.d.ts +30 -0
  57. package/build/tokens/typography.js +15 -0
  58. package/build/types/index.d.ts +4 -2
  59. package/build/types/index.js +4 -2
  60. package/build/types/semanticColorValues.d.ts +22 -0
  61. package/build/types/semanticColorValues.js +1 -0
  62. package/build/types/utilityProps.d.ts +326 -0
  63. package/build/types/utilityProps.js +1 -0
  64. package/build/types/values.d.ts +4 -3
  65. package/build/utils/coloursAsArray.d.ts +4 -0
  66. package/build/utils/coloursAsArray.js +5 -0
  67. package/build/utils/index.d.ts +1 -1
  68. package/build/utils/index.js +1 -1
  69. package/build/utils/styleUtils.d.ts +26 -2
  70. package/build/utils/styleUtils.js +42 -13
  71. package/build/utils/themeValueHelpers.d.ts +13 -0
  72. package/build/utils/themeValueHelpers.js +29 -0
  73. package/docs/changelog.mdx +74 -2
  74. package/docs/components/AllComponents.web.tsx +23 -24
  75. package/docs/components/NextPrevPage.tsx +2 -2
  76. package/docs/components/UsageWrap.tsx +2 -2
  77. package/docs/introduction.mdx +0 -7
  78. package/package.json +8 -6
  79. package/src/components/BodyText/BodyText.props.ts +5 -19
  80. package/src/components/BodyText/BodyText.stories.tsx +2 -1
  81. package/src/components/BodyText/BodyText.tsx +17 -6
  82. package/src/components/Box/Box.docs.mdx +5 -4
  83. package/src/components/Box/Box.props.ts +3 -231
  84. package/src/components/Box/Box.stories.tsx +2 -2
  85. package/src/components/Box/Box.tsx +38 -9
  86. package/src/components/Button/Button.docs.mdx +46 -1
  87. package/src/components/Card/Card.docs.mdx +1 -1
  88. package/src/components/Card/Card.props.ts +5 -11
  89. package/src/components/Card/Card.stories.tsx +54 -23
  90. package/src/components/Card/CardRoot.tsx +0 -1
  91. package/src/components/Carousel/Carousel.docs.mdx +49 -44
  92. package/src/components/Center/Center.docs.mdx +6 -4
  93. package/src/components/Checkbox/Checkbox.docs.mdx +1 -0
  94. package/src/components/Checkbox/Checkbox.props.ts +2 -0
  95. package/src/components/Checkbox/Checkbox.stories.tsx +26 -0
  96. package/src/components/Checkbox/Checkbox.tsx +2 -0
  97. package/src/components/Container/Container.docs.mdx +13 -8
  98. package/src/components/Container/Container.props.ts +9 -80
  99. package/src/components/Container/Container.stories.tsx +81 -65
  100. package/src/components/DateInput/DateInput.docs.mdx +43 -0
  101. package/src/components/DateInput/DateInput.props.ts +15 -1
  102. package/src/components/DateInput/DateInput.stories.tsx +37 -2
  103. package/src/components/DateInput/DateInput.tsx +6 -0
  104. package/src/components/DateInput/DateInputSegment.tsx +2 -0
  105. package/src/components/DetailText/DetailText.props.ts +4 -17
  106. package/src/components/DetailText/DetailText.stories.tsx +2 -3
  107. package/src/components/DetailText/DetailText.tsx +16 -17
  108. package/src/components/Flex/Flex.props.ts +2 -2
  109. package/src/components/Flex/Flex.stories.tsx +1 -1
  110. package/src/components/Flex/Flex.tsx +4 -1
  111. package/src/components/Grid/Grid.docs.mdx +53 -49
  112. package/src/components/Heading/Heading.props.ts +4 -18
  113. package/src/components/Heading/Heading.stories.tsx +2 -1
  114. package/src/components/Heading/Heading.tsx +40 -18
  115. package/src/components/Modal/Modal.tsx +1 -1
  116. package/src/components/Radio/Radio.docs.mdx +1 -0
  117. package/src/components/Radio/Radio.props.ts +2 -0
  118. package/src/components/Radio/Radio.stories.tsx +22 -0
  119. package/src/components/Radio/Radio.tsx +2 -0
  120. package/src/components/Radio/RadioTile.figma.tsx +4 -0
  121. package/src/components/Toast/ToastItem.figma.tsx +1 -8
  122. package/src/core/themes.ts +19 -2
  123. package/src/hooks/useStyleProps.ts +40 -5
  124. package/src/tokens/color.ts +2 -0
  125. package/src/tokens/components/dark/modal.ts +6 -0
  126. package/src/tokens/components/dark/navigation.ts +1 -0
  127. package/src/tokens/components/light/modal.ts +6 -0
  128. package/src/tokens/components/light/navigation.ts +1 -0
  129. package/src/tokens/components/light/skeleton.ts +1 -1
  130. package/src/tokens/font.ts +2 -0
  131. package/src/tokens/line-height.ts +2 -0
  132. package/src/tokens/primitive.ts +4 -0
  133. package/src/tokens/semantic-dark.ts +1 -0
  134. package/src/tokens/semantic-light.ts +1 -0
  135. package/src/tokens/typography.ts +15 -0
  136. package/src/types/index.ts +4 -2
  137. package/src/types/semanticColorValues.ts +26 -0
  138. package/src/types/utilityProps.ts +410 -0
  139. package/src/types/values.ts +4 -7
  140. package/src/utils/coloursAsArray.ts +6 -0
  141. package/src/utils/index.ts +8 -1
  142. package/src/utils/styleUtils.ts +45 -14
  143. package/src/utils/themeValueHelpers.ts +38 -0
@@ -1,76 +1,6 @@
1
1
  import type { ViewProps } from 'react-native';
2
- import { SpaceValue, SpacingValues } from '../../types';
3
- interface ContainerProps extends ViewProps {
4
- /**
5
- * The padding of the container.
6
- */
7
- padding?: SpaceValue;
8
- /**
9
- * The horizontal padding of the container.
10
- */
11
- paddingHorizontal?: SpaceValue;
12
- /**
13
- * The vertical padding of the container.
14
- */
15
- paddingVertical?: SpaceValue;
16
- /**
17
- * The top padding of the container.
18
- */
19
- paddingTop?: SpaceValue;
20
- /**
21
- * The bottom padding of the container.
22
- */
23
- paddingBottom?: SpaceValue;
24
- /**
25
- * The left padding of the container.
26
- */
27
- paddingLeft?: SpaceValue;
28
- /**
29
- * The right padding of the container.
30
- */
31
- paddingRight?: SpaceValue;
32
- /**
33
- * The margin of the container.
34
- */
35
- margin?: SpaceValue;
36
- /**
37
- * The horizontal margin of the container.
38
- */
39
- marginHorizontal?: SpaceValue;
40
- /**
41
- * The vertical margin of the container.
42
- */
43
- marginVertical?: SpaceValue;
44
- /**
45
- * The top margin of the container.
46
- */
47
- marginTop?: SpaceValue;
48
- /**
49
- * The bottom margin of the container.
50
- */
51
- marginBottom?: SpaceValue;
52
- /**
53
- * The left margin of the container.
54
- */
55
- marginLeft?: SpaceValue;
56
- /**
57
- * The right margin of the container.
58
- */
59
- marginRight?: SpaceValue;
60
- p?: SpaceValue;
61
- px?: SpaceValue;
62
- py?: SpaceValue;
63
- pt?: SpaceValue;
64
- pb?: SpaceValue;
65
- pl?: SpaceValue;
66
- pr?: SpaceValue;
67
- m?: SpaceValue;
68
- mx?: SpaceValue;
69
- my?: SpaceValue;
70
- mt?: SpaceValue;
71
- mb?: SpaceValue;
72
- ml?: SpaceValue;
73
- mr?: SpaceValue;
2
+ import type { BackgroundColorProps, GapProps, MarginProps, PaddingProps, SpacingValues } from '../../types';
3
+ interface ContainerProps extends ViewProps, MarginProps, PaddingProps, GapProps, BackgroundColorProps {
74
4
  /**
75
5
  * The spacing between child elements (gap).
76
6
  */
@@ -80,11 +10,5 @@ interface ContainerProps extends ViewProps {
80
10
  * @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
81
11
  */
82
12
  space?: SpacingValues;
83
- /**
84
- * The space between child elements.
85
- */
86
- gap?: SpaceValue;
87
- backgroundColor?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
88
- bg?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
89
13
  }
90
14
  export default ContainerProps;
@@ -1,6 +1,6 @@
1
1
  import type { DateInputProps } from './DateInput.props';
2
2
  declare const DateInput: {
3
- ({ label, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, required, hideDay, hideMonth, hideYear, dayPlaceholder, monthPlaceholder, yearPlaceholder, dayValue, monthValue, yearValue, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, inputLabelStyle, inputContainerStyle, inputStyle, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ label, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, required, hideDay, hideMonth, hideYear, dayPlaceholder, monthPlaceholder, yearPlaceholder, dayValue, monthValue, yearValue, dayRef, monthRef, yearRef, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, inputLabelStyle, inputContainerStyle, inputStyle, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default DateInput;
@@ -3,8 +3,8 @@ import { View } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
  import { FormField } from '../FormField';
5
5
  import DateInputSegment from './DateInputSegment';
6
- const DateInput = ({ label, helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled, readonly, required, hideDay = false, hideMonth = false, hideYear = false, dayPlaceholder = 'DD', monthPlaceholder = 'MM', yearPlaceholder = 'YYYY', dayValue, monthValue, yearValue, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, inputLabelStyle, inputContainerStyle, inputStyle, ...props }) => {
7
- return (_jsx(FormField, { label: label, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, required: required, style: styles.wrap, ...props, children: _jsxs(View, { style: styles.container, children: [!hideDay && (_jsx(DateInputSegment, { label: "Day", placeholder: dayPlaceholder, value: dayValue, onChange: onDayChange, onFocus: onDayFocus, onBlur: onDayBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-day", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle })), !hideMonth && (_jsx(DateInputSegment, { label: "Month", placeholder: monthPlaceholder, value: monthValue, onChange: onMonthChange, onFocus: onMonthFocus, onBlur: onMonthBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-month", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle })), !hideYear && (_jsx(DateInputSegment, { label: "Year", placeholder: yearPlaceholder, value: yearValue, onChange: onYearChange, onFocus: onYearFocus, onBlur: onYearBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 4, testID: "date-input-year", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle }))] }) }));
6
+ const DateInput = ({ label, helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled, readonly, required, hideDay = false, hideMonth = false, hideYear = false, dayPlaceholder = 'DD', monthPlaceholder = 'MM', yearPlaceholder = 'YYYY', dayValue, monthValue, yearValue, dayRef, monthRef, yearRef, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, inputLabelStyle, inputContainerStyle, inputStyle, ...props }) => {
7
+ return (_jsx(FormField, { label: label, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, required: required, style: styles.wrap, ...props, children: _jsxs(View, { style: styles.container, children: [!hideDay && (_jsx(DateInputSegment, { label: "Day", placeholder: dayPlaceholder, value: dayValue, inputRef: dayRef, onChange: onDayChange, onFocus: onDayFocus, onBlur: onDayBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-day", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle })), !hideMonth && (_jsx(DateInputSegment, { label: "Month", placeholder: monthPlaceholder, value: monthValue, inputRef: monthRef, onChange: onMonthChange, onFocus: onMonthFocus, onBlur: onMonthBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-month", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle })), !hideYear && (_jsx(DateInputSegment, { label: "Year", placeholder: yearPlaceholder, value: yearValue, inputRef: yearRef, onChange: onYearChange, onFocus: onYearFocus, onBlur: onYearBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 4, testID: "date-input-year", inputContainerStyle: inputContainerStyle, inputStyle: inputStyle, inputLabelStyle: inputLabelStyle }))] }) }));
8
8
  };
9
9
  DateInput.displayName = 'DateInput';
10
10
  const styles = StyleSheet.create(theme => ({
@@ -1,4 +1,5 @@
1
- import type { TextInputProps, ViewProps } from 'react-native';
1
+ import type { Ref } from 'react';
2
+ import type { TextInput, TextInputProps, ViewProps } from 'react-native';
2
3
  import type { FormFieldBaseProps } from '../FormField/FormField.props';
3
4
  import LabelProps from '../Label/Label.props';
4
5
  export interface DateInputProps extends FormFieldBaseProps {
@@ -41,6 +42,18 @@ export interface DateInputProps extends FormFieldBaseProps {
41
42
  * The controlled value for the year segment. Must be used with an `onYearChange` handler.
42
43
  */
43
44
  yearValue?: string;
45
+ /**
46
+ * Ref for the day segment input.
47
+ */
48
+ dayRef?: Ref<TextInput>;
49
+ /**
50
+ * Ref for the month segment input.
51
+ */
52
+ monthRef?: Ref<TextInput>;
53
+ /**
54
+ * Ref for the year segment input.
55
+ */
56
+ yearRef?: Ref<TextInput>;
44
57
  /**
45
58
  * Callback fired when the day value changes.
46
59
  */
@@ -85,6 +98,7 @@ export interface DateInputSegmentProps {
85
98
  label: string;
86
99
  placeholder?: string;
87
100
  value?: string;
101
+ inputRef?: Ref<TextInput>;
88
102
  onChange?: (text: string) => void;
89
103
  onFocus?: DateInputProps['onDayFocus'];
90
104
  onBlur?: DateInputProps['onDayBlur'];
@@ -1,6 +1,6 @@
1
1
  import type { DateInputSegmentProps } from './DateInput.props';
2
2
  declare const DateInputSegment: {
3
- ({ label, placeholder, value, onChange, onFocus, onBlur, disabled, validationStatus, maxLength, readonly, testID, inputContainerStyle, inputStyle, inputLabelStyle, }: DateInputSegmentProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ label, placeholder, value, inputRef, onChange, onFocus, onBlur, disabled, validationStatus, maxLength, readonly, testID, inputContainerStyle, inputStyle, inputLabelStyle, }: DateInputSegmentProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default DateInputSegment;
@@ -3,9 +3,9 @@ import { View } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
  import { BodyText } from '../BodyText';
5
5
  import { Input } from '../Input';
6
- const DateInputSegment = ({ label, placeholder, value, onChange, onFocus, onBlur, disabled, validationStatus, maxLength, readonly, testID, inputContainerStyle, inputStyle, inputLabelStyle, }) => {
6
+ const DateInputSegment = ({ label, placeholder, value, inputRef, onChange, onFocus, onBlur, disabled, validationStatus, maxLength, readonly, testID, inputContainerStyle, inputStyle, inputLabelStyle, }) => {
7
7
  styles.useVariants({ disabled });
8
- return (_jsxs(View, { style: [styles.container, inputContainerStyle], children: [_jsx(BodyText, { size: "md", style: [styles.label, inputLabelStyle], children: label }), _jsx(Input, { value: value, onChangeText: onChange, onFocus: onFocus, onBlur: onBlur, placeholder: disabled ? undefined : placeholder, keyboardType: "number-pad", maxLength: maxLength, testID: testID, accessibilityLabel: label, disabled: disabled, validationStatus: validationStatus, readonly: readonly, style: inputStyle })] }));
8
+ return (_jsxs(View, { style: [styles.container, inputContainerStyle], children: [_jsx(BodyText, { size: "md", style: [styles.label, inputLabelStyle], children: label }), _jsx(Input, { ref: inputRef, value: value, onChangeText: onChange, onFocus: onFocus, onBlur: onBlur, placeholder: disabled ? undefined : placeholder, keyboardType: "number-pad", maxLength: maxLength, testID: testID, accessibilityLabel: label, disabled: disabled, validationStatus: validationStatus, readonly: readonly, style: inputStyle })] }));
9
9
  };
10
10
  DateInputSegment.displayName = 'DateInputSegment';
11
11
  const styles = StyleSheet.create(theme => ({
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
2
  import { Text } from 'react-native';
4
3
  import { StyleSheet } from 'react-native-unistyles';
5
- import { useTheme } from '../../hooks';
6
- import { getFlattenedColorValue } from '../../utils';
4
+ import { useStyleProps } from '../../hooks';
5
+ import { getFlattenedColorValue, resolveThemeValueWithFallback } from '../../utils';
7
6
  const DetailText = ({ children, color, size = 'md', truncated, underline, strikeThrough, italic, textTransform, textAlign, textAlignVertical, textDecorationColor, textDecorationLine, textDecorationStyle, userSelect, inverted, ...props }) => {
8
- const { color: themeColor, colorMode } = useTheme();
7
+ const { computedStyles: utilityStyles, remainingProps } = useStyleProps(props);
9
8
  styles.useVariants({
10
9
  size,
11
10
  underline,
@@ -13,29 +12,23 @@ const DetailText = ({ children, color, size = 'md', truncated, underline, strike
13
12
  italic,
14
13
  inverted,
15
14
  });
16
- const colorValue = useMemo(() => getFlattenedColorValue(color, themeColor),
17
- // eslint-disable-next-line react-hooks/exhaustive-deps
18
- [color, colorMode]);
19
- const decorationColor = useMemo(() => getFlattenedColorValue(textDecorationColor, themeColor),
20
- // eslint-disable-next-line react-hooks/exhaustive-deps
21
- [textDecorationColor, colorMode]);
22
- return (_jsx(Text, { ...props, ...(truncated
15
+ return (_jsx(Text, { ...remainingProps, ...(truncated
23
16
  ? {
24
17
  numberOfLines: 1,
25
18
  ellipsizeMode: 'tail',
26
19
  }
27
20
  : {}), style: [
28
21
  styles.text,
22
+ utilityStyles,
29
23
  {
30
- ...(colorValue && { color: colorValue }),
31
24
  ...(textTransform && { textTransform }),
32
25
  ...(textAlign && { textAlign }),
33
- ...(decorationColor && { textDecorationColor: decorationColor }),
34
26
  ...(textDecorationLine && { textDecorationLine }),
35
27
  ...(textDecorationStyle && { textDecorationStyle }),
36
28
  ...(userSelect && { userSelect }),
37
29
  ...(textAlignVertical && { textAlignVertical }),
38
30
  },
31
+ styles.getColours(color, textDecorationColor),
39
32
  props.style,
40
33
  ], children: children }));
41
34
  };
@@ -111,5 +104,13 @@ const styles = StyleSheet.create(theme => ({
111
104
  },
112
105
  },
113
106
  },
107
+ getColours: (color, textDecorationColor) => ({
108
+ ...(color
109
+ ? { color: resolveThemeValueWithFallback(color, theme.helpers.semanticColor.text, theme.color) }
110
+ : {}),
111
+ ...(textDecorationColor
112
+ ? { textDecorationColor: getFlattenedColorValue(textDecorationColor, theme.color) }
113
+ : {}),
114
+ }),
114
115
  }));
115
116
  export default DetailText;
@@ -1,19 +1,6 @@
1
- import type { TextProps as RNTextProps, TextStyle } from 'react-native';
2
- import type { ColorValue } from '../../types';
3
- interface TextProps extends RNTextProps {
1
+ import type { CommonTextProps } from '../../types';
2
+ interface DetailTextProps extends CommonTextProps {
3
+ /** Text size variant. */
4
4
  size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
5
- strikeThrough?: boolean;
6
- underline?: boolean;
7
- truncated?: boolean;
8
- italic?: boolean;
9
- color?: ColorValue;
10
- textTransform?: TextStyle['textTransform'];
11
- textAlign?: TextStyle['textAlign'];
12
- textAlignVertical?: TextStyle['textAlignVertical'];
13
- textDecorationLine?: TextStyle['textDecorationLine'];
14
- textDecorationStyle?: TextStyle['textDecorationStyle'];
15
- textDecorationColor?: ColorValue;
16
- userSelect?: TextStyle['userSelect'];
17
- inverted?: boolean;
18
5
  }
19
- export default TextProps;
6
+ export default DetailTextProps;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
+ import { useStyleProps } from '../../hooks';
4
5
  const Flex = ({ style, children, direction = 'column', align = 'flex-start', justify = 'flex-start', wrap = 'nowrap', spacing = 'md', space, ...rest }) => {
5
6
  const propStyle = {
6
7
  flexDirection: direction,
@@ -8,8 +9,9 @@ const Flex = ({ style, children, direction = 'column', align = 'flex-start', jus
8
9
  justifyContent: justify,
9
10
  flexWrap: wrap,
10
11
  };
12
+ const { computedStyles, remainingProps } = useStyleProps(rest);
11
13
  styles.useVariants({ spacing: space ?? spacing });
12
- return (_jsx(View, { style: [propStyle, styles.flex, style], ...rest, children: children }));
14
+ return (_jsx(View, { style: [propStyle, styles.flex, computedStyles, style], ...remainingProps, children: children }));
13
15
  };
14
16
  Flex.displayName = 'Flex';
15
17
  const styles = StyleSheet.create(theme => ({
@@ -1,6 +1,6 @@
1
1
  import type { FlexAlignType, ViewProps, ViewStyle } from 'react-native';
2
- import { SpacingValues } from '../../types';
3
- interface FlexProps extends ViewProps {
2
+ import { FlexLayoutProps, GapProps, SpacingValues } from '../../types';
3
+ interface FlexProps extends ViewProps, FlexLayoutProps, GapProps {
4
4
  direction?: ViewStyle['flexDirection'];
5
5
  align?: FlexAlignType;
6
6
  justify?: ViewStyle['justifyContent'];
@@ -1,40 +1,34 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
2
  import { Text } from 'react-native';
4
3
  import { StyleSheet } from 'react-native-unistyles';
5
- import { useTheme } from '../../hooks';
6
- import { getFlattenedColorValue } from '../../utils';
4
+ import { useStyleProps } from '../../hooks';
5
+ import { getFlattenedColorValue, resolveThemeValueWithFallback } from '../../utils';
7
6
  const Heading = ({ children, color, size = 'lg', truncated, underline, strikeThrough, textTransform, textAlign, textAlignVertical, textDecorationColor, textDecorationLine, textDecorationStyle, userSelect, inverted, ...props }) => {
7
+ // Extract margin utility props from remaining props
8
+ const { computedStyles: utilityStyles, remainingProps } = useStyleProps(props);
8
9
  styles.useVariants({
9
10
  size,
10
11
  underline,
11
12
  strikeThrough,
12
13
  inverted,
13
14
  });
14
- const { color: themeColor, colorMode } = useTheme();
15
- const colorValue = useMemo(() => getFlattenedColorValue(color, themeColor),
16
- // eslint-disable-next-line react-hooks/exhaustive-deps
17
- [color, colorMode]);
18
- const decorationColor = useMemo(() => getFlattenedColorValue(textDecorationColor, themeColor),
19
- // eslint-disable-next-line react-hooks/exhaustive-deps
20
- [textDecorationColor, colorMode]);
21
- return (_jsx(Text, { ...props, ...(truncated
15
+ return (_jsx(Text, { ...remainingProps, ...(truncated
22
16
  ? {
23
17
  numberOfLines: 1,
24
18
  ellipsizeMode: 'tail',
25
19
  }
26
20
  : {}), style: [
27
21
  styles.text,
22
+ utilityStyles,
28
23
  {
29
- ...(colorValue ? { color: colorValue } : {}),
30
24
  ...(textTransform ? { textTransform } : {}),
31
25
  ...(textAlign ? { textAlign } : {}),
32
26
  ...(textAlignVertical ? { textAlignVertical } : {}),
33
- ...(decorationColor && { textDecorationColor: decorationColor }),
34
27
  ...(textDecorationLine && { textDecorationLine }),
35
28
  ...(textDecorationStyle && { textDecorationStyle }),
36
29
  ...(userSelect && { userSelect }),
37
30
  },
31
+ styles.getColours(color, textDecorationColor),
38
32
  props.style,
39
33
  ], children: children }));
40
34
  };
@@ -115,6 +109,23 @@ const styles = StyleSheet.create(theme => ({
115
109
  lg: theme.typography.desktop.heading.xl.lineHeight,
116
110
  },
117
111
  },
112
+ '2xl': {
113
+ fontSize: {
114
+ base: theme.typography.mobile.heading['2xl'].fontSize,
115
+ md: theme.typography.tablet.heading['2xl'].fontSize,
116
+ lg: theme.typography.desktop.heading['2xl'].fontSize,
117
+ },
118
+ fontWeight: {
119
+ base: theme.typography.mobile.heading['2xl'].fontWeight,
120
+ md: theme.typography.tablet.heading['2xl'].fontWeight,
121
+ lg: theme.typography.desktop.heading['2xl'].fontWeight,
122
+ },
123
+ lineHeight: {
124
+ base: theme.typography.mobile.heading['2xl'].lineHeight,
125
+ md: theme.typography.tablet.heading['2xl'].lineHeight,
126
+ lg: theme.typography.desktop.heading['2xl'].lineHeight,
127
+ },
128
+ },
118
129
  },
119
130
  underline: {
120
131
  true: {
@@ -133,5 +144,15 @@ const styles = StyleSheet.create(theme => ({
133
144
  },
134
145
  },
135
146
  },
147
+ getColours: (color, textDecorationColor) => ({
148
+ ...(color
149
+ ? {
150
+ color: resolveThemeValueWithFallback(color, theme.helpers.semanticColor.text, theme.color),
151
+ }
152
+ : {}),
153
+ ...(textDecorationColor
154
+ ? { textDecorationColor: getFlattenedColorValue(textDecorationColor, theme.color) }
155
+ : {}),
156
+ }),
136
157
  }));
137
158
  export default Heading;
@@ -1,20 +1,6 @@
1
- import type { Ref } from 'react';
2
- import type { Text, TextProps, TextStyle } from 'react-native';
3
- import type { ColorValue } from '../../types';
4
- interface HeadingProps extends TextProps {
5
- size?: 'sm' | 'md' | 'lg' | 'xl';
6
- strikeThrough?: boolean;
7
- underline?: boolean;
8
- truncated?: boolean;
9
- color?: ColorValue;
10
- textTransform?: TextStyle['textTransform'];
11
- textAlign?: TextStyle['textAlign'];
12
- textAlignVertical?: TextStyle['textAlignVertical'];
13
- textDecorationLine?: TextStyle['textDecorationLine'];
14
- textDecorationStyle?: TextStyle['textDecorationStyle'];
15
- textDecorationColor?: ColorValue;
16
- userSelect?: TextStyle['userSelect'];
17
- inverted?: boolean;
18
- ref?: Ref<Text>;
1
+ import type { CommonTextProps } from '../../types';
2
+ interface HeadingProps extends CommonTextProps {
3
+ /** Heading size variant. */
4
+ size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
19
5
  }
20
6
  export default HeadingProps;
@@ -107,7 +107,7 @@ const Modal = ({ ref, children, heading, description, showCloseButton = true, pr
107
107
  showHandle: props.showHandle,
108
108
  });
109
109
  const footer = (_jsxs(View, { style: styles.footer, children: [onPressPrimaryButton && primaryButtonText ? (_jsx(Button, { onPress: handlePrimaryButtonPress, text: primaryButtonText, ...primaryButtonProps, variant: primaryButtonProps?.variant ?? 'solid', colorScheme: primaryButtonProps?.colorScheme ?? 'highlight' })) : null, onPressSecondaryButton && secondaryButtonText ? (_jsx(Button, { onPress: handleSecondaryButtonPress, text: secondaryButtonText, ...secondaryButtonProps, variant: secondaryButtonProps?.variant ?? 'outline', colorScheme: secondaryButtonProps?.colorScheme ?? 'functional' })) : null] }));
110
- const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children: loadingHeading })] })) : (_jsxs(View, { style: styles.container, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Modal content' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTextContent, children: [heading && !image ? (_jsx(Heading, { size: "lg", accessible: true, children: heading })) : null, description && !image ? _jsx(BodyText, { accessible: true, children: description }) : null] }), showCloseButton ? (_jsx(UnstyledIconButton, { icon: CloseMediumIcon, onPress: handleCloseButtonPress, accessibilityLabel: "Close modal", ...closeButtonProps })) : null] }), image ? (_jsxs(View, { style: styles.imageContainer, children: [image, _jsxs(View, { style: styles.textContent, children: [heading ? (_jsx(Heading, { size: "lg", textAlign: "center", accessible: true, children: heading })) : null, description ? (_jsx(BodyText, { textAlign: "center", accessible: true, children: description })) : null] })] })) : null, children, !stickyFooter && !noButtons ? footer : null] })) }));
110
+ const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children: loadingHeading })] })) : (_jsxs(View, { style: styles.container, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Modal content' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTextContent, children: [heading && !image ? (_jsx(Heading, { size: "lg", accessible: true, children: heading })) : null, description && !image ? _jsx(BodyText, { accessible: true, children: description }) : null] }), showCloseButton ? (_jsx(UnstyledIconButton, { icon: CloseMediumIcon, onPress: handleCloseButtonPress, accessibilityLabel: "Close modal", ...closeButtonProps })) : null] }), image ? (_jsxs(View, { style: styles.imageContainer, children: [image, _jsxs(View, { style: styles.textContent, children: [heading ? (_jsx(Heading, { size: "lg", textAlign: "center", accessible: true, children: heading })) : null, description ? (_jsx(BodyText, { textAlign: "center", accessible: true, children: description })) : null] })] })) : null, children, (!stickyFooter || inNavModal) && !noButtons ? footer : null] })) }));
111
111
  const renderFooter = useCallback((props) => (_jsx(BottomSheetFooter, { ...props, children: _jsx(View, { style: styles.footerWrap, children: footer }) })), [
112
112
  onPressPrimaryButton,
113
113
  primaryButtonText,
@@ -10,7 +10,7 @@ declare const RadioIcon: import("react").ForwardRefExoticComponent<import("react
10
10
  }>;
11
11
  declare const RadioLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("../Label/Label.props").default> & Omit<import("../Label/Label.props").default, "ref">>;
12
12
  declare const Radio: {
13
- ({ children, label, disabled, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type, image, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
13
+ ({ children, label, disabled, helperIcon, helperText, badge, invalidText, validText, validationStatus: validation, showValidationIcon, type, image, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
14
14
  displayName: string;
15
15
  };
16
16
  declare const RadioTile: {
@@ -25,12 +25,12 @@ RadioGroup.displayName = 'RadioGroup';
25
25
  RadioIndicator.displayName = 'RadioIndicator';
26
26
  RadioIcon.displayName = 'RadioIcon';
27
27
  RadioLabel.displayName = 'RadioLabel';
28
- const Radio = ({ children, label, disabled, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type = 'default', image, ...props }) => {
28
+ const Radio = ({ children, label, disabled, helperIcon, helperText, badge, invalidText, validText, validationStatus: validation, showValidationIcon, type = 'default', image, ...props }) => {
29
29
  const { validationStatus: fieldValidationStatus } = useFormFieldContext();
30
30
  const { validationStatus: groupValidationStatus, type: groupType } = useRadioGroupContext();
31
31
  const validationStatus = fieldValidationStatus ?? groupValidationStatus ?? validation ?? 'initial';
32
32
  const radioType = groupType ?? type;
33
- const radioChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(RadioIndicator, { children: _jsx(RadioIcon, {}) }), image ? image : null, _jsxs(RadioTextContent, { children: [!!label && _jsx(RadioLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
33
+ const radioChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(RadioIndicator, { children: _jsx(RadioIcon, {}) }), image ? image : null, _jsxs(RadioTextContent, { children: [!!label && _jsx(RadioLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), badge ? badge : null, validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
34
34
  return (_jsx(RadioComponent, { ...props, isDisabled: disabled, children: radioType === 'tile' ? _jsx(RadioTileRoot, { children: radioChildren }) : radioChildren }));
35
35
  };
36
36
  const RadioTile = ({ type = 'tile', ...props }) => _jsx(Radio, { ...props, type: type });
@@ -12,6 +12,7 @@ interface RadioWithChildrenProps extends RadioBaseProps {
12
12
  label?: never;
13
13
  helperText?: never;
14
14
  helperIcon?: never;
15
+ badge?: never;
15
16
  invalidText?: never;
16
17
  validText?: never;
17
18
  showValidationIcon?: never;
@@ -22,6 +23,7 @@ interface RadioWithoutChildrenProps extends RadioBaseProps {
22
23
  label?: string;
23
24
  helperText?: string;
24
25
  helperIcon?: ComponentType;
26
+ badge?: ReactNode;
25
27
  invalidText?: string;
26
28
  validText?: string;
27
29
  showValidationIcon?: boolean;