@dnb/eufemia 10.36.0 → 10.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cjs/components/accordion/Accordion.d.ts +12 -0
  3. package/cjs/components/accordion/Accordion.js +7 -0
  4. package/cjs/components/accordion/Accordion.js.map +1 -1
  5. package/cjs/components/accordion/AccordionDocs.d.ts +4 -0
  6. package/cjs/components/accordion/AccordionDocs.js +161 -0
  7. package/cjs/components/accordion/AccordionDocs.js.map +1 -0
  8. package/cjs/components/accordion/AccordionGroup.js +13 -3
  9. package/cjs/components/accordion/AccordionGroup.js.map +1 -1
  10. package/cjs/components/accordion/AccordionProviderContext.d.ts +2 -0
  11. package/cjs/components/accordion/AccordionProviderContext.js.map +1 -1
  12. package/cjs/components/autocomplete/Autocomplete.js +2 -2
  13. package/cjs/components/autocomplete/Autocomplete.js.map +1 -1
  14. package/cjs/components/step-indicator/StepIndicatorSidebar.js +1 -2
  15. package/cjs/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  16. package/cjs/extensions/forms/Value/Date/Date.d.ts +5 -1
  17. package/cjs/extensions/forms/Value/Date/Date.js +26 -3
  18. package/cjs/extensions/forms/Value/Date/Date.js.map +1 -1
  19. package/cjs/extensions/forms/Value/Date/DateDocs.d.ts +2 -0
  20. package/cjs/extensions/forms/Value/Date/DateDocs.js +20 -0
  21. package/cjs/extensions/forms/Value/Date/DateDocs.js.map +1 -0
  22. package/cjs/shared/Eufemia.d.ts +1 -1
  23. package/cjs/shared/Eufemia.js +2 -2
  24. package/cjs/shared/Eufemia.js.map +1 -1
  25. package/cjs/shared/component-helper.js +1 -1
  26. package/cjs/shared/component-helper.js.map +1 -1
  27. package/cjs/style/core/scopes.scss +1 -1
  28. package/cjs/style/dnb-ui-basis.css +1 -1
  29. package/cjs/style/dnb-ui-basis.min.css +1 -1
  30. package/cjs/style/dnb-ui-body.css +1 -1
  31. package/cjs/style/dnb-ui-body.min.css +1 -1
  32. package/cjs/style/dnb-ui-core.css +1 -1
  33. package/cjs/style/dnb-ui-core.min.css +1 -1
  34. package/components/accordion/Accordion.d.ts +12 -0
  35. package/components/accordion/Accordion.js +7 -0
  36. package/components/accordion/Accordion.js.map +1 -1
  37. package/components/accordion/AccordionDocs.d.ts +4 -0
  38. package/components/accordion/AccordionDocs.js +152 -0
  39. package/components/accordion/AccordionDocs.js.map +1 -0
  40. package/components/accordion/AccordionGroup.js +14 -4
  41. package/components/accordion/AccordionGroup.js.map +1 -1
  42. package/components/accordion/AccordionProviderContext.d.ts +2 -0
  43. package/components/accordion/AccordionProviderContext.js.map +1 -1
  44. package/components/autocomplete/Autocomplete.js +2 -2
  45. package/components/autocomplete/Autocomplete.js.map +1 -1
  46. package/components/step-indicator/StepIndicatorSidebar.js +1 -2
  47. package/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  48. package/es/components/accordion/Accordion.d.ts +12 -0
  49. package/es/components/accordion/Accordion.js +7 -0
  50. package/es/components/accordion/Accordion.js.map +1 -1
  51. package/es/components/accordion/AccordionDocs.d.ts +4 -0
  52. package/es/components/accordion/AccordionDocs.js +152 -0
  53. package/es/components/accordion/AccordionDocs.js.map +1 -0
  54. package/es/components/accordion/AccordionGroup.js +14 -4
  55. package/es/components/accordion/AccordionGroup.js.map +1 -1
  56. package/es/components/accordion/AccordionProviderContext.d.ts +2 -0
  57. package/es/components/accordion/AccordionProviderContext.js.map +1 -1
  58. package/es/components/autocomplete/Autocomplete.js +2 -2
  59. package/es/components/autocomplete/Autocomplete.js.map +1 -1
  60. package/es/components/step-indicator/StepIndicatorSidebar.js +1 -2
  61. package/es/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  62. package/es/extensions/forms/Value/Date/Date.d.ts +5 -1
  63. package/es/extensions/forms/Value/Date/Date.js +25 -3
  64. package/es/extensions/forms/Value/Date/Date.js.map +1 -1
  65. package/es/extensions/forms/Value/Date/DateDocs.d.ts +2 -0
  66. package/es/extensions/forms/Value/Date/DateDocs.js +13 -0
  67. package/es/extensions/forms/Value/Date/DateDocs.js.map +1 -0
  68. package/es/shared/Eufemia.d.ts +1 -1
  69. package/es/shared/Eufemia.js +2 -2
  70. package/es/shared/Eufemia.js.map +1 -1
  71. package/es/shared/component-helper.js +1 -1
  72. package/es/shared/component-helper.js.map +1 -1
  73. package/es/style/core/scopes.scss +1 -1
  74. package/es/style/dnb-ui-basis.css +1 -1
  75. package/es/style/dnb-ui-basis.min.css +1 -1
  76. package/es/style/dnb-ui-body.css +1 -1
  77. package/es/style/dnb-ui-body.min.css +1 -1
  78. package/es/style/dnb-ui-core.css +1 -1
  79. package/es/style/dnb-ui-core.min.css +1 -1
  80. package/esm/dnb-ui-basis.min.mjs +1 -1
  81. package/esm/dnb-ui-components.min.mjs +1 -1
  82. package/esm/dnb-ui-elements.min.mjs +1 -1
  83. package/esm/dnb-ui-extensions.min.mjs +3 -3
  84. package/esm/dnb-ui-lib.min.mjs +1 -1
  85. package/extensions/forms/Value/Date/Date.d.ts +5 -1
  86. package/extensions/forms/Value/Date/Date.js +25 -3
  87. package/extensions/forms/Value/Date/Date.js.map +1 -1
  88. package/extensions/forms/Value/Date/DateDocs.d.ts +2 -0
  89. package/extensions/forms/Value/Date/DateDocs.js +13 -0
  90. package/extensions/forms/Value/Date/DateDocs.js.map +1 -0
  91. package/package.json +1 -1
  92. package/shared/Eufemia.d.ts +1 -1
  93. package/shared/Eufemia.js +2 -2
  94. package/shared/Eufemia.js.map +1 -1
  95. package/shared/component-helper.js +1 -1
  96. package/shared/component-helper.js.map +1 -1
  97. package/style/core/scopes.scss +1 -1
  98. package/style/dnb-ui-basis.css +1 -1
  99. package/style/dnb-ui-basis.min.css +1 -1
  100. package/style/dnb-ui-body.css +1 -1
  101. package/style/dnb-ui-body.min.css +1 -1
  102. package/style/dnb-ui-core.css +1 -1
  103. package/style/dnb-ui-core.min.css +1 -1
  104. package/umd/dnb-ui-basis.min.js +1 -1
  105. package/umd/dnb-ui-components.min.js +1 -1
  106. package/umd/dnb-ui-elements.min.js +1 -1
  107. package/umd/dnb-ui-extensions.min.js +1 -1
  108. package/umd/dnb-ui-lib.min.js +1 -1
@@ -276,7 +276,7 @@ body,
276
276
  /* stylelint-disable-next-line */
277
277
  -webkit-text-size-adjust: 100%;
278
278
  word-break: break-word;
279
- --eufemia-version: "10.36.0";
279
+ --eufemia-version: "10.37.0";
280
280
  }
281
281
  body *,
282
282
  body ::before,
@@ -1 +1 @@
1
- @charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.36.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style fieldset,body fieldset{padding:.35rem .75rem .625rem}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:"‌"}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
1
+ @charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.37.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style fieldset,body fieldset{padding:.35rem .75rem .625rem}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:"‌"}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
@@ -225,6 +225,12 @@ declare namespace Accordion {
225
225
  on_state_update?: (...args: any[]) => any;
226
226
  } & {
227
227
  allow_close_all?: boolean;
228
+ /**
229
+ * ref handle to collapse all expanded accordions. Send in a ref and use `.current()` to collapse all accordions.
230
+ *
231
+ * Default: `undefined`
232
+ */
233
+ collapseAllHandleRef?: React.MutableRefObject<() => void>;
228
234
  expanded_id?: string;
229
235
  };
230
236
  var Provider: {
@@ -249,6 +255,12 @@ declare namespace Accordion {
249
255
  }
250
256
  export type GroupProps = AccordionProps & {
251
257
  allow_close_all?: boolean;
258
+ /**
259
+ * ref handle to collapse all expanded accordions. Send in a ref and use `.current()` to collapse all accordions.
260
+ *
261
+ * Default: `undefined`
262
+ */
263
+ collapseAllHandleRef?: React.MutableRefObject<() => void>;
252
264
  expanded_id?: string;
253
265
  };
254
266
  export default Accordion;
@@ -39,6 +39,7 @@ function Accordion(_ref) {
39
39
  });
40
40
  const [previousExpanded, setPreviousExpanded] = useState(props.expanded);
41
41
  const [expanded, setExpanded] = useState(getInitialExpandedState());
42
+ const hasAddedCallbackRef = useRef(false);
42
43
  if (props.expanded !== previousExpanded) {
43
44
  setExpanded(props.expanded !== undefined ? props.expanded : false);
44
45
  setPreviousExpanded(props.expanded);
@@ -83,6 +84,11 @@ function Accordion(_ref) {
83
84
  setExpanded(true);
84
85
  }
85
86
  }, [context.flush_remembered_state, context.expanded_id]);
