@elastic/eui 59.1.0 → 60.1.0

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 (248) hide show
  1. package/README.md +7 -0
  2. package/dist/eui_theme_dark.css +0 -493
  3. package/dist/eui_theme_dark.json +7 -44
  4. package/dist/eui_theme_dark.json.d.ts +7 -44
  5. package/dist/eui_theme_dark.min.css +1 -1
  6. package/dist/eui_theme_light.css +0 -493
  7. package/dist/eui_theme_light.json +7 -44
  8. package/dist/eui_theme_light.json.d.ts +7 -44
  9. package/dist/eui_theme_light.min.css +1 -1
  10. package/es/components/accessibility/screen_reader_live/screen_reader_live.js +30 -7
  11. package/es/components/accessibility/screen_reader_only/screen_reader_only.js +14 -19
  12. package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  13. package/es/components/accessibility/skip_link/skip_link.js +20 -4
  14. package/es/components/avatar/avatar.js +2 -2
  15. package/es/components/badge/badge.js +1 -1
  16. package/es/components/button/button_icon/button_icon.js +1 -1
  17. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  18. package/es/components/combo_box/matching_options.js +3 -2
  19. package/es/components/datagrid/body/data_grid_body.js +6 -6
  20. package/es/components/datagrid/body/data_grid_cell.js +12 -12
  21. package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  22. package/es/components/datagrid/body/header/data_grid_header_row.js +6 -6
  23. package/es/components/datagrid/data_grid.js +6 -6
  24. package/es/components/datagrid/utils/in_memory.js +6 -6
  25. package/es/components/date_picker/date_picker.js +1 -1
  26. package/es/components/empty_prompt/empty_prompt.js +1 -1
  27. package/es/components/form/field_text/field_text.js +1 -1
  28. package/es/components/form/form_control_layout/form_control_layout.js +1 -1
  29. package/es/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  30. package/es/components/health/health.js +1 -1
  31. package/es/components/icon/icon.js +43 -495
  32. package/es/components/icon/icon.styles.js +75 -0
  33. package/es/components/icon/icon_map.js +455 -0
  34. package/es/components/icon/named_colors.js +2 -13
  35. package/es/components/list_group/list_group.js +1 -1
  36. package/es/components/list_group/list_group_item.js +1 -1
  37. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  38. package/es/components/notification/notification_event.js +2 -2
  39. package/es/components/notification/notification_event_meta.js +1 -1
  40. package/es/components/notification/notification_event_read_button.js +1 -1
  41. package/es/components/progress/progress.js +34 -87
  42. package/es/components/progress/progress.styles.js +155 -0
  43. package/es/components/provider/cache/cache_provider.js +17 -0
  44. package/es/components/provider/cache/index.js +8 -0
  45. package/es/components/provider/provider.js +35 -5
  46. package/es/components/selectable/selectable.js +39 -22
  47. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  48. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  49. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -2
  50. package/es/components/stat/stat.js +28 -35
  51. package/es/components/stat/stat.styles.js +38 -0
  52. package/es/components/timeline/timeline.js +15 -8
  53. package/es/components/timeline/timeline.styles.js +29 -0
  54. package/es/components/timeline/timeline_item.js +4 -16
  55. package/es/components/timeline/timeline_item.styles.js +18 -3
  56. package/es/components/timeline/timeline_item_icon.styles.js +14 -4
  57. package/es/components/tool_tip/icon_tip.js +1 -1
  58. package/es/global_styling/functions/logicals.js +2 -2
  59. package/es/global_styling/utility/utility.js +17 -0
  60. package/es/services/theme/hooks.js +4 -2
  61. package/es/services/theme/provider.js +1 -5
  62. package/es/test/emotion-prefix.js +29 -0
  63. package/es/test/index.d.ts +5 -0
  64. package/es/test/index.js +2 -1
  65. package/eui.d.ts +450 -454
  66. package/i18ntokens.json +18 -18
  67. package/lib/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  68. package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +22 -19
  69. package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  70. package/lib/components/accessibility/skip_link/skip_link.js +21 -4
  71. package/lib/components/avatar/avatar.js +2 -2
  72. package/lib/components/badge/badge.js +1 -1
  73. package/lib/components/button/button_icon/button_icon.js +1 -1
  74. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  75. package/lib/components/combo_box/matching_options.js +3 -2
  76. package/lib/components/datagrid/body/data_grid_body.js +6 -6
  77. package/lib/components/datagrid/body/data_grid_cell.js +12 -12
  78. package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  79. package/lib/components/datagrid/body/header/data_grid_header_row.js +6 -6
  80. package/lib/components/datagrid/data_grid.js +6 -6
  81. package/lib/components/datagrid/utils/in_memory.js +6 -6
  82. package/lib/components/date_picker/date_picker.js +1 -1
  83. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  84. package/lib/components/form/field_text/field_text.js +1 -1
  85. package/lib/components/form/form_control_layout/form_control_layout.js +1 -1
  86. package/lib/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  87. package/lib/components/health/health.js +1 -1
  88. package/lib/components/icon/icon.js +54 -499
  89. package/lib/components/icon/icon.styles.js +79 -0
  90. package/lib/components/icon/icon_map.js +463 -0
  91. package/lib/components/icon/named_colors.js +4 -15
  92. package/lib/components/list_group/list_group.js +1 -1
  93. package/lib/components/list_group/list_group_item.js +1 -1
  94. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  95. package/lib/components/notification/notification_event.js +2 -2
  96. package/lib/components/notification/notification_event_meta.js +1 -1
  97. package/lib/components/notification/notification_event_read_button.js +1 -1
  98. package/lib/components/progress/progress.js +36 -88
  99. package/lib/components/progress/progress.styles.js +166 -0
  100. package/lib/components/provider/cache/cache_provider.js +29 -0
  101. package/lib/components/provider/cache/index.js +18 -0
  102. package/lib/components/provider/provider.js +36 -5
  103. package/lib/components/selectable/selectable.js +39 -22
  104. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  105. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  106. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  107. package/lib/components/stat/stat.js +30 -40
  108. package/lib/components/stat/stat.styles.js +45 -0
  109. package/lib/components/timeline/timeline.js +20 -9
  110. package/lib/components/timeline/timeline.styles.js +39 -0
  111. package/lib/components/timeline/timeline_item.js +4 -17
  112. package/lib/components/timeline/timeline_item.styles.js +17 -10
  113. package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  114. package/lib/components/tool_tip/icon_tip.js +1 -1
  115. package/lib/global_styling/functions/logicals.js +2 -2
  116. package/lib/global_styling/utility/utility.js +31 -0
  117. package/lib/services/theme/hooks.js +4 -2
  118. package/lib/services/theme/provider.js +3 -6
  119. package/lib/test/emotion-prefix.js +38 -0
  120. package/lib/test/index.d.ts +5 -0
  121. package/lib/test/index.js +23 -1
  122. package/optimize/es/components/accessibility/screen_reader_live/screen_reader_live.js +21 -6
  123. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.js +11 -17
  124. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  125. package/optimize/es/components/accessibility/skip_link/skip_link.js +20 -4
  126. package/optimize/es/components/combo_box/matching_options.js +3 -2
  127. package/optimize/es/components/icon/icon.js +40 -492
  128. package/optimize/es/components/icon/icon.styles.js +75 -0
  129. package/optimize/es/components/icon/icon_map.js +455 -0
  130. package/optimize/es/components/icon/named_colors.js +2 -13
  131. package/optimize/es/components/progress/progress.js +31 -84
  132. package/optimize/es/components/progress/progress.styles.js +155 -0
  133. package/optimize/es/components/provider/cache/cache_provider.js +17 -0
  134. package/optimize/es/components/provider/cache/index.js +8 -0
  135. package/optimize/es/components/provider/provider.js +35 -5
  136. package/optimize/es/components/selectable/selectable.js +33 -22
  137. package/optimize/es/components/stat/stat.js +25 -33
  138. package/optimize/es/components/stat/stat.styles.js +38 -0
  139. package/optimize/es/components/timeline/timeline.js +10 -1
  140. package/optimize/es/components/timeline/timeline.styles.js +29 -0
  141. package/optimize/es/components/timeline/timeline_item.js +4 -9
  142. package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
  143. package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
  144. package/optimize/es/global_styling/functions/logicals.js +2 -2
  145. package/optimize/es/global_styling/utility/utility.js +17 -0
  146. package/optimize/es/services/theme/hooks.js +4 -2
  147. package/optimize/es/services/theme/provider.js +1 -5
  148. package/optimize/es/test/emotion-prefix.js +27 -0
  149. package/optimize/es/test/index.d.ts +5 -0
  150. package/optimize/es/test/index.js +2 -1
  151. package/optimize/lib/components/accessibility/screen_reader_live/screen_reader_live.js +20 -5
  152. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.js +18 -16
  153. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  154. package/optimize/lib/components/accessibility/skip_link/skip_link.js +21 -4
  155. package/optimize/lib/components/combo_box/matching_options.js +3 -2
  156. package/optimize/lib/components/icon/icon.js +49 -494
  157. package/optimize/lib/components/icon/icon.styles.js +81 -0
  158. package/optimize/lib/components/icon/icon_map.js +463 -0
  159. package/optimize/lib/components/icon/named_colors.js +4 -15
  160. package/optimize/lib/components/progress/progress.js +33 -85
  161. package/optimize/lib/components/progress/progress.styles.js +168 -0
  162. package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
  163. package/optimize/lib/components/provider/cache/index.js +18 -0
  164. package/optimize/lib/components/provider/provider.js +36 -5
  165. package/optimize/lib/components/selectable/selectable.js +33 -22
  166. package/optimize/lib/components/stat/stat.js +27 -37
  167. package/optimize/lib/components/stat/stat.styles.js +47 -0
  168. package/optimize/lib/components/timeline/timeline.js +14 -2
  169. package/optimize/lib/components/timeline/timeline.styles.js +39 -0
  170. package/optimize/lib/components/timeline/timeline_item.js +4 -10
  171. package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
  172. package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  173. package/optimize/lib/global_styling/functions/logicals.js +2 -2
  174. package/optimize/lib/global_styling/utility/utility.js +31 -0
  175. package/optimize/lib/services/theme/hooks.js +4 -2
  176. package/optimize/lib/services/theme/provider.js +3 -6
  177. package/optimize/lib/test/emotion-prefix.js +40 -0
  178. package/optimize/lib/test/index.d.ts +5 -0
  179. package/optimize/lib/test/index.js +23 -1
  180. package/package.json +2 -2
  181. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -4
  182. package/src/components/index.scss +0 -4
  183. package/src/global_styling/variables/_form.scss +9 -0
  184. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  185. package/test-env/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  186. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +21 -18
  187. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  188. package/test-env/components/accessibility/skip_link/skip_link.js +21 -4
  189. package/test-env/components/avatar/avatar.js +2 -2
  190. package/test-env/components/badge/badge.js +1 -1
  191. package/test-env/components/button/button_icon/button_icon.js +1 -1
  192. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  193. package/test-env/components/combo_box/matching_options.js +3 -2
  194. package/test-env/components/datagrid/body/data_grid_body.js +6 -6
  195. package/test-env/components/datagrid/body/data_grid_cell.js +12 -12
  196. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  197. package/test-env/components/datagrid/body/header/data_grid_header_row.js +6 -6
  198. package/test-env/components/datagrid/data_grid.js +6 -6
  199. package/test-env/components/datagrid/utils/in_memory.js +6 -6
  200. package/test-env/components/date_picker/date_picker.js +1 -1
  201. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  202. package/test-env/components/form/field_text/field_text.js +1 -1
  203. package/test-env/components/form/form_control_layout/form_control_layout.js +1 -1
  204. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  205. package/test-env/components/health/health.js +1 -1
  206. package/test-env/components/icon/icon.styles.js +81 -0
  207. package/test-env/components/icon/icon_map.js +463 -0
  208. package/test-env/components/icon/named_colors.js +4 -15
  209. package/test-env/components/list_group/list_group.js +1 -1
  210. package/test-env/components/list_group/list_group_item.js +1 -1
  211. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  212. package/test-env/components/notification/notification_event.js +2 -2
  213. package/test-env/components/notification/notification_event_meta.js +1 -1
  214. package/test-env/components/notification/notification_event_read_button.js +1 -1
  215. package/test-env/components/progress/progress.js +36 -88
  216. package/test-env/components/progress/progress.styles.js +168 -0
  217. package/test-env/components/provider/cache/cache_provider.js +29 -0
  218. package/test-env/components/provider/cache/index.js +18 -0
  219. package/test-env/components/provider/provider.js +36 -5
  220. package/test-env/components/selectable/selectable.js +39 -22
  221. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  222. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  223. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  224. package/test-env/components/stat/stat.js +29 -39
  225. package/test-env/components/stat/stat.styles.js +47 -0
  226. package/test-env/components/timeline/timeline.js +19 -9
  227. package/test-env/components/timeline/timeline.styles.js +39 -0
  228. package/test-env/components/timeline/timeline_item.js +4 -17
  229. package/test-env/components/timeline/timeline_item.styles.js +17 -10
  230. package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
  231. package/test-env/components/tool_tip/icon_tip.js +1 -1
  232. package/test-env/global_styling/functions/logicals.js +2 -2
  233. package/test-env/global_styling/utility/utility.js +31 -0
  234. package/test-env/services/theme/hooks.js +4 -2
  235. package/test-env/services/theme/provider.js +3 -6
  236. package/test-env/test/emotion-prefix.js +40 -0
  237. package/test-env/test/index.js +23 -1
  238. package/src/components/accessibility/_index.scss +0 -1
  239. package/src/components/accessibility/screen_reader_only/_screen_reader_only.scss +0 -5
  240. package/src/components/icon/_icon.scss +0 -87
  241. package/src/components/icon/_index.scss +0 -2
  242. package/src/components/icon/_variables.scss +0 -22
  243. package/src/components/progress/_index.scss +0 -2
  244. package/src/components/progress/_progress.scss +0 -166
  245. package/src/components/progress/_variables.scss +0 -21
  246. package/src/components/stat/_index.scss +0 -1
  247. package/src/components/stat/_stat.scss +0 -50
  248. package/src/themes/amsterdam/overrides/_progress.scss +0 -3
