@dxc-technology/halstack-react 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/accordion/Accordion.js +122 -103
  2. package/accordion/Accordion.stories.tsx +1 -2
  3. package/accordion/Accordion.test.js +9 -10
  4. package/accordion/types.d.ts +4 -4
  5. package/accordion-group/AccordionGroup.js +1 -21
  6. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  7. package/accordion-group/AccordionGroup.test.js +20 -45
  8. package/accordion-group/types.d.ts +9 -3
  9. package/alert/Alert.js +1 -1
  10. package/box/Box.js +1 -1
  11. package/bulleted-list/types.d.ts +1 -1
  12. package/button/Button.js +43 -61
  13. package/button/Button.stories.tsx +9 -0
  14. package/button/types.d.ts +7 -7
  15. package/checkbox/Checkbox.js +88 -95
  16. package/checkbox/Checkbox.test.js +93 -16
  17. package/checkbox/types.d.ts +2 -2
  18. package/chip/types.d.ts +1 -1
  19. package/common/variables.js +23 -10
  20. package/date-input/DateInput.js +3 -3
  21. package/dialog/Dialog.js +52 -28
  22. package/dialog/Dialog.stories.tsx +1 -2
  23. package/dialog/Dialog.test.js +34 -4
  24. package/dialog/types.d.ts +2 -2
  25. package/dropdown/Dropdown.d.ts +1 -1
  26. package/dropdown/Dropdown.js +243 -247
  27. package/dropdown/Dropdown.stories.tsx +126 -63
  28. package/dropdown/Dropdown.test.js +510 -108
  29. package/dropdown/DropdownMenu.d.ts +4 -0
  30. package/dropdown/DropdownMenu.js +80 -0
  31. package/dropdown/DropdownMenuItem.d.ts +4 -0
  32. package/dropdown/DropdownMenuItem.js +92 -0
  33. package/dropdown/types.d.ts +25 -5
  34. package/flex/Flex.js +1 -1
  35. package/flex/types.d.ts +1 -1
  36. package/footer/Footer.stories.tsx +8 -1
  37. package/footer/types.d.ts +1 -1
  38. package/header/Header.js +74 -72
  39. package/header/Header.stories.tsx +4 -4
  40. package/header/Icons.js +2 -2
  41. package/header/types.d.ts +2 -2
  42. package/layout/ApplicationLayout.js +3 -3
  43. package/layout/ApplicationLayout.stories.tsx +1 -0
  44. package/link/Link.js +1 -1
  45. package/link/Link.stories.tsx +12 -5
  46. package/link/types.d.ts +1 -1
  47. package/package.json +10 -10
  48. package/progress-bar/ProgressBar.d.ts +2 -2
  49. package/progress-bar/ProgressBar.js +56 -50
  50. package/progress-bar/ProgressBar.stories.jsx +3 -1
  51. package/progress-bar/ProgressBar.test.js +67 -22
  52. package/progress-bar/types.d.ts +3 -4
  53. package/radio-group/RadioGroup.js +11 -13
  54. package/select/Listbox.d.ts +1 -1
  55. package/select/Listbox.js +25 -2
  56. package/select/Select.js +14 -31
  57. package/select/Select.stories.tsx +6 -5
  58. package/select/Select.test.js +63 -50
  59. package/select/types.d.ts +2 -4
  60. package/sidenav/Sidenav.js +15 -3
  61. package/sidenav/types.d.ts +1 -1
  62. package/slider/Slider.js +114 -93
  63. package/slider/Slider.stories.tsx +7 -1
  64. package/slider/Slider.test.js +121 -21
  65. package/slider/types.d.ts +2 -2
  66. package/switch/Switch.d.ts +1 -1
  67. package/switch/Switch.js +111 -55
  68. package/switch/Switch.stories.tsx +8 -30
  69. package/switch/Switch.test.js +122 -8
  70. package/switch/types.d.ts +3 -4
  71. package/tabs/Tab.d.ts +4 -0
  72. package/tabs/Tab.js +135 -0
  73. package/tabs/Tabs.js +360 -104
  74. package/tabs/Tabs.stories.tsx +74 -0
  75. package/tabs/Tabs.test.js +217 -6
  76. package/tabs/types.d.ts +15 -5
  77. package/tabs-nav/NavTabs.js +5 -5
  78. package/tabs-nav/Tab.js +3 -5
  79. package/tabs-nav/types.d.ts +1 -1
  80. package/tag/Tag.js +1 -1
  81. package/tag/types.d.ts +1 -1
  82. package/text-input/Icons.d.ts +8 -0
  83. package/text-input/Icons.js +60 -0
  84. package/text-input/Suggestion.js +7 -5
  85. package/text-input/Suggestions.d.ts +4 -0
  86. package/text-input/Suggestions.js +134 -0
  87. package/text-input/TextInput.js +115 -222
  88. package/text-input/TextInput.stories.tsx +189 -182
  89. package/text-input/TextInput.test.js +163 -162
  90. package/text-input/types.d.ts +17 -3
  91. package/toggle-group/types.d.ts +1 -1
  92. package/wizard/types.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ export declare type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
