namirasoft-site-react 1.3.252 → 1.3.255

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 (96) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/App.js.map +1 -1
  3. package/dist/components/NSBoxBoolean.d.ts +6 -7
  4. package/dist/components/NSBoxBoolean.js +8 -12
  5. package/dist/components/NSBoxBoolean.js.map +1 -1
  6. package/dist/components/NSBoxDate.d.ts +1 -0
  7. package/dist/components/NSBoxDate.js +1 -4
  8. package/dist/components/NSBoxDate.js.map +1 -1
  9. package/dist/components/NSBoxDateTime.d.ts +1 -0
  10. package/dist/components/NSBoxDateTime.js +1 -4
  11. package/dist/components/NSBoxDateTime.js.map +1 -1
  12. package/dist/components/NSBoxDouble.d.ts +1 -0
  13. package/dist/components/NSBoxDouble.js +1 -4
  14. package/dist/components/NSBoxDouble.js.map +1 -1
  15. package/dist/components/NSBoxDuration.d.ts +1 -0
  16. package/dist/components/NSBoxDuration.js +1 -4
  17. package/dist/components/NSBoxDuration.js.map +1 -1
  18. package/dist/components/NSBoxEmail.d.ts +1 -0
  19. package/dist/components/NSBoxEmail.js +1 -4
  20. package/dist/components/NSBoxEmail.js.map +1 -1
  21. package/dist/components/NSBoxEntity.d.ts +4 -3
  22. package/dist/components/NSBoxEntity.js +13 -10
  23. package/dist/components/NSBoxEntity.js.map +1 -1
  24. package/dist/components/NSBoxEnum.js +1 -4
  25. package/dist/components/NSBoxEnum.js.map +1 -1
  26. package/dist/components/NSBoxErrorNotifier.d.ts +1 -0
  27. package/dist/components/NSBoxErrorNotifier.js +5 -1
  28. package/dist/components/NSBoxErrorNotifier.js.map +1 -1
  29. package/dist/components/NSBoxIPV4.d.ts +1 -0
  30. package/dist/components/NSBoxIPV4.js +1 -4
  31. package/dist/components/NSBoxIPV4.js.map +1 -1
  32. package/dist/components/NSBoxIPV6.d.ts +1 -0
  33. package/dist/components/NSBoxIPV6.js +1 -4
  34. package/dist/components/NSBoxIPV6.js.map +1 -1
  35. package/dist/components/NSBoxInteger.d.ts +1 -0
  36. package/dist/components/NSBoxInteger.js +1 -4
  37. package/dist/components/NSBoxInteger.js.map +1 -1
  38. package/dist/components/NSBoxLabel.d.ts +2 -1
  39. package/dist/components/NSBoxLabel.js +2 -1
  40. package/dist/components/NSBoxLabel.js.map +1 -1
  41. package/dist/components/NSBoxOTP.js +2 -1
  42. package/dist/components/NSBoxOTP.js.map +1 -1
  43. package/dist/components/NSBoxPassword.d.ts +1 -0
  44. package/dist/components/NSBoxPassword.js +1 -4
  45. package/dist/components/NSBoxPassword.js.map +1 -1
  46. package/dist/components/NSBoxPhone.d.ts +1 -0
  47. package/dist/components/NSBoxPhone.js +1 -4
  48. package/dist/components/NSBoxPhone.js.map +1 -1
  49. package/dist/components/NSBoxPrice.d.ts +1 -0
  50. package/dist/components/NSBoxPrice.js +1 -4
  51. package/dist/components/NSBoxPrice.js.map +1 -1
  52. package/dist/components/NSBoxString.d.ts +1 -0
  53. package/dist/components/NSBoxString.js +2 -5
  54. package/dist/components/NSBoxString.js.map +1 -1
  55. package/dist/components/NSBoxTextArea.d.ts +1 -0
  56. package/dist/components/NSBoxTextArea.js +3 -6
  57. package/dist/components/NSBoxTextArea.js.map +1 -1
  58. package/dist/components/NSBoxTime.d.ts +1 -0
  59. package/dist/components/NSBoxTime.js +1 -4
  60. package/dist/components/NSBoxTime.js.map +1 -1
  61. package/dist/components/NSPagination.d.ts +15 -2
  62. package/dist/components/NSPagination.js +73 -44
  63. package/dist/components/NSPagination.js.map +1 -1
  64. package/dist/components/NSTable.d.ts +4 -3
  65. package/dist/components/NSTable.js +8 -6
  66. package/dist/components/NSTable.js.map +1 -1
  67. package/dist/pages/NSLoginPage.d.ts +0 -2
  68. package/dist/pages/NSLoginPage.js +2 -16
  69. package/dist/pages/NSLoginPage.js.map +1 -1
  70. package/dist/props/IBaseComponentProps.d.ts +1 -0
  71. package/package.json +2 -2
  72. package/src/App.tsx +2 -2
  73. package/src/components/NSBoxBoolean.tsx +18 -27
  74. package/src/components/NSBoxDate.tsx +7 -10
  75. package/src/components/NSBoxDateTime.tsx +7 -10
  76. package/src/components/NSBoxDouble.tsx +8 -12
  77. package/src/components/NSBoxDuration.tsx +7 -9
  78. package/src/components/NSBoxEmail.tsx +10 -11
  79. package/src/components/NSBoxEntity.tsx +21 -14
  80. package/src/components/NSBoxEnum.tsx +2 -6
  81. package/src/components/NSBoxErrorNotifier.tsx +7 -1
  82. package/src/components/NSBoxIPV4.tsx +7 -9
  83. package/src/components/NSBoxIPV6.tsx +7 -9
  84. package/src/components/NSBoxInteger.tsx +7 -9
  85. package/src/components/NSBoxLabel.tsx +3 -2
  86. package/src/components/NSBoxOTP.tsx +17 -15
  87. package/src/components/NSBoxPassword.tsx +7 -9
  88. package/src/components/NSBoxPhone.tsx +2 -7
  89. package/src/components/NSBoxPrice.tsx +8 -10
  90. package/src/components/NSBoxString.tsx +9 -11
  91. package/src/components/NSBoxTextArea.tsx +5 -12
  92. package/src/components/NSBoxTime.tsx +7 -9
  93. package/src/components/NSPagination.tsx +154 -117
  94. package/src/components/NSTable.tsx +8 -8
  95. package/src/pages/NSLoginPage.tsx +4 -19
  96. package/src/props/IBaseComponentProps.ts +1 -0