@@ -21,10 +21,12 @@ var _i18n = require("../i18n");
21
21
 
22
22
  var _inner_text = require("../inner_text");
23
23
 
24
- var _common = require("../common");
25
-
26
24
  var _predicate = require("../../services/predicate");
27
25
 
26
+ var _services = require("../../services");
27
+
28
+ var _progress = require("./progress.styles");
29
+
28
30
  var _react2 = require("@emotion/react");
29
31
 
30
32
  var _excluded = ["className", "color", "size", "position", "max", "valueText", "label", "value", "labelProps"];
@@ -33,63 +35,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
35
 
34
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
37
 
36
- var sizeToClassNameMap = {
37
- xs: 'euiProgress--xs',
38
- s: 'euiProgress--s',
39
- m: 'euiProgress--m',
40
- l: 'euiProgress--l'
41
- };
42
- var SIZES = (0, _common.keysOf)(sizeToClassNameMap);
38
+ var SIZES = ['xs', 's', 'm', 'l'];
43
39
  exports.SIZES = SIZES;
44
- var colorToClassNameMap = {
45
- primary: 'euiProgress--primary',
46
- success: 'euiProgress--success',
47
- warning: 'euiProgress--warning',
48
- danger: 'euiProgress--danger',
49
- subdued: 'euiProgress--subdued',
50
- accent: 'euiProgress--accent',
51
- vis0: 'euiProgress--vis0',
52
- vis1: 'euiProgress--vis1',
53
- vis2: 'euiProgress--vis2',
54
- vis3: 'euiProgress--vis3',
55
- vis4: 'euiProgress--vis4',
56
- vis5: 'euiProgress--vis5',
57
- vis6: 'euiProgress--vis6',
58
- vis7: 'euiProgress--vis7',
59
- vis8: 'euiProgress--vis8',
60
- vis9: 'euiProgress--vis9'
61
- };
62
- var COLORS = (0, _common.keysOf)(colorToClassNameMap);
40
+ var COLORS = ['primary', 'success', 'warning', 'danger', 'subdued', 'accent', 'vis0', 'vis1', 'vis2', 'vis3', 'vis4', 'vis5', 'vis6', 'vis7', 'vis8', 'vis9'];
63
41
  exports.COLORS = COLORS;
