@pingux/astro 2.51.0-alpha.0 → 2.51.0

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 (29) hide show
  1. package/lib/cjs/components/FieldHelperText/FieldHelperText.styles.d.ts +832 -2
  2. package/lib/cjs/components/ListBox/ListBox.d.ts +11 -0
  3. package/lib/cjs/components/ListBox/ListBox.js +7 -45
  4. package/lib/cjs/components/ListBox/ListBox.styles.d.ts +3 -0
  5. package/lib/cjs/components/ListBox/ListBox.test.d.ts +1 -0
  6. package/lib/cjs/components/ListBox/ListBox.test.js +29 -28
  7. package/lib/cjs/components/ListBox/ListBoxContext.d.ts +2 -0
  8. package/lib/cjs/components/ListBox/ListBoxContext.js +1 -1
  9. package/lib/cjs/components/ListBox/ListBoxSection.d.ts +10 -0
  10. package/lib/cjs/components/ListBox/ListBoxSection.js +4 -4
  11. package/lib/cjs/components/ListBox/Option.d.ts +4 -0
  12. package/lib/cjs/components/ListBox/Option.js +11 -33
  13. package/lib/cjs/components/ListBox/index.d.ts +2 -0
  14. package/lib/cjs/components/Text/Text.styles.d.ts +1664 -18
  15. package/lib/cjs/hooks/useSelectField/useSelectField.d.ts +2 -2
  16. package/lib/cjs/hooks/useSelectField/useSelectField.js +1 -1
  17. package/lib/cjs/types/index.d.ts +1 -0
  18. package/lib/cjs/types/index.js +27 -16
  19. package/lib/cjs/types/listBox.d.ts +49 -0
  20. package/lib/cjs/types/listBox.js +6 -0
  21. package/lib/components/ListBox/ListBox.js +8 -46
  22. package/lib/components/ListBox/ListBox.test.js +23 -28
  23. package/lib/components/ListBox/ListBoxContext.js +1 -1
  24. package/lib/components/ListBox/ListBoxSection.js +4 -4
  25. package/lib/components/ListBox/Option.js +11 -33
  26. package/lib/hooks/useSelectField/useSelectField.js +1 -1
  27. package/lib/types/index.js +1 -0
  28. package/lib/types/listBox.js +1 -0
  29. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { AriaButtonProps } from 'react-aria';
3
3
  import { SelectState } from 'react-stately';
4
4
  import { CollectionChildren } from '@react-types/shared';
5
5
  import { LabelProps as ThemeUILabelProps } from 'theme-ui';
6
- import { Axis, BoxProps, FocusableElement, PlacementAxis, ReactRef, StyleProps } from '../../types';
6
+ import { Axis, BoxProps, FocusableElement, ListBoxProps, PlacementAxis, ReactRef, StyleProps } from '../../types';
7
7
  import { LabelMode } from '../useColumnStyles/useColumnStyles';
8
8
  import { FieldControlInputProps } from '../useField/useField';
9
9
  interface UseSelectFieldProps<T> {
@@ -32,7 +32,7 @@ interface UseSelectFieldProps<T> {
32
32
  onSelectionChange?: (key: Key) => unknown;
33
33
  controlProps?: React.HTMLAttributes<Element>;
34
34
  scrollBoxProps?: BoxProps;
35
- listBoxProps?: BoxProps;
35
+ listBoxProps?: ListBoxProps;
36
36
  labelProps?: ThemeUILabelProps;
37
37
  containerProps?: BoxProps;
38
38
  labelMode: LabelMode;
@@ -190,7 +190,7 @@ var useSelectField = function useSelectField(props, ref) {
190
190
  }), (0, _react2.jsx)(_ListBox["default"], (0, _extends2["default"])({
191
191
  ref: listBoxRef,
192
192
  hasNoEmptySelection: true,
193
- hasAutoFocus: state.focusStrategy || true,
193
+ hasAutoFocus: true,
194
194
  state: state,
195
195
  variant: "listBox.selectField",
196
196
  isLoading: isLoadingMore,
@@ -13,6 +13,7 @@ export * from './iconButton';
13
13
  export * from './input';
14
14
  export * from './item';
15
15
  export * from './link';
16
+ export * from './listBox';
16
17
  export * from './listItem';
17
18
  export * from './loader';
18
19
  export * from './menu';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30;
3
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -172,8 +172,19 @@ _forEachInstanceProperty(_context15 = _Object$keys(_link)).call(_context15, func
172
172
  }
173
173
  });
174
174
  });
