@team-monolith/cds 1.115.2 → 1.116.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,8 +24,6 @@ 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;
29
27
  }
30
28
  /**
31
29
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-907&t=G4t39O7uXZvsGQ9u-0)
@@ -15,7 +15,6 @@ import { css, useTheme } from "@emotion/react";
15
15
  import * as React from "react";
16
16
  import styled from "@emotion/styled";
17
17
  import { ZINDEX } from "../utils/zIndex";
18
- const DEFAULT_CHECKBOX_SIZE = 16;
19
18
  export const checkboxInputClasses = {
20
19
  root: "CheckboxInput",
21
20
  checkbox: "CheckboxInput-checkbox",
@@ -40,11 +39,6 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => ({
40
39
  stroke: ${theme.color.background.primary};
41
40
  }
42
41
  }
43
- input[type="checkbox"]:focus-visible + & {
44
- rect {
45
- stroke: ${theme.color.background.primary};
46
- }
47
- }
48
42
  `}
49
43
  `,
50
44
  checked: css `
@@ -72,12 +66,6 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => ({
72
66
  stroke: ${theme.color.background.primaryActive};
73
67
  }
74
68
  }
75
- input[type="checkbox"]:focus-visible + & {
76
- rect {
77
- fill: ${theme.color.background.primaryActive};
78
- stroke: ${theme.color.background.primaryActive};
79
- }
80
- }
81
69
  `}
82
70
  `,
83
71
  partial: css `
@@ -110,15 +98,6 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => ({
110
98
  stroke: none;
111
99
  }
112
100
  }
113
- input[type="checkbox"]:focus-visible + & {
114
- rect {
115
- stroke: ${theme.color.background.primaryActive};
116
- }
117
- rect + rect {
118
- fill: ${theme.color.background.primaryActive};
119
- stroke: none;
120
- }
121
- }
122
101
  `}
123
102
  `,
124
103
  })[type];
@@ -126,7 +105,7 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => ({
126
105
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-907&t=G4t39O7uXZvsGQ9u-0)
127
106
  */
128
107
  export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref) {
129
- 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"]);
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"]);
130
109
  if (!label) {
131
110
  return _jsx(Checkbox, Object.assign({}, props, { ref: ref }));
132
111
  }
@@ -137,7 +116,6 @@ export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref)
137
116
  partial,
138
117
  onChange,
139
118
  inputProps,
140
- hitAreaSize,
141
119
  };