87
+ if (context !== null && context !== void 0 && context.collapseAllHandleRef && !hasAddedCallbackRef.current) {
88
+ var _context$collapseAcco;
89
+ context === null || context === void 0 ? void 0 : (_context$collapseAcco = context.collapseAccordionCallbacks) === null || _context$collapseAcco === void 0 ? void 0 : _context$collapseAcco.current.push(() => changeOpened(false));
90
+ hasAddedCallbackRef.current = true;
91
+ }
86
92
  function getInitialExpandedState() {
87
93
  if (props.expanded_ssr || context !== null && context !== void 0 && context.expanded_ssr) {
88
94
  return typeof window === 'undefined';
@@ -138,6 +144,7 @@ function Accordion(_ref) {
138
144
  event
139
145
  });
140
146
  }
147
+ console.log('context', context);
141
148
  return React.createElement(Context.Consumer, null, globalContext => React.createElement(AccordionContext.Consumer, null, nestedContext => {
142
149
  let expandedState = expanded;
143
150
  const extendedProps = extendPropsWithContext(props, accordionDefaultProps, context, nestedContext, {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","names":["React","useContext","useState","useEffect","useRef","classnames","makeUniqueId","findElementInChildren","extendPropsWithContext","validateDOMAttributes","dispatchCustomElementEvent","createSpacingClasses","AccordionGroup","AccordionHeader","AccordionContent","AccordionContext","AccordionProviderContext","Context","AccordionStore","Store","rememberWarning","accordionDefaultProps","Accordion","_ref","variant","icon_size","restOfProps","_objectWithoutProperties","_excluded","props","_objectSpread","context","group","id","current","store","previousExpanded","setPreviousExpanded","expanded","setExpanded","getInitialExpandedState","undefined","thisInstance","_id","handleDisabledClick","callOnChange","callOnChangeHandler","close","setExpandedState","state","window","addInstance","onInit","_window","_window$__dnbAccordio","removeInstance","flush_remembered_state","flush","expanded_id","expanded_ssr","remember_state","storedExpanded","getState","changeOpened","saveState","e","preventDefault","_len","arguments","length","params","Array","_key","onChange","_window2","_window2$__dnbAccordi","event","createElement","Consumer","globalContext","nestedContext","expandedState","extendedProps","skeleton","translation","className","prerender","prevent_rerender","prevent_rerender_conditional","single_container","disabled","no_animation","_expanded_ssr","children","_group","title","description","left_component","icon","icon_position","on_change","on_state_update","contentRef","restOfExtendedProps","_excluded2","mainParams","onClick","extendedPropsForContext","accordionContext","Provider","value","cur","type","_AccordionHeader","defaultProps","Group","expandedId","setExpandedId","instanceIDs","storedData","getData","currentIDs","includes","fallbackId","instance","push","_extends","Header","Content","_supportsSpacingProps"],"sources":["../../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["/**\n * Web Accordion Component\n *\n */\n\nimport React, {\n useContext,\n useState,\n useEffect,\n useRef,\n HTMLProps,\n} from 'react'\n\nimport classnames from 'classnames'\nimport {\n makeUniqueId,\n findElementInChildren,\n extendPropsWithContext,\n validateDOMAttributes,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\n\nimport type { ButtonIconPosition } from '../Button'\nimport type { HeadingLevel } from '../Heading'\nimport type { IconIcon, IconSize } from '../Icon'\nimport type { SkeletonShow } from '../Skeleton'\nimport type { SpacingProps } from '../space/types'\n\nimport AccordionGroup from './AccordionGroup'\nimport AccordionHeader from './AccordionHeader'\nimport AccordionContent from './AccordionContent'\nimport AccordionContext from './AccordionContext'\nimport AccordionProviderContext from './AccordionProviderContext'\nimport Context from '../../shared/Context'\n\nimport { AccordionStore, Store, rememberWarning } from './AccordionStore'\nimport { accordionDefaultProps } from './defaultProps'\n\nexport type AccordionVariant = 'plain' | 'default' | 'outlined' | 'filled'\n\nexport type AccordionHeading = boolean | React.ReactNode\n\nexport type AccordionIcon =\n | IconIcon\n | {\n closed?: IconIcon\n /**\n * If set to `true` the accordion will be expanded as its initial state.\n */\n expanded?: IconIcon\n }\n\nexport type AccordionAttributes = string | Record<string, unknown>\n\nexport type AccordionIconPosition = ButtonIconPosition\n\nexport type AccordionProps = Omit<React.HTMLProps<HTMLElement>, 'ref'> &\n SpacingProps & {\n /**\n * A title as a string or React element. It will be used as the button text.\n */\n title?: React.ReactNode\n description?: React.ReactNode\n /**\n * If set to `true` the accordion will be expanded as its initial state.\n */\n expanded?: boolean\n /**\n * If set to `true`, the open and close animation will be omitted.\n */\n no_animation?: boolean\n /**\n * If set to `true` the accordion will be expanded during SSR. Can be potentially useful for SEO, although it will disturb client hydration, where React expects the same state. But that&#39;s mainly a technical aspect to consider.\n */\n expanded_ssr?: boolean\n /**\n */\n prerender?: boolean\n /**\n * If set to `true` the accordion component will not re-render its content – can be useful for widgets you don&#39;t have control of storing the temporary state during an interaction.\n */\n prevent_rerender?: boolean\n /**\n * Use this prop together with `prevent_rerender` – and if it is to `true`, the accordion component will re-render if the children are a new React element and does not match the previous one anymore.\n */\n prevent_rerender_conditional?: boolean\n /**\n * If set to `true`, it will remember a changed state initiated by the user. It requires a unique `id`. It will store the sate in the local storage.\n */\n remember_state?: boolean\n /**\n * Send along a custom React Ref for `.dnb-accordion__content`.\n */\n contentRef?: React.MutableRefObject<unknown>\n /**\n * If set to `true`, the saved (remembered) will be removed and the initial component state will be used and set.\n */\n flush_remembered_state?: boolean\n /**\n * If set to `true`, a group of accordions will be wrapped to sidebar looking menu for medium and larger screens.\n */\n single_container?: boolean\n /**\n * Defines the used styling. As of now, only `outlined` is available. Use `plain` for no styles. It defaults to `outlined`.\n */\n variant?: AccordionVariant\n /**\n * Will add a React element on the left side of the `title`, inside `AccordionHeaderContainer`.\n */\n left_component?: React.ReactNode\n /**\n * If set to `true`, the accordion button will be disabled (dimmed).\n */\n disabled?: boolean\n /**\n * If set to `true`, an overlaying skeleton with animation will be shown.\n */\n skeleton?: SkeletonShow\n /**\n * A unique `id` that will be used on the button element. If you use `remember_state`, an id is required.\n */\n id?: string\n group?: string\n /**\n * Gives you the option to replace the used `button` element. Provide a React element, including a string (HTML element). Defaults to a `div` with all the needed accessibility features included.\n */\n element?: React.ReactNode\n /**\n * If set to `true`, level 2 (h2) will be used. You can provide your own HTML heading (`h3`), or provide a `heading_level` property.\n */\n heading?: AccordionHeading\n /**\n * If `heading` is set to `true`, you can provide a numeric value to define a different heading level. Defaults to `2`.\n */\n heading_level?: HeadingLevel\n /**\n * Will replace the `chevron` icon. The icon will still rotate (by CSS). You can use an object to use two different icons, one for the closed state and one for the expanded state `{ closed, expanded }`.\n */\n icon?: AccordionIcon\n /**\n * Will set the placement of the icon. Defaults to `left`.\n */\n icon_position?: AccordionIconPosition\n /**\n * Define a different icon size. Defaults to `medium` (1.5rem).\n */\n icon_size?: IconSize\n attributes?: AccordionAttributes\n className?: string\n children?: React.ReactNode\n /**\n * Will be called by user click interaction. Returns an object with a boolean state `expanded` inside `{ expanded, id, event, ...event }`.\n */\n on_change?: (...args: any[]) => any\n on_state_update?: (...args: any[]) => any\n }\n\nfunction Accordion({\n variant = 'outlined',\n icon_size = 'medium',\n ...restOfProps\n}: AccordionProps) {\n const props = { variant, icon_size, ...restOfProps }\n\n const context = useContext(AccordionProviderContext)\n\n const group = props.group || context?.group\n const id = useRef(props.id || makeUniqueId()).current\n\n const store = new Store({ id: props.id, group })\n\n // States ordered last here to make sure that the getInitialExpandedState have access to the store\n const [previousExpanded, setPreviousExpanded] = useState(props.expanded)\n const [expanded, setExpanded] = useState<boolean>(\n getInitialExpandedState()\n )\n\n // replacement for getDerivedStateFromProps\n if (props.expanded !== previousExpanded) {\n setExpanded(props.expanded !== undefined ? props.expanded : false)\n setPreviousExpanded(props.expanded)\n }\n\n const thisInstance = {\n _id: id,\n context,\n handleDisabledClick,\n callOnChange,\n callOnChangeHandler,\n close,\n setExpandedState,\n state: { expanded, group },\n props,\n store,\n }\n\n // Constructor\n useEffect(() => {\n if (group && typeof window !== 'undefined') {\n window['__dnbAccordion'] = window['__dnbAccordion'] || {}\n window['__dnbAccordion'][group] =\n window['__dnbAccordion'][group] || new AccordionStore(group)\n\n window['__dnbAccordion'][group].addInstance(thisInstance)\n }\n\n if (context && typeof context?.onInit === 'function') {\n context.onInit(thisInstance)\n }\n\n return () => {\n if (group && typeof window !== 'undefined') {\n window?.['__dnbAccordion'][group]?.removeInstance(thisInstance)\n }\n }\n }, [])\n\n // componentDidUpdate\n useEffect(() => {\n if (context.flush_remembered_state) {\n store.flush()\n setExpanded(props.expanded)\n }\n\n if (context?.expanded_id && context.expanded_id === props.id) {\n setExpanded(true)\n }\n }, [context.flush_remembered_state, context.expanded_id])\n\n // Gets the initial expanded sate, to prevent the opening and closing of Accordion\n // That happens when if we put this logic in a useEffect that runs after the initial expanded state is set\n // Since useEffect runs after every render\n function getInitialExpandedState() {\n if (props.expanded_ssr || context?.expanded_ssr) {\n return typeof window === 'undefined'\n }\n\n if (props.remember_state || context.remember_state) {\n const storedExpanded = store.getState()\n\n if (props.expanded && storedExpanded === false) {\n return false\n }\n\n if (storedExpanded) {\n return true\n }\n }\n\n return props.expanded !== undefined\n ? props.expanded\n : context?.expanded !== undefined\n ? context.expanded\n : false\n }\n\n function setExpandedState(expanded: boolean) {\n setExpanded(expanded)\n }\n\n function close() {\n changeOpened(false)\n }\n\n function changeOpened(expanded: boolean) {\n setExpanded(expanded)\n\n // check if a event exists, because, then it's a user click\n if (props.remember_state || context.remember_state) {\n store.saveState(expanded)\n }\n }\n\n function handleDisabledClick(e: React.MouseEvent<HTMLElement>) {\n e.preventDefault()\n return false\n }\n\n function callOnChangeHandler(...params: any[]) {\n callOnChange(...params)\n if (context?.onChange) {\n context?.onChange(...params)\n }\n if (group && typeof window !== 'undefined') {\n window?.['__dnbAccordion'][group]?.onChange(...params)\n }\n }\n\n function callOnChange(...params: any[]) {\n const { expanded, event } = params[0]\n\n changeOpened(expanded)\n\n dispatchCustomElementEvent(thisInstance, 'on_change', {\n expanded,\n event,\n })\n }\n\n return (\n <Context.Consumer>\n {(globalContext) => (\n <AccordionContext.Consumer>\n {(nestedContext) => {\n // use only the props from context, who are available here anyway\n let expandedState = expanded\n\n const extendedProps = extendPropsWithContext(\n props,\n accordionDefaultProps,\n context, // group context\n nestedContext as Record<string, unknown>, // internal context\n { skeleton: globalContext?.skeleton },\n globalContext.Accordion, // global context\n globalContext.translation['Accordion']\n )\n\n if (expandedState === undefined && globalContext.Accordion) {\n if (globalContext.Accordion.expanded) {\n expandedState = extendedProps.expanded\n }\n }\n\n const {\n variant,\n className,\n prerender,\n prevent_rerender,\n prevent_rerender_conditional,\n single_container,\n remember_state,\n disabled,\n skeleton,\n no_animation,\n expanded_ssr: _expanded_ssr, // eslint-disable-line\n children,\n\n id: _id, // eslint-disable-line\n group: _group, // eslint-disable-line\n // expanded: _expanded, // eslint-disable-line\n\n title, // eslint-disable-line\n description, // eslint-disable-line\n left_component, // eslint-disable-line\n icon, // eslint-disable-line\n icon_position, // eslint-disable-line\n icon_size, // eslint-disable-line\n on_change, // eslint-disable-line\n on_state_update, // eslint-disable-line\n\n contentRef, // eslint-disable-line\n\n ...restOfExtendedProps\n } = extendedProps\n\n const mainParams = {\n id,\n className: classnames(\n 'dnb-accordion',\n expandedState && 'dnb-accordion--expanded',\n variant && `dnb-accordion__variant--${variant}`,\n prerender && 'dnb-accordion--prerender',\n createSpacingClasses(extendedProps),\n className\n ),\n } as HTMLProps<HTMLDivElement>\n\n if (disabled) {\n mainParams.onClick = handleDisabledClick\n }\n\n // to remove spacing props\n validateDOMAttributes(props, restOfExtendedProps)\n\n const extendedPropsForContext = extendPropsWithContext(\n props,\n accordionDefaultProps,\n { expanded, group },\n context\n )\n\n const accordionContext = {\n ...extendedPropsForContext,\n id,\n expanded: expandedState,\n prerender: prerender,\n prevent_rerender: prevent_rerender,\n prevent_rerender_conditional: prevent_rerender_conditional,\n single_container: single_container,\n remember_state: remember_state,\n disabled: disabled,\n skeleton: skeleton,\n no_animation: no_animation,\n callOnChange: callOnChangeHandler,\n }\n\n return (\n <AccordionContext.Provider value={accordionContext}>\n <div {...mainParams}>\n {findElementInChildren(\n children,\n (cur) => cur.type === AccordionHeader\n ) ? null : (\n <AccordionHeader />\n )}\n {findElementInChildren(\n children,\n (cur) => cur.type === AccordionContent\n ) ? (\n children\n ) : (\n <AccordionContent>{children}</AccordionContent>\n )}\n </div>\n </AccordionContext.Provider>\n )\n }}\n </AccordionContext.Consumer>\n )}\n </Context.Consumer>\n )\n}\n// TEMPORARY SOLUTION (defaultProps will be deprecated at one point). Needs to replacement with default prop parameters for example \"({expanded: null})\"\n// Only solved this way to prevent tests from failing, for when expanded is undefined instead of null\nAccordion.defaultProps = accordionDefaultProps\n\nexport type GroupProps = AccordionProps & {\n allow_close_all?: boolean\n expanded_id?: string\n}\n\nconst Group = (props: GroupProps) => {\n if (props.remember_state && !props.id) {\n rememberWarning('accordion group')\n }\n\n const [expandedId, setExpandedId] = useState<string | null>(null)\n\n const instanceIDs = useRef<string[]>([])\n\n const group = props?.id\n ? props.id\n : !props.group\n ? '#' + makeUniqueId()\n : undefined\n\n const store = new Store({ group })\n\n // Set stored expanded_id on mount\n useEffect(() => {\n const storedData = store.getData()\n const currentIDs = instanceIDs?.current\n\n if (!storedData?.id) {\n return\n }\n\n if (currentIDs.includes(storedData?.id)) {\n return\n }\n\n // 1. get the fallback id\n const fallbackId = currentIDs[0]\n\n if (!fallbackId) {\n return\n }\n\n // 2. set the fallback ids\n setExpandedId(fallbackId)\n }, [])\n\n // Store and reset fallback id\n useEffect(() => {\n if (!expandedId) {\n return\n }\n\n // 3. save the fallback id\n store.saveState(true, expandedId)\n\n // 4. and reset the fallback id\n setExpandedId(null)\n }, [expandedId])\n\n function onInit(instance) {\n if (\n instance.props.id &&\n !instanceIDs.current.includes(instance.props.id)\n ) {\n instanceIDs.current.push(instance.props.id)\n }\n }\n\n return (\n <AccordionGroup\n onInit={onInit}\n {...props}\n group={group}\n expanded_id={expandedId || props.expanded_id}\n />\n )\n}\n\nAccordion.Provider = AccordionGroup\nAccordion.Header = AccordionHeader\nAccordion.Content = AccordionContent\n\nAccordion.Group = Group\n\nGroup.Store = (group: string, id: string = null) => {\n return new Store({ group, id })\n}\n\nAccordion.Store = (id: string) => {\n return new Store({ id })\n}\n\nAccordion._supportsSpacingProps = true\n\nexport default Accordion\n"],"mappings":";;;;;;;;;;AAKA,OAAOA,KAAK,IACVC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,MAAM,QAED,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,YAAY,EACZC,qBAAqB,EACrBC,sBAAsB,EACtBC,qBAAqB,EACrBC,0BAA0B,QACrB,+BAA+B;AACtC,SAASC,oBAAoB,QAAQ,wBAAwB;AAQ7D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,wBAAwB,MAAM,4BAA4B;AACjE,OAAOC,OAAO,MAAM,sBAAsB;AAE1C,SAASC,cAAc,EAAEC,KAAK,EAAEC,eAAe,QAAQ,kBAAkB;AACzE,SAASC,qBAAqB,QAAQ,gBAAgB;AAyHtD,SAASC,SAASA,CAAAC,IAAA,EAIC;EAAA,IAJA;MACjBC,OAAO,GAAG,UAAU;MACpBC,SAAS,GAAG;IAEE,CAAC,GAAAF,IAAA;IADZG,WAAW,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEd,MAAMC,KAAK,GAAAC,aAAA;IAAKN,OAAO;IAAEC;EAAS,GAAKC,WAAW,CAAE;EAEpD,MAAMK,OAAO,GAAG9B,UAAU,CAACe,wBAAwB,CAAC;EAEpD,MAAMgB,KAAK,GAAGH,KAAK,CAACG,KAAK,KAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK;EAC3C,MAAMC,EAAE,GAAG7B,MAAM,CAACyB,KAAK,CAACI,EAAE,IAAI3B,YAAY,CAAC,CAAC,CAAC,CAAC4B,OAAO;EAErD,MAAMC,KAAK,GAAG,I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mC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAA3B,SAAA,GAAA2B,SAAA,MAAG,IAAI;EAC7C,OAAO,IAAIjD,KAAK,CAAC;IAAEa,KAAK;IAAEC;EAAG,CAAC,CAAC;AACjC,CAAC;AAEDX,SAAS,CAACH,KAAK,GAAIc,EAAU,IAAK;EAChC,OAAO,IAAId,KAAK,CAAC;IAAEc;EAAG,CAAC,CAAC;AAC1B,CAAC;AAEDX,SAAS,CAAC2G,qBAAqB,GAAG,IAAI;AAEtC,eAAe3G,SAAS"}
1
+ {"version":3,"file":"Accordion.js","names":["React","useContext","useState","useEffect","useRef","classnames","makeUniqueId","findElementInChildren","extendPropsWithContext","validateDOMAttributes","dispatchCustomElementEvent","createSpacingClasses","AccordionGroup","AccordionHeader","AccordionContent","AccordionContext","AccordionProviderContext","Context","AccordionStore","Store","rememberWarning","accordionDefaultProps","Accordion","_ref","variant","icon_size","restOfProps","_objectWithoutProperties","_excluded","props","_objectSpread","context","group","id","current","store","previousExpanded","setPreviousExpanded","expanded","setExpanded","getInitialExpandedState","hasAddedCallbackRef","undefined","thisInstance","_id","handleDisabledClick","callOnChange","callOnChangeHandler","close","setExpandedState","state","window","addInstance","onInit","_window","_window$__dnbAccordio","removeInstance","flush_remembered_state","flush","expanded_id","collapseAllHandleRef","_context$collapseAcco","collapseAccordionCallbacks","push","changeOpened","expanded_ssr","remember_state","storedExpanded","getState","saveState","e","preventDefault","_len","arguments","length","params","Array","_key","onChange","_window2","_window2$__dnbAccordi","event","console","log","createElement","Consumer","globalContext","nestedContext","expandedState","extendedProps","skeleton","translation","className","prerender","prevent_rerender","prevent_rerender_conditional","single_container","disabled","no_animation","_expanded_ssr","children","_group","title","description","left_component","icon","icon_position","on_change","on_state_update","contentRef","restOfExtendedProps","_excluded2","mainParams","onClick","extendedPropsForContext","accordionContext","Provider","value","cur","type","_AccordionHeader","defaultProps","Group","expandedId","setExpandedId","instanceIDs","storedData","getData","currentIDs","includes","fallbackId","instance","_extends","Header","Content","_supportsSpacingProps"],"sources":["../../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["/**\n * Web Accordion Component\n *\n */\n\nimport React, {\n useContext,\n useState,\n useEffect,\n useRef,\n HTMLProps,\n} from 'react'\n\nimport classnames from 'classnames'\nimport {\n makeUniqueId,\n findElementInChildren,\n extendPropsWithContext,\n validateDOMAttributes,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\n\nimport type { ButtonIconPosition } from '../Button'\nimport type { HeadingLevel } from '../Heading'\nimport type { IconIcon, IconSize } from '../Icon'\nimport type { SkeletonShow } from '../Skeleton'\nimport type { SpacingProps } from '../space/types'\n\nimport AccordionGroup from './AccordionGroup'\nimport AccordionHeader from './AccordionHeader'\nimport AccordionContent from './AccordionContent'\nimport AccordionContext from './AccordionContext'\nimport AccordionProviderContext from './AccordionProviderContext'\nimport Context from '../../shared/Context'\n\nimport { AccordionStore, Store, rememberWarning } from './AccordionStore'\nimport { accordionDefaultProps } from './defaultProps'\n\nexport type AccordionVariant = 'plain' | 'default' | 'outlined' | 'filled'\n\nexport type AccordionHeading = boolean | React.ReactNode\n\nexport type AccordionIcon =\n | IconIcon\n | {\n closed?: IconIcon\n /**\n * If set to `true` the accordion will be expanded as its initial state.\n */\n expanded?: IconIcon\n }\n\nexport type AccordionAttributes = string | Record<string, unknown>\n\nexport type AccordionIconPosition = ButtonIconPosition\n\nexport type AccordionProps = Omit<React.HTMLProps<HTMLElement>, 'ref'> &\n SpacingProps & {\n /**\n * A title as a string or React element. It will be used as the button text.\n */\n title?: React.ReactNode\n description?: React.ReactNode\n /**\n * If set to `true` the accordion will be expanded as its initial state.\n */\n expanded?: boolean\n /**\n * If set to `true`, the open and close animation will be omitted.\n */\n no_animation?: boolean\n /**\n * If set to `true` the accordion will be expanded during SSR. Can be potentially useful for SEO, although it will disturb client hydration, where React expects the same state. But that&#39;s mainly a technical aspect to consider.\n */\n expanded_ssr?: boolean\n /**\n */\n prerender?: boolean\n /**\n * If set to `true` the accordion component will not re-render its content – can be useful for widgets you don&#39;t have control of storing the temporary state during an interaction.\n */\n prevent_rerender?: boolean\n /**\n * Use this prop together with `prevent_rerender` – and if it is to `true`, the accordion component will re-render if the children are a new React element and does not match the previous one anymore.\n */\n prevent_rerender_conditional?: boolean\n /**\n * If set to `true`, it will remember a changed state initiated by the user. It requires a unique `id`. It will store the sate in the local storage.\n */\n remember_state?: boolean\n /**\n * Send along a custom React Ref for `.dnb-accordion__content`.\n */\n contentRef?: React.MutableRefObject<unknown>\n /**\n * If set to `true`, the saved (remembered) will be removed and the initial component state will be used and set.\n */\n flush_remembered_state?: boolean\n /**\n * If set to `true`, a group of accordions will be wrapped to sidebar looking menu for medium and larger screens.\n */\n single_container?: boolean\n /**\n * Defines the used styling. As of now, only `outlined` is available. Use `plain` for no styles. It defaults to `outlined`.\n */\n variant?: AccordionVariant\n /**\n * Will add a React element on the left side of the `title`, inside `AccordionHeaderContainer`.\n */\n left_component?: React.ReactNode\n /**\n * If set to `true`, the accordion button will be disabled (dimmed).\n */\n disabled?: boolean\n /**\n * If set to `true`, an overlaying skeleton with animation will be shown.\n */\n skeleton?: SkeletonShow\n /**\n * A unique `id` that will be used on the button element. If you use `remember_state`, an id is required.\n */\n id?: string\n group?: string\n /**\n * Gives you the option to replace the used `button` element. Provide a React element, including a string (HTML element). Defaults to a `div` with all the needed accessibility features included.\n */\n element?: React.ReactNode\n /**\n * If set to `true`, level 2 (h2) will be used. You can provide your own HTML heading (`h3`), or provide a `heading_level` property.\n */\n heading?: AccordionHeading\n /**\n * If `heading` is set to `true`, you can provide a numeric value to define a different heading level. Defaults to `2`.\n */\n heading_level?: HeadingLevel\n /**\n * Will replace the `chevron` icon. The icon will still rotate (by CSS). You can use an object to use two different icons, one for the closed state and one for the expanded state `{ closed, expanded }`.\n */\n icon?: AccordionIcon\n /**\n * Will set the placement of the icon. Defaults to `left`.\n */\n icon_position?: AccordionIconPosition\n /**\n * Define a different icon size. Defaults to `medium` (1.5rem).\n */\n icon_size?: IconSize\n attributes?: AccordionAttributes\n className?: string\n children?: React.ReactNode\n /**\n * Will be called by user click interaction. Returns an object with a boolean state `expanded` inside `{ expanded, id, event, ...event }`.\n */\n on_change?: (...args: any[]) => any\n on_state_update?: (...args: any[]) => any\n }\n\nfunction Accordion({\n variant = 'outlined',\n icon_size = 'medium',\n ...restOfProps\n}: AccordionProps) {\n const props = { variant, icon_size, ...restOfProps }\n\n const context = useContext(AccordionProviderContext)\n\n const group = props.group || context?.group\n const id = useRef(props.id || makeUniqueId()).current\n\n const store = new Store({ id: props.id, group })\n\n // States ordered last here to make sure that the getInitialExpandedState have access to the store\n const [previousExpanded, setPreviousExpanded] = useState(props.expanded)\n const [expanded, setExpanded] = useState<boolean>(\n getInitialExpandedState()\n )\n const hasAddedCallbackRef = useRef<boolean>(false)\n\n // replacement for getDerivedStateFromProps\n if (props.expanded !== previousExpanded) {\n setExpanded(props.expanded !== undefined ? props.expanded : false)\n setPreviousExpanded(props.expanded)\n }\n\n const thisInstance = {\n _id: id,\n context,\n handleDisabledClick,\n callOnChange,\n callOnChangeHandler,\n close,\n setExpandedState,\n state: { expanded, group },\n props,\n store,\n }\n\n // Constructor\n useEffect(() => {\n if (group && typeof window !== 'undefined') {\n window['__dnbAccordion'] = window['__dnbAccordion'] || {}\n window['__dnbAccordion'][group] =\n window['__dnbAccordion'][group] || new AccordionStore(group)\n\n window['__dnbAccordion'][group].addInstance(thisInstance)\n }\n\n if (context && typeof context?.onInit === 'function') {\n context.onInit(thisInstance)\n }\n\n return () => {\n if (group && typeof window !== 'undefined') {\n window?.['__dnbAccordion'][group]?.removeInstance(thisInstance)\n }\n }\n }, [])\n\n // componentDidUpdate\n useEffect(() => {\n if (context.flush_remembered_state) {\n store.flush()\n setExpanded(props.expanded)\n }\n\n if (context?.expanded_id && context.expanded_id === props.id) {\n setExpanded(true)\n }\n }, [context.flush_remembered_state, context.expanded_id])\n\n // Add callback for closing all accordions inside a group if collapseAllHandleRef is defined\n if (context?.collapseAllHandleRef && !hasAddedCallbackRef.current) {\n context?.collapseAccordionCallbacks?.current.push(() =>\n changeOpened(false)\n )\n hasAddedCallbackRef.current = true\n }\n\n // Gets the initial expanded sate, to prevent the opening and closing of Accordion\n // That happens when if we put this logic in a useEffect that runs after the initial expanded state is set\n // Since useEffect runs after every render\n function getInitialExpandedState() {\n if (props.expanded_ssr || context?.expanded_ssr) {\n return typeof window === 'undefined'\n }\n\n if (props.remember_state || context.remember_state) {\n const storedExpanded = store.getState()\n\n if (props.expanded && storedExpanded === false) {\n return false\n }\n\n if (storedExpanded) {\n return true\n }\n }\n\n return props.expanded !== undefined\n ? props.expanded\n : context?.expanded !== undefined\n ? context.expanded\n : false\n }\n\n function setExpandedState(expanded: boolean) {\n setExpanded(expanded)\n }\n\n function close() {\n changeOpened(false)\n }\n\n function changeOpened(expanded: boolean) {\n setExpanded(expanded)\n\n // check if a event exists, because, then it's a user click\n if (props.remember_state || context.remember_state) {\n store.saveState(expanded)\n }\n }\n\n function handleDisabledClick(e: React.MouseEvent<HTMLElement>) {\n e.preventDefault()\n return false\n }\n\n function callOnChangeHandler(...params: any[]) {\n callOnChange(...params)\n if (context?.onChange) {\n context?.onChange(...params)\n }\n if (group && typeof window !== 'undefined') {\n window?.['__dnbAccordion'][group]?.onChange(...params)\n }\n }\n\n function callOnChange(...params: any[]) {\n const { expanded, event } = params[0]\n\n changeOpened(expanded)\n\n dispatchCustomElementEvent(thisInstance, 'on_change', {\n expanded,\n event,\n })\n }\n console.log('context', context)\n return (\n <Context.Consumer>\n {(globalContext) => (\n <AccordionContext.Consumer>\n {(nestedContext) => {\n // use only the props from context, who are available here anyway\n let expandedState = expanded\n\n const extendedProps = extendPropsWithContext(\n props,\n accordionDefaultProps,\n context, // group context\n nestedContext as Record<string, unknown>, // internal context\n { skeleton: globalContext?.skeleton },\n globalContext.Accordion, // global context\n globalContext.translation['Accordion']\n )\n\n if (expandedState === undefined && globalContext.Accordion) {\n if (globalContext.Accordion.expanded) {\n expandedState = extendedProps.expanded\n }\n }\n\n const {\n variant,\n className,\n prerender,\n prevent_rerender,\n prevent_rerender_conditional,\n single_container,\n remember_state,\n disabled,\n skeleton,\n no_animation,\n expanded_ssr: _expanded_ssr, // eslint-disable-line\n children,\n\n id: _id, // eslint-disable-line\n group: _group, // eslint-disable-line\n // expanded: _expanded, // eslint-disable-line\n\n title, // eslint-disable-line\n description, // eslint-disable-line\n left_component, // eslint-disable-line\n icon, // eslint-disable-line\n icon_position, // eslint-disable-line\n icon_size, // eslint-disable-line\n on_change, // eslint-disable-line\n on_state_update, // eslint-disable-line\n\n contentRef, // eslint-disable-line\n\n ...restOfExtendedProps\n } = extendedProps\n\n const mainParams = {\n id,\n className: classnames(\n 'dnb-accordion',\n expandedState && 'dnb-accordion--expanded',\n variant && `dnb-accordion__variant--${variant}`,\n prerender && 'dnb-accordion--prerender',\n createSpacingClasses(extendedProps),\n className\n ),\n } as HTMLProps<HTMLDivElement>\n\n if (disabled) {\n mainParams.onClick = handleDisabledClick\n }\n\n // to remove spacing props\n validateDOMAttributes(props, restOfExtendedProps)\n\n const extendedPropsForContext = extendPropsWithContext(\n props,\n accordionDefaultProps,\n { expanded, group },\n context\n )\n\n const accordionContext = {\n ...extendedPropsForContext,\n id,\n expanded: expandedState,\n prerender: prerender,\n prevent_rerender: prevent_rerender,\n prevent_rerender_conditional: prevent_rerender_conditional,\n single_container: single_container,\n remember_state: remember_state,\n disabled: disabled,\n skeleton: skeleton,\n no_animation: no_animation,\n callOnChange: callOnChangeHandler,\n }\n\n return (\n <AccordionContext.Provider value={accordionContext}>\n <div {...mainParams}>\n {findElementInChildren(\n children,\n (cur) => cur.type === AccordionHeader\n ) ? null : (\n <AccordionHeader />\n )}\n {findElementInChildren(\n children,\n (cur) => cur.type === AccordionContent\n ) ? (\n children\n ) : (\n <AccordionContent>{children}</AccordionContent>\n )}\n </div>\n </AccordionContext.Provider>\n )\n }}\n </AccordionContext.Consumer>\n )}\n </Context.Consumer>\n )\n}\n// TEMPORARY SOLUTION (defaultProps will be deprecated at one point). Needs to replacement with default prop parameters for example \"({expanded: null})\"\n// Only solved this way to prevent tests from failing, for when expanded is undefined instead of null\nAccordion.defaultProps = accordionDefaultProps\n\nexport type GroupProps = AccordionProps & {\n allow_close_all?: boolean\n /**\n * ref handle to collapse all expanded accordions. Send in a ref and use `.current()` to collapse all accordions.\n *\n * Default: `undefined`\n */\n collapseAllHandleRef?: React.MutableRefObject<() => void>\n expanded_id?: string\n}\n\nconst Group = (props: GroupProps) => {\n if (props.remember_state && !props.id) {\n rememberWarning('accordion group')\n }\n\n const [expandedId, setExpandedId] = useState<string | null>(null)\n\n const instanceIDs = useRef<string[]>([])\n\n const group = props?.id\n ? props.id\n : !props.group\n ? '#' + makeUniqueId()\n : undefined\n\n const store = new Store({ group })\n\n // Set stored expanded_id on mount\n useEffect(() => {\n const storedData = store.getData()\n const currentIDs = instanceIDs?.current\n\n if (!storedData?.id) {\n return\n }\n\n if (currentIDs.includes(storedData?.id)) {\n return\n }\n\n // 1. get the fallback id\n const fallbackId = currentIDs[0]\n\n if (!fallbackId) {\n return\n }\n\n // 2. set the fallback ids\n setExpandedId(fallbackId)\n }, [])\n\n // Store and reset fallback id\n useEffect(() => {\n if (!expandedId) {\n return\n }\n\n // 3. save the fallback id\n store.saveState(true, expandedId)\n\n // 4. and reset the fallback id\n setExpandedId(null)\n }, [expandedId])\n\n function onInit(instance) {\n if (\n instance.props.id &&\n !instanceIDs.current.includes(instance.props.id)\n ) {\n instanceIDs.current.push(instance.props.id)\n }\n }\n\n return (\n <AccordionGroup\n onInit={onInit}\n {...props}\n group={group}\n expanded_id={expandedId || props.expanded_id}\n />\n )\n}\n\nAccordion.Provider = AccordionGroup\nAccordion.Header = AccordionHeader\nAccordion.Content = AccordionContent\n\nAccordion.Group = Group\n\nGroup.Store = (group: string, id: string = null) => {\n return new Store({ group, id })\n}\n\nAccordion.Store = (id: string) => {\n return new Store({ id })\n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EAAO,GACXxB,KAAK;IACTG,KAAK,EAAEA,KAAM;IACb2B,WAAW,EAAEgE,UAAU,IAAI9F,KAAK,CAAC8B;EAAY,EAC9C,CAAC;AAEN,CAAC;AAEDrC,SAAS,CAAC8F,QAAQ,GAAGxG,cAAc;AACnCU,SAAS,CAAC+G,MAAM,GAAGxH,eAAe;AAClCS,SAAS,CAACgH,OAAO,GAAGxH,gBAAgB;AAEpCQ,SAAS,CAACoG,KAAK,GAAGA,KAAK;AAEvBA,KAAK,CAACvG,KAAK,GAAG,UAACa,KAAa,EAAwB;EAAA,IAAtBC,EAAU,GAAAwC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAA/B,SAAA,GAAA+B,SAAA,MAAG,IAAI;EAC7C,OAAO,IAAItD,KAAK,CAAC;IAAEa,KAAK;IAAEC;EAAG,CAAC,CAAC;AACjC,CAAC;AAEDX,SAAS,CAACH,KAAK,GAAIc,EAAU,IAAK;EAChC,OAAO,IAAId,KAAK,CAAC;IAAEc;EAAG,CAAC,CAAC;AAC1B,CAAC;AAEDX,SAAS,CAACiH,qBAAqB,GAAG,IAAI;AAEtC,eAAejH,SAAS"}
@@ -0,0 +1,4 @@
1
+ import { PropertiesTableProps } from '../../shared/types';
2
+ export declare const AccordionProperties: PropertiesTableProps;
3
+ export declare const AccordionProviderGroupProperties: PropertiesTableProps;
4
+ export declare const AccordionEvents: PropertiesTableProps;
@@ -0,0 +1,152 @@
1
+ export const AccordionProperties = {
2
+ id: {
3
+ doc: 'A unique `id` that will be used on the button element. If you use `remember_state`, an id is required.',
4
+ type: 'string',
5
+ status: 'optional'
6
+ },
7
+ title: {
8
+ doc: 'A title as a string or React element. It will be used as the button text.',
9
+ type: 'string',
10
+ status: 'optional'
11
+ },
12
+ expanded: {
13
+ doc: 'If set to `true` the accordion will be expanded as its initial state.',
14
+ type: 'boolean',
15
+ status: 'optional'
16
+ },
17
+ expanded_ssr: {
18
+ doc: "If set to `true` the accordion will be expanded during SSR. Can be potentially useful for SEO, although it will disturb client hydration, where React expects the same state. But that's mainly a technical aspect to consider.",
19
+ type: 'boolean',
20
+ status: 'optional'
21
+ },
22
+ remember_state: {
23
+ doc: 'If set to `true`, it will remember a changed state initiated by the user. It requires a unique `id`. It will store the state in the local storage.',
24
+ type: 'boolean',
25
+ status: 'optional'
26
+ },
27
+ flush_remembered_state: {
28
+ doc: 'If set to `true`, the saved (remembered) state will be removed and the initial component state will be used and set.',
29
+ type: 'boolean',
30
+ status: 'optional'
31
+ },
32
+ no_animation: {
33
+ doc: 'If set to `true`, the open and close animation will be omitted.',
34
+ type: 'boolean',
35
+ status: 'optional'
36
+ },
37
+ variant: {
38
+ doc: 'Defines the used styling. `Outlined`, `filled`, or `plain` (no styling). Defaults to `outlined`.',
39
+ type: ['outlined', 'filled', 'plain'],
40
+ status: 'optional'
41
+ },
42
+ icon: {
43
+ doc: 'Will replace the `chevron` icon. The icon will still rotate (by CSS). You can use an object to use two different icons, one for the closed state and one for the expanded state `{ closed, expanded }`.',
44
+ type: 'React.ReactNode',
45
+ status: 'optional'
46
+ },
47
+ icon_position: {
48
+ doc: 'Will set the placement of the icon. Defaults to `left`.',
49
+ type: 'string',
50
+ status: 'optional'
51
+ },
52
+ icon_size: {
53
+ doc: 'Define a different icon size. Defaults to `medium` (1.5rem).',
54
+ type: 'string',
55
+ status: 'optional'
56
+ },
57
+ left_component: {
58
+ doc: 'Will add a React element on the left side of the `title`, inside `AccordionHeaderContainer`.',
59
+ type: 'React.ReactNode',
60
+ status: 'optional'
61
+ },
62
+ prerender: {
63
+ doc: 'If set to `true` the content will be present, even the accordion is not expanded. Can be useful for assistive technology or SEO.',
64
+ type: 'boolean',
65
+ status: 'optional'
66
+ },
67
+ prevent_rerender: {
68
+ doc: "If set to `true` the accordion component will not re-render its content – can be useful for widgets you don't have control of storing the temporary state during an interaction.",
69
+ type: 'boolean',
70
+ status: 'optional'
71
+ },
72
+ prevent_rerender_conditional: {
73
+ doc: 'Use this prop together with `prevent_rerender` – and if it is set to `true`, the accordion component will re-render if the children are a new React element and do not match the previous one anymore.',
74
+ type: 'boolean',
75
+ status: 'optional'
76
+ },
77
+ single_container: {
78
+ doc: 'If set to `true`, a group of accordions will be wrapped to a sidebar looking menu for medium and larger screens.',
79
+ type: 'boolean',
80
+ status: 'optional'
81
+ },
82
+ element: {
83
+ doc: 'Gives you the option to replace the used `button` element. Provide a React element, including a string (HTML element). Defaults to a `div` with all the needed accessibility features included.',
84
+ type: 'React.ReactNode',
85
+ status: 'optional'
86
+ },
87
+ heading: {
88
+ doc: 'If set to `true`, level 2 (h2) will be used. You can provide your own HTML heading (`h3`), or provide a `heading_level` property.',
89
+ type: 'boolean',
90
+ status: 'optional'
91
+ },
92
+ heading_level: {
93
+ doc: 'If `heading` is set to `true`, you can provide a numeric value to define a different heading level. Defaults to `2`.',
94
+ type: 'boolean',
95
+ status: 'optional'
96
+ },
97
+ disabled: {
98
+ doc: 'If set to `true`, the accordion button will be disabled (dimmed).',
99
+ type: 'boolean',
100
+ status: 'optional'
101
+ },
102
+ skeleton: {
103
+ doc: 'If set to `true`, an overlaying skeleton with animation will be shown.',
104
+ type: 'boolean',
105
+ status: 'optional'
106
+ },
107
+ contentRef: {
108
+ doc: 'Send along a custom React Ref for `.dnb-accordion__content`.',
109
+ type: 'function',
110
+ status: 'optional'
111
+ },
112
+ collapseAllHandleRef: {
113
+ doc: 'Ref handle to collapse all expanded accordions. Send in a ref and use `.current()` to collapse all accordions. Default: `undefined`.',
114
+ type: 'React.MutableRefObject<() => void>',
115
+ status: 'optional'
116
+ },
117
+ space: {
118
+ doc: 'Spacing properties like `top` or `bottom` are supported.',
119
+ type: ['string', 'object'],
120
+ status: 'optional'
121
+ }
122
+ };
123
+ export const AccordionProviderGroupProperties = {
124
+ group: {
125
+ doc: "Define a unique id, it will be used to 'group' several accordions into one.",
126
+ type: 'string',
127
+ status: 'optional'
128
+ },
129
+ allow_close_all: {
130
+ doc: 'If set to `true`, the group of accordions will allow all to close.',
131
+ type: 'boolean',
132
+ status: 'optional'
133
+ },
134
+ expanded_id: {
135
+ doc: 'Define an `id` of a nested accordion that will get expanded.',
136
+ type: 'string',
137
+ status: 'optional'
138
+ },
139
+ space: {
140
+ doc: 'Spacing properties like `top` or `bottom` are supported.',
141
+ type: ['string', 'object'],
142
+ status: 'optional'
143
+ }
144
+ };
145
+ export const AccordionEvents = {
146
+ on_change: {
147
+ doc: 'Will be called by user click interaction. Returns an object with a boolean state `expanded` inside `{ expanded, id, event, ...event }`.',
148
+ type: 'function',
149
+ status: 'optional'
150
+ }
151
+ };
152
+ //# sourceMappingURL=AccordionDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionDocs.js","names":["AccordionProperties","id","doc","type","status","title","expanded","expanded_ssr","remember_state","flush_remembered_state","no_animation","variant","icon","icon_position","icon_size","left_component","prerender","prevent_rerender","prevent_rerender_conditional","single_container","element","heading","heading_level","disabled","skeleton","contentRef","collapseAllHandleRef","space","AccordionProviderGroupProperties","group","allow_close_all","expanded_id","AccordionEvents","on_change"],"sources":["../../../../src/components/accordion/AccordionDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const AccordionProperties: PropertiesTableProps = {\n id: {\n doc: 'A unique `id` that will be used on the button element. If you use `remember_state`, an id is required.',\n type: 'string',\n status: 'optional',\n },\n title: {\n doc: 'A title as a string or React element. It will be used as the button text.',\n type: 'string',\n status: 'optional',\n },\n expanded: {\n doc: 'If set to `true` the accordion will be expanded as its initial state.',\n type: 'boolean',\n status: 'optional',\n },\n expanded_ssr: {\n doc: \"If set to `true` the accordion will be expanded during SSR. Can be potentially useful for SEO, although it will disturb client hydration, where React expects the same state. But that's mainly a technical aspect to consider.\",\n type: 'boolean',\n status: 'optional',\n },\n remember_state: {\n doc: 'If set to `true`, it will remember a changed state initiated by the user. It requires a unique `id`. It will store the state in the local storage.',\n type: 'boolean',\n status: 'optional',\n },\n flush_remembered_state: {\n doc: 'If set to `true`, the saved (remembered) state will be removed and the initial component state will be used and set.',\n type: 'boolean',\n status: 'optional',\n },\n no_animation: {\n doc: 'If set to `true`, the open and close animation will be omitted.',\n type: 'boolean',\n status: 'optional',\n },\n variant: {\n doc: 'Defines the used styling. `Outlined`, `filled`, or `plain` (no styling). Defaults to `outlined`.',\n type: ['outlined', 'filled', 'plain'],\n status: 'optional',\n },\n icon: {\n doc: 'Will replace the `chevron` icon. The icon will still rotate (by CSS). You can use an object to use two different icons, one for the closed state and one for the expanded state `{ closed, expanded }`.',\n type: 'React.ReactNode',\n status: 'optional',\n },\n icon_position: {\n doc: 'Will set the placement of the icon. Defaults to `left`.',\n type: 'string',\n status: 'optional',\n },\n icon_size: {\n doc: 'Define a different icon size. Defaults to `medium` (1.5rem).',\n type: 'string',\n status: 'optional',\n },\n left_component: {\n doc: 'Will add a React element on the left side of the `title`, inside `AccordionHeaderContainer`.',\n type: 'React.ReactNode',\n status: 'optional',\n },\n prerender: {\n doc: 'If set to `true` the content will be present, even the accordion is not expanded. Can be useful for assistive technology or SEO.',\n type: 'boolean',\n status: 'optional',\n },\n prevent_rerender: {\n doc: \"If set to `true` the accordion component will not re-render its content – can be useful for widgets you don't have control of storing the temporary state during an interaction.\",\n type: 'boolean',\n status: 'optional',\n },\n prevent_rerender_conditional: {\n doc: 'Use this prop together with `prevent_rerender` – and if it is set to `true`, the accordion component will re-render if the children are a new React element and do not match the previous one anymore.',\n type: 'boolean',\n status: 'optional',\n },\n single_container: {\n doc: 'If set to `true`, a group of accordions will be wrapped to a sidebar looking menu for medium and larger screens.',\n type: 'boolean',\n status: 'optional',\n },\n element: {\n doc: 'Gives you the option to replace the used `button` element. Provide a React element, including a string (HTML element). Defaults to a `div` with all the needed accessibility features included.',\n type: 'React.ReactNode',\n status: 'optional',\n },\n heading: {\n doc: 'If set to `true`, level 2 (h2) will be used. You can provide your own HTML heading (`h3`), or provide a `heading_level` property.',\n type: 'boolean',\n status: 'optional',\n },\n heading_level: {\n doc: 'If `heading` is set to `true`, you can provide a numeric value to define a different heading level. Defaults to `2`.',\n type: 'boolean',\n status: 'optional',\n },\n disabled: {\n doc: 'If set to `true`, the accordion button will be disabled (dimmed).',\n type: 'boolean',\n status: 'optional',\n },\n skeleton: {\n doc: 'If set to `true`, an overlaying skeleton with animation will be shown.',\n type: 'boolean',\n status: 'optional',\n },\n contentRef: {\n doc: 'Send along a custom React Ref for `.dnb-accordion__content`.',\n type: 'function',\n status: 'optional',\n },\n collapseAllHandleRef: {\n doc: 'Ref handle to collapse all expanded accordions. Send in a ref and use `.current()` to collapse all accordions. Default: `undefined`.',\n type: 'React.MutableRefObject<() => void>',\n status: 'optional',\n },\n space: {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const AccordionProviderGroupProperties: PropertiesTableProps = {\n group: {\n doc: \"Define a unique id, it will be used to 'group' several accordions into one.\",\n type: 'string',\n status: 'optional',\n },\n allow_close_all: {\n doc: 'If set to `true`, the group of accordions will allow all to close.',\n type: 'boolean',\n status: 'optional',\n },\n expanded_id: {\n doc: 'Define an `id` of a nested accordion that will get expanded.',\n type: 'string',\n status: 'optional',\n },\n space: {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const AccordionEvents: PropertiesTableProps = {\n on_change: {\n doc: 'Will be called by user click interaction. Returns an object with a boolean state `expanded` inside `{ expanded, id, event, ...event }`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,mBAAyC,GAAG;EACvDC,EAAE,EAAE;IACFC,GAAG,EAAE,wGAAwG;IAC7GC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDC,KAAK,EAAE;IACLH,GAAG,EAAE,2EAA2E;IAChFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,QAAQ,EAAE;IACRJ,GAAG,EAAE,uEAAuE;IAC5EC,IAAI,EAA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;IACfC,MAAM,EAAE;EACV,CAAC;EACD2B,WAAW,EAAE;IACX7B,GAAG,EAAE,8DAA8D;IACnEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDuB,KAAK,EAAE;IACLzB,GAAG,EAAE,0DAA0D;IAC/DC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1BC,MAAM,EAAE;EACV;AACF,CAAC;AAED,OAAO,MAAM4B,eAAqC,GAAG;EACnDC,SAAS,EAAE;IACT/B,GAAG,EAAE,yIAAyI;IAC9IC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC"}
@@ -3,10 +3,10 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
- const _excluded = ["expanded", "expanded_id", "prerender", "prevent_rerender", "single_container", "contentRef", "allow_close_all", "remember_state", "flush_remembered_state", "disabled", "group", "onInit", "className", "id", "children"];
6
+ const _excluded = ["expanded", "expanded_id", "prerender", "prevent_rerender", "single_container", "contentRef", "allow_close_all", "remember_state", "flush_remembered_state", "disabled", "group", "onInit", "className", "id", "children", "collapseAllHandleRef"];
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
- import React, { useContext } from 'react';
9
+ import React, { useContext, useEffect, useRef } from 'react';
10
10
  import classnames from 'classnames';
11
11
  import { isTrue, makeUniqueId, extendPropsWithContext, validateDOMAttributes, dispatchCustomElementEvent } from '../../shared/component-helper';
12
12
  import { createSpacingClasses } from '../space/SpacingHelper';
@@ -45,9 +45,18 @@ const AccordionGroup = props => {
45
45
  onInit,
46
46
  className,
47
47
  id: _id,
48
- children
48
+ children,
49
+ collapseAllHandleRef
49
50
  } = extendedProps,
50
51
  restOfExtendedProps = _objectWithoutProperties(extendedProps, _excluded);
52
+ const collapseAccordionCallbacks = useRef([]);
53
+ useEffect(() => {
54
+ if (collapseAllHandleRef) {
55
+ collapseAllHandleRef.current = () => {
56
+ collapseAccordionCallbacks.current.forEach(callback => callback());
57
+ };
58
+ }
59
+ }, [collapseAllHandleRef]);
51
60
  const classes = classnames('dnb-accordion-group', createSpacingClasses(extendedProps), className, isTrue(single_container) && 'dnb-accordion-group--single-container');
52
61
  const params = _objectSpread({}, restOfExtendedProps);
53
62
  validateDOMAttributes(props, params);
@@ -56,7 +65,8 @@ const AccordionGroup = props => {
56
65
  }
57
66
  const contextForProvider = _objectSpread(_objectSpread({}, extendedProps), {}, {
58
67
  id,
59
- onChange: onChangeHandler
68
+ onChange: onChangeHandler,
69
+ collapseAccordionCallbacks
60
70
  });
61
71
  return React.createElement(AccordionGroupContext.Provider, {
62
72
  value: contextForProvider
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionGroup.js","names":["React","useContext","classnames","isTrue","makeUniqueId","extendPropsWithContext","validateDOMAttributes","dispatchCustomElementEvent","createSpacingClasses","Context","AccordionGroupContext","accordionDefaultProps","AccordionGroup","props","context","id","thisInstance","_id","onChangeHandler","event","expanded","extendedProps","Accordion","getTranslation","expanded_id","prerender","prevent_rerender","single_container","contentRef","allow_close_all","remember_state","flush_remembered_state","disabled","group","onInit","className","children","restOfExtendedProps","_objectWithoutProperties","_excluded","classes","params","_objectSpread","contextForProvider","onChange","createElement","Provider","value","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/accordion/AccordionGroup.tsx"],"sourcesContent":["/**\n * Web AccordionGroup Component\n *\n */\n\nimport React, { useContext } from 'react'\n\nimport classnames from 'classnames'\nimport {\n isTrue,\n makeUniqueId,\n extendPropsWithContext,\n validateDOMAttributes,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\n\nimport Context from '../../shared/Context'\nimport AccordionGroupContext from './AccordionProviderContext'\n\nimport type { GroupProps } from './Accordion'\nimport { accordionDefaultProps } from './defaultProps'\n\nexport type AccordionGroupProps = React.HTMLProps<HTMLElement> &\n GroupProps & {\n onInit?: (...args: any[]) => any\n }\n\nconst AccordionGroup = (props: AccordionGroupProps) => {\n const context = useContext(Context)\n const id = props.id || makeUniqueId()\n\n const thisInstance = {\n _id: id,\n props,\n context,\n onChangeHandler,\n }\n\n function onChangeHandler(event) {\n dispatchCustomElementEvent(thisInstance, 'on_change', {\n id: event.id,\n expanded: event.expanded,\n event,\n })\n }\n\n // use only the props from context, who are available here anyway\n const extendedProps = extendPropsWithContext(\n props,\n accordionDefaultProps,\n context.Accordion,\n context.getTranslation(props)['Accordion']\n )\n\n const {\n expanded, // eslint-disable-line\n expanded_id, // eslint-disable-line\n prerender, // eslint-disable-line\n prevent_rerender, // eslint-disable-line\n single_container, // eslint-disable-line\n contentRef, // eslint-disable-line\n allow_close_all, // eslint-disable-line\n remember_state, // eslint-disable-line\n flush_remembered_state, // eslint-disable-line\n disabled, // eslint-disable-line\n group, // eslint-disable-line\n onInit, // eslint-disable-line\n className,\n\n id: _id, // eslint-disable-line\n children, // eslint-disable-line\n\n ...restOfExtendedProps\n } = extendedProps\n\n const classes = classnames(\n 'dnb-accordion-group',\n isTrue(single_container) && 'dnb-accordion-group--single-container',\n createSpacingClasses(extendedProps),\n className\n )\n\n const params = {\n ...restOfExtendedProps,\n }\n\n // also used for code markup simulation\n validateDOMAttributes(props, params)\n\n if (!extendedProps?.group && isTrue(props.single_container)) {\n extendedProps.group = makeUniqueId()\n }\n\n const contextForProvider = {\n ...extendedProps,\n id,\n onChange: onChangeHandler,\n }\n\n return (\n <AccordionGroupContext.Provider value={contextForProvider}>\n <div className={classes}>\n <span\n id={id}\n className=\"dnb-accordion-group__shell\"\n role=\"group\"\n {...params}\n >\n <span className=\"dnb-accordion-group__children\">{children}</span>\n </span>\n </div>\n </AccordionGroupContext.Provider>\n )\n}\n\nAccordionGroup._supportsSpacingProps = true\n\nexport default AccordionGroup\n"],"mappings":";;;;;;;;AAKA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,MAAM,EACNC,YAAY,EACZC,sBAAsB,EACtBC,qBAAqB,EACrBC,0BAA0B,QACrB,+BAA+B;AACtC,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,qBAAqB,MAAM,4BAA4B;AAG9D,SAASC,qBAAqB,QAAQ,gBAAgB;AAOtD,MAAMC,cAAc,GAAIC,KAA0B,IAAK;EACrD,MAAMC,OAAO,GAAGb,UAAU,CAACQ,OAAO,CAAC;EACnC,MAAMM,EAAE,GAAGF,KAAK,CAACE,EAAE,IAAIX,YAAY,CAAC,CAAC;EAErC,MAAMY,YAAY,GAAG;IACnBC,GAAG,EAAEF,EAAE;IACPF,KAAK;IACLC,OAAO;IACPI;EACF,CAAC;EAED,SAASA,eAAeA,CAACC,KAAK,EAAE;IAC9BZ,0BAA0B,CAACS,YAAY,EAAE,WAAW,EAAE;MACpDD,EAAE,EAAEI,KAAK,CAACJ,EAAE;MACZK,QAAQ,EAAED,KAAK,CAACC,QAAQ;MACxBD;IACF,CAAC,CAAC;EACJ;EAGA,MAAME,aAAa,GAAGhB,sBAAsB,CAC1CQ,KAAK,EACLF,qBAAqB,EACrBG,OAAO,CAACQ,SAA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S,EAAC;EAA+B,GAAEC,QAAe,CAC5D,CACH,CACyB,CAAC;AAErC,CAAC;AAEDxB,cAAc,CAACsC,qBAAqB,GAAG,IAAI;AAE3C,eAAetC,cAAc"}
1
+ {"version":3,"file":"AccordionGroup.js","names":["React","useContext","useEffect","useRef","classnames","isTrue","makeUniqueId","extendPropsWithContext","validateDOMAttributes","dispatchCustomElementEvent","createSpacingClasses","Context","AccordionGroupContext","accordionDefaultProps","AccordionGroup","props","context","id","thisInstance","_id","onChangeHandler","event","expanded","extendedProps","Accordion","getTranslation","expanded_id","prerender","prevent_rerender","single_container","contentRef","allow_close_all","remember_state","flush_remembered_state","disabled","group","onInit","className","children","collapseAllHandleRef","restOfExtendedProps","_objectWithoutProperties","_excluded","collapseAccordionCallbacks","current","forEach","callback","classes","params","_objectSpread","contextForProvider","onChange","createElement","Provider","value","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/accordion/AccordionGroup.tsx"],"sourcesContent":["/**\n * Web AccordionGroup Component\n *\n */\n\nimport React, { useContext, useEffect, useRef } from 'react'\n\nimport classnames from 'classnames'\nimport {\n isTrue,\n makeUniqueId,\n extendPropsWithContext,\n validateDOMAttributes,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\n\nimport Context from '../../shared/Context'\nimport AccordionGroupContext from './AccordionProviderContext'\n\nimport type { GroupProps } from './Accordion'\nimport { accordionDefaultProps } from './defaultProps'\n\nexport type AccordionGroupProps = React.HTMLProps<HTMLElement> &\n GroupProps & {\n onInit?: (...args: any[]) => any\n }\n\nconst AccordionGroup = (props: AccordionGroupProps) => {\n const context = useContext(Context)\n const id = props.id || makeUniqueId()\n\n const thisInstance = {\n _id: id,\n props,\n context,\n onChangeHandler,\n }\n\n function onChangeHandler(event) {\n dispatchCustomElementEvent(thisInstance, 'on_change', {\n id: event.id,\n expanded: event.expanded,\n event,\n })\n }\n\n // use only the props from context, who are available here anyway\n const extendedProps = extendPropsWithContext(\n props,\n accordionDefaultProps,\n context.Accordion,\n context.getTranslation(props)['Accordion']\n )\n\n const {\n expanded, // eslint-disable-line\n expanded_id, // eslint-disable-line\n prerender, // eslint-disable-line\n prevent_rerender, // eslint-disable-line\n single_container, // eslint-disable-line\n contentRef, // eslint-disable-line\n allow_close_all, // eslint-disable-line\n remember_state, // eslint-disable-line\n flush_remembered_state, // eslint-disable-line\n disabled, // eslint-disable-line\n group, // eslint-disable-line\n onInit, // eslint-disable-line\n className,\n\n id: _id, // eslint-disable-line\n children, // eslint-disable-line\n collapseAllHandleRef,\n\n ...restOfExtendedProps\n } = extendedProps\n\n const collapseAccordionCallbacks = useRef<(() => void)[]>([])\n\n useEffect(() => {\n if (collapseAllHandleRef) {\n collapseAllHandleRef.current = () => {\n collapseAccordionCallbacks.current.forEach((callback) =>\n callback()\n )\n }\n }\n }, [collapseAllHandleRef])\n\n const classes = classnames(\n 'dnb-accordion-group',\n isTrue(single_container) && 'dnb-accordion-group--single-container',\n createSpacingClasses(extendedProps),\n className\n )\n\n const params = {\n ...restOfExtendedProps,\n }\n\n // also used for code markup simulation\n validateDOMAttributes(props, params)\n\n if (!extendedProps?.group && isTrue(props.single_container)) {\n extendedProps.group = makeUniqueId()\n }\n\n const contextForProvider = {\n ...extendedProps,\n id,\n onChange: onChangeHandler,\n collapseAccordionCallbacks,\n }\n\n return (\n <AccordionGroupContext.Provider value={contextForProvider}>\n <div className={classes}>\n <span\n id={id}\n className=\"dnb-accordion-group__shell\"\n role=\"group\"\n {...params}\n >\n <span className=\"dnb-accordion-group__children\">{children}</span>\n </span>\n </div>\n </AccordionGroupContext.Provider>\n )\n}\n\nAccordionGroup._supportsSpacingProps = true\n\nexport default AccordionGroup\n"],"mappings":";;;;;;;;AAKA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAE5D,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,MAAM,EACNC,YAAY,EACZC,sBAAsB,EAC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ded_id?: string;
13
13
  onChange?: (...params: unknown[]) => void;
14
14
  onInit?: (...args: any[]) => any;
15
+ collapseAccordionCallbacks?: React.MutableRefObject<(() => void)[]>;
16
+ collapseAllHandleRef?: React.MutableRefObject<() => void>;
15
17
  };
16
18
  declare const AccordionGroupContext: React.Context<AccordionGroupContextProps>;
17
19
  export default AccordionGroupContext;
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionProviderContext.js","names":["React","AccordionGroupContext","createContext"],"sources":["../../../../src/components/accordion/AccordionProviderContext.ts"],"sourcesContent":["/**\n * Web AccordionGroup Context\n *\n */\n\nimport React from 'react'\n\ntype AccordionGroupContextProps = {\n expanded?: boolean\n group?: string\n expanded_ssr?: boolean\n remember_state?: boolean\n flush_remembered_state?: boolean\n expanded_id?: string\n onChange?: (...params: unknown[]) => void\n onInit?: (...args: any[]) => any\n}\n\nconst AccordionGroupContext =\n React.createContext<AccordionGroupContextProps>({})\n\nexport default AccordionGroupContext\n"],"mappings":"AAKA,OAAOA,KAAK,MAAM,OAAO;AAazB,MAAMC,qBAAqB,GACzBD,KAAK,CAACE,aAAa,CAA6B,CAAC,CAAC,CAAC;AAErD,eAAeD,qBAAqB"}
1
+ {"version":3,"file":"AccordionProviderContext.js","names":["React","AccordionGroupContext","createContext"],"sources":["../../../../src/components/accordion/AccordionProviderContext.ts"],"sourcesContent":["/**\n * Web AccordionGroup Context\n *\n */\n\nimport React from 'react'\n\ntype AccordionGroupContextProps = {\n expanded?: boolean\n group?: string\n expanded_ssr?: boolean\n remember_state?: boolean\n flush_remembered_state?: boolean\n expanded_id?: string\n onChange?: (...params: unknown[]) => void\n onInit?: (...args: any[]) => any\n collapseAccordionCallbacks?: React.MutableRefObject<(() => void)[]>\n collapseAllHandleRef?: React.MutableRefObject<() => void>\n}\n\nconst AccordionGroupContext =\n React.createContext<AccordionGroupContextProps>({})\n\nexport default AccordionGroupContext\n"],"mappings":"AAKA,OAAOA,KAAK,MAAM,OAAO;AAezB,MAAMC,qBAAqB,GACzBD,KAAK,CAACE,aAAa,CAA6B,CAAC,CAAC,CAAC;AAErD,eAAeD,qBAAqB"}
@@ -1255,7 +1255,7 @@ class AutocompleteInstance extends React.PureComponent {
1255
1255
  const currentDataItem = getCurrentData(active_item, this.context.drawerList.data);
1256
1256
  return React.createElement(AriaLive, {
1257
1257
  hidden: !IS_MAC,
1258
- priority: "hight",
1258
+ priority: "high",
1259
1259
  delay: 0
1260
1260
  }, currentDataItem && React.createElement(React.Fragment, null, active_item === selected_item ? React.createElement(React.Fragment, null, selected_sr, " ") : null, React.createElement(ItemContent, null, currentDataItem)));
1261
1261
  }
@@ -1507,7 +1507,7 @@ class AutocompleteInstance extends React.PureComponent {
1507
1507
  id: id + '-suffix',
1508
1508
  context: props
1509
1509
  }, suffix))), this.getVoiceOverActiveItem(selected_sr), React.createElement(AriaLive, {
1510
- priority: "hight"
1510
+ priority: "high"
1511
1511
  }, this.getAriaLiveUpdate()));
1512
1512
  }
1513
1513
  }