@dxc-technology/halstack-react 0.0.0-e2d44ba → 0.0.0-e3347c0
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 +27 -47
- package/dist/index.d.mts +6708 -0
- package/dist/index.d.ts +6708 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +79 -67
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -240
- package/dist/accordion/Accordion.js +0 -353
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/alert/Alert.js +0 -403
- package/dist/badge/Badge.js +0 -63
- package/dist/box/Box.js +0 -156
- package/dist/button/Button.js +0 -238
- package/dist/card/Card.js +0 -254
- package/dist/checkbox/Checkbox.js +0 -300
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -265
- package/dist/common/OpenSans.css +0 -81
- package/dist/common/RequiredComponent.js +0 -40
- package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Light.ttf +0 -0
- package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/dist/common/utils.js +0 -22
- package/dist/common/variables.js +0 -1365
- package/dist/date/Date.js +0 -381
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -218
- package/dist/dropdown/Dropdown.js +0 -544
- package/dist/footer/Footer.js +0 -395
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo.svg +0 -15
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -403
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/heading/Heading.js +0 -218
- package/dist/input-text/InputText.js +0 -707
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/ApplicationLayout.js +0 -331
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/Link.js +0 -241
- package/dist/link/readme.md +0 -51
- package/dist/main.js +0 -351
- package/dist/new-date/NewDate.js +0 -403
- package/dist/new-input-text/NewInputText.js +0 -961
- package/dist/new-textarea/NewTextarea.js +0 -346
- package/dist/number/Number.js +0 -138
- package/dist/number/NumberContext.js +0 -16
- package/dist/paginator/Paginator.js +0 -289
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/password/Password.js +0 -200
- package/dist/password/styles.css +0 -3
- package/dist/progress-bar/ProgressBar.js +0 -242
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -209
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -358
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.js +0 -549
- package/dist/sidenav/Sidenav.js +0 -177
- package/dist/slider/Slider.js +0 -319
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -381
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -222
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/table/Table.js +0 -132
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -288
- package/dist/textarea/Textarea.js +0 -264
- package/dist/toggle/Toggle.js +0 -220
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/toggle-group/ToggleGroup.js +0 -223
- package/dist/upload/Upload.js +0 -205
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -184
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -175
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/upload/transactions/Transactions.js +0 -138
- package/dist/useTheme.js +0 -22
- package/dist/wizard/Wizard.js +0 -411
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -145
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -240
- package/test/Link.test.js +0 -43
- package/test/NewDate.test.js +0 -203
- package/test/NewInputText.test.js +0 -817
- package/test/NewTextarea.test.js +0 -201
- package/test/Number.test.js +0 -241
- package/test/Paginator.test.js +0 -177
- package/test/Password.test.js +0 -76
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -32
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/ToggleGroup.test.js +0 -81
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
package/dist/button/Button.js
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
|
-
var _core = require("@material-ui/core");
|
|
21
|
-
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
|
-
|
|
26
|
-
var _variables = require("../common/variables.js");
|
|
27
|
-
|
|
28
|
-
var _utils = require("../common/utils.js");
|
|
29
|
-
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
31
|
-
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
33
|
-
|
|
34
|
-
function _templateObject4() {
|
|
35
|
-
var data = (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"]);
|
|
36
|
-
|
|
37
|
-
_templateObject4 = function _templateObject4() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _templateObject3() {
|
|
45
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject3 = function _templateObject3() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _templateObject2() {
|
|
55
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"]);
|
|
56
|
-
|
|
57
|
-
_templateObject2 = function _templateObject2() {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _templateObject() {
|
|
65
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n margin-right: ", ";\n margin-left: ", ";\n"]);
|
|
66
|
-
|
|
67
|
-
_templateObject = function _templateObject() {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var DxcButton = function DxcButton(_ref) {
|
|
75
|
-
var _ref$label = _ref.label,
|
|
76
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
77
|
-
_ref$mode = _ref.mode,
|
|
78
|
-
mode = _ref$mode === void 0 ? "primary" : _ref$mode,
|
|
79
|
-
_ref$disabled = _ref.disabled,
|
|
80
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
81
|
-
_ref$iconPosition = _ref.iconPosition,
|
|
82
|
-
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
83
|
-
_ref$type = _ref.type,
|
|
84
|
-
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
85
|
-
_ref$iconSrc = _ref.iconSrc,
|
|
86
|
-
iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
|
|
87
|
-
icon = _ref.icon,
|
|
88
|
-
_ref$onClick = _ref.onClick,
|
|
89
|
-
_onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
|
|
90
|
-
margin = _ref.margin,
|
|
91
|
-
size = _ref.size,
|
|
92
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
93
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
94
|
-
|
|
95
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
96
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
97
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
98
|
-
theme: colorsTheme.button
|
|
99
|
-
}, _react["default"].createElement(DxCButton, {
|
|
100
|
-
type: type,
|
|
101
|
-
margin: margin,
|
|
102
|
-
mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
103
|
-
disabled: disabled,
|
|
104
|
-
iconPosition: iconPosition,
|
|
105
|
-
size: size,
|
|
106
|
-
backgroundType: backgroundType,
|
|
107
|
-
icon: icon
|
|
108
|
-
}, _react["default"].createElement(_core.Button, {
|
|
109
|
-
disabled: disabled,
|
|
110
|
-
type: type,
|
|
111
|
-
disableRipple: true,
|
|
112
|
-
"aria-disabled": disabled ? true : false,
|
|
113
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
114
|
-
onClick: function onClick() {
|
|
115
|
-
if (_onClick) {
|
|
116
|
-
_onClick();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, label && _react["default"].createElement(LabelContainer, {
|
|
120
|
-
icon: icon,
|
|
121
|
-
iconPosition: iconPosition
|
|
122
|
-
}, label), icon ? _react["default"].createElement(IconContainer, {
|
|
123
|
-
label: label,
|
|
124
|
-
iconPosition: iconPosition
|
|
125
|
-
}, (0, _typeof2["default"])(icon) === "object" ? icon : _react["default"].createElement(icon)) : iconSrc && _react["default"].createElement(ButtonIcon, {
|
|
126
|
-
label: label,
|
|
127
|
-
iconPosition: iconPosition,
|
|
128
|
-
src: iconSrc
|
|
129
|
-
}))));
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
var sizes = {
|
|
133
|
-
small: "42px",
|
|
134
|
-
medium: "120px",
|
|
135
|
-
large: "240px",
|
|
136
|
-
fillParent: "100%",
|
|
137
|
-
fitContent: "unset"
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
141
|
-
if (size === "fillParent") {
|
|
142
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return sizes[size];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject(), function (props) {
|
|
149
|
-
return props.theme.labelFontLineHeight;
|
|
150
|
-
}, function (props) {
|
|
151
|
-
return props.theme.fontSize;
|
|
152
|
-
}, function (props) {
|
|
153
|
-
return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
|
|
154
|
-
}, function (props) {
|
|
155
|
-
return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
var IconContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
159
|
-
return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
var ButtonIcon = _styledComponents["default"].img(_templateObject3(), function (props) {
|
|
165
|
-
return props.iconPosition === "after" && props.label !== "" && "10px" || "0px";
|
|
166
|
-
}, function (props) {
|
|
167
|
-
return props.iconPosition === "before" && props.label !== "" && "10px" || "0px";
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
var DxCButton = _styledComponents["default"].div(_templateObject4(), function (props) {
|
|
171
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
172
|
-
}, function (props) {
|
|
173
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
174
|
-
}, function (props) {
|
|
175
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
176
|
-
}, function (props) {
|
|
177
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
178
|
-
}, function (props) {
|
|
179
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
180
|
-
}, function (props) {
|
|
181
|
-
return calculateWidth(props.margin, props.size);
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return props.disabled && "not-allowed" || "pointer";
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return props.theme.paddingLeft;
|
|
186
|
-
}, function (props) {
|
|
187
|
-
return props.theme.paddingRight;
|
|
188
|
-
}, function (props) {
|
|
189
|
-
return props.theme.paddingTop;
|
|
190
|
-
}, function (props) {
|
|
191
|
-
return props.theme.paddingBottom;
|
|
192
|
-
}, function (props) {
|
|
193
|
-
return props.iconPosition === "after" && "row" || "row-reverse";
|
|
194
|
-
}, function (props) {
|
|
195
|
-
return props.theme.fontFamily;
|
|
196
|
-
}, function (props) {
|
|
197
|
-
return props.theme.fontSize;
|
|
198
|
-
}, function (props) {
|
|
199
|
-
return props.theme.fontWeight;
|
|
200
|
-
}, function (props) {
|
|
201
|
-
return props.theme.labelLetterSpacing;
|
|
202
|
-
}, function (props) {
|
|
203
|
-
return props.size === "small" && "calc(100% - 22px)" || "unset";
|
|
204
|
-
}, function (props) {
|
|
205
|
-
return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
|
|
206
|
-
}, function (props) {
|
|
207
|
-
var mode = props.mode,
|
|
208
|
-
backgroundType = props.backgroundType;
|
|
209
|
-
|
|
210
|
-
if (mode === "primary") {
|
|
211
|
-
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 ");
|
|
212
|
-
} else if (mode === "secondary") {
|
|
213
|
-
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 ");
|
|
214
|
-
} else if (mode === "text") {
|
|
215
|
-
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 ");
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
DxcButton.propTypes = {
|
|
220
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
221
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
222
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
223
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
224
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
225
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
226
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
227
|
-
label: _propTypes["default"].string,
|
|
228
|
-
mode: _propTypes["default"].oneOf(["primary", "secondary", "text"]),
|
|
229
|
-
disabled: _propTypes["default"].bool,
|
|
230
|
-
iconPosition: _propTypes["default"].oneOf(["after", "before"]),
|
|
231
|
-
onClick: _propTypes["default"].func,
|
|
232
|
-
iconSrc: _propTypes["default"].string,
|
|
233
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
234
|
-
type: _propTypes["default"].oneOf(["button", "reset", "submit"]),
|
|
235
|
-
tabIndex: _propTypes["default"].number
|
|
236
|
-
};
|
|
237
|
-
var _default = DxcButton;
|
|
238
|
-
exports["default"] = _default;
|
package/dist/card/Card.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
|
-
var _variables = require("../common/variables.js");
|
|
27
|
-
|
|
28
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
29
|
-
|
|
30
|
-
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
31
|
-
|
|
32
|
-
function _templateObject6() {
|
|
33
|
-
var data = (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"]);
|
|
34
|
-
|
|
35
|
-
_templateObject6 = function _templateObject6() {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _templateObject5() {
|
|
43
|
-
var data = (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"]);
|
|
44
|
-
|
|
45
|
-
_templateObject5 = function _templateObject5() {
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _templateObject4() {
|
|
53
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"]);
|
|
54
|
-
|
|
55
|
-
_templateObject4 = function _templateObject4() {
|
|
56
|
-
return data;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _templateObject3() {
|
|
63
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n text-decoration: none;\n"]);
|
|
64
|
-
|
|
65
|
-
_templateObject3 = function _templateObject3() {
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _templateObject2() {
|
|
73
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: ", ";\n height: ", ";\n width: ", ";\n &:hover {\n border-color: ", ";\n }\n"]);
|
|
74
|
-
|
|
75
|
-
_templateObject2 = function _templateObject2() {
|
|
76
|
-
return data;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _templateObject() {
|
|
83
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n outline: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
84
|
-
|
|
85
|
-
_templateObject = function _templateObject() {
|
|
86
|
-
return data;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var DxcCard = function DxcCard(_ref) {
|
|
93
|
-
var imageSrc = _ref.imageSrc,
|
|
94
|
-
children = _ref.children,
|
|
95
|
-
margin = _ref.margin,
|
|
96
|
-
contentPadding = _ref.contentPadding,
|
|
97
|
-
linkHref = _ref.linkHref,
|
|
98
|
-
onClick = _ref.onClick,
|
|
99
|
-
imageBgColor = _ref.imageBgColor,
|
|
100
|
-
imagePadding = _ref.imagePadding,
|
|
101
|
-
imagePosition = _ref.imagePosition,
|
|
102
|
-
outlined = _ref.outlined,
|
|
103
|
-
imageCover = _ref.imageCover,
|
|
104
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
105
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
106
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
107
|
-
|
|
108
|
-
var _useState = (0, _react.useState)(false),
|
|
109
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
110
|
-
isHovered = _useState2[0],
|
|
111
|
-
changeIsHovered = _useState2[1];
|
|
112
|
-
|
|
113
|
-
var tagContent = _react["default"].createElement(_Box["default"], {
|
|
114
|
-
shadowDepth: outlined ? 0 : isHovered && (onClick || linkHref) ? 2 : 1
|
|
115
|
-
}, _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
116
|
-
theme: colorsTheme.card
|
|
117
|
-
}, _react["default"].createElement(CardContainer, {
|
|
118
|
-
hasAction: onClick || linkHref,
|
|
119
|
-
outlined: outlined,
|
|
120
|
-
imagePosition: imagePosition
|
|
121
|
-
}, imageSrc && _react["default"].createElement(ImageContainer, {
|
|
122
|
-
imageBgColor: imageBgColor
|
|
123
|
-
}, _react["default"].createElement(TagImage, {
|
|
124
|
-
imagePadding: imagePadding,
|
|
125
|
-
cover: imageCover,
|
|
126
|
-
src: imageSrc
|
|
127
|
-
})), _react["default"].createElement(CardContent, {
|
|
128
|
-
contentPadding: contentPadding
|
|
129
|
-
}, children))));
|
|
130
|
-
|
|
131
|
-
return _react["default"].createElement(StyledDxcCard, {
|
|
132
|
-
margin: margin,
|
|
133
|
-
onMouseEnter: function onMouseEnter() {
|
|
134
|
-
return changeIsHovered(true);
|
|
135
|
-
},
|
|
136
|
-
onMouseLeave: function onMouseLeave() {
|
|
137
|
-
return changeIsHovered(false);
|
|
138
|
-
},
|
|
139
|
-
onClick: onClick,
|
|
140
|
-
hasAction: onClick,
|
|
141
|
-
tabIndex: typeof onClick === "function" && !linkHref ? tabIndex : -1
|
|
142
|
-
}, linkHref && _react["default"].createElement(StyledLink, {
|
|
143
|
-
tabIndex: tabIndex,
|
|
144
|
-
href: linkHref
|
|
145
|
-
}, tagContent) || tagContent);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
var StyledDxcCard = _styledComponents["default"].div(_templateObject(), function (_ref2) {
|
|
149
|
-
var hasAction = _ref2.hasAction;
|
|
150
|
-
return hasAction && "pointer" || "unset";
|
|
151
|
-
}, function (_ref3) {
|
|
152
|
-
var hasAction = _ref3.hasAction;
|
|
153
|
-
return !hasAction && "none";
|
|
154
|
-
}, function (_ref4) {
|
|
155
|
-
var margin = _ref4.margin;
|
|
156
|
-
return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
|
|
157
|
-
}, function (_ref5) {
|
|
158
|
-
var margin = _ref5.margin;
|
|
159
|
-
return margin && margin.top ? _variables.spaces[margin.top] : "";
|
|
160
|
-
}, function (_ref6) {
|
|
161
|
-
var margin = _ref6.margin;
|
|
162
|
-
return margin && margin.right ? _variables.spaces[margin.right] : "";
|
|
163
|
-
}, function (_ref7) {
|
|
164
|
-
var margin = _ref7.margin;
|
|
165
|
-
return margin && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
166
|
-
}, function (_ref8) {
|
|
167
|
-
var margin = _ref8.margin;
|
|
168
|
-
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
var CardContainer = _styledComponents["default"].div(_templateObject2(), function (_ref9) {
|
|
172
|
-
var imagePosition = _ref9.imagePosition;
|
|
173
|
-
return imagePosition === "before" && "row" || "row-reverse";
|
|
174
|
-
}, function (props) {
|
|
175
|
-
return props.theme.height;
|
|
176
|
-
}, function (props) {
|
|
177
|
-
return props.theme.width;
|
|
178
|
-
}, function (_ref10) {
|
|
179
|
-
var hasAction = _ref10.hasAction;
|
|
180
|
-
return hasAction ? "" : "unset";
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
var StyledLink = _styledComponents["default"].a(_templateObject3());
|
|
184
|
-
|
|
185
|
-
var TagImage = _styledComponents["default"].img(_templateObject4(), function (_ref11) {
|
|
186
|
-
var imagePadding = _ref11.imagePadding;
|
|
187
|
-
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
188
|
-
}, function (_ref12) {
|
|
189
|
-
var imagePadding = _ref12.imagePadding;
|
|
190
|
-
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
191
|
-
}, function (_ref13) {
|
|
192
|
-
var cover = _ref13.cover;
|
|
193
|
-
return cover ? "cover" : "contain";
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
var ImageContainer = _styledComponents["default"].div(_templateObject5(), function (_ref14) {
|
|
197
|
-
var imageBgColor = _ref14.imageBgColor;
|
|
198
|
-
return imageBgColor;
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
var CardContent = _styledComponents["default"].div(_templateObject6(), function (_ref15) {
|
|
202
|
-
var contentPadding = _ref15.contentPadding;
|
|
203
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) !== "object" ? _variables.spaces[contentPadding] : "0px";
|
|
204
|
-
}, function (_ref16) {
|
|
205
|
-
var contentPadding = _ref16.contentPadding;
|
|
206
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.top ? _variables.spaces[contentPadding.top] : "";
|
|
207
|
-
}, function (_ref17) {
|
|
208
|
-
var contentPadding = _ref17.contentPadding;
|
|
209
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.right ? _variables.spaces[contentPadding.right] : "";
|
|
210
|
-
}, function (_ref18) {
|
|
211
|
-
var contentPadding = _ref18.contentPadding;
|
|
212
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.bottom ? _variables.spaces[contentPadding.bottom] : "";
|
|
213
|
-
}, function (_ref19) {
|
|
214
|
-
var contentPadding = _ref19.contentPadding;
|
|
215
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.left ? _variables.spaces[contentPadding.left] : "";
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
DxcCard.propTypes = {
|
|
219
|
-
imageSrc: _propTypes["default"].string,
|
|
220
|
-
imageBgColor: _propTypes["default"].string,
|
|
221
|
-
imagePadding: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces))),
|
|
222
|
-
imagePosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
223
|
-
linkHref: _propTypes["default"].string,
|
|
224
|
-
onClick: _propTypes["default"].func,
|
|
225
|
-
outlined: _propTypes["default"].bool,
|
|
226
|
-
imageCover: _propTypes["default"].bool,
|
|
227
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
228
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
229
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
230
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
231
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
232
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
233
|
-
contentPadding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
234
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
235
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
236
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
237
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
238
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
239
|
-
tabIndex: _propTypes["default"].number
|
|
240
|
-
};
|
|
241
|
-
DxcCard.defaultProps = {
|
|
242
|
-
imageSrc: null,
|
|
243
|
-
margin: null,
|
|
244
|
-
contentPadding: null,
|
|
245
|
-
outlined: false,
|
|
246
|
-
imagePadding: null,
|
|
247
|
-
imageCover: false,
|
|
248
|
-
linkHref: null,
|
|
249
|
-
onClick: null,
|
|
250
|
-
imageBgColor: "black",
|
|
251
|
-
imagePosition: "before"
|
|
252
|
-
};
|
|
253
|
-
var _default = DxcCard;
|
|
254
|
-
exports["default"] = _default;
|