From 45da9643fa1c6ef18e35ab951406eb41781e7718 Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 3 Oct 2022 11:10:08 +0200 Subject: [PATCH] fix(Accordion): support nested accordions --- .../uilib/components/accordion/Examples.js | 34 ++++ .../docs/uilib/components/accordion/demos.md | 7 +- .../__tests__/Accordion.screenshot.test.js | 9 + .../__snapshots__/Accordion.test.js.snap | 174 +++++++++--------- ...dion-in-nested-accordions-1-f81b0.snap.png | Bin 0 -> 14749 bytes .../accordion/stories/Accordion.stories.js | 44 ++++- .../accordion/style/_accordion.scss | 29 ++- .../style/themes/dnb-accordion-theme-ui.scss | 74 ++++---- 8 files changed, 235 insertions(+), 136 deletions(-) create mode 100644 packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/accordion-screenshot-test-js-accordion-closed-screenshot-have-to-match-accordion-in-nested-accordions-1-f81b0.snap.png diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/Examples.js b/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/Examples.js index 8e65204ee3b..81e72056c5c 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/Examples.js +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/Examples.js @@ -266,3 +266,37 @@ export const AccordionPlainVariant = () => { ) : null } + +export const AccordionNestedExample = () => { + return ( + + { + /* jsx */ ` + +

Content A

+ +

I'm nested 1

+
+

Content B

+ +

I'm nested 2

+
+
+` + } +
+ ) +} diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/demos.md b/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/demos.md index 1afacce64c4..7daa2be73ba 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/demos.md +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/accordion/demos.md @@ -8,7 +8,8 @@ AccordionLargeContentExample, AccordionCustomisationExample, AccordionContainerExample, AccordionGroupExample, -AccordionPlainVariant +AccordionNestedExample, +AccordionPlainVariant, } from 'Docs/uilib/components/accordion/Examples' ## Demos @@ -31,6 +32,10 @@ AccordionPlainVariant +### Nested Accordions + + + ### Accordion with a single container A single container is only used for wider screens (desktop). When the users' screen is narrower (mobile), it will change to a normal accordion. The change happens with CSS only, so it will not interrupt any React render. diff --git a/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.screenshot.test.js b/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.screenshot.test.js index 7e2768cecdb..c2c01181a0f 100644 --- a/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.screenshot.test.js +++ b/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.screenshot.test.js @@ -53,6 +53,15 @@ describe('Accordion closed screenshot', () => { }) expect(screenshot).toMatchImageSnapshot() }) + + it('have to match accordion in nested accordions', async () => { + const screenshot = await testPageScreenshot({ + style: { width: '20rem', height: '25rem' }, + selector: '[data-visual-test="accordion-nested"]', + simulateSelector: '[data-visual-test="accordion-nested"]', + }) + expect(screenshot).toMatchImageSnapshot() + }) }) describe('Accordion container screenshot', () => { diff --git a/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/Accordion.test.js.snap b/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/Accordion.test.js.snap index 3c981410802..b7bc2c5c2d3 100644 --- a/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/Accordion.test.js.snap +++ b/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/Accordion.test.js.snap @@ -179,15 +179,18 @@ exports[`Accordion scss have to match default theme snapshot 1`] = ` */ .dnb-accordion__header { border: none; } - .dnb-accordion__header__icon, .dnb-accordion__header__container { - color: var(--color-emerald-green); } - .dnb-accordion__header__description { - color: var(--color-black-55); } -.dnb-accordion--expanded .dnb-accordion__header__title { +> .dnb-accordion__header .dnb-accordion__header__icon, +> .dnb-accordion__header .dnb-accordion__header__container { + color: var(--color-emerald-green); } + +> .dnb-accordion__header .dnb-accordion__header__description { + color: var(--color-black-55); } + +.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header__title { font-weight: var(--font-weight-medium); } -.dnb-accordion__variant--outlined .dnb-accordion__header { +.dnb-accordion__variant--outlined > .dnb-accordion__header { color: var(--color-black-80); background-color: var(--color-white); --border-color: var(--color-black-8); @@ -196,139 +199,143 @@ exports[`Accordion scss have to match default theme snapshot 1`] = ` /* Safari fix - because \\"inset\\" works not fine with border-radius if the user zooms the page */ border-color: transparent; } @supports (-webkit-touch-callout: none) { - .dnb-accordion__variant--outlined .dnb-accordion__header { + .dnb-accordion__variant--outlined > .dnb-accordion__header { box-shadow: 0 0 0 0.0625rem var(--border-color); } } @media not all and (min-resolution: 0.001dpcm) { @supports (-webkit-appearance: none) and (stroke-color: transparent) and (not (-webkit-overflow-scrolling: touch)) { - .dnb-accordion__variant--outlined .dnb-accordion__header { + .dnb-accordion__variant--outlined > .dnb-accordion__header { box-shadow: 0 0 0 0.0625rem var(--border-color); } } } @media screen and (-ms-high-contrast: none) { - .dnb-accordion__variant--outlined .dnb-accordion__header { + .dnb-accordion__variant--outlined > .dnb-accordion__header { box-shadow: inset 0 0 0 1px var(--color-black-8); } } - .dnb-accordion__variant--outlined .dnb-accordion__header:focus[disabled], - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus[disabled] { + .dnb-accordion__variant--outlined > .dnb-accordion__header:focus[disabled], + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus[disabled] { cursor: not-allowed; } - .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { outline: none; } - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-white); } - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { --border-color: var(--color-emerald-green); box-shadow: inset 0 0 0 0.125rem var(--border-color); /* iOS fix - because \\"inset\\" works not fine with border-radius */ /* Safari fix - because \\"inset\\" works not fine with border-radius if the user zooms the page */ border-color: transparent; } @supports (-webkit-touch-callout: none) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { box-shadow: 0 0 0 0.125rem var(--border-color); } } @media not all and (min-resolution: 0.001dpcm) { @supports (-webkit-appearance: none) and (stroke-color: transparent) and (not (-webkit-overflow-scrolling: touch)) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { box-shadow: 0 0 0 0.125rem var(--border-color); } } } @media screen and (-ms-high-contrast: none) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:focus:not([disabled]) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]), html[data-whatinput='keyboard'] + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:focus:not([disabled]) { box-shadow: inset 0 0 0 0.125rem var(--color-emerald-green); } } - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:hover[disabled] { + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:hover[disabled] { cursor: not-allowed; } - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:hover:not([disabled]) { + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:hover:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-white); --border-color: var(--color-emerald-green); box-shadow: 0 0 0 0.125rem var(--border-color); border-color: transparent; } @media screen and (-ms-high-contrast: none) { - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:hover:not([disabled]) { + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:hover:not([disabled]) { box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } @media screen and (-ms-high-contrast: none) { - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:hover:not([disabled]) { + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:hover:not([disabled]) { opacity: 1; } } - .dnb-accordion__variant--outlined .dnb-accordion__header:active[disabled], - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:active[disabled] { + .dnb-accordion__variant--outlined > .dnb-accordion__header:active[disabled], + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:active[disabled] { cursor: not-allowed; } - .dnb-accordion__variant--outlined .dnb-accordion__header:active:not([disabled]), - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:active:not([disabled]) { + .dnb-accordion__variant--outlined > .dnb-accordion__header:active:not([disabled]), + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:active:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-pistachio); --border-color: var(--color-emerald-green); box-shadow: 0 0 0 0.0625rem var(--border-color); border-color: transparent; } @media screen and (-ms-high-contrast: none) { - .dnb-accordion__variant--outlined .dnb-accordion__header:active:not([disabled]), - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined .dnb-accordion__header:active:not([disabled]) { + .dnb-accordion__variant--outlined > .dnb-accordion__header:active:not([disabled]), + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined > .dnb-accordion__header:active:not([disabled]) { box-shadow: 0 0 0 0.0625rem var(--color-emerald-green); } } - .dnb-accordion__variant--outlined .dnb-accordion__header[disabled] { - background-color: var(--color-white); - --border-color: var(--color-sea-green-30); - box-shadow: 0 0 0 0.0625rem var(--border-color); - border-color: transparent; } - @media screen and (-ms-high-contrast: none) { - .dnb-accordion__variant--outlined .dnb-accordion__header[disabled] { - box-shadow: 0 0 0 0.0625rem var(--color-sea-green-30); } } - .dnb-accordion__variant--outlined .dnb-accordion__header[disabled] * { - color: var(--color-sea-green-30); } -.dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header { +.dnb-accordion__variant--outlined > .dnb-accordion__header .dnb-accordion__header[disabled] { + background-color: var(--color-white); + --border-color: var(--color-sea-green-30); + box-shadow: 0 0 0 0.0625rem var(--border-color); + border-color: transparent; } + @media screen and (-ms-high-contrast: none) { + .dnb-accordion__variant--outlined > .dnb-accordion__header .dnb-accordion__header[disabled] { + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-30); } } + .dnb-accordion__variant--outlined > .dnb-accordion__header .dnb-accordion__header[disabled] * { + color: var(--color-sea-green-30); } + +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header { color: var(--color-white); background-color: var(--color-sea-green); --border-color: transparent; box-shadow: 0 0 0 0.0625rem var(--border-color); border-color: transparent; } @media screen and (-ms-high-contrast: none) { - .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header { + .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header { box-shadow: 0 0 0 0.0625rem transparent; } } - .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header[disabled] { - background-color: var(--color-sea-green-30); } - .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header[disabled] * { - color: var(--color-white); } - html[data-whatinput='keyboard'] -.dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - background-color: var(--color-mint-green); } - html[data-whatinput='keyboard'] -.dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus * { - color: var(--color-emerald-green); } - .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - outline: none; } - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - --border-color: var(--color-emerald-green); - box-shadow: inset 0 0 0 0.125rem var(--border-color); - /* iOS fix - because \\"inset\\" works not fine with border-radius */ - /* Safari fix - because \\"inset\\" works not fine with border-radius if the user zooms the page */ - border-color: transparent; } - @supports (-webkit-touch-callout: none) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - box-shadow: 0 0 0 0.125rem var(--border-color); } } - @media not all and (min-resolution: 0.001dpcm) { - @supports (-webkit-appearance: none) and (stroke-color: transparent) and (not (-webkit-overflow-scrolling: touch)) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - box-shadow: 0 0 0 0.125rem var(--border-color); } } } - @media screen and (-ms-high-contrast: none) { - html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { - box-shadow: inset 0 0 0 0.125rem var(--color-emerald-green); } } -.dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header:not(:hover):not([disabled]) * { +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header[disabled] { + background-color: var(--color-sea-green-30); } + .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header[disabled] * { + color: var(--color-white); } + +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header html[data-whatinput='keyboard'] +.dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + background-color: var(--color-mint-green); } + .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header html[data-whatinput='keyboard'] +.dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus * { + color: var(--color-emerald-green); } + +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + outline: none; } + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + --border-color: var(--color-emerald-green); + box-shadow: inset 0 0 0 0.125rem var(--border-color); + /* iOS fix - because \\"inset\\" works not fine with border-radius */ + /* Safari fix - because \\"inset\\" works not fine with border-radius if the user zooms the page */ + border-color: transparent; } + @supports (-webkit-touch-callout: none) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + box-shadow: 0 0 0 0.125rem var(--border-color); } } + @media not all and (min-resolution: 0.001dpcm) { + @supports (-webkit-appearance: none) and (stroke-color: transparent) and (not (-webkit-overflow-scrolling: touch)) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + box-shadow: 0 0 0 0.125rem var(--border-color); } } } + @media screen and (-ms-high-contrast: none) { + html[data-whatinput='keyboard'] .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not([disabled]):not(:active):not(:hover):focus { + box-shadow: inset 0 0 0 0.125rem var(--color-emerald-green); } } + +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header:not(:hover):not([disabled]) * { color: var(--color-white); } -html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header.dnb-accordion--hover:not(:active):hover[disabled] { +html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header.dnb-accordion--hover:not(:active):hover[disabled] { cursor: not-allowed; } -html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header.dnb-accordion--hover:not(:active):hover:not([disabled]) { +html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header.dnb-accordion--hover:not(:active):hover:not([disabled]) { color: var(--color-white); background-color: var(--color-sea-green); --border-color: var(--color-sea-green); box-shadow: 0 0 0 0.0625rem var(--border-color); border-color: transparent; } @media screen and (-ms-high-contrast: none) { - html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header.dnb-accordion--hover:not(:active):hover:not([disabled]) { + html:not([data-whatintent='touch']) .dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header.dnb-accordion--hover:not(:active):hover:not([disabled]) { box-shadow: 0 0 0 0.0625rem var(--color-sea-green); } } -.dnb-accordion__variant--outlined.dnb-accordion--expanded .dnb-accordion__header.dnb-accordion--hover:not(:active) * { +.dnb-accordion__variant--outlined.dnb-accordion--expanded > .dnb-accordion__header.dnb-accordion--hover:not(:active) * { color: var(--color-white); } " `; @@ -538,15 +545,16 @@ exports[`Accordion scss have to match snapshot 1`] = ` margin-top: 0.25rem; } .dnb-accordion__header__description + .dnb-accordion__header__title { margin-top: 0.25rem; } - .dnb-accordion--expanded .dnb-accordion__header__icon { - transform: rotate(-180deg); } .dnb-accordion--no-animation .dnb-accordion__header__icon, html[data-visual-test] .dnb-accordion__header__icon { transition-duration: 1ms !important; } + .dnb-accordion--expanded > .dnb-accordion__header .dnb-accordion__header__icon { + transform: rotate(-180deg); } .dnb-accordion__content { display: flex; opacity: 1; visibility: visible; + width: 100%; will-change: height; transition: height 400ms var(--accordion-easing), opacity 600ms var(--accordion-easing); } .dnb-accordion__content--hidden { @@ -556,6 +564,7 @@ exports[`Accordion scss have to match snapshot 1`] = ` .dnb-accordion__content--is-animating { overflow: hidden; } .dnb-accordion__content__inner { + width: 100%; margin-top: 1rem; } .dnb-accordion__content__inner--remove-content { display: none; } @@ -567,13 +576,14 @@ exports[`Accordion scss have to match snapshot 1`] = ` @media screen and (min-width: 40em) { .dnb-accordion-group--single-container .dnb-accordion__header { width: 40%; } - .dnb-accordion-group--single-container .dnb-accordion__header__icon { - transform: rotate(-90deg); } .dnb-accordion-group--single-container .dnb-accordion__content { margin-left: 1rem; transition: opacity 1s var(--accordion-easing); } .dnb-accordion-group--single-container .dnb-accordion__content__inner { margin-top: 0; } } + @media screen and (min-width: 40em) { + .dnb-accordion-group--single-container .dnb-accordion > .dnb-accordion__header .dnb-accordion__header__icon { + transform: rotate(-90deg); } } .dnb-accordion--no-animation .dnb-accordion__content, html[data-visual-test] .dnb-accordion__content { transition-duration: 1ms !important; } diff --git a/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/accordion-screenshot-test-js-accordion-closed-screenshot-have-to-match-accordion-in-nested-accordions-1-f81b0.snap.png b/packages/dnb-eufemia/src/components/accordion/__tests__/__snapshots__/accordion-screenshot-test-js-accordion-closed-screenshot-have-to-match-accordion-in-nested-accordions-1-f81b0.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..5b6423d5464ce2e7cf33cf2de1931928473b0a67 GIT binary patch literal 14749 zcmd6uc{o@7yYH8Io-)soka^z~ie^;!4ue!uQpq_(Ci2_XX^f*>SnSCw=T1j7RU zFTux!?J!{?O)f{$3l_B}}zSQ_)> z3ZbMRXhAsH&pgDqro@4dl^k)E99M|q=~-e6c6NEXCMBg1q2R~}Y|H=d7e31(LV_Qb z+5Y+35FnB8GODFdw|9`Be>+|2lKtsS z#Dd`6B|KJ(@`QwM3=ak6{cD377trtKvfYkdM`XQb9{tmo4XtA4>}N9m`X|o6=Rmev z=r2%ZX`HpAqHEeNe4!gDX5DVFn5&be;p5a=8FL-N$YeGz!*y z{ye1MoZTM$#ByV5D*3`{%uO@1h5pj)1=qB$f=ic@f31?PIsHJ8og(Ar97VhlJyeGesgfcU&cl@Z0kaEGyku*)L(dtgY(aSkgTzvD~ zT4Qx2!7pOw$C)uP-h=J9_lDnD-nZd=&LYi?S7BXXI3n!9vtwgpbwdT$hKwF_n3OqA z&nQCBbFE!#aZ&Ks^|N+YQv4A)rUtXgATmUPj*5fhA=gp$(RyR!@uRNF`_@m&L^<;Z z4KTgG*cY=o{ZvA(d|qqJHi)80?ki@U@bFZbq~?u#nuO=3r^gYnMIpVs^3+s2IQ#o| zIt$xyOViq{vYhjnl@1sPpYIa?7sgA(UK$#If|3NY%Mz(&S)}Ps=Vq~s2MgxnmPg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t7vs;~TGC+BvKB+OL>d%Agnckf5W%s~eLfD5rHb8^^t z$_Uqhm8x7P7u=(Wd;M=LVRZ&wzXd#Re-wF82WwPd=z+D5532+M+P$;_Q0w6FHY%6@?a0mv}uNi%Cpf|3t3$tu}#3m?626nhA@K_RF zfQRh;7YjbHMZAz5>%6s~15NlGL;-Lf5s;dXK%NrQ31tk`wxBa>n9j2S@?`a2$6#V+ zM#Uub<7W7HU<`d4Xm<#JS_dgQI}4!$2c2w{Oz5=|Ey;D$BoL*WY^78UB zsc|O&F$ERz<0BHr42UC(W=w$XXosbQUtLhhY=UEpOG`6b5$SE^c{hrdE-6okMDz17 zohm6U%_|#@vqMKdWfOCTH@rHS!P^2$0-#l=v$DA|TG0x)<}qaO^h~VWBi+1@P#2@2 zIkCf5!sW}CQF(zbEI{IS4p+uN%Lm^%0s#oi8rX^II8e8NcVPnG#zbHQXgQc~VAL2W z14~OfuwKI=<7)v+OE5n7b69~&+Kxi~A6}D|(=B1ZCfj+7>q5XTvx$jS3?U!hzmG3o ziH?a;fgqIh_>B!y2e{MWvC$k5p@v1qVI+)~EMQE^ec^&UkS!sXpGrP?`S8(U&+Pnj zLGzf5jI#iywpPYyVQ(!QRxJ?JH-qc~d)qqOnJ_&w6DruShr0F+mv$iYAZp<6sLq5+ zI5$TG^CCXe8Y)I{CnZpqAh%#VQwq4+A3AddODlMvj6pk$jL`<*uLYhYDZkSc@>lqj z&&7d>fXIvz$ZpPeVV;8Ju3S)FW*eg9qryrP^Qv*asM@C`lX^&Dy&?<20l zmmp82Sweke~F1xPI#GPJAKNiH7CCq4Qp3Dy|U{yi% z0G#6H<(;{foEs@hM+|=rg>DJQh@xmJUCOIP8yl`5$`p%-MIT0{2>m { return <> } +export const NestedAccordion = () => { + return ( + + + +

