@utilitywarehouse/hearth-react-native 0.3.1 → 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 (193) hide show
  1. package/.storybook/preview.tsx +3 -0
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/CHANGELOG.md +10 -0
  5. package/build/components/CurrencyInput/CurrencyInput.js +1 -1
  6. package/build/components/DatePicker/DatePicker.context.d.ts +19 -0
  7. package/build/components/DatePicker/DatePicker.context.js +3 -0
  8. package/build/components/DatePicker/DatePicker.d.ts +19 -0
  9. package/build/components/DatePicker/DatePicker.js +479 -0
  10. package/build/components/DatePicker/DatePicker.props.d.ts +125 -0
  11. package/build/components/DatePicker/DatePicker.props.js +1 -0
  12. package/build/components/DatePicker/DatePickerCalendar.d.ts +2 -0
  13. package/build/components/DatePicker/DatePickerCalendar.js +28 -0
  14. package/build/components/DatePicker/DatePickerDay.d.ts +11 -0
  15. package/build/components/DatePicker/DatePickerDay.js +242 -0
  16. package/build/components/DatePicker/DatePickerDays.d.ts +2 -0
  17. package/build/components/DatePicker/DatePickerDays.js +157 -0
  18. package/build/components/DatePicker/DatePickerFooter.d.ts +2 -0
  19. package/build/components/DatePicker/DatePickerFooter.js +23 -0
  20. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +8 -0
  21. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.js +1 -0
  22. package/build/components/DatePicker/DatePickerHeader/DatePickerMonthButton.d.ts +2 -0
  23. package/build/components/DatePicker/DatePickerHeader/DatePickerMonthButton.js +14 -0
  24. package/build/components/DatePicker/DatePickerHeader/DatePickerNextButton.d.ts +2 -0
  25. package/build/components/DatePicker/DatePickerHeader/DatePickerNextButton.js +32 -0
  26. package/build/components/DatePicker/DatePickerHeader/DatePickerPrevButton.d.ts +2 -0
  27. package/build/components/DatePicker/DatePickerHeader/DatePickerPrevButton.js +32 -0
  28. package/build/components/DatePicker/DatePickerHeader/DatePickerSelectors.d.ts +6 -0
  29. package/build/components/DatePicker/DatePickerHeader/DatePickerSelectors.js +64 -0
  30. package/build/components/DatePicker/DatePickerHeader/DatePickerTimeButton.d.ts +1 -0
  31. package/build/components/DatePicker/DatePickerHeader/DatePickerTimeButton.js +22 -0
  32. package/build/components/DatePicker/DatePickerHeader/DatePickerYearButton.d.ts +2 -0
  33. package/build/components/DatePicker/DatePickerHeader/DatePickerYearButton.js +25 -0
  34. package/build/components/DatePicker/DatePickerHeader/index.d.ts +3 -0
  35. package/build/components/DatePicker/DatePickerHeader/index.js +30 -0
  36. package/build/components/DatePicker/DatePickerMonths.d.ts +2 -0
  37. package/build/components/DatePicker/DatePickerMonths.js +69 -0
  38. package/build/components/DatePicker/DatePickerWeekdays.d.ts +8 -0
  39. package/build/components/DatePicker/DatePickerWeekdays.js +26 -0
  40. package/build/components/DatePicker/DatePickerYears.d.ts +2 -0
  41. package/build/components/DatePicker/DatePickerYears.js +83 -0
  42. package/build/components/DatePicker/TimePicker.d.ts +3 -0
  43. package/build/components/DatePicker/TimePicker.js +84 -0
  44. package/build/components/DatePicker/enums.d.ts +12 -0
  45. package/build/components/DatePicker/enums.js +12 -0
  46. package/build/components/DatePicker/index.d.ts +4 -0
  47. package/build/components/DatePicker/index.js +3 -0
  48. package/build/components/DatePicker/polyfill.d.ts +0 -0
  49. package/build/components/DatePicker/polyfill.js +22 -0
  50. package/build/components/DatePicker/time-picker/animated-math.d.ts +4 -0
  51. package/build/components/DatePicker/time-picker/animated-math.js +19 -0
  52. package/build/components/DatePicker/time-picker/period-native.d.ts +6 -0
  53. package/build/components/DatePicker/time-picker/period-native.js +17 -0
  54. package/build/components/DatePicker/time-picker/period-picker.d.ts +6 -0
  55. package/build/components/DatePicker/time-picker/period-picker.js +10 -0
  56. package/build/components/DatePicker/time-picker/period-web.d.ts +6 -0
  57. package/build/components/DatePicker/time-picker/period-web.js +21 -0
  58. package/build/components/DatePicker/time-picker/wheel-native.d.ts +8 -0
  59. package/build/components/DatePicker/time-picker/wheel-native.js +19 -0
  60. package/build/components/DatePicker/time-picker/wheel-picker/index.d.ts +2 -0
  61. package/build/components/DatePicker/time-picker/wheel-picker/index.js +2 -0
  62. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.d.ts +16 -0
  63. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.js +97 -0
  64. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.d.ts +21 -0
  65. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.js +88 -0
  66. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.d.ts +23 -0
  67. package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.js +21 -0
  68. package/build/components/DatePicker/time-picker/wheel-web.d.ts +8 -0
  69. package/build/components/DatePicker/time-picker/wheel-web.js +148 -0
  70. package/build/components/DatePicker/time-picker/wheel.d.ts +8 -0
  71. package/build/components/DatePicker/time-picker/wheel.js +10 -0
  72. package/build/components/DatePicker/utils.d.ts +212 -0
  73. package/build/components/DatePicker/utils.js +391 -0
  74. package/build/components/DatePickerInput/DatePickerInput.d.ts +6 -0
  75. package/build/components/DatePickerInput/DatePickerInput.js +126 -0
  76. package/build/components/DatePickerInput/DatePickerInput.props.d.ts +47 -0
  77. package/build/components/DatePickerInput/DatePickerInput.props.js +1 -0
  78. package/build/components/DatePickerInput/DatePickerInputDoneButton.d.ts +8 -0
  79. package/build/components/DatePickerInput/DatePickerInputDoneButton.js +19 -0
  80. package/build/components/DatePickerInput/DatePickerInputDoneButton.web.d.ts +5 -0
  81. package/build/components/DatePickerInput/DatePickerInputDoneButton.web.js +5 -0
  82. package/build/components/DatePickerInput/index.d.ts +2 -0
  83. package/build/components/DatePickerInput/index.js +1 -0
  84. package/build/components/Input/InputField.d.ts +1 -1
  85. package/build/components/Input/InputField.js +1 -1
  86. package/build/components/Input/InputSlot.d.ts +1 -1
  87. package/build/components/Input/InputSlot.js +3 -3
  88. package/build/components/UnstyledIconButton/UnstyledIconButton.js +2 -2
  89. package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
  90. package/build/components/index.d.ts +2 -0
  91. package/build/components/index.js +2 -0
  92. package/build/hooks/index.d.ts +4 -3
  93. package/build/hooks/index.js +4 -3
  94. package/build/hooks/usePrevious.d.ts +1 -0
  95. package/build/hooks/usePrevious.js +8 -0
  96. package/build/hooks/useTheme.d.ts +2 -1
  97. package/build/hooks/useTheme.js +2 -2
  98. package/build/tokens/components/dark/date-picker.d.ts +1 -0
  99. package/build/tokens/components/dark/date-picker.js +1 -0
  100. package/build/tokens/components/dark/illustrations.d.ts +7 -0
  101. package/build/tokens/components/dark/illustrations.js +6 -0
  102. package/build/tokens/components/dark/index.d.ts +1 -0
  103. package/build/tokens/components/dark/index.js +1 -0
  104. package/build/tokens/components/dark/segmented-control.d.ts +2 -2
  105. package/build/tokens/components/dark/segmented-control.js +2 -2
  106. package/build/tokens/components/dark/table.d.ts +3 -0
  107. package/build/tokens/components/dark/table.js +3 -0
  108. package/build/tokens/components/light/date-picker.d.ts +1 -0
  109. package/build/tokens/components/light/date-picker.js +1 -0
  110. package/build/tokens/components/light/illustrations.d.ts +7 -0
  111. package/build/tokens/components/light/illustrations.js +6 -0
  112. package/build/tokens/components/light/index.d.ts +1 -0
  113. package/build/tokens/components/light/index.js +1 -0
  114. package/build/tokens/components/light/segmented-control.d.ts +2 -2
  115. package/build/tokens/components/light/segmented-control.js +2 -2
  116. package/build/tokens/components/light/table.d.ts +3 -0
  117. package/build/tokens/components/light/table.js +3 -0
  118. package/build/utils/index.d.ts +1 -0
  119. package/build/utils/index.js +1 -0
  120. package/build/utils/isEqual.d.ts +2 -0
  121. package/build/utils/isEqual.js +29 -0
  122. package/chromatic.config.json +6 -0
  123. package/docs/components/AllComponents.web.tsx +43 -1
  124. package/docs/components/ViewWrap.tsx +32 -0
  125. package/docs/components/index.ts +1 -0
  126. package/docs/getting-started.mdx +6 -6
  127. package/package.json +10 -7
  128. package/src/components/CurrencyInput/CurrencyInput.tsx +2 -1
  129. package/src/components/DatePicker/DatePicker.context.ts +23 -0
  130. package/src/components/DatePicker/DatePicker.docs.mdx +239 -0
  131. package/src/components/DatePicker/DatePicker.props.ts +139 -0
  132. package/src/components/DatePicker/DatePicker.stories.tsx +98 -0
  133. package/src/components/DatePicker/DatePicker.tsx +669 -0
  134. package/src/components/DatePicker/DatePickerCalendar.tsx +41 -0
  135. package/src/components/DatePicker/DatePickerDay.tsx +302 -0
  136. package/src/components/DatePicker/DatePickerDays.tsx +241 -0
  137. package/src/components/DatePicker/DatePickerFooter.tsx +35 -0
  138. package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +10 -0
  139. package/src/components/DatePicker/DatePickerHeader/DatePickerMonthButton.tsx +29 -0
  140. package/src/components/DatePicker/DatePickerHeader/DatePickerNextButton.tsx +46 -0
  141. package/src/components/DatePicker/DatePickerHeader/DatePickerPrevButton.tsx +46 -0
  142. package/src/components/DatePicker/DatePickerHeader/DatePickerSelectors.tsx +96 -0
  143. package/src/components/DatePicker/DatePickerHeader/DatePickerTimeButton.tsx +48 -0
  144. package/src/components/DatePicker/DatePickerHeader/DatePickerYearButton.tsx +50 -0
  145. package/src/components/DatePicker/DatePickerHeader/index.tsx +64 -0
  146. package/src/components/DatePicker/DatePickerMonths.tsx +101 -0
  147. package/src/components/DatePicker/DatePickerWeekdays.tsx +49 -0
  148. package/src/components/DatePicker/DatePickerYears.tsx +119 -0
  149. package/src/components/DatePicker/TimePicker.tsx +141 -0
  150. package/src/components/DatePicker/enums.ts +14 -0
  151. package/src/components/DatePicker/index.ts +13 -0
  152. package/src/components/DatePicker/polyfill.ts +21 -0
  153. package/src/components/DatePicker/time-picker/animated-math.ts +33 -0
  154. package/src/components/DatePicker/time-picker/period-native.tsx +34 -0
  155. package/src/components/DatePicker/time-picker/period-picker.tsx +16 -0
  156. package/src/components/DatePicker/time-picker/period-web.tsx +36 -0
  157. package/src/components/DatePicker/time-picker/wheel-native.tsx +37 -0
  158. package/src/components/DatePicker/time-picker/wheel-picker/index.ts +3 -0
  159. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.tsx +132 -0
  160. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.ts +22 -0
  161. package/src/components/DatePicker/time-picker/wheel-picker/wheel-picker.tsx +200 -0
  162. package/src/components/DatePicker/time-picker/wheel-web.tsx +181 -0
  163. package/src/components/DatePicker/time-picker/wheel.tsx +18 -0
  164. package/src/components/DatePicker/utils.ts +549 -0
  165. package/src/components/DatePickerInput/DatePickerInput.docs.mdx +237 -0
  166. package/src/components/DatePickerInput/DatePickerInput.props.ts +50 -0
  167. package/src/components/DatePickerInput/DatePickerInput.stories.tsx +178 -0
  168. package/src/components/DatePickerInput/DatePickerInput.tsx +265 -0
  169. package/src/components/DatePickerInput/DatePickerInputDoneButton.tsx +42 -0
  170. package/src/components/DatePickerInput/DatePickerInputDoneButton.web.tsx +7 -0
  171. package/src/components/DatePickerInput/index.ts +2 -0
  172. package/src/components/Icon/Icon.stories.tsx +4 -3
  173. package/src/components/Input/InputField.tsx +0 -2
  174. package/src/components/Input/InputSlot.tsx +14 -3
  175. package/src/components/Modal/Modal.stories.tsx +2 -30
  176. package/src/components/UnstyledIconButton/UnstyledIconButton.tsx +14 -2
  177. package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +7 -3
  178. package/src/components/index.ts +2 -0
  179. package/src/hooks/index.ts +4 -3
  180. package/src/hooks/usePrevious.ts +9 -0
  181. package/src/hooks/useTheme.ts +4 -3
  182. package/src/tokens/components/dark/date-picker.ts +1 -0
  183. package/src/tokens/components/dark/illustrations.ts +7 -0
  184. package/src/tokens/components/dark/index.ts +1 -0
  185. package/src/tokens/components/dark/segmented-control.ts +2 -2
  186. package/src/tokens/components/dark/table.ts +3 -0
  187. package/src/tokens/components/light/date-picker.ts +1 -0
  188. package/src/tokens/components/light/illustrations.ts +7 -0
  189. package/src/tokens/components/light/index.ts +1 -0
  190. package/src/tokens/components/light/segmented-control.ts +2 -2
  191. package/src/tokens/components/light/table.ts +3 -0
  192. package/src/utils/index.ts +1 -0
  193. package/src/utils/isEqual.ts +30 -0