@@ -12,7 +12,7 @@ declare type Padding = {
12
12
  left?: Space;
13
13
  right?: Space;
14
14
  };
15
- declare type SVG = React.SVGProps<SVGSVGElement>;
15
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
16
16
  export declare type AccordionPropsType = {
17
17
  /**
18
18
  * The panel label.
@@ -69,4 +69,10 @@ declare type Props = {
69
69
  */
70
70
  children: React.ReactElement<AccordionPropsType>[] | React.ReactElement<AccordionPropsType>;
71
71
  };
72
+ export declare type AccordionGroupAccordionContextProps = {
73
+ activeIndex: number;
74
+ handlerActiveChange: (index: number) => void;
75
+ disabled: boolean;
76
+ index: number;
77
+ };
72
78
  export default Props;
package/alert/Alert.js CHANGED
@@ -146,7 +146,7 @@ var sizes = {
146
146
  medium: "480px",
147
147
  large: "820px",
148
148
  fillParent: "100%",
149
- fitContent: "auto"
149
+ fitContent: "fit-content"
150
150
  };
151
151
 
152
152
  var calculateWidth = function calculateWidth(margin, size) {
package/box/Box.js CHANGED
@@ -60,7 +60,7 @@ var sizes = {
60
60
  medium: "240px",
61
61
  large: "480px",
62
62
  fillParent: "100%",
63
- fitContent: "unset"
63
+ fitContent: "fit-content"
64
64
  };
65
65
 
66
66
  var calculateWidth = function calculateWidth(margin, size, padding) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
2
+ declare type SVG = React.ReactNode & (React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>);
3
3
  declare type Props = {
4
4
  children: React.ReactNode;
5
5
  type?: "disc" | "circle" | "square" | "number" | "icon";
package/button/Button.js CHANGED
@@ -15,8 +15,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
18
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
19
-
20
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
19
 
22
20
  var _variables = require("../common/variables.js");
@@ -33,6 +31,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
31
 
34
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; }
35
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
+
36
50
  var DxcButton = function DxcButton(_ref) {
37
51
  var _ref$label = _ref.label,
38
52
  label = _ref$label === void 0 ? "" : _ref$label,
@@ -63,21 +77,15 @@ var DxcButton = function DxcButton(_ref) {
63
77
 
64
78
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
65
79
  theme: colorsTheme.button
66
- }, /*#__PURE__*/_react["default"].createElement(DxCButton, {
80
+ }, /*#__PURE__*/_react["default"].createElement(Button, {
67
81
  type: type,
68
- margin: margin,
69
82
  mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
70
83
  disabled: disabled,
71
- iconPosition: iconPosition,
72
- size: size,
73
- backgroundType: backgroundType,
74
- icon: icon
75
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
76
- type: type,
77
- disabled: disabled,
78
- disableRipple: true,
79
84
  "aria-disabled": disabled,
80
85
  tabIndex: disabled ? -1 : tabIndex,
86
+ backgroundType: backgroundType,
87
+ size: size,
88
+ margin: margin,
81
89
  onClick: function onClick() {
82
90
  _onClick();
83
91
  }
@@ -86,44 +94,10 @@ var DxcButton = function DxcButton(_ref) {
86
94
  iconPosition: iconPosition
87
95
  }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
88
96
  src: icon
89
- }) : icon), label && iconPosition === "before" && labelComponent)));
90
- };
91
-
92
- var sizes = {
93
- small: "42px",
94
- medium: "120px",
95
- large: "240px",
96
- fillParent: "100%",
97
- fitContent: "unset"
98
- };
99
-
100
- var calculateWidth = function calculateWidth(margin, size) {
101
- if (size === "fillParent") {
102
- return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
103
- }
104
-
105
- return sizes[size];
97
+ }) : icon), label && iconPosition === "before" && labelComponent));
106
98
  };