@@ -16,6 +16,7 @@ export interface INSBoxDurationProps extends IBaseComponentProps, IValidationPro
16
16
  placeholder?: string;
17
17
  defaultValue?: string;
18
18
  onChanged?: (e: NSBoxDuration) => void;
19
+ onClicked?: (e: NSBoxDuration) => void;
19
20
  }
20
21
 
21
22
  export interface INSBoxDurationState
@@ -47,10 +48,6 @@ export class NSBoxDuration extends React.Component<INSBoxDurationProps, INSBoxDu
47
48
  if (error)
48
49
  {
49
50
  this.setState({ error });
50
- setTimeout(() =>
51
- {
52
- this.setState({ error: "" });
53
- }, 7000);
54
51
  throw new Error(error);
55
52
  }
56
53
  return this.state.value;
@@ -71,20 +68,21 @@ export class NSBoxDuration extends React.Component<INSBoxDurationProps, INSBoxDu
71
68
  {
72
69
  return (
73
70
  <>
74
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
71
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
75
72
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
76
73
  <input
77
- id={this.props.id}
78
- value={this.state.value}
79
- onChange={this.onChanged}
80
74
  type="time"
75
+ name={this.props.name}
81
76
  className={Styles.ns_input}
82
77
  placeholder={this.props.placeholder}
78
+ value={this.state.value}
79
+ onChange={this.onChanged}
80
+ onClick={() => this.props.onClicked}
83
81
  step="2"
84
82
  style={{ background: `url(${IconInputDuration}) white no-repeat scroll center right 16px` }}
85
83
  />
86
84
  </div>
87
- <NSBoxErrorNotifier error={this.state.error} />
85
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
88
86
  </>
89
87
  );
90
88
  }
