@dxc-technology/halstack-react 0.0.0-da4b2be → 0.0.0-da9270d

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 (236) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +4 -21
  3. package/HalstackContext.d.ts +23 -124
  4. package/HalstackContext.js +10 -35
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +24 -76
  8. package/accordion/Accordion.stories.tsx +1 -113
  9. package/accordion/Accordion.test.js +18 -33
  10. package/accordion/types.d.ts +5 -17
  11. package/accordion-group/AccordionGroup.js +15 -42
  12. package/accordion-group/AccordionGroup.stories.tsx +78 -77
  13. package/accordion-group/AccordionGroup.test.js +43 -71
  14. package/accordion-group/AccordionGroupAccordion.js +9 -21
  15. package/accordion-group/types.d.ts +6 -18
  16. package/alert/Alert.js +15 -50
  17. package/alert/Alert.test.js +28 -45
  18. package/alert/types.d.ts +5 -5
  19. package/badge/Badge.js +4 -17
  20. package/badge/types.d.ts +1 -1
  21. package/bleed/Bleed.js +13 -21
  22. package/bleed/types.d.ts +2 -2
  23. package/box/Box.js +11 -33
  24. package/box/Box.test.js +1 -6
  25. package/box/types.d.ts +3 -3
  26. package/bulleted-list/BulletedList.js +18 -54
  27. package/bulleted-list/BulletedList.stories.tsx +1 -92
  28. package/bulleted-list/types.d.ts +5 -5
  29. package/button/Button.d.ts +1 -1
  30. package/button/Button.js +66 -99
  31. package/button/Button.stories.tsx +6 -87
  32. package/button/Button.test.js +17 -16
  33. package/button/types.d.ts +8 -4
  34. package/card/Card.d.ts +1 -1
  35. package/card/Card.js +39 -79
  36. package/card/Card.stories.tsx +0 -29
  37. package/card/Card.test.js +10 -21
  38. package/card/types.d.ts +6 -12
  39. package/checkbox/Checkbox.js +85 -120
  40. package/checkbox/Checkbox.stories.tsx +16 -54
  41. package/checkbox/Checkbox.test.js +107 -63
  42. package/checkbox/types.d.ts +8 -4
  43. package/chip/Chip.js +12 -31
  44. package/chip/Chip.stories.tsx +1 -1
  45. package/chip/Chip.test.js +15 -28
  46. package/chip/types.d.ts +4 -4
  47. package/common/coreTokens.d.ts +105 -14
  48. package/common/coreTokens.js +41 -24
  49. package/common/utils.js +2 -8
  50. package/common/variables.d.ts +23 -124
  51. package/common/variables.js +27 -135
  52. package/container/Container.d.ts +4 -0
  53. package/container/Container.js +194 -0
  54. package/container/Container.stories.tsx +214 -0
  55. package/container/types.d.ts +74 -0
  56. package/date-input/Calendar.js +15 -59
  57. package/date-input/DateInput.js +50 -96
  58. package/date-input/DateInput.stories.tsx +11 -30
  59. package/date-input/DateInput.test.js +674 -701
  60. package/date-input/DatePicker.js +11 -42
  61. package/date-input/Icons.d.ts +6 -6
  62. package/date-input/Icons.js +6 -23
  63. package/date-input/YearPicker.js +8 -34
  64. package/date-input/types.d.ts +27 -21
  65. package/dialog/Dialog.js +13 -40
  66. package/dialog/Dialog.stories.tsx +170 -0
  67. package/dialog/Dialog.test.js +125 -187
  68. package/dialog/types.d.ts +18 -13
  69. package/dropdown/Dropdown.js +39 -93
  70. package/dropdown/Dropdown.test.js +391 -378
  71. package/dropdown/DropdownMenu.js +8 -19
  72. package/dropdown/DropdownMenuItem.js +5 -17
  73. package/dropdown/types.d.ts +17 -19
  74. package/file-input/FileInput.js +180 -248
  75. package/file-input/FileInput.stories.tsx +1 -1
  76. package/file-input/FileInput.test.js +356 -354
  77. package/file-input/FileItem.js +14 -41
  78. package/file-input/types.d.ts +10 -10
  79. package/flex/Flex.js +25 -39
  80. package/flex/types.d.ts +6 -6
  81. package/footer/Footer.d.ts +1 -1
  82. package/footer/Footer.js +54 -112
  83. package/footer/Footer.stories.tsx +19 -95
  84. package/footer/Footer.test.js +21 -33
  85. package/footer/Icons.d.ts +2 -2
  86. package/footer/Icons.js +2 -7
  87. package/footer/types.d.ts +21 -29
  88. package/grid/Grid.d.ts +1 -1
  89. package/grid/Grid.js +2 -17
  90. package/grid/Grid.stories.tsx +38 -38
  91. package/grid/types.d.ts +10 -10
  92. package/header/Header.d.ts +2 -2
  93. package/header/Header.js +31 -114
  94. package/header/Header.stories.tsx +7 -71
  95. package/header/Header.test.js +12 -25
  96. package/header/Icons.d.ts +2 -2
  97. package/header/Icons.js +2 -7
  98. package/header/types.d.ts +5 -20
  99. package/heading/Heading.js +9 -31
  100. package/heading/Heading.test.js +70 -87
  101. package/heading/types.d.ts +7 -7
  102. package/image/Image.d.ts +4 -0
  103. package/image/Image.js +70 -0
  104. package/image/Image.stories.tsx +127 -0
  105. package/image/types.d.ts +72 -0
  106. package/inset/Inset.js +13 -21
  107. package/inset/types.d.ts +2 -2
  108. package/layout/ApplicationLayout.d.ts +3 -3
  109. package/layout/ApplicationLayout.js +28 -65
  110. package/layout/ApplicationLayout.stories.tsx +1 -1
  111. package/layout/Icons.d.ts +8 -5
  112. package/layout/Icons.js +51 -59
  113. package/layout/SidenavContext.d.ts +1 -1
  114. package/layout/SidenavContext.js +3 -9
  115. package/layout/types.d.ts +3 -3
  116. package/link/Link.js +21 -42
  117. package/link/Link.test.js +23 -41
  118. package/link/types.d.ts +14 -14
  119. package/main.d.ts +4 -3
  120. package/main.js +17 -58
  121. package/nav-tabs/NavTabs.js +11 -43
  122. package/nav-tabs/NavTabs.stories.tsx +1 -1
  123. package/nav-tabs/NavTabs.test.js +36 -43
  124. package/nav-tabs/Tab.js +16 -45
  125. package/nav-tabs/types.d.ts +9 -9
  126. package/number-input/NumberInput.d.ts +7 -0
  127. package/number-input/NumberInput.js +26 -35
  128. package/number-input/NumberInput.stories.tsx +42 -26
  129. package/number-input/NumberInput.test.js +700 -412
  130. package/number-input/types.d.ts +11 -5
  131. package/package.json +30 -28
  132. package/paginator/Icons.d.ts +5 -5
  133. package/paginator/Icons.js +5 -19
  134. package/paginator/Paginator.js +15 -43
  135. package/paginator/Paginator.test.js +224 -207
  136. package/paginator/types.d.ts +3 -3
  137. package/paragraph/Paragraph.js +3 -19
  138. package/paragraph/Paragraph.stories.tsx +0 -17
  139. package/password-input/Icons.d.ts +6 -0
  140. package/password-input/Icons.js +35 -0
  141. package/password-input/PasswordInput.js +57 -126
  142. package/password-input/PasswordInput.stories.tsx +1 -33
  143. package/password-input/PasswordInput.test.js +157 -140
  144. package/password-input/types.d.ts +8 -7
  145. package/progress-bar/ProgressBar.js +21 -53
  146. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
  147. package/progress-bar/ProgressBar.test.js +35 -52
  148. package/progress-bar/types.d.ts +3 -3
  149. package/quick-nav/QuickNav.js +4 -27
  150. package/quick-nav/QuickNav.stories.tsx +1 -1
  151. package/quick-nav/types.d.ts +10 -10
  152. package/radio-group/Radio.d.ts +1 -1
  153. package/radio-group/Radio.js +22 -54
  154. package/radio-group/RadioGroup.js +37 -83
  155. package/radio-group/RadioGroup.stories.tsx +10 -10
  156. package/radio-group/RadioGroup.test.js +504 -470
  157. package/radio-group/types.d.ts +8 -8
  158. package/resultset-table/Icons.d.ts +7 -0
  159. package/{resultsetTable → resultset-table}/Icons.js +1 -5
  160. package/{resultsetTable → resultset-table}/ResultsetTable.js +23 -59
  161. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
  162. package/{resultsetTable → resultset-table}/types.d.ts +7 -7
  163. package/resultset-table/types.js +5 -0
  164. package/select/Icons.d.ts +7 -7
  165. package/select/Icons.js +1 -5
  166. package/select/Listbox.js +13 -39
  167. package/select/Option.js +9 -26
  168. package/select/Select.js +70 -155
  169. package/select/Select.stories.tsx +3 -3
  170. package/select/Select.test.js +1946 -1804
  171. package/select/types.d.ts +14 -15
  172. package/sidenav/Icons.d.ts +4 -4
  173. package/sidenav/Icons.js +1 -5
  174. package/sidenav/Sidenav.js +26 -68
  175. package/sidenav/Sidenav.test.js +3 -10
  176. package/sidenav/types.d.ts +18 -18
  177. package/slider/Slider.js +68 -125
  178. package/slider/Slider.test.js +107 -103
  179. package/slider/types.d.ts +4 -4
  180. package/spinner/Spinner.js +16 -54
  181. package/spinner/Spinner.test.js +25 -34
  182. package/spinner/types.d.ts +3 -3
  183. package/switch/Switch.js +49 -97
  184. package/switch/Switch.stories.tsx +0 -34
  185. package/switch/Switch.test.js +51 -96
  186. package/switch/types.d.ts +4 -4
  187. package/table/Table.js +5 -27
  188. package/table/Table.test.js +1 -6
  189. package/table/types.d.ts +8 -8
  190. package/tabs/Tab.js +10 -29
  191. package/tabs/Tabs.js +52 -129
  192. package/tabs/Tabs.test.js +62 -118
  193. package/tabs/types.d.ts +19 -19
  194. package/tag/Tag.js +21 -51
  195. package/tag/Tag.test.js +19 -30
  196. package/tag/types.d.ts +7 -7
  197. package/text-input/Icons.d.ts +5 -5
  198. package/text-input/Icons.js +1 -5
  199. package/text-input/Suggestion.js +9 -26
  200. package/text-input/Suggestions.d.ts +1 -1
  201. package/text-input/Suggestions.js +15 -65
  202. package/text-input/TextInput.js +204 -284
  203. package/text-input/TextInput.stories.tsx +48 -152
  204. package/text-input/TextInput.test.js +1210 -1194
  205. package/text-input/types.d.ts +25 -17
  206. package/textarea/Textarea.js +67 -109
  207. package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
  208. package/textarea/Textarea.test.js +150 -179
  209. package/textarea/types.d.ts +9 -5
  210. package/toggle-group/ToggleGroup.js +90 -107
  211. package/toggle-group/ToggleGroup.stories.tsx +7 -4
  212. package/toggle-group/ToggleGroup.test.js +68 -87
  213. package/toggle-group/types.d.ts +26 -17
  214. package/typography/Typography.js +4 -13
  215. package/typography/types.d.ts +1 -1
  216. package/useTheme.d.ts +20 -121
  217. package/useTheme.js +1 -8
  218. package/useTranslatedLabels.js +1 -7
  219. package/utils/BaseTypography.d.ts +2 -2
  220. package/utils/BaseTypography.js +16 -30
  221. package/utils/FocusLock.js +22 -39
  222. package/wizard/Wizard.js +14 -49
  223. package/wizard/Wizard.test.js +53 -80
  224. package/wizard/types.d.ts +6 -6
  225. package/card/ice-cream.jpg +0 -0
  226. package/number-input/NumberInputContext.d.ts +0 -4
  227. package/number-input/NumberInputContext.js +0 -19
  228. package/number-input/numberInputContextTypes.d.ts +0 -19
  229. package/resultsetTable/Icons.d.ts +0 -7
  230. package/slider/Slider.stories.tsx +0 -240
  231. /package/{resultsetTable → container}/types.js +0 -0
  232. /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
  233. /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
  234. /package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +0 -0
  235. /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
  236. /package/table/{Table.stories.jsx → Table.stories.tsx} +0 -0
