@aws-amplify/ui-react 4.6.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/esm/PrimitiveCatalog.mjs +1 -1
  2. package/dist/esm/components/AccountSettings/ChangePassword/ChangePassword.mjs +1 -1
  3. package/dist/esm/components/index.mjs +1 -1
  4. package/dist/esm/index.mjs +1 -1
  5. package/dist/esm/primitives/Autocomplete/AutocompleteMenu.mjs +1 -1
  6. package/dist/esm/primitives/Autocomplete/AutocompleteOption.mjs +1 -1
  7. package/dist/esm/primitives/Link/Link.mjs +1 -1
  8. package/dist/esm/version.mjs +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/internal.js +1 -1
  11. package/dist/styles.css +0 -378
  12. package/dist/types/components/AccountSettings/types.d.ts +4 -7
  13. package/dist/types/components/index.d.ts +0 -2
  14. package/dist/types/primitives/Alert/Alert.d.ts +2 -3
  15. package/dist/types/primitives/Autocomplete/Autocomplete.d.ts +2 -3
  16. package/dist/types/primitives/Autocomplete/AutocompleteMenu.d.ts +2 -2
  17. package/dist/types/primitives/Autocomplete/AutocompleteOption.d.ts +2 -2
  18. package/dist/types/primitives/Badge/Badge.d.ts +2 -3
  19. package/dist/types/primitives/Button/Button.d.ts +2 -3
  20. package/dist/types/primitives/ButtonGroup/ButtonGroup.d.ts +2 -3
  21. package/dist/types/primitives/Card/Card.d.ts +2 -3
  22. package/dist/types/primitives/Checkbox/Checkbox.d.ts +3 -3
  23. package/dist/types/primitives/CheckboxField/CheckboxField.d.ts +2 -3
  24. package/dist/types/primitives/Collection/Collection.d.ts +2 -2
  25. package/dist/types/primitives/Divider/Divider.d.ts +2 -3
  26. package/dist/types/primitives/Expander/Expander.d.ts +3 -3
  27. package/dist/types/primitives/Expander/ExpanderItem.d.ts +3 -3
  28. package/dist/types/primitives/Field/Field.d.ts +3 -4
  29. package/dist/types/primitives/Field/FieldClearButton.d.ts +2 -3
  30. package/dist/types/primitives/Field/FieldDescription.d.ts +2 -2
  31. package/dist/types/primitives/Field/FieldErrorMessage.d.ts +2 -2
  32. package/dist/types/primitives/FieldGroup/FieldGroup.d.ts +2 -3
  33. package/dist/types/primitives/FieldGroupIcon/FieldGroupIcon.d.ts +2 -3
  34. package/dist/types/primitives/FieldGroupIcon/FieldGroupIconButton.d.ts +2 -3
  35. package/dist/types/primitives/Flex/Flex.d.ts +2 -3
  36. package/dist/types/primitives/Grid/Grid.d.ts +2 -3
  37. package/dist/types/primitives/Heading/Heading.d.ts +2 -5
  38. package/dist/types/primitives/HighlightMatch/HighlightMatch.d.ts +2 -3
  39. package/dist/types/primitives/Icon/Icon.d.ts +2 -3
  40. package/dist/types/primitives/Image/Image.d.ts +2 -3
  41. package/dist/types/primitives/Input/Input.d.ts +2 -3
  42. package/dist/types/primitives/Label/Label.d.ts +2 -3
  43. package/dist/types/primitives/Link/Link.d.ts +2 -3
  44. package/dist/types/primitives/Loader/Loader.d.ts +3 -3
  45. package/dist/types/primitives/Menu/Menu.d.ts +2 -3
  46. package/dist/types/primitives/Menu/MenuButton.d.ts +2 -8
  47. package/dist/types/primitives/Menu/MenuItem.d.ts +2 -6
  48. package/dist/types/primitives/Pagination/Pagination.d.ts +2 -3
  49. package/dist/types/primitives/Pagination/PaginationItem.d.ts +2 -2
  50. package/dist/types/primitives/PasswordField/PasswordField.d.ts +2 -3
  51. package/dist/types/primitives/PasswordField/ShowPasswordButton.d.ts +2 -3
  52. package/dist/types/primitives/PhoneNumberField/CountryCodeSelect.d.ts +2 -3
  53. package/dist/types/primitives/PhoneNumberField/PhoneNumberField.d.ts +2 -3
  54. package/dist/types/primitives/Placeholder/Placeholder.d.ts +2 -3
  55. package/dist/types/primitives/Radio/Radio.d.ts +2 -3
  56. package/dist/types/primitives/RadioGroupField/RadioGroupField.d.ts +2 -3
  57. package/dist/types/primitives/Rating/Rating.d.ts +2 -3
  58. package/dist/types/primitives/ScrollView/ScrollView.d.ts +2 -3
  59. package/dist/types/primitives/SearchField/SearchField.d.ts +2 -3
  60. package/dist/types/primitives/SearchField/SearchFieldButton.d.ts +2 -3
  61. package/dist/types/primitives/Select/Select.d.ts +3 -3
  62. package/dist/types/primitives/SelectField/SelectField.d.ts +2 -3
  63. package/dist/types/primitives/SliderField/SliderField.d.ts +3 -4
  64. package/dist/types/primitives/StepperField/StepperField.d.ts +3 -3
  65. package/dist/types/primitives/StepperField/useStepper.d.ts +1 -1
  66. package/dist/types/primitives/SwitchField/SwitchField.d.ts +2 -3
  67. package/dist/types/primitives/Table/Table.d.ts +2 -3
  68. package/dist/types/primitives/Table/TableBody.d.ts +2 -3
  69. package/dist/types/primitives/Table/TableCell.d.ts +2 -3
  70. package/dist/types/primitives/Table/TableFoot.d.ts +2 -3
  71. package/dist/types/primitives/Table/TableHead.d.ts +2 -3
  72. package/dist/types/primitives/Table/TableRow.d.ts +2 -3
  73. package/dist/types/primitives/Tabs/Tabs.d.ts +3 -4
  74. package/dist/types/primitives/Text/Text.d.ts +2 -3
  75. package/dist/types/primitives/TextArea/TextArea.d.ts +3 -3
  76. package/dist/types/primitives/TextAreaField/TextAreaField.d.ts +3 -3
  77. package/dist/types/primitives/TextField/TextField.d.ts +2 -3
  78. package/dist/types/primitives/ToggleButton/ToggleButton.d.ts +2 -3
  79. package/dist/types/primitives/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -3
  80. package/dist/types/primitives/View/View.d.ts +2 -7
  81. package/dist/types/primitives/VisuallyHidden/VisuallyHidden.d.ts +2 -3
  82. package/dist/types/primitives/shared/styleUtils.d.ts +3 -3
  83. package/dist/types/primitives/types/alert.d.ts +4 -2
  84. package/dist/types/primitives/types/autocomplete.d.ts +8 -5
  85. package/dist/types/primitives/types/badge.d.ts +3 -2
  86. package/dist/types/primitives/types/base.d.ts +5 -0
  87. package/dist/types/primitives/types/button.d.ts +3 -2
  88. package/dist/types/primitives/types/buttonGroup.d.ts +5 -3
  89. package/dist/types/primitives/types/card.d.ts +3 -2
  90. package/dist/types/primitives/types/checkbox.d.ts +5 -3
  91. package/dist/types/primitives/types/checkboxField.d.ts +5 -3
  92. package/dist/types/primitives/types/collection.d.ts +7 -5
  93. package/dist/types/primitives/types/divider.d.ts +3 -2
  94. package/dist/types/primitives/types/expander.d.ts +5 -3
  95. package/dist/types/primitives/types/field.d.ts +12 -7
  96. package/dist/types/primitives/types/fieldGroup.d.ts +4 -2
  97. package/dist/types/primitives/types/fieldGroupIcon.d.ts +6 -4
  98. package/dist/types/primitives/types/flex.d.ts +3 -2
  99. package/dist/types/primitives/types/grid.d.ts +3 -2
  100. package/dist/types/primitives/types/heading.d.ts +5 -2
  101. package/dist/types/primitives/types/highlightMatch.d.ts +3 -2
  102. package/dist/types/primitives/types/icon.d.ts +3 -2
  103. package/dist/types/primitives/types/image.d.ts +3 -2
  104. package/dist/types/primitives/types/input.d.ts +3 -2
  105. package/dist/types/primitives/types/label.d.ts +3 -2
  106. package/dist/types/primitives/types/link.d.ts +8 -16
  107. package/dist/types/primitives/types/loader.d.ts +3 -2
  108. package/dist/types/primitives/types/menu.d.ts +7 -4
  109. package/dist/types/primitives/types/pagination.d.ts +6 -7
  110. package/dist/types/primitives/types/passwordField.d.ts +7 -4
  111. package/dist/types/primitives/types/phoneNumberField.d.ts +8 -5
  112. package/dist/types/primitives/types/placeholder.d.ts +3 -2
  113. package/dist/types/primitives/types/radio.d.ts +4 -2
  114. package/dist/types/primitives/types/radioGroupField.d.ts +5 -3
  115. package/dist/types/primitives/types/rating.d.ts +4 -2
  116. package/dist/types/primitives/types/scrollView.d.ts +3 -2
  117. package/dist/types/primitives/types/searchField.d.ts +6 -3
  118. package/dist/types/primitives/types/select.d.ts +3 -2
  119. package/dist/types/primitives/types/selectField.d.ts +5 -3
  120. package/dist/types/primitives/types/sliderField.d.ts +4 -3
  121. package/dist/types/primitives/types/stepperField.d.ts +4 -2
  122. package/dist/types/primitives/types/switchField.d.ts +5 -3
  123. package/dist/types/primitives/types/table.d.ts +13 -8
  124. package/dist/types/primitives/types/tabs.d.ts +6 -3
  125. package/dist/types/primitives/types/text.d.ts +3 -7
  126. package/dist/types/primitives/types/textArea.d.ts +3 -2
  127. package/dist/types/primitives/types/textAreaField.d.ts +5 -3
  128. package/dist/types/primitives/types/textField.d.ts +7 -5
  129. package/dist/types/primitives/types/toggleButton.d.ts +4 -2
  130. package/dist/types/primitives/types/toggleButtonGroup.d.ts +5 -3
  131. package/dist/types/primitives/types/view.d.ts +14 -30
  132. package/dist/types/primitives/types/visuallyHidden.d.ts +3 -2
  133. package/dist/types/version.d.ts +1 -1
  134. package/package.json +3 -22
  135. package/dist/esm/components/Geo/LocationSearch/index.mjs +0 -1
  136. package/dist/esm/components/Geo/MapView/index.mjs +0 -1
  137. package/dist/esm/components/InAppMessaging/Backdrop/Backdrop.mjs +0 -1
  138. package/dist/esm/components/InAppMessaging/Backdrop/withBackdrop.mjs +0 -1
  139. package/dist/esm/components/InAppMessaging/BannerMessage/BannerMessage.mjs +0 -1
  140. package/dist/esm/components/InAppMessaging/BannerMessage/constants.mjs +0 -1
  141. package/dist/esm/components/InAppMessaging/CloseIconButton/CloseIconButton.mjs +0 -1
  142. package/dist/esm/components/InAppMessaging/FullScreenMessage/FullScreenMessage.mjs +0 -1
  143. package/dist/esm/components/InAppMessaging/FullScreenMessage/constants.mjs +0 -1
  144. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/InAppMessageDisplay.mjs +0 -1
  145. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/handleMessageLinkAction.mjs +0 -1
  146. package/dist/esm/components/InAppMessaging/MessageLayout/MessageLayout.mjs +0 -1
  147. package/dist/esm/components/InAppMessaging/MessageLayout/constants.mjs +0 -1
  148. package/dist/esm/components/InAppMessaging/MessageLayout/utils.mjs +0 -1
  149. package/dist/esm/components/InAppMessaging/ModalMessage/ModalMessage.mjs +0 -1
  150. package/dist/esm/components/InAppMessaging/ModalMessage/constants.mjs +0 -1
  151. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/types.mjs +0 -1
  152. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/useMessageImage.mjs +0 -1
  153. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/useMessageProps.mjs +0 -1
  154. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/utils.mjs +0 -1
  155. package/dist/esm/components/InAppMessaging/withInAppMessaging/withInAppMessaging.mjs +0 -1
  156. package/dist/types/components/Geo/LocationSearch/index.d.ts +0 -25
  157. package/dist/types/components/Geo/MapView/index.d.ts +0 -24
  158. package/dist/types/components/Geo/index.d.ts +0 -2
  159. package/dist/types/components/Geo/types/maplibre-gl-geocoder.d.ts +0 -171
  160. package/dist/types/components/InAppMessaging/Backdrop/Backdrop.d.ts +0 -4
  161. package/dist/types/components/InAppMessaging/Backdrop/index.d.ts +0 -2
  162. package/dist/types/components/InAppMessaging/Backdrop/types.d.ts +0 -8
  163. package/dist/types/components/InAppMessaging/Backdrop/withBackdrop.d.ts +0 -3
  164. package/dist/types/components/InAppMessaging/BannerMessage/BannerMessage.d.ts +0 -3
  165. package/dist/types/components/InAppMessaging/BannerMessage/constants.d.ts +0 -1
  166. package/dist/types/components/InAppMessaging/BannerMessage/index.d.ts +0 -2
  167. package/dist/types/components/InAppMessaging/BannerMessage/types.d.ts +0 -7
  168. package/dist/types/components/InAppMessaging/CloseIconButton/CloseIconButton.d.ts +0 -3
  169. package/dist/types/components/InAppMessaging/CloseIconButton/index.d.ts +0 -1
  170. package/dist/types/components/InAppMessaging/CloseIconButton/types.d.ts +0 -8
  171. package/dist/types/components/InAppMessaging/FullScreenMessage/FullScreenMessage.d.ts +0 -3
  172. package/dist/types/components/InAppMessaging/FullScreenMessage/constants.d.ts +0 -1
  173. package/dist/types/components/InAppMessaging/FullScreenMessage/index.d.ts +0 -2
  174. package/dist/types/components/InAppMessaging/FullScreenMessage/types.d.ts +0 -4
  175. package/dist/types/components/InAppMessaging/InAppMessageDisplay/InAppMessageDisplay.d.ts +0 -10
  176. package/dist/types/components/InAppMessaging/InAppMessageDisplay/handleMessageLinkAction.d.ts +0 -3
  177. package/dist/types/components/InAppMessaging/InAppMessageDisplay/index.d.ts +0 -2
  178. package/dist/types/components/InAppMessaging/InAppMessageDisplay/types.d.ts +0 -23
  179. package/dist/types/components/InAppMessaging/MessageLayout/MessageLayout.d.ts +0 -3
  180. package/dist/types/components/InAppMessaging/MessageLayout/constants.d.ts +0 -16
  181. package/dist/types/components/InAppMessaging/MessageLayout/index.d.ts +0 -1
  182. package/dist/types/components/InAppMessaging/MessageLayout/types.d.ts +0 -23
  183. package/dist/types/components/InAppMessaging/MessageLayout/utils.d.ts +0 -13
  184. package/dist/types/components/InAppMessaging/ModalMessage/ModalMessage.d.ts +0 -3
  185. package/dist/types/components/InAppMessaging/ModalMessage/constants.d.ts +0 -2
  186. package/dist/types/components/InAppMessaging/ModalMessage/index.d.ts +0 -2
  187. package/dist/types/components/InAppMessaging/ModalMessage/types.d.ts +0 -4
  188. package/dist/types/components/InAppMessaging/hooks/index.d.ts +0 -2
  189. package/dist/types/components/InAppMessaging/hooks/useMessageImage/index.d.ts +0 -1
  190. package/dist/types/components/InAppMessaging/hooks/useMessageImage/types.d.ts +0 -10
  191. package/dist/types/components/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +0 -9
  192. package/dist/types/components/InAppMessaging/hooks/useMessageProps/index.d.ts +0 -2
  193. package/dist/types/components/InAppMessaging/hooks/useMessageProps/types.d.ts +0 -39
  194. package/dist/types/components/InAppMessaging/hooks/useMessageProps/useMessageProps.d.ts +0 -11
  195. package/dist/types/components/InAppMessaging/hooks/useMessageProps/utils.d.ts +0 -23
  196. package/dist/types/components/InAppMessaging/index.d.ts +0 -6
  197. package/dist/types/components/InAppMessaging/withInAppMessaging/index.d.ts +0 -1
  198. package/dist/types/components/InAppMessaging/withInAppMessaging/withInAppMessaging.d.ts +0 -5
