@aws-amplify/ui-react 5.3.2 → 6.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.
- package/dist/Field-6c0e096a.js +1174 -0
- package/dist/esm/PrimitiveCatalog.mjs +16255 -1
- package/dist/esm/components/AccountSettings/AccountSettings.mjs +6 -1
- package/dist/esm/components/AccountSettings/ChangePassword/ChangePassword.mjs +209 -1
- package/dist/esm/components/AccountSettings/ChangePassword/defaults.mjs +77 -1
- package/dist/esm/components/AccountSettings/DeleteUser/DeleteUser.mjs +156 -1
- package/dist/esm/components/AccountSettings/DeleteUser/defaults.mjs +85 -1
- package/dist/esm/components/AccountSettings/constants.mjs +7 -1
- package/dist/esm/components/AccountSettings/shared/Defaults.mjs +66 -1
- package/dist/esm/components/AccountSettings/utils/displayText.mjs +14 -0
- package/dist/esm/components/Authenticator/Authenticator.mjs +74 -1
- package/dist/esm/components/Authenticator/ConfirmSignIn/ConfirmSignIn.mjs +42 -1
- package/dist/esm/components/Authenticator/ConfirmSignUp/ConfirmSignUp.mjs +51 -1
- package/dist/esm/components/Authenticator/FederatedSignIn/FederatedSignIn.mjs +34 -1
- package/dist/esm/components/Authenticator/FederatedSignIn/FederatedSignInButtons/FederatedSignInButton.mjs +54 -1
- package/dist/esm/components/Authenticator/ForceNewPassword/ForceNewPassword.mjs +43 -1
- package/dist/esm/components/Authenticator/ForgotPassword/ConfirmResetPassword.mjs +39 -0
- package/dist/esm/components/Authenticator/ForgotPassword/ForgotPassword.mjs +40 -0
- package/dist/esm/components/Authenticator/RouteContainer/RouteContainer.mjs +26 -1
- package/dist/esm/components/Authenticator/Router/Router.mjs +63 -1
- package/dist/esm/components/Authenticator/SetupTotp/SetupTotp.mjs +76 -0
- package/dist/esm/components/Authenticator/SignIn/SignIn.mjs +47 -1
- package/dist/esm/components/Authenticator/SignUp/SignUp.mjs +46 -1
- package/dist/esm/components/Authenticator/VerifyUser/ConfirmVerifyUser.mjs +37 -1
- package/dist/esm/components/Authenticator/VerifyUser/VerifyUser.mjs +59 -1
- package/dist/esm/components/Authenticator/hooks/useCustomComponents/defaultComponents.mjs +62 -1
- package/dist/esm/components/Authenticator/hooks/useCustomComponents/useCustomComponents.mjs +14 -1
- package/dist/esm/components/Authenticator/hooks/useFormHandlers/useFormHandlers.mjs +30 -1
- package/dist/esm/components/Authenticator/shared/ConfirmSignInFooter.mjs +18 -1
- package/dist/esm/components/Authenticator/shared/FormField.mjs +35 -1
- package/dist/esm/components/Authenticator/shared/FormFields.mjs +15 -1
- package/dist/esm/components/Authenticator/shared/RemoteErrorMessage.mjs +11 -1
- package/dist/esm/components/Authenticator/shared/SignInSignUpTabs.mjs +27 -1
- package/dist/esm/components/Authenticator/shared/TwoButtonSubmitFooter.mjs +35 -1
- package/dist/esm/components/Authenticator/utils.mjs +3 -1
- package/dist/esm/components/Authenticator/withAuthenticator.mjs +14 -1
- package/dist/esm/components/ThemeProvider/ThemeContext.mjs +8 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.mjs +23 -1
- package/dist/esm/components/index.mjs +5 -1
- package/dist/esm/components/shared/ValidationErrors.mjs +15 -1
- package/dist/esm/helpers/utils.mjs +6 -1
- package/dist/esm/hooks/useAuth.mjs +73 -1
- package/dist/esm/hooks/useBreakpointValue.mjs +29 -1
- package/dist/esm/hooks/useComposeRefsCallback.mjs +20 -1
- package/dist/esm/hooks/useDeprecationWarning.mjs +15 -1
- package/dist/esm/hooks/useStorageURL.mjs +40 -1
- package/dist/esm/hooks/useTheme.mjs +23 -1
- package/dist/esm/hooks/useThemeBreakpoint.mjs +19 -1
- package/dist/esm/index.mjs +71 -1
- package/dist/esm/internal.mjs +32 -1
- package/dist/esm/primitives/Accordion/Accordion.mjs +28 -0
- package/dist/esm/primitives/Accordion/AccordionContainer.mjs +49 -0
- package/dist/esm/primitives/Accordion/AccordionContent.mjs +15 -0
- package/dist/esm/primitives/Accordion/AccordionContext.mjs +6 -0
- package/dist/esm/primitives/Accordion/AccordionIcon.mjs +20 -0
- package/dist/esm/primitives/Accordion/AccordionItem.mjs +19 -0
- package/dist/esm/primitives/Accordion/AccordionTrigger.mjs +27 -0
- package/dist/esm/primitives/Alert/Alert.mjs +36 -1
- package/dist/esm/primitives/Alert/AlertIcon.mjs +36 -1
- package/dist/esm/primitives/Autocomplete/Autocomplete.mjs +67 -1
- package/dist/esm/primitives/Autocomplete/AutocompleteMenu.mjs +36 -1
- package/dist/esm/primitives/Autocomplete/AutocompleteOption.mjs +12 -1
- package/dist/esm/primitives/Autocomplete/useAutocomplete.mjs +188 -1
- package/dist/esm/primitives/Badge/Badge.mjs +16 -1
- package/dist/esm/primitives/Breadcrumbs/BreadcrumbContainer.mjs +18 -1
- package/dist/esm/primitives/Breadcrumbs/BreadcrumbItem.mjs +16 -1
- package/dist/esm/primitives/Breadcrumbs/BreadcrumbLink.mjs +24 -1
- package/dist/esm/primitives/Breadcrumbs/BreadcrumbSeparator.mjs +16 -1
- package/dist/esm/primitives/Breadcrumbs/Breadcrumbs.mjs +28 -1
- package/dist/esm/primitives/Button/Button.mjs +33 -1
- package/dist/esm/primitives/ButtonGroup/ButtonGroup.mjs +19 -1
- package/dist/esm/primitives/Card/Card.mjs +15 -1
- package/dist/esm/primitives/Checkbox/Checkbox.mjs +84 -1
- package/dist/esm/primitives/CheckboxField/CheckboxField.mjs +24 -1
- package/dist/esm/primitives/Collection/Collection.mjs +58 -1
- package/dist/esm/primitives/Collection/utils.mjs +30 -1
- package/dist/esm/primitives/Divider/Divider.mjs +16 -1
- package/dist/esm/primitives/DropZone/DropZone.mjs +27 -1
- package/dist/esm/primitives/DropZone/DropZoneChildren.mjs +39 -1
- package/dist/esm/primitives/DropZone/DropZoneContainer.mjs +18 -1
- package/dist/esm/primitives/DropZone/DropZoneProvider.mjs +8 -1
- package/dist/esm/primitives/DropZone/filterAllowedFiles.mjs +34 -1
- package/dist/esm/primitives/DropZone/useDropZone.mjs +65 -1
- package/dist/esm/primitives/Field/Field.mjs +20 -1
- package/dist/esm/primitives/Field/FieldClearButton.mjs +21 -1
- package/dist/esm/primitives/Field/FieldDescription.mjs +11 -1
- package/dist/esm/primitives/Field/FieldErrorMessage.mjs +10 -1
- package/dist/esm/primitives/FieldGroup/FieldGroup.mjs +29 -1
- package/dist/esm/primitives/FieldGroupIcon/FieldGroupIcon.mjs +12 -1
- package/dist/esm/primitives/FieldGroupIcon/FieldGroupIconButton.mjs +11 -1
- package/dist/esm/primitives/Fieldset/Fieldset.mjs +33 -1
- package/dist/esm/primitives/Fieldset/useFieldset.mjs +13 -1
- package/dist/esm/primitives/Flex/Flex.mjs +13 -1
- package/dist/esm/primitives/Grid/Grid.mjs +13 -1
- package/dist/esm/primitives/Heading/Heading.mjs +21 -1
- package/dist/esm/primitives/HighlightMatch/HighlightMatch.mjs +28 -1
- package/dist/esm/primitives/Icon/Icon.mjs +36 -1
- package/dist/esm/primitives/Icon/context/IconsContext.mjs +5 -1
- package/dist/esm/primitives/Icon/context/IconsProvider.mjs +8 -1
- package/dist/esm/primitives/Icon/context/useIcons.mjs +12 -1
- package/dist/esm/primitives/Icon/icons/IconAdd.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconCheck.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconCheckCircle.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconCheckCircleOutline.mjs +13 -1
- package/dist/esm/primitives/Icon/icons/IconChevronLeft.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconChevronRight.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconClose.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconEdit.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconError.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconExpandMore.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconFile.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconIndeterminate.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconInfo.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconMenu.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconRemove.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconSearch.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconStar.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconUpload.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconVisibility.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconVisibilityOff.mjs +15 -1
- package/dist/esm/primitives/Icon/icons/IconWarning.mjs +15 -1
- package/dist/esm/primitives/Image/Image.mjs +13 -1
- package/dist/esm/primitives/Input/Input.mjs +15 -1
- package/dist/esm/primitives/Label/Label.mjs +14 -1
- package/dist/esm/primitives/Link/Link.mjs +15 -1
- package/dist/esm/primitives/Loader/Loader.mjs +56 -1
- package/dist/esm/primitives/Menu/Menu.mjs +31 -1
- package/dist/esm/primitives/Menu/MenuButton.mjs +18 -1
- package/dist/esm/primitives/Menu/MenuItem.mjs +22 -1
- package/dist/esm/primitives/Message/Message.mjs +23 -1
- package/dist/esm/primitives/Message/MessageContainer.mjs +19 -1
- package/dist/esm/primitives/Message/MessageContent.mjs +12 -1
- package/dist/esm/primitives/Message/MessageDismiss.mjs +28 -1
- package/dist/esm/primitives/Message/MessageHeading.mjs +12 -1
- package/dist/esm/primitives/Message/MessageIcon.mjs +35 -1
- package/dist/esm/primitives/Message/useMessage.mjs +9 -1
- package/dist/esm/primitives/Pagination/Pagination.mjs +31 -1
- package/dist/esm/primitives/Pagination/PaginationItem.mjs +48 -1
- package/dist/esm/primitives/Pagination/usePagination.mjs +41 -1
- package/dist/esm/primitives/Pagination/usePaginationItems.mjs +39 -1
- package/dist/esm/primitives/Pagination/useRange.mjs +72 -1
- package/dist/esm/primitives/PasswordField/PasswordField.mjs +25 -1
- package/dist/esm/primitives/PasswordField/ShowPasswordButton.mjs +30 -1
- package/dist/esm/primitives/PhoneNumberField/DialCodeSelect.mjs +21 -0
- package/dist/esm/primitives/PhoneNumberField/PhoneNumberField.mjs +17 -1
- package/dist/esm/primitives/Placeholder/Placeholder.mjs +18 -1
- package/dist/esm/primitives/Radio/Radio.mjs +31 -1
- package/dist/esm/primitives/RadioGroupField/RadioGroupField.mjs +55 -1
- package/dist/esm/primitives/RadioGroupField/context.mjs +9 -1
- package/dist/esm/primitives/Rating/Rating.mjs +44 -1
- package/dist/esm/primitives/Rating/RatingIcon.mjs +11 -1
- package/dist/esm/primitives/Rating/RatingMixedIcon.mjs +13 -1
- package/dist/esm/primitives/Rating/utils.mjs +18 -1
- package/dist/esm/primitives/ScrollView/ScrollView.mjs +13 -1
- package/dist/esm/primitives/SearchField/SearchField.mjs +38 -1
- package/dist/esm/primitives/SearchField/SearchFieldButton.mjs +21 -1
- package/dist/esm/primitives/SearchField/useSearchField.mjs +64 -1
- package/dist/esm/primitives/Select/Select.mjs +31 -1
- package/dist/esm/primitives/SelectField/SelectField.mjs +42 -1
- package/dist/esm/primitives/SliderField/SliderField.mjs +77 -1
- package/dist/esm/primitives/StepperField/StepperField.mjs +60 -1
- package/dist/esm/primitives/StepperField/useStepper.mjs +113 -1
- package/dist/esm/primitives/SwitchField/SwitchField.mjs +48 -1
- package/dist/esm/primitives/SwitchField/useSwitch.mjs +30 -1
- package/dist/esm/primitives/Table/Table.mjs +18 -1
- package/dist/esm/primitives/Table/TableBody.mjs +10 -1
- package/dist/esm/primitives/Table/TableCell.mjs +12 -1
- package/dist/esm/primitives/Table/TableFoot.mjs +10 -1
- package/dist/esm/primitives/Table/TableHead.mjs +10 -1
- package/dist/esm/primitives/Table/TableRow.mjs +10 -1
- package/dist/esm/primitives/Tabs/Tabs.mjs +24 -1
- package/dist/esm/primitives/Tabs/TabsContainer.mjs +35 -0
- package/dist/esm/primitives/Tabs/TabsContext.mjs +8 -0
- package/dist/esm/primitives/Tabs/TabsItem.mjs +24 -0
- package/dist/esm/primitives/Tabs/TabsList.mjs +85 -0
- package/dist/esm/primitives/Tabs/TabsPanel.mjs +19 -0
- package/dist/esm/primitives/Text/Text.mjs +16 -1
- package/dist/esm/primitives/TextArea/TextArea.mjs +15 -1
- package/dist/esm/primitives/TextAreaField/TextAreaField.mjs +36 -1
- package/dist/esm/primitives/TextField/TextField.mjs +34 -1
- package/dist/esm/primitives/ToggleButton/ToggleButton.mjs +24 -1
- package/dist/esm/primitives/ToggleButton/useToggleButton.mjs +23 -1
- package/dist/esm/primitives/ToggleButtonGroup/ToggleButtonGroup.mjs +35 -1
- package/dist/esm/primitives/ToggleButtonGroup/useToggleButtonGroup.mjs +36 -1
- package/dist/esm/primitives/View/View.mjs +23 -1
- package/dist/esm/primitives/VisuallyHidden/VisuallyHidden.mjs +13 -1
- package/dist/esm/primitives/index.mjs +63 -1
- package/dist/esm/primitives/shared/constants.mjs +98 -1
- package/dist/esm/primitives/shared/getStyleValue.mjs +25 -1
- package/dist/esm/primitives/shared/responsive/getMediaQueries.mjs +29 -1
- package/dist/esm/primitives/shared/responsive/useBreakpoint.mjs +39 -1
- package/dist/esm/primitives/shared/responsive/utils.mjs +51 -1
- package/dist/esm/primitives/shared/styleUtils.mjs +122 -1
- package/dist/esm/primitives/shared/utils.mjs +60 -1
- package/dist/esm/primitives/types/style.mjs +104 -1
- package/dist/esm/primitives/types/theme.mjs +7 -1
- package/dist/esm/primitives/utils/getTestId.mjs +3 -1
- package/dist/esm/primitives/utils/primitiveWithForwardRef.mjs +14 -0
- package/dist/esm/primitives/utils/splitPrimitiveProps.mjs +36 -1
- package/dist/esm/primitives/utils/useLayoutEffect.mjs +13 -1
- package/dist/esm/primitives/utils/useStableId.mjs +34 -1
- package/dist/esm/version.mjs +3 -1
- package/dist/index.js +3485 -1
- package/dist/internal.js +16403 -1
- package/dist/styles/StorageManager.css +138 -0
- package/dist/styles/StorageManager.layer.css +140 -0
- package/dist/styles/_fieldControl.css +0 -0
- package/dist/styles/_fieldControl.layer.css +3 -0
- package/dist/styles/accordion.css +64 -0
- package/dist/styles/accordion.layer.css +66 -0
- package/dist/styles/alert.css +44 -0
- package/dist/styles/alert.layer.css +46 -0
- package/dist/styles/authenticator.css +72 -0
- package/dist/styles/authenticator.layer.css +74 -0
- package/dist/styles/autocomplete.css +48 -0
- package/dist/styles/autocomplete.layer.css +50 -0
- package/dist/styles/badge.css +35 -0
- package/dist/styles/badge.layer.css +37 -0
- package/dist/styles/base.css +1491 -0
- package/dist/styles/base.layer.css +1493 -0
- package/dist/styles/breadcrumbs.css +40 -0
- package/dist/styles/breadcrumbs.layer.css +42 -0
- package/dist/styles/button.css +1122 -0
- package/dist/styles/button.layer.css +1124 -0
- package/dist/styles/card.css +26 -0
- package/dist/styles/card.layer.css +28 -0
- package/dist/styles/checkbox.css +95 -0
- package/dist/styles/checkbox.layer.css +97 -0
- package/dist/styles/checkboxField.css +6 -0
- package/dist/styles/checkboxField.layer.css +8 -0
- package/dist/styles/collection.css +70 -0
- package/dist/styles/collection.layer.css +72 -0
- package/dist/styles/copy.css +27 -0
- package/dist/styles/copy.layer.css +29 -0
- package/dist/styles/dialCodeSelect.css +3 -0
- package/dist/styles/dialCodeSelect.layer.css +5 -0
- package/dist/styles/divider.css +47 -0
- package/dist/styles/divider.layer.css +49 -0
- package/dist/styles/dropZone.css +45 -0
- package/dist/styles/dropZone.layer.css +47 -0
- package/dist/styles/field.css +17 -0
- package/dist/styles/field.layer.css +19 -0
- package/dist/styles/fieldGroup.css +130 -0
- package/dist/styles/fieldGroup.layer.css +132 -0
- package/dist/styles/fieldMessages.css +10 -0
- package/dist/styles/fieldMessages.layer.css +12 -0
- package/dist/styles/fieldModifiers.css +15 -0
- package/dist/styles/fieldModifiers.layer.css +17 -0
- package/dist/styles/fieldset.css +37 -0
- package/dist/styles/fieldset.layer.css +39 -0
- package/dist/styles/flex.css +8 -0
- package/dist/styles/flex.layer.css +10 -0
- package/dist/styles/grid.css +3 -0
- package/dist/styles/grid.layer.css +5 -0
- package/dist/styles/heading.css +40 -0
- package/dist/styles/heading.layer.css +42 -0
- package/dist/styles/highlightMatch.css +3 -0
- package/dist/styles/highlightMatch.layer.css +5 -0
- package/dist/styles/icon.css +14 -0
- package/dist/styles/icon.layer.css +16 -0
- package/dist/styles/image.css +9 -0
- package/dist/styles/image.layer.css +11 -0
- package/dist/styles/inAppMessaging.css +179 -0
- package/dist/styles/inAppMessaging.layer.css +181 -0
- package/dist/styles/input.css +83 -0
- package/dist/styles/input.layer.css +85 -0
- package/dist/styles/link.css +26 -0
- package/dist/styles/link.layer.css +28 -0
- package/dist/styles/liveness.css +374 -0
- package/dist/styles/liveness.layer.css +376 -0
- package/dist/styles/loader.css +108 -0
- package/dist/styles/loader.layer.css +110 -0
- package/dist/styles/menu.css +54 -0
- package/dist/styles/menu.layer.css +56 -0
- package/dist/styles/message.css +111 -0
- package/dist/styles/message.layer.css +113 -0
- package/dist/styles/pagination.css +41 -0
- package/dist/styles/pagination.layer.css +43 -0
- package/dist/styles/passwordField.css +49 -0
- package/dist/styles/passwordField.layer.css +51 -0
- package/dist/styles/phoneNumberField.css +30 -0
- package/dist/styles/phoneNumberField.layer.css +32 -0
- package/dist/styles/placeholder.css +31 -0
- package/dist/styles/placeholder.layer.css +33 -0
- package/dist/styles/radio.css +82 -0
- package/dist/styles/radio.layer.css +84 -0
- package/dist/styles/radioGroupField.css +25 -0
- package/dist/styles/radioGroupField.layer.css +27 -0
- package/dist/styles/radiogroup.css +5 -0
- package/dist/styles/radiogroup.layer.css +7 -0
- package/dist/styles/rating.css +33 -0
- package/dist/styles/rating.layer.css +35 -0
- package/dist/styles/reset.css +76 -0
- package/dist/styles/reset.layer.css +78 -0
- package/dist/styles/scrollView.css +4 -0
- package/dist/styles/scrollView.layer.css +6 -0
- package/dist/styles/searchField.css +29 -0
- package/dist/styles/searchField.layer.css +31 -0
- package/dist/styles/select.css +128 -0
- package/dist/styles/select.layer.css +130 -0
- package/dist/styles/selectField.css +18 -0
- package/dist/styles/selectField.layer.css +20 -0
- package/dist/styles/sliderField.css +143 -0
- package/dist/styles/sliderField.layer.css +145 -0
- package/dist/styles/stepperField.css +77 -0
- package/dist/styles/stepperField.layer.css +79 -0
- package/dist/styles/switchField.css +76 -0
- package/dist/styles/switchField.layer.css +78 -0
- package/dist/styles/table.css +146 -0
- package/dist/styles/table.layer.css +148 -0
- package/dist/styles/tabs.css +87 -0
- package/dist/styles/tabs.layer.css +89 -0
- package/dist/styles/text.css +40 -0
- package/dist/styles/text.layer.css +42 -0
- package/dist/styles/textArea.css +71 -0
- package/dist/styles/textArea.layer.css +73 -0
- package/dist/styles/textAreaField.css +12 -0
- package/dist/styles/textAreaField.layer.css +14 -0
- package/dist/styles/textField.css +14 -0
- package/dist/styles/textField.layer.css +16 -0
- package/dist/styles/toggleButton.css +280 -0
- package/dist/styles/toggleButton.layer.css +282 -0
- package/dist/styles/toggleButtonGroup.css +31 -0
- package/dist/styles/toggleButtonGroup.layer.css +33 -0
- package/dist/styles/visuallyHidden.css +12 -0
- package/dist/styles/visuallyHidden.layer.css +14 -0
- package/dist/styles.css +299 -685
- package/dist/styles.layer.css +6115 -0
- package/dist/types/components/AccountSettings/ChangePassword/ChangePassword.d.ts +6 -6
- package/dist/types/components/AccountSettings/ChangePassword/types.d.ts +3 -0
- package/dist/types/components/AccountSettings/DeleteUser/DeleteUser.d.ts +3 -3
- package/dist/types/components/AccountSettings/DeleteUser/types.d.ts +7 -2
- package/dist/types/components/AccountSettings/utils/displayText.d.ts +18 -0
- package/dist/types/components/AccountSettings/utils/index.d.ts +1 -0
- package/dist/types/components/Authenticator/Authenticator.d.ts +4 -3
- package/dist/types/components/Authenticator/ConfirmSignIn/ConfirmSignIn.d.ts +2 -2
- package/dist/types/components/Authenticator/ConfirmSignUp/ConfirmSignUp.d.ts +2 -2
- package/dist/types/components/Authenticator/{ResetPassword → ForgotPassword}/index.d.ts +1 -1
- package/dist/types/components/Authenticator/{SetupTOTP/SetupTOTP.d.ts → SetupTotp/SetupTotp.d.ts} +1 -1
- package/dist/types/components/Authenticator/SetupTotp/index.d.ts +1 -0
- package/dist/types/components/Authenticator/SignIn/SignIn.d.ts +2 -2
- package/dist/types/components/Authenticator/SignUp/SignUp.d.ts +2 -2
- package/dist/types/components/Authenticator/VerifyUser/ConfirmVerifyUser.d.ts +2 -2
- package/dist/types/components/Authenticator/hooks/useCustomComponents/defaultComponents.d.ts +1 -1
- package/dist/types/components/Authenticator/withAuthenticator.d.ts +2 -2
- package/dist/types/components/ThemeProvider/ThemeContext.d.ts +6 -0
- package/dist/types/components/ThemeProvider/ThemeProvider.d.ts +1 -2
- package/dist/types/components/ThemeProvider/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types/hooks/useAuth.d.ts +2 -2
- package/dist/types/hooks/useStorageURL.d.ts +2 -6
- package/dist/types/hooks/useTheme.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal.d.ts +0 -12
- package/dist/types/primitives/Accordion/Accordion.d.ts +19 -0
- package/dist/types/primitives/Accordion/AccordionContainer.d.ts +8 -0
- package/dist/types/primitives/Accordion/AccordionContent.d.ts +9 -0
- package/dist/types/primitives/Accordion/AccordionContext.d.ts +9 -0
- package/dist/types/primitives/Accordion/AccordionIcon.d.ts +9 -0
- package/dist/types/primitives/Accordion/AccordionItem.d.ts +6 -0
- package/dist/types/primitives/Accordion/AccordionTrigger.d.ts +9 -0
- package/dist/types/primitives/Accordion/index.d.ts +2 -0
- package/dist/types/primitives/Accordion/types.d.ts +49 -0
- package/dist/types/primitives/Alert/AlertIcon.d.ts +5 -2
- package/dist/types/primitives/Breadcrumbs/BreadcrumbItem.d.ts +1 -1
- package/dist/types/primitives/DropZone/DropZoneChildren.d.ts +10 -3
- package/dist/types/primitives/Icon/context/IconsContext.d.ts +1 -1
- package/dist/types/primitives/PhoneNumberField/DialCodeSelect.d.ts +2 -0
- package/dist/types/primitives/StepperField/useStepper.d.ts +1 -1
- package/dist/types/primitives/Tabs/Tabs.d.ts +14 -3
- package/dist/types/primitives/Tabs/TabsContainer.d.ts +6 -0
- package/dist/types/primitives/Tabs/TabsContext.d.ts +7 -0
- package/dist/types/primitives/Tabs/TabsItem.d.ts +6 -0
- package/dist/types/primitives/Tabs/TabsList.d.ts +6 -0
- package/dist/types/primitives/Tabs/TabsPanel.d.ts +6 -0
- package/dist/types/primitives/Tabs/index.d.ts +2 -1
- package/dist/types/primitives/Tabs/types.d.ts +93 -0
- package/dist/types/primitives/components.d.ts +2 -2
- package/dist/types/primitives/index.d.ts +0 -1
- package/dist/types/primitives/shared/constants.d.ts +0 -6
- package/dist/types/primitives/shared/responsive/utils.d.ts +1 -1
- package/dist/types/primitives/shared/styleUtils.d.ts +2 -2
- package/dist/types/primitives/types/collection.d.ts +2 -2
- package/dist/types/primitives/types/fieldset.d.ts +1 -1
- package/dist/types/primitives/types/index.d.ts +0 -3
- package/dist/types/primitives/types/radioGroupField.d.ts +2 -1
- package/dist/types/primitives/types/view.d.ts +32 -2
- package/dist/types/primitives/utils/primitiveWithForwardRef.d.ts +11 -0
- package/package.json +13 -45
- package/dist/Field-94e428ed.js +0 -1
- package/dist/esm/components/Authenticator/ResetPassword/ConfirmResetPassword.mjs +0 -1
- package/dist/esm/components/Authenticator/ResetPassword/ResetPassword.mjs +0 -1
- package/dist/esm/components/Authenticator/SetupTOTP/SetupTOTP.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/FileUploader.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/UploadDropZone/UploadDropZone.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/UploadPreviewer/UploadPreviewer.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/UploadTracker/UploadMessage.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/UploadTracker/UploadTracker.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/hooks/useFileUploader/useFileUploader.mjs +0 -1
- package/dist/esm/components/Storage/FileUploader/types.mjs +0 -1
- package/dist/esm/components/ThemeProvider/AmplifyContext.mjs +0 -1
- package/dist/esm/helpers/constants.mjs +0 -1
- package/dist/esm/hooks/actions/constants.mjs +0 -1
- package/dist/esm/hooks/actions/shared/types.mjs +0 -1
- package/dist/esm/hooks/actions/shared/useTypeCastFields.mjs +0 -1
- package/dist/esm/hooks/actions/useAuthSignOutAction.mjs +0 -1
- package/dist/esm/hooks/actions/useDataStoreCreateAction.mjs +0 -1
- package/dist/esm/hooks/actions/useDataStoreDeleteAction.mjs +0 -1
- package/dist/esm/hooks/actions/useDataStoreUpdateAction.mjs +0 -1
- package/dist/esm/hooks/actions/useNavigateAction.mjs +0 -1
- package/dist/esm/hooks/actions/useStateMutationAction.mjs +0 -1
- package/dist/esm/hooks/useAmplify.mjs +0 -1
- package/dist/esm/hooks/useDataStore.mjs +0 -1
- package/dist/esm/primitives/Expander/Expander.mjs +0 -1
- package/dist/esm/primitives/Expander/ExpanderItem.mjs +0 -1
- package/dist/esm/primitives/PhoneNumberField/CountryCodeSelect.mjs +0 -1
- package/dist/esm/primitives/shared/datastore.mjs +0 -1
- package/dist/esm/studio/findChildOverrides.mjs +0 -1
- package/dist/esm/studio/getOverrideProps.mjs +0 -1
- package/dist/esm/studio/getOverridesFromVariants.mjs +0 -1
- package/dist/esm/studio/mergeVariantsAndOverrides.mjs +0 -1
- package/dist/styles.js +0 -2
- package/dist/types/components/Authenticator/SetupTOTP/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/FileUploader.d.ts +0 -3
- package/dist/types/components/Storage/FileUploader/UploadDropZone/UploadDropZone.d.ts +0 -3
- package/dist/types/components/Storage/FileUploader/UploadDropZone/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/UploadPreviewer/UploadPreviewer.d.ts +0 -3
- package/dist/types/components/Storage/FileUploader/UploadPreviewer/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/UploadTracker/UploadMessage.d.ts +0 -3
- package/dist/types/components/Storage/FileUploader/UploadTracker/UploadTracker.d.ts +0 -3
- package/dist/types/components/Storage/FileUploader/UploadTracker/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/hooks/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/hooks/useFileUploader/index.d.ts +0 -2
- package/dist/types/components/Storage/FileUploader/hooks/useFileUploader/types.d.ts +0 -18
- package/dist/types/components/Storage/FileUploader/hooks/useFileUploader/useFileUploader.d.ts +0 -9
- package/dist/types/components/Storage/FileUploader/index.d.ts +0 -1
- package/dist/types/components/Storage/FileUploader/types.d.ts +0 -91
- package/dist/types/components/Storage/index.d.ts +0 -1
- package/dist/types/components/ThemeProvider/AmplifyContext.d.ts +0 -6
- package/dist/types/hooks/actions/constants.d.ts +0 -39
- package/dist/types/hooks/actions/shared/types.d.ts +0 -27
- package/dist/types/hooks/actions/shared/useTypeCastFields.d.ts +0 -15
- package/dist/types/hooks/actions/testModels/model.d.ts +0 -25
- package/dist/types/hooks/actions/testModels/schema.d.ts +0 -2
- package/dist/types/hooks/actions/testModels/todo.d.ts +0 -13
- package/dist/types/hooks/actions/useAuthSignOutAction.d.ts +0 -9
- package/dist/types/hooks/actions/useDataStoreCreateAction.d.ts +0 -9
- package/dist/types/hooks/actions/useDataStoreDeleteAction.d.ts +0 -10
- package/dist/types/hooks/actions/useDataStoreUpdateAction.d.ts +0 -10
- package/dist/types/hooks/actions/useNavigateAction.d.ts +0 -15
- package/dist/types/hooks/actions/useStateMutationAction.d.ts +0 -10
- package/dist/types/hooks/useAmplify.d.ts +0 -6
- package/dist/types/hooks/useDataStore.d.ts +0 -18
- package/dist/types/primitives/Expander/Expander.d.ts +0 -6
- package/dist/types/primitives/Expander/ExpanderItem.d.ts +0 -7
- package/dist/types/primitives/Expander/index.d.ts +0 -2
- package/dist/types/primitives/Menu/__tests_/menu.test.d.ts +0 -1
- package/dist/types/primitives/PhoneNumberField/CountryCodeSelect.d.ts +0 -2
- package/dist/types/primitives/Rating/__test__/Rating.test.d.ts +0 -1
- package/dist/types/primitives/Rating/__test__/utils.test.d.ts +0 -1
- package/dist/types/primitives/Text/__test__/Text.test.d.ts +0 -1
- package/dist/types/primitives/shared/datastore.d.ts +0 -7
- package/dist/types/primitives/shared/index.d.ts +0 -1
- package/dist/types/primitives/shared/types.d.ts +0 -15
- package/dist/types/primitives/types/datastore.d.ts +0 -31
- package/dist/types/primitives/types/expander.d.ts +0 -51
- package/dist/types/primitives/types/tabs.d.ts +0 -63
- package/dist/types/studio/findChildOverrides.d.ts +0 -18
- package/dist/types/studio/getOverrideProps.d.ts +0 -18
- package/dist/types/studio/getOverridesFromVariants.d.ts +0 -20
- package/dist/types/studio/index.d.ts +0 -5
- package/dist/types/studio/mergeVariantsAndOverrides.d.ts +0 -18
- package/dist/types/studio/types.d.ts +0 -18
- package/dist/types/styles.d.ts +0 -1
- /package/dist/types/components/Authenticator/{ResetPassword → ForgotPassword}/ConfirmResetPassword.d.ts +0 -0
- /package/dist/types/components/Authenticator/{ResetPassword/ResetPassword.d.ts → ForgotPassword/ForgotPassword.d.ts} +0 -0
|
@@ -1 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isFunction, classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';
|
|
3
|
+
import { ComponentText } from '../shared/constants.mjs';
|
|
4
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
5
|
+
import { View } from '../View/View.mjs';
|
|
6
|
+
import { Flex } from '../Flex/Flex.mjs';
|
|
7
|
+
import { Button } from '../Button/Button.mjs';
|
|
8
|
+
import { AlertIcon } from './AlertIcon.mjs';
|
|
9
|
+
import '../Icon/Icon.mjs';
|
|
10
|
+
import '../Icon/context/IconsContext.mjs';
|
|
11
|
+
import { useIcons } from '../Icon/context/useIcons.mjs';
|
|
12
|
+
import { IconClose } from '../Icon/icons/IconClose.mjs';
|
|
13
|
+
|
|
14
|
+
const AlertPrimitive = ({ buttonRef, children, className, dismissButtonLabel = ComponentText.Alert.dismissButtonLabel, hasIcon = true, heading, isDismissible = false, onDismiss, variation, ...rest }, ref) => {
|
|
15
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
16
|
+
const icons = useIcons('alert');
|
|
17
|
+
const dismissAlert = React.useCallback(() => {
|
|
18
|
+
setDismissed(!dismissed);
|
|
19
|
+
if (isFunction(onDismiss)) {
|
|
20
|
+
onDismiss();
|
|
21
|
+
}
|
|
22
|
+
}, [setDismissed, onDismiss, dismissed]);
|
|
23
|
+
return !dismissed ? (React.createElement(Flex, { className: classNames(ComponentClassName.Alert, className, classNameModifier(ComponentClassName.Alert, variation)), ref: ref, role: "alert", ...rest },
|
|
24
|
+
hasIcon && React.createElement(AlertIcon, { variation: variation, ariaHidden: true }),
|
|
25
|
+
React.createElement(View, { flex: "1" },
|
|
26
|
+
heading && (React.createElement(View, { className: ComponentClassName.AlertHeading }, heading)),
|
|
27
|
+
React.createElement(View, { className: ComponentClassName.AlertBody }, children)),
|
|
28
|
+
isDismissible && (React.createElement(Button, { ariaLabel: dismissButtonLabel, variation: "link", className: ComponentClassName.AlertDismiss, onClick: dismissAlert, ref: buttonRef }, icons?.close ?? React.createElement(IconClose, { "aria-hidden": "true" }))))) : null;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/alert)
|
|
32
|
+
*/
|
|
33
|
+
const Alert = primitiveWithForwardRef(AlertPrimitive);
|
|
34
|
+
Alert.displayName = 'Alert';
|
|
35
|
+
|
|
36
|
+
export { Alert };
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
import*
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import '../Icon/Icon.mjs';
|
|
4
|
+
import '../Icon/context/IconsContext.mjs';
|
|
5
|
+
import { useIcons } from '../Icon/context/useIcons.mjs';
|
|
6
|
+
import '../View/View.mjs';
|
|
7
|
+
import { IconCheckCircle } from '../Icon/icons/IconCheckCircle.mjs';
|
|
8
|
+
import { IconError } from '../Icon/icons/IconError.mjs';
|
|
9
|
+
import { IconInfo } from '../Icon/icons/IconInfo.mjs';
|
|
10
|
+
import { IconWarning } from '../Icon/icons/IconWarning.mjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @internal For internal Amplify UI use only. May be removed in a future release.
|
|
14
|
+
*/
|
|
15
|
+
const AlertIcon = ({ variation, ariaHidden, }) => {
|
|
16
|
+
const icons = useIcons('alert');
|
|
17
|
+
let icon;
|
|
18
|
+
switch (variation) {
|
|
19
|
+
case 'info':
|
|
20
|
+
icon = icons?.info ?? React.createElement(IconInfo, { "aria-hidden": ariaHidden });
|
|
21
|
+
break;
|
|
22
|
+
case 'error':
|
|
23
|
+
icon = icons?.error ?? React.createElement(IconError, { "aria-hidden": ariaHidden });
|
|
24
|
+
break;
|
|
25
|
+
case 'warning':
|
|
26
|
+
icon = icons?.warning ?? React.createElement(IconWarning, { "aria-hidden": ariaHidden });
|
|
27
|
+
break;
|
|
28
|
+
case 'success':
|
|
29
|
+
icon = icons?.success ?? React.createElement(IconCheckCircle, { "aria-hidden": ariaHidden });
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
return icon ? (React.createElement("span", { className: ComponentClassName.AlertIcon }, icon)) : null;
|
|
33
|
+
};
|
|
34
|
+
AlertIcon.displayName = 'AlertIcon';
|
|
35
|
+
|
|
36
|
+
export { AlertIcon };
|
|
@@ -1 +1,67 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { isFunction, classNames, ComponentClassName } from '@aws-amplify/ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { AutocompleteOption } from './AutocompleteOption.mjs';
|
|
5
|
+
import { AutocompleteMenu } from './AutocompleteMenu.mjs';
|
|
6
|
+
import { useAutocomplete } from './useAutocomplete.mjs';
|
|
7
|
+
import { HighlightMatch } from '../HighlightMatch/HighlightMatch.mjs';
|
|
8
|
+
import { SearchField } from '../SearchField/SearchField.mjs';
|
|
9
|
+
import { View } from '../View/View.mjs';
|
|
10
|
+
|
|
11
|
+
const AutocompletePrimitive = ({ className, defaultValue, value, isLoading = false, menuSlots = {}, options, optionFilter, onBlur, onChange, onClear, onClick, onSelect, onSubmit, renderOption, testId, ...rest }, ref) => {
|
|
12
|
+
const { activeOptionId, autocompleteId, composedValue, filteredOptions, handleOnBlur, handleOnClear, handleOnClick, handleOnChange, handleOnKeyDown, isControlled, isCustomFiltering, isMenuOpen, listboxId, menuId, optionBaseId, setActiveOption, setIsMenuOpen, setInternalValue, } = useAutocomplete({
|
|
13
|
+
defaultValue,
|
|
14
|
+
value,
|
|
15
|
+
options,
|
|
16
|
+
optionFilter,
|
|
17
|
+
onBlur,
|
|
18
|
+
onChange,
|
|
19
|
+
onClear,
|
|
20
|
+
onClick,
|
|
21
|
+
onSelect,
|
|
22
|
+
onSubmit,
|
|
23
|
+
});
|
|
24
|
+
const comboboxProps = {
|
|
25
|
+
role: 'combobox',
|
|
26
|
+
'aria-activedescendant': activeOptionId,
|
|
27
|
+
'aria-autocomplete': 'list',
|
|
28
|
+
'aria-controls': isMenuOpen ? menuId : undefined,
|
|
29
|
+
'aria-expanded': isMenuOpen,
|
|
30
|
+
'aria-haspopup': 'listbox',
|
|
31
|
+
'aria-owns': isMenuOpen ? menuId : undefined,
|
|
32
|
+
};
|
|
33
|
+
const Options = filteredOptions.map((option, idx) => {
|
|
34
|
+
const { id, label, ...rest } = option;
|
|
35
|
+
const handleOnClick = () => {
|
|
36
|
+
setIsMenuOpen(false);
|
|
37
|
+
setActiveOption(null);
|
|
38
|
+
if (!isControlled) {
|
|
39
|
+
setInternalValue(label);
|
|
40
|
+
}
|
|
41
|
+
if (isFunction(onSelect)) {
|
|
42
|
+
onSelect(option);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// This is required. Mousedown event will fire a blur event by default
|
|
46
|
+
// and so the menu will close before the click event on an option gets a chance to fire
|
|
47
|
+
const handleOnMouseDown = (event) => {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
};
|
|
50
|
+
const handleOnMouseMove = () => {
|
|
51
|
+
setActiveOption(option);
|
|
52
|
+
};
|
|
53
|
+
const optionId = id ?? `${optionBaseId}-option-${idx}`;
|
|
54
|
+
const isActive = optionId === activeOptionId;
|
|
55
|
+
return (React.createElement(AutocompleteOption, { isActive: isActive, id: optionId, key: optionId, onClick: handleOnClick, onMouseDown: handleOnMouseDown, onMouseMove: handleOnMouseMove, ...rest }, isFunction(renderOption) ? (renderOption(option, composedValue)) : isCustomFiltering ? (label) : (React.createElement(HighlightMatch, { query: composedValue }, label))));
|
|
56
|
+
});
|
|
57
|
+
return (React.createElement(View, { className: classNames(ComponentClassName.Autocomplete, className), id: autocompleteId, testId: testId },
|
|
58
|
+
React.createElement(SearchField, { hasSearchButton: false, hasSearchIcon: true, onBlur: handleOnBlur, onChange: handleOnChange, onClear: handleOnClear, onClick: handleOnClick, onKeyDown: handleOnKeyDown, ref: ref, value: composedValue, ...comboboxProps, ...rest }),
|
|
59
|
+
isMenuOpen ? (React.createElement(AutocompleteMenu, { id: menuId, isLoading: isLoading, listboxId: listboxId, ...menuSlots }, Options)) : null));
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/autocomplete)
|
|
63
|
+
*/
|
|
64
|
+
const Autocomplete = primitiveWithForwardRef(AutocompletePrimitive);
|
|
65
|
+
Autocomplete.displayName = 'Autocomplete';
|
|
66
|
+
|
|
67
|
+
export { Autocomplete, AutocompletePrimitive };
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import { Loader } from '../Loader/Loader.mjs';
|
|
4
|
+
import { ScrollView } from '../ScrollView/ScrollView.mjs';
|
|
5
|
+
import { View } from '../View/View.mjs';
|
|
6
|
+
import { ComponentText } from '../shared/constants.mjs';
|
|
7
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
8
|
+
|
|
9
|
+
const MenuHeader = ({ children }) => {
|
|
10
|
+
if (!children) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (React.createElement(View, { className: ComponentClassName.AutocompleteMenuHeader }, children));
|
|
14
|
+
};
|
|
15
|
+
const MenuFooter = ({ children }) => {
|
|
16
|
+
if (!children) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement(View, { className: ComponentClassName.AutocompleteMenuFooter }, children));
|
|
20
|
+
};
|
|
21
|
+
const MenuLoading = ({ children }) => {
|
|
22
|
+
return (React.createElement(View, { className: ComponentClassName.AutocompleteMenuLoading }, children ?? (React.createElement(React.Fragment, null,
|
|
23
|
+
React.createElement(Loader, null),
|
|
24
|
+
ComponentText.Autocomplete.loadingText))));
|
|
25
|
+
};
|
|
26
|
+
const MenuEmpty = ({ children }) => (React.createElement(View, { className: ComponentClassName.AutocompleteMenuEmpty }, children ?? ComponentText.Autocomplete.emptyText));
|
|
27
|
+
const AutocompleteMenuPrimitive = ({ ariaLabel, children, Header = null, Footer = null, LoadingIndicator = null, Empty = null, isLoading, listboxId, ...rest }, ref) => {
|
|
28
|
+
return (React.createElement(ScrollView, { className: ComponentClassName.AutocompleteMenu, ref: ref, ...rest }, isLoading ? (React.createElement(MenuLoading, null, LoadingIndicator)) : (React.createElement(React.Fragment, null,
|
|
29
|
+
React.createElement(MenuHeader, null, Header),
|
|
30
|
+
children.length > 0 ? (React.createElement(ScrollView, { as: "ul", ariaLabel: ariaLabel, className: ComponentClassName.AutocompleteMenuOptions, id: listboxId, role: "listbox" }, children)) : (React.createElement(MenuEmpty, null, Empty)),
|
|
31
|
+
React.createElement(MenuFooter, null, Footer)))));
|
|
32
|
+
};
|
|
33
|
+
const AutocompleteMenu = primitiveWithForwardRef(AutocompleteMenuPrimitive);
|
|
34
|
+
AutocompleteMenu.displayName = 'AutocompleteMenu';
|
|
35
|
+
|
|
36
|
+
export { AutocompleteMenu };
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { classNames, ComponentClassName, classNameModifierByFlag } from '@aws-amplify/ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { View } from '../View/View.mjs';
|
|
4
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
5
|
+
|
|
6
|
+
const AutocompleteOptionPrimitive = ({ children, className, isActive, ...rest }, ref) => {
|
|
7
|
+
return (React.createElement(View, { "aria-selected": isActive, as: "li", role: "option", className: classNames(ComponentClassName.AutocompleteMenuOption, classNameModifierByFlag(ComponentClassName.AutocompleteMenuOption, 'active', isActive), className), ref: ref, ...rest }, children));
|
|
8
|
+
};
|
|
9
|
+
const AutocompleteOption = primitiveWithForwardRef(AutocompleteOptionPrimitive);
|
|
10
|
+
AutocompleteOption.displayName = 'AutocompleteOption';
|
|
11
|
+
|
|
12
|
+
export { AutocompleteOption };
|
|
@@ -1 +1,188 @@
|
|
|
1
|
-
import*
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isFunction } from '@aws-amplify/ui';
|
|
3
|
+
import { ARROW_UP, ARROW_DOWN, ENTER_KEY, ESCAPE_KEY } from '../shared/constants.mjs';
|
|
4
|
+
import { strHasLength } from '../shared/utils.mjs';
|
|
5
|
+
import { useStableId } from '../utils/useStableId.mjs';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_KEYS = new Set([ARROW_DOWN, ARROW_UP, ENTER_KEY, ESCAPE_KEY]);
|
|
8
|
+
const useAutocomplete = ({ defaultValue = '', value, options, optionFilter, onBlur, onChange, onClear, onClick, onSelect, onSubmit, }) => {
|
|
9
|
+
const isControlled = value !== undefined;
|
|
10
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
11
|
+
const composedValue = isControlled ? value : internalValue;
|
|
12
|
+
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
13
|
+
const [activeOption, setActiveOption] = React.useState(null);
|
|
14
|
+
const isCustomFiltering = isFunction(optionFilter);
|
|
15
|
+
const filteredOptions = React.useMemo(() => {
|
|
16
|
+
const defaultFilter = (option) => {
|
|
17
|
+
const { label } = option;
|
|
18
|
+
return label
|
|
19
|
+
?.toLocaleLowerCase()
|
|
20
|
+
.includes(composedValue?.toLocaleLowerCase());
|
|
21
|
+
};
|
|
22
|
+
const filter = isCustomFiltering
|
|
23
|
+
? (option) => optionFilter(option, composedValue)
|
|
24
|
+
: defaultFilter;
|
|
25
|
+
return options?.filter(filter) ?? [];
|
|
26
|
+
}, [composedValue, optionFilter, isCustomFiltering, options]);
|
|
27
|
+
const autocompleteId = useStableId();
|
|
28
|
+
const listboxId = useStableId();
|
|
29
|
+
const menuId = useStableId();
|
|
30
|
+
const optionBaseId = useStableId();
|
|
31
|
+
const activeIndex = filteredOptions.findIndex((option) => option === activeOption);
|
|
32
|
+
const activeOptionId = activeOption?.id ??
|
|
33
|
+
(activeIndex !== -1 ? `${optionBaseId}-option-${activeIndex}` : undefined);
|
|
34
|
+
const handleOnBlur = React.useCallback((event) => {
|
|
35
|
+
setIsMenuOpen(false);
|
|
36
|
+
setActiveOption(null);
|
|
37
|
+
if (isFunction(onBlur)) {
|
|
38
|
+
onBlur(event);
|
|
39
|
+
}
|
|
40
|
+
}, [onBlur]);
|
|
41
|
+
const handleOnChange = React.useCallback((event) => {
|
|
42
|
+
setActiveOption(null);
|
|
43
|
+
setIsMenuOpen(true);
|
|
44
|
+
if (!isControlled) {
|
|
45
|
+
setInternalValue(event.target.value);
|
|
46
|
+
}
|
|
47
|
+
if (isFunction(onChange)) {
|
|
48
|
+
onChange(event);
|
|
49
|
+
}
|
|
50
|
+
}, [isControlled, onChange]);
|
|
51
|
+
const handleOnClear = React.useCallback(() => {
|
|
52
|
+
if (!isControlled) {
|
|
53
|
+
setInternalValue('');
|
|
54
|
+
}
|
|
55
|
+
if (isFunction(onClear)) {
|
|
56
|
+
onClear();
|
|
57
|
+
}
|
|
58
|
+
}, [isControlled, onClear]);
|
|
59
|
+
const handleOnClick = React.useCallback((event) => {
|
|
60
|
+
setIsMenuOpen(true);
|
|
61
|
+
if (isFunction(onClick)) {
|
|
62
|
+
onClick(event);
|
|
63
|
+
}
|
|
64
|
+
}, [onClick]);
|
|
65
|
+
const handleOnKeyDown = (event) => {
|
|
66
|
+
const { key } = event;
|
|
67
|
+
if (!DEFAULT_KEYS.has(key)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
switch (key) {
|
|
72
|
+
case ESCAPE_KEY: {
|
|
73
|
+
if (isMenuOpen) {
|
|
74
|
+
setIsMenuOpen(false);
|
|
75
|
+
setActiveOption(null);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
handleOnClear();
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case ENTER_KEY: {
|
|
83
|
+
if (!activeOption) {
|
|
84
|
+
if (isFunction(onSubmit)) {
|
|
85
|
+
onSubmit(composedValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const { label } = activeOption;
|
|
90
|
+
if (!isControlled) {
|
|
91
|
+
setInternalValue(label);
|
|
92
|
+
}
|
|
93
|
+
if (isFunction(onSelect)) {
|
|
94
|
+
onSelect(activeOption);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
setIsMenuOpen(false);
|
|
98
|
+
setActiveOption(null);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case ARROW_DOWN: {
|
|
102
|
+
if (filteredOptions.length <= 0) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
setIsMenuOpen(true);
|
|
106
|
+
const newActiveIndex = activeIndex >= filteredOptions.length - 1 ? 0 : activeIndex + 1;
|
|
107
|
+
setActiveOption(filteredOptions[newActiveIndex]);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case ARROW_UP: {
|
|
111
|
+
if (filteredOptions.length <= 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
setIsMenuOpen(true);
|
|
115
|
+
const newActiveIndex = activeIndex <= 0 ? filteredOptions.length - 1 : activeIndex - 1;
|
|
116
|
+
setActiveOption(filteredOptions[newActiveIndex]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
// The window will scroll down to the right place to show the whole menu
|
|
121
|
+
// if space is not enough in current viewport
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
const autocompleteElement = document.getElementById(autocompleteId);
|
|
124
|
+
const menuElement = document.getElementById(menuId);
|
|
125
|
+
if (menuElement && isMenuOpen && autocompleteElement) {
|
|
126
|
+
const { bottom } = menuElement.getBoundingClientRect();
|
|
127
|
+
const { offsetParent, offsetTop } = autocompleteElement;
|
|
128
|
+
if (offsetParent === document.body &&
|
|
129
|
+
bottom > document.documentElement.clientHeight) {
|
|
130
|
+
window.scrollTo({
|
|
131
|
+
top: Math.min(bottom -
|
|
132
|
+
document.documentElement.clientHeight +
|
|
133
|
+
window.scrollY +
|
|
134
|
+
20, // Add 20 gap between menu bottom and window viewport bottom
|
|
135
|
+
offsetTop),
|
|
136
|
+
behavior: 'smooth',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [autocompleteId, isMenuOpen, menuId]);
|
|
141
|
+
// This will make the menu able to scroll with keyboard,
|
|
142
|
+
// and scroll each option into window viewport if necessary
|
|
143
|
+
React.useEffect(() => {
|
|
144
|
+
const listboxElement = document.getElementById(listboxId);
|
|
145
|
+
const activeOptionElement = strHasLength(activeOptionId)
|
|
146
|
+
? document.getElementById(activeOptionId)
|
|
147
|
+
: null;
|
|
148
|
+
if (activeOptionElement && listboxElement) {
|
|
149
|
+
const { scrollTop, clientHeight } = listboxElement;
|
|
150
|
+
const { offsetHeight, offsetTop } = activeOptionElement;
|
|
151
|
+
const { top, bottom } = activeOptionElement.getBoundingClientRect();
|
|
152
|
+
if (scrollTop > offsetTop) {
|
|
153
|
+
listboxElement.scrollTop = offsetTop;
|
|
154
|
+
}
|
|
155
|
+
if (scrollTop + clientHeight < offsetTop + offsetHeight) {
|
|
156
|
+
listboxElement.scrollTop = offsetTop + offsetHeight - clientHeight;
|
|
157
|
+
}
|
|
158
|
+
if (top < 0 || bottom > document.documentElement.clientHeight) {
|
|
159
|
+
activeOptionElement.scrollIntoView({
|
|
160
|
+
behavior: 'smooth',
|
|
161
|
+
block: 'nearest',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, [activeOptionId, listboxId]);
|
|
166
|
+
return {
|
|
167
|
+
activeOptionId,
|
|
168
|
+
autocompleteId,
|
|
169
|
+
composedValue,
|
|
170
|
+
filteredOptions,
|
|
171
|
+
handleOnBlur,
|
|
172
|
+
handleOnClear,
|
|
173
|
+
handleOnClick,
|
|
174
|
+
handleOnChange,
|
|
175
|
+
handleOnKeyDown,
|
|
176
|
+
isControlled,
|
|
177
|
+
isCustomFiltering,
|
|
178
|
+
isMenuOpen,
|
|
179
|
+
listboxId,
|
|
180
|
+
menuId,
|
|
181
|
+
optionBaseId,
|
|
182
|
+
setActiveOption,
|
|
183
|
+
setIsMenuOpen,
|
|
184
|
+
setInternalValue,
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export { useAutocomplete };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { View } from '../View/View.mjs';
|
|
5
|
+
|
|
6
|
+
const BadgePrimitive = ({ className, children, variation, size, ...rest }, ref) => {
|
|
7
|
+
const componentClasses = classNames(ComponentClassName.Badge, className, classNameModifier(ComponentClassName.Badge, variation), classNameModifier(ComponentClassName.Badge, size));
|
|
8
|
+
return (React.createElement(View, { as: "span", className: componentClasses, ref: ref, ...rest }, children));
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/badge)
|
|
12
|
+
*/
|
|
13
|
+
const Badge = primitiveWithForwardRef(BadgePrimitive);
|
|
14
|
+
Badge.displayName = 'Badge';
|
|
15
|
+
|
|
16
|
+
export { Badge };
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { View } from '../View/View.mjs';
|
|
5
|
+
|
|
6
|
+
const BreadcrumbContainerPrimitive = ({ className, children, ...rest }, ref) => {
|
|
7
|
+
const componentClasses = classNames(ComponentClassName.Breadcrumbs, className);
|
|
8
|
+
const ariaLabel = rest['aria-label'] ?? 'Breadcrumb';
|
|
9
|
+
return (React.createElement(View, { ...rest, as: "nav", "aria-label": ariaLabel, className: componentClasses, ref: ref },
|
|
10
|
+
React.createElement(View, { as: "ol", className: ComponentClassName.BreadcrumbsList }, children)));
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
14
|
+
*/
|
|
15
|
+
const BreadcrumbContainer = primitiveWithForwardRef(BreadcrumbContainerPrimitive);
|
|
16
|
+
BreadcrumbContainer.displayName = 'Breadcrumbs.Container';
|
|
17
|
+
|
|
18
|
+
export { BreadcrumbContainer };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { View } from '../View/View.mjs';
|
|
5
|
+
|
|
6
|
+
const BreadcrumbItemPrimitive = ({ className, children, as = 'li', ...rest }, ref) => {
|
|
7
|
+
const componentClasses = classNames(ComponentClassName.BreadcrumbsItem, className);
|
|
8
|
+
return (React.createElement(View, { ...rest, as: as, className: componentClasses, ref: ref }, children));
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
12
|
+
*/
|
|
13
|
+
const BreadcrumbItem = primitiveWithForwardRef(BreadcrumbItemPrimitive);
|
|
14
|
+
BreadcrumbItem.displayName = 'Breadcrumbs.Item';
|
|
15
|
+
|
|
16
|
+
export { BreadcrumbItem };
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName, classNameModifierByFlag } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { Link } from '../Link/Link.mjs';
|
|
5
|
+
import { Text } from '../Text/Text.mjs';
|
|
6
|
+
|
|
7
|
+
const BreadcrumbLinkPrimitive = ({ className, children, href, isCurrent, ...rest }, ref) => {
|
|
8
|
+
const componentClasses = classNames(ComponentClassName.BreadcrumbsLink, classNameModifierByFlag(ComponentClassName.BreadcrumbsLink, 'current', isCurrent), className);
|
|
9
|
+
if (isCurrent) {
|
|
10
|
+
const ariaCurrent = rest['aria-current'] ?? 'page';
|
|
11
|
+
const as = rest.as ?? 'span';
|
|
12
|
+
return (React.createElement(Text, { ...rest, as: as, "aria-current": ariaCurrent, className: componentClasses, ref: ref }, children));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return (React.createElement(Link, { ...rest, className: componentClasses, ref: ref, href: href }, children));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
20
|
+
*/
|
|
21
|
+
const BreadcrumbLink = primitiveWithForwardRef(BreadcrumbLinkPrimitive);
|
|
22
|
+
BreadcrumbLink.displayName = 'Breadcrumbs.Link';
|
|
23
|
+
|
|
24
|
+
export { BreadcrumbLink };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { View } from '../View/View.mjs';
|
|
5
|
+
|
|
6
|
+
const BreadcrumbSeparatorPrimitive = ({ className, children = '/', as = 'span', ...rest }, ref) => {
|
|
7
|
+
const ariaHidden = rest['aria-hidden'] ?? 'true';
|
|
8
|
+
return (React.createElement(View, { ...rest, as: as, ref: ref, "aria-hidden": ariaHidden, className: classNames(ComponentClassName.BreadcrumbsSeparator, className) }, children));
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
12
|
+
*/
|
|
13
|
+
const BreadcrumbSeparator = primitiveWithForwardRef(BreadcrumbSeparatorPrimitive);
|
|
14
|
+
BreadcrumbSeparator.displayName = 'Breadcrumbs.Separator';
|
|
15
|
+
|
|
16
|
+
export { BreadcrumbSeparator };
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
3
|
+
import { BreadcrumbItem } from './BreadcrumbItem.mjs';
|
|
4
|
+
import { BreadcrumbLink } from './BreadcrumbLink.mjs';
|
|
5
|
+
import { BreadcrumbSeparator } from './BreadcrumbSeparator.mjs';
|
|
6
|
+
import { BreadcrumbContainer } from './BreadcrumbContainer.mjs';
|
|
7
|
+
|
|
8
|
+
const BreadcrumbsPrimitive = ({ className, items, separator = React.createElement(BreadcrumbSeparator, null), ...rest }, ref) => {
|
|
9
|
+
const ariaLabel = rest['aria-label'] ?? 'Breadcrumb';
|
|
10
|
+
return (React.createElement(BreadcrumbContainer, { ...rest, "aria-label": ariaLabel, className: className, ref: ref }, items?.map(({ href, label }, idx) => {
|
|
11
|
+
const isCurrent = items.length - 1 === idx;
|
|
12
|
+
return (React.createElement(BreadcrumbItem, { key: `${href}${idx}` },
|
|
13
|
+
React.createElement(BreadcrumbLink, { href: href, isCurrent: isCurrent }, label),
|
|
14
|
+
isCurrent ? null : separator));
|
|
15
|
+
})));
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
19
|
+
*/
|
|
20
|
+
const Breadcrumbs = Object.assign(primitiveWithForwardRef(BreadcrumbsPrimitive), {
|
|
21
|
+
Item: BreadcrumbItem,
|
|
22
|
+
Link: BreadcrumbLink,
|
|
23
|
+
Separator: BreadcrumbSeparator,
|
|
24
|
+
Container: BreadcrumbContainer,
|
|
25
|
+
});
|
|
26
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
27
|
+
|
|
28
|
+
export { Breadcrumbs };
|
|
@@ -1 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { useFieldset } from '../Fieldset/useFieldset.mjs';
|
|
5
|
+
import { Flex } from '../Flex/Flex.mjs';
|
|
6
|
+
import { Loader } from '../Loader/Loader.mjs';
|
|
7
|
+
import { View } from '../View/View.mjs';
|
|
8
|
+
|
|
9
|
+
// These variations support colorThemes. 'undefined' accounts for our
|
|
10
|
+
// 'default' variation which is not named.
|
|
11
|
+
const supportedVariations = ['link', 'primary', undefined];
|
|
12
|
+
const ButtonPrimitive = ({ className, children, colorTheme, isFullWidth = false, isDisabled, isLoading, loadingText = '', size, type = 'button', variation, ...rest }, ref) => {
|
|
13
|
+
// Creates our colorTheme modifier string based on if the variation
|
|
14
|
+
// supports colorThemes and a colorTheme is used.
|
|
15
|
+
const colorThemeModifier = supportedVariations.includes(variation) && colorTheme
|
|
16
|
+
? `${variation ?? 'outlined'}--${colorTheme}`
|
|
17
|
+
: undefined;
|
|
18
|
+
const { isFieldsetDisabled } = useFieldset();
|
|
19
|
+
const shouldBeDisabled = isFieldsetDisabled
|
|
20
|
+
? isFieldsetDisabled
|
|
21
|
+
: isDisabled ?? isLoading ?? rest['disabled'];
|
|
22
|
+
const componentClasses = classNames(ComponentClassName.Button, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Button, variation), classNameModifier(ComponentClassName.Button, colorThemeModifier), classNameModifier(ComponentClassName.Button, size), classNameModifierByFlag(ComponentClassName.Button, 'disabled', shouldBeDisabled), classNameModifierByFlag(ComponentClassName.Button, 'loading', isLoading), classNameModifierByFlag(ComponentClassName.Button, 'fullwidth', isFullWidth), className);
|
|
23
|
+
return (React.createElement(View, { ref: ref, as: "button", className: componentClasses, isDisabled: shouldBeDisabled, type: type, ...rest }, isLoading ? (React.createElement(Flex, { as: "span", className: ComponentClassName.ButtonLoaderWrapper },
|
|
24
|
+
React.createElement(Loader, { size: size }),
|
|
25
|
+
loadingText ? loadingText : null)) : (children)));
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/button)
|
|
29
|
+
*/
|
|
30
|
+
const Button = primitiveWithForwardRef(ButtonPrimitive);
|
|
31
|
+
Button.displayName = 'Button';
|
|
32
|
+
|
|
33
|
+
export { Button };
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { classNames, ComponentClassName } from '@aws-amplify/ui';
|
|
3
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
4
|
+
import { Flex } from '../Flex/Flex.mjs';
|
|
5
|
+
|
|
6
|
+
const ButtonGroupPrimitive = ({ className, children, role = 'group', size: _size, variation: _variation, ...rest }, ref) => (React.createElement(Flex, { className: classNames(ComponentClassName.ButtonGroup, className), role: role, ref: ref, ...rest }, React.Children.map(children, (child) => {
|
|
7
|
+
if (React.isValidElement(child)) {
|
|
8
|
+
const { size = _size, variation = _variation } = child.props;
|
|
9
|
+
return React.cloneElement(child, { size, variation });
|
|
10
|
+
}
|
|
11
|
+
return child;
|
|
12
|
+
})));
|
|
13
|
+
/**
|
|
14
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/button#buttongroup)
|
|
15
|
+
*/
|
|
16
|
+
const ButtonGroup = primitiveWithForwardRef(ButtonGroupPrimitive);
|
|
17
|
+
ButtonGroup.displayName = 'ButtonGroup';
|
|
18
|
+
|
|
19
|
+
export { ButtonGroup };
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { View } from '../View/View.mjs';
|
|
4
|
+
import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
|
|
5
|
+
|
|
6
|
+
const CardPrimitive = ({ className, children, variation, ...rest }, ref) => {
|
|
7
|
+
return (React.createElement(View, { className: classNames(ComponentClassName.Card, classNameModifier(ComponentClassName.Card, variation), className), ref: ref, ...rest }, children));
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* [📖 Docs](https://ui.docs.amplify.aws/react/components/card)
|
|
11
|
+
*/
|
|
12
|
+
const Card = primitiveWithForwardRef(CardPrimitive);
|
|
13
|
+
Card.displayName = 'Card';
|
|
14
|
+
|
|
15
|
+
export { Card };
|