@dxc-technology/halstack-react 0.0.0-1c4cbc0 → 0.0.0-1c9e3f9

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 (329) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +5 -22
  3. package/HalstackContext.d.ts +1231 -6
  4. package/HalstackContext.js +127 -111
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +116 -160
  8. package/accordion/Accordion.stories.tsx +102 -126
  9. package/accordion/Accordion.test.js +25 -41
  10. package/accordion/types.d.ts +5 -16
  11. package/accordion-group/AccordionGroup.d.ts +4 -3
  12. package/accordion-group/AccordionGroup.js +31 -98
  13. package/accordion-group/AccordionGroup.stories.tsx +94 -67
  14. package/accordion-group/AccordionGroup.test.js +52 -105
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +31 -0
  17. package/accordion-group/types.d.ts +11 -16
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +47 -0
  20. package/action-icon/ActionIcon.stories.tsx +41 -0
  21. package/action-icon/ActionIcon.test.js +64 -0
  22. package/action-icon/types.d.ts +26 -0
  23. package/alert/Alert.js +20 -59
  24. package/alert/Alert.stories.tsx +28 -0
  25. package/alert/Alert.test.js +29 -46
  26. package/alert/types.d.ts +5 -5
  27. package/badge/Badge.d.ts +1 -1
  28. package/badge/Badge.js +141 -41
  29. package/badge/Badge.stories.tsx +210 -0
  30. package/badge/Badge.test.js +30 -0
  31. package/badge/types.d.ts +52 -2
  32. package/bleed/Bleed.js +14 -55
  33. package/bleed/Bleed.stories.tsx +95 -95
  34. package/bleed/types.d.ts +2 -2
  35. package/box/Box.d.ts +1 -1
  36. package/box/Box.js +30 -81
  37. package/box/Box.stories.tsx +38 -51
  38. package/box/Box.test.js +2 -7
  39. package/box/types.d.ts +3 -14
  40. package/bulleted-list/BulletedList.d.ts +7 -0
  41. package/bulleted-list/BulletedList.js +89 -0
  42. package/bulleted-list/BulletedList.stories.tsx +115 -0
  43. package/bulleted-list/types.d.ts +38 -0
  44. package/button/Button.d.ts +1 -1
  45. package/button/Button.js +63 -117
  46. package/button/Button.stories.tsx +160 -90
  47. package/button/Button.test.js +20 -17
  48. package/button/types.d.ts +12 -8
  49. package/card/Card.d.ts +1 -1
  50. package/card/Card.js +64 -107
  51. package/card/Card.stories.tsx +12 -42
  52. package/card/Card.test.js +11 -22
  53. package/card/types.d.ts +6 -11
  54. package/checkbox/Checkbox.d.ts +2 -2
  55. package/checkbox/Checkbox.js +140 -182
  56. package/checkbox/Checkbox.stories.tsx +128 -94
  57. package/checkbox/Checkbox.test.js +160 -39
  58. package/checkbox/types.d.ts +11 -3
  59. package/chip/Chip.js +39 -79
  60. package/chip/Chip.stories.tsx +121 -26
  61. package/chip/Chip.test.js +16 -31
  62. package/chip/types.d.ts +4 -4
  63. package/common/OpenSans.css +68 -80
  64. package/common/coreTokens.d.ts +237 -0
  65. package/common/coreTokens.js +184 -0
  66. package/common/utils.d.ts +1 -0
  67. package/common/utils.js +6 -12
  68. package/common/variables.d.ts +1383 -0
  69. package/common/variables.js +930 -1140
  70. package/container/Container.d.ts +4 -0
  71. package/container/Container.js +194 -0
  72. package/container/Container.stories.tsx +214 -0
  73. package/container/types.d.ts +74 -0
  74. package/date-input/Calendar.d.ts +4 -0
  75. package/date-input/Calendar.js +214 -0
  76. package/date-input/DateInput.js +150 -299
  77. package/date-input/DateInput.stories.tsx +203 -56
  78. package/date-input/DateInput.test.js +700 -371
  79. package/date-input/DatePicker.d.ts +4 -0
  80. package/date-input/DatePicker.js +115 -0
  81. package/date-input/Icons.d.ts +6 -0
  82. package/date-input/Icons.js +58 -0
  83. package/date-input/YearPicker.d.ts +4 -0
  84. package/date-input/YearPicker.js +100 -0
  85. package/date-input/types.d.ts +72 -15
  86. package/dialog/Dialog.d.ts +1 -1
  87. package/dialog/Dialog.js +73 -107
  88. package/dialog/Dialog.stories.tsx +320 -167
  89. package/dialog/Dialog.test.js +287 -20
  90. package/dialog/types.d.ts +18 -25
  91. package/dropdown/Dropdown.d.ts +1 -1
  92. package/dropdown/Dropdown.js +248 -303
  93. package/dropdown/Dropdown.stories.tsx +245 -56
  94. package/dropdown/Dropdown.test.js +575 -165
  95. package/dropdown/DropdownMenu.d.ts +4 -0
  96. package/dropdown/DropdownMenu.js +63 -0
  97. package/dropdown/DropdownMenuItem.d.ts +4 -0
  98. package/dropdown/DropdownMenuItem.js +67 -0
  99. package/dropdown/types.d.ts +32 -14
  100. package/file-input/FileInput.d.ts +2 -2
  101. package/file-input/FileInput.js +241 -355
  102. package/file-input/FileInput.stories.tsx +123 -12
  103. package/file-input/FileInput.test.js +369 -367
  104. package/file-input/FileItem.d.ts +4 -14
  105. package/file-input/FileItem.js +45 -96
  106. package/file-input/types.d.ts +25 -8
  107. package/flex/Flex.d.ts +4 -0
  108. package/flex/Flex.js +57 -0
  109. package/flex/Flex.stories.tsx +112 -0
  110. package/flex/types.d.ts +97 -0
  111. package/footer/Footer.d.ts +1 -1
  112. package/footer/Footer.js +70 -117
  113. package/footer/Footer.stories.tsx +60 -19
  114. package/footer/Footer.test.js +33 -57
  115. package/footer/Icons.d.ts +3 -2
  116. package/footer/Icons.js +67 -8
  117. package/footer/types.d.ts +25 -26
  118. package/grid/Grid.d.ts +7 -0
  119. package/grid/Grid.js +76 -0
  120. package/grid/Grid.stories.tsx +219 -0
  121. package/grid/types.d.ts +115 -0
  122. package/header/Header.d.ts +4 -3
  123. package/header/Header.js +85 -168
  124. package/header/Header.stories.tsx +118 -39
  125. package/header/Header.test.js +13 -26
  126. package/header/Icons.d.ts +2 -2
  127. package/header/Icons.js +4 -9
  128. package/header/types.d.ts +5 -19
  129. package/heading/Heading.js +10 -32
  130. package/heading/Heading.test.js +71 -88
  131. package/heading/types.d.ts +7 -7
  132. package/image/Image.d.ts +4 -0
  133. package/image/Image.js +70 -0
  134. package/image/Image.stories.tsx +127 -0
  135. package/image/types.d.ts +72 -0
  136. package/inset/Inset.js +14 -55
  137. package/inset/Inset.stories.tsx +37 -36
  138. package/inset/types.d.ts +2 -2
  139. package/layout/ApplicationLayout.d.ts +16 -6
  140. package/layout/ApplicationLayout.js +82 -166
  141. package/layout/ApplicationLayout.stories.tsx +85 -94
  142. package/layout/Icons.d.ts +8 -0
  143. package/layout/Icons.js +51 -48
  144. package/layout/SidenavContext.d.ts +5 -0
  145. package/layout/SidenavContext.js +13 -0
  146. package/layout/types.d.ts +19 -35
  147. package/link/Link.d.ts +2 -2
  148. package/link/Link.js +42 -89
  149. package/link/Link.stories.tsx +73 -6
  150. package/link/Link.test.js +24 -44
  151. package/link/types.d.ts +14 -15
  152. package/main.d.ts +12 -12
  153. package/main.js +51 -101
  154. package/nav-tabs/NavTabs.d.ts +8 -0
  155. package/nav-tabs/NavTabs.js +93 -0
  156. package/nav-tabs/NavTabs.stories.tsx +276 -0
  157. package/nav-tabs/NavTabs.test.js +76 -0
  158. package/nav-tabs/Tab.d.ts +4 -0
  159. package/nav-tabs/Tab.js +118 -0
  160. package/nav-tabs/types.d.ts +52 -0
  161. package/nav-tabs/types.js +5 -0
  162. package/number-input/NumberInput.d.ts +7 -0
  163. package/number-input/NumberInput.js +26 -35
  164. package/number-input/NumberInput.stories.tsx +42 -26
  165. package/number-input/NumberInput.test.js +701 -377
  166. package/number-input/types.d.ts +11 -5
  167. package/package.json +43 -45
  168. package/paginator/Icons.d.ts +5 -0
  169. package/paginator/Icons.js +21 -47
  170. package/paginator/Paginator.js +23 -59
  171. package/paginator/Paginator.stories.tsx +24 -0
  172. package/paginator/Paginator.test.js +280 -211
  173. package/paginator/types.d.ts +3 -3
  174. package/paragraph/Paragraph.d.ts +5 -0
  175. package/paragraph/Paragraph.js +22 -0
  176. package/paragraph/Paragraph.stories.tsx +27 -0
  177. package/password-input/Icons.d.ts +6 -0
  178. package/password-input/Icons.js +35 -0
  179. package/password-input/PasswordInput.js +57 -126
  180. package/password-input/PasswordInput.stories.tsx +1 -33
  181. package/password-input/PasswordInput.test.js +160 -142
  182. package/password-input/types.d.ts +8 -7
  183. package/progress-bar/ProgressBar.js +65 -91
  184. package/progress-bar/ProgressBar.stories.tsx +93 -0
  185. package/progress-bar/ProgressBar.test.js +72 -44
  186. package/progress-bar/types.d.ts +3 -3
  187. package/quick-nav/QuickNav.js +67 -42
  188. package/quick-nav/QuickNav.stories.tsx +146 -27
  189. package/quick-nav/types.d.ts +10 -10
  190. package/radio-group/Radio.d.ts +1 -1
  191. package/radio-group/Radio.js +59 -76
  192. package/radio-group/RadioGroup.js +67 -114
  193. package/radio-group/RadioGroup.stories.tsx +132 -18
  194. package/radio-group/RadioGroup.test.js +518 -457
  195. package/radio-group/types.d.ts +10 -10
  196. package/resultset-table/Icons.d.ts +7 -0
  197. package/resultset-table/Icons.js +47 -0
  198. package/resultset-table/ResultsetTable.d.ts +7 -0
  199. package/resultset-table/ResultsetTable.js +167 -0
  200. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +136 -30
  201. package/resultset-table/ResultsetTable.test.js +371 -0
  202. package/{resultsetTable → resultset-table}/types.d.ts +13 -7
  203. package/resultset-table/types.js +5 -0
  204. package/select/Icons.d.ts +7 -7
  205. package/select/Icons.js +1 -5
  206. package/select/Listbox.d.ts +1 -1
  207. package/select/Listbox.js +42 -51
  208. package/select/Option.js +27 -50
  209. package/select/Select.js +173 -237
  210. package/select/Select.stories.tsx +516 -139
  211. package/select/Select.test.js +2009 -1696
  212. package/select/types.d.ts +16 -20
  213. package/sidenav/Icons.d.ts +7 -0
  214. package/sidenav/Icons.js +47 -0
  215. package/sidenav/Sidenav.d.ts +6 -5
  216. package/sidenav/Sidenav.js +131 -71
  217. package/sidenav/Sidenav.stories.tsx +251 -151
  218. package/sidenav/Sidenav.test.js +26 -45
  219. package/sidenav/types.d.ts +52 -26
  220. package/slider/Slider.d.ts +2 -2
  221. package/slider/Slider.js +148 -181
  222. package/slider/Slider.test.js +185 -81
  223. package/slider/types.d.ts +7 -3
  224. package/spinner/Spinner.js +31 -75
  225. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
  226. package/spinner/Spinner.test.js +26 -35
  227. package/spinner/types.d.ts +3 -3
  228. package/status-light/StatusLight.d.ts +4 -0
  229. package/status-light/StatusLight.js +51 -0
  230. package/status-light/StatusLight.stories.tsx +74 -0
  231. package/status-light/StatusLight.test.js +25 -0
  232. package/status-light/types.d.ts +17 -0
  233. package/status-light/types.js +5 -0
  234. package/switch/Switch.d.ts +2 -2
  235. package/switch/Switch.js +145 -126
  236. package/switch/Switch.stories.tsx +37 -60
  237. package/switch/Switch.test.js +138 -56
  238. package/switch/types.d.ts +7 -3
  239. package/table/ActionsCell.d.ts +4 -0
  240. package/table/ActionsCell.js +55 -0
  241. package/table/DropdownTheme.js +57 -0
  242. package/table/Table.d.ts +4 -1
  243. package/table/Table.js +27 -32
  244. package/table/Table.stories.tsx +615 -0
  245. package/table/Table.test.js +95 -8
  246. package/table/types.d.ts +45 -6
  247. package/tabs/Tab.d.ts +4 -0
  248. package/tabs/Tab.js +116 -0
  249. package/tabs/Tabs.js +314 -141
  250. package/tabs/Tabs.stories.tsx +120 -6
  251. package/tabs/Tabs.test.js +223 -69
  252. package/tabs/types.d.ts +28 -18
  253. package/tag/Tag.js +29 -61
  254. package/tag/Tag.stories.tsx +14 -1
  255. package/tag/Tag.test.js +20 -31
  256. package/tag/types.d.ts +7 -7
  257. package/text-input/Icons.d.ts +8 -0
  258. package/text-input/Icons.js +56 -0
  259. package/text-input/Suggestion.js +40 -28
  260. package/text-input/Suggestions.d.ts +4 -0
  261. package/text-input/Suggestions.js +84 -0
  262. package/text-input/TextInput.js +308 -506
  263. package/text-input/TextInput.stories.tsx +266 -275
  264. package/text-input/TextInput.test.js +1402 -1375
  265. package/text-input/types.d.ts +43 -16
  266. package/textarea/Textarea.js +70 -113
  267. package/textarea/Textarea.stories.tsx +174 -0
  268. package/textarea/Textarea.test.js +152 -183
  269. package/textarea/types.d.ts +9 -5
  270. package/toggle-group/ToggleGroup.d.ts +2 -2
  271. package/toggle-group/ToggleGroup.js +92 -106
  272. package/toggle-group/ToggleGroup.stories.tsx +49 -4
  273. package/toggle-group/ToggleGroup.test.js +69 -88
  274. package/toggle-group/types.d.ts +26 -17
  275. package/typography/Typography.d.ts +4 -0
  276. package/typography/Typography.js +23 -0
  277. package/typography/Typography.stories.tsx +198 -0
  278. package/typography/types.d.ts +18 -0
  279. package/typography/types.js +5 -0
  280. package/useTheme.d.ts +1135 -1
  281. package/useTheme.js +2 -9
  282. package/useTranslatedLabels.d.ts +84 -1
  283. package/useTranslatedLabels.js +1 -7
  284. package/utils/BaseTypography.d.ts +21 -0
  285. package/utils/BaseTypography.js +94 -0
  286. package/utils/FocusLock.d.ts +13 -0
  287. package/utils/FocusLock.js +124 -0
  288. package/wizard/Wizard.js +24 -66
  289. package/wizard/Wizard.stories.tsx +40 -1
  290. package/wizard/Wizard.test.js +54 -81
  291. package/wizard/types.d.ts +7 -7
  292. package/card/ice-cream.jpg +0 -0
  293. package/common/RequiredComponent.js +0 -32
  294. package/list/List.d.ts +0 -4
  295. package/list/List.js +0 -47
  296. package/list/List.stories.tsx +0 -95
  297. package/list/types.d.ts +0 -7
  298. package/number-input/NumberInputContext.d.ts +0 -4
  299. package/number-input/NumberInputContext.js +0 -19
  300. package/number-input/numberInputContextTypes.d.ts +0 -19
  301. package/progress-bar/ProgressBar.stories.jsx +0 -58
  302. package/radio/Radio.d.ts +0 -4
  303. package/radio/Radio.js +0 -173
  304. package/radio/Radio.stories.tsx +0 -192
  305. package/radio/Radio.test.js +0 -71
  306. package/radio/types.d.ts +0 -54
  307. package/resultsetTable/ResultsetTable.d.ts +0 -4
  308. package/resultsetTable/ResultsetTable.js +0 -254
  309. package/resultsetTable/ResultsetTable.test.js +0 -306
  310. package/row/Row.d.ts +0 -3
  311. package/row/Row.js +0 -127
  312. package/row/Row.stories.tsx +0 -237
  313. package/row/types.d.ts +0 -28
  314. package/slider/Slider.stories.tsx +0 -177
  315. package/stack/Stack.d.ts +0 -3
  316. package/stack/Stack.js +0 -97
  317. package/stack/Stack.stories.tsx +0 -164
  318. package/stack/types.d.ts +0 -24
  319. package/table/Table.stories.jsx +0 -277
  320. package/text/Text.d.ts +0 -7
  321. package/text/Text.js +0 -30
  322. package/text/Text.stories.tsx +0 -19
  323. package/textarea/Textarea.stories.jsx +0 -157
  324. /package/{list → action-icon}/types.js +0 -0
  325. /package/{radio → bulleted-list}/types.js +0 -0
  326. /package/{resultsetTable → container}/types.js +0 -0
  327. /package/{row → flex}/types.js +0 -0
  328. /package/{stack → grid}/types.js +0 -0
  329. /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
