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.
Files changed (223) hide show
  1. package/dist/App.js +2 -2
  2. package/dist/App.js.map +1 -1
  3. package/dist/Validator.d.ts +7 -2
  4. package/dist/Validator.js +57 -15
  5. package/dist/Validator.js.map +1 -1
  6. package/dist/components/NSButton.d.ts +0 -9
  7. package/dist/components/NSButton.js +2 -9
  8. package/dist/components/NSButton.js.map +1 -1
  9. package/dist/components/NSButton.module.css +8 -7
  10. package/dist/components/NSButtonBlue.d.ts +2 -14
  11. package/dist/components/NSButtonBlue.js +7 -13
  12. package/dist/components/NSButtonBlue.js.map +1 -1
  13. package/dist/components/NSButtonBlue.module.css +0 -8
  14. package/dist/components/NSButtonGreen.d.ts +2 -14
  15. package/dist/components/NSButtonGreen.js +7 -13
  16. package/dist/components/NSButtonGreen.js.map +1 -1
  17. package/dist/components/NSButtonGreen.module.css +0 -8
  18. package/dist/components/NSButtonRed.d.ts +2 -14
  19. package/dist/components/NSButtonRed.js +8 -14
  20. package/dist/components/NSButtonRed.js.map +1 -1
  21. package/dist/components/NSButtonRed.module.css +0 -8
  22. package/dist/components/NSCard.d.ts +3 -9
  23. package/dist/components/NSCard.js +12 -16
  24. package/dist/components/NSCard.js.map +1 -1
  25. package/dist/components/NSCopyToClipboard.d.ts +1 -8
  26. package/dist/components/NSCopyToClipboard.js +6 -14
  27. package/dist/components/NSCopyToClipboard.js.map +1 -1
  28. package/dist/components/NSCopyToClipboard.module.css +1 -1
  29. package/dist/components/NSEntityBar.d.ts +3 -9
  30. package/dist/components/NSEntityBar.js +3 -6
  31. package/dist/components/NSEntityBar.js.map +1 -1
  32. package/dist/components/NSEntityBar.module.css +1 -1
  33. package/dist/components/NSEntityCardBackground.d.ts +1 -11
  34. package/dist/components/NSEntityCardBackground.js +4 -23
  35. package/dist/components/NSEntityCardBackground.js.map +1 -1
  36. package/dist/components/NSFooter.js +2 -1
  37. package/dist/components/NSFooter.js.map +1 -1
  38. package/dist/components/NSHeader.d.ts +1 -2
  39. package/dist/components/NSHeader.js +9 -4
  40. package/dist/components/NSHeader.js.map +1 -1
  41. package/dist/components/NSInput.module.css +29 -0
  42. package/dist/components/NSInputDate.d.ts +3 -1
  43. package/dist/components/NSInputDate.js +14 -4
  44. package/dist/components/NSInputDate.js.map +1 -1
  45. package/dist/components/NSInputDate.module.css +4 -1
  46. package/dist/components/NSInputDuration.d.ts +6 -1
  47. package/dist/components/NSInputDuration.js +15 -6
  48. package/dist/components/NSInputDuration.js.map +1 -1
  49. package/dist/components/NSInputEmail.d.ts +1 -1
  50. package/dist/components/NSInputEmail.js +5 -3
  51. package/dist/components/NSInputEmail.js.map +1 -1
  52. package/dist/components/NSInputFloat.d.ts +4 -4
  53. package/dist/components/NSInputFloat.js +8 -9
  54. package/dist/components/NSInputFloat.js.map +1 -1
  55. package/dist/components/NSInputIP.d.ts +5 -1
  56. package/dist/components/NSInputIP.js +17 -7
  57. package/dist/components/NSInputIP.js.map +1 -1
  58. package/dist/components/NSInputInteger.d.ts +9 -5
  59. package/dist/components/NSInputInteger.js +16 -8
  60. package/dist/components/NSInputInteger.js.map +1 -1
  61. package/dist/components/NSInputPassword.d.ts +5 -1
  62. package/dist/components/NSInputPassword.js +15 -6
  63. package/dist/components/NSInputPassword.js.map +1 -1
  64. package/dist/components/NSInputPhone.d.ts +8 -3
  65. package/dist/components/NSInputPhone.js +18 -12
  66. package/dist/components/NSInputPhone.js.map +1 -1
  67. package/dist/components/NSInputPrice.d.ts +7 -2
  68. package/dist/components/NSInputPrice.js +15 -7
  69. package/dist/components/NSInputPrice.js.map +1 -1
  70. package/dist/components/NSInputSearch.d.ts +6 -1
  71. package/dist/components/NSInputSearch.js +15 -6
  72. package/dist/components/NSInputSearch.js.map +1 -1
  73. package/dist/components/NSInputString.d.ts +5 -1
  74. package/dist/components/NSInputString.js +15 -6
  75. package/dist/components/NSInputString.js.map +1 -1
  76. package/dist/components/NSInputText.d.ts +5 -1
  77. package/dist/components/NSInputText.js +15 -6
  78. package/dist/components/NSInputText.js.map +1 -1
  79. package/dist/components/NSInputTime.d.ts +5 -1
  80. package/dist/components/NSInputTime.js +16 -6
  81. package/dist/components/NSInputTime.js.map +1 -1
  82. package/dist/components/NSLayout.js +2 -2
  83. package/dist/components/NSLayout.js.map +1 -1
  84. package/dist/components/NSLayoutHeroBanner.js.map +1 -1
  85. package/dist/components/NSLinkBlue.d.ts +1 -9
  86. package/dist/components/NSLinkBlue.js +3 -17
  87. package/dist/components/NSLinkBlue.js.map +1 -1
  88. package/dist/components/NSLoading.d.ts +1 -6
  89. package/dist/components/NSLoading.js +2 -6
  90. package/dist/components/NSLoading.js.map +1 -1
  91. package/dist/components/NSNotification.js +2 -2
  92. package/dist/components/NSNotification.js.map +1 -1
  93. package/dist/components/NSPagination.d.ts +1 -1
  94. package/dist/components/NSPagination.js +2 -1
  95. package/dist/components/NSPagination.js.map +1 -1
  96. package/dist/components/NSPanel.d.ts +2 -7
  97. package/dist/components/NSPanel.js +3 -9
  98. package/dist/components/NSPanel.js.map +1 -1
  99. package/dist/components/NSSection.d.ts +2 -10
  100. package/dist/components/NSSection.js +6 -25
  101. package/dist/components/NSSection.js.map +1 -1
  102. package/dist/components/NSSectionBars.d.ts +2 -6
  103. package/dist/components/NSSectionBars.js +4 -8
  104. package/dist/components/NSSectionBars.js.map +1 -1
  105. package/dist/components/NSSectionCards.d.ts +4 -14
  106. package/dist/components/NSSectionCards.js +7 -11
  107. package/dist/components/NSSectionCards.js.map +1 -1
  108. package/dist/components/NSSectionTitle.d.ts +3 -10
  109. package/dist/components/NSSectionTitle.js +2 -6
  110. package/dist/components/NSSectionTitle.js.map +1 -1
  111. package/dist/components/NSSelectBox.d.ts +6 -3
  112. package/dist/components/NSSelectBox.js +21 -6
  113. package/dist/components/NSSelectBox.js.map +1 -1
  114. package/dist/components/NSSpace.js +2 -1
  115. package/dist/components/NSSpace.js.map +1 -1
  116. package/dist/components/NSTable.js +2 -1
  117. package/dist/components/NSTable.js.map +1 -1
  118. package/dist/components/NSTitle.d.ts +1 -6
  119. package/dist/components/NSTitle.js +3 -6
  120. package/dist/components/NSTitle.js.map +1 -1
  121. package/dist/main.d.ts +0 -1
  122. package/dist/main.js +0 -1
  123. package/dist/main.js.map +1 -1
  124. package/dist/pages/NSLoginPage.d.ts +2 -3
  125. package/dist/pages/NSLoginPage.js +4 -3
  126. package/dist/pages/NSLoginPage.js.map +1 -1
  127. package/dist/props/BaseComponentProps.d.ts +1 -0
  128. package/dist/props/ValidationNumberProps.d.ts +1 -2
  129. package/dist/props/ValidationProps.d.ts +1 -0
  130. package/dist/props/ValidationStringProps.d.ts +1 -2
  131. package/package.json +3 -4
  132. package/src/App.tsx +14 -4
  133. package/src/Validator.ts +67 -18
  134. package/src/components/NSButton.module.css +8 -7
  135. package/src/components/NSButton.tsx +6 -24
  136. package/src/components/NSButtonBlue.module.css +0 -8
  137. package/src/components/NSButtonBlue.tsx +8 -28
  138. package/src/components/NSButtonGreen.module.css +0 -8
  139. package/src/components/NSButtonGreen.tsx +8 -29
  140. package/src/components/NSButtonRed.module.css +0 -8
  141. package/src/components/NSButtonRed.tsx +9 -30
  142. package/src/components/NSCard.tsx +49 -56
  143. package/src/components/NSCopyToClipboard.module.css +1 -1
  144. package/src/components/NSCopyToClipboard.tsx +21 -35
  145. package/src/components/NSEntityBar.module.css +1 -1
  146. package/src/components/NSEntityBar.tsx +17 -23
  147. package/src/components/NSEntityCardBackground.tsx +22 -56
  148. package/src/components/NSFooter.tsx +4 -1
  149. package/src/components/NSHeader.tsx +16 -7
  150. package/src/components/NSInput.module.css +29 -0
  151. package/src/components/NSInputDate.module.css +4 -1
  152. package/src/components/NSInputDate.tsx +29 -10
  153. package/src/components/NSInputDuration.tsx +44 -23
  154. package/src/components/NSInputEmail.tsx +10 -5
  155. package/src/components/NSInputFloat.tsx +33 -32
  156. package/src/components/NSInputIP.tsx +44 -24
  157. package/src/components/NSInputInteger.tsx +48 -31
  158. package/src/components/NSInputPassword.tsx +42 -23
  159. package/src/components/NSInputPhone.tsx +45 -29
  160. package/src/components/NSInputPrice.tsx +45 -23
  161. package/src/components/NSInputSearch.tsx +43 -21
  162. package/src/components/NSInputString.tsx +42 -23
  163. package/src/components/NSInputText.tsx +42 -23
  164. package/src/components/NSInputTime.tsx +44 -23
  165. package/src/components/NSLayout.tsx +3 -3
  166. package/src/components/NSLayoutHeroBanner.tsx +0 -1
  167. package/src/components/NSLinkBlue.tsx +12 -32
  168. package/src/components/NSLoading.tsx +8 -17
  169. package/src/components/NSNotification.tsx +19 -14
  170. package/src/components/NSPagination.tsx +4 -3
  171. package/src/components/NSPanel.tsx +10 -21
  172. package/src/components/NSSection.tsx +13 -39
  173. package/src/components/NSSectionBars.tsx +13 -22
  174. package/src/components/NSSectionCards.tsx +30 -45
  175. package/src/components/NSSectionTitle.tsx +10 -20
  176. package/src/components/NSSelectBox.tsx +48 -23
  177. package/src/components/NSSpace.tsx +3 -1
  178. package/src/components/NSTable.tsx +6 -4
  179. package/src/components/NSTitle.tsx +10 -15
  180. package/src/main.ts +0 -1
  181. package/src/pages/NSLoginPage.tsx +8 -6
  182. package/src/props/BaseComponentProps.ts +1 -0
  183. package/src/props/ValidationNumberProps.ts +1 -3
  184. package/src/props/ValidationProps.ts +1 -0
  185. package/src/props/ValidationStringProps.ts +1 -3
  186. package/dist/components/NSButtonBlueVector.d.ts +0 -16
  187. package/dist/components/NSButtonBlueVector.js +0 -17
  188. package/dist/components/NSButtonBlueVector.js.map +0 -1
  189. package/dist/components/NSButtonBlueVector.module.css +0 -17
  190. package/dist/components/NSInputDuration.module.css +0 -26
  191. package/dist/components/NSInputEmail.module.css +0 -38
  192. package/dist/components/NSInputFloat.module.css +0 -26
  193. package/dist/components/NSInputIP.module.css +0 -26
  194. package/dist/components/NSInputInteger.module.css +0 -26
  195. package/dist/components/NSInputPassword.module.css +0 -27
  196. package/dist/components/NSInputPhone.module.css +0 -33
  197. package/dist/components/NSInputPrice.module.css +0 -27
  198. package/dist/components/NSInputSearch.module.css +0 -27
  199. package/dist/components/NSInputString.module.css +0 -27
  200. package/dist/components/NSInputText.module.css +0 -28
  201. package/dist/components/NSInputTime.module.css +0 -27
  202. package/dist/props/BackgroundProps.d.ts +0 -6
  203. package/dist/props/BackgroundProps.js +0 -2
  204. package/dist/props/BackgroundProps.js.map +0 -1
  205. package/dist/props/NSButtonProps.d.ts +0 -11
  206. package/dist/props/NSButtonProps.js +0 -2
  207. package/dist/props/NSButtonProps.js.map +0 -1
  208. package/src/components/NSButtonBlueVector.module.css +0 -17
  209. package/src/components/NSButtonBlueVector.tsx +0 -42
  210. package/src/components/NSInputDuration.module.css +0 -26
  211. package/src/components/NSInputEmail.module.css +0 -38
  212. package/src/components/NSInputFloat.module.css +0 -26
  213. package/src/components/NSInputIP.module.css +0 -26
  214. package/src/components/NSInputInteger.module.css +0 -26
  215. package/src/components/NSInputPassword.module.css +0 -27
  216. package/src/components/NSInputPhone.module.css +0 -33
  217. package/src/components/NSInputPrice.module.css +0 -27
  218. package/src/components/NSInputSearch.module.css +0 -27
  219. package/src/components/NSInputString.module.css +0 -27
  220. package/src/components/NSInputText.module.css +0 -28
  221. package/src/components/NSInputTime.module.css +0 -27
  222. package/src/props/BackgroundProps.ts +0 -7
  223. package/src/props/NSButtonProps.ts +0 -12
