@thecb/components 7.8.1 → 7.8.2-beta.4

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.1",
3
+ "version": "7.8.2-beta.4",
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 = {
@@ -13,6 +13,7 @@ export interface ClusterProps {
13
13
  justifySelf?: string;
14
14
  alignSelf?: string;
15
15
  flexGrow?: string;
16
+ innerWrapperAs?: string;
16
17
  }
17
18
 
18
19
  export const Cluster: React.FC<Expand<ClusterProps> &
@@ -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>
@@ -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)"}>
@@ -103,6 +103,7 @@ const Pagination = ({
103
103
  pageNext,
104
104
  pagePrevious,
105
105
  setCurrentPage,
106
+ ariaLabel,
106
107
  themeValues
107
108
  }) => {
108
109
  const { isMobile } = useContext(ThemeContext);
@@ -123,9 +124,6 @@ const Pagination = ({
123
124
  &:hover {
124
125
  background-color: ${themeValues.hoverBackgroundColor}
125
126
  }
126
- &:focus {
127
- outline: none
128
- }
129
127
  `;
130
128
 
131
129
  const extraDisabledStyles = `
@@ -142,10 +140,19 @@ const Pagination = ({
142
140
  `;
143
141
 
144
142
  return (
145
- <Cluster justify="center" childGap={childGap}>
143
+ <Cluster
144
+ justify="center"
145
+ childGap={childGap}
146
+ overflow={true}
147
+ as="nav"
148
+ innerWrapperAs="ul"
149
+ aria-label={ariaLabel}
150
+ extraStyles="> ul { padding: 0px; > li { list-style-type: none; } };"
151
+ >
146
152
  {currentPage > 1 ? (
147
153
  <PrevNextButton
148
154
  action={pagePrevious}
155
+ ariaLabel={`Previous Page Button`}
149
156
  arrowColor={arrowColor ?? themeValues.arrowColor}
150
157
  borderRadius={borderRadius}
151
158
  buttonHeight={buttonHeight}
@@ -178,13 +185,21 @@ const Pagination = ({
178
185
  )
179
186
  : getPagesPanel(currentPage, pageCount).map((item, index) =>
180
187
  item.isButton ? (
181
- <Box padding="0" extraStyles={`max-height: ${buttonHeight};`}>
188
+ <Box
189
+ padding="0"
190
+ extraStyles={`max-height: ${buttonHeight};`}
191
+ as="li"
192
+ key={`pagination-button-${item.index}`}
193
+ >
182
194
  <ButtonWithAction
183
195
  variant="ghost"
184
- key={item.index}
185
196
  text={item.index}
186
197
  disabled={item.active}
187
198
  extraDisabledStyles={extraDisabledStyles}
199
+ aria-current={item.active ? "page" : undefined}
200
+ aria-label={`${item.active ? "Current " : ""}Page ${
201
+ item.index
202
+ } Button`}
188
203
  action={
189
204
  !item.active
190
205
  ? () => setCurrentPage({ pageNumber: item.index })
@@ -198,10 +213,9 @@ const Pagination = ({
198
213
  </ButtonWithAction>
199
214
  </Box>
200
215
  ) : (
201
- <Box padding="0 10px">
216
+ <Box padding="0 10px" as="li" key={`pagination-elipsis-${index}`}>
202
217
  <Cluster justify="flex-end">
203
218
  <Text
204
- key={index}
205
219
  variant="pXL"
206
220
  weight={fontWeight}
207
221
  color={numberColor ?? themeValues.numberColor}
@@ -215,6 +229,7 @@ const Pagination = ({
215
229
  {currentPage < pageCount ? (
216
230
  <PrevNextButton
217
231
  action={pageNext}
232
+ ariaLabel={`Next Page Button`}
218
233
  arrowColor={arrowColor ?? themeValues.arrowColor}
219
234
  borderRadius={borderRadius}
220
235
  buttonHeight={buttonHeight}
@@ -14,6 +14,7 @@ export interface PaginationProps {
14
14
  fontWeight?: string;
15
15
  numberColor?: string;
16
16
  pageCount: number;
17
+ ariaLabel?: string;
17
18
  pageNext: () => void;
18
19
  pagePrevious: () => void;
19
20
  setCurrentPage: ({ currentPage: number }) => void;
@@ -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