| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
$pf-v6-c-divider--breakpoint-map: build-breakpoint-map("sm", "md", "lg", "xl", "2xl"); |
| 4 |
$pf-v6-c-divider--spacer-map: build-spacer-map("none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"); |
| 5 |
|
| 6 |
// * Divider horizontal |
| 7 |
@mixin pf-v6-c-divider--m-horizontal { |
| 8 |
flex-direction: row; |
| 9 |
width: 100%; |
| 10 |
height: var(--#{$divider}--Size); // apply size to height in horizontal orientation |
| 11 |
} |
| 12 |
|
| 13 |
// * Divider vertical |
| 14 |
@mixin pf-v6-c-divider--m-vertical { |
| 15 |
flex-direction: column; |
| 16 |
width: var(--#{$divider}--Size); // apply size to width in vertical orientation |
| 17 |
height: inherit; |
| 18 |
} |
| 19 |
|
| 20 |
@include pf-root($divider) { |
| 21 |
// * Divider |
| 22 |
--#{$divider}--Display: flex; |
| 23 |
--#{$divider}--Color: var(--pf-t--global--border--color--default); |
| 24 |
--#{$divider}--Size: var(--pf-t--global--border--width--divider--default); |
| 25 |
|
| 26 |
// * Divider before |
| 27 |
--#{$divider}--before--FlexBasis: 100%; |
| 28 |
} |
| 29 |
|
| 30 |
// - Divider |
| 31 |
.#{$divider} { |
| 32 |
@include pf-v6-c-divider--m-horizontal; // default, set to orientation to horizontal |
| 33 |
@include pf-v6-hidden-visible(var(--#{$divider}--Display)); |
| 34 |
|
| 35 |
flex-shrink: 0; |
| 36 |
align-items: stretch; |
| 37 |
align-self: stretch; |
| 38 |
justify-content: center; |
| 39 |
border: 0; // removes the default border styling on an hr |
| 40 |
|
| 41 |
// - Divider before |
| 42 |
&::before { |
| 43 |
flex-basis: var(--#{$divider}--before--FlexBasis); |
| 44 |
content: ""; |
| 45 |
background-color: var(--#{$divider}--Color); |
| 46 |
border-block-start: var(--#{$divider}--Size) solid transparent; |
| 47 |
border-inline-start: var(--#{$divider}--Size) solid transparent; |
| 48 |
} |
| 49 |
|
| 50 |
// - Divider horizontal |
| 51 |
&.pf-m-horizontal { |
| 52 |
@include pf-v6-c-divider--m-horizontal; |
| 53 |
} |
| 54 |
|
| 55 |
// - Divider vertical |
| 56 |
&.pf-m-vertical { |
| 57 |
@include pf-v6-c-divider--m-vertical; |
| 58 |
} |
| 59 |
|
| 60 |
// - Divider spacer insets |
| 61 |
@each $spacer, $spacer-value in $pf-v6-c-divider--spacer-map { |
| 62 |
@if $spacer == none { |
| 63 |
$spacer-value: 0%; |
| 64 |
} |
| 65 |
|
| 66 |
&.pf-m-inset-#{$spacer} { |
| 67 |
--#{$divider}--before--FlexBasis: calc(100% - #{$spacer-value} * 2); |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
// TODO: move this loop to separate file for resize observer implementation |
| 73 |
// TODO: make responsive values opt in/out |
| 74 |
// stylelint-disable |
| 75 |
.#{$divider} { |
| 76 |
@each $breakpoint, $breakpoint-value in $pf-v6-c-divider--breakpoint-map { |
| 77 |
$breakpoint-name: '-on-' + #{$breakpoint}; |
| 78 |
|
| 79 |
@include pf-v6-apply-breakpoint($breakpoint) { |
| 80 |
&.pf-m-horizontal#{$breakpoint-name} { |
| 81 |
@include pf-v6-c-divider--m-horizontal; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
@include pf-v6-apply-breakpoint($breakpoint) { |
| 86 |
&.pf-m-vertical#{$breakpoint-name} { |
| 87 |
@include pf-v6-c-divider--m-vertical; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
@include pf-v6-apply-breakpoint($breakpoint) { |
| 92 |
@each $spacer, $spacer-value in $pf-v6-c-divider--spacer-map { |
| 93 |
&.pf-m-inset-#{$spacer}#{$breakpoint-name} { |
| 94 |
@if $spacer == none { |
| 95 |
--#{$divider}--before--FlexBasis: 100%; |
| 96 |
} @else { |
| 97 |
--#{$divider}--before--FlexBasis: calc(100% - #{$spacer-value} * 2); |
| 98 |
} |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
// stylelint-enable |