@utilitywarehouse/hearth-react-native 0.15.3 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +67 -6
  3. package/CHANGELOG.md +73 -6
  4. package/build/components/Avatar/Avatar.js +0 -2
  5. package/build/components/Banner/Banner.d.ts +1 -1
  6. package/build/components/Banner/Banner.js +3 -1
  7. package/build/components/Carousel/Carousel.js +1 -1
  8. package/build/components/Checkbox/CheckboxGroup.d.ts +1 -1
  9. package/build/components/Checkbox/CheckboxGroup.js +2 -2
  10. package/build/components/Checkbox/CheckboxGroup.props.d.ts +2 -1
  11. package/build/components/CurrencyInput/CurrencyInput.d.ts +1 -1
  12. package/build/components/CurrencyInput/CurrencyInput.js +2 -6
  13. package/build/components/CurrencyInput/CurrencyInput.props.d.ts +6 -0
  14. package/build/components/DateInput/DateInput.js +1 -0
  15. package/build/components/DateInput/DateInputSegment.js +2 -3
  16. package/build/components/DatePicker/DatePicker.js +8 -4
  17. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +0 -1
  18. package/build/components/DatePicker/DatePickerHeader/index.js +1 -1
  19. package/build/components/DatePicker/index.d.ts +1 -0
  20. package/build/components/DatePicker/polyfill.js +3 -3
  21. package/build/components/DatePicker/time-picker/wheel-web.js +1 -3
  22. package/build/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  23. package/build/components/DatePickerInput/DatePickerInput.js +3 -4
  24. package/build/components/DatePickerInput/DatePickerInput.props.d.ts +6 -0
  25. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  26. package/build/components/DescriptionList/DescriptionList.js +2 -2
  27. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -0
  28. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  29. package/build/components/DescriptionList/DescriptionListItem.js +3 -2
  30. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +1 -0
  31. package/build/components/FormField/FormField.context.d.ts +8 -2
  32. package/build/components/FormField/FormField.d.ts +1 -1
  33. package/build/components/FormField/FormField.js +24 -4
  34. package/build/components/FormField/FormField.props.d.ts +2 -0
  35. package/build/components/FormField/FormFieldLabel.d.ts +1 -1
  36. package/build/components/FormField/FormFieldLabel.js +3 -3
  37. package/build/components/FormField/FormFieldValid.js +2 -2
  38. package/build/components/Input/Input.js +48 -10
  39. package/build/components/Input/Input.props.d.ts +7 -1
  40. package/build/components/Label/Label.d.ts +1 -1
  41. package/build/components/Label/Label.js +5 -1
  42. package/build/components/Label/Label.props.d.ts +3 -2
  43. package/build/components/Radio/RadioGroup.d.ts +1 -1
  44. package/build/components/Radio/RadioGroup.js +2 -2
  45. package/build/components/Radio/RadioGroup.props.d.ts +1 -0
  46. package/build/components/RadioCard/RadioCard.d.ts +1 -1
  47. package/build/components/RadioCard/RadioCard.js +2 -2
  48. package/build/components/RadioCard/RadioCard.props.d.ts +1 -0
  49. package/build/components/Select/Select.d.ts +1 -1
  50. package/build/components/Select/Select.js +2 -2
  51. package/build/components/Select/Select.props.d.ts +10 -0
  52. package/build/components/Switch/Switch.js +1 -1
  53. package/build/components/Tabs/Tabs.d.ts +1 -1
  54. package/build/components/Tabs/Tabs.js +1 -1
  55. package/build/components/Textarea/Textarea.d.ts +1 -1
  56. package/build/components/Textarea/Textarea.js +46 -6
  57. package/build/components/Textarea/Textarea.props.d.ts +8 -0
  58. package/build/components/Toast/ToastItem.js +1 -1
  59. package/build/components/ToggleButton/ToggleButtonIcon.js +1 -1
  60. package/build/components/ToggleButton/ToggleButtonRoot.js +0 -2
  61. package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +1 -1
  62. package/build/components/VerificationInput/VerificationInput.d.ts +1 -1
  63. package/build/components/VerificationInput/VerificationInput.js +2 -2
  64. package/build/components/VerificationInput/VerificationInput.props.d.ts +4 -0
  65. package/build/utils/coloursAsArray.js +1 -1
  66. package/docs/components/AllComponents.web.tsx +19 -20
  67. package/docs/components/UsageWrap.tsx +17 -20
  68. package/docs/theme-tokens.mdx +390 -2
  69. package/eslint.config.js +5 -1
  70. package/package.json +12 -12
  71. package/src/components/Accordion/Accordion.figma.tsx +15 -17
  72. package/src/components/Accordion/AccordionItem.figma.tsx +27 -0
  73. package/src/components/Avatar/Avatar.figma.tsx +11 -21
  74. package/src/components/Avatar/Avatar.tsx +0 -2
  75. package/src/components/Badge/Badge.figma.tsx +45 -54
  76. package/src/components/Banner/Banner.figma.tsx +21 -13
  77. package/src/components/Banner/Banner.stories.tsx +4 -4
  78. package/src/components/Banner/Banner.tsx +2 -1
  79. package/src/components/Button/Button.figma.tsx +118 -46
  80. package/src/components/Card/Card.figma.tsx +27 -43
  81. package/src/components/Card/Card.stories.tsx +1 -1
  82. package/src/components/Carousel/Carousel.figma.tsx +20 -17
  83. package/src/components/Carousel/Carousel.tsx +1 -1
  84. package/src/components/Checkbox/Checkbox.docs.mdx +32 -31
  85. package/src/components/Checkbox/Checkbox.figma.tsx +15 -18
  86. package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
  87. package/src/components/Checkbox/CheckboxGroup.figma.tsx +48 -15
  88. package/src/components/Checkbox/CheckboxGroup.props.ts +2 -1
  89. package/src/components/Checkbox/CheckboxGroup.tsx +6 -1
  90. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +24 -27
  91. package/src/components/CurrencyInput/CurrencyInput.docs.mdx +52 -9
  92. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +65 -49
  93. package/src/components/CurrencyInput/CurrencyInput.props.ts +6 -0
  94. package/src/components/CurrencyInput/CurrencyInput.stories.tsx +30 -1
  95. package/src/components/CurrencyInput/CurrencyInput.tsx +16 -8
  96. package/src/components/DateInput/DateInput.figma.tsx +58 -45
  97. package/src/components/DateInput/DateInput.tsx +1 -0
  98. package/src/components/DateInput/DateInputSegment.tsx +2 -3
  99. package/src/components/DatePicker/DatePicker.figma.tsx +47 -0
  100. package/src/components/DatePicker/DatePicker.tsx +8 -4
  101. package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +0 -2
  102. package/src/components/DatePicker/DatePickerHeader/index.tsx +2 -2
  103. package/src/components/DatePicker/index.ts +2 -0
  104. package/src/components/DatePicker/polyfill.ts +3 -3
  105. package/src/components/DatePicker/time-picker/wheel-web.tsx +0 -1
  106. package/src/components/DatePickerInput/DatePickerInput.docs.mdx +22 -0
  107. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +18 -46
  108. package/src/components/DatePickerInput/DatePickerInput.props.ts +6 -0
  109. package/src/components/DatePickerInput/DatePickerInput.tsx +17 -5
  110. package/src/components/DescriptionList/DescriptionList.docs.mdx +16 -14
  111. package/src/components/DescriptionList/DescriptionList.figma.tsx +41 -17
  112. package/src/components/DescriptionList/DescriptionList.props.ts +1 -0
  113. package/src/components/DescriptionList/DescriptionList.stories.tsx +24 -0
  114. package/src/components/DescriptionList/DescriptionList.tsx +2 -0
  115. package/src/components/DescriptionList/DescriptionListItem.figma.tsx +42 -0
  116. package/src/components/DescriptionList/DescriptionListItem.props.ts +1 -0
  117. package/src/components/DescriptionList/DescriptionListItem.tsx +7 -0
  118. package/src/components/Divider/Divider.figma.tsx +10 -23
  119. package/src/components/FormField/FormField.context.ts +6 -1
  120. package/src/components/FormField/FormField.docs.mdx +30 -30
  121. package/src/components/FormField/FormField.props.ts +2 -0
  122. package/src/components/FormField/FormField.stories.tsx +8 -2
  123. package/src/components/FormField/FormField.tsx +38 -4
  124. package/src/components/FormField/FormFieldLabel.tsx +7 -3
  125. package/src/components/FormField/FormFieldValid.tsx +2 -2
  126. package/src/components/Input/Input.docs.mdx +67 -22
  127. package/src/components/Input/Input.props.ts +7 -1
  128. package/src/components/Input/Input.stories.tsx +9 -1
  129. package/src/components/Input/Input.tsx +124 -60
  130. package/src/components/Label/Label.props.ts +3 -2
  131. package/src/components/Label/Label.tsx +11 -1
  132. package/src/components/List/List.stories.tsx +1 -4
  133. package/src/components/Radio/Radio.docs.mdx +31 -30
  134. package/src/components/Radio/Radio.stories.tsx +1 -1
  135. package/src/components/Radio/RadioGroup.props.ts +1 -0
  136. package/src/components/Radio/RadioGroup.stories.tsx +6 -0
  137. package/src/components/Radio/RadioGroup.tsx +6 -1
  138. package/src/components/RadioCard/RadioCard.docs.mdx +31 -30
  139. package/src/components/RadioCard/RadioCard.props.ts +1 -0
  140. package/src/components/RadioCard/RadioCard.tsx +8 -2
  141. package/src/components/Select/Select.props.ts +10 -0
  142. package/src/components/Select/Select.tsx +3 -2
  143. package/src/components/Switch/Switch.tsx +1 -1
  144. package/src/components/Tabs/Tabs.tsx +0 -1
  145. package/src/components/Textarea/Textarea.docs.mdx +65 -17
  146. package/src/components/Textarea/Textarea.props.ts +8 -0
  147. package/src/components/Textarea/Textarea.stories.tsx +23 -2
  148. package/src/components/Textarea/Textarea.tsx +87 -19
  149. package/src/components/ThemedImage/ThemedImage.stories.tsx +14 -14
  150. package/src/components/Toast/ToastItem.tsx +1 -1
  151. package/src/components/ToggleButton/ToggleButtonIcon.tsx +1 -1
  152. package/src/components/ToggleButton/ToggleButtonRoot.tsx +0 -2
  153. package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +1 -1
  154. package/src/components/VerificationInput/VerificationInput.docs.mdx +1 -0
  155. package/src/components/VerificationInput/VerificationInput.props.ts +4 -1
  156. package/src/components/VerificationInput/VerificationInput.tsx +2 -0
  157. package/src/utils/coloursAsArray.ts +1 -1
  158. package/tsconfig.eslint.json +13 -0
  159. package/src/components/Accordion/AccordionItemRoot.figma.tsx +0 -47
  160. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +0 -34
