ui-soxo-bootstrap-core 2.6.1-dev.20 → 2.6.1-dev.21

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.
@@ -1,92 +1,18 @@
1
1
  export const boxVariants = {
2
- entering: { x: -24, opacity: 0, scale: 0.985 },
2
+ entering: { x: -50, opacity: 0},
3
3
  entered: {
4
4
  x: 0,
5
5
  opacity: 1,
6
- scale: 1,
7
6
  transition: {
8
7
  x: {
9
- duration: 0.45,
8
+ duration: 0.5,
10
9
  ease: [.62,.28,.23,.99]
11
10
  },
12
11
  opacity: {
13
- duration: 0.35,
12
+ duration: 0.5,
14
13
  ease: [.62,.28,.23,.99]
15
- },
16
- scale: {
17
- duration: 0.45,
18
- ease: [.22,1,.36,1]
19
14
  }
20
15
  },
21
16
 
22
17
  }
23
- };
24
-
25
- export const headerShellVariants = {
26
- hidden: {
27
- y: -14,
28
- opacity: 0,
29
- scale: 0.995,
30
- filter: 'blur(6px)',
31
- },
32
- visible: {
33
- y: 0,
34
- opacity: 1,
35
- scale: 1,
36
- filter: 'blur(0px)',
37
- transition: {
38
- duration: 0.45,
39
- ease: [.22,1,.36,1],
40
- when: 'beforeChildren',
41
- staggerChildren: 0.045,
42
- },
43
- },
44
- };
45
-
46
- export const headerClusterVariants = {
47
- hidden: { opacity: 0, x: -12 },
48
- visible: {
49
- opacity: 1,
50
- x: 0,
51
- transition: {
52
- duration: 0.32,
53
- ease: [.22,1,.36,1],
54
- },
55
- },
56
- };
57
-
58
- export const headerActionsVariants = {
59
- hidden: {},
60
- visible: {
61
- transition: {
62
- staggerChildren: 0.05,
63
- delayChildren: 0.08,
64
- },
65
- },
66
- };
67
-
68
- export const headerActionItemVariants = {
69
- hidden: { opacity: 0, y: -8, scale: 0.98 },
70
- visible: {
71
- opacity: 1,
72
- y: 0,
73
- scale: 1,
74
- transition: {
75
- duration: 0.28,
76
- ease: [.22,1,.36,1],
77
- },
78
- },
79
- };
80
-
81
- export const contentRevealVariants = {
82
- hidden: { opacity: 0, y: 10 },
83
- visible: {
84
- opacity: 1,
85
- y: 0,
86
- transition: {
87
- duration: 0.35,
88
- ease: [.22,1,.36,1],
89
- delay: 0.08,
90
- },
91
- },
92
- };
18
+ }
@@ -3,54 +3,61 @@
3
3
  * Global header component
4
4
  */
5
5
 
6
- import React, { useState, useEffect, useContext, useRef } from 'react';
6
+ import React, { useState, useEffect, useContext,useRef } from "react";
7
7
 
8
- import { motion, useAnimation, useReducedMotion } from 'framer-motion';
8
+ import { animationControls, motion, useAnimation } from "framer-motion";
9
9
 
10
10
  import {
11
11
  boxVariants,
12
- contentRevealVariants,
13
- headerActionItemVariants,
14
- headerActionsVariants,
15
- headerClusterVariants,
16
- headerShellVariants,
17
- } from './animations';
12
+ } from "./animations"
18
13
 
19
- import { GlobalContext } from './../../Store';
14
+ import { GlobalContext } from "./../../Store";
20
15
 
21
- import { Link, useLocation } from 'react-router-dom';
16
+ import { Link, useLocation } from "react-router-dom";
22
17
 
23
- import { Typography, Avatar, Input } from 'antd';
18
+ import { Typography, Avatar ,Input} from "antd";
24
19
 
25
- import ProgressBar from '../progress-bar/progress-bar'; // Adjust the path as needed
26
20
 
