@dxc-technology/halstack-react 10.1.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +4 -21
- package/HalstackContext.d.ts +45 -143
- package/HalstackContext.js +10 -35
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +33 -84
- package/accordion/Accordion.stories.tsx +8 -64
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +6 -6
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +17 -44
- package/accordion-group/AccordionGroup.stories.tsx +24 -24
- package/accordion-group/AccordionGroup.test.js +42 -60
- package/accordion-group/AccordionGroupAccordion.js +11 -23
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +7 -7
- 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 +34 -120
- package/alert/Alert.test.js +28 -45
- 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/types.d.ts +2 -2
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +11 -33
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -3
- 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/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.js +22 -55
- package/bulleted-list/BulletedList.stories.tsx +2 -93
- package/bulleted-list/types.d.ts +5 -5
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +36 -59
- package/button/Button.stories.tsx +35 -135
- package/button/Button.test.js +13 -21
- package/button/types.d.ts +5 -5
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.js +23 -45
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +5 -5
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +88 -123
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +22 -36
- package/chip/Chip.stories.tsx +10 -25
- package/chip/Chip.test.js +17 -30
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +40 -23
- package/common/utils.js +2 -8
- package/common/variables.d.ts +46 -144
- package/common/variables.js +120 -225
- 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/container/types.js +5 -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/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +13 -57
- package/date-input/DateInput.accessibility.test.js +228 -0
- package/date-input/DateInput.js +53 -100
- package/date-input/DateInput.stories.tsx +19 -31
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +23 -48
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +28 -22
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +21 -59
- package/dialog/Dialog.stories.tsx +176 -0
- package/dialog/Dialog.test.js +126 -188
- package/dialog/types.d.ts +18 -13
- 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/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.js +63 -130
- package/dropdown/Dropdown.stories.tsx +15 -26
- package/dropdown/Dropdown.test.js +402 -389
- package/dropdown/DropdownMenu.js +12 -23
- package/dropdown/DropdownMenuItem.js +13 -21
- package/dropdown/types.d.ts +20 -24
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.js +180 -284
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +279 -354
- package/file-input/FileItem.js +29 -66
- package/file-input/types.d.ts +9 -9
- package/flex/Flex.js +25 -39
- package/flex/types.d.ts +6 -6
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +43 -68
- package/footer/Footer.stories.tsx +58 -2
- package/footer/Footer.test.js +18 -32
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +53 -22
- package/footer/types.d.ts +17 -17
- package/grid/Grid.js +1 -16
- package/grid/types.d.ts +10 -10
- package/header/Header.accessibility.test.js +93 -0
- package/header/Header.d.ts +1 -1
- package/header/Header.js +38 -104
- package/header/Header.stories.tsx +16 -0
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +3 -13
- package/header/types.d.ts +7 -8
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- 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 +2 -2
- package/image/Image.js +17 -32
- package/image/Image.stories.tsx +3 -1
- package/image/types.d.ts +2 -2
- package/inset/Inset.js +13 -21
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +23 -60
- package/layout/Icons.d.ts +4 -5
- package/layout/Icons.js +2 -16
- package/layout/types.d.ts +3 -3
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.js +28 -47
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +8 -4
- package/main.js +39 -60
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +19 -48
- package/nav-tabs/NavTabs.stories.tsx +30 -25
- package/nav-tabs/NavTabs.test.js +45 -50
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +38 -67
- package/nav-tabs/types.d.ts +10 -10
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +47 -39
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +839 -575
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +17 -5
- package/package.json +41 -37
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +27 -52
- package/paginator/Paginator.test.js +224 -207
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.js +3 -19
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +32 -54
- package/password-input/PasswordInput.stories.tsx +1 -34
- package/password-input/PasswordInput.test.js +153 -129
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +26 -56
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +22 -54
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +38 -83
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +45 -69
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +118 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Listbox.js +40 -54
- package/select/Option.js +28 -36
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.js +107 -171
- package/select/Select.stories.tsx +59 -111
- package/select/Select.test.js +1895 -1858
- package/select/types.d.ts +15 -16
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +44 -81
- package/sidenav/Sidenav.stories.tsx +4 -9
- package/sidenav/Sidenav.test.js +3 -10
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +20 -20
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.js +70 -126
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +21 -55
- package/spinner/Spinner.test.js +25 -34
- 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.js +49 -97
- package/switch/Switch.stories.tsx +12 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- 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 +76 -33
- package/table/{Table.stories.jsx → Table.stories.tsx} +309 -2
- package/table/Table.test.js +93 -6
- package/table/types.d.ts +34 -6
- package/tabs/Tab.js +22 -37
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +59 -147
- package/tabs/Tabs.stories.tsx +8 -4
- package/tabs/Tabs.test.js +57 -131
- package/tabs/types.d.ts +21 -21
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +27 -57
- package/tag/Tag.stories.tsx +4 -7
- package/tag/Tag.test.js +17 -36
- package/tag/types.d.ts +9 -9
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +30 -70
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +203 -289
- package/text-input/TextInput.stories.tsx +65 -160
- package/text-input/TextInput.test.js +1227 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +68 -109
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +25 -64
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +48 -81
- package/toggle-group/types.d.ts +12 -12
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +43 -141
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +25 -39
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +27 -73
- package/wizard/Wizard.stories.tsx +19 -0
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +8 -8
- package/common/OpenSans.css +0 -69
- 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/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -75
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -54
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -39
- package/resultsetTable/Icons.d.ts +0 -7
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -51
- package/slider/Slider.stories.tsx +0 -240
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -60
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
package/HalstackContext.js
CHANGED
|
@@ -1,36 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = exports.HalstackProvider = exports.HalstackLanguageContext = void 0;
|
|
11
|
-
|
|
12
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _color = _interopRequireDefault(require("color"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _variables = require("./common/variables");
|
|
21
|
-
|
|
22
14
|
var _templateObject;
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
28
17
|
var HalstackContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
29
|
-
|
|
30
|
-
var HalstackLanguageContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
31
|
-
|
|
32
|
-
exports.HalstackLanguageContext = HalstackLanguageContext;
|
|
33
|
-
|
|
18
|
+
var HalstackLanguageContext = exports.HalstackLanguageContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
34
19
|
var addLightness = function addLightness(newLightness, hexColor) {
|
|
35
20
|
try {
|
|
36
21
|
if (hexColor) {
|
|
@@ -43,7 +28,6 @@ var addLightness = function addLightness(newLightness, hexColor) {
|
|
|
43
28
|
return null;
|
|
44
29
|
}
|
|
45
30
|
};
|
|
46
|
-
|
|
47
31
|
var subLightness = function subLightness(newLightness, hexColor) {
|
|
48
32
|
try {
|
|
49
33
|
if (hexColor) {
|
|
@@ -56,7 +40,6 @@ var subLightness = function subLightness(newLightness, hexColor) {
|
|
|
56
40
|
return null;
|
|
57
41
|
}
|
|
58
42
|
};
|
|
59
|
-
|
|
60
43
|
var parseAdvancedTheme = function parseAdvancedTheme(advancedTheme) {
|
|
61
44
|
var allTokensCopy = JSON.parse(JSON.stringify(_variables.componentTokens));
|
|
62
45
|
Object.keys(allTokensCopy).map(function (component) {
|
|
@@ -70,10 +53,8 @@ var parseAdvancedTheme = function parseAdvancedTheme(advancedTheme) {
|
|
|
70
53
|
});
|
|
71
54
|
return allTokensCopy;
|
|
72
55
|
};
|
|
73
|
-
|
|
74
56
|
var parseTheme = function parseTheme(theme) {
|
|
75
57
|
var _theme$alert$baseColo, _theme$alert, _theme$alert$accentCo, _theme$alert2, _theme$alert$accentCo2, _theme$alert3, _theme$alert$overlayC, _theme$alert4, _theme$accordion$assi, _theme$accordion, _theme$accordion$titl, _theme$accordion2, _theme$accordion$acce, _theme$accordion3, _theme$accordion$acce2, _theme$accordion4, _addLightness, _theme$accordion5, _theme$box$baseColor, _theme$box, _theme$button$primary, _theme$button, _theme$button$baseCol, _theme$button2, _theme$button$baseCol2, _theme$button3, _theme$button$seconda, _theme$button4, _theme$button$baseCol3, _theme$button5, _theme$button$baseCol4, _theme$button6, _theme$button$baseCol5, _theme$button7, _subLightness, _theme$button8, _subLightness2, _theme$button9, _subLightness3, _theme$button10, _addLightness2, _theme$button11, _addLightness3, _theme$button12, _theme$checkbox$baseC, _theme$checkbox, _theme$checkbox$baseC2, _theme$checkbox2, _theme$checkbox$check, _theme$checkbox3, _theme$checkbox$fontC, _theme$checkbox4, _subLightness4, _theme$checkbox5, _subLightness5, _theme$checkbox6, _theme$chip$baseColor, _theme$chip, _theme$chip$fontColor, _theme$chip2, _theme$chip$iconColor, _theme$chip3, _subLightness6, _theme$chip4, _subLightness7, _theme$chip5, _theme$dateInput$base, _theme$dateInput, _theme$dateInput$sele, _theme$dateInput2, _subLightness8, _theme$dateInput3, _theme$dateInput$sele2, _theme$dateInput4, _theme$dateInput$base2, _theme$dateInput5, _subLightness9, _theme$dateInput6, _theme$dateInput$sele3, _theme$dateInput7, _addLightness4, _theme$dateInput8, _addLightness5, _theme$dateInput9, _addLightness6, _theme$dateInput10, _theme$dialog$baseCol, _theme$dialog, _theme$dialog$closeIc, _theme$dialog2, _theme$dialog$overlay, _theme$dialog3, _theme$dropdown$baseC, _theme$dropdown, _theme$dropdown$fontC, _theme$dropdown2, _theme$dropdown$fontC2, _theme$dropdown3, _theme$dropdown$fontC3, _theme$dropdown4, _theme$dropdown$optio, _theme$dropdown5, _theme$dropdown$optio2, _theme$dropdown6, _subLightness10, _theme$dropdown7, _subLightness11, _theme$dropdown8, _subLightness12, _theme$dropdown9, _subLightness13, _theme$dropdown10, _theme$fileInput$font, _theme$fileInput, _theme$fileInput$font2, _theme$fileInput2, _theme$fileInput$font3, _theme$fileInput3, _theme$fileInput$font4, _theme$fileInput4, _theme$footer$baseCol, _theme$footer, _theme$footer$fontCol, _theme$footer2, _theme$footer$fontCol2, _theme$footer3, _theme$footer$fontCol3, _theme$footer4, _theme$footer$accentC, _theme$footer5, _theme$footer$logo, _theme$footer6, _theme$header$baseCol, _theme$header, _theme$header$accentC, _theme$header2, _theme$header$menuBas, _theme$header3, _theme$header$fontCol, _theme$header4, _theme$header$hamburg, _theme$header5, _addLightness7, _theme$header6, _theme$header$logo, _theme$header7, _theme$header$logoRes, _theme$header8, _theme$header$content, _theme$header9, _theme$header$overlay, _theme$header10, _theme$link$baseColor, _theme$link, _theme$link$baseColor2, _theme$link2, _theme$navTabs$baseCo, _theme$navTabs, _theme$navTabs$baseCo2, _theme$navTabs2, _theme$navTabs$baseCo3, _theme$navTabs3, _theme$navTabs$baseCo4, _theme$navTabs4, _theme$navTabs$accent, _theme$navTabs5, _addLightness8, _theme$navTabs6, _addLightness9, _theme$navTabs7, _theme$paginator$base, _theme$paginator, _theme$paginator$font, _theme$paginator2, _theme$progressBar$ac, _theme$progressBar, _theme$progressBar$ba, _theme$progressBar2, _theme$progressBar$fo, _theme$progressBar3, _theme$progressBar$fo2, _theme$progressBar4, _theme$progressBar$fo3, _theme$progressBar5, _theme$progressBar$ov, _theme$progressBar6, _theme$progressBar$ov2, _theme$progressBar7, _theme$quickNav$fontC, _theme$quickNav, _theme$quickNav$accen, _theme$quickNav2, _theme$radioGroup$bas, _theme$radioGroup, _theme$radioGroup$fon, _theme$radioGroup2, _theme$radioGroup$fon2, _theme$radioGroup3, _theme$radioGroup$fon3, _theme$radioGroup4, _subLightness14, _theme$radioGroup5, _subLightness15, _theme$radioGroup6, _theme$select$selecte, _theme$select, _theme$select$fontCol, _theme$select2, _theme$select$fontCol2, _theme$select3, _theme$select$fontCol3, _theme$select4, _theme$select$optionF, _theme$select5, _addLightness10, _theme$select6, _theme$select$fontCol4, _theme$select7, _theme$select$hoverBo, _theme$select8, _subLightness16, _theme$select9, _subLightness17, _theme$select10, _theme$sidenav$baseCo, _theme$sidenav, _theme$slider$fontCol, _theme$slider, _theme$slider$fontCol2, _theme$slider2, _theme$slider$fontCol3, _theme$slider3, _theme$slider$baseCol, _theme$slider4, _theme$slider$baseCol2, _theme$slider5, _theme$slider$baseCol3, _theme$slider6, _theme$slider$baseCol4, _theme$slider7, _theme$slider$totalLi, _theme$slider8, _subLightness18, _theme$slider9, _subLightness19, _theme$slider10, _theme$spinner$accent, _theme$spinner, _theme$spinner$baseCo, _theme$spinner2, _theme$spinner$overla, _theme$spinner3, _theme$spinner$fontCo, _theme$spinner4, _theme$spinner$fontCo2, _theme$spinner5, _theme$spinner$overla2, _theme$spinner6, _theme$spinner$overla3, _theme$spinner7, _theme$switch$checked, _theme$switch, _theme$switch$fontCol, _theme$switch2, _addLightness11, _theme$switch3, _theme$table$baseColo, _theme$table, _theme$table$headerFo, _theme$table2, _theme$table$cellFont, _theme$table3, _theme$table$headerFo2, _theme$table4, _theme$tabs$baseColor, _theme$tabs, _theme$tabs$baseColor2, _theme$tabs2, _theme$tabs$baseColor3, _theme$tabs3, _theme$tabs$baseColor4, _theme$tabs4, _addLightness12, _theme$tabs5, _addLightness13, _theme$tabs6, _theme$tag$fontColor, _theme$tag, _theme$tag$iconColor, _theme$tag2, _theme$textInput$font, _theme$textInput, _theme$textInput$font2, _theme$textInput2, _theme$textInput$font3, _theme$textInput3, _theme$textInput$font4, _theme$textInput4, _theme$textInput$font5, _theme$textInput5, _theme$textInput$font6, _theme$textInput6, _theme$textInput$font7, _theme$textInput7, _theme$textInput$hove, _theme$textInput8, _addLightness14, _theme$textInput9, _addLightness15, _theme$textInput10, _addLightness16, _theme$textInput11, _theme$textarea$fontC, _theme$textarea, _theme$textarea$fontC2, _theme$textarea2, _theme$textarea$fontC3, _theme$textarea3, _theme$textarea$hover, _theme$textarea4, _addLightness17, _theme$textarea5, _theme$toggleGroup$se, _theme$toggleGroup, _theme$toggleGroup$se2, _theme$toggleGroup2, _theme$toggleGroup$un, _theme$toggleGroup3, _theme$toggleGroup$se3, _theme$toggleGroup4, _theme$toggleGroup$un2, _theme$toggleGroup5, _subLightness20, _theme$toggleGroup6, _subLightness21, _theme$toggleGroup7, _addLightness18, _theme$toggleGroup8, _addLightness19, _theme$toggleGroup9, _subLightness22, _theme$toggleGroup10, _theme$wizard$baseCol, _theme$wizard, _theme$wizard$selecte, _theme$wizard2, _theme$wizard$baseCol2, _theme$wizard3, _theme$wizard$fontCol, _theme$wizard4, _theme$wizard$fontCol2, _theme$wizard5, _theme$wizard$fontCol3, _theme$wizard6, _theme$wizard$fontCol4, _theme$wizard7, _addLightness20, _theme$wizard8, _addLightness21, _theme$wizard9, _addLightness22, _theme$wizard10, _addLightness23, _theme$wizard11;
|
|
76
|
-
|
|
77
58
|
var componentTokensCopy = JSON.parse(JSON.stringify(_variables.componentTokens));
|
|
78
59
|
var alertTokens = componentTokensCopy.alert;
|
|
79
60
|
alertTokens.infoBackgroundColor = (_theme$alert$baseColo = theme === null || theme === void 0 ? void 0 : (_theme$alert = theme.alert) === null || _theme$alert === void 0 ? void 0 : _theme$alert.baseColor) !== null && _theme$alert$baseColo !== void 0 ? _theme$alert$baseColo : alertTokens.infoBackgroundColor;
|
|
@@ -289,7 +270,6 @@ var parseTheme = function parseTheme(theme) {
|
|
|
289
270
|
wizardTokens.unvisitedHelperTextFontColor = (_addLightness23 = addLightness(40, theme === null || theme === void 0 ? void 0 : (_theme$wizard11 = theme.wizard) === null || _theme$wizard11 === void 0 ? void 0 : _theme$wizard11.fontColor)) !== null && _addLightness23 !== void 0 ? _addLightness23 : wizardTokens.unvisitedHelperTextFontColor;
|
|
290
271
|
return componentTokensCopy;
|
|
291
272
|
};
|
|
292
|
-
|
|
293
273
|
var parseLabels = function parseLabels(labels) {
|
|
294
274
|
var parsedLabels = _variables.defaultTranslatedComponentLabels;
|
|
295
275
|
Object.keys(labels).map(function (component) {
|
|
@@ -303,17 +283,17 @@ var parseLabels = function parseLabels(labels) {
|
|
|
303
283
|
});
|
|
304
284
|
return parsedLabels;
|
|
305
285
|
};
|
|
286
|
+
|
|
306
287
|
/**
|
|
307
288
|
* This type is used to allow partial themes and labels objects to be passed to the HalstackProvider.
|
|
308
289
|
* This is an extension of the already existing Partial type, which only allows one level of partiality.
|
|
309
290
|
*/
|
|
310
291
|
|
|
311
|
-
|
|
312
|
-
var HalstackProvider = function HalstackProvider(_ref) {
|
|
292
|
+
var HalstackProvider = exports.HalstackProvider = function HalstackProvider(_ref) {
|
|
313
293
|
var theme = _ref.theme,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
294
|
+
advancedTheme = _ref.advancedTheme,
|
|
295
|
+
labels = _ref.labels,
|
|
296
|
+
children = _ref.children;
|
|
317
297
|
var parsedTheme = (0, _react.useMemo)(function () {
|
|
318
298
|
return theme ? parseTheme(theme) : advancedTheme ? parseAdvancedTheme(advancedTheme) : _variables.componentTokens;
|
|
319
299
|
}, [theme, advancedTheme]);
|
|
@@ -326,10 +306,5 @@ var HalstackProvider = function HalstackProvider(_ref) {
|
|
|
326
306
|
value: parsedLabels
|
|
327
307
|
}, children)));
|
|
328
308
|
};
|
|
329
|
-
|
|
330
|
-
exports
|
|
331
|
-
|
|
332
|
-
var Halstack = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n @import url(\"https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap\");\n"])));
|
|
333
|
-
|
|
334
|
-
var _default = HalstackContext;
|
|
335
|
-
exports["default"] = _default;
|
|
309
|
+
var Halstack = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n @import url(\"https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap\");\n @import url(\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1\");\n"])));
|
|
310
|
+
var _default = exports["default"] = HalstackContext;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 _Accordion = _interopRequireDefault(require("./Accordion.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(_Accordion["default"], {
|
|
31
|
+
label: "Accordion",
|
|
32
|
+
assistiveText: "Assistive Text",
|
|
33
|
+
icon: folderIcon,
|
|
34
|
+
margin: "small",
|
|
35
|
+
defaultIsExpanded: true
|
|
36
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))), container = _render.container;
|
|
37
|
+
_context.next = 3;
|
|
38
|
+
return (0, _axeHelper.axe)(container);
|
|
39
|
+
case 3:
|
|
40
|
+
results = _context.sent;
|
|
41
|
+
expect(results).toHaveNoViolations();
|
|
42
|
+
case 5:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
})));
|
|
48
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
49
|
+
var _render2, container, results;
|
|
50
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
51
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
54
|
+
label: "Accordion",
|
|
55
|
+
assistiveText: "Assistive Text",
|
|
56
|
+
icon: folderIcon,
|
|
57
|
+
margin: "small",
|
|
58
|
+
disabled: true
|
|
59
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))), container = _render2.container;
|
|
60
|
+
_context2.next = 3;
|
|
61
|
+
return (0, _axeHelper.axe)(container);
|
|
62
|
+
case 3:
|
|
63
|
+
results = _context2.sent;
|
|
64
|
+
expect(results).toHaveNoViolations();
|
|
65
|
+
case 5:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context2.stop();
|
|
68
|
+
}
|
|
69
|
+
}, _callee2);
|
|
70
|
+
})));
|
|
71
|
+
});
|
package/accordion/Accordion.js
CHANGED
|
@@ -1,96 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
14
|
var _utils = require("../common/utils");
|
|
23
|
-
|
|
24
15
|
var _variables = require("../common/variables");
|
|
25
|
-
|
|
26
16
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
|
-
|
|
28
|
-
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
29
|
-
|
|
30
17
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
31
|
-
|
|
32
18
|
var _uuid = require("uuid");
|
|
33
|
-
|
|
19
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
34
20
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
-
|
|
40
|
-
var expandLess = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
-
height: "24",
|
|
43
|
-
width: "24",
|
|
44
|
-
fill: "currentColor"
|
|
45
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
-
d: "m7.4 15.375-1.4-1.4 6-6 6 6-1.4 1.4-4.6-4.6Z"
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
var expandMore = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
51
|
-
height: "24",
|
|
52
|
-
width: "24",
|
|
53
|
-
fill: "currentColor"
|
|
54
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
55
|
-
d: "m12 15.375-6-6 1.4-1.4 4.6 4.6 4.6-4.6 1.4 1.4Z"
|
|
56
|
-
}));
|
|
57
|
-
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
58
23
|
var DxcAccordion = function DxcAccordion(_ref) {
|
|
59
24
|
var _ref$label = _ref.label,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
25
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
26
|
+
defaultIsExpanded = _ref.defaultIsExpanded,
|
|
27
|
+
isExpanded = _ref.isExpanded,
|
|
28
|
+
icon = _ref.icon,
|
|
29
|
+
_ref$assistiveText = _ref.assistiveText,
|
|
30
|
+
assistiveText = _ref$assistiveText === void 0 ? "" : _ref$assistiveText,
|
|
31
|
+
_ref$disabled = _ref.disabled,
|
|
32
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
33
|
+
onChange = _ref.onChange,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
margin = _ref.margin,
|
|
36
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
37
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
74
38
|
var _useState = (0, _react.useState)((0, _uuid.v4)()),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
39
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
40
|
+
id = _useState2[0];
|
|
78
41
|
var _useState3 = (0, _react.useState)(defaultIsExpanded !== null && defaultIsExpanded !== void 0 ? defaultIsExpanded : false),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
42
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
43
|
+
innerIsExpanded = _useState4[0],
|
|
44
|
+
setInnerIsExpanded = _useState4[1];
|
|
83
45
|
var colorsTheme = (0, _useTheme["default"])();
|
|
84
|
-
|
|
85
46
|
var handleAccordionState = function handleAccordionState() {
|
|
86
47
|
var _isExpanded;
|
|
87
|
-
|
|
88
48
|
isExpanded !== null && isExpanded !== void 0 ? isExpanded : setInnerIsExpanded(function (innerIsExpanded) {
|
|
89
49
|
return !innerIsExpanded;
|
|
90
50
|
});
|
|
91
51
|
onChange === null || onChange === void 0 ? void 0 : onChange((_isExpanded = !isExpanded) !== null && _isExpanded !== void 0 ? _isExpanded : !innerIsExpanded);
|
|
92
52
|
};
|
|
93
|
-
|
|
94
53
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
95
54
|
theme: colorsTheme.accordion
|
|
96
55
|
}, /*#__PURE__*/_react["default"].createElement(AccordionContainer, {
|
|
@@ -106,8 +65,8 @@ var DxcAccordion = function DxcAccordion(_ref) {
|
|
|
106
65
|
isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded
|
|
107
66
|
}, /*#__PURE__*/_react["default"].createElement(AccordionInfo, null, /*#__PURE__*/_react["default"].createElement(AccordionLabel, null, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
108
67
|
disabled: disabled
|
|
109
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("
|
|
110
|
-
|
|
68
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
69
|
+
icon: icon
|
|
111
70
|
}) : icon), /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
|
|
112
71
|
color: disabled ? colorsTheme.accordion.disabledTitleLabelFontColor : colorsTheme.accordion.titleLabelFontColor,
|
|
113
72
|
fontFamily: colorsTheme.accordion.titleLabelFontFamily,
|
|
@@ -125,19 +84,17 @@ var DxcAccordion = function DxcAccordion(_ref) {
|
|
|
125
84
|
lineHeight: "1.5em"
|
|
126
85
|
}, assistiveText))), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
127
86
|
disabled: disabled
|
|
128
|
-
},
|
|
87
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
88
|
+
icon: (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) ? "expand_less" : "expand_more"
|
|
89
|
+
})))), (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) && /*#__PURE__*/_react["default"].createElement(AccordionPanel, {
|
|
129
90
|
id: "accordion-panel-".concat(id),
|
|
130
91
|
role: "region",
|
|
131
92
|
"aria-labelledby": "accordion-".concat(id)
|
|
132
|
-
},
|
|
133
|
-
color: colorsTheme.accordion.backgroundColor
|
|
134
|
-
}, children))));
|
|
93
|
+
}, children)));
|
|
135
94
|
};
|
|
136
|
-
|
|
137
95
|
var calculateWidth = function calculateWidth(margin) {
|
|
138
96
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
139
97
|
};
|
|
140
|
-
|
|
141
98
|
var AccordionContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n border-radius: ", ";\n ", "\n box-shadow: ", ";\n min-width: 280px;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n"])), function (props) {
|
|
142
99
|
return props.theme.backgroundColor;
|
|
143
100
|
}, function (props) {
|
|
@@ -159,9 +116,7 @@ var AccordionContainer = _styledComponents["default"].div(_templateObject || (_t
|
|
|
159
116
|
}, function (props) {
|
|
160
117
|
return calculateWidth(props.margin);
|
|
161
118
|
});
|
|
162
|
-
|
|
163
119
|
var AccordionHeader = _styledComponents["default"].h3(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n min-height: 48px;\n margin: 0;\n"])));
|
|
164
|
-
|
|
165
120
|
var AccordionTrigger = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 24px;\n width: 100%;\n background-color: transparent;\n border: none;\n border-radius: ", ";\n ", "\n padding: 12px 16px;\n cursor: ", ";\n\n :focus {\n outline: ", ";\n }\n :hover:enabled {\n background-color: ", ";\n }\n :active:enabled {\n background-color: ", ";\n }\n"])), function (props) {
|
|
166
121
|
return props.theme.borderRadius;
|
|
167
122
|
}, function (props) {
|
|
@@ -175,9 +130,7 @@ var AccordionTrigger = _styledComponents["default"].button(_templateObject3 || (
|
|
|
175
130
|
}, function (props) {
|
|
176
131
|
return "".concat(props.theme.hoverBackgroundColor);
|
|
177
132
|
});
|
|
178
|
-
|
|
179
133
|
var AccordionInfo = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
180
|
-
|
|
181
134
|
var AccordionLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-right: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
182
135
|
return props.theme.titleLabelPaddingTop;
|
|
183
136
|
}, function (props) {
|
|
@@ -187,19 +140,19 @@ var AccordionLabel = _styledComponents["default"].span(_templateObject5 || (_tem
|
|
|
187
140
|
}, function (props) {
|
|
188
141
|
return props.theme.titleLabelPaddingLeft;
|
|
189
142
|
});
|
|
190
|
-
|
|
191
|
-
var IconContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
143
|
+
var IconContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n font-size: ", ";\n\n svg {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
192
144
|
return props.theme.iconMarginLeft;
|
|
193
145
|
}, function (props) {
|
|
194
|
-
return props.theme.
|
|
146
|
+
return props.theme.iconMarginRight;
|
|
195
147
|
}, function (props) {
|
|
196
148
|
return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
|
|
197
149
|
}, function (props) {
|
|
198
150
|
return props.theme.iconSize;
|
|
199
151
|
}, function (props) {
|
|
200
152
|
return props.theme.iconSize;
|
|
153
|
+
}, function (props) {
|
|
154
|
+
return props.theme.iconSize;
|
|
201
155
|
});
|
|
202
|
-
|
|
203
156
|
var AccordionAssistiveText = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: ", ";\n padding-left: ", ";\n padding-right: ", ";\n"])), function (props) {
|
|
204
157
|
return props.theme.assistiveTextMinWidth;
|
|
205
158
|
}, function (props) {
|
|
@@ -207,16 +160,12 @@ var AccordionAssistiveText = _styledComponents["default"].span(_templateObject7
|
|
|
207
160
|
}, function (props) {
|
|
208
161
|
return props.theme.assistiveTextPaddingRight;
|
|
209
162
|
});
|
|
210
|
-
|
|
211
|
-
var CollapseIndicator = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n color: ", ";\n"])), function (props) {
|
|
163
|
+
var CollapseIndicator = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n font-size: 24px;\n color: ", ";\n"])), function (props) {
|
|
212
164
|
return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
|
|
213
165
|
});
|
|
214
|
-
|
|
215
166
|
var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n"])), function (props) {
|
|
216
167
|
return props.theme.borderRadius;
|
|
217
168
|
}, function (props) {
|
|
218
169
|
return props.theme.borderRadius;
|
|
219
170
|
});
|
|
220
|
-
|
|
221
|
-
var _default = DxcAccordion;
|
|
222
|
-
exports["default"] = _default;
|
|
171
|
+
var _default = exports["default"] = DxcAccordion;
|
|
@@ -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,24 +9,6 @@ export default {
|
|
|
12
9
|
component: DxcAccordion,
|
|
13
10
|
};
|
|
14
11
|
|
|
15
|
-
const folderIcon = (
|
|
16
|
-
<svg
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
enableBackground="new 0 0 24 24"
|
|
19
|
-
height="24px"
|
|
20
|
-
viewBox="0 0 24 24"
|
|
21
|
-
width="24px"
|
|
22
|
-
fill="currentColor"
|
|
23
|
-
>
|
|
24
|
-
<g>
|
|
25
|
-
<rect fill="none" height="24" width="24" />
|
|
26
|
-
</g>
|
|
27
|
-
<g>
|
|
28
|
-
<path 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" />
|
|
29
|
-
</g>
|
|
30
|
-
</svg>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
12
|
const smallIcon = (
|
|
34
13
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
|
|
35
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" />
|
|
@@ -39,7 +18,6 @@ const smallIcon = (
|
|
|
39
18
|
const facebookIcon = (
|
|
40
19
|
<svg
|
|
41
20
|
version="1.1"
|
|
42
|
-
id="Capa_1"
|
|
43
21
|
x="0px"
|
|
44
22
|
y="0px"
|
|
45
23
|
width="438.536px"
|
|
@@ -60,16 +38,6 @@ const facebookIcon = (
|
|
|
60
38
|
</svg>
|
|
61
39
|
);
|
|
62
40
|
|
|
63
|
-
const advancedTheme = {
|
|
64
|
-
accordion: {
|
|
65
|
-
backgroundColor: "#000000",
|
|
66
|
-
assistiveTextFontColor: "#ffffff",
|
|
67
|
-
titleLabelFontColor: "#ffffff",
|
|
68
|
-
arrowColor: "#5f249f",
|
|
69
|
-
iconColor: "#5f249f",
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
41
|
const opinionatedTheme = {
|
|
74
42
|
accordion: {
|
|
75
43
|
accentColor: "#5f249f",
|
|
@@ -83,7 +51,7 @@ export const Chromatic = () => (
|
|
|
83
51
|
<Title title="Component anatomy" theme="light" level={2} />
|
|
84
52
|
<ExampleContainer>
|
|
85
53
|
<Title title="With label" theme="light" level={4} />
|
|
86
|
-
<DxcAccordion label="Accordion">
|
|
54
|
+
<DxcAccordion label="Accordion 1">
|
|
87
55
|
<div>
|
|
88
56
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
89
57
|
lobortis eget.
|
|
@@ -92,7 +60,7 @@ export const Chromatic = () => (
|
|
|
92
60
|
</ExampleContainer>
|
|
93
61
|
<ExampleContainer>
|
|
94
62
|
<Title title="With assistive text" theme="light" level={4} />
|
|
95
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text">
|
|
63
|
+
<DxcAccordion label="Accordion 2" assistiveText="Assistive text">
|
|
96
64
|
<div>
|
|
97
65
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
98
66
|
lobortis eget.
|
|
@@ -101,7 +69,7 @@ export const Chromatic = () => (
|
|
|
101
69
|
</ExampleContainer>
|
|
102
70
|
<ExampleContainer>
|
|
103
71
|
<Title title="With icon" theme="light" level={4} />
|
|
104
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon=
|
|
72
|
+
<DxcAccordion label="Accordion 3" assistiveText="Assistive text" icon="folder">
|
|
105
73
|
<div>
|
|
106
74
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
107
75
|
lobortis eget.
|
|
@@ -110,7 +78,7 @@ export const Chromatic = () => (
|
|
|
110
78
|
</ExampleContainer>
|
|
111
79
|
<ExampleContainer>
|
|
112
80
|
<Title title="With smaller icon" theme="light" level={4} />
|
|
113
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={smallIcon}>
|
|
81
|
+
<DxcAccordion label="Accordion 4" assistiveText="Assistive text" icon={smallIcon}>
|
|
114
82
|
<div>
|
|
115
83
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
116
84
|
lobortis eget.
|
|
@@ -119,20 +87,7 @@ export const Chromatic = () => (
|
|
|
119
87
|
</ExampleContainer>
|
|
120
88
|
<ExampleContainer>
|
|
121
89
|
<Title title="With bigger icon (SVG)" theme="light" level={4} />
|
|
122
|
-
<DxcAccordion label="
|
|
123
|
-
<div>
|
|
124
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
125
|
-
lobortis eget.
|
|
126
|
-
</div>
|
|
127
|
-
</DxcAccordion>
|
|
128
|
-
</ExampleContainer>
|
|
129
|
-
<ExampleContainer>
|
|
130
|
-
<Title title="With bigger icon (image)" theme="light" level={4} />
|
|
131
|
-
<DxcAccordion
|
|
132
|
-
label="Accordion"
|
|
133
|
-
assistiveText="Assistive text"
|
|
134
|
-
icon="https://www.freepnglogos.com/uploads/facebook-logo-design-1.png"
|
|
135
|
-
>
|
|
90
|
+
<DxcAccordion label="Accordion Test" assistiveText="Assistive text" icon={facebookIcon}>
|
|
136
91
|
<div>
|
|
137
92
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
138
93
|
lobortis eget.
|
|
@@ -169,24 +124,13 @@ export const Chromatic = () => (
|
|
|
169
124
|
</ExampleContainer>
|
|
170
125
|
<ExampleContainer>
|
|
171
126
|
<Title title="Disabled" theme="light" level={4} />
|
|
172
|
-
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon=
|
|
127
|
+
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon="folder" disabled>
|
|
173
128
|
<div>
|
|
174
129
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
175
130
|
lobortis eget.
|
|
176
131
|
</div>
|
|
177
132
|
</DxcAccordion>
|
|
178
133
|
</ExampleContainer>
|
|
179
|
-
<ExampleContainer>
|
|
180
|
-
<Title title="Background color provider over accordion content" theme="light" level={4} />
|
|
181
|
-
<HalstackProvider advancedTheme={advancedTheme}>
|
|
182
|
-
<DxcAccordion label="Dark Accordion" defaultIsExpanded assistiveText="Assistive text" icon={folderIcon}>
|
|
183
|
-
<div style={{ display: "flex", flexDirection: "column", gap: "36px", padding: "36px" }}>
|
|
184
|
-
<DxcTextInput label="Label" helperText="HelperText" placeholder="Placeholder" size="fillParent" />
|
|
185
|
-
<DxcButton label="Submit" size="medium" />
|
|
186
|
-
</div>
|
|
187
|
-
</DxcAccordion>
|
|
188
|
-
</HalstackProvider>
|
|
189
|
-
</ExampleContainer>
|
|
190
134
|
<Title title="Margins" theme="light" level={2} />
|
|
191
135
|
<ExampleContainer>
|
|
192
136
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
@@ -255,7 +199,7 @@ export const Chromatic = () => (
|
|
|
255
199
|
<ExampleContainer>
|
|
256
200
|
<Title title="With assistive text and icon" theme="light" level={4} />
|
|
257
201
|
<HalstackProvider theme={opinionatedTheme}>
|
|
258
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon=
|
|
202
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon="folder">
|
|
259
203
|
Content
|
|
260
204
|
</DxcAccordion>
|
|
261
205
|
</HalstackProvider>
|
|
@@ -285,7 +229,7 @@ export const Chromatic = () => (
|
|
|
285
229
|
<ExampleContainer>
|
|
286
230
|
<Title title="Disabled" theme="light" level={4} />
|
|
287
231
|
<HalstackProvider theme={opinionatedTheme}>
|
|
288
|
-
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon=
|
|
232
|
+
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon="folder" disabled>
|
|
289
233
|
<div>
|
|
290
234
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
291
235
|
leo lobortis eget.
|