@thecb/components 11.10.4 → 11.10.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.10.4",
3
+ "version": "11.10.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -159,7 +159,7 @@ const InnerRadioSection = ({
159
159
  <Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
160
160
  <Text
161
161
  as="label"
162
- htmlFor={`radio-input-${idString(section)}`}
162
+ htmlFor={`radio-${idString(section)}`}
163
163
  color={CHARADE_GREY}
164
164
  >
165
165
  {section.title}
@@ -0,0 +1,142 @@
1
+ import React, { useState } from "react";
2
+ import RadioSection from "./RadioSection";
3
+ import { Box } from "../../atoms/layouts";
4
+
5
+ const PaymentMethodSections = () => {
6
+ const [openSection, setOpenSection] = useState("");
7
+ return (
8
+ <RadioSection
9
+ toggleOpenSection={setOpenSection}
10
+ openSection={openSection}
11
+ isSectionRequired={true}
12
+ sections={[
13
+ {
14
+ id: "checking-1234",
15
+ title: "Checking Account ending in 1234",
16
+ content: (
17
+ <Box padding="1rem">
18
+ <p>Checking account payment details would appear here.</p>
19
+ </Box>
20
+ ),
21
+ required: true,
22
+ dataQa: "Checking Account"
23
+ },
24
+ {
25
+ id: "savings-5678",
26
+ title: "Savings Account ending in 5678",
27
+ content: (
28
+ <Box padding="1rem">
29
+ <p>Savings account payment details would appear here.</p>
30
+ </Box>
31
+ ),
32
+ required: true,
33
+ dataQa: "Savings Account"
34
+ },
35
+ {
36
+ id: "card-4321",
37
+ title: "Card ending in 4321",
38
+ content: (
39
+ <Box padding="1rem">
40
+ <p>Credit card payment details would appear here.</p>
41
+ </Box>
42
+ ),
43
+ required: true,
44
+ dataQa: "Credit Card"
45
+ }
46
+ ]}
47
+ />
48
+ );
49
+ };
50
+
51
+ const BasicSections = () => {
52
+ const [openSection, setOpenSection] = useState("");
53
+ return (
54
+ <RadioSection
55
+ toggleOpenSection={setOpenSection}
56
+ openSection={openSection}
57
+ sections={[
58
+ {
59
+ id: "section-a",
60
+ title: "Section A",
61
+ content: (
62
+ <Box padding="1rem">
63
+ <p>Content for section A</p>
64
+ </Box>
65
+ )
66
+ },
67
+ {
68
+ id: "section-b",
69
+ title: "Section B",
70
+ content: (
71
+ <Box padding="1rem">
72
+ <p>Content for section B</p>
73
+ </Box>
74
+ )
75
+ },
76
+ {
77
+ id: "section-c",
78
+ title: "Section C",
79
+ content: (
80
+ <Box padding="1rem">
81
+ <p>Content for section C</p>
82
+ </Box>
83
+ )
84
+ }
85
+ ]}
86
+ />
87
+ );
88
+ };
89
+
90
+ const WithDisabledSection = () => {
91
+ const [openSection, setOpenSection] = useState("");
92
+ return (
93
+ <RadioSection
94
+ toggleOpenSection={setOpenSection}
95
+ openSection={openSection}
96
+ sections={[
97
+ {
98
+ id: "enabled-section",
99
+ title: "Enabled Option",
100
+ content: (
101
+ <Box padding="1rem">
102
+ <p>This option is selectable.</p>
103
+ </Box>
104
+ )
105
+ },
106
+ {
107
+ id: "disabled-section",
108
+ title: "Disabled Option",
109
+ disabled: true,
110
+ content: (
111
+ <Box padding="1rem">
112
+ <p>This option is disabled.</p>
113
+ </Box>
114
+ )
115
+ }
116
+ ]}
117
+ />
118
+ );
119
+ };
120
+
121
+ const meta = {
122
+ title: "Molecules/RadioSection",
123
+ component: RadioSection,
124
+ parameters: {
125
+ layout: "centered"
126
+ },
127
+ tags: ["!autodocs"]
128
+ };
129
+
130
+ export default meta;
131
+
132
+ export const PaymentMethods = {
133
+ render: () => <PaymentMethodSections />
134
+ };
135
+
136
+ export const Basic = {
137
+ render: () => <BasicSections />
138
+ };
139
+
140
+ export const Disabled = {
141
+ render: () => <WithDisabledSection />
142
+ };
@@ -54,7 +54,7 @@ const TermsAndConditionsModal = ({
54
54
  weight={themeValues.fontWeight}
55
55
  hoverStyles={themeValues.modalLinkHoverFocus}
56
56
  textDecoration={themeValues.modalLinkTextDecoration}
57
- extraStyles={`display: inline-block; width: fit-content; cursor: pointer`}
57
+ extraStyles={`display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px;`}
58
58
  role="button" // This should always be a "button" since it opens a modal
59
59
  className="modal-trigger"
60
60
  >
@@ -0,0 +1,110 @@
1
+ import React from "react";
2
+ import TermsAndConditionsModal from "./TermsAndConditionsModal";
3
+
4
+ const TermsContent = () => (
5
+ <p>
6
+ By enrolling, you agree to the automatic payment terms. Payments will be
7
+ processed on the first of each month using your selected payment method. You
8
+ may cancel at any time by contacting support. See our{" "}
9
+ <a href="#">Privacy Policy</a> for more details.
10
+ </p>
11
+ );
12
+
13
+ const meta = {
14
+ title: "Molecules/TermsAndConditionsModal",
15
+ component: TermsAndConditionsModal,
16
+ parameters: {
17
+ layout: "centered"
18
+ },
19
+ tags: ["!autodocs"],
20
+ args: {
21
+ link: "Terms and Conditions",
22
+ title: "Terms and Conditions",
23
+ terms: <TermsContent />,
24
+ isOpen: false,
25
+ linkVariant: "p",
26
+ initialFocusSelector: "[name='Cancel']"
27
+ },
28
+ argTypes: {
29
+ link: {
30
+ description: "Text displayed for the modal trigger link",
31
+ table: {
32
+ type: { summary: "string" },
33
+ defaultValue: { summary: "Terms and Conditions" }
34
+ }
35
+ },
36
+ title: {
37
+ description: "Title displayed in the modal header",
38
+ table: {
39
+ type: { summary: "string" },
40
+ defaultValue: { summary: "Terms & Conditions" }
41
+ }
42
+ },
43
+ isOpen: {
44
+ description: "Whether the modal is currently open",
45
+ table: {
46
+ type: { summary: "boolean" },
47
+ defaultValue: { summary: false }
48
+ }
49
+ },
50
+ acceptText: {
51
+ description:
52
+ "Text for the accept button. If omitted, only a close button is shown.",
53
+ table: {
54
+ type: { summary: "string" },
55
+ defaultValue: { summary: undefined }
56
+ }
57
+ },
58
+ linkVariant: {
59
+ description: "Text size variant for the trigger link",
60
+ control: "select",
61
+ options: ["p", "pL", "pS", "pXS", "pXXS", "pXL"],
62
+ table: {
63
+ type: { summary: "string" },
64
+ defaultValue: { summary: "p" }
65
+ }
66
+ },
67
+ initialFocusSelector: {
68
+ description: "CSS selector for the element that receives initial focus",
69
+ table: {
70
+ type: { summary: "string" },
71
+ defaultValue: { summary: "" }
72
+ }
73
+ }
74
+ }
75
+ };
76
+
77
+ export default meta;
78
+
79
+ export const Default = {};
80
+
81
+ export const SmallVariant = {
82
+ args: {
83
+ linkVariant: "pS"
84
+ }
85
+ };
86
+
87
+ export const ExtraSmallVariant = {
88
+ args: {
89
+ linkVariant: "pXS"
90
+ }
91
+ };
92
+
93
+ export const LargeVariant = {
94
+ args: {
95
+ linkVariant: "pL"
96
+ }
97
+ };
98
+
99
+ export const WithAcceptButton = {
100
+ args: {
101
+ acceptText: "I Accept"
102
+ }
103
+ };
104
+
105
+ export const CustomLinkText = {
106
+ args: {
107
+ link: "Learn More",
108
+ linkVariant: "pS"
109
+ }
110
+ };