@elastic/eui 106.1.0-amsterdam.0 → 106.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/call_out/call_out.js +2 -1
- package/es/components/card/checkable_card/checkable_card.js +30 -5
- package/es/components/code/code_block.js +5 -2
- package/es/components/code/code_block_virtualized.js +5 -3
- package/es/components/markdown_editor/index.js +1 -0
- package/es/components/markdown_editor/markdown_editor.js +15 -4
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
- package/es/components/markdown_editor/markdown_editor_footer.js +12 -120
- package/es/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
- package/es/components/markdown_editor/markdown_editor_help_button.js +144 -0
- package/es/components/markdown_editor/markdown_editor_help_button.styles.js +16 -0
- package/es/components/markdown_editor/markdown_editor_toolbar.js +28 -23
- package/es/components/popover/popover.js +2 -1
- package/es/components/provider/provider.js +2 -2
- package/es/services/color/vis_color_store.js +1 -1
- package/es/services/theme/context.js +2 -2
- package/eui.d.ts +432 -400
- package/i18ntokens.json +624 -624
- package/lib/components/call_out/call_out.js +3 -2
- package/lib/components/card/checkable_card/checkable_card.js +29 -4
- package/lib/components/code/code_block.js +5 -2
- package/lib/components/code/code_block_virtualized.js +5 -3
- package/lib/components/markdown_editor/index.js +7 -0
- package/lib/components/markdown_editor/markdown_editor.js +15 -4
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
- package/lib/components/markdown_editor/markdown_editor_footer.js +10 -117
- package/lib/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
- package/lib/components/markdown_editor/markdown_editor_help_button.js +151 -0
- package/lib/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +28 -23
- package/lib/components/popover/popover.js +2 -1
- package/lib/components/provider/provider.js +2 -2
- package/lib/services/color/vis_color_store.js +2 -2
- package/lib/services/theme/context.js +2 -2
- package/optimize/es/components/call_out/call_out.js +1 -0
- package/optimize/es/components/card/checkable_card/checkable_card.js +25 -5
- package/optimize/es/components/code/code_block.js +5 -2
- package/optimize/es/components/code/code_block_virtualized.js +5 -3
- package/optimize/es/components/markdown_editor/index.js +1 -0
- package/optimize/es/components/markdown_editor/markdown_editor.js +7 -3
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +3 -2
- package/optimize/es/components/markdown_editor/markdown_editor_footer.js +12 -120
- package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
- package/optimize/es/components/markdown_editor/markdown_editor_help_button.js +139 -0
- package/optimize/es/components/markdown_editor/markdown_editor_help_button.styles.js +16 -0
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +20 -16
- package/optimize/es/components/popover/popover.js +2 -1
- package/optimize/es/components/provider/provider.js +2 -2
- package/optimize/es/services/color/vis_color_store.js +1 -1
- package/optimize/es/services/theme/context.js +2 -2
- package/optimize/lib/components/call_out/call_out.js +2 -1
- package/optimize/lib/components/card/checkable_card/checkable_card.js +24 -4
- package/optimize/lib/components/code/code_block.js +5 -2
- package/optimize/lib/components/code/code_block_virtualized.js +5 -3
- package/optimize/lib/components/markdown_editor/index.js +7 -0
- package/optimize/lib/components/markdown_editor/markdown_editor.js +7 -3
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +3 -2
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +9 -118
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
- package/optimize/lib/components/markdown_editor/markdown_editor_help_button.js +150 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +20 -16
- package/optimize/lib/components/popover/popover.js +2 -1
- package/optimize/lib/components/provider/provider.js +2 -2
- package/optimize/lib/services/color/vis_color_store.js +2 -2
- package/optimize/lib/services/theme/context.js +2 -2
- package/package.json +1 -1
- package/test-env/components/call_out/call_out.js +3 -2
- package/test-env/components/card/checkable_card/checkable_card.js +24 -4
- package/test-env/components/code/code_block_virtualized.js +5 -3
- package/test-env/components/markdown_editor/index.js +7 -0
- package/test-env/components/markdown_editor/markdown_editor.js +15 -4
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +5 -3
- package/test-env/components/markdown_editor/markdown_editor_footer.js +9 -118
- package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +0 -2
- package/test-env/components/markdown_editor/markdown_editor_help_button.js +150 -0
- package/test-env/components/markdown_editor/markdown_editor_help_button.styles.js +22 -0
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +28 -23
- package/test-env/components/popover/popover.js +2 -1
- package/test-env/components/provider/provider.js +2 -2
- package/test-env/services/color/vis_color_store.js +2 -2
- package/test-env/services/theme/context.js +2 -2
|
@@ -29,6 +29,7 @@ import { euiCallOutStyles, euiCallOutHeaderStyles } from './call_out.styles';
|
|
|
29
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
30
|
export var COLORS = ['primary', 'success', 'warning', 'danger', 'accent'];
|
|
31
31
|
export var HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
|
|
32
|
+
export var SIZES = ['s', 'm'];
|
|
32
33
|
export var EuiCallOut = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
33
34
|
var title = _ref.title,
|
|
34
35
|
_ref$color = _ref.color,
|
|
@@ -108,7 +109,7 @@ EuiCallOut.propTypes = {
|
|
|
108
109
|
title: PropTypes.node,
|
|
109
110
|
iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "anomalyChart", "anomalySwimLane", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "article", "asterisk", "at", "auditbeatApp", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "changePointDetection", "check", "checkCircle", "checkInCircleFilled", "cheer", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "code", "codeApp", "color", "comment", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "contrast", "contrastHigh", "controls", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInCircle", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "diff", "discoverApp", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "endpoint", "eql", "eraser", "error", "errorFilled", "esqlVis", "exit", "expand", "expandMini", "export", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "fieldStatistics", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flask", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "info", "image", "importAction", "index", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "launch", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logPatternAnalysis", "logRateAnalysis", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "minusInSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "newChat", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipeBreaks", "pipelineApp", "pipeNoBreaks", "pivot", "play", "playFilled", "plugs", "plus", "plusInCircle", "plusInCircleFilled", "plusInSquare", "popout", "push", "question", "quote", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "timeslider", "training", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "warningFilled", "alert", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDimension", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenSemanticText", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenDenseVector", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]),
|
|
110
111
|
color: PropTypes.any,
|
|
111
|
-
size: PropTypes.
|
|
112
|
+
size: PropTypes.any,
|
|
112
113
|
heading: PropTypes.any,
|
|
113
114
|
/**
|
|
114
115
|
* Passing an `onDismiss` callback will render a cross in the top right hand corner
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
var _excluded = ["children", "className", "css", "checkableType", "label", "labelProps", "checked", "disabled", "hasShadow", "hasBorder"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
3
9
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
10
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
11
|
/*
|
|
@@ -10,9 +16,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
16
|
* Side Public License, v 1.
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
|
-
import React, { useRef } from 'react';
|
|
19
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
14
20
|
import PropTypes from "prop-types";
|
|
15
21
|
import classNames from 'classnames';
|
|
22
|
+
import { tabbable } from 'tabbable';
|
|
16
23
|
import { EuiRadio, EuiCheckbox } from '../../form';
|
|
17
24
|
import { EuiSplitPanel } from '../../panel';
|
|
18
25
|
import { useEuiTheme } from '../../../services';
|
|
@@ -44,7 +51,16 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
|
|
|
44
51
|
var id = rest.id;
|
|
45
52
|
var labelEl = useRef(null);
|
|
46
53
|
var inputEl = useRef(null);
|
|
54
|
+
var childrenWrapperEl = useRef(null);
|
|
47
55
|
var classes = classNames('euiCheckableCard', className);
|
|
56
|
+
var _useState = useState(false),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
hasInteractiveChildren = _useState2[0],
|
|
59
|
+
setHasInteractiveChildren = _useState2[1];
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
var interactiveElements = childrenWrapperEl.current ? tabbable(childrenWrapperEl.current) : [];
|
|
62
|
+
setHasInteractiveChildren(interactiveElements.length > 0);
|
|
63
|
+
}, [children, childrenWrapperEl]);
|
|
48
64
|
var checkableElement;
|
|
49
65
|
if (checkableType === 'radio') {
|
|
50
66
|
checkableElement = ___EmotionJSX(EuiRadio, _extends({
|
|
@@ -60,9 +76,13 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
|
|
|
60
76
|
}
|
|
61
77
|
var labelClasses = classNames('euiCheckableCard__label');
|
|
62
78
|
var onChangeAffordance = function onChangeAffordance(e) {
|
|
63
|
-
if (labelEl.current
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
if (!labelEl.current || e.target === inputEl.current) return;
|
|
80
|
+
labelEl.current.click();
|
|
81
|
+
};
|
|
82
|
+
var onChildrenClick = function onChildrenClick() {
|
|
83
|
+
var _labelEl$current;
|
|
84
|
+
if (hasInteractiveChildren) return;
|
|
85
|
+
(_labelEl$current = labelEl.current) === null || _labelEl$current === void 0 || _labelEl$current.click();
|
|
66
86
|
};
|
|
67
87
|
return ___EmotionJSX(EuiSplitPanel.Outer, {
|
|
68
88
|
responsive: false,
|
|
@@ -83,9 +103,14 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
|
|
|
83
103
|
htmlFor: id,
|
|
84
104
|
"aria-describedby": children ? "".concat(id, "-details") : undefined
|
|
85
105
|
}), label), children && ___EmotionJSX("div", {
|
|
106
|
+
ref: childrenWrapperEl,
|
|
86
107
|
id: "".concat(id, "-details"),
|
|
87
108
|
className: "euiCheckableCard__children",
|
|
88
|
-
css: childStyles
|
|
109
|
+
css: childStyles,
|
|
110
|
+
onClick: disabled ? undefined : onChildrenClick,
|
|
111
|
+
style: {
|
|
112
|
+
cursor: !disabled && !hasInteractiveChildren ? 'pointer' : undefined
|
|
113
|
+
}
|
|
89
114
|
}, children)));
|
|
90
115
|
};
|
|
91
116
|
EuiCheckableCard.propTypes = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["language", "transparentBackground", "paddingSize", "fontSize", "isCopyable", "copyAriaLabel", "whiteSpace", "children", "className", "overflowHeight", "isVirtualized", "lineNumbers"];
|
|
1
|
+
var _excluded = ["language", "transparentBackground", "paddingSize", "fontSize", "isCopyable", "copyAriaLabel", "whiteSpace", "children", "className", "overflowHeight", "isVirtualized", "lineNumbers", "aria-label"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
4
|
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."); }
|
|
@@ -68,6 +68,7 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
68
68
|
_isVirtualized = _ref.isVirtualized,
|
|
69
69
|
_ref$lineNumbers = _ref.lineNumbers,
|
|
70
70
|
lineNumbers = _ref$lineNumbers === void 0 ? false : _ref$lineNumbers,
|
|
71
|
+
ariaLabel = _ref['aria-label'],
|
|
71
72
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
72
73
|
var euiTheme = useEuiTheme();
|
|
73
74
|
var language = useMemo(function () {
|
|
@@ -159,13 +160,14 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
159
160
|
});
|
|
160
161
|
// pre tags don't accept aria-label without an
|
|
161
162
|
// appropriate role, we add a SR only text instead
|
|
162
|
-
var codeBlockLabelElement = ___EmotionJSX(React.Fragment, null, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, codeBlockLabel)), tabularCopyMarkers.hiddenNoCopyBoundary);
|
|
163
|
+
var codeBlockLabelElement = ___EmotionJSX(React.Fragment, null, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, ariaLabel ? "".concat(ariaLabel, ", ") : undefined, codeBlockLabel)), tabularCopyMarkers.hiddenNoCopyBoundary);
|
|
163
164
|
return ___EmotionJSX("div", {
|
|
164
165
|
css: cssStyles,
|
|
165
166
|
className: classNames('euiCodeBlock', className),
|
|
166
167
|
style: overflowHeightStyles
|
|
167
168
|
}, isVirtualized ? ___EmotionJSX(EuiCodeBlockVirtualized, {
|
|
168
169
|
data: data,
|
|
170
|
+
label: codeBlockLabelElement,
|
|
169
171
|
rowHeight: fontSizeToRowHeightMap[fontSize],
|
|
170
172
|
overflowHeight: overflowHeight,
|
|
171
173
|
preProps: preProps,
|
|
@@ -180,6 +182,7 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
180
182
|
onClose: onKeyDown
|
|
181
183
|
}, isVirtualized ? ___EmotionJSX(EuiCodeBlockVirtualized, {
|
|
182
184
|
data: data,
|
|
185
|
+
label: codeBlockLabelElement,
|
|
183
186
|
rowHeight: fontSizeToRowHeightMap.l,
|
|
184
187
|
preProps: preFullscreenProps,
|
|
185
188
|
codeProps: codeProps
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["style"],
|
|
1
|
+
var _excluded = ["style", "children"],
|
|
2
2
|
_excluded2 = ["style"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
@@ -19,6 +19,7 @@ import { nodeToHtml } from './utils';
|
|
|
19
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
20
|
export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
|
|
21
21
|
var data = _ref.data,
|
|
22
|
+
label = _ref.label,
|
|
22
23
|
rowHeight = _ref.rowHeight,
|
|
23
24
|
overflowHeight = _ref.overflowHeight,
|
|
24
25
|
preProps = _ref.preProps,
|
|
@@ -26,14 +27,15 @@ export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
|
|
|
26
27
|
var VirtualizedOuterElement = useMemo(function () {
|
|
27
28
|
return /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
28
29
|
var style = _ref2.style,
|
|
30
|
+
children = _ref2.children,
|
|
29
31
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
30
32
|
return ___EmotionJSX("pre", _extends({
|
|
31
33
|
style: logicalStyles(style)
|
|
32
34
|
}, props, {
|
|
33
35
|
ref: ref
|
|
34
|
-
}, preProps));
|
|
36
|
+
}, preProps), label, children);
|
|
35
37
|
});
|
|
36
|
-
}, [preProps]);
|
|
38
|
+
}, [preProps, label]);
|
|
37
39
|
var VirtualizedInnerElement = useMemo(function () {
|
|
38
40
|
return /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
39
41
|
var style = _ref3.style,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { EuiMarkdownEditor } from './markdown_editor';
|
|
10
|
+
export { EuiMarkdownEditorHelpButton } from './markdown_editor_help_button';
|
|
10
11
|
export { getDefaultEuiMarkdownParsingPlugins, getDefaultEuiMarkdownProcessingPlugins, getDefaultEuiMarkdownUiPlugins, getDefaultEuiMarkdownPlugins } from './plugins/markdown_default_plugins';
|
|
11
12
|
export { EuiMarkdownContext } from './markdown_context';
|
|
12
13
|
export { EuiMarkdownFormat } from './markdown_format';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "editorId", "value", "onChange", "height", "maxHeight", "autoExpandPreview", "parsingPluginList", "processingPluginList", "uiPlugins", "onParse", "errors", "aria-label", "aria-labelledby", "aria-describedby", "initialViewMode", "dropHandlers", "markdownFormatProps", "placeholder", "readOnly"];
|
|
1
|
+
var _excluded = ["className", "editorId", "value", "onChange", "height", "maxHeight", "autoExpandPreview", "parsingPluginList", "processingPluginList", "uiPlugins", "onParse", "errors", "aria-label", "aria-labelledby", "aria-describedby", "initialViewMode", "dropHandlers", "markdownFormatProps", "placeholder", "readOnly", "toolbarProps", "showFooter"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -114,6 +114,9 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
114
114
|
markdownFormatProps = _ref.markdownFormatProps,
|
|
115
115
|
placeholder = _ref.placeholder,
|
|
116
116
|
readOnly = _ref.readOnly,
|
|
117
|
+
toolbarProps = _ref.toolbarProps,
|
|
118
|
+
_ref$showFooter = _ref.showFooter,
|
|
119
|
+
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
|
|
117
120
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
118
121
|
var _useState = useState(initialViewMode),
|
|
119
122
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -293,7 +296,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
293
296
|
}, ___EmotionJSX("div", _extends({
|
|
294
297
|
className: classes,
|
|
295
298
|
css: cssStyles
|
|
296
|
-
}, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, {
|
|
299
|
+
}, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, _extends({
|
|
297
300
|
ref: editorToolbarRef,
|
|
298
301
|
selectedNode: selectedNode,
|
|
299
302
|
markdownActions: markdownActions,
|
|
@@ -302,7 +305,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
302
305
|
},
|
|
303
306
|
viewMode: viewMode,
|
|
304
307
|
uiPlugins: toolbarPlugins
|
|
305
|
-
}), isPreviewing && ___EmotionJSX("div", {
|
|
308
|
+
}, toolbarProps)), isPreviewing && ___EmotionJSX("div", {
|
|
306
309
|
ref: previewRef,
|
|
307
310
|
className: classesPreview,
|
|
308
311
|
css: styles.euiMarkdownEditorPreview,
|
|
@@ -334,6 +337,7 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
334
337
|
selectionEnd: newSelectionPoint
|
|
335
338
|
});
|
|
336
339
|
},
|
|
340
|
+
showFooter: showFooter,
|
|
337
341
|
uiPlugins: toolbarPlugins,
|
|
338
342
|
errors: errors,
|
|
339
343
|
hasUnacceptedItems: hasUnacceptedItems,
|
|
@@ -468,6 +472,13 @@ EuiMarkdownEditor.propTypes = {
|
|
|
468
472
|
* Determines the text size. Choose `relative` to control the `font-size` based on the value of a parent container.
|
|
469
473
|
*/
|
|
470
474
|
textSize: PropTypes.any
|
|
471
|
-
})
|
|
475
|
+
}),
|
|
476
|
+
/**
|
|
477
|
+
* Props to customize the toolbar. `right` replaces the default preview/editor toggle with custom content.
|
|
478
|
+
*/
|
|
479
|
+
toolbarProps: PropTypes.shape({
|
|
480
|
+
right: PropTypes.node
|
|
481
|
+
}),
|
|
482
|
+
/** Controls whether the footer is shown */showFooter: PropTypes.bool
|
|
472
483
|
};
|
|
473
484
|
EuiMarkdownEditor.displayName = 'EuiMarkdownEditor';
|
|
@@ -69,7 +69,8 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
|
|
|
69
69
|
hasUnacceptedItems = props.hasUnacceptedItems,
|
|
70
70
|
setHasUnacceptedItems = props.setHasUnacceptedItems,
|
|
71
71
|
setEditorFooterHeight = props.setEditorFooterHeight,
|
|
72
|
-
isEditing = props.isEditing
|
|
72
|
+
isEditing = props.isEditing,
|
|
73
|
+
showFooter = props.showFooter;
|
|
73
74
|
var classes = classNames('euiMarkdownEditorDropZone');
|
|
74
75
|
var styles = useEuiMemoizedStyles(euiMarkdownEditorDropZoneStyles);
|
|
75
76
|
var cssStyles = [styles.euiMarkdownEditorDropZone, isDragging && !isDraggingError && styles.isDragging, isDraggingError && styles.isDraggingError, (hasUnacceptedItems || errors.length > 0) && styles.hasError];
|
|
@@ -176,7 +177,7 @@ export var EuiMarkdownEditorDropZone = function EuiMarkdownEditorDropZone(props)
|
|
|
176
177
|
return ___EmotionJSX("div", _extends({}, rootProps, {
|
|
177
178
|
css: cssStyles,
|
|
178
179
|
className: classes
|
|
179
|
-
}), children, ___EmotionJSX(EuiMarkdownEditorFooter, {
|
|
180
|
+
}), children, showFooter && ___EmotionJSX(EuiMarkdownEditorFooter, {
|
|
180
181
|
ref: setEditorFooterRef,
|
|
181
182
|
uiPlugins: uiPlugins,
|
|
182
183
|
openFiles: function openFiles() {
|
|
@@ -223,5 +224,6 @@ EuiMarkdownEditorDropZone.propTypes = {
|
|
|
223
224
|
hasUnacceptedItems: PropTypes.bool.isRequired,
|
|
224
225
|
setHasUnacceptedItems: PropTypes.func.isRequired,
|
|
225
226
|
setEditorFooterHeight: PropTypes.func.isRequired,
|
|
226
|
-
isEditing: PropTypes.bool.isRequired
|
|
227
|
+
isEditing: PropTypes.bool.isRequired,
|
|
228
|
+
showFooter: PropTypes.bool
|
|
227
229
|
};
|
|
@@ -12,24 +12,18 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import React, { useState, useMemo,
|
|
15
|
+
import React, { useState, useMemo, forwardRef, useContext } from 'react';
|
|
16
16
|
import PropTypes from "prop-types";
|
|
17
|
-
import { useEuiMemoizedStyles
|
|
17
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
18
18
|
import { EuiLoadingSpinner } from '../loading';
|
|
19
|
-
import {
|
|
20
|
-
import { EuiTitle } from '../title';
|
|
21
|
-
import { EuiModal, EuiModalBody, EuiModalFooter, EuiModalHeader } from '../modal';
|
|
19
|
+
import { EuiButtonEmpty, EuiButtonIcon } from '../button';
|
|
22
20
|
import { EuiI18n, useEuiI18n } from '../i18n';
|
|
23
21
|
import { EuiPopover, EuiPopoverTitle } from '../popover';
|
|
24
22
|
import { EuiText } from '../text';
|
|
25
|
-
import { EuiSpacer } from '../spacer';
|
|
26
23
|
import { EuiToolTip } from '../tool_tip';
|
|
27
|
-
import { EuiHorizontalRule } from '../horizontal_rule';
|
|
28
|
-
import { EuiLink } from '../link';
|
|
29
24
|
import { EuiMarkdownContext } from './markdown_context';
|
|
30
|
-
// @ts-ignore a react svg
|
|
31
|
-
import MarkdownLogo from './icons/markdown_logo';
|
|
32
25
|
import { euiMarkdownEditorFooterStyles } from './markdown_editor_footer.styles';
|
|
26
|
+
import { EuiMarkdownEditorHelpButton } from './markdown_editor_help_button';
|
|
33
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
34
28
|
export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
35
29
|
var uiPlugins = props.uiPlugins,
|
|
@@ -41,16 +35,8 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
41
35
|
var styles = useEuiMemoizedStyles(euiMarkdownEditorFooterStyles);
|
|
42
36
|
var _useState = useState(false),
|
|
43
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var _useState3 = useState(false),
|
|
47
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
-
isShowingHelpPopover = _useState4[0],
|
|
49
|
-
setIsShowingHelpPopover = _useState4[1];
|
|
50
|
-
var _useState5 = useState(false),
|
|
51
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
-
isPopoverOpen = _useState6[0],
|
|
53
|
-
setIsPopoverOpen = _useState6[1];
|
|
38
|
+
isPopoverOpen = _useState2[0],
|
|
39
|
+
setIsPopoverOpen = _useState2[1];
|
|
54
40
|
var onButtonClick = function onButtonClick() {
|
|
55
41
|
return setIsPopoverOpen(function (isPopoverOpen) {
|
|
56
42
|
return !isPopoverOpen;
|
|
@@ -73,13 +59,10 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
73
59
|
supportedFileTypes: useEuiI18n('euiMarkdownEditorFooter.supportedFileTypes', 'Supported files: {supportedFileTypes}', {
|
|
74
60
|
supportedFileTypes: supportedFileTypes
|
|
75
61
|
}),
|
|
76
|
-
showSyntaxErrors: useEuiI18n('euiMarkdownEditorFooter.showSyntaxErrors', 'Show errors')
|
|
77
|
-
showMarkdownHelp: useEuiI18n('euiMarkdownEditorFooter.showMarkdownHelp', 'Show markdown help')
|
|
62
|
+
showSyntaxErrors: useEuiI18n('euiMarkdownEditorFooter.showSyntaxErrors', 'Show errors')
|
|
78
63
|
};
|
|
79
|
-
var syntaxTitle = useEuiI18n('euiMarkdownEditorFooter.syntaxTitle', 'Syntax help');
|
|
80
64
|
var _useContext = useContext(EuiMarkdownContext),
|
|
81
65
|
readOnly = _useContext.readOnly;
|
|
82
|
-
var helpModalTitleId = useGeneratedHtmlId();
|
|
83
66
|
if (isUploadingFiles) {
|
|
84
67
|
uploadButton = ___EmotionJSX(EuiButtonIcon, {
|
|
85
68
|
size: "s",
|
|
@@ -139,108 +122,17 @@ export var EuiMarkdownEditorFooter = /*#__PURE__*/forwardRef(function (props, re
|
|
|
139
122
|
}, message.toString());
|
|
140
123
|
})));
|
|
141
124
|
}
|
|
142
|
-
var uiPluginsWithHelpText = uiPlugins.filter(function (_ref2) {
|
|
143
|
-
var helpText = _ref2.helpText;
|
|
144
|
-
return !!helpText;
|
|
145
|
-
});
|
|
146
|
-
var hasUiPluginsWithHelpText = uiPluginsWithHelpText.length > 0;
|
|
147
|
-
var mdSyntaxHref = 'https://guides.github.com/features/mastering-markdown/';
|
|
148
|
-
var mdSyntaxLink = ___EmotionJSX(EuiLink, {
|
|
149
|
-
href: mdSyntaxHref,
|
|
150
|
-
target: "_blank"
|
|
151
|
-
}, ___EmotionJSX(EuiI18n, {
|
|
152
|
-
token: "euiMarkdownEditorFooter.mdSyntaxLink",
|
|
153
|
-
default: "GitHub flavored markdown"
|
|
154
|
-
}));
|
|
155
|
-
var helpSyntaxButton;
|
|
156
|
-
if (hasUiPluginsWithHelpText) {
|
|
157
|
-
helpSyntaxButton = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiToolTip, {
|
|
158
|
-
content: syntaxTitle
|
|
159
|
-
}, ___EmotionJSX(EuiButtonIcon, {
|
|
160
|
-
size: "s",
|
|
161
|
-
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
162
|
-
className: "euiMarkdownEditorFooter__helpButton",
|
|
163
|
-
iconType: MarkdownLogo,
|
|
164
|
-
color: "text",
|
|
165
|
-
"aria-label": ariaLabels.showMarkdownHelp,
|
|
166
|
-
onClick: function onClick() {
|
|
167
|
-
return setIsShowingHelpModal(!isShowingHelpModal);
|
|
168
|
-
},
|
|
169
|
-
isDisabled: readOnly
|
|
170
|
-
})), isShowingHelpModal && ___EmotionJSX(EuiModal, {
|
|
171
|
-
onClose: function onClose() {
|
|
172
|
-
return setIsShowingHelpModal(false);
|
|
173
|
-
},
|
|
174
|
-
"aria-labelledby": helpModalTitleId
|
|
175
|
-
}, ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiTitle, null, ___EmotionJSX("h1", {
|
|
176
|
-
id: helpModalTitleId
|
|
177
|
-
}, syntaxTitle))), ___EmotionJSX(EuiModalBody, null, ___EmotionJSX(EuiText, null, ___EmotionJSX(EuiI18n, {
|
|
178
|
-
tokens: ['euiMarkdownEditorFooter.syntaxModalDescriptionPrefix', 'euiMarkdownEditorFooter.syntaxModalDescriptionSuffix'],
|
|
179
|
-
defaults: ['This editor uses', 'You can also utilize these additional syntax plugins to add rich content to your text.']
|
|
180
|
-
}, function (_ref3) {
|
|
181
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
182
|
-
syntaxModalDescriptionPrefix = _ref4[0],
|
|
183
|
-
syntaxModalDescriptionSuffix = _ref4[1];
|
|
184
|
-
return ___EmotionJSX("p", null, syntaxModalDescriptionPrefix, " ", mdSyntaxLink, ".", ' ', syntaxModalDescriptionSuffix);
|
|
185
|
-
})), ___EmotionJSX(EuiHorizontalRule, null), uiPluginsWithHelpText.map(function (_ref5) {
|
|
186
|
-
var name = _ref5.name,
|
|
187
|
-
helpText = _ref5.helpText;
|
|
188
|
-
return ___EmotionJSX(Fragment, {
|
|
189
|
-
key: name
|
|
190
|
-
}, ___EmotionJSX(EuiTitle, {
|
|
191
|
-
size: "xxs"
|
|
192
|
-
}, ___EmotionJSX("p", null, ___EmotionJSX("strong", null, name))), ___EmotionJSX(EuiSpacer, {
|
|
193
|
-
size: "s"
|
|
194
|
-
}), helpText, ___EmotionJSX(EuiSpacer, {
|
|
195
|
-
size: "l"
|
|
196
|
-
}));
|
|
197
|
-
}), ___EmotionJSX(EuiHorizontalRule, null)), ___EmotionJSX(EuiModalFooter, null, ___EmotionJSX(EuiButton, {
|
|
198
|
-
onClick: function onClick() {
|
|
199
|
-
return setIsShowingHelpModal(false);
|
|
200
|
-
},
|
|
201
|
-
fill: true
|
|
202
|
-
}, ___EmotionJSX(EuiI18n, {
|
|
203
|
-
token: "euiMarkdownEditorFooter.closeButton",
|
|
204
|
-
default: "Close"
|
|
205
|
-
})))));
|
|
206
|
-
} else {
|
|
207
|
-
helpSyntaxButton = ___EmotionJSX(EuiPopover, {
|
|
208
|
-
button: ___EmotionJSX(EuiButtonIcon, {
|
|
209
|
-
title: syntaxTitle,
|
|
210
|
-
size: "s",
|
|
211
|
-
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
212
|
-
className: "euiMarkdownEditorFooter__helpButton",
|
|
213
|
-
iconType: MarkdownLogo,
|
|
214
|
-
color: "text",
|
|
215
|
-
"aria-label": ariaLabels.showMarkdownHelp,
|
|
216
|
-
onClick: function onClick() {
|
|
217
|
-
return setIsShowingHelpPopover(!isShowingHelpPopover);
|
|
218
|
-
}
|
|
219
|
-
}),
|
|
220
|
-
isOpen: isShowingHelpPopover,
|
|
221
|
-
closePopover: function closePopover() {
|
|
222
|
-
return setIsShowingHelpPopover(false);
|
|
223
|
-
},
|
|
224
|
-
panelPaddingSize: "s",
|
|
225
|
-
anchorPosition: "upCenter",
|
|
226
|
-
"aria-labelledby": helpModalTitleId
|
|
227
|
-
}, ___EmotionJSX(EuiI18n, {
|
|
228
|
-
tokens: ['euiMarkdownEditorFooter.syntaxPopoverDescription'],
|
|
229
|
-
defaults: ['This editor uses']
|
|
230
|
-
}, function (_ref6) {
|
|
231
|
-
var _ref7 = _slicedToArray(_ref6, 1),
|
|
232
|
-
syntaxPopoverDescription = _ref7[0];
|
|
233
|
-
return ___EmotionJSX("p", null, syntaxPopoverDescription, " ", mdSyntaxLink, ".");
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
125
|
return ___EmotionJSX("div", {
|
|
237
126
|
ref: ref,
|
|
238
127
|
css: styles.euiMarkdownEditorFooter,
|
|
239
|
-
className: "euiMarkdownEditorFooter"
|
|
128
|
+
className: "euiMarkdownEditorFooter",
|
|
129
|
+
"data-test-subj": "euiMarkdownEditorFooter"
|
|
240
130
|
}, ___EmotionJSX("div", {
|
|
241
131
|
css: styles.euiMarkdownEditorFooter__actions,
|
|
242
132
|
className: "euiMarkdownEditorFooter__actions"
|
|
243
|
-
}, uploadButton, errorsButton),
|
|
133
|
+
}, uploadButton, errorsButton), ___EmotionJSX(EuiMarkdownEditorHelpButton, {
|
|
134
|
+
uiPlugins: uiPlugins
|
|
135
|
+
}));
|
|
244
136
|
});
|
|
245
137
|
EuiMarkdownEditorFooter.propTypes = {
|
|
246
138
|
uiPlugins: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -19,8 +19,6 @@ export var euiMarkdownEditorFooterStyles = function euiMarkdownEditorFooterStyle
|
|
|
19
19
|
euiMarkdownEditorFooter__actions: /*#__PURE__*/css("flex:1;display:inline-flex;align-items:center;gap:", euiTheme.size.xs, ";;label:euiMarkdownEditorFooter__actions;"),
|
|
20
20
|
// Override default button border radius to match the overall markdown editor
|
|
21
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
22
|
euiMarkdownEditorFooter__popover: /*#__PURE__*/css(logicalCSS('width', '300px'), ";;label:euiMarkdownEditorFooter__popover;")
|
|
25
23
|
};
|
|
26
24
|
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React, { useState, Fragment, useContext } from 'react';
|
|
16
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
17
|
+
import { EuiButton, EuiButtonIcon } from '../button';
|
|
18
|
+
import { EuiTitle } from '../title';
|
|
19
|
+
import { EuiModal, EuiModalBody, EuiModalFooter, EuiModalHeader } from '../modal';
|
|
20
|
+
import { EuiI18n, useEuiI18n } from '../i18n';
|
|
21
|
+
import { EuiPopover } from '../popover';
|
|
22
|
+
import { EuiText } from '../text';
|
|
23
|
+
import { EuiSpacer } from '../spacer';
|
|
24
|
+
import { EuiToolTip } from '../tool_tip';
|
|
25
|
+
import { EuiHorizontalRule } from '../horizontal_rule';
|
|
26
|
+
import { EuiLink } from '../link';
|
|
27
|
+
import { EuiMarkdownContext } from './markdown_context';
|
|
28
|
+
// @ts-ignore a react svg
|
|
29
|
+
import MarkdownLogo from './icons/markdown_logo';
|
|
30
|
+
import { euiMarkdownEditorHelpButtonStyles } from './markdown_editor_help_button.styles';
|
|
31
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
|
+
var mdSyntaxHref = 'https://guides.github.com/features/mastering-markdown/';
|
|
33
|
+
var mdSyntaxLink = ___EmotionJSX(EuiLink, {
|
|
34
|
+
href: mdSyntaxHref,
|
|
35
|
+
target: "_blank"
|
|
36
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
37
|
+
token: "euiMarkdownEditorHelpButton.mdSyntaxLink",
|
|
38
|
+
default: "GitHub flavored markdown"
|
|
39
|
+
}));
|
|
40
|
+
export var EuiMarkdownEditorHelpButton = function EuiMarkdownEditorHelpButton(_ref) {
|
|
41
|
+
var uiPlugins = _ref.uiPlugins;
|
|
42
|
+
var _useState = useState(false),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
isShowingHelpModal = _useState2[0],
|
|
45
|
+
setIsShowingHelpModal = _useState2[1];
|
|
46
|
+
var _useState3 = useState(false),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
isShowingHelpPopover = _useState4[0],
|
|
49
|
+
setIsShowingHelpPopover = _useState4[1];
|
|
50
|
+
var _useContext = useContext(EuiMarkdownContext),
|
|
51
|
+
readOnly = _useContext.readOnly;
|
|
52
|
+
var styles = useEuiMemoizedStyles(euiMarkdownEditorHelpButtonStyles);
|
|
53
|
+
var syntaxTitle = useEuiI18n('euiMarkdownEditorHelpButton.syntaxTitle', 'Syntax help');
|
|
54
|
+
var ariaLabels = {
|
|
55
|
+
showMarkdownHelp: useEuiI18n('euiMarkdownEditorHelpButton.showMarkdownHelp', 'Show markdown help')
|
|
56
|
+
};
|
|
57
|
+
var helpModalTitleId = useGeneratedHtmlId();
|
|
58
|
+
var uiPluginsWithHelpText = uiPlugins.filter(function (_ref2) {
|
|
59
|
+
var helpText = _ref2.helpText;
|
|
60
|
+
return !!helpText;
|
|
61
|
+
});
|
|
62
|
+
var hasUiPluginsWithHelpText = uiPluginsWithHelpText.length > 0;
|
|
63
|
+
if (hasUiPluginsWithHelpText) {
|
|
64
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiToolTip, {
|
|
65
|
+
content: syntaxTitle
|
|
66
|
+
}, ___EmotionJSX(EuiButtonIcon, {
|
|
67
|
+
size: "s",
|
|
68
|
+
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
69
|
+
className: "euiMarkdownEditorFooter__helpButton",
|
|
70
|
+
iconType: MarkdownLogo,
|
|
71
|
+
color: "text",
|
|
72
|
+
"aria-label": ariaLabels.showMarkdownHelp,
|
|
73
|
+
onClick: function onClick() {
|
|
74
|
+
return setIsShowingHelpModal(!isShowingHelpModal);
|
|
75
|
+
},
|
|
76
|
+
isDisabled: readOnly
|
|
77
|
+
})), isShowingHelpModal && ___EmotionJSX(EuiModal, {
|
|
78
|
+
onClose: function onClose() {
|
|
79
|
+
return setIsShowingHelpModal(false);
|
|
80
|
+
},
|
|
81
|
+
"aria-labelledby": helpModalTitleId
|
|
82
|
+
}, ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiTitle, null, ___EmotionJSX("h1", {
|
|
83
|
+
id: helpModalTitleId
|
|
84
|
+
}, syntaxTitle))), ___EmotionJSX(EuiModalBody, null, ___EmotionJSX(EuiText, null, ___EmotionJSX(EuiI18n, {
|
|
85
|
+
tokens: ['euiMarkdownEditorHelpButton.syntaxModalDescriptionPrefix', 'euiMarkdownEditorHelpButton.syntaxModalDescriptionSuffix'],
|
|
86
|
+
defaults: ['This editor uses', 'You can also utilize these additional syntax plugins to add rich content to your text.']
|
|
87
|
+
}, function (_ref3) {
|
|
88
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
89
|
+
syntaxModalDescriptionPrefix = _ref4[0],
|
|
90
|
+
syntaxModalDescriptionSuffix = _ref4[1];
|
|
91
|
+
return ___EmotionJSX("p", null, syntaxModalDescriptionPrefix, " ", mdSyntaxLink, ".", ' ', syntaxModalDescriptionSuffix);
|
|
92
|
+
})), ___EmotionJSX(EuiHorizontalRule, null), uiPluginsWithHelpText.map(function (_ref5) {
|
|
93
|
+
var name = _ref5.name,
|
|
94
|
+
helpText = _ref5.helpText;
|
|
95
|
+
return ___EmotionJSX(Fragment, {
|
|
96
|
+
key: name
|
|
97
|
+
}, ___EmotionJSX(EuiTitle, {
|
|
98
|
+
size: "xxs"
|
|
99
|
+
}, ___EmotionJSX("p", null, ___EmotionJSX("strong", null, name))), ___EmotionJSX(EuiSpacer, {
|
|
100
|
+
size: "s"
|
|
101
|
+
}), helpText, ___EmotionJSX(EuiSpacer, {
|
|
102
|
+
size: "l"
|
|
103
|
+
}));
|
|
104
|
+
}), ___EmotionJSX(EuiHorizontalRule, null)), ___EmotionJSX(EuiModalFooter, null, ___EmotionJSX(EuiButton, {
|
|
105
|
+
onClick: function onClick() {
|
|
106
|
+
return setIsShowingHelpModal(false);
|
|
107
|
+
},
|
|
108
|
+
fill: true
|
|
109
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
110
|
+
token: "euiMarkdownEditorHelpButton.closeButton",
|
|
111
|
+
default: "Close"
|
|
112
|
+
})))));
|
|
113
|
+
} else {
|
|
114
|
+
return ___EmotionJSX(EuiPopover, {
|
|
115
|
+
button: ___EmotionJSX(EuiButtonIcon, {
|
|
116
|
+
title: syntaxTitle,
|
|
117
|
+
size: "s",
|
|
118
|
+
css: styles.euiMarkdownEditorFooter__helpButton,
|
|
119
|
+
className: "euiMarkdownEditorFooter__helpButton",
|
|
120
|
+
iconType: MarkdownLogo,
|
|
121
|
+
color: "text",
|
|
122
|
+
"aria-label": ariaLabels.showMarkdownHelp,
|
|
123
|
+
onClick: function onClick() {
|
|
124
|
+
return setIsShowingHelpPopover(!isShowingHelpPopover);
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
isOpen: isShowingHelpPopover,
|
|
128
|
+
closePopover: function closePopover() {
|
|
129
|
+
return setIsShowingHelpPopover(false);
|
|
130
|
+
},
|
|
131
|
+
panelPaddingSize: "s",
|
|
132
|
+
anchorPosition: "upCenter",
|
|
133
|
+
"aria-labelledby": helpModalTitleId
|
|
134
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
135
|
+
tokens: ['euiMarkdownEditorHelpButton.syntaxPopoverDescription'],
|
|
136
|
+
defaults: ['This editor uses']
|
|
137
|
+
}, function (_ref6) {
|
|
138
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
139
|
+
syntaxPopoverDescription = _ref7[0];
|
|
140
|
+
return ___EmotionJSX("p", null, syntaxPopoverDescription, " ", mdSyntaxLink, ".");
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
EuiMarkdownEditorHelpButton.displayName = 'EuiMarkdownEditorHelpButton';
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export var euiMarkdownEditorHelpButtonStyles = function euiMarkdownEditorHelpButtonStyles() {
|
|
12
|
+
return {
|
|
13
|
+
// Override the default button icon width size
|
|
14
|
+
euiMarkdownEditorFooter__helpButton: /*#__PURE__*/css(".euiIcon{", logicalCSS('width', '26px'), ";};label:euiMarkdownEditorFooter__helpButton;")
|
|
15
|
+
};
|
|
16
|
+
};
|