@dxc-technology/halstack-react 0.0.0-d3ac293 → 0.0.0-d3df47e
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 +4 -21
- package/HalstackContext.d.ts +24 -139
- package/HalstackContext.js +11 -36
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +26 -83
- package/accordion/Accordion.stories.tsx +2 -114
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +27 -75
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +43 -71
- 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 +17 -56
- package/alert/Alert.test.js +28 -45
- 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 +16 -55
- package/box/Box.stories.tsx +25 -53
- package/box/Box.test.js +1 -6
- 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 +66 -100
- package/button/Button.stories.tsx +9 -90
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +47 -88
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +34 -68
- package/chip/Chip.stories.tsx +25 -17
- package/chip/Chip.test.js +15 -28
- 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.js +2 -8
- package/common/variables.d.ts +24 -282
- package/common/variables.js +860 -1125
- 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.js +15 -59
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +27 -21
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +15 -60
- package/dialog/Dialog.stories.tsx +215 -169
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +39 -93
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +13 -20
- package/dropdown/DropdownMenuItem.js +5 -19
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +180 -249
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +14 -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 +69 -116
- package/footer/Footer.stories.tsx +38 -95
- package/footer/Footer.test.js +21 -33
- 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/grid/types.js +5 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +33 -116
- package/header/Header.stories.tsx +7 -71
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- 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 +28 -65
- 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 +23 -44
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +7 -4
- package/main.js +32 -58
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +22 -54
- package/nav-tabs/NavTabs.stories.tsx +21 -5
- package/nav-tabs/NavTabs.test.js +38 -44
- package/nav-tabs/Tab.js +40 -72
- package/nav-tabs/types.d.ts +14 -15
- 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 +700 -412
- package/number-input/types.d.ts +11 -5
- package/package.json +30 -28
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +17 -47
- package/paginator/Paginator.test.js +229 -199
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +2 -3
- package/paragraph/Paragraph.js +3 -19
- 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 +157 -140
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -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 +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- 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.d.ts +1 -1
- package/{resultsetTable → resultset-table}/ResultsetTable.js +33 -63
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +19 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
- package/{resultsetTable → resultset-table}/types.d.ts +13 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +17 -27
- package/select/Select.js +92 -166
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +80 -150
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.js +68 -126
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +28 -72
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +28 -28
- package/spinner/Spinner.test.js +25 -34
- 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 +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/Table.d.ts +1 -1
- package/table/Table.js +23 -30
- package/table/{Table.stories.jsx → Table.stories.tsx} +98 -0
- package/table/Table.test.js +1 -6
- package/table/types.d.ts +12 -6
- package/tabs/Tab.js +19 -36
- package/tabs/Tabs.js +61 -144
- package/tabs/Tabs.stories.tsx +1 -1
- package/tabs/Tabs.test.js +65 -121
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +26 -58
- package/tag/Tag.test.js +19 -30
- 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 +217 -318
- package/text-input/TextInput.stories.tsx +48 -152
- package/text-input/TextInput.test.js +1210 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +68 -111
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +151 -182
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +91 -105
- package/toggle-group/ToggleGroup.stories.tsx +7 -4
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +21 -136
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +28 -43
- package/wizard/Wizard.js +15 -50
- package/wizard/Wizard.test.js +53 -80
- 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 -240
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → container/types.js} +0 -0
package/radio-group/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Option = {
|
|
2
2
|
/**
|
|
3
3
|
* Label of the option placed next to the radio input.
|
|
4
4
|
*/
|
|
@@ -14,11 +14,11 @@ export declare type Option = {
|
|
|
14
14
|
*/
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
type RadioGroupProps = {
|
|
18
18
|
/**
|
|
19
19
|
* Text to be placed above the radio group.
|
|
20
20
|
*/
|
|
21
|
-
label
|
|
21
|
+
label?: string;
|
|
22
22
|
/**
|
|
23
23
|
* Name attribute of the input element. This attribute will allow users
|
|
24
24
|
* to find the component's value during the submit event.
|
|
@@ -49,9 +49,9 @@ declare type RadioGroupProps = {
|
|
|
49
49
|
*/
|
|
50
50
|
optionalItemLabel?: string;
|
|
51
51
|
/**
|
|
52
|
-
* If true, the component will be
|
|
52
|
+
* If true, the component will not be mutable, meaning the user can not edit the control.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
readOnly?: boolean;
|
|
55
55
|
/**
|
|
56
56
|
* Sets the orientation of the options within the radio group.
|
|
57
57
|
*/
|
|
@@ -97,18 +97,18 @@ declare type RadioGroupProps = {
|
|
|
97
97
|
/**
|
|
98
98
|
* Reference to the component.
|
|
99
99
|
*/
|
|
100
|
-
export
|
|
100
|
+
export type RefType = HTMLDivElement;
|
|
101
101
|
/**
|
|
102
102
|
* Single radio prop types.
|
|
103
103
|
*/
|
|
104
|
-
export
|
|
104
|
+
export type RadioProps = {
|
|
105
105
|
label: string;
|
|
106
106
|
checked: boolean;
|
|
107
107
|
onClick: () => void;
|
|
108
108
|
error?: string;
|
|
109
109
|
disabled: boolean;
|
|
110
110
|
focused: boolean;
|
|
111
|
-
|
|
111
|
+
readOnly: boolean;
|
|
112
112
|
tabIndex: number;
|
|
113
113
|
};
|
|
114
114
|
export default RadioGroupProps;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var icons = {
|
|
13
10
|
arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -47,5 +44,4 @@ var icons = {
|
|
|
47
44
|
d: "M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"
|
|
48
45
|
}))
|
|
49
46
|
};
|
|
50
|
-
var _default = icons;
|
|
51
|
-
exports["default"] = _default;
|
|
47
|
+
var _default = exports["default"] = icons;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import ResultsetTablePropsType from "./types";
|
|
3
|
-
declare const DxcResultsetTable: ({ columns, rows, showGoToPage, itemsPerPage, itemsPerPageOptions, itemsPerPageFunction, margin, tabIndex, }: ResultsetTablePropsType) => JSX.Element;
|
|
3
|
+
declare const DxcResultsetTable: ({ columns, rows, showGoToPage, itemsPerPage, itemsPerPageOptions, itemsPerPageFunction, margin, tabIndex, mode, }: ResultsetTablePropsType) => JSX.Element;
|
|
4
4
|
export default DxcResultsetTable;
|
|
@@ -1,52 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
14
|
var _variables = require("../common/variables");
|
|
23
|
-
|
|
24
15
|
var _Table = _interopRequireDefault(require("../table/Table"));
|
|
25
|
-
|
|
26
16
|
var _Paginator = _interopRequireDefault(require("../paginator/Paginator"));
|
|
27
|
-
|
|
28
17
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
|
-
|
|
30
18
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
31
|
-
|
|
32
19
|
var _utils = require("../common/utils");
|
|
33
|
-
|
|
20
|
+
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
34
21
|
var _templateObject, _templateObject2, _templateObject3;
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
39
|
-
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
40
24
|
var normalizeSortValue = function normalizeSortValue(sortValue) {
|
|
41
25
|
return typeof sortValue === "string" ? sortValue.toUpperCase() : sortValue;
|
|
42
26
|
};
|
|
43
|
-
|
|
44
27
|
var sortArray = function sortArray(index, order, resultset) {
|
|
45
28
|
return resultset.slice().sort(function (element1, element2) {
|
|
46
29
|
var sortValueA = normalizeSortValue(element1[index].sortValue || element1[index].displayValue);
|
|
47
30
|
var sortValueB = normalizeSortValue(element2[index].sortValue || element2[index].displayValue);
|
|
48
31
|
var comparison = 0;
|
|
49
|
-
|
|
50
32
|
if ((0, _typeof2["default"])(sortValueA) === "object") {
|
|
51
33
|
comparison = -1;
|
|
52
34
|
} else if ((0, _typeof2["default"])(sortValueB) === "object") {
|
|
@@ -56,48 +38,42 @@ var sortArray = function sortArray(index, order, resultset) {
|
|
|
56
38
|
} else if (sortValueA < sortValueB) {
|
|
57
39
|
comparison = -1;
|
|
58
40
|
}
|
|
59
|
-
|
|
60
41
|
return order === "descending" ? comparison * -1 : comparison;
|
|
61
42
|
});
|
|
62
43
|
};
|
|
63
|
-
|
|
64
44
|
var getMinItemsPerPageIndex = function getMinItemsPerPageIndex(currentPageInternal, itemsPerPage, page) {
|
|
65
45
|
return currentPageInternal === 1 ? 0 : itemsPerPage * (page - 1);
|
|
66
46
|
};
|
|
67
|
-
|
|
68
47
|
var getMaxItemsPerPageIndex = function getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, resultset, page) {
|
|
69
48
|
return minItemsPerPageIndex + itemsPerPage > resultset.length ? resultset.length : itemsPerPage * page - 1;
|
|
70
49
|
};
|
|
71
|
-
|
|
72
50
|
var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
73
51
|
var columns = _ref.columns,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
52
|
+
rows = _ref.rows,
|
|
53
|
+
_ref$showGoToPage = _ref.showGoToPage,
|
|
54
|
+
showGoToPage = _ref$showGoToPage === void 0 ? true : _ref$showGoToPage,
|
|
55
|
+
_ref$itemsPerPage = _ref.itemsPerPage,
|
|
56
|
+
itemsPerPage = _ref$itemsPerPage === void 0 ? 5 : _ref$itemsPerPage,
|
|
57
|
+
itemsPerPageOptions = _ref.itemsPerPageOptions,
|
|
58
|
+
itemsPerPageFunction = _ref.itemsPerPageFunction,
|
|
59
|
+
margin = _ref.margin,
|
|
60
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
61
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
62
|
+
_ref$mode = _ref.mode,
|
|
63
|
+
mode = _ref$mode === void 0 ? "default" : _ref$mode;
|
|
84
64
|
var colorsTheme = (0, _useTheme["default"])();
|
|
85
|
-
|
|
86
65
|
var _useState = (0, _react.useState)(1),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
66
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
67
|
+
page = _useState2[0],
|
|
68
|
+
changePage = _useState2[1];
|
|
91
69
|
var _useState3 = (0, _react.useState)(-1),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
70
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
71
|
+
sortColumnIndex = _useState4[0],
|
|
72
|
+
changeSortColumnIndex = _useState4[1];
|
|
96
73
|
var _useState5 = (0, _react.useState)("ascending"),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
74
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
75
|
+
sortOrder = _useState6[0],
|
|
76
|
+
changeSortOrder = _useState6[1];
|
|
101
77
|
var minItemsPerPageIndex = (0, _react.useMemo)(function () {
|
|
102
78
|
return getMinItemsPerPageIndex(page, itemsPerPage, page);
|
|
103
79
|
}, [itemsPerPage, page]);
|
|
@@ -110,17 +86,14 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
110
86
|
var filteredResultset = (0, _react.useMemo)(function () {
|
|
111
87
|
return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
112
88
|
}, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
113
|
-
|
|
114
89
|
var goToPage = function goToPage(newPage) {
|
|
115
90
|
changePage(newPage);
|
|
116
91
|
};
|
|
117
|
-
|
|
118
92
|
var changeSorting = function changeSorting(columnIndex) {
|
|
119
93
|
changePage(1);
|
|
120
94
|
changeSortColumnIndex(columnIndex);
|
|
121
95
|
changeSortOrder(sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending");
|
|
122
96
|
};
|
|
123
|
-
|
|
124
97
|
(0, _react.useEffect)(function () {
|
|
125
98
|
rows.length > 0 ? changePage(1) : changePage(0);
|
|
126
99
|
}, [rows]);
|
|
@@ -128,7 +101,9 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
128
101
|
theme: colorsTheme.table
|
|
129
102
|
}, /*#__PURE__*/_react["default"].createElement(DxcResultsetTableContainer, {
|
|
130
103
|
margin: margin
|
|
131
|
-
}, /*#__PURE__*/_react["default"].createElement(_Table["default"],
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
105
|
+
mode: mode
|
|
106
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, columns.map(function (column, index) {
|
|
132
107
|
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
133
108
|
key: "tableHeader_".concat(index),
|
|
134
109
|
"aria-sort": column.isSortable ? sortColumnIndex === index ? sortOrder : "none" : undefined
|
|
@@ -139,11 +114,12 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
139
114
|
column.isSortable && changeSorting(index);
|
|
140
115
|
},
|
|
141
116
|
tabIndex: column.isSortable ? tabIndex : -1,
|
|
142
|
-
isSortable: column.isSortable
|
|
117
|
+
isSortable: column.isSortable,
|
|
118
|
+
mode: mode
|
|
143
119
|
}, /*#__PURE__*/_react["default"].createElement("span", null, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, sortColumnIndex === index ? sortOrder === "ascending" ? _Icons["default"].arrowUp : _Icons["default"].arrowDown : _Icons["default"].bothArrows)));
|
|
144
120
|
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (cells, index) {
|
|
145
121
|
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
146
|
-
key: "resultSetTableCell_".concat(index)
|
|
122
|
+
key: "resultSetTableCell_".concat(page, "_").concat(index)
|
|
147
123
|
}, cells.map(function (cellContent, index) {
|
|
148
124
|
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
149
125
|
key: "resultSetTableCellContent_".concat(index)
|
|
@@ -160,11 +136,9 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
160
136
|
tabIndex: tabIndex
|
|
161
137
|
})));
|
|
162
138
|
};
|
|
163
|
-
|
|
164
139
|
var calculateWidth = function calculateWidth(margin) {
|
|
165
140
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
166
141
|
};
|
|
167
|
-
|
|
168
142
|
var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
169
143
|
return calculateWidth(props.margin);
|
|
170
144
|
}, function (props) {
|
|
@@ -178,18 +152,14 @@ var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObjec
|
|
|
178
152
|
}, function (props) {
|
|
179
153
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
180
154
|
});
|
|
181
|
-
|
|
182
|
-
var HeaderContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n gap: 8px;\n width: fit-content;\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
155
|
+
var HeaderContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n gap: ", ";\n width: fit-content;\n border: 1px solid transparent;\n border-radius: 2px;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
183
156
|
return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
|
|
184
|
-
}, function (props) {
|
|
157
|
+
}, _coreTokens["default"].spacing_8, function (props) {
|
|
185
158
|
return props.isSortable ? "pointer" : "default";
|
|
186
159
|
}, function (props) {
|
|
187
160
|
return props.isSortable && "&:focus {\n outline: #0095ff solid 2px;\n }";
|
|
188
161
|
});
|
|
189
|
-
|
|
190
162
|
var SortIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 14px;\n width: 14px;\n color: ", ";\n\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
191
163
|
return props.theme.sortIconColor;
|
|
192
164
|
});
|
|
193
|
-
|
|
194
|
-
var _default = DxcResultsetTable;
|
|
195
|
-
exports["default"] = _default;
|
|
165
|
+
var _default = exports["default"] = DxcResultsetTable;
|
|
@@ -206,6 +206,25 @@ export const Chromatic = () => (
|
|
|
206
206
|
<DxcResultsetTable columns={columnsSortable} rows={longValues} />
|
|
207
207
|
</SmallContainer>
|
|
208
208
|
</ExampleContainer>
|
|
209
|
+
<ExampleContainer>
|
|
210
|
+
<Title title="Reduced sortable table" theme="light" level={4} />
|
|
211
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable} mode="reduced" />
|
|
212
|
+
</ExampleContainer>
|
|
213
|
+
{/* PENDING SMALL ICON VERSION */}
|
|
214
|
+
<ExampleContainer>
|
|
215
|
+
<Title title="Reduced with items per page option" theme="light" level={4} />
|
|
216
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} itemsPerPageOptions={[2, 3]} mode="reduced" />
|
|
217
|
+
</ExampleContainer>
|
|
218
|
+
<ExampleContainer>
|
|
219
|
+
<Title title="Reduced scroll resultset table" theme="light" level={4} />
|
|
220
|
+
<DxcResultsetTable columns={longColumns} rows={longRows} mode="reduced" />
|
|
221
|
+
</ExampleContainer>
|
|
222
|
+
<ExampleContainer>
|
|
223
|
+
<SmallContainer>
|
|
224
|
+
<Title title="Reduced small container and text overflow" theme="light" level={4} />
|
|
225
|
+
<DxcResultsetTable columns={columnsSortable} rows={longValues} mode="reduced" />
|
|
226
|
+
</SmallContainer>
|
|
227
|
+
</ExampleContainer>
|
|
209
228
|
<Title title="Margins" theme="light" level={2} />
|
|
210
229
|
<ExampleContainer>
|
|
211
230
|
<Title title="Xxsmall" theme="light" level={4} />
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
5
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
-
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
-
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
var _react2 = require("@testing-library/react");
|
|
12
|
-
|
|
13
10
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
|
-
|
|
15
11
|
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable.tsx"));
|
|
16
|
-
|
|
17
12
|
// Mocking DOMRect for Radix Primitive Popover
|
|
18
13
|
global.globalThis = global;
|
|
19
14
|
global.DOMRect = {
|
|
@@ -28,12 +23,10 @@ global.DOMRect = {
|
|
|
28
23
|
};
|
|
29
24
|
}
|
|
30
25
|
};
|
|
31
|
-
|
|
32
26
|
global.ResizeObserver = /*#__PURE__*/function () {
|
|
33
27
|
function ResizeObserver() {
|
|
34
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
(0, _createClass2["default"])(ResizeObserver, [{
|
|
38
31
|
key: "observe",
|
|
39
32
|
value: function observe() {}
|
|
@@ -46,7 +39,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
46
39
|
}]);
|
|
47
40
|
return ResizeObserver;
|
|
48
41
|
}();
|
|
49
|
-
|
|
50
42
|
var columns = [{
|
|
51
43
|
displayValue: "Id",
|
|
52
44
|
isSortable: false
|
|
@@ -181,92 +173,88 @@ var rows2 = [[{
|
|
|
181
173
|
describe("Resultset table component tests", function () {
|
|
182
174
|
test("Resultset table rendered correctly", function () {
|
|
183
175
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
176
|
+
columns: columns,
|
|
177
|
+
rows: rows,
|
|
178
|
+
itemsPerPage: 3
|
|
179
|
+
})),
|
|
180
|
+
getByText = _render.getByText;
|
|
190
181
|
expect(getByText("Peter")).toBeTruthy();
|
|
191
182
|
});
|
|
192
183
|
test("Resultset table shows as many rows as itemsPerPage", function () {
|
|
193
184
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
columns: columns,
|
|
186
|
+
rows: rows,
|
|
187
|
+
itemsPerPage: 3
|
|
188
|
+
})),
|
|
189
|
+
getAllByRole = _render2.getAllByRole;
|
|
200
190
|
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
201
191
|
});
|
|
202
192
|
test("Resultset table shows rows on second page", function () {
|
|
203
193
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
194
|
+
columns: columns,
|
|
195
|
+
rows: rows,
|
|
196
|
+
itemsPerPage: 3
|
|
197
|
+
})),
|
|
198
|
+
getByText = _render3.getByText,
|
|
199
|
+
getAllByRole = _render3.getAllByRole;
|
|
211
200
|
expect(getByText("Peter")).toBeTruthy();
|
|
212
201
|
expect(getByText("Louis")).toBeTruthy();
|
|
213
202
|
expect(getByText("Lana")).toBeTruthy();
|
|
214
203
|
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
215
204
|
var nextButton = getAllByRole("button")[3];
|
|
216
|
-
|
|
217
205
|
_react2.fireEvent.click(nextButton);
|
|
218
|
-
|
|
219
|
-
expect(getByText("4 to 6 of 10")).toBeTruthy();
|
|
220
|
-
expect(getByText("Rick")).toBeTruthy();
|
|
221
|
-
expect(getByText("Mark")).toBeTruthy();
|
|
222
|
-
expect(getByText("Cris")).toBeTruthy();
|
|
223
|
-
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
224
|
-
});
|
|
225
|
-
test("Resultset table goToPage works as expected", function () {
|
|
226
|
-
window.HTMLElement.prototype.scrollIntoView = function () {};
|
|
227
|
-
|
|
228
|
-
window.HTMLElement.prototype.scrollTo = function () {};
|
|
229
|
-
|
|
230
|
-
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
231
|
-
columns: columns,
|
|
232
|
-
showGoToPage: true,
|
|
233
|
-
rows: rows,
|
|
234
|
-
itemsPerPage: 3
|
|
235
|
-
})),
|
|
236
|
-
getByText = _render4.getByText,
|
|
237
|
-
getAllByRole = _render4.getAllByRole;
|
|
238
|
-
|
|
239
|
-
expect(getByText("Peter")).toBeTruthy();
|
|
240
|
-
expect(getByText("Louis")).toBeTruthy();
|
|
241
|
-
expect(getByText("Lana")).toBeTruthy();
|
|
242
|
-
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
243
|
-
var goToPageSelect = getAllByRole("button")[3];
|
|
244
|
-
|
|
245
|
-
_userEvent["default"].click(goToPageSelect);
|
|
246
|
-
|
|
247
|
-
var goToPageOption = getByText("2");
|
|
248
|
-
|
|
249
|
-
_userEvent["default"].click(goToPageOption);
|
|
250
|
-
|
|
251
206
|
expect(getByText("4 to 6 of 10")).toBeTruthy();
|
|
252
207
|
expect(getByText("Rick")).toBeTruthy();
|
|
253
208
|
expect(getByText("Mark")).toBeTruthy();
|
|
254
209
|
expect(getByText("Cris")).toBeTruthy();
|
|
255
210
|
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
256
211
|
});
|
|
212
|
+
test("Resultset table goToPage works as expected", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
213
|
+
var _render4, getByText, getAllByRole, goToPageSelect, goToPageOption;
|
|
214
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
215
|
+
while (1) switch (_context.prev = _context.next) {
|
|
216
|
+
case 0:
|
|
217
|
+
window.HTMLElement.prototype.scrollIntoView = function () {};
|
|
218
|
+
window.HTMLElement.prototype.scrollTo = function () {};
|
|
219
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
220
|
+
columns: columns,
|
|
221
|
+
showGoToPage: true,
|
|
222
|
+
rows: rows,
|
|
223
|
+
itemsPerPage: 3
|
|
224
|
+
})), getByText = _render4.getByText, getAllByRole = _render4.getAllByRole;
|
|
225
|
+
expect(getByText("Peter")).toBeTruthy();
|
|
226
|
+
expect(getByText("Louis")).toBeTruthy();
|
|
227
|
+
expect(getByText("Lana")).toBeTruthy();
|
|
228
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
229
|
+
goToPageSelect = getAllByRole("button")[3];
|
|
230
|
+
_context.next = 10;
|
|
231
|
+
return _userEvent["default"].click(goToPageSelect);
|
|
232
|
+
case 10:
|
|
233
|
+
goToPageOption = getByText("2");
|
|
234
|
+
_context.next = 13;
|
|
235
|
+
return _userEvent["default"].click(goToPageOption);
|
|
236
|
+
case 13:
|
|
237
|
+
expect(getByText("4 to 6 of 10")).toBeTruthy();
|
|
238
|
+
expect(getByText("Rick")).toBeTruthy();
|
|
239
|
+
expect(getByText("Mark")).toBeTruthy();
|
|
240
|
+
expect(getByText("Cris")).toBeTruthy();
|
|
241
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
242
|
+
case 18:
|
|
243
|
+
case "end":
|
|
244
|
+
return _context.stop();
|
|
245
|
+
}
|
|
246
|
+
}, _callee);
|
|
247
|
+
})));
|
|
257
248
|
test("Resultset table going to the last page shows only one row", function () {
|
|
258
249
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
250
|
+
columns: columns,
|
|
251
|
+
rows: rows,
|
|
252
|
+
itemsPerPage: 3
|
|
253
|
+
})),
|
|
254
|
+
getByText = _render5.getByText,
|
|
255
|
+
getAllByRole = _render5.getAllByRole;
|
|
266
256
|
var lastButton = getAllByRole("button")[4];
|
|
267
|
-
|
|
268
257
|
_react2.fireEvent.click(lastButton);
|
|
269
|
-
|
|
270
258
|
expect(getByText("10 to 10 of 10")).toBeTruthy();
|
|
271
259
|
expect(getAllByRole("row")).toHaveLength(2);
|
|
272
260
|
expect(getByText("Cosmin")).toBeTruthy();
|
|
@@ -278,26 +266,21 @@ describe("Resultset table component tests", function () {
|
|
|
278
266
|
itemsPerPage: 3
|
|
279
267
|
}));
|
|
280
268
|
expect(component.queryByText("Peter")).toBeTruthy();
|
|
281
|
-
|
|
282
269
|
_react2.fireEvent.click(component.queryByText("Name"));
|
|
283
|
-
|
|
284
270
|
expect(component.queryByText("Tina")).not.toBeTruthy();
|
|
285
271
|
expect(component.queryByText("Cosmin")).toBeTruthy();
|
|
286
|
-
|
|
287
272
|
_react2.fireEvent.click(component.queryByText("Name"));
|
|
288
|
-
|
|
289
273
|
expect(component.queryByText("Tina")).toBeTruthy();
|
|
290
274
|
expect(component.queryByText("Cosmin")).not.toBeTruthy();
|
|
291
275
|
});
|
|
292
276
|
test("Resultset table change rows should go to first page", function () {
|
|
293
277
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
278
|
+
columns: columns,
|
|
279
|
+
rows: rows,
|
|
280
|
+
itemsPerPage: 3
|
|
281
|
+
})),
|
|
282
|
+
queryByText = _render6.queryByText,
|
|
283
|
+
rerender = _render6.rerender;
|
|
301
284
|
expect(queryByText("Peter")).toBeTruthy();
|
|
302
285
|
rerender( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
303
286
|
columns: columns,
|
|
@@ -308,18 +291,15 @@ describe("Resultset table component tests", function () {
|
|
|
308
291
|
});
|
|
309
292
|
test("Resultset table change itemsPerPage should go to first page", function () {
|
|
310
293
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
294
|
+
columns: columns,
|
|
295
|
+
rows: rows,
|
|
296
|
+
itemsPerPage: 3,
|
|
297
|
+
itemsPerPageOptions: [2, 3]
|
|
298
|
+
})),
|
|
299
|
+
getAllByRole = _render7.getAllByRole;
|
|
318
300
|
var lastButton = getAllByRole("button")[4];
|
|
319
301
|
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
320
|
-
|
|
321
302
|
_react2.fireEvent.click(lastButton);
|
|
322
|
-
|
|
323
303
|
expect(getAllByRole("row").length - 1).toEqual(1);
|
|
324
304
|
});
|
|
325
305
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
-
|
|
9
|
+
export type Column = {
|
|
10
10
|
/**
|
|
11
11
|
* Column display value.
|
|
12
12
|
*/
|
|
@@ -16,7 +16,7 @@ declare type Column = {
|
|
|
16
16
|
*/
|
|
17
17
|
isSortable?: boolean;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
type Row = {
|
|
20
20
|
/**
|
|
21
21
|
* Value to be displayed in the cell.
|
|
22
22
|
*/
|
|
@@ -27,7 +27,7 @@ declare type Row = {
|
|
|
27
27
|
*/
|
|
28
28
|
sortValue?: string;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
type Props = {
|
|
31
31
|
/**
|
|
32
32
|
* An array of objects representing the columns of the table.
|
|
33
33
|
*/
|
|
@@ -53,15 +53,21 @@ declare type Props = {
|
|
|
53
53
|
* This function will be called when the user selects an item per page
|
|
54
54
|
* option. The value selected will be passed as a parameter.
|
|
55
55
|
*/
|
|
56
|
-
itemsPerPageFunction?: (
|
|
56
|
+
itemsPerPageFunction?: (value: number) => void;
|
|
57
57
|
/**
|
|
58
58
|
* Size of the margin to be applied to the component. You can pass an object with 'top',
|
|
59
59
|
* 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
60
60
|
*/
|
|
61
61
|
margin?: Space | Margin;
|
|
62
62
|
/**
|
|
63
|
-
* Value of the tabindex attribute
|
|
63
|
+
* Value of the tabindex attribute applied to the sortable icon.
|
|
64
64
|
*/
|
|
65
65
|
tabIndex?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Determines the visual style and layout
|
|
68
|
+
* - "default": The default mode with big spacing
|
|
69
|
+
* - "reduced": A reduced mode with minimal spacing for dense tables
|
|
70
|
+
*/
|
|
71
|
+
mode?: "default" | "reduced";
|
|
66
72
|
};
|
|
67
73
|
export default Props;
|
package/select/Icons.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
declare const selectIcons: {
|
|
3
|
-
error: JSX.Element;
|
|
4
|
-
arrowUp: JSX.Element;
|
|
5
|
-
arrowDown: JSX.Element;
|
|
6
|
-
clear: JSX.Element;
|
|
7
|
-
selected: JSX.Element;
|
|
8
|
-
searchOff: JSX.Element;
|
|
3
|
+
error: React.JSX.Element;
|
|
4
|
+
arrowUp: React.JSX.Element;
|
|
5
|
+
arrowDown: React.JSX.Element;
|
|
6
|
+
clear: React.JSX.Element;
|
|
7
|
+
selected: React.JSX.Element;
|
|
8
|
+
searchOff: React.JSX.Element;
|
|
9
9
|
};
|
|
10
10
|
export default selectIcons;
|