@reitwagen/design-components 0.6.0 → 0.6.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.
Files changed (28) hide show
  1. package/dist/components/FormControl/FormControl.d.ts.map +1 -1
  2. package/dist/components/FormControl/FormControl.js +2 -2
  3. package/dist/components/FormControl/FormControl.stories.js +9 -9
  4. package/dist/components/TextInput/TextInput.d.ts +36 -0
  5. package/dist/components/TextInput/TextInput.d.ts.map +1 -0
  6. package/dist/components/TextInput/TextInput.js +53 -0
  7. package/dist/components/{Input/Input.stories.d.ts → TextInput/TextInput.stories.d.ts} +10 -3
  8. package/dist/components/TextInput/TextInput.stories.d.ts.map +1 -0
  9. package/dist/components/{Input/Input.stories.js → TextInput/TextInput.stories.js} +39 -8
  10. package/dist/components/{Input/Input.styles.d.ts → TextInput/TextInput.styles.d.ts} +1 -1
  11. package/dist/components/TextInput/TextInput.styles.d.ts.map +1 -0
  12. package/dist/components/{Input/Input.styles.js → TextInput/TextInput.styles.js} +1 -1
  13. package/dist/components/TextInput/index.d.ts +2 -0
  14. package/dist/components/TextInput/index.d.ts.map +1 -0
  15. package/dist/components/TextInput/index.js +5 -0
  16. package/dist/index.css +23 -3
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/package.json +3 -3
  21. package/dist/components/Input/Input.d.ts +0 -28
  22. package/dist/components/Input/Input.d.ts.map +0 -1
  23. package/dist/components/Input/Input.js +0 -30
  24. package/dist/components/Input/Input.stories.d.ts.map +0 -1
  25. package/dist/components/Input/Input.styles.d.ts.map +0 -1
  26. package/dist/components/Input/index.d.ts +0 -2
  27. package/dist/components/Input/index.d.ts.map +0 -1
  28. package/dist/components/Input/index.js +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EAQtB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,KAAK,uBAAuB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAIF,eAAO,MAAM,cAAc,+BAS1B,CAAC;AAEF,QAAA,MAAM,mBAAmB,oFAAwC,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAC7D,aAAa,GACb,YAAY,CAAC,OAAO,mBAAmB,CAAC,GAAG;IACzC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,iBAAS,eAAe,CAAC,EACvB,EAAE,EAAE,MAAM,EACV,QAAgB,EAChB,QAAgB,EAChB,KAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAyDtB;kBAjEQ,eAAe;;;AAqExB,eAAO,MAAM,WAAW;;;CAGtB,CAAC"}
1
+ {"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EAQtB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,KAAK,uBAAuB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAIF,eAAO,MAAM,cAAc,+BAS1B,CAAC;AAEF,QAAA,MAAM,mBAAmB,oFAAwC,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAC7D,aAAa,GACb,YAAY,CAAC,OAAO,mBAAmB,CAAC,GAAG;IACzC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,iBAAS,eAAe,CAAC,EACvB,EAAE,EAAE,MAAM,EACV,QAAgB,EAChB,QAAgB,EAChB,KAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAyDtB;kBAjEQ,eAAe;;;AAqExB,eAAO,MAAM,WAAW;;;CAGtB,CAAC"}
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const class_variance_authority_1 = require("class-variance-authority");
8
8
  const style_1 = require("../../utils/style");
9
- const Input_1 = require("../Input");
9
+ const TextInput_1 = require("../TextInput/TextInput");
10
10
  const FormControlLabel_1 = require("./FormControlLabel");
11
11
  const FormControlValidation_1 = require("./FormControlValidation");
12
12
  const FormControlContext = (0, react_1.createContext)(null);
