@dxc-technology/halstack-react 0.0.0-dddc3c4 → 0.0.0-de7c6b0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1329 -5
  4. package/HalstackContext.js +117 -77
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +110 -114
  7. package/accordion/Accordion.stories.tsx +104 -114
  8. package/accordion/Accordion.test.js +10 -11
  9. package/accordion/types.d.ts +0 -11
  10. package/accordion-group/AccordionGroup.d.ts +4 -3
  11. package/accordion-group/AccordionGroup.js +24 -65
  12. package/accordion-group/AccordionGroup.stories.tsx +93 -66
  13. package/accordion-group/AccordionGroup.test.js +27 -62
  14. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  15. package/accordion-group/AccordionGroupAccordion.js +43 -0
  16. package/accordion-group/types.d.ts +6 -11
  17. package/alert/Alert.js +5 -9
  18. package/alert/Alert.stories.tsx +28 -0
  19. package/alert/Alert.test.js +1 -1
  20. package/bleed/Bleed.stories.tsx +1 -0
  21. package/box/Box.d.ts +1 -1
  22. package/box/Box.js +8 -27
  23. package/box/Box.stories.tsx +38 -51
  24. package/box/Box.test.js +1 -1
  25. package/box/types.d.ts +0 -11
  26. package/bulleted-list/BulletedList.js +4 -2
  27. package/bulleted-list/BulletedList.stories.tsx +7 -1
  28. package/bulleted-list/types.d.ts +31 -4
  29. package/button/Button.js +13 -16
  30. package/button/Button.stories.tsx +151 -9
  31. package/button/Button.test.js +1 -1
  32. package/button/types.d.ts +3 -3
  33. package/card/Card.d.ts +1 -1
  34. package/card/Card.js +27 -45
  35. package/card/Card.stories.tsx +12 -42
  36. package/card/Card.test.js +1 -1
  37. package/card/types.d.ts +1 -6
  38. package/checkbox/Checkbox.d.ts +2 -2
  39. package/checkbox/Checkbox.js +94 -101
  40. package/checkbox/Checkbox.stories.tsx +131 -59
  41. package/checkbox/Checkbox.test.js +94 -17
  42. package/checkbox/types.d.ts +4 -0
  43. package/chip/Chip.js +28 -49
  44. package/chip/Chip.stories.tsx +121 -26
  45. package/chip/Chip.test.js +3 -5
  46. package/common/OpenSans.css +68 -80
  47. package/common/coreTokens.d.ts +146 -0
  48. package/common/coreTokens.js +167 -0
  49. package/common/utils.d.ts +1 -0
  50. package/common/utils.js +4 -4
  51. package/common/variables.d.ts +1482 -0
  52. package/common/variables.js +990 -1137
  53. package/date-input/Calendar.d.ts +4 -0
  54. package/date-input/Calendar.js +258 -0
  55. package/date-input/DateInput.js +134 -237
  56. package/date-input/DateInput.stories.tsx +199 -33
  57. package/date-input/DateInput.test.js +494 -138
  58. package/date-input/DatePicker.d.ts +4 -0
  59. package/date-input/DatePicker.js +146 -0
  60. package/date-input/Icons.d.ts +6 -0
  61. package/date-input/Icons.js +75 -0
  62. package/date-input/YearPicker.d.ts +4 -0
  63. package/date-input/YearPicker.js +126 -0
  64. package/date-input/types.d.ts +51 -0
  65. package/dialog/Dialog.d.ts +1 -1
  66. package/dialog/Dialog.js +54 -85
  67. package/dialog/Dialog.stories.tsx +154 -170
  68. package/dialog/Dialog.test.js +302 -3
  69. package/dialog/types.d.ts +0 -12
  70. package/dropdown/Dropdown.js +43 -42
  71. package/dropdown/Dropdown.stories.tsx +210 -84
  72. package/dropdown/Dropdown.test.js +22 -27
  73. package/dropdown/DropdownMenu.js +12 -18
  74. package/dropdown/DropdownMenuItem.js +5 -18
  75. package/dropdown/types.d.ts +3 -3
  76. package/file-input/FileInput.d.ts +2 -2
  77. package/file-input/FileInput.js +174 -220
  78. package/file-input/FileInput.stories.tsx +122 -11
  79. package/file-input/FileInput.test.js +14 -14
  80. package/file-input/FileItem.d.ts +4 -14
  81. package/file-input/FileItem.js +39 -63
  82. package/file-input/types.d.ts +17 -0
  83. package/flex/Flex.d.ts +1 -1
  84. package/flex/Flex.js +33 -19
  85. package/flex/Flex.stories.tsx +35 -26
  86. package/flex/types.d.ts +83 -7
  87. package/footer/Footer.d.ts +1 -1
  88. package/footer/Footer.js +8 -23
  89. package/footer/Footer.stories.tsx +26 -16
  90. package/footer/Footer.test.js +14 -26
  91. package/footer/types.d.ts +0 -5
  92. package/grid/Grid.d.ts +7 -0
  93. package/grid/Grid.js +91 -0
  94. package/grid/Grid.stories.tsx +219 -0
  95. package/grid/types.d.ts +115 -0
  96. package/header/Header.d.ts +4 -3
  97. package/header/Header.js +20 -49
  98. package/header/Header.stories.tsx +115 -36
  99. package/header/Header.test.js +2 -2
  100. package/header/types.d.ts +1 -14
  101. package/heading/Heading.js +1 -1
  102. package/heading/Heading.test.js +1 -1
  103. package/inset/Inset.stories.tsx +2 -1
  104. package/layout/ApplicationLayout.d.ts +5 -5
  105. package/layout/ApplicationLayout.js +1 -1
  106. package/layout/types.d.ts +2 -3
  107. package/link/Link.js +4 -4
  108. package/link/Link.stories.tsx +60 -0
  109. package/link/Link.test.js +2 -4
  110. package/link/types.d.ts +2 -2
  111. package/main.d.ts +3 -2
  112. package/main.js +9 -1
  113. package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
  114. package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
  115. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
  116. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  117. package/{tabs-nav → nav-tabs}/Tab.js +49 -33
  118. package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
  119. package/nav-tabs/types.js +5 -0
  120. package/number-input/NumberInput.test.js +44 -8
  121. package/package.json +13 -18
  122. package/paginator/Icons.d.ts +5 -0
  123. package/paginator/Icons.js +16 -28
  124. package/paginator/Paginator.js +8 -16
  125. package/paginator/Paginator.stories.tsx +24 -0
  126. package/paginator/Paginator.test.js +58 -48
  127. package/paragraph/Paragraph.d.ts +3 -4
  128. package/paragraph/Paragraph.js +5 -5
  129. package/password-input/PasswordInput.test.js +14 -13
  130. package/progress-bar/ProgressBar.d.ts +2 -2
  131. package/progress-bar/ProgressBar.js +5 -5
  132. package/progress-bar/ProgressBar.stories.jsx +35 -2
  133. package/progress-bar/ProgressBar.test.js +1 -1
  134. package/progress-bar/types.d.ts +4 -3
  135. package/quick-nav/QuickNav.js +11 -12
  136. package/quick-nav/QuickNav.stories.tsx +111 -19
  137. package/radio-group/Radio.d.ts +1 -1
  138. package/radio-group/Radio.js +46 -31
  139. package/radio-group/RadioGroup.js +23 -23
  140. package/radio-group/RadioGroup.stories.tsx +132 -18
  141. package/radio-group/RadioGroup.test.js +124 -97
  142. package/radio-group/types.d.ts +2 -2
  143. package/resultsetTable/Icons.d.ts +7 -0
  144. package/resultsetTable/Icons.js +51 -0
  145. package/resultsetTable/ResultsetTable.js +49 -108
  146. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  147. package/resultsetTable/ResultsetTable.test.js +41 -64
  148. package/resultsetTable/types.d.ts +1 -1
  149. package/select/Listbox.d.ts +1 -1
  150. package/select/Listbox.js +5 -35
  151. package/select/Option.js +11 -24
  152. package/select/Select.js +59 -36
  153. package/select/Select.stories.tsx +494 -150
  154. package/select/Select.test.js +341 -288
  155. package/select/types.d.ts +2 -2
  156. package/sidenav/Icons.d.ts +7 -0
  157. package/sidenav/Icons.js +51 -0
  158. package/sidenav/Sidenav.d.ts +2 -2
  159. package/sidenav/Sidenav.js +66 -96
  160. package/sidenav/Sidenav.stories.tsx +165 -63
  161. package/sidenav/types.d.ts +21 -18
  162. package/slider/Slider.d.ts +2 -2
  163. package/slider/Slider.js +24 -15
  164. package/slider/Slider.stories.tsx +57 -0
  165. package/slider/Slider.test.js +1 -1
  166. package/slider/types.d.ts +6 -2
  167. package/spinner/Spinner.js +17 -23
  168. package/spinner/Spinner.stories.jsx +53 -27
  169. package/spinner/Spinner.test.js +1 -1
  170. package/switch/Switch.d.ts +3 -3
  171. package/switch/Switch.js +96 -85
  172. package/switch/Switch.stories.tsx +33 -0
  173. package/switch/Switch.test.js +27 -14
  174. package/switch/types.d.ts +8 -3
  175. package/table/Table.js +3 -3
  176. package/table/Table.stories.jsx +80 -1
  177. package/table/Table.test.js +2 -2
  178. package/tabs/Tab.js +12 -15
  179. package/tabs/Tabs.js +11 -17
  180. package/tabs/Tabs.stories.tsx +45 -5
  181. package/tabs/Tabs.test.js +4 -5
  182. package/tabs/types.d.ts +2 -2
  183. package/tag/Tag.js +8 -10
  184. package/tag/Tag.stories.tsx +14 -1
  185. package/tag/Tag.test.js +1 -1
  186. package/text-input/Icons.d.ts +8 -0
  187. package/text-input/Icons.js +60 -0
  188. package/text-input/Suggestion.js +40 -11
  189. package/text-input/Suggestions.d.ts +4 -0
  190. package/text-input/Suggestions.js +134 -0
  191. package/text-input/TextInput.js +189 -277
  192. package/text-input/TextInput.stories.tsx +280 -184
  193. package/text-input/TextInput.test.js +736 -725
  194. package/text-input/types.d.ts +21 -2
  195. package/textarea/Textarea.js +3 -4
  196. package/textarea/Textarea.stories.jsx +60 -1
  197. package/textarea/Textarea.test.js +2 -4
  198. package/toggle-group/ToggleGroup.d.ts +2 -2
  199. package/toggle-group/ToggleGroup.js +7 -4
  200. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  201. package/toggle-group/ToggleGroup.test.js +1 -1
  202. package/toggle-group/types.d.ts +1 -1
  203. package/typography/Typography.d.ts +2 -2
  204. package/typography/Typography.js +14 -113
  205. package/typography/Typography.stories.tsx +1 -1
  206. package/useTheme.d.ts +1234 -1
  207. package/useTheme.js +1 -1
  208. package/useTranslatedLabels.d.ts +84 -1
  209. package/utils/BaseTypography.d.ts +21 -0
  210. package/utils/BaseTypography.js +108 -0
  211. package/utils/FocusLock.d.ts +13 -0
  212. package/utils/FocusLock.js +138 -0
  213. package/wizard/Wizard.js +2 -2
  214. package/wizard/Wizard.stories.tsx +20 -0
  215. package/wizard/Wizard.test.js +1 -1
  216. package/wizard/types.d.ts +5 -6
  217. package/card/ice-cream.jpg +0 -0
  218. package/common/RequiredComponent.js +0 -32
  219. /package/{tabs-nav → grid}/types.js +0 -0
  220. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
