@thecb/components 9.3.1-beta.8 → 9.3.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 (39) hide show
  1. package/dist/index.cjs.js +114 -143
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.esm.js +114 -144
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/button-with-action/ButtonWithAction.js +76 -70
  8. package/src/components/atoms/checkbox/Checkbox.js +2 -1
  9. package/src/components/atoms/dropdown/Dropdown.js +3 -3
  10. package/src/components/atoms/icons/KebabMenuIcon.d.ts +1 -0
  11. package/src/components/atoms/icons/KebabMenuIcon.js +38 -0
  12. package/src/components/atoms/icons/TrashIcon.js +42 -40
  13. package/src/components/atoms/icons/icons.stories.js +3 -1
  14. package/src/components/atoms/icons/index.d.ts +1 -0
  15. package/src/components/atoms/icons/index.js +3 -1
  16. package/src/components/atoms/layouts/Motion.js +7 -10
  17. package/src/components/atoms/toggle-switch/ToggleSwitch.js +2 -1
  18. package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -1
  19. package/src/components/molecules/popover/Popover.js +2 -1
  20. package/src/components/molecules/popup-menu/PopupMenu.js +152 -0
  21. package/src/components/molecules/popup-menu/PopupMenu.stories.js +40 -0
  22. package/src/components/molecules/popup-menu/PopupMenu.styled.js +20 -0
  23. package/src/components/molecules/popup-menu/PopupMenu.theme.js +11 -0
  24. package/src/components/molecules/popup-menu/index.d.ts +25 -0
  25. package/src/components/molecules/popup-menu/index.js +3 -0
  26. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.js +79 -0
  27. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.styled.js +27 -0
  28. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.theme.js +23 -0
  29. package/src/components/molecules/radio-section/RadioSection.js +177 -284
  30. package/src/components/molecules/radio-section/RadioSection.stories.js +11 -42
  31. package/src/components/molecules/radio-section/radio-button/RadioButton.js +1 -1
  32. package/src/constants/keyboard.js +7 -0
  33. package/src/util/general.js +10 -0
  34. package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
  35. package/src/.DS_Store +0 -0
  36. package/src/components/.DS_Store +0 -0
  37. package/src/components/atoms/.DS_Store +0 -0
  38. package/src/components/atoms/icons/.DS_Store +0 -0
  39. /package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
@@ -0,0 +1,40 @@
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;
@@ -0,0 +1,20 @@
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
+ `;
@@ -0,0 +1,11 @@
1
+ const hoverColor = "#116285";
2
+ const activeColor = "#0E506D";
3
+ const menuTriggerColor = "#15749D";
4
+ const backgroundColor = "white";
5
+
6
+ export const fallbackValues = {
7
+ hoverColor,
8
+ activeColor,
9
+ menuTriggerColor,
10
+ backgroundColor
11
+ };
@@ -0,0 +1,25 @@
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>>;
@@ -0,0 +1,3 @@
1
+ import PopupMenu from "./PopupMenu";
2
+
3
+ export default PopupMenu;
@@ -0,0 +1,79 @@
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);
@@ -0,0 +1,27 @@
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
+ `;
@@ -0,0 +1,23 @@
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
+ };