react-validate-component 0.0.2-0 → 0.1.1-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.
package/README.md CHANGED
@@ -1,160 +1,110 @@
1
- # TSDX React User Guide
1
+ # react-validate-component
2
2
 
3
- Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
3
+ `react-validate-component`는 리액트 애플리케이션에서 입력 유효성 검사를 간편하게 처리할 있도록 도와주는 라이브러리입니다. 현재 `VText` 컴포넌트가 구현되어 있으며, 컴포넌트를 사용하여 간단하게 텍스트 입력의 유효성을 검사할 수 있습니다.
4
4
 
5
- > This TSDX setup is meant for developing React component libraries (not apps!) that can be published to NPM. If you’re looking to build a React-based app, you should use `create-react-app`, `razzle`, `nextjs`, `gatsby`, or `react-static`.
5
+ ## 설치
6
6
 
7
- > If you’re new to TypeScript and React, checkout [this handy cheatsheet](https://github.com/sw-yx/react-typescript-cheatsheet/)
7
+ `react-validate-component` 라이브러리는 npm 또는 yarn을 통해 설치할 있습니다.
8
8
 
9
- ## Commands
10
-
11
- TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
12
-
13
- The recommended workflow is to run TSDX in one terminal:
14
-
15
- ```bash
16
- npm start # or yarn start
17
- ```
18
-
19
- This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
20
-
21
- Then run the example inside another:
9
+ ### npm
22
10
 
23
11
  ```bash
24
- cd example
25
- npm i # or yarn to install dependencies
26
- npm start # or yarn start
27
- ```
28
-
29
- The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
30
-
31
- To do a one-off build, use `npm run build` or `yarn build`.
32
-
33
- To run tests, use `npm test` or `yarn test`.
34
-
35
- ## Configuration
36
-
37
- Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
38
-
39
- ### Jest
40
-
41
- Jest tests are set up to run with `npm test` or `yarn test`.
42
-
43
- ### Bundle analysis
44
-
45
- Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.
46
-
47
- #### Setup Files
48
-
49
- This is the folder structure we set up for you:
50
-
51
- ```txt
52
- /example
53
- index.html
54
- index.tsx # test your component here in a demo app
55
- package.json
56
- tsconfig.json
57
- /src
58
- index.tsx # EDIT THIS
59
- /test
60
- blah.test.tsx # EDIT THIS
61
- .gitignore
62
- package.json
63
- README.md # EDIT THIS
64
- tsconfig.json
65
- ```
66
-
67
- #### React Testing Library
68
-
69
- We do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.
70
-
71
- ### Rollup
72
-
73
- TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
74
-
75
- ### TypeScript
76
-
77
- `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
78
-
79
- ## Continuous Integration
80
-
81
- ### GitHub Actions
82
-
83
- Two actions are added by default:
84
-
85
- - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
86
- - `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
87
-
88
- ## Optimizations
89
-
90
- Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
91
-
92
- ```js
93
- // ./types/index.d.ts
94
- declare var __DEV__: boolean;
95
-
96
- // inside your code...
97
- if (__DEV__) {
98
- console.log('foo');
99
- }
12
+ npm install react-validate-component
100
13
  ```
101
14
 
102
- You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
103
-
104
- ## Module Formats
105
-
106
- CJS, ESModules, and UMD module formats are supported.
107
-
108
- The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
109
-
110
- ## Deploying the Example Playground
111
-
112
- The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
15
+ ### yarn
113
16
 
114
17
  ```bash
115
- cd example # if not already in the example folder
116
- npm run build # builds to dist
117
- netlify deploy # deploy the dist folder
18
+ yarn add react-validate-component
118
19
  ```
119
20
 
120
- Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:
121
-
122
- ```bash
123
- netlify init
124
- # build command: yarn build && cd example && yarn && yarn build
125
- # directory to deploy: example/dist
126
- # pick yes for netlify.toml
21
+ ## 사용법
22
+
23
+ 현재 라이브러리에는 `VText` 컴포넌트가 포함되어 있습니다. 이 컴포넌트를 사용하여 텍스트 입력 필드의 유효성 검사를 쉽게 구현할 수 있습니다.
24
+
25
+ ### VText 컴포넌트
26
+
27
+ `VText` 컴포넌트는 기본적인 텍스트 입력 필드와 유효성 검사 기능을 제공합니다.
28
+
29
+ #### 기본 사용 예제
30
+
31
+ ```jsx
32
+ import React from 'react';
33
+ import { VText } from 'react-validate-component';
34
+
35
+ const App = () => {
36
+ const [message, setMessage] = React.useState('');
37
+ const [vState, setVState] = React.useState(false);
38
+ const [vMessage, setVMessage] = React.useState('');
39
+
40
+ React.useEffect(() => {
41
+ if (/[\d]/gim.exec(message)) {
42
+ setVState(true);
43
+ setVMessage('숫자는 입력이 안됩니다.');
44
+ } else {
45
+ setVState(false);
46
+ setVMessage('');
47
+ }
48
+ }, [message]);
49
+
50
+ return (
51
+ <section className={styles.layout}>
52
+ <h1>React-Validate-Component</h1>
53
+ <div>
54
+ <h2>VText</h2>
55
+ <VText
56
+ vState={vState}
57
+ vClassName={''}
58
+ vShowMessage={true}
59
+ vMessage={vMessage}
60
+ vIsInnerMessage={true}
61
+ vLocateMessage={'top-left'}
62
+ vMessageClass={styles.validation_message}
63
+ vIsAnimate={false}
64
+ props={{
65
+ onChange: (e: { target: { value: string } }) => {
66
+ setMessage(e.target.value);
67
+ },
68
+ placeholder: 'this is react-validate-component test.',
69
+ className: styles.input_text,
70
+ defaultValue: 'test',
71
+ }}
72
+ />
73
+ </div>
74
+ </section>
75
+ );
76
+ };
77
+
78
+ export default App;
127
79
  ```
128
80
 
129
- ## Named Exports
130
-
131
- Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
132
-
133
- ## Including Styles
81
+ #### Props
134
82
 
135
- There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
83
+ - `vState` (boolean): 유효성 상태 값입니다.
84
+ - `vClassName` (string): 유효성 입힐 class 명입니다.
85
+ - `vShowMessage` (boolean): 유효성 메시지 출력 여부값입니다.
86
+ - `vMessage` (string): 유효성 검사 실패 시 표시할 에러 메시지입니다.
87
+ - `vIsInnerMessage` (boolean): 유효성 메시지를 element 안에 넣을지 (absolute 형태) 여부입니다.
88
+ - `vLocateMessage` (`top-left`, `top`, `top-right`, `center-left`, `center`, `center-right`, `bottom-left`, `bottom`, `bottom-right`): 유효성 메시지를 element 어디에 붙일지 위치값입니다.
89
+ - `vMessageClass` (string): 유효성 메시지에 입힐 class 명입니다.
90
+ - `vIsAnimate` (boolean): 유효성 메시지 출력 시 애니메이션 적용할지 여부입니다. (개발중, 삭제될 수 있음)
91
+ - `props` (object): 기타 옵션입니다. 기본 input 태그에 attribute로 넣을 값들을 입력하시면 됩니다.
136
92
 
137
- For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
93
+ ### 유효성 검사 규칙
138
94
 
139
- ## Publishing to NPM
95
+ - 지금은 사용자가 정규식 혹은 함수를 이용해 작성한 유효성검사 로직을 토대로 element에 출력하고 있습니다.
96
+ - 상단에 예시를 확인하여 주시기 바랍니다.
140
97
 
141
- We recommend using [np](https://github.com/sindresorhus/np).
98
+ ## 개발 중인 기능
142
99
 
143
- ## Usage with Lerna
100
+ - 현재 `VText` 컴포넌트만 구현되어 있으며, 다른 입력 유형에 대한 컴포넌트도 개발할 예정입니다.
101
+ - 추가적인 유효성 검사 규칙 및 에러 메시지 처리 기능이 계획되어 있습니다.
102
+ - 현재 문서에 이미지를 추가한 문서 업데이트 예정되어있습니다.
144
103
 
145
- When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.
104
+ ## 기여
146
105
 
147
- The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.
106
+ 기여를 원하시는 분은 언제든지 pull request를 제출하거나 이슈를 제기해 주세요. 코드 기여 피드백을 환영합니다!
148
107
 
149
- Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.
150
-
151
- ```diff
152
- "alias": {
153
- - "react": "../node_modules/react",
154
- - "react-dom": "../node_modules/react-dom"
155
- + "react": "../../../node_modules/react",
156
- + "react-dom": "../../../node_modules/react-dom"
157
- },
158
- ```
108
+ ## 라이센스
159
109
 
160
- An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)
110
+ 라이브러리는 [MIT 라이센스](LICENSE) 하에 배포됩니다.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
2
- import { VINPUT_PARAMS } from './types/vinput';
3
- export declare const VText: ({ maxLength, value, className, }: VINPUT_PARAMS) => React.JSX.Element;
1
+ import React from 'react';
2
+ import { VTEXT_PARAMS } from './types/vinput';
3
+ export declare const VText: ({ vState, vClassName, vShowMessage, vMessage, vIsInnerMessage, vLocateMessage, vMessageClass, vIsAnimate, props, }: VTEXT_PARAMS) => JSX.Element;
4
4
  export declare const VCheckbox: () => React.JSX.Element;
5
5
  export declare const VRadio: () => React.JSX.Element;
6
6
  export declare const VDate: () => React.JSX.Element;
@@ -2,21 +2,73 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var React = _interopDefault(require('react'));
8
+
9
+ function styleInject(css, ref) {
10
+ if ( ref === void 0 ) ref = {};
11
+ var insertAt = ref.insertAt;
12
+
13
+ if (!css || typeof document === 'undefined') { return; }
14
+
15
+ var head = document.head || document.getElementsByTagName('head')[0];
16
+ var style = document.createElement('style');
17
+ style.type = 'text/css';
18
+
19
+ if (insertAt === 'top') {
20
+ if (head.firstChild) {
21
+ head.insertBefore(style, head.firstChild);
22
+ } else {
23
+ head.appendChild(style);
24
+ }
25
+ } else {
26
+ head.appendChild(style);
27
+ }
28
+
29
+ if (style.styleSheet) {
30
+ style.styleSheet.cssText = css;
31
+ } else {
32
+ style.appendChild(document.createTextNode(css));
33
+ }
34
+ }
35
+
36
+ var css_248z = ".index-module_invalid__gHKsE {\r\n border: 2px solid red;\r\n}\r\n\r\n/* 유효성 메시지 locate */\r\n.index-module_vinput__tFGFH {\r\n display: flex;\r\n}\r\n.index-module_vinput-top-left__2g8Bq {\r\n flex-direction: column-reverse;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top__ZTh6H {\r\n flex-direction: column-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top-right__t6K-Q {\r\n flex-direction: column-reverse;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-left__vJn0s {\r\n flex-direction: row-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-right__HDgip {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-left__xxaiT {\r\n flex-direction: column;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom__nCOAf {\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-right__6AjOE {\r\n flex-direction: column;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage__rihga {\r\n position: absolute;\r\n font-size: 12px;\r\n margin: 0;\r\n padding: 2px 5px;\r\n display: flex;\r\n}\r\n.index-module_innerMessage-top-left__HLoYg {\r\n align-items: flex-start;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-top__ouYW6 {\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-top-right__7tMC8 {\r\n align-items: flex-start;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-center-left__4iZyl {\r\n align-items: center;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-center__U2006 {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-center-right__Pg2oU {\r\n align-items: center;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-bottom-left__1QDIv {\r\n align-items: flex-end;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-bottom__gMogT {\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-bottom-right__peBq- {\r\n align-items: flex-end;\r\n justify-content: flex-end;\r\n}\r\n\r\n.index-module_animateMessage__Gxf3M {\r\n animation: index-module_fade-in__GxKz8 1s ease-in-out;\r\n}\r\n\r\n@keyframes index-module_fade-in__GxKz8 {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n}\r\n";
37
+ var styles = {"invalid":"index-module_invalid__gHKsE","vinput":"index-module_vinput__tFGFH","vinput-top-left":"index-module_vinput-top-left__2g8Bq","vinput-top":"index-module_vinput-top__ZTh6H","vinput-top-right":"index-module_vinput-top-right__t6K-Q","vinput-center-left":"index-module_vinput-center-left__vJn0s","vinput-center-right":"index-module_vinput-center-right__HDgip","vinput-bottom-left":"index-module_vinput-bottom-left__xxaiT","vinput-bottom":"index-module_vinput-bottom__nCOAf","vinput-bottom-right":"index-module_vinput-bottom-right__6AjOE","innerMessage":"index-module_innerMessage__rihga","innerMessage-top-left":"index-module_innerMessage-top-left__HLoYg","innerMessage-top":"index-module_innerMessage-top__ouYW6","innerMessage-top-right":"index-module_innerMessage-top-right__7tMC8","innerMessage-center-left":"index-module_innerMessage-center-left__4iZyl","innerMessage-center":"index-module_innerMessage-center__U2006","innerMessage-center-right":"index-module_innerMessage-center-right__Pg2oU","innerMessage-bottom-left":"index-module_innerMessage-bottom-left__1QDIv","innerMessage-bottom":"index-module_innerMessage-bottom__gMogT","innerMessage-bottom-right":"index-module_innerMessage-bottom-right__peBq-","animateMessage":"index-module_animateMessage__Gxf3M","fade-in":"index-module_fade-in__GxKz8"};
38
+ styleInject(css_248z);
6
39
 
7
40
  // Text
8
41
  var VText = function VText(_ref) {
9
- var maxLength = _ref.maxLength,
10
- value = _ref.value,
11
- className = _ref.className;
12
- return React.createElement("input", {
13
- type: "text",
14
- // {...props}
15
- className: className,
16
- maxLength: maxLength,
17
- value: value,
18
- placeholder: "this is react-validate-component test."
19
- });
42
+ var _props$defaultValue;
43
+ var _ref$vState = _ref.vState,
44
+ vState = _ref$vState === void 0 ? false : _ref$vState,
45
+ _ref$vClassName = _ref.vClassName,
46
+ vClassName = _ref$vClassName === void 0 ? '' : _ref$vClassName,
47
+ _ref$vShowMessage = _ref.vShowMessage,
48
+ vShowMessage = _ref$vShowMessage === void 0 ? false : _ref$vShowMessage,
49
+ _ref$vMessage = _ref.vMessage,
50
+ vMessage = _ref$vMessage === void 0 ? '' : _ref$vMessage,
51
+ _ref$vIsInnerMessage = _ref.vIsInnerMessage,
52
+ vIsInnerMessage = _ref$vIsInnerMessage === void 0 ? false : _ref$vIsInnerMessage,
53
+ _ref$vLocateMessage = _ref.vLocateMessage,
54
+ vLocateMessage = _ref$vLocateMessage === void 0 ? 'bottom' : _ref$vLocateMessage,
55
+ _ref$vMessageClass = _ref.vMessageClass,
56
+ vMessageClass = _ref$vMessageClass === void 0 ? '' : _ref$vMessageClass,
57
+ _ref$vIsAnimate = _ref.vIsAnimate,
58
+ vIsAnimate = _ref$vIsAnimate === void 0 ? false : _ref$vIsAnimate,
59
+ _ref$props = _ref.props,
60
+ props = _ref$props === void 0 ? {} : _ref$props;
61
+ var Result = React.createElement("div", {
62
+ className: styles.vinput + " " + styles["vinput-" + vLocateMessage]
63
+ }, React.createElement("input", Object.assign({
64
+ type: "text"
65
+ }, props, {
66
+ defaultValue: (_props$defaultValue = props == null ? void 0 : props.defaultValue) != null ? _props$defaultValue : '',
67
+ className: (props == null ? void 0 : props.className) + " " + (vState ? vClassName || styles.invalid : '')
68
+ })), vState && vShowMessage ? React.createElement("p", {
69
+ className: vMessageClass + " " + (vIsInnerMessage ? (props == null ? void 0 : props.className) + " " + styles.innerMessage + " " + styles["innerMessage-" + vLocateMessage] : '') + " " + (vIsAnimate ? styles.animateMessage : '')
70
+ }, vMessage) : null);
71
+ return Result;
20
72
  };
21
73
  // Checkbox
22
74
  var VCheckbox = function VCheckbox() {
@@ -1 +1 @@
1
- {"version":3,"file":"react-validate-component.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { VINPUT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n maxLength,\n value,\n className,\n}: // props,\nVINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n // {...props}\n className={className}\n maxLength={maxLength}\n value={value}\n placeholder=\"this is react-validate-component test.\"\n />\n );\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["VText","_ref","maxLength","value","className","React","type","placeholder","VCheckbox","VRadio","VDate","VColor","VEmail","VRange","VUrl"],"mappings":";;;;;;AAGA;IACaA,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA;MAChBC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,SAAS,GAAAH,IAAA,CAATG,SAAS;EAGT,OACEC;IACEC,IAAI,EAAC,MAAM;;IAEXF,SAAS,EAAEA,SAAS;IACpBF,SAAS,EAAEA,SAAS;IACpBC,KAAK,EAAEA,KAAK;IACZI,WAAW,EAAC;IACZ;AAEN;AAEA;IACaC,SAAS,GAAG,SAAZA,SAASA;EACpB,OAAOH;IAAOC,IAAI,EAAC;IAAa;AAClC;AAEA;IACaG,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOJ;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaI,KAAK,GAAG,SAARA,KAAKA;EAChB,OAAOL;IAAOC,IAAI,EAAC;IAAS;AAC9B;AAEA;IACaK,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAON;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaM,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOP;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaO,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOR;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaQ,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOT;IAAOC,IAAI,EAAC;IAAQ;AAC7B;;;;;;;;;;;"}
1
+ {"version":3,"file":"react-validate-component.cjs.development.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/index.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\nimport styles from './index.module.css';\nimport { VTEXT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n vState = false,\n vClassName = '',\n vShowMessage = false,\n vMessage = '',\n vIsInnerMessage = false,\n vLocateMessage = 'bottom',\n vMessageClass = '',\n vIsAnimate = false,\n props = {},\n}: VTEXT_PARAMS) => {\n const Result: JSX.Element = (\n <div className={`${styles.vinput} ${styles[`vinput-${vLocateMessage}`]}`}>\n <input\n type=\"text\"\n {...props}\n defaultValue={props?.defaultValue ?? ''}\n className={`${props?.className} ${\n vState ? vClassName || styles.invalid : ''\n }`}\n ></input>\n {vState && vShowMessage ? (\n <p\n className={`${vMessageClass} ${\n vIsInnerMessage\n ? `${props?.className} ${styles.innerMessage} ${\n styles[`innerMessage-${vLocateMessage}`]\n }`\n : ''\n } ${vIsAnimate ? styles.animateMessage : ''}`}\n >\n {vMessage}\n </p>\n ) : null}\n </div>\n );\n\n return Result;\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["VText","_ref","vState","_ref$vState","_ref$vClassName","vClassName","_ref$vShowMessage","vShowMessage","_ref$vMessage","vMessage","_ref$vIsInnerMessage","vIsInnerMessage","_ref$vLocateMessage","vLocateMessage","_ref$vMessageClass","vMessageClass","_ref$vIsAnimate","vIsAnimate","_ref$props","props","Result","React","className","styles","vinput","type","defaultValue","_props$defaultValue","invalid","innerMessage","animateMessage","VCheckbox","VRadio","VDate","VColor","VEmail","VRange","VUrl"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.VCheckbox=function(){return e.createElement("input",{type:"checkbox"})},exports.VColor=function(){return e.createElement("input",{type:"color"})},exports.VDate=function(){return e.createElement("input",{type:"date"})},exports.VEmail=function(){return e.createElement("input",{type:"email"})},exports.VRadio=function(){return e.createElement("input",{type:"radio"})},exports.VRange=function(){return e.createElement("input",{type:"range"})},exports.VText=function(t){return e.createElement("input",{type:"text",className:t.className,maxLength:t.maxLength,value:t.value,placeholder:"this is react-validate-component test."})},exports.VUrl=function(){return e.createElement("input",{type:"url"})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,t={invalid:"index-module_invalid__gHKsE",vinput:"index-module_vinput__tFGFH","vinput-top-left":"index-module_vinput-top-left__2g8Bq","vinput-top":"index-module_vinput-top__ZTh6H","vinput-top-right":"index-module_vinput-top-right__t6K-Q","vinput-center-left":"index-module_vinput-center-left__vJn0s","vinput-center-right":"index-module_vinput-center-right__HDgip","vinput-bottom-left":"index-module_vinput-bottom-left__xxaiT","vinput-bottom":"index-module_vinput-bottom__nCOAf","vinput-bottom-right":"index-module_vinput-bottom-right__6AjOE",innerMessage:"index-module_innerMessage__rihga","innerMessage-top-left":"index-module_innerMessage-top-left__HLoYg","innerMessage-top":"index-module_innerMessage-top__ouYW6","innerMessage-top-right":"index-module_innerMessage-top-right__7tMC8","innerMessage-center-left":"index-module_innerMessage-center-left__4iZyl","innerMessage-center":"index-module_innerMessage-center__U2006","innerMessage-center-right":"index-module_innerMessage-center-right__Pg2oU","innerMessage-bottom-left":"index-module_innerMessage-bottom-left__1QDIv","innerMessage-bottom":"index-module_innerMessage-bottom__gMogT","innerMessage-bottom-right":"index-module_innerMessage-bottom-right__peBq-",animateMessage:"index-module_animateMessage__Gxf3M","fade-in":"index-module_fade-in__GxKz8"};!function(e,n){void 0===n&&(n={});var t=n.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".index-module_invalid__gHKsE {\r\n border: 2px solid red;\r\n}\r\n\r\n/* 유효성 메시지 locate */\r\n.index-module_vinput__tFGFH {\r\n display: flex;\r\n}\r\n.index-module_vinput-top-left__2g8Bq {\r\n flex-direction: column-reverse;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top__ZTh6H {\r\n flex-direction: column-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top-right__t6K-Q {\r\n flex-direction: column-reverse;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-left__vJn0s {\r\n flex-direction: row-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-right__HDgip {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-left__xxaiT {\r\n flex-direction: column;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom__nCOAf {\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-right__6AjOE {\r\n flex-direction: column;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage__rihga {\r\n position: absolute;\r\n font-size: 12px;\r\n margin: 0;\r\n padding: 2px 5px;\r\n display: flex;\r\n}\r\n.index-module_innerMessage-top-left__HLoYg {\r\n align-items: flex-start;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-top__ouYW6 {\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-top-right__7tMC8 {\r\n align-items: flex-start;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-center-left__4iZyl {\r\n align-items: center;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-center__U2006 {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-center-right__Pg2oU {\r\n align-items: center;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-bottom-left__1QDIv {\r\n align-items: flex-end;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-bottom__gMogT {\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-bottom-right__peBq- {\r\n align-items: flex-end;\r\n justify-content: flex-end;\r\n}\r\n\r\n.index-module_animateMessage__Gxf3M {\r\n animation: index-module_fade-in__GxKz8 1s ease-in-out;\r\n}\r\n\r\n@keyframes index-module_fade-in__GxKz8 {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n}\r\n"),exports.VCheckbox=function(){return n.createElement("input",{type:"checkbox"})},exports.VColor=function(){return n.createElement("input",{type:"color"})},exports.VDate=function(){return n.createElement("input",{type:"date"})},exports.VEmail=function(){return n.createElement("input",{type:"email"})},exports.VRadio=function(){return n.createElement("input",{type:"radio"})},exports.VRange=function(){return n.createElement("input",{type:"range"})},exports.VText=function(e){var i,r=e.vState,o=void 0!==r&&r,s=e.vClassName,l=e.vShowMessage,d=void 0!==l&&l,a=e.vMessage,u=void 0===a?"":a,_=e.vIsInnerMessage,m=void 0!==_&&_,c=e.vLocateMessage,g=void 0===c?"bottom":c,x=e.vMessageClass,p=void 0===x?"":x,f=e.vIsAnimate,v=void 0!==f&&f,M=e.props,y=void 0===M?{}:M;return n.createElement("div",{className:t.vinput+" "+t["vinput-"+g]},n.createElement("input",Object.assign({type:"text"},y,{defaultValue:null!=(i=null==y?void 0:y.defaultValue)?i:"",className:(null==y?void 0:y.className)+" "+(o?(void 0===s?"":s)||t.invalid:"")})),o&&d?n.createElement("p",{className:p+" "+(m?(null==y?void 0:y.className)+" "+t.innerMessage+" "+t["innerMessage-"+g]:"")+" "+(v?t.animateMessage:"")},u):null)},exports.VUrl=function(){return n.createElement("input",{type:"url"})};
2
2
  //# sourceMappingURL=react-validate-component.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-validate-component.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { VINPUT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n maxLength,\n value,\n className,\n}: // props,\nVINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n // {...props}\n className={className}\n maxLength={maxLength}\n value={value}\n placeholder=\"this is react-validate-component test.\"\n />\n );\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["React","type","_ref","className","maxLength","value","placeholder"],"mappings":"6GAuByB,WACvB,OAAOA,yBAAOC,KAAK,6BAcC,WACpB,OAAOD,yBAAOC,KAAK,yBANA,WACnB,OAAOD,yBAAOC,KAAK,yBASC,WACpB,OAAOD,yBAAOC,KAAK,0BAhBC,WACpB,OAAOD,yBAAOC,KAAK,0BAmBC,WACpB,OAAOD,yBAAOC,KAAK,yBA7CA,SAAHC,GAMhB,OACEF,yBACEC,KAAK,OAELE,UAPKD,EAATC,UAQIC,UAVKF,EAATE,UAWIC,MAVCH,EAALG,MAWIC,YAAY,yDAoCE,WAClB,OAAON,yBAAOC,KAAK"}
1
+ {"version":3,"file":"react-validate-component.cjs.production.min.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/index.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\nimport styles from './index.module.css';\nimport { VTEXT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n vState = false,\n vClassName = '',\n vShowMessage = false,\n vMessage = '',\n vIsInnerMessage = false,\n vLocateMessage = 'bottom',\n vMessageClass = '',\n vIsAnimate = false,\n props = {},\n}: VTEXT_PARAMS) => {\n const Result: JSX.Element = (\n <div className={`${styles.vinput} ${styles[`vinput-${vLocateMessage}`]}`}>\n <input\n type=\"text\"\n {...props}\n defaultValue={props?.defaultValue ?? ''}\n className={`${props?.className} ${\n vState ? vClassName || styles.invalid : ''\n }`}\n ></input>\n {vState && vShowMessage ? (\n <p\n className={`${vMessageClass} ${\n vIsInnerMessage\n ? `${props?.className} ${styles.innerMessage} ${\n styles[`innerMessage-${vLocateMessage}`]\n }`\n : ''\n } ${vIsAnimate ? styles.animateMessage : ''}`}\n >\n {vMessage}\n </p>\n ) : null}\n </div>\n );\n\n return Result;\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","React","_ref","vState","_ref$vState","_ref$vClassName","vClassName","_ref$vShowMessage","vShowMessage","_ref$vMessage","vMessage","_ref$vIsInnerMessage","vIsInnerMessage","_ref$vLocateMessage","vLocateMessage","_ref$vMessageClass","vMessageClass","_ref$vIsAnimate","vIsAnimate","_ref$props","props","className","styles","vinput","defaultValue","_props$defaultValue","invalid","innerMessage","animateMessage"],"mappings":"26CAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,2mFCuBrB,WACvB,OAAOe,yBAAOP,KAAK,6BAcC,WACpB,OAAOO,yBAAOP,KAAK,yBANA,WACnB,OAAOO,yBAAOP,KAAK,yBASC,WACpB,OAAOO,yBAAOP,KAAK,0BAhBC,WACpB,OAAOO,yBAAOP,KAAK,0BAmBC,WACpB,OAAOO,yBAAOP,KAAK,yBAnEA,SAAHQ,aAChBC,OAAAA,WAAMC,GAAQA,EAAAC,EAAAH,EACdI,WAAeC,EAAAL,EACfM,aAAAA,WAAYD,GAAQA,EAAAE,EAAAP,EACpBQ,SAAAA,WAAQD,EAAG,GAAEA,EAAAE,EAAAT,EACbU,gBAAAA,WAAeD,GAAQA,EAAAE,EAAAX,EACvBY,eAAAA,WAAcD,EAAG,SAAQA,EAAAE,EAAAb,EACzBc,cAAAA,WAAaD,EAAG,GAAEA,EAAAE,EAAAf,EAClBgB,WAAAA,WAAUD,GAAQA,EAAAE,EAAAjB,EAClBkB,MAAAA,WAAKD,EAAG,GAAEA,EA4BV,OAzBElB,uBAAKoB,UAAcC,EAAOC,WAAUD,YAAiBR,IACnDb,uCACEP,KAAK,QACD0B,GACJI,oBAAYC,QAAEL,SAAAA,EAAOI,cAAYC,EAAI,GACrCJ,iBAAcD,SAAAA,EAAOC,gBACnBlB,YAhBEE,EAAG,GAAEA,IAgBgBiB,EAAOI,QAAU,OAG3CvB,GAAUK,EACTP,qBACEoB,UAAcL,OACZJ,SACOQ,SAAAA,EAAOC,eAAaC,EAAOK,iBAC5BL,kBAAuBR,GAEzB,SACFI,EAAaI,EAAOM,eAAiB,KAExClB,GAED,oBAsCU,WAClB,OAAOT,yBAAOP,KAAK"}
@@ -1,58 +1,108 @@
1
- import { createElement } from 'react';
1
+ import React from 'react';
2
+
3
+ function styleInject(css, ref) {
4
+ if ( ref === void 0 ) ref = {};
5
+ var insertAt = ref.insertAt;
6
+
7
+ if (!css || typeof document === 'undefined') { return; }
8
+
9
+ var head = document.head || document.getElementsByTagName('head')[0];
10
+ var style = document.createElement('style');
11
+ style.type = 'text/css';
12
+
13
+ if (insertAt === 'top') {
14
+ if (head.firstChild) {
15
+ head.insertBefore(style, head.firstChild);
16
+ } else {
17
+ head.appendChild(style);
18
+ }
19
+ } else {
20
+ head.appendChild(style);
21
+ }
22
+
23
+ if (style.styleSheet) {
24
+ style.styleSheet.cssText = css;
25
+ } else {
26
+ style.appendChild(document.createTextNode(css));
27
+ }
28
+ }
29
+
30
+ var css_248z = ".index-module_invalid__gHKsE {\r\n border: 2px solid red;\r\n}\r\n\r\n/* 유효성 메시지 locate */\r\n.index-module_vinput__tFGFH {\r\n display: flex;\r\n}\r\n.index-module_vinput-top-left__2g8Bq {\r\n flex-direction: column-reverse;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top__ZTh6H {\r\n flex-direction: column-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-top-right__t6K-Q {\r\n flex-direction: column-reverse;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-left__vJn0s {\r\n flex-direction: row-reverse;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-center-right__HDgip {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-left__xxaiT {\r\n flex-direction: column;\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom__nCOAf {\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_vinput-bottom-right__6AjOE {\r\n flex-direction: column;\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage__rihga {\r\n position: absolute;\r\n font-size: 12px;\r\n margin: 0;\r\n padding: 2px 5px;\r\n display: flex;\r\n}\r\n.index-module_innerMessage-top-left__HLoYg {\r\n align-items: flex-start;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-top__ouYW6 {\r\n align-items: flex-start;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-top-right__7tMC8 {\r\n align-items: flex-start;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-center-left__4iZyl {\r\n align-items: center;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-center__U2006 {\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-center-right__Pg2oU {\r\n align-items: center;\r\n justify-content: flex-end;\r\n}\r\n.index-module_innerMessage-bottom-left__1QDIv {\r\n align-items: flex-end;\r\n justify-content: flex-start;\r\n}\r\n.index-module_innerMessage-bottom__gMogT {\r\n align-items: flex-end;\r\n justify-content: center;\r\n}\r\n.index-module_innerMessage-bottom-right__peBq- {\r\n align-items: flex-end;\r\n justify-content: flex-end;\r\n}\r\n\r\n.index-module_animateMessage__Gxf3M {\r\n animation: index-module_fade-in__GxKz8 1s ease-in-out;\r\n}\r\n\r\n@keyframes index-module_fade-in__GxKz8 {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n}\r\n";
31
+ var styles = {"invalid":"index-module_invalid__gHKsE","vinput":"index-module_vinput__tFGFH","vinput-top-left":"index-module_vinput-top-left__2g8Bq","vinput-top":"index-module_vinput-top__ZTh6H","vinput-top-right":"index-module_vinput-top-right__t6K-Q","vinput-center-left":"index-module_vinput-center-left__vJn0s","vinput-center-right":"index-module_vinput-center-right__HDgip","vinput-bottom-left":"index-module_vinput-bottom-left__xxaiT","vinput-bottom":"index-module_vinput-bottom__nCOAf","vinput-bottom-right":"index-module_vinput-bottom-right__6AjOE","innerMessage":"index-module_innerMessage__rihga","innerMessage-top-left":"index-module_innerMessage-top-left__HLoYg","innerMessage-top":"index-module_innerMessage-top__ouYW6","innerMessage-top-right":"index-module_innerMessage-top-right__7tMC8","innerMessage-center-left":"index-module_innerMessage-center-left__4iZyl","innerMessage-center":"index-module_innerMessage-center__U2006","innerMessage-center-right":"index-module_innerMessage-center-right__Pg2oU","innerMessage-bottom-left":"index-module_innerMessage-bottom-left__1QDIv","innerMessage-bottom":"index-module_innerMessage-bottom__gMogT","innerMessage-bottom-right":"index-module_innerMessage-bottom-right__peBq-","animateMessage":"index-module_animateMessage__Gxf3M","fade-in":"index-module_fade-in__GxKz8"};
32
+ styleInject(css_248z);
2
33
 
3
34
  // Text
4
35
  var VText = function VText(_ref) {
5
- var maxLength = _ref.maxLength,
6
- value = _ref.value,
7
- className = _ref.className;
8
- return createElement("input", {
9
- type: "text",
10
- // {...props}
11
- className: className,
12
- maxLength: maxLength,
13
- value: value,
14
- placeholder: "this is react-validate-component test."
15
- });
36
+ var _props$defaultValue;
37
+ var _ref$vState = _ref.vState,
38
+ vState = _ref$vState === void 0 ? false : _ref$vState,
39
+ _ref$vClassName = _ref.vClassName,
40
+ vClassName = _ref$vClassName === void 0 ? '' : _ref$vClassName,
41
+ _ref$vShowMessage = _ref.vShowMessage,
42
+ vShowMessage = _ref$vShowMessage === void 0 ? false : _ref$vShowMessage,
43
+ _ref$vMessage = _ref.vMessage,
44
+ vMessage = _ref$vMessage === void 0 ? '' : _ref$vMessage,
45
+ _ref$vIsInnerMessage = _ref.vIsInnerMessage,
46
+ vIsInnerMessage = _ref$vIsInnerMessage === void 0 ? false : _ref$vIsInnerMessage,
47
+ _ref$vLocateMessage = _ref.vLocateMessage,
48
+ vLocateMessage = _ref$vLocateMessage === void 0 ? 'bottom' : _ref$vLocateMessage,
49
+ _ref$vMessageClass = _ref.vMessageClass,
50
+ vMessageClass = _ref$vMessageClass === void 0 ? '' : _ref$vMessageClass,
51
+ _ref$vIsAnimate = _ref.vIsAnimate,
52
+ vIsAnimate = _ref$vIsAnimate === void 0 ? false : _ref$vIsAnimate,
53
+ _ref$props = _ref.props,
54
+ props = _ref$props === void 0 ? {} : _ref$props;
55
+ var Result = React.createElement("div", {
56
+ className: styles.vinput + " " + styles["vinput-" + vLocateMessage]
57
+ }, React.createElement("input", Object.assign({
58
+ type: "text"
59
+ }, props, {
60
+ defaultValue: (_props$defaultValue = props == null ? void 0 : props.defaultValue) != null ? _props$defaultValue : '',
61
+ className: (props == null ? void 0 : props.className) + " " + (vState ? vClassName || styles.invalid : '')
62
+ })), vState && vShowMessage ? React.createElement("p", {
63
+ className: vMessageClass + " " + (vIsInnerMessage ? (props == null ? void 0 : props.className) + " " + styles.innerMessage + " " + styles["innerMessage-" + vLocateMessage] : '') + " " + (vIsAnimate ? styles.animateMessage : '')
64
+ }, vMessage) : null);
65
+ return Result;
16
66
  };
17
67
  // Checkbox
18
68
  var VCheckbox = function VCheckbox() {
19
- return createElement("input", {
69
+ return React.createElement("input", {
20
70
  type: "checkbox"
21
71
  });
22
72
  };
23
73
  // Radio
24
74
  var VRadio = function VRadio() {
25
- return createElement("input", {
75
+ return React.createElement("input", {
26
76
  type: "radio"
27
77
  });
28
78
  };
29
79
  // Date
30
80
  var VDate = function VDate() {
31
- return createElement("input", {
81
+ return React.createElement("input", {
32
82
  type: "date"
33
83
  });
34
84
  };
35
85
  // Color
36
86
  var VColor = function VColor() {
37
- return createElement("input", {
87
+ return React.createElement("input", {
38
88
  type: "color"
39
89
  });
40
90
  };
41
91
  // Email
42
92
  var VEmail = function VEmail() {
43
- return createElement("input", {
93
+ return React.createElement("input", {
44
94
  type: "email"
45
95
  });
46
96
  };
47
97
  // Range
48
98
  var VRange = function VRange() {
49
- return createElement("input", {
99
+ return React.createElement("input", {
50
100
  type: "range"
51
101
  });
52
102
  };
53
103
  // Url
54
104
  var VUrl = function VUrl() {
55
- return createElement("input", {
105
+ return React.createElement("input", {
56
106
  type: "url"
57
107
  });
58
108
  };
@@ -1 +1 @@
1
- {"version":3,"file":"react-validate-component.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { VINPUT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n maxLength,\n value,\n className,\n}: // props,\nVINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n // {...props}\n className={className}\n maxLength={maxLength}\n value={value}\n placeholder=\"this is react-validate-component test.\"\n />\n );\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["VText","_ref","maxLength","value","className","React","type","placeholder","VCheckbox","VRadio","VDate","VColor","VEmail","VRange","VUrl"],"mappings":";;AAGA;IACaA,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA;MAChBC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,SAAS,GAAAH,IAAA,CAATG,SAAS;EAGT,OACEC;IACEC,IAAI,EAAC,MAAM;;IAEXF,SAAS,EAAEA,SAAS;IACpBF,SAAS,EAAEA,SAAS;IACpBC,KAAK,EAAEA,KAAK;IACZI,WAAW,EAAC;IACZ;AAEN;AAEA;IACaC,SAAS,GAAG,SAAZA,SAASA;EACpB,OAAOH;IAAOC,IAAI,EAAC;IAAa;AAClC;AAEA;IACaG,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOJ;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaI,KAAK,GAAG,SAARA,KAAKA;EAChB,OAAOL;IAAOC,IAAI,EAAC;IAAS;AAC9B;AAEA;IACaK,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAON;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaM,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOP;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaO,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOR;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaQ,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOT;IAAOC,IAAI,EAAC;IAAQ;AAC7B;;;;"}
1
+ {"version":3,"file":"react-validate-component.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/index.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\nimport styles from './index.module.css';\nimport { VTEXT_PARAMS } from './types/vinput';\n\n// Text\nexport const VText = ({\n vState = false,\n vClassName = '',\n vShowMessage = false,\n vMessage = '',\n vIsInnerMessage = false,\n vLocateMessage = 'bottom',\n vMessageClass = '',\n vIsAnimate = false,\n props = {},\n}: VTEXT_PARAMS) => {\n const Result: JSX.Element = (\n <div className={`${styles.vinput} ${styles[`vinput-${vLocateMessage}`]}`}>\n <input\n type=\"text\"\n {...props}\n defaultValue={props?.defaultValue ?? ''}\n className={`${props?.className} ${\n vState ? vClassName || styles.invalid : ''\n }`}\n ></input>\n {vState && vShowMessage ? (\n <p\n className={`${vMessageClass} ${\n vIsInnerMessage\n ? `${props?.className} ${styles.innerMessage} ${\n styles[`innerMessage-${vLocateMessage}`]\n }`\n : ''\n } ${vIsAnimate ? styles.animateMessage : ''}`}\n >\n {vMessage}\n </p>\n ) : null}\n </div>\n );\n\n return Result;\n};\n\n// Checkbox\nexport const VCheckbox = () => {\n return <input type=\"checkbox\" />;\n};\n\n// Radio\nexport const VRadio = () => {\n return <input type=\"radio\" />;\n};\n\n// Date\nexport const VDate = () => {\n return <input type=\"date\" />;\n};\n\n// Color\nexport const VColor = () => {\n return <input type=\"color\" />;\n};\n\n// Email\nexport const VEmail = () => {\n return <input type=\"email\" />;\n};\n\n// Range\nexport const VRange = () => {\n return <input type=\"range\" />;\n};\n\n// Url\nexport const VUrl = () => {\n return <input type=\"url\" />;\n};\n"],"names":["VText","_ref","vState","_ref$vState","_ref$vClassName","vClassName","_ref$vShowMessage","vShowMessage","_ref$vMessage","vMessage","_ref$vIsInnerMessage","vIsInnerMessage","_ref$vLocateMessage","vLocateMessage","_ref$vMessageClass","vMessageClass","_ref$vIsAnimate","vIsAnimate","_ref$props","props","Result","React","className","styles","vinput","type","defaultValue","_props$defaultValue","invalid","innerMessage","animateMessage","VCheckbox","VRadio","VDate","VColor","VEmail","VRange","VUrl"],"mappings":"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"}
@@ -1,6 +1,12 @@
1
- export interface VINPUT_PARAMS {
2
- maxLength: number;
3
- value: string;
4
- className: string;
5
- props: object;
1
+ import propsType from './vprops';
2
+ export interface VTEXT_PARAMS {
3
+ readonly vState: boolean;
4
+ vClassName?: string;
5
+ readonly vShowMessage: boolean;
6
+ vMessage?: string;
7
+ vIsInnerMessage?: boolean;
8
+ vLocateMessage?: 'top-left' | 'top' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom' | 'bottom-right';
9
+ vMessageClass?: string;
10
+ vIsAnimate?: boolean;
11
+ props?: propsType;
6
12
  }
@@ -0,0 +1,3 @@
1
+ export default interface propsType {
2
+ [key: string]: any;
3
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.2-0",
2
+ "version": "0.1.1-0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -57,5 +57,12 @@
57
57
  "tsdx": "^0.14.1",
58
58
  "tslib": "^2.6.3",
59
59
  "typescript": "^3.9.10"
60
+ },
61
+ "dependencies": {
62
+ "@babel/core": "^7.25.2",
63
+ "@babel/plugin-transform-runtime": "^7.24.7",
64
+ "@babel/preset-env": "^7.25.3",
65
+ "babel-jest": "^29.7.0",
66
+ "rollup-plugin-postcss": "^4.0.2"
60
67
  }
61
68
  }
@@ -0,0 +1,103 @@
1
+ .invalid {
2
+ border: 2px solid red;
3
+ }
4
+
5
+ /* 유효성 메시지 locate */
6
+ .vinput {
7
+ display: flex;
8
+ }
9
+ .vinput-top-left {
10
+ flex-direction: column-reverse;
11
+ align-items: flex-start;
12
+ justify-content: center;
13
+ }
14
+ .vinput-top {
15
+ flex-direction: column-reverse;
16
+ align-items: center;
17
+ justify-content: center;
18
+ }
19
+ .vinput-top-right {
20
+ flex-direction: column-reverse;
21
+ align-items: flex-end;
22
+ justify-content: center;
23
+ }
24
+ .vinput-center-left {
25
+ flex-direction: row-reverse;
26
+ align-items: center;
27
+ justify-content: center;
28
+ }
29
+ .vinput-center-right {
30
+ align-items: center;
31
+ justify-content: center;
32
+ }
33
+ .vinput-bottom-left {
34
+ flex-direction: column;
35
+ align-items: flex-start;
36
+ justify-content: center;
37
+ }
38
+ .vinput-bottom {
39
+ flex-direction: column;
40
+ align-items: center;
41
+ justify-content: center;
42
+ }
43
+ .vinput-bottom-right {
44
+ flex-direction: column;
45
+ align-items: flex-end;
46
+ justify-content: center;
47
+ }
48
+ .innerMessage {
49
+ position: absolute;
50
+ font-size: 12px;
51
+ margin: 0;
52
+ padding: 2px 5px;
53
+ display: flex;
54
+ }
55
+ .innerMessage-top-left {
56
+ align-items: flex-start;
57
+ justify-content: flex-start;
58
+ }
59
+ .innerMessage-top {
60
+ align-items: flex-start;
61
+ justify-content: center;
62
+ }
63
+ .innerMessage-top-right {
64
+ align-items: flex-start;
65
+ justify-content: flex-end;
66
+ }
67
+ .innerMessage-center-left {
68
+ align-items: center;
69
+ justify-content: flex-start;
70
+ }
71
+ .innerMessage-center {
72
+ align-items: center;
73
+ justify-content: center;
74
+ }
75
+ .innerMessage-center-right {
76
+ align-items: center;
77
+ justify-content: flex-end;
78
+ }
79
+ .innerMessage-bottom-left {
80
+ align-items: flex-end;
81
+ justify-content: flex-start;
82
+ }
83
+ .innerMessage-bottom {
84
+ align-items: flex-end;
85
+ justify-content: center;
86
+ }
87
+ .innerMessage-bottom-right {
88
+ align-items: flex-end;
89
+ justify-content: flex-end;
90
+ }
91
+
92
+ .animateMessage {
93
+ animation: fade-in 1s ease-in-out;
94
+ }
95
+
96
+ @keyframes fade-in {
97
+ 0% {
98
+ opacity: 0;
99
+ }
100
+ 100% {
101
+ opacity: 1;
102
+ }
103
+ }
package/src/index.tsx CHANGED
@@ -1,23 +1,46 @@
1
- import * as React from 'react';
2
- import { VINPUT_PARAMS } from './types/vinput';
1
+ import React from 'react';
2
+ import styles from './index.module.css';
3
+ import { VTEXT_PARAMS } from './types/vinput';
3
4
 
4
5
  // Text
5
6
  export const VText = ({
6
- maxLength,
7
- value,
8
- className,
9
- }: // props,
10
- VINPUT_PARAMS) => {
11
- return (
12
- <input
13
- type="text"
14
- // {...props}
15
- className={className}
16
- maxLength={maxLength}
17
- value={value}
18
- placeholder="this is react-validate-component test."
19
- />
7
+ vState = false,
8
+ vClassName = '',
9
+ vShowMessage = false,
10
+ vMessage = '',
11
+ vIsInnerMessage = false,
12
+ vLocateMessage = 'bottom',
13
+ vMessageClass = '',
14
+ vIsAnimate = false,
15
+ props = {},
16
+ }: VTEXT_PARAMS) => {
17
+ const Result: JSX.Element = (
18
+ <div className={`${styles.vinput} ${styles[`vinput-${vLocateMessage}`]}`}>
19
+ <input
20
+ type="text"
21
+ {...props}
22
+ defaultValue={props?.defaultValue ?? ''}
23
+ className={`${props?.className} ${
24
+ vState ? vClassName || styles.invalid : ''
25
+ }`}
26
+ ></input>
27
+ {vState && vShowMessage ? (
28
+ <p
29
+ className={`${vMessageClass} ${
30
+ vIsInnerMessage
31
+ ? `${props?.className} ${styles.innerMessage} ${
32
+ styles[`innerMessage-${vLocateMessage}`]
33
+ }`
34
+ : ''
35
+ } ${vIsAnimate ? styles.animateMessage : ''}`}
36
+ >
37
+ {vMessage}
38
+ </p>
39
+ ) : null}
40
+ </div>
20
41
  );
42
+
43
+ return Result;
21
44
  };
22
45
 
23
46
  // Checkbox
@@ -1,7 +1,23 @@
1
- // VInput 파라미터
2
- export interface VINPUT_PARAMS {
3
- maxLength: number;
4
- value: string;
5
- className: string;
6
- props: object;
1
+ import propsType from './vprops';
2
+
3
+ // VText 파라미터
4
+ export interface VTEXT_PARAMS {
5
+ readonly vState: boolean; // 유효성 상태 값
6
+ vClassName?: string; // 유효성 입힐 class 명
7
+ readonly vShowMessage: boolean; // 유효성 메시지 출력할지
8
+ vMessage?: string; // 유효성 메시지
9
+ vIsInnerMessage?: boolean; // 유효성 메시지를 element 안에 넣을지 (absolute)
10
+ vLocateMessage?: // 유효성 메시지를 element 어디에 붙일지
11
+ | 'top-left'
12
+ | 'top'
13
+ | 'top-right'
14
+ | 'center-left'
15
+ | 'center'
16
+ | 'center-right'
17
+ | 'bottom-left'
18
+ | 'bottom'
19
+ | 'bottom-right';
20
+ vMessageClass?: string; // 유효성 메시지에 입힐 class 명
21
+ vIsAnimate?: boolean; // 유효성 메시지 출력 시 애니메이션 적용할지
22
+ props?: propsType; // 기타 옵션
7
23
  }
@@ -0,0 +1,3 @@
1
+ export default interface propsType {
2
+ [key: string]: any;
3
+ }
@@ -0,0 +1,4 @@
1
+ declare module '*.css' {
2
+ const content: { [className: string]: string };
3
+ export default content;
4
+ }