@dxc-technology/halstack-react 0.0.0-bfeb2b0 → 0.0.0-c058988
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.
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.js +5 -27
- package/accordion/Accordion.stories.tsx +3 -3
- package/alert/Alert.js +4 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/box/Box.js +22 -32
- package/button/Button.js +14 -11
- package/card/Card.js +27 -28
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +38 -28
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/types.d.ts +3 -3
- package/common/variables.js +178 -84
- package/date-input/DateInput.js +16 -13
- package/dialog/Dialog.js +4 -32
- package/dropdown/Dropdown.js +13 -17
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +15 -88
- package/header/Header.js +27 -48
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +18 -2
- package/layout/ApplicationLayout.js +5 -18
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +3 -3
- package/main.js +19 -13
- package/number-input/NumberInput.test.js +2 -4
- package/number-input/types.d.ts +13 -10
- package/package.json +5 -5
- package/paginator/Paginator.js +17 -38
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +3 -6
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/quick-nav/QuickNav.js +65 -19
- package/quick-nav/QuickNav.stories.tsx +2 -2
- package/quick-nav/types.d.ts +4 -4
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +8 -6
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.js +1 -1
- package/select/Select.js +63 -150
- package/select/Select.stories.tsx +14 -2
- package/select/Select.test.js +257 -194
- package/select/types.d.ts +21 -2
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +19 -16
- package/switch/Switch.stories.tsx +8 -8
- package/switch/types.d.ts +2 -2
- package/tabs/Tabs.stories.tsx +0 -6
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{radio → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +5 -8
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +48 -76
- package/text-input/TextInput.test.js +22 -35
- package/text-input/types.d.ts +27 -12
- package/textarea/Textarea.js +10 -19
- package/textarea/types.d.ts +10 -7
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.js +35 -29
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
package/box/Box.js
CHANGED
|
@@ -71,9 +71,8 @@ var calculateWidth = function calculateWidth(margin, size, padding) {
|
|
|
71
71
|
return sizes[size];
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n letter-spacing: ", ";\n overflow: hidden;\n width: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (
|
|
75
|
-
|
|
76
|
-
return display;
|
|
74
|
+
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n letter-spacing: ", ";\n overflow: hidden;\n width: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
75
|
+
return props.display;
|
|
77
76
|
}, function (props) {
|
|
78
77
|
return props.theme.borderRadius;
|
|
79
78
|
}, function (props) {
|
|
@@ -90,36 +89,27 @@ var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
90
89
|
return props.theme.backgroundColor;
|
|
91
90
|
}, function (props) {
|
|
92
91
|
return props.shadowDepth === 1 ? "".concat(props.theme.oneShadowDepthShadowOffsetX, " ").concat(props.theme.oneShadowDepthShadowOffsetY, " ").concat(props.theme.oneShadowDepthShadowBlur, " ").concat(props.theme.oneShadowDepthShadowSpread, " ").concat(props.theme.oneShadowDepthShadowColor) : props.shadowDepth === 2 ? "".concat(props.theme.twoShadowDepthShadowOffsetX, " ").concat(props.theme.twoShadowDepthShadowOffsetY, " ").concat(props.theme.twoShadowDepthShadowBlur, " ").concat(props.theme.twoShadowDepthShadowSpread, " ").concat(props.theme.twoShadowDepthShadowColor) : "".concat(props.theme.noneShadowDepthShadowOffsetX, " ").concat(props.theme.noneShadowDepthShadowOffsetY, " ").concat(props.theme.noneShadowDepthShadowBlur, " ").concat(props.theme.noneShadowDepthShadowSpread, " ").concat(props.theme.noneShadowDepthShadowColor);
|
|
93
|
-
}, function (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return margin && margin.
|
|
99
|
-
}, function (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, function (_ref7) {
|
|
106
|
-
var margin = _ref7.margin;
|
|
107
|
-
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
108
|
-
}, function (_ref8) {
|
|
109
|
-
var padding = _ref8.padding;
|
|
92
|
+
}, function (props) {
|
|
93
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
94
|
+
}, function (props) {
|
|
95
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
96
|
+
}, function (props) {
|
|
97
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
98
|
+
}, function (props) {
|
|
99
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
100
|
+
}, function (props) {
|
|
101
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
102
|
+
}, function (_ref2) {
|
|
103
|
+
var padding = _ref2.padding;
|
|
110
104
|
return padding && (0, _typeof2["default"])(padding) !== "object" ? _variables.spaces[padding] : "0px";
|
|
111
|
-
}, function (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return padding && padding.
|
|
117
|
-
}, function (
|
|
118
|
-
|
|
119
|
-
return padding && padding.bottom ? _variables.spaces[padding.bottom] : "";
|
|
120
|
-
}, function (_ref12) {
|
|
121
|
-
var padding = _ref12.padding;
|
|
122
|
-
return padding && padding.left ? _variables.spaces[padding.left] : "";
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
111
|
+
}, function (props) {
|
|
112
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
123
113
|
});
|
|
124
114
|
|
|
125
115
|
var _default = DxcBox;
|
package/button/Button.js
CHANGED
|
@@ -45,14 +45,22 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
45
45
|
_ref$type = _ref.type,
|
|
46
46
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
47
47
|
icon = _ref.icon,
|
|
48
|
-
|
|
48
|
+
_ref$onClick = _ref.onClick,
|
|
49
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
49
50
|
margin = _ref.margin,
|
|
50
51
|
_ref$size = _ref.size,
|
|
51
52
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
52
53
|
_ref$tabIndex = _ref.tabIndex,
|
|
53
54
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
55
|
+
|
|
54
56
|
var colorsTheme = (0, _useTheme["default"])();
|
|
55
57
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
58
|
+
|
|
59
|
+
var labelComponent = /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
60
|
+
icon: icon,
|
|
61
|
+
iconPosition: iconPosition
|
|
62
|
+
}, label);
|
|
63
|
+
|
|
56
64
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
57
65
|
theme: colorsTheme.button
|
|
58
66
|
}, /*#__PURE__*/_react["default"].createElement(DxCButton, {
|
|
@@ -73,15 +81,12 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
73
81
|
onClick: function onClick() {
|
|
74
82
|
_onClick();
|
|
75
83
|
}
|
|
76
|
-
}, label && /*#__PURE__*/_react["default"].createElement(
|
|
77
|
-
icon: icon,
|
|
78
|
-
iconPosition: iconPosition
|
|
79
|
-
}, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
84
|
+
}, label && iconPosition === "after" && labelComponent, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
80
85
|
label: label,
|
|
81
86
|
iconPosition: iconPosition
|
|
82
87
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
|
|
83
88
|
src: icon
|
|
84
|
-
}) : icon))));
|
|
89
|
+
}) : icon), label && iconPosition === "before" && labelComponent)));
|
|
85
90
|
};
|
|
86
91
|
|
|
87
92
|
var sizes = {
|
|
@@ -118,7 +123,7 @@ var IconContainer = _styledComponents["default"].div(_templateObject2 || (_templ
|
|
|
118
123
|
|
|
119
124
|
var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
120
125
|
|
|
121
|
-
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
|
|
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) {
|
|
122
127
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
123
128
|
}, function (props) {
|
|
124
129
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -140,8 +145,6 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
|
|
|
140
145
|
return props.theme.paddingTop;
|
|
141
146
|
}, function (props) {
|
|
142
147
|
return props.theme.paddingBottom;
|
|
143
|
-
}, function (props) {
|
|
144
|
-
return props.iconPosition === "after" && "row" || "row-reverse";
|
|
145
148
|
}, function (props) {
|
|
146
149
|
return props.theme.fontFamily;
|
|
147
150
|
}, function (props) {
|
|
@@ -159,9 +162,9 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
|
|
|
159
162
|
backgroundType = props.backgroundType;
|
|
160
163
|
|
|
161
164
|
if (mode === "primary") {
|
|
162
|
-
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
|
|
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 ");
|
|
163
166
|
} else if (mode === "secondary") {
|
|
164
|
-
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
|
|
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 ");
|
|
165
168
|
} else if (mode === "text") {
|
|
166
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 ");
|
|
167
170
|
}
|
package/card/Card.js
CHANGED
|
@@ -56,6 +56,14 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
56
56
|
isHovered = _useState2[0],
|
|
57
57
|
changeIsHovered = _useState2[1];
|
|
58
58
|
|
|
59
|
+
var imageComponent = /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
60
|
+
imageBgColor: imageBgColor
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement(TagImage, {
|
|
62
|
+
imagePadding: imagePadding,
|
|
63
|
+
cover: imageCover,
|
|
64
|
+
src: imageSrc
|
|
65
|
+
}));
|
|
66
|
+
|
|
59
67
|
var tagContent = /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
60
68
|
shadowDepth: !outlined ? 0 : isHovered && (onClick || linkHref) ? 2 : 1
|
|
61
69
|
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
@@ -63,15 +71,9 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
63
71
|
}, /*#__PURE__*/_react["default"].createElement(CardContainer, {
|
|
64
72
|
hasAction: onClick || linkHref,
|
|
65
73
|
imagePosition: imagePosition
|
|
66
|
-
}, imageSrc && /*#__PURE__*/_react["default"].createElement(
|
|
67
|
-
imageBgColor: imageBgColor
|
|
68
|
-
}, /*#__PURE__*/_react["default"].createElement(TagImage, {
|
|
69
|
-
imagePadding: imagePadding,
|
|
70
|
-
cover: imageCover,
|
|
71
|
-
src: imageSrc
|
|
72
|
-
})), /*#__PURE__*/_react["default"].createElement(CardContent, {
|
|
74
|
+
}, imageSrc && imagePosition === "before" && imageComponent, /*#__PURE__*/_react["default"].createElement(CardContent, {
|
|
73
75
|
contentPadding: contentPadding
|
|
74
|
-
}, children))));
|
|
76
|
+
}, children), imageSrc && imagePosition === "after" && imageComponent)));
|
|
75
77
|
|
|
76
78
|
return /*#__PURE__*/_react["default"].createElement(StyledDxcCard, {
|
|
77
79
|
margin: margin,
|
|
@@ -113,50 +115,47 @@ var StyledDxcCard = _styledComponents["default"].div(_templateObject || (_templa
|
|
|
113
115
|
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
114
116
|
});
|
|
115
117
|
|
|
116
|
-
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n
|
|
117
|
-
var imagePosition = _ref9.imagePosition;
|
|
118
|
-
return imagePosition === "before" && "row" || "row-reverse";
|
|
119
|
-
}, function (props) {
|
|
118
|
+
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n height: ", ";\n width: ", ";\n &:hover {\n border-color: ", ";\n }\n"])), function (props) {
|
|
120
119
|
return props.theme.height;
|
|
121
120
|
}, function (props) {
|
|
122
121
|
return props.theme.width;
|
|
123
|
-
}, function (
|
|
124
|
-
var hasAction =
|
|
122
|
+
}, function (_ref9) {
|
|
123
|
+
var hasAction = _ref9.hasAction;
|
|
125
124
|
return hasAction ? "" : "unset";
|
|
126
125
|
});
|
|
127
126
|
|
|
128
127
|
var StyledLink = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n text-decoration: none;\n\n :focus {\n outline-color: #0095ff;\n }\n"])));
|
|
129
128
|
|
|
130
|
-
var TagImage = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"])), function (
|
|
129
|
+
var TagImage = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"])), function (_ref10) {
|
|
130
|
+
var imagePadding = _ref10.imagePadding;
|
|
131
|
+
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
132
|
+
}, function (_ref11) {
|
|
131
133
|
var imagePadding = _ref11.imagePadding;
|
|
132
134
|
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
133
135
|
}, function (_ref12) {
|
|
134
|
-
var
|
|
135
|
-
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
136
|
-
}, function (_ref13) {
|
|
137
|
-
var cover = _ref13.cover;
|
|
136
|
+
var cover = _ref12.cover;
|
|
138
137
|
return cover ? "cover" : "contain";
|
|
139
138
|
});
|
|
140
139
|
|
|
141
|
-
var ImageContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: 35%;\n height: 100%;\n flex-shrink: 0;\n background: ", ";\n justify-content: center;\n align-items: center;\n display: inline-flex;\n"])), function (
|
|
142
|
-
var imageBgColor =
|
|
140
|
+
var ImageContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: 35%;\n height: 100%;\n flex-shrink: 0;\n background: ", ";\n justify-content: center;\n align-items: center;\n display: inline-flex;\n"])), function (_ref13) {
|
|
141
|
+
var imageBgColor = _ref13.imageBgColor;
|
|
143
142
|
return imageBgColor;
|
|
144
143
|
});
|
|
145
144
|
|
|
146
|
-
var CardContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"])), function (
|
|
147
|
-
var contentPadding =
|
|
145
|
+
var CardContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"])), function (_ref14) {
|
|
146
|
+
var contentPadding = _ref14.contentPadding;
|
|
148
147
|
return contentPadding && (0, _typeof2["default"])(contentPadding) !== "object" ? _variables.spaces[contentPadding] : "0px";
|
|
148
|
+
}, function (_ref15) {
|
|
149
|
+
var contentPadding = _ref15.contentPadding;
|
|
150
|
+
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.top ? _variables.spaces[contentPadding.top] : "";
|
|
149
151
|
}, function (_ref16) {
|
|
150
152
|
var contentPadding = _ref16.contentPadding;
|
|
151
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.
|
|
153
|
+
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.right ? _variables.spaces[contentPadding.right] : "";
|
|
152
154
|
}, function (_ref17) {
|
|
153
155
|
var contentPadding = _ref17.contentPadding;
|
|
154
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.
|
|
156
|
+
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.bottom ? _variables.spaces[contentPadding.bottom] : "";
|
|
155
157
|
}, function (_ref18) {
|
|
156
158
|
var contentPadding = _ref18.contentPadding;
|
|
157
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.bottom ? _variables.spaces[contentPadding.bottom] : "";
|
|
158
|
-
}, function (_ref19) {
|
|
159
|
-
var contentPadding = _ref19.contentPadding;
|
|
160
159
|
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.left ? _variables.spaces[contentPadding.left] : "";
|
|
161
160
|
});
|
|
162
161
|
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import CheckboxPropsType from "./types";
|
|
3
|
-
declare const DxcCheckbox: ({ checked, defaultChecked, value, label, labelPosition, name, disabled,
|
|
3
|
+
declare const DxcCheckbox: ({ checked, defaultChecked, value, label, labelPosition, name, disabled, optional, onChange, margin, size, tabIndex, }: CheckboxPropsType) => JSX.Element;
|
|
4
4
|
export default DxcCheckbox;
|
package/checkbox/Checkbox.js
CHANGED
|
@@ -21,14 +21,16 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
23
23
|
|
|
24
|
-
var _RequiredComponent = _interopRequireDefault(require("../common/RequiredComponent"));
|
|
25
|
-
|
|
26
24
|
var _variables = require("../common/variables.js");
|
|
27
25
|
|
|
28
26
|
var _utils = require("../common/utils.js");
|
|
29
27
|
|
|
28
|
+
var _uuid = require("uuid");
|
|
29
|
+
|
|
30
30
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
33
|
+
|
|
32
34
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
35
|
|
|
34
36
|
var _templateObject, _templateObject2, _templateObject3;
|
|
@@ -50,27 +52,34 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
50
52
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
51
53
|
_ref$disabled = _ref.disabled,
|
|
52
54
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
55
|
+
_ref$optional = _ref.optional,
|
|
56
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
53
57
|
onChange = _ref.onChange,
|
|
54
|
-
_ref$required = _ref.required,
|
|
55
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
56
58
|
margin = _ref.margin,
|
|
57
59
|
_ref$size = _ref.size,
|
|
58
60
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
59
61
|
_ref$tabIndex = _ref.tabIndex,
|
|
60
62
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
61
63
|
|
|
62
|
-
var _useState = (0, _react.useState)(
|
|
63
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState,
|
|
64
|
-
|
|
65
|
-
setInnerChecked = _useState2[1];
|
|
64
|
+
var _useState = (0, _react.useState)("checkbox-".concat((0, _uuid.v4)())),
|
|
65
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
66
|
+
switchId = _useState2[0];
|
|
66
67
|
|
|
67
|
-
var
|
|
68
|
+
var labelId = "label-".concat(switchId);
|
|
69
|
+
|
|
70
|
+
var _useState3 = (0, _react.useState)(defaultChecked),
|
|
68
71
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
innerChecked = _useState4[0],
|
|
73
|
+
setInnerChecked = _useState4[1];
|
|
74
|
+
|
|
75
|
+
var _useState5 = (0, _react.useState)(false),
|
|
76
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
77
|
+
isLabelHovered = _useState6[0],
|
|
78
|
+
setIsLabelHovered = _useState6[1];
|
|
71
79
|
|
|
72
80
|
var colorsTheme = (0, _useTheme["default"])();
|
|
73
81
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
82
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
74
83
|
|
|
75
84
|
var handlerCheckboxChange = function handlerCheckboxChange(checkboxValue) {
|
|
76
85
|
if (checked === undefined) {
|
|
@@ -91,6 +100,17 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
91
100
|
setIsLabelHovered(!isLabelHovered);
|
|
92
101
|
};
|
|
93
102
|
|
|
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));
|
|
113
|
+
|
|
94
114
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
95
115
|
theme: colorsTheme.checkbox
|
|
96
116
|
}, /*#__PURE__*/_react["default"].createElement(CheckboxContainer, {
|
|
@@ -103,11 +123,11 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
103
123
|
size: size,
|
|
104
124
|
backgroundType: backgroundType,
|
|
105
125
|
isLabelHovered: isLabelHovered
|
|
106
|
-
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
126
|
+
}, label && labelPosition === "before" && labelComponent, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
107
127
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
108
128
|
inputProps: {
|
|
109
129
|
name: name,
|
|
110
|
-
"aria-
|
|
130
|
+
"aria-labelledby": labelId,
|
|
111
131
|
role: "checkbox",
|
|
112
132
|
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked
|
|
113
133
|
},
|
|
@@ -122,15 +142,7 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
122
142
|
disabled: disabled,
|
|
123
143
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
124
144
|
backgroundType: backgroundType
|
|
125
|
-
}),
|
|
126
|
-
labelPosition: labelPosition,
|
|
127
|
-
onClick: disabled === true ? function (e) {} : handlerCheckboxChange,
|
|
128
|
-
disabled: disabled,
|
|
129
|
-
className: "labelContainer",
|
|
130
|
-
backgroundType: backgroundType,
|
|
131
|
-
onMouseOver: handleLabelHover,
|
|
132
|
-
onMouseOut: handleLabelHover
|
|
133
|
-
}, label)));
|
|
145
|
+
}), label && labelPosition === "after" && labelComponent));
|
|
134
146
|
};
|
|
135
147
|
|
|
136
148
|
var sizes = {
|
|
@@ -181,19 +193,19 @@ var getNotDisabledColor = function getNotDisabledColor(props, element) {
|
|
|
181
193
|
}
|
|
182
194
|
};
|
|
183
195
|
|
|
184
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n
|
|
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) {
|
|
185
197
|
return props.disabled ? getDisabledColor(props, "label") : getNotDisabledColor(props, "label");
|
|
186
|
-
}, function (props) {
|
|
187
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
188
198
|
}, function (props) {
|
|
189
199
|
return props.theme.fontFamily;
|
|
190
200
|
}, function (props) {
|
|
191
201
|
return props.theme.fontSize;
|
|
192
202
|
}, function (props) {
|
|
193
203
|
return props.theme.fontWeight;
|
|
204
|
+
}, function (props) {
|
|
205
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
194
206
|
});
|
|
195
207
|
|
|
196
|
-
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
|
|
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) {
|
|
197
209
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
198
210
|
}, function (props) {
|
|
199
211
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -207,8 +219,6 @@ var CheckboxContainer = _styledComponents["default"].span(_templateObject2 || (_
|
|
|
207
219
|
return calculateWidth(props.margin, props.size);
|
|
208
220
|
}, function (props) {
|
|
209
221
|
return props.disabled ? "not-allowed" : "pointer";
|
|
210
|
-
}, function (props) {
|
|
211
|
-
return props.labelPosition === "before" ? "row-reverse" : "row";
|
|
212
222
|
}, function (props) {
|
|
213
223
|
return props.isLabelHovered ? props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor : getNotDisabledColor(props, "border");
|
|
214
224
|
}, function (props) {
|