@jobber/components-native 0.101.5 → 0.101.6
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/dist/docs/ActionItem/ActionItem.md +65 -0
- package/dist/docs/ActionItemGroup/ActionItemGroup.md +33 -0
- package/dist/docs/ActionLabel/ActionLabel.md +43 -0
- package/dist/docs/ActivityIndicator/ActivityIndicator.md +116 -0
- package/dist/docs/Animation/Animation.md +71 -0
- package/dist/docs/AtlantisThemeContext/AtlantisThemeContext.md +256 -0
- package/dist/docs/AutoLink/AutoLink.md +47 -0
- package/dist/docs/Banner/Banner.md +390 -0
- package/dist/docs/Borders/Borders.md +45 -0
- package/dist/docs/BottomSheet/BottomSheet.md +67 -0
- package/dist/docs/Button/Button.md +918 -0
- package/dist/docs/ButtonGroup/ButtonGroup.md +89 -0
- package/dist/docs/Card/Card.md +270 -0
- package/dist/docs/Checkbox/Checkbox.md +69 -0
- package/dist/docs/Chip/Chip.md +371 -0
- package/dist/docs/Colors/Colors.md +217 -0
- package/dist/docs/Content/Content.md +67 -0
- package/dist/docs/ContentOverlay/ContentOverlay.md +64 -0
- package/dist/docs/Disclosure/Disclosure.md +161 -0
- package/dist/docs/Divider/Divider.md +84 -0
- package/dist/docs/Elevations/Elevations.md +76 -0
- package/dist/docs/EmptyState/EmptyState.md +72 -0
- package/dist/docs/Flex/Flex.md +37 -0
- package/dist/docs/Form/Form.md +126 -0
- package/dist/docs/FormField/FormField.md +57 -0
- package/dist/docs/FormatFile/FormatFile.md +56 -0
- package/dist/docs/Glimmer/Glimmer.md +143 -0
- package/dist/docs/Heading/Heading.md +132 -0
- package/dist/docs/Icon/Icon.md +585 -0
- package/dist/docs/IconButton/IconButton.md +25 -0
- package/dist/docs/InputCurrency/InputCurrency.md +61 -0
- package/dist/docs/InputDate/InputDate.md +133 -0
- package/dist/docs/InputEmail/InputEmail.md +69 -0
- package/dist/docs/InputFieldWrapper/InputFieldWrapper.md +70 -0
- package/dist/docs/InputNumber/InputNumber.md +72 -0
- package/dist/docs/InputPassword/InputPassword.md +61 -0
- package/dist/docs/InputPressable/InputPressable.md +64 -0
- package/dist/docs/InputSearch/InputSearch.md +49 -0
- package/dist/docs/InputText/InputText.md +324 -0
- package/dist/docs/InputTime/InputTime.md +54 -0
- package/dist/docs/Opacity/Opacity.md +12 -0
- package/dist/docs/ProgressBar/ProgressBar.md +39 -0
- package/dist/docs/Radii/Radii.md +23 -0
- package/dist/docs/ResponsiveBreakpoint/ResponsiveBreakpoint.md +74 -0
- package/dist/docs/Select/Select.md +213 -0
- package/dist/docs/Spacing/Spacing.md +103 -0
- package/dist/docs/StatusLabel/StatusLabel.md +119 -0
- package/dist/docs/Switch/Switch.md +54 -0
- package/dist/docs/Text/Text.md +368 -0
- package/dist/docs/TextList/TextList.md +29 -0
- package/dist/docs/ThumbnailList/ThumbnailList.md +16 -0
- package/dist/docs/Toast/Toast.md +71 -0
- package/dist/docs/Typography/Typography.md +170 -0
- package/dist/docs/choosing-components/choosing-components.md +76 -0
- package/dist/docs/customizing-components/customizing-components.md +167 -0
- package/dist/docs/disabled-states/disabled-states.md +86 -0
- package/dist/docs/empty-states/empty-states.md +126 -0
- package/dist/docs/errors/errors.md +114 -0
- package/dist/docs/index.md +64 -0
- package/dist/docs/interaction/interaction.md +109 -0
- package/dist/docs/page-layouts/page-layouts.md +323 -0
- package/dist/docs/scaffolding/scaffolding.md +109 -0
- package/dist/docs/settings/settings.md +58 -0
- package/dist/docs/usage-guidelines/usage-guidelines.md +177 -0
- package/dist/package.json +8 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Input Date
|
|
2
|
+
|
|
3
|
+
InputDate provides a multi-modal way for the user to select a date, using
|
|
4
|
+
either:
|
|
5
|
+
|
|
6
|
+
* Form Field
|
|
7
|
+
* Visual calendar selector and comes complete with the ability to re-format user
|
|
8
|
+
input into an expected date format.
|
|
9
|
+
|
|
10
|
+
## Design & usage guidelines
|
|
11
|
+
|
|
12
|
+
The InputDate should be used in most cases where the user needs to select a
|
|
13
|
+
date.
|
|
14
|
+
|
|
15
|
+
### States
|
|
16
|
+
|
|
17
|
+
#### Disabled
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { InputDate } from "@jobber/components/InputDate";
|
|
22
|
+
// eslint-disable-next-line import/no-deprecated
|
|
23
|
+
import type { InputDateProps } from "../InputDate.types";
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line import/no-deprecated
|
|
26
|
+
export function InputDateDisabledExample(props: InputDateProps) {
|
|
27
|
+
return <InputDate placeholder="Start Date" disabled={true} {...props} />;
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Invalid
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import React from "react";
|
|
35
|
+
import type { InputDateProps } from "@jobber/components/InputDate";
|
|
36
|
+
import { InputDate } from "@jobber/components/InputDate";
|
|
37
|
+
|
|
38
|
+
export function InputDateInvalidExample(props: InputDateProps) {
|
|
39
|
+
return (
|
|
40
|
+
<InputDate
|
|
41
|
+
placeholder="Start date"
|
|
42
|
+
error="Start Date is required"
|
|
43
|
+
invalid={true}
|
|
44
|
+
{...props}
|
|
45
|
+
version={2}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Content guidelines
|
|
52
|
+
|
|
53
|
+
The InputDate should only be used to display and submit date values. For other
|
|
54
|
+
input usage, see [Related Components](#component-view-related-components).
|
|
55
|
+
|
|
56
|
+
## Responsiveness
|
|
57
|
+
|
|
58
|
+
When the InputDate is near the top or bottom of the viewport, the Datepicker
|
|
59
|
+
will adjust its position to remain in view.
|
|
60
|
+
|
|
61
|
+
The FormField for InputDate will take up the full available width of its parent.
|
|
62
|
+
If used in an [InputGroup](/components/InputGroup), it will take up the
|
|
63
|
+
available amount of space left by any other inputs in the group.
|
|
64
|
+
|
|
65
|
+
## Related components
|
|
66
|
+
|
|
67
|
+
* On web if you do not need an accompanying form field, you can use the
|
|
68
|
+
[DatePicker](/components/DatePicker) on its own
|
|
69
|
+
* If you need to allow the user to enter time, use
|
|
70
|
+
[InputTime](../InputTime/InputTime.md)
|
|
71
|
+
* If you just need a text input, use [InputText](../InputText/InputText.md)
|
|
72
|
+
|
|
73
|
+
## Accessibility
|
|
74
|
+
|
|
75
|
+
Accessibility concerns for the InputDate are captured by:
|
|
76
|
+
|
|
77
|
+
### FormField
|
|
78
|
+
|
|
79
|
+
Provides a label, announces input type, can be focused, and handles error
|
|
80
|
+
validation and messaging.
|
|
81
|
+
|
|
82
|
+
### Datepicker
|
|
83
|
+
|
|
84
|
+
[Datepicker](/components/DatePicker) is keyboard-operable and announces the
|
|
85
|
+
currently-focused date available for selection to the user via assistive
|
|
86
|
+
technology.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Developer notes
|
|
90
|
+
|
|
91
|
+
Some functionality that we have opted not to introduce at this time, but that
|
|
92
|
+
would be relatively feasible to add in the future:
|
|
93
|
+
|
|
94
|
+
* allow for the concept of a date-range selection
|
|
95
|
+
* allow for certain days or dates to be excluded from selection
|
|
96
|
+
|
|
97
|
+
### Web
|
|
98
|
+
|
|
99
|
+
InputDate pairs with the
|
|
100
|
+
|
|
101
|
+
AtlantisContext
|
|
102
|
+
|
|
103
|
+
using the provided `firstDayOfWeek` value to determine what day the calendar date
|
|
104
|
+
picking UI will use to start weeks.
|
|
105
|
+
|
|
106
|
+
To leverage this behavior, implement the
|
|
107
|
+
|
|
108
|
+
AtlantisContext
|
|
109
|
+
|
|
110
|
+
at the root of the application, populated with the applicable value.
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## Props
|
|
114
|
+
|
|
115
|
+
### Mobile
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Required | Default | Description |
|
|
118
|
+
|------|------|----------|---------|-------------|
|
|
119
|
+
| `accessibilityHint` | `string` | No | — | Helps users understand what will happen when they perform an action |
|
|
120
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the element |
|
|
121
|
+
| `clearable` | `"never" | "always"` | No | — | Defaulted to "always" so user can clear the dates whenever there's a value. |
|
|
122
|
+
| `defaultValue` | `Date` | No | — | The initial value for the input. |
|
|
123
|
+
| `disabled` | `boolean` | No | — | Disable the input |
|
|
124
|
+
| `emptyValueLabel` | `string` | No | — | This label is shown to the user when there's no selected date. |
|
|
125
|
+
| `invalid` | `string | boolean` | No | — | Highlights the field red and shows message below (if string) to indicate an error |
|
|
126
|
+
| `maxDate` | `Date` | No | — | Maximum date the user can set. |
|
|
127
|
+
| `minDate` | `Date` | No | — | Minimum date the user can set |
|
|
128
|
+
| `name` | `string` | No | — | Adding a `name` would make this component "Form controlled" and must be nested within a `<Form />` component. Cannot... |
|
|
129
|
+
| `onChange` | `((value?: Date) => void) | ((value?: Date) => void)` | No | — | The callback that fires whenever a date gets selected. |
|
|
130
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
131
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
132
|
+
| `validations` | `Omit<RegisterOptions<FieldValues, string>, "disabled" | "valueAsNumber" | "valueAsDate" | "setValueAs">` | No | — | Shows an error message below the field and highlights it red when the value is invalid. Only applies when nested with... |
|
|
133
|
+
| `value` | `string | Date` | No | — | The value shown on the field. This gets automatically formatted to the account's date format. Cannot be declared if ... |
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Input Email
|
|
2
|
+
|
|
3
|
+
InputEmail is used to display input with built-in email validation.
|
|
4
|
+
|
|
5
|
+
## Design & usage guidelines
|
|
6
|
+
|
|
7
|
+
Use the InputEmail component when you expect the user to input an email address.
|
|
8
|
+
By default, the InputEmail component will validate email addresses.
|
|
9
|
+
|
|
10
|
+
If you want to add additional validation within the Web/JO, you can pass in the
|
|
11
|
+
`validations` prop with your own message. Note: The validations prop is not
|
|
12
|
+
available on mobile.
|
|
13
|
+
|
|
14
|
+
## Clearable
|
|
15
|
+
|
|
16
|
+
* **while-editing**: shows the clear button only while focused and when there is
|
|
17
|
+
a value. When focus leaves the field and its controls, the button is hidden.
|
|
18
|
+
* **always**: shows the clear button whenever there is a value, even when
|
|
19
|
+
blurred. Never shown when the field is empty.
|
|
20
|
+
* The clear button is not shown when the field is `disabled` or `readonly`, and
|
|
21
|
+
is not supported for `multiline` inputs.
|
|
22
|
+
|
|
23
|
+
## Related components
|
|
24
|
+
|
|
25
|
+
If you are not worried about email address validation, consider using
|
|
26
|
+
[InputText](../InputText/InputText.md).
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
### Mobile
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Required | Default | Description |
|
|
34
|
+
|------|------|----------|---------|-------------|
|
|
35
|
+
| `accessibilityHint` | `string` | No | — | An accessibility hint helps users understand what will happen when they perform an action on the accessibility elemen... |
|
|
36
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the associated element |
|
|
37
|
+
| `assistiveText` | `string` | No | — | Text that helps the user understand the input |
|
|
38
|
+
| `autoCapitalize` | `"characters" | "words" | "sentences" | "none"` | No | — | Determines where to autocapitalize |
|
|
39
|
+
| `autoComplete` | `"name" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | ... 45 more ... | "off"` | No | — | Determines which content to suggest on auto complete, e.g.`username`. Default is `off` which disables auto complete ... |
|
|
40
|
+
| `autoCorrect` | `boolean` | No | — | Turn off autocorrect |
|
|
41
|
+
| `autoFocus` | `boolean` | No | — | Automatically focus the input after it is rendered |
|
|
42
|
+
| `clearable` | `Clearable` | No | — | Add a clear action on the input that clears the value. You should always use `while-editing` if you want the input t... |
|
|
43
|
+
| `defaultValue` | `string` | No | — | Default value for when component is uncontrolled |
|
|
44
|
+
| `disabled` | `boolean` | No | — | Disable the input |
|
|
45
|
+
| `invalid` | `string | boolean` | No | — | Highlights the field red and shows message below (if string) to indicate an error |
|
|
46
|
+
| `loading` | `boolean` | No | — | Show loading indicator. |
|
|
47
|
+
| `loadingType` | `"spinner" | "glimmer"` | No | — | Change the type of loading indicator to spinner or glimmer. |
|
|
48
|
+
| `multiline` | `boolean` | No | — | Determines if inputText will span multiple lines. Default is `false` https://reactnative.dev/docs/textinput#multiline |
|
|
49
|
+
| `name` | `string` | No | — | Name of the input. |
|
|
50
|
+
| `onBlur` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is blurred |
|
|
51
|
+
| `onChangeText` | `(newValue: string) => void` | No | — | Simplified callback that only provides the new value @param newValue |
|
|
52
|
+
| `onFocus` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is focused @param event |
|
|
53
|
+
| `onSubmitEditing` | `(event?: SyntheticEvent<Element, Event>) => void` | No | — | Callback that is called when the text input's submit button is pressed @param event |
|
|
54
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
55
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
56
|
+
| `readonly` | `boolean` | No | — | Makes the input read-only |
|
|
57
|
+
| `ref` | `Ref<InputTextRef>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
58
|
+
| `secureTextEntry` | `boolean` | No | — | Use secure text entry |
|
|
59
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
60
|
+
| `spellCheck` | `boolean` | No | — | Determines whether spell check is used. Turn it off to hide empty autoCorrect suggestions when autoCorrect is off. *... |
|
|
61
|
+
| `styleOverride` | `InputTextStyleOverride` | No | — | Custom styling to override default style of the input text |
|
|
62
|
+
| `suffix` | `{ icon?: IconNames; label?: string; onPress?: () => void; }` | No | — | Symbol to display after the text input |
|
|
63
|
+
| `testID` | `string` | No | — | Used to locate this view in end-to-end tests |
|
|
64
|
+
| `textContentType` | `"name" | "none" | "nickname" | "password" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "creditCardExpiration" | ... 33 more ... | "shipmentTrackingNumber"` | No | — | Determines which content to suggest on auto complete, e.g.`username`. Default is `none` which disables auto complete ... |
|
|
65
|
+
| `toolbar` | `ReactNode` | No | — | Add a toolbar below the input field for actions like rewriting the text. |
|
|
66
|
+
| `toolbarVisibility` | `"always" | "while-editing"` | No | — | Change the behaviour of when the toolbar becomes visible. |
|
|
67
|
+
| `transform` | `{ input?: (v: any) => string; output?: (v: string) => any; }` | No | — | transform object is used to transform the internal TextInput value It's useful for components like InputNumber where ... |
|
|
68
|
+
| `validations` | `RegisterOptions` | No | — | Shows an error message below the field and highlight the field red when value is invalid |
|
|
69
|
+
| `value` | `string` | No | — | Set the component to a given value |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# InputFieldWrapper
|
|
2
|
+
|
|
3
|
+
This component is used to wrap input fields such as
|
|
4
|
+
[InputText](../InputText/InputText.md) and
|
|
5
|
+
[InputPressable](../InputPressable/InputPressable.md) to provide common patterns and
|
|
6
|
+
functionality present in our input designs, such as suffix/prefix icons,
|
|
7
|
+
placeholders, etc.
|
|
8
|
+
|
|
9
|
+
## Design & usage guidelines
|
|
10
|
+
|
|
11
|
+
### Prefix/Suffix
|
|
12
|
+
|
|
13
|
+
Use a prefix or suffix when additional visual cues about an input's function may
|
|
14
|
+
be helpful.
|
|
15
|
+
|
|
16
|
+
Some fields have common visual patterns such as "search" having a magnifying
|
|
17
|
+
glass icon, "Select" having a downwards arrow, or currency inputs having a
|
|
18
|
+
currency symbol. These signifiers reinforce the purpose of the input to increase
|
|
19
|
+
[Recognition over Recall](https://www.nngroup.com/articles/ten-usability-heuristics/)
|
|
20
|
+
and align the input with
|
|
21
|
+
[Consistency and Standards](https://www.nngroup.com/articles/ten-usability-heuristics/).
|
|
22
|
+
With clearer guidance around the purpose of inputs, the user is able to better
|
|
23
|
+
focus on the task at hand. See
|
|
24
|
+
[InputFieldWrapper/Prefix and Suffix example](/storybook/mobile/?path=/story/components-private-inputfieldwrapper--prefix-and-suffix).
|
|
25
|
+
|
|
26
|
+
## Related components
|
|
27
|
+
|
|
28
|
+
Refer to [InputText](../InputText/InputText.md) and
|
|
29
|
+
[InputPressable](../InputPressable/InputPressable.md) to see implementation examples
|
|
30
|
+
using InputFieldWrapper.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
### Clearable
|
|
36
|
+
|
|
37
|
+
When setting `showClearAction` to `true` you must also provide an `onClear`
|
|
38
|
+
callback that will clear the input you are wrapping. See
|
|
39
|
+
[InputDate](../InputDate/InputDate.md) and
|
|
40
|
+
[InputPressable](../InputPressable/InputPressable.md) or
|
|
41
|
+
[InputText](../InputText/InputText.md) for examples.
|
|
42
|
+
|
|
43
|
+
See
|
|
44
|
+
[InputFieldWrapper/Clearable example](/storybook/mobile/?path=/story/components-private-inputfieldwrapper--clearable).
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
### Mobile
|
|
50
|
+
|
|
51
|
+
| Prop | Type | Required | Default | Description |
|
|
52
|
+
|------|------|----------|---------|-------------|
|
|
53
|
+
| `assistiveText` | `string` | No | — | Text that goes below the input to help the user understand the input |
|
|
54
|
+
| `disabled` | `boolean` | No | — | Disable the input |
|
|
55
|
+
| `error` | `FieldError` | No | — | |
|
|
56
|
+
| `focused` | `boolean` | No | `false` | |
|
|
57
|
+
| `hasValue` | `boolean` | No | `false` | |
|
|
58
|
+
| `invalid` | `string | boolean` | No | — | Highlights the field red and shows message below (if string) to indicate an error |
|
|
59
|
+
| `loading` | `boolean` | No | `false` | Show loading indicator. |
|
|
60
|
+
| `loadingType` | `"spinner" | "glimmer"` | No | `spinner` | Change the type of loading indicator to spinner or glimmer. |
|
|
61
|
+
| `multiline` | `boolean` | No | `false` | Whether the input is a multiline input. |
|
|
62
|
+
| `onClear` | `() => void` | No | — | Callback called when the user clicks the ClearAction button. Should clear the value passed. To disallow clearing set ... |
|
|
63
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
64
|
+
| `placeholderMode` | `"normal" | "mini" | "hidden"` | No | `normal` | Controls how the placeholder text is displayed. - normal: the placeholder text will be displayed in the normal placeh... |
|
|
65
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
66
|
+
| `showClearAction` | `boolean` | No | `false` | Adds the ClearAction that will call the onClear handler when pressed |
|
|
67
|
+
| `styleOverride` | `InputFieldStyleOverride` | No | — | Custom styling to override default style of the input field |
|
|
68
|
+
| `suffix` | `{ icon?: IconNames; label?: string; onPress?: () => void; }` | No | — | Symbol to display after the text input |
|
|
69
|
+
| `toolbar` | `ReactNode` | No | — | Add a toolbar below the input field for actions like rewriting the text. |
|
|
70
|
+
| `toolbarVisibility` | `"always" | "while-editing"` | No | `while-editing` | Change the behaviour of when the toolbar becomes visible. |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# InputNumber
|
|
2
|
+
|
|
3
|
+
InputNumber is used in forms that accept numbers as an answer.
|
|
4
|
+
|
|
5
|
+
## Design & usage guidelines
|
|
6
|
+
|
|
7
|
+
This is best suited for input data that benefits from being modified in
|
|
8
|
+
increments, such as quantity, price, or days (ie 2 days -> 3 days).
|
|
9
|
+
|
|
10
|
+
While some types of data may technically be numbers, they can be ill-suited for
|
|
11
|
+
using a number input. For example, phone numbers and credit card numbers provide
|
|
12
|
+
no value to the user by offering an incrementer.
|
|
13
|
+
|
|
14
|
+
## Clearable
|
|
15
|
+
|
|
16
|
+
InputNumber does not show a clear button. The component enforces
|
|
17
|
+
`clearable="never"` to align with numeric, increment/decrement-focused usage.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
## Using onValidation
|
|
23
|
+
|
|
24
|
+
If you need to capture the error message and render it outside of the component.
|
|
25
|
+
Read the [InputValidation](/components/InputValidation) documentation.
|
|
26
|
+
|
|
27
|
+
For more details about `validation` using `Input` components, see the
|
|
28
|
+
[InputText](../InputText/InputText.md) documentation.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Props
|
|
32
|
+
|
|
33
|
+
### Mobile
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Required | Default | Description |
|
|
36
|
+
|------|------|----------|---------|-------------|
|
|
37
|
+
| `accessibilityHint` | `string` | No | — | An accessibility hint helps users understand what will happen when they perform an action on the accessibility elemen... |
|
|
38
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the associated element |
|
|
39
|
+
| `assistiveText` | `string` | No | — | Text that helps the user understand the input |
|
|
40
|
+
| `autoCapitalize` | `"characters" | "words" | "sentences" | "none"` | No | — | Determines where to autocapitalize |
|
|
41
|
+
| `autoComplete` | `"name" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | ... 45 more ... | "off"` | No | — | Determines which content to suggest on auto complete, e.g.`username`. Default is `off` which disables auto complete ... |
|
|
42
|
+
| `autoCorrect` | `boolean` | No | — | Turn off autocorrect |
|
|
43
|
+
| `autoFocus` | `boolean` | No | — | Automatically focus the input after it is rendered |
|
|
44
|
+
| `clearable` | `Clearable` | No | — | Add a clear action on the input that clears the value. You should always use `while-editing` if you want the input t... |
|
|
45
|
+
| `defaultValue` | `number` | No | — | |
|
|
46
|
+
| `disabled` | `boolean` | No | — | Disable the input |
|
|
47
|
+
| `invalid` | `string | boolean` | No | — | Highlights the field red and shows message below (if string) to indicate an error |
|
|
48
|
+
| `keyboard` | `NumberKeyboard` | No | — | |
|
|
49
|
+
| `loading` | `boolean` | No | — | Show loading indicator. |
|
|
50
|
+
| `loadingType` | `"spinner" | "glimmer"` | No | — | Change the type of loading indicator to spinner or glimmer. |
|
|
51
|
+
| `multiline` | `boolean` | No | — | Determines if inputText will span multiple lines. Default is `false` https://reactnative.dev/docs/textinput#multiline |
|
|
52
|
+
| `name` | `string` | No | — | Name of the input. |
|
|
53
|
+
| `onBlur` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is blurred |
|
|
54
|
+
| `onChange` | `(newValue?: string | number) => void` | No | — | |
|
|
55
|
+
| `onFocus` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is focused @param event |
|
|
56
|
+
| `onSubmitEditing` | `(event?: SyntheticEvent<Element, Event>) => void` | No | — | Callback that is called when the text input's submit button is pressed @param event |
|
|
57
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
58
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
59
|
+
| `readonly` | `boolean` | No | — | Makes the input read-only |
|
|
60
|
+
| `ref` | `Ref<InputTextRef>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
61
|
+
| `secureTextEntry` | `boolean` | No | — | Use secure text entry |
|
|
62
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
63
|
+
| `spellCheck` | `boolean` | No | — | Determines whether spell check is used. Turn it off to hide empty autoCorrect suggestions when autoCorrect is off. *... |
|
|
64
|
+
| `styleOverride` | `InputTextStyleOverride` | No | — | Custom styling to override default style of the input text |
|
|
65
|
+
| `suffix` | `{ icon?: IconNames; label?: string; onPress?: () => void; }` | No | — | Symbol to display after the text input |
|
|
66
|
+
| `testID` | `string` | No | — | Used to locate this view in end-to-end tests |
|
|
67
|
+
| `textContentType` | `"name" | "none" | "nickname" | "password" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "creditCardExpiration" | ... 33 more ... | "shipmentTrackingNumber"` | No | — | Determines which content to suggest on auto complete, e.g.`username`. Default is `none` which disables auto complete ... |
|
|
68
|
+
| `toolbar` | `ReactNode` | No | — | Add a toolbar below the input field for actions like rewriting the text. |
|
|
69
|
+
| `toolbarVisibility` | `"always" | "while-editing"` | No | — | Change the behaviour of when the toolbar becomes visible. |
|
|
70
|
+
| `transform` | `{ input?: (v: any) => string; output?: (v: string) => any; }` | No | — | transform object is used to transform the internal TextInput value It's useful for components like InputNumber where ... |
|
|
71
|
+
| `validations` | `RegisterOptions` | No | — | Shows an error message below the field and highlight the field red when value is invalid |
|
|
72
|
+
| `value` | `number` | No | — | |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Input Password
|
|
2
|
+
|
|
3
|
+
InputPassword is used to display a secure password input field.
|
|
4
|
+
|
|
5
|
+
## Design & usage guidelines
|
|
6
|
+
|
|
7
|
+
Use InputPassword for authentication flows where the user is required to enter a
|
|
8
|
+
password.
|
|
9
|
+
|
|
10
|
+
If you are building an experience for authentication that does not require
|
|
11
|
+
character-masking or are looking for more information regarding `validations`,
|
|
12
|
+
refer to [InputText](../InputText/InputText.md).
|
|
13
|
+
|
|
14
|
+
## Clearable
|
|
15
|
+
|
|
16
|
+
* **while-editing**: shows the clear button only while focused and when there is
|
|
17
|
+
a value. When focus leaves the field and its controls, the button is hidden.
|
|
18
|
+
* **always**: shows the clear button whenever there is a value, even when
|
|
19
|
+
blurred. Never shown when the field is empty.
|
|
20
|
+
* The clear button is not shown when the field is `disabled` or `readonly`.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
### Mobile
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Required | Default | Description |
|
|
28
|
+
|------|------|----------|---------|-------------|
|
|
29
|
+
| `accessibilityHint` | `string` | No | — | An accessibility hint helps users understand what will happen when they perform an action on the accessibility elemen... |
|
|
30
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the associated element |
|
|
31
|
+
| `assistiveText` | `string` | No | — | Text that helps the user understand the input |
|
|
32
|
+
| `autoCapitalize` | `"characters" | "words" | "sentences" | "none"` | No | — | Determines where to autocapitalize |
|
|
33
|
+
| `autoComplete` | `"name" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | ... 45 more ... | "off"` | No | — | Determines which content to suggest on auto complete, e.g.`username`. Default is `off` which disables auto complete ... |
|
|
34
|
+
| `autoCorrect` | `boolean` | No | — | Turn off autocorrect |
|
|
35
|
+
| `autoFocus` | `boolean` | No | — | Automatically focus the input after it is rendered |
|
|
36
|
+
| `defaultValue` | `string` | No | — | Default value for when component is uncontrolled |
|
|
37
|
+
| `disabled` | `boolean` | No | — | Disable the input |
|
|
38
|
+
| `invalid` | `string | boolean` | No | — | Highlights the field red and shows message below (if string) to indicate an error |
|
|
39
|
+
| `loading` | `boolean` | No | — | Show loading indicator. |
|
|
40
|
+
| `loadingType` | `"spinner" | "glimmer"` | No | — | Change the type of loading indicator to spinner or glimmer. |
|
|
41
|
+
| `multiline` | `boolean` | No | — | Determines if inputText will span multiple lines. Default is `false` https://reactnative.dev/docs/textinput#multiline |
|
|
42
|
+
| `name` | `string` | No | — | Name of the input. |
|
|
43
|
+
| `onBlur` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is blurred |
|
|
44
|
+
| `onChangeText` | `(newValue: string) => void` | No | — | Simplified callback that only provides the new value @param newValue |
|
|
45
|
+
| `onFocus` | `(event?: FocusEvent) => void` | No | — | Callback that is called when the text input is focused @param event |
|
|
46
|
+
| `onSubmitEditing` | `(event?: SyntheticEvent<Element, Event>) => void` | No | — | Callback that is called when the text input's submit button is pressed @param event |
|
|
47
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
48
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
49
|
+
| `readonly` | `boolean` | No | — | Makes the input read-only |
|
|
50
|
+
| `ref` | `Ref<InputTextRef>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
51
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
52
|
+
| `spellCheck` | `boolean` | No | — | Determines whether spell check is used. Turn it off to hide empty autoCorrect suggestions when autoCorrect is off. *... |
|
|
53
|
+
| `styleOverride` | `InputTextStyleOverride` | No | — | Custom styling to override default style of the input text |
|
|
54
|
+
| `suffix` | `{ icon?: IconNames; label?: string; onPress?: () => void; }` | No | — | Symbol to display after the text input |
|
|
55
|
+
| `testID` | `string` | No | — | Used to locate this view in end-to-end tests |
|
|
56
|
+
| `toolbar` | `ReactNode` | No | — | Add a toolbar below the input field for actions like rewriting the text. |
|
|
57
|
+
| `toolbarVisibility` | `"always" | "while-editing"` | No | — | Change the behaviour of when the toolbar becomes visible. |
|
|
58
|
+
| `transform` | `{ input?: (v: any) => string; output?: (v: string) => any; }` | No | — | transform object is used to transform the internal TextInput value It's useful for components like InputNumber where ... |
|
|
59
|
+
| `usePrivacyEye` | `boolean` | No | `true` | Determines if InputPassword uses privacy eye suffix |
|
|
60
|
+
| `validations` | `RegisterOptions` | No | — | Shows an error message below the field and highlight the field red when value is invalid |
|
|
61
|
+
| `value` | `string` | No | — | Set the component to a given value |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Input Pressable
|
|
2
|
+
|
|
3
|
+
InputPressable is a component that is used to trigger an action when pressed.
|
|
4
|
+
|
|
5
|
+
## Design & usage guidelines
|
|
6
|
+
|
|
7
|
+
This component matches InputText in terms of visual design, but functionality is
|
|
8
|
+
tied to a press action instead of an input. As a result, this component can
|
|
9
|
+
launch a native modal or external library such as the DateTimePicker, instead of
|
|
10
|
+
acting as an input that triggers a keyboard when tapped.
|
|
11
|
+
|
|
12
|
+
### States
|
|
13
|
+
|
|
14
|
+
A
|
|
15
|
+
[disabled](/storybook/mobile/?path=/story/components-forms-and-inputs-inputpressable--disabled)
|
|
16
|
+
InputPressable cannot be pressed and is visually muted to indicate that it is
|
|
17
|
+
disabled.
|
|
18
|
+
|
|
19
|
+
An
|
|
20
|
+
[invalid](/storybook/mobile/?path=/story/components-forms-and-inputs-inputpressable--invalid)
|
|
21
|
+
state is indicated by a red input line and an error message. The error message
|
|
22
|
+
is displayed below the input.
|
|
23
|
+
|
|
24
|
+
To make an InputPressable
|
|
25
|
+
[clearable](/storybook/mobile/?path=/story/components-forms-and-inputs-inputpressable--clearable)
|
|
26
|
+
you need to pass the `clearable` prop set as `always`. The reason for this is
|
|
27
|
+
that InputPressable isn't an input that is focused in the same way an InputText
|
|
28
|
+
would be. When you want to have an input be clearable you will also need to
|
|
29
|
+
provide an `onClear` that will clear the input's value.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Controlled & Uncontrolled
|
|
33
|
+
|
|
34
|
+
InputPressable can only be used as a controlled component. Given the nature of
|
|
35
|
+
this input component which requires a wrapper to set the value, it doesn't make
|
|
36
|
+
sense for this component to be uncontrolled.
|
|
37
|
+
|
|
38
|
+
## Developer notes
|
|
39
|
+
|
|
40
|
+
To prevent a previously focused input from being focused again when the
|
|
41
|
+
`InputPressable` is closed you can `Keyboard.dismiss()` in the `onPress`.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Props
|
|
45
|
+
|
|
46
|
+
### Mobile
|
|
47
|
+
|
|
48
|
+
| Prop | Type | Required | Default | Description |
|
|
49
|
+
|------|------|----------|---------|-------------|
|
|
50
|
+
| `accessibilityHint` | `string` | No | — | Helps users understand what will happen when they perform an action |
|
|
51
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the element |
|
|
52
|
+
| `clearable` | `Clearable` | No | — | Add a clear action on the input that clears the value. Since the input value isn't editable (i.e. `InputDateTime`) y... |
|
|
53
|
+
| `disabled` | `boolean` | No | — | Disables input selection |
|
|
54
|
+
| `error` | `FieldError` | No | — | Indicates if there is an validation error |
|
|
55
|
+
| `focused` | `boolean` | No | — | Indicates if the input is focused |
|
|
56
|
+
| `invalid` | `string | boolean` | No | — | Indicates the current selection is invalid |
|
|
57
|
+
| `onClear` | `() => void` | No | — | Callback called when the user clicks the ClearAction button. Should clear the value passed. To disallow clearing set ... |
|
|
58
|
+
| `onPress` | `() => void` | No | — | Callback that is called when the text input is focused @param event |
|
|
59
|
+
| `placeholder` | `string` | No | — | Placeholder item shown until a selection is made |
|
|
60
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
61
|
+
| `ref` | `Ref<Text>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
62
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
63
|
+
| `suffix` | `XOR<BasicSuffix, InteractiveSuffix>` | No | — | Symbol to display after the text input |
|
|
64
|
+
| `value` | `string` | No | — | Current value of the component |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# InputSearch
|
|
2
|
+
|
|
3
|
+
The InputSearch component allows the user to input a keyword to search from
|
|
4
|
+
associated data. It handles debouncing for improved performance when making
|
|
5
|
+
queries.
|
|
6
|
+
|
|
7
|
+
## Design & usage guidelines
|
|
8
|
+
|
|
9
|
+
InputSearch will provide a consistent experience for users searching for
|
|
10
|
+
content. It uses familiar iconography and interactions to make searching a
|
|
11
|
+
simpler experience.
|
|
12
|
+
|
|
13
|
+
## Content guidelines
|
|
14
|
+
|
|
15
|
+
The label for InputSearch should help guide the user to find their results. It
|
|
16
|
+
can be helpful to direct the user to use certain types of queries for a given
|
|
17
|
+
search, such as "Search by clients and properties".
|
|
18
|
+
|
|
19
|
+
It is recommended to use the `search` icon as a prefix to aid users in
|
|
20
|
+
recognizing the functionality of the input.
|
|
21
|
+
|
|
22
|
+
InputSearch will take up the full available width of its container.
|
|
23
|
+
|
|
24
|
+
## Accessibility
|
|
25
|
+
|
|
26
|
+
Most of the accessibility concerns for InputSearch are handled by `InputText`.
|
|
27
|
+
It is announced as an input and the label and value are read to assistive
|
|
28
|
+
technology. Users can navigate to the clear button to remove the entered value.
|
|
29
|
+
|
|
30
|
+
## Mockup
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
### Mobile
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Required | Default | Description |
|
|
38
|
+
|------|------|----------|---------|-------------|
|
|
39
|
+
| `onChange` | `(newValue: string) => void` | Yes | — | A callback function that handles the update of the new value of the property value. |
|
|
40
|
+
| `onDebouncedChange` | `(searchValue: string) => void` | Yes | — | A callback function that handles the API call to search the value. This is where the wait value is applied to the deb... |
|
|
41
|
+
| `value` | `string` | Yes | — | Set the component to a given value |
|
|
42
|
+
| `accessibilityHint` | `string` | No | — | An accessibility hint helps users understand what will happen when they perform an action on the accessibility elemen... |
|
|
43
|
+
| `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the associated element |
|
|
44
|
+
| `autoFocus` | `boolean` | No | — | Automatically focus the input after it is rendered |
|
|
45
|
+
| `placeholder` | `string` | No | — | Hint text that goes above the value once the field is filled out |
|
|
46
|
+
| `prefix` | `{ icon?: IconNames; label?: string; }` | No | — | Symbol to display before the text input |
|
|
47
|
+
| `ref` | `Ref<InputTextRef>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
48
|
+
| `showMiniLabel` | `boolean` | No | `true` | Controls the visibility of the mini label that appears inside the input when a value is entered. By default, the plac... |
|
|
49
|
+
| `wait` | `number` | No | `300` | A numeric value to represents the milliseconds in delaying the function to populate the data source when the 'value' ... |
|