@@ -19,28 +19,42 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
21
 
22
- var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
22
+ var _utils = require("../common/utils");
23
23
 
24
- var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
25
-
26
- var _ExpansionPanelDetails = _interopRequireDefault(require("@material-ui/core/ExpansionPanelDetails"));
27
-
28
- var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
29
-
30
- var _utils = require("../common/utils.js");
31
-
32
- var _variables = require("../common/variables.js");
24
+ var _variables = require("../common/variables");
33
25
 
34
26
  var _useTheme = _interopRequireDefault(require("../useTheme"));
35
27
 
36
28
  var _BackgroundColorContext = require("../BackgroundColorContext");
37
29
 
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
30
+ var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
31
+
32
+ var _uuid = require("uuid");
33
+
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
39
35
 
40
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
37
 
42
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; }
43
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
+
44
58
  var DxcAccordion = function DxcAccordion(_ref) {
45
59
  var _ref$label = _ref.label,
46
60
  label = _ref$label === void 0 ? "" : _ref$label,
@@ -54,61 +68,85 @@ var DxcAccordion = function DxcAccordion(_ref) {
54
68
  onChange = _ref.onChange,
55
69
  children = _ref.children,
56
70
  margin = _ref.margin,
57
- padding = _ref.padding,
58
71
  _ref$tabIndex = _ref.tabIndex,
59
72
  tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
60
73
 
61
- var _useState = (0, _react.useState)(defaultIsExpanded !== null && defaultIsExpanded !== void 0 ? defaultIsExpanded : false),
62
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
63
- innerIsExpanded = _useState2[0],
64
- setInnerIsExpanded = _useState2[1];
74
+ var _useState = (0, _react.useState)((0, _uuid.v4)()),
75
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
76
+ id = _useState2[0];
77
+
78
+ var _useState3 = (0, _react.useState)(defaultIsExpanded !== null && defaultIsExpanded !== void 0 ? defaultIsExpanded : false),
79
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
80
+ innerIsExpanded = _useState4[0],
81
+ setInnerIsExpanded = _useState4[1];
65
82
 
66
83
  var colorsTheme = (0, _useTheme["default"])();
67
84
 
68
- var handlerAccordion = function handlerAccordion() {
69
- if (isExpanded == null) {
70
- setInnerIsExpanded(!innerIsExpanded);
71
- }
85
+ var handleAccordionState = function handleAccordionState() {
86
+ var _isExpanded;
72
87
 
73
- if (typeof onChange === "function") {
74
- onChange(isExpanded == null ? !innerIsExpanded : !isExpanded);
75
- }
88
+ isExpanded !== null && isExpanded !== void 0 ? isExpanded : setInnerIsExpanded(function (innerIsExpanded) {
89
+ return !innerIsExpanded;
90
+ });
91
+ onChange === null || onChange === void 0 ? void 0 : onChange((_isExpanded = !isExpanded) !== null && _isExpanded !== void 0 ? _isExpanded : !innerIsExpanded);
76
92
  };
77
93
 
78
94
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
79
95
  theme: colorsTheme.accordion
80
- }, /*#__PURE__*/_react["default"].createElement(DXCAccordion, {
81
- padding: padding,
82
- margin: margin,
96
+ }, /*#__PURE__*/_react["default"].createElement(AccordionContainer, {
97
+ isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
98
+ margin: margin
99
+ }, /*#__PURE__*/_react["default"].createElement(AccordionHeader, null, /*#__PURE__*/_react["default"].createElement(AccordionTrigger, {
100
+ id: "accordion-".concat(id),
101
+ onClick: disabled ? undefined : handleAccordionState,
83
102
  disabled: disabled,
84
- icon: icon
85
- }, /*#__PURE__*/_react["default"].createElement(_ExpansionPanel["default"], {
86
- disabled: disabled,
87
- onChange: handlerAccordion,
88
- expanded: isExpanded != null ? isExpanded : innerIsExpanded
89
- }, /*#__PURE__*/_react["default"].createElement(_ExpansionPanelSummary["default"], {
90
- expandIcon: /*#__PURE__*/_react["default"].createElement(_ExpandMore["default"], null),
91
- tabIndex: disabled ? -1 : tabIndex
92
- }, /*#__PURE__*/_react["default"].createElement(AccordionInfo, {
93
- disabled: disabled
94
- }, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
103
+ tabIndex: disabled ? -1 : tabIndex,
104
+ "aria-expanded": isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
105
+ "aria-controls": "accordion-panel-".concat(id),
106
+ isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded
107
+ }, /*#__PURE__*/_react["default"].createElement(AccordionInfo, null, /*#__PURE__*/_react["default"].createElement(AccordionLabel, null, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
95
108
  disabled: disabled
96
- }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(AccordionIcon, {
109
+ }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
97
110
  src: icon
98
- }) : icon), /*#__PURE__*/_react["default"].createElement(AccordionLabel, null, label)), assistiveText && /*#__PURE__*/_react["default"].createElement(AccordionAssistiveText, {
99
- disabled: disabled
100
- }, assistiveText)), /*#__PURE__*/_react["default"].createElement(_ExpansionPanelDetails["default"], null, /*#__PURE__*/_react["default"].createElement(AccordionContent, {
111
+ }) : icon), /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
112
+ color: disabled ? colorsTheme.accordion.disabledTitleLabelFontColor : colorsTheme.accordion.titleLabelFontColor,
113
+ fontFamily: colorsTheme.accordion.titleLabelFontFamily,
114
+ fontSize: colorsTheme.accordion.titleLabelFontSize,
115
+ fontStyle: colorsTheme.accordion.titleLabelFontStyle,
116
+ fontWeight: colorsTheme.accordion.titleLabelFontWeight,
117
+ lineHeight: "1.5em"
118
+ }, label)), assistiveText && /*#__PURE__*/_react["default"].createElement(AccordionAssistiveText, null, /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
119
+ color: disabled ? colorsTheme.accordion.disabledAssistiveTextFontColor : colorsTheme.accordion.assistiveTextFontColor,
120
+ fontFamily: colorsTheme.accordion.assistiveTextFontFamily,
121
+ fontSize: colorsTheme.accordion.assistiveTextFontSize,
122
+ fontStyle: colorsTheme.accordion.assistiveTextFontStyle,
123
+ fontWeight: colorsTheme.accordion.assistiveTextFontWeight,
124
+ letterSpacing: colorsTheme.accordion.assistiveTextLetterSpacing,
125
+ lineHeight: "1.5em"
126
+ }, assistiveText))), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
101
127
  disabled: disabled
