@thecb/components 7.12.2-beta.0 → 7.12.2-beta.10

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.12.2-beta.0",
3
+ "version": "7.12.2-beta.10",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -4,6 +4,7 @@ import { Box, Center, Cluster, Stack, Cover, Sidebar } from "../layouts";
4
4
  import Text from "../text";
5
5
  import { fallbackValues } from "./Alert.theme";
6
6
  import { themeComponent } from "../../../util/themeUtils";
7
+ import { generateShadows } from "../../../util/generateShadows";
7
8
 
8
9
  const Alert = ({
9
10
  heading,
@@ -17,13 +18,21 @@ const Alert = ({
17
18
  showQuitLink = true,
18
19
  themeValues,
19
20
  extraStyles,
20
- maxContentWidth
21
+ maxContentWidth,
22
+ noBorder = false,
23
+ enableBoxShadow = false,
24
+ enableSmallText = false,
25
+ innerContentPadding = "1rem",
26
+ iconPadding = "0 0 0 1rem"
21
27
  }) => {
22
28
  const Icon = AlertIcons[variant];
29
+ let contentPadding = maxContentWidth
30
+ ? `${padding} 1rem`
31
+ : innerContentPadding;
23
32
 
24
33
  const content = (
25
34
  <Sidebar width="24px" childGap="0rem">
26
- <Box padding="0 0 0 1rem" minHeight="100%">
35
+ <Box padding={iconPadding} minHeight="100%">
27
36
  <Cover minHeight="100%" singleChild>
28
37
  <Box padding="0" width="1.5rem" minHeight="1.5rem">
29
38
  <Icon />
@@ -32,13 +41,17 @@ const Alert = ({
32
41
  </Box>
33
42
  <Box padding="0">
34
43
  <Sidebar sidebarOnRight width="24px" childGap="0rem">
35
- <Box padding={maxContentWidth ? `${padding} 1rem` : "1rem"}>
44
+ <Box padding={contentPadding}>
36
45
  <Cluster justify="flex-start" align="center">
37
46
  {textOverride ? (
38
47
  textOverride
39
48
  ) : (
40
49
  <Stack fullHeight childGap="0.25rem">
41
- <Text variant="p" color={themeValues.text} weight="600">
50
+ <Text
51
+ variant={enableSmallText ? "pS" : "p"}
52
+ color={themeValues.text}
53
+ weight="600"
54
+ >
42
55
  {heading}
43
56
  </Text>
44
57
  <Text variant="pS" color={themeValues.text}>
@@ -70,7 +83,8 @@ const Alert = ({
70
83
  background={themeValues.background}
71
84
  borderRadius="4px"
72
85
  borderColor={themeValues.border}
73
- borderSize="1px"
86
+ borderSize={noBorder ? "0px" : "1px"}
87
+ boxShadow={enableBoxShadow ? generateShadows()?.inset?.base : ""}
74
88
  extraStyles={extraStyles}
75
89
  >
76
90
  {maxContentWidth ? (
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import styled from "styled-components";
2
+ import styled, { css } from "styled-components";
3
3
  import { fallbackValues } from "./Spinner.theme";
4
4
  import { themeComponent } from "../../../util/themeUtils";
5
5
 
@@ -32,6 +32,12 @@ const SpinnerSvgAnimation = styled.svg`
32
32
  stroke-dashoffset: -124;
33
33
  }
34
34
  }
35
+ ${({ centerSpinner }) =>
36
+ centerSpinner
37
+ ? css`
38
+ margin: 0;
39
+ `
40
+ : ""}
35
41
  `;
36
42
 
37
43
  export const SpinnerContainer = styled.div`
@@ -41,11 +47,27 @@ export const SpinnerContainer = styled.div`
41
47
  align-items: center;
42
48
  justify-content: center;
43
49
  line-height: 1;
50
+ ${({ centerSpinner, size }) =>
51
+ centerSpinner
52
+ ? css`
53
+ width: ${size}px;
54
+ height: ${size}px;
55
+ `
56
+ : ""}
44
57
  `;
45
58
 
46
- const Spinner = ({ size = "24", themeValues }) => (
47
- <SpinnerContainer>
48
- <SpinnerSvgAnimation size={size} color={themeValues.color}>
59
+ /*
60
+ `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
61
+ containers. Default is false to preserve legacy behavior for past uses.
62
+ */
63
+
64
+ const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
65
+ <SpinnerContainer centerSpinner={centerSpinner} size={size}>
66
+ <SpinnerSvgAnimation
67
+ size={size}
68
+ color={themeValues.color}
69
+ centerSpinner={centerSpinner}
70
+ >
49
71
  <circle
50
72
  className="path"
51
73
  cx="50"
@@ -1,5 +1,12 @@
1
1
  import React, { useState, Fragment } from "react";
2
- import { Stack, Cluster, Box, Motion } from "../../atoms/layouts";
2
+ import {
3
+ Stack,
4
+ Cluster,
5
+ Box,
6
+ Motion,
7
+ Cover,
8
+ Center
9
+ } from "../../atoms/layouts";
3
10
  import { fallbackValues } from "./PaymentDetails.theme";
4
11
 
5
12
  import { displayCurrency } from "../../../util/general";
@@ -14,7 +21,7 @@ import {
14
21
  FONT_WEIGHT_BOLD,
15
22
  FONT_WEIGHT_REGULAR
16
23
  } from "../../../constants/style_constants";
17
- import { ATHENS_GREY, GHOST_GREY } from "../../../constants/colors";
24
+ import { ATHENS_GREY, GRECIAN_GREY } from "../../../constants/colors";
18
25
  import ButtonWithAction from "../../atoms/button-with-action";
19
26
  import Text from "../../atoms/text";
20
27
  import Alert from "../../atoms/alert";
@@ -60,7 +67,7 @@ const PaymentDetailsContent = ({
60
67
  text="Void"
61
68
  padding="0"
62
69
  extraStyles={`
63
- min-width: 65px;
70
+ min-width: 65px;
64
71
  margin: 0px;
65
72
  min-height: 0px;
66
73
  `}
@@ -113,8 +120,22 @@ const PaymentDetailsContent = ({
113
120
  );
114
121
 
115
122
  const LoadingDetails = () => (
116
- <Box padding="0" background={GHOST_GREY} borderRadius="4px">
117
- <Spinner />
123
+ <Box
124
+ padding="0"
125
+ background={GRECIAN_GREY}
126
+ borderRadius="4px"
127
+ minHeight="196px"
128
+ >
129
+ <Cover minHeight="196px" singleChild fillCenter>
130
+ <Center intrinsic>
131
+ <Box
132
+ padding="0"
133
+ extraStyles={`flex-grow: 1; display: flex; justify-content: center; align-items: center;`}
134
+ >
135
+ <Spinner size="100" centerSpinner />
136
+ </Box>
137
+ </Center>
138
+ </Cover>
118
139
  </Box>
119
140
  );
120
141
 
@@ -125,6 +146,12 @@ const ErrorDetails = () => (
125
146
  heading="Error Loading Payment"
126
147
  text="Please go back and try again."
127
148
  showQuitLink={false}
149
+ noBorder
150
+ enableBoxShadow
151
+ enableSmallText
152
+ innerContentPadding="0 1rem"
153
+ extraStyles={`min-height: 67px; height: 67px;`}
154
+ iconPadding="0 0 0 0.75rem"
128
155
  />
129
156
  </Box>
130
157
  );
@@ -28,7 +28,7 @@ const rgbToRgba = (rgbValue = "", opacity = "") => {
28
28
  )}, ${opacity}${rgbValue.slice(-1)}`;
29
29
  };
30
30
 
31
- export const generateShadows = baseColorRGB => {
31
+ export const generateShadows = (baseColorRGB = "rgb(41, 42, 51)") => {
32
32
  const colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
33
33
  const colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
34
34
  const colorTwentyFive =
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file