@coinbase/cds-mcp-server 8.53.1 → 8.55.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.
- package/CHANGELOG.md +8 -0
- package/mcp-docs/mobile/components/Calendar.txt +518 -0
- package/mcp-docs/mobile/components/DateInput.txt +1 -0
- package/mcp-docs/mobile/components/DatePicker.txt +156 -28
- package/mcp-docs/mobile/components/IconButton.txt +2 -0
- package/mcp-docs/mobile/components/SelectChip.txt +2 -0
- package/mcp-docs/mobile/components/Tooltip.txt +51 -12
- package/mcp-docs/mobile/components/Tray.txt +2 -0
- package/mcp-docs/mobile/guides/v8-migration-guide.txt +1762 -0
- package/mcp-docs/mobile/routes.txt +6 -1
- package/mcp-docs/web/components/Calendar.txt +132 -4
- package/mcp-docs/web/components/DatePicker.txt +28 -26
- package/mcp-docs/web/components/Tray.txt +1 -0
- package/mcp-docs/web/guides/v8-migration-guide.txt +1762 -0
- package/mcp-docs/web/routes.txt +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DatePicker
|
|
2
2
|
|
|
3
|
-
Date Picker allows our global users to input past, present, future and important dates into our interface in a simple and intuitive manner. Date Picker offers both manual and calendar entry options - accommodating both internationalization and accessibility needs
|
|
3
|
+
Date Picker allows our global users to input past, present, future and important dates into our interface in a simple and intuitive manner. Date Picker offers both manual and calendar entry options - accommodating both internationalization and accessibility needs.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -159,12 +159,16 @@ function Example() {
|
|
|
159
159
|
error={error}
|
|
160
160
|
onChangeDate={setDate}
|
|
161
161
|
onErrorDate={setError}
|
|
162
|
-
disabledDates={[new Date()]}
|
|
163
162
|
label="Birthdate"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
accessibilityLabel="Birthdate"
|
|
164
|
+
accessibilityHint="Enter date or select from calendar using the calendar button."
|
|
165
|
+
openCalendarAccessibilityLabel="Open calendar to select birthdate"
|
|
166
|
+
closeCalendarAccessibilityLabel="Close calendar without selecting a date"
|
|
167
|
+
confirmText="Confirm birthdate selection"
|
|
168
|
+
confirmButtonAccessibilityHint="Confirms the selected birthdate"
|
|
169
|
+
nextArrowAccessibilityLabel="Go to next month"
|
|
170
|
+
previousArrowAccessibilityLabel="Go to previous month"
|
|
171
|
+
highlightedDateAccessibilityHint="Highlighted"
|
|
168
172
|
invalidDateError="Please enter a valid date"
|
|
169
173
|
disabledDateError="Date unavailable"
|
|
170
174
|
requiredError="This field is required"
|
|
@@ -199,7 +203,7 @@ function Example() {
|
|
|
199
203
|
|
|
200
204
|
### Styling
|
|
201
205
|
|
|
202
|
-
DatePicker supports the same styling functionality as [DateInput](/components/other/DateInput/).
|
|
206
|
+
DatePicker supports the same styling functionality as [DateInput](/components/other/DateInput/) and [Calendar](/components/other/Calendar/).
|
|
203
207
|
|
|
204
208
|
#### Compact
|
|
205
209
|
|
|
@@ -397,7 +401,7 @@ function Example() {
|
|
|
397
401
|
|
|
398
402
|
Defaults to today when undefined.
|
|
399
403
|
|
|
400
|
-
|
|
404
|
+
The `seedDate` prop is used to generate the Calendar month when there is no selected date value.
|
|
401
405
|
|
|
402
406
|
```jsx
|
|
403
407
|
function Example() {
|
|
@@ -422,6 +426,122 @@ function Example() {
|
|
|
422
426
|
|
|
423
427
|
### Composed Examples
|
|
424
428
|
|
|
429
|
+
Make sure to provide the `requiredError` prop when setting the `required` prop to true. The `requiredError` will be displayed if a user blurs the input, without a date selected, after having typed into it.
|
|
430
|
+
|
|
431
|
+
```jsx
|
|
432
|
+
function Example() {
|
|
433
|
+
const [date, setDate] = useState(null);
|
|
434
|
+
const [error, setError] = useState(null);
|
|
435
|
+
|
|
436
|
+
return (
|
|
437
|
+
<DatePicker
|
|
438
|
+
required
|
|
439
|
+
date={date}
|
|
440
|
+
error={error}
|
|
441
|
+
onChangeDate={setDate}
|
|
442
|
+
onErrorDate={setError}
|
|
443
|
+
label="Birthdate"
|
|
444
|
+
invalidDateError="Please enter a valid date"
|
|
445
|
+
requiredError="This field is required"
|
|
446
|
+
/>
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
#### Highlighted dates
|
|
452
|
+
|
|
453
|
+
The `highlightedDates` prop is an array of Dates and Date tuples for date ranges. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges.
|
|
454
|
+
|
|
455
|
+
```jsx
|
|
456
|
+
function Example() {
|
|
457
|
+
const [date, setDate] = useState(null);
|
|
458
|
+
const [error, setError] = useState(null);
|
|
459
|
+
|
|
460
|
+
const today = new Date(new Date().setHours(0, 0, 0, 0));
|
|
461
|
+
const oneWeekAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
|
|
462
|
+
const twoDaysAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 2);
|
|
463
|
+
const oneWeekLater = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 7);
|
|
464
|
+
|
|
465
|
+
const highlightedDates = [[oneWeekAgo, twoDaysAgo], oneWeekLater];
|
|
466
|
+
|
|
467
|
+
return (
|
|
468
|
+
<DatePicker
|
|
469
|
+
date={date}
|
|
470
|
+
error={error}
|
|
471
|
+
onChangeDate={setDate}
|
|
472
|
+
onErrorDate={setError}
|
|
473
|
+
highlightedDates={highlightedDates}
|
|
474
|
+
label="Select a date"
|
|
475
|
+
invalidDateError="Please enter a valid date"
|
|
476
|
+
/>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Minimum and maximum dates
|
|
482
|
+
|
|
483
|
+
Make sure to provide the `disabledDateError` prop when providing `minDate`, `maxDate`, or `disabledDates` props. Navigation to dates before the `minDate` and after the `maxDate` is disabled.
|
|
484
|
+
|
|
485
|
+
```jsx
|
|
486
|
+
function Example() {
|
|
487
|
+
const [date, setDate] = useState(null);
|
|
488
|
+
const [error, setError] = useState(null);
|
|
489
|
+
|
|
490
|
+
const today = new Date(new Date().setHours(0, 0, 0, 0));
|
|
491
|
+
const lastMonth15th = new Date(today.getFullYear(), today.getMonth() - 1, 15);
|
|
492
|
+
const nextMonth15th = new Date(today.getFullYear(), today.getMonth() + 1, 15);
|
|
493
|
+
|
|
494
|
+
return (
|
|
495
|
+
<DatePicker
|
|
496
|
+
date={date}
|
|
497
|
+
error={error}
|
|
498
|
+
onChangeDate={setDate}
|
|
499
|
+
onErrorDate={setError}
|
|
500
|
+
minDate={lastMonth15th}
|
|
501
|
+
maxDate={nextMonth15th}
|
|
502
|
+
label="Birthdate"
|
|
503
|
+
invalidDateError="Please enter a valid date"
|
|
504
|
+
disabledDateError="Date unavailable"
|
|
505
|
+
/>
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
#### Disabled dates
|
|
511
|
+
|
|
512
|
+
The `disabledDates` prop is an array of Dates and Date tuples for date ranges. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges.
|
|
513
|
+
|
|
514
|
+
Make sure to provide the `disabledDateError` prop when providing `minDate`, `maxDate`, or `disabledDates` props.
|
|
515
|
+
|
|
516
|
+
```jsx
|
|
517
|
+
function Example() {
|
|
518
|
+
const [date, setDate] = useState(null);
|
|
519
|
+
const [error, setError] = useState(null);
|
|
520
|
+
|
|
521
|
+
const today = new Date(new Date().setHours(0, 0, 0, 0));
|
|
522
|
+
const tomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
|
523
|
+
const startOfNextWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 7);
|
|
524
|
+
const endOfNextWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 13);
|
|
525
|
+
|
|
526
|
+
return (
|
|
527
|
+
<DatePicker
|
|
528
|
+
date={date}
|
|
529
|
+
error={error}
|
|
530
|
+
onChangeDate={setDate}
|
|
531
|
+
onErrorDate={setError}
|
|
532
|
+
disabledDates={[
|
|
533
|
+
today,
|
|
534
|
+
tomorrow,
|
|
535
|
+
[startOfNextWeek, endOfNextWeek], // Disable entire range
|
|
536
|
+
]}
|
|
537
|
+
label="Appointment date"
|
|
538
|
+
invalidDateError="Please enter a valid date"
|
|
539
|
+
disabledDateError="This date is not available"
|
|
540
|
+
/>
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
425
545
|
#### Date range selector
|
|
426
546
|
|
|
427
547
|
This is a complex example using many different props. We use multiple DatePickers together to allow a user to select a date range.
|
|
@@ -437,11 +557,8 @@ function Example() {
|
|
|
437
557
|
|
|
438
558
|
const today = new Date(new Date().setHours(0, 0, 0, 0));
|
|
439
559
|
const firstDayThisMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
|
440
|
-
const seventhDayThisMonth = new Date(today.getFullYear(), today.getMonth(), 7);
|
|
441
560
|
const lastDayThisMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
442
561
|
|
|
443
|
-
const disabledDates = [[firstDayThisMonth, seventhDayThisMonth]];
|
|
444
|
-
|
|
445
562
|
const updateEndDate = (endDate, startDate) => {
|
|
446
563
|
setEndDate(endDate);
|
|
447
564
|
setEndError(null);
|
|
@@ -480,12 +597,10 @@ function Example() {
|
|
|
480
597
|
};
|
|
481
598
|
|
|
482
599
|
return (
|
|
483
|
-
<
|
|
600
|
+
<VStack gap={2}>
|
|
484
601
|
<DatePicker
|
|
485
602
|
required
|
|
486
603
|
date={startDate}
|
|
487
|
-
disabledDateError="Date unavailable"
|
|
488
|
-
disabledDates={disabledDates}
|
|
489
604
|
error={startError}
|
|
490
605
|
highlightedDates={startDate && endDate ? [[startDate, endDate]] : undefined}
|
|
491
606
|
invalidDateError="Please enter a valid date"
|
|
@@ -500,8 +615,7 @@ function Example() {
|
|
|
500
615
|
required
|
|
501
616
|
date={endDate}
|
|
502
617
|
disabled={!startDate}
|
|
503
|
-
|
|
504
|
-
disabledDates={startDate ? [...disabledDates, startDate] : disabledDates}
|
|
618
|
+
disabledDates={startDate ? [startDate] : undefined}
|
|
505
619
|
error={endError}
|
|
506
620
|
highlightedDates={
|
|
507
621
|
startDate && endDate && startDate < endDate
|
|
@@ -519,18 +633,18 @@ function Example() {
|
|
|
519
633
|
requiredError="This field is required"
|
|
520
634
|
variant={endError ? 'negative' : undefined}
|
|
521
635
|
/>
|
|
522
|
-
</
|
|
636
|
+
</VStack>
|
|
523
637
|
);
|
|
524
638
|
}
|
|
525
639
|
```
|
|
526
640
|
|
|
527
641
|
### Event Lifecycle
|
|
528
642
|
|
|
529
|
-
- Selecting a date with the
|
|
643
|
+
- Selecting a date with the Calendar:
|
|
530
644
|
|
|
531
645
|
`onOpen -> onConfirm -> onChangeDate -> onErrorDate -> onClose`
|
|
532
646
|
|
|
533
|
-
- Closing the
|
|
647
|
+
- Closing the Calendar without selecting a date:
|
|
534
648
|
|
|
535
649
|
`onOpen -> onCancel -> onClose`
|
|
536
650
|
|
|
@@ -542,6 +656,10 @@ function Example() {
|
|
|
542
656
|
|
|
543
657
|
`onChange -> onChangeDate -> onChange -> onChange -> ... -> onChangeDate -> onErrorDate`
|
|
544
658
|
|
|
659
|
+
:::note
|
|
660
|
+
The Calendar picker requires pressing the confirm button to select a date.
|
|
661
|
+
:::
|
|
662
|
+
|
|
545
663
|
```jsx
|
|
546
664
|
function Example() {
|
|
547
665
|
const [date, setDate] = useState(null);
|
|
@@ -592,18 +710,22 @@ function Example() {
|
|
|
592
710
|
| `blurOnSubmit` | `boolean` | No | `-` | If true, the text field will blur when submitted. The default value is true. |
|
|
593
711
|
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `200` | Leverage one of the borderRadius styles we offer to round the corners of the input. |
|
|
594
712
|
| `bordered` | `boolean` | No | `true` | Determines if the input should have a border |
|
|
595
|
-
| `calendarIconButtonAccessibilityLabel` | `string` | No |
|
|
713
|
+
| `calendarIconButtonAccessibilityLabel` | `string` | No | `-` | Accessibility label describing the calendar IconButton, which opens the calendar when pressed. |
|
|
596
714
|
| `caretHidden` | `boolean` | No | `-` | If true, caret is hidden. The default value is false. |
|
|
597
715
|
| `clearButtonMode` | `never \| while-editing \| unless-editing \| always` | No | `-` | enum(never, while-editing, unless-editing, always) When the clear button should appear on the right side of the text view |
|
|
598
716
|
| `clearTextOnFocus` | `boolean` | No | `-` | If true, clears the text field automatically when editing begins |
|
|
717
|
+
| `closeCalendarAccessibilityLabel` | `string` | No | `'Close calendar without selecting a date'` | Accessibility label for the handle bar that closes the picker. |
|
|
599
718
|
| `compact` | `boolean` | No | `false` | Enables compact variation |
|
|
719
|
+
| `confirmButtonAccessibilityHint` | `string` | No | `-` | Accessibility hint for the confirm button. |
|
|
720
|
+
| `confirmText` | `string` | No | `'Confirm'` | Text to display on the confirm button. |
|
|
600
721
|
| `contextMenuHidden` | `boolean` | No | `-` | If true, context menu is hidden. The default value is false. |
|
|
601
722
|
| `cursorColor` | `ColorValue \| null` | No | `-` | When provided it will set the color of the cursor (or caret) in the component. Unlike the behavior of selectionColor the cursor color will be set independently from the color of the text selection box. |
|
|
602
723
|
| `dataDetectorTypes` | `DataDetectorTypes \| DataDetectorTypes[]` | No | `-` | Determines the types of data converted to clickable URLs in the text input. Only valid if multiline={true} and editable={false}. By default no data types are detected. You can provide one type or an array of many types. Possible values for dataDetectorTypes are: - phoneNumber - link - address - calendarEvent - none - all |
|
|
603
|
-
| `dateInputStyle` | `null \| false \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<ViewStyle \| Falsy \| RegisteredStyle<ViewStyle>>` | No | `-` |
|
|
724
|
+
| `dateInputStyle` | `null \| false \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<ViewStyle \| Falsy \| RegisteredStyle<ViewStyle>>` | No | `-` | Custom style to apply to the DateInput. |
|
|
604
725
|
| `disableFullscreenUI` | `boolean` | No | `-` | When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), the OS may choose to have the user edit the text inside of a full screen text input mode. When true, this feature is disabled and users will always edit the text directly inside of the text input. Defaults to false. |
|
|
605
726
|
| `disabled` | `boolean` | No | `false` | Disables user interaction. Toggles input interactability and opacity |
|
|
606
|
-
| `disabledDateError` | `string` | No | `'Date unavailable'` |
|
|
727
|
+
| `disabledDateError` | `string` | No | `'Date unavailable'` | Tooltip content shown when hovering or focusing a disabled date, including dates before the minDate or after the maxDate. |
|
|
728
|
+
| `disabledDates` | `(Date \| [Date, Date])[]` | No | `-` | Array of disabled dates, and date tuples for date ranges. Make sure to set disabledDateError as well. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges. |
|
|
607
729
|
| `editable` | `boolean` | No | `-` | If false, text is not editable. The default value is true. |
|
|
608
730
|
| `enableColorSurge` | `boolean` | No | `-` | Enable Color Surge motion |
|
|
609
731
|
| `enablesReturnKeyAutomatically` | `boolean` | No | `-` | If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. The default value is false. |
|
|
@@ -612,6 +734,8 @@ function Example() {
|
|
|
612
734
|
| `height` | `string \| number` | No | `-` | Height of input |
|
|
613
735
|
| `helperText` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | For cases where label is not enough information to describe what the text input is for. Can also be used for showing positive/negative messages |
|
|
614
736
|
| `helperTextErrorIconAccessibilityLabel` | `string` | No | `'error'` | Accessibility label for helper text error icon when variant=negative |
|
|
737
|
+
| `highlightedDateAccessibilityHint` | `string` | No | `'Highlighted'` | Accessibility hint announced for highlighted dates. Applied to all highlighted dates. |
|
|
738
|
+
| `highlightedDates` | `(Date \| [Date, Date])[]` | No | `-` | Array of highlighted dates, and date tuples for date ranges. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges. |
|
|
615
739
|
| `importantForAutofill` | `auto \| yes \| no \| noExcludeDescendants \| yesExcludeDescendants` | No | `-` | Determines whether the individual fields in your app should be included in a view structure for autofill purposes on Android API Level 26+. Defaults to auto. To disable auto complete, use off. *Android Only* The following values work on Android only: - auto - let Android decide - no - not important for autofill - noExcludeDescendants - this view and its children arent important for autofill - yes - is important for autofill - yesExcludeDescendants - this view is important for autofill but its children arent |
|
|
616
740
|
| `inlineImageLeft` | `string` | No | `-` | If defined, the provided image resource will be rendered on the left. |
|
|
617
741
|
| `inlineImagePadding` | `number` | No | `-` | Padding between the inline image, if any, and the text input itself. |
|
|
@@ -632,18 +756,19 @@ function Example() {
|
|
|
632
756
|
| `minDate` | `Date` | No | `-` | Minimum date allowed to be selected, inclusive. Dates before the minDate are disabled. All navigation to months before the minDate is disabled. |
|
|
633
757
|
| `minHeight` | `string \| number` | No | `auto` | minimum height of input |
|
|
634
758
|
| `multiline` | `boolean` | No | `-` | If true, the text input can be multiple lines. The default value is false. |
|
|
759
|
+
| `nextArrowAccessibilityLabel` | `string` | No | `'Go to next month'` | Accessibility label describing the Calendar next month arrow. |
|
|
635
760
|
| `numberOfLines` | `number` | No | `-` | Sets the number of lines for a TextInput. Use it with multiline set to true to be able to fill the lines. |
|
|
636
761
|
| `onBlur` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is blurred |
|
|
637
|
-
| `onCancel` | `(() => void)` | No | `-` | Callback function fired when the user closes the
|
|
638
|
-
| `onChange` | `(((
|
|
762
|
+
| `onCancel` | `(() => void)` | No | `-` | Callback function fired when the user closes the picker without selecting a date. Interacting with the DateInput does not fire this callback. Will always be called before onClose. |
|
|
763
|
+
| `onChange` | `(((e: NativeSyntheticEvent<TextInputChangeEventData>) => void) & ((event: NativeSyntheticEvent<TextInputChangeEventData>) => void))` | No | `-` | Callback function fired when the DateInput text value changes. Prefer to use onChangeDate instead. Will always be called before onChangeDate. This prop should only be used for edge cases, such as custom error handling. |
|
|
639
764
|
| `onChangeText` | `((text: string) => void)` | No | `-` | - |
|
|
640
|
-
| `onClose` | `(() => void)` | No | `-` | Callback function fired when the
|
|
641
|
-
| `onConfirm` | `(() => void)` | No | `-` | Callback function fired when the user selects a date using the
|
|
765
|
+
| `onClose` | `(() => void)` | No | `-` | Callback function fired when the picker is closed. Will always be called after onCancel, onConfirm, and onChangeDate. |
|
|
766
|
+
| `onConfirm` | `(() => void)` | No | `-` | Callback function fired when the user selects a date using the picker. Interacting with the DateInput does not fire this callback. Will always be called before onClose. |
|
|
642
767
|
| `onContentSizeChange` | `((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void)` | No | `-` | Callback that is called when the text inputs content size changes. This will be called with { nativeEvent: { contentSize: { width, height } } }. Only called for multiline text inputs. |
|
|
643
768
|
| `onEndEditing` | `((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void)` | No | `-` | Callback that is called when text input ends. |
|
|
644
769
|
| `onFocus` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is focused |
|
|
645
770
|
| `onKeyPress` | `((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void)` | No | `-` | Callback that is called when a key is pressed. This will be called with { nativeEvent: { key: keyValue } } where keyValue is Enter or Backspace for respective keys and the typed-in character otherwise including for space. Fires before onChange callbacks. Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs. |
|
|
646
|
-
| `onOpen` | `(() => void)` | No | `-` | Callback function fired when the
|
|
771
|
+
| `onOpen` | `(() => void)` | No | `-` | Callback function fired when the picker is opened. |
|
|
647
772
|
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
648
773
|
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
649
774
|
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
@@ -663,9 +788,11 @@ function Example() {
|
|
|
663
788
|
| `onSelectionChange` | `((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void)` | No | `-` | Callback that is called when the text input selection is changed. |
|
|
664
789
|
| `onSubmitEditing` | `((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)` | No | `-` | Callback that is called when the text inputs submit button is pressed. |
|
|
665
790
|
| `onTextInput` | `((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void)` | No | `-` | Callback that is called on new text input with the argument { nativeEvent: { text, previousText, range: { start, end } } }. This prop requires multiline={true} to be set. |
|
|
791
|
+
| `openCalendarAccessibilityLabel` | `string` | No | `'Open calendar'` | Accessibility label for the calendar IconButton, which opens the calendar when pressed. |
|
|
666
792
|
| `passwordRules` | `string \| null` | No | `-` | Provide rules for your password. For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters. required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8; |
|
|
667
793
|
| `placeholder` | `string` | No | `-` | Placeholder text displayed inside of the input. Will be replaced if there is a value. The string that will be rendered before text input has been entered |
|
|
668
794
|
| `placeholderTextColor` | `string \| OpaqueColorValue` | No | `-` | The text color of the placeholder string |
|
|
795
|
+
| `previousArrowAccessibilityLabel` | `string` | No | `'Go to previous month'` | Accessibility label describing the Calendar previous month arrow. |
|
|
669
796
|
| `readOnly` | `boolean` | No | `-` | If true, text is not editable. The default value is false. |
|
|
670
797
|
| `ref` | `((instance: View \| null) => void) \| RefObject<View> \| null` | No | `-` | - |
|
|
671
798
|
| `rejectResponderTermination` | `boolean \| null` | No | `-` | If true, allows TextInput to pass touch events to the parent component. This allows components to be swipeable from the TextInput on iOS, as is the case on Android by default. If false, TextInput always asks to handle the input (except when disabled). |
|
|
@@ -675,7 +802,7 @@ function Example() {
|
|
|
675
802
|
| `returnKeyType` | `search \| join \| done \| none \| default \| go \| next \| send \| previous \| google \| route \| yahoo \| emergency-call` | No | `-` | enum(default, go, google, join, next, route, search, send, yahoo, done, emergency-call) Determines how the return key should look. |
|
|
676
803
|
| `scrollEnabled` | `boolean` | No | `-` | If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true} |
|
|
677
804
|
| `secureTextEntry` | `boolean` | No | `-` | If true, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value is false. |
|
|
678
|
-
| `seedDate` | `Date` | No | `-` | Date
|
|
805
|
+
| `seedDate` | `Date` | No | `-` | Date used to generate the Calendar month when there is no value for the selectedDate prop, defaults to today. |
|
|
679
806
|
| `selectTextOnFocus` | `boolean` | No | `-` | If true, all text will automatically be selected on focus |
|
|
680
807
|
| `selection` | `{ start: number; end?: number; } \| undefined` | No | `-` | The start and end of the text inputs selection. Set start and end to the same value to position the cursor. |
|
|
681
808
|
| `selectionColor` | `string \| OpaqueColorValue` | No | `-` | The highlight (and cursor on ios) color of the text input |
|
|
@@ -685,6 +812,7 @@ function Example() {
|
|
|
685
812
|
| `smartInsertDelete` | `boolean` | No | `-` | If false, the iOS system will not insert an extra space after a paste operation neither delete one or two spaces after a cut or delete operation. The default value is true. |
|
|
686
813
|
| `spellCheck` | `boolean` | No | `-` | If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect |
|
|
687
814
|
| `start` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds content to the start of the inner input. Refer to diagram for location of startNode in InputStack component |
|
|
815
|
+
| `styles` | `{ dateInput?: StyleProp<ViewStyle>; calendar?: StyleProp<ViewStyle>; calendarHeader?: StyleProp<ViewStyle>; calendarTitle?: StyleProp<TextStyle>; calendarNavigation?: StyleProp<ViewStyle>; calendarContent?: StyleProp<ViewStyle>; calendarDay?: StyleProp<ViewStyle>; }` | No | `-` | Custom styles for the DateInput and Calendar subcomponents. |
|
|
688
816
|
| `suffix` | `string` | No | `-` | Adds suffix text to the end of input |
|
|
689
817
|
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID Used to locate this view in end-to-end tests |
|
|
690
818
|
| `testIDMap` | `{ start?: string; end?: string \| undefined; label?: string \| undefined; helperText?: string \| undefined; } \| undefined` | No | `-` | Add ability to test individual parts of the input |
|
|
@@ -296,6 +296,7 @@ An icon button with a badge showing the notification count. Uses `DotCount` to d
|
|
|
296
296
|
| `height` | `string \| number` | No | `-` | - |
|
|
297
297
|
| `iconSize` | `xs \| s \| m \| l` | No | `compact ? 's' : 'm'` | Size for the icon rendered inside the button. |
|
|
298
298
|
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
299
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
299
300
|
| `left` | `string \| number` | No | `-` | - |
|
|
300
301
|
| `lineHeight` | `inherit \| LineHeight` | No | `-` | - |
|
|
301
302
|
| `loading` | `boolean` | No | `-` | Is the element currenty loading. When set to true, will disable element from press and keyboard events Is the element currenty loading. Mark the button as loading and display a spinner. |
|
|
@@ -325,6 +326,7 @@ An icon button with a badge showing the notification count. Uses `DotCount` to d
|
|
|
325
326
|
| `paddingY` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
326
327
|
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
327
328
|
| `position` | `static \| relative \| fixed \| absolute \| sticky` | No | `-` | - |
|
|
329
|
+
| `ref` | `((instance: View \| null) => void) \| RefObject<View> \| null` | No | `-` | - |
|
|
328
330
|
| `right` | `string \| number` | No | `-` | - |
|
|
329
331
|
| `rowGap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
330
332
|
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID Used to locate this element in unit and end-to-end tests. |
|
|
@@ -219,6 +219,7 @@ function SelectChipExample() {
|
|
|
219
219
|
| `debounceTime` | `number` | No | `500` | The amount of time to wait (in milliseconds) before invoking the debounced function. This prop is used in conjunction with the disableDebounce prop. The debounce function is configured to be invoked as soon as its called, but subsequent calls within the debounceTime period will be ignored. |
|
|
220
220
|
| `disableCapturePanGestureToDismiss` | `boolean` | No | `false` | Prevents the Drawer from capturing pan gestures on children. Set to true when using a ScrollView as a child |
|
|
221
221
|
| `disableDebounce` | `boolean` | No | `-` | React Native is historically trash at debouncing touch events. This can cause a lot of unwanted behavior such as double navigations where we push a screen onto the stack 2 times. Debouncing the event 500 miliseconds, but taking the leading event prevents this effect and the accidental double-tap. |
|
|
222
|
+
| `disableSafeAreaPaddingBottom` | `boolean` | No | `-` | disable safe area padding for bottom of drawer when true |
|
|
222
223
|
| `disabled` | `boolean` | No | `-` | Is the element currently disabled. Whether the press behavior is disabled. |
|
|
223
224
|
| `display` | `flex \| none` | No | `-` | - |
|
|
224
225
|
| `elevation` | `0 \| 1 \| 2` | No | `-` | Determines box shadow styles. Parent should have overflow set to visible to ensure styles are not clipped. Is the element elevated. |
|
|
@@ -265,6 +266,7 @@ function SelectChipExample() {
|
|
|
265
266
|
| `onBlur` | `(() => void)` | No | `-` | Callback fired when the overlay is pressed, or swipe to close |
|
|
266
267
|
| `onChange` | `((newValue: string) => void) \| Dispatch<SetStateAction<string>>` | No | `-` | Callback that is fired whenever a select option is selected |
|
|
267
268
|
| `onDismiss` | `(() => void)` | No | `-` | The onDismiss prop allows passing a function that will be called once the modal has been dismissed. |
|
|
269
|
+
| `onOpenComplete` | `(() => void)` | No | `-` | Callback fired when the open animation completes. |
|
|
268
270
|
| `onOrientationChange` | `((event: NativeSyntheticEvent<any>) => void)` | No | `-` | The onOrientationChange callback is called when the orientation changes while the modal is being displayed. The orientation provided is only portrait or landscape. This callback is also called on initial render, regardless of the current orientation. |
|
|
269
271
|
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
270
272
|
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
@@ -10,25 +10,32 @@ import { Tooltip } from '@coinbase/cds-mobile/overlays/Tooltip'
|
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
13
|
+
### Basic usage
|
|
14
|
+
|
|
15
|
+
A basic Tooltip that displays additional information when the trigger element is pressed.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
function Example() {
|
|
19
|
+
return (
|
|
20
|
+
<Tooltip content="This is helpful information">
|
|
21
|
+
<Button>Show tooltip</Button>
|
|
22
|
+
</Tooltip>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
13
27
|
### Placement
|
|
14
28
|
|
|
29
|
+
Control the tooltip position using the `placement` prop. Available options are `top` and `bottom`.
|
|
30
|
+
|
|
15
31
|
```jsx
|
|
16
|
-
function
|
|
17
|
-
const content = 'This is the tooltip
|
|
32
|
+
function Example() {
|
|
33
|
+
const content = 'This is the tooltip content';
|
|
18
34
|
return (
|
|
19
|
-
<HStack
|
|
20
|
-
<Tooltip content={content}>
|
|
21
|
-
<Button>Default</Button>
|
|
22
|
-
</Tooltip>
|
|
35
|
+
<HStack gap={2} justifyContent="space-around">
|
|
23
36
|
<Tooltip content={content} placement="top">
|
|
24
37
|
<Button>Top</Button>
|
|
25
38
|
</Tooltip>
|
|
26
|
-
<Tooltip content={content} placement="left">
|
|
27
|
-
<Button>Left</Button>
|
|
28
|
-
</Tooltip>
|
|
29
|
-
<Tooltip content={content} placement="right">
|
|
30
|
-
<Button>Right</Button>
|
|
31
|
-
</Tooltip>
|
|
32
39
|
<Tooltip content={content} placement="bottom">
|
|
33
40
|
<Button>Bottom</Button>
|
|
34
41
|
</Tooltip>
|
|
@@ -71,6 +78,37 @@ function TooltipVisibilityDelay() {
|
|
|
71
78
|
<Button>Open 400 / Close 150</Button>
|
|
72
79
|
</Tooltip>
|
|
73
80
|
</HStack>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Accessibility
|
|
84
|
+
|
|
85
|
+
Always provide appropriate accessibility labels when the tooltip trigger is not a simple text string.
|
|
86
|
+
|
|
87
|
+
```jsx
|
|
88
|
+
function Example() {
|
|
89
|
+
return (
|
|
90
|
+
<Tooltip
|
|
91
|
+
content="Additional information about this icon"
|
|
92
|
+
accessibilityLabel="Info icon"
|
|
93
|
+
accessibilityHint="Tap to show more information"
|
|
94
|
+
accessibilityLabelForContent="Additional information about this icon"
|
|
95
|
+
>
|
|
96
|
+
<Icon name="info" size="m" />
|
|
97
|
+
</Tooltip>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Color scheme
|
|
103
|
+
|
|
104
|
+
By default, tooltips use an inverted color scheme. You can disable this with `invertColorScheme={false}`.
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
function Example() {
|
|
108
|
+
return (
|
|
109
|
+
<Tooltip content="This tooltip uses the regular color scheme" invertColorScheme={false}>
|
|
110
|
+
<Button>Show tooltip</Button>
|
|
111
|
+
</Tooltip>
|
|
74
112
|
);
|
|
75
113
|
}
|
|
76
114
|
```
|
|
@@ -84,6 +122,7 @@ function TooltipVisibilityDelay() {
|
|
|
84
122
|
| `accessibilityHintForContent` | `string` | No | `-` | The accessibilityHint for the content of the tooltip. If content is a string, this is not required as accessibilityHint would be set to the content. Otherwise, this is required |
|
|
85
123
|
| `accessibilityLabel` | `string` | No | `-` | If the children of the trigger is not a string, then you have to set your own accessibilityLabel to ensure that the tooltip is read correctly for voice-overs. |
|
|
86
124
|
| `accessibilityLabelForContent` | `string` | No | `-` | The accessibilityLabel for the content of the tooltip. If content is a string, this is not required as accessibilityHint would be set to the content. Otherwise, this is required |
|
|
125
|
+
| `accessibilityState` | `AccessibilityState` | No | `-` | Accessibility state for the trigger. |
|
|
87
126
|
| `closeDelay` | `number` | No | `-` | Delay (in ms) before hiding the tooltip after dismiss. |
|
|
88
127
|
| `elevation` | `0 \| 1 \| 2` | No | `-` | Determines a components shadow styles. Parent should have overflow set to visible to ensure styles are not clipped. |
|
|
89
128
|
| `gap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `1` | This value corresponds to how big the gap between the subject and the tooltip is. We do not encourage usage of this prop. But it is enabled for special cases as an escape hatch. |
|
|
@@ -820,6 +820,7 @@ function Example() {
|
|
|
820
820
|
| `animationType` | `none \| slide \| fade` | No | `-` | The animationType prop controls how the modal animates. - slide slides in from the bottom - fade fades into view - none appears without an animation |
|
|
821
821
|
| `children` | `ReactNode \| TrayRenderChildren` | No | `-` | Component to render as the Tray content |
|
|
822
822
|
| `disableCapturePanGestureToDismiss` | `boolean` | No | `false` | Prevents the Drawer from capturing pan gestures on children. Set to true when using a ScrollView as a child |
|
|
823
|
+
| `disableSafeAreaPaddingBottom` | `boolean` | No | `-` | disable safe area padding for bottom of drawer when true |
|
|
823
824
|
| `footer` | `ReactNode \| TrayRenderChildren` | No | `-` | Component to render as the Tray footer |
|
|
824
825
|
| `handleBarAccessibilityLabel` | `string` | No | `-` | Accessibility label for handlebar |
|
|
825
826
|
| `handleBarVariant` | `inside \| outside` | No | `'outside'` | The HandleBar can be rendered inside or outside the drawer, when pinned to bottom. |
|
|
@@ -830,6 +831,7 @@ function Example() {
|
|
|
830
831
|
| `key` | `Key \| null` | No | `-` | - |
|
|
831
832
|
| `onBlur` | `(() => void)` | No | `-` | Callback fired when the overlay is pressed, or swipe to close |
|
|
832
833
|
| `onDismiss` | `(() => void)` | No | `-` | The onDismiss prop allows passing a function that will be called once the modal has been dismissed. |
|
|
834
|
+
| `onOpenComplete` | `(() => void)` | No | `-` | Callback fired when the open animation completes. |
|
|
833
835
|
| `onOrientationChange` | `((event: NativeSyntheticEvent<any>) => void)` | No | `-` | The onOrientationChange callback is called when the orientation changes while the modal is being displayed. The orientation provided is only portrait or landscape. This callback is also called on initial render, regardless of the current orientation. |
|
|
834
836
|
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
835
837
|
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|