namirasoft-site-react 1.3.113 → 1.3.115

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.
Files changed (122) hide show
  1. package/dist/App.js +4 -3
  2. package/dist/App.js.map +1 -1
  3. package/dist/components/{NSInputDate.d.ts → NSBoxDate.d.ts} +4 -4
  4. package/dist/components/{NSInputDate.js → NSBoxDate.js} +5 -5
  5. package/dist/components/NSBoxDate.js.map +1 -0
  6. package/dist/components/NSBoxDateTime.d.ts +21 -0
  7. package/dist/components/NSBoxDateTime.js +41 -0
  8. package/dist/components/NSBoxDateTime.js.map +1 -0
  9. package/dist/components/{NSInputInteger.d.ts → NSBoxDouble.d.ts} +5 -5
  10. package/dist/components/{NSInputPrice.js → NSBoxDouble.js} +8 -8
  11. package/dist/components/NSBoxDouble.js.map +1 -0
  12. package/dist/components/{NSInputDuration.d.ts → NSBoxDuration.d.ts} +4 -4
  13. package/dist/components/{NSInputDuration.js → NSBoxDuration.js} +5 -5
  14. package/dist/components/NSBoxDuration.js.map +1 -0
  15. package/dist/components/{NSInputTime.d.ts → NSBoxEmail.d.ts} +5 -5
  16. package/dist/components/{NSInputEmail.js → NSBoxEmail.js} +5 -5
  17. package/dist/components/NSBoxEmail.js.map +1 -0
  18. package/dist/components/NSBoxEntity.d.ts +12 -0
  19. package/dist/components/NSBoxEntity.js +10 -0
  20. package/dist/components/NSBoxEntity.js.map +1 -0
  21. package/dist/components/NSBoxEnum.d.ts +7 -0
  22. package/dist/components/NSBoxEnum.js +38 -0
  23. package/dist/components/NSBoxEnum.js.map +1 -0
  24. package/dist/components/NSBoxErrorNotifier.d.ts +5 -0
  25. package/dist/components/{NSInputErrorNotifier.js → NSBoxErrorNotifier.js} +3 -3
  26. package/dist/components/NSBoxErrorNotifier.js.map +1 -0
  27. package/dist/components/{NSInputIP.d.ts → NSBoxIPV4.d.ts} +4 -4
  28. package/dist/components/{NSInputIP.js → NSBoxIPV4.js} +6 -5
  29. package/dist/components/NSBoxIPV4.js.map +1 -0
  30. package/dist/components/{NSInputEmail.d.ts → NSBoxIPV6.d.ts} +5 -5
  31. package/dist/components/NSBoxIPV6.js +44 -0
  32. package/dist/components/NSBoxIPV6.js.map +1 -0
  33. package/dist/components/{NSInputFloat.d.ts → NSBoxInteger.d.ts} +5 -5
  34. package/dist/components/{NSInputInteger.js → NSBoxInteger.js} +5 -5
  35. package/dist/components/NSBoxInteger.js.map +1 -0
  36. package/dist/components/{NSInputString.d.ts → NSBoxPassword.d.ts} +4 -4
  37. package/dist/components/{NSInputPassword.js → NSBoxPassword.js} +5 -5
  38. package/dist/components/NSBoxPassword.js.map +1 -0
  39. package/dist/components/{NSInputPhone.d.ts → NSBoxPhone.d.ts} +4 -4
  40. package/dist/components/{NSInputPhone.js → NSBoxPhone.js} +5 -5
  41. package/dist/components/NSBoxPhone.js.map +1 -0
  42. package/dist/components/{NSInputPrice.d.ts → NSBoxPrice.d.ts} +5 -5
  43. package/dist/components/{NSInputFloat.js → NSBoxPrice.js} +5 -5
  44. package/dist/components/NSBoxPrice.js.map +1 -0
  45. package/dist/components/{NSInputSearch.d.ts → NSBoxSearch.d.ts} +4 -4
  46. package/dist/components/{NSInputSearch.js → NSBoxSearch.js} +5 -5
  47. package/dist/components/NSBoxSearch.js.map +1 -0
  48. package/dist/components/{NSInputText.d.ts → NSBoxString.d.ts} +4 -4
  49. package/dist/components/{NSInputString.js → NSBoxString.js} +5 -5
  50. package/dist/components/NSBoxString.js.map +1 -0
  51. package/dist/components/NSBoxText.d.ts +22 -0
  52. package/dist/components/{NSInputText.js → NSBoxText.js} +5 -5
  53. package/dist/components/NSBoxText.js.map +1 -0
  54. package/dist/components/NSBoxTime.d.ts +22 -0
  55. package/dist/components/{NSInputTime.js → NSBoxTime.js} +5 -5
  56. package/dist/components/NSBoxTime.js.map +1 -0
  57. package/dist/components/NSSelectBox.d.ts +1 -0
  58. package/dist/components/NSSelectBox.js +3 -2
  59. package/dist/components/NSSelectBox.js.map +1 -1
  60. package/dist/components/NSTable.js +2 -2
  61. package/dist/components/NSTable.js.map +1 -1
  62. package/dist/main.d.ts +15 -14
  63. package/dist/main.js +15 -14
  64. package/dist/main.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/App.tsx +12 -1
  67. package/src/components/NSBoxDate.tsx +81 -0
  68. package/src/components/NSBoxDateTime.tsx +81 -0
  69. package/src/components/NSBoxDouble.tsx +92 -0
  70. package/src/components/NSBoxDuration.tsx +91 -0
  71. package/src/components/NSBoxEmail.tsx +90 -0
  72. package/src/components/NSBoxEntity.tsx +29 -0
  73. package/src/components/NSBoxEnum.tsx +54 -0
  74. package/src/components/NSBoxErrorNotifier.tsx +28 -0
  75. package/src/components/NSBoxIPV4.tsx +96 -0
  76. package/src/components/NSBoxIPV6.tsx +93 -0
  77. package/src/components/NSBoxInteger.tsx +89 -0
  78. package/src/components/NSBoxPassword.tsx +89 -0
  79. package/src/components/NSBoxPhone.tsx +83 -0
  80. package/src/components/NSBoxPrice.tsx +91 -0
  81. package/src/components/{NSInputSearch.tsx → NSBoxSearch.tsx} +9 -9
  82. package/src/components/NSBoxString.tsx +89 -0
  83. package/src/components/NSBoxText.tsx +89 -0
  84. package/src/components/NSBoxTime.tsx +91 -0
  85. package/src/components/NSSelectBox.tsx +94 -93
  86. package/src/components/NSTable.tsx +130 -130
  87. package/src/main.ts +15 -14
  88. package/dist/components/NSInputDate.js.map +0 -1
  89. package/dist/components/NSInputDuration.js.map +0 -1
  90. package/dist/components/NSInputEmail.js.map +0 -1
  91. package/dist/components/NSInputErrorNotifier.d.ts +0 -5
  92. package/dist/components/NSInputErrorNotifier.js.map +0 -1
  93. package/dist/components/NSInputFloat.js.map +0 -1
  94. package/dist/components/NSInputIP.js.map +0 -1
  95. package/dist/components/NSInputInteger.js.map +0 -1
  96. package/dist/components/NSInputPassword.d.ts +0 -22
  97. package/dist/components/NSInputPassword.js.map +0 -1
  98. package/dist/components/NSInputPhone.js.map +0 -1
  99. package/dist/components/NSInputPrice.js.map +0 -1
  100. package/dist/components/NSInputSearch.js.map +0 -1
  101. package/dist/components/NSInputString.js.map +0 -1
  102. package/dist/components/NSInputText.js.map +0 -1
  103. package/dist/components/NSInputTime.js.map +0 -1
  104. package/src/components/NSInputDate.tsx +0 -81
  105. package/src/components/NSInputDuration.tsx +0 -91
  106. package/src/components/NSInputEmail.tsx +0 -90
  107. package/src/components/NSInputErrorNotifier.tsx +0 -28
  108. package/src/components/NSInputFloat.tsx +0 -89
  109. package/src/components/NSInputIP.tsx +0 -90
  110. package/src/components/NSInputInteger.tsx +0 -89
  111. package/src/components/NSInputPassword.tsx +0 -89
  112. package/src/components/NSInputPhone.tsx +0 -83
  113. package/src/components/NSInputPrice.tsx +0 -90
  114. package/src/components/NSInputString.tsx +0 -89
  115. package/src/components/NSInputText.tsx +0 -89
  116. package/src/components/NSInputTime.tsx +0 -91
  117. /package/dist/components/{NSInput.module.css → NSBox.module.css} +0 -0
  118. /package/dist/components/{NSInputDate.module.css → NSBoxDate.module.css} +0 -0
  119. /package/dist/components/{NSInputErrorNotifier.module.css → NSBoxErrorNotifier.module.css} +0 -0
  120. /package/src/components/{NSInput.module.css → NSBox.module.css} +0 -0
  121. /package/src/components/{NSInputDate.module.css → NSBoxDate.module.css} +0 -0
  122. /package/src/components/{NSInputErrorNotifier.module.css → NSBoxErrorNotifier.module.css} +0 -0