@@ -1,114 +1,122 @@
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
- var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
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");
33
-
14
+ var _utils = require("../common/utils");
15
+ var _variables = require("../common/variables");
34
16
  var _useTheme = _interopRequireDefault(require("../useTheme"));
35
-
36
- var _BackgroundColorContext = require("../BackgroundColorContext");
37
-
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
39
-
40
- 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
-
42
- 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
-
17
+ var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
18
+ var _uuid = require("uuid");
19
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
20
+ 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); }
21
+ 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 && Object.prototype.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; }
22
+ var expandLess = /*#__PURE__*/_react["default"].createElement("svg", {
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ height: "24",
25
+ width: "24",
26
+ fill: "currentColor"
27
+ }, /*#__PURE__*/_react["default"].createElement("path", {
28
+ d: "m7.4 15.375-1.4-1.4 6-6 6 6-1.4 1.4-4.6-4.6Z"
29
+ }));
30
+ var expandMore = /*#__PURE__*/_react["default"].createElement("svg", {
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ height: "24",
33
+ width: "24",
34
+ fill: "currentColor"
35
+ }, /*#__PURE__*/_react["default"].createElement("path", {
36
+ d: "m12 15.375-6-6 1.4-1.4 4.6 4.6 4.6-4.6 1.4 1.4Z"
37
+ }));
44
38
  var DxcAccordion = function DxcAccordion(_ref) {
45
39
  var _ref$label = _ref.label,
46
- label = _ref$label === void 0 ? "" : _ref$label,
47
- defaultIsExpanded = _ref.defaultIsExpanded,
48
- isExpanded = _ref.isExpanded,
49
- icon = _ref.icon,
50
- _ref$assistiveText = _ref.assistiveText,
51
- assistiveText = _ref$assistiveText === void 0 ? "" : _ref$assistiveText,
52
- _ref$disabled = _ref.disabled,
53
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
54
- onChange = _ref.onChange,
55
- children = _ref.children,
56
- margin = _ref.margin,
57
- padding = _ref.padding,
58
- _ref$tabIndex = _ref.tabIndex,
59
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
60
-
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];
65
-
40
+ label = _ref$label === void 0 ? "" : _ref$label,
41
+ defaultIsExpanded = _ref.defaultIsExpanded,
42
+ isExpanded = _ref.isExpanded,
43
+ icon = _ref.icon,
44
+ _ref$assistiveText = _ref.assistiveText,
45
+ assistiveText = _ref$assistiveText === void 0 ? "" : _ref$assistiveText,
46
+ _ref$disabled = _ref.disabled,
47
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
48
+ onChange = _ref.onChange,
49
+ children = _ref.children,
50
+ margin = _ref.margin,
51
+ _ref$tabIndex = _ref.tabIndex,
52
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
53
+ var _useState = (0, _react.useState)((0, _uuid.v4)()),
54
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
55
+ id = _useState2[0];
56
+ var _useState3 = (0, _react.useState)(defaultIsExpanded !== null && defaultIsExpanded !== void 0 ? defaultIsExpanded : false),
57
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
58
+ innerIsExpanded = _useState4[0],
59
+ setInnerIsExpanded = _useState4[1];
66
60
  var colorsTheme = (0, _useTheme["default"])();
