@thecb/components 2.2.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/.eslintrc.json +29 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/stale.yml +17 -0
- package/.prettierignore +3 -0
- package/.tool-versions +1 -0
- package/README.md +149 -0
- package/dist/cb-components.cjs.js +77 -0
- package/package.json +96 -0
- package/rollup.config.js +35 -0
- package/src/components/atoms/alert/Alert.js +67 -0
- package/src/components/atoms/alert/Alert.theme.js +71 -0
- package/src/components/atoms/alert/index.js +3 -0
- package/src/components/atoms/amount-callout/AmountCallout.js +27 -0
- package/src/components/atoms/amount-callout/AmountCallout.theme.js +19 -0
- package/src/components/atoms/amount-callout/index.js +3 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.js +50 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +25 -0
- package/src/components/atoms/breadcrumb/index.js +3 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +128 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +125 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +360 -0
- package/src/components/atoms/button-with-action/index.js +3 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.js +40 -0
- package/src/components/atoms/button-with-link/index.js +3 -0
- package/src/components/atoms/checkbox/Checkbox.js +143 -0
- package/src/components/atoms/checkbox/Checkbox.theme.js +54 -0
- package/src/components/atoms/checkbox/index.js +3 -0
- package/src/components/atoms/checkbox-list/CheckboxList.js +129 -0
- package/src/components/atoms/checkbox-list/CheckboxList.theme.js +42 -0
- package/src/components/atoms/checkbox-list/index.js +3 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.js +24 -0
- package/src/components/atoms/country-dropdown/index.js +1 -0
- package/src/components/atoms/country-dropdown/options.js +249 -0
- package/src/components/atoms/display-box/DisplayBox.js +22 -0
- package/src/components/atoms/display-box/DisplayBox.theme.js +9 -0
- package/src/components/atoms/display-box/index.js +3 -0
- package/src/components/atoms/display-card/DisplayCard.js +65 -0
- package/src/components/atoms/display-card/index.js +3 -0
- package/src/components/atoms/dropdown/Dropdown.js +299 -0
- package/src/components/atoms/dropdown/Dropdown.theme.js +9 -0
- package/src/components/atoms/dropdown/DropdownIcon.js +31 -0
- package/src/components/atoms/dropdown/index.js +3 -0
- package/src/components/atoms/form-layouts/FormContainer.js +28 -0
- package/src/components/atoms/form-layouts/FormInput.js +218 -0
- package/src/components/atoms/form-layouts/FormInputColumn.js +15 -0
- package/src/components/atoms/form-layouts/FormInputRow.js +26 -0
- package/src/components/atoms/form-layouts/FormLayouts.theme.js +52 -0
- package/src/components/atoms/form-layouts/index.js +6 -0
- package/src/components/atoms/form-select/FormSelect.js +62 -0
- package/src/components/atoms/form-select/FormSelect.styled.js +65 -0
- package/src/components/atoms/form-select/index.js +3 -0
- package/src/components/atoms/formatted-address/FormattedAddress.js +53 -0
- package/src/components/atoms/formatted-address/FormattedAddress.theme.js +11 -0
- package/src/components/atoms/formatted-address/index.js +3 -0
- package/src/components/atoms/hamburger-button/HamburgerButton.js +113 -0
- package/src/components/atoms/hamburger-button/index.js +3 -0
- package/src/components/atoms/heading/Heading.js +37 -0
- package/src/components/atoms/heading/Heading.styled.js +14 -0
- package/src/components/atoms/heading/Heading.theme.js +18 -0
- package/src/components/atoms/heading/index.js +3 -0
- package/src/components/atoms/icons/AccountsAddIcon.js +42 -0
- package/src/components/atoms/icons/AccountsIcon.js +37 -0
- package/src/components/atoms/icons/AccountsIconSmall.js +63 -0
- package/src/components/atoms/icons/ChevronIcon.js +51 -0
- package/src/components/atoms/icons/ForgotPasswordIcon.js +46 -0
- package/src/components/atoms/icons/GoToEmailIcon.js +31 -0
- package/src/components/atoms/icons/Icons.theme.js +38 -0
- package/src/components/atoms/icons/PaymentMethodIcon.js +42 -0
- package/src/components/atoms/icons/PaymentsIconSmall.js +63 -0
- package/src/components/atoms/icons/ProfileIconSmall.js +44 -0
- package/src/components/atoms/icons/PropertiesAddIcon.js +70 -0
- package/src/components/atoms/icons/PropertiesIconSmall.js +32 -0
- package/src/components/atoms/icons/SettingsIconSmall.js +63 -0
- package/src/components/atoms/icons/VerifiedEmailIcon.js +53 -0
- package/src/components/atoms/icons/index.js +28 -0
- package/src/components/atoms/index.js +33 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.js +35 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +10 -0
- package/src/components/atoms/labeled-amount/index.js +3 -0
- package/src/components/atoms/layouts/Box.js +83 -0
- package/src/components/atoms/layouts/Box.styled.js +131 -0
- package/src/components/atoms/layouts/Center.js +28 -0
- package/src/components/atoms/layouts/Center.styled.js +18 -0
- package/src/components/atoms/layouts/Cluster.js +37 -0
- package/src/components/atoms/layouts/Cluster.styled.js +21 -0
- package/src/components/atoms/layouts/Cover.js +49 -0
- package/src/components/atoms/layouts/Cover.styled.js +29 -0
- package/src/components/atoms/layouts/Frame.js +28 -0
- package/src/components/atoms/layouts/Frame.styled.js +27 -0
- package/src/components/atoms/layouts/Grid.js +38 -0
- package/src/components/atoms/layouts/Grid.styled.js +22 -0
- package/src/components/atoms/layouts/Imposter.js +52 -0
- package/src/components/atoms/layouts/Imposter.styled.js +19 -0
- package/src/components/atoms/layouts/Motion.js +51 -0
- package/src/components/atoms/layouts/Motion.styled.js +41 -0
- package/src/components/atoms/layouts/Reel.js +28 -0
- package/src/components/atoms/layouts/Reel.styled.js +17 -0
- package/src/components/atoms/layouts/Sidebar.js +42 -0
- package/src/components/atoms/layouts/Sidebar.styled.js +38 -0
- package/src/components/atoms/layouts/Stack.js +36 -0
- package/src/components/atoms/layouts/Stack.styled.js +30 -0
- package/src/components/atoms/layouts/Switcher.js +64 -0
- package/src/components/atoms/layouts/Switcher.styled.js +44 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.js +22 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.styled.js +20 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.js +27 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.styled.js +15 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.js +49 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +39 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.js +10 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.stories.js +97 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.js +49 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.stories.js +44 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.js +11 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.stories.js +87 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.js +27 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.stories.js +69 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.js +38 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.stories.js +65 -0
- package/src/components/atoms/layouts/index.js +27 -0
- package/src/components/atoms/line-item/LineItem.js +30 -0
- package/src/components/atoms/line-item/LineItem.theme.js +7 -0
- package/src/components/atoms/line-item/index.js +3 -0
- package/src/components/atoms/link/ExternalLink.js +50 -0
- package/src/components/atoms/link/ExternalLink.styled.js +26 -0
- package/src/components/atoms/link/InternalLink.js +51 -0
- package/src/components/atoms/link/InternalLink.styled.js +39 -0
- package/src/components/atoms/link/Link.theme.js +8 -0
- package/src/components/atoms/link/index.js +4 -0
- package/src/components/atoms/nav-footer/NavFooter.js +57 -0
- package/src/components/atoms/nav-footer/index.js +3 -0
- package/src/components/atoms/nav-header/NavHeader.js +36 -0
- package/src/components/atoms/nav-header/index.js +3 -0
- package/src/components/atoms/paragraph/Paragraph.js +31 -0
- package/src/components/atoms/paragraph/Paragraph.styled.js +13 -0
- package/src/components/atoms/paragraph/Paragraph.theme.js +18 -0
- package/src/components/atoms/paragraph/index.js +3 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.js +116 -0
- package/src/components/atoms/password-requirements/index.js +3 -0
- package/src/components/atoms/placeholder/Placeholder.js +122 -0
- package/src/components/atoms/placeholder/Placeholder.theme.js +9 -0
- package/src/components/atoms/placeholder/index.js +3 -0
- package/src/components/atoms/processing-fee/ProcessingFee.js +43 -0
- package/src/components/atoms/processing-fee/ProcessingFee.theme.js +7 -0
- package/src/components/atoms/processing-fee/index.js +3 -0
- package/src/components/atoms/radio-button/RadioButton.js +101 -0
- package/src/components/atoms/radio-button/RadioButton.theme.js +9 -0
- package/src/components/atoms/radio-button/index.js +3 -0
- package/src/components/atoms/solid-divider/SolidDivider.js +22 -0
- package/src/components/atoms/solid-divider/SolidDivider.theme.js +8 -0
- package/src/components/atoms/solid-divider/index.js +3 -0
- package/src/components/atoms/spinner/Spinner.js +61 -0
- package/src/components/atoms/spinner/Spinner.theme.js +5 -0
- package/src/components/atoms/spinner/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +28 -0
- package/src/components/atoms/state-province-dropdown/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/options.js +3837 -0
- package/src/components/atoms/text/Text.js +37 -0
- package/src/components/atoms/text/Text.styled.js +32 -0
- package/src/components/atoms/text/Text.theme.js +22 -0
- package/src/components/atoms/text/index.js +3 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +212 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +36 -0
- package/src/components/atoms/toggle-switch/index.js +3 -0
- package/src/components/index.js +3 -0
- package/src/components/molecules/address-form/AddressForm.js +110 -0
- package/src/components/molecules/address-form/AddressForm.state.js +52 -0
- package/src/components/molecules/address-form/index.js +11 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.js +92 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.state.js +33 -0
- package/src/components/molecules/change-password-form/index.js +11 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +126 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.theme.js +11 -0
- package/src/components/molecules/collapsible-section/index.js +3 -0
- package/src/components/molecules/edit-name-form/EditNameForm.js +51 -0
- package/src/components/molecules/edit-name-form/EditNameForm.state.js +14 -0
- package/src/components/molecules/edit-name-form/index.js +11 -0
- package/src/components/molecules/email-form/EmailForm.js +55 -0
- package/src/components/molecules/email-form/EmailForm.state.js +19 -0
- package/src/components/molecules/email-form/index.js +11 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +32 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.state.js +11 -0
- package/src/components/molecules/forgot-password-form/index.js +11 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +62 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.theme.js +7 -0
- package/src/components/molecules/highlight-tab-row/index.js +8 -0
- package/src/components/molecules/index.js +24 -0
- package/src/components/molecules/login-form/LoginForm.js +46 -0
- package/src/components/molecules/login-form/LoginForm.state.js +14 -0
- package/src/components/molecules/login-form/index.js +11 -0
- package/src/components/molecules/modal/Modal.js +138 -0
- package/src/components/molecules/modal/index.js +3 -0
- package/src/components/molecules/module/Module.js +42 -0
- package/src/components/molecules/module/Module.theme.js +30 -0
- package/src/components/molecules/module/index.js +8 -0
- package/src/components/molecules/nav-menu/NavMenu.theme.js +5 -0
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +39 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.js +63 -0
- package/src/components/molecules/nav-menu/index.js +4 -0
- package/src/components/molecules/obligation/Obligation.js +69 -0
- package/src/components/molecules/obligation/icons/AccountBillIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountDentalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountElectricIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGasIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGenericIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountWaterIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +100 -0
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +96 -0
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +100 -0
- package/src/components/molecules/obligation/icons/index.js +60 -0
- package/src/components/molecules/obligation/index.js +3 -0
- package/src/components/molecules/obligation/modules/AmountModule.js +36 -0
- package/src/components/molecules/obligation/modules/IconModule.js +29 -0
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +67 -0
- package/src/components/molecules/obligation/modules/TitleModule.js +25 -0
- package/src/components/molecules/obligation/modules/index.js +6 -0
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +80 -0
- package/src/components/molecules/payment-button-bar/index.js +3 -0
- package/src/components/molecules/payment-details/PaymentDetails.js +158 -0
- package/src/components/molecules/payment-details/PaymentDetails.theme.js +11 -0
- package/src/components/molecules/payment-details/index.js +1 -0
- package/src/components/molecules/phone-form/PhoneForm.js +44 -0
- package/src/components/molecules/phone-form/PhoneForm.state.js +17 -0
- package/src/components/molecules/phone-form/index.js +11 -0
- package/src/components/molecules/radio-section/RadioSection.js +205 -0
- package/src/components/molecules/radio-section/RadioSection.theme.js +15 -0
- package/src/components/molecules/radio-section/index.js +3 -0
- package/src/components/molecules/registration-form/RegistrationForm.js +104 -0
- package/src/components/molecules/registration-form/RegistrationForm.state.js +40 -0
- package/src/components/molecules/registration-form/index.js +11 -0
- package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.js +56 -0
- package/src/components/molecules/reset-confirmation-form/index.js +3 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.js +67 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.state.js +30 -0
- package/src/components/molecules/reset-password-form/index.js +11 -0
- package/src/components/molecules/reset-password-success/ResetPasswordSuccess.js +55 -0
- package/src/components/molecules/reset-password-success/index.js +3 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.js +92 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.theme.js +9 -0
- package/src/components/molecules/tab-sidebar/index.js +3 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +73 -0
- package/src/components/molecules/terms-and-conditions/index.js +3 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +64 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +28 -0
- package/src/components/molecules/terms-and-conditions-modal/index.js +3 -0
- package/src/components/molecules/workflow-tile/WorkflowTile.js +58 -0
- package/src/components/molecules/workflow-tile/index.js +3 -0
- package/src/components/templates/center-single/CenterSingle.js +61 -0
- package/src/components/templates/center-single/index.js +3 -0
- package/src/components/templates/center-stack/CenterStack.js +49 -0
- package/src/components/templates/center-stack/index.js +3 -0
- package/src/components/templates/default-page-template/DefaultPageTemplate.js +49 -0
- package/src/components/templates/default-page-template/index.js +3 -0
- package/src/components/templates/index.js +5 -0
- package/src/components/templates/sidebar-single-content/SidebarSingleContent.js +60 -0
- package/src/components/templates/sidebar-single-content/index.js +3 -0
- package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +81 -0
- package/src/components/templates/sidebar-stack-content/index.js +3 -0
- package/src/components/templates/templates.theme.js +5 -0
- package/src/components/withWindowSize.js +50 -0
- package/src/constants/colors.js +178 -0
- package/src/constants/regex_constants.js +1 -0
- package/src/constants/style_constants.js +21 -0
- package/src/deprecated/colors.js +154 -0
- package/src/deprecated/components/radio-button/index.js +3 -0
- package/src/deprecated/components/radio-button/radio-button.js +44 -0
- package/src/deprecated/icons/AlertErrorIcon.js +42 -0
- package/src/deprecated/icons/AlertInfoIcon.js +42 -0
- package/src/deprecated/icons/AlertSuccessIcon.js +42 -0
- package/src/deprecated/icons/AlertWarningIcon.js +36 -0
- package/src/deprecated/icons/BankIcon.js +82 -0
- package/src/deprecated/icons/GenericCard.js +39 -0
- package/src/deprecated/icons/IconAdd.js +44 -0
- package/src/deprecated/icons/IconCheck.js +23 -0
- package/src/deprecated/icons/IconCheckEmail.js +46 -0
- package/src/deprecated/icons/IconChevron.js +35 -0
- package/src/deprecated/icons/IconEmailVerified.js +62 -0
- package/src/deprecated/icons/IconEye.js +32 -0
- package/src/deprecated/icons/IconEyeSlash.js +48 -0
- package/src/deprecated/icons/IconInvalid.js +69 -0
- package/src/deprecated/icons/IconNeutral.js +27 -0
- package/src/deprecated/icons/IconQuit.js +32 -0
- package/src/deprecated/icons/IconValid.js +72 -0
- package/src/deprecated/icons/IconWarn.js +28 -0
- package/src/deprecated/icons/index.js +40 -0
- package/src/deprecated/index.js +1 -0
- package/src/deprecated/spinner/Spinner.js +68 -0
- package/src/deprecated/spinner/index.js +1 -0
- package/src/deprecated/utility/__tests__/safeConcat.spec.js +59 -0
- package/src/deprecated/utility/__tests__/validateKeyType.spec.js +116 -0
- package/src/deprecated/utility/index.js +2 -0
- package/src/deprecated/utility/safeConcat.js +10 -0
- package/src/deprecated/utility/validateKeyType.js +19 -0
- package/src/index.js +2 -0
- package/src/util/formats.js +30 -0
- package/src/util/general.js +15 -0
- package/src/util/inputValidationUtils.js +257 -0
- package/src/util/router-utils.js +23 -0
- package/src/util/themeUtils.js +144 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["plugin:prettier/recommended", "plugin:react/recommended"],
|
|
3
|
+
"plugins": ["babel", "prettier"],
|
|
4
|
+
"settings": {
|
|
5
|
+
"react": {
|
|
6
|
+
"version": "detect"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"parser": "babel-eslint",
|
|
10
|
+
"rules": {
|
|
11
|
+
"react/jsx-filename-extension": 0,
|
|
12
|
+
"react/prop-types": 0,
|
|
13
|
+
"react/display-name": 0,
|
|
14
|
+
"prettier/prettier": "error",
|
|
15
|
+
"no-unused-vars": 2,
|
|
16
|
+
"babel/camelcase": 0,
|
|
17
|
+
"camelcase": ["off"]
|
|
18
|
+
},
|
|
19
|
+
"env": {
|
|
20
|
+
"browser": true
|
|
21
|
+
},
|
|
22
|
+
"parserOptions": {
|
|
23
|
+
"ecmaVersion": 11,
|
|
24
|
+
"sourceType": "module",
|
|
25
|
+
"ecmaFeatures": {
|
|
26
|
+
"jsx": true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
A brief description of the changes and purpose of the PR.
|
|
3
|
+
|
|
4
|
+
## List of changes to be aware of:
|
|
5
|
+
- [x] ....
|
|
6
|
+
- [x] ....
|
|
7
|
+
|
|
8
|
+
## Dev Tasks
|
|
9
|
+
- [ ] specs
|
|
10
|
+
- [ ] storys
|
|
11
|
+
- [ ] lint
|
|
12
|
+
- [ ] export component in ~/src/index.js
|
|
13
|
+
|
|
14
|
+
## JIRA Task
|
|
15
|
+
[ABCD-123](https://citybase.atlassian.net/browse/ABCD-123)
|
|
16
|
+
|
|
17
|
+
## Screenshots
|
|
18
|
+
(optional)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 30
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- "Don't close"
|
|
8
|
+
# Label to use when marking an issue as stale
|
|
9
|
+
staleLabel: stale
|
|
10
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
11
|
+
markComment: >
|
|
12
|
+
This issue has been automatically marked as stale because it has not had
|
|
13
|
+
recent activity. It will be closed within seven days if no further activity
|
|
14
|
+
occurs. If it needs to remain open, add the "Don't close" label.
|
|
15
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
16
|
+
closeComment: >
|
|
17
|
+
This issue has been automatically closed because it was stale.
|
package/.prettierignore
ADDED
package/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodejs 10.15.3
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Citybase JS Components
|
|
2
|
+
|
|
3
|
+
This should be used for basic components that can be reused across applications with a standardized set of functionality hooks and props and base styles.
|
|
4
|
+
|
|
5
|
+
<!-- TOC -->
|
|
6
|
+
|
|
7
|
+
- [Setup](#setup)
|
|
8
|
+
- [Testing](#testing)
|
|
9
|
+
- [Base Styles for components](#base-styles-for-components)
|
|
10
|
+
- [Storybook](#storybook)
|
|
11
|
+
- [Storybook QA Environment](#storybook-qa-environment)
|
|
12
|
+
- [Storybook addons](#storybook-addons)
|
|
13
|
+
- [Deploying new changes](#deploying-new-changes)
|
|
14
|
+
- [Consuming in your application](#consuming-in-your-application)
|
|
15
|
+
- [Prod import](#prod-import)
|
|
16
|
+
- [Local import](#local-import)
|
|
17
|
+
- [Package.json updates](#packagejson-updates)
|
|
18
|
+
- [Circle CI needed setup](#circle-ci-needed-setup)
|
|
19
|
+
- [Using in your application](#using-in-your-application)
|
|
20
|
+
- [Wikitext Component Markdown](#wikitext-component-markdown)
|
|
21
|
+
- [Listview Component Table](#listview-component-table)
|
|
22
|
+
- [ExternalRedirect link protection library](#externalredirect-link-protection-library)
|
|
23
|
+
|
|
24
|
+
<!-- /TOC -->
|
|
25
|
+
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
- Install Node.js with [asdf](https://citybase.atlassian.net/wiki/spaces/DEV/pages/49777332/First+Time+Environment+Setup) by running `asdf install`
|
|
29
|
+
- `brew install yarn && yarn`
|
|
30
|
+
|
|
31
|
+
The following statement will inheritly be called with `yarn`, but you can run it with this command to not try to fetch new dependencies
|
|
32
|
+
|
|
33
|
+
- `yarn run build`
|
|
34
|
+
|
|
35
|
+
## Testing
|
|
36
|
+
|
|
37
|
+
- All components are to have specs with coverage to 100%.
|
|
38
|
+
- Specs are to be added to the `__tests__` folder with an extension of `.spec.js`
|
|
39
|
+
|
|
40
|
+
## Base Styles for components
|
|
41
|
+
|
|
42
|
+
- If a component needs base styles from the library to be exposed, please add to the root component folder with the extension of `.css`
|
|
43
|
+
- This will be the current direction of including styles until [IMP-857](https://citybase.atlassian.net/browse/IMP-857) is fully fleshed out and implemented.
|
|
44
|
+
|
|
45
|
+
Example directory structure -
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
citybase_js_components
|
|
49
|
+
|- .storybook-stories
|
|
50
|
+
|- component.js
|
|
51
|
+
|- src
|
|
52
|
+
|- component
|
|
53
|
+
|- __tests__
|
|
54
|
+
|- component.spec.js
|
|
55
|
+
component.css
|
|
56
|
+
component.js
|
|
57
|
+
component.types.js
|
|
58
|
+
index.js
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
CLI -
|
|
62
|
+
Run all tests and produce a code coverage report.
|
|
63
|
+
|
|
64
|
+
- `yarn test`
|
|
65
|
+
Run Jest in "watch mode" and do not produce a code coverage report. (Useful while writing new tests.)
|
|
66
|
+
- `yarn run jest --watch --coverage=false`
|
|
67
|
+
|
|
68
|
+
## Storybook
|
|
69
|
+
|
|
70
|
+
This repo uses [React Storybook](https://storybook.js.org/basics/guide-react/) for interactive component display.
|
|
71
|
+
|
|
72
|
+
### Storybook QA Environment
|
|
73
|
+
|
|
74
|
+
[https://js-assets.qa.citybase.thecb.net/](https://js-assets.qa.citybase.thecb.net/)
|
|
75
|
+
|
|
76
|
+
### Storybook addons
|
|
77
|
+
|
|
78
|
+
- [Actions](https://github.com/storybooks/storybook/tree/master/addons/actions)
|
|
79
|
+
- [Knobs](https://github.com/storybooks/storybook/tree/master/addons/knobs)
|
|
80
|
+
|
|
81
|
+
Please include new component stories as this library will also be a sandbox. **Please consider these as important as unit tests.**
|
|
82
|
+
|
|
83
|
+
- `yarn storybook`
|
|
84
|
+
- open browser to localhost:9001
|
|
85
|
+
|
|
86
|
+
## Deploying new changes
|
|
87
|
+
|
|
88
|
+
After new changes are ready to be deployed:
|
|
89
|
+
|
|
90
|
+
- `yarn build`
|
|
91
|
+
- [Tag off changes on Github](https://github.com/CityBaseInc/citybase_js_components/releases)
|
|
92
|
+
|
|
93
|
+
## Consuming in your application
|
|
94
|
+
|
|
95
|
+
### Prod import
|
|
96
|
+
|
|
97
|
+
- `npm i git+ssh://git@github.com:CityBaseInc/citybase_js_components.git#<commit-ish> --save`
|
|
98
|
+
- I would suggest using a tagged version of the component library as the default (master branch) can be unstable.
|
|
99
|
+
- Learn more about [Git urls as dependencies](https://docs.npmjs.com/files/package.json#git-urls-as-dependencies)
|
|
100
|
+
|
|
101
|
+
### Local import
|
|
102
|
+
|
|
103
|
+
- `npm i ../local/path/to/citybase_js_components --save`
|
|
104
|
+
- This should persist changes up through the consuming application so that you don't have to rebuild and re `npm install` on every change.
|
|
105
|
+
|
|
106
|
+
### Package.json updates
|
|
107
|
+
|
|
108
|
+
As the citybase_js_components is not built and delivered from a package manager, when the package is imported, it will serve up raw source files. You will likely need to update your package.json file to include any `citybase` labelled node_module package to use your babel processor.
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
// in package.json
|
|
112
|
+
{
|
|
113
|
+
test: /\.jsx?$/,
|
|
114
|
+
exclude: /node_modules\/(?!citybase).*/,
|
|
115
|
+
use: ['babel-loader'],
|
|
116
|
+
},
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Circle CI needed setup
|
|
120
|
+
|
|
121
|
+
Please follow
|
|
122
|
+
[this step by step document](https://citybase.atlassian.net/wiki/spaces/DEV/pages/276267015/How+to+set+up+CircleCI+to+have+permissions+from+multiple+repos) on how to allow CircleCI to reference multiple repositories
|
|
123
|
+
|
|
124
|
+
## Using in your application
|
|
125
|
+
|
|
126
|
+
- `import { Button } from 'citybase_js_components';`
|
|
127
|
+
- or alias the component:
|
|
128
|
+
- `import { Button as CBButton } from 'citybase_js_components';`
|
|
129
|
+
|
|
130
|
+
## Wikitext Component Markdown
|
|
131
|
+
|
|
132
|
+
The wikitext uses showdownjs to render markdown to html.
|
|
133
|
+
|
|
134
|
+
- Syntax docs can be found here: https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax
|
|
135
|
+
- Live editor: http://demo.showdownjs.com/
|
|
136
|
+
- Showdownjs documentation: https://github.com/showdownjs/showdown/wiki
|
|
137
|
+
|
|
138
|
+
## Listview Component Table
|
|
139
|
+
|
|
140
|
+
The listview component uses React-Table as the brains of the table.
|
|
141
|
+
|
|
142
|
+
- Live table: https://react-table.js.org/
|
|
143
|
+
- Documentation: https://github.com/react-tools/react-table
|
|
144
|
+
|
|
145
|
+
## ExternalRedirect link protection library
|
|
146
|
+
|
|
147
|
+
This lib helps prevent against reverse tabnabbing.
|
|
148
|
+
|
|
149
|
+
- Blankshield: https://github.com/danielstjules/blankshield
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var React = _interopDefault(require('react'));
|
|
8
|
+
var styled = _interopDefault(require('styled-components'));
|
|
9
|
+
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) {
|
|
11
|
+
if (!raw) {
|
|
12
|
+
raw = strings.slice(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
16
|
+
raw: {
|
|
17
|
+
value: Object.freeze(raw)
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
Need to add a new color? Visit http://chir.ag/projects/name-that-color to generate a color name.
|
|
24
|
+
|
|
25
|
+
Name already taken? If you can't use the existing color, then use thesaurus.com to pick a similar name
|
|
26
|
+
to the one generated by name-that-color.
|
|
27
|
+
*/
|
|
28
|
+
var PEWTER_GREY = "#DFE1E4";
|
|
29
|
+
var MARINER_BLUE = "#2E75D2";
|
|
30
|
+
|
|
31
|
+
function _templateObject2() {
|
|
32
|
+
var data = _taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n background-color: ", ";\n border-radius: 8px;\n"]);
|
|
33
|
+
|
|
34
|
+
_templateObject2 = function _templateObject2() {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _templateObject() {
|
|
42
|
+
var data = _taggedTemplateLiteral(["\n height: 24px;\n width: 24px;\n border: 1px solid\n ", ";\n border-radius: 12px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 10px;\n min-width: 24px;\n min-height: 24px;\n"]);
|
|
43
|
+
|
|
44
|
+
_templateObject = function _templateObject() {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
var defaultTheme = {
|
|
51
|
+
theme: {
|
|
52
|
+
accentColor: MARINER_BLUE,
|
|
53
|
+
inactiveColor: PEWTER_GREY
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var RadioButtonBorder = styled.div(_templateObject(), function (_ref) {
|
|
57
|
+
var isSelected = _ref.isSelected,
|
|
58
|
+
theme = _ref.theme;
|
|
59
|
+
return isSelected ? theme.accentColor : theme.inactiveColor;
|
|
60
|
+
});
|
|
61
|
+
RadioButtonBorder.defaultProps = defaultTheme;
|
|
62
|
+
var RadioButtonCenter = styled.div(_templateObject2(), function (_ref2) {
|
|
63
|
+
var theme = _ref2.theme;
|
|
64
|
+
return theme.accentColor;
|
|
65
|
+
});
|
|
66
|
+
RadioButtonCenter.defaultProps = defaultTheme;
|
|
67
|
+
|
|
68
|
+
var RadioButton = function RadioButton(_ref3) {
|
|
69
|
+
var isSelected = _ref3.isSelected,
|
|
70
|
+
name = _ref3.name;
|
|
71
|
+
return React.createElement(RadioButtonBorder, {
|
|
72
|
+
isSelected: isSelected,
|
|
73
|
+
name: name
|
|
74
|
+
}, isSelected && React.createElement(RadioButtonCenter, null));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.RadioButton = RadioButton;
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thecb/components",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "Common lib for CityBase react components",
|
|
5
|
+
"main": "dist/cb-components.cjs.js",
|
|
6
|
+
"module": "dist/cb-components.esm.js",
|
|
7
|
+
"source": "src/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rollup -c",
|
|
10
|
+
"dev": "microbundle watch"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/cb-components.git"
|
|
15
|
+
},
|
|
16
|
+
"author": "CityBase Inc.",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/CityBaseInc/cb-components/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/CityBaseInc/cb-components#readme",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/core": "^7.0.0-0",
|
|
24
|
+
"@babel/preset-env": "^7.6.0",
|
|
25
|
+
"@babel/preset-react": "^7.0.0",
|
|
26
|
+
"@babel/register": "^7.6.2",
|
|
27
|
+
"@rollup/plugin-json": "^4.0.3",
|
|
28
|
+
"@storybook/addon-a11y": "^5.3.14",
|
|
29
|
+
"@storybook/addon-actions": "^5.3.14",
|
|
30
|
+
"@storybook/addon-console": "^1.2.1",
|
|
31
|
+
"@storybook/addon-knobs": "^5.3.14",
|
|
32
|
+
"@storybook/addon-storysource": "^5.3.14",
|
|
33
|
+
"@storybook/addon-viewport": "^5.3.14",
|
|
34
|
+
"@storybook/react": "^5.3.14",
|
|
35
|
+
"babel-core": "^6.26.3",
|
|
36
|
+
"babel-eslint": "^10.1.0",
|
|
37
|
+
"babel-preset-env": "^1.7.0",
|
|
38
|
+
"babel-preset-react": "^6.24.1",
|
|
39
|
+
"connected-react-router": "^6.8.0",
|
|
40
|
+
"dompurify": "^2.0.11",
|
|
41
|
+
"eslint": "^6.8.0",
|
|
42
|
+
"eslint-config-prettier": "^6.11.0",
|
|
43
|
+
"eslint-plugin-babel": "^5.3.0",
|
|
44
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
45
|
+
"eslint-plugin-react": "^7.20.0",
|
|
46
|
+
"formatted-input": "^0.1.3",
|
|
47
|
+
"framer-motion": "^1.11.0",
|
|
48
|
+
"html-react-parser": "^0.10.3",
|
|
49
|
+
"husky": "^4.2.3",
|
|
50
|
+
"numeral": "^2.0.6",
|
|
51
|
+
"prettier": "^1.19.1",
|
|
52
|
+
"pretty-quick": "^2.0.1",
|
|
53
|
+
"react-aria-modal": "^4.0.0",
|
|
54
|
+
"react-helmet": "^6.0.0",
|
|
55
|
+
"react-pose": "^4.0.10",
|
|
56
|
+
"react-router-dom": "^5.2.0",
|
|
57
|
+
"redux-freeform": "^4.1.2",
|
|
58
|
+
"rollup": "^1.21.4",
|
|
59
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
60
|
+
"rollup-plugin-commonjs": "^10.0.0",
|
|
61
|
+
"rollup-plugin-json": "^4.0.0",
|
|
62
|
+
"rollup-plugin-node-resolve": "^5.1.0",
|
|
63
|
+
"sanctuary": "^3.0.0",
|
|
64
|
+
"storybook": "^5.3.14",
|
|
65
|
+
"styled-components": "^5.1.1",
|
|
66
|
+
"styled-media-query": "^2.1.2",
|
|
67
|
+
"styled-theming": "^2.2.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"connected-react-router": "^6.8.0",
|
|
71
|
+
"dompurify": "^2.0.11",
|
|
72
|
+
"formatted-input": "^0.1.3",
|
|
73
|
+
"framer-motion": "^1.11.0",
|
|
74
|
+
"html-react-parser": "^0.10.3",
|
|
75
|
+
"numeral": "^2.0.6",
|
|
76
|
+
"ramda": "^0.27.0",
|
|
77
|
+
"react": "^16.13.1",
|
|
78
|
+
"react-aria-modal": "^4.0.0",
|
|
79
|
+
"react-dom": "^16.13.1",
|
|
80
|
+
"react-helmet": "^6.0.0",
|
|
81
|
+
"react-is": "^16.13.1",
|
|
82
|
+
"react-pose": "^4.0.10",
|
|
83
|
+
"react-router-dom": "^5.2.0",
|
|
84
|
+
"redux-freeform": "^4.1.2",
|
|
85
|
+
"sanctuary": "^3.0.0",
|
|
86
|
+
"sanctuary-def": "^0.21.1",
|
|
87
|
+
"styled-components": ">=4.0.0",
|
|
88
|
+
"styled-media-query": ">=2.1.2",
|
|
89
|
+
"styled-theming": ">=2.2.0"
|
|
90
|
+
},
|
|
91
|
+
"husky": {
|
|
92
|
+
"hooks": {
|
|
93
|
+
"pre-commit": "pretty-quick --staged"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import resolve from "rollup-plugin-node-resolve";
|
|
2
|
+
import commonjs from "rollup-plugin-commonjs";
|
|
3
|
+
import babel from "rollup-plugin-babel";
|
|
4
|
+
import json from "rollup-plugin-json";
|
|
5
|
+
import pkg from "./package.json";
|
|
6
|
+
|
|
7
|
+
import * as reactIs from "react-is";
|
|
8
|
+
import * as sanctuary from "sanctuary";
|
|
9
|
+
import * as formattedInput from "formatted-input";
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
{
|
|
13
|
+
input: "src/index.js",
|
|
14
|
+
output: [
|
|
15
|
+
// { file: 'docs/node_modules/oah-ui/dist/index.cjs.js', format: 'cjs' },
|
|
16
|
+
{ file: pkg.module, format: "esm" }
|
|
17
|
+
],
|
|
18
|
+
plugins: [
|
|
19
|
+
resolve({ preferBuiltins: false }),
|
|
20
|
+
babel({
|
|
21
|
+
exclude: "node_modules/**",
|
|
22
|
+
presets: ["@babel/env", "@babel/preset-react"]
|
|
23
|
+
}),
|
|
24
|
+
json(),
|
|
25
|
+
commonjs({
|
|
26
|
+
include: "node_modules/**",
|
|
27
|
+
namedExports: {
|
|
28
|
+
sanctuary: Object.keys(sanctuary),
|
|
29
|
+
"formatted-input": Object.keys(formattedInput)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
],
|
|
33
|
+
external: [...Object.keys(pkg.peerDependencies || {})]
|
|
34
|
+
}
|
|
35
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AlertIcons, IconQuit } from "../../../deprecated/icons";
|
|
3
|
+
import { Box, Cluster, Stack, Cover, Sidebar } from "../layouts";
|
|
4
|
+
import Text from "../text";
|
|
5
|
+
import { fallbackValues } from "./Alert.theme";
|
|
6
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
7
|
+
|
|
8
|
+
const Alert = ({
|
|
9
|
+
heading,
|
|
10
|
+
text,
|
|
11
|
+
variant,
|
|
12
|
+
children,
|
|
13
|
+
height,
|
|
14
|
+
onLinkClick,
|
|
15
|
+
showQuitLink = true,
|
|
16
|
+
themeValues
|
|
17
|
+
}) => {
|
|
18
|
+
const Icon = AlertIcons[variant];
|
|
19
|
+
return (
|
|
20
|
+
<Box
|
|
21
|
+
padding="0.5rem"
|
|
22
|
+
width="100%"
|
|
23
|
+
minHeight="100px"
|
|
24
|
+
height={height ? height : "auto"}
|
|
25
|
+
background={themeValues.background}
|
|
26
|
+
borderRadius="4px"
|
|
27
|
+
borderColor={themeValues.border}
|
|
28
|
+
borderSize="1px"
|
|
29
|
+
>
|
|
30
|
+
<Sidebar width="24px" childGap="0rem">
|
|
31
|
+
<Box padding="0 0 0 1rem" minHeight="100%">
|
|
32
|
+
<Cover minHeight="100%" singleChild>
|
|
33
|
+
<Box padding="0" width="1.5rem" minHeight="1.5rem">
|
|
34
|
+
<Icon />
|
|
35
|
+
</Box>
|
|
36
|
+
</Cover>
|
|
37
|
+
</Box>
|
|
38
|
+
<Box padding="0">
|
|
39
|
+
<Sidebar onRight width="24px" childGap="0rem">
|
|
40
|
+
<Box padding="1rem">
|
|
41
|
+
<Cluster justify="flex-start" align="center">
|
|
42
|
+
<Stack fullHeight childGap="0.25rem">
|
|
43
|
+
<Text variant="p" color={themeValues.text} weight="600">
|
|
44
|
+
{heading}
|
|
45
|
+
</Text>
|
|
46
|
+
<Text variant="pS" color={themeValues.text}>
|
|
47
|
+
{text}
|
|
48
|
+
</Text>
|
|
49
|
+
{children}
|
|
50
|
+
</Stack>
|
|
51
|
+
</Cluster>
|
|
52
|
+
</Box>
|
|
53
|
+
<Cluster justify="flex-end" align="flex-start">
|
|
54
|
+
{showQuitLink && (
|
|
55
|
+
<Box padding="0" minHeight="100%" onClick={onLinkClick}>
|
|
56
|
+
<IconQuit />
|
|
57
|
+
</Box>
|
|
58
|
+
)}
|
|
59
|
+
</Cluster>
|
|
60
|
+
</Sidebar>
|
|
61
|
+
</Box>
|
|
62
|
+
</Sidebar>
|
|
63
|
+
</Box>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default themeComponent(Alert, "Alert", fallbackValues, "info");
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APRICOT_ORANGE,
|
|
3
|
+
INFO_BLUE,
|
|
4
|
+
BLUSH_RED,
|
|
5
|
+
HINT_GREEN,
|
|
6
|
+
ZEST_ORANGE,
|
|
7
|
+
MATISSE_BLUE,
|
|
8
|
+
RAZZMATAZZ_RED,
|
|
9
|
+
EMERALD_GREEN,
|
|
10
|
+
MUSTARD_YELLOW,
|
|
11
|
+
ONAHAU_BLUE,
|
|
12
|
+
COSMOS_RED,
|
|
13
|
+
ICE_GREEN,
|
|
14
|
+
CARROT_ORANGE,
|
|
15
|
+
CONGRESS_BLUE,
|
|
16
|
+
THUNDERBIRD_RED,
|
|
17
|
+
HAZE_GREEN,
|
|
18
|
+
ZODIAC_BLUE,
|
|
19
|
+
SCIENCE_BLUE
|
|
20
|
+
} from "../../../constants/colors";
|
|
21
|
+
|
|
22
|
+
const background = {
|
|
23
|
+
info: `${INFO_BLUE}`,
|
|
24
|
+
warn: `${APRICOT_ORANGE}`,
|
|
25
|
+
error: `${BLUSH_RED}`,
|
|
26
|
+
success: `${HINT_GREEN}`
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const border = {
|
|
30
|
+
info: `${MATISSE_BLUE}`,
|
|
31
|
+
warn: `${ZEST_ORANGE}`,
|
|
32
|
+
error: `${RAZZMATAZZ_RED}`,
|
|
33
|
+
success: `${EMERALD_GREEN}`
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const iconBackground = {
|
|
37
|
+
info: `${ONAHAU_BLUE}`,
|
|
38
|
+
warn: `${MUSTARD_YELLOW}`,
|
|
39
|
+
error: `${COSMOS_RED}`,
|
|
40
|
+
success: `${ICE_GREEN}`
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const iconFill = {
|
|
44
|
+
info: `${CONGRESS_BLUE}`,
|
|
45
|
+
warn: `${CARROT_ORANGE}`,
|
|
46
|
+
error: `${THUNDERBIRD_RED}`,
|
|
47
|
+
success: `${HAZE_GREEN}`
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const text = {
|
|
51
|
+
info: `${ZODIAC_BLUE}`,
|
|
52
|
+
warn: `${ZODIAC_BLUE}`,
|
|
53
|
+
error: `${ZODIAC_BLUE}`,
|
|
54
|
+
success: `${ZODIAC_BLUE}`
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const link = {
|
|
58
|
+
info: `${SCIENCE_BLUE}`,
|
|
59
|
+
warn: `${SCIENCE_BLUE}`,
|
|
60
|
+
error: `${SCIENCE_BLUE}`,
|
|
61
|
+
success: `${SCIENCE_BLUE}`
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const fallbackValues = {
|
|
65
|
+
background,
|
|
66
|
+
border,
|
|
67
|
+
iconBackground,
|
|
68
|
+
iconFill,
|
|
69
|
+
text,
|
|
70
|
+
link
|
|
71
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Heading from "../heading";
|
|
3
|
+
import { Box } from "../layouts";
|
|
4
|
+
import { fallbackValues } from "./AmountCallout.theme";
|
|
5
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
6
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
7
|
+
|
|
8
|
+
const AmountCallout = ({ amount, textAlign, themeValues }) => (
|
|
9
|
+
<Box padding="0" textAlign={textAlign}>
|
|
10
|
+
<Heading
|
|
11
|
+
variant="h6"
|
|
12
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
13
|
+
fontSize={themeValues.fontSize}
|
|
14
|
+
color={themeValues.color}
|
|
15
|
+
lineHeight={themeValues.lineHeight}
|
|
16
|
+
>
|
|
17
|
+
{amount}
|
|
18
|
+
</Heading>
|
|
19
|
+
</Box>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default themeComponent(
|
|
23
|
+
AmountCallout,
|
|
24
|
+
"AmountCallout",
|
|
25
|
+
fallbackValues,
|
|
26
|
+
"medium"
|
|
27
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const fontSize = {
|
|
2
|
+
large: "1.75rem",
|
|
3
|
+
medium: "1.5rem",
|
|
4
|
+
small: "1.094rem"
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const color = "#15749D";
|
|
8
|
+
|
|
9
|
+
const lineHeight = {
|
|
10
|
+
large: "2.25rem",
|
|
11
|
+
medium: "2rem",
|
|
12
|
+
small: "1.641rem"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const fallbackValues = {
|
|
16
|
+
fontSize,
|
|
17
|
+
color,
|
|
18
|
+
lineHeight
|
|
19
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { Fragment, useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { IconChevron } from "../../../deprecated/icons";
|
|
4
|
+
import { createThemeValues } from "../../../util/themeUtils";
|
|
5
|
+
import { fallbackValues } from "./Breadcrumb.theme";
|
|
6
|
+
import { InternalLink } from "../link";
|
|
7
|
+
import Cluster from "../layouts/Cluster";
|
|
8
|
+
import Box from "../layouts/Box";
|
|
9
|
+
|
|
10
|
+
const Breadcrumbs = ({ breadcrumbsList = [] }) => {
|
|
11
|
+
const themeContext = useContext(ThemeContext);
|
|
12
|
+
const themeValues = createThemeValues(
|
|
13
|
+
themeContext,
|
|
14
|
+
fallbackValues,
|
|
15
|
+
"Breadcrumb"
|
|
16
|
+
);
|
|
17
|
+
return (
|
|
18
|
+
<Box padding="0" role="region" aria-level="Breadcrumb navigation">
|
|
19
|
+
<Cluster justify="flex-start" align="center">
|
|
20
|
+
{breadcrumbsList.map(
|
|
21
|
+
({ linkText, linkDestination, isActive }, index) => (
|
|
22
|
+
<Fragment key={`breadcrumb-${linkText}`}>
|
|
23
|
+
<InternalLink
|
|
24
|
+
to={linkDestination}
|
|
25
|
+
active={isActive.toString()}
|
|
26
|
+
color={themeValues.color}
|
|
27
|
+
activeStyles={themeValues.activeColor}
|
|
28
|
+
fontSize={themeValues.fontSize}
|
|
29
|
+
lineheight={themeValues.lineHeight}
|
|
30
|
+
fontWeight={themeValues.fontWeight}
|
|
31
|
+
margin={themeValues.margin}
|
|
32
|
+
hoverStyles={themeValues.hover}
|
|
33
|
+
extraStyles={`
|
|
34
|
+
text-transform: uppercase;
|
|
35
|
+
&:first-child {
|
|
36
|
+
margin-left: 0;
|
|
37
|
+
}`}
|
|
38
|
+
>
|
|
39
|
+
{linkText}
|
|
40
|
+
</InternalLink>
|
|
41
|
+
{index < breadcrumbsList.length - 1 && <IconChevron />}
|
|
42
|
+
</Fragment>
|
|
43
|
+
)
|
|
44
|
+
)}
|
|
45
|
+
</Cluster>
|
|
46
|
+
</Box>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Breadcrumbs;
|