@utilitywarehouse/hearth-react-native 0.3.0 → 0.4.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 (313) hide show
  1. package/.storybook/preview.tsx +3 -0
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +3 -1
  4. package/CHANGELOG.md +22 -0
  5. package/build/components/Alert/AlertCloseButton.js +25 -3
  6. package/build/components/Alert/AlertIcon.js +17 -1
  7. package/build/components/Alert/AlertIconButton.js +27 -1
  8. package/build/components/Alert/AlertLink.js +47 -1
  9. package/build/components/Alert/AlertText.d.ts +1 -1
  10. package/build/components/Alert/AlertText.js +26 -2
  11. package/build/components/Alert/AlertTitle.d.ts +1 -1
  12. package/build/components/Alert/AlertTitle.js +26 -2
  13. package/build/components/Badge/BadgeIcon.js +72 -0
  14. package/build/components/Badge/BadgeText.js +72 -0
  15. package/build/components/Button/ButtonRoot.js +1 -0
  16. package/build/components/Checkbox/Checkbox.d.ts +2 -2
  17. package/build/components/Checkbox/Checkbox.js +11 -10
  18. package/build/components/Checkbox/Checkbox.props.d.ts +3 -1
  19. package/build/components/Checkbox/CheckboxIcon.js +1 -1
  20. package/build/components/Checkbox/CheckboxImage.d.ts +6 -0
  21. package/build/components/Checkbox/CheckboxImage.js +5 -0
  22. package/build/components/Checkbox/CheckboxTileRoot.js +1 -1
  23. package/build/components/Checkbox/index.d.ts +3 -2
  24. package/build/components/Checkbox/index.js +2 -1
  25. package/build/components/CurrencyInput/CurrencyInput.js +1 -1
  26. package/build/components/DatePicker/DatePicker.context.d.ts +19 -0
  27. package/build/components/DatePicker/DatePicker.context.js +3 -0
  28. package/build/components/DatePicker/DatePicker.d.ts +19 -0
  29. package/build/components/DatePicker/DatePicker.js +479 -0
  30. package/build/components/DatePicker/DatePicker.props.d.ts +125 -0
  31. package/build/components/DatePicker/DatePicker.props.js +1 -0
  32. package/build/components/DatePicker/DatePickerCalendar.d.ts +2 -0
  33. package/build/components/DatePicker/DatePickerCalendar.js +28 -0
  34. package/build/components/DatePicker/DatePickerDay.d.ts +11 -0
  35. package/build/components/DatePicker/DatePickerDay.js +242 -0
  36. package/build/components/DatePicker/DatePickerDays.d.ts +2 -0
  37. package/build/components/DatePicker/DatePickerDays.js +157 -0
  38. package/build/components/DatePicker/DatePickerFooter.d.ts +2 -0
  39. package/build/components/DatePicker/DatePickerFooter.js +23 -0
  40. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +8 -0
  41. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.js +1 -0
  42. package/build/components/DatePicker/DatePickerHeader/DatePickerMonthButton.d.ts +2 -0
  43. package/build/components/DatePicker/DatePickerHeader/DatePickerMonthButton.js +14 -0
  44. package/build/components/DatePicker/DatePickerHeader/DatePickerNextButton.d.ts +2 -0
  45. package/build/components/DatePicker/DatePickerHeader/DatePickerNextButton.js +32 -0
  46. package/build/components/DatePicker/DatePickerHeader/DatePickerPrevButton.d.ts +2 -0
  47. package/build/components/DatePicker/DatePickerHeader/DatePickerPrevButton.js +32 -0
  48. package/build/components/DatePicker/DatePickerHeader/DatePickerSelectors.d.ts +6 -0
  49. package/build/components/DatePicker/DatePickerHeader/DatePickerSelectors.js +64 -0
  50. package/build/components/DatePicker/DatePickerHeader/DatePickerTimeButton.d.ts +1 -0
  51. package/build/components/DatePicker/DatePickerHeader/DatePickerTimeButton.js +22 -0
  52. package/build/components/DatePicker/DatePickerHeader/DatePickerYearButton.d.ts +2 -0
  53. package/build/components/DatePicker/DatePickerHeader/DatePickerYearButton.js +25 -0
  54. package/build/components/DatePicker/DatePickerHeader/index.d.ts +3 -0
  55. package/build/components/DatePicker/DatePickerHeader/index.js +30 -0
  56. package/build/components/DatePicker/DatePickerMonths.d.ts +2 -0
  57. package/build/components/DatePicker/DatePickerMonths.js +69 -0
  58. package/build/components/DatePicker/DatePickerWeekdays.d.ts +8 -0
  59. package/build/components/DatePicker/DatePickerWeekdays.js +26 -0
  60. package/build/components/DatePicker/DatePickerYears.d.ts +2 -0
  61. package/build/components/DatePicker/DatePickerYears.js +83 -0
  62. package/build/components/DatePicker/TimePicker.d.ts +3 -0
  63. package/build/components/DatePicker/TimePicker.js +84 -0
  64. package/build/components/DatePicker/enums.d.ts +12 -0
  65. package/build/components/DatePicker/enums.js +12 -0
  66. package/build/components/DatePicker/index.d.ts +4 -0
  67. package/build/components/DatePicker/index.js +3 -0
  68. package/build/components/DatePicker/polyfill.d.ts +0 -0
  69. package/build/components/DatePicker/polyfill.js +22 -0
  70. package/build/components/DatePicker/time-picker/animated-math.d.ts +4 -0
  71. package/build/components/DatePicker/time-picker/animated-math.js +19 -0
  72. package/build/components/DatePicker/time-picker/period-native.d.ts +6 -0
  73. package/build/components/DatePicker/time-picker/period-native.js +17 -0
  74. package/build/components/DatePicker/time-picker/period-picker.d.ts +6 -0
  75. package/build/components/DatePicker/time-picker/period-picker.js +10 -0
  76. package/build/components/DatePicker/time-picker/period-web.d.ts +6 -0
  77. package/build/components/DatePicker/time-picker/period-web.js +21 -0
  78. package/build/components/DatePicker/time-picker/wheel-native.d.ts +8 -0
  79. package/build/components/DatePicker/time-picker/wheel-native.js +19 -0
  80. package/build/components/DatePicker/time-picker/wheel-picker/index.d.ts +2 -0
  81. package/build/components/DatePicker/time-picker/wheel-picker/index.js +2 -0
  82. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.d.ts +16 -0
  83. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.js +97 -0
  84. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.d.ts +21 -0
  85. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.js +88 -0
  86. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.d.ts +23 -0
  87. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.js +21 -0
  88. package/build/components/DatePicker/time-picker/wheel-web.d.ts +8 -0
  89. package/build/components/DatePicker/time-picker/wheel-web.js +148 -0
  90. package/build/components/DatePicker/time-picker/wheel.d.ts +8 -0
  91. package/build/components/DatePicker/time-picker/wheel.js +10 -0
  92. package/build/components/DatePicker/utils.d.ts +212 -0
  93. package/build/components/DatePicker/utils.js +391 -0
  94. package/build/components/DatePickerInput/DatePickerInput.d.ts +6 -0
  95. package/build/components/DatePickerInput/DatePickerInput.js +126 -0
  96. package/build/components/DatePickerInput/DatePickerInput.props.d.ts +47 -0
  97. package/build/components/DatePickerInput/DatePickerInput.props.js +1 -0
  98. package/build/components/DatePickerInput/DatePickerInputDoneButton.d.ts +8 -0
  99. package/build/components/DatePickerInput/DatePickerInputDoneButton.js +19 -0
  100. package/build/components/DatePickerInput/DatePickerInputDoneButton.web.d.ts +5 -0
  101. package/build/components/DatePickerInput/DatePickerInputDoneButton.web.js +5 -0
  102. package/build/components/DatePickerInput/index.d.ts +2 -0
  103. package/build/components/DatePickerInput/index.js +1 -0
  104. package/build/components/Input/InputField.d.ts +1 -1
  105. package/build/components/Input/InputField.js +1 -1
  106. package/build/components/Input/InputSlot.d.ts +1 -1
  107. package/build/components/Input/InputSlot.js +3 -3
  108. package/build/components/Link/Link.d.ts +1 -1
  109. package/build/components/Link/Link.js +4 -4
  110. package/build/components/Link/Link.props.d.ts +3 -0
  111. package/build/components/Radio/Radio.d.ts +2 -2
  112. package/build/components/Radio/Radio.js +9 -8
  113. package/build/components/Radio/Radio.props.d.ts +3 -1
  114. package/build/components/Radio/RadioImage.d.ts +6 -0
  115. package/build/components/Radio/RadioImage.js +5 -0
  116. package/build/components/Radio/RadioTileRoot.js +1 -1
  117. package/build/components/Radio/index.d.ts +3 -2
  118. package/build/components/Radio/index.js +2 -1
  119. package/build/components/Select/SelectOption.js +1 -7
  120. package/build/components/UnstyledIconButton/UnstyledIconButton.d.ts +1 -1
  121. package/build/components/UnstyledIconButton/UnstyledIconButton.js +5 -5
  122. package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +2 -1
  123. package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
  124. package/build/components/index.d.ts +2 -0
  125. package/build/components/index.js +2 -0
  126. package/build/core/themes.d.ts +12 -12
  127. package/build/hooks/index.d.ts +4 -3
  128. package/build/hooks/index.js +4 -3
  129. package/build/hooks/usePrevious.d.ts +1 -0
  130. package/build/hooks/usePrevious.js +8 -0
  131. package/build/hooks/useTheme.d.ts +2 -1
  132. package/build/hooks/useTheme.js +2 -2
  133. package/build/tokens/color.d.ts +12 -12
  134. package/build/tokens/color.js +6 -6
  135. package/build/tokens/components/dark/alert.d.ts +13 -0
  136. package/build/tokens/components/dark/alert.js +13 -0
  137. package/build/tokens/components/dark/checkbox.d.ts +3 -0
  138. package/build/tokens/components/dark/checkbox.js +3 -0
  139. package/build/tokens/components/dark/date-picker.d.ts +1 -0
  140. package/build/tokens/components/dark/date-picker.js +1 -0
  141. package/build/tokens/components/dark/icon-button.d.ts +7 -0
  142. package/build/tokens/components/dark/icon-button.js +7 -0
  143. package/build/tokens/components/dark/illustrations.d.ts +7 -0
  144. package/build/tokens/components/dark/illustrations.js +6 -0
  145. package/build/tokens/components/dark/index.d.ts +2 -0
  146. package/build/tokens/components/dark/index.js +2 -0
  147. package/build/tokens/components/dark/link.d.ts +5 -0
  148. package/build/tokens/components/dark/link.js +5 -0
  149. package/build/tokens/components/dark/progress-bar.d.ts +41 -0
  150. package/build/tokens/components/dark/progress-bar.js +40 -0
  151. package/build/tokens/components/dark/segmented-control.d.ts +2 -2
  152. package/build/tokens/components/dark/segmented-control.js +2 -2
  153. package/build/tokens/components/dark/table.d.ts +3 -0
  154. package/build/tokens/components/dark/table.js +3 -0
  155. package/build/tokens/components/light/alert.d.ts +13 -0
  156. package/build/tokens/components/light/alert.js +13 -0
  157. package/build/tokens/components/light/checkbox.d.ts +3 -0
  158. package/build/tokens/components/light/checkbox.js +3 -0
  159. package/build/tokens/components/light/date-picker.d.ts +1 -0
  160. package/build/tokens/components/light/date-picker.js +1 -0
  161. package/build/tokens/components/light/icon-button.d.ts +7 -0
  162. package/build/tokens/components/light/icon-button.js +7 -0
  163. package/build/tokens/components/light/illustrations.d.ts +7 -0
  164. package/build/tokens/components/light/illustrations.js +6 -0
  165. package/build/tokens/components/light/index.d.ts +2 -0
  166. package/build/tokens/components/light/index.js +2 -0
  167. package/build/tokens/components/light/link.d.ts +5 -0
  168. package/build/tokens/components/light/link.js +5 -0
  169. package/build/tokens/components/light/progress-bar.d.ts +41 -0
  170. package/build/tokens/components/light/progress-bar.js +40 -0
  171. package/build/tokens/components/light/segmented-control.d.ts +2 -2
  172. package/build/tokens/components/light/segmented-control.js +2 -2
  173. package/build/tokens/components/light/table.d.ts +3 -0
  174. package/build/tokens/components/light/table.js +3 -0
  175. package/build/tokens/index.d.ts +1 -0
  176. package/build/tokens/index.js +1 -0
  177. package/build/tokens/motion.d.ts +23 -0
  178. package/build/tokens/motion.js +22 -0
  179. package/build/tokens/primitive.d.ts +19 -0
  180. package/build/tokens/primitive.js +19 -0
  181. package/build/tokens/semantic-dark.d.ts +5 -5
  182. package/build/tokens/semantic-dark.js +5 -5
  183. package/build/tokens/semantic-light.d.ts +1 -1
  184. package/build/tokens/semantic-light.js +1 -1
  185. package/build/utils/index.d.ts +1 -0
  186. package/build/utils/index.js +1 -0
  187. package/build/utils/isEqual.d.ts +2 -0
  188. package/build/utils/isEqual.js +29 -0
  189. package/chromatic.config.json +6 -0
  190. package/docs/assets/bank-logo.png +0 -0
  191. package/docs/assets/bank-logo1.png +0 -0
  192. package/docs/components/AllComponents.web.tsx +43 -1
  193. package/docs/components/ViewWrap.tsx +32 -0
  194. package/docs/components/index.ts +7 -7
  195. package/docs/getting-started.mdx +6 -6
  196. package/docs/introduction.mdx +3 -3
  197. package/package.json +16 -12
  198. package/src/components/Alert/AlertCloseButton.tsx +33 -5
  199. package/src/components/Alert/AlertIcon.tsx +17 -1
  200. package/src/components/Alert/AlertIconButton.tsx +37 -4
  201. package/src/components/Alert/AlertLink.tsx +52 -1
  202. package/src/components/Alert/AlertText.tsx +28 -3
  203. package/src/components/Alert/AlertTitle.tsx +28 -3
  204. package/src/components/Badge/BadgeIcon.tsx +72 -0
  205. package/src/components/Badge/BadgeText.tsx +72 -0
  206. package/src/components/Button/ButtonRoot.tsx +1 -0
  207. package/src/components/Checkbox/Checkbox.docs.mdx +45 -7
  208. package/src/components/Checkbox/Checkbox.props.ts +3 -1
  209. package/src/components/Checkbox/Checkbox.stories.tsx +37 -1
  210. package/src/components/Checkbox/Checkbox.tsx +12 -9
  211. package/src/components/Checkbox/CheckboxIcon.tsx +1 -1
  212. package/src/components/Checkbox/CheckboxImage.tsx +9 -0
  213. package/src/components/Checkbox/CheckboxTileRoot.tsx +1 -1
  214. package/src/components/Checkbox/index.ts +3 -2
  215. package/src/components/CurrencyInput/CurrencyInput.tsx +2 -1
  216. package/src/components/DatePicker/DatePicker.context.ts +23 -0
  217. package/src/components/DatePicker/DatePicker.docs.mdx +239 -0
  218. package/src/components/DatePicker/DatePicker.props.ts +139 -0
  219. package/src/components/DatePicker/DatePicker.stories.tsx +98 -0
  220. package/src/components/DatePicker/DatePicker.tsx +669 -0
  221. package/src/components/DatePicker/DatePickerCalendar.tsx +41 -0
  222. package/src/components/DatePicker/DatePickerDay.tsx +302 -0
  223. package/src/components/DatePicker/DatePickerDays.tsx +241 -0
  224. package/src/components/DatePicker/DatePickerFooter.tsx +35 -0
  225. package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +10 -0
  226. package/src/components/DatePicker/DatePickerHeader/DatePickerMonthButton.tsx +29 -0
  227. package/src/components/DatePicker/DatePickerHeader/DatePickerNextButton.tsx +46 -0
  228. package/src/components/DatePicker/DatePickerHeader/DatePickerPrevButton.tsx +46 -0
  229. package/src/components/DatePicker/DatePickerHeader/DatePickerSelectors.tsx +96 -0
  230. package/src/components/DatePicker/DatePickerHeader/DatePickerTimeButton.tsx +48 -0
  231. package/src/components/DatePicker/DatePickerHeader/DatePickerYearButton.tsx +50 -0
  232. package/src/components/DatePicker/DatePickerHeader/index.tsx +64 -0
  233. package/src/components/DatePicker/DatePickerMonths.tsx +101 -0
  234. package/src/components/DatePicker/DatePickerWeekdays.tsx +49 -0
  235. package/src/components/DatePicker/DatePickerYears.tsx +119 -0
  236. package/src/components/DatePicker/TimePicker.tsx +141 -0
  237. package/src/components/DatePicker/enums.ts +14 -0
  238. package/src/components/DatePicker/index.ts +13 -0
  239. package/src/components/DatePicker/polyfill.ts +21 -0
  240. package/src/components/DatePicker/time-picker/animated-math.ts +33 -0
  241. package/src/components/DatePicker/time-picker/period-native.tsx +34 -0
  242. package/src/components/DatePicker/time-picker/period-picker.tsx +16 -0
  243. package/src/components/DatePicker/time-picker/period-web.tsx +36 -0
  244. package/src/components/DatePicker/time-picker/wheel-native.tsx +37 -0
  245. package/src/components/DatePicker/time-picker/wheel-picker/index.ts +3 -0
  246. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.tsx +132 -0
  247. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.ts +22 -0
  248. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker.tsx +200 -0
  249. package/src/components/DatePicker/time-picker/wheel-web.tsx +181 -0
  250. package/src/components/DatePicker/time-picker/wheel.tsx +18 -0
  251. package/src/components/DatePicker/utils.ts +549 -0
  252. package/src/components/DatePickerInput/DatePickerInput.docs.mdx +237 -0
  253. package/src/components/DatePickerInput/DatePickerInput.props.ts +50 -0
  254. package/src/components/DatePickerInput/DatePickerInput.stories.tsx +178 -0
  255. package/src/components/DatePickerInput/DatePickerInput.tsx +265 -0
  256. package/src/components/DatePickerInput/DatePickerInputDoneButton.tsx +42 -0
  257. package/src/components/DatePickerInput/DatePickerInputDoneButton.web.tsx +7 -0
  258. package/src/components/DatePickerInput/index.ts +2 -0
  259. package/src/components/Icon/Icon.stories.tsx +4 -3
  260. package/src/components/IconContainer/IconContainer.docs.mdx +4 -4
  261. package/src/components/Input/InputField.tsx +0 -2
  262. package/src/components/Input/InputSlot.tsx +14 -3
  263. package/src/components/Link/Link.props.ts +3 -0
  264. package/src/components/Link/Link.tsx +12 -6
  265. package/src/components/List/List.docs.mdx +24 -23
  266. package/src/components/Modal/Modal.stories.tsx +2 -30
  267. package/src/components/Radio/Radio.docs.mdx +96 -124
  268. package/src/components/Radio/Radio.props.ts +3 -1
  269. package/src/components/Radio/Radio.stories.tsx +47 -0
  270. package/src/components/Radio/Radio.tsx +10 -7
  271. package/src/components/Radio/RadioImage.tsx +9 -0
  272. package/src/components/Radio/RadioTileRoot.tsx +1 -1
  273. package/src/components/Radio/index.ts +3 -2
  274. package/src/components/Select/Select.docs.mdx +6 -6
  275. package/src/components/Select/Select.stories.tsx +7 -7
  276. package/src/components/Select/SelectOption.tsx +4 -10
  277. package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
  278. package/src/components/UnstyledIconButton/UnstyledIconButton.tsx +23 -5
  279. package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +7 -3
  280. package/src/components/index.ts +2 -0
  281. package/src/hooks/index.ts +4 -3
  282. package/src/hooks/usePrevious.ts +9 -0
  283. package/src/hooks/useTheme.ts +4 -3
  284. package/src/tokens/color.ts +6 -6
  285. package/src/tokens/components/dark/alert.ts +13 -0
  286. package/src/tokens/components/dark/checkbox.ts +3 -0
  287. package/src/tokens/components/dark/date-picker.ts +1 -0
  288. package/src/tokens/components/dark/icon-button.ts +7 -0
  289. package/src/tokens/components/dark/illustrations.ts +7 -0
  290. package/src/tokens/components/dark/index.ts +2 -0
  291. package/src/tokens/components/dark/link.ts +5 -0
  292. package/src/tokens/components/dark/progress-bar.ts +41 -0
  293. package/src/tokens/components/dark/segmented-control.ts +2 -2
  294. package/src/tokens/components/dark/table.ts +3 -0
  295. package/src/tokens/components/light/alert.ts +13 -0
  296. package/src/tokens/components/light/checkbox.ts +3 -0
  297. package/src/tokens/components/light/date-picker.ts +1 -0
  298. package/src/tokens/components/light/icon-button.ts +7 -0
  299. package/src/tokens/components/light/illustrations.ts +7 -0
  300. package/src/tokens/components/light/index.ts +2 -0
  301. package/src/tokens/components/light/link.ts +5 -0
  302. package/src/tokens/components/light/progress-bar.ts +41 -0
  303. package/src/tokens/components/light/segmented-control.ts +2 -2
  304. package/src/tokens/components/light/table.ts +3 -0
  305. package/src/tokens/index.ts +1 -0
  306. package/src/tokens/motion.ts +23 -0
  307. package/src/tokens/primitive.ts +19 -0
  308. package/src/tokens/semantic-dark.ts +5 -5
  309. package/src/tokens/semantic-light.ts +1 -1
  310. package/src/utils/index.ts +1 -0
  311. package/src/utils/isEqual.ts +30 -0
  312. package/docs/assets/react-native-pig.png +0 -0
  313. package/docs/components/AdvancedRadioExample.tsx +0 -126
