Skip to content

Commit dce8fee

Browse files
authored
Merge pull request #1386 from undp/develop
Release 1.3.1
2 parents b5eeaf3 + f5b6b12 commit dce8fee

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

docs/js/accordion.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/all.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@undp/design-system",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "UNDP Design System",
55
"homepage": "https://design.undp.org",
66
"main": "index.js",

stories/Components/UIcomponents/Accordion/Accordion.stories.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ export default {
128128
<h4>States</h4>
129129
<p>An accordion panel has two states: collapsed and expanded. The chevron icon at the end of the accordion title should indicate the accordion panel’s state. By default, all panels of an accordion should begin at the collapsed state. The following behavior modifiers are available:</p>
130130
<ul>
131-
<li><strong>Multi-expand</strong>. By default only one panel of the accordion can be open at a time. It can be changed by assigning data-multi-expand=”true” attribute to the accordion’s outermost element.</li>
132-
<li><strong>Disabled</strong>: temporary removing expanding capability of the specific panel while preserving overall look and feel</li>
133-
<li><strong>Active</strong>: while default state of all panels is “close” we can enable certain panels by assigning class .is-active to it</li>
134-
<li><strong>Mobile Only</strong>: To shwo the Accordion on mobile device only we have to pass the attribute to the parent div eg: <code>&lt;div class="accordion" data-accordion="mobile"&gt;</code></li>
131+
<li><strong>Multi-expand</strong>. By default only one panel of the accordion can be open at a time. It can be changed by assigning data-multi-expand=”true” attribute to the accordion’s outermost element. <code>&lt;div class="accordion" data-multi-expand="true"&gt;</code></li>
132+
{/* <li><strong>Disabled</strong>: temporary removing expanding capability of the specific panel while preserving overall look and feel</li> */}
133+
<li><strong>Active</strong>: while default state of all panels is “close” we can enable certain panels by assigning class .is-active to it: <code>&lt;li class="is-active"&gt;</code></li>
134+
<li><strong>Mobile Only</strong>: To show the Accordion on mobile device only we have to pass the attribute to the parent div eg: <code>&lt;div class="accordion" data-accordion="mobile"&gt;</code></li>
135135
</ul>
136136
<h4>Interactions</h4>
137137
<p>The entire accordion title and chevron is selectable. Users can click anywhere in the title area to expand or collapse the content, providing a large, easy to manipulate target.</p>
@@ -166,5 +166,5 @@ AccordionStory.argTypes = {
166166
descriptionText: { table: { disable: true } },
167167
};
168168

169-
169+
170170

stories/assets/js/accordion.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ export function accordion(accordionSelector, accordionSiblingSelector, accordion
1313
jQuery(currentElem).siblings(accordinSiblingElement).slideDown('fast').attr('aria-hidden', false);
1414

1515
// Close all other list items and panels.
16-
jQuery(accordionListItem).not(jQuery(currentElem)).removeClass(accordionActiveElem).attr('aria-expanded', false);
17-
jQuery(accordionListItem).not(jQuery(currentElem)).siblings(accordinSiblingElement).slideUp('fast')
18-
.attr('aria-hidden', true);
16+
if (!jQuery(accordionElement).data('multiExpand')) {
17+
jQuery(accordionListItem).not(jQuery(currentElem)).removeClass(accordionActiveElem).attr('aria-expanded', false);
18+
jQuery(accordionListItem).not(jQuery(currentElem)).siblings(accordinSiblingElement).slideUp('fast').attr('aria-hidden', true);
19+
}
1920
} else {
2021
// Close active list item if open.
2122
jQuery(currentElem).removeClass(accordionActiveElem).attr('aria-expanded', false);
@@ -30,7 +31,7 @@ export function accordion(accordionSelector, accordionSiblingSelector, accordion
3031
if (hasMobileAttr) {
3132
jQuery(accordionListItem).addClass('desktop-event-none').siblings(accordionSibling).addClass('desktop-visible');
3233
}
33-
jQuery(accordionListItem).click(function (e) {
34+
jQuery(accordionListItem, element).click(function (e) {
3435
e.preventDefault();
3536

3637
// Callback function for Accordion Trigger.
@@ -42,7 +43,7 @@ export function accordion(accordionSelector, accordionSiblingSelector, accordion
4243
// Check if 'Enter' key is pressed.
4344
if (keycode == 13) accordionTrigger(jQuery(this), accordionListItem, accordionSibling, accordionActiveClass);
4445
});
45-
});
46+
}).find('.is-active button').first().trigger('click');
4647
};
4748

4849
accordionClick(accordionElement, accordionPanel, accordionActiveElement);

0 commit comments

Comments
 (0)