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

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 (286) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +4 -21
  3. package/HalstackContext.d.ts +52 -139
  4. package/HalstackContext.js +11 -36
  5. package/README.md +47 -0
  6. package/accordion/Accordion.js +31 -84
  7. package/accordion/Accordion.stories.tsx +5 -50
  8. package/accordion/Accordion.test.js +18 -33
  9. package/accordion/types.d.ts +6 -6
  10. package/accordion-group/AccordionGroup.d.ts +2 -3
  11. package/accordion-group/AccordionGroup.js +17 -44
  12. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  13. package/accordion-group/AccordionGroup.test.js +42 -60
  14. package/accordion-group/AccordionGroupAccordion.js +11 -23
  15. package/accordion-group/AccordionGroupContext.d.ts +3 -0
  16. package/accordion-group/AccordionGroupContext.js +8 -0
  17. package/accordion-group/types.d.ts +7 -7
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +48 -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 +29 -118
  24. package/alert/Alert.test.js +28 -45
  25. package/alert/types.d.ts +5 -5
  26. package/badge/Badge.d.ts +1 -1
  27. package/badge/Badge.js +141 -43
  28. package/badge/Badge.stories.tsx +210 -0
  29. package/badge/Badge.test.js +30 -0
  30. package/badge/types.d.ts +52 -3
  31. package/bleed/Bleed.js +13 -21
  32. package/bleed/types.d.ts +2 -2
  33. package/box/Box.js +11 -33
  34. package/box/Box.test.js +1 -6
  35. package/box/types.d.ts +3 -3
  36. package/bulleted-list/BulletedList.js +22 -55
  37. package/bulleted-list/BulletedList.stories.tsx +2 -93
  38. package/bulleted-list/types.d.ts +5 -5
  39. package/button/Button.d.ts +1 -1
  40. package/button/Button.js +68 -100
  41. package/button/Button.stories.tsx +33 -132
  42. package/button/Button.test.js +19 -16
  43. package/button/types.d.ts +9 -5
  44. package/card/Card.js +21 -44
  45. package/card/Card.test.js +10 -21
  46. package/card/types.d.ts +5 -5
  47. package/checkbox/Checkbox.js +85 -120
  48. package/checkbox/Checkbox.stories.tsx +16 -54
  49. package/checkbox/Checkbox.test.js +107 -63
  50. package/checkbox/types.d.ts +8 -4
  51. package/chip/Chip.js +12 -31
  52. package/chip/Chip.stories.tsx +1 -1
  53. package/chip/Chip.test.js +15 -28
  54. package/chip/types.d.ts +4 -4
  55. package/common/coreTokens.d.ts +105 -14
  56. package/common/coreTokens.js +41 -24
  57. package/common/utils.js +2 -8
  58. package/common/variables.d.ts +52 -139
  59. package/common/variables.js +63 -157
  60. package/container/Container.d.ts +4 -0
  61. package/container/Container.js +194 -0
  62. package/container/Container.stories.tsx +214 -0
  63. package/container/types.d.ts +74 -0
  64. package/contextual-menu/ContextualMenu.d.ts +7 -0
  65. package/contextual-menu/ContextualMenu.js +71 -0
  66. package/contextual-menu/ContextualMenu.stories.tsx +182 -0
  67. package/contextual-menu/ContextualMenu.test.js +71 -0
  68. package/contextual-menu/MenuItemAction.d.ts +4 -0
  69. package/contextual-menu/MenuItemAction.js +46 -0
  70. package/contextual-menu/types.d.ts +22 -0
  71. package/contextual-menu/types.js +5 -0
  72. package/date-input/Calendar.js +15 -59
  73. package/date-input/DateInput.js +50 -96
  74. package/date-input/DateInput.stories.tsx +11 -30
  75. package/date-input/DateInput.test.js +674 -701
  76. package/date-input/DatePicker.js +11 -42
  77. package/date-input/Icons.d.ts +6 -6
  78. package/date-input/Icons.js +6 -23
  79. package/date-input/YearPicker.js +8 -34
  80. package/date-input/types.d.ts +28 -22
  81. package/dialog/Dialog.js +13 -40
  82. package/dialog/Dialog.stories.tsx +170 -0
  83. package/dialog/Dialog.test.js +125 -187
  84. package/dialog/types.d.ts +18 -13
  85. package/divider/Divider.d.ts +4 -0
  86. package/divider/Divider.js +36 -0
  87. package/divider/Divider.stories.tsx +223 -0
  88. package/divider/Divider.test.js +38 -0
  89. package/divider/types.d.ts +21 -0
  90. package/divider/types.js +5 -0
  91. package/dropdown/Dropdown.js +59 -128
  92. package/dropdown/Dropdown.stories.tsx +5 -16
  93. package/dropdown/Dropdown.test.js +391 -378
  94. package/dropdown/DropdownMenu.js +8 -19
  95. package/dropdown/DropdownMenuItem.js +11 -20
  96. package/dropdown/types.d.ts +20 -24
  97. package/file-input/FileInput.js +180 -248
  98. package/file-input/FileInput.stories.tsx +1 -1
  99. package/file-input/FileInput.test.js +356 -354
  100. package/file-input/FileItem.js +14 -41
  101. package/file-input/types.d.ts +10 -10
  102. package/flex/Flex.js +25 -39
  103. package/flex/types.d.ts +6 -6
  104. package/footer/Footer.d.ts +1 -1
  105. package/footer/Footer.js +70 -102
  106. package/footer/Footer.stories.tsx +37 -6
  107. package/footer/Footer.test.js +21 -33
  108. package/footer/Icons.d.ts +3 -2
  109. package/footer/Icons.js +66 -7
  110. package/footer/types.d.ts +25 -21
  111. package/grid/Grid.d.ts +1 -1
  112. package/grid/Grid.js +2 -17
  113. package/grid/Grid.stories.tsx +38 -38
  114. package/grid/types.d.ts +10 -10
  115. package/header/Header.d.ts +1 -1
  116. package/header/Header.js +28 -84
  117. package/header/Header.test.js +12 -25
  118. package/header/Icons.d.ts +2 -2
  119. package/header/Icons.js +2 -7
  120. package/header/types.d.ts +7 -8
  121. package/heading/Heading.js +9 -31
  122. package/heading/Heading.test.js +70 -87
  123. package/heading/types.d.ts +7 -7
  124. package/icon/Icon.d.ts +4 -0
  125. package/icon/Icon.js +33 -0
  126. package/icon/Icon.stories.tsx +28 -0
  127. package/icon/types.d.ts +4 -0
  128. package/icon/types.js +5 -0
  129. package/image/Image.d.ts +4 -0
  130. package/image/Image.js +70 -0
  131. package/image/Image.stories.tsx +129 -0
  132. package/image/types.d.ts +72 -0
  133. package/image/types.js +5 -0
  134. package/inset/Inset.js +13 -21
  135. package/inset/types.d.ts +2 -2
  136. package/layout/ApplicationLayout.d.ts +2 -2
  137. package/layout/ApplicationLayout.js +29 -66
  138. package/layout/ApplicationLayout.stories.tsx +1 -1
  139. package/layout/Icons.d.ts +8 -5
  140. package/layout/Icons.js +51 -59
  141. package/layout/types.d.ts +3 -3
  142. package/link/Link.js +21 -42
  143. package/link/Link.test.js +23 -41
  144. package/link/types.d.ts +14 -14
  145. package/main.d.ts +8 -4
  146. package/main.js +39 -59
  147. package/nav-tabs/NavTabs.d.ts +1 -2
  148. package/nav-tabs/NavTabs.js +19 -48
  149. package/nav-tabs/NavTabs.stories.tsx +7 -5
  150. package/nav-tabs/NavTabs.test.js +38 -44
  151. package/nav-tabs/NavTabsContext.d.ts +3 -0
  152. package/nav-tabs/NavTabsContext.js +8 -0
  153. package/nav-tabs/Tab.js +24 -52
  154. package/nav-tabs/types.d.ts +9 -9
  155. package/number-input/NumberInput.js +46 -36
  156. package/number-input/NumberInput.stories.tsx +42 -26
  157. package/number-input/NumberInput.test.js +859 -412
  158. package/number-input/NumberInputContext.d.ts +3 -4
  159. package/number-input/NumberInputContext.js +3 -14
  160. package/number-input/types.d.ts +17 -5
  161. package/package.json +30 -28
  162. package/paginator/Icons.d.ts +5 -5
  163. package/paginator/Icons.js +5 -19
  164. package/paginator/Paginator.js +15 -43
  165. package/paginator/Paginator.test.js +224 -207
  166. package/paginator/types.d.ts +3 -3
  167. package/paragraph/Paragraph.js +3 -19
  168. package/paragraph/Paragraph.stories.tsx +0 -17
  169. package/password-input/Icons.d.ts +6 -0
  170. package/password-input/Icons.js +35 -0
  171. package/password-input/PasswordInput.js +57 -126
  172. package/password-input/PasswordInput.stories.tsx +1 -33
  173. package/password-input/PasswordInput.test.js +157 -140
  174. package/password-input/types.d.ts +8 -7
  175. package/progress-bar/ProgressBar.js +21 -53
  176. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
  177. package/progress-bar/ProgressBar.test.js +35 -52
  178. package/progress-bar/types.d.ts +3 -3
  179. package/quick-nav/QuickNav.js +4 -27
  180. package/quick-nav/QuickNav.stories.tsx +1 -1
  181. package/quick-nav/types.d.ts +10 -10
  182. package/radio-group/Radio.d.ts +1 -1
  183. package/radio-group/Radio.js +22 -54
  184. package/radio-group/RadioGroup.js +37 -83
  185. package/radio-group/RadioGroup.stories.tsx +10 -10
  186. package/radio-group/RadioGroup.test.js +504 -470
  187. package/radio-group/types.d.ts +8 -8
  188. package/resultset-table/Icons.d.ts +7 -0
  189. package/{resultsetTable → resultset-table}/Icons.js +1 -5
  190. package/resultset-table/ResultsetTable.d.ts +7 -0
  191. package/{resultsetTable → resultset-table}/ResultsetTable.js +44 -69
  192. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
  193. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
  194. package/{resultsetTable → resultset-table}/types.d.ts +44 -11
  195. package/resultset-table/types.js +5 -0
  196. package/select/Icons.d.ts +7 -7
  197. package/select/Icons.js +1 -5
  198. package/select/Listbox.js +13 -39
  199. package/select/Option.js +17 -27
  200. package/select/Select.js +87 -163
  201. package/select/Select.stories.tsx +3 -3
  202. package/select/Select.test.js +1946 -1804
  203. package/select/types.d.ts +14 -15
  204. package/sidenav/Icons.d.ts +4 -4
  205. package/sidenav/Icons.js +1 -5
  206. package/sidenav/Sidenav.js +29 -70
  207. package/sidenav/Sidenav.test.js +3 -10
  208. package/{layout → sidenav}/SidenavContext.d.ts +1 -1
  209. package/{layout → sidenav}/SidenavContext.js +3 -9
  210. package/sidenav/types.d.ts +18 -18
  211. package/slider/Slider.js +68 -125
  212. package/slider/Slider.test.js +107 -103
  213. package/slider/types.d.ts +4 -4
  214. package/spinner/Spinner.js +16 -54
  215. package/spinner/Spinner.test.js +25 -34
  216. package/spinner/types.d.ts +3 -3
  217. package/status-light/StatusLight.d.ts +4 -0
  218. package/status-light/StatusLight.js +51 -0
  219. package/status-light/StatusLight.stories.tsx +74 -0
  220. package/status-light/StatusLight.test.js +25 -0
  221. package/status-light/types.d.ts +17 -0
  222. package/status-light/types.js +5 -0
  223. package/switch/Switch.js +49 -97
  224. package/switch/Switch.stories.tsx +0 -34
  225. package/switch/Switch.test.js +51 -96
  226. package/switch/types.d.ts +4 -4
  227. package/table/DropdownTheme.js +62 -0
  228. package/table/Table.d.ts +6 -2
  229. package/table/Table.js +76 -33
  230. package/table/{Table.stories.jsx → Table.stories.tsx} +297 -2
  231. package/table/Table.test.js +93 -6
  232. package/table/types.d.ts +34 -6
  233. package/tabs/Tab.js +17 -33
  234. package/tabs/Tabs.js +52 -129
  235. package/tabs/Tabs.stories.tsx +1 -1
  236. package/tabs/Tabs.test.js +62 -118
  237. package/tabs/types.d.ts +19 -19
  238. package/tag/Tag.js +21 -51
  239. package/tag/Tag.test.js +19 -30
  240. package/tag/types.d.ts +7 -7
  241. package/text-input/Suggestion.js +9 -26
  242. package/text-input/Suggestions.d.ts +1 -1
  243. package/text-input/Suggestions.js +19 -67
  244. package/text-input/TextInput.js +221 -327
  245. package/text-input/TextInput.stories.tsx +49 -153
  246. package/text-input/TextInput.test.js +1227 -1194
  247. package/text-input/types.d.ts +25 -17
  248. package/textarea/Textarea.js +67 -109
  249. package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
  250. package/textarea/Textarea.test.js +150 -179
  251. package/textarea/types.d.ts +9 -5
  252. package/toggle-group/ToggleGroup.js +90 -107
  253. package/toggle-group/ToggleGroup.stories.tsx +7 -4
  254. package/toggle-group/ToggleGroup.test.js +68 -87
  255. package/toggle-group/types.d.ts +26 -17
  256. package/typography/Typography.js +4 -13
  257. package/typography/types.d.ts +1 -1
  258. package/useTheme.d.ts +49 -136
  259. package/useTheme.js +1 -8
  260. package/useTranslatedLabels.js +1 -7
  261. package/utils/BaseTypography.d.ts +2 -2
  262. package/utils/BaseTypography.js +16 -30
  263. package/utils/FocusLock.js +25 -39
  264. package/wizard/Wizard.js +14 -49
  265. package/wizard/Wizard.test.js +53 -80
  266. package/wizard/types.d.ts +7 -7
  267. package/common/OpenSans.css +0 -69
  268. package/common/fonts/OpenSans-Bold.ttf +0 -0
  269. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  270. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  271. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  272. package/common/fonts/OpenSans-Italic.ttf +0 -0
  273. package/common/fonts/OpenSans-Light.ttf +0 -0
  274. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  275. package/common/fonts/OpenSans-Regular.ttf +0 -0
  276. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  277. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  278. package/number-input/numberInputContextTypes.d.ts +0 -19
  279. package/resultsetTable/Icons.d.ts +0 -7
  280. package/resultsetTable/ResultsetTable.d.ts +0 -4
  281. package/slider/Slider.stories.tsx +0 -240
  282. package/text-input/Icons.d.ts +0 -8
  283. package/text-input/Icons.js +0 -60
  284. /package/{resultsetTable → action-icon}/types.js +0 -0
  285. /package/{number-input/numberInputContextTypes.js → container/types.js} +0 -0
  286. /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
