namirasoft-site-react 1.3.40 → 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 (49) 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/NSTable.d.ts +1 -0
  29. package/dist/components/NSTable.js +6 -2
  30. package/dist/components/NSTable.js.map +1 -1
  31. package/dist/components/NSTable.module.css +50 -9
  32. package/dist/main.d.ts +1 -0
  33. package/dist/main.js +1 -0
  34. package/dist/main.js.map +1 -1
  35. package/package.json +1 -1
  36. package/public/assets/images/close-vector.png +0 -0
  37. package/src/App.tsx +46 -8
  38. package/src/components/NSButtonGroup.module.css +38 -0
  39. package/src/components/NSButtonGroup.tsx +12 -0
  40. package/src/components/NSInputDuration.tsx +18 -14
  41. package/src/components/NSInputEmail.tsx +21 -16
  42. package/src/components/NSInputFloat.tsx +16 -11
  43. package/src/components/NSInputIP.tsx +14 -10
  44. package/src/components/NSInputInteger.tsx +14 -10
  45. package/src/components/NSInputSearch.tsx +16 -24
  46. package/src/components/NSInputTime.tsx +13 -9
  47. package/src/components/NSTable.module.css +50 -9
  48. package/src/components/NSTable.tsx +27 -8
  49. package/src/main.ts +1 -0
@@ -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"
@@ -1,25 +1,20 @@
1
- .ns_project_list_container {}
2
-
3
1
  .ns_table {
4
2
  display: flex;
5
3
  flex-direction: column;
6
- padding: 0;
7
4
  color: rgba(20, 27, 92, 1);
8
-
9
5
  }
10
6
 
11
7
  .ns_table thead {
12
8
  clip: rect(0 0 0 0);
13
9
  position: fixed;
14
-
15
10
  }
16
11
 
17
12
  .ns_table tr {
18
13
  border-radius: 8px;
19
14
  padding: 16px;
20
- margin: 10px;
21
15
  display: block;
22
16
  background-color: rgba(20, 27, 92, 0.3);
17
+ margin: 16px 0;
23
18
  }
24
19
 
25
20
  .ns_table td {
@@ -35,13 +30,42 @@
35
30
  float: left;
36
31
  font-weight: bold;
37
32
  text-transform: uppercase;
33
+ }
34
+
35
+ /* Button Group */
36
+ .ns_button_group {
37
+ display: flex;
38
+ flex-direction: column;
39
+ align-items: center;
40
+ }
41
+
42
+ /* Modal */
43
+ .ns_modal {
44
+ position: fixed;
45
+ height: fit-content;
46
+ top: 25%;
47
+ left: 0;
48
+ border-radius: 8px;
49
+ padding: 24px;
50
+ margin: 0 16px;
51
+ background-color: rgba(188, 194, 244, 1);
52
+ z-index: 10;
53
+ color: rgba(20, 27, 92, 1);
54
+ }
38
55
 
56
+ .ns_modal a {
57
+ float: right;
39
58
  }
40
59
 
