namirasoft-site-react 1.3.39 → 1.3.42

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 (57) hide show
  1. package/dist/App.js +30 -2
  2. package/dist/App.js.map +1 -1
  3. package/dist/components/NSButtonGroup.d.ts +2 -0
  4. package/dist/components/NSButtonGroup.js +7 -0
  5. package/dist/components/NSButtonGroup.js.map +1 -0
  6. package/dist/components/NSButtonGroup.module.css +38 -0
  7. package/dist/components/NSInputDuration.d.ts +4 -2
  8. package/dist/components/NSInputDuration.js +12 -9
  9. package/dist/components/NSInputDuration.js.map +1 -1
  10. package/dist/components/NSInputEmail.d.ts +4 -2
  11. package/dist/components/NSInputEmail.js +16 -12
  12. package/dist/components/NSInputEmail.js.map +1 -1
  13. package/dist/components/NSInputFloat.d.ts +4 -2
  14. package/dist/components/NSInputFloat.js +11 -8
  15. package/dist/components/NSInputFloat.js.map +1 -1
  16. package/dist/components/NSInputIP.d.ts +4 -2
  17. package/dist/components/NSInputIP.js +12 -9
  18. package/dist/components/NSInputIP.js.map +1 -1
  19. package/dist/components/NSInputInteger.d.ts +4 -2
  20. package/dist/components/NSInputInteger.js +12 -9
  21. package/dist/components/NSInputInteger.js.map +1 -1
  22. package/dist/components/NSInputSearch.d.ts +4 -4
  23. package/dist/components/NSInputSearch.js +11 -17
  24. package/dist/components/NSInputSearch.js.map +1 -1
  25. package/dist/components/NSInputTime.d.ts +4 -2
  26. package/dist/components/NSInputTime.js +12 -9
  27. package/dist/components/NSInputTime.js.map +1 -1
  28. package/dist/components/NSSection.d.ts +1 -0
  29. package/dist/components/NSSection.js +4 -1
  30. package/dist/components/NSSection.js.map +1 -1
  31. package/dist/components/NSSection.module.css +6 -0
  32. package/dist/components/NSSpace.js.map +1 -1
  33. package/dist/components/NSTable.d.ts +1 -0
  34. package/dist/components/NSTable.js +6 -2
  35. package/dist/components/NSTable.js.map +1 -1
  36. package/dist/components/NSTable.module.css +121 -88
  37. package/dist/main.d.ts +1 -0
  38. package/dist/main.js +1 -0
  39. package/dist/main.js.map +1 -1
  40. package/package.json +2 -2
  41. package/public/assets/images/close-vector.png +0 -0
  42. package/src/App.tsx +46 -8
  43. package/src/components/NSButtonGroup.module.css +38 -0
  44. package/src/components/NSButtonGroup.tsx +12 -0
  45. package/src/components/NSInputDuration.tsx +18 -14
  46. package/src/components/NSInputEmail.tsx +36 -31
  47. package/src/components/NSInputFloat.tsx +16 -11
  48. package/src/components/NSInputIP.tsx +14 -10
  49. package/src/components/NSInputInteger.tsx +14 -10
  50. package/src/components/NSInputSearch.tsx +16 -24
  51. package/src/components/NSInputTime.tsx +13 -9
  52. package/src/components/NSSection.module.css +6 -0
  53. package/src/components/NSSection.tsx +7 -2
  54. package/src/components/NSSpace.tsx +2 -1
  55. package/src/components/NSTable.module.css +121 -88
  56. package/src/components/NSTable.tsx +28 -9
  57. package/src/main.ts +1 -0
@@ -8,6 +8,8 @@ import Danger from '../assets/images/danger.svg';
8
8
  export interface NSInputEmailProps
9
9
  {
10
10
  title: string;
11
+ defaultValue?: string;
12
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
13
  }
12
14
 
13
15
  export interface NSInputEmailState
