@utilitywarehouse/hearth-react-native 0.36.1 → 0.36.3
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.
- package/SKILL.md +27 -16
- package/build/components/Accordion/Accordion.d.ts +4 -0
- package/build/components/Accordion/Accordion.js +4 -0
- package/build/components/Accordion/Accordion.props.d.ts +2 -0
- package/build/components/Alert/Alert.d.ts +4 -0
- package/build/components/Alert/Alert.js +4 -0
- package/build/components/Avatar/Avatar.d.ts +4 -0
- package/build/components/Avatar/Avatar.js +4 -0
- package/build/components/Badge/Badge.d.ts +4 -0
- package/build/components/Badge/Badge.js +4 -0
- package/build/components/Badge/Badge.props.d.ts +19 -0
- package/build/components/Banner/Banner.d.ts +5 -0
- package/build/components/Banner/Banner.js +5 -0
- package/build/components/Banner/BannerIllustration.d.ts +4 -0
- package/build/components/Banner/BannerIllustration.js +4 -0
- package/build/components/Banner/BannerImage.d.ts +4 -0
- package/build/components/Banner/BannerImage.js +4 -0
- package/build/components/BodyText/BodyText.d.ts +4 -0
- package/build/components/BodyText/BodyText.js +4 -0
- package/build/components/BottomSheet/BottomSheet.d.ts +6 -0
- package/build/components/BottomSheet/BottomSheet.js +6 -0
- package/build/components/BottomSheet/BottomSheet.props.d.ts +2 -0
- package/build/components/Box/Box.d.ts +4 -0
- package/build/components/Box/Box.js +4 -0
- package/build/components/Box/Box.props.d.ts +2 -0
- package/build/components/Button/Button.d.ts +4 -0
- package/build/components/Button/Button.js +4 -0
- package/build/components/Button/Button.props.d.ts +129 -0
- package/build/components/Card/Card.d.ts +4 -0
- package/build/components/Card/Card.js +4 -0
- package/build/components/Card/Card.props.d.ts +19 -1
- package/build/components/Card/CardAction/CardAction.d.ts +4 -0
- package/build/components/Card/CardAction/CardAction.js +4 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +23 -0
- package/build/components/Card/CardPressHandler.d.ts +8 -3
- package/build/components/Card/CardPressHandler.js +3 -0
- package/build/components/Carousel/Carousel.d.ts +3 -0
- package/build/components/Carousel/Carousel.js +3 -0
- package/build/components/Carousel/Carousel.props.d.ts +37 -0
- package/build/components/Center/Center.d.ts +3 -0
- package/build/components/Center/Center.js +3 -0
- package/build/components/Checkbox/Checkbox.d.ts +3 -0
- package/build/components/Checkbox/Checkbox.js +3 -0
- package/build/components/Checkbox/Checkbox.props.d.ts +20 -0
- package/build/components/Checkbox/CheckboxGroup.d.ts +3 -0
- package/build/components/Checkbox/CheckboxGroup.js +3 -0
- package/build/components/Checkbox/CheckboxGroup.props.d.ts +24 -0
- package/build/components/Combobox/Combobox.d.ts +3 -0
- package/build/components/Combobox/Combobox.js +3 -0
- package/build/components/Container/Container.d.ts +3 -0
- package/build/components/Container/Container.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/build/components/CurrencyInput/CurrencyInput.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +25 -0
- package/build/components/DateInput/DateInput.d.ts +4 -0
- package/build/components/DateInput/DateInput.js +4 -0
- package/build/components/DateInput/DateInput.props.d.ts +3 -0
- package/build/components/DatePicker/DatePicker.context.d.ts +1 -0
- package/build/components/DatePicker/DatePicker.d.ts +14 -0
- package/build/components/DatePicker/DatePicker.js +31 -0
- package/build/components/DatePicker/DatePicker.props.d.ts +78 -0
- package/build/components/DatePicker/DatePickerFooter.js +6 -2
- package/build/components/DatePickerInput/DatePickerInput.d.ts +5 -1
- package/build/components/DatePickerInput/DatePickerInput.js +15 -5
- package/build/components/DatePickerInput/DatePickerInput.props.d.ts +28 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +4 -0
- package/build/components/DescriptionList/DescriptionList.js +4 -0
- package/build/components/DescriptionList/DescriptionList.props.d.ts +4 -0
- package/build/components/DetailText/DetailText.d.ts +4 -0
- package/build/components/DetailText/DetailText.js +4 -0
- package/build/components/Divider/Divider.d.ts +4 -0
- package/build/components/Divider/Divider.js +4 -0
- package/build/components/Divider/Divider.props.d.ts +10 -0
- package/build/components/Expandable/Expandable.d.ts +5 -0
- package/build/components/Expandable/Expandable.js +5 -0
- package/build/components/ExpandableCard/ExpandableCard.d.ts +4 -0
- package/build/components/ExpandableCard/ExpandableCard.js +4 -0
- package/build/components/Flex/Flex.d.ts +4 -0
- package/build/components/Flex/Flex.js +4 -0
- package/build/components/Flex/Flex.props.d.ts +20 -0
- package/build/components/FormField/FormField.d.ts +5 -0
- package/build/components/FormField/FormField.js +5 -0
- package/build/components/FormField/FormField.props.d.ts +24 -0
- package/build/components/Grid/Grid.d.ts +4 -0
- package/build/components/Grid/Grid.js +4 -0
- package/build/components/HTMLElements/ListItem.d.ts +5 -0
- package/build/components/HTMLElements/OrderedList.d.ts +10 -0
- package/build/components/HTMLElements/OrderedList.js +4 -0
- package/build/components/HTMLElements/UnorderedList.d.ts +10 -0
- package/build/components/HTMLElements/UnorderedList.js +4 -0
- package/build/components/Heading/Heading.d.ts +4 -0
- package/build/components/Heading/Heading.js +4 -0
- package/build/components/HighlightBanner/HighlightBanner.d.ts +5 -0
- package/build/components/HighlightBanner/HighlightBanner.js +5 -0
- package/build/components/HighlightBanner/HighlightBanner.props.d.ts +14 -0
- package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
- package/build/components/HighlightBanner/HighlightBannerImage.js +4 -0
- package/build/components/Icon/Icon.d.ts +4 -0
- package/build/components/Icon/Icon.js +4 -0
- package/build/components/Icon/Icon.props.d.ts +8 -0
- package/build/components/IconButton/IconButton.d.ts +5 -0
- package/build/components/IconButton/IconButton.js +5 -0
- package/build/components/IconButton/IconButton.props.d.ts +9 -0
- package/build/components/IconContainer/IconContainer.d.ts +4 -0
- package/build/components/IconContainer/IconContainer.js +4 -0
- package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
- package/build/components/IndicatorIconButton/IndicatorIconButton.js +6 -0
- package/build/components/InlineLink/InlineLink.d.ts +1 -0
- package/build/components/InlineLink/InlineLink.js +1 -0
- package/build/components/InlineLink/InlineLink.props.d.ts +4 -0
- package/build/components/Input/Input.d.ts +5 -0
- package/build/components/Input/Input.js +5 -0
- package/build/components/Input/Input.props.d.ts +54 -0
- package/build/components/Link/Link.d.ts +5 -0
- package/build/components/Link/Link.js +5 -0
- package/build/components/Link/Link.props.d.ts +15 -0
- package/build/components/List/List.d.ts +1 -0
- package/build/components/List/List.js +1 -0
- package/build/components/List/List.props.d.ts +8 -0
- package/build/components/Menu/Menu.d.ts +1 -0
- package/build/components/Menu/Menu.js +1 -0
- package/build/components/Modal/Modal.d.ts +5 -0
- package/build/components/Modal/Modal.js +5 -0
- package/build/components/Modal/Modal.props.d.ts +6 -0
- package/build/components/Modal/Modal.shared.types.d.ts +32 -0
- package/build/components/Modal/ModalImage.d.ts +1 -0
- package/build/components/Modal/ModalImage.js +1 -0
- package/build/components/NavModal/NavModal.d.ts +8 -0
- package/build/components/NavModal/NavModal.js +8 -0
- package/build/components/NavModal/NavModal.props.d.ts +10 -0
- package/build/components/Pagination/Pagination.d.ts +5 -0
- package/build/components/Pagination/Pagination.js +5 -0
- package/build/components/PillGroup/Pill.d.ts +1 -0
- package/build/components/PillGroup/Pill.js +1 -0
- package/build/components/PillGroup/PillGroup.d.ts +5 -0
- package/build/components/PillGroup/PillGroup.js +5 -0
- package/build/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/build/components/ProgressBar/ProgressBar.js +5 -0
- package/build/components/ProgressBar/ProgressBar.props.d.ts +4 -0
- package/build/components/ProgressStepper/ProgressStep.d.ts +13 -0
- package/build/components/ProgressStepper/ProgressStep.js +5 -0
- package/build/components/ProgressStepper/ProgressStepper.d.ts +5 -0
- package/build/components/ProgressStepper/ProgressStepper.js +5 -0
- package/build/components/Radio/Radio.d.ts +5 -0
- package/build/components/Radio/Radio.js +5 -0
- package/build/components/Radio/Radio.props.d.ts +17 -0
- package/build/components/Radio/RadioGroup.d.ts +5 -0
- package/build/components/Radio/RadioGroup.js +5 -0
- package/build/components/Radio/RadioGroup.props.d.ts +25 -0
- package/build/components/RadioCard/RadioCard.d.ts +10 -0
- package/build/components/RadioCard/RadioCard.js +10 -0
- package/build/components/RadioCard/RadioCard.props.d.ts +14 -0
- package/build/components/RadioCard/RadioCardGroup.d.ts +4 -0
- package/build/components/RadioCard/RadioCardGroup.js +4 -0
- package/build/components/RadioCard/RadioCardGroup.props.d.ts +17 -0
- package/build/components/Rating/Rating.d.ts +5 -0
- package/build/components/Rating/Rating.js +5 -0
- package/build/components/Roundel/Roundel.d.ts +1 -0
- package/build/components/Roundel/Roundel.js +1 -0
- package/build/components/SectionHeader/SectionHeader.d.ts +1 -0
- package/build/components/SectionHeader/SectionHeader.js +1 -0
- package/build/components/SectionHeader/SectionHeader.props.d.ts +7 -0
- package/build/components/SegmentedControl/SegmentedControl.d.ts +5 -0
- package/build/components/SegmentedControl/SegmentedControl.js +5 -0
- package/build/components/Select/Select.d.ts +5 -0
- package/build/components/Select/Select.js +5 -0
- package/build/components/Skeleton/Skeleton.d.ts +1 -0
- package/build/components/Skeleton/Skeleton.js +1 -0
- package/build/components/Skeleton/Skeleton.props.d.ts +4 -0
- package/build/components/Spinner/Spinner.d.ts +4 -0
- package/build/components/Spinner/Spinner.js +8 -0
- package/build/components/Spinner/Spinner.props.d.ts +5 -0
- package/build/components/Spinner/Spinner.web.d.ts +4 -0
- package/build/components/Spinner/Spinner.web.js +8 -0
- package/build/components/StepperInput/StepperInput.d.ts +4 -0
- package/build/components/StepperInput/StepperInput.js +4 -0
- package/build/components/StepperInput/StepperInput.props.d.ts +44 -0
- package/build/components/Switch/Switch.d.ts +4 -0
- package/build/components/Switch/Switch.js +4 -0
- package/build/components/Switch/Switch.props.d.ts +5 -0
- package/build/components/Table/Table.d.ts +4 -0
- package/build/components/Table/Table.js +4 -0
- package/build/components/Table/Table.props.d.ts +6 -0
- package/build/components/Table/TableHeader.d.ts +3 -0
- package/build/components/Table/TableHeader.js +3 -0
- package/build/components/Table/TableHeaderCell.d.ts +6 -0
- package/build/components/Table/TableHeaderCell.js +3 -0
- package/build/components/Tabs/Tabs.d.ts +5 -0
- package/build/components/Tabs/Tabs.js +5 -0
- package/build/components/Textarea/Textarea.d.ts +6 -0
- package/build/components/Textarea/Textarea.js +6 -0
- package/build/components/Textarea/Textarea.props.d.ts +14 -0
- package/build/components/TimePicker/TimePicker.d.ts +5 -0
- package/build/components/TimePicker/TimePicker.js +14 -1
- package/build/components/TimePicker/TimePickerView.js +5 -19
- package/build/components/TimePicker/TimePickerWheel.web.js +11 -2
- package/build/components/TimePicker/utils.d.ts +9 -0
- package/build/components/TimePicker/utils.js +30 -0
- package/build/components/TimePicker/utils.test.d.ts +1 -0
- package/build/components/TimePicker/utils.test.js +31 -0
- package/build/components/TimePickerInput/TimePickerInput.d.ts +6 -1
- package/build/components/TimePickerInput/TimePickerInput.js +16 -5
- package/build/components/TimePickerInput/TimePickerInput.props.d.ts +35 -0
- package/build/components/Timeline/Timeline.d.ts +5 -0
- package/build/components/Timeline/Timeline.js +5 -0
- package/build/components/Timeline/TimelineItem.d.ts +4 -0
- package/build/components/Timeline/TimelineItem.js +4 -0
- package/build/components/Toast/Toast.context.d.ts +4 -0
- package/build/components/Toast/Toast.context.js +4 -0
- package/build/components/Toast/Toast.props.d.ts +7 -0
- package/build/components/ToggleButton/ToggleButton.d.ts +4 -0
- package/build/components/ToggleButton/ToggleButton.js +4 -0
- package/build/components/ToggleButton/ToggleButton.props.d.ts +6 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.d.ts +8 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.js +8 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.props.d.ts +9 -0
- package/build/components/ToggleButtonCard/ToggleButtonCardGroup.props.d.ts +15 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.d.ts +5 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.js +5 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +17 -0
- package/build/components/VerificationInput/VerificationInput.d.ts +4 -0
- package/build/components/VerificationInput/VerificationInput.js +4 -0
- package/package.json +8 -5
- package/public/llms/components/date-picker.md +7 -1
- package/public/llms/components/time-picker.md +1 -0
- package/public/llms/docs/introduction.md +1 -1
|
@@ -77,45 +77,123 @@ export type MultiChange = (params: {
|
|
|
77
77
|
}) => void;
|
|
78
78
|
export type Styles = Partial<ViewStyle | TextStyle | ImageStyle>;
|
|
79
79
|
export interface DatePickerBaseProps {
|
|
80
|
+
/**
|
|
81
|
+
* Controls whether the picker returns a single date, a date range, or multiple dates.
|
|
82
|
+
* @default 'single'
|
|
83
|
+
*/
|
|
80
84
|
mode?: CalendarMode;
|
|
85
|
+
/** IANA time zone identifier used to normalise and compare dates. */
|
|
81
86
|
timeZone?: string;
|
|
87
|
+
/** The selected date, used in single mode. */
|
|
82
88
|
date?: DateType;
|
|
89
|
+
/** Start of the selected range, used in range mode. */
|
|
83
90
|
startDate?: DateType;
|
|
91
|
+
/** End of the selected range, used in range mode. */
|
|
84
92
|
endDate?: DateType;
|
|
93
|
+
/** The selected dates, used in multiple mode. */
|
|
85
94
|
dates?: DateType[];
|
|
95
|
+
/** Minimum length of a selected range, in days, when using range mode. */
|
|
86
96
|
min?: number;
|
|
97
|
+
/** Maximum range length, in days, or the maximum number of selected dates in multiple mode. */
|
|
87
98
|
max?: number;
|
|
99
|
+
/** Called after a selection changes. */
|
|
88
100
|
onChange?: SingleChange | RangeChange | MultiChange;
|
|
101
|
+
/** Earliest year available in the year picker. */
|
|
89
102
|
startYear?: number;
|
|
103
|
+
/** Latest year available in the year picker. */
|
|
90
104
|
endYear?: number;
|
|
105
|
+
/** Earliest selectable date; dates before this are disabled. */
|
|
91
106
|
minDate?: DateType;
|
|
107
|
+
/** Latest selectable date; dates after this are disabled. */
|
|
92
108
|
maxDate?: DateType;
|
|
109
|
+
/** List or predicate marking which dates can be selected. */
|
|
93
110
|
enabledDates?: DateType[] | ((date: DateType) => boolean);
|
|
111
|
+
/** List or predicate marking which dates cannot be selected. */
|
|
94
112
|
disabledDates?: DateType[] | ((date: DateType) => boolean);
|
|
113
|
+
/**
|
|
114
|
+
* Index of the first weekday, where 0 is Sunday and 6 is Saturday.
|
|
115
|
+
* @default 1
|
|
116
|
+
*/
|
|
95
117
|
firstDayOfWeek?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Whether to show the leading and trailing days from adjacent months.
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
96
122
|
showOutsideDays?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether to show a time picker alongside the calendar, in single mode.
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
97
127
|
timePicker?: boolean;
|
|
128
|
+
/** Whether the time picker uses a 12-hour format with AM/PM instead of 24-hour. */
|
|
98
129
|
use12Hours?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* The calendar view shown when the picker first opens.
|
|
132
|
+
* @default 'day'
|
|
133
|
+
*/
|
|
99
134
|
initialView?: CalendarViews;
|
|
135
|
+
/**
|
|
136
|
+
* Height of the calendar container.
|
|
137
|
+
* @default CONTAINER_HEIGHT
|
|
138
|
+
*/
|
|
100
139
|
containerHeight?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Height of the weekday header row.
|
|
142
|
+
* @default WEEKDAYS_HEIGHT
|
|
143
|
+
*/
|
|
101
144
|
weekdaysHeight?: number;
|
|
102
145
|
style?: ViewStyle;
|
|
146
|
+
/**
|
|
147
|
+
* Placement of the month navigation controls.
|
|
148
|
+
* @default 'right'
|
|
149
|
+
*/
|
|
103
150
|
navigationPosition?: NavigationPosition;
|
|
151
|
+
/**
|
|
152
|
+
* Format used for the weekday labels.
|
|
153
|
+
* @default 'min'
|
|
154
|
+
*/
|
|
104
155
|
weekdaysFormat?: WeekdayFormat;
|
|
156
|
+
/**
|
|
157
|
+
* Format used for month names.
|
|
158
|
+
* @default 'short'
|
|
159
|
+
*/
|
|
105
160
|
monthsFormat?: MonthFormat;
|
|
161
|
+
/**
|
|
162
|
+
* Format used for the heading above the calendar grid.
|
|
163
|
+
* @default 'full'
|
|
164
|
+
*/
|
|
106
165
|
monthCaptionFormat?: MonthFormat;
|
|
166
|
+
/** Whether to allow selecting multiple separate ranges before confirming. */
|
|
107
167
|
multiRangeMode?: boolean;
|
|
168
|
+
/** Whether to hide the calendar header controls. */
|
|
108
169
|
hideHeader?: boolean;
|
|
170
|
+
/** Whether to hide the footer actions. */
|
|
109
171
|
hideFooter?: boolean;
|
|
172
|
+
/** Whether to hide the weekday labels row. */
|
|
110
173
|
hideWeekdays?: boolean;
|
|
174
|
+
/** Whether to prevent switching to the month selection view. */
|
|
111
175
|
disableMonthPicker?: boolean;
|
|
176
|
+
/** Whether to prevent switching to the year selection view. */
|
|
112
177
|
disableYearPicker?: boolean;
|
|
113
178
|
/** use to handle month and year selectors */
|
|
114
179
|
month?: number;
|
|
180
|
+
/** Forces the calendar to display a specific year. */
|
|
115
181
|
year?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Called when the displayed month changes.
|
|
184
|
+
* @default () => {}
|
|
185
|
+
*/
|
|
116
186
|
onMonthChange?: (month: number) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Called when the displayed year changes.
|
|
189
|
+
* @default () => {}
|
|
190
|
+
*/
|
|
117
191
|
onYearChange?: (year: number) => void;
|
|
118
192
|
ref?: Ref<BottomSheetModalMethods<any>>;
|
|
193
|
+
/**
|
|
194
|
+
* Called when the cancel action is triggered from the footer.
|
|
195
|
+
* @default () => {}
|
|
196
|
+
*/
|
|
119
197
|
onCancel?: () => void;
|
|
120
198
|
}
|
|
121
199
|
export type Numerals = 'latn';
|
|
@@ -4,14 +4,18 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Button } from '../Button';
|
|
5
5
|
import { useDatePickerContext } from './DatePicker.context';
|
|
6
6
|
const Footer = () => {
|
|
7
|
-
const { closeDatePicker, onCancel } = useDatePickerContext();
|
|
7
|
+
const { closeDatePicker, onConfirm, onCancel } = useDatePickerContext();
|
|
8
8
|
const handleCancel = () => {
|
|
9
9
|
if (onCancel) {
|
|
10
10
|
onCancel();
|
|
11
11
|
}
|
|
12
12
|
closeDatePicker();
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
const handleConfirm = () => {
|
|
15
|
+
onConfirm();
|
|
16
|
+
closeDatePicker();
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs(View, { style: styles.container, testID: "footer", children: [_jsx(Button, { variant: "ghost", colorScheme: "functional", onPress: handleCancel, children: "Cancel" }), _jsx(Button, { variant: "ghost", colorScheme: "functional", onPress: handleConfirm, children: "Ok" })] }));
|
|
15
19
|
};
|
|
16
20
|
const styles = StyleSheet.create(theme => ({
|
|
17
21
|
container: {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type DatePickerInputProps from './DatePickerInput.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use DatePickerInput for a text field that accepts a typed date or one picked from an
|
|
4
|
+
* attached calendar, formatting and parsing the value with Day.js.
|
|
5
|
+
*/
|
|
2
6
|
declare const DatePickerInput: {
|
|
3
|
-
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, format, openButtonLabel, autoCloseOnSelect, label, labelVariant, helperText, helperIcon, validText, invalidText, required, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }: DatePickerInputProps): import("react").JSX.Element;
|
|
7
|
+
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, format, openButtonLabel, autoCloseOnSelect, disableManualEntry, label, labelVariant, helperText, helperIcon, validText, invalidText, required, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }: DatePickerInputProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
5
9
|
};
|
|
6
10
|
export default DatePickerInput;
|
|
@@ -3,7 +3,7 @@ import { CalendarSmallIcon, CloseSmallIcon } from '@utilitywarehouse/hearth-reac
|
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
import { Keyboard, Platform } from 'react-native';
|
|
6
|
+
import { Keyboard, Platform, Pressable } from 'react-native';
|
|
7
7
|
import { StyleSheet } from 'react-native-unistyles';
|
|
8
8
|
import { DatePicker } from '../DatePicker';
|
|
9
9
|
import { useFormFieldContext } from '../FormField';
|
|
@@ -12,7 +12,11 @@ import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
|
12
12
|
import { DEFAULT_FORMAT, maskDefaultFormat } from './DatePickerInput.utils';
|
|
13
13
|
import DatePickerInputDoneButton from './DatePickerInputDoneButton';
|
|
14
14
|
dayjs.extend(customParseFormat);
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Use DatePickerInput for a text field that accepts a typed date or one picked from an
|
|
17
|
+
* attached calendar, formatting and parsing the value with Day.js.
|
|
18
|
+
*/
|
|
19
|
+
const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, format = DEFAULT_FORMAT, openButtonLabel = 'Open date picker', autoCloseOnSelect = true, disableManualEntry = false, label, labelVariant, helperText, helperIcon, validText, invalidText, required = true, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }) => {
|
|
16
20
|
const formFieldContext = useFormFieldContext();
|
|
17
21
|
const isDisabled = formFieldContext?.disabled ?? disabled;
|
|
18
22
|
const isReadonly = formFieldContext?.readonly ?? readonly;
|
|
@@ -101,18 +105,24 @@ const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, read
|
|
|
101
105
|
pickerRef.current?.close?.();
|
|
102
106
|
}, [pickerOnCancel]);
|
|
103
107
|
const placeholderValue = placeholder ?? format;
|
|
104
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Input, { validationStatus: validationStatus, disabled: disabled, readonly: readonly, focused: focused, label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, required: required, style: styles.wrap, accessible: false, children: [_jsx(
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Input, { validationStatus: validationStatus, disabled: disabled, readonly: readonly, focused: focused, label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, required: required, style: styles.wrap, accessible: false, children: [_jsx(Pressable, { style: styles.fieldPressable, disabled: !disableManualEntry || isDisabled || isReadonly, onPress: openPicker, children: _jsx(InputField, { 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: {
|
|
109
|
+
disabled: isDisabled || isReadonly,
|
|
110
|
+
}, importantForAccessibility: resolvedImportantForAccessibility, inputAccessoryViewID: Platform.OS === 'ios' ? accessoryViewID : undefined, ...textInputProps, editable: !isReadonly && !isDisabled && !disableManualEntry, style: [styles.input, inputStyle, disableManualEntry && styles.noPointerEvents] }) }), !!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 }))] }));
|
|
107
111
|
};
|
|
108
112
|
DatePickerInput.displayName = 'DatePickerInput';
|
|
109
113
|
const styles = StyleSheet.create(theme => ({
|
|
110
114
|
wrap: {
|
|
111
115
|
gap: theme.components.input.date.gap,
|
|
112
116
|
},
|
|
117
|
+
fieldPressable: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
},
|
|
113
120
|
input: {
|
|
114
121
|
paddingLeft: 0,
|
|
115
122
|
paddingRight: 0,
|
|
116
123
|
},
|
|
124
|
+
noPointerEvents: {
|
|
125
|
+
pointerEvents: 'none',
|
|
126
|
+
},
|
|
117
127
|
}));
|
|
118
128
|
export default DatePickerInput;
|
|
@@ -2,18 +2,39 @@ import type { TextInputProps, ViewProps } from 'react-native';
|
|
|
2
2
|
import type { DatePickerSingleProps } from '../DatePicker/DatePicker';
|
|
3
3
|
import type { DateType } from '../DatePicker/DatePicker.props';
|
|
4
4
|
export interface DatePickerInputBaseProps {
|
|
5
|
+
/** Disables both typing and the calendar trigger button. */
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Renders the corresponding validation style.
|
|
9
|
+
* @default 'initial'
|
|
10
|
+
*/
|
|
6
11
|
validationStatus?: 'initial' | 'valid' | 'invalid';
|
|
12
|
+
/** Prevents manual typing while keeping the calendar picker available. */
|
|
7
13
|
readonly?: boolean;
|
|
14
|
+
/** Forces the focused visual state. */
|
|
8
15
|
focused?: boolean;
|
|
16
|
+
/** The label for the input. */
|
|
9
17
|
label?: string;
|
|
18
|
+
/** The variant of the label text. */
|
|
10
19
|
labelVariant?: 'heading' | 'body';
|
|
20
|
+
/** Helper text to display below the input. */
|
|
11
21
|
helperText?: string;
|
|
22
|
+
/** Icon to display alongside the helper text. */
|
|
12
23
|
helperIcon?: React.ComponentType;
|
|
24
|
+
/** Text to display below the input when `validationStatus` is `'valid'`. */
|
|
13
25
|
validText?: string;
|
|
26
|
+
/** Text to display below the input when `validationStatus` is `'invalid'`. */
|
|
14
27
|
invalidText?: string;
|
|
15
28
|
placeholder?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Renders using `BottomSheetTextInput` for use inside a bottom sheet.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
16
33
|
inBottomSheet?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the input is required.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
17
38
|
required?: boolean;
|
|
18
39
|
/**
|
|
19
40
|
* Controls how the selected date is formatted when displayed inside the input.
|
|
@@ -29,6 +50,13 @@ export interface DatePickerInputBaseProps {
|
|
|
29
50
|
* When true (default), the calendar sheet is dismissed as soon as a date is picked.
|
|
30
51
|
*/
|
|
31
52
|
autoCloseOnSelect?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Blocks manual keyboard entry and makes tapping anywhere on the field open the
|
|
55
|
+
* calendar picker, instead of only the trailing calendar button. Independent of
|
|
56
|
+
* `disabled`/`readonly`, which still disable the whole field regardless of this prop.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
disableManualEntry?: boolean;
|
|
32
60
|
/**
|
|
33
61
|
* Additional props forwarded to the underlying DatePicker instance.
|
|
34
62
|
*/
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type DescriptionListProps from './DescriptionList.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use DescriptionList to display a list of related heading/description pairs, laid out as
|
|
4
|
+
* stacked rows or two columns, with an optional heading and helper text above the list.
|
|
5
|
+
*/
|
|
2
6
|
declare const DescriptionList: {
|
|
3
7
|
({ direction, itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, invalidText, ...props }: DescriptionListProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
@@ -4,6 +4,10 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { SectionHeader } from '../SectionHeader';
|
|
6
6
|
import { DescriptionListContext } from './DescriptionList.context';
|
|
7
|
+
/**
|
|
8
|
+
* Use DescriptionList to display a list of related heading/description pairs, laid out as
|
|
9
|
+
* stacked rows or two columns, with an optional heading and helper text above the list.
|
|
10
|
+
*/
|
|
7
11
|
const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, invalidText, ...props }) => {
|
|
8
12
|
styles.useVariants({ direction });
|
|
9
13
|
const value = useMemo(() => ({ direction, itemHeadingWidth }), [direction, itemHeadingWidth]);
|
|
@@ -4,9 +4,13 @@ export interface DescriptionListProps extends ViewProps {
|
|
|
4
4
|
direction?: 'row' | 'column';
|
|
5
5
|
/** Override heading/term column width when layout is row (defaults to token) */
|
|
6
6
|
itemHeadingWidth?: number;
|
|
7
|
+
/** Optional overall heading, rendered as a SectionHeader above the list. */
|
|
7
8
|
heading?: string;
|
|
9
|
+
/** Supporting text displayed below the heading. */
|
|
8
10
|
helperText?: string;
|
|
11
|
+
/** Custom trailing content for the heading (e.g. a Link). */
|
|
9
12
|
headerTrailingContent?: React.ReactNode;
|
|
13
|
+
/** Text to show below the heading when the section is invalid. */
|
|
10
14
|
invalidText?: string;
|
|
11
15
|
}
|
|
12
16
|
export default DescriptionListProps;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type DetailTextProps from './DetailText.props';
|
|
2
|
+
/**
|
|
3
|
+
* Renders detail copy, smaller secondary text used for captions, metadata, or supporting
|
|
4
|
+
* information alongside body content, with size and colour variants.
|
|
5
|
+
*/
|
|
2
6
|
declare const DetailText: {
|
|
3
7
|
({ children, color, size, truncated, underline, strikeThrough, italic, textTransform, textAlign, textAlignVertical, textDecorationColor, textDecorationLine, textDecorationStyle, userSelect, inverted, ...props }: DetailTextProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
@@ -3,6 +3,10 @@ import { Text } from 'react-native';
|
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { useStyleProps } from '../../hooks';
|
|
5
5
|
import { getFlattenedColorValue, resolveThemeValueWithFallback } from '../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* Renders detail copy, smaller secondary text used for captions, metadata, or supporting
|
|
8
|
+
* information alongside body content, with size and colour variants.
|
|
9
|
+
*/
|
|
6
10
|
const DetailText = ({ children, color, size = 'md', truncated, underline, strikeThrough, italic, textTransform, textAlign, textAlignVertical, textDecorationColor, textDecorationLine, textDecorationStyle, userSelect, inverted, ...props }) => {
|
|
7
11
|
const { computedStyles: utilityStyles, remainingProps } = useStyleProps(props);
|
|
8
12
|
styles.useVariants({
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type DividerProps from './Divider.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use Divider to create a visual separation between sections or elements, as a horizontal or
|
|
4
|
+
* vertical line.
|
|
5
|
+
*/
|
|
2
6
|
declare const Divider: {
|
|
3
7
|
({ orientation, color, spacing, space, height, width, flexItem, ...props }: DividerProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
@@ -4,6 +4,10 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { getFlattenedColorValue } from '../../utils';
|
|
7
|
+
/**
|
|
8
|
+
* Use Divider to create a visual separation between sections or elements, as a horizontal or
|
|
9
|
+
* vertical line.
|
|
10
|
+
*/
|
|
7
11
|
const Divider = ({ orientation = 'horizontal', color, spacing, space, height, width, flexItem, ...props }) => {
|
|
8
12
|
styles.useVariants({ orientation, spacing: space ?? spacing, flexItem });
|
|
9
13
|
const { color: themeColor, colorMode } = useTheme();
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import type { DimensionValue, ViewProps } from 'react-native';
|
|
2
2
|
import type { ColorValue, SpacingValues } from '../../types';
|
|
3
3
|
interface DividerProps extends Omit<ViewProps, 'children'> {
|
|
4
|
+
/** The color of the divider line. */
|
|
4
5
|
color?: ColorValue;
|
|
6
|
+
/** The background color of the divider line. */
|
|
5
7
|
backgroundColor?: ColorValue;
|
|
8
|
+
/** The space around the divider. */
|
|
6
9
|
spacing?: SpacingValues;
|
|
7
10
|
/**
|
|
8
11
|
* The space between child elements (gap).
|
|
9
12
|
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
10
13
|
*/
|
|
11
14
|
space?: SpacingValues;
|
|
15
|
+
/**
|
|
16
|
+
* The orientation of the divider.
|
|
17
|
+
* @default 'horizontal'
|
|
18
|
+
*/
|
|
12
19
|
orientation?: 'horizontal' | 'vertical';
|
|
20
|
+
/** The height of the divider. */
|
|
13
21
|
height?: DimensionValue;
|
|
22
|
+
/** The width of the divider. */
|
|
14
23
|
width?: DimensionValue;
|
|
24
|
+
/** Gives a vertical divider the correct height when used inside a flex container. */
|
|
15
25
|
flexItem?: boolean;
|
|
16
26
|
}
|
|
17
27
|
export default DividerProps;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ExpandableProps } from './Expandable.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use Expandable to show or hide content with a smooth height and opacity animation. It's a
|
|
4
|
+
* primitive building block for accordions, collapsible sections, and other expand/collapse
|
|
5
|
+
* interactions.
|
|
6
|
+
*/
|
|
2
7
|
declare const Expandable: {
|
|
3
8
|
({ expanded, onExpandedChange, children, duration, style, accessibilityLabel, testID, animateOpacity, ...props }: ExpandableProps): import("react").JSX.Element;
|
|
4
9
|
displayName: string;
|
|
@@ -3,6 +3,11 @@ import { useEffect } from 'react';
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedStyle, useDerivedValue, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
5
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
+
/**
|
|
7
|
+
* Use Expandable to show or hide content with a smooth height and opacity animation. It's a
|
|
8
|
+
* primitive building block for accordions, collapsible sections, and other expand/collapse
|
|
9
|
+
* interactions.
|
|
10
|
+
*/
|
|
6
11
|
const Expandable = ({ expanded = false, onExpandedChange, children, duration = 200, style, accessibilityLabel, testID, animateOpacity = true, ...props }) => {
|
|
7
12
|
const height = useSharedValue(0);
|
|
8
13
|
const open = useSharedValue(expanded);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type ExpandableCardProps from './ExpandableCard.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use ExpandableCard for a Card that reveals additional content when its trigger is pressed,
|
|
4
|
+
* with a built-in heading, helper text, leading/trailing content, and expansion animation.
|
|
5
|
+
*/
|
|
2
6
|
declare const ExpandableCard: {
|
|
3
7
|
({ expanded: controlledExpanded, onExpandedChange, heading, helperText, leadingIcon, leadingContent, badge, badgePosition, numericValue, triggerContent, expandedContent, duration, animateOpacity, disabled, testID, children, ...cardProps }: ExpandableCardProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
@@ -3,6 +3,10 @@ import { useState } from 'react';
|
|
|
3
3
|
import { Card } from '../Card';
|
|
4
4
|
import ExpandableCardExpandedContent from './ExpandableCardExpandedContent';
|
|
5
5
|
import ExpandableCardTrigger from './ExpandableCardTrigger';
|
|
6
|
+
/**
|
|
7
|
+
* Use ExpandableCard for a Card that reveals additional content when its trigger is pressed,
|
|
8
|
+
* with a built-in heading, helper text, leading/trailing content, and expansion animation.
|
|
9
|
+
*/
|
|
6
10
|
const ExpandableCard = ({ expanded: controlledExpanded, onExpandedChange, heading, helperText, leadingIcon, leadingContent, badge, badgePosition = 'bottom', numericValue, triggerContent, expandedContent, duration = 200, animateOpacity = true, disabled = false, testID = 'expandable-card', children, ...cardProps }) => {
|
|
7
11
|
const [internalExpanded, setInternalExpanded] = useState(false);
|
|
8
12
|
// Use controlled or uncontrolled state
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import FlexProps from './Flex.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use Flex to lay out children in a row or column with control over alignment, wrapping, and
|
|
4
|
+
* spacing between them.
|
|
5
|
+
*/
|
|
2
6
|
declare const Flex: {
|
|
3
7
|
({ style, children, direction, align, justify, wrap, spacing, space, ...rest }: FlexProps): import("react").JSX.Element;
|
|
4
8
|
displayName: string;
|
|
@@ -2,6 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { useStyleProps } from '../../hooks';
|
|
5
|
+
/**
|
|
6
|
+
* Use Flex to lay out children in a row or column with control over alignment, wrapping, and
|
|
7
|
+
* spacing between them.
|
|
8
|
+
*/
|
|
5
9
|
const Flex = ({ style, children, direction = 'column', align = 'flex-start', justify = 'flex-start', wrap = 'nowrap', spacing = 'md', space, ...rest }) => {
|
|
6
10
|
const propStyle = {
|
|
7
11
|
flexDirection: direction,
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { FlexAlignType, ViewProps, ViewStyle } from 'react-native';
|
|
2
2
|
import { DisplayProps, FlexLayoutProps, GapProps, MarginProps, PaddingProps, SizeProps, SpacingValues } from '../../types';
|
|
3
3
|
interface FlexProps extends ViewProps, MarginProps, PaddingProps, FlexLayoutProps, GapProps, Pick<SizeProps, 'width'>, Omit<DisplayProps, 'direction'> {
|
|
4
|
+
/**
|
|
5
|
+
* The direction of the flex container.
|
|
6
|
+
* @default 'column'
|
|
7
|
+
*/
|
|
4
8
|
direction?: ViewStyle['flexDirection'];
|
|
9
|
+
/**
|
|
10
|
+
* The align items of the flex container.
|
|
11
|
+
* @default 'flex-start'
|
|
12
|
+
*/
|
|
5
13
|
align?: FlexAlignType;
|
|
14
|
+
/**
|
|
15
|
+
* The justify content of the flex container.
|
|
16
|
+
* @default 'flex-start'
|
|
17
|
+
*/
|
|
6
18
|
justify?: ViewStyle['justifyContent'];
|
|
19
|
+
/**
|
|
20
|
+
* The wrap of the flex container.
|
|
21
|
+
* @default 'nowrap'
|
|
22
|
+
*/
|
|
7
23
|
wrap?: ViewStyle['flexWrap'];
|
|
24
|
+
/**
|
|
25
|
+
* The space between the content.
|
|
26
|
+
* @default 'md'
|
|
27
|
+
*/
|
|
8
28
|
spacing?: SpacingValues;
|
|
9
29
|
/**
|
|
10
30
|
* The space between child elements (gap).
|
|
@@ -22,6 +22,11 @@ export declare const FormFieldInvalidText: {
|
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
24
|
export declare const FormFieldTextContent: typeof View;
|
|
25
|
+
/**
|
|
26
|
+
* Use FormField to wrap a form control with a consistent label, helper text, and
|
|
27
|
+
* valid/invalid messaging, and to share validation and required/disabled state with its
|
|
28
|
+
* children.
|
|
29
|
+
*/
|
|
25
30
|
declare const FormField: {
|
|
26
31
|
({ children, disabled, validationStatus, readonly, label, helperText, helperIcon, validText, invalidText, required, labelVariant, accessibilityHandledByChildren, ...props }: FormFieldProps): import("react").JSX.Element;
|
|
27
32
|
displayName: string;
|
|
@@ -30,6 +30,11 @@ export const FormFieldHelperIcon = HelperIcon;
|
|
|
30
30
|
export const FormFieldValidText = HelperText;
|
|
31
31
|
export const FormFieldInvalidText = HelperText;
|
|
32
32
|
export const FormFieldTextContent = View;
|
|
33
|
+
/**
|
|
34
|
+
* Use FormField to wrap a form control with a consistent label, helper text, and
|
|
35
|
+
* valid/invalid messaging, and to share validation and required/disabled state with its
|
|
36
|
+
* children.
|
|
37
|
+
*/
|
|
33
38
|
const FormField = ({ children, disabled, validationStatus = 'initial', readonly, label, helperText, helperIcon, validText, invalidText, required = true, labelVariant = 'body', accessibilityHandledByChildren = false, ...props }) => {
|
|
34
39
|
const [shouldHandleAccessibility, setShouldHandleAccessibility] = useState(accessibilityHandledByChildren);
|
|
35
40
|
const value = useMemo(() => ({
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
export interface FormFieldBaseProps {
|
|
4
|
+
/**
|
|
5
|
+
* The validation status of the field.
|
|
6
|
+
* @default 'initial'
|
|
7
|
+
*/
|
|
4
8
|
validationStatus?: 'valid' | 'invalid' | 'initial';
|
|
9
|
+
/** Whether the field is disabled. */
|
|
5
10
|
disabled?: boolean;
|
|
11
|
+
/** Whether the field is readonly. */
|
|
6
12
|
readonly?: boolean;
|
|
13
|
+
/** The label for the field. */
|
|
7
14
|
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The variant of the label text.
|
|
17
|
+
* @default 'body'
|
|
18
|
+
*/
|
|
8
19
|
labelVariant?: 'heading' | 'body';
|
|
20
|
+
/** The helper text for the field. */
|
|
9
21
|
helperText?: string;
|
|
22
|
+
/** The icon for the helper text. */
|
|
10
23
|
helperIcon?: ComponentType;
|
|
24
|
+
/** The valid text for the field. */
|
|
11
25
|
validText?: string;
|
|
26
|
+
/** The invalid text for the field. */
|
|
12
27
|
invalidText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the field is required.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
13
32
|
required?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether accessibility is handled by child components, hiding accessibility for the
|
|
35
|
+
* FormField itself.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
14
38
|
accessibilityHandledByChildren?: boolean;
|
|
15
39
|
}
|
|
16
40
|
interface FormFieldProps extends FormFieldBaseProps, ViewProps {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { GridProps } from './Grid.props';
|
|
3
|
+
/**
|
|
4
|
+
* Use Grid to arrange children into rows of a fixed or breakpoint-responsive number of
|
|
5
|
+
* columns, with consistent spacing between them.
|
|
6
|
+
*/
|
|
3
7
|
declare const Grid: {
|
|
4
8
|
({ columns, containerStyle, itemStyle, rowStyle, spacing, space, children, ...props }: GridProps): React.JSX.Element;
|
|
5
9
|
displayName: string;
|
|
@@ -3,6 +3,10 @@ import React, { useMemo } from 'react';
|
|
|
3
3
|
import { useWindowDimensions, View } from 'react-native';
|
|
4
4
|
import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
|
|
5
5
|
import { useStyleProps, useTheme } from '../../hooks';
|
|
6
|
+
/**
|
|
7
|
+
* Use Grid to arrange children into rows of a fixed or breakpoint-responsive number of
|
|
8
|
+
* columns, with consistent spacing between them.
|
|
9
|
+
*/
|
|
6
10
|
const Grid = ({ columns = 2, containerStyle, itemStyle, rowStyle, spacing, space, children, ...props }) => {
|
|
7
11
|
const { breakpoints } = useTheme();
|
|
8
12
|
const { computedStyles, remainingProps } = useStyleProps(props);
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ViewProps } from 'react-native';
|
|
2
2
|
import { ColorValue } from '../../types';
|
|
3
3
|
export interface ListStyleProps {
|
|
4
|
+
/** Custom element (e.g. Image) to use as the bullet/marker. */
|
|
4
5
|
listStyleImage?: React.ReactElement;
|
|
6
|
+
/** Custom icon component to use as the bullet/marker. */
|
|
5
7
|
listStyleIcon?: React.ComponentType<any>;
|
|
8
|
+
/** Width of the custom bullet/marker. */
|
|
6
9
|
listStyleWidth?: number;
|
|
10
|
+
/** Height of the custom bullet/marker. */
|
|
7
11
|
listStyleHeight?: number;
|
|
12
|
+
/** Colour of the bullet/marker/number. */
|
|
8
13
|
listStyleColour?: ColorValue;
|
|
9
14
|
}
|
|
10
15
|
export interface ListItemProps extends ViewProps, ListStyleProps {
|
|
@@ -3,10 +3,20 @@ import { ViewProps, ViewStyle } from 'react-native';
|
|
|
3
3
|
import { SpaceValue } from '../../types';
|
|
4
4
|
import { ListStyleProps } from './ListItem';
|
|
5
5
|
export interface OrderedListProps extends ViewProps, ListStyleProps {
|
|
6
|
+
/** The `LI` components to be rendered within the list. */
|
|
6
7
|
children: ViewProps['children'];
|
|
8
|
+
/**
|
|
9
|
+
* The gap between the list items.
|
|
10
|
+
* @default '100'
|
|
11
|
+
*/
|
|
7
12
|
gap?: SpaceValue;
|
|
13
|
+
/** Custom style for the numbers. */
|
|
8
14
|
bulletStyle?: ViewStyle;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Use OrderedList (exported as `OL`) to render a numbered list of `LI` items, with support for
|
|
18
|
+
* custom bullet icons, images, and colours.
|
|
19
|
+
*/
|
|
10
20
|
declare const OrderedList: {
|
|
11
21
|
({ children, gap, style, listStyleImage, listStyleIcon, listStyleWidth, listStyleHeight, listStyleColour, ...rest }: OrderedListProps): React.JSX.Element;
|
|
12
22
|
displayName: string;
|
|
@@ -4,6 +4,10 @@ import { StyleSheet, View } from 'react-native';
|
|
|
4
4
|
import { useStyleProps, useTheme } from '../../hooks';
|
|
5
5
|
import { getFlattenedColorValue } from '../../utils';
|
|
6
6
|
import { BodyText } from '../BodyText';
|
|
7
|
+
/**
|
|
8
|
+
* Use OrderedList (exported as `OL`) to render a numbered list of `LI` items, with support for
|
|
9
|
+
* custom bullet icons, images, and colours.
|
|
10
|
+
*/
|
|
7
11
|
const OrderedList = ({ children, gap = '100', style, listStyleImage, listStyleIcon, listStyleWidth, listStyleHeight, listStyleColour, ...rest }) => {
|
|
8
12
|
const { computedStyles } = useStyleProps({ gap });
|
|
9
13
|
const theme = useTheme();
|
|
@@ -3,10 +3,20 @@ import { ViewProps, ViewStyle } from 'react-native';
|
|
|
3
3
|
import { SpaceValue } from '../../types';
|
|
4
4
|
import { ListStyleProps } from './ListItem';
|
|
5
5
|
export interface UnorderedListProps extends ViewProps, ListStyleProps {
|
|
6
|
+
/** The `LI` components to be rendered within the list. */
|
|
6
7
|
children: ViewProps['children'];
|
|
8
|
+
/**
|
|
9
|
+
* The gap between the list items.
|
|
10
|
+
* @default '100'
|
|
11
|
+
*/
|
|
7
12
|
gap?: SpaceValue;
|
|
13
|
+
/** Custom style for the bullet points. */
|
|
8
14
|
bulletStyle?: ViewStyle;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Use UnorderedList (exported as `UL`) to render a bulleted list of `LI` items, with support
|
|
18
|
+
* for custom bullet icons, images, and colours.
|
|
19
|
+
*/
|
|
10
20
|
declare const UnorderedList: {
|
|
11
21
|
({ children, gap, style, listStyleImage, listStyleIcon, listStyleWidth, listStyleHeight, listStyleColour, ...rest }: UnorderedListProps): React.JSX.Element;
|
|
12
22
|
displayName: string;
|