@thecb/components 9.3.0 → 9.3.1-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 +136 -202
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.esm.js +137 -202
- package/dist/index.esm.js.map +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +70 -76
- package/src/components/atoms/icons/.DS_Store +0 -0
- package/src/components/atoms/icons/TrashIcon.js +40 -42
- package/src/components/atoms/icons/icons.stories.js +1 -3
- package/src/components/atoms/icons/index.d.ts +0 -1
- package/src/components/atoms/icons/index.js +1 -3
- package/src/components/molecules/radio-section/RadioSection.js +140 -131
- package/src/components/molecules/radio-section/RadioSection.stories.js +1 -0
- package/src/components/atoms/icons/KebabMenuIcon.d.ts +0 -1
- package/src/components/atoms/icons/KebabMenuIcon.js +0 -38
- package/src/components/molecules/popup-menu/PopupMenu.js +0 -152
- package/src/components/molecules/popup-menu/PopupMenu.stories.js +0 -40
- package/src/components/molecules/popup-menu/PopupMenu.styled.js +0 -20
- package/src/components/molecules/popup-menu/PopupMenu.theme.js +0 -11
- package/src/components/molecules/popup-menu/index.d.ts +0 -25
- package/src/components/molecules/popup-menu/index.js +0 -3
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.js +0 -79
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.styled.js +0 -27
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.theme.js +0 -23
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const KebabMenuIcon = () => {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
-
width="21"
|
|
8
|
-
height="32"
|
|
9
|
-
viewBox="0 0 21 32"
|
|
10
|
-
fill="none"
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
d="M0 4C0 1.79086 1.79086 0 4 0L17 0C19.2091 0 21 1.79086 21 4V28C21 30.2091 19.2091 32 17 32H4C1.79086 32 0 30.2091 0 28L0 4Z"
|
|
14
|
-
fill="none"
|
|
15
|
-
/>
|
|
16
|
-
<path
|
|
17
|
-
fillRule="evenodd"
|
|
18
|
-
clipRule="evenodd"
|
|
19
|
-
d="M10.5 6C9.39333 6 8.5 6.89333 8.5 8C8.5 9.10667 9.39333 10 10.5 10C11.6067 10 12.5 9.10667 12.5 8C12.5 6.89333 11.6067 6 10.5 6Z"
|
|
20
|
-
fill="#3B5BDB"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
fillRule="evenodd"
|
|
24
|
-
clipRule="evenodd"
|
|
25
|
-
d="M10.5 14C9.39333 14 8.5 14.8933 8.5 16C8.5 17.1067 9.39333 18 10.5 18C11.6067 18 12.5 17.1067 12.5 16C12.5 14.8933 11.6067 14 10.5 14Z"
|
|
26
|
-
fill="#3B5BDB"
|
|
27
|
-
/>
|
|
28
|
-
<path
|
|
29
|
-
fillRule="evenodd"
|
|
30
|
-
clipRule="evenodd"
|
|
31
|
-
d="M10.5 22C9.39333 22 8.5 22.9067 8.5 24C8.5 25.0933 9.40667 26 10.5 26C11.5933 26 12.5 25.0933 12.5 24C12.5 22.9067 11.6067 22 10.5 22Z"
|
|
32
|
-
fill="#3B5BDB"
|
|
33
|
-
/>
|
|
34
|
-
</svg>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default KebabMenuIcon;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
-
import { themeComponent } from "../../../util/themeUtils";
|
|
3
|
-
import Text from "../../atoms/text";
|
|
4
|
-
import { Box } from "../../atoms/layouts";
|
|
5
|
-
import PopupMenuItem from "./popup-menu-item/PopupMenuItem";
|
|
6
|
-
import { fallbackValues } from "./PopupMenu.theme";
|
|
7
|
-
import { PopupMenuContainer, PopupMenuTriggerButton } from "./PopupMenu.styled";
|
|
8
|
-
|
|
9
|
-
const PopupMenu = ({
|
|
10
|
-
menuId = "popup-menu",
|
|
11
|
-
menuItems = [],
|
|
12
|
-
themeValues,
|
|
13
|
-
triggerText = "trigger text",
|
|
14
|
-
hasIcon = false,
|
|
15
|
-
icon: Icon,
|
|
16
|
-
iconHelpText = "", // for screen-readers, required if using an icon for trigger
|
|
17
|
-
menuFocus,
|
|
18
|
-
containerExtraStyles,
|
|
19
|
-
textExtraStyles,
|
|
20
|
-
minWidth = "250px",
|
|
21
|
-
maxWidth = "300px",
|
|
22
|
-
height = "auto",
|
|
23
|
-
position,
|
|
24
|
-
transform = "none",
|
|
25
|
-
buttonExtraStyles,
|
|
26
|
-
popupExtraStyles
|
|
27
|
-
}) => {
|
|
28
|
-
const {
|
|
29
|
-
hoverColor,
|
|
30
|
-
activeColor,
|
|
31
|
-
menuTriggerColor,
|
|
32
|
-
backgroundColor
|
|
33
|
-
} = themeValues;
|
|
34
|
-
const { top = `${height}px`, right = "auto", bottom = "auto", left = "0" } =
|
|
35
|
-
position ?? {};
|
|
36
|
-
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
37
|
-
const menuRef = useRef();
|
|
38
|
-
const triggerRef = useRef();
|
|
39
|
-
const toggleMenu = menuState => setIsMenuOpen(menuState);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const checkIfClickedOutside = e => {
|
|
43
|
-
// If the menu is open and the clicked target is not within the menu or the trigger
|
|
44
|
-
if (
|
|
45
|
-
isMenuOpen &&
|
|
46
|
-
menuRef.current &&
|
|
47
|
-
!menuRef.current.contains(e.target) &&
|
|
48
|
-
triggerRef.current &&
|
|
49
|
-
!triggerRef.current.contains(e.target)
|
|
50
|
-
) {
|
|
51
|
-
toggleMenu(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
document.addEventListener("click", checkIfClickedOutside);
|
|
56
|
-
|
|
57
|
-
return () => {
|
|
58
|
-
document.removeEventListener("click", checkIfClickedOutside);
|
|
59
|
-
};
|
|
60
|
-
}, [isMenuOpen]);
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<PopupMenuContainer extraStyles={containerExtraStyles}>
|
|
64
|
-
<PopupMenuTriggerButton
|
|
65
|
-
ref={triggerRef}
|
|
66
|
-
action={() => {
|
|
67
|
-
toggleMenu(!isMenuOpen);
|
|
68
|
-
}}
|
|
69
|
-
onKeyDown={e => {
|
|
70
|
-
if (e.key === "Escape") {
|
|
71
|
-
toggleMenu(false);
|
|
72
|
-
}
|
|
73
|
-
}}
|
|
74
|
-
contentOverride
|
|
75
|
-
variant="smallGhost"
|
|
76
|
-
tabIndex="0"
|
|
77
|
-
id={menuId}
|
|
78
|
-
borderRadius="8px"
|
|
79
|
-
aria-haspopup="true"
|
|
80
|
-
aria-expanded={isMenuOpen}
|
|
81
|
-
aria-controls={`${menuId}-container`}
|
|
82
|
-
extraStyles={buttonExtraStyles}
|
|
83
|
-
>
|
|
84
|
-
{hasIcon && (
|
|
85
|
-
<>
|
|
86
|
-
<Icon />
|
|
87
|
-
<Box padding="0" srOnly>
|
|
88
|
-
<Text id={`btn${menuId}_info`}>{iconHelpText}</Text>
|
|
89
|
-
</Box>
|
|
90
|
-
</>
|
|
91
|
-
)}
|
|
92
|
-
{!hasIcon && (
|
|
93
|
-
<Text
|
|
94
|
-
color={menuTriggerColor}
|
|
95
|
-
extraStyles={`&:active { color: ${activeColor}; } &:hover { color: ${hoverColor} }; ${textExtraStyles}`}
|
|
96
|
-
>
|
|
97
|
-
{triggerText}
|
|
98
|
-
</Text>
|
|
99
|
-
)}
|
|
100
|
-
</PopupMenuTriggerButton>
|
|
101
|
-
<Box
|
|
102
|
-
as="div"
|
|
103
|
-
id={`${menuId}-container`}
|
|
104
|
-
ref={menuRef}
|
|
105
|
-
onKeyDown={e => {
|
|
106
|
-
if (e.key === "Escape") {
|
|
107
|
-
toggleMenu(false);
|
|
108
|
-
}
|
|
109
|
-
}}
|
|
110
|
-
background={backgroundColor}
|
|
111
|
-
borderRadius="8px"
|
|
112
|
-
boxShadow={`
|
|
113
|
-
0px 7px 32px 0px rgba(41, 42, 51, 0.2),
|
|
114
|
-
0px 1px 4px 0px rgba(41, 42, 51, 0.2),
|
|
115
|
-
0px 1px 8px -1px rgba(41, 42, 51, 0.3);
|
|
116
|
-
`}
|
|
117
|
-
role="menu"
|
|
118
|
-
aria-labelledby={menuId}
|
|
119
|
-
tabIndex={menuFocus && isMenuOpen ? "0" : "-1"}
|
|
120
|
-
minWidth={minWidth}
|
|
121
|
-
maxWidth={maxWidth}
|
|
122
|
-
extraStyles={`
|
|
123
|
-
display: ${isMenuOpen ? "block" : "none"};
|
|
124
|
-
position: absolute;
|
|
125
|
-
padding: 8px 8px 3px 8px;
|
|
126
|
-
top: ${top};
|
|
127
|
-
left: ${left};
|
|
128
|
-
right: ${right};
|
|
129
|
-
bottom: ${bottom};
|
|
130
|
-
height: ${height};
|
|
131
|
-
transform: ${transform};
|
|
132
|
-
${popupExtraStyles};
|
|
133
|
-
`}
|
|
134
|
-
>
|
|
135
|
-
{menuItems.map((item, index) => (
|
|
136
|
-
<PopupMenuItem
|
|
137
|
-
key={index}
|
|
138
|
-
id={`${menuId}-item-${index}`}
|
|
139
|
-
closeMenuCallback={() => {
|
|
140
|
-
toggleMenu(false);
|
|
141
|
-
// focus back to trigger button when menu closes
|
|
142
|
-
triggerRef.current.focus();
|
|
143
|
-
}}
|
|
144
|
-
{...item}
|
|
145
|
-
/>
|
|
146
|
-
))}
|
|
147
|
-
</Box>
|
|
148
|
-
</PopupMenuContainer>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export default themeComponent(PopupMenu, "PopupMenu", fallbackValues);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { KebabMenuIcon, TrashIcon } from "../../atoms";
|
|
3
|
-
import PopupMenu from "./PopupMenu";
|
|
4
|
-
import page from "../../../../.storybook/page";
|
|
5
|
-
import { noop } from "../../../util/general";
|
|
6
|
-
|
|
7
|
-
const menuItems = [
|
|
8
|
-
{
|
|
9
|
-
text: "Account Details",
|
|
10
|
-
action: noop
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
text: "Remove",
|
|
14
|
-
action: noop,
|
|
15
|
-
isDeleteAction: true,
|
|
16
|
-
hasIcon: true,
|
|
17
|
-
icon: TrashIcon
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const story = page({
|
|
22
|
-
title: "Components|Molecules/PopupMenu",
|
|
23
|
-
Component: PopupMenu
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const popupMenu = () => (
|
|
27
|
-
<PopupMenu
|
|
28
|
-
hasIcon="true"
|
|
29
|
-
menuItems={menuItems}
|
|
30
|
-
icon={KebabMenuIcon}
|
|
31
|
-
minWidth={"50px"}
|
|
32
|
-
maxWidth={"208px"}
|
|
33
|
-
position={{ top: "0", left: "auto", right: "63px" }}
|
|
34
|
-
menuId={"menuId"}
|
|
35
|
-
containerExtraStyles={`margin-bottom: 100px;`}
|
|
36
|
-
buttonExtraStyles={`margin: 0 0 0 auto;`}
|
|
37
|
-
popupExtraStyles={`padding: 8px 8px 3px 8px;`}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
export default story;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { ButtonWithAction } from "../../atoms";
|
|
3
|
-
import { Box } from "../../atoms";
|
|
4
|
-
|
|
5
|
-
export const PopupMenuContainer = styled(Box)`
|
|
6
|
-
display: flex;
|
|
7
|
-
position: relative;
|
|
8
|
-
padding: 0;
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const PopupMenuTriggerButton = styled(ButtonWithAction)`
|
|
12
|
-
padding: 10px 15px;
|
|
13
|
-
min-width: auto;
|
|
14
|
-
&:active,
|
|
15
|
-
&:focus {
|
|
16
|
-
outline: none;
|
|
17
|
-
border: 1px solid rgba(196, 206, 244, 1);
|
|
18
|
-
background-color: rgba(235, 239, 251, 1);
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import Expand from "../../../util/expand";
|
|
3
|
-
|
|
4
|
-
export interface PopupMenuProps {
|
|
5
|
-
menuId?: string;
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
triggerText?: string | JSX.Element;
|
|
8
|
-
hasIcon?: boolean;
|
|
9
|
-
iconHelpText?: string; // for screen-readers, required if using an icon for trigger
|
|
10
|
-
menuFocus?: boolean;
|
|
11
|
-
containerExtraStyles?: string;
|
|
12
|
-
textExtraStyles?: string;
|
|
13
|
-
minWidth?: string;
|
|
14
|
-
maxWidth?: string;
|
|
15
|
-
height?: string;
|
|
16
|
-
position?: { top: string; right: string; bottom: string; left: string };
|
|
17
|
-
transform?: string;
|
|
18
|
-
disclosedExtraStyles?: string;
|
|
19
|
-
borderColor?: string;
|
|
20
|
-
backgroundColor?: string;
|
|
21
|
-
popupExtraStyles?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const PopupMenu: React.FC<Expand<PopupMenuProps> &
|
|
25
|
-
React.HTMLAttributes<HTMLElement>>;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { themeComponent } from "../../../../util/themeUtils";
|
|
3
|
-
import { Box, Text } from "../../../atoms";
|
|
4
|
-
import { fallbackValues } from "./PopupMenuItem.theme";
|
|
5
|
-
import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
|
|
6
|
-
import { PopupMenuItemContainer } from "./PopupMenuItem.styled";
|
|
7
|
-
|
|
8
|
-
const PopupMenuItem = ({
|
|
9
|
-
id,
|
|
10
|
-
closeMenuCallback,
|
|
11
|
-
action,
|
|
12
|
-
themeValues,
|
|
13
|
-
text,
|
|
14
|
-
hasIcon = false,
|
|
15
|
-
isDeleteAction = false,
|
|
16
|
-
icon: Icon,
|
|
17
|
-
textExtraStyles,
|
|
18
|
-
hoverStyles,
|
|
19
|
-
activeStyles,
|
|
20
|
-
extraStyles,
|
|
21
|
-
...rest
|
|
22
|
-
}) => {
|
|
23
|
-
return (
|
|
24
|
-
<PopupMenuItemContainer
|
|
25
|
-
id={id}
|
|
26
|
-
role="menuItem"
|
|
27
|
-
text={text}
|
|
28
|
-
action={() => {
|
|
29
|
-
action();
|
|
30
|
-
closeMenuCallback();
|
|
31
|
-
}}
|
|
32
|
-
variant="smallGhost"
|
|
33
|
-
isDeleteAction={isDeleteAction}
|
|
34
|
-
theme={themeValues}
|
|
35
|
-
contentOverride
|
|
36
|
-
textExtraStyles={textExtraStyles}
|
|
37
|
-
hoverStyles={hoverStyles}
|
|
38
|
-
extraStyles={extraStyles}
|
|
39
|
-
activeStyles={`outline: none; ${activeStyles}`}
|
|
40
|
-
{...rest}
|
|
41
|
-
>
|
|
42
|
-
<Box
|
|
43
|
-
extraStyles={`
|
|
44
|
-
display: flex;
|
|
45
|
-
gap: 8px;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
padding: 0;
|
|
48
|
-
`}
|
|
49
|
-
>
|
|
50
|
-
{hasIcon && (
|
|
51
|
-
<Icon
|
|
52
|
-
iconFill={
|
|
53
|
-
isDeleteAction
|
|
54
|
-
? themeValues.menuItemColorDelete
|
|
55
|
-
: themeValues.menuItemColor
|
|
56
|
-
}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
59
|
-
{text && (
|
|
60
|
-
<Text
|
|
61
|
-
variant="pS"
|
|
62
|
-
weight={FONT_WEIGHT_SEMIBOLD}
|
|
63
|
-
fontFamily="Public Sans, sans-serif"
|
|
64
|
-
color={
|
|
65
|
-
isDeleteAction
|
|
66
|
-
? themeValues.menuItemColorDelete
|
|
67
|
-
: themeValues.menuItemColor
|
|
68
|
-
}
|
|
69
|
-
extraStyles={textExtraStyles}
|
|
70
|
-
>
|
|
71
|
-
{text}
|
|
72
|
-
</Text>
|
|
73
|
-
)}
|
|
74
|
-
</Box>
|
|
75
|
-
</PopupMenuItemContainer>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default themeComponent(PopupMenuItem, "PopupMenuItem", fallbackValues);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import ButtonWithAction from "../../../atoms/button-with-action/ButtonWithAction";
|
|
3
|
-
|
|
4
|
-
export const PopupMenuItemContainer = styled(ButtonWithAction)`
|
|
5
|
-
width: 100%;
|
|
6
|
-
margin: 0;
|
|
7
|
-
padding: 17px 11px;
|
|
8
|
-
margin-bottom: 5px;
|
|
9
|
-
border: 0;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
text-decoration: none;
|
|
12
|
-
${({ theme, isDeleteAction }) => `
|
|
13
|
-
background-color: ${theme.menuItemBackgroundColor};
|
|
14
|
-
color: ${isDeleteAction ? theme.menuItemColorDelete : theme.menuItemColor};
|
|
15
|
-
`}
|
|
16
|
-
&:hover,
|
|
17
|
-
&:active {
|
|
18
|
-
text-decoration: none;
|
|
19
|
-
${({ theme, isDeleteAction }) => `
|
|
20
|
-
background-color: ${
|
|
21
|
-
isDeleteAction
|
|
22
|
-
? theme.menuItemHoverBackgroundColorDelete
|
|
23
|
-
: theme.menuItemHoverBackgroundColor
|
|
24
|
-
};
|
|
25
|
-
`}
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ROYAL_BLUE_VIVID,
|
|
3
|
-
CORNFLOWER_BLUE,
|
|
4
|
-
RAZZMATAZZ_RED,
|
|
5
|
-
BLUSH_RED,
|
|
6
|
-
WHITE
|
|
7
|
-
} from "../../../../constants/colors";
|
|
8
|
-
|
|
9
|
-
const menuItemBackgroundColor = WHITE;
|
|
10
|
-
const menuItemColor = ROYAL_BLUE_VIVID;
|
|
11
|
-
const menuItemColorDelete = RAZZMATAZZ_RED;
|
|
12
|
-
const menuItemHoverBackgroundColor = CORNFLOWER_BLUE;
|
|
13
|
-
const menuItemHoverBackgroundColorDelete = BLUSH_RED;
|
|
14
|
-
const menuItemHoverColor = ROYAL_BLUE_VIVID;
|
|
15
|
-
|
|
16
|
-
export const fallbackValues = {
|
|
17
|
-
menuItemBackgroundColor,
|
|
18
|
-
menuItemColor,
|
|
19
|
-
menuItemColorDelete,
|
|
20
|
-
menuItemHoverBackgroundColor,
|
|
21
|
-
menuItemHoverBackgroundColorDelete,
|
|
22
|
-
menuItemHoverColor
|
|
23
|
-
};
|