@aws-amplify/ui-react 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/styles.css +1 -1
  3. package/dist/types/primitives/types/alert.d.ts +6 -0
  4. package/dist/types/primitives/types/badge.d.ts +2 -0
  5. package/dist/types/primitives/types/base.d.ts +15 -0
  6. package/dist/types/primitives/types/button.d.ts +8 -0
  7. package/dist/types/primitives/types/card.d.ts +4 -0
  8. package/dist/types/primitives/types/checkbox.d.ts +5 -3
  9. package/dist/types/primitives/types/collection.d.ts +11 -0
  10. package/dist/types/primitives/types/divider.d.ts +3 -0
  11. package/dist/types/primitives/types/expander.d.ts +7 -0
  12. package/dist/types/primitives/types/field.d.ts +4 -0
  13. package/dist/types/primitives/types/fieldGroupIcon.d.ts +2 -0
  14. package/dist/types/primitives/types/flex.d.ts +7 -0
  15. package/dist/types/primitives/types/heading.d.ts +4 -0
  16. package/dist/types/primitives/types/icon.d.ts +9 -4
  17. package/dist/types/primitives/types/image.d.ts +17 -3
  18. package/dist/types/primitives/types/input.d.ts +18 -3
  19. package/dist/types/primitives/types/label.d.ts +2 -0
  20. package/dist/types/primitives/types/link.d.ts +3 -0
  21. package/dist/types/primitives/types/loader.d.ts +7 -0
  22. package/dist/types/primitives/types/menu.d.ts +10 -0
  23. package/dist/types/primitives/types/pagination.d.ts +17 -0
  24. package/dist/types/primitives/types/passwordField.d.ts +12 -1
  25. package/dist/types/primitives/types/phoneNumberField.d.ts +25 -0
  26. package/dist/types/primitives/types/placeholder.d.ts +2 -0
  27. package/dist/types/primitives/types/radio.d.ts +1 -0
  28. package/dist/types/primitives/types/radioGroupField.d.ts +2 -0
  29. package/dist/types/primitives/types/rating.d.ts +7 -0
  30. package/dist/types/primitives/types/searchField.d.ts +5 -0
  31. package/dist/types/primitives/types/select.d.ts +52 -0
  32. package/dist/types/primitives/types/selectField.d.ts +1 -0
  33. package/dist/types/primitives/types/sliderField.d.ts +48 -0
  34. package/dist/types/primitives/types/stepperField.d.ts +35 -0
  35. package/dist/types/primitives/types/style.d.ts +331 -6
  36. package/dist/types/primitives/types/switchField.d.ts +13 -0
  37. package/dist/types/primitives/types/table.d.ts +12 -0
  38. package/dist/types/primitives/types/tabs.d.ts +8 -0
  39. package/dist/types/primitives/types/text.d.ts +3 -0
  40. package/dist/types/primitives/types/textArea.d.ts +19 -3
  41. package/dist/types/primitives/types/textField.d.ts +5 -0
  42. package/dist/types/primitives/types/toggleButton.d.ts +16 -0
  43. package/dist/types/primitives/types/toggleButtonGroup.d.ts +20 -0
  44. package/dist/types/primitives/types/view.d.ts +24 -0
  45. package/package.json +2 -2
@@ -4,34 +4,44 @@ import { FlexProps } from './flex';
4
4
  import { Sizes } from './base';
5
5
  export interface MenuProps extends FlexProps {
6
6
  /**
7
+ * @description
7
8
  * Alignment of menu against trigger
8
9
  * @default "start"
9
10
  */
10
11
  menuAlign?: 'start' | 'center' | 'end';
11
12
  /**
13
+ * @description
12
14
  * Handle open and close event of menu
13
15
  */
14
16
  onOpenChange?: (isOpen: boolean) => void;
15
17
  /**
18
+ * @description
16
19
  * Default for controlled menu
17
20
  */
18
21
  isOpen?: boolean;
19
22
  /**
23
+ * @description
20
24
  * Size of Menu button and items
21
25
  */
22
26
  size?: Sizes;
23
27
  /**
28
+ * @description
24
29
  * Trigger node
25
30
  * @default MenuButton with IconMenu
26
31
  * @note Must forward refs to DOM element
27
32
  */
28
33
  trigger?: React.ReactNode;
29
34
  /**
35
+ * @description
30
36
  * ClassName to apply to default trigger button
31
37
  * Note: only applies if `trigger` prop is null
32
38
  */
33
39
  triggerClassName?: string;
34
40
  }
