@ehfuse/mui-form-controls 3.0.59 → 3.0.61

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/dist/types.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import * as React from "react";
9
9
  import type { TextFieldProps as MuiTextFieldProps } from "@mui/material/TextField";
10
+ import type { ChipProps } from "@mui/material/Chip";
10
11
  import type { SxProps, Theme } from "@mui/material/styles";
11
12
  import type { CheckboxProps as MuiCheckboxProps } from "@mui/material/Checkbox";
12
13
  import type { SwitchProps as MuiSwitchProps } from "@mui/material/Switch";
@@ -271,6 +272,38 @@ export type ClearTextFieldProps = TextFieldProps & BaseTextFieldProps & {
271
272
  spellCheck?: boolean;
272
273
  onClear?: () => void;
273
274
  };
275
+ export type TagsTextFieldProps = Omit<TextFieldProps, "value" | "defaultValue" | "onChange" | "type" | "select" | "multiline"> & BaseTextFieldProps & {
276
+ value?: string[];
277
+ defaultValue?: string[];
278
+ onChange?: (value: string[]) => void;
279
+ separators?: string[];
280
+ allowDuplicates?: boolean;
281
+ maxTags?: number;
282
+ chipProps?: Partial<ChipProps>;
283
+ chipsSx?: SxProps<Theme>;
284
+ deleteIconSx?: SxProps<Theme>;
285
+ draggable?: boolean;
286
+ spaceToConfirm?: boolean;
287
+ backspaceToDelete?: boolean;
288
+ showDeleteIcon?: boolean;
289
+ /**
290
+ * X 클릭 직전. `false`를 반환하면 삭제를 진행하지 않음(동기 가드·모달 전 차단 등).
291
+ * `onDelete`가 없을 때만 기본 삭제와 조합됨.
292
+ */
293
+ onDeleteBefore?: (event: React.SyntheticEvent, tag: string, index: number) => boolean | void;
294
+ /**
295
+ * X 클릭 시 호출. 지정하면 **기본 삭제는 하지 않으며** 이 콜백만 실행됨.
296
+ * 모달 확인 후 `onChange`/`form.setFormValue`로 배열에서 제거하면 됨.
297
+ * 지정하지 않으면 내부에서 태그를 제거한 뒤 `onChange`만 호출함.
298
+ */
299
+ onDelete?: (event: React.SyntheticEvent, tag: string, index: number) => void;
300
+ /**
301
+ * 태그 칩 본문 클릭 시(삭제 아이콘 제외). 상세 모달·라우팅 등에 사용.
302
+ * `chipProps.onClick`이 있으면 먼저 호출한 뒤, `event.defaultPrevented`가 아니면 이 콜백을 호출함.
303
+ * `draggable`이 true이면 짧은 클릭과 드래그가 겹칠 수 있음(센서는 기본 5px 이동 후 드래그).
304
+ */
305
+ onTagClick?: (event: React.MouseEvent, tag: string, index: number) => void;
306
+ };
274
307
  /**
275
308
  * 비밀번호 유효성 검사 규칙
276
309
  */
@@ -112,3 +112,34 @@ export declare function buildDateOutputValue(formattedValue: string, format: Dat
112
112
  * Date 객체에서 포맷에 맞는 숫자 문자열 생성
113
113
  */
114
114
  export declare function dateToNumbers(date: Date, format: DateFormat): string;
115
+ export type ParsedPasteDateTime = {
116
+ dateDisplay: string;
117
+ hour: string;
118
+ minute: string;
119
+ second: string;
120
+ /** 연도 없는 날짜 포맷에서 ISO 등으로 연도를 알 수 있을 때 */
121
+ internalYear?: number | null;
122
+ };
123
+ /**
124
+ * DateTimeTextField용: 클립보드 텍스트가 현재 날짜·시간 포맷과 호환되면 파싱 결과를 반환한다.
125
+ * AM/PM 없는 시간은 24시간 해석 후 12시간 표시로 변환한다.
126
+ */
127
+ export declare function tryParsePastedDateTimeClipboard(raw: string, dateFormat: DateFormat, _dateTimeFormat: DateTimeFormat, options: {
128
+ hasSecond: boolean;
129
+ is12Hour: boolean;
130
+ minDateTime?: Date;
131
+ maxDateTime?: Date;
132
+ minTime?: string;
133
+ maxTime?: string;
134
+ }): ParsedPasteDateTime | null;
135
+ export type ParsedPasteDateOnly = {
136
+ display: string;
137
+ internalYear?: number | null;
138
+ };
139
+ /**
140
+ * DateTextField용: "YYYY-MM-DD" 또는 "YYYY-MM-DD HH:mm" 등에서 날짜만 파싱
141
+ */
142
+ export declare function tryParsePastedDateClipboard(raw: string, dateFormat: DateFormat, options: {
143
+ minDate?: Date;
144
+ maxDate?: Date;
145
+ }): ParsedPasteDateOnly | null;
@@ -5,7 +5,8 @@
5
5
  * @copyright 2025 김영진 (Kim Young Jin)
6
6
  * @author 김영진 (ehfuse@gmail.com)
7
7
  */
8
- export { isLeapYear, getDaysInMonth, getSeparator, formatDate, getMaxLength, getCompleteLength, parseDateParts, validateDate, parseToDate, clampDateValue, extractDateFormat, hasSecondField, constrainDateNumbers, formatDateValue, formatToPlaceholder, getSegmentRange, hasYearInFormat, has2DigitYear, convertYY2YYYY, parseDateWithInternalYear, buildDateOutputValue, dateToNumbers, } from "./date";
8
+ export { isLeapYear, getDaysInMonth, getSeparator, formatDate, getMaxLength, getCompleteLength, parseDateParts, validateDate, parseToDate, clampDateValue, extractDateFormat, hasSecondField, constrainDateNumbers, formatDateValue, formatToPlaceholder, getSegmentRange, hasYearInFormat, has2DigitYear, convertYY2YYYY, parseDateWithInternalYear, buildDateOutputValue, dateToNumbers, tryParsePastedDateTimeClipboard, tryParsePastedDateClipboard, } from "./date";
9
+ export type { ParsedPasteDateTime, ParsedPasteDateOnly } from "./date";
9
10
  export { getTimeFieldCount, is12HourFormat, validateTime, clampTimeValue, } from "./time";
10
11
  export { formatNumber, parseNumber } from "./number";
11
12
  export { DEFAULT_EMAIL_DOMAINS, validateEmail } from "./email";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ehfuse/mui-form-controls",
3
- "version": "3.0.59",
3
+ "version": "3.0.61",
4
4
  "description": "Material-UI form controls and text fields for complex forms",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -86,5 +86,11 @@
86
86
  "react-daum-postcode": {
87
87
  "optional": true
88
88
  }
89
+ },
90
+ "dependencies": {
91
+ "@dnd-kit/core": "^6.3.1",
92
+ "@dnd-kit/modifiers": "^9.0.0",
93
+ "@dnd-kit/sortable": "^10.0.0",
94
+ "@dnd-kit/utilities": "^3.2.2"
89
95
  }
90
96
  }