@elastic/eui-theme-common 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +6 -0
- package/README.md +11 -0
- package/lib/cjs/.tsbuildinfo +1 -0
- package/lib/cjs/global_styling/functions/index.d.ts +2 -0
- package/lib/cjs/global_styling/functions/index.d.ts.map +1 -0
- package/lib/cjs/global_styling/functions/index.js +22 -0
- package/lib/cjs/global_styling/functions/index.js.map +1 -0
- package/lib/cjs/global_styling/functions/size.d.ts +13 -0
- package/lib/cjs/global_styling/functions/size.d.ts.map +1 -0
- package/lib/cjs/global_styling/functions/size.js +42 -0
- package/lib/cjs/global_styling/functions/size.js.map +1 -0
- package/lib/cjs/global_styling/index.d.ts +4 -0
- package/lib/cjs/global_styling/index.d.ts.map +1 -0
- package/lib/cjs/global_styling/index.js +44 -0
- package/lib/cjs/global_styling/index.js.map +1 -0
- package/lib/cjs/global_styling/types.d.ts +66 -0
- package/lib/cjs/global_styling/types.d.ts.map +1 -0
- package/lib/cjs/global_styling/types.js +21 -0
- package/lib/cjs/global_styling/types.js.map +1 -0
- package/lib/cjs/global_styling/variables/_colors_vis.d.ts +13 -0
- package/lib/cjs/global_styling/variables/_colors_vis.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/_colors_vis.js +69 -0
- package/lib/cjs/global_styling/variables/_colors_vis.js.map +1 -0
- package/lib/cjs/global_styling/variables/animations.d.ts +36 -0
- package/lib/cjs/global_styling/variables/animations.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/animations.js +38 -0
- package/lib/cjs/global_styling/variables/animations.js.map +1 -0
- package/lib/cjs/global_styling/variables/borders.d.ts +61 -0
- package/lib/cjs/global_styling/variables/borders.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/borders.js +7 -0
- package/lib/cjs/global_styling/variables/borders.js.map +1 -0
- package/lib/cjs/global_styling/variables/breakpoint.d.ts +15 -0
- package/lib/cjs/global_styling/variables/breakpoint.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/breakpoint.js +23 -0
- package/lib/cjs/global_styling/variables/breakpoint.js.map +1 -0
- package/lib/cjs/global_styling/variables/buttons.d.ts +44 -0
- package/lib/cjs/global_styling/variables/buttons.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/buttons.js +7 -0
- package/lib/cjs/global_styling/variables/buttons.js.map +1 -0
- package/lib/cjs/global_styling/variables/colors.d.ts +245 -0
- package/lib/cjs/global_styling/variables/colors.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/colors.js +7 -0
- package/lib/cjs/global_styling/variables/colors.js.map +1 -0
- package/lib/cjs/global_styling/variables/components.d.ts +69 -0
- package/lib/cjs/global_styling/variables/components.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/components.js +7 -0
- package/lib/cjs/global_styling/variables/components.js.map +1 -0
- package/lib/cjs/global_styling/variables/forms.d.ts +20 -0
- package/lib/cjs/global_styling/variables/forms.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/forms.js +7 -0
- package/lib/cjs/global_styling/variables/forms.js.map +1 -0
- package/lib/cjs/global_styling/variables/index.d.ts +14 -0
- package/lib/cjs/global_styling/variables/index.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/index.js +154 -0
- package/lib/cjs/global_styling/variables/index.js.map +1 -0
- package/lib/cjs/global_styling/variables/levels.d.ts +39 -0
- package/lib/cjs/global_styling/variables/levels.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/levels.js +33 -0
- package/lib/cjs/global_styling/variables/levels.js.map +1 -0
- package/lib/cjs/global_styling/variables/shadow.d.ts +11 -0
- package/lib/cjs/global_styling/variables/shadow.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/shadow.js +27 -0
- package/lib/cjs/global_styling/variables/shadow.js.map +1 -0
- package/lib/cjs/global_styling/variables/size.d.ts +26 -0
- package/lib/cjs/global_styling/variables/size.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/size.js +17 -0
- package/lib/cjs/global_styling/variables/size.js.map +1 -0
- package/lib/cjs/global_styling/variables/states.d.ts +25 -0
- package/lib/cjs/global_styling/variables/states.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/states.js +7 -0
- package/lib/cjs/global_styling/variables/states.js.map +1 -0
- package/lib/cjs/global_styling/variables/typography.d.ts +93 -0
- package/lib/cjs/global_styling/variables/typography.d.ts.map +1 -0
- package/lib/cjs/global_styling/variables/typography.js +48 -0
- package/lib/cjs/global_styling/variables/typography.js.map +1 -0
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +44 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types.d.ts +33 -0
- package/lib/cjs/types.d.ts.map +1 -0
- package/lib/cjs/types.js +7 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils.d.ts +104 -0
- package/lib/cjs/utils.d.ts.map +1 -0
- package/lib/cjs/utils.js +382 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/cjs/utils.test.js +411 -0
- package/lib/cjs/utils.test.js.map +1 -0
- package/lib/esm/.tsbuildinfo +1 -0
- package/lib/esm/global_styling/functions/index.d.ts +1 -0
- package/lib/esm/global_styling/functions/index.js +9 -0
- package/lib/esm/global_styling/functions/index.js.map +1 -0
- package/lib/esm/global_styling/functions/size.d.ts +12 -0
- package/lib/esm/global_styling/functions/size.js +21 -0
- package/lib/esm/global_styling/functions/size.js.map +1 -0
- package/lib/esm/global_styling/index.d.ts +3 -0
- package/lib/esm/global_styling/index.js +11 -0
- package/lib/esm/global_styling/index.js.map +1 -0
- package/lib/esm/global_styling/types.d.ts +65 -0
- package/lib/esm/global_styling/types.js +13 -0
- package/lib/esm/global_styling/types.js.map +1 -0
- package/lib/esm/global_styling/variables/_colors_vis.d.ts +12 -0
- package/lib/esm/global_styling/variables/_colors_vis.js +60 -0
- package/lib/esm/global_styling/variables/_colors_vis.js.map +1 -0
- package/lib/esm/global_styling/variables/animations.d.ts +35 -0
- package/lib/esm/global_styling/variables/animations.js +25 -0
- package/lib/esm/global_styling/variables/animations.js.map +1 -0
- package/lib/esm/global_styling/variables/borders.d.ts +60 -0
- package/lib/esm/global_styling/variables/borders.js +9 -0
- package/lib/esm/global_styling/variables/borders.js.map +1 -0
- package/lib/esm/global_styling/variables/breakpoint.d.ts +14 -0
- package/lib/esm/global_styling/variables/breakpoint.js +9 -0
- package/lib/esm/global_styling/variables/breakpoint.js.map +1 -0
- package/lib/esm/global_styling/variables/buttons.d.ts +43 -0
- package/lib/esm/global_styling/variables/buttons.js +9 -0
- package/lib/esm/global_styling/variables/buttons.js.map +1 -0
- package/lib/esm/global_styling/variables/colors.d.ts +244 -0
- package/lib/esm/global_styling/variables/colors.js +9 -0
- package/lib/esm/global_styling/variables/colors.js.map +1 -0
- package/lib/esm/global_styling/variables/components.d.ts +68 -0
- package/lib/esm/global_styling/variables/components.js +9 -0
- package/lib/esm/global_styling/variables/components.js.map +1 -0
- package/lib/esm/global_styling/variables/forms.d.ts +19 -0
- package/lib/esm/global_styling/variables/forms.js +9 -0
- package/lib/esm/global_styling/variables/forms.js.map +1 -0
- package/lib/esm/global_styling/variables/index.d.ts +13 -0
- package/lib/esm/global_styling/variables/index.js +21 -0
- package/lib/esm/global_styling/variables/index.js.map +1 -0
- package/lib/esm/global_styling/variables/levels.d.ts +38 -0
- package/lib/esm/global_styling/variables/levels.js +34 -0
- package/lib/esm/global_styling/variables/levels.js.map +1 -0
- package/lib/esm/global_styling/variables/shadow.d.ts +10 -0
- package/lib/esm/global_styling/variables/shadow.js +19 -0
- package/lib/esm/global_styling/variables/shadow.js.map +1 -0
- package/lib/esm/global_styling/variables/size.d.ts +25 -0
- package/lib/esm/global_styling/variables/size.js +20 -0
- package/lib/esm/global_styling/variables/size.js.map +1 -0
- package/lib/esm/global_styling/variables/states.d.ts +24 -0
- package/lib/esm/global_styling/variables/states.js +9 -0
- package/lib/esm/global_styling/variables/states.js.map +1 -0
- package/lib/esm/global_styling/variables/typography.d.ts +92 -0
- package/lib/esm/global_styling/variables/typography.js +35 -0
- package/lib/esm/global_styling/variables/typography.js.map +1 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.js +11 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types.d.ts +32 -0
- package/lib/esm/types.js +9 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils.d.ts +103 -0
- package/lib/esm/utils.js +300 -0
- package/lib/esm/utils.js.map +1 -0
- package/lib/esm/utils.test.d.ts +1 -0
- package/lib/esm/utils.test.js +233 -0
- package/lib/esm/utils.test.js.map +1 -0
- package/licenses/ELASTIC-LICENSE-2.0.md +93 -0
- package/licenses/SSPL-LICENSE.md +557 -0
- package/package.json +78 -0
- package/src/global_styling/functions/_colors.scss +138 -0
- package/src/global_styling/functions/_index.scss +5 -0
- package/src/global_styling/functions/_math.scss +1 -0
- package/src/global_styling/functions/_math_pow.scss +82 -0
- package/src/global_styling/index.scss +18 -0
- package/src/global_styling/mixins/_button.scss +149 -0
- package/src/global_styling/mixins/_form.scss +273 -0
- package/src/global_styling/mixins/_helpers.scss +126 -0
- package/src/global_styling/mixins/_index.scss +14 -0
- package/src/global_styling/mixins/_link.scss +11 -0
- package/src/global_styling/mixins/_loading.scss +6 -0
- package/src/global_styling/mixins/_panel.scss +55 -0
- package/src/global_styling/mixins/_range.scss +62 -0
- package/src/global_styling/mixins/_responsive.scss +44 -0
- package/src/global_styling/mixins/_shadow.scss +108 -0
- package/src/global_styling/mixins/_size.scss +4 -0
- package/src/global_styling/mixins/_states.scss +50 -0
- package/src/global_styling/mixins/_tool_tip.scss +25 -0
- package/src/global_styling/mixins/_typography.scss +167 -0
- package/src/global_styling/react_date_picker/_date_picker.scss +772 -0
- package/src/global_styling/react_date_picker/_index.scss +2 -0
- package/src/global_styling/react_date_picker/_variables.scss +1 -0
- package/src/global_styling/utility/_animations.scss +55 -0
- package/src/global_styling/utility/_index.scss +1 -0
- package/src/global_styling/variables/_animations.scss +13 -0
- package/src/global_styling/variables/_borders.scss +11 -0
- package/src/global_styling/variables/_buttons.scss +18 -0
- package/src/global_styling/variables/_colors_vis.scss +72 -0
- package/src/global_styling/variables/_font_weight.scss +10 -0
- package/src/global_styling/variables/_form.scss +8 -0
- package/src/global_styling/variables/_index.scss +23 -0
- package/src/global_styling/variables/_responsive.scss +9 -0
- package/src/global_styling/variables/_shadows.scss +2 -0
- package/src/global_styling/variables/_size.scss +15 -0
- package/src/global_styling/variables/_states.scss +14 -0
- package/src/global_styling/variables/_typography.scss +75 -0
- package/src/global_styling/variables/_z_index.scss +34 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Converting a normal hex color to RBG
|
|
2
|
+
@function hexToRGB($color) {
|
|
3
|
+
@return 'rgb%28#{round(red($color))}, #{round(green($color))}, #{round(blue($color))}%29';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// Mixes a provided color with white.
|
|
7
|
+
@function tint($color, $percent) {
|
|
8
|
+
@return mix($euiColorGhost, $color, $percent);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Mixes a provided color with black.
|
|
12
|
+
@function shade($color, $percent) {
|
|
13
|
+
@return mix($euiColorInk, $color, $percent);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// For theming. Checks the text color and tells us whether it's light or dark.
|
|
17
|
+
// Based on that we either tint (add white) or shade (add black).
|
|
18
|
+
@function tintOrShade($color, $tint, $shade) {
|
|
19
|
+
@if (lightness($euiTextColor) > 50) {
|
|
20
|
+
@return shade($color, $shade);
|
|
21
|
+
} @else {
|
|
22
|
+
@return tint($color, $tint);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// The reverse of the above
|
|
27
|
+
@function shadeOrTint($color, $shade, $tint) {
|
|
28
|
+
@if (lightness($euiTextColor) < 50) {
|
|
29
|
+
@return shade($color, $shade);
|
|
30
|
+
} @else {
|
|
31
|
+
@return tint($color, $tint);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Similar to above, but uses the light or dark color based
|
|
36
|
+
// on whether it's the light or dark theme
|
|
37
|
+
@function lightOrDarkTheme($lightColor, $darkColor) {
|
|
38
|
+
@if (lightness($euiTextColor) < 50) {
|
|
39
|
+
@return $lightColor;
|
|
40
|
+
} @else {
|
|
41
|
+
@return $darkColor;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Calculates luminance, which is better than brightness for checking colors
|
|
46
|
+
// pow, nth functions come from the _math.scss functions
|
|
47
|
+
@function luminance($color) {
|
|
48
|
+
// Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
49
|
+
$rgba: red($color), green($color), blue($color);
|
|
50
|
+
$rgba2: ();
|
|
51
|
+
|
|
52
|
+
@for $i from 1 through 3 {
|
|
53
|
+
$rgb: nth($rgba, $i);
|
|
54
|
+
$rgb: $rgb / 255;
|
|
55
|
+
|
|
56
|
+
$rgb: if($rgb < .03928, $rgb / 12.92, pow(($rgb + .055) / 1.055, 2.4));
|
|
57
|
+
|
|
58
|
+
$rgba2: append($rgba2, $rgb);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@return .2126 * nth($rgba2, 1) + .7152 * nth($rgba2, 2) + .0722 * nth($rgba2, 3);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Calculate contrast
|
|
65
|
+
@function contrastRatio($background, $foreground) {
|
|
66
|
+
$backgroundLum: luminance($background) + .05;
|
|
67
|
+
$foregroundLum: luminance($foreground) + .05;
|
|
68
|
+
|
|
69
|
+
@return max($backgroundLum, $foregroundLum) / min($backgroundLum, $foregroundLum);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Given $color, decide whether $lightText or $darkText should be used as the text color
|
|
73
|
+
// ex: chooseLightOrDarkText(#EEE, #FFF, #000) would return #000 because it has
|
|
74
|
+
// a higher contrast than #FFF against a #EEE background.
|
|
75
|
+
@function chooseLightOrDarkText($background, $lightText: $euiColorGhost, $darkText: $euiColorInk) {
|
|
76
|
+
$lightContrast: contrastRatio($background, $lightText);
|
|
77
|
+
$darkContrast: contrastRatio($background, $darkText);
|
|
78
|
+
|
|
79
|
+
@if ($lightContrast > $darkContrast) {
|
|
80
|
+
@return $lightText;
|
|
81
|
+
} @else {
|
|
82
|
+
@return $darkText;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Given a $foreground and a $background, make the $foreground AA accessibility by slightly
|
|
87
|
+
// adjusting it till the contrast is high enough
|
|
88
|
+
// By default it will compare against the page background color
|
|
89
|
+
|
|
90
|
+
// ex: makeContrastColor($lightPink, #FFF) would continually shade the pink until
|
|
91
|
+
// it had higher than 4.5 contrast on a white background.
|
|
92
|
+
$euiContrastRatioText: 4.5;
|
|
93
|
+
@function makeHighContrastColor($foreground, $background: $euiPageBackgroundColor, $ratio: $euiContrastRatioText) {
|
|
94
|
+
$contrast: contrastRatio($foreground, $background);
|
|
95
|
+
|
|
96
|
+
// Determine the lightness factor of the background color first to
|
|
97
|
+
// determine whether to shade or tint the foreground.
|
|
98
|
+
$brightness: lightness($background);
|
|
99
|
+
|
|
100
|
+
$highContrastTextColor: $foreground;
|
|
101
|
+
|
|
102
|
+
@while ($contrast < $ratio) {
|
|
103
|
+
@if ($brightness > 50) {
|
|
104
|
+
$highContrastTextColor: shade($highContrastTextColor, 5%);
|
|
105
|
+
} @else {
|
|
106
|
+
$highContrastTextColor: tint($highContrastTextColor, 5%);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
$contrast: contrastRatio($highContrastTextColor, $background);
|
|
110
|
+
|
|
111
|
+
@if (lightness($highContrastTextColor) < 5) {
|
|
112
|
+
@warn 'High enough contrast could not be determined. Most likely your background color does not adjust for light mode.';
|
|
113
|
+
@return $highContrastTextColor;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@if (lightness($highContrastTextColor) > 95) {
|
|
117
|
+
@warn 'High enough contrast could not be determined. Most likely your background color does not adjust for dark mode.';
|
|
118
|
+
@return $highContrastTextColor;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@return $highContrastTextColor;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Graphics such as stand alone icons and pieces of a graph only need a minimum ratio of 3:1 with its background.
|
|
126
|
+
// Therefore, we can reuse the `makeHighContrastColor()` function but only attain a min contrast of 3.0.
|
|
127
|
+
// It is still recommended to use `makeHighContrastColor()` to attain a 4.5:1 ratio if the graphic is small or thinly stroked.
|
|
128
|
+
// https://www.w3.org/WAI/GL/low-vision-a11y-tf/wiki/Informational_Graphic_Contrast_(Minimum)
|
|
129
|
+
$euiContrastRatioGraphic: 3;
|
|
130
|
+
@function makeGraphicContrastColor($color, $background: $euiPageBackgroundColor) {
|
|
131
|
+
@return makeHighContrastColor($color, $background, $euiContrastRatioGraphic);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Disabled content only needs a contrast of at least 2 because there is no interaction available
|
|
135
|
+
$euiContrastRatioDisabled: 2;
|
|
136
|
+
@function makeDisabledContrastColor($color, $background: $euiPageBackgroundColor) {
|
|
137
|
+
@return makeHighContrastColor($color, $background, $euiContrastRatioDisabled);
|
|
138
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import 'math_pow';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2015 strarsis https://github.com/strarsis/sass-math-pow
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
@function pow($number, $exp) {
|
|
26
|
+
$exp1: round($exp);
|
|
27
|
+
$result: powInt($number, $exp1);
|
|
28
|
+
|
|
29
|
+
@if ($exp1 != $exp) {
|
|
30
|
+
$result: $result * mathExp(($exp - $exp1) * mathLn($number));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@return $result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@function powInt($number, $exp) {
|
|
37
|
+
@if $exp == 0 {
|
|
38
|
+
@return 1;
|
|
39
|
+
} @else if $exp < 0 {
|
|
40
|
+
@return 1 / powInt($number, -$exp);
|
|
41
|
+
} @else {
|
|
42
|
+
$e: floor($exp / 2);
|
|
43
|
+
$pow: pow($number, $e);
|
|
44
|
+
@if $e * 2 == $exp {
|
|
45
|
+
@return $pow * $pow;
|
|
46
|
+
} @else {
|
|
47
|
+
@return $pow * $pow * $number;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@function mathExp($value) {
|
|
53
|
+
$item: 1;
|
|
54
|
+
$result: 1;
|
|
55
|
+
|
|
56
|
+
@for $index from 1 to 100 {
|
|
57
|
+
$item: $item * $value / $index;
|
|
58
|
+
$result: $result + $item;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@return $result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@function mathLn($value) {
|
|
65
|
+
$tenExp: 0;
|
|
66
|
+
$lnTen: 2.30258509;
|
|
67
|
+
|
|
68
|
+
@while ($value > 1) {
|
|
69
|
+
$tenExp: $tenExp + 1;
|
|
70
|
+
$value: $value / 10;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$item: -1;
|
|
74
|
+
$result: 0;
|
|
75
|
+
|
|
76
|
+
@for $index from 1 to 100 {
|
|
77
|
+
$item: $item * (1 - $value);
|
|
78
|
+
$result: $result + $item / $index;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@return $result + $tenExp * $lnTen;
|
|
82
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Core
|
|
2
|
+
|
|
3
|
+
// Functions need to be first, since we use them in our variables and mixin definitions
|
|
4
|
+
@import 'functions/index';
|
|
5
|
+
|
|
6
|
+
// Variables come next, and are used in some mixins
|
|
7
|
+
@import 'variables/index';
|
|
8
|
+
|
|
9
|
+
// Mixins provide generic code expansion through helpers
|
|
10
|
+
@import 'mixins/index';
|
|
11
|
+
|
|
12
|
+
// Utility classes provide one-off selectors for common css problems
|
|
13
|
+
@import 'utility/index';
|
|
14
|
+
|
|
15
|
+
// The reset file has moved to global_styles.tsx
|
|
16
|
+
|
|
17
|
+
// Customization of the React Date Picker
|
|
18
|
+
@import 'react_date_picker/index';
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Provides a solid reset and base for handling sizing layout
|
|
2
|
+
// Does not include any visual styles
|
|
3
|
+
@mixin euiButtonBase {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
appearance: none;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
height: $euiButtonHeight;
|
|
8
|
+
line-height: $euiButtonHeight; // prevents descenders from getting cut off
|
|
9
|
+
text-align: center;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
vertical-align: middle;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Adds the focus (and hover) animation for translating up 1px
|
|
16
|
+
@mixin euiButtonFocus {
|
|
17
|
+
@include euiCanAnimate {
|
|
18
|
+
transition: transform $euiAnimSpeedNormal ease-in-out, background-color $euiAnimSpeedNormal ease-in-out;
|
|
19
|
+
|
|
20
|
+
&:hover:not(:disabled) {
|
|
21
|
+
transform: translateY(-1px);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:focus {
|
|
25
|
+
animation: euiButtonActive $euiAnimSpeedNormal $euiAnimSlightBounce;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:active:not(:disabled) {
|
|
29
|
+
transform: translateY(1px);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// All of the button base styles including the base, focus, font, and initial styles
|
|
35
|
+
// Does not include individual alterations like color or sizes
|
|
36
|
+
@mixin euiButton {
|
|
37
|
+
@include euiButtonBase;
|
|
38
|
+
@include euiFont;
|
|
39
|
+
@include euiFontSize;
|
|
40
|
+
@include euiButtonFocus;
|
|
41
|
+
|
|
42
|
+
font-weight: $euiButtonFontWeight;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
outline-offset: -1px;
|
|
45
|
+
|
|
46
|
+
&:hover:not(:disabled),
|
|
47
|
+
&:focus {
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Correctly lays out the contents of a button when using the proper dom elements of:
|
|
53
|
+
// <button>
|
|
54
|
+
// <span className="__content">
|
|
55
|
+
// {icon/spinner}
|
|
56
|
+
// {child}
|
|
57
|
+
// </span>
|
|
58
|
+
// </button>
|
|
59
|
+
// 1. Apply margin to all but last item in the flex.
|
|
60
|
+
// 2. Margin gets flipped because of the row-reverse.
|
|
61
|
+
@mixin euiButtonContent($isReverse: false) {
|
|
62
|
+
height: 100%;
|
|
63
|
+
width: 100%;
|
|
64
|
+
vertical-align: middle;
|
|
65
|
+
|
|
66
|
+
.euiButtonContent__icon,
|
|
67
|
+
.euiButtonContent__spinner {
|
|
68
|
+
flex-shrink: 0; // Ensures the icons/spinner don't scale down below their intended size
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@if ($isReverse) {
|
|
72
|
+
flex-direction: row-reverse;
|
|
73
|
+
|
|
74
|
+
> * + * {
|
|
75
|
+
margin-inline-start: 0; // 1, 2
|
|
76
|
+
margin-inline-end: $euiSizeS; // 1, 2
|
|
77
|
+
}
|
|
78
|
+
} @else {
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
|
|
83
|
+
> * + * {
|
|
84
|
+
margin-inline-start: $euiSizeS; // 1
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@mixin euiButtonContentDisabled {
|
|
90
|
+
pointer-events: auto;
|
|
91
|
+
cursor: not-allowed;
|
|
92
|
+
|
|
93
|
+
&:hover,
|
|
94
|
+
&:focus,
|
|
95
|
+
&:focus-within {
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.euiButtonContent__spinner {
|
|
100
|
+
border-color: euiLoadingSpinnerBorderColors(currentColor);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
* Creates the Amsterdam style of button with a transparent background
|
|
106
|
+
*/
|
|
107
|
+
@mixin euiButtonDefaultStyle($color: 'primary', $includeStates: true, $transparency: $euiButtonDefaultTransparency) {
|
|
108
|
+
$backgroundColor: $color;
|
|
109
|
+
|
|
110
|
+
@if (map-has-key($euiButtonTypes, $color)) {
|
|
111
|
+
$backgroundColor: map-get($euiButtonTypes, $color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
$percentConversion: $transparency * 100%;
|
|
115
|
+
// This variable simulates the possibly darkest background the button could be on
|
|
116
|
+
// Simulates the 20% opaque color on top of the page background color
|
|
117
|
+
$backgroundColorSimulated: mix($euiPageBackgroundColor, $backgroundColor, $percentConversion);
|
|
118
|
+
// Then we can calculate the darkest text color needed
|
|
119
|
+
color: makeHighContrastColor($backgroundColor, $backgroundColorSimulated);
|
|
120
|
+
// But still use transparency
|
|
121
|
+
background-color: transparentize($backgroundColor, $transparency);
|
|
122
|
+
|
|
123
|
+
@if ($includeStates) {
|
|
124
|
+
&:not([class*='isDisabled']) {
|
|
125
|
+
&:hover,
|
|
126
|
+
&:focus {
|
|
127
|
+
// Duplicated from inert state simply to override default theme
|
|
128
|
+
background-color: transparentize($backgroundColor, $transparency);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
* Creates the Amsterdam style of fill button
|
|
136
|
+
*/
|
|
137
|
+
@mixin euiButtonFillStyle($color: 'primary') {
|
|
138
|
+
$backgroundColor: $color;
|
|
139
|
+
|
|
140
|
+
@if (map-has-key($euiButtonTypes, $color)) {
|
|
141
|
+
$backgroundColor: map-get($euiButtonTypes, $color);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
background-color: $backgroundColor;
|
|
145
|
+
color: chooseLightOrDarkText($backgroundColor);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Keyframe animation declarations can be found in
|
|
149
|
+
// utility/animations.scss
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
@mixin euiFormControlLayoutPadding($numOfIcons, $side: 'right', $compressed: false) {
|
|
2
|
+
$iconSize: $euiSize;
|
|
3
|
+
$iconPadding: $euiFormControlPadding;
|
|
4
|
+
$marginBetweenIcons: $euiFormControlPadding / 2;
|
|
5
|
+
|
|
6
|
+
@if ($compressed) {
|
|
7
|
+
$iconPadding: $euiFormControlCompressedPadding;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@if variable-exists(numOfIcons) == false {
|
|
11
|
+
@error '$numOfIcons:integer (1-3) must be provided to @mixin euiFormControlLayoutPadding().';
|
|
12
|
+
} @else if $numOfIcons == 1 {
|
|
13
|
+
padding-#{$side}: $iconPadding + $iconSize + $iconPadding;
|
|
14
|
+
} @else if $numOfIcons == 2 {
|
|
15
|
+
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
|
|
16
|
+
} @else if $numOfIcons == 3 {
|
|
17
|
+
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@mixin euiPlaceholderPerBrowser {
|
|
22
|
+
// stylelint-disable selector-no-vendor-prefix
|
|
23
|
+
// Each prefix must be its own content block
|
|
24
|
+
&::-webkit-input-placeholder { @content; opacity: 1; }
|
|
25
|
+
&::-moz-placeholder { @content; opacity: 1; }
|
|
26
|
+
&:-ms-input-placeholder { @content; opacity: 1; }
|
|
27
|
+
&:-moz-placeholder { @content; opacity: 1; }
|
|
28
|
+
&::placeholder { @content; opacity: 1; }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@function euiFormControlGradient($color: $euiColorPrimary) {
|
|
32
|
+
@return linear-gradient(to top,
|
|
33
|
+
$color,
|
|
34
|
+
$color 2px,
|
|
35
|
+
transparent 2px,
|
|
36
|
+
transparent 100%
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@mixin euiFormControlText {
|
|
41
|
+
@include euiFont;
|
|
42
|
+
font-size: $euiFontSizeS;
|
|
43
|
+
color: $euiTextColor;
|
|
44
|
+
|
|
45
|
+
@include euiPlaceholderPerBrowser {
|
|
46
|
+
color: $euiFormControlPlaceholderText;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@mixin euiFormControlSize(
|
|
51
|
+
$height: $euiFormControlHeight,
|
|
52
|
+
$includeAlternates: false
|
|
53
|
+
) {
|
|
54
|
+
// Default
|
|
55
|
+
max-width: $euiFormMaxWidth;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: $height;
|
|
58
|
+
|
|
59
|
+
@if ($includeAlternates) {
|
|
60
|
+
&--fullWidth {
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&--compressed {
|
|
65
|
+
height: $euiFormControlCompressedHeight;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--inGroup {
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@mixin euiFormControlWithIcon($isIconOptional: false, $side: 'left', $compressed: false) {
|
|
75
|
+
@if ($isIconOptional) {
|
|
76
|
+
@at-root {
|
|
77
|
+
#{&}--withIcon {
|
|
78
|
+
@include euiFormControlLayoutPadding(1, $side, $compressed);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} @else {
|
|
82
|
+
@include euiFormControlLayoutPadding(1, $side, $compressed);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@mixin euiFormControlIsLoading($isNextToIcon: false) {
|
|
87
|
+
@at-root {
|
|
88
|
+
#{&}-isLoading {
|
|
89
|
+
@if ($isNextToIcon) {
|
|
90
|
+
@include euiFormControlLayoutPadding(2);
|
|
91
|
+
} @else {
|
|
92
|
+
@include euiFormControlLayoutPadding(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#{&}-isLoading#{&}--compressed {
|
|
97
|
+
@if ($isNextToIcon) {
|
|
98
|
+
@include euiFormControlLayoutPadding(2, $compressed: true);
|
|
99
|
+
} @else {
|
|
100
|
+
@include euiFormControlLayoutPadding(1, $compressed: true);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 1. Must supply both values to background-size or some browsers apply the single value to both directions
|
|
107
|
+
|
|
108
|
+
@mixin euiFormControlDefaultShadow($borderOnly: false) {
|
|
109
|
+
background-color: $euiFormBackgroundColor;
|
|
110
|
+
background-repeat: no-repeat;
|
|
111
|
+
background-size: 0% 100%; // 1
|
|
112
|
+
|
|
113
|
+
@if ($borderOnly) {
|
|
114
|
+
box-shadow: inset 0 0 0 1px $euiFormBorderColor;
|
|
115
|
+
} @else {
|
|
116
|
+
box-shadow:
|
|
117
|
+
#{$euiFormControlBoxShadow},
|
|
118
|
+
inset 0 0 0 1px $euiFormBorderColor;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
transition:
|
|
122
|
+
box-shadow $euiAnimSpeedFast ease-in,
|
|
123
|
+
background-image $euiAnimSpeedFast ease-in,
|
|
124
|
+
background-size $euiAnimSpeedFast ease-in,
|
|
125
|
+
background-color $euiAnimSpeedFast ease-in;
|
|
126
|
+
|
|
127
|
+
// Fixes bug in Firefox where adding a transition to the background-color
|
|
128
|
+
// caused a flash of differently styled dropdown.
|
|
129
|
+
@supports (-moz-appearance: none) {
|
|
130
|
+
// List *must* be in the same order as the above.
|
|
131
|
+
transition-property: box-shadow, background-image, background-size;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@mixin euiFormControlFocusStyle($borderOnly: false) {
|
|
136
|
+
background-color: tintOrShade($euiColorEmptyShade, 0%, 40%);
|
|
137
|
+
background-image: euiFormControlGradient();
|
|
138
|
+
background-size: 100% 100%; // 1
|
|
139
|
+
outline: none; // Blanket remove all outlines relying on our own bottom border
|
|
140
|
+
|
|
141
|
+
@if ($borderOnly) {
|
|
142
|
+
box-shadow: inset 0 0 0 1px $euiFormBorderColor;
|
|
143
|
+
} @else {
|
|
144
|
+
box-shadow: inset 0 0 0 1px $euiFormBorderColor;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@mixin euiFormControlInvalidStyle {
|
|
149
|
+
background-image: euiFormControlGradient($euiColorDanger);
|
|
150
|
+
background-size: 100%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@mixin euiFormControlDisabledTextStyle {
|
|
154
|
+
color: $euiFormControlDisabledColor;
|
|
155
|
+
-webkit-text-fill-color: $euiFormControlDisabledColor; // Required for Safari
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@mixin euiFormControlDisabledStyle {
|
|
159
|
+
@include euiFormControlDisabledTextStyle;
|
|
160
|
+
cursor: not-allowed;
|
|
161
|
+
background: $euiFormBackgroundDisabledColor;
|
|
162
|
+
box-shadow: inset 0 0 0 1px $euiFormBorderDisabledColor;
|
|
163
|
+
|
|
164
|
+
@include euiPlaceholderPerBrowser {
|
|
165
|
+
color: $euiFormControlDisabledColor;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@mixin euiFormControlReadOnlyStyle {
|
|
170
|
+
cursor: default;
|
|
171
|
+
color: $euiTextColor;
|
|
172
|
+
-webkit-text-fill-color: $euiTextColor; // Required for Safari
|
|
173
|
+
// Use transparency since there is no border and in case form is on a non-white background
|
|
174
|
+
background: $euiFormBackgroundReadOnlyColor;
|
|
175
|
+
border-color: transparent;
|
|
176
|
+
box-shadow: inset 0 0 0 1px $euiFormBorderDisabledColor;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 2. Override invalid state with focus state.
|
|
180
|
+
|
|
181
|
+
@mixin euiFormControlStyle($borderOnly: false, $includeStates: true, $includeSizes: true) {
|
|
182
|
+
@include euiFormControlSize($includeAlternates: $includeSizes);
|
|
183
|
+
@include euiFormControlDefaultShadow;
|
|
184
|
+
@include euiFormControlText;
|
|
185
|
+
|
|
186
|
+
border: none;
|
|
187
|
+
border-radius: $euiFormControlBorderRadius;
|
|
188
|
+
padding: $euiFormControlPadding;
|
|
189
|
+
|
|
190
|
+
@if ($includeStates) {
|
|
191
|
+
&:invalid { // 2
|
|
192
|
+
@include euiFormControlInvalidStyle;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&:focus { // 2
|
|
196
|
+
@include euiFormControlFocusStyle;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&:disabled {
|
|
200
|
+
@include euiFormControlDisabledStyle;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&[readOnly] {
|
|
204
|
+
@include euiFormControlReadOnlyStyle;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Needs to be set for autofill
|
|
208
|
+
&:-webkit-autofill {
|
|
209
|
+
-webkit-text-fill-color: lightOrDarkTheme($euiColorDarkestShade, $euiColorLightShade);
|
|
210
|
+
|
|
211
|
+
~ .euiFormControlLayoutIcons {
|
|
212
|
+
color: lightOrDarkTheme($euiColorDarkestShade, $euiColorLightShade);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@if ($includeSizes) {
|
|
218
|
+
&--compressed {
|
|
219
|
+
@include euiFormControlStyleCompressed($borderOnly, $includeStates);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&--inGroup {
|
|
223
|
+
// stylelint-disable-next-line declaration-no-important
|
|
224
|
+
box-shadow: none !important;
|
|
225
|
+
border-radius: 0;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@mixin euiFormControlStyleCompressed($borderOnly: false, $includeStates: true) {
|
|
231
|
+
@include euiFormControlDefaultShadow($borderOnly: true);
|
|
232
|
+
padding: $euiFormControlCompressedPadding;
|
|
233
|
+
border-radius: $euiFormControlCompressedBorderRadius;
|
|
234
|
+
|
|
235
|
+
@if ($includeStates) {
|
|
236
|
+
&:invalid { // 2
|
|
237
|
+
@include euiFormControlInvalidStyle;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:focus { // 2
|
|
241
|
+
@include euiFormControlFocusStyle($borderOnly: true);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&:disabled {
|
|
245
|
+
@include euiFormControlDisabledStyle;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&[readOnly] {
|
|
249
|
+
@include euiFormControlReadOnlyStyle;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@mixin euiHiddenSelectableInput {
|
|
255
|
+
position: absolute;
|
|
256
|
+
// stylelint-disable-next-line declaration-no-important
|
|
257
|
+
opacity: 0 !important; // Make sure it's still hidden when :disabled
|
|
258
|
+
width: 100%;
|
|
259
|
+
height: 100%;
|
|
260
|
+
cursor: pointer;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Adjusts form controls border radius
|
|
264
|
+
@mixin euiFormControlSideBorderRadius($borderRadius, $side, $internal: false) {
|
|
265
|
+
@if $internal == true {
|
|
266
|
+
$borderRadius: $borderRadius - 1;
|
|
267
|
+
}
|
|
268
|
+
@if $side == 'left' {
|
|
269
|
+
border-radius: $borderRadius 0 0 $borderRadius;
|
|
270
|
+
} @else if $side == 'right' {
|
|
271
|
+
border-radius: 0 $borderRadius $borderRadius 0;
|
|
272
|
+
}
|
|
273
|
+
}
|