@dxc-technology/halstack-react 0.0.0-d3554d7 → 0.0.0-d3ac293
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 +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1336 -0
- package/HalstackContext.js +335 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +118 -126
- package/accordion/Accordion.stories.tsx +115 -27
- package/accordion/Accordion.test.js +26 -12
- package/accordion/types.d.ts +9 -4
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +17 -38
- package/accordion-group/AccordionGroup.stories.tsx +28 -2
- package/accordion-group/AccordionGroup.test.js +31 -38
- package/accordion-group/types.d.ts +14 -3
- package/alert/Alert.js +7 -4
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +25 -37
- package/box/Box.stories.tsx +15 -0
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/button/Button.js +52 -69
- package/button/Button.stories.tsx +159 -8
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +7 -7
- package/card/Card.js +25 -28
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +107 -110
- package/checkbox/Checkbox.stories.tsx +198 -130
- package/checkbox/Checkbox.test.js +101 -11
- package/checkbox/types.d.ts +13 -5
- package/chip/Chip.js +18 -24
- package/chip/Chip.stories.tsx +96 -9
- package/chip/Chip.test.js +3 -5
- package/chip/types.d.ts +1 -1
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1625 -0
- package/common/variables.js +483 -352
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +169 -258
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +521 -155
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +67 -9
- package/dialog/Dialog.js +76 -93
- package/dialog/Dialog.stories.tsx +230 -123
- package/dialog/Dialog.test.js +334 -5
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +246 -253
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +507 -110
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +70 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +81 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +181 -223
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +44 -66
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/footer/Footer.js +16 -89
- package/footer/Footer.stories.tsx +99 -1
- package/footer/Footer.test.js +14 -26
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +108 -129
- package/header/Header.stories.tsx +189 -36
- package/header/Header.test.js +20 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +72 -132
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +59 -76
- package/link/Link.stories.tsx +155 -53
- package/link/Link.test.js +9 -19
- package/link/types.d.ts +7 -23
- package/main.d.ts +8 -10
- package/main.js +46 -56
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +125 -0
- package/nav-tabs/NavTabs.stories.tsx +260 -0
- package/nav-tabs/NavTabs.test.js +82 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +150 -0
- package/nav-tabs/types.d.ts +53 -0
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +46 -12
- package/number-input/types.d.ts +17 -10
- package/package.json +20 -23
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +78 -39
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +17 -19
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +61 -55
- package/progress-bar/ProgressBar.stories.jsx +47 -12
- package/progress-bar/ProgressBar.test.js +68 -23
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +117 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +32 -28
- package/radio-group/RadioGroup.stories.tsx +135 -17
- package/radio-group/RadioGroup.test.js +145 -117
- package/radio-group/types.d.ts +79 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -108
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +61 -42
- package/resultsetTable/types.d.ts +2 -2
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +169 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +97 -0
- package/select/Select.js +179 -384
- package/select/Select.stories.tsx +531 -142
- package/select/Select.test.js +652 -324
- package/select/types.d.ts +53 -13
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +183 -53
- package/sidenav/Sidenav.stories.tsx +249 -149
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +124 -98
- package/slider/Slider.stories.tsx +72 -9
- package/slider/Slider.test.js +143 -22
- package/slider/types.d.ts +10 -2
- package/spinner/Spinner.js +4 -4
- package/spinner/Spinner.stories.jsx +27 -1
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +152 -69
- package/switch/Switch.stories.tsx +53 -42
- package/switch/Switch.test.js +156 -4
- package/switch/types.d.ts +12 -4
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +363 -109
- package/tabs/Tabs.stories.tsx +119 -13
- package/tabs/Tabs.test.js +241 -14
- package/tabs/types.d.ts +19 -5
- package/tag/Tag.js +17 -22
- package/tag/Tag.stories.tsx +25 -8
- package/tag/Tag.test.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +84 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +221 -344
- package/text-input/TextInput.stories.tsx +290 -195
- package/text-input/TextInput.test.js +763 -731
- package/text-input/types.d.ts +50 -12
- package/textarea/Textarea.js +17 -26
- package/textarea/Textarea.stories.jsx +65 -6
- package/textarea/Textarea.test.js +38 -37
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +6 -5
- package/toggle-group/ToggleGroup.stories.tsx +46 -4
- package/toggle-group/ToggleGroup.test.js +36 -5
- package/toggle-group/types.d.ts +9 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +32 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +3 -3
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +20 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +59 -55
- package/wizard/Wizard.stories.tsx +48 -19
- package/wizard/Wizard.test.js +37 -24
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -10
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -9
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- /package/{list → bulleted-list}/types.js +0 -0
- /package/{radio → flex}/types.js +0 -0
- /package/{row → nav-tabs}/types.js +0 -0
- /package/{stack → quick-nav}/types.js +0 -0
package/radio-group/types.d.ts
CHANGED
|
@@ -1,32 +1,109 @@
|
|
|
1
1
|
export declare type Option = {
|
|
2
|
+
/**
|
|
3
|
+
* Label of the option placed next to the radio input.
|
|
4
|
+
*/
|
|
2
5
|
value: string;
|
|
6
|
+
/**
|
|
7
|
+
* Value of the option. It should be unique and
|
|
8
|
+
* not an empty string, which is reserved to the optional item added
|
|
9
|
+
* by 'optional' prop.
|
|
10
|
+
*/
|
|
3
11
|
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* If true, disables the option.
|
|
14
|
+
*/
|
|
4
15
|
disabled?: boolean;
|
|
5
16
|
};
|
|
6
17
|
declare type RadioGroupProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Text to be placed above the radio group.
|
|
20
|
+
*/
|
|
7
21
|
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* Name attribute of the input element. This attribute will allow users
|
|
24
|
+
* to find the component's value during the submit event.
|
|
25
|
+
*/
|
|
8
26
|
name?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Helper text to be placed above the radio group.
|
|
29
|
+
*/
|
|
9
30
|
helperText?: string;
|
|
31
|
+
/**
|
|
32
|
+
* An array of objects representing the selectable options.
|
|
33
|
+
*/
|
|
10
34
|
options: Option[];
|
|
35
|
+
/**
|
|
36
|
+
* If true, the component will be disabled.
|
|
37
|
+
*/
|
|
11
38
|
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* If true, the radio group will be optional, showing
|
|
41
|
+
* (Optional) next to the label and adding a default last
|
|
42
|
+
* option with an empty string as value. Otherwise, the field will be
|
|
43
|
+
* considered required and an error will be passed as a parameter to the
|
|
44
|
+
* OnBlur functions if an option wasn't selected.
|
|
45
|
+
*/
|
|
12
46
|
optional?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Label of the optional radio input.
|
|
49
|
+
*/
|
|
13
50
|
optionalItemLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* If true, the component will be marked as readonly.
|
|
53
|
+
*/
|
|
14
54
|
readonly?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the orientation of the options within the radio group.
|
|
57
|
+
*/
|
|
15
58
|
stacking?: "row" | "column";
|
|
59
|
+
/**
|
|
60
|
+
* Initial value of the radio group, only when it is uncontrolled.
|
|
61
|
+
*/
|
|
16
62
|
defaultValue?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Value of the radio group. If undefined, the component will be
|
|
65
|
+
* uncontrolled and the value will be managed internally by the
|
|
66
|
+
* component.
|
|
67
|
+
*/
|
|
17
68
|
value?: string;
|
|
69
|
+
/**
|
|
70
|
+
* This function will be called when the user chooses an option. The new
|
|
71
|
+
* value will be passed to this function.
|
|
72
|
+
*/
|
|
18
73
|
onChange?: (value: string) => void;
|
|
74
|
+
/**
|
|
75
|
+
* This function will be called when the radio group loses the focus. An
|
|
76
|
+
* object including the value and the error will be passed to this
|
|
77
|
+
* function. If there is no error, error will not be defined.
|
|
78
|
+
*/
|
|
19
79
|
onBlur?: (val: {
|
|
20
80
|
value?: string;
|
|
21
81
|
error?: string;
|
|
22
82
|
}) => void;
|
|
83
|
+
/**
|
|
84
|
+
* If it is a defined value and also a truthy string, the component will
|
|
85
|
+
* change its appearance, showing the error below the radio group. If the
|
|
86
|
+
* defined value is an empty string, it will reserve a space below the
|
|
87
|
+
* component for a future error, but it would not change its look. In
|
|
88
|
+
* case of being undefined or null, both the appearance and the space for
|
|
89
|
+
* the error message would not be modified.
|
|
90
|
+
*/
|
|
23
91
|
error?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Value of the tabindex attribute.
|
|
94
|
+
*/
|
|
24
95
|
tabIndex?: number;
|
|
25
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Reference to the component.
|
|
99
|
+
*/
|
|
26
100
|
export declare type RefType = HTMLDivElement;
|
|
101
|
+
/**
|
|
102
|
+
* Single radio prop types.
|
|
103
|
+
*/
|
|
27
104
|
export declare type RadioProps = {
|
|
28
|
-
|
|
29
|
-
|
|
105
|
+
label: string;
|
|
106
|
+
checked: boolean;
|
|
30
107
|
onClick: () => void;
|
|
31
108
|
error?: string;
|
|
32
109
|
disabled: boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var icons = {
|
|
13
|
+
arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
height: "24",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
width: "24",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M0 0h24v24H0V0z",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
23
|
+
d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
|
|
24
|
+
})),
|
|
25
|
+
arrowDown: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
height: "24",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "24",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
+
d: "M0 0h24v24H0V0z",
|
|
33
|
+
fill: "none"
|
|
34
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
35
|
+
d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
|
|
36
|
+
})),
|
|
37
|
+
bothArrows: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
height: "24",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
width: "24",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M0 0h24v24H0z",
|
|
45
|
+
fill: "none"
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
+
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
|
+
}))
|
|
49
|
+
};
|
|
50
|
+
var _default = icons;
|
|
51
|
+
exports["default"] = _default;
|
|
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _Table = _interopRequireDefault(require("../table/Table"));
|
|
25
25
|
|
|
@@ -27,17 +27,21 @@ var _Paginator = _interopRequireDefault(require("../paginator/Paginator"));
|
|
|
27
27
|
|
|
28
28
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
31
|
+
|
|
32
|
+
var _utils = require("../common/utils");
|
|
33
|
+
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
31
35
|
|
|
32
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
37
|
|
|
34
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; }
|
|
35
39
|
|
|
36
|
-
function normalizeSortValue(sortValue) {
|
|
40
|
+
var normalizeSortValue = function normalizeSortValue(sortValue) {
|
|
37
41
|
return typeof sortValue === "string" ? sortValue.toUpperCase() : sortValue;
|
|
38
|
-
}
|
|
42
|
+
};
|
|
39
43
|
|
|
40
|
-
function sortArray(index, order, resultset) {
|
|
44
|
+
var sortArray = function sortArray(index, order, resultset) {
|
|
41
45
|
return resultset.slice().sort(function (element1, element2) {
|
|
42
46
|
var sortValueA = normalizeSortValue(element1[index].sortValue || element1[index].displayValue);
|
|
43
47
|
var sortValueB = normalizeSortValue(element2[index].sortValue || element2[index].displayValue);
|
|
@@ -53,9 +57,9 @@ function sortArray(index, order, resultset) {
|
|
|
53
57
|
comparison = -1;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
return order === "
|
|
60
|
+
return order === "descending" ? comparison * -1 : comparison;
|
|
57
61
|
});
|
|
58
|
-
}
|
|
62
|
+
};
|
|
59
63
|
|
|
60
64
|
var getMinItemsPerPageIndex = function getMinItemsPerPageIndex(currentPageInternal, itemsPerPage, page) {
|
|
61
65
|
return currentPageInternal === 1 ? 0 : itemsPerPage * (page - 1);
|
|
@@ -65,51 +69,6 @@ var getMaxItemsPerPageIndex = function getMaxItemsPerPageIndex(minItemsPerPageIn
|
|
|
65
69
|
return minItemsPerPageIndex + itemsPerPage > resultset.length ? resultset.length : itemsPerPage * page - 1;
|
|
66
70
|
};
|
|
67
71
|
|
|
68
|
-
var ArrowUp = function ArrowUp() {
|
|
69
|
-
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
70
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
-
height: "24",
|
|
72
|
-
viewBox: "0 0 24 24",
|
|
73
|
-
width: "24",
|
|
74
|
-
fill: "currentColor"
|
|
75
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
76
|
-
d: "M0 0h24v24H0V0z",
|
|
77
|
-
fill: "none"
|
|
78
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
79
|
-
d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
|
|
80
|
-
}));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
var ArrowDown = function ArrowDown() {
|
|
84
|
-
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
85
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
86
|
-
height: "24",
|
|
87
|
-
viewBox: "0 0 24 24",
|
|
88
|
-
width: "24",
|
|
89
|
-
fill: "currentColor"
|
|
90
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
91
|
-
d: "M0 0h24v24H0V0z",
|
|
92
|
-
fill: "none"
|
|
93
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
94
|
-
d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
|
|
95
|
-
}));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
var BothArrows = function BothArrows() {
|
|
99
|
-
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
100
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
-
height: "24",
|
|
102
|
-
viewBox: "0 0 24 24",
|
|
103
|
-
width: "24",
|
|
104
|
-
fill: "currentColor"
|
|
105
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
106
|
-
d: "M0 0h24v24H0z",
|
|
107
|
-
fill: "none"
|
|
108
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
109
|
-
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"
|
|
110
|
-
}));
|
|
111
|
-
};
|
|
112
|
-
|
|
113
72
|
var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
114
73
|
var columns = _ref.columns,
|
|
115
74
|
rows = _ref.rows,
|
|
@@ -129,12 +88,12 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
129
88
|
page = _useState2[0],
|
|
130
89
|
changePage = _useState2[1];
|
|
131
90
|
|
|
132
|
-
var _useState3 = (0, _react.useState)(
|
|
91
|
+
var _useState3 = (0, _react.useState)(-1),
|
|
133
92
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
134
93
|
sortColumnIndex = _useState4[0],
|
|
135
94
|
changeSortColumnIndex = _useState4[1];
|
|
136
95
|
|
|
137
|
-
var _useState5 = (0, _react.useState)("
|
|
96
|
+
var _useState5 = (0, _react.useState)("ascending"),
|
|
138
97
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
139
98
|
sortOrder = _useState6[0],
|
|
140
99
|
changeSortOrder = _useState6[1];
|
|
@@ -145,6 +104,12 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
145
104
|
var maxItemsPerPageIndex = (0, _react.useMemo)(function () {
|
|
146
105
|
return getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page);
|
|
147
106
|
}, [itemsPerPage, minItemsPerPageIndex, page, rows]);
|
|
107
|
+
var sortedResultset = (0, _react.useMemo)(function () {
|
|
108
|
+
return sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rows) : rows;
|
|
109
|
+
}, [sortColumnIndex, sortOrder, rows]);
|
|
110
|
+
var filteredResultset = (0, _react.useMemo)(function () {
|
|
111
|
+
return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
112
|
+
}, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
148
113
|
|
|
149
114
|
var goToPage = function goToPage(newPage) {
|
|
150
115
|
changePage(newPage);
|
|
@@ -153,44 +118,30 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
153
118
|
var changeSorting = function changeSorting(columnIndex) {
|
|
154
119
|
changePage(1);
|
|
155
120
|
changeSortColumnIndex(columnIndex);
|
|
156
|
-
changeSortOrder(sortColumnIndex ===
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
var getIconForSortableColumn = function getIconForSortableColumn(clickedColumnIndex) {
|
|
160
|
-
return sortColumnIndex === clickedColumnIndex ? sortOrder === "asc" ? /*#__PURE__*/_react["default"].createElement(ArrowUp, null) : /*#__PURE__*/_react["default"].createElement(ArrowDown, null) : /*#__PURE__*/_react["default"].createElement(BothArrows, null);
|
|
121
|
+
changeSortOrder(sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending");
|
|
161
122
|
};
|
|
162
123
|
|
|
163
124
|
(0, _react.useEffect)(function () {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} else {
|
|
167
|
-
changePage(0);
|
|
168
|
-
}
|
|
169
|
-
}, [rows.length, itemsPerPage]);
|
|
170
|
-
var sortedResultset = (0, _react.useMemo)(function () {
|
|
171
|
-
return sortColumnIndex !== "" ? sortArray(sortColumnIndex, sortOrder, rows) : rows;
|
|
172
|
-
}, [sortColumnIndex, sortOrder, rows]);
|
|
173
|
-
var filteredResultset = (0, _react.useMemo)(function () {
|
|
174
|
-
return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
175
|
-
}, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
125
|
+
rows.length > 0 ? changePage(1) : changePage(0);
|
|
126
|
+
}, [rows]);
|
|
176
127
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
177
128
|
theme: colorsTheme.table
|
|
178
129
|
}, /*#__PURE__*/_react["default"].createElement(DxcResultsetTableContainer, {
|
|
179
130
|
margin: margin
|
|
180
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
181
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
182
|
-
key: "tableHeader_".concat(index)
|
|
131
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, columns.map(function (column, index) {
|
|
132
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
133
|
+
key: "tableHeader_".concat(index),
|
|
134
|
+
"aria-sort": column.isSortable ? sortColumnIndex === index ? sortOrder : "none" : undefined
|
|
183
135
|
}, /*#__PURE__*/_react["default"].createElement(HeaderContainer, {
|
|
136
|
+
role: column.isSortable ? "button" : undefined,
|
|
184
137
|
key: "headerContainer_".concat(index),
|
|
185
138
|
onClick: function onClick() {
|
|
186
|
-
|
|
139
|
+
column.isSortable && changeSorting(index);
|
|
187
140
|
},
|
|
188
141
|
tabIndex: column.isSortable ? tabIndex : -1,
|
|
189
142
|
isSortable: column.isSortable
|
|
190
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
191
|
-
|
|
192
|
-
}, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, getIconForSortableColumn(index))));
|
|
193
|
-
}))), /*#__PURE__*/_react["default"].createElement(TableRowGroup, null, filteredResultset.map(function (cells, index) {
|
|
143
|
+
}, /*#__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
|
+
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (cells, index) {
|
|
194
145
|
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
195
146
|
key: "resultSetTableCell_".concat(index)
|
|
196
147
|
}, cells.map(function (cellContent, index) {
|
|
@@ -198,7 +149,7 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
198
149
|
key: "resultSetTableCellContent_".concat(index)
|
|
199
150
|
}, cellContent.displayValue);
|
|
200
151
|
}));
|
|
201
|
-
})))
|
|
152
|
+
}))), /*#__PURE__*/_react["default"].createElement(_Paginator["default"], {
|
|
202
153
|
totalItems: rows.length,
|
|
203
154
|
itemsPerPage: itemsPerPage,
|
|
204
155
|
itemsPerPageOptions: itemsPerPageOptions,
|
|
@@ -207,37 +158,15 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
207
158
|
showGoToPage: showGoToPage,
|
|
208
159
|
onPageChange: goToPage,
|
|
209
160
|
tabIndex: tabIndex
|
|
210
|
-
})))
|
|
161
|
+
})));
|
|
211
162
|
};
|
|
212
163
|
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var TableRowGroup = _styledComponents["default"].tbody(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n > div:nth-child(1) {\n position: absolute;\n left: calc(50% - 68.5px);\n bottom: calc(50% - 68.5px - 30px);\n }\n & tr {\n height: ", ";\n }\n"])), function (props) {
|
|
218
|
-
return props.theme.rowHeight || "70px";
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
var SortIcon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n top: 409px;\n left: 390px;\n height: 14px;\n cursor: pointer;\n color: ", ";\n\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
222
|
-
return props.theme.sortIconColor;
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
var TitleDiv = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: ", ";\n"])), function (props) {
|
|
226
|
-
return props.isSortable && "pointer" || "default";
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
var TableHeader = _styledComponents["default"].th(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
230
|
-
|
|
231
|
-
var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: fit-content;\n :focus {\n ", "\n }\n"])), function (props) {
|
|
232
|
-
return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
|
|
233
|
-
}, function (props) {
|
|
234
|
-
return props.isSortable && "outline: #0095ff solid 2px; \n outline-offset: 4px;";
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
var HeaderRow = _styledComponents["default"].thead(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 60px;\n"])));
|
|
164
|
+
var calculateWidth = function calculateWidth(margin) {
|
|
165
|
+
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
166
|
+
};
|
|
238
167
|
|
|
239
|
-
var DxcResultsetTableContainer = _styledComponents["default"].div(
|
|
240
|
-
return props.
|
|
168
|
+
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
|
+
return calculateWidth(props.margin);
|
|
241
170
|
}, function (props) {
|
|
242
171
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
243
172
|
}, function (props) {
|
|
@@ -250,5 +179,17 @@ var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObjec
|
|
|
250
179
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
251
180
|
});
|
|
252
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) {
|
|
183
|
+
return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
|
|
184
|
+
}, function (props) {
|
|
185
|
+
return props.isSortable ? "pointer" : "default";
|
|
186
|
+
}, function (props) {
|
|
187
|
+
return props.isSortable && "&:focus {\n outline: #0095ff solid 2px;\n }";
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
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
|
+
return props.theme.sortIconColor;
|
|
192
|
+
});
|
|
193
|
+
|
|
253
194
|
var _default = DxcResultsetTable;
|
|
254
195
|
exports["default"] = _default;
|
|
@@ -4,6 +4,7 @@ import DxcButton from "../button/Button";
|
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
6
|
import { userEvent, within } from "@storybook/testing-library";
|
|
7
|
+
import styled from "styled-components";
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: "Resultset Table",
|
|
@@ -48,6 +49,24 @@ const columnsSortable = [
|
|
|
48
49
|
{ displayValue: "City", isSortable: false },
|
|
49
50
|
];
|
|
50
51
|
|
|
52
|
+
const longValues = [
|
|
53
|
+
[
|
|
54
|
+
{ displayValue: "000000000000000001", sortValue: "000000000000000001" },
|
|
55
|
+
{ displayValue: "Peter Larsson González", sortValue: "Peter" },
|
|
56
|
+
{ displayValue: "Miami: The city that never sleeps", sortValue: "Miami" },
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
{ displayValue: "002", sortValue: "002" },
|
|
60
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
61
|
+
{ displayValue: "London", sortValue: "London" },
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
{ displayValue: "003", sortValue: "003" },
|
|
65
|
+
{ displayValue: "Aida", sortValue: "Aida" },
|
|
66
|
+
{ displayValue: "Wroclaw", sortValue: "Wroclaw" },
|
|
67
|
+
],
|
|
68
|
+
];
|
|
69
|
+
|
|
51
70
|
const rowsSortable = [
|
|
52
71
|
[
|
|
53
72
|
{ displayValue: "001", sortValue: "001" },
|
|
@@ -167,89 +186,95 @@ export const Chromatic = () => (
|
|
|
167
186
|
<>
|
|
168
187
|
<ExampleContainer>
|
|
169
188
|
<Title title="Sortable table" theme="light" level={4} />
|
|
170
|
-
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}
|
|
189
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
|
|
171
190
|
</ExampleContainer>
|
|
172
191
|
<ExampleContainer>
|
|
173
192
|
<Title title="With action" theme="light" level={4} />
|
|
174
|
-
<DxcResultsetTable columns={columns} rows={rowsIcon}
|
|
193
|
+
<DxcResultsetTable columns={columns} rows={rowsIcon} />
|
|
175
194
|
</ExampleContainer>
|
|
176
195
|
<ExampleContainer>
|
|
177
196
|
<Title title="With items per page option" theme="light" level={4} />
|
|
178
|
-
<DxcResultsetTable
|
|
179
|
-
columns={columns}
|
|
180
|
-
rows={rows}
|
|
181
|
-
itemsPerPage={2}
|
|
182
|
-
itemsPerPageOptions={[2, 3]}
|
|
183
|
-
></DxcResultsetTable>
|
|
197
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} itemsPerPageOptions={[2, 3]} />
|
|
184
198
|
</ExampleContainer>
|
|
185
199
|
<ExampleContainer>
|
|
186
200
|
<Title title="Scroll resultset table" theme="light" level={4} />
|
|
187
|
-
<DxcResultsetTable columns={longColumns} rows={longRows}
|
|
201
|
+
<DxcResultsetTable columns={longColumns} rows={longRows} />
|
|
202
|
+
</ExampleContainer>
|
|
203
|
+
<ExampleContainer>
|
|
204
|
+
<SmallContainer>
|
|
205
|
+
<Title title="Small container and text overflow" theme="light" level={4} />
|
|
206
|
+
<DxcResultsetTable columns={columnsSortable} rows={longValues} />
|
|
207
|
+
</SmallContainer>
|
|
188
208
|
</ExampleContainer>
|
|
189
209
|
<Title title="Margins" theme="light" level={2} />
|
|
190
210
|
<ExampleContainer>
|
|
191
211
|
<Title title="Xxsmall" theme="light" level={4} />
|
|
192
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"xxsmall"}
|
|
212
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xxsmall"} />
|
|
193
213
|
</ExampleContainer>
|
|
194
214
|
<ExampleContainer>
|
|
195
215
|
<Title title="Xsmall" theme="light" level={4} />
|
|
196
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"xsmall"}
|
|
216
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xsmall"} />
|
|
197
217
|
</ExampleContainer>
|
|
198
218
|
<ExampleContainer>
|
|
199
219
|
<Title title="Small" theme="light" level={4} />
|
|
200
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"small"}
|
|
220
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"small"} />
|
|
201
221
|
</ExampleContainer>
|
|
202
222
|
<ExampleContainer>
|
|
203
223
|
<Title title="Medium" theme="light" level={4} />
|
|
204
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"medium"}
|
|
224
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"medium"} />
|
|
205
225
|
</ExampleContainer>
|
|
206
226
|
<ExampleContainer>
|
|
207
227
|
<Title title="Large" theme="light" level={4} />
|
|
208
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"large"}
|
|
228
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"large"} />
|
|
209
229
|
</ExampleContainer>
|
|
210
230
|
<ExampleContainer>
|
|
211
231
|
<Title title="Xlarge" theme="light" level={4} />
|
|
212
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"xlarge"}
|
|
232
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xlarge"} />
|
|
213
233
|
</ExampleContainer>
|
|
214
|
-
<ExampleContainer>
|
|
234
|
+
<ExampleContainer expanded>
|
|
215
235
|
<Title title="Xxlarge" theme="light" level={4} />
|
|
216
|
-
<DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"}
|
|
217
|
-
<hr />
|
|
236
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"} />
|
|
218
237
|
</ExampleContainer>
|
|
219
238
|
</>
|
|
220
239
|
);
|
|
221
240
|
|
|
241
|
+
const SmallContainer = styled.div`
|
|
242
|
+
width: 500px;
|
|
243
|
+
`;
|
|
244
|
+
|
|
222
245
|
const ResultsetTableAsc = () => (
|
|
223
246
|
<ExampleContainer>
|
|
224
247
|
<Title title="Ascendant sorting" theme="light" level={4} />
|
|
225
|
-
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}
|
|
248
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
|
|
226
249
|
</ExampleContainer>
|
|
227
250
|
);
|
|
228
251
|
|
|
229
252
|
export const AscendentSorting = ResultsetTableAsc.bind({});
|
|
230
253
|
AscendentSorting.play = async ({ canvasElement }) => {
|
|
231
254
|
const canvas = within(canvasElement);
|
|
232
|
-
|
|
255
|
+
const idHeader = canvas.getAllByRole("button")[0];
|
|
256
|
+
await userEvent.click(idHeader);
|
|
233
257
|
};
|
|
234
258
|
|
|
235
259
|
const ResultsetTableDesc = () => (
|
|
236
260
|
<ExampleContainer>
|
|
237
261
|
<Title title="Descendant sorting" theme="light" level={4} />
|
|
238
|
-
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}
|
|
262
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
|
|
239
263
|
</ExampleContainer>
|
|
240
264
|
);
|
|
241
265
|
|
|
242
266
|
export const DescendantSorting = ResultsetTableDesc.bind({});
|
|
243
267
|
DescendantSorting.play = async ({ canvasElement }) => {
|
|
244
268
|
const canvas = within(canvasElement);
|
|
245
|
-
|
|
246
|
-
await userEvent.click(
|
|
269
|
+
const nameHeader = canvas.getAllByRole("button")[1];
|
|
270
|
+
await userEvent.click(nameHeader);
|
|
271
|
+
await userEvent.click(nameHeader);
|
|
247
272
|
};
|
|
248
273
|
|
|
249
274
|
const ResultsetTableMiddle = () => (
|
|
250
275
|
<ExampleContainer>
|
|
251
276
|
<Title title="Middle page" theme="light" level={4} />
|
|
252
|
-
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}
|
|
277
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} />
|
|
253
278
|
</ExampleContainer>
|
|
254
279
|
);
|
|
255
280
|
|
|
@@ -263,7 +288,7 @@ MiddlePage.play = async ({ canvasElement }) => {
|
|
|
263
288
|
const ResultsetTableLast = () => (
|
|
264
289
|
<ExampleContainer>
|
|
265
290
|
<Title title="Last page" theme="light" level={4} />
|
|
266
|
-
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}
|
|
291
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} />
|
|
267
292
|
</ExampleContainer>
|
|
268
293
|
);
|
|
269
294
|
|