@visns-studio/visns-components 4.3.12 → 4.4.1

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.
@@ -7,7 +7,7 @@ import {
7
7
  Briefcase,
8
8
  Bug,
9
9
  Calendar,
10
- CHatDots,
10
+ ChatDots,
11
11
  Clipboard,
12
12
  DoubleSword,
13
13
  Draft,
@@ -39,11 +39,11 @@ import {
39
39
  TextAlignLeft,
40
40
  Ticket,
41
41
  Utensils,
42
- ChatDots,
43
42
  } from 'akar-icons';
44
-
45
43
  import CustomFetch from './Fetch';
46
44
  import Notification from './Notification';
45
+ import classNames from 'classnames';
46
+ import styles from './styles/Navigation.module.css';
47
47
 
48
48
  function Navigation({
49
49
  children,
@@ -57,10 +57,13 @@ function Navigation({
57
57
  const location = useLocation();
58
58
  const navigate = useNavigate();
59
59
  const currentPage = location.pathname.substr(1) || 'dashboard';
60
- const [isOpen, setOpen] = useState('false');
60
+ const [isOpen, setOpen] = useState(false);
61
61
  const [isScrolled, setIsScrolled] = useState(false);
62
62
  const [navData, setNavData] = useState(navConfig);
63
- const appNavClasses = `app-nav ${isScrolled ? 'navscrolled' : ''}`;
63
+
64
+ const appNavClasses = classNames(styles['app-nav'], {
65
+ [styles['navscrolled']]: isScrolled,
66
+ });
64
67
 
65
68
  const handleLogout = () => {
66
69
  CustomFetch('/logout', 'GET', {}, () => {
@@ -150,7 +153,7 @@ function Navigation({
150
153
  questionFill: QuestionFill,
151
154
  settingsVertical: SettingsVertical,
152
155
  signOut: SignOut,
153
- shippingboxv1: ShippingBoxV1,
156
+ shippingBoxV1: ShippingBoxV1,
154
157
  statisticUp: StatisticUp,
155
158
  textAlignLeft: TextAlignLeft,
156
159
  ticket: Ticket,
@@ -158,16 +161,19 @@ function Navigation({
158
161
  };
159
162
 
160
163
  const IconComponent = iconComponents[n.icon];
164
+ const navItemClasses = classNames(
165
+ n.class.split(' ').map((cls) => styles[cls])
166
+ );
161
167
 
162
168
  const renderChildren = () => {
163
169
  if (n.children && n.children.length > 0) {
164
170
  return (
165
- <ul>
171
+ <ul className={styles.subnav}>
166
172
  {n.children.map(
167
173
  (child, childKey) =>
168
174
  child.permission === true && (
169
175
  <li
170
- className="sub-nav-item"
176
+ className={styles['sub-nav-item']}
171
177
  key={`nav-child-${childKey}`}
172
178
  >
173
179
  <Link
@@ -186,7 +192,7 @@ function Navigation({
186
192
  };
187
193
 
188
194
  return (
189
- <li className={n.class}>
195
+ <li className={navItemClasses}>
190
196
  {n.url ? (
191
197
  <Link to={n.url}>
192
198
  <IconComponent strokeWidth={2} size={18} />
@@ -231,7 +237,6 @@ function Navigation({
231
237
  const matchingPermission = permissions.includes(
232
238
  nav.permissionKey
233
239
  );
234
-
235
240
  return {
236
241
  ...nav,
237
242
  permission: matchingPermission,
@@ -250,7 +255,6 @@ function Navigation({
250
255
  const matchingPermission = permissions.includes(
251
256
  nav.permissionKey
252
257
  );
253
-
254
258
  return {
255
259
  ...nav,
256
260
  permission: matchingPermission,
@@ -281,14 +285,12 @@ function Navigation({
281
285
  useEffect(() => {
282
286
  setNavData((prevNavData) => {
283
287
  const updateNavItems = (nav) => {
284
- const cleanUrl = (url) => {
285
- return url && url.startsWith('/')
288
+ const cleanUrl = (url) =>
289
+ url && url.startsWith('/')
286
290
  ? url.substr(1).split('/')[0]
287
291
  : url
288
292
  ? url.split('/')[0]
289
293
  : '';
290
- };
291
-
292
294
  const currentUrl = cleanUrl(currentPage);
293
295
  const navUrl = nav.url
294
296
  ? cleanUrl(nav.url)
@@ -325,8 +327,6 @@ function Navigation({
325
327
  return () => {
326
328
  window.removeEventListener('scroll', handleScroll);
327
329
  };
328
-
329
- console.info(layout);
330
330
  }, []);
331
331
 
332
332
  return layout === 'simple' || layout === 'cms' ? (
@@ -338,7 +338,7 @@ function Navigation({
338
338
  >
339
339
  <div className="logo">
340
340
  <Link to="/">
341
- <img src={logo} alt="Visns Studio CRM" />
341
+ <img src={logo} alt="System Logo" />
342
342
  </Link>
343
343
  </div>
344
344
  <div className="awrap">
@@ -364,9 +364,7 @@ function Navigation({
364
364
  className={
365
365
  isOpen ? 'mobmenu' : 'mobmenu mobmenu--open'
366
366
  }
367
- onClick={() => {
368
- setOpen(!isOpen);
369
- }}
367
+ onClick={() => setOpen(!isOpen)}
370
368
  >
371
369
  <span></span>
372
370
  <span></span>
@@ -394,38 +392,35 @@ function Navigation({
394
392
  </main>
395
393
  </div>
396
394
  ) : (
397
- <header className="header">
398
- <div className="hwrap">
399
- <div className="logo">
400
- <Link to="/">
401
- <img src={logo} alt="Visns Studio CRM" />
402
- </Link>
403
- </div>
404
- <div className="navwrap">
405
- <ul className={appNavClasses}>
406
- {navData.navigations.map((nav, navKey) =>
407
- nav.permission === true ||
408
- nav.permissionKey === '' ? (
409
- <React.Fragment key={`nav-item-${navKey}`}>
410
- {renderNav(nav)}
411
- </React.Fragment>
412
- ) : null
413
- )}
414
- </ul>
415
- </div>
416
- <div className="hactions">
417
- <ul>
418
- {navData.settings.map((setting, settingKey) =>
419
- setting.permission === true ? (
420
- <React.Fragment key={`setting-${settingKey}`}>
421
- {renderSetting(setting)}
422
- </React.Fragment>
423
- ) : null
424
- )}
425
- </ul>
426
- </div>
395
+ <div className={styles.hwrap}>
396
+ <div className={styles.logo}>
397
+ <Link to="/">
398
+ <img src={logo} alt="System Logo" />
399
+ </Link>
400
+ </div>
401
+ <div className={styles.navwrap}>
402
+ <ul className={appNavClasses}>
403
+ {navData.navigations.map((nav, navKey) =>
404
+ nav.permission === true || nav.permissionKey === '' ? (
405
+ <React.Fragment key={`nav-item-${navKey}`}>
406
+ {renderNav(nav)}
407
+ </React.Fragment>
408
+ ) : null
409
+ )}
410
+ </ul>
427
411
  </div>
428
- </header>
412
+ <div className={styles.hactions}>
413
+ <ul>
414
+ {navData.settings.map((setting, settingKey) =>
415
+ setting.permission === true ? (
416
+ <React.Fragment key={`setting-${settingKey}`}>
417
+ {renderSetting(setting)}
418
+ </React.Fragment>
419
+ ) : null
420
+ )}
421
+ </ul>
422
+ </div>
423
+ </div>
429
424
  );
430
425
  }
431
426
 
@@ -2,22 +2,15 @@ import React, { useState, useEffect, useRef } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import moment from 'moment';
4
4
  import parse from 'html-react-parser';
5
- import { TooltipWrapper } from 'react-tooltip';
6
5
  import { toast } from 'react-toastify';
7
6
  import { Bell, CircleX } from 'akar-icons';
8
-
9
7
  import CustomFetch from './Fetch';
8
+ import styles from './styles/Notification.module.css';
10
9
 
11
10
  function Notification(props) {
12
11
  let interval;
13
12
  const navigate = useNavigate();
14
13
  const wrapperRef = useRef(null);
15
- const [containerClass] = useState('notibox');
16
- const [divClass] = useState('notibox-item');
17
- const [iconBellBlinkClass] = useState('cis-bell-exclamation noti');
18
- const [iconBellClass] = useState('cis-bell-exclamation');
19
- const [iconXClass] = useState('cis-x-circle noti-read');
20
- const [actionClass] = useState('notibox-actions');
21
14
  const [items, setItems] = useState([]);
22
15
  const [show, setShow] = useState(false);
23
16
  const { setSystemAuth } = props;
@@ -37,7 +30,6 @@ function Notification(props) {
37
30
  if (error === 'Unauthenticated.') {
38
31
  setSystemAuth(false);
39
32
  }
40
-
41
33
  toast.error(String(error));
42
34
  }
43
35
  }
@@ -62,9 +54,7 @@ function Notification(props) {
62
54
  setItems(array);
63
55
  }
64
56
 
65
- let formData = {
66
- id: id,
67
- };
57
+ let formData = { id: id };
68
58
 
69
59
  CustomFetch(
70
60
  '/ajax/user/notification/markasread',
@@ -82,30 +72,22 @@ function Notification(props) {
82
72
  let array = items;
83
73
  setItems([]);
84
74
 
85
- {
86
- array.map((item) => {
87
- let formData = {
88
- id: item.id,
89
- };
90
-
91
- CustomFetch(
92
- '/ajax/user/notification/markasread',
93
- 'POST',
94
- formData,
95
- function () {
96
- fetchNotification();
97
- }
98
- );
99
- });
100
- }
75
+ array.map((item) => {
76
+ let formData = { id: item.id };
77
+
78
+ CustomFetch(
79
+ '/ajax/user/notification/markasread',
80
+ 'POST',
81
+ formData,
82
+ function () {
83
+ fetchNotification();
84
+ }
85
+ );
86
+ });
101
87
  };
102
88
 
103
89
  const toggleNotification = () => {
104
- if (show === false) {
105
- setShow(true);
106
- } else {
107
- setShow(false);
108
- }
90
+ setShow(!show);
109
91
  };
110
92
 
111
93
  const showAllNotifications = () => {
@@ -126,8 +108,7 @@ function Notification(props) {
126
108
 
127
109
  return function cleanup() {
128
110
  clearInterval(interval);
129
-
130
- document.addEventListener('mousedown', handleClick, false);
111
+ document.removeEventListener('mousedown', handleClick, false);
131
112
  };
132
113
  }, []);
133
114
 
@@ -143,22 +124,29 @@ function Notification(props) {
143
124
  size={19}
144
125
  strokeWidth={2}
145
126
  className={
146
- items.length > 0 ? iconBellBlinkClass : iconBellClass
127
+ items.length > 0
128
+ ? styles.noti
129
+ : styles['cis-bell-exclamation']
147
130
  }
148
131
  />
149
132
  </a>
150
133
 
151
- {show === true ? (
134
+ {show && (
152
135
  <div ref={wrapperRef}>
153
136
  {items.length > 0 ? (
154
- <div className={containerClass}>
155
- <div className="notiscrollwrap">
137
+ <div className={styles.notibox}>
138
+ <div className={styles.notiscrollwrap}>
156
139
  {items.map((item, index) => (
157
- <div className={divClass} key={item.id}>
140
+ <div
141
+ className={styles['notibox-item']}
142
+ key={item.id}
143
+ >
158
144
  <Bell
159
145
  size={19}
160
146
  strokeWidth={2}
161
- className={iconBellClass}
147
+ className={
148
+ styles.cisBellExclamation
149
+ }
162
150
  />{' '}
163
151
  {parse(item.data.label)}{' '}
164
152
  <span>
@@ -173,13 +161,13 @@ function Notification(props) {
173
161
  size={24}
174
162
  data-id={item.id}
175
163
  data-index={index}
176
- className={iconXClass}
164
+ className={styles.notiRead}
177
165
  />
178
166
  </button>
179
167
  </div>
180
168
  ))}
181
169
  </div>
182
- <div className={actionClass}>
170
+ <div className={styles['notibox-actions']}>
183
171
  <button onClick={showAllNotifications}>
184
172
  View All
185
173
  </button>
@@ -189,11 +177,11 @@ function Notification(props) {
189
177
  </div>
190
178
  </div>
191
179
  ) : (
192
- <div className={containerClass}>
193
- <div className={divClass}>
180
+ <div className={styles.notibox}>
181
+ <div className={styles['notibox-item']}>
194
182
  No new notifications available.
195
183
  </div>
196
- <div className={actionClass}>
184
+ <div className={styles['notibox-actions']}>
197
185
  <button onClick={showAllNotifications}>
198
186
  View All
199
187
  </button>
@@ -201,8 +189,6 @@ function Notification(props) {
201
189
  </div>
202
190
  )}
203
191
  </div>
204
- ) : (
205
- <div></div>
206
192
  )}
207
193
  </>
208
194
  );
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react';
2
2
  import ReactToPrint from 'react-to-print';
3
3
 
4
4
  import CustomFetch from './Fetch';
5
+ import styles from './styles/QrCode.module.css';
5
6
 
6
7
  const QrCode = ({ config, dataId }) => {
7
8
  const printComponentRef = useRef();
@@ -27,11 +28,11 @@ const QrCode = ({ config, dataId }) => {
27
28
 
28
29
  return (
29
30
  <>
30
- <div className="gridtxt" ref={printComponentRef}>
31
+ <div className={styles.gridtxt} ref={printComponentRef}>
31
32
  {qrCodeData.logo && qrCodeData.logo !== '' && (
32
- <ul className="customer__overview">
33
+ <ul className={styles.customer__overview}>
33
34
  <li
34
- className="fw-grid-item"
35
+ className={styles['fw-grid-item']}
35
36
  style={{
36
37
  textAlign: 'center',
37
38
  }}
@@ -44,9 +45,9 @@ const QrCode = ({ config, dataId }) => {
44
45
  </li>
45
46
  </ul>
46
47
  )}
47
- <ul className="customer__overview">
48
+ <ul className={styles.customer__overview}>
48
49
  <li
49
- className="fw-grid-item"
50
+ className={styles['fw-grid-item']}
50
51
  style={{
51
52
  textAlign: 'center',
52
53
  }}
@@ -54,9 +55,9 @@ const QrCode = ({ config, dataId }) => {
54
55
  {qrCodeData.title}
55
56
  </li>
56
57
  </ul>
57
- <ul className="customer__overview">
58
+ <ul className={styles.customer__overview}>
58
59
  <li
59
- className="fw-grid-item"
60
+ className={styles['fw-grid-item']}
60
61
  style={{ textAlign: 'center' }}
61
62
  >
62
63
  {qrCodeData.qrCode && qrCodeData.qrCode !== '' && (
@@ -69,7 +70,7 @@ const QrCode = ({ config, dataId }) => {
69
70
  </li>
70
71
  </ul>
71
72
  </div>
72
- <div className="polActions">
73
+ <div className={styles.polActions}>
73
74
  <ReactToPrint
74
75
  trigger={() => <button className="btn">Print</button>}
75
76
  content={() => printComponentRef.current}
@@ -1,4 +1,5 @@
1
1
  // src/components/Profile.jsx
2
+ import '../../styles/global.css';
2
3
 
3
4
  import React, { useState, useEffect, useRef } from 'react';
4
5
  import PasswordStrengthBar from 'react-password-strength-bar';
@@ -129,7 +130,7 @@ const Profile = ({ userProfile, setUserProfile }) => {
129
130
  type="text"
130
131
  name="name"
131
132
  onChange={handleChangeProfile}
132
- className={inputClasses.name}
133
+ className={`${styles.input} ${inputClasses.name}`}
133
134
  value={profile.name}
134
135
  />
135
136
  <span className={styles.fi__span}>
@@ -143,7 +144,7 @@ const Profile = ({ userProfile, setUserProfile }) => {
143
144
  type="text"
144
145
  name="email"
145
146
  readOnly
146
- className={inputClasses.email}
147
+ className={`${styles.input} ${inputClasses.email}`}
147
148
  value={profile.email}
148
149
  />
149
150
  <span className={styles.fi__span}>
@@ -163,7 +164,7 @@ const Profile = ({ userProfile, setUserProfile }) => {
163
164
  name="password"
164
165
  onChange={handleChangeProfile}
165
166
  value={profile.password}
166
- className={inputClasses.password}
167
+ className={`${styles.input} ${inputClasses.password}`}
167
168
  />
168
169
  <PasswordStrengthBar
169
170
  password={profile.password}
@@ -182,9 +183,7 @@ const Profile = ({ userProfile, setUserProfile }) => {
182
183
  name="password_confirmation"
183
184
  onChange={handleChangeProfile}
184
185
  value={profile.password_confirmation}
185
- className={
186
- inputClasses.password_confirmation
187
- }
186
+ className={`${styles.input} ${inputClasses.password_confirmation}`}
188
187
  />
189
188
  </label>
190
189
  </div>
@@ -1,5 +1,16 @@
1
1
  /* Profile.module.css */
2
2
 
3
+ input:not(:placeholder-shown) + .fi__span,
4
+ textarea:not(:placeholder-shown) + .fi__span,
5
+ select:not(:placeholder-shown) + .fi__span {
6
+ transform: translateY(-40%) translateX(10px) scale(0.75);
7
+ opacity: 1;
8
+ padding: 0 4px;
9
+ background: var(--tertiary-color);
10
+ font-weight: 300;
11
+ border-radius: var(--br);
12
+ }
13
+
3
14
  .grid {
4
15
  width: 100%;
5
16
  display: flex;
@@ -136,8 +147,9 @@
136
147
  z-index: 500;
137
148
  }
138
149
 
139
- input[type='text'],
140
- input[type='password'] {
150
+ .input,
151
+ .textarea,
152
+ .select {
141
153
  background: var(--item-color);
142
154
  border-radius: var(--br);
143
155
  border: 1px solid transparent;
@@ -149,28 +161,19 @@ input[type='password'] {
149
161
  transition: box-shadow 0.15s linear;
150
162
  }
151
163
 
152
- input[type='text']:hover,
153
- input[type='password']:hover {
164
+ .input:hover,
165
+ .textarea:hover,
166
+ .select:hover {
154
167
  border: 1px solid rgba(var(--highlight-color-rgb), 0.85);
155
168
  transition: border 0.15s linear;
156
169
  }
157
170
 
158
- input[type='text']:focus,
159
- input[type='password']:focus {
171
+ .input:focus,
172
+ .textarea:focus,
173
+ .select:focus {
160
174
  border: 1px solid rgba(var(--highlight-color-rgb), 0.85);
161
175
  }
162
176
 
163
- input:not(:placeholder-shown) + .fi__span,
164
- textarea:not(:placeholder-shown) + .fi__span,
165
- select:not(:placeholder-shown) + .fi__span {
166
- transform: translateY(-40%) translateX(10px) scale(0.75);
167
- opacity: 1;
168
- padding: 0 4px;
169
- background: var(--tertiary-color);
170
- font-weight: 300;
171
- border-radius: var(--br);
172
- }
173
-
174
177
  .sigcanvas {
175
178
  border: 2px solid #ccc;
176
179
  border-radius: 10px;
@@ -0,0 +1,12 @@
1
+ .visns__ms {
2
+ input {
3
+ &:hover {
4
+ box-shadow: none !important;
5
+ transition: box-shadow 0.15s linear !important;
6
+ }
7
+
8
+ &:focus {
9
+ box-shadow: none !important;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,44 @@
1
+ .AutocompletePlace-results {
2
+ z-index: 999;
3
+ }
4
+
5
+ .AutocompletePlace {
6
+ position: relative;
7
+
8
+ > svg {
9
+ position: absolute;
10
+ right: 0.5em;
11
+ top: 0.5em;
12
+ color: var(--primary-color);
13
+ cursor: pointer;
14
+ }
15
+ }
16
+
17
+ .AutocompletePlace.toggleActive {
18
+ color: var(--highlight-color);
19
+ }
20
+
21
+ .AutocompletePlace-input {
22
+ padding: 0.65rem 3rem 0.65rem 0.95rem !important;
23
+ }
24
+
25
+ .AutocompletePlace-results {
26
+ position: absolute;
27
+ background-color: white;
28
+ padding: 0;
29
+ margin: 0;
30
+ border: 1px solid rgba(var(--primary-color-rgb), 0.25);
31
+ border-radius: var(--br);
32
+ overflow: hidden;
33
+ }
34
+
35
+ .AutocompletePlace-items {
36
+ list-style: none;
37
+ border-bottom: 1px solid rgba(var(--primary-color-rgb), 0.1);
38
+ cursor: pointer;
39
+ padding: 10px 10px;
40
+
41
+ &:hover {
42
+ background-color: rgba(var(--primary-color-rgb), 0.065);
43
+ }
44
+ }