@tide-design/components 0.23.0 → 0.25.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.
@@ -1,7 +1,7 @@
1
1
  import { InputSize } from "../_internal/constants/inputClass.js";
2
- import { MaskFormatOptions, NumericFormatOptions, WithoutNumericOptions } from "./types.js";
2
+ import { MaskFormatOptions, NumericFormatOptions, NumericRangeOptions, WithoutNumericOptions } from "./types.js";
3
3
  import { ComponentProps, ReactElement } from "react";
4
- export interface NumberFormatInputOwnProps extends NumericFormatOptions {
4
+ export interface NumberFormatInputOwnProps extends NumericFormatOptions, NumericRangeOptions {
5
5
  /** 패턴 모드 틀. `#` 자리에 숫자가 들어간다(`"###-####-####"`). 주면 숫자 모드 옵션은 받지 않는다. */
6
6
  mask?: MaskFormatOptions["mask"];
7
7
  /**
@@ -28,12 +28,12 @@ type NumberFormatInputModeProps = {
28
28
  mask?: undefined;
29
29
  value?: number | null;
30
30
  defaultValue?: number | null;
31
- } | (Required<Pick<MaskFormatOptions, "mask">> & WithoutNumericOptions);
31
+ } | (Required<Pick<MaskFormatOptions, "mask">> & WithoutNumericOptions & { [K in keyof NumericRangeOptions]?: undefined; });
32
32
  export type NumberFormatInputProps = NumberFormatInputModeProps & NumberFormatInputOwnProps & Omit<ComponentProps<"input">, keyof NumberFormatInputOwnProps | "type" | "pattern" | "children" | "dangerouslySetInnerHTML">;
33
33
  /**
34
- * 칠 때 바로 포맷하는 숫자 입력. 천 단위 구분자·prefix·suffix·소수 자릿수(숫자 모드)와
34
+ * 칠 때 바로 포맷하는 숫자 입력. 자릿수 묶음·prefix·suffix·소수 자릿수(숫자 모드)와
35
35
  * `mask` 틀(패턴 모드)을 다룬다. `<input type="text">`이고 Field 안에서 label·설명·오류가 연결된다.
36
- * Tide props: `mask`, `value`, `defaultValue`, `onValueChange`, `size`, `invalid`, `prefix`, `suffix`, `decimalPlaces`, `fixedDecimalPlaces`, `allowNegative`, `groupStyle`, `groupSeparator`, `decimalSeparator`, `locale` ({@link NumberFormatInputOwnProps}). 나머지는 `<input>` 속성.
36
+ * Tide props: `mask`, `value`, `defaultValue`, `onValueChange`, `size`, `invalid`, `prefix`, `suffix`, `decimalPlaces`, `fixedDecimalPlaces`, `allowNegative`, `min`, `max`, `groupStyle`, `groupSeparator`, `decimalSeparator`, `locale` ({@link NumberFormatInputOwnProps}). 나머지는 `<input>` 속성.
37
37
  */
38
- export declare function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, suffix, decimalPlaces, fixedDecimalPlaces, allowNegative, groupStyle, groupSeparator, decimalSeparator, locale, inputMode, ref, onInput, onChange, ...props }: NumberFormatInputProps): ReactElement;
38
+ export declare function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, suffix, decimalPlaces, fixedDecimalPlaces, allowNegative, min, max, groupStyle, groupSeparator, decimalSeparator, locale, inputMode, ref, onInput, onChange, ...props }: NumberFormatInputProps): ReactElement;
39
39
  export {};
@@ -6,23 +6,25 @@ import { createInputGuard } from "./libs/inputGuard.js";
6
6
  import { createMaskFormatter } from "./libs/maskFormatter.js";
7
7
  import { createNumericFormatter } from "./libs/numericFormatter.js";
8
8
  import { jsx } from "react/jsx-runtime";
9
- import { useMemo } from "react";
9
+ import { useLayoutEffect, useMemo, useRef } from "react";
10
10
  import { useMaskito } from "@maskito/react";
11
11
  import { mergeRefs } from "react-aria";
12
12
 
13
13
  // src/NumberFormatInput/NumberFormatInput.tsx
