@dxc-technology/halstack-react 0.0.0-d4fec82 → 0.0.0-d618bea
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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -3
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.js +2 -2
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.js +1 -1
- package/box/Box.d.ts +4 -0
- package/box/Box.js +6 -32
- package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -12
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +11 -11
- package/card/Card.js +5 -6
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +1 -23
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +44 -37
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +4 -7
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +6 -25
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/types.d.ts +1 -1
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +65 -76
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +8 -8
- package/footer/Footer.stories.tsx +151 -0
- package/footer/types.d.ts +22 -18
- package/header/Header.d.ts +7 -0
- package/header/Header.js +28 -30
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.js +2 -27
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/InputText.js +2 -2
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +8 -18
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +4 -26
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/list/List.d.ts +7 -0
- package/list/List.js +37 -0
- package/list/List.stories.tsx +70 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/paginator/Paginator.js +2 -8
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +19 -55
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.js +3 -3
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +4 -27
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +11 -0
- package/row/Row.js +124 -0
- package/row/Row.stories.tsx +223 -0
- package/select/Select.js +15 -17
- package/select/Select.stories.tsx +572 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +43 -32
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +2 -7
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +8 -25
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +94 -0
- package/stack/Stack.stories.tsx +150 -0
- package/switch/Switch.js +4 -4
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.js +4 -2
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +3 -4
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +21 -36
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +42 -81
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.js +29 -32
- package/textarea/index.d.ts +18 -8
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +8 -34
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +13 -53
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/box/index.d.ts +0 -25
- package/chip/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/file-input/index.d.ts +0 -81
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
- package/wizard/index.d.ts +0 -18
package/spinner/Spinner.js
CHANGED
|
@@ -13,19 +13,15 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
-
|
|
18
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
17
|
|
|
20
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
19
|
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
20
|
var _variables = require("../common/variables.js");
|
|
25
21
|
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
23
|
|
|
28
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
24
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
29
25
|
|
|
30
26
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
31
27
|
|
|
@@ -140,19 +136,6 @@ var determinatedValue = function determinatedValue(props, strokeDashArray) {
|
|
|
140
136
|
return val;
|
|
141
137
|
};
|
|
142
138
|
|
|
143
|
-
DxcSpinner.propTypes = {
|
|
144
|
-
label: _propTypes["default"].string,
|
|
145
|
-
value: _propTypes["default"].number,
|
|
146
|
-
showValue: _propTypes["default"].bool,
|
|
147
|
-
mode: _propTypes["default"].oneOf(["large", "small", "overlay"]),
|
|
148
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
149
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
150
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
151
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
152
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
153
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
154
|
-
};
|
|
155
|
-
|
|
156
139
|
var DXCSpinner = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n display: ", ";\n position: ", ";\n top: ", ";\n left: ", ";\n justify-content: ", ";\n align-items: ", ";\n z-index: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
157
140
|
return props.mode === "overlay" ? "100vh" : "";
|
|
158
141
|
}, function (props) {
|
|
@@ -172,15 +155,15 @@ var DXCSpinner = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
172
155
|
}, function (props) {
|
|
173
156
|
return props.mode === "overlay" ? 1300 : "";
|
|
174
157
|
}, function (props) {
|
|
175
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
158
|
+
return props.mode != "overlay" ? props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px" : "";
|
|
176
159
|
}, function (props) {
|
|
177
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
160
|
+
return props.mode != "overlay" ? props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "" : "";
|
|
178
161
|
}, function (props) {
|
|
179
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
162
|
+
return props.mode != "overlay" ? props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "" : "";
|
|
180
163
|
}, function (props) {
|
|
181
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
164
|
+
return props.mode != "overlay" ? props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "" : "";
|
|
182
165
|
}, function (props) {
|
|
183
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
166
|
+
return props.mode != "overlay" ? props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "" : "";
|
|
184
167
|
});
|
|
185
168
|
|
|
186
169
|
var SpinnerContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n align-items: center;\n display: flex;\n height: ", ";\n width: ", ";\n justify-content: center;\n position: relative;\n background-color: transparent;\n\n @keyframes spinner-svg {\n 0% {\n transform: rotateZ(0deg);\n }\n 100% {\n transform: rotateZ(360deg);\n }\n }\n @keyframes svg-circle-large {\n 0% {\n stroke-dashoffset: 400;\n transform: rotate(0);\n }\n\n 50% {\n stroke-dashoffset: 75;\n transform: rotate(45deg);\n }\n\n 100% {\n stroke-dashoffset: 400;\n transform: rotate(360deg);\n }\n }\n @keyframes svg-circle-small {\n 0% {\n stroke-dashoffset: 35;\n transform: rotate(0);\n }\n\n 50% {\n stroke-dashoffset: 8;\n transform: rotate(45deg);\n }\n\n 100% {\n stroke-dashoffset: 35;\n transform: rotate(360deg);\n }\n }\n"])), function (props) {
|
|
@@ -245,7 +228,7 @@ var SpinnerLabel = _styledComponents["default"].p(_templateObject11 || (_templat
|
|
|
245
228
|
return props.mode === "overlay" ? props.theme.overlayLabelLetterSpacing : props.theme.labelLetterSpacing;
|
|
246
229
|
});
|
|
247
230
|
|
|
248
|
-
var SpinnerProgress = _styledComponents["default"].p(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-style: ", ";\n
|
|
231
|
+
var SpinnerProgress = _styledComponents["default"].p(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n font-style: ", ";\n color: ", ";\n text-align: ", ";\n letter-spacing: ", ";\n"])), function (props) {
|
|
249
232
|
return props.value !== "" && props.showValue === true && "block" || "none";
|
|
250
233
|
}, function (props) {
|
|
251
234
|
return props.mode === "overlay" ? props.theme.overlayProgressValueFontFamily : props.theme.progressValueFontFamily;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcSpinner from "./Spinner";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Spinner",
|
|
8
|
+
component: DxcSpinner,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="With label" theme="light" level={4} />
|
|
15
|
+
<DxcSpinner label="Label" value="50"></DxcSpinner>
|
|
16
|
+
<Title title="With value label" theme="light" level={4} />
|
|
17
|
+
<DxcSpinner value="50" showValue></DxcSpinner>
|
|
18
|
+
<Title title="With label and value label" theme="light" level={4} />
|
|
19
|
+
<DxcSpinner label="Label" value="50" showValue></DxcSpinner>
|
|
20
|
+
<Title title="With 100%" theme="light" level={4} />
|
|
21
|
+
<DxcSpinner label="Label" value="100" showValue></DxcSpinner>
|
|
22
|
+
</ExampleContainer>
|
|
23
|
+
<Title title="Modes" theme="light" level={2} />
|
|
24
|
+
<ExampleContainer>
|
|
25
|
+
<Title title="Mode large" theme="light" level={4} />
|
|
26
|
+
<DxcSpinner mode="large" value="50"></DxcSpinner>
|
|
27
|
+
<Title title="Mode small" theme="light" level={4} />
|
|
28
|
+
<DxcSpinner mode="small" value="50"></DxcSpinner>
|
|
29
|
+
<Title title="Mode small with 100%" theme="light" level={4} />
|
|
30
|
+
<DxcSpinner mode="small" value="100" showValue></DxcSpinner>
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<Title title="Margins with large mode" theme="light" level={2} />
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
35
|
+
<DxcSpinner margin="xxsmall" value="75"></DxcSpinner>
|
|
36
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
37
|
+
<DxcSpinner margin="xsmall" value="75"></DxcSpinner>
|
|
38
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
39
|
+
<DxcSpinner margin="small" value="75"></DxcSpinner>
|
|
40
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
41
|
+
<DxcSpinner margin="medium" value="75"></DxcSpinner>
|
|
42
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
43
|
+
<DxcSpinner margin="large" value="75"></DxcSpinner>
|
|
44
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
45
|
+
<DxcSpinner margin="xlarge" value="75"></DxcSpinner>
|
|
46
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
47
|
+
<DxcSpinner margin="xxlarge" value="75"></DxcSpinner>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<Title title="Margins with small mode" theme="light" level={2} />
|
|
50
|
+
<ExampleContainer>
|
|
51
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
52
|
+
<DxcSpinner margin="xxsmall" mode="small" value="75"></DxcSpinner>
|
|
53
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
54
|
+
<DxcSpinner margin="xsmall" mode="small" value="75"></DxcSpinner>
|
|
55
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
56
|
+
<DxcSpinner margin="small" mode="small" value="75"></DxcSpinner>
|
|
57
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
58
|
+
<DxcSpinner margin="medium" mode="small" value="75"></DxcSpinner>
|
|
59
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
60
|
+
<DxcSpinner margin="large" mode="small" value="75"></DxcSpinner>
|
|
61
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
62
|
+
<DxcSpinner margin="xlarge" mode="small" value="75"></DxcSpinner>
|
|
63
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
64
|
+
<DxcSpinner margin="xxlarge" mode="small" value="75"></DxcSpinner>
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
export const SpinnerOverlay = () => (
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Mode overlay" theme="light" level={4} />
|
|
72
|
+
<DxcSpinner mode="overlay" value="25"></DxcSpinner>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export const SpinnerOverlayWith100 = () => (
|
|
77
|
+
<ExampleContainer>
|
|
78
|
+
<Title title="Mode overlay" theme="light" level={4} />
|
|
79
|
+
<DxcSpinner mode="overlay" value="100"></DxcSpinner>
|
|
80
|
+
</ExampleContainer>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export const SpinnerOverlayWithLabel = () => (
|
|
84
|
+
<ExampleContainer>
|
|
85
|
+
<Title title="Mode overlay" theme="light" level={4} />
|
|
86
|
+
<DxcSpinner mode="overlay" value="50" label="Label"></DxcSpinner>
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
export const SpinnerOverlayWithValue = () => (
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="Mode overlay" theme="light" level={4} />
|
|
93
|
+
<DxcSpinner mode="overlay" value="50" showValue></DxcSpinner>
|
|
94
|
+
</ExampleContainer>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export const SpinnerOverlayWithValueAndLabel = () => (
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Mode overlay" theme="light" level={4} />
|
|
100
|
+
<DxcSpinner mode="overlay" label="Label" value="50" showValue></DxcSpinner>
|
|
101
|
+
</ExampleContainer>
|
|
102
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Text to be placed inside the spinner.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The value of the progress indicator. If it's received the
|
|
15
|
+
* component is determinate, otherwise is indeterminate.
|
|
16
|
+
*/
|
|
17
|
+
value?: number;
|
|
18
|
+
/**
|
|
19
|
+
* If true, the value is displayed inside the spinner..
|
|
20
|
+
*/
|
|
21
|
+
showValue?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Available modes of the spinner.
|
|
24
|
+
*/
|
|
25
|
+
mode?: "large" | "small" | "overlay";
|
|
26
|
+
/**
|
|
27
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
28
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
29
|
+
*/
|
|
30
|
+
margin?: Space | Margin;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
package/spinner/types.js
ADDED
package/stack/Stack.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type StackProps = {
|
|
3
|
+
gutter?: "none" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
4
|
+
divider?: boolean;
|
|
5
|
+
align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
6
|
+
as?: React.ElementType;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export default function Stack({ gutter, divider, align, as, children }: StackProps): JSX.Element;
|
|
10
|
+
export {};
|
package/stack/Stack.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = Stack;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
|
+
|
|
18
|
+
function Stack(_ref) {
|
|
19
|
+
var gutter = _ref.gutter,
|
|
20
|
+
divider = _ref.divider,
|
|
21
|
+
align = _ref.align,
|
|
22
|
+
_ref$as = _ref.as,
|
|
23
|
+
as = _ref$as === void 0 ? "div" : _ref$as,
|
|
24
|
+
children = _ref.children;
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(StyledStack, {
|
|
26
|
+
gutter: gutter,
|
|
27
|
+
divider: divider,
|
|
28
|
+
align: align,
|
|
29
|
+
as: as
|
|
30
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
31
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var Divider = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n height: 1px;\n background-color: #999999;\n"])));
|
|
36
|
+
|
|
37
|
+
var StyledStack = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: ", "};\n gap: ", ";\n margin: 0;\n padding: 0;\n"])), function (_ref2) {
|
|
38
|
+
var align = _ref2.align;
|
|
39
|
+
|
|
40
|
+
switch (align) {
|
|
41
|
+
case "start":
|
|
42
|
+
return "flex-start";
|
|
43
|
+
|
|
44
|
+
case "center":
|
|
45
|
+
return "center";
|
|
46
|
+
|
|
47
|
+
case "end":
|
|
48
|
+
return "flex-end";
|
|
49
|
+
|
|
50
|
+
case "baseline":
|
|
51
|
+
return "baseline";
|
|
52
|
+
|
|
53
|
+
case "stretch":
|
|
54
|
+
return "stretch";
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
return "initial";
|
|
58
|
+
}
|
|
59
|
+
}, function (_ref3) {
|
|
60
|
+
var gutter = _ref3.gutter,
|
|
61
|
+
divider = _ref3.divider;
|
|
62
|
+
|
|
63
|
+
switch (gutter) {
|
|
64
|
+
case "none":
|
|
65
|
+
return "0";
|
|
66
|
+
|
|
67
|
+
case "xxsmall":
|
|
68
|
+
return "calc(0.125rem / ".concat(divider ? 2 : 1, ")");
|
|
69
|
+
|
|
70
|
+
case "xsmall":
|
|
71
|
+
return "calc(0.25rem / ".concat(divider ? 2 : 1, ")");
|
|
72
|
+
|
|
73
|
+
case "small":
|
|
74
|
+
return "calc(0.5rem / ".concat(divider ? 2 : 1, ")");
|
|
75
|
+
|
|
76
|
+
case "medium":
|
|
77
|
+
return "calc(1rem / ".concat(divider ? 2 : 1, ")");
|
|
78
|
+
|
|
79
|
+
case "large":
|
|
80
|
+
return "calc(1.5rem / ".concat(divider ? 2 : 1, ")");
|
|
81
|
+
|
|
82
|
+
case "xlarge":
|
|
83
|
+
return "calc(2rem / ".concat(divider ? 2 : 1, ")");
|
|
84
|
+
|
|
85
|
+
case "xxlarge":
|
|
86
|
+
return "calc(3rem / ".concat(divider ? 2 : 1, ")");
|
|
87
|
+
|
|
88
|
+
case "xxxlarge":
|
|
89
|
+
return "calc(4rem / ".concat(divider ? 2 : 1, ")");
|
|
90
|
+
|
|
91
|
+
default:
|
|
92
|
+
return "0";
|
|
93
|
+
}
|
|
94
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcStack from "./Stack";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Stack",
|
|
8
|
+
component: DxcStack,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" theme="light" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcStack>
|
|
16
|
+
<Placeholder></Placeholder>
|
|
17
|
+
<Placeholder></Placeholder>
|
|
18
|
+
<Placeholder></Placeholder>
|
|
19
|
+
</DxcStack>
|
|
20
|
+
</Container>
|
|
21
|
+
<Title title="Align = baseline" theme="light" level={4} />
|
|
22
|
+
<Container>
|
|
23
|
+
<DxcStack align="baseline">
|
|
24
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
25
|
+
<Placeholder></Placeholder>
|
|
26
|
+
<Placeholder paddingRight={60}></Placeholder>
|
|
27
|
+
</DxcStack>
|
|
28
|
+
</Container>
|
|
29
|
+
<Title title="Align = center" theme="light" level={4} />
|
|
30
|
+
<Container>
|
|
31
|
+
<DxcStack align="center">
|
|
32
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
33
|
+
<Placeholder></Placeholder>
|
|
34
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
35
|
+
</DxcStack>
|
|
36
|
+
</Container>
|
|
37
|
+
<Title title="Align = end" theme="light" level={4} />
|
|
38
|
+
<Container>
|
|
39
|
+
<DxcStack align="end">
|
|
40
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
41
|
+
<Placeholder></Placeholder>
|
|
42
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
43
|
+
</DxcStack>
|
|
44
|
+
</Container>
|
|
45
|
+
<Title title="Align = start" theme="light" level={4} />
|
|
46
|
+
<Container>
|
|
47
|
+
<DxcStack align="start">
|
|
48
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
49
|
+
<Placeholder></Placeholder>
|
|
50
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
51
|
+
</DxcStack>
|
|
52
|
+
</Container>
|
|
53
|
+
<Title title="Align = stretch" theme="light" level={4} />
|
|
54
|
+
<Container>
|
|
55
|
+
<DxcStack align="stretch">
|
|
56
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
57
|
+
<Placeholder></Placeholder>
|
|
58
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
59
|
+
</DxcStack>
|
|
60
|
+
</Container>
|
|
61
|
+
<Title title="gutter = xxsmall" theme="light" level={4} />
|
|
62
|
+
<Container>
|
|
63
|
+
<DxcStack gutter="xxsmall">
|
|
64
|
+
<Placeholder></Placeholder>
|
|
65
|
+
<Placeholder></Placeholder>
|
|
66
|
+
<Placeholder></Placeholder>
|
|
67
|
+
</DxcStack>
|
|
68
|
+
</Container>
|
|
69
|
+
<Title title="gutter = xsmall" theme="light" level={4} />
|
|
70
|
+
<Container>
|
|
71
|
+
<DxcStack gutter="xsmall">
|
|
72
|
+
<Placeholder></Placeholder>
|
|
73
|
+
<Placeholder></Placeholder>
|
|
74
|
+
<Placeholder></Placeholder>
|
|
75
|
+
</DxcStack>
|
|
76
|
+
</Container>
|
|
77
|
+
<Title title="gutter = small" theme="light" level={4} />
|
|
78
|
+
<Container>
|
|
79
|
+
<DxcStack gutter="small">
|
|
80
|
+
<Placeholder></Placeholder>
|
|
81
|
+
<Placeholder></Placeholder>
|
|
82
|
+
<Placeholder></Placeholder>
|
|
83
|
+
</DxcStack>
|
|
84
|
+
</Container>
|
|
85
|
+
<Title title="gutter = medium" theme="light" level={4} />
|
|
86
|
+
<Container>
|
|
87
|
+
<DxcStack gutter="medium">
|
|
88
|
+
<Placeholder></Placeholder>
|
|
89
|
+
<Placeholder></Placeholder>
|
|
90
|
+
<Placeholder></Placeholder>
|
|
91
|
+
</DxcStack>
|
|
92
|
+
</Container>
|
|
93
|
+
<Title title="gutter = large" theme="light" level={4} />
|
|
94
|
+
<Container>
|
|
95
|
+
<DxcStack gutter="large">
|
|
96
|
+
<Placeholder></Placeholder>
|
|
97
|
+
<Placeholder></Placeholder>
|
|
98
|
+
<Placeholder></Placeholder>
|
|
99
|
+
</DxcStack>
|
|
100
|
+
</Container>
|
|
101
|
+
<Title title="gutter = xlarge" theme="light" level={4} />
|
|
102
|
+
<Container>
|
|
103
|
+
<DxcStack gutter="xlarge">
|
|
104
|
+
<Placeholder></Placeholder>
|
|
105
|
+
<Placeholder></Placeholder>
|
|
106
|
+
<Placeholder></Placeholder>
|
|
107
|
+
</DxcStack>
|
|
108
|
+
</Container>
|
|
109
|
+
<Title title="gutter = xxlarge" theme="light" level={4} />
|
|
110
|
+
<Container>
|
|
111
|
+
<DxcStack gutter="xxlarge">
|
|
112
|
+
<Placeholder></Placeholder>
|
|
113
|
+
<Placeholder></Placeholder>
|
|
114
|
+
<Placeholder></Placeholder>
|
|
115
|
+
</DxcStack>
|
|
116
|
+
</Container>
|
|
117
|
+
<Title title="gutter = xxlarge && divider" theme="light" level={4} />
|
|
118
|
+
<Container>
|
|
119
|
+
<DxcStack gutter="xxlarge" divider>
|
|
120
|
+
<Placeholder></Placeholder>
|
|
121
|
+
<Placeholder></Placeholder>
|
|
122
|
+
<Placeholder></Placeholder>
|
|
123
|
+
</DxcStack>
|
|
124
|
+
</Container>
|
|
125
|
+
<Title title="gutter = none" theme="light" level={4} />
|
|
126
|
+
<Container>
|
|
127
|
+
<DxcStack gutter="none">
|
|
128
|
+
<Placeholder></Placeholder>
|
|
129
|
+
<Placeholder></Placeholder>
|
|
130
|
+
<Placeholder></Placeholder>
|
|
131
|
+
</DxcStack>
|
|
132
|
+
</Container>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const Container = styled.div`
|
|
137
|
+
background: #d0d0d0;
|
|
138
|
+
padding: 10px;
|
|
139
|
+
border-radius: 10px;
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
const Placeholder = styled.div`
|
|
143
|
+
min-height: 80px;
|
|
144
|
+
min-width: 120px;
|
|
145
|
+
border: 1px solid #fabada;
|
|
146
|
+
background-color: #fff7fb;
|
|
147
|
+
border-radius: 5px;
|
|
148
|
+
padding-left: ${({ paddingLeft }) => `${paddingLeft ?? 0}px`};
|
|
149
|
+
padding-right: ${({ paddingRight }) => `${paddingRight ?? 0}px`};
|
|
150
|
+
`;
|
package/switch/Switch.js
CHANGED
|
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _utils = require("../common/utils.js");
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
34
|
var _templateObject, _templateObject2;
|
|
35
35
|
|
|
@@ -113,7 +113,7 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
113
113
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (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\n .MuiSwitch-root {\n align-items: center;\n width: ", ";\n height: 45px;\n margin: 3px;\n\n .Mui-focusVisible {\n
|
|
116
|
+
var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n \n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n .MuiSwitch-root {\n align-items: center;\n width: ", ";\n height: 45px;\n margin: 3px;\n\n .Mui-focusVisible {\n outline: ", ";\n outline-offset: -3px;\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"])), function (props) {
|
|
117
117
|
return calculateWidth(props.margin, props.size);
|
|
118
118
|
}, function (props) {
|
|
119
119
|
return props.labelPosition === "after" ? "row" : "row-reverse";
|
|
@@ -159,7 +159,7 @@ var SwitchContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
159
159
|
return props.backgroundType === "dark" ? props.theme.checkedTrackBackgroundColorOnDark : props.theme.checkedTrackBackgroundColor;
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n cursor: ", ";\n ", "\n"])), function (props) {
|
|
162
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n cursor: ", ";\n ", "\n"])), function (props) {
|
|
163
163
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
164
164
|
}, function (props) {
|
|
165
165
|
return props.theme.labelFontFamily;
|