@@ -0,0 +1,391 @@
1
+ import dayjs from 'dayjs';
2
+ import { useRef } from 'react';
3
+ import { isEqual } from '../../utils';
4
+ export const CALENDAR_FORMAT = 'YYYY-MM-DD HH:mm';
5
+ export const DATE_FORMAT = 'YYYY-MM-DD';
6
+ export const YEAR_PAGE_SIZE = 12;
7
+ export const getMonths = () => dayjs.months();
8
+ export const getMonthName = (month) => dayjs.months()[month];
9
+ /**
10
+ * Get months array
11
+ *
12
+ * @returns months array
13
+ */
14
+ export const getMonthsArray = () => {
15
+ const monthNames = dayjs.months();
16
+ const monthShortNames = dayjs.monthsShort();
17
+ return monthNames.map((name, index) => ({
18
+ index,
19
+ name: {
20
+ full: name,
21
+ short: monthShortNames[index] || '',
22
+ },
23
+ isSelected: false,
24
+ }));
25
+ };
26
+ /**
27
+ * Get weekdays
28
+ *
29
+ * @param locale - locale
30
+ * @param firstDayOfWeek - first day of week
31
+ * @param format - format short, min or full
32
+ *
33
+ * @returns weekdays
34
+ */
35
+ export const getWeekdays = (firstDayOfWeek) => {
36
+ dayjs.locale('en');
37
+ const weekdayNames = dayjs.weekdays();
38
+ const weekdayShortNames = dayjs.weekdaysShort();
39
+ const weekdayMinNames = dayjs.weekdaysMin();
40
+ let weekdays = weekdayNames.map((name, index) => ({
41
+ index,
42
+ name: {
43
+ full: name,
44
+ short: weekdayShortNames[index] || '',
45
+ min: weekdayMinNames[index][0] || '',
46
+ },
47
+ }));
48
+ if (firstDayOfWeek > 0) {
49
+ weekdays = [
50
+ ...weekdays.slice(firstDayOfWeek, weekdays.length),
51
+ ...weekdays.slice(0, firstDayOfWeek),
52
+ ];
53
+ }
54
+ return weekdays;
55
+ };
56
+ export const getFormated = (date) => dayjs(date).format(CALENDAR_FORMAT);
57
+ export const getDateMonth = (date) => dayjs(date).month();
58
+ export const getDateYear = (date) => dayjs(date).year();
59
+ /**
60
+ * Check if two dates are on the same day
61
+ *
62
+ * @param a - date to check
63
+ * @param b - date to check
64
+ *
65
+ * @returns true if dates are on the same day, false otherwise
66
+ */
67
+ export function areDatesOnSameDay(a, b) {
68
+ if (!a || !b) {
69
+ return false;
70
+ }
71
+ const date_a = dayjs(a).format(DATE_FORMAT);
72
+ const date_b = dayjs(b).format(DATE_FORMAT);
73
+ return date_a === date_b;
74
+ }
75
+ /**
76
+ * Check if date is between two dates
77
+ *
78
+ * @param date - date to check
79
+ * @param options - options
80
+ *
81
+ * @returns true if date is between two dates, false otherwise
82
+ */
83
+ export function isDateBetween(date, { startDate, endDate, }) {
84
+ if (!startDate || !endDate) {
85
+ return false;
86
+ }
87
+ return dayjs(date) <= endDate && dayjs(date) >= startDate;
88
+ }
89
+ /**
90
+ * Check if date is disabled
91
+ *
92
+ * @param date - date to check
93
+ * @param options - options
94
+ *
95
+ * @returns true if date is disabled, false otherwise
96
+ */
97
+ export function isDateDisabled(date, { minDate, maxDate, enabledDates, disabledDates, }) {
98
+ if (minDate && date.isBefore(dayjs(minDate).startOf('day'))) {
99
+ return true;
100
+ }
101
+ if (maxDate && date.isAfter(dayjs(maxDate).endOf('day'))) {
102
+ return true;
103
+ }
104
+ if (enabledDates) {
105
+ if (Array.isArray(enabledDates)) {
106
+ const isEnabled = enabledDates.some(enabledDate => areDatesOnSameDay(date, enabledDate));
107
+ return !isEnabled;
108
+ }
109
+ else if (enabledDates instanceof Function) {
110
+ return !enabledDates(date);
111
+ }
112
+ }
113
+ else if (disabledDates) {
114
+ if (Array.isArray(disabledDates)) {
115
+ const isDisabled = disabledDates.some(disabledDate => areDatesOnSameDay(date, disabledDate));
116
+ return isDisabled;
117
+ }
118
+ else if (disabledDates instanceof Function) {
119
+ return disabledDates(date);
120
+ }
121
+ }
122
+ return false;
123
+ }
124
+ /**
125
+ * Check if year is disabled
126
+ *
127
+ * @param year - year to check
128
+ * @param options - options
129
+ *
130
+ * @returns true if year is disabled, false otherwise
131
+ */
132
+ export function isYearDisabled(year, { minDate, maxDate, }) {
133
+ if (minDate && year < getDateYear(minDate))
134
+ return true;
135
+ if (maxDate && year > getDateYear(maxDate))
136
+ return true;
137
+ return false;
138
+ }
139
+ /**
140
+ * Check if month is disabled
141
+ *
142
+ * @param month - month to check
143
+ * @param date - date to check
144
+ * @param options - options
145
+ *
146
+ * @returns true if month is disabled, false otherwise
147
+ */
148
+ export function isMonthDisabled(month, date, { minDate, maxDate, }) {
149
+ if (minDate && month < getDateMonth(minDate) && getDateYear(date) === getDateYear(minDate))
150
+ return true;
151
+ if (maxDate && month > getDateMonth(maxDate) && getDateYear(date) === getDateYear(maxDate))
152
+ return true;
153
+ return false;
154
+ }
155
+ /**
156
+ * Get formated date
157
+ *
158
+ * @param date - date to get formated date from
159
+ * @param format - format to get formated date from
160
+ *
161
+ * @returns formated date
162
+ */
163
+ export const getFormatedDate = (date, format) => dayjs(date).format(format);
164
+ /**
165
+ * Get date
166
+ *
167
+ * @param date - date to get
168
+ *
169
+ * @returns date
170
+ */
171
+ export const getDate = (date) => dayjs(date);
172
+ /**
173
+ * Get year range
174
+ *
175
+ * @param year - year to get year range from
176
+ *
177
+ * @returns year range
178
+ */
179
+ export const getYearRange = (year) => {
180
+ const endYear = YEAR_PAGE_SIZE * Math.ceil(year / YEAR_PAGE_SIZE);
181
+ let startYear = endYear === year ? endYear : endYear - YEAR_PAGE_SIZE;
182
+ if (startYear < 0) {
183
+ startYear = 0;
184
+ }
185
+ return Array.from({ length: YEAR_PAGE_SIZE }, (_, i) => startYear + i);
186
+ };
187
+ /**
188
+ * Get days in month
189
+ *
190
+ * @param date - date to get days in month from
191
+ * @param showOutsideDays - whether to show outside days
192
+ * @param firstDayOfWeek - first day of week, number 0-6, 0 – Sunday, 6 – Saturday
193
+ *
194
+ * @returns days in month
195
+ */
196
+ export function getDaysInMonth(date, showOutsideDays, firstDayOfWeek) {
197
+ const daysInCurrentMonth = dayjs(date).daysInMonth();
198
+ const prevMonthDays = dayjs(date).add(-1, 'month').daysInMonth();
199
+ const firstDay = dayjs(date).date(1 - firstDayOfWeek);
200
+ const prevMonthOffset = firstDay.day() % 7;
201
+ const daysInPrevMonth = showOutsideDays ? prevMonthOffset : 0;
202
+ const monthDaysOffset = prevMonthOffset + daysInCurrentMonth;
203
+ const daysInNextMonth = showOutsideDays
204
+ ? monthDaysOffset > 35
205
+ ? 42 - monthDaysOffset
206
+ : 35 - monthDaysOffset
207
+ : 0;
208
+ const fullDaysInMonth = daysInPrevMonth + daysInCurrentMonth + daysInNextMonth;
209
+ return {
210
+ prevMonthDays,
211
+ prevMonthOffset,
212
+ daysInCurrentMonth,
213
+ daysInNextMonth,
214
+ fullDaysInMonth,
215
+ };
216
+ }
217
+ /**
218
+ * Get first day of month
219
+ *
220
+ * @param date - date to get first day of month from
221
+ * @param firstDayOfWeek - first day of week, number 0-6, 0 – Sunday, 6 – Saturday
222
+ *
223
+ * @returns first day of month
224
+ */
225
+ export function getFirstDayOfMonth(date, firstDayOfWeek) {
226
+ const d = getDate(date);
227
+ return d.date(1 - firstDayOfWeek).day();
228
+ }
229
+ /**
230
+ * Get start of day
231
+ *
232
+ * @param date - date to get start of day from
233
+ *
234
+ * @returns start of day
235
+ */
236
+ export function getStartOfDay(date) {
237
+ return dayjs(date).startOf('day');
238
+ }
239
+ /**
240
+ * Get end of day
241
+ *
242
+ * @param date - date to get end of day from
243
+ *
244
+ * @returns end of day
245
+ */
246
+ export function getEndOfDay(date) {
247
+ return dayjs(date).endOf('day');
248
+ }
249
+ /**
250
+ * Convert date to unix timestamp
251
+ *
252
+ * @param date - date to convert
253
+ *
254
+ * @returns unix timestamp
255
+ */
256
+ export function dateToUnix(date) {
257
+ return dayjs(date).unix();
258
+ }
259
+ /**
260
+ * Remove time from date
261
+ *
262
+ * @param date - date to remove time from
263
+ *
264
+ * @returns date with time removed
265
+ */
266
+ export function removeTime(date, timeZone) {
267
+ return date ? dayjs.tz(date, timeZone).startOf('day') : undefined;
268
+ }
269
+ /**
270
+ * Get detailed date object
271
+ *
272
+ * @param date Get detailed date object
273
+ *
274
+ * @returns parsed date object
275
+ */
276
+ export const getParsedDate = (date) => {
277
+ return {
278
+ year: dayjs(date).year(),
279
+ month: dayjs(date).month(),
280
+ hour: dayjs(date).hour(),
281
+ hour12: parseInt(dayjs(date).format('hh')),
282
+ minute: dayjs(date).minute(),
283
+ period: dayjs(date).format('A'),
284
+ };
285
+ };
286
+ /**
287
+ * Calculate month days array based on current date
288
+ *
289
+ * @param datetime - The current date that selected
290
+ * @param showOutsideDays
291
+ * @param minDate - min selectable date
292
+ * @param maxDate - max selectable date
293
+ * @param firstDayOfWeek - first day of week, number 0-6, 0 – Sunday, 6 – Saturday
294
+ * @param enabledDates - array of enabled dates, or a function that returns true for a given date (takes precedence over disabledDates)
295
+ * @param disabledDates - array of disabled dates, or a function that returns true for a given date
296
+ * @param prevMonthDays - number of days in the previous month
297
+ * @param prevMonthOffset - number of days to offset the previous month
298
+ * @param daysInCurrentMonth - number of days in the current month
299
+ * @param daysInNextMonth - number of days in the next month
300
+ *
301
+ * @returns days array based on current date
302
+ */
303
+ export const getMonthDays = (datetime, showOutsideDays, minDate, maxDate, firstDayOfWeek, enabledDates, disabledDates, prevMonthDays, prevMonthOffset, daysInCurrentMonth, daysInNextMonth, numerals) => {
304
+ const date = dayjs(datetime);
305
+ const prevDays = showOutsideDays
306
+ ? Array.from({ length: prevMonthOffset }, (_, index) => {
307
+ const number = index + (prevMonthDays - prevMonthOffset + 1);
308
+ const thisDay = date.add(-1, 'month').date(number);
309
+ return generateCalendarDay(number, thisDay, minDate, maxDate, enabledDates, disabledDates, false, index + 1, firstDayOfWeek, numerals);
310
+ })
311
+ : Array(prevMonthOffset).fill(null);
312
+ const currentDays = Array.from({ length: daysInCurrentMonth }, (_, index) => {
313
+ const day = index + 1;
314
+ const thisDay = date.date(day);
315
+ return generateCalendarDay(day, thisDay, minDate, maxDate, enabledDates, disabledDates, true, prevMonthOffset + day, firstDayOfWeek, numerals);
316
+ });
317
+ const nextDays = Array.from({ length: daysInNextMonth }, (_, index) => {
318
+ const day = index + 1;
319
+ const thisDay = date.add(1, 'month').date(day);
320
+ return generateCalendarDay(day, thisDay, minDate, maxDate, enabledDates, disabledDates, false, daysInCurrentMonth + prevMonthOffset + day, firstDayOfWeek, numerals);
321
+ });
322
+ return [...prevDays, ...currentDays, ...nextDays];
323
+ };
324
+ /**
325
+ * Generate day object for displaying inside day cell
326
+ *
327
+ * @param number - number of day
328
+ * @param date - calculated date based on day, month, and year
329
+ * @param minDate - min selectable date
330
+ * @param maxDate - max selectable date
331
+ * @param enabledDates - array of enabled dates, or a function that returns true for a given date (takes precedence over disabledDates)
332
+ * @param disabledDates - array of disabled dates, or a function that returns true for a given date
333
+ * @param isCurrentMonth - define the day is in the current month
334
+ * @param dayOfMonth - number the day in the current month
335
+ * @param firstDayOfWeek - first day of week, number 0-6, 0 – Sunday, 6 – Saturday
336
+ *
337
+ * @returns days object based on current date
338
+ */
339
+ const generateCalendarDay = (number, date, minDate, maxDate, enabledDates, disabledDates, isCurrentMonth, dayOfMonth, firstDayOfWeek, numerals) => {
340
+ const startOfWeek = dayjs(date).startOf('week').add(firstDayOfWeek, 'day');
341
+ return {
342
+ text: formatNumber(number, numerals),
343
+ number,
344
+ date: date,
345
+ isDisabled: isDateDisabled(date, {
346
+ minDate,
347
+ maxDate,
348
+ enabledDates,
349
+ disabledDates,
350
+ }),
351
+ isCurrentMonth,
352
+ dayOfMonth,
353
+ isStartOfWeek: date.isSame(startOfWeek, 'day'),
354
+ isEndOfWeek: date.day() === (firstDayOfWeek + 6) % 7,
355
+ };
356
+ };
357
+ /**
358
+ * Deep compare memo
359
+ *
360
+ * @param value - value to compare
361
+ * @param deps - dependencies
362
+ *
363
+ * @returns memoized value
364
+ */
365
+ export function useDeepCompareMemo(value, deps) {
366
+ const ref = useRef(null);
367
+ const depsRef = useRef(null);
368
+ if (!depsRef.current || !deps.every((dep, i) => isEqual(dep, depsRef.current[i]))) {
369
+ ref.current = value;
370
+ depsRef.current = deps;
371
+ }
372
+ return ref.current;
373
+ }
374
+ export const numeralSystems = {
375
+ latn: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
376
+ };
377
+ function getDigitMap(numerals) {
378
+ const digitMap = {};
379
+ const numeralDigits = numeralSystems[numerals];
380
+ for (let i = 0; i < 10; i++) {
381
+ digitMap[i.toString()] = numeralDigits[i];
382
+ }
383
+ return digitMap;
384
+ }
385
+ function replaceDigits(input, numerals) {
386
+ const digitMap = getDigitMap(numerals);
387
+ return input.replace(/\d/g, digit => digitMap[digit] || digit);
388
+ }
389
+ export function formatNumber(value, numerals) {
390
+ return replaceDigits(value.toString(), numerals);
391
+ }
@@ -0,0 +1,6 @@
1
+ import type DatePickerInputProps from './DatePickerInput.props';
2
+ declare const DatePickerInput: {
3
+ ({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, format, openButtonLabel, autoCloseOnSelect, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default DatePickerInput;
@@ -0,0 +1,126 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CalendarSmallIcon, CloseSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
+ import dayjs from 'dayjs';
4
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
5
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { Keyboard, Platform } from 'react-native';
7
+ import { StyleSheet } from 'react-native-unistyles';
8
+ import { DatePicker } from '../DatePicker';
9
+ import { useFormFieldContext } from '../FormField';
10
+ import { Input, InputField, InputSlot } from '../Input';
11
+ import { UnstyledIconButton } from '../UnstyledIconButton';
12
+ import DatePickerInputDoneButton from './DatePickerInputDoneButton';
13
+ dayjs.extend(customParseFormat);
14
+ const DEFAULT_FORMAT = 'DD/MM/YYYY';
15
+ const maskDefaultFormat = (value) => {
16
+ const digitsOnly = value.replace(/\D/g, '').slice(0, 8);
17
+ const day = digitsOnly.slice(0, 2);
18
+ const month = digitsOnly.slice(2, 4);
19
+ const year = digitsOnly.slice(4, 8);
20
+ return [day, month, year].filter(Boolean).join('/');
21
+ };
22
+ const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, format = DEFAULT_FORMAT, openButtonLabel = 'Open date picker', autoCloseOnSelect = true, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }) => {
23
+ const formFieldContext = useFormFieldContext();
24
+ const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
25
+ const isDisabled = formFieldContext?.disabled ?? disabled;
26
+ const isReadonly = formFieldContext?.readonly ?? readonly;
27
+ const pickerRef = useRef(null);
28
+ const accessoryViewID = useMemo(() => {
29
+ if (Platform.OS !== 'ios')
30
+ return undefined;
31
+ return `datepicker-input-${Math.random().toString(36).slice(2)}`;
32
+ }, []);
33
+ const formatDate = useCallback((dateValue) => {
34
+ if (!dateValue)
35
+ return '';
36
+ const parsed = dayjs(dateValue);
37
+ return parsed.isValid() ? parsed.format(format) : '';
38
+ }, [format]);
39
+ const isDefaultFormat = format === DEFAULT_FORMAT;
40
+ const [inputValue, setInputValue] = useState(() => formatDate(value));
41
+ useEffect(() => {
42
+ setInputValue(formatDate(value));
43
+ }, [value, formatDate]);
44
+ const handleTextChange = useCallback((text) => {
45
+ const nextValue = isDefaultFormat ? maskDefaultFormat(text) : text;
46
+ setInputValue(nextValue);
47
+ onChangeText?.(nextValue);
48
+ if (!nextValue) {
49
+ onChange?.({ date: undefined });
50
+ return;
51
+ }
52
+ const parsed = dayjs(nextValue, format, true);
53
+ if (parsed.isValid()) {
54
+ onChange?.({ date: parsed.toDate() });
55
+ }
56
+ else {
57
+ onChange?.({ date: undefined });
58
+ }
59
+ }, [format, isDefaultFormat, onChange, onChangeText]);
60
+ const handleClear = useCallback(() => {
61
+ setInputValue('');
62
+ onChange?.({ date: undefined });
63
+ onClear?.();
64
+ }, [onChange, onClear]);
65
+ const closeKeyboard = useCallback(() => {
66
+ Keyboard.dismiss();
67
+ }, []);
68
+ const openPicker = useCallback(() => {
69
+ if (isDisabled || isReadonly)
70
+ return;
71
+ closeKeyboard();
72
+ pickerRef.current?.present();
73
+ }, [closeKeyboard, isDisabled, isReadonly]);
74
+ const selectedDate = useMemo(() => {
75
+ if (value) {
76
+ return value;
77
+ }
78
+ const parsed = dayjs(inputValue, format, true);
79
+ return parsed.isValid() ? parsed.toDate() : undefined;
80
+ }, [value, inputValue, format]);
81
+ const handlePickerChange = useCallback(({ date }) => {
82
+ if (!date) {
83
+ handleClear();
84
+ return;
85
+ }
86
+ const formatted = formatDate(date);
87
+ setInputValue(formatted);
88
+ onChange?.({ date });
89
+ if (autoCloseOnSelect) {
90
+ pickerRef.current?.close?.();
91
+ }
92
+ }, [autoCloseOnSelect, formatDate, handleClear, onChange]);
93
+ const handleBlur = useCallback((event) => {
94
+ onBlur?.(event);
95
+ }, [onBlur]);
96
+ const handleFocus = useCallback((event) => {
97
+ onFocus?.(event);
98
+ }, [onFocus]);
99
+ const { onCancel: pickerOnCancel, ...restDatePickerProps } = datePickerProps ?? {};
100
+ const { style: inputStyle, keyboardType: keyboardTypeProp, inputMode: inputModeProp, accessibilityHint: accessibilityHintProp, accessibilityLabel: accessibilityLabelProp, accessible: accessibleProp, accessibilityRole: accessibilityRoleProp, importantForAccessibility: importantForAccessibilityProp, ...textInputProps } = rest;
101
+ const resolvedKeyboardType = keyboardTypeProp ?? (isDefaultFormat ? 'number-pad' : undefined);
102
+ const resolvedInputMode = inputModeProp ?? (isDefaultFormat ? 'numeric' : undefined);
103
+ const resolvedAccessibilityHint = accessibilityHintProp ?? `Enter the date in ${format} format`;
104
+ const resolvedAccessibilityLabel = accessibilityLabelProp ?? 'Date input';
105
+ const resolvedAccessible = accessibleProp ?? true;
106
+ const resolvedImportantForAccessibility = importantForAccessibilityProp ?? 'yes';
107
+ const handleCancel = useCallback(() => {
108
+ pickerOnCancel?.();
109
+ pickerRef.current?.close?.();
110
+ }, [pickerOnCancel]);
111
+ const placeholderValue = placeholder ?? format;
112
+ return (_jsxs(_Fragment, { children: [_jsxs(Input, { validationStatus: validationStatusFromContext, disabled: isDisabled, readonly: isReadonly, focused: focused, style: styles.wrap, accessible: false, children: [_jsx(InputField, { editable: !isReadonly && !isDisabled, value: inputValue, placeholder: placeholderValue, onChangeText: handleTextChange, onBlur: handleBlur, onFocus: handleFocus, inBottomSheet: inBottomSheet, keyboardType: resolvedKeyboardType, inputMode: resolvedInputMode, accessibilityHint: resolvedAccessibilityHint, "aria-label": "Date input", accessibilityLabel: resolvedAccessibilityLabel, accessible: resolvedAccessible, accessibilityState: {
113
+ disabled: isDisabled || isReadonly,
114
+ }, importantForAccessibility: resolvedImportantForAccessibility, inputAccessoryViewID: Platform.OS === 'ios' ? accessoryViewID : undefined, ...textInputProps, style: [styles.input, inputStyle] }), !!inputValue && onClear && !isReadonly && !isDisabled && (_jsx(InputSlot, { accessibilityElementsHidden: false, children: _jsx(UnstyledIconButton, { accessibilityLabel: "Clear date", accessibilityHint: "Removes the current date", icon: CloseSmallIcon, onPress: handleClear }) })), _jsx(InputSlot, { accessibilityElementsHidden: false, children: _jsx(UnstyledIconButton, { accessibilityLabel: openButtonLabel, accessibilityHint: "Opens the date picker calendar", icon: CalendarSmallIcon, onPress: openPicker, disabled: isDisabled || isReadonly }) })] }), _jsx(DatePicker, { ref: pickerRef, mode: "single", date: selectedDate, onChange: handlePickerChange, onCancel: handleCancel, ...restDatePickerProps }), Platform.OS === 'ios' && accessoryViewID && (_jsx(DatePickerInputDoneButton, { accessoryViewID: accessoryViewID, closeKeyboard: closeKeyboard }))] }));
115
+ };
116
+ DatePickerInput.displayName = 'DatePickerInput';
117
+ const styles = StyleSheet.create(theme => ({
118
+ wrap: {
119
+ gap: theme.components.input.date.gap,
120
+ },
121
+ input: {
122
+ paddingLeft: 0,
123
+ paddingRight: 0,
124
+ },
125
+ }));
126
+ export default DatePickerInput;
@@ -0,0 +1,47 @@
1
+ import type { TextInputProps, ViewProps } from 'react-native';
2
+ import type { DatePickerSingleProps } from '../DatePicker/DatePicker';
3
+ import type { DateType } from '../DatePicker/DatePicker.props';
4
+ export interface DatePickerInputBaseProps {
5
+ disabled?: boolean;
6
+ validationStatus?: 'initial' | 'valid' | 'invalid';
7
+ readonly?: boolean;
8
+ focused?: boolean;
9
+ placeholder?: string;
10
+ inBottomSheet?: boolean;
11
+ required?: boolean;
12
+ /**
13
+ * Controls how the selected date is formatted when displayed inside the input.
14
+ * Accepts any Day.js format string. When left as the default `DD/MM/YYYY`,
15
+ * the input automatically inserts separators as people type.
16
+ */
17
+ format?: string;
18
+ /**
19
+ * Accessible label announced when activating the calendar trigger button.
20
+ */
21
+ openButtonLabel?: string;
22
+ /**
23
+ * When true (default), the calendar sheet is dismissed as soon as a date is picked.
24
+ */
25
+ autoCloseOnSelect?: boolean;
26
+ /**
27
+ * Additional props forwarded to the underlying DatePicker instance.
28
+ */
29
+ datePickerProps?: Omit<DatePickerSingleProps, 'mode' | 'date' | 'onChange' | 'ref'>;
30
+ /**
31
+ * Handles cleared input values.
32
+ */
33
+ onClear?: () => void;
34
+ }
35
+ export type DatePickerInputProps = DatePickerInputBaseProps & Omit<TextInputProps, 'value' | 'onChange' | 'children'> & ViewProps & {
36
+ /**
37
+ * Controlled date value. Accepts Date, string, number or Day.js instances.
38
+ */
39
+ value?: DateType;
40
+ /**
41
+ * Fired after a valid date is parsed either from typing or the picker selection.
42
+ */
43
+ onChange?: (params: {
44
+ date: DateType;
45
+ }) => void;
46
+ };
47
+ export default DatePickerInputProps;
@@ -0,0 +1,8 @@
1
+ declare const DatePickerInputDoneButton: {
2
+ ({ accessoryViewID, closeKeyboard, }: {
3
+ accessoryViewID: string;
4
+ closeKeyboard: () => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ DisplayName: string;
7
+ };
8
+ export default DatePickerInputDoneButton;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { InputAccessoryView, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { Button } from '../Button';
5
+ const DatePickerInputDoneButton = ({ accessoryViewID, closeKeyboard, }) => {
6
+ return (_jsx(InputAccessoryView, { nativeID: accessoryViewID, children: _jsx(View, { style: styles.accessory, children: _jsx(Button, { accessibilityRole: "button", accessibilityLabel: "Done", onPress: closeKeyboard, variant: "ghost", colorScheme: "functional", children: "Done" }) }) }));
7
+ };
8
+ const styles = StyleSheet.create(theme => ({
9
+ accessory: {
10
+ paddingHorizontal: 16,
11
+ paddingVertical: 2,
12
+ alignItems: 'flex-end',
13
+ backgroundColor: theme.color.surface.neutral.strong,
14
+ borderTopWidth: theme.borderWidth[1],
15
+ borderTopColor: theme.color.border.subtle,
16
+ },
17
+ }));
18
+ DatePickerInputDoneButton.DisplayName = 'DatePickerInputDoneButton';
19
+ export default DatePickerInputDoneButton;
@@ -0,0 +1,5 @@
1
+ declare const DatePickerInputDoneButton: {
2
+ (): null;
3
+ DisplayName: string;
4
+ };
5
+ export default DatePickerInputDoneButton;
@@ -0,0 +1,5 @@
1
+ const DatePickerInputDoneButton = () => {
2
+ return null;
3
+ };
4
+ DatePickerInputDoneButton.DisplayName = 'DatePickerInputDoneButton';
5
+ export default DatePickerInputDoneButton;
@@ -0,0 +1,2 @@
1
+ export { default as DatePickerInput } from './DatePickerInput';
2
+ export type { default as DatePickerInputProps } from './DatePickerInput.props';
@@ -0,0 +1 @@
1
+ export { default as DatePickerInput } from './DatePickerInput';
@@ -1,6 +1,6 @@
1
1
  import { TextInputProps } from 'react-native';
2
2
  declare const InputField: {
3
- ({ style, onFocus, onBlur, inBottomSheet, ...props }: TextInputProps & {
3
+ ({ style, inBottomSheet, ...props }: TextInputProps & {
4
4
  inBottomSheet?: boolean;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
6
  displayName: string;
@@ -4,7 +4,7 @@ import { TextInput as RNTextInput } from 'react-native';
4
4
  import { StyleSheet } from 'react-native-unistyles';
5
5
  import { useTheme } from '../../hooks';
6
6
  import { useInputContext } from './Input.context';
7
- const InputField = ({ style, onFocus, onBlur, inBottomSheet = false, ...props }) => {
7
+ const InputField = ({ style, inBottomSheet = false, ...props }) => {
8
8
  const { disabled, focused = false, type } = useInputContext();
9
9
  styles.useVariants({ focused, type });
10
10
  const { color } = useTheme();
@@ -1,6 +1,6 @@
1
1
  import { ViewProps } from 'react-native';
2
2
  declare const InputSlot: {
3
- ({ children, style, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ children, style, accessible, importantForAccessibility, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default InputSlot;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { StyleSheet } from 'react-native-unistyles';
3
2
  import { View } from 'react-native';
4
- const InputSlot = ({ children, style, ...props }) => {
5
- return (_jsx(View, { ...props, style: [styles.container, style], children: children }));
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ const InputSlot = ({ children, style, accessible, importantForAccessibility, ...props }) => {
5
+ return (_jsx(View, { ...props, accessible: accessible ?? false, importantForAccessibility: importantForAccessibility ?? 'auto', style: [styles.container, style], children: children }));
6
6
  };
7
7
  InputSlot.displayName = 'InputSlot';
8
8
  const styles = StyleSheet.create({
@@ -1,7 +1,7 @@
1
1
  import type { LinkProps } from './Link.props';
2
2
  export declare const LinkText: import("react").ForwardRefExoticComponent<import("react-native").TextProps & import("react").RefAttributes<import("react-native").TextProps>>;
3
3
  declare const Link: {
4
- ({ children, icon, disabled, target, iconPosition, showIcon, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
4
+ ({ children, icon, disabled, target, iconPosition, showIcon, textStyle, iconStyle, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default Link;