@elastic/eui 106.1.0 → 106.2.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 (67) hide show
  1. package/es/components/call_out/call_out.js +2 -1
  2. package/es/components/card/checkable_card/checkable_card.js +30 -5
  3. package/es/components/code/code_block.js +5 -2
  4. package/es/components/code/code_block_virtualized.js +5 -3
  5. package/es/components/markdown_editor/index.js +1 -0
  6. package/es/components/markdown_editor/markdown_editor.js +15 -4
  7. package/es/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
  8. package/es/components/markdown_editor/markdown_editor_footer.js +12 -120
  9. package/es/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
  10. package/es/components/markdown_editor/markdown_editor_help_button.js +144 -0
  11. package/es/components/markdown_editor/markdown_editor_help_button.styles.js +16 -0
  12. package/es/components/markdown_editor/markdown_editor_toolbar.js +28 -23
  13. package/es/components/popover/popover.js +2 -1
  14. package/eui.d.ts +84 -52
  15. package/i18ntokens.json +624 -624
  16. package/lib/components/call_out/call_out.js +3 -2
  17. package/lib/components/card/checkable_card/checkable_card.js +29 -4
  18. package/lib/components/code/code_block.js +5 -2
  19. package/lib/components/code/code_block_virtualized.js +5 -3
  20. package/lib/components/markdown_editor/index.js +7 -0
  21. package/lib/components/markdown_editor/markdown_editor.js +15 -4
  22. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
  23. package/lib/components/markdown_editor/markdown_editor_footer.js +10 -117
  24. package/lib/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
  25. package/lib/components/markdown_editor/markdown_editor_help_button.js +151 -0
  26. package/lib/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
  27. package/lib/components/markdown_editor/markdown_editor_toolbar.js +28 -23
  28. package/lib/components/popover/popover.js +2 -1
  29. package/optimize/es/components/call_out/call_out.js +1 -0
  30. package/optimize/es/components/card/checkable_card/checkable_card.js +25 -5
  31. package/optimize/es/components/code/code_block.js +5 -2
  32. package/optimize/es/components/code/code_block_virtualized.js +5 -3
  33. package/optimize/es/components/markdown_editor/index.js +1 -0
  34. package/optimize/es/components/markdown_editor/markdown_editor.js +7 -3
  35. package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +3 -2
  36. package/optimize/es/components/markdown_editor/markdown_editor_footer.js +12 -120
  37. package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
  38. package/optimize/es/components/markdown_editor/markdown_editor_help_button.js +139 -0
  39. package/optimize/es/components/markdown_editor/markdown_editor_help_button.styles.js +16 -0
  40. package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +20 -16
  41. package/optimize/es/components/popover/popover.js +2 -1
  42. package/optimize/lib/components/call_out/call_out.js +2 -1
  43. package/optimize/lib/components/card/checkable_card/checkable_card.js +24 -4
  44. package/optimize/lib/components/code/code_block.js +5 -2
  45. package/optimize/lib/components/code/code_block_virtualized.js +5 -3
  46. package/optimize/lib/components/markdown_editor/index.js +7 -0
  47. package/optimize/lib/components/markdown_editor/markdown_editor.js +7 -3
  48. package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +3 -2
  49. package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +9 -118
  50. package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
  51. package/optimize/lib/components/markdown_editor/markdown_editor_help_button.js +150 -0
  52. package/optimize/lib/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
  53. package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +20 -16
  54. package/optimize/lib/components/popover/popover.js +2 -1
  55. package/package.json +1 -1
  56. package/test-env/components/call_out/call_out.js +3 -2
  57. package/test-env/components/card/checkable_card/checkable_card.js +24 -4
  58. package/test-env/components/code/code_block_virtualized.js +5 -3
  59. package/test-env/components/markdown_editor/index.js +7 -0
  60. package/test-env/components/markdown_editor/markdown_editor.js +15 -4
  61. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
  62. package/test-env/components/markdown_editor/markdown_editor_footer.js +9 -118
  63. package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
  64. package/test-env/components/markdown_editor/markdown_editor_help_button.js +150 -0
  65. package/test-env/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
  66. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +28 -23
  67. package/test-env/components/popover/popover.js +2 -1
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.EuiMarkdownEditorHelpButton = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _services = require("../../services");
10
+ var _button = require("../button");
11
+ var _title = require("../title");
12
+ var _modal = require("../modal");
13
+ var _i18n = require("../i18n");
14
+ var _popover = require("../popover");
15
+ var _text = require("../text");
16
+ var _spacer = require("../spacer");
17
+ var _tool_tip = require("../tool_tip");
18
+ var _horizontal_rule = require("../horizontal_rule");
19
+ var _link = require("../link");
20
+ var _markdown_context = require("./markdown_context");
21
+ var _markdown_logo = _interopRequireDefault(require("./icons/markdown_logo"));
22
+ var _markdown_editor_help_button = require("./markdown_editor_help_button.styles");
23
+ var _react2 = require("@emotion/react");
24
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
28
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
30
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
31
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
32
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
33
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
34
+ * or more contributor license agreements. Licensed under the Elastic License
35
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
36
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
37
+ * Side Public License, v 1.
38
+ */ // @ts-ignore a react svg
39
+ var mdSyntaxHref = 'https://guides.github.com/features/mastering-markdown/';
40
+ var mdSyntaxLink = (0, _react2.jsx)(_link.EuiLink, {
41
+ href: mdSyntaxHref,
42
+ target: "_blank"
43
+ }, (0, _react2.jsx)(_i18n.EuiI18n, {
44
+ token: "euiMarkdownEditorHelpButton.mdSyntaxLink",
45
+ default: "GitHub flavored markdown"
46
+ }));
47
+ var EuiMarkdownEditorHelpButton = exports.EuiMarkdownEditorHelpButton = function EuiMarkdownEditorHelpButton(_ref) {
48
+ var uiPlugins = _ref.uiPlugins;
49
+ var _useState = (0, _react.useState)(false),
50
+ _useState2 = _slicedToArray(_useState, 2),
51
+ isShowingHelpModal = _useState2[0],
52
+ setIsShowingHelpModal = _useState2[1];
53
+ var _useState3 = (0, _react.useState)(false),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ isShowingHelpPopover = _useState4[0],
56
+ setIsShowingHelpPopover = _useState4[1];
57
+ var _useContext = (0, _react.useContext)(_markdown_context.EuiMarkdownContext),
58
+ readOnly = _useContext.readOnly;
59
+ var styles = (0, _services.useEuiMemoizedStyles)(_markdown_editor_help_button.euiMarkdownEditorHelpButtonStyles);
60
+ var syntaxTitle = (0, _i18n.useEuiI18n)('euiMarkdownEditorHelpButton.syntaxTitle', 'Syntax help');
61
+ var ariaLabels = {
62
+ showMarkdownHelp: (0, _i18n.useEuiI18n)('euiMarkdownEditorHelpButton.showMarkdownHelp', 'Show markdown help')
63
+ };
64
+ var helpModalTitleId = (0, _services.useGeneratedHtmlId)();
65
+ var uiPluginsWithHelpText = uiPlugins.filter(function (_ref2) {
66
+ var helpText = _ref2.helpText;
67
+ return !!helpText;
68
+ });
69
+ var hasUiPluginsWithHelpText = uiPluginsWithHelpText.length > 0;
70
+ if (hasUiPluginsWithHelpText) {
71
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_tool_tip.EuiToolTip, {
72
+ content: syntaxTitle
73
+ }, (0, _react2.jsx)(_button.EuiButtonIcon, {
74
+ size: "s",
75
+ css: styles.euiMarkdownEditorFooter__helpButton,
76
+ className: "euiMarkdownEditorFooter__helpButton",
77
+ iconType: _markdown_logo.default,
78
+ color: "text",
79
+ "aria-label": ariaLabels.showMarkdownHelp,
80
+ onClick: function onClick() {
81
+ return setIsShowingHelpModal(!isShowingHelpModal);
82
+ },
83
+ isDisabled: readOnly
84
+ })), isShowingHelpModal && (0, _react2.jsx)(_modal.EuiModal, {
85
+ onClose: function onClose() {
86
+ return setIsShowingHelpModal(false);
87
+ },
88
+ "aria-labelledby": helpModalTitleId
89
+ }, (0, _react2.jsx)(_modal.EuiModalHeader, null, (0, _react2.jsx)(_title.EuiTitle, null, (0, _react2.jsx)("h1", {
90
+ id: helpModalTitleId
91
+ }, syntaxTitle))), (0, _react2.jsx)(_modal.EuiModalBody, null, (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)(_i18n.EuiI18n, {
92
+ tokens: ['euiMarkdownEditorHelpButton.syntaxModalDescriptionPrefix', 'euiMarkdownEditorHelpButton.syntaxModalDescriptionSuffix'],
93
+ defaults: ['This editor uses', 'You can also utilize these additional syntax plugins to add rich content to your text.']
94
+ }, function (_ref3) {
95
+ var _ref4 = _slicedToArray(_ref3, 2),
96
+ syntaxModalDescriptionPrefix = _ref4[0],
97
+ syntaxModalDescriptionSuffix = _ref4[1];
98
+ return (0, _react2.jsx)("p", null, syntaxModalDescriptionPrefix, " ", mdSyntaxLink, ".", ' ', syntaxModalDescriptionSuffix);
99
+ })), (0, _react2.jsx)(_horizontal_rule.EuiHorizontalRule, null), uiPluginsWithHelpText.map(function (_ref5) {
100
+ var name = _ref5.name,
101
+ helpText = _ref5.helpText;
102
+ return (0, _react2.jsx)(_react.Fragment, {
103
+ key: name
104
+ }, (0, _react2.jsx)(_title.EuiTitle, {
105
+ size: "xxs"
106
+ }, (0, _react2.jsx)("p", null, (0, _react2.jsx)("strong", null, name))), (0, _react2.jsx)(_spacer.EuiSpacer, {
107
+ size: "s"
108
+ }), helpText, (0, _react2.jsx)(_spacer.EuiSpacer, {
109
+ size: "l"
110
+ }));
111
+ }), (0, _react2.jsx)(_horizontal_rule.EuiHorizontalRule, null)), (0, _react2.jsx)(_modal.EuiModalFooter, null, (0, _react2.jsx)(_button.EuiButton, {
112
+ onClick: function onClick() {
113
+ return setIsShowingHelpModal(false);
114
+ },
115
+ fill: true
116
+ }, (0, _react2.jsx)(_i18n.EuiI18n, {
117
+ token: "euiMarkdownEditorHelpButton.closeButton",
118
+ default: "Close"
119
+ })))));
120
+ } else {
121
+ return (0, _react2.jsx)(_popover.EuiPopover, {
122
+ button: (0, _react2.jsx)(_button.EuiButtonIcon, {
123
+ title: syntaxTitle,
124
+ size: "s",
125
+ css: styles.euiMarkdownEditorFooter__helpButton,
126
+ className: "euiMarkdownEditorFooter__helpButton",
127
+ iconType: _markdown_logo.default,
128
+ color: "text",
129
+ "aria-label": ariaLabels.showMarkdownHelp,
130
+ onClick: function onClick() {
131
+ return setIsShowingHelpPopover(!isShowingHelpPopover);
132
+ }
133
+ }),
134
+ isOpen: isShowingHelpPopover,
135
+ closePopover: function closePopover() {
136
+ return setIsShowingHelpPopover(false);
137
+ },
138
+ panelPaddingSize: "s",
139
+ anchorPosition: "upCenter",
140
+ "aria-labelledby": helpModalTitleId
141
+ }, (0, _react2.jsx)(_i18n.EuiI18n, {
142
+ tokens: ['euiMarkdownEditorHelpButton.syntaxPopoverDescription'],
143
+ defaults: ['This editor uses']
144
+ }, function (_ref6) {
145
+ var _ref7 = _slicedToArray(_ref6, 1),
146
+ syntaxPopoverDescription = _ref7[0];
147
+ return (0, _react2.jsx)("p", null, syntaxPopoverDescription, " ", mdSyntaxLink, ".");
148
+ }));
149
+ }
150
+ };
151
+ EuiMarkdownEditorHelpButton.displayName = 'EuiMarkdownEditorHelpButton';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiMarkdownEditorHelpButtonStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _global_styling = require("../../global_styling");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ var euiMarkdownEditorHelpButtonStyles = exports.euiMarkdownEditorHelpButtonStyles = function euiMarkdownEditorHelpButtonStyles() {
18
+ return {
19
+ // Override the default button icon width size
20
+ euiMarkdownEditorFooter__helpButton: /*#__PURE__*/(0, _react.css)(".euiIcon{", (0, _global_styling.logicalCSS)('width', '26px'), ";};label:euiMarkdownEditorFooter__helpButton;")
21
+ };
22
+ };
@@ -99,7 +99,8 @@ var EuiMarkdownEditorToolbar = exports.EuiMarkdownEditorToolbar = /*#__PURE__*/(
99
99
  viewMode = _ref2.viewMode,
100
100
  onClickPreview = _ref2.onClickPreview,
101
101
  uiPlugins = _ref2.uiPlugins,
102
- selectedNode = _ref2.selectedNode;
102
+ selectedNode = _ref2.selectedNode,
103
+ right = _ref2.right;
103
104
  var _useContext = (0, _react.useContext)(_markdown_context.EuiMarkdownContext),
104
105
  openPluginEditor = _useContext.openPluginEditor,
105
106
  readOnly = _useContext.readOnly;
@@ -186,27 +187,11 @@ var EuiMarkdownEditorToolbar = exports.EuiMarkdownEditorToolbar = /*#__PURE__*/(
186
187
  label: button.label,
187
188
  icon: button.iconType
188
189
  }));
