@team-monolith/cds 1.115.2 → 1.115.4
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.
|
@@ -153,9 +153,9 @@ const Checkbox = React.forwardRef(function Checkbox(props, ref) {
|
|
|
153
153
|
? "partial"
|
|
154
154
|
: "default";
|
|
155
155
|
const clampedSize = Math.max(hitAreaSize, DEFAULT_CHECKBOX_SIZE);
|
|
156
|
-
return (_jsxs(CheckboxContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled,
|
|
156
|
+
return (_jsxs(CheckboxContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled, hitAreaSize: clampedSize, ref: ref }, other, { children: [_jsx(StyledInput, Object.assign({ type: "checkbox" }, inputProps, { checked: checked, disabled: disabled, onClick: onClick, onChange: onChange, size: clampedSize })), _jsx(CheckboxIcon, { type: type, disabled: disabled })] })));
|
|
157
157
|
});
|
|
158
|
-
const CheckboxContainer = styled.span(({ theme, spacer, disabled,
|
|
158
|
+
const CheckboxContainer = styled.span(({ theme, spacer, disabled, hitAreaSize }) => css `
|
|
159
159
|
display: flex;
|
|
160
160
|
align-items: center;
|
|
161
161
|
justify-content: center;
|
|
@@ -170,16 +170,15 @@ const CheckboxContainer = styled.span(({ theme, spacer, disabled, size }) => css
|
|
|
170
170
|
pointer-events: none;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
${
|
|
173
|
+
${hitAreaSize > DEFAULT_CHECKBOX_SIZE &&
|
|
174
174
|
css `
|
|
175
175
|
&::before {
|
|
176
176
|
content: "";
|
|
177
177
|
position: absolute;
|
|
178
|
-
top:
|
|
179
|
-
left:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
height: ${size}px;
|
|
178
|
+
top: ${(DEFAULT_CHECKBOX_SIZE - hitAreaSize) / 2}px;
|
|
179
|
+
left: ${(DEFAULT_CHECKBOX_SIZE - hitAreaSize) / 2}px;
|
|
180
|
+
width: ${hitAreaSize}px;
|
|
181
|
+
height: ${hitAreaSize}px;
|
|
183
182
|
border-radius: 50%;
|
|
184
183
|
background: ${theme.color.background.neutralAltActive};
|
|
185
184
|
opacity: 0;
|
|
@@ -197,9 +196,8 @@ const CheckboxContainer = styled.span(({ theme, spacer, disabled, size }) => css
|
|
|
197
196
|
const StyledInput = styled.input(({ size }) => css `
|
|
198
197
|
cursor: inherit;
|
|
199
198
|
position: absolute;
|
|
200
|
-
top:
|
|
201
|
-
left:
|
|
202
|
-
transform: translate(-50%, -50%);
|
|
199
|
+
top: ${(DEFAULT_CHECKBOX_SIZE - size) / 2}px;
|
|
200
|
+
left: ${(DEFAULT_CHECKBOX_SIZE - size) / 2}px;
|
|
203
201
|
opacity: 0;
|
|
204
202
|
width: ${size}px;
|
|
205
203
|
height: ${size}px;
|