107
99
 
108
- var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (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) {
109
- return props.theme.labelFontLineHeight;
110
- }, function (props) {
111
- return props.theme.fontSize;
112
- }, function (props) {
113
- return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
114
- }, function (props) {
115
- return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
116
- });
117
-
118
- var IconContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
119
- return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
120
- }, function (props) {
121
- return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
122
- });
123
-
124
- var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
125
-
126
- var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-block;\n width: ", ";\n cursor: ", ";\n\n .MuiButtonBase-root {\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n\n .MuiButton-label {\n display: flex;\n align-items: center;\n }\n\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n min-width: ", ";\n width: 100%;\n height: 40px;\n transition: none !important;\n\n &:focus {\n border-color: transparent;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n ", "\n }\n"])), function (props) {
100
+ 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) {
127
101
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
128
102
  }, function (props) {
129
103
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -135,8 +109,6 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
135
109
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
136
110
  }, function (props) {
137
111
  return calculateWidth(props.margin, props.size);
138
- }, function (props) {
139
- return props.disabled && "not-allowed" || "pointer";
140
112
  }, function (props) {
141
113
  return props.theme.paddingLeft;
142
114
  }, function (props) {
@@ -153,22 +125,32 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
153
125
  return props.theme.fontWeight;
154
126
  }, function (props) {
155
127
  return props.theme.labelLetterSpacing;
156
- }, function (props) {
157
- return props.size === "small" && "calc(100% - 22px)" || "unset";
158
128
  }, function (props) {
159
129
  return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
160
130
  }, function (props) {
161
131
  var mode = props.mode,
162
- backgroundType = props.backgroundType;
163
-
164
- if (mode === "primary") {
165
- return "\n border-radius: ".concat(props.theme.primaryBorderRadius, ";\n border-width: ").concat(props.theme.primaryBorderThickness, ";\n border-style: ").concat(props.theme.primaryBorderStyle, ";\n font-family: ").concat(props.theme.primaryFontFamily, ";\n font-size: ").concat(props.theme.primaryFontSize, ";\n font-weight: ").concat(props.theme.primaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor, ";\n color: ").concat(backgroundType && backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled { \n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor, " !important; \n }\n ");
166
- } else if (mode === "secondary") {
167
- return "\n border-radius: ".concat(props.theme.secondaryBorderRadius, ";\n border-width: ").concat(props.theme.secondaryBorderThickness, ";\n border-style: ").concat(props.theme.secondaryBorderStyle, ";\n font-family: ").concat(props.theme.secondaryFontFamily, ";\n font-size: ").concat(props.theme.secondaryFontSize, ";\n font-weight: ").concat(props.theme.secondaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor, ";\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor, ";\n }\n ");
168
- } else if (mode === "text") {
169
- return "\n border-radius: ".concat(props.theme.textBorderRadius, ";\n border-width: ").concat(props.theme.textBorderThickness, ";\n border-style: ").concat(props.theme.textBorderStyle, ";\n font-family: ").concat(props.theme.textFontFamily, ";\n font-size: ").concat(props.theme.textFontSize, ";\n font-weight: ").concat(props.theme.textFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.textBackgroundColorOnDark : props.theme.textBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.textFontColorOnDark : props.theme.textFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textHoverBackgroundColorOnDark : props.theme.textHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textActiveBackgroundColorOnDark : props.theme.textActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor:not-allowed;\n color: ").concat(backgroundType === "dark" ? props.theme.textDisabledFontColorOnDark : props.theme.textDisabledFontColor, " !important;\n background-color: ").concat(backgroundType === "dark" ? props.theme.textDisabledBackgroundColorOnDark : props.theme.textDisabledBackgroundColor, ";\n }\n ");
170
- }
132
+ backgroundType = props.backgroundType,
133
+ disabled = props.disabled;
134
+ 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 ");
135
+ });
136
+
137
+ 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) {
138
+ return props.theme.labelFontLineHeight;
139
+ }, function (props) {
140
+ return props.theme.fontSize;
141
+ }, function (props) {
142
+ return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
143
+ }, function (props) {
144
+ return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
171
145
  });
