@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.
- package/README.md +3 -0
- package/dist/eui_charts_theme.js +1519 -1519
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +41 -497
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +41 -497
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/es/components/form/form.styles.js +26 -3
- package/es/components/markdown_editor/markdown_editor.js +12 -8
- package/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +22 -9
- package/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/es/components/markdown_editor/markdown_format.js +9 -6
- package/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/es/components/selectable/selectable.js +10 -2
- package/es/components/selectable/selectable_list/selectable_list.js +95 -42
- package/es/components/selectable/selectable_list/selectable_list_item.js +234 -204
- package/es/components/selectable/selectable_option.js +9 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/es/components/text/text_color.js +4 -1
- package/es/components/toast/global_toast_list_item.js +5 -5
- package/eui.d.ts +332 -234
- package/i18ntokens.json +124 -106
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/lib/components/form/form.styles.js +30 -4
- package/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +20 -8
- package/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/lib/components/markdown_editor/markdown_format.js +8 -5
- package/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/lib/components/selectable/selectable.js +10 -2
- package/lib/components/selectable/selectable_list/selectable_list.js +95 -42
- package/lib/components/selectable/selectable_list/selectable_list_item.js +241 -210
- package/lib/components/selectable/selectable_option.js +12 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/lib/components/text/text_color.js +6 -2
- package/lib/components/toast/global_toast_list_item.js +5 -5
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/es/components/form/form.styles.js +26 -3
- package/optimize/es/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +19 -9
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/optimize/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/optimize/es/components/markdown_editor/markdown_format.js +9 -6
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/optimize/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +217 -198
- package/optimize/es/components/selectable/selectable_option.js +9 -1
- package/optimize/es/components/text/text_color.js +4 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/lib/components/form/form.styles.js +30 -4
- package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/optimize/lib/components/markdown_editor/markdown_format.js +8 -5
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/optimize/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +224 -204
- package/optimize/lib/components/selectable/selectable_option.js +12 -1
- package/optimize/lib/components/text/text_color.js +6 -2
- package/package.json +5 -12
- package/src/components/date_picker/react-datepicker/LICENSE +21 -0
- package/src/components/date_picker/react-datepicker/README.md +168 -0
- package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +13 -18
- package/src/components/form/checkbox/_checkbox.scss +23 -6
- package/src/components/index.scss +0 -1
- package/src/components/selectable/selectable_list/_selectable_list_item.scss +4 -0
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +5 -1
- package/src/services/theme/README.md +153 -0
- package/src/test/README.md +44 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/test-env/components/form/form.styles.js +30 -4
- package/test-env/components/markdown_editor/markdown_editor.js +12 -8
- package/test-env/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/test-env/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/test-env/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/test-env/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/test-env/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/test-env/components/markdown_editor/markdown_format.js +8 -5
- package/test-env/components/markdown_editor/markdown_format.styles.js +25 -10
- package/test-env/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/test-env/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/test-env/components/selectable/selectable.js +10 -2
- package/test-env/components/selectable/selectable_list/selectable_list.js +95 -42
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +233 -205
- package/test-env/components/selectable/selectable_option.js +12 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/test-env/components/text/text_color.js +6 -2
- package/test-env/components/toast/global_toast_list_item.js +5 -5
- package/src/components/markdown_editor/_index.scss +0 -9
- package/src/components/markdown_editor/_markdown_editor.scss +0 -22
- package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +0 -58
- package/src/components/markdown_editor/_markdown_editor_footer.scss +0 -42
- package/src/components/markdown_editor/_markdown_editor_preview.scss +0 -20
- package/src/components/markdown_editor/_markdown_editor_text_area.scss +0 -43
- package/src/components/markdown_editor/_markdown_editor_toolbar.scss +0 -29
- package/src/components/markdown_editor/_markdown_format.scss +0 -78
- package/src/components/markdown_editor/_variables.scss +0 -1
- package/src/components/markdown_editor/plugins/markdown_tooltip.scss +0 -4
- package/src/themes/amsterdam/overrides/_markdown_editor.scss +0 -18
|
@@ -16,6 +16,7 @@ import { EuiButtonIcon } from '../../../button/button_icon';
|
|
|
16
16
|
import { EuiToolTip } from '../../../tool_tip';
|
|
17
17
|
import { EuiCollapsibleNavContext } from '../../context';
|
|
18
18
|
import { euiCollapsedNavButtonStyles, euiCollapsedNavItemTooltipStyles } from './collapsed_nav_button.styles';
|
|
19
|
+
import { useEuiI18n } from '../../../i18n';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
21
|
export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
|
|
21
22
|
var href = _ref.href,
|
|
@@ -35,6 +36,9 @@ export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
|
|
|
35
36
|
var buttonClassName = classNames('euiCollapsedNavButton', linkProps === null || linkProps === void 0 ? void 0 : linkProps.className);
|
|
36
37
|
var tooltipStyles = useEuiMemoizedStyles(euiCollapsedNavItemTooltipStyles);
|
|
37
38
|
var tooltipCssStyles = [tooltipStyles.euiCollapsedNavItemTooltip, tooltipStyles[side], hideToolTip && tooltipStyles.hidden];
|
|
39
|
+
var buttonIconAriaLabel = useEuiI18n('euiCollapsedNavButton.ariaLabelButtonIcon', '{title}, quick navigation menu', {
|
|
40
|
+
title: title
|
|
41
|
+
});
|
|
38
42
|
return ___EmotionJSX(EuiToolTip, {
|
|
39
43
|
content: title,
|
|
40
44
|
css: tooltipCssStyles,
|
|
@@ -47,7 +51,7 @@ export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
|
|
|
47
51
|
color: "text",
|
|
48
52
|
href: href,
|
|
49
53
|
onClick: onClick,
|
|
50
|
-
"aria-label":
|
|
54
|
+
"aria-label": buttonIconAriaLabel
|
|
51
55
|
}, linkProps, {
|
|
52
56
|
// Exclusive union shenanigans
|
|
53
57
|
className: buttonClassName,
|
|
@@ -20,8 +20,9 @@ import React, { Component } from 'react';
|
|
|
20
20
|
import moment from 'moment'; // eslint-disable-line import/named
|
|
21
21
|
|
|
22
22
|
import dateMath from '@elastic/datemath';
|
|
23
|
-
import { keys } from '../../../../services';
|
|
24
23
|
import { EuiFormRow, EuiFieldText, EuiFormLabel } from '../../../form';
|
|
24
|
+
import { EuiFlexGroup } from '../../../flex';
|
|
25
|
+
import { EuiButtonIcon } from '../../../button';
|
|
25
26
|
import { EuiCode } from '../../../code';
|
|
26
27
|
import { EuiI18n } from '../../../i18n';
|
|
27
28
|
import { EuiDatePicker } from '../../date_picker';
|
|
@@ -146,20 +147,29 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
|
|
|
146
147
|
locale: locale,
|
|
147
148
|
utcOffset: utcOffset
|
|
148
149
|
}), ___EmotionJSX(EuiI18n, {
|
|
149
|
-
tokens: ['euiAbsoluteTab.
|
|
150
|
-
defaults: ['
|
|
150
|
+
tokens: ['euiAbsoluteTab.dateFormatButtonLabel', 'euiAbsoluteTab.dateFormatError'],
|
|
151
|
+
defaults: ['Parse date', 'Allowed formats: {dateFormat}, ISO 8601, RFC 2822, or Unix timestamp.'],
|
|
151
152
|
values: {
|
|
152
153
|
dateFormat: ___EmotionJSX(EuiCode, null, dateFormat)
|
|
153
154
|
}
|
|
154
155
|
}, function (_ref) {
|
|
155
156
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
156
|
-
|
|
157
|
+
dateFormatButtonLabel = _ref2[0],
|
|
157
158
|
dateFormatError = _ref2[1];
|
|
158
|
-
return ___EmotionJSX(
|
|
159
|
+
return ___EmotionJSX(EuiFlexGroup, {
|
|
160
|
+
component: "form",
|
|
161
|
+
onSubmit: function onSubmit(e) {
|
|
162
|
+
e.preventDefault(); // Prevents a page refresh/reload
|
|
163
|
+
_this2.parseUserDateInput(textInputValue);
|
|
164
|
+
},
|
|
165
|
+
className: "euiSuperDatePicker__absoluteDateForm",
|
|
166
|
+
gutterSize: "s",
|
|
167
|
+
responsive: false
|
|
168
|
+
}, ___EmotionJSX(EuiFormRow, {
|
|
159
169
|
className: "euiSuperDatePicker__absoluteDateFormRow",
|
|
160
170
|
isInvalid: isTextInvalid,
|
|
161
171
|
error: isTextInvalid ? dateFormatError : undefined,
|
|
162
|
-
helpText: hasUnparsedText
|
|
172
|
+
helpText: hasUnparsedText && !isTextInvalid ? dateFormatError : undefined
|
|
163
173
|
}, ___EmotionJSX(EuiFieldText, {
|
|
164
174
|
compressed: true,
|
|
165
175
|
isInvalid: isTextInvalid,
|
|
@@ -168,13 +178,17 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
|
|
|
168
178
|
onPaste: function onPaste(event) {
|
|
169
179
|
_this2.parseUserDateInput(event.clipboardData.getData('text'));
|
|
170
180
|
},
|
|
171
|
-
onKeyDown: function onKeyDown(event) {
|
|
172
|
-
if (event.key === keys.ENTER) {
|
|
173
|
-
_this2.parseUserDateInput(textInputValue);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
181
|
"data-test-subj": "superDatePickerAbsoluteDateInput",
|
|
177
182
|
prepend: ___EmotionJSX(EuiFormLabel, null, labelPrefix)
|
|
183
|
+
})), hasUnparsedText && ___EmotionJSX(EuiButtonIcon, {
|
|
184
|
+
type: "submit",
|
|
185
|
+
className: "euiSuperDatePicker__absoluteDateFormSubmit",
|
|
186
|
+
size: "s",
|
|
187
|
+
display: "base",
|
|
188
|
+
iconType: "check",
|
|
189
|
+
"aria-label": dateFormatButtonLabel,
|
|
190
|
+
title: dateFormatButtonLabel,
|
|
191
|
+
"data-test-subj": "parseAbsoluteDateFormat"
|
|
178
192
|
}));
|
|
179
193
|
}));
|
|
180
194
|
}
|
|
@@ -10,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { shade, tint, darken, transparentize, makeHighContrastColor } from '../../services';
|
|
13
|
-
import { mathWithUnits, euiCanAnimate } from '../../global_styling';
|
|
13
|
+
import { mathWithUnits, euiCanAnimate, euiFontSize } from '../../global_styling';
|
|
14
14
|
export var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
15
15
|
var euiTheme = euiThemeContext.euiTheme,
|
|
16
16
|
colorMode = euiThemeContext.colorMode;
|
|
@@ -65,7 +65,9 @@ export var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
65
65
|
xxl: euiTheme.size.xxl
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sizes), colors), customControlColors), iconSizes), controlLayout)
|
|
68
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sizes), colors), customControlColors), iconSizes), controlLayout), {}, {
|
|
69
|
+
animationTiming: "".concat(euiTheme.animation.fast, " ease-in")
|
|
70
|
+
});
|
|
69
71
|
};
|
|
70
72
|
export var euiFormControlSize = function euiFormControlSize(euiThemeContext) {
|
|
71
73
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -99,5 +101,26 @@ export var euiCustomControl = function euiCustomControl(euiThemeContext) {
|
|
|
99
101
|
} else if (type === 'square') {
|
|
100
102
|
borderRadiusStyle = "border-radius: ".concat(form.controlCompressedBorderRadius, ";");
|
|
101
103
|
}
|
|
102
|
-
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(
|
|
104
|
+
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 ");
|
|
105
|
+
};
|
|
106
|
+
export var euiFormControlText = function euiFormControlText(euiThemeContext) {
|
|
107
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
108
|
+
var _euiFontSize = euiFontSize(euiThemeContext, 's'),
|
|
109
|
+
fontSize = _euiFontSize.fontSize;
|
|
110
|
+
var _euiFormVariables = euiFormVariables(euiThemeContext),
|
|
111
|
+
controlPlaceholderText = _euiFormVariables.controlPlaceholderText;
|
|
112
|
+
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 ");
|
|
113
|
+
};
|
|
114
|
+
export var euiFormControlDefaultShadow = function euiFormControlDefaultShadow(euiThemeContext) {
|
|
115
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
116
|
+
var form = euiFormVariables(euiThemeContext);
|
|
117
|
+
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 ");
|
|
118
|
+
};
|
|
119
|
+
export var euiFormControlFocusStyles = function euiFormControlFocusStyles(_ref) {
|
|
120
|
+
var euiTheme = _ref.euiTheme,
|
|
121
|
+
colorMode = _ref.colorMode;
|
|
122
|
+
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");
|
|
123
|
+
};
|
|
124
|
+
var euiPlaceholderPerBrowser = function euiPlaceholderPerBrowser(content) {
|
|
125
|
+
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");
|
|
103
126
|
};
|
|
@@ -17,17 +17,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
17
17
|
import React, { createElement, useEffect, useImperativeHandle, useMemo, useState, useCallback, useRef, forwardRef } from 'react';
|
|
18
18
|
import unified from 'unified';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
21
|
+
import { EuiModal } from '../modal';
|
|
22
|
+
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
20
23
|
import MarkdownActions, { insertText as _insertText } from './markdown_actions';
|
|
21
24
|
import { EuiMarkdownEditorToolbar } from './markdown_editor_toolbar';
|
|
22
25
|
import { EuiMarkdownEditorTextArea } from './markdown_editor_text_area';
|
|
23
26
|
import { EuiMarkdownFormat } from './markdown_format';
|
|
24
27
|
import { EuiMarkdownEditorDropZone } from './markdown_editor_drop_zone';
|
|
25
|
-
import { useGeneratedHtmlId } from '../../services';
|
|
26
28
|
import { MODE_EDITING, MODE_VIEWING } from './markdown_modes';
|
|
27
|
-
import { EuiModal } from '../modal';
|
|
28
29
|
import { EuiMarkdownContext } from './markdown_context';
|
|
29
30
|
import { defaultParsingPlugins, defaultProcessingPlugins, defaultUiPlugins } from './plugins/markdown_default_plugins';
|
|
30
|
-
import {
|
|
31
|
+
import { euiMarkdownEditorStyles } from './markdown_editor.styles';
|
|
31
32
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
33
|
// TODO I wanted to use the useCombinedRefs
|
|
33
34
|
// but I can't because it's not allowed to use react hooks
|
|
@@ -240,10 +241,10 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
240
241
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
241
242
|
editorToolbarHeight = _useState12[0],
|
|
242
243
|
setEditorToolbarHeight = _useState12[1];
|
|
244
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorStyles);
|
|
245
|
+
var cssStyles = [styles.euiMarkdownEditor, height === 'full' && styles.fullHeight];
|
|
243
246
|
var classes = classNames('euiMarkdownEditor', {
|
|
244
|
-
'euiMarkdownEditor
|
|
245
|
-
}, {
|
|
246
|
-
'euiMarkdownEditor--isPreviewing': isPreviewing
|
|
247
|
+
'euiMarkdownEditor-isPreviewing': isPreviewing
|
|
247
248
|
}, className);
|
|
248
249
|
var classesPreview = classNames('euiMarkdownEditorPreview', {
|
|
249
250
|
'euiMarkdownEditorPreview-isReadOnly': readOnly
|
|
@@ -282,7 +283,8 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
282
283
|
return ___EmotionJSX(EuiMarkdownContext.Provider, {
|
|
283
284
|
value: contextValue
|
|
284
285
|
}, ___EmotionJSX("div", _extends({
|
|
285
|
-
className: classes
|
|
286
|
+
className: classes,
|
|
287
|
+
css: cssStyles
|
|
286
288
|
}, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, {
|
|
287
289
|
ref: editorToolbarRef,
|
|
288
290
|
selectedNode: selectedNode,
|
|
@@ -295,6 +297,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
295
297
|
}), isPreviewing && ___EmotionJSX("div", {
|
|
296
298
|
ref: previewRef,
|
|
297
299
|
className: classesPreview,
|
|
300
|
+
css: styles.euiMarkdownEditorPreview,
|
|
298
301
|
style: {
|
|
299
302
|
height: previewHeight
|
|
300
303
|
}
|
|
@@ -304,7 +307,8 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
304
307
|
}, markdownFormatProps), value)), ___EmotionJSX("div", {
|
|
305
308
|
className: "euiMarkdownEditor__toggleContainer",
|
|
306
309
|
style: {
|
|
307
|
-
height: editorToggleContainerHeight
|
|
310
|
+
height: editorToggleContainerHeight,
|
|
311
|
+
display: isPreviewing ? 'none' : undefined
|
|
308
312
|
}
|
|
309
313
|
}, ___EmotionJSX(EuiMarkdownEditorDropZone, {
|
|
310
314
|
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,5 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
3
6
|
/*
|
|
4
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
8
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -8,11 +11,14 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
11
|
* Side Public License, v 1.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
|
-
import React, { useEffect } from 'react';
|
|
14
|
+
import React, { useEffect, useContext } from 'react';
|
|
12
15
|
import classNames from 'classnames';
|
|
13
16
|
import { useDropzone } from 'react-dropzone';
|
|
14
|
-
import {
|
|
17
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
15
18
|
import { useResizeObserver } from '../observer/resize_observer';
|
|
19
|
+
import { EuiMarkdownContext } from './markdown_context';
|
|
20
|
+
import { EuiMarkdownEditorFooter } from './markdown_editor_footer';
|
|
21
|
+
import { euiMarkdownEditorDropZoneStyles } from './markdown_editor_drop_zone.styles';
|
|
16
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
23
|
var getUnacceptedItems = function getUnacceptedItems(items, dropHandlers) {
|
|
18
24
|
var unacceptedItems = [];
|
|
@@ -32,6 +38,8 @@ var getUnacceptedItems = function getUnacceptedItems(items, dropHandlers) {
|
|
|
32
38
|
return unacceptedItems;
|
|
33
39
|
};
|
|
34
40
|
export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props) {
|
|
41
|
+
var _useContext = useContext(EuiMarkdownContext),
|
|
42
|
+
readOnly = _useContext.readOnly;
|
|
35
43
|
var _React$useState = React.useState(false),
|
|
36
44
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
45
|
isDragging = _React$useState2[0],
|
|
@@ -53,11 +61,9 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
|
|
|
53
61
|
setHasUnacceptedItems = props.setHasUnacceptedItems,
|
|
54
62
|
setEditorFooterHeight = props.setEditorFooterHeight,
|
|
55
63
|
isEditing = props.isEditing;
|
|
56
|
-
var classes = classNames('euiMarkdownEditorDropZone'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'euiMarkdownEditorDropZone--isDraggingError': isDraggingError
|
|
60
|
-
});
|
|
64
|
+
var classes = classNames('euiMarkdownEditorDropZone');
|
|
65
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorDropZoneStyles);
|
|
66
|
+
var cssStyles = [styles.euiMarkdownEditorDropZone, isDragging && !isDraggingError && styles.isDragging, isDraggingError && styles.isDraggingError, (hasUnacceptedItems || errors.length > 0) && styles.hasError];
|
|
61
67
|
var _React$useState7 = React.useState(null),
|
|
62
68
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
63
69
|
editorFooterRef = _React$useState8[0],
|
|
@@ -70,7 +76,7 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
|
|
|
70
76
|
}
|
|
71
77
|
}, [setEditorFooterHeight, isEditing, editorFooterHeight]);
|
|
72
78
|
var _useDropzone = useDropzone({
|
|
73
|
-
disabled: dropHandlers.length === 0,
|
|
79
|
+
disabled: dropHandlers.length === 0 || readOnly,
|
|
74
80
|
// Disable click and keydown behavior
|
|
75
81
|
noClick: true,
|
|
76
82
|
noKeyboard: true,
|
|
@@ -155,7 +161,11 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
|
|
|
155
161
|
getRootProps = _useDropzone.getRootProps,
|
|
156
162
|
getInputProps = _useDropzone.getInputProps,
|
|
157
163
|
open = _useDropzone.open;
|
|
158
|
-
|
|
164
|
+
var rootProps = _objectSpread({}, getRootProps());
|
|
165
|
+
if (readOnly) rootProps.role = undefined; // Unset the default `role="button"` attribute which sets a misleading pointer icon
|
|
166
|
+
|
|
167
|
+
return ___EmotionJSX("div", _extends({}, rootProps, {
|
|
168
|
+
css: cssStyles,
|
|
159
169
|
className: classes
|
|
160
170
|
}), children, ___EmotionJSX(EuiMarkdownEditorFooter, {
|
|
161
171
|
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
|
+
};
|
|
@@ -8,6 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { useState, useMemo, Fragment, forwardRef, useContext } from 'react';
|
|
11
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
11
12
|
import { EuiLoadingSpinner } from '../loading';
|
|
12
13
|
import { EuiButton, EuiButtonEmpty, EuiButtonIcon } from '../button';
|
|
13
14
|
import { EuiTitle } from '../title';
|
|
@@ -17,11 +18,12 @@ import { EuiPopover, EuiPopoverTitle } from '../popover';
|
|
|
17
18
|
import { EuiText } from '../text';
|
|
18
19
|
import { EuiSpacer } from '../spacer';
|
|
19
20
|
import { EuiToolTip } from '../tool_tip';
|
|
20
|
-
// @ts-ignore a react svg
|
|
21
|
-
import MarkdownLogo from './icons/markdown_logo';
|
|
22
21
|
import { EuiHorizontalRule } from '../horizontal_rule';
|
|
23
22
|
import { EuiLink } from '../link';
|
|
24
23
|
import { EuiMarkdownContext } from './markdown_context';
|
|
24
|
+
// @ts-ignore a react svg
|
|
25
|
+
import MarkdownLogo from './icons/markdown_logo';
|
|
26
|
+
import { euiMarkdownEditorFooterStyles } from './markdown_editor_footer.styles';
|
|
25
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
28
|
export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
27
29
|
var uiPlugins = props.uiPlugins,
|
|
@@ -30,6 +32,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
30
32
|
errors = props.errors,
|
|
31
33
|
hasUnacceptedItems = props.hasUnacceptedItems,
|
|
32
34
|
dropHandlers = props.dropHandlers;
|
|
35
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorFooterStyles);
|
|
33
36
|
var _useState = useState(false),
|
|
34
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
38
|
isShowingHelpModal = _useState2[0],
|
|
@@ -81,6 +84,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
81
84
|
uploadButton = ___EmotionJSX(EuiToolTip, {
|
|
82
85
|
content: ariaLabels.supportedFileTypes
|
|
83
86
|
}, ___EmotionJSX(EuiButtonEmpty, {
|
|
87
|
+
css: styles.euiMarkdownEditorFooter__uploadError,
|
|
84
88
|
className: "euiMarkdownEditorFooter__uploadError",
|
|
85
89
|
autoFocus: true,
|
|
86
90
|
size: "s",
|
|
@@ -116,6 +120,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
116
120
|
panelPaddingSize: "s",
|
|
117
121
|
anchorPosition: "upCenter"
|
|
118
122
|
}, ___EmotionJSX("div", {
|
|
123
|
+
css: styles.euiMarkdownEditorFooter__popover,
|
|
119
124
|
className: "euiMarkdownEditorFooter__popover"
|
|
120
125
|
}, ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
|
|
121
126
|
token: "euiMarkdownEditorFooter.errorsTitle",
|
|
@@ -146,6 +151,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
146
151
|
content: syntaxTitle
|
|
147
152
|
}, ___EmotionJSX(EuiButtonIcon, {
|
|
148
153
|
size: "s",
|
|
154
|
+
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
149
155
|
className: "euiMarkdownEditorFooter__helpButton",
|
|
150
156
|
iconType: MarkdownLogo,
|
|
151
157
|
color: "text",
|
|
@@ -192,6 +198,7 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
192
198
|
button: ___EmotionJSX(EuiButtonIcon, {
|
|
193
199
|
title: syntaxTitle,
|
|
194
200
|
size: "s",
|
|
201
|
+
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
195
202
|
className: "euiMarkdownEditorFooter__helpButton",
|
|
196
203
|
iconType: MarkdownLogo,
|
|
197
204
|
color: "text",
|
|
@@ -217,8 +224,10 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
217
224
|
}
|
|
218
225
|
return ___EmotionJSX("div", {
|
|
219
226
|
ref: ref,
|
|
227
|
+
css: styles.euiMarkdownEditorFooter,
|
|
220
228
|
className: "euiMarkdownEditorFooter"
|
|
221
229
|
}, ___EmotionJSX("div", {
|
|
230
|
+
css: styles.euiMarkdownEditorFooter__actions,
|
|
222
231
|
className: "euiMarkdownEditorFooter__actions"
|
|
223
232
|
}, uploadButton, errorsButton), helpSyntaxButton);
|
|
224
233
|
});
|
|
@@ -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
|
+
};
|
|
@@ -11,7 +11,9 @@ var _excluded = ["children", "compressed", "id", "isInvalid", "name", "placehold
|
|
|
11
11
|
|
|
12
12
|
import React, { forwardRef, useContext } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
14
15
|
import { EuiMarkdownContext } from './markdown_context';
|
|
16
|
+
import { euiMarkdownEditorTextAreaStyles } from './markdown_editor_text_area.styles';
|
|
15
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
18
|
export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
19
|
var children = _ref.children,
|
|
@@ -29,6 +31,8 @@ export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, r
|
|
|
29
31
|
var classes = classNames('euiMarkdownEditorTextArea', {
|
|
30
32
|
'euiMarkdownEditorTextArea-isReadOnly': readOnly
|
|
31
33
|
});
|
|
34
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorTextAreaStyles);
|
|
35
|
+
var cssStyles = [styles.euiMarkdownEditorTextArea, readOnly ? styles.readOnly : styles.editable];
|
|
32
36
|
|
|
33
37
|
// Ignore invalid empty string style values
|
|
34
38
|
var style = {};
|
|
@@ -42,7 +46,8 @@ export var EuiMarkdownEditorTextArea = /*#__PURE__*/forwardRef(function (_ref, r
|
|
|
42
46
|
ref: ref,
|
|
43
47
|
"data-test-subj": "euiMarkdownEditorTextArea",
|
|
44
48
|
style: style,
|
|
45
|
-
className: classes
|
|
49
|
+
className: classes,
|
|
50
|
+
css: cssStyles
|
|
46
51
|
}, rest, {
|
|
47
52
|
rows: 6,
|
|
48
53
|
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
|
+
};
|
|
@@ -8,11 +8,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { useContext, forwardRef } from 'react';
|
|
11
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
11
12
|
import { EuiButtonEmpty, EuiButtonIcon } from '../button';
|
|
12
13
|
import { EuiI18n } from '../i18n';
|
|
13
14
|
import { EuiToolTip } from '../tool_tip';
|
|
14
15
|
import { MODE_VIEWING } from './markdown_modes';
|
|
15
16
|
import { EuiMarkdownContext } from './markdown_context';
|
|
17
|
+
import { euiMarkdownEditorToolbarStyles } from './markdown_editor_toolbar.styles';
|
|
16
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
19
|
var boldItalicButtons = [{
|
|
18
20
|
id: 'mdBold',
|
|
@@ -98,11 +100,14 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
|
|
|
98
100
|
};
|
|
99
101
|
var isPreviewing = viewMode === MODE_VIEWING;
|
|
100
102
|
var isEditable = !isPreviewing && !readOnly;
|
|
103
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorToolbarStyles);
|
|
101
104
|
return ___EmotionJSX("div", {
|
|
102
105
|
ref: ref,
|
|
103
|
-
|
|
104
|
-
className: "euiMarkdownEditorToolbar"
|
|
106
|
+
css: styles.euiMarkdownEditorToolbar,
|
|
107
|
+
className: "euiMarkdownEditorToolbar",
|
|
108
|
+
"data-test-subj": "euiMarkdownEditorToolbar"
|
|
105
109
|
}, ___EmotionJSX("div", {
|
|
110
|
+
css: styles.euiMarkdownEditorToolbar__buttons,
|
|
106
111
|
className: "euiMarkdownEditorToolbar__buttons"
|
|
107
112
|
}, boldItalicButtons.map(function (item) {
|
|
108
113
|
return ___EmotionJSX(EuiToolTip, {
|
|
@@ -119,6 +124,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
|
|
|
119
124
|
icon: item.iconType
|
|
120
125
|
}));
|
|
121
126
|
}), ___EmotionJSX("span", {
|
|
127
|
+
css: styles.euiMarkdownEditorToolbar__divider,
|
|
122
128
|
className: "euiMarkdownEditorToolbar__divider"
|
|
123
129
|
}), listButtons.map(function (item) {
|
|
124
130
|
return ___EmotionJSX(EuiToolTip, {
|
|
@@ -135,6 +141,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
|
|
|
135
141
|
icon: item.iconType
|
|
136
142
|
}));
|
|
137
143
|
}), ___EmotionJSX("span", {
|
|
144
|
+
css: styles.euiMarkdownEditorToolbar__divider,
|
|
138
145
|
className: "euiMarkdownEditorToolbar__divider"
|
|
139
146
|
}), quoteCodeLinkButtons.map(function (item) {
|
|
140
147
|
return ___EmotionJSX(EuiToolTip, {
|
|
@@ -151,6 +158,7 @@ export var EuiMarkdownEditorToolbar = /*#__PURE__*/forwardRef(function (_ref2, r
|
|
|
151
158
|
icon: item.iconType
|
|
152
159
|
}));
|
|
153
160
|
}), uiPlugins.length > 0 ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
|
|
161
|
+
css: styles.euiMarkdownEditorToolbar__divider,
|
|
154
162
|
className: "euiMarkdownEditorToolbar__divider"
|
|
155
163
|
}), uiPlugins.map(function (_ref3) {
|
|
156
164
|
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,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "parsingPluginList", "processingPluginList", "textSize"];
|
|
3
|
+
var _excluded = ["children", "className", "parsingPluginList", "processingPluginList", "textSize", "color"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -13,7 +13,8 @@ import React, { useMemo } from 'react';
|
|
|
13
13
|
import unified from 'unified';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { EuiText } from '../text/text';
|
|
16
|
-
import {
|
|
16
|
+
import { _isNamedColor } from '../text/text_color';
|
|
17
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
17
18
|
import { euiMarkdownFormatStyles } from './markdown_format.styles';
|
|
18
19
|
import { defaultProcessingPlugins, defaultParsingPlugins } from './plugins/markdown_default_plugins';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -26,6 +27,8 @@ export var EuiMarkdownFormat = function EuiMarkdownFormat(_ref) {
|
|
|
26
27
|
processingPluginList = _ref$processingPlugin === void 0 ? defaultProcessingPlugins : _ref$processingPlugin,
|
|
27
28
|
_ref$textSize = _ref.textSize,
|
|
28
29
|
textSize = _ref$textSize === void 0 ? 'm' : _ref$textSize,
|
|
30
|
+
_ref$color = _ref.color,
|
|
31
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
29
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
33
|
var processor = useMemo(function () {
|
|
31
34
|
return unified().use(parsingPluginList).use(processingPluginList);
|
|
@@ -41,13 +44,13 @@ export var EuiMarkdownFormat = function EuiMarkdownFormat(_ref) {
|
|
|
41
44
|
return children;
|
|
42
45
|
}
|
|
43
46
|
}, [children, processor]);
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var cssStyles = [styles.euiMarkdownFormat, styles[textSize]];
|
|
47
|
+
var styles = useEuiMemoizedStyles(euiMarkdownFormatStyles);
|
|
48
|
+
var cssStyles = [styles.euiMarkdownFormat, styles[textSize], _isNamedColor(color) ? styles.colors[color] : styles.colors.custom];
|
|
47
49
|
var classes = classNames('euiMarkdownFormat', className);
|
|
48
50
|
return ___EmotionJSX(EuiText, _extends({
|
|
49
51
|
size: textSize,
|
|
50
52
|
css: cssStyles,
|
|
51
|
-
className: classes
|
|
53
|
+
className: classes,
|
|
54
|
+
color: color
|
|
52
55
|
}, rest), result);
|
|
53
56
|
};
|