@@ -1,5 +1,6 @@
1
- import { TextFieldProps } from '../types/textField';
2
- export interface StepperFieldProps extends TextFieldProps {
1
+ import { BaseTextFieldProps } from '../types/textField';
2
+ import { ElementType, PrimitiveProps } from './view';
3
+ export interface BaseStepperFieldProps extends BaseTextFieldProps {
3
4
  /**
4
5
  * @description
5
6
  * <input> elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
@@ -62,3 +63,4 @@ export interface StepperFieldProps extends TextFieldProps {
62
63
  */
63
64
  onDecrease?: () => void;
64
65
  }
66
+ export type StepperFieldProps<Element extends ElementType = 'input'> = PrimitiveProps<BaseStepperFieldProps, Element>;
@@ -2,9 +2,10 @@
2
2
  import { Property } from 'csstype';
3
3
  import { Sizes } from './base';
4
4
  import { BaseStyleProps, StyleToken } from './style';
5
- import { InputProps } from './input';
6
- import { FieldProps, LabelPositions } from './field';
7
- export interface SwitchFieldProps extends InputProps, FieldProps, BaseStyleProps {
5
+ import { BaseInputProps } from './input';
6
+ import { BaseFieldProps, LabelPositions } from './field';
7
+ import { ElementType, PrimitiveProps } from './view';
8
+ export interface BaseSwitchFieldProps extends BaseInputProps, BaseFieldProps, BaseStyleProps {
8
9
  /**
9
10
  * @description
10
11
  * Use this to provide a default checked value for an uncontrolled SwitchField
@@ -71,3 +72,4 @@ export interface SwitchFieldProps extends InputProps, FieldProps, BaseStyleProps
71
72
  */
72
73
  value?: string | number;
73
74
  }
75
+ export type SwitchFieldProps<Element extends ElementType = 'input'> = PrimitiveProps<BaseSwitchFieldProps, Element>;
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { Sizes } from './base';
3
- import { ViewProps } from './view';
3
+ import { ElementType, PrimitiveProps, BaseViewProps } from './view';
4
4
  export type TableSize = Sizes;
5
5
  export type TableVariation = 'bordered' | 'striped';
6
- export interface TableProps extends ViewProps {
6
+ export interface BaseTableProps extends BaseViewProps {
7
7
  /**
8
8
  * @description
9
9
  * Optional caption which serves as an accessible title/caption for
@@ -26,11 +26,12 @@ export interface TableProps extends ViewProps {
26
26
  */
27
27
  variation?: TableVariation;
28
28
  }
29
- export interface TableBodyProps extends ViewProps {
29
+ export type TableProps<Element extends ElementType = 'table'> = PrimitiveProps<BaseTableProps, Element>;
30
+ export interface BaseTableBodyProps extends BaseViewProps {
30
31
  }
32
+ export type TableBodyProps<Element extends ElementType = 'tbody'> = PrimitiveProps<BaseTableBodyProps, Element>;
31
33
  export type TableCellElement = 'td' | 'th';
32
- export interface TableCellProps extends ViewProps {
33
- as?: TableCellElement;
34
+ export interface BaseTableCellProps extends BaseViewProps {
34
35
  /**
35
36
  * @description
36
37
  * Defines the number of columns spanned by a cell within a <table>
@@ -42,9 +43,13 @@ export interface TableCellProps extends ViewProps {
42
43
  */
43
44
  rowspan?: Pick<React.HTMLProps<HTMLTableCellElement>, 'rowSpan'>;
44
45
  }
45
- export interface TableFootProps extends ViewProps {
46
+ export type TableCellProps<Element extends ElementType = TableCellElement> = PrimitiveProps<BaseTableCellProps, Element>;
47
+ export interface BaseTableFootProps extends BaseViewProps {
46
48
  }
47
- export interface TableHeadProps extends ViewProps {
49
+ export type TableFootProps<Element extends ElementType = 'tfoot'> = PrimitiveProps<BaseTableFootProps, Element>;
50
+ export interface BaseTableHeadProps extends BaseViewProps {
48
51
  }
49
- export interface TableRowProps extends ViewProps {
52
+ export type TableHeadProps<Element extends ElementType = 'thead'> = PrimitiveProps<BaseTableHeadProps, Element>;
53
+ export interface BaseTableRowProps extends BaseViewProps {
50
54
  }
55
+ export type TableRowProps<Element extends ElementType = 'tr'> = PrimitiveProps<BaseTableRowProps, Element>;
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { BaseComponentProps } from './base';
3
3
  import { BaseStyleProps } from './style';
4
- import { FlexProps } from './flex';
4
+ import { BaseFlexProps } from './flex';
5
+ import { ElementType, PrimitiveProps } from './view';
5
6
  export type TabsSpacing = 'equal' | 'relative';
6
- export interface TabsProps extends FlexProps {
7
+ export interface BaseTabsProps extends BaseFlexProps {
7
8
  /**
8
9
  * @description
9
10
  * The Tabs component only accepts TabItem components as children.
@@ -39,7 +40,8 @@ export interface TabsProps extends FlexProps {
39
40
  */
40
41
  indicatorPosition?: 'top' | 'bottom';
41
42
  }
42
- export interface TabItemProps extends BaseComponentProps, BaseStyleProps {
43
+ export type TabsProps<Element extends ElementType = 'div'> = PrimitiveProps<BaseTabsProps, Element>;
44
+ export interface BaseTabItemProps extends BaseComponentProps, BaseStyleProps {
43
45
  /**
44
46
  * @description
45
47
  * Change the title corresponding with each Tab's content panel.
@@ -56,3 +58,4 @@ export interface TabItemProps extends BaseComponentProps, BaseStyleProps {
56
58
  */
57
59
  children?: React.ReactNode;
58
60
  }
61
+ export type TabItemProps<Element extends ElementType = 'button'> = PrimitiveProps<BaseTabItemProps, Element>;
@@ -1,11 +1,6 @@
1
- import { ViewProps } from './view';
1
+ import { ElementType, PrimitiveProps, BaseViewProps } from './view';
2
2
  export type TextVariation = 'primary' | 'secondary' | 'tertiary' | 'error' | 'warning' | 'info' | 'success';
3
- export interface TextProps extends ViewProps {
4
- /**
5
- * @description
6
- * HTML allowed tags
7
- */
8
- as?: 'p' | 'span' | 'strong' | 'em';
3
+ export interface BaseTextProps extends BaseViewProps {
9
4
  /**
10
5
  * @description
11
6
  * This should be the primary way to handle different styles of text. Lower-level
@@ -20,3 +15,4 @@ export interface TextProps extends ViewProps {
20
15
  */
21
16
  isTruncated?: boolean;
22
17
  }
18
+ export type TextProps<Element extends ElementType = 'p'> = PrimitiveProps<BaseTextProps, Element>;
@@ -2,7 +2,7 @@
2
2
  import { Property } from 'csstype';
3
3
  import { Sizes } from './base';
4
4
  import { FieldVariations } from './field';
5
- import { ViewProps } from './view';
5
+ import { ElementType, PrimitiveProps, BaseViewProps } from './view';
6
6
  export interface TextAreaStyleProps {
7
7
  /**
8
8
  * @description
@@ -10,7 +10,7 @@ export interface TextAreaStyleProps {
10
10
  */
11
11
  resize?: Property.Resize;
12
12
  }
13
- export interface TextAreaProps extends TextAreaStyleProps, ViewProps {
13
+ export interface BaseTextAreaProps extends TextAreaStyleProps, BaseViewProps {
14
14
  /**
15
15
  * @description
16
16
  * Specifies permissions for browser UA to autocomplete field.
@@ -87,3 +87,4 @@ export interface TextAreaProps extends TextAreaStyleProps, ViewProps {
87
87
  */
88
88
  variation?: FieldVariations;
89
89
  }
90
+ export type TextAreaProps<Element extends ElementType = 'textarea'> = PrimitiveProps<BaseTextAreaProps, Element>;
@@ -1,7 +1,9 @@
1
- import { TextAreaProps, TextAreaStyleProps } from './textArea';
2
- import { FieldProps } from './field';
1
+ import { BaseTextAreaProps, TextAreaStyleProps } from './textArea';
2
+ import { BaseFieldProps } from './field';
3
3
  import { FlexContainerStyleProps } from './flex';
4
4
  import { BaseStyleProps } from './style';
5
- export interface TextAreaFieldProps extends FieldProps, FlexContainerStyleProps, TextAreaProps {
5
+ import { ElementType, PrimitiveProps } from './view';
6
+ export interface BaseTextAreaFieldProps extends BaseFieldProps, FlexContainerStyleProps, BaseTextAreaProps {
6
7
  inputStyles?: BaseStyleProps & TextAreaStyleProps;
7
8
  }
9
+ export type TextAreaFieldProps<Element extends ElementType = 'textarea'> = PrimitiveProps<BaseTextAreaFieldProps, Element>;
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { FlexContainerStyleProps } from './flex';
3
- import { InputProps } from './input';
4
- import { FieldProps } from './field';
5
- export interface TextFieldOptions extends FieldProps, FlexContainerStyleProps {
3
+ import { BaseInputProps } from './input';
4
+ import { BaseFieldProps } from './field';
5
+ import { PrimitiveProps, ElementType } from './view';
6
+ export interface TextFieldOptions extends BaseFieldProps, FlexContainerStyleProps {
6
7
  /**
7
8
  * @description
8
9
  * Component(s) to show after input
@@ -27,7 +28,8 @@ export interface TextFieldOptions extends FieldProps, FlexContainerStyleProps {
27
28
  * @description
28
29
  * Input field type
29
30
  */
30
- type?: InputProps['type'];
31
+ type?: BaseInputProps['type'];
31
32
  }
32
- export interface TextFieldProps extends TextFieldOptions, InputProps {
33
+ export interface BaseTextFieldProps extends TextFieldOptions, BaseInputProps {
33
34
  }
35
+ export type TextFieldProps<Element extends ElementType = 'input'> = PrimitiveProps<BaseTextFieldProps, Element>;
@@ -1,5 +1,6 @@
1
- import { ButtonProps } from './button';
2
- export interface ToggleButtonProps extends ButtonProps {
1
+ import { BaseButtonProps } from './button';
2
+ import { ElementType, PrimitiveProps } from './view';
3
+ export interface BaseToggleButtonProps extends BaseButtonProps {
3
4
  /**
4
5
  * @description
5
6
  * Controls the selected state of the ToggleButton
@@ -21,3 +22,4 @@ export interface ToggleButtonProps extends ButtonProps {
21
22
  */
22
23
  onChange?: (value: string | undefined) => void;
23
24
  }
25
+ export type ToggleButtonProps<Element extends ElementType = 'button'> = PrimitiveProps<BaseToggleButtonProps, Element>;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
- import { FlexProps } from './flex';
3
- import { ToggleButtonProps } from './toggleButton';
4
- export interface ToggleButtonGroupProps extends FlexProps, Pick<ToggleButtonProps, 'size' | 'variation'> {
2
+ import { BaseFlexProps } from './flex';
3
+ import { BaseToggleButtonProps } from './toggleButton';
4
+ import { ElementType, PrimitiveProps } from './view';
5
+ export interface BaseToggleButtonGroupProps extends BaseFlexProps, Pick<BaseToggleButtonProps, 'size' | 'variation'> {
5
6
  /**
6
7
  * @description
7
8
  * Accepts any number of ToggleButton components
@@ -28,3 +29,4 @@ export interface ToggleButtonGroupProps extends FlexProps, Pick<ToggleButtonProp
28
29
  */
29
30
  onChange: (value: string | (string | undefined)[] | undefined) => void;
30
31
  }
32
+ export type ToggleButtonGroupProps<Element extends ElementType = 'div'> = PrimitiveProps<BaseToggleButtonGroupProps, Element>;
@@ -1,42 +1,25 @@
1
1
  import * as React from 'react';
2
2
  import { AriaProps, BaseComponentProps } from './base';
3
3
  import { BaseStyleProps } from './style';
4
+ export type IsAny<Type> = (Type extends never ? true : false) extends false ? false : true;
4
5
  type MergeProps<A, B> = A & Omit<B, keyof A>;
5
- export type ElementType = React.FC<any> | keyof JSX.IntrinsicElements;
6
- /**
7
- * @description
8
- * Convert string element type to DOMElement Type
9
- * e.g. 'button' => HTMLButtonElement
10
- */
11
- export type HTMLElementType<Element extends ElementType> = Element extends keyof JSX.IntrinsicElements ? React.ElementRef<Element> : HTMLElementTypeFromExoticComponentRef<Element>;
12
- /**
13
- * @description
14
- * Allows us to extract ElementType from `typeof Root` used in SliderField
15
- * e.g. React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>> => HTMLSpanElement
16
- */
17
- type HTMLElementTypeFromExoticComponentRef<Element extends ElementType> = Element extends React.ForwardRefExoticComponent<React.RefAttributes<infer DOMHTMLElement>> ? DOMHTMLElement : HTMLElement;
18
- export type ElementProps<Element extends ElementType> = Element extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[Element] : Element extends React.FC<infer ComponentProps> ? ComponentProps : never;
19
- export type PrimitiveProps<Props extends ViewProps, Element extends ElementType> = MergeProps<Omit<Props, 'as'> & {
6
+ export type ElementType = React.ElementType;
7
+ type AsProp<Element extends ElementType> = {
20
8
  /**
21
9
  * @description
22
10
  * Changes the type of HTML element rendered
23
11
  */
24
- as?: Element | Props['as'];
25
- }, Omit<ElementProps<Element>, 'ref'>>;
26
- export type PrimitivePropsWithRef<Props extends ViewProps, Element extends ElementType> = PrimitiveProps<Props, Element> & {
27
- /**
28
- * @description
29
- * References a DOM element from within a parent component
30
- */
31
- ref?: React.Ref<HTMLElementType<Element>>;
12
+ as?: Element;
32
13
  };
33
- export type Primitive<Props extends ViewProps, Element extends ElementType> = React.ForwardRefRenderFunction<HTMLElementType<Element>, PrimitivePropsWithRef<Props, Element>>;
34
- export interface ViewProps extends BaseComponentProps, BaseStyleProps, AriaProps {
35
- /**
36
- * @description
37
- * Changes the type of HTML element rendered
38
- */
39
- as?: ElementType;
14
+ export type PrimitivePropsWithAs<Props extends BaseViewProps, Element extends ElementType> = Omit<Props, 'as'> & AsProp<Element>;
15
+ type PrimitivePropsWithRef<Props extends BaseViewProps, Element extends ElementType> = Omit<Props, 'ref'> & (IsAny<Element> extends false ? React.RefAttributes<React.ComponentRef<Element>> : React.RefAttributes<any>);
16
+ export type PrimitivePropsWithHTMLAttributes<Props extends BaseViewProps, Element extends ElementType> = MergeProps<PrimitivePropsWithRef<Props, Element>, React.ComponentPropsWithoutRef<Element>>;
17
+ export type PrimitiveProps<Props extends BaseViewProps, Element extends ElementType> = PrimitivePropsWithHTMLAttributes<PrimitivePropsWithAs<Props, Element>, Element>;
18
+ export type Primitive<Props extends BaseViewProps, Element extends ElementType> = React.ForwardRefRenderFunction<React.ComponentRef<Element>, Props>;
19
+ export interface ForwardRefPrimitive<Props extends BaseViewProps, DefaultElement extends ElementType> extends React.ForwardRefExoticComponent<Props> {
20
+ <Element extends ElementType = DefaultElement>(props: PrimitiveProps<Props, Element>): React.ReactElement | null;
21
+ }
22
+ export interface BaseViewProps extends BaseComponentProps, BaseStyleProps, AriaProps {
40
23
  /**
41
24
  * @description
42
25
  * Sets the Boolean `disabled` HTML attribute, which, when present, makes the element not mutable, focusable, or even submitted with the form
@@ -51,4 +34,5 @@ export interface ViewProps extends BaseComponentProps, BaseStyleProps, AriaProps
51
34
  */
52
35
  style?: React.CSSProperties;
53
36
  }
37
+ export type ViewProps<Element extends ElementType = 'div'> = PrimitiveProps<BaseViewProps, Element>;
54
38
  export {};
@@ -1,3 +1,4 @@
1
- import { ViewProps } from './view';
2
- export interface VisuallyHiddenProps extends ViewProps {
1
+ import { ElementType, PrimitiveProps, BaseViewProps } from './view';
2
+ export interface BaseVisuallyHiddenProps extends BaseViewProps {
3
3
  }
4
+ export type VisuallyHiddenProps<Element extends ElementType = 'span'> = PrimitiveProps<BaseVisuallyHiddenProps, Element>;
@@ -1 +1 @@
1
- export declare const VERSION = "4.6.3";
1
+ export declare const VERSION = "5.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "4.6.3",
3
+ "version": "5.0.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -47,8 +47,8 @@
47
47
  "typecheck": "tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@aws-amplify/ui": "5.6.3",
51
- "@aws-amplify/ui-react-core": "2.1.22",
50
+ "@aws-amplify/ui": "5.6.4",
51
+ "@aws-amplify/ui-react-core": "2.1.23",
52
52
  "@radix-ui/react-accordion": "1.0.0",
53
53
  "@radix-ui/react-direction": "1.0.0",
54
54
  "@radix-ui/react-dropdown-menu": "1.0.0",
@@ -58,13 +58,8 @@
58
58
  "classnames": "2.3.1",
59
59
  "deepmerge": "4.2.2",
60
60
  "lodash": "4.17.21",
61
- "mapbox-gl": "1.13.1",
62
- "maplibre-gl": "2.1.9",
63
- "maplibre-gl-js-amplify": "3.0.5",
64
61
  "qrcode": "1.5.0",
65
62
  "react-generate-context": "1.0.1",
66
- "react-map-gl": "7.0.23",
67
- "tinycolor2": "1.4.2",
68
63
  "tslib": "2.4.1"
69
64
  },
70
65
  "peerDependencies": {
@@ -87,11 +82,9 @@
87
82
  "@testing-library/react-hooks": "^7.0.1",
88
83
  "@testing-library/user-event": "^13.2.1",
89
84
  "@types/jest": "^26.0.23",
90
- "@types/mapbox__mapbox-gl-draw": "^1.3.3",
91
85
  "@types/qrcode": "^1.4.2",
92
86
  "@types/react": "^17.0.2",
93
87
  "@types/testing-library__jest-dom": "^5.14.1",
94
- "@types/tinycolor2": "^1.4.3",
95
88
  "esbuild-register": "^3.3.3",
96
89
  "eslint": "^8.13.0",
97
90
  "jest": "^27.0.4",
@@ -118,12 +111,6 @@
118
111
  "import": "{ Authenticator }",
119
112
  "limit": "120 kB"
120
113
  },
121
- {
122
- "name": "Geo",
123
- "path": "dist/esm/index.mjs",
124
- "import": "{ MapView, LocationSearch }",
125
- "limit": "330 kB"
126
- },
127
114
  {
128
115
  "name": "Storage - FileUploader",
129
116
  "path": "dist/esm/index.mjs",
@@ -135,12 +122,6 @@
135
122
  "path": "dist/esm/index.mjs",
136
123
  "import": "{ AccountSettings }",
137
124
  "limit": "60 kB"
138
- },
139
- {
140
- "name": "InAppMessaging",
141
- "path": "dist/esm/index.mjs",
142
- "import": "{ InAppMessagingProvider, InAppMessageDisplay }",
143
- "limit": "110 kB"
144
125
  }
145
126
  ]
146
127
  }
@@ -1 +0,0 @@
1
- import{__rest as r}from"tslib";import e,{useRef as t,useEffect as o}from"react";import i from"maplibre-gl";import{createAmplifyGeocoder as n}from"maplibre-gl-js-amplify";import{useMap as l,useControl as m}from"react-map-gl";const p={maplibregl:i,marker:{color:"#3FB1CE"},popup:!0,showResultMarkers:{color:"#3FB1CE"},showResultsWhileTyping:!0},s="geocoder-container",a=e=>{var{position:t="top-right"}=e,o=r(e,["position"]);return m((()=>n(o)),{position:t}),null},c=r=>{const i=t(!1);return o((()=>{i.current||(n(r).addTo(`#${s}`),i.current=!0)}),[r]),e.createElement("div",{id:s})},u=r=>{const{current:t}=l();return t?e.createElement(a,Object.assign({},p,r)):e.createElement(c,Object.assign({},p,r))},g=u;export{g as Geocoder,u as LocationSearch};
@@ -1 +0,0 @@
1
- import{__rest as e,__awaiter as i}from"tslib";import o,{forwardRef as r,useMemo as t,useState as l,useEffect as a}from"react";import n from"maplibre-gl";import{AmplifyMapLibreRequest as m}from"maplibre-gl-js-amplify";import s from"react-map-gl";import{Amplify as p,Auth as v}from"aws-amplify";const f=r(((r,f)=>{var c,{mapLib:d,mapStyle:u,style:g}=r,y=e(r,["mapLib","mapStyle","style"]);const b=p.configure(),w=t((()=>{var e,i,o,r;return null!==(r=null!==(i=null===(e=b.geo)||void 0===e?void 0:e.amazon_location_service)&&void 0!==i?i:null===(o=b.geo)||void 0===o?void 0:o.AmazonLocationService)&&void 0!==r?r:{}}),[b]),[h,L]=l(),S=t((()=>Object.assign({height:"100vh",position:"relative",width:"100vw"},g)),[g]);return a((()=>{i(void 0,void 0,void 0,(function*(){const e=yield v.currentUserCredentials();if(e){const{region:i}=w,{transformRequest:o}=new m(e,i);L((()=>o))}}))}),[w]),h?o.createElement(s,Object.assign({},y,{mapLib:null!=d?d:n,mapStyle:null!=u?u:null===(c=w.maps)||void 0===c?void 0:c.default,ref:f,style:S,transformRequest:h,fog:y.fog,terrain:y.terrain})):null}));f.displayName="MapView";export{f as MapView};
@@ -1 +0,0 @@
1
- import{__rest as i}from"tslib";import t from"react";import{View as a}from"../../../primitives/View/View.mjs";const e="inappmessaging-backdrop";function r(r){var{onClick:o}=r,m=i(r,["onClick"]);return t.createElement(a,Object.assign({className:"amplify-inappmessaging-backdrop","data-testid":e,onClick:o},m))}export{e as BACKDROP_TEST_ID,r as Backdrop};
@@ -1 +0,0 @@
1
- import e from"react";import{Flex as t}from"../../../primitives/Flex/Flex.mjs";import{View as r}from"../../../primitives/View/View.mjs";import{Backdrop as m}from"./Backdrop.mjs";function n(n,a={}){return function(i){return e.createElement(e.Fragment,null,e.createElement(m,Object.assign({},a)),e.createElement(t,{className:"amplify-inappmessaging-backdrop-content-container"},e.createElement(r,{className:"amplify-inappmessaging-backdrop-content"},e.createElement(n,Object.assign({},i)))))}}export{n as withBackdrop};
@@ -1 +0,0 @@
1
- import e from"react";import s from"classnames";import{useBreakpointValue as o}from"../../../hooks/useBreakpointValue.mjs";import{Flex as t}from"../../../primitives/Flex/Flex.mjs";import"../hooks/useMessageImage/useMessageImage.mjs";import r from"../hooks/useMessageProps/useMessageProps.mjs";import{MessageLayout as m}from"../MessageLayout/MessageLayout.mjs";import{BLOCK_CLASS as a}from"./constants.mjs";function i(i){const n=r(i),l=o([!0,!0,!1]),{shouldRenderMessage:p,styles:g}=n;if(!p)return null;const{alignment:u="right",position:c="top"}=i,d="center"===u&&"middle"===c;return e.createElement(t,{className:s(a,{[`${a}--${c}`]:!d,[`${a}--${u}`]:!d,[`${a}--center-middle`]:d,[`${a}--full-width`]:l}),role:"dialog",testId:`inappmessaging-${c}banner-dialog`},e.createElement(m,Object.assign({},i,n,{orientation:"horizontal",buttonSize:"small",styles:g})))}export{i as BannerMessage};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-bannermessage";export{a as BLOCK_CLASS};
@@ -1 +0,0 @@
1
- import{__rest as i}from"tslib";import*as e from"react";import"../../../primitives/Alert/Alert.mjs";import"../../../primitives/Autocomplete/Autocomplete.mjs";import"../../../primitives/Badge/Badge.mjs";import{Button as m}from"../../../primitives/Button/Button.mjs";import"../../../primitives/ButtonGroup/ButtonGroup.mjs";import"../../../primitives/Card/Card.mjs";import"../../../primitives/CheckboxField/CheckboxField.mjs";import"../../../primitives/Collection/Collection.mjs";import"../../../primitives/Divider/Divider.mjs";import"../../../primitives/Expander/Expander.mjs";import"../../../primitives/Expander/ExpanderItem.mjs";import"../../../primitives/FieldGroupIcon/FieldGroupIcon.mjs";import"../../../primitives/FieldGroupIcon/FieldGroupIconButton.mjs";import"../../../primitives/Flex/Flex.mjs";import"../../../primitives/Grid/Grid.mjs";import"../../../primitives/Heading/Heading.mjs";import"../../../primitives/HighlightMatch/HighlightMatch.mjs";import"../../../primitives/Icon/Icon.mjs";import"../../../primitives/Image/Image.mjs";import"../../../primitives/Link/Link.mjs";import"../../../primitives/Loader/Loader.mjs";import"../../../primitives/Menu/Menu.mjs";import"../../../primitives/Menu/MenuButton.mjs";import"../../../primitives/Menu/MenuItem.mjs";import"../../../primitives/Pagination/Pagination.mjs";import"../../../primitives/PasswordField/PasswordField.mjs";import"../../../primitives/PhoneNumberField/PhoneNumberField.mjs";import"../../../primitives/Placeholder/Placeholder.mjs";import"../../../primitives/Radio/Radio.mjs";import"../../../primitives/RadioGroupField/RadioGroupField.mjs";import"../../../primitives/Rating/Rating.mjs";import"../../../primitives/ScrollView/ScrollView.mjs";import"../../../primitives/SearchField/SearchField.mjs";import"../../../primitives/SelectField/SelectField.mjs";import"../../../primitives/SliderField/SliderField.mjs";import"../../../primitives/StepperField/StepperField.mjs";import"../../../primitives/SwitchField/SwitchField.mjs";import"../../../primitives/Table/Table.mjs";import"../../../primitives/Table/TableBody.mjs";import"../../../primitives/Table/TableCell.mjs";import"../../../primitives/Table/TableFoot.mjs";import"../../../primitives/Table/TableHead.mjs";import"../../../primitives/Table/TableRow.mjs";import"../../../primitives/Tabs/Tabs.mjs";import"../../../primitives/Text/Text.mjs";import"../../../primitives/TextAreaField/TextAreaField.mjs";import"../../../primitives/TextField/TextField.mjs";import"../../../primitives/ToggleButton/ToggleButton.mjs";import"../../../primitives/ToggleButtonGroup/ToggleButtonGroup.mjs";import"../../../primitives/View/View.mjs";import"../../../primitives/VisuallyHidden/VisuallyHidden.mjs";import"../../../primitives/shared/constants.mjs";import"classnames";import{IconClose as t}from"../../../primitives/Icon/icons/IconClose.mjs";function r(r){var{className:s,dismissButtonLabel:o="Dismiss message",onClick:p,style:l}=r,a=i(r,["className","dismissButtonLabel","onClick","style"]);return e.createElement(m,Object.assign({ariaLabel:o,className:s,onClick:p,style:l,variation:"link"},a),e.createElement(t,{"aria-hidden":"true",size:"1.5rem"}))}export{r as CloseIconButton};
@@ -1 +0,0 @@
1
- import*as e from"react";import s from"classnames";import{useBreakpointValue as o}from"../../../hooks/useBreakpointValue.mjs";import{Flex as r}from"../../../primitives/Flex/Flex.mjs";import"tslib";import"../../../primitives/View/View.mjs";import{withBackdrop as t}from"../Backdrop/withBackdrop.mjs";import"../hooks/useMessageImage/useMessageImage.mjs";import m from"../hooks/useMessageProps/useMessageProps.mjs";import{MessageLayout as a}from"../MessageLayout/MessageLayout.mjs";import{BLOCK_CLASS as i}from"./constants.mjs";function l(l){const n=m(l),p=o([!0,!0,!1]),{shouldRenderMessage:c,styles:u}=n,{onClose:g}=l;if(!c)return null;const f=()=>e.createElement(r,{className:s(i,{[`${i}--fullscreen`]:p}),role:"dialog",testId:"inappmessaging-fullscreen-dialog"},e.createElement(a,Object.assign({},l,n,{styles:u})));if(p)return e.createElement(f,null);const j=t(f,{onClick:g});return e.createElement(j,null)}export{l as FullScreenMessage};
@@ -1 +0,0 @@
1
- const e="amplify-inappmessaging-fullscreenmessage";export{e as BLOCK_CLASS};
@@ -1 +0,0 @@
1
- import e from"react";import{useMessage as s,handleMessageAction as o}from"@aws-amplify/ui-react-core";import{ThemeProvider as n}from"../../ThemeProvider/index.mjs";import{BannerMessage as a}from"../BannerMessage/BannerMessage.mjs";import{FullScreenMessage as r}from"../FullScreenMessage/FullScreenMessage.mjs";import{ModalMessage as t}from"../ModalMessage/ModalMessage.mjs";import m from"./handleMessageLinkAction.mjs";function l(e){return null}const c={BannerMessage:a,CarouselMessage:l,FullScreenMessage:r,ModalMessage:t},i=({action:e,url:s})=>{o({action:e,url:s,handleMessageLinkAction:m})};function M({components:o}){const a=e.useMemo((()=>Object.assign(Object.assign({},c),o)),[o]),{Component:r,props:t}=s({components:a,onMessageAction:i});return e.createElement(n,{colorMode:"light"},e.createElement(r,Object.assign({},t)))}M.BannerMessage=a,M.CarouselMessage=l,M.FullScreenMessage=r,M.ModalMessage=t;export{M as default};
@@ -1 +0,0 @@
1
- import{ConsoleLogger as o}from"@aws-amplify/core";const t=new o("Notifications.InAppMessaging"),r=o=>{let r;try{r=new URL(o)}catch(r){return void t.warn(`Unsupported url provided: ${o}`)}const{protocol:p}=r;"http:"===p||"https:"===p?window.open(o):t.warn(`Unsupported url protocol provided: ${p}`)};export{r as default};
@@ -1 +0,0 @@
1
- import*as i from"react";import e from"classnames";import{isEmpty as t}from"@aws-amplify/ui";import"../../../primitives/Alert/Alert.mjs";import"../../../primitives/Autocomplete/Autocomplete.mjs";import"../../../primitives/Badge/Badge.mjs";import{Button as m}from"../../../primitives/Button/Button.mjs";import{ButtonGroup as r}from"../../../primitives/ButtonGroup/ButtonGroup.mjs";import"../../../primitives/Card/Card.mjs";import"../../../primitives/CheckboxField/CheckboxField.mjs";import"../../../primitives/Collection/Collection.mjs";import"../../../primitives/Divider/Divider.mjs";import"../../../primitives/Expander/Expander.mjs";import"../../../primitives/Expander/ExpanderItem.mjs";import"../../../primitives/FieldGroupIcon/FieldGroupIcon.mjs";import"../../../primitives/FieldGroupIcon/FieldGroupIconButton.mjs";import{Flex as o}from"../../../primitives/Flex/Flex.mjs";import"../../../primitives/Grid/Grid.mjs";import{Heading as s}from"../../../primitives/Heading/Heading.mjs";import"../../../primitives/HighlightMatch/HighlightMatch.mjs";import"../../../primitives/Icon/Icon.mjs";import{Image as p}from"../../../primitives/Image/Image.mjs";import"../../../primitives/Link/Link.mjs";import"../../../primitives/Loader/Loader.mjs";import"../../../primitives/Menu/Menu.mjs";import"../../../primitives/Menu/MenuButton.mjs";import"../../../primitives/Menu/MenuItem.mjs";import"../../../primitives/Pagination/Pagination.mjs";import"../../../primitives/PasswordField/PasswordField.mjs";import"../../../primitives/PhoneNumberField/PhoneNumberField.mjs";import"../../../primitives/Placeholder/Placeholder.mjs";import"../../../primitives/Radio/Radio.mjs";import"../../../primitives/RadioGroupField/RadioGroupField.mjs";import"../../../primitives/Rating/Rating.mjs";import"../../../primitives/ScrollView/ScrollView.mjs";import"../../../primitives/SearchField/SearchField.mjs";import"../../../primitives/SelectField/SelectField.mjs";import"../../../primitives/SliderField/SliderField.mjs";import"../../../primitives/StepperField/StepperField.mjs";import"../../../primitives/SwitchField/SwitchField.mjs";import"../../../primitives/Table/Table.mjs";import"../../../primitives/Table/TableBody.mjs";import"../../../primitives/Table/TableCell.mjs";import"../../../primitives/Table/TableFoot.mjs";import"../../../primitives/Table/TableHead.mjs";import"../../../primitives/Table/TableRow.mjs";import"../../../primitives/Tabs/Tabs.mjs";import{Text as l}from"../../../primitives/Text/Text.mjs";import"../../../primitives/TextAreaField/TextAreaField.mjs";import"../../../primitives/TextField/TextField.mjs";import"../../../primitives/ToggleButton/ToggleButton.mjs";import"../../../primitives/ToggleButtonGroup/ToggleButtonGroup.mjs";import"../../../primitives/View/View.mjs";import"../../../primitives/VisuallyHidden/VisuallyHidden.mjs";import"../../../primitives/shared/constants.mjs";import{CloseIconButton as a}from"../CloseIconButton/CloseIconButton.mjs";import{CLOSE_BUTTON_CLASS as n,BLOCK_CLASS as d,MESSAGE_LAYOUT_TEST_ID as c,CONTENT_CLASS as v,CONTENT_TEST_ID as j,IMAGE_CONTAINER_CLASS as u,IMAGE_CONTAINER_TEST_ID as F,TEXT_CONTAINER_CLASS as g,TEXT_CONTAINER_TEST_ID as y,HEADER_CLASS as T,HEADER_TEXT_TEST_ID as b,BODY_TEXT_TEST_ID as B,BUTTON_GROUP_TEST_ID as I,BUTTON_CLASS as h,SECONDARY_BUTTON_TEST_ID as f,PRIMARY_BUTTON_TEST_ID as x}from"./constants.mjs";import{getButtonModifier as E}from"./utils.mjs";const C=i=>!t(i);function S({body:t,buttonSize:S,hasRenderableImage:G,header:w,image:M,onClose:N,orientation:$="vertical",primaryButton:A,secondaryButton:P,styles:R}){const k=i.useMemo((()=>({primary:E(R.primaryButton),secondary:E(R.secondaryButton)})),[R]),H="horizontal"===$,V=i.createElement(a,{className:n,onClick:N,style:R.closeIconButton}),L=C(A),z=C(P),D=L||z;return i.createElement(o,{className:d,"data-testid":c,style:R.container},!H&&i.createElement(o,{justifyContent:"flex-end"},V),i.createElement(o,{className:e(v,`${v}--${$}`),"data-testid":j},G&&i.createElement(o,{className:e(u,`${u}--${$}`),"data-testid":F},i.createElement(p,{alt:"In-App Message Image",src:null==M?void 0:M.src,style:R.image})),i.createElement(o,{className:e(g,`${g}--${$}`),"data-testid":y},(null==w?void 0:w.content)&&i.createElement(s,{className:T,isTruncated:!0,level:2,style:R.header,testId:b},w.content),(null==t?void 0:t.content)&&i.createElement(l,{style:R.body,testId:B},t.content)),H&&i.createElement(o,{alignItems:"flex-start"},V)),D&&i.createElement(r,{size:S,testId:I},z&&i.createElement(m,{className:e(h,`${h}--${k.secondary}`),onClick:P.onAction,style:R.secondaryButton,testId:f},P.title),L&&i.createElement(m,{className:e(h,`${h}--${k.primary}`),onClick:A.onAction,style:R.primaryButton,testId:x},A.title)))}export{S as MessageLayout};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-messagelayout",e=`${a}__button`,s=`${a}__close-button`,n=`${a}__content`,t=`${a}__header`,g=`${a}__image-container`,i=`${a}__text-container`,o="inappmessaging-messagelayout-bodytext",m="inappmessaging-messagelayout-buttongroup",p="inappmessaging-messagelayout-content",u="inappmessaging-messagelayout-headertext",y="inappmessaging-messagelayout-imagecontainer",l="inappmessaging-messagelayout",_="inappmessaging-messagelayout-primarybutton",r="inappmessaging-messagelayout-secondarybutton",c="inappmessaging-messagelayout-textcontainer";export{a as BLOCK_CLASS,o as BODY_TEXT_TEST_ID,e as BUTTON_CLASS,m as BUTTON_GROUP_TEST_ID,s as CLOSE_BUTTON_CLASS,n as CONTENT_CLASS,p as CONTENT_TEST_ID,t as HEADER_CLASS,u as HEADER_TEXT_TEST_ID,g as IMAGE_CONTAINER_CLASS,y as IMAGE_CONTAINER_TEST_ID,l as MESSAGE_LAYOUT_TEST_ID,_ as PRIMARY_BUTTON_TEST_ID,r as SECONDARY_BUTTON_TEST_ID,i as TEXT_CONTAINER_CLASS,c as TEXT_CONTAINER_TEST_ID};
@@ -1 +0,0 @@
1
- import r from"tinycolor2";const o=(o,t="light")=>{const{backgroundColor:n}=null!=o?o:{};if(!n)return t;return r(n).isDark()?"dark":"light"};export{o as getButtonModifier};
@@ -1 +0,0 @@
1
- import*as e from"react";import s from"classnames";import{useBreakpointValue as o}from"../../../hooks/useBreakpointValue.mjs";import{Flex as m}from"../../../primitives/Flex/Flex.mjs";import"../hooks/useMessageImage/useMessageImage.mjs";import a from"../hooks/useMessageProps/useMessageProps.mjs";import{MessageLayout as t}from"../MessageLayout/MessageLayout.mjs";import{BLOCK_CLASS as r,DIALOG_CLASS as l}from"./constants.mjs";function i(i){const n=a(i),p=o([!0,!0,!1]),{shouldRenderMessage:g,styles:u}=n;return g?e.createElement(m,{className:r},e.createElement(m,{className:s(l,{[`${l}--full-width`]:p}),role:"dialog",testId:"inappmessaging-modal-dialog"},e.createElement(t,Object.assign({},i,n,{styles:u})))):null}export{i as ModalMessage};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-modalmessage",s=`${a}__dialog`;export{a as BLOCK_CLASS,s as DIALOG_CLASS};
@@ -1 +0,0 @@
1
- var e;!function(e){e.Aborted="ABORTED",e.Failure="FAILURE",e.Fetching="FETCHING",e.Success="SUCCESS"}(e||(e={}));export{e as ImagePrefetchStatus};
@@ -1 +0,0 @@
1
- import{useState as e,useEffect as r}from"react";import{ConsoleLogger as o}from"@aws-amplify/core";import{ImagePrefetchStatus as t}from"./types.mjs";const a=new o("Notifications.InAppMessaging");function n(o){const{src:n}=null!=o?o:{},s=!!n,[c,i]=e(s?t.Fetching:null),m=c===t.Fetching,l=c===t.Success;return r((()=>{if(!s)return;const e=new Image;e.onload=()=>{i(t.Success)},e.onabort=()=>{a.error(`Image load aborted: ${n}`),i(t.Aborted)},e.onerror=()=>{a.error(`Image failed to load: ${n}`),i(t.Failure)},e.src=n}),[s,n]),{hasRenderableImage:l,isImageFetching:m}}export{n as default};
@@ -1 +0,0 @@
1
- import{useRef as e,useEffect as s,useMemo as a}from"react";import r from"../useMessageImage/useMessageImage.mjs";import{getMessageStyles as t,getPayloadStyle as m}from"./utils.mjs";function l(l){const{image:o,onDisplay:n}=l,g=e(!1),{hasRenderableImage:i,isImageFetching:u}=r(o),c=!u;s((()=>{!g.current&&c&&(null==n||n(),g.current=!0)}),[n,c]);const d=a((()=>t({styleParams:{payloadStyle:m(l),overrideStyle:l.style}})),[l]);return{hasRenderableImage:i,shouldRenderMessage:c,styles:d}}export{l as default};
@@ -1 +0,0 @@
1
- const n=({body:n,container:o,header:l,primaryButton:t,secondaryButton:i})=>{var e,d,u,a,s;return{body:null!==(e=null==n?void 0:n.style)&&void 0!==e?e:{},container:null!==(d=null==o?void 0:o.style)&&void 0!==d?d:{},header:null!==(u=null==l?void 0:l.style)&&void 0!==u?u:{},primaryButton:null!==(a=null==t?void 0:t.style)&&void 0!==a?a:{},secondaryButton:null!==(s=null==i?void 0:i.style)&&void 0!==s?s:{}}};function o({styleParams:n}){var o,l;const{payloadStyle:t,overrideStyle:i}=n;return{body:Object.assign(Object.assign({},null==t?void 0:t.body),null==i?void 0:i.body),closeIconButton:null!==(o=null==i?void 0:i.closeIconButton)&&void 0!==o?o:{},container:Object.assign(Object.assign({},null==t?void 0:t.container),null==i?void 0:i.container),header:Object.assign(Object.assign({},null==t?void 0:t.header),null==i?void 0:i.header),image:null!==(l=null==i?void 0:i.image)&&void 0!==l?l:{},primaryButton:Object.assign(Object.assign({},null==t?void 0:t.primaryButton),null==i?void 0:i.primaryButton),secondaryButton:Object.assign(Object.assign({},null==t?void 0:t.secondaryButton),null==i?void 0:i.secondaryButton)}}export{o as getMessageStyles,n as getPayloadStyle};
@@ -1 +0,0 @@
1
- import e from"react";import{InAppMessagingProvider as t}from"@aws-amplify/ui-react-core";import r from"../InAppMessageDisplay/InAppMessageDisplay.mjs";function a(a,n){return function(s){return e.createElement(t,null,e.createElement(r,Object.assign({},n)),e.createElement(a,Object.assign({},s)))}}export{a as default};
@@ -1,25 +0,0 @@
1
- /// <reference types="react" />
2
- import { LocationSearchProps } from '../types/maplibre-gl-geocoder';
3
- /**
4
- * The `<LocationSearch>` component provides location search.
5
- *
6
- * [📖 Docs](https://ui.docs.amplify.aws/react/connected-components/geo#location-search)
7
- *
8
- * @example
9
- * // Used as a map control:
10
- * function App() {
11
- * return (
12
- * <MapView>
13
- * <LocationSearch />
14
- * </MapView>
15
- * );
16
- * }
17
- *
18
- * @example
19
- * // Used as a standalone component:
20
- * function App() {
21
- * return <LocationSearch />;
22
- * }
23
- */
24
- export declare const LocationSearch: (props: LocationSearchProps) => JSX.Element;
25
- export declare const Geocoder: (props: LocationSearchProps) => JSX.Element;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import maplibregl from 'maplibre-gl';
3
- import type { MapProps, MapRef } from 'react-map-gl';
4
- interface MapViewProps extends Omit<MapProps, 'mapLib' | 'transformRequest'> {
5
- mapLib?: typeof maplibregl;
6
- }
7
- /**
8
- * The `MapView` component uses [react-map-gl](https://visgl.github.io/react-map-gl/) and
9
- * [maplibre-gl-js](https://visgl.github.io/react-map-gl/) to provide an interactive map using
10
- * [Amplify Geo APIs](https://docs.amplify.aws/lib/geo/getting-started/q/platform/js/) powered by
11
- * [Amazon Location Service](https://aws.amazon.com/location/). Since `MapView` is a wrapper of the
12
- * [react-map-gl default Map](https://visgl.github.io/react-map-gl/docs/api-reference/map/), it accepts the same
13
- * properties except `transformRequest` which is set by Amplify.
14
- *
15
- * [📖 Docs](https://ui.docs.amplify.aws/react/connected-components/geo#mapview)
16
- *
17
- * @example
18
- * // Basic usage of MapView:
19
- * function App() {
20
- * return <MapView />
21
- * }
22
- */
23
- declare const MapView: React.ForwardRefExoticComponent<MapViewProps & React.RefAttributes<MapRef>>;
24
- export { MapView };
@@ -1,2 +0,0 @@
1
- export { MapView } from './MapView';
2
- export { Geocoder, LocationSearch } from './LocationSearch';