namirasoft-site-react 1.3.61 → 1.3.63
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/App.js +2 -2
- package/dist/App.js.map +1 -1
- package/dist/Validator.d.ts +7 -2
- package/dist/Validator.js +57 -15
- package/dist/Validator.js.map +1 -1
- package/dist/components/NSButton.module.css +1 -1
- package/dist/components/NSButtonBlue.js +5 -4
- package/dist/components/NSButtonBlue.js.map +1 -1
- package/dist/components/NSButtonGreen.js +5 -4
- package/dist/components/NSButtonGreen.js.map +1 -1
- package/dist/components/NSButtonRed.js +5 -4
- package/dist/components/NSButtonRed.js.map +1 -1
- package/dist/components/NSCard.module.css +2 -3
- package/dist/components/NSCopyToClipboard.js +1 -1
- package/dist/components/NSCopyToClipboard.js.map +1 -1
- package/dist/components/NSCopyToClipboard.module.css +1 -1
- package/dist/components/NSEntityBar.module.css +2 -2
- package/dist/components/NSEntityCardBackground.module.css +2 -2
- package/dist/components/NSFooter.js.map +1 -1
- package/dist/components/NSHeader.js +1 -1
- package/dist/components/NSHeader.js.map +1 -1
- package/dist/components/NSInput.module.css +29 -0
- package/dist/components/NSInputDate.d.ts +3 -1
- package/dist/components/NSInputDate.js +14 -4
- package/dist/components/NSInputDate.js.map +1 -1
- package/dist/components/NSInputDate.module.css +5 -2
- package/dist/components/NSInputDuration.d.ts +6 -1
- package/dist/components/NSInputDuration.js +15 -6
- package/dist/components/NSInputDuration.js.map +1 -1
- package/dist/components/NSInputEmail.d.ts +1 -1
- package/dist/components/NSInputEmail.js +5 -3
- package/dist/components/NSInputEmail.js.map +1 -1
- package/dist/components/NSInputFloat.d.ts +4 -4
- package/dist/components/NSInputFloat.js +8 -9
- package/dist/components/NSInputFloat.js.map +1 -1
- package/dist/components/NSInputIP.d.ts +5 -1
- package/dist/components/NSInputIP.js +17 -7
- package/dist/components/NSInputIP.js.map +1 -1
- package/dist/components/NSInputInteger.d.ts +9 -5
- package/dist/components/NSInputInteger.js +16 -8
- package/dist/components/NSInputInteger.js.map +1 -1
- package/dist/components/NSInputPassword.d.ts +5 -1
- package/dist/components/NSInputPassword.js +15 -6
- package/dist/components/NSInputPassword.js.map +1 -1
- package/dist/components/NSInputPhone.d.ts +8 -3
- package/dist/components/NSInputPhone.js +18 -12
- package/dist/components/NSInputPhone.js.map +1 -1
- package/dist/components/NSInputPrice.d.ts +7 -2
- package/dist/components/NSInputPrice.js +15 -7
- package/dist/components/NSInputPrice.js.map +1 -1
- package/dist/components/NSInputSearch.d.ts +6 -1
- package/dist/components/NSInputSearch.js +15 -6
- package/dist/components/NSInputSearch.js.map +1 -1
- package/dist/components/NSInputString.d.ts +5 -1
- package/dist/components/NSInputString.js +15 -6
- package/dist/components/NSInputString.js.map +1 -1
- package/dist/components/NSInputText.d.ts +5 -1
- package/dist/components/NSInputText.js +15 -6
- package/dist/components/NSInputText.js.map +1 -1
- package/dist/components/NSInputTime.d.ts +5 -1
- package/dist/components/NSInputTime.js +16 -6
- package/dist/components/NSInputTime.js.map +1 -1
- package/dist/components/NSLayoutTitle.d.ts +1 -4
- package/dist/components/NSLayoutTitle.js +7 -11
- package/dist/components/NSLayoutTitle.js.map +1 -1
- package/dist/components/NSLink.d.ts +5 -0
- package/dist/components/NSLink.js +7 -0
- package/dist/components/NSLink.js.map +1 -0
- package/dist/components/{NSLinkBlue.module.css → NSLink.module.css} +3 -3
- package/dist/components/NSLinkBlue.d.ts +2 -5
- package/dist/components/NSLinkBlue.js +2 -3
- package/dist/components/NSLinkBlue.js.map +1 -1
- package/dist/components/NSLinkGreen.d.ts +2 -16
- package/dist/components/NSLinkGreen.js +3 -18
- package/dist/components/NSLinkGreen.js.map +1 -1
- package/dist/components/NSLinkRed.d.ts +2 -16
- package/dist/components/NSLinkRed.js +3 -18
- package/dist/components/NSLinkRed.js.map +1 -1
- package/dist/components/NSNotification.d.ts +2 -10
- package/dist/components/NSNotification.js +4 -20
- package/dist/components/NSNotification.js.map +1 -1
- package/dist/components/NSPagination.d.ts +1 -9
- package/dist/components/NSPagination.js +25 -33
- package/dist/components/NSPagination.js.map +1 -1
- package/dist/components/NSSectionBars.d.ts +1 -0
- package/dist/components/NSSectionBars.js.map +1 -1
- package/dist/components/NSSectionCards.d.ts +1 -2
- package/dist/components/NSSectionCards.js +1 -1
- package/dist/components/NSSectionCards.js.map +1 -1
- package/dist/components/NSSectionTitle.d.ts +1 -2
- package/dist/components/NSSectionTitle.js +1 -1
- package/dist/components/NSSectionTitle.js.map +1 -1
- package/dist/components/NSSelectBox.d.ts +6 -3
- package/dist/components/NSSelectBox.js +21 -6
- package/dist/components/NSSelectBox.js.map +1 -1
- package/dist/components/NSSelectBox.module.css +3 -3
- package/dist/components/NSTable.js +1 -1
- package/dist/components/NSTable.js.map +1 -1
- package/dist/pages/NSLoginPage.d.ts +1 -4
- package/dist/pages/NSLoginPage.js +8 -11
- package/dist/pages/NSLoginPage.js.map +1 -1
- package/dist/pages/NSNotFoundPage.d.ts +1 -4
- package/dist/pages/NSNotFoundPage.js +2 -6
- package/dist/pages/NSNotFoundPage.js.map +1 -1
- package/dist/props/ValidationNumberProps.d.ts +1 -2
- package/dist/props/ValidationProps.d.ts +1 -0
- package/dist/props/ValidationStringProps.d.ts +1 -2
- package/package.json +4 -4
- package/src/App.tsx +13 -3
- package/src/Validator.ts +67 -18
- package/src/components/NSButton.module.css +1 -1
- package/src/components/NSButtonBlue.tsx +6 -4
- package/src/components/NSButtonGreen.tsx +5 -4
- package/src/components/NSButtonRed.tsx +5 -4
- package/src/components/NSCard.module.css +2 -3
- package/src/components/NSCopyToClipboard.module.css +1 -1
- package/src/components/NSCopyToClipboard.tsx +3 -3
- package/src/components/NSEntityBar.module.css +2 -2
- package/src/components/NSEntityCardBackground.module.css +2 -2
- package/src/components/NSHeader.tsx +3 -3
- package/src/components/NSInput.module.css +29 -0
- package/src/components/NSInputDate.module.css +5 -2
- package/src/components/NSInputDate.tsx +29 -12
- package/src/components/NSInputDuration.tsx +44 -23
- package/src/components/NSInputEmail.tsx +10 -5
- package/src/components/NSInputFloat.tsx +33 -32
- package/src/components/NSInputIP.tsx +44 -24
- package/src/components/NSInputInteger.tsx +48 -31
- package/src/components/NSInputPassword.tsx +42 -23
- package/src/components/NSInputPhone.tsx +45 -29
- package/src/components/NSInputPrice.tsx +45 -23
- package/src/components/NSInputSearch.tsx +43 -21
- package/src/components/NSInputString.tsx +42 -23
- package/src/components/NSInputText.tsx +42 -23
- package/src/components/NSInputTime.tsx +44 -23
- package/src/components/NSLayoutTitle.tsx +24 -30
- package/src/components/{NSLinkBlue.module.css → NSLink.module.css} +3 -3
- package/src/components/NSLink.tsx +22 -0
- package/src/components/NSLinkBlue.tsx +3 -19
- package/src/components/NSLinkGreen.tsx +3 -42
- package/src/components/NSLinkRed.tsx +3 -42
- package/src/components/NSNotification.tsx +19 -51
- package/src/components/NSPagination.tsx +56 -72
- package/src/components/NSSectionBars.tsx +1 -0
- package/src/components/NSSectionCards.tsx +3 -3
- package/src/components/NSSectionTitle.tsx +3 -3
- package/src/components/NSSelectBox.module.css +3 -3
- package/src/components/NSSelectBox.tsx +48 -23
- package/src/components/NSTable.tsx +1 -1
- package/src/pages/NSLoginPage.tsx +20 -24
- package/src/pages/NSNotFoundPage.tsx +7 -13
- package/src/props/ValidationNumberProps.ts +1 -3
- package/src/props/ValidationProps.ts +1 -0
- package/src/props/ValidationStringProps.ts +1 -3
- package/dist/components/NSInputDuration.module.css +0 -26
- package/dist/components/NSInputEmail.module.css +0 -38
- package/dist/components/NSInputFloat.module.css +0 -26
- package/dist/components/NSInputIP.module.css +0 -26
- package/dist/components/NSInputInteger.module.css +0 -26
- package/dist/components/NSInputPassword.module.css +0 -27
- package/dist/components/NSInputPhone.module.css +0 -33
- package/dist/components/NSInputPrice.module.css +0 -27
- package/dist/components/NSInputSearch.module.css +0 -27
- package/dist/components/NSInputString.module.css +0 -27
- package/dist/components/NSInputText.module.css +0 -28
- package/dist/components/NSInputTime.module.css +0 -27
- package/dist/components/NSLinkGreen.module.css +0 -16
- package/dist/components/NSLinkRed.module.css +0 -16
- package/src/components/NSInputDuration.module.css +0 -26
- package/src/components/NSInputEmail.module.css +0 -38
- package/src/components/NSInputFloat.module.css +0 -26
- package/src/components/NSInputIP.module.css +0 -26
- package/src/components/NSInputInteger.module.css +0 -26
- package/src/components/NSInputPassword.module.css +0 -27
- package/src/components/NSInputPhone.module.css +0 -33
- package/src/components/NSInputPrice.module.css +0 -27
- package/src/components/NSInputSearch.module.css +0 -27
- package/src/components/NSInputString.module.css +0 -27
- package/src/components/NSInputText.module.css +0 -28
- package/src/components/NSInputTime.module.css +0 -27
- package/src/components/NSLinkGreen.module.css +0 -16
- package/src/components/NSLinkRed.module.css +0 -16
|
@@ -4,8 +4,10 @@ import { NSButtonProps } from "./NSButton";
|
|
|
4
4
|
|
|
5
5
|
export function NSButtonBlue(props: NSButtonProps)
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let classList = []
|
|
8
|
+
if (props.classList)
|
|
9
|
+
classList.push(...props.classList);
|
|
10
|
+
classList.push(Style.ns_button_blue);
|
|
11
|
+
|
|
12
|
+
return <NSButton title={props.title} icon={props.icon} onClick={props.onClick} id={props.id} classList={classList} style={props.style} />;
|
|
11
13
|
}
|
|
@@ -4,8 +4,9 @@ import { NSButtonProps } from "./NSButton";
|
|
|
4
4
|
|
|
5
5
|
export function NSButtonGreen(props: NSButtonProps)
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let classList = []
|
|
8
|
+
if (props.classList)
|
|
9
|
+
classList.push(...props.classList);
|
|
10
|
+
classList.push(Style.ns_button_green);
|
|
11
|
+
return <NSButton title={props.title} icon={props.icon} onClick={props.onClick} id={props.id} classList={classList} style={props.style} />;
|
|
11
12
|
}
|
|
@@ -4,8 +4,9 @@ import { NSButtonProps } from "./NSButton";
|
|
|
4
4
|
|
|
5
5
|
export function NSButtonRed(props: NSButtonProps)
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let classList = []
|
|
8
|
+
if (props.classList)
|
|
9
|
+
classList.push(...props.classList);
|
|
10
|
+
classList.push(Style.ns_button_red);
|
|
11
|
+
return <NSButton title={props.title} icon={props.icon} onClick={props.onClick} id={props.id} classList={classList} style={props.style} />;
|
|
11
12
|
}
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
box-shadow: 0 2px 10px 4px #00000040;
|
|
10
10
|
padding: 24px;
|
|
11
11
|
border-radius: 24px;
|
|
12
|
-
width:
|
|
13
|
-
max-width: 358px;
|
|
12
|
+
max-width: 272px;
|
|
14
13
|
position: relative;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
line-height: normal;
|
|
83
82
|
border-radius: 24px;
|
|
84
83
|
width: 100%;
|
|
85
|
-
max-width:
|
|
84
|
+
max-width: 272px;
|
|
86
85
|
margin-top: 24px;
|
|
87
86
|
}
|
|
88
87
|
|
|
@@ -25,9 +25,9 @@ export function NSCopyToClipboard(props: NSCopyToClipboardProps)
|
|
|
25
25
|
<img
|
|
26
26
|
className={Styles.ns_copy_to_clipboard_icon}
|
|
27
27
|
src={IconInputString}
|
|
28
|
-
alt="
|
|
29
|
-
width={
|
|
30
|
-
height={
|
|
28
|
+
alt="Copy Icon"
|
|
29
|
+
width={24}
|
|
30
|
+
height={24}
|
|
31
31
|
onClick={copyToClipboard}
|
|
32
32
|
/>
|
|
33
33
|
<span>{props.value}</span>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
padding: 24px;
|
|
8
8
|
box-shadow: 0 2px 10px 4px #00000040;
|
|
9
9
|
width: 100%;
|
|
10
|
-
max-width:
|
|
10
|
+
max-width: 304px;
|
|
11
11
|
border-radius: 24px;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
.ns_entity_bar_image_container {
|
|
65
65
|
width: 30%;
|
|
66
|
-
max-width:
|
|
66
|
+
max-width: 304px;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.ns_entity_bar_image_title {
|
|
@@ -109,9 +109,9 @@ export class NSHeader extends React.Component<NSHeaderProps, NSHeaderState>
|
|
|
109
109
|
"https://static.namirasoft.com/icons/base/close-menu.svg"
|
|
110
110
|
: "https://static.namirasoft.com/icons/base/menu.svg"
|
|
111
111
|
}
|
|
112
|
-
alt="Menu"
|
|
113
|
-
width={
|
|
114
|
-
height={
|
|
112
|
+
alt="Menu Icon"
|
|
113
|
+
width={24}
|
|
114
|
+
height={24}
|
|
115
115
|
/>
|
|
116
116
|
</div>
|
|
117
117
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.ns_input_parent {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 272px;
|
|
5
|
+
color: #fff;
|
|
6
|
+
position: relative;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
padding: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ns_input {
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
padding: 10px 12px;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
font-weight: 400;
|
|
16
|
+
border: 1px solid rgba(47, 0, 236, 0.6);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ns_input_icon {
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: 20px;
|
|
22
|
+
top: 51%;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ns_input_title {
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
.
|
|
1
|
+
.ns_input_parent {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
width:
|
|
4
|
+
width: 272px;
|
|
5
5
|
color: #fff;
|
|
6
6
|
position: relative;
|
|
7
7
|
max-width: 100%;
|
|
8
|
+
padding: 8px;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.ns_input {
|
|
@@ -12,12 +13,14 @@
|
|
|
12
13
|
padding: 10px 12px;
|
|
13
14
|
font-size: 16px;
|
|
14
15
|
font-weight: 400;
|
|
16
|
+
border: 1px solid rgba(47, 0, 236, 0.6);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.ns_input_icon {
|
|
18
20
|
position: absolute;
|
|
19
21
|
right: 20px;
|
|
20
22
|
top: 51%;
|
|
23
|
+
z-index: 1;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
.ns_input_title {
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import Styles from "./NSInputDate.module.css";
|
|
5
|
+
import IconInputDate from '../assets/images/icon-input-date.svg';
|
|
5
6
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
6
7
|
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
8
|
+
import { ValidationProps } from "../props/ValidationProps";
|
|
9
|
+
import { Validator } from "../Validator";
|
|
7
10
|
|
|
8
|
-
export interface NSInputDateProps extends BaseComponentProps
|
|
11
|
+
export interface NSInputDateProps extends BaseComponentProps, ValidationProps
|
|
9
12
|
{
|
|
10
13
|
title: string;
|
|
11
14
|
defaultValue?: string;
|
|
@@ -24,15 +27,26 @@ export class NSInputDate extends React.Component<NSInputDateProps, NSInputDateSt
|
|
|
24
27
|
constructor(props: NSInputDateProps)
|
|
25
28
|
{
|
|
26
29
|
super(props);
|
|
27
|
-
this.state = {
|
|
28
|
-
value: ""
|
|
29
|
-
};
|
|
30
|
+
this.state = { value: props.defaultValue ?? "" };
|
|
30
31
|
this.setValue = this.setValue.bind(this);
|
|
31
32
|
this.getValue = this.getValue.bind(this);
|
|
32
33
|
this.onChanged = this.onChanged.bind(this);
|
|
33
34
|
}
|
|
35
|
+
getError(): string | null
|
|
36
|
+
{
|
|
37
|
+
return (
|
|
38
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
39
|
+
Validator.getErrorDate(this.props.title, this.state.value)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
34
42
|
getValue(): string
|
|
35
43
|
{
|
|
44
|
+
let error = this.getError();
|
|
45
|
+
if (error)
|
|
46
|
+
{
|
|
47
|
+
this.setState({ error });
|
|
48
|
+
throw new Error(error);
|
|
49
|
+
}
|
|
36
50
|
return this.state.value;
|
|
37
51
|
}
|
|
38
52
|
setValue(value: string): void
|
|
@@ -49,17 +63,22 @@ export class NSInputDate extends React.Component<NSInputDateProps, NSInputDateSt
|
|
|
49
63
|
{
|
|
50
64
|
return (
|
|
51
65
|
<>
|
|
52
|
-
<div className={`${Styles.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
<div className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
67
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
68
|
+
<img
|
|
69
|
+
className={Styles.ns_input_icon}
|
|
70
|
+
src={IconInputDate}
|
|
71
|
+
alt="Date Icon"
|
|
72
|
+
width={24}
|
|
73
|
+
height={24}
|
|
74
|
+
/>
|
|
56
75
|
<input
|
|
76
|
+
id={this.props.id}
|
|
57
77
|
value={this.state.value}
|
|
58
78
|
onChange={this.onChanged}
|
|
59
79
|
type="date"
|
|
60
80
|
className={Styles.ns_input}
|
|
61
81
|
placeholder={this.props.placeholder}
|
|
62
|
-
id={this.props.id}
|
|
63
82
|
onClick={() => { }}
|
|
64
83
|
/>
|
|
65
84
|
</div>
|
|
@@ -67,6 +86,4 @@ export class NSInputDate extends React.Component<NSInputDateProps, NSInputDateSt
|
|
|
67
86
|
</>
|
|
68
87
|
);
|
|
69
88
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
89
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import Styles from "./
|
|
4
|
+
import Styles from "./NSInput.module.css";
|
|
5
5
|
import IconInputDuration from '../assets/images/icon-input-duration.svg';
|
|
6
6
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
7
|
+
import { ValidationProps } from "../props/ValidationProps";
|
|
8
|
+
import { ValidationNumberProps } from "../props/ValidationNumberProps";
|
|
9
|
+
import { ValidationStringProps } from "../props/ValidationStringProps";
|
|
10
|
+
import { Validator } from "../Validator";
|
|
11
|
+
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
7
12
|
|
|
8
|
-
export interface NSInputDurationProps extends BaseComponentProps
|
|
13
|
+
export interface NSInputDurationProps extends BaseComponentProps, ValidationProps, ValidationStringProps, ValidationNumberProps
|
|
9
14
|
{
|
|
10
15
|
title: string;
|
|
11
16
|
defaultValue?: string;
|
|
@@ -16,6 +21,7 @@ export interface NSInputDurationProps extends BaseComponentProps
|
|
|
16
21
|
export interface NSInputDurationState
|
|
17
22
|
{
|
|
18
23
|
value: string;
|
|
24
|
+
error?: string;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
export class NSInputDuration extends React.Component<NSInputDurationProps, NSInputDurationState>
|
|
@@ -23,15 +29,26 @@ export class NSInputDuration extends React.Component<NSInputDurationProps, NSInp
|
|
|
23
29
|
constructor(props: NSInputDurationProps)
|
|
24
30
|
{
|
|
25
31
|
super(props);
|
|
26
|
-
this.state = {
|
|
27
|
-
value: props.defaultValue ?? "",
|
|
28
|
-
};
|
|
32
|
+
this.state = { value: props.defaultValue ?? "" };
|
|
29
33
|
this.getValue = this.getValue.bind(this);
|
|
30
34
|
this.setValue = this.setValue.bind(this);
|
|
31
35
|
this.onChanged = this.onChanged.bind(this);
|
|
32
36
|
}
|
|
37
|
+
getError(): string | null
|
|
38
|
+
{
|
|
39
|
+
return (
|
|
40
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
41
|
+
Validator.getErrorDuration(this.props.title, this.state.value)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
33
44
|
getValue(): string
|
|
34
45
|
{
|
|
46
|
+
let error = this.getError();
|
|
47
|
+
if (error)
|
|
48
|
+
{
|
|
49
|
+
this.setState({ error });
|
|
50
|
+
throw new Error(error);
|
|
51
|
+
}
|
|
35
52
|
return this.state.value;
|
|
36
53
|
}
|
|
37
54
|
setValue(value: string): void
|
|
@@ -47,24 +64,28 @@ export class NSInputDuration extends React.Component<NSInputDurationProps, NSInp
|
|
|
47
64
|
override render()
|
|
48
65
|
{
|
|
49
66
|
return (
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
<>
|
|
68
|
+
<div className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
69
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
70
|
+
<img
|
|
71
|
+
className={Styles.ns_input_icon}
|
|
72
|
+
src={IconInputDuration}
|
|
73
|
+
alt="Duration Icon"
|
|
74
|
+
width={24}
|
|
75
|
+
height={24}
|
|
76
|
+
/>
|
|
77
|
+
<input
|
|
78
|
+
id={this.props.id}
|
|
79
|
+
value={this.state.value}
|
|
80
|
+
onChange={this.onChanged}
|
|
81
|
+
type="time"
|
|
82
|
+
className={Styles.ns_input}
|
|
83
|
+
placeholder={this.props.placeholder}
|
|
84
|
+
step="2"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
88
|
+
</>
|
|
68
89
|
);
|
|
69
90
|
}
|
|
70
91
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import Styles from "./
|
|
4
|
+
import Styles from "./NSInput.module.css";
|
|
5
5
|
import IconInputEmail from '../assets/images/icon-input-email.svg';
|
|
6
6
|
import { Validator } from "../Validator";
|
|
7
7
|
import { ValidationProps } from "../props/ValidationProps";
|
|
@@ -13,8 +13,8 @@ export interface NSInputEmailProps extends BaseComponentProps, ValidationProps,
|
|
|
13
13
|
{
|
|
14
14
|
title: string;
|
|
15
15
|
defaultValue?: string;
|
|
16
|
-
placeholder?: string;
|
|
17
16
|
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
placeholder?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface NSInputEmailState
|
|
@@ -35,7 +35,11 @@ export class NSInputEmail extends React.Component<NSInputEmailProps, NSInputEmai
|
|
|
35
35
|
}
|
|
36
36
|
getError(): string | null
|
|
37
37
|
{
|
|
38
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
40
|
+
Validator.getErrorString(this.props.title, this.state.value, this.props) &&
|
|
41
|
+
Validator.getErrorEmail(this.props.title, this.state.value)
|
|
42
|
+
);
|
|
39
43
|
}
|
|
40
44
|
getValue(): string
|
|
41
45
|
{
|
|
@@ -62,7 +66,7 @@ export class NSInputEmail extends React.Component<NSInputEmailProps, NSInputEmai
|
|
|
62
66
|
return (
|
|
63
67
|
<>
|
|
64
68
|
<div className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
65
|
-
<span className={Styles.ns_input_title}>{this.props.title}</span>
|
|
69
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
66
70
|
<img
|
|
67
71
|
className={Styles.ns_input_icon}
|
|
68
72
|
src={IconInputEmail}
|
|
@@ -71,10 +75,11 @@ export class NSInputEmail extends React.Component<NSInputEmailProps, NSInputEmai
|
|
|
71
75
|
height={24}
|
|
72
76
|
/>
|
|
73
77
|
<input
|
|
78
|
+
id={this.props.id}
|
|
74
79
|
value={this.state.value}
|
|
75
80
|
onChange={this.onChanged}
|
|
76
81
|
type="email"
|
|
77
|
-
className={
|
|
82
|
+
className={Styles.ns_input}
|
|
78
83
|
placeholder={this.props.placeholder}
|
|
79
84
|
/>
|
|
80
85
|
</div>
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import Styles from "./
|
|
4
|
+
import Styles from "./NSInput.module.css";
|
|
5
5
|
import IconInputFloat from '../assets/images/icon-input-float.svg';
|
|
6
6
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
7
7
|
import { ValidationProps } from "../props/ValidationProps";
|
|
8
8
|
import { ValidationNumberProps } from "../props/ValidationNumberProps";
|
|
9
9
|
import { Validator } from "../Validator";
|
|
10
|
+
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
10
11
|
|
|
11
12
|
export interface NSInputFloatProps extends BaseComponentProps, ValidationProps, ValidationNumberProps
|
|
12
13
|
{
|
|
13
14
|
title: string;
|
|
14
|
-
defaultValue?:
|
|
15
|
+
defaultValue?: number;
|
|
15
16
|
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface NSInputFloatState
|
|
20
21
|
{
|
|
21
|
-
value
|
|
22
|
+
value?: number;
|
|
22
23
|
error?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -27,18 +28,19 @@ export class NSInputFloat extends React.Component<NSInputFloatProps, NSInputFloa
|
|
|
27
28
|
constructor(props: NSInputFloatProps)
|
|
28
29
|
{
|
|
29
30
|
super(props);
|
|
30
|
-
this.state = {
|
|
31
|
-
value: props.defaultValue ?? "",
|
|
32
|
-
};
|
|
31
|
+
this.state = { value: props.defaultValue };
|
|
33
32
|
this.setValue = this.setValue.bind(this);
|
|
34
33
|
this.getValue = this.getValue.bind(this);
|
|
35
34
|
this.onChanged = this.onChanged.bind(this);
|
|
36
35
|
}
|
|
37
36
|
getError(): string | null
|
|
38
37
|
{
|
|
39
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
40
|
+
Validator.getErrorNumber(this.props.title, this.state.value, this.props)
|
|
41
|
+
);
|
|
40
42
|
}
|
|
41
|
-
getValue():
|
|
43
|
+
getValue(): number | undefined
|
|
42
44
|
{
|
|
43
45
|
let error = this.getError();
|
|
44
46
|
if (error)
|
|
@@ -48,41 +50,40 @@ export class NSInputFloat extends React.Component<NSInputFloatProps, NSInputFloa
|
|
|
48
50
|
}
|
|
49
51
|
return this.state.value;
|
|
50
52
|
}
|
|
51
|
-
setValue(value:
|
|
53
|
+
setValue(value: number | undefined): void
|
|
52
54
|
{
|
|
53
55
|
this.setState({ value });
|
|
54
56
|
}
|
|
55
57
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
56
58
|
{
|
|
57
|
-
this.setValue(e.target.value);
|
|
59
|
+
this.setValue(parseFloat(e.target.value));
|
|
58
60
|
if (this.props.onChanged)
|
|
59
61
|
this.props.onChanged(e);
|
|
60
62
|
}
|
|
61
63
|
override render()
|
|
62
64
|
{
|
|
63
65
|
return (
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</div>
|
|
66
|
+
<>
|
|
67
|
+
<div className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
68
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
69
|
+
<img
|
|
70
|
+
className={Styles.ns_input_icon}
|
|
71
|
+
src={IconInputFloat}
|
|
72
|
+
alt="Flaot Icon"
|
|
73
|
+
width={24}
|
|
74
|
+
height={24}
|
|
75
|
+
/>
|
|
76
|
+
<input
|
|
77
|
+
id={this.props.id}
|
|
78
|
+
value={this.state.value}
|
|
79
|
+
onChange={this.onChanged}
|
|
80
|
+
type="number"
|
|
81
|
+
className={Styles.ns_input}
|
|
82
|
+
placeholder={this.props.placeholder}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
86
|
+
</>
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import Styles from "./
|
|
5
|
-
import
|
|
4
|
+
import Styles from "./NSInput.module.css";
|
|
5
|
+
import IconInputIP from '../assets/images/icon-input-ip.svg';
|
|
6
6
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
7
|
+
import { ValidationProps } from "../props/ValidationProps";
|
|
8
|
+
import { ValidationStringProps } from "../props/ValidationStringProps";
|
|
9
|
+
import { Validator } from "../Validator";
|
|
10
|
+
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
7
11
|
|
|
8
|
-
export interface NSInputIPProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputIPProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
defaultValue?: string;
|
|
@@ -16,6 +20,7 @@ export interface NSInputIPProps extends BaseComponentProps
|
|
|
16
20
|
export interface NSInputIPState
|
|
17
21
|
{
|
|
18
22
|
value: string;
|
|
23
|
+
error?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export class NSInputIP extends React.Component<NSInputIPProps, NSInputIPState>
|
|
@@ -23,15 +28,27 @@ export class NSInputIP extends React.Component<NSInputIPProps, NSInputIPState>
|
|
|
23
28
|
constructor(props: NSInputIPProps)
|
|
24
29
|
{
|
|
25
30
|
super(props);
|
|
26
|
-
this.state = {
|
|
27
|
-
value: props.defaultValue ?? "",
|
|
28
|
-
};
|
|
31
|
+
this.state = { value: props.defaultValue ?? "" };
|
|
29
32
|
this.getValue = this.getValue.bind(this);
|
|
30
33
|
this.setValue = this.setValue.bind(this);
|
|
31
34
|
this.onChanged = this.onChanged.bind(this);
|
|
32
35
|
}
|
|
36
|
+
getError(): string | null
|
|
37
|
+
{
|
|
38
|
+
return (
|
|
39
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
40
|
+
Validator.getErrorString(this.props.title, this.state.value, this.props) &&
|
|
41
|
+
Validator.getErrorIP(this.props.title, this.state.value)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
33
44
|
getValue(): string
|
|
34
45
|
{
|
|
46
|
+
let error = this.getError();
|
|
47
|
+
if (error)
|
|
48
|
+
{
|
|
49
|
+
this.setState({ error });
|
|
50
|
+
throw new Error(error);
|
|
51
|
+
}
|
|
35
52
|
return this.state.value;
|
|
36
53
|
}
|
|
37
54
|
setValue(value: string): void
|
|
@@ -47,24 +64,27 @@ export class NSInputIP extends React.Component<NSInputIPProps, NSInputIPState>
|
|
|
47
64
|
override render()
|
|
48
65
|
{
|
|
49
66
|
return (
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
<>
|
|
68
|
+
<div className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
69
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
70
|
+
<img
|
|
71
|
+
className={Styles.ns_input_icon}
|
|
72
|
+
src={IconInputIP}
|
|
73
|
+
alt="IP Icon"
|
|
74
|
+
width={24}
|
|
75
|
+
height={24}
|
|
76
|
+
/>
|
|
77
|
+
<input
|
|
78
|
+
id={this.props.id}
|
|
79
|
+
value={this.state.value}
|
|
80
|
+
onChange={this.onChanged}
|
|
81
|
+
type="text"
|
|
82
|
+
className={Styles.ns_input}
|
|
83
|
+
placeholder={this.props.placeholder}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
87
|
+
</>
|
|
68
88
|
);
|
|
69
89
|
}
|
|
70
90
|
}
|