128
+ }, (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) ? expandLess : expandMore))), (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) && /*#__PURE__*/_react["default"].createElement(AccordionPanel, {
129
+ id: "accordion-panel-".concat(id),
130
+ role: "region",
131
+ "aria-labelledby": "accordion-".concat(id)
102
132
  }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
103
133
  color: colorsTheme.accordion.backgroundColor
104
- }, children))))));
134
+ }, children))));
105
135
  };
106
136
 
107
137
  var calculateWidth = function calculateWidth(margin) {
108
138
  return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
109
139
  };
110
140
 
111
- var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n min-width: 280px;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n cursor: ", ";\n\n .MuiPaper-root {\n min-width: 0;\n display: flex;\n left: 85px;\n background-color: ", " !important;\n box-shadow: ", ";\n position: static;\n width: 100%;\n border-radius: ", ";\n\n &.Mui-expanded {\n border-radius: ", ";\n }\n &.MuiExpansionPanel-root {\n display: flex;\n flex-direction: column;\n min-height: 48px;\n }\n &.MuiExpansionPanel-rounded {\n border-radius: ", ";\n }\n .MuiButtonBase-root.MuiExpansionPanelSummary-root {\n min-height: 48px;\n height: 48px;\n\n :focus {\n outline-color: ", ";\n outline-style: ", ";\n outline-width: ", ";\n background-color: ", ";\n }\n :hover {\n background-color: ", ";\n }\n :active {\n background-color: ", ";\n }\n &.Mui-disabled {\n opacity: 1;\n }\n }\n .MuiButtonBase-root {\n border-radius: ", ";\n\n &.Mui-expanded {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n .MuiSvgIcon-root {\n opacity: 1;\n }\n }\n &.MuiIconButton-root {\n height: auto;\n }\n .MuiExpansionPanelSummary-content {\n padding-top: ", ";\n padding-bottom: ", ";\n padding-right: ", ";\n padding-left: ", ";\n min-width: 0;\n &.Mui-expanded {\n div:nth-child(2) {\n opacity: 1;\n }\n }\n :hover {\n div {\n opacity: 1;\n }\n }\n }\n }\n .MuiTouchRipple-root {\n display: none;\n }\n }\n .MuiCollapse-hidden {\n display: none;\n }\n .MuiCollapse-container {\n border-radius: 0px 0px 4px 4px;\n cursor: default;\n width: 100%;\n }\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n color: ", ";\n }\n }\n .MuiExpansionPanelDetails-root {\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n }\n"])), function (props) {
141
+ 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
+ return props.theme.backgroundColor;
143
+ }, function (props) {
144
+ return props.theme.borderRadius;
145
+ }, function (props) {
146
+ return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
147
+ }, function (props) {
148
+ return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
149
+ }, function (props) {
112
150
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
113
151
  }, function (props) {
114
152
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -120,33 +158,27 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
120
158
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
121
159
  }, function (props) {
122
160
  return calculateWidth(props.margin);
123
- }, function (props) {
124
- return props.disabled && "not-allowed" || "pointer";
125
- }, function (props) {
126
- return props.theme.backgroundColor;
127
- }, function (props) {
128
- return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
129
- }, function (props) {
130
- return props.theme.borderRadius;
131
- }, function (props) {
132
- return props.theme.borderRadius;
133
- }, function (props) {
161
+ });
162
+
163
+ 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
+ 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) {
134
166
  return props.theme.borderRadius;
135
167
  }, function (props) {
136
- return props.theme.focusBorderColor;
137
- }, function (props) {
138
- return props.theme.focusBorderStyle;
168
+ return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
139
169
  }, function (props) {
140
- return props.theme.focusBorderThickness;
170
+ return props.disabled ? "not-allowed" : "pointer";
141
171
  }, function (props) {
142
- return props.theme.backgroundColor;
172
+ return "".concat(props.theme.focusBorderColor, " ").concat(props.theme.focusBorderStyle, " ").concat(props.theme.focusBorderThickness);
143
173
  }, function (props) {
144
174
  return "".concat(props.theme.hoverBackgroundColor);
145
175
  }, function (props) {
146
176
  return "".concat(props.theme.hoverBackgroundColor);
147
- }, function (props) {
148
- return props.theme.borderRadius;
149
- }, function (props) {
177
+ });
178
+
179
+ 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
+ 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) {
150
182
  return props.theme.titleLabelPaddingTop;
151
183
  }, function (props) {
152
184
  return props.theme.titleLabelPaddingBottom;
@@ -154,73 +186,37 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
154
186
  return props.theme.titleLabelPaddingRight;
155
187
  }, function (props) {
156
188
  return props.theme.titleLabelPaddingLeft;
157
- }, function (props) {
158
- return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
159
- }, function (props) {
160
- return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
161
- }, function (props) {
162
- return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
163
- }, function (props) {
164
- return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
165
- }, function (props) {
166
- return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
167
- }, function (props) {
168
- return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
169
189
  });