@@ -1,47 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = void 0;
11
-
12
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
10
+ var _react = _interopRequireDefault(require("react"));
16
11
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
-
18
12
  var _Flex = _interopRequireDefault(require("../flex/Flex"));
19
-
20
13
  var _Typography = _interopRequireDefault(require("../typography/Typography"));
21
-
22
14
  var _useTheme = _interopRequireDefault(require("../useTheme"));
23
-
24
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
25
-
15
+ var _Icon = _interopRequireDefault(require("../icon/Icon"));
26
16
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
27
-
28
- 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); }
29
-
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
-
17
+ 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); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && 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; }
32
19
  var BulletedListItem = function BulletedListItem(_ref) {
33
20
  var children = _ref.children;
34
21
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
35
22
  };
36
-
37
23
  var DxcBulletedList = function DxcBulletedList(_ref2) {
38
24
  var children = _ref2.children,
39
- _ref2$type = _ref2.type,
40
- type = _ref2$type === void 0 ? "disc" : _ref2$type,
41
- _ref2$icon = _ref2.icon,
42
- icon = _ref2$icon === void 0 ? "" : _ref2$icon;
25
+ _ref2$type = _ref2.type,
26
+ type = _ref2$type === void 0 ? "disc" : _ref2$type,
27
+ _ref2$icon = _ref2.icon,
28
+ icon = _ref2$icon === void 0 ? "" : _ref2$icon;
43
29
  var colorsTheme = (0, _useTheme["default"])();
44
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
45
30
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
46
31
  theme: colorsTheme.bulletedList
47
32
  }, /*#__PURE__*/_react["default"].createElement(ListContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
@@ -50,47 +35,34 @@ var DxcBulletedList = function DxcBulletedList(_ref2) {
50
35
  gap: "0.125rem"
51
36
  }, _react["default"].Children.map(children, function (child, index) {
52
37
  return /*#__PURE__*/_react["default"].createElement(ListItem, null, /*#__PURE__*/_react["default"].createElement(GeneralContent, null, type === "number" ? /*#__PURE__*/_react["default"].createElement(Number, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
53
- color: backgroundType && backgroundType === "dark" ? colorsTheme.bulletedList.fontColorOnDark : colorsTheme.bulletedList.fontColor
54
- }, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Square, {
55
- backgroundType: backgroundType
56
- })) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Circle, {
57
- backgroundType: backgroundType
58
- })) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, {
59
- backgroundType: backgroundType
60
- }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
61
- src: icon
62
- }) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, {
63
- backgroundType: backgroundType
64
- })), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
65
- color: backgroundType && backgroundType === "dark" ? colorsTheme.bulletedList.fontColorOnDark : colorsTheme.bulletedList.fontColor
38
+ color: colorsTheme.bulletedList.fontColor
39
+ }, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Square, null)) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Circle, null)) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
40
+ icon: icon
41
+ }) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, null)), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
42
+ color: colorsTheme.bulletedList.fontColor
66
43
  }, child)));
