|
1 | 1 | //// |
2 | 2 | /// @group typography |
3 | | -/// @access public |
4 | 3 | /// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a> |
5 | 4 | //// |
6 | 5 |
|
|
10 | 9 | @import '../components/button/button-theme'; |
11 | 10 | @import '../components/calendar/calendar-theme'; |
12 | 11 | @import '../components/card/card-theme'; |
| 12 | +@import '../components/charts/data-chart-theme'; |
| 13 | +@import '../components/charts/financial-chart-theme'; |
| 14 | +@import '../components/charts/funnel-chart-theme'; |
| 15 | +@import '../components/charts/gauge-theme'; |
| 16 | +@import '../components/charts/graph-theme'; |
| 17 | +@import '../components/charts/shape-chart-theme'; |
13 | 18 | @import '../components/checkbox/checkbox-theme'; |
14 | 19 | @import '../components/chip/chip-theme'; |
15 | 20 | @import '../components/column-hiding/column-hiding-theme'; |
| 21 | +@import '../components/date-range-picker/date-range-picker-theme'; |
16 | 22 | @import '../components/dialog/dialog-theme'; |
17 | 23 | @import '../components/drop-down/drop-down-theme'; |
18 | | -@import '../components/date-range-picker/date-range-picker-theme'; |
19 | 24 | @import '../components/expansion-panel/expansion-panel-theme'; |
20 | 25 | @import '../components/grid/excel-filtering-theme'; |
21 | 26 | @import '../components/input/input-group-theme'; |
| 27 | +@import '../components/list/list-theme'; |
22 | 28 | @import '../components/navbar/navbar-theme'; |
23 | 29 | @import '../components/navdrawer/navdrawer-theme'; |
24 | | -@import '../components/list/list-theme'; |
25 | 30 | @import '../components/radio/radio-theme'; |
26 | | -@import '../components/snackbar/snackbar-theme'; |
27 | 31 | @import '../components/slider/slider-theme'; |
| 32 | +@import '../components/snackbar/snackbar-theme'; |
28 | 33 | @import '../components/switch/switch-theme'; |
29 | 34 | @import '../components/tabs/tabs-theme'; |
30 | 35 | @import '../components/time-picker/time-picker-theme'; |
31 | 36 | @import '../components/toast/toast-theme'; |
32 | 37 | @import '../components/tooltip/tooltip-theme'; |
33 | | -@import '../components/charts/data-chart-theme'; |
34 | | -@import '../components/charts/financial-chart-theme'; |
35 | | -@import '../components/charts/graph-theme'; |
36 | | -@import '../components/charts/shape-chart-theme'; |
37 | | -@import '../components/charts/funnel-chart-theme'; |
38 | | -@import '../components/charts/gauge-theme'; |
39 | 38 |
|
40 | | -/// Adds typography styles for h1-h6, paragraph and creates |
41 | | -/// custom typography class selectors. The produces styles |
42 | | -/// are based on the passed type scale. If omitted the |
43 | | -/// default-type-scale will be used. |
44 | | -/// @param {String} $font-family ["'Titillium Web', sans-serif"] - The font family to be used across all typographic elements. |
45 | | -/// @param {Map} $type-scale [$default-type-scale] - A type scale map as produced by igx-type-scale. |
46 | | -@mixin igx-typography( |
47 | | - $font-family: "'Titillium Web', sans-serif", |
48 | | - $type-scale: $default-type-scale, |
49 | | -) { |
| 39 | +/// @access private |
| 40 | +@mixin _igx-typography-styles($font-family, $type-scale) { |
| 41 | + font-family: unquote($font-family); |
| 42 | + font-size: $browser-context; |
| 43 | + line-height: $browser-line-height; |
| 44 | + font-size-adjust: 100%; |
| 45 | + -webkit-font-smoothing: antialiased; |
| 46 | + -moz-osx-font-smoothing: grayscale; |
| 47 | + |
| 48 | + $this: bem--selector-to-string(&); |
| 49 | + $selector: bem--extract-first-selector($this); |
| 50 | + |
50 | 51 | // Maps type scale typographic categories |
51 | 52 | // to native elements. |
52 | 53 | $category-element-map: ( |
|
59 | 60 | body-1: 'p' |
60 | 61 | ); |
61 | 62 |
|
62 | | - $this: bem--selector-to-string(&); |
63 | | - $scope: if(is-root(), 'igx-typography', #{str-slice($this, 2, -1)}); |
64 | | - |
65 | | - // Use the BEM notation to create a link |
66 | | - // between the igx-typography class selector |
67 | | - // and all typographic elements. |
68 | | - @include b($scope) { |
69 | | - font-family: unquote($font-family); |
70 | | - font-size: $browser-context; |
71 | | - line-height: $browser-line-height; |
72 | | - font-size-adjust: 100%; |
73 | | - -webkit-font-smoothing: antialiased; |
74 | | - -moz-osx-font-smoothing: grayscale; |
75 | | - |
76 | | - @each $category, $type-style in $type-scale { |
77 | | - // Get the native element that uses typographic styles directly |
78 | | - // as mapped in the $category-element-map |
79 | | - $e: map-get($category-element-map, $category); |
| 63 | + @each $category, $type-style in $type-scale { |
| 64 | + // Get the native element that uses typographic styles directly |
| 65 | + // as mapped in the $category-element-map |
| 66 | + $e: map-get($category-element-map, $category); |
80 | 67 |
|
81 | | - // Create a placeholder selector with styles for each |
82 | | - // typographic style to be able to easily extend it |
83 | | - // elsewhere. |
84 | | - %#{$category} { |
85 | | - @include igx-type-style($type-scale, $category); |
86 | | - } |
| 68 | + // Create a placeholder selector with styles for each |
| 69 | + // typographic style to be able to easily extend it |
| 70 | + // elsewhere. |
| 71 | + %#{$category} { |
| 72 | + @include igx-type-style($type-scale, $category); |
| 73 | + } |
87 | 74 |
|
88 | | - // Add native element typographic styles. |
89 | | - @if $e != null { |
90 | | - #{$e} { |
91 | | - @extend %#{$category}; |
92 | | - } |
| 75 | + // Add native element typographic styles. |
| 76 | + @if $e != null { |
| 77 | + #{$e} { |
| 78 | + @extend %#{$category}; |
93 | 79 | } |
| 80 | + } |
94 | 81 |
|
95 | | - // Add class selector typographic styles. |
| 82 | + // Add class selector typographic styles. |
| 83 | + @if ($selector == '.igx-typography') { |
96 | 84 | @include e(#{$category}) { |
97 | | - $selector: bem--selector-to-string(&); |
98 | | - |
99 | 85 | @extend %#{$category}; |
100 | 86 | } |
101 | 87 | } |
| 88 | + } |
| 89 | + |
| 90 | + // Call the individual component styles with the type scale |
| 91 | + @include _excel-filtering-typography($type-scale); |
| 92 | + @include igx-banner-typography($type-scale); |
| 93 | + @include igx-bottom-nav-typography($type-scale); |
| 94 | + @include igx-button-typography($type-scale); |
| 95 | + @include igx-calendar-typography($type-scale); |
| 96 | + @include igx-card-typography($type-scale); |
| 97 | + @include igx-checkbox-typography($type-scale); |
| 98 | + @include igx-chip-typography($type-scale); |
| 99 | + @include igx-column-hiding-typography($type-scale); |
| 100 | + @include igx-data-chart-typography($type-scale); |
| 101 | + @include igx-date-range-typography($type-scale); |
| 102 | + @include igx-dialog-typography($type-scale); |
| 103 | + @include igx-drop-down-typography($type-scale); |
| 104 | + @include igx-expansion-panel-typography($type-scale); |
| 105 | + @include igx-financial-chart-typography($type-scale); |
| 106 | + @include igx-funnel-chart-typography($type-scale); |
| 107 | + @include igx-gauge-typography(); |
| 108 | + @include igx-graph-typography(); |
| 109 | + @include igx-input-group-typography($type-scale); |
| 110 | + @include igx-list-typography($type-scale); |
| 111 | + @include igx-navbar-typography($type-scale); |
| 112 | + @include igx-navdrawer-typography($type-scale); |
| 113 | + @include igx-radio-typography($type-scale); |
| 114 | + @include igx-shape-chart-typography($type-scale); |
| 115 | + @include igx-slider-typography($type-scale); |
| 116 | + @include igx-snackbar-typography($type-scale); |
| 117 | + @include igx-switch-typography($type-scale); |
| 118 | + @include igx-tabs-typography($type-scale); |
| 119 | + @include igx-time-picker-typography($type-scale); |
| 120 | + @include igx-toast-typography($type-scale); |
| 121 | + @include igx-tooltip-typography($type-scale); |
| 122 | +} |
102 | 123 |
|
103 | | - // Call the individual component styles with the type scale |
104 | | - @include igx-button-typography($type-scale); |
105 | | - @include igx-bottom-nav-typography($type-scale); |
106 | | - @include igx-banner-typography($type-scale); |
107 | | - @include igx-calendar-typography($type-scale); |
108 | | - @include igx-card-typography($type-scale); |
109 | | - @include igx-checkbox-typography($type-scale); |
110 | | - @include igx-chip-typography($type-scale); |
111 | | - @include igx-column-hiding-typography($type-scale); |
112 | | - @include igx-dialog-typography($type-scale); |
113 | | - @include igx-drop-down-typography($type-scale); |
114 | | - @include igx-date-range-typography($type-scale); |
115 | | - @include igx-expansion-panel-typography($type-scale); |
116 | | - @include _excel-filtering-typography($type-scale); |
117 | | - @include igx-input-group-typography($type-scale); |
118 | | - @include igx-navbar-typography($type-scale); |
119 | | - @include igx-navdrawer-typography($type-scale); |
120 | | - @include igx-list-typography($type-scale); |
121 | | - @include igx-radio-typography($type-scale); |
122 | | - @include igx-snackbar-typography($type-scale); |
123 | | - @include igx-switch-typography($type-scale); |
124 | | - @include igx-slider-typography($type-scale); |
125 | | - @include igx-tabs-typography($type-scale); |
126 | | - @include igx-time-picker-typography($type-scale); |
127 | | - @include igx-toast-typography($type-scale); |
128 | | - @include igx-tooltip-typography($type-scale); |
129 | | - @include igx-data-chart-typography($type-scale); |
130 | | - @include igx-financial-chart-typography($type-scale); |
131 | | - @include igx-graph-typography(); |
132 | | - @include igx-shape-chart-typography($type-scale); |
133 | | - @include igx-funnel-chart-typography($type-scale); |
134 | | - @include igx-gauge-typography(); |
| 124 | +/// Adds typography styles for h1-h6, paragraph and creates |
| 125 | +/// custom typography class selectors. The produces styles |
| 126 | +/// are based on the passed type scale. If omitted the |
| 127 | +/// default-type-scale will be used. |
| 128 | +/// @access public |
| 129 | +/// @param {String} $font-family ["'Titillium Web', sans-serif"] - The font family to be used across all typographic elements. |
| 130 | +/// @param {Map} $type-scale [$default-type-scale] - A type scale map as produced by igx-type-scale. |
| 131 | +@mixin igx-typography( |
| 132 | + $font-family: "'Titillium Web', sans-serif", |
| 133 | + $type-scale: $default-type-scale, |
| 134 | +) { |
| 135 | + @if(is-root()) { |
| 136 | + // Use the BEM notation to create a link |
| 137 | + // between the igx-typography class selector |
| 138 | + // and all typographic elements. |
| 139 | + @include b(igx-typography) { |
| 140 | + @include _igx-typography-styles($font-family, $type-scale); |
| 141 | + } |
| 142 | + } @else { |
| 143 | + @include _igx-typography-styles($font-family, $type-scale); |
135 | 144 | } |
136 | 145 | } |
| 146 | + |
0 commit comments