react-validate-component 0.0.1 → 0.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/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, props, }: 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
- props = _ref.props;
13
- return React.createElement("input", Object.assign({
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({
14
64
  type: "text"
15
65
  }, props, {
16
- className: className,
17
- maxLength: maxLength,
18
- value: value
19
- }));
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,\n}: VINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n {...props}\n className={className}\n maxLength={maxLength}\n value={value}\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","props","React","type","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;IACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;EAEL,OACEC;IACEC,IAAI,EAAC;KACDF,KAAK;IACTD,SAAS,EAAEA,SAAS;IACpBF,SAAS,EAAEA,SAAS;IACpBC,KAAK,EAAEA;KACP;AAEN;AAEA;IACaK,SAAS,GAAG,SAAZA,SAASA;EACpB,OAAOF;IAAOC,IAAI,EAAC;IAAa;AAClC;AAEA;IACaE,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOH;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaG,KAAK,GAAG,SAARA,KAAKA;EAChB,OAAOJ;IAAOC,IAAI,EAAC;IAAS;AAC9B;AAEA;IACaI,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOL;IAAOC,IAAI,EAAC;IAAU;AAC/B;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,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOR;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":";;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK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MA;EACjB,OAAOd;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaW,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOf;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaY,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOhB;IAAOI,IAAI,EAAC;IAAQ;AAC7B,CAAC;;;;;;;;;;;"}
@@ -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",Object.assign({type:"text"},t.props,{className:t.className,maxLength:t.maxLength,value:t.value}))},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,\n}: VINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n {...props}\n className={className}\n maxLength={maxLength}\n value={value}\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","props","className","maxLength","value"],"mappings":"6GAsByB,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,yBA5CA,SAAHC,GAMhB,OACEF,uCACEC,KAAK,QAJJC,EAALC,OAMIC,UAPKF,EAATE,UAQIC,UAVKH,EAATG,UAWIC,MAVCJ,EAALI,uBA8CkB,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
- props = _ref.props;
9
- return createElement("input", Object.assign({
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({
10
58
  type: "text"
11
59
  }, props, {
12
- className: className,
13
- maxLength: maxLength,
14
- value: value
15
- }));
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,\n}: VINPUT_PARAMS) => {\n return (\n <input\n type=\"text\"\n {...props}\n className={className}\n maxLength={maxLength}\n value={value}\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","props","React","type","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;IACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;EAEL,OACEC;IACEC,IAAI,EAAC;KACDF,KAAK;IACTD,SAAS,EAAEA,SAAS;IACpBF,SAAS,EAAEA,SAAS;IACpBC,KAAK,EAAEA;KACP;AAEN;AAEA;IACaK,SAAS,GAAG,SAAZA,SAASA;EACpB,OAAOF;IAAOC,IAAI,EAAC;IAAa;AAClC;AAEA;IACaE,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOH;IAAOC,IAAI,EAAC;IAAU;AAC/B;AAEA;IACaG,KAAK,GAAG,SAARA,KAAKA;EAChB,OAAOJ;IAAOC,IAAI,EAAC;IAAS;AAC9B;AAEA;IACaI,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOL;IAAOC,IAAI,EAAC;IAAU;AAC/B;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,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOR;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":";;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;;;ACrBA;AACA,IAAaA,KAAK,GAAG,SAARA,KAAKA,CAAA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,eAAe,IACRQ,KAAK,oBAALA,KAAK,CAAEG,SAAS,UAAIC,MAAM,CAACM,YAAY,SACxCN,MAAM,mBAAiBV,cAAc,CACvC,GACA,EACN,WAAII,UAAU,GAAGM,MAAM,CAACO,cAAc,GAAG,EAAE;KAE1CrB,QAAQ,CACP,GACF,IAAI,CAEX;EAED,OAAOW,MAAM;AACf,CAAC;AAED;AACA,IAAaW,SAAS,GAAG,SAAZA,SAASA;EACpB,OAAOV;IAAOI,IAAI,EAAC;IAAa;AAClC,CAAC;AAED;AACA,IAAaO,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOX;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaQ,KAAK,GAAG,SAARA,KAAKA;EAChB,OAAOZ;IAAOI,IAAI,EAAC;IAAS;AAC9B,CAAC;AAED;AACA,IAAaS,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOb;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaU,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOd;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaW,MAAM,GAAG,SAATA,MAAMA;EACjB,OAAOf;IAAOI,IAAI,EAAC;IAAU;AAC/B,CAAC;AAED;AACA,IAAaY,IAAI,GAAG,SAAPA,IAAIA;EACf,OAAOhB;IAAOI,IAAI,EAAC;IAAQ;AAC7B,CAAC;;;;"}
@@ -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.1",
2
+ "version": "0.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,22 +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
- />
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>
19
41
  );
42
+
43
+ return Result;
20
44
  };
21
45
 
22
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
+ }