67
-
68
- var handlerAccordion = function handlerAccordion() {
69
- if (isExpanded == null) {
70
- setInnerIsExpanded(!innerIsExpanded);
71
- }
72
-
73
- if (typeof onChange === "function") {
74
- onChange(isExpanded == null ? !innerIsExpanded : !isExpanded);
75
- }
61
+ var handleAccordionState = function handleAccordionState() {
62
+ var _isExpanded;
63
+ isExpanded !== null && isExpanded !== void 0 ? isExpanded : setInnerIsExpanded(function (innerIsExpanded) {
64
+ return !innerIsExpanded;
65
+ });
66
+ onChange === null || onChange === void 0 ? void 0 : onChange((_isExpanded = !isExpanded) !== null && _isExpanded !== void 0 ? _isExpanded : !innerIsExpanded);
76
67
  };
77
-
78
68
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
79
69
  theme: colorsTheme.accordion
80
- }, /*#__PURE__*/_react["default"].createElement(DXCAccordion, {
81
- padding: padding,
82
- margin: margin,
70
+ }, /*#__PURE__*/_react["default"].createElement(AccordionContainer, {
71
+ isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
72
+ margin: margin
73
+ }, /*#__PURE__*/_react["default"].createElement(AccordionHeader, null, /*#__PURE__*/_react["default"].createElement(AccordionTrigger, {
74
+ id: "accordion-".concat(id),
75
+ onClick: disabled ? undefined : handleAccordionState,
83
76
  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, {
77
+ tabIndex: disabled ? -1 : tabIndex,
78
+ "aria-expanded": isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
79
+ "aria-controls": "accordion-panel-".concat(id),
80
+ isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded
81
+ }, /*#__PURE__*/_react["default"].createElement(AccordionInfo, null, /*#__PURE__*/_react["default"].createElement(AccordionLabel, null, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
95
82
  disabled: disabled
96
- }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(AccordionIcon, {
83
+ }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
97
84
  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, {
85
+ }) : icon), /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
86
+ color: disabled ? colorsTheme.accordion.disabledTitleLabelFontColor : colorsTheme.accordion.titleLabelFontColor,
87
+ fontFamily: colorsTheme.accordion.titleLabelFontFamily,
88
+ fontSize: colorsTheme.accordion.titleLabelFontSize,
89
+ fontStyle: colorsTheme.accordion.titleLabelFontStyle,
90
+ fontWeight: colorsTheme.accordion.titleLabelFontWeight,
91
+ lineHeight: "1.5em"
92
+ }, label)), assistiveText && /*#__PURE__*/_react["default"].createElement(AccordionAssistiveText, null, /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
93
+ color: disabled ? colorsTheme.accordion.disabledAssistiveTextFontColor : colorsTheme.accordion.assistiveTextFontColor,
94
+ fontFamily: colorsTheme.accordion.assistiveTextFontFamily,
95
+ fontSize: colorsTheme.accordion.assistiveTextFontSize,
96
+ fontStyle: colorsTheme.accordion.assistiveTextFontStyle,
97
+ fontWeight: colorsTheme.accordion.assistiveTextFontWeight,
98
+ letterSpacing: colorsTheme.accordion.assistiveTextLetterSpacing,
99
+ lineHeight: "1.5em"
100
+ }, assistiveText))), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
101
101
  disabled: disabled
