@pingux/astro 2.87.0-alpha.3 → 2.88.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.
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +4 -1
- package/lib/cjs/components/SearchField/Search.styles.d.ts +39 -0
- package/lib/cjs/components/SearchField/SearchField.d.ts +4 -0
- package/lib/cjs/components/SearchField/SearchField.js +1 -169
- package/lib/cjs/components/SearchField/SearchField.stories.d.ts +10 -0
- package/lib/cjs/components/SearchField/SearchField.stories.js +6 -2
- package/lib/cjs/components/SearchField/SearchField.test.d.ts +1 -0
- package/lib/cjs/components/SearchField/SearchField.test.js +2 -2
- package/lib/cjs/components/SearchField/index.d.ts +1 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +22 -11
- package/lib/cjs/types/searchField.d.ts +168 -0
- package/lib/cjs/types/searchField.js +6 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +4 -1
- package/lib/components/SearchField/SearchField.js +3 -171
- package/lib/components/SearchField/SearchField.stories.js +6 -2
- package/lib/components/SearchField/SearchField.test.js +2 -2
- package/lib/types/index.js +1 -0
- package/lib/types/searchField.js +1 -0
- package/package.json +1 -1
@@ -274,12 +274,15 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
274
274
|
autoFocus: true,
|
275
275
|
contain: true
|
276
276
|
}, (0, _react2.jsx)(_index.SearchField, (0, _extends2["default"])({
|
277
|
+
value: searchValue,
|
277
278
|
"aria-describedby": optionsNumberMessageId,
|
278
279
|
autocomplete: "off",
|
279
280
|
placeholder: "Search",
|
280
281
|
"aria-label": "Items Search",
|
281
282
|
"data-testid": "Environment-Breadcrumb-Search",
|
282
|
-
onChange:
|
283
|
+
onChange: function onChange(val) {
|
284
|
+
return setSearchValue(val);
|
285
|
+
},
|
283
286
|
p: "10px"
|
284
287
|
}, searchProps)), (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, {
|
285
288
|
role: "alert",
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export declare const clearButtonIcon: {
|
2
|
+
color: string;
|
3
|
+
};
|
4
|
+
export declare const wrapper: {
|
5
|
+
position: string;
|
6
|
+
justifyContent: string;
|
7
|
+
'> input::-webkit-search-cancel-button, > input::-webkit-search-decoration': {
|
8
|
+
WebkitAppearance: string;
|
9
|
+
};
|
10
|
+
'&.is-focused > *': {
|
11
|
+
zIndex: number;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export declare const icon: {
|
15
|
+
position: string;
|
16
|
+
color: string;
|
17
|
+
ml: string;
|
18
|
+
};
|
19
|
+
declare const _default: {
|
20
|
+
clearButtonIcon: {
|
21
|
+
color: string;
|
22
|
+
};
|
23
|
+
wrapper: {
|
24
|
+
position: string;
|
25
|
+
justifyContent: string;
|
26
|
+
'> input::-webkit-search-cancel-button, > input::-webkit-search-decoration': {
|
27
|
+
WebkitAppearance: string;
|
28
|
+
};
|
29
|
+
'&.is-focused > *': {
|
30
|
+
zIndex: number;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
icon: {
|
34
|
+
position: string;
|
35
|
+
color: string;
|
36
|
+
ml: string;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
export default _default;
|
@@ -22,12 +22,9 @@ var _reactAria = require("react-aria");
|
|
22
22
|
var _reactStately = require("react-stately");
|
23
23
|
var _CloseIcon = _interopRequireDefault(require("@pingux/mdi-react/CloseIcon"));
|
24
24
|
var _SearchIcon = _interopRequireDefault(require("@pingux/mdi-react/SearchIcon"));
|
25
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
26
25
|
var _ = require("../..");
|
27
26
|
var _hooks = require("../../hooks");
|
28
27
|
var _pendoID = require("../../utils/devUtils/constants/pendoID");
|
29
|
-
var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
30
|
-
var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
31
28
|
var _react2 = require("@emotion/react");
|
32
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
33
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -44,12 +41,8 @@ var SearchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
44
41
|
controlProps = props.controlProps,
|
45
42
|
iconProps = props.iconProps,
|
46
43
|
labelProps = props.labelProps;
|
47
|
-
var searchRef = (0, _react.useRef)();
|
48
44
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
49
|
-
|
50
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
51
|
-
return searchRef.current;
|
52
|
-
});
|
45
|
+
var searchRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
53
46
|
var state = (0, _reactStately.useSearchFieldState)(props);
|
54
47
|
var _useSearchField = (0, _reactAria.useSearchField)(_objectSpread({
|
55
48
|
autoComplete: autocomplete,
|
@@ -105,167 +98,6 @@ var SearchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
105
98
|
}
|
106
99
|
}))));
|
107
100
|
});
|
108
|
-
SearchField.propTypes = _objectSpread(_objectSpread({
|
109
|
-
/**
|
110
|
-
* @ignore
|
111
|
-
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
112
|
-
* group, or application.
|
113
|
-
*/
|
114
|
-
'aria-activedescendant': _propTypes["default"].string,
|
115
|
-
/**
|
116
|
-
* Indicates whether inputting text could trigger display of one or more predictions of the
|
117
|
-
* user's intended value for an input and specifies how predictions would be presented if they
|
118
|
-
* are made.
|
119
|
-
*/
|
120
|
-
'aria-autocomplete': _propTypes["default"].oneOf(['none', 'inline', 'list', 'both']),
|
121
|
-
/**
|
122
|
-
* @ignore
|
123
|
-
* Indicates the availability and type of interactive popup element, such as menu or dialog, that
|
124
|
-
* can be triggered by an element.
|
125
|
-
*/
|
126
|
-
'aria-haspopup': _propTypes["default"].oneOf([true, false, 'menu', 'listbox', 'tree', 'grid', 'dialog']),
|
127
|
-
/** How the input should handle autocompletion according to the browser. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). The `autocomplete` prop is an alias for this. */
|
128
|
-
autoComplete: _propTypes["default"].string,
|
129
|
-
/** @ignore Alias for `autoComplete` prop. Exists for backwards-compatibility. */
|
130
|
-
autocomplete: _propTypes["default"].string,
|
131
|
-
/** The default value (uncontrolled). */
|
132
|
-
defaultValue: _propTypes["default"].string,
|
133
|
-
/** Whether the element should receive focus on render. */
|
134
|
-
hasAutoFocus: _propTypes["default"].bool,
|
135
|
-
/** Whether to display the clear button or not. */
|
136
|
-
hasNoClearButton: _propTypes["default"].bool,
|
137
|
-
/** The icon to display alongside the placeholder text. */
|
138
|
-
icon: _propTypes["default"].elementType,
|
139
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
140
|
-
id: _propTypes["default"].string,
|
141
|
-
/** Whether the input is disabled. */
|
142
|
-
isDisabled: _propTypes["default"].bool,
|
143
|
-
/** The content to display as the label. */
|
144
|
-
label: _propTypes["default"].node,
|
145
|
-
/** The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */
|
146
|
-
name: _propTypes["default"].string,
|
147
|
-
/** Temporary text that occupies the text input when it is empty. */
|
148
|
-
placeholder: _propTypes["default"].string,
|
149
|
-
/** The current value (controlled). */
|
150
|
-
value: _propTypes["default"].string,
|
151
|
-
/**
|
152
|
-
* Handler that is called when the SearchField is submitted.
|
153
|
-
* (value: string) => void
|
154
|
-
*/
|
155
|
-
onSubmit: _propTypes["default"].func,
|
156
|
-
/**
|
157
|
-
* Handler that is called when the clear button is pressed.
|
158
|
-
* () => void
|
159
|
-
*/
|
160
|
-
onClear: _propTypes["default"].func,
|
161
|
-
/**
|
162
|
-
* Handler that is called when the element receives focus.
|
163
|
-
* (e: FocusEvent) => void
|
164
|
-
*/
|
165
|
-
onFocus: _propTypes["default"].func,
|
166
|
-
/**
|
167
|
-
* Handler that is called when the element loses focus.
|
168
|
-
* (e: FocusEvent) => void
|
169
|
-
*/
|
170
|
-
onBlur: _propTypes["default"].func,
|
171
|
-
/**
|
172
|
-
* Handler that is called when a key is pressed.
|
173
|
-
* (e: KeyboardEvent) => void
|
174
|
-
*/
|
175
|
-
onKeyDown: _propTypes["default"].func,
|
176
|
-
/**
|
177
|
-
* Handler that is called when a key is released.
|
178
|
-
* (e: KeyboardEvent) => void
|
179
|
-
*/
|
180
|
-
onKeyUp: _propTypes["default"].func,
|
181
|
-
/**
|
182
|
-
* Handler that is called when the value changes.
|
183
|
-
* (value: string) => void
|
184
|
-
*/
|
185
|
-
onChange: _propTypes["default"].func,
|
186
|
-
/** Props object that is spread into the icon element. */
|
187
|
-
iconProps: _propTypes["default"].shape({}),
|
188
|
-
// NOTE: unsurfaced useSearchField / useSearchFieldState props listed below
|
189
|
-
|
190
|
-
/** @ignore Whether the input can be selected but not changed by the user. */
|
191
|
-
isReadOnly: _propTypes["default"].bool,
|
192
|
-
/**
|
193
|
-
* @ignore
|
194
|
-
* Whether user input is required on the input before form submission.
|
195
|
-
* Often paired with the necessityIndicator prop to add a visual indicator to the input.
|
196
|
-
*/
|
197
|
-
isRequired: _propTypes["default"].bool,
|
198
|
-
/**
|
199
|
-
* @ignore
|
200
|
-
* Handler that is called when the element's focus status changes.
|
201
|
-
* (isFocused: boolean) => void
|
202
|
-
*/
|
203
|
-
onFocusChange: _propTypes["default"].func,
|
204
|
-
/**
|
205
|
-
* @ignore
|
206
|
-
* Whether to exclude the element from the sequential tab order. If true, the element will not be
|
207
|
-
* focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where
|
208
|
-
* an alternative means of accessing the element or its functionality via the keyboard is
|
209
|
-
* available.
|
210
|
-
*/
|
211
|
-
isExcludedFromTabOrder: _propTypes["default"].bool,
|
212
|
-
/** The maximum number of characters supported by the input set by the user. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength). */
|
213
|
-
maxLength: _propTypes["default"].number,
|
214
|
-
/** @ignore The minimum number of characters required by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength). */
|
215
|
-
minLength: _propTypes["default"].number,
|
216
|
-
/** @ignore Regex pattern that the value of the input must match to be valid. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern). */
|
217
|
-
pattern: _propTypes["default"].string,
|
218
|
-
/** @ignore The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype). */
|
219
|
-
type: _propTypes["default"].string,
|
220
|
-
/**
|
221
|
-
* @ignore
|
222
|
-
* Hints at the type of data that might be entered by the user while editing the element or its
|
223
|
-
* contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).
|
224
|
-
*/
|
225
|
-
inputMode: _propTypes["default"].oneOf(['none', 'text', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
|
226
|
-
/**
|
227
|
-
* @ignore
|
228
|
-
* Handler that is called when the user copies text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncopy).
|
229
|
-
*/
|
230
|
-
onCopy: _propTypes["default"].func,
|
231
|
-
/** @ignore Handler that is called when the user cuts text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncut). */
|
232
|
-
onCut: _propTypes["default"].func,
|
233
|
-
/** @ignore Handler that is called when the user pastes text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onpaste). */
|
234
|
-
onPaste: _propTypes["default"].func,
|
235
|
-
/**
|
236
|
-
* @ignore
|
237
|
-
* Handler that is called when a text composition system starts a new text composition session.
|
238
|
-
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event).
|
239
|
-
*/
|
240
|
-
onCompositionStart: _propTypes["default"].func,
|
241
|
-
/**
|
242
|
-
* @ignore
|
243
|
-
* Handler that is called when a text composition system completes or cancels the current text
|
244
|
-
* composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event).
|
245
|
-
*/
|
246
|
-
onCompositionEnd: _propTypes["default"].func,
|
247
|
-
/**
|
248
|
-
* @ignore
|
249
|
-
* Handler that is called when a new character is received in the current text composition
|
250
|
-
* session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event).
|
251
|
-
*/
|
252
|
-
onCompositionUpdate: _propTypes["default"].func,
|
253
|
-
/**
|
254
|
-
* @ignore
|
255
|
-
* Handler that is called when text in the input is selected. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/select_event).
|
256
|
-
*/
|
257
|
-
onSelect: _propTypes["default"].func,
|
258
|
-
/**
|
259
|
-
* @ignore
|
260
|
-
* Handler that is called when the input value is about to be modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event).
|
261
|
-
*/
|
262
|
-
onBeforeInput: _propTypes["default"].func,
|
263
|
-
/**
|
264
|
-
* @ignore
|
265
|
-
* Handler that is called when the input value is modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event).
|
266
|
-
*/
|
267
|
-
onInput: _propTypes["default"].func
|
268
|
-
}, _ariaAttributes.ariaAttributesBasePropTypes), _fieldAttributes.inputFieldAttributesBasePropTypes);
|
269
101
|
SearchField.defaultProps = {
|
270
102
|
hasNoClearButton: false,
|
271
103
|
icon: _SearchIcon["default"]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
2
|
+
import { SearchFieldProps } from '../../types';
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
4
|
+
export default _default;
|
5
|
+
export declare const Default: StoryFn<SearchFieldProps>;
|
6
|
+
export declare const Controlled: StoryFn<SearchFieldProps>;
|
7
|
+
export declare const CustomIcon: StoryFn<SearchFieldProps>;
|
8
|
+
export declare const NoClearButton: StoryFn<SearchFieldProps>;
|
9
|
+
export declare const ControlledWithDebouncedInput: StoryFn<SearchFieldProps>;
|
10
|
+
export declare const WithFilter: StoryFn<SearchFieldProps>;
|
@@ -96,7 +96,9 @@ var Controlled = function Controlled() {
|
|
96
96
|
setValue = _useState2[1];
|
97
97
|
return (0, _react2.jsx)(_index.SearchField, {
|
98
98
|
value: value,
|
99
|
-
onChange:
|
99
|
+
onChange: function onChange(val) {
|
100
|
+
return setValue(val);
|
101
|
+
},
|
100
102
|
"aria-label": "Search Groups",
|
101
103
|
placeholder: "Search Groups",
|
102
104
|
onSubmit: function onSubmit(text) {
|
@@ -138,7 +140,9 @@ var ControlledWithDebouncedInput = function ControlledWithDebouncedInput() {
|
|
138
140
|
});
|
139
141
|
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.SearchField, {
|
140
142
|
value: value,
|
141
|
-
onChange:
|
143
|
+
onChange: function onChange(val) {
|
144
|
+
return setValue(val);
|
145
|
+
},
|
142
146
|
"aria-label": "Search Groups",
|
143
147
|
placeholder: "Search Groups",
|
144
148
|
onSubmit: function onSubmit(text) {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -89,7 +89,7 @@ test('search isRequired', function () {
|
|
89
89
|
});
|
90
90
|
test('search autoFocus', function () {
|
91
91
|
getComponent({
|
92
|
-
|
92
|
+
hasAutoFocus: true
|
93
93
|
});
|
94
94
|
var search = _testWrapper.screen.getByLabelText(testLabel);
|
95
95
|
expect(search).toHaveFocus();
|
@@ -163,7 +163,7 @@ test('search onChange', function () {
|
|
163
163
|
});
|
164
164
|
test('search excludeFromTabOrder', function () {
|
165
165
|
getComponent({
|
166
|
-
|
166
|
+
isExcludedFromTabOrder: true
|
167
167
|
});
|
168
168
|
var search = _testWrapper.screen.getByLabelText(testLabel);
|
169
169
|
expect(search).toHaveAttribute('tabindex', '-1');
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './SearchField';
|
package/lib/cjs/types/index.d.ts
CHANGED
@@ -41,6 +41,7 @@ export * from './progressBar';
|
|
41
41
|
export * from './requirementsList';
|
42
42
|
export * from './rockerButtonGroup';
|
43
43
|
export * from './scrollBox';
|
44
|
+
export * from './searchField';
|
44
45
|
export * from './separator';
|
45
46
|
export * from './shared';
|
46
47
|
export * from './switchField';
|
package/lib/cjs/types/index.js
CHANGED
@@ -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, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53;
|
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, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54;
|
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");
|
@@ -480,8 +480,19 @@ _forEachInstanceProperty(_context43 = _Object$keys(_scrollBox)).call(_context43,
|
|
480
480
|
}
|
481
481
|
});
|
482
482
|
});
|
483
|
+
var _searchField = require("./searchField");
|
484
|
+
_forEachInstanceProperty(_context44 = _Object$keys(_searchField)).call(_context44, function (key) {
|
485
|
+
if (key === "default" || key === "__esModule") return;
|
486
|
+
if (key in exports && exports[key] === _searchField[key]) return;
|
487
|
+
_Object$defineProperty(exports, key, {
|
488
|
+
enumerable: true,
|
489
|
+
get: function get() {
|
490
|
+
return _searchField[key];
|
491
|
+
}
|
492
|
+
});
|
493
|
+
});
|
483
494
|
var _separator = require("./separator");
|
484
|
-
_forEachInstanceProperty(
|
495
|
+
_forEachInstanceProperty(_context45 = _Object$keys(_separator)).call(_context45, function (key) {
|
485
496
|
if (key === "default" || key === "__esModule") return;
|
486
497
|
if (key in exports && exports[key] === _separator[key]) return;
|
487
498
|
_Object$defineProperty(exports, key, {
|
@@ -492,7 +503,7 @@ _forEachInstanceProperty(_context44 = _Object$keys(_separator)).call(_context44,
|
|
492
503
|
});
|
493
504
|
});
|
494
505
|
var _shared = require("./shared");
|
495
|
-
_forEachInstanceProperty(
|
506
|
+
_forEachInstanceProperty(_context46 = _Object$keys(_shared)).call(_context46, function (key) {
|
496
507
|
if (key === "default" || key === "__esModule") return;
|
497
508
|
if (key in exports && exports[key] === _shared[key]) return;
|
498
509
|
_Object$defineProperty(exports, key, {
|
@@ -503,7 +514,7 @@ _forEachInstanceProperty(_context45 = _Object$keys(_shared)).call(_context45, fu
|
|
503
514
|
});
|
504
515
|
});
|
505
516
|
var _switchField = require("./switchField");
|
506
|
-
_forEachInstanceProperty(
|
517
|
+
_forEachInstanceProperty(_context47 = _Object$keys(_switchField)).call(_context47, function (key) {
|
507
518
|
if (key === "default" || key === "__esModule") return;
|
508
519
|
if (key in exports && exports[key] === _switchField[key]) return;
|
509
520
|
_Object$defineProperty(exports, key, {
|
@@ -514,7 +525,7 @@ _forEachInstanceProperty(_context46 = _Object$keys(_switchField)).call(_context4
|
|
514
525
|
});
|
515
526
|
});
|
516
527
|
var _tab = require("./tab");
|
517
|
-
_forEachInstanceProperty(
|
528
|
+
_forEachInstanceProperty(_context48 = _Object$keys(_tab)).call(_context48, function (key) {
|
518
529
|
if (key === "default" || key === "__esModule") return;
|
519
530
|
if (key in exports && exports[key] === _tab[key]) return;
|
520
531
|
_Object$defineProperty(exports, key, {
|
@@ -525,7 +536,7 @@ _forEachInstanceProperty(_context47 = _Object$keys(_tab)).call(_context47, funct
|
|
525
536
|
});
|
526
537
|
});
|
527
538
|
var _table = require("./table");
|
528
|
-
_forEachInstanceProperty(
|
539
|
+
_forEachInstanceProperty(_context49 = _Object$keys(_table)).call(_context49, function (key) {
|
529
540
|
if (key === "default" || key === "__esModule") return;
|
530
541
|
if (key in exports && exports[key] === _table[key]) return;
|
531
542
|
_Object$defineProperty(exports, key, {
|
@@ -536,7 +547,7 @@ _forEachInstanceProperty(_context48 = _Object$keys(_table)).call(_context48, fun
|
|
536
547
|
});
|
537
548
|
});
|
538
549
|
var _tabs = require("./tabs");
|
539
|
-
_forEachInstanceProperty(
|
550
|
+
_forEachInstanceProperty(_context50 = _Object$keys(_tabs)).call(_context50, function (key) {
|
540
551
|
if (key === "default" || key === "__esModule") return;
|
541
552
|
if (key in exports && exports[key] === _tabs[key]) return;
|
542
553
|
_Object$defineProperty(exports, key, {
|
@@ -547,7 +558,7 @@ _forEachInstanceProperty(_context49 = _Object$keys(_tabs)).call(_context49, func
|
|
547
558
|
});
|
548
559
|
});
|
549
560
|
var _text = require("./text");
|
550
|
-
_forEachInstanceProperty(
|
561
|
+
_forEachInstanceProperty(_context51 = _Object$keys(_text)).call(_context51, function (key) {
|
551
562
|
if (key === "default" || key === "__esModule") return;
|
552
563
|
if (key in exports && exports[key] === _text[key]) return;
|
553
564
|
_Object$defineProperty(exports, key, {
|
@@ -558,7 +569,7 @@ _forEachInstanceProperty(_context50 = _Object$keys(_text)).call(_context50, func
|
|
558
569
|
});
|
559
570
|
});
|
560
571
|
var _textField = require("./textField");
|
561
|
-
_forEachInstanceProperty(
|
572
|
+
_forEachInstanceProperty(_context52 = _Object$keys(_textField)).call(_context52, function (key) {
|
562
573
|
if (key === "default" || key === "__esModule") return;
|
563
574
|
if (key in exports && exports[key] === _textField[key]) return;
|
564
575
|
_Object$defineProperty(exports, key, {
|
@@ -569,7 +580,7 @@ _forEachInstanceProperty(_context51 = _Object$keys(_textField)).call(_context51,
|
|
569
580
|
});
|
570
581
|
});
|
571
582
|
var _timefield = require("./timefield");
|
572
|
-
_forEachInstanceProperty(
|
583
|
+
_forEachInstanceProperty(_context53 = _Object$keys(_timefield)).call(_context53, function (key) {
|
573
584
|
if (key === "default" || key === "__esModule") return;
|
574
585
|
if (key in exports && exports[key] === _timefield[key]) return;
|
575
586
|
_Object$defineProperty(exports, key, {
|
@@ -580,7 +591,7 @@ _forEachInstanceProperty(_context52 = _Object$keys(_timefield)).call(_context52,
|
|
580
591
|
});
|
581
592
|
});
|
582
593
|
var _tooltipTrigger = require("./tooltipTrigger");
|
583
|
-
_forEachInstanceProperty(
|
594
|
+
_forEachInstanceProperty(_context54 = _Object$keys(_tooltipTrigger)).call(_context54, function (key) {
|
584
595
|
if (key === "default" || key === "__esModule") return;
|
585
596
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
586
597
|
_Object$defineProperty(exports, key, {
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { ThemeUICSSObject } from 'theme-ui';
|
3
|
+
import { ControlProps } from '../hooks/useField/useField';
|
4
|
+
import { StyleProps } from './shared';
|
5
|
+
import { IconProps, IconTypeExtended, LabelProps } from '.';
|
6
|
+
export interface SearchFieldProps extends StyleProps {
|
7
|
+
/**
|
8
|
+
* @ignore
|
9
|
+
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
10
|
+
* group, or application.
|
11
|
+
*/
|
12
|
+
'aria-activedescendant'?: string;
|
13
|
+
/**
|
14
|
+
* Indicates whether inputting text could trigger display of one or more predictions of the
|
15
|
+
* user's intended value for an input and specifies how predictions would be presented if they
|
16
|
+
* are made.
|
17
|
+
*/
|
18
|
+
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both';
|
19
|
+
/**
|
20
|
+
* @ignore
|
21
|
+
* Indicates the availability and type of interactive popup element, such as menu or dialog, that
|
22
|
+
* can be triggered by an element.
|
23
|
+
*/
|
24
|
+
'aria-haspopup'?: true | false | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
25
|
+
/** How the input should handle autocompletion according to the browser. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). The `autocomplete` prop is an alias for this. */
|
26
|
+
autoComplete?: string;
|
27
|
+
/** @ignore Alias for `autoComplete` prop. Exists for backwards-compatibility. */
|
28
|
+
autocomplete?: string;
|
29
|
+
/** The default value (uncontrolled). */
|
30
|
+
defaultValue?: string;
|
31
|
+
/** Whether the element should receive focus on render. */
|
32
|
+
hasAutoFocus?: boolean;
|
33
|
+
/** Whether to display the clear button or not. */
|
34
|
+
hasNoClearButton?: boolean;
|
35
|
+
/** The icon to display alongside the placeholder text. */
|
36
|
+
icon?: IconTypeExtended;
|
37
|
+
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
38
|
+
id?: string;
|
39
|
+
/** Whether the input is disabled. */
|
40
|
+
isDisabled?: boolean;
|
41
|
+
/** The content to display as the label. */
|
42
|
+
label?: React.ReactNode;
|
43
|
+
/** The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */
|
44
|
+
name?: string;
|
45
|
+
/** Temporary text that occupies the text input when it is empty. */
|
46
|
+
placeholder?: string;
|
47
|
+
/** The current value (controlled). */
|
48
|
+
value?: string;
|
49
|
+
/**
|
50
|
+
* Handler that is called when the SearchField is submitted.
|
51
|
+
* (value: string) => void
|
52
|
+
*/
|
53
|
+
onSubmit?: (value?: unknown) => void;
|
54
|
+
/**
|
55
|
+
* Handler that is called when the clear button is pressed.
|
56
|
+
* () => void
|
57
|
+
*/
|
58
|
+
onClear?: () => void;
|
59
|
+
/**
|
60
|
+
* Handler that is called when the element receives focus.
|
61
|
+
* (e: FocusEvent) => void
|
62
|
+
*/
|
63
|
+
onFocus?: (e: FocusEvent) => void;
|
64
|
+
/**
|
65
|
+
* Handler that is called when the element loses focus.
|
66
|
+
* (e: FocusEvent) => void
|
67
|
+
*/
|
68
|
+
onBlur?: (e: FocusEvent) => void;
|
69
|
+
/**
|
70
|
+
* Handler that is called when a key is pressed.
|
71
|
+
* (e: KeyboardEvent) => void
|
72
|
+
*/
|
73
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
74
|
+
/**
|
75
|
+
* Handler that is called when a key is released.
|
76
|
+
* (e: KeyboardEvent) => void
|
77
|
+
*/
|
78
|
+
onKeyUp?: (e: KeyboardEvent) => void;
|
79
|
+
/**
|
80
|
+
* Handler that is called when the value changes.
|
81
|
+
* (value: string) => void
|
82
|
+
*/
|
83
|
+
onChange?: (value: string) => void;
|
84
|
+
/** Props object that is spread into the icon element. */
|
85
|
+
iconProps?: IconProps;
|
86
|
+
/** @ignore Whether the input can be selected but not changed by the user. */
|
87
|
+
isReadOnly?: boolean;
|
88
|
+
/**
|
89
|
+
* @ignore
|
90
|
+
* Whether user input is required on the input before form submission.
|
91
|
+
* Often paired with the necessityIndicator prop to add a visual indicator to the input.
|
92
|
+
*/
|
93
|
+
isRequired?: boolean;
|
94
|
+
/**
|
95
|
+
* @ignore
|
96
|
+
* Handler that is called when the element's focus status changes.
|
97
|
+
* (isFocused: boolean) => void
|
98
|
+
*/
|
99
|
+
onFocusChange?: (isFocused: boolean) => void;
|
100
|
+
/**
|
101
|
+
* @ignore
|
102
|
+
* Whether to exclude the element from the sequential tab order. If true, the element will not be
|
103
|
+
* focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where
|
104
|
+
* an alternative means of accessing the element or its functionality via the keyboard is
|
105
|
+
* available.
|
106
|
+
*/
|
107
|
+
isExcludedFromTabOrder?: boolean;
|
108
|
+
/** The maximum number of characters supported by the input set by the user. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength). */
|
109
|
+
maxLength?: number;
|
110
|
+
/** @ignore The minimum number of characters required by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength). */
|
111
|
+
minLength?: number;
|
112
|
+
/** @ignore Regex pattern that the value of the input must match to be valid. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern). */
|
113
|
+
pattern?: string;
|
114
|
+
/** @ignore The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype). */
|
115
|
+
type?: string;
|
116
|
+
/**
|
117
|
+
* @ignore
|
118
|
+
* Hints at the type of data that might be entered by the user while editing the element or its
|
119
|
+
* contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).
|
120
|
+
*/
|
121
|
+
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
122
|
+
/**
|
123
|
+
* @ignore
|
124
|
+
* Handler that is called when the user copies text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncopy).
|
125
|
+
*/
|
126
|
+
onCopy?: () => void;
|
127
|
+
/** @ignore Handler that is called when the user cuts text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncut). */
|
128
|
+
onCut?: () => void;
|
129
|
+
/** @ignore Handler that is called when the user pastes text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onpaste). */
|
130
|
+
onPaste?: () => void;
|
131
|
+
/**
|
132
|
+
* @ignore
|
133
|
+
* Handler that is called when a text composition system starts a new text composition session.
|
134
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event).
|
135
|
+
*/
|
136
|
+
onCompositionStart?: () => void;
|
137
|
+
/**
|
138
|
+
* @ignore
|
139
|
+
* Handler that is called when a text composition system completes or cancels the current text
|
140
|
+
* composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event).
|
141
|
+
*/
|
142
|
+
onCompositionEnd?: () => void;
|
143
|
+
/**
|
144
|
+
* @ignore
|
145
|
+
* Handler that is called when a new character is received in the current text composition
|
146
|
+
* session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event).
|
147
|
+
*/
|
148
|
+
onCompositionUpdate?: () => void;
|
149
|
+
/**
|
150
|
+
* @ignore
|
151
|
+
* Handler that is called when text in the input is selected. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/select_event).
|
152
|
+
*/
|
153
|
+
onSelect?: () => void;
|
154
|
+
/**
|
155
|
+
* @ignore
|
156
|
+
* Handler that is called when the input value is about to be modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event).
|
157
|
+
*/
|
158
|
+
onBeforeInput?: () => void;
|
159
|
+
/**
|
160
|
+
* @ignore
|
161
|
+
* Handler that is called when the input value is modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event).
|
162
|
+
*/
|
163
|
+
onInput?: () => void;
|
164
|
+
controlProps?: ControlProps;
|
165
|
+
labelProps?: LabelProps;
|
166
|
+
size?: string;
|
167
|
+
sx?: ThemeUICSSObject;
|
168
|
+
}
|
@@ -260,12 +260,15 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
260
260
|
autoFocus: true,
|
261
261
|
contain: true
|
262
262
|
}, ___EmotionJSX(SearchField, _extends({
|
263
|
+
value: searchValue,
|
263
264
|
"aria-describedby": optionsNumberMessageId,
|
264
265
|
autocomplete: "off",
|
265
266
|
placeholder: "Search",
|
266
267
|
"aria-label": "Items Search",
|
267
268
|
"data-testid": "Environment-Breadcrumb-Search",
|
268
|
-
onChange:
|
269
|
+
onChange: function onChange(val) {
|
270
|
+
return setSearchValue(val);
|
271
|
+
},
|
269
272
|
p: "10px"
|
270
273
|
}, searchProps)), ___EmotionJSX(VisuallyHidden, {
|
271
274
|
role: "alert",
|
@@ -10,17 +10,14 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
11
|
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; }
|
12
12
|
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; }
|
13
|
-
import React, { forwardRef
|
13
|
+
import React, { forwardRef } from 'react';
|
14
14
|
import { useSearchField } from 'react-aria';
|
15
15
|
import { useSearchFieldState } from 'react-stately';
|
16
16
|
import CloseIcon from '@pingux/mdi-react/CloseIcon';
|
17
17
|
import SearchIcon from '@pingux/mdi-react/SearchIcon';
|
18
|
-
import PropTypes from 'prop-types';
|
19
18
|
import { Box, Icon, IconButton, Input, Label } from '../..';
|
20
|
-
import { useField, usePropWarning } from '../../hooks';
|
19
|
+
import { useField, useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
21
20
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
22
|
-
import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
|
23
|
-
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
24
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
25
22
|
var displayName = 'SearchField';
|
26
23
|
var SearchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -33,12 +30,8 @@ var SearchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
30
|
controlProps = props.controlProps,
|
34
31
|
iconProps = props.iconProps,
|
35
32
|
labelProps = props.labelProps;
|
36
|
-
var searchRef = useRef();
|
37
33
|
usePropWarning(props, 'disabled', 'isDisabled');
|
38
|
-
|
39
|
-
useImperativeHandle(ref, function () {
|
40
|
-
return searchRef.current;
|
41
|
-
});
|
34
|
+
var searchRef = useLocalOrForwardRef(ref);
|
42
35
|
var state = useSearchFieldState(props);
|
43
36
|
var _useSearchField = useSearchField(_objectSpread({
|
44
37
|
autoComplete: autocomplete,
|
@@ -94,167 +87,6 @@ var SearchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
87
|
}
|
95
88
|
}))));
|
96
89
|
});
|
97
|
-
SearchField.propTypes = _objectSpread(_objectSpread({
|
98
|
-
/**
|
99
|
-
* @ignore
|
100
|
-
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
101
|
-
* group, or application.
|
102
|
-
*/
|
103
|
-
'aria-activedescendant': PropTypes.string,
|
104
|
-
/**
|
105
|
-
* Indicates whether inputting text could trigger display of one or more predictions of the
|
106
|
-
* user's intended value for an input and specifies how predictions would be presented if they
|
107
|
-
* are made.
|
108
|
-
*/
|
109
|
-
'aria-autocomplete': PropTypes.oneOf(['none', 'inline', 'list', 'both']),
|
110
|
-
/**
|
111
|
-
* @ignore
|
112
|
-
* Indicates the availability and type of interactive popup element, such as menu or dialog, that
|
113
|
-
* can be triggered by an element.
|
114
|
-
*/
|
115
|
-
'aria-haspopup': PropTypes.oneOf([true, false, 'menu', 'listbox', 'tree', 'grid', 'dialog']),
|
116
|
-
/** How the input should handle autocompletion according to the browser. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). The `autocomplete` prop is an alias for this. */
|
117
|
-
autoComplete: PropTypes.string,
|
118
|
-
/** @ignore Alias for `autoComplete` prop. Exists for backwards-compatibility. */
|
119
|
-
autocomplete: PropTypes.string,
|
120
|
-
/** The default value (uncontrolled). */
|
121
|
-
defaultValue: PropTypes.string,
|
122
|
-
/** Whether the element should receive focus on render. */
|
123
|
-
hasAutoFocus: PropTypes.bool,
|
124
|
-
/** Whether to display the clear button or not. */
|
125
|
-
hasNoClearButton: PropTypes.bool,
|
126
|
-
/** The icon to display alongside the placeholder text. */
|
127
|
-
icon: PropTypes.elementType,
|
128
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
129
|
-
id: PropTypes.string,
|
130
|
-
/** Whether the input is disabled. */
|
131
|
-
isDisabled: PropTypes.bool,
|
132
|
-
/** The content to display as the label. */
|
133
|
-
label: PropTypes.node,
|
134
|
-
/** The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */
|
135
|
-
name: PropTypes.string,
|
136
|
-
/** Temporary text that occupies the text input when it is empty. */
|
137
|
-
placeholder: PropTypes.string,
|
138
|
-
/** The current value (controlled). */
|
139
|
-
value: PropTypes.string,
|
140
|
-
/**
|
141
|
-
* Handler that is called when the SearchField is submitted.
|
142
|
-
* (value: string) => void
|
143
|
-
*/
|
144
|
-
onSubmit: PropTypes.func,
|
145
|
-
/**
|
146
|
-
* Handler that is called when the clear button is pressed.
|
147
|
-
* () => void
|
148
|
-
*/
|
149
|
-
onClear: PropTypes.func,
|
150
|
-
/**
|
151
|
-
* Handler that is called when the element receives focus.
|
152
|
-
* (e: FocusEvent) => void
|
153
|
-
*/
|
154
|
-
onFocus: PropTypes.func,
|
155
|
-
/**
|
156
|
-
* Handler that is called when the element loses focus.
|
157
|
-
* (e: FocusEvent) => void
|
158
|
-
*/
|
159
|
-
onBlur: PropTypes.func,
|
160
|
-
/**
|
161
|
-
* Handler that is called when a key is pressed.
|
162
|
-
* (e: KeyboardEvent) => void
|
163
|
-
*/
|
164
|
-
onKeyDown: PropTypes.func,
|
165
|
-
/**
|
166
|
-
* Handler that is called when a key is released.
|
167
|
-
* (e: KeyboardEvent) => void
|
168
|
-
*/
|
169
|
-
onKeyUp: PropTypes.func,
|
170
|
-
/**
|
171
|
-
* Handler that is called when the value changes.
|
172
|
-
* (value: string) => void
|
173
|
-
*/
|
174
|
-
onChange: PropTypes.func,
|
175
|
-
/** Props object that is spread into the icon element. */
|
176
|
-
iconProps: PropTypes.shape({}),
|
177
|
-
// NOTE: unsurfaced useSearchField / useSearchFieldState props listed below
|
178
|
-
|
179
|
-
/** @ignore Whether the input can be selected but not changed by the user. */
|
180
|
-
isReadOnly: PropTypes.bool,
|
181
|
-
/**
|
182
|
-
* @ignore
|
183
|
-
* Whether user input is required on the input before form submission.
|
184
|
-
* Often paired with the necessityIndicator prop to add a visual indicator to the input.
|
185
|
-
*/
|
186
|
-
isRequired: PropTypes.bool,
|
187
|
-
/**
|
188
|
-
* @ignore
|
189
|
-
* Handler that is called when the element's focus status changes.
|
190
|
-
* (isFocused: boolean) => void
|
191
|
-
*/
|
192
|
-
onFocusChange: PropTypes.func,
|
193
|
-
/**
|
194
|
-
* @ignore
|
195
|
-
* Whether to exclude the element from the sequential tab order. If true, the element will not be
|
196
|
-
* focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where
|
197
|
-
* an alternative means of accessing the element or its functionality via the keyboard is
|
198
|
-
* available.
|
199
|
-
*/
|
200
|
-
isExcludedFromTabOrder: PropTypes.bool,
|
201
|
-
/** The maximum number of characters supported by the input set by the user. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength). */
|
202
|
-
maxLength: PropTypes.number,
|
203
|
-
/** @ignore The minimum number of characters required by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength). */
|
204
|
-
minLength: PropTypes.number,
|
205
|
-
/** @ignore Regex pattern that the value of the input must match to be valid. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern). */
|
206
|
-
pattern: PropTypes.string,
|
207
|
-
/** @ignore The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype). */
|
208
|
-
type: PropTypes.string,
|
209
|
-
/**
|
210
|
-
* @ignore
|
211
|
-
* Hints at the type of data that might be entered by the user while editing the element or its
|
212
|
-
* contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).
|
213
|
-
*/
|
214
|
-
inputMode: PropTypes.oneOf(['none', 'text', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
|
215
|
-
/**
|
216
|
-
* @ignore
|
217
|
-
* Handler that is called when the user copies text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncopy).
|
218
|
-
*/
|
219
|
-
onCopy: PropTypes.func,
|
220
|
-
/** @ignore Handler that is called when the user cuts text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncut). */
|
221
|
-
onCut: PropTypes.func,
|
222
|
-
/** @ignore Handler that is called when the user pastes text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onpaste). */
|
223
|
-
onPaste: PropTypes.func,
|
224
|
-
/**
|
225
|
-
* @ignore
|
226
|
-
* Handler that is called when a text composition system starts a new text composition session.
|
227
|
-
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event).
|
228
|
-
*/
|
229
|
-
onCompositionStart: PropTypes.func,
|
230
|
-
/**
|
231
|
-
* @ignore
|
232
|
-
* Handler that is called when a text composition system completes or cancels the current text
|
233
|
-
* composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event).
|
234
|
-
*/
|
235
|
-
onCompositionEnd: PropTypes.func,
|
236
|
-
/**
|
237
|
-
* @ignore
|
238
|
-
* Handler that is called when a new character is received in the current text composition
|
239
|
-
* session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event).
|
240
|
-
*/
|
241
|
-
onCompositionUpdate: PropTypes.func,
|
242
|
-
/**
|
243
|
-
* @ignore
|
244
|
-
* Handler that is called when text in the input is selected. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/select_event).
|
245
|
-
*/
|
246
|
-
onSelect: PropTypes.func,
|
247
|
-
/**
|
248
|
-
* @ignore
|
249
|
-
* Handler that is called when the input value is about to be modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event).
|
250
|
-
*/
|
251
|
-
onBeforeInput: PropTypes.func,
|
252
|
-
/**
|
253
|
-
* @ignore
|
254
|
-
* Handler that is called when the input value is modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event).
|
255
|
-
*/
|
256
|
-
onInput: PropTypes.func
|
257
|
-
}, ariaAttributesBasePropTypes), inputFieldAttributesBasePropTypes);
|
258
90
|
SearchField.defaultProps = {
|
259
91
|
hasNoClearButton: false,
|
260
92
|
icon: SearchIcon
|
@@ -84,7 +84,9 @@ export var Controlled = function Controlled() {
|
|
84
84
|
setValue = _useState2[1];
|
85
85
|
return ___EmotionJSX(SearchField, {
|
86
86
|
value: value,
|
87
|
-
onChange:
|
87
|
+
onChange: function onChange(val) {
|
88
|
+
return setValue(val);
|
89
|
+
},
|
88
90
|
"aria-label": "Search Groups",
|
89
91
|
placeholder: "Search Groups",
|
90
92
|
onSubmit: function onSubmit(text) {
|
@@ -126,7 +128,9 @@ export var ControlledWithDebouncedInput = function ControlledWithDebouncedInput(
|
|
126
128
|
});
|
127
129
|
return ___EmotionJSX(Box, null, ___EmotionJSX(SearchField, {
|
128
130
|
value: value,
|
129
|
-
onChange:
|
131
|
+
onChange: function onChange(val) {
|
132
|
+
return setValue(val);
|
133
|
+
},
|
130
134
|
"aria-label": "Search Groups",
|
131
135
|
placeholder: "Search Groups",
|
132
136
|
onSubmit: function onSubmit(text) {
|
@@ -86,7 +86,7 @@ test('search isRequired', function () {
|
|
86
86
|
});
|
87
87
|
test('search autoFocus', function () {
|
88
88
|
getComponent({
|
89
|
-
|
89
|
+
hasAutoFocus: true
|
90
90
|
});
|
91
91
|
var search = screen.getByLabelText(testLabel);
|
92
92
|
expect(search).toHaveFocus();
|
@@ -160,7 +160,7 @@ test('search onChange', function () {
|
|
160
160
|
});
|
161
161
|
test('search excludeFromTabOrder', function () {
|
162
162
|
getComponent({
|
163
|
-
|
163
|
+
isExcludedFromTabOrder: true
|
164
164
|
});
|
165
165
|
var search = screen.getByLabelText(testLabel);
|
166
166
|
expect(search).toHaveAttribute('tabindex', '-1');
|
package/lib/types/index.js
CHANGED
@@ -41,6 +41,7 @@ export * from './progressBar';
|
|
41
41
|
export * from './requirementsList';
|
42
42
|
export * from './rockerButtonGroup';
|
43
43
|
export * from './scrollBox';
|
44
|
+
export * from './searchField';
|
44
45
|
export * from './separator';
|
45
46
|
export * from './shared';
|
46
47
|
export * from './switchField';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|