67
44
  }))));
68
45
  };
69
-
70
46
  DxcBulletedList.Item = BulletedListItem;
71
-
72
47
  var ListContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ul,\n ol {\n padding: 0;\n margin: 0;\n }\n"])));
73
-
74
48
  var Bullet = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-self: flex-start;\n align-items: center;\n height: 1.5rem;\n"])));
75
-
76
49
  var GeneralContent = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n"])));
77
-
78
- var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
50
+ var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n\n font-size: ", ";\n svg {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
79
51
  return props.theme.bulletMarginRight;
80
52
  }, function (props) {
81
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
53
+ return props.theme.fontColor;
54
+ }, function (props) {
55
+ return props.theme.bulletIconWidth;
82
56
  }, function (props) {
83
57
  return props.theme.bulletIconHeight;
84
58
  }, function (props) {
85
59
  return props.theme.bulletIconWidth;
86
60
  });
87
-
88
61
  var Number = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n user-select: none;\n margin-right: ", ";\n display: flex;\n box-sizing: border-box;\n align-self: flex-start;\n min-width: 0;\n"])), function (props) {
89
62
  return props.theme.bulletMarginRight;
90
63
  });
91
-
92
64
  var Square = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n height: ", ";\n width: ", ";\n margin-right: ", ";\n"])), function (props) {