@@ -48,7 +48,7 @@ function FormControlBase({ id: idProp, required = false, disabled = false, error
48
48
  case FormControlLabel_1.FormControlLabel:
49
49
  labelSlot = child;
50
50
  break;
51
- case Input_1.Input: {
51
+ case TextInput_1.TextInput: {
52
52
  const inputChild = child;
53
53
  inputSlot = (0, react_1.cloneElement)(inputChild, {
54
54
  id,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MultipleInputTypes = exports.VisuallyHiddenLabel = exports.RequiredWithError = exports.WithError = exports.Disabled = exports.Required = exports.Default = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const FormControl_1 = require("./FormControl");
6
- const Input_1 = require("../Input");
6
+ const TextInput_1 = require("../TextInput");
7
7
  const meta = {
8
8
  title: "Components/FormControl",
9
9
  component: FormControl_1.FormControl,
@@ -12,7 +12,7 @@ const meta = {
12
12
  docs: {
13
13
  description: {
14
14
  component: `
15
- Input 컴포넌트에 Label, Validation 등을 제공하는 래퍼 컴포넌트입니다.
15
+ 컴포넌트에 Label, Validation 등을 제공하는 래퍼 컴포넌트입니다.
16
16
  `,
17
17
  },
18
18
  },
@@ -47,29 +47,29 @@ Input 컴포넌트에 Label, Validation 등을 제공하는 래퍼 컴포넌트
47
47
  };
48
48
  exports.default = meta;
49
49
  exports.Default = {
50
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "email", placeholder: "example@baree.net" })] }) })),
50
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "email", placeholder: "example@baree.net" })] }) })),
51
51
  };
52
52
  exports.Required = {
53
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "email", placeholder: "example@baree.net" })] }) })),
53
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "email", placeholder: "example@baree.net" })] }) })),
54
54
  };
55
55
  exports.Disabled = {
56
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { disabled: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "email", placeholder: "example@baree.net" })] }) })),
56
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { disabled: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "email", placeholder: "example@baree.net" })] }) })),
57
57
  };
58
58
  exports.WithError = {
59
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { error: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "email", placeholder: "example@baree.net" }), (0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Validation, { children: "\uC62C\uBC14\uB978 \uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4" })] }) })),
59
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { error: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "email", placeholder: "example@baree.net" }), (0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Validation, { children: "\uC62C\uBC14\uB978 \uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4" })] }) })),
60
60
  };
61
61
  /**
62
62
  * 필수 입력이면서 에러 상태인 필드입니다.
63
63
  */
64
64
  exports.RequiredWithError = {
65
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, error: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uBE44\uBC00\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "password", placeholder: "8\uC790 \uC774\uC0C1 \uC785\uB825" }), (0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Validation, { children: "\uBE44\uBC00\uBC88\uD638\uB294 \uCD5C\uC18C 8\uC790 \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" })] }) })),
65
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, error: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uBE44\uBC00\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "password", placeholder: "8\uC790 \uC774\uC0C1 \uC785\uB825" }), (0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Validation, { children: "\uBE44\uBC00\uBC88\uD638\uB294 \uCD5C\uC18C 8\uC790 \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" })] }) })),
66
66
  };
67
67
  /**
68
68
  * 시각적으로 숨겨진 라벨입니다. 접근성은 유지됩니다.
69
69
  */
70
70
  exports.VisuallyHiddenLabel = {
71
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { visuallyHidden: true, children: "\uAC80\uC0C9" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "search", placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694" })] }) })),
71
+ render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:w-80", children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { visuallyHidden: true, children: "\uAC80\uC0C9" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "search", placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694" })] }) })),
72
72
  };
73
73
  exports.MultipleInputTypes = {
74
- render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:space-y-6 ui:w-80", children: [(0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "email", placeholder: "example@baree.net" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uBE44\uBC00\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "password", placeholder: "8\uC790 \uC774\uC0C1 \uC785\uB825" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC804\uD654\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "tel", placeholder: "010-1234-5678" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uB0A0\uC9DC" }), (0, jsx_runtime_1.jsx)(Input_1.Input, { type: "date" })] })] })),
74
+ render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:space-y-6 ui:w-80", children: [(0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC774\uBA54\uC77C" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "email", placeholder: "example@baree.net" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { required: true, ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uBE44\uBC00\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "password", placeholder: "8\uC790 \uC774\uC0C1 \uC785\uB825" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uC804\uD654\uBC88\uD638" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "tel", placeholder: "010-1234-5678" })] }), (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...props, children: [(0, jsx_runtime_1.jsx)(FormControl_1.FormControl.Label, { children: "\uB0A0\uC9DC" }), (0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { type: "date" })] })] })),
75
75
  };
