-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Emotion] Convert EuiFormLabel and EuiFormLegend (#7967)
- Loading branch information
Showing
45 changed files
with
158 additions
and
292 deletions.
There are no files selected for viewing
Binary file modified
BIN
-1 Byte
(100%)
packages/eui/.loki/reference/chrome_desktop_Forms_EuiForm_Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...eference/chrome_desktop_Forms_EuiForm_EuiDescribedFormGroup_Implicit_Titles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...oki/reference/chrome_desktop_Forms_EuiForm_EuiDescribedFormGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...nce/chrome_desktop_Forms_EuiForm_EuiFormControlLayoutDelimited_Kitchen_Sink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-22 Bytes
(100%)
.../reference/chrome_desktop_Forms_EuiForm_EuiFormControlLayout_Append_Prepend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+42 Bytes
(100%)
...eui/.loki/reference/chrome_desktop_Forms_EuiForm_EuiFormFieldset_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5 Bytes
(100%)
...esktop_Forms_EuiForm_EuiFormFieldset_Subcomponents_EuiFormLegend_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-29 Bytes
(99%)
...ages/eui/.loki/reference/chrome_desktop_Forms_EuiForm_EuiFormRow_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-24 Bytes
(98%)
...rome_desktop_Forms_EuiForm_EuiFormRow_Subcomponents_EuiFormLabel_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-64 Bytes
(100%)
packages/eui/.loki/reference/chrome_mobile_Forms_EuiForm_Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-25 Bytes
(100%)
...reference/chrome_mobile_Forms_EuiForm_EuiDescribedFormGroup_Implicit_Titles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-37 Bytes
(100%)
...loki/reference/chrome_mobile_Forms_EuiForm_EuiDescribedFormGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-40 Bytes
(100%)
...ence/chrome_mobile_Forms_EuiForm_EuiFormControlLayoutDelimited_Kitchen_Sink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+51 Bytes
(100%)
...i/reference/chrome_mobile_Forms_EuiForm_EuiFormControlLayout_Append_Prepend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-26 Bytes
(100%)
.../eui/.loki/reference/chrome_mobile_Forms_EuiForm_EuiFormFieldset_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+26 Bytes
(100%)
...mobile_Forms_EuiForm_EuiFormFieldset_Subcomponents_EuiFormLegend_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-145 Bytes
(99%)
packages/eui/.loki/reference/chrome_mobile_Forms_EuiForm_EuiFormRow_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-53 Bytes
(98%)
...hrome_mobile_Forms_EuiForm_EuiFormRow_Subcomponents_EuiFormLabel_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**CSS-in-JS conversions** | ||
|
||
- Converted `EuiFormLabel` and `EuiFormLegend` to Emotion; Removed `@euiFormLabel` mixin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
@import 'checkbox/index'; | ||
@import 'form_fieldset/index'; | ||
@import 'form_label/index'; | ||
@import 'form_row/index'; | ||
@import 'radio/index'; | ||
@import 'switch/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/eui/src/components/form/form_fieldset/_form_legend.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/eui/src/components/form/form_fieldset/form_legend.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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 { UseEuiTheme } from '../../../services'; | ||
import { logicalCSS } from '../../../global_styling'; | ||
import { euiFormLabel } from '../form_label/form_label.styles'; | ||
|
||
export const euiFormLegendStyles = (euiThemeContext: UseEuiTheme) => { | ||
const { euiTheme } = euiThemeContext; | ||
|
||
return { | ||
euiFormLegend: css` | ||
${euiFormLabel(euiThemeContext)} | ||
`, | ||
// Skip css`` to avoid generating an extra Emotion className | ||
uncompressed: logicalCSS('margin-bottom', euiTheme.size.s), | ||
compressed: css(logicalCSS('margin-bottom', euiTheme.size.xs)), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
packages/eui/src/components/form/form_label/_form_label.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
packages/eui/src/components/form/form_label/form_label.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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 { serializeStyles, type CSSObject } from '@emotion/serialize'; | ||
|
||
import { UseEuiTheme } from '../../../services'; | ||
import { euiCanAnimate, euiTextBreakWord } from '../../../global_styling'; | ||
import { euiTitle } from '../../title/title.styles'; | ||
|
||
export const euiFormLabel = (euiThemeContext: UseEuiTheme) => { | ||
const { euiTheme } = euiThemeContext; | ||
// Exclude the fontWeight from the title, since we're setting our own later | ||
const { fontWeight: _, ..._titleStyles } = euiTitle(euiThemeContext, 'xxxs'); | ||
// Since we're not returning a css`` string (to avoid generating an extra Emotion | ||
// className), we need to manually serialize the style object into a string | ||
const titleStyles = serializeStyles([_titleStyles as CSSObject]).styles; | ||
|
||
return ` | ||
${titleStyles} | ||
font-weight: ${euiTheme.font.weight.semiBold}; | ||
${euiTextBreakWord()} | ||
`; | ||
}; | ||
|
||
export const euiFormLabelStyles = (euiThemeContext: UseEuiTheme) => { | ||
const { euiTheme } = euiThemeContext; | ||
|
||
return { | ||
euiFormLabel: css` | ||
${euiFormLabel(euiThemeContext)} | ||
display: inline-block; | ||
${euiCanAnimate} { | ||
transition: color ${euiTheme.animation.fast} | ||
${euiTheme.animation.resistance}; | ||
} | ||
`, | ||
// Skip css`` to avoid generating an extra Emotion className | ||
// Use :where to reduce specificity & make the CSS easier to override by prepend/append nodes | ||
notDisabled: ` | ||
&:where([for]) { | ||
cursor: pointer; | ||
} | ||
`, | ||
invalid: css` | ||
color: ${euiTheme.colors.danger}; | ||
`, | ||
// Focused state should override invalid state | ||
focused: css` | ||
color: ${euiTheme.colors.primary}; | ||
`, | ||
}; | ||
}; |
Oops, something went wrong.