@thecb/components 4.0.3 → 4.0.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/dist/index.cjs.js CHANGED
@@ -6164,16 +6164,6 @@ var Text = function Text(_ref) {
6164
6164
 
6165
6165
  var Text$1 = themeComponent(Text, "Text", fallbackValues, "p");
6166
6166
 
6167
- function _templateObject7() {
6168
- var data = _taggedTemplateLiteral(["\n display: none;\n "]);
6169
-
6170
- _templateObject7 = function _templateObject7() {
6171
- return data;
6172
- };
6173
-
6174
- return data;
6175
- }
6176
-
6177
6167
  function _templateObject6() {
6178
6168
  var data = _taggedTemplateLiteral(["\n ", "\n "]);
6179
6169
 
@@ -6225,7 +6215,7 @@ function _templateObject2$1() {
6225
6215
  }
6226
6216
 
6227
6217
  function _templateObject$1() {
6228
- var data = _taggedTemplateLiteral(["\n position: relative;\n box-sizing: border-box;\n padding: ", ";\n border: ", ";\n box-shadow: ", ";\n background-color: ", ";\n min-height: ", ";\n ", "\n min-width: ", ";\n max-width: ", ";\n color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border: ", ";\n text-align: ", ";\n\n &:hover, &:focus {\n ", "\n }\n\n &:active {\n ", "\n }\n\n &:disabled {\n ", "\n }\n\n & * {\n color: ", ";\n }\n\n ", "\n ", "\n\n ", "\n"]);
6218
+ var data = _taggedTemplateLiteral(["\n position: relative;\n box-sizing: border-box;\n padding: ", ";\n border: ", ";\n box-shadow: ", ";\n background-color: ", ";\n min-height: ", ";\n ", "\n min-width: ", ";\n max-width: ", ";\n color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border: ", ";\n text-align: ", ";\n\n &:hover, &:focus {\n ", "\n }\n\n &:active {\n ", "\n }\n\n &:disabled {\n ", "\n }\n\n & * {\n color: ", ";\n }\n\n ", "\n ", "\n"]);
6229
6219
 
6230
6220
  _templateObject$1 = function _templateObject() {
6231
6221
  return data;
@@ -6259,9 +6249,14 @@ var BoxWrapper = styled__default(function (_ref) {
6259
6249
  maxWidth = _ref.maxWidth,
6260
6250
  padding = _ref.padding,
6261
6251
  hiddenStyles = _ref.hiddenStyles,
6262
- props = _objectWithoutProperties(_ref, ["activeStyles", "hoverStyles", "disabledStyles", "extraStyles", "borderSize", "borderColor", "borderWidthOverride", "borderRadius", "textAlign", "boxShadow", "minHeight", "minWidth", "maxWidth", "padding", "hiddenStyles"]);
6263
-
6264
- return /*#__PURE__*/React__default.createElement("div", props);
6252
+ ariaControls = _ref.ariaControls,
6253
+ ariaLabel = _ref.ariaLabel,
6254
+ props = _objectWithoutProperties(_ref, ["activeStyles", "hoverStyles", "disabledStyles", "extraStyles", "borderSize", "borderColor", "borderWidthOverride", "borderRadius", "textAlign", "boxShadow", "minHeight", "minWidth", "maxWidth", "padding", "hiddenStyles", "ariaControls", "ariaLabel"]);
6255
+
6256
+ return /*#__PURE__*/React__default.createElement("div", _extends({
6257
+ "aria-controls": ariaControls,
6258
+ "aria-label": ariaLabel
6259
+ }, props));
6265
6260
  })(_templateObject$1(), function (_ref2) {
6266
6261
  var padding = _ref2.padding;
6267
6262
  return padding;
@@ -6324,9 +6319,6 @@ var BoxWrapper = styled__default(function (_ref) {
6324
6319
  }, function (_ref20) {
6325
6320
  var extraStyles = _ref20.extraStyles;
6326
6321
  return styled.css(_templateObject6(), extraStyles);
6327
- }, function (_ref21) {
6328
- var hiddenStyles = _ref21.hiddenStyles;
6329
- return hiddenStyles && styled.css(_templateObject7());
6330
6322
  });
6331
6323
  /* eslint-enable no-unused-vars */
6332
6324
 
@@ -16388,10 +16380,10 @@ function _templateObject8() {
16388
16380
  return data;
16389
16381
  }
16390
16382
 
16391
- function _templateObject7$1() {
16383
+ function _templateObject7() {
16392
16384
  var data = _taggedTemplateLiteral(["\n display: inline-block;\n width: 24px;\n height: 24px;\n border-radius: 2px;\n transition: all 150ms;\n\n ", " {\n visibility: ", ";\n }\n\n ", ";\n"]);
16393
16385
 
16394
- _templateObject7$1 = function _templateObject7() {
16386
+ _templateObject7 = function _templateObject7() {
16395
16387
  return data;
16396
16388
  };
16397
16389
 
@@ -16468,7 +16460,7 @@ var CheckboxIcon = styled__default.svg(_templateObject3$3(), function (_ref) {
16468
16460
  var HiddenCheckbox = styled__default.input.attrs({
16469
16461
  type: "checkbox"
16470
16462
  })(_templateObject6$1());
16471
- var StyledCheckbox = styled__default.div(_templateObject7$1(), CheckboxIcon, function (_ref2) {
16463
+ var StyledCheckbox = styled__default.div(_templateObject7(), CheckboxIcon, function (_ref2) {
16472
16464
  var checked = _ref2.checked;
16473
16465
  return checked ? "visible" : "hidden";
16474
16466
  }, function (_ref3) {
@@ -18867,16 +18859,23 @@ var CCIconWrapper = styled__default.div(_templateObject2$e());
18867
18859
  var FormattedCreditCard = function FormattedCreditCard(_ref) {
18868
18860
  var lastFour = _ref.lastFour,
18869
18861
  autoPay = _ref.autoPay,
18862
+ expireDate = _ref.expireDate,
18870
18863
  themeValues = _ref.themeValues;
18871
18864
  return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(GenericCard, null)), /*#__PURE__*/React__default.createElement(Stack, {
18872
18865
  childGap: "0"
18866
+ }, /*#__PURE__*/React__default.createElement(Box, {
18867
+ padding: "0"
18873
18868
  }, /*#__PURE__*/React__default.createElement(Text$1, {
18874
18869
  variant: "p",
18875
18870
  padding: "0 0 0 8px",
18876
18871
  color: themeValues.textColor,
18877
18872
  textAlign: "left",
18878
18873
  extraStyles: "display: inline-block;"
18879
- }, "Card ending in ".concat(lastFour)), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
18874
+ }, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(Paragraph$1, {
18875
+ variant: "pXS",
18876
+ color: ASH_GREY,
18877
+ textAlign: "left"
18878
+ }, "Exp ".concat(expireDate))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
18880
18879
  variant: "p",
18881
18880
  color: themeValues.autopayTextColor,
18882
18881
  extraStyles: "font-style: italic;"
@@ -19312,10 +19311,10 @@ function _templateObject8$1() {
19312
19311
  return data;
19313
19312
  }
19314
19313
 
19315
- function _templateObject7$2() {
19314
+ function _templateObject7$1() {
19316
19315
  var data = _taggedTemplateLiteral(["", " needs an uppercase letter"]);
19317
19316
 
19318
- _templateObject7$2 = function _templateObject7() {
19317
+ _templateObject7$1 = function _templateObject7() {
19319
19318
  return data;
19320
19319
  };
19321
19320
 
@@ -19421,7 +19420,7 @@ with interpolation.
19421
19420
  */
19422
19421
 
19423
19422
 
19424
- var DEFAULT_ERROR_MESSAGES = (_DEFAULT_ERROR_MESSAG = {}, _defineProperty(_DEFAULT_ERROR_MESSAG, MIN_LENGTH_ERROR, genErrorMessage(_templateObject$t(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MAX_LENGTH_ERROR, genErrorMessage(_templateObject2$h(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, EXACT_LENGTH_ERROR, genErrorMessage(_templateObject3$9(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MULTIPLE_LENGTHS_ERROR, genErrorMessage(_templateObject4$5(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, EMAIL_ERROR, genErrorMessage(_templateObject5$2(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_NUMBER_ERROR, genErrorMessage(_templateObject6$2(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_UPPERCASE_LETTER_ERROR, genErrorMessage(_templateObject7$2(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_LOWERCASE_LETTER_ERROR, genErrorMessage(_templateObject8$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_SPECIAL_CHARACTER_ERROR, genErrorMessage(_templateObject9$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, ONLY_NUMBERS_ERROR, genErrorMessage(_templateObject10$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, ONLY_LETTERS_ERROR, genErrorMessage(_templateObject11$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, REQUIRED_FIELD_ERROR, genErrorMessage(_templateObject12(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, NUM_GREATER_THAN_ERROR, genErrorMessage(_templateObject13(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, NUM_LESS_THAN_ERROR, genErrorMessage(_templateObject14(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MATCHES_FIELD_ERROR, genErrorMessage(_templateObject15(), "fieldLabel", "matchField")), _defineProperty(_DEFAULT_ERROR_MESSAG, VALID_SELECT_OPTION_ERROR, genErrorMessage(_templateObject16(), "fieldLabel")), _DEFAULT_ERROR_MESSAG); // Constants to represent an input's state
19423
+ var DEFAULT_ERROR_MESSAGES = (_DEFAULT_ERROR_MESSAG = {}, _defineProperty(_DEFAULT_ERROR_MESSAG, MIN_LENGTH_ERROR, genErrorMessage(_templateObject$t(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MAX_LENGTH_ERROR, genErrorMessage(_templateObject2$h(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, EXACT_LENGTH_ERROR, genErrorMessage(_templateObject3$9(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MULTIPLE_LENGTHS_ERROR, genErrorMessage(_templateObject4$5(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, EMAIL_ERROR, genErrorMessage(_templateObject5$2(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_NUMBER_ERROR, genErrorMessage(_templateObject6$2(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_UPPERCASE_LETTER_ERROR, genErrorMessage(_templateObject7$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_LOWERCASE_LETTER_ERROR, genErrorMessage(_templateObject8$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, HAS_SPECIAL_CHARACTER_ERROR, genErrorMessage(_templateObject9$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, ONLY_NUMBERS_ERROR, genErrorMessage(_templateObject10$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, ONLY_LETTERS_ERROR, genErrorMessage(_templateObject11$1(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, REQUIRED_FIELD_ERROR, genErrorMessage(_templateObject12(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, NUM_GREATER_THAN_ERROR, genErrorMessage(_templateObject13(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, NUM_LESS_THAN_ERROR, genErrorMessage(_templateObject14(), "fieldLabel")), _defineProperty(_DEFAULT_ERROR_MESSAG, MATCHES_FIELD_ERROR, genErrorMessage(_templateObject15(), "fieldLabel", "matchField")), _defineProperty(_DEFAULT_ERROR_MESSAG, VALID_SELECT_OPTION_ERROR, genErrorMessage(_templateObject16(), "fieldLabel")), _DEFAULT_ERROR_MESSAG); // Constants to represent an input's state
19425
19424
  // Neutral - has not been validated
19426
19425
  // Invalid - has been validated and has an error
19427
19426
  // Valid - has been validated and has no error
@@ -32714,10 +32713,10 @@ function _templateObject8$2() {
32714
32713
  return data;
32715
32714
  }
32716
32715
 
32717
- function _templateObject7$3() {
32716
+ function _templateObject7$2() {
32718
32717
  var data = _taggedTemplateLiteral(["\n display: flex;\n ", ";\n ", ";\n ", ";\n font-size: ", ";\n color: ", ";\n"]);
32719
32718
 
32720
- _templateObject7$3 = function _templateObject7() {
32719
+ _templateObject7$2 = function _templateObject7() {
32721
32720
  return data;
32722
32721
  };
32723
32722
 
@@ -32810,7 +32809,7 @@ var ActionWrapper = styled__default.div(_templateObject6$3(), function (_ref7) {
32810
32809
  var isMobile = _ref7.isMobile;
32811
32810
  return isMobile && "display: none";
32812
32811
  });
32813
- var TableItemKey = styled__default.div(_templateObject7$3(), function (_ref8) {
32812
+ var TableItemKey = styled__default.div(_templateObject7$2(), function (_ref8) {
32814
32813
  var isMobile = _ref8.isMobile;
32815
32814
  return !isMobile && "flex: 1";
32816
32815
  }, function (_ref9) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -2,9 +2,11 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import GenericCard from "../icons/GenericCard";
4
4
  import Text from "../text";
5
- import { Stack } from "../layouts";
5
+ import Paragraph from "../paragraph";
6
+ import { Box, Stack } from "../layouts";
6
7
  import { fallbackValues } from "./FormattedCreditCard.theme";
7
8
  import { themeComponent } from "../../../util/themeUtils";
9
+ import { ASH_GREY } from "../../../constants/colors";
8
10
 
9
11
  export const CreditCardWrapper = styled.div`
10
12
  display: flex;
@@ -19,21 +21,33 @@ export const CCIconWrapper = styled.div`
19
21
  display: flex;
20
22
  `;
21
23
 
22
- const FormattedCreditCard = ({ lastFour, autoPay, themeValues }) => (
24
+ const FormattedCreditCard = ({
25
+ lastFour,
26
+ autoPay,
27
+ expireDate,
28
+ themeValues
29
+ }) => (
23
30
  <CreditCardWrapper>
24
31
  <CCIconWrapper>
25
32
  <GenericCard />
26
33
  </CCIconWrapper>
27
34
  <Stack childGap="0">
28
- <Text
29
- variant="p"
30
- padding="0 0 0 8px"
31
- color={themeValues.textColor}
32
- textAlign="left"
33
- extraStyles={`display: inline-block;`}
34
- >
35
- {`Card ending in ${lastFour}`}
36
- </Text>
35
+ <Box padding="0">
36
+ <Text
37
+ variant="p"
38
+ padding="0 0 0 8px"
39
+ color={themeValues.textColor}
40
+ textAlign="left"
41
+ extraStyles={`display: inline-block;`}
42
+ >
43
+ {`Card ending in ${lastFour}`}
44
+ </Text>
45
+ {expireDate && (
46
+ <Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
47
+ {`Exp ${expireDate}`}
48
+ </Paragraph>
49
+ )}
50
+ </Box>
37
51
  {autoPay && (
38
52
  <Text
39
53
  variant="p"
@@ -27,8 +27,10 @@ export const BoxWrapper = styled(
27
27
  maxWidth,
28
28
  padding,
29
29
  hiddenStyles,
30
+ ariaControls,
31
+ ariaLabel,
30
32
  ...props
31
- }) => <div {...props} />
33
+ }) => <div aria-controls={ariaControls} aria-label={ariaLabel} {...props} />
32
34
  )`
33
35
  position: relative;
34
36
  box-sizing: border-box;
@@ -106,11 +108,5 @@ export const BoxWrapper = styled(
106
108
  css`
107
109
  ${extraStyles}
108
110
  `}
109
-
110
- ${({ hiddenStyles }) =>
111
- hiddenStyles &&
112
- css`
113
- display: none;
114
- `}
115
111
  `;
116
112
  /* eslint-enable no-unused-vars */