@elastic/eui 94.3.0 → 94.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +3 -0
  2. package/dist/eui_charts_theme.js +1519 -1519
  3. package/dist/eui_charts_theme.js.map +1 -1
  4. package/dist/eui_theme_dark.css +41 -497
  5. package/dist/eui_theme_dark.min.css +1 -1
  6. package/dist/eui_theme_light.css +41 -497
  7. package/dist/eui_theme_light.min.css +1 -1
  8. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
  9. package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
  10. package/es/components/form/form.styles.js +26 -3
  11. package/es/components/markdown_editor/markdown_editor.js +12 -8
  12. package/es/components/markdown_editor/markdown_editor.styles.js +29 -0
  13. package/es/components/markdown_editor/markdown_editor_drop_zone.js +22 -9
  14. package/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
  15. package/es/components/markdown_editor/markdown_editor_footer.js +11 -2
  16. package/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
  17. package/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
  18. package/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
  19. package/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
  20. package/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
  21. package/es/components/markdown_editor/markdown_format.js +9 -6
  22. package/es/components/markdown_editor/markdown_format.styles.js +25 -10
  23. package/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
  24. package/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
  25. package/es/components/selectable/selectable.js +10 -2
  26. package/es/components/selectable/selectable_list/selectable_list.js +95 -42
  27. package/es/components/selectable/selectable_list/selectable_list_item.js +234 -204
  28. package/es/components/selectable/selectable_option.js +9 -1
  29. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
  30. package/es/components/text/text_color.js +4 -1
  31. package/es/components/toast/global_toast_list_item.js +5 -5
  32. package/eui.d.ts +332 -234
  33. package/i18ntokens.json +124 -106
  34. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
  35. package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
  36. package/lib/components/form/form.styles.js +30 -4
  37. package/lib/components/markdown_editor/markdown_editor.js +12 -8
  38. package/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
  39. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +20 -8
  40. package/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
  41. package/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
  42. package/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
  43. package/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
  44. package/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
  45. package/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
  46. package/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
  47. package/lib/components/markdown_editor/markdown_format.js +8 -5
  48. package/lib/components/markdown_editor/markdown_format.styles.js +25 -10
  49. package/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
  50. package/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
  51. package/lib/components/selectable/selectable.js +10 -2
  52. package/lib/components/selectable/selectable_list/selectable_list.js +95 -42
  53. package/lib/components/selectable/selectable_list/selectable_list_item.js +241 -210
  54. package/lib/components/selectable/selectable_option.js +12 -1
  55. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
  56. package/lib/components/text/text_color.js +6 -2
  57. package/lib/components/toast/global_toast_list_item.js +5 -5
  58. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
  59. package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
  60. package/optimize/es/components/form/form.styles.js +26 -3
  61. package/optimize/es/components/markdown_editor/markdown_editor.js +12 -8
  62. package/optimize/es/components/markdown_editor/markdown_editor.styles.js +29 -0
  63. package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +19 -9
  64. package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
  65. package/optimize/es/components/markdown_editor/markdown_editor_footer.js +11 -2
  66. package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
  67. package/optimize/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
  68. package/optimize/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
  69. package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
  70. package/optimize/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
  71. package/optimize/es/components/markdown_editor/markdown_format.js +9 -6
  72. package/optimize/es/components/markdown_editor/markdown_format.styles.js +25 -10
  73. package/optimize/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
  74. package/optimize/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
  75. package/optimize/es/components/selectable/selectable_list/selectable_list.js +81 -38
  76. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +217 -198
  77. package/optimize/es/components/selectable/selectable_option.js +9 -1
  78. package/optimize/es/components/text/text_color.js +4 -1
  79. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
  80. package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
  81. package/optimize/lib/components/form/form.styles.js +30 -4
  82. package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -8
  83. package/optimize/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
  84. package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
  85. package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
  86. package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
  87. package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
  88. package/optimize/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
  89. package/optimize/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
  90. package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
  91. package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
  92. package/optimize/lib/components/markdown_editor/markdown_format.js +8 -5
  93. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +25 -10
  94. package/optimize/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
  95. package/optimize/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
  96. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +81 -38
  97. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +224 -204
  98. package/optimize/lib/components/selectable/selectable_option.js +12 -1
  99. package/optimize/lib/components/text/text_color.js +6 -2
  100. package/package.json +5 -12
  101. package/src/components/date_picker/react-datepicker/LICENSE +21 -0
  102. package/src/components/date_picker/react-datepicker/README.md +168 -0
  103. package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +13 -18
  104. package/src/components/form/checkbox/_checkbox.scss +23 -6
  105. package/src/components/index.scss +0 -1
  106. package/src/components/selectable/selectable_list/_selectable_list_item.scss +4 -0
  107. package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +5 -1
  108. package/src/services/theme/README.md +153 -0
  109. package/src/test/README.md +44 -0
  110. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  111. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
  112. package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
  113. package/test-env/components/form/form.styles.js +30 -4
  114. package/test-env/components/markdown_editor/markdown_editor.js +12 -8
  115. package/test-env/components/markdown_editor/markdown_editor.styles.js +37 -0
  116. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
  117. package/test-env/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
  118. package/test-env/components/markdown_editor/markdown_editor_footer.js +10 -1
  119. package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
  120. package/test-env/components/markdown_editor/markdown_editor_text_area.js +6 -1
  121. package/test-env/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
  122. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +10 -2
  123. package/test-env/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
  124. package/test-env/components/markdown_editor/markdown_format.js +8 -5
  125. package/test-env/components/markdown_editor/markdown_format.styles.js +25 -10
  126. package/test-env/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
  127. package/test-env/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
  128. package/test-env/components/selectable/selectable.js +10 -2
  129. package/test-env/components/selectable/selectable_list/selectable_list.js +95 -42
  130. package/test-env/components/selectable/selectable_list/selectable_list_item.js +233 -205
  131. package/test-env/components/selectable/selectable_option.js +12 -1
  132. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
  133. package/test-env/components/text/text_color.js +6 -2
  134. package/test-env/components/toast/global_toast_list_item.js +5 -5
  135. package/src/components/markdown_editor/_index.scss +0 -9
  136. package/src/components/markdown_editor/_markdown_editor.scss +0 -22
  137. package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +0 -58
  138. package/src/components/markdown_editor/_markdown_editor_footer.scss +0 -42
  139. package/src/components/markdown_editor/_markdown_editor_preview.scss +0 -20
  140. package/src/components/markdown_editor/_markdown_editor_text_area.scss +0 -43
  141. package/src/components/markdown_editor/_markdown_editor_toolbar.scss +0 -29
  142. package/src/components/markdown_editor/_markdown_format.scss +0 -78
  143. package/src/components/markdown_editor/_variables.scss +0 -1
  144. package/src/components/markdown_editor/plugins/markdown_tooltip.scss +0 -4
  145. package/src/themes/amsterdam/overrides/_markdown_editor.scss +0 -18
