@arbor-education/design-system.components 0.0.3 → 0.0.5
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.
- package/README.md +1 -1
- package/dist/components/button/Button.d.ts +5 -2
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +3 -1
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/card/Card.d.ts +1 -2
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +3 -3
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/card/Card.test.js +0 -5
- package/dist/components/card/Card.test.js.map +1 -1
- package/dist/components/formField/FormField.d.ts +4 -0
- package/dist/components/formField/FormField.d.ts.map +1 -1
- package/dist/components/formField/FormField.js +2 -1
- package/dist/components/formField/FormField.js.map +1 -1
- package/dist/components/formField/FormField.stories.d.ts.map +1 -1
- package/dist/components/formField/FormField.stories.js +3 -1
- package/dist/components/formField/FormField.stories.js.map +1 -1
- package/dist/components/formField/FormField.test.js +5 -0
- package/dist/components/formField/FormField.test.js.map +1 -1
- package/dist/components/formField/inputs/checkbox/CheckboxInput.d.ts +7 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.d.ts.map +1 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.js +31 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.js.map +1 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.d.ts +17 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.js +19 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.js.map +1 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.test.d.ts +2 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.test.js +30 -0
- package/dist/components/formField/inputs/checkbox/CheckboxInput.test.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.d.ts +11 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.js +43 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.d.ts +161 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.js +172 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.d.ts +2 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.js +93 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.d.ts +11 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.js +15 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.d.ts +10 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.js +12 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.d.ts +9 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.js +17 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.d.ts +7 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.js +16 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.d.ts +16 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.js +73 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.js.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.d.ts +6 -0
- package/dist/components/formField/inputs/number/NumberInput.d.ts.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.js +39 -0
- package/dist/components/formField/inputs/number/NumberInput.js.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.stories.d.ts +20 -0
- package/dist/components/formField/inputs/number/NumberInput.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.stories.js +22 -0
- package/dist/components/formField/inputs/number/NumberInput.stories.js.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.test.d.ts +2 -0
- package/dist/components/formField/inputs/number/NumberInput.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/number/NumberInput.test.js +30 -0
- package/dist/components/formField/inputs/number/NumberInput.test.js.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.d.ts +7 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.d.ts.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.js +9 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.js.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.d.ts +46 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js +83 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.test.d.ts +2 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.test.js +34 -0
- package/dist/components/formField/inputs/radio/RadioButtonInput.test.js.map +1 -0
- package/dist/components/heading/Heading.d.ts +392 -388
- package/dist/components/heading/Heading.d.ts.map +1 -1
- package/dist/components/heading/Heading.js +8 -1
- package/dist/components/heading/Heading.js.map +1 -1
- package/dist/components/heading/Heading.stories.d.ts.map +1 -1
- package/dist/components/heading/Heading.stories.js +7 -8
- package/dist/components/heading/Heading.stories.js.map +1 -1
- package/dist/components/heading/HeadingInnerContainer.d.ts +2 -2
- package/dist/components/heading/HeadingInnerContainer.js +4 -4
- package/dist/components/icon/Icon.d.ts +2 -2
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/components/icon/Icon.js.map +1 -1
- package/dist/components/icon/Icon.stories.d.ts +7 -0
- package/dist/components/icon/Icon.stories.d.ts.map +1 -1
- package/dist/components/icon/Icon.stories.js +8 -0
- package/dist/components/icon/Icon.stories.js.map +1 -1
- package/dist/components/icon/allowedIcons.d.ts +1 -0
- package/dist/components/icon/allowedIcons.d.ts.map +1 -1
- package/dist/components/section/Section.d.ts +18 -0
- package/dist/components/section/Section.d.ts.map +1 -0
- package/dist/components/section/Section.js +36 -0
- package/dist/components/section/Section.js.map +1 -0
- package/dist/components/section/Section.stories.d.ts +18 -0
- package/dist/components/section/Section.stories.d.ts.map +1 -0
- package/dist/components/section/Section.stories.js +27 -0
- package/dist/components/section/Section.stories.js.map +1 -0
- package/dist/components/section/Section.test.d.ts +2 -0
- package/dist/components/section/Section.test.d.ts.map +1 -0
- package/dist/components/section/Section.test.js +157 -0
- package/dist/components/section/Section.test.js.map +1 -0
- package/dist/components/slideover/Slideover.d.ts +11 -0
- package/dist/components/slideover/Slideover.d.ts.map +1 -0
- package/dist/components/slideover/Slideover.js +11 -0
- package/dist/components/slideover/Slideover.js.map +1 -0
- package/dist/components/slideover/Slideover.test.d.ts +2 -0
- package/dist/components/slideover/Slideover.test.d.ts.map +1 -0
- package/dist/components/slideover/Slideover.test.js +33 -0
- package/dist/components/slideover/Slideover.test.js.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.d.ts +7 -0
- package/dist/components/slideoverManager/SlideoverManager.d.ts.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.js +29 -0
- package/dist/components/slideoverManager/SlideoverManager.js.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.stories.d.ts +15 -0
- package/dist/components/slideoverManager/SlideoverManager.stories.d.ts.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.stories.js +102 -0
- package/dist/components/slideoverManager/SlideoverManager.stories.js.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.test.d.ts +2 -0
- package/dist/components/slideoverManager/SlideoverManager.test.d.ts.map +1 -0
- package/dist/components/slideoverManager/SlideoverManager.test.js +53 -0
- package/dist/components/slideoverManager/SlideoverManager.test.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +14 -18
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +6 -39
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/Tabs.stories.d.ts +35 -6
- package/dist/components/tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.stories.js +17 -45
- package/dist/components/tabs/Tabs.stories.js.map +1 -1
- package/dist/components/tabs/Tabs.test.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.test.js +90 -97
- package/dist/components/tabs/Tabs.test.js.map +1 -1
- package/dist/components/tabs/TabsItem.d.ts +15 -0
- package/dist/components/tabs/TabsItem.d.ts.map +1 -0
- package/dist/components/tabs/TabsItem.js +18 -0
- package/dist/components/tabs/TabsItem.js.map +1 -0
- package/dist/components/tabs/TabsItem.stories.d.ts +618 -0
- package/dist/components/tabs/TabsItem.stories.d.ts.map +1 -0
- package/dist/components/tabs/TabsItem.stories.js +48 -0
- package/dist/components/tabs/TabsItem.stories.js.map +1 -0
- package/dist/index.css +1996 -1326
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/Constants.d.ts +6 -0
- package/dist/utils/Constants.d.ts.map +1 -0
- package/dist/utils/Constants.js +6 -0
- package/dist/utils/Constants.js.map +1 -0
- package/dist/utils/PopupParentContext.d.ts +3 -0
- package/dist/utils/PopupParentContext.d.ts.map +1 -0
- package/dist/utils/PopupParentContext.js +6 -0
- package/dist/utils/PopupParentContext.js.map +1 -0
- package/dist/utils/PubSub.d.ts +11 -0
- package/dist/utils/PubSub.d.ts.map +1 -0
- package/dist/utils/PubSub.js +27 -0
- package/dist/utils/PubSub.js.map +1 -0
- package/dist/utils/PubSub.test.d.ts +2 -0
- package/dist/utils/PubSub.test.d.ts.map +1 -0
- package/dist/utils/PubSub.test.js +229 -0
- package/dist/utils/PubSub.test.js.map +1 -0
- package/dist/utils/SlideoverUtils.d.ts +7 -0
- package/dist/utils/SlideoverUtils.d.ts.map +1 -0
- package/dist/utils/SlideoverUtils.js +8 -0
- package/dist/utils/SlideoverUtils.js.map +1 -0
- package/dist/utils/getDefaultPopupParent.d.ts +2 -0
- package/dist/utils/getDefaultPopupParent.d.ts.map +1 -0
- package/dist/utils/getDefaultPopupParent.js +13 -0
- package/dist/utils/getDefaultPopupParent.js.map +1 -0
- package/dist/utils/hooks/useComponentDidMount.d.ts +3 -0
- package/dist/utils/hooks/useComponentDidMount.d.ts.map +1 -0
- package/dist/utils/hooks/useComponentDidMount.js +5 -0
- package/dist/utils/hooks/useComponentDidMount.js.map +1 -0
- package/dist/utils/hooks/usePubSub.d.ts +2 -0
- package/dist/utils/hooks/usePubSub.d.ts.map +1 -0
- package/dist/utils/hooks/usePubSub.js +12 -0
- package/dist/utils/hooks/usePubSub.js.map +1 -0
- package/package.json +3 -3
- package/src/components/button/Button.story.tsx +9 -0
- package/src/components/button/Button.tsx +10 -2
- package/src/components/button/button.scss +75 -33
- package/src/components/card/Card.test.tsx +0 -6
- package/src/components/card/Card.tsx +12 -7
- package/src/components/card/card.scss +32 -18
- package/src/components/formField/FormField.stories.tsx +9 -1
- package/src/components/formField/FormField.test.tsx +6 -0
- package/src/components/formField/FormField.tsx +5 -0
- package/src/components/formField/formField.scss +20 -8
- package/src/components/formField/inputs/checkbox/CheckboxInput.stories.tsx +22 -0
- package/src/components/formField/inputs/checkbox/CheckboxInput.test.tsx +35 -0
- package/src/components/formField/inputs/checkbox/CheckboxInput.tsx +79 -0
- package/src/components/formField/inputs/checkbox/checkboxInput.scss +96 -0
- package/src/components/formField/inputs/dropdown/Dropdown.stories.tsx +185 -0
- package/src/components/formField/inputs/dropdown/Dropdown.test.tsx +185 -0
- package/src/components/formField/inputs/dropdown/Dropdown.tsx +82 -0
- package/src/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.tsx +41 -0
- package/src/components/formField/inputs/dropdown/buttons/dropdownButton/dropdownButton.scss +12 -0
- package/src/components/formField/inputs/dropdown/dropdown.scss +24 -0
- package/src/components/formField/inputs/dropdown/items/DropdownItemRenderer.tsx +38 -0
- package/src/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.tsx +49 -0
- package/src/components/formField/inputs/dropdown/items/dropdownItem/dropdownItem.scss +62 -0
- package/src/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.tsx +48 -0
- package/src/components/formField/inputs/dropdown/items/dropdownMultiLineItem/dropdownMultiLineItem.scss +52 -0
- package/src/components/formField/inputs/dropdown/wrapper/DropdownWrapper.tsx +138 -0
- package/src/components/formField/inputs/dropdown/wrapper/dropdownWrapper.scss +32 -0
- package/src/components/formField/inputs/input.scss +25 -26
- package/src/components/formField/inputs/number/NumberInput.stories.tsx +25 -0
- package/src/components/formField/inputs/number/NumberInput.test.tsx +33 -0
- package/src/components/formField/inputs/number/NumberInput.tsx +107 -0
- package/src/components/formField/inputs/number/numberInput.scss +68 -0
- package/src/components/formField/inputs/radio/RadioButtonInput.stories.tsx +97 -0
- package/src/components/formField/inputs/radio/RadioButtonInput.test.tsx +37 -0
- package/src/components/formField/inputs/radio/RadioButtonInput.tsx +46 -0
- package/src/components/formField/inputs/radio/radioButtonInput.scss +100 -0
- package/src/components/formField/label/label.scss +5 -1
- package/src/components/heading/Heading.stories.tsx +11 -12
- package/src/components/heading/Heading.tsx +21 -2
- package/src/components/heading/heading.scss +4 -0
- package/src/components/icon/Icon.stories.tsx +8 -0
- package/src/components/icon/Icon.tsx +2 -2
- package/src/components/icon/allowedIcons.tsx +2 -0
- package/src/components/pill/pill.scss +7 -7
- package/src/components/section/Section.stories.tsx +34 -0
- package/src/components/section/Section.test.tsx +308 -0
- package/src/components/section/Section.tsx +131 -0
- package/src/components/section/section.scss +42 -0
- package/src/components/slideover/Slideover.test.tsx +36 -0
- package/src/components/slideover/Slideover.tsx +38 -0
- package/src/components/slideover/slideover.scss +50 -0
- package/src/components/slideoverManager/SlideoverManager.stories.tsx +374 -0
- package/src/components/slideoverManager/SlideoverManager.test.tsx +64 -0
- package/src/components/slideoverManager/SlideoverManager.tsx +51 -0
- package/src/components/slideoverManager/slideoverManager.scss +13 -0
- package/src/components/tabs/Tabs.stories.tsx +92 -0
- package/src/components/tabs/Tabs.test.tsx +220 -0
- package/src/components/tabs/Tabs.tsx +14 -0
- package/src/components/tabs/TabsItem.stories.tsx +55 -0
- package/src/components/tabs/TabsItem.tsx +42 -0
- package/src/components/tabs/tabs.scss +62 -0
- package/src/global.scss +10 -1
- package/src/index.scss +15 -3
- package/src/index.ts +10 -3
- package/src/tokens.scss +1321 -1238
- package/src/utils/Constants.ts +5 -0
- package/src/utils/PopupParentContext.ts +6 -0
- package/src/utils/PubSub.test.ts +303 -0
- package/src/utils/PubSub.ts +34 -0
- package/src/utils/SlideoverUtils.ts +9 -0
- package/src/utils/getDefaultPopupParent.ts +14 -0
- package/src/utils/hooks/useComponentDidMount.ts +5 -0
- package/src/utils/hooks/usePubSub.ts +12 -0
- package/tokens/export-config.json +32 -0
- package/tokens/json/$metadata.json +5 -0
- package/tokens/json/$themes.json +1333 -0
- package/tokens/json/Arbor.json +6329 -0
- package/src/components/heading/HeadingInnerContainer.tsx +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3E,KAAK,wBAAwB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAgBhE,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACvB,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAElC,eAAO,MAAM,OAAO;YAAW,YAAY;;gBAHjC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAfe,wBAAwB;CA4B7D,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
1
3
|
import { createElement } from 'react';
|
|
4
|
+
const HeadingInnerContainer = (props) => {
|
|
5
|
+
const { className, ...rest } = props;
|
|
6
|
+
return (_jsx("span", { className: classNames('ds-heading__inner-container', className), ...rest }));
|
|
7
|
+
};
|
|
2
8
|
export const Heading = (props) => {
|
|
3
9
|
const { level = 1, children } = props;
|
|
4
10
|
const Component = {
|
|
@@ -7,6 +13,7 @@ export const Heading = (props) => {
|
|
|
7
13
|
3: 'h3',
|
|
8
14
|
4: 'h4',
|
|
9
15
|
}[level];
|
|
10
|
-
return createElement(Component, { className: 'ds-heading',
|
|
16
|
+
return createElement(Component, { ...props, className: classNames('ds-heading', props.className) }, children);
|
|
11
17
|
};
|
|
18
|
+
Heading.InnerContainer = HeadingInnerContainer;
|
|
12
19
|
//# sourceMappingURL=Heading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAuC,MAAM,OAAO,CAAC;AAI3E,MAAM,qBAAqB,GAAG,CAAC,KAA+B,EAAE,EAAE;IAChE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAErC,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CACnB,6BAA6B,EAC7B,SAAS,CACV,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,SAAS,GAAG;QAChB,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;KACR,CAAC,KAAK,CAAC,CAAC;IAET,OAAO,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;AAChH,CAAC,CAAC;AAEF,OAAO,CAAC,cAAc,GAAG,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.stories.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Heading.stories.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAG9B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;CAanC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;CAiBtC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;CAuBvC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Heading } from './Heading';
|
|
3
3
|
import { Button } from '../button/Button';
|
|
4
4
|
import { Icon } from '../icon/Icon';
|
|
5
|
-
import { HeadingInnerContainer } from './HeadingInnerContainer';
|
|
6
5
|
const meta = {
|
|
7
6
|
title: 'Components/Heading',
|
|
8
7
|
component: Heading,
|
|
@@ -15,7 +14,7 @@ export const Default = {
|
|
|
15
14
|
};
|
|
16
15
|
export const FloatingChildren = {
|
|
17
16
|
args: {
|
|
18
|
-
children: [_jsx(
|
|
17
|
+
children: [_jsx(Heading.InnerContainer, { children: "Text floating left" }, 1), _jsx("span", { children: "Text floating right" }, 2)],
|
|
19
18
|
level: 1,
|
|
20
19
|
},
|
|
21
20
|
};
|
|
@@ -23,8 +22,8 @@ export const HeadingWithSingleButton = {
|
|
|
23
22
|
args: {
|
|
24
23
|
level: 1,
|
|
25
24
|
children: [
|
|
26
|
-
_jsx(
|
|
27
|
-
_jsx(
|
|
25
|
+
_jsx(Heading.InnerContainer, { children: "Heading" }, 1),
|
|
26
|
+
_jsx(Heading.InnerContainer, { children: _jsxs(Button, { children: [_jsx(Icon, { name: "info" }), "Button Text"] }) }, 2),
|
|
28
27
|
],
|
|
29
28
|
},
|
|
30
29
|
};
|
|
@@ -32,8 +31,8 @@ export const HeadingWithMultipleButtons = {
|
|
|
32
31
|
args: {
|
|
33
32
|
level: 1,
|
|
34
33
|
children: [
|
|
35
|
-
_jsx(
|
|
36
|
-
_jsxs(
|
|
34
|
+
_jsx(Heading.InnerContainer, { children: "Heading" }, 1),
|
|
35
|
+
_jsxs(Heading.InnerContainer, { className: "medium-spacing-gap", children: [_jsxs(Button, { type: "secondary", children: [_jsx(Icon, { name: "info" }), "Button Text"] }), _jsxs(Button, { children: [_jsx(Icon, { name: "info" }), "Button Text"] })] }, 2),
|
|
37
36
|
],
|
|
38
37
|
},
|
|
39
38
|
};
|
|
@@ -41,8 +40,8 @@ export const HeadingWithButtonsBothSides = {
|
|
|
41
40
|
args: {
|
|
42
41
|
level: 1,
|
|
43
42
|
children: [
|
|
44
|
-
_jsxs(
|
|
45
|
-
_jsxs(
|
|
43
|
+
_jsxs(Heading.InnerContainer, { className: "medium-spacing-gap", children: [_jsxs(Button, { type: "tertiary", children: [_jsx(Icon, { name: "chevron-left" }), "Button Text"] }), "Heading"] }, 1),
|
|
44
|
+
_jsxs(Heading.InnerContainer, { className: "medium-spacing-gap", children: [_jsxs(Button, { type: "secondary", children: [_jsx(Icon, { name: "info" }), "Button Text"] }), _jsxs(Button, { children: [_jsx(Icon, { name: "info" }), "Button Text"] })] }, 2),
|
|
46
45
|
],
|
|
47
46
|
},
|
|
48
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.stories.js","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Heading.stories.js","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,IAAI,GAAyB;IACjC,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,OAAO;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,cAAc,CAAC;QAC1B,KAAK,EAAE,CAAC;KACT;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA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AC,WAAW,aACtB,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,mBAEb,EACT,MAAC,MAAM,eACL,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,mBAEb,KARkB,CAAC,CASL;SAC1B;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
type HeadingSubContainerProps = HTMLAttributes<HTMLSpanElement>;
|
|
3
|
-
export declare const HeadingInnerContainer: (props: HeadingSubContainerProps) => import(
|
|
3
|
+
export declare const HeadingInnerContainer: (props: HeadingSubContainerProps) => import('react/jsx-runtime').JSX.Element;
|
|
4
4
|
export {};
|
|
5
|
-
|
|
5
|
+
// # sourceMappingURL=HeadingInnerContainer.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from
|
|
1
|
+
import { jsx as _jsx } from 'react/jsx-runtime';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
export const HeadingInnerContainer = (props) => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const { className, ...rest } = props;
|
|
5
|
+
return (_jsx('span', { className: classNames(className, 'ds-heading__inner-container'), ...rest }));
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
// # sourceMappingURL=HeadingInnerContainer.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IconSize } from './types';
|
|
2
|
-
import {
|
|
2
|
+
import { type IconName } from './allowedIcons';
|
|
3
3
|
type IconProps = {
|
|
4
4
|
size?: IconSize;
|
|
5
5
|
color?: string;
|
|
6
6
|
screenReaderText?: string;
|
|
7
|
-
name:
|
|
7
|
+
name: IconName;
|
|
8
8
|
className?: string;
|
|
9
9
|
ariaLabel?: string;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG7D,KAAK,SAAS,GAAG;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,4CAapC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/icon/Icon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/icon/Icon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,UAAU,MAAM,YAAY,CAAC;AAWpC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAgB,EAAE,EAAE;IACvC,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACvF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,EAAE,mBAAmB,IAAI,EAAE,CAAC,CAAC;IACjE,OAAO,CACL,8BAEE,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,KAAK,iBAAa,MAAM,GAAG,EACxF,CAAC,CAAC,gBAAgB,IAAI,CACrB,eAAM,SAAS,EAAC,SAAS,YAAE,gBAAgB,GAAQ,CACpD,IACA,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.stories.d.ts","sourceRoot":"","sources":["../../../src/components/icon/Icon.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.stories.d.ts","sourceRoot":"","sources":["../../../src/components/icon/Icon.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAG3B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYnB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Icon } from './Icon';
|
|
2
|
+
import { allowedIcons } from './allowedIcons';
|
|
2
3
|
const meta = {
|
|
3
4
|
title: 'Components/Icon',
|
|
4
5
|
component: Icon,
|
|
@@ -8,6 +9,13 @@ export const Default = {
|
|
|
8
9
|
name: '3-dot',
|
|
9
10
|
size: 16,
|
|
10
11
|
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
name: {
|
|
14
|
+
control: 'select',
|
|
15
|
+
description: 'Icon name',
|
|
16
|
+
options: Object.keys(allowedIcons),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
11
19
|
};
|
|
12
20
|
export default meta;
|
|
13
21
|
//# sourceMappingURL=Icon.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.stories.js","sourceRoot":"","sources":["../../../src/components/icon/Icon.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.stories.js","sourceRoot":"","sources":["../../../src/components/icon/Icon.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,IAAI,GAAsB;IAC9B,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE;KACT;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;SACnC;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -107,4 +107,5 @@ export declare const allowedIcons: {
|
|
|
107
107
|
readonly 'favourite-filled': (props: LucideProps) => import("react/jsx-runtime").JSX.Element;
|
|
108
108
|
readonly 'x-solid': (props: CustomIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
109
109
|
};
|
|
110
|
+
export type IconName = keyof typeof allowedIcons;
|
|
110
111
|
//# sourceMappingURL=allowedIcons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allowedIcons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/allowedIcons.tsx"],"names":[],"mappings":"AAAA,OAAO,EA2DG,KAAK,WAAW,EA8BzB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA0GA,eAAe;yCACV,WAAW;gCAGpB,eAAe;CAC1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"allowedIcons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/allowedIcons.tsx"],"names":[],"mappings":"AAAA,OAAO,EA2DG,KAAK,WAAW,EA8BzB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA0GA,eAAe;yCACV,WAAW;gCAGpB,eAAe;CAC1B,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ButtonSize, type ButtonType } from '../button/Button';
|
|
2
|
+
import type { IconName } from '../icon/allowedIcons';
|
|
3
|
+
import { type HTMLAttributes, type MouseEventHandler } from 'react';
|
|
4
|
+
type SectionProps = {
|
|
5
|
+
title?: string;
|
|
6
|
+
titleIconName?: IconName;
|
|
7
|
+
titleIconColor?: string;
|
|
8
|
+
titleIconScreenReaderText?: string;
|
|
9
|
+
collapsible?: boolean;
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
buttonText?: string;
|
|
12
|
+
buttonOnClick?: MouseEventHandler<HTMLButtonElement>;
|
|
13
|
+
buttonType?: ButtonType;
|
|
14
|
+
buttonSize?: ButtonSize;
|
|
15
|
+
} & HTMLAttributes<HTMLElement>;
|
|
16
|
+
export declare const Section: (props: SectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=Section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../src/components/section/Section.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG9E,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAEhC,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,4CA6G1C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Button } from '../button/Button';
|
|
4
|
+
import { Heading } from '../heading/Heading';
|
|
5
|
+
import { Icon } from '../icon/Icon';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { ENTER_KEY, SPACE_KEY } from '../../utils/keyboardConstants';
|
|
8
|
+
export const Section = (props) => {
|
|
9
|
+
const { className, children, title, titleIconName, titleIconColor, titleIconScreenReaderText, collapsible = false, collapsed: initialCollapsed = false, buttonText, buttonOnClick, buttonType, buttonSize, } = props;
|
|
10
|
+
const [collapsed, setCollapsed] = useState(initialCollapsed);
|
|
11
|
+
const toggleCollapsedState = () => {
|
|
12
|
+
if (collapsible) {
|
|
13
|
+
setCollapsed(!collapsed);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return (_jsxs("section", { className: classNames('ds-section', {
|
|
17
|
+
'ds-section--collapsible': collapsible,
|
|
18
|
+
}, className), "aria-label": "section", children: [_jsxs(Heading, { role: "heading", onClick: (e) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
toggleCollapsedState();
|
|
22
|
+
}, onKeyDown: (e) => {
|
|
23
|
+
if ([SPACE_KEY, ENTER_KEY].includes(e.key)) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
toggleCollapsedState();
|
|
27
|
+
}
|
|
28
|
+
}, tabIndex: collapsible ? 0 : -1, children: [_jsxs(Heading.InnerContainer, { children: [title, titleIconName && (_jsx(Icon, { name: titleIconName, color: titleIconColor, screenReaderText: titleIconScreenReaderText, size: 24 }))] }), _jsxs(Heading.InnerContainer, { children: [buttonText && (_jsx(Button, { onClick: buttonOnClick, type: buttonType, size: buttonSize, children: buttonText })), collapsible && (_jsx("button", { className: "remove-default-button-styles", onClick: (e) => {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
toggleCollapsedState();
|
|
32
|
+
}, "aria-expanded": !collapsed, children: _jsx(Icon, { name: collapsed ? 'chevron-down' : 'chevron-up', size: 24, screenReaderText: collapsed ? 'Expand section' : 'Collapse section' }) }))] })] }), _jsx("div", { className: classNames('ds-section__contents', {
|
|
33
|
+
'ds-section__contents--collapsed': collapsed,
|
|
34
|
+
}), children: children })] }));
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=Section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../src/components/section/Section.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAoC,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAA+C,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAe/D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,WAAW,GAAG,KAAK,EACnB,SAAS,EAAE,gBAAgB,GAAG,KAAK,EACnC,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,GACX,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,oBAAoB,GAAG,GAAG,EAAE;QAChC,IAAI,WAAW,EAAE,CAAC;YAChB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,mBACE,SAAS,EACP,UAAU,CACR,YAAY,EACZ;YACE,yBAAyB,EAAE,WAAW;SACvC,EACD,SAAS,CACV,gBAKQ,SAAS,aAEpB,MAAC,OAAO,IACN,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACb,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,oBAAoB,EAAE,CAAC;gB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C7C,CACF,YAGA,QAAQ,GACL,IACE,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { Section } from './Section';
|
|
3
|
+
declare const meta: Meta<typeof Section>;
|
|
4
|
+
export declare const Default: {
|
|
5
|
+
args: {
|
|
6
|
+
title: string;
|
|
7
|
+
children: import("react/jsx-runtime").JSX.Element[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const NestedSections: {
|
|
11
|
+
args: {
|
|
12
|
+
title: string;
|
|
13
|
+
collapsible: boolean;
|
|
14
|
+
children: import("react/jsx-runtime").JSX.Element[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
//# sourceMappingURL=Section.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.stories.d.ts","sourceRoot":"","sources":["../../../src/components/section/Section.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAM9B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;CAa1B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Section } from './Section';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/Section',
|
|
5
|
+
component: Section,
|
|
6
|
+
globals: {
|
|
7
|
+
backgrounds: { value: 'dark' },
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export const Default = {
|
|
11
|
+
args: {
|
|
12
|
+
title: 'titleValue',
|
|
13
|
+
children: [_jsx("p", { children: "Sunt consectetur esse labore dolor consequat tempor dolor incididunt. Ullamco veniam ex enim consequat esse. Qui aute consequat dolore dolore ipsum commodo magna minim consectetur deserunt veniam in ipsum. Aute veniam do mollit cupidatat laboris. Laborum nisi est qui et eiusmod. Enim aliqua quis officia ut eiusmod quis dolore id commodo ipsum cillum sunt adipisicing laboris. Et non est sunt cillum ipsum." }, 1)],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const NestedSections = {
|
|
17
|
+
args: {
|
|
18
|
+
title: 'Parent Section',
|
|
19
|
+
collapsible: true,
|
|
20
|
+
children: [
|
|
21
|
+
_jsx(Section, { title: "Sub-section 1", collapsible: true, children: _jsx("p", { children: "Eu nisi dolore qui irure irure nulla aliqua commodo non sint dolor consectetur. Ullamco dolore ut exercitation ad cupidatat ipsum. Nisi proident esse nisi ullamco irure incididunt eiusmod fugiat est culpa Lorem. Dolor esse ut minim magna. In qui fugiat non nulla eu mollit enim excepteur consequat qui consequat occaecat aliquip adipisicing. Eu est nisi irure laboris culpa amet consectetur irure quis duis." }) }, 1),
|
|
22
|
+
_jsx(Section, { title: "Sub-section 2", collapsible: true, children: _jsx("p", { children: "Eu nisi dolore qui irure irure nulla aliqua commodo non sint dolor consectetur. Ullamco dolore ut exercitation ad cupidatat ipsum. Nisi proident esse nisi ullamco irure incididunt eiusmod fugiat est culpa Lorem. Dolor esse ut minim magna. In qui fugiat non nulla eu mollit enim excepteur consequat qui consequat occaecat aliquip adipisicing. Eu est nisi irure laboris culpa amet consectetur irure quis duis." }) }, 2),
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
//# sourceMappingURL=Section.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.stories.js","sourceRoot":"","sources":["../../../src/components/section/Section.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,IAAI,GAAyB;IACjC,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE;QACP,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,CAAC,mbAAQ,CAAC,CAA6Z,CAAC;KACnb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE;YACR,KAAC,OAAO,IAAS,KAAK,EAAC,eAAe,EAAC,WAAW,kBAChD,kbAA8Z,IADlZ,CAAC,CAEL;YACV,KAAC,OAAO,IAAS,KAAK,EAAC,eAAe,EAAC,WAAW,kBAChD,kbAA8Z,IADlZ,CAAC,CAEL;SACX;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.test.d.ts","sourceRoot":"","sources":["../../../src/components/section/Section.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { expect, test, describe, vi } from 'vitest';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
+
import { Section } from './Section';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Section component', () => {
|
|
7
|
+
test('renders basic section with children', () => {
|
|
8
|
+
render(_jsx(Section, { children: _jsx("p", { children: "Section content" }) }));
|
|
9
|
+
expect(screen.getByText('Section content')).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('renders section with title', () => {
|
|
12
|
+
render(_jsx(Section, { title: "Test Section", children: _jsx("p", { children: "Section content" }) }));
|
|
13
|
+
expect(screen.getByText('Test Section')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
test('renders section with title icon', () => {
|
|
16
|
+
render(_jsx(Section, { title: "Test Section", titleIconName: "info", titleIconScreenReaderText: "info icon", children: _jsx("p", { children: "Section content" }) }));
|
|
17
|
+
expect(screen.getByText('Test Section')).toBeInTheDocument();
|
|
18
|
+
// Icon should be rendered within the heading
|
|
19
|
+
const heading = screen.getByText('info icon');
|
|
20
|
+
expect(heading).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
test('renders section with button', () => {
|
|
23
|
+
const mockButtonClick = vi.fn();
|
|
24
|
+
render(_jsx(Section, { title: "Test Section", buttonText: "Click Me", buttonOnClick: mockButtonClick, buttonType: "primary", buttonSize: "M", children: _jsx("p", { children: "Section content" }) }));
|
|
25
|
+
const button = screen.getByText('Click Me');
|
|
26
|
+
expect(button).toBeInTheDocument();
|
|
27
|
+
fireEvent.click(button);
|
|
28
|
+
expect(mockButtonClick).toHaveBeenCalledTimes(1);
|
|
29
|
+
});
|
|
30
|
+
test('applies custom className', () => {
|
|
31
|
+
render(_jsx(Section, { className: "custom-section", children: _jsx("p", { children: "Section content" }) }));
|
|
32
|
+
const section = screen.getByRole('region');
|
|
33
|
+
expect(section).toHaveClass('ds-section', 'custom-section');
|
|
34
|
+
});
|
|
35
|
+
describe('collapsible functionality', () => {
|
|
36
|
+
test('renders collapsible section with chevron icon', () => {
|
|
37
|
+
render(_jsx(Section, { title: "Collapsible Section", collapsible: true, children: _jsx("p", { children: "Section content" }) }));
|
|
38
|
+
const section = screen.getByRole('region');
|
|
39
|
+
expect(section).toHaveClass('ds-section--collapsible');
|
|
40
|
+
// Should have chevron-up icon when not collapsed
|
|
41
|
+
expect(screen.getByText('Collapse section')).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
test('toggles collapsed state when header is clicked', () => {
|
|
44
|
+
render(_jsx(Section, { title: "Collapsible Section", collapsible: true, children: _jsx("p", { children: "Section content" }) }));
|
|
45
|
+
const heading = screen.getByRole('heading');
|
|
46
|
+
const contents = document.querySelector('.ds-section__contents');
|
|
47
|
+
// Initially not collapsed
|
|
48
|
+
expect(contents).not.toHaveClass('ds-section__contents--collapsed');
|
|
49
|
+
// Click to collapse
|
|
50
|
+
fireEvent.click(heading);
|
|
51
|
+
expect(contents).toHaveClass('ds-section__contents--collapsed');
|
|
52
|
+
// Click to expand
|
|
53
|
+
fireEvent.click(heading);
|
|
54
|
+
expect(contents).not.toHaveClass('ds-section__contents--collapsed');
|
|
55
|
+
});
|
|
56
|
+
test('starts collapsed when initially collapsed prop is true', () => {
|
|
57
|
+
render(_jsx(Section, { title: "Collapsible Section", collapsible: true, collapsed: true, children: _jsx("p", { children: "Section content" }) }));
|
|
58
|
+
const contents = document.querySelector('.ds-section__contents');
|
|
59
|
+
expect(contents).toHaveClass('ds-section__contents--collapsed');
|
|
60
|
+
});
|
|
61
|
+
test('heading has correct tabIndex for collapsible section', () => {
|
|
62
|
+
render(_jsx(Section, { title: "Collapsible Section", collapsible: true, children: _jsx("p", { children: "Section content" }) }));
|
|
63
|
+
const heading = screen.getByRole('heading');
|
|
64
|
+
expect(heading).toHaveAttribute('tabIndex', '0');
|
|
65
|
+
});
|
|
66
|
+
test('heading has tabIndex -1 for non-collapsible section', () => {
|
|
67
|
+
render(_jsx(Section, { title: "Non-collapsible Section", children: _jsx("p", { children: "Section content" }) }));
|
|
68
|
+
const heading = screen.getByRole('heading');
|
|
69
|
+
expect(heading).toHaveAttribute('tabIndex', '-1');
|
|
70
|
+
});
|
|
71
|
+
test('does not toggle when non-collapsible section header is clicked', () => {
|
|
72
|
+
render(_jsx(Section, { title: "Non-collapsible Section", children: _jsx("p", { children: "Section content" }) }));
|
|
73
|
+
const heading = screen.getByRole('heading');
|
|
74
|
+
const contents = document.querySelector('.ds-section__contents');
|
|
75
|
+
// Initially not collapsed
|
|
76
|
+
expect(contents).not.toHaveClass('ds-section__contents--collapsed');
|
|
77
|
+
// Click should not change state
|
|
78
|
+
fireEvent.click(heading);
|
|
79
|
+
expect(contents).not.toHaveClass('ds-section__contents--collapsed');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('nested sections', () => {
|
|
83
|
+
test('renders nested sections correctly', () => {
|
|
84
|
+
render(_jsxs(Section, { title: "Parent Section", collapsible: true, children: [_jsx("p", { children: "Parent content" }), _jsx(Section, { title: "Child Section 1", collapsible: true, children: _jsx("p", { children: "Child 1 content" }) }), _jsxs(Section, { title: "Child Section 2", children: [_jsx("p", { children: "Child 2 content" }), _jsx(Section, { title: "Grandchild Section", children: _jsx("p", { children: "Grandchild content" }) })] })] }));
|
|
85
|
+
// All titles should be present
|
|
86
|
+
expect(screen.getByText('Parent Section')).toBeInTheDocument();
|
|
87
|
+
expect(screen.getByText('Child Section 1')).toBeInTheDocument();
|
|
88
|
+
expect(screen.getByText('Child Section 2')).toBeInTheDocument();
|
|
89
|
+
expect(screen.getByText('Grandchild Section')).toBeInTheDocument();
|
|
90
|
+
// All content should be present
|
|
91
|
+
expect(screen.getByText('Parent content')).toBeInTheDocument();
|
|
92
|
+
expect(screen.getByText('Child 1 content')).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByText('Child 2 content')).toBeInTheDocument();
|
|
94
|
+
expect(screen.getByText('Grandchild content')).toBeInTheDocument();
|
|
95
|
+
// Should have multiple sections
|
|
96
|
+
const sections = document.querySelectorAll('.ds-section');
|
|
97
|
+
expect(sections).toHaveLength(4);
|
|
98
|
+
});
|
|
99
|
+
test('nested sections can be collapsed independently', () => {
|
|
100
|
+
render(_jsxs(Section, { title: "Parent Section", collapsible: true, children: [_jsx("p", { children: "Parent content" }), _jsx(Section, { title: "Child Section", collapsible: true, children: _jsx("p", { children: "Child content" }) })] }));
|
|
101
|
+
const allHeadings = screen.getAllByRole('heading');
|
|
102
|
+
const parentHeading = allHeadings[0];
|
|
103
|
+
const childHeading = allHeadings[1];
|
|
104
|
+
const allContents = document.querySelectorAll('.ds-section__contents');
|
|
105
|
+
const parentContents = allContents[0];
|
|
106
|
+
const childContents = allContents[1];
|
|
107
|
+
// Initially both expanded
|
|
108
|
+
expect(parentContents).not.toHaveClass('ds-section__contents--collapsed');
|
|
109
|
+
expect(childContents).not.toHaveClass('ds-section__contents--collapsed');
|
|
110
|
+
// Collapse child section
|
|
111
|
+
fireEvent.click(childHeading);
|
|
112
|
+
expect(parentContents).not.toHaveClass('ds-section__contents--collapsed');
|
|
113
|
+
expect(childContents).toHaveClass('ds-section__contents--collapsed');
|
|
114
|
+
// Collapse parent section
|
|
115
|
+
fireEvent.click(parentHeading);
|
|
116
|
+
expect(parentContents).toHaveClass('ds-section__contents--collapsed');
|
|
117
|
+
expect(childContents).toHaveClass('ds-section__contents--collapsed');
|
|
118
|
+
// Expand parent section (child should remain collapsed)
|
|
119
|
+
fireEvent.click(parentHeading);
|
|
120
|
+
expect(parentContents).not.toHaveClass('ds-section__contents--collapsed');
|
|
121
|
+
expect(childContents).toHaveClass('ds-section__contents--collapsed');
|
|
122
|
+
});
|
|
123
|
+
test('nested sections with different configurations', () => {
|
|
124
|
+
const parentButtonClick = vi.fn();
|
|
125
|
+
const childButtonClick = vi.fn();
|
|
126
|
+
render(_jsxs(Section, { title: "Parent Section", collapsible: true, buttonText: "Parent Action", buttonOnClick: parentButtonClick, titleIconName: "info", children: [_jsx("p", { children: "Parent content" }), _jsx(Section, { title: "Child Section", buttonText: "Child Action", buttonOnClick: childButtonClick, titleIconName: "file", children: _jsx("p", { children: "Child content" }) })] }));
|
|
127
|
+
// Both buttons should be present and functional
|
|
128
|
+
const parentButton = screen.getByText('Parent Action');
|
|
129
|
+
const childButton = screen.getByText('Child Action');
|
|
130
|
+
fireEvent.click(parentButton);
|
|
131
|
+
expect(parentButtonClick).toHaveBeenCalledTimes(1);
|
|
132
|
+
fireEvent.click(childButton);
|
|
133
|
+
expect(childButtonClick).toHaveBeenCalledTimes(1);
|
|
134
|
+
// Parent should be collapsible, child should not
|
|
135
|
+
const sections = document.querySelectorAll('.ds-section');
|
|
136
|
+
expect(sections[0]).toHaveClass('ds-section--collapsible');
|
|
137
|
+
expect(sections[1]).not.toHaveClass('ds-section--collapsible');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
describe('accessibility', () => {
|
|
141
|
+
test('section has proper role', () => {
|
|
142
|
+
render(_jsx(Section, { title: "Test Section", children: _jsx("p", { children: "Content" }) }));
|
|
143
|
+
expect(screen.getByRole('region')).toBeInTheDocument();
|
|
144
|
+
});
|
|
145
|
+
test('heading is focusable when collapsible', () => {
|
|
146
|
+
render(_jsx(Section, { title: "Collapsible Section", collapsible: true, children: _jsx("p", { children: "Content" }) }));
|
|
147
|
+
const heading = screen.getByRole('heading');
|
|
148
|
+
expect(heading).toHaveAttribute('tabIndex', '0');
|
|
149
|
+
});
|
|
150
|
+
test('heading is not focusable when not collapsible', () => {
|
|
151
|
+
render(_jsx(Section, { title: "Static Section", children: _jsx("p", { children: "Content" }) }));
|
|
152
|
+
const heading = screen.getByRole('heading');
|
|
153
|
+
expect(heading).toHaveAttribute('tabIndex', '-1');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=Section.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.test.js","sourceRoot":"","sources":["../../../src/components/section/Section.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC/C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EAAC,qBAAqB,EAAC,WAAW,kBAC9C,kCAAc,GACN,CACX,CAAC;YAEF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACzD,MAAM,CACJ,KAAC,OAAO,IAAC,KAAK,EAAC,gBAAgB,YAC7B,kCAAc,GACN,CACX,CAAC;YAEF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IconName } from '../icon/allowedIcons';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export type SlideoverProps = {
|
|
4
|
+
title?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
footerContents?: ReactNode;
|
|
7
|
+
headerIcon?: IconName;
|
|
8
|
+
centerHeaderText?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const Slideover: (props: SlideoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Slideover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slideover.d.ts","sourceRoot":"","sources":["../../../src/components/slideover/Slideover.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,4CAqB9C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Button } from '../button/Button';
|
|
4
|
+
import { Heading } from '../heading/Heading';
|
|
5
|
+
import { Icon } from '../icon/Icon';
|
|
6
|
+
import { SlideoverUtils } from '../../utils/SlideoverUtils';
|
|
7
|
+
export const Slideover = (props) => {
|
|
8
|
+
const { title, children, footerContents, headerIcon, centerHeaderText = true } = props;
|
|
9
|
+
return (_jsxs("aside", { className: "ds-slideover", children: [_jsxs("div", { className: classNames('ds-slideover__header', { 'ds-slideover__header--center': centerHeaderText }), children: [_jsxs(Button, { type: "tertiary", onClick: SlideoverUtils.removeSlideover, children: [_jsx(Icon, { name: "chevrons-left" }), "Back"] }), _jsxs(Heading, { level: 2, children: [title, headerIcon && _jsx(Icon, { name: headerIcon })] })] }), _jsx("div", { className: "ds-slideover__contents", children: children }), footerContents && _jsx("div", { className: "ds-slideover__footer", children: footerContents })] }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=Slideover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slideover.js","sourceRoot":"","sources":["../../../src/components/slideover/Slideover.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEvF,OAAO,CACL,iBAAO,SAAS,EAAC,cAAc,aAC7B,eAAK,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,CAAC,aACtG,MAAC,MAAM,IAAC,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,cAAc,CAAC,eAAe,aAC7D,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,GAAG,YAEtB,EACT,MAAC,OAAO,IAAC,KAAK,EAAE,CAAC,aACd,KAAK,EACL,UAAU,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,GAAI,IACjC,IACN,EAEN,cAAK,SAAS,EAAC,wBAAwB,YAAE,QAAQ,GAAO,EAEvD,cAAc,IAAI,cAAK,SAAS,EAAC,sBAAsB,YAAE,cAAc,GAAO,IACzE,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slideover.test.d.ts","sourceRoot":"","sources":["../../../src/components/slideover/Slideover.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { expect, test, describe, vi } from 'vitest';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
+
import { Slideover } from './Slideover';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
import { SlideoverUtils } from '../../utils/SlideoverUtils';
|
|
7
|
+
vi.mock('Utils/SlideoverUtils', () => ({
|
|
8
|
+
SlideoverUtils: {
|
|
9
|
+
removeSlideover: vi.fn(),
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
describe('Slideover', () => {
|
|
13
|
+
test('renders the title and children', () => {
|
|
14
|
+
render(_jsx(Slideover, { title: "My Test Slideover", children: _jsx("div", { children: "My Content" }) }));
|
|
15
|
+
expect(screen.getByText('My Test Slideover')).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByText('My Content')).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
test('renders footer contents when provided', () => {
|
|
19
|
+
render(_jsx(Slideover, { footerContents: _jsx("div", { children: "Footer Stuff" }) }));
|
|
20
|
+
expect(screen.getByText('Footer Stuff')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
test('does not render footer when footerContents is not provided', () => {
|
|
23
|
+
const { container } = render(_jsx(Slideover, {}));
|
|
24
|
+
expect(container.querySelector('.ds-slideover__footer')).not.toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
test('calls removeSlideover when the back button is clicked', () => {
|
|
27
|
+
render(_jsx(Slideover, {}));
|
|
28
|
+
const backButton = screen.getByRole('button', { name: /Back/i });
|
|
29
|
+
fireEvent.click(backButton);
|
|
30
|
+
expect(SlideoverUtils.removeSlideover).toHaveBeenCalled();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=Slideover.test.js.map
|