@@ -1,42 +1,22 @@
1
- "use client";
2
-
3
1
  import { BaseComponentProps } from "../props/BaseComponentProps";
4
2
  import { LinkProps } from "../props/LinkProps";
5
3
  import Styles from "./NSLinkBlue.module.css";
6
- import React from "react";
7
4
 
8
5
  export interface NSLinkBlueProps extends LinkProps, BaseComponentProps
9
6
  {
10
7
  }
11
8
 
12
- export interface NSLinkBlueState extends LinkProps
9
+ export function NSLinkBlue(props: NSLinkBlueProps)
13
10
  {
14
- }
15
-
16
- export class NSLinkBlue extends React.Component<NSLinkBlueProps, NSLinkBlueState>
17
- {
18
- constructor(props: NSLinkBlueProps)
19
- {
20
- super(props);
21
- this.state = { title: props.title, href: props.href, target: props.target };
22
- }
23
- setTitle(title: string)
24
- {
25
- this.setState({ title });
26
- }
27
- setHRef(href: string)
28
- {
29
- this.setState({ href });
30
- }
31
- override render()
32
- {
33
- return (
34
-
35
- <div className={Styles.ns_link_parent} style={this.props.style}>
36
- <a className={`text-white text-decoration-none ${this.props.title ? Styles.ns_link : Styles.ns_link_absolute}`} href={this.state.href} target={this.state?.target ?? "_self"} >
37
- {this.state.title}
38
- </a>
39
- </div>
40
- )
41
- }
11
+ return (
12
+ <div
13
+ id={props.id}
14
+ className={Styles.ns_link_parent}
15
+ style={props.style}
16
+ >
17
+ <a className={`text-white text-decoration-none ${props.title ? Styles.ns_link : Styles.ns_link_absolute}`} href={props.href} target={props?.target ?? "_self"} >
18
+ {props.title}
19
+ </a>
20
+ </div>
21
+ )
42
22
  }