172
146
 
147
+ var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
148
+ return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
149
+ }, function (props) {
150
+ return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
151
+ });
152
+
153
+ var ButtonIcon = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])));
154
+
173
155
  var _default = DxcButton;
174
156
  exports["default"] = _default;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import DxcButton from "./Button";
3
+ import DxcFlex from "./../flex/Flex";
3
4
  import { BackgroundColorProvider } from "../BackgroundColorContext";
4
5
  import Title from "../../.storybook/components/Title";
5
6
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
@@ -270,5 +271,13 @@ export const Chromatic = () => (
270
271
  <Title title="Xxlarge margin" theme="light" level={4} />
271
272
  <DxcButton label="Xxlarge margin" margin="xxlarge" />
272
273
  </ExampleContainer>
274
+ <Title title="Inside a flex" theme="light" level={2} />
275
+ <ExampleContainer>
276
+ <DxcFlex direction="column" gap="0.75rem">
277
+ <DxcButton label="Button" />
278
+ <DxcButton label="Button" />
279
+ <DxcButton label="Button" />
280
+ </DxcFlex>
281
+ </ExampleContainer>
273
282
  </>
274
283
  );
package/button/types.d.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  /// <reference types="react" />
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ export declare type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement>;
9
+ export declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
10
  declare type Props = {
11
11
  /**
12
- * Text to be placed next to the button.
12
+ * Text to be placed in the button.
13
13
  */
14
14
  label?: string;
15
15
  /**
16
- * Uses one of the available button modes.
16
+ * The available button modes.
17
17
  */
18
18
  mode?: "primary" | "secondary" | "text";
19
19
  /**
@@ -25,11 +25,11 @@ declare type Props = {
25
25
  */
26
26
  iconPosition?: "before" | "after";
27
27
  /**
28
- * This prop corresponds to the 'type' prop of the button in html.
28
+ * 'type' html prop of the button.
29
29
  */
30
30
  type?: "button" | "reset" | "submit";
31
31
  /**
32
- * Element or path used as the icon that will be placed next to the button label.
32
+ * Element or path used as the icon that will be placed next to the label.
33
33
  */
34
34
  icon?: string | SVG;
35
35
  /**
@@ -19,8 +19,6 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
21
 
22
- var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
23
-
24
22
  var _variables = require("../common/variables.js");
25
23
 
26
24
  var _utils = require("../common/utils.js");
@@ -33,12 +31,21 @@ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabel
33
31
 
34
32
  var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
35
33
 
36
- var _templateObject, _templateObject2, _templateObject3;
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
37
35
 
38
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
37
 
40
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
39
 
40
+ var checkedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
41
+ fill: "currentColor",
42
+ focusable: "false",
43
+ "aria-hidden": "true",
44
+ viewBox: "0 0 24 24"
45
+ }, /*#__PURE__*/_react["default"].createElement("path", {
46
+ d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
47
+ }));
48
+
42
49
  var DxcCheckbox = function DxcCheckbox(_ref) {
43
50
  var checked = _ref.checked,
44
51
  _ref$defaultChecked = _ref.defaultChecked,
@@ -61,88 +68,78 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
61
68
  _ref$tabIndex = _ref.tabIndex,
62
69
  tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
63
70
 
64
- var _useState = (0, _react.useState)("checkbox-".concat((0, _uuid.v4)())),
71
+ var _useState = (0, _react.useState)("label-checkbox-".concat((0, _uuid.v4)())),
65
72
  _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
66
- switchId = _useState2[0];
67
-
68
- var labelId = "label-".concat(switchId);
73
+ labelId = _useState2[0];
69
74
 
70
75
  var _useState3 = (0, _react.useState)(defaultChecked),
71
76
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
72
77
  innerChecked = _useState4[0],
73
78
  setInnerChecked = _useState4[1];
74
79
 
75
- var _useState5 = (0, _react.useState)(false),
76
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
77
- isLabelHovered = _useState6[0],
78
- setIsLabelHovered = _useState6[1];
79
-
80
+ var checkboxRef = (0, _react.useRef)(null);
80
81
  var colorsTheme = (0, _useTheme["default"])();
81
82
  var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
82
83
  var translatedLabels = (0, _useTranslatedLabels["default"])();
83
84
 
84
- var handlerCheckboxChange = function handlerCheckboxChange(checkboxValue) {
85
- if (checked === undefined) {
86
- var isChecked = checkboxValue.target.checked === undefined ? !innerChecked : checkboxValue.target.checked;
87
- setInnerChecked(isChecked);
88
-
89
- if (typeof onChange === "function") {
90
- onChange(isChecked);
91
- }
92
- } else {
93
- if (typeof onChange === "function") {
94
- onChange(!checked);
95
- }
96
- }
97
- };
85
+ var handleCheckboxChange = function handleCheckboxChange() {
86
+ var _checkboxRef$current;
98
87
 
99
- var handleLabelHover = function handleLabelHover() {
100
- setIsLabelHovered(!isLabelHovered);
88
+ document.activeElement !== (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) && (checkboxRef === null || checkboxRef === void 0 ? void 0 : (_checkboxRef$current = checkboxRef.current) === null || _checkboxRef$current === void 0 ? void 0 : _checkboxRef$current.focus());
89
+ var newChecked = checked !== null && checked !== void 0 ? checked : innerChecked;
90
+ checked !== null && checked !== void 0 ? checked : setInnerChecked(function (innerChecked) {
91
+ return !innerChecked;
92
+ });
93
+ onChange === null || onChange === void 0 ? void 0 : onChange(!newChecked);
101
94
  };
102
95
 
103
- var labelComponent = /*#__PURE__*/_react["default"].createElement(LabelContainer, {
104
- id: labelId,
105
- labelPosition: labelPosition,
106
- onClick: disabled === true ? function () {} : handlerCheckboxChange,
107
- disabled: disabled,
108
- className: "labelContainer",
109
- backgroundType: backgroundType,
110
- onMouseOver: handleLabelHover,
111
- onMouseOut: handleLabelHover
112
- }, labelPosition === "before" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, label, " ", optional && /*#__PURE__*/_react["default"].createElement("span", null, translatedLabels.formFields.optionalLabel)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, optional && /*#__PURE__*/_react["default"].createElement("span", null, "(Optional)"), " ", label));
96
+ var handleKeyboard = function handleKeyboard(event) {
97
+ switch (event.key) {
98
+ case " ":
99
+ case "Space":
100
+ event.preventDefault();
101
+ handleCheckboxChange();
102
+ }
103
+ };
113
104
 
114
105
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
115
106
  theme: colorsTheme.checkbox
116
- }, /*#__PURE__*/_react["default"].createElement(CheckboxContainer, {
117
- id: name,
118
- brightness: _variables.componentTokens,
119
- label: label,
120
- labelPosition: labelPosition,
107
+ }, /*#__PURE__*/_react["default"].createElement(MainContainer, {
121
108
  disabled: disabled,
109
+ onClick: disabled ? undefined : handleCheckboxChange,
122
110
  margin: margin,
123
111
  size: size,
124
- backgroundType: backgroundType,
125
- isLabelHovered: isLabelHovered
126
- }, label && labelPosition === "before" && labelComponent, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
127
112
  checked: checked !== null && checked !== void 0 ? checked : innerChecked,
128
- inputProps: {
129
- name: name,
130
- "aria-labelledby": labelId,
131
- role: "checkbox",
132
- "aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked
133
- },
134
- onChange: handlerCheckboxChange,
135
- value: value,
113
+ backgroundType: backgroundType
114
+ }, label && labelPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
115
+ id: labelId,
136
116
  disabled: disabled,
137
- disableRipple: true,
138
- className: "test",
139
- tabIndex: tabIndex
140
- }), /*#__PURE__*/_react["default"].createElement(CheckboxBlackBack, {
141
- labelPosition: labelPosition,
117
+ backgroundType: backgroundType
118
+ }, label, optional && " ".concat(translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(ValueInput, {
119
+ type: "checkbox",
120
+ checked: checked !== null && checked !== void 0 ? checked : innerChecked,
121
+ name: name,
122
+ "aria-hidden": "true",
123
+ value: value,
142
124
  disabled: disabled,
125
+ readOnly: true
126
+ }), /*#__PURE__*/_react["default"].createElement(CheckboxContainer, null, /*#__PURE__*/_react["default"].createElement(Checkbox, {
127
+ onKeyDown: handleKeyboard,
128
+ role: "checkbox",
129
+ tabIndex: disabled ? -1 : tabIndex,
130
+ "aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked,
131
+ "aria-disabled": disabled,
132
+ "aria-required": !disabled && !optional,
133
+ "aria-labelledby": labelId,
134
+ backgroundType: backgroundType,
143
135
  checked: checked !== null && checked !== void 0 ? checked : innerChecked,
136
+ disabled: disabled,
137
+ ref: checkboxRef
138
+ }, (checked !== null && checked !== void 0 ? checked : innerChecked) && checkedIcon)), label && labelPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
139
+ id: labelId,
140
+ disabled: disabled,
144
141
  backgroundType: backgroundType
145
- }), label && labelPosition === "after" && labelComponent));
142
+ }, optional && "".concat(translatedLabels.formFields.optionalLabel, " "), label)));
146
143
  };