35
41
  export interface MenuItemProps extends ButtonProps {
42
+ /**
43
+ * @description
44
+ * Accepts any number of MenuItem components
45
+ */
36
46
  children?: React.ReactNode;
37
47
  }
@@ -6,52 +6,63 @@ export declare type PaginationCallbackType = 'onNext' | 'onPrevious' | 'onChange
6
6
  export declare type PaginationLabelType = 'pageLabel' | 'currentPageLabel' | 'previousLabel' | 'nextLabel';
7
7
  interface BasePaginationProps {
8
8
  /**
9
+ * @description
9
10
  * Index of the current page. (starting from 1)
10
11
  */
11
12
  currentPage?: number;
12
13
  /**
14
+ * @description
13
15
  * Total number of available pages.
14
16
  */
15
17
  totalPages: number;
16
18
  /**
19
+ * @description
17
20
  * The number of siblings on each side of current page.
18
21
  */
19
22
  siblingCount?: number;
20
23
  /**
24
+ * @description
21
25
  * Optionally indicates whether there are more pages after `totalPages`. Can be combined with `totalPages` to enable the next button when reaching the last page.
22
26
  * @default false
23
27
  */
24
28
  hasMorePages?: boolean;
25
29
  /**
30
+ * @description
26
31
  * Set the invisible label for current page.
27
32
  * @default "Current Page:"
28
33
  */
29
34
  currentPageLabel?: string;
30
35
  /**
36
+ * @description
31
37
  * Set the label text for each page button other than the current page.
32
38
  * It will be used to construct the `aria-label` for each page button. e.g, "Go to page 1" for page 1 button
33
39
  * @default "Go to page"
34
40
  */
35
41
  pageLabel?: string;
36
42
  /**
43
+ * @description
37
44
  * Set the `aria-label` for the left arrow button.
38
45
  * @default "Go to previous page"
39
46
  */
40
47
  previousLabel?: string;
41
48
  /**
49
+ * @description
42
50
  * Set the `aria-label` for the right arrow button.
43
51
  * @default "Go to next page"
44
52
  */
45
53
  nextLabel?: string;
46
54
  /**
55
+ * @description
47
56
  * Callback function triggered when the next-page button is pressed
48
57
  */
49
58
  onNext?: () => void;
50
59
  /**
60
+ * @description
51
61
  * Callback function triggered when the prev-page button is pressed
52
62
  */
53
63
  onPrevious?: () => void;
54
64
  /**
65
+ * @description
55
66
  * Callback function triggered every time the page changes
56
67
  */
57
68
  onChange?: (newPageIndex: number, prevPageIndex: number) => void;
@@ -64,27 +75,33 @@ export interface UsePaginationResult extends Required<Omit<BasePaginationProps,
64
75
  }