package/dist/main.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ export * from "./components/NSBoxDate";
2
+ export * from "./components/NSBoxDouble";
3
+ export * from "./components/NSBoxDuration";
4
+ export * from "./components/NSBoxEmail";
5
+ export * from "./components/NSBoxErrorNotifier";
6
+ export * from "./components/NSBoxInteger";
7
+ export * from "./components/NSBoxIPV4";
8
+ export * from "./components/NSBoxIPV6";
9
+ export * from "./components/NSBoxPassword";
10
+ export * from "./components/NSBoxPhone";
11
+ export * from "./components/NSBoxPrice";
12
+ export * from "./components/NSBoxString";
1
13
  export * from "./components/NSButtonBlue";
2
14
  export * from "./components/NSButtonGreen";
3
15
  export * from "./components/NSButton";
@@ -5,23 +17,12 @@ export * from "./components/NSButtonRed";
5
17
  export * from "./components/NSCard";
6
18
  export * from "./components/NSEntityCardBackground";
7
19
  export * from "./components/NSEntityBar";
8
- export * from "./components/NSInputErrorNotifier";
9
20
  export * from "./components/NSFooter";
10
21
  export * from "./components/NSHeader";
11
22
  export * from "./components/NSCopyToClipboard";
12
- export * from "./components/NSInputDate";
13
- export * from "./components/NSInputDuration";
14
- export * from "./components/NSInputEmail";
15
- export * from "./components/NSInputFloat";
16
- export * from "./components/NSInputIP";
17
- export * from "./components/NSInputPassword";
18
- export * from "./components/NSInputInteger";
19
- export * from "./components/NSInputPhone";
20
- export * from "./components/NSInputPrice";
21
- export * from "./components/NSInputSearch";
22
- export * from "./components/NSInputString";
23
- export * from "./components/NSInputText";
24
- export * from "./components/NSInputTime";
23
+ export * from "./components/NSBoxSearch";
24
+ export * from "./components/NSBoxText";
25
+ export * from "./components/NSBoxTime";
25
26
  export * from "./components/NSLayout";