@@ -18,6 +18,7 @@ export interface INSBoxEmailProps extends IBaseComponentProps, IValidationProps,
18
18
  placeholder?: string;
19
19
  defaultValue?: string;
20
20
  onChanged?: (e: NSBoxEmail) => void;
21
+ onClicked?: (e: NSBoxEmail) => void;
21
22
  }
22
23
 
23
24
  export interface INSBoxEmailState
@@ -54,10 +55,6 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
54
55
  if (error)
55
56
  {
56
57
  this.setState({ error });
57
- setTimeout(() =>
58
- {
59
- this.setState({ error: "" });
60
- }, 7000);
61
58
  throw new Error(error);
62
59
  }
63
60
  return this.state.value;
@@ -83,11 +80,12 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
83
80
  {
84
81
  this.setState(prevState => ({ isFullScreen: !prevState.isFullScreen }));
85
82
  }
83
+
86
84
  override render()
87
85
  {
88
86
  return (
89
87
  <>
90
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
88
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
91
89
  <div className="d-flex justify-content-between align-items-center">
92
90
  <span className={Styles.ns_input_title}>
93
91
  {this.props.required && <span style={{ color: "red" }}>*</span>} {this.props.title}
@@ -114,14 +112,16 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
114
112
  </div>
115
113
  </div>
116
114
  <input
117
- id={this.props.id}
118
- value={this.state.value}
119
- onChange={this.onChanged}
120
115
  type="email"
116
+ name={this.props.name}
121
117
  className={Styles.ns_input}
122
118
  placeholder={this.props.placeholder}
119
+ value={this.state.value}
120
+ onChange={this.onChanged}
121
+ onClick={() => this.props.onClicked}
123
122
  style={{ background: `url(${IconInputEmail}) white no-repeat scroll center right 16px` }}
124
123
  />
124
+ {/* Todo make a new component for fullscreen */}
125
125
  <div className={Styles.ns_input_modal_full_screen} style={{ display: this.state.isFullScreen === false ? "none" : "block" }} >
126
126
  <div>
127
127
  <img
@@ -133,16 +133,15 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
133
133
  onClick={this.toggleFullScreen}
134
134
  />
135
135
  </div>
136
- <div className={Styles.ns_input_modal_full} onClick={this.toggleFullScreen}> </div>
136
+ <div className={Styles.ns_input_modal_full} onClick={this.toggleFullScreen}></div>
137
137
  <textarea
138
138
  value={this.state.value}
139
139
  onChange={(e) => this.setValue(e.target.value)}
140
140
  >
141
-
142
141
  </textarea>
143
142
  </div>
144
143
  </div>
145
- <NSBoxErrorNotifier error={this.state.error} />
144
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
146
145
  </>
147
146
  );
148
147
  }
@@ -18,11 +18,12 @@ export interface INSBoxEntitOption extends BaseOptionType
18
18
  export interface INSBoxEntityProps extends IBaseComponentProps, IValidationProps
19
19
  {
20
20
  title: string;
21
- options: INSBoxEntitOption[];
22
- multiple: boolean;
23
21
  placeholder?: string;
24
22
  defaultValue?: string;
25
23
  onChanged?: (e: NSBoxEntity) => void;
24
+ onClicked?: (e: NSBoxEntity) => void;
25
+ multiple: boolean;
26
+ options: INSBoxEntitOption[];
26
27
  }
27
28
 
28
29
  export interface INSBoxEntityState
@@ -45,7 +46,7 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
45
46
  this.setValues = this.setValues.bind(this);
46
47
  this.setValue = this.setValue.bind(this);
47
48
  this.getValue = this.getValue.bind(this);
