@visns-studio/visns-components 5.7.4 → 5.7.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 CHANGED
@@ -20,12 +20,12 @@
20
20
  "dayjs": "^1.11.13",
21
21
  "fabric": "^6.6.4",
22
22
  "file-saver": "^2.0.5",
23
- "framer-motion": "^12.9.2",
23
+ "framer-motion": "^12.9.4",
24
24
  "html-react-parser": "^5.2.3",
25
25
  "lodash": "^4.17.21",
26
26
  "lodash.debounce": "^4.0.8",
27
27
  "moment": "^2.30.1",
28
- "motion": "^12.9.2",
28
+ "motion": "^12.9.4",
29
29
  "numeral": "^2.0.6",
30
30
  "pluralize": "^8.0.0",
31
31
  "qrcode.react": "^4.2.0",
@@ -63,10 +63,10 @@
63
63
  "yet-another-react-lightbox": "^3.23.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@babel/core": "^7.26.10",
67
- "@babel/plugin-transform-runtime": "^7.26.10",
68
- "@babel/preset-env": "^7.26.9",
69
- "@babel/preset-react": "^7.26.3",
66
+ "@babel/core": "^7.27.1",
67
+ "@babel/plugin-transform-runtime": "^7.27.1",
68
+ "@babel/preset-env": "^7.27.1",
69
+ "@babel/preset-react": "^7.27.1",
70
70
  "babel-loader": "^10.0.0",
71
71
  "copy-webpack-plugin": "^13.0.0",
72
72
  "css-loader": "^7.1.2",
@@ -82,7 +82,7 @@
82
82
  "react-dom": "^17.0.0 || ^18.0.0"
83
83
  },
84
84
  "name": "@visns-studio/visns-components",
85
- "version": "5.7.4",
85
+ "version": "5.7.6",
86
86
  "description": "Various packages to assist in the development of our Custom Applications.",
87
87
  "main": "src/index.js",
88
88
  "files": [
@@ -103,5 +103,5 @@
103
103
  "url": "https://github.com/visnsstudio/visns-components/issues"
104
104
  },
105
105
  "homepage": "https://github.com/visnsstudio/visns-components#readme",
106
- "packageManager": "yarn@4.8.1"
106
+ "packageManager": "yarn@4.9.1"
107
107
  }
@@ -287,6 +287,9 @@ function Navigation({
287
287
  }
288
288
  };
289
289
 
