@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.
Files changed (196) hide show
  1. package/LICENSE.txt +6 -0
  2. package/README.md +11 -0
  3. package/lib/cjs/.tsbuildinfo +1 -0
  4. package/lib/cjs/global_styling/functions/index.d.ts +2 -0
  5. package/lib/cjs/global_styling/functions/index.d.ts.map +1 -0
  6. package/lib/cjs/global_styling/functions/index.js +22 -0
  7. package/lib/cjs/global_styling/functions/index.js.map +1 -0
  8. package/lib/cjs/global_styling/functions/size.d.ts +13 -0
  9. package/lib/cjs/global_styling/functions/size.d.ts.map +1 -0
  10. package/lib/cjs/global_styling/functions/size.js +42 -0
  11. package/lib/cjs/global_styling/functions/size.js.map +1 -0
  12. package/lib/cjs/global_styling/index.d.ts +4 -0
  13. package/lib/cjs/global_styling/index.d.ts.map +1 -0
  14. package/lib/cjs/global_styling/index.js +44 -0
  15. package/lib/cjs/global_styling/index.js.map +1 -0
  16. package/lib/cjs/global_styling/types.d.ts +66 -0
  17. package/lib/cjs/global_styling/types.d.ts.map +1 -0
  18. package/lib/cjs/global_styling/types.js +21 -0
  19. package/lib/cjs/global_styling/types.js.map +1 -0
  20. package/lib/cjs/global_styling/variables/_colors_vis.d.ts +13 -0
  21. package/lib/cjs/global_styling/variables/_colors_vis.d.ts.map +1 -0
  22. package/lib/cjs/global_styling/variables/_colors_vis.js +69 -0
  23. package/lib/cjs/global_styling/variables/_colors_vis.js.map +1 -0
  24. package/lib/cjs/global_styling/variables/animations.d.ts +36 -0
  25. package/lib/cjs/global_styling/variables/animations.d.ts.map +1 -0
  26. package/lib/cjs/global_styling/variables/animations.js +38 -0
  27. package/lib/cjs/global_styling/variables/animations.js.map +1 -0
  28. package/lib/cjs/global_styling/variables/borders.d.ts +61 -0
  29. package/lib/cjs/global_styling/variables/borders.d.ts.map +1 -0
  30. package/lib/cjs/global_styling/variables/borders.js +7 -0
  31. package/lib/cjs/global_styling/variables/borders.js.map +1 -0
  32. package/lib/cjs/global_styling/variables/breakpoint.d.ts +15 -0
  33. package/lib/cjs/global_styling/variables/breakpoint.d.ts.map +1 -0
  34. package/lib/cjs/global_styling/variables/breakpoint.js +23 -0
  35. package/lib/cjs/global_styling/variables/breakpoint.js.map +1 -0
  36. package/lib/cjs/global_styling/variables/buttons.d.ts +44 -0
  37. package/lib/cjs/global_styling/variables/buttons.d.ts.map +1 -0
  38. package/lib/cjs/global_styling/variables/buttons.js +7 -0
  39. package/lib/cjs/global_styling/variables/buttons.js.map +1 -0
  40. package/lib/cjs/global_styling/variables/colors.d.ts +245 -0
  41. package/lib/cjs/global_styling/variables/colors.d.ts.map +1 -0
  42. package/lib/cjs/global_styling/variables/colors.js +7 -0
  43. package/lib/cjs/global_styling/variables/colors.js.map +1 -0
  44. package/lib/cjs/global_styling/variables/components.d.ts +69 -0
  45. package/lib/cjs/global_styling/variables/components.d.ts.map +1 -0
  46. package/lib/cjs/global_styling/variables/components.js +7 -0
  47. package/lib/cjs/global_styling/variables/components.js.map +1 -0
  48. package/lib/cjs/global_styling/variables/forms.d.ts +20 -0
  49. package/lib/cjs/global_styling/variables/forms.d.ts.map +1 -0
  50. package/lib/cjs/global_styling/variables/forms.js +7 -0
  51. package/lib/cjs/global_styling/variables/forms.js.map +1 -0
  52. package/lib/cjs/global_styling/variables/index.d.ts +14 -0
  53. package/lib/cjs/global_styling/variables/index.d.ts.map +1 -0
  54. package/lib/cjs/global_styling/variables/index.js +154 -0
  55. package/lib/cjs/global_styling/variables/index.js.map +1 -0
  56. package/lib/cjs/global_styling/variables/levels.d.ts +39 -0
  57. package/lib/cjs/global_styling/variables/levels.d.ts.map +1 -0
  58. package/lib/cjs/global_styling/variables/levels.js +33 -0
  59. package/lib/cjs/global_styling/variables/levels.js.map +1 -0
  60. package/lib/cjs/global_styling/variables/shadow.d.ts +11 -0
  61. package/lib/cjs/global_styling/variables/shadow.d.ts.map +1 -0
  62. package/lib/cjs/global_styling/variables/shadow.js +27 -0
  63. package/lib/cjs/global_styling/variables/shadow.js.map +1 -0
  64. package/lib/cjs/global_styling/variables/size.d.ts +26 -0
  65. package/lib/cjs/global_styling/variables/size.d.ts.map +1 -0
  66. package/lib/cjs/global_styling/variables/size.js +17 -0
  67. package/lib/cjs/global_styling/variables/size.js.map +1 -0
  68. package/lib/cjs/global_styling/variables/states.d.ts +25 -0
  69. package/lib/cjs/global_styling/variables/states.d.ts.map +1 -0
  70. package/lib/cjs/global_styling/variables/states.js +7 -0
  71. package/lib/cjs/global_styling/variables/states.js.map +1 -0
  72. package/lib/cjs/global_styling/variables/typography.d.ts +93 -0
  73. package/lib/cjs/global_styling/variables/typography.d.ts.map +1 -0
  74. package/lib/cjs/global_styling/variables/typography.js +48 -0
  75. package/lib/cjs/global_styling/variables/typography.js.map +1 -0
  76. package/lib/cjs/index.d.ts +4 -0
  77. package/lib/cjs/index.d.ts.map +1 -0
  78. package/lib/cjs/index.js +44 -0
  79. package/lib/cjs/index.js.map +1 -0
  80. package/lib/cjs/types.d.ts +33 -0
  81. package/lib/cjs/types.d.ts.map +1 -0
  82. package/lib/cjs/types.js +7 -0
  83. package/lib/cjs/types.js.map +1 -0
  84. package/lib/cjs/utils.d.ts +104 -0
  85. package/lib/cjs/utils.d.ts.map +1 -0
  86. package/lib/cjs/utils.js +382 -0
  87. package/lib/cjs/utils.js.map +1 -0
  88. package/lib/cjs/utils.test.js +411 -0
  89. package/lib/cjs/utils.test.js.map +1 -0
  90. package/lib/esm/.tsbuildinfo +1 -0
  91. package/lib/esm/global_styling/functions/index.d.ts +1 -0
  92. package/lib/esm/global_styling/functions/index.js +9 -0
  93. package/lib/esm/global_styling/functions/index.js.map +1 -0
  94. package/lib/esm/global_styling/functions/size.d.ts +12 -0
  95. package/lib/esm/global_styling/functions/size.js +21 -0
  96. package/lib/esm/global_styling/functions/size.js.map +1 -0
  97. package/lib/esm/global_styling/index.d.ts +3 -0
  98. package/lib/esm/global_styling/index.js +11 -0
  99. package/lib/esm/global_styling/index.js.map +1 -0
  100. package/lib/esm/global_styling/types.d.ts +65 -0
  101. package/lib/esm/global_styling/types.js +13 -0
  102. package/lib/esm/global_styling/types.js.map +1 -0
  103. package/lib/esm/global_styling/variables/_colors_vis.d.ts +12 -0
  104. package/lib/esm/global_styling/variables/_colors_vis.js +60 -0
  105. package/lib/esm/global_styling/variables/_colors_vis.js.map +1 -0
  106. package/lib/esm/global_styling/variables/animations.d.ts +35 -0
  107. package/lib/esm/global_styling/variables/animations.js +25 -0
  108. package/lib/esm/global_styling/variables/animations.js.map +1 -0
  109. package/lib/esm/global_styling/variables/borders.d.ts +60 -0
  110. package/lib/esm/global_styling/variables/borders.js +9 -0
  111. package/lib/esm/global_styling/variables/borders.js.map +1 -0
  112. package/lib/esm/global_styling/variables/breakpoint.d.ts +14 -0
  113. package/lib/esm/global_styling/variables/breakpoint.js +9 -0
  114. package/lib/esm/global_styling/variables/breakpoint.js.map +1 -0
  115. package/lib/esm/global_styling/variables/buttons.d.ts +43 -0
  116. package/lib/esm/global_styling/variables/buttons.js +9 -0
  117. package/lib/esm/global_styling/variables/buttons.js.map +1 -0
  118. package/lib/esm/global_styling/variables/colors.d.ts +244 -0
  119. package/lib/esm/global_styling/variables/colors.js +9 -0
  120. package/lib/esm/global_styling/variables/colors.js.map +1 -0
  121. package/lib/esm/global_styling/variables/components.d.ts +68 -0
  122. package/lib/esm/global_styling/variables/components.js +9 -0
  123. package/lib/esm/global_styling/variables/components.js.map +1 -0
  124. package/lib/esm/global_styling/variables/forms.d.ts +19 -0
  125. package/lib/esm/global_styling/variables/forms.js +9 -0
  126. package/lib/esm/global_styling/variables/forms.js.map +1 -0
  127. package/lib/esm/global_styling/variables/index.d.ts +13 -0
  128. package/lib/esm/global_styling/variables/index.js +21 -0
  129. package/lib/esm/global_styling/variables/index.js.map +1 -0
  130. package/lib/esm/global_styling/variables/levels.d.ts +38 -0
  131. package/lib/esm/global_styling/variables/levels.js +34 -0
  132. package/lib/esm/global_styling/variables/levels.js.map +1 -0
  133. package/lib/esm/global_styling/variables/shadow.d.ts +10 -0
  134. package/lib/esm/global_styling/variables/shadow.js +19 -0
  135. package/lib/esm/global_styling/variables/shadow.js.map +1 -0
  136. package/lib/esm/global_styling/variables/size.d.ts +25 -0
  137. package/lib/esm/global_styling/variables/size.js +20 -0
  138. package/lib/esm/global_styling/variables/size.js.map +1 -0
  139. package/lib/esm/global_styling/variables/states.d.ts +24 -0
  140. package/lib/esm/global_styling/variables/states.js +9 -0
  141. package/lib/esm/global_styling/variables/states.js.map +1 -0
  142. package/lib/esm/global_styling/variables/typography.d.ts +92 -0
  143. package/lib/esm/global_styling/variables/typography.js +35 -0
  144. package/lib/esm/global_styling/variables/typography.js.map +1 -0
  145. package/lib/esm/index.d.ts +3 -0
  146. package/lib/esm/index.js +11 -0
  147. package/lib/esm/index.js.map +1 -0
  148. package/lib/esm/types.d.ts +32 -0
  149. package/lib/esm/types.js +9 -0
  150. package/lib/esm/types.js.map +1 -0
  151. package/lib/esm/utils.d.ts +103 -0
  152. package/lib/esm/utils.js +300 -0
  153. package/lib/esm/utils.js.map +1 -0
  154. package/lib/esm/utils.test.d.ts +1 -0
  155. package/lib/esm/utils.test.js +233 -0
  156. package/lib/esm/utils.test.js.map +1 -0
  157. package/licenses/ELASTIC-LICENSE-2.0.md +93 -0
  158. package/licenses/SSPL-LICENSE.md +557 -0
  159. package/package.json +78 -0
  160. package/src/global_styling/functions/_colors.scss +138 -0
  161. package/src/global_styling/functions/_index.scss +5 -0
  162. package/src/global_styling/functions/_math.scss +1 -0
  163. package/src/global_styling/functions/_math_pow.scss +82 -0
  164. package/src/global_styling/index.scss +18 -0
  165. package/src/global_styling/mixins/_button.scss +149 -0
  166. package/src/global_styling/mixins/_form.scss +273 -0
  167. package/src/global_styling/mixins/_helpers.scss +126 -0
  168. package/src/global_styling/mixins/_index.scss +14 -0
  169. package/src/global_styling/mixins/_link.scss +11 -0
  170. package/src/global_styling/mixins/_loading.scss +6 -0
  171. package/src/global_styling/mixins/_panel.scss +55 -0
  172. package/src/global_styling/mixins/_range.scss +62 -0
  173. package/src/global_styling/mixins/_responsive.scss +44 -0
  174. package/src/global_styling/mixins/_shadow.scss +108 -0
  175. package/src/global_styling/mixins/_size.scss +4 -0
  176. package/src/global_styling/mixins/_states.scss +50 -0
  177. package/src/global_styling/mixins/_tool_tip.scss +25 -0
  178. package/src/global_styling/mixins/_typography.scss +167 -0
  179. package/src/global_styling/react_date_picker/_date_picker.scss +772 -0
  180. package/src/global_styling/react_date_picker/_index.scss +2 -0
  181. package/src/global_styling/react_date_picker/_variables.scss +1 -0
  182. package/src/global_styling/utility/_animations.scss +55 -0
  183. package/src/global_styling/utility/_index.scss +1 -0
  184. package/src/global_styling/variables/_animations.scss +13 -0
  185. package/src/global_styling/variables/_borders.scss +11 -0
  186. package/src/global_styling/variables/_buttons.scss +18 -0
  187. package/src/global_styling/variables/_colors_vis.scss +72 -0
  188. package/src/global_styling/variables/_font_weight.scss +10 -0
  189. package/src/global_styling/variables/_form.scss +8 -0
  190. package/src/global_styling/variables/_index.scss +23 -0
  191. package/src/global_styling/variables/_responsive.scss +9 -0
  192. package/src/global_styling/variables/_shadows.scss +2 -0
  193. package/src/global_styling/variables/_size.scss +15 -0
  194. package/src/global_styling/variables/_states.scss +14 -0
  195. package/src/global_styling/variables/_typography.scss +75 -0
  196. package/src/global_styling/variables/_z_index.scss +34 -0