@@ -18,6 +18,7 @@ import { EuiButtonIcon } from '../../../button/button_icon';
18
18
  import { EuiToolTip } from '../../../tool_tip';
19
19
  import { EuiCollapsibleNavContext } from '../../context';
20
20
  import { euiCollapsedNavButtonStyles, euiCollapsedNavItemTooltipStyles } from './collapsed_nav_button.styles';
21
+ import { useEuiI18n } from '../../../i18n';
21
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
23
  export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
23
24
  var href = _ref.href,
@@ -37,6 +38,9 @@ export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
37
38
  var buttonClassName = classNames('euiCollapsedNavButton', linkProps === null || linkProps === void 0 ? void 0 : linkProps.className);
38
39
  var tooltipStyles = useEuiMemoizedStyles(euiCollapsedNavItemTooltipStyles);
39
40
  var tooltipCssStyles = [tooltipStyles.euiCollapsedNavItemTooltip, tooltipStyles[side], hideToolTip && tooltipStyles.hidden];
41
+ var buttonIconAriaLabel = useEuiI18n('euiCollapsedNavButton.ariaLabelButtonIcon', '{title}, quick navigation menu', {
42
+ title: title
43
+ });
40
44
  return ___EmotionJSX(EuiToolTip, {
41
45
  content: title,
42
46
  css: tooltipCssStyles,
@@ -49,7 +53,7 @@ export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
49
53
  color: "text",
50
54
  href: href,
51
55
  onClick: onClick,
52
- "aria-label": title
56
+ "aria-label": buttonIconAriaLabel
53
57
  }, linkProps, {
54
58
  // Exclusive union shenanigans
55
59
  className: buttonClassName,
@@ -31,8 +31,9 @@ import PropTypes from "prop-types";
31
31
  import moment from 'moment'; // eslint-disable-line import/named
32
32
 
33
33
  import dateMath from '@elastic/datemath';
34
- import { keys } from '../../../../services';
35
34
  import { EuiFormRow, EuiFieldText, EuiFormLabel } from '../../../form';
35
+ import { EuiFlexGroup } from '../../../flex';
36
+ import { EuiButtonIcon } from '../../../button';
36
37
  import { EuiCode } from '../../../code';
37
38
  import { EuiI18n } from '../../../i18n';
38
39
  import { EuiDatePicker } from '../../date_picker';
@@ -157,20 +158,29 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
157
158
  locale: locale,
158
159
  utcOffset: utcOffset
159
160
  }), ___EmotionJSX(EuiI18n, {
160
- tokens: ['euiAbsoluteTab.dateFormatHint', 'euiAbsoluteTab.dateFormatError'],
161
- defaults: ['Press the Enter key to parse as a date.', 'Allowed formats: {dateFormat}, ISO 8601, RFC 2822, or Unix timestamp.'],
161
+ tokens: ['euiAbsoluteTab.dateFormatButtonLabel', 'euiAbsoluteTab.dateFormatError'],
162
+ defaults: ['Parse date', 'Allowed formats: {dateFormat}, ISO 8601, RFC 2822, or Unix timestamp.'],
162
163
  values: {
163
164
  dateFormat: ___EmotionJSX(EuiCode, null, dateFormat)
164
165
  }
165
166
  }, function (_ref) {
166
167
  var _ref2 = _slicedToArray(_ref, 2),
167
- dateFormatHint = _ref2[0],
168
+ dateFormatButtonLabel = _ref2[0],
168
169
  dateFormatError = _ref2[1];
169
- return ___EmotionJSX(EuiFormRow, {
170
+ return ___EmotionJSX(EuiFlexGroup, {
171
+ component: "form",
172
+ onSubmit: function onSubmit(e) {
173
+ e.preventDefault(); // Prevents a page refresh/reload
174
+ _this2.parseUserDateInput(textInputValue);
175
+ },
176
+ className: "euiSuperDatePicker__absoluteDateForm",
177
+ gutterSize: "s",
178
+ responsive: false
179
+ }, ___EmotionJSX(EuiFormRow, {
170
180
  className: "euiSuperDatePicker__absoluteDateFormRow",
171
181
  isInvalid: isTextInvalid,
172
182
  error: isTextInvalid ? dateFormatError : undefined,
173
- helpText: hasUnparsedText ? isTextInvalid ? dateFormatHint : [dateFormatHint, dateFormatError] : undefined
183
+ helpText: hasUnparsedText && !isTextInvalid ? dateFormatError : undefined
174
184
  }, ___EmotionJSX(EuiFieldText, {
175
185
  compressed: true,
176
186
  isInvalid: isTextInvalid,
@@ -179,13 +189,17 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
179
189
  onPaste: function onPaste(event) {
180
190
  _this2.parseUserDateInput(event.clipboardData.getData('text'));
181
191
  },
182
- onKeyDown: function onKeyDown(event) {
183
- if (event.key === keys.ENTER) {
184
- _this2.parseUserDateInput(textInputValue);
185
- }
186
- },
187
192
  "data-test-subj": "superDatePickerAbsoluteDateInput",
188
193
  prepend: ___EmotionJSX(EuiFormLabel, null, labelPrefix)
194
+ })), hasUnparsedText && ___EmotionJSX(EuiButtonIcon, {
195
+ type: "submit",
196
+ className: "euiSuperDatePicker__absoluteDateFormSubmit",
197
+ size: "s",
198
+ display: "base",
199
+ iconType: "check",
200
+ "aria-label": dateFormatButtonLabel,
201
+ title: dateFormatButtonLabel,
202
+ "data-test-subj": "parseAbsoluteDateFormat"
189
203
  }));
190
204
  }));
191
205
  }