189
- })) : null), isPreviewing ? (0, _react2.jsx)(_button.EuiButtonEmpty, {
190
- "data-test-subj": "markdown_editor_edit_button",
191
- iconType: "code",
192
- color: "text",
193
- size: "s",
194
- onClick: onClickPreview,
195
- isDisabled: readOnly
196
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
197
- token: "euiMarkdownEditorToolbar.editor",
198
- default: "Editor"
199
- })) : (0, _react2.jsx)(_button.EuiButtonEmpty, {
200
- "data-test-subj": "markdown_editor_preview_button",
201
- iconType: "eye",
202
- color: "text",
203
- size: "s",
204
- onClick: onClickPreview,
205
- isDisabled: readOnly
206
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
207
- token: "euiMarkdownEditorToolbar.previewMarkdown",
208
- default: "Preview"
209
- })));
190
+ })) : null), right !== null && right !== void 0 ? right : (0, _react2.jsx)(PreviewEditorSwitch, {
191
+ isPreviewing: isPreviewing,
192
+ onClickPreview: onClickPreview,
193
+ readOnly: readOnly
194
+ }));
210
195
  });
211
196
  EuiMarkdownEditorToolbar.propTypes = {
212
197
  className: _propTypes.default.string,
@@ -239,6 +224,26 @@ EuiMarkdownEditorToolbar.propTypes = {
239
224
  trimFirst: _propTypes.default.bool
240
225
  }),