@@ -1,27 +1,18 @@
1
- "use client";
2
-
3
- import { Component } from 'react';
4
1
  import Styles from './NSLoading.module.css';
5
2
  import { NSSection } from './NSSection';
6
- import { BackgroundProps } from '../props/BackgroundProps';
7
3
  import { BaseComponentProps } from "../props/BaseComponentProps";
8
4
 
9
5
  export interface NSLoadingProps extends BaseComponentProps
10
6
  {
11
- background?: BackgroundProps;
12
7
  }
13
8
 
14
- export class NSLoading extends Component<NSLoadingProps>
9
+ export function NSLoading(props: NSLoadingProps)
15
10
  {
16
- override render()
17
- {
18
- return (
19
- <NSSection background={this.props.background} >
20
- <div className={Styles.ns_loading_parent}>
21
- <div className={Styles.ns_loader}></div>
22
- </div>
23
- </NSSection>
24
- );
25
- }
11
+ return (
12
+ <NSSection {...props}>
13
+ <div className={Styles.ns_loading_parent}>
14
+ <div className={Styles.ns_loader}></div>
15
+ </div>
16
+ </NSSection>
17
+ );
26
18
  }
27
-
@@ -47,21 +47,26 @@ export class NSNotification extends React.Component<NSNotificationProps, NSNotif
47
47
 