@@ -21,32 +23,35 @@ export class NSInputEmail extends React.Component<NSInputEmailProps, NSInputEmai
21
23
  {
22
24
  super(props);
23
25
  this.state = {
24
- value: "",
26
+ value: props.defaultValue ?? "",
25
27
  error: false,
26
28
  };
27
29
  this.setValue = this.setValue.bind(this);
28
30
  this.getValue = this.getValue.bind(this);
29
- this.setDefaultValue = this.setDefaultValue.bind(this);
30
- }
31
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
31
+ this.onChanged = this.onChanged.bind(this);
32
+ }
33
+ getValue(): string
34
+ {
35
+ return this.state.value;
36
+ }
37
+ setValue(value: string): void
32
38
  {
33
- let email = /^(([^<>()[]\\.,;:\s@"]+(\.[^<>()[]\\.,;:\s@"]+)*)|(".+"))@(([[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
34
- if (!email.test(e.target.value))
39
+ let email = /^(([^<>()[]\\.,;:\s@"]+(\.[^<>()[]\\.,;:\s@"]+)*)|(".+"))@(([[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
40
+ debugger
41
+ if (!email.test(value))
35
42
  {
36
- this.setState({ error: true, value: e.target.value });
43
+ this.setState({ error: true, value });
37
44
  }
38
45
  else
39
46
  {
40
- this.setState({ error: false, value: e.target.value });
47
+ this.setState({ error: false, value });
41
48
  }
42
- }
43
- setDefaultValue(value: string): void
49
+ }
50
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
44
51
  {
45
- this.setState({ value });
46
- }
47
- getValue(): string
48
- {
49
- return this.state.value;
52
+ this.setValue(e.target.value);
53
+ if (this.props.onChanged)
54
+ this.props.onChanged(e);
50
55
  }
51
56
  override render()
52
57
  {
@@ -63,27 +68,27 @@ export class NSInputEmail extends React.Component<NSInputEmailProps, NSInputEmai
63
68
  />
64
69
  <input
65
70
  value={this.state.value}
66
- onChange={this.setValue}
71
+ onChange={this.onChanged}
67
72
  type="email"
68
73
  className={`${this.state.error === true ? Styles.ns_input_red : ""} ${Styles.ns_input}`}
69
74
  placeholder="Sample@gmail.com"
70
75
  />
71
76
  </div>
72
-
73
- {this.state.error === true ? (
74
- <>
75
- <div className="d-flex justify-content-start align-items-center gap-2 ms-2 ">
76
- <img
77
- className={""}
78
- src={Danger}
79
- alt="icon"
80
- width={13}
81
- height={13}
82
- />
83
- <span className={Styles.ns_input_error}>Enter a valid email. </span>
84
- </div>
85
- </>) : null}
86
-
77
+ {
78
+ this.state.error === true ? (
79
+ <>
80
+ <div className="d-flex justify-content-start align-items-center gap-2 ms-2 ">
81
+ <img
82
+ className={""}
83
+ src={Danger}
84
+ alt="icon"
85
+ width={13}
86
+ height={13}
87
+ />
88
+ <span className={Styles.ns_input_error}>Enter a valid email.</span>
89
+ </div>
90
+ </>) : null
91
+ }
87
92
  </>
88
93
  );
89
94
  }
@@ -6,7 +6,9 @@ import IconInputFloat from '../assets/images/icon-input-float.svg';
6
6
 
7
7
  export interface NSInputFloatProps
8
8
  {
9
- title: string;
9
+ title: string;
10
+ defaultValue?: string;
11
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
12
  }
11
13
 
12
14
  export interface NSInputFloatState
@@ -19,23 +21,26 @@ export class NSInputFloat extends React.Component<NSInputFloatProps, NSInputFloa
19
21
  {
20
22
  super(props);
21
23
  this.state = {
22
- value: "",
24
+ value: props.defaultValue ?? "",
23
25
  };
24
26
  this.setValue = this.setValue.bind(this);
25
27
  this.getValue = this.getValue.bind(this);
26
- this.setDefaultValue = this.setDefaultValue.bind(this);
28
+ this.onChanged = this.onChanged.bind(this);
27
29
  }
28
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
30
+ getValue(): string
29
31
  {
30
- this.setState({ value: e.target.value });
31
- }
32
- setDefaultValue(value: string): void
32
+ return this.state.value;
33
+ }
34
+ setValue(value: string): void
33
35
  {
34
36
  this.setState({ value });
35
- }
36
- getValue(): string
37
+ }
38
+
39
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
37
40
  {
38
- return this.state.value;
41
+ this.setValue(e.target.value);
42
+ if (this.props.onChanged)
43
+ this.props.onChanged(e);
39
44
  }
40
45
  override render()
41
46
  {
@@ -51,7 +56,7 @@ export class NSInputFloat extends React.Component<NSInputFloatProps, NSInputFloa
51
56
  />
52
57
  <input
53
58
  value={this.state.value}
54
- onChange={this.setValue}
59
+ onChange={this.onChanged}
55
60
  type="number"
56
61
  className={Styles.ns_input}
57
62
  placeholder="1.2"
@@ -6,7 +6,9 @@ import IconInputId from '../assets/images/icon-input-id.svg';
6
6
 
7
7
  export interface NSInputIPProps
8
8
  {
9
- title: string;
9
+ title: string;
10
+ defaultValue?: string;
11
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
12
  }
11
13
 
12
14
  export interface NSInputIPState
@@ -19,23 +21,25 @@ export class NSInputIP extends React.Component<NSInputIPProps, NSInputIPState> {
19
21
  {
20
22
  super(props);
21
23
  this.state = {
22
- value: "",
24
+ value: props.defaultValue ?? "",
23
25
  };
24
- this.setValue = this.setValue.bind(this);
25
26
  this.getValue = this.getValue.bind(this);
26
- this.setDefaultValue = this.setDefaultValue.bind(this);
27
+ this.setValue = this.setValue.bind(this);
28
+ this.onChanged = this.onChanged.bind(this);
27
29
  }
28
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
30
+ getValue(): string
29
31
  {
30
- this.setState({ value: e.target.value });
32
+ return this.state.value;
31
33
  }
32
- setDefaultValue(value: string): void
34
+ setValue(value: string): void
33
35
  {
34
36
  this.setState({ value });
35
37
  }
36
- getValue(): string
38
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
37
39
  {
38
- return this.state.value;
40
+ this.setValue(e.target.value);
41
+ if (this.props.onChanged)
42
+ this.props.onChanged(e);
39
43
  }
40
44
  override render()
41
45
  {
@@ -51,7 +55,7 @@ export class NSInputIP extends React.Component<NSInputIPProps, NSInputIPState> {
51
55
  />
52
56
  <input
53
57
  value={this.state.value}
54
- onChange={this.setValue}
58
+ onChange={this.onChanged}
55
59
  type="number"
56
60
  className={Styles.ns_input}
57
61
  placeholder="192.158.1.38"
@@ -6,7 +6,9 @@ import IconInputInteger from '../assets/images/icon-input-integer.svg';
6
6
 
7
7
  export interface NSInputIntegerProps
8
8
  {
9
- title: string;
9
+ title: string;
10
+ defaultValue?: string;
11
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
12
  }
11
13
 
12
14
  export interface NSInputIntegerState
@@ -19,23 +21,25 @@ export class NSInputInteger extends React.Component<NSInputIntegerProps, NSInput
19
21
  {
20
22
  super(props);
21
23
  this.state = {
22
- value: "",
24
+ value: props.defaultValue ?? "",
23
25
  };
24
- this.setValue = this.setValue.bind(this);
25
26
  this.getValue = this.getValue.bind(this);
26
- this.setDefaultValue = this.setDefaultValue.bind(this);
27
+ this.setValue = this.setValue.bind(this);
28
+ this.onChanged = this.onChanged.bind(this);
27
29
  }
28
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
30
+ getValue(): string
29
31
  {
30
- this.setState({ value: e.target.value });
32
+ return this.state.value;
31
33
  }
32
- setDefaultValue(value: string): void
34
+ setValue(value: string): void
33
35
  {
34
36
  this.setState({ value });
35
37
  }
36
- getValue(): string
38
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
37
39
  {
38
- return this.state.value;
40
+ this.setValue(e.target.value);
41
+ if (this.props.onChanged)
42
+ this.props.onChanged(e);
39
43
  }
40
44
  override render()
41
45
  {
@@ -51,7 +55,7 @@ export class NSInputInteger extends React.Component<NSInputIntegerProps, NSInput
51
55
  />
52
56
  <input
53
57
  value={this.state.value}
54
- onChange={this.setValue}
58
+ onChange={this.onChanged}
55
59
  type="number"
56
60
  className={Styles.ns_input}
57
61
  placeholder="1234"
@@ -5,48 +5,41 @@ import Styles from "./NSInputSearch.module.css";
5
5
  import IconInputSearch from '../assets/images/icon-input-search.svg';
6
6
 
7
7
  export interface NSInputSearchProps
8
- {}
8
+ {
9
+ defaultValue?: string;
10
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ }
9
12
 
10
13
  export interface NSInputSearchState
11
14
  {
12
15
  value: string;
13
16
  }
14
17
 
15
- export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSearchState> {
18
+ export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSearchState>
19
+ {
16
20
  constructor(props: NSInputSearchProps)
17
21
  {
18
22
  super(props);
19
23
  this.state = {
20
- value: "",
24
+ value: props.defaultValue ?? "",
21
25
  };
22
- this.setValue = this.setValue.bind(this);
23
26
  this.getValue = this.getValue.bind(this);
24
- this.setDefaultValue = this.setDefaultValue.bind(this);
25
- this.keyDownEvent = this.keyDownEvent.bind(this);
26
- }
27
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
28
- {
29
- this.setState({ value: e.target.value });
30
- }
31
- setDefaultValue(value: string): void
32
- {
33
- this.setState({ value });
27
+ this.setValue = this.setValue.bind(this);
28
+ this.onChanged = this.onChanged.bind(this);
34
29
  }
35
30
  getValue(): string
36
31
  {
37
32
  return this.state.value;
38
33
  }
39
- onChanged(e: React.ChangeEvent<HTMLInputElement>): void
34
+ setValue(value: string): void
40
35
  {
41
- this.setValue(e);
36
+ this.setState({ value });
42
37
  }
43
- keyDownEvent(event: React.KeyboardEvent<HTMLDivElement>)
38
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
44
39
  {
45
- if (event.code === "Enter")
46
- {
47
- //todo
48
- console.log("function")
49
- }
40
+ this.setValue(e.target.value);
41
+ if (this.props.onChanged)
42
+ this.props.onChanged(e);
50
43
  }
51
44
  override render()
52
45
  {
@@ -61,8 +54,7 @@ export class NSInputSearch extends React.Component<NSInputSearchProps, NSInputSe
61
54
  />
62
55
  <input
63
56
  value={this.state.value}
64
- onChange={this.setValue}
65
- onKeyDown={this.keyDownEvent}
57
+ onChange={this.onChanged}
66
58
  type="text"
67
59
  className={Styles.ns_input}
68
60
  placeholder="Search"
@@ -7,6 +7,8 @@ import IconInputTime from '../assets/images/icon-input-time.svg';
7
7
  export interface NSInputTimeProps
8
8
  {
9
9
  title: string;
10
+ defaultValue?: string;
11
+ onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
12
  }
11
13
 
12
14
  export interface NSInputTimeState
@@ -19,23 +21,25 @@ export class NSInputTime extends React.Component<NSInputTimeProps, NSInputTimeSt
19
21
  {
20
22
  super(props);
21
23
  this.state = {
22
- value: "",
24
+ value: props.defaultValue ?? "",
23
25
  };
24
- this.setValue = this.setValue.bind(this);
25
26
  this.getValue = this.getValue.bind(this);
26
- this.setDefaultValue = this.setDefaultValue.bind(this);
27
+ this.setValue = this.setValue.bind(this);
28
+ this.onChanged = this.onChanged.bind(this);
27
29
  }
28
- setValue(e: React.ChangeEvent<HTMLInputElement>): void
30
+ getValue(): string
29
31
  {
30
- this.setState({ value: e.target.value });
32
+ return this.state.value;
31
33
  }
32
- setDefaultValue(value: string): void
34
+ setValue(value: string): void
33
35
  {
34
36
  this.setState({ value });
35
37
  }
36
- getValue(): string
38
+ private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
37
39
  {
38
- return this.state.value;
40
+ this.setValue(e.target.value);
41
+ if (this.props.onChanged)
42
+ this.props.onChanged(e);
39
43
  }
40
44
  override render()
41
45
  {
@@ -51,7 +55,7 @@ export class NSInputTime extends React.Component<NSInputTimeProps, NSInputTimeSt
51
55
  />
52
56
  <input
53
57
  value={this.state.value}
54
- onChange={this.setValue}
58
+ onChange={this.onChanged}
55
59
  type="time"
56
60
  className={Styles.ns_input}
57
61
  placeholder="21:44:06"
@@ -2,4 +2,10 @@
2
2
  background-repeat: no-repeat;
3
3
  background-size: cover;
4
4
  background-position: center;
5
+ }
6
+
7
+ .ns_section_center {
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
5
11
  }
@@ -8,6 +8,7 @@ export interface NSSectionProps
8
8
  {
9
9
  children: ReactNode;
10
10
  background?: BackgroundType;
11
+ center_items?: boolean;
11
12
  }
12
13
 
13
14
  export interface NSSectionState
@@ -15,7 +16,8 @@ export interface NSSectionState
15
16
  background?: BackgroundType;
16
17
  }
17
18
 
18
- export class NSSection extends Component<NSSectionProps, NSSectionState> {
19
+ export class NSSection extends Component<NSSectionProps, NSSectionState>
20
+ {
19
21
  constructor(props: NSSectionProps)
20
22
  {
21
23
  super(props);
@@ -29,6 +31,9 @@ export class NSSection extends Component<NSSectionProps, NSSectionState> {
29
31
  }
30
32
  override render()
31
33
  {
34
+ let styles = [Styles.ns_section];
35
+ if (this.props.center_items)
36
+ styles.push(Styles.ns_section_center);
32
37
  return (
33
38
  <section style=
34
39
  {{
@@ -36,7 +41,7 @@ export class NSSection extends Component<NSSectionProps, NSSectionState> {
36
41
  backgroundColor: this.state.background?.color,
37
42
  backgroundPosition: this.state.background?.position
38
43
  }}
39
- className={Styles.ns_section} >
44
+ className={styles.join(" ")} >
40
45
  {this.props.children}
41
46
  </section>
42
47
  );
@@ -26,7 +26,8 @@ export interface NSSpaceState
26
26
  size: NSSpaceSizeType;
27
27
  }
28
28
 
29
- export class NSSpace extends React.Component<NSSpaceProps, NSSpaceState> {
29
+ export class NSSpace extends React.Component<NSSpaceProps, NSSpaceState>
30
+ {
30
31
  constructor(props: NSSpaceProps)
31
32
  {
32
33
  super(props);