@reitwagen/design-components 0.6.2 → 0.6.3

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.
@@ -2,6 +2,11 @@ import { ComponentPropsWithRef } from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  import { inputVariants } from "./TextInput.styles";
4
4
  export type TextInputProps = ComponentPropsWithRef<"input"> & VariantProps<typeof inputVariants> & {
5
+ /**
6
+ * 입력값의 단위 (예: "km", "원", "%")
7
+ * 입력 필드 오른쪽에 표시됩니다.
8
+ */
9
+ unit?: string;
5
10
  /**
6
11
  * 클리어 버튼이 표시되는 조건
7
12
  * - 'never': 표시 안 함
@@ -10,10 +15,9 @@ export type TextInputProps = ComponentPropsWithRef<"input"> & VariantProps<typeo
10
15
  */
11
16
  clearButtonMode?: "always" | "while-editing" | "never";
12
17
  /**
13
- * 입력값의 단위 (예: "km", "원", "%")
14
- * 입력 필드 오른쪽에 표시됩니다.
18
+ * 클리어 버튼 클릭 호출되는 콜백 함수
15
19
  */
16
- unit?: string;
20
+ onClear?: () => void;
17
21
  };
18
22
  /**
19
23
  * `TextInput`: 텍스트 입력을 위한 기본 컴포넌트입니다. FormControl과 함께 사용하면 label, validation 등의 기능을 자동으로 제공받습니다.
@@ -41,7 +45,7 @@ export type TextInputProps = ComponentPropsWithRef<"input"> & VariantProps<typeo
41
45
  * />
42
46
  * ```
43
47
  */
44
- export declare function TextInput({ variant, disabled, className, clearButtonMode, unit, value: controlledValue, onChange, ...props }: TextInputProps): import("react/jsx-runtime").JSX.Element;
48
+ export declare function TextInput({ variant, disabled, className, clearButtonMode, unit, value: controlledValue, onChange, onClear, ...props }: TextInputProps): import("react/jsx-runtime").JSX.Element;
45
49
  export declare namespace TextInput {
46
50
  var displayName: string;
47
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAE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,eAAiC,EACjC,IAAI,EACJ,KAAK,EAAE,eAAe,EACtB,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,2CA+GhB;yBAzHe,SAAS"}
@@ -37,7 +37,7 @@ const SPACING = {
37
37
  * />
38
38
  * ```
39
39
  */
40
- function TextInput({ variant, disabled, className, clearButtonMode = "while-editing", unit, value: controlledValue, onChange, ...props }) {
40
+ function TextInput({ variant, disabled, className, clearButtonMode = "while-editing", unit, value: controlledValue, onChange, onClear, ...props }) {
41
41
  const [internalValue, setInternalValue] = (0, react_1.useState)("");
42
42
  const [isFocused, setIsFocused] = (0, react_1.useState)(false);
43
43
  const [rightContentWidth, setRightContentWidth] = (0, react_1.useState)(0);
@@ -72,6 +72,7 @@ function TextInput({ variant, disabled, className, clearButtonMode = "while-edit
72
72
  setInternalValue("");
73
73
  }
74
74
  onChange?.(syntheticEvent);
75
+ onClear?.();
75
76
  };
76
77
  (0, react_1.useEffect)(() => {
77
78
  let totalWidth = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reitwagen/design-components",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ],
@@ -50,8 +50,8 @@
50
50
  "ts-node": "^10.9.2",
51
51
  "typescript": "5.9.2",
52
52
  "@reitwagen/eslint-config": "0.0.0",
53
- "@reitwagen/tailwind-config": "0.0.0",
54
- "@reitwagen/typescript-config": "0.0.0"
53
+ "@reitwagen/typescript-config": "0.0.0",
54
+ "@reitwagen/tailwind-config": "0.0.0"
55
55
  },
56
56
  "dependencies": {
57
57
  "axios": "^1.13.2",