147
144
 
148
145
  var sizes = {
@@ -150,7 +147,7 @@ var sizes = {
150
147
  medium: "240px",
151
148
  large: "480px",
152
149
  fillParent: "100%",
153
- fitContent: "unset"
150
+ fitContent: "fit-content"
154
151
  };
155
152
 
156
153
  var calculateWidth = function calculateWidth(margin, size) {
@@ -185,15 +182,21 @@ var getNotDisabledColor = function getNotDisabledColor(props, element) {
185
182
  case "background":
186
183
  return props.backgroundType && props.backgroundType === "dark" ? props.theme.backgroundColorCheckedOnDark : props.theme.backgroundColorChecked;
187
184
 
185
+ case "hoverBackground":
186
+ return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
187
+
188
188
  case "border":
189
189
  return props.backgroundType && props.backgroundType === "dark" ? props.theme.borderColorOnDark : props.theme.borderColor;
190
190
 
191
+ case "hoverBorder":
192
+ return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
193
+
191
194
  case "label":
192
195
  return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
193
196
  }
194
197
  };
195
198
 
196
- var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n cursor: ", ";\n"])), function (props) {
199
+ var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
197
200
  return props.disabled ? getDisabledColor(props, "label") : getNotDisabledColor(props, "label");
198
201
  }, function (props) {
199
202
  return props.theme.fontFamily;
@@ -201,11 +204,27 @@ var LabelContainer = _styledComponents["default"].span(_templateObject || (_temp
201
204
  return props.theme.fontSize;
202
205
  }, function (props) {
203
206
  return props.theme.fontWeight;
207
+ });
208
+
209
+ var ValueInput = _styledComponents["default"].input(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
210
+
211
+ var CheckboxContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
212
+
213
+ var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: solid 2px\n ", ";\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 2px;\n }\n svg {\n position: absolute;\n width: 22px;\n height: 22px;\n }\n ", "\n"])), function (props) {
214
+ return props.disabled ? getDisabledColor(props, "border") : getNotDisabledColor(props, "border");
204
215
  }, function (props) {
205
- return props.disabled ? "not-allowed" : "pointer";
216
+ return props.checked ? props.disabled ? getDisabledColor(props, "check") : getNotDisabledColor(props, "check") : "transparent";
217
+ }, function (props) {
218
+ return props.disabled ? getDisabledColor(props, "background") : getNotDisabledColor(props, "background");
219
+ }, function (props) {
220
+ return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
221
+ }, function (props) {
222
+ return props.disabled && "pointer-events: none;";
206
223
  });
