@thecb/components 11.10.5 → 11.10.7

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.5",
3
+ "version": "11.10.7",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -23,6 +23,7 @@ const EditableList = ({
23
23
  titleWeight = "400",
24
24
  canAdd = true,
25
25
  addItem,
26
+ addItemDestination,
26
27
  removeItem,
27
28
  editItem,
28
29
  itemName,
@@ -168,6 +169,8 @@ const EditableList = ({
168
169
  <Box padding={items.length === 0 ? "0" : "1rem 0 0"}>
169
170
  <Placeholder
170
171
  text={addText}
172
+ isLink={!!addItemDestination}
173
+ destination={addItemDestination}
171
174
  action={addItem}
172
175
  dataQa={"Add " + qaPrefix}
173
176
  aria-label={addText}
@@ -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
+ };