93
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
65
+ return props.theme.fontColor;
94
66
  }, function (props) {
95
67
  return props.theme.bulletHeight;
96
68
  }, function (props) {
@@ -98,19 +70,17 @@ var Square = _styledComponents["default"].div(_templateObject6 || (_templateObje
98
70
  }, function (props) {
99
71
  return props.theme.bulletMarginRight;
100
72
  });
101
-
102
73
  var Circle = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n border-radius: 50%;\n border: 1px solid;\n border-color: ", ";\n margin-right: ", ";\n"])), function (props) {
103
74
  return props.theme.bulletHeight;
104
75
  }, function (props) {
105
76
  return props.theme.bulletWidth;
106
77
  }, function (props) {
107
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
78
+ return props.theme.fontColor;
108
79
  }, function (props) {
109
80
  return props.theme.bulletMarginRight;
110
81
  });
111
-
112
82
  var Disc = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 50%;\n margin-right: ", ";\n"])), function (props) {
113
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
83
+ return props.theme.fontColor;
114
84
  }, function (props) {
115
85
  return props.theme.bulletHeight;
116
86
  }, function (props) {
@@ -118,8 +88,5 @@ var Disc = _styledComponents["default"].div(_templateObject8 || (_templateObject
118
88
  }, function (props) {
119
89
  return props.theme.bulletMarginRight;
120
90
  });
121
-
122
- var ListItem = _styledComponents["default"].li(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n padding: 0px;\n list-style: none;\n display: flex;\n font-size: 1em;\n"])));
123
-
124
- var _default = DxcBulletedList;
125
- exports["default"] = _default;
91
+ var ListItem = _styledComponents["default"].li(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin: 0px;\n padding: 0px;\n list-style: none;\n font-size: 1em;\n"])));
92
+ var _default = exports["default"] = DxcBulletedList;
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
  import styled from "styled-components";
3
3
  import Title from "../../.storybook/components/Title";
4
- import { BackgroundColorProvider } from "../BackgroundColorContext";
5
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
5
  import DxcBulletedList from "./BulletedList";
7
6
 
8
7
  export default {
9
- title: "BulletedList",
8
+ title: "Bulleted List",
10
9
  component: DxcBulletedList,
11
10
  };
12
11
 
@@ -27,7 +26,7 @@ export const Chromatic = () => (
27
26
  <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
28
27
  </DxcBulletedList>
29
28
  <Title title="Icon list (path)" level={4} />
30
- <DxcBulletedList type="icon" icon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg">
29
+ <DxcBulletedList type="icon" icon="filled_check_circle">
31
30
  <DxcBulletedList.Item>Code</DxcBulletedList.Item>
32
31
  <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
33
32
  <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
@@ -108,99 +107,9 @@ export const Chromatic = () => (
108
107
  </DxcBulletedList>
109
108
  </Container>
110
109
  </ExampleContainer>
111
- <BackgroundColorProvider color="#333333">
112
- <DarkContainerForBulletedList>
113
- <Title title="Icon list" theme="dark" level={4} />
114
- <DxcBulletedList type="icon" icon={icon}>
115
- <DxcBulletedList.Item>Code</DxcBulletedList.Item>
116
- <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
117
- <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
118
- </DxcBulletedList>
119
- <Title title="Number list" theme="dark" level={4} />
120
- <DxcBulletedList type="number">
121
- <DxcBulletedList.Item>Code</DxcBulletedList.Item>
122
- <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
123
- <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
124
- </DxcBulletedList>
125
- <Title title="Square" theme="dark" level={4} />
126
- <DxcBulletedList type="square">
127
- <DxcBulletedList.Item>Code</DxcBulletedList.Item>
128
- <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
129
- <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
130
- </DxcBulletedList>
131
- <Title title="Circle" theme="dark" level={4} />
132
- <DxcBulletedList type="circle">
133
- <DxcBulletedList.Item>Code</DxcBulletedList.Item>
134
- <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
135
- <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
136
- </DxcBulletedList>
137
- <Title title="Disc" theme="dark" level={4} />
138
- <DxcBulletedList>
139
- <DxcBulletedList.Item>Code</DxcBulletedList.Item>
140
- <DxcBulletedList.Item>Usage</DxcBulletedList.Item>
141
- <DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
142
- </DxcBulletedList>
143
- <Title title="Multiple lines" theme="dark" level={4} />
144
- <Container>
145
- <Title title="Number" theme="dark" level={4} />
146
- <DxcBulletedList type="number">
147
- <DxcBulletedList.Item>
148
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
149
- dolore magna aliqua.
150
- </DxcBulletedList.Item>
151
- <DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
152
- </DxcBulletedList>
153
- </Container>
154
- <Container>
155
- <Title title="Square" theme="dark" level={4} />
156
- <DxcBulletedList type="square">
157
- <DxcBulletedList.Item>
158
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
159
- dolore magna aliqua.
160
- </DxcBulletedList.Item>
161
- <DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
162
- </DxcBulletedList>
163
- </Container>
164
- <Container>
165
- <Title title="Circle" theme="dark" level={4} />
166
- <DxcBulletedList type="circle">
167
- <DxcBulletedList.Item>
168
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
169
- dolore magna aliqua.
170
- </DxcBulletedList.Item>
171
- <DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
172
- </DxcBulletedList>
173
- </Container>
174
- <Title title="Disc" theme="dark" level={4} />
175
- <Container>
176
- <DxcBulletedList>
177
- <DxcBulletedList.Item>
178
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
179
- dolore magna aliqua.
180
- </DxcBulletedList.Item>
181
- <DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
182
- </DxcBulletedList>
183
- </Container>
184
- <Container>
185
- <Title title="Icon" theme="dark" level={4} />
186
- <DxcBulletedList type="icon" icon={icon}>
187
- <DxcBulletedList.Item>
188
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
189
- dolore magna aliqua.
190
- </DxcBulletedList.Item>
191
- <DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
192
- </DxcBulletedList>
193
- </Container>
194
- </DarkContainerForBulletedList>
195
- </BackgroundColorProvider>
196
110
  </>
197
111
  );
198
112
 
199
113
  const Container = styled.div`
200
114
  width: 400px;
201
115
  `;
202
-
203
- const DarkContainerForBulletedList = styled.div`
204
- background-color: #333333;
205
- padding: 5px;
206
- `;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
3
- declare type IconProps = {
2
+ type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
3
+ type IconProps = {
4
4
  /**
5
5
  * Defines the style of the bullet point in the list.
6
6
  */
@@ -14,7 +14,7 @@ declare type IconProps = {
14
14
  */
15
15
  children: React.ReactNode;
16
16
  };
17
- declare type OtherProps = {
17
+ type OtherProps = {
18
18
  /**
19
19
  * Defines the style of the bullet point in the list.
20
20
  */
@@ -28,9 +28,9 @@ declare type OtherProps = {
28
28
  */
29
29
  children: React.ReactNode;
30
30
  };
31
- declare type Props = IconProps | OtherProps;
31
+ type Props = IconProps | OtherProps;
32
32
  export default Props;
33
- export declare type BulletedListItemPropsType = {
33
+ export type BulletedListItemPropsType = {
34
34
  /**
35
35
  * Text to be shown in the list.
36
36
  */
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import ButtonPropsType from "./types";
3
- declare const DxcButton: ({ label, mode, disabled, iconPosition, type, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
3
+ declare const DxcButton: ({ label, mode, disabled, iconPosition, title, type, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
4
4
  export default DxcButton;
package/button/Button.js CHANGED
@@ -1,102 +1,85 @@
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
- var _react = _interopRequireWildcard(require("react"));
17
-
11
+ var _react = _interopRequireDefault(require("react"));
18
12
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
-
20
13
  var _variables = require("../common/variables");
21
-
22
14
  var _utils = require("../common/utils");
23
-
24
15
  var _useTheme = _interopRequireDefault(require("../useTheme"));
25
-
26
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
27
-
16
+ var _Icon = _interopRequireDefault(require("../icon/Icon"));
28
17
  var _templateObject, _templateObject2, _templateObject3;
29
-
30
- 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); }
31
-
32
- 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; }
33
-
34
- var sizes = {
35
- small: "42px",
36
- medium: "120px",
37
- large: "240px",
38
- fillParent: "100%",
39
- fitContent: "fit-content"
40
- };
41
-
42
- var calculateWidth = function calculateWidth(margin, size) {
43
- if (size === "fillParent") {
44
- return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
45
- }
46
-
47
- return sizes[size];
48
- };
49
-
18
+ 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); }
19
+ 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; }
50
20
  var DxcButton = function DxcButton(_ref) {
51
21
  var _ref$label = _ref.label,
52
- label = _ref$label === void 0 ? "" : _ref$label,
53
- _ref$mode = _ref.mode,
54
- mode = _ref$mode === void 0 ? "primary" : _ref$mode,
55
- _ref$disabled = _ref.disabled,
56
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
57
- _ref$iconPosition = _ref.iconPosition,
58
- iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
59
- _ref$type = _ref.type,
60
- type = _ref$type === void 0 ? "button" : _ref$type,
61
- icon = _ref.icon,
62
- _ref$onClick = _ref.onClick,
63
- _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
64
- margin = _ref.margin,
65
- _ref$size = _ref.size,
66
- size = _ref$size === void 0 ? "fitContent" : _ref$size,
67
- _ref$tabIndex = _ref.tabIndex,
68
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
69
-
22
+ label = _ref$label === void 0 ? "" : _ref$label,
23
+ _ref$mode = _ref.mode,
24
+ mode = _ref$mode === void 0 ? "primary" : _ref$mode,
25
+ _ref$disabled = _ref.disabled,
26
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
27
+ _ref$iconPosition = _ref.iconPosition,
28
+ iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
29
+ title = _ref.title,
30
+ _ref$type = _ref.type,
31
+ type = _ref$type === void 0 ? "button" : _ref$type,
32
+ icon = _ref.icon,
33
+ _ref$onClick = _ref.onClick,
34
+ _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
35
+ margin = _ref.margin,
36
+ _ref$size = _ref.size,
37
+ size = _ref$size === void 0 ? "fitContent" : _ref$size,
38
+ _ref$tabIndex = _ref.tabIndex,
39
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
70
40
  var colorsTheme = (0, _useTheme["default"])();
71
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
72
41
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
73
42
  theme: colorsTheme.button
74
43
  }, /*#__PURE__*/_react["default"].createElement(Button, {
75
- type: type,
76
- mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
44
+ "aria-label": title,
77
45
  disabled: disabled,
78
- tabIndex: disabled ? -1 : tabIndex,
79
- backgroundType: backgroundType,
80
- size: size,
81
- margin: margin,
82
46
  onClick: function onClick() {
83
47
  _onClick();
84
- }
85
- }, label && iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
86
- icon: icon,
87
- iconPosition: iconPosition
88
- }, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
89
- label: label,
90
- iconPosition: iconPosition
91
- }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
92
- src: icon
93
- }) : icon), label && iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
94
- icon: icon,
95
- iconPosition: iconPosition
96
- }, label)));
48
+ },
49
+ tabIndex: disabled ? -1 : tabIndex,
50
+ title: title,
51
+ type: type,
52
+ $mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
53
+ hasLabel: label ? true : false,
54
+ hasIcon: icon ? true : false,
55
+ iconPosition: iconPosition,
56
+ size: size,
57
+ margin: margin
58
+ }, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, null, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
59
+ icon: icon
60
+ }) : icon)));
97
61
  };