64
-
65
- function isNamedColor(name) {
66
- return colorToClassNameMap.hasOwnProperty(name);
67
- }
68
-
69
- var dataColorToClassNameMap = {
70
- primary: 'euiProgress__data--primary',
71
- success: 'euiProgress__data--success',
72
- warning: 'euiProgress__data--warning',
73
- danger: 'euiProgress__data--danger',
74
- subdued: 'euiProgress__data--subdued',
75
- accent: 'euiProgress__data--accent',
76
- vis0: 'euiProgress__data--vis0',
77
- vis1: 'euiProgress__data--vis1',
78
- vis2: 'euiProgress__data--vis2',
79
- vis3: 'euiProgress__data--vis3',
80
- vis4: 'euiProgress__data--vis4',
81
- vis5: 'euiProgress__data--vis5',
82
- vis6: 'euiProgress__data--vis6',
83
- vis7: 'euiProgress__data--vis7',
84
- vis8: 'euiProgress__data--vis8',
85
- vis9: 'euiProgress__data--vis9'
86
- };
87
- var positionsToClassNameMap = {
88
- fixed: 'euiProgress--fixed',
89
- absolute: 'euiProgress--absolute',
90
- static: ''
91
- };
92
- var POSITIONS = (0, _common.keysOf)(positionsToClassNameMap);
42
+ var POSITIONS = ['fixed', 'absolute', 'static'];
93
43
  exports.POSITIONS = POSITIONS;
