@pingux/astro 2.234.1 → 2.235.0-alpha.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.
@@ -14,7 +14,6 @@ var _excluded = ["hasAutoFocus", "hasAddOption", "hasCustomValue", "hasNoEmptySe
14
14
  _excluded2 = ["shouldFocusOnHover", "shouldSelectOnPressUp", "UNSTABLE_itemBehavior"];
15
15
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
16
16
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
17
- import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
18
17
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
20
19
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
@@ -22,13 +21,10 @@ import { DismissButton, FocusScope, useComboBox, useOverlayPosition } from 'reac
22
21
  import { useComboBoxState } from 'react-stately';
23
22
  import { useFilter } from '@react-aria/i18n';
24
23
  import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
25
- import PropTypes from 'prop-types';
26
24
  import { usePropWarning } from '../../hooks';
27
25
  import loadingStates from '../../utils/devUtils/constants/loadingStates';
28
26
  import { getPendoID } from '../../utils/devUtils/constants/pendoID';
29
- import { isIterableProp } from '../../utils/devUtils/props/isIterable';
30
- import { ariaAttributesBasePropTypes, getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
31
- import { statusPropTypes } from '../../utils/docUtils/statusProp';
27
+ import { getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
32
28
  import ComboBoxInput from '../ComboBox';
33
29
  import ListBox from '../ListBox';
34
30
  import Popover from '../Popover';
@@ -76,11 +72,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
76
72
  label: 'default',
77
73
  allowsEmptyCollection: allowsEmptyCollection
78
74
  }, nonAriaProps);
79
- var popoverRef = useRef();
80
- var buttonRef = useRef();
81
- var listBoxRef = useRef();
82
- var inputRef = useRef();
83
- var inputWrapperRef = useRef();
75
+ var popoverRef = useRef(null);
76
+ var buttonRef = useRef(null);
77
+ var listBoxRef = useRef(null);
78
+ var inputRef = useRef(null);
79
+ var inputWrapperRef = useRef(null);
84
80
  usePropWarning(props, 'disabled', 'isDisabled');
85
81
  /* istanbul ignore next */
86
82
  useImperativeHandle(ref, function () {
@@ -91,7 +87,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
91
87
  var getItemsArr = function getItemsArr(initialArr) {
92
88
  if (initialArr && shouldShowAddOption) {
93
89
  var _context;
94
- return _concatInstanceProperty(_context = []).call(_context, initialArr, [{
90
+ return _concatInstanceProperty(_context = []).call(_context, _Array$from(initialArr), [{
95
91
  name: addOption,
96
92
  key: addOption
97
93
  }]);
@@ -133,10 +129,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
133
129
  inputProps = _useComboBox.inputProps,
134
130
  listBoxProps = _useComboBox.listBoxProps,
135
131
  labelProps = _useComboBox.labelProps;
136
- var shouldFocusOnHover = listBoxProps.shouldFocusOnHover,
137
- shouldSelectOnPressUp = listBoxProps.shouldSelectOnPressUp,
138
- action = listBoxProps['UNSTABLE_itemBehavior'],
139
- otherListBoxProps = _objectWithoutProperties(listBoxProps, _excluded2);
132
+ var _ref = listBoxProps,
133
+ shouldFocusOnHover = _ref.shouldFocusOnHover,
134
+ shouldSelectOnPressUp = _ref.shouldSelectOnPressUp,
135
+ action = _ref['UNSTABLE_itemBehavior'],
136
+ otherListBoxProps = _objectWithoutProperties(_ref, _excluded2);
140
137
  var _useOverlayPosition = useOverlayPosition({
141
138
  offset: 1,
142
139
  targetRef: inputWrapperRef,
@@ -224,125 +221,6 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
224
221
  "aria-invalid": status === 'error' && true
225
222
  })), listBox);
226
223
  });
227
- ComboBoxField.propTypes = _objectSpread(_objectSpread({
228
- /* Whether or not adding new options to the list is enabled. */
229
- hasAddOption: PropTypes.bool,
230
- /** Whether the ComboBox allows a non-item matching input value to be set. */
231
- hasCustomValue: PropTypes.bool,
232
- /** Whether the collection allows empty selection. */
233
- hasNoEmptySelection: PropTypes.bool,
234
- /**
235
- * The item keys that are disabled. These items cannot be selected, focused, or otherwise
236
- * interacted with.
237
- */
238
- disabledKeys: isIterableProp,
239
- /** The interaction required to display the ComboBox menu. */
240
- menuTrigger: PropTypes.oneOf(['focus', 'input', 'manual']),
241
- /**
242
- * Whether the ComboBox menu is prevented from flipping directions when insufficient space is
243
- * available for the given `direction` placement.
244
- */
245
- isNotFlippable: PropTypes.bool,
246
- /** Where the ComboBox menu opens relative to its trigger. */
247
- direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
248
- /** Text rendered below the input. */
249
- helperText: PropTypes.node,
250
- /** The initial selected key in the collection (uncontrolled). */
251
- defaultSelectedKey: PropTypes.string,
252
- /** The currently selected key in the collection (controlled). */
253
- selectedKey: PropTypes.string,
254
- /**
255
- * Handler that is called when the selection changes.
256
- *
257
- * `(key: Key) => any`
258
- */
259
- onSelectionChange: PropTypes.func,
260
- /** The list of ComboBox items (uncontrolled). */
261
- defaultItems: isIterableProp,
262
- /** The list of ComboBox items (controlled). */
263
- items: isIterableProp,
264
- /**
265
- * Method that is called when the open state of the menu changes.
266
- * Returns the new open state and the action that caused the opening of the menu.
267
- *
268
- * `(isOpen: boolean, menuTrigger: MenuTriggerAction) => void`
269
- */
270
- onOpenChange: PropTypes.func,
271
- loadingState: PropTypes.oneOf(_Object$values(loadingStates)),
272
- onLoadMore: PropTypes.func,
273
- /** The default value of the ComboBox input (uncontrolled). */
274
- defaultInputValue: PropTypes.string,
275
- /** The value of the ComboBox input (controlled). */
276
- inputValue: PropTypes.string,
277
- /**
278
- * Handler that is called when the ComboBox input value changes.
279
- *
280
- * `(value: string) => void`
281
- */
282
- onInputChange: PropTypes.func,
283
- /** Whether user input is required on the input before form submission. */
284
- isRequired: PropTypes.bool,
285
- /** Whether the input is disabled. */
286
- isDisabled: PropTypes.bool,
287
- /** Whether the input can be selected but not changed by the user. */
288
- isReadOnly: PropTypes.bool,
289
- /** The rendered label for the field. */
290
- label: PropTypes.node,
291
- /** Temporary text that occupies the text input when it is empty. */
292
- placeholder: PropTypes.string,
293
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
294
- id: PropTypes.string,
295
- /** Whether the element should receive focus on render. */
296
- hasAutoFocus: PropTypes.bool,
297
- /** Whether the field has a status indicator. */
298
- hasNoStatusIndicator: PropTypes.bool,
299
- /**
300
- * Handler that is called when the element receives focus.
301
- *
302
- * `(e: FocusEvent) => void`
303
- */
304
- onFocus: PropTypes.func,
305
- /**
306
- * Handler that is called when the element loses focus.
307
- *
308
- * `(e: FocusEvent) => void`
309
- */
310
- onBlur: PropTypes.func,
311
- /**
312
- * Handler that is called when the element's focus status changes.
313
- *
314
- * `(isFocused: boolean) => void`
315
- */
316
- onFocusChange: PropTypes.func,
317
- /**
318
- * Handler that is called when a key is pressed.
319
- *
320
- * `(e: KeyboardEvent) => void`
321
- */
322
- onKeyDown: PropTypes.func,
323
- /**
324
- * Handler that is called when a key is released.
325
- *
326
- * `(e: KeyboardEvent) => void`
327
- */
328
- onKeyUp: PropTypes.func,
329
- /**
330
- * Handler that determines the default filtering for items. If undefined, `contains` from
331
- * [useFilter](https://react-spectrum.adobe.com/react-aria/useFilter.html) is used.
332
- *
333
- * `(option: string, inputValue: string) => boolean`
334
- */
335
- defaultFilter: PropTypes.func,
336
- // /** Props object that is spread directly into the ScrollBox element. */
337
- /** @ignore */
338
- scrollBoxProps: PropTypes.shape({
339
- maxHeight: PropTypes.string
340
- }),
341
- /** Props object that is spread directly into the ComboBoxInput element. */
342
- controlProps: PropTypes.shape({
343
- onClick: PropTypes.func
344
- })
345
- }, statusPropTypes), ariaAttributesBasePropTypes);
346
224
  ComboBoxField.defaultProps = {
347
225
  menuTrigger: 'focus',
348
226
  direction: 'bottom',
@@ -330,9 +330,10 @@ export var AsyncLoading = function AsyncLoading() {
330
330
  loadingState: loading,
331
331
  onLoadMore: handleLoadMore
332
332
  }), function (item) {
333
+ var _item$name, _item$name2;
333
334
  return ___EmotionJSX(Item, {
334
- key: item.name.given
335
- }, item.name.given);
335
+ key: (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.given
336
+ }, (_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : _item$name2.given);
336
337
  }));
337
338
  };
338
339
  export var ControlledInput = function ControlledInput() {
@@ -411,8 +412,8 @@ export var ControlledFiltering = function ControlledFiltering() {
411
412
  inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
412
413
  selectedKey: key,
413
414
  itemsList: _filterInstanceProperty(items).call(items, function (item) {
414
- var _selectedItem$name;
415
- return startsWith(item.name, (_selectedItem$name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _selectedItem$name !== void 0 ? _selectedItem$name : '');
415
+ var _name;
416
+ return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
416
417
  })
417
418
  });
418
419
  };
@@ -145,8 +145,8 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
145
145
  inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
146
146
  selectedKey: key,
147
147
  itemsList: _filterInstanceProperty(items).call(items, function (item) {
148
- var _selectedItem$name;
149
- return startsWith(item.name, (_selectedItem$name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _selectedItem$name !== void 0 ? _selectedItem$name : '');
148
+ var _name;
149
+ return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
150
150
  })
151
151
  });
152
152
  };
@@ -173,7 +173,6 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
173
173
  }
174
174
  };
175
175
  return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
176
- label: "Example label",
177
176
  items: fieldState.itemsList,
178
177
  inputValue: fieldState.inputValue,
179
178
  selectedKey: fieldState.selectedKey,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -19,6 +19,8 @@ export * from './codeEditor';
19
19
  export * from './codeView';
20
20
  export * from './collapsiblePanel';
21
21
  export * from './colorField';
22
+ export * from './ComboBox';
23
+ export * from './ComboBoxField';
22
24
  export * from './copyText';
23
25
  export * from './dataTable';
24
26
  export * from './datePicker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.234.1",
3
+ "version": "2.235.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",