Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Emotion] Fix consumer css overriding (instead of merging with) EUI css in child props #6896

Merged
merged 25 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
95647fe
[setup] Document `shouldRenderCustomStyles` options type more cleanly
cee-chen Jun 28, 2023
4c7fac6
[setup] Move `assertOutputStyles` to internal util
cee-chen Jun 28, 2023
72c4fe0
[setup] DRY out render + renderCallback to a util
cee-chen Jun 28, 2023
7a2eb0d
[setup] DRY out `childProps` merge util
cee-chen Jun 28, 2023
9be0f79
[FIX] Ensure that `css` props do not override baseline EUI `css`
cee-chen Jun 28, 2023
2b5f409
[FIX] Fix `shouldRenderCustomStyles` not merging css no matter what
cee-chen Jun 28, 2023
cfb2590
[EuiAccordion] Fix `buttonProps.css` and `arrowProps.css` overriding …
cee-chen Jun 28, 2023
38fbb71
[EuiBadge] Fix `closeButtonProps.css` overriding EUI css
cee-chen Jun 28, 2023
c298e46
[EuiCard] Fix `betaBadgeProps.css` and `betaBadgeProps.anchorProps.cs…
cee-chen Jun 28, 2023
2974c2c
[EuiExpression] Fix `descriptionProps` and `valueProps` overrides
cee-chen Jun 28, 2023
8c10960
[EuiFlyout] Fix `closeButtonProps.css` overriding EUI css
cee-chen Jun 28, 2023
e056bf5
[EuiKeyPadMenu] Fix `checkable.legendProps.css` overriding EUI css
cee-chen Jun 28, 2023
dedd8f5
[EuiListGroupItem] Fix `iconProps.css` overriding EUI css
cee-chen Jun 28, 2023
14e7ca2
[EuiPageBody] Fix `panelProps.css` overriding EUI css
cee-chen Jun 29, 2023
5730400
[EuiPageHeaderContent] Fix `iconProps.css` overriding EUI css
cee-chen Jun 29, 2023
68fc472
[EuiProgress] Fix `labelProps.css` overriding EUI css
cee-chen Jun 29, 2023
b58df4a
[EuiTour] Fix `panelProps` test
cee-chen Jun 29, 2023
1aa93f8
[enhancement] Add `options.wrapper` API to `shouldRenderCustomStyles`
cee-chen Jun 29, 2023
30bbcf0
[EuiResizablePanel] Fix `wrapperProps.css` overriding EUI css
cee-chen Jun 29, 2023
d488697
[EuiIcon] Fix failing svg test
cee-chen Jun 29, 2023
d250839
[EuiImage] Fix `wrapperProps.css` overriding EUI css
cee-chen Jun 29, 2023
9c41c07
[EuiImage] Fix fullscreen wrapper css + add `targetSelector` API to `…
cee-chen Jun 29, 2023
a2a17f1
[opinionated] Remove custom `css_before_spread_props` lint rule
cee-chen Jun 29, 2023
d93cd43
[docs] Add wiki documentation of this behavior
cee-chen Jun 29, 2023
a5dbaad
changelog
cee-chen Jun 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ exports.rules = {
'require-license-header': require('./scripts/eslint-plugin/require_license_header'),
'forward-ref': require('./scripts/eslint-plugin/forward_ref_display_name'),
'css-logical-properties': require('./scripts/eslint-plugin/css_logical_properties'),
css_before_spread_props: require('./scripts/eslint-plugin/css_before_spread_props'),
'require-cypress-references': require('./scripts/eslint-plugin/require_cypress_references'),
};
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = {
'local/href-with-rel': 'error',
'local/forward-ref': 'error',
'local/css-logical-properties': 'error',
'local/css_before_spread_props': 'error',
'local/require-cypress-references': 'error',
'local/require-license-header': [
'warn',
Expand Down
48 changes: 0 additions & 48 deletions scripts/eslint-plugin/css_before_spread_props.js

This file was deleted.

248 changes: 0 additions & 248 deletions scripts/eslint-plugin/css_before_spread_props.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ exports[`EuiAccordion props arrowProps is rendered 1`] = `
aria-expanded="false"
aria-label="aria-label"
aria-labelledby="generated-id"
class="euiButtonIcon euiAccordion__iconButton testClass1 testClass2 emotion-euiButtonIcon-xs-empty-text-euiTestCss"
class="euiButtonIcon euiAccordion__iconButton testClass1 testClass2 emotion-euiButtonIcon-xs-empty-text-euiAccordion__iconButton-euiTestCss"
data-test-subj="test subject string"
tabindex="-1"
type="button"
Expand Down Expand Up @@ -637,7 +637,7 @@ exports[`EuiAccordion props buttonProps is rendered 1`] = `
aria-controls="4"
aria-expanded="false"
aria-label="aria-label"
class="euiAccordion__button testClass1 testClass2 emotion-euiTestCss"
class="euiAccordion__button testClass1 testClass2 emotion-euiAccordion__button-euiTestCss"
data-test-subj="test subject string"
id="generated-id"
type="button"
Expand Down
6 changes: 4 additions & 2 deletions src/components/accordion/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export class EuiAccordionClass extends Component<
const cssButtonStyles = [
buttonStyles.euiAccordion__button,
isDisabled && buttonStyles.disabled,
buttonProps?.css,
];

const childrenStyles = euiAccordionChildrenStyles(theme);
Expand All @@ -296,6 +297,7 @@ export class EuiAccordionClass extends Component<
iconButtonStyles.euiAccordion__iconButton,
isOpen && iconButtonStyles.isOpen,
_arrowDisplay === 'right' && iconButtonStyles.arrowRight,
arrowProps?.css,
];

const optionalActionStyles = euiAccordionOptionalActionStyles();
Expand All @@ -317,9 +319,9 @@ export class EuiAccordionClass extends Component<
iconButton = (
<EuiButtonIcon
color="text"
css={cssIconButtonStyles}
{...arrowProps}
className={iconButtonClasses}
css={cssIconButtonStyles}
iconType="arrowRight"
onClick={this.onToggle}
aria-controls={id}
Expand Down Expand Up @@ -369,10 +371,10 @@ export class EuiAccordionClass extends Component<

const button = (
<ButtonElement
css={cssButtonStyles}
{...buttonProps}
id={buttonId}
className={buttonClasses}
css={cssButtonStyles}
aria-controls={id}
// `aria-expanded` is only a valid attribute on interactive controls - axe-core throws a violation otherwise
aria-expanded={ButtonElement === 'button' ? isOpen : undefined}
Expand Down
4 changes: 2 additions & 2 deletions src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const EuiBadge: FunctionComponent<EuiBadgeProps> = ({

const closeClassNames = classNames(
'euiBadge__icon',
closeButtonProps && closeButtonProps.className
closeButtonProps?.className
);

const Element = href && !isDisabled ? 'a' : 'button';
Expand Down Expand Up @@ -230,9 +230,9 @@ export const EuiBadge: FunctionComponent<EuiBadgeProps> = ({
type={iconType}
size="s"
color="inherit" // forces the icon to inherit its parent color
css={iconCssStyles}
{...closeButtonProps}
className={closeClassNames}
css={[...iconCssStyles, closeButtonProps?.css]}
/>
</button>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('EuiCard', () => {

shouldRenderCustomStyles(
<EuiCard title="Card title" betaBadgeProps={{ label: 'beta' }} />,
{ childProps: ['betaBadgeProps'] }
{ childProps: ['betaBadgeProps', 'betaBadgeProps.anchorProps'] }
);

describe('props', () => {
Expand Down
Loading