241
226
  editor: _propTypes.default.elementType
242
- }).isRequired).isRequired
227
+ }).isRequired).isRequired,
228
+ right: _propTypes.default.node
229
+ };
230
+ var PreviewEditorSwitch = function PreviewEditorSwitch(_ref4) {
231
+ var isPreviewing = _ref4.isPreviewing,
232
+ onClickPreview = _ref4.onClickPreview,
233
+ readOnly = _ref4.readOnly;
234
+ return (0, _react2.jsx)(_button.EuiButtonEmpty, {
235
+ iconType: isPreviewing ? 'code' : 'eye',
236
+ color: "text",
237
+ size: "s",
238
+ onClick: onClickPreview,
239
+ isDisabled: readOnly,
240
+ "data-test-subj": isPreviewing ? 'markdown_editor_preview_button' : 'markdown_editor_edit_button'
241
+ }, isPreviewing ? (0, _react2.jsx)(_i18n.EuiI18n, {
242
+ token: "euiMarkdownEditorToolbar.editor",
243
+ default: "Editor"
244
+ }) : (0, _react2.jsx)(_i18n.EuiI18n, {
245
+ token: "euiMarkdownEditorToolbar.previewMarkdown",
246
+ default: "Preview"
247
+ }));
243
248
  };
244
249
  EuiMarkdownEditorToolbar.displayName = 'EuiMarkdownEditorToolbar';