@@ -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({
@@ -17,10 +17,10 @@ UnstyledIconButtonSpinner.displayName = 'UnstyledIconButtonSpinner';
17
17
  UnstyledIconButtonIcon.displayName = 'UnstyledIconButtonIcon';
18
18
  const UnstyledIconButton = ({ icon, disabled = false, pressed, size = 'md', inverted = false, iconStyle, ...props }) => {
19
19
  const { disabled: groupDisabled, loading: groupLoading } = useButtonGroupContext();
20
- const { loading } = props;
20
+ const { loading, accessibilityRole = 'button', accessible = true, focusable = true, importantForAccessibility = 'yes', ...restProps } = props;
21
21
  const isLoading = loading ?? groupLoading;
22
22
  const buttonDisabled = isLoading || (disabled ?? groupDisabled);
23
- return (_jsx(UnstyledIconButtonComponent, { ...props, size: size, inverted: inverted, isDisabled: buttonDisabled, isPressed: pressed, icon: icon, children: loading ? (_jsx(UnstyledIconButtonSpinner, {})) : (_jsx(UnstyledIconButtonIcon, { as: icon, style: iconStyle })) }));
23
+ return (_jsx(UnstyledIconButtonComponent, { ...restProps, size: size, inverted: inverted, isDisabled: buttonDisabled, isPressed: pressed, accessibilityRole: accessibilityRole, accessible: accessible, focusable: focusable, importantForAccessibility: importantForAccessibility, icon: icon, children: loading ? (_jsx(UnstyledIconButtonSpinner, {})) : (_jsx(UnstyledIconButtonIcon, { as: icon, style: iconStyle })) }));
24
24
  };
25
25
  UnstyledIconButton.displayName = 'UnstyledIconButton';
26
26
  export default UnstyledIconButton;
@@ -7,7 +7,7 @@ const UnstyledIconButtonRoot = ({ size, inverted, states, ...props }) => {
7
7
  const { active, disabled } = states || {};
8
8
  styles.useVariants({ disabled, size });
9
9
  const value = useMemo(() => ({ disabled, active, inverted, size }), [disabled, active, inverted, size]);
10
- return (_jsx(UnstyledIconButtonContext.Provider, { value: value, children: _jsx(Pressable, { ...props, style: [styles.container, props.style] }) }));
10
+ return (_jsx(UnstyledIconButtonContext.Provider, { value: value, children: _jsx(Pressable, { ...props, accessibilityState: { disabled: !!disabled, ...props.accessibilityState }, style: [styles.container, props.style] }) }));
11
11
  };
12
12
  UnstyledIconButtonRoot.displayName = 'UnstyledIconButtonRoot';
13
13
  const styles = StyleSheet.create(theme => ({
@@ -9,6 +9,8 @@ export * from './Card';
9
9
  export * from './Center';
10
10
  export * from './Checkbox';
11
11
  export * from './CurrencyInput';
12
+ export * from './DatePicker';
13
+ export * from './DatePickerInput';
12
14
  export * from './DescriptionList';
13
15
  export * from './DetailText';
14
16
  export * from './Divider';
@@ -10,6 +10,8 @@ export * from './Card';
10
10
  export * from './Center';
11
11
  export * from './Checkbox';
12
12
  export * from './CurrencyInput';
13
+ export * from './DatePicker';
14
+ export * from './DatePickerInput';
13
15
  export * from './DescriptionList';
14
16
  export * from './DetailText';
15
17
  export * from './Divider';
@@ -1,6 +1,7 @@
1
- export { default as useColorMode } from './useColorMode';
2
1
  export { default as useBreakpointValue } from './useBreakpointValue';
3
- export { default as useTheme } from './useTheme';
2
+ export { default as useColorMode } from './useColorMode';
4
3
  export { default as useMedia } from './useMedia';
5
- export { default as useToken } from './useToken';
4
+ export { usePrevious } from './usePrevious';
6
5
  export { useStyleProps } from './useStyleProps';
6
+ export { default as useTheme } from './useTheme';
7
+ export { default as useToken } from './useToken';
@@ -1,6 +1,7 @@
1
- export { default as useColorMode } from './useColorMode';
2
1
  export { default as useBreakpointValue } from './useBreakpointValue';
3
- export { default as useTheme } from './useTheme';
2
+ export { default as useColorMode } from './useColorMode';
4
3
  export { default as useMedia } from './useMedia';
5
- export { default as useToken } from './useToken';
4
+ export { usePrevious } from './usePrevious';
6
5
  export { useStyleProps } from './useStyleProps';
6
+ export { default as useTheme } from './useTheme';
7
+ export { default as useToken } from './useToken';
@@ -0,0 +1 @@
1
+ export declare const usePrevious: (value: any) => null;
@@ -0,0 +1,8 @@
1
+ import { useEffect, useRef } from 'react';
2
+ export const usePrevious = (value) => {
3
+ const ref = useRef(null);
4
+ useEffect(() => {
5
+ ref.current = value;
6
+ });
7
+ return ref.current;
8
+ };
@@ -1,2 +1,3 @@
1
- declare const useTheme: () => import("react-native-unistyles/lib/typescript/src/types").UnistylesTheme;
1
+ import { AppThemes } from '../types';
2
+ declare const useTheme: () => AppThemes["light"] | AppThemes["dark"];
2
3
  export default useTheme;
@@ -1,6 +1,6 @@
1
- import { UnistylesRuntime } from 'react-native-unistyles';
1
+ import { useUnistyles } from 'react-native-unistyles';
2
2
  const useTheme = () => {
3
- const theme = UnistylesRuntime.getTheme();
3
+ const { theme } = useUnistyles();
4
4
  return theme;
5
5
  };
6
6
  export default useTheme;
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  readonly item: {
21
21
  readonly borderRadius: 8;
22
22
  readonly minWidth: 32;
23
+ readonly rangeBackground: "#191919";
23
24
  readonly roundelBackgroundColorInverted: "#fcfbf2";
24
25
  readonly roundelHeight: 6;
25
26
  readonly roundelWidth: 6;
@@ -20,6 +20,7 @@ export default {
20
20
  item: {
21
21
  borderRadius: 8,
22
22
  minWidth: 32,
23
+ rangeBackground: '#191919',
23
24
  roundelBackgroundColorInverted: '#fcfbf2',
24
25
  roundelHeight: 6,
25
26
  roundelWidth: 6,
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ declare const _default: {
5
+ readonly mode: "dark";
6
+ };
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ export default {
5
+ mode: 'dark',
6
+ };
@@ -21,6 +21,7 @@ export { default as expandableCard } from './expandable-card';
21
21
  export { default as formField } from './form-field';
22
22
  export { default as iconButton } from './icon-button';
23
23
  export { default as iconContainer } from './icon-container';
24
+ export { default as illustrations } from './illustrations';
24
25
  export { default as indicatorIconButton } from './indicator-icon-button';
25
26
  export { default as inlineLink } from './inline-link';
26
27
  export { default as input } from './input';
@@ -21,6 +21,7 @@ export { default as expandableCard } from './expandable-card';
21
21
  export { default as formField } from './form-field';
22
22
  export { default as iconButton } from './icon-button';
23
23
  export { default as iconContainer } from './icon-container';
24
+ export { default as illustrations } from './illustrations';
24
25
  export { default as indicatorIconButton } from './indicator-icon-button';
25
26
  export { default as inlineLink } from './inline-link';
26
27
  export { default as input } from './input';
@@ -2,10 +2,10 @@
2
2
  * Do not edit directly, this file was auto-generated.
3
3
  */
4
4
  declare const _default: {
5
- readonly borderRadius: 6;
5
+ readonly borderRadius: 9999;
6
6
  readonly gap: 6;
7
7
  readonly group: {
8
- readonly borderRadius: 8;
8
+ readonly borderRadius: 9999;
9
9
  readonly borderWidth: 1;
10
10
  readonly gap: 4;
11
11
  readonly height: 48;
@@ -2,10 +2,10 @@
2
2
  * Do not edit directly, this file was auto-generated.
3
3
  */
4
4
  export default {
5
- borderRadius: 6,
5
+ borderRadius: 9999,
6
6
  gap: 6,
7
7
  group: {
8
- borderRadius: 8,
8
+ borderRadius: 9999,
9
9
  borderWidth: 1,
10
10
  gap: 4,
11
11
  height: 48,
@@ -13,6 +13,9 @@ declare const _default: {
13
13
  readonly headerCell: {
14
14
  readonly borderWidth: 2;
15
15
  readonly gap: 8;
16
+ readonly neutral: {
17
+ readonly backgroundColor: "#30302c";
18
+ };
16
19
  readonly paddingHorizontal: 12;
17
20
  readonly paddingVertical: 16;
18
21
  };
@@ -13,6 +13,9 @@ export default {
13
13
  headerCell: {
14
14
  borderWidth: 2,
15
15
  gap: 8,
16
+ neutral: {
17
+ backgroundColor: '#30302c',
18
+ },
16
19
  paddingHorizontal: 12,
17
20
  paddingVertical: 16,
18
21
  },
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  readonly item: {
21
21
  readonly borderRadius: 8;
22
22
  readonly minWidth: 32;
23
+ readonly rangeBackground: "#f7f7f7";
23
24
  readonly roundelBackgroundColorInverted: "#fcfbf2";
24
25
  readonly roundelHeight: 6;
25
26
  readonly roundelWidth: 6;
@@ -20,6 +20,7 @@ export default {
20
20
  item: {
21
21
  borderRadius: 8,
22
22
  minWidth: 32,
23
+ rangeBackground: '#f7f7f7',
23
24
  roundelBackgroundColorInverted: '#fcfbf2',
24
25
  roundelHeight: 6,
25
26
  roundelWidth: 6,
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ declare const _default: {
5
+ readonly mode: "light";
6
+ };
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ export default {
5
+ mode: 'light',
6
+ };
@@ -21,6 +21,7 @@ export { default as expandableCard } from './expandable-card';
21
21
  export { default as formField } from './form-field';
22
22
  export { default as iconButton } from './icon-button';
23
23
  export { default as iconContainer } from './icon-container';
24
+ export { default as illustrations } from './illustrations';
24
25
  export { default as indicatorIconButton } from './indicator-icon-button';
25
26
  export { default as inlineLink } from './inline-link';
26
27
  export { default as input } from './input';
@@ -21,6 +21,7 @@ export { default as expandableCard } from './expandable-card';
21
21
  export { default as formField } from './form-field';
22
22
  export { default as iconButton } from './icon-button';
23
23
  export { default as iconContainer } from './icon-container';
24
+ export { default as illustrations } from './illustrations';
24
25
  export { default as indicatorIconButton } from './indicator-icon-button';
25
26
  export { default as inlineLink } from './inline-link';
26
27
  export { default as input } from './input';
@@ -2,10 +2,10 @@
2
2
  * Do not edit directly, this file was auto-generated.
3
3
  */
4
4
  declare const _default: {
5
- readonly borderRadius: 6;
5
+ readonly borderRadius: 9999;
6
6
  readonly gap: 6;
7
7
  readonly group: {
8
- readonly borderRadius: 8;
8
+ readonly borderRadius: 9999;
9
9
  readonly borderWidth: 1;
10
10
  readonly gap: 4;
11
11
  readonly height: 48;
@@ -2,10 +2,10 @@
2
2
  * Do not edit directly, this file was auto-generated.
3
3
  */
4
4
  export default {
5
- borderRadius: 6,
5
+ borderRadius: 9999,
6
6
  gap: 6,
7
7
  group: {
8
- borderRadius: 8,
8
+ borderRadius: 9999,
9
9
  borderWidth: 1,
10
10
  gap: 4,
11
11
  height: 48,
@@ -13,6 +13,9 @@ declare const _default: {
13
13
  readonly headerCell: {
14
14
  readonly borderWidth: 2;
15
15
  readonly gap: 8;
16
+ readonly neutral: {
17
+ readonly backgroundColor: "#f1efe4";
18
+ };
16
19
  readonly paddingHorizontal: 12;
17
20
  readonly paddingVertical: 16;
18
21
  };
@@ -13,6 +13,9 @@ export default {
13
13
  headerCell: {
14
14
  borderWidth: 2,
15
15
  gap: 8,
16
+ neutral: {
17
+ backgroundColor: '#f1efe4',
18
+ },
16
19
  paddingHorizontal: 12,
17
20
  paddingVertical: 16,
18
21
  },
@@ -3,4 +3,5 @@ export { default as formatThousands } from './formatThousands';
3
3
  export { default as getFlattenedColorValue } from './getFlattenedColorValue';
4
4
  export { default as getStyleValue } from './getStyleValue';
5
5
  export { default as hexWithOpacity } from './hexWithOpacity';
6
+ export { default as isEqual } from './isEqual';
6
7
  export * from './styleUtils';
@@ -3,4 +3,5 @@ export { default as formatThousands } from './formatThousands';
3
3
  export { default as getFlattenedColorValue } from './getFlattenedColorValue';
4
4
  export { default as getStyleValue } from './getStyleValue';
5
5
  export { default as hexWithOpacity } from './hexWithOpacity';
6
+ export { default as isEqual } from './isEqual';
6
7
  export * from './styleUtils';
@@ -0,0 +1,2 @@
1
+ declare const isEqual: (a: any, b: any) => boolean;
2
+ export default isEqual;
@@ -0,0 +1,29 @@
1
+ const isEqual = (a, b) => {
2
+ if (a === b)
3
+ return true;
4
+ if (typeof a !== typeof b)
5
+ return false;
6
+ if (typeof a !== 'object' || a === null || b === null)
7
+ return false;
8
+ if (Array.isArray(a) !== Array.isArray(b))
9
+ return false;
10
+ if (Array.isArray(a)) {
11
+ if (a.length !== b.length)
12
+ return false;
13
+ for (let i = 0; i < a.length; i++) {
14
+ if (!isEqual(a[i], b[i]))
15
+ return false;
16
+ }
17
+ return true;
18
+ }
19
+ const keysA = Object.keys(a);
20
+ const keysB = Object.keys(b);
21
+ if (keysA.length !== keysB.length)
22
+ return false;
23
+ for (const key of keysA) {
24
+ if (!keysB.includes(key) || !isEqual(a[key], b[key]))
25
+ return false;
26
+ }
27
+ return true;
28
+ };
29
+ export default isEqual;
@@ -0,0 +1,6 @@
1
+ {
2
+ "onlyChanged": true,
3
+ "projectId": "Project:68e3ad5c6e80b57678cad6c6",
4
+ "storybookBaseDir": "packages/react-native",
5
+ "zip": true
6
+ }