@aws-amplify/ui 5.8.1 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +423 -0
- package/dist/styles/liveness.layer.css +425 -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 +343 -680
- package/dist/styles.layer.css +6164 -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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import pickBy from 'lodash/pickBy.js';
|
|
2
|
+
import '@aws-amplify/core/internals/utils';
|
|
3
|
+
import '../../utils/setUserAgent/constants.mjs';
|
|
4
|
+
import { isString } from '../../utils/utils.mjs';
|
|
5
|
+
|
|
6
|
+
// default `autoSignIn` flag is `true`
|
|
7
|
+
const DEFAULT_AUTO_SIGN_IN = true;
|
|
8
|
+
const sanitizePhoneNumber = (dialCode, phoneNumber) => `${dialCode}${phoneNumber}`.replace(/[^A-Z0-9+]/gi, '');
|
|
9
|
+
const selectUserAttributes = (_, key) => {
|
|
10
|
+
// Allowlist of Cognito User Pool Attributes (from OpenID Connect specification)
|
|
11
|
+
// See: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html
|
|
12
|
+
switch (key) {
|
|
13
|
+
case 'address':
|
|
14
|
+
case 'birthdate':
|
|
15
|
+
case 'email':
|
|
16
|
+
case 'family_name':
|
|
17
|
+
case 'gender':
|
|
18
|
+
case 'given_name':
|
|
19
|
+
case 'locale':
|
|
20
|
+
case 'middle_name':
|
|
21
|
+
case 'name':
|
|
22
|
+
case 'nickname':
|
|
23
|
+
case 'phone_number':
|
|
24
|
+
case 'picture':
|
|
25
|
+
case 'preferred_username':
|
|
26
|
+
case 'profile':
|
|
27
|
+
case 'updated_at':
|
|
28
|
+
case 'website':
|
|
29
|
+
case 'zoneinfo':
|
|
30
|
+
return true;
|
|
31
|
+
// Otherwise, it's a custom attribute
|
|
32
|
+
default:
|
|
33
|
+
return key.startsWith('custom:');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const getUserAttributes = (formValues) => {
|
|
37
|
+
const { phone_number, ...userAttributes } = pickBy(formValues, selectUserAttributes);
|
|
38
|
+
// only include `phone_number` attribute in `userAttributes` if it has a value
|
|
39
|
+
if (isString(phone_number)) {
|
|
40
|
+
const { country_code } = formValues;
|
|
41
|
+
return {
|
|
42
|
+
...userAttributes,
|
|
43
|
+
phone_number: sanitizePhoneNumber(country_code, phone_number),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return userAttributes;
|
|
47
|
+
};
|
|
48
|
+
const getSignUpInput = (username, formValues, loginMechanism) => {
|
|
49
|
+
const { password, ...values } = formValues;
|
|
50
|
+
const attributes = getUserAttributes(values);
|
|
51
|
+
const options = {
|
|
52
|
+
autoSignIn: DEFAULT_AUTO_SIGN_IN,
|
|
53
|
+
userAttributes: {
|
|
54
|
+
// use `username` value for `phone_number`
|
|
55
|
+
...(loginMechanism === 'phone_number'
|
|
56
|
+
? { ...attributes, phone_number: username }
|
|
57
|
+
: attributes),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return { username, password, options };
|
|
61
|
+
};
|
|
62
|
+
const getUsernameSignUp = ({ formValues, loginMechanisms, }) => {
|
|
63
|
+
const loginMechanism = loginMechanisms[0];
|
|
64
|
+
if (loginMechanism === 'phone_number') {
|
|
65
|
+
const { country_code, phone_number } = formValues;
|
|
66
|
+
return sanitizePhoneNumber(country_code, phone_number);
|
|
67
|
+
}
|
|
68
|
+
return formValues[loginMechanism];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { getSignUpInput, getUserAttributes, getUsernameSignUp, sanitizePhoneNumber };
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
// Breakpoint unit is in pixels
|
|
2
|
+
const breakpoints = {
|
|
3
|
+
values: {
|
|
4
|
+
base: 0,
|
|
5
|
+
small: 480,
|
|
6
|
+
medium: 768,
|
|
7
|
+
large: 992,
|
|
8
|
+
xl: 1280,
|
|
9
|
+
xxl: 1536,
|
|
10
|
+
},
|
|
11
|
+
defaultBreakpoint: 'base',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { breakpoints };
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
import
|
|
1
|
+
import deepExtend from 'style-dictionary/lib/utils/deepExtend.js';
|
|
2
|
+
import flattenProperties from 'style-dictionary/lib/utils/flattenProperties.js';
|
|
3
|
+
import { defaultTheme } from './defaultTheme.mjs';
|
|
4
|
+
import { setupTokens, cssNameTransform, cssValue } from './utils.mjs';
|
|
5
|
+
import '@aws-amplify/core/internals/utils';
|
|
6
|
+
import '../utils/setUserAgent/constants.mjs';
|
|
7
|
+
import { isString } from '../utils/utils.mjs';
|
|
8
|
+
|
|
9
|
+
// Internal Style Dictionary methods
|
|
10
|
+
/**
|
|
11
|
+
* This will take a design token and add some data to it for it
|
|
12
|
+
* to be used in JS/CSS. It will create its CSS var name and update
|
|
13
|
+
* the value to use a CSS var if it is a reference. It will also
|
|
14
|
+
* add a `.toString()` method to make it easier to use in JS.
|
|
15
|
+
*
|
|
16
|
+
* We should see if there is a way to share this logic with style dictionary...
|
|
17
|
+
*/
|
|
18
|
+
const setupToken = ({ token, path }) => {
|
|
19
|
+
const name = `--${cssNameTransform({ path })}`;
|
|
20
|
+
const { value: original } = token;
|
|
21
|
+
const value = cssValue(token);
|
|
22
|
+
return { name, original, path, value, toString: () => `var(${name})` };
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Takes a set of keys and a color name and returns an object of design tokens,
|
|
26
|
+
* used for applying a primary color at the theme level to our tokens.
|
|
27
|
+
*
|
|
28
|
+
* createColorPalette({keys: ['10','20',...], value: 'red'})
|
|
29
|
+
* returns {
|
|
30
|
+
* 10: { value: '{colors.red.10.value}' },
|
|
31
|
+
* 20: { value: '{colors.red.20.value}' },
|
|
32
|
+
* ...
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
function createColorPalette({ keys, value }) {
|
|
36
|
+
return keys.reduce((acc, key) => {
|
|
37
|
+
return {
|
|
38
|
+
...acc,
|
|
39
|
+
[key]: { value: `{colors.${value}.${key}.value}` },
|
|
40
|
+
};
|
|
41
|
+
}, {});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This will be used like `const myTheme = createTheme({})`
|
|
45
|
+
* `myTheme` can then be passed to a Provider or the generated CSS
|
|
46
|
+
* can be passed to a stylesheet at build-time or run-time.
|
|
47
|
+
* const myTheme = createTheme({})
|
|
48
|
+
* const myOtherTheme = createTheme({}, myTheme);
|
|
49
|
+
*/
|
|
50
|
+
function createTheme(theme, DefaultTheme = defaultTheme) {
|
|
51
|
+
// merge theme and DefaultTheme to get a complete theme
|
|
52
|
+
// deepExtend is an internal Style Dictionary method
|
|
53
|
+
// that performs a deep merge on n objects. We could change
|
|
54
|
+
// this to another 3p deep merge solution too.
|
|
55
|
+
const mergedTheme = deepExtend([{}, DefaultTheme, theme]);
|
|
56
|
+
const { primaryColor, secondaryColor } = mergedTheme;
|
|
57
|
+
// apply primaryColor and secondaryColor if present
|
|
58
|
+
if (isString(primaryColor)) {
|
|
59
|
+
mergedTheme.tokens.colors.primary = createColorPalette({
|
|
60
|
+
keys: Object.keys(mergedTheme.tokens.colors[primaryColor]),
|
|
61
|
+
value: primaryColor,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (isString(secondaryColor)) {
|
|
65
|
+
mergedTheme.tokens.colors.secondary = createColorPalette({
|
|
66
|
+
keys: Object.keys(mergedTheme.tokens.colors[secondaryColor]),
|
|
67
|
+
value: secondaryColor,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Setting up the tokens. This is similar to what Style Dictionary
|
|
71
|
+
// does. At the end of this, each token should have:
|
|
72
|
+
// - CSS variable name of itself
|
|
73
|
+
// - its value (reference to another CSS variable or raw value)
|
|
74
|
+
const tokens = setupTokens({
|
|
75
|
+
tokens: mergedTheme.tokens,
|
|
76
|
+
setupToken,
|
|
77
|
+
}); // Setting the type here because setupTokens is recursive
|
|
78
|
+
const { breakpoints, name } = mergedTheme;
|
|
79
|
+
// flattenProperties is another internal Style Dictionary function
|
|
80
|
+
// that creates an array of all tokens.
|
|
81
|
+
let cssText = `[data-amplify-theme="${name}"] {\n` +
|
|
82
|
+
flattenProperties(tokens)
|
|
83
|
+
.map((token) => `${token.name}: ${token.value};`)
|
|
84
|
+
.join('\n') +
|
|
85
|
+
`\n}\n`;
|
|
86
|
+
let overrides = [];
|
|
87
|
+
/**
|
|
88
|
+
* For each override, we setup the tokens and then generate the CSS.
|
|
89
|
+
* This allows us to have one single CSS string for all possible overrides
|
|
90
|
+
* and avoid re-renders in React, but also support other frameworks as well.
|
|
91
|
+
*/
|
|
92
|
+
if (mergedTheme.overrides) {
|
|
93
|
+
overrides = mergedTheme.overrides.map((override) => {
|
|
94
|
+
const tokens = setupTokens({
|
|
95
|
+
tokens: override.tokens,
|
|
96
|
+
setupToken,
|
|
97
|
+
});
|
|
98
|
+
const customProperties = flattenProperties(tokens)
|
|
99
|
+
.map((token) => `${token.name}: ${token.value};`)
|
|
100
|
+
.join('\n');
|
|
101
|
+
// Overrides can have a selector, media query, breakpoint, or color mode
|
|
102
|
+
// for creating the selector
|
|
103
|
+
if ('selector' in override) {
|
|
104
|
+
cssText += `\n${override.selector} {\n${customProperties}\n}\n`;
|
|
105
|
+
}
|
|
106
|
+
if ('mediaQuery' in override) {
|
|
107
|
+
cssText += `\n@media (${override.mediaQuery}) {
|
|
108
|
+
[data-amplify-theme="${name}"] {
|
|
109
|
+
${customProperties}
|
|
110
|
+
}
|
|
111
|
+
}\n`;
|
|
112
|
+
}
|
|
113
|
+
if ('breakpoint' in override) {
|
|
114
|
+
const breakpoint = mergedTheme.breakpoints.values[override.breakpoint];
|
|
115
|
+
cssText += `\n@media (min-width: ${breakpoint}px) {
|
|
116
|
+
[data-amplify-theme="${name}"] {
|
|
117
|
+
${customProperties}
|
|
118
|
+
}
|
|
119
|
+
}\n`;
|
|
120
|
+
}
|
|
121
|
+
if ('colorMode' in override) {
|
|
122
|
+
cssText += `\n@media (prefers-color-scheme: ${override.colorMode}) {
|
|
123
|
+
[data-amplify-theme="${name}"][data-amplify-color-mode="system"] {
|
|
124
|
+
${customProperties}
|
|
125
|
+
color-scheme: ${override.colorMode};
|
|
126
|
+
}
|
|
127
|
+
}\n`;
|
|
128
|
+
cssText += `\n[data-amplify-theme="${name}"][data-amplify-color-mode="${override.colorMode}"] {
|
|
129
|
+
${customProperties}
|
|
130
|
+
color-scheme: ${override.colorMode};
|
|
131
|
+
}\n`;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
...override,
|
|
135
|
+
tokens,
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
tokens,
|
|
141
|
+
breakpoints,
|
|
142
|
+
name,
|
|
143
|
+
cssText,
|
|
144
|
+
// keep overrides separate from base theme
|
|
145
|
+
// this allows web platforms to use plain CSS scoped to a
|
|
146
|
+
// selector and only override the CSS vars needed. This
|
|
147
|
+
// means we could generate CSS at build-time in a postcss
|
|
148
|
+
// plugin, or do it at runtime and inject the CSS into a
|
|
149
|
+
// style tag.
|
|
150
|
+
// This also allows RN to dynamically switch themes in a
|
|
151
|
+
// provider.
|
|
152
|
+
overrides,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { createTheme };
|
|
@@ -1 +1,128 @@
|
|
|
1
|
-
import{tokens
|
|
1
|
+
import { tokens } from './tokens/index.mjs';
|
|
2
|
+
|
|
3
|
+
const darkModeTokens = {
|
|
4
|
+
colors: {
|
|
5
|
+
red: {
|
|
6
|
+
10: tokens.colors.red[100],
|
|
7
|
+
20: tokens.colors.red[90],
|
|
8
|
+
40: tokens.colors.red[80],
|
|
9
|
+
// 60 doesn't change
|
|
10
|
+
80: tokens.colors.red[40],
|
|
11
|
+
90: tokens.colors.red[20],
|
|
12
|
+
100: tokens.colors.red[10],
|
|
13
|
+
},
|
|
14
|
+
orange: {
|
|
15
|
+
10: tokens.colors.orange[100],
|
|
16
|
+
20: tokens.colors.orange[90],
|
|
17
|
+
40: tokens.colors.orange[80],
|
|
18
|
+
// 60 doesn't change
|
|
19
|
+
80: tokens.colors.orange[40],
|
|
20
|
+
90: tokens.colors.orange[20],
|
|
21
|
+
100: tokens.colors.orange[10],
|
|
22
|
+
},
|
|
23
|
+
yellow: {
|
|
24
|
+
10: tokens.colors.yellow[100],
|
|
25
|
+
20: tokens.colors.yellow[90],
|
|
26
|
+
40: tokens.colors.yellow[80],
|
|
27
|
+
// 60 doesn't change
|
|
28
|
+
80: tokens.colors.yellow[40],
|
|
29
|
+
90: tokens.colors.yellow[20],
|
|
30
|
+
100: tokens.colors.yellow[10],
|
|
31
|
+
},
|
|
32
|
+
green: {
|
|
33
|
+
10: tokens.colors.green[100],
|
|
34
|
+
20: tokens.colors.green[90],
|
|
35
|
+
40: tokens.colors.green[80],
|
|
36
|
+
// 60 doesn't change
|
|
37
|
+
80: tokens.colors.green[40],
|
|
38
|
+
90: tokens.colors.green[20],
|
|
39
|
+
100: tokens.colors.green[10],
|
|
40
|
+
},
|
|
41
|
+
teal: {
|
|
42
|
+
10: tokens.colors.teal[100],
|
|
43
|
+
20: tokens.colors.teal[90],
|
|
44
|
+
40: tokens.colors.teal[80],
|
|
45
|
+
// 60 doesn't change
|
|
46
|
+
80: tokens.colors.teal[40],
|
|
47
|
+
90: tokens.colors.teal[20],
|
|
48
|
+
100: tokens.colors.teal[10],
|
|
49
|
+
},
|
|
50
|
+
blue: {
|
|
51
|
+
10: tokens.colors.blue[100],
|
|
52
|
+
20: tokens.colors.blue[90],
|
|
53
|
+
40: tokens.colors.blue[80],
|
|
54
|
+
// 60 doesn't change
|
|
55
|
+
80: tokens.colors.blue[40],
|
|
56
|
+
90: tokens.colors.blue[20],
|
|
57
|
+
100: tokens.colors.blue[10],
|
|
58
|
+
},
|
|
59
|
+
purple: {
|
|
60
|
+
10: tokens.colors.purple[100],
|
|
61
|
+
20: tokens.colors.purple[90],
|
|
62
|
+
40: tokens.colors.purple[80],
|
|
63
|
+
// 60 doesn't change
|
|
64
|
+
80: tokens.colors.purple[40],
|
|
65
|
+
90: tokens.colors.purple[20],
|
|
66
|
+
100: tokens.colors.purple[10],
|
|
67
|
+
},
|
|
68
|
+
pink: {
|
|
69
|
+
10: tokens.colors.pink[100],
|
|
70
|
+
20: tokens.colors.pink[90],
|
|
71
|
+
40: tokens.colors.pink[80],
|
|
72
|
+
// 60 doesn't change
|
|
73
|
+
80: tokens.colors.pink[40],
|
|
74
|
+
90: tokens.colors.pink[20],
|
|
75
|
+
100: tokens.colors.pink[10],
|
|
76
|
+
},
|
|
77
|
+
neutral: {
|
|
78
|
+
10: tokens.colors.neutral[100],
|
|
79
|
+
20: tokens.colors.neutral[90],
|
|
80
|
+
40: tokens.colors.neutral[80],
|
|
81
|
+
// 60 doesn't change
|
|
82
|
+
80: tokens.colors.neutral[40],
|
|
83
|
+
90: tokens.colors.neutral[20],
|
|
84
|
+
100: tokens.colors.neutral[10],
|
|
85
|
+
},
|
|
86
|
+
font: {
|
|
87
|
+
primary: '{colors.white}',
|
|
88
|
+
secondary: '{colors.neutral.100}',
|
|
89
|
+
tertiary: '{colors.neutral.90}',
|
|
90
|
+
inverse: '{colors.neutral.10}',
|
|
91
|
+
},
|
|
92
|
+
background: {
|
|
93
|
+
primary: '{colors.neutral.10}',
|
|
94
|
+
secondary: '{colors.neutral.20}',
|
|
95
|
+
tertiary: '{colors.neutral.40}',
|
|
96
|
+
},
|
|
97
|
+
border: {
|
|
98
|
+
primary: '{colors.neutral.60}',
|
|
99
|
+
secondary: '{colors.neutral.40}',
|
|
100
|
+
tertiary: '{colors.neutral.20}',
|
|
101
|
+
},
|
|
102
|
+
overlay: {
|
|
103
|
+
5: 'hsla(0, 0%, 100%, 0.05)',
|
|
104
|
+
10: 'hsla(0, 0%, 100%, 0.1)',
|
|
105
|
+
20: 'hsla(0, 0%, 100%, 0.2)',
|
|
106
|
+
30: 'hsla(0, 0%, 100%, 0.3)',
|
|
107
|
+
40: 'hsla(0, 0%, 100%, 0.4)',
|
|
108
|
+
50: 'hsla(0, 0%, 100%, 0.5)',
|
|
109
|
+
60: 'hsla(0, 0%, 100%, 0.6)',
|
|
110
|
+
70: 'hsla(0, 0%, 100%, 0.7)',
|
|
111
|
+
80: 'hsla(0, 0%, 100%, 0.8)',
|
|
112
|
+
90: 'hsla(0, 0%, 100%, 0.9)',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* A basic dark mode that just flips the base color
|
|
118
|
+
* palette.
|
|
119
|
+
*/
|
|
120
|
+
const defaultDarkModeOverride = {
|
|
121
|
+
colorMode: 'dark',
|
|
122
|
+
tokens: darkModeTokens,
|
|
123
|
+
};
|
|
124
|
+
const reactNativeDarkTokens = {
|
|
125
|
+
...darkModeTokens,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { defaultDarkModeOverride, reactNativeDarkTokens };
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{tokens
|
|
1
|
+
import { tokens } from './tokens/index.mjs';
|
|
2
|
+
import { breakpoints } from './breakpoints.mjs';
|
|
3
|
+
|
|
4
|
+
const defaultTheme = {
|
|
5
|
+
tokens,
|
|
6
|
+
breakpoints,
|
|
7
|
+
name: 'default-theme',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { defaultTheme };
|
|
@@ -1 +1,166 @@
|
|
|
1
|
-
const
|
|
1
|
+
const colors = {
|
|
2
|
+
red: {
|
|
3
|
+
10: { value: 'hsl(0, 75%, 95%)' },
|
|
4
|
+
20: { value: 'hsl(0, 75%, 85%)' },
|
|
5
|
+
40: { value: 'hsl(0, 75%, 75%)' },
|
|
6
|
+
60: { value: 'hsl(0, 50%, 50%)' },
|
|
7
|
+
80: { value: 'hsl(0, 95%, 30%)' },
|
|
8
|
+
90: { value: 'hsl(0, 100%, 20%)' },
|
|
9
|
+
100: { value: 'hsl(0, 100%, 15%)' },
|
|
10
|
+
},
|
|
11
|
+
orange: {
|
|
12
|
+
10: { value: 'hsl(30, 75%, 95%)' },
|
|
13
|
+
20: { value: 'hsl(30, 75%, 85%)' },
|
|
14
|
+
40: { value: 'hsl(30, 75%, 75%)' },
|
|
15
|
+
60: { value: 'hsl(30, 50%, 50%)' },
|
|
16
|
+
80: { value: 'hsl(30, 95%, 30%)' },
|
|
17
|
+
90: { value: 'hsl(30, 100%, 20%)' },
|
|
18
|
+
100: { value: 'hsl(30, 100%, 15%)' },
|
|
19
|
+
},
|
|
20
|
+
yellow: {
|
|
21
|
+
10: { value: 'hsl(60, 75%, 95%)' },
|
|
22
|
+
20: { value: 'hsl(60, 75%, 85%)' },
|
|
23
|
+
40: { value: 'hsl(60, 75%, 75%)' },
|
|
24
|
+
60: { value: 'hsl(60, 50%, 50%)' },
|
|
25
|
+
80: { value: 'hsl(60, 95%, 30%)' },
|
|
26
|
+
90: { value: 'hsl(60, 100%, 20%)' },
|
|
27
|
+
100: { value: 'hsl(60, 100%, 15%)' },
|
|
28
|
+
},
|
|
29
|
+
green: {
|
|
30
|
+
10: { value: 'hsl(130, 60%, 95%)' },
|
|
31
|
+
20: { value: 'hsl(130, 60%, 90%)' },
|
|
32
|
+
40: { value: 'hsl(130, 44%, 63%)' },
|
|
33
|
+
60: { value: 'hsl(130, 43%, 46%)' },
|
|
34
|
+
80: { value: 'hsl(130, 33%, 37%)' },
|
|
35
|
+
90: { value: 'hsl(130, 27%, 29%)' },
|
|
36
|
+
100: { value: 'hsl(130, 22%, 23%)' },
|
|
37
|
+
},
|
|
38
|
+
teal: {
|
|
39
|
+
10: { value: 'hsl(190, 75%, 95%)' },
|
|
40
|
+
20: { value: 'hsl(190, 75%, 85%)' },
|
|
41
|
+
40: { value: 'hsl(190, 70%, 70%)' },
|
|
42
|
+
60: { value: 'hsl(190, 50%, 50%)' },
|
|
43
|
+
80: { value: 'hsl(190, 95%, 30%)' },
|
|
44
|
+
90: { value: 'hsl(190, 100%, 20%)' },
|
|
45
|
+
100: { value: 'hsl(190, 100%, 15%)' },
|
|
46
|
+
},
|
|
47
|
+
blue: {
|
|
48
|
+
10: { value: 'hsl(220, 95%, 95%)' },
|
|
49
|
+
20: { value: 'hsl(220, 85%, 85%)' },
|
|
50
|
+
40: { value: 'hsl(220, 70%, 70%)' },
|
|
51
|
+
60: { value: 'hsl(220, 50%, 50%)' },
|
|
52
|
+
80: { value: 'hsl(220, 95%, 30%)' },
|
|
53
|
+
90: { value: 'hsl(220, 100%, 20%)' },
|
|
54
|
+
100: { value: 'hsl(220, 100%, 15%)' },
|
|
55
|
+
},
|
|
56
|
+
purple: {
|
|
57
|
+
10: { value: 'hsl(300, 95%, 95%)' },
|
|
58
|
+
20: { value: 'hsl(300, 85%, 85%)' },
|
|
59
|
+
40: { value: 'hsl(300, 70%, 70%)' },
|
|
60
|
+
60: { value: 'hsl(300, 50%, 50%)' },
|
|
61
|
+
80: { value: 'hsl(300, 95%, 30%)' },
|
|
62
|
+
90: { value: 'hsl(300, 100%, 20%)' },
|
|
63
|
+
100: { value: 'hsl(300, 100%, 15%)' },
|
|
64
|
+
},
|
|
65
|
+
pink: {
|
|
66
|
+
10: { value: 'hsl(340, 95%, 95%)' },
|
|
67
|
+
20: { value: 'hsl(340, 90%, 85%)' },
|
|
68
|
+
40: { value: 'hsl(340, 70%, 70%)' },
|
|
69
|
+
60: { value: 'hsl(340, 50%, 50%)' },
|
|
70
|
+
80: { value: 'hsl(340, 95%, 30%)' },
|
|
71
|
+
90: { value: 'hsl(340, 100%, 20%)' },
|
|
72
|
+
100: { value: 'hsl(340, 100%, 15%)' },
|
|
73
|
+
},
|
|
74
|
+
neutral: {
|
|
75
|
+
10: { value: 'hsl(210, 5%, 98%)' },
|
|
76
|
+
20: { value: 'hsl(210, 5%, 94%)' },
|
|
77
|
+
40: { value: 'hsl(210, 5%, 87%)' },
|
|
78
|
+
60: { value: 'hsl(210, 10%, 58%)' },
|
|
79
|
+
80: { value: 'hsl(210, 10%, 40%)' },
|
|
80
|
+
90: { value: 'hsl(210, 25%, 25%)' },
|
|
81
|
+
100: { value: 'hsl(210, 50%, 10%)' },
|
|
82
|
+
},
|
|
83
|
+
primary: {
|
|
84
|
+
10: { value: '{colors.teal.10.value}' },
|
|
85
|
+
20: { value: '{colors.teal.20.value}' },
|
|
86
|
+
40: { value: '{colors.teal.40.value}' },
|
|
87
|
+
60: { value: '{colors.teal.60.value}' },
|
|
88
|
+
80: { value: '{colors.teal.80.value}' },
|
|
89
|
+
90: { value: '{colors.teal.90.value}' },
|
|
90
|
+
100: { value: '{colors.teal.100.value}' },
|
|
91
|
+
},
|
|
92
|
+
secondary: {
|
|
93
|
+
10: { value: '{colors.purple.10.value}' },
|
|
94
|
+
20: { value: '{colors.purple.20.value}' },
|
|
95
|
+
40: { value: '{colors.purple.40.value}' },
|
|
96
|
+
60: { value: '{colors.purple.60.value}' },
|
|
97
|
+
80: { value: '{colors.purple.80.value}' },
|
|
98
|
+
90: { value: '{colors.purple.90.value}' },
|
|
99
|
+
100: { value: '{colors.purple.100.value}' },
|
|
100
|
+
},
|
|
101
|
+
font: {
|
|
102
|
+
primary: { value: '{colors.neutral.100.value}' },
|
|
103
|
+
secondary: { value: '{colors.neutral.90.value}' },
|
|
104
|
+
tertiary: { value: '{colors.neutral.80.value}' },
|
|
105
|
+
disabled: { value: '{colors.neutral.60.value}' },
|
|
106
|
+
inverse: { value: '{colors.white.value}' },
|
|
107
|
+
interactive: { value: '{colors.primary.80.value}' },
|
|
108
|
+
// Hover and Focus colors are intentionally different colors.
|
|
109
|
+
// This allows users to distinguish between the current keyboard focus
|
|
110
|
+
// and the location of their pointer
|
|
111
|
+
hover: { value: '{colors.primary.90.value}' },
|
|
112
|
+
// Focus color is set to 100 to ensure enough contrast for accessibility
|
|
113
|
+
focus: { value: '{colors.primary.100.value}' },
|
|
114
|
+
active: { value: '{colors.primary.100.value}' },
|
|
115
|
+
info: { value: '{colors.blue.90.value}' },
|
|
116
|
+
warning: { value: '{colors.orange.90.value}' },
|
|
117
|
+
error: { value: '{colors.red.90.value}' },
|
|
118
|
+
success: { value: '{colors.green.90.value}' },
|
|
119
|
+
},
|
|
120
|
+
background: {
|
|
121
|
+
primary: { value: '{colors.white.value}' },
|
|
122
|
+
secondary: { value: '{colors.neutral.10.value}' },
|
|
123
|
+
tertiary: { value: '{colors.neutral.20.value}' },
|
|
124
|
+
quaternary: { value: '{colors.neutral.60.value}' },
|
|
125
|
+
disabled: { value: '{colors.background.tertiary.value}' },
|
|
126
|
+
info: { value: '{colors.blue.10.value}' },
|
|
127
|
+
warning: { value: '{colors.orange.10.value}' },
|
|
128
|
+
error: { value: '{colors.red.10.value}' },
|
|
129
|
+
success: { value: '{colors.green.10.value}' },
|
|
130
|
+
},
|
|
131
|
+
border: {
|
|
132
|
+
primary: { value: '{colors.neutral.60.value}' },
|
|
133
|
+
secondary: { value: '{colors.neutral.40.value}' },
|
|
134
|
+
tertiary: { value: '{colors.neutral.20.value}' },
|
|
135
|
+
disabled: { value: '{colors.border.tertiary.value}' },
|
|
136
|
+
pressed: { value: '{colors.primary.100.value}' },
|
|
137
|
+
// Focus color is set to 100 to ensure enough contrast for accessibility
|
|
138
|
+
focus: { value: '{colors.primary.100.value}' },
|
|
139
|
+
error: { value: '{colors.red.80.value}' },
|
|
140
|
+
info: { value: '{colors.blue.80.value}' },
|
|
141
|
+
success: { value: '{colors.green.80.value}' },
|
|
142
|
+
warning: { value: '{colors.orange.80.value}' },
|
|
143
|
+
},
|
|
144
|
+
shadow: {
|
|
145
|
+
primary: { value: 'hsla(210, 50%, 10%, 0.25)' },
|
|
146
|
+
secondary: { value: 'hsla(210, 50%, 10%, 0.15)' },
|
|
147
|
+
tertiary: { value: 'hsla(210, 50%, 10%, 0.05)' },
|
|
148
|
+
},
|
|
149
|
+
overlay: {
|
|
150
|
+
5: { value: 'hsla(0, 0%, 0%, 0.05)' },
|
|
151
|
+
10: { value: 'hsla(0, 0%, 0%, 0.1)' },
|
|
152
|
+
20: { value: 'hsla(0, 0%, 0%, 0.2)' },
|
|
153
|
+
30: { value: 'hsla(0, 0%, 0%, 0.3)' },
|
|
154
|
+
40: { value: 'hsla(0, 0%, 0%, 0.4)' },
|
|
155
|
+
50: { value: 'hsla(0, 0%, 0%, 0.5)' },
|
|
156
|
+
60: { value: 'hsla(0, 0%, 0%, 0.6)' },
|
|
157
|
+
70: { value: 'hsla(0, 0%, 0%, 0.7)' },
|
|
158
|
+
80: { value: 'hsla(0, 0%, 0%, 0.8)' },
|
|
159
|
+
90: { value: 'hsla(0, 0%, 0%, 0.9)' },
|
|
160
|
+
},
|
|
161
|
+
black: { value: 'hsl(0, 0%, 0%)' },
|
|
162
|
+
white: { value: 'hsl(0, 0%, 100%)' },
|
|
163
|
+
transparent: { value: 'transparent' },
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export { colors };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const accordion = {
|
|
2
|
+
backgroundColor: { value: '{colors.background.primary.value}' },
|
|
3
|
+
item: {
|
|
4
|
+
borderColor: { value: '{colors.border.secondary.value}' },
|
|
5
|
+
borderWidth: { value: '{borderWidths.small.value}' },
|
|
6
|
+
borderStyle: { value: 'solid' },
|
|
7
|
+
borderRadius: { value: '{radii.small.value}' },
|
|
8
|
+
trigger: {
|
|
9
|
+
alignItems: { value: 'center' },
|
|
10
|
+
backgroundColor: { value: '{colors.background.primary.value}' },
|
|
11
|
+
color: { value: 'inherit' },
|
|
12
|
+
gap: { value: '{space.small.value}' },
|
|
13
|
+
justifyContent: { value: 'space-between' },
|
|
14
|
+
paddingBlock: { value: '{space.xs.value}' },
|
|
15
|
+
paddingInline: { value: '{space.small.value}' },
|
|
16
|
+
_hover: {
|
|
17
|
+
color: { value: 'inherit' },
|
|
18
|
+
backgroundColor: { value: '{colors.overlay.5.value}' },
|
|
19
|
+
},
|
|
20
|
+
_focus: {
|
|
21
|
+
borderColor: { value: '{colors.border.focus.value}' },
|
|
22
|
+
boxShadow: {
|
|
23
|
+
value: {
|
|
24
|
+
offsetX: '0',
|
|
25
|
+
offsetY: '0',
|
|
26
|
+
blurRadius: '0',
|
|
27
|
+
spreadRadius: '2px',
|
|
28
|
+
color: '{colors.border.focus.value}',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
content: {
|
|
34
|
+
color: { value: 'inherit' },
|
|
35
|
+
paddingInline: { value: '{space.small.value}' },
|
|
36
|
+
paddingBlockEnd: { value: '{space.small.value}' },
|
|
37
|
+
paddingBlockStart: { value: '{space.xxxs.value}' },
|
|
38
|
+
},
|
|
39
|
+
icon: {
|
|
40
|
+
color: { value: '{colors.font.tertiary.value}' },
|
|
41
|
+
transitionDuration: { value: '{time.medium.value}' },
|
|
42
|
+
transitionTimingFunction: { value: 'cubic-bezier(0.87, 0, 0.13, 1)' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { accordion };
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
const
|
|
1
|
+
const alert = {
|
|
2
|
+
// Default styles
|
|
3
|
+
alignItems: { value: 'center' },
|
|
4
|
+
justifyContent: { value: 'space-between' },
|
|
5
|
+
color: { value: '{colors.font.primary.value}' },
|
|
6
|
+
backgroundColor: { value: '{colors.background.tertiary.value}' },
|
|
7
|
+
paddingBlock: { value: '{space.small.value}' },
|
|
8
|
+
paddingInline: { value: '{space.medium.value}' },
|
|
9
|
+
icon: {
|
|
10
|
+
size: { value: '{fontSizes.xl.value}' },
|
|
11
|
+
},
|
|
12
|
+
heading: {
|
|
13
|
+
fontSize: { value: '{fontSizes.medium.value}' },
|
|
14
|
+
fontWeight: { value: '{fontWeights.bold.value}' },
|
|
15
|
+
},
|
|
16
|
+
// Variations
|
|
17
|
+
info: {
|
|
18
|
+
color: { value: '{colors.font.info.value}' },
|
|
19
|
+
backgroundColor: { value: '{colors.background.info.value}' },
|
|
20
|
+
},
|
|
21
|
+
error: {
|
|
22
|
+
color: { value: '{colors.font.error.value}' },
|
|
23
|
+
backgroundColor: { value: '{colors.background.error.value}' },
|
|
24
|
+
},
|
|
25
|
+
warning: {
|
|
26
|
+
color: { value: '{colors.font.warning.value}' },
|
|
27
|
+
backgroundColor: { value: '{colors.background.warning.value}' },
|
|
28
|
+
},
|
|
29
|
+
success: {
|
|
30
|
+
color: { value: '{colors.font.success.value}' },
|
|
31
|
+
backgroundColor: { value: '{colors.background.success.value}' },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { alert };
|