namirasoft-site-react 1.3.60 → 1.3.62
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.d.ts +0 -9
- package/dist/components/NSButton.js +2 -9
- package/dist/components/NSButton.js.map +1 -1
- package/dist/components/NSButton.module.css +8 -7
- package/dist/components/NSButtonBlue.d.ts +2 -14
- package/dist/components/NSButtonBlue.js +7 -13
- package/dist/components/NSButtonBlue.js.map +1 -1
- package/dist/components/NSButtonBlue.module.css +0 -8
- package/dist/components/NSButtonGreen.d.ts +2 -14
- package/dist/components/NSButtonGreen.js +7 -13
- package/dist/components/NSButtonGreen.js.map +1 -1
- package/dist/components/NSButtonGreen.module.css +0 -8
- package/dist/components/NSButtonRed.d.ts +2 -14
- package/dist/components/NSButtonRed.js +8 -14
- package/dist/components/NSButtonRed.js.map +1 -1
- package/dist/components/NSButtonRed.module.css +0 -8
- package/dist/components/NSCard.d.ts +3 -9
- package/dist/components/NSCard.js +12 -16
- package/dist/components/NSCard.js.map +1 -1
- package/dist/components/NSCopyToClipboard.d.ts +1 -8
- package/dist/components/NSCopyToClipboard.js +6 -14
- package/dist/components/NSCopyToClipboard.js.map +1 -1
- package/dist/components/NSCopyToClipboard.module.css +1 -1
- package/dist/components/NSEntityBar.d.ts +3 -9
- package/dist/components/NSEntityBar.js +3 -6
- package/dist/components/NSEntityBar.js.map +1 -1
- package/dist/components/NSEntityBar.module.css +1 -1
- package/dist/components/NSEntityCardBackground.d.ts +1 -11
- package/dist/components/NSEntityCardBackground.js +4 -23
- package/dist/components/NSEntityCardBackground.js.map +1 -1
- package/dist/components/NSFooter.js +2 -1
- package/dist/components/NSFooter.js.map +1 -1
- package/dist/components/NSHeader.d.ts +1 -2
- package/dist/components/NSHeader.js +9 -4
- 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 +4 -1
- 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/NSLayout.js +2 -2
- package/dist/components/NSLayout.js.map +1 -1
- package/dist/components/NSLayoutHeroBanner.js.map +1 -1
- package/dist/components/NSLinkBlue.d.ts +1 -9
- package/dist/components/NSLinkBlue.js +3 -17
- package/dist/components/NSLinkBlue.js.map +1 -1
- package/dist/components/NSLoading.d.ts +1 -6
- package/dist/components/NSLoading.js +2 -6
- package/dist/components/NSLoading.js.map +1 -1
- package/dist/components/NSNotification.js +2 -2
- package/dist/components/NSNotification.js.map +1 -1
- package/dist/components/NSPagination.d.ts +1 -1
- package/dist/components/NSPagination.js +2 -1
- package/dist/components/NSPagination.js.map +1 -1
- package/dist/components/NSPanel.d.ts +2 -7
- package/dist/components/NSPanel.js +3 -9
- package/dist/components/NSPanel.js.map +1 -1
- package/dist/components/NSSection.d.ts +2 -10
- package/dist/components/NSSection.js +6 -25
- package/dist/components/NSSection.js.map +1 -1
- package/dist/components/NSSectionBars.d.ts +2 -6
- package/dist/components/NSSectionBars.js +4 -8
- package/dist/components/NSSectionBars.js.map +1 -1
- package/dist/components/NSSectionCards.d.ts +4 -14
- package/dist/components/NSSectionCards.js +7 -11
- package/dist/components/NSSectionCards.js.map +1 -1
- package/dist/components/NSSectionTitle.d.ts +3 -10
- package/dist/components/NSSectionTitle.js +2 -6
- 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/NSSpace.js +2 -1
- package/dist/components/NSSpace.js.map +1 -1
- package/dist/components/NSTable.js +2 -1
- package/dist/components/NSTable.js.map +1 -1
- package/dist/components/NSTitle.d.ts +1 -6
- package/dist/components/NSTitle.js +3 -6
- package/dist/components/NSTitle.js.map +1 -1
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -1
- package/dist/main.js.map +1 -1
- package/dist/pages/NSLoginPage.d.ts +2 -3
- package/dist/pages/NSLoginPage.js +4 -3
- package/dist/pages/NSLoginPage.js.map +1 -1
- package/dist/props/BaseComponentProps.d.ts +1 -0
- 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 +3 -4
- package/src/App.tsx +14 -4
- package/src/Validator.ts +67 -18
- package/src/components/NSButton.module.css +8 -7
- package/src/components/NSButton.tsx +6 -24
- package/src/components/NSButtonBlue.module.css +0 -8
- package/src/components/NSButtonBlue.tsx +8 -28
- package/src/components/NSButtonGreen.module.css +0 -8
- package/src/components/NSButtonGreen.tsx +8 -29
- package/src/components/NSButtonRed.module.css +0 -8
- package/src/components/NSButtonRed.tsx +9 -30
- package/src/components/NSCard.tsx +49 -56
- package/src/components/NSCopyToClipboard.module.css +1 -1
- package/src/components/NSCopyToClipboard.tsx +21 -35
- package/src/components/NSEntityBar.module.css +1 -1
- package/src/components/NSEntityBar.tsx +17 -23
- package/src/components/NSEntityCardBackground.tsx +22 -56
- package/src/components/NSFooter.tsx +4 -1
- package/src/components/NSHeader.tsx +16 -7
- package/src/components/NSInput.module.css +29 -0
- package/src/components/NSInputDate.module.css +4 -1
- package/src/components/NSInputDate.tsx +29 -10
- 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/NSLayout.tsx +3 -3
- package/src/components/NSLayoutHeroBanner.tsx +0 -1
- package/src/components/NSLinkBlue.tsx +12 -32
- package/src/components/NSLoading.tsx +8 -17
- package/src/components/NSNotification.tsx +19 -14
- package/src/components/NSPagination.tsx +4 -3
- package/src/components/NSPanel.tsx +10 -21
- package/src/components/NSSection.tsx +13 -39
- package/src/components/NSSectionBars.tsx +13 -22
- package/src/components/NSSectionCards.tsx +30 -45
- package/src/components/NSSectionTitle.tsx +10 -20
- package/src/components/NSSelectBox.tsx +48 -23
- package/src/components/NSSpace.tsx +3 -1
- package/src/components/NSTable.tsx +6 -4
- package/src/components/NSTitle.tsx +10 -15
- package/src/main.ts +0 -1
- package/src/pages/NSLoginPage.tsx +8 -6
- package/src/props/BaseComponentProps.ts +1 -0
- package/src/props/ValidationNumberProps.ts +1 -3
- package/src/props/ValidationProps.ts +1 -0
- package/src/props/ValidationStringProps.ts +1 -3
- package/dist/components/NSButtonBlueVector.d.ts +0 -16
- package/dist/components/NSButtonBlueVector.js +0 -17
- package/dist/components/NSButtonBlueVector.js.map +0 -1
- package/dist/components/NSButtonBlueVector.module.css +0 -17
- 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/props/BackgroundProps.d.ts +0 -6
- package/dist/props/BackgroundProps.js +0 -2
- package/dist/props/BackgroundProps.js.map +0 -1
- package/dist/props/NSButtonProps.d.ts +0 -11
- package/dist/props/NSButtonProps.js +0 -2
- package/dist/props/NSButtonProps.js.map +0 -1
- package/src/components/NSButtonBlueVector.module.css +0 -17
- package/src/components/NSButtonBlueVector.tsx +0 -42
- 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/props/BackgroundProps.ts +0 -7
- package/src/props/NSButtonProps.ts +0 -12
|
@@ -1,21 +1,28 @@
|
|
|
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 IconInputPhone from '../assets/images/icon-input-phone.svg';
|
|
6
6
|
import PhoneInput from 'react-phone-input-2'
|
|
7
7
|
import 'react-phone-input-2/lib/style.css'
|
|
8
8
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
9
|
+
import { ValidationProps } from "../props/ValidationProps";
|
|
10
|
+
import { ValidationStringProps } from "../props/ValidationStringProps";
|
|
11
|
+
import { Validator } from "../Validator";
|
|
12
|
+
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
9
13
|
|
|
10
|
-
export interface NSInputPhoneProps extends BaseComponentProps
|
|
14
|
+
export interface NSInputPhoneProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
11
15
|
{
|
|
12
16
|
title: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
13
19
|
placeholder?: string;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
export interface NSInputPhoneState
|
|
17
23
|
{
|
|
18
24
|
value: string;
|
|
25
|
+
error?: string;
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
export class NSInputPhone extends React.Component<NSInputPhoneProps, NSInputPhoneState>
|
|
@@ -23,45 +30,54 @@ export class NSInputPhone extends React.Component<NSInputPhoneProps, NSInputPhon
|
|
|
23
30
|
constructor(props: NSInputPhoneProps)
|
|
24
31
|
{
|
|
25
32
|
super(props);
|
|
26
|
-
this.state = {
|
|
27
|
-
value: "",
|
|
28
|
-
};
|
|
33
|
+
this.state = { value: props.defaultValue ?? "" };
|
|
29
34
|
this.setValue = this.setValue.bind(this);
|
|
30
35
|
this.getValue = this.getValue.bind(this);
|
|
31
|
-
this.setDefaultValue = this.setDefaultValue.bind(this);
|
|
32
36
|
}
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
this.setState({ value });
|
|
36
|
-
}
|
|
37
|
-
setDefaultValue(value: string): void
|
|
37
|
+
getError(): string | null
|
|
38
38
|
{
|
|
39
|
-
|
|
39
|
+
return (
|
|
40
|
+
Validator.getError(this.props.title, this.state.value, this.props) &&
|
|
41
|
+
Validator.getErrorString(this.props.title, this.state.value, this.props)
|
|
42
|
+
);
|
|
40
43
|
}
|
|
41
44
|
getValue(): string
|
|
42
45
|
{
|
|
46
|
+
let error = this.getError();
|
|
47
|
+
if (error)
|
|
48
|
+
{
|
|
49
|
+
this.setState({ error });
|
|
50
|
+
throw new Error(error);
|
|
51
|
+
}
|
|
43
52
|
return this.state.value;
|
|
44
53
|
}
|
|
54
|
+
setValue(value: string): void
|
|
55
|
+
{
|
|
56
|
+
this.setState({ value });
|
|
57
|
+
}
|
|
45
58
|
override render()
|
|
46
59
|
{
|
|
47
60
|
return (
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
<>
|
|
62
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} p-2 ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
63
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
64
|
+
<img
|
|
65
|
+
className={Styles.ns_input_icon}
|
|
66
|
+
src={IconInputPhone}
|
|
67
|
+
alt="Phone Icon"
|
|
68
|
+
width={24}
|
|
69
|
+
height={24}
|
|
70
|
+
/>
|
|
71
|
+
<PhoneInput
|
|
72
|
+
value={this.state.value}
|
|
73
|
+
onChange={this.setValue}
|
|
74
|
+
country={'us'}
|
|
75
|
+
inputClass={Styles.ns_input}
|
|
76
|
+
placeholder={this.props.placeholder}
|
|
77
|
+
/>
|
|
78
|
+
</div >
|
|
79
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
80
|
+
</>
|
|
65
81
|
);
|
|
66
82
|
}
|
|
67
83
|
}
|
|
@@ -1,20 +1,26 @@
|
|
|
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 IconInputPrice from '../assets/images/icon-input-price.svg';
|
|
6
6
|
import { BaseComponentProps } from "../props/BaseComponentProps";
|
|
7
|
+
import { ValidationProps } from "../props/ValidationProps";
|
|
8
|
+
import { ValidationNumberProps } from "../props/ValidationNumberProps";
|
|
9
|
+
import { Validator } from "../Validator";
|
|
10
|
+
import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
|
|
7
11
|
|
|
8
|
-
export interface NSInputPriceProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputPriceProps extends BaseComponentProps, ValidationProps, ValidationNumberProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
defaultValue?: number;
|
|
12
16
|
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
placeholder?: string;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
export interface NSInputPriceState
|
|
16
21
|
{
|
|
17
|
-
value
|
|
22
|
+
value?: number;
|
|
23
|
+
error?: string;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
export class NSInputPrice extends React.Component<NSInputPriceProps, NSInputPriceState>
|
|
@@ -22,15 +28,26 @@ export class NSInputPrice extends React.Component<NSInputPriceProps, NSInputPric
|
|
|
22
28
|
constructor(props: NSInputPriceProps)
|
|
23
29
|
{
|
|
24
30
|
super(props);
|
|
25
|
-
this.state = {
|
|
26
|
-
value: props.defaultValue ?? undefined,
|
|
27
|
-
};
|
|
31
|
+
this.state = { value: props.defaultValue };
|
|
28
32
|
this.getValue = this.getValue.bind(this);
|
|
29
33
|
this.setValue = this.setValue.bind(this);
|
|
30
34
|
this.onChanged = this.onChanged.bind(this);
|
|
31
35
|
}
|
|
36
|
+
getError(): string | null
|
|
37
|
+
{
|
|
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
|
+
);
|
|
42
|
+
}
|
|
32
43
|
getValue(): number | undefined
|
|
33
44
|
{
|
|
45
|
+
let error = this.getError();
|
|
46
|
+
if (error)
|
|
47
|
+
{
|
|
48
|
+
this.setState({ error });
|
|
49
|
+
throw new Error(error);
|
|
50
|
+
}
|
|
34
51
|
return this.state.value;
|
|
35
52
|
}
|
|
36
53
|
setValue(value: number): void
|
|
@@ -46,23 +63,28 @@ export class NSInputPrice extends React.Component<NSInputPriceProps, NSInputPric
|
|
|
46
63
|
override render()
|
|
47
64
|
{
|
|
48
65
|
return (
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
className={Styles.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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={IconInputPrice}
|
|
72
|
+
alt="Price 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
|
+
step="20"
|
|
82
|
+
className={Styles.ns_input}
|
|
83
|
+
placeholder={this.props.placeholder}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
87
|
+
</>
|
|
66
88
|
);
|
|
67
89
|
}
|
|
68
90
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
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 IconInputSearch from '../assets/images/icon-input-search.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 NSInputSearchProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputSearchProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
9
13
|
{
|
|
14
|
+
title: string;
|
|
10
15
|
defaultValue?: string;
|
|
11
16
|
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
17
|
placeholder?: string;
|
|
@@ -15,6 +20,7 @@ export interface NSInputSearchProps extends BaseComponentProps
|
|
|
15
20
|
export interface NSInputSearchState
|
|
16
21
|
{
|
|
17
22
|
value: string;
|
|
23
|
+
error?: string;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSearchState>
|
|
@@ -22,15 +28,26 @@ export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSe
|
|
|
22
28
|
constructor(props: NSInputSearchProps)
|
|
23
29
|
{
|
|
24
30
|
super(props);
|
|
25
|
-
this.state = {
|
|
26
|
-
value: props.defaultValue ?? "",
|
|
27
|
-
};
|
|
31
|
+
this.state = { value: props.defaultValue ?? "" };
|
|
28
32
|
this.getValue = this.getValue.bind(this);
|
|
29
33
|
this.setValue = this.setValue.bind(this);
|
|
30
34
|
this.onChanged = this.onChanged.bind(this);
|
|
31
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
|
+
);
|
|
42
|
+
}
|
|
32
43
|
getValue(): string
|
|
33
44
|
{
|
|
45
|
+
let error = this.getError();
|
|
46
|
+
if (error)
|
|
47
|
+
{
|
|
48
|
+
this.setState({ error });
|
|
49
|
+
throw new Error(error);
|
|
50
|
+
}
|
|
34
51
|
return this.state.value;
|
|
35
52
|
}
|
|
36
53
|
setValue(value: string): void
|
|
@@ -46,22 +63,27 @@ export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSe
|
|
|
46
63
|
override render()
|
|
47
64
|
{
|
|
48
65
|
return (
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
className={Styles.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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={IconInputSearch}
|
|
72
|
+
alt="Search 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="text"
|
|
81
|
+
className={Styles.ns_input}
|
|
82
|
+
placeholder={this.props.placeholder}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
86
|
+
</>
|
|
65
87
|
);
|
|
66
88
|
}
|
|
67
89
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
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 IconInputString from '../assets/images/icon-input-string.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 NSInputStringProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputStringProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
defaultValue?: string;
|
|
@@ -16,6 +20,7 @@ export interface NSInputStringProps extends BaseComponentProps
|
|
|
16
20
|
export interface NSInputStringState
|
|
17
21
|
{
|
|
18
22
|
value: string;
|
|
23
|
+
error?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export class NSInputString extends React.Component<NSInputStringProps, NSInputStringState>
|
|
@@ -23,15 +28,26 @@ export class NSInputString extends React.Component<NSInputStringProps, NSInputSt
|
|
|
23
28
|
constructor(props: NSInputStringProps)
|
|
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
|
+
);
|
|
42
|
+
}
|
|
33
43
|
getValue(): string
|
|
34
44
|
{
|
|
45
|
+
let error = this.getError();
|
|
46
|
+
if (error)
|
|
47
|
+
{
|
|
48
|
+
this.setState({ error });
|
|
49
|
+
throw new Error(error);
|
|
50
|
+
}
|
|
35
51
|
return this.state.value;
|
|
36
52
|
}
|
|
37
53
|
setValue(value: string): void
|
|
@@ -47,24 +63,27 @@ export class NSInputString extends React.Component<NSInputStringProps, NSInputSt
|
|
|
47
63
|
override render()
|
|
48
64
|
{
|
|
49
65
|
return (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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={IconInputString}
|
|
72
|
+
alt="String 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="text"
|
|
81
|
+
className={Styles.ns_input}
|
|
82
|
+
placeholder={this.props.placeholder}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
86
|
+
</>
|
|
68
87
|
);
|
|
69
88
|
}
|
|
70
89
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
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 IconInputText from '../assets/images/icon-input-text.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 NSInputTextProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputTextProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
defaultValue?: string;
|
|
@@ -16,6 +20,7 @@ export interface NSInputTextProps extends BaseComponentProps
|
|
|
16
20
|
export interface NSInputTextState
|
|
17
21
|
{
|
|
18
22
|
value: string;
|
|
23
|
+
error?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export class NSInputText extends React.Component<NSInputTextProps, NSInputTextState>
|
|
@@ -23,15 +28,26 @@ export class NSInputText extends React.Component<NSInputTextProps, NSInputTextSt
|
|
|
23
28
|
constructor(props: NSInputTextProps)
|
|
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
|
+
);
|
|
42
|
+
}
|
|
33
43
|
getValue(): string
|
|
34
44
|
{
|
|
45
|
+
let error = this.getError();
|
|
46
|
+
if (error)
|
|
47
|
+
{
|
|
48
|
+
this.setState({ error });
|
|
49
|
+
throw new Error(error);
|
|
50
|
+
}
|
|
35
51
|
return this.state.value;
|
|
36
52
|
}
|
|
37
53
|
setValue(value: string): void
|
|
@@ -47,24 +63,27 @@ export class NSInputText extends React.Component<NSInputTextProps, NSInputTextSt
|
|
|
47
63
|
override render()
|
|
48
64
|
{
|
|
49
65
|
return (
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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={IconInputText}
|
|
72
|
+
alt="Text 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="text"
|
|
81
|
+
className={Styles.ns_input}
|
|
82
|
+
placeholder={this.props.placeholder}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<NSInputErrorNotifier error={this.state.error} />
|
|
86
|
+
</>
|
|
68
87
|
);
|
|
69
88
|
}
|
|
70
89
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
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 IconInputTime from '../assets/images/icon-input-time.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 NSInputTimeProps extends BaseComponentProps
|
|
12
|
+
export interface NSInputTimeProps extends BaseComponentProps, ValidationProps, ValidationStringProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
defaultValue?: string;
|
|
@@ -16,6 +20,7 @@ export interface NSInputTimeProps extends BaseComponentProps
|
|
|
16
20
|
export interface NSInputTimeState
|
|
17
21
|
{
|
|
18
22
|
value: string;
|
|
23
|
+
error?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export class NSInputTime extends React.Component<NSInputTimeProps, NSInputTimeState>
|
|
@@ -23,15 +28,27 @@ export class NSInputTime extends React.Component<NSInputTimeProps, NSInputTimeSt
|
|
|
23
28
|
constructor(props: NSInputTimeProps)
|
|
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.getErrorTime(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 NSInputTime extends React.Component<NSInputTimeProps, NSInputTimeSt
|
|
|
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={IconInputTime}
|
|
73
|
+
alt="Time 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,5 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import Styles from './NSLayout.module.css';
|
|
4
2
|
import { ReactNode } from 'react';
|
|
5
3
|
import { NSHeader } from './NSHeader';
|
|
@@ -19,7 +17,9 @@ export interface NSLayoutProps extends BaseComponentProps
|
|
|
19
17
|
export function NSLayout(props: NSLayoutProps)
|
|
20
18
|
{
|
|
21
19
|
return (
|
|
22
|
-
<div
|
|
20
|
+
<div id={props.id}
|
|
21
|
+
className={`${Styles.ns_container} ${props.classList?.join(" ")}`}
|
|
22
|
+
style={props.style}>
|
|
23
23
|
<NSHeader scope={props.scope} name="Header" logo={props.logo} />
|
|
24
24
|
{props.notifications.map(props => <NSNotification {...props}></NSNotification>)}
|
|
25
25
|
<main className="d-flex flex-column text-white" style={{ background: props.background }}>
|
|
@@ -20,7 +20,6 @@ export function NSLayoutHeroBanner(props: NSLayoutHeroBannerProps)
|
|
|
20
20
|
return (
|
|
21
21
|
<NSLayout {...props} >
|
|
22
22
|
<div className={Styles.hero_holder}>
|
|
23
|
-
{/* <NSHeader name='Header' scope='Namira Software Corporation' logo='https://static.namirasoft.com/logo/namirasoft/base.png' /> */}
|
|
24
23
|
<section className={Styles.hero_wraper}>
|
|
25
24
|
<div className="container mx-auto px-4 lg:px-12">
|
|
26
25
|
<div className="flex flex-wrap lg:flex-nowrap justify-center lg:justify-between">
|