Mailspring/static/components/tokenizing-text-field.less

211 lines
5.7 KiB
Plaintext
Raw Normal View History

@import "ui-variables";
@token-top:lighten(@background-secondary,0.6%);
@token-bottom:darken(@background-secondary, 2.5%);
@token-hover-top: mix(@token-top, @component-active-color, 92%);
@token-hover-bottom: mix(@token-bottom, @component-active-color, 90%);
@token-selected-top: mix(@token-top, @component-active-color, 15%);
@token-selected-bottom: mix(@token-bottom, @component-active-color, 0%);
@token-invalid-selected-top: mix(@token-top, red, 60%);
@token-invalid-selected-bottom: mix(@token-bottom, red, 55%);
.tokenizing-field {
2015-03-05 04:30:54 +08:00
display: block;
margin: 0;
padding: 0;
position: relative;
.content-container {
border: 1px solid @border-color-secondary;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
border-radius: @border-radius-small;
background-color: @background-primary;
position: absolute;
z-index: 2;
}
.content-container.empty {
border: 0;
box-shadow: none;
}
2015-03-05 04:30:54 +08:00
.header-container, .footer-container {
background-color: transparent;
padding:0;
margin:0;
border:0;
}
.token-editing-input {
max-width: 100%;
font-size: 15px;
line-height: 17px;
padding: 2em;//0.5em @spacing-three-quarters 0.5em @spacing-three-quarters;
padding-right: 1.5em;
margin: 3px 6px 6px 1px;
}
2015-03-05 04:30:54 +08:00
.token {
display: inline-block;
position: relative;
color: @text-color;
padding: 0 @spacing-three-quarters;
2015-03-05 04:30:54 +08:00
padding-right: 1.5em;
margin: 1px 5px 1px 1px;
border-radius: @border-radius-base * 0.8;
2015-03-05 10:47:48 +08:00
max-width: 100%;
line-height: 1.9em;
background: linear-gradient(to bottom, @token-top 0%, @token-bottom 100%);
box-shadow: 0 0.5px 0 rgba(0,0,0,0.17), 0 -0.5px 0 rgba(0,0,0,0.17), 0.5px 0 0 rgba(0,0,0,0.17), -0.5px 0 0 rgba(0,0,0,0.17), 0 1px 1px rgba(0, 0, 0, 0.1);
2015-03-05 04:30:54 +08:00
.action {
position:absolute;
padding: 0;
border: 0;
margin: 0;
right: 7px;
2015-03-05 04:30:54 +08:00
background-color: transparent;
color: @text-color-very-subtle;
img { background-color: @text-color-very-subtle; }
2015-03-05 04:30:54 +08:00
font-size: 10px;
}
2015-03-05 04:30:54 +08:00
&:hover {
background: linear-gradient(to bottom, @token-hover-top 0%, @token-hover-bottom 100%);
box-shadow: 0 0.5px 0 darken(@token-hover-bottom, 35%), 0 -0.5px 0 darken(@token-hover-top, 25%), 0.5px 0 0 darken(@token-hover-bottom, 25%), -0.5px 0 0 darken(@token-hover-bottom, 25%), 0 1px 1px rgba(0, 0, 0, 0.07);
cursor: default;
}
&.invalid {
border-bottom:1px dashed red;
margin-bottom: -1px;
background: transparent;
&:hover {
box-shadow: 0 -0.5px 0 @token-invalid-selected-top, 0.5px 0 0 @token-invalid-selected-bottom, -0.5px 0 0 @token-invalid-selected-bottom, 0 1px 1px rgba(0, 0, 0, 0.07);
}
}
&.invalid.selected, &.invalid.dragging {
background: linear-gradient(to bottom, @token-invalid-selected-top 0%, @token-invalid-selected-bottom 100%);
box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.3), 0 1px 1px rgba(0, 0, 0, 0.1);
border: 1px solid darken(@token-invalid-selected-bottom, 8%);
border-top: 1px solid darken(@token-invalid-selected-top, 10%);
}
2015-03-05 04:30:54 +08:00
&.selected,
&.dragging {
background: linear-gradient(to bottom, @token-selected-top 0%, @token-selected-bottom 100%);
box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.3), 0 1px 1px rgba(0, 0, 0, 0.1);
border: 1px solid darken(@token-selected-bottom, 8%);
border-top: 1px solid darken(@token-selected-top, 10%);
border-radius: @border-radius-base;
// Note: we switch from 0.5px borders with box shadows to a real border,
// because the 0.5px shadows can't be as dark as we want. This means
// margins / border radius change by 1px.
margin: 0 4px 0 0;
2015-03-05 04:30:54 +08:00
color: @text-color-inverse;
.action {
color: @text-color-inverse-subtle;
img { background-color: @text-color-inverse-subtle; }
}
.secondary,
.participant-secondary {
color: @text-color-inverse-subtle;
}
}
&.dragging {
cursor: -webkit-grabbing;
}
2015-03-05 04:30:54 +08:00
}
2015-03-05 04:30:54 +08:00
.tokenizing-field-label {
2015-03-05 07:52:40 +08:00
color: @text-color-very-subtle;
2015-03-05 04:30:54 +08:00
float: left;
text-transform: capitalize;
fix(focus): Remove focusedField in favor of imperative focus, break apart ComposerView Summary: - Removes controlled focus in the composer! - No React components ever perfom focus in lifecycle methods. Never again. - A new `Utils.schedule({action, after, timeout})` helper makes it easy to say "setState or load draft, etc. and then focus" - The DraftStore issues a focusDraft action after creating a draft, which causes the MessageList to focus and scroll to the desired composer, which itself decides which field to focus. - The MessageList never focuses anything automatically. - Refactors ComposerView apart — ComposerHeader handles all top fields, DraftSessionContainer handles draft session initialization and exposes props to ComposerView - ComposerHeader now uses a KeyCommandRegion (with focusIn and focusOut) to do the expanding and collapsing of the participants fields. May rename that container very soon. - Removes all CommandRegistry handling of tab and shift-tab. Unless you preventDefault, the browser does it's thing. - Removes all tabIndexes greater than 1. This is an anti-pattern—assigning everything a tabIndex of 0 tells the browser to move between them based on their order in the DOM, and is almost always what you want. - Adds "TabGroupRegion" which allows you to create a tab/shift-tabbing group, (so tabbing does not leave the active composer). Can't believe this isn't a browser feature. Todos: - Occasionally, clicking out of the composer contenteditable requires two clicks. This is because atomicEdit is restoring selection within the contenteditable and breaking blur. - Because the ComposerView does not render until it has a draft, we're back to it being white in popout composers for a brief moment. We will fix this another way - all the "return unless draft" statements were untenable. - Clicking a row in the thread list no longer shifts focus to the message list and focuses the last draft. This will be restored soon. Test Plan: Broken Reviewers: juan, evan Reviewed By: juan, evan Differential Revision: https://phab.nylas.com/D2814
2016-04-05 06:22:01 +08:00
padding-top: 12px;
2015-03-05 04:30:54 +08:00
display: block;
}
2015-03-05 07:52:40 +08:00
2015-03-05 04:30:54 +08:00
.tokenizing-field-input {
2015-03-05 10:47:48 +08:00
position: relative;
padding-left: 2.8em;
fix(focus): Remove focusedField in favor of imperative focus, break apart ComposerView Summary: - Removes controlled focus in the composer! - No React components ever perfom focus in lifecycle methods. Never again. - A new `Utils.schedule({action, after, timeout})` helper makes it easy to say "setState or load draft, etc. and then focus" - The DraftStore issues a focusDraft action after creating a draft, which causes the MessageList to focus and scroll to the desired composer, which itself decides which field to focus. - The MessageList never focuses anything automatically. - Refactors ComposerView apart — ComposerHeader handles all top fields, DraftSessionContainer handles draft session initialization and exposes props to ComposerView - ComposerHeader now uses a KeyCommandRegion (with focusIn and focusOut) to do the expanding and collapsing of the participants fields. May rename that container very soon. - Removes all CommandRegistry handling of tab and shift-tab. Unless you preventDefault, the browser does it's thing. - Removes all tabIndexes greater than 1. This is an anti-pattern—assigning everything a tabIndex of 0 tells the browser to move between them based on their order in the DOM, and is almost always what you want. - Adds "TabGroupRegion" which allows you to create a tab/shift-tabbing group, (so tabbing does not leave the active composer). Can't believe this isn't a browser feature. Todos: - Occasionally, clicking out of the composer contenteditable requires two clicks. This is because atomicEdit is restoring selection within the contenteditable and breaking blur. - Because the ComposerView does not render until it has a draft, we're back to it being white in popout composers for a brief moment. We will fix this another way - all the "return unless draft" statements were untenable. - Clicking a row in the thread list no longer shifts focus to the message list and focuses the last draft. This will be restored soon. Test Plan: Broken Reviewers: juan, evan Reviewed By: juan, evan Differential Revision: https://phab.nylas.com/D2814
2016-04-05 06:22:01 +08:00
padding-top: 9px;
padding-bottom: 3px;
&:hover {
cursor: text;
}
2015-03-05 04:30:54 +08:00
input {
display: inline-block;
width: initial;
vertical-align:top;
2015-03-05 04:30:54 +08:00
border: none;
min-width: 0.5em;
2015-03-05 04:30:54 +08:00
background-color:transparent;
// NOTE: padding-top and padding-bottom need to match that of
// `.token`. to ensure they have the same baseline.
//
// The padding-left and padding-right must be 0 so we can manually
// set the width properly to always match the size of the input
// test.
padding: 0.3em 0 0.3em 0;
&.noop-input {
position: absolute;
min-width: 0;
padding-left: 0;
margin-right: 0;
box-shadow: none;
&:focus {
box-shadow: none;
}
}
}
input:focus {
box-shadow: none;
}
2015-03-05 04:30:54 +08:00
}
.placeholder {
color: fade(@text-color, 50%);
position: absolute;
top: 50%;
margin-top: -0.8em;
left: 1em;
font-size: 12px;
}
}
body.is-blurred .tokenizing-field .token:not(.invalid) {
background: @background-secondary;
}
body.platform-win32 {
.tokenizing-field {
.content-container {
border-radius: 0;
}
}
.token {
border-radius: 0;
background: @token-bottom;
&.selected,
&.dragging {
border-radius: 0;
background: @token-selected-top;
}
&:hover {
background: @token-hover-bottom;
}
&.invalid.selected, &.invalid.dragging {
background: @token-invalid-selected-top;
}
}
}