27
- import { Button } from '../../elements';
28
21
 
29
- import GenericHeader from '../header/generic-header';
22
+ import ProgressBar from "../progress-bar/progress-bar"; // Adjust the path as needed
30
23
 
31
- import { MenuOutlined, UserOutlined, SettingOutlined } from '@ant-design/icons';
24
+ import { Button } from "../../elements";
32
25
 
33
- import { Drawer } from 'antd';
34
26
 
35
- import { ReloadOutlined, SearchOutlined } from '@ant-design/icons';
36
27
 
37
- import SideMenu from './../sidemenu/sidemenu';
28
+ import GenericHeader from "../header/generic-header";
38
29
 
39
- import './global-header.scss';
30
+ import {
31
+ MenuOutlined,
32
+ UserOutlined,
33
+ SettingOutlined,
34
+ } from "@ant-design/icons";
35
+
36
+ import { Drawer } from "antd";
37
+
38
+ import { ReloadOutlined, SearchOutlined } from "@ant-design/icons";
39
+
40
+ import SideMenu from "./../sidemenu/sidemenu";
41
+
42
+ import "./global-header.scss";
40
43
 
41
- import LanguageSwitcher from '../language-switcher/language-switcher';
44
+ import LanguageSwitcher from "../language-switcher/language-switcher";
42
45
 
43
- import { useTranslation } from 'react-i18next';
46
+ import { useTranslation } from "react-i18next";
47
+
48
+
49
+ import BorderStyle from "pdf-lib/cjs/core/annotation/BorderStyle";
50
+
51
+ import SettingsUtil from "../../../utils/settings.utils";
52
+ import SpotlightSearch from "../spotlight-search/spotlight-search.component";
44
53
 
45
- import BorderStyle from 'pdf-lib/cjs/core/annotation/BorderStyle';
46
54
 
47
- import SettingsUtil from '../../../utils/settings.utils';
48
- import SpotlightSearch from '../spotlight-search/spotlight-search.component';
49
- import { LicenseAlert } from '../../../components';
50
- // import { MenusAPI } from '../../../models';
51
55
 
52
56
  const { Title } = Typography;
53
57
 