48
48
  override render()
49
49
  {
50
- let style = Styles["ns_" + this.props.type.toString().toLowerCase];
50
+ let className = Styles["ns_" + this.props.type.toString().toLowerCase];
51
51
  return <>
52
- {this.state.show && (
53
- <div className={`${Styles.ns_messenger} ${style}`}>
54
- <p className={`mb-0 ns-font-16-normal`}>{this.props.title}</p>
55
- <img
56
- className={Styles.ns_exit_icon}
57
- src={Exit}
58
- alt="exit"
59
- width={32}
60
- height={32}
61
- onClick={() => this.handleDestroy()}
62
- />
63
- </div>
64
- )}
52
+ {
53
+ this.state.show && (
54
+ <div id={this.props.id}
55
+ className={`${Styles.ns_messenger} ${className}`}
56
+ style={this.props.style}
57
+ >
58
+ <p className={`mb-0 ns-font-16-normal`}>{this.props.title}</p>
59
+ <img
60
+ className={Styles.ns_exit_icon}
61
+ src={Exit}
62
+ alt="exit"
63
+ width={32}
64
+ height={32}
65
+ onClick={() => this.handleDestroy()}
66
+ />
67
+ </div>
68
+ )
69
+ }
65
70
  </>
66
71
  }
67
72
  }
@@ -15,8 +15,7 @@ export interface NSPaginationState
15
15
  size: number;
