@aws-amplify/ui 5.8.1 → 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/esm/helpers/accountSettings/utils.mjs +33 -1
- package/dist/esm/helpers/accountSettings/validator.mjs +120 -1
- package/dist/esm/helpers/authenticator/actor.mjs +20 -1
- package/dist/esm/helpers/authenticator/constants.mjs +144 -1
- package/dist/esm/helpers/authenticator/defaultAuthHubHandler.mjs +52 -0
- package/dist/esm/helpers/authenticator/facade.mjs +137 -1
- package/dist/esm/helpers/authenticator/form.mjs +43 -1
- package/dist/esm/helpers/authenticator/formFields/defaults.mjs +132 -1
- package/dist/esm/helpers/authenticator/formFields/formFields.mjs +62 -1
- package/dist/esm/helpers/authenticator/formFields/utils.mjs +35 -0
- package/dist/esm/helpers/authenticator/getRoute.mjs +47 -0
- package/dist/esm/helpers/authenticator/textUtil.mjs +112 -1
- package/dist/esm/helpers/authenticator/utils.mjs +38 -1
- package/dist/esm/helpers/utils.mjs +5 -1
- package/dist/esm/i18n/country-dial-codes.mjs +210 -1
- package/dist/esm/i18n/dictionaries/authenticator/de.mjs +87 -1
- package/dist/esm/i18n/dictionaries/authenticator/defaultTexts.mjs +83 -1
- package/dist/esm/i18n/dictionaries/authenticator/en.mjs +74 -1
- package/dist/esm/i18n/dictionaries/authenticator/es.mjs +83 -1
- package/dist/esm/i18n/dictionaries/authenticator/fr.mjs +92 -1
- package/dist/esm/i18n/dictionaries/authenticator/he.mjs +54 -1
- package/dist/esm/i18n/dictionaries/authenticator/id.mjs +96 -1
- package/dist/esm/i18n/dictionaries/authenticator/it.mjs +82 -1
- package/dist/esm/i18n/dictionaries/authenticator/ja.mjs +86 -1
- package/dist/esm/i18n/dictionaries/authenticator/kr.mjs +71 -1
- package/dist/esm/i18n/dictionaries/authenticator/nb.mjs +95 -1
- package/dist/esm/i18n/dictionaries/authenticator/nl.mjs +67 -1
- package/dist/esm/i18n/dictionaries/authenticator/pl.mjs +71 -1
- package/dist/esm/i18n/dictionaries/authenticator/pt.mjs +61 -1
- package/dist/esm/i18n/dictionaries/authenticator/ru.mjs +61 -1
- package/dist/esm/i18n/dictionaries/authenticator/sv.mjs +82 -1
- package/dist/esm/i18n/dictionaries/authenticator/tr.mjs +76 -1
- package/dist/esm/i18n/dictionaries/authenticator/ua.mjs +84 -1
- package/dist/esm/i18n/dictionaries/authenticator/zh.mjs +74 -1
- package/dist/esm/i18n/dictionaries/index.mjs +47 -1
- package/dist/esm/i18n/translations.mjs +67 -1
- package/dist/esm/index.mjs +28 -1
- package/dist/esm/machines/authenticator/actions.mjs +188 -1
- package/dist/esm/machines/authenticator/actors/forgotPassword.mjs +184 -0
- package/dist/esm/machines/authenticator/actors/signIn.mjs +328 -1
- package/dist/esm/machines/authenticator/actors/signOut.mjs +28 -1
- package/dist/esm/machines/authenticator/actors/signUp.mjs +295 -0
- package/dist/esm/machines/authenticator/actors/verifyUserAttributes.mjs +106 -0
- package/dist/esm/machines/authenticator/defaultServices.mjs +102 -1
- package/dist/esm/machines/authenticator/guards.mjs +70 -0
- package/dist/esm/machines/authenticator/index.mjs +368 -1
- package/dist/esm/machines/authenticator/utils.mjs +71 -0
- package/dist/esm/theme/breakpoints.mjs +14 -1
- package/dist/esm/theme/createTheme.mjs +156 -1
- package/dist/esm/theme/defaultDarkModeOverride.mjs +128 -1
- package/dist/esm/theme/defaultTheme.mjs +10 -1
- package/dist/esm/theme/tokens/borderWidths.mjs +7 -1
- package/dist/esm/theme/tokens/colors.mjs +166 -1
- package/dist/esm/theme/tokens/components/accordion.mjs +47 -0
- package/dist/esm/theme/tokens/components/alert.mjs +35 -1
- package/dist/esm/theme/tokens/components/authenticator.mjs +39 -1
- package/dist/esm/theme/tokens/components/autocomplete.mjs +42 -1
- package/dist/esm/theme/tokens/components/badge.mjs +44 -1
- package/dist/esm/theme/tokens/components/breadcrumbs.mjs +34 -1
- package/dist/esm/theme/tokens/components/button.mjs +685 -1
- package/dist/esm/theme/tokens/components/card.mjs +27 -1
- package/dist/esm/theme/tokens/components/checkbox.mjs +87 -1
- package/dist/esm/theme/tokens/components/checkboxField.mjs +8 -1
- package/dist/esm/theme/tokens/components/collection.mjs +72 -1
- package/dist/esm/theme/tokens/components/copy.mjs +18 -1
- package/dist/esm/theme/tokens/components/dialCodeSelect.mjs +7 -1
- package/dist/esm/theme/tokens/components/divider.mjs +22 -1
- package/dist/esm/theme/tokens/components/dropZone.mjs +46 -1
- package/dist/esm/theme/tokens/components/field.mjs +20 -1
- package/dist/esm/theme/tokens/components/fieldControl.mjs +131 -1
- package/dist/esm/theme/tokens/components/fieldGroup.mjs +11 -1
- package/dist/esm/theme/tokens/components/fieldMessages.mjs +13 -1
- package/dist/esm/theme/tokens/components/fieldset.mjs +40 -1
- package/dist/esm/theme/tokens/components/flex.mjs +9 -1
- package/dist/esm/theme/tokens/components/heading.mjs +30 -1
- package/dist/esm/theme/tokens/components/highlightMatch.mjs +7 -1
- package/dist/esm/theme/tokens/components/icon.mjs +6 -1
- package/dist/esm/theme/tokens/components/image.mjs +8 -1
- package/dist/esm/theme/tokens/components/inAppMessaging.mjs +23 -1
- package/dist/esm/theme/tokens/components/index.mjs +111 -1
- package/dist/esm/theme/tokens/components/input.mjs +12 -1
- package/dist/esm/theme/tokens/components/link.mjs +9 -1
- package/dist/esm/theme/tokens/components/liveness.mjs +7 -1
- package/dist/esm/theme/tokens/components/loader.mjs +42 -1
- package/dist/esm/theme/tokens/components/menu.mjs +27 -1
- package/dist/esm/theme/tokens/components/message.mjs +102 -1
- package/dist/esm/theme/tokens/components/pagination.mjs +40 -1
- package/dist/esm/theme/tokens/components/passwordField.mjs +38 -1
- package/dist/esm/theme/tokens/components/phoneNumberField.mjs +10 -1
- package/dist/esm/theme/tokens/components/placeholder.mjs +18 -1
- package/dist/esm/theme/tokens/components/radio.mjs +67 -1
- package/dist/esm/theme/tokens/components/radioGroup.mjs +19 -1
- package/dist/esm/theme/tokens/components/rating.mjs +9 -1
- package/dist/esm/theme/tokens/components/searchField.mjs +39 -1
- package/dist/esm/theme/tokens/components/select.mjs +63 -1
- package/dist/esm/theme/tokens/components/selectField.mjs +16 -1
- package/dist/esm/theme/tokens/components/sliderField.mjs +70 -1
- package/dist/esm/theme/tokens/components/stepperField.mjs +33 -1
- package/dist/esm/theme/tokens/components/storagemanager.mjs +97 -1
- package/dist/esm/theme/tokens/components/switchField.mjs +61 -1
- package/dist/esm/theme/tokens/components/table.mjs +105 -1
- package/dist/esm/theme/tokens/components/tabs.mjs +59 -1
- package/dist/esm/theme/tokens/components/text.mjs +28 -1
- package/dist/esm/theme/tokens/components/textAreaField.mjs +11 -1
- package/dist/esm/theme/tokens/components/textField.mjs +12 -1
- package/dist/esm/theme/tokens/components/toggleButton.mjs +96 -1
- package/dist/esm/theme/tokens/components/toggleButtonGroup.mjs +7 -1
- package/dist/esm/theme/tokens/fontSizes.mjs +14 -1
- package/dist/esm/theme/tokens/fontWeights.mjs +13 -1
- package/dist/esm/theme/tokens/fonts.mjs +19 -1
- package/dist/esm/theme/tokens/index.mjs +65 -1
- package/dist/esm/theme/tokens/lineHeights.mjs +7 -1
- package/dist/esm/theme/tokens/opacities.mjs +15 -1
- package/dist/esm/theme/tokens/outlineOffsets.mjs +7 -1
- package/dist/esm/theme/tokens/outlineWidths.mjs +7 -1
- package/dist/esm/theme/tokens/radii.mjs +11 -1
- package/dist/esm/theme/tokens/shadows.mjs +28 -1
- package/dist/esm/theme/tokens/space.mjs +29 -1
- package/dist/esm/theme/tokens/time.mjs +7 -1
- package/dist/esm/theme/tokens/transforms.mjs +10 -1
- package/dist/esm/theme/utils.mjs +81 -1
- package/dist/esm/types/authenticator/attributes.mjs +41 -1
- package/dist/esm/types/authenticator/user.mjs +18 -1
- package/dist/esm/types/authenticator/utils.mjs +5 -1
- package/dist/esm/types/primitives/componentClassName.mjs +164 -1
- package/dist/esm/utils/classNames.mjs +39 -0
- package/dist/esm/utils/setUserAgent/constants.mjs +43 -0
- package/dist/esm/utils/setUserAgent/setUserAgent.mjs +65 -0
- package/dist/esm/utils/utils.mjs +227 -0
- package/dist/esm/validators/index.mjs +19 -1
- package/dist/index.js +8396 -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 +298 -684
- package/dist/styles.layer.css +6115 -0
- package/dist/theme.css +93 -156
- package/dist/types/helpers/accountSettings/utils.d.ts +1 -3
- package/dist/types/helpers/authenticator/actor.d.ts +1 -1
- package/dist/types/helpers/authenticator/constants.d.ts +5 -0
- package/dist/types/helpers/authenticator/defaultAuthHubHandler.d.ts +15 -0
- package/dist/types/helpers/authenticator/facade.d.ts +35 -6
- package/dist/types/helpers/authenticator/formFields/defaults.d.ts +3 -1
- package/dist/types/helpers/authenticator/formFields/formFields.d.ts +2 -1
- package/dist/types/helpers/authenticator/formFields/index.d.ts +1 -1
- package/dist/types/helpers/authenticator/formFields/{util.d.ts → utils.d.ts} +2 -0
- package/dist/types/helpers/authenticator/getRoute.d.ts +2 -0
- package/dist/types/helpers/authenticator/index.d.ts +2 -1
- package/dist/types/helpers/authenticator/textUtil.d.ts +8 -7
- package/dist/types/{types/authenticator/stateMachine/authMachine.d.ts → helpers/authenticator/types.d.ts} +5 -5
- package/dist/types/helpers/authenticator/utils.d.ts +0 -25
- package/dist/types/helpers/index.d.ts +0 -1
- package/dist/types/helpers/utils.d.ts +2 -2
- package/dist/types/i18n/translations.d.ts +2 -3
- package/dist/types/machines/authenticator/actions.d.ts +4 -62
- package/dist/types/machines/authenticator/actors/{resetPassword.d.ts → forgotPassword.d.ts} +3 -3
- package/dist/types/machines/authenticator/actors/index.d.ts +3 -1
- package/dist/types/machines/authenticator/actors/signIn.d.ts +3 -3
- package/dist/types/machines/authenticator/actors/signOut.d.ts +2 -2
- package/dist/types/machines/authenticator/{signUp.d.ts → actors/signUp.d.ts} +3 -3
- package/dist/types/machines/authenticator/actors/verifyUserAttributes.d.ts +5 -0
- package/dist/types/machines/authenticator/defaultServices.d.ts +208 -28
- package/dist/types/machines/authenticator/getAuthenticatorConfig.d.ts +14 -0
- package/dist/types/machines/authenticator/guards.d.ts +4 -0
- package/dist/types/machines/authenticator/index.d.ts +4 -2
- package/dist/types/machines/authenticator/types.d.ts +125 -0
- package/dist/types/machines/authenticator/utils.d.ts +7 -0
- package/dist/types/machines/index.d.ts +1 -0
- package/dist/types/theme/tokens/borderWidths.d.ts +2 -2
- package/dist/types/theme/tokens/colors.d.ts +7 -9
- package/dist/types/theme/tokens/components/accordion.d.ts +12 -0
- package/dist/types/theme/tokens/components/index.d.ts +2 -4
- package/dist/types/theme/tokens/components/radioGroup.d.ts +1 -1
- package/dist/types/theme/tokens/components/storagemanager.d.ts +18 -3
- package/dist/types/theme/tokens/components/tabs.d.ts +4 -3
- package/dist/types/theme/tokens/fontSizes.d.ts +2 -2
- package/dist/types/theme/tokens/fontWeights.d.ts +2 -2
- package/dist/types/theme/tokens/fonts.d.ts +2 -2
- package/dist/types/theme/tokens/lineHeights.d.ts +2 -2
- package/dist/types/theme/tokens/opacities.d.ts +2 -2
- package/dist/types/theme/tokens/outlineOffsets.d.ts +2 -2
- package/dist/types/theme/tokens/outlineWidths.d.ts +2 -2
- package/dist/types/theme/tokens/radii.d.ts +2 -2
- package/dist/types/theme/tokens/shadows.d.ts +2 -2
- package/dist/types/theme/tokens/space.d.ts +2 -2
- package/dist/types/theme/tokens/time.d.ts +2 -2
- package/dist/types/theme/tokens/types/designToken.d.ts +12 -6
- package/dist/types/theme/types.d.ts +5 -1
- package/dist/types/types/authenticator/attributes.d.ts +10 -4
- package/dist/types/types/authenticator/form.d.ts +7 -6
- package/dist/types/types/authenticator/index.d.ts +0 -1
- package/dist/types/types/authenticator/user.d.ts +3 -29
- package/dist/types/types/authenticator/validator.d.ts +2 -2
- package/dist/types/types/displayText.d.ts +84 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/primitives/componentClassName.d.ts +162 -180
- package/dist/types/types/util.d.ts +0 -5
- package/dist/types/utils/classNames.d.ts +4 -0
- package/dist/types/utils/index.d.ts +3 -135
- package/dist/types/utils/setUserAgent/constants.d.ts +7 -0
- package/dist/types/utils/setUserAgent/index.d.ts +1 -0
- package/dist/types/utils/setUserAgent/setUserAgent.d.ts +19 -0
- package/dist/types/utils/utils.d.ts +147 -0
- package/dist/types/validators/index.d.ts +2 -2
- package/package.json +5 -19
- package/dist/esm/helpers/authenticator/context.mjs +0 -1
- package/dist/esm/helpers/authenticator/formFields/util.mjs +0 -1
- package/dist/esm/helpers/storage/fileUploader/utils/uploader.mjs +0 -1
- package/dist/esm/machines/authenticator/actors/resetPassword.mjs +0 -1
- package/dist/esm/machines/authenticator/signUp.mjs +0 -1
- package/dist/esm/theme/tokens/components/expander.mjs +0 -1
- package/dist/esm/theme/tokens/components/fileUploader.mjs +0 -1
- package/dist/esm/utils/index.mjs +0 -1
- package/dist/types/helpers/authenticator/context.d.ts +0 -13
- package/dist/types/helpers/storage/fileUploader/index.d.ts +0 -1
- package/dist/types/helpers/storage/fileUploader/utils/index.d.ts +0 -1
- package/dist/types/helpers/storage/fileUploader/utils/uploader.d.ts +0 -28
- package/dist/types/helpers/storage/index.d.ts +0 -1
- package/dist/types/theme/tokens/components/expander.d.ts +0 -22
- package/dist/types/theme/tokens/components/fileUploader.d.ts +0 -23
- package/dist/types/types/authenticator/stateMachine/context.d.ts +0 -109
- package/dist/types/types/authenticator/stateMachine/event.d.ts +0 -17
- package/dist/types/types/authenticator/stateMachine/index.d.ts +0 -4
- package/dist/types/types/authenticator/stateMachine/state.d.ts +0 -10
|
@@ -1 +1,164 @@
|
|
|
1
|
-
|
|
1
|
+
const ComponentClassName = {
|
|
2
|
+
Accordion: 'amplify-accordion',
|
|
3
|
+
AccordionItem: 'amplify-accordion__item',
|
|
4
|
+
AccordionItemTrigger: 'amplify-accordion__item__trigger',
|
|
5
|
+
AccordionItemContent: 'amplify-accordion__item__content',
|
|
6
|
+
AccordionItemIcon: 'amplify-accordion__item__icon',
|
|
7
|
+
Alert: 'amplify-alert',
|
|
8
|
+
AlertIcon: 'amplify-alert__icon',
|
|
9
|
+
AlertHeading: 'amplify-alert__heading',
|
|
10
|
+
AlertBody: 'amplify-alert__body',
|
|
11
|
+
AlertDismiss: 'amplify-alert__dismiss',
|
|
12
|
+
Autocomplete: 'amplify-autocomplete',
|
|
13
|
+
AutocompleteMenu: 'amplify-autocomplete__menu',
|
|
14
|
+
AutocompleteMenuEmpty: 'amplify-autocomplete__menu--empty',
|
|
15
|
+
AutocompleteMenuFooter: 'amplify-autocomplete__menu__footer',
|
|
16
|
+
AutocompleteMenuHeader: 'amplify-autocomplete__menu__header',
|
|
17
|
+
AutocompleteMenuLoading: 'amplify-autocomplete__menu--loading',
|
|
18
|
+
AutocompleteMenuOption: 'amplify-autocomplete__menu__option',
|
|
19
|
+
AutocompleteMenuOptions: 'amplify-autocomplete__menu__options',
|
|
20
|
+
Badge: 'amplify-badge',
|
|
21
|
+
Breadcrumbs: 'amplify-breadcrumbs',
|
|
22
|
+
BreadcrumbsList: 'amplify-breadcrumbs__list',
|
|
23
|
+
BreadcrumbsItem: 'amplify-breadcrumbs__item',
|
|
24
|
+
BreadcrumbsSeparator: 'amplify-breadcrumbs__separator',
|
|
25
|
+
BreadcrumbsLink: 'amplify-breadcrumbs__link',
|
|
26
|
+
Button: 'amplify-button',
|
|
27
|
+
ButtonGroup: 'amplify-buttongroup',
|
|
28
|
+
ButtonLoaderWrapper: 'amplify-button__loader-wrapper',
|
|
29
|
+
Card: 'amplify-card',
|
|
30
|
+
Checkbox: 'amplify-checkbox',
|
|
31
|
+
CheckboxButton: 'amplify-checkbox__button',
|
|
32
|
+
CheckboxIcon: 'amplify-checkbox__icon',
|
|
33
|
+
CheckboxInput: 'amplify-checkbox__input',
|
|
34
|
+
CheckboxLabel: 'amplify-checkbox__label',
|
|
35
|
+
CheckboxField: 'amplify-checkboxfield',
|
|
36
|
+
Collection: 'amplify-collection',
|
|
37
|
+
CollectionItems: 'amplify-collection-items',
|
|
38
|
+
CollectionSearch: 'amplify-collection-search',
|
|
39
|
+
CollectionPagination: 'amplify-collection-pagination',
|
|
40
|
+
CountryCodeSelect: 'amplify-countrycodeselect',
|
|
41
|
+
DialCodeSelect: 'amplify-dialcodeselect',
|
|
42
|
+
Divider: 'amplify-divider',
|
|
43
|
+
DividerLabel: 'amplify-divider--label',
|
|
44
|
+
DropZone: 'amplify-dropzone',
|
|
45
|
+
Field: 'amplify-field',
|
|
46
|
+
FieldDescription: 'amplify-field__description',
|
|
47
|
+
FieldErrorMessage: 'amplify-field__error-message',
|
|
48
|
+
FieldGroup: 'amplify-field-group',
|
|
49
|
+
FieldGroupControl: 'amplify-field-group__control',
|
|
50
|
+
FieldGroupOuterEnd: 'amplify-field-group__outer-end',
|
|
51
|
+
FieldGroupOuterStart: 'amplify-field-group__outer-start',
|
|
52
|
+
FieldGroupInnerEnd: 'amplify-field-group__inner-end',
|
|
53
|
+
FieldGroupInnerStart: 'amplify-field-group__inner-start',
|
|
54
|
+
FieldGroupIcon: 'amplify-field-group__icon',
|
|
55
|
+
FieldGroupIconButton: 'amplify-field-group__icon-button',
|
|
56
|
+
FieldGroupHasInnerEnd: 'amplify-field-group--has-inner-end',
|
|
57
|
+
FieldGroupHasInnerStart: 'amplify-field-group--has-inner-start',
|
|
58
|
+
FieldShowPassword: 'amplify-field__show-password',
|
|
59
|
+
FieldGroupFieldWrapper: 'amplify-field-group__field-wrapper',
|
|
60
|
+
Fieldset: 'amplify-fieldset',
|
|
61
|
+
FieldsetLegend: 'amplify-fieldset__legend',
|
|
62
|
+
Flex: 'amplify-flex',
|
|
63
|
+
Grid: 'amplify-grid',
|
|
64
|
+
Heading: 'amplify-heading',
|
|
65
|
+
HighlightMatch: 'amplify-highlightmatch',
|
|
66
|
+
HighlightMatchHighlighted: 'amplify-highlightmatch__highlighted',
|
|
67
|
+
Icon: 'amplify-icon',
|
|
68
|
+
Image: 'amplify-image',
|
|
69
|
+
Input: 'amplify-input',
|
|
70
|
+
Label: 'amplify-label',
|
|
71
|
+
Link: 'amplify-link',
|
|
72
|
+
Loader: 'amplify-loader',
|
|
73
|
+
LoaderLabel: 'amplify-loader__label',
|
|
74
|
+
MenuContent: 'amplify-menu__content',
|
|
75
|
+
MenuItem: 'amplify-menu__content__item',
|
|
76
|
+
MenuTrigger: 'amplify-menu__trigger',
|
|
77
|
+
MenuWrapper: 'amplify-menu__wrapper',
|
|
78
|
+
Message: 'amplify-message',
|
|
79
|
+
MessageIcon: 'amplify-message__icon',
|
|
80
|
+
MessageHeading: 'amplify-message__heading',
|
|
81
|
+
MessageBody: 'amplify-message__body',
|
|
82
|
+
MessageContent: 'amplify-message__content',
|
|
83
|
+
MessageDismiss: 'amplify-message__dismiss',
|
|
84
|
+
Pagination: 'amplify-pagination',
|
|
85
|
+
PaginationItem: 'amplify-pagination__item',
|
|
86
|
+
PasswordField: 'amplify-passwordfield',
|
|
87
|
+
PhoneNumberField: 'amplify-phonenumberfield',
|
|
88
|
+
Placeholder: 'amplify-placeholder',
|
|
89
|
+
Radio: 'amplify-radio',
|
|
90
|
+
RadioButton: 'amplify-radio__button',
|
|
91
|
+
RadioInput: 'amplify-radio__input',
|
|
92
|
+
RadioLabel: 'amplify-radio__label',
|
|
93
|
+
RadioGroupField: 'amplify-radiogroupfield',
|
|
94
|
+
RadioGroup: 'amplify-radiogroup',
|
|
95
|
+
Rating: 'amplify-rating',
|
|
96
|
+
RatingItem: 'amplify-rating__item',
|
|
97
|
+
RatingIcon: 'amplify-rating__icon',
|
|
98
|
+
RatingLabel: 'amplify-rating__label',
|
|
99
|
+
ScrollView: 'amplify-scrollview',
|
|
100
|
+
SearchField: 'amplify-searchfield',
|
|
101
|
+
SearchFieldClear: 'amplify-searchfield__clear',
|
|
102
|
+
SearchFieldSearch: 'amplify-searchfield__search',
|
|
103
|
+
Select: 'amplify-select',
|
|
104
|
+
SelectField: 'amplify-selectfield',
|
|
105
|
+
SelectWrapper: 'amplify-select__wrapper',
|
|
106
|
+
SelectIcon: 'amplify-select__icon',
|
|
107
|
+
SliderField: 'amplify-sliderfield',
|
|
108
|
+
SliderFieldGroup: 'amplify-sliderfield__group',
|
|
109
|
+
SliderFieldLabel: 'amplify-sliderfield__label',
|
|
110
|
+
SliderFieldRange: 'amplify-sliderfield__range',
|
|
111
|
+
SliderFieldRoot: 'amplify-sliderfield__root',
|
|
112
|
+
SliderFieldThumb: 'amplify-sliderfield__thumb',
|
|
113
|
+
SliderFieldTrack: 'amplify-sliderfield__track',
|
|
114
|
+
StepperField: 'amplify-stepperfield',
|
|
115
|
+
StepperFieldButtonDecrease: 'amplify-stepperfield__button--decrease',
|
|
116
|
+
StepperFieldButtonIncrease: 'amplify-stepperfield__button--increase',
|
|
117
|
+
StepperFieldInput: 'amplify-stepperfield__input',
|
|
118
|
+
StorageImage: 'amplify-storageimage',
|
|
119
|
+
StorageManager: 'amplify-storagemanager',
|
|
120
|
+
StorageManagerDropZone: 'amplify-storagemanager__dropzone',
|
|
121
|
+
StorageManagerDropZoneIcon: 'amplify-storagemanager__dropzone__icon',
|
|
122
|
+
StorageManagerDropZoneText: 'amplify-storagemanager__dropzone__text',
|
|
123
|
+
StorageManagerFilePicker: 'amplify-storagemanager__file__picker',
|
|
124
|
+
StorageManagerFile: 'amplify-storagemanager__file',
|
|
125
|
+
StorageManagerFileWrapper: 'amplify-storagemanager__file__wrapper',
|
|
126
|
+
StorageManagerFileList: 'amplify-storagemanager__file__list',
|
|
127
|
+
StorageManagerFileName: 'amplify-storagemanager__file__name',
|
|
128
|
+
StorageManagerFileSize: 'amplify-storagemanager__file__size',
|
|
129
|
+
StorageManagerFileInfo: 'amplify-storagemanager__file__info',
|
|
130
|
+
StorageManagerFileImage: 'amplify-storagemanager__file__image',
|
|
131
|
+
StorageManagerFileMain: 'amplify-storagemanager__file__main',
|
|
132
|
+
StorageManagerFileStatus: 'amplify-storagemanager__file__status',
|
|
133
|
+
StorageManagerLoader: 'amplify-storagemanager__loader',
|
|
134
|
+
StorageManagerPreviewer: 'amplify-storagemanager__previewer',
|
|
135
|
+
StorageManagerPreviewerText: 'amplify-storagemanager__previewer__text',
|
|
136
|
+
StorageManagerPreviewerActions: 'amplify-storagemanager__previewer__actions',
|
|
137
|
+
StorageManagerPreviewerFooter: 'amplify-storagemanager__previewer__footer',
|
|
138
|
+
SwitchField: 'amplify-switchfield',
|
|
139
|
+
SwitchLabel: 'amplify-switch__label',
|
|
140
|
+
SwitchThumb: 'amplify-switch__thumb',
|
|
141
|
+
SwitchTrack: 'amplify-switch__track',
|
|
142
|
+
SwitchWrapper: 'amplify-switch__wrapper',
|
|
143
|
+
Table: 'amplify-table',
|
|
144
|
+
TableCaption: 'amplify-table__caption',
|
|
145
|
+
TableBody: 'amplify-table__body',
|
|
146
|
+
TableTd: 'amplify-table__td',
|
|
147
|
+
TableTh: 'amplify-table__th',
|
|
148
|
+
TableFoot: 'amplify-table__foot',
|
|
149
|
+
TableHead: 'amplify-table__head',
|
|
150
|
+
TableRow: 'amplify-table__row',
|
|
151
|
+
Tabs: 'amplify-tabs',
|
|
152
|
+
TabsList: 'amplify-tabs__list',
|
|
153
|
+
TabsItem: 'amplify-tabs__item',
|
|
154
|
+
TabsPanel: 'amplify-tabs__panel',
|
|
155
|
+
Text: 'amplify-text',
|
|
156
|
+
Textarea: 'amplify-textarea',
|
|
157
|
+
TextAreaField: 'amplify-textareafield',
|
|
158
|
+
TextField: 'amplify-textfield',
|
|
159
|
+
ToggleButton: 'amplify-togglebutton',
|
|
160
|
+
ToggleButtonGroup: 'amplify-togglebuttongroup',
|
|
161
|
+
VisuallyHidden: 'amplify-visually-hidden',
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export { ComponentClassName };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isString, isObject, has } from './utils.mjs';
|
|
2
|
+
|
|
3
|
+
const classNames = (...args) => {
|
|
4
|
+
const classes = [];
|
|
5
|
+
for (const arg of args) {
|
|
6
|
+
// skip falsey values
|
|
7
|
+
if (!arg) {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (isString(arg)) {
|
|
11
|
+
classes.push(arg);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (typeof arg === 'number') {
|
|
15
|
+
classes.push(arg.toString());
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(arg)) {
|
|
19
|
+
classes.push(classNames(...arg));
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (isObject(arg)) {
|
|
23
|
+
// check if the object has a valid .toString() method
|
|
24
|
+
if (arg.toString !== Object.prototype.toString &&
|
|
25
|
+
arg.toString() !== '[object Object]') {
|
|
26
|
+
classes.push(arg.toString());
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
for (const key in arg) {
|
|
30
|
+
if (has(arg, key) && arg[key]) {
|
|
31
|
+
classes.push(key);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return classes.join(' ');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { classNames };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AuthAction, Category, InAppMessagingAction, GeoAction, StorageAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
|
|
3
|
+
const ACCOUNT_SETTINGS_INPUT_BASE = {
|
|
4
|
+
apis: [AuthAction.DeleteUser, AuthAction.UpdatePassword],
|
|
5
|
+
category: Category.Auth,
|
|
6
|
+
};
|
|
7
|
+
const AUTHENTICATOR_INPUT_BASE = {
|
|
8
|
+
apis: [
|
|
9
|
+
AuthAction.SignUp,
|
|
10
|
+
AuthAction.ConfirmSignUp,
|
|
11
|
+
AuthAction.ResendSignUpCode,
|
|
12
|
+
AuthAction.SignIn,
|
|
13
|
+
AuthAction.ConfirmSignIn,
|
|
14
|
+
AuthAction.FetchUserAttributes,
|
|
15
|
+
AuthAction.SignOut,
|
|
16
|
+
AuthAction.ResetPassword,
|
|
17
|
+
AuthAction.ConfirmResetPassword,
|
|
18
|
+
AuthAction.SignInWithRedirect,
|
|
19
|
+
],
|
|
20
|
+
category: Category.Auth,
|
|
21
|
+
};
|
|
22
|
+
const IN_APP_MESSAGING_INPUT_BASE = {
|
|
23
|
+
apis: [InAppMessagingAction.NotifyMessageInteraction],
|
|
24
|
+
category: Category.InAppMessaging,
|
|
25
|
+
};
|
|
26
|
+
const LOCATION_SEARCH_INPUT_BASE = {
|
|
27
|
+
category: Category.Geo,
|
|
28
|
+
apis: [
|
|
29
|
+
GeoAction.SearchByText,
|
|
30
|
+
GeoAction.SearchForSuggestions,
|
|
31
|
+
GeoAction.SearchByPlaceId,
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
const MAP_VIEW_INPUT_BASE = {
|
|
35
|
+
category: Category.Geo,
|
|
36
|
+
apis: [],
|
|
37
|
+
};
|
|
38
|
+
const STORAGE_MANAGER_INPUT_BASE = {
|
|
39
|
+
apis: [StorageAction.UploadData],
|
|
40
|
+
category: Category.Storage,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { ACCOUNT_SETTINGS_INPUT_BASE, AUTHENTICATOR_INPUT_BASE, IN_APP_MESSAGING_INPUT_BASE, LOCATION_SEARCH_INPUT_BASE, MAP_VIEW_INPUT_BASE, STORAGE_MANAGER_INPUT_BASE };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { setCustomUserAgent } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import { STORAGE_MANAGER_INPUT_BASE, MAP_VIEW_INPUT_BASE, LOCATION_SEARCH_INPUT_BASE, IN_APP_MESSAGING_INPUT_BASE, ACCOUNT_SETTINGS_INPUT_BASE, AUTHENTICATOR_INPUT_BASE } from './constants.mjs';
|
|
3
|
+
import { noop } from '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* // set user agent options
|
|
9
|
+
* const clear = setUserAgent(input);
|
|
10
|
+
*
|
|
11
|
+
* // clear user agent options
|
|
12
|
+
* clear();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const setUserAgent = ({ componentName, packageName, version, }) => {
|
|
16
|
+
const packageData = [`ui-${packageName}`, version];
|
|
17
|
+
switch (componentName) {
|
|
18
|
+
case 'Authenticator': {
|
|
19
|
+
setCustomUserAgent({
|
|
20
|
+
...AUTHENTICATOR_INPUT_BASE,
|
|
21
|
+
additionalDetails: [[componentName], packageData],
|
|
22
|
+
});
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'ChangePassword':
|
|
26
|
+
case 'DeleteUser': {
|
|
27
|
+
setCustomUserAgent({
|
|
28
|
+
...ACCOUNT_SETTINGS_INPUT_BASE,
|
|
29
|
+
additionalDetails: [['AccountSettings'], packageData],
|
|
30
|
+
});
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case 'InAppMessaging': {
|
|
34
|
+
setCustomUserAgent({
|
|
35
|
+
...IN_APP_MESSAGING_INPUT_BASE,
|
|
36
|
+
additionalDetails: [[componentName], packageData],
|
|
37
|
+
});
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case 'LocationSearch': {
|
|
41
|
+
setCustomUserAgent({
|
|
42
|
+
...LOCATION_SEARCH_INPUT_BASE,
|
|
43
|
+
additionalDetails: [[componentName], packageData],
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'MapView': {
|
|
48
|
+
setCustomUserAgent({
|
|
49
|
+
...MAP_VIEW_INPUT_BASE,
|
|
50
|
+
additionalDetails: [[componentName], packageData],
|
|
51
|
+
});
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case 'StorageManager': {
|
|
55
|
+
setCustomUserAgent({
|
|
56
|
+
...STORAGE_MANAGER_INPUT_BASE,
|
|
57
|
+
additionalDetails: [[componentName], packageData],
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return noop;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { setUserAgent };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some libraries may not follow Node ES module spec and could be loaded as CommonJS modules,
|
|
3
|
+
* To ensure the interoperability between ESM and CJS, modules from those libraries have to be loaded via namespace import
|
|
4
|
+
* And sanitized by the function below because unlike ESM namespace, CJS namespace set `module.exports` object on the `default` key
|
|
5
|
+
* https://nodejs.org/api/esm.html#interoperability-with-commonjs
|
|
6
|
+
*/
|
|
7
|
+
const sanitizeNamespaceImport = (namespaceModule) => {
|
|
8
|
+
const sanitizedNamespaceModule = { default: undefined, ...namespaceModule };
|
|
9
|
+
return sanitizedNamespaceModule.default ?? sanitizedNamespaceModule;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Checks if `value` is an Object (non-primitive, non-array, non-function)
|
|
13
|
+
* Will return false for Arrays and functions
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @param {unknown} value The value to check
|
|
17
|
+
* @returns {boolean} Returns `true` if `value` is an object, `false` otherwise
|
|
18
|
+
*/
|
|
19
|
+
function isObject(value) {
|
|
20
|
+
return value != null && !Array.isArray(value) && typeof value === 'object';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if `value` is a string primitive or object
|
|
24
|
+
*
|
|
25
|
+
* @param {unknown} value The value to check
|
|
26
|
+
* @returns {boolean} Returns `true` if `value` is a string, `false` otherwise
|
|
27
|
+
*/
|
|
28
|
+
function isString(value) {
|
|
29
|
+
return (typeof value === 'string' ||
|
|
30
|
+
(typeof value === 'object' &&
|
|
31
|
+
Object.prototype.toString.call(value) === '[object String]'));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks if `value` is a Map
|
|
35
|
+
*
|
|
36
|
+
* @param {unknown} value The value to check
|
|
37
|
+
* @returns {boolean} Returns `true` if `value` is a Map, `false` otherwise
|
|
38
|
+
*/
|
|
39
|
+
function isMap(value) {
|
|
40
|
+
return (isObject(value) && Object.prototype.toString.call(value) === '[object Map]');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checks if `value` is a Set
|
|
44
|
+
*
|
|
45
|
+
* @param {unknown} value The value to check
|
|
46
|
+
* @returns {boolean} Returns `true` if `value` is a Set, `false` otherwise
|
|
47
|
+
*/
|
|
48
|
+
function isSet(value) {
|
|
49
|
+
return (isObject(value) && Object.prototype.toString.call(value) === '[object Set]');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checks if `value` is undefined
|
|
53
|
+
*
|
|
54
|
+
* @param {unknown} value The value to check
|
|
55
|
+
* @returns {boolean} Returns `true` if `value` is undefined, `false` otherwise
|
|
56
|
+
*/
|
|
57
|
+
function isUndefined(value) {
|
|
58
|
+
return value === undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks if `value` is nullish
|
|
62
|
+
*
|
|
63
|
+
* @param {unknown} value The value to check
|
|
64
|
+
* @returns {boolean} Returns `true` if `value` is nullish, `false` otherwise
|
|
65
|
+
*/
|
|
66
|
+
function isNil(value) {
|
|
67
|
+
return value == null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Checks if `value` is empty
|
|
71
|
+
*
|
|
72
|
+
* @param {unknown} value The value to check
|
|
73
|
+
* @returns {boolean} Returns `true` if `value` is empty, `false` otherwise
|
|
74
|
+
*/
|
|
75
|
+
function isEmpty(value) {
|
|
76
|
+
if (value === null || value === undefined)
|
|
77
|
+
return true;
|
|
78
|
+
if (isObject(value) && (isMap(value) || isSet(value))) {
|
|
79
|
+
return !value.size;
|
|
80
|
+
}
|
|
81
|
+
if (isObject(value) && (isString(value) || Array.isArray(value))) {
|
|
82
|
+
return !value.length;
|
|
83
|
+
}
|
|
84
|
+
for (const key in value) {
|
|
85
|
+
if (has(value, key)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Checks if `value` is an empty array
|
|
93
|
+
*
|
|
94
|
+
* @param {unknown} value The value to check
|
|
95
|
+
* @returns {boolean} Returns `true` if `value` is a empty, `false` otherwise
|
|
96
|
+
*/
|
|
97
|
+
function isEmptyArray(value) {
|
|
98
|
+
return Array.isArray(value) && isEmpty(value);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Checks if all members of the `values` param are empty arrays
|
|
102
|
+
*
|
|
103
|
+
* @param {unknown} value The values to check
|
|
104
|
+
* @returns {boolean} Returns `true` if all members of `values` are empty, `false` otherwise
|
|
105
|
+
*/
|
|
106
|
+
function areEmptyArrays(...values) {
|
|
107
|
+
return values.every(isEmptyArray);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Checks if `value` is an empty object
|
|
111
|
+
*
|
|
112
|
+
* @param {unknown} value The value to check
|
|
113
|
+
* @returns {boolean} Returns `true` if `value` is empty, `false` otherwise
|
|
114
|
+
*/
|
|
115
|
+
function isEmptyObject(value) {
|
|
116
|
+
return isObject(value) && isEmpty(value);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Checks if all members of the `values` param are empty objects
|
|
120
|
+
*
|
|
121
|
+
* @param {unknown} values The values to check
|
|
122
|
+
* @returns {boolean} Returns `true` if all members of the `values` param are empty, `false` otherwise
|
|
123
|
+
*/
|
|
124
|
+
function areEmptyObjects(...values) {
|
|
125
|
+
return values.every(isEmptyObject);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Capitalizes `value` and its return type
|
|
129
|
+
*
|
|
130
|
+
* @param {string} value string to capitalize
|
|
131
|
+
* @returns {string} capitalized string
|
|
132
|
+
*/
|
|
133
|
+
function capitalize(value) {
|
|
134
|
+
return (isString(value) ? value.charAt(0).toUpperCase() + value.slice(1) : '');
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Checks if `key` is a direct property of `value`
|
|
138
|
+
*
|
|
139
|
+
* @param {unknown} value `object` potentially containing property
|
|
140
|
+
* @param {string} key property key
|
|
141
|
+
* @returns whether `key` param is a property of the `obj` param
|
|
142
|
+
*/
|
|
143
|
+
function has(value, key) {
|
|
144
|
+
return value != null && Object.prototype.hasOwnProperty.call(value, key);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Checks if `value` is a function
|
|
148
|
+
*
|
|
149
|
+
* @param {unknown} value param to check
|
|
150
|
+
* @returns {boolean} whether `value` is a function
|
|
151
|
+
*/
|
|
152
|
+
function isFunction(value) {
|
|
153
|
+
return typeof value === 'function';
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* This helper function creates modifier class names that are used for our flat BEM styling
|
|
157
|
+
* it takes in a base and modifier and returns the modified class if a modifier was passed in and null otherwise
|
|
158
|
+
* @param base The base class of the output
|
|
159
|
+
* @param modifier The modifier to add onto the base
|
|
160
|
+
* @returns the modified class name or empty string
|
|
161
|
+
*/
|
|
162
|
+
const classNameModifier = (base, modifier) => {
|
|
163
|
+
return modifier ? `${base}--${modifier}` : '';
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* This helper function creates modified class names that are used for our flat BEM styling
|
|
167
|
+
* it takes in a base, modifier, and flag and returns the modified class name if the flag is true and null if the flag is false
|
|
168
|
+
* @param base
|
|
169
|
+
* @param modifier
|
|
170
|
+
* @param flag
|
|
171
|
+
* @returns the modified class name or empty string
|
|
172
|
+
*/
|
|
173
|
+
const classNameModifierByFlag = (base, modifier, flag) => {
|
|
174
|
+
return flag ? `${base}--${modifier}` : '';
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* `isFunction` but types the param with its function signature
|
|
178
|
+
*
|
|
179
|
+
* @param {unknown} value param to check
|
|
180
|
+
* @returns {boolean} whether `value` is a function
|
|
181
|
+
*/
|
|
182
|
+
function isTypedFunction(value) {
|
|
183
|
+
return isFunction(value);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Similar to `Array.join`, with an optional callback/template param
|
|
187
|
+
* for formatting returned string values
|
|
188
|
+
*
|
|
189
|
+
* @param {string[]} values string array
|
|
190
|
+
* @param {(value: string) => string} template callback format param
|
|
191
|
+
* @returns formatted string array
|
|
192
|
+
*/
|
|
193
|
+
function templateJoin(values, template) {
|
|
194
|
+
return values.reduce((acc, curr) => `${acc}${isString(curr) ? template(curr) : ''}`, '');
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* A function that does nothing
|
|
198
|
+
*
|
|
199
|
+
* @param {any[]} _ accepts any parameters
|
|
200
|
+
* @returns nothing
|
|
201
|
+
*/
|
|
202
|
+
function noop(..._) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @param {string} groupName name of group
|
|
207
|
+
* @param events string values related to group
|
|
208
|
+
*/
|
|
209
|
+
function groupLog(groupName, ...events) {
|
|
210
|
+
const hasEvents = !!events?.length;
|
|
211
|
+
if (hasEvents) {
|
|
212
|
+
// eslint-disable-next-line no-console
|
|
213
|
+
console.groupCollapsed(groupName);
|
|
214
|
+
events?.forEach((event) => {
|
|
215
|
+
// eslint-disable-next-line no-console
|
|
216
|
+
console.log(event);
|
|
217
|
+
});
|
|
218
|
+
// eslint-disable-next-line no-console
|
|
219
|
+
console.groupEnd();
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// eslint-disable-next-line no-console
|
|
223
|
+
console.log(groupName);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isTypedFunction, isUndefined, noop, sanitizeNamespaceImport, templateJoin };
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import merge from 'lodash/merge.js';
|
|
2
|
+
import '@aws-amplify/core/internals/utils';
|
|
3
|
+
import '../utils/setUserAgent/constants.mjs';
|
|
4
|
+
import { isEmpty } from '../utils/utils.mjs';
|
|
5
|
+
|
|
6
|
+
// Runs all validators given. Resolves if there are no error. Rejects otherwise.
|
|
7
|
+
const runValidators = async (formData, touchData, passwordSettings, validators) => {
|
|
8
|
+
const errors = await Promise.all(validators.map((validator) => validator(formData, touchData, passwordSettings)));
|
|
9
|
+
const mergedError = merge({}, ...errors);
|
|
10
|
+
if (isEmpty(mergedError)) {
|
|
11
|
+
// no errors were found
|
|
12
|
+
return Promise.resolve();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return Promise.reject(mergedError);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { runValidators };
|