@team-monolith/cds 1.114.2 → 1.115.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.
@@ -24,6 +24,8 @@ export interface CheckboxInputProps {
24
24
  onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;
25
25
  /** HTML input 태그에 전달될 props */
26
26
  inputProps?: InputHTMLAttributes<HTMLInputElement>;
27
+ /** 클릭 가능한 영역의 한 변의 길이(px). 기본값은 16px */
28
+ hitAreaSize?: number;
27
29
  }
28
30
  /**
29
31
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-907&t=G4t39O7uXZvsGQ9u-0)
@@ -105,7 +105,7 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => ({
105
105
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-907&t=G4t39O7uXZvsGQ9u-0)
106
106
  */
107
107
  export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref) {
108
- const { className, checked, label, spacer, disabled, partial, onChange, onClick: _onClick, inputProps } = props, other = __rest(props, ["className", "checked", "label", "spacer", "disabled", "partial", "onChange", "onClick", "inputProps"]);
108
+ const { className, checked, label, spacer, disabled, partial, onChange, onClick: _onClick, inputProps, hitAreaSize } = props, other = __rest(props, ["className", "checked", "label", "spacer", "disabled", "partial", "onChange", "onClick", "inputProps", "hitAreaSize"]);
109
109
  if (!label) {
110
110
  return _jsx(Checkbox, Object.assign({}, props, { ref: ref }));
111
111
  }
@@ -116,6 +116,7 @@ export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref)
116
116
  partial,
117
117
  onChange,
118
118
  inputProps,
119
+ hitAreaSize,
119
120
  };
120
121
  return (_jsxs(Label, Object.assign({ className: [checkboxInputClasses.root, className]
121
122
  .filter(Boolean)
@@ -124,35 +125,37 @@ export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref)
124
125
  `, children: label })] })));
125
126
  });
126
127
  const Checkbox = React.forwardRef(function Checkbox(props, ref) {
127
- const { className, checked, partial, disabled = false, spacer = false, onChange, onClick, inputProps } = props, other = __rest(props, ["className", "checked", "partial", "disabled", "spacer", "onChange", "onClick", "inputProps"]);
128
+ const { className, checked, partial, disabled = false, spacer = false, onChange, onClick, inputProps, hitAreaSize = 16 } = props, other = __rest(props, ["className", "checked", "partial", "disabled", "spacer", "onChange", "onClick", "inputProps", "hitAreaSize"]);
128
129
  const type = checked
129
130
  ? "checked"
130
131
  : partial
131
132
  ? "partial"
132
133
  : "default";
133
- return (_jsxs(CheckboxContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled, ref: ref }, other, { children: [_jsx(StyledInput, Object.assign({ type: "checkbox" }, inputProps, { checked: checked, disabled: disabled, onClick: onClick, onChange: onChange })), _jsx(CheckboxIcon, { type: type, disabled: disabled })] })));
134
+ return (_jsxs(CheckboxContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled, size: hitAreaSize, ref: ref }, other, { children: [_jsx(StyledInput, Object.assign({ type: "checkbox" }, inputProps, { checked: checked, disabled: disabled, onClick: onClick, onChange: onChange, size: hitAreaSize })), _jsx(CheckboxIcon, { type: type, disabled: disabled })] })));
134
135
  });
135
- const CheckboxContainer = styled.span(({ spacer, disabled }) => css `
136
- display: inline-flex;
136
+ const CheckboxContainer = styled.span(({ spacer, disabled, size }) => css `
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: center;
137
140
  position: relative;
138
- width: 16px;
139
- height: 16px;
141
+ width: ${size}px;
142
+ height: ${size}px;
140
143
  cursor: ${disabled ? "default" : "pointer"};
141
144
  margin-bottom: ${spacer ? "8px" : "0"};
142
145
  `);
143
- const StyledInput = styled.input `
146
+ const StyledInput = styled.input(({ size }) => css `
144
147
  cursor: inherit;
145
148
  position: absolute;
146
149
  top: 0;
147
150
  left: 0;
148
151
  opacity: 0;
149
- width: 16px;
150
- height: 16px;
152
+ width: ${size}px;
153
+ height: ${size}px;
151
154
  margin: 0;
152
155
  padding: 0;
153
156
  // input 컴포넌트는 보이지 않지만, 클릭이 가능하게 z-index를 설정합니다.
154
157
  z-index: ${ZINDEX.inputBase};
155
- `;
158
+ `);
156
159
  const Label = styled.label `
157
160
  display: flex;
158
161
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.114.2",
3
+ "version": "1.115.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,