58
+
59
+
60
+
54
61
  export default function GlobalHeader({
55
62
  loading,
56
63
  appSettings,
@@ -61,37 +68,48 @@ export default function GlobalHeader({
61
68
  sidemenu = [],
62
69
  reload,
63
70
  meta = {},
64
- licenseData,
65
- licAlert,
66
71
  ...props
67
72
  }) {
73
+
68
74
  let location = useLocation();
69
75
  // let location = {};
70
76
 
77
+
78
+
71
79
  const { isMobile, user = { locations: [] }, kiosk, state } = useContext(GlobalContext);
72
80
 
81
+
82
+
73
83
  const [visible, setVisible] = useState(false);
74
84
 
75
85
  // Variable to handle toggling of menu
76
86
  const [collapsed, setCollapsed] = useState(false);
77
87
  // varibale handle branch switcher
78
88
 
89
+
90
+
79
91
  // const [searchModalVisible, setSearchModalVisible] = useState(false);
80
92
 
81
- const { globalCustomerHeader = () => {} } = appSettings;
93
+
94
+ const { globalCustomerHeader = () => { } } = appSettings;
82
95
 
83
96
  const { t, i18n } = useTranslation();
84
- const reduceMotion = useReducedMotion();
85
- const shouldAnimate = !reduceMotion;
86
97
 
87
98
  const spotlightRef = useRef();
88
99
 
89
100
  useEffect(() => {
101
+
90
102
  setTimeout(() => {
103
+
91
104
  i18n.changeLanguage(localStorage.selectedLanguage);
92
- }, 0);
93
- // fetchSummary();
105
+
106
+ }, 0)
107
+
108
+
94
109
  }, []);
110
+
111
+
112
+
95
113
 
96
114
  /**
97
115
  * Function to handle toggling of menu
@@ -107,6 +125,9 @@ export default function GlobalHeader({
107
125
  // input to avoid typing
108
126
  SettingsUtil.openSpotlightModal();
109
127
  };
128
+
129
+
130
+
110
131
 
111
132
  /**
112
133
  * Function to remove toggling on mobile view
@@ -135,49 +156,79 @@ export default function GlobalHeader({
135
156
  const boxControls = useAnimation();
136
157
 
137
158
  async function animate() {
138
- if (!shouldAnimate) {
139
- boxControls.set('entered');
140
- return;
141
- }
142
-
143
- await boxControls.start('entered');
159
+ await boxControls.start("entered");
144
160
 
145
161
  //await boxControls.start("show");
146
162
  }
147
163
 
148
164
  useEffect(() => {
165
+
149
166
  animate();
150
- }, [shouldAnimate]);
167
+ }, [])
168
+
169
+ useEffect(() => {
151
170
 
152
- useEffect(() => {}, [state.theme]);
171
+ }, [state.theme]);
172
+
173
+
174
+
175
+
176
+
153
177
 
154
- const motionProps = shouldAnimate ? { initial: 'hidden', animate: 'visible' } : { initial: false, animate: false };
155
178
 
156
179
  return (
157
- <>
158
- <div
159
- className={`global-header ${process.env.REACT_APP_THEME} ${isConnected && !kiosk ? 'connected' : ''}`}
160
- style={{
161
- // background: state.theme.colors.bodyBackground,
162
-
163
- height: 10,
164
- }}
165
- >
166
- {/* <MenuOutlined style={{left:'1%',top:'1%', fontSize:18, position:'absolute', zIndex:999}} onClick={showSidebar}/> */}
167
-
168
- <div className="layout-content">
169
- <div
170
- //whileHover="hover"
171
- //whileTap="tap"
172
- className={`left-bar ${!isConnected && !isMobile ? '' : 'hide'}${!collapsed ? 'open' : 'close'}${kiosk && !isConnected ? 'kioskon' : ''}`}
173
- // style={{ background: state.theme.colors.leftSectionBackground }}
174
- >
175
- {!isMobile && !isConnected ? (
176
- <motion.div
177
- variants={boxVariants}
178
- initial={['entering']}
179
- animate={boxControls}
180
- className={`sidebar-container ${!collapsed ? 'open' : 'close'}${kiosk ? '' : 'kioskon'}`}
180
+ <div
181
+ className={`global-header ${process.env.REACT_APP_THEME} ${isConnected && !kiosk ? "connected" : ""
182
+ }`}
183
+ style={{
184
+
185
+ // background: state.theme.colors.bodyBackground,
186
+
187
+ height: 10,
188
+
189
+ }}
190
+ >
191
+ {/* <MenuOutlined style={{left:'1%',top:'1%', fontSize:18, position:'absolute', zIndex:999}} onClick={showSidebar}/> */}
192
+
193
+ <div className="layout-content">
194
+ <div
195
+
196
+ //whileHover="hover"
197
+ //whileTap="tap"
198
+ className={`left-bar ${!isConnected && !isMobile ? "" : "hide"}${!collapsed ? "open" : "close"}${kiosk && !isConnected ? "kioskon" : ""}`}
199
+ // style={{ background: state.theme.colors.leftSectionBackground }}
200
+ >
201
+
202
+ {!isMobile && !isConnected ? (
203
+ <motion.div
204
+ variants={boxVariants}
205
+ initial={["entering"]}
206
+ animate={boxControls}
207
+ className={`sidebar-container ${!collapsed ? "open" : "close"}${kiosk ? "" : "kioskon"}`}
208
+
209
+ >
210
+
211
+ <SideMenu
212
+ // isOpen={isOpen}
213
+ collapsed={collapsed}
214
+ setCollapsed={setCollapsed}
215
+ loading={loading}
216
+ appSettings={appSettings}
217
+ callback={onClose}
218
+ modules={modules}
219
+ history={history}
220
+ />
221
+
222
+ </motion.div>
223
+ ) : (
224
+ <Drawer
225
+ placement="left"
226
+ onClose={onClose}
227
+ visible={visible}
228
+ className="side-drawer-content"
229
+ >
230
+ <div
231
+ className={`sidebar-container ${!collapsed ? "open" : "close"}`}
181
232
  >
182
233
  <SideMenu
183
234
  // isOpen={isOpen}
@@ -189,188 +240,168 @@ export default function GlobalHeader({
189
240
  modules={modules}
190
241
  history={history}
191
242
  />
192
- </motion.div>
193
- ) : (
194
- <Drawer placement="left" onClose={onClose} visible={visible} className="side-drawer-content">
195
- <div className={`sidebar-container ${!collapsed ? 'open' : 'close'}`}>
196
- <SideMenu
197
- // isOpen={isOpen}
198
- collapsed={collapsed}
199
- setCollapsed={setCollapsed}
200
- loading={loading}
201
- appSettings={appSettings}
202
- callback={onClose}
203
- modules={modules}
204
- history={history}
205
- />
206
- </div>
207
- </Drawer>
208
- )}
209
- </div>
210
-
211
- {/* Right Section of the Component Loader */}
212
- <div
213
- className={`right-section ${!collapsed ? 'open' : 'close'} ${kiosk ? 'kioskon' : ''}`}
214
- style={{ background: state.theme.colors.bodyBackground }}
215
- >
216
- {/* For not connected section */}
217
- {!isConnected && !kiosk ? (
218
- <motion.div
219
- variants={headerShellVariants}
220
- {...motionProps}
221
- className={`page-wrapper ${!collapsed ? 'open' : 'close'}`}
222
- // style={{ background: state.theme.colors.headerBg }}
223
- >
224
- {/* */}
225
- <motion.div className="page-header-name" variants={headerClusterVariants}>
226
- <ProgressBar isLoading={loading} />
243
+ </div>
244
+ </Drawer>
245
+ )}
246
+ </div>
227
247
 
228
- <span type onClick={!isMobile ? toggleCollapsed : hideToggle} className="toggle-box toggle-menu">
229
- <MenuOutlined />
248
+ {/* Right Section of the Component Loader */}
249
+ <div className={`right-section ${!collapsed ? "open" : "close"} ${kiosk ? "kioskon" : ""}`} style={{ background: state.theme.colors.bodyBackground }}>
250
+ {/* For not connected section */}
251
+ {!isConnected && !kiosk ? (
252
+
253
+ <div className={`page-wrapper ${!collapsed ? "open" : "close"}`}
254
+ // style={{ background: state.theme.colors.headerBg }}
255
+ >
256
+ {/* */}
257
+ <div className="page-header-name">
258
+
259
+ <ProgressBar isLoading={loading} />
260
+
261
+ <span type
262
+ onClick={!isMobile ? toggleCollapsed : hideToggle}
263
+ className="toggle-box toggle-menu"
264
+ >
265
+ <MenuOutlined />
266
+
267
+ </span>
268
+
269
+ {/* Back Button */}
270
+ {location.pathname !== "/" ? (
271
+ <span
272
+ className="toggle-box"
273
+ onClick={() => {
274
+ history && history.goBack();
275
+ }}
276
+ >
277
+ <GenericHeader />
230
278
  </span>
279
+ ) : null}
280
+ {/* Back Button Ends */}
231
281
 
232
- {/* Back Button */}
233
- {location.pathname !== '/' ? (
234
- <span
235
- className="toggle-box"
236
- onClick={() => {
237
- history && history.goBack();
238
- }}
239
- >
240
- <GenericHeader />
241
- </span>
242
- ) : null}
243
- {/* Back Button Ends */}
244
282
 
245
- {location.pathname !== '/' ? (
246
- <h4 className="menu-caption header-caption" style={{ color: state.theme.colors.headerColor }}>
247
- {menu.caption}
248
- </h4>
283
+ {location.pathname !== "/" ? (
284
+ <h4 className="menu-caption header-caption" style={{ color: state.theme.colors.headerColor }}>
285
+ {menu.caption}
286
+ </h4>
287
+ ) : null}
288
+ </div>
289
+
290
+ {/* Page Menu Actions */}
291
+
292
+ {user.role || user.id ? (
293
+ <div className="page-menu">
294
+ {/* Search Input in header start */}
295
+ { !isMobile && (
296
+
297
+ <div>
298
+ <Input
299
+ placeholder="Search (Shift + F)"
300
+ prefix={<SearchOutlined />}
301
+ onClick={openSearchModal}
302
+
303
+ readOnly
304
+ style={{ width: 250 }}
305
+ />
306
+
307
+
308
+ <SpotlightSearch ref={(elem) => SettingsUtil.registerModal(elem)} props={props}/>
309
+
310
+ </div>
311
+ )}
312
+ {/* Search Input in header start */}
313
+
314
+ {/** branchswitcher Option */}
315
+ {/* branch switcher controlled with env for matria and nura */}
316
+ {!process.env.REACT_APP_SHOW_BRANCH_SWITCHER ? (
317
+ <div className="branch-switcher">{globalCustomerHeader()}</div>
318
+ ):null}
319
+ {/* <div className="branch-switcher">{globalCustomerHeader()}</div> */}
320
+
321
+
322
+ {/* Search Option */}
323
+
324
+ {/* <ModalSearch /> */}
325
+
326
+ {/* Search Option Ends */}
327
+
328
+ {/* Configurator Actions */}
329
+ {user.isAdmin ? (
330
+ <>
331
+ {/* Models */}
332
+ {menu && menu.id ? (
333
+ <Link to={`/menus/${menu.id}`}>
334
+
335
+ <Button type="default" size={"small"} icon={<SettingOutlined />}>
336
+
337
+ </Button>
338
+ </Link>
339
+ ) : null}
340
+ {/* Models Ends */}
341
+ </>
249
342
  ) : null}
250
- </motion.div>
343
+ {/* Configurator Actions Ends */}
251
344
 
252
- {/* Page Menu Actions */}
345
+
253
346
 
254
- {user.role || user.id ? (
255
- <motion.div className="page-menu" variants={headerActionsVariants}>
256
- {/* Search Input in header start */}
257
- {!isMobile && (
258
- <motion.div className="header-action header-action-search" variants={headerActionItemVariants}>
259
- <Input
260
- placeholder="Search (Shift + F)"
261
- prefix={<SearchOutlined />}
262
- onClick={openSearchModal}
263
- readOnly
264
- style={{ width: 250 }}
265
- />
266
-
267
- <SpotlightSearch ref={(elem) => SettingsUtil.registerModal(elem)} props={props} />
268
- </motion.div>
269
- )}
270
- {/* Search Input in header start */}
271
347
 
272
- {/** branchswitcher Option */}
273
- {/* branch switcher controlled with env for matria and nura */}
274
- {!process.env.REACT_APP_SHOW_BRANCH_SWITCHER ? (
275
- <motion.div className="branch-switcher header-action" variants={headerActionItemVariants}>
276
- {globalCustomerHeader()}
277
- </motion.div>
278
- ) : null}
279
- {/* <div className="branch-switcher">{globalCustomerHeader()}</div> */}
280
-
281
- {/* Search Option */}
282
-
283
- {/* <ModalSearch /> */}
284
-
285
- {/* Search Option Ends */}
286
-
287
- {/* Configurator Actions */}
288
- {user.isAdmin ? (
289
- <>
290
- {/* Models */}
291
- {menu && menu.id ? (
292
- <motion.div className="header-action" variants={headerActionItemVariants}>
293
- <Link to={`/menus/${menu.id}`}>
294
- <Button type="default" size={'small'} icon={<SettingOutlined />}></Button>
295
- </Link>
296
- </motion.div>
297
- ) : null}
298
- {/* Models Ends */}
299
- </>
300
- ) : null}
301
- {/* Configurator Actions Ends */}
302
-
303
- {/* Reload Button */}
304
-
305
- <motion.div className="header-action" variants={headerActionItemVariants}>
306
- <Button onClick={reload} icon={<ReloadOutlined />} type="default" size={'small'}></Button>
307
- </motion.div>
308
-
309
- {/* Reload Button Ends */}
310
-
311
- {/** Switch Languages starts */}
312
- {process.env.REACT_APP_ENABLE_LANGUAGE_SWITCHER ? (
313
- <motion.div className="header-action" variants={headerActionItemVariants}>
314
- <LanguageSwitcher />
315
- </motion.div>
316
- ) : null}
317
- {/** Switch Languages ends */}
318
-
319
- {/* User Profile */}
320
- <motion.div className="header-profile-wrap header-action" variants={headerActionItemVariants}>
321
- <ProfileAvatar />
322
- <span className="header-profile-name" style={{ color: state.theme.colors.colorText }}>
323
- {' '}
324
- {user.name}{' '}
325
- </span>
326
- </motion.div>
327
- {/* User Profile Ends */}
328
- </motion.div>
329
- ) : null}
330
348
 
331
- {/* Page Menu Actions Ends */}
332
- </motion.div>
333
- ) : null}
334
349
 
335
- {/* The children is rendered */}
336
- <motion.div className="page-content-stage" variants={contentRevealVariants} {...motionProps}>
337
- {children}
338
- </motion.div>
339
- {/* The children is rendered */}
340
- </div>
341
- {/* Right Section of the Component Loader Ends */}
350
+ {/* Reload Button */}
351
+
352
+ <Button onClick={reload} icon={<ReloadOutlined />} type="default" size={"small"} >
353
+
354
+ </Button>
355
+
356
+ {/* Reload Button Ends */}
357
+
358
+ {/** Switch Languages starts */}
359
+ {process.env.REACT_APP_ENABLE_LANGUAGE_SWITCHER ? <LanguageSwitcher /> : null}
360
+ {/** Switch Languages ends */}
361
+
362
+ {/* User Profile */}
363
+ <div style={{ padding: "10px" }}>
364
+ <ProfileAvatar />
365
+ <span style={{ color: state.theme.colors.colorText }}> {user.name} </span>
366
+ </div>
367
+ {/* User Profile Ends */}
368
+ </div>
369
+ ) : null}
370
+
371
+ {/* Page Menu Actions Ends */}
372
+ </div>
373
+ ) : null}
374
+
375
+ {/* The children is rendered */}
376
+ {children}
377
+ {/* The children is rendered */}
342
378
  </div>
379
+ {/* Right Section of the Component Loader Ends */}
343
380
  </div>
344
- {licAlert && licenseData && (
345
- <div
346
- style={{
347
- marginTop: '3rem',
348
- right: '2%',
349
- position: 'absolute',
350
- zIndex: 999,
351
- }}
352
- >
353
- <LicenseAlert data={licenseData} />
354
- </div>
355
- )}
356
- </>
381
+ </div>
357
382
  );
358
383
  }
359
384
 
385
+
360
386
  /**
361
- *
362
- * @returns
387
+ *
388
+ * @returns
363
389
  */
364
390
  function ProfileAvatar() {
391
+
365
392
  const { user = { locations: [] } } = useContext(GlobalContext);
366
393
 
367
- useEffect(() => {}, []);
394
+ useEffect(() => { }, []);
368
395
 
369
396
  return (
370
397
  <Link className="profile-avatar" to="/profile">
371
398
  {user.photograph ? (
372
399
  <>
373
- <img className="profile-picture" src={user.photograph} alt={'user photograph'} />
400
+ <img
401
+ className="profile-picture"
402
+ src={user.photograph}
403
+ alt={"user photograph"}
404
+ />
374
405
  </>
375
406
  ) : (
376
407
  <Avatar shape="square" size="small" icon={<UserOutlined />} />