@@ -171,7 +171,8 @@ var EuiPopover = exports.EuiPopover = /*#__PURE__*/function (_Component) {
171
171
  // transition can take effect.
172
172
  _this.closingTransitionAnimationFrame = window.requestAnimationFrame(function () {
173
173
  _this.setState({
174
- isOpening: true
174
+ isOpening: true,
175
+ isClosing: false
175
176
  });
176
177
  });
177
178
 
@@ -24,6 +24,7 @@ import { euiCallOutStyles, euiCallOutHeaderStyles } from './call_out.styles';
24
24
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
25
  export var COLORS = ['primary', 'success', 'warning', 'danger', 'accent'];
26
26
  export var HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
27
+ export var SIZES = ['s', 'm'];
27
28
  export var EuiCallOut = /*#__PURE__*/forwardRef(function (_ref, ref) {
28
29
  var title = _ref.title,
29
30
  _ref$color = _ref.color,
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  var _excluded = ["children", "className", "css", "checkableType", "label", "labelProps", "checked", "disabled", "hasShadow", "hasBorder"];
4
5
  /*
@@ -9,8 +10,9 @@ var _excluded = ["children", "className", "css", "checkableType", "label", "labe
9
10
  * Side Public License, v 1.
10
11
  */
11
12
 
12
- import React, { useRef } from 'react';
13
+ import React, { useEffect, useRef, useState } from 'react';
13
14
  import classNames from 'classnames';
15
+ import { tabbable } from 'tabbable';
14
16
  import { EuiRadio, EuiCheckbox } from '../../form';
15
17
  import { EuiSplitPanel } from '../../panel';
16
18
  import { useEuiTheme } from '../../../services';
@@ -42,7 +44,16 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
42
44
  var id = rest.id;
43
45
  var labelEl = useRef(null);
44
46
  var inputEl = useRef(null);
47
+ var childrenWrapperEl = useRef(null);
45
48
  var classes = classNames('euiCheckableCard', className);
49
+ var _useState = useState(false),
50
+ _useState2 = _slicedToArray(_useState, 2),
51
+ hasInteractiveChildren = _useState2[0],
52
+ setHasInteractiveChildren = _useState2[1];
53
+ useEffect(function () {
54
+ var interactiveElements = childrenWrapperEl.current ? tabbable(childrenWrapperEl.current) : [];
55
+ setHasInteractiveChildren(interactiveElements.length > 0);
56
+ }, [children, childrenWrapperEl]);
46
57
  var checkableElement;
47
58
  if (checkableType === 'radio') {
48
59
  checkableElement = ___EmotionJSX(EuiRadio, _extends({
@@ -58,9 +69,13 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
58
69
  }
59
70
  var labelClasses = classNames('euiCheckableCard__label');
60
71
  var onChangeAffordance = function onChangeAffordance(e) {
61
- if (labelEl.current && e.target !== inputEl.current) {
62
- labelEl.current.click();
63
- }
72
+ if (!labelEl.current || e.target === inputEl.current) return;
73
+ labelEl.current.click();
74
+ };
75
+ var onChildrenClick = function onChildrenClick() {
76
+ var _labelEl$current;
77
+ if (hasInteractiveChildren) return;
78
+ (_labelEl$current = labelEl.current) === null || _labelEl$current === void 0 || _labelEl$current.click();
64
79
  };
65
80
  return ___EmotionJSX(EuiSplitPanel.Outer, {
66
81
  responsive: false,
@@ -81,8 +96,13 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
81
96
  htmlFor: id,
82
97
  "aria-describedby": children ? "".concat(id, "-details") : undefined
83
98
  }), label), children && ___EmotionJSX("div", {
99
+ ref: childrenWrapperEl,
84
100
  id: "".concat(id, "-details"),
85
101
  className: "euiCheckableCard__children",
86
- css: childStyles
102
+ css: childStyles,
103
+ onClick: disabled ? undefined : onChildrenClick,
104
+ style: {
105
+ cursor: !disabled && !hasInteractiveChildren ? 'pointer' : undefined
106
+ }
87
107
  }, children)));
88
108
  };
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _typeof from "@babel/runtime/helpers/typeof";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- var _excluded = ["language", "transparentBackground", "paddingSize", "fontSize", "isCopyable", "copyAriaLabel", "whiteSpace", "children", "className", "overflowHeight", "isVirtualized", "lineNumbers"];
6
+ var _excluded = ["language", "transparentBackground", "paddingSize", "fontSize", "isCopyable", "copyAriaLabel", "whiteSpace", "children", "className", "overflowHeight", "isVirtualized", "lineNumbers", "aria-label"];
7
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
9
  /*
@@ -59,6 +59,7 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
59
59
  _isVirtualized = _ref.isVirtualized,
60
60
  _ref$lineNumbers = _ref.lineNumbers,
61
61
  lineNumbers = _ref$lineNumbers === void 0 ? false : _ref$lineNumbers,
62
+ ariaLabel = _ref['aria-label'],
62
63
  rest = _objectWithoutProperties(_ref, _excluded);
63
64
  var euiTheme = useEuiTheme();
64
65
  var language = useMemo(function () {
@@ -150,13 +151,14 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
150
151
  });
151
152
  // pre tags don't accept aria-label without an
152
153
  // appropriate role, we add a SR only text instead
153
- var codeBlockLabelElement = ___EmotionJSX(React.Fragment, null, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, codeBlockLabel)), tabularCopyMarkers.hiddenNoCopyBoundary);
154
+ var codeBlockLabelElement = ___EmotionJSX(React.Fragment, null, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, ariaLabel ? "".concat(ariaLabel, ", ") : undefined, codeBlockLabel)), tabularCopyMarkers.hiddenNoCopyBoundary);
154
155
  return ___EmotionJSX("div", {
155
156
  css: cssStyles,
156
157
  className: classNames('euiCodeBlock', className),
157
158
  style: overflowHeightStyles
158
159
  }, isVirtualized ? ___EmotionJSX(EuiCodeBlockVirtualized, {
159
160
  data: data,
161
+ label: codeBlockLabelElement,
160
162
  rowHeight: fontSizeToRowHeightMap[fontSize],
161
163
  overflowHeight: overflowHeight,
162
164
  preProps: preProps,
@@ -171,6 +173,7 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
171
173
  onClose: onKeyDown
172
174
  }, isVirtualized ? ___EmotionJSX(EuiCodeBlockVirtualized, {
173
175
  data: data,
176
+ label: codeBlockLabelElement,
174
177
  rowHeight: fontSizeToRowHeightMap.l,
175
178
  preProps: preFullscreenProps,
176
179
  codeProps: codeProps
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["style"],
3
+ var _excluded = ["style", "children"],
4
4
  _excluded2 = ["style"];
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -18,6 +18,7 @@ import { nodeToHtml } from './utils';
18
18
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
19
  export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
20
20
  var data = _ref.data,
21
+ label = _ref.label,
21
22
  rowHeight = _ref.rowHeight,
22
23
  overflowHeight = _ref.overflowHeight,
23
24
  preProps = _ref.preProps,
@@ -25,14 +26,15 @@ export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
25
26
  var VirtualizedOuterElement = useMemo(function () {
26
27
  return /*#__PURE__*/forwardRef(function (_ref2, ref) {
27
28
  var style = _ref2.style,
29
+ children = _ref2.children,
28
30
  props = _objectWithoutProperties(_ref2, _excluded);
29
31
  return ___EmotionJSX("pre", _extends({
30
32
  style: logicalStyles(style)
31
33
  }, props, {
32
34
  ref: ref
33
- }, preProps));
35
+ }, preProps), label, children);
34
36
  });