16
16
  page: number;
17
17
  }
18
-
19
- export class NSPagination extends Component<NSPaginationState, NSPaginationProps>
18
+ export class NSPagination extends Component<NSPaginationProps, NSPaginationState>
20
19
  {
21
20
  constructor(props: NSPaginationProps)
22
21
  {
@@ -88,7 +87,9 @@ export class NSPagination extends Component<NSPaginationState, NSPaginationProps
88
87
  );
89
88
 
90
89
  return (
91
- <div className={`${Styles.ns_pagination_container}`}>
90
+ <div id={this.props.id}
91
+ className={`${Styles.ns_pagination_container} ${this.props.classList?.join(" ")}`}
92
+ style={this.props.style}>
92
93
  {arr.map(x => (x))}
93
94
  </div>
94
95
  );
@@ -1,6 +1,4 @@
1
- "use client";
2
-
3
- import { Component, ReactNode } from "react";
1
+ import { ReactNode } from "react";
4
2
  import Styles from './NSPanel.module.css';
5
3
  import { BaseComponentProps } from "../props/BaseComponentProps";
6
4
 
@@ -9,23 +7,14 @@ export interface NSSectionProps extends BaseComponentProps
9
7
  children: ReactNode;
10
8
  grid: boolean;
11
9
  }
12
-
13
- export interface NSSectionState
14
- { }
15
-
16
- export class NSPanel extends Component<NSSectionProps, NSSectionState>
10
+ export function NSPanel(props: NSSectionProps)
17
11
  {
18
- constructor(props: NSSectionProps)
19
- {
20
- super(props);
21
- }
22
- override render()
23
- {
24
- return (
25
- <section
26
- className={this.props.grid ? Styles.ns_panel_grid : Styles.ns_panel_column} >
27
- {this.props.children}
28
- </section>
29
- );
30
- }
12
+ return (
13
+ <section id={props.id}
14
+ className={`${props.grid ? Styles.ns_panel_grid : Styles.ns_panel_column} ${props.classList?.join(" ")}`}
15
+ style={props.style}
16
+ >
17
+ {props.children}
18
+ </section>
19
+ );
31
20
  }
@@ -1,50 +1,24 @@
1
- "use client";
2
-
3
- import { Component, ReactNode } from "react";
1
+ import { ReactNode } from "react";
4
2
  import Styles from './NSSection.module.css'
5
- import { BackgroundProps } from "../props/BackgroundProps";
6
3
  import { BaseComponentProps } from "../props/BaseComponentProps";
7
4
 
8
5
  export interface NSSectionProps extends BaseComponentProps
9
6
  {
10
7
  children: ReactNode;
11
- background?: BackgroundProps;
12
8
  center_items?: boolean;
13
9
  }
14
10
 
15
- export interface NSSectionState
16
- {
17
- background?: BackgroundProps;
18
- }
19
-
20
- export class NSSection extends Component<NSSectionProps, NSSectionState>
11
+ export function NSSection(props: NSSectionProps)
21
12
  {
22
- constructor(props: NSSectionProps)
23
- {
24
- super(props);
25
- this.state = {
26
- background: {
27
- image: `url(${props.background?.image})`,
28
- color: props.background?.color,
29
- position: props.background?.position
30
- }
31
- }
32
- }
33
- override render()
34
- {
35
- let styles = [Styles.ns_section];
36
- if (this.props.center_items)
37
- styles.push(Styles.ns_section_center);
38
- return (
39
- <section style=
40
- {{
41
- backgroundImage: this.state.background?.image,
42
- backgroundColor: this.state.background?.color,
43
- backgroundPosition: this.state.background?.position
44
- }}
45
- className={styles.join(" ")} >
46
- {this.props.children}
47
- </section>
48
- );
49
- }
13
+ let styles = [Styles.ns_section];
14
+ if (props.center_items)
15
+ styles.push(Styles.ns_section_center);
16
+ return (
17
+ <section id={props.id}
18
+ className={`${styles.join(" ")} ${props.classList?.join(" ")}`}
19
+ style={props.style}
20
+ >
21
+ {props.children}
22
+ </section>
23
+ );
50
24
  }
@@ -1,35 +1,26 @@
1
- "use client";
2
-
3
- import { Component } from 'react';
4
1
  import Styles from './NSSectionBars.module.css';
5
2
  import { NSEntityBar, NSEntityBarProps } from './NSEntityBar';
6
3
  import { NSSection } from './NSSection';
7
- import { BackgroundProps } from '../props/BackgroundProps';
8
4
  import { NSSpace, NSSpaceSizeType } from './NSSpace';
9
5
  import { BaseComponentProps } from "../props/BaseComponentProps";
10
6
 
11
7
  export interface NSSectionBarsProps extends BaseComponentProps