290
+ const [, setActiveDropdown] = useState(null); // We only need the setter
291
+ const navWrapRef = useRef(null);
292
+
290
293
  const renderNav = (n) => {
291
294
  let navItemClasses;
292
295
 
@@ -302,8 +305,30 @@ function Navigation({
302
305
  : styles['nav-item'];
303
306
  }
304
307
 
308
+ const hasChildren = n.children && n.children.length > 0;
309
+
310
+ const handleMouseEnter = () => {
311
+ if (hasChildren) {
312
+ setActiveDropdown(n.id);
313
+ // Temporarily disable overflow on the navwrap when dropdown is active
314
+ if (navWrapRef.current) {
315
+ navWrapRef.current.style.overflowX = 'visible';
316
+ }
317
+ }
318
+ };
319
+
320
+ const handleMouseLeave = () => {
321
+ if (hasChildren) {
322
+ setActiveDropdown(null);
323
+ // Restore overflow when dropdown is no longer active
324
+ if (navWrapRef.current) {
325
+ navWrapRef.current.style.overflowX = 'auto';
326
+ }
327
+ }
328
+ };
329
+
305
330
  const renderChildren = () => {
306
- if (n.children && n.children.length > 0) {
331
+ if (hasChildren) {
307
332
  return (
308
333
  <ul className={styles.navDropdown}>
309
334
  {n.children.map(
@@ -331,7 +356,11 @@ function Navigation({
331
356
  };
332
357
 
333
358
  return (
334
- <li className={navItemClasses}>
359
+ <li
360
+ className={navItemClasses}
361
+ onMouseEnter={handleMouseEnter}
362
+ onMouseLeave={handleMouseLeave}
363
+ >
335
364
  {n.url ? (
336
365
  <Link to={n.url}>{n.label}</Link>
337
366
  ) : (
@@ -508,7 +537,7 @@ function Navigation({
508
537
  </Link>
509
538
  </div>
510
539
  <div className={styles.awrap}>
511
- <nav className={styles.navwrap}>
540
+ <nav className={styles.navwrap} ref={navWrapRef}>
512
541
  <ul className={appNavClasses}>
513
542
  {navData.navigations.map((nav, navKey) =>
514
543
  nav.permission === true ||
@@ -578,7 +607,7 @@ function Navigation({
578
607
  <img src={logo} alt="System Logo" />
579
608
  </Link>
580
609
  </div>
581
- <div className={styles.navwrap}>
610
+ <div className={styles.navwrap} ref={navWrapRef}>
582
611
  <ul className={appNavClasses}>
583
612
  {navData.navigations.map((nav, navKey) =>
584
613
  nav.permission === true || nav.permissionKey === '' ? (
@@ -7,6 +7,46 @@ import { Bell, CircleX, Check } from 'akar-icons';
7
7
  import CustomFetch from './Fetch';
8
8
  import styles from './styles/Notification.module.scss';
9
9
 
10
+ // Helper function to sanitize HTML content and remove unwanted styling from anchor tags
11
+ const sanitizeHtml = (html) => {
12
+ if (!html) return '';
13
+
14
+ // Create a temporary div to parse the HTML
15
+ const tempDiv = document.createElement('div');
16
+ tempDiv.innerHTML = html;
17
+
18
+ // Find all anchor tags and remove any styling attributes
19
+ const anchors = tempDiv.querySelectorAll('a');
20
+ anchors.forEach((anchor) => {
21
+ // Preserve href and target attributes, remove all others
22
+ const href = anchor.getAttribute('href');
23
+ const target = anchor.getAttribute('target');
24
+
25
+ // Clone the text content
26
+ const textContent = anchor.textContent;
27
+
28
+ // Create a clean anchor with only necessary attributes
29
+ const cleanAnchor = document.createElement('a');
30
+ cleanAnchor.textContent = textContent;
31
+
32
+ if (href) cleanAnchor.setAttribute('href', href);
33
+ if (target) cleanAnchor.setAttribute('target', target);
34
+
35
+ // Add a small icon after the link text to indicate it's a link
36
+ // We'll use CSS to style this instead of adding an actual icon
37
+ cleanAnchor.setAttribute('data-is-link', 'true');
38
+
39
+ // Set inline styles to ensure visibility against white background
40
+ cleanAnchor.style.color = '#0056b3';
41
+ cleanAnchor.style.fontWeight = '600';
42
+
43
+ // Replace the original anchor with the clean one
44
+ anchor.parentNode.replaceChild(cleanAnchor, anchor);
45
+ });
46
+
47
+ return tempDiv.innerHTML;
48
+ };
49
+
10
50
  function Notification(props) {
11
51
  const navigate = useNavigate();
12
52
  const wrapperRef = useRef(null);
@@ -290,7 +330,11 @@ function Notification(props) {
290
330
  <div
291
331
  className={styles.notiText}
292
332
  >
293
- {parse(item.data.label)}
333
+ {parse(
334
+ sanitizeHtml(
335
+ item.data.label
336
+ )
337
+ )}
294
338
  </div>
295
339
  <div
296
340
  className={styles.notiTime}
@@ -4,6 +4,7 @@
4
4
  align-items: center;
5
5
  gap: var(--padding);
6
6
  width: 100%;
7
+ position: relative; /* Establish a positioning context */
7
8
 
8
9
  .logo {
9
10
  width: var(--logo-width);
@@ -42,6 +43,7 @@
42
43
  flex: 1;
43
44
  overflow-x: auto;
44
45
  -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
46
+ position: relative; /* Ensure proper stacking context */
45
47
 
46
48
  /* Hide scrollbar for most browsers but keep functionality */
47
49
  scrollbar-width: none; /* Firefox */
@@ -67,8 +69,10 @@
67
69
 
68
70
  .navDropdown {
69
71
  border-radius: var(--br);
70
- overflow: hidden;
71
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
72
+ overflow: visible;
73
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
74
+ z-index: 1000; /* Ensure dropdown appears above other elements */
75
+ position: absolute; /* Ensure it's positioned absolutely */
72
76
  }
73
77
 
74
78
  .nav-item,
@@ -78,6 +82,11 @@
78
82
  box-sizing: border-box;
79
83
  position: relative;
80
84
  flex-shrink: 0; /* Prevent items from shrinking too much */
85
+ z-index: 10; /* Base z-index for nav items */
86
+
87
+ &:hover {
88
+ z-index: 100; /* Higher z-index when hovered to ensure dropdown visibility */
89
+ }
81
90
 
82
91
  a,
83
92
  span {
@@ -132,9 +141,11 @@
132
141
  opacity: 0;
133
142
  background: rgba(var(--primary-rgb), 0.75);
134
143
  border-radius: var(--br);
135
- overflow: hidden;
144
+ overflow: visible;
136
145
  margin-top: 1px;
137
146
  clip-path: inset(0 0 0 0 round var(--br));
147
+ z-index: 1000; /* Ensure dropdown appears above other elements */
148
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); /* Add shadow for better visibility */
138
149
 
139
150
  li {
140
151
  display: block;
@@ -230,9 +241,11 @@
230
241
  opacity: 0;
231
242
  background: rgba(var(--primary-rgb), 0.9);
232
243
  border-radius: var(--br);
233
- overflow: hidden;
244
+ overflow: visible;
234
245
  margin-top: 1px;
235
246
  clip-path: inset(0 0 0 0 round var(--br));
247
+ z-index: 1000; /* Ensure dropdown appears above other elements */
248
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); /* Add shadow for better visibility */
236
249
 
237
250
  li {
238
251
  display: block;
@@ -544,7 +557,9 @@
544
557
  background: var(--primary-color);
545
558
  border-radius: 5px;
546
559
  clip-path: inset(0 0 0 0 round 5px);
547
- overflow: hidden;
560
+ overflow: visible;
561
+ z-index: 1000; /* Ensure dropdown appears above other elements */
562
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); /* Add shadow for better visibility */
548
563
 
549
564
  li {
550
565
  display: block;
@@ -158,18 +158,62 @@
158
158
  line-height: 1.4;
159
159
  margin-bottom: 4px;
160
160
  word-break: break-word;
161
+
162
+ /* Target all elements inside notiText to ensure proper styling */
163
+ * {
164
+ background: inherit;
165
+ border: none;
166
+ border-radius: 0;
167
+ padding: 0;
168
+ margin: 0;
169
+ display: inline;
170
+ box-shadow: none;
171
+ text-shadow: none;
172
+ white-space: normal;
173
+ }
161
174
  }
162
175
 
163
176
  .notiText a {
164
- color: var(--primary-color);
165
- font-weight: 500;
177
+ /* Use a darker color that will be visible against white background */
178
+ color: #0056b3 !important; /* Fallback if var(--primary-color) is too light */
179
+ font-weight: 600 !important; /* Make it slightly bolder */
166
180
  text-decoration: none;
167
- transition: color 0.2s;
181
+ transition: all 0.2s;
182
+ /* Reset any potential styling that could cause elliptical borders and white text */
183
+ background: transparent !important;
184
+ border: none !important;
185
+ border-radius: 0 !important;
186
+ padding: 0 !important;
187
+ margin: 0 !important;
188
+ display: inline !important;
189
+ box-shadow: none !important;
190
+ text-shadow: none !important;
191
+ white-space: normal !important;
192
+ /* Add subtle bottom border to indicate it's a link */
193
+ border-bottom: 1px dotted #0056b3 !important;
194
+ position: relative !important;
195
+ }
196
+
197
+ /* Add a small external link icon after links with data-is-link attribute */
198
+ .notiText a[data-is-link='true']::after {
199
+ content: '↗';
200
+ font-size: 10px;
201
+ position: relative;
202
+ top: -5px;
203
+ margin-left: 2px;
204
+ opacity: 0.9;
205
+ color: #0056b3 !important; /* Match the link color */
168
206
  }
169
207
 
170
208
  .notiText a:hover {
171
- color: var(--secondary-color);
172
- text-decoration: underline;
209
+ color: #003d80 !important; /* Darker shade for hover state */
210
+ text-decoration: none;
211
+ background: transparent !important;
212
+ border-bottom: 1px solid #003d80 !important;
213
+ }
214
+
215
+ .notiText a:hover[data-is-link='true']::after {
216
+ opacity: 1;
173
217
  }
174
218
 
175
219
  .notiTime {