Text A

+ +

I'm nested 1

+
+

Text B

+ +

I'm nested 2

+
+ + + + ) +} + export const AccordionSandbox = () => { return ( @@ -324,7 +364,7 @@ function AccordionWithContainer() { } function ChangingContent({ changeHeight, children }) { const [contentSize, changeContentSize] = React.useState(false) - React.useEffect(() => { + React.useLayoutEffect(() => { changeHeight.current.setContainerHeight() }, [changeHeight, contentSize]) return ( @@ -339,6 +379,8 @@ function ChangingContent({ changeHeight, children }) { Toggle content size + {String(contentSize)} + {contentSize ? children : null} ) diff --git a/packages/dnb-eufemia/src/components/accordion/style/_accordion.scss b/packages/dnb-eufemia/src/components/accordion/style/_accordion.scss index f5f78eacee7..6118a443046 100644 --- a/packages/dnb-eufemia/src/components/accordion/style/_accordion.scss +++ b/packages/dnb-eufemia/src/components/accordion/style/_accordion.scss @@ -26,6 +26,9 @@ cursor: pointer; outline: none; + border: var(--accordion-border-width) solid transparent; + border-radius: var(--accordion-border-radius); + &:focus { user-select: none; } @@ -40,11 +43,6 @@ pointer-events: none; } - border: var(--accordion-border-width) solid transparent; - border-radius: var(--accordion-border-radius); - - // background-color: var(--color-white); - &__wrapper { display: flex; flex-direction: column; @@ -116,12 +114,6 @@ } } - &--expanded &__header { - &__icon { - transform: rotate(-180deg); - } - } - &--no-animation &__header, html[data-visual-test] &__header { &__icon { @@ -129,10 +121,15 @@ } } + &--expanded > &__header &__header__icon { + transform: rotate(-180deg); + } + &__content { display: flex; opacity: 1; visibility: visible; + width: 100%; will-change: height; transition: height 400ms var(--accordion-easing), @@ -149,6 +146,7 @@ } &__inner { + width: 100%; margin-top: 1rem; &--remove-content { @@ -168,10 +166,6 @@ @media screen and (min-width: 40em) { &__header { width: 40%; // 40% / 60% - - &__icon { - transform: rotate(-90deg); - } } // Only to make sure we have a spacing. But would be typcally project spesific @@ -194,6 +188,11 @@ // } // } } + &-group--single-container & > &__header &__header__icon { + @media screen and (min-width: 40em) { + transform: rotate(-90deg); + } + } &--no-animation &__content, html[data-visual-test] &__content { transition-duration: 1ms !important; diff --git a/packages/dnb-eufemia/src/components/accordion/style/themes/dnb-accordion-theme-ui.scss b/packages/dnb-eufemia/src/components/accordion/style/themes/dnb-accordion-theme-ui.scss index 5cb83f742d2..04103eb73ec 100644 --- a/packages/dnb-eufemia/src/components/accordion/style/themes/dnb-accordion-theme-ui.scss +++ b/packages/dnb-eufemia/src/components/accordion/style/themes/dnb-accordion-theme-ui.scss @@ -9,28 +9,25 @@ .dnb-accordion { &__header { border: none; + } + > &__header &__header__icon, + > &__header &__header__container { + color: var(--color-emerald-green); + } - &__icon, - &__container { - color: var(--color-emerald-green); - } - - &__description { - color: var(--color-black-55); - } + > &__header &__header__description { + color: var(--color-black-55); } - &--expanded &__header { - &__title { - font-weight: var(--font-weight-medium); - } + &--expanded > &__header &__header__title { + font-weight: var(--font-weight-medium); } // &__variant--default { // } // Variant: outlined - &__variant--outlined &__header { + &__variant--outlined > &__header { color: var(--color-black-80); background-color: var(--color-white); @@ -44,49 +41,52 @@ @include fakeBorder(var(--color-emerald-green), 0.0625rem); } - - &[disabled] { - background-color: var(--color-white); - @include fakeBorder(var(--color-sea-green-30), 0.0625rem); - * { - color: var(--color-sea-green-30); - } + } + &__variant--outlined > &__header &__header[disabled] { + background-color: var(--color-white); + @include fakeBorder(var(--color-sea-green-30), 0.0625rem); + * { + color: var(--color-sea-green-30); } } - &__variant--outlined#{&}--expanded &__header { + &__variant--outlined#{&}--expanded > &__header { color: var(--color-white); background-color: var(--color-sea-green); @include fakeBorder(transparent); - - &[disabled] { - background-color: var(--color-sea-green-30); - * { - color: var(--color-white); - } + } + &__variant--outlined#{&}--expanded > &__header &__header[disabled] { + background-color: var(--color-sea-green-30); + * { + color: var(--color-white); } + } - // Additional focus handling + // Additional focus handling + &__variant--outlined#{&}--expanded + > &__header html[data-whatinput='keyboard'] - &:not([disabled]):not(:active):not(:hover):focus { - background-color: var(--color-mint-green); - * { - color: var(--color-emerald-green); - } - } - &:not([disabled]):not(:active):not(:hover):focus { - @include fakeFocus(null, var(--color-emerald-green), inset); + &__header:not([disabled]):not(:active):not(:hover):focus { + background-color: var(--color-mint-green); + * { + color: var(--color-emerald-green); } } + &__variant--outlined#{&}--expanded + > &__header + &__header:not([disabled]):not(:active):not(:hover):focus { + @include fakeFocus(null, var(--color-emerald-green), inset); + } &__variant--outlined#{&}--expanded + > &__header &__header:not(:hover):not([disabled]) { * { color: var(--color-white); } } // we have this hover variant, because of the default html focus/hover handling - &__variant--outlined#{&}--expanded &__header#{&}--hover:not(:active) { + &__variant--outlined#{&}--expanded > &__header#{&}--hover:not(:active) { @include hover { color: var(--color-white); background-color: var(--color-sea-green);