@thecb/components 9.3.4-beta.1 → 9.3.5-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.
Files changed (26) hide show
  1. package/dist/index.cjs.js +3148 -3196
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +3148 -3196
  4. package/dist/index.esm.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/components/atoms/labeled-amount/LabeledAmount.js +7 -32
  7. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +13 -0
  8. package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +7 -1
  9. package/src/components/atoms/labeled-amount/LabeledAmountV1.js +37 -0
  10. package/src/components/atoms/labeled-amount/LabeledAmountV2.js +34 -0
  11. package/src/components/atoms/line-item/LineItem.js +21 -35
  12. package/src/components/atoms/line-item/LineItem.theme.js +2 -2
  13. package/src/components/molecules/modal/Modal.js +3 -3
  14. package/src/components/molecules/payment-details/PaymentDetails.js +14 -13
  15. package/src/components/molecules/payment-details/PaymentDetails.stories.js +36 -0
  16. package/src/components/molecules/payment-details/PaymentDetails.theme.js +2 -2
  17. package/src/components/molecules/radio-section/RadioSection.js +204 -80
  18. package/src/components/molecules/radio-section/RadioSection.stories.js +15 -85
  19. package/src/constants/index.js +1 -2
  20. package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
  21. package/src/.DS_Store +0 -0
  22. package/src/components/.DS_Store +0 -0
  23. package/src/components/atoms/.DS_Store +0 -0
  24. package/src/components/atoms/icons/.DS_Store +0 -0
  25. package/src/components/molecules/radio-section/InnerRadioSection.js +0 -207
  26. package/src/components/molecules/radio-section/InnerRadioSection.theme.js +0 -15
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file
@@ -1,207 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import styled from "styled-components";
3
- import { themeComponent } from "../../../util/themeUtils";
4
- import { fallbackValues } from "./InnerRadioSection.theme";
5
- import { AnimatePresence } from "framer-motion";
6
- import RadioButton from "./radio-button/RadioButton";
7
- import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
8
- import { createIdFromString, noop } from "../../../util/general";
9
- import Text from "../../atoms/text";
10
- import { CHARADE_GREY } from "../../../constants/colors";
11
-
12
- const idString = section =>
13
- typeof section.title === "string"
14
- ? createIdFromString(section.title)
15
- : section.id;
16
-
17
- const InnerRadioSection = ({
18
- themeValues,
19
- isMobile,
20
- supportsTouch,
21
- section,
22
- sectionIndex,
23
- openSection = "",
24
- toggleOpenSection,
25
- staggeredAnimation = false,
26
- initiallyOpen = true,
27
- openHeight = "auto",
28
- ariaDescribedBy,
29
- focused,
30
- setFocused,
31
- sectionRefs,
32
- ariaLabelledBy,
33
- onKeyDown = noop
34
- }) => {
35
- const wrapper = {
36
- open: {
37
- height: openHeight,
38
- opacity: 1,
39
- transition: {
40
- duration: 0.3,
41
- ease: [0.04, 0.62, 0.23, 0.98],
42
- staggerChildren: staggeredAnimation ? 0.15 : 0
43
- }
44
- },
45
- closed: {
46
- height: 0,
47
- opacity: 0,
48
- transition: {
49
- duration: 0.3,
50
- ease: [0.04, 0.62, 0.23, 0.98],
51
- staggerChildren: staggeredAnimation ? 0.15 : 0,
52
- staggerDirection: -1
53
- }
54
- }
55
- };
56
-
57
- const borderStyles = `
58
- border-width: 0 0 1px 0;
59
- border-color: ${themeValues.borderColor};
60
- border-style: solid;
61
- border-radius: 0px;
62
- transform-origin: 100% 0;
63
-
64
- &:last-child {
65
- border-width: 0;
66
- }
67
- `;
68
-
69
- const RightIcon = styled.img`
70
- height: ${({ isMobile }) => (isMobile ? "14px" : "18px")};
71
- width: ${({ isMobile }) => (isMobile ? "22px" : "28px")};
72
- ${({ fade }) => fade && "opacity: 0.4;"}
73
- transition: opacity 0.3s ease;
74
- `;
75
-
76
- return (
77
- <Motion
78
- tabIndex={section.hideRadioButton || section.disabled ? "-1" : "0"}
79
- ref={sectionRefs.current[sectionIndex]}
80
- onBlur={() => !section.disabled && setFocused(null)}
81
- onFocus={() => !section.disabled && setFocused(section.id)}
82
- onKeyDown={onKeyDown} // DIFFERENT
83
- hoverStyles={themeValues.focusStyles}
84
- animate={openSection === section.id ? "open" : "closed"}
85
- initial={initiallyOpen ? "open" : "closed"}
86
- key={`item-${section.id}`}
87
- extraStyles={borderStyles}
88
- role="radio"
89
- aria-checked={openSection === section.id}
90
- aria-disabled={section.disabled}
91
- aria-required={section.required}
92
- aria-labelledby={ariaLabelledBy} // THIS PROP NOT PASSED ON GROUPED MODEL - check if you can add it without consequence
93
- aria-describedby={ariaDescribedBy} // THIS PROP NOT PASSED ON GROUPED MODEL - check if you can add it without consequence
94
- >
95
- <Stack childGap="0">
96
- <Box
97
- padding={section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem"}
98
- background={
99
- section.disabled
100
- ? themeValues.headingDisabledColor
101
- : themeValues.headingBackgroundColor
102
- }
103
- onClick={
104
- (isMobile && supportsTouch) || section.disabled
105
- ? noop
106
- : () => toggleOpenSection(section.id)
107
- }
108
- onTouchEnd={
109
- isMobile && supportsTouch && !section.disabled
110
- ? () => toggleOpenSection(section.id)
111
- : noop
112
- }
113
- key={`header-${section.id}`}
114
- borderSize="0px"
115
- borderColor={themeValues.borderColor}
116
- borderWidthOverride={
117
- openSection === section.id && !!section.content
118
- ? `0px 0px 1px 0px`
119
- : ``
120
- }
121
- extraStyles={!section.disabled ? "cursor: pointer;" : ""}
122
- dataQa={section.dataQa ? section.dataQa : section.id}
123
- >
124
- <Cluster justify="space-between" align="center" childGap="1px" nowrap>
125
- <Cluster justify="flex-start" align="center" nowrap>
126
- {!section.hideRadioButton && (
127
- <Box padding="0">
128
- <RadioButton
129
- id={`radio-input-${idString(section)}`}
130
- name={idString(section)}
131
- ariaDescribedBy={ariaDescribedBy}
132
- radioOn={openSection === section.id}
133
- radioFocused={focused === section.id}
134
- toggleRadio={
135
- section.disabled
136
- ? noop
137
- : () => toggleOpenSection(section.id)
138
- }
139
- tabIndex="-1"
140
- isRequired={section.required}
141
- />
142
- </Box>
143
- )}
144
- {section.titleIcon && (
145
- <Cluster align="center">{section.titleIcon}</Cluster>
146
- )}
147
- <Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
148
- <Text
149
- as="label"
150
- htmlFor={`radio-input-${idString(section)}`}
151
- color={CHARADE_GREY}
152
- >
153
- {section.title}
154
- </Text>
155
- </Box>
156
- </Cluster>
157
- {section.rightIcons && (
158
- <Cluster
159
- id={`right-icons-${idString(section)}`}
160
- childGap="0.5rem"
161
- aria-label={section.rightIconsLabel || null}
162
- role={section.rightIconsRole || null}
163
- >
164
- {section.rightIcons.map(icon => (
165
- <RightIcon
166
- src={icon.img}
167
- key={icon.img}
168
- fade={!icon.enabled}
169
- isMobile={isMobile}
170
- alt={icon.altText}
171
- aria-disabled={!icon.enabled}
172
- />
173
- ))}
174
- </Cluster>
175
- )}
176
- {section.rightTitleContent && (
177
- <Fragment>{section.rightTitleContent}</Fragment>
178
- )}
179
- </Cluster>
180
- </Box>
181
- <AnimatePresence initial={false}>
182
- {openSection === section.id && (
183
- <Motion
184
- key={`content-${section.id}`}
185
- padding="0"
186
- background={themeValues.bodyBackgroundColor}
187
- layoutTransition
188
- initial="closed"
189
- animate="open"
190
- exit="closed"
191
- variants={wrapper}
192
- extraStyles={`transform-origin: 100% 0;`}
193
- >
194
- {section.content}
195
- </Motion>
196
- )}
197
- </AnimatePresence>
198
- </Stack>
199
- </Motion>
200
- );
201
- };
202
-
203
- export default themeComponent(
204
- InnerRadioSection,
205
- "InnerRadioSection",
206
- fallbackValues
207
- );
@@ -1,15 +0,0 @@
1
- import { WHITE, GREY_CHATEAU, ATHENS_GREY } from "../../../constants/colors";
2
-
3
- const headingBackgroundColor = `${WHITE}`;
4
- const headingDisabledColor = `${ATHENS_GREY}`;
5
- const bodyBackgroundColor = "#eeeeee";
6
- const borderColor = `${GREY_CHATEAU}`;
7
- const focusStyles = `outline: none;`;
8
-
9
- export const fallbackValues = {
10
- headingBackgroundColor,
11
- headingDisabledColor,
12
- bodyBackgroundColor,
13
- borderColor,
14
- focusStyles
15
- };