vanilla-framework 3.7.1 → 3.8.0

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
@@ -47,7 +47,7 @@
47
47
  "percy": "percy exec -- node snapshots.js",
48
48
  "icon-svgs-to-mixins": "node scripts/convert-svgs-to-icon-mixins.js icons"
49
49
  },
50
- "version": "3.7.1",
50
+ "version": "3.8.0",
51
51
  "files": [
52
52
  "_index.scss",
53
53
  "/scss",
@@ -8,6 +8,8 @@
8
8
  Side navigation in default variant.
9
9
  .p-side-navigation--icons:
10
10
  Side navigation with item icons.
11
+ .p-side-navigation--accordion:
12
+ Side navigation with expanding accordion items.
11
13
  .p-side-navigation--raw-html:
12
14
  Raw HTML version of side navigation (used with links generated by an external service).
13
15
  "&.is-drawer-expanded":
@@ -67,6 +69,10 @@
67
69
  .p-side-navigation__text:
68
70
  Single text item in side navigation (for items that are not linked).
69
71
 
72
+ Item accordion button:
73
+ .p-side-navigation__accordion-button:
74
+ Single accordion button item in side navigation with `.p-side-navigation--accordion` variant.
75
+
70
76
  Item icon:
71
77
  .p-side-navigation__icon:
72
78
  An icon in side navigation item (used with `.p-side-navigation--icons` variant).
@@ -264,6 +270,10 @@
264
270
  @include vf-side-navigation-spacing-left($prop: left, $multiplier: 2, $offset: $sp-sidenav--icon-width);
265
271
  }
266
272
 
273
+ .p-side-navigation--accordion &::after {
274
+ @include vf-side-navigation-spacing-left($prop: left, $multiplier: 2);
275
+ }
276
+
267
277
  &:last-of-type::after {
268
278
  content: none;
269
279
  }
@@ -271,6 +281,26 @@
271
281
 
