@dxc-technology/halstack-react 0.0.0-2c2ee9d → 0.0.0-2c8be25
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 +66 -0
- package/babel.config.js +5 -2
- package/dist/BackgroundColorContext.js +46 -0
- package/dist/ThemeContext.js +237 -2
- package/dist/V3Select/V3Select.js +549 -0
- package/dist/V3Select/index.d.ts +27 -0
- package/dist/V3Textarea/V3Textarea.js +264 -0
- package/dist/V3Textarea/index.d.ts +27 -0
- package/dist/accordion/Accordion.js +170 -81
- package/dist/accordion/index.d.ts +28 -0
- package/dist/accordion-group/AccordionGroup.js +186 -0
- package/dist/accordion-group/index.d.ts +16 -0
- package/dist/alert/Alert.js +184 -83
- package/dist/alert/index.d.ts +51 -0
- package/dist/badge/Badge.js +63 -0
- package/dist/box/Box.js +39 -19
- package/dist/box/index.d.ts +25 -0
- package/dist/button/Button.js +93 -42
- package/dist/button/index.d.ts +24 -0
- package/dist/card/Card.js +64 -56
- package/dist/card/index.d.ts +22 -0
- package/dist/checkbox/Checkbox.js +117 -39
- package/dist/checkbox/index.d.ts +24 -0
- package/dist/chip/Chip.js +265 -0
- package/dist/chip/index.d.ts +22 -0
- package/dist/common/RequiredComponent.js +5 -15
- package/dist/common/variables.js +1507 -10
- package/dist/date/Date.js +110 -76
- package/dist/date/index.d.ts +27 -0
- package/dist/date-input/DateInput.js +400 -0
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +87 -33
- package/dist/dialog/index.d.ts +18 -0
- package/dist/dropdown/Dropdown.js +226 -94
- package/dist/dropdown/index.d.ts +26 -0
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +287 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +125 -45
- package/dist/footer/Icons.js +77 -0
- package/dist/footer/index.d.ts +25 -0
- package/dist/header/Header.js +215 -85
- package/dist/header/Icons.js +59 -0
- package/dist/header/index.d.ts +25 -0
- package/dist/heading/Heading.js +93 -22
- package/dist/heading/index.d.ts +17 -0
- package/dist/input-text/Icons.js +22 -0
- package/dist/input-text/InputText.js +300 -104
- package/dist/input-text/index.d.ts +36 -0
- package/dist/layout/ApplicationLayout.js +327 -0
- package/dist/layout/Icons.js +55 -0
- package/dist/link/Link.js +142 -34
- package/dist/link/index.d.ts +23 -0
- package/dist/main.d.ts +40 -0
- package/dist/main.js +120 -24
- package/dist/number-input/NumberInput.js +136 -0
- package/dist/number-input/NumberInputContext.js +16 -0
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Icons.js +66 -0
- package/dist/paginator/Paginator.js +187 -60
- package/dist/paginator/index.d.ts +20 -0
- package/dist/password-input/PasswordInput.js +203 -0
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +97 -44
- package/dist/progress-bar/index.d.ts +18 -0
- package/dist/radio/Radio.js +39 -34
- package/dist/radio/index.d.ts +23 -0
- package/dist/resultsetTable/ResultsetTable.js +99 -71
- package/dist/resultsetTable/index.d.ts +19 -0
- package/dist/select/Select.js +920 -249
- package/dist/select/index.d.ts +53 -0
- package/dist/sidenav/Sidenav.js +87 -125
- package/dist/sidenav/index.d.ts +13 -0
- package/dist/slider/Slider.js +219 -83
- package/dist/slider/index.d.ts +29 -0
- package/dist/spinner/Spinner.js +249 -64
- package/dist/spinner/index.d.ts +17 -0
- package/dist/stories/Button.js +71 -0
- package/dist/stories/Button.stories.js +55 -0
- package/dist/stories/Header.js +67 -0
- package/dist/stories/Header.stories.js +31 -0
- package/dist/stories/Introduction.stories.mdx +211 -0
- package/dist/stories/Page.js +68 -0
- package/dist/stories/Page.stories.js +39 -0
- package/dist/stories/assets/code-brackets.svg +1 -0
- package/dist/stories/assets/colors.svg +1 -0
- package/dist/stories/assets/comments.svg +1 -0
- package/dist/stories/assets/direction.svg +1 -0
- package/dist/stories/assets/flow.svg +1 -0
- package/dist/stories/assets/plugin.svg +1 -0
- package/dist/stories/assets/repo.svg +1 -0
- package/dist/stories/assets/stackalt.svg +1 -0
- package/dist/stories/button.css +30 -0
- package/dist/stories/header.css +26 -0
- package/dist/stories/page.css +69 -0
- package/dist/switch/Switch.js +54 -51
- package/dist/switch/index.d.ts +24 -0
- package/dist/table/Table.js +63 -15
- package/dist/table/index.d.ts +13 -0
- package/dist/tabs/Tabs.js +210 -50
- package/dist/tabs/index.d.ts +19 -0
- package/dist/tag/Tag.js +100 -35
- package/dist/tag/index.d.ts +24 -0
- package/dist/text-input/TextInput.js +974 -0
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +250 -107
- package/dist/textarea/index.d.ts +117 -0
- package/dist/toggle/Toggle.js +16 -19
- package/dist/toggle/index.d.ts +21 -0
- package/dist/toggle-group/ToggleGroup.js +327 -0
- package/dist/toggle-group/index.d.ts +21 -0
- package/dist/upload/Upload.js +13 -8
- package/dist/upload/buttons-upload/ButtonsUpload.js +35 -25
- package/dist/upload/buttons-upload/Icons.js +40 -0
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +84 -37
- package/dist/upload/dragAndDropArea/Icons.js +39 -0
- package/dist/upload/file-upload/FileToUpload.js +64 -33
- package/dist/upload/file-upload/Icons.js +66 -0
- package/dist/upload/files-upload/FilesToUpload.js +16 -16
- package/dist/upload/index.d.ts +15 -0
- package/dist/upload/transaction/Icons.js +160 -0
- package/dist/upload/transaction/Transaction.js +42 -49
- package/dist/upload/transactions/Transactions.js +38 -20
- package/dist/useTheme.js +22 -0
- package/dist/wizard/Icons.js +65 -0
- package/dist/wizard/Wizard.js +156 -61
- package/dist/wizard/index.d.ts +18 -0
- package/package.json +32 -17
- package/test/AccordionGroup.test.js +125 -0
- package/test/Chip.test.js +25 -0
- package/test/Date.test.js +15 -13
- package/test/DateInput.test.js +242 -0
- package/test/Dropdown.test.js +19 -4
- package/test/FileInput.test.js +201 -0
- package/test/Footer.test.js +2 -7
- package/test/Header.test.js +7 -20
- package/test/Heading.test.js +60 -12
- package/test/InputText.test.js +31 -28
- package/test/Link.test.js +25 -7
- package/test/NumberInput.test.js +259 -0
- package/test/Paginator.test.js +76 -60
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +65 -17
- package/test/Select.test.js +371 -147
- package/test/Sidenav.test.js +22 -64
- package/test/Slider.test.js +24 -15
- package/test/Spinner.test.js +5 -0
- package/test/Tabs.test.js +21 -0
- package/test/TextInput.test.js +732 -0
- package/test/Textarea.test.js +193 -0
- package/test/ToggleGroup.test.js +85 -0
- package/test/Upload.test.js +1 -1
- package/test/V3Select.test.js +212 -0
- package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- 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/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/common/services/example-service.js +0 -10
- package/dist/common/services/example-service.test.js +0 -12
- 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.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- 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.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- 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_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/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/link/readme.md +0 -51
- 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.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- 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.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/arrow_icon.svg +0 -3
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -107
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/upload/Upload.stories.js +0 -72
- 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/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- 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/readme.md +0 -37
- 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/wizard/invalid_icon.svg +0 -6
- package/dist/wizard/valid_icon.svg +0 -6
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/TabsForSections.test.js +0 -34
- package/test/Toggle.test.js +0 -43
package/dist/switch/Switch.js
CHANGED
|
@@ -25,26 +25,18 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
25
25
|
|
|
26
26
|
var _core = require("@material-ui/core");
|
|
27
27
|
|
|
28
|
-
require("../common/
|
|
28
|
+
var _RequiredComponent = _interopRequireDefault(require("../common/RequiredComponent"));
|
|
29
29
|
|
|
30
30
|
var _variables = require("../common/variables.js");
|
|
31
31
|
|
|
32
32
|
var _utils = require("../common/utils.js");
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n cursor: ", ";\n font-family: \"Open Sans\", sans-serif;\n"]);
|
|
38
|
-
|
|
39
|
-
_templateObject3 = function _templateObject3() {
|
|
40
|
-
return data;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return data;
|
|
44
|
-
}
|
|
36
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
45
37
|
|
|
46
38
|
function _templateObject2() {
|
|
47
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
39
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n cursor: ", ";\n ", "\n"]);
|
|
48
40
|
|
|
49
41
|
_templateObject2 = function _templateObject2() {
|
|
50
42
|
return data;
|
|
@@ -54,7 +46,7 @@ function _templateObject2() {
|
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
function _templateObject() {
|
|
57
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
49
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n opacity: 1;\n \n .MuiSwitch-root {\n align-items: center;\n width: ", ";\n height: 45px;\n margin: 3px;\n\n .Mui-focusVisible {\n border: ", ";\n padding: 7px;\n }\n\n .MuiSwitch-track {\n /*Enabled and unchecked bar*/\n background-color: ", ";\n height: ", ";\n }\n\n .MuiSwitch-switchBase + .MuiSwitch-track {\n opacity: 1;\n }\n\n .MuiIconButton-root {\n /*Enabled and unchecked*/\n top: unset;\n .MuiSwitch-thumb {\n /*Only for thumb in all states*/\n width: ", ";\n height: ", ";\n }\n color: ", ";\n &:hover {\n background-color: transparent;\n }\n &.Mui-disabled {\n /*Disabled and unchecked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and unchecked bar*/\n background-color: ", ";\n }\n }\n &.Mui-disabled.Mui-checked {\n /*Disabled and checked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and checked bar*/\n background-color: ", ";\n }\n }\n &.Mui-checked {\n /*Enabled and checked*/\n color: ", ";\n transform: translateX(", ");\n &:hover {\n background-color: transparent;\n }\n + .MuiSwitch-track {\n /*Enabled and checked bar*/\n background-color: ", ";\n }\n }\n }\n }\n"]);
|
|
58
50
|
|
|
59
51
|
_templateObject = function _templateObject() {
|
|
60
52
|
return data;
|
|
@@ -69,26 +61,25 @@ var DxcSwitch = function DxcSwitch(_ref) {
|
|
|
69
61
|
label = _ref.label,
|
|
70
62
|
_ref$labelPosition = _ref.labelPosition,
|
|
71
63
|
labelPosition = _ref$labelPosition === void 0 ? "before" : _ref$labelPosition,
|
|
72
|
-
_ref$theme = _ref.theme,
|
|
73
|
-
theme = _ref$theme === void 0 ? "light" : _ref$theme,
|
|
74
64
|
name = _ref.name,
|
|
75
65
|
_ref$disabled = _ref.disabled,
|
|
76
66
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
77
|
-
_ref$disableRipple = _ref.disableRipple,
|
|
78
|
-
disableRipple = _ref$disableRipple === void 0 ? false : _ref$disableRipple,
|
|
79
67
|
onChange = _ref.onChange,
|
|
80
68
|
_ref$required = _ref.required,
|
|
81
69
|
required = _ref$required === void 0 ? false : _ref$required,
|
|
82
70
|
margin = _ref.margin,
|
|
83
71
|
_ref$size = _ref.size,
|
|
84
|
-
size = _ref$size === void 0 ? "fitContent" : _ref$size
|
|
72
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
73
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
74
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
85
75
|
|
|
86
76
|
var _useState = (0, _react.useState)(0),
|
|
87
77
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
88
78
|
innerChecked = _useState2[0],
|
|
89
79
|
setInnerChecked = _useState2[1];
|
|
90
80
|
|
|
91
|
-
var colorsTheme = (0,
|
|
81
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
82
|
+
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
92
83
|
|
|
93
84
|
var handlerSwitchChange = function handlerSwitchChange(newValue) {
|
|
94
85
|
if (checked === undefined) {
|
|
@@ -106,30 +97,29 @@ var DxcSwitch = function DxcSwitch(_ref) {
|
|
|
106
97
|
};
|
|
107
98
|
|
|
108
99
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
109
|
-
theme: colorsTheme
|
|
100
|
+
theme: colorsTheme["switch"]
|
|
110
101
|
}, _react["default"].createElement(SwitchContainer, {
|
|
111
102
|
margin: margin,
|
|
112
|
-
brightness: theme,
|
|
113
103
|
disabled: disabled,
|
|
114
104
|
labelPosition: labelPosition,
|
|
115
|
-
size: size
|
|
105
|
+
size: size,
|
|
106
|
+
backgroundType: backgroundType
|
|
116
107
|
}, _react["default"].createElement(_core.Switch, {
|
|
117
108
|
checked: checked != undefined ? checked : innerChecked,
|
|
118
|
-
inputProps:
|
|
119
|
-
name: name
|
|
109
|
+
inputProps: {
|
|
110
|
+
name: name,
|
|
111
|
+
tabIndex: tabIndex
|
|
120
112
|
},
|
|
121
113
|
onChange: handlerSwitchChange,
|
|
122
114
|
value: value,
|
|
123
115
|
disabled: disabled,
|
|
124
|
-
disableRipple:
|
|
116
|
+
disableRipple: true
|
|
125
117
|
}), _react["default"].createElement(LabelContainer, {
|
|
126
118
|
labelPosition: labelPosition,
|
|
127
|
-
brightness: theme,
|
|
128
119
|
onClick: disabled === true ? function () {} : handlerSwitchChange,
|
|
129
|
-
disabled: disabled
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}, "*"), label)));
|
|
120
|
+
disabled: disabled,
|
|
121
|
+
backgroundType: backgroundType
|
|
122
|
+
}, required && _react["default"].createElement(_RequiredComponent["default"], null), label)));
|
|
133
123
|
};
|
|
134
124
|
|
|
135
125
|
var sizes = {
|
|
@@ -148,11 +138,7 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
148
138
|
return sizes[size];
|
|
149
139
|
};
|
|
150
140
|
|
|
151
|
-
var
|
|
152
|
-
return props.brightness === "dark" ? props.theme.lightRed : props.theme.darkRed;
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
var SwitchContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
141
|
+
var SwitchContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
156
142
|
return calculateWidth(props.margin, props.size);
|
|
157
143
|
}, function (props) {
|
|
158
144
|
return props.labelPosition === "after" ? "row" : "row-reverse";
|
|
@@ -167,33 +153,51 @@ var SwitchContainer = _styledComponents["default"].div(_templateObject2(), funct
|
|
|
167
153
|
}, function (props) {
|
|
168
154
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
169
155
|
}, function (props) {
|
|
170
|
-
return props.disabled
|
|
156
|
+
return props.disabled ? "not-allowed" : "default";
|
|
171
157
|
}, function (props) {
|
|
172
|
-
return props.theme.
|
|
158
|
+
return props.theme.trackWidth;
|
|
173
159
|
}, function (props) {
|
|
174
|
-
return props.theme.
|
|
160
|
+
return "".concat(props.backgroundType === "dark" ? props.theme.thumbFocusColorOnDark : props.theme.thumbFocusColor, " solid 2px");
|
|
175
161
|
}, function (props) {
|
|
176
|
-
return props.
|
|
162
|
+
return props.backgroundType === "dark" ? props.theme.uncheckedTrackBackgroundColorOnDark : props.theme.uncheckedTrackBackgroundColor;
|
|
177
163
|
}, function (props) {
|
|
178
|
-
return props.
|
|
164
|
+
return props.theme.trackHeight;
|
|
179
165
|
}, function (props) {
|
|
180
|
-
return props.
|
|
166
|
+
return props.theme.thumbWidth;
|
|
181
167
|
}, function (props) {
|
|
182
|
-
return props.theme.
|
|
168
|
+
return props.theme.thumbHeight;
|
|
183
169
|
}, function (props) {
|
|
184
|
-
return props.theme.
|
|
170
|
+
return props.backgroundType === "dark" ? props.theme.uncheckedThumbBackgroundColorOnDark : props.theme.uncheckedThumbBackgroundColor;
|
|
185
171
|
}, function (props) {
|
|
186
|
-
return props.
|
|
172
|
+
return props.backgroundType === "dark" ? props.theme.disabledUncheckedThumbBackgroundColorOnDark : props.theme.disabledUncheckedThumbBackgroundColor;
|
|
187
173
|
}, function (props) {
|
|
188
|
-
return props.theme.
|
|
174
|
+
return props.backgroundType === "dark" ? props.theme.disabledUncheckedTrackBackgroundColorOnDark : props.theme.disabledUncheckedTrackBackgroundColor;
|
|
189
175
|
}, function (props) {
|
|
190
|
-
return props.theme.
|
|
176
|
+
return props.backgroundType === "dark" ? props.theme.disabledCheckedThumbBackgroundColorOnDark : props.theme.disabledCheckedThumbBackgroundColor;
|
|
177
|
+
}, function (props) {
|
|
178
|
+
return props.backgroundType === "dark" ? props.theme.disabledCheckedTrackBackgroundColorOnDark : props.theme.disabledCheckedTrackBackgroundColor;
|
|
179
|
+
}, function (props) {
|
|
180
|
+
return props.backgroundType === "dark" ? props.theme.checkedThumbBackgroundColorOnDark : props.theme.checkedThumbBackgroundColor;
|
|
181
|
+
}, function (props) {
|
|
182
|
+
return props.theme.thumbShift;
|
|
183
|
+
}, function (props) {
|
|
184
|
+
return props.backgroundType === "dark" ? props.theme.checkedTrackBackgroundColorOnDark : props.theme.checkedTrackBackgroundColor;
|
|
191
185
|
});
|
|
192
186
|
|
|
193
|
-
var LabelContainer = _styledComponents["default"].span(
|
|
194
|
-
return props.disabled ? props.
|
|
187
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2(), function (props) {
|
|
188
|
+
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
189
|
+
}, function (props) {
|
|
190
|
+
return props.theme.labelFontFamily;
|
|
191
|
+
}, function (props) {
|
|
192
|
+
return props.theme.labelFontSize;
|
|
193
|
+
}, function (props) {
|
|
194
|
+
return props.disabled ? props.theme.disabledLabelFontStyle : props.theme.labelFontStyle;
|
|
195
|
+
}, function (props) {
|
|
196
|
+
return props.theme.labelFontWeight;
|
|
195
197
|
}, function (props) {
|
|
196
198
|
return props.disabled === true ? "not-allowed" : "pointer";
|
|
199
|
+
}, function (props) {
|
|
200
|
+
return props.labelPosition === "after" ? "margin-left: ".concat(props.theme.spaceBetweenLabelSwitch, ";") : "margin-right: ".concat(props.theme.spaceBetweenLabelSwitch, ";");
|
|
197
201
|
});
|
|
198
202
|
|
|
199
203
|
DxcSwitch.propTypes = {
|
|
@@ -202,10 +206,8 @@ DxcSwitch.propTypes = {
|
|
|
202
206
|
value: _propTypes["default"].any,
|
|
203
207
|
label: _propTypes["default"].string,
|
|
204
208
|
labelPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
205
|
-
theme: _propTypes["default"].oneOf(["light", "dark", ""]),
|
|
206
209
|
name: _propTypes["default"].string,
|
|
207
210
|
disabled: _propTypes["default"].bool,
|
|
208
|
-
disableRipple: _propTypes["default"].bool,
|
|
209
211
|
onChange: _propTypes["default"].func,
|
|
210
212
|
required: _propTypes["default"].bool,
|
|
211
213
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
@@ -213,7 +215,8 @@ DxcSwitch.propTypes = {
|
|
|
213
215
|
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
214
216
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
215
217
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
216
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
218
|
+
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
219
|
+
tabIndex: _propTypes["default"].number
|
|
217
220
|
};
|
|
218
221
|
var _default = DxcSwitch;
|
|
219
222
|
exports["default"] = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
value?: any;
|
|
13
|
+
label?: string;
|
|
14
|
+
labelPosition?: "before" | "after";
|
|
15
|
+
name?: string,
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
onChange?: void;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
margin?: Space | Margin;
|
|
20
|
+
size?: Size;
|
|
21
|
+
tabIndex?: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default function DxcSwitch(props: Props): JSX.Element;
|
package/dist/table/Table.js
CHANGED
|
@@ -13,16 +13,20 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var _react =
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
20
|
var _variables = require("../common/variables.js");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _utils = require("../common/utils.js");
|
|
23
|
+
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
25
|
+
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
23
27
|
|
|
24
28
|
function _templateObject2() {
|
|
25
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom:
|
|
29
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n }\n"]);
|
|
26
30
|
|
|
27
31
|
_templateObject2 = function _templateObject2() {
|
|
28
32
|
return data;
|
|
@@ -32,7 +36,7 @@ function _templateObject2() {
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
function _templateObject() {
|
|
35
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
39
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: hidden auto;\n &::-webkit-scrollbar {\n width: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"]);
|
|
36
40
|
|
|
37
41
|
_templateObject = function _templateObject() {
|
|
38
42
|
return data;
|
|
@@ -44,17 +48,23 @@ function _templateObject() {
|
|
|
44
48
|
var DxcTable = function DxcTable(_ref) {
|
|
45
49
|
var children = _ref.children,
|
|
46
50
|
margin = _ref.margin;
|
|
47
|
-
|
|
48
|
-
var colorsTheme = (0, _react.useContext)(_ThemeContext["default"]) || _variables.colors;
|
|
49
|
-
|
|
51
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
50
52
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
51
|
-
theme: colorsTheme
|
|
53
|
+
theme: colorsTheme.table
|
|
52
54
|
}, _react["default"].createElement(DxcTableContainer, {
|
|
53
55
|
margin: margin
|
|
54
|
-
}, _react["default"].createElement(DxcTableContent, null,
|
|
56
|
+
}, _react["default"].createElement(DxcTableContent, null, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
57
|
+
color: colorsTheme.table.dataBackgroundColor
|
|
58
|
+
}, children))));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var calculateWidth = function calculateWidth(margin) {
|
|
62
|
+
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
55
63
|
};
|
|
56
64
|
|
|
57
65
|
var DxcTableContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
66
|
+
return calculateWidth(props.margin);
|
|
67
|
+
}, function (props) {
|
|
58
68
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
59
69
|
}, function (props) {
|
|
60
70
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -65,19 +75,57 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject(), func
|
|
|
65
75
|
}, function (props) {
|
|
66
76
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
67
77
|
}, function (props) {
|
|
68
|
-
return props.theme.
|
|
78
|
+
return props.theme.scrollBarThumbColor;
|
|
69
79
|
}, function (props) {
|
|
70
|
-
return props.theme.
|
|
80
|
+
return props.theme.scrollBarTrackColor;
|
|
71
81
|
});
|
|
72
82
|
|
|
73
83
|
var DxcTableContent = _styledComponents["default"].table(_templateObject2(), function (props) {
|
|
74
|
-
return props.theme.
|
|
84
|
+
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
85
|
+
}, function (props) {
|
|
86
|
+
return props.theme.dataBackgroundColor;
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return props.theme.dataFontFamily;
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return props.theme.dataFontSize;
|
|
91
|
+
}, function (props) {
|
|
92
|
+
return props.theme.dataFontStyle;
|
|
93
|
+
}, function (props) {
|
|
94
|
+
return props.theme.dataFontWeight;
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return props.theme.dataFontColor;
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return props.theme.dataFontTextTransform;
|
|
99
|
+
}, function (props) {
|
|
100
|
+
return props.theme.dataTextAlign;
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return props.theme.dataTextLineHeight;
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.theme.headerBackgroundColor;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.headerFontFamily;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.theme.headerFontSize;
|
|
111
|
+
}, function (props) {
|
|
112
|
+
return props.theme.headerFontStyle;
|
|
113
|
+
}, function (props) {
|
|
114
|
+
return props.theme.headerFontWeight;
|
|
115
|
+
}, function (props) {
|
|
116
|
+
return props.theme.headerFontColor;
|
|
117
|
+
}, function (props) {
|
|
118
|
+
return props.theme.headerFontTextTransform;
|
|
119
|
+
}, function (props) {
|
|
120
|
+
return props.theme.headerTextAlign;
|
|
121
|
+
}, function (props) {
|
|
122
|
+
return props.theme.headerTextLineHeight;
|
|
75
123
|
}, function (props) {
|
|
76
|
-
return props.theme.
|
|
124
|
+
return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
|
|
77
125
|
}, function (props) {
|
|
78
|
-
return props.theme.
|
|
126
|
+
return props.theme.headerBorderRadius;
|
|
79
127
|
}, function (props) {
|
|
80
|
-
return props.theme.
|
|
128
|
+
return props.theme.headerBorderRadius;
|
|
81
129
|
});
|
|
82
130
|
|
|
83
131
|
var _default = DxcTable;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
margin?: Space | Margin;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function DxcTable(props: Props): JSX.Element;
|