@@ -0,0 +1,126 @@
1
+ // Helper mixins
2
+
3
+ // Set scroll bar appearance on Chrome (and firefox).
4
+ @mixin euiScrollBar($thumbColor: $euiColorDarkShade, $trackBackgroundColor: transparent, $size: 'thin') {
5
+ // Firefox's scrollbar coloring cascades, but the sizing does not,
6
+ // so it's being added to this mixin for allowing support wherever custom scrollbars are
7
+ scrollbar-color: transparentize($thumbColor, .5) $trackBackgroundColor; // Firefox support
8
+
9
+ @if ($size == 'thin') {
10
+ scrollbar-width: thin;
11
+ }
12
+
13
+ // stylelint-disable selector-no-vendor-prefix
14
+ &::-webkit-scrollbar {
15
+ width: $euiScrollBar;
16
+ height: $euiScrollBar;
17
+ }
18
+
19
+ &::-webkit-scrollbar-thumb {
20
+ background-color: transparentize($thumbColor, .5);
21
+ background-clip: content-box;
22
+ border-radius: $euiScrollBar;
23
+
24
+ @if ($size == 'thin') {
25
+ border: $euiScrollBarCornerThin solid $trackBackgroundColor;
26
+ } @else {
27
+ border: $euiScrollBarCorner solid $trackBackgroundColor;
28
+ }
29
+ }
30
+
31
+ &::-webkit-scrollbar-corner,
32
+ &::-webkit-scrollbar-track {
33
+ background-color: $trackBackgroundColor;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * 1. Focus rings shouldn't be visible on scrollable regions, but a11y requires them to be focusable.
39
+ * Browser's supporting `:focus-visible` will still show outline on keyboard focus only.
40
+ * Others like Safari, won't show anything at all.
41
+ * 2. Force the `:focus-visible` when the `tabindex=0` (is tabbable)
42
+ */
43
+
44
+ // Just overflow and scrollbars
45
+ @mixin euiYScroll {
46
+ @include euiScrollBar;
47
+ height: 100%;
48
+ overflow-y: auto;
49
+ overflow-x: hidden;
50
+
51
+ &:focus {
52
+ outline: none; /* 1 */
53
+ }
54
+
55
+ &[tabindex='0']:focus:focus-visible {
56
+ outline-style: auto; /* 2 */
57
+ }
58
+ }
59
+
60
+ @mixin euiXScroll {
61
+ @include euiScrollBar;
62
+ overflow-x: auto;
63
+
64
+ &:focus {
65
+ outline: none; /* 1 */
66
+ }
67
+
68
+ &[tabindex='0']:focus:focus-visible {
69
+ outline-style: auto; /* 2 */
70
+ }
71
+ }
72
+
73
+ // The full overflow with shadow
74
+ @mixin euiYScrollWithShadows {
75
+ @include euiYScroll;
76
+ @include euiOverflowShadow('y');
77
+ }
78
+
79
+ @mixin euiXScrollWithShadows {
80
+ @include euiXScroll;
81
+ @include euiOverflowShadow('x');
82
+ }
83
+
84
+ /**
85
+ * For quickly applying a full-height element whether using flex or not
86
+ */
87
+ @mixin euiFullHeight {
88
+ height: 100%;
89
+ flex: 1 1 auto;
90
+ overflow: hidden;
91
+ }
92
+
93
+ // Hiding elements offscreen to only be read by screen reader
94
+ // See https://github.com/elastic/eui/pull/5130 and https://github.com/elastic/eui/pull/5152 for more info
95
+ @mixin euiScreenReaderOnly {
96
+ // Take the element out of the layout
97
+ position: absolute;
98
+ // Keep it vertically inline
99
+ top: auto;
100
+ // Chrome requires a left value, and Selenium (used by Kibana's FTR) requires an off-screen position for its .getVisibleText() to not register SR-only text
101
+ left: -10000px;
102
+ // The element must have a size (for some screen readers)
103
+ width: 1px;
104
+ height: 1px;
105
+ // But reduce the visible size to nothing
106
+ clip: rect(0 0 0 0);
107
+ clip-path: inset(50%);
108
+ // And ensure no overflows occur
109
+ overflow: hidden;
110
+ // Chrome requires the negative margin to not cause overflows of parent containers
111
+ margin: -1px;
112
+ }
113
+
114
+ // Doesn't have reduced motion turned on
115
+ @mixin euiCanAnimate {
116
+ @media screen and (prefers-reduced-motion: no-preference) {
117
+ @content;
118
+ }
119
+ }
120
+
121
+ // Does have reduced motion turned on
122
+ @mixin euiCantAnimate {
123
+ @media screen and (prefers-reduced-motion: reduce) {
124
+ @content;
125
+ }
126
+ }
@@ -0,0 +1,14 @@
1
+ @import 'responsive';
2
+ @import 'shadow';
3
+ @import 'size';
4
+ @import 'typography';
5
+ @import 'helpers';
6
+ @import 'states';
7
+
8
+ @import 'button';
9
+ @import 'form';
10
+ @import 'loading';
11
+ @import 'link';
12
+ @import 'panel';
13
+ @import 'range';
14
+ @import 'tool_tip';
@@ -0,0 +1,11 @@
1
+ @mixin euiLink {
2
+ text-align: left;
3
+
4
+ &:hover {
5
+ text-decoration: underline;
6
+ }
7
+
8
+ &:focus {
9
+ text-decoration: underline;
10
+ }
11
+ }
@@ -0,0 +1,6 @@
1
+ @function euiLoadingSpinnerBorderColors(
2
+ $main: $euiColorLightShade,
3
+ $highlight: $euiColorPrimary
4
+ ) {
5
+ @return $highlight $main $main $main;
6
+ }
@@ -0,0 +1,55 @@
1
+ @mixin euiPanel($selector) {
2
+ @if variable-exists(selector) == false {
3
+ @error 'A $selector must be provided to @mixin euiPanel().';
4
+ } @else {
5
+ #{$selector} {
6
+ flex-grow: 1;
7
+
8
+ &#{$selector}--flexGrowZero {
9
+ flex-grow: 0;
10
+ }
11
+
12
+ &#{$selector}--hasShadow {
13
+ @include euiBottomShadowMedium;
14
+ }
15
+
16
+ &#{$selector}--hasBorder {
17
+ border: $euiBorderThin;
18
+ box-shadow: none;
19
+ }
20
+
21
+ &#{$selector}--isClickable {
22
+ // transition the shadow
23
+ transition: all $euiAnimSpeedFast $euiAnimSlightResistance;
24
+
25
+ &:enabled { // This is a good selector for buttons since it doesn't exist on divs
26
+ // in case of button wrapper which inherently is inline-block and no width
27
+ display: block;
28
+ width: 100%;
29
+ text-align: left;
30
+ }
31
+
32
+ &:hover,
33
+ &:focus {
34
+ @include euiBottomShadow;
35
+ transform: translateY(-2px);
36
+ cursor: pointer;
37
+ }
38
+ }
39
+
40
+ // Border Radii
41
+ @each $modifier, $amount in $euiPanelBorderRadiusModifiers {
42
+ &#{$selector}--#{$modifier} {
43
+ border-radius: $amount;
44
+ }
45
+ }
46
+
47
+ // Background colors
48
+ @each $modifier, $amount in $euiPanelBackgroundColorModifiers {
49
+ &#{$selector}--#{$modifier} {
50
+ background-color: $amount;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,62 @@
1
+ /*
2
+ The CSS in JS version of this file lives in:
3
+ - src/components/form/range/range.styles.ts
4
+
5
+ The following files still use the Sass version:
6
+ - src/themes/amsterdam/overrides/_color_stops.scss
7
+ - src/themes/amsterdam/overrides/_hue.scss
8
+ */
9
+
10
+ @mixin euiRangeTrackSize($compressed: false) {
11
+ height: $euiRangeTrackHeight;
12
+ width: $euiRangeTrackWidth;
13
+
14
+ @if ($compressed) {
15
+ height: $euiRangeTrackCompressedHeight;
16
+ }
17
+ }
18
+
19
+ @mixin euiRangeTrackPerBrowser {
20
+ &::-webkit-slider-runnable-track { @content; }
21
+ &::-moz-range-track { @content; }
22
+ &::-ms-fill-lower { @content; }
23
+ &::-ms-fill-upper { @content; }
24
+ }
25
+
26
+ @mixin euiRangeThumbBorder {
27
+ border: 2px solid $euiRangeThumbBorderColor;
28
+ }
29
+
30
+ @mixin euiRangeThumbBoxShadow {
31
+ box-shadow:
32
+ 0 0 0 1px $euiRangeThumbBorderColor,
33
+ 0 2px 2px -1px rgba($euiShadowColor, .2),
34
+ 0 1px 5px -2px rgba($euiShadowColor, .2);
35
+ }
36
+
37
+ @mixin euiRangeThumbFocusBoxShadow {
38
+ box-shadow: 0 0 0 2px $euiFocusRingColor;
39
+ }
40
+
41
+ @mixin euiRangeThumbStyle {
42
+ @include euiRangeThumbBoxShadow;
43
+ @include euiRangeThumbBorder;
44
+ cursor: pointer;
45
+ background-color: $euiRangeThumbBackgroundColor;
46
+ padding: 0;
47
+ height: $euiRangeThumbHeight;
48
+ width: $euiRangeThumbWidth;
49
+ box-sizing: border-box; // required for firefox or the border makes the width and height to increase
50
+ }
51
+
52
+ @mixin euiRangeThumbPerBrowser {
53
+ &::-webkit-slider-thumb { @content; }
54
+ &::-moz-range-thumb { @content; }
55
+ &::-ms-thumb { @content; }
56
+ }
57
+
58
+ @mixin euiRangeThumbFocus {
59
+ @include euiRangeThumbBorder;
60
+ @include euiRangeThumbFocusBoxShadow;
61
+ background-color: $euiColorPrimary;
62
+ }
@@ -0,0 +1,44 @@
1
+ // A sem-complicated mixin for breakpoints, that takes any number of
2
+ // named breakpoints that exists in $euiBreakpoints.
3
+
4
+ @mixin euiBreakpoint($sizes...) {
5
+ // Loop through each size parameter
6
+ @each $size in $sizes {
7
+ // Store the location of the size in the list to check against
8
+ $index: index($euiBreakpointKeys, $size);
9
+
10
+ // Check to make sure it exists in the allowed breakpoint names
11
+ @if ( $index ) {
12
+
13
+ // Set the min size to the value of the size
14
+ $minSize: map-get($euiBreakpoints, $size);
15
+
16
+ // If it is the last item, don't give it a max-width
17
+ @if ( $index == length($euiBreakpointKeys) ) {
18
+ @media only screen and (min-width: $minSize) {
19
+ @content;
20
+ }
21
+ // If it's not the last item, add a max-width
22
+ } @else {
23
+
24
+ // Set the max size to the value of the next size (-1px as to not overlap)
25
+ $maxSize: map-get($euiBreakpoints, nth($euiBreakpointKeys, $index + 1)) - 1px;
26
+
27
+ // If it's the the first item, don't set a min-width
28
+ @if ( $index == 1 ) {
29
+ @media only screen and (max-width: $maxSize) {
30
+ @content;
31
+ }
32
+ // Otherwise it should have a min and max width
33
+ } @else {
34
+ @media only screen and (min-width: $minSize) and (max-width: $maxSize) {
35
+ @content;
36
+ }
37
+ }
38
+ }
39
+ // If it's not a known breakpoint, throw a warning
40
+ } @else {
41
+ @warn "euiBreakpoint(): '#{$size}' is not a valid size in $euiBreakpoints. Accepted values are '#{$euiBreakpointKeys}'";
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,108 @@
1
+ @function shadowOpacity($opacity) {
2
+ @if (lightness($euiTextColor) < 50) {
3
+ @return $opacity * 1;
4
+ } @else {
5
+ @return $opacity * 2.5;
6
+ }
7
+ }
8
+
9
+ @mixin euiSlightShadow($color: $euiShadowColor) {
10
+ box-shadow:
11
+ 0 .8px .8px rgba($color, shadowOpacity(.04)),
12
+ 0 2.3px 2px rgba($color, shadowOpacity(.03));
13
+ }
14
+
15
+ @mixin euiBottomShadowSmall($color: $euiShadowColor) {
16
+ box-shadow:
17
+ 0 .7px 1.4px rgba($color, shadowOpacity(.07)),
18
+ 0 1.9px 4px rgba($color, shadowOpacity(.05)),
19
+ 0 4.5px 10px rgba($color, shadowOpacity(.05));
20
+ }
21
+
22
+ @mixin euiBottomShadowMedium($color: $euiShadowColor) {
23
+ box-shadow:
24
+ 0 .9px 4px -1px rgba($color, shadowOpacity(.08)),
25
+ 0 2.6px 8px -1px rgba($color, shadowOpacity(.06)),
26
+ 0 5.7px 12px -1px rgba($color, shadowOpacity(.05)),
27
+ 0 15px 15px -1px rgba($color, shadowOpacity(.04));
28
+ }
29
+
30
+ // Similar to shadow medium but without the bottom depth. Useful for popovers
31
+ // that drop UP rather than DOWN.
32
+ @mixin euiBottomShadowFlat($color: $euiShadowColor) {
33
+ box-shadow:
34
+ 0 0 .8px rgba($color, shadowOpacity(.06)),
35
+ 0 0 2px rgba($color, shadowOpacity(.04)),
36
+ 0 0 5px rgba($color, shadowOpacity(.04)),
37
+ 0 0 17px rgba($color, shadowOpacity(.03));
38
+ }
39
+
40
+ @mixin euiBottomShadow($color: $euiShadowColor) {
41
+ box-shadow:
42
+ 0 1px 5px rgba($color, shadowOpacity(.1)),
43
+ 0 3.6px 13px rgba($color, shadowOpacity(.07)),
44
+ 0 8.4px 23px rgba($color, shadowOpacity(.06)),
45
+ 0 23px 35px rgba($color, shadowOpacity(.05));
46
+ }
47
+
48
+ @mixin euiBottomShadowLarge(
49
+ $color: $euiShadowColor,
50
+ $opacity: 0,
51
+ $reverse: false
52
+ ) {
53
+ @if ($reverse) {
54
+ box-shadow:
55
+ 0 -2.7px 9px rgba($color, shadowOpacity(.13)),
56
+ 0 -9.4px 24px rgba($color, shadowOpacity(.09)),
57
+ 0 -21.8px 43px rgba($color, shadowOpacity(.08));
58
+ } @else {
59
+ box-shadow:
60
+ 0 2.7px 9px rgba($color, shadowOpacity(.13)),
61
+ 0 9.4px 24px rgba($color, shadowOpacity(.09)),
62
+ 0 21.8px 43px rgba($color, shadowOpacity(.08));
63
+ }
64
+ }
65
+
66
+ @mixin euiSlightShadowHover($color: $euiShadowColor) {
67
+ box-shadow:
68
+ 0 1px 5px rgba($color, shadowOpacity(.1)),
69
+ 0 3.6px 13px rgba($color, shadowOpacity(.07)),
70
+ 0 8.4px 23px rgba($color, shadowOpacity(.06)),
71
+ 0 23px 35px rgba($color, shadowOpacity(.05));
72
+ }
73
+
74
+ // stylelint-disable color-named
75
+ @mixin euiOverflowShadow($direction: 'y', $side: 'both') {
76
+ $hideHeight: $euiScrollBarCornerThin * 1.25;
77
+ $gradient: null;
78
+ $gradientStart:
79
+ transparentize(red, .9) 0%,
80
+ transparentize(red, 0) $hideHeight;
81
+ $gradientEnd:
82
+ transparentize(red, 0) calc(100% - #{$hideHeight}),
83
+ transparentize(red, .9) 100%;
84
+ @if ($side == 'both' or $side == 'start' or $side == 'end') {
85
+ @if ($side == 'both') {
86
+ $gradient: $gradientStart, $gradientEnd;
87
+ } @else if ($side == 'start') {
88
+ $gradient: $gradientStart;
89
+ } @else {
90
+ $gradient: $gradientEnd;
91
+ }
92
+ } @else {
93
+ @warn "euiOverflowShadow() expects side to be 'both', 'start' or 'end' but got '#{$side}'";
94
+ }
95
+
96
+ @if ($direction == 'y') {
97
+ mask-image: linear-gradient(to bottom, #{$gradient});
98
+ } @else if ($direction == 'x') {
99
+ mask-image: linear-gradient(to right, #{$gradient});
100
+ } @else {
101
+ @warn "euiOverflowShadow() expects direction to be 'y' or 'x' but got '#{$direction}'";
102
+ }
103
+
104
+ // Chrome+Edge has a very bizarre edge case bug where `mask-image` stops working
105
+ // This workaround forces a stacking context on the scrolling container, which
106
+ // hopefully addresses the bug. @see https://github.com/elastic/eui/pull/7855
107
+ transform: translateZ(0);
108
+ }
@@ -0,0 +1,4 @@
1
+ @mixin size($size) {
2
+ width: $size;
3
+ height: $size;
4
+ }
@@ -0,0 +1,50 @@
1
+ @mixin euiFocusRing($size: 'small', $amsterdamOnlyProp: null) {
2
+ @if $size == 'large' {
3
+ // It's always OK to use the focus animation. This will take precedence over times we turn it off individually like EuiButtonEmpty
4
+ // stylelint-disable-next-line declaration-no-important
5
+ animation: $euiAnimSpeedSlow $euiAnimSlightResistance 1 normal forwards focusRingAnimateLarge !important;
6
+ } @else {
7
+ // stylelint-disable-next-line declaration-no-important
8
+ animation: $euiAnimSpeedSlow $euiAnimSlightResistance 1 normal forwards focusRingAnimate !important;
9
+ }
10
+ }
11
+
12
+ // Keyframe animation declarations can be found in
13
+ // utility/animations.scss
14
+
15
+ @mixin euiFocusBackground($color: $euiColorPrimary) {
16
+ background-color: tintOrShade($euiColorPrimary, ((1 - $euiFocusTransparency) * 100%), ((1 - $euiFocusTransparency) * 100%));
17
+ }
18
+
19
+ @mixin euiHoverState {
20
+ cursor: pointer;
21
+ text-decoration: underline;
22
+ }
23
+
24
+ @mixin euiFocusState($color: $euiColorPrimary) {
25
+ @include euiHoverState;
26
+ @include euiFocusBackground($color);
27
+ }
28
+
29
+ @mixin euiDisabledState($color: $euiButtonColorDisabledText) {
30
+ cursor: not-allowed;
31
+ text-decoration: none;
32
+
33
+ @if ($color) {
34
+ color: $color;
35
+ }
36
+ }
37
+
38
+ @mixin euiInteractiveStates($focusColor: $euiColorPrimary, $disabledColor: $euiButtonColorDisabledText) {
39
+ &:hover {
40
+ @include euiHoverState;
41
+ }
42
+
43
+ &:focus {
44
+ @include euiFocusState($focusColor);
45
+ }
46
+
47
+ &:disabled {
48
+ @include euiDisabledState($disabledColor);
49
+ }
50
+ }
@@ -0,0 +1,25 @@
1
+ @mixin euiToolTipStyle($size: null) {
2
+ @include euiBottomShadow($color: $euiColorInk);
3
+
4
+ $euiTooltipBackgroundColor: tintOrShade($euiColorFullShade, 25%, 100%) !default;
5
+ $euiTooltipBorderColor: tintOrShade($euiColorFullShade, 35%, 80%) !default;
6
+
7
+ border-radius: $euiBorderRadius;
8
+ background-color: $euiTooltipBackgroundColor;
9
+ color: $euiColorGhost;
10
+ z-index: $euiZLevel9;
11
+ max-width: 256px;
12
+ overflow-wrap: break-word;
13
+ padding: $euiSizeS;
14
+
15
+ .euiHorizontalRule {
16
+ background-color: $euiTooltipBorderColor;
17
+ }
18
+ }
19
+
20
+ @mixin euiToolTipTitle {
21
+ font-weight: $euiFontWeightBold;
22
+ border-bottom: solid $euiBorderWidthThin $euiTooltipBorderColor;
23
+ padding-bottom: $euiSizeXS;
24
+ margin-bottom: $euiSizeXS;
25
+ }
@@ -0,0 +1,167 @@
1
+ // stylelint-disable property-no-vendor-prefix
2
+ // stylelint-disable declaration-no-important
3
+
4
+ @function fontSizeToRemOrEm($size, $sizingMethod: 'rem') {
5
+ @if ($sizingMethod == 'rem') {
6
+ @return #{$size / $euiFontSize}rem;
7
+ } @else if ($sizingMethod == 'em') {
8
+ @return #{$size / $euiFontSize}em;
9
+ }
10
+ }
11
+
12
+ // It can also be applied to calculate paddings
13
+ @function marginToRemOrEm($elementSize, $elementFontSize, $sizingMethod: 'rem') {
14
+ @if ($sizingMethod == 'rem') {
15
+ @return #{$elementSize / $euiFontSize}rem;
16
+ } @else if ($sizingMethod == 'em') {
17
+ @return #{$elementSize / $elementFontSize}em;
18
+ }
19
+ }
20
+
21
+ // Spit out rem and px
22
+ @mixin fontSize($size: $euiFontSize, $sizingMethod: 'rem') {
23
+ @if ($sizingMethod == 'rem') {
24
+ font-size: $size;
25
+ font-size: fontSizeToRemOrEm($size, 'rem');
26
+ } @else if ($sizingMethod == 'em') {
27
+ font-size: fontSizeToRemOrEm($size, 'em');
28
+ }
29
+ }
30
+
31
+ @mixin lineHeightFromBaseline($multiplier: 3) {
32
+ line-height: lineHeightFromBaseline($multiplier);
33
+ }
34
+
35
+ // Some mixins that help us deal with browser scaling of text more consistently.
36
+ // Essentially, fonts across eui should scale against the root html element, not
37
+ // against parent inheritance.
38
+
39
+ // Our base fonts
40
+
41
+ @mixin euiFont {
42
+ font-family: $euiFontFamily;
43
+ font-weight: $euiFontWeightRegular;
44
+ letter-spacing: -.005em;
45
+ -webkit-text-size-adjust: 100%;
46
+ -ms-text-size-adjust: 100%;
47
+ font-kerning: normal;
48
+ }
49
+
50
+ @mixin euiCodeFont {
51
+ font-family: $euiCodeFontFamily;
52
+ letter-spacing: normal;
53
+ }
54
+
55
+ @mixin euiText {
56
+ color: $euiTextColor;
57
+ font-weight: $euiFontWeightRegular;
58
+ }
59
+
60
+ @mixin euiTitle($size: 'm') {
61
+ @include euiTextBreakWord;
62
+ color: $euiTitleColor;
63
+
64
+ @if (map-has-key($euiTitles, $size)) {
65
+ @each $property, $value in map-get($euiTitles, $size) {
66
+ @if ($property == 'font-size') {
67
+ @include fontSize($value);
68
+ } @else {
69
+ #{$property}: $value;
70
+ }
71
+ }
72
+ } @else {
73
+ @include fontSize($size);
74
+ @include lineHeightFromBaseline(3);
75
+ }
76
+ }
77
+
78
+ // Font sizing extends, using rem mixin
79
+
80
+ @mixin euiFontSizeXS {
81
+ @include fontSize($euiFontSizeXS);
82
+ line-height: $euiLineHeight;
83
+ }
84
+
85
+ @mixin euiFontSizeS {
86
+ @include fontSize($euiFontSizeS);
87
+ line-height: $euiLineHeight;
88
+ }
89
+
90
+ @mixin euiFontSize {
91
+ @include fontSize($euiFontSize);
92
+ line-height: $euiLineHeight;
93
+ }
94
+
95
+ @mixin euiFontSizeM {
96
+ @include fontSize($euiFontSizeM);
97
+ line-height: $euiLineHeight;
98
+ }
99
+
100
+ @mixin euiFontSizeL {
101
+ @include fontSize($euiFontSizeL);
102
+ line-height: $euiLineHeight;
103
+ }
104
+
105
+ @mixin euiFontSizeXL {
106
+ @each $property, $value in map-get($euiTitles, 'm') {
107
+ @if ($property == 'font-size') {
108
+ @include fontSize($value);
109
+ } @else {
110
+ #{$property}: $value;
111
+ }
112
+ }
113
+ line-height: 1.25;
114
+ }
115
+
116
+ @mixin euiFontSizeXXL {
117
+ @each $property, $value in map-get($euiTitles, 'l') {
118
+ @if ($property == 'font-size') {
119
+ @include fontSize($value);
120
+ } @else {
121
+ #{$property}: $value;
122
+ }
123
+ }
124
+ line-height: 1.25;
125
+ }
126
+
127
+ @mixin euiTextBreakWord {
128
+ // https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/
129
+ overflow-wrap: break-word !important; // makes sure the long string will wrap and not bust out of the container
130
+ word-break: break-word;
131
+ }
132
+
133
+ /**
134
+ * Text truncation
135
+ *
136
+ * Prevent text from wrapping onto multiple lines, and truncate with an ellipsis.
137
+ *
138
+ * 1. Ensure that the node has a maximum width after which truncation can occur.
139
+ */
140
+ @mixin euiTextTruncate {
141
+ max-width: 100%; // 1
142
+ overflow: hidden !important;
143
+ text-overflow: ellipsis !important;
144
+ white-space: nowrap !important;
145
+ }
146
+
147
+ @mixin euiNumberFormat {
148
+ font-feature-settings: $euiFontFeatureSettings, 'tnum' 1; // Fixed-width numbers for tabular data
149
+ }
150
+
151
+ /**
152
+ * Text weight shifting
153
+ *
154
+ * When changing the font-weight based the state of the component
155
+ * this mixin will ensure that the sizing is dependent on the boldest
156
+ * weight so it doesn't shifter sibling content.
157
+ */
158
+ @mixin euiTextShift($fontWeight: $euiFontWeightBold, $attr: 'data-text') {
159
+ &::after {
160
+ display: block;
161
+ content: attr(#{$attr});
162
+ font-weight: $fontWeight;
163
+ height: 0;
164
+ overflow: hidden;
165
+ visibility: hidden;
166
+ }
167
+ }