@dxc-technology/halstack-react 0.0.0-ff43881 → 0.0.0-ff5083e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +11 -11
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +4 -0
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +13 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +4 -0
- package/alert/Alert.js +4 -1
- package/alert/Alert.test.js +92 -0
- 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 +31 -32
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +22 -32
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +120 -0
- package/bulleted-list/BulletedList.stories.tsx +203 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +14 -11
- package/button/Button.test.js +35 -0
- package/card/Card.js +24 -27
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +7 -3
- package/chip/Chip.test.js +56 -0
- package/common/variables.js +197 -322
- package/date-input/DateInput.js +53 -39
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +4 -32
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.js +13 -17
- package/dropdown/Dropdown.test.js +189 -0
- package/file-input/FileInput.js +9 -6
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +15 -88
- package/footer/Footer.test.js +109 -0
- package/header/Header.js +27 -48
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +32 -32
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +82 -114
- package/layout/ApplicationLayout.stories.tsx +14 -59
- 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 +5 -10
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +7 -23
- package/main.d.ts +7 -10
- package/main.js +33 -51
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +6 -5
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +266 -0
- 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 +180 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/progress-bar/ProgressBar.test.js +65 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +112 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/{radio → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +25 -24
- package/radio-group/RadioGroup.js +46 -37
- package/radio-group/RadioGroup.stories.tsx +60 -39
- package/radio-group/RadioGroup.test.js +530 -83
- package/radio-group/types.d.ts +80 -2
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/row/types.d.ts +18 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +109 -327
- package/select/Select.stories.tsx +103 -81
- package/select/Select.test.js +2120 -0
- package/select/types.d.ts +54 -11
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/sidenav/Sidenav.test.js +56 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +2 -1
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/spinner/Spinner.test.js +64 -0
- package/stack/types.d.ts +15 -0
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +35 -19
- package/switch/Switch.stories.tsx +14 -14
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +6 -2
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +4 -0
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +14 -19
- package/tag/Tag.stories.tsx +12 -8
- package/tag/Tag.test.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +56 -80
- package/text-input/TextInput.stories.tsx +30 -12
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +31 -12
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +33 -12
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +8 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +175 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/typography/typographyContextTypes.d.ts +16 -0
- package/typography/typographyContextTypes.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +55 -44
- package/wizard/Wizard.stories.tsx +13 -23
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +6 -2
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- 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/types.d.ts +0 -54
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
package/radio-group/types.d.ts
CHANGED
|
@@ -1,36 +1,114 @@
|
|
|
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;
|
|
18
|
-
|
|
69
|
+
/**
|
|
70
|
+
* This function will be called when the user chooses an option. The new
|
|
71
|
+
* value will be passed to this function.
|
|
72
|
+
*/
|
|
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
|
+
*/
|
|
95
|
+
tabIndex?: number;
|
|
24
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Reference to the component.
|
|
99
|
+
*/
|
|
25
100
|
export declare type RefType = HTMLDivElement;
|
|
101
|
+
/**
|
|
102
|
+
* Single radio prop types.
|
|
103
|
+
*/
|
|
26
104
|
export declare type RadioProps = {
|
|
27
105
|
option: Option;
|
|
28
106
|
currentValue?: string;
|
|
29
107
|
onClick: () => void;
|
|
30
|
-
onFocus: () => void;
|
|
31
108
|
error?: string;
|
|
32
109
|
disabled: boolean;
|
|
33
110
|
focused: boolean;
|
|
34
111
|
readonly: boolean;
|
|
112
|
+
tabIndex: number;
|
|
35
113
|
};
|
|
36
114
|
export default RadioGroupProps;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
10
|
+
|
|
11
|
+
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
|
+
|
|
13
|
+
var columns = [{
|
|
14
|
+
displayValue: "Id",
|
|
15
|
+
isSortable: false
|
|
16
|
+
}, {
|
|
17
|
+
displayValue: "Name",
|
|
18
|
+
isSortable: true
|
|
19
|
+
}, {
|
|
20
|
+
displayValue: "City",
|
|
21
|
+
isSortable: false
|
|
22
|
+
}];
|
|
23
|
+
var rows = [[{
|
|
24
|
+
displayValue: "001",
|
|
25
|
+
sortValue: "001"
|
|
26
|
+
}, {
|
|
27
|
+
displayValue: "Peter",
|
|
28
|
+
sortValue: "Peter"
|
|
29
|
+
}, {
|
|
30
|
+
displayValue: "Oviedo",
|
|
31
|
+
sortValue: "Oviedo"
|
|
32
|
+
}], [{
|
|
33
|
+
displayValue: "002",
|
|
34
|
+
sortValue: "002"
|
|
35
|
+
}, {
|
|
36
|
+
displayValue: "Louis",
|
|
37
|
+
sortValue: "Louis"
|
|
38
|
+
}, {
|
|
39
|
+
displayValue: "Oviedo",
|
|
40
|
+
sortValue: "Oviedo"
|
|
41
|
+
}, {
|
|
42
|
+
displayValue: ""
|
|
43
|
+
}], [{
|
|
44
|
+
displayValue: "003",
|
|
45
|
+
sortValue: "003"
|
|
46
|
+
}, {
|
|
47
|
+
displayValue: "Lana",
|
|
48
|
+
sortValue: "Lana"
|
|
49
|
+
}, {
|
|
50
|
+
displayValue: "Albacete",
|
|
51
|
+
sortValue: "Albacete"
|
|
52
|
+
}], [{
|
|
53
|
+
displayValue: "004",
|
|
54
|
+
sortValue: "004"
|
|
55
|
+
}, {
|
|
56
|
+
displayValue: "Rick",
|
|
57
|
+
sortValue: "Rick"
|
|
58
|
+
}, {
|
|
59
|
+
displayValue: "Albacete",
|
|
60
|
+
sortValue: "Albacete"
|
|
61
|
+
}], [{
|
|
62
|
+
displayValue: "005",
|
|
63
|
+
sortValue: "005"
|
|
64
|
+
}, {
|
|
65
|
+
displayValue: "Mark",
|
|
66
|
+
sortValue: "Mark"
|
|
67
|
+
}, {
|
|
68
|
+
displayValue: "Madrid",
|
|
69
|
+
sortValue: "Madrid"
|
|
70
|
+
}], [{
|
|
71
|
+
displayValue: "006",
|
|
72
|
+
sortValue: "006"
|
|
73
|
+
}, {
|
|
74
|
+
displayValue: "Cris",
|
|
75
|
+
sortValue: "Cris"
|
|
76
|
+
}, {
|
|
77
|
+
displayValue: "Barcelona",
|
|
78
|
+
sortValue: "Barcelona"
|
|
79
|
+
}, {
|
|
80
|
+
displayValue: ""
|
|
81
|
+
}], [{
|
|
82
|
+
displayValue: "007",
|
|
83
|
+
sortValue: "007"
|
|
84
|
+
}, {
|
|
85
|
+
displayValue: "Susan",
|
|
86
|
+
sortValue: "Susan"
|
|
87
|
+
}, {
|
|
88
|
+
displayValue: "Madrid",
|
|
89
|
+
sortValue: "Madrid"
|
|
90
|
+
}], [{
|
|
91
|
+
displayValue: "008",
|
|
92
|
+
sortValue: "008"
|
|
93
|
+
}, {
|
|
94
|
+
displayValue: "Tina",
|
|
95
|
+
sortValue: "Tina"
|
|
96
|
+
}, {
|
|
97
|
+
displayValue: "Barcelona",
|
|
98
|
+
sortValue: "Barcelona"
|
|
99
|
+
}], [{
|
|
100
|
+
displayValue: "009",
|
|
101
|
+
sortValue: "009"
|
|
102
|
+
}, {
|
|
103
|
+
displayValue: "Kevin",
|
|
104
|
+
sortValue: "Kevin"
|
|
105
|
+
}, {
|
|
106
|
+
displayValue: "Oviedo",
|
|
107
|
+
sortValue: "Oviedo"
|
|
108
|
+
}, {
|
|
109
|
+
displayValue: ""
|
|
110
|
+
}], [{
|
|
111
|
+
displayValue: "010",
|
|
112
|
+
sortValue: "010"
|
|
113
|
+
}, {
|
|
114
|
+
displayValue: "Cosmin",
|
|
115
|
+
sortValue: "Cosmin"
|
|
116
|
+
}, {
|
|
117
|
+
displayValue: "Barcelona",
|
|
118
|
+
sortValue: "Barcelona"
|
|
119
|
+
}, {
|
|
120
|
+
displayValue: ""
|
|
121
|
+
}]];
|
|
122
|
+
var rows2 = [[{
|
|
123
|
+
displayValue: "546",
|
|
124
|
+
sortValue: "465"
|
|
125
|
+
}, {
|
|
126
|
+
displayValue: "OtherValue",
|
|
127
|
+
sortValue: "OtherValue"
|
|
128
|
+
}, {
|
|
129
|
+
displayValue: "OtherValue",
|
|
130
|
+
sortValue: "OtherValue"
|
|
131
|
+
}], [{
|
|
132
|
+
displayValue: "978",
|
|
133
|
+
sortValue: "465"
|
|
134
|
+
}, {
|
|
135
|
+
displayValue: "OtherValue",
|
|
136
|
+
sortValue: "OtherValue"
|
|
137
|
+
}, {
|
|
138
|
+
displayValue: "OtherValue",
|
|
139
|
+
sortValue: "OtherValue"
|
|
140
|
+
}, {
|
|
141
|
+
displayValue: ""
|
|
142
|
+
}], [{
|
|
143
|
+
displayValue: "678",
|
|
144
|
+
sortValue: "344"
|
|
145
|
+
}, {
|
|
146
|
+
displayValue: "OtherValue",
|
|
147
|
+
sortValue: "OtherValue"
|
|
148
|
+
}, {
|
|
149
|
+
displayValue: "OtherValue",
|
|
150
|
+
sortValue: "OtherValue"
|
|
151
|
+
}]];
|
|
152
|
+
describe("ResultsetTable component tests", function () {
|
|
153
|
+
test("ResultsetTable rendered correctly", function () {
|
|
154
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
155
|
+
columns: columns,
|
|
156
|
+
rows: rows,
|
|
157
|
+
itemsPerPage: 3
|
|
158
|
+
})),
|
|
159
|
+
getByText = _render.getByText;
|
|
160
|
+
|
|
161
|
+
expect(getByText("Peter")).toBeTruthy();
|
|
162
|
+
});
|
|
163
|
+
test("Resultsettable shows as many rows as itemsPerPage", function () {
|
|
164
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
165
|
+
columns: columns,
|
|
166
|
+
rows: rows,
|
|
167
|
+
itemsPerPage: 3
|
|
168
|
+
})),
|
|
169
|
+
getAllByRole = _render2.getAllByRole;
|
|
170
|
+
|
|
171
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
172
|
+
});
|
|
173
|
+
test("Resultsettable shows rows on second page", function () {
|
|
174
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
175
|
+
columns: columns,
|
|
176
|
+
rows: rows,
|
|
177
|
+
itemsPerPage: 3
|
|
178
|
+
})),
|
|
179
|
+
getByText = _render3.getByText,
|
|
180
|
+
getAllByRole = _render3.getAllByRole;
|
|
181
|
+
|
|
182
|
+
expect(getByText("Peter")).toBeTruthy();
|
|
183
|
+
expect(getByText("Louis")).toBeTruthy();
|
|
184
|
+
expect(getByText("Lana")).toBeTruthy();
|
|
185
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
186
|
+
var nextButton = getAllByRole("button")[2];
|
|
187
|
+
|
|
188
|
+
_react2.fireEvent.click(nextButton);
|
|
189
|
+
|
|
190
|
+
expect(getByText("4 to 6 of 10")).toBeTruthy(); // expect(getByText("Page: 2 of 4")).toBeTruthy();
|
|
191
|
+
|
|
192
|
+
expect(getByText("Rick")).toBeTruthy();
|
|
193
|
+
expect(getByText("Mark")).toBeTruthy();
|
|
194
|
+
expect(getByText("Cris")).toBeTruthy();
|
|
195
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
196
|
+
});
|
|
197
|
+
test("Resultsettable goToPage works as expected", function () {
|
|
198
|
+
window.HTMLElement.prototype.scrollIntoView = function () {};
|
|
199
|
+
|
|
200
|
+
window.HTMLElement.prototype.scrollTo = function () {};
|
|
201
|
+
|
|
202
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
203
|
+
columns: columns,
|
|
204
|
+
showGoToPage: true,
|
|
205
|
+
rows: rows,
|
|
206
|
+
itemsPerPage: 3
|
|
207
|
+
})),
|
|
208
|
+
getByText = _render4.getByText,
|
|
209
|
+
getAllByRole = _render4.getAllByRole,
|
|
210
|
+
getByRole = _render4.getByRole;
|
|
211
|
+
|
|
212
|
+
expect(getByText("Peter")).toBeTruthy();
|
|
213
|
+
expect(getByText("Louis")).toBeTruthy();
|
|
214
|
+
expect(getByText("Lana")).toBeTruthy();
|
|
215
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
216
|
+
var goToPageSelect = getAllByRole("button")[2];
|
|
217
|
+
(0, _react2.act)(function () {
|
|
218
|
+
_userEvent["default"].click(goToPageSelect);
|
|
219
|
+
});
|
|
220
|
+
var goToPageOption = getByText("2");
|
|
221
|
+
(0, _react2.act)(function () {
|
|
222
|
+
_userEvent["default"].click(goToPageOption);
|
|
223
|
+
});
|
|
224
|
+
expect(getByText("4 to 6 of 10")).toBeTruthy();
|
|
225
|
+
expect(getByText("Rick")).toBeTruthy();
|
|
226
|
+
expect(getByText("Mark")).toBeTruthy();
|
|
227
|
+
expect(getByText("Cris")).toBeTruthy();
|
|
228
|
+
expect(getAllByRole("row").length - 1).toEqual(3);
|
|
229
|
+
});
|
|
230
|
+
test("Resultsettable going to the last page shows only one row", function () {
|
|
231
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
232
|
+
columns: columns,
|
|
233
|
+
rows: rows,
|
|
234
|
+
itemsPerPage: 3
|
|
235
|
+
})),
|
|
236
|
+
getByText = _render5.getByText,
|
|
237
|
+
getAllByRole = _render5.getAllByRole;
|
|
238
|
+
|
|
239
|
+
var lastButton = getAllByRole("button")[3];
|
|
240
|
+
|
|
241
|
+
_react2.fireEvent.click(lastButton);
|
|
242
|
+
|
|
243
|
+
expect(getByText("10 to 10 of 10")).toBeTruthy();
|
|
244
|
+
expect(getAllByRole("row")).toHaveLength(2);
|
|
245
|
+
expect(getByText("Cosmin")).toBeTruthy();
|
|
246
|
+
});
|
|
247
|
+
test("Resultsettable sort rows by column", function () {
|
|
248
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
249
|
+
columns: columns,
|
|
250
|
+
rows: rows,
|
|
251
|
+
itemsPerPage: 3
|
|
252
|
+
}));
|
|
253
|
+
expect(component.queryByText("Peter")).toBeTruthy();
|
|
254
|
+
|
|
255
|
+
_react2.fireEvent.click(component.queryByText("Name"));
|
|
256
|
+
|
|
257
|
+
expect(component.queryByText("Tina")).not.toBeTruthy();
|
|
258
|
+
expect(component.queryByText("Cosmin")).toBeTruthy();
|
|
259
|
+
|
|
260
|
+
_react2.fireEvent.click(component.queryByText("Name"));
|
|
261
|
+
|
|
262
|
+
expect(component.queryByText("Tina")).toBeTruthy();
|
|
263
|
+
expect(component.queryByText("Cosmin")).not.toBeTruthy();
|
|
264
|
+
});
|
|
265
|
+
test("Resultsettable change rows should go to first page", function () {
|
|
266
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
267
|
+
columns: columns,
|
|
268
|
+
rows: rows,
|
|
269
|
+
itemsPerPage: 3
|
|
270
|
+
})),
|
|
271
|
+
queryByText = _render6.queryByText,
|
|
272
|
+
rerender = _render6.rerender;
|
|
273
|
+
|
|
274
|
+
expect(queryByText("Peter")).toBeTruthy();
|
|
275
|
+
rerender( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
276
|
+
columns: columns,
|
|
277
|
+
rows: rows2,
|
|
278
|
+
itemsPerPage: 3
|
|
279
|
+
}));
|
|
280
|
+
expect(queryByText("1 to 3 of 3")).toBeTruthy();
|
|
281
|
+
});
|
|
282
|
+
test("Resultsettable change itemsPerPage should go to first page", function () {
|
|
283
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
284
|
+
columns: columns,
|
|
285
|
+
rows: rows,
|
|
286
|
+
itemsPerPage: 3,
|
|
287
|
+
itemsPerPageOptions: [2, 3]
|
|
288
|
+
})),
|
|
289
|
+
getAllByRole = _render7.getAllByRole,
|
|
290
|
+
queryByText = _render7.queryByText,
|
|
291
|
+
rerender = _render7.rerender;
|
|
292
|
+
|
|
293
|
+
var lastButton = getAllByRole("button")[3];
|
|
294
|
+
|
|
295
|
+
_react2.fireEvent.click(lastButton);
|
|
296
|
+
|
|
297
|
+
expect(getAllByRole("row").length - 1).toEqual(1);
|
|
298
|
+
rerender( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
299
|
+
columns: columns,
|
|
300
|
+
rows: rows,
|
|
301
|
+
itemsPerPage: 6
|
|
302
|
+
}));
|
|
303
|
+
expect(getAllByRole("row").length - 1).toEqual(6);
|
|
304
|
+
expect(queryByText("Peter")).toBeTruthy();
|
|
305
|
+
});
|
|
306
|
+
});
|
package/row/types.d.ts
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Space applied between each child.
|
|
5
|
+
*/
|
|
3
6
|
gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
7
|
+
/**
|
|
8
|
+
* Alignment applied to children.
|
|
9
|
+
*/
|
|
4
10
|
align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
11
|
+
/**
|
|
12
|
+
* Justification applied to children.
|
|
13
|
+
*/
|
|
5
14
|
justify?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
15
|
+
/**
|
|
16
|
+
* If true, children will wrap onto multiple rows.
|
|
17
|
+
*/
|
|
6
18
|
wrap?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, children are shown in reverse order.
|
|
21
|
+
*/
|
|
7
22
|
reverse?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Custom content inside the row.
|
|
25
|
+
*/
|
|
8
26
|
children: React.ReactNode;
|
|
9
27
|
};
|
|
10
28
|
export default Props;
|
package/select/Icons.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
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 selectIcons = {
|
|
13
|
+
error: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
role: "img",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
height: "24px",
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
width: "24px",
|
|
19
|
+
fill: "currentColor"
|
|
20
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
21
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
22
|
+
})),
|
|
23
|
+
arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
24
|
+
role: "img",
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
height: "24px",
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
width: "24px",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
31
|
+
d: "M0 0h24v24H0V0z",
|
|
32
|
+
fill: "none"
|
|
33
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
34
|
+
d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
|
|
35
|
+
})),
|
|
36
|
+
arrowDown: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
37
|
+
role: "img",
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
height: "24px",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
width: "24px",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M0 0h24v24H0V0z",
|
|
45
|
+
fill: "none"
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
+
d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
|
|
48
|
+
})),
|
|
49
|
+
clear: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
|
+
role: "img",
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
width: "24",
|
|
53
|
+
height: "24",
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
fill: "currentColor"
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
+
d: "M0 0h24v24H0V0z",
|
|
58
|
+
fill: "none"
|
|
59
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
60
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
61
|
+
})),
|
|
62
|
+
selected: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
63
|
+
role: "img",
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
+
height: "24px",
|
|
66
|
+
viewBox: "0 0 24 24",
|
|
67
|
+
width: "24px",
|
|
68
|
+
fill: "currentColor"
|
|
69
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
70
|
+
d: "M0 0h24v24H0z",
|
|
71
|
+
fill: "none"
|
|
72
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
73
|
+
d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
|
74
|
+
})),
|
|
75
|
+
searchOff: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
76
|
+
role: "img",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
height: "24px",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
width: "24px",
|
|
81
|
+
fill: "currentColor"
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
83
|
+
fill: "none",
|
|
84
|
+
height: "24",
|
|
85
|
+
width: "24"
|
|
86
|
+
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
87
|
+
d: "M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3C6.08,3,3.28,5.64,3.03,9h2.02 C5.3,6.75,7.18,5,9.5,5C11.99,5,14,7.01,14,9.5S11.99,14,9.5,14c-0.17,0-0.33-0.03-0.5-0.05v2.02C9.17,15.99,9.33,16,9.5,16 c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z"
|
|
88
|
+
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
89
|
+
points: "6.47,10.82 4,13.29 1.53,10.82 0.82,11.53 3.29,14 0.82,16.47 1.53,17.18 4,14.71 6.47,17.18 7.18,16.47 4.71,14 7.18,11.53"
|
|
90
|
+
}))))
|
|
91
|
+
};
|
|
92
|
+
var _default = selectIcons;
|
|
93
|
+
exports["default"] = _default;
|