26
27
  export * from "./components/NSLayoutAction";
27
28
  export * from "./components/NSLayoutHeroBanner";
package/dist/main.js CHANGED
@@ -1,3 +1,15 @@
1
+ export * from "./components/NSBoxDate";
2
+ export * from "./components/NSBoxDouble";
3
+ export * from "./components/NSBoxDuration";
4
+ export * from "./components/NSBoxEmail";
5
+ export * from "./components/NSBoxErrorNotifier";
6
+ export * from "./components/NSBoxInteger";
7
+ export * from "./components/NSBoxIPV4";
8
+ export * from "./components/NSBoxIPV6";
9
+ export * from "./components/NSBoxPassword";
10
+ export * from "./components/NSBoxPhone";
11
+ export * from "./components/NSBoxPrice";
12
+ export * from "./components/NSBoxString";
1
13
  export * from "./components/NSButtonBlue";
2
14
  export * from "./components/NSButtonGreen";
3
15
  export * from "./components/NSButton";
@@ -5,23 +17,12 @@ export * from "./components/NSButtonRed";
5
17
  export * from "./components/NSCard";
6
18
  export * from "./components/NSEntityCardBackground";
7
19
  export * from "./components/NSEntityBar";
8
- export * from "./components/NSInputErrorNotifier";
9
20
  export * from "./components/NSFooter";
