@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.
@@ -1,8 +1,9 @@
1
1
  import React, { useState } from "react";
2
- import { text, boolean } from "@storybook/addon-knobs";
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: <p>The form to add a credit card would go here.</p>,
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
- { id: "bar", title: "Bar", content: <div>Content 1</div>, required: true },
56
- { id: "baz", title: "Baz", content: <div>Content 2</div> }
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
- <RadioSection
63
- isMobile={boolean("isMobile", false, "props")}
64
- supportsTouch={boolean("isMobile", false, "props")}
65
- toggleOpenSection={setOpenSection}
66
- openSection={openSection}
67
- staggeredAnimation={boolean("staggeredAnimation", false, "props")}
68
- sections={sections}
69
- isSectionRequired={true}
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
  };
@@ -1,4 +1,5 @@
1
1
  import * as colors from "./colors";
2
2
  import * as fontWeights from "./style_constants";
3
+ import * as keyboard from "./keyboard";
3
4
 
4
- export { colors, fontWeights };
5
+ export { colors, fontWeights, keyboard };