14
14
  /**
15
- * 칠 때 바로 포맷하는 숫자 입력. 천 단위 구분자·prefix·suffix·소수 자릿수(숫자 모드)와
15
+ * 칠 때 바로 포맷하는 숫자 입력. 자릿수 묶음·prefix·suffix·소수 자릿수(숫자 모드)와
16
16
  * `mask` 틀(패턴 모드)을 다룬다. `<input type="text">`이고 Field 안에서 label·설명·오류가 연결된다.
17
- * Tide props: `mask`, `value`, `defaultValue`, `onValueChange`, `size`, `invalid`, `prefix`, `suffix`, `decimalPlaces`, `fixedDecimalPlaces`, `allowNegative`, `groupStyle`, `groupSeparator`, `decimalSeparator`, `locale` ({@link NumberFormatInputOwnProps}). 나머지는 `<input>` 속성.
17
+ * Tide props: `mask`, `value`, `defaultValue`, `onValueChange`, `size`, `invalid`, `prefix`, `suffix`, `decimalPlaces`, `fixedDecimalPlaces`, `allowNegative`, `min`, `max`, `groupStyle`, `groupSeparator`, `decimalSeparator`, `locale` ({@link NumberFormatInputOwnProps}). 나머지는 `<input>` 속성.
18
18
  */
