@dxc-technology/halstack-react 12.0.2 → 12.2.0
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 +23 -0
- package/HalstackContext.js +31 -21
- package/breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/breadcrumbs/Breadcrumbs.test.js +1 -2
- package/breadcrumbs/types.d.ts +24 -0
- package/card/Card.stories.tsx +1 -1
- package/chip/Chip.stories.tsx +2 -6
- package/common/coreTokens.d.ts +0 -1
- package/common/coreTokens.js +0 -1
- package/common/variables.d.ts +29 -0
- package/common/variables.js +25 -2
- package/container/types.d.ts +113 -11
- package/contextual-menu/ContextualMenu.js +56 -8
- package/contextual-menu/ContextualMenu.stories.tsx +50 -51
- package/contextual-menu/ContextualMenu.test.js +108 -66
- package/contextual-menu/GroupItem.js +9 -9
- package/contextual-menu/ItemAction.d.ts +1 -1
- package/contextual-menu/ItemAction.js +52 -15
- package/contextual-menu/SingleItem.d.ts +1 -1
- package/contextual-menu/SingleItem.js +14 -14
- package/contextual-menu/types.d.ts +13 -6
- package/date-input/Calendar.js +46 -30
- package/date-input/DateInput.accessibility.test.js +12 -13
- package/date-input/DateInput.js +9 -3
- package/date-input/DateInput.stories.tsx +5 -6
- package/date-input/DateInput.test.js +30 -31
- package/date-input/YearPicker.js +9 -4
- package/dialog/Dialog.stories.tsx +2 -3
- package/dialog/Dialog.test.js +1 -2
- package/divider/Divider.stories.tsx +2 -1
- package/dropdown/Dropdown.accessibility.test.js +1 -2
- package/dropdown/Dropdown.stories.tsx +1 -1
- package/dropdown/Dropdown.test.js +1 -2
- package/file-input/FileInput.js +1 -3
- package/file-input/FileItem.js +1 -1
- package/file-input/types.d.ts +0 -4
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.stories.tsx +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/number-input/NumberInput.accessibility.test.js +1 -2
- package/number-input/NumberInput.js +5 -2
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.js +1 -2
- package/package.json +19 -16
- package/paginator/Paginator.accessibility.test.js +1 -2
- package/paginator/Paginator.test.js +1 -2
- package/password-input/PasswordInput.accessibility.test.js +1 -2
- package/password-input/PasswordInput.js +6 -3
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.js +1 -2
- package/resultset-table/ResultsetTable.accessibility.test.js +1 -2
- package/resultset-table/ResultsetTable.js +33 -9
- package/resultset-table/ResultsetTable.stories.tsx +2 -2
- package/resultset-table/ResultsetTable.test.js +102 -32
- package/resultset-table/types.d.ts +3 -2
- package/select/Select.accessibility.test.js +1 -2
- package/select/Select.js +3 -1
- package/select/Select.stories.tsx +11 -2
- package/select/Select.test.js +1 -2
- package/sidenav/Sidenav.stories.tsx +1 -1
- package/slider/Slider.accessibility.test.js +1 -2
- package/slider/Slider.test.js +1 -2
- package/table/Table.accessibility.test.js +1 -2
- package/table/Table.stories.tsx +1 -1
- package/table/Table.test.js +1 -2
- package/tabs/Tabs.stories.tsx +2 -2
- package/tag/Tag.stories.tsx +1 -1
- package/text-input/TextInput.accessibility.test.js +1 -2
- package/text-input/TextInput.js +3 -1
- package/text-input/TextInput.stories.tsx +11 -8
- package/text-input/TextInput.test.js +1 -2
- package/toggle-group/ToggleGroup.stories.tsx +1 -1
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.stories.tsx +1 -3
- package/typography/Typography.test.js +23 -0
- package/useTheme.d.ts +23 -0
- package/utils/BaseTypography.js +44 -40
- package/utils/FocusLock.js +2 -1
- package/wizard/Wizard.stories.tsx +1 -1
|
@@ -9,6 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
10
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
11
11
|
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
|
+
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
12
13
|
// Mocking DOMRect for Radix Primitive Popover
|
|
13
14
|
global.globalThis = global;
|
|
14
15
|
global.DOMRect = {
|
|
@@ -27,7 +28,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
28
|
function ResizeObserver() {
|
|
28
29
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
30
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
31
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
32
|
key: "observe",
|
|
32
33
|
value: function observe() {}
|
|
33
34
|
}, {
|
|
@@ -37,7 +38,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
38
|
key: "disconnect",
|
|
38
39
|
value: function disconnect() {}
|
|
39
40
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
41
|
}();
|
|
42
42
|
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
43
43
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -152,36 +152,55 @@ var rows = [[{
|
|
|
152
152
|
displayValue: "Barcelona",
|
|
153
153
|
sortValue: "Barcelona"
|
|
154
154
|
}]];
|
|
155
|
-
var
|
|
156
|
-
displayValue: "
|
|
157
|
-
|
|
155
|
+
var columnsWithCheckbox = [{
|
|
156
|
+
displayValue: "Id",
|
|
157
|
+
isSortable: true
|
|
158
|
+
}, {
|
|
159
|
+
displayValue: "Checkbox",
|
|
160
|
+
isSortable: false
|
|
158
161
|
}, {
|
|
159
|
-
displayValue: "
|
|
160
|
-
|
|
162
|
+
displayValue: "Name",
|
|
163
|
+
isSortable: false
|
|
161
164
|
}, {
|
|
162
|
-
displayValue: "
|
|
163
|
-
|
|
165
|
+
displayValue: "City",
|
|
166
|
+
isSortable: false
|
|
167
|
+
}];
|
|
168
|
+
var rowsWithCheckbox = [[{
|
|
169
|
+
displayValue: "001",
|
|
170
|
+
sortValue: "001"
|
|
171
|
+
}, {
|
|
172
|
+
displayValue: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
173
|
+
size: "fillParent",
|
|
174
|
+
defaultChecked: true
|
|
175
|
+
})
|
|
176
|
+
}, {
|
|
177
|
+
displayValue: "Peter"
|
|
178
|
+
}, {
|
|
179
|
+
displayValue: "Miami"
|
|
164
180
|
}], [{
|
|
165
|
-
displayValue: "
|
|
166
|
-
sortValue: "
|
|
181
|
+
displayValue: "002",
|
|
182
|
+
sortValue: "002"
|
|
167
183
|
}, {
|
|
168
|
-
displayValue: "
|
|
169
|
-
|
|
184
|
+
displayValue: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
185
|
+
size: "fillParent"
|
|
186
|
+
})
|
|
170
187
|
}, {
|
|
171
|
-
displayValue: "
|
|
172
|
-
sortValue: "OtherValue"
|
|
188
|
+
displayValue: "Louis"
|
|
173
189
|
}, {
|
|
174
|
-
displayValue: ""
|
|
190
|
+
displayValue: "London"
|
|
175
191
|
}], [{
|
|
176
|
-
displayValue: "
|
|
177
|
-
sortValue: "
|
|
192
|
+
displayValue: "003",
|
|
193
|
+
sortValue: "003"
|
|
194
|
+
}, {
|
|
195
|
+
displayValue: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
196
|
+
size: "fillParent"
|
|
197
|
+
})
|
|
178
198
|
}, {
|
|
179
|
-
displayValue: "
|
|
180
|
-
sortValue: "OtherValue"
|
|
199
|
+
displayValue: "Lana"
|
|
181
200
|
}, {
|
|
182
|
-
displayValue: "
|
|
183
|
-
sortValue: "OtherValue"
|
|
201
|
+
displayValue: "Amsterdam"
|
|
184
202
|
}]];
|
|
203
|
+
var rows2 = [].concat(rows).slice(0, -1);
|
|
185
204
|
describe("Resultset table component tests", function () {
|
|
186
205
|
test("Resultset table rendered correctly", function () {
|
|
187
206
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
@@ -285,42 +304,93 @@ describe("Resultset table component tests", function () {
|
|
|
285
304
|
expect(component.queryByText("Tina")).toBeTruthy();
|
|
286
305
|
expect(component.queryByText("Cosmin")).not.toBeTruthy();
|
|
287
306
|
});
|
|
288
|
-
test("Resultset table
|
|
307
|
+
test("Resultset table should go one page back when removing the last page data", function () {
|
|
289
308
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
290
309
|
columns: columns,
|
|
291
310
|
rows: rows,
|
|
292
311
|
itemsPerPage: 3
|
|
293
312
|
})),
|
|
313
|
+
getAllByRole = _render6.getAllByRole,
|
|
294
314
|
queryByText = _render6.queryByText,
|
|
295
315
|
rerender = _render6.rerender;
|
|
316
|
+
expect(queryByText("1 to 3 of 10")).toBeTruthy();
|
|
317
|
+
var lastButton = getAllByRole("button")[4];
|
|
296
318
|
expect(queryByText("Peter")).toBeTruthy();
|
|
319
|
+
_react2.fireEvent.click(lastButton);
|
|
320
|
+
expect(queryByText("10 to 10 of 10")).toBeTruthy();
|
|
297
321
|
rerender( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
298
322
|
columns: columns,
|
|
299
323
|
rows: rows2,
|
|
300
324
|
itemsPerPage: 3
|
|
301
325
|
}));
|
|
302
|
-
expect(queryByText("
|
|
326
|
+
expect(queryByText("7 to 9 of 9")).toBeTruthy();
|
|
303
327
|
});
|
|
304
|
-
test("Resultset table
|
|
328
|
+
test("Resultset table shouldn't go one page back when there is data left in the last page", function () {
|
|
305
329
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
330
|
+
columns: columns,
|
|
331
|
+
rows: rows,
|
|
332
|
+
itemsPerPage: 2
|
|
333
|
+
})),
|
|
334
|
+
getAllByRole = _render7.getAllByRole,
|
|
335
|
+
queryByText = _render7.queryByText,
|
|
336
|
+
rerender = _render7.rerender;
|
|
337
|
+
expect(queryByText("1 to 2 of 10")).toBeTruthy();
|
|
338
|
+
var lastButton = getAllByRole("button")[4];
|
|
339
|
+
expect(queryByText("Peter")).toBeTruthy();
|
|
340
|
+
_react2.fireEvent.click(lastButton);
|
|
341
|
+
expect(queryByText("9 to 10 of 10")).toBeTruthy();
|
|
342
|
+
rerender( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
343
|
+
columns: columns,
|
|
344
|
+
rows: rows2,
|
|
345
|
+
itemsPerPage: 2
|
|
346
|
+
}));
|
|
347
|
+
expect(queryByText("9 to 9 of 9")).toBeTruthy();
|
|
348
|
+
});
|
|
349
|
+
test("Resultset table uncontrolled components maintain its value when sorting", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
350
|
+
var _render8, getAllByRole, columnHeader, sortButton;
|
|
351
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
352
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
353
|
+
case 0:
|
|
354
|
+
_render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
355
|
+
columns: columnsWithCheckbox,
|
|
356
|
+
rows: rowsWithCheckbox,
|
|
357
|
+
itemsPerPage: 3
|
|
358
|
+
})), getAllByRole = _render8.getAllByRole;
|
|
359
|
+
columnHeader = getAllByRole("columnheader")[0];
|
|
360
|
+
sortButton = getAllByRole("button")[0];
|
|
361
|
+
expect(getAllByRole("checkbox")[0].getAttribute("aria-checked")).toBe("true");
|
|
362
|
+
expect(columnHeader.getAttribute("aria-sort")).toBe("none");
|
|
363
|
+
_react2.fireEvent.click(sortButton);
|
|
364
|
+
expect(columnHeader.getAttribute("aria-sort")).toBe("ascending");
|
|
365
|
+
_react2.fireEvent.click(sortButton);
|
|
366
|
+
expect(columnHeader.getAttribute("aria-sort")).toBe("descending");
|
|
367
|
+
expect(getAllByRole("checkbox")[0].getAttribute("aria-checked")).toBe("false");
|
|
368
|
+
case 10:
|
|
369
|
+
case "end":
|
|
370
|
+
return _context2.stop();
|
|
371
|
+
}
|
|
372
|
+
}, _callee2);
|
|
373
|
+
})));
|
|
374
|
+
test("Resultset table change itemsPerPage should go to first page", function () {
|
|
375
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
306
376
|
columns: columns,
|
|
307
377
|
rows: rows,
|
|
308
378
|
itemsPerPage: 3,
|
|
309
379
|
itemsPerPageOptions: [2, 3]
|
|
310
380
|
})),
|
|
311
|
-
getAllByRole =
|
|
381
|
+
getAllByRole = _render9.getAllByRole;
|
|
312
382
|
var lastButton = getAllByRole("button")[4];
|
|
313
383
|
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
314
384
|
_react2.fireEvent.click(lastButton);
|
|
315
385
|
expect(getAllByRole("row").length - 1).toEqual(1);
|
|
316
386
|
});
|
|
317
387
|
test("Resultset table may not use the paginator", function () {
|
|
318
|
-
var
|
|
388
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
319
389
|
columns: columns,
|
|
320
390
|
rows: rows,
|
|
321
391
|
hidePaginator: true
|
|
322
392
|
})),
|
|
323
|
-
getAllByRole =
|
|
393
|
+
getAllByRole = _render10.getAllByRole;
|
|
324
394
|
var nextButton = getAllByRole("button")[3];
|
|
325
395
|
expect(nextButton).not.toBeTruthy();
|
|
326
396
|
});
|
|
@@ -357,14 +427,14 @@ describe("Resultset table component tests", function () {
|
|
|
357
427
|
}),
|
|
358
428
|
sortValue: "Actions"
|
|
359
429
|
}]];
|
|
360
|
-
var
|
|
430
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
361
431
|
columns: columns,
|
|
362
432
|
rows: actionRows,
|
|
363
433
|
itemsPerPage: 3
|
|
364
434
|
})),
|
|
365
|
-
getAllByRole =
|
|
366
|
-
getByRole =
|
|
367
|
-
getByText =
|
|
435
|
+
getAllByRole = _render11.getAllByRole,
|
|
436
|
+
getByRole = _render11.getByRole,
|
|
437
|
+
getByText = _render11.getByText;
|
|
368
438
|
var dropdown = getAllByRole("button")[2];
|
|
369
439
|
(0, _react2.act)(function () {
|
|
370
440
|
_userEvent["default"].click(dropdown);
|
|
@@ -16,7 +16,7 @@ export type Column = {
|
|
|
16
16
|
*/
|
|
17
17
|
isSortable?: boolean;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
type Cell = {
|
|
20
20
|
/**
|
|
21
21
|
* Value to be displayed in the cell.
|
|
22
22
|
*/
|
|
@@ -27,6 +27,7 @@ export type Row = {
|
|
|
27
27
|
*/
|
|
28
28
|
sortValue?: string;
|
|
29
29
|
};
|
|
30
|
+
export type Row = Cell[];
|
|
30
31
|
type CommonProps = {
|
|
31
32
|
/**
|
|
32
33
|
* An array of objects representing the columns of the table.
|
|
@@ -36,7 +37,7 @@ type CommonProps = {
|
|
|
36
37
|
* An array of objects representing the rows of the table, you will have
|
|
37
38
|
* as many objects as columns in the table.
|
|
38
39
|
*/
|
|
39
|
-
rows: Row[]
|
|
40
|
+
rows: Row[];
|
|
40
41
|
/**
|
|
41
42
|
* Size of the margin to be applied to the component. You can pass an object with 'top',
|
|
42
43
|
* 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
@@ -130,7 +130,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
130
130
|
function ResizeObserver() {
|
|
131
131
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
132
132
|
}
|
|
133
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
133
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
134
134
|
key: "observe",
|
|
135
135
|
value: function observe() {}
|
|
136
136
|
}, {
|
|
@@ -140,7 +140,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
140
140
|
key: "disconnect",
|
|
141
141
|
value: function disconnect() {}
|
|
142
142
|
}]);
|
|
143
|
-
return ResizeObserver;
|
|
144
143
|
}();
|
|
145
144
|
describe("Select component accessibility tests", function () {
|
|
146
145
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
package/select/Select.js
CHANGED
|
@@ -462,8 +462,10 @@ var sizes = {
|
|
|
462
462
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
463
463
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
464
464
|
};
|
|
465
|
-
var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
465
|
+
var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
466
466
|
return calculateWidth(props.margin, props.size);
|
|
467
|
+
}, function (props) {
|
|
468
|
+
return props.size !== "fillParent" && "min-width:" + calculateWidth(props.margin, props.size);
|
|
467
469
|
}, function (props) {
|
|
468
470
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
469
471
|
}, function (props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcSelect from "./Select";
|
|
@@ -9,6 +9,7 @@ import useTheme from "../useTheme";
|
|
|
9
9
|
import { HalstackProvider } from "../HalstackContext";
|
|
10
10
|
import { disabledRules } from "../../test/accessibility/rules/specific/select/disabledRules";
|
|
11
11
|
import preview from "../../.storybook/preview";
|
|
12
|
+
import DxcFlex from "../flex/Flex";
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
title: "Select",
|
|
@@ -305,6 +306,14 @@ const Select = () => (
|
|
|
305
306
|
<Title title="Fillparent size" theme="light" level={4} />
|
|
306
307
|
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
307
308
|
</ExampleContainer>
|
|
309
|
+
<ExampleContainer>
|
|
310
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
311
|
+
<DxcFlex justifyContent="space-between" gap="1rem">
|
|
312
|
+
<DxcSelect label="fillParent" size="fillParent" options={single_options} />
|
|
313
|
+
<DxcSelect label="medium" size="medium" options={single_options} />
|
|
314
|
+
<DxcSelect label="large" size="large" options={single_options} />
|
|
315
|
+
</DxcFlex>
|
|
316
|
+
</ExampleContainer>
|
|
308
317
|
<Title title="Margins" theme="light" level={2} />
|
|
309
318
|
<ExampleContainer>
|
|
310
319
|
<Title title="xxsmall margin" theme="light" level={4} />
|
|
@@ -402,7 +411,7 @@ const Select = () => (
|
|
|
402
411
|
);
|
|
403
412
|
|
|
404
413
|
const SelectListbox = () => {
|
|
405
|
-
const colorsTheme
|
|
414
|
+
const colorsTheme = useTheme();
|
|
406
415
|
|
|
407
416
|
return (
|
|
408
417
|
<>
|
package/select/Select.test.js
CHANGED
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
var singleOptions = [{
|
|
43
42
|
label: "Option 01",
|
|
@@ -4,7 +4,7 @@ import DxcSelect from "../select/Select";
|
|
|
4
4
|
import DxcInset from "../inset/Inset";
|
|
5
5
|
import Title from "../../.storybook/components/Title";
|
|
6
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
|
-
import { userEvent, within } from "@storybook/
|
|
7
|
+
import { userEvent, within } from "@storybook/test";
|
|
8
8
|
import { HalstackProvider } from "../HalstackContext";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Slider component accessibility tests", function () {
|
|
43
42
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
package/slider/Slider.test.js
CHANGED
|
@@ -25,7 +25,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
25
25
|
function ResizeObserver() {
|
|
26
26
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
27
27
|
}
|
|
28
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
28
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
29
29
|
key: "observe",
|
|
30
30
|
value: function observe() {}
|
|
31
31
|
}, {
|
|
@@ -35,7 +35,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
35
35
|
key: "disconnect",
|
|
36
36
|
value: function disconnect() {}
|
|
37
37
|
}]);
|
|
38
|
-
return ResizeObserver;
|
|
39
38
|
}();
|
|
40
39
|
describe("Slider component tests", function () {
|
|
41
40
|
test("Slider renders with correct text and label id", function () {
|
|
@@ -37,7 +37,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
function ResizeObserver() {
|
|
38
38
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
39
39
|
}
|
|
40
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
40
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
41
41
|
key: "observe",
|
|
42
42
|
value: function observe() {}
|
|
43
43
|
}, {
|
|
@@ -47,7 +47,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
47
47
|
key: "disconnect",
|
|
48
48
|
value: function disconnect() {}
|
|
49
49
|
}]);
|
|
50
|
-
return ResizeObserver;
|
|
51
50
|
}();
|
|
52
51
|
describe("Table component accessibility tests", function () {
|
|
53
52
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
package/table/Table.stories.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import DxcTable from "./Table";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import { HalstackProvider } from "../HalstackContext";
|
|
6
|
-
import { userEvent, within } from "@storybook/
|
|
6
|
+
import { userEvent, within } from "@storybook/test";
|
|
7
7
|
import { disabledRules } from "../../test/accessibility/rules/specific/table/disabledRules";
|
|
8
8
|
import preview from "../../.storybook/preview";
|
|
9
9
|
|
package/table/Table.test.js
CHANGED
|
@@ -26,7 +26,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
26
26
|
function ResizeObserver() {
|
|
27
27
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
28
28
|
}
|
|
29
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
29
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
30
30
|
key: "observe",
|
|
31
31
|
value: function observe() {}
|
|
32
32
|
}, {
|
|
@@ -36,7 +36,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
36
36
|
key: "disconnect",
|
|
37
37
|
value: function disconnect() {}
|
|
38
38
|
}]);
|
|
39
|
-
return ResizeObserver;
|
|
40
39
|
}();
|
|
41
40
|
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
42
41
|
xmlns: "http://www.w3.org/2000/svg",
|
package/tabs/Tabs.stories.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import DxcTabs from "./Tabs";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import { HalstackProvider } from "../HalstackContext";
|
|
6
|
-
import { INITIAL_VIEWPORTS } from
|
|
6
|
+
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: "Tabs",
|
|
@@ -81,7 +81,7 @@ const tabsNotification = tabs.map((tab, index) => ({
|
|
|
81
81
|
}));
|
|
82
82
|
|
|
83
83
|
const tabsIcon = tabs.map((tab, index) =>
|
|
84
|
-
index <= tabs.length / 2 ? { ...tab, icon: "mail" } : { ...tab, icon: iconSVG }
|
|
84
|
+
index <= tabs.length / 2 ? { ...tab, icon: "mail" } : { ...tab, icon: iconSVG },
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const tabsNotificationIcon = tabsNotification.map((tab) => ({ ...tab, icon: iconSVG }));
|
package/tag/Tag.stories.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcTag from "./Tag";
|
|
@@ -45,7 +45,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
45
45
|
function ResizeObserver() {
|
|
46
46
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
47
47
|
}
|
|
48
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
48
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
49
49
|
key: "observe",
|
|
50
50
|
value: function observe() {}
|
|
51
51
|
}, {
|
|
@@ -55,7 +55,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
55
55
|
key: "disconnect",
|
|
56
56
|
value: function disconnect() {}
|
|
57
57
|
}]);
|
|
58
|
-
return ResizeObserver;
|
|
59
58
|
}();
|
|
60
59
|
describe("TextInput component accessibility tests", function () {
|
|
61
60
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
package/text-input/TextInput.js
CHANGED
|
@@ -478,8 +478,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
478
478
|
"aria-live": error ? "assertive" : "off"
|
|
479
479
|
}, error)));
|
|
480
480
|
});
|
|
481
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
481
|
+
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
482
482
|
return calculateWidth(props.margin, props.size);
|
|
483
|
+
}, function (props) {
|
|
484
|
+
return props.size !== "fillParent" && "min-width:" + calculateWidth(props.margin, props.size);
|
|
483
485
|
}, function (props) {
|
|
484
486
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
485
487
|
}, function (props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcTextInput from "./TextInput";
|
|
@@ -7,6 +7,7 @@ import Suggestions from "./Suggestions";
|
|
|
7
7
|
import { ThemeProvider } from "styled-components";
|
|
8
8
|
import useTheme from "../useTheme";
|
|
9
9
|
import { HalstackProvider } from "../HalstackContext";
|
|
10
|
+
import DxcFlex from "../flex/Flex";
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: "Text Input",
|
|
@@ -27,13 +28,7 @@ const action = {
|
|
|
27
28
|
const actionLargeIconSVG = {
|
|
28
29
|
onClick: () => {},
|
|
29
30
|
icon: (
|
|
30
|
-
<svg
|
|
31
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
-
height="48px"
|
|
33
|
-
viewBox="0 0 24 24"
|
|
34
|
-
width="48px"
|
|
35
|
-
fill="currentColor"
|
|
36
|
-
>
|
|
31
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
37
32
|
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
38
33
|
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
|
|
39
34
|
</svg>
|
|
@@ -274,6 +269,14 @@ export const Chromatic = () => (
|
|
|
274
269
|
<Title title="FillParent size" theme="light" level={4} />
|
|
275
270
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
276
271
|
</ExampleContainer>
|
|
272
|
+
<ExampleContainer>
|
|
273
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
274
|
+
<DxcFlex justifyContent="space-between" gap="1.5rem">
|
|
275
|
+
<DxcTextInput label="Text input" size="fillParent" />
|
|
276
|
+
<DxcTextInput label="Text input" size="medium" />
|
|
277
|
+
<DxcTextInput label="Text input" size="large" />
|
|
278
|
+
</DxcFlex>
|
|
279
|
+
</ExampleContainer>
|
|
277
280
|
<Title title="Opinionated theme" theme="light" level={2} />
|
|
278
281
|
<ExampleContainer>
|
|
279
282
|
<HalstackProvider theme={opinionatedTheme}>
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
var countries = ["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands, The", "Central African Republic", "Chad", "Democratic Republic of the Congo", "Dominican Republic", "Dominica", "Denmark", "Djibouti"];
|
|
43
42
|
var specialCharacters = ["/", "\\", "*", "(", ")", "[", "]", "+", "?", "*{[]}|"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import DxcToggleGroup from "./ToggleGroup";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|