@@ -1,47 +1,31 @@
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
-
26
15
  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
-
16
+ 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); }
17
+ 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
18
  var BulletedListItem = function BulletedListItem(_ref) {
33
19
  var children = _ref.children;
34
20
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
35
21
  };
36
-
37
22
  var DxcBulletedList = function DxcBulletedList(_ref2) {
38
23
  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;
24
+ _ref2$type = _ref2.type,
25
+ type = _ref2$type === void 0 ? "disc" : _ref2$type,
26
+ _ref2$icon = _ref2.icon,
27
+ icon = _ref2$icon === void 0 ? "" : _ref2$icon;
43
28
  var colorsTheme = (0, _useTheme["default"])();
44
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
45
29
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
46
30
  theme: colorsTheme.bulletedList
47
31
  }, /*#__PURE__*/_react["default"].createElement(ListContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
@@ -50,47 +34,32 @@ var DxcBulletedList = function DxcBulletedList(_ref2) {
50
34
  gap: "0.125rem"
51
35
  }, _react["default"].Children.map(children, function (child, index) {
52
36
  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", {
37
+ color: colorsTheme.bulletedList.fontColor
38
+ }, 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("img", {
61
39
  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
40
+ }) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, null)), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
41
+ color: colorsTheme.bulletedList.fontColor
66
42
  }, child)));
