@elastic/eui 74.1.0 → 75.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 (149) hide show
  1. package/dist/eui_theme_dark.css +0 -323
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -323
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/code/code_block.js +5 -3
  6. package/es/components/code/code_block_annotations.js +94 -0
  7. package/es/components/code/code_block_annotations.style.js +18 -0
  8. package/es/components/code/code_block_full_screen.js +9 -3
  9. package/es/components/code/code_block_line.styles.js +3 -2
  10. package/es/components/code/utils.js +53 -13
  11. package/es/components/collapsible_nav/collapsible_nav.js +10 -11
  12. package/es/components/flyout/flyout.js +88 -24
  13. package/es/components/form/range/range_track.js +1 -1
  14. package/es/components/header/header.js +3 -1
  15. package/es/components/icon/assets/app_agent.js +2 -10
  16. package/es/components/icon/assets/app_fleet.js +10 -2
  17. package/es/components/search_bar/filters/field_value_selection_filter.js +6 -10
  18. package/es/components/selectable/selectable_list/selectable_list.js +19 -5
  19. package/es/components/steps/step.js +19 -12
  20. package/es/components/steps/step.styles.js +73 -0
  21. package/es/components/steps/step_horizontal.js +55 -42
  22. package/es/components/steps/step_horizontal.styles.js +55 -0
  23. package/es/components/steps/step_number.js +82 -73
  24. package/es/components/steps/step_number.styles.js +76 -0
  25. package/es/components/steps/steps_horizontal.js +11 -7
  26. package/es/components/steps/steps_horizontal.styles.js +35 -0
  27. package/es/components/steps/sub_steps.js +7 -1
  28. package/es/components/steps/sub_steps.styles.js +14 -0
  29. package/es/components/tour/tour_step_indicator.js +0 -3
  30. package/es/global_styling/utility/animations.js +4 -3
  31. package/eui.d.ts +130 -16
  32. package/i18ntokens.json +76 -12
  33. package/lib/components/code/code_block.js +5 -3
  34. package/lib/components/code/code_block_annotations.js +113 -0
  35. package/lib/components/code/code_block_annotations.style.js +29 -0
  36. package/lib/components/code/code_block_full_screen.js +9 -3
  37. package/lib/components/code/code_block_line.styles.js +3 -2
  38. package/lib/components/code/utils.js +54 -13
  39. package/lib/components/collapsible_nav/collapsible_nav.js +10 -11
  40. package/lib/components/flyout/flyout.js +85 -22
  41. package/lib/components/form/range/range_track.js +1 -1
  42. package/lib/components/header/header.js +3 -1
  43. package/lib/components/icon/assets/app_agent.js +2 -10
  44. package/lib/components/icon/assets/app_fleet.js +10 -2
  45. package/lib/components/icon/svgs/app_agent.svg +2 -4
  46. package/lib/components/icon/svgs/app_fleet.svg +4 -2
  47. package/lib/components/search_bar/filters/field_value_selection_filter.js +6 -10
  48. package/lib/components/selectable/selectable_list/selectable_list.js +19 -5
  49. package/lib/components/steps/step.js +21 -12
  50. package/lib/components/steps/step.styles.js +93 -0
  51. package/lib/components/steps/step_horizontal.js +56 -41
  52. package/lib/components/steps/step_horizontal.styles.js +66 -0
  53. package/lib/components/steps/step_number.js +86 -75
  54. package/lib/components/steps/step_number.styles.js +84 -0
  55. package/lib/components/steps/steps_horizontal.js +12 -7
  56. package/lib/components/steps/steps_horizontal.styles.js +38 -0
  57. package/lib/components/steps/sub_steps.js +9 -1
  58. package/lib/components/steps/sub_steps.styles.js +24 -0
  59. package/lib/components/tour/tour_step_indicator.js +0 -3
  60. package/lib/global_styling/utility/animations.js +6 -4
  61. package/optimize/es/components/code/code_block_annotations.js +79 -0
  62. package/optimize/es/components/code/code_block_annotations.style.js +18 -0
  63. package/optimize/es/components/code/code_block_full_screen.js +9 -3
  64. package/optimize/es/components/code/code_block_line.styles.js +3 -2
  65. package/optimize/es/components/code/utils.js +53 -13
  66. package/optimize/es/components/collapsible_nav/collapsible_nav.js +1 -4
  67. package/optimize/es/components/flyout/flyout.js +81 -24
  68. package/optimize/es/components/form/range/range_track.js +1 -1
  69. package/optimize/es/components/header/header.js +3 -1
  70. package/optimize/es/components/icon/assets/app_agent.js +2 -10
  71. package/optimize/es/components/icon/assets/app_fleet.js +10 -2
  72. package/optimize/es/components/search_bar/filters/field_value_selection_filter.js +6 -10
  73. package/optimize/es/components/selectable/selectable_list/selectable_list.js +19 -5
  74. package/optimize/es/components/steps/step.js +19 -12
  75. package/optimize/es/components/steps/step.styles.js +73 -0
  76. package/optimize/es/components/steps/step_horizontal.js +54 -41
  77. package/optimize/es/components/steps/step_horizontal.styles.js +55 -0
  78. package/optimize/es/components/steps/step_number.js +82 -73
  79. package/optimize/es/components/steps/step_number.styles.js +76 -0
  80. package/optimize/es/components/steps/steps_horizontal.js +11 -7
  81. package/optimize/es/components/steps/steps_horizontal.styles.js +35 -0
  82. package/optimize/es/components/steps/sub_steps.js +7 -1
  83. package/optimize/es/components/steps/sub_steps.styles.js +14 -0
  84. package/optimize/es/components/tour/tour_step_indicator.js +0 -3
  85. package/optimize/es/global_styling/utility/animations.js +4 -3
  86. package/optimize/lib/components/code/code_block_annotations.js +105 -0
  87. package/optimize/lib/components/code/code_block_annotations.style.js +29 -0
  88. package/optimize/lib/components/code/code_block_full_screen.js +9 -3
  89. package/optimize/lib/components/code/code_block_line.styles.js +3 -2
  90. package/optimize/lib/components/code/utils.js +54 -13
  91. package/optimize/lib/components/collapsible_nav/collapsible_nav.js +1 -4
  92. package/optimize/lib/components/flyout/flyout.js +80 -22
  93. package/optimize/lib/components/form/range/range_track.js +1 -1
  94. package/optimize/lib/components/header/header.js +3 -1
  95. package/optimize/lib/components/icon/assets/app_agent.js +2 -10
  96. package/optimize/lib/components/icon/assets/app_fleet.js +10 -2
  97. package/optimize/lib/components/icon/svgs/app_agent.svg +2 -4
  98. package/optimize/lib/components/icon/svgs/app_fleet.svg +4 -2
  99. package/optimize/lib/components/search_bar/filters/field_value_selection_filter.js +6 -10
  100. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +16 -5
  101. package/optimize/lib/components/steps/step.js +21 -12
  102. package/optimize/lib/components/steps/step.styles.js +93 -0
  103. package/optimize/lib/components/steps/step_horizontal.js +55 -40
  104. package/optimize/lib/components/steps/step_horizontal.styles.js +66 -0
  105. package/optimize/lib/components/steps/step_number.js +86 -75
  106. package/optimize/lib/components/steps/step_number.styles.js +84 -0
  107. package/optimize/lib/components/steps/steps_horizontal.js +12 -7
  108. package/optimize/lib/components/steps/steps_horizontal.styles.js +38 -0
  109. package/optimize/lib/components/steps/sub_steps.js +9 -1
  110. package/optimize/lib/components/steps/sub_steps.styles.js +24 -0
  111. package/optimize/lib/components/tour/tour_step_indicator.js +0 -3
  112. package/optimize/lib/global_styling/utility/animations.js +6 -4
  113. package/package.json +3 -3
  114. package/src/components/index.scss +0 -1
  115. package/src/themes/amsterdam/global_styling/variables/_index.scss +0 -1
  116. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  117. package/test-env/components/code/code_block_annotations.js +110 -0
  118. package/test-env/components/code/code_block_annotations.style.js +29 -0
  119. package/test-env/components/code/code_block_full_screen.js +9 -3
  120. package/test-env/components/code/code_block_line.styles.js +3 -2
  121. package/test-env/components/code/utils.js +54 -13
  122. package/test-env/components/collapsible_nav/collapsible_nav.js +10 -11
  123. package/test-env/components/form/range/range_track.js +1 -1
  124. package/test-env/components/header/header.js +3 -1
  125. package/test-env/components/icon/assets/app_agent.js +2 -10
  126. package/test-env/components/icon/assets/app_fleet.js +10 -2
  127. package/test-env/components/search_bar/filters/field_value_selection_filter.js +6 -10
  128. package/test-env/components/selectable/selectable_list/selectable_list.js +16 -5
  129. package/test-env/components/steps/step.js +21 -12
  130. package/test-env/components/steps/step.styles.js +93 -0
  131. package/test-env/components/steps/step_horizontal.js +56 -41
  132. package/test-env/components/steps/step_horizontal.styles.js +66 -0
  133. package/test-env/components/steps/step_number.js +86 -75
  134. package/test-env/components/steps/step_number.styles.js +84 -0
  135. package/test-env/components/steps/steps_horizontal.js +12 -7
  136. package/test-env/components/steps/steps_horizontal.styles.js +38 -0
  137. package/test-env/components/steps/sub_steps.js +9 -1
  138. package/test-env/components/steps/sub_steps.styles.js +24 -0
  139. package/test-env/components/tour/tour_step_indicator.js +0 -3
  140. package/test-env/global_styling/utility/animations.js +6 -4
  141. package/src/components/steps/_index.scss +0 -7
  142. package/src/components/steps/_mixins.scss +0 -12
  143. package/src/components/steps/_step_number.scss +0 -52
  144. package/src/components/steps/_steps.scss +0 -57
  145. package/src/components/steps/_steps_horizontal.scss +0 -135
  146. package/src/components/steps/_sub_steps.scss +0 -15
  147. package/src/components/steps/_variables.scss +0 -11
  148. package/src/themes/amsterdam/global_styling/variables/_steps.scss +0 -8
  149. package/src/themes/amsterdam/overrides/_steps.scss +0 -101
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiStepNumberStyles = exports.euiStepNumberContentStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ var _step = require("./step.styles");
13
+
14
+ var _mixins = require("../../themes/amsterdam/global_styling/mixins");
15
+
16
+ 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)."; }
17
+
18
+ var _ref = process.env.NODE_ENV === "production" ? {
19
+ name: "76s2de-loading",
20
+ styles: "background:transparent;label:loading;"
21
+ } : {
22
+ name: "76s2de-loading",
23
+ styles: "background:transparent;label:loading;",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ };
26
+
27
+ var _ref2 = process.env.NODE_ENV === "production" ? {
28
+ name: "1ru1jeq-euiStepNumber",
29
+ styles: "flex-shrink:0;label:euiStepNumber;"
30
+ } : {
31
+ name: "1ru1jeq-euiStepNumber",
32
+ styles: "flex-shrink:0;label:euiStepNumber;",
33
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
34
+ };
35
+
36
+ var euiStepNumberStyles = function euiStepNumberStyles(euiThemeContext) {
37
+ var euiTheme = euiThemeContext.euiTheme;
38
+ var euiStep = (0, _step.euiStepVariables)(euiTheme);
39
+
40
+ var createStepsNumber = function createStepsNumber(size, fontSize) {
41
+ return "\n display: inline-block;\n line-height: ".concat(size, ";\n border-radius: ").concat(size, ";\n ").concat((0, _global_styling.logicalCSS)('width', size), ";\n ").concat((0, _global_styling.logicalCSS)('height', size), ";\n text-align: center;\n color: ").concat(euiTheme.colors.emptyShade, ";\n background-color: ").concat(euiTheme.colors.primary, ";\n font-size: ").concat(fontSize, ";\n font-weight: ").concat(euiTheme.font.weight.medium, ";\n ");
42
+ };
43
+
44
+ return {
45
+ euiStepNumber: _ref2,
46
+ // sizes
47
+ m: /*#__PURE__*/(0, _react.css)(createStepsNumber(euiStep.numberSize, (0, _global_styling.euiFontSizeFromScale)('s', euiTheme)), ";;label:m;"),
48
+ s: /*#__PURE__*/(0, _react.css)(createStepsNumber(euiStep.numberSize, (0, _global_styling.euiFontSizeFromScale)('s', euiTheme)), ";;label:s;"),
49
+ xs: /*#__PURE__*/(0, _react.css)(createStepsNumber(euiStep.numberXSSize, (0, _global_styling.euiFontSizeFromScale)('xs', euiTheme)), ";;label:xs;"),
50
+ // status
51
+ incomplete: /*#__PURE__*/(0, _react.css)("background-color:transparent;color:", euiTheme.colors.text, ";border:", euiTheme.border.thick, ";;label:incomplete;"),
52
+ disabled: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'disabled').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'disabled').backgroundColor, ";;label:disabled;"),
53
+ loading: _ref,
54
+ warning: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'warning').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'warning').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:warning;"),
55
+ danger: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'danger').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'danger').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:danger;"),
56
+ complete: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'success').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'success').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:complete;"),
57
+ current: /*#__PURE__*/(0, _react.css)(";label:current;")
58
+ };
59
+ };
60
+
61
+ exports.euiStepNumberStyles = euiStepNumberStyles;
62
+
63
+ var euiStepNumberContentStyles = function euiStepNumberContentStyles(_ref3) {
64
+ var euiTheme = _ref3.euiTheme;
65
+ return {
66
+ // Statuses with icon content
67
+ euiStepNumber__icon: /*#__PURE__*/(0, _react.css)("vertical-align:middle;position:relative;inset-block-start:-", euiTheme.border.width.thin, ";;label:euiStepNumber__icon;"),
68
+ complete: /*#__PURE__*/(0, _react.css)("stroke:currentColor;stroke-width:", (0, _global_styling.mathWithUnits)(euiTheme.border.width.thin, function (x) {
69
+ return x / 2;
70
+ }), ";;label:complete;"),
71
+ danger: /*#__PURE__*/(0, _react.css)("stroke:currentColor;stroke-width:", (0, _global_styling.mathWithUnits)(euiTheme.border.width.thin, function (x) {
72
+ return x / 2;
73
+ }), ";;label:danger;"),
74
+ warning: /*#__PURE__*/(0, _react.css)("inset-block-start:-", euiTheme.border.width.thick, ";;label:warning;"),
75
+ // Statuses with number content
76
+ euiStepNumber__number: /*#__PURE__*/(0, _react.css)(";label:euiStepNumber__number;"),
77
+ incomplete: /*#__PURE__*/(0, _react.css)("display:unset;position:relative;inset-block-start:-", euiTheme.border.width.thick, ";;label:incomplete;"),
78
+ loading: /*#__PURE__*/(0, _react.css)(";label:loading;"),
79
+ disabled: /*#__PURE__*/(0, _react.css)(";label:disabled;"),
80
+ current: /*#__PURE__*/(0, _react.css)(";label:current;")
81
+ };
82
+ };
83
+
84
+ exports.euiStepNumberContentStyles = euiStepNumberContentStyles;
@@ -13,6 +13,8 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  var _step_horizontal = require("./step_horizontal");
15
15
 
