1 | //
|
2 | // Copyright IBM Corp. 2016, 2018
|
3 | //
|
4 | // This source code is licensed under the Apache-2.0 license found in the
|
5 | // LICENSE file in the root directory of this source tree.
|
6 | //
|
7 |
|
8 | @import 'helper-classes';
|
9 | @import 'deprecate';
|
10 | @import 'functions';
|
11 |
|
12 | /// @deprecated (For v10) Superseded by `$carbon--grid-breakpoints`
|
13 | /// @access private
|
14 | /// @type Map
|
15 | /// @group @mixin breakpoint/max-breakpoint
|
16 | $breakpoints: (
|
17 | bp--xs--major: 500px,
|
18 | bp--sm--major: 768px,
|
19 | bp--md--major: 992px,
|
20 | bp--lg--major: 1200px,
|
21 | sm: 320px,
|
22 | md: 672px,
|
23 | lg: 1056px,
|
24 | xlg: 1312px,
|
25 | max: 1584px,
|
26 | );
|
27 |
|
28 | /// @deprecated (For v10) Was used primary for older grid
|
29 | /// @access private
|
30 | /// @type Map
|
31 | /// @group @function padding();
|
32 | $padding: (
|
33 | 'mobile': 3%,
|
34 | 'xs': 5%,
|
35 | );
|
36 |
|
37 | //-------------------------------------
|
38 | // @function: padding($value)
|
39 | //-------------------------------------
|
40 | /// @deprecated (For v10) Was used primary for older grid
|
41 | /// @group $padding map
|
42 | /// @param {String} $value - mobile or xs
|
43 | /// @example
|
44 | // .container {
|
45 | // padding: padding(mobile);
|
46 | // }
|
47 | @function padding($value) {
|
48 | @if feature-flag-enabled('breaking-changes-x') {
|
49 | @warn ('`@function padding()` has been removed.');
|
50 | } @else {
|
51 | @if map-has-key($padding, $value) {
|
52 | @return map-get($padding, $value);
|
53 | } @else {
|
54 | @warn 'padding: could not find #{$value} in $padding map. Please make sure it is defined';
|
55 | }
|
56 | }
|
57 | }
|
58 |
|
59 | //-------------------------------------
|
60 | // @mixin: breakpoint($size)
|
61 | //-------------------------------------
|
62 | /// @access public
|
63 | /// @deprecated (For v10) Use `@include carbon--breakpoint()`
|
64 | /// @param {String} $size - from $breakpoints map (see line 16)
|
65 | /// @content will add media query for styles using breakpoint as min-width
|
66 | /// @example
|
67 | // @include breakpoint(bp--md--major) {
|
68 | // - styles here --
|
69 | // }
|
70 | @mixin breakpoint($size) {
|
71 | @include deprecate(
|
72 | '`@include breakpoint()` has been removed. ' + 'Use `@include carbon--breakpoint()` instead.',
|
73 | feature-flag-enabled('breaking-changes-x'),
|
74 | true
|
75 | ) {
|
76 | @if map-has-key($breakpoints, $size) {
|
77 | @media screen and (min-width: map-get($breakpoints, $size)) {
|
78 | @content;
|
79 | }
|
80 | } @else {
|
81 | @media (min-width: $size) {
|
82 | @content;
|
83 | }
|
84 | }
|
85 | }
|
86 | }
|
87 |
|
88 | //-------------------------------------
|
89 | // @mixin: max-breakpoint($size)
|
90 | //-------------------------------------
|
91 | /// @access public
|
92 | /// @deprecated (For v10) Use `@include carbon--breakpoint-down()`
|
93 | /// @param {String} $size - from $breakpoints map (see line 16)
|
94 | /// @example @include max-breakpoint('bp--xs--major') { ... };
|
95 | /// @content will add media query for styles using breakpoint as max-width
|
96 | @mixin max-breakpoint($size) {
|
97 | @include deprecate(
|
98 | '`@include max-breakpoint()` has been removed. ' + 'Use `@include carbon--breakpoint-down()` instead.',
|
99 | feature-flag-enabled('breaking-changes-x'),
|
100 | true
|
101 | ) {
|
102 | @if map-has-key($breakpoints, $size) {
|
103 | @media screen and (max-width: map-get($breakpoints, $size)) {
|
104 | @content;
|
105 | }
|
106 | } @else {
|
107 | @media (max-width: $size) {
|
108 | @content;
|
109 | }
|
110 | }
|
111 | }
|
112 | }
|
113 |
|
114 | //-------------------------------------
|
115 | // @mixin: grid-container
|
116 | //-------------------------------------
|
117 | /// @access public
|
118 | /// @deprecated (For v10) Use `@include carbon--make-container()`
|
119 | /// @example
|
120 | /// .some-container {
|
121 | /// @include grid-container;
|
122 | /// }
|
123 | @mixin grid-container {
|
124 | @include deprecate(
|
125 | '`@include grid-container` has been removed. ' + 'Use `@include carbon--make-container()` instead.',
|
126 | feature-flag-enabled('breaking-changes-x'),
|
127 | true
|
128 | ) {
|
129 | width: 100%;
|
130 | padding-right: padding(mobile);
|
131 | padding-left: padding(mobile);
|
132 |
|
133 | @include breakpoint(bp--xs--major) {
|
134 | padding-right: padding(xs);
|
135 | padding-left: padding(xs);
|
136 | }
|
137 | }
|
138 | }
|
139 |
|
140 | /// @access private
|
141 | /// @type Map
|
142 | /// @group @function z();
|
143 | $z-indexes: (
|
144 | modal: 9000,
|
145 | overlay: 8000,
|
146 | dropdown: 7000,
|
147 | header: 6000,
|
148 | footer: 5000,
|
149 | hidden: - 1,
|
150 | overflowHidden: - 1,
|
151 | floating: 10000,
|
152 | );
|
153 |
|
154 | //-------------------------------------
|
155 | // @function: z($layer)
|
156 | //-------------------------------------
|
157 | /// @access public
|
158 | /// @param {String} $layer value from $z-indexes map (See line 139)
|
159 | /// @group $z-indexes
|
160 | /// @example
|
161 | // .modal {
|
162 | // z-index: z('modal');
|
163 | // }
|
164 | @function z($layer) {
|
165 | @if not map-has-key($z-indexes, $layer) {
|
166 | @warn 'No layer found for `#{$layer}` in $z-indexes map. Property omitted.';
|
167 | }
|
168 |
|
169 | @return map-get($z-indexes, $layer);
|
170 | }
|