@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.
Files changed (179) hide show
  1. package/README.md +14 -6
  2. package/dist/index.cjs.js +1309 -1481
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +1309 -1482
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +25 -13
  7. package/src/.DS_Store +0 -0
  8. package/src/components/.DS_Store +0 -0
  9. package/src/components/atoms/.DS_Store +0 -0
  10. package/src/components/atoms/alert/Alert.mdx +19 -0
  11. package/src/components/atoms/alert/Alert.stories.js +148 -26
  12. package/src/components/atoms/badge/Badge.js +2 -2
  13. package/src/components/atoms/badge/Badge.mdx +27 -0
  14. package/src/components/atoms/badge/Badge.stories.js +143 -29
  15. package/src/components/atoms/breadcrumb/Breadcrumb.mdx +21 -0
  16. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -29
  17. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +108 -55
  18. package/src/components/atoms/button-with-link/ButtonWithLink.mdx +21 -0
  19. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +160 -31
  20. package/src/components/atoms/card/Card.mdx +41 -0
  21. package/src/components/atoms/card/Card.stories.js +351 -0
  22. package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
  23. package/src/components/atoms/checkbox/Checkbox.oldstories.js +34 -0
  24. package/src/components/atoms/checkbox/Checkbox.stories.js +140 -25
  25. package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
  26. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +61 -27
  27. package/src/components/atoms/detail/Detail.js +0 -26
  28. package/src/components/atoms/detail/Detail.mdx +32 -0
  29. package/src/components/atoms/detail/Detail.stories.js +156 -0
  30. package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
  31. package/src/components/atoms/display-box/DisplayBox.stories.js +65 -21
  32. package/src/components/atoms/display-card/DisplayCard.mdx +13 -0
  33. package/src/components/atoms/display-card/DisplayCard.stories.js +163 -22
  34. package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
  35. package/src/components/atoms/dropdown/Dropdown.stories.js +91 -10
  36. package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
  37. package/src/components/atoms/form-layouts/FormInput.stories.js +212 -26
  38. package/src/components/atoms/form-select/FormSelect.mdx +42 -0
  39. package/src/components/atoms/form-select/FormSelect.stories.js +55 -29
  40. package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
  41. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +133 -27
  42. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
  43. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
  44. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
  45. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
  46. package/src/components/atoms/icons/Icons.mdx +40 -0
  47. package/src/components/atoms/icons/Icons.stories.js +325 -0
  48. package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
  49. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +110 -34
  50. package/src/components/atoms/line-item/LineItem.mdx +28 -0
  51. package/src/components/atoms/line-item/LineItem.stories.js +89 -22
  52. package/src/components/atoms/link/Link.mdx +19 -0
  53. package/src/components/atoms/link/Link.stories.js +155 -49
  54. package/src/components/atoms/loading/Loading.mdx +13 -0
  55. package/src/components/atoms/loading/Loading.stories.js +22 -0
  56. package/src/components/atoms/loading-line/LoadingLine.js +14 -10
  57. package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
  58. package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -28
  59. package/src/components/atoms/nav-footer/.DS_Store +0 -0
  60. package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
  61. package/src/components/atoms/nav-footer/NavFooter.stories.js +235 -22
  62. package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
  63. package/src/components/atoms/nav-header/NavHeader.stories.js +122 -21
  64. package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
  65. package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
  66. package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
  67. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +108 -44
  68. package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
  69. package/src/components/atoms/placeholder/Placeholder.stories.js +164 -36
  70. package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
  71. package/src/components/atoms/searchable-select/SearchableSelect.stories.js +103 -28
  72. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
  73. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +65 -40
  74. package/src/components/atoms/table/Table.mdx +71 -0
  75. package/src/components/atoms/table/Table.oldstories.js +84 -0
  76. package/src/components/atoms/table/Table.stories.js +59 -75
  77. package/src/components/atoms/table/TableRow.js +1 -0
  78. package/src/components/atoms/title/Title.js +0 -23
  79. package/src/components/atoms/title/Title.mdx +26 -0
  80. package/src/components/atoms/title/Title.stories.js +144 -0
  81. package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
  82. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +103 -20
  83. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
  84. package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
  85. package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
  86. package/src/components/molecules/.DS_Store +0 -0
  87. package/src/components/molecules/address-form/AddressForm.mdx +18 -0
  88. package/src/components/molecules/address-form/AddressForm.stories.js +223 -20
  89. package/src/components/molecules/banner/Banner.mdx +23 -0
  90. package/src/components/molecules/banner/Banner.stories.js +122 -26
  91. package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
  92. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +203 -19
  93. package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
  94. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +210 -61
  95. package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
  96. package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
  97. package/src/components/molecules/idle-modal/IdleModal.js +101 -0
  98. package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
  99. package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
  100. package/src/components/molecules/idle-modal/index.d.ts +16 -0
  101. package/src/components/molecules/idle-modal/index.js +3 -0
  102. package/src/components/molecules/index.js +1 -0
  103. package/src/components/molecules/link-card/LinkCard.mdx +17 -0
  104. package/src/components/molecules/link-card/LinkCard.stories.js +287 -72
  105. package/src/components/molecules/login-form/LoginForm.mdx +16 -0
  106. package/src/components/molecules/login-form/LoginForm.stories.js +117 -21
  107. package/src/components/molecules/modal/Modal.mdx +17 -0
  108. package/src/components/molecules/modal/Modal.stories.js +342 -128
  109. package/src/components/molecules/module/Module.mdx +17 -0
  110. package/src/components/molecules/module/Module.stories.js +267 -25
  111. package/src/components/molecules/obligation/.DS_Store +0 -0
  112. package/src/components/molecules/obligation/Obligation.mdx +23 -0
  113. package/src/components/molecules/obligation/Obligation.stories.js +460 -0
  114. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
  115. package/src/components/molecules/pagination/Pagination.mdx +15 -0
  116. package/src/components/molecules/pagination/Pagination.stories.js +177 -28
  117. package/src/components/molecules/popover/Popover.mdx +15 -0
  118. package/src/components/molecules/popover/Popover.stories.js +220 -0
  119. package/src/components/molecules/tabs/Tabs.mdx +17 -0
  120. package/src/components/molecules/tabs/Tabs.stories.js +135 -227
  121. package/src/components/molecules/toast-notification/Toast.mdx +15 -0
  122. package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
  123. package/src/util/idleTimerUtils.js +36 -0
  124. package/src/util/index.js +3 -1
  125. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +0 -24
  126. package/src/components/molecules/toast-notification/ToastNotification.stories.js +0 -105
  127. /package/src/components/atoms/add-obligation/{AddObligation.stories.js → AddObligation.oldstories.js} +0 -0
  128. /package/src/components/atoms/amount-callout/{AmountCallout.stories.js → AmountCallout.oldstories.js} +0 -0
  129. /package/src/components/atoms/checkbox-list/{CheckboxList.stories.js → CheckboxList.oldstories.js} +0 -0
  130. /package/src/components/atoms/form-layouts/{FormLayouts.stories.js → FormLayouts.oldstories.js} +0 -0
  131. /package/src/components/atoms/hamburger-button/{HamburgerButton.stories.js → HamburgerButton.oldstories.js} +0 -0
  132. /package/src/components/atoms/heading/{Heading.stories.js → Heading.oldstories.js} +0 -0
  133. /package/src/components/atoms/icons/{icons.stories.js → icons.oldstories.js} +0 -0
  134. /package/src/components/atoms/layouts/examples/box-example/{BoxExample.stories.js → BoxExample.oldstories.js} +0 -0
  135. /package/src/components/atoms/layouts/examples/center-example/{CenterExample.stories.js → CenterExample.oldstories.js} +0 -0
  136. /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.stories.js → ClusterExample.oldstories.js} +0 -0
  137. /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.stories.js → CoverExample.oldstories.js} +0 -0
  138. /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.stories.js → FrameExample.oldstories.js} +0 -0
  139. /package/src/components/atoms/layouts/examples/grid-example/{GridExample.stories.js → GridExample.oldstories.js} +0 -0
  140. /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.stories.js → ImposterExample.oldstories.js} +0 -0
  141. /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.stories.js → MotionExample.oldstories.js} +0 -0
  142. /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.stories.js → ReelExample.oldstories.js} +0 -0
  143. /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.stories.js → SidebarExample.oldstories.js} +0 -0
  144. /package/src/components/atoms/layouts/examples/stack-example/{StackExample.stories.js → StackExample.oldstories.js} +0 -0
  145. /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.stories.js → SwitcherExample.oldstories.js} +0 -0
  146. /package/src/components/atoms/paragraph/{Paragraph.stories.js → Paragraph.oldstories.js} +0 -0
  147. /package/src/components/atoms/processing-fee/{ProcessingFee.stories.js → ProcessingFee.oldstories.js} +0 -0
  148. /package/src/components/atoms/search/{Search.stories.js → Search.oldstories.js} +0 -0
  149. /package/src/components/atoms/solid-divider/{SolidDivider.stories.js → SolidDivider.oldstories.js} +0 -0
  150. /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.stories.js → SortableTableHeading.oldstories.js} +0 -0
  151. /package/src/components/atoms/spinner/{Spinner.stories.js → Spinner.oldstories.js} +0 -0
  152. /package/src/components/atoms/tab/{Tab.stories.js → Tab.oldstories.js} +0 -0
  153. /package/src/components/atoms/text/{Text.stories.js → Text.oldstories.js} +0 -0
  154. /package/src/components/atoms/typeahead-input/{TypeaheadIinput.stories.js → TypeaheadIinput.oldstories.js} +0 -0
  155. /package/src/components/atoms/wallet-name/{WalletName.stories.js → WalletName.oldstories.js} +0 -0
  156. /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.stories.js → AccountAndRoutingModal.oldstories.js} +0 -0
  157. /package/src/components/molecules/editable-list/{EditableList.stories.js → EditableList.oldstories.js} +0 -0
  158. /package/src/components/molecules/email-form/{EmailForm.stories.js → EmailForm.oldstories.js} +0 -0
  159. /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.stories.js → ForgotPasswordForm.oldstories.js} +0 -0
  160. /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.stories.js → HighlightTabRow.oldstories.js} +0 -0
  161. /package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.stories.js → MultipleSelectFilter.oldstories.js} +0 -0
  162. /package/src/components/molecules/obligation/modules/{AmountModule.stories.js → AmountModule.oldstories.js} +0 -0
  163. /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.stories.js → PaymentButtonBar.oldstories.js} +0 -0
  164. /package/src/components/molecules/payment-details/{PaymentDetails.stories.js → PaymentDetails.oldstories.js} +0 -0
  165. /package/src/components/molecules/payment-form-ach/{PaymentFormACH.stories.js → PaymentFormACH.oldstories.js} +0 -0
  166. /package/src/components/molecules/payment-form-card/{PaymentFormCard.stories.js → PaymentFormCard.oldstories.js} +0 -0
  167. /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.stories.js → PeriscopeDashBoardIframe.oldstories.js} +0 -0
  168. /package/src/components/molecules/phone-form/{PhoneForm.stories.js → PhoneForm.oldstories.js} +0 -0
  169. /package/src/components/molecules/popup-menu/{PopupMenu.stories.js → PopupMenu.oldstories.js} +0 -0
  170. /package/src/components/molecules/radio-group/{RadioGroup.stories.js → RadioGroup.oldstories.js} +0 -0
  171. /package/src/components/molecules/radio-section/{RadioSection.stories.js → RadioSection.oldstories.js} +0 -0
  172. /package/src/components/molecules/registration-form/{RegistrationForm.stories.js → RegistrationForm.oldstories.js} +0 -0
  173. /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.stories.js → ResetConfirmationForm.oldstories.js} +0 -0
  174. /package/src/components/molecules/reset-password-form/{ResetPasswordForm.stories.js → ResetPasswordForm.oldstories.js} +0 -0
  175. /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.stories.js → ResetPasswordSuccess.oldstories.js} +0 -0
  176. /package/src/components/molecules/tab-sidebar/{TabSidebar.stories.js → TabSidebar.oldstories.js} +0 -0
  177. /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.stories.js → TermsAndConditions.oldstories.js} +0 -0
  178. /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.stories.js → TermsAndConditionsModal.oldstories.js} +0 -0
  179. /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 page from "../../../../.storybook/page";
