datastake-daf 0.6.501 → 0.6.503

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 (31) hide show
  1. package/dist/layouts/index.css +1 -0
  2. package/dist/layouts/index.js +7137 -0
  3. package/dist/utils/index.js +287 -0
  4. package/package.json +1 -1
  5. package/rollup.config.js +25 -0
  6. package/src/@daf/hooks/usePermissions.js +20 -0
  7. package/src/@daf/layouts/AppLayout/AppLayout.stories.js +532 -0
  8. package/src/@daf/layouts/AppLayout/components/LoginPopup/index.js +116 -0
  9. package/src/@daf/layouts/AppLayout/components/LoginPopup/style.js +26 -0
  10. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +208 -0
  11. package/src/@daf/layouts/AppLayout/components/MobileDrawer/style.js +87 -0
  12. package/src/@daf/layouts/AppLayout/components/Notifications/Notification/index.js +31 -0
  13. package/src/@daf/layouts/AppLayout/components/Notifications/NotificationHistory/index.js +22 -0
  14. package/src/@daf/layouts/AppLayout/components/Notifications/context/index.js +79 -0
  15. package/src/@daf/layouts/AppLayout/components/Notifications/index.js +106 -0
  16. package/src/@daf/layouts/AppLayout/components/Notifications/style.js +61 -0
  17. package/src/@daf/layouts/AppLayout/components/Notifications/useNotifications.js +105 -0
  18. package/src/@daf/layouts/AppLayout/components/Sidenav/index.js +296 -0
  19. package/src/@daf/layouts/AppLayout/components/UserDropdown/UserIcon.js +96 -0
  20. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +112 -0
  21. package/src/@daf/layouts/AppLayout/index.jsx +384 -0
  22. package/src/@daf/layouts/AppLayout/index.scss +5 -0
  23. package/src/@daf/layouts/AppLayout/styles/header.scss +257 -0
  24. package/src/@daf/layouts/AppLayout/styles/layout.scss +76 -0
  25. package/src/@daf/layouts/AppLayout/styles/responsive.scss +52 -0
  26. package/src/@daf/layouts/AppLayout/styles/sidebar.scss +79 -0
  27. package/src/@daf/layouts/AppLayout/styles/variables.scss +22 -0
  28. package/src/helpers/theme.js +304 -0
  29. package/src/helpers/user.js +4 -0
  30. package/src/layouts.js +1 -0
  31. package/src/utils.js +4 -2