10
21
  export * from "./components/NSHeader";
11
22
  export * from "./components/NSCopyToClipboard";
12
- export * from "./components/NSInputDate";
13
- export * from "./components/NSInputDuration";
14
- export * from "./components/NSInputEmail";
15
- export * from "./components/NSInputFloat";
16
- export * from "./components/NSInputIP";
17
- export * from "./components/NSInputPassword";
18
- export * from "./components/NSInputInteger";
19
- export * from "./components/NSInputPhone";
20
- export * from "./components/NSInputPrice";
21
- export * from "./components/NSInputSearch";
22
- export * from "./components/NSInputString";
23
- export * from "./components/NSInputText";
24
- export * from "./components/NSInputTime";
23
+ export * from "./components/NSBoxSearch";
24
+ export * from "./components/NSBoxText";
25
+ export * from "./components/NSBoxTime";
25
26
  export * from "./components/NSLayout";
26
27
  export * from "./components/NSLayoutAction";
27
28
  export * from "./components/NSLayoutHeroBanner";
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;A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gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.3.113",
11
+ "version": "1.3.115",
12
12
  "author": "Amir Abolhasani, Alireza Esmaeeli, Sepideh Mazloumi, Hooman Shashaeh",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
package/src/App.tsx CHANGED
@@ -1,8 +1,9 @@
1
1
  import './App.css';
2
2
  import 'bootstrap/dist/css/bootstrap.min.css';
3
- import { NSTable } from './main';
3
+ import { NSBoxIPV4, NSTable } from './main';
4
4
  import { useRef } from 'react';
5
5
  import { NSLayoutAction } from './components/NSLayoutAction';
6
+ import { NSBoxIPV6 } from './components/NSBoxIPV6';
6
7
 
