From: Jeremy Thomas Date: Sun, 19 Sep 2021 17:08:24 +0000 (+0100) Subject: Finish direction mixins X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89c5ed1a39ab4602f8ae937cc8f152baee3445d8;p=thirdparty%2Fbulma.git Finish direction mixins --- diff --git a/docs/_includes/elements/anchor-bis.html b/docs/_includes/elements/anchor-bis.html new file mode 100644 index 000000000..c22e69091 --- /dev/null +++ b/docs/_includes/elements/anchor-bis.html @@ -0,0 +1,8 @@ +

+ + {{ include.name }} + + + # + +

diff --git a/docs/_includes/index/beautified.html b/docs/_includes/index/beautified.html index a835ffdf1..91e86dab3 100644 --- a/docs/_includes/index/beautified.html +++ b/docs/_includes/index/beautified.html @@ -9,7 +9,7 @@
- See what Bulma developers are bulding + See what Bulma developers are building
diff --git a/docs/_sass/components/content.scss b/docs/_sass/components/content.scss index 7d46166a1..4d953c507 100644 --- a/docs/_sass/components/content.scss +++ b/docs/_sass/components/content.scss @@ -32,6 +32,11 @@ &.title { font-size: 1.5em; + + &.is-5 { + font-size: 1.25em; + margin-top: 0 !important; + } } @include until($widescreen) { diff --git a/docs/_sass/examples/mixins.scss b/docs/_sass/examples/mixins.scss index a328582e1..073286037 100644 --- a/docs/_sass/examples/mixins.scss +++ b/docs/_sass/examples/mixins.scss @@ -22,3 +22,141 @@ @include fa(1rem, 2rem); background-color: lavender; } + +.bulma-overlay-mixin-parent { + background-image: url(https://source.unsplash.com/La2kOu2dmH4/640x320); + background-size: cover; + border-radius: 0.5em; + position: relative; + height: 11.25rem; + width: 20rem; +} + +.bulma-overlay-mixin { + @include overlay(1.5rem); + background-color: darkorange; + border-radius: 0.25em; + color: white; + opacity: 0.9; + padding: 1em; +} + +.bulma-placeholder-mixin { + @include placeholder { + color: lightblue; + } + + border-color: hsl(195deg, 53%, 79%); + + &:hover { + border-color: hsl(195deg, 83%, 66%); + } + + &:focus, + &:active { + border-color: hsl(195deg, 100%, 56%) !important; + box-shadow: 0 0 0 0.125em hsla(195deg, 100%, 56%, 0.25) !important; + } +} + +.bulma-clearfix-mixin { + @include clearfix; + + img { + border-radius: 0.25em; + margin-right: 0.5em; + } +} + +.bulma-center-mixin-parent { + background-image: url(https://source.unsplash.com/xo3Bd2tYeqg/640x320); + background-size: cover; + border-radius: 0.5em; + position: relative; + height: 11.25rem; + width: 20rem; +} + +.bulma-center-mixin { + @include center(96px); + border-radius: 8px; + height: 96px; + width: 96px; +} + +.bulma-reset-mixin { + @include reset; +} + +.bulma-unselectable-mixin { + @include unselectable; +} + +.bulma-ltr-rtl-mixin { + background-color: lightgreen; + padding: 0.5em 1em; + border: 1px solid seagreen; + margin-right: -1px; + + &:first-child { + @include ltr { + border-bottom-left-radius: 0.5em; + border-top-left-radius: 0.5em; + } + + @include rtl { + border-bottom-right-radius: 0.5em; + border-top-right-radius: 0.5em; + } + } + + &:last-child { + @include ltr { + border-bottom-right-radius: 0.5em; + border-top-right-radius: 0.5em; + } + + @include rtl { + border-bottom-left-radius: 0.5em; + border-top-left-radius: 0.5em; + } + } +} + +.bulma-ltr-position-mixin-parent { + background-color: beige; + border-radius: 0.5em; + padding: 1rem; + padding-left: 5rem; + position: relative; + + p { + margin-top: -0.25rem; + } +} + +.bulma-ltr-position-mixin { + @include ltr-position(1rem, false); + border-radius: 0.25em; + position: absolute; + top: 1rem; +} + +.bulma-ltr-property-mixin-parent { + align-items: flex-start; + background-color: midnightblue; + border-radius: 0.5em; + color: lightskyblue; + display: flex; + padding: 1.5rem; + position: relative; + + p { + margin-top: -0.25rem; + } +} + +.bulma-ltr-property-mixin { + @include ltr-property("margin", 1rem, false); + border-radius: 0.25em; +} diff --git a/docs/css/bulma-docs.css b/docs/css/bulma-docs.css index 240a83909..ae72e638f 100644 --- a/docs/css/bulma-docs.css +++ b/docs/css/bulma-docs.css @@ -17887,6 +17887,11 @@ a.has-text-bootstrap-dark:hover, a.has-text-bootstrap-dark:focus { font-size: 1.5em; } +.bd-anchor-title.title.is-5 { + font-size: 1.25em; + margin-top: 0 !important; +} + @media screen and (max-width: 1215px) { .bd-anchor-title { padding-left: 1em; @@ -22390,3 +22395,159 @@ a.has-text-bootstrap-dark:hover, a.has-text-bootstrap-dark:focus { width: 2rem; background-color: lavender; } + +.bulma-overlay-mixin-parent { + background-image: url(https://source.unsplash.com/La2kOu2dmH4/640x320); + background-size: cover; + border-radius: 0.5em; + position: relative; + height: 11.25rem; + width: 20rem; +} + +.bulma-overlay-mixin { + bottom: 1.5rem; + left: 1.5rem; + position: absolute; + right: 1.5rem; + top: 1.5rem; + background-color: darkorange; + border-radius: 0.25em; + color: white; + opacity: 0.9; + padding: 1em; +} + +.bulma-placeholder-mixin { + border-color: lightblue; +} + +.bulma-placeholder-mixin::-moz-placeholder { + color: lightblue; +} + +.bulma-placeholder-mixin::-webkit-input-placeholder { + color: lightblue; +} + +.bulma-placeholder-mixin:-moz-placeholder { + color: lightblue; +} + +.bulma-placeholder-mixin:-ms-input-placeholder { + color: lightblue; +} + +.bulma-placeholder-mixin:hover { + border-color: #60ccf0; +} + +.bulma-placeholder-mixin:focus, .bulma-placeholder-mixin:active { + border-color: #1fc7ff !important; + box-shadow: 0 0 0 0.125em rgba(31, 199, 255, 0.25) !important; +} + +.bulma-clearfix-mixin::after { + clear: both; + content: " "; + display: table; +} + +.bulma-clearfix-mixin img { + border-radius: 0.25em; + margin-right: 0.5em; +} + +.bulma-center-mixin-parent { + background-image: url(https://source.unsplash.com/xo3Bd2tYeqg/640x320); + background-size: cover; + border-radius: 0.5em; + position: relative; + height: 11.25rem; + width: 20rem; +} + +.bulma-center-mixin { + position: absolute; + left: calc(50% - (96px * 0.5)); + top: calc(50% - (96px * 0.5)); + border-radius: 8px; + height: 96px; + width: 96px; +} + +.bulma-reset-mixin { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background: none; + border: none; + color: currentColor; + font-family: inherit; + font-size: 1em; + margin: 0; + padding: 0; +} + +.bulma-unselectable-mixin { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.bulma-ltr-rtl-mixin { + background-color: lightgreen; + padding: 0.5em 1em; + border: 1px solid seagreen; + margin-right: -1px; +} + +.bulma-ltr-rtl-mixin:first-child { + border-bottom-left-radius: 0.5em; + border-top-left-radius: 0.5em; +} + +.bulma-ltr-rtl-mixin:last-child { + border-bottom-right-radius: 0.5em; + border-top-right-radius: 0.5em; +} + +.bulma-ltr-position-mixin-parent { + background-color: beige; + border-radius: 0.5em; + padding: 1rem; + padding-left: 5rem; + position: relative; +} + +.bulma-ltr-position-mixin-parent p { + margin-top: -0.25rem; +} + +.bulma-ltr-position-mixin { + left: 1rem; + border-radius: 0.25em; + position: absolute; + top: 1rem; +} + +.bulma-ltr-property-mixin-parent { + align-items: flex-start; + background-color: midnightblue; + border-radius: 0.5em; + color: lightskyblue; + display: flex; + padding: 1.5rem; + position: relative; +} + +.bulma-ltr-property-mixin-parent p { + margin-top: -0.25rem; +} + +.bulma-ltr-property-mixin { + margin-left: 1rem; + border-radius: 0.25em; +} diff --git a/docs/documentation/utilities/mixins.html b/docs/documentation/utilities/mixins.html index cecb47b79..99ecf7f51 100644 --- a/docs/documentation/utilities/mixins.html +++ b/docs/documentation/utilities/mixins.html @@ -18,7 +18,11 @@ breadcrumb: {% include elements/anchor.html name="Element Mixins" %} -

Arrow

+

+ These mixins create a visual HTML element. +

+ +{% include elements/anchor-bis.html name="Arrow" %}

@@ -38,7 +42,7 @@ breadcrumb: -

Hamburger

+{% include elements/anchor-bis.html name="Hamburger" %}

@@ -62,7 +66,7 @@ breadcrumb: -

Delete

+{% include elements/anchor-bis.html name="Delete" %}

@@ -85,7 +89,7 @@ breadcrumb: -

Loader

+{% include elements/anchor-bis.html name="Loader" %}

@@ -105,7 +109,42 @@ breadcrumb: -

Block

+{% include elements/anchor-bis.html name="Font Awesome container" %} + +
+

+ The fa() mixin creates a square inline-block element, ideal for containing a Font Awesome icon, or any other type of icon font. +
+ The first $size parameter defines the icon font size. +
+ The second $dimensions parameter defines the dimensions of the square container. +

+
+ +{% highlight sass %}.bulma-fa-mixin { + @include fa(1rem, 2rem); + background-color: lavender; // For demo purposes +}{% endhighlight %} + +{% capture fa %} + + + +{% endcapture %} + +{% include elements/snippet.html content=fa %} + + + +{% include elements/anchor.html name="CSS Mixins" %} + +

+ These mixins add CSS rules to the element. +

+ + + +{% include elements/anchor-bis.html name="Block" %}

@@ -129,56 +168,361 @@ breadcrumb: -

Font Awesome container

+{% include elements/anchor-bis.html name="Overlay" %}

- The fa() mixin creates a square inline-block element, ideal for containing a Font Awesome icon, or any other type of icon font. + The overlay() mixin makes the element cover its closest positioned ancestor.
- The first $size parameter defines the icon font size. + The $offset parameter defines how far inside the element is positioned from each edge (top, bottom, left and right). +

+
+ +{% highlight sass %}.bulma-overlay-mixin { + @include overlay(1.5rem); + background-color: darkorange; + border-radius: 0.25em; + color: white; + opacity: 0.9; + padding: 1em; +}{% endhighlight %} + +{% capture overlay %} +
+
Overlay element
+
+{% endcapture %} + +{% include elements/snippet.html content=overlay %} + + + +{% include elements/anchor-bis.html name="Center" %} + +
+

+ The center() mixin allows you to absolutely position an element with fixed dimensions at the center of its closest positioned ancestor.
- The second $dimensions parameter defines the dimensions of the square container. + The value of the $width parameter should be the width of the element the mixin is applied on. +
+ Unless the element has square dimensions, the second parameter $height is required and its value should be the height of the element the mixin is applied on.

-{% highlight sass %}.bulma-fa-mixin { - @include fa(1rem, 2rem); - background-color: lavender; // For demo purposes +{% highlight sass %}.bulma-center-mixin { + @include center; }{% endhighlight %} -{% capture fa %} - - - +{% capture center %} +
+ +
{% endcapture %} -{% include elements/snippet.html content=fa %} +{% include elements/snippet.html content=center %} + + + +{% include elements/anchor-bis.html name="Placeholder" %} + +
+

+ The placeholder() mixin allows you to change the style of an input's placeholder. +
+ The $offset parameter defines how far inside the element is positioned from each edge (top, bottom, left and right). +

+
+ +{% highlight sass %}.bulma-placeholder-mixin { + @include placeholder { + color: lightblue; + } +}{% endhighlight %} + +{% capture placeholder %} + +{% endcapture %} + +{% include elements/snippet.html content=placeholder %} -@include overlay($offset: 0) +{% include elements/anchor-bis.html name="Clearfix" %} + +
+

+ The clearfix() mixin adds a ::after pseudo-element with a clear: both rule. +

+
-@include placeholder +{% highlight sass %}.bulma-clearfix-mixin { + @include clearfix; +}{% endhighlight %} -// Tools +{% capture clearfix %} +
+ +

This is a short image description.

+
-@include clearfix +

This text is following the clearfix element and is correctly placed after.

+{% endcapture %} -@include center($width, $height: 0) +{% include elements/snippet.html content=clearfix %} -@include overflow-touch + -@include reset +{% include elements/anchor-bis.html name="Reset" %} -@include unselectable +
+

+ The reset() mixin applies a soft style reset. This is especially useful for <button> elements. +

+
-// RTL +{% highlight sass %}.bulma-reset-mixin { + @include reset; +}{% endhighlight %} -@include ltr +{% capture reset %} + + +{% endcapture %} -@include rtl +{% include elements/snippet.html content=reset %} -@include ltr-property($property, $spacing, $right: true) + -@include ltr-position($spacing, $right: true) +{% include elements/anchor-bis.html name="Unselectable" %} + +
+

+ The unselectable() mixin makes an element not selectable. This is to prevent the text to be selected when double-clicked. +

+
+ +{% highlight sass %}.bulma-unselectable-mixin { + @include unselectable; +}{% endhighlight %} + +{% capture unselectable %} +

This text is selectable.

+

This text is not selectable.

+{% endcapture %} + +{% include elements/snippet.html content=unselectable %} + + + +{% include elements/anchor-bis.html name="Overflow Touch" %} + +
+

+ The overflow-touch() mixin add the -webkit-overflow-scrolling: touch; rule to the element. +

+
+ + + +{% include elements/anchor.html name="Direction Mixins" %} + +{% include elements/anchor-bis.html name="Left-to-right and Right-to-left Mixins" %} + +
+

+ Bulma has a global $rtl flag, which allows the framework to output a Right-to-left version of the CSS. By default, this flag's value is set to false. This means the framework output a Left-to-right version. +

+ +

+ The mixins @mixin ltr and @mixin rtl are here to output CSS rules based on the value of $rtl: +

+ +
    +
  • + if $rtl: true, @include ltr outputs nothing +
  • +
  • + if $rtl: false, @include rtl outputs nothing +
  • +
+ +

+ This is useful for properties that are specific to the side of an element. +

+
+ +{% highlight sass %}.bulma-ltr-rtl-mixin { + background-color: lightgreen; + padding: 0.5em 1em; + border: 1px solid seagreen; + margin-right: -1px; + + &:first-child { + @include ltr { + border-bottom-left-radius: 0.5em; + border-top-left-radius: 0.5em; + } + + @include rtl { + border-bottom-right-radius: 0.5em; + border-top-right-radius: 0.5em; + } + } + + &:last-child { + @include ltr { + border-bottom-right-radius: 0.5em; + border-top-right-radius: 0.5em; + } + + @include rtl { + border-bottom-left-radius: 0.5em; + border-top-left-radius: 0.5em; + } + } +}{% endhighlight %} + +{% capture ltr-rtl %} +
+ One + Two + Three +
+{% endcapture %} + +{% include elements/snippet.html content=ltr-rtl %} + + + +{% include elements/anchor-bis.html name="LTR Position" %} + +
+

+ The ltr-position() mixin is a quick way to switch between left and right CSS properties when dealing with positioned elements. +
+ The first $spacing parameter defines the value of the offset, whether it's right or left. +
+ The second $right parameter defines if the property outputs right (default) or left. +

+ +

+ Here is what the output looks like with a $spacing parameter set to 1rem: +

+ + + + + + + + + + + + + + + + + + + + + +
Flag →$rtl: false;$rtl: true;
@include ltr-position(1rem, true)right: 1remleft: 1rem
@include ltr-position(1rem, false)left: 1remright: 1rem
+
+ +

Sass source

+ +{% highlight sass %}.bulma-ltr-position-mixin { + @include ltr-position(1rem, false); + border-radius: 0.25em; + position: absolute; + top: 1rem; +}{% endhighlight %} + +

CSS output

+ +{% highlight css %}.bulma-ltr-position-mixin { + left: 1rem; + border-radius: 0.25em; + position: absolute; + top: 1rem; +}{% endhighlight %} + +{% capture ltr-position %} +
+ +

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum.

+
+{% endcapture %} + +{% include elements/snippet.html content=ltr-position %} + + +{% include elements/anchor-bis.html name="LTR Property" %} + +
+

+ The ltr-property() mixin works like the ltr-position() mixin but allows you to choose which CSS property to set. The mixin will append -right or -left to that property. This is especially useful for margin and padding. +
+ The first $property parameter which property you want to "flip" left and right. +
+ The second $spacing parameter defines the value of the offset, whether it's right or left. +
+ The third $right parameter defines if the property outputs right (default) or left. +

+ +

+ Here is what the output looks like with a $spacing parameter set to 1rem: +

+ + + + + + + + + + + + + + + + + + + + + +
Flag →$rtl: false;$rtl: true;
@include ltr-property("margin", 1rem, true)margin-right: 1remmargin-left: 1rem
@include ltr-property("margin", 1rem, false)margin-left: 1remmargin-right: 1rem
+
+ +

Sass source

+ +{% highlight sass %}.bulma-ltr-property-mixin { + @include ltr-property("margin", 1rem, false); + border-radius: 0.25em; +}{% endhighlight %} + +

CSS output

+ +{% highlight css %}.bulma-ltr-property-mixin { + margin-left: 1rem; + border-radius: 0.25em; +}{% endhighlight %} + +{% capture ltr-property %} +
+

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum.

+ +
+{% endcapture %} +{% include elements/snippet.html content=ltr-property %} diff --git a/docs/documentation/utilities/responsive-mixins.html b/docs/documentation/utilities/responsive-mixins.html index 7dcf0a7ba..15af10b95 100644 --- a/docs/documentation/utilities/responsive-mixins.html +++ b/docs/documentation/utilities/responsive-mixins.html @@ -1,68 +1,11 @@ --- title: Mixins layout: documentation -doc-tab: overview +doc-tab: utilities doc-subtab: mixins breadcrumb: - home - documentation -- overview -- overview-mixins +- utilities +- utilities-responsive-mixins --- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
=arrow($color)Creates a CSS-only down arrow. Used for the dropdown select.
=blockDefines a margin-bottom of 1.5rem, except when the element is the last child. Used for almost all block elements.
=clearfixAdds a clearfix at the end of the element. Used for the "is-clearfix" helper.
=center($size)Positions an element in the exact center of its parent. Used for the spinner in a loading button.
=deleteCreates a CSS-only cross. Used for the delete element in modals, messages, tags...
=fa($size, $dimensions)Sets the style of a Font Awesome icon container.
=hamburger($dimensions)Creates a CSS-only hamburger menu with 3 bars. Used for the "nav-toggle".
=loaderCreates a CSS-only loading spinner. Used for the ".loader" element, and for input and button spinners.
=overflow-touchSets the style of a container so that it keeps momentum when scrolling on iOS devices.
=overlay($offset: 0)Makes the element overlay its parent container, like the transparent modal background.
=placeholderSets the styles of an input placeholder.
=unselectableTurns the element unselectable. Used for buttons to prevent selection when clicking.
-
- -
-

These mixins are already used throughout Bulma, but you can use them as well to extend your own styles.

-
diff --git a/sass/utilities/mixins.sass b/sass/utilities/mixins.sass index 248d28277..4d2e5b53d 100644 --- a/sass/utilities/mixins.sass +++ b/sass/utilities/mixins.sass @@ -282,4 +282,3 @@ position: absolute right: $offset top: $offset -