@pingux/astro 2.239.0-alpha.0 → 2.240.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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { LinkSelectFieldProps } from '../../types/linkSelectField';
3
+ declare const LinkSelectField: React.ForwardRefExoticComponent<LinkSelectFieldProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default LinkSelectField;
@@ -8,14 +8,12 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactAria = require("react-aria");
11
- var _propTypes = _interopRequireDefault(require("prop-types"));
12
11
  var _uuid = require("uuid");
13
12
  var _ = require("../..");
14
13
  var _hooks = require("../../hooks");
15
14
  var _pendoID = require("../../utils/devUtils/constants/pendoID");
16
15
  var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
17
16
  var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
18
- var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
19
17
  var _statusProp = require("../../utils/docUtils/statusProp");
20
18
  var _SelectFieldBase = _interopRequireDefault(require("../SelectFieldBase"));
21
19
  var _react2 = require("@emotion/react");
@@ -75,7 +73,7 @@ const LinkSelectField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
75
73
  variant: "selectLink",
76
74
  tabIndex: isDisabled ? -1 : 0
77
75
  }, (0, _pendoID.getPendoID)(displayName), triggerProps, raTriggerProps, ariaProps, {
78
- "aria-describedby": helperText && helperTextId
76
+ "aria-describedby": helperText ? helperTextId : undefined
79
77
  }), (0, _react2.jsx)(_.Text, {
80
78
  variant: "linkSelectFieldLabel",
81
79
  className: "link-select-field-placeholder"
@@ -104,92 +102,11 @@ const LinkSelectField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
104
102
  id: helperTextId
105
103
  }, helperText));
106
104
  return (0, _react2.jsx)(_SelectFieldBase.default, (0, _extends2.default)({}, props, selectFieldProps, {
105
+ label: props.label,
106
+ helperText: props.helperText,
107
107
  trigger: triggerProp || triggerNode
108
108
  }));
109
109
  });
110
- LinkSelectField.propTypes = {
111
- /** Alignment of the popover menu relative to the trigger. */
112
- align: _propTypes.default.oneOf(['start', 'end', 'middle']),
113
- /** Where the popover menu opens relative to its trigger. */
114
- direction: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
115
- /** The initial selected key in the collection (uncontrolled). */
116
- defaultSelectedKey: _propTypes.default.string,
117
- /** Array of keys to disable within the options list. */
118
- disabledKeys: _propTypes.default.arrayOf(_propTypes.default.string),
119
- /** Whether the collection allows empty selection. */
120
- hasNoEmptySelection: _propTypes.default.bool,
121
- /** Whether the field has a status indicator. */
122
- hasNoStatusIndicator: _propTypes.default.bool,
123
- /** Text rendered below the input. */
124
- helperText: _propTypes.default.node,
125
- /** Props object that is spread directly into the helphint element. */
126
- helpHintProps: _propTypes.default.shape({}),
127
- /** If present this prop will cause a help hint to render in the label of the field. */
128
- hintText: _propTypes.default.string,
129
- /** Sets the default open state of the menu. */
130
- isDefaultOpen: _propTypes.default.bool,
131
- /** Whether the input is disabled. */
132
- isDisabled: _propTypes.default.bool,
133
- /** Whether the items are currently loading. */
134
- isLoading: _propTypes.default.bool,
135
- /** @ignore Whether the menu should automatically flip direction when space is limited. */
136
- isNotFlippable: _propTypes.default.bool,
137
- /** Sets the open state of the menu. */
138
- isOpen: _propTypes.default.bool,
139
- /** @ignore Whether the input can be selected but not changed by the user. */
140
- isReadOnly: _propTypes.default.bool,
141
- /** Whether user input is required on the input before form submission. */
142
- isRequired: _propTypes.default.bool,
143
- /**
144
- * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
145
- * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
146
- */
147
- items: _propTypes.default.arrayOf(_propTypes.default.shape({})),
148
- /** The label for the select element. */
149
- label: _propTypes.default.node,
150
- /** The name for the select element, used when submitting a form. */
151
- name: _propTypes.default.string,
152
- /** Temporary text that occupies the text input when it is empty. */
153
- placeholder: _propTypes.default.string,
154
- /** The currently selected key in the collection (controlled). */
155
- selectedKey: _propTypes.default.string,
156
- /**
157
- * Handler that is called when more items should be loaded, e.g. while scrolling near the bottom.
158
- *
159
- * () => any
160
- */
161
- onLoadMore: _propTypes.default.func,
162
- /**
163
- * Method that is called when the open state of the menu changes.
164
- *
165
- * (isOpen: boolean) => void
166
- */
167
- onOpenChange: _propTypes.default.func,
168
- /**
169
- * Handler that is called when the selection changes.
170
- *
171
- * (key: Key) => any
172
- */
173
- onSelectionChange: _propTypes.default.func,
174
- /** Display an inline loader inside the select trigger while loading. */
175
- hasInlineLoader: _propTypes.default.bool,
176
- /**
177
- * Props object that is spread directly into the Icon inside the default trigger button.
178
- * Supports all IconProps (icon, title, size, color, sx, etc.).
179
- * The sx prop is merged with the rotation style.
180
- */
181
- iconProps: _propTypes.default.shape({}),
182
- /** Width of the popover menu. Accepts any valid CSS unit. */
183
- popoverWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
184
- /**
185
- * A ReactNode that replaces the default Button trigger entirely.
186
- * When provided, the local Button element is not rendered.
187
- */
188
- trigger: _propTypes.default.node,
189
- ..._statusProp.statusPropTypes,
190
- ..._fieldAttributes.inputFieldAttributesBasePropTypes,
191
- ..._ariaAttributes.ariaAttributesBasePropTypes
192
- };
193
110
  LinkSelectField.defaultProps = {
194
111
  placeholder: 'Select',
195
112
  align: 'start',
@@ -0,0 +1 @@
1
+ export { default } from './LinkSelectField';
@@ -44,6 +44,7 @@ export * from './item';
44
44
  export * from './label';
45
45
  export * from './labelValuePairs';
46
46
  export * from './link';
47
+ export * from './linkSelectField';
47
48
  export * from './listBox';
48
49
  export * from './listItem';
49
50
  export * from './loader';
@@ -509,6 +509,17 @@ Object.keys(_link).forEach(function (key) {
509
509
  }
510
510
  });