@@ -13,7 +13,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
13
13
  */
14
14
 
15
15
  import { shade, tint, darken, transparentize, makeHighContrastColor } from '../../services';
16
- import { mathWithUnits, euiCanAnimate } from '../../global_styling';
16
+ import { mathWithUnits, euiCanAnimate, euiFontSize } from '../../global_styling';
17
17
  export var euiFormVariables = function euiFormVariables(euiThemeContext) {
18
18
  var euiTheme = euiThemeContext.euiTheme,
19
19
  colorMode = euiThemeContext.colorMode;
@@ -68,7 +68,9 @@ export var euiFormVariables = function euiFormVariables(euiThemeContext) {
68
68
  xxl: euiTheme.size.xxl
69
69
  }
70
70
  };
71
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sizes), colors), customControlColors), iconSizes), controlLayout);
71
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sizes), colors), customControlColors), iconSizes), controlLayout), {}, {
72
+ animationTiming: "".concat(euiTheme.animation.fast, " ease-in")
73
+ });
72
74
  };
73
75
  export var euiFormControlSize = function euiFormControlSize(euiThemeContext) {
74
76
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -102,5 +104,26 @@ export var euiCustomControl = function euiCustomControl(euiThemeContext) {
102
104
  } else if (type === 'square') {
103
105
  borderRadiusStyle = "border-radius: ".concat(form.controlCompressedBorderRadius, ";");
104
106
  }
105
- return "\n ".concat(padddingStyle, "\n ").concat(borderRadiusStyle, "\n border: ").concat(euiTheme.border.width.thin, " solid ").concat(form.customControlBorderColor, ";\n background: ").concat(euiTheme.colors.emptyShade, " no-repeat center;\n\n ").concat(euiCanAnimate, " {\n transition: background-color ").concat(euiTheme.animation.fast, " ease-in,\n border-color ").concat(euiTheme.animation.fast, " ease-in;\n }\n ");
107
+ return "\n ".concat(padddingStyle, "\n ").concat(borderRadiusStyle, "\n border: ").concat(euiTheme.border.width.thin, " solid ").concat(form.customControlBorderColor, ";\n background: ").concat(euiTheme.colors.emptyShade, " no-repeat center;\n\n ").concat(euiCanAnimate, " {\n transition: background-color ").concat(form.animationTiming, ",\n border-color ").concat(form.animationTiming, ";\n }\n ");
108
+ };
109
+ export var euiFormControlText = function euiFormControlText(euiThemeContext) {
110
+ var euiTheme = euiThemeContext.euiTheme;
111
+ var _euiFontSize = euiFontSize(euiThemeContext, 's'),
112
+ fontSize = _euiFontSize.fontSize;
113
+ var _euiFormVariables = euiFormVariables(euiThemeContext),
114
+ controlPlaceholderText = _euiFormVariables.controlPlaceholderText;
115
+ return "\n font-family: ".concat(euiTheme.font.family, ";\n font-size: ").concat(fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n\n ").concat(euiPlaceholderPerBrowser("color: ".concat(controlPlaceholderText)), "\n ");
116
+ };
117
+ export var euiFormControlDefaultShadow = function euiFormControlDefaultShadow(euiThemeContext) {
118
+ var euiTheme = euiThemeContext.euiTheme;
119
+ var form = euiFormVariables(euiThemeContext);
120
+ return "\n box-shadow: inset 0 0 0 1px ".concat(form.borderColor, ";\n background-color: ").concat(form.backgroundColor, ";\n\n background-repeat: no-repeat;\n background-size: 0% 100%;\n background-image: linear-gradient(to top,\n var(--euiFormStateColor),\n var(--euiFormStateColor) ").concat(euiTheme.border.width.thick, ",\n transparent ").concat(euiTheme.border.width.thick, ",\n transparent 100%\n );\n\n ").concat(euiCanAnimate, " {\n transition:\n box-shadow ").concat(form.animationTiming, ",\n background-image ").concat(form.animationTiming, ",\n background-size ").concat(form.animationTiming, ",\n background-color ").concat(form.animationTiming, ";\n }\n ");
121
+ };
122
+ export var euiFormControlFocusStyles = function euiFormControlFocusStyles(_ref) {
123
+ var euiTheme = _ref.euiTheme,
124
+ colorMode = _ref.colorMode;
125
+ return "\n --euiFormStateColor: ".concat(euiTheme.colors.primary, ";\n background-color: ").concat(colorMode === 'DARK' ? shade(euiTheme.colors.emptyShade, 0.4) : euiTheme.colors.emptyShade, ";\n background-size: 100% 100%;\n outline: none; /* Remove all outlines and rely on our own bottom border gradient */\n");
126
+ };
127
+ var euiPlaceholderPerBrowser = function euiPlaceholderPerBrowser(content) {
128
+ return "\n &::-webkit-input-placeholder { ".concat(content, "; opacity: 1; }\n &::-moz-placeholder { ").concat(content, "; opacity: 1; }\n &:-ms-input-placeholder { ").concat(content, "; opacity: 1; }\n &:-moz-placeholder { ").concat(content, "; opacity: 1; }\n &::placeholder { ").concat(content, "; opacity: 1; }\n");
106
129
  };
@@ -25,17 +25,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
25
25
  import React, { createElement, useEffect, useImperativeHandle, useMemo, useState, useCallback, useRef, forwardRef } from 'react';
26
26
  import unified from 'unified';
27
27
  import classNames from 'classnames';
28
+ import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
29
+ import { EuiModal } from '../modal';
30
+ import { EuiResizeObserver } from '../observer/resize_observer';
28
31
  import MarkdownActions, { insertText as _insertText } from './markdown_actions';
29
32
  import { EuiMarkdownEditorToolbar } from './markdown_editor_toolbar';
30
33
  import { EuiMarkdownEditorTextArea } from './markdown_editor_text_area';
31
34
  import { EuiMarkdownFormat } from './markdown_format';
32
35
  import { EuiMarkdownEditorDropZone } from './markdown_editor_drop_zone';
33
- import { useGeneratedHtmlId } from '../../services';
34
36
  import { MODE_EDITING, MODE_VIEWING } from './markdown_modes';
35
- import { EuiModal } from '../modal';
36
37
  import { EuiMarkdownContext } from './markdown_context';
37
38
  import { defaultParsingPlugins, defaultProcessingPlugins, defaultUiPlugins } from './plugins/markdown_default_plugins';
38
- import { EuiResizeObserver } from '../observer/resize_observer';
39
+ import { euiMarkdownEditorStyles } from './markdown_editor.styles';
39
40
  import { jsx as ___EmotionJSX } from "@emotion/react";
40
41
  // TODO I wanted to use the useCombinedRefs
41
42
  // but I can't because it's not allowed to use react hooks
@@ -248,10 +249,10 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
248
249
  _useState12 = _slicedToArray(_useState11, 2),
249
250
  editorToolbarHeight = _useState12[0],
250
251
  setEditorToolbarHeight = _useState12[1];
252
+ var styles = useEuiMemoizedStyles(euiMarkdownEditorStyles);
253
+ var cssStyles = [styles.euiMarkdownEditor, height === 'full' && styles.fullHeight];
251
254
  var classes = classNames('euiMarkdownEditor', {
252
- 'euiMarkdownEditor--fullHeight': height === 'full'
253
- }, {
254
- 'euiMarkdownEditor--isPreviewing': isPreviewing
255
+ 'euiMarkdownEditor-isPreviewing': isPreviewing
255
256
  }, className);
256
257
  var classesPreview = classNames('euiMarkdownEditorPreview', {
257
258
  'euiMarkdownEditorPreview-isReadOnly': readOnly
@@ -290,7 +291,8 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
290
291
  return ___EmotionJSX(EuiMarkdownContext.Provider, {
291
292
  value: contextValue
292
293
  }, ___EmotionJSX("div", _extends({
293
- className: classes
294
+ className: classes,
295
+ css: cssStyles
294
296
  }, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, {
295
297
  ref: editorToolbarRef,
296
298
  selectedNode: selectedNode,
@@ -303,6 +305,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
303
305
  }), isPreviewing && ___EmotionJSX("div", {
304
306
  ref: previewRef,
305
307
  className: classesPreview,
308
+ css: styles.euiMarkdownEditorPreview,
306
309
  style: {
307
310
  height: previewHeight
308
311
  }
@@ -312,7 +315,8 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
312
315
  }, markdownFormatProps), value)), ___EmotionJSX("div", {
313
316
  className: "euiMarkdownEditor__toggleContainer",
314
317
  style: {
315
- height: editorToggleContainerHeight
318
+ height: editorToggleContainerHeight,
319
+ display: isPreviewing ? 'none' : undefined
316
320
  }
317
321
  }, ___EmotionJSX(EuiMarkdownEditorDropZone, {
318
322
  setEditorFooterHeight: setEditorFooterHeight,
@@ -0,0 +1,29 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS, logicalCSSWithFallback, logicalBorderRadiusCSS, euiScrollBarStyles } from '../../global_styling';
11
+ export var euiMarkdownEditorVariables = function euiMarkdownEditorVariables(_ref) {
12
+ var euiTheme = _ref.euiTheme;
13
+ return {
14
+ minHeight: '150px',
15
+ borderRadius: euiTheme.border.radius.medium,
16
+ barsBackgroundColor: euiTheme.colors.lightestShade
17
+ };
18
+ };
19
+ export var euiMarkdownEditorStyles = function euiMarkdownEditorStyles(euiThemeContext) {
20
+ var euiTheme = euiThemeContext.euiTheme;
21
+ var _euiMarkdownEditorVar = euiMarkdownEditorVariables(euiThemeContext),
22
+ minHeight = _euiMarkdownEditorVar.minHeight,
23
+ borderRadius = _euiMarkdownEditorVar.borderRadius;
24
+ return {
25
+ euiMarkdownEditor: /*#__PURE__*/css("display:flex;flex-direction:column;.euiMarkdownEditorToolbar{", logicalBorderRadiusCSS("".concat(borderRadius, " ").concat(borderRadius, " 0 0"), true), ";}.euiMarkdownEditorPreview,.euiMarkdownEditorFooter{", logicalBorderRadiusCSS("0 0 ".concat(borderRadius, " ").concat(borderRadius), true), ";};label:euiMarkdownEditor;"),
26
+ fullHeight: /*#__PURE__*/css(logicalCSS('height', '100%'), " .euiMarkdownEditorTextArea{resize:none;}.euiMarkdownEditorDropZone{", logicalCSS('height', '100%'), ";};label:fullHeight;"),
27
+ euiMarkdownEditorPreview: /*#__PURE__*/css(logicalCSS('min-height', minHeight), " ", logicalCSSWithFallback('overflow-y', 'auto'), " ", euiScrollBarStyles(euiThemeContext), " padding:", euiTheme.size.m, ";border:", euiTheme.border.thin, ";background-color:", euiTheme.colors.emptyShade, ";;label:euiMarkdownEditorPreview;")
28
+ };
29
+ };
@@ -1,4 +1,10 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
9
  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."); }
4
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -13,12 +19,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
19
  * Side Public License, v 1.
14
20
  */
15
21
 
16
- import React, { useEffect } from 'react';
22
+ import React, { useEffect, useContext } from 'react';
17
23
  import PropTypes from "prop-types";
18
24
  import classNames from 'classnames';
19
25
  import { useDropzone } from 'react-dropzone';
20
- import { EuiMarkdownEditorFooter } from './markdown_editor_footer';
26
+ import { useEuiMemoizedStyles } from '../../services';
21
27
  import { useResizeObserver } from '../observer/resize_observer';
28
+ import { EuiMarkdownContext } from './markdown_context';
29
+ import { EuiMarkdownEditorFooter } from './markdown_editor_footer';
30
+ import { euiMarkdownEditorDropZoneStyles } from './markdown_editor_drop_zone.styles';
22
31
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
32
  var getUnacceptedItems = function getUnacceptedItems(items, dropHandlers) {
24
33
  var unacceptedItems = [];
@@ -38,6 +47,8 @@ var getUnacceptedItems = function getUnacceptedItems(items, dropHandlers) {
38
47
  return unacceptedItems;
39
48
  };
40
49
  export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props) {
50
+ var _useContext = useContext(EuiMarkdownContext),
51
+ readOnly = _useContext.readOnly;
41
52
  var _React$useState = React.useState(false),
42
53
  _React$useState2 = _slicedToArray(_React$useState, 2),
43
54
  isDragging = _React$useState2[0],
@@ -59,11 +70,9 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
59
70
  setHasUnacceptedItems = props.setHasUnacceptedItems,
60
71
  setEditorFooterHeight = props.setEditorFooterHeight,
61
72
  isEditing = props.isEditing;
62
- var classes = classNames('euiMarkdownEditorDropZone', {
63
- 'euiMarkdownEditorDropZone--isDragging': isDragging,
64
- 'euiMarkdownEditorDropZone--hasError': hasUnacceptedItems,
65
- 'euiMarkdownEditorDropZone--isDraggingError': isDraggingError
66
- });
73
+ var classes = classNames('euiMarkdownEditorDropZone');
74
+ var styles = useEuiMemoizedStyles(euiMarkdownEditorDropZoneStyles);
75
+ var cssStyles = [styles.euiMarkdownEditorDropZone, isDragging && !isDraggingError && styles.isDragging, isDraggingError && styles.isDraggingError, (hasUnacceptedItems || errors.length > 0) && styles.hasError];
67
76
  var _React$useState7 = React.useState(null),
68
77
  _React$useState8 = _slicedToArray(_React$useState7, 2),
69
78
  editorFooterRef = _React$useState8[0],
@@ -76,7 +85,7 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
76
85
  }
77
86
  }, [setEditorFooterHeight, isEditing, editorFooterHeight]);
78
87
  var _useDropzone = useDropzone({
79
- disabled: dropHandlers.length === 0,
88
+ disabled: dropHandlers.length === 0 || readOnly,
80
89
  // Disable click and keydown behavior
81
90
  noClick: true,
82
91
  noKeyboard: true,
@@ -161,7 +170,11 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
161
170
  getRootProps = _useDropzone.getRootProps,
162
171
  getInputProps = _useDropzone.getInputProps,
163
172
  open = _useDropzone.open;
164
- return ___EmotionJSX("div", _extends({}, getRootProps(), {
173
+ var rootProps = _objectSpread({}, getRootProps());
174
+ if (readOnly) rootProps.role = undefined; // Unset the default `role="button"` attribute which sets a misleading pointer icon
175
+
176
+ return ___EmotionJSX("div", _extends({}, rootProps, {
177
+ css: cssStyles,
165
178
  className: classes
166
179
  }), children, ___EmotionJSX(EuiMarkdownEditorFooter, {
167
180
  ref: setEditorFooterRef,
@@ -0,0 +1,33 @@
1
+ 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)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ import { transparentize } from '../../services';
12
+ import { logicalCSS } from '../../global_styling';
13
+ import { euiMarkdownEditorVariables } from './markdown_editor.styles';
14
+ var _ref = process.env.NODE_ENV === "production" ? {
15
+ name: "gwjnpv-euiMarkdownEditorDropZone__input",
16
+ styles: "position:absolute;inset:0;opacity:0;overflow:hidden;&:hover{cursor:pointer;}&:hover:disabled{cursor:not-allowed;};label:euiMarkdownEditorDropZone__input;"
17
+ } : {
18
+ name: "gwjnpv-euiMarkdownEditorDropZone__input",
19
+ styles: "position:absolute;inset:0;opacity:0;overflow:hidden;&:hover{cursor:pointer;}&:hover:disabled{cursor:not-allowed;};label:euiMarkdownEditorDropZone__input;",
20
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
+ };
22
+ export var euiMarkdownEditorDropZoneStyles = function euiMarkdownEditorDropZoneStyles(euiThemeContext) {
23
+ var euiTheme = euiThemeContext.euiTheme;
24
+ var _euiMarkdownEditorVar = euiMarkdownEditorVariables(euiThemeContext),
25
+ minHeight = _euiMarkdownEditorVar.minHeight;
26
+ return {
27
+ euiMarkdownEditorDropZone: /*#__PURE__*/css("position:relative;display:flex;flex-direction:column;", logicalCSS('min-height', minHeight), ";;label:euiMarkdownEditorDropZone;"),
28
+ isDragging: /*#__PURE__*/css(".euiMarkdownEditorFooter,.euiMarkdownEditorTextArea{background-color:", transparentize(euiTheme.colors.primary, 0.1), "!important;};label:isDragging;"),
29
+ isDraggingError: /*#__PURE__*/css(".euiMarkdownEditorFooter,.euiMarkdownEditorTextArea{background-color:", transparentize(euiTheme.colors.danger, 0.1), "!important;};label:isDraggingError;"),
30
+ hasError: /*#__PURE__*/css(".euiMarkdownEditorTextArea{--euiFormStateColor:", euiTheme.colors.danger, "!important;background-size:100% 100%;};label:hasError;"),
31
+ euiMarkdownEditorDropZone__input: _ref
32
+ };
33
+ };
@@ -14,6 +14,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
15
  import React, { useState, useMemo, Fragment, forwardRef, useContext } from 'react';
16
16
  import PropTypes from "prop-types";
17
+ import { useEuiMemoizedStyles } from '../../services';
17
18
  import { EuiLoadingSpinner } from '../loading';
18
19
  import { EuiButton, EuiButtonEmpty, EuiButtonIcon } from '../button';
19
20
  import { EuiTitle } from '../title';
@@ -23,11 +24,12 @@ import { EuiPopover, EuiPopoverTitle } from '../popover';
23
24
  import { EuiText } from '../text';
24
25
  import { EuiSpacer } from '../spacer';
25
26
  import { EuiToolTip } from '../tool_tip';
26
- // @ts-ignore a react svg
27
- import MarkdownLogo from './icons/markdown_logo';
28
27
  import { EuiHorizontalRule } from '../horizontal_rule';
29
28
  import { EuiLink } from '../link';
30
29
  import { EuiMarkdownContext } from './markdown_context';
30
+ // @ts-ignore a react svg
31
+ import MarkdownLogo from './icons/markdown_logo';
32
+ import { euiMarkdownEditorFooterStyles } from './markdown_editor_footer.styles';
31
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
32
34
  export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, ref) {
33
35
  var uiPlugins = props.uiPlugins,
@@ -36,6 +38,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
36
38
  errors = props.errors,
37
39
  hasUnacceptedItems = props.hasUnacceptedItems,
38
40
  dropHandlers = props.dropHandlers;
41
+ var styles = useEuiMemoizedStyles(euiMarkdownEditorFooterStyles);
39
42
  var _useState = useState(false),
40
43
  _useState2 = _slicedToArray(_useState, 2),
41
44
  isShowingHelpModal = _useState2[0],
@@ -87,6 +90,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
87
90
  uploadButton = ___EmotionJSX(EuiToolTip, {
88
91
  content: ariaLabels.supportedFileTypes
89
92
  }, ___EmotionJSX(EuiButtonEmpty, {
93
+ css: styles.euiMarkdownEditorFooter__uploadError,
90
94
  className: "euiMarkdownEditorFooter__uploadError",
91
95
  autoFocus: true,
92
96
  size: "s",
@@ -122,6 +126,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
122
126
  panelPaddingSize: "s",
123
127
  anchorPosition: "upCenter"
124
128
  }, ___EmotionJSX("div", {
129
+ css: styles.euiMarkdownEditorFooter__popover,
125
130
  className: "euiMarkdownEditorFooter__popover"
126
131
  }, ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
127
132
  token: "euiMarkdownEditorFooter.errorsTitle",
@@ -152,6 +157,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
152
157
  content: syntaxTitle
153
158
  }, ___EmotionJSX(EuiButtonIcon, {
154
159
  size: "s",
160
+ css: styles.euiMarkdownEditorFooter__helpButton,
155
161
  className: "euiMarkdownEditorFooter__helpButton",
156
162
  iconType: MarkdownLogo,
157
163
  color: "text",
@@ -198,6 +204,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
198
204
  button: ___EmotionJSX(EuiButtonIcon, {
199
205
  title: syntaxTitle,
200
206
  size: "s",
207
+ css: styles.euiMarkdownEditorFooter__helpButton,
201
208
  className: "euiMarkdownEditorFooter__helpButton",
202
209
  iconType: MarkdownLogo,
203
210
  color: "text",
@@ -223,8 +230,10 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
223
230
  }
224
231
  return ___EmotionJSX("div", {
225
232
  ref: ref,
233
+ css: styles.euiMarkdownEditorFooter,
226
234
  className: "euiMarkdownEditorFooter"
227
235
  }, ___EmotionJSX("div", {
236
+ css: styles.euiMarkdownEditorFooter__actions,
228
237
  className: "euiMarkdownEditorFooter__actions"
229
238
  }, uploadButton, errorsButton), helpSyntaxButton);
230
239
  });
@@ -0,0 +1,26 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS } from '../../global_styling';
11
+ import { euiMarkdownEditorVariables } from './markdown_editor.styles';
12
+ export var euiMarkdownEditorFooterStyles = function euiMarkdownEditorFooterStyles(euiThemeContext) {
13
+ var euiTheme = euiThemeContext.euiTheme;
14
+ var _euiMarkdownEditorVar = euiMarkdownEditorVariables(euiThemeContext),
15
+ borderRadius = _euiMarkdownEditorVar.borderRadius,
16
+ barsBackgroundColor = _euiMarkdownEditorVar.barsBackgroundColor;
17
+ return {
18
+ euiMarkdownEditorFooter: /*#__PURE__*/css("display:inline-flex;align-items:center;padding:", euiTheme.size.xs, ";border:", euiTheme.border.thin, ";background-color:", barsBackgroundColor, ";;label:euiMarkdownEditorFooter;"),
19
+ euiMarkdownEditorFooter__actions: /*#__PURE__*/css("flex:1;display:inline-flex;align-items:center;gap:", euiTheme.size.xs, ";;label:euiMarkdownEditorFooter__actions;"),
20
+ // Override default button border radius to match the overall markdown editor
21
+ euiMarkdownEditorFooter__uploadError: /*#__PURE__*/css("border-radius:", borderRadius, ";;label:euiMarkdownEditorFooter__uploadError;"),
22
+ // Override the default button icon width size
23
+ euiMarkdownEditorFooter__helpButton: /*#__PURE__*/css(".euiIcon{", logicalCSS('width', '26px'), ";};label:euiMarkdownEditorFooter__helpButton;"),
24
+ euiMarkdownEditorFooter__popover: /*#__PURE__*/css(logicalCSS('width', '300px'), ";;label:euiMarkdownEditorFooter__popover;")
25
+ };
26
+ };
@@ -13,7 +13,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
  import React, { forwardRef, useContext } from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
+ import { useEuiMemoizedStyles } from '../../services';
16
17
  import { EuiMarkdownContext } from './markdown_context';
18
+ import { euiMarkdownEditorTextAreaStyles } from './markdown_editor_text_area.styles';
17
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
20
  export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
19
21
  var children = _ref.children,
@@ -31,6 +33,8 @@ export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, r
31
33
  var classes = classNames('euiMarkdownEditorTextArea', {
32
34
  'euiMarkdownEditorTextArea-isReadOnly': readOnly
33
35
  });
36
+ var styles = useEuiMemoizedStyles(euiMarkdownEditorTextAreaStyles);
37
+ var cssStyles = [styles.euiMarkdownEditorTextArea, readOnly ? styles.readOnly : styles.editable];
34
38
 
35
39
  // Ignore invalid empty string style values
36
40
  var style = {};
@@ -44,7 +48,8 @@ export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, r
44
48
  ref: ref,
45
49
  "data-test-subj": "euiMarkdownEditorTextArea",
46
50
  style: style,
47
- className: classes
51
+ className: classes,
52
+ css: cssStyles
48
53
  }, rest, {
49
54
  rows: 6,
50
55
  name: name,
@@ -0,0 +1,22 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS, logicalSizeCSS, euiScrollBarStyles } from '../../global_styling';
11
+ import { euiFormControlText, euiFormControlDefaultShadow, euiFormControlFocusStyles } from '../form/form.styles';
12
+ import { euiMarkdownEditorVariables } from './markdown_editor.styles';
13
+ export var euiMarkdownEditorTextAreaStyles = function euiMarkdownEditorTextAreaStyles(euiThemeContext) {
14
+ var euiTheme = euiThemeContext.euiTheme;
15
+ var _euiMarkdownEditorVar = euiMarkdownEditorVariables(euiThemeContext),
16
+ minHeight = _euiMarkdownEditorVar.minHeight;
17
+ return {
18
+ euiMarkdownEditorTextArea: /*#__PURE__*/css(logicalSizeCSS('100%'), " ", logicalCSS('min-height', minHeight), " ", euiScrollBarStyles(euiThemeContext), " resize:vertical;margin:0;padding:", euiTheme.size.m, ";", euiFormControlText(euiThemeContext), " line-height:", euiTheme.font.lineHeightMultiplier, ";border:", euiTheme.border.thin, ";", logicalCSS('border-bottom', 'none'), ";;label:euiMarkdownEditorTextArea;"),
19
+ readOnly: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";cursor:default;&:focus{outline:none;};label:readOnly;"),
20
+ editable: /*#__PURE__*/css(euiFormControlDefaultShadow(euiThemeContext), " box-shadow:none;&:focus,.euiMarkdownEditor:focus-within &{", euiFormControlFocusStyles(euiThemeContext), ";};label:editable;")
21
+ };
22
+ };
@@ -9,11 +9,13 @@ import PropTypes from "prop-types";
9
9
  */
10
10
 
11
11
  import React, { useContext, forwardRef } from 'react';
12
+ import { useEuiMemoizedStyles } from '../../services';
12
13
  import { EuiButtonEmpty, EuiButtonIcon } from '../button';
13
14
  import { EuiI18n } from '../i18n';
14
15
  import { EuiToolTip } from '../tool_tip';
15
16
  import { MODE_VIEWING } from './markdown_modes';
16
17
  import { EuiMarkdownContext } from './markdown_context';
18
+ import { euiMarkdownEditorToolbarStyles } from './markdown_editor_toolbar.styles';
17
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
20
  var boldItalicButtons = [{
19
21
  id: 'mdBold',
@@ -99,11 +101,14 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
99
101
  };
100
102
  var isPreviewing = viewMode === MODE_VIEWING;
101
103
  var isEditable = !isPreviewing && !readOnly;
104
+ var styles = useEuiMemoizedStyles(euiMarkdownEditorToolbarStyles);
102
105
  return ___EmotionJSX("div", {
103
106
  ref: ref,
104
- "data-test-subj": "euiMarkdownEditorToolbar",
105
- className: "euiMarkdownEditorToolbar"
107
+ css: styles.euiMarkdownEditorToolbar,
108
+ className: "euiMarkdownEditorToolbar",
109
+ "data-test-subj": "euiMarkdownEditorToolbar"
106
110
  }, ___EmotionJSX("div", {
111
+ css: styles.euiMarkdownEditorToolbar__buttons,
107
112
  className: "euiMarkdownEditorToolbar__buttons"
108
113
  }, boldItalicButtons.map(function (item) {
109
114
  return ___EmotionJSX(EuiToolTip, {
@@ -120,6 +125,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
120
125
  icon: item.iconType
121
126
  }));
122
127
  }), ___EmotionJSX("span", {
128
+ css: styles.euiMarkdownEditorToolbar__divider,
123
129
  className: "euiMarkdownEditorToolbar__divider"
124
130
  }), listButtons.map(function (item) {
125
131
  return ___EmotionJSX(EuiToolTip, {
@@ -136,6 +142,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
136
142
  icon: item.iconType
137
143
  }));
138
144
  }), ___EmotionJSX("span", {
145
+ css: styles.euiMarkdownEditorToolbar__divider,
139
146
  className: "euiMarkdownEditorToolbar__divider"
140
147
  }), quoteCodeLinkButtons.map(function (item) {
141
148
  return ___EmotionJSX(EuiToolTip, {
@@ -152,6 +159,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
152
159
  icon: item.iconType
153
160
  }));
154
161
  }), uiPlugins.length > 0 ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
162
+ css: styles.euiMarkdownEditorToolbar__divider,
155
163
  className: "euiMarkdownEditorToolbar__divider"
156
164
  }), uiPlugins.map(function (_ref3) {
157
165
  var name = _ref3.name,
@@ -0,0 +1,21 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS } from '../../global_styling';
11
+ import { euiMarkdownEditorVariables } from './markdown_editor.styles';
12
+ export var euiMarkdownEditorToolbarStyles = function euiMarkdownEditorToolbarStyles(euiThemeContext) {
13
+ var euiTheme = euiThemeContext.euiTheme;
14
+ var _euiMarkdownEditorVar = euiMarkdownEditorVariables(euiThemeContext),
15
+ barsBackgroundColor = _euiMarkdownEditorVar.barsBackgroundColor;
16
+ return {
17
+ euiMarkdownEditorToolbar: /*#__PURE__*/css("display:flex;flex-wrap:wrap;padding:", euiTheme.size.xs, ";background-color:", barsBackgroundColor, ";border:", euiTheme.border.thin, ";", logicalCSS('border-bottom', 'none'), ";;label:euiMarkdownEditorToolbar;"),
18
+ euiMarkdownEditorToolbar__buttons: /*#__PURE__*/css("flex:1;display:flex;flex-wrap:wrap;align-items:center;column-gap:", euiTheme.size.xs, ";;label:euiMarkdownEditorToolbar__buttons;"),
19
+ euiMarkdownEditorToolbar__divider: /*#__PURE__*/css("display:block;", logicalCSS('height', euiTheme.size.l), " ", logicalCSS('margin-left', euiTheme.size.xs), " ", logicalCSS('padding-right', euiTheme.size.xs), " ", logicalCSS('border-left', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.border.color)), ";;label:euiMarkdownEditorToolbar__divider;")
20
+ };
21
+ };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className", "parsingPluginList", "processingPluginList", "textSize"];
1
+ var _excluded = ["children", "className", "parsingPluginList", "processingPluginList", "textSize", "color"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -15,7 +15,8 @@ import PropTypes from "prop-types";
15
15
  import unified from 'unified';
16
16
  import classNames from 'classnames';
17
17
  import { EuiText } from '../text/text';
18
- import { useEuiTheme } from '../../services';
18
+ import { _isNamedColor } from '../text/text_color';
19
+ import { useEuiMemoizedStyles } from '../../services';
19
20
  import { euiMarkdownFormatStyles } from './markdown_format.styles';
20
21
  import { defaultProcessingPlugins, defaultParsingPlugins } from './plugins/markdown_default_plugins';
21
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -28,6 +29,8 @@ export var EuiMarkdownFormat = function EuiMarkdownFormat(_ref) {
28
29
  processingPluginList = _ref$processingPlugin === void 0 ? defaultProcessingPlugins : _ref$processingPlugin,
29
30
  _ref$textSize = _ref.textSize,
30
31
  textSize = _ref$textSize === void 0 ? 'm' : _ref$textSize,
32
+ _ref$color = _ref.color,
33
+ color = _ref$color === void 0 ? 'default' : _ref$color,
31
34
  rest = _objectWithoutProperties(_ref, _excluded);
32
35
  var processor = useMemo(function () {
33
36
  return unified().use(parsingPluginList).use(processingPluginList);
@@ -43,14 +46,14 @@ export var EuiMarkdownFormat = function EuiMarkdownFormat(_ref) {
43
46
  return children;
44
47
  }
45
48
  }, [children, processor]);
46
- var euiTheme = useEuiTheme();
47
- var styles = euiMarkdownFormatStyles(euiTheme);
48
- var cssStyles = [styles.euiMarkdownFormat, styles[textSize]];
49
+ var styles = useEuiMemoizedStyles(euiMarkdownFormatStyles);
50
+ var cssStyles = [styles.euiMarkdownFormat, styles[textSize], _isNamedColor(color) ? styles.colors[color] : styles.colors.custom];
49
51
  var classes = classNames('euiMarkdownFormat', className);
50
52
  return ___EmotionJSX(EuiText, _extends({
51
53
  size: textSize,
52
54
  css: cssStyles,
53
- className: classes
55
+ className: classes,
56
+ color: color
54
57
  }, rest), result);
55
58
  };
56
59
  EuiMarkdownFormat.propTypes = {