170
190
 
171
- var AccordionInfo = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n padding-left: ", ";\n padding-right: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (props) {
172
- return props.theme.titlePaddingLeft;
173
- }, function (props) {
174
- return props.theme.titlePaddingRight;
175
- }, function (props) {
176
- return props.theme.titleLabelFontFamily;
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) {
192
+ return props.theme.iconMarginLeft;
177
193
  }, function (props) {
178
- return props.theme.titleLabelFontSize;
194
+ return props.theme.iconMarginRigth;
179
195
  }, function (props) {
180
- return props.theme.titleLabelFontStyle;
196
+ return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
181
197
  }, function (props) {
182
- return props.theme.titleFonLabeltWeight;
198
+ return props.theme.iconSize;
183
199
  }, function (props) {
184
- return props.disabled ? props.theme.disabledTitleLabelFontColor : props.theme.titleLabelFontColor;
200
+ return props.theme.iconSize;
185
201
  });
186
202
 
187
- var AccordionLabel = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
188
-
189
- var AccordionContent = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n"])));
190
-
191
- var AccordionAssistiveText = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding-left: ", ";\n padding-right: ", ";\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: ", ";\n text-align: end;\n"])), function (props) {
203
+ var AccordionAssistiveText = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: ", ";\n padding-left: ", ";\n padding-right: ", ";\n"])), function (props) {
204
+ return props.theme.assistiveTextMinWidth;
205
+ }, function (props) {
192
206
  return props.theme.assistiveTextPaddingLeft;
193
207
  }, function (props) {
194
208
  return props.theme.assistiveTextPaddingRight;
195
- }, function (props) {
196
- return props.theme.assistiveTextFontSize;
197
- }, function (props) {
198
- return props.theme.assistiveTextFontFamily;
199
- }, function (props) {
200
- return props.theme.assistiveTextFontStyle;
201
- }, function (props) {
202
- return props.theme.assistiveTextFontWeight;
203
- }, function (props) {
204
- return props.disabled ? props.theme.disabledAssistiveTextFontColor : props.theme.assistiveTextFontColor;
205
- }, function (props) {
206
- return props.theme.assistiveTextLetterSpacing;
207
- }, function (props) {
208
- return props.theme.assistiveTextMinWidth;
209
209
  });
