nexus-shared 1.1.4 → 1.1.6
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.
- package/package.json +16 -40
- package/src/api-services/preference-service.tsx +5 -0
- package/src/api-services/system-service.tsx +322 -0
- package/src/components/documents/button.tsx +136 -0
- package/src/components/documents/icon-box.tsx +92 -0
- package/src/components/documents/page-title.tsx +7 -0
- package/src/components/documents/tab-button.tsx +169 -0
- package/src/components/index.js +0 -0
- package/src/components/inputs/checkbox-input.tsx +66 -0
- package/src/components/inputs/input-box.tsx +45 -0
- package/src/components/inputs/input-element.tsx +65 -0
- package/src/components/inputs/input-form.tsx +50 -0
- package/src/components/inputs/input.tsx +181 -0
- package/src/components/inputs/number-input.tsx +108 -0
- package/src/components/inputs/radiobox-input.tsx +53 -0
- package/src/components/inputs/textarea-input.tsx +47 -0
- package/src/components/inputs/textbox-input.tsx +45 -0
- package/src/components/layouts/global-dialogbox.tsx +433 -0
- package/src/components/layouts/global-layout.tsx +63 -0
- package/src/components/layouts/layout-helpers.tsx +23 -0
- package/src/components/layouts/utility-menu.tsx +71 -0
- package/src/components/panels/theme-panel.tsx +44 -0
- package/src/helpers/bitwise-helpers.tsx +11 -0
- package/src/helpers/browser-helpers.tsx +73 -0
- package/src/helpers/datasource-helpers.tsx +99 -0
- package/src/helpers/element-helpers.tsx +57 -0
- package/src/helpers/input-helpers.tsx +24 -0
- package/src/helpers/string-helpers.tsx +28 -0
- package/src/helpers/utility-helpers.tsx +44 -0
- package/src/index.ts +0 -11
- package/src/interfaces/browser-interfaces.tsx +23 -0
- package/src/interfaces/button-interfaces.tsx +63 -0
- package/src/interfaces/datasource-interfaces.tsx +22 -0
- package/src/interfaces/datatable-interfaces.tsx +25 -0
- package/src/interfaces/dialogbox-interfaces.tsx +5 -0
- package/src/interfaces/http-interfaces.tsx +15 -0
- package/src/interfaces/icon-interfaces.tsx +126 -0
- package/src/interfaces/input-interfaces.tsx +360 -0
- package/src/interfaces/layout-interfaces.tsx +191 -0
- package/src/interfaces/menu-interfaces.tsx +36 -0
- package/src/interfaces/permission-interfaces.tsx +9 -0
- package/src/interfaces/storage-interfaces.tsx +3 -0
- package/src/interfaces/system-interfaces.tsx +22 -0
- package/src/interfaces/theme-interfaces.tsx +209 -0
- package/src/interfaces/type-interfaces.tsx +22 -0
- package/src/nexus-client.tsx +23 -0
- package/src/nexus.environments.tsx +34 -0
- package/src/services/loader-service.tsx +168 -0
- package/src/services/localstorage-service.tsx +45 -0
- package/src/services/theme-service.tsx +149 -0
- package/src/styles/nexus.animation.css +269 -0
- package/src/styles/nexus.core.css +119 -0
- package/src/styles/nexus.dialog.css +141 -0
- package/src/styles/nexus.icon.css +50 -0
- package/src/styles/nexus.input.css +207 -0
- package/src/styles/nexus.loader.css +11 -0
- package/src/styles/nexus.logic.css +18 -0
- package/src/styles/nexus.utility.css +347 -0
- package/dist/chunk-7GVFDWOS.js +0 -28
- package/dist/chunk-7GVFDWOS.js.map +0 -1
- package/dist/chunk-EW6K4PYI.js +0 -96
- package/dist/chunk-EW6K4PYI.js.map +0 -1
- package/dist/chunk-UMV7E2RN.js +0 -1
- package/dist/chunk-UMV7E2RN.js.map +0 -1
- package/dist/client.css +0 -119
- package/dist/client.css.map +0 -1
- package/dist/client.d.ts +0 -9
- package/dist/client.js +0 -7
- package/dist/client.js.map +0 -1
- package/dist/index.css +0 -207
- package/dist/index.css.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/interface.d.ts +0 -9
- package/dist/interface.js +0 -2
- package/dist/interface.js.map +0 -1
- package/dist/nexus-list-DV45tcM0.d.ts +0 -24
- package/dist/server.css +0 -88
- package/dist/server.css.map +0 -1
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -7
- package/dist/server.js.map +0 -1
- package/src/client/index.ts +0 -1
- package/src/client/nexus-selectable-list.css +0 -131
- package/src/client/nexus-selectable-list.tsx +0 -111
- package/src/client.ts +0 -7
- package/src/interface.ts +0 -5
- package/src/interfaces/index.ts +0 -6
- package/src/interfaces/nexus-base.ts +0 -5
- package/src/interfaces/nexus-list.ts +0 -24
- package/src/server/index.ts +0 -1
- package/src/server/nexus-stat-list.css +0 -92
- package/src/server/nexus-stat-list.tsx +0 -46
- package/src/server.ts +0 -8
package/package.json
CHANGED
|
@@ -1,54 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexus-shared",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Nexus
|
|
3
|
+
"version": "1.1.6",
|
|
4
|
+
"description": "Nexus shared React components for Next.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects": ["**/*.css"],
|
|
6
|
+
"sideEffects": [ "**/*.css" ],
|
|
7
7
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"./interface": {
|
|
14
|
-
"types": "./dist/interface.d.ts",
|
|
15
|
-
"import": "./src/interface.ts",
|
|
16
|
-
"default": "./dist/interface.js"
|
|
17
|
-
},
|
|
18
|
-
"./server": {
|
|
19
|
-
"types": "./dist/server.d.ts",
|
|
20
|
-
"import": "./src/server.ts",
|
|
21
|
-
"default": "./dist/server.js"
|
|
22
|
-
},
|
|
23
|
-
"./client": {
|
|
24
|
-
"types": "./dist/client.d.ts",
|
|
25
|
-
"import": "./src/client.ts",
|
|
26
|
-
"default": "./dist/client.js"
|
|
27
|
-
}
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./interface": "./src/interface.ts",
|
|
10
|
+
"./server": "./src/server.ts",
|
|
11
|
+
"./client": "./src/client.ts"
|
|
28
12
|
},
|
|
29
|
-
"files": [
|
|
13
|
+
"files": [ "src" ],
|
|
30
14
|
"scripts": {
|
|
31
|
-
"build": "tsup",
|
|
32
|
-
"dev": "tsup --watch",
|
|
33
15
|
"typecheck": "tsc --noEmit"
|
|
34
16
|
},
|
|
35
17
|
"peerDependencies": {
|
|
36
|
-
"
|
|
37
|
-
"react": "
|
|
38
|
-
"
|
|
18
|
+
"react": "19.2.4",
|
|
19
|
+
"react-dom": "19.2.4",
|
|
20
|
+
"next": "16.2.6"
|
|
39
21
|
},
|
|
40
22
|
"devDependencies": {
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/react": "^19
|
|
43
|
-
"
|
|
44
|
-
"next": "^16.2.6",
|
|
45
|
-
"react": "^19.2.6",
|
|
46
|
-
"react-dom": "^19.2.6",
|
|
47
|
-
"server-only": "^0.0.1",
|
|
48
|
-
"tsup": "^8.5.0",
|
|
49
|
-
"typescript": "^5.9.2"
|
|
23
|
+
"@types/react": "^19",
|
|
24
|
+
"@types/react-dom": "^19",
|
|
25
|
+
"typescript": "^5"
|
|
50
26
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"dotenv": "^17.4.2"
|
|
53
29
|
}
|
|
54
30
|
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { EIcons } from "../interfaces/icon-interfaces";
|
|
2
|
+
import { EMenuTargets, EMenuVisibility, IClientMenu, IPanelMenu, IUtilityMenu } from "../interfaces/menu-interfaces";
|
|
3
|
+
import { ENexusModules } from "../interfaces/system-interfaces";
|
|
4
|
+
|
|
5
|
+
export const GetClientMenus = async (): Promise<IClientMenu[]> => {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
id: 1,
|
|
9
|
+
menuCode: "home",
|
|
10
|
+
menuIcon: EIcons.HOME,
|
|
11
|
+
menuName: "Home",
|
|
12
|
+
menuUrl: "/home",
|
|
13
|
+
documentTitle: "Home Page",
|
|
14
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
15
|
+
displayOrder: 1,
|
|
16
|
+
pageTitle: "Home Page",
|
|
17
|
+
breadcrumbTitle: "Home",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 2,
|
|
21
|
+
menuCode: "about-me",
|
|
22
|
+
menuIcon: EIcons.PERSON,
|
|
23
|
+
menuName: "About Me",
|
|
24
|
+
menuUrl: "/about-me",
|
|
25
|
+
documentTitle: "About Me",
|
|
26
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
27
|
+
displayOrder: 2,
|
|
28
|
+
pageTitle: "About Me",
|
|
29
|
+
breadcrumbTitle: "About Me",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 3,
|
|
33
|
+
menuCode: "about-us",
|
|
34
|
+
menuIcon: EIcons.PERSON,
|
|
35
|
+
menuName: "About Us",
|
|
36
|
+
menuUrl: "/about-us",
|
|
37
|
+
documentTitle: "About Us",
|
|
38
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
39
|
+
displayOrder: 2,
|
|
40
|
+
pageTitle: "About Us",
|
|
41
|
+
breadcrumbTitle: "About Us",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 4,
|
|
45
|
+
menuCode: "my-projects",
|
|
46
|
+
menuIcon: EIcons.BRIEFCASE,
|
|
47
|
+
menuName: "My Projects",
|
|
48
|
+
menuUrl: "/my-projects",
|
|
49
|
+
documentTitle: "My Projects",
|
|
50
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
51
|
+
displayOrder: 3,
|
|
52
|
+
pageTitle: "My Projects",
|
|
53
|
+
breadcrumbTitle: "My Projects",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 5,
|
|
57
|
+
menuCode: "products",
|
|
58
|
+
menuIcon: EIcons.CUBE,
|
|
59
|
+
menuName: "My Products",
|
|
60
|
+
menuUrl: "/products",
|
|
61
|
+
documentTitle: "My Products",
|
|
62
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
63
|
+
displayOrder: 4,
|
|
64
|
+
pageTitle: "My Products",
|
|
65
|
+
breadcrumbTitle: "My Products",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 6,
|
|
69
|
+
menuCode: "products",
|
|
70
|
+
menuIcon: EIcons.CUBE,
|
|
71
|
+
menuName: "Our Products",
|
|
72
|
+
menuUrl: "/our-products",
|
|
73
|
+
documentTitle: "Our Products",
|
|
74
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
75
|
+
displayOrder: 4,
|
|
76
|
+
pageTitle: "Our Products",
|
|
77
|
+
breadcrumbTitle: "Our Products",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 7,
|
|
81
|
+
menuCode: "blog",
|
|
82
|
+
menuIcon: EIcons.NEWSPAPER,
|
|
83
|
+
menuName: "Blog",
|
|
84
|
+
menuUrl: "/blog",
|
|
85
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
86
|
+
displayOrder: 5,
|
|
87
|
+
pageTitle: "Blog",
|
|
88
|
+
breadcrumbTitle: "Blog",
|
|
89
|
+
documentTitle: "Blog",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 8,
|
|
93
|
+
menuCode: "portfolio-gallery",
|
|
94
|
+
menuIcon: EIcons.IMAGES,
|
|
95
|
+
menuName: "Portfolio Gallery",
|
|
96
|
+
menuUrl: "/portfolio-gallery",
|
|
97
|
+
documentTitle: "Portfolio Gallery",
|
|
98
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
99
|
+
displayOrder: 6,
|
|
100
|
+
pageTitle: "Portfolio Gallery",
|
|
101
|
+
breadcrumbTitle: "Portfolio Gallery",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 9,
|
|
105
|
+
menuCode: "our-gallery",
|
|
106
|
+
menuIcon: EIcons.IMAGES,
|
|
107
|
+
menuName: "Our Gallery",
|
|
108
|
+
menuUrl: "/our-gallery",
|
|
109
|
+
documentTitle: "Our Gallery",
|
|
110
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
111
|
+
displayOrder: 6,
|
|
112
|
+
pageTitle: "Our Gallery",
|
|
113
|
+
breadcrumbTitle: "Our Gallery",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 10,
|
|
117
|
+
menuCode: "services",
|
|
118
|
+
menuIcon: EIcons.CONSTRUCT,
|
|
119
|
+
menuName: "Services",
|
|
120
|
+
menuUrl: "/services",
|
|
121
|
+
documentTitle: "Services",
|
|
122
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
123
|
+
displayOrder: 7,
|
|
124
|
+
pageTitle: "Services",
|
|
125
|
+
breadcrumbTitle: "Services",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 11,
|
|
129
|
+
menuCode: "faq",
|
|
130
|
+
menuIcon: EIcons.HELP_CIRCLE,
|
|
131
|
+
menuName: "FAQ",
|
|
132
|
+
menuUrl: "/faq",
|
|
133
|
+
documentTitle: "FAQ",
|
|
134
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
135
|
+
displayOrder: 8,
|
|
136
|
+
pageTitle: "FAQ",
|
|
137
|
+
breadcrumbTitle: "FAQ",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: 12,
|
|
141
|
+
menuCode: "contact-me",
|
|
142
|
+
menuIcon: EIcons.CALL,
|
|
143
|
+
menuName: "Contact Me",
|
|
144
|
+
menuUrl: "/contact-me",
|
|
145
|
+
documentTitle: "Contact Me",
|
|
146
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
147
|
+
displayOrder: 9,
|
|
148
|
+
pageTitle: "Contact Me",
|
|
149
|
+
breadcrumbTitle: "Contact Me",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 13,
|
|
153
|
+
menuCode: "contact-us",
|
|
154
|
+
menuIcon: EIcons.CALL,
|
|
155
|
+
menuName: "Contact Us",
|
|
156
|
+
menuUrl: "/contact-us",
|
|
157
|
+
documentTitle: "Contact Us",
|
|
158
|
+
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
159
|
+
displayOrder: 9,
|
|
160
|
+
pageTitle: "Contact Us",
|
|
161
|
+
breadcrumbTitle: "Contact Us",
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const GetUtilityMenus = async (): Promise<IUtilityMenu[]> => {
|
|
167
|
+
return [
|
|
168
|
+
{
|
|
169
|
+
id: 1,
|
|
170
|
+
menuCode: "root-search",
|
|
171
|
+
menuIcon: EIcons.SEARCH,
|
|
172
|
+
menuName: "Search",
|
|
173
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
174
|
+
displayOrder: 1,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 2,
|
|
178
|
+
menuCode: "favorite-menu",
|
|
179
|
+
menuIcon: EIcons.HEART,
|
|
180
|
+
menuName: "Favorite",
|
|
181
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
182
|
+
displayOrder: 2,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: 3,
|
|
186
|
+
menuCode: "cart-menu",
|
|
187
|
+
menuIcon: EIcons.CART,
|
|
188
|
+
menuName: "Cart",
|
|
189
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
190
|
+
displayOrder: 3,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 4,
|
|
194
|
+
menuCode: "switch-theme",
|
|
195
|
+
menuIcon: EIcons.COLOR_PALETTE,
|
|
196
|
+
menuName: "Theme",
|
|
197
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
198
|
+
displayOrder: 4,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 5,
|
|
202
|
+
menuCode: "mega-menu",
|
|
203
|
+
menuIcon: EIcons.GRID,
|
|
204
|
+
menuName: "Mega Menu",
|
|
205
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
206
|
+
displayOrder: 5,
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const GetUserPanels = async (): Promise<IPanelMenu[]> => {
|
|
212
|
+
return [
|
|
213
|
+
{
|
|
214
|
+
id: 1,
|
|
215
|
+
menuCode: "message-menu",
|
|
216
|
+
menuIcon: EIcons.MAIL,
|
|
217
|
+
menuName: "Messages",
|
|
218
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
219
|
+
displayOrder: 1,
|
|
220
|
+
groupOrder: 1,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: 2,
|
|
224
|
+
menuCode: "notification-menu",
|
|
225
|
+
menuIcon: EIcons.NOTIFICATIONS,
|
|
226
|
+
menuName: "Notifications",
|
|
227
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
228
|
+
displayOrder: 2,
|
|
229
|
+
groupOrder: 1,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: 3,
|
|
233
|
+
menuCode: "switch-theme",
|
|
234
|
+
menuIcon: EIcons.COLOR_PALETTE,
|
|
235
|
+
menuName: "Theme Mode",
|
|
236
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
237
|
+
displayOrder: 2,
|
|
238
|
+
groupOrder: 2,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: 4,
|
|
242
|
+
menuCode: "language",
|
|
243
|
+
menuIcon: EIcons.LANGUAGE,
|
|
244
|
+
menuName: "Language",
|
|
245
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
246
|
+
displayOrder: 2,
|
|
247
|
+
groupOrder: 2,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: 5,
|
|
251
|
+
menuCode: "currency",
|
|
252
|
+
menuIcon: EIcons.CASH,
|
|
253
|
+
menuName: "Currency Format",
|
|
254
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
255
|
+
displayOrder: 2,
|
|
256
|
+
groupOrder: 2,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: 6,
|
|
260
|
+
menuCode: "calendar-date",
|
|
261
|
+
menuIcon: EIcons.CALENDAR,
|
|
262
|
+
menuName: "Calendar Date",
|
|
263
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
264
|
+
displayOrder: 2,
|
|
265
|
+
groupOrder: 2,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 7,
|
|
269
|
+
menuCode: "help-support",
|
|
270
|
+
menuIcon: EIcons.HELP_CIRCLE,
|
|
271
|
+
menuName: "Help & Support",
|
|
272
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
273
|
+
displayOrder: 2,
|
|
274
|
+
groupOrder: 2,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: 8,
|
|
278
|
+
menuCode: "settings",
|
|
279
|
+
menuIcon: EIcons.SETTINGS,
|
|
280
|
+
menuName: "Account Settings",
|
|
281
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
282
|
+
displayOrder: 3,
|
|
283
|
+
groupOrder: 3,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: 9,
|
|
287
|
+
menuCode: "switch-branch",
|
|
288
|
+
menuIcon: EIcons.REPEAT,
|
|
289
|
+
menuName: "Switch Branch",
|
|
290
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
291
|
+
displayOrder: 3,
|
|
292
|
+
groupOrder: 3,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 10,
|
|
296
|
+
menuCode: "switch-fiscal-year",
|
|
297
|
+
menuIcon: EIcons.CALENDAR,
|
|
298
|
+
menuName: "Switch Fiscal Year",
|
|
299
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
300
|
+
displayOrder: 3,
|
|
301
|
+
groupOrder: 3,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: 11,
|
|
305
|
+
menuCode: "sign-out",
|
|
306
|
+
menuIcon: EIcons.EXIT,
|
|
307
|
+
menuName: "Sign Out",
|
|
308
|
+
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
309
|
+
displayOrder: 3,
|
|
310
|
+
groupOrder: 3,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: 12,
|
|
314
|
+
menuCode: "sign-in",
|
|
315
|
+
menuIcon: EIcons.LOGIN,
|
|
316
|
+
menuName: "Sign In",
|
|
317
|
+
menuVisibilities: EMenuVisibility.GuestOnly,
|
|
318
|
+
displayOrder: 3,
|
|
319
|
+
groupOrder: 3,
|
|
320
|
+
},
|
|
321
|
+
];
|
|
322
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { IsValidURL } from "../../helpers/browser-helpers";
|
|
4
|
+
import { SetElementStyles } from "../../helpers/element-helpers";
|
|
5
|
+
import { DEFAULT_BUTTON_CLASS, DEFAULT_LINK_BUTTON_STYLE, EButtonTypes, ETargets, IButton } from "../../interfaces/button-interfaces";
|
|
6
|
+
import { EIconTypes } from "../../interfaces/icon-interfaces";
|
|
7
|
+
import { COLUMN_SIZE_ATTRIBUTE_KEY, EFlexPositions, EOpacity, ESizes } from "../../interfaces/layout-interfaces";
|
|
8
|
+
import { EBackgroundColors, EBackgrounds } from "../../interfaces/theme-interfaces";
|
|
9
|
+
import { ClickHandler, UN } from "../../interfaces/type-interfaces";
|
|
10
|
+
import { NEXUS_CONFIG } from "../../nexus.environments";
|
|
11
|
+
import { CreateIcon, Icon } from "./icon-box";
|
|
12
|
+
|
|
13
|
+
export const SET_BUTTON_ACTIVE_CLASS = (isActive: boolean, element: HTMLElement, overrideColor?: EBackgroundColors | null, overrideActive?: string) => {
|
|
14
|
+
if (!element) return;
|
|
15
|
+
|
|
16
|
+
if (overrideColor) element.style.setProperty("--ACTIVE_BORDER_COLOR", overrideColor);
|
|
17
|
+
|
|
18
|
+
if (isActive) element.classList.add(overrideActive ?? "active");
|
|
19
|
+
else element.classList.remove(overrideActive ?? "active");
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Button = ({ button, buttonType, styles, needColumnSize }: { button: IButton; buttonType?: EButtonTypes; styles?: React.CSSProperties | UN; needColumnSize?: boolean | UN }) => {
|
|
23
|
+
return IsValidURL(button.url) ? (
|
|
24
|
+
<Link href={button.url ?? "#"} style={styles ?? undefined} className={DEFAULT_BUTTON_CLASS(button.columnSize, undefined, button.borderSize, button.background, button.defaultClass, needColumnSize)} key={button.displayOrder ?? 0} type={buttonType ?? EButtonTypes.BUTTON} onClick={(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => button.onClick?.(event, event.currentTarget as HTMLElement, button.data, button.displayOrder)}>
|
|
25
|
+
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.FILLED} opacity={EOpacity.O08} size={ESizes.Small} defaultClass="mr4" />}
|
|
26
|
+
<span>{button.label instanceof Function ? button.label(button.data) : button.label}</span>
|
|
27
|
+
</Link>
|
|
28
|
+
) : (
|
|
29
|
+
<button style={styles ?? undefined} className={DEFAULT_BUTTON_CLASS(button.columnSize, undefined, button.borderSize, button.background, button.defaultClass, needColumnSize)} key={button.displayOrder} type={buttonType ?? EButtonTypes.BUTTON} onClick={(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => button.onClick?.(event, event.currentTarget as HTMLElement, button.data, button.displayOrder)}>
|
|
30
|
+
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.FILLED} opacity={EOpacity.O08} size={ESizes.Small} defaultClass="mr4" />}
|
|
31
|
+
<span>{button.label instanceof Function ? button.label(button.data) : button.label}</span>
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
export const CreateButton = (param: IButton, parent?: HTMLElement | UN, styles?: React.CSSProperties | UN, needColumnSize?: boolean | UN) => {
|
|
36
|
+
const button = document.createElement(param.url ? "a" : "button");
|
|
37
|
+
button.setAttribute(COLUMN_SIZE_ATTRIBUTE_KEY, (param.columnSize ?? 12).toString());
|
|
38
|
+
if (param.icon) {
|
|
39
|
+
const icon = CreateIcon(param.icon, button, param.iconType, param.iconSize ?? ESizes.Small, null, null);
|
|
40
|
+
icon.classList.add("mr4");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
SetElementStyles(button, styles);
|
|
44
|
+
|
|
45
|
+
button.className = DEFAULT_BUTTON_CLASS(param.columnSize, undefined, param.borderSize, param.background ?? NEXUS_CONFIG.DEFAULT_BACKGROUND, undefined, needColumnSize);
|
|
46
|
+
const span = document.createElement("span");
|
|
47
|
+
span.textContent = param.label instanceof Function ? (param.label(param.data) ?? null) : (param.label ?? null);
|
|
48
|
+
button.appendChild(span);
|
|
49
|
+
button.onclick = (e) => param.onClick?.(e, button, param.data, param.displayOrder);
|
|
50
|
+
if (param.url) {
|
|
51
|
+
(button as HTMLAnchorElement).href = param.url;
|
|
52
|
+
(button as HTMLAnchorElement).target = param.target ?? ETargets.Blank;
|
|
53
|
+
}
|
|
54
|
+
if (parent) parent.appendChild(button);
|
|
55
|
+
return button;
|
|
56
|
+
};
|
|
57
|
+
export const Buttons = ({ buttons, buttonStyles, padding, border, maxHeight, boxDefaultClass, needColumnSize, pt }: { buttons: IButton[]; padding?: number; buttonStyles?: React.CSSProperties | UN; border?: number; maxHeight?: number; boxDefaultClass?: string; needColumnSize?: boolean; pt?: number }) => {
|
|
58
|
+
return (
|
|
59
|
+
<div className={`row ${maxHeight ? "sb" : ""} ${boxDefaultClass ?? ""} r sm p${padding ?? 5} b${border ?? 0} ${pt !== undefined ? `pt${pt}` : ""}`}>
|
|
60
|
+
{buttons.map((button) => (
|
|
61
|
+
<Button key={button.id} button={button} needColumnSize={needColumnSize} styles={buttonStyles} />
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export const CreateButtons = (buttons: IButton[], parent?: HTMLElement | UN, buttonStyles?: React.CSSProperties | UN, columns?: number | UN, padding?: number | UN, border?: number | UN, maxHeight?: number | UN, boxDefaultClass?: string | UN, needColumnSize?: boolean | UN) => {
|
|
67
|
+
if (!buttons || buttons.length === 0) return;
|
|
68
|
+
maxHeight ??= 25;
|
|
69
|
+
const sortButtons = buttons.sort((a, b) => (a.displayOrder ?? 0) - (b.displayOrder ?? 0));
|
|
70
|
+
const buttonBox = document.createElement("div");
|
|
71
|
+
if (maxHeight) buttonBox.style.maxHeight = `${maxHeight}rem`;
|
|
72
|
+
|
|
73
|
+
buttonBox.className = `row ${maxHeight ? "sb" : ""} ${boxDefaultClass ?? ""} r sm p${padding ?? 5} b${border ?? 0}`;
|
|
74
|
+
for (const button of sortButtons) {
|
|
75
|
+
// Set column size if valid columns provided
|
|
76
|
+
if (columns && !button.columnSize) button.columnSize = columns;
|
|
77
|
+
|
|
78
|
+
CreateButton(button, buttonBox, buttonStyles, needColumnSize);
|
|
79
|
+
}
|
|
80
|
+
if (parent) parent.appendChild(buttonBox);
|
|
81
|
+
return buttonBox;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
interface ILinkButtonProps {
|
|
85
|
+
url: string;
|
|
86
|
+
label: string;
|
|
87
|
+
defaultClass?: string | UN;
|
|
88
|
+
linkDefaultClass?: string | UN;
|
|
89
|
+
onClicked?: ClickHandler | UN;
|
|
90
|
+
borderBottom?: boolean | UN;
|
|
91
|
+
background?: EBackgrounds | UN;
|
|
92
|
+
target?: ETargets | UN;
|
|
93
|
+
position?: EFlexPositions | UN;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const _getPDefaultClass = (defaultClass?: string | UN, position?: EFlexPositions | UN) => `${defaultClass ?? ""} df ${position ?? EFlexPositions.Center}`;
|
|
97
|
+
const _getLinkDefaultClass = (linkDefaultClass?: string | UN, background?: EBackgrounds | UN) => `${background ?? EBackgrounds.Background1} ${linkDefaultClass ?? "o08 ho1"} db h p2 r`;
|
|
98
|
+
const _getLinkDefaultStyle = (borderBottom?: boolean | UN) => (borderBottom ? DEFAULT_LINK_BUTTON_STYLE : { width: "fit-content" });
|
|
99
|
+
|
|
100
|
+
export const LinkButton = ({ url, label, defaultClass, linkDefaultClass, onClicked, borderBottom, background, target, position }: Readonly<ILinkButtonProps>) => {
|
|
101
|
+
return (
|
|
102
|
+
<p className={_getPDefaultClass(defaultClass, position)}>
|
|
103
|
+
<Link style={_getLinkDefaultStyle(borderBottom)} onClick={onClicked ?? undefined} target={target ?? undefined} className={_getLinkDefaultClass(linkDefaultClass, background)} href={url}>
|
|
104
|
+
{label}
|
|
105
|
+
</Link>
|
|
106
|
+
</p>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const CreateLinkButton = (
|
|
111
|
+
parent: HTMLElement | UN,
|
|
112
|
+
//
|
|
113
|
+
url: string,
|
|
114
|
+
label: string,
|
|
115
|
+
onClicked?: ClickHandler | UN,
|
|
116
|
+
defaultClass?: string | UN,
|
|
117
|
+
linkDefaultClass?: string | UN,
|
|
118
|
+
borderBottom?: boolean | UN,
|
|
119
|
+
background?: EBackgrounds | UN,
|
|
120
|
+
target?: ETargets | UN,
|
|
121
|
+
position?: EFlexPositions | UN,
|
|
122
|
+
) => {
|
|
123
|
+
const p = document.createElement("p");
|
|
124
|
+
p.className = _getPDefaultClass(defaultClass, position);
|
|
125
|
+
const link = document.createElement("a");
|
|
126
|
+
link.href = url;
|
|
127
|
+
link.className = _getLinkDefaultClass(linkDefaultClass, background);
|
|
128
|
+
link.onclick = onClicked ?? null;
|
|
129
|
+
link.innerText = label;
|
|
130
|
+
|
|
131
|
+
if (parent) parent.appendChild(p);
|
|
132
|
+
p.appendChild(link);
|
|
133
|
+
|
|
134
|
+
if (target) link.target = target;
|
|
135
|
+
return p;
|
|
136
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { JSX } from "react";
|
|
2
|
+
import { SetElementStyles } from "../../helpers/element-helpers";
|
|
3
|
+
import { DEFAULT_ICON_ELEMENT_NAME, EIcons, EIconTypes } from "../../interfaces/icon-interfaces";
|
|
4
|
+
import { EBadgeTypes, EOpacity, ESizes } from "../../interfaces/layout-interfaces";
|
|
5
|
+
import { EBackgrounds } from "../../interfaces/theme-interfaces";
|
|
6
|
+
import { ClickHandler, UN } from "../../interfaces/type-interfaces";
|
|
7
|
+
|
|
8
|
+
interface IIconBoxProps {
|
|
9
|
+
icon: EIcons;
|
|
10
|
+
children?: React.ReactNode | UN;
|
|
11
|
+
id?: string | UN;
|
|
12
|
+
iconType?: EIconTypes | UN;
|
|
13
|
+
iconSize?: ESizes | UN;
|
|
14
|
+
boxSize?: ESizes | UN;
|
|
15
|
+
background?: EBackgrounds | UN;
|
|
16
|
+
defaultClass?: string | UN;
|
|
17
|
+
iconDefaultClass?: string | UN;
|
|
18
|
+
badgeType?: EBadgeTypes | UN;
|
|
19
|
+
badgeCount?: number | UN;
|
|
20
|
+
iconOpacity?: EOpacity;
|
|
21
|
+
title?: string | UN;
|
|
22
|
+
dataKeys?: { key: string; val: string }[] | UN;
|
|
23
|
+
makeRound?: boolean | UN;
|
|
24
|
+
boxStyle?: React.CSSProperties | UN;
|
|
25
|
+
onClicked?: ClickHandler | UN;
|
|
26
|
+
onMouseEnter?: ClickHandler | UN;
|
|
27
|
+
disabledHoverEffect?: boolean | UN;
|
|
28
|
+
}
|
|
29
|
+
interface IIconProps {
|
|
30
|
+
icon: EIcons;
|
|
31
|
+
type?: EIconTypes | UN;
|
|
32
|
+
size?: ESizes | UN;
|
|
33
|
+
defaultClass?: string | UN;
|
|
34
|
+
opacity?: EOpacity | UN;
|
|
35
|
+
style?: React.CSSProperties | UN;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const _getIconClass = (size?: ESizes | UN, defaultClass?: string | UN, opacity?: EOpacity | UN) => `icon ${size ?? ESizes.Normal} ${defaultClass ?? ""} ${opacity ?? EOpacity.O08}`;
|
|
39
|
+
|
|
40
|
+
export const Icon = ({ icon, type, size, style, defaultClass, opacity }: IIconProps): JSX.Element => {
|
|
41
|
+
const c = _getIconClass(size, defaultClass, opacity ?? EOpacity.O06);
|
|
42
|
+
return React.createElement(DEFAULT_ICON_ELEMENT_NAME, {
|
|
43
|
+
name: `${icon ?? EIcons.HOME}${type ?? EIconTypes.OUTLINED}`,
|
|
44
|
+
style: style ?? undefined,
|
|
45
|
+
className: c,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export const CreateIcon = (icon: EIcons, parent?: HTMLElement | UN, type?: EIconTypes | UN, size?: ESizes | UN, defaultClass?: string | UN, opacity?: EOpacity | UN, style?: React.CSSProperties | UN) => {
|
|
49
|
+
const iconElement = document.createElement(DEFAULT_ICON_ELEMENT_NAME);
|
|
50
|
+
(iconElement as any).name = `${icon ?? EIcons.HOME}${type ?? EIconTypes.OUTLINED}` as string;
|
|
51
|
+
SetElementStyles(iconElement, style);
|
|
52
|
+
(iconElement as any).className = _getIconClass(size, defaultClass, opacity) as string;
|
|
53
|
+
if (parent) parent.appendChild(iconElement);
|
|
54
|
+
return iconElement;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const _getBoxClass = (background?: EBackgrounds | UN, makeRound?: boolean | UN, defaultClass?: string | UN, boxSize?: ESizes | UN, isNeedHover?: boolean | UN) => `ib ${background} ${makeRound !== false ? "r" : ""} r item ${defaultClass ?? ""} ${boxSize ?? ESizes.Normal} ${isNeedHover ? "h" : ""}`;
|
|
58
|
+
|
|
59
|
+
export const Iconbox = ({ children, id, icon, iconType, iconSize, boxSize, background, defaultClass, iconDefaultClass, badgeType, badgeCount, iconOpacity, title, dataKeys, makeRound, boxStyle, onClicked, onMouseEnter, disabledHoverEffect }: Readonly<IIconBoxProps>): JSX.Element => {
|
|
60
|
+
background = background ?? EBackgrounds.Background1;
|
|
61
|
+
const isNeedHover = disabledHoverEffect !== false;
|
|
62
|
+
const c = _getBoxClass(background, makeRound, defaultClass, boxSize, isNeedHover);
|
|
63
|
+
const dataAttributes = (dataKeys ?? []).reduce((acc, { key, val }) => {
|
|
64
|
+
(acc as any)[`data-${key}`] = val;
|
|
65
|
+
return acc;
|
|
66
|
+
}, {});
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div {...dataAttributes} id={id ?? undefined} style={boxStyle ?? undefined} className={c} onClick={onClicked ?? undefined} onMouseEnter={onMouseEnter ?? undefined}>
|
|
70
|
+
{title && <span className="title nw">{title}</span>}
|
|
71
|
+
<Icon icon={icon} opacity={iconOpacity} type={iconType} size={iconSize} defaultClass={iconDefaultClass} />
|
|
72
|
+
{children}
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
export const CreateIconBox = (icon: EIcons, parent?: HTMLElement | UN, children?: HTMLElement | UN, id?: string | UN, iconType?: EIconTypes | UN, background?: EBackgrounds | UN, boxSize?: ESizes | UN, iconSize?: ESizes | UN, defaultClass?: string | UN, iconDefaultClass?: string | UN, badgeType?: EBadgeTypes | UN, badgeCount?: number | UN, iconOpacity?: EOpacity | UN, title?: string | UN, dataKeys?: { key: string; val: string }[] | UN, makeRound?: boolean | UN, boxStyle?: React.CSSProperties | UN, onClicked?: ClickHandler | UN, onMouseEnter?: ClickHandler | UN, disabledHoverEffect?: boolean | UN): HTMLElement => {
|
|
77
|
+
background = background ?? EBackgrounds.Background1;
|
|
78
|
+
const isNeedHover = disabledHoverEffect !== false;
|
|
79
|
+
const iconBox = document.createElement("div");
|
|
80
|
+
iconBox.className = _getBoxClass(background, makeRound, defaultClass, boxSize, isNeedHover);
|
|
81
|
+
SetElementStyles(iconBox, boxStyle);
|
|
82
|
+
|
|
83
|
+
if (onClicked) iconBox.onclick = onClicked;
|
|
84
|
+
if (onMouseEnter) iconBox.onmouseenter = onMouseEnter;
|
|
85
|
+
if (parent) parent.appendChild(iconBox);
|
|
86
|
+
|
|
87
|
+
CreateIcon(icon, iconBox, iconType, iconSize, iconDefaultClass, iconOpacity);
|
|
88
|
+
if (children) iconBox.appendChild(children as HTMLElement);
|
|
89
|
+
return iconBox;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? "bg1"} ml5`, "r90");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export const GLOBAL_PAGE_TITLE_CLASS = (defaultClass?: string, borderBottom?: number, marginBottom?: number, paddingBottom?: number) => `fs-12 o09 fw600 ${defaultClass ?? ""} bb${borderBottom ?? 0} mb${marginBottom ?? 0} pb${paddingBottom ?? 0}`;
|
|
4
|
+
|
|
5
|
+
export const PageTitle = ({ title, defaultClass, borderBottom, marginBottom }: { title: string; defaultClass?: string; borderBottom?: number; marginBottom?: number }) => {
|
|
6
|
+
return <h6 className={GLOBAL_PAGE_TITLE_CLASS(defaultClass, borderBottom, marginBottom, borderBottom ? 2 : 0)}>{title}</h6>;
|
|
7
|
+
};
|