-
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
[v4] [core] feat: update input borders and separate buttons #5055
Changes from all commits
1d18572
0dbb11a
f73326b
bf9a15c
2a6ab33
6fb7d68
f9efb2e
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ $dark-input-color-disabled: $dark-button-color-disabled !default; | |
$dark-input-placeholder-color: $pt-dark-text-color-disabled !default; | ||
$dark-input-background-color: rgba($black, 0.3) !default; | ||
$dark-input-background-color-disabled: rgba($dark-gray5, 0.5) !default; | ||
$dark-input-shadow-color-focus: $pt-intent-primary !default; | ||
$dark-input-shadow-color-focus: $blue4 !default; | ||
|
||
$control-indicator-size: $pt-icon-size-standard !default; | ||
$control-indicator-size-large: $pt-icon-size-large !default; | ||
|
@@ -59,8 +59,8 @@ $control-group-stack: ( | |
@function input-transition-shadow($color: $input-shadow-color-focus, $focus: false) { | ||
@if $focus { | ||
@return | ||
border-shadow(1, $color, 1px), | ||
border-shadow(0.3, $color, 3px); | ||
inset border-shadow(1, $color, 1px), | ||
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. |
||
border-shadow(0.3, $color, 2px); | ||
} @else { | ||
@return | ||
border-shadow(0, $color, 0), | ||
|
@@ -71,9 +71,9 @@ $control-group-stack: ( | |
@function dark-input-transition-shadow($color: $dark-input-shadow-color-focus, $focus: false) { | ||
@if $focus { | ||
@return | ||
border-shadow(1, $color, 1px), | ||
border-shadow(1, $color, 1px), // duplicating to minimize browser antialiasing in dark | ||
border-shadow(0.3, $color, 3px); | ||
inset border-shadow(1, $color, 1px), | ||
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. |
||
inset border-shadow(1, $color, 1px), // duplicating to minimize browser antialiasing in dark | ||
border-shadow(0.3, $color, 2px); | ||
} @else { | ||
@return | ||
border-shadow(0, $color, 0), | ||
|
@@ -188,8 +188,7 @@ $control-group-stack: ( | |
color: $dark-input-color; | ||
|
||
&:focus { | ||
box-shadow: dark-input-transition-shadow($dark-input-shadow-color-focus, true), | ||
$pt-dark-input-box-shadow; | ||
box-shadow: dark-input-transition-shadow($dark-input-shadow-color-focus, true); | ||
} | ||
|
||
&[readonly] { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,12 +91,9 @@ Styleguide control-group | |
} | ||
|
||
.#{$ns}-input { | ||
// inherit radius since it's most likely to be zero | ||
border-radius: inherit; | ||
z-index: index($control-group-stack, "input-default"); | ||
|
||
&:focus { | ||
border-radius: $pt-border-radius; | ||
z-index: index($control-group-stack, "input-focus"); | ||
} | ||
|
||
|
@@ -127,8 +124,6 @@ Styleguide control-group | |
.#{$ns}-html-select select, | ||
.#{$ns}-select select { | ||
@include new-render-layer(); | ||
// inherit radius since it's most likely to be zero | ||
border-radius: inherit; | ||
z-index: index($control-group-stack, "button-default"); | ||
|
||
&:focus { | ||
|
@@ -195,57 +190,10 @@ Styleguide control-group | |
z-index: index($control-group-stack, "button-focus"); | ||
} | ||
|
||
// have consecutive elements share a border | ||
&:not(.#{$ns}-vertical) { | ||
> *:not(.#{$ns}-divider) { | ||
margin-right: -$button-border-width; | ||
> :not(:last-child) { | ||
margin-right: 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. |
||
} | ||
|
||
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. removed all logic for removing borders between consecutive components |
||
> .#{$ns}-divider:not(:first-child) { | ||
margin-left: $divider-margin + $button-border-width; | ||
} | ||
|
||
.#{$ns}-dark & { | ||
> *:not(.#{$ns}-divider) { | ||
margin-right: 0; | ||
} | ||
|
||
|
||
// consecutive buttons within a button group look okay out of the box, but | ||
// we need need to make a small correction for non-grouped buttons. this | ||
// replicates what's already done in dark theme button groups. | ||
> .#{$ns}-button + .#{$ns}-button { | ||
margin-left: $button-border-width; | ||
} | ||
} | ||
} | ||
|
||
// Add border radius inheritance to support components wrapped in a popover | ||
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. removed all logic to unround border-radius for consecutive components |
||
.#{$ns}-popover-wrapper, | ||
.#{$ns}-popover-target { | ||
border-radius: inherit; | ||
} | ||
|
||
// round the left corners of the left-most element | ||
> :first-child { | ||
border-radius: $pt-border-radius 0 0 $pt-border-radius; | ||
} | ||
|
||
// round the right corners of the right-most element | ||
> :last-child { | ||
border-radius: 0 $pt-border-radius $pt-border-radius 0; | ||
margin-right: 0; | ||
} | ||
|
||
// round all the corners of the only child element | ||
> :only-child { | ||
border-radius: $pt-border-radius; | ||
margin-right: 0; | ||
} | ||
|
||
// bring back border radius on these buttons | ||
.#{$ns}-input-group .#{$ns}-button { | ||
border-radius: $pt-border-radius; | ||
} | ||
|
||
// special handling of numeric input, which is a nested control group itself | ||
|
@@ -307,17 +255,8 @@ Styleguide control-group | |
&.#{$ns}-vertical { | ||
flex-direction: column; | ||
|
||
> * { | ||
margin-top: -$button-border-width; | ||
} | ||
|
||
> :first-child { | ||
border-radius: $pt-border-radius $pt-border-radius 0 0; | ||
margin-top: 0; | ||
} | ||
|
||
> :last-child { | ||
border-radius: 0 0 $pt-border-radius $pt-border-radius; | ||
> :not(:last-child) { | ||
margin-bottom: 2px; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,10 @@ $input-button-height-small: $pt-button-height-smaller !default; | |
&.#{$ns}-intent-#{$intent} { | ||
.#{$ns}-input { | ||
@include pt-input-intent($color); | ||
|
||
.#{$ns}-dark & { | ||
@include pt-dark-input-intent(map-get($pt-dark-input-intent-box-shadow-colors, $intent)); | ||
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. |
||
} | ||
} | ||
|
||
> .#{$ns}-icon { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ Styleguide input | |
@include pt-input-intent($color); | ||
|
||
.#{$ns}-dark & { | ||
@include pt-dark-input-intent($color); | ||
@include pt-dark-input-intent(map-get($pt-dark-input-intent-box-shadow-colors, $intent)); | ||
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. same as above but for non-input group dark inputs |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,35 +3,13 @@ | |
@import "./common"; | ||
|
||
.#{$ns}-numeric-input { | ||
|
||
// we need a very-specific selector here to override specificicty of selectors defined elsewhere. | ||
.#{$ns}-button-group.#{$ns}-vertical > .#{$ns}-button { | ||
// let the buttons shrink to equal heights | ||
flex: 1 1 ($pt-button-height / 2 - 1); | ||
min-height: 0; | ||
padding: 0; | ||
width: $pt-button-height; | ||
|
||
&:first-child { | ||
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. removed all logic to unround border-radius for consecutive components in numeric input |
||
border-radius: 0 $pt-border-radius 0 0; | ||
} | ||
|
||
&:last-child { | ||
border-radius: 0 0 $pt-border-radius 0; | ||
} | ||
} | ||
|
||
// fix button border radius when the buttons are on the left | ||
.#{$ns}-button-group.#{$ns}-vertical { | ||
&:first-child > .#{$ns}-button { | ||
&:first-child { | ||
border-radius: $pt-border-radius 0 0 0; | ||
} | ||
|
||
&:last-child { | ||
border-radius: 0 0 0 $pt-border-radius; | ||
} | ||
} | ||
} | ||
|
||
&.#{$ns}-large .#{$ns}-button-group.#{$ns}-vertical > .#{$ns}-button { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,7 @@ $tag-input-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / | |
background-color: $input-background-color; | ||
box-shadow: input-transition-shadow($input-shadow-color-focus, true), $input-box-shadow-focus; | ||
|
||
@each $intent, $color in $pt-intent-text-colors { | ||
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. |
||
@each $intent, $color in $pt-intent-colors { | ||
&.#{$ns}-intent-#{$intent} { | ||
box-shadow: input-transition-shadow($color, true), $input-box-shadow-focus; | ||
} | ||
|
@@ -138,7 +138,7 @@ $tag-input-icon-padding-large: ($pt-input-height-large - $pt-icon-size-large) / | |
box-shadow: dark-input-transition-shadow($dark-input-shadow-color-focus, true), | ||
$pt-dark-input-box-shadow; | ||
|
||
@each $intent, $color in $pt-intent-text-colors { | ||
@each $intent, $color in $pt-dark-input-intent-box-shadow-colors { | ||
&.#{$ns}-intent-#{$intent} { | ||
box-shadow: input-transition-shadow($color, true), $pt-dark-input-box-shadow; | ||
} | ||
|
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.
Moved all of these overrides + styles to
components/forms/*