67
43
  }))));
68
44
  };
69
-
70
45
  DxcBulletedList.Item = BulletedListItem;
71
-
72
46
  var ListContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ul,\n ol {\n padding: 0;\n margin: 0;\n }\n"])));
73
-
74
47
  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
48
  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) {
49
+ 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 svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
79
50
  return props.theme.bulletMarginRight;
80
51
  }, function (props) {
81
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
52
+ return props.theme.fontColor;
82
53
  }, function (props) {
83
54
  return props.theme.bulletIconHeight;
84
55
  }, function (props) {
85
56
  return props.theme.bulletIconWidth;
86
57
  });
87
-
88
58
  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
59
  return props.theme.bulletMarginRight;
90
60
  });
91
-
92
61
  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;
62
+ return props.theme.fontColor;
94
63
  }, function (props) {
95
64
  return props.theme.bulletHeight;
96
65
  }, function (props) {
@@ -98,19 +67,17 @@ var Square = _styledComponents["default"].div(_templateObject6 || (_templateObje
98
67
  }, function (props) {
99
68
  return props.theme.bulletMarginRight;
100
69
  });
101
-
102
70
  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
71
  return props.theme.bulletHeight;
104
72
  }, function (props) {
105
73
  return props.theme.bulletWidth;
106
74
  }, function (props) {
107
- return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
75
+ return props.theme.fontColor;
108
76
  }, function (props) {
109
77
  return props.theme.bulletMarginRight;
110
78
  });