94
44
 
95
45
  var EuiProgress = function EuiProgress(_ref) {
@@ -108,30 +58,23 @@ var EuiProgress = function EuiProgress(_ref) {
108
58
  labelProps = _ref.labelProps,
109
59
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
110
60
  var determinate = !(0, _predicate.isNil)(max);
111
- var colorClass = null;
112
- var dataColorClass = null;
113
- var optionalCustomStyles = null;
114
-
115
- if (color) {
116
- if (isNamedColor(color)) {
117
- colorClass = colorToClassNameMap[color];
118
- dataColorClass = dataColorToClassNameMap[color];
119
- } else {
120
- optionalCustomStyles = {
121
- color: color
122
- };
123
- colorClass = 'euiProgress--customColor';
124
- }
125
- }
126
-
127
- var classes = (0, _classnames.default)('euiProgress', {
128
- 'euiProgress--indeterminate': !determinate,
129
- 'euiProgress--native': determinate
130
- }, sizeToClassNameMap[size], colorClass, positionsToClassNameMap[position], className);
131
- var dataClasses = (0, _classnames.default)('euiProgress__data', {
132
- 'euiProgress__data--l': size === 'l'
133
- }, dataColorClass);
134
- var labelClasses = (0, _classnames.default)('euiProgress__label', labelProps && labelProps.className);
61
+ var isNamedColor = COLORS.includes(color);
62
+ var euiTheme = (0, _services.useEuiTheme)();
63
+ var customColorStyles = !isNamedColor ? {
64
+ color: color
65
+ } : {};
66
+ var customTextColorStyles = !isNamedColor ? {
67
+ color: (0, _services.makeHighContrastColor)(color)(euiTheme.euiTheme)
68
+ } : {};
69
+ var styles = (0, _progress.euiProgressStyles)(euiTheme, determinate);
70
+ var cssStyles = [styles.euiProgress, determinate && styles.native, !determinate && styles.indeterminate, styles[size], styles[position], isNamedColor ? styles[color] : styles.customColor];
71
+ var dataStyles = (0, _progress.euiProgressDataStyles)(euiTheme);
72
+ var dataCssStyles = [dataStyles.euiProgress__data, size === 'l' && dataStyles[size]];
73
+ var labelCssStyles = [_progress.euiProgressLabelStyles.euiProgress__label];
74
+ var valueTextStyles = (0, _progress.euiProgressValueTextStyles)(euiTheme);
75
+ var valueTextCssStyles = [valueTextStyles.euiProgress__valueText, isNamedColor ? valueTextStyles[color] : styles.customColor];
76
+ var classes = (0, _classnames.default)('euiProgress', className);
77
+ var labelClasses = (0, _classnames.default)('euiProgress__label', labelProps === null || labelProps === void 0 ? void 0 : labelProps.className);
135
78
  var valueRender;
136
79
 
137
80
  if (valueText === true) {
@@ -152,31 +95,36 @@ var EuiProgress = function EuiProgress(_ref) {
152
95
 
153
96
  if (determinate) {
154
97
  return (0, _react2.jsx)(_react.Fragment, null, label || valueText ? (0, _react2.jsx)("div", {
155
- className: dataClasses
98
+ css: dataCssStyles,
99
+ className: "euiProgress__data"
156
100
  }, label && (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
157
101
  return (0, _react2.jsx)("span", (0, _extends2.default)({
158
102
  title: innerText,
159
103
  ref: ref
160
104
  }, labelProps, {
105
+ css: labelCssStyles,
161
106
  className: labelClasses
162
107
  }), label);
163
108
  }), valueRender && (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
164
109
  return (0, _react2.jsx)("span", {
165
110
  title: innerText,
166
111
  ref: ref,
167
- style: optionalCustomStyles,
112
+ style: customTextColorStyles,
113
+ css: valueTextCssStyles,
168
114
  className: "euiProgress__valueText"
169
115
  }, valueRender);
170
116
  })) : undefined, (0, _react2.jsx)("progress", (0, _extends2.default)({
117
+ css: cssStyles,
171
118
  className: classes,
172
- style: optionalCustomStyles,
119
+ style: customColorStyles,
173
120
  max: max,
174
121
  value: value,
175
122
  "aria-hidden": label && valueText ? true : false
176
123
  }, rest)));
177
124
  } else {
178
125
  return (0, _react2.jsx)("div", (0, _extends2.default)({
179
- style: optionalCustomStyles,
126
+ css: cssStyles,
127
+ style: customColorStyles,
180
128
  className: classes
181
129
  }, rest));
182
130
  }
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.euiProgressValueTextStyles = exports.euiProgressStyles = exports.euiProgressLabelStyles = exports.euiProgressDataStyles = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = require("@emotion/react");
13
+
14
+ var _global_styling = require("../../global_styling");
15
+
16
+ var _services = require("../../services");
17
+
18
+ var _text = require("../text/text.styles");
19
+
20
+ var _templateObject;
21
+
22
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
23
+
24
+ /**
25
+ * DRY utilities for native/determinate progress components vs non-native indeterminate
26
+ */
27
+ var crossBrowserProgressValue = function crossBrowserProgressValue(cssProperties) {
28
+ return "\n &::-webkit-progress-value {\n ".concat(cssProperties, "\n }\n &::-moz-progress-bar {\n ").concat(cssProperties, "\n }\n");
29
+ };
30
+
31
+ var indeterminateProgressValue = function indeterminateProgressValue(cssProperties) {
32
+ return "\n &:before {\n ".concat(cssProperties, "\n }\n");
33
+ };
34
+ /**
35
+ * Color utilities
36
+ */
37
+
38
+
39
+ var visColors = (0, _services.euiPaletteColorBlind)();
40
+
41
+ var nativeVsIndeterminateColor = function nativeVsIndeterminateColor(color, isNative) {
42
+ var selectors = isNative ? crossBrowserProgressValue : indeterminateProgressValue;
43
+ return selectors("background-color: ".concat(color, ";"));
44
+ };
45
+ /**
46
+ * DRY utils for non-static positions
47
+ */
48
+
49
+
50
+ var nonStaticPositioning = function nonStaticPositioning(isNative) {
51
+ return "\n top: 0;\n left: 0;\n right: 0;\n background-color: transparent;\n ".concat(isNative ? "\n &::-webkit-progress-bar {\n background-color: transparent;\n }" : '', "\n");
52
+ };
53
+ /**
54
+ * Animations
55
+ */
56
+
57
+
58
+ var euiIndeterminateAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 0% {\n transform: scaleX(1) translateX(-100%);\n }\n 100% {\n transform: scaleX(1) translateX(100%);\n }\n"])));
59
+ /**
60
+ * Emotion styles
61
+ */
62
+
63
+ var _ref2 = process.env.NODE_ENV === "production" ? {
64
+ name: "187h6sp-static",
65
+ styles: "position:relative;label:static;"
66
+ } : {
67
+ name: "187h6sp-static",
68
+ styles: "position:relative;label:static;",
69
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
70
+ };
71
+
72
+ var euiProgressStyles = function euiProgressStyles(_ref3, isNative) {
73
+ var euiTheme = _ref3.euiTheme;
74
+ return {
75
+ euiProgress: /*#__PURE__*/(0, _react.css)("overflow:hidden;background-color:", euiTheme.colors.lightShade, ";;label:euiProgress;"),
76
+ // https://css-tricks.com/html5-progress-element/
77
+ // Good resource if you need to work in here. There's some gotchas with
78
+ // dealing with cross-browser progress bars.
79
+ native: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", crossBrowserProgressValue("transition: width ".concat(euiTheme.animation.normal, " linear;")), ";;label:native;"),
80
+ // An indeterminate bar has an unreliable end time. Because of a Firefox animation issue,
81
+ // we apply this style to a <div> instead of a <progress> element.
82
+ // See https://css-tricks.com/html5-progress-element/ for more info.
83
+ indeterminate: /*#__PURE__*/(0, _react.css)("&:before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " top:0;bottom:0;left:0;transform:scaleX(0) translateX(0%);animation:", euiIndeterminateAnimation, " 1s ", euiTheme.animation.resistance, " infinite;", _global_styling.euiCantAnimate, "{animation-duration:2s;animation-timing-function:linear;}};label:indeterminate;"),
84
+ // Sizes
85
+ xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.xxs), ";;label:xs;"),
86
+ s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.xs), ";;label:s;"),
87
+ m: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.s), ";;label:m;"),
88
+ l: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.m), ";;label:l;"),
89
+ // Positioning
90
+ fixed: /*#__PURE__*/(0, _react.css)("position:fixed;z-index:", Number(euiTheme.levels.header) + 1, ";", nonStaticPositioning(isNative), ";;label:fixed;"),
91
+ absolute: /*#__PURE__*/(0, _react.css)("position:absolute;", nonStaticPositioning(isNative), ";;label:absolute;"),
92
+ static: _ref2,
93
+ // Colors
94
+ primary: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.primary, isNative), ";;label:primary;"),
95
+ success: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.success, isNative), ";;label:success;"),
96
+ warning: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.warning, isNative), ";;label:warning;"),
97
+ danger: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.danger, isNative), ";;label:danger;"),
98
+ subdued: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.subduedText, isNative), ";;label:subdued;"),
99
+ accent: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.accent, isNative), ";;label:accent;"),
100
+ vis0: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[0], isNative), ";;label:vis0;"),
101
+ vis1: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[1], isNative), ";;label:vis1;"),
102
+ vis2: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[2], isNative), ";;label:vis2;"),
103
+ vis3: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[3], isNative), ";;label:vis3;"),
104
+ vis4: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[4], isNative), ";;label:vis4;"),
105
+ vis5: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[5], isNative), ";;label:vis5;"),
106
+ vis6: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[6], isNative), ";;label:vis6;"),
107
+ vis7: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[7], isNative), ";;label:vis7;"),
108
+ vis8: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[8], isNative), ";;label:vis8;"),
109
+ vis9: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[9], isNative), ";;label:vis9;"),
110
+ customColor: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor('currentColor', isNative), ";;label:customColor;")
111
+ };
112
+ };
113
+ /**
114
+ * Data styles
115
+ */
116
+
117
+
118
+ exports.euiProgressStyles = euiProgressStyles;
119
+
120
+ var euiProgressDataStyles = function euiProgressDataStyles(euiThemeContext) {
121
+ return {
122
+ euiProgress__data: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:space-between;gap:", euiThemeContext.euiTheme.size.xs, ";", (0, _text.euiText)(euiThemeContext.euiTheme), " ", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs'), ";;label:euiProgress__data;"),
123
+ // Sizes
124
+ l: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 's'), ";;label:l;")
125
+ };
126
+ };
127
+
128
+ exports.euiProgressDataStyles = euiProgressDataStyles;
129
+ var euiProgressLabelStyles = {
130
+ euiProgress__label: /*#__PURE__*/(0, _react.css)("flex-grow:1;", (0, _global_styling.euiTextTruncate)(), ";;label:euiProgress__label;")
131
+ };
132
+ exports.euiProgressLabelStyles = euiProgressLabelStyles;
133
+
134
+ var _ref = process.env.NODE_ENV === "production" ? {
135
+ name: "15ioh86-customColor",
136
+ styles: "color:currentColor;label:customColor;"
137
+ } : {
138
+ name: "15ioh86-customColor",
139
+ styles: "color:currentColor;label:customColor;",
140
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
141
+ };
142
+
143
+ var euiProgressValueTextStyles = function euiProgressValueTextStyles(_ref4) {
144
+ var euiTheme = _ref4.euiTheme;
145
+ return {
146
+ euiProgress__valueText: /*#__PURE__*/(0, _react.css)("flex-grow:1;flex-shrink:0;font-feature-settings:'tnum' 1;", (0, _global_styling.logicalTextAlignCSS)('right'), " ", (0, _global_styling.euiTextTruncate)(), ";;label:euiProgress__valueText;"),
147
+ // Colors
148
+ primary: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.primaryText, ";;label:primary;"),
149
+ success: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.successText, ";;label:success;"),
150
+ warning: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.warningText, ";;label:warning;"),
151
+ danger: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.dangerText, ";;label:danger;"),
152
+ subdued: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.subduedText, ";;label:subdued;"),
153
+ accent: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.accentText, ";;label:accent;"),
154
+ vis0: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[0])(euiTheme), ";;label:vis0;"),
155
+ vis1: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[1])(euiTheme), ";;label:vis1;"),
156
+ vis2: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[2])(euiTheme), ";;label:vis2;"),
157
+ vis3: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[3])(euiTheme), ";;label:vis3;"),
158
+ vis4: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[4])(euiTheme), ";;label:vis4;"),
159
+ vis5: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[5])(euiTheme), ";;label:vis5;"),
160
+ vis6: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[6])(euiTheme), ";;label:vis6;"),
161
+ vis7: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[7])(euiTheme), ";;label:vis7;"),
162
+ vis8: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[8])(euiTheme), ";;label:vis8;"),
163
+ vis9: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[9])(euiTheme), ";;label:vis9;"),
164
+ customColor: _ref
165
+ };
166
+ };
167
+
168
+ exports.euiProgressValueTextStyles = euiProgressValueTextStyles;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.EuiCacheProvider = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _react2 = require("@emotion/react");
13
+
14
+ /*
15
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
16
+ * or more contributor license agreements. Licensed under the Elastic License
17
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
18
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
19
+ * Side Public License, v 1.
20
+ */
21
+ var EuiCacheProvider = function EuiCacheProvider(_ref) {
22
+ var cache = _ref.cache,
23
+ children = _ref.children;
24
+ return children && cache ? (0, _react2.jsx)(_react2.CacheProvider, {
25
+ value: cache
26
+ }, children) : (0, _react2.jsx)(_react.default.Fragment, null, children);
27
+ };
28
+
29
+ exports.EuiCacheProvider = EuiCacheProvider;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _cache_provider = require("./cache_provider");
8
+
9
+ Object.keys(_cache_provider).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _cache_provider[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _cache_provider[key];
16
+ }
17
+ });
18
+ });
@@ -11,10 +11,14 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _global_styles = require("../../global_styling/reset/global_styles");
13
13
 
