@pingux/astro 1.32.0-alpha.1 → 1.32.0-alpha.3

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.
@@ -158,6 +158,15 @@ var ListView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
158
158
  layout.isLoading = isLoading;
159
159
  var focusedKey = selectionManager.focusedKey;
160
160
  delete gridProps.onMouseDown;
161
+
162
+ var onFocus = function onFocus(e) {
163
+ gridProps.onFocus(e);
164
+
165
+ if (others.onFocus) {
166
+ others.onFocus(e);
167
+ }
168
+ };
169
+
161
170
  return (0, _react2.jsx)(_ListViewContext.ListViewContext.Provider, {
162
171
  value: {
163
172
  state: state
@@ -173,7 +182,9 @@ var ListView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
173
182
  isLoading: isLoading,
174
183
  collection: collection,
175
184
  transitionDuration: 0
176
- }, others), function (type, item) {
185
+ }, others, {
186
+ onFocus: onFocus
187
+ }), function (type, item) {
177
188
  if (type === 'item') {
178
189
  return (0, _react2.jsx)(_ListViewItem["default"], {
179
190
  item: item
@@ -323,4 +323,35 @@ test('selectionMode "multiple" allows to select more than one item', /*#__PURE__
323
323
  }
324
324
  }
325
325
  }, _callee6);
326
+ })));
327
+ test('when user navigates with tab and arrows keys, onFocus is called and the is-focused class is applied', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
328
+ var onFocus, listView, options;
329
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
330
+ while (1) {
331
+ switch (_context7.prev = _context7.next) {
332
+ case 0:
333
+ onFocus = jest.fn();
334
+ getComponent({
335
+ onFocus: onFocus
336
+ });
337
+ listView = _testWrapper.screen.getByTestId(testId);
338
+
339
+ _userEvent["default"].tab();
340
+
341
+ expect(onFocus).toHaveBeenCalled();
342
+
343
+ _userEvent["default"].type(listView, '{arrowdown}', {
344
+ skipClick: true
345
+ });
346
+
347
+ options = _testWrapper.screen.getAllByRole('gridcell');
348
+ expect(options[1]).toHaveClass('is-focused');
349
+ expect(onFocus).toHaveBeenCalled();
350
+
351
+ case 9:
352
+ case "end":
353
+ return _context7.stop();
354
+ }
355
+ }
356
+ }, _callee7);
326
357
  })));
@@ -164,8 +164,10 @@ var TextAreaField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
164
164
  ref: textAreaRef,
165
165
  rows: rows
166
166
  }, fieldControlProps, {
167
- sx: (slots === null || slots === void 0 ? void 0 : slots.inContainer) && {
167
+ sx: slots !== null && slots !== void 0 && slots.inContainer ? {
168
168
  paddingRight: '35px'
169
+ } : {
170
+ overflow: 'hidden'
169
171
  }
170
172
  })), (slots === null || slots === void 0 ? void 0 : slots.inContainer) && (0, _react2.jsx)(_.Box, {
171
173
  variant: "boxes.textFieldInContainerSlot",
@@ -112,6 +112,15 @@ var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
112
112
  layout.isLoading = isLoading;
113
113
  var focusedKey = selectionManager.focusedKey;
114
114
  delete gridProps.onMouseDown;
115
+
116
+ var onFocus = function onFocus(e) {
117
+ gridProps.onFocus(e);
118
+
119
+ if (others.onFocus) {
120
+ others.onFocus(e);
121
+ }
122
+ };
123
+
115
124
  return ___EmotionJSX(ListViewContext.Provider, {
116
125
  value: {
117
126
  state: state
@@ -127,7 +136,9 @@ var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
127
136
  isLoading: isLoading,
128
137
  collection: collection,
129
138
  transitionDuration: 0
130
- }, others), function (type, item) {
139
+ }, others, {
140
+ onFocus: onFocus
141
+ }), function (type, item) {
131
142
  if (type === 'item') {
132
143
  return ___EmotionJSX(ListViewItem, {
133
144
  item: item
@@ -282,4 +282,31 @@ test('selectionMode "multiple" allows to select more than one item', /*#__PURE__
282
282
  }
283
283
  }
284
284
  }, _callee6);
285
+ })));
286
+ test('when user navigates with tab and arrows keys, onFocus is called and the is-focused class is applied', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
287
+ var onFocus, listView, options;
288
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
289
+ while (1) {
290
+ switch (_context7.prev = _context7.next) {
291
+ case 0:
292
+ onFocus = jest.fn();
293
+ getComponent({
294
+ onFocus: onFocus
295
+ });
296
+ listView = screen.getByTestId(testId);
297
+ userEvent.tab();
298
+ expect(onFocus).toHaveBeenCalled();
299
+ userEvent.type(listView, '{arrowdown}', {
300
+ skipClick: true
301
+ });
302
+ options = screen.getAllByRole('gridcell');
303
+ expect(options[1]).toHaveClass('is-focused');
304
+ expect(onFocus).toHaveBeenCalled();
305
+
306
+ case 9:
307
+ case "end":
308
+ return _context7.stop();
309
+ }
310
+ }
311
+ }, _callee7);
285
312
  })));
@@ -132,8 +132,10 @@ var TextAreaField = /*#__PURE__*/forwardRef(function (props, ref) {
132
132
  ref: textAreaRef,
133
133
  rows: rows
134
134
  }, fieldControlProps, {
135
- sx: (slots === null || slots === void 0 ? void 0 : slots.inContainer) && {
135
+ sx: slots !== null && slots !== void 0 && slots.inContainer ? {
136
136
  paddingRight: '35px'
137
+ } : {
138
+ overflow: 'hidden'
137
139
  }
138
140
  })), (slots === null || slots === void 0 ? void 0 : slots.inContainer) && ___EmotionJSX(Box, {
139
141
  variant: "boxes.textFieldInContainerSlot",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.32.0-alpha.1",
3
+ "version": "1.32.0-alpha.3",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",