@thecb/components 7.7.3-beta.3 → 7.7.3-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.7.3-beta.3",
3
+ "version": "7.7.3-beta.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
2
 
3
- const WarningIconXS = () => (
3
+ const WarningIconXS = ({
4
+ color = "#B34A00",
5
+ title,
6
+ titleID = "warning-icon-title",
7
+ iconIndex = 0
8
+ }) => (
4
9
  <svg
5
10
  width="16px"
6
11
  height="13px"
@@ -8,47 +13,45 @@ const WarningIconXS = () => (
8
13
  version="1.1"
9
14
  xmlns="http://www.w3.org/2000/svg"
10
15
  xmlnsXlink="http://www.w3.org/1999/xlink"
11
- aria-labelledby="#warning-restricted-item"
16
+ aria-labelledby={title && `#${titleID}-${iconIndex}`}
12
17
  role="img"
13
18
  >
14
- <title id="warning-restricted-item">
15
- Warning: restricted items cannot be selected
16
- </title>
19
+ {title && <title id={`${titleID}-${iconIndex}`}>{title}</title>}
17
20
  <defs>
18
21
  <path
19
22
  d="M11.0106463,4.4659633 C11.3063934,4.63914978 11.5526739,4.88543032 11.7258604,5.18117739 L16.7999622,13.846119 C17.3581267,14.7992854 17.0379144,16.0244612 16.0847481,16.5826257 C15.7781918,16.762142 15.4293522,16.8567653 15.0741018,16.8567653 L4.92589823,16.8567653 C3.82132873,16.8567653 2.92589823,15.9613348 2.92589823,14.8567653 C2.92589823,14.5015149 3.02052159,14.1526753 3.20003784,13.846119 L8.27413962,5.18117739 C8.83230416,4.22801102 10.0574799,3.90779877 11.0106463,4.4659633 Z M10.6666667,13.3333333 L9.33333333,13.3333333 L9.33333333,14.6666667 L10.6666667,14.6666667 L10.6666667,13.3333333 Z M10.6666667,6.66666667 L9.33333333,6.66666667 L9.33333333,12 L10.6666667,12 L10.6666667,6.66666667 Z"
20
- id="WarningIconXs-path-1"
23
+ id={`WarningIconXs-path-1-${iconIndex}`}
21
24
  ></path>
22
25
  </defs>
23
26
  <g
24
- id="WarningIconXs-SRV-2647---Workflow-$0-Balance"
27
+ id={`WarningIconXs-Group-1-${iconIndex}`}
25
28
  stroke="none"
26
29
  strokeWidth="1"
27
30
  fill="none"
28
31
  fillRule="evenodd"
29
32
  >
30
33
  <g
31
- id="WarningIconXs-11---Search-Results----Checked--Copy-6"
34
+ id={`WarningIconXs-Group-2-${iconIndex}`}
32
35
  transform="translate(-135.000000, -483.000000)"
33
36
  >
34
37
  <g
35
- id="WarningIconXs-Group"
38
+ id={`WarningIconXs-Group-3-${iconIndex}`}
36
39
  transform="translate(133.000000, 479.000000)"
37
40
  >
38
- <mask id="WarningIconXs-mask-2" fill="white">
39
- <use xlinkHref="#WarningIconXs-path-1"></use>
41
+ <mask id={`WarningIconXs-mask-2-${iconIndex}`} fill="white">
42
+ <use xlinkHref={`#WarningIconXs-path-1-${iconIndex}`}></use>
40
43
  </mask>
41
44
  <use
42
- id="WarningIconXs-Mask"
43
- fill="#B34A00"
45
+ id={`WarningIconXs-Mask-${iconIndex}`}
46
+ fill={color}
44
47
  fillRule="nonzero"
45
- xlinkHref="#WarningIconXs-path-1"
48
+ xlinkHref={`#WarningIconXs-path-1-${iconIndex}`}
46
49
  ></use>
47
50
  <polygon
48
- id="WarningIconXs-Path"
49
- fill="#B34A00"
51
+ id={`WarningIconXs-Path-${iconIndex}`}
52
+ fill={color}
50
53
  fillRule="nonzero"
51
- mask="url(#WarningIconXs-mask-2)"
54
+ mask={`url(#WarningIconXs-mask-2-${iconIndex})`}
52
55
  points="-2.84217094e-14 -4.26325641e-14 20 -4.26325641e-14 20 20 -2.84217094e-14 20"
53
56
  ></polygon>
54
57
  </g>
@@ -8,9 +8,9 @@ import { useOutsideClick } from "../../../util";
8
8
  import { noop } from "../../../util/general";
9
9
  import { fallbackValues } from "./Popover.theme";
10
10
 
11
- const arrowBorder = (direction, width = "8px") => {
11
+ const arrowBorder = (borderColor, direction, width = "8px") => {
12
12
  const angle = `${width} solid transparent`;
13
- const straight = `${width} solid rgba(255, 255, 255, 0.85)`;
13
+ const straight = `${width} solid ${borderColor}`;
14
14
  if (direction == "down") {
15
15
  return `border-left: ${angle}; border-right: ${angle}; border-top: ${straight}`;
16
16
  } else if (direction == "up") {
@@ -40,7 +40,10 @@ const Popover = ({
40
40
  arrowPosition, // { top: string, right: string, bottom: string, left: string }
41
41
  arrowDirection = "down",
42
42
  transform = "none",
43
- buttonExtraStyles
43
+ buttonExtraStyles,
44
+ backgroundColor = "white",
45
+ borderColor = "rgba(255, 255, 255, 0.85)",
46
+ popoverExtraStyles
44
47
  }) => {
45
48
  const { hoverColor, activeColor, popoverTriggerColor } = themeValues;
46
49
  const { top = "-110px", right = "auto", bottom = "auto", left = "-225px" } =
@@ -110,7 +113,7 @@ const Popover = ({
110
113
  )}
111
114
  </ButtonWithAction>
112
115
  <Box
113
- background="white"
116
+ background={backgroundColor}
114
117
  borderRadius="4px"
115
118
  boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
116
119
  id={`Disclosed${popoverID}`}
@@ -128,6 +131,7 @@ const Popover = ({
128
131
  left: ${left};
129
132
  height: ${height};
130
133
  transform: ${transform};
134
+ ${popoverExtraStyles};
131
135
  `}
132
136
  >
133
137
  <Paragraph>{content}</Paragraph>
@@ -138,7 +142,7 @@ const Popover = ({
138
142
  content: "";
139
143
  width: 0;
140
144
  height: 0;
141
- ${arrowBorder(arrowDirection, "8px")};
145
+ ${arrowBorder(borderColor, arrowDirection, "8px")};
142
146
  filter: drop-shadow(2px 8px 14px black);
143
147
  bottom: ${arrowBottom};
144
148
  right: ${arrowRight};
@@ -23,6 +23,9 @@ export interface PopoverProps {
23
23
  arrowDirection?: "left" | "right" | "top" | "bottom";
24
24
  transform?: string;
25
25
  disclosedExtraStyles?: string;
26
+ borderColor?: string;
27
+ backgroundColor?: string;
28
+ popoverExtraStyles?: string;
26
29
  }
27
30
 
28
31
  export const Popover: React.FC<Expand<PopoverProps> &