@thecb/components 5.10.4 → 5.11.1-beta.0

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": "5.10.4",
3
+ "version": "5.11.1-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -68,8 +68,8 @@
68
68
  "react": "^16.13.1",
69
69
  "react-dom": "^16.13.1",
70
70
  "react-router-dom": "^6.3.0",
71
- "styled-theming": "^2.2.0",
72
- "styled-components": "^5.1.1"
71
+ "styled-components": "^5.1.1",
72
+ "styled-theming": "^2.2.0"
73
73
  },
74
74
  "husky": {
75
75
  "hooks": {
@@ -29,25 +29,40 @@ const PaymentDetailsContent = ({
29
29
  hasVoidablePaymentsSection,
30
30
  voidableTransactionDetails,
31
31
  voidableAmountPaid,
32
- partialVoidAction
32
+ partialVoidAction,
33
+ remainingBalance
33
34
  }) => (
34
35
  <Stack childGap="16px">
35
36
  {lineItemElems}
36
37
  {hasVoidablePaymentsSection && (
37
38
  <Box background={ATHENS_GREY}>
38
- <Text variant="p" color={themeValues.text} weight="400">
39
+ <Text
40
+ variant="p"
41
+ color={themeValues.text}
42
+ weight="400"
43
+ fontSize="0.875rem"
44
+ >
39
45
  Paid
40
46
  </Text>
41
47
  {voidableTransactionDetails.map(t => (
42
48
  <Cluster key={t.id} justify="space-between" align="center">
43
- <Cluster padding="0" align="center">
49
+ <Cluster
50
+ padding="0"
51
+ align="center"
52
+ extraStyles={`font-size: 14px;`}
53
+ >
44
54
  <Box padding="0">{t.voidText}</Box>
45
55
  <ButtonWithAction
46
56
  variant="ghost"
47
57
  action={() => partialVoidAction(t)}
48
58
  text="Void"
49
- extraStyles={"min-width: 75px; margin: 0px;"}
50
- textExtraStyles={`font-weight: ${FONT_WEIGHT_REGULAR}; font-size: 16px;`}
59
+ padding="0"
60
+ extraStyles={`
61
+ min-width: 65px;
62
+ margin: 0px;
63
+ min-height: 0px;
64
+ `}
65
+ textExtraStyles={`font-weight: ${FONT_WEIGHT_REGULAR}; font-size: 14px;`}
51
66
  />
52
67
  </Cluster>
53
68
  <Box padding="0" key={t.id}>
@@ -55,11 +70,11 @@ const PaymentDetailsContent = ({
55
70
  </Box>
56
71
  </Cluster>
57
72
  ))}
58
- <Box padding="8px 0px 16px 0px">
73
+ <Box padding="16px 0px">
59
74
  <SolidDivider />
60
75
  </Box>
61
76
  <LabeledAmount
62
- fontWeight={FONT_WEIGHT_REGULAR}
77
+ extraStyles={`font-weight: ${FONT_WEIGHT_REGULAR}; font-size: 14px;`}
63
78
  label="Amount paid"
64
79
  amount={displayCurrency(voidableAmountPaid)}
65
80
  />
@@ -68,20 +83,26 @@ const PaymentDetailsContent = ({
68
83
  {!hasVoidablePaymentsSection && !!lineItemElems.length && (
69
84
  <SolidDivider /> // avoids duplicate dividers -> case of voidable payment section, that acts as divider
70
85
  )}
71
- <Box padding="0.5rem 0">
72
- <LabeledAmount
73
- variant={themeValues.labeledAmountSubtotal}
74
- label="Subtotal"
75
- amount={displayCurrency(subtotal)}
76
- />
77
- {feeElems}
78
- </Box>
79
- <SolidDivider />
86
+ {subtotal && (
87
+ <>
88
+ <Box padding="0.5rem 0">
89
+ <LabeledAmount
90
+ variant={themeValues.labeledAmountSubtotal}
91
+ label="Subtotal"
92
+ amount={displayCurrency(subtotal)}
93
+ />
94
+ {feeElems}
95
+ </Box>
96
+ <SolidDivider />
97
+ </>
98
+ )}
80
99
  <LabeledAmount
81
100
  as="p"
82
101
  variant={themeValues.labeledAmountTotal}
83
102
  label={hasVoidablePaymentsSection ? "Remaining amount due" : "Total"}
84
- amount={displayCurrency(total)}
103
+ amount={displayCurrency(
104
+ typeof remainingBalance === "number" ? remainingBalance : total
105
+ )}
85
106
  extraStyles={variant === "small" && `font-weight: ${FONT_WEIGHT_BOLD};`}
86
107
  />
87
108
  </Stack>
@@ -135,7 +156,8 @@ const PaymentDetails = ({
135
156
  hasVoidablePaymentsSection = false,
136
157
  voidableTransactionDetails = [],
137
158
  partialVoidAction = noop,
138
- voidableAmountPaid = 0
159
+ voidableAmountPaid = 0,
160
+ remainingBalance = false
139
161
  // end partial void section
140
162
  }) => {
141
163
  const [isOpen, setIsOpen] = useState(initiallyOpen);
@@ -179,7 +201,8 @@ const PaymentDetails = ({
179
201
  hasVoidablePaymentsSection,
180
202
  voidableTransactionDetails,
181
203
  voidableAmountPaid,
182
- partialVoidAction
204
+ partialVoidAction,
205
+ remainingBalance
183
206
  }}
184
207
  />
185
208
  </Stack>
@@ -195,7 +218,8 @@ const PaymentDetails = ({
195
218
  hasVoidablePaymentsSection,
196
219
  voidableTransactionDetails,
197
220
  voidableAmountPaid,
198
- partialVoidAction
221
+ partialVoidAction,
222
+ remainingBalance
199
223
  }}
200
224
  />
201
225
  );
@@ -129,10 +129,10 @@ export const paymentDetails = () => (
129
129
 
130
130
  export const paymentDetailsWithPartialVoids = () => (
131
131
  <PaymentDetails
132
- subtotal={100}
132
+ subtotal={false}
133
133
  lineItems={lineItems2}
134
134
  fees={[]}
135
- total={100}
135
+ total={500}
136
136
  collapsibleOnMobile={boolean("collapsibleOnMobile", false, "props")}
137
137
  initiallyOpen={boolean("initiallyOpen", true, "props")}
138
138
  hideTitle={boolean("hideTitle", false, "props")}
@@ -147,6 +147,7 @@ export const paymentDetailsWithPartialVoids = () => (
147
147
  console.log(`Your function to void payment id: ${transaction.id}`);
148
148
  }}
149
149
  voidableAmountPaid={number("voidableAmountPaid", 400)}
150
+ remainingBalance={100}
150
151
  // end partial void section
151
152
  />
152
153
  );