@dxc-technology/halstack-react 0.0.0-ff5083e → 0.0.0-ff6c8bf
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/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1240 -6
- package/HalstackContext.js +126 -111
- package/README.md +47 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +105 -160
- package/accordion/Accordion.stories.tsx +82 -148
- package/accordion/Accordion.test.js +25 -41
- package/accordion/types.d.ts +6 -17
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -2
- package/accordion-group/AccordionGroup.js +31 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.js +52 -105
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +12 -17
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +37 -127
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -42
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +64 -63
- package/bleed/types.d.ts +2 -2
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +19 -60
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -14
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +169 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.js +35 -63
- package/bulleted-list/BulletedList.stories.tsx +18 -106
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +64 -117
- package/button/Button.stories.tsx +151 -100
- package/button/Button.test.js +20 -17
- package/button/types.d.ts +12 -8
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +49 -89
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +139 -181
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.js +160 -39
- package/checkbox/types.d.ts +11 -3
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +45 -80
- package/chip/Chip.stories.tsx +107 -27
- package/chip/Chip.test.js +18 -33
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1392 -0
- package/common/variables.js +984 -1206
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +97 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +88 -0
- package/contextual-menu/ContextualMenu.stories.tsx +232 -0
- package/contextual-menu/ContextualMenu.test.js +205 -0
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +51 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +58 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.accessibility.test.js +228 -0
- package/date-input/DateInput.js +149 -299
- package/date-input/DateInput.stories.tsx +210 -56
- package/date-input/DateInput.test.js +700 -371
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -106
- package/dialog/Dialog.stories.tsx +326 -167
- package/dialog/Dialog.test.js +287 -20
- package/dialog/types.d.ts +18 -25
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +233 -303
- package/dropdown/Dropdown.stories.tsx +235 -57
- package/dropdown/Dropdown.test.js +575 -165
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +71 -0
- package/dropdown/types.d.ts +35 -19
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +241 -391
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.js +306 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +56 -117
- package/file-input/types.d.ts +25 -8
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +73 -118
- package/footer/Footer.stories.tsx +99 -21
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +54 -23
- package/footer/types.d.ts +26 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.accessibility.test.js +93 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +90 -183
- package/header/Header.stories.tsx +133 -38
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +5 -15
- package/header/types.d.ts +7 -21
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +5 -4
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +57 -119
- package/layout/ApplicationLayout.stories.tsx +81 -45
- package/layout/Icons.d.ts +7 -5
- package/layout/Icons.js +41 -59
- package/layout/types.d.ts +21 -32
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.js +32 -51
- package/link/Link.stories.tsx +76 -9
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -14
- package/main.d.ts +14 -12
- package/main.js +51 -88
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +7 -0
- package/{tabs-nav → nav-tabs}/NavTabs.js +30 -62
- package/nav-tabs/NavTabs.stories.tsx +279 -0
- package/nav-tabs/NavTabs.test.js +77 -0
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +117 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +15 -16
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.js +46 -36
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +860 -377
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +17 -5
- package/package.json +51 -51
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +35 -68
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +280 -211
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +7 -23
- package/paragraph/Paragraph.stories.tsx +1 -18
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +58 -127
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +160 -142
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +68 -92
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +39 -4
- package/progress-bar/ProgressBar.test.js +72 -44
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +24 -42
- package/quick-nav/QuickNav.stories.tsx +146 -27
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -76
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +68 -114
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +518 -457
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +171 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +168 -30
- package/resultset-table/ResultsetTable.test.js +381 -0
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +68 -65
- package/select/Option.js +35 -56
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.js +171 -214
- package/select/Select.stories.tsx +515 -190
- package/select/Select.test.js +1934 -1789
- package/select/types.d.ts +17 -21
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +132 -78
- package/sidenav/Sidenav.stories.tsx +246 -151
- package/sidenav/Sidenav.test.js +26 -45
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +149 -181
- package/slider/Slider.stories.tsx +64 -61
- package/slider/Slider.test.js +185 -81
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +34 -74
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +145 -126
- package/switch/Switch.stories.tsx +49 -60
- package/switch/Switch.test.js +138 -56
- package/switch/types.d.ts +7 -3
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.js +93 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +78 -35
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.js +95 -8
- package/table/types.d.ts +34 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +117 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +303 -141
- package/tabs/Tabs.stories.tsx +124 -6
- package/tabs/Tabs.test.js +213 -77
- package/tabs/types.d.ts +30 -20
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +35 -67
- package/tag/Tag.stories.tsx +18 -8
- package/tag/Tag.test.js +18 -37
- package/tag/types.d.ts +9 -9
- package/text-input/Suggestion.js +40 -28
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +94 -0
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +316 -515
- package/text-input/TextInput.stories.tsx +276 -276
- package/text-input/TextInput.test.js +1419 -1375
- package/text-input/types.d.ts +43 -16
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +71 -113
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +94 -107
- package/toggle-group/ToggleGroup.stories.tsx +52 -7
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +28 -19
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +16 -124
- package/typography/Typography.stories.tsx +185 -162
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1144 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +84 -1
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +34 -87
- package/wizard/Wizard.stories.tsx +59 -1
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +9 -9
- package/card/ice-cream.jpg +0 -0
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/paginator/Icons.js +0 -66
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.test.js +0 -306
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/table/Table.stories.jsx +0 -277
- package/tabs-nav/NavTabs.d.ts +0 -8
- package/tabs-nav/NavTabs.stories.tsx +0 -170
- package/tabs-nav/NavTabs.test.js +0 -82
- package/tabs-nav/Tab.js +0 -132
- package/textarea/Textarea.stories.jsx +0 -157
- package/typography/typographyContextTypes.d.ts +0 -16
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{row → breadcrumbs}/types.js +0 -0
- /package/{stack → container}/types.js +0 -0
- /package/{tabs-nav → contextual-menu}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → divider/types.js} +0 -0
- /package/{typography/typographyContextTypes.js → flex/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DxcAccordion from "./Accordion";
|
|
3
|
-
import DxcHeading from "../heading/Heading";
|
|
4
|
-
import DxcTextInput from "../text-input/TextInput";
|
|
5
|
-
import DxcButton from "../button/Button";
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
5
|
import { HalstackProvider } from "../HalstackContext";
|
|
@@ -12,38 +9,40 @@ export default {
|
|
|
12
9
|
component: DxcAccordion,
|
|
13
10
|
};
|
|
14
11
|
|
|
15
|
-
const
|
|
12
|
+
const smallIcon = (
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
|
|
14
|
+
<path d="m7.646 18.333-.313-2.625q-.208-.125-.458-.27-.25-.146-.458-.271l-2.438 1.021-2.354-4.063 2.083-1.583V9.458L1.625 7.875l2.354-4.063 2.438 1.021q.208-.125.458-.27.25-.146.458-.271l.313-2.625h4.708l.313 2.625q.208.125.458.271.25.145.458.27l2.438-1.021 2.354 4.063-2.063 1.583v1.084l2.063 1.583-2.354 4.063-2.438-1.021q-.208.125-.458.271-.25.145-.458.27l-.313 2.625ZM10 12.979q1.229 0 2.104-.875T12.979 10q0-1.229-.875-2.104T10 7.021q-1.229 0-2.104.875T7.021 10q0 1.229.875 2.104t2.104.875Zm0-1.75q-.5 0-.865-.364-.364-.365-.364-.865t.364-.865q.365-.364.865-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.166q.605-.167 1.167-.5.562-.334 1.021-.792l2.021.854.833-1.375-1.771-1.354q.104-.292.146-.604.042-.313.042-.646 0-.292-.042-.594t-.125-.635l1.771-1.375-.834-1.375-2.02.875q-.48-.479-1.032-.802-.552-.323-1.156-.49l-.271-2.187H9.167l-.271 2.187q-.604.167-1.156.49-.552.323-1.011.781l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.459.458 1.011.781.552.323 1.156.49Z" />
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const facebookIcon = (
|
|
16
19
|
<svg
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
version="1.1"
|
|
21
|
+
x="0px"
|
|
22
|
+
y="0px"
|
|
23
|
+
width="438.536px"
|
|
24
|
+
height="438.536px"
|
|
25
|
+
viewBox="0 0 438.536 438.536"
|
|
22
26
|
fill="currentColor"
|
|
23
27
|
>
|
|
24
28
|
<g>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
<path
|
|
30
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
31
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
32
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
33
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
34
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
35
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
36
|
+
/>
|
|
29
37
|
</g>
|
|
30
38
|
</svg>
|
|
31
39
|
);
|
|
32
40
|
|
|
33
|
-
const
|
|
34
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
35
|
-
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
36
|
-
<path d="M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z" />
|
|
37
|
-
</svg>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const advancedTheme = {
|
|
41
|
+
const opinionatedTheme = {
|
|
41
42
|
accordion: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
arrowColor: "#5f249f",
|
|
46
|
-
iconColor: "#5f249f",
|
|
43
|
+
accentColor: "#5f249f",
|
|
44
|
+
titleFontColor: "#000000",
|
|
45
|
+
assistiveTextFontColor: "#666666",
|
|
47
46
|
},
|
|
48
47
|
};
|
|
49
48
|
|
|
@@ -52,7 +51,7 @@ export const Chromatic = () => (
|
|
|
52
51
|
<Title title="Component anatomy" theme="light" level={2} />
|
|
53
52
|
<ExampleContainer>
|
|
54
53
|
<Title title="With label" theme="light" level={4} />
|
|
55
|
-
<DxcAccordion label="Accordion">
|
|
54
|
+
<DxcAccordion label="Accordion 1">
|
|
56
55
|
<div>
|
|
57
56
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
58
57
|
lobortis eget.
|
|
@@ -61,7 +60,7 @@ export const Chromatic = () => (
|
|
|
61
60
|
</ExampleContainer>
|
|
62
61
|
<ExampleContainer>
|
|
63
62
|
<Title title="With assistive text" theme="light" level={4} />
|
|
64
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text">
|
|
63
|
+
<DxcAccordion label="Accordion 2" assistiveText="Assistive text">
|
|
65
64
|
<div>
|
|
66
65
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
67
66
|
lobortis eget.
|
|
@@ -70,7 +69,16 @@ export const Chromatic = () => (
|
|
|
70
69
|
</ExampleContainer>
|
|
71
70
|
<ExampleContainer>
|
|
72
71
|
<Title title="With icon" theme="light" level={4} />
|
|
73
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon=
|
|
72
|
+
<DxcAccordion label="Accordion 3" assistiveText="Assistive text" icon="folder">
|
|
73
|
+
<div>
|
|
74
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
75
|
+
lobortis eget.
|
|
76
|
+
</div>
|
|
77
|
+
</DxcAccordion>
|
|
78
|
+
</ExampleContainer>
|
|
79
|
+
<ExampleContainer>
|
|
80
|
+
<Title title="With smaller icon" theme="light" level={4} />
|
|
81
|
+
<DxcAccordion label="Accordion 4" assistiveText="Assistive text" icon={smallIcon}>
|
|
74
82
|
<div>
|
|
75
83
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
76
84
|
lobortis eget.
|
|
@@ -78,8 +86,8 @@ export const Chromatic = () => (
|
|
|
78
86
|
</DxcAccordion>
|
|
79
87
|
</ExampleContainer>
|
|
80
88
|
<ExampleContainer>
|
|
81
|
-
<Title title="With bigger icon
|
|
82
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={
|
|
89
|
+
<Title title="With bigger icon (SVG)" theme="light" level={4} />
|
|
90
|
+
<DxcAccordion label="Accordion Test" assistiveText="Assistive text" icon={facebookIcon}>
|
|
83
91
|
<div>
|
|
84
92
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
85
93
|
lobortis eget.
|
|
@@ -116,128 +124,13 @@ export const Chromatic = () => (
|
|
|
116
124
|
</ExampleContainer>
|
|
117
125
|
<ExampleContainer>
|
|
118
126
|
<Title title="Disabled" theme="light" level={4} />
|
|
119
|
-
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon=
|
|
127
|
+
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon="folder" disabled>
|
|
120
128
|
<div>
|
|
121
129
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
122
130
|
lobortis eget.
|
|
123
131
|
</div>
|
|
124
132
|
</DxcAccordion>
|
|
125
133
|
</ExampleContainer>
|
|
126
|
-
<ExampleContainer>
|
|
127
|
-
<Title title="Background color provider over accordion content" theme="light" level={4} />
|
|
128
|
-
<HalstackProvider advancedTheme={advancedTheme}>
|
|
129
|
-
<DxcAccordion
|
|
130
|
-
label="Dark Accordion"
|
|
131
|
-
defaultIsExpanded
|
|
132
|
-
assistiveText="Assistive text"
|
|
133
|
-
icon={folderIcon}
|
|
134
|
-
padding="medium"
|
|
135
|
-
>
|
|
136
|
-
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
137
|
-
<DxcTextInput
|
|
138
|
-
label="Label"
|
|
139
|
-
helperText="HelperText"
|
|
140
|
-
placeholder="Placeholder"
|
|
141
|
-
size="fillParent"
|
|
142
|
-
margin={{ bottom: "medium" }}
|
|
143
|
-
/>
|
|
144
|
-
<DxcButton label="Submit" size="medium" />
|
|
145
|
-
</div>
|
|
146
|
-
</DxcAccordion>
|
|
147
|
-
</HalstackProvider>
|
|
148
|
-
</ExampleContainer>
|
|
149
|
-
<Title title="Paddings" theme="light" level={2} />
|
|
150
|
-
<ExampleContainer>
|
|
151
|
-
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
152
|
-
<DxcAccordion label="Xxsmall padding" defaultIsExpanded padding="xxsmall">
|
|
153
|
-
<div>
|
|
154
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
155
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
156
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
157
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
158
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
159
|
-
est laborum.
|
|
160
|
-
</div>
|
|
161
|
-
</DxcAccordion>
|
|
162
|
-
</ExampleContainer>
|
|
163
|
-
<ExampleContainer>
|
|
164
|
-
<Title title="Xsmall padding" theme="light" level={4} />
|
|
165
|
-
<DxcAccordion label="Xsmall padding" defaultIsExpanded padding="xsmall">
|
|
166
|
-
<div>
|
|
167
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
168
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
169
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
170
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
171
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
172
|
-
est laborum.
|
|
173
|
-
</div>
|
|
174
|
-
</DxcAccordion>
|
|
175
|
-
</ExampleContainer>
|
|
176
|
-
<ExampleContainer>
|
|
177
|
-
<Title title="Small padding" theme="light" level={4} />
|
|
178
|
-
<DxcAccordion label="Small padding" defaultIsExpanded padding="small">
|
|
179
|
-
<div>
|
|
180
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
181
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
182
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
183
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
184
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
185
|
-
est laborum.
|
|
186
|
-
</div>
|
|
187
|
-
</DxcAccordion>
|
|
188
|
-
</ExampleContainer>
|
|
189
|
-
<ExampleContainer>
|
|
190
|
-
<Title title="Medium padding" theme="light" level={4} />
|
|
191
|
-
<DxcAccordion label="Medium padding" defaultIsExpanded padding="medium">
|
|
192
|
-
<div>
|
|
193
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
194
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
195
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
196
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
197
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
198
|
-
est laborum.
|
|
199
|
-
</div>
|
|
200
|
-
</DxcAccordion>
|
|
201
|
-
</ExampleContainer>
|
|
202
|
-
<ExampleContainer>
|
|
203
|
-
<Title title="Large padding" theme="light" level={4} />
|
|
204
|
-
<DxcAccordion label="Large padding" defaultIsExpanded padding="large">
|
|
205
|
-
<div>
|
|
206
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
207
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
208
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
209
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
210
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
211
|
-
est laborum.
|
|
212
|
-
</div>
|
|
213
|
-
</DxcAccordion>
|
|
214
|
-
</ExampleContainer>
|
|
215
|
-
<ExampleContainer>
|
|
216
|
-
<Title title="Xlarge padding" theme="light" level={4} />
|
|
217
|
-
<DxcAccordion label="Xlarge padding" defaultIsExpanded padding="xlarge">
|
|
218
|
-
<div>
|
|
219
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
220
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
221
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
222
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
223
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
224
|
-
est laborum.
|
|
225
|
-
</div>
|
|
226
|
-
</DxcAccordion>
|
|
227
|
-
</ExampleContainer>
|
|
228
|
-
<ExampleContainer>
|
|
229
|
-
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
230
|
-
<DxcAccordion label="Xxlarge padding" defaultIsExpanded padding="xxlarge">
|
|
231
|
-
<div>
|
|
232
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
233
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
234
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
235
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
236
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
237
|
-
est laborum.
|
|
238
|
-
</div>
|
|
239
|
-
</DxcAccordion>
|
|
240
|
-
</ExampleContainer>
|
|
241
134
|
<Title title="Margins" theme="light" level={2} />
|
|
242
135
|
<ExampleContainer>
|
|
243
136
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
@@ -301,7 +194,48 @@ export const Chromatic = () => (
|
|
|
301
194
|
lobortis eget.
|
|
302
195
|
</div>
|
|
303
196
|
</DxcAccordion>
|
|
304
|
-
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
199
|
+
<ExampleContainer>
|
|
200
|
+
<Title title="With assistive text and icon" theme="light" level={4} />
|
|
201
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
202
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon="folder">
|
|
203
|
+
Content
|
|
204
|
+
</DxcAccordion>
|
|
205
|
+
</HalstackProvider>
|
|
206
|
+
</ExampleContainer>
|
|
207
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
208
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
209
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
210
|
+
<DxcAccordion label="Hovered">
|
|
211
|
+
<div>
|
|
212
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
213
|
+
leo lobortis eget.
|
|
214
|
+
</div>
|
|
215
|
+
</DxcAccordion>
|
|
216
|
+
</HalstackProvider>
|
|
217
|
+
</ExampleContainer>
|
|
218
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
219
|
+
<Title title="Active" theme="light" level={4} />
|
|
220
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
221
|
+
<DxcAccordion label="Active">
|
|
222
|
+
<div>
|
|
223
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
224
|
+
leo lobortis eget.
|
|
225
|
+
</div>
|
|
226
|
+
</DxcAccordion>
|
|
227
|
+
</HalstackProvider>
|
|
228
|
+
</ExampleContainer>
|
|
229
|
+
<ExampleContainer>
|
|
230
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
231
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
232
|
+
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon="folder" disabled>
|
|
233
|
+
<div>
|
|
234
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
235
|
+
leo lobortis eget.
|
|
236
|
+
</div>
|
|
237
|
+
</DxcAccordion>
|
|
238
|
+
</HalstackProvider>
|
|
305
239
|
</ExampleContainer>
|
|
306
240
|
</>
|
|
307
241
|
);
|
|
@@ -1,69 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
var _Accordion = _interopRequireDefault(require("./Accordion"));
|
|
10
|
-
|
|
6
|
+
var _Accordion = _interopRequireDefault(require("./Accordion.tsx"));
|
|
11
7
|
describe("Accordion component tests", function () {
|
|
12
|
-
test("
|
|
13
|
-
var onChange = jest.fn();
|
|
14
|
-
|
|
8
|
+
test("Renders with correct aria accessibility attributes", function () {
|
|
15
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
10
|
+
label: "Accordion",
|
|
11
|
+
defaultIsExpanded: true
|
|
12
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))),
|
|
13
|
+
getByRole = _render.getByRole;
|
|
14
|
+
var accordion = getByRole("button");
|
|
15
|
+
var panel = getByRole("region");
|
|
16
|
+
expect(accordion.getAttribute("aria-controls")).toBe(panel.id);
|
|
17
|
+
expect(panel.getAttribute("aria-labelledby")).toBe(accordion.id);
|
|
24
18
|
});
|
|
25
|
-
test("
|
|
19
|
+
test("Renders expanded by default when it is uncontrolled", function () {
|
|
26
20
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
label: "Accordion",
|
|
22
|
+
defaultIsExpanded: true
|
|
23
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))),
|
|
24
|
+
getByRole = _render2.getByRole;
|
|
32
25
|
var accordion = getByRole("button");
|
|
33
26
|
expect(accordion.getAttribute("aria-expanded")).toBe("true");
|
|
34
27
|
});
|
|
35
28
|
test("Calls correct function on click", function () {
|
|
36
29
|
var onChange = jest.fn();
|
|
37
|
-
|
|
38
30
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
label: "Accordion",
|
|
32
|
+
onChange: onChange
|
|
33
|
+
})),
|
|
34
|
+
getByText = _render3.getByText;
|
|
44
35
|
_react2.fireEvent.click(getByText("Accordion"));
|
|
45
|
-
|
|
46
36
|
expect(onChange).toHaveBeenCalled();
|
|
47
37
|
});
|
|
48
38
|
test("Controlled accordion", function () {
|
|
49
39
|
var onChange = jest.fn();
|
|
50
|
-
|
|
51
40
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
label: "Accordion",
|
|
42
|
+
onChange: onChange,
|
|
43
|
+
isExpanded: true
|
|
44
|
+
})),
|
|
45
|
+
getByText = _render4.getByText,
|
|
46
|
+
getByRole = _render4.getByRole;
|
|
59
47
|
expect(getByRole("button").getAttribute("aria-expanded")).toBe("true");
|
|
60
|
-
|
|
61
48
|
_react2.fireEvent.click(getByText("Accordion"));
|
|
62
|
-
|
|
63
49
|
_react2.fireEvent.click(getByText("Accordion"));
|
|
64
|
-
|
|
65
50
|
_react2.fireEvent.click(getByText("Accordion"));
|
|
66
|
-
|
|
67
51
|
expect(onChange).toHaveBeenCalledTimes(3);
|
|
68
52
|
expect(onChange.mock.calls[0][0]).toBe(false);
|
|
69
53
|
expect(onChange.mock.calls[1][0]).toBe(false);
|
package/accordion/types.d.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
bottom?: Space;
|
|
12
|
-
left?: Space;
|
|
13
|
-
right?: Space;
|
|
14
|
-
};
|
|
15
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
16
|
-
declare type Props = {
|
|
9
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
+
type Props = {
|
|
17
11
|
/**
|
|
18
12
|
* The panel label.
|
|
19
13
|
*/
|
|
@@ -29,7 +23,7 @@ declare type Props = {
|
|
|
29
23
|
*/
|
|
30
24
|
isExpanded?: boolean;
|
|
31
25
|
/**
|
|
32
|
-
*
|
|
26
|
+
* Material Symbol name or SVG element used as the icon that will be placed next to panel label.
|
|
33
27
|
*/
|
|
34
28
|
icon?: string | SVG;
|
|
35
29
|
/**
|
|
@@ -56,12 +50,7 @@ declare type Props = {
|
|
|
56
50
|
*/
|
|
57
51
|
margin?: Space | Margin;
|
|
58
52
|
/**
|
|
59
|
-
*
|
|
60
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
61
|
-
*/
|
|
62
|
-
padding?: Space | Padding;
|
|
63
|
-
/**
|
|
64
|
-
* Value of the tabindex.
|
|
53
|
+
* Value of the tabindex attribute.
|
|
65
54
|
*/
|
|
66
55
|
tabIndex?: number;
|
|
67
56
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _AccordionGroup = _interopRequireDefault(require("./AccordionGroup.tsx"));
|
|
9
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
10
|
+
var folderIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
enableBackground: "new 0 0 24 24",
|
|
13
|
+
height: "24px",
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
width: "24px",
|
|
16
|
+
fill: "currentColor"
|
|
17
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
18
|
+
fill: "none",
|
|
19
|
+
height: "24",
|
|
20
|
+
width: "24"
|
|
21
|
+
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
22
|
+
d: "M20,6h-8l-2-2H4C2.9,4,2.01,4.9,2.01,6L2,18c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8C22,6.9,21.1,6,20,6z M16,16h2v-2h-2v-2 h2v-2h-2V8h4v10h-4V16z M16,16h-2v2H4V6h5.17l2,2H14v2h2v2h-2v2h2V16z"
|
|
23
|
+
})));
|
|
24
|
+
describe("Accordion component accessibility tests", function () {
|
|
25
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
26
|
+
var _render, container, results;
|
|
27
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"], {
|
|
31
|
+
defaultIndexActive: 1
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"].Accordion, {
|
|
33
|
+
label: "Accordion1",
|
|
34
|
+
assistiveText: "Assistive Text1",
|
|
35
|
+
icon: folderIcon,
|
|
36
|
+
margin: "small",
|
|
37
|
+
defaultIsExpanded: true
|
|
38
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "First accordion")), /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"].Accordion, {
|
|
39
|
+
label: "Accordion2",
|
|
40
|
+
assistiveText: "Assistive Text2",
|
|
41
|
+
icon: folderIcon,
|
|
42
|
+
margin: "small",
|
|
43
|
+
defaultIsExpanded: true
|
|
44
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Second accordion")))), container = _render.container;
|
|
45
|
+
_context.next = 3;
|
|
46
|
+
return (0, _axeHelper.axe)(container);
|
|
47
|
+
case 3:
|
|
48
|
+
results = _context.sent;
|
|
49
|
+
expect(results).toHaveNoViolations();
|
|
50
|
+
case 5:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
})));
|
|
56
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
57
|
+
var _render2, container, results;
|
|
58
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
59
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"], {
|
|
62
|
+
defaultIndexActive: 1,
|
|
63
|
+
disabled: true
|
|
64
|
+
}, /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"].Accordion, {
|
|
65
|
+
label: "Accordion1",
|
|
66
|
+
assistiveText: "Assistive Text1",
|
|
67
|
+
icon: folderIcon,
|
|
68
|
+
margin: "small",
|
|
69
|
+
defaultIsExpanded: true
|
|
70
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "First accordion")), /*#__PURE__*/_react["default"].createElement(_AccordionGroup["default"].Accordion, {
|
|
71
|
+
label: "Accordion2",
|
|
72
|
+
assistiveText: "Assistive Text2",
|
|
73
|
+
icon: folderIcon,
|
|
74
|
+
margin: "small",
|
|
75
|
+
defaultIsExpanded: true
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Second accordion")))), container = _render2.container;
|
|
77
|
+
_context2.next = 3;
|
|
78
|
+
return (0, _axeHelper.axe)(container);
|
|
79
|
+
case 3:
|
|
80
|
+
results = _context2.sent;
|
|
81
|
+
expect(results).toHaveNoViolations();
|
|
82
|
+
case 5:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee2);
|
|
87
|
+
})));
|
|
88
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import AccordionGroupPropsType
|
|
2
|
+
import AccordionGroupPropsType from "./types";
|
|
3
3
|
declare const DxcAccordionGroup: {
|
|
4
4
|
({ defaultIndexActive, indexActive, disabled, onActiveChange, margin, children, }: AccordionGroupPropsType): JSX.Element;
|
|
5
|
-
Accordion: ({ ...childProps }: AccordionPropsType) => JSX.Element;
|
|
5
|
+
Accordion: ({ ...childProps }: import("./types").AccordionPropsType) => JSX.Element;
|
|
6
6
|
};
|
|
7
7
|
export default DxcAccordionGroup;
|