111
-
112
79
  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;
80
+ return props.theme.fontColor;
114
81
  }, function (props) {
115
82
  return props.theme.bulletHeight;
116
83
  }, function (props) {
@@ -118,8 +85,5 @@ var Disc = _styledComponents["default"].div(_templateObject8 || (_templateObject
118
85
  }, function (props) {
119
86
  return props.theme.bulletMarginRight;
120
87
  });
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;
88
+ 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"])));
89
+ 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
 
@@ -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,84 @@
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
-
28
16
  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
-
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" != _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
19
  var DxcButton = function DxcButton(_ref) {
51
20
  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
-
21
+ label = _ref$label === void 0 ? "" : _ref$label,
22
+ _ref$mode = _ref.mode,
23
+ mode = _ref$mode === void 0 ? "primary" : _ref$mode,
24
+ _ref$disabled = _ref.disabled,
25
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
26
+ _ref$iconPosition = _ref.iconPosition,
27
+ iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
28
+ title = _ref.title,
29
+ _ref$type = _ref.type,
30
+ type = _ref$type === void 0 ? "button" : _ref$type,
31
+ icon = _ref.icon,
32
+ _ref$onClick = _ref.onClick,
33
+ _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
34
+ margin = _ref.margin,
35
+ _ref$size = _ref.size,
36
+ size = _ref$size === void 0 ? "fitContent" : _ref$size,
37
+ _ref$tabIndex = _ref.tabIndex,
38
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
70
39
  var colorsTheme = (0, _useTheme["default"])();
71
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
72
40
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
73
41
  theme: colorsTheme.button
74
42
  }, /*#__PURE__*/_react["default"].createElement(Button, {
75
- type: type,
76
- mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
43
+ "aria-label": title,
77
44
  disabled: disabled,
78
- tabIndex: disabled ? -1 : tabIndex,
79
- backgroundType: backgroundType,
80
- size: size,
81
- margin: margin,
82
45
  onClick: function onClick() {
83
46
  _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", {
47
+ },
48
+ tabIndex: disabled ? -1 : tabIndex,
49
+ title: title,
50
+ type: type,
51
+ $mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
52
+ hasLabel: label ? true : false,
53
+ hasIcon: icon ? true : false,
54
+ iconPosition: iconPosition,
55
+ size: size,
56
+ margin: margin
57
+ }, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, null, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
92
58
  src: icon
93
- }) : icon), label && iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
94
- icon: icon,
95
- iconPosition: iconPosition
96
- }, label)));
59
+ }) : icon)));
97
60
  };
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) {
61
+ var sizes = {
62
+ small: "42px",
63
+ medium: "120px",
64
+ large: "240px",
65
+ fillParent: "100%",
66
+ fitContent: "fit-content"
67
+ };
68
+ var calculateWidth = function calculateWidth(margin, size) {
69
+ return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
70
+ };
71
+ var getButtonStyles = function getButtonStyles($mode, theme) {
72
+ 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 ");
73
+ };
74
+ var getButtonStates = function getButtonStates(disabled, $mode, theme) {
75
+ 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");
76
+ };
77
+ 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) {
78
+ return props.iconPosition === "after" ? "row" : "row-reverse";
79
+ }, function (props) {
80
+ return calculateWidth(props.margin, props.size);
81
+ }, function (props) {
100
82
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
101
83
  }, function (props) {
102
84
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -106,16 +88,14 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
106
88
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
107
89
  }, function (props) {
108
90
  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
91
  }, function (props) {
116
92
  return props.theme.paddingTop;
117
93
  }, function (props) {
118
94
  return props.theme.paddingBottom;
95
+ }, function (props) {
96
+ return props.hasIcon && !props.hasLabel ? props.theme.paddingLeft : "calc(".concat(props.theme.paddingLeft, " + 8px)");
97
+ }, function (props) {
98
+ return props.hasIcon && !props.hasLabel ? props.theme.paddingRight : "calc(".concat(props.theme.paddingRight, " + 8px)");
119
99
  }, function (props) {
120
100
  return props.theme.fontFamily;
121
101
  }, function (props) {
@@ -125,29 +105,16 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
125
105
  }, function (props) {
126
106
  return props.theme.labelLetterSpacing;
127
107
  }, function (props) {
128
- return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
108
+ return props.theme.focusBorderColor;
109
+ }, function (props) {
110
+ return getButtonStyles(props.$mode, props.theme);
129
111
  }, 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 ");
112
+ return getButtonStates(props.disabled, props.$mode, props.theme);
134
113
  });
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) {
114
+ 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
115
  return props.theme.labelFontLineHeight;
138
116
  }, function (props) {
139
117
  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
118
  });
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;
119
+ var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])));
120
+ var _default = exports["default"] = DxcButton;