@dxc-technology/halstack-react 0.0.0-d5ae9d7 → 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.d.ts +2 -2
- package/accordion/Accordion.js +2 -2
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +59 -73
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -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.tsx +132 -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.d.ts +4 -0
- package/card/Card.js +17 -53
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +3 -4
- 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 +45 -38
- 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.d.ts +4 -0
- package/dropdown/Dropdown.js +8 -41
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- 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 +4 -0
- package/footer/Footer.js +11 -42
- package/footer/Footer.stories.tsx +151 -0
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- 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.tsx +115 -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.d.ts +4 -0
- package/progress-bar/ProgressBar.js +5 -23
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -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/select/index.d.ts +4 -4
- 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 +4 -0
- package/slider/Slider.js +61 -84
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- 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.d.ts +4 -0
- package/tabs/Tabs.js +9 -55
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- 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/Textarea.stories.jsx +135 -0
- 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/accordion-group/index.d.ts +0 -16
- package/box/index.d.ts +0 -25
- package/card/index.d.ts +0 -22
- package/chip/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- 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/progress-bar/index.d.ts +0 -18
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- 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/chip/Chip.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
13
|
|
|
16
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -19,13 +17,11 @@ var _react = _interopRequireDefault(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 _utils = require("../common/utils.js");
|
|
27
23
|
|
|
28
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
25
|
|
|
30
26
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
31
27
|
|
|
@@ -199,23 +195,5 @@ var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templ
|
|
|
199
195
|
return props.disabled && "outline: none;";
|
|
200
196
|
});
|
|
201
197
|
|
|
202
|
-
DxcChip.propTypes = {
|
|
203
|
-
label: _propTypes["default"].string,
|
|
204
|
-
disabled: _propTypes["default"].bool,
|
|
205
|
-
theme: _propTypes["default"].oneOf(["dark", "light"]),
|
|
206
|
-
suffixIcon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
207
|
-
prefixIcon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
208
|
-
suffixIconSrc: _propTypes["default"].string,
|
|
209
|
-
prefixIconSrc: _propTypes["default"].string,
|
|
210
|
-
onClickSuffix: _propTypes["default"].func,
|
|
211
|
-
onClickPrefix: _propTypes["default"].func,
|
|
212
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
213
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
214
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
215
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
216
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
217
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
218
|
-
tabIndex: _propTypes["default"].number
|
|
219
|
-
};
|
|
220
198
|
var _default = DxcChip;
|
|
221
199
|
exports["default"] = _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcChip from "./Chip";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Chip",
|
|
9
|
+
component: DxcChip,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconSVG = () => {
|
|
13
|
+
return (
|
|
14
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
15
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
16
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Chromatic = () => (
|
|
22
|
+
<>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Basic chip" theme="light" level={4} />
|
|
25
|
+
<DxcChip label="Default Chip" />
|
|
26
|
+
</ExampleContainer>
|
|
27
|
+
<ExampleContainer>
|
|
28
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
29
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} />
|
|
30
|
+
</ExampleContainer>
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
33
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="Chip with prefix and suffix" theme="light" level={4} />
|
|
37
|
+
<DxcChip label="Chip with prefix and suffix" prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Disabled chip" theme="light" level={4} />
|
|
41
|
+
<DxcChip label="Disabled" disabled prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Chip with ellipsis" theme="light" level={4} />
|
|
45
|
+
<DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Chip with ellipsis and suffix" theme="light" level={4} />
|
|
49
|
+
<DxcChip
|
|
50
|
+
suffixIcon={iconSVG}
|
|
51
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
52
|
+
/>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Chip with ellipsis and prefix" theme="light" level={4} />
|
|
56
|
+
<DxcChip
|
|
57
|
+
prefixIcon={iconSVG}
|
|
58
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
59
|
+
/>
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
|
|
63
|
+
<DxcChip
|
|
64
|
+
prefixIcon={iconSVG}
|
|
65
|
+
suffixIcon={iconSVG}
|
|
66
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
|
|
67
|
+
/>
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<Title title="Margins" theme="light" level={2} />
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
72
|
+
<DxcChip label="xxsmall" margin="xxsmall" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcChip label="xsmall" margin="xsmall" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
80
|
+
<DxcChip label="small" margin="small" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
84
|
+
<DxcChip label="medium" margin="medium" />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
88
|
+
<DxcChip label="large" margin="large" />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
92
|
+
<DxcChip label="xlarge" margin="xlarge" />
|
|
93
|
+
</ExampleContainer>
|
|
94
|
+
<ExampleContainer>
|
|
95
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
96
|
+
<DxcChip label="xxlarge" margin="xxlarge" />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
const ChipPrefixFocused = () => (
|
|
101
|
+
<ExampleContainer>
|
|
102
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
103
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
);
|
|
106
|
+
const ChipSuffixFocused = () => (
|
|
107
|
+
<ExampleContainer>
|
|
108
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
109
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} onClickSuffix={() => {}} />
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export const PrefixFocused = ChipPrefixFocused.bind({});
|
|
114
|
+
PrefixFocused.play = async ({ canvasElement }) => {
|
|
115
|
+
await userEvent.tab();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const SuffixFocused = ChipSuffixFocused.bind({});
|
|
119
|
+
SuffixFocused.play = async ({ canvasElement }) => {
|
|
120
|
+
await userEvent.tab();
|
|
121
|
+
};
|
package/chip/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
|
+
declare type Props = {
|
|
11
|
+
/**
|
|
12
|
+
* Text to be placed on the chip.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Element used as icon to be placed after the chip label.
|
|
17
|
+
*/
|
|
18
|
+
suffixIcon?: SVG;
|
|
19
|
+
/**
|
|
20
|
+
* Element used as icon to be placed before the chip label.
|
|
21
|
+
*/
|
|
22
|
+
prefixIcon?: SVG;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Path of the icon to be placed after the chip label.
|
|
25
|
+
*/
|
|
26
|
+
suffixIconSrc?: string;
|
|
27
|
+
/**
|
|
28
|
+
* This function will be called when the suffix is clicked.
|
|
29
|
+
*/
|
|
30
|
+
onClickSuffix?: (label: string | undefined) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Path of the icon to be placed before the chip label.
|
|
33
|
+
*/
|
|
34
|
+
prefixIconSrc?: string;
|
|
35
|
+
/**
|
|
36
|
+
* This function will be called when the prefix is clicked.
|
|
37
|
+
*/
|
|
38
|
+
onClickPrefix?: (label: string | undefined) => void;
|
|
39
|
+
/**
|
|
40
|
+
* If true, the component will be disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
45
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
46
|
+
*/
|
|
47
|
+
margin?: Space | Margin;
|
|
48
|
+
/**
|
|
49
|
+
* Value of the tabindex attribute.
|
|
50
|
+
*/
|
|
51
|
+
tabIndex?: number;
|
|
52
|
+
};
|
|
53
|
+
export default Props;
|
package/chip/types.js
ADDED
package/common/variables.js
CHANGED
|
@@ -99,7 +99,7 @@ var globalTokens = {
|
|
|
99
99
|
type_sans: "Open Sans, sans-serif",
|
|
100
100
|
type_scale_root: "16px",
|
|
101
101
|
type_scale_08: "3.75rem",
|
|
102
|
-
type_scale_07: "
|
|
102
|
+
type_scale_07: "2.5rem",
|
|
103
103
|
type_scale_06: "2rem",
|
|
104
104
|
type_scale_05: "1.5rem",
|
|
105
105
|
type_scale_04: "1.25rem",
|
|
@@ -535,17 +535,16 @@ var componentTokens = {
|
|
|
535
535
|
errorMessageFontFamily: globalTokens.type_sans,
|
|
536
536
|
errorMessageFontSize: globalTokens.type_scale_01,
|
|
537
537
|
errorMessageFontWeight: globalTokens.type_regular,
|
|
538
|
-
errorMessageLineHeight: globalTokens.
|
|
538
|
+
errorMessageLineHeight: globalTokens.type_leading_normal,
|
|
539
539
|
dropBorderThickness: globalTokens.border_width_1,
|
|
540
540
|
dropBorderStyle: globalTokens.border_dashed,
|
|
541
541
|
dropBorderRadius: globalTokens.border_radius_large,
|
|
542
542
|
fileItemBorderThickness: globalTokens.border_width_1,
|
|
543
543
|
fileItemBorderStyle: globalTokens.border_solid,
|
|
544
544
|
fileItemBorderRadius: globalTokens.border_radius_medium,
|
|
545
|
-
hoverDeleteFileItemBackgroundColor:
|
|
546
|
-
activeDeleteFileItemBackgroundColor:
|
|
547
|
-
|
|
548
|
-
errorActiveDeleteFileItemBackgroundColor: globalTokens.hal_red_s_41
|
|
545
|
+
hoverDeleteFileItemBackgroundColor: "#0000000d",
|
|
546
|
+
activeDeleteFileItemBackgroundColor: "#00000033",
|
|
547
|
+
focusActionBorderColor: globalTokens.hal_blue_l_50
|
|
549
548
|
},
|
|
550
549
|
footer: {
|
|
551
550
|
height: "124px",
|
|
@@ -608,37 +607,37 @@ var componentTokens = {
|
|
|
608
607
|
heading: {
|
|
609
608
|
level1FontColor: globalTokens.inherit,
|
|
610
609
|
level1FontFamily: globalTokens.type_sans,
|
|
611
|
-
level1FontSize: globalTokens.
|
|
610
|
+
level1FontSize: globalTokens.type_scale_07,
|
|
612
611
|
level1FontStyle: globalTokens.type_normal,
|
|
613
|
-
level1FontWeight: globalTokens.
|
|
612
|
+
level1FontWeight: globalTokens.type_semibold,
|
|
614
613
|
level1LineHeight: globalTokens.type_leading_compact_01,
|
|
615
614
|
level1LetterSpacing: globalTokens.type_spacing_tight_01,
|
|
616
615
|
level2FontColor: globalTokens.inherit,
|
|
617
616
|
level2FontFamily: globalTokens.type_sans,
|
|
618
|
-
level2FontSize: globalTokens.
|
|
617
|
+
level2FontSize: globalTokens.type_scale_05,
|
|
619
618
|
level2FontStyle: globalTokens.type_normal,
|
|
620
|
-
level2FontWeight: globalTokens.
|
|
619
|
+
level2FontWeight: globalTokens.type_semibold,
|
|
621
620
|
level2LineHeight: globalTokens.type_leading_normal,
|
|
622
621
|
level2LetterSpacing: globalTokens.type_spacing_normal,
|
|
623
622
|
level3FontColor: globalTokens.inherit,
|
|
624
623
|
level3FontFamily: globalTokens.type_sans,
|
|
625
|
-
level3FontSize: globalTokens.
|
|
624
|
+
level3FontSize: globalTokens.type_scale_04,
|
|
626
625
|
level3FontStyle: globalTokens.type_normal,
|
|
627
|
-
level3FontWeight: globalTokens.
|
|
626
|
+
level3FontWeight: globalTokens.type_semibold,
|
|
628
627
|
level3LineHeight: globalTokens.type_leading_compact_01,
|
|
629
628
|
level3LetterSpacing: globalTokens.type_spacing_wide_01,
|
|
630
629
|
level4FontColor: globalTokens.inherit,
|
|
631
630
|
level4FontFamily: globalTokens.type_sans,
|
|
632
|
-
level4FontSize: globalTokens.
|
|
631
|
+
level4FontSize: globalTokens.type_scale_03,
|
|
633
632
|
level4FontStyle: globalTokens.type_normal,
|
|
634
|
-
level4FontWeight: globalTokens.
|
|
633
|
+
level4FontWeight: globalTokens.type_semibold,
|
|
635
634
|
level4LineHeight: globalTokens.type_leading_normal,
|
|
636
635
|
level4LetterSpacing: globalTokens.type_spacing_normal,
|
|
637
636
|
level5FontColor: globalTokens.inherit,
|
|
638
637
|
level5FontFamily: globalTokens.type_sans,
|
|
639
|
-
level5FontSize: globalTokens.
|
|
638
|
+
level5FontSize: globalTokens.type_scale_02,
|
|
640
639
|
level5FontStyle: globalTokens.type_normal,
|
|
641
|
-
level5FontWeight: globalTokens.
|
|
640
|
+
level5FontWeight: globalTokens.type_semibold,
|
|
642
641
|
level5LineHeight: globalTokens.type_leading_normal,
|
|
643
642
|
level5LetterSpacing: globalTokens.type_spacing_wide_01
|
|
644
643
|
},
|
|
@@ -780,7 +779,7 @@ var componentTokens = {
|
|
|
780
779
|
activeActionBackgroundColor: globalTokens.hal_grey_l_80,
|
|
781
780
|
activeActionBackgroundColorOnDark: globalTokens.hal_grey_l_60,
|
|
782
781
|
listDialogBackgroundColor: globalTokens.hal_white,
|
|
783
|
-
listDialogBorderColor: globalTokens.
|
|
782
|
+
listDialogBorderColor: globalTokens.hal_grey_l_75,
|
|
784
783
|
listOptionDividerColor: globalTokens.hal_grey_l_90,
|
|
785
784
|
listOptionFontColor: globalTokens.hal_black,
|
|
786
785
|
listOptionFontSize: globalTokens.type_scale_02,
|
|
@@ -1042,9 +1041,13 @@ var componentTokens = {
|
|
|
1042
1041
|
},
|
|
1043
1042
|
slider: {
|
|
1044
1043
|
fontFamily: globalTokens.type_sans,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1044
|
+
limitValuesFontColor: globalTokens.hal_black,
|
|
1045
|
+
limitValuesFontColorOnDark: globalTokens.hal_white,
|
|
1046
|
+
limitValuesFontSize: globalTokens.type_scale_03,
|
|
1047
|
+
limitValuesFontStyle: globalTokens.type_normal,
|
|
1048
|
+
limitValuesFontWeight: globalTokens.type_regular,
|
|
1049
|
+
limitValuesFontLetterSpacing: globalTokens.type_spacing_normal,
|
|
1050
|
+
disabledLimitValuesFontColor: globalTokens.hal_grey_l_60,
|
|
1048
1051
|
labelFontFamily: globalTokens.type_sans,
|
|
1049
1052
|
labelFontSize: globalTokens.type_scale_02,
|
|
1050
1053
|
labelFontStyle: globalTokens.type_normal,
|
|
@@ -1058,9 +1061,13 @@ var componentTokens = {
|
|
|
1058
1061
|
fontColor: globalTokens.hal_black,
|
|
1059
1062
|
fontColorOnDark: globalTokens.hal_white,
|
|
1060
1063
|
labelFontColor: globalTokens.hal_black,
|
|
1064
|
+
labelFontColorOnDark: globalTokens.hal_white,
|
|
1061
1065
|
helperTextFontColor: globalTokens.hal_black,
|
|
1062
|
-
|
|
1063
|
-
|
|
1066
|
+
helperTextFontColorOnDark: globalTokens.hal_white,
|
|
1067
|
+
disabledLabelFontColor: globalTokens.hal_grey_l_60,
|
|
1068
|
+
disabledLabelFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1069
|
+
disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
|
|
1070
|
+
disabledHelperTextFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1064
1071
|
thumbHeight: "12px",
|
|
1065
1072
|
thumbWidth: "12px",
|
|
1066
1073
|
hoverThumbHeight: "14px",
|
|
@@ -1142,30 +1149,30 @@ var componentTokens = {
|
|
|
1142
1149
|
"switch": {
|
|
1143
1150
|
checkedTrackBackgroundColor: globalTokens.hal_purple_s_38,
|
|
1144
1151
|
checkedTrackBackgroundColorOnDark: globalTokens.hal_purple_s_38,
|
|
1145
|
-
checkedThumbBackgroundColor: globalTokens.
|
|
1146
|
-
checkedThumbBackgroundColorOnDark: globalTokens.
|
|
1147
|
-
uncheckedTrackBackgroundColor: globalTokens.
|
|
1148
|
-
uncheckedTrackBackgroundColorOnDark: globalTokens.
|
|
1149
|
-
uncheckedThumbBackgroundColor: globalTokens.
|
|
1150
|
-
uncheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1151
|
-
disabledCheckedTrackBackgroundColor: globalTokens.
|
|
1152
|
+
checkedThumbBackgroundColor: globalTokens.hal_white,
|
|
1153
|
+
checkedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1154
|
+
uncheckedTrackBackgroundColor: globalTokens.hal_grey_l_75,
|
|
1155
|
+
uncheckedTrackBackgroundColorOnDark: globalTokens.hal_grey_l_75,
|
|
1156
|
+
uncheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1157
|
+
uncheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1158
|
+
disabledCheckedTrackBackgroundColor: globalTokens.hal_purple_l_95,
|
|
1152
1159
|
disabledCheckedTrackBackgroundColorOnDark: "#1c0b24",
|
|
1153
|
-
disabledCheckedThumbBackgroundColor: globalTokens.
|
|
1154
|
-
disabledCheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1155
|
-
disabledUncheckedTrackBackgroundColor: globalTokens.
|
|
1160
|
+
disabledCheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1161
|
+
disabledCheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1162
|
+
disabledUncheckedTrackBackgroundColor: globalTokens.hal_grey_l_95,
|
|
1156
1163
|
disabledUncheckedTrackBackgroundColorOnDark: "#363636",
|
|
1157
|
-
disabledUncheckedThumbBackgroundColor: globalTokens.
|
|
1158
|
-
disabledUncheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1159
|
-
disabledLabelFontColor: globalTokens.
|
|
1164
|
+
disabledUncheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1165
|
+
disabledUncheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1166
|
+
disabledLabelFontColor: globalTokens.hal_grey_l_60,
|
|
1160
1167
|
disabledLabelFontColorOnDark: "#575757",
|
|
1161
1168
|
disabledLabelFontStyle: globalTokens.type_normal,
|
|
1162
1169
|
labelFontFamily: globalTokens.type_sans,
|
|
1163
1170
|
labelFontSize: globalTokens.type_scale_root,
|
|
1164
1171
|
labelFontStyle: globalTokens.type_normal,
|
|
1165
1172
|
labelFontWeight: globalTokens.type_regular,
|
|
1166
|
-
labelFontColor: globalTokens.
|
|
1167
|
-
labelFontColorOnDark: globalTokens.
|
|
1168
|
-
thumbFocusColor: globalTokens.
|
|
1173
|
+
labelFontColor: globalTokens.hal_black,
|
|
1174
|
+
labelFontColorOnDark: globalTokens.hal_white,
|
|
1175
|
+
thumbFocusColor: globalTokens.hal_blue_l_50,
|
|
1169
1176
|
thumbFocusColorOnDark: "#1682FF",
|
|
1170
1177
|
thumbHeight: "24px",
|
|
1171
1178
|
thumbWidth: "24px",
|
package/date/Date.js
CHANGED
|
@@ -39,7 +39,7 @@ var _InputText = _interopRequireDefault(require("../input-text/InputText"));
|
|
|
39
39
|
|
|
40
40
|
var _variables = require("../common/variables.js");
|
|
41
41
|
|
|
42
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
42
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
43
43
|
|
|
44
44
|
var _templateObject, _DxcDate$propTypes;
|
|
45
45
|
|
package/date-input/DateInput.js
CHANGED
|
@@ -29,7 +29,7 @@ var _dateFns = _interopRequireDefault(require("@date-io/date-fns"));
|
|
|
29
29
|
|
|
30
30
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
31
31
|
|
|
32
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
32
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
33
33
|
|
|
34
34
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
35
35
|
|
|
@@ -40,15 +40,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
40
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
41
|
|
|
42
42
|
var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
43
|
-
var
|
|
44
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
43
|
+
var label = _ref.label,
|
|
45
44
|
_ref$name = _ref.name,
|
|
46
45
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
47
46
|
value = _ref.value,
|
|
48
47
|
_ref$format = _ref.format,
|
|
49
48
|
format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
|
|
50
|
-
|
|
51
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
49
|
+
helperText = _ref.helperText,
|
|
52
50
|
_ref$placeholder = _ref.placeholder,
|
|
53
51
|
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
54
52
|
_ref$clearable = _ref.clearable,
|
|
@@ -59,8 +57,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
59
57
|
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
60
58
|
onChange = _ref.onChange,
|
|
61
59
|
onBlur = _ref.onBlur,
|
|
62
|
-
|
|
63
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
60
|
+
error = _ref.error,
|
|
64
61
|
_ref$autocomplete = _ref.autocomplete,
|
|
65
62
|
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
66
63
|
margin = _ref.margin,
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within, fireEvent, screen } from "@storybook/testing-library";
|
|
3
|
+
import DxcDateInput from "./DateInput";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
7
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Date input",
|
|
11
|
+
component: DxcDateInput,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Chromatic = () => (
|
|
15
|
+
<>
|
|
16
|
+
<ExampleContainer>
|
|
17
|
+
<Title title="Complete date input" theme="light" level={4} />
|
|
18
|
+
<DxcDateInput label="Date input" helperText="Help message" format="dd/mm/yy" placeholder optional />
|
|
19
|
+
</ExampleContainer>
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
+
<DxcDateInput label="Disabled date input" helperText="Help message" value="06-04-2027" clearable disabled />
|
|
23
|
+
</ExampleContainer>
|
|
24
|
+
<ExampleContainer>
|
|
25
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
26
|
+
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
27
|
+
</ExampleContainer>
|
|
28
|
+
<ExampleContainer>
|
|
29
|
+
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
+
<DxcDateInput label="Error date input" error="Error message." value="06-04-2027" clearable />
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<BackgroundColorProvider color="#333333">
|
|
33
|
+
<DarkContainer>
|
|
34
|
+
<Title title="Dark" theme="dark" level={2} />
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="Complete date input" theme="dark" level={4} />
|
|
37
|
+
<DxcDateInput label="Date input" helperText="Help message" format="yyyy/dd/mm" placeholder optional />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
+
<DxcDateInput label="Disabled Date input" helperText="Help message" value="06-04-2027" clearable disabled />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Invalid" theme="dark" level={4} />
|
|
45
|
+
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
+
<DxcDateInput label="Error date input" value="06-04-2027" error="Error message." clearable />
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
</DarkContainer>
|
|
52
|
+
</BackgroundColorProvider>
|
|
53
|
+
<Title title="Margins" theme="light" level={2} />
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
56
|
+
<DxcDateInput label="Xxsmall" margin="xxsmall" />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
<ExampleContainer>
|
|
59
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
60
|
+
<DxcDateInput label="Xsmall" margin="xsmall" />
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<Title title="Small" theme="light" level={4} />
|
|
64
|
+
<DxcDateInput label="Small" margin="small" />
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
<ExampleContainer>
|
|
67
|
+
<Title title="Medium" theme="light" level={4} />
|
|
68
|
+
<DxcDateInput label="Medium" margin="medium" />
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Large" theme="light" level={4} />
|
|
72
|
+
<DxcDateInput label="Large" margin="large" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
76
|
+
<DxcDateInput label="Xlarge" margin="xlarge" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
80
|
+
<DxcDateInput label="Xxlarge" margin="xxlarge" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
85
|
+
<DxcDateInput label="Medium" size="medium" />
|
|
86
|
+
</ExampleContainer>
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="Large size" theme="light" level={4} />
|
|
89
|
+
<DxcDateInput label="Large" size="large" />
|
|
90
|
+
</ExampleContainer>
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
93
|
+
<DxcDateInput label="FillParent" size="fillParent" />
|
|
94
|
+
</ExampleContainer>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const DatePicker = () => (
|
|
99
|
+
<ExampleContainer expanded>
|
|
100
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
102
|
+
</ExampleContainer>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
export const ShowDatePicker = DatePicker.bind({});
|
|
106
|
+
ShowDatePicker.play = async ({ canvasElement }) => {
|
|
107
|
+
const canvas = within(canvasElement);
|
|
108
|
+
const dateBtn = canvas.getByRole("button");
|
|
109
|
+
await userEvent.click(dateBtn);
|
|
110
|
+
await userEvent.tab();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const YearPicker = () => (
|
|
114
|
+
<ExampleContainer expanded>
|
|
115
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
116
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
117
|
+
</ExampleContainer>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export const ShowYearPicker = YearPicker.bind({});
|
|
121
|
+
ShowYearPicker.play = async () => {
|
|
122
|
+
await fireEvent.click(screen.getByRole("button"));
|
|
123
|
+
await fireEvent.click(screen.getByText("2023"));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const YearPickerFocus = () => (
|
|
127
|
+
<ExampleContainer expanded>
|
|
128
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
129
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
export const ShowYearPickerFocus = YearPickerFocus.bind({});
|
|
134
|
+
ShowYearPickerFocus.play = async () => {
|
|
135
|
+
await fireEvent.click(screen.getByRole("button"));
|
|
136
|
+
await fireEvent.click(screen.getByText("2023"));
|
|
137
|
+
await screen.getByText("2021").focus();
|
|
138
|
+
};
|
package/dialog/Dialog.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -23,13 +21,11 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
23
21
|
|
|
24
22
|
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
25
23
|
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
24
|
var _variables = require("../common/variables.js");
|
|
29
25
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
26
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
27
|
|
|
32
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
28
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
33
29
|
|
|
34
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
35
31
|
|
|
@@ -49,7 +45,7 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
49
45
|
_ref$tabIndex = _ref.tabIndex,
|
|
50
46
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
51
47
|
|
|
52
|
-
var _useState = (0, _react.useState)(),
|
|
48
|
+
var _useState = (0, _react.useState)(false),
|
|
53
49
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
54
50
|
isResponsive = _useState2[0],
|
|
55
51
|
setIsResponsive = _useState2[1];
|
|
@@ -57,15 +53,15 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
57
53
|
var colorsTheme = (0, _useTheme["default"])();
|
|
58
54
|
|
|
59
55
|
var handleClose = function handleClose() {
|
|
60
|
-
|
|
56
|
+
onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
|
|
61
57
|
};
|
|
62
58
|
|
|
63
59
|
var handleOverlayClick = function handleOverlayClick() {
|
|
64
|
-
|
|
60
|
+
onBackgroundClick === null || onBackgroundClick === void 0 ? void 0 : onBackgroundClick();
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
var handleResize = function handleResize(width) {
|
|
68
|
-
width && width <= _variables.responsiveSizes.tablet
|
|
64
|
+
setIsResponsive(width && width <= _variables.responsiveSizes.tablet);
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
var handleEventListener = function handleEventListener() {
|
|
@@ -165,20 +161,5 @@ var CloseIcon = _styledComponents["default"].svg(_templateObject4 || (_templateO
|
|
|
165
161
|
return props.theme.closeIconBorderColor;
|
|
166
162
|
});
|
|
167
163
|
|
|
168
|
-
DxcDialog.propTypes = {
|
|
169
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
170
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
171
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
172
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
173
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
174
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
175
|
-
isVisible: _propTypes["default"].bool,
|
|
176
|
-
isCloseVisible: _propTypes["default"].bool,
|
|
177
|
-
onClose: _propTypes["default"].func,
|
|
178
|
-
onCloseClick: _propTypes["default"].func,
|
|
179
|
-
onBackgroundClick: _propTypes["default"].func,
|
|
180
|
-
overlay: _propTypes["default"].bool,
|
|
181
|
-
tabIndex: _propTypes["default"].number
|
|
182
|
-
};
|
|
183
164
|
var _default = DxcDialog;
|
|
184
165
|
exports["default"] = _default;
|