102
- }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
103
- color: colorsTheme.accordion.backgroundColor
104
- }, children))))));
102
+ }, (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) ? expandLess : expandMore))), (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) && /*#__PURE__*/_react["default"].createElement(AccordionPanel, {
103
+ id: "accordion-panel-".concat(id),
104
+ role: "region",
105
+ "aria-labelledby": "accordion-".concat(id)
106
+ }, children)));
105
107
  };
106
-
107
108
  var calculateWidth = function calculateWidth(margin) {
108
109
  return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
109
110
  };
110
-
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) {
111
+ 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) {
112
+ return props.theme.backgroundColor;
113
+ }, function (props) {
114
+ return props.theme.borderRadius;
115
+ }, function (props) {
116
+ return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
117
+ }, function (props) {
118
+ return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
119
+ }, function (props) {
112
120
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
113
121
  }, function (props) {
114
122
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -120,33 +128,23 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
120
128
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
121
129
  }, function (props) {
122
130
  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) {
131
+ });
132
+ 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"])));
133
+ 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
134
  return props.theme.borderRadius;
135
135
  }, function (props) {
136
- return props.theme.focusBorderColor;
137
- }, function (props) {
138
- return props.theme.focusBorderStyle;
136
+ return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
139
137
  }, function (props) {
140
- return props.theme.focusBorderThickness;
138
+ return props.disabled ? "not-allowed" : "pointer";
141
139
  }, function (props) {
142
- return props.theme.backgroundColor;
140
+ return "".concat(props.theme.focusBorderColor, " ").concat(props.theme.focusBorderStyle, " ").concat(props.theme.focusBorderThickness);
143
141
  }, function (props) {
144
142
  return "".concat(props.theme.hoverBackgroundColor);
145
143
  }, function (props) {
146
144
  return "".concat(props.theme.hoverBackgroundColor);
147
- }, function (props) {
148
- return props.theme.borderRadius;
149
- }, function (props) {
145
+ });
146
+ var AccordionInfo = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: space-between;\n width: 100%;\n"])));
147
+ 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
148
  return props.theme.titleLabelPaddingTop;
