@thecb/components 9.3.3 → 9.3.4-beta.1
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/dist/index.cjs.js +3153 -3060
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3153 -3060
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/radio-section/InnerRadioSection.js +207 -0
- package/src/components/molecules/radio-section/InnerRadioSection.theme.js +15 -0
- package/src/components/molecules/radio-section/RadioSection.js +80 -204
- package/src/components/molecules/radio-section/RadioSection.stories.js +85 -15
- package/src/constants/index.js +2 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
3
3
|
|
|
4
4
|
import RadioSection from "./RadioSection";
|
|
5
5
|
import page from "../../../../.storybook/page";
|
|
6
|
+
import { Box } from "../../atoms/layouts";
|
|
6
7
|
|
|
7
8
|
const story = page({
|
|
8
9
|
title: "Components|Molecules/RadioSection",
|
|
@@ -43,30 +44,99 @@ const cardIconsLabel = `Accepting ${cardIcons
|
|
|
43
44
|
? ` and ${cardIcon.altText}.`
|
|
44
45
|
: ` ` + cardIcon.altText
|
|
45
46
|
)}`;
|
|
47
|
+
const groupedSections = [
|
|
48
|
+
[
|
|
49
|
+
{
|
|
50
|
+
id: "new-card-section",
|
|
51
|
+
title: "Group 1: New Card",
|
|
52
|
+
content: <p>The form to add a credit card would go here.</p>,
|
|
53
|
+
rightIconsLabel: cardIconsLabel,
|
|
54
|
+
rightIcons: cardIcons,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "new-bank-section",
|
|
59
|
+
title: "Group 1: New Bank Account",
|
|
60
|
+
content: <p>The form to add a credit card would go here.</p>,
|
|
61
|
+
required: true
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
id: "bar",
|
|
67
|
+
title: "Group 2: Bar",
|
|
68
|
+
content: <div>Content 1</div>,
|
|
69
|
+
required: true
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
{
|
|
74
|
+
id: "bar2",
|
|
75
|
+
title: "Group 3: Bar",
|
|
76
|
+
content: <div>Content 1</div>,
|
|
77
|
+
required: true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "baz",
|
|
81
|
+
title: "Group 3: Baz",
|
|
82
|
+
content: <div>Content 1</div>,
|
|
83
|
+
required: true
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
];
|
|
46
87
|
const sections = [
|
|
47
88
|
{
|
|
48
|
-
id: "new-card-section",
|
|
49
|
-
title: "New Card",
|
|
50
|
-
content: <
|
|
89
|
+
id: "new-card-section-2",
|
|
90
|
+
title: "Section 1: New Card",
|
|
91
|
+
content: <Box>The form to add a credit card would go here.</Box>,
|
|
51
92
|
rightIconsLabel: cardIconsLabel,
|
|
52
93
|
rightIcons: cardIcons,
|
|
53
94
|
required: true
|
|
54
95
|
},
|
|
55
|
-
{
|
|
56
|
-
|
|
96
|
+
{
|
|
97
|
+
id: "bar3",
|
|
98
|
+
title: "Section 1: Bar",
|
|
99
|
+
content: <div>Content 1</div>,
|
|
100
|
+
required: true
|
|
101
|
+
},
|
|
102
|
+
{ id: "baz2", title: "Section 1: Baz", content: <div>Content 2</div> }
|
|
57
103
|
];
|
|
58
104
|
|
|
59
105
|
export const radioSection = () => {
|
|
60
106
|
const [openSection, setOpenSection] = useState("");
|
|
107
|
+
const [openGroupedSection, setOpenGroupedSection] = useState("");
|
|
61
108
|
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
109
|
+
<>
|
|
110
|
+
<Box padding="0 1rem" extraStyles="text-align: center;">
|
|
111
|
+
<p>
|
|
112
|
+
Using <b>sections</b>, a flat array of section objects.
|
|
113
|
+
</p>
|
|
114
|
+
</Box>
|
|
115
|
+
<RadioSection
|
|
116
|
+
isMobile={boolean("isMobile", false, "props")}
|
|
117
|
+
supportsTouch={boolean("isMobile", false, "props")}
|
|
118
|
+
toggleOpenSection={setOpenSection}
|
|
119
|
+
openSection={openSection}
|
|
120
|
+
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
121
|
+
sections={sections}
|
|
122
|
+
isSectionRequired={true}
|
|
123
|
+
/>
|
|
124
|
+
<Box />
|
|
125
|
+
<Box padding="0 1rem" extraStyles="text-align: center;">
|
|
126
|
+
<p>
|
|
127
|
+
Using <b>groupedSections</b>, a multidimensional array of sections,
|
|
128
|
+
instead of the <b>sections</b> prop.
|
|
129
|
+
</p>
|
|
130
|
+
</Box>
|
|
131
|
+
<RadioSection
|
|
132
|
+
isMobile={boolean("isMobile", false, "props")}
|
|
133
|
+
supportsTouch={boolean("isMobile", false, "props")}
|
|
134
|
+
toggleOpenSection={setOpenGroupedSection}
|
|
135
|
+
openSection={openGroupedSection}
|
|
136
|
+
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
137
|
+
groupedSections={groupedSections}
|
|
138
|
+
isSectionRequired={true}
|
|
139
|
+
/>
|
|
140
|
+
</>
|
|
71
141
|
);
|
|
72
142
|
};
|
package/src/constants/index.js
CHANGED