65
76
  export interface PaginationItemProps extends BaseComponentProps, BaseStyleProps, AriaProps {
66
77
  /**
78
+ * @description
67
79
  * Available item type are 'page', 'next', 'previous' and 'ellipsis'.
68
80
  */
69
81
  type: PaginationItemType;
70
82
  /**
83
+ * @description
71
84
  * For 'page' item, this is the page number to be rendered.
72
85
  */
73
86
  page?: number;
74
87
  /**
88
+ * @description
75
89
  * The index of current page.
76
90
  */
77
91
  currentPage?: number;
78
92
  /**
93
+ * @description
79
94
  * An item is not clickable if disabled
80
95
  */
81
96
  isDisabled?: boolean;
82
97
  /**
98
+ * @description
83
99
  * Set the invisible label for current page.
84
100
  * @default "Current Page:"
85
101
  */
86
102
  currentPageLabel?: string;
87
103
  /**
104
+ * @description
88
105
  * Triggered every time the item is clicked.
89
106
  */
90
107
  onClick?: (newPageIndex?: number, prevPageIndex?: number) => void;
@@ -3,39 +3,50 @@ import { ButtonProps } from './button';
3
3
  import { TextInputFieldProps } from './textField';
4
4
  export interface PasswordFieldProps extends TextInputFieldProps {
5
5
  /**
6
+ * @description
6
7
  * For password fields, will hide the "show password" button
7
8
  */
8
9
  hideShowPassword?: boolean;
9
10
  /**
11
+ * @description
10
12
  * Set the `aria-label` for hide password button
11
13
  * @default "Hide password"
12
14
  */
13
15
  hidePasswordButtonLabel?: string;
14
16
  /**
17
+ * @description
15
18
  * Set the `aria-label` for show password button
16
19
  * @default "Show password"
17
20
  */
18
21
  showPasswordButtonLabel?: string;
19
22
  /**
23
+ * @description
20
24
  * Password autocomplete type
21
- * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
25
+ * @See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values)
22
26
  * @default "current-password"
23
27
  */
24
28
  autoComplete?: 'new-password' | 'current-password' | string;
25
29
  /**
30
+ * @description
26
31
  * Forwarded ref for access to show password button DOM element
27
32
  */
28
33
  showPasswordButtonRef?: React.Ref<HTMLButtonElement>;
29
34
  }
30
35
  export declare type PasswordFieldType = 'password' | 'text';
31
36
  export interface ShowPasswordButtonProps extends ButtonProps {
37
+ /**
38
+ * @description
39
+ * Determines whether the input is hidden or displayed. Options include 'password' or 'text'
40
+ */
32
41
  fieldType: PasswordFieldType;
33
42
  /**
43
+ * @description
34
44
  * Set the `aria-label` for hide password button
35
45
  * @default "Hide password"
36
46
  */
37
47
  hidePasswordButtonLabel?: string;
38
48
  /**
49
+ * @description
39
50
  * Set the `aria-label` for show password button
40
51
  * @default "Show password"
41
52
  */
@@ -2,13 +2,38 @@ import * as React from 'react';
2
2
  import { SelectFieldProps } from './selectField';
3
3
  import { TextInputFieldProps } from './textField';
4
4
  export interface PhoneNumberFieldProps extends TextInputFieldProps {
5
+ /**
6
+ * @description
7
+ * Sets a hidden and accessible label for the dial code selector
8
+ */
5
9
  countryCodeLabel?: string;
10
+ /**
11
+ * @description
12
+ * Sets the name used when handling form submission for the dial code selector
13
+ */
6
14
  countryCodeName?: string;
15
+ /**
16
+ * @description
17
+ * Sets the default dial code that will be selected on initial render
18
+ */
7
19
  defaultCountryCode: string;
20
+ /**
21
+ * @description
22
+ * Accepts an array of dial codes (strings) used as options in the dial code selector
23
+ */
8
24
  dialCodeList?: Array<string>;
25
+ /**
26
+ * @description
27
+ * Handles change events for the dial code selector
28
+ */
9
29
  onCountryCodeChange?: React.ChangeEventHandler<HTMLSelectElement>;
30
+ /**
31
+ * @description
32
+ * <input> elements of type 'tel' are used to let the user enter and edit a telephone number
33
+ */
10
34
  type?: 'tel';
11
35
  /**
36
+ * @description
12
37
  * Forwarded ref for access to Country Code select DOM element
13
38
  */
14
39
  countryCodeRef?: React.Ref<HTMLSelectElement>;
@@ -3,11 +3,13 @@ import { ViewProps } from './view';
3
3
  export declare type PlaceholderSizes = Sizes;
4
4
  export interface PlaceholderProps extends ViewProps {
5
5
  /**
6
+ * @description
6
7
  * If true, the placeholder won't show, if false the placeholder will show.
7
8
  * @default false
8
9
  */
9
10
  isLoaded?: boolean;
10
11
  /**
12
+ * @description
11
13
  * Controls the display size of placeholder
12
14
  */
13
15
  size?: PlaceholderSizes;
@@ -3,6 +3,7 @@ import { LabelPositions } from './field';
3
3
  export interface RadioProps extends InputProps {
4
4
  value: string;
5
5
  /**
6
+ * @description
6
7
  * Position of label in relation to the radio,
7
8
  * default is 'start'
8
9
  */
@@ -7,10 +7,12 @@ export interface RadioGroupFieldProps extends FieldProps, FlexContainerStyleProp
7
7
  value?: string;
8
8
  defaultValue?: string;
9
9
  /**
10
+ * @description
10
11
  * Handle onChange event
11
12
  */
12
13
  onChange?: React.ChangeEventHandler<HTMLInputElement>;
13
14
  /**
15
+ * @description
14
16
  * Position of label in relation to the radio,
15
17
  * default is 'start'
16
18
  */
@@ -5,22 +5,26 @@ import { StyleToken } from './style';
5
5
  export declare type RatingSizes = Sizes;
6
6
  export interface RatingOptions {
7
7
  /**
8
+ * @description
8
9
  * The CSS color to use on the empty rating icon
9
10
  * Default css value is #A2A2A2
10
11
  */
11
12
  emptyColor?: StyleToken<Property.Color>;
12
13
  /**
14
+ * @description
13
15
  * This will override which icon to use as the empty icon. This will only
14
16
  * override the empty icon an will create a rating component that uses
15
17
  * different icons for filled and empty icons.
16
18
  */
17
19
  emptyIcon?: JSX.Element;
18
20
  /**
21
+ * @description
19
22
  * The CSS color to use on the filled rating icon
20
23
  * Default css value is #ffb400
21
24
  */
22
25
  fillColor?: StyleToken<Property.Color>;
23
26
  /**
27
+ * @description
24
28
  * This will override which icon to use. This will override both
25
29
  * the filled and empty icon values unless an empty icon is specified
26
30
  * with the emptyIcon prop
@@ -28,17 +32,20 @@ export interface RatingOptions {
28
32
  */
29
33
  icon?: JSX.Element;
30
34
  /**
35
+ * @description
31
36
  * The max rating integer value
32
37
  * Default is 5
33
38
  */
34
39
  maxValue?: number;
35
40
  /**
41
+ * @description
36
42
  *
37
43
  * This will set the icon size of the stars
38
44
  * Default css value is medium
39
45
  */
40
46
  size?: RatingSizes;
41
47
  /**
48
+ * @description
42
49
  * The value of the rating
43
50
  * Default is 0
44
51
  */
@@ -3,24 +3,29 @@ import { FieldGroupIconButtonProps } from './fieldGroupIcon';
3
3
  import { TextInputFieldProps } from './textField';
4
4
  export interface SearchFieldProps extends TextInputFieldProps {
5
5
  /**
6
+ * @description
6
7
  * Handle submission of search field input
7
8
  */
8
9
  onSubmit?: (value: string) => void;
9
10
  /**
11
+ * @description
10
12
  * Triggered when search field is cleared
11
13
  */
12
14
  onClear?: () => void;
13
15
  /**
16
+ * @description
14
17
  * Visually hide label
15
18
  * @default true
16
19
  */
17
20
  labelHidden?: boolean;
18
21
  /**
22
+ * @description
19
23
  * Set the `aria-label` for clear button
20
24
  * @default "Clear search"
21
25
  */
22
26
  clearButtonLabel?: string;
23
27
  /**
28
+ * @description
24
29
  * Provides ref access to search button DOM element
25
30
  */
26
31
  searchButtonRef?: React.Ref<HTMLButtonElement>;
@@ -3,17 +3,69 @@ import { ViewProps } from './view';
3
3
  import { Sizes } from './base';
4
4
  export declare type SelectVariation = 'quiet';
5
5
  export interface SelectProps extends ViewProps {
6
+ /**
7
+ * @description
8
+ * A string providing a hint for a user agent's autocomplete feature
9
+ */
6
10
  autoComplete?: string;
11
+ /**
12
+ * @description
13
+ * Specifies the name of the control used when submitting form data
14
+ */
7
15
  name?: string;
16
+ /**
17
+ * @description
18
+ * Sets the SelectField’s initial value on render
19
+ */
8
20
  defaultValue?: string;
21
+ /**
22
+ * @description
23
+ * Controls the current value when using the SelectField as a controlled component
24
+ */
9
25
  value?: string;
26
+ /**
27
+ * @description
28
+ * Changes the height and font size of the SelectField. Available options are ‘small’, none (default), and ‘large’
29
+ */
10
30
  size?: Sizes;
31
+ /**
32
+ * @description
33
+ * Changes the displayed style of the SelectField. Options include ‘quiet’ and none (default)
34
+ */
11
35
  variation?: SelectVariation;
36
+ /**
37
+ * @description
38
+ * Changes the icon used to expand and collapse the SelectField
39
+ */
12
40
  icon?: React.ReactElement;
41
+ /**
42
+ * @description
43
+ * Controls the color of the icon used to expand and collapse the SelectField
44
+ */
13
45
  iconColor?: string;
46
+ /**
47
+ * @description
48
+ * Sets the text that appears in the form control when it has no value set
49
+ */
14
50
  placeholder?: string;
51
+ /**
52
+ * @description
53
+ * Marks the SelectField as having a validation error
54
+ */
15
55
  hasError?: boolean;
56
+ /**
57
+ * @description
58
+ * A Boolean attribute indicating that the user cannot interact with the control
59
+ */
16
60
  isDisabled?: boolean;
61
+ /**
62
+ * @description
63
+ * A Boolean attribute indicating that an option with a non-empty string value must be selected
64
+ */
17
65
  isRequired?: boolean;
66
+ /**
67
+ * @description
68
+ * Handles changes to the current value when using the SelectField as a controlled component
69
+ */
18
70
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
19
71
  }
@@ -3,6 +3,7 @@ import { SelectProps } from './select';
3
3
  import { FieldProps } from './field';
4
4
  export interface SelectFieldProps extends FieldProps, FlexContainerStyleProps, SelectProps {
5
5
  /**
6
+ * @description
6
7
  * List of option values for select dropdown
7
8
  */
8
9
  options?: string[];
@@ -4,17 +4,65 @@ import { TextInputFieldProps } from './textField';
4
4
  import { ViewProps } from './view';
5
5
  declare type SliderOrientation = 'horizontal' | 'vertical';
6
6
  export interface SliderFieldProps extends TextInputFieldProps, ViewProps {
7
+ /**
8
+ * @description
9
+ * Sets the minimum value for the SliderField range
10
+ */
7
11
  min?: number;
12
+ /**
13
+ * @description
14
+ * Sets the maximum value for the SliderField range
15
+ */
8
16
  max?: number;
17
+ /**
18
+ * @description
19
+ * Controls the interval between selectable values
20
+ */
9
21
  step?: number;
22
+ /**
23
+ * @description
24
+ * Changes the orientation of the SliderField to either 'vertical' or 'horizontal' (default)
25
+ */
10
26
  orientation?: SliderOrientation;
27
+ /**
28
+ * @description
29
+ * When `true`, hides the numerical value to the right of the label
30
+ */
11
31
  isValueHidden?: boolean;
32
+ /**
33
+ * @description
34
+ * Controls the width of the track and size of the thumb. Options include 'small', none (default), and 'large'
35
+ */
12
36
  trackSize?: string;
37
+ /**
38
+ * @description
39
+ * Applies to the empty part of the SliderField track
40
+ */
13
41
  emptyTrackColor?: StyleToken<Property.Color>;
42
+ /**
43
+ * @description
44
+ * Applies to the filled-in part of the SliderField track
45
+ */
14
46
  filledTrackColor?: StyleToken<Property.Color>;
47
+ /**
48
+ * @description
49
+ * Applies to the thumb component that users can slide
50
+ */
15
51
  thumbColor?: StyleToken<Property.Color>;
52
+ /**
53
+ * @description
54
+ * Controls the current value when using the SliderField as a controlled component
55
+ */
16
56
  value?: number;
57
+ /**
58
+ * @description
59
+ * Sets the SliderField’s initial value on render
60
+ */
17
61
  defaultValue?: number;
62
+ /**
63
+ * @description
64
+ * Handles changes to the current value when using the SliderField as a controlled component
65
+ */
18
66
  onChange?: (value: number) => void;
19
67
  }
20
68
  export {};
@@ -1,29 +1,64 @@
1
1
  import { TextInputFieldProps } from '../types/textField';
2
2
  export interface StepperFieldProps extends TextInputFieldProps {
3
+ /**
4
+ * @description
5
+ * <input> elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
6
+ */
3
7
  type?: 'number';
8
+ /**
9
+ * @description
10
+ * Sets the minimum possible value
11
+ */
4
12
  min?: number;
13
+ /**
14
+ * @description
15
+ * Sets the maximum possible value
16
+ */
5
17
  max?: number;
18
+ /**
19
+ * @description
20
+ * Controls the interval between selectable values
21
+ */
6
22
  step?: number;
23
+ /**
24
+ * @description
25
+ * Controls the current value when using the StepperField as a controlled component
26
+ */
7
27
  value?: number;
28
+ /**
29
+ * @description
30
+ * Sets the StepperField’s initial value on render
31
+ */
8
32
  defaultValue?: number;
9
33
  /**
34
+ * @description
10
35
  * Set the label text for increase button.
11
36
  * This will be used to construct its the `aria-label`. e.g., "Increase to 2" if the current step is 1.
12
37
  * @default "Increase to"
13
38
  */
14
39
  increaseButtonLabel?: string;
15
40
  /**
41
+ * @description
16
42
  * Set the label text for decrease button.
17
43
  * This will be used to construct its the `aria-label`. e.g., "Decrease to 0" if the current step is 1.
18
44
  * @default "Decrease to"
19
45
  */
20
46
  decreaseButtonLabel?: string;
21
47
  /**
48
+ * @description
22
49
  * TODO:
23
50
  * Extends StepperField props from Omit<TextFieldProps, 'onChange'>, after removing [key: string]: any from the base type
24
51
  * and rename onStepChange to onChange
25
52
  */
26
53
  onStepChange?: (value: number) => void;
54
+ /**
55
+ * @description
56
+ * Handles the event when a user clicks on the increment button
57
+ */
27
58
  onIncrease?: () => void;
59
+ /**
60
+ * @description
61
+ * Handles the event when a user clicks on the decrement button
62
+ */
28
63
  onDecrease?: () => void;
29
64
  }