@elastic/eui 122.1.0 → 123.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/eui-icons.json +94 -94
  2. package/es/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  3. package/es/components/datagrid/utils/row_heights.js +4 -1
  4. package/es/components/flyout/flyout.component.js +129 -55
  5. package/es/components/flyout/flyout_menu/action_button.js +15 -21
  6. package/es/components/flyout/flyout_menu/flyout_menu.js +40 -46
  7. package/es/components/flyout/manager/flyout_managed.js +24 -6
  8. package/es/components/form/described_form_group/described_form_group.js +17 -4
  9. package/es/components/tabs/tabbed_content/tabbed_content.js +93 -138
  10. package/es/components/text_truncate/text_truncate.js +9 -4
  11. package/eui.d.ts +32 -58
  12. package/lib/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  13. package/lib/components/datagrid/utils/row_heights.js +4 -1
  14. package/lib/components/flyout/flyout.component.js +134 -62
  15. package/lib/components/flyout/flyout_menu/action_button.js +18 -23
  16. package/lib/components/flyout/flyout_menu/flyout_menu.js +40 -46
  17. package/lib/components/flyout/manager/flyout_managed.js +23 -5
  18. package/lib/components/form/described_form_group/described_form_group.js +19 -3
  19. package/lib/components/tabs/tabbed_content/tabbed_content.js +98 -142
  20. package/lib/components/text_truncate/text_truncate.js +9 -4
  21. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +116 -36
  22. package/optimize/es/components/datagrid/utils/row_heights.js +4 -1
  23. package/optimize/es/components/flyout/flyout.component.js +124 -50
  24. package/optimize/es/components/flyout/flyout_menu/action_button.js +14 -21
  25. package/optimize/es/components/flyout/manager/flyout_managed.js +24 -6
  26. package/optimize/es/components/form/described_form_group/described_form_group.js +17 -4
  27. package/optimize/es/components/tabs/tabbed_content/tabbed_content.js +87 -131
  28. package/optimize/es/components/text_truncate/text_truncate.js +4 -3
  29. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +116 -36
  30. package/optimize/lib/components/datagrid/utils/row_heights.js +4 -1
  31. package/optimize/lib/components/flyout/flyout.component.js +123 -49
  32. package/optimize/lib/components/flyout/flyout_menu/action_button.js +14 -22
  33. package/optimize/lib/components/flyout/manager/flyout_managed.js +23 -5
  34. package/optimize/lib/components/form/described_form_group/described_form_group.js +19 -3
  35. package/optimize/lib/components/tabs/tabbed_content/tabbed_content.js +87 -131
  36. package/optimize/lib/components/text_truncate/text_truncate.js +4 -3
  37. package/package.json +2 -2
  38. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  39. package/test-env/components/datagrid/utils/row_heights.js +4 -1
  40. package/test-env/components/flyout/flyout.component.js +123 -49
  41. package/test-env/components/flyout/flyout_menu/action_button.js +14 -22
  42. package/test-env/components/flyout/flyout_menu/flyout_menu.js +40 -46
  43. package/test-env/components/flyout/manager/flyout_managed.js +23 -5
  44. package/test-env/components/form/described_form_group/described_form_group.js +19 -3
  45. package/test-env/components/tabs/tabbed_content/tabbed_content.js +88 -132
  46. package/test-env/components/text_truncate/text_truncate.js +9 -4
