@dxc-technology/halstack-react 0.0.0-fb2efcc → 0.0.0-fb5dc94
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/README.md +46 -0
- package/dist/index.d.mts +6589 -0
- package/dist/index.d.ts +6589 -0
- package/dist/index.js +13742 -0
- package/dist/index.mjs +13684 -0
- package/package.json +69 -68
- package/BackgroundColorContext.js +0 -50
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/Accordion.js +0 -289
- package/accordion/index.d.ts +0 -28
- package/accordion-group/AccordionGroup.js +0 -184
- package/accordion-group/index.d.ts +0 -16
- package/alert/Alert.js +0 -309
- package/alert/index.d.ts +0 -51
- package/badge/Badge.js +0 -59
- package/box/Box.js +0 -152
- package/box/index.d.ts +0 -25
- package/button/Button.d.ts +0 -4
- package/button/Button.js +0 -182
- package/button/Button.stories.tsx +0 -306
- package/button/types.d.ts +0 -57
- package/button/types.js +0 -5
- package/card/Card.js +0 -200
- package/card/index.d.ts +0 -22
- package/checkbox/Checkbox.js +0 -275
- package/checkbox/index.d.ts +0 -24
- package/chip/Chip.js +0 -221
- package/chip/index.d.ts +0 -22
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/common/utils.js +0 -22
- package/common/variables.js +0 -1569
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/date-input/DateInput.js +0 -396
- package/date-input/index.d.ts +0 -95
- package/dialog/Dialog.js +0 -184
- package/dialog/index.d.ts +0 -18
- package/dropdown/Dropdown.js +0 -450
- package/dropdown/index.d.ts +0 -26
- package/file-input/FileInput.js +0 -532
- package/file-input/FileItem.js +0 -193
- package/file-input/index.d.ts +0 -81
- package/footer/Footer.js +0 -297
- package/footer/Icons.js +0 -77
- package/footer/index.d.ts +0 -25
- package/header/Header.js +0 -326
- package/header/Icons.js +0 -59
- package/header/index.d.ts +0 -25
- package/heading/Heading.js +0 -176
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/layout/ApplicationLayout.js +0 -235
- package/layout/Icons.js +0 -55
- package/link/Link.js +0 -183
- package/link/index.d.ts +0 -23
- package/main.d.ts +0 -44
- package/main.js +0 -363
- package/number-input/NumberInput.js +0 -128
- package/number-input/NumberInputContext.js +0 -16
- package/number-input/index.d.ts +0 -113
- package/paginator/Icons.js +0 -66
- package/paginator/Paginator.js +0 -221
- package/paginator/index.d.ts +0 -20
- package/password-input/PasswordInput.js +0 -199
- package/password-input/index.d.ts +0 -94
- package/progress-bar/ProgressBar.js +0 -188
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -195
- package/radio/index.d.ts +0 -23
- package/resultsetTable/ResultsetTable.js +0 -274
- package/resultsetTable/index.d.ts +0 -19
- package/select/Select.js +0 -865
- package/select/index.d.ts +0 -131
- package/sidenav/Sidenav.js +0 -145
- package/sidenav/index.d.ts +0 -13
- package/slider/Slider.js +0 -340
- package/slider/index.d.ts +0 -29
- package/spinner/Spinner.js +0 -267
- package/spinner/index.d.ts +0 -17
- package/switch/Switch.js +0 -208
- package/switch/index.d.ts +0 -24
- package/table/Table.js +0 -118
- package/table/index.d.ts +0 -13
- package/tabs/Tabs.js +0 -259
- package/tabs/index.d.ts +0 -19
- package/tag/Tag.js +0 -208
- package/tag/index.d.ts +0 -24
- package/text-input/TextInput.js +0 -825
- package/text-input/index.d.ts +0 -135
- package/textarea/Textarea.js +0 -317
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/ToggleGroup.js +0 -243
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/useTheme.js +0 -22
- package/wizard/Icons.js +0 -65
- package/wizard/Wizard.js +0 -271
- package/wizard/index.d.ts +0 -18
package/box/Box.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireDefault(require("react"));
|
|
19
|
-
|
|
20
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
|
-
var _variables = require("../common/variables.js");
|
|
25
|
-
|
|
26
|
-
var _utils = require("../common/utils.js");
|
|
27
|
-
|
|
28
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
29
|
-
|
|
30
|
-
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
31
|
-
|
|
32
|
-
var _templateObject;
|
|
33
|
-
|
|
34
|
-
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); }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
var DxcBox = function DxcBox(_ref) {
|
|
39
|
-
var shadowDepth = _ref.shadowDepth,
|
|
40
|
-
margin = _ref.margin,
|
|
41
|
-
padding = _ref.padding,
|
|
42
|
-
_ref$display = _ref.display,
|
|
43
|
-
display = _ref$display === void 0 ? "inline-flex" : _ref$display,
|
|
44
|
-
children = _ref.children,
|
|
45
|
-
_ref$size = _ref.size,
|
|
46
|
-
size = _ref$size === void 0 ? "fitContent" : _ref$size;
|
|
47
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
48
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
49
|
-
theme: colorsTheme.box
|
|
50
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledDxcBox, {
|
|
51
|
-
shadowDepth: shadowDepth,
|
|
52
|
-
display: display,
|
|
53
|
-
margin: margin,
|
|
54
|
-
padding: padding,
|
|
55
|
-
size: size
|
|
56
|
-
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
57
|
-
color: colorsTheme.box.backgroundColor
|
|
58
|
-
}, children)));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var sizes = {
|
|
62
|
-
small: "48px",
|
|
63
|
-
medium: "240px",
|
|
64
|
-
large: "480px",
|
|
65
|
-
fillParent: "100%",
|
|
66
|
-
fitContent: "unset"
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var calculateWidth = function calculateWidth(margin, size, padding) {
|
|
70
|
-
if (size === "fillParent") {
|
|
71
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), " -\n ").concat((0, _utils.getMargin)(padding, "left"), " - ").concat((0, _utils.getMargin)(padding, "right"), ")");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return sizes[size];
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
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 (_ref2) {
|
|
78
|
-
var display = _ref2.display;
|
|
79
|
-
return display;
|
|
80
|
-
}, function (props) {
|
|
81
|
-
return props.theme.borderRadius;
|
|
82
|
-
}, function (props) {
|
|
83
|
-
return props.theme.borderThickness;
|
|
84
|
-
}, function (props) {
|
|
85
|
-
return props.theme.borderStyle;
|
|
86
|
-
}, function (props) {
|
|
87
|
-
return props.theme.borderColor;
|
|
88
|
-
}, function (props) {
|
|
89
|
-
return props.theme.letterSpacing;
|
|
90
|
-
}, function (props) {
|
|
91
|
-
return calculateWidth(props.margin, props.size, props.padding);
|
|
92
|
-
}, function (props) {
|
|
93
|
-
return props.theme.backgroundColor;
|
|
94
|
-
}, function (props) {
|
|
95
|
-
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);
|
|
96
|
-
}, function (_ref3) {
|
|
97
|
-
var margin = _ref3.margin;
|
|
98
|
-
return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
|
|
99
|
-
}, function (_ref4) {
|
|
100
|
-
var margin = _ref4.margin;
|
|
101
|
-
return margin && margin.top ? _variables.spaces[margin.top] : "";
|
|
102
|
-
}, function (_ref5) {
|
|
103
|
-
var margin = _ref5.margin;
|
|
104
|
-
return margin && margin.right ? _variables.spaces[margin.right] : "";
|
|
105
|
-
}, function (_ref6) {
|
|
106
|
-
var margin = _ref6.margin;
|
|
107
|
-
return margin && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
108
|
-
}, function (_ref7) {
|
|
109
|
-
var margin = _ref7.margin;
|
|
110
|
-
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
111
|
-
}, function (_ref8) {
|
|
112
|
-
var padding = _ref8.padding;
|
|
113
|
-
return padding && (0, _typeof2["default"])(padding) !== "object" ? _variables.spaces[padding] : "0px";
|
|
114
|
-
}, function (_ref9) {
|
|
115
|
-
var padding = _ref9.padding;
|
|
116
|
-
return padding && padding.top ? _variables.spaces[padding.top] : "";
|
|
117
|
-
}, function (_ref10) {
|
|
118
|
-
var padding = _ref10.padding;
|
|
119
|
-
return padding && padding.right ? _variables.spaces[padding.right] : "";
|
|
120
|
-
}, function (_ref11) {
|
|
121
|
-
var padding = _ref11.padding;
|
|
122
|
-
return padding && padding.bottom ? _variables.spaces[padding.bottom] : "";
|
|
123
|
-
}, function (_ref12) {
|
|
124
|
-
var padding = _ref12.padding;
|
|
125
|
-
return padding && padding.left ? _variables.spaces[padding.left] : "";
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
DxcBox.propTypes = {
|
|
129
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
130
|
-
display: _propTypes["default"].string,
|
|
131
|
-
shadowDepth: _propTypes["default"].oneOf([0, 1, 2]),
|
|
132
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
133
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
134
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
135
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
136
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
137
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
138
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
139
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
140
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
141
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
142
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
143
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
144
|
-
};
|
|
145
|
-
DxcBox.defaultProps = {
|
|
146
|
-
shadowDepth: 2,
|
|
147
|
-
display: "inline-flex",
|
|
148
|
-
margin: null,
|
|
149
|
-
padding: null
|
|
150
|
-
};
|
|
151
|
-
var _default = DxcBox;
|
|
152
|
-
exports["default"] = _default;
|
package/box/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
2
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
type Margin = {
|
|
4
|
-
top?: Space;
|
|
5
|
-
bottom?: Space;
|
|
6
|
-
left?: Space;
|
|
7
|
-
right?: Space;
|
|
8
|
-
};
|
|
9
|
-
type Padding = {
|
|
10
|
-
top?: Space;
|
|
11
|
-
bottom?: Space;
|
|
12
|
-
left?: Space;
|
|
13
|
-
right?: Space;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type Props = {
|
|
18
|
-
shadowDepth?: 0 | 1 | 2;
|
|
19
|
-
margin?: Space | Margin;
|
|
20
|
-
padging?: Space | Padding;
|
|
21
|
-
display: string;
|
|
22
|
-
size: Size;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default function DxcBox(props: Props): JSX.Element;
|
package/button/Button.d.ts
DELETED
package/button/Button.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
19
|
-
|
|
20
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
|
-
var _variables = require("../common/variables.js");
|
|
23
|
-
|
|
24
|
-
var _utils = require("../common/utils.js");
|
|
25
|
-
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
27
|
-
|
|
28
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
29
|
-
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
31
|
-
|
|
32
|
-
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); }
|
|
33
|
-
|
|
34
|
-
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
|
-
|
|
36
|
-
var DxcButton = function DxcButton(_ref) {
|
|
37
|
-
var _ref$label = _ref.label,
|
|
38
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
39
|
-
_ref$mode = _ref.mode,
|
|
40
|
-
mode = _ref$mode === void 0 ? "primary" : _ref$mode,
|
|
41
|
-
_ref$disabled = _ref.disabled,
|
|
42
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
43
|
-
_ref$iconPosition = _ref.iconPosition,
|
|
44
|
-
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
45
|
-
_ref$type = _ref.type,
|
|
46
|
-
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
47
|
-
_ref$iconSrc = _ref.iconSrc,
|
|
48
|
-
iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
|
|
49
|
-
icon = _ref.icon,
|
|
50
|
-
_ref$onClick = _ref.onClick,
|
|
51
|
-
_onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
|
|
52
|
-
margin = _ref.margin,
|
|
53
|
-
size = _ref.size,
|
|
54
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
55
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
56
|
-
|
|
57
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
58
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
60
|
-
theme: colorsTheme.button
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(DxCButton, {
|
|
62
|
-
type: type,
|
|
63
|
-
margin: margin,
|
|
64
|
-
mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
65
|
-
disabled: disabled,
|
|
66
|
-
iconPosition: iconPosition,
|
|
67
|
-
size: size,
|
|
68
|
-
backgroundType: backgroundType,
|
|
69
|
-
icon: icon
|
|
70
|
-
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
71
|
-
disabled: disabled,
|
|
72
|
-
type: type,
|
|
73
|
-
disableRipple: true,
|
|
74
|
-
"aria-disabled": disabled ? true : false,
|
|
75
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
76
|
-
onClick: function onClick() {
|
|
77
|
-
if (_onClick) {
|
|
78
|
-
_onClick();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
82
|
-
icon: icon,
|
|
83
|
-
iconPosition: iconPosition
|
|
84
|
-
}, label), icon ? /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
85
|
-
label: label,
|
|
86
|
-
iconPosition: iconPosition
|
|
87
|
-
}, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : iconSrc && /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
|
|
88
|
-
label: label,
|
|
89
|
-
iconPosition: iconPosition,
|
|
90
|
-
src: iconSrc
|
|
91
|
-
}))));
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
var sizes = {
|
|
95
|
-
small: "42px",
|
|
96
|
-
medium: "120px",
|
|
97
|
-
large: "240px",
|
|
98
|
-
fillParent: "100%",
|
|
99
|
-
fitContent: "unset"
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
103
|
-
if (size === "fillParent") {
|
|
104
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return sizes[size];
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
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) {
|
|
111
|
-
return props.theme.labelFontLineHeight;
|
|
112
|
-
}, function (props) {
|
|
113
|
-
return props.theme.fontSize;
|
|
114
|
-
}, function (props) {
|
|
115
|
-
return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
|
|
116
|
-
}, function (props) {
|
|
117
|
-
return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
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) {
|
|
121
|
-
return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
|
|
122
|
-
}, function (props) {
|
|
123
|
-
return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
127
|
-
return props.iconPosition === "after" && props.label !== "" && "10px" || "0px";
|
|
128
|
-
}, function (props) {
|
|
129
|
-
return props.iconPosition === "before" && props.label !== "" && "10px" || "0px";
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
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 flex-direction: ", ";\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) {
|
|
133
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
134
|
-
}, function (props) {
|
|
135
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
136
|
-
}, function (props) {
|
|
137
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
138
|
-
}, function (props) {
|
|
139
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
140
|
-
}, function (props) {
|
|
141
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
142
|
-
}, function (props) {
|
|
143
|
-
return calculateWidth(props.margin, props.size);
|
|
144
|
-
}, function (props) {
|
|
145
|
-
return props.disabled && "not-allowed" || "pointer";
|
|
146
|
-
}, function (props) {
|
|
147
|
-
return props.theme.paddingLeft;
|
|
148
|
-
}, function (props) {
|
|
149
|
-
return props.theme.paddingRight;
|
|
150
|
-
}, function (props) {
|
|
151
|
-
return props.theme.paddingTop;
|
|
152
|
-
}, function (props) {
|
|
153
|
-
return props.theme.paddingBottom;
|
|
154
|
-
}, function (props) {
|
|
155
|
-
return props.iconPosition === "after" && "row" || "row-reverse";
|
|
156
|
-
}, function (props) {
|
|
157
|
-
return props.theme.fontFamily;
|
|
158
|
-
}, function (props) {
|
|
159
|
-
return props.theme.fontSize;
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return props.theme.fontWeight;
|
|
162
|
-
}, function (props) {
|
|
163
|
-
return props.theme.labelLetterSpacing;
|
|
164
|
-
}, function (props) {
|
|
165
|
-
return props.size === "small" && "calc(100% - 22px)" || "unset";
|
|
166
|
-
}, function (props) {
|
|
167
|
-
return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
|
|
168
|
-
}, function (props) {
|
|
169
|
-
var mode = props.mode,
|
|
170
|
-
backgroundType = props.backgroundType;
|
|
171
|
-
|
|
172
|
-
if (mode === "primary") {
|
|
173
|
-
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 .MuiButton-label {\n z-index: 5;\n }\n ");
|
|
174
|
-
} else if (mode === "secondary") {
|
|
175
|
-
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 .MuiButton-label {\n z-index: 5;\n }\n ");
|
|
176
|
-
} else if (mode === "text") {
|
|
177
|
-
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 ");
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
var _default = DxcButton;
|
|
182
|
-
exports["default"] = _default;
|