@@ -0,0 +1,52 @@
1
+ @import './variables';
2
+
3
+ @media (max-width: $mobile-breakpoint) {
4
+ .components-layout {
5
+ .sidenav-sider.desktop-sider {
6
+ display: none;
7
+ }
8
+
9
+ .layout-header {
10
+ padding: 0 16px;
11
+
12
+ .left-sidebar,
13
+ .right-sidebar {
14
+ gap: 12px;
15
+ }
16
+ }
17
+
18
+ .layout-children {
19
+ padding: 12px;
20
+ }
21
+ }
22
+
23
+ // Hide certain elements on mobile
24
+ .user-dropdown-layout {
25
+ .drop-header {
26
+ padding: 12px;
27
+
28
+ h4 {
29
+ font-size: 13px;
30
+ }
31
+
32
+ p {
33
+ font-size: 11px;
34
+ }
35
+ }
36
+
37
+ .list {
38
+ .list-item {
39
+ padding: 8px 12px;
40
+ font-size: 13px;
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ // Large screens
47
+ @media (min-width: 1920px) {
48
+ .layout-children {
49
+ max-width: 1600px;
50
+ margin: 0 auto;
51
+ }
52
+ }
@@ -0,0 +1,79 @@
1
+ @import './variables';
2
+
3
+ .sidenav-sider {
4
+ background: $primary-bg;
5
+ height: 100dvh;
6
+ position: relative;
7
+ transition: all $transition-speed;
8
+ z-index: $z-sidebar;
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ &.desktop-sider {
13
+ @media (max-width: $mobile-breakpoint) {
14
+ display: none;
15
+ }
16
+ }
17
+
18
+ .logo {
19
+ padding: 20px;
20
+ text-align: center;
21
+ border-bottom: 1px solid $border-color;
22
+ background: $primary-bg;
23
+
24
+ img {
25
+ max-width: 100%;
26
+ height: auto;
27
+ max-height: 40px;
28
+ cursor: pointer;
29
+ transition: all $transition-speed;
30
+ object-fit: contain;
31
+
32
+ &:hover {
33
+ opacity: 0.8;
34
+ }
35
+ }
36
+ }
37
+
38
+ &.sidenav-sider-collapsed {
39
+ width: $sidebar-collapsed-width !important;
40
+ min-width: $sidebar-collapsed-width !important;
41
+
42
+ .logo {
43
+ padding: 20px 10px;
44
+
45
+ img {
46
+ max-height: 32px;
47
+ }
48
+ }
49
+ }
50
+
51
+ &.sidenav-sider-opened {
52
+ width: $sidebar-width;
53
+ min-width: $sidebar-width;
54
+ }
55
+ }
56
+
57
+ // Sidenav menu items
58
+ .sidenav-menu {
59
+ flex: 1;
60
+ overflow-y: auto;
61
+ overflow-x: hidden;
62
+
63
+ &::-webkit-scrollbar {
64
+ width: 6px;
65
+ }
66
+
67
+ &::-webkit-scrollbar-track {
68
+ background: transparent;
69
+ }
70
+
71
+ &::-webkit-scrollbar-thumb {
72
+ background: rgba(255, 255, 255, 0.2);
73
+ border-radius: 3px;
74
+
75
+ &:hover {
76
+ background: rgba(255, 255, 255, 0.3);
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,22 @@
1
+ // Colors
2
+ $primary-bg: #1a1d29;
3
+ $secondary-bg: #262b3d;
4
+ $border-color: rgba(255, 255, 255, 0.1);
5
+ $text-primary: #ffffff;
6
+ $text-secondary: #8c8c8c;
7
+ $hover-bg: rgba(255, 255, 255, 0.1);
8
+
9
+ // Spacing
10
+ $header-height: 64px;
11
+ $sidebar-width: 250px;
12
+ $sidebar-collapsed-width: 70px;
13
+ $mobile-breakpoint: 768px;
14
+
15
+ // Transitions
16
+ $transition-speed: 0.3s;
17
+
18
+ // Z-index
19
+ $z-header: 1000;
20
+ $z-sidebar: 999;
21
+ $z-mobile-drawer: 1001;
22
+ $z-modal: 1050;
@@ -0,0 +1,304 @@
1
+ const baseTheme = {
2
+ // Base
3
+ white: '#ffffff',
4
+ colorPrimary: '#E3591E',
5
+ borderColor: '#EAECF0',
6
+
7
+ // Gray
8
+ gray50: '#D2D6DB',
9
+
10
+ // Base Gray
11
+ baseGray10: '#FCFCFD',
12
+ baseGray20: '#f5f5f5',
13
+ baseGray30: '#F3F4F6',
14
+ baseGray40: '#E5E7EB',
15
+ baseGray50: '#D2D6DB',
16
+ baseGray60: '#9DA4AE',
17
+ baseGray70: '#6C737F',
18
+ baseGray80: '#4D5761',
19
+ baseGray90: '#384250',
20
+ baseGray100: '#2B3644',
21
+ baseGray110: '#1F2A37',
22
+
23
+ // Primary
24
+ colorPrimary1: '#FFF3EE',
25
+ colorPrimary2: '#F7CFBD',
26
+ colorPrimary3: '#F5C2AC',
27
+ colorPrimary4: '#F2B59A',
28
+ colorPrimary5: '#F0A888',
29
+ colorPrimary6: '#EC8D65',
30
+ colorPrimary7: '#E3591E',
31
+ colorPrimary8: '#D2521B',
32
+ colorPrimary9: '#C04B19',
33
+ colorPrimary10: '#9D3D14',
34
+
35
+ // Success
36
+ success1: '#F6FEF9',
37
+ success2: '#ECFDF3',
38
+ success3: '#D7FBE5',
39
+ success4: '#B0F3CB',
40
+ success5: '#6AD99E',
41
+ success6: '#32D583',
42
+ success7: '#12B76A',
43
+ success8: '#039855',
44
+ success9: '#05603A',
45
+ success10: '#054F31',
46
+
47
+ // Warning
48
+ warning1: '#FFFCF5',
49
+ warning2: '#FFFAEB',
50
+ warning3: '#FEF0C7',
51
+ warning4: '#FEDF89',
52
+ warning5: '#FEC84B',
53
+ warning6: '#FDB022',
54
+ warning7: '#F79009',
55
+ warning8: '#DC6803',
56
+ warning9: '#B54708',
57
+ warning10: '#93370D',
58
+
59
+ // Error
60
+ error1: '#FFFBFA',
61
+ error2: '#FEF3F2',
62
+ error3: '#FEE4E2',
63
+ error4: '#FECDCA',
64
+ error5: '#FDA29B',
65
+ error6: '#F97066',
66
+ error7: '#F04438',
67
+ error8: '#D92D20',
68
+ error9: '#B42318',
69
+ error10: '#912018',
70
+
71
+ // Red
72
+ red1: '#FFF1F0',
73
+ red2: '#FFCCC7',
74
+ red3: '#FFA39E',
75
+ red4: '#FF7875',
76
+ red5: '#FF4D4F',
77
+ red6: '#F5222D',
78
+ red7: '#CF1322',
79
+ red8: '#A8071A',
80
+ red9: '#820014',
81
+ red10: '#5C0011',
82
+
83
+ // Volcano
84
+ volcano1: '#FFF2E8',
85
+ volcano2: '#FFD8BF',
86
+ volcano3: '#FFBB96',
87
+ volcano4: '#FF9C6E',
88
+ volcano5: '#FF7A45',
89
+ volcano6: '#FA541C',
90
+ volcano7: '#D4380D',
91
+ volcano8: '#AD2102',
92
+ volcano9: '#871400',
93
+ volcano10: '#610B00',
94
+
95
+ // Orange
96
+ orange1: '#FFF7E6',
97
+ orange2: '#FFE7BA',
98
+ orange3: '#FFD591',
99
+ orange4: '#FFC069',
100
+ orange5: '#FFA940',
101
+ orange6: '#FA8C16',
102
+ orange7: '#D46B08',
103
+ orange8: '#AD4E00',
104
+ orange9: '#873800',
105
+ orange10: '#612500',
106
+
107
+ // Gold
108
+ gold1: '#FFFBE6',
109
+ gold2: '#FFF1B8',
110
+ gold3: '#FFE58F',
111
+ gold4: '#FFD666',
112
+ gold5: '#FFC53D',
113
+ gold6: '#FAAD14',
114
+ gold7: '#D48806',
115
+ gold8: '#AD6800',
116
+ gold9: '#874D00',
117
+ gold10: '#613400',
118
+
119
+ // Yellow
120
+ yellow1: '#feffe6',
121
+ yellow2: '#ffffb8',
122
+ yellow3: '#fffb8f',
123
+ yellow4: '#fff566',
124
+ yellow5: '#ffec3d',
125
+ yellow6: '#fadb14',
126
+ yellow7: '#d4b106',
127
+ yellow8: '#ad8b00',
128
+ yellow9: '#876800',
129
+ yellow10: '#614700',
130
+
131
+ // Lime
132
+ lime1: '#FCFFE6',
133
+ lime2: '#F4FFB8',
134
+ lime3: '#EAFF8F',
135
+ lime4: '#D3F261',
136
+ lime5: '#BAE637',
137
+ lime6: '#A0D911',
138
+ lime7: '#7CB305',
139
+ lime8: '#5B8C00',
140
+ lime9: '#3F6600',
141
+ lime10: '#254000',
142
+
143
+ // Green
144
+ green1: '#F6FFED',
145
+ green2: '#D9F7BE',
146
+ green3: '#B7EB8F',
147
+ green4: '#95DE64',
148
+ green5: '#73D13D',
149
+ green6: '#52C41A',
150
+ green7: '#389E0D',
151
+ green8: '#237804',
152
+ green9: '#135200',
153
+ green10: '#092B00',
154
+
155
+ // Cyan
156
+ cyan1: '#E6FFFB',
157
+ cyan2: '#B5F5EC',
158
+ cyan3: '#87E8DE',
159
+ cyan4: '#5CDBD3',
160
+ cyan5: '#36CFC9',
161
+ cyan6: '#13C2C2',
162
+ cyan7: '#08979C',
163
+ cyan8: '#006D75',
164
+ cyan9: '#00474F',
165
+ cyan10: '#002329',
166
+
167
+ // Blue
168
+ blue1: '#E6F4FF',
169
+ blue2: '#BAE0FF',
170
+ blue3: '#91CAFF',
171
+ blue4: '#69B1FF',
172
+ blue5: '#4096FF',
173
+ blue6: '#1677FF',
174
+ blue7: '#0958D9',
175
+ blue8: '#003EB3',
176
+ blue9: '#002C8C',
177
+ blue10: '#001D66',
178
+
179
+ // Primary
180
+ mmtPrimary1: '#F5FAFF',
181
+ mmtPrimary2: '#EFF8FF',
182
+ mmtPrimary3: '#D1E9FF',
183
+ mmtPrimary4: '#B2DDFF',
184
+ mmtPrimary5: '#84CAFF',
185
+ mmtPrimary6: '#53B1FD',
186
+ mmtPrimary7: '#2E90FA',
187
+ mmtPrimary8: '#1570EF',
188
+ mmtPrimary9: '#175CD3',
189
+ mmtPrimary10: '#1849A9',
190
+
191
+ // Purple
192
+ purple1: '#F9F0FF',
193
+ purple2: '#EFDBFF',
194
+ purple3: '#D3ADF7',
195
+ purple4: '#B37FEB',
196
+ purple5: '#9254DE',
197
+ purple6: '#722ED1',
198
+ purple7: '#531DAB',
199
+ purple8: '#391085',
200
+ purple9: '#22075E',
201
+ purple10: '#120338',
202
+
203
+ // Magenta
204
+ magenta1: '#FFF0F6',
205
+ magenta2: '#FFD6E7',
206
+ magenta3: '#FFADD2',
207
+ magenta4: '#FF85C0',
208
+ magenta5: '#F759AB',
209
+ magenta6: '#EB2F96',
210
+ magenta7: '#C41D7F',
211
+ magenta8: '#9E1068',
212
+ magenta9: '#780650',
213
+ magenta10: '#520339',
214
+
215
+ // Sizes
216
+ sizeUnit: 4,
217
+ size: 16,
218
+ sizeXXS: 4,
219
+ sizeXS: 8,
220
+ sizeSM: 12,
221
+ sizeMD: 20,
222
+ sizeLG: 24,
223
+ sizeXL: 40,
224
+ sizeXXL: 30,
225
+
226
+ // Padding
227
+ padding: 16,
228
+ paddingXXS: 4,
229
+ paddingXS: 8,
230
+ paddingSM: 12,
231
+ paddingMD: 20,
232
+ paddingLG: 24,
233
+ paddingXL: 32,
234
+ paddingXXL: 48,
235
+
236
+ // Margin
237
+ margin: 16,
238
+ marginXXS: 4,
239
+ marginXS: 8,
240
+ marginSM: 12,
241
+ marginMD: 16,
242
+ marginLG: 24,
243
+ marginXL: 48,
244
+
245
+ // Height
246
+ controlHeight: 32,
247
+ controlHeightXS: 16,
248
+ controlHeightSM: 24,
249
+ controlHeightLG: 40,
250
+
251
+ // Border Radius
252
+ borderRadius: 6,
253
+ borderRadiusXS: 2,
254
+ borderRadiusSM: 4,
255
+ borderRadiusLG: 8,
256
+
257
+ // Font Size
258
+ fontSize: 14,
259
+ fontSizeSM: 12,
260
+ fontSizeLG: 16,
261
+ fontSizeXL: 20,
262
+
263
+ fontSizeHeading1: 38,
264
+ fontSizeHeading2: 30,
265
+ fontSizeHeading3: 24,
266
+ fontSizeHeading4: 20,
267
+ fontSizeHeading5: 16,
268
+
269
+ // Secondary
270
+ colorSecondary3: '#683DE5',
271
+ colorSecondary: '#683DE5',
272
+ };
273
+
274
+ /**
275
+ * Creates a custom theme by merging base theme with overrides
276
+ * @param {Object} overrides - Object with theme properties to override
277
+ * @returns {Object} - Merged theme object
278
+ *
279
+ * @example
280
+ * // Create a custom theme with different primary color
281
+ * const myTheme = createTheme({ colorPrimary: '#FF0000' });
282
+ *
283
+ * @example
284
+ * // Create a custom theme with multiple overrides
285
+ * const customTheme = createTheme({
286
+ * colorPrimary: '#1E90FF',
287
+ * fontSize: 16,
288
+ * borderRadius: 8
289
+ * });
290
+ */
291
+ export const createTheme = (overrides = {}) => {
292
+ return {
293
+ ...baseTheme,
294
+ ...overrides,
295
+ };
296
+ };
297
+
298
+ export const createAdminTheme = ({appTheme = {}, overrides = {}}) => {
299
+ return {
300
+ ...baseTheme,
301
+ ...appTheme,
302
+ ...overrides,
303
+ };
304
+ }
@@ -144,3 +144,7 @@ export const userHasInterface = (user, app, intf) => {
144
144
  const currentApp = apps.find(a => a.app === app);
145
145
  return currentApp && intf.includes(currentApp.interface) ? true : false;
146
146
  };
147
+
148
+ export const userIsAdmin = (user) => {
149
+ return user?.role?.id === 'APP_ADMIN';
150
+ }
package/src/layouts.js ADDED
@@ -0,0 +1 @@
1
+ export { default as AppLayout } from './@daf/layouts/AppLayout/index.jsx';
package/src/utils.js CHANGED
@@ -21,7 +21,7 @@ export { getOptionConfig, getOptionLabel } from './@daf/core/components/DynamicV
21
21
 
22
22
  export { defaultMapConfig } from './@daf/hooks/useMapHelper.js';
23
23
 
24
- export { getInterface, modules, isSuperAdmin, isModuleApproved, userHasInterface } from './helpers/user.js'
24
+ export { getInterface, modules, isSuperAdmin, isModuleApproved, userHasInterface, userIsAdmin } from './helpers/user.js'
25
25
 
26
26
  export { default as locales } from './constants/locales/index.js';
27
27
 
@@ -46,4 +46,6 @@ export { StorageManager } from './helpers/StorageManager.js';
46
46
 
47
47
  export { assignParamsToUrl, buildQueryString } from './helpers/urlHelpers.js';
48
48
 
49
- export { createErrorHandler, handleError, handleSuccess, handleWarning, handleInfo } from './helpers/errorHandling.js';
49
+ export { createErrorHandler, handleError, handleSuccess, handleWarning, handleInfo } from './helpers/errorHandling.js';
50
+
51
+ export { createTheme, createAdminTheme } from './helpers/theme.js';