@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.
Files changed (209) hide show
  1. package/HalstackContext.d.ts +12 -0
  2. package/HalstackContext.js +295 -0
  3. package/accordion/Accordion.d.ts +1 -1
  4. package/accordion/Accordion.js +7 -28
  5. package/accordion/Accordion.stories.tsx +11 -11
  6. package/accordion/Accordion.test.js +72 -0
  7. package/accordion/types.d.ts +4 -0
  8. package/accordion-group/AccordionGroup.d.ts +1 -1
  9. package/accordion-group/AccordionGroup.js +13 -15
  10. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  11. package/accordion-group/AccordionGroup.test.js +151 -0
  12. package/accordion-group/types.d.ts +4 -0
  13. package/alert/Alert.js +4 -1
  14. package/alert/Alert.test.js +92 -0
  15. package/badge/Badge.d.ts +1 -1
  16. package/badge/Badge.js +5 -3
  17. package/badge/types.d.ts +1 -0
  18. package/bleed/Bleed.js +1 -34
  19. package/bleed/Bleed.stories.tsx +31 -32
  20. package/bleed/types.d.ts +25 -1
  21. package/box/Box.js +22 -32
  22. package/box/Box.test.js +18 -0
  23. package/bulleted-list/BulletedList.d.ts +7 -0
  24. package/bulleted-list/BulletedList.js +120 -0
  25. package/bulleted-list/BulletedList.stories.tsx +203 -0
  26. package/bulleted-list/types.d.ts +11 -0
  27. package/{list → bulleted-list}/types.js +0 -0
  28. package/button/Button.js +14 -11
  29. package/button/Button.test.js +35 -0
  30. package/card/Card.js +24 -27
  31. package/card/Card.test.js +50 -0
  32. package/checkbox/Checkbox.d.ts +1 -1
  33. package/checkbox/Checkbox.js +43 -39
  34. package/checkbox/Checkbox.stories.tsx +124 -128
  35. package/checkbox/Checkbox.test.js +78 -0
  36. package/checkbox/types.d.ts +7 -3
  37. package/chip/Chip.test.js +56 -0
  38. package/common/variables.js +197 -322
  39. package/date-input/DateInput.js +53 -39
  40. package/date-input/DateInput.stories.tsx +7 -7
  41. package/date-input/DateInput.test.js +479 -0
  42. package/date-input/types.d.ts +16 -9
  43. package/dialog/Dialog.js +4 -32
  44. package/dialog/Dialog.test.js +40 -0
  45. package/dropdown/Dropdown.js +13 -17
  46. package/dropdown/Dropdown.test.js +189 -0
  47. package/file-input/FileInput.js +9 -6
  48. package/file-input/FileInput.test.js +457 -0
  49. package/file-input/FileItem.js +7 -5
  50. package/footer/Footer.js +15 -88
  51. package/footer/Footer.test.js +109 -0
  52. package/header/Header.js +27 -48
  53. package/header/Header.stories.tsx +46 -36
  54. package/header/Header.test.js +79 -0
  55. package/heading/Heading.test.js +186 -0
  56. package/inset/Inset.js +1 -34
  57. package/inset/Inset.stories.tsx +32 -32
  58. package/inset/types.d.ts +25 -1
  59. package/layout/ApplicationLayout.d.ts +4 -3
  60. package/layout/ApplicationLayout.js +82 -114
  61. package/layout/ApplicationLayout.stories.tsx +14 -59
  62. package/layout/Icons.d.ts +5 -0
  63. package/layout/Icons.js +13 -2
  64. package/layout/SidenavContext.d.ts +5 -0
  65. package/layout/SidenavContext.js +19 -0
  66. package/layout/types.d.ts +5 -10
  67. package/link/Link.d.ts +3 -2
  68. package/link/Link.js +57 -74
  69. package/link/Link.stories.tsx +87 -52
  70. package/link/Link.test.js +83 -0
  71. package/link/types.d.ts +7 -23
  72. package/main.d.ts +7 -10
  73. package/main.js +33 -51
  74. package/number-input/NumberInput.js +11 -18
  75. package/number-input/NumberInput.stories.tsx +5 -5
  76. package/number-input/NumberInput.test.js +506 -0
  77. package/number-input/types.d.ts +17 -10
  78. package/package.json +6 -5
  79. package/paginator/Paginator.js +17 -38
  80. package/paginator/Paginator.test.js +266 -0
  81. package/paragraph/Paragraph.d.ts +6 -0
  82. package/paragraph/Paragraph.js +38 -0
  83. package/paragraph/Paragraph.stories.tsx +44 -0
  84. package/password-input/PasswordInput.js +7 -4
  85. package/password-input/PasswordInput.test.js +180 -0
  86. package/password-input/types.d.ts +14 -11
  87. package/progress-bar/ProgressBar.js +1 -1
  88. package/progress-bar/ProgressBar.stories.jsx +11 -11
  89. package/progress-bar/ProgressBar.test.js +65 -0
  90. package/quick-nav/QuickNav.d.ts +4 -0
  91. package/quick-nav/QuickNav.js +112 -0
  92. package/quick-nav/QuickNav.stories.tsx +237 -0
  93. package/quick-nav/types.d.ts +21 -0
  94. package/{radio → quick-nav}/types.js +0 -0
  95. package/radio-group/Radio.d.ts +1 -1
  96. package/radio-group/Radio.js +25 -24
  97. package/radio-group/RadioGroup.js +46 -37
  98. package/radio-group/RadioGroup.stories.tsx +60 -39
  99. package/radio-group/RadioGroup.test.js +530 -83
  100. package/radio-group/types.d.ts +80 -2
  101. package/resultsetTable/ResultsetTable.test.js +306 -0
  102. package/row/types.d.ts +18 -0
  103. package/select/Icons.d.ts +10 -0
  104. package/select/Icons.js +93 -0
  105. package/select/Listbox.d.ts +4 -0
  106. package/select/Listbox.js +152 -0
  107. package/select/Option.d.ts +4 -0
  108. package/select/Option.js +110 -0
  109. package/select/Select.js +109 -327
  110. package/select/Select.stories.tsx +103 -81
  111. package/select/Select.test.js +2120 -0
  112. package/select/types.d.ts +54 -11
  113. package/sidenav/Sidenav.d.ts +1 -1
  114. package/sidenav/Sidenav.js +20 -9
  115. package/sidenav/Sidenav.test.js +56 -0
  116. package/slider/Slider.d.ts +1 -1
  117. package/slider/Slider.js +2 -1
  118. package/slider/Slider.stories.tsx +8 -8
  119. package/slider/Slider.test.js +150 -0
  120. package/slider/types.d.ts +4 -0
  121. package/spinner/Spinner.js +1 -1
  122. package/spinner/Spinner.test.js +64 -0
  123. package/stack/types.d.ts +15 -0
  124. package/switch/Switch.d.ts +1 -1
  125. package/switch/Switch.js +35 -19
  126. package/switch/Switch.stories.tsx +14 -14
  127. package/switch/Switch.test.js +98 -0
  128. package/switch/types.d.ts +6 -2
  129. package/table/Table.test.js +26 -0
  130. package/tabs/Tabs.d.ts +1 -1
  131. package/tabs/Tabs.js +9 -11
  132. package/tabs/Tabs.stories.tsx +0 -8
  133. package/tabs/Tabs.test.js +140 -0
  134. package/tabs/types.d.ts +4 -0
  135. package/tabs-nav/NavTabs.d.ts +8 -0
  136. package/tabs-nav/NavTabs.js +125 -0
  137. package/tabs-nav/NavTabs.stories.tsx +170 -0
  138. package/tabs-nav/NavTabs.test.js +82 -0
  139. package/tabs-nav/Tab.d.ts +4 -0
  140. package/tabs-nav/Tab.js +132 -0
  141. package/tabs-nav/types.d.ts +53 -0
  142. package/tabs-nav/types.js +5 -0
  143. package/tag/Tag.js +14 -19
  144. package/tag/Tag.stories.tsx +12 -8
  145. package/tag/Tag.test.js +60 -0
  146. package/text-input/Suggestion.d.ts +4 -0
  147. package/text-input/Suggestion.js +55 -0
  148. package/text-input/TextInput.js +56 -80
  149. package/text-input/TextInput.stories.tsx +30 -12
  150. package/text-input/TextInput.test.js +1712 -0
  151. package/text-input/types.d.ts +31 -12
  152. package/textarea/Textarea.js +20 -27
  153. package/textarea/Textarea.stories.jsx +33 -12
  154. package/textarea/Textarea.test.js +437 -0
  155. package/textarea/types.d.ts +18 -11
  156. package/toggle-group/ToggleGroup.d.ts +1 -1
  157. package/toggle-group/ToggleGroup.js +5 -4
  158. package/toggle-group/ToggleGroup.stories.tsx +4 -4
  159. package/toggle-group/ToggleGroup.test.js +156 -0
  160. package/toggle-group/types.d.ts +8 -0
  161. package/typography/Typography.d.ts +4 -0
  162. package/typography/Typography.js +131 -0
  163. package/typography/Typography.stories.tsx +175 -0
  164. package/typography/types.d.ts +18 -0
  165. package/typography/types.js +5 -0
  166. package/typography/typographyContextTypes.d.ts +16 -0
  167. package/typography/typographyContextTypes.js +5 -0
  168. package/useTheme.js +2 -2
  169. package/useTranslatedLabels.d.ts +2 -0
  170. package/useTranslatedLabels.js +20 -0
  171. package/wizard/Wizard.d.ts +1 -1
  172. package/wizard/Wizard.js +55 -44
  173. package/wizard/Wizard.stories.tsx +13 -23
  174. package/wizard/Wizard.test.js +141 -0
  175. package/wizard/types.d.ts +6 -2
  176. package/ThemeContext.d.ts +0 -15
  177. package/ThemeContext.js +0 -243
  178. package/V3Select/V3Select.js +0 -455
  179. package/V3Select/index.d.ts +0 -27
  180. package/V3Textarea/V3Textarea.js +0 -260
  181. package/V3Textarea/index.d.ts +0 -27
  182. package/date/Date.js +0 -373
  183. package/date/index.d.ts +0 -27
  184. package/input-text/Icons.js +0 -22
  185. package/input-text/InputText.js +0 -611
  186. package/input-text/index.d.ts +0 -36
  187. package/list/List.d.ts +0 -4
  188. package/list/List.js +0 -47
  189. package/list/List.stories.tsx +0 -95
  190. package/list/types.d.ts +0 -7
  191. package/radio/Radio.d.ts +0 -4
  192. package/radio/Radio.js +0 -174
  193. package/radio/Radio.stories.tsx +0 -192
  194. package/radio/types.d.ts +0 -54
  195. package/text/Text.d.ts +0 -7
  196. package/text/Text.js +0 -30
  197. package/text/Text.stories.tsx +0 -19
  198. package/upload/Upload.js +0 -201
  199. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  200. package/upload/buttons-upload/Icons.js +0 -40
  201. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  202. package/upload/dragAndDropArea/Icons.js +0 -39
  203. package/upload/file-upload/FileToUpload.js +0 -115
  204. package/upload/file-upload/Icons.js +0 -66
  205. package/upload/files-upload/FilesToUpload.js +0 -109
  206. package/upload/index.d.ts +0 -15
  207. package/upload/transaction/Icons.js +0 -160
  208. package/upload/transaction/Transaction.js +0 -104
  209. package/upload/transactions/Transactions.js +0 -94
@@ -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
- onChange?: (value?: string) => void;
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;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
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;
9
+ };
10
+ export default selectIcons;
@@ -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;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ListboxProps } from "./types";
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ListboxProps & React.RefAttributes<HTMLUListElement>>>;
4
+ export default _default;