6
-
7
- const variantsLabel = "variant";
8
- const variants = {
9
- primary: "primary",
10
- secondary: "secondary",
11
- back: "back",
12
- smallPrimary: "smallPrimary",
13
- smallSecondary: "smallSecondary",
14
- ghost: "ghost",
15
- smallGhost: "smallGhost",
16
- tertiary: "tertiary",
17
- danger: "danger",
18
- dangerSecondary: "dangerSecondary",
19
- whiteSecondary: "whiteSecondary",
20
- whitePrimary: "whitePrimary",
21
- None: undefined
22
- };
23
- const defaultValue = "primary";
24
- const groupId = "props";
25
-
26
- const buttonHandler = () => window.alert("Button click!");
27
-
28
- export const buttonWithAction = () => (
29
- <Fragment>
30
- {/* Uncomment to view buttons on a dark background */}
31
- {/* <Box extraStyles="background-color: #000;">
32
- <ButtonWithAction
33
- variant={select(variantsLabel, variants, defaultValue, groupId)}
34
- disabled={boolean("disabled", false, "props")}
35
- text={text("text", "button", "props")}
36
- isLoading={boolean("isLoading", false, "props")}
37
- action={text("action", buttonHandler, "props")}
38
- />
39
- </Box> */}
40
- <Box extraStyles="background-color: #fff;">
41
- <ButtonWithAction
42
- variant={select(variantsLabel, variants, defaultValue, groupId)}
43
- disabled={boolean("disabled", false, "props")}
44
- text={text("text", "button", "props")}
45
- isLoading={boolean("isLoading", false, "props")}
46
- action={text("action", buttonHandler, "props")}
47
- />
48
- </Box>
49
- </Fragment>
50
- );
51
-
52
- const story = page({
53
- title: "Components|Atoms/ButtonWithAction",
54
- Component: ButtonWithAction
55
- });
56
- export default story;
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
- import page from "../../../../.storybook/page";
5
-
6
- const variants = {
7
- primary: "primary",
8
- secondary: "secondary",
9
- back: "back",
10
- smallPrimary: "smallPrimary",
11
- smallSecondary: "smallSecondary",
12
- ghost: "ghost",
13
- smallGhost: "smallGhost",
14
- danger: "danger",
15
- None: undefined
16
- };
17
-
18
- export const buttonWithLink = () => (
19
- <ButtonWithLink
20
- variant={select("variant", variants, "primary", "props")}
21
- url={text("url", "/login", "props")}
22
- disabled={boolean("disabled", false, "props")}
23
- extraStyles={text("extraStyles", "", "props")}
24
- text={text("text", "Lorem", "props")}
25
- />
26
- );
27
-
28
- const story = page({
29
- title: "Components|Atoms/ButtonWithLink",
30
- Component: ButtonWithLink
31
- });
32
- export default story;
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>