@thecb/components 10.12.6 → 11.0.0-beta.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/README.md +14 -6
- package/dist/index.cjs.js +1309 -1481
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1309 -1482
- package/dist/index.esm.js.map +1 -1
- package/package.json +25 -13
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/alert/Alert.mdx +19 -0
- package/src/components/atoms/alert/Alert.stories.js +148 -26
- package/src/components/atoms/badge/Badge.js +2 -2
- package/src/components/atoms/badge/Badge.mdx +27 -0
- package/src/components/atoms/badge/Badge.stories.js +143 -29
- package/src/components/atoms/breadcrumb/Breadcrumb.mdx +21 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -29
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +108 -55
- package/src/components/atoms/button-with-link/ButtonWithLink.mdx +21 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +160 -31
- package/src/components/atoms/card/Card.mdx +41 -0
- package/src/components/atoms/card/Card.stories.js +351 -0
- package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
- package/src/components/atoms/checkbox/Checkbox.oldstories.js +34 -0
- package/src/components/atoms/checkbox/Checkbox.stories.js +140 -25
- package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +61 -27
- package/src/components/atoms/detail/Detail.js +0 -26
- package/src/components/atoms/detail/Detail.mdx +32 -0
- package/src/components/atoms/detail/Detail.stories.js +156 -0
- package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
- package/src/components/atoms/display-box/DisplayBox.stories.js +65 -21
- package/src/components/atoms/display-card/DisplayCard.mdx +13 -0
- package/src/components/atoms/display-card/DisplayCard.stories.js +163 -22
- package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
- package/src/components/atoms/dropdown/Dropdown.stories.js +91 -10
- package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
- package/src/components/atoms/form-layouts/FormInput.stories.js +212 -26
- package/src/components/atoms/form-select/FormSelect.mdx +42 -0
- package/src/components/atoms/form-select/FormSelect.stories.js +55 -29
- package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
- package/src/components/atoms/formatted-address/FormattedAddress.stories.js +133 -27
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
- package/src/components/atoms/icons/Icons.mdx +40 -0
- package/src/components/atoms/icons/Icons.stories.js +325 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +110 -34
- package/src/components/atoms/line-item/LineItem.mdx +28 -0
- package/src/components/atoms/line-item/LineItem.stories.js +89 -22
- package/src/components/atoms/link/Link.mdx +19 -0
- package/src/components/atoms/link/Link.stories.js +155 -49
- package/src/components/atoms/loading/Loading.mdx +13 -0
- package/src/components/atoms/loading/Loading.stories.js +22 -0
- package/src/components/atoms/loading-line/LoadingLine.js +14 -10
- package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
- package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -28
- package/src/components/atoms/nav-footer/.DS_Store +0 -0
- package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
- package/src/components/atoms/nav-footer/NavFooter.stories.js +235 -22
- package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
- package/src/components/atoms/nav-header/NavHeader.stories.js +122 -21
- package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
- package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +108 -44
- package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
- package/src/components/atoms/placeholder/Placeholder.stories.js +164 -36
- package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
- package/src/components/atoms/searchable-select/SearchableSelect.stories.js +103 -28
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +65 -40
- package/src/components/atoms/table/Table.mdx +71 -0
- package/src/components/atoms/table/Table.oldstories.js +84 -0
- package/src/components/atoms/table/Table.stories.js +59 -75
- package/src/components/atoms/table/TableRow.js +1 -0
- package/src/components/atoms/title/Title.js +0 -23
- package/src/components/atoms/title/Title.mdx +26 -0
- package/src/components/atoms/title/Title.stories.js +144 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +103 -20
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
- package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
- package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/address-form/AddressForm.mdx +18 -0
- package/src/components/molecules/address-form/AddressForm.stories.js +223 -20
- package/src/components/molecules/banner/Banner.mdx +23 -0
- package/src/components/molecules/banner/Banner.stories.js +122 -26
- package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +203 -19
- package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +210 -61
- package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
- package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
- package/src/components/molecules/idle-modal/IdleModal.js +101 -0
- package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
- package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
- package/src/components/molecules/idle-modal/index.d.ts +16 -0
- package/src/components/molecules/idle-modal/index.js +3 -0
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/link-card/LinkCard.mdx +17 -0
- package/src/components/molecules/link-card/LinkCard.stories.js +287 -72
- package/src/components/molecules/login-form/LoginForm.mdx +16 -0
- package/src/components/molecules/login-form/LoginForm.stories.js +117 -21
- package/src/components/molecules/modal/Modal.mdx +17 -0
- package/src/components/molecules/modal/Modal.stories.js +342 -128
- package/src/components/molecules/module/Module.mdx +17 -0
- package/src/components/molecules/module/Module.stories.js +267 -25
- package/src/components/molecules/obligation/.DS_Store +0 -0
- package/src/components/molecules/obligation/Obligation.mdx +23 -0
- package/src/components/molecules/obligation/Obligation.stories.js +460 -0
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
- package/src/components/molecules/pagination/Pagination.mdx +15 -0
- package/src/components/molecules/pagination/Pagination.stories.js +177 -28
- package/src/components/molecules/popover/Popover.mdx +15 -0
- package/src/components/molecules/popover/Popover.stories.js +220 -0
- package/src/components/molecules/tabs/Tabs.mdx +17 -0
- package/src/components/molecules/tabs/Tabs.stories.js +135 -227
- package/src/components/molecules/toast-notification/Toast.mdx +15 -0
- package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
- package/src/util/idleTimerUtils.js +36 -0
- package/src/util/index.js +3 -1
- package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +0 -24
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +0 -105
- /package/src/components/atoms/add-obligation/{AddObligation.stories.js → AddObligation.oldstories.js} +0 -0
- /package/src/components/atoms/amount-callout/{AmountCallout.stories.js → AmountCallout.oldstories.js} +0 -0
- /package/src/components/atoms/checkbox-list/{CheckboxList.stories.js → CheckboxList.oldstories.js} +0 -0
- /package/src/components/atoms/form-layouts/{FormLayouts.stories.js → FormLayouts.oldstories.js} +0 -0
- /package/src/components/atoms/hamburger-button/{HamburgerButton.stories.js → HamburgerButton.oldstories.js} +0 -0
- /package/src/components/atoms/heading/{Heading.stories.js → Heading.oldstories.js} +0 -0
- /package/src/components/atoms/icons/{icons.stories.js → icons.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/box-example/{BoxExample.stories.js → BoxExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/center-example/{CenterExample.stories.js → CenterExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.stories.js → ClusterExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.stories.js → CoverExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.stories.js → FrameExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/grid-example/{GridExample.stories.js → GridExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.stories.js → ImposterExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.stories.js → MotionExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.stories.js → ReelExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.stories.js → SidebarExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/stack-example/{StackExample.stories.js → StackExample.oldstories.js} +0 -0
- /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.stories.js → SwitcherExample.oldstories.js} +0 -0
- /package/src/components/atoms/paragraph/{Paragraph.stories.js → Paragraph.oldstories.js} +0 -0
- /package/src/components/atoms/processing-fee/{ProcessingFee.stories.js → ProcessingFee.oldstories.js} +0 -0
- /package/src/components/atoms/search/{Search.stories.js → Search.oldstories.js} +0 -0
- /package/src/components/atoms/solid-divider/{SolidDivider.stories.js → SolidDivider.oldstories.js} +0 -0
- /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.stories.js → SortableTableHeading.oldstories.js} +0 -0
- /package/src/components/atoms/spinner/{Spinner.stories.js → Spinner.oldstories.js} +0 -0
- /package/src/components/atoms/tab/{Tab.stories.js → Tab.oldstories.js} +0 -0
- /package/src/components/atoms/text/{Text.stories.js → Text.oldstories.js} +0 -0
- /package/src/components/atoms/typeahead-input/{TypeaheadIinput.stories.js → TypeaheadIinput.oldstories.js} +0 -0
- /package/src/components/atoms/wallet-name/{WalletName.stories.js → WalletName.oldstories.js} +0 -0
- /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.stories.js → AccountAndRoutingModal.oldstories.js} +0 -0
- /package/src/components/molecules/editable-list/{EditableList.stories.js → EditableList.oldstories.js} +0 -0
- /package/src/components/molecules/email-form/{EmailForm.stories.js → EmailForm.oldstories.js} +0 -0
- /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.stories.js → ForgotPasswordForm.oldstories.js} +0 -0
- /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.stories.js → HighlightTabRow.oldstories.js} +0 -0
- /package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.stories.js → MultipleSelectFilter.oldstories.js} +0 -0
- /package/src/components/molecules/obligation/modules/{AmountModule.stories.js → AmountModule.oldstories.js} +0 -0
- /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.stories.js → PaymentButtonBar.oldstories.js} +0 -0
- /package/src/components/molecules/payment-details/{PaymentDetails.stories.js → PaymentDetails.oldstories.js} +0 -0
- /package/src/components/molecules/payment-form-ach/{PaymentFormACH.stories.js → PaymentFormACH.oldstories.js} +0 -0
- /package/src/components/molecules/payment-form-card/{PaymentFormCard.stories.js → PaymentFormCard.oldstories.js} +0 -0
- /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.stories.js → PeriscopeDashBoardIframe.oldstories.js} +0 -0
- /package/src/components/molecules/phone-form/{PhoneForm.stories.js → PhoneForm.oldstories.js} +0 -0
- /package/src/components/molecules/popup-menu/{PopupMenu.stories.js → PopupMenu.oldstories.js} +0 -0
- /package/src/components/molecules/radio-group/{RadioGroup.stories.js → RadioGroup.oldstories.js} +0 -0
- /package/src/components/molecules/radio-section/{RadioSection.stories.js → RadioSection.oldstories.js} +0 -0
- /package/src/components/molecules/registration-form/{RegistrationForm.stories.js → RegistrationForm.oldstories.js} +0 -0
- /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.stories.js → ResetConfirmationForm.oldstories.js} +0 -0
- /package/src/components/molecules/reset-password-form/{ResetPasswordForm.stories.js → ResetPasswordForm.oldstories.js} +0 -0
- /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.stories.js → ResetPasswordSuccess.oldstories.js} +0 -0
- /package/src/components/molecules/tab-sidebar/{TabSidebar.stories.js → TabSidebar.oldstories.js} +0 -0
- /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.stories.js → TermsAndConditions.oldstories.js} +0 -0
- /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.stories.js → TermsAndConditionsModal.oldstories.js} +0 -0
- /package/src/components/molecules/workflow-tile/{WorkflowTile.stories.js → WorkflowTile.oldstories.js} +0 -0
|
@@ -1,42 +1,76 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { connect } from "react-redux";
|
|
3
|
-
import { createFormState, required } from "redux-freeform";
|
|
4
|
-
import { Box } from "../../atoms/layouts";
|
|
5
1
|
import CountryDropdown from "./CountryDropdown";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
2
|
+
import { connect, Provider } from "react-redux";
|
|
3
|
+
import { createStore } from "redux";
|
|
4
|
+
import { createFormState, required } from "redux-freeform";
|
|
5
|
+
import React from "react";
|
|
8
6
|
|
|
9
7
|
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
10
8
|
country: {
|
|
11
9
|
validators: [required()]
|
|
12
10
|
}
|
|
13
11
|
});
|
|
12
|
+
|
|
13
|
+
const store = createStore(
|
|
14
|
+
reducer,
|
|
15
|
+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
16
|
+
);
|
|
17
|
+
|
|
14
18
|
const errorMessages = {
|
|
15
19
|
[required.error]: "country is required"
|
|
16
20
|
};
|
|
17
21
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const CountryFormWrapper = ({ fields, actions }) => (
|
|
27
|
-
<Box minHeight="300px">
|
|
28
|
-
<CountryDropdown
|
|
29
|
-
errorMessages={errorMessages}
|
|
30
|
-
options={options}
|
|
31
|
-
field={fields.country}
|
|
32
|
-
fieldActions={actions.fields.country}
|
|
33
|
-
/>
|
|
34
|
-
</Box>
|
|
22
|
+
const FormWrapper = props => (
|
|
23
|
+
<CountryDropdown
|
|
24
|
+
{...props}
|
|
25
|
+
field={props.fields.country}
|
|
26
|
+
fieldActions={props.actions.fields.country}
|
|
27
|
+
/>
|
|
35
28
|
);
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
const ConnectedForm = connect(
|
|
30
|
+
const ConnectedCountryDropdown = connect(
|
|
39
31
|
mapStateToProps,
|
|
40
32
|
mapDispatchToProps
|
|
41
|
-
)(
|
|
42
|
-
|
|
33
|
+
)(FormWrapper);
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
title: "Atoms/CountryDropdown",
|
|
37
|
+
component: ConnectedCountryDropdown,
|
|
38
|
+
tags: ["!autodocs"],
|
|
39
|
+
parameters: {
|
|
40
|
+
controls: { expanded: true }
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
errorMessages: errorMessages,
|
|
44
|
+
showErrors: undefined,
|
|
45
|
+
onChange: null,
|
|
46
|
+
labelTextWhenNoError: "Country",
|
|
47
|
+
isRequired: false,
|
|
48
|
+
dataQa: null
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
fieldActions: { type: "object" },
|
|
52
|
+
field: { type: "object" },
|
|
53
|
+
dataQa: {
|
|
54
|
+
type: "string",
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: "string" },
|
|
57
|
+
defaultValue: { summary: "CountryDropdown" }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
showErrors: {
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: "boolean" },
|
|
63
|
+
defaultValue: { summary: undefined }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
decorators: [
|
|
68
|
+
Story => (
|
|
69
|
+
<Provider store={store}>
|
|
70
|
+
<Story />
|
|
71
|
+
</Provider>
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Basic = args => <ConnectedCountryDropdown {...args} />;
|
|
@@ -10,32 +10,6 @@ import {
|
|
|
10
10
|
} from "./Detail.theme";
|
|
11
11
|
import { themeComponent } from "../../../util/themeUtils";
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
New responsive text component for Detail elements
|
|
15
|
-
(Block level text elements which are smaller than "Title" elements)
|
|
16
|
-
Size is decoupled from tag
|
|
17
|
-
Comes with four variants - "large", "regular", "small", "extraSmall"
|
|
18
|
-
Large variant results in text that is 1.125rem/1.1428rem (18px desktop, 16px mobile)
|
|
19
|
-
Regular variant results in text that is 1rem (16px desktop, 14px mobile)
|
|
20
|
-
Small variant reuslts in text that is 0.875rem/0.8571rem (14px desktop, 12px mobile)
|
|
21
|
-
ExtraSmall variant results in text that is 0.75rem/0.7142rem (12px desktop, 10px mobile)
|
|
22
|
-
|
|
23
|
-
If you need a larger font size, use the <Title /> atom, which has larger variants
|
|
24
|
-
|
|
25
|
-
Use the "as" prop to specify element type, can use any of: h1/h2/h3/h4/h5/h6/p
|
|
26
|
-
If you need an inline text element (span), use the <Text /> atom
|
|
27
|
-
The "as" value should be dictated by the structure of your page, not what font-size you want
|
|
28
|
-
|
|
29
|
-
Title / Detail both use slightly different desktop/mobile scales
|
|
30
|
-
(Mobile scale is different to allow for design-friendly px values)
|
|
31
|
-
Both atoms detect the presence of a mobile device on their own
|
|
32
|
-
and apply the corresponding scale
|
|
33
|
-
|
|
34
|
-
Mobile breakpoint value is specified in Detail.theme.js
|
|
35
|
-
|
|
36
|
-
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set all of the variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
13
|
const isBelowBreakpoint = window.innerWidth < MOBILE_BREAKPOINT;
|
|
40
14
|
const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
|
|
41
15
|
const mobileDeviceDetected = isBelowBreakpoint && isTouchDevice;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DetailStories from './Detail.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DetailStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Detail component is a responsive text component (Block level text elements which are smaller than [Title](?path=/docs/atoms-title--docs) elements).
|
|
11
|
+
|
|
12
|
+
Size is decoupled from tag. Comes with four variants - `large`, `regular`, `small`, `extraSmall`:
|
|
13
|
+
|
|
14
|
+
- Large variant results in text that is `1.125rem/1.1428rem` (`18px` desktop, `16px` mobile)
|
|
15
|
+
- Regular variant results in text that is `1rem` (`16px` desktop, `14px` mobile)
|
|
16
|
+
- Small variant reuslts in text that is `0.875rem/0.8571rem` (`14px` desktop, `12px` mobile)
|
|
17
|
+
- ExtraSmall variant results in text that is `0.75rem/0.7142rem` (`12px` desktop, `10px` mobile)
|
|
18
|
+
|
|
19
|
+
If you need a larger font size, use the [Title atom](?path=/docs/atoms-title--docs), which has larger variants
|
|
20
|
+
|
|
21
|
+
Use the "as" prop to specify element type, can use any of: `h1/h2/h3/h4/h5/h6/p`. If you need an inline text element (span), use the `<Text />` atom. The "as" value should be dictated by the structure of your page, not what font-size you want.
|
|
22
|
+
|
|
23
|
+
Title / Detail both use slightly different desktop/mobile scales. (Mobile scale is different to allow for design-friendly px values). Both atoms detect the presence of a mobile device on their own and apply the corresponding scale.
|
|
24
|
+
|
|
25
|
+
Mobile breakpoint value is specified in `Detail.theme.js`
|
|
26
|
+
|
|
27
|
+
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set all of the variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<Story />
|
|
31
|
+
|
|
32
|
+
<Controls />
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import Detail from "./Detail";
|
|
2
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
|
+
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
4
|
+
import { Box } from "../layouts";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Atoms/Detail",
|
|
8
|
+
component: Detail,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
controls: { expanded: true }
|
|
12
|
+
},
|
|
13
|
+
tags: ["!autodocs"],
|
|
14
|
+
args: {
|
|
15
|
+
weight: FONT_WEIGHT_REGULAR,
|
|
16
|
+
color: FIREFLY_GREY,
|
|
17
|
+
margin: 0,
|
|
18
|
+
textAlign: undefined,
|
|
19
|
+
extraStyles: "",
|
|
20
|
+
className: undefined,
|
|
21
|
+
variant: "regular",
|
|
22
|
+
as: "p",
|
|
23
|
+
dataQa: undefined,
|
|
24
|
+
children: "Detail Component!"
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
weight: {
|
|
28
|
+
control: { type: "text" },
|
|
29
|
+
table: {
|
|
30
|
+
type: { summary: "string" },
|
|
31
|
+
defaultValue: { summary: FONT_WEIGHT_REGULAR }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
control: { type: "text" },
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "string" },
|
|
38
|
+
defaultValue: { summary: FIREFLY_GREY }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
margin: {
|
|
42
|
+
control: { type: "text" },
|
|
43
|
+
table: {
|
|
44
|
+
type: { summary: "number | string" },
|
|
45
|
+
defaultValue: { summary: 0 }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
textAlign: {
|
|
49
|
+
control: { type: "text" },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "string" },
|
|
52
|
+
defaultValue: { summary: undefined }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
extraStyles: {
|
|
56
|
+
control: { type: "text" },
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: "string" },
|
|
59
|
+
defaultValue: { summary: undefined }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
className: {
|
|
63
|
+
control: { type: "text" },
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: "string" },
|
|
66
|
+
defaultValue: { summary: undefined }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
variant: {
|
|
70
|
+
description: "`large` `regular` `small` `extraSmall`",
|
|
71
|
+
control: { type: "text" },
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: "string" },
|
|
74
|
+
defaultValue: { summary: "large" }
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
as: {
|
|
78
|
+
description: "`h1` `h2` `h3` `h4` `h5` `h6` `p`",
|
|
79
|
+
control: { type: "text" },
|
|
80
|
+
table: {
|
|
81
|
+
type: { summary: "string" },
|
|
82
|
+
defaultValue: { summary: "h1" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
dataQa: {
|
|
86
|
+
control: { type: "text" },
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: "string" },
|
|
89
|
+
defaultValue: { summary: undefined }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
children: {
|
|
93
|
+
control: { type: "text" },
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: "string | element | array" },
|
|
96
|
+
defaultValue: { summary: undefined }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default meta;
|
|
103
|
+
|
|
104
|
+
export const Basic = {};
|
|
105
|
+
|
|
106
|
+
export const CustomWeight = {
|
|
107
|
+
args: {
|
|
108
|
+
weight: "700"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const CustomColor = {
|
|
113
|
+
args: {
|
|
114
|
+
color: "green"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const CustomMargin = {
|
|
119
|
+
args: {
|
|
120
|
+
margin: "2rem"
|
|
121
|
+
},
|
|
122
|
+
render: args => (
|
|
123
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0">
|
|
124
|
+
<Detail {...args} />
|
|
125
|
+
</Box>
|
|
126
|
+
)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const TextAlign = {
|
|
130
|
+
args: {
|
|
131
|
+
textAlign: "right"
|
|
132
|
+
},
|
|
133
|
+
render: args => (
|
|
134
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0" minWidth="400px">
|
|
135
|
+
<Detail {...args} />
|
|
136
|
+
</Box>
|
|
137
|
+
)
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const LargeVariant = {
|
|
141
|
+
args: {
|
|
142
|
+
variant: "large"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const SmallVariant = {
|
|
147
|
+
args: {
|
|
148
|
+
variant: "small"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const ExtraSmallVariant = {
|
|
153
|
+
args: {
|
|
154
|
+
variant: "extraSmall"
|
|
155
|
+
}
|
|
156
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DisplayBoxStories from './DisplayBox.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DisplayBoxStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The DisplayBox uses nested Box components with hardcoded padding and border radius values to create consistent and themeable "boxes" that wrap children with a box shadow. DisplayBox supports an "error" state with a red border via the `showErrors` prop.
|
|
10
|
+
|
|
11
|
+
<Story />
|
|
@@ -1,25 +1,69 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
3
1
|
import DisplayBox from "./DisplayBox";
|
|
2
|
+
import React from "react";
|
|
4
3
|
import FormattedAddress from "../formatted-address";
|
|
5
|
-
import page from "../../../../.storybook/page";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Atoms/DisplayBox",
|
|
7
|
+
component: DisplayBox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
controls: { expanded: true }
|
|
11
|
+
},
|
|
12
|
+
tags: ["!autodocs"],
|
|
13
|
+
args: {
|
|
14
|
+
dataQa: null,
|
|
15
|
+
children: "Display box content!"
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
dataQa: {
|
|
19
|
+
control: { type: "text" },
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: "string" },
|
|
22
|
+
defaultValue: { summary: null }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
showError: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "boolean" },
|
|
29
|
+
defaultValue: { summary: undefined }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children: {
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: "string/component" },
|
|
35
|
+
defaultValue: { summary: undefined }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
export const Basic = {
|
|
44
|
+
render: args => <DisplayBox {...args} />
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Error = {
|
|
48
|
+
args: {
|
|
49
|
+
showError: true
|
|
50
|
+
},
|
|
51
|
+
render: args => <DisplayBox {...args} />
|
|
52
|
+
};
|
|
20
53
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
export const ChildComponent = {
|
|
55
|
+
args: {
|
|
56
|
+
children: (
|
|
57
|
+
<FormattedAddress
|
|
58
|
+
qaPrefix="billing-info"
|
|
59
|
+
name="Citybase"
|
|
60
|
+
street1="30 North Lasalle"
|
|
61
|
+
city="Chicago"
|
|
62
|
+
country="USA"
|
|
63
|
+
stateProvince="Illinois"
|
|
64
|
+
zip="60606"
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
},
|
|
68
|
+
render: args => <DisplayBox {...args} />
|
|
69
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DisplayCardStories from './DisplayCard.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DisplayCardStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The DisplayCard component offers a consistent box style for text content. A link, button, or "help" text is also supported, which will be displayed with the text in a flexbox with any extra space rendered in-between. DisplayCard also supports an optional tooltip with the Popover molecule, and a title.
|
|
10
|
+
|
|
11
|
+
Note: DisplyCard is _not_ themeable or styleable except for the Popover box.
|
|
12
|
+
|
|
13
|
+
<Story />
|
|
@@ -1,24 +1,165 @@
|
|
|
1
|
+
import DisplayCard from "./DisplayCard";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
+
import { fn } from "@storybook/test";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
url
|
|
18
|
-
link
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Atoms/DisplayCard",
|
|
7
|
+
component: DisplayCard,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
controls: { expanded: true }
|
|
11
|
+
},
|
|
12
|
+
tags: ["!autodocs"],
|
|
13
|
+
args: {
|
|
14
|
+
title: "Display Card",
|
|
15
|
+
item: "Item text",
|
|
16
|
+
buttonText: undefined,
|
|
17
|
+
buttonAction: undefined,
|
|
18
|
+
url: undefined,
|
|
19
|
+
link: false,
|
|
20
|
+
helpText: undefined,
|
|
21
|
+
hasPopover: false,
|
|
22
|
+
popoverTriggerText: "",
|
|
23
|
+
popoverContent: "",
|
|
24
|
+
popoverExtraStyles: undefined,
|
|
25
|
+
popoverTextExtraStyles: undefined
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
title: {
|
|
29
|
+
description: "Text that appears above the box",
|
|
30
|
+
table: {
|
|
31
|
+
type: { summary: "string" },
|
|
32
|
+
defaultValue: { summary: undefined }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
item: {
|
|
36
|
+
description: "Text that appears in the box",
|
|
37
|
+
table: {
|
|
38
|
+
type: { summary: "string" },
|
|
39
|
+
defaultValue: { summary: undefined }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
buttonText: {
|
|
43
|
+
description: "Text for the button or link",
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: "string" },
|
|
46
|
+
defaultValue: { summary: undefined }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
buttonAction: {
|
|
50
|
+
description: "Callback function for the button",
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: "function" },
|
|
53
|
+
defaultValue: { summary: undefined }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
url: {
|
|
57
|
+
description: "URL for the link",
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: "string" },
|
|
60
|
+
defaultValue: { summary: undefined }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
link: {
|
|
64
|
+
description:
|
|
65
|
+
"Whether or not to display a link, uses the `url` and `buttonText` props",
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: "boolean" },
|
|
68
|
+
defaultValue: { summary: false }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
helpText: {
|
|
72
|
+
description:
|
|
73
|
+
"Text rendered to the right of the `item` text and styled as italic.",
|
|
74
|
+
table: {
|
|
75
|
+
type: { summary: "string" },
|
|
76
|
+
defaultValue: { summary: undefined }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
hasPopover: {
|
|
80
|
+
description: "Whether or not to render Popover component",
|
|
81
|
+
table: {
|
|
82
|
+
type: { summary: "boolean" },
|
|
83
|
+
defaultValue: { summary: false }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
popoverTriggerText: {
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: "string" },
|
|
89
|
+
defaultValue: { summary: "" }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
popoverContent: {
|
|
93
|
+
table: {
|
|
94
|
+
type: { summary: "string" },
|
|
95
|
+
defaultValue: { summary: "" }
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
popoverExtraStyles: {
|
|
99
|
+
description: "Styles for the Box that wraps the Popover content.",
|
|
100
|
+
table: {
|
|
101
|
+
type: { summary: "string" },
|
|
102
|
+
defaultValue: { summary: undefined }
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
popoverTextExtraStyles: {
|
|
106
|
+
description: "Prop passed to the Popover component, but is not used.",
|
|
107
|
+
table: {
|
|
108
|
+
type: { summary: "string" },
|
|
109
|
+
defaultValue: { summary: undefined }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default meta;
|
|
116
|
+
|
|
117
|
+
export const Basic = {
|
|
118
|
+
render: args => <DisplayCard {...args} />
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const WithLink = {
|
|
122
|
+
args: {
|
|
123
|
+
buttonText: "Link",
|
|
124
|
+
url: "https://example.com",
|
|
125
|
+
link: true
|
|
126
|
+
},
|
|
127
|
+
render: args => <DisplayCard {...args} />
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const WithButtonAction = {
|
|
131
|
+
args: {
|
|
132
|
+
buttonText: "Button",
|
|
133
|
+
buttonAction: fn()
|
|
134
|
+
},
|
|
135
|
+
render: args => <DisplayCard {...args} />
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const WithHelpText = {
|
|
139
|
+
parameters: {
|
|
140
|
+
layout: "padded"
|
|
141
|
+
},
|
|
142
|
+
args: {
|
|
143
|
+
helpText: "Help!"
|
|
144
|
+
},
|
|
145
|
+
render: args => <DisplayCard {...args} />
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const WithPopover = {
|
|
149
|
+
args: {
|
|
150
|
+
hasPopover: true,
|
|
151
|
+
popoverTriggerText: "Popover",
|
|
152
|
+
popoverContent: "This is example popover content!"
|
|
153
|
+
},
|
|
154
|
+
render: args => <DisplayCard {...args} />
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const WithPopoverAndExtraStyles = {
|
|
158
|
+
args: {
|
|
159
|
+
hasPopover: true,
|
|
160
|
+
popoverTriggerText: "Popover",
|
|
161
|
+
popoverContent: "This is example popover content!",
|
|
162
|
+
popoverExtraStyles: "padding: 4px 8px"
|
|
163
|
+
},
|
|
164
|
+
render: args => <DisplayCard {...args} />
|
|
165
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DropdownStories from './Dropdown.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DropdownStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The Dropdown component is a fully accesible (keyboard & screenreader) replacement for standard `<select/>` elements, which provides addtional features such as:
|
|
10
|
+
|
|
11
|
+
- More styling options than a `<select />`
|
|
12
|
+
- Theming
|
|
13
|
+
- Error message display
|
|
14
|
+
- Width & height settings
|
|
15
|
+
- Disabled options (via the `disabledValues` prop)
|
|
16
|
+
- Animated scrolling to the selected option when open
|
|
17
|
+
- Type ahead
|
|
18
|
+
|
|
19
|
+
Under the hood the Dropdown uses an `<input />` element to allow users to filter the available options via keyboard (TypeAhead).
|
|
20
|
+
|
|
21
|
+
<div style={{ marginBottom: "2em"}}>
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
## Controlling a Dropdown
|
|
26
|
+
|
|
27
|
+
The Dropdown component does not handle opening and closing it's own options menu, nor does it track the selected value. Both of these things are left to the app implementing the component.
|
|
28
|
+
|
|
29
|
+
### Disabled State
|
|
30
|
+
|
|
31
|
+
While the `<Dropdown />` component takes a `disabled` prop, it should be noted that this prop only effects the styles of the component.
|
|
32
|
+
|
|
33
|
+
The code below shows how a Dropdown can be controlled via hooks to manage the open state, value, and to not allow the menu to be opened when the component should be disabled.
|
|
34
|
+
|
|
35
|
+
<Story of={DropdownStories.Disabled} />
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
const DropdownWithHooks = ({ disabled = false }) => {
|
|
39
|
+
const [isOpen, setOpen] = useState(false);
|
|
40
|
+
const [value, setValue] = useState(null);
|
|
41
|
+
const [isError, setError] = useState(false);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (value === options[0].value) {
|
|
45
|
+
setError(true);
|
|
46
|
+
} else {
|
|
47
|
+
setError(false);
|
|
48
|
+
}
|
|
49
|
+
}, [value]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Dropdown
|
|
53
|
+
placeholder={options[0].text}
|
|
54
|
+
options={options}
|
|
55
|
+
disabledValues={disabledValues}
|
|
56
|
+
value={value}
|
|
57
|
+
isOpen={isOpen}
|
|
58
|
+
isError={isError}
|
|
59
|
+
onSelect={setValue}
|
|
60
|
+
onClick={() => !disabled && setOpen(!isOpen)}
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
```
|