From 11dd537feaa230133f8051fd6c370e6e3ec7d54f Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Wed, 20 Nov 2024 13:35:36 +0100 Subject: [PATCH 1/8] fix(Select): do not reserve space for clear if empty (#1956) --- .../components/SelectClear/SelectClear.scss | 1 + .../SelectControl/SelectControl.scss | 25 +++---------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/components/Select/components/SelectClear/SelectClear.scss b/src/components/Select/components/SelectClear/SelectClear.scss index 3949b639ad..dc844d6a5a 100644 --- a/src/components/Select/components/SelectClear/SelectClear.scss +++ b/src/components/Select/components/SelectClear/SelectClear.scss @@ -10,6 +10,7 @@ $block: '.#{variables.$ns}select-clear'; align-items: center; margin-inline-start: auto; z-index: 1; + flex-shrink: 0; &:focus-visible { border: 1px solid var(--g-color-line-generic-active); diff --git a/src/components/Select/components/SelectControl/SelectControl.scss b/src/components/Select/components/SelectControl/SelectControl.scss index 8fae1ea32f..006da7d381 100644 --- a/src/components/Select/components/SelectControl/SelectControl.scss +++ b/src/components/Select/components/SelectControl/SelectControl.scss @@ -48,22 +48,6 @@ $blockButton: '.#{variables.$ns}select-control__button'; } } -@mixin block_clear_reserved_width() { - // reserving place for clear icon to fix width changing on displaying clear - #{$block}_has-clear:not(#{$block}_has-value)#{$block}_size_s & { - padding-inline-end: calc(#{variables.$s-height} + var(--_--text-right-padding)); - } - #{$block}_has-clear:not(#{$block}_has-value)#{$block}_size_m & { - padding-inline-end: calc(#{variables.$m-height} + var(--_--text-right-padding)); - } - #{$block}_has-clear:not(#{$block}_has-value)#{$block}_size_l & { - padding-inline-end: calc(#{variables.$l-height} + var(--_--text-right-padding)); - } - #{$block}_has-clear:not(#{$block}_has-value)#{$block}_size_xl & { - padding-inline-end: calc(#{variables.$xl-height} + var(--_--text-right-padding)); - } -} - @mixin block_clear_reserved_disabled_width() { // reserving place for clear icon to fix width changing on displaying clear for disabled select #{$block}_has-clear#{$block}_size_s #{$blockButton}_disabled & { @@ -222,17 +206,16 @@ $blockButton: '.#{variables.$ns}select-control__button'; &__placeholder, &__option-text { @include mixins.overflow-ellipsis(); - @include block_clear_reserved_disabled_width(); padding-inline-end: var(--_--text-right-padding); } + &__option-text { + @include block_clear_reserved_disabled_width(); + } + &__placeholder { color: var(--g-color-text-hint); - - #{$blockButton}:not(#{$blockButton}_disabled) & { - @include block_clear_reserved_width(); - } } &__chevron-icon { From 8d456c3d77d63674f20ebac82913d8a26c14f997 Mon Sep 17 00:00:00 2001 From: sofiushko Date: Mon, 25 Nov 2024 19:52:22 +0300 Subject: [PATCH 2/8] fix(Toc): correctly display content of no items.length and add event forward (#1939) --- src/components/Toc/Toc.tsx | 7 +++++-- src/components/Toc/TocItem/TocItem.tsx | 23 ++++++++++++++--------- src/components/Toc/__tests__/Toc.test.tsx | 22 ++++++++++++++++------ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/components/Toc/Toc.tsx b/src/components/Toc/Toc.tsx index a29575dbe1..30e9b65dab 100644 --- a/src/components/Toc/Toc.tsx +++ b/src/components/Toc/Toc.tsx @@ -15,10 +15,11 @@ export interface TocProps extends QAProps { items: TocItemType[]; value?: string; onUpdate?: (value: string) => void; + onItemClick?: (event: React.MouseEvent) => void; } export const Toc = React.forwardRef(function Toc(props, ref) { - const {value: activeValue, items, className, onUpdate, qa} = props; + const {value: activeValue, items, className, onUpdate, onItemClick, qa} = props; return (