12
8
  {
13
- background?: BackgroundProps;
9
+ title?: string;
14
10
  bars: NSEntityBarProps[]
15
11
  }
16
12
 
17
- export class NSSectionBars extends Component<NSSectionBarsProps>
13
+ export function NSSectionBars(props: NSSectionBarsProps)
18
14
  {
19
- override render()
20
- {
21
- return (
22
- <>
23
- <NSSection background={this.props.background} >
24
- <NSSpace size={NSSpaceSizeType.NORMAL} />
25
- <div className={`container mx-auto px-4 lg:px-12 ${Styles.ns_entity_bar_container}`}>
26
- {
27
- this.props.bars?.map((bar) => <NSEntityBar key={bar.id} {...bar} />)
28
- }
29
- </div>
30
- <NSSpace size={NSSpaceSizeType.NORMAL} />
31
- </NSSection>
32
- </>
33
- );
34
- }
15
+ return (
16
+ <NSSection {...props} >
17
+ <NSSpace size={NSSpaceSizeType.NORMAL} />
18
+ <div className={`container mx-auto px-4 lg:px-12 ${Styles.ns_entity_bar_container}`}>
19
+ {
20
+ props.bars?.map((bar) => <NSEntityBar key={bar.id} {...bar} />)
21
+ }
22
+ </div>
23
+ <NSSpace size={NSSpaceSizeType.NORMAL} />
24
+ </NSSection>
25
+ );
35
26
  }
@@ -1,67 +1,52 @@
1
- "use client";
2
-
3
- import { Component } from 'react';
4
1
  import Styles from './NSSectionCards.module.css';
5
2
  import { NSTitle } from './NSTitle';
6
3
  import { NSCard, NSCardProps } from './NSCard';
7
4
  import { NSSection } from './NSSection';
8
5
  import { NSLinkBlue } from './NSLinkBlue';
9
- import { BackgroundProps } from '../props/BackgroundProps';
10
6
  import { NSSpace, NSSpaceSizeType } from './NSSpace';
11
7
  import { BaseComponentProps } from "../props/BaseComponentProps";
8
+ import { LinkProps } from '../props/LinkProps';
12
9
 
13
10
  export interface NSSectionCardsProps extends BaseComponentProps
14
11
  {
15
- title?: {
16
- text: string,
17
- color?: string
18
- };
12
+ title?: string;
19
13
  description?: {
20
14
  text: string,
21
15
  color?: string
22
16
  };
23
- background?: BackgroundProps
24
- button?: {
25
- href: string;
26
- title: string;
27
- };
17
+ button?: LinkProps;
28
18
  cards: NSCardProps[];
29
19
  }
30
20
 
31
- export class NSSectionCards extends Component<NSSectionCardsProps>
21
+ export function NSSectionCards(props: NSSectionCardsProps)
32
22
  {
33
- override render()
34
- {
35
- return (
36
- <>
37
- <NSSection background={this.props.background} >
38
- <NSSpace size={NSSpaceSizeType.NORMAL} />
39
- <div className={`container mx-auto px-4 lg:px-12 ${Styles.ns_section_cards_holder}`}>
40
- {
41
- this.props.title &&
42
- <div className={Styles.ns_section_cards_title_container}>
43
- <NSTitle color={this.props.title?.color} title={this.props.title?.text} />
44
- {
45
- this.props.description &&
46
- <p style={{ color: this.props.description?.color }} className={Styles.ns_description}> {this.props.description.text} </p>
47
- }
48
- </div>
49
- }
50
- <div className={` ${Styles.ns_card_container}`}>
51
- {
52
- this.props.cards?.map((card) => <NSCard key={card.id} {...card} />)
53
- }
54
- </div>
23
+ return (
24
+ <NSSection {...props} >
25
+ <NSSpace size={NSSpaceSizeType.NORMAL} />
26
+ <div className={`container mx-auto px-4 lg:px-12 ${Styles.ns_section_cards_holder}`}>
27
+ {
28
+ props.title &&
29
+ <div className={Styles.ns_section_cards_title_container}>
30
+ <NSTitle title={props.title} />
55
31
  {
56
- this.props.button &&
57
- <div className={`mt-12 w-full- text-center ${Styles.ns_section_cards_link_container}`}>
58
- <NSLinkBlue href={this.props.button?.href} title={this.props.button?.title} />
59
- </div>
32
+ props.description &&
33
+ <p style={{ color: props.description?.color }} className={Styles.ns_description}> {props.description.text} </p>
60
34
  }
61
35
  </div>
62
- <NSSpace size={NSSpaceSizeType.NORMAL} />
63
- </NSSection>
64
- </>
65
- );
66
- }
36
+ }
37
+ <div className={` ${Styles.ns_card_container}`}>
38
+ {
39
+ props.cards?.map((card) => <NSCard key={card.id} {...card} />)
40
+ }
41
+ </div>
42
+ {
43
+ props.button &&
44
+ <div className={`mt-12 w-full- text-center ${Styles.ns_section_cards_link_container}`}>
45
+ <NSLinkBlue {...props.button} />
46
+ </div>
47
+ }
48
+ </div>
49
+ <NSSpace size={NSSpaceSizeType.NORMAL} />
50
+ </NSSection>
51
+ );
67
52
  }