@@ -1,60 +1,72 @@
1
- import React from "react"
2
- import DateInput from "./DateInput"
3
- import figma from "@figma/code-connect"
4
-
5
- /**
6
- * -- This file was auto-generated by Code Connect --
7
- * `props` includes a mapping from your code props to Figma properties.
8
- * You should check this is correct, and update the `example` function
9
- * to return the code example you'd like to see in Figma
10
- */
1
+ import figma from '@figma/code-connect';
2
+ import { DateInput } from '../';
11
3
 
12
4
  figma.connect(
13
5
  DateInput,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2277%3A14708",
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2277%3A14708',
15
7
  {
16
8
  props: {
17
- // These props were automatically mapped based on your linked code:
18
- hideDay: figma.boolean("Day?"),
19
- hideMonth: figma.boolean("Month?"),
20
- monthPlaceholder: figma.string("Month value"),
21
- yearPlaceholder: figma.string("Year value"),
22
- dayValue: figma.string("Day value"),
23
- monthValue: figma.string("Month value"),
24
- yearValue: figma.string("Year value"),
25
- disabled: figma.enum("State", {
9
+ hideDay: figma.boolean('Day?', {
10
+ true: false,
11
+ false: true,
12
+ }),
13
+ hideMonth: figma.boolean('Month?', {
14
+ true: false,
15
+ false: true,
16
+ }),
17
+ // hideYear: figma.boolean('Year?'),
18
+ monthPlaceholder: figma.enum('Value type', {
19
+ Placeholder: figma.boolean('Month?', {
20
+ true: figma.string('Month value'),
21
+ }),
22
+ }),
23
+ yearPlaceholder: figma.enum('Value type', {
24
+ Placeholder: figma.string('Year value'),
25
+ }),
26
+ dayPlaceholder: figma.enum('Value type', {
27
+ Placeholder: figma.boolean('Day?', {
28
+ true: figma.string('Day value'),
29
+ }),
30
+ }),
31
+ dayValue: figma.enum('Value type', {
32
+ Filled: figma.boolean('Day?', {
33
+ true: figma.string('Day value'),
34
+ }),
35
+ }),
36
+ monthValue: figma.enum('Value type', {
37
+ Filled: figma.boolean('Month?', {
38
+ true: figma.string('Month value'),
39
+ }),
40
+ }),
41
+ yearValue: figma.enum('Value type', {
42
+ Filled: figma.string('Year value'),
43
+ }),
44
+ disabled: figma.enum('State', {
26
45
  Disabled: true,
27
46
  }),
28
- readonly: figma.enum("State", {
29
- "Read-only": true,
47
+ readonly: figma.enum('State', {
48
+ 'Read-only': true,
49
+ }),
50
+ label: figma.string('Label'),
51
+ helperText: figma.string('Helper text'),
52
+ validText: figma.enum('State', {
53
+ Valid: figma.string('Validation'),
54
+ }),
55
+ invalidText: figma.enum('State', {
56
+ Invalid: figma.string('Validation'),
57
+ }),
58
+ validationStatus: figma.enum('State', {
59
+ Default: undefined,
60
+ Valid: 'valid',
61
+ Invalid: 'invalid',
30
62
  }),
31
- label: figma.string("Label"),
32
- helperText: figma.string("Helper text"),
33
- validText: figma.string("Validation"),
34
- invalidText: figma.string("Helper text"),
35
63
  // No matching props could be found for these Figma properties:
36
- // "helperText": figma.boolean('Helper text?'),
37
- // "label": figma.string('Label'),
38
- // "validation": figma.string('Validation'),
39
- // "helperText": figma.string('Helper text'),
40
- // "dayValue": figma.string('Day value'),
41
- // "day": figma.boolean('Day?'),
42
- // "month": figma.boolean('Month?'),
43
- // "monthValue": figma.string('Month value'),
44
- // "yearValue": figma.string('Year value'),
45
- // "optional": figma.boolean('Optional?'),
46
- // "valueType": figma.enum('Value type', {
47
- // "Empty": "empty",
48
- // "Placeholder": "placeholder",
49
- // "Filled": "filled"
50
- // }),
51
- // "focus": figma.boolean('Focus?'),
52
64
  // "labelVariant": figma.enum('Label variant', {
53
65
  // "Body": "body",
54
66
  // "Heading": "heading"
55
67
  // })
56
68
  },
57
- example: (props) => (
69
+ example: props => (
58
70
  <DateInput
59
71
  hideDay={props.hideDay}
60
72
  hideMonth={props.hideMonth}
@@ -69,7 +81,8 @@ figma.connect(
69
81
  helperText={props.helperText}
70
82
  validText={props.validText}
71
83
  invalidText={props.invalidText}
84
+ validationStatus={props.validationStatus}
72
85
  />
73
86
  ),
74
- },
75
- )
87
+ }
88
+ );
@@ -111,6 +111,7 @@ const styles = StyleSheet.create(theme => ({
111
111
  container: {
112
112
  flexDirection: 'row',
113
113
  gap: theme.components.input.date.gap,
114
+ // alignItems: 'stretch',
114
115
  },
115
116
  }));
116
117
 
@@ -63,7 +63,7 @@ const styles = StyleSheet.create(theme => ({
63
63
  container: {
64
64
  flex: 1,
65
65
  gap: theme.components.input.gap,
66
- maxWidth: 96,
66
+ // maxWidth: 96,
67
67
  },
68
68
  label: {
69
69
  variants: {
@@ -75,8 +75,7 @@ const styles = StyleSheet.create(theme => ({
75
75
  },
76
76
  },
77
77
  input: {
78
- flex: 1,
79
- maxWidth: 96,
78
+ // maxWidth: 96,
80
79
  },
81
80
  }));
82
81
 
@@ -0,0 +1,47 @@
1
+ import figma from '@figma/code-connect';
2
+ import { DatePicker } from '../';
3
+
4
+ const selectedDate = '';
5
+ const handlePickerChange = () => {
6
+ // Placeholder for onChange handler
7
+ };
8
+ const handleCancel = () => {
9
+ // Placeholder for onCancel handler
10
+ };
11
+
12
+ const pickerRef = () => null;
13
+
14
+ figma.connect(
15
+ DatePicker,
16
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3797-6383&m=dev',
17
+ {
18
+ props: {
19
+ // "grabber": figma.boolean('Grabber?'),
20
+ header: figma.boolean('Header?', {
21
+ true: false,
22
+ false: true,
23
+ }),
24
+ footer: figma.boolean('Footer?', {
25
+ true: false,
26
+ false: true,
27
+ }),
28
+ initialView: figma.enum('Type', {
29
+ Day: undefined,
30
+ Month: 'month',
31
+ Year: 'year',
32
+ }),
33
+ },
34
+ example: props => (
35
+ <DatePicker
36
+ ref={pickerRef}
37
+ mode="single"
38
+ date={selectedDate}
39
+ hideFooter={props.footer}
40
+ hideHeader={props.header}
41
+ initialView={props.initialView}
42
+ onChange={handlePickerChange}
43
+ onCancel={handleCancel}
44
+ />
45
+ ),
46
+ }
47
+ );
@@ -52,6 +52,7 @@ export interface DatePickerMultipleProps extends DatePickerBaseProps {
52
52
  const DateTimePicker = (
53
53
  props: DatePickerSingleProps | DatePickerRangeProps | DatePickerMultipleProps
54
54
  ) => {
55
+ // eslint-disable-next-line @typescript-eslint/prefer-as-const
55
56
  const numerals: 'latn' = 'latn';
56
57
  const {
57
58
  mode = 'single',
@@ -216,26 +217,29 @@ const DateTimePicker = (
216
217
  ...prevState,
217
218
  currentYear: action.payload,
218
219
  };
219
- case CalendarActionKind.CHANGE_SELECTED_DATE:
220
+ case CalendarActionKind.CHANGE_SELECTED_DATE: {
220
221
  const { date: selectedDate } = action.payload;
221
222
  return {
222
223
  ...prevState,
223
224
  date: selectedDate,
224
225
  currentDate: selectedDate,
225
226
  };
226
- case CalendarActionKind.CHANGE_SELECTED_RANGE:
227
+ }
228
+ case CalendarActionKind.CHANGE_SELECTED_RANGE: {
227
229
  const { startDate: start, endDate: end } = action.payload;
228
230
  return {
229
231
  ...prevState,
230
232
  startDate: start,
231
233
  endDate: end,
232
234
  };
233
- case CalendarActionKind.CHANGE_SELECTED_MULTIPLE:
235
+ }
236
+ case CalendarActionKind.CHANGE_SELECTED_MULTIPLE: {
234
237
  const { dates: selectedDates } = action.payload;
235
238
  return {
236
239
  ...prevState,
237
240
  dates: selectedDates,
238
241
  };
242
+ }
239
243
  case CalendarActionKind.RESET_STATE:
240
244
  return action.payload;
241
245
  default:
@@ -363,7 +367,7 @@ const DateTimePicker = (
363
367
  });
364
368
  } else if (mode === 'range') {
365
369
  // set time to 00:00:00
366
- let start = removeTime(stateRef.current.startDate, timeZone);
370
+ const start = removeTime(stateRef.current.startDate, timeZone);
367
371
  let end = removeTime(stateRef.current.endDate, timeZone);
368
372
  const selected = removeTime(selectedDate, timeZone);
369
373
  let isStart: boolean = true;
@@ -6,5 +6,3 @@ export type HeaderProps = {
6
6
  NextIcon?: React.ReactNode;
7
7
  navigationPosition?: NavigationPosition;
8
8
  };
9
-
10
- export type NavigationProps = {};
@@ -1,12 +1,12 @@
1
1
  import { memo } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
- import type { HeaderProps, NavigationProps } from './DatePickerHeader.props';
4
+ import type { HeaderProps } from './DatePickerHeader.props';
5
5
  import NextButton from './DatePickerNextButton';
6
6
  import PrevButton from './DatePickerPrevButton';
7
7
  import Selectors from './DatePickerSelectors';
8
8
 
9
- const NavigationButtons = ({}: NavigationProps) => (
9
+ const NavigationButtons = () => (
10
10
  <View style={styles.navigation}>
11
11
  <PrevButton />
12
12
  <NextButton />
@@ -1,6 +1,8 @@
1
1
  import 'dayjs/locale/en';
2
2
  import './polyfill';
3
3
 
4
+ export type { BottomSheetMethods as DatePickerMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
5
+
4
6
  export type {
5
7
  CalendarDay,
6
8
  CalendarMode,
@@ -1,6 +1,6 @@
1
- // @ts-ignore
1
+ // @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
2
2
  Date.prototype._toLocaleString = Date.prototype.toLocaleString;
3
- // @ts-ignore
3
+ // @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
4
4
  Date.prototype.toLocaleString = function (a, b) {
5
5
  if (b && Object.keys(b).length === 1 && 'timeZone' in b && a === 'en-US') {
6
6
  return Intl.DateTimeFormat('en-us', {
@@ -16,6 +16,6 @@ Date.prototype.toLocaleString = function (a, b) {
16
16
  .format(this)
17
17
  .replace(/(\d{2})\/(\d{2})\/(\d{4}),/g, '$3-$1-$2');
18
18
  }
19
- // @ts-ignore
19
+ // @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
20
20
  return this._toLocaleString(a, b);
21
21
  };
@@ -121,7 +121,6 @@ const WheelWeb = ({ value, setValue = () => {}, items }: WheelProps) => {
121
121
  return (
122
122
  <Animated.View
123
123
  key={`${displayValue?.text}-${index}`}
124
- // eslint-disable-next-line react-native/no-inline-styles
125
124
  style={{
126
125
  position: 'absolute',
127
126
  height: ITEM_HEIGHT - 10,
@@ -78,6 +78,12 @@ When used inside `FormField`, validation, disabled, and required states are inhe
78
78
  | `disabled` | `boolean` | `false` | Disables both typing and the calendar trigger button. |
79
79
  | `readonly` | `boolean` | `false` | Prevents manual typing while keeping the picker available. |
80
80
  | `focused` | `boolean` | `false` | Forces the focused state styling. |
81
+ | `label` | `string` | `-` | The label for the input. When used inside `FormField`, this is inherited from the context. |
82
+ | `labelVariant` | `'heading' \| 'body'` | `'body'` | The variant of the label text. |
83
+ | `helperText` | `string` | `-` | Helper text to display below the input. When used inside `FormField`, this is inherited from the context. |
84
+ | `helperIcon` | `ComponentType` | `-` | Icon to display alongside the helper |
85
+ | `validText` | `string` | `-` | Text to display when validation status is 'valid'. When used inside `FormField`, this is inherited from the context. |
86
+ | `invalidText` | `string` | `-` | Text to display when validation status is 'invalid'. When used inside `FormField`, this is inherited from the context. |
81
87
  | `inBottomSheet` | `boolean` | `false` | Uses `BottomSheetTextInput` when rendering inside a bottom sheet. |
82
88
  | `format` | `string` | `'DD/MM/YYYY'` | Day.js format string used to render selected dates and parse manual input. Leaving it as `'DD/MM/YYYY'` automatically inserts `/` separators and requests a numeric keypad. |
83
89
  | `openButtonLabel` | `string` | `'Open date picker'` | Accessible label read by screen readers for the calendar trigger button. |
@@ -152,6 +158,22 @@ Selection through the calendar always returns a JavaScript `Date` that is reform
152
158
 
153
159
  ## Examples
154
160
 
161
+ ## With Label and Helper Text
162
+
163
+ The `DatePickerInput` component can display a label and helper text by passing the appropriate props.
164
+
165
+ <UsageWrap>
166
+ <BottomSheetModalProvider>
167
+ <Center>
168
+ <DatePickerInput label="Travel date" helperText="Choose a departure day" onClear={() => {}} />
169
+ </Center>
170
+ </BottomSheetModalProvider>
171
+ </UsageWrap>
172
+
173
+ ```tsx
174
+ <DatePickerInput label="Travel date" helperText="Choose a departure day" onClear={() => {}} />
175
+ ```
176
+
155
177
  ### With `FormField`
156
178
 
157
179
  <UsageWrap>
@@ -1,62 +1,34 @@
1
1
  import figma from '@figma/code-connect';
2
- import DatePickerInput from './DatePickerInput';
3
-
4
- /**
5
- * -- This file was auto-generated by Code Connect --
6
- * `props` includes a mapping from your code props to Figma properties.
7
- * You should check this is correct, and update the `example` function
8
- * to return the code example you'd like to see in Figma
9
- */
2
+ import { DatePickerInput } from '../';
10
3
 
11
4
  figma.connect(
12
5
  DatePickerInput,
13
6
  'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3917%3A7057',
14
7
  {
15
8
  props: {
16
- // These props were automatically mapped based on your linked code:
17
9
  disabled: figma.enum('Variant', {
18
10
  Disabled: true,
19
11
  }),
20
- readonly: figma.enum('Variant', {
21
- 'Read-only': true,
12
+ validationStatus: figma.enum('Variant', {
13
+ Default: undefined,
14
+ Valid: 'valid',
15
+ Invalid: 'invalid',
22
16
  }),
23
- focused: figma.boolean('Focus?'),
24
- placeholder: figma.string('Label'),
25
- autoFocus: figma.boolean('Focus?'),
26
- defaultValue: figma.string('Value'),
27
- readOnly: figma.enum('Variant', {
28
- 'Read-only': true,
17
+ readonly: figma.enum('Variant', { Readonly: true }),
18
+ label: figma.string('Label'),
19
+ validText: figma.enum('Variant', {
20
+ Valid: figma.string('Validation'),
29
21
  }),
30
- focusable: figma.boolean('Focus?'),
31
- hasTVPreferredFocus: figma.boolean('Focus?'),
32
- 'aria-disabled': figma.enum('Variant', {
33
- Disabled: true,
22
+ invalidText: figma.enum('Variant', {
23
+ Invalid: figma.string('Validation'),
24
+ }),
25
+ placeholder: figma.enum('Value type', {
26
+ Placeholder: figma.string('Value'),
27
+ }),
28
+ value: figma.enum('Value type', {
29
+ Filled: figma.string('Value'),
34
30
  }),
35
- // No matching props could be found for these Figma properties:
36
- // "helperText": figma.boolean('Helper text?'),
37
- // "label": figma.string('Label'),
38
- // "validation": figma.string('Validation'),
39
- // "helperText": figma.string('Helper text'),
40
- // "value": figma.string('Value'),
41
- // "icon": figma.boolean('Icon?'),
42
- // "calendar": figma.boolean('Calendar?'),
43
- // "valueType": figma.enum('Value type', {
44
- // "Empty": "empty",
45
- // "Placeholder": "placeholder",
46
- // "Filled": "filled"
47
- // })
48
31
  },
49
- example: props => (
50
- <DatePickerInput
51
- disabled={props.disabled}
52
- readonly={props.readonly}
53
- focused={props.focused}
54
- placeholder={props.placeholder}
55
- autoFocus={props.autoFocus}
56
- defaultValue={props.defaultValue}
57
- readOnly={props.readOnly}
58
- focusable={props.focusable}
59
- />
60
- ),
32
+ example: props => <DatePickerInput {...props} />,
61
33
  }
62
34
  );
@@ -7,6 +7,12 @@ export interface DatePickerInputBaseProps {
7
7
  validationStatus?: 'initial' | 'valid' | 'invalid';
8
8
  readonly?: boolean;
9
9
  focused?: boolean;
10
+ label?: string;
11
+ labelVariant?: 'heading' | 'body';
12
+ helperText?: string;
13
+ helperIcon?: React.ComponentType;
14
+ validText?: string;
15
+ invalidText?: string;
10
16
  placeholder?: string;
11
17
  inBottomSheet?: boolean;
12
18
  required?: boolean;
@@ -36,6 +36,13 @@ const DatePickerInput = ({
36
36
  format = DEFAULT_FORMAT,
37
37
  openButtonLabel = 'Open date picker',
38
38
  autoCloseOnSelect = true,
39
+ label,
40
+ labelVariant,
41
+ helperText,
42
+ helperIcon,
43
+ validText,
44
+ invalidText,
45
+ required = true,
39
46
  onChange,
40
47
  onChangeText,
41
48
  onBlur,
@@ -46,7 +53,6 @@ const DatePickerInput = ({
46
53
  ...rest
47
54
  }: DatePickerInputProps) => {
48
55
  const formFieldContext = useFormFieldContext();
49
- const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
50
56
  const isDisabled = formFieldContext?.disabled ?? disabled;
51
57
  const isReadonly = formFieldContext?.readonly ?? readonly;
52
58
 
@@ -161,7 +167,6 @@ const DatePickerInput = ({
161
167
  accessibilityHint: accessibilityHintProp,
162
168
  accessibilityLabel: accessibilityLabelProp,
163
169
  accessible: accessibleProp,
164
- accessibilityRole: accessibilityRoleProp,
165
170
  importantForAccessibility: importantForAccessibilityProp,
166
171
  ...textInputProps
167
172
  } = rest;
@@ -183,10 +188,17 @@ const DatePickerInput = ({
183
188
  return (
184
189
  <>
185
190
  <Input
186
- validationStatus={validationStatusFromContext}
187
- disabled={isDisabled}
188
- readonly={isReadonly}
191
+ validationStatus={validationStatus}
192
+ disabled={disabled}
193
+ readonly={readonly}
189
194
  focused={focused}
195
+ label={label}
196
+ labelVariant={labelVariant}
197
+ helperText={helperText}
198
+ helperIcon={helperIcon}
199
+ validText={validText}
200
+ invalidText={invalidText}
201
+ required={required}
190
202
  style={styles.wrap}
191
203
  accessible={false}
192
204
  >
@@ -58,23 +58,25 @@ import { DescriptionList, DescriptionListItem } from '@utilitywarehouse/hearth-r
58
58
 
59
59
  ### DescriptionList
60
60
 
61
- | Prop | Type | Description | Default |
62
- | ----------------------- | ------------------- | ------------------------------------------------ | ----------- |
63
- | `direction` | `'row' \| 'column'` | Layout orientation | `column` |
64
- | `itemHeadingWidth` | `number` | Override heading column width in row layout | token value |
65
- | `heading` | `string` | Optional overall heading (renders SectionHeader) | - |
66
- | `helperText` | `string` | Supporting text under heading | - |
67
- | `headerTrailingContent` | `ReactNode` | Custom trailing content for heading (e.g. Link) | - |
61
+ | Prop | Type | Default | Description |
62
+ | ----------------------- | ------------------- | ----------- | ------------------------------------------------ |
63
+ | `direction` | `'row' \| 'column'` | `column` | Layout orientation |
64
+ | `itemHeadingWidth` | `number` | token value | Override heading column width in row layout |
65
+ | `heading` | `string` | - | Optional overall heading (renders SectionHeader) |
66
+ | `helperText` | `string` | - | Supporting text under heading |
67
+ | `headerTrailingContent` | `ReactNode` | - | Custom trailing content for heading (e.g. Link) |
68
+ | `invalidText` | `string` | - | Text to show under section header |
68
69
 
69
70
  ### DescriptionListItem
70
71
 
71
- | Prop | Type | Description | Default |
72
- | ----------------- | ----------- | ------------------------------------------------ | ---------- |
73
- | `heading` | `ReactNode` | Heading (label) content | (required) |
74
- | `description` | `ReactNode` | Description (value) content | (required) |
75
- | `headingWidth` | `number` | Per-item heading width override (row layout) | inherits |
76
- | `trailingContent` | `ReactNode` | Optional trailing content (e.g. Link, Button) | - |
77
- | `invalidText` | `string` | Text to show under description for invalid value | - |
72
+ | Prop | Type | Default | Description |
73
+ | ----------------- | ----------- | ---------- | ------------------------------------------------ |
74
+ | `heading` | `ReactNode` | (required) | Heading (label) content |
75
+ | `description` | `ReactNode` | (required) | Description (value) content |
76
+ | `numericValue` | `string` | - | Optional numeric value |
77
+ | `headingWidth` | `number` | inherits | Per-item heading width override (row layout) |
78
+ | `trailingContent` | `ReactNode` | - | Optional trailing content (e.g. Link, Button) |
79
+ | `invalidText` | `string` | - | Text to show under description for invalid value |
78
80
 
79
81
  > Uses `theme.components.descriptionList` tokens for spacing & column width.
80
82
 
@@ -1,23 +1,47 @@
1
- import React from "react"
2
- import DescriptionList from "./DescriptionList"
3
- import figma from "@figma/code-connect"
4
-
5
- /**
6
- * -- This file was auto-generated by Code Connect --
7
- * None of your props could be automatically mapped to Figma properties.
8
- * You should update the `props` object to include a mapping from your
9
- * code props to Figma properties, and update the `example` function to
10
- * return the code example you'd like to see in Figma
11
- */
1
+ import figma from '@figma/code-connect';
2
+ import { DescriptionList } from '../';
12
3
 
13
4
  figma.connect(
14
5
  DescriptionList,
15
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=7247%3A4636",
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=7247%3A4636',
16
7
  {
17
8
  props: {
18
- // No matching props could be found for these Figma properties:
19
- // "sectionHeader": figma.boolean('Section header?')
9
+ sectionHeader: figma.boolean('Section header?', {
10
+ true: figma.nestedProps('Section Header', {
11
+ heading: figma.string('Heading'),
12
+ helperText: figma.boolean('Helper text?', {
13
+ true: figma.string('Helper text'),
14
+ }),
15
+ trailingContent: figma.boolean('Trailing content?', {
16
+ true: figma.nestedProps('Trailing content', {
17
+ headerTrailingContent: figma.instance('Variant'),
18
+ }),
19
+ }),
20
+ invalidText: figma.enum('State', {
21
+ Invalid: figma.nestedProps('Validation Text', {
22
+ invalidText: figma.string('Text'),
23
+ }),
24
+ }),
25
+ }),
26
+ }),
27
+ items: figma.children('Item'),
28
+ direction: figma.nestedProps('Item', {
29
+ direction: figma.enum('Direction', {
30
+ Row: 'row',
31
+ Column: 'column',
32
+ }),
33
+ }),
20
34
  },
21
- example: (props) => <DescriptionList />,
22
- },
23
- )
35
+ example: props => (
36
+ <DescriptionList
37
+ heading={props.sectionHeader?.heading}
38
+ helperText={props.sectionHeader?.helperText}
39
+ direction={props.direction?.direction}
40
+ headerTrailingContent={props.sectionHeader?.trailingContent?.headerTrailingContent}
41
+ invalidText={props.sectionHeader?.invalidText?.invalidText}
42
+ >
43
+ {props.items}
44
+ </DescriptionList>
45
+ ),
46
+ }
47
+ );
@@ -8,6 +8,7 @@ export interface DescriptionListProps extends ViewProps {
8
8
  heading?: string;
9
9
  helperText?: string;
10
10
  headerTrailingContent?: React.ReactNode;
11
+ invalidText?: string;
11
12
  }
12
13
 
13
14
  export default DescriptionListProps;
@@ -146,3 +146,27 @@ export const WithLinks: Story = {
146
146
  </DescriptionList>
147
147
  ),
148
148
  };
149
+
150
+ export const WithNumericValues: Story = {
151
+ parameters: { controls: { include: ['direction', 'itemHeadingWidth'] } },
152
+ args: { direction: 'row' },
153
+ render: args => (
154
+ <DescriptionList {...args}>
155
+ <DescriptionListItem
156
+ heading="Account Balance"
157
+ description="Current balance"
158
+ numericValue="£5,432.10"
159
+ />
160
+ <DescriptionListItem
161
+ heading="Available Credit"
162
+ description="Credit limit minus current balance"
163
+ numericValue="£1,234.56"
164
+ />
165
+ <DescriptionListItem
166
+ heading="Minimum Payment"
167
+ description="Amount due by next statement date"
168
+ numericValue="£123.45"
169
+ />
170
+ </DescriptionList>
171
+ ),
172
+ };
@@ -13,6 +13,7 @@ const DescriptionList = ({
13
13
  headerTrailingContent,
14
14
  children,
15
15
  style,
16
+ invalidText,
16
17
  ...props
17
18
  }: DescriptionListProps) => {
18
19
  styles.useVariants({ direction });
@@ -26,6 +27,7 @@ const DescriptionList = ({
26
27
  heading={heading}
27
28
  helperText={helperText}
28
29
  trailingContent={headerTrailingContent}
30
+ invalidText={invalidText}
29
31
  />
30
32
  ) : null}
31
33
  {children}