@dxc-technology/halstack-react 0.0.0-c25d3b6 → 0.0.0-c2834c3
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/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +298 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +11 -11
- package/accordion/Accordion.test.js +19 -4
- package/accordion/types.d.ts +4 -0
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +13 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +24 -6
- package/accordion-group/types.d.ts +4 -0
- package/alert/Alert.js +4 -1
- package/button/Button.js +14 -11
- package/card/Card.js +27 -28
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +13 -0
- package/checkbox/types.d.ts +7 -3
- package/common/variables.js +181 -70
- package/date-input/DateInput.js +38 -20
- package/date-input/DateInput.test.js +9 -22
- package/date-input/types.d.ts +12 -9
- package/dialog/Dialog.js +4 -32
- package/dropdown/Dropdown.js +13 -17
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +15 -88
- package/header/Header.js +27 -48
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +18 -2
- package/inset/types.d.ts +24 -0
- package/layout/ApplicationLayout.js +5 -18
- package/link/Link.d.ts +3 -2
- package/link/Link.js +65 -56
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +8 -23
- package/main.d.ts +3 -2
- package/main.js +19 -5
- package/number-input/NumberInput.test.js +2 -4
- package/number-input/types.d.ts +13 -10
- package/package.json +6 -5
- package/paginator/Paginator.js +17 -38
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +3 -6
- package/password-input/types.d.ts +14 -11
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +116 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio/Radio.js +10 -11
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +8 -6
- package/row/types.d.ts +18 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.js +1 -1
- package/select/Select.js +53 -139
- package/select/Select.stories.tsx +14 -2
- package/select/Select.test.js +83 -42
- package/select/types.d.ts +33 -11
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +2 -1
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +31 -10
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +35 -19
- package/switch/Switch.stories.tsx +14 -14
- package/switch/Switch.test.js +25 -0
- package/switch/types.d.ts +6 -2
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +26 -9
- package/tabs/types.d.ts +4 -0
- package/tag/Tag.js +5 -8
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +48 -76
- package/text-input/TextInput.test.js +22 -35
- package/text-input/types.d.ts +27 -12
- package/textarea/Textarea.js +12 -23
- package/textarea/Textarea.test.js +10 -20
- package/textarea/types.d.ts +14 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +35 -4
- package/toggle-group/types.d.ts +8 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +55 -44
- package/wizard/Wizard.stories.tsx +13 -23
- package/wizard/Wizard.test.js +36 -23
- package/wizard/types.d.ts +6 -2
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
package/link/Link.stories.tsx
CHANGED
|
@@ -24,128 +24,163 @@ export const Chromatic = () => (
|
|
|
24
24
|
<Title title="With anchor" theme="light" level={2} />
|
|
25
25
|
<ExampleContainer>
|
|
26
26
|
<Title title="Disabled" theme="light" level={4} />
|
|
27
|
-
<DxcLink
|
|
27
|
+
<DxcLink disabled>Test</DxcLink>
|
|
28
28
|
<Title title="Icon before" theme="light" level={4} />
|
|
29
|
-
<DxcLink
|
|
29
|
+
<DxcLink href="https://www.google.com" icon={icon} iconPosition="before">
|
|
30
|
+
Test
|
|
31
|
+
</DxcLink>
|
|
30
32
|
<Title title="Icon after" theme="light" level={4} />
|
|
31
33
|
<DxcLink
|
|
32
|
-
text="Test"
|
|
33
34
|
href="https://www.youtube.com/"
|
|
34
35
|
icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png"
|
|
35
36
|
iconPosition="after"
|
|
36
|
-
|
|
37
|
+
>
|
|
38
|
+
Test
|
|
39
|
+
</DxcLink>
|
|
37
40
|
</ExampleContainer>
|
|
38
41
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
39
42
|
<Title title="With link hovered" theme="light" level={4} />
|
|
40
|
-
<DxcLink
|
|
43
|
+
<DxcLink href="https://www.dxc.com">Test</DxcLink>
|
|
41
44
|
</ExampleContainer>
|
|
42
45
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
43
46
|
<Title title="With link focused" theme="light" level={4} />
|
|
44
|
-
<DxcLink
|
|
47
|
+
<DxcLink href="https://www.dxc.com">Test</DxcLink>
|
|
45
48
|
</ExampleContainer>
|
|
46
49
|
<ExampleContainer pseudoState="pseudo-active">
|
|
47
50
|
<Title title="With link active" theme="light" level={4} />
|
|
48
|
-
<DxcLink
|
|
51
|
+
<DxcLink href="https://www.dxc.com">Test</DxcLink>
|
|
49
52
|
</ExampleContainer>
|
|
50
53
|
<ExampleContainer pseudoState="pseudo-visited">
|
|
51
54
|
<Title title="With link visited" theme="light" level={4} />
|
|
52
|
-
<DxcLink
|
|
55
|
+
<DxcLink href="https://www.amazon.com">Test</DxcLink>
|
|
53
56
|
</ExampleContainer>
|
|
54
57
|
<ExampleContainer>
|
|
55
58
|
<Title title="Inherit color" theme="light" level={4} />
|
|
56
|
-
This is a <DxcLink
|
|
59
|
+
This is a <DxcLink inheritColor>Test</DxcLink>.
|
|
57
60
|
</ExampleContainer>
|
|
58
61
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
59
62
|
<Title title="With brackets and focus" theme="light" level={4} />
|
|
60
|
-
This is a (
|
|
63
|
+
This is a (
|
|
64
|
+
<DxcLink inheritColor href="https://www.google.com">
|
|
65
|
+
Test
|
|
66
|
+
</DxcLink>
|
|
67
|
+
).
|
|
61
68
|
</ExampleContainer>
|
|
62
69
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
63
70
|
<Title title="Long text with hover" theme="light" level={4} />
|
|
64
|
-
Lorem <DxcLink
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
Lorem <DxcLink href="https://www.google.com">Test</DxcLink> ipsum dolor sit amet, consectetur adipiscing elit, sed
|
|
72
|
+
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
73
|
+
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
|
|
74
|
+
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
75
|
+
officia deserunt mollit anim id est laborum.
|
|
69
76
|
</ExampleContainer>
|
|
70
77
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
71
78
|
<Title title="Long text with focus" theme="light" level={4} />
|
|
72
|
-
Lorem <DxcLink
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
Lorem <DxcLink href="https://www.google.com">Test</DxcLink> ipsum dolor sit amet, consectetur adipiscing elit, sed
|
|
80
|
+
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
81
|
+
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
|
|
82
|
+
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
83
|
+
officia deserunt mollit anim id est laborum.
|
|
77
84
|
</ExampleContainer>
|
|
78
85
|
<Title title="With button" theme="light" level={2} />
|
|
79
86
|
<ExampleContainer>
|
|
80
87
|
<Title title="Disabled" theme="light" level={4} />
|
|
81
|
-
<DxcLink
|
|
88
|
+
<DxcLink onClick={() => {}} disabled>
|
|
89
|
+
Test
|
|
90
|
+
</DxcLink>
|
|
82
91
|
<Title title="Icon before" theme="light" level={4} />
|
|
83
|
-
<DxcLink
|
|
92
|
+
<DxcLink onClick={() => {}} icon={icon} iconPosition="before">
|
|
93
|
+
Test
|
|
94
|
+
</DxcLink>
|
|
84
95
|
<Title title="Icon after" theme="light" level={4} />
|
|
85
|
-
<DxcLink
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
href="https://www.youtube.com/"
|
|
89
|
-
icon={icon}
|
|
90
|
-
iconPosition="after"
|
|
91
|
-
></DxcLink>
|
|
96
|
+
<DxcLink onClick={() => {}} icon={icon} iconPosition="after">
|
|
97
|
+
Test
|
|
98
|
+
</DxcLink>
|
|
92
99
|
</ExampleContainer>
|
|
93
100
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
94
101
|
<Title title="With link hovered" theme="light" level={4} />
|
|
95
|
-
<DxcLink
|
|
102
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
96
103
|
</ExampleContainer>
|
|
97
104
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
98
105
|
<Title title="With link focused" theme="light" level={4} />
|
|
99
|
-
<DxcLink
|
|
106
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
100
107
|
</ExampleContainer>
|
|
101
108
|
<ExampleContainer pseudoState="pseudo-active">
|
|
102
109
|
<Title title="With link active" theme="light" level={4} />
|
|
103
|
-
<DxcLink
|
|
110
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
104
111
|
</ExampleContainer>
|
|
105
112
|
<ExampleContainer pseudoState="pseudo-visited">
|
|
106
113
|
<Title title="With link visited" theme="light" level={4} />
|
|
107
|
-
<DxcLink
|
|
114
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
108
115
|
</ExampleContainer>
|
|
109
116
|
<ExampleContainer>
|
|
110
117
|
<Title title="Inherit color" theme="light" level={4} />
|
|
111
|
-
This is a
|
|
118
|
+
This is a{" "}
|
|
119
|
+
<DxcLink onClick={() => {}} inheritColor>
|
|
120
|
+
Test
|
|
121
|
+
</DxcLink>
|
|
122
|
+
.
|
|
112
123
|
</ExampleContainer>
|
|
113
124
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
114
125
|
<Title title="With brackets and focus" theme="light" level={4} />
|
|
115
|
-
This is a (
|
|
126
|
+
This is a (
|
|
127
|
+
<DxcLink onClick={() => {}} inheritColor>
|
|
128
|
+
Test
|
|
129
|
+
</DxcLink>
|
|
130
|
+
).
|
|
116
131
|
</ExampleContainer>
|
|
117
132
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
118
133
|
<Title title="Long text with hover" theme="light" level={4} />
|
|
119
|
-
Lorem
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
Lorem{" "}
|
|
135
|
+
<DxcLink onClick={() => {}} href="https://www.google.com">
|
|
136
|
+
Test
|
|
137
|
+
</DxcLink>{" "}
|
|
138
|
+
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
|
139
|
+
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
140
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
141
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
124
142
|
</ExampleContainer>
|
|
125
143
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
126
144
|
<Title title="Long text with focus" theme="light" level={4} />
|
|
127
|
-
Lorem
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
Lorem{" "}
|
|
146
|
+
<DxcLink onClick={() => {}} href="https://www.google.com">
|
|
147
|
+
Test
|
|
148
|
+
</DxcLink>{" "}
|
|
149
|
+
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
|
150
|
+
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
151
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
152
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
132
153
|
</ExampleContainer>
|
|
133
154
|
<Title title="Margins" theme="light" level={2} />
|
|
134
155
|
<ExampleContainer>
|
|
135
156
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
136
|
-
<DxcLink
|
|
157
|
+
<DxcLink margin="xxsmall" href="https://www.facebook.com/">
|
|
158
|
+
Test
|
|
159
|
+
</DxcLink>
|
|
137
160
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
138
|
-
<DxcLink
|
|
161
|
+
<DxcLink margin="xsmall" href="https://www.linkedin.com/">
|
|
162
|
+
Test
|
|
163
|
+
</DxcLink>
|
|
139
164
|
<Title title="Small margin" theme="light" level={4} />
|
|
140
|
-
<DxcLink
|
|
165
|
+
<DxcLink margin="small" href="https://www.linkedin.com/">
|
|
166
|
+
Test
|
|
167
|
+
</DxcLink>
|
|
141
168
|
<Title title="Medium margin" theme="light" level={4} />
|
|
142
|
-
<DxcLink
|
|
169
|
+
<DxcLink margin="medium" href="https://www.linkedin.com/">
|
|
170
|
+
Test
|
|
171
|
+
</DxcLink>
|
|
143
172
|
<Title title="Large margin" theme="light" level={4} />
|
|
144
|
-
<DxcLink
|
|
173
|
+
<DxcLink margin="large" href="https://www.linkedin.com/">
|
|
174
|
+
Test
|
|
175
|
+
</DxcLink>
|
|
145
176
|
<Title title="Xlarge margin" theme="light" level={4} />
|
|
146
|
-
<DxcLink
|
|
177
|
+
<DxcLink margin="xlarge" href="https://www.linkedin.com/">
|
|
178
|
+
Test
|
|
179
|
+
</DxcLink>
|
|
147
180
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
148
|
-
<DxcLink
|
|
181
|
+
<DxcLink margin="xxlarge" href="https://www.linkedin.com/">
|
|
182
|
+
Test
|
|
183
|
+
</DxcLink>
|
|
149
184
|
</ExampleContainer>
|
|
150
185
|
</>
|
|
151
186
|
);
|
package/link/Link.test.js
CHANGED
|
@@ -10,49 +10,43 @@ var _Link = _interopRequireDefault(require("./Link"));
|
|
|
10
10
|
|
|
11
11
|
describe("Link component tests", function () {
|
|
12
12
|
test("Link renders with correct text", function () {
|
|
13
|
-
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"],
|
|
14
|
-
text: "Link"
|
|
15
|
-
})),
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link")),
|
|
16
14
|
getByText = _render.getByText;
|
|
17
15
|
|
|
18
16
|
expect(getByText("Link")).toBeTruthy();
|
|
19
17
|
});
|
|
20
18
|
test("Link renders with correct href", function () {
|
|
21
19
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
22
|
-
text: "Link",
|
|
23
20
|
href: "/testPage"
|
|
24
|
-
})),
|
|
21
|
+
}, "Link")),
|
|
25
22
|
getByRole = _render2.getByRole;
|
|
26
23
|
|
|
27
24
|
expect(getByRole("link").getAttribute("href")).toEqual("/testPage");
|
|
28
25
|
});
|
|
29
26
|
test("Link renders with correct disabled state", function () {
|
|
30
27
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
31
|
-
text: "Link",
|
|
32
28
|
href: "/testPage",
|
|
33
29
|
disabled: true
|
|
34
|
-
})),
|
|
30
|
+
}, "Link")),
|
|
35
31
|
getByText = _render3.getByText;
|
|
36
32
|
|
|
37
33
|
expect(getByText("Link").hasAttribute("href")).toBeFalsy();
|
|
38
34
|
|
|
39
35
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
40
|
-
text: "LinkButton",
|
|
41
36
|
onClick: function onClick() {
|
|
42
37
|
return console.log("Andorra");
|
|
43
38
|
},
|
|
44
39
|
disabled: true
|
|
45
|
-
})),
|
|
40
|
+
}, "LinkButton")),
|
|
46
41
|
getByTextLinkButton = _render4.getByText;
|
|
47
42
|
|
|
48
43
|
expect(getByTextLinkButton("LinkButton").hasAttribute("onclick")).toBeFalsy();
|
|
49
44
|
});
|
|
50
45
|
test("Link open new tab", function () {
|
|
51
46
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
52
|
-
text: "Link",
|
|
53
47
|
href: "/testPage",
|
|
54
48
|
newWindow: true
|
|
55
|
-
})),
|
|
49
|
+
}, "Link")),
|
|
56
50
|
getByRole = _render5.getByRole;
|
|
57
51
|
|
|
58
52
|
expect(getByRole("link").getAttribute("target")).toEqual("_blank");
|
|
@@ -61,9 +55,8 @@ describe("Link component tests", function () {
|
|
|
61
55
|
var onClick = jest.fn();
|
|
62
56
|
|
|
63
57
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
64
|
-
text: "Link",
|
|
65
58
|
onClick: onClick
|
|
66
|
-
})),
|
|
59
|
+
}, "Link")),
|
|
67
60
|
getByText = _render6.getByText;
|
|
68
61
|
|
|
69
62
|
var link = getByText("Link");
|
|
@@ -76,10 +69,9 @@ describe("Link component tests", function () {
|
|
|
76
69
|
var onClick = jest.fn();
|
|
77
70
|
|
|
78
71
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
79
|
-
text: "Link",
|
|
80
72
|
onClick: onClick,
|
|
81
73
|
disabled: true
|
|
82
|
-
})),
|
|
74
|
+
}, "Link")),
|
|
83
75
|
getByText = _render7.getByText;
|
|
84
76
|
|
|
85
77
|
var link = getByText("Link");
|
package/link/types.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Margin = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
10
|
+
export declare type LinkProps = {
|
|
10
11
|
/**
|
|
11
12
|
* If true, the color is inherited from parent.
|
|
12
13
|
*/
|
|
@@ -41,30 +42,14 @@ declare type LinkCommonProps = {
|
|
|
41
42
|
* Value of the tabindex.
|
|
42
43
|
*/
|
|
43
44
|
tabIndex?: number;
|
|
44
|
-
};
|
|
45
|
-
export declare type LinkTextProps = LinkCommonProps & {
|
|
46
45
|
/**
|
|
47
|
-
* Link
|
|
46
|
+
* Content of the link. To use the component with other libraries (such as React Router or Next.js Link) pass the custom link as a child.
|
|
47
|
+
* The component will apply the styles to the custom link.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
children?: React.ReactNode;
|
|
50
50
|
/**
|
|
51
51
|
* Element or path used as the icon that will be placed next to the link text.
|
|
52
52
|
*/
|
|
53
53
|
icon?: string | SVG;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
56
|
-
/**
|
|
57
|
-
* Link text.
|
|
58
|
-
*/
|
|
59
|
-
text?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Element or path used as the icon that will be placed next to the link text.
|
|
62
|
-
*/
|
|
63
|
-
icon: string | SVG;
|
|
64
|
-
};
|
|
65
|
-
declare type Overload = {
|
|
66
|
-
(props: LinkTextProps): JSX.Element;
|
|
67
|
-
(props: LinkIconProps): JSX.Element;
|
|
68
|
-
};
|
|
69
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
70
|
-
export default Overload;
|
|
55
|
+
export {};
|
package/main.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ import DxcList from "./list/List";
|
|
|
41
41
|
import DxcRadioGroup from "./radio-group/RadioGroup";
|
|
42
42
|
import DxcBleed from "./bleed/Bleed";
|
|
43
43
|
import DxcInset from "./inset/Inset";
|
|
44
|
-
import
|
|
44
|
+
import DxcQuickNav from "./quick-nav/QuickNav";
|
|
45
|
+
import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
|
|
45
46
|
import { BackgroundColorProvider } from "./BackgroundColorContext";
|
|
46
|
-
export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout,
|
|
47
|
+
export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcStack, DxcRow, DxcText, DxcList, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, };
|
package/main.js
CHANGED
|
@@ -163,6 +163,12 @@ Object.defineProperty(exports, "DxcProgressBar", {
|
|
|
163
163
|
return _ProgressBar["default"];
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
|
+
Object.defineProperty(exports, "DxcQuickNav", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function get() {
|
|
169
|
+
return _QuickNav["default"];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
166
172
|
Object.defineProperty(exports, "DxcRadio", {
|
|
167
173
|
enumerable: true,
|
|
168
174
|
get: function get() {
|
|
@@ -271,16 +277,22 @@ Object.defineProperty(exports, "DxcWizard", {
|
|
|
271
277
|
return _Wizard["default"];
|
|
272
278
|
}
|
|
273
279
|
});
|
|
274
|
-
Object.defineProperty(exports, "
|
|
280
|
+
Object.defineProperty(exports, "HalstackContext", {
|
|
275
281
|
enumerable: true,
|
|
276
282
|
get: function get() {
|
|
277
|
-
return
|
|
283
|
+
return _HalstackContext["default"];
|
|
278
284
|
}
|
|
279
285
|
});
|
|
280
|
-
Object.defineProperty(exports, "
|
|
286
|
+
Object.defineProperty(exports, "HalstackLanguageContext", {
|
|
281
287
|
enumerable: true,
|
|
282
288
|
get: function get() {
|
|
283
|
-
return
|
|
289
|
+
return _HalstackContext.HalstackLanguageContext;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(exports, "HalstackProvider", {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function get() {
|
|
295
|
+
return _HalstackContext.HalstackProvider;
|
|
284
296
|
}
|
|
285
297
|
});
|
|
286
298
|
|
|
@@ -370,7 +382,9 @@ var _Bleed = _interopRequireDefault(require("./bleed/Bleed"));
|
|
|
370
382
|
|
|
371
383
|
var _Inset = _interopRequireDefault(require("./inset/Inset"));
|
|
372
384
|
|
|
373
|
-
var
|
|
385
|
+
var _QuickNav = _interopRequireDefault(require("./quick-nav/QuickNav"));
|
|
386
|
+
|
|
387
|
+
var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
|
|
374
388
|
|
|
375
389
|
var _BackgroundColorContext = require("./BackgroundColorContext");
|
|
376
390
|
|
|
@@ -135,16 +135,14 @@ describe("Number input component tests", function () {
|
|
|
135
135
|
_userEvent["default"].type(number, "t");
|
|
136
136
|
|
|
137
137
|
expect(onChange).not.toHaveBeenCalledWith({
|
|
138
|
-
value: "t"
|
|
139
|
-
error: null
|
|
138
|
+
value: "t"
|
|
140
139
|
});
|
|
141
140
|
expect(number.value).toBe("");
|
|
142
141
|
|
|
143
142
|
_userEvent["default"].type(number, "1");
|
|
144
143
|
|
|
145
144
|
expect(onChange).toHaveBeenCalledWith({
|
|
146
|
-
value: "1"
|
|
147
|
-
error: null
|
|
145
|
+
value: "1"
|
|
148
146
|
});
|
|
149
147
|
expect(number.value).toBe("1");
|
|
150
148
|
});
|
package/number-input/types.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare type Props = {
|
|
|
54
54
|
* lower than min, the onBlur and onChange functions will be called with
|
|
55
55
|
* the current value and an internal error informing that the current
|
|
56
56
|
* value is not correct. If a valid state is reached, the error parameter
|
|
57
|
-
* will be
|
|
57
|
+
* will not be defined in both events.
|
|
58
58
|
*/
|
|
59
59
|
min?: number;
|
|
60
60
|
/**
|
|
@@ -62,7 +62,7 @@ declare type Props = {
|
|
|
62
62
|
* surpasses max, the onBlur and onChange functions will be called with
|
|
63
63
|
* the current value and an internal error informing that the current
|
|
64
64
|
* value is not correct. If a valid state is reached, the error parameter
|
|
65
|
-
* will be
|
|
65
|
+
* will not be defined in both events.
|
|
66
66
|
*/
|
|
67
67
|
max?: number;
|
|
68
68
|
/**
|
|
@@ -73,26 +73,29 @@ declare type Props = {
|
|
|
73
73
|
* This function will be called when the user types within the input
|
|
74
74
|
* element of the component. An object including the current value and
|
|
75
75
|
* the error (if the value entered is not valid) will be passed to this
|
|
76
|
-
* function. If there is no error, error will be
|
|
76
|
+
* function. If there is no error, error will not be defined.
|
|
77
77
|
*/
|
|
78
78
|
onChange?: (val: {
|
|
79
79
|
value: string;
|
|
80
|
-
error
|
|
80
|
+
error?: string;
|
|
81
81
|
}) => void;
|
|
82
82
|
/**
|
|
83
83
|
* This function will be called when the input element loses the focus.
|
|
84
84
|
* An object including the input value and the error (if the value
|
|
85
85
|
* entered is not valid) will be passed to this function. If there is no error,
|
|
86
|
-
* error will be
|
|
86
|
+
* error will not be defined.
|
|
87
87
|
*/
|
|
88
88
|
onBlur?: (val: {
|
|
89
89
|
value: string;
|
|
90
|
-
error
|
|
90
|
+
error?: string;
|
|
91
91
|
}) => void;
|
|
92
92
|
/**
|
|
93
|
-
* If it is defined
|
|
94
|
-
* the error below the input component. If
|
|
95
|
-
*
|
|
93
|
+
* If it is a defined value and also a truthy string, the component will
|
|
94
|
+
* change its appearance, showing the error below the input component. If
|
|
95
|
+
* the defined value is an empty string, it will reserve a space below
|
|
96
|
+
* the component for a future error, but it would not change its look. In
|
|
97
|
+
* case of being undefined or null, both the appearance and the space for
|
|
98
|
+
* the error message would not be modified.
|
|
96
99
|
*/
|
|
97
100
|
error?: string;
|
|
98
101
|
/**
|
|
@@ -106,7 +109,7 @@ declare type Props = {
|
|
|
106
109
|
*/
|
|
107
110
|
margin?: Space | Margin;
|
|
108
111
|
/**
|
|
109
|
-
* Size of the component
|
|
112
|
+
* Size of the component.
|
|
110
113
|
*/
|
|
111
114
|
size?: "small" | "medium" | "large" | "fillParent";
|
|
112
115
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-c2834c3",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
6
|
"homepage": "http://developer.dxc.com/tools/react",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"styled-components": "^5.0.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@date-io/
|
|
21
|
+
"@date-io/dayjs": "^1.3.9",
|
|
22
22
|
"@material-ui/core": "4.11.1",
|
|
23
23
|
"@material-ui/icons": "4.4.3",
|
|
24
24
|
"@material-ui/lab": "4.0.0-alpha.17",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"@types/styled-components": "^5.1.24",
|
|
28
28
|
"@types/uuid": "^8.3.4",
|
|
29
29
|
"color": "^3.1.3",
|
|
30
|
-
"
|
|
31
|
-
"moment": "2.24.0",
|
|
30
|
+
"dayjs": "^1.11.1",
|
|
32
31
|
"prop-types": "^15.7.2",
|
|
33
32
|
"rgb-hex": "^3.0.0",
|
|
33
|
+
"slugify": "^1.6.5",
|
|
34
34
|
"uuid": "^8.3.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "jest",
|
|
38
38
|
"test:watch": "npm test -- --watch --coverage",
|
|
39
39
|
"build": "babel src --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose && node ../scripts/build/copy-package.js && tsc ",
|
|
40
|
-
"build:watch": "babel src --watch --out-dir ../dist --copy-files --verbose",
|
|
40
|
+
"build:watch": "babel src --watch --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose",
|
|
41
41
|
"storybook": "start-storybook -p 6006",
|
|
42
42
|
"build-storybook": "build-storybook"
|
|
43
43
|
},
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@storybook/testing-library": "0.0.7",
|
|
58
58
|
"@testing-library/react": "^11.2.5",
|
|
59
59
|
"@testing-library/user-event": "^12.6.3",
|
|
60
|
+
"@types/react": "16.9.5",
|
|
60
61
|
"babel-jest": "^24.8.0",
|
|
61
62
|
"babel-loader": "^8.0.6",
|
|
62
63
|
"chromatic": "^6.3.3",
|