@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-9005464
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/accordion/types.d.ts +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/alert/Alert.stories.tsx +170 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +9 -32
- package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
- package/box/types.d.ts +47 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -12
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +10 -10
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/common/variables.js +29 -21
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +4 -23
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/footer/Footer.stories.jsx +151 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +26 -28
- package/header/Icons.js +2 -27
- package/header/types.d.ts +45 -0
- package/header/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +1 -23
- package/link/Link.stories.tsx +70 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +2 -44
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +0 -37
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +100 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/radio/Radio.stories.tsx +192 -0
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +2 -2
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +4 -13
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +39 -28
- package/slider/Slider.stories.tsx +172 -0
- package/slider/types.d.ts +2 -7
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +6 -23
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +20 -35
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/index.d.ts +2 -2
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +11 -51
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/box/index.d.ts +0 -25
- package/dialog/index.d.ts +0 -18
- package/header/index.d.ts +0 -25
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- 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/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Padding = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
export declare type SidenavLinkPropsType = {
|
|
10
|
+
/**
|
|
11
|
+
* Value of the tabindex.
|
|
12
|
+
*/
|
|
13
|
+
tabIndex?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Page to be opened when the user clicks on the link.
|
|
16
|
+
*/
|
|
17
|
+
href?: string;
|
|
18
|
+
/**
|
|
19
|
+
* This function will be called when the user clicks the link.
|
|
20
|
+
*/
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* The area inside the sidenav link. This area can be used to render custom content.
|
|
24
|
+
*/
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare type SidenavTitlePropsType = {
|
|
28
|
+
/**
|
|
29
|
+
* The area inside the sidenav title. This area can be used to render custom content.
|
|
30
|
+
*/
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export declare type SidenavSubtitlePropsType = {
|
|
34
|
+
/**
|
|
35
|
+
* The area inside the sidenav subtitle. This area can be used to render custom content.
|
|
36
|
+
*/
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
declare type SidenavPropsType = {
|
|
40
|
+
/**
|
|
41
|
+
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
42
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
43
|
+
*/
|
|
44
|
+
padding?: Space | Padding;
|
|
45
|
+
/**
|
|
46
|
+
* The area inside the sidenav. This area can be used to render custom content.
|
|
47
|
+
*/
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
export default SidenavPropsType;
|
package/sidenav/types.js
ADDED
package/slider/Slider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import SliderPropsType from "./types";
|
|
3
|
-
declare const DxcSlider: ({ label, name, value, helperText, minValue, maxValue, step, showLimitsValues, showInput, disabled, marks, onChange, onDragEnd, labelFormatCallback, margin, size,
|
|
3
|
+
declare const DxcSlider: ({ label, name, value, helperText, minValue, maxValue, step, showLimitsValues, showInput, disabled, marks, onChange, onDragEnd, labelFormatCallback, margin, size, }: SliderPropsType) => JSX.Element;
|
|
4
4
|
export default DxcSlider;
|
package/slider/Slider.js
CHANGED
|
@@ -31,6 +31,8 @@ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
|
31
31
|
|
|
32
32
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
33
33
|
|
|
34
|
+
var _uuid = require("uuid");
|
|
35
|
+
|
|
34
36
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
35
37
|
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -64,9 +66,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
64
66
|
labelFormatCallback = _ref.labelFormatCallback,
|
|
65
67
|
margin = _ref.margin,
|
|
66
68
|
_ref$size = _ref.size,
|
|
67
|
-
size = _ref$size === void 0 ? "fillParent" : _ref$size
|
|
68
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
69
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
69
|
+
size = _ref$size === void 0 ? "fillParent" : _ref$size;
|
|
70
70
|
|
|
71
71
|
var _useState = (0, _react.useState)(0),
|
|
72
72
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -75,6 +75,11 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
75
75
|
|
|
76
76
|
var colorsTheme = (0, _useTheme["default"])();
|
|
77
77
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
78
|
+
|
|
79
|
+
var _useState3 = (0, _react.useState)("label-".concat((0, _uuid.v4)())),
|
|
80
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
81
|
+
labelId = _useState4[0];
|
|
82
|
+
|
|
78
83
|
var minLabel = (0, _react.useMemo)(function () {
|
|
79
84
|
return labelFormatCallback ? labelFormatCallback(minValue) : minValue;
|
|
80
85
|
}, [labelFormatCallback, minValue]);
|
|
@@ -109,7 +114,14 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
109
114
|
}, /*#__PURE__*/_react["default"].createElement(Container, {
|
|
110
115
|
margin: margin,
|
|
111
116
|
size: size
|
|
112
|
-
}, /*#__PURE__*/_react["default"].createElement(Label,
|
|
117
|
+
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
118
|
+
id: labelId,
|
|
119
|
+
disabled: disabled,
|
|
120
|
+
backgroundType: backgroundType
|
|
121
|
+
}, label), /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
122
|
+
disabled: disabled,
|
|
123
|
+
backgroundType: backgroundType
|
|
124
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(SliderContainer, {
|
|
113
125
|
backgroundType: backgroundType
|
|
114
126
|
}, showLimitsValues && /*#__PURE__*/_react["default"].createElement(MinLabelContainer, {
|
|
115
127
|
backgroundType: backgroundType,
|
|
@@ -123,7 +135,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
123
135
|
step: step,
|
|
124
136
|
marks: marks || [],
|
|
125
137
|
disabled: disabled,
|
|
126
|
-
|
|
138
|
+
"aria-labelledby": labelId
|
|
127
139
|
}), showLimitsValues && /*#__PURE__*/_react["default"].createElement(MaxLabelContainer, {
|
|
128
140
|
backgroundType: backgroundType,
|
|
129
141
|
disabled: disabled,
|
|
@@ -133,8 +145,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
133
145
|
value: value != null && value >= 0 && value || innerValue,
|
|
134
146
|
disabled: disabled,
|
|
135
147
|
onChange: handlerInputChange,
|
|
136
|
-
size: "fillParent"
|
|
137
|
-
tabIndex: tabIndex
|
|
148
|
+
size: "fillParent"
|
|
138
149
|
})))));
|
|
139
150
|
};
|
|
140
151
|
|
|
@@ -162,10 +173,10 @@ var Container = _styledComponents["default"].div(_templateObject || (_templateOb
|
|
|
162
173
|
return calculateWidth(props.margin, props.size);
|
|
163
174
|
});
|
|
164
175
|
|
|
165
|
-
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
166
|
-
return props.theme.labelFontColor;
|
|
176
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
177
|
+
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
167
178
|
}, function (props) {
|
|
168
|
-
return props.theme.
|
|
179
|
+
return props.theme.fontFamily;
|
|
169
180
|
}, function (props) {
|
|
170
181
|
return props.theme.labelFontSize;
|
|
171
182
|
}, function (props) {
|
|
@@ -176,14 +187,14 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
176
187
|
return props.theme.labelLineHeight;
|
|
177
188
|
});
|
|
178
189
|
|
|
179
|
-
var HelperText = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
180
|
-
return props.theme.helperTextFontColor;
|
|
190
|
+
var HelperText = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
191
|
+
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
181
192
|
}, function (props) {
|
|
182
|
-
return props.theme.
|
|
193
|
+
return props.theme.fontFamily;
|
|
183
194
|
}, function (props) {
|
|
184
195
|
return props.theme.helperTextFontSize;
|
|
185
196
|
}, function (props) {
|
|
186
|
-
return props.theme.
|
|
197
|
+
return props.theme.helperTextFontStyle;
|
|
187
198
|
}, function (props) {
|
|
188
199
|
return props.theme.helperTextFontWeight;
|
|
189
200
|
}, function (props) {
|
|
@@ -266,34 +277,34 @@ var SliderContainer = _styledComponents["default"].div(_templateObject4 || (_tem
|
|
|
266
277
|
return props.theme.tickVerticalPosition;
|
|
267
278
|
});
|
|
268
279
|
|
|
269
|
-
var MinLabelContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
270
|
-
return props.theme.
|
|
280
|
+
var MinLabelContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
281
|
+
return props.disabled ? props.theme.disabledLimitValuesFontColor : props.backgroundType === "dark" ? props.theme.limitValuesFontColorOnDark : props.theme.limitValuesFontColor;
|
|
271
282
|
}, function (props) {
|
|
272
|
-
return props.theme.
|
|
283
|
+
return props.theme.fontFamily;
|
|
273
284
|
}, function (props) {
|
|
274
|
-
return props.theme.
|
|
285
|
+
return props.theme.limitValuesFontSize;
|
|
275
286
|
}, function (props) {
|
|
276
|
-
return props.theme.
|
|
287
|
+
return props.theme.limitValuesFontStyle;
|
|
277
288
|
}, function (props) {
|
|
278
|
-
return props.
|
|
289
|
+
return props.theme.limitValuesFontWeight;
|
|
279
290
|
}, function (props) {
|
|
280
|
-
return props.theme.
|
|
291
|
+
return props.theme.limitValuesFontLetterSpacing;
|
|
281
292
|
}, function (props) {
|
|
282
293
|
return props.theme.floorLabelMarginRight;
|
|
283
294
|
});
|
|
284
295
|
|
|
285
|
-
var MaxLabelContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
286
|
-
return props.theme.
|
|
296
|
+
var MaxLabelContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
297
|
+
return props.disabled ? props.theme.disabledLimitValuesFontColor : props.backgroundType === "dark" ? props.theme.limitValuesFontColorOnDark : props.theme.limitValuesFontColor;
|
|
287
298
|
}, function (props) {
|
|
288
|
-
return props.theme.
|
|
299
|
+
return props.theme.fontFamily;
|
|
289
300
|
}, function (props) {
|
|
290
|
-
return props.theme.
|
|
301
|
+
return props.theme.limitValuesFontSize;
|
|
291
302
|
}, function (props) {
|
|
292
|
-
return props.theme.
|
|
303
|
+
return props.theme.limitValuesFontStyle;
|
|
293
304
|
}, function (props) {
|
|
294
|
-
return props.
|
|
305
|
+
return props.theme.limitValuesFontWeight;
|
|
295
306
|
}, function (props) {
|
|
296
|
-
return props.theme.
|
|
307
|
+
return props.theme.limitValuesFontLetterSpacing;
|
|
297
308
|
}, function (props) {
|
|
298
309
|
return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
|
|
299
310
|
});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcSlider from "./Slider";
|
|
3
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Slider",
|
|
11
|
+
component: DxcSlider,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Chromatic = () => (
|
|
15
|
+
<>
|
|
16
|
+
<Title title="States" theme="light" level={2} />
|
|
17
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
18
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
19
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
22
|
+
<Title title="Active" theme="light" level={4} />
|
|
23
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
26
|
+
<Title title="Focused" theme="light" level={4} />
|
|
27
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
31
|
+
<DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Disabled discrete slider with input" theme="light" level={4} />
|
|
35
|
+
<DxcSlider
|
|
36
|
+
label="Slider"
|
|
37
|
+
helperText="Help message"
|
|
38
|
+
disabled
|
|
39
|
+
value={40}
|
|
40
|
+
minValue={0}
|
|
41
|
+
maxValue={50}
|
|
42
|
+
showLimitsValues
|
|
43
|
+
showInput
|
|
44
|
+
marks
|
|
45
|
+
step={10}
|
|
46
|
+
/>
|
|
47
|
+
</ExampleContainer>
|
|
48
|
+
<Title title="Variants" theme="light" level={2} />
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Continuous slider" theme="light" level={4} />
|
|
51
|
+
<DxcSlider value={65} label="Slider" helperText="Help message" showLimitsValues />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Discrete slider" theme="light" level={4} />
|
|
55
|
+
<DxcSlider value={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
|
|
56
|
+
</ExampleContainer>
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<Title title="Discrete slider with input" theme="light" level={4} />
|
|
59
|
+
<DxcSlider
|
|
60
|
+
value={20}
|
|
61
|
+
minValue={0}
|
|
62
|
+
maxValue={50}
|
|
63
|
+
label="Slider"
|
|
64
|
+
helperText="Help message"
|
|
65
|
+
showLimitsValues
|
|
66
|
+
showInput
|
|
67
|
+
marks
|
|
68
|
+
step={10}
|
|
69
|
+
/>
|
|
70
|
+
</ExampleContainer>
|
|
71
|
+
<BackgroundColorProvider color="#333333">
|
|
72
|
+
<DarkContainer>
|
|
73
|
+
<Title title="Dark" theme="dark" level={2} />
|
|
74
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
75
|
+
<Title title="Hovered" theme="dark" level={4} />
|
|
76
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
79
|
+
<Title title="Active" theme="dark" level={4} />
|
|
80
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
83
|
+
<Title title="Focused" theme="dark" level={4} />
|
|
84
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Disabled" theme="dark" level={4} />
|
|
88
|
+
<DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Disabled discrete slider with input" theme="dark" level={4} />
|
|
92
|
+
<DxcSlider
|
|
93
|
+
label="Slider"
|
|
94
|
+
helperText="Help message"
|
|
95
|
+
disabled
|
|
96
|
+
value={40}
|
|
97
|
+
minValue={0}
|
|
98
|
+
maxValue={50}
|
|
99
|
+
showLimitsValues
|
|
100
|
+
showInput
|
|
101
|
+
marks
|
|
102
|
+
step={5}
|
|
103
|
+
/>
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
<ExampleContainer>
|
|
106
|
+
<Title title="Continuous slider" theme="dark" level={4} />
|
|
107
|
+
<DxcSlider value={65} label="Slider" helperText="Help message" showLimitsValues />
|
|
108
|
+
</ExampleContainer>
|
|
109
|
+
<ExampleContainer>
|
|
110
|
+
<Title title="Discrete slider" theme="dark" level={4} />
|
|
111
|
+
<DxcSlider value={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
|
|
112
|
+
</ExampleContainer>
|
|
113
|
+
<ExampleContainer>
|
|
114
|
+
<Title title="Discrete slider with input" theme="dark" level={4} />
|
|
115
|
+
<DxcSlider
|
|
116
|
+
value={20}
|
|
117
|
+
minValue={0}
|
|
118
|
+
maxValue={50}
|
|
119
|
+
label="Slider"
|
|
120
|
+
helperText="Help message"
|
|
121
|
+
showLimitsValues
|
|
122
|
+
showInput
|
|
123
|
+
marks
|
|
124
|
+
step={10}
|
|
125
|
+
/>
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
</DarkContainer>
|
|
128
|
+
</BackgroundColorProvider>
|
|
129
|
+
<Title title="Margins" theme="light" level={2} />
|
|
130
|
+
<ExampleContainer>
|
|
131
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
132
|
+
<DxcSlider label="Xxsmall" margin="xxsmall" />
|
|
133
|
+
</ExampleContainer>
|
|
134
|
+
<ExampleContainer>
|
|
135
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
136
|
+
<DxcSlider label="Xsmall" margin="xsmall" />
|
|
137
|
+
</ExampleContainer>
|
|
138
|
+
<ExampleContainer>
|
|
139
|
+
<Title title="Small" theme="light" level={4} />
|
|
140
|
+
<DxcSlider label="Small" margin="small" />
|
|
141
|
+
</ExampleContainer>
|
|
142
|
+
<ExampleContainer>
|
|
143
|
+
<Title title="Medium" theme="light" level={4} />
|
|
144
|
+
<DxcSlider label="Medium" margin="medium" />
|
|
145
|
+
</ExampleContainer>
|
|
146
|
+
<ExampleContainer>
|
|
147
|
+
<Title title="Large" theme="light" level={4} />
|
|
148
|
+
<DxcSlider label="Large" margin="large" />
|
|
149
|
+
</ExampleContainer>
|
|
150
|
+
<ExampleContainer>
|
|
151
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
152
|
+
<DxcSlider label="Xlarge" margin="xlarge" />
|
|
153
|
+
</ExampleContainer>
|
|
154
|
+
<ExampleContainer>
|
|
155
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
156
|
+
<DxcSlider label="Xxlarge" margin="xxlarge" />
|
|
157
|
+
</ExampleContainer>
|
|
158
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
159
|
+
<ExampleContainer>
|
|
160
|
+
<Title title="Medium" theme="light" level={4} />
|
|
161
|
+
<DxcSlider label="Medium" size="medium" />
|
|
162
|
+
</ExampleContainer>
|
|
163
|
+
<ExampleContainer>
|
|
164
|
+
<Title title="Large" theme="light" level={4} />
|
|
165
|
+
<DxcSlider label="Large" size="large" />
|
|
166
|
+
</ExampleContainer>
|
|
167
|
+
<ExampleContainer>
|
|
168
|
+
<Title title="FillParent" theme="light" level={4} />
|
|
169
|
+
<DxcSlider label="FillParent" size="fillParent" />
|
|
170
|
+
</ExampleContainer>
|
|
171
|
+
</>
|
|
172
|
+
);
|
package/slider/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare type Size = "medium" | "large" | "fillParent";
|
|
2
1
|
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
2
|
declare type Margin = {
|
|
4
3
|
top?: Space;
|
|
@@ -65,7 +64,7 @@ declare type Props = {
|
|
|
65
64
|
* This function will be used to format the labels displayed next to the slider.
|
|
66
65
|
* The value will be passed as parameter and the function must return the formatted value.
|
|
67
66
|
*/
|
|
68
|
-
labelFormatCallback?: (value: number) =>
|
|
67
|
+
labelFormatCallback?: (value: number) => string;
|
|
69
68
|
/**
|
|
70
69
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
71
70
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
@@ -74,10 +73,6 @@ declare type Props = {
|
|
|
74
73
|
/**
|
|
75
74
|
* Size of the component.
|
|
76
75
|
*/
|
|
77
|
-
size?:
|
|
78
|
-
/**
|
|
79
|
-
* Value of the tabindex attribute.
|
|
80
|
-
*/
|
|
81
|
-
tabIndex?: number;
|
|
76
|
+
size?: "medium" | "large" | "fillParent";
|
|
82
77
|
};
|
|
83
78
|
export default Props;
|
package/spinner/Spinner.js
CHANGED
|
@@ -13,14 +13,10 @@ 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
22
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
@@ -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;
|