142
120
  return (_jsxs(Label, Object.assign({ className: [checkboxInputClasses.root, className]
143
121
  .filter(Boolean)
@@ -146,68 +124,35 @@ export const CheckboxInput = React.forwardRef(function CheckboxInput(props, ref)
146
124
  `, children: label })] })));
147
125
  });
148
126
  const Checkbox = React.forwardRef(function Checkbox(props, ref) {
149
- const { className, checked, partial, disabled = false, spacer = false, onChange, onClick, inputProps, hitAreaSize = DEFAULT_CHECKBOX_SIZE } = props, other = __rest(props, ["className", "checked", "partial", "disabled", "spacer", "onChange", "onClick", "inputProps", "hitAreaSize"]);
127
+ const { className, checked, partial, disabled = false, spacer = false, onChange, onClick, inputProps } = props, other = __rest(props, ["className", "checked", "partial", "disabled", "spacer", "onChange", "onClick", "inputProps"]);
150
128
  const type = checked
151
129
  ? "checked"
152
130
  : partial
153
131
  ? "partial"
154
132
  : "default";
155
- const clampedSize = Math.max(hitAreaSize, DEFAULT_CHECKBOX_SIZE);
156
- return (_jsxs(CheckboxContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled, size: 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 })] })));
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 })] })));
157
134
  });
158
- const CheckboxContainer = styled.span(({ theme, spacer, disabled, size }) => css `
159
- display: flex;
160
- align-items: center;
161
- justify-content: center;
135
+ const CheckboxContainer = styled.span(({ spacer, disabled }) => css `
136
+ display: inline-flex;
162
137
  position: relative;
163
- width: ${DEFAULT_CHECKBOX_SIZE}px;
164
- height: ${DEFAULT_CHECKBOX_SIZE}px;
138
+ width: 16px;
139
+ height: 16px;
165
140
  cursor: ${disabled ? "default" : "pointer"};
166
141
  margin-bottom: ${spacer ? "8px" : "0"};
167
-
168
- svg {
169
- z-index: 1;
170
- pointer-events: none;
171
- }
172
-
173
- ${size > DEFAULT_CHECKBOX_SIZE &&
174
- css `
175
- &::before {
176
- content: "";
177
- position: absolute;
178
- top: 50%;
179
- left: 50%;
180
- transform: translate(-50%, -50%);
181
- width: ${size}px;
182
- height: ${size}px;
183
- border-radius: 50%;
184
- background: ${theme.color.background.neutralAltActive};
185
- opacity: 0;
186
- pointer-events: none;
187
- }
188
- `}
189
- ${!disabled &&
190
- css `
191
- &:hover::before,
192
- &:focus-visible::before {
193
- opacity: 0.5; /* input 영역 hover 및 focus 시 표시 */
194
- }
195
- `}
196
- `);
197
- const StyledInput = styled.input(({ size }) => css `
198
- cursor: inherit;
199
- position: absolute;
200
- top: 50%;
201
- left: 50%;
202
- transform: translate(-50%, -50%);
203
- opacity: 0;
204
- width: ${size}px;
205
- height: ${size}px;
206
- margin: 0;
207
- padding: 0;
208
- // input 컴포넌트는 보이지 않지만, 클릭이 가능하게 z-index를 설정합니다.
209
- z-index: ${ZINDEX.inputBase};
210
142
  `);
143
+ const StyledInput = styled.input `
144
+ cursor: inherit;
145
+ position: absolute;
146
+ top: 0;
147
+ left: 0;
148
+ opacity: 0;
149
+ width: 16px;
150
+ height: 16px;
151
+ margin: 0;
152
+ padding: 0;
153
+ // input 컴포넌트는 보이지 않지만, 클릭이 가능하게 z-index를 설정합니다.
154
+ z-index: ${ZINDEX.inputBase};
155
+ `;
211
156
  const Label = styled.label `
212
157
  display: flex;
213
158
  position: relative;
@@ -19,6 +19,8 @@ export interface LexicalEditorProps {
19
19
  isQuizEnabled?: boolean;
20
20
  /** 렉시컬 플러그인의 파일 블록 노출의 유무, false가 디폴트이고, 전달하지 않아도 로컬스토리지 devMode로도 노출시킬 수 있습니다. */
21
21
  showFileUpload?: boolean;
22
+ /** 에디터가 마운트될 때 자동으로 포커스를 설정할지 여부. true가 디폴트입니다. */
23
+ autoFocus?: boolean;
22
24
  /** 외부에서 플러그인을 주입하는 경우 활용함 */
23
25
  children?: JSX.Element | string | (JSX.Element | string)[];
24
26
  }
@@ -39,7 +39,7 @@ function getCleanObject(obj) {
39
39
  return newObj;
40
40
  }
41
41
  export function LexicalEditor(props) {
42
- const { className, contentEditableClassName, value, onChange, editable = true, showQuizSolution = false, freezeProblemNode = false, isSheetEnabled = false, isQuizEnabled = false, showFileUpload = false, children, } = props;
42
+ const { className, contentEditableClassName, value, onChange, editable = true, showQuizSolution = false, freezeProblemNode = false, isSheetEnabled = false, isQuizEnabled = false, showFileUpload = false, autoFocus = true, children, } = props;
43
43
  const theme = useTheme();
44
44
  const initialConfig = {
45
45
  namespace: "CustomLexicalEditor",
@@ -62,5 +62,5 @@ export function LexicalEditor(props) {
62
62
  }
63
63
  }
64
64
  : undefined;
65
- return (_jsx(LexicalCustomConfigContext.Provider, { value: { freezeProblemNode, showQuizSolution, showFileUpload }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Plugins, { className: className, contentEditableClassName: contentEditableClassName, onChange: onChangeHandler, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload }), _jsx(_Fragment, { children: children })] }) }));
65
+ return (_jsx(LexicalCustomConfigContext.Provider, { value: { freezeProblemNode, showQuizSolution, showFileUpload }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Plugins, { className: className, contentEditableClassName: contentEditableClassName, onChange: onChangeHandler, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload, autoFocus: autoFocus }), _jsx(_Fragment, { children: children })] }) }));
66
66
  }
@@ -11,5 +11,6 @@ export interface PluginsProps {
11
11
  isSheetEnabled: boolean;
12
12
  isQuizEnabled: boolean;
13
13
  showFileUpload: boolean;
14
+ autoFocus: boolean;
14
15
  }
15
16
  export declare function Plugins(props: PluginsProps): ReactElement;
@@ -39,7 +39,7 @@ import { DragDropPastePlugin } from "./plugins/DragDropPastePlugin";
39
39
  import { ParagraphPlaceholderPlugin } from "./plugins/ParagraphPlaceholderPlugin";
40
40
  import { AutoLinkPlugin } from "./plugins/AutoLinkPlugin";
41
41
  export function Plugins(props) {
42
- const { className, contentEditableClassName, onChange, isSheetEnabled, isQuizEnabled, showFileUpload, } = props;
42
+ const { className, contentEditableClassName, onChange, isSheetEnabled, isQuizEnabled, showFileUpload, autoFocus, } = props;
43
43
  const isEditable = useLexicalEditable();
44
44
  const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
45
45
  const [isLinkEditMode, setIsLinkEditMode] = useState(false);
@@ -52,7 +52,7 @@ export function Plugins(props) {
52
52
  onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
53
53
  },
54
54
  // ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
55
- ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload }), _jsx(MarkdownShortcutPlugin, { transformers: CUSTOM_TRANSFORMERS }), _jsx(HistoryPlugin, {}), _jsx(ParagraphPlaceholderPlugin, { placeholder: "\uBA85\uB839\uC5B4 \uC0AC\uC6A9 \uC2DC\uC5D0\uB294 '/'\uB97C \uB204\uB974\uC138\uC694. \uBE14\uB85D\uC5D0 \uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB824 \uB098\uD0C0\uB098\uB294 '+'\uB97C \uD074\uB9AD\uD558\uBA74 \uC544\uB798\uC5D0 \uBE14\uB85D\uC744 \uCD94\uAC00\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4." })] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(ClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(VideosPlugin, {}), _jsx(FilePlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {}), _jsx(SelfEvaluationPlugin, {}), _jsx(AutoLinkPlugin, {})] }));
55
+ ignoreSelectionChange: true }), autoFocus && _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload }), _jsx(MarkdownShortcutPlugin, { transformers: CUSTOM_TRANSFORMERS }), _jsx(HistoryPlugin, {}), _jsx(ParagraphPlaceholderPlugin, { placeholder: "\uBA85\uB839\uC5B4 \uC0AC\uC6A9 \uC2DC\uC5D0\uB294 '/'\uB97C \uB204\uB974\uC138\uC694. \uBE14\uB85D\uC5D0 \uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB824 \uB098\uD0C0\uB098\uB294 '+'\uB97C \uD074\uB9AD\uD558\uBA74 \uC544\uB798\uC5D0 \uBE14\uB85D\uC744 \uCD94\uAC00\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4." })] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled, showFileUpload: showFileUpload }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(ClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(VideosPlugin, {}), _jsx(FilePlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {}), _jsx(SelfEvaluationPlugin, {}), _jsx(AutoLinkPlugin, {})] }));
56
56
  }
57
57
  const ScrollArea = styled.div `
58
58
  min-height: 150px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.115.2",
3
+ "version": "1.116.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,