From 6ac16b475de748ab8912f19eef390078cada20dc Mon Sep 17 00:00:00 2001 From: Akira Sudoh Date: Fri, 22 Nov 2019 14:22:00 +0900 Subject: [PATCH 1/5] feat(list-box): update selection style Fixes #3988. --- .../src/components/dropdown/_dropdown.scss | 5 +++++ .../components/src/components/dropdown/dropdown.hbs | 1 + .../src/components/list-box/_list-box.scss | 12 ++++++++++++ .../components/src/components/list-box/list-box.hbs | 3 ++- packages/react/src/components/ComboBox/ComboBox.js | 7 ++++++- packages/react/src/components/Dropdown/Dropdown.js | 7 ++++++- 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/components/src/components/dropdown/_dropdown.scss b/packages/components/src/components/dropdown/_dropdown.scss index e6583772c477..016145e9d85b 100644 --- a/packages/components/src/components/dropdown/_dropdown.scss +++ b/packages/components/src/components/dropdown/_dropdown.scss @@ -178,6 +178,7 @@ background-color $duration--fast-01 motion(standard, productive); opacity: 0; visibility: inherit; + position: relative; &:hover { background-color: $hover-ui; @@ -396,6 +397,10 @@ + .#{$prefix}--dropdown-item .#{$prefix}--dropdown-link { border-top-color: transparent; } + + .#{$prefix}--list-box__menu-item__selected-icon { + display: block; + } } // Skeleton State diff --git a/packages/components/src/components/dropdown/dropdown.hbs b/packages/components/src/components/dropdown/dropdown.hbs index 4aaae77f29e2..71a7c4b29177 100644 --- a/packages/components/src/components/dropdown/dropdown.hbs +++ b/packages/components/src/components/dropdown/dropdown.hbs @@ -140,6 +140,7 @@ {{#each items as |item index|}}
  • {{label}} + {{ carbon-icon 'Checkmark16' class=(add @root.prefix '--list-box__menu-item__selected-icon') aria-hidden="true" }}
  • {{/each}} diff --git a/packages/components/src/components/list-box/_list-box.scss b/packages/components/src/components/list-box/_list-box.scss index 85a1100893ec..33dc5fb407be 100644 --- a/packages/components/src/components/list-box/_list-box.scss +++ b/packages/components/src/components/list-box/_list-box.scss @@ -545,6 +545,18 @@ $list-box-menu-width: rem(300px); color: $text-01; } + .#{$prefix}--list-box__menu-item__selected-icon { + display: none; + position: absolute; + top: rem(12px); + right: rem(16px); + } + + .#{$prefix}--list-box__menu-item--active + .#{$prefix}--list-box__menu-item__selected-icon { + display: block; + } + .#{$prefix}--list-box__menu-item .#{$prefix}--checkbox-label { width: 100%; } diff --git a/packages/components/src/components/list-box/list-box.hbs b/packages/components/src/components/list-box/list-box.hbs index 87a53ea0fe5d..cc731fe80849 100644 --- a/packages/components/src/components/list-box/list-box.hbs +++ b/packages/components/src/components/list-box/list-box.hbs @@ -114,10 +114,11 @@