@dxc-technology/halstack-react 0.0.0-d725c1e → 0.0.0-d80caba
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 +6734 -0
- package/dist/index.d.ts +6734 -0
- package/dist/index.js +14279 -0
- package/dist/index.mjs +14190 -0
- package/package.json +76 -66
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -216
- package/dist/accordion/Accordion.js +0 -356
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.js +0 -188
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.js +0 -318
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/badge/Badge.js +0 -40
- package/dist/box/Box.js +0 -147
- package/dist/button/Button.js +0 -219
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/card/Card.js +0 -247
- package/dist/checkbox/Checkbox.js +0 -233
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -223
- 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 -676
- package/dist/date/Date.js +0 -357
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -203
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.js +0 -456
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.js +0 -405
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -431
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- 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 -222
- package/dist/input-text/InputText.js +0 -609
- 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 -200
- package/dist/link/readme.md +0 -51
- package/dist/main.js +0 -311
- package/dist/paginator/Paginator.js +0 -261
- 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/progress-bar/ProgressBar.js +0 -192
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -190
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -332
- 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 -490
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/Sidenav.js +0 -179
- package/dist/slider/Slider.js +0 -267
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -214
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -194
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/table/Table.js +0 -98
- package/dist/tabs/Tabs.js +0 -325
- 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 -268
- package/dist/textarea/Textarea.js +0 -238
- 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/toggle-group/readme.md +0 -82
- package/dist/upload/Upload.js +0 -209
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -123
- 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 -293
- 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 -162
- 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 -152
- 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 -122
- package/dist/useTheme.js +0 -22
- package/dist/wizard/Wizard.js +0 -355
- package/dist/wizard/invalid_icon.svg +0 -6
- package/dist/wizard/valid_icon.svg +0 -6
- 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 -130
- 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 -42
- package/test/Paginator.test.js +0 -177
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -330
- package/test/Select.test.js +0 -192
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -27
- 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/readme.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# DXC Button Component
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
```js
|
|
6
|
-
import { DxcButton } from "@dxc-technology/halstack-react";
|
|
7
|
-
|
|
8
|
-
<DxcButton onClick={handleClick} label="Test Button" />;
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
<table>
|
|
14
|
-
<tr style="background-color: grey">
|
|
15
|
-
<td>Name</td>
|
|
16
|
-
<td>Default</td>
|
|
17
|
-
<td>Description</td>
|
|
18
|
-
</tr>
|
|
19
|
-
<tr>
|
|
20
|
-
<td>mode: 'basic' | 'outlined' | 'raised' | 'flat'</td>
|
|
21
|
-
<td><code>'basic'</code></td>
|
|
22
|
-
<td>Uses on of the available button modes.</td>
|
|
23
|
-
</tr>
|
|
24
|
-
<tr>
|
|
25
|
-
<td>theme: 'light' |'dark'</td>
|
|
26
|
-
<td><code>'light'</code></td>
|
|
27
|
-
<td>Uses one of the available button modes.</td>
|
|
28
|
-
</tr>
|
|
29
|
-
<tr>
|
|
30
|
-
<td>label: string</td>
|
|
31
|
-
<td><code>'basic'</code></td>
|
|
32
|
-
<td>Text to be placed next to the button.</td>
|
|
33
|
-
</tr>
|
|
34
|
-
<tr>
|
|
35
|
-
<td>iconSrc: string</td>
|
|
36
|
-
<td></td>
|
|
37
|
-
<td>URL of the icon that will be placed next to the button label.</td>
|
|
38
|
-
</tr>
|
|
39
|
-
<tr>
|
|
40
|
-
<td>iconPosition: 'before' | 'after'</td>
|
|
41
|
-
<td><code>'before'</code></td>
|
|
42
|
-
<td>Whether the icon should appear after or before the label.</td>
|
|
43
|
-
</tr>
|
|
44
|
-
<tr>
|
|
45
|
-
<td>disabled: boolean</td>
|
|
46
|
-
<td><code>false</code></td>
|
|
47
|
-
<td>If true, the component will be disabled.</td>
|
|
48
|
-
</tr>
|
|
49
|
-
<tr>
|
|
50
|
-
<td>disableRipple: boolean</td>
|
|
51
|
-
<td><code>false</code></td>
|
|
52
|
-
<td>If true, the ripple effect will be disabled.</td>
|
|
53
|
-
</tr>
|
|
54
|
-
<tr>
|
|
55
|
-
<td>onClick: function</td>
|
|
56
|
-
<td></td>
|
|
57
|
-
<td>This function will be called when the user clicks the button. The event object will be passed as a parameter.</td>
|
|
58
|
-
</tr>
|
|
59
|
-
|
|
60
|
-
</table>
|
|
61
|
-
|
|
62
|
-
## Examples
|
|
63
|
-
|
|
64
|
-
- Basic button - Light theme - Enabled - Icon after label - With ripple
|
|
65
|
-
|
|
66
|
-
```js
|
|
67
|
-
import React from "react";
|
|
68
|
-
|
|
69
|
-
import { DxcButton } from "@dxc-technology/halstack-react";
|
|
70
|
-
|
|
71
|
-
function App() {
|
|
72
|
-
const handleOnClick = event => {
|
|
73
|
-
console.log("Button clicked");
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<div>
|
|
78
|
-
<DxcButton
|
|
79
|
-
label="Basic"
|
|
80
|
-
mode="basic"
|
|
81
|
-
disabled={false}
|
|
82
|
-
theme="light"
|
|
83
|
-
disableRipple={false}
|
|
84
|
-
iconPosition="after"
|
|
85
|
-
iconSrc="/images/run_icon.png"
|
|
86
|
-
onClick={handleOnClick}
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default App;
|
|
93
|
-
```
|
package/dist/card/Card.js
DELETED
|
@@ -1,247 +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 = _interopRequireDefault(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
|
-
var _variables = require("../common/variables.js");
|
|
27
|
-
|
|
28
|
-
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
29
|
-
|
|
30
|
-
function _templateObject6() {
|
|
31
|
-
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"]);
|
|
32
|
-
|
|
33
|
-
_templateObject6 = function _templateObject6() {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _templateObject5() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 140px;\n height: 100%;\n flex-shrink: 0;\n background: ", ";\n justify-content: center;\n align-items: center;\n display: inline-flex;\n"]);
|
|
42
|
-
|
|
43
|
-
_templateObject5 = function _templateObject5() {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _templateObject4() {
|
|
51
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"]);
|
|
52
|
-
|
|
53
|
-
_templateObject4 = function _templateObject4() {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _templateObject3() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n text-decoration: ", ";\n"]);
|
|
62
|
-
|
|
63
|
-
_templateObject3 = function _templateObject3() {
|
|
64
|
-
return data;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _templateObject2() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: ", ";\n height: 220px;\n width: 400px;\n &:hover {\n border-color: ", ";\n }\n"]);
|
|
72
|
-
|
|
73
|
-
_templateObject2 = function _templateObject2() {
|
|
74
|
-
return data;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return data;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function _templateObject() {
|
|
81
|
-
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"]);
|
|
82
|
-
|
|
83
|
-
_templateObject = function _templateObject() {
|
|
84
|
-
return data;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return data;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var DxcCard = function DxcCard(_ref) {
|
|
91
|
-
var imageSrc = _ref.imageSrc,
|
|
92
|
-
children = _ref.children,
|
|
93
|
-
margin = _ref.margin,
|
|
94
|
-
contentPadding = _ref.contentPadding,
|
|
95
|
-
linkHref = _ref.linkHref,
|
|
96
|
-
onClick = _ref.onClick,
|
|
97
|
-
imageBgColor = _ref.imageBgColor,
|
|
98
|
-
imagePadding = _ref.imagePadding,
|
|
99
|
-
imagePosition = _ref.imagePosition,
|
|
100
|
-
outlined = _ref.outlined,
|
|
101
|
-
imageCover = _ref.imageCover,
|
|
102
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
103
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
104
|
-
|
|
105
|
-
var _useState = (0, _react.useState)(false),
|
|
106
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
107
|
-
isHovered = _useState2[0],
|
|
108
|
-
changeIsHovered = _useState2[1];
|
|
109
|
-
|
|
110
|
-
var tagContent = _react["default"].createElement(_Box["default"], {
|
|
111
|
-
shadowDepth: outlined ? 0 : isHovered && (onClick || linkHref) ? 2 : 1
|
|
112
|
-
}, _react["default"].createElement(CardContainer, {
|
|
113
|
-
hasAction: onClick || linkHref,
|
|
114
|
-
outlined: outlined,
|
|
115
|
-
imagePosition: imagePosition
|
|
116
|
-
}, imageSrc && _react["default"].createElement(ImageContainer, {
|
|
117
|
-
imageBgColor: imageBgColor
|
|
118
|
-
}, _react["default"].createElement(TagImage, {
|
|
119
|
-
imagePadding: imagePadding,
|
|
120
|
-
cover: imageCover,
|
|
121
|
-
src: imageSrc
|
|
122
|
-
})), _react["default"].createElement(CardContent, {
|
|
123
|
-
contentPadding: contentPadding
|
|
124
|
-
}, children)));
|
|
125
|
-
|
|
126
|
-
return _react["default"].createElement(StyledDxcCard, {
|
|
127
|
-
margin: margin,
|
|
128
|
-
onMouseEnter: function onMouseEnter() {
|
|
129
|
-
return changeIsHovered(true);
|
|
130
|
-
},
|
|
131
|
-
onMouseLeave: function onMouseLeave() {
|
|
132
|
-
return changeIsHovered(false);
|
|
133
|
-
},
|
|
134
|
-
onClick: onClick,
|
|
135
|
-
hasAction: onClick,
|
|
136
|
-
tabIndex: typeof onClick === "function" && !linkHref ? tabIndex : -1
|
|
137
|
-
}, linkHref && _react["default"].createElement(StyledLink, {
|
|
138
|
-
tabIndex: tabIndex,
|
|
139
|
-
href: linkHref
|
|
140
|
-
}, tagContent) || tagContent);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
var StyledDxcCard = _styledComponents["default"].div(_templateObject(), function (_ref2) {
|
|
144
|
-
var hasAction = _ref2.hasAction;
|
|
145
|
-
return hasAction && "pointer" || "unset";
|
|
146
|
-
}, function (_ref3) {
|
|
147
|
-
var hasAction = _ref3.hasAction;
|
|
148
|
-
return !hasAction && "none";
|
|
149
|
-
}, function (_ref4) {
|
|
150
|
-
var margin = _ref4.margin;
|
|
151
|
-
return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
|
|
152
|
-
}, function (_ref5) {
|
|
153
|
-
var margin = _ref5.margin;
|
|
154
|
-
return margin && margin.top ? _variables.spaces[margin.top] : "";
|
|
155
|
-
}, function (_ref6) {
|
|
156
|
-
var margin = _ref6.margin;
|
|
157
|
-
return margin && margin.right ? _variables.spaces[margin.right] : "";
|
|
158
|
-
}, function (_ref7) {
|
|
159
|
-
var margin = _ref7.margin;
|
|
160
|
-
return margin && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
161
|
-
}, function (_ref8) {
|
|
162
|
-
var margin = _ref8.margin;
|
|
163
|
-
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
var CardContainer = _styledComponents["default"].div(_templateObject2(), function (_ref9) {
|
|
167
|
-
var imagePosition = _ref9.imagePosition;
|
|
168
|
-
return imagePosition === "before" && "row" || "row-reverse";
|
|
169
|
-
}, function (_ref10) {
|
|
170
|
-
var hasAction = _ref10.hasAction;
|
|
171
|
-
return hasAction ? "" : "unset";
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
var StyledLink = _styledComponents["default"].a(_templateObject3(), function (props) {
|
|
175
|
-
return props.theme.textDecoration;
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
var TagImage = _styledComponents["default"].img(_templateObject4(), function (_ref11) {
|
|
179
|
-
var imagePadding = _ref11.imagePadding;
|
|
180
|
-
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
181
|
-
}, function (_ref12) {
|
|
182
|
-
var imagePadding = _ref12.imagePadding;
|
|
183
|
-
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
184
|
-
}, function (_ref13) {
|
|
185
|
-
var cover = _ref13.cover;
|
|
186
|
-
return cover ? "cover" : "contain";
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
var ImageContainer = _styledComponents["default"].div(_templateObject5(), function (_ref14) {
|
|
190
|
-
var imageBgColor = _ref14.imageBgColor;
|
|
191
|
-
return imageBgColor;
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
var CardContent = _styledComponents["default"].div(_templateObject6(), function (_ref15) {
|
|
195
|
-
var contentPadding = _ref15.contentPadding;
|
|
196
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) !== "object" ? _variables.spaces[contentPadding] : "0px";
|
|
197
|
-
}, function (_ref16) {
|
|
198
|
-
var contentPadding = _ref16.contentPadding;
|
|
199
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.top ? _variables.spaces[contentPadding.top] : "";
|
|
200
|
-
}, function (_ref17) {
|
|
201
|
-
var contentPadding = _ref17.contentPadding;
|
|
202
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.right ? _variables.spaces[contentPadding.right] : "";
|
|
203
|
-
}, function (_ref18) {
|
|
204
|
-
var contentPadding = _ref18.contentPadding;
|
|
205
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.bottom ? _variables.spaces[contentPadding.bottom] : "";
|
|
206
|
-
}, function (_ref19) {
|
|
207
|
-
var contentPadding = _ref19.contentPadding;
|
|
208
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.left ? _variables.spaces[contentPadding.left] : "";
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
DxcCard.propTypes = {
|
|
212
|
-
imageSrc: _propTypes["default"].string,
|
|
213
|
-
imageBgColor: _propTypes["default"].string,
|
|
214
|
-
imagePadding: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces))),
|
|
215
|
-
imagePosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
216
|
-
linkHref: _propTypes["default"].string,
|
|
217
|
-
onClick: _propTypes["default"].func,
|
|
218
|
-
outlined: _propTypes["default"].bool,
|
|
219
|
-
imageCover: _propTypes["default"].bool,
|
|
220
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
221
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
222
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
223
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
224
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
225
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
226
|
-
contentPadding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
227
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
228
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
229
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
230
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
231
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
232
|
-
tabIndex: _propTypes["default"].number
|
|
233
|
-
};
|
|
234
|
-
DxcCard.defaultProps = {
|
|
235
|
-
imageSrc: null,
|
|
236
|
-
margin: null,
|
|
237
|
-
contentPadding: null,
|
|
238
|
-
outlined: false,
|
|
239
|
-
imagePadding: null,
|
|
240
|
-
imageCover: false,
|
|
241
|
-
linkHref: null,
|
|
242
|
-
onClick: null,
|
|
243
|
-
imageBgColor: "black",
|
|
244
|
-
imagePosition: "before"
|
|
245
|
-
};
|
|
246
|
-
var _default = DxcCard;
|
|
247
|
-
exports["default"] = _default;
|
|
@@ -1,233 +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 _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
25
|
-
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
|
-
var _RequiredComponent = _interopRequireDefault(require("../common/RequiredComponent"));
|
|
29
|
-
|
|
30
|
-
var _variables = require("../common/variables.js");
|
|
31
|
-
|
|
32
|
-
var _utils = require("../common/utils.js");
|
|
33
|
-
|
|
34
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
35
|
-
|
|
36
|
-
function _templateObject3() {
|
|
37
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: 17px;\n height: 17px;\n position: absolute;\n left: ", ";\n right: ", ";\n z-index: 0;\n padding-left: ", ";\n padding-right: ", ";\n margin-left: ", ";\n margin-right: ", ";\n"]);
|
|
38
|
-
|
|
39
|
-
_templateObject3 = function _templateObject3() {
|
|
40
|
-
return data;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return data;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _templateObject2() {
|
|
47
|
-
var data = (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 flex-direction: ", ";\n .MuiCheckbox-colorSecondary {\n &.Mui-checked {\n color: ", ";\n &:hover {\n background-color: transparent;\n }\n }\n }\n .MuiIconButton-colorSecondary {\n &:hover {\n background-color: transparent;\n }\n }\n .MuiButtonBase-root {\n &.Mui-focusVisible {\n .MuiIconButton-label {\n outline: ", " auto 1px;\n }\n }\n z-index: 1;\n padding: 10px;\n padding-left: ", ";\n padding-right: ", ";\n margin: 2px;\n margin-left: ", ";\n margin-right: ", ";\n color: ", " !important;\n }\n .MuiSvgIcon-root {\n width: 26.6px;\n height: 26.6px;\n }\n"]);
|
|
48
|
-
|
|
49
|
-
_templateObject2 = function _templateObject2() {
|
|
50
|
-
return data;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return data;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _templateObject() {
|
|
57
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n opacity: ", ";\n cursor: ", ";\n font-family: ", ";\n"]);
|
|
58
|
-
|
|
59
|
-
_templateObject = function _templateObject() {
|
|
60
|
-
return data;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
67
|
-
var checked = _ref.checked,
|
|
68
|
-
value = _ref.value,
|
|
69
|
-
_ref$label = _ref.label,
|
|
70
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
71
|
-
_ref$labelPosition = _ref.labelPosition,
|
|
72
|
-
labelPosition = _ref$labelPosition === void 0 ? "before" : _ref$labelPosition,
|
|
73
|
-
_ref$name = _ref.name,
|
|
74
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
75
|
-
_ref$disabled = _ref.disabled,
|
|
76
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
77
|
-
onChange = _ref.onChange,
|
|
78
|
-
_ref$required = _ref.required,
|
|
79
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
80
|
-
margin = _ref.margin,
|
|
81
|
-
_ref$size = _ref.size,
|
|
82
|
-
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
83
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
84
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
85
|
-
|
|
86
|
-
var _useState = (0, _react.useState)(false),
|
|
87
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
88
|
-
innerChecked = _useState2[0],
|
|
89
|
-
setInnerChecked = _useState2[1];
|
|
90
|
-
|
|
91
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
92
|
-
|
|
93
|
-
var handlerCheckboxChange = function handlerCheckboxChange(checkboxValue) {
|
|
94
|
-
if (checked === undefined) {
|
|
95
|
-
var isChecked = checkboxValue.target.checked === undefined ? !innerChecked : checkboxValue.target.checked;
|
|
96
|
-
setInnerChecked(isChecked);
|
|
97
|
-
|
|
98
|
-
if (typeof onChange === "function") {
|
|
99
|
-
onChange(isChecked);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
if (typeof onChange === "function") {
|
|
103
|
-
onChange(!checked);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
109
|
-
theme: colorsTheme.checkbox
|
|
110
|
-
}, _react["default"].createElement(CheckboxContainer, {
|
|
111
|
-
id: name,
|
|
112
|
-
brightness: _variables.componentTokens,
|
|
113
|
-
labelPosition: labelPosition,
|
|
114
|
-
disabled: disabled,
|
|
115
|
-
margin: margin,
|
|
116
|
-
size: size
|
|
117
|
-
}, _react["default"].createElement(_Checkbox["default"], {
|
|
118
|
-
checked: checked != undefined ? checked : innerChecked,
|
|
119
|
-
inputProps: name = {
|
|
120
|
-
name: name
|
|
121
|
-
},
|
|
122
|
-
onChange: handlerCheckboxChange,
|
|
123
|
-
value: value,
|
|
124
|
-
disabled: disabled,
|
|
125
|
-
disableRipple: true,
|
|
126
|
-
className: "test",
|
|
127
|
-
tabIndex: tabIndex
|
|
128
|
-
}), _react["default"].createElement(CheckboxBlackBack, {
|
|
129
|
-
labelPosition: labelPosition,
|
|
130
|
-
disabled: disabled,
|
|
131
|
-
checked: checked != undefined ? checked : innerChecked
|
|
132
|
-
}), required && _react["default"].createElement(_RequiredComponent["default"], null), label && _react["default"].createElement(LabelContainer, {
|
|
133
|
-
labelPosition: labelPosition,
|
|
134
|
-
onClick: disabled === true ? function (e) {} : handlerCheckboxChange,
|
|
135
|
-
disabled: disabled,
|
|
136
|
-
className: "labelContainer"
|
|
137
|
-
}, label)));
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
var sizes = {
|
|
141
|
-
small: "120px",
|
|
142
|
-
medium: "240px",
|
|
143
|
-
large: "480px",
|
|
144
|
-
fillParent: "100%",
|
|
145
|
-
fitContent: "unset"
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
149
|
-
if (size === "fillParent") {
|
|
150
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return sizes[size];
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject(), function (props) {
|
|
157
|
-
return props.theme.fontColor;
|
|
158
|
-
}, function (props) {
|
|
159
|
-
return props.disabled && "0.34";
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
162
|
-
}, function (props) {
|
|
163
|
-
return props.theme.fontFamily;
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
var CheckboxContainer = _styledComponents["default"].span(_templateObject2(), function (props) {
|
|
167
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
168
|
-
}, function (props) {
|
|
169
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
170
|
-
}, function (props) {
|
|
171
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
172
|
-
}, function (props) {
|
|
173
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
174
|
-
}, function (props) {
|
|
175
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
176
|
-
}, function (props) {
|
|
177
|
-
return calculateWidth(props.margin, props.size);
|
|
178
|
-
}, function (props) {
|
|
179
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
180
|
-
}, function (props) {
|
|
181
|
-
return props.labelPosition === "before" ? "row-reverse" : "row";
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return props.disabled && props.theme.disabledBackgroundColorChecked || props.theme.backgroundColorChecked;
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return props.theme.focusColor;
|
|
186
|
-
}, function (props) {
|
|
187
|
-
return props.labelPosition === "after" ? "0px" : "";
|
|
188
|
-
}, function (props) {
|
|
189
|
-
return props.labelPosition === "before" ? "0px" : "";
|
|
190
|
-
}, function (props) {
|
|
191
|
-
return props.labelPosition === "after" ? "0px" : "";
|
|
192
|
-
}, function (props) {
|
|
193
|
-
return props.labelPosition === "before" ? "0px" : "";
|
|
194
|
-
}, function (props) {
|
|
195
|
-
return props.disabled && props.theme.disabledBorderColor || props.theme.borderColor;
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
var CheckboxBlackBack = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
199
|
-
return props.checked !== true && "transparent" || props.disabled && props.theme.disabledCheckColor || props.theme.checkColor;
|
|
200
|
-
}, function (props) {
|
|
201
|
-
return props.labelPosition === "before" ? "unset" : "5px";
|
|
202
|
-
}, function (props) {
|
|
203
|
-
return props.labelPosition === "before" ? "5px" : "unset";
|
|
204
|
-
}, function (props) {
|
|
205
|
-
return props.labelPosition === "after" ? "0px" : "";
|
|
206
|
-
}, function (props) {
|
|
207
|
-
return props.labelPosition === "before" ? "0px" : "";
|
|
208
|
-
}, function (props) {
|
|
209
|
-
return props.labelPosition === "after" ? "0px" : "";
|
|
210
|
-
}, function (props) {
|
|
211
|
-
return props.labelPosition === "before" ? "0px" : "";
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
DxcCheckbox.propTypes = {
|
|
215
|
-
checked: _propTypes["default"].bool,
|
|
216
|
-
value: _propTypes["default"].any,
|
|
217
|
-
label: _propTypes["default"].string,
|
|
218
|
-
labelPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
219
|
-
name: _propTypes["default"].string,
|
|
220
|
-
disabled: _propTypes["default"].bool,
|
|
221
|
-
onChange: _propTypes["default"].func,
|
|
222
|
-
required: _propTypes["default"].bool,
|
|
223
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
224
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
225
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
226
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
227
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
228
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
229
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
230
|
-
tabIndex: _propTypes["default"].number
|
|
231
|
-
};
|
|
232
|
-
var _default = DxcCheckbox;
|
|
233
|
-
exports["default"] = _default;
|