48
- this.handleChange = this.handleChange.bind(this);
49
+ this.onChanged = this.onChanged.bind(this);
49
50
  }
50
51
  getError(value: string): string | null
51
52
  {
@@ -78,34 +79,40 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
78
79
  }
79
80
  setValue(value: string | null): void
80
81
  {
81
- this.setState({ value });
82
+ this.setState({ value }, () =>
83
+ {
84
+ if (this.props.onChanged)
85
+ this.props.onChanged(this);
86
+ });
82
87
  }
83
88
  setValues(values: string[]): void
84
89
  {
85
- this.setState({ values });
90
+ this.setState({ values }, () =>
91
+ {
92
+ if (this.props.onChanged)
93
+ this.props.onChanged(this);
94
+ });
86
95
  }
87
- handleChange(value: string | null | string[]): void
96
+ onChanged(value: string | null | string[]): void
88
97
  {
89
98
  if (this.props.multiple)
90
- {
91
99
  this.setValues(value as string[]);
92
- } else
93
- {
100
+ else
94
101
  this.setValue(value as string | null);
95
- }
96
102
  }
97
103
  override render()
98
104
  {
99
105
  return (
100
106
  <>
101
- <div className={`${Styles.ns_input_parent}`}>
107
+ <div id={this.props.id} className={`${Styles.ns_input_parent}`}>
102
108
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
103
109
  <Select
104
110
  mode={this.props.multiple ? "multiple" : undefined}
105
111
  style={{ width: '100%' }}
106
112
  className={Styles.ns_input_select}
107
- placeholder={this.props.placeholder ?? "Combo Box"}
108
- onChange={this.handleChange}
113
+ placeholder={this.props.placeholder}
114
+ onChange={this.onChanged}
115
+ onClick={() => this.props.onClicked}
109
116
  optionLabelProp="label"
110
117
  options={this.props.options}
111
118
  optionRender={(option) => (
@@ -116,7 +123,7 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
116
123
  suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
117
124
  />
118
125
  </div>
119
- <NSBoxErrorNotifier error={this.state.error} />
126
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
120
127
  </>
121
128
  );
122
129
  }
@@ -61,10 +61,6 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
61
61
  if (error)
62
62
  {
63
63
  this.setState({ error });
64
- setTimeout(() =>
65
- {
66
- this.setState({ error: "" });
67
- }, 7000);
68
64
  throw new Error(error);
69
65
  }
70
66
  return this.state.value;
@@ -109,7 +105,7 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
109
105
  {
110
106
  return (
111
107
  <>
112
- <div className={`${Styles.ns_input_parent} ${this.props.customClass}`}>
108
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.customClass}`}>
113
109
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
114
110
  <Select
115
111
  showSearch
@@ -128,7 +124,7 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
128
124
  suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
129
125
  />
130
126
  </div>
131
- <NSBoxErrorNotifier error={this.state.error} />
127
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
132
128
  </>
133
129
  );
134
130
  }
@@ -5,14 +5,20 @@ import { IBaseComponentProps } from "../props/IBaseComponentProps";
5
5
  export interface INSBoxErrorNotifierProps extends IBaseComponentProps
6
6
  {
7
7
  error?: string;
8
+ clearError: () => void;
8
9
  }
9
10
 
10
11
  export function NSBoxErrorNotifier(props: INSBoxErrorNotifierProps)
11
12
  {
13
+ if (props.error)
14
+ setTimeout(() =>
15
+ {
16
+ props.clearError();
17
+ }, 5000);
12
18
  return <>
13
19
  {
14
20
  props.error && (
15
- <div className="d-flex justify-content-start align-items-center gap-2 ms-2">
21
+ <div id={props.id} className="d-flex justify-content-start align-items-center gap-2 ms-2">
16
22
  <img
17
23
  className={""}
18
24
  src={Danger}
@@ -17,6 +17,7 @@ export interface INSBoxIPV4Props extends IBaseComponentProps, IValidationProps,
17
17
  placeholder?: string;
18
18
  defaultValue?: string;
19
19
  onChanged?: (e: NSBoxIPV4) => void;
20
+ onClicked?: (e: NSBoxIPV4) => void;
20
21
  }
21
22
 
22
23
  export interface INSBoxIPV4State
@@ -49,10 +50,6 @@ export class NSBoxIPV4 extends React.Component<INSBoxIPV4Props, INSBoxIPV4State>
49
50
  if (error)
50
51
  {
51
52
  this.setState({ error });
52
- setTimeout(() =>
53
- {
54
- this.setState({ error: "" });
55
- }, 7000);
56
53
  throw new Error(error);
57
54
  }
58
55
  return this.state.value;
@@ -73,15 +70,16 @@ export class NSBoxIPV4 extends React.Component<INSBoxIPV4Props, INSBoxIPV4State>
73
70
  {
74
71
  return (
75
72
  <>
76
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
73
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
77
74
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
78
75
  <input
79
- id={this.props.id}
80
- value={this.state.value}
81
- onChange={this.onChanged}
82
76
  type="text"
77
+ name={this.props.name}
83
78
  className={Styles.ns_input}
84
79
  placeholder={this.props.placeholder}
80
+ value={this.state.value}
81
+ onChange={this.onChanged}
82
+ onClick={() => this.props.onClicked}
85
83
  minLength={7}
86
84
  maxLength={15}
87
85
  size={15}
@@ -89,7 +87,7 @@ export class NSBoxIPV4 extends React.Component<INSBoxIPV4Props, INSBoxIPV4State>
89
87
  style={{ background: `url(${IconInputIP}) white no-repeat scroll center right 16px` }}
90
88
  />
91
89
  </div>
92
- <NSBoxErrorNotifier error={this.state.error} />
90
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
93
91
  </>
94
92
  );
95
93
  }
@@ -17,6 +17,7 @@ export interface INSBoxIPV6Props extends IBaseComponentProps, IValidationProps,
17
17
  placeholder?: string;
18
18
  defaultValue?: string;
19
19
  onChanged?: (e: NSBoxIPV6) => void;
20
+ onClicked?: (e: NSBoxIPV6) => void;
20
21
  }
21
22
 
22
23
  export interface INSBoxIPV6State
@@ -49,10 +50,6 @@ export class NSBoxIPV6 extends React.Component<INSBoxIPV6Props, INSBoxIPV6State>
49
50
  if (error)
50
51
  {
51
52
  this.setState({ error });
52
- setTimeout(() =>
53
- {
54
- this.setState({ error: "" });
55
- }, 7000);
56
53
  throw new Error(error);
57
54
  }
58
55
  return this.state.value;
@@ -73,20 +70,21 @@ export class NSBoxIPV6 extends React.Component<INSBoxIPV6Props, INSBoxIPV6State>
73
70
  {
74
71
  return (
75
72
  <>
76
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
73
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
77
74
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
78
75
  <input
79
- id={this.props.id}
80
- value={this.state.value}
81
- onChange={this.onChanged}
82
76
  type="text"
77
+ name={this.props.name}
83
78
  className={Styles.ns_input}
84
79
  placeholder={this.props.placeholder}
80
+ value={this.state.value}
81
+ onChange={this.onChanged}
82
+ onClick={() => this.props.onClicked}
85
83
  pattern={IPV6_PATTERN}
86
84
  style={{ background: `url(${IconInputIP}) white no-repeat scroll center right 16px` }}
87
85
  />
88
86
  </div>
89
- <NSBoxErrorNotifier error={this.state.error} />
87
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
90
88
  </>
91
89
  );
92
90
  }
@@ -15,6 +15,7 @@ export interface INSBoxIntegerProps extends IBaseComponentProps, IValidationProp
15
15
  placeholder?: string;
16
16
  defaultValue?: number;
17
17
  onChanged?: (e: NSBoxInteger) => void;
18
+ onClicked?: (e: NSBoxInteger) => void;
18
19
  }
19
20
 
20
21
  export interface INSBoxIntegerState
@@ -46,10 +47,6 @@ export class NSBoxInteger extends React.Component<INSBoxIntegerProps, INSBoxInte
46
47
  if (error)
47
48
  {
48
49
  this.setState({ error });
49
- setTimeout(() =>
50
- {
51
- this.setState({ error: "" });
52
- }, 7000);
53
50
  throw new Error(error);
54
51
  }
55
52
  return this.state.value;
@@ -70,19 +67,20 @@ export class NSBoxInteger extends React.Component<INSBoxIntegerProps, INSBoxInte
70
67
  {
71
68
  return (
72
69
  <>
73
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
70
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
74
71
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
75
72
  <input
76
- id={this.props.id}
77
- value={this.state.value}
78
- onChange={this.onChanged}
79
73
  type="number"
74
+ name={this.props.name}
80
75
  className={Styles.ns_input}
81
76
  placeholder={this.props.placeholder}
77
+ value={this.state.value}
78
+ onChange={this.onChanged}
79
+ onClick={() => this.props.onClicked}
82
80
  style={{ background: `url(${IconInputInteger}) white no-repeat scroll center right 16px` }}
83
81
  />
84
82
  </div>
85
- <NSBoxErrorNotifier error={this.state.error} />
83
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
86
84
  </>
87
85
  );
88
86
  }
@@ -3,8 +3,9 @@
3
3
  import Styles from './NSBoxLabel.module.css'
4
4
  import React from "react";
5
5
  import { ReactNode } from "react";
6
+ import { IBaseComponentProps } from '../main';
6
7
 
7
- export interface INSBoxLabelProps
8
+ export interface INSBoxLabelProps extends IBaseComponentProps
8
9
  {
9
10
  title: string;
10
11
  children: ReactNode;
@@ -18,7 +19,7 @@ export class NSBoxLabel extends React.Component<INSBoxLabelProps, INSBoxLabelSta
18
19
  override render()
19
20
  {
20
21
  return (
21
- <div className={Styles.ns_tab_item}>
22
+ <div id={this.props.id} className={`${Styles.ns_tab_item} ${this.props.classList?.join(" ")}`} style={this.props.style}>
22
23
  <span className={`${Styles.ns_box_label_title} ns_font_16_bold`}>{this.props.title}</span>
23
24
  <div>
24
25
  {this.props.children}
@@ -43,21 +43,23 @@ function NSBoxOTP(props: INSBoxOTPProps)
43
43
  };
44
44
 
45
45
  return (
46
- <div style={{ display: 'flex', gap: '10px' }}>
47
- {values.map((value, index) => (
48
- <input
49
- key={index + 10}
50
- ref={el => inputsRef.current[index] = el}
51
- type="text"
52
- value={value}
53
- onChange={handleChange(index)}
54
- onKeyDown={handleKeyDown(index)}
55
- maxLength={1}
56
- style={{ width: '30px', textAlign: 'center' }}
57
- className={Styles.ns_otp_input}
58
- />
59
- ))}
60
- </div>
46
+ <div id={props.id} className={`${Styles.ns_input_parent} ${props.classList?.join(" ")}`} style={{ ...props.style, display: 'flex', gap: '10px' }}>
47
+ {
48
+ values.map((value, index) => (
49
+ <input
50
+ key={index + 10}
51
+ ref={el => inputsRef.current[index] = el}
52
+ type="text"
53
+ value={value}
54
+ onChange={handleChange(index)}
55
+ onKeyDown={handleKeyDown(index)}
56
+ maxLength={1}
57
+ style={{ width: '30px', textAlign: 'center' }}
58
+ className={Styles.ns_otp_input}
59
+ />
60
+ ))
61
+ }
62
+ </div >
61
63
  );
62
64
  };
63
65
 
@@ -15,6 +15,7 @@ export interface INSBoxPasswordProps extends IBaseComponentProps, IValidationPro
15
15
  placeholder?: string;
16
16
  defaultValue?: string;
17
17
  onChanged?: (e: NSBoxPassword) => void;
18
+ onClicked?: (e: NSBoxPassword) => void;
18
19
  }
19
20
 
20
21
  export interface INSBoxPasswordState
@@ -46,10 +47,6 @@ export class NSBoxPassword extends React.Component<INSBoxPasswordProps, INSBoxPa
46
47
  if (error)
47
48
  {
48
49
  this.setState({ error });
49
- setTimeout(() =>
50
- {
51
- this.setState({ error: "" });
52
- }, 7000);
53
50
  throw new Error(error);
54
51
  }
55
52
  return this.state.value;
@@ -70,19 +67,20 @@ export class NSBoxPassword extends React.Component<INSBoxPasswordProps, INSBoxPa
70
67
  {
71
68
  return (
72
69
  <>
73
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
70
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
74
71
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
75
72
  <input
76
- id={this.props.id}
77
- value={this.state.value}
78
- onChange={this.onChanged}
79
73
  type="password"
74
+ name={this.props.name}
80
75
  className={Styles.ns_input}
81
76
  placeholder={this.props.placeholder}
77
+ value={this.state.value}
78
+ onChange={this.onChanged}
79
+ onClick={() => this.props.onClicked}
82
80
  style={{ background: `url(${IconInputString}) white no-repeat scroll center right 16px` }}
83
81
  />
84
82
  </div>
85
- <NSBoxErrorNotifier error={this.state.error} />
83
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
86
84
  </>
87
85
  );
88
86
  }
@@ -20,6 +20,7 @@ export interface INSBoxPhoneProps extends IBaseComponentProps, IValidationProps,
20
20
  placeholder?: string;
21
21
  defaultValue?: string;
22
22
  onChanged?: (e: NSBoxPhone) => void;
23
+ onClicked?: (e: NSBoxPhone) => void;
23
24
  }
24
25
 
25
26
  export interface INSBoxPhoneState
@@ -52,12 +53,7 @@ export class NSBoxPhone extends React.Component<INSBoxPhoneProps, INSBoxPhoneSta
52
53
  if (error)
53
54
  {
54
55
  this.setState({ error });
55
- setTimeout(() =>
56
- {
57
- this.setState({ error: "" });
58
- }, 8000);
59
56
  throw new Error(error);
60
-
61
57
  }
62
58
  return this.state.value;
63
59
  }
@@ -74,7 +70,6 @@ export class NSBoxPhone extends React.Component<INSBoxPhoneProps, INSBoxPhoneSta
74
70
  return (
75
71
  <>
76
72
  <div id={this.props.id} className={`${Styles.ns_input_phone_parent} ${Styles.ns_input_parent} ${this.props.classList?.join(" ")} ${this.state.isFullScreen ? Styles.ns_full_screen : ""}`} style={this.props.style}>
77
-
78
73
  <div className="d-flex justify-content-between align-item-center">
79
74
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
80
75
  <div className="d-flex gap-1">
@@ -108,7 +103,7 @@ export class NSBoxPhone extends React.Component<INSBoxPhoneProps, INSBoxPhoneSta
108
103
  }}
109
104
  />
110
105
  </div >
111
- <NSBoxErrorNotifier error={this.state.error} />
106
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
112
107
  </>
113
108
  );
114
109
  }
@@ -15,6 +15,7 @@ export interface INSBoxPriceProps extends IBaseComponentProps, IValidationProps,
15
15
  placeholder?: number;
16
16
  defaultValue?: number;
17
17
  onChanged?: (e: NSBoxPrice) => void;
18
+ onClicked?: (e: NSBoxPrice) => void;
18
19
  }
19
20
 
20
21
  export interface INSBoxPriceState
@@ -46,10 +47,6 @@ export class NSBoxPrice extends React.Component<INSBoxPriceProps, INSBoxPriceSta
46
47
  if (error)
47
48
  {
48
49
  this.setState({ error });
49
- setTimeout(() =>
50
- {
51
- this.setState({ error: "" });
52
- }, 7000);
53
50
  throw new Error(error);
54
51
  }
55
52
  return this.state.value;
@@ -70,21 +67,22 @@ export class NSBoxPrice extends React.Component<INSBoxPriceProps, INSBoxPriceSta
70
67
  {
71
68
  return (
72
69
  <>
73
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
70
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
74
71
  <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
75
72
  <input
76
- id={this.props.id}
73
+ type="number"
74
+ name={this.props.name}
75
+ className={Styles.ns_input}
76
+ placeholder={this.props.placeholder?.toString.name}
77
77
  value={this.state.value}
78
78
  onChange={this.onChanged}
79
- type="number"
79
+ onClick={() => this.props.onClicked}
80
80
  step="0.01"
81
81
  min="0"
82
- className={Styles.ns_input}
83
- placeholder={this.props.placeholder?.toString.name}
84
82
  style={{ background: `url(${IconInputFloat}) white no-repeat scroll center right 16px` }}
85
83
  />
86
84
  </div>
87
- <NSBoxErrorNotifier error={this.state.error} />
85
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
88
86
  </>
89
87
  );
90
88
  }
@@ -18,6 +18,7 @@ export interface INSBoxStringProps extends IBaseComponentProps, IValidationProps
18
18
  placeholder?: string;
19
19
  defaultValue?: string;
20
20
  onChanged?: (e: NSBoxString) => void;
21
+ onClicked?: (e: NSBoxString) => void;
21
22
  }
22
23
 
23
24
  export interface INSBoxStringState
@@ -51,12 +52,7 @@ export class NSBoxString extends React.Component<INSBoxStringProps, INSBoxString
51
52
  if (error)
52
53
  {
53
54
  this.setState({ error });
54
- setTimeout(() =>
55
- {
56
- this.setState({ error: "" });
57
- }, 7000);
58
- // throw new Error(error);
59
- return '';
55
+ throw new Error(error);
60
56
  }
61
57
  return this.state.value;
62
58
  }
@@ -80,7 +76,7 @@ export class NSBoxString extends React.Component<INSBoxStringProps, INSBoxString
80
76
  {
81
77
  return (
82
78
  <>
83
- <div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")} ${this.state.isFullScreen ? Styles.ns_full_screen : ""}`} style={this.props.style}>
79
+ <div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")} ${this.state.isFullScreen ? Styles.ns_full_screen : ""}`} style={this.props.style}>
84
80
  <div className="d-flex justify-content-between align-items-center">
85
81
  <span className={Styles.ns_input_title}>
86
82
  {this.props.required && <span style={{ color: "red" }}>*</span>} {this.props.title}
@@ -105,14 +101,16 @@ export class NSBoxString extends React.Component<INSBoxStringProps, INSBoxString
105
101
  </div>
106
102
  </div>
107
103
  <input
108
- id={this.props.id}
109
- value={this.state.value}
110
- onChange={this.onChanged}
111
104
  type="text"
105
+ name={this.props.name}
112
106
  className={Styles.ns_input}
113
107
  placeholder={this.props.placeholder}
108
+ value={this.state.value}
109
+ onChange={this.onChanged}
110
+ onClick={() => this.props.onClicked}
114
111
  style={{ background: `url(${IconInputString}) white no-repeat scroll center right 16px` }}
115
112
  />
113
+ {/* Todo make a new component for fullscreen */}
116
114
  <div className={Styles.ns_input_modal_full_screen} style={{ display: this.state.isFullScreen === false ? "none" : "block" }} >
117
115
  <div>
118
116
  <img
@@ -131,7 +129,7 @@ export class NSBoxString extends React.Component<INSBoxStringProps, INSBoxString
131
129
  ></textarea>
132
130
  </div>
133
131
  </div>
134
- <NSBoxErrorNotifier error={this.state.error} />
132
+ <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
135
133
  </>
136
134
  );
137
135
  }