35
- }, [preProps]);
37
+ }, [preProps, label]);
36
38
  var VirtualizedInnerElement = useMemo(function () {
37
39
  return /*#__PURE__*/forwardRef(function (_ref3, ref) {
38
40
  var style = _ref3.style,
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  export { EuiMarkdownEditor } from './markdown_editor';
10
+ export { EuiMarkdownEditorHelpButton } from './markdown_editor_help_button';
10
11
  export { getDefaultEuiMarkdownParsingPlugins, getDefaultEuiMarkdownProcessingPlugins, getDefaultEuiMarkdownUiPlugins, getDefaultEuiMarkdownPlugins } from './plugins/markdown_default_plugins';
11
12
  export { EuiMarkdownContext } from './markdown_context';
12
13
  export { EuiMarkdownFormat } from './markdown_format';
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["className", "editorId", "value", "onChange", "height", "maxHeight", "autoExpandPreview", "parsingPluginList", "processingPluginList", "uiPlugins", "onParse", "errors", "aria-label", "aria-labelledby", "aria-describedby", "initialViewMode", "dropHandlers", "markdownFormatProps", "placeholder", "readOnly"];
5
+ var _excluded = ["className", "editorId", "value", "onChange", "height", "maxHeight", "autoExpandPreview", "parsingPluginList", "processingPluginList", "uiPlugins", "onParse", "errors", "aria-label", "aria-labelledby", "aria-describedby", "initialViewMode", "dropHandlers", "markdownFormatProps", "placeholder", "readOnly", "toolbarProps", "showFooter"];
6
6
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
7
7
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
8
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -106,6 +106,9 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
106
106
  markdownFormatProps = _ref.markdownFormatProps,
107
107
  placeholder = _ref.placeholder,
108
108
  readOnly = _ref.readOnly,
109
+ toolbarProps = _ref.toolbarProps,
110
+ _ref$showFooter = _ref.showFooter,
111
+ showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
109
112
  rest = _objectWithoutProperties(_ref, _excluded);
110
113
  var _useState = useState(initialViewMode),
111
114
  _useState2 = _slicedToArray(_useState, 2),
@@ -285,7 +288,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
285
288
  }, ___EmotionJSX("div", _extends({
286
289
  className: classes,
287
290
  css: cssStyles
288
- }, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, {
291
+ }, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, _extends({
289
292
  ref: editorToolbarRef,
290
293
  selectedNode: selectedNode,
291
294
  markdownActions: markdownActions,
@@ -294,7 +297,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
294
297
  },
295
298
  viewMode: viewMode,
296
299
  uiPlugins: toolbarPlugins
297
- }), isPreviewing && ___EmotionJSX("div", {
300
+ }, toolbarProps)), isPreviewing && ___EmotionJSX("div", {
298
301
  ref: previewRef,
299
302
  className: classesPreview,
300
303
  css: styles.euiMarkdownEditorPreview,
@@ -326,6 +329,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
326
329
  selectionEnd: newSelectionPoint
327
330
  });
328
331
  },
332
+ showFooter: showFooter,
329
333
  uiPlugins: toolbarPlugins,
330
334
  errors: errors,
331
335
  hasUnacceptedItems: hasUnacceptedItems,
@@ -60,7 +60,8 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
60
60
  hasUnacceptedItems = props.hasUnacceptedItems,
61
61
  setHasUnacceptedItems = props.setHasUnacceptedItems,
62
62
  setEditorFooterHeight = props.setEditorFooterHeight,
63
- isEditing = props.isEditing;
63
+ isEditing = props.isEditing,
64
+ showFooter = props.showFooter;
64
65
  var classes = classNames('euiMarkdownEditorDropZone');
65
66
  var styles = useEuiMemoizedStyles(euiMarkdownEditorDropZoneStyles);
66
67
  var cssStyles = [styles.euiMarkdownEditorDropZone, isDragging && !isDraggingError && styles.isDragging, isDraggingError && styles.isDraggingError, (hasUnacceptedItems || errors.length > 0) && styles.hasError];
@@ -167,7 +168,7 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
167
168
  return ___EmotionJSX("div", _extends({}, rootProps, {
168
169
  css: cssStyles,
169
170
  className: classes
170
- }), children, ___EmotionJSX(EuiMarkdownEditorFooter, {
171
+ }), children, showFooter && ___EmotionJSX(EuiMarkdownEditorFooter, {
171
172
  ref: setEditorFooterRef,
172
173
  uiPlugins: uiPlugins,
173
174
  openFiles: function openFiles() {