151
149
  }, function (props) {
152
150
  return props.theme.titleLabelPaddingBottom;
@@ -154,73 +152,31 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
154
152
  return props.theme.titleLabelPaddingRight;
155
153
  }, function (props) {
156
154
  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
155
  });
170
-
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;
156
+ 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) {
157
+ return props.theme.iconMarginLeft;
177
158
  }, function (props) {
178
- return props.theme.titleLabelFontSize;
159
+ return props.theme.iconMarginRigth;
179
160
  }, function (props) {
180
- return props.theme.titleLabelFontStyle;
161
+ return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
181
162
  }, function (props) {
182
- return props.theme.titleFonLabeltWeight;
163
+ return props.theme.iconSize;
183
164
  }, function (props) {
184
- return props.disabled ? props.theme.disabledTitleLabelFontColor : props.theme.titleLabelFontColor;
165
+ return props.theme.iconSize;
185
166
  });
186
-
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) {
167
+ var AccordionAssistiveText = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: ", ";\n padding-left: ", ";\n padding-right: ", ";\n"])), function (props) {
168
+ return props.theme.assistiveTextMinWidth;
169
+ }, function (props) {
192
170
  return props.theme.assistiveTextPaddingLeft;
193
171
  }, function (props) {
194
172
  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
173
  });
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;
174
+ 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) {
175
+ return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
176
+ });
177
+ var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n"])), function (props) {
178
+ return props.theme.borderRadius;
219
179
  }, function (props) {
220
- return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
180
+ return props.theme.borderRadius;
221
181
  });
