react-validate-component 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ export function VDate({
13
13
  props = {},
14
14
  }: VDATE_PARAMS) {
15
15
  switch (vType) {
16
+ default:
16
17
  case 'top':
17
18
  return (
18
19
  <>
@@ -47,7 +48,5 @@ export function VDate({
47
48
  ) : null}
48
49
  </>
49
50
  );
50
- default:
51
- return <></>;
52
51
  }
53
52
  }
@@ -14,6 +14,7 @@ export function VEmail({
14
14
  props = {},
15
15
  }: VEMAIL_PARAMS) {
16
16
  switch (vType) {
17
+ default:
17
18
  case 'outer':
18
19
  return (
19
20
  <div
@@ -86,7 +87,5 @@ export function VEmail({
86
87
  ) : null}
87
88
  </div>
88
89
  );
89
- default:
90
- return <div></div>;
91
90
  }
92
91
  }
@@ -38,6 +38,7 @@ export function VRadio({
38
38
  }
39
39
 
40
40
  switch (vType) {
41
+ default:
41
42
  case 'bottom':
42
43
  return (
43
44
  <>
@@ -103,7 +104,5 @@ export function VRadio({
103
104
  ) : null}
104
105
  </>
105
106
  );
106
- default:
107
- return <div></div>;
108
107
  }
109
108
  }
@@ -13,6 +13,7 @@ export function VRange({
13
13
  props = {},
14
14
  }: VRANGE_PARAMS) {
15
15
  switch (vType) {
16
+ default:
16
17
  case 'top':
17
18
  return (
18
19
  <>
@@ -47,7 +48,5 @@ export function VRange({
47
48
  ) : null}
48
49
  </>
49
50
  );
50
- default:
51
- return <></>;
52
51
  }
53
52
  }
@@ -23,25 +23,27 @@ export function VText({
23
23
  );
24
24
 
25
25
  // 공통 input 태그 변수화
26
- const inputHTML = (
27
- <input
28
- type="text"
29
- ref={inputRef}
30
- {...props}
31
- onChange={e => {
32
- if (vUseMaxLength && e.target.value.length > vMaxLength) {
33
- e.preventDefault();
34
- e.target.value = e.target.value.slice(0, vMaxLength);
35
- } else {
36
- props?.onChange(e);
37
- }
38
- }}
39
- defaultValue={props?.defaultValue ?? ''}
40
- className={`${props?.className ?? ''} ${vClassName} ${
41
- vState ? styles.invalid : ''
42
- }`}
43
- ></input>
44
- );
26
+ const inputHTML = () => {
27
+ return (
28
+ <input
29
+ type="text"
30
+ ref={inputRef}
31
+ {...props}
32
+ onChange={e => {
33
+ if (vUseMaxLength && e.target.value.length > vMaxLength) {
34
+ e.preventDefault();
35
+ e.target.value = e.target.value.slice(0, vMaxLength);
36
+ } else {
37
+ props?.onChange(e);
38
+ }
39
+ }}
40
+ defaultValue={props?.defaultValue ?? ''}
41
+ className={`${props?.className ?? ''} ${vClassName} ${
42
+ vState ? styles.invalid : ''
43
+ }`}
44
+ ></input>
45
+ );
46
+ };
45
47
 
46
48
  // 일부 옵션 값들은 input 기본 속성값을 이용하기 위해 merge 진행
47
49
  if (vUseMaxLength) {
@@ -56,6 +58,7 @@ export function VText({
56
58
  }, [inputRef.current?.value]);
57
59
 
58
60
  switch (vType) {
61
+ default:
59
62
  case 'outer':
60
63
  return (
61
64
  <div
@@ -63,12 +66,14 @@ export function VText({
63
66
  vUseMaxLength ? styles.vMaxLengthContainer : ''
64
67
  }`}
65
68
  >
66
- {inputHTML}
67
- {vUseMaxLength && (
68
- <p className={`${styles.vMaxLength} ${vClassMaxLength}`}>
69
- {inputLength} / {vMaxLength}
70
- </p>
71
- )}
69
+ <div style={{ position: 'relative' }}>
70
+ {inputHTML()}
71
+ {vUseMaxLength && (
72
+ <p className={`${styles.vMaxLength} ${vClassMaxLength}`}>
73
+ {inputLength} / {vMaxLength}
74
+ </p>
75
+ )}
76
+ </div>
72
77
  {vState && vShowMessage ? (
73
78
  <p
74
79
  className={`${vMessageClass} ${
@@ -87,7 +92,7 @@ export function VText({
87
92
  vUseMaxLength ? styles.vMaxLengthContainer : ''
88
93
  }`}
89
94
  >
90
- {inputHTML}
95
+ {inputHTML()}
91
96
  {vUseMaxLength && (
92
97
  <p className={`${styles.vMaxLength} ${vClassMaxLength}`}>
93
98
  {inputLength} / {vMaxLength}
@@ -111,7 +116,7 @@ export function VText({
111
116
  styles[`tooltipMessage-${vLocateMessage}`]
112
117
  } ${vUseMaxLength ? styles.vMaxLengthContainer : ''}`}
113
118
  >
114
- {inputHTML}
119
+ {inputHTML()}
115
120
  {vUseMaxLength && (
116
121
  <p className={`${styles.vMaxLength} ${vClassMaxLength}`}>
117
122
  {inputLength} / {vMaxLength}
@@ -128,7 +133,5 @@ export function VText({
128
133
  ) : null}
129
134
  </div>
130
135
  );
131
- default:
132
- return <div></div>;
133
136
  }
134
137
  }
@@ -14,6 +14,7 @@ export function VURL({
14
14
  props = {},
15
15
  }: VURL_PARAMS) {
16
16
  switch (vType) {
17
+ default:
17
18
  case 'outer':
18
19
  return (
19
20
  <div
@@ -86,7 +87,5 @@ export function VURL({
86
87
  ) : null}
87
88
  </div>
88
89
  );
89
- default:
90
- return <div></div>;
91
90
  }
92
91
  }