mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 19:42:54 +08:00
fix: Some input style issue (#21316)
* fix firefox flex bug * fix input wrapper style * fix clear text style * update snapshot
This commit is contained in:
parent
06de637163
commit
4192c1f6d9
@ -14,7 +14,7 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
|
|||||||
<span
|
<span
|
||||||
class="ant-input-group-addon"
|
class="ant-input-group-addon"
|
||||||
>
|
>
|
||||||
Http://
|
http://
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
class="ant-input"
|
class="ant-input"
|
||||||
@ -68,7 +68,7 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
|
|||||||
<span
|
<span
|
||||||
class="ant-select-selection-item"
|
class="ant-select-selection-item"
|
||||||
>
|
>
|
||||||
Http://
|
http://
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
@ -211,6 +211,37 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
style="margin-bottom:16px"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-wrapper"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-wrapper ant-input-group"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-addon"
|
||||||
|
>
|
||||||
|
http://
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="ant-input-affix-wrapper"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="ant-input"
|
||||||
|
type="text"
|
||||||
|
value="mysite"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="ant-input-suffix"
|
||||||
|
>
|
||||||
|
.com
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ import { SettingOutlined } from '@ant-design/icons';
|
|||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
const selectBefore = (
|
const selectBefore = (
|
||||||
<Select defaultValue="Http://" style={{ width: 90 }}>
|
<Select defaultValue="http://" style={{ width: 90 }}>
|
||||||
<Option value="Http://">Http://</Option>
|
<Option value="http://">http://</Option>
|
||||||
<Option value="Https://">Https://</Option>
|
<Option value="https://">https://</Option>
|
||||||
</Select>
|
</Select>
|
||||||
);
|
);
|
||||||
const selectAfter = (
|
const selectAfter = (
|
||||||
@ -37,7 +37,7 @@ const selectAfter = (
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<div>
|
<div>
|
||||||
<div style={{ marginBottom: 16 }}>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<Input addonBefore="Http://" addonAfter=".com" defaultValue="mysite" />
|
<Input addonBefore="http://" addonAfter=".com" defaultValue="mysite" />
|
||||||
</div>
|
</div>
|
||||||
<div style={{ marginBottom: 16 }}>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
|
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
|
||||||
@ -45,6 +45,9 @@ ReactDOM.render(
|
|||||||
<div style={{ marginBottom: 16 }}>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<Input addonAfter={<SettingOutlined />} defaultValue="mysite" />
|
<Input addonAfter={<SettingOutlined />} defaultValue="mysite" />
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{ marginBottom: 16 }}>
|
||||||
|
<Input addonBefore="http://" suffix=".com" defaultValue="mysite" />
|
||||||
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
.input();
|
.input();
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|
||||||
> .@{ant-prefix}-input {
|
> input.@{ant-prefix}-input {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
@ -17,11 +17,6 @@
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{ant-prefix}-input-clear-icon {
|
|
||||||
margin: 0 @input-affix-margin;
|
|
||||||
vertical-align: -1px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-prefix,
|
&-prefix,
|
||||||
|
47
components/input/style/allow-clear.less
Normal file
47
components/input/style/allow-clear.less
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
@import './index';
|
||||||
|
|
||||||
|
.clear-icon() {
|
||||||
|
color: @disabled-color;
|
||||||
|
font-size: @font-size-sm;
|
||||||
|
// https://github.com/ant-design/ant-design/pull/18151
|
||||||
|
// https://codesandbox.io/s/wizardly-sun-u10br
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.3s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: @text-color-secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
color: @text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ i {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========================= Input =========================
|
||||||
|
.@{ant-prefix}-input-clear-icon {
|
||||||
|
.clear-icon;
|
||||||
|
margin: 0 @input-affix-margin;
|
||||||
|
vertical-align: -1px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ======================= TextArea ========================
|
||||||
|
.@{ant-prefix}-input-affix-wrapper-textarea-with-clear-btn {
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.@{ant-prefix}-input-textarea-clear-icon {
|
||||||
|
.clear-icon;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 8px 8px 0 0;
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
@import '../../style/mixins/index';
|
@import '../../style/mixins/index';
|
||||||
@import './mixin';
|
@import './mixin';
|
||||||
@import './affix';
|
@import './affix';
|
||||||
|
@import './allow-clear';
|
||||||
|
|
||||||
// Input styles
|
// Input styles
|
||||||
.@{ant-prefix}-input {
|
.@{ant-prefix}-input {
|
||||||
@ -37,17 +38,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{ant-prefix}-input-clear-icon {
|
|
||||||
.clear-icon;
|
|
||||||
vertical-align: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.@{ant-prefix}-input-textarea-clear-icon {
|
|
||||||
.clear-icon;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
margin: 8px 8px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@import './search-input';
|
@import './search-input';
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
padding: @input-padding-vertical-base @input-padding-horizontal-base;
|
padding: @input-padding-vertical-base @input-padding-horizontal-base;
|
||||||
color: @input-color;
|
color: @input-color;
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
@ -306,7 +307,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.@{inputClass}-affix-wrapper {
|
.@{inputClass}-affix-wrapper {
|
||||||
border-radius: 0;
|
&:not(:first-child) {
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:last-child) {
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&&-compact {
|
&&-compact {
|
||||||
@ -417,24 +426,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.clear-icon() {
|
|
||||||
color: @disabled-color;
|
|
||||||
font-size: @font-size-sm;
|
|
||||||
// https://github.com/ant-design/ant-design/pull/18151
|
|
||||||
// https://codesandbox.io/s/wizardly-sun-u10br
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 0.3s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: @text-color-secondary;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
color: @text-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ i {
|
|
||||||
margin-left: 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user