namirasoft-site-react 1.4.559 → 1.4.561

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 (69) hide show
  1. package/SKILL.md +1 -1
  2. package/dist/ColorOperation.d.ts +27 -0
  3. package/dist/ColorOperation.js +145 -0
  4. package/dist/ColorOperation.js.map +1 -0
  5. package/dist/components/NSBoxBaseCombo.d.ts +2 -0
  6. package/dist/components/NSBoxBaseCombo.js +16 -14
  7. package/dist/components/NSBoxBaseCombo.js.map +1 -1
  8. package/dist/components/NSBoxCombo.d.ts +4 -4
  9. package/dist/components/NSBoxCombo.js +2 -2
  10. package/dist/components/NSBoxCombo.js.map +1 -1
  11. package/dist/components/NSBoxOptions.d.ts +32 -0
  12. package/dist/components/NSBoxOptions.js +105 -0
  13. package/dist/components/NSBoxOptions.js.map +1 -0
  14. package/dist/components/NSBoxOptions.module.css +54 -0
  15. package/dist/components/{NSChartColumn.d.ts → NSChartBar.d.ts} +6 -2
  16. package/dist/components/NSChartBar.js +93 -0
  17. package/dist/components/NSChartBar.js.map +1 -0
  18. package/dist/components/NSChartDoughnut.d.ts +3 -0
  19. package/dist/components/NSChartDoughnut.js +22 -20
  20. package/dist/components/NSChartDoughnut.js.map +1 -1
  21. package/dist/components/NSChartLine.d.ts +21 -0
  22. package/dist/components/NSChartLine.js +76 -0
  23. package/dist/components/NSChartLine.js.map +1 -0
  24. package/dist/components/NSChartPie.d.ts +3 -0
  25. package/dist/components/NSChartPie.js +20 -21
  26. package/dist/components/NSChartPie.js.map +1 -1
  27. package/dist/components/NSPagination.js +9 -8
  28. package/dist/components/NSPagination.js.map +1 -1
  29. package/dist/components/NSPagination.module.css +1 -0
  30. package/dist/components/NSSplitter.js +1 -1
  31. package/dist/components/NSSplitter.js.map +1 -1
  32. package/dist/components/NSTable.d.ts +1 -0
  33. package/dist/components/NSTable.js +9 -3
  34. package/dist/components/NSTable.js.map +1 -1
  35. package/dist/components/NSTableChart.d.ts +49 -0
  36. package/dist/components/NSTableChart.js +335 -0
  37. package/dist/components/NSTableChart.js.map +1 -0
  38. package/dist/components/NSTableChart.module.css +120 -0
  39. package/dist/main.d.ts +5 -2
  40. package/dist/main.js +5 -2
  41. package/dist/main.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/ColorOperation.ts +154 -0
  44. package/src/components/NSBoxBaseCombo.tsx +14 -10
  45. package/src/components/NSBoxCombo.tsx +2 -2
  46. package/src/components/NSBoxOptions.module.css +54 -0
  47. package/src/components/NSBoxOptions.tsx +183 -0
  48. package/src/components/NSChartBar.tsx +135 -0
  49. package/src/components/NSChartDoughnut.tsx +26 -24
  50. package/src/components/NSChartLine.tsx +111 -0
  51. package/src/components/NSChartPie.tsx +23 -23
  52. package/src/components/NSPagination.module.css +1 -0
  53. package/src/components/NSPagination.tsx +14 -13
  54. package/src/components/NSSplitter.tsx +6 -15
  55. package/src/components/NSTable.tsx +17 -1
  56. package/src/components/NSTableChart.module.css +120 -0
  57. package/src/components/NSTableChart.tsx +588 -0
  58. package/src/main.ts +5 -2
  59. package/dist/components/NSChartColumn.js +0 -95
  60. package/dist/components/NSChartColumn.js.map +0 -1
  61. package/dist/components/NSChartColumn.module.css +0 -8
  62. package/dist/components/NSChartTable.d.ts +0 -15
  63. package/dist/components/NSChartTable.js +0 -63
  64. package/dist/components/NSChartTable.js.map +0 -1
  65. package/dist/components/NSChartTable.module.css +0 -22
  66. package/src/components/NSChartColumn.module.css +0 -8
  67. package/src/components/NSChartColumn.tsx +0 -131
  68. package/src/components/NSChartTable.module.css +0 -22
  69. package/src/components/NSChartTable.tsx +0 -95