41
- @media screen and (min-width: 600px) {
60
+ .modal img {
61
+ width: 32px;
62
+ height: 32px;
63
+ right: 0;
64
+ }
65
+
66
+ @media screen and (min-width: 768px) {
42
67
  .ns_table {
43
68
  color: #000000;
44
-
45
69
  }
46
70
 
47
71
  .ns_table thead {
@@ -53,7 +77,6 @@
53
77
 
54
78
  .ns_table tbody {
55
79
  background-color: rgba(20, 27, 92, 0.3);
56
-
57
80
  }
58
81
 
59
82
  .ns_table tr {
@@ -89,6 +112,14 @@
89
112
  text-transform: uppercase;
90
113
  }
91
114
 
115
+ /* Button Group */
116
+ .ns_button_group {
117
+ display: flex;
118
+ flex-direction: row;
119
+ justify-content: space-between;
120
+ align-items: center;
121
+ }
122
+
92
123
  @media screen and (min-width: 990px) {
93
124
  .ns_table {
94
125
  padding: 0 48px;
@@ -101,5 +132,15 @@
101
132
  .ns_table tr {
102
133
  font-size: 24px;
103
134
  }
135
+
136
+ /* Search Input */
137
+ .ns_search_input {
138
+ padding: 0 40px;
139
+ }
140
+
141
+ /* Button Group */
142
+ .ns_button_group {
143
+ padding: 0 48px;
144
+ }
104
145
  }
105
146
  }
@@ -1,5 +1,9 @@
1
1
  "use client";
2
2
 
3
+ import NSButtonGroup from './NSButtonGroup';
4
+ import { NSInputSearch } from './NSInputSearch';
5
+ import { NSPagination } from './NSPagination';
6
+ import { NSSpace, NSSpaceSizeType } from './NSSpace';
3
7
  import Styles from './NSTable.module.css';
4
8
  import { Component } from 'react';
5
9
 
@@ -16,6 +20,7 @@ export interface NSTableState<RowType>
16
20
  {
17
21
  columns: { [key: string]: string };
18
22
  rows: RowType[];
23
+ modalState: boolean
19
24
  }
20
25
 
21
26
  export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableState<RowType>>
@@ -23,7 +28,7 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
23
28
  constructor(props: NSTableProps<RowType>)
24
29
  {
25
30
  super(props);
26
- this.state = { columns: props.columns, rows: props.rows };
31
+ this.state = { columns: props.columns, rows: props.rows, modalState: false };
27
32
  }
28
33
  setColumns(columns: { [key: string]: string })
29
34
  {
@@ -37,8 +42,12 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
37
42
  {
38
43
  let column_keys = Object.keys(this.state.columns);
39
44
  return (
40
- <div className={Styles.ns_project_list_container}>
41
- <table className={Styles.ns_table}>
45
+ <div className={`container ${Styles.ns_project_list_container}`}>
46
+ <section className={Styles.ns_search_input}>
47
+ <NSInputSearch />
48
+ </section>
49
+ <NSSpace size={NSSpaceSizeType.SMALL} />
50
+ <table className={Styles.ns_table} >
42
51
  <thead className={Styles.ns_thead}>
43
52
  <tr>
44
53
  {column_keys.map(column_key => <th key={column_key} scope="col">{this.state.columns[column_key]}</th>)}
@@ -47,7 +56,7 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
47
56
  <tbody className={Styles.ns_tbody}>
48
57
  {
49
58
  this.state.rows.map((row, rowIndex) =>
50
- <tr key={this.props.getRowKey(row, rowIndex)}>
59
+ <tr key={this.props.getRowKey(row, rowIndex)} onClick={() => this.setState({ modalState: !this.state.modalState })}>
51
60
  {
52
61
  column_keys.map((column, columnIndex) => (
53
62
  <td {...this.props.getColumnAttributes(column, columnIndex)} data-label={this.state.columns[column]}>
@@ -59,10 +68,20 @@ export class NSTable<RowType> extends Component<NSTableProps<RowType>, NSTableSt
59
68
  }
60
69
  </tbody >
61
70
  </table>
62
- <div className={Styles.ns_button_group_desktop}>
63
- <button onClick={() => window.print()} className={Styles.ns_export_button}><img src="/assets/images/export-vector.png" alt="Export Table Data" width={13} height={16} />Export</button>
64
- <button onClick={() => window.location.reload()} className={Styles.ns_refresh_button}><img src="/assets/images/refresh-vector.png" alt="Refresh Table Contnet" width={15} height={16} />Refresh</button>
65
- </div>
71
+ <NSSpace size={NSSpaceSizeType.MICRO} />
72
+ <section className={Styles.ns_button_group}>
73
+ <NSPagination size={50} page={5} />
74
+ <NSSpace size={NSSpaceSizeType.SMALL} />
75
+ <NSButtonGroup />
76
+ </section>
77
+ <NSSpace size={NSSpaceSizeType.SMALL} />
78
+ <section onClick={() => this.setState({ modalState: !this.state.modalState })} className={Styles.ns_modal} style={{ display: this.state.modalState ? "block" : "none" }}>
79
+ <a><img src='/assets/images/close-vector.png' /></a>
80
+ <p>
81
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur vitae diam non enim vestibulum interdum. Duis condimentum augue id magna semper rutrum. Nullam sit amet magna in magna gravida vehicula. Vestibulum erat nulla, ullamcorper nec, rutrum non, nonummy ac, erat. In laoreet, magna id viverra tincidunt, sem odio bibendum justo, vel imperdiet sapien wisi sed libero. Phasellus enim erat, vestibulum vel, aliquam a, posuere eu, velit. Morbi imperdiet, mauris ac auctor dictum, nisl ligula egestas nulla, et sollicitudin sem purus in lacus. Mauris dictum facilisis augue. Phasellus faucibus molestie nisl. Aliquam ante. Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo.
82
+ In convallis. Phasellus rhoncus..
83
+ </p>
84
+ </section>
66
85
  </div >
67
86
  )
68
87
  }
package/src/main.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./components/NSButtonBlue";
2
2
  export * from "./components/NSButtonBlueVector";
3
3
  export * from "./components/NSButtonGreen";
4
+ export * from "./components/NSButtonGroup";
4
5
  export * from "./components/NSButtonRed";
5
6
  export * from "./components/NSCard";
6
7
  export * from "./components/NSEntityCardBackground";