@@ -243,97 +243,91 @@ EuiFlyoutMenu.propTypes = {
243
243
  /**
244
244
  * List of action items rendered at the start (inline-start) of the menu bar.
245
245
  */
246
- leadingActions: PropTypes.arrayOf(PropTypes.shape({
246
+ leadingActions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
247
247
  /**
248
- * Icon type for the action button
248
+ * Aria label for the action button
249
249
  */
250
- iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "addToChat", "addToDashboard", "advancedSettingsApp", "agentApp", "aggregate", "alignBottom", "alignBottomLeft", "alignBottomRight", "alignCenterHorizontal", "alignCenterVertical", "alignLeft", "alignRight", "alignTop", "alignTopLeft", "alignTopRight", "analyzeEvent", "annotation", "chartAnomaly", "anomalySwimLane", "apmApp", "chartWaterfall", "appSearchApp", "apps", "chevronSingleDown", "chevronSingleLeft", "chevronSingleRight", "chevronSingleUp", "chevronLimitLeft", "chevronLimitRight", "asterisk", "at", "archive", "article", "axisX", "axisYLeft", "axisYRight", "auditbeatApp", "backgroundTask", "bell", "bellSlash", "beta", "bolt", "boxesVertical", "branch", "briefcase", "broom", "brush", "bug", "bulb", "bullseye", "calendar", "canvasApp", "casesApp", "chartChangePoint", "chartArea", "visArea", "chartAreaStack", "chartBarHorizontal", "chartBarHorizontalStack", "chartBarVertical", "visBarVertical", "chartBarVerticalStack", "chartGauge", "visGauge", "chartHeatmap", "chartLine", "visLine", "chartPie", "visPie", "chartTagCloud", "chartThreshold", "check", "checkCircle", "checkCircleFill", "popper", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "clockControl", "cloud", "cloudBolt", "cloudDrizzle", "cloudRain", "cloudStormy", "cloudSun", "cloudSunny", "cluster", "code", "codeApp", "paintBucket", "commandLine", "comment", "editorComment", "compare", "processor", "compute", "consoleApp", "container", "continuityAbove", "continuityWithin", "contrast", "contrastFill", "controls", "copy", "crossProjectSearch", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossCircle", "crosshair", "cursorDefault", "money", "scissors", "dashboardApp", "dashedCircle", "dataVisualizer", "database", "display", "devToolsApp", "discoverApp", "distributeHorizontal", "distributeVertical", "download", "drag", "dragHorizontal", "dragVertical", "document", "documentation", "documents", "dot", "dotInCircle", "chevronDoubleLeft", "chevronDoubleRight", "ellipsis", "textAlignCenter", "textAlignLeft", "textAlignRight", "textBold", "listCheck", "textHeading", "textItalic", "listNumber", "redo", "textStrike", "table", "visTable", "textUnderline", "undo", "listBullet", "list", "mail", "empty", "emsApp", "endpoint", "query", "eraser", "error", "errorFill", "esqlVis", "logIn", "logOut", "maximize", "export", "upload", "external", "eye", "eyeSlash", "faceHappy", "faceNeutral", "faceSad", "tableInfo", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "flask", "flag", "fleetApp", "fold", "folder", "folderClosed", "folderClose", "folderCheck", "folderExclamation", "folderOpen", "folderOpened", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "gear", "gisApp", "globe", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "help", "home", "hourglass", "if", "info", "image", "index", "indexClose", "tableCross", "tableSparkles", "indexEdit", "tablePencil", "indexManagementApp", "mapping", "indexOpen", "tablePlus", "indexPatternApp", "indexRollupApp", "indexRuntime", "tablePlay", "indexSettings", "tableGear", "tableTime", "infinity", "inputOutput", "inspect", "ip", "key", "keyboard", "queryField", "kqlFunction", "queryOperand", "querySelector", "queryValue", "kubernetesNamespace", "kubernetesNode", "kubernetesPod", "cube", "rocket", "layers", "lensApp", "text", "lineBreak", "lineBreakSlash", "lineDash", "lineDot", "lineSolid", "link", "linkSlash", "lock", "lockOpen", "pattern", "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", "logoVectorDB", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashInput", "logstashOutput", "queue", "machineLearningApp", "magnify", "search", "magnifyExclamation", "magnifyMinus", "magnifyPlus", "managementApp", "map", "mapMarker", "waypoint", "megaphone", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusCircle", "minusSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "vectorTriangle", "notebookApp", "number", "wifiSlash", "wifi", "outlierDetectionJob", "package", "packetbeatApp", "pagesSelect", "documentsCheck", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFill", "pinFilled", "pipelineApp", "pivot", "play", "plugs", "plus", "plusCircle", "plusSquare", "presentation", "productAgent", "productCloudInfra", "productDashboard", "productDiscover", "productML", "productStreamsClassic", "productStreamsWired", "productTimelion", "productTSVB", "push", "send", "question", "quote", "radar", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "return", "routeSplit", "save", "scale", "savedObjectsApp", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignalDetected", "server", "sessionViewer", "shard", "share", "significantEvents", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "star", "starEmpty", "starEmptySpace", "starFill", "starFilled", "starFillSpace", "starMinusEmpty", "starMinusFill", "starPlusEmpty", "starPlusFill", "stats", "stop", "stopFill", "stopSlash", "storage", "string", "sun", "swatchInput", "symlink", "tableDensityHigh", "tableDensityLow", "tableOfContents", "tag", "thermometer", "temperature", "thumbDown", "thumbUp", "timeline", "timelineWithArrow", "timelinePointer", "timelionApp", "refreshTime", "transitionBottomIn", "transitionBottomOut", "transitionLeftIn", "transitionLeftOut", "transitionRightIn", "transitionRightOut", "transitionTopIn", "transitionTopOut", "translate", "trash", "unfold", "upgradeAssistantApp", "uptimeApp", "user", "users", "usersRolesApp", "unarchive", "vectorSquare", "videoPlayer", "visGoal", "chartMetric", "visTimelion", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "warningFill", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workflowsApp", "workflow", "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", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
250
+ "aria-label": PropTypes.string.isRequired,
251
251
  /**
252
252
  * onClick handler for the action button
253
253
  */
254
254
  onClick: PropTypes.func,
255
255
  /**
256
- * Aria label for the action button
257
- */
258
- "aria-label": PropTypes.string.isRequired,
259
- /**
260
- * Optional tooltip content shown on hover/focus of the action button.
261
- * When `isDisabled` is `true`, the action uses `aria-disabled` so the tooltip
262
- * remains reachable via hover/focus (unless overridden via `toolTipProps`).
256
+ * Tooltip text shown on hover or focus.
257
+ * When the action is disabled, also set `hasAriaDisabled`. This keeps
258
+ * the button focusable so the tooltip remains reachable.
263
259
  */
264
260
  toolTipContent: PropTypes.node,
265
261
  /**
266
262
  * Optional props to pass to the underlying {@link EuiToolTip}.
267
263
  * Only used when `toolTipContent` is also provided.
268
264
  */
269
- toolTipProps: PropTypes.any,
265
+ toolTipProps: PropTypes.any
266
+ }).isRequired, PropTypes.shape({
270
267
  /**
271
- * Disables the action button. Pair with `toolTipContent` to explain why
272
- * the action is unavailable.
268
+ * Aria label for the action button
273
269
  */
274
- isDisabled: PropTypes.bool,
270
+ "aria-label": PropTypes.string.isRequired,
275
271
  /**
276
- * Replaces the button icon with a loading spinner and disables the button.
272
+ * onClick handler for the action button
277
273
  */
278
- isLoading: PropTypes.bool,
274
+ onClick: PropTypes.func,
279
275
  /**
280
- * Renders the action as an anchor tag with the given URL, allowing users to
281
- * right-click and open in a new tab. When `isDisabled` or `isLoading` is
282
- * `true`, the element renders as a `<button>` regardless of this prop.
276
+ * Tooltip text shown on hover or focus.
277
+ * When the action is disabled, also set `hasAriaDisabled`. This keeps
278
+ * the button focusable so the tooltip remains reachable.
283
279
  */
284
- href: PropTypes.string,
280
+ toolTipContent: PropTypes.node,
285
281
  /**
286
- * Target for the anchor tag. Only used when `href` is provided.
282
+ * Optional props to pass to the underlying {@link EuiToolTip}.
283
+ * Only used when `toolTipContent` is also provided.
287
284
  */
288
- target: PropTypes.string
289
- }).isRequired),
285
+ toolTipProps: PropTypes.any
286
+ }).isRequired]).isRequired),
290
287
  /**
291
288
  * List of action items rendered at the end (inline-end) of the menu bar.
292
289
  */
