@thecb/components 7.8.0 → 7.8.2-beta.3

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.8.0",
3
+ "version": "7.8.2-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,7 +1,12 @@
1
- /*
2
- For now I'm using string values, eventually shared components library will have its own constants file
3
- for colors/values that should be used here instead
4
- */
1
+ import {
2
+ WHITE,
3
+ TRANSPARENT,
4
+ SAPPHIRE_BLUE,
5
+ PEACOCK_BLUE,
6
+ MATISSE_BLUE,
7
+ RASPBERRY,
8
+ ERROR_COLOR
9
+ } from "../../../constants/colors";
5
10
 
6
11
  const padding = {
7
12
  primary: "0.75rem 1.5rem",
@@ -19,18 +24,18 @@ const padding = {
19
24
  };
20
25
 
21
26
  const color = {
22
- primary: "#FFFFFF",
23
- secondary: "#15749D",
24
- back: "#15749D",
25
- smallPrimary: "#FFFFFF",
26
- smallSecondary: "#15749D",
27
- smallGhost: "#15749D",
28
- ghost: "#15749D",
29
- tertiary: "#15749D",
30
- danger: "#FFFFFF",
31
- dangerSecondary: "#D11053",
32
- whiteSecondary: "#FFFFFF",
33
- whitePrimary: "#FFFFFF"
27
+ primary: WHITE,
28
+ secondary: MATISSE_BLUE,
29
+ back: MATISSE_BLUE,
30
+ smallPrimary: WHITE,
31
+ smallSecondary: MATISSE_BLUE,
32
+ smallGhost: MATISSE_BLUE,
33
+ ghost: MATISSE_BLUE,
34
+ tertiary: MATISSE_BLUE,
35
+ danger: WHITE,
36
+ dangerSecondary: ERROR_COLOR,
37
+ whiteSecondary: WHITE,
38
+ whitePrimary: WHITE
34
39
  };
35
40
 
36
41
  const fontSizeVariant = {
@@ -94,123 +99,123 @@ const minWidth = {
94
99
  };
95
100
 
96
101
  const backgroundColor = {
97
- primary: "#15749D",
98
- secondary: "transparent",
99
- back: "transparent",
100
- smallPrimary: "#15749D",
101
- smallSecondary: "transparent",
102
- smallGhost: "transparent",
103
- ghost: "transparent",
104
- tertiary: "transparent",
105
- danger: "#ED125F",
106
- dangerSecondary: "transparent",
107
- whiteSecondary: "transparent",
108
- whitePrimary: "transparent"
102
+ primary: MATISSE_BLUE,
103
+ secondary: TRANSPARENT,
104
+ back: TRANSPARENT,
105
+ smallPrimary: MATISSE_BLUE,
106
+ smallSecondary: TRANSPARENT,
107
+ smallGhost: TRANSPARENT,
108
+ ghost: TRANSPARENT,
109
+ tertiary: TRANSPARENT,
110
+ danger: RASPBERRY,
111
+ dangerSecondary: TRANSPARENT,
112
+ whiteSecondary: TRANSPARENT,
113
+ whitePrimary: TRANSPARENT
109
114
  };
110
115
 
111
116
  const border = {
112
- primary: "2px solid #15749D",
113
- secondary: "2px solid #15749D",
114
- back: "2px solid #15749D",
115
- smallPrimary: "2px solid #15749D",
116
- smallSecondary: "2px solid #15749D",
117
+ primary: "2px solid " + MATISSE_BLUE,
118
+ secondary: "2px solid " + MATISSE_BLUE,
119
+ back: "2px solid " + MATISSE_BLUE,
120
+ smallPrimary: "2px solid " + MATISSE_BLUE,
121
+ smallSecondary: "2px solid " + MATISSE_BLUE,
117
122
  smallGhost: "none",
118
123
  ghost: "none",
119
124
  tertiary: "none",
120
- danger: "2px solid #ED125F",
121
- dangerSecondary: "2px solid #D11053",
122
- whiteSecondary: "2px solid white",
123
- whitePrimary: "2px solid transparent"
125
+ danger: "2px solid " + RASPBERRY,
126
+ dangerSecondary: "2px solid " + ERROR_COLOR,
127
+ whiteSecondary: "2px solid " + WHITE,
128
+ whitePrimary: "2px solid " + TRANSPARENT
124
129
  };
125
130
 
126
131
  const hoverBackgroundColor = {
127
- primary: "#116285",
132
+ primary: SAPPHIRE_BLUE,
128
133
  secondary: "#DBEAF0",
129
- back: "transparent",
130
- smallPrimary: "#116285",
134
+ back: TRANSPARENT,
135
+ smallPrimary: SAPPHIRE_BLUE,
131
136
  smallSecondary: "#DBEAF0",
132
- smallGhost: "transparent",
133
- ghost: "transparent",
134
- tertiary: "transparent",
137
+ smallGhost: TRANSPARENT,
138
+ ghost: TRANSPARENT,
139
+ tertiary: TRANSPARENT,
135
140
  danger: "#BA002C",
136
- dangerSecondary: "transparent",
137
- whiteSecondary: "transparent",
138
- whitePrimary: "transparent"
141
+ dangerSecondary: "#FAE7EE",
142
+ whiteSecondary: TRANSPARENT,
143
+ whitePrimary: TRANSPARENT
139
144
  };
140
145
 
141
146
  const hoverBorderColor = {
142
- primary: "#116285",
143
- secondary: "#15749D",
147
+ primary: SAPPHIRE_BLUE,
148
+ secondary: MATISSE_BLUE,
144
149
  back: "#DCEAF1",
145
- smallPrimary: "#116285",
146
- smallSecondary: "#15749D",
147
- smallGhost: "transparent",
148
- ghost: "transparent",
149
- tertiary: "transparent",
150
+ smallPrimary: SAPPHIRE_BLUE,
151
+ smallSecondary: MATISSE_BLUE,
152
+ smallGhost: TRANSPARENT,
153
+ ghost: TRANSPARENT,
154
+ tertiary: TRANSPARENT,
150
155
  danger: "#BA002C",
151
156
  dangerSecondary: "#B10541",
152
- whiteSecondary: "2px solid transparent",
153
- whitePrimary: "2px solid transparent"
157
+ whiteSecondary: "2px solid " + TRANSPARENT,
158
+ whitePrimary: "2px solid " + TRANSPARENT
154
159
  };
155
160
 
156
161
  const hoverColor = {
157
- primary: "#FFFFFF",
158
- secondary: "#116285",
159
- back: "#116285",
160
- smallPrimary: "#FFFFFF",
161
- smallSecondary: "#116285",
162
- smallGhost: "#116285",
163
- ghost: "#116285",
164
- tertiary: "#116285",
165
- danger: "#FFFFFF",
162
+ primary: WHITE,
163
+ secondary: SAPPHIRE_BLUE,
164
+ back: SAPPHIRE_BLUE,
165
+ smallPrimary: WHITE,
166
+ smallSecondary: SAPPHIRE_BLUE,
167
+ smallGhost: SAPPHIRE_BLUE,
168
+ ghost: SAPPHIRE_BLUE,
169
+ tertiary: SAPPHIRE_BLUE,
170
+ danger: WHITE,
166
171
  dangerSecondary: "#B10541",
167
- whiteSecondary: "#FFFFFF",
168
- whitePrimary: "#FFFFFF"
172
+ whiteSecondary: WHITE,
173
+ whitePrimary: WHITE
169
174
  };
170
175
 
171
176
  const activeBackgroundColor = {
172
- primary: "#0E506D",
177
+ primary: PEACOCK_BLUE,
173
178
  secondary: "#B8D5E1",
174
- back: "transparent",
175
- smallPrimary: "#0E506D",
179
+ back: TRANSPARENT,
180
+ smallPrimary: PEACOCK_BLUE,
176
181
  smallSecondary: "#B8D5E1",
177
- smallGhost: "transparent",
178
- ghost: "transparent",
179
- tertiary: "transparent",
182
+ smallGhost: TRANSPARENT,
183
+ ghost: TRANSPARENT,
184
+ tertiary: TRANSPARENT,
180
185
  danger: "#870000",
181
- dangerSecondary: "transparent",
182
- whiteSecondary: "transparent",
183
- whitePrimary: "transparent"
186
+ dangerSecondary: "#FAE7EE",
187
+ whiteSecondary: TRANSPARENT,
188
+ whitePrimary: TRANSPARENT
184
189
  };
185
190
 
186
191
  const activeBorderColor = {
187
- primary: "#0E506D",
188
- secondary: "#15749D",
189
- back: "#0E506D",
190
- smallPrimary: "#0E506D",
191
- smallSecondary: "#15749D",
192
- smallGhost: "transparent",
193
- ghost: "transparent",
194
- tertiary: "transparent",
192
+ primary: PEACOCK_BLUE,
193
+ secondary: MATISSE_BLUE,
194
+ back: PEACOCK_BLUE,
195
+ smallPrimary: PEACOCK_BLUE,
196
+ smallSecondary: MATISSE_BLUE,
197
+ smallGhost: TRANSPARENT,
198
+ ghost: TRANSPARENT,
199
+ tertiary: TRANSPARENT,
195
200
  danger: "#870000",
196
201
  dangerSecondary: "#910029",
197
- whiteSecondary: "2px solid transparent",
198
- whitePrimary: "2px solid transparent"
202
+ whiteSecondary: "2px solid " + TRANSPARENT,
203
+ whitePrimary: "2px solid " + TRANSPARENT
199
204
  };
200
205
 
201
206
  const activeColor = {
202
- primary: "#FFFFFF",
203
- secondary: "#15749D",
204
- back: "#0E506D",
205
- smallPrimary: "#FFFFFF",
206
- smallSecondary: "#0E506D",
207
- smallGhost: "#0E506D",
208
- ghost: "#0E506D",
209
- tertiary: "#0E506D",
210
- danger: "#FFFFFF",
207
+ primary: WHITE,
208
+ secondary: MATISSE_BLUE,
209
+ back: PEACOCK_BLUE,
210
+ smallPrimary: WHITE,
211
+ smallSecondary: PEACOCK_BLUE,
212
+ smallGhost: PEACOCK_BLUE,
213
+ ghost: PEACOCK_BLUE,
214
+ tertiary: PEACOCK_BLUE,
215
+ danger: WHITE,
211
216
  dangerSecondary: "#910029",
212
- whiteSecondary: "#FFFFFF",
213
- whitePrimary: "#FFFFFF"
217
+ whiteSecondary: WHITE,
218
+ whitePrimary: WHITE
214
219
  };
215
220
 
216
221
  export const fallbackValues = {
@@ -24,6 +24,7 @@ const Cluster = ({
24
24
  flexGrow,
25
25
  extraStyles,
26
26
  children,
27
+ innerWrapperAs = "div",
27
28
  ...rest
28
29
  }) => (
29
30
  <ClusterWrapper
@@ -41,6 +42,7 @@ const Cluster = ({
41
42
  minHeight={minHeight}
42
43
  minWidth={minWidth}
43
44
  $nowrap={nowrap}
45
+ as={innerWrapperAs}
44
46
  >
45
47
  {safeChildren(children, <Fragment />)}
46
48
  </ClusterInnerWrapper>
@@ -1,4 +1,4 @@
1
- import React, { memo } from "react";
1
+ import React from "react";
2
2
  import { repeat } from "ramda";
3
3
 
4
4
  import { fallbackValues } from "./HighlightTabRow.theme";
@@ -41,7 +41,7 @@ const HighlightTabRow = ({
41
41
  <Center maxWidth="76.5rem">
42
42
  <Reel
43
43
  padding="0"
44
- childGap="4.5rem"
44
+ childGap="0"
45
45
  childWidth="11rem"
46
46
  justifyContent="space-evenly"
47
47
  disableScroll
@@ -60,6 +60,7 @@ const HighlightTabRow = ({
60
60
  extraStyles="text-align: center; display: block;"
61
61
  as="li"
62
62
  aria-current={highlightIndex == i ? "step" : ""}
63
+ id={`${t?.toLowerCase()?.replace(/\s/g, "-")}-tab`}
63
64
  >
64
65
  <Text
65
66
  variant="p"
@@ -79,6 +80,8 @@ const HighlightTabRow = ({
79
80
  );
80
81
  };
81
82
 
82
- export default memo(
83
- themeComponent(HighlightTabRow, "HighlightTabRow", fallbackValues)
83
+ export default themeComponent(
84
+ HighlightTabRow,
85
+ "HighlightTabRow",
86
+ fallbackValues
84
87
  );
@@ -1,9 +1,8 @@
1
1
  import React, { Fragment, memo } from "react";
2
2
  import { themeComponent } from "../../../util/themeUtils";
3
3
  import { fallbackValues } from "./Module.theme";
4
- import Heading from "../../atoms/heading";
5
4
  import Title from "../../atoms/title";
6
- import { Box } from "../../atoms/layouts";
5
+ import { Box, Cluster } from "../../atoms/layouts";
7
6
 
8
7
  /*
9
8
  New (01/22) - updated <Module /> to use <Title /> atom
@@ -25,6 +24,8 @@ const Module = ({
25
24
  variant = "default",
26
25
  fontSize,
27
26
  as,
27
+ titleID = "",
28
+ rightTitleContent,
28
29
  children
29
30
  }) => {
30
31
  const themedFontSize =
@@ -37,20 +38,28 @@ const Module = ({
37
38
  const themedElemType =
38
39
  variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
39
40
  const computedElemType = as || themedElemType;
41
+ const headingText = (
42
+ <Title
43
+ weight={themeValues.fontWeight}
44
+ color={themeValues.fontColor}
45
+ margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
46
+ textAlign={themeValues.textAlign}
47
+ as={computedElemType}
48
+ extraStyles={`font-size: ${computedFontSize};`}
49
+ id={titleID}
50
+ >
51
+ {heading}
52
+ </Title>
53
+ );
40
54
 
41
55
  return (
42
56
  <Fragment>
43
- {heading && (
44
- <Title
45
- weight={themeValues.fontWeight}
46
- color={themeValues.fontColor}
47
- margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
48
- textAlign={themeValues.textAlign}
49
- as={computedElemType}
50
- extraStyles={`font-size: ${computedFontSize};`}
51
- >
52
- {heading}
53
- </Title>
57
+ {heading && !rightTitleContent && headingText}
58
+ {heading && rightTitleContent && (
59
+ <Cluster justify="space-between" align="center" nowrap>
60
+ {headingText}
61
+ {rightTitleContent}
62
+ </Cluster>
54
63
  )}
55
64
  <Box padding={`0 0 ${spacingBottom}`}>
56
65
  <Box
@@ -23,6 +23,7 @@ const PrevNextPlaceholder = ({ buttonHeight, buttonWidth }) => (
23
23
 
24
24
  const PrevNextButton = ({
25
25
  action,
26
+ ariaLabel,
26
27
  arrowColor,
27
28
  borderRadius,
28
29
  buttonHeight,
@@ -34,11 +35,13 @@ const PrevNextButton = ({
34
35
  padding="0"
35
36
  minHeight={buttonHeight}
36
37
  extraStyles={`max-height: ${buttonHeight};`}
38
+ as="li"
37
39
  >
38
40
  <ButtonWithAction
39
41
  action={action}
40
42
  contentOverride
41
43
  dataQa={type}
44
+ aria-label={ariaLabel}
42
45
  extraStyles={`
43
46
  background-color: ${numberColor};
44
47
  border-color: ${numberColor};
@@ -48,9 +51,6 @@ const PrevNextButton = ({
48
51
  min-height: 100%;
49
52
  min-width: ${buttonWidth};
50
53
  padding: 0;
51
- &:focus {
52
- outline: none
53
- }
54
54
  `}
55
55
  >
56
56
  <Box padding="0" extraStyles={type === "prev" && "transform: scaleX(-1)"}>
@@ -123,9 +123,6 @@ const Pagination = ({
123
123
  &:hover {
124
124
  background-color: ${themeValues.hoverBackgroundColor}
125
125
  }
126
- &:focus {
127
- outline: none
128
- }
129
126
  `;
130
127
 
131
128
  const extraDisabledStyles = `
@@ -142,10 +139,18 @@ const Pagination = ({
142
139
  `;
143
140
 
144
141
  return (
145
- <Cluster justify="center" childGap={childGap}>
142
+ <Cluster
143
+ justify="center"
144
+ childGap={childGap}
145
+ overflow={true}
146
+ as="nav"
147
+ innerWrapperAs="ul"
148
+ extraStyles="> ul { padding: 0px; > li { list-style-type: none; } };"
149
+ >
146
150
  {currentPage > 1 ? (
147
151
  <PrevNextButton
148
152
  action={pagePrevious}
153
+ ariaLabel={`Previous Page Button`}
149
154
  arrowColor={arrowColor ?? themeValues.arrowColor}
150
155
  borderRadius={borderRadius}
151
156
  buttonHeight={buttonHeight}
@@ -178,13 +183,21 @@ const Pagination = ({
178
183
  )
179
184
  : getPagesPanel(currentPage, pageCount).map((item, index) =>
180
185
  item.isButton ? (
181
- <Box padding="0" extraStyles={`max-height: ${buttonHeight};`}>
186
+ <Box
187
+ padding="0"
188
+ extraStyles={`max-height: ${buttonHeight};`}
189
+ as="li"
190
+ >
182
191
  <ButtonWithAction
183
192
  variant="ghost"
184
193
  key={item.index}
185
194
  text={item.index}
186
195
  disabled={item.active}
187
196
  extraDisabledStyles={extraDisabledStyles}
197
+ aria-current={item.active ? "page" : undefined}
198
+ aria-label={`${item.active ? "Current " : ""}Page ${
199
+ item.index
200
+ } Button`}
188
201
  action={
189
202
  !item.active
190
203
  ? () => setCurrentPage({ pageNumber: item.index })
@@ -215,6 +228,7 @@ const Pagination = ({
215
228
  {currentPage < pageCount ? (
216
229
  <PrevNextButton
217
230
  action={pageNext}
231
+ ariaLabel={`Next Page Button`}
218
232
  arrowColor={arrowColor ?? themeValues.arrowColor}
219
233
  borderRadius={borderRadius}
220
234
  buttonHeight={buttonHeight}
@@ -54,6 +54,8 @@ const HOVER_LIGHT_BLUE = "#EFFAFF";
54
54
  const MATISSE_BLUE = "#15749D";
55
55
  const ROYAL_BLUE = "#3181E3";
56
56
  const ASTRAL_BLUE = "#3176AA";
57
+ const SAPPHIRE_BLUE = "#116285";
58
+ const PEACOCK_BLUE = "#0E506D";
57
59
  // GREEN
58
60
  const FOREST_GREEN = "#19b03F";
59
61
  const MEADOW_GREEN = "#16C98D";
@@ -76,6 +78,7 @@ const RED = "#FF0000";
76
78
  const CRIMSON_RED = "#ED1C24";
77
79
  const THUNDERBIRD_RED = "#C3191F";
78
80
  const RAZZMATAZZ_RED = "#D11053";
81
+ const RASPBERRY = "#ED125F";
79
82
  const FANTASY_RED = "#FCF4F4";
80
83
  const COSMOS_RED = "#FFD0D3";
81
84
  const BLUSH_RED = "#FFF0F5";
@@ -161,6 +164,8 @@ export {
161
164
  MATISSE_BLUE,
162
165
  ROYAL_BLUE,
163
166
  ASTRAL_BLUE,
167
+ SAPPHIRE_BLUE,
168
+ PEACOCK_BLUE,
164
169
  FOREST_GREEN,
165
170
  MEADOW_GREEN,
166
171
  POLAR_GREEN,
@@ -182,6 +187,7 @@ export {
182
187
  FANTASY_RED,
183
188
  COSMOS_RED,
184
189
  BLUSH_RED,
190
+ RASPBERRY,
185
191
  ALERT_COLORS,
186
192
  ERROR_COLOR
187
193
  };
package/src/.DS_Store DELETED
Binary file
Binary file