@@ -0,0 +1,36 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { VariantProps } from "class-variance-authority";
3
+ import { inputVariants } from "./TextInput.styles";
4
+ export type TextInputProps = ComponentPropsWithRef<"input"> & VariantProps<typeof inputVariants> & {
5
+ /**
6
+ * 클리어 버튼이 표시되는 조건
7
+ * - 'never': 표시 안 함 (기본값)
8
+ * - 'while-editing': 입력값이 있을 때만 표시
9
+ * - 'always': 항상 표시
10
+ */
11
+ clearButtonMode?: "always" | "while-editing" | "never";
12
+ };
13
+ /**
14
+ * `TextInput`: 텍스트 입력을 위한 기본 컴포넌트입니다. FormControl과 함께 사용하면 label, validation 등의 기능을 자동으로 제공받습니다.
15
+ * @see [RDS Storybook: TextInput](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-textinput--docs)
16
+ * @see [RDS Storybook: FormControl](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-formcontrol--docs)
17
+ * @example
18
+ * ```tsx
19
+ * // 독립적으로 사용
20
+ * <TextInput
21
+ * placeholder="이메일을 입력하세요"
22
+ * onChange={(e) => setEmail(e.target.value)}
23
+ * />
24
+ *
25
+ * // FormControl과 함께 사용
26
+ * <FormControl required>
27
+ * <FormControl.Label>이메일</FormControl.Label>
28
+ * <TextInput type="email" />
29
+ * </FormControl>
30
+ * ```
31
+ */
32
+ export declare function TextInput({ variant, disabled, className, clearButtonMode, value: controlledValue, onChange, ...props }: TextInputProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare namespace TextInput {
34
+ var displayName: string;
35
+ }
36
+ //# sourceMappingURL=TextInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,qBAAqB,EAAY,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC,GACzD,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC;CACxD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,QAAQ,EACR,SAAS,EACT,eAAyB,EACzB,KAAK,EAAE,eAAe,EACtB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,2CAqDhB;yBA7De,SAAS"}
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TextInput = TextInput;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const style_1 = require("../../utils/style");
8
+ const TextInput_styles_1 = require("./TextInput.styles");
9
+ const Icons_1 = require("../Icons");
10
+ /**
11
+ * `TextInput`: 텍스트 입력을 위한 기본 컴포넌트입니다. FormControl과 함께 사용하면 label, validation 등의 기능을 자동으로 제공받습니다.
12
+ * @see [RDS Storybook: TextInput](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-textinput--docs)
13
+ * @see [RDS Storybook: FormControl](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-formcontrol--docs)
14
+ * @example
15
+ * ```tsx
16
+ * // 독립적으로 사용
17
+ * <TextInput
18
+ * placeholder="이메일을 입력하세요"
19
+ * onChange={(e) => setEmail(e.target.value)}
20
+ * />
21
+ *
22
+ * // FormControl과 함께 사용
23
+ * <FormControl required>
24
+ * <FormControl.Label>이메일</FormControl.Label>
25
+ * <TextInput type="email" />
26
+ * </FormControl>
27
+ * ```
28
+ */
29
+ function TextInput({ variant, disabled, className, clearButtonMode = "never", value: controlledValue, onChange, ...props }) {
30
+ const [internalValue, setInternalValue] = (0, react_1.useState)("");
31
+ const isControlled = controlledValue !== undefined;
32
+ const value = isControlled ? controlledValue : internalValue;
33
+ const isShowClearButton = clearButtonMode === "always" ||
34
+ (clearButtonMode === "while-editing" && String(value).length > 0);
35
+ const handleChange = (e) => {
36
+ if (!isControlled) {
37
+ setInternalValue(e.target.value);
38
+ }
39
+ onChange?.(e);
40
+ };
41
+ const handleClear = () => {
42
+ const syntheticEvent = {
43
+ target: { value: "" },
44
+ currentTarget: { value: "" },
45
+ };
46
+ if (!isControlled) {
47
+ setInternalValue("");
48
+ }
49
+ onChange?.(syntheticEvent);
50
+ };
51
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "ui:relative ui:flex-1 ui:flex ui:items-center", children: [(0, jsx_runtime_1.jsx)("input", { disabled: disabled, value: value, onChange: handleChange, className: (0, style_1.cn)((0, TextInput_styles_1.inputVariants)({ variant, disabled, className }), isShowClearButton && "ui:pr-[52px]"), ...props }), isShowClearButton && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleClear, disabled: disabled, className: "ui:absolute ui:right-4 ui:top-1/2 ui:-translate-y-1/2 ui:cursor-pointer disabled:ui:cursor-not-allowed disabled:ui:opacity-50", "aria-label": "Clear input", children: (0, jsx_runtime_1.jsx)(Icons_1.IconCloseCircle, { className: "ui:text-gray-400" }) }))] }));
52
+ }
53
+ TextInput.displayName = "TextInput";
@@ -1,8 +1,8 @@
1
1
  import type { StoryObj } from "@storybook/react";