293
- trailingActions: PropTypes.arrayOf(PropTypes.shape({
290
+ trailingActions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
294
291
  /**
295
- * Icon type for the action button
292
+ * Aria label for the action button
296
293
  */
297
- iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "addToChat", "addToDashboard", "advancedSettingsApp", "agentApp", "aggregate", "alignBottom", "alignBottomLeft", "alignBottomRight", "alignCenterHorizontal", "alignCenterVertical", "alignLeft", "alignRight", "alignTop", "alignTopLeft", "alignTopRight", "analyzeEvent", "annotation", "chartAnomaly", "anomalySwimLane", "apmApp", "chartWaterfall", "appSearchApp", "apps", "chevronSingleDown", "chevronSingleLeft", "chevronSingleRight", "chevronSingleUp", "chevronLimitLeft", "chevronLimitRight", "asterisk", "at", "archive", "article", "axisX", "axisYLeft", "axisYRight", "auditbeatApp", "backgroundTask", "bell", "bellSlash", "beta", "bolt", "boxesVertical", "branch", "briefcase", "broom", "brush", "bug", "bulb", "bullseye", "calendar", "canvasApp", "casesApp", "chartChangePoint", "chartArea", "visArea", "chartAreaStack", "chartBarHorizontal", "chartBarHorizontalStack", "chartBarVertical", "visBarVertical", "chartBarVerticalStack", "chartGauge", "visGauge", "chartHeatmap", "chartLine", "visLine", "chartPie", "visPie", "chartTagCloud", "chartThreshold", "check", "checkCircle", "checkCircleFill", "popper", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "clockControl", "cloud", "cloudBolt", "cloudDrizzle", "cloudRain", "cloudStormy", "cloudSun", "cloudSunny", "cluster", "code", "codeApp", "paintBucket", "commandLine", "comment", "editorComment", "compare", "processor", "compute", "consoleApp", "container", "continuityAbove", "continuityWithin", "contrast", "contrastFill", "controls", "copy", "crossProjectSearch", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossCircle", "crosshair", "cursorDefault", "money", "scissors", "dashboardApp", "dashedCircle", "dataVisualizer", "database", "display", "devToolsApp", "discoverApp", "distributeHorizontal", "distributeVertical", "download", "drag", "dragHorizontal", "dragVertical", "document", "documentation", "documents", "dot", "dotInCircle", "chevronDoubleLeft", "chevronDoubleRight", "ellipsis", "textAlignCenter", "textAlignLeft", "textAlignRight", "textBold", "listCheck", "textHeading", "textItalic", "listNumber", "redo", "textStrike", "table", "visTable", "textUnderline", "undo", "listBullet", "list", "mail", "empty", "emsApp", "endpoint", "query", "eraser", "error", "errorFill", "esqlVis", "logIn", "logOut", "maximize", "export", "upload", "external", "eye", "eyeSlash", "faceHappy", "faceNeutral", "faceSad", "tableInfo", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "flask", "flag", "fleetApp", "fold", "folder", "folderClosed", "folderClose", "folderCheck", "folderExclamation", "folderOpen", "folderOpened", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "gear", "gisApp", "globe", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "help", "home", "hourglass", "if", "info", "image", "index", "indexClose", "tableCross", "tableSparkles", "indexEdit", "tablePencil", "indexManagementApp", "mapping", "indexOpen", "tablePlus", "indexPatternApp", "indexRollupApp", "indexRuntime", "tablePlay", "indexSettings", "tableGear", "tableTime", "infinity", "inputOutput", "inspect", "ip", "key", "keyboard", "queryField", "kqlFunction", "queryOperand", "querySelector", "queryValue", "kubernetesNamespace", "kubernetesNode", "kubernetesPod", "cube", "rocket", "layers", "lensApp", "text", "lineBreak", "lineBreakSlash", "lineDash", "lineDot", "lineSolid", "link", "linkSlash", "lock", "lockOpen", "pattern", "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", "logoVectorDB", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashInput", "logstashOutput", "queue", "machineLearningApp", "magnify", "search", "magnifyExclamation", "magnifyMinus", "magnifyPlus", "managementApp", "map", "mapMarker", "waypoint", "megaphone", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusCircle", "minusSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "vectorTriangle", "notebookApp", "number", "wifiSlash", "wifi", "outlierDetectionJob", "package", "packetbeatApp", "pagesSelect", "documentsCheck", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFill", "pinFilled", "pipelineApp", "pivot", "play", "plugs", "plus", "plusCircle", "plusSquare", "presentation", "productAgent", "productCloudInfra", "productDashboard", "productDiscover", "productML", "productStreamsClassic", "productStreamsWired", "productTimelion", "productTSVB", "push", "send", "question", "quote", "radar", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "return", "routeSplit", "save", "scale", "savedObjectsApp", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignalDetected", "server", "sessionViewer", "shard", "share", "significantEvents", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "star", "starEmpty", "starEmptySpace", "starFill", "starFilled", "starFillSpace", "starMinusEmpty", "starMinusFill", "starPlusEmpty", "starPlusFill", "stats", "stop", "stopFill", "stopSlash", "storage", "string", "sun", "swatchInput", "symlink", "tableDensityHigh", "tableDensityLow", "tableOfContents", "tag", "thermometer", "temperature", "thumbDown", "thumbUp", "timeline", "timelineWithArrow", "timelinePointer", "timelionApp", "refreshTime", "transitionBottomIn", "transitionBottomOut", "transitionLeftIn", "transitionLeftOut", "transitionRightIn", "transitionRightOut", "transitionTopIn", "transitionTopOut", "translate", "trash", "unfold", "upgradeAssistantApp", "uptimeApp", "user", "users", "usersRolesApp", "unarchive", "vectorSquare", "videoPlayer", "visGoal", "chartMetric", "visTimelion", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "warningFill", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workflowsApp", "workflow", "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", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
294
+ "aria-label": PropTypes.string.isRequired,
298
295
  /**
299
296
  * onClick handler for the action button
300
297
  */
301
298
  onClick: PropTypes.func,
302
299
  /**
303
- * Aria label for the action button
304
- */
305
- "aria-label": PropTypes.string.isRequired,
306
- /**
307
- * Optional tooltip content shown on hover/focus of the action button.
308
- * When `isDisabled` is `true`, the action uses `aria-disabled` so the tooltip
309
- * remains reachable via hover/focus (unless overridden via `toolTipProps`).
300
+ * Tooltip text shown on hover or focus.
301
+ * When the action is disabled, also set `hasAriaDisabled`. This keeps
302
+ * the button focusable so the tooltip remains reachable.
310
303
  */
311
304
  toolTipContent: PropTypes.node,
312
305
  /**
313
306
  * Optional props to pass to the underlying {@link EuiToolTip}.
314
307
  * Only used when `toolTipContent` is also provided.
315
308
  */
316
- toolTipProps: PropTypes.any,
309
+ toolTipProps: PropTypes.any
310
+ }).isRequired, PropTypes.shape({
317
311
  /**
318
- * Disables the action button. Pair with `toolTipContent` to explain why
319
- * the action is unavailable.
312
+ * Aria label for the action button
320
313
  */
321
- isDisabled: PropTypes.bool,
314
+ "aria-label": PropTypes.string.isRequired,
322
315
  /**
323
- * Replaces the button icon with a loading spinner and disables the button.
316
+ * onClick handler for the action button
324
317
  */
325
- isLoading: PropTypes.bool,
318
+ onClick: PropTypes.func,
326
319
  /**
327
- * Renders the action as an anchor tag with the given URL, allowing users to
328
- * right-click and open in a new tab. When `isDisabled` or `isLoading` is
329
- * `true`, the element renders as a `<button>` regardless of this prop.
320
+ * Tooltip text shown on hover or focus.
321
+ * When the action is disabled, also set `hasAriaDisabled`. This keeps
322
+ * the button focusable so the tooltip remains reachable.
330
323
  */
331
- href: PropTypes.string,
324
+ toolTipContent: PropTypes.node,
332
325
  /**
333
- * Target for the anchor tag. Only used when `href` is provided.
326
+ * Optional props to pass to the underlying {@link EuiToolTip}.
327
+ * Only used when `toolTipContent` is also provided.
334
328
  */
335
- target: PropTypes.string
336
- }).isRequired),
329
+ toolTipProps: PropTypes.any
330
+ }).isRequired]).isRequired),
337
331
  /**
338
332
  * List of custom action items for the menu component
339
333
  * @deprecated Use `trailingActions` instead. If both are supplied, `trailingActions` takes precedence.
@@ -24,7 +24,7 @@ import PropTypes from "prop-types";
24
24
  * Side Public License, v 1.
25
25
  */
