@visns-studio/visns-components 6.17.0 → 6.17.2

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
@@ -95,7 +95,7 @@
95
95
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
96
96
  },
97
97
  "name": "@visns-studio/visns-components",
98
- "version": "6.17.0",
98
+ "version": "6.17.2",
99
99
  "description": "Various packages to assist in the development of our Custom Applications.",
100
100
  "main": "src/index.js",
101
101
  "files": [
@@ -30,7 +30,7 @@ import CustomFetch from './Fetch';
30
30
  import Notification from './Notification';
31
31
  import SwitchAccount from './SwitchAccount';
32
32
  import BusinessCardOcr from './BusinessCardOcr';
33
- import { isNavActive } from './navActive';
33
+ import { isNavActive, bestMatchingUrl, cleanUrl } from './navActive';
34
34
  import styles from './styles/Navigation.module.scss';
35
35
 
36
36
  // Opt-in icons for the sidebar (simple/cms) layouts: a nav entry names one
@@ -598,7 +598,11 @@ function Navigation({
598
598
  <Link
599
599
  to={child.url}
600
600
  className={
601
- isNavActive(child.url, [], currentPage)
601
+ cleanUrl(child.url) ===
602
+ bestMatchingUrl(
603
+ n.children.map((one) => one.url),
604
+ currentPage
605
+ )
602
606
  ? styles.active
603
607
  : ''
604
608
  }
@@ -57,4 +57,29 @@ export function isNavActive(navUrl, childUrls, currentUrl) {
57
57
  return (childUrls || []).some((child) => covers(cleanUrl(child), current));
58
58
  }
59
59
 
60
+
61
+ /**
62
+ * Which ONE of a set of sibling urls is the current page's best match: the
63
+ * longest url that covers it. `/reports` and `/reports/prebuilt` both cover
64
+ * `/reports/prebuilt`; only the second is the page you are on.
65
+ *
66
+ * @param {string[]} urls sibling urls (dropdown children).
67
+ * @param {string} currentUrl the path being viewed.
68
+ * @returns {string|null} the cleaned winning url, or null when none covers it.
69
+ */
70
+ export function bestMatchingUrl(urls, currentUrl) {
71
+ const current = cleanUrl(currentUrl) || '/';
72
+ let best = null;
73
+
74
+ (urls || []).forEach((url) => {
75
+ const base = cleanUrl(url);
76
+
77
+ if (!base || base === '/') return;
78
+ if (!covers(base, current)) return;
79
+ if (best === null || base.length > best.length) best = base;
80
+ });
81
+
82
+ return best;
83
+ }
84
+
60
85
  export default isNavActive;
@@ -247,7 +247,9 @@ input[type]:not([type='search']):not([type='url']):not([type='hidden']):not(
247
247
  .variable-inserter-search-input
248
248
  ):not(.react-datepicker__month-select):not(
249
249
  .react-datepicker__year-select
250
- ):not(.visns-native-date-filter__input) {
250
+ ):not(.visns-native-date-filter__input):not([type='date']):not(
251
+ [type='datetime-local']
252
+ ):not([type='time']) {
251
253
  background: white;
252
254
  border-radius: var(--br);
253
255
  border: 1px solid rgba(var(--paragraph-color-rgb), 0.15);
@@ -266,6 +268,36 @@ input[type]:not([type='search']):not([type='url']):not([type='hidden']):not(
266
268
  }
267
269
  }
268
270
 
271
+ /* Native date / time inputs are excluded from the padded rule above: 1rem of
272
+ padding inside a date control made it ~48px and, in Firefox, sat the value
273
+ low. They get a flat 34px control instead, matching the grid filters. */
274
+ input[type='date'],
275
+ input[type='datetime-local'],
276
+ input[type='time'] {
277
+ box-sizing: border-box;
278
+ height: 34px;
279
+ min-height: 34px;
280
+ padding: 0 10px;
281
+ border: 1px solid rgba(var(--paragraph-color-rgb, 31, 31, 31), 0.15);
282
+ border-radius: var(--br, 4px);
283
+ background: #fff;
284
+ color: var(--paragraph-color, #1f1f1f);
285
+ font-family: inherit;
286
+ font-size: 0.85rem;
287
+ line-height: 32px;
288
+ font-variant-numeric: tabular-nums;
289
+ }
290
+
291
+ @-moz-document url-prefix() {
292
+ input[type='date'],
293
+ input[type='datetime-local'],
294
+ input[type='time'] {
295
+ height: 34px;
296
+ padding: 0 8px;
297
+ line-height: 32px;
298
+ }
299
+ }
300
+
269
301
  .popup-content {
270
302
  border-radius: var(--br);
271
303
  padding: 0 !important;