@@ -1,32 +1,22 @@
1
- "use client";
2
-
3
- import { Component, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
4
2
  import { NSSection } from './NSSection';
5
3
  import { NSTitle } from './NSTitle';
6
- import { BackgroundProps } from '../props/BackgroundProps';
7
4
  import { NSSpace, NSSpaceSizeType } from './NSSpace';
8
5
  import { BaseComponentProps } from "../props/BaseComponentProps";
9
6
 
10
7
  export interface NSSectionTitleProps extends BaseComponentProps
11
8
  {
12
- title: {
13
- text: string,
14
- color?: string
15
- };
16
- background?: BackgroundProps
9
+ title: string;
17
10
  children: ReactNode
18
11
  }
19
12
 
20
- export class NSSectionTitle extends Component<NSSectionTitleProps>
13
+ export function NSSectionTitle(props: NSSectionTitleProps)
21
14
  {
22
- override render()
23
- {
24
- return (
25
- <NSSection background={this.props.background} >
26
- <NSSpace size={NSSpaceSizeType.NORMAL} />
27
- <NSTitle color={this.props.title.color} title={this.props.title.text} />
28
- {this.props.children}
29
- </NSSection>
30
- );
31
- }
15
+ return (
16
+ <NSSection {...props} >
17
+ <NSSpace size={NSSpaceSizeType.NORMAL} />
18
+ <NSTitle title={props.title} />
19
+ {props.children}
20
+ </NSSection>
21
+ );
32
22
  }
@@ -6,8 +6,11 @@ import { Select, Space } from 'antd';
6
6
  import type { SelectProps } from 'antd';
7
7
  import IconSelectBox from '../assets/images/icon-select-box.svg';
8
8
  import { BaseComponentProps } from "../props/BaseComponentProps";
9
+ import { ValidationProps } from "../props/ValidationProps";
10
+ import { Validator } from "../Validator";
11
+ import { NSInputErrorNotifier } from "./NSInputErrorNotifier";
9
12
 
10
- export interface NSSelectBoxProps extends BaseComponentProps
13
+ export interface NSSelectBoxProps extends BaseComponentProps, ValidationProps
11
14
  {
12
15
  title: string;
13
16
  options: SelectProps['options'];
@@ -17,6 +20,7 @@ export interface NSSelectBoxState
17
20
  {
18
21
  value: string | null;
19
22
  values: string[];
23
+ error?: string;
20
24
  }
21
25
 
22
26
  export class NSSelectBox extends React.Component<NSSelectBoxProps, NSSelectBoxState>
@@ -31,43 +35,64 @@ export class NSSelectBox extends React.Component<NSSelectBoxProps, NSSelectBoxSt
31
35
  this.getValues = this.getValues.bind(this);
32
36
  this.setValues = this.setValues.bind(this);
33
37
  }
34
- setValue(value: string | null): void
38
+ getError(): string | null
35
39
  {
36
- this.setState({ value });
40
+ return (
41
+ Validator.getError(this.props.title, this.state.value, this.props)
42
+ );
37
43
  }
38
44
  getValue(): string | null
39
45
  {
46
+ let error = this.getError();
47
+ if (error)
48
+ {
49
+ this.setState({ error });
50
+ throw new Error(error);
51
+ }
40
52
  return this.state.value;
41
53
  }
42
- setValues(values: string[]): void
54
+ setValue(value: string | null): void
43
55
  {
44
- this.setState({ values });
56
+ this.setState({ value });
45
57
  }
46
58
  getValues(): string[]
47
59
  {
60
+ let error = this.getError();
61
+ if (error)
62
+ {
63
+ this.setState({ error });
64
+ throw new Error(error);
65
+ }
48
66
  return this.state.values;
49
67
  }
68
+ setValues(values: string[]): void
69
+ {
70
+ this.setState({ values });
71
+ }
50
72
  override render()
51
73
  {
52
74
  return (
53
- <div className={`${Styles.ns_input_parent} p-2`}>
54
- <span className={Styles.ns_input_title}>{this.props.title}</span>
55
- <Select
56
- mode="multiple"
57
- style={{ width: '100%' }}
58
- className={Styles.ns_input_select}
59
- placeholder="Combo Box"
60
- onChange={this.setValues}
61
- optionLabelProp="label"
62
- options={this.props.options}
63
- optionRender={(option) => (
64
- <Space className={Styles.ns_input_select_option}>
65
- {option.data.desc}
66
- </Space>
67
- )}
68
- suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
69
- />
70
- </div>
75
+ <>
76
+ <div className={`${Styles.ns_input_parent} p-2`}>
77
+ <span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
78
+ <Select
79
+ mode="multiple"
80
+ style={{ width: '100%' }}
81
+ className={Styles.ns_input_select}
82
+ placeholder="Combo Box"
83
+ onChange={this.setValues}
84
+ optionLabelProp="label"
85
+ options={this.props.options}
86
+ optionRender={(option) => (
87
+ <Space className={Styles.ns_input_select_option}>
88
+ {option.data.desc}
89
+ </Space>
90
+ )}
91
+ suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
92
+ />
93
+ </div>
94
+ <NSInputErrorNotifier error={this.state.error} />
95
+ </>
71
96
  );
72
97
  }
73
98
  }