16
+ var _steps_horizontal = require("./steps_horizontal.styles");
17
+
16
18
  var _react2 = require("@emotion/react");
17
19
 
18
20
  var _excluded = ["className", "steps"];
@@ -31,16 +33,19 @@ var EuiStepsHorizontal = function EuiStepsHorizontal(_ref) {
31
33
  rest = _objectWithoutProperties(_ref, _excluded);
32
34
 
33
35
  var classes = (0, _classnames.default)('euiStepsHorizontal', className);
36
+ var styles = (0, _steps_horizontal.euiStepsHorizontalStyles)();
37
+ var cssStyles = styles.euiStepsHorizontal;
38
+ var cssItemStyles = styles.euiStepsHorizontal__item;
34
39
  return (0, _react2.jsx)("ol", _extends({
35
- className: classes
40
+ className: classes,
41
+ css: cssStyles
36
42
  }, rest), steps.map(function (stepProps, index) {
37
- var isCurrent = stepProps.status === 'current' ? {
38
- 'aria-current': 'step'
39
- } : {};
40
- return (0, _react2.jsx)("li", _extends({
43
+ return (0, _react2.jsx)("li", {
41
44
  key: index,
42
- className: "euiStepHorizontal__item"
43
- }, isCurrent), (0, _react2.jsx)(_step_horizontal.EuiStepHorizontal, _extends({
45
+ className: "euiStepsHorizontal__item",
46
+ css: cssItemStyles,
47
+ "aria-current": stepProps.status === 'current' ? 'step' : undefined
48
+ }, (0, _react2.jsx)(_step_horizontal.EuiStepHorizontal, _extends({
44
49
  step: index + 1
45
50
  }, stepProps)));
46
51
  }));
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiStepsHorizontalStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ 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)."; }
11
+
12
+ var _ref = process.env.NODE_ENV === "production" ? {
13
+ name: "1pmkwst-euiStepsHorizontal__item",
14
+ styles: "flex-grow:1;flex-basis:0%;&:first-of-type>.euiStepHorizontal::before,&:last-of-type>.euiStepHorizontal::after{display:none;};label:euiStepsHorizontal__item;"
15
+ } : {
16
+ name: "1pmkwst-euiStepsHorizontal__item",
17
+ styles: "flex-grow:1;flex-basis:0%;&:first-of-type>.euiStepHorizontal::before,&:last-of-type>.euiStepHorizontal::after{display:none;};label:euiStepsHorizontal__item;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+
21
+ var _ref2 = process.env.NODE_ENV === "production" ? {
22
+ name: "44yl7r-euiStepsHorizontal",
23
+ styles: "display:flex;align-items:stretch;label:euiStepsHorizontal;"
24
+ } : {
25
+ name: "44yl7r-euiStepsHorizontal",
26
+ styles: "display:flex;align-items:stretch;label:euiStepsHorizontal;",
27
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
28
+ };
29
+
30
+ // 1. Make each step the same width
31
+ var euiStepsHorizontalStyles = function euiStepsHorizontalStyles() {
32
+ return {
33
+ euiStepsHorizontal: _ref2,
34
+ euiStepsHorizontal__item: _ref
35
+ };
36
+ };
37
+
38
+ exports.euiStepsHorizontalStyles = euiStepsHorizontalStyles;
@@ -11,6 +11,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
+ var _services = require("../../services");
15
+
16
+ var _sub_steps = require("./sub_steps.styles");
17
+
14
18
  var _react2 = require("@emotion/react");
15
19
 
16
20
  var _excluded = ["children", "className"];
@@ -29,8 +33,12 @@ var EuiSubSteps = function EuiSubSteps(_ref) {
29
33
  rest = _objectWithoutProperties(_ref, _excluded);
30
34
 
31
35
  var classes = (0, _classnames.default)('euiSubSteps', className);
36
+ var euiTheme = (0, _services.useEuiTheme)();
37
+ var styles = (0, _sub_steps.euiSubStepsStyles)(euiTheme);
38
+ var cssStyles = [styles.euiSubSteps];
32
39
  return (0, _react2.jsx)("div", _extends({
33
- className: classes
40
+ className: classes,
41
+ css: cssStyles
34
42
  }, rest), children);
35
43
  };
36
44
 
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiSubStepsStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ var euiSubStepsStyles = function euiSubStepsStyles(_ref) {
18
+ var euiTheme = _ref.euiTheme;
19
+ return {
20
+ euiSubSteps: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.base, ";background-color:", euiTheme.colors.lightestShade, ";margin-block-end:", euiTheme.size.base, ";>*:last-child{margin-block-end:0;}& ol,.euiText & ol{list-style-type:lower-alpha;};label:euiSubSteps;")
21
+ };
22
+ };
23
+
24
+ exports.euiSubStepsStyles = euiSubStepsStyles;
@@ -54,7 +54,6 @@ var EuiTourStepIndicator = function EuiTourStepIndicator(_ref2) {
54
54
  }, function (isActive) {
55
55
  return (0, _react2.jsx)(_icon.EuiIcon, {
56
56
  type: "dot",
57
- className: "euiStepNumber__icon",
58
57
  "aria-label": isActive,
59
58
  color: "success",
60
59
  "aria-current": "step"
@@ -67,7 +66,6 @@ var EuiTourStepIndicator = function EuiTourStepIndicator(_ref2) {
67
66
  }, function (isComplete) {
68
67
  return (0, _react2.jsx)(_icon.EuiIcon, {
69
68
  type: "dot",
70
- className: "euiStepNumber__icon",
71
69
  "aria-label": isComplete,
72
70
  color: "subdued"
73
71
  });
@@ -79,7 +77,6 @@ var EuiTourStepIndicator = function EuiTourStepIndicator(_ref2) {
79
77
  }, function (isIncomplete) {
80
78
  return (0, _react2.jsx)(_icon.EuiIcon, {
81
79
  type: "dot",
82
- className: "euiStepNumber__icon",
83
80
  "aria-label": isIncomplete,
84
81
  color: "subdued"
85
82
  });
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.euiAnimSlideX = exports.euiAnimSlideInUp = exports.euiAnimFadeIn = void 0;
6
+ exports.euiAnimSlideX = exports.euiAnimSlideInUp = exports.euiAnimScale = exports.euiAnimFadeIn = void 0;
7
7
 
8
8
  var _react = require("@emotion/react");
9
9
 
10
- var _templateObject, _templateObject2, _templateObject3;
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
11
11
 
12
12
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
13
 
@@ -21,7 +21,9 @@ var euiAnimSlideInUp = function euiAnimSlideInUp(size) {
21
21
  exports.euiAnimSlideInUp = euiAnimSlideInUp;
22
22
 
23
23
  var euiAnimSlideX = function euiAnimSlideX(size) {
24
- return (0, _react.keyframes)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(", ");\n }\n\n 100% {\n transform: translateX(0);\n }\n"])), size);
24
+ return (0, _react.keyframes)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(", ");\n }\n\n 100% {\n transform: translateX(0);\n\n }\n"])), size);
25
25
  };
26
26
 
27
- exports.euiAnimSlideX = euiAnimSlideX;
27
+ exports.euiAnimSlideX = euiAnimSlideX;
28
+ var euiAnimScale = (0, _react.keyframes)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n }\n\n 1% {\n opacity: 0;\n transform: scale(0);\n }\n\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n"])));
29
+ exports.euiAnimScale = euiAnimScale;
@@ -0,0 +1,79 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+ import React, { useState } from 'react';
12
+ import { useEuiTheme } from '../../services';
13
+ import { useEuiI18n } from '../i18n';
14
+ import { EuiPopover } from '../popover';
15
+ import { EuiIcon } from '../icon';
16
+ import { useEuiButtonFocusCSS } from '../../themes/amsterdam/global_styling/mixins/button';
17
+ import { euiCodeBlockAnnotationsStyles } from './code_block_annotations.style';
18
+ import { jsx as ___EmotionJSX } from "@emotion/react";
19
+ export var EuiCodeBlockAnnotation = function EuiCodeBlockAnnotation(_ref) {
20
+ var lineNumber = _ref.lineNumber,
21
+ children = _ref.children;
22
+
23
+ var _useState = useState(false),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ isOpen = _useState2[0],
26
+ setIsOpen = _useState2[1];
27
+
28
+ var ariaLabel = useEuiI18n('euiCodeBlockAnnotations.ariaLabel', 'Click to view a code annotation for line {lineNumber}', {
29
+ lineNumber: lineNumber
30
+ });
31
+
32
+ var _useEuiTheme = useEuiTheme(),
33
+ euiTheme = _useEuiTheme.euiTheme,
34
+ colorMode = _useEuiTheme.colorMode;
35
+
36
+ var styles = euiCodeBlockAnnotationsStyles(euiTheme);
37
+ var buttonIconFocusStyle = useEuiButtonFocusCSS();
38
+ var cssButtonIconStyles = [styles.euiCodeBlockAnnotation__buttonIcon, buttonIconFocusStyle];
39
+ var isDarkMode = colorMode === 'DARK';
40
+ return ___EmotionJSX(EuiPopover, {
41
+ isOpen: isOpen,
42
+ closePopover: function closePopover() {
43
+ return setIsOpen(false);
44
+ },
45
+ button: ___EmotionJSX("button", {
46
+ onClick: function onClick() {
47
+ return setIsOpen(!isOpen);
48
+ },
49
+ "aria-label": ariaLabel,
50
+ css: cssButtonIconStyles,
51
+ "data-test-subj": "euiCodeBlockAnnotationIcon"
52
+ }, ___EmotionJSX(EuiIcon, {
53
+ type: AnnotationInfoIcon,
54
+ size: "s",
55
+ color: isDarkMode ? euiTheme.colors.ink : 'ghost'
56
+ })),
57
+ css: styles.euiCodeBlockAnnotation,
58
+ zIndex: Number(euiTheme.levels.mask) + 1 // Ensure fullscreen annotation popovers sit above the mask
59
+ ,
60
+ anchorPosition: "leftCenter",
61
+ panelProps: {
62
+ 'data-test-subj': 'euiCodeBlockAnnotationPopover'
63
+ }
64
+ }, children);
65
+ };
66
+
67
+ var AnnotationInfoIcon = function AnnotationInfoIcon(props) {
68
+ return ___EmotionJSX("svg", _extends({
69
+ width: 11,
70
+ height: 11,
71
+ viewBox: "0 0 16 16",
72
+ fill: "none",
73
+ xmlns: "http://www.w3.org/2000/svg"
74
+ }, props), ___EmotionJSX("path", {
75
+ fillRule: "evenodd",
76
+ clipRule: "evenodd",
77
+ d: "M7.139 14l-.052-6.007H5V6.28h4.111l.052 6.007h1.915V14h-3.94zM6.712 3.38c0-.396.118-.725.354-.987S7.639 2 8.077 2c.438 0 .777.131 1.016.393.24.262.359.591.359.987 0 .39-.12.714-.359.972s-.578.388-1.016.388c-.438 0-.775-.13-1.011-.388-.236-.258-.354-.582-.354-.972z"
78
+ }));
79
+ };
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { css } from '@emotion/react';
9
+ import { logicalCSS, logicalSizeCSS, mathWithUnits } from '../../global_styling';
10
+ export var euiCodeBlockAnnotationsStyles = function euiCodeBlockAnnotationsStyles(euiTheme) {
11
+ var buttonIconSize = mathWithUnits(euiTheme.size.base, function (x) {
12
+ return x - 1.5;
13
+ });
14
+ return {
15
+ euiCodeBlockAnnotation: /*#__PURE__*/css("position:absolute;", logicalCSS('right', 0), " ", logicalCSS('top', '50%'), " transform:translate(50%, -50%);line-height:1;;label:euiCodeBlockAnnotation;"),
16
+ euiCodeBlockAnnotation__buttonIcon: /*#__PURE__*/css(logicalSizeCSS(buttonIconSize), " display:flex;align-items:center;justify-content:center;background-color:", euiTheme.colors.primary, ";border-radius:50%;;label:euiCodeBlockAnnotation__buttonIcon;")
17
+ };
18
+ };
@@ -35,9 +35,15 @@ export var useFullScreen = function useFullScreen(_ref) {
35
35
  }, []);
36
36
  var onKeyDown = useCallback(function (event) {
37
37
  if (event.key === keys.ESCAPE) {
38
- event.preventDefault();
39
- event.stopPropagation();
40
- setIsFullScreen(false);
38
+ // We need to make sure annotation Escape keypresses don't also cause fullscreen mode to close
39
+ var focus = document.activeElement;
40
+ var isAnnotationPopover = !!(focus !== null && focus !== void 0 && focus.dataset.popoverOpen) || !!(focus !== null && focus !== void 0 && focus.closest('[data-popover-open]'));
41
+
42
+ if (!isAnnotationPopover) {
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ setIsFullScreen(false);
46
+ }
41
47
  }
42
48
  }, []);
43
49
 
@@ -39,11 +39,12 @@ export var euiCodeBlockLineStyles = function euiCodeBlockLineStyles(euiThemeCont
39
39
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
40
  }),
41
41
  lineText: {
42
- euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.s, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
42
+ euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.m, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
43
43
  isHighlighted: /*#__PURE__*/css("background:", euiBackgroundColor(euiThemeContext, 'primary'), ";border-inline-start:", euiTheme.border.width.thick, " solid ", euiTheme.colors.primary, ";;label:isHighlighted;")
44
44
  },
45
45
  lineNumber: {
46
- euiCodeBlock__lineNumber: /*#__PURE__*/css("flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.s, ";box-sizing:content-box;&:before{content:attr(data-line-number);color:", euiTheme.colors.subduedText, ";text-align:end;display:block;};label:euiCodeBlock__lineNumber;")
46
+ euiCodeBlock__lineNumberWrapper: /*#__PURE__*/css("position:relative;flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.m, ";box-sizing:content-box;;label:euiCodeBlock__lineNumberWrapper;"),
47
+ euiCodeBlock__lineNumber: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";text-align:end;display:block;;label:euiCodeBlock__lineNumber;")
47
48
  }
48
49
  };
49
50
  };
@@ -14,6 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
14
  import React, { createElement } from 'react';
15
15
  import { listLanguages, highlight } from 'refractor';
16
16
  import { cx } from '@emotion/css';
17
+ import { EuiCodeBlockAnnotation } from './code_block_annotations';
17
18
  import { euiCodeBlockLineStyles } from './code_block_line.styles';
18
19
  /**
19
20
  * Utils shared between EuiCode and EuiCodeBlock
@@ -47,7 +48,15 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
47
48
  key: key,
48
49
  className: cx(properties.className)
49
50
  }), children && children.map(function (el, i) {
50
- return nodeToHtml(el, i, nodes, depth + 1);
51
+ return (// @ts-ignore - using a custom type here to handle JSX annotations
52
+ el.type === 'annotation' ? // @ts-ignore - custom keys are passed by annotationElement below
53
+ ___EmotionJSX(EuiCodeBlockAnnotation, {
54
+ lineNumber: el.lineNumber,
55
+ children: el.annotation,
56
+ key: i
57
+ }) // prettier-ignore
58
+ : nodeToHtml(el, i, nodes, depth + 1)
59
+ );
51
60
  }));
52
61
  }
53
62
 
@@ -151,31 +160,61 @@ function wrapLines(nodes, options, euiTheme) {
151
160
  var lineStyles = cx([styles.euiCodeBlock__line, options.showLineNumbers && styles.hasLineNumbers]);
152
161
 
153
162
  if (options.showLineNumbers) {
154
- var _properties;
163
+ var _properties, _options$annotations;
155
164
 
156
165
  var lineNumber = i + 1;
157
166
  var digits = grouped.length.toString().length;
158
- var width = digits * CHAR_SIZE;
167
+ var width = digits * CHAR_SIZE; // Line text element and highlights
168
+
159
169
  var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
160
170
  var lineTextStyles = cx([styles.lineText.euiCodeBlock__lineText, highlights.includes(lineNumber) && styles.lineText.isHighlighted]);
161
- var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
162
- children = [{
171
+ var lineTextElement = {
172
+ type: 'element',
173
+ tagName: 'span',
174
+ properties: {
175
+ className: ['euiCodeBlock__lineText', lineTextStyles]
176
+ },
177
+ children: node
178
+ }; // Line number column/wrapper
179
+
180
+ var lineNumberWrapperStyles = cx(styles.lineNumber.euiCodeBlock__lineNumberWrapper);
181
+ var lineNumberWrapperElement = {
163
182
  type: 'element',
164
183
  tagName: 'span',
165
184
  properties: (_properties = {
166
185
  style: {
167
186
  inlineSize: width
168
187
  }
169
- }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, 'aria-hidden', true), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberStyles]), _properties),
188
+ }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberWrapperStyles]), _properties),
170
189
  children: []
171
- }, {
190
+ }; // Line number element
191
+
192
+ var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
193
+ var lineNumberElement = {
172
194
  type: 'element',
173
195
  tagName: 'span',
174
- properties: {
175
- className: ['euiCodeBlock__lineText', lineTextStyles]
176
- },
177
- children: node
178
- }];
196
+ properties: _defineProperty({
197
+ className: [lineNumberStyles]
198
+ }, 'aria-hidden', true),
199
+ children: [{
200
+ type: 'text',
201
+ value: String(lineNumber)
202
+ }]
203
+ };
204
+ lineNumberWrapperElement.children.push(lineNumberElement); // Annotation element
205
+
206
+ var hasAnnotation = (_options$annotations = options.annotations) === null || _options$annotations === void 0 ? void 0 : _options$annotations.hasOwnProperty(lineNumber);
207
+
208
+ if (hasAnnotation) {
209
+ var annotationElement = {
210
+ type: 'annotation',
211
+ annotation: options.annotations[lineNumber],
212
+ lineNumber: lineNumber
213
+ };
214
+ lineNumberWrapperElement.children.push(annotationElement);
215
+ }
216
+
217
+ children = [lineNumberWrapperElement, lineTextElement];
179
218
  }
180
219
 
181
220
  wrapped.push({
@@ -195,6 +234,7 @@ export var highlightByLine = function highlightByLine(children, language, data,
195
234
  lineNumber: data.start
196
235
  }), {
197
236
  showLineNumbers: data.show,
198
- highlight: data.highlight
237
+ highlight: data.highlight,
238
+ annotations: data.annotations
199
239
  }, euiTheme);
200
240
  };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["id", "children", "className", "isDocked", "isOpen", "button", "showButtonIfDocked", "dockedBreakpoint", "as", "size", "side", "role", "ownFocus", "outsideClickCloses", "closeButtonPosition", "paddingSize", "focusTrapProps"];
5
+ var _excluded = ["id", "children", "className", "isDocked", "isOpen", "button", "showButtonIfDocked", "dockedBreakpoint", "as", "size", "side", "ownFocus", "outsideClickCloses", "closeButtonPosition", "paddingSize", "focusTrapProps"];
6
6
 
7
7
  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; }
8
8
 
@@ -40,8 +40,6 @@ export var EuiCollapsibleNav = function EuiCollapsibleNav(_ref) {
40
40
  size = _ref$size === void 0 ? 320 : _ref$size,
41
41
  _ref$side = _ref.side,
42
42
  side = _ref$side === void 0 ? 'left' : _ref$side,
43
- _ref$role = _ref.role,
44
- role = _ref$role === void 0 ? null : _ref$role,
45
43
  _ref$ownFocus = _ref.ownFocus,
46
44
  ownFocus = _ref$ownFocus === void 0 ? true : _ref$ownFocus,
47
45
  _ref$outsideClickClos = _ref.outsideClickCloses,
@@ -91,7 +89,6 @@ export var EuiCollapsibleNav = function EuiCollapsibleNav(_ref) {
91
89
  as: as,
92
90
  size: size,
93
91
  side: side,
94
- role: role,
95
92
  ownFocus: ownFocus,
96
93
  outsideClickCloses: outsideClickCloses,
97
94
  closeButtonPosition: closeButtonPosition,