UNPKG

@elastic/eui

Version:

Elastic UI Component Library

548 lines (544 loc) 34.2 kB
var _excluded = ["data"], _excluded2 = ["label", "isGroupLabel", "checked", "disabled", "prepend", "append", "ref", "key", "searchableLabel", "data"], _excluded3 = ["className", "options", "searchValue", "onOptionClick", "renderOption", "height", "windowProps", "rowHeight", "activeOptionIndex", "makeOptionId", "showIcons", "singleSelection", "visibleOptions", "allowExclusions", "bordered", "paddingSize", "searchable", "onFocusBadge", "listId", "setActiveOptionIndex", "aria-label", "aria-labelledby", "aria-describedby", "role", "isVirtualized", "textWrap"]; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 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; } 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; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import React, { Component, memo } from 'react'; import PropTypes from "prop-types"; import classNames from 'classnames'; import { FixedSizeList, areEqual } from 'react-window'; import { EuiAutoSizer } from '../../auto_sizer'; import { EuiHighlight } from '../../highlight'; import { EuiSelectableListItem } from './selectable_list_item'; // Consumer Configurable Props via `EuiSelectable.listProps` import { jsx as ___EmotionJSX } from "@emotion/react"; export var EuiSelectableList = /*#__PURE__*/function (_Component) { _inherits(EuiSelectableList, _Component); var _super = _createSuper(EuiSelectableList); function EuiSelectableList(props) { var _this; _classCallCheck(this, EuiSelectableList); _this = _super.call(this, props); _defineProperty(_assertThisInitialized(_this), "listRef", null); _defineProperty(_assertThisInitialized(_this), "listBoxRef", null); _defineProperty(_assertThisInitialized(_this), "setListRef", function (ref) { _this.listRef = ref; if (ref && _this.props.activeOptionIndex) { ref.scrollToItem(_this.props.activeOptionIndex, 'auto'); } }); _defineProperty(_assertThisInitialized(_this), "removeScrollableTabStop", function (ref) { // Firefox adds a tab stop for scrollable containers // We handle this inside so need to stop firefox from doing its thing if (ref) { ref.setAttribute('tabindex', '-1'); } }); _defineProperty(_assertThisInitialized(_this), "setListBoxRef", function (ref) { _this.listBoxRef = ref; var _this$props = _this.props, listId = _this$props.listId, searchable = _this$props.searchable, singleSelection = _this$props.singleSelection, ariaLabel = _this$props['aria-label'], ariaLabelledby = _this$props['aria-labelledby'], ariaDescribedby = _this$props['aria-describedby']; if (ref) { ref.setAttribute('id', listId); ref.setAttribute('role', 'listbox'); if (searchable !== true) { ref.setAttribute('tabindex', '0'); if (singleSelection !== 'always' && singleSelection !== true) { ref.setAttribute('aria-multiselectable', 'true'); } } if (typeof ariaLabel === 'string') { ref.setAttribute('aria-label', ariaLabel); } else if (typeof ariaLabelledby === 'string') { ref.setAttribute('aria-labelledby', ariaLabelledby); } if (typeof ariaDescribedby === 'string') { ref.setAttribute('aria-describedby', ariaDescribedby); } } }); _defineProperty(_assertThisInitialized(_this), "ariaSetSize", 0); _defineProperty(_assertThisInitialized(_this), "ariaPosInSetMap", {}); _defineProperty(_assertThisInitialized(_this), "calculateAriaSetAttrs", function (optionArray) { _this.ariaPosInSetMap = {}; var latestAriaPosIndex = 0; optionArray.forEach(function (option, index) { if (!option.isGroupLabel) { latestAriaPosIndex++; _this.ariaPosInSetMap[index] = latestAriaPosIndex; } }); _this.ariaSetSize = latestAriaPosIndex; }); _defineProperty(_assertThisInitialized(_this), "ListRow", /*#__PURE__*/memo(function (_ref) { var data = _ref.data, index = _ref.index, style = _ref.style; var option = data[index]; var optionData = option.data, _option = _objectWithoutProperties(option, _excluded); var label = option.label, isGroupLabel = option.isGroupLabel, checked = option.checked, disabled = option.disabled, prepend = option.prepend, append = option.append, ref = option.ref, key = option.key, searchableLabel = option.searchableLabel, _data = option.data, optionRest = _objectWithoutProperties(option, _excluded2); var _this$props2 = _this.props, activeOptionIndex = _this$props2.activeOptionIndex, allowExclusions = _this$props2.allowExclusions, onFocusBadge = _this$props2.onFocusBadge, paddingSize = _this$props2.paddingSize, searchValue = _this$props2.searchValue, showIcons = _this$props2.showIcons, makeOptionId = _this$props2.makeOptionId, renderOption = _this$props2.renderOption, setActiveOptionIndex = _this$props2.setActiveOptionIndex, searchable = _this$props2.searchable, textWrap = _this$props2.textWrap; if (isGroupLabel) { return ___EmotionJSX("li", _extends({ role: "presentation", className: "euiSelectableList__groupLabel", style: style // @ts-ignore complex }, optionRest), prepend, label, append); } var id = makeOptionId(index); return ___EmotionJSX(EuiSelectableListItem, _extends({ key: id, id: id, style: style, onMouseDown: function onMouseDown() { setActiveOptionIndex(index); }, onClick: function onClick(event) { event.persist(); // NOTE: This is needed for React v16 backwards compatibility _this.onAddOrRemoveOption(option, event); }, ref: ref ? ref.bind(null, index) : undefined, isFocused: activeOptionIndex === index, title: searchableLabel || label, checked: checked, disabled: disabled, prepend: prepend, append: append, "aria-posinset": _this.ariaPosInSetMap[index], "aria-setsize": _this.ariaSetSize, onFocusBadge: onFocusBadge, allowExclusions: allowExclusions, showIcons: showIcons, paddingSize: paddingSize, searchable: searchable, textWrap: textWrap }, optionRest), renderOption ? renderOption( // @ts-ignore complex _objectSpread(_objectSpread({}, _option), optionData), _this.props.searchValue) : ___EmotionJSX(EuiHighlight, { search: searchValue }, label)); }, areEqual)); _defineProperty(_assertThisInitialized(_this), "onAddOrRemoveOption", function (option, event) { if (option.disabled) { return; } var _this$props3 = _this.props, allowExclusions = _this$props3.allowExclusions, options = _this$props3.options, _this$props3$visibleO = _this$props3.visibleOptions, visibleOptions = _this$props3$visibleO === void 0 ? options : _this$props3$visibleO; _this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref2) { var label = _ref2.label; return label === option.label; }), function () { if (option.checked === 'on' && allowExclusions) { _this.onExcludeOption(option, event); } else if (option.checked === 'on' || option.checked === 'off') { _this.onRemoveOption(option, event); } else { _this.onAddOption(option, event); } }); }); _defineProperty(_assertThisInitialized(_this), "onAddOption", function (addedOption, event) { var _this$props4 = _this.props, onOptionClick = _this$props4.onOptionClick, options = _this$props4.options, singleSelection = _this$props4.singleSelection; var changedOption = _objectSpread({}, addedOption); var updatedOptions = options.map(function (option) { // if singleSelection is enabled, uncheck any selected option(s) var updatedOption = _objectSpread({}, option); if (singleSelection) { delete updatedOption.checked; } // if this is the now-selected option, check it if (option === addedOption) { updatedOption.checked = 'on'; changedOption = updatedOption; } return updatedOption; }); onOptionClick(updatedOptions, event, changedOption); }); _defineProperty(_assertThisInitialized(_this), "onRemoveOption", function (removedOption, event) { var _this$props5 = _this.props, onOptionClick = _this$props5.onOptionClick, singleSelection = _this$props5.singleSelection, options = _this$props5.options; var changedOption = _objectSpread({}, removedOption); var updatedOptions = options.map(function (option) { var updatedOption = _objectSpread({}, option); if (option === removedOption && singleSelection !== 'always') { delete updatedOption.checked; changedOption = updatedOption; } return updatedOption; }); onOptionClick(updatedOptions, event, changedOption); }); _defineProperty(_assertThisInitialized(_this), "onExcludeOption", function (excludedOption, event) { var _this$props6 = _this.props, onOptionClick = _this$props6.onOptionClick, options = _this$props6.options; var changedOption = _objectSpread({}, excludedOption); var updatedOptions = options.map(function (option) { var updatedOption = _objectSpread({}, option); if (option === excludedOption) { updatedOption.checked = 'off'; changedOption = updatedOption; } return updatedOption; }); onOptionClick(updatedOptions, event, changedOption); }); return _this; } _createClass(EuiSelectableList, [{ key: "componentDidUpdate", value: function componentDidUpdate() { var activeOptionIndex = this.props.activeOptionIndex; if (this.listBoxRef && this.props.searchable !== true) { this.listBoxRef.setAttribute('aria-activedescendant', "".concat(this.props.makeOptionId(activeOptionIndex))); } if (this.listRef && typeof this.props.activeOptionIndex !== 'undefined') { this.listRef.scrollToItem(this.props.activeOptionIndex, 'auto'); } } }, { key: "render", value: function render() { var _this2 = this; var _this$props7 = this.props, className = _this$props7.className, options = _this$props7.options, searchValue = _this$props7.searchValue, onOptionClick = _this$props7.onOptionClick, renderOption = _this$props7.renderOption, forcedHeight = _this$props7.height, windowProps = _this$props7.windowProps, rowHeight = _this$props7.rowHeight, activeOptionIndex = _this$props7.activeOptionIndex, makeOptionId = _this$props7.makeOptionId, showIcons = _this$props7.showIcons, singleSelection = _this$props7.singleSelection, visibleOptions = _this$props7.visibleOptions, allowExclusions = _this$props7.allowExclusions, bordered = _this$props7.bordered, paddingSize = _this$props7.paddingSize, searchable = _this$props7.searchable, onFocusBadge = _this$props7.onFocusBadge, listId = _this$props7.listId, setActiveOptionIndex = _this$props7.setActiveOptionIndex, ariaLabel = _this$props7['aria-label'], ariaLabelledby = _this$props7['aria-labelledby'], ariaDescribedby = _this$props7['aria-describedby'], role = _this$props7.role, isVirtualized = _this$props7.isVirtualized, textWrap = _this$props7.textWrap, rest = _objectWithoutProperties(_this$props7, _excluded3); var optionArray = visibleOptions || options; this.calculateAriaSetAttrs(optionArray); var heightIsFull = forcedHeight === 'full'; var calculatedHeight = heightIsFull ? false : forcedHeight; // If calculatedHeight is still undefined, then calculate it if (calculatedHeight === undefined) { var maxVisibleOptions = 7; var numVisibleOptions = optionArray.length; var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions; if (numVisibleMoreThanMax) { // Show only half of the last one to indicate there's more to scroll to calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight; } else { calculatedHeight = numVisibleOptions * rowHeight; } } var classes = classNames('euiSelectableList', { 'euiSelectableList-fullHeight': heightIsFull, 'euiSelectableList-bordered': bordered }, className); return ___EmotionJSX("div", _extends({ className: classes }, rest), isVirtualized ? ___EmotionJSX(EuiAutoSizer, { disableHeight: !heightIsFull }, function (_ref3) { var width = _ref3.width, height = _ref3.height; return ___EmotionJSX(FixedSizeList, _extends({ ref: _this2.setListRef, outerRef: _this2.removeScrollableTabStop, className: "euiSelectableList__list", "data-skip-axe": "scrollable-region-focusable", width: width, height: calculatedHeight || height, itemCount: optionArray.length, itemData: optionArray, itemSize: rowHeight, innerElementType: "ul", innerRef: _this2.setListBoxRef }, windowProps), _this2.ListRow); }) : ___EmotionJSX("div", { className: "euiSelectableList__list", ref: this.removeScrollableTabStop }, ___EmotionJSX("ul", { ref: this.setListBoxRef }, optionArray.map(function (_, index) { return /*#__PURE__*/React.createElement(_this2.ListRow, { key: index, data: optionArray, index: index }, null); })))); } }]); return EuiSelectableList; }(Component); _defineProperty(EuiSelectableList, "defaultProps", { rowHeight: 32, searchValue: '', isVirtualized: true }); EuiSelectableList.propTypes = { className: PropTypes.string, "aria-label": PropTypes.string, "data-test-subj": PropTypes.string, css: PropTypes.any, /** * The index of the option to be highlighted as pseudo-focused; * Good for use when only one selection is allowed and needing to open * directly to that option */ activeOptionIndex: PropTypes.number, /** * Show the check/cross selection indicator icons */ showIcons: PropTypes.bool, singleSelection: PropTypes.oneOfType([PropTypes.oneOf(["always"]), PropTypes.bool.isRequired]), /** * Any props to send specifically to the react-window `FixedSizeList` */ windowProps: PropTypes.any, /** * Adds a border around the list to indicate the bounds; * Useful when the list scrolls, otherwise use your own container */ bordered: PropTypes.bool, /** * When enabled by setting to either `true` or passing custom text, * shows a hollow badge as an append (far right) when the item is focused. * The default content when `true` is `↩ to select/deselect/include/exclude` */ onFocusBadge: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({ /** * Accepts any string from our icon library */ iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "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", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "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", "eql", "eraser", "error", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "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", "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", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "pivot", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "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", "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", "alert", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "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", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]), /** * The side of the badge the icon should sit */ iconSide: PropTypes.any, /** * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`. */ color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]), /** * Will override any color passed through the `color` prop. */ isDisabled: PropTypes.bool, /** * Props passed to the close button. */ closeButtonProps: PropTypes.any, className: PropTypes.string, "aria-label": PropTypes.string, "data-test-subj": PropTypes.string, css: PropTypes.any, /** * Will apply an onclick to icon within the badge */ iconOnClick: PropTypes.func, /** * Aria label applied to the iconOnClick button */ iconOnClickAriaLabel: PropTypes.any, /** * Will apply an onclick to the badge itself */ onClick: PropTypes.func, /** * Aria label applied to the onClick button */ onClickAriaLabel: PropTypes.any, href: PropTypes.string, target: PropTypes.string, rel: PropTypes.string }).isRequired]), /** * Padding for the list items. */ paddingSize: PropTypes.any, /** * How to handle long text within the item. * Wrapping only works if virtualization is off. */ textWrap: PropTypes.oneOf(["truncate", "wrap"]), /** * Use virtualized rendering for list items with `react-window`. * Sets each row's height to the value of `rowHeight`. */ isVirtualized: PropTypes.oneOfType([PropTypes.oneOf([true]), PropTypes.oneOf([false]).isRequired]), /** * The height of each option in pixels. Defaults to `32`. * Has no effect if `isVirtualized=false`. */ rowHeight: PropTypes.number, /** * All possible options */ options: PropTypes.arrayOf(PropTypes.shape({ /** * Optional `boolean`. * Set to `true` to indicate object is just a grouping label, not a selectable item */ isGroupLabel: PropTypes.oneOfType([PropTypes.oneOf([true]).isRequired, PropTypes.oneOf([false])]), className: PropTypes.string, "aria-label": PropTypes.string, "data-test-subj": PropTypes.string, css: PropTypes.any, /** * Visible label of option. * Must be unique across items if `key` is not supplied */ label: PropTypes.string, /** * Optionally change the searchable term by passing a different string other than the `label`. * Best used when creating a custom `optionRender` to separate the label from metadata but allowing to search on both */ searchableLabel: PropTypes.string, /** * Must be unique across items. * Will be used to match options instead of `label` */ key: PropTypes.string, /** * Leave `undefined` to indicate not selected. Pass a string of * 'on' to indicate inclusion, 'off' to indicate exclusion, * or 'mixed' to indicate inclusion for some. */ checked: PropTypes.oneOf(["on", "off", "mixed", undefined]), disabled: PropTypes.bool, /** * Node to add between the selection icon and the label */ prepend: PropTypes.node, /** * Node to add to the far right of the item */ append: PropTypes.node, ref: PropTypes.func, /** * Option data to pass through to the `renderOptions` element. * Bypass `EuiSelectableItem` and avoid DOM attribute warnings. */ data: PropTypes.shape({}) }).isRequired).isRequired, /** * Filtered options list (if applicable) */ visibleOptions: PropTypes.arrayOf(PropTypes.shape({ isGroupLabel: PropTypes.oneOfType([PropTypes.oneOf([true]).isRequired, PropTypes.oneOf([false])]), className: PropTypes.string, "aria-label": PropTypes.string, "data-test-subj": PropTypes.string, css: PropTypes.any, label: PropTypes.string, searchableLabel: PropTypes.string, key: PropTypes.string, checked: PropTypes.oneOf(["on", "off", "mixed", undefined]), disabled: PropTypes.bool, prepend: PropTypes.node, append: PropTypes.node, ref: PropTypes.func, data: PropTypes.shape({}) }).isRequired), /** * Search value to highlight on the option render */ searchValue: PropTypes.string.isRequired, /** * Returns the array of options with altered checked state, the click/keyboard event, * and the option that triggered the click/keyboard event */ onOptionClick: PropTypes.func.isRequired, /** * Custom render for the label portion of the option; * Takes (option, searchValue), returns ReactNode */ renderOption: PropTypes.func, /** * Sets the max height in pixels or pass `full` to allow * the whole group to fill the height of its container and * allows the list grow as well */ height: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf(["full"])]), /** * Allow cycling through the on, off and undefined state of option.checked * and not just on and undefined */ allowExclusions: PropTypes.bool, searchable: PropTypes.bool, makeOptionId: PropTypes.func.isRequired, listId: PropTypes.string.isRequired, setActiveOptionIndex: PropTypes.func.isRequired };