272
282
  .p-side-navigation__list {
273
283
  @extend %side-navigation__list;
284
+
285
+ // accordion styles
286
+ &[aria-expanded] {
287
+ @include vf-transition(#{transform, opacity}, fast);
288
+ &.has-tick-elements {
289
+ padding-left: 1em;
290
+ }
291
+ }
292
+ &[aria-expanded='false'] {
293
+ height: 0;
294
+ opacity: 0;
295
+ transform: translate3d(0, -0.5rem, 0);
296
+ visibility: hidden;
297
+ }
298
+ &[aria-expanded='true'] {
299
+ height: auto;
300
+ opacity: 1;
301
+ transform: translate3d(0, 0, 0);
302
+ visibility: visible;
303
+ }
274
304
  }
275
305
 
276
306
  %side-navigation__text {
@@ -322,17 +352,66 @@
322
352
  @extend %side-navigation__link;
323
353
  }
324
354
 
355
+ .p-side-navigation__accordion-button {
356
+ // reset default button styles
357
+ border: 0;
358
+ border-radius: 0;
359
+ font-size: inherit;
360
+ justify-content: flex-start;
361
+ margin-bottom: 0;
362
+ text-align: left;
363
+ width: 100%;
364
+
365
+ &::before {
366
+ @extend %icon;
367
+ @include vf-transition($property: transform, $duration: fast);
368
+
369
+ align-self: center;
370
+ content: '';
371
+ flex-shrink: 0;
372
+ margin-left: calc(-1 * ($sph--large + $sp-sidenav--icon-width));
373
+ margin-right: $sph--large;
374
+ }
375
+
376
+ // aria-selected controls the open and closed state for the accordion tab
377
+ &[aria-expanded='true'] {
378
+ // override base expanded button styles
379
+ background-color: inherit;
380
+
381
+ &:hover {
382
+ background-color: $colors--light-theme--background-hover;
383
+ }
384
+ @include vf-transition(#{background-color, border-color});
385
+ }
386
+
387
+ &[aria-expanded='false'] {
388
+ &::before {
389
+ transform: rotate(-90deg);
390
+ }
391
+
392
+ @include vf-transition(#{background-color, border-color});
393
+ }
394
+ }
395
+
325
396
  .p-side-navigation__heading,
326
397
  .p-side-navigation__text,
327
- .p-side-navigation__link {
398
+ .p-side-navigation__link,
399
+ .p-side-navigation__accordion-button {
328
400
  @extend %side-navigation__text;
329
401
 
402
+ // offset for accordion chevrons is icon size + twice spacing around it
403
+ // we don't use grid width spacing for accordion (as we do in icon version)
404
+ $sp-sidenav--accordion-offset: $sp-sidenav--icon-width + 2 * $sph--large;
405
+
330
406
  .p-side-navigation--icons & {
331
407
  @include vf-side-navigation-spacing-left($multiplier: 2, $offset: $sp-sidenav--icon-width);
332
-
333
408
  position: relative;
334
409
  }
335
410
 
411
+ .p-side-navigation--accordion & {
412
+ @include vf-side-navigation-spacing-left($multiplier: 0, $offset: $sp-sidenav--accordion-offset);
413
+ }
414
+
336
415
  // nested 2nd level of navigation
337
416
  .p-side-navigation__item--title .p-side-navigation__item &,
338
417
  .p-side-navigation__item .p-side-navigation__item & {
@@ -342,6 +421,11 @@
342
421
  .p-side-navigation--icons & {
343
422
  @include vf-side-navigation-spacing-left($multiplier: 3, $offset: $sp-sidenav--icon-width);
344
423
  }
424
+
425
+ // add spacing for variant with accordions
426
+ .p-side-navigation--accordion & {
427
+ @include vf-side-navigation-spacing-left($multiplier: 1, $offset: $sp-sidenav--accordion-offset);
428
+ }
345
429
  }
346
430
 
347
431
  // nested 3rd level of navigation
@@ -353,6 +437,11 @@
353
437
  .p-side-navigation--icons & {
354
438
  @include vf-side-navigation-spacing-left($multiplier: 4, $offset: $sp-sidenav--icon-width);
355
439
  }
440
+
441
+ // add spacing for variant with accordions
442
+ .p-side-navigation--accordion & {
443
+ @include vf-side-navigation-spacing-left($multiplier: 2, $offset: $sp-sidenav--accordion-offset);
444
+ }
356
445
  }
357
446
  }
358
447
 
@@ -475,10 +564,6 @@
475
564
  @media (min-width: $threshold-4-6-col) {
476
565
  #{$prop}: $multiplier * map-get($grid-margin-widths, default) + $offset;
477
566
  }
478
-
479
- @media (min-width: $threshold-6-12-col) {
480
- #{$prop}: $multiplier * map-get($grid-margin-widths, default) + $offset;
481
- }
482
567
  }
483
568
 
484
569
  // theme
@@ -592,6 +677,19 @@
592
677
  color: $color-sidenav-text-active;
593
678
  }
594
679
 
680
+ .p-side-navigation__accordion-button {
681
+ background-color: inherit;
682
+ color: inherit;
683
+ &::before {
684
+ @include vf-icon-chevron($color-sidenav-toggle-icon);
685
+ }
686
+
687
+ &:hover {
688
+ background: $color-sidenav-item-background-hover;
689
+ color: $color-sidenav-text-active;
690
+ }
691
+ }
692
+
595
693
  // styles applied when side nav is used in application layout
596
694
  @if mixin-exists(vf-application-layout--when-collapsed) {
597
695
  .p-side-navigation__item.has-active-child {
@@ -2,6 +2,6 @@
2
2
  $breakpoint-x-small: 460px !default;
3
3
  $breakpoint-small: 620px !default;
4
4
  $breakpoint-large: 1036px !default;
5
- $breakpoint-navigation-threshold: $breakpoint-small !default;
5
+ $breakpoint-navigation-threshold: $breakpoint-large !default;
6
6
  $breakpoint-heading-threshold: $breakpoint-large !default;
7
7
  $breakpoint-x-large: 1681px !default; // exclude most laptops