From bd7915576825bafc454546e391fb0ae0c954ebb9 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Tue, 21 Mar 2023 12:25:48 -0500 Subject: [PATCH 1/4] fix(structured-list): add selected background border --- .../scss/components/structured-list/_structured-list.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/styles/scss/components/structured-list/_structured-list.scss b/packages/styles/scss/components/structured-list/_structured-list.scss index 7c14d48211bd..66cd36691b49 100644 --- a/packages/styles/scss/components/structured-list/_structured-list.scss +++ b/packages/styles/scss/components/structured-list/_structured-list.scss @@ -93,10 +93,16 @@ cursor: pointer; } - .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected { + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected, + .#{$prefix}--structured-list-row:has(.#{$prefix}--structured-list-input:checked) { background-color: $background-selected; } + .#{$prefix}--structured-list-row:has(.#{$prefix}--structured-list-input:checked) + .#{$prefix}--structured-list-td { + color: $text-primary; + } + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--header-row { border-bottom: 1px solid $background-selected; cursor: inherit; From 21a84cd43de63400add3068abb56f106ad854229 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Wed, 22 Mar 2023 13:42:09 -0500 Subject: [PATCH 2/4] fix(StructuredList): render selected class --- .../react/src/components/StructuredList/StructuredList.js | 2 ++ .../scss/components/structured-list/_structured-list.scss | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/react/src/components/StructuredList/StructuredList.js b/packages/react/src/components/StructuredList/StructuredList.js index d11d7cc14157..dac249db3b3d 100644 --- a/packages/react/src/components/StructuredList/StructuredList.js +++ b/packages/react/src/components/StructuredList/StructuredList.js @@ -162,12 +162,14 @@ export function StructuredListRow(props) { const { onKeyDown, children, className, head, ...other } = props; const [hasFocusWithin, setHasFocusWithin] = useState(false); const id = useId('grid-input'); + const selectedRow = React.useContext(GridSelectedRowStateContext); const setSelectedRow = React.useContext(GridSelectedRowDispatchContext); const prefix = usePrefix(); const value = { id }; const classes = classNames(`${prefix}--structured-list-row`, className, { [`${prefix}--structured-list-row--header-row`]: head, [`${prefix}--structured-list-row--focused-within`]: hasFocusWithin, + [`${prefix}--structured-list-row--selected`]: selectedRow === id, }); return head ? ( diff --git a/packages/styles/scss/components/structured-list/_structured-list.scss b/packages/styles/scss/components/structured-list/_structured-list.scss index 66cd36691b49..c5ca07e51cb5 100644 --- a/packages/styles/scss/components/structured-list/_structured-list.scss +++ b/packages/styles/scss/components/structured-list/_structured-list.scss @@ -93,12 +93,11 @@ cursor: pointer; } - .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected, - .#{$prefix}--structured-list-row:has(.#{$prefix}--structured-list-input:checked) { + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected { background-color: $background-selected; } - .#{$prefix}--structured-list-row:has(.#{$prefix}--structured-list-input:checked) + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected .#{$prefix}--structured-list-td { color: $text-primary; } From ea2ade344a8fb715043de6bd64495d528a76a403 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Mon, 3 Apr 2023 12:54:13 -0500 Subject: [PATCH 3/4] fix(structured-list): hover selected border color adjustment --- .../structured-list/_structured-list.scss | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/packages/styles/scss/components/structured-list/_structured-list.scss b/packages/styles/scss/components/structured-list/_structured-list.scss index c5ca07e51cb5..7186eb23cf6b 100644 --- a/packages/styles/scss/components/structured-list/_structured-list.scss +++ b/packages/styles/scss/components/structured-list/_structured-list.scss @@ -81,20 +81,41 @@ .#{$prefix}--structured-list-row { display: table-row; - border-bottom: 1px solid $border-subtle; + border-top: 1px solid $border-subtle; transition: background-color motion.$duration-fast-02 motion.motion(standard, productive); } + .#{$prefix}--structured-list-tbody + .#{$prefix}--structured-list-row:last-child { + border-bottom: 1px solid $border-subtle; + } + + .#{$prefix}--structured-list-row--header-row { + border: none; + } + .#{$prefix}--structured-list--selection .#{$prefix}--structured-list-row:hover:not(.#{$prefix}--structured-list-row--header-row):not(.#{$prefix}--structured-list-row--selected) { - border-bottom: 1px solid $background-hover; - background-color: $background-hover; + border-color: $layer-hover; + background-color: $layer-hover; cursor: pointer; } + .#{$prefix}--structured-list--selection + .#{$prefix}--structured-list-row:hover:not(.#{$prefix}--structured-list-row--header-row):not(.#{$prefix}--structured-list-row--selected) + + .#{$prefix}--structured-list-row { + border-color: $layer-hover; + } + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected { - background-color: $background-selected; + border-color: $layer-selected; + background-color: $layer-selected; + } + + .#{$prefix}--structured-list-row--selected + + .#{$prefix}--structured-list-row { + border-color: $layer-selected; } .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected @@ -103,7 +124,6 @@ } .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--header-row { - border-bottom: 1px solid $background-selected; cursor: inherit; } @@ -120,16 +140,6 @@ color: $text-primary; } - .#{$prefix}--structured-list--selection - .#{$prefix}--structured-list-row:hover:not(.#{$prefix}--structured-list-row--header-row) - > .#{$prefix}--structured-list-td { - @if enabled('enable-v11-release') { - border-top: 1px solid $border-subtle; - } @else { - border-top: 1px solid $layer; - } - } - .#{$prefix}--structured-list-thead { display: table-header-group; vertical-align: middle; @@ -163,9 +173,6 @@ display: table-cell; max-width: 36rem; color: $text-secondary; - @if enabled('enable-v11-release') { - border-top: 1px solid $border-subtle; - } transition: color motion.$duration-fast-02 motion.motion(standard, productive); From ca77e79ac7605daf0c6a75336899f5240a44bb1f Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Tue, 4 Apr 2023 08:24:44 -0500 Subject: [PATCH 4/4] fix: simple list selection --- .../components/structured-list/_structured-list.scss | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/styles/scss/components/structured-list/_structured-list.scss b/packages/styles/scss/components/structured-list/_structured-list.scss index 7186eb23cf6b..a7358fe43cb7 100644 --- a/packages/styles/scss/components/structured-list/_structured-list.scss +++ b/packages/styles/scss/components/structured-list/_structured-list.scss @@ -108,17 +108,20 @@ border-color: $layer-hover; } - .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected { + .#{$prefix}--structured-list--selection + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected { border-color: $layer-selected; background-color: $layer-selected; } - .#{$prefix}--structured-list-row--selected + .#{$prefix}--structured-list--selection + .#{$prefix}--structured-list-row--selected + .#{$prefix}--structured-list-row { border-color: $layer-selected; } - .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected + .#{$prefix}--structured-list--selection + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected .#{$prefix}--structured-list-td { color: $text-primary; } @@ -135,7 +138,8 @@ .#{$prefix}--structured-list--selection .#{$prefix}--structured-list-row:hover:not(.#{$prefix}--structured-list-row--header-row) > .#{$prefix}--structured-list-td, - .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected + .#{$prefix}--structured-list--selection + .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected > .#{$prefix}--structured-list-td { color: $text-primary; }