26
26
 
27
- import React, { useEffect, useLayoutEffect, useMemo, useRef, useState, forwardRef } from 'react';
27
+ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, forwardRef } from 'react';
28
28
  import { css } from '@emotion/react';
29
29
  import { flushSync } from 'react-dom';
30
30
  import { useCombinedRefs, useEuiMemoizedStyles } from '../../../services';
@@ -177,6 +177,24 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
177
177
  flyoutExistsInManagerRef.current = flyoutExistsInManager;
178
178
  }, [flyoutExistsInManager]);
179
179
 
180
+ // Closing a main closes its whole history group via `closeAllFlyouts`, which always targets
181
+ // the *current* session. A main that has been backgrounded by a newer session (e.g. closed
182
+ // programmatically from another React root) must only remove its own session, otherwise it
183
+ // tears down the foreground session and leaves its own stale session behind.
184
+ var closeOwnFlyouts = useCallback(function () {
185
+ if (level !== LEVEL_MAIN) {
186
+ closeFlyout(flyoutId);
187
+ return;
188
+ }
189
+ var _getFlyoutManagerStor = getFlyoutManagerStore().getState(),
190
+ sessions = _getFlyoutManagerStor.sessions;
191
+ var ownSession = sessions.find(function (session) {
192
+ return session.mainFlyoutId === flyoutId;
193
+ });
194
+ var isBackgroundedMain = ownSession != null && ownSession !== sessions[sessions.length - 1];
195
+ isBackgroundedMain ? closeFlyout(flyoutId) : closeAllFlyouts();
196
+ }, [level, flyoutId, closeFlyout, closeAllFlyouts]);
197
+
180
198
  // Register with flyout manager context when open, remove when closed