19
- function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, suffix, decimalPlaces, fixedDecimalPlaces, allowNegative, groupStyle, groupSeparator, decimalSeparator, locale, inputMode, ref, onInput, onChange, ...props }) {
19
+ function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, suffix, decimalPlaces, fixedDecimalPlaces, allowNegative, min, max, groupStyle, groupSeparator, decimalSeparator, locale, inputMode, ref, onInput, onChange, ...props }) {
20
20
  const formatterKey = JSON.stringify(mask === void 0 ? {
21
21
  prefix,
22
22
  suffix,
23
23
  decimalPlaces,
24
24
  fixedDecimalPlaces,
25
25
  allowNegative,
26
+ min,
27
+ max,
26
28
  groupStyle,
27
29
  groupSeparator,
28
30
  decimalSeparator,
@@ -39,7 +41,7 @@ function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, s
39
41
  defaultValue,
40
42
  onValueChange
41
43
  });
42
- const { committedText, onCompositionChange } = text;
44
+ const { committedText, isDraft, onCompositionChange } = text;
43
45
  const maskitoOptions = useMemo(() => ({
44
46
  ...formatter.maskOptions,
45
47
  plugins: [createInputGuard({
@@ -53,7 +55,16 @@ function NumberFormatInput({ mask, value, defaultValue, onValueChange, prefix, s
53
55
  onCompositionChange
54
56
  ]);
55
57
  const maskitoRef = useMaskito({ options: maskitoOptions });
56
- const mergedRef = useMemo(() => mergeRefs(ref, maskitoRef), [ref, maskitoRef]);
58
+ const inputRef = useRef(null);
59
+ const mergedRef = useMemo(() => mergeRefs(ref, maskitoRef, inputRef), [ref, maskitoRef]);
60
+ useLayoutEffect(() => {
61
+ const element = inputRef.current;
62
+ if (!isDraft && element?.matches(":focus")) formatter.limitCaret?.(element);
63
+ }, [
64
+ formatter,
65
+ isDraft,
66
+ text.text
67
+ ]);
57
68
  return /* @__PURE__ */ jsx(Input, {
58
69
  ...props,
59
70
  ref: mergedRef,
@@ -67,6 +67,7 @@ function useNumberText({ formatter, formatterKey, value, defaultValue, onValueCh
67
67
  };
68
68
  return {
69
69
  text: draft ?? state.text,
70
+ isDraft: draft !== null,
70
71
  committedText,
71
72
  onCompositionChange,
72
73
  onInput: (event) => {
@@ -1,3 +1,2 @@
1
1
  import { NumberFormatInput, NumberFormatInputOwnProps, NumberFormatInputProps } from "./NumberFormatInput.js";
2
- import { NumberGroupStyle } from "./types.js";
3
- export { NumberFormatInput, type NumberFormatInputOwnProps, type NumberFormatInputProps, type NumberGroupStyle };
2
+ export { NumberFormatInput, type NumberFormatInputOwnProps, type NumberFormatInputProps };
@@ -0,0 +1,32 @@
1
+ import { maskitoCaretGuard } from "@maskito/kit";
2
+
3
+ // src/NumberFormatInput/libs/caretGuard.ts
4
+ /**
5
+ * 커서를 `getCaretRange`의 범위 안에 둔다. 선택은 제한하지 않아 전체를 선택해 복사할 수 있다.
6
+ * Chromium은 `selectionchange`를 다음 글자보다 늦게 보낼 수 있어 `keydown`에서도 옮긴다(ADR 0043).
7
+ */
8
+ function createCaretGuard(getCaretRange) {
9
+ const getLimits = (value, [from, to]) => from === to ? getCaretRange(value) : [0, value.length];
10
+ const limitCaret = (element) => {
11
+ const from = element.selectionStart ?? 0;
12
+ const [start, end] = getLimits(element.value, [from, element.selectionEnd ?? from]);
13
+ const next = Math.min(Math.max(from, start), end);
14
+ if (next !== from) element.setSelectionRange(next, next);
15
+ };
16
+ return {
17
+ limitCaret,
18
+ plugin: (element, options) => {
19
+ const stop = maskitoCaretGuard(getLimits)(element, options);
20
+ const onKeyDown = (event) => {
21
+ if (!event.isComposing) limitCaret(element);
22
+ };
23
+ element.addEventListener("keydown", onKeyDown, { capture: true });
24
+ return () => {
25
+ stop?.();
26
+ element.removeEventListener("keydown", onKeyDown, { capture: true });
27
+ };
28
+ }
29
+ };
30
+ }
31
+
32
+ export { createCaretGuard };
@@ -1,5 +1,6 @@
1
1
  import { applyMask, maskDigits, sortMasks } from "./maskFormat.js";
2
- import { toLibraryNumericOptions, toNumericString } from "./numericFormat.js";
2
+ import { resolveSeparators, toNumericString } from "./numericFormat.js";
3
+ import { splitDigits } from "./splitDigits.js";
3
4
  import { numericFormatter } from "react-number-format";
4
5
 
5
6
  // src/NumberFormatInput/libs/formatNumber.ts
@@ -10,8 +11,26 @@ import { numericFormatter } from "react-number-format";
10
11
  function formatNumber(value, options = {}) {
11
12
  if (value === null || value === void 0 || Number.isNaN(value)) return "";
12
13
  if (options.mask !== void 0) return applyMask(maskDigits(String(value)), sortMasks(options.mask));
13
- const numStr = typeof value === "number" ? toNumericString(value, options.decimalPlaces) : value;
14
- return numericFormatter(numStr, toLibraryNumericOptions(options));
14
+ return formatNumeric(typeof value === "number" ? toNumericString(value, options.decimalPlaces) : value, options);
15
+ }
16
+ /**
17
+ * react-number-format은 정해진 묶음만 지원해 소수 자리·부호만 맡기고, 묶음은 Tide가 한다.
18
+ * prefix·suffix 안의 숫자나 점을 건드리지 않도록 묶은 뒤에 붙인다.
19
+ */
20
+ function formatNumeric(numStr, options) {
21
+ if (numStr === "" || numStr === "-") return numStr;
22
+ const { prefix = "", suffix = "", allowNegative = false } = options;
23
+ const { groupSize, group, decimal } = resolveSeparators(options);
24
+ const plain = numericFormatter(numStr, {
25
+ decimalScale: options.decimalPlaces,
26
+ fixedDecimalScale: options.fixedDecimalPlaces ?? false,
27
+ allowNegative,
28
+ decimalSeparator: "."
29
+ });
30
+ const sign = allowNegative && plain.startsWith("-") ? "-" : "";
31
+ const [integer = "", fraction] = plain.slice(sign.length).split(".");
32
+ const [zeros = ""] = /^[^1-9]*/.exec(integer) ?? [];
33
+ return `${sign}${prefix}${zeros}${integer.slice(zeros.length).replace(/\d+/g, (digits) => splitDigits(digits, groupSize).join(group))}${fraction === void 0 ? "" : `${decimal}${fraction}`}${suffix}`;
15
34
  }
16
35
 
17
36
  export { formatNumber };
@@ -10,22 +10,18 @@ function localeSeparators(locale) {
10
10
  decimal: parts.find((part) => part.type === "decimal")?.value ?? "."
11
11
  };
12
12
  }
13
- /** Tide 옵션을 react-number-format 옵션으로 바꾼다. */
14
- function toLibraryNumericOptions(options) {
13
+ /** 묶을 자릿수와 구분자를 정한다. 입력 칸과 `formatNumber`가 함께 쓴다. */
14
+ function resolveSeparators(options) {
15
15
  const separators = localeSeparators(options.locale);
16
16
  const groupSeparator = options.groupSeparator ?? separators.group;
17
- const decimalSeparator = options.decimalSeparator ?? separators.decimal;
18
- const groupStyle = options.groupStyle ?? "thousand";
17
+ const decimal = options.decimalSeparator ?? separators.decimal;
18
+ const groupStyle = options.groupStyle ?? 0;
19
+ const groupSize = Number.isInteger(groupStyle) && groupStyle > 0 ? groupStyle : 0;
19
20
  return {
20
- prefix: options.prefix,
21
- suffix: options.suffix,
22
- decimalScale: options.decimalPlaces,
23
- fixedDecimalScale: options.fixedDecimalPlaces ?? false,
24
- allowNegative: options.allowNegative ?? false,
25
- thousandSeparator: groupStyle === "none" ? false : groupSeparator,
26
- thousandsGroupStyle: groupStyle,
27
- decimalSeparator,
28
- allowedDecimalSeparators: [decimalSeparator, "."].filter((char) => char !== groupSeparator)
21
+ groupSize,
22
+ group: groupSize === 0 ? "" : groupSeparator,
23
+ decimal,
24
+ decimalKeys: [decimal, "."].filter((char) => char !== groupSeparator)
29
25
  };
30
26
  }
31
27
  /**
@@ -44,4 +40,4 @@ function toNumericString(value, decimalPlaces) {
44
40
  }).format(value);
45
41
  }
46
42
 
47
- export { toLibraryNumericOptions, toNumericString };
43
+ export { resolveSeparators, toNumericString };
@@ -1,32 +1,41 @@
1
- import { toLibraryNumericOptions, toNumericString } from "./numericFormat.js";
1
+ import { createCaretGuard } from "./caretGuard.js";
2
+ import { resolveSeparators, toNumericString } from "./numericFormat.js";
3
+ import { splitDigits } from "./splitDigits.js";
2
4
  import { maskitoTransform } from "@maskito/core";
3
5
  import { maskitoNumber } from "@maskito/kit";
4
6
 
5
7
  // src/NumberFormatInput/libs/numericFormatter.ts
6
- /** 만 단위로 묶는다(`1234567` → `123`, `4567`). */
7
- const wanGroups = (digits) => digits.match(/\d{1,4}(?=(?:\d{4})*$)/g) ?? [];
8
+ /** mask가 늘 버리는 글자. fixed는 넣는 글자 수만큼 덮어쓰므로 글자를 지우지 않고 이 글자로 바꾼다(ADR 0043). */
9
+ const REJECTED = "\0";
10
+ /** 대소문자·전각·호환 글자를 같게 본다(`M2`, `㎡`). */
11
+ const fold = (text) => text.normalize("NFKC").toLowerCase();
8
12
  /** 숫자 모드 포맷 규칙. 구분자는 `formatNumber`와 같은 방법으로 고른다. */
9
13
  function createNumericFormatter(options) {
10
- const separators = toLibraryNumericOptions(options);
11
- const decimal = separators.decimalSeparator ?? ".";
12
- const group = typeof separators.thousandSeparator === "string" ? separators.thousandSeparator : "";
13
- const decimalKeys = separators.allowedDecimalSeparators ?? [decimal];
14
+ const { groupSize, group, decimal, decimalKeys } = resolveSeparators(options);
14
15
  const prefix = options.prefix ?? "";
15
16
  const suffix = options.suffix ?? "";
17
+ const foldedSuffix = fold(suffix);
16
18
  const allowNegative = options.allowNegative ?? false;
17
19
  const { decimalPlaces } = options;
18
- const params = {
20
+ const min = options.min ?? void 0;
21
+ const max = options.max ?? void 0;
22
+ const display = {
19
23
  prefix,
20
24
  postfix: suffix,
21
25
  thousandSeparator: group,
26
+ thousandSeparatorPattern: (integer) => splitDigits(/\d*$/.exec(integer)?.[0] ?? "", groupSize),
22
27
  decimalSeparator: decimal,
23
28
  decimalPseudoSeparators: decimalKeys.filter((key) => key !== decimal),
24
29
  maximumFractionDigits: decimalPlaces ?? Infinity,
25
30
  minimumFractionDigits: options.fixedDecimalPlaces ? decimalPlaces ?? 0 : 0,
26
31
  minusSign: "-",
27
32
  negativePattern: "minusFirst",
28
- ...allowNegative ? {} : { min: 0 },
29
- ...options.groupStyle === "wan" ? { thousandSeparatorPattern: wanGroups } : {}
33
+ ...allowNegative ? {} : { min: 0 }
34
+ };
35
+ const params = {
36
+ ...display,
37
+ min: allowNegative ? min : Math.max(min ?? 0, 0),
38
+ max
30
39
  };
31
40
  /** prefix·suffix를 뺀 숫자 부분. prefix·suffix 안의 점을 소수점으로 보지 않으려고 쓴다. */
32
41
  const numberRange = (text) => {
@@ -62,20 +71,85 @@ function createNumericFormatter(options) {
62
71
  data: ""
63
72
  };
64
73
  };
74
+ /** 글자 앞에 온 suffix 조각의 길이. 숫자나 공백만으로는 조각으로 보지 않고, 이어진 숫자 중간에서 끊지 않는다. */
75
+ const suffixPartLength = (text) => {
76
+ const first = text.charAt(0);
77
+ if (/[0-90-9-]/.test(first) || decimalKeys.includes(first)) return 0;
78
+ let length = 0;
79
+ while (length < text.length && foldedSuffix.includes(fold(text.slice(0, length + 1)))) length += 1;
80
+ const part = text.slice(0, length);
81
+ const whole = /^[0-90-9]/.test(text.slice(length)) ? part.replace(/[0-90-9]+$/, "") : part;
82
+ return whole.trim() === "" ? 0 : whole.length;
83
+ };
84
+ /** 넣는 글자에서 suffix 조각을 가린다. Maskito가 suffix의 점과 숫자를 값으로 읽기 전에 해야 한다. */
85
+ const hideSuffix = ({ elementState, data }, actionType) => {
86
+ if (actionType !== "insert" || suffix === "") return {
87
+ elementState,
88
+ data
89
+ };
90
+ let body = data.slice(0, numberRange(data)[0]);
91
+ let isHidden = false;
92
+ while (body.length < data.length) {
93
+ const rest = data.slice(body.length);
94
+ const length = suffixPartLength(rest);
95
+ isHidden ||= length > 0;
96
+ const isPunctuation = isHidden && decimalKeys.includes(rest.charAt(0)) && !/^.[0-90-9]/.test(rest);
97
+ body += length > 0 || isPunctuation ? REJECTED.repeat(length || 1) : rest.charAt(0);
98
+ }
99
+ return {
100
+ elementState,
101
+ data: body
102
+ };
103
+ };
104
+ const numberMask = maskitoNumber({
105
+ ...params,
106
+ postfix: ""
107
+ }).mask;
108
+ /**
109
+ * mask는 숫자 사이의 글자가 suffix에도 있으면(공백 등) suffix로 받고 뒤 숫자를 버린다. 그래서 숫자에 쓸 수 없는 글자를 가린다.
110
+ * Maskito가 prefix·suffix를 빼고 점과 부호를 정리한 뒤에 해야 한다.
111
+ */
112
+ const keepNumber = ({ elementState, data }, actionType) => {
113
+ const { value, selection } = elementState;
114
+ if (actionType !== "insert" || suffix === "") return {
115
+ elementState,
116
+ data
117
+ };
118
+ let accepted = value.slice(0, selection[0]);
119
+ return {
120
+ elementState,
121
+ data: Array.from(data, (char) => {
122
+ if (!numberMask.test(accepted + char)) return REJECTED.repeat(char.length);
123
+ accepted += char;
124
+ return char;
125
+ }).join("")
126
+ };
127
+ };
128
+ const caretGuard = prefix === "" && suffix === "" ? void 0 : createCaretGuard((value) => {
129
+ const [start, end] = numberRange(value);
130
+ return [prefix === "" ? 0 : start, end];
131
+ });
65
132
  const base = maskitoNumber(params);
66
133
  return {
67
134
  maskOptions: {
68
135
  ...base,
69
- preprocessors: [singleDecimal, ...base.preprocessors ?? []],
136
+ plugins: [...base.plugins ?? [], ...caretGuard ? [caretGuard.plugin] : []],
137
+ preprocessors: [
138
+ singleDecimal,
139
+ hideSuffix,
140
+ ...base.preprocessors ?? [],
141
+ keepNumber
142
+ ],
70
143
  postprocessors: [...base.postprocessors ?? [], (state) => parse(state.value) === "" ? {
71
144
  value: "",
72
145
  selection: [0, 0]
73
146
  } : state]
74
147
  },
148
+ limitCaret: caretGuard?.limitCaret,
75
149
  parse,
76
150
  format: (digits) => {
77
151
  const signed = allowNegative ? digits : digits.replace("-", "");
78
- return signed === "" ? "" : maskitoTransform(signed.replace(".", decimal), maskitoNumber(params));
152
+ return signed === "" ? "" : maskitoTransform(signed.replace(".", decimal), maskitoNumber(display));
79
153
  },
80
154
  toValue: (digits) => {
81
155
  const value = Number.parseFloat(digits);
@@ -0,0 +1,10 @@
1
+ // src/NumberFormatInput/libs/splitDigits.ts
2
+ /** 숫자를 오른쪽부터 `size`자리씩 나눈다(`1234567`, 3 → `1`, `234`, `567`). `size`가 `0`이면 나누지 않는다. */
3
+ function splitDigits(digits, size) {
4
+ if (size === 0) return [digits];
5
+ const groups = [];
6
+ for (let end = digits.length; end > 0; end -= size) groups.unshift(digits.slice(Math.max(end - size, 0), end));
7
+ return groups;
8
+ }
9
+
10
+ export { splitDigits };
@@ -1,6 +1,4 @@
1
1
  import "@maskito/core";
2
- /** 숫자를 몇 자리씩 묶는지. `thousand` 1,234,567 · `wan` 123,4567(만 단위) · `none` 묶지 않음. */
3
- export type NumberGroupStyle = "thousand" | "wan" | "none";
4
2
  /** 숫자 모드 포맷 옵션. `NumberFormatInput`과 `formatNumber`가 같은 옵션으로 같은 글자를 만든다. */
5
3
  export interface NumericFormatOptions {
6
4
  /** 숫자 앞에 붙는 글자(예: `"₩"`). 값이 있을 때만 보인다. */
@@ -16,15 +14,25 @@ export interface NumericFormatOptions {
16
14
  fixedDecimalPlaces?: boolean;
17
15
  /** 음수(`-`)를 받는다. 기본값 `false`. */
18
16
  allowNegative?: boolean;
19
- /** 자릿수 묶음 방식. 기본값 `thousand`. */
20
- groupStyle?: NumberGroupStyle;
21
- /** 묶음 구분자. 기본값은 `locale`의 구분자, `locale`이 없으면 `","`. */
17
+ /** 정수를 몇 자리씩 묶을지(`3` → `1,234,567`, `4` → `123,4567`). 기본값은 묶지 않음. 양의 정수가 아니면 묶지 않는다. */
18
+ groupStyle?: number;
19
+ /** 묶음 구분자. `groupStyle`을 줄 때만 보인다. 기본값은 `locale`의 구분자, `locale`이 없으면 `","`. */
22
20
  groupSeparator?: string;
23
21
  /** 소수점 글자. 기본값은 `locale`의 소수점, `locale`이 없으면 `"."`. */
24
22
  decimalSeparator?: string;
25
- /** 구분자 기본값을 가져올 BCP 47 locale(예: `"de-DE"`). 묶음 방식은 바꾸지 않는다. */
23
+ /** 구분자 기본값을 가져올 BCP 47 locale(예: `"de-DE"`). 소수점은 늘 적용되고, 묶으려면 `groupStyle`도 준다. */
26
24
  locale?: string;
27
25
  }
26
+ /** 숫자 모드 입력 칸이 받는 값의 범위. 표시만 하는 `formatNumber`에는 없다. */
27
+ export interface NumericRangeOptions {
28
+ /**
29
+ * 받는 가장 작은 값. 입력 중에는 음수만 바로 맞추고, 양수는 칸을 벗어날 때 맞춘다.
30
+ * `allowNegative`가 아니면 `0`보다 작게 주어도 `0`이다.
31
+ */
32
+ min?: number;
33
+ /** 받는 가장 큰 값. 양수가 넘으면 입력 중에 바로, 음수가 넘으면 칸을 벗어날 때 이 값으로 맞춘다. */
34
+ max?: number;
35
+ }
28
36
  /** 패턴 모드 포맷 옵션 */
29
37
  export interface MaskFormatOptions {
30
38
  /**
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ import { Textarea, TextareaOwnProps, TextareaProps } from "./Textarea/Textarea.j
18
18
  import "./NumberFormatInput/index.js";
19
19
  import { formatNumber } from "./NumberFormatInput/libs/formatNumber.js";
20
20
  import { NumberFormatInput, NumberFormatInputOwnProps, NumberFormatInputProps } from "./NumberFormatInput/NumberFormatInput.js";
21
- import { MaskFormatOptions, NumberFormatOptions, NumberGroupStyle, NumericFormatOptions } from "./NumberFormatInput/types.js";
21
+ import { MaskFormatOptions, NumberFormatOptions, NumericFormatOptions, NumericRangeOptions } from "./NumberFormatInput/types.js";
22
22
  import "./Checkbox/index.js";
23
23
  import { Checkbox, CheckboxOwnProps, CheckboxProps, CheckboxShape } from "./Checkbox/Checkbox.js";
24
24
  import "./CheckboxGroup/index.js";
@@ -121,4 +121,4 @@ import { TooltipTrigger, TooltipTriggerOwnProps, TooltipTriggerProps } from "./T
121
121
  import { TooltipPlacement } from "./Tooltip/types.js";
122
122
  import { TooltipContent, TooltipContentOwnProps, TooltipContentProps } from "./Tooltip/components/TooltipContent.js";
123
123
  import { Color, ColorFamilyName, ColorFamilyRegistry, FillVariant, Role, RoleRegistry, Size } from "./types.js";
124
- export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type CheckboxShape, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, type MaskFormatOptions, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, NumberFormatInput, type NumberFormatInputOwnProps, type NumberFormatInputProps, type NumberFormatOptions, type NumberGroupStyle, type NumericFormatOptions, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, VisuallyHidden, type VisuallyHiddenProps, cn, formatNumber };
124
+ export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type CheckboxShape, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, type MaskFormatOptions, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, NumberFormatInput, type NumberFormatInputOwnProps, type NumberFormatInputProps, type NumberFormatOptions, type NumericFormatOptions, type NumericRangeOptions, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, VisuallyHidden, type VisuallyHiddenProps, cn, formatNumber };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tide-design/components",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Tide 디자인 시스템의 React Component",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -37,8 +37,8 @@
37
37
  "@maskito/core": "5.6.1",
38
38
  "@maskito/kit": "5.6.1",
39
39
  "@maskito/react": "5.6.1",
40
- "@tide-design/foundation": "0.23.0",
41
- "@tide-design/icons": "0.23.0",
40
+ "@tide-design/foundation": "0.25.0",
41
+ "@tide-design/icons": "0.25.0",
42
42
  "clsx": "^2.1.1",
43
43
  "react-aria": "^3.53.1",
44
44
  "react-number-format": "^5.4.5",