-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature branch] Added EuiFormControlLayoutDelimited component (#2117)
As a layout helper component to create date and number ranges * Added Sass var for `$euiFormControlLayoutGroupInputHeight` and compressed version
- Loading branch information
Showing
19 changed files
with
494 additions
and
61 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
src-docs/src/views/form_controls/form_control_layout_range.js
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,137 @@ | ||
import React, { Fragment } from 'react'; | ||
|
||
import { | ||
EuiFormControlLayoutDelimited, | ||
EuiSpacer, | ||
EuiFormLabel, | ||
EuiIcon, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<Fragment> | ||
<EuiFormControlLayoutDelimited | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
append={<EuiFormLabel>px</EuiFormLabel>} | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
icon="vector" | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
clear={{ onClick: () => {} }} | ||
isLoading | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
fullWidth | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
isLoading | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
<EuiFormControlLayoutDelimited | ||
compressed | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormControlLayoutDelimited | ||
prepend={<EuiFormLabel>Add</EuiFormLabel>} | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
delimiter="+" | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormControlLayoutDelimited | ||
prepend={<EuiFormLabel>Merge</EuiFormLabel>} | ||
startControl={ | ||
<input type="number" placeholder="0" className="euiFieldNumber" /> | ||
} | ||
delimiter={<EuiIcon type="merge" />} | ||
endControl={ | ||
<input type="number" placeholder="100" className="euiFieldNumber" /> | ||
} | ||
/> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormControlLayoutDelimited | ||
readOnly | ||
prepend={<EuiFormLabel>Read only</EuiFormLabel>} | ||
startControl={ | ||
<input | ||
type="number" | ||
placeholder="0" | ||
className="euiFieldNumber" | ||
readOnly | ||
/> | ||
} | ||
endControl={ | ||
<input | ||
type="number" | ||
placeholder="100" | ||
className="euiFieldNumber" | ||
readOnly | ||
/> | ||
} | ||
/> | ||
</Fragment> | ||
); |
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,10 +1,12 @@ | ||
@import '../../form/form_control_layout/variables'; | ||
|
||
@mixin euiSuperDatePickerText { | ||
@include euiFormControlText; | ||
display: block; | ||
width: 100%; | ||
padding: 0 $euiSizeS; | ||
line-height: $euiFormControlHeight - 2px; | ||
height: $euiFormControlHeight - 2px; | ||
line-height: $euiFormControlLayoutGroupInputHeight; | ||
height: $euiFormControlLayoutGroupInputHeight; | ||
word-break: break-all; | ||
transition: background $euiAnimSpeedFast ease-in; | ||
} |
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,5 +1,3 @@ | ||
@import 'form_control_layout/mixins'; | ||
|
||
@import 'variables'; | ||
@import 'mixins'; | ||
|
||
|
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
100 changes: 100 additions & 0 deletions
100
...onents/form/form_control_layout/__snapshots__/form_control_layout_delimited.test.tsx.snap
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,100 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiFormControlLayoutDelimited is rendered 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="euiFormControlLayout euiFormControlLayoutDelimited testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
<div | ||
class="euiFormControlLayout__childrenWrapper" | ||
> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
start | ||
</span> | ||
<div | ||
class="euiText euiText--small euiFormControlLayoutDelimited__delimeter" | ||
> | ||
<div | ||
class="euiTextColor euiTextColor--subdued" | ||
> | ||
→ | ||
</div> | ||
</div> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
end | ||
</span> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`EuiFormControlLayoutDelimited props delimiter is rendered as a node 1`] = ` | ||
<div | ||
class="euiFormControlLayout euiFormControlLayoutDelimited" | ||
> | ||
<div | ||
class="euiFormControlLayout__childrenWrapper" | ||
> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
start | ||
</span> | ||
<div | ||
class="euiText euiText--small euiFormControlLayoutDelimited__delimeter" | ||
> | ||
<div | ||
class="euiTextColor euiTextColor--subdued" | ||
> | ||
<svg | ||
class="euiIcon euiIcon--medium euiIcon-isLoading" | ||
focusable="false" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</div> | ||
</div> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
end | ||
</span> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`EuiFormControlLayoutDelimited props delimiter is rendered as a string 1`] = ` | ||
<div | ||
class="euiFormControlLayout euiFormControlLayoutDelimited" | ||
> | ||
<div | ||
class="euiFormControlLayout__childrenWrapper" | ||
> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
start | ||
</span> | ||
<div | ||
class="euiText euiText--small euiFormControlLayoutDelimited__delimeter" | ||
> | ||
<div | ||
class="euiTextColor euiTextColor--subdued" | ||
> | ||
+ | ||
</div> | ||
</div> | ||
<span | ||
class="euiFormControlLayoutDelimited__child--noStyle euiFormControlLayoutDelimited__child--centered" | ||
> | ||
end | ||
</span> | ||
</div> | ||
</div> | ||
`; |
Oops, something went wrong.