* + * {
- margin-left: $euiSizeS; /* 3 */
- }
-}
diff --git a/src/components/call_out/_index.scss b/src/components/call_out/_index.scss
index 950298dc9c5..d1ee44203d1 100644
--- a/src/components/call_out/_index.scss
+++ b/src/components/call_out/_index.scss
@@ -1,4 +1,3 @@
@import 'variables';
@import 'mixins';
-@import 'call_out';
diff --git a/src/components/call_out/_mixins.scss b/src/components/call_out/_mixins.scss
index 10b644a3d8e..f3f140c240a 100644
--- a/src/components/call_out/_mixins.scss
+++ b/src/components/call_out/_mixins.scss
@@ -1,4 +1,10 @@
+// Kibana's Ace Editor uses this function, can't remove yet
+// https://github.com/elastic/kibana/blob/main/src/core/public/styles/_ace_overrides.scss
+// As well as deprecation notices
+// https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss
@function euiCallOutColor($type: 'primary', $returnBackgroundOrForeground: 'background') {
+ @warn 'euiCallOutColor() is set for deprecation. Please consider using EuiCallOut directly.';
+
@if (map-has-key($euiCallOutTypes, $type)) {
$color: map-get($euiCallOutTypes, $type);
$backgroundColor: tintOrShade($color, 90%, 70%);
@@ -15,13 +21,3 @@
@warn 'Incorrect type of call out provided. See the $euiCallOutTypes map for allowed values.';
}
}
-
-@mixin euiCallOutTitle($size: null) {
- @if ($size == 's') {
- @include euiTitle('xxs');
- font-weight: $euiFontWeightRegular;
- } @else {
- @include euiTitle('xs');
- font-weight: $euiFontWeightRegular;
- }
-}
diff --git a/src/components/call_out/_variables.scss b/src/components/call_out/_variables.scss
index ecfd7e7e7a2..3e09e74d962 100644
--- a/src/components/call_out/_variables.scss
+++ b/src/components/call_out/_variables.scss
@@ -1,4 +1,4 @@
-// Modifier naming and colors.
+// Used in mixin that's used in Kibana
$euiCallOutTypes: (
primary: $euiColorPrimary,
success: $euiColorSuccess,
diff --git a/src/components/call_out/call_out.styles.ts b/src/components/call_out/call_out.styles.ts
new file mode 100644
index 00000000000..16b1ebf799a
--- /dev/null
+++ b/src/components/call_out/call_out.styles.ts
@@ -0,0 +1,47 @@
+/*
+ * 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 { css } from '@emotion/react';
+import { logicalCSS } from '../../global_styling';
+import { UseEuiTheme } from '../../services';
+
+export const euiCallOutStyles = ({ euiTheme }: UseEuiTheme) => {
+ return {
+ euiCallOut: css``,
+ euiCallOut__icon: css`
+ position: relative;
+ ${logicalCSS('top', '-1px')};
+ ${logicalCSS('margin-right', euiTheme.size.s)};
+ `,
+ euiCallOut__description: css`
+ ${logicalCSS('margin-top', euiTheme.size.s)};
+ `,
+ };
+};
+
+export const euiCallOutHeadingStyles = ({ euiTheme }: UseEuiTheme) => {
+ return {
+ euiCallOutHeader: css`
+ font-weight: ${euiTheme.font.weight.medium};
+ margin-bottom: 0 !important; // In case it's nested inside EuiText
+ `,
+
+ primary: css`
+ color: ${euiTheme.colors.primaryText};
+ `,
+ success: css`
+ color: ${euiTheme.colors.successText};
+ `,
+ warning: css`
+ color: ${euiTheme.colors.warningText};
+ `,
+ danger: css`
+ color: ${euiTheme.colors.dangerText};
+ `,
+ };
+};
diff --git a/src/components/call_out/call_out.tsx b/src/components/call_out/call_out.tsx
index 7fc09e2a1aa..0d4257d501d 100644
--- a/src/components/call_out/call_out.tsx
+++ b/src/components/call_out/call_out.tsx
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import React, { forwardRef, Ref, HTMLAttributes, ReactNode } from 'react';
+import React, { forwardRef, HTMLAttributes, ReactNode } from 'react';
import classNames from 'classnames';
@@ -14,6 +14,11 @@ import { CommonProps, keysOf } from '../common';
import { IconType, EuiIcon } from '../icon';
import { EuiText } from '../text';
+import { useEuiTheme } from '../../services';
+import { EuiPanel } from '../panel';
+import { EuiTitle } from '../title';
+
+import { euiCallOutStyles, euiCallOutHeadingStyles } from './call_out.styles';
type Color = 'primary' | 'success' | 'warning' | 'danger';
type Size = 's' | 'm';
@@ -38,11 +43,6 @@ const colorToClassNameMap: { [color in Color]: string } = {
export const COLORS = keysOf(colorToClassNameMap);
export const HEADINGS: Heading[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
-const sizeToClassNameMap: { [size in Size]: string } = {
- s: 'euiCallOut--small',
- m: '',
-};
-
export const EuiCallOut = forwardRef
(
(
{
@@ -52,15 +52,26 @@ export const EuiCallOut = forwardRef(
iconType,
children,
className,
- heading,
+ heading = 'p',
...rest
},
- ref: Ref
+ ref
) => {
+ const theme = useEuiTheme();
+ const styles = euiCallOutStyles(theme);
+ const cssStyles = [styles.euiCallOut];
+ const cssIconStyle = [styles.euiCallOut__icon];
+ const cssDescriptionStyle = [styles.euiCallOut__description];
+
+ const headerStyles = euiCallOutHeadingStyles(theme);
+ const cssHeaderStyles = [
+ headerStyles.euiCallOutHeader,
+ headerStyles[color],
+ ];
+
const classes = classNames(
'euiCallOut',
colorToClassNameMap[color],
- sizeToClassNameMap[size],
className
);
@@ -69,7 +80,7 @@ export const EuiCallOut = forwardRef(
if (iconType) {
headerIcon = (
(
}
let optionalChildren;
- if (children && size === 's') {
- optionalChildren = (
-
- {children}
-
- );
- } else if (children) {
+ if (children) {
optionalChildren = (
-
+
{children}
);
}
- const H: any = heading ? `${heading}` : 'span';
let header;
-
if (title) {
+ const H: Heading = heading;
header = (
-
- {headerIcon}
- {title}
-
+
+
+ {headerIcon}
+ {title}
+
+
);
}
+
return (
-
+
{header}
{optionalChildren}
-
+
);
}
);
diff --git a/src/components/form/__snapshots__/form.test.tsx.snap b/src/components/form/__snapshots__/form.test.tsx.snap
index 10cf353611b..513a2b6177d 100644
--- a/src/components/form/__snapshots__/form.test.tsx.snap
+++ b/src/components/form/__snapshots__/form.test.tsx.snap
@@ -24,19 +24,15 @@ exports[`EuiForm renders with error callout when isInvalid is "true" 1`] = `
>
-
+ Please address the highlighted errors.
+
`;
@@ -49,21 +45,17 @@ exports[`EuiForm renders with error callout when isInvalid is "true" and has mul
>