@dxc-technology/halstack-react 0.0.0-1b8b460 → 0.0.0-1bfe223
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 +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1215 -6
- package/HalstackContext.js +121 -105
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +36 -99
- package/accordion/Accordion.stories.tsx +101 -124
- package/accordion/Accordion.test.js +19 -34
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +29 -77
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +44 -72
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +6 -18
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +47 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +19 -58
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -42
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +18 -59
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +19 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +69 -105
- package/button/Button.stories.tsx +152 -91
- package/button/Button.test.js +20 -17
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +48 -89
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.js +87 -122
- package/checkbox/Checkbox.stories.tsx +68 -54
- package/checkbox/Checkbox.test.js +108 -64
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +39 -79
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +16 -31
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1367 -0
- package/common/variables.js +866 -1139
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +52 -96
- package/date-input/DateInput.js +103 -107
- package/date-input/DateInput.stories.tsx +194 -60
- package/date-input/DateInput.test.js +676 -620
- package/date-input/DatePicker.js +47 -92
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +29 -44
- package/date-input/types.d.ts +31 -27
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -119
- package/dialog/Dialog.stories.tsx +310 -212
- package/dialog/Dialog.test.js +269 -32
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +44 -101
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +393 -379
- package/dropdown/DropdownMenu.js +20 -37
- package/dropdown/DropdownMenuItem.js +9 -34
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +184 -256
- package/file-input/FileInput.stories.tsx +86 -3
- package/file-input/FileInput.test.js +356 -395
- package/file-input/FileItem.js +15 -41
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +27 -39
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -117
- package/footer/Footer.stories.tsx +55 -21
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +48 -133
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +5 -6
- package/link/Link.js +24 -45
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -14
- package/main.d.ts +8 -5
- package/main.js +33 -59
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +23 -55
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +115 -9
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +39 -45
- package/nav-tabs/Tab.js +118 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +14 -15
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +26 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +701 -413
- package/number-input/types.d.ts +11 -5
- package/package.json +31 -29
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +21 -47
- package/paginator/Paginator.js +22 -58
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +252 -225
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +6 -22
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +158 -141
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +23 -55
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
- package/progress-bar/ProgressBar.test.js +36 -53
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +15 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +31 -63
- package/radio-group/RadioGroup.js +45 -93
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +505 -471
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.js +25 -61
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +89 -114
- package/{resultsetTable → resultset-table}/types.d.ts +7 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +17 -72
- package/select/Option.js +27 -50
- package/select/Select.js +120 -175
- package/select/Select.stories.tsx +495 -148
- package/select/Select.test.js +1974 -1837
- package/select/types.d.ts +16 -17
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +81 -153
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.js +70 -128
- package/slider/Slider.test.js +108 -104
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +29 -73
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.js +51 -99
- package/switch/Switch.stories.tsx +33 -34
- package/switch/Switch.test.js +52 -97
- package/switch/types.d.ts +4 -4
- package/table/Table.js +7 -29
- package/table/{Table.stories.jsx → Table.stories.tsx} +80 -1
- package/table/Table.test.js +2 -7
- package/table/types.d.ts +8 -8
- package/tabs/Tab.js +26 -45
- package/tabs/Tabs.js +62 -145
- package/tabs/Tabs.stories.tsx +46 -5
- package/tabs/Tabs.test.js +66 -123
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +28 -60
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +20 -31
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +5 -5
- package/text-input/Icons.js +1 -5
- package/text-input/Suggestion.js +11 -28
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +15 -65
- package/text-input/TextInput.js +219 -324
- package/text-input/TextInput.stories.tsx +134 -155
- package/text-input/TextInput.test.js +1211 -1196
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +70 -113
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -106
- package/toggle-group/ToggleGroup.stories.tsx +49 -4
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +15 -123
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1119 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +84 -1
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.js +16 -51
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +8 -9
- package/card/ice-cream.jpg +0 -0
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/Icons.d.ts +0 -7
- package/slider/Slider.stories.tsx +0 -183
- package/tabs-nav/Tab.js +0 -130
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{tabs-nav → container}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → grid/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +0 -0
package/wizard/Wizard.test.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
var _Wizard = _interopRequireDefault(require("./Wizard"));
|
|
10
|
-
|
|
6
|
+
var _Wizard = _interopRequireDefault(require("./Wizard.tsx"));
|
|
11
7
|
describe("Wizard components tests", function () {
|
|
12
8
|
test("Wizard renders with correct steps", function () {
|
|
13
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
steps: [{
|
|
11
|
+
label: "first-step"
|
|
12
|
+
}, {
|
|
13
|
+
label: "second-step"
|
|
14
|
+
}]
|
|
15
|
+
})),
|
|
16
|
+
getByText = _render.getByText,
|
|
17
|
+
getAllByRole = _render.getAllByRole;
|
|
23
18
|
var steps = getAllByRole("button");
|
|
24
19
|
expect(getByText("first-step")).toBeTruthy();
|
|
25
20
|
expect(getByText("second-step")).toBeTruthy();
|
|
@@ -28,112 +23,90 @@ describe("Wizard components tests", function () {
|
|
|
28
23
|
});
|
|
29
24
|
test("Wizard renders with initially selected step", function () {
|
|
30
25
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
defaultCurrentStep: 1,
|
|
27
|
+
steps: [{
|
|
28
|
+
label: "first-step"
|
|
29
|
+
}, {
|
|
30
|
+
label: "second-step"
|
|
31
|
+
}]
|
|
32
|
+
})),
|
|
33
|
+
getAllByRole = _render2.getAllByRole;
|
|
40
34
|
var steps = getAllByRole("button");
|
|
41
35
|
expect(steps[1].getAttribute("aria-current")).toBe("step");
|
|
42
36
|
});
|
|
43
37
|
test("Click on step text", function () {
|
|
44
38
|
var onClick = jest.fn();
|
|
45
|
-
|
|
46
39
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
onStepClick: onClick,
|
|
41
|
+
steps: [{
|
|
42
|
+
label: "first-step"
|
|
43
|
+
}]
|
|
44
|
+
})),
|
|
45
|
+
getByText = _render3.getByText;
|
|
54
46
|
var step = getByText("first-step");
|
|
55
|
-
|
|
56
47
|
_react2.fireEvent.click(step);
|
|
57
|
-
|
|
58
48
|
expect(onClick).toHaveBeenCalled();
|
|
59
49
|
});
|
|
60
50
|
test("Click on step description", function () {
|
|
61
51
|
var onClick = jest.fn();
|
|
62
|
-
|
|
63
52
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
onStepClick: onClick,
|
|
54
|
+
steps: [{
|
|
55
|
+
label: "first-step",
|
|
56
|
+
description: "step-description"
|
|
57
|
+
}]
|
|
58
|
+
})),
|
|
59
|
+
getByText = _render4.getByText;
|
|
72
60
|
var step = getByText("step-description");
|
|
73
|
-
|
|
74
61
|
_react2.fireEvent.click(step);
|
|
75
|
-
|
|
76
62
|
expect(onClick).toHaveBeenCalled();
|
|
77
63
|
});
|
|
78
64
|
test("Click on step number", function () {
|
|
79
65
|
var onClick = jest.fn();
|
|
80
|
-
|
|
81
66
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
onStepClick: onClick,
|
|
68
|
+
steps: [{
|
|
69
|
+
label: "first-step"
|
|
70
|
+
}]
|
|
71
|
+
})),
|
|
72
|
+
getByText = _render5.getByText;
|
|
89
73
|
var step = getByText("1");
|
|
90
|
-
|
|
91
74
|
_react2.fireEvent.click(step);
|
|
92
|
-
|
|
93
75
|
expect(onClick).toHaveBeenCalled();
|
|
94
76
|
});
|
|
95
77
|
test("Click on disable step", function () {
|
|
96
78
|
var onClick = jest.fn();
|
|
97
|
-
|
|
98
79
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
onStepClick: onClick,
|
|
81
|
+
steps: [{
|
|
82
|
+
label: "first-step"
|
|
83
|
+
}, {
|
|
84
|
+
label: "second-step",
|
|
85
|
+
disabled: true
|
|
86
|
+
}]
|
|
87
|
+
})),
|
|
88
|
+
getByText = _render6.getByText;
|
|
109
89
|
var step = getByText("second-step");
|
|
110
|
-
|
|
111
90
|
_react2.fireEvent.click(step);
|
|
112
|
-
|
|
113
91
|
expect(onClick).toHaveBeenCalledTimes(0);
|
|
114
92
|
});
|
|
115
93
|
test("Controlled wizard function is called", function () {
|
|
116
94
|
var onClick = jest.fn(function (i) {
|
|
117
95
|
return i;
|
|
118
96
|
});
|
|
119
|
-
|
|
120
97
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
98
|
+
currentStep: 0,
|
|
99
|
+
onStepClick: onClick,
|
|
100
|
+
steps: [{
|
|
101
|
+
label: "first-step"
|
|
102
|
+
}, {
|
|
103
|
+
label: "second-step"
|
|
104
|
+
}]
|
|
105
|
+
})),
|
|
106
|
+
getAllByRole = _render7.getAllByRole;
|
|
131
107
|
var steps = getAllByRole("button");
|
|
132
|
-
|
|
133
108
|
_react2.fireEvent.click(steps[1]);
|
|
134
|
-
|
|
135
109
|
_react2.fireEvent.click(steps[0]);
|
|
136
|
-
|
|
137
110
|
expect(onClick).toHaveBeenCalledTimes(2);
|
|
138
111
|
expect(onClick).toHaveBeenNthCalledWith(1, 1);
|
|
139
112
|
expect(onClick).toHaveBeenNthCalledWith(2, 0);
|
package/wizard/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
+
export type StepProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Step label.
|
|
13
13
|
*/
|
|
@@ -29,12 +29,11 @@ declare type Step = {
|
|
|
29
29
|
*/
|
|
30
30
|
valid?: boolean;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
declare type Props = {
|
|
32
|
+
type Props = {
|
|
34
33
|
/**
|
|
35
34
|
* The wizard can be showed in horizontal or vertical.
|
|
36
35
|
*/
|
|
37
|
-
mode?:
|
|
36
|
+
mode?: "horizontal" | "vertical";
|
|
38
37
|
/**
|
|
39
38
|
* Initially selected step, only when it is uncontrolled.
|
|
40
39
|
*/
|
|
@@ -47,11 +46,11 @@ declare type Props = {
|
|
|
47
46
|
* This function will be called when the user clicks a step. The step
|
|
48
47
|
* number will be passed as a parameter.
|
|
49
48
|
*/
|
|
50
|
-
onStepClick?: (
|
|
49
|
+
onStepClick?: (currentStep: number) => void;
|
|
51
50
|
/**
|
|
52
51
|
* An array of objects representing the steps.
|
|
53
52
|
*/
|
|
54
|
-
steps:
|
|
53
|
+
steps: StepProps[];
|
|
55
54
|
/**
|
|
56
55
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
57
56
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
package/card/ice-cream.jpg
DELETED
|
Binary file
|
|
@@ -1,19 +0,0 @@
|
|
|
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"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var defaultState = {
|
|
13
|
-
stepNumber: 1
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
var NumberInputContext = /*#__PURE__*/_react["default"].createContext(defaultState);
|
|
17
|
-
|
|
18
|
-
var _default = NumberInputContext;
|
|
19
|
-
exports["default"] = _default;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare type Props = {
|
|
2
|
-
/**
|
|
3
|
-
* Type of the input.
|
|
4
|
-
*/
|
|
5
|
-
typeNumber?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Minimum value allowed by the number input.
|
|
8
|
-
*/
|
|
9
|
-
minNumber?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Maximum value allowed by the number input.
|
|
12
|
-
*/
|
|
13
|
-
maxNumber?: number;
|
|
14
|
-
/**
|
|
15
|
-
* The step interval to use when using the up and down arrows to adjust the value.
|
|
16
|
-
*/
|
|
17
|
-
stepNumber?: number;
|
|
18
|
-
};
|
|
19
|
-
export default Props;
|
|
@@ -1,183 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: "Slider",
|
|
10
|
-
component: DxcSlider,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const labelFormat = (value) => `${value}E100000000000000000000000`;
|
|
14
|
-
|
|
15
|
-
export const Chromatic = () => (
|
|
16
|
-
<>
|
|
17
|
-
<Title title="States" theme="light" level={2} />
|
|
18
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
19
|
-
<Title title="Hovered" theme="light" level={4} />
|
|
20
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
21
|
-
</ExampleContainer>
|
|
22
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
23
|
-
<Title title="Active" theme="light" level={4} />
|
|
24
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
25
|
-
</ExampleContainer>
|
|
26
|
-
<ExampleContainer pseudoState="pseudo-focus">
|
|
27
|
-
<Title title="Focused" theme="light" level={4} />
|
|
28
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
29
|
-
</ExampleContainer>
|
|
30
|
-
<ExampleContainer>
|
|
31
|
-
<Title title="Disabled" theme="light" level={4} />
|
|
32
|
-
<DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
|
|
33
|
-
</ExampleContainer>
|
|
34
|
-
<ExampleContainer>
|
|
35
|
-
<Title title="Disabled discrete slider with input" theme="light" level={4} />
|
|
36
|
-
<DxcSlider
|
|
37
|
-
label="Slider"
|
|
38
|
-
helperText="Help message"
|
|
39
|
-
disabled
|
|
40
|
-
defaultValue={40}
|
|
41
|
-
minValue={0}
|
|
42
|
-
maxValue={50}
|
|
43
|
-
showLimitsValues
|
|
44
|
-
showInput
|
|
45
|
-
marks
|
|
46
|
-
step={10}
|
|
47
|
-
/>
|
|
48
|
-
</ExampleContainer>
|
|
49
|
-
<Title title="Variants" theme="light" level={2} />
|
|
50
|
-
<ExampleContainer>
|
|
51
|
-
<Title title="Continuous slider" theme="light" level={4} />
|
|
52
|
-
<DxcSlider defaultValue={65} label="Slider" helperText="Help message" showLimitsValues />
|
|
53
|
-
</ExampleContainer>
|
|
54
|
-
<ExampleContainer>
|
|
55
|
-
<Title title="Discrete slider" theme="light" level={4} />
|
|
56
|
-
<DxcSlider defaultValue={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
|
|
57
|
-
</ExampleContainer>
|
|
58
|
-
<ExampleContainer>
|
|
59
|
-
<Title title="Discrete slider with input" theme="light" level={4} />
|
|
60
|
-
<DxcSlider
|
|
61
|
-
defaultValue={20}
|
|
62
|
-
minValue={0}
|
|
63
|
-
maxValue={50}
|
|
64
|
-
label="Slider"
|
|
65
|
-
helperText="Help message"
|
|
66
|
-
showLimitsValues
|
|
67
|
-
showInput
|
|
68
|
-
marks
|
|
69
|
-
step={10}
|
|
70
|
-
/>
|
|
71
|
-
</ExampleContainer>
|
|
72
|
-
<BackgroundColorProvider color="#333333">
|
|
73
|
-
<DarkContainer>
|
|
74
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
75
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
76
|
-
<Title title="Hovered" theme="dark" level={4} />
|
|
77
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
78
|
-
</ExampleContainer>
|
|
79
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
80
|
-
<Title title="Active" theme="dark" level={4} />
|
|
81
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
82
|
-
</ExampleContainer>
|
|
83
|
-
<ExampleContainer pseudoState="pseudo-focus">
|
|
84
|
-
<Title title="Focused" theme="dark" level={4} />
|
|
85
|
-
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
86
|
-
</ExampleContainer>
|
|
87
|
-
<ExampleContainer>
|
|
88
|
-
<Title title="Disabled" theme="dark" level={4} />
|
|
89
|
-
<DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
|
|
90
|
-
</ExampleContainer>
|
|
91
|
-
<ExampleContainer>
|
|
92
|
-
<Title title="Disabled discrete slider with input" theme="dark" level={4} />
|
|
93
|
-
<DxcSlider
|
|
94
|
-
label="Slider"
|
|
95
|
-
helperText="Help message"
|
|
96
|
-
disabled
|
|
97
|
-
defaultValue={40}
|
|
98
|
-
minValue={0}
|
|
99
|
-
maxValue={50}
|
|
100
|
-
showLimitsValues
|
|
101
|
-
showInput
|
|
102
|
-
marks
|
|
103
|
-
step={5}
|
|
104
|
-
/>
|
|
105
|
-
</ExampleContainer>
|
|
106
|
-
<ExampleContainer>
|
|
107
|
-
<Title title="Continuous slider" theme="dark" level={4} />
|
|
108
|
-
<DxcSlider defaultValue={65} label="Slider" helperText="Help message" showLimitsValues />
|
|
109
|
-
</ExampleContainer>
|
|
110
|
-
<ExampleContainer>
|
|
111
|
-
<Title title="Discrete slider" theme="dark" level={4} />
|
|
112
|
-
<DxcSlider defaultValue={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
|
|
113
|
-
</ExampleContainer>
|
|
114
|
-
<ExampleContainer>
|
|
115
|
-
<Title title="Discrete slider with input" theme="dark" level={4} />
|
|
116
|
-
<DxcSlider
|
|
117
|
-
defaultValue={20}
|
|
118
|
-
minValue={0}
|
|
119
|
-
maxValue={50}
|
|
120
|
-
label="Slider"
|
|
121
|
-
helperText="Help message"
|
|
122
|
-
showLimitsValues
|
|
123
|
-
showInput
|
|
124
|
-
marks
|
|
125
|
-
step={10}
|
|
126
|
-
/>
|
|
127
|
-
</ExampleContainer>
|
|
128
|
-
</DarkContainer>
|
|
129
|
-
</BackgroundColorProvider>
|
|
130
|
-
<Title title="Margins" theme="light" level={2} />
|
|
131
|
-
<ExampleContainer>
|
|
132
|
-
<Title title="Xxsmall" theme="light" level={4} />
|
|
133
|
-
<DxcSlider label="Xxsmall" margin="xxsmall" />
|
|
134
|
-
</ExampleContainer>
|
|
135
|
-
<ExampleContainer>
|
|
136
|
-
<Title title="Xsmall" theme="light" level={4} />
|
|
137
|
-
<DxcSlider label="Xsmall" margin="xsmall" />
|
|
138
|
-
</ExampleContainer>
|
|
139
|
-
<ExampleContainer>
|
|
140
|
-
<Title title="Small" theme="light" level={4} />
|
|
141
|
-
<DxcSlider label="Small" margin="small" />
|
|
142
|
-
</ExampleContainer>
|
|
143
|
-
<ExampleContainer>
|
|
144
|
-
<Title title="Medium" theme="light" level={4} />
|
|
145
|
-
<DxcSlider label="Medium" margin="medium" />
|
|
146
|
-
</ExampleContainer>
|
|
147
|
-
<ExampleContainer>
|
|
148
|
-
<Title title="Large" theme="light" level={4} />
|
|
149
|
-
<DxcSlider label="Large" margin="large" />
|
|
150
|
-
</ExampleContainer>
|
|
151
|
-
<ExampleContainer>
|
|
152
|
-
<Title title="Xlarge" theme="light" level={4} />
|
|
153
|
-
<DxcSlider label="Xlarge" margin="xlarge" />
|
|
154
|
-
</ExampleContainer>
|
|
155
|
-
<ExampleContainer>
|
|
156
|
-
<Title title="Xxlarge" theme="light" level={4} />
|
|
157
|
-
<DxcSlider label="Xxlarge" margin="xxlarge" />
|
|
158
|
-
</ExampleContainer>
|
|
159
|
-
<Title title="Sizes" theme="light" level={2} />
|
|
160
|
-
<ExampleContainer>
|
|
161
|
-
<Title title="Medium" theme="light" level={4} />
|
|
162
|
-
<DxcSlider label="Medium" size="medium" />
|
|
163
|
-
</ExampleContainer>
|
|
164
|
-
<ExampleContainer>
|
|
165
|
-
<Title title="Large" theme="light" level={4} />
|
|
166
|
-
<DxcSlider label="Large" size="large" />
|
|
167
|
-
</ExampleContainer>
|
|
168
|
-
<ExampleContainer>
|
|
169
|
-
<Title title="FillParent" theme="light" level={4} />
|
|
170
|
-
<DxcSlider label="FillParent" size="fillParent" />
|
|
171
|
-
</ExampleContainer>
|
|
172
|
-
<ExampleContainer>
|
|
173
|
-
<Title title="Large limit values labels" theme="light" level={4} />
|
|
174
|
-
<DxcSlider
|
|
175
|
-
label="Slider"
|
|
176
|
-
helperText="Help message"
|
|
177
|
-
showLimitsValues
|
|
178
|
-
labelFormatCallback={labelFormat}
|
|
179
|
-
size="large"
|
|
180
|
-
/>
|
|
181
|
-
</ExampleContainer>
|
|
182
|
-
</>
|
|
183
|
-
);
|
package/tabs-nav/Tab.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
-
|
|
22
|
-
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
23
|
-
|
|
24
|
-
var _NavTabs = require("./NavTabs");
|
|
25
|
-
|
|
26
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
27
|
-
|
|
28
|
-
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
29
|
-
|
|
30
|
-
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); }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
35
|
-
var href = _ref.href,
|
|
36
|
-
_ref$active = _ref.active,
|
|
37
|
-
active = _ref$active === void 0 ? false : _ref$active,
|
|
38
|
-
icon = _ref.icon,
|
|
39
|
-
_ref$disabled = _ref.disabled,
|
|
40
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
41
|
-
_ref$notificationNumb = _ref.notificationNumber,
|
|
42
|
-
notificationNumber = _ref$notificationNumb === void 0 ? false : _ref$notificationNumb,
|
|
43
|
-
children = _ref.children,
|
|
44
|
-
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
45
|
-
var tabRef = /*#__PURE__*/(0, _react.createRef)();
|
|
46
|
-
|
|
47
|
-
var _useContext = (0, _react.useContext)(_NavTabs.NavTabsContext),
|
|
48
|
-
iconPosition = _useContext.iconPosition,
|
|
49
|
-
tabIndex = _useContext.tabIndex,
|
|
50
|
-
hasIcons = _useContext.hasIcons,
|
|
51
|
-
focusedLabel = _useContext.focusedLabel;
|
|
52
|
-
|
|
53
|
-
(0, _react.useLayoutEffect)(function () {
|
|
54
|
-
var _tabRef$current;
|
|
55
|
-
|
|
56
|
-
focusedLabel === children.toString() && (tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current = tabRef.current) === null || _tabRef$current === void 0 ? void 0 : _tabRef$current.focus());
|
|
57
|
-
}, [focusedLabel]);
|
|
58
|
-
|
|
59
|
-
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
60
|
-
var _tabRef$current2;
|
|
61
|
-
|
|
62
|
-
switch (event.key) {
|
|
63
|
-
case " ":
|
|
64
|
-
case "Enter":
|
|
65
|
-
tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.click();
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
72
|
-
active: active,
|
|
73
|
-
role: "tab",
|
|
74
|
-
"aria-selected": active
|
|
75
|
-
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
76
|
-
href: !disabled && href ? href : undefined,
|
|
77
|
-
disabled: disabled,
|
|
78
|
-
iconPosition: iconPosition,
|
|
79
|
-
hasIcon: hasIcons,
|
|
80
|
-
ref: function ref(anchorRef) {
|
|
81
|
-
tabRef.current = anchorRef;
|
|
82
|
-
|
|
83
|
-
if (_ref2) {
|
|
84
|
-
if (typeof _ref2 === "function") _ref2(anchorRef);else {
|
|
85
|
-
_ref2.current = anchorRef;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
onKeyDown: handleOnKeyDown,
|
|
90
|
-
tabIndex: active ? tabIndex : -1
|
|
91
|
-
}, otherProps), icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
92
|
-
iconPosition: iconPosition
|
|
93
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(TabIcon, {
|
|
94
|
-
src: icon
|
|
95
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(LabelContainer, null, children, notificationNumber && /*#__PURE__*/_react["default"].createElement(BadgeContainer, null, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
96
|
-
notificationText: notificationNumber > 99 ? "+99" : notificationNumber,
|
|
97
|
-
disabled: disabled
|
|
98
|
-
})))));
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom: 2px solid ", ";\n"])), function (props) {
|
|
102
|
-
return props.active ? "#6f2c91" : "#0000001a";
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n\n font-family: \"Open Sans\";\n font-style: normal;\n font-weight: 400;\n font-size: 1rem;\n color: ", ";\n text-decoration-color: transparent;\n cursor: ", ";\n\n height: ", ";\n min-width: 164px;\n margin: 0.5rem;\n padding: 0.375rem;\n\n border-radius: 4px;\n\n ", "\n"])), function (props) {
|
|
106
|
-
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
107
|
-
}, function (props) {
|
|
108
|
-
return props.disabled ? "#0000004D" : "#333333";
|
|
109
|
-
}, function (props) {
|
|
110
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.hasIcon && props.iconPosition === "top" ? "66px" : "32px";
|
|
113
|
-
}, function (props) {
|
|
114
|
-
return !props.disabled && ":hover {\n background: #0000000D;\n }\n\n :focus {\n outline: 2px solid #33aaff};\n }\n\n :active {\n background: #0000001A;\n outline: 2px solid #33aaff};\n }";
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
var TabIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
118
|
-
|
|
119
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-bottom: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n align-items: center;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
120
|
-
return props.iconPosition === "top" && "0.375rem";
|
|
121
|
-
}, function (props) {
|
|
122
|
-
return props.iconPosition === "left" && "0.625rem";
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
var LabelContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
|
|
126
|
-
|
|
127
|
-
var BadgeContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 0.5rem;\n"])));
|
|
128
|
-
|
|
129
|
-
var _default = DxcTab;
|
|
130
|
-
exports["default"] = _default;
|