@thecb/components 11.1.13-beta.0 → 11.1.13

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": "11.1.13-beta.0",
3
+ "version": "11.1.13",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -99,6 +99,7 @@ const FormattedInputField = styled(({ showErrors, themeValues, ...props }) => (
99
99
 
100
100
  const FormInput = ({
101
101
  type = "text",
102
+ labelDisplayOverride = null,
102
103
  labelTextWhenNoError = "",
103
104
  errorMessages,
104
105
  isNum = false,
@@ -147,39 +148,47 @@ const FormInput = ({
147
148
  <Box padding="0">
148
149
  {helperModal ? (
149
150
  <Cluster justify="space-between" align="center">
150
- <Text
151
- as="label"
152
- color={themeValues.labelColor}
153
- variant={labelTextVariant}
154
- weight={themeValues.fontWeight}
155
- extraStyles={`word-break: break-word;
151
+ {labelDisplayOverride ? (
152
+ labelDisplayOverride
153
+ ) : (
154
+ <Text
155
+ as="label"
156
+ color={themeValues.labelColor}
157
+ variant={labelTextVariant}
158
+ weight={themeValues.fontWeight}
159
+ extraStyles={`word-break: break-word;
156
160
  font-family: Public Sans;
157
161
  &::first-letter {
158
162
  text-transform: uppercase;
159
163
  }`}
160
- id={createIdFromString(labelTextWhenNoError)}
161
- >
162
- {labelTextWhenNoError}
163
- </Text>
164
+ id={createIdFromString(labelTextWhenNoError)}
165
+ >
166
+ {labelTextWhenNoError}
167
+ </Text>
168
+ )}
164
169
  {helperModal()}
165
170
  </Cluster>
166
171
  ) : (
167
172
  <Box padding="0" minWidth="100%">
168
173
  <Cluster justify="space-between" align="center">
169
- <Text
170
- as="label"
171
- color={themeValues.labelColor}
172
- variant={labelTextVariant}
173
- fontWeight={themeValues.fontWeight}
174
- extraStyles={`word-break: break-word;
174
+ {labelDisplayOverride ? (
175
+ labelDisplayOverride
176
+ ) : (
177
+ <Text
178
+ as="label"
179
+ color={themeValues.labelColor}
180
+ variant={labelTextVariant}
181
+ fontWeight={themeValues.fontWeight}
182
+ extraStyles={`word-break: break-word;
175
183
  font-family: Public Sans;
176
184
  &::first-letter {
177
185
  text-transform: uppercase;
178
186
  }`}
179
- id={createIdFromString(labelTextWhenNoError)}
180
- >
181
- {labelTextWhenNoError}
182
- </Text>
187
+ id={createIdFromString(labelTextWhenNoError)}
188
+ >
189
+ {labelTextWhenNoError}
190
+ </Text>
191
+ )}
183
192
  {type === "password" && (
184
193
  <Text
185
194
  variant={labelTextVariant}
@@ -2,18 +2,39 @@ import React from "react";
2
2
  import { equals } from "ramda";
3
3
  import { FormInput } from "../../atoms/form-layouts";
4
4
  import { displayCurrency } from "../../../util/general";
5
- import Text from "../../atoms/text";
6
-
5
+ import { Stack, Detail, Text } from "../../atoms";
6
+ import { themeComponent } from "../../../util/themeUtils";
7
+ import { fallbackValues } from "./PartialAmountField.theme";
7
8
  const PartialAmountField = ({
8
9
  lineItem,
9
10
  field,
10
11
  showErrors,
11
12
  errorMessages,
12
13
  moneyFormat,
13
- fieldActions
14
+ fieldActions,
15
+ themeValues
14
16
  }) => (
15
17
  <FormInput
16
18
  labelTextWhenNoError={lineItem.description}
19
+ labelDisplayOverride={
20
+ <Stack childGap="0px">
21
+ <Detail
22
+ as="h3"
23
+ variant={themeValues.detailVariant}
24
+ weight={themeValues.weightTitle}
25
+ >
26
+ <span>{lineItem.description}</span>
27
+ </Detail>
28
+ <Detail
29
+ id={lineItem.subDescription}
30
+ as="p"
31
+ variant={themeValues.detailVariant}
32
+ weight="400"
33
+ >
34
+ {lineItem.subDescription}
35
+ </Detail>
36
+ </Stack>
37
+ }
17
38
  key={lineItem.id}
18
39
  field={field}
19
40
  fieldActions={fieldActions}
@@ -46,4 +67,12 @@ function arePropsEqual(prevProps, nextProps) {
46
67
  );
47
68
  }
48
69
 
49
- export default React.memo(PartialAmountField, arePropsEqual);
70
+ export default React.memo(
71
+ themeComponent(
72
+ PartialAmountField,
73
+ "PartialAmountField",
74
+ fallbackValues,
75
+ "default"
76
+ ),
77
+ arePropsEqual
78
+ );
@@ -0,0 +1,7 @@
1
+ const weightTitle = { default: "600", small: "400" };
2
+ const detailVariant = { default: "large", small: "small" };
3
+
4
+ export const fallbackValues = {
5
+ weightTitle,
6
+ detailVariant
7
+ };