@pingux/astro 2.145.0 → 2.145.1-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/Modal/Modal.stories.js +4 -4
- package/lib/cjs/components/SearchField/SearchField.stories.js +4 -4
- package/lib/cjs/types/searchField.d.ts +15 -7
- package/lib/components/Modal/Modal.stories.js +4 -4
- package/lib/components/SearchField/SearchField.stories.js +4 -4
- package/package.json +1 -1
|
@@ -178,13 +178,13 @@ var WithInputField = function WithInputField() {
|
|
|
178
178
|
value = _useState2[0],
|
|
179
179
|
setValue = _useState2[1];
|
|
180
180
|
var items = [{
|
|
181
|
-
|
|
181
|
+
key: 'apple',
|
|
182
182
|
name: 'Apple'
|
|
183
183
|
}, {
|
|
184
|
-
|
|
184
|
+
key: 'banana',
|
|
185
185
|
name: 'Banana'
|
|
186
186
|
}, {
|
|
187
|
-
|
|
187
|
+
key: 'blueberry',
|
|
188
188
|
name: 'Blueberry'
|
|
189
189
|
}];
|
|
190
190
|
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
|
|
@@ -230,7 +230,7 @@ var WithInputField = function WithInputField() {
|
|
|
230
230
|
}
|
|
231
231
|
}, function (item) {
|
|
232
232
|
return (0, _react2.jsx)(_index.Item, {
|
|
233
|
-
key: item.
|
|
233
|
+
key: item.key,
|
|
234
234
|
textValue: item.name
|
|
235
235
|
}, item.name);
|
|
236
236
|
}), (0, _react2.jsx)(_index.Box, {
|
|
@@ -187,13 +187,13 @@ var ControlledWithPopover = function ControlledWithPopover() {
|
|
|
187
187
|
value = _useState6[0],
|
|
188
188
|
setValue = _useState6[1];
|
|
189
189
|
var items = [{
|
|
190
|
-
|
|
190
|
+
key: 'apple',
|
|
191
191
|
name: 'Apple'
|
|
192
192
|
}, {
|
|
193
|
-
|
|
193
|
+
key: 'banana',
|
|
194
194
|
name: 'Banana'
|
|
195
195
|
}, {
|
|
196
|
-
|
|
196
|
+
key: 'blueberry',
|
|
197
197
|
name: 'Blueberry'
|
|
198
198
|
}];
|
|
199
199
|
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.SearchField, {
|
|
@@ -213,7 +213,7 @@ var ControlledWithPopover = function ControlledWithPopover() {
|
|
|
213
213
|
}
|
|
214
214
|
}, function (item) {
|
|
215
215
|
return (0, _react2.jsx)(_index.Item, {
|
|
216
|
-
key: item.
|
|
216
|
+
key: item.key,
|
|
217
217
|
textValue: item.name
|
|
218
218
|
}, item.name);
|
|
219
219
|
}), (0, _react2.jsx)(_index.Text, {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { Key, ReactNode } from 'react';
|
|
2
2
|
import type { CollectionChildren } from '@react-types/shared';
|
|
3
3
|
import { ThemeUICSSObject } from 'theme-ui';
|
|
4
4
|
import { ControlProps } from '../hooks/useField/useField';
|
|
5
5
|
import { StyleProps } from './shared';
|
|
6
6
|
import { HelpHintProps, IconProps, IconTypeExtended, LabelProps } from '.';
|
|
7
|
-
|
|
7
|
+
type Mode = 'default' | 'autocomplete';
|
|
8
|
+
interface SearchFieldCommonProps extends StyleProps {
|
|
8
9
|
/**
|
|
9
10
|
* @ignore
|
|
10
11
|
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
|
@@ -55,7 +56,7 @@ export interface SearchFieldProps<T extends object> extends StyleProps {
|
|
|
55
56
|
* Handler that is called when the SearchField is submitted.
|
|
56
57
|
* (value: string) => void
|
|
57
58
|
*/
|
|
58
|
-
onSubmit?: (value?:
|
|
59
|
+
onSubmit?: (value?: string) => void;
|
|
59
60
|
/**
|
|
60
61
|
* Handler that is called when the clear button is pressed.
|
|
61
62
|
* () => void
|
|
@@ -170,13 +171,20 @@ export interface SearchFieldProps<T extends object> extends StyleProps {
|
|
|
170
171
|
labelProps?: LabelProps;
|
|
171
172
|
size?: string;
|
|
172
173
|
sx?: ThemeUICSSObject;
|
|
173
|
-
mode?:
|
|
174
|
+
mode?: Mode;
|
|
175
|
+
}
|
|
176
|
+
interface SearchAutoCompleteProps<T> extends SearchFieldCommonProps {
|
|
177
|
+
mode: Exclude<Mode, 'default'>;
|
|
174
178
|
defaultItems?: Iterable<T>;
|
|
175
179
|
children?: CollectionChildren<T>;
|
|
180
|
+
onSelectionChange?: (key: Key) => void;
|
|
176
181
|
}
|
|
182
|
+
export type SearchFieldProps<T> = SearchFieldCommonProps | SearchAutoCompleteProps<T>;
|
|
177
183
|
export interface SearchItem extends StyleProps {
|
|
178
|
-
|
|
179
|
-
text?: string;
|
|
184
|
+
key?: Key;
|
|
180
185
|
name?: string;
|
|
181
|
-
|
|
186
|
+
href?: string;
|
|
187
|
+
title?: ReactNode | string;
|
|
188
|
+
'aria-label'?: string;
|
|
182
189
|
}
|
|
190
|
+
export {};
|
|
@@ -162,13 +162,13 @@ export var WithInputField = function WithInputField() {
|
|
|
162
162
|
value = _useState2[0],
|
|
163
163
|
setValue = _useState2[1];
|
|
164
164
|
var items = [{
|
|
165
|
-
|
|
165
|
+
key: 'apple',
|
|
166
166
|
name: 'Apple'
|
|
167
167
|
}, {
|
|
168
|
-
|
|
168
|
+
key: 'banana',
|
|
169
169
|
name: 'Banana'
|
|
170
170
|
}, {
|
|
171
|
-
|
|
171
|
+
key: 'blueberry',
|
|
172
172
|
name: 'Blueberry'
|
|
173
173
|
}];
|
|
174
174
|
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
|
|
@@ -214,7 +214,7 @@ export var WithInputField = function WithInputField() {
|
|
|
214
214
|
}
|
|
215
215
|
}, function (item) {
|
|
216
216
|
return ___EmotionJSX(Item, {
|
|
217
|
-
key: item.
|
|
217
|
+
key: item.key,
|
|
218
218
|
textValue: item.name
|
|
219
219
|
}, item.name);
|
|
220
220
|
}), ___EmotionJSX(Box, {
|
|
@@ -172,13 +172,13 @@ export var ControlledWithPopover = function ControlledWithPopover() {
|
|
|
172
172
|
value = _useState6[0],
|
|
173
173
|
setValue = _useState6[1];
|
|
174
174
|
var items = [{
|
|
175
|
-
|
|
175
|
+
key: 'apple',
|
|
176
176
|
name: 'Apple'
|
|
177
177
|
}, {
|
|
178
|
-
|
|
178
|
+
key: 'banana',
|
|
179
179
|
name: 'Banana'
|
|
180
180
|
}, {
|
|
181
|
-
|
|
181
|
+
key: 'blueberry',
|
|
182
182
|
name: 'Blueberry'
|
|
183
183
|
}];
|
|
184
184
|
return ___EmotionJSX(Box, null, ___EmotionJSX(SearchField, {
|
|
@@ -198,7 +198,7 @@ export var ControlledWithPopover = function ControlledWithPopover() {
|
|
|
198
198
|
}
|
|
199
199
|
}, function (item) {
|
|
200
200
|
return ___EmotionJSX(Item, {
|
|
201
|
-
key: item.
|
|
201
|
+
key: item.key,
|
|
202
202
|
textValue: item.name
|
|
203
203
|
}, item.name);
|
|
204
204
|
}), ___EmotionJSX(Text, {
|