98
-
99
- var Button = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-flex;\n width: ", ";\n height: 40px;\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n align-items: center;\n justify-content: center;\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n cursor: pointer;\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n ", "\n"])), function (props) {
62
+ var sizes = {
63
+ small: "42px",
64
+ medium: "120px",
65
+ large: "240px",
66
+ fillParent: "100%",
67
+ fitContent: "fit-content"
68
+ };
69
+ var calculateWidth = function calculateWidth(margin, size) {
70
+ return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
71
+ };
72
+ var getButtonStyles = function getButtonStyles($mode, theme) {
73
+ return "\n border-color: ".concat($mode === "secondary" ? theme.secondaryBorderColor : "", ";\n border-radius: ").concat($mode === "primary" ? theme.primaryBorderRadius : $mode === "secondary" ? theme.secondaryBorderRadius : theme.textBorderRadius, ";\n border-width: ").concat($mode === "primary" ? theme.primaryBorderThickness : $mode === "secondary" ? theme.secondaryBorderThickness : theme.textBorderThickness, ";\n border-style: ").concat($mode === "primary" ? theme.primaryBorderStyle : $mode === "secondary" ? theme.secondaryBorderStyle : theme.textBorderStyle, ";\n font-family: ").concat($mode === "primary" ? theme.primaryFontFamily : $mode === "secondary" ? theme.secondaryFontFamily : theme.textFontFamily, ";\n font-size: ").concat($mode === "primary" ? theme.primaryFontSize : $mode === "secondary" ? theme.secondaryFontSize : theme.textFontSize, ";\n font-weight: ").concat($mode === "primary" ? theme.primaryFontWeight : $mode === "secondary" ? theme.secondaryFontWeight : theme.textFontWeight, ";\n background-color: ").concat($mode === "primary" ? theme.primaryBackgroundColor : $mode === "secondary" ? theme.secondaryBackgroundColor : theme.textBackgroundColor, ";\n color: ").concat($mode === "primary" ? theme.primaryFontColor : $mode === "secondary" ? theme.secondaryFontColor : theme.textFontColor, ";\n ");
74
+ };
75
+ var getButtonStates = function getButtonStates(disabled, $mode, theme) {
76
+ return "\n &:hover {\n background-color: ".concat($mode === "primary" ? theme.primaryHoverBackgroundColor : $mode === "secondary" ? theme.secondaryHoverBackgroundColor : theme.textHoverBackgroundColor, ";\n color: ").concat($mode === "secondary" ? theme.secondaryHoverFontColor : "", ";\n }\n &:focus {\n border-color: ").concat($mode === "secondary" ? "transparent" : "", ";\n }\n &:active {\n background-color: ").concat($mode === "primary" ? theme.primaryActiveBackgroundColor : $mode === "secondary" ? theme.secondaryActiveBackgroundColor : theme.textActiveBackgroundColor, ";\n color: ").concat($mode === "secondary" ? theme.secondaryHoverFontColor : "", ";\n border-color: ").concat($mode === "secondary" ? "transparent" : "", ";\n outline: none;\n box-shadow: ").concat(!disabled ? "0 0 0 2px ".concat(theme.focusBorderColor) : "", ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat($mode === "primary" ? theme.primaryDisabledBackgroundColor : $mode === "secondary" ? theme.secondaryDisabledBackgroundColor : theme.textDisabledBackgroundColor, ";\n color: ").concat($mode === "primary" ? theme.primaryDisabledFontColor : $mode === "secondary" ? theme.secondaryDisabledFontColor : theme.textDisabledFontColor, ";\n border-color: ").concat($mode === "secondary" ? theme.secondaryDisabledBorderColor : "", ";\n }\n");
77
+ };
78
+ var Button = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: ", ";\n gap: 0.5rem;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: 40px;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n cursor: pointer;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n\n ", "\n ", "\n"])), function (props) {
79
+ return props.iconPosition === "after" ? "row" : "row-reverse";
80
+ }, function (props) {
81
+ return calculateWidth(props.margin, props.size);
82
+ }, function (props) {
100
83
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
101
84
  }, function (props) {
102
85
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -106,16 +89,14 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
106
89
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
107
90
  }, function (props) {
108
91
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
109
- }, function (props) {
110
- return calculateWidth(props.margin, props.size);
111
- }, function (props) {
112
- return props.theme.paddingLeft;
113
- }, function (props) {
114
- return props.theme.paddingRight;
115
92
  }, function (props) {
116
93
  return props.theme.paddingTop;
117
94
  }, function (props) {
118
95
  return props.theme.paddingBottom;
96
+ }, function (props) {
97
+ return props.hasIcon && !props.hasLabel ? props.theme.paddingLeft : "calc(".concat(props.theme.paddingLeft, " + 8px)");
98
+ }, function (props) {
99
+ return props.hasIcon && !props.hasLabel ? props.theme.paddingRight : "calc(".concat(props.theme.paddingRight, " + 8px)");
119
100
  }, function (props) {
120
101
  return props.theme.fontFamily;
121
102
  }, function (props) {
@@ -125,29 +106,16 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
125
106
  }, function (props) {
126
107
  return props.theme.labelLetterSpacing;
127
108
  }, function (props) {
128
- return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
109
+ return props.theme.focusBorderColor;
110
+ }, function (props) {
111
+ return getButtonStyles(props.$mode, props.theme);
129
112
  }, function (props) {
130
- var mode = props.mode,
131
- backgroundType = props.backgroundType,
132
- disabled = props.disabled;
133
- return "\n border-radius: ".concat(props.mode === "primary" ? props.theme.primaryBorderRadius : props.mode === "secondary" ? props.theme.secondaryBorderRadius : props.theme.textBorderRadius, ";\n border-width: ").concat(props.mode === "primary" ? props.theme.primaryBorderThickness : props.mode === "secondary" ? props.theme.secondaryBorderThickness : props.theme.textBorderThickness, ";\n border-style: ").concat(mode === "primary" ? props.theme.primaryBorderStyle : mode === "secondary" ? props.theme.secondaryBorderStyle : props.theme.textBorderStyle, ";\n font-family: ").concat(mode === "primary" ? props.theme.primaryFontFamily : mode === "secondary" ? props.theme.secondaryFontFamily : props.theme.textFontFamily, ";\n font-size: ").concat(mode === "primary" ? props.theme.primaryFontSize : mode === "secondary" ? props.theme.secondaryFontSize : props.theme.textFontSize, ";\n font-weight: ").concat(mode === "primary" ? props.theme.primaryFontWeight : mode === "secondary" ? props.theme.secondaryFontWeight : props.theme.textFontWeight, ";\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor : backgroundType === "dark" ? props.theme.textBackgroundColorOnDark : props.theme.textBackgroundColor, ";\n color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor : backgroundType === "dark" ? props.theme.textFontColorOnDark : props.theme.textFontColor, ";\n border-color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor : "", ";\n &:hover {\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor : backgroundType === "dark" ? props.theme.textHoverBackgroundColorOnDark : props.theme.textHoverBackgroundColor, ";\n color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor : "", ";\n }\n &:focus {\n border-color: ").concat(mode === "secondary" ? "transparent" : "", ";\n }\n &:active {\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor : backgroundType === "dark" ? props.theme.textActiveBackgroundColorOnDark : props.theme.textActiveBackgroundColor, ";\n color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor : "", ";\n border-color: ").concat(mode === "secondary" ? "transparent" : "", ";\n outline: none;\n box-shadow: ").concat(!disabled ? "0 0 0 2px ".concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor) : "", ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor : backgroundType === "dark" ? props.theme.textDisabledBackgroundColorOnDark : props.theme.textDisabledBackgroundColor, ";\n color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor : backgroundType === "dark" ? props.theme.textDisabledFontColorOnDark : props.theme.textDisabledFontColor, ";\n border-color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor : "", ";\n }\n ");
113
+ return getButtonStates(props.disabled, props.$mode, props.theme);
134
114
  });
135
-
136
- var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n white-space: nowrap;\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
115
+ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n white-space: nowrap;\n"])), function (props) {
137
116
  return props.theme.labelFontLineHeight;
138
117
  }, function (props) {
139
118
  return props.theme.fontSize;
140
- }, function (props) {
141
- return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
142
- }, function (props) {
143
- return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
144
119
  });
145
-
146
- var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-left: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
147
- return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
148
- }, function (props) {
149
- return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
150
- });
151
-
152
- var _default = DxcButton;
153
- exports["default"] = _default;
120
+ var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-size: 24px;\n\n svg {\n height: 24px;\n width: 24px;\n }\n"])));
121
+ var _default = exports["default"] = DxcButton;