@ehfuse/mui-form-controls 3.2.0 → 3.2.1

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.
@@ -11,6 +11,12 @@
11
11
  * 실제 입력 요소/IME/포커스 머신러리가 없어 렌더 비용이 크게 낮다.
12
12
  * 실제 <input> 이 꼭 필요하면 소비처가 `readonlyInput` prop 으로 예전 동작(진짜 입력칸)을 되살릴 수 있다.
13
13
  *
14
+ * ⚠️ 클래스 호환: 소비처 `sx` 에는 `& .MuiInputBase-input { textAlign }`, `& .MuiOutlinedInput-root { minHeight }`
15
+ * 같은 MUI 내부 셀렉터가 흔하다. 박스 렌더로 바뀌어도 그 스타일이 죽지 않도록 각 파트에 MUI 와 동일한
16
+ * 클래스명(MuiInputBase-root / MuiOutlinedInput-root / MuiInputBase-input / MuiOutlinedInput-input /
17
+ * MuiOutlinedInput-notchedOutline / MuiInputLabel-root / Mui-disabled)을 그대로 붙이고,
18
+ * 값 텍스트가 MUI input 과 같은 패딩을 갖게 해서 패딩/정렬 override 도 동일하게 먹도록 맞춘다.
19
+ *
14
20
  * @license MIT
15
21
  * @copyright 2025 김영진 (Kim Young Jin)
16
22
  * @author 김영진 (ehfuse@gmail.com)
@@ -36,6 +42,8 @@ export interface ReadonlyDisplayProps {
36
42
  dimmed?: boolean;
37
43
  /** true 면 값의 줄바꿈을 보존하고 여러 줄로 표시한다(말줄임 대신). */
38
44
  multiline?: boolean;
45
+ /** multiline 일 때 최소 줄 수(입력칸의 minRows 와 같은 높이를 유지한다). */
46
+ minRows?: number;
39
47
  /** 값 표시 영역 클릭 핸들러(읽기 전용 칸을 눌러 다이얼로그를 여는 패턴 지원). */
40
48
  onClick?: React.MouseEventHandler<HTMLDivElement>;
41
49
  /** 네이티브 툴팁. */
@@ -45,4 +53,4 @@ export interface ReadonlyDisplayProps {
45
53
  sx?: SxProps<Theme>;
46
54
  }
47
55
  /** readonly/disabled 입력칸을 실제 input 없이 그리는 표시 컴포넌트. */
48
- export declare function ReadonlyDisplay({ label, value, prefix, suffix, startAdornment, endAdornment, showAffixOnlyWithValue, align, size, fullWidth, dimmed, multiline, onClick, title, className, id, sx, }: ReadonlyDisplayProps): import("react/jsx-runtime").JSX.Element;
56
+ export declare function ReadonlyDisplay({ label, value, prefix, suffix, startAdornment, endAdornment, showAffixOnlyWithValue, align, size, fullWidth, dimmed, multiline, minRows, onClick, title, className, id, sx, }: ReadonlyDisplayProps): import("react/jsx-runtime").JSX.Element;
@@ -32,6 +32,17 @@ export type ReadonlyBoxFlags = {
32
32
  * readonly 든 disabled 든 "편집 불가" 이므로 둘 다 박스로 간다. 차이는 흐림(dimmed) 뿐이다.
33
33
  */
34
34
  export declare function shouldRenderReadonlyBox(props: ReadonlyBoxFlags): boolean;
35
+ /**
36
+ * slotProps 에서 박스 렌더가 살릴 수 있는 것만 뽑는다.
37
+ * - `input.start/endAdornment` : 박스에도 그대로 붙인다(복사 버튼 등 클릭 가능한 요소 포함).
38
+ * - `htmlInput.style.textAlign` : 값 정렬로 옮긴다.
39
+ * 함수형 slotProps 는 ownerState 가 없어 해석할 수 없으므로 무시한다.
40
+ */
41
+ export declare function pickSlotPropsForBox(slotProps: unknown): {
42
+ startAdornment?: React.ReactNode;
43
+ endAdornment?: React.ReactNode;
44
+ align?: "left" | "right" | "center";
45
+ };
35
46
  /** 컨트롤 props 에서 박스 렌더에 필요한 공통 필드만 뽑는다(컴포넌트마다 반복되는 보일러플레이트 제거). */
36
47
  export declare function commonReadonlyBoxProps(props: {
37
48
  form?: FormLike | null;
@@ -45,7 +56,17 @@ export declare function commonReadonlyBoxProps(props: {
45
56
  id?: string;
46
57
  onClick?: unknown;
47
58
  sx?: ReadonlyDisplayProps["sx"];
59
+ slotProps?: unknown;
60
+ multiline?: boolean;
61
+ minRows?: number | string;
62
+ /** Select/LabelSelect 는 바깥 FormControl 에 레이아웃 sx 를 받는다 — 박스에도 함께 적용한다. */
63
+ formControlProps?: {
64
+ sx?: ReadonlyDisplayProps["sx"];
65
+ };
48
66
  }): {
67
+ startAdornment?: React.ReactNode;
68
+ endAdornment?: React.ReactNode;
69
+ align?: "left" | "right" | "center";
49
70
  form: FormLike | null | undefined;
50
71
  name: string | undefined;
51
72
  value: unknown;
@@ -56,6 +77,8 @@ export declare function commonReadonlyBoxProps(props: {
56
77
  className: string | undefined;
57
78
  id: string | undefined;
58
79
  onClick: React.MouseEventHandler<HTMLDivElement>;
80
+ multiline: boolean;
81
+ minRows: number | undefined;
59
82
  sx: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
60
83
  };
61
84
  type ReadonlyFieldProps = Omit<ReadonlyDisplayProps, "value" | "dimmed"> & {