2
- import { Input } from "./Input";
2
+ import { TextInput } from "./TextInput";
3
3
  declare const meta: {
4
4
  title: string;
5
- component: typeof Input;
5
+ component: typeof TextInput;
6
6
  tags: string[];
7
7
  parameters: {
8
8
  layout: string;
@@ -25,10 +25,17 @@ declare const meta: {
25
25
  };
26
26
  options: string[];
27
27
  };
28
+ clearButtonMode: {
29
+ control: {
30
+ type: "radio";
31
+ };
32
+ options: string[];
33
+ };
28
34
  };
29
35
  };
30
36
  export default meta;
31
37
  type Story = StoryObj<typeof meta>;
32
38
  export declare const Default: Story;
33
39
  export declare const Error: Story;
34
- //# sourceMappingURL=Input.stories.d.ts.map
40
+ export declare const DefaultWithClearButton: Story;
41
+ //# sourceMappingURL=TextInput.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInput.stories.d.ts","sourceRoot":"","sources":["../../../src/components/TextInput/TextInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCwB,CAAC;AAEnC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KA2BrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KA2BnB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KA+BpC,CAAC"}
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Error = exports.Default = void 0;
3
+ exports.DefaultWithClearButton = exports.Error = exports.Default = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const Input_1 = require("./Input");
5
+ const TextInput_1 = require("./TextInput");
6
6
  const meta = {
7
- title: "Components/Input",
8
- component: Input_1.Input,
7
+ title: "Components/TextInput",
8
+ component: TextInput_1.TextInput,
9
9
  tags: ["autodocs"],
10
10
  parameters: {
11
11
  layout: "centered",
12
12
  docs: {
13
13
  description: {
14
14
  component: `
15
- Input은 한 줄의 텍스트 값을 설정하는데 사용됩니다.
15
+ TextInput은 한 줄의 텍스트 값을 설정하는데 사용됩니다.
16
16
 
17
- ## <b>Input guide</b>
17
+ ## <b>TextInput guide</b>
18
18
 
19
19
  입력 필드는 텍스트의 길이를 고려하여 적절한 크기로 제공하며, 플레이스홀더를 레이블이나 도움말의 대체 수단으로 사용하지 않도록 합니다.
20
20
  `,
@@ -30,6 +30,10 @@ Input은 한 줄의 텍스트 값을 설정하는데 사용됩니다.
30
30
  control: { type: "boolean" },
31
31
  options: ["true", "false"],
32
32
  },
33
+ clearButtonMode: {
34
+ control: { type: "radio" },
35
+ options: ["never", "always", "while-editing"],
36
+ },
33
37
  },
34
38
  };
35
39
  exports.default = meta;
@@ -44,7 +48,7 @@ exports.Default = {
44
48
  },
45
49
  },
46
50
  },
47
- render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.Input, { ...props }), props.children] })),
51
+ render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { ...props }), props.children] })),
48
52
  args: {
49
53
  placeholder: "placeholder",
50
54
  variant: "default",
@@ -67,7 +71,7 @@ exports.Error = {
67
71
  },
68
72
  },
69
73
  },
70
- render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.Input, { ...props, variant: "error" }), props.children] })),
74
+ render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { ...props, variant: "error" }), props.children] })),
71
75
  args: {
72
76
  placeholder: "placeholder",
73
77
  variant: "error",
@@ -79,3 +83,30 @@ exports.Error = {
79
83
  },
80
84
  },
81
85
  };