175
+ var _listBox = require("./listBox");
176
+ _forEachInstanceProperty(_context16 = _Object$keys(_listBox)).call(_context16, function (key) {
177
+ if (key === "default" || key === "__esModule") return;
178
+ if (key in exports && exports[key] === _listBox[key]) return;
179
+ _Object$defineProperty(exports, key, {
180
+ enumerable: true,
181
+ get: function get() {
182
+ return _listBox[key];
183
+ }
184
+ });
185
+ });
175
186
  var _listItem = require("./listItem");
176
- _forEachInstanceProperty(_context16 = _Object$keys(_listItem)).call(_context16, function (key) {
187
+ _forEachInstanceProperty(_context17 = _Object$keys(_listItem)).call(_context17, function (key) {
177
188
  if (key === "default" || key === "__esModule") return;
178
189
  if (key in exports && exports[key] === _listItem[key]) return;
179
190
  _Object$defineProperty(exports, key, {
@@ -184,7 +195,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_listItem)).call(_context16,
184
195
  });
185
196
  });
186
197
  var _loader = require("./loader");
187
- _forEachInstanceProperty(_context17 = _Object$keys(_loader)).call(_context17, function (key) {
198
+ _forEachInstanceProperty(_context18 = _Object$keys(_loader)).call(_context18, function (key) {
188
199
  if (key === "default" || key === "__esModule") return;
189
200
  if (key in exports && exports[key] === _loader[key]) return;
190
201
  _Object$defineProperty(exports, key, {
@@ -195,7 +206,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_loader)).call(_context17, fu
195
206
  });
196
207
  });
197
208
  var _menu = require("./menu");
198
- _forEachInstanceProperty(_context18 = _Object$keys(_menu)).call(_context18, function (key) {
209
+ _forEachInstanceProperty(_context19 = _Object$keys(_menu)).call(_context19, function (key) {
199
210
  if (key === "default" || key === "__esModule") return;
200
211
  if (key in exports && exports[key] === _menu[key]) return;
201
212
  _Object$defineProperty(exports, key, {
@@ -206,7 +217,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_menu)).call(_context18, func
206
217
  });
207
218
  });
208
219
  var _menuItem = require("./menuItem");
209
- _forEachInstanceProperty(_context19 = _Object$keys(_menuItem)).call(_context19, function (key) {
220
+ _forEachInstanceProperty(_context20 = _Object$keys(_menuItem)).call(_context20, function (key) {
210
221
  if (key === "default" || key === "__esModule") return;
211
222
  if (key in exports && exports[key] === _menuItem[key]) return;
212
223
  _Object$defineProperty(exports, key, {
@@ -217,7 +228,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_menuItem)).call(_context19,
217
228
  });
218
229
  });
219
230
  var _overlayPanel = require("./overlayPanel");
220
- _forEachInstanceProperty(_context20 = _Object$keys(_overlayPanel)).call(_context20, function (key) {
231
+ _forEachInstanceProperty(_context21 = _Object$keys(_overlayPanel)).call(_context21, function (key) {
221
232
  if (key === "default" || key === "__esModule") return;
222
233
  if (key in exports && exports[key] === _overlayPanel[key]) return;
223
234
  _Object$defineProperty(exports, key, {
@@ -228,7 +239,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_overlayPanel)).call(_context
228
239
  });
229
240
  });
230
241
  var _popoverContainer = require("./popoverContainer");
231
- _forEachInstanceProperty(_context21 = _Object$keys(_popoverContainer)).call(_context21, function (key) {
242
+ _forEachInstanceProperty(_context22 = _Object$keys(_popoverContainer)).call(_context22, function (key) {
232
243
  if (key === "default" || key === "__esModule") return;
233
244
  if (key in exports && exports[key] === _popoverContainer[key]) return;
234
245
  _Object$defineProperty(exports, key, {
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_popoverContainer)).call(_con
239
250
  });
240
251
  });
241
252
  var _popoverMenu = require("./popoverMenu");
242
- _forEachInstanceProperty(_context22 = _Object$keys(_popoverMenu)).call(_context22, function (key) {
253
+ _forEachInstanceProperty(_context23 = _Object$keys(_popoverMenu)).call(_context23, function (key) {
243
254
  if (key === "default" || key === "__esModule") return;
244
255
  if (key in exports && exports[key] === _popoverMenu[key]) return;
245
256
  _Object$defineProperty(exports, key, {
@@ -250,7 +261,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_popoverMenu)).call(_context2
250
261
  });
251
262
  });
252
263
  var _requirementsList = require("./requirementsList");
253
- _forEachInstanceProperty(_context23 = _Object$keys(_requirementsList)).call(_context23, function (key) {
264
+ _forEachInstanceProperty(_context24 = _Object$keys(_requirementsList)).call(_context24, function (key) {
254
265
  if (key === "default" || key === "__esModule") return;
255
266
  if (key in exports && exports[key] === _requirementsList[key]) return;
256
267
  _Object$defineProperty(exports, key, {
@@ -261,7 +272,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_requirementsList)).call(_con
261
272
  });
262
273
  });
263
274
  var _rockerButtonGroup = require("./rockerButtonGroup");
264
- _forEachInstanceProperty(_context24 = _Object$keys(_rockerButtonGroup)).call(_context24, function (key) {
275
+ _forEachInstanceProperty(_context25 = _Object$keys(_rockerButtonGroup)).call(_context25, function (key) {
265
276
  if (key === "default" || key === "__esModule") return;
266
277
  if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
267
278
  _Object$defineProperty(exports, key, {
@@ -272,7 +283,7 @@ _forEachInstanceProperty(_context24 = _Object$keys(_rockerButtonGroup)).call(_co
272
283
  });
273
284
  });
274
285
  var _scrollBox = require("./scrollBox");
275
- _forEachInstanceProperty(_context25 = _Object$keys(_scrollBox)).call(_context25, function (key) {
286
+ _forEachInstanceProperty(_context26 = _Object$keys(_scrollBox)).call(_context26, function (key) {
276
287
  if (key === "default" || key === "__esModule") return;
277
288
  if (key in exports && exports[key] === _scrollBox[key]) return;
278
289
  _Object$defineProperty(exports, key, {
@@ -283,7 +294,7 @@ _forEachInstanceProperty(_context25 = _Object$keys(_scrollBox)).call(_context25,
283
294
  });
284
295
  });
285
296
  var _separator = require("./separator");
286
- _forEachInstanceProperty(_context26 = _Object$keys(_separator)).call(_context26, function (key) {
297
+ _forEachInstanceProperty(_context27 = _Object$keys(_separator)).call(_context27, function (key) {
287
298
  if (key === "default" || key === "__esModule") return;
288
299
  if (key in exports && exports[key] === _separator[key]) return;
289
300
  _Object$defineProperty(exports, key, {
@@ -294,7 +305,7 @@ _forEachInstanceProperty(_context26 = _Object$keys(_separator)).call(_context26,
294
305
  });
295
306
  });
296
307
  var _shared = require("./shared");
297
- _forEachInstanceProperty(_context27 = _Object$keys(_shared)).call(_context27, function (key) {
308
+ _forEachInstanceProperty(_context28 = _Object$keys(_shared)).call(_context28, function (key) {
298
309
  if (key === "default" || key === "__esModule") return;
299
310
  if (key in exports && exports[key] === _shared[key]) return;
300
311
  _Object$defineProperty(exports, key, {
@@ -305,7 +316,7 @@ _forEachInstanceProperty(_context27 = _Object$keys(_shared)).call(_context27, fu
305
316
  });
306
317
  });
307
318
  var _table = require("./table");
308
- _forEachInstanceProperty(_context28 = _Object$keys(_table)).call(_context28, function (key) {
319
+ _forEachInstanceProperty(_context29 = _Object$keys(_table)).call(_context29, function (key) {
309
320
  if (key === "default" || key === "__esModule") return;
310
321
  if (key in exports && exports[key] === _table[key]) return;
311
322
  _Object$defineProperty(exports, key, {
@@ -316,7 +327,7 @@ _forEachInstanceProperty(_context28 = _Object$keys(_table)).call(_context28, fun
316
327
  });
317
328
  });
318
329
  var _text = require("./text");
319
- _forEachInstanceProperty(_context29 = _Object$keys(_text)).call(_context29, function (key) {
330
+ _forEachInstanceProperty(_context30 = _Object$keys(_text)).call(_context30, function (key) {
320
331
  if (key === "default" || key === "__esModule") return;
321
332
  if (key in exports && exports[key] === _text[key]) return;
322
333
  _Object$defineProperty(exports, key, {
@@ -327,7 +338,7 @@ _forEachInstanceProperty(_context29 = _Object$keys(_text)).call(_context29, func
327
338
  });
328
339
  });
329
340
  var _tooltipTrigger = require("./tooltipTrigger");
330
- _forEachInstanceProperty(_context30 = _Object$keys(_tooltipTrigger)).call(_context30, function (key) {
341
+ _forEachInstanceProperty(_context31 = _Object$keys(_tooltipTrigger)).call(_context31, function (key) {
331
342
  if (key === "default" || key === "__esModule") return;
332
343
  if (key in exports && exports[key] === _tooltipTrigger[key]) return;
333
344
  _Object$defineProperty(exports, key, {
@@ -0,0 +1,49 @@
1
+ import { Key, ReactNode } from 'react';
2
+ import { ComboBoxState, ListState, Node } from 'react-stately';
3
+ import { AriaListBoxOptions, AriaOptionProps } from '@react-aria/listbox';
4
+ import { VirtualizerItemOptions } from '@react-aria/virtualizer';
5
+ import { ReusableView } from '@react-stately/virtualizer';
6
+ import type { CollectionChildren, FocusStrategy } from '@react-types/shared';
7
+ import { BoxProps } from './box';
8
+ export interface ComboBoxStateType extends ComboBoxState<object> {
9
+ focusStrategy: FocusStrategy;
10
+ }
11
+ export interface ListStateType extends ListState<object> {
12
+ focusStrategy: FocusStrategy;
13
+ }
14
+ export type ListBoxStateType = ListStateType | ComboBoxStateType;
15
+ interface ListBoxItemType extends Node<unknown> {
16
+ key: Key;
17
+ }
18
+ export interface ListBoxProps extends AriaListBoxOptions<object> {
19
+ hasAutoFocus?: boolean;
20
+ hasFocusWrap?: boolean;
21
+ hasNoEmptySelection?: boolean;
22
+ hasVirtualFocus?: boolean;
23
+ isLoading?: boolean;
24
+ isFocusedOnHover?: boolean;
25
+ isSelectedOnPressUp?: boolean;
26
+ onLoadMore?: () => void;
27
+ onScroll?: () => void;
28
+ state: ListBoxStateType;
29
+ renderEmptyState?: React.ReactNode;
30
+ variant?: string;
31
+ children?: CollectionChildren<object>;
32
+ }
33
+ export interface OptionType {
34
+ item: ListBoxItemType;
35
+ hasVirtualFocus?: boolean;
36
+ }
37
+ export interface AriaListBoxOptionsType extends AriaOptionProps {
38
+ onPressStart: () => void;
39
+ onPressUp: () => void;
40
+ }
41
+ export interface ListBoxSectionProps extends Omit<VirtualizerItemOptions<object, object>, 'ref'> {
42
+ children?: ReactNode;
43
+ header: ReusableView<object, ReactNode>;
44
+ }
45
+ export interface UseListBoxSectionProps {
46
+ headingProps: BoxProps;
47
+ groupProps: BoxProps;
48
+ }
49
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -13,16 +13,15 @@ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
13
13
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
14
14
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
16
- import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
16
+ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
17
17
  import { mergeProps } from 'react-aria';
18
18
  import { useCollator } from '@react-aria/i18n';
19
19
  import { useListBox } from '@react-aria/listbox';
20
20
  import { Virtualizer, VirtualizerItem } from '@react-aria/virtualizer';
21
21
  import { ListLayout } from '@react-stately/layout';
22
- import PropTypes from 'prop-types';
23
- import { isIterableProp } from '../../utils/devUtils/props/isIterable';
22
+ import { useLocalOrForwardRef } from '../../hooks';
24
23
  import Loader from '../Loader';
25
- import { Option } from './index.js';
24
+ import { Option } from './index';
26
25
  import { ListBoxContext } from './ListBoxContext';
27
26
  import ListBoxSection from './ListBoxSection';
28
27
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -78,10 +77,10 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
78
77
  ariaDescribedby = props['aria-describedby'],
79
78
  ariaDetails = props['aria-details'],
80
79
  others = _objectWithoutProperties(props, _excluded);
81
- var focusStrategy = state.focusStrategy;
80
+
82
81
  // Object matching React Aria API with all options
83
82
  var listBoxOptions = {
84
- autoFocus: hasAutoFocus || focusStrategy,
83
+ autoFocus: hasAutoFocus,
85
84
  defaultSelectedKeys: defaultSelectedKeys,
86
85
  disabledKeys: disabledKeys,
87
86
  disallowEmptySelection: hasNoEmptySelection,
@@ -106,13 +105,13 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
106
105
  'aria-describedby': ariaDescribedby,
107
106
  'aria-details': ariaDetails
108
107
  };
109
- var listBoxRef = useRef();
108
+ var listBoxRef = useLocalOrForwardRef(null);
110
109
  /* istanbul ignore next */
111
110
  useImperativeHandle(ref, function () {
112
111
  return listBoxRef.current;
113
112
  });
114
113
  var layout = useListBoxLayout(state);
115
- layout.isLoading = props.isLoading;
114
+ layout.isLoading = props.isLoading ? props.isLoading : false;
116
115
 
117
116
  // Get props for the listbox
118
117
  var _useListBox = useListBox(_objectSpread(_objectSpread({}, listBoxOptions), {}, {
@@ -141,6 +140,7 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
141
140
  return ___EmotionJSX(ListBoxContext.Provider, {
142
141
  value: state
143
142
  }, ___EmotionJSX(Virtualizer, _extends({}, mergeProps(listBoxProps, others), {
143
+ autoFocus: hasAutoFocus,
144
144
  style: {
145
145
  outline: 'none'
146
146
  },
@@ -174,42 +174,4 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
174
174
  return null;
175
175
  }));
176
176
  });
177
- ListBox.propTypes = {
178
- defaultSelectedKeys: isIterableProp,
179
- disabledKeys: isIterableProp,
180
- hasAutoFocus: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
181
- hasFocusWrap: PropTypes.bool,
182
- hasNoEmptySelection: PropTypes.bool,
183
- hasVirtualFocus: PropTypes.bool,
184
- id: PropTypes.string,
185
- isFocusedOnHover: PropTypes.bool,
186
- isLoading: PropTypes.bool,
187
- isSelectedOnPressUp: PropTypes.bool,
188
- isVirtualized: PropTypes.bool,
189
- items: isIterableProp,
190
- keyboardDelegate: PropTypes.shape({}),
191
- label: PropTypes.node,
192
- onLoadMore: PropTypes.func,
193
- onScroll: PropTypes.func,
194
- onSelectionChange: PropTypes.func,
195
- renderEmptyState: PropTypes.node,
196
- selectedKeys: isIterableProp,
197
- selectionMode: PropTypes.oneOf(['none', 'single', 'multiple']),
198
- 'aria-label': PropTypes.string,
199
- 'aria-labelledby': PropTypes.string,
200
- 'aria-describedby': PropTypes.string,
201
- 'aria-details': PropTypes.string,
202
- state: PropTypes.shape({
203
- close: PropTypes.func,
204
- collection: PropTypes.shape({}),
205
- focusStrategy: PropTypes.string,
206
- isOpen: PropTypes.bool,
207
- selectionManager: PropTypes.shape({
208
- focusedKey: PropTypes.string
209
- })
210
- })
211
- };
212
- ListBox.defaultProps = {
213
- state: {}
214
- };
215
177
  export default ListBox;
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import React from 'react';
2
+ import React, { forwardRef } from 'react';
3
3
  import { Item, Section } from 'react-stately';
4
4
  import { useListState } from '@react-stately/list';
5
5
  import { render, screen } from '@testing-library/react';
@@ -37,19 +37,13 @@ var defaultWithSectionsProps = {
37
37
  'aria-labelledby': 'label',
38
38
  items: itemsWithSections
39
39
  };
40
- var ListBoxWithState = /*#__PURE__*/React.forwardRef(function (props, ref) {
41
- var state = useListState({
42
- props: props
43
- });
40
+ var ListBoxWithState = /*#__PURE__*/forwardRef(function (props, ref) {
41
+ var theseProps = {};
42
+ var state = useListState(theseProps);
44
43
  return ___EmotionJSX(ListBox, _extends({}, props, {
45
44
  state: state,
46
45
  ref: ref
47
- }), function (item) {
48
- return ___EmotionJSX(Item, {
49
- key: item.name,
50
- childItems: item.options
51
- }, item.name);
52
- });
46
+ }));
53
47
  });
54
48
  var ListBoxWithSections = function ListBoxWithSections(props) {
55
49
  var state = useListState(props);
@@ -59,24 +53,28 @@ var ListBoxWithSections = function ListBoxWithSections(props) {
59
53
  };
60
54
  var getComponent = function getComponent() {
61
55
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
62
- return render(___EmotionJSX(ListBoxWithState, _extends({}, defaultProps, props)));
56
+ return render(___EmotionJSX(ListBoxWithState, _extends({}, defaultProps, props, {
57
+ items: items
58
+ }), function (item) {
59
+ return ___EmotionJSX(Item, {
60
+ key: item.name,
61
+ childItems: item.options
62
+ }, item.name);
63
+ }));
63
64
  };
64
65
  var getSectionsComponent = function getSectionsComponent() {
65
66
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
66
67
  return render(___EmotionJSX(ListBoxWithSections, _extends({}, defaultWithSectionsProps, props), function (section) {
67
- return (
68
- // eslint-disable-next-line testing-library/no-node-access
69
- ___EmotionJSX(Section, {
70
- key: section.name,
71
- title: section.name,
72
- items: section.options
73
- }, function (item) {
74
- return ___EmotionJSX(Item, {
75
- key: item.name,
76
- childItems: item.options
77
- }, item.name);
78
- })
79
- );
68
+ return ___EmotionJSX(Section, {
69
+ key: section.name,
70
+ title: section.name,
71
+ items: section.options
72
+ }, function (item) {
73
+ return ___EmotionJSX(Item, {
74
+ key: item.name,
75
+ childItems: item.options
76
+ }, item.name);
77
+ });
80
78
  }));
81
79
  };
82
80
  var offsetWidth;
@@ -93,9 +91,6 @@ beforeAll(function () {
93
91
  scrollHeight = jest.spyOn(window.HTMLElement.prototype, 'scrollHeight', 'get').mockImplementation(function () {
94
92
  return 48;
95
93
  });
96
- jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) {
97
- return cb();
98
- });
99
94
  jest.useFakeTimers();
100
95
  });
101
96
  afterEach(function () {
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export var ListBoxContext = /*#__PURE__*/React.createContext(null);
2
+ export var ListBoxContext = /*#__PURE__*/React.createContext({});
@@ -13,13 +13,13 @@ var ListBoxSection = function ListBoxSection(props) {
13
13
  reusableView = props.reusableView,
14
14
  header = props.header;
15
15
  var item = reusableView.content;
16
- var _useListBoxSection = useListBoxSection({
16
+ var _ref = useListBoxSection({
17
17
  heading: item.rendered,
18
18
  'aria-label': item['aria-label']
19
19
  }),
20
- headingProps = _useListBoxSection.headingProps,
21
- groupProps = _useListBoxSection.groupProps;
22
- var headerRef = useRef();
20
+ headingProps = _ref.headingProps,
21
+ groupProps = _ref.groupProps;
22
+ var headerRef = useRef(null);
23
23
  useVirtualizerItem({
24
24
  reusableView: header,
25
25
  ref: headerRef
@@ -9,16 +9,15 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
9
9
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["item", "hasVirtualFocus"];
12
+ var _excluded = ["item", "hasVirtualFocus"],
13
+ _excluded2 = ["onPressStart", "onPressUp"];
13
14
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
15
16
  import React, { forwardRef, useContext, useEffect, useImperativeHandle, useRef } from 'react';
16
17
  import CircleSmallIcon from '@pingux/mdi-react/CircleSmallIcon';
17
18
  import { useOption } from '@react-aria/listbox';
18
- import PropTypes from 'prop-types';
19
19
  import { useMultivaluesContext } from '../../context/MultivaluesContext';
20
20
  import { useStatusClasses } from '../../hooks';
21
- import { isIterableProp } from '../../utils/devUtils/props/isIterable';
22
21
  import Box from '../Box';
23
22
  import Icon from '../Icon';
24
23
  import { ListBoxContext } from './ListBoxContext';
@@ -36,7 +35,7 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
36
35
  var isSeparator = itemProps.isSeparator,
37
36
  dataId = itemProps['data-id'];
38
37
  // Get props for the option element
39
- var optionRef = useRef();
38
+ var optionRef = useRef(null);
40
39
  /* istanbul ignore next */
41
40
  useImperativeHandle(ref, function () {
42
41
  return optionRef.current;
@@ -71,11 +70,13 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
71
70
  }
72
71
  }, [isFocused, updateActiveDescendant]);
73
72
 
74
- /* Related to UIP-4992
75
- * Need to remove these properties to avoid errors in the console on the external app.
76
- * By the way, these properties return "undefined", so it shouldn't create issues */
77
- delete optionProps.onPressStart;
78
- delete optionProps.onPressUp;
73
+ // /* Related to UIP-4992
74
+ // * Need to remove these properties to avoid errors in the console on the external app.
75
+ // * By the way, these properties return "undefined", so it shouldn't create issues */
76
+ var _ref = optionProps,
77
+ onPressStart = _ref.onPressStart,
78
+ onPressUp = _ref.onPressUp,
79
+ theseOptionProps = _objectWithoutProperties(_ref, _excluded2);
79
80
  return ___EmotionJSX(Box, _extends({
80
81
  as: "li",
81
82
  isRow: true,
@@ -84,7 +85,7 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
84
85
  "data-id": dataId,
85
86
  className: classNames,
86
87
  onPointerOver: setFocusOnHover
87
- }, optionProps, others, {
88
+ }, theseOptionProps, others, {
88
89
  "aria-label": ariaLabel
89
90
  }), isSelected && ___EmotionJSX(Icon, {
90
91
  icon: CircleSmallIcon,
@@ -93,27 +94,4 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
93
94
  }
94
95
  }), rendered);
95
96
  });
96
- Option.propTypes = {
97
- hasVirtualFocus: PropTypes.bool,
98
- item: PropTypes.shape({
99
- key: PropTypes.string,
100
- props: PropTypes.shape({
101
- 'data-id': PropTypes.string,
102
- isSeparator: PropTypes.bool
103
- }),
104
- rendered: PropTypes.node,
105
- 'aria-label': PropTypes.string
106
- }),
107
- state: PropTypes.shape({
108
- disabledKeys: isIterableProp,
109
- selectionManager: PropTypes.shape({
110
- focusedKey: PropTypes.string,
111
- isSelected: PropTypes.func
112
- })
113
- })
114
- };
115
- Option.defaultProps = {
116
- item: {},
117
- state: {}
118
- };
119
97
  export default Option;
@@ -181,7 +181,7 @@ var useSelectField = function useSelectField(props, ref) {
181
181
  }), ___EmotionJSX(ListBox, _extends({
182
182
  ref: listBoxRef,
183
183
  hasNoEmptySelection: true,
184
- hasAutoFocus: state.focusStrategy || true,
184
+ hasAutoFocus: true,
185
185
  state: state,
186
186
  variant: "listBox.selectField",
187
187
  isLoading: isLoadingMore,
@@ -13,6 +13,7 @@ export * from './iconButton';
13
13
  export * from './input';
14
14
  export * from './item';
15
15
  export * from './link';
16
+ export * from './listBox';
16
17
  export * from './listItem';
17
18
  export * from './loader';
18
19
  export * from './menu';
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.51.0-alpha.0",
3
+ "version": "2.51.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",