@thecb/components 4.3.15 → 4.4.2

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
@@ -6073,16 +6073,17 @@ var createUniqueId = function createUniqueId() {
6073
6073
 
6074
6074
  var safeChildren = function safeChildren(children) {
6075
6075
  var replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
6076
+ var unsafeValues = [false, undefined, NaN, null];
6076
6077
 
6077
6078
  if (children && children instanceof Array) {
6078
6079
  return children.map(function (child) {
6079
- return !child ? /*#__PURE__*/React__default.createElement(React.Fragment, {
6080
+ return unsafeValues.includes(child) ? /*#__PURE__*/React__default.createElement(React.Fragment, {
6080
6081
  key: createUniqueId()
6081
6082
  }, replacement) : child;
6082
6083
  });
6083
6084
  }
6084
6085
 
6085
- return !children ? replacement : children;
6086
+ return unsafeValues.includes(children) ? replacement : children;
6086
6087
  };
6087
6088
  var generateClickHandler = function generateClickHandler(form, handleErrors, submitForm) {
6088
6089
  return function (e) {
@@ -21632,6 +21633,7 @@ var Jumbo$1 = withWindowSize(Jumbo);
21632
21633
 
21633
21634
  var fontWeight$4 = {
21634
21635
  "default": "600",
21636
+ pS: "600",
21635
21637
  p: "600",
21636
21638
  pL: "600",
21637
21639
  h6: "700"
@@ -21646,7 +21648,8 @@ var LabeledAmount = function LabeledAmount(_ref) {
21646
21648
  label = _ref.label,
21647
21649
  amount = _ref.amount,
21648
21650
  themeValues = _ref.themeValues,
21649
- as = _ref.as;
21651
+ as = _ref.as,
21652
+ extraStyles = _ref.extraStyles;
21650
21653
  var LabeledAmountText = variant === "h6" ? Heading$1 : Paragraph$1;
21651
21654
  return /*#__PURE__*/React__default.createElement(Stack, {
21652
21655
  direction: "row"
@@ -21654,12 +21657,12 @@ var LabeledAmount = function LabeledAmount(_ref) {
21654
21657
  variant: variant,
21655
21658
  as: as,
21656
21659
  weight: themeValues.fontWeight,
21657
- extraStyles: "text-align: start; flex: 3;"
21660
+ extraStyles: "".concat(extraStyles, "; text-align: start; flex: 3;")
21658
21661
  }, label, ":"), /*#__PURE__*/React__default.createElement(LabeledAmountText, {
21659
21662
  variant: variant,
21660
21663
  as: as,
21661
21664
  weight: themeValues.fontWeight,
21662
- extraStyles: "text-align: end; flex: 1;"
21665
+ extraStyles: "".concat(extraStyles, "; text-align: end; flex: 1;")
21663
21666
  }, amount));
21664
21667
  };
21665
21668
 
@@ -21671,7 +21674,7 @@ var weightTitle = {
21671
21674
  };
21672
21675
  var paragraphVariant = {
21673
21676
  "default": "pL",
21674
- small: "p"
21677
+ small: "pS"
21675
21678
  };
21676
21679
  var fallbackValues$l = {
21677
21680
  weightTitle: weightTitle,
@@ -39011,43 +39014,53 @@ var Modal$1 = function Modal(_ref) {
39011
39014
 
39012
39015
  var fontSize$8 = {
39013
39016
  "default": "1.375rem",
39014
- largeTitle: "1.75rem"
39017
+ largeTitle: "1.75rem",
39018
+ small: "1.25rem"
39015
39019
  };
39016
39020
  var fontWeight$5 = {
39017
39021
  "default": "600",
39018
- largeTitle: "700"
39022
+ largeTitle: "700",
39023
+ small: "600"
39019
39024
  };
39020
39025
  var fontColor = {
39021
39026
  "default": CHARADE_GREY,
39022
- largeTitle: CHARADE_GREY
39027
+ largeTitle: CHARADE_GREY,
39028
+ small: CHARADE_GREY
39023
39029
  };
39024
39030
  var lineHeight$4 = {
39025
39031
  "default": "2rem",
39026
- largeTitle: "2rem"
39032
+ largeTitle: "2rem",
39033
+ small: "2rem"
39027
39034
  };
39028
39035
  var textAlign = {
39029
39036
  "default": "left",
39030
- largeTitle: "left"
39037
+ largeTitle: "left",
39038
+ small: "left"
39031
39039
  };
39032
39040
  var titleType = {
39033
39041
  "default": "h5",
39034
- largeTitle: "h1"
39042
+ largeTitle: "h1",
39043
+ small: "h6"
39035
39044
  };
39036
39045
  var titleSpacing = {
39037
39046
  "default": "0.5rem",
39038
- largeTitle: "1.125rem"
39047
+ largeTitle: "1.125rem",
39048
+ small: "0.5rem"
39039
39049
  };
39040
39050
  var boxShadow$1 = {
39041
39051
  "default": "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
39042
- largeTitle: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
39052
+ largeTitle: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
39053
+ small: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
39043
39054
  };
39044
39055
  var borderRadius = {
39045
39056
  "default": "0.25rem",
39046
- largeTitle: "0.25rem"
39057
+ largeTitle: "0.25rem",
39058
+ small: "0.25rem"
39047
39059
  };
39048
39060
  var backgroundColor$6 = {
39049
39061
  "default": WHITE,
39050
- largeTitle: WHITE
39062
+ largeTitle: WHITE,
39063
+ small: WHITE
39051
39064
  };
39052
39065
  var fallbackValues$v = {
39053
39066
  fontSize: fontSize$8,
@@ -39075,7 +39088,7 @@ var Module = function Module(_ref) {
39075
39088
  variant = _ref$variant === void 0 ? "default" : _ref$variant,
39076
39089
  children = _ref.children;
39077
39090
  return /*#__PURE__*/React__default.createElement(React.Fragment, null, heading && /*#__PURE__*/React__default.createElement(Heading$1, {
39078
- variant: variant === "default" ? "h5" : "h2",
39091
+ variant: variant === "small" ? "h6" : variant === "default" ? "h5" : "h2",
39079
39092
  weight: themeValues.fontWeight,
39080
39093
  color: themeValues.fontColor,
39081
39094
  margin: "".concat(spacing, " 0 ").concat(themeValues.titleSpacing, " 0"),
@@ -39902,11 +39915,11 @@ var lineItem = {
39902
39915
  };
39903
39916
  var labeledAmountSubtotal = {
39904
39917
  "default": "pL",
39905
- small: "p"
39918
+ small: "pS"
39906
39919
  };
39907
39920
  var labeledAmountTotal = {
39908
39921
  "default": "h6",
39909
- small: "pL"
39922
+ small: "p"
39910
39923
  };
39911
39924
  var fallbackValues$y = {
39912
39925
  backgroundColor: backgroundColor$8,
@@ -39920,6 +39933,7 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
39920
39933
  feeElems = _ref.feeElems,
39921
39934
  subtotal = _ref.subtotal,
39922
39935
  total = _ref.total,
39936
+ variant = _ref.variant,
39923
39937
  themeValues = _ref.themeValues;
39924
39938
  return /*#__PURE__*/React__default.createElement(Stack, {
39925
39939
  childGap: "16px"
@@ -39933,7 +39947,8 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
39933
39947
  as: "h2",
39934
39948
  variant: themeValues.labeledAmountTotal,
39935
39949
  label: "Total",
39936
- amount: displayCurrency(total)
39950
+ amount: displayCurrency(total),
39951
+ extraStyles: variant === "small" && "font-weight: ".concat(FONT_WEIGHT_BOLD, ";")
39937
39952
  }));
39938
39953
  };
39939
39954
 
@@ -39978,6 +39993,8 @@ var PaymentDetails = function PaymentDetails(_ref4) {
39978
39993
  _fees = _ref4.fees,
39979
39994
  subtotal = _ref4.subtotal,
39980
39995
  total = _ref4.total,
39996
+ _ref4$variant = _ref4.variant,
39997
+ variant = _ref4$variant === void 0 ? "default" : _ref4$variant,
39981
39998
  _ref4$hideTitle = _ref4.hideTitle,
39982
39999
  hideTitle = _ref4$hideTitle === void 0 ? false : _ref4$hideTitle,
39983
40000
  _ref4$titleText = _ref4.titleText,
@@ -40043,13 +40060,15 @@ var PaymentDetails = function PaymentDetails(_ref4) {
40043
40060
  feeElems: feeElems,
40044
40061
  subtotal: subtotal,
40045
40062
  total: total,
40046
- themeValues: themeValues
40063
+ themeValues: themeValues,
40064
+ variant: variant
40047
40065
  })) : /*#__PURE__*/React__default.createElement(PaymentDetailsContent, {
40048
40066
  lineItemElems: lineItemElems,
40049
40067
  feeElems: feeElems,
40050
40068
  subtotal: subtotal,
40051
40069
  total: total,
40052
- themeValues: themeValues
40070
+ themeValues: themeValues,
40071
+ variant: variant
40053
40072
  });
40054
40073
  var title = hideTitle ? /*#__PURE__*/React__default.createElement(React.Fragment, null) : isCollapsible ? /*#__PURE__*/React__default.createElement(Box, {
40055
40074
  width: "100%",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.3.15",
3
+ "version": "4.4.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -5,7 +5,14 @@ import { Stack } from "../layouts";
5
5
  import Heading from "../heading";
6
6
  import Paragraph from "../paragraph";
7
7
 
8
- const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
8
+ const LabeledAmount = ({
9
+ variant = "pL",
10
+ label,
11
+ amount,
12
+ themeValues,
13
+ as,
14
+ extraStyles
15
+ }) => {
9
16
  const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
10
17
  return (
11
18
  <Stack direction="row">
@@ -13,7 +20,7 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
13
20
  variant={variant}
14
21
  as={as}
15
22
  weight={themeValues.fontWeight}
16
- extraStyles="text-align: start; flex: 3;"
23
+ extraStyles={`${extraStyles}; text-align: start; flex: 3;`}
17
24
  >
18
25
  {label}:
19
26
  </LabeledAmountText>
@@ -21,7 +28,7 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
21
28
  variant={variant}
22
29
  as={as}
23
30
  weight={themeValues.fontWeight}
24
- extraStyles="text-align: end; flex: 1;"
31
+ extraStyles={`${extraStyles}; text-align: end; flex: 1;`}
25
32
  >
26
33
  {amount}
27
34
  </LabeledAmountText>
@@ -1,5 +1,6 @@
1
1
  const fontWeight = {
2
2
  default: "600",
3
+ pS: "600",
3
4
  p: "600",
4
5
  pL: "600",
5
6
  h6: "700"
@@ -1,5 +1,5 @@
1
1
  const weightTitle = { default: "600", small: "400" };
2
- const paragraphVariant = { default: "pL", small: "p" };
2
+ const paragraphVariant = { default: "pL", small: "pS" };
3
3
 
4
4
  export const fallbackValues = {
5
5
  weightTitle,
@@ -16,7 +16,9 @@ const Module = ({
16
16
  <Fragment>
17
17
  {heading && (
18
18
  <Heading
19
- variant={variant === "default" ? "h5" : "h2"}
19
+ variant={
20
+ variant === "small" ? "h6" : variant === "default" ? "h5" : "h2"
21
+ }
20
22
  weight={themeValues.fontWeight}
21
23
  color={themeValues.fontColor}
22
24
  margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
@@ -1,20 +1,38 @@
1
1
  import { WHITE, CHARADE_GREY } from "../../../constants/colors";
2
2
 
3
- const fontSize = { default: "1.375rem", largeTitle: "1.75rem" };
4
- const fontWeight = { default: "600", largeTitle: "700" };
5
- const fontColor = { default: CHARADE_GREY, largeTitle: CHARADE_GREY };
6
- const lineHeight = { default: "2rem", largeTitle: "2rem" };
7
- const textAlign = { default: "left", largeTitle: "left" };
8
- const titleType = { default: "h5", largeTitle: "h1" };
9
- const titleSpacing = { default: "0.5rem", largeTitle: "1.125rem" };
3
+ const fontSize = {
4
+ default: "1.375rem",
5
+ largeTitle: "1.75rem",
6
+ small: "1.25rem"
7
+ };
8
+ const fontWeight = { default: "600", largeTitle: "700", small: "600" };
9
+ const fontColor = {
10
+ default: CHARADE_GREY,
11
+ largeTitle: CHARADE_GREY,
12
+ small: CHARADE_GREY
13
+ };
14
+ const lineHeight = { default: "2rem", largeTitle: "2rem", small: "2rem" };
15
+ const textAlign = { default: "left", largeTitle: "left", small: "left" };
16
+ const titleType = { default: "h5", largeTitle: "h1", small: "h6" };
17
+ const titleSpacing = {
18
+ default: "0.5rem",
19
+ largeTitle: "1.125rem",
20
+ small: "0.5rem"
21
+ };
10
22
  const boxShadow = {
11
23
  default:
12
24
  "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
13
25
  largeTitle:
26
+ "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
27
+ small:
14
28
  "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
15
29
  };
16
- const borderRadius = { default: "0.25rem", largeTitle: "0.25rem" };
17
- const backgroundColor = { default: WHITE, largeTitle: WHITE };
30
+ const borderRadius = {
31
+ default: "0.25rem",
32
+ largeTitle: "0.25rem",
33
+ small: "0.25rem"
34
+ };
35
+ const backgroundColor = { default: WHITE, largeTitle: WHITE, small: WHITE };
18
36
 
19
37
  export const fallbackValues = {
20
38
  fontSize,
@@ -10,12 +10,14 @@ import LabeledAmount from "../../atoms/labeled-amount";
10
10
  import LineItem from "../../atoms/line-item";
11
11
  import Heading from "../../atoms/heading";
12
12
  import SolidDivider from "../../atoms/solid-divider";
13
+ import { FONT_WEIGHT_BOLD } from "../../../constants/style_constants";
13
14
 
14
15
  const PaymentDetailsContent = ({
15
16
  lineItemElems,
16
17
  feeElems,
17
18
  subtotal,
18
19
  total,
20
+ variant,
19
21
  themeValues
20
22
  }) => (
21
23
  <Stack childGap="16px">
@@ -35,6 +37,7 @@ const PaymentDetailsContent = ({
35
37
  variant={themeValues.labeledAmountTotal}
36
38
  label="Total"
37
39
  amount={displayCurrency(total)}
40
+ extraStyles={variant === "small" && `font-weight: ${FONT_WEIGHT_BOLD};`}
38
41
  />
39
42
  </Stack>
40
43
  );
@@ -74,6 +77,7 @@ const PaymentDetails = ({
74
77
  fees: _fees,
75
78
  subtotal,
76
79
  total,
80
+ variant = "default",
77
81
  hideTitle = false,
78
82
  titleText = "Payment Details",
79
83
  initiallyOpen = false,
@@ -113,12 +117,12 @@ const PaymentDetails = ({
113
117
  <SolidDivider />
114
118
  <Box padding="8px" />
115
119
  <PaymentDetailsContent
116
- {...{ lineItemElems, feeElems, subtotal, total, themeValues }}
120
+ {...{ lineItemElems, feeElems, subtotal, total, themeValues, variant }}
117
121
  />
118
122
  </Stack>
119
123
  ) : (
120
124
  <PaymentDetailsContent
121
- {...{ lineItemElems, feeElems, subtotal, total, themeValues }}
125
+ {...{ lineItemElems, feeElems, subtotal, total, themeValues, variant }}
122
126
  />
123
127
  );
124
128
  const title = hideTitle ? (
@@ -1,7 +1,7 @@
1
1
  const backgroundColor = { default: "transparent", small: "transparent" };
2
2
  const lineItem = { default: "default", small: "small" };
3
- const labeledAmountSubtotal = { default: "pL", small: "p" };
4
- const labeledAmountTotal = { default: "h6", small: "pL" };
3
+ const labeledAmountSubtotal = { default: "pL", small: "pS" };
4
+ const labeledAmountTotal = { default: "h6", small: "p" };
5
5
 
6
6
  export const fallbackValues = {
7
7
  backgroundColor,
@@ -17,12 +17,17 @@ const createUniqueId = () =>
17
17
  .substr(2, 9);
18
18
 
19
19
  export const safeChildren = (children, replacement = []) => {
20
+ const unsafeValues = [false, undefined, NaN, null];
20
21
  if (children && children instanceof Array) {
21
22
  return children.map(child =>
22
- !child ? <Fragment key={createUniqueId()}>{replacement}</Fragment> : child
23
+ unsafeValues.includes(child) ? (
24
+ <Fragment key={createUniqueId()}>{replacement}</Fragment>
25
+ ) : (
26
+ child
27
+ )
23
28
  );
24
29
  }
25
- return !children ? replacement : children;
30
+ return unsafeValues.includes(children) ? replacement : children;
26
31
  };
27
32
 
28
33
  export const generateClickHandler = (form, handleErrors, submitForm) => e => {