14
+ var _utility = require("../../global_styling/utility/utility");
15
+
14
16
  var _services = require("../../services");
15
17
 
16
18
  var _themes = require("../../themes");
17
19
 
20
+ var _cache = require("./cache");
21
+
18
22
  var _react2 = require("@emotion/react");
19
23
 
20
24
  /*
@@ -24,21 +28,48 @@ var _react2 = require("@emotion/react");
24
28
  * in compliance with, at your election, the Elastic License 2.0 or the Server
25
29
  * Side Public License, v 1.
26
30
  */
31
+ var isEmotionCacheObject = function isEmotionCacheObject(obj) {
32
+ return obj.hasOwnProperty('key');
33
+ };
34
+
27
35
  var EuiProvider = function EuiProvider(_ref) {
28
36
  var cache = _ref.cache,
29
37
  _ref$theme = _ref.theme,
30
38
  theme = _ref$theme === void 0 ? _themes.EuiThemeAmsterdam : _ref$theme,
31
39
  _ref$globalStyles = _ref.globalStyles,
32
- GlobalStyles = _ref$globalStyles === void 0 ? _global_styles.EuiGlobalStyles : _ref$globalStyles,
40
+ Globals = _ref$globalStyles === void 0 ? _global_styles.EuiGlobalStyles : _ref$globalStyles,
41
+ _ref$utilityClasses = _ref.utilityClasses,
42
+ Utilities = _ref$utilityClasses === void 0 ? _utility.EuiUtilityClasses : _ref$utilityClasses,
33
43
  colorMode = _ref.colorMode,
34
44
  modify = _ref.modify,
35
45
  children = _ref.children;
36
- return (0, _react2.jsx)(_services.EuiThemeProvider, {
46
+ var defaultCache;
47
+ var globalCache;
48
+ var utilityCache;
49
+
50
+ if (cache) {
51
+ if (isEmotionCacheObject(cache)) {
52
+ defaultCache = cache;
53
+ } else {
54
+ defaultCache = cache.default;
55
+ globalCache = cache.global;
56
+ utilityCache = cache.utility;
57
+ }
58
+ }
59
+
60
+ return (0, _react2.jsx)(_cache.EuiCacheProvider, {
61
+ cache: defaultCache
62
+ }, (0, _react2.jsx)(_services.EuiThemeProvider, {
37
63
  theme: theme !== null && theme !== void 0 ? theme : undefined,
38
64
  colorMode: colorMode,
39
- modify: modify,
40
- cache: cache
41
- }, theme !== null && GlobalStyles !== false ? (0, _react2.jsx)(GlobalStyles, null) : null, children);
65
+ modify: modify
66
+ }, theme && (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_cache.EuiCacheProvider, {
67
+ cache: globalCache,
68
+ children: Globals && (0, _react2.jsx)(Globals, null)
69
+ }), (0, _react2.jsx)(_cache.EuiCacheProvider, {
70
+ cache: utilityCache,
71
+ children: Utilities && (0, _react2.jsx)(Utilities, null)
72
+ })), children));
42
73
  };
