From fb5e3830b3940d0ce3f169625c3f60c4190d274c Mon Sep 17 00:00:00 2001 From: Alaa Yahia Date: Mon, 8 Apr 2024 04:18:24 +0200 Subject: [PATCH 01/10] feat(Chip): libs-553 add chipGroup component --- components/chip/src/chip-group/chip-group.js | 75 +++++++++++++++++++ components/chip/src/chip-group/index.js | 1 + components/chip/src/{ => chip}/chip.js | 9 ++- .../chip/src/{ => chip}/chip.stories.e2e.js | 0 .../chip/src/{ => chip}/chip.stories.js | 0 components/chip/src/{ => chip}/content.js | 0 .../features/accepts_children.feature | 0 .../features/accepts_children/index.js | 0 .../{ => chip}/features/accepts_icon.feature | 0 .../{ => chip}/features/accepts_icon/index.js | 0 .../{ => chip}/features/is_clickable.feature | 0 .../{ => chip}/features/is_clickable/index.js | 0 .../{ => chip}/features/is_removable.feature | 0 .../{ => chip}/features/is_removable/index.js | 0 components/chip/src/{ => chip}/icon.js | 0 components/chip/src/chip/index.js | 1 + components/chip/src/{ => chip}/remove.js | 0 components/chip/src/index.js | 3 +- 18 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 components/chip/src/chip-group/chip-group.js create mode 100644 components/chip/src/chip-group/index.js rename components/chip/src/{ => chip}/chip.js (97%) rename components/chip/src/{ => chip}/chip.stories.e2e.js (100%) rename components/chip/src/{ => chip}/chip.stories.js (100%) rename components/chip/src/{ => chip}/content.js (100%) rename components/chip/src/{ => chip}/features/accepts_children.feature (100%) rename components/chip/src/{ => chip}/features/accepts_children/index.js (100%) rename components/chip/src/{ => chip}/features/accepts_icon.feature (100%) rename components/chip/src/{ => chip}/features/accepts_icon/index.js (100%) rename components/chip/src/{ => chip}/features/is_clickable.feature (100%) rename components/chip/src/{ => chip}/features/is_clickable/index.js (100%) rename components/chip/src/{ => chip}/features/is_removable.feature (100%) rename components/chip/src/{ => chip}/features/is_removable/index.js (100%) rename components/chip/src/{ => chip}/icon.js (100%) create mode 100644 components/chip/src/chip/index.js rename components/chip/src/{ => chip}/remove.js (100%) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js new file mode 100644 index 0000000000..859d49fe7a --- /dev/null +++ b/components/chip/src/chip-group/chip-group.js @@ -0,0 +1,75 @@ +import { theme } from '@dhis2/ui-constants' +import PropTypes from 'prop-types' +import React, { useRef } from 'react' + +const ChipGroup = ({ className, dataTest, children }) => { + const chipContainer = useRef(null) + + const handleKeyDown = (event) => { + const currentFocus = document.activeElement + + if (chipContainer.current && chipContainer.current === currentFocus) { + const chips = Array.from( + chipContainer.current.querySelectorAll('[role="option"]') + ) + + chips[0].focus() + return + } + + const role = currentFocus.getAttribute('role') + + if (role !== 'option') { + return + } + + const chips = Array.from( + chipContainer.current.querySelectorAll('[role="option"]') + ) + + const currentIndex = chips.indexOf(currentFocus) + + if (event.key === 'ArrowRight') { + event.preventDefault() + const nextIndex = (currentIndex + 1) % chips.length + chips[nextIndex].focus() + } + if (event.key === 'ArrowLeft') { + event.preventDefault() + const prevIndex = (currentIndex - 1 + chips.length) % chips.length + chips[prevIndex].focus() + } + } + return ( +
+ {children} + +
+ ) +} + +ChipGroup.defaultProps = { + dataTest: 'dhis2-uicore-chipgroup', +} + +ChipGroup.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + dataTest: PropTypes.string, +} + +export { ChipGroup } diff --git a/components/chip/src/chip-group/index.js b/components/chip/src/chip-group/index.js new file mode 100644 index 0000000000..d94f294e98 --- /dev/null +++ b/components/chip/src/chip-group/index.js @@ -0,0 +1 @@ +export { ChipGroup } from './chip-group.js' diff --git a/components/chip/src/chip.js b/components/chip/src/chip/chip.js similarity index 97% rename from components/chip/src/chip.js rename to components/chip/src/chip/chip.js index 221bf677cd..8ab06c39e7 100644 --- a/components/chip/src/chip.js +++ b/components/chip/src/chip/chip.js @@ -27,7 +27,8 @@ const Chip = ({ marginInlineStart, marginInlineEnd, }) => ( - { if (!disabled && onClick) { onClick({}, e) @@ -40,13 +41,14 @@ const Chip = ({ dragging, })} data-test={dataTest} + tabIndex={-1} > {children} - + ) Chip.defaultProps = { diff --git a/components/chip/src/chip.stories.e2e.js b/components/chip/src/chip/chip.stories.e2e.js similarity index 100% rename from components/chip/src/chip.stories.e2e.js rename to components/chip/src/chip/chip.stories.e2e.js diff --git a/components/chip/src/chip.stories.js b/components/chip/src/chip/chip.stories.js similarity index 100% rename from components/chip/src/chip.stories.js rename to components/chip/src/chip/chip.stories.js diff --git a/components/chip/src/content.js b/components/chip/src/chip/content.js similarity index 100% rename from components/chip/src/content.js rename to components/chip/src/chip/content.js diff --git a/components/chip/src/features/accepts_children.feature b/components/chip/src/chip/features/accepts_children.feature similarity index 100% rename from components/chip/src/features/accepts_children.feature rename to components/chip/src/chip/features/accepts_children.feature diff --git a/components/chip/src/features/accepts_children/index.js b/components/chip/src/chip/features/accepts_children/index.js similarity index 100% rename from components/chip/src/features/accepts_children/index.js rename to components/chip/src/chip/features/accepts_children/index.js diff --git a/components/chip/src/features/accepts_icon.feature b/components/chip/src/chip/features/accepts_icon.feature similarity index 100% rename from components/chip/src/features/accepts_icon.feature rename to components/chip/src/chip/features/accepts_icon.feature diff --git a/components/chip/src/features/accepts_icon/index.js b/components/chip/src/chip/features/accepts_icon/index.js similarity index 100% rename from components/chip/src/features/accepts_icon/index.js rename to components/chip/src/chip/features/accepts_icon/index.js diff --git a/components/chip/src/features/is_clickable.feature b/components/chip/src/chip/features/is_clickable.feature similarity index 100% rename from components/chip/src/features/is_clickable.feature rename to components/chip/src/chip/features/is_clickable.feature diff --git a/components/chip/src/features/is_clickable/index.js b/components/chip/src/chip/features/is_clickable/index.js similarity index 100% rename from components/chip/src/features/is_clickable/index.js rename to components/chip/src/chip/features/is_clickable/index.js diff --git a/components/chip/src/features/is_removable.feature b/components/chip/src/chip/features/is_removable.feature similarity index 100% rename from components/chip/src/features/is_removable.feature rename to components/chip/src/chip/features/is_removable.feature diff --git a/components/chip/src/features/is_removable/index.js b/components/chip/src/chip/features/is_removable/index.js similarity index 100% rename from components/chip/src/features/is_removable/index.js rename to components/chip/src/chip/features/is_removable/index.js diff --git a/components/chip/src/icon.js b/components/chip/src/chip/icon.js similarity index 100% rename from components/chip/src/icon.js rename to components/chip/src/chip/icon.js diff --git a/components/chip/src/chip/index.js b/components/chip/src/chip/index.js new file mode 100644 index 0000000000..8214f999ee --- /dev/null +++ b/components/chip/src/chip/index.js @@ -0,0 +1 @@ +export { Chip } from './chip.js' diff --git a/components/chip/src/remove.js b/components/chip/src/chip/remove.js similarity index 100% rename from components/chip/src/remove.js rename to components/chip/src/chip/remove.js diff --git a/components/chip/src/index.js b/components/chip/src/index.js index 8214f999ee..9d4b3062bd 100644 --- a/components/chip/src/index.js +++ b/components/chip/src/index.js @@ -1 +1,2 @@ -export { Chip } from './chip.js' +export { Chip } from './chip/index.js' +export { ChipGroup } from './chip-group/index.js' From a428d2b0019ad9185ab8fcd40cc0c3a854048c54 Mon Sep 17 00:00:00 2001 From: Alaa Yahia Date: Mon, 8 Apr 2024 05:04:02 +0200 Subject: [PATCH 02/10] feat(Chip): libs-554 make chip keyboard accessible --- components/chip/src/chip/chip.js | 174 +++++++++++++++++-------------- 1 file changed, 93 insertions(+), 81 deletions(-) diff --git a/components/chip/src/chip/chip.js b/components/chip/src/chip/chip.js index 8ab06c39e7..0a2fb58d27 100644 --- a/components/chip/src/chip/chip.js +++ b/components/chip/src/chip/chip.js @@ -26,96 +26,108 @@ const Chip = ({ marginTop, marginInlineStart, marginInlineEnd, -}) => ( - -) + .disabled .remove-icon { + pointer-events: none; + } + + .dragging { + box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), + 0 2px 2px 0 rgba(0, 0, 0, 0.14), + 0 1px 5px 0 rgba(0, 0, 0, 0.12); + } + `} + + + ) +} Chip.defaultProps = { dataTest: 'dhis2-uicore-chip', From 8c0c379b6a246e5b5b8b01e63e2643fd58ba8e11 Mon Sep 17 00:00:00 2001 From: Alaa Yahia Date: Mon, 8 Apr 2024 05:06:12 +0200 Subject: [PATCH 03/10] feat(Chip): libs-555 add chip aria attributes --- components/chip/src/chip/chip.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/chip/src/chip/chip.js b/components/chip/src/chip/chip.js index 0a2fb58d27..fb2ef9fa6c 100644 --- a/components/chip/src/chip/chip.js +++ b/components/chip/src/chip/chip.js @@ -53,6 +53,8 @@ const Chip = ({ data-test={dataTest} tabIndex={-1} role="option" + aria-selected={selected ? 'true' : 'false'} + aria-disabled={disabled ? 'true' : 'false'} > {children} From 51770e1a80fbb00c833cecb3bb7084ca26350bbd Mon Sep 17 00:00:00 2001 From: Alaa Yahia Date: Wed, 17 Apr 2024 23:15:20 +0200 Subject: [PATCH 04/10] fix(chip): move focus to next chip when chip removed --- components/chip/src/chip-group/chip-group.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index 859d49fe7a..b2064314b7 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -12,8 +12,9 @@ const ChipGroup = ({ className, dataTest, children }) => { const chips = Array.from( chipContainer.current.querySelectorAll('[role="option"]') ) - - chips[0].focus() + if (chips.length > 0) { + chips[0].focus() + } return } @@ -39,6 +40,10 @@ const ChipGroup = ({ className, dataTest, children }) => { const prevIndex = (currentIndex - 1 + chips.length) % chips.length chips[prevIndex].focus() } + if (event.key === 'Backspace' || event.key === 'Delete') { + const nextIndex = (currentIndex + 1) % chips.length + chips[nextIndex].focus() + } } return (
Date: Sat, 13 Jul 2024 00:02:07 +0300 Subject: [PATCH 05/10] chore: avoid refs --- components/chip/src/chip-group/chip-group.js | 60 +++++++++++++++++++- components/chip/src/chip/chip.js | 14 ++--- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index b2064314b7..6356e832a9 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -1,13 +1,66 @@ import { theme } from '@dhis2/ui-constants' import PropTypes from 'prop-types' -import React, { useRef } from 'react' +import React, { useRef, useEffect, useState } from 'react' const ChipGroup = ({ className, dataTest, children }) => { const chipContainer = useRef(null) + const [childrenToFocus, setChildrenToFocus] = useState([]) + + useEffect(() => { + if (chipContainer.current) { + const controlsDiv = chipContainer.current.querySelectorAll( + '[role="option"]' + ) + if (controlsDiv) { + const childElements = Array.from(controlsDiv) + childElements.forEach((child) => { + child.tabIndex = -1 + child.role = 'option' + }) + setChildrenToFocus(childElements) + } + } + }, [children]) const handleKeyDown = (event) => { const currentFocus = document.activeElement + if (chipContainer.current && chipContainer.current === currentFocus) { + if (childrenToFocus.length > 0 && childrenToFocus[0]) { + childrenToFocus[0].focus() + } + return + } + if (!childrenToFocus.length) { + return + } + + const currentIndex = childrenToFocus.findIndex( + (element) => element === currentFocus + ) + + if (currentIndex === -1) { + return + } + + if (event.key === 'ArrowRight') { + event.preventDefault() + const nextIndex = (currentIndex + 1) % childrenToFocus.length + childrenToFocus[nextIndex].focus() + } + + if (event.key === 'ArrowLeft') { + event.preventDefault() + const prevIndex = + (currentIndex - 1 + childrenToFocus.length) % + childrenToFocus.length + childrenToFocus[prevIndex].focus() + } + } + + /* const handleKeyDown = (event) => { + const currentFocus = document.activeElement + if (chipContainer.current && chipContainer.current === currentFocus) { const chips = Array.from( chipContainer.current.querySelectorAll('[role="option"]') @@ -44,7 +97,7 @@ const ChipGroup = ({ className, dataTest, children }) => { const nextIndex = (currentIndex + 1) % chips.length chips[nextIndex].focus() } - } + } */ return (
{ ref={chipContainer} tabIndex={0} > - {children} +
{children}
+ - + ) } @@ -163,4 +161,4 @@ Chip.propTypes = { onRemove: PropTypes.func, } -export { Chip } +export { Chip } \ No newline at end of file From 27b0671575b111e091d407147db87457a3b6fa0c Mon Sep 17 00:00:00 2001 From: Alaa Yahia Date: Tue, 16 Jul 2024 13:15:12 +0300 Subject: [PATCH 06/10] fix: avoid using refs --- components/chip/src/chip-group/chip-group.js | 44 -------------------- 1 file changed, 44 deletions(-) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index 6356e832a9..890c615c9f 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -13,10 +13,6 @@ const ChipGroup = ({ className, dataTest, children }) => { ) if (controlsDiv) { const childElements = Array.from(controlsDiv) - childElements.forEach((child) => { - child.tabIndex = -1 - child.role = 'option' - }) setChildrenToFocus(childElements) } } @@ -58,46 +54,6 @@ const ChipGroup = ({ className, dataTest, children }) => { } } - /* const handleKeyDown = (event) => { - const currentFocus = document.activeElement - - if (chipContainer.current && chipContainer.current === currentFocus) { - const chips = Array.from( - chipContainer.current.querySelectorAll('[role="option"]') - ) - if (chips.length > 0) { - chips[0].focus() - } - return - } - - const role = currentFocus.getAttribute('role') - - if (role !== 'option') { - return - } - - const chips = Array.from( - chipContainer.current.querySelectorAll('[role="option"]') - ) - - const currentIndex = chips.indexOf(currentFocus) - - if (event.key === 'ArrowRight') { - event.preventDefault() - const nextIndex = (currentIndex + 1) % chips.length - chips[nextIndex].focus() - } - if (event.key === 'ArrowLeft') { - event.preventDefault() - const prevIndex = (currentIndex - 1 + chips.length) % chips.length - chips[prevIndex].focus() - } - if (event.key === 'Backspace' || event.key === 'Delete') { - const nextIndex = (currentIndex + 1) % chips.length - chips[nextIndex].focus() - } - } */ return (
Date: Mon, 2 Sep 2024 21:08:18 +0300 Subject: [PATCH 07/10] feat: add accessibility improvements to chip --- collections/forms/i18n/en.pot | 4 +- components/chip/API.md | 18 ++++++++ components/chip/src/chip-group/chip-group.js | 45 ++++++++++++++------ 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/collections/forms/i18n/en.pot b/collections/forms/i18n/en.pot index e65ed246e0..b2c2ec5558 100644 --- a/collections/forms/i18n/en.pot +++ b/collections/forms/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2024-02-12T14:58:56.792Z\n" -"PO-Revision-Date: 2024-02-12T14:58:56.792Z\n" +"POT-Creation-Date: 2024-09-02T17:18:35.684Z\n" +"PO-Revision-Date: 2024-09-02T17:18:35.684Z\n" msgid "Upload file" msgstr "Upload file" diff --git a/components/chip/API.md b/components/chip/API.md index a0842b9609..460cfeea2b 100644 --- a/components/chip/API.md +++ b/components/chip/API.md @@ -1,3 +1,21 @@ +### ChipGroup + +#### Usage + +**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package. + +```js +import { ChipGroup } from '@dhis2-ui/chip' +``` + +#### Props + +|Name|Type|Default|Required|Description| +|---|---|---|---|---| +|children|node|||The Chip components to be rendered within the group| +|className|string|||Additional CSS class for the chip group| +|dataTest|string|`'dhis2-uicore-chipgroup'`||Data test id for testing purposes| + ### Chip #### Usage diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index 890c615c9f..9b6ee58b13 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -8,29 +8,23 @@ const ChipGroup = ({ className, dataTest, children }) => { useEffect(() => { if (chipContainer.current) { - const controlsDiv = chipContainer.current.querySelectorAll( + const chips = chipContainer.current.querySelectorAll( '[role="option"]' ) - if (controlsDiv) { - const childElements = Array.from(controlsDiv) - setChildrenToFocus(childElements) + if (chips.length > 0) { + const childrenToFocus = Array.from(chips) + setChildrenToFocus(childrenToFocus) } } }, [children]) const handleKeyDown = (event) => { - const currentFocus = document.activeElement - - if (chipContainer.current && chipContainer.current === currentFocus) { - if (childrenToFocus.length > 0 && childrenToFocus[0]) { - childrenToFocus[0].focus() - } - return - } if (!childrenToFocus.length) { return } + const currentFocus = document.activeElement + const currentIndex = childrenToFocus.findIndex( (element) => element === currentFocus ) @@ -52,6 +46,28 @@ const ChipGroup = ({ className, dataTest, children }) => { childrenToFocus.length childrenToFocus[prevIndex].focus() } + + if (event.key === 'Backspace' || event.key === 'Delete') { + event.preventDefault() + event.stopPropagation() + const nextIndex = (currentIndex + 1) % childrenToFocus.length + childrenToFocus[nextIndex].focus() + } + } + + const handleFocus = (event) => { + if (!childrenToFocus.length) { + return + } + if (event.target === chipContainer.current) { + const selectedChild = childrenToFocus.find( + (child) => child.getAttribute('aria-selected') === 'true' + ) + if (!selectedChild) { + childrenToFocus[0].focus() + } + selectedChild.focus() + } } return ( @@ -59,11 +75,12 @@ const ChipGroup = ({ className, dataTest, children }) => { className={className} data-test={dataTest} onKeyDown={handleKeyDown} + onFocus={handleFocus} ref={chipContainer} tabIndex={0} + role="listbox" > -
{children}
- + {children} - - ), -} - -export const Dense = () => I am dense -Dense.args = { dense: true, children: 'I am dense' } - -export const DenseRemoveable = Template.bind({}) -DenseRemoveable.args = { - ...Dense.args, - ...Removable.args, - children: 'Removable and dense', -} - -export const RTLRemovable = (args) => ( -
- RTL removable -
-) -RTLRemovable.args = { ...Removable.args } From e20053e688f64f2f226c86309eaef8f3df9e7b40 Mon Sep 17 00:00:00 2001 From: alaa-yahia Date: Mon, 2 Sep 2024 23:31:08 +0300 Subject: [PATCH 09/10] feat: pass compoenet a to chip --- components/chip/src/chip-group/chip-group.js | 2 +- components/chip/src/chip/chip.js | 119 +++++++++++-------- 2 files changed, 68 insertions(+), 53 deletions(-) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index 9b6ee58b13..7ae8b014e1 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -63,7 +63,7 @@ const ChipGroup = ({ className, dataTest, children }) => { const selectedChild = childrenToFocus.find( (child) => child.getAttribute('aria-selected') === 'true' ) - if (!selectedChild) { + if (!selectedChild && childrenToFocus[0]) { childrenToFocus[0].focus() } selectedChild.focus() diff --git a/components/chip/src/chip/chip.js b/components/chip/src/chip/chip.js index c3e9e818f1..b463c8de32 100644 --- a/components/chip/src/chip/chip.js +++ b/components/chip/src/chip/chip.js @@ -26,6 +26,9 @@ const Chip = ({ marginTop, marginInlineStart, marginInlineEnd, + component: Component, + href, + to, }) => { const handleKeyDown = (event) => { if (!onRemove) { @@ -35,32 +38,49 @@ const Chip = ({ onRemove({}, event) } } - return ( - { - if (!disabled && onClick) { - onClick({}, e) - } - }} - onKeyDown={handleKeyDown} - className={cx(className, { - selected, - dense, - disabled, - dragging, - })} - data-test={dataTest} - tabIndex={-1} - role="option" - aria-selected={selected ? 'true' : 'false'} - aria-disabled={disabled ? 'true' : 'false'} - > + + const chipProps = { + onClick: (e) => { + if (!disabled && onClick) { + onClick({}, e) + } + }, + onKeyDown: handleKeyDown, + className: cx('chip', className, { + selected, + dense, + disabled, + dragging, + }), + 'data-test': dataTest, + tabIndex: -1, + role: 'option', + 'aria-selected': selected ? 'true' : 'false', + 'aria-disabled': disabled ? 'true' : 'false', + } + + const content = ( + <> {children} + + ) + + const chipElement = + Component === 'a' ? ( + + {content} + + ) : ( + {content} + ) + return ( + <> + {chipElement} - - + ) } @@ -138,27 +156,24 @@ Chip.defaultProps = { Chip.propTypes = { children: PropTypes.any, className: PropTypes.string, + component: PropTypes.oneOf(['a', 'span']), dataTest: PropTypes.string, dense: PropTypes.bool, disabled: PropTypes.bool, dragging: PropTypes.bool, + href: PropTypes.string, icon: PropTypes.element, - /** `margin-bottom` value, applied in `px` */ marginBottom: PropTypes.number, - /** `margin-inline-end` value, applied in `px` */ marginInlineEnd: PropTypes.number, - /** `margin-inline-start` value, applied in `px` */ marginInlineStart: PropTypes.number, - /** `margin-inline-start` value, applied in `px` */ marginLeft: PropTypes.number, - /** `margin-inline-end` value, applied in `px` */ marginRight: PropTypes.number, - /** `margin-top` value, applied in `px` */ marginTop: PropTypes.number, overflow: PropTypes.bool, selected: PropTypes.bool, + to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), onClick: PropTypes.func, onRemove: PropTypes.func, } -export { Chip } \ No newline at end of file +export { Chip } From 6a11cced07d90b67b24f08193c3cf84a225d5467 Mon Sep 17 00:00:00 2001 From: alaa-yahia Date: Mon, 2 Sep 2024 23:43:32 +0300 Subject: [PATCH 10/10] fix: linter issues --- components/chip/src/chip-group/chip-group.js | 5 ++--- components/chip/src/chip/chip.js | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/chip/src/chip-group/chip-group.js b/components/chip/src/chip-group/chip-group.js index 7ae8b014e1..d8b62458f3 100644 --- a/components/chip/src/chip-group/chip-group.js +++ b/components/chip/src/chip-group/chip-group.js @@ -8,9 +8,8 @@ const ChipGroup = ({ className, dataTest, children }) => { useEffect(() => { if (chipContainer.current) { - const chips = chipContainer.current.querySelectorAll( - '[role="option"]' - ) + const chips = + chipContainer.current.querySelectorAll('[role="option"]') if (chips.length > 0) { const childrenToFocus = Array.from(chips) setChildrenToFocus(childrenToFocus) diff --git a/components/chip/src/chip/chip.js b/components/chip/src/chip/chip.js index b463c8de32..a8eaef83f9 100644 --- a/components/chip/src/chip/chip.js +++ b/components/chip/src/chip/chip.js @@ -137,8 +137,7 @@ const Chip = ({ } :global(.chip.dragging) { - box-shadow: - 0 3px 1px -2px rgba(0, 0, 0, 0.2), + box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12); }