210
210
 
211
- var IconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n color: ", ";\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
212
- return props.theme.iconSize;
213
- }, function (props) {
214
- return props.theme.iconSize;
215
- }, function (props) {
216
- return props.theme.iconMarginLeft;
217
- }, function (props) {
218
- return props.theme.iconMarginRigth;
219
- }, function (props) {
220
- return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
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) {
212
+ return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
221
213
  });
222
214
 
223
- var AccordionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])([""])));
215
+ var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n"])), function (props) {
216
+ return props.theme.borderRadius;
217
+ }, function (props) {
218
+ return props.theme.borderRadius;
219
+ });
224
220
 
225
221
  var _default = DxcAccordion;
226
222
  exports["default"] = _default;
@@ -30,10 +30,33 @@ const folderIcon = (
30
30
  </svg>
31
31
  );
32
32
 
33
- const thumbIcon = (
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" />
33
+ const smallIcon = (
34
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
35
+ <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" />
36
+ </svg>
37
+ );
38
+
39
+ const facebookIcon = (
40
+ <svg
41
+ version="1.1"
42
+ id="Capa_1"
43
+ x="0px"
44
+ y="0px"
45
+ width="438.536px"
46
+ height="438.536px"
47
+ viewBox="0 0 438.536 438.536"
48
+ fill="currentColor"
49
+ >
50
+ <g>
51
+ <path
52
+ 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
53
+ 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
54
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
55
+ 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
56
+ 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
57
+ 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"
58
+ />
59
+ </g>
37
60
  </svg>
38
61
  );
39
62
 
@@ -47,6 +70,14 @@ const advancedTheme = {
47
70
  },
48
71
  };