43
74
 
44
75
  exports.EuiProvider = EuiProvider;
@@ -53,7 +53,7 @@ var _i18n = require("../i18n");
53
53
 
54
54
  var _react2 = require("@emotion/react");
55
55
 
56
- var _excluded = ["children", "className", "options", "onChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "isPreFiltered"],
56
+ var _excluded = ["children", "className", "options", "onChange", "onActiveOptionChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "isPreFiltered"],
57
57
  _excluded2 = ["aria-label", "aria-describedby", "onChange", "defaultValue", "inputRef"],
58
58
  _excluded3 = ["aria-label", "aria-describedby", "isVirtualized", "rowHeight"];
59
59
 
@@ -319,31 +319,42 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
319
319
  }
320
320
 
321
321
  (0, _createClass2.default)(EuiSelectable, [{
322
+ key: "componentDidUpdate",
323
+ value: function componentDidUpdate(prevProps, prevState) {
324
+ if (prevState.activeOptionIndex !== this.state.activeOptionIndex) {
325
+ var _this$props$onActiveO, _this$props2;
326
+
327
+ var activeOption = this.state.activeOptionIndex != null ? this.state.visibleOptions[this.state.activeOptionIndex] : null;
328
+ (_this$props$onActiveO = (_this$props2 = this.props).onActiveOptionChange) === null || _this$props$onActiveO === void 0 ? void 0 : _this$props$onActiveO.call(_this$props2, activeOption);
329
+ }
330
+ }
331
+ }, {
322
332
  key: "render",
323
333
  value: function render() {
324
334
  var _this2 = this;
325
335
 
326
- var _this$props2 = this.props,
327
- children = _this$props2.children,
328
- className = _this$props2.className,
329
- options = _this$props2.options,
330
- onChange = _this$props2.onChange,
331
- searchable = _this$props2.searchable,
332
- searchProps = _this$props2.searchProps,
333
- singleSelection = _this$props2.singleSelection,
334
- isLoading = _this$props2.isLoading,
335
- listProps = _this$props2.listProps,
336
- renderOption = _this$props2.renderOption,
337
- height = _this$props2.height,
338
- allowExclusions = _this$props2.allowExclusions,
339
- ariaLabel = _this$props2['aria-label'],
340
- ariaDescribedby = _this$props2['aria-describedby'],
341
- loadingMessage = _this$props2.loadingMessage,
342
- noMatchesMessage = _this$props2.noMatchesMessage,
343
- emptyMessage = _this$props2.emptyMessage,
344
- errorMessage = _this$props2.errorMessage,
345
- isPreFiltered = _this$props2.isPreFiltered,
346
- rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
336
+ var _this$props3 = this.props,
337
+ children = _this$props3.children,
338
+ className = _this$props3.className,
339
+ options = _this$props3.options,
340
+ onChange = _this$props3.onChange,
341
+ onActiveOptionChange = _this$props3.onActiveOptionChange,
342
+ searchable = _this$props3.searchable,
343
+ searchProps = _this$props3.searchProps,
344
+ singleSelection = _this$props3.singleSelection,
345
+ isLoading = _this$props3.isLoading,
346
+ listProps = _this$props3.listProps,
347
+ renderOption = _this$props3.renderOption,
348
+ height = _this$props3.height,
349
+ allowExclusions = _this$props3.allowExclusions,
350
+ ariaLabel = _this$props3['aria-label'],
351
+ ariaDescribedby = _this$props3['aria-describedby'],
352
+ loadingMessage = _this$props3.loadingMessage,
353
+ noMatchesMessage = _this$props3.noMatchesMessage,
354
+ emptyMessage = _this$props3.emptyMessage,
355
+ errorMessage = _this$props3.errorMessage,
356
+ isPreFiltered = _this$props3.isPreFiltered,
357
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
347
358
  var _this$state = this.state,
348
359
  searchValue = _this$state.searchValue,
349
360
  visibleOptions = _this$state.visibleOptions,
@@ -7,16 +7,16 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.isColorClass = exports.EuiStat = exports.COLORS = exports.ALIGNMENTS = void 0;
10
+ exports.EuiStat = exports.COLORS = exports.ALIGNMENTS = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+
14
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
17
 
16
18
  var _react = _interopRequireWildcard(require("react"));
17
19
 
18
- var _common = require("../common");
19
-
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
22
  var _text = require("../text");
@@ -27,6 +27,10 @@ var _accessibility = require("../accessibility");
27
27
 
28
28
  var _i18n = require("../i18n");
29
29
 
30
+ var _services = require("../../services");
31
+
32
+ var _stat = require("./stat.styles");
33
+
30
34
  var _react2 = require("@emotion/react");
31
35
 
32
36
  var _excluded = ["children", "className", "description", "isLoading", "reverse", "textAlign", "title", "titleColor", "titleSize", "titleElement", "descriptionElement"];
@@ -35,28 +39,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
35
39
 
36
40
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
41
 
38
- var colorToClassNameMap = {
39
- default: null,
40
- subdued: 'euiStat__title--subdued',
41
- primary: 'euiStat__title--primary',
42
- success: 'euiStat__title--success',
43
- danger: 'euiStat__title--danger',
44
- accent: 'euiStat__title--accent'
45
- };
46
- var COLORS = (0, _common.keysOf)(colorToClassNameMap);
47
- exports.COLORS = COLORS;
48
- var textAlignToClassNameMap = {
49
- left: 'euiStat--leftAligned',
50
- center: 'euiStat--centerAligned',
51
- right: 'euiStat--rightAligned'
52
- };
42
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
53
43
 
54
- var isColorClass = function isColorClass(input) {
55
- return colorToClassNameMap.hasOwnProperty(input);
56
- };
44
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
57
45
 
58
- exports.isColorClass = isColorClass;
59
- var ALIGNMENTS = (0, _common.keysOf)(textAlignToClassNameMap);
46
+ var COLORS = ['default', 'subdued', 'primary', 'success', 'danger', 'accent'];
47
+ exports.COLORS = COLORS;
48
+ var ALIGNMENTS = ['left', 'center', 'right'];
60
49
  exports.ALIGNMENTS = ALIGNMENTS;
61
50
 
62
51
  var EuiStat = function EuiStat(_ref) {
@@ -79,10 +68,10 @@ var EuiStat = function EuiStat(_ref) {
79
68
  _ref$descriptionEleme = _ref.descriptionElement,
80
69
  descriptionElement = _ref$descriptionEleme === void 0 ? 'p' : _ref$descriptionEleme,
81
70
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
82
- var classes = (0, _classnames.default)('euiStat', textAlignToClassNameMap[textAlign], className);
83
- var titleClasses = (0, _classnames.default)('euiStat__title', isColorClass(titleColor) ? colorToClassNameMap[titleColor] : null, {
84
- 'euiStat__title-isLoading': isLoading
85
- });
71
+ var euiTheme = (0, _services.useEuiTheme)();
72
+ var styles = (0, _stat.euiStatStyles)();
73
+ var cssStyles = [styles.euiStat, styles[textAlign]];
74
+ var classes = (0, _classnames.default)('euiStat', className);
86
75
  var commonProps = {
87
76
  'aria-hidden': true
88
77
  };
@@ -90,26 +79,27 @@ var EuiStat = function EuiStat(_ref) {
90
79
  size: "s",
91
80
  className: "euiStat__description"
92
81
  }, /*#__PURE__*/(0, _react.createElement)(descriptionElement, commonProps, description));
93
- var titlePropsWithColor = {
94
- 'aria-hidden': true,
82
+ var isNamedTitleColor = COLORS.includes(titleColor);
83
+ var titleStyles = (0, _stat.euiStatTitleStyles)(euiTheme);
84
+ var titleCssStyles = [titleStyles.euiStat__title, isNamedTitleColor && titleStyles[titleColor], isLoading && titleStyles.isLoading];
85
+ var titleProps = isNamedTitleColor ? commonProps : _objectSpread(_objectSpread({}, commonProps), {}, {
95
86
  style: {
96
- color: "".concat(titleColor)
87
+ color: titleColor
97
88
  }
98
- };
89
+ });
99
90
  var titleChildren = isLoading ? '--' : title;
100
- var titleDisplay = isColorClass(titleColor) ? (0, _react2.jsx)(_title.EuiTitle, {
101
- size: titleSize,
102
- className: titleClasses
103
- }, /*#__PURE__*/(0, _react.createElement)(titleElement, commonProps, titleChildren)) : (0, _react2.jsx)(_title.EuiTitle, {
91
+ var titleDisplay = (0, _react2.jsx)(_title.EuiTitle, {
104
92
  size: titleSize,
105
- className: titleClasses
106
- }, /*#__PURE__*/(0, _react.createElement)(titleElement, titlePropsWithColor, titleChildren));
93
+ className: "euiStat__title",
94
+ css: titleCssStyles
95
+ }, /*#__PURE__*/(0, _react.createElement)(titleElement, titleProps, titleChildren));
107
96
  var screenReader = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, isLoading ? (0, _react2.jsx)(_i18n.EuiI18n, {
108
97
  token: "euiStat.loadingText",
109
98
  default: "Statistic is loading"
110
99
  }) : (0, _react2.jsx)(_react.Fragment, null, reverse ? "".concat(title, " ").concat(description) : "".concat(description, " ").concat(title))));
111
100
  var statDisplay = (0, _react2.jsx)(_react.Fragment, null, !reverse && descriptionDisplay, titleDisplay, reverse && descriptionDisplay, typeof title === 'string' && typeof description === 'string' && screenReader);
112
101
  return (0, _react2.jsx)("div", (0, _extends2.default)({
102
+ css: cssStyles,
113
103
  className: classes
114
104
  }, rest), statDisplay, children);
115
105
  };