package/src/main.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./components/NSBoxMoney";
38
38
  export * from "./components/NSBoxSensitive";
39
39
  export * from "./components/NSBoxPhone";
40
40
  export * from "./components/NSBoxRadio";
41
+ export * from "./components/NSBoxOptions";
41
42
  export * from "./components/NSBoxSchemaBase";
42
43
  export * from "./components/NSBoxSchemaVariable";
43
44
  export * from "./components/NSBoxSearch";
@@ -60,11 +61,13 @@ export * from "./components/NSCard";
60
61
  export * from "./components/NSCardScreenshot"
61
62
 
62
63
  // Chart
63
- export * from "./components/NSChartColumn";
64
+ export * from "./components/NSChartBar";
65
+ export * from "./components/NSChartLine";
64
66
  export * from "./components/NSChartDoughnut";
65
67
  export * from "./components/NSChartPie";
66
68
  export * from "./components/NSChartRange";
67
- export * from "./components/NSChartTable";
69
+ export * from "./components/NSTableChart";
70
+ export * from "./ColorOperation";
68
71
 
69
72
  // Copy
70
73
  export * from "./components/NSCopyBox";
@@ -1,95 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Bar } from 'react-chartjs-2';
3
- import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend } from 'chart.js';
4
- import Styles from "./NSChartColumn.module.css";
5
- ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
6
- const prepareDatasets = (dataset) => {
7
- const colors = [
8
- "#7583E6",
9
- "#C3406C",
10
- "#3AA498",
11
- "#8C4BCB",
12
- "#DB7E46",
13
- "#2962AA",
14
- "#95274A",
15
- "#95274A",
16
- "#95274A",
17
- "#977E19",
18
- ];
19
- return dataset.map((item, index) => {
20
- var _a;
21
- return ({
22
- label: item.label,
23
- data: item.data,
24
- backgroundColor: (_a = item.color) !== null && _a !== void 0 ? _a : colors[index % colors.length],
25
- stack: "stack",
26
- });
27
- });
28
- };
29
- ;
30
- export function NSChartColumn(props) {
31
- var _a, _b, _c, _d, _e;
32
- const data = {
33
- labels: props.labels,
34
- datasets: prepareDatasets(props.dataset)
35
- };
36
- const options = {
37
- responsive: true,
38
- maintainAspectRatio: false,
39
- plugins: {
40
- legend: {
41
- display: true,
42
- position: "bottom"
43
- },
44
- tooltip: {
45
- enabled: true,
46
- callbacks: {
47
- label: ({ dataset, raw }) => `${dataset.label}: ${props.formatValue ? props.formatValue(raw) : raw}`,
48
- },
49
- },
50
- },
51
- scales: {
52
- x: {
53
- ticks: {
54
- font: {
55
- size: 12,
56
- weight: 400,
57
- },
58
- color: '#141B5C',
59
- maxRotation: 554,
60
- minRotation: 0,
61
- },
62
- grid: {
63
- display: false,
64
- },
65
- border: {
66
- display: false,
67
- }
68
- },
69
- y: {
70
- min: props.range.min,
71
- max: props.range.max,
72
- ticks: {
73
- callback: function (value) {
74
- return props.formatValue ? props.formatValue(value) : value;
75
- },
76
- font: {
77
- size: 12,
78
- weight: 400,
79
- },
80
- color: '#141B5C',
81
- },
82
- grid: {
83
- display: props.yGrid,
84
- color: "#E6EEF5"
85
- },
86
- border: {
87
- display: false,
88
- },
89
- },
90
- },
91
- };
92
- return (_jsx("div", { style: Object.assign(Object.assign({}, props.style), { height: (_a = props.height) !== null && _a !== void 0 ? _a : 250 }), className: `${Styles.chart_column_container} ${(_c = (_b = props.classList) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : ""}`, children: _jsx(Bar, { data: data, options: options, width: (_d = props.width) !== null && _d !== void 0 ? _d : 320, height: (_e = props.height) !== null && _e !== void 0 ? _e : 250 }) }));
93
- }
94
- ;
95
- //# sourceMappingURL=NSChartColumn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NSChartColumn.js","sourceRoot":"","sources":["../../src/components/NSChartColumn.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAA2B,MAAM,UAAU,CAAC;AAErI,OAAO,MAAM,MAAM,4BAA4B,CAAA;AAE/C,OAAO,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAEjF,MAAM,eAAe,GAAG,CAAC,OAAsB,EAAE,EAAE;IAElD,MAAM,MAAM,G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- width: 100%;
4
- }
5
-
6
- .chart_column_container canvas {
7
- height: 100% !important;
8
- }
@@ -1,15 +0,0 @@
1
- import { IBaseComponentProps } from '../props/IBaseComponentProps';
2
- interface DataType {
3
- key: string;
4
- job: string;
5
- totalHours: number;
6
- percentage: number;
7
- cost: number;
8
- income: number;
9
- benefit: number;
10
- }
11
- interface CustomTableProps extends IBaseComponentProps {
12
- data: DataType[];
13
- }
14
- export declare function NSChartTable(props: CustomTableProps): import("react").JSX.Element;
15
- export {};
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Table, Progress } from 'antd';
3
- import Styles from "./NSChartTable.module.css";
4
- export function NSChartTable(props) {
5
- var _a, _b;
6
- const getColor = (percentage) => {
7
- if (percentage >= 75)
8
- return '#368F01';
9
- if (percentage >= 60)
10
- return ' #44B400';
11
- if (percentage >= 50)
12
- return '#56E500';
13
- if (percentage >= 25)
14
- return '#FAFF00';
15
- return 'red';
16
- };
17
- const columns = [
18
- {
19
- title: '',
20
- dataIndex: 'job',
21
- key: 'job',
22
- },
23
- {
24
- title: 'Total Hours',
25
- dataIndex: 'totalHours',
26
- key: 'totalHours',
27
- render: (text) => _jsx("div", { children: text }),
28
- },
29
- {
30
- title: 'Percentage',
31
- dataIndex: 'percentage',
32
- key: 'percentage',
33
- render: (text) => _jsxs("div", { children: [text, "%"] }),
34
- },
35
- {
36
- title: 'Cost',
37
- dataIndex: 'cost',
38
- key: 'cost',
39
- render: (text) => _jsxs("div", { children: ["$", text] }),
40
- },
41
- {
42
- title: 'Income',
43
- dataIndex: 'income',
44
- key: 'income',
45
- render: (text) => _jsxs("div", { children: ["$", text] }),
46
- },
47
- {
48
- title: 'Benefit',
49
- dataIndex: 'benefit',
50
- key: 'benefit',
51
- render: (text) => _jsxs("div", { children: ["$", text] }),
52
- },
53
- {
54
- title: '',
55
- dataIndex: 'totalHours',
56
- key: 'chart',
57
- render: (totalHours, record) => (_jsx(Progress, { percent: (totalHours / 8) * 100, showInfo: false, strokeColor: getColor(record.percentage), size: { width: 310, height: 16 } })),
58
- },
59
- ];
60
- return (_jsx("div", { className: `${(_b = (_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: props.style, children: _jsx(Table, { columns: columns, dataSource: props.data, pagination: false, scroll: { x: 800 }, rowClassName: () => Styles.custom_row }) }));
61
- }
62
- ;
63
- //# sourceMappingURL=NSChartTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NSChartTable.js","sourceRoot":"","sources":["../../src/components/NSChartTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,MAAM,MAAM,2BAA2B,CAAA;AAkB9C,MAAM,UAAU,YAAY,CAAC,KAAuB;;IAEnD,MAAM,QAAQ,GAAG,CAAC,UAAkB,EAAE,EAAE;QAEvC,IAAI,UAAU,IAAI,EAAE;YAAE,OAAO,SAAS,CAAC;QACvC,IAAI,UAAU,IAAI,EAAE;YAAE,OAAO,UAAU,CAAC;QACxC,IAAI,UAAU,IAAI,EAAE;YAAE,OAAO,SAAS,CAAC;QACvC,IAAI,UAAU,IAAI,EAAE;YAAE,OAAO,SAAS,CAAC;QACvC,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,OAAO,GAA2B;QACvC;YACC,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,KAAK;YAChB,GAAG,EAAE,KAAK;SACV;QACD;YACC,KAAK,EAAE,aAAa;YACpB,SAAS,EAAE,YAAY;YACvB,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,wBAAM,IAAI,GAAO;SAC3C;QACD;YACC,KAAK,EAAE,YAAY;YACnB,SAAS,EAAE,YAAY;YACvB,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,0BAAM,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GACG,CACN,CAAC;AACH,CAAC;AAAA,CAAC"}
@@ -1,22 +0,0 @@
1
- .custom_row td {
2
- border: none;
3
- }
4
-
5
- .custom_row td:nth-child(2),
6
- .custom_row td:nth-child(3),
7
- .custom_row td:nth-child(4),
8
- .custom_row td:nth-child(5),
9
- .custom_row td:nth-child(6) {
10
- border-bottom: 1px dashed #d9d9d9;
11
- }
12
-
13
- /* Override default Ant Design row borders */
14
- .ant-table-tbody>tr>td {
15
- border-bottom: none !important;
16
- }
17
-
18
- /* Increase progress bar height */
19
- .ant-progress {
20
- height: 16px !important;
21
- /* Adjust as needed */
22
- }
@@ -1,8 +0,0 @@
1
- .chart_column_container {
2
- max-width: 620px;
3
- width: 100%;
4
- }
5
-
6
- .chart_column_container canvas {
7
- height: 100% !important;
8
- }
@@ -1,131 +0,0 @@
1
- import { Bar } from 'react-chartjs-2';
2
- import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ChartOptions, ChartData } from 'chart.js';
3
- import { IBaseComponentProps } from '../props/IBaseComponentProps';
4
- import Styles from "./NSChartColumn.module.css"
5
-
6
- ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
7
-
8
- const prepareDatasets = (dataset: DataSetItem[]) =>
9
- {
10
- const colors = [
11
- "#7583E6",
12
- "#C3406C",
13
- "#3AA498",
14
- "#8C4BCB",
15
- "#DB7E46",
16
- "#2962AA",
17
- "#95274A",
18
- "#95274A",
19
- "#95274A",
20
- "#977E19",
21
- ];
22
-
23
- return dataset.map((item, index) => ({
24
- label: item.label,
25
- data: item.data,
26
- backgroundColor: item.color ?? colors[index % colors.length],
27
- stack: "stack",
28
- }));
29
- };
30
-
31
- export interface DataSetItem
32
- {
33
- label: string;
34
- color?: string;
35
- data: number[]
36
- };
37
-
38
-
39
- export interface NSChartColumnProps extends IBaseComponentProps
40
- {
41
- labels: string[];
42
- dataset: DataSetItem[];
43
- range: {
44
- min: number,
45
- max: number,
46
- }
47
- yGrid?: boolean;
48
- height?: number;
49
- width?: number;
50
- formatValue?: (value: number) => string;
51
- }
52
-
53
- export function NSChartColumn(props: NSChartColumnProps)
54
- {
55
- const data: ChartData<"bar", number[], string> = {
56
- labels: props.labels,
57
- datasets: prepareDatasets(props.dataset)
58
- };
59
-
60
- const options: ChartOptions<'bar'> = {
61
- responsive: true,
62
- maintainAspectRatio: false,
63
- plugins: {
64
- legend: {
65
- display: true,
66
- position: "bottom"
67
- },
68
- tooltip: {
69
- enabled: true,
70
- callbacks: {
71
- label: ({ dataset, raw }) => `${dataset.label}: ${props.formatValue ? props.formatValue(raw as number) : raw}`,
72
- },
73
- },
74
- },
75
- scales: {
76
- x: {
77
- ticks: {
78
- font: {
79
- size: 12,
80
- weight: 400,
81
- },
82
- color: '#141B5C',
83
- maxRotation: 554,
84
- minRotation: 0,
85
- },
86
- grid: {
87
- display: false,
88
- },
89
- border: {
90
- display: false,
91
- }
92
- },
93
- y: {
94
- min: props.range.min,
95
- max: props.range.max,
96
- ticks: {
97
- callback: function (value)
98
- {
99
- return props.formatValue ? props.formatValue(value as number) : value;
100
- },
101
- font: {
102
- size: 12,
103
- weight: 400,
104
- },
105
- color: '#141B5C',
106
- },
107
- grid: {
108
- display: props.yGrid,
109
- color: "#E6EEF5"
110
- },
111
- border: {
112
- display: false,
113
- },
114
- },
115
- },
116
- };
117
-
118
- return (
119
- <div
120
- style={{ ...props.style, height: props.height ?? 250 }}
121
- className={`${Styles.chart_column_container} ${props.classList?.join(" ") ?? ""}`}
122
- >
123
- <Bar
124
- data={data}
125
- options={options}
126
- width={props.width ?? 320}
127
- height={props.height ?? 250}
128
- />
129
- </div>
130
- );
131
- };
@@ -1,22 +0,0 @@
1
- .custom_row td {
2
- border: none;
3
- }
4
-
5
- .custom_row td:nth-child(2),
6
- .custom_row td:nth-child(3),
7
- .custom_row td:nth-child(4),
8
- .custom_row td:nth-child(5),
9
- .custom_row td:nth-child(6) {
10
- border-bottom: 1px dashed #d9d9d9;
11
- }
12
-
13
- /* Override default Ant Design row borders */
14
- .ant-table-tbody>tr>td {
15
- border-bottom: none !important;
16
- }
17
-
18
- /* Increase progress bar height */
19
- .ant-progress {
20
- height: 16px !important;
21
- /* Adjust as needed */
22
- }
@@ -1,95 +0,0 @@
1
- import { Table, Progress } from 'antd';
2
- import { ColumnType } from 'antd/es/table';
3
- import { IBaseComponentProps } from '../props/IBaseComponentProps';
4
- import Styles from "./NSChartTable.module.css"
5
-
6
- interface DataType
7
- {
8
- key: string;
9
- job: string;
10
- totalHours: number;
11
- percentage: number;
12
- cost: number;
13
- income: number;
14
- benefit: number;
15
- }
16
-
17
- interface CustomTableProps extends IBaseComponentProps
18
- {
19
- data: DataType[];
20
- }
21
-
22
- export function NSChartTable(props: CustomTableProps)
23
- {
24
- const getColor = (percentage: number) =>
25
- {
26
- if (percentage >= 75) return '#368F01';
27
- if (percentage >= 60) return ' #44B400';
28
- if (percentage >= 50) return '#56E500';
29
- if (percentage >= 25) return '#FAFF00';
30
- return 'red';
31
- };
32
-
33
- const columns: ColumnType<DataType>[] = [
34
- {
35
- title: '',
36
- dataIndex: 'job',
37
- key: 'job',
38
- },
39
- {
40
- title: 'Total Hours',
41
- dataIndex: 'totalHours',
42
- key: 'totalHours',
43
- render: (text: number) => <div>{text}</div>,
44
- },
45
- {
46
- title: 'Percentage',
47
- dataIndex: 'percentage',
48
- key: 'percentage',
49
- render: (text: number) => <div>{text}%</div>,
50
- },
51
- {
52
- title: 'Cost',
53
- dataIndex: 'cost',
54
- key: 'cost',
55
- render: (text: number) => <div>${text}</div>,
56
- },
57
- {
58
- title: 'Income',
59
- dataIndex: 'income',
60
- key: 'income',
61
- render: (text: number) => <div>${text}</div>,
62
- },
63
- {
64
- title: 'Benefit',
65
- dataIndex: 'benefit',
66
- key: 'benefit',
67
- render: (text: number) => <div>${text}</div>,
68
- },
69
- {
70
- title: '',
71
- dataIndex: 'totalHours',
72
- key: 'chart',
73
- render: (totalHours: number, record: DataType) => (
74
- <Progress
75
- percent={(totalHours / 8) * 100}
76
- showInfo={false}
77
- strokeColor={getColor(record.percentage)}
78
- size={{ width: 310, height: 16 }}
79
- />
80
- ),
81
- },
82
- ];
83
-
84
- return (
85
- <div className={`${props.classList?.join(" ") ?? ""}`} style={props.style}>
86
- <Table
87
- columns={columns}
88
- dataSource={props.data}
89
- pagination={false}
90
- scroll={{ x: 800 }}
91
- rowClassName={() => Styles.custom_row}
92
- />
93
- </div>
94
- );
95
- };