-
Notifications
You must be signed in to change notification settings - Fork 106
fix(RTL): refactor mixins, add slider rtl styles #5867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7081127
7b27e13
3f94125
493f33b
0df2f7f
e46a23a
7a1711a
1685b5b
2f2147b
8cf4382
59614ee
0d68bae
367d7c2
4cc800a
475db54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -310,27 +310,62 @@ | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Applies custom styles to support RTL | ||||||
| @mixin pf-v5-rtl($transform: null) { | ||||||
| // resets property used to inverse transform values calc()s in RTL | ||||||
| @if $transform == "transform-flip-revert" { | ||||||
| --#{$pf-global}--rtl--transform--flip: 1; | ||||||
| } @else { | ||||||
| // establishes the selectors used to target RTL | ||||||
| // remove .ws-dir-rtl before releasing RTL | ||||||
| @at-root :where(.ws-dir-rtl, .#{$pf-prefix}m-dir-rtl, [dir="rtl"]) #{&} { | ||||||
| // sets property used in calcs to inverse transform values | ||||||
| @if $transform == "transform-flip" { | ||||||
| --#{$pf-global}--rtl--transform--flip: -1; | ||||||
| } | ||||||
| // RTL helpers | ||||||
|
|
||||||
| // flips something horizontally/inline. relies upon scale/scale() not already being used for the element | ||||||
| @if $transform == 'flip-inline' { | ||||||
| scale: -1 1; | ||||||
| } | ||||||
| // Used to create the RTL selector for RTL specific styles | ||||||
|
|
||||||
| // any custom CSS to apply within the selectors that target RTL | ||||||
| @content | ||||||
| } | ||||||
| // @include pf-v5-rtl { | ||||||
| // background: red; | ||||||
| // } | ||||||
|
|
||||||
| // renders as | ||||||
|
|
||||||
| // [dir="rtl"] { | ||||||
| // background: red; | ||||||
| // } | ||||||
| @mixin pf-v5-rtl { | ||||||
| @at-root :where(.ws-dir-rtl, .#{$pf-prefix}m-dir-rtl, [dir="rtl"]) #{&} { | ||||||
| @content; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Used to create the LTR selector for LTR specific styles | ||||||
| @mixin pf-v5-ltr { | ||||||
| @at-root :where(.ws-dir-ltr, .#{$pf-prefix}m-dir-ltr, [dir="ltr"]) #{&} { | ||||||
| @content; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Creates a default/LTR declaration, and an RTL declaration. | ||||||
|
|
||||||
| // @include pf-v5-bidirectional-style(background, blue, red) | ||||||
|
|
||||||
| // renders as | ||||||
|
|
||||||
| // background: blue; | ||||||
| // [dir="rtl"] { | ||||||
| // background: red; | ||||||
| // } | ||||||
| @mixin pf-v5-bidirectional-style($prop, $ltr-val, $rtl-val) { | ||||||
| #{$prop}: #{$ltr-val}; | ||||||
|
|
||||||
| @include pf-v5-rtl { | ||||||
| #{$prop}: #{$rtl-val}; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Mirrors/flips something horizontally/inline. Relies upon scale/scale() not already being used for the element. Can be extended to take arguments to use different methods other than scale(). | ||||||
| @mixin pf-v5-mirror-inline { | ||||||
| scale: -1 1; | ||||||
| } | ||||||
|
|
||||||
| @mixin pf-v5-mirror-inline-on-rtl { | ||||||
| @include pf-v5-rtl { | ||||||
| @include pf-v5-mirror-inline; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Declares a global inverse multiplier var used for returning the inverse of a number. Defined within blocks that reference the global var in calc() functions to conditionally return the default or inverse value of a number. | ||||||
| @mixin pf-v5-set-inverse($val: true) { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There may be other things we want to put in here that get set when you establish a block where things will inverse. I'd leave |
||||||
| --#{$pf-global}--inverse--multiplier: #{if($val, -1, 1)}; | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.