@thecb/components 3.5.12-beta.1 → 3.5.14

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": "3.5.12-beta.1",
3
+ "version": "3.5.14",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useContext } from "react";
2
- import styled, { ThemeContext } from "styled-components";
2
+ import styled, { ThemeContext, css } from "styled-components";
3
3
  import { FormattedInput } from "formatted-input";
4
4
  import { fallbackValues } from "./FormLayouts.theme.js";
5
5
  import { themeComponent } from "../../../util/themeUtils";
@@ -15,7 +15,7 @@ const InputField = styled.input`
15
15
  ? ERROR_COLOR
16
16
  : themeValues.borderColor};
17
17
  border-radius: 2px;
18
- height: 48px;
18
+ height: ${({ customHeight }) => (customHeight ? customHeight : "48px")};
19
19
  width: 100%;
20
20
  padding: 1rem;
21
21
  min-width: 100px;
@@ -38,6 +38,11 @@ const InputField = styled.input`
38
38
  &:focus {
39
39
  border: 1px solid ${MATISSE_BLUE};
40
40
  }
41
+
42
+ ${({ extraStyles }) =>
43
+ css`
44
+ ${extraStyles}
45
+ `}
41
46
  `;
42
47
 
43
48
  // eslint-disable-next-line no-unused-vars
@@ -50,7 +55,7 @@ const FormattedInputField = styled(({ showErrors, ...props }) => (
50
55
  ? ERROR_COLOR
51
56
  : themeValues.borderColor};
52
57
  border-radius: 2px;
53
- height: 48px;
58
+ height: ${({ customHeight }) => (customHeight ? customHeight : "48px")};
54
59
  width: 100%;
55
60
  padding: 1rem;
56
61
  min-width: 100px;
@@ -68,6 +73,11 @@ const FormattedInputField = styled(({ showErrors, ...props }) => (
68
73
  &:focus {
69
74
  border: 1px solid ${MATISSE_BLUE};
70
75
  }
76
+
77
+ ${({ extraStyles }) =>
78
+ css`
79
+ ${extraStyles}
80
+ `}
71
81
  `;
72
82
 
73
83
  const FormInput = ({
@@ -83,6 +93,8 @@ const FormInput = ({
83
93
  decorator,
84
94
  themeValues,
85
95
  background,
96
+ customHeight,
97
+ extraStyles,
86
98
  ...props
87
99
  }) => {
88
100
  const [showPassword, setShowPassword] = useState(false);
@@ -168,6 +180,8 @@ const FormInput = ({
168
180
  showErrors={showErrors}
169
181
  data-qa={labelTextWhenNoError}
170
182
  themeValues={themeValues}
183
+ customHeight={customHeight}
184
+ extraStyles={extraStyles}
171
185
  {...props}
172
186
  />
173
187
  ) : (
@@ -183,6 +197,8 @@ const FormInput = ({
183
197
  data-qa={labelTextWhenNoError}
184
198
  themeValues={themeValues}
185
199
  background={background}
200
+ customHeight={customHeight}
201
+ extraStyles={extraStyles}
186
202
  {...props}
187
203
  />
188
204
  )}
@@ -122,12 +122,12 @@ const RadioSection = ({
122
122
  : themeValues.headingBackgroundColor
123
123
  }
124
124
  onClick={
125
- isMobile && supportsTouch
125
+ (isMobile && supportsTouch) || section.disabled
126
126
  ? noop
127
127
  : () => toggleOpenSection(section.id)
128
128
  }
129
129
  onTouchEnd={
130
- isMobile && supportsTouch
130
+ (isMobile && supportsTouch) || !section.disabled
131
131
  ? () => toggleOpenSection(section.id)
132
132
  : noop
133
133
  }
@@ -155,7 +155,11 @@ const RadioSection = ({
155
155
  name={section.id}
156
156
  radioOn={openSection === section.id}
157
157
  radioFocused={focused === section.id}
158
- toggleRadio={() => toggleOpenSection(section.id)}
158
+ toggleRadio={
159
+ section.disabled
160
+ ? noop
161
+ : () => toggleOpenSection(section.id)
162
+ }
159
163
  tabIndex="-1"
160
164
  />
161
165
  </Box>