86
+ exports.DefaultWithClearButton = {
87
+ parameters: {
88
+ layout: "centered",
89
+ docs: {
90
+ description: {
91
+ story: `
92
+
93
+ `,
94
+ },
95
+ },
96
+ },
97
+ render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(TextInput_1.TextInput, { clearButtonMode: "while-editing", ...props }), props.children] })),
98
+ args: {
99
+ clearButtonMode: "while-editing",
100
+ placeholder: "placeholder",
101
+ },
102
+ argTypes: {
103
+ disabled: {
104
+ control: { type: "boolean" },
105
+ options: ["true", "false"],
106
+ },
107
+ clearButtonMode: {
108
+ control: { type: "radio" },
109
+ options: ["never", "always", "while-editing"],
110
+ },
111
+ },
112
+ };
@@ -2,4 +2,4 @@ export declare const inputVariants: (props?: ({
2
2
  variant?: "default" | "error" | null | undefined;
3
3
  disabled?: boolean | null | undefined;
4
4
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
- //# sourceMappingURL=Input.styles.d.ts.map
5
+ //# sourceMappingURL=TextInput.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/TextInput/TextInput.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;8EAmBzB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inputVariants = void 0;
4
4
  const class_variance_authority_1 = require("class-variance-authority");
5
- exports.inputVariants = (0, class_variance_authority_1.cva)("ui:h-[50px] ui:bg-white ui:px-4 ui:rounded-[16px] ui:w-full ui:border ui:text-body4 ui:transition-colors ui:outline-none", {
5
+ exports.inputVariants = (0, class_variance_authority_1.cva)("ui:h-[50px] ui:bg-white ui:px-4 ui:rounded-2xl ui:w-full ui:border ui:text-body4 ui:transition-colors ui:outline-none", {
6
6
  variants: {
7
7
  variant: {
8
8
  default: "ui:border-gray-100 ui:text-gray-800 ui:placeholder:text-body4 ui:placeholder:text-gray-500 ui:focus:bg-gray-50 ui:focus:border-gray-200",
@@ -0,0 +1,2 @@
1
+ export { TextInput } from "./TextInput";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextInput = void 0;
4
+ var TextInput_1 = require("./TextInput");
5
+ Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return TextInput_1.TextInput; } });
package/dist/index.css CHANGED
@@ -29,6 +29,7 @@
29
29
  --ui-color-gray-900: #04041b;
30
30
  --ui-color-white: #ffffff;
31
31
  --ui-spacing: 0.25rem;
32
+ --ui-radius-2xl: 1rem;
32
33
  --ui-default-transition-duration: 150ms;
33
34
  --ui-default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
34
35
  --ui-default-font-family: var(--ui-font-sans);
@@ -282,6 +283,18 @@
282
283
  white-space: nowrap;
283
284
  border-width: 0;
284
285
  }
286
+ .ui\:absolute {
287
+ position: absolute;
288
+ }
289
+ .ui\:relative {
290
+ position: relative;
291
+ }
292
+ .ui\:top-1\/2 {
293
+ top: calc(1/2 * 100%);
294
+ }
295
+ .ui\:right-4 {
296
+ right: calc(var(--ui-spacing) * 4);
297
+ }
285
298
  .ui\:my-3 {
286
299
  margin-block: calc(var(--ui-spacing) * 3);
287
300
  }
@@ -374,6 +387,10 @@
374
387
  --tw-translate-x: calc(var(--ui-spacing) * 6);
375
388
  translate: var(--tw-translate-x) var(--tw-translate-y);
376
389
  }
390
+ .ui\:-translate-y-1\/2 {
391
+ --tw-translate-y: calc(calc(1/2 * 100%) * -1);
392
+ translate: var(--tw-translate-x) var(--tw-translate-y);
393
+ }
377
394
  .ui\:cursor-default {
378
395
  cursor: default;
379
396
  }
@@ -423,6 +440,9 @@
423
440
  margin-block-end: calc(calc(var(--ui-spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
424
441
  }
425
442
  }
443
+ .ui\:rounded-2xl {
444
+ border-radius: var(--ui-radius-2xl);
445
+ }
426
446
  .ui\:rounded-\[8px\] {
427
447
  border-radius: 8px;
428
448
  }
@@ -435,9 +455,6 @@
435
455
  .ui\:rounded-\[14px\] {
436
456
  border-radius: 14px;
437
457
  }
438
- .ui\:rounded-\[16px\] {
439
- border-radius: 16px;
440
- }
441
458
  .ui\:rounded-full {
442
459
  border-radius: calc(infinity * 1px);
443
460
  }
@@ -542,6 +559,9 @@
542
559
  .ui\:py-\[14px\] {
543
560
  padding-block: 14px;
544
561
  }
562
+ .ui\:pr-\[52px\] {
563
+ padding-right: 52px;
564
+ }
545
565
  .ui\:text-body1 {
546
566
  font-size: var(--ui-text-body1);
547
567
  line-height: var(--tw-leading, var(--ui-text-body1--line-height));
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from "./components/Toggle";
4
4
  export * from "./components/Checkbox";
5
5
  export * from "./components/Radio";
6
6
  export * from "./components/RadioGroup";
7
- export * from "./components/Input";
7
+ export * from "./components/TextInput";
8
8
  export * from "./components/FormControl";
9
9
  export * from "./components/Icons";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ __exportStar(require("./components/Toggle"), exports);
21
21
  __exportStar(require("./components/Checkbox"), exports);
22
22
  __exportStar(require("./components/Radio"), exports);
23
23
  __exportStar(require("./components/RadioGroup"), exports);
24
- __exportStar(require("./components/Input"), exports);
24
+ __exportStar(require("./components/TextInput"), exports);
25
25
  __exportStar(require("./components/FormControl"), exports);
26
26
  /* --------------------------------- ICONS ---------------------------------- */
27
27
  __exportStar(require("./components/Icons"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reitwagen/design-components",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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",
@@ -1,28 +0,0 @@
1
- import { ComponentPropsWithRef } from "react";
2
- import { VariantProps } from "class-variance-authority";
3
- import { inputVariants } from "./Input.styles";
4
- export type InputProps = ComponentPropsWithRef<"input"> & VariantProps<typeof inputVariants>;
5
- /**
6
- * `Input`: 텍스트 입력을 위한 기본 컴포넌트입니다. FormControl과 함께 사용하면 label, validation 등의 기능을 자동으로 제공받습니다.
7
- * @see [RDS Storybook: Input](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-input--docs)
8
- * @see [RDS Storybook: FormControl](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-formcontrol--docs)
9
- * @example
10
- * ```tsx
11
- * // 독립적으로 사용
12
- * <Input
13
- * placeholder="이메일을 입력하세요"
14
- * onChange={(e) => setEmail(e.target.value)}
15
- * />
16
- *
17
- * // FormControl과 함께 사용
18
- * <FormControl required>
19
- * <FormControl.Label>이메일</FormControl.Label>
20
- * <Input type="email" />
21
- * </FormControl>
22
- * ```
23
- */
24
- export declare function Input({ variant, disabled, className, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
25
- export declare namespace Input {
26
- var displayName: string;
27
- }
28
- //# sourceMappingURL=Input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,GACrD,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAQ3E;yBARe,KAAK"}
@@ -1,30 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Input = Input;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const style_1 = require("../../utils/style");
7
- const Input_styles_1 = require("./Input.styles");
8
- /**
9
- * `Input`: 텍스트 입력을 위한 기본 컴포넌트입니다. FormControl과 함께 사용하면 label, validation 등의 기능을 자동으로 제공받습니다.
10
- * @see [RDS Storybook: Input](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-input--docs)
11
- * @see [RDS Storybook: FormControl](https://main--691ac7d6da1eb0c0acb5f3e2.chromatic.com/?path=/docs/components-formcontrol--docs)
12
- * @example
13
- * ```tsx
14
- * // 독립적으로 사용
15
- * <Input
16
- * placeholder="이메일을 입력하세요"
17
- * onChange={(e) => setEmail(e.target.value)}
18
- * />
19
- *
20
- * // FormControl과 함께 사용
21
- * <FormControl required>
22
- * <FormControl.Label>이메일</FormControl.Label>
23
- * <Input type="email" />
24
- * </FormControl>
25
- * ```
26
- */
27
- function Input({ variant, disabled, className, ...props }) {
28
- return ((0, jsx_runtime_1.jsx)("input", { disabled: disabled, className: (0, style_1.cn)((0, Input_styles_1.inputVariants)({ variant, disabled, className })), ...props }));
29
- }
30
- Input.displayName = "Input";
@@ -1 +0,0 @@
1
- {"version":3,"file":"Input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BoB,CAAC;AAE/B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KA2BrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KA2BnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Input.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;8EAmBzB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { Input } from "./Input";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Input = void 0;
4
- var Input_1 = require("./Input");
5
- Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });