@thecb/components 10.12.6 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,56 +1,109 @@
|
|
|
1
|
-
import React, { Fragment, useState } from "react";
|
|
2
|
-
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
|
-
import { Box } from "../layouts";
|
|
4
1
|
import ButtonWithAction from "./ButtonWithAction";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
2
|
+
import { fn } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Atoms/ButtonWithAction",
|
|
6
|
+
component: ButtonWithAction,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered"
|
|
9
|
+
},
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
args: {
|
|
12
|
+
action: fn(),
|
|
13
|
+
dataQa: null,
|
|
14
|
+
textExtraStyles: "",
|
|
15
|
+
extraStyles: "",
|
|
16
|
+
extraDisabledStyles: ""
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
export const Primary = {
|
|
23
|
+
args: {
|
|
24
|
+
variant: "primary",
|
|
25
|
+
text: "Pay Now"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Secondary = {
|
|
30
|
+
args: {
|
|
31
|
+
...Primary.args,
|
|
32
|
+
variant: "secondary"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Tertiary = {
|
|
37
|
+
args: {
|
|
38
|
+
...Primary.args,
|
|
39
|
+
variant: "tertiary"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Back = {
|
|
44
|
+
args: {
|
|
45
|
+
...Primary.args,
|
|
46
|
+
variant: "back"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Danger = {
|
|
51
|
+
args: {
|
|
52
|
+
...Primary.args,
|
|
53
|
+
variant: "danger"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Ghost = {
|
|
58
|
+
args: {
|
|
59
|
+
...Primary.args,
|
|
60
|
+
variant: "ghost"
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const LoadingPrimary = {
|
|
65
|
+
args: {
|
|
66
|
+
...Primary.args,
|
|
67
|
+
isLoading: true
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const DisabledPrimary = {
|
|
72
|
+
args: {
|
|
73
|
+
...Primary.args,
|
|
74
|
+
disabled: true
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const SmallGhost = {
|
|
79
|
+
args: {
|
|
80
|
+
...Primary.args,
|
|
81
|
+
variant: "smallGhost"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const SmallPrimary = {
|
|
86
|
+
args: {
|
|
87
|
+
...Primary.args,
|
|
88
|
+
variant: "smallPrimary"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const SmallSecondary = {
|
|
93
|
+
args: {
|
|
94
|
+
...Primary.args,
|
|
95
|
+
variant: "smallSecondary"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const WhitePrimary = {
|
|
100
|
+
args: {
|
|
101
|
+
...Primary.args,
|
|
102
|
+
variant: "whitePrimary"
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const WhiteSecondary = {
|
|
107
|
+
...Primary.args,
|
|
108
|
+
variant: "whiteSecondary"
|
|
109
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as ButtonWithLinkStories from './ButtonWithLink.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={ButtonWithLinkStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
`ButtonWithLink` wraps a [ButtonWithAction](?path=/docs/atoms-buttonwithaction--docs) component with either a `ExternalLink` or `InternalLink` component, unless the `disabled` prop is `true`, then it returns just the disabled `ButtonWithAction`.
|
|
10
|
+
|
|
11
|
+
Any additional props not specified in the component params will be passed down to the underlying `ButtonWithAction` component, including the `text` prop, which will be used as the text for the button.
|
|
12
|
+
|
|
13
|
+
The underlying `ButtonWithAction` component is themeable, and the variant can be changed by passing a valid `variant` value to `ButtonWithLink`.
|
|
14
|
+
|
|
15
|
+
`extraStyles` will be passed down to the `ButtonWithAction`, while `linkExtraStyles` are passed to the `ExternalLink` or `InternalLink` component.
|
|
16
|
+
|
|
17
|
+
`fileLink` forces the use of the `ExternalLink` component, even if the value of `url` is not an full external link with a valid URL prefix like `http://`.
|
|
18
|
+
|
|
19
|
+
<Story />
|
|
20
|
+
|
|
21
|
+
<Controls />
|
|
@@ -1,32 +1,161 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
1
|
import ButtonWithLink from "./ButtonWithLink";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Atoms/ButtonWithLink",
|
|
5
|
+
component: ButtonWithLink,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "centered",
|
|
8
|
+
controls: { expanded: true }
|
|
9
|
+
},
|
|
10
|
+
tags: ["!autodocs"],
|
|
11
|
+
args: {
|
|
12
|
+
url: "/",
|
|
13
|
+
disabled: false,
|
|
14
|
+
fileLink: false,
|
|
15
|
+
extraStyles: "",
|
|
16
|
+
linkExtraStyles: "",
|
|
17
|
+
newTab: false,
|
|
18
|
+
dataQa: undefined,
|
|
19
|
+
text: "Test Button",
|
|
20
|
+
variant: "primary"
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
url: {
|
|
24
|
+
description: "URL for the button, can be interal or external",
|
|
25
|
+
control: { type: "text" },
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: "string" },
|
|
28
|
+
defaultValue: { summary: "/" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
description: "Whether or not the button is disabled",
|
|
33
|
+
control: { type: "boolean" },
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: "boolean" },
|
|
36
|
+
defaultValue: { summary: false }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
fileLink: {
|
|
40
|
+
description:
|
|
41
|
+
"Forces `ExternalLink` to be used even if `url` is an internal value",
|
|
42
|
+
control: { type: "boolean" },
|
|
43
|
+
table: {
|
|
44
|
+
type: { summary: "boolean" },
|
|
45
|
+
defaultValue: { summary: false }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
extraStyles: {
|
|
49
|
+
description: "Styles for the underlying `ButtonWithAction` component",
|
|
50
|
+
control: { type: "text" },
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: "string" },
|
|
53
|
+
defaultValue: { summary: "" }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
linkExtraStyles: {
|
|
57
|
+
description:
|
|
58
|
+
"Styles for the underlying `ExternalLink` or `InternalLink` component",
|
|
59
|
+
control: { type: "text" },
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string" },
|
|
62
|
+
defaultValue: { summary: "" }
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
newTab: {
|
|
66
|
+
description: "Whether or not the link will open in a new tab/window",
|
|
67
|
+
control: { type: "boolean" },
|
|
68
|
+
table: {
|
|
69
|
+
type: { summary: "boolean" },
|
|
70
|
+
defaultValue: { summary: false }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
dataQa: {
|
|
74
|
+
description: "`data-qa` value for the underlying link",
|
|
75
|
+
control: { type: "text" },
|
|
76
|
+
table: {
|
|
77
|
+
type: { summary: "string" },
|
|
78
|
+
defaultValue: { summary: undefined }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
text: {
|
|
82
|
+
description: "The button's text",
|
|
83
|
+
control: { type: "text" },
|
|
84
|
+
table: {
|
|
85
|
+
type: { summary: "string" },
|
|
86
|
+
defaultValue: { summary: undefined }
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
variant: {
|
|
90
|
+
description: "The button's style variant",
|
|
91
|
+
control: { type: "text" },
|
|
92
|
+
table: {
|
|
93
|
+
type: { summary: "string" },
|
|
94
|
+
defaultValue: { summary: undefined }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default meta;
|
|
101
|
+
|
|
102
|
+
export const Basic = {
|
|
103
|
+
args: {
|
|
104
|
+
url: "http://example.com"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const SecondaryVariant = {
|
|
109
|
+
args: {
|
|
110
|
+
url: "http://example.com",
|
|
111
|
+
variant: "secondary"
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Disabled = {
|
|
116
|
+
args: {
|
|
117
|
+
url: "http://example.com",
|
|
118
|
+
disabled: true
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const ExtraStyles = {
|
|
123
|
+
args: {
|
|
124
|
+
url: "http://example.com",
|
|
125
|
+
extraStyles: "border-radius: 50%"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const LinkExtraStyles = {
|
|
130
|
+
args: {
|
|
131
|
+
url: "http://example.com",
|
|
132
|
+
linkExtraStyles: "opacity: 50%;"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const FileLink = {
|
|
137
|
+
args: {
|
|
138
|
+
url: "test.pdf",
|
|
139
|
+
fileLink: true
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const NewTab = {
|
|
144
|
+
args: {
|
|
145
|
+
url: "http://example.com",
|
|
146
|
+
newTab: true
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const DataQA = {
|
|
151
|
+
args: {
|
|
152
|
+
url: "http://example.com",
|
|
153
|
+
dataQa: "important-link"
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const InternalLink = {
|
|
158
|
+
args: {
|
|
159
|
+
url: "/example"
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as CardStories from './Card.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={CardStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The Card component is a generic wrapper to create "cards" of information. A Card can contain a header, title, body text, images, and custom controls. Providing strings for header/title/body text as props results in default styling, but the component is very flexible and can be customized to display virtually any information.
|
|
10
|
+
|
|
11
|
+
Cards can take these properties to display content:
|
|
12
|
+
|
|
13
|
+
- headerText (optional)
|
|
14
|
+
- titleText (optional)
|
|
15
|
+
- text (optional)
|
|
16
|
+
- imgSrc (optional)
|
|
17
|
+
- Image (optional)
|
|
18
|
+
- children
|
|
19
|
+
|
|
20
|
+
In addition to the content props, Cards also offer certain props for controlling the style and display of provided information:
|
|
21
|
+
|
|
22
|
+
- headerAs (optional, default "h2")
|
|
23
|
+
- headerVariant (optional, default "small")
|
|
24
|
+
- imgHeight (optional, default "150px")
|
|
25
|
+
- imgObjectFit (optional, default "none")
|
|
26
|
+
- imgAltText (required for proper accessibility)
|
|
27
|
+
- titleVariant (optional, default "small")
|
|
28
|
+
- padding (optioonal, default "24px")
|
|
29
|
+
- width (optional min-width, default "276px")
|
|
30
|
+
|
|
31
|
+
By default, the width prop is the Card's _minimum_ width. The card will scale to match its width to the width of its parent container. If you wish to cap the Card's with, use the extraStyles prop like so:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
<Card extraStyles={`& { max-width: 450px };`} />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
When using a Card to display an image there are two options. Either provide a URL string using the imgSrc prop, or provide a React Component using the Image prop. These are mutually exclusive options -- an image provided using the Image prop will only be displayed if imgSrc is undefined.
|
|
38
|
+
|
|
39
|
+
<div style={{ marginBottom: "2em"}}>
|
|
40
|
+
<Story />
|
|
41
|
+
</div>
|