511
511
  });
512
+ var _linkSelectField = require("./linkSelectField");
513
+ Object.keys(_linkSelectField).forEach(function (key) {
514
+ if (key === "default" || key === "__esModule") return;
515
+ if (key in exports && exports[key] === _linkSelectField[key]) return;
516
+ Object.defineProperty(exports, key, {
517
+ enumerable: true,
518
+ get: function () {
519
+ return _linkSelectField[key];
520
+ }
521
+ });
522
+ });
512
523
  var _listBox = require("./listBox");
513
524
  Object.keys(_listBox).forEach(function (key) {
514
525
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,111 @@
1
+ import { UseSelectFieldProps } from '../hooks/useSelectField/useSelectField';
2
+ import { IconProps } from './icon';
3
+ import { Status } from './item';
4
+ export interface LinkSelectFieldProps extends Omit<UseSelectFieldProps<object>, 'align' | 'helperText' | 'label'> {
5
+ /** Alignment of the popover menu relative to the trigger. */
6
+ align?: 'start' | 'end' | 'middle';
7
+ /** Where the popover menu opens relative to its trigger. */
8
+ direction?: 'top' | 'right' | 'bottom' | 'left';
9
+ /** The initial selected key in the collection (uncontrolled). */
10
+ defaultSelectedKey?: string;
11
+ /** Array of keys to disable within the options list. */
12
+ disabledKeys?: Iterable<string>;
13
+ /** Whether the collection allows empty selection. */
14
+ hasNoEmptySelection?: boolean;
15
+ /** Whether the field has a status indicator. */
16
+ hasNoStatusIndicator?: boolean;
17
+ /** Text rendered below the input. */
18
+ helperText?: React.ReactNode;
19
+ /** Props object that is spread directly into the helphint element. */
20
+ helpHintProps?: Record<string, unknown>;
21
+ /** If present this prop will cause a help hint to render in the label of the field. */
22
+ hintText?: string;
23
+ /** The label for the select element. */
24
+ label?: React.ReactNode;
25
+ /** Sets the default open state of the menu. */
26
+ isDefaultOpen?: boolean;
27
+ /** Whether the input is disabled. */
28
+ isDisabled?: boolean;
29
+ /** Whether the items are currently loading. */
30
+ isLoading?: boolean;
31
+ /** @ignore Whether the menu should automatically flip direction when space is limited. */
32
+ isNotFlippable?: boolean;
33
+ /** Sets the open state of the menu. */
34
+ isOpen?: boolean;
35
+ /** @ignore Whether the input can be selected but not changed by the user. */
36
+ isReadOnly?: boolean;
37
+ /** Whether user input is required on the input before form submission. */
38
+ isRequired?: boolean;
39
+ /**
40
+ * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
41
+ * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
42
+ */
43
+ items?: Iterable<object>;
44
+ /** The name for the select element, used when submitting a form. */
45
+ name?: string;
46
+ /** Temporary text that occupies the text input when it is empty. */
47
+ placeholder?: string;
48
+ /** The currently selected key in the collection (controlled). */
49
+ selectedKey?: string;
50
+ /**
51
+ * Handler that is called when more items should be loaded, e.g. while scrolling near the bottom.
52
+ *
53
+ * () => any
54
+ */
55
+ onLoadMore?: () => unknown;
56
+ /**
57
+ * Method that is called when the open state of the menu changes.
58
+ *
59
+ * (isOpen: boolean) => void
60
+ */
61
+ onOpenChange?: (isOpen: boolean) => void;
62
+ /**
63
+ * Handler that is called when the selection changes.
64
+ *
65
+ * (key: Key) => any
66
+ */
67
+ onSelectionChange?: (key: React.Key | null) => void;
68
+ /** Display an inline loader inside the select trigger while loading. */
69
+ hasInlineLoader?: boolean;
70
+ /**
71
+ * Props object that is spread directly into the Icon inside the default trigger button.
72
+ * Supports all IconProps (icon, title, size, color, sx, etc.).
73
+ * The sx prop is merged with the rotation style.
74
+ */
75
+ iconProps?: IconProps;
76
+ /** Width of the popover menu. Accepts any valid CSS unit. */
77
+ popoverWidth?: string | number;
78
+ /**
79
+ * A ReactNode that replaces the default Button trigger entirely.
80
+ * When provided, the local Button element is not rendered.
81
+ */
82
+ trigger?: React.ReactNode;
83
+ /** Props object that is spread directly into the default trigger button. */
84
+ triggerProps?: Record<string, unknown>;
85
+ /** Determines any status related styling. */
86
+ status?: Status;
87
+ /** Props object spread into the outer-most container. Wrapper and label will be children. */
88
+ containerProps?: Record<string, unknown>;
89
+ /** Props object that is spread directly into the input element. Will be a child
90
+ * of the Wrapper. */
91
+ controlProps?: Record<string, unknown>;
92
+ /** Props object spread to the field control wrapper, i.e. the immediate parent
93
+ * element for the control, sibling of the label, and child of the field container. */
94
+ controlWrapperProps?: Record<string, unknown>;
95
+ /** Props object spread to the field label, i.e. the visible text which labels the control. */
96
+ labelProps?: Record<string, unknown>;
97
+ /** Identifies the element (or elements) whose contents or presence
98
+ * are controlled by the current element. */
99
+ 'aria-controls'?: string;
100
+ /** Identifies the element (or elements) that describes the object. */
101
+ 'aria-describedby'?: string;
102
+ /** Identifies the element (or elements) that provide a detailed, extended description
103
+ * for the object. */
104
+ 'aria-details'?: string;
105
+ /** Identifies the element that provides an error message for the object. */
106
+ 'aria-errormessage'?: string;
107
+ /** Defines a string value that labels the current element. */
108
+ 'aria-label'?: string;
109
+ /** Identifies the element (or elements) that labels the current element. */
110
+ 'aria-labelledby'?: string;
111
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,15 +1,13 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { VisuallyHidden } from 'react-aria';
4
- import PropTypes from 'prop-types';
5
4
  import { v4 as uuid } from 'uuid';
6
5
  import { Box, Button, Icon, Loader, Text } from '../..';
7
6
  import { useGetTheme, usePropWarning, useSelectField } from '../../hooks';
8
7
  import { getPendoID } from '../../utils/devUtils/constants/pendoID';
9
8
  import statuses from '../../utils/devUtils/constants/statuses';
10
- import { ariaAttributesBasePropTypes, getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
11
- import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
12
- import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusProp';
9
+ import { getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
10
+ import { statusDefaultProp } from '../../utils/docUtils/statusProp';
13
11
  import SelectFieldBase from '../SelectFieldBase';
14
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
15
13
  const displayName = 'LinkSelectField';
@@ -67,7 +65,7 @@ const LinkSelectField = /*#__PURE__*/forwardRef((props, ref) => {
67
65
  variant: "selectLink",
68
66
  tabIndex: isDisabled ? -1 : 0
69
67
  }, getPendoID(displayName), triggerProps, raTriggerProps, ariaProps, {
70
- "aria-describedby": helperText && helperTextId
68
+ "aria-describedby": helperText ? helperTextId : undefined
71
69
  }), ___EmotionJSX(Text, {
72
70
  variant: "linkSelectFieldLabel",
73
71
  className: "link-select-field-placeholder"
@@ -96,92 +94,11 @@ const LinkSelectField = /*#__PURE__*/forwardRef((props, ref) => {
96
94
  id: helperTextId
97
95
  }, helperText));
98
96
  return ___EmotionJSX(SelectFieldBase, _extends({}, props, selectFieldProps, {
97
+ label: props.label,
98
+ helperText: props.helperText,
99
99
  trigger: triggerProp || triggerNode
100
100
  }));
101
101
  });
102
- LinkSelectField.propTypes = {
103
- /** Alignment of the popover menu relative to the trigger. */
104
- align: PropTypes.oneOf(['start', 'end', 'middle']),
105
- /** Where the popover menu opens relative to its trigger. */
106
- direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
107
- /** The initial selected key in the collection (uncontrolled). */
108
- defaultSelectedKey: PropTypes.string,
109
- /** Array of keys to disable within the options list. */
110
- disabledKeys: PropTypes.arrayOf(PropTypes.string),
111
- /** Whether the collection allows empty selection. */
112
- hasNoEmptySelection: PropTypes.bool,
113
- /** Whether the field has a status indicator. */
114
- hasNoStatusIndicator: PropTypes.bool,
115
- /** Text rendered below the input. */
116
- helperText: PropTypes.node,
117
- /** Props object that is spread directly into the helphint element. */
118
- helpHintProps: PropTypes.shape({}),
119
- /** If present this prop will cause a help hint to render in the label of the field. */
120
- hintText: PropTypes.string,
121
- /** Sets the default open state of the menu. */
122
- isDefaultOpen: PropTypes.bool,
123
- /** Whether the input is disabled. */
124
- isDisabled: PropTypes.bool,
125
- /** Whether the items are currently loading. */
126
- isLoading: PropTypes.bool,
127
- /** @ignore Whether the menu should automatically flip direction when space is limited. */
128
- isNotFlippable: PropTypes.bool,
129
- /** Sets the open state of the menu. */
130
- isOpen: PropTypes.bool,
131
- /** @ignore Whether the input can be selected but not changed by the user. */
132
- isReadOnly: PropTypes.bool,
133
- /** Whether user input is required on the input before form submission. */
134
- isRequired: PropTypes.bool,
135
- /**
136
- * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
137
- * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
138
- */
139
- items: PropTypes.arrayOf(PropTypes.shape({})),
140
- /** The label for the select element. */
141
- label: PropTypes.node,
142
- /** The name for the select element, used when submitting a form. */
143
- name: PropTypes.string,
144
- /** Temporary text that occupies the text input when it is empty. */
145
- placeholder: PropTypes.string,
146
- /** The currently selected key in the collection (controlled). */
147
- selectedKey: PropTypes.string,
148
- /**
149
- * Handler that is called when more items should be loaded, e.g. while scrolling near the bottom.
150
- *
151
- * () => any
152
- */
153
- onLoadMore: PropTypes.func,
154
- /**
155
- * Method that is called when the open state of the menu changes.
156
- *
157
- * (isOpen: boolean) => void
158
- */
159
- onOpenChange: PropTypes.func,
160
- /**
161
- * Handler that is called when the selection changes.
162
- *
163
- * (key: Key) => any
164
- */
165
- onSelectionChange: PropTypes.func,
166
- /** Display an inline loader inside the select trigger while loading. */
167
- hasInlineLoader: PropTypes.bool,
168
- /**
169
- * Props object that is spread directly into the Icon inside the default trigger button.
170
- * Supports all IconProps (icon, title, size, color, sx, etc.).
171
- * The sx prop is merged with the rotation style.
172
- */
173
- iconProps: PropTypes.shape({}),
174
- /** Width of the popover menu. Accepts any valid CSS unit. */
175
- popoverWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
176
- /**
177
- * A ReactNode that replaces the default Button trigger entirely.
178
- * When provided, the local Button element is not rendered.
179
- */
180
- trigger: PropTypes.node,
181
- ...statusPropTypes,
182
- ...inputFieldAttributesBasePropTypes,
183
- ...ariaAttributesBasePropTypes
184
- };
185
102
  LinkSelectField.defaultProps = {
186
103
  placeholder: 'Select',
187
104
  align: 'start',
@@ -44,6 +44,7 @@ export * from './item';
44
44
  export * from './label';
45
45
  export * from './labelValuePairs';
46
46
  export * from './link';
47
+ export * from './linkSelectField';
47
48
  export * from './listBox';
48
49
  export * from './listItem';
49
50
  export * from './loader';
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.239.0-alpha.0",
3
+ "version": "2.240.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",