@@ -22,6 +22,8 @@ export enum NSSpaceSizeType
22
22
  export function NSSpace(props: NSSpaceProps)
23
23
  {
24
24
  return (
25
- <hr style={{ width: "100%", height: props.size, margin: "0px", padding: "0px", background: "transparent", color: "transparent", border: 0 }} />
25
+ <hr id={props.id}
26
+ className={props.classList?.join(" ")}
27
+ style={{ ...props.style, width: "100%", height: props.size, margin: "0px", padding: "0px", background: "transparent", color: "transparent", border: 0 }} />
26
28
  );
27
29
  }
@@ -55,9 +55,11 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
55
55
  return (row as any)[column];
56
56
  }
57
57
  return (
58
- <div className={`container ${Styles.ns_project_list_container}`}>
58
+ <div id={this.props.id}
59
+ className={`container ${Styles.ns_project_list_container} ${this.props.classList?.join(" ")}`}
60
+ style={this.props.style}>
59
61
  <section className={Styles.ns_search_input}>
60
- <NSInputSearch />
62
+ <NSInputSearch title='' required={false} />
61
63
  </section>
62
64
  <NSSpace size={NSSpaceSizeType.SMALL} />
63
65
  <table className={Styles.ns_table} >
@@ -86,8 +88,8 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
86
88
  <NSPagination size={50} page={5} />
87
89
  <NSSpace size={NSSpaceSizeType.SMALL} />
88
90
  <div className={Styles.ns_button}>
89
- <NSButton title='Export' icon={{ src: "/assets/images/export-vector.png" }} onClick={() => { }} border='1px solid rgba(255, 148, 50, 1)' />
90
- <NSButton title='Refresh' icon={{ src: "/assets/images/export-vector.png" }} onClick={() => { }} border='1px solid rgba(3, 119, 255, 1)' />
91
+ <NSButton title='Export' icon={{ src: "/assets/images/export-vector.png" }} onClick={() => { }} style={{ border: '1px solid rgba(255, 148, 50, 1)' }} />
92
+ <NSButton title='Refresh' icon={{ src: "/assets/images/export-vector.png" }} onClick={() => { }} style={{ border: '1px solid rgba(3, 119, 255, 1)' }} />
91
93
  </div>
92
94
  </section>
93
95
  <NSSpace size={NSSpaceSizeType.SMALL} />
@@ -1,25 +1,20 @@
1
- "use client";
2
-
3
- import { Component } from 'react';
4
1
  import Styles from './NSTitle.module.css';
5
2
  import { BaseComponentProps } from "../props/BaseComponentProps";
6
3
 
7
4
  export interface NSTitleProps extends BaseComponentProps
8
5
  {
9
6
  title: string;
10
- color?: string;
11
- text_align?: string;
12
7
  }
13
8
 
14
- export class NSTitle extends Component<NSTitleProps>
9
+ export function NSTitle(props: NSTitleProps)
15
10
  {
16
- override render()
17
- {
18
- return (
19
- //todo : fix text align
20
- <h2 style={{ color: this.props.color, textAlign: this.props.text_align ? "start" : "center" }} className={`${Styles.ns_title}`}>
21
- {this.props.title}
22
- </h2>
23
- );
24
- }
11
+ return (
12
+ <h2
13
+ id={props.id}
14
+ className={`${Styles.ns_title} ${props.classList?.join(" ")}`}
15
+ style={props.style}
16
+ >
17
+ {props.title}
18
+ </h2>
19
+ );
25
20
  }
package/src/main.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./components/NSButtonBlue";
2
- export * from "./components/NSButtonBlueVector";
3
2
  export * from "./components/NSButtonGreen";
4
3
  export * from "./components/NSButton";
5
4
  export * from "./components/NSButtonRed";