7
8
  const actions = [
8
9
  {
@@ -125,6 +126,16 @@ export function App()
125
126
  onChanged={onChange}
126
127
  />
127
128
  </div>
129
+ <NSBoxIPV6
130
+ title='IPV6'
131
+ required={false}
132
+ />
133
+
134
+ <NSBoxIPV4
135
+ title='IPV4'
136
+ required={false}
137
+ />
138
+
128
139
  </NSLayoutAction>
129
140
  </>
130
141
  );
@@ -0,0 +1,81 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBoxDate.module.css";
5
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
6
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
7
+ import { IValidationProps } from "../props/IValidationProps";
8
+ import { Validator } from "../Validator";
9
+
10
+ export interface INSBoxDateProps extends IBaseComponentProps, IValidationProps
11
+ {
12
+ title: string;
13
+ defaultValue?: string;
14
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
15
+ placeholder?: string;
16
+ }
17
+
18
+ export interface INSBoxDateState
19
+ {
20
+ value: string;
21
+ error?: string;
22
+ }
23
+
24
+ export class NSBoxDate extends React.Component<INSBoxDateProps, INSBoxDateState>
25
+ {
26
+ constructor(props: INSBoxDateProps)
27
+ {
28
+ super(props);
29
+ this.state = { value: props.defaultValue ?? "" };
30
+ this.setValue = this.setValue.bind(this);
31
+ this.getValue = this.getValue.bind(this);
32
+ this.onChanged = this.onChanged.bind(this);
33
+ }
34
+ getError(): string | null
35
+ {
36
+ return (
37
+ Validator.getError(this.props.title, this.state.value, this.props) &&
38
+ Validator.getErrorDate(this.props.title, this.state.value)
39
+ );
40
+ }
41
+ getValue(): string
42
+ {
43
+ let error = this.getError();
44
+ if (error)
45
+ {
46
+ this.setState({ error });
47
+ throw new Error(error);
48
+ }
49
+ return this.state.value;
50
+ }
51
+ setValue(value: string): void
52
+ {
53
+ this.setState({ value });
54
+ }
55
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
56
+ {
57
+ this.setValue(e.target.value);
58
+ if (this.props.onChanged)
59
+ this.props.onChanged(e);
60
+ }
61
+ override render()
62
+ {
63
+ return (
64
+ <>
65
+ <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
66
+ <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
67
+ <input
68
+ id={this.props.id}
69
+ value={this.state.value}
70
+ onChange={this.onChanged}
71
+ type="date"
72
+ className={Styles.ns_input}
73
+ placeholder={this.props.placeholder}
74
+ onClick={() => { }}
75
+ />
76
+ </div>
77
+ <NSBoxErrorNotifier error={this.state.error} />
78
+ </>
79
+ );
80
+ }
81
+ }
@@ -0,0 +1,81 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBoxDate.module.css";
5
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
6
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
7
+ import { IValidationProps } from "../props/IValidationProps";
8
+ import { Validator } from "../Validator";
9
+
10
+ export interface INSBoxDateTimeProps extends IBaseComponentProps, IValidationProps
11
+ {
12
+ title: string;
13
+ defaultValue?: string;
14
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
15
+ placeholder?: string;
16
+ }
17
+
18
+ export interface INSBoxDateTimeState
19
+ {
20
+ value: string;
21
+ error?: string;
22
+ }
23
+
24
+ export class NSBoxDateTime extends React.Component<INSBoxDateTimeProps, INSBoxDateTimeState>
25
+ {
26
+ constructor(props: INSBoxDateTimeProps)
27
+ {
28
+ super(props);
29
+ this.state = { value: props.defaultValue ?? "" };
30
+ this.setValue = this.setValue.bind(this);
31
+ this.getValue = this.getValue.bind(this);
32
+ this.onChanged = this.onChanged.bind(this);
33
+ }
34
+ getError(): string | null
35
+ {
36
+ return (
37
+ Validator.getError(this.props.title, this.state.value, this.props) &&
38
+ Validator.getErrorDate(this.props.title, this.state.value)
39
+ );
40
+ }
41
+ getValue(): string
42
+ {
43
+ let error = this.getError();
44
+ if (error)
45
+ {
46
+ this.setState({ error });
47
+ throw new Error(error);
48
+ }
49
+ return this.state.value;
50
+ }
51
+ setValue(value: string): void
52
+ {
53
+ this.setState({ value });
54
+ }
55
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
56
+ {
57
+ this.setValue(e.target.value);
58
+ if (this.props.onChanged)
59
+ this.props.onChanged(e);
60
+ }
61
+ override render()
62
+ {
63
+ return (
64
+ <>
65
+ <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
66
+ <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
67
+ <input
68
+ id={this.props.id}
69
+ value={this.state.value}
70
+ onChange={this.onChanged}
71
+ type="datetime-local"
72
+ className={Styles.ns_input}
73
+ placeholder={this.props.placeholder}
74
+ onClick={() => { }}
75
+ />
76
+ </div>
77
+ <NSBoxErrorNotifier error={this.state.error} />
78
+ </>
79
+ );
80
+ }
81
+ }
@@ -0,0 +1,92 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBox.module.css";
5
+ import IconInputFloat from '../assets/images/icon-input-float.svg';
6
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
7
+ import { IValidationProps } from "../props/IValidationProps";
8
+ import { IValidationNumberProps } from "../props/IValidationNumberProps";
9
+ import { Validator } from "../Validator";
10
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
11
+
12
+ export interface INSBoxDoubleProps extends IBaseComponentProps, IValidationProps, IValidationNumberProps
13
+ {
14
+ title: string;
15
+ defaultValue?: number;
16
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
17
+ placeholder?: string;
18
+ }
19
+
20
+ export interface INSBoxDoubleState
21
+ {
22
+ value?: number;
23
+ error?: string;
24
+ }
25
+
26
+ export class NSBoxDouble extends React.Component<INSBoxDoubleProps, INSBoxDoubleState>
27
+ {
28
+ constructor(props: INSBoxDoubleProps)
29
+ {
30
+ super(props);
31
+ this.state = { value: props.defaultValue };
32
+ this.setValue = this.setValue.bind(this);
33
+ this.getValue = this.getValue.bind(this);
34
+ this.onChanged = this.onChanged.bind(this);
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
+ }
43
+ getValue(): number | undefined
44
+ {
45
+ let error = this.getError();
46
+ if (error)
47
+ {
48
+ this.setState({ error });
49
+ throw new Error(error);
50
+ }
51
+ return this.state.value;
52
+ }
53
+ setValue(value: number | undefined): void
54
+ {
55
+ this.setState({ value });
56
+ }
57
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
58
+ {
59
+ this.setValue(parseFloat(e.target.value));
60
+ if (this.props.onChanged)
61
+ this.props.onChanged(e);
62
+ }
63
+ override render()
64
+ {
65
+ return (
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
+ inputMode="decimal"
82
+ //todo: check pattern
83
+ pattern="[0-9]*[.,]?[0-9]*"
84
+ className={Styles.ns_input}
85
+ placeholder={this.props.placeholder}
86
+ />
87
+ </div>
88
+ <NSBoxErrorNotifier error={this.state.error} />
89
+ </>
90
+ );
91
+ }
92
+ }
@@ -0,0 +1,91 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBox.module.css";
5
+ import IconInputDuration from '../assets/images/icon-input-duration.svg';
6
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
7
+ import { IValidationProps } from "../props/IValidationProps";
8
+ import { IValidationNumberProps } from "../props/IValidationNumberProps";
9
+ import { IValidationStringProps } from "../props/IValidationStringProps";
10
+ import { Validator } from "../Validator";
11
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
12
+
13
+ export interface INSBoxDurationProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, IValidationNumberProps
14
+ {
15
+ title: string;
16
+ defaultValue?: string;
17
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
18
+ placeholder?: string;
19
+ }
20
+
21
+ export interface INSBoxDurationState
22
+ {
23
+ value: string;
24
+ error?: string;
25
+ }
26
+
27
+ export class NSBoxDuration extends React.Component<INSBoxDurationProps, INSBoxDurationState>
28
+ {
29
+ constructor(props: INSBoxDurationProps)
30
+ {
31
+ super(props);
32
+ this.state = { value: props.defaultValue ?? "" };
33
+ this.getValue = this.getValue.bind(this);
34
+ this.setValue = this.setValue.bind(this);
35
+ this.onChanged = this.onChanged.bind(this);
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
+ }
44
+ getValue(): string
45
+ {
46
+ let error = this.getError();
47
+ if (error)
48
+ {
49
+ this.setState({ error });
50
+ throw new Error(error);
51
+ }
52
+ return this.state.value;
53
+ }
54
+ setValue(value: string): void
55
+ {
56
+ this.setState({ value });
57
+ }
58
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
59
+ {
60
+ this.setValue(e.target.value);
61
+ if (this.props.onChanged)
62
+ this.props.onChanged(e);
63
+ }
64
+ override render()
65
+ {
66
+ return (
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
+ <NSBoxErrorNotifier error={this.state.error} />
88
+ </>
89
+ );
90
+ }
91
+ }
@@ -0,0 +1,90 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBox.module.css";
5
+ import IconInputEmail from '../assets/images/icon-input-email.svg';
6
+ import { Validator } from "../Validator";
7
+ import { IValidationProps } from "../props/IValidationProps";
8
+ import { IValidationStringProps } from "../props/IValidationStringProps";
9
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
10
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
11
+
12
+ export interface INSBoxEmailProps extends IBaseComponentProps, IValidationProps, IValidationStringProps
13
+ {
14
+ title: string;
15
+ defaultValue?: string;
16
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
17
+ placeholder?: string;
18
+ }
19
+
20
+ export interface INSBoxEmailState
21
+ {
22
+ value: string;
23
+ error?: string;
24
+ }
25
+
26
+ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailState>
27
+ {
28
+ constructor(props: INSBoxEmailProps)
29
+ {
30
+ super(props);
31
+ this.state = { value: props.defaultValue ?? "" };
32
+ this.setValue = this.setValue.bind(this);
33
+ this.getValue = this.getValue.bind(this);
34
+ this.onChanged = this.onChanged.bind(this);
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.getErrorEmail(this.props.title, this.state.value)
42
+ );
43
+ }
44
+ getValue(): string
45
+ {
46
+ let error = this.getError();
47
+ if (error)
48
+ {
49
+ this.setState({ error });
50
+ throw new Error(error);
51
+ }
52
+ return this.state.value;
53
+ }
54
+ setValue(value: string): void
55
+ {
56
+ this.setState({ value });
57
+ }
58
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
59
+ {
60
+ this.setValue(e.target.value);
61
+ if (this.props.onChanged)
62
+ this.props.onChanged(e);
63
+ }
64
+ override render()
65
+ {
66
+ return (
67
+ <>
68
+ <div className={`${Styles.ns_input_parent} ${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={IconInputEmail}
73
+ alt="Email 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="email"
82
+ className={Styles.ns_input}
83
+ placeholder={this.props.placeholder}
84
+ />
85
+ </div>
86
+ <NSBoxErrorNotifier error={this.state.error} />
87
+ </>
88
+ );
89
+ }
90
+ }
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import React from "react";
3
+ import type { SelectProps } from 'antd';
4
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
5
+ import { IValidationProps } from "../props/IValidationProps";
6
+ import { NSSelectBox } from "./NSSelectBox";
7
+
8
+ export interface INSBoxEntityProps extends IBaseComponentProps, IValidationProps
9
+ {
10
+ title: string;
11
+ options: SelectProps['options'];
12
+ multiple: boolean;
13
+ }
14
+
15
+ export class NSBoxEntity extends React.Component<INSBoxEntityProps>
16
+ {
17
+ override render(): React.ReactNode
18
+ {
19
+ return (
20
+ <NSSelectBox
21
+ placeHolder="Entity Box"
22
+ title={this.props.title}
23
+ multiple={false}
24
+ options={this.props.options}
25
+ required={false}
26
+ />
27
+ )
28
+ }
29
+ }
@@ -0,0 +1,54 @@
1
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
2
+ import { IValidationProps } from "../props/IValidationProps";
3
+ import { NSSelectBox } from "./NSSelectBox";
4
+
5
+ const options = [
6
+ {
7
+ date: {
8
+ desc : "test"
9
+ },
10
+ },
11
+ {
12
+ date: {
13
+ desc : "test"
14
+ },
15
+ },
16
+ {
17
+ date: {
18
+ desc : "test"
19
+ },
20
+ },
21
+ {
22
+ date: {
23
+ desc : "test"
24
+ },
25
+ },
26
+ {
27
+ date: {
28
+ desc : "test"
29
+ },
30
+ },
31
+ {
32
+ date: {
33
+ desc : "test"
34
+ },
35
+ },
36
+ ]
37
+ export interface INSBoxEnumProps extends IBaseComponentProps, IValidationProps
38
+ {
39
+ title: string;
40
+ multiple: boolean;
41
+ }
42
+
43
+ export function NSBoxEnum(props: INSBoxEnumProps)
44
+ {
45
+ return (
46
+ <NSSelectBox
47
+ placeHolder="Enum Box"
48
+ title={props.title}
49
+ multiple={false}
50
+ options={options}
51
+ required={false}
52
+ />
53
+ )
54
+ }
@@ -0,0 +1,28 @@
1
+ import Styles from "./NSBoxErrorNotifier.module.css";
2
+ import Danger from '../assets/images/danger.svg';
3
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
4
+
5
+ export interface INSBoxErrorNotifierProps extends IBaseComponentProps
6
+ {
7
+ error?: string;
8
+ }
9
+
10
+ export function NSBoxErrorNotifier(props: INSBoxErrorNotifierProps)
11
+ {
12
+ return <>
13
+ {
14
+ props.error && (
15
+ <div className="d-flex justify-content-start align-items-center gap-2 ms-2">
16
+ <img
17
+ className={""}
18
+ src={Danger}
19
+ alt="Error Icon"
20
+ width={13}
21
+ height={13}
22
+ />
23
+ <span className={Styles.ns_input_error}>{props.error}</span>
24
+ </div >
25
+ )
26
+ }
27
+ </>;
28
+ }