49
72
 
73
+ const opinionatedTheme = {
74
+ accordion: {
75
+ accentColor: "#5f249f",
76
+ titleFontColor: "#000000",
77
+ assistiveTextFontColor: "#666666",
78
+ },
79
+ };
80
+
50
81
  export const Chromatic = () => (
51
82
  <>
52
83
  <Title title="Component anatomy" theme="light" level={2} />
@@ -78,8 +109,30 @@ export const Chromatic = () => (
78
109
  </DxcAccordion>
79
110
  </ExampleContainer>
80
111
  <ExampleContainer>
81
- <Title title="With bigger icon 48x48" theme="light" level={4} />
82
- <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={thumbIcon}>
112
+ <Title title="With smaller icon" theme="light" level={4} />
113
+ <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={smallIcon}>
114
+ <div>
115
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
116
+ lobortis eget.
117
+ </div>
118
+ </DxcAccordion>
119
+ </ExampleContainer>
120
+ <ExampleContainer>
121
+ <Title title="With bigger icon (SVG)" theme="light" level={4} />
122
+ <DxcAccordion label="AccordionTest" assistiveText="Assistive text" icon={facebookIcon}>
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
+ >
83
136
  <div>
84
137
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
85
138
  lobortis eget.
@@ -126,118 +179,14 @@ export const Chromatic = () => (
126
179
  <ExampleContainer>
127
180
  <Title title="Background color provider over accordion content" theme="light" level={4} />
128
181
  <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
- />
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" />
144
185
  <DxcButton label="Submit" size="medium" />
145
186
  </div>
146
187
  </DxcAccordion>
147
188
  </HalstackProvider>
148
189
  </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
190
  <Title title="Margins" theme="light" level={2} />
242
191
  <ExampleContainer>
243
192
  <Title title="Xxsmall margin" theme="light" level={4} />
@@ -301,7 +250,48 @@ export const Chromatic = () => (
301
250
  lobortis eget.
302
251
  </div>
303
252
  </DxcAccordion>
304
- <hr />
253
+ </ExampleContainer>
254
+ <Title title="Opinionated theme" theme="light" level={2} />
255
+ <ExampleContainer>
256
+ <Title title="With assistive text and icon" theme="light" level={4} />
257
+ <HalstackProvider theme={opinionatedTheme}>
258
+ <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={folderIcon}>
259
+ Content
260
+ </DxcAccordion>
261
+ </HalstackProvider>
262
+ </ExampleContainer>
263
+ <ExampleContainer pseudoState="pseudo-hover">
264
+ <Title title="Hovered" theme="light" level={4} />
265
+ <HalstackProvider theme={opinionatedTheme}>
266
+ <DxcAccordion label="Hovered">
267
+ <div>
268
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
269
+ leo lobortis eget.
270
+ </div>
271
+ </DxcAccordion>
272
+ </HalstackProvider>
273
+ </ExampleContainer>
274
+ <ExampleContainer pseudoState="pseudo-active">
275
+ <Title title="Active" theme="light" level={4} />
276
+ <HalstackProvider theme={opinionatedTheme}>
277
+ <DxcAccordion label="Active">
278
+ <div>
279
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
280
+ leo lobortis eget.
281
+ </div>
282
+ </DxcAccordion>
283
+ </HalstackProvider>
284
+ </ExampleContainer>
285
+ <ExampleContainer>
286
+ <Title title="Disabled" theme="light" level={4} />
287
+ <HalstackProvider theme={opinionatedTheme}>
288
+ <DxcAccordion label="Disabled" assistiveText="Assistive text" icon={folderIcon} disabled>
289
+ <div>
290
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
291
+ leo lobortis eget.
292
+ </div>
293
+ </DxcAccordion>
294
+ </HalstackProvider>
305
295
  </ExampleContainer>
306
296
  </>
307
297
  );
@@ -6,23 +6,22 @@ var _react = _interopRequireDefault(require("react"));
6
6
 
7
7
  var _react2 = require("@testing-library/react");
8
8
 
9
- var _Accordion = _interopRequireDefault(require("./Accordion"));
9
+ var _Accordion = _interopRequireDefault(require("./Accordion.tsx"));
10
10
 
11
11
  describe("Accordion component tests", function () {
12
- test("Accordion renders with correct text", function () {
13
- var onChange = jest.fn();
14
-
12
+ test("Renders with correct aria accessibility attributes", function () {
15
13
  var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
16
14
  label: "Accordion",
17
- assistiveText: "Assistive text",
18
- onChange: onChange
19
- })),
20
- getByText = _render.getByText;
15
+ defaultIsExpanded: true
16
+ }, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))),
17
+ getByRole = _render.getByRole;
21
18
 
22
- expect(getByText("Accordion")).toBeTruthy();
23
- expect(getByText("Assistive text")).toBeTruthy();
19
+ var accordion = getByRole("button");
20
+ var panel = getByRole("region");
21
+ expect(accordion.getAttribute("aria-controls")).toBe(panel.id);
22
+ expect(panel.getAttribute("aria-labelledby")).toBe(accordion.id);
24
23
  });
25
- test("Accordion renders expanded by default when it is uncontrolled", function () {
24
+ test("Renders expanded by default when it is uncontrolled", function () {
26
25
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
27
26
  label: "Accordion",
28
27
  defaultIsExpanded: true
@@ -6,12 +6,6 @@ declare type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type Padding = {
10
- top?: Space;
11
- bottom?: Space;
12
- left?: Space;
13
- right?: Space;
14
- };
15
9
  declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
16
10
  declare type Props = {
17
11
  /**
@@ -55,11 +49,6 @@ declare type Props = {
55
49
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
56
50
  */
57
51
  margin?: Space | Margin;
58
- /**
59
- * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
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
52
  /**
64
53
  * Value of the tabindex.
65
54
  */