207
224
 
208
- var CheckboxContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n position: relative;\n .MuiCheckbox-colorSecondary {\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n color: ", ";\n }\n }\n &.Mui-disabled {\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n color: ", ";\n opacity: 0.34;\n }\n }\n }\n &.Mui-checked {\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n color: ", ";\n }\n }\n\n &:hover {\n background-color: transparent;\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n background-color: transparent;\n color: ", ";\n }\n }\n }\n }\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n width: 24px;\n height: 24px;\n }\n }\n }\n\n .MuiIconButton-colorSecondary {\n &:hover {\n background-color: transparent;\n }\n }\n .MuiButtonBase-root {\n &:hover {\n .MuiIconButton-label {\n & > .MuiSvgIcon-root {\n color: ", ";\n }\n }\n }\n\n &.Mui-focusVisible {\n .MuiIconButton-label {\n border-radius: 2px;\n outline: 2px solid\n ", ";\n outline-offset: -1px;\n }\n }\n z-index: 1;\n margin-left: ", ";\n margin-right: ", ";\n padding: 0px;\n left: ", ";\n right: ", ";\n }\n"])), function (props) {
225
+ var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n gap: ", ";\n\n &:hover ", " {\n border: 2px solid\n ", ";\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
226
+ return calculateWidth(props.margin, props.size);
227
+ }, function (props) {
209
228
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
210
229
  }, function (props) {
211
230
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -215,42 +234,16 @@ var CheckboxContainer = _styledComponents["default"].span(_templateObject2 || (_
215
234
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
216
235
  }, function (props) {
217
236
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
218
- }, function (props) {
219
- return calculateWidth(props.margin, props.size);
220
237
  }, function (props) {
221
238
  return props.disabled ? "not-allowed" : "pointer";
222
239
  }, function (props) {
223
- return props.isLabelHovered ? props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor : getNotDisabledColor(props, "border");
224
- }, function (props) {
225
- return getDisabledColor(props, "border");
226
- }, function (props) {
227
- return props.disabled ? getDisabledColor(props, "background") : getNotDisabledColor(props, "background");
228
- }, function (props) {
229
- return props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
230
- }, function (props) {
231
- return props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
232
- }, function (props) {
233
- return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
234
- }, function (props) {
235
- return props.labelPosition === "before" && props.label ? props.theme.checkLabelSpacing : "0";
236
- }, function (props) {
237
- return props.labelPosition === "after" && props.label ? props.theme.checkLabelSpacing : "0";
238
- }, function (props) {
239
- return props.labelPosition === "before" ? "unset" : "1px";
240
- }, function (props) {
241
- return props.labelPosition === "before" ? "1px" : "unset";
242
- });
243
-
244
- var CheckboxBlackBack = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: 16px;\n height: 16px;\n position: absolute;\n left: ", ";\n right: ", ";\n z-index: 0;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
245
- return !props.checked ? "transparent" : props.disabled ? getDisabledColor(props, "check") : getNotDisabledColor(props, "check");
246
- }, function (props) {
247
- return props.labelPosition === "before" ? "unset" : "5px";
248
- }, function (props) {
249
- return props.labelPosition === "before" ? "5px" : "unset";
240
+ return props.theme.checkLabelSpacing;
241
+ }, Checkbox, function (props) {
242
+ return props.disabled ? getDisabledColor(props, "border") : getNotDisabledColor(props, "hoverBorder");
250
243
  }, function (props) {
251
- return props.labelPosition === "after" ? "0px" : "";
244
+ return props.checked ? props.disabled ? getDisabledColor(props, "check") : getNotDisabledColor(props, "check") : "transparent";
252
245
  }, function (props) {
253
- return props.labelPosition === "before" ? "0px" : "";
246
+ return props.disabled ? getDisabledColor(props, "background") : getNotDisabledColor(props, "hoverBackground");
254
247
  });
255
248
 
256
249
  var _default = DxcCheckbox;