222
-
223
- var AccordionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])([""])));
224
-
225
- var _default = DxcAccordion;
226
- exports["default"] = _default;
182
+ 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";
@@ -15,7 +12,7 @@ export default {
15
12
  const folderIcon = (
16
13
  <svg
17
14
  xmlns="http://www.w3.org/2000/svg"
18
- enable-background="new 0 0 24 24"
15
+ enableBackground="new 0 0 24 24"
19
16
  height="24px"
20
17
  viewBox="0 0 24 24"
21
18
  width="24px"
@@ -30,10 +27,33 @@ const folderIcon = (
30
27
  </svg>
31
28
  );
32
29
 
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" />
30
+ const smallIcon = (
31
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
32
+ <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" />
33
+ </svg>
34
+ );
35
+
36
+ const facebookIcon = (
37
+ <svg
38
+ version="1.1"
39
+ id="Capa_1"
40
+ x="0px"
41
+ y="0px"
42
+ width="438.536px"
43
+ height="438.536px"
44
+ viewBox="0 0 438.536 438.536"
45
+ fill="currentColor"
46
+ >
47
+ <g>
48
+ <path
49
+ 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
50
+ 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
51
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
52
+ 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
53
+ 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
54
+ 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"
55
+ />
56
+ </g>
37
57
  </svg>
38
58
  );
39
59
 
@@ -47,6 +67,14 @@ const advancedTheme = {
47
67
  },
48
68
  };
49
69
 
70
+ const opinionatedTheme = {
71
+ accordion: {
72
+ accentColor: "#5f249f",
73
+ titleFontColor: "#000000",
74
+ assistiveTextFontColor: "#666666",
75
+ },
76
+ };
77
+
50
78
  export const Chromatic = () => (
51
79
  <>
52
80
  <Title title="Component anatomy" theme="light" level={2} />
@@ -78,8 +106,30 @@ export const Chromatic = () => (
78
106
  </DxcAccordion>
79
107
  </ExampleContainer>
80
108
  <ExampleContainer>
81
- <Title title="With bigger icon 48x48" theme="light" level={4} />
82
- <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={thumbIcon}>
109
+ <Title title="With smaller icon" theme="light" level={4} />
110
+ <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={smallIcon}>
111
+ <div>
112
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
113
+ lobortis eget.
114
+ </div>
115
+ </DxcAccordion>
116
+ </ExampleContainer>
117
+ <ExampleContainer>
118
+ <Title title="With bigger icon (SVG)" theme="light" level={4} />
119
+ <DxcAccordion label="Accordion Test" assistiveText="Assistive text" icon={facebookIcon}>
120
+ <div>
121
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
122
+ lobortis eget.
123
+ </div>
124
+ </DxcAccordion>
125
+ </ExampleContainer>
126
+ <ExampleContainer>
127
+ <Title title="With bigger icon (image)" theme="light" level={4} />
128
+ <DxcAccordion
129
+ label="Accordion"
130
+ assistiveText="Assistive text"
131
+ icon="https://www.freepnglogos.com/uploads/facebook-logo-design-1.png"
132
+ >
83
133
  <div>
84
134
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
85
135
  lobortis eget.
@@ -123,121 +173,6 @@ export const Chromatic = () => (
123
173
  </div>
124
174
  </DxcAccordion>
125
175
  </ExampleContainer>
126
- <ExampleContainer>
127
- <Title title="Background color provider over accordion content" theme="light" level={4} />
128
- <HalstackProvider advancedTheme={advancedTheme}>
129
- <DxcAccordion
130
- label="Dark Accordion"
131
- defaultIsExpanded
132
- assistiveText="Assistive text"
133
- icon={folderIcon}
134
- padding="medium"
135
- >
136
- <div style={{ display: "flex", flexDirection: "column" }}>
137
- <DxcTextInput
138
- label="Label"
139
- helperText="HelperText"
140
- placeholder="Placeholder"
141
- size="fillParent"
142
- margin={{ bottom: "medium" }}
143
- />
144
- <DxcButton label="Submit" size="medium" />
145
- </div>
146
- </DxcAccordion>
147
- </HalstackProvider>
148
- </ExampleContainer>
149
- <Title title="Paddings" theme="light" level={2} />
150
- <ExampleContainer>
151
- <Title title="Xxsmall padding" theme="light" level={4} />
152
- <DxcAccordion label="Xxsmall padding" defaultIsExpanded padding="xxsmall">
153
- <div>
154
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
155
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
156
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
157
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
158
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
159
- est laborum.
160
- </div>
161
- </DxcAccordion>
162
- </ExampleContainer>
163
- <ExampleContainer>
164
- <Title title="Xsmall padding" theme="light" level={4} />
165
- <DxcAccordion label="Xsmall padding" defaultIsExpanded padding="xsmall">
166
- <div>
167
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
168
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
169
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
170
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
171
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
172
- est laborum.
173
- </div>
174
- </DxcAccordion>
175
- </ExampleContainer>
176
- <ExampleContainer>
177
- <Title title="Small padding" theme="light" level={4} />
178
- <DxcAccordion label="Small padding" defaultIsExpanded padding="small">
179
- <div>
180
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
181
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
182
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
183
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
184
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
185
- est laborum.
186
- </div>
187
- </DxcAccordion>
188
- </ExampleContainer>
189
- <ExampleContainer>
190
- <Title title="Medium padding" theme="light" level={4} />
191
- <DxcAccordion label="Medium padding" defaultIsExpanded padding="medium">
192
- <div>
193
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
194
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
195
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
196
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
197
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
198
- est laborum.
199
- </div>
200
- </DxcAccordion>
201
- </ExampleContainer>
202
- <ExampleContainer>
203
- <Title title="Large padding" theme="light" level={4} />
204
- <DxcAccordion label="Large padding" defaultIsExpanded padding="large">
205
- <div>
206
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
207
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
208
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
209
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
210
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
211
- est laborum.
212
- </div>
213
- </DxcAccordion>
214
- </ExampleContainer>
215
- <ExampleContainer>
216
- <Title title="Xlarge padding" theme="light" level={4} />
217
- <DxcAccordion label="Xlarge padding" defaultIsExpanded padding="xlarge">
218
- <div>
219
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
220
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
221
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
222
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
223
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
224
- est laborum.
225
- </div>
226
- </DxcAccordion>
227
- </ExampleContainer>
228
- <ExampleContainer>
229
- <Title title="Xxlarge padding" theme="light" level={4} />
230
- <DxcAccordion label="Xxlarge padding" defaultIsExpanded padding="xxlarge">
231
- <div>
232
- <DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
233
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
234
- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
235
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
236
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
237
- est laborum.
238
- </div>
239
- </DxcAccordion>
240
- </ExampleContainer>
241
176
  <Title title="Margins" theme="light" level={2} />
242
177
  <ExampleContainer>
243
178
  <Title title="Xxsmall margin" theme="light" level={4} />
@@ -301,7 +236,48 @@ export const Chromatic = () => (
301
236
  lobortis eget.
302
237
  </div>
303
238
  </DxcAccordion>
304
- <hr />
239
+ </ExampleContainer>
240
+ <Title title="Opinionated theme" theme="light" level={2} />
241
+ <ExampleContainer>
242
+ <Title title="With assistive text and icon" theme="light" level={4} />
243
+ <HalstackProvider theme={opinionatedTheme}>
244
+ <DxcAccordion label="Accordion" assistiveText="Assistive text" icon={folderIcon}>
245
+ Content
246
+ </DxcAccordion>
247
+ </HalstackProvider>
248
+ </ExampleContainer>
249
+ <ExampleContainer pseudoState="pseudo-hover">
250
+ <Title title="Hovered" theme="light" level={4} />
251
+ <HalstackProvider theme={opinionatedTheme}>
252
+ <DxcAccordion label="Hovered">
253
+ <div>
254
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
255
+ leo lobortis eget.
256
+ </div>
257
+ </DxcAccordion>
258
+ </HalstackProvider>
259
+ </ExampleContainer>
260
+ <ExampleContainer pseudoState="pseudo-active">
261
+ <Title title="Active" theme="light" level={4} />
262
+ <HalstackProvider theme={opinionatedTheme}>
263
+ <DxcAccordion label="Active">
264
+ <div>
265
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
266
+ leo lobortis eget.
267
+ </div>
268
+ </DxcAccordion>
269
+ </HalstackProvider>
270
+ </ExampleContainer>
271
+ <ExampleContainer>
272
+ <Title title="Disabled" theme="light" level={4} />
273
+ <HalstackProvider theme={opinionatedTheme}>
274
+ <DxcAccordion label="Disabled" assistiveText="Assistive text" icon={folderIcon} disabled>
275
+ <div>
276
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
277
+ leo lobortis eget.
278
+ </div>
279
+ </DxcAccordion>
280
+ </HalstackProvider>
305
281
  </ExampleContainer>
306
282
  </>
307
283
  );