181
199
  // Using useLayoutEffect to run synchronously before DOM updates
182
200
  useLayoutEffect(function () {
@@ -188,7 +206,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
188
206
  });
189
207
  if (stillInStore) {
190
208
  // Normal cleanup (deps changed or explicit close via isOpen=false)
191
- level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
209
+ closeOwnFlyouts();
192
210
  } else if (wasRegisteredRef.current) {
193
211
  var _onCloseCallbackRef$c, _store$consumeCloseMe;
194
212
  // Removed externally while mounted: forward the store-stamped reason
@@ -199,7 +217,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
199
217
  }
200
218
  wasRegisteredRef.current = false;
201
219
  };
202
- }, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
220
+ }, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeOwnFlyouts]);
203
221
 
204
222
  // Detect when flyout has been removed from manager state (e.g., via Back button)
205
223
  // and trigger onClose callback to notify the parent component
@@ -214,8 +232,8 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
214
232
  // any other removal (e.g. a closeAllFlyouts cascade reaching a backgrounded
215
233
  // flyout) defaults to `navigation-cascade`.
216
234
  if (wasRegisteredRef.current && !flyoutExistsInManager) {
217
- var _onCloseCallbackRef$c2, _getFlyoutManagerStor;
218
- (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (_getFlyoutManagerStor = getFlyoutManagerStore().consumeCloseMeta(flyoutId)) !== null && _getFlyoutManagerStor !== void 0 ? _getFlyoutManagerStor : {
235
+ var _onCloseCallbackRef$c2, _getFlyoutManagerStor2;
236
+ (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (_getFlyoutManagerStor2 = getFlyoutManagerStore().consumeCloseMeta(flyoutId)) !== null && _getFlyoutManagerStor2 !== void 0 ? _getFlyoutManagerStor2 : {
219
237
  reason: 'navigation-cascade'
220
238
  });
221
239
  wasRegisteredRef.current = false; // Reset to avoid repeated calls
@@ -252,7 +270,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
252
270
  // and ensures cascade close logic runs before DOM cleanup begins
253
271
  // Using flushSync to force synchronous state update completion
254
272
  flushSync(function () {
255
- level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
273
+ closeOwnFlyouts();
256
274
  });
257
275
  if (onCloseCallbackRef.current) {
258
276
  var event = e || new MouseEvent('click');
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps"];
1
+ var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps", "aria-label", "aria-labelledby"];
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 _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
4
  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; }
@@ -10,10 +10,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
10
10
  * Side Public License, v 1.
11
11
  */
12
12
 
13
- import React from 'react';
13
+ import React, { isValidElement } from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
- import { useEuiMemoizedStyles } from '../../../services';
16
+ import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../../services';
17
17
  import { EuiTitle } from '../../title';
18
18
  import { EuiText } from '../../text';
19
19
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
@@ -40,7 +40,15 @@ export var EuiDescribedFormGroup = function EuiDescribedFormGroup(props) {
40
40
  description = props.description,
41
41
  descriptionFlexItemProps = props.descriptionFlexItemProps,
42
42
  fieldFlexItemProps = props.fieldFlexItemProps,
43
+ ariaLabel = props['aria-label'],
44
+ ariaLabelledby = props['aria-labelledby'],
43
45
  rest = _objectWithoutProperties(props, _excluded);
46
+ var generatedTitleId = useGeneratedHtmlId({
47
+ prefix: 'euiDescribedFormGroupTitle'
48
+ });
49
+ // Reuse an `id` already set on the title element, so that consumers
50
+ // referencing it from their own `aria-labelledby` keep working
51
+ var titleId = /*#__PURE__*/isValidElement(title) && title.props.id || generatedTitleId;
44
52
  var styles = useEuiMemoizedStyles(euiDescribedFormGroupStyles);
45
53
  var cssStyles = [styles.euiDescribedFormGroup, fullWidth ? styles.fullWidth : styles.formWidth];
46
54
  var descriptionColumnStyles = [styles.euiDescribedFormGroup__descriptionColumn, descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.css];
@@ -74,7 +82,11 @@ export var EuiDescribedFormGroup = function EuiDescribedFormGroup(props) {
74
82
  break;
75
83
  }
76
84
  return ___EmotionJSX(EuiFlexGroup, _extends({
77
- role: "group"
85
+ role: "group",
86
+ "aria-label": ariaLabel
87
+ // The title names the group, unless the consumer provides their own label
88
+ ,
89
+ "aria-labelledby": ariaLabelledby !== null && ariaLabelledby !== void 0 ? ariaLabelledby : ariaLabel == null ? titleId : undefined
78
90
  }, rest, {
79
91
  css: cssStyles,
80
92
  className: classes,
@@ -86,6 +98,7 @@ export var EuiDescribedFormGroup = function EuiDescribedFormGroup(props) {
86
98
  css: descriptionColumnStyles,
87
99
  className: classNames('euiDescribedFormGroup__descriptionColumn', descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.className)
88
100
  }), ___EmotionJSX(EuiTitle, {
101
+ id: titleId,
89
102
  size: titleSize,
90
103
  className: "euiDescribedFormGroup__title"
91
104
  }, title), renderedDescription), ___EmotionJSX(EuiFlexItem, _extends({
@@ -1,24 +1,14 @@
1
- var _excluded = ["className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs", "autoFocus"],
1
+ var _excluded = ["autoFocus", "className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs"],
2
2
  _excluded2 = ["id", "name", "content"];
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
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); }
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
5
+ 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."); }
6
+ 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; } }
7
+ 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; }
8
+ 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; } }
9
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
10
  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; }
8
11
  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; }
9
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
11
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
13
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
14
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
15
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
17
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
18
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
19
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
21
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
12
  /*
23
13
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
24
14
  * or more contributor license agreements. Licensed under the Elastic License
@@ -27,138 +17,102 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
27
17
  * Side Public License, v 1.
28
18
  */
29
19
 
30
- import React, { Component, createRef } from 'react';
20
+ import React, { useRef, useState } from 'react';
31
21
  import PropTypes from "prop-types";
32
- import { htmlIdGenerator } from '../../../services';
33
22
  import { EuiTabs } from '../tabs';
34
23
  import { EuiTab } from '../tab';
35
- import { jsx as ___EmotionJSX } from "@emotion/react";
24
+ import { useGeneratedHtmlId } from '../../../services';
25
+
36
26
  /**
37
27
  * Marked as const so type is `['initial', 'selected']` instead of `string[]`
38
28
  */
29
+ import { jsx as ___EmotionJSX } from "@emotion/react";
39
30
  export var AUTOFOCUS = ['initial', 'selected'];
40
- export var EuiTabbedContent = /*#__PURE__*/function (_Component) {
41
- function EuiTabbedContent(props) {
42
- var _this;
43
- _classCallCheck(this, EuiTabbedContent);
44
- _this = _callSuper(this, EuiTabbedContent, [props]);
45
- _defineProperty(_this, "rootId", htmlIdGenerator()());
46
- _defineProperty(_this, "tabsRef", /*#__PURE__*/createRef());
47
- _defineProperty(_this, "focusTab", function () {
48
- var targetTab = _this.tabsRef.current.querySelector("#".concat(_this.state.selectedTabId));
49
- targetTab.focus();
50
- });
51
- _defineProperty(_this, "initializeFocus", function () {
52
- if (!_this.state.inFocus && _this.props.autoFocus === 'selected') {
53
- // Must wait for setState to finish before calling `.focus()`
54
- // as the focus call triggers a blur on the first tab
55
- _this.setState({
56
- inFocus: true
57
- }, function () {
58
- _this.focusTab();
59
- });
60
- }
61
- });
62
- _defineProperty(_this, "removeFocus", function (blurEvent) {
63
- // only set inFocus to false if the wrapping div doesn't contain the now-focusing element
64
- var currentTarget = blurEvent.currentTarget;
65
- var relatedTarget = blurEvent.relatedTarget;
66
- if (currentTarget.contains(relatedTarget) === false) {
67
- _this.setState({
68
- inFocus: false
69
- });
70
- }
71
- });
72
- _defineProperty(_this, "onTabClick", function (selectedTab) {
73
- var _this$props = _this.props,
74
- onTabClick = _this$props.onTabClick,
75
- externalSelectedTab = _this$props.selectedTab;
76
- if (onTabClick) {
77
- onTabClick(selectedTab);
78
- }
79
-
80
- // Only track selection state if it's not controlled externally.
81
- if (!externalSelectedTab) {
82
- _this.setState({
83
- selectedTabId: selectedTab.id
84
- }, function () {
85
- _this.focusTab();
86
- });
87
- }
88
- });
89
- var initialSelectedTab = props.initialSelectedTab,
90
- _selectedTab = props.selectedTab,
91
- tabs = props.tabs;
31
+ export var EuiTabbedContent = function EuiTabbedContent(_ref) {
32
+ var _ref$autoFocus = _ref.autoFocus,
33
+ autoFocus = _ref$autoFocus === void 0 ? 'initial' : _ref$autoFocus,
34
+ className = _ref.className,
35
+ expand = _ref.expand,
36
+ initialSelectedTab = _ref.initialSelectedTab,
37
+ onTabClick = _ref.onTabClick,
38
+ externalSelectedTab = _ref.selectedTab,
39
+ size = _ref.size,
40
+ tabs = _ref.tabs,
41
+ rest = _objectWithoutProperties(_ref, _excluded);
42
+ var rootId = useGeneratedHtmlId();
43
+ var tabsRef = useRef(null);
44
+ var inFocusRef = useRef(false);
45
+ var _useState = useState(function () {
46
+ return externalSelectedTab ? undefined : (initialSelectedTab === null || initialSelectedTab === void 0 ? void 0 : initialSelectedTab.id) || tabs[0].id;
47
+ }),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ selectedTabId = _useState2[0],
50
+ setSelectedTabId = _useState2[1];
51
+ var focusTab = function focusTab(id) {
52
+ var _tabsRef$current;
53
+ var targetTab = (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.querySelector("#".concat(id));
54
+ targetTab === null || targetTab === void 0 || targetTab.focus();
55
+ };
56
+ var initializeFocus = function initializeFocus() {
57
+ if (!inFocusRef.current && autoFocus === 'selected') {
58
+ inFocusRef.current = true;
59
+ focusTab(selectedTabId);
60
+ }
61
+ };
62
+ var removeFocus = function removeFocus(blurEvent) {
63
+ // only set inFocus to false if the wrapping div doesn't contain the now-focusing element
64
+ var currentTarget = blurEvent.currentTarget;
65
+ var relatedTarget = blurEvent.relatedTarget;
66
+ if (currentTarget.contains(relatedTarget) === false) {
67
+ inFocusRef.current = false;
68
+ }
69
+ };
70
+ var handleTabClick = function handleTabClick(tab) {
71
+ onTabClick === null || onTabClick === void 0 || onTabClick(tab);
92
72
 
93
73
  // Only track selection state if it's not controlled externally.
94
- var selectedTabId;
95
- if (!_selectedTab) {
96
- selectedTabId = (initialSelectedTab === null || initialSelectedTab === void 0 ? void 0 : initialSelectedTab.id) || tabs[0].id;
74
+ if (!externalSelectedTab) {
75
+ setSelectedTabId(tab.id);
76
+ focusTab(tab.id);
97
77
  }
98
- _this.state = {
99
- selectedTabId: selectedTabId,
100
- inFocus: false
101
- };
102
- return _this;
103
- }
104
- _inherits(EuiTabbedContent, _Component);
105
- return _createClass(EuiTabbedContent, [{
106
- key: "render",
107
- value: function render() {
108
- var _this2 = this;
109
- var _this$props2 = this.props,
110
- className = _this$props2.className,
111
- expand = _this$props2.expand,
112
- initialSelectedTab = _this$props2.initialSelectedTab,
113
- onTabClick = _this$props2.onTabClick,
114
- externalSelectedTab = _this$props2.selectedTab,
115
- size = _this$props2.size,
116
- tabs = _this$props2.tabs,
117
- autoFocus = _this$props2.autoFocus,
118
- rest = _objectWithoutProperties(_this$props2, _excluded);
78
+ };
119
79
 
120
- // Allow the consumer to control tab selection.
121
- var selectedTab = externalSelectedTab || tabs.find(function (tab) {
122
- return tab.id === _this2.state.selectedTabId;
123
- }) || tabs[0]; // Fall back to the first tab if a selected tab can't be found
80
+ // Allow the consumer to control tab selection.
81
+ var selectedTab = externalSelectedTab || tabs.find(function (tab) {
82
+ return tab.id === selectedTabId;
83
+ }) || tabs[0]; // Fall back to the first tab if a selected tab can't be found
124
84
 
125
- var selectedTabContent = selectedTab.content,
126
- selectedTabId = selectedTab.id;
127
- return ___EmotionJSX("div", _extends({
128
- className: className
129
- }, rest), ___EmotionJSX(EuiTabs, {
130
- ref: this.tabsRef,
131
- expand: expand,
132
- size: size,
133
- onFocus: this.initializeFocus,
134
- onBlur: this.removeFocus
135
- }, tabs.map(function (tab) {
136
- var id = tab.id,
137
- name = tab.name,
138
- content = tab.content,
139
- tabProps = _objectWithoutProperties(tab, _excluded2);
140
- var props = _objectSpread(_objectSpread({
141
- key: id,
142
- id: id
143
- }, tabProps), {}, {
144
- onClick: function onClick() {
145
- return _this2.onTabClick(tab);
146
- },
147
- isSelected: tab === selectedTab,
148
- 'aria-controls': "".concat(_this2.rootId)
149
- });
150
- return ___EmotionJSX(EuiTab, props, name);
151
- })), ___EmotionJSX("div", {
152
- role: "tabpanel",
153
- id: "".concat(this.rootId),
154
- "aria-labelledby": selectedTabId
155
- }, selectedTabContent));
156
- }
157
- }]);
158
- }(Component);
159
- _defineProperty(EuiTabbedContent, "defaultProps", {
160
- autoFocus: 'initial'
161
- });
85
+ var selectedTabContent = selectedTab.content,
86
+ selectedTabContentId = selectedTab.id;
87
+ return ___EmotionJSX("div", _extends({
88
+ className: className
89
+ }, rest), ___EmotionJSX(EuiTabs, {
90
+ ref: tabsRef,
91
+ expand: expand,
92
+ size: size,
93
+ onFocus: initializeFocus,
94
+ onBlur: removeFocus
95
+ }, tabs.map(function (tab) {
96
+ var id = tab.id,
97
+ name = tab.name,
98
+ content = tab.content,
99
+ tabProps = _objectWithoutProperties(tab, _excluded2);
100
+ return ___EmotionJSX(EuiTab, _extends({
101
+ key: id,
102
+ id: id
103
+ }, tabProps, {
104
+ onClick: function onClick() {
105
+ return handleTabClick(tab);
106
+ },
107
+ isSelected: tab === selectedTab,
108
+ "aria-controls": rootId
109
+ }), name);
110
+ })), ___EmotionJSX("div", {
111
+ role: "tabpanel",
112
+ id: rootId,
113
+ "aria-labelledby": selectedTabContentId
114
+ }, selectedTabContent));
115
+ };
162
116
  EuiTabbedContent.propTypes = {
163
117
  className: PropTypes.string,
164
118
  "aria-label": PropTypes.string,
@@ -234,4 +188,5 @@ EuiTabbedContent.propTypes = {
234
188
  "data-test-subj": PropTypes.string,
235
189
  css: PropTypes.any
236
190
  }).isRequired).isRequired
237
- };
191
+ };
192
+ EuiTabbedContent.displayName = 'EuiTabbedContent';