-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Tag] Improve outline behavior #2428
Changes from 5 commits
c780896
221bdc0
f0e9eb6
22633b7
059231e
45b96f3
d169afa
f10e1c1
43c4c9f
9198538
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,14 @@ | |
@import "../forms/common"; | ||
@import "../tag/common"; | ||
|
||
$ti-padding: ($pt-input-height - $tag-height) / 2; | ||
$tag-input-padding: ($pt-input-height - $tag-height) / 2; | ||
|
||
$ti-icon-padding: ($pt-input-height - $pt-icon-size-standard) / 2; | ||
$ti-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / 2; | ||
$tag-input-icon-padding: ($pt-input-height - $pt-icon-size-standard) / 2; | ||
$tag-input-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / 2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add |
||
|
||
$tag-input-outline-color: $pt-outline-color; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$tag-input-outline-offset: 1px; | ||
$tag-input-outline-size: 2px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these two vars are unused; please remove |
||
|
||
.#{$ns}-tag-input { | ||
@include pt-flex-container(row, $fill: ".#{$ns}-tag-input-values"); | ||
|
@@ -17,34 +21,39 @@ $ti-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / 2; | |
height: auto; | ||
min-height: $pt-input-height; | ||
padding-right: 0; | ||
padding-left: $ti-padding; | ||
padding-left: $tag-input-padding; | ||
|
||
.#{$ns}-tag-input-icon { | ||
// margins to center icon in one-line input | ||
margin-top: $ti-icon-padding; | ||
margin-right: $ti-icon-padding; | ||
margin-left: $ti-icon-padding - $ti-padding; | ||
margin-top: $tag-input-icon-padding; | ||
margin-right: $tag-input-icon-padding; | ||
margin-left: $tag-input-icon-padding - $tag-input-padding; | ||
color: $pt-icon-color; | ||
} | ||
|
||
.#{$ns}-tag-input-values { | ||
@include pt-flex-container(row, $ti-padding); | ||
@include pt-flex-container(row, $tag-input-padding); | ||
flex-wrap: wrap; | ||
align-items: center; | ||
// fill vertical height | ||
align-self: stretch; | ||
margin-top: $ti-padding; | ||
margin-right: $ti-icon-padding; | ||
margin-top: $tag-input-padding; | ||
margin-right: $tag-input-icon-padding; | ||
|
||
> * { | ||
margin-bottom: $ti-padding; | ||
margin-bottom: $tag-input-padding; | ||
} | ||
} | ||
|
||
.#{$ns}-tag { | ||
position: relative; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't think this chance is necessary. leftover from previous attempt? |
||
// NOTE: in order to wrap long words, you must set explicit width on TagInput, | ||
// or use .#{$ns}-fill CSS class modifier. | ||
overflow-wrap: break-word; | ||
|
||
&.#{$ns}-active { | ||
@include focus-outline(0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's the right move, but did it anyway, Not sure what to do with outline design in general |
||
} | ||
} | ||
|
||
.#{$ns}-input-ghost { | ||
|
@@ -71,13 +80,13 @@ $ti-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / 2; | |
} | ||
|
||
&.#{$ns}-large { | ||
@include pt-flex-margin(row, $ti-icon-padding-large); | ||
@include pt-flex-margin(row, $tag-input-icon-padding-large); | ||
height: auto; | ||
min-height: $pt-input-height-large; | ||
|
||
.#{$ns}-tag-input-icon { | ||
margin-top: $ti-icon-padding-large; | ||
margin-left: $ti-icon-padding-large - $ti-padding; | ||
margin-top: $tag-input-icon-padding-large; | ||
margin-left: $tag-input-icon-padding-large - $tag-input-padding; | ||
} | ||
|
||
.#{$ns}-input-ghost { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,6 @@ $tag-padding-large: ($tag-height-large - $pt-icon-size-large) / 2 !default; | |
&.#{$ns}-tag-removable { | ||
padding-right: $tag-height; | ||
} | ||
|
||
&.#{$ns}-active { | ||
@include focus-outline(0); | ||
} | ||
} | ||
|
||
@mixin pt-tag-large() { | ||
|
@@ -106,6 +102,7 @@ $tag-padding-large: ($tag-height-large - $pt-icon-size-large) / 2 !default; | |
background-color: rgba($background-color, $opacity - 0.15); | ||
} | ||
|
||
&.pt-active, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
&:active { | ||
background-color: rgba($background-color, $opacity - 0.3); | ||
} | ||
|
@@ -120,6 +117,7 @@ $tag-padding-large: ($tag-height-large - $pt-icon-size-large) / 2 !default; | |
background-color: rgba($background-color, $opacity + 0.1); | ||
} | ||
|
||
&.pt-active, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
&:active { | ||
background-color: rgba($background-color, $opacity + 0.2); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ export class Tag extends React.PureComponent<ITagProps, {}> { | |
) : null; | ||
|
||
return ( | ||
<span {...htmlProps} className={tagClasses}> | ||
<span {...htmlProps} className={tagClasses} tabIndex={interactive ? 0 : -1}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we want
|
||
{children} | ||
{removeButton} | ||
</span> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was a bit confused by the namespace look of
$ti
so named this more classicly... if you feel strongly, I can revert back, but this seems more legible to me