@react-aria/searchfield 3.0.0-nightly-641446f65-240905
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/README.md +3 -0
- package/dist/ar-AE.main.js +6 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +8 -0
- package/dist/ar-AE.module.js +8 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +6 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +8 -0
- package/dist/bg-BG.module.js +8 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +6 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +8 -0
- package/dist/cs-CZ.module.js +8 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +6 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +8 -0
- package/dist/da-DK.module.js +8 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +6 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +8 -0
- package/dist/de-DE.module.js +8 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +6 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +8 -0
- package/dist/el-GR.module.js +8 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +6 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +8 -0
- package/dist/en-US.module.js +8 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +6 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +8 -0
- package/dist/es-ES.module.js +8 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +6 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +8 -0
- package/dist/et-EE.module.js +8 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +6 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +8 -0
- package/dist/fi-FI.module.js +8 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +6 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +8 -0
- package/dist/fr-FR.module.js +8 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +6 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +8 -0
- package/dist/he-IL.module.js +8 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +6 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +8 -0
- package/dist/hr-HR.module.js +8 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +6 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +8 -0
- package/dist/hu-HU.module.js +8 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +17 -0
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +6 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +8 -0
- package/dist/it-IT.module.js +8 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +6 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +8 -0
- package/dist/ja-JP.module.js +8 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +6 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +8 -0
- package/dist/ko-KR.module.js +8 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +6 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +8 -0
- package/dist/lt-LT.module.js +8 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +6 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +8 -0
- package/dist/lv-LV.module.js +8 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +22 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +17 -0
- package/dist/module.js.map +1 -0
- package/dist/nb-NO.main.js +6 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +8 -0
- package/dist/nb-NO.module.js +8 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +6 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +8 -0
- package/dist/nl-NL.module.js +8 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +6 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +8 -0
- package/dist/pl-PL.module.js +8 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +6 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +8 -0
- package/dist/pt-BR.module.js +8 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +6 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +8 -0
- package/dist/pt-PT.module.js +8 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +6 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +8 -0
- package/dist/ro-RO.module.js +8 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +6 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +8 -0
- package/dist/ru-RU.module.js +8 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +6 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +8 -0
- package/dist/sk-SK.module.js +8 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +6 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +8 -0
- package/dist/sl-SI.module.js +8 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +6 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +8 -0
- package/dist/sr-SP.module.js +8 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +6 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +8 -0
- package/dist/sv-SE.module.js +8 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +6 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +8 -0
- package/dist/tr-TR.module.js +8 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/uk-UA.main.js +6 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +8 -0
- package/dist/uk-UA.module.js +8 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/useSearchField.main.js +90 -0
- package/dist/useSearchField.main.js.map +1 -0
- package/dist/useSearchField.mjs +85 -0
- package/dist/useSearchField.module.js +85 -0
- package/dist/useSearchField.module.js.map +1 -0
- package/dist/zh-CN.main.js +6 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +8 -0
- package/dist/zh-CN.module.js +8 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +6 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +8 -0
- package/dist/zh-TW.module.js +8 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +41 -0
- package/src/index.ts +14 -0
- package/src/useSearchField.ts +128 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,eAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/pt-PT.json"],"sourcesContent":["{\n \"Clear search\": \"Limpar pesquisa\"\n}\n"],"names":[],"version":3,"file":"pt-PT.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,mCAAiB,CAAC;AACvD","sources":["packages/@react-aria/searchfield/intl/ro-RO.json"],"sourcesContent":["{\n \"Clear search\": \"Ştergeţi căutarea\"\n}\n"],"names":[],"version":3,"file":"ro-RO.main.js.map"}
|
package/dist/ro-RO.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,mCAAiB,CAAC;AACvD","sources":["packages/@react-aria/searchfield/intl/ro-RO.json"],"sourcesContent":["{\n \"Clear search\": \"Ştergeţi căutarea\"\n}\n"],"names":[],"version":3,"file":"ro-RO.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,4FAAc,CAAC;AACpD","sources":["packages/@react-aria/searchfield/intl/ru-RU.json"],"sourcesContent":["{\n \"Clear search\": \"Очистить поиск\"\n}\n"],"names":[],"version":3,"file":"ru-RU.main.js.map"}
|
package/dist/ru-RU.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var $701c918a4653e946$exports = {};
|
|
2
|
+
$701c918a4653e946$exports = {
|
|
3
|
+
"Clear search": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{44C} \u{43F}\u{43E}\u{438}\u{441}\u{43A}`
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {$701c918a4653e946$exports as default};
|
|
8
|
+
//# sourceMappingURL=ru-RU.module.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var $701c918a4653e946$exports = {};
|
|
2
|
+
$701c918a4653e946$exports = {
|
|
3
|
+
"Clear search": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{44C} \u{43F}\u{43E}\u{438}\u{441}\u{43A}`
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {$701c918a4653e946$exports as default};
|
|
8
|
+
//# sourceMappingURL=ru-RU.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,4FAAc,CAAC;AACpD","sources":["packages/@react-aria/searchfield/intl/ru-RU.json"],"sourcesContent":["{\n \"Clear search\": \"Очистить поиск\"\n}\n"],"names":[],"version":3,"file":"ru-RU.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,mCAAoB,CAAC;AAC1D","sources":["packages/@react-aria/searchfield/intl/sk-SK.json"],"sourcesContent":["{\n \"Clear search\": \"Vymazať vyhľadávanie\"\n}\n"],"names":[],"version":3,"file":"sk-SK.main.js.map"}
|
package/dist/sk-SK.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,mCAAoB,CAAC;AAC1D","sources":["packages/@react-aria/searchfield/intl/sk-SK.json"],"sourcesContent":["{\n \"Clear search\": \"Vymazať vyhľadávanie\"\n}\n"],"names":[],"version":3,"file":"sk-SK.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/sl-SI.json"],"sourcesContent":["{\n \"Clear search\": \"Počisti iskanje\"\n}\n"],"names":[],"version":3,"file":"sl-SI.main.js.map"}
|
package/dist/sl-SI.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/sl-SI.json"],"sourcesContent":["{\n \"Clear search\": \"Počisti iskanje\"\n}\n"],"names":[],"version":3,"file":"sl-SI.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/sr-SP.json"],"sourcesContent":["{\n \"Clear search\": \"Obriši pretragu\"\n}\n"],"names":[],"version":3,"file":"sr-SP.main.js.map"}
|
package/dist/sr-SP.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/sr-SP.json"],"sourcesContent":["{\n \"Clear search\": \"Obriši pretragu\"\n}\n"],"names":[],"version":3,"file":"sr-SP.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,gBAAa,CAAC;AACnD","sources":["packages/@react-aria/searchfield/intl/sv-SE.json"],"sourcesContent":["{\n \"Clear search\": \"Rensa sökning\"\n}\n"],"names":[],"version":3,"file":"sv-SE.main.js.map"}
|
package/dist/sv-SE.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,gBAAa,CAAC;AACnD","sources":["packages/@react-aria/searchfield/intl/sv-SE.json"],"sourcesContent":["{\n \"Clear search\": \"Rensa sökning\"\n}\n"],"names":[],"version":3,"file":"sv-SE.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/tr-TR.json"],"sourcesContent":["{\n \"Clear search\": \"Aramayı temizle\"\n}\n"],"names":[],"version":3,"file":"tr-TR.main.js.map"}
|
package/dist/tr-TR.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,qBAAe,CAAC;AACrD","sources":["packages/@react-aria/searchfield/intl/tr-TR.json"],"sourcesContent":["{\n \"Clear search\": \"Aramayı temizle\"\n}\n"],"names":[],"version":3,"file":"tr-TR.module.js.map"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AriaButtonProps } from "@react-types/button";
|
|
2
|
+
import { AriaSearchFieldProps } from "@react-types/searchfield";
|
|
3
|
+
import { DOMAttributes, RefObject, ValidationResult } from "@react-types/shared";
|
|
4
|
+
import { InputHTMLAttributes, LabelHTMLAttributes } from "react";
|
|
5
|
+
import { SearchFieldState } from "@react-stately/searchfield";
|
|
6
|
+
export interface SearchFieldAria extends ValidationResult {
|
|
7
|
+
/** Props for the text field's visible label element (if any). */
|
|
8
|
+
labelProps: LabelHTMLAttributes<HTMLLabelElement>;
|
|
9
|
+
/** Props for the input element. */
|
|
10
|
+
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
11
|
+
/** Props for the clear button. */
|
|
12
|
+
clearButtonProps: AriaButtonProps;
|
|
13
|
+
/** Props for the searchfield's description element, if any. */
|
|
14
|
+
descriptionProps: DOMAttributes;
|
|
15
|
+
/** Props for the searchfield's error message element, if any. */
|
|
16
|
+
errorMessageProps: DOMAttributes;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Provides the behavior and accessibility implementation for a search field.
|
|
20
|
+
* @param props - Props for the search field.
|
|
21
|
+
* @param state - State for the search field, as returned by `useSearchFieldState`.
|
|
22
|
+
* @param inputRef - A ref to the input element.
|
|
23
|
+
*/
|
|
24
|
+
export function useSearchField(props: AriaSearchFieldProps, state: SearchFieldState, inputRef: RefObject<HTMLInputElement | null>): SearchFieldAria;
|
|
25
|
+
export type { AriaSearchFieldProps } from '@react-types/searchfield';
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAuBA,gCAAiC,SAAQ,gBAAgB;IACvD,iEAAiE;IACjE,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,kCAAkC;IAClC,gBAAgB,EAAE,eAAe,CAAC;IAClC,+DAA+D;IAC/D,gBAAgB,EAAE,aAAa,CAAC;IAChC,iEAAiE;IACjE,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED;;;;;GAKG;AACH,+BACE,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAC3C,eAAe,CAiFjB;ACnHD,YAAY,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC","sources":["packages/@react-aria/searchfield/src/packages/@react-aria/searchfield/src/useSearchField.ts","packages/@react-aria/searchfield/src/packages/@react-aria/searchfield/src/index.ts","packages/@react-aria/searchfield/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSearchField} from './useSearchField';\nexport type {AriaSearchFieldProps} from '@react-types/searchfield';\nexport type {SearchFieldAria} from './useSearchField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,4FAAc,CAAC;AACpD","sources":["packages/@react-aria/searchfield/intl/uk-UA.json"],"sourcesContent":["{\n \"Clear search\": \"Очистити пошук\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
|
package/dist/uk-UA.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var $2d999353ca652e34$exports = {};
|
|
2
|
+
$2d999353ca652e34$exports = {
|
|
3
|
+
"Clear search": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{438} \u{43F}\u{43E}\u{448}\u{443}\u{43A}`
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {$2d999353ca652e34$exports as default};
|
|
8
|
+
//# sourceMappingURL=uk-UA.module.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var $2d999353ca652e34$exports = {};
|
|
2
|
+
$2d999353ca652e34$exports = {
|
|
3
|
+
"Clear search": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{438} \u{43F}\u{43E}\u{448}\u{443}\u{43A}`
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {$2d999353ca652e34$exports as default};
|
|
8
|
+
//# sourceMappingURL=uk-UA.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,gBAAgB,CAAC,4FAAc,CAAC;AACpD","sources":["packages/@react-aria/searchfield/intl/uk-UA.json"],"sourcesContent":["{\n \"Clear search\": \"Очистити пошук\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var $8e80a08ea739bb00$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $2KtRb$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $2KtRb$reactariai18n = require("@react-aria/i18n");
|
|
4
|
+
var $2KtRb$reactariatextfield = require("@react-aria/textfield");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "useSearchField", () => $ccae92a71d96d51a$export$9bb30bbe003b82e0);
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $ccae92a71d96d51a$export$9bb30bbe003b82e0(props, state, inputRef) {
|
|
31
|
+
let stringFormatter = (0, $2KtRb$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($8e80a08ea739bb00$exports))), '@react-aria/searchfield');
|
|
32
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit, onClear: onClear, type: type = 'search' } = props;
|
|
33
|
+
let onKeyDown = (e)=>{
|
|
34
|
+
const key = e.key;
|
|
35
|
+
if (key === 'Enter' && (isDisabled || isReadOnly)) e.preventDefault();
|
|
36
|
+
if (isDisabled || isReadOnly) return;
|
|
37
|
+
// for backward compatibility;
|
|
38
|
+
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior
|
|
39
|
+
if (key === 'Enter' && onSubmit) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
onSubmit(state.value);
|
|
42
|
+
}
|
|
43
|
+
if (key === 'Escape') {
|
|
44
|
+
if (state.value === '') e.continuePropagation();
|
|
45
|
+
else {
|
|
46
|
+
state.setValue('');
|
|
47
|
+
if (onClear) onClear();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
let onClearButtonClick = ()=>{
|
|
52
|
+
state.setValue('');
|
|
53
|
+
if (onClear) onClear();
|
|
54
|
+
};
|
|
55
|
+
let onPressStart = ()=>{
|
|
56
|
+
var // this is in PressStart for mobile so that touching the clear button doesn't remove focus from
|
|
57
|
+
// the input and close the keyboard
|
|
58
|
+
_inputRef_current;
|
|
59
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
60
|
+
};
|
|
61
|
+
let { labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, ...validation } = (0, $2KtRb$reactariatextfield.useTextField)({
|
|
62
|
+
...props,
|
|
63
|
+
value: state.value,
|
|
64
|
+
onChange: state.setValue,
|
|
65
|
+
onKeyDown: !isReadOnly ? (0, $2KtRb$reactariautils.chain)(onKeyDown, props.onKeyDown) : props.onKeyDown,
|
|
66
|
+
type: type
|
|
67
|
+
}, inputRef);
|
|
68
|
+
return {
|
|
69
|
+
labelProps: labelProps,
|
|
70
|
+
inputProps: {
|
|
71
|
+
...inputProps,
|
|
72
|
+
// already handled by useSearchFieldState
|
|
73
|
+
defaultValue: undefined
|
|
74
|
+
},
|
|
75
|
+
clearButtonProps: {
|
|
76
|
+
'aria-label': stringFormatter.format('Clear search'),
|
|
77
|
+
excludeFromTabOrder: true,
|
|
78
|
+
preventFocusOnPress: true,
|
|
79
|
+
isDisabled: isDisabled || isReadOnly,
|
|
80
|
+
onPress: onClearButtonClick,
|
|
81
|
+
onPressStart: onPressStart
|
|
82
|
+
},
|
|
83
|
+
descriptionProps: descriptionProps,
|
|
84
|
+
errorMessageProps: errorMessageProps,
|
|
85
|
+
...validation
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=useSearchField.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAgCM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,cACF,UAAU,cACV,UAAU,YACV,QAAQ,WACR,OAAO,QACP,OAAO,UACR,GAAG;IAEJ,IAAI,YAAY,CAAC;QACf,MAAM,MAAM,EAAE,GAAG;QAEjB,IAAI,QAAQ,WAAY,CAAA,cAAc,UAAS,GAC7C,EAAE,cAAc;QAGlB,IAAI,cAAc,YAChB;QAGF,8BAA8B;QAC9B,2FAA2F;QAC3F,IAAI,QAAQ,WAAW,UAAU;YAC/B,EAAE,cAAc;YAChB,SAAS,MAAM,KAAK;QACtB;QAEA,IAAI,QAAQ;YACV,IAAI,MAAM,KAAK,KAAK,IAClB,EAAE,mBAAmB;iBAChB;gBACL,MAAM,QAAQ,CAAC;gBACf,IAAI,SACF;YAEJ;;IAEJ;IAEA,IAAI,qBAAqB;QACvB,MAAM,QAAQ,CAAC;QAEf,IAAI,SACF;IAEJ;IAEA,IAAI,eAAe;YACjB,+FAA+F;QAC/F,mCAAmC;QACnC;SAAA,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK;IACzB;IAEA,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,sCAAW,EAAE;QAC9F,GAAG,KAAK;QACR,OAAO,MAAM,KAAK;QAClB,UAAU,MAAM,QAAQ;QACxB,WAAW,CAAC,aAAa,CAAA,GAAA,2BAAI,EAAE,WAAW,MAAM,SAAS,IAAI,MAAM,SAAS;cAC5E;IACF,GAAG;IAEH,OAAO;oBACL;QACA,YAAY;YACV,GAAG,UAAU;YACb,yCAAyC;YACzC,cAAc;QAChB;QACA,kBAAkB;YAChB,cAAc,gBAAgB,MAAM,CAAC;YACrC,qBAAqB;YACrB,qBAAqB;YACrB,YAAY,cAAc;YAC1B,SAAS;0BACT;QACF;0BACA;2BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/searchfield/src/useSearchField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaSearchFieldProps} from '@react-types/searchfield';\nimport {chain} from '@react-aria/utils';\nimport {DOMAttributes, RefObject, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, LabelHTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SearchFieldState} from '@react-stately/searchfield';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useTextField} from '@react-aria/textfield';\n\nexport interface SearchFieldAria extends ValidationResult {\n /** Props for the text field's visible label element (if any). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the searchfield's description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the searchfield's error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search field.\n * @param props - Props for the search field.\n * @param state - State for the search field, as returned by `useSearchFieldState`.\n * @param inputRef - A ref to the input element.\n */\nexport function useSearchField(\n props: AriaSearchFieldProps,\n state: SearchFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): SearchFieldAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/searchfield');\n let {\n isDisabled,\n isReadOnly,\n onSubmit,\n onClear,\n type = 'search'\n } = props;\n\n let onKeyDown = (e) => {\n const key = e.key;\n\n if (key === 'Enter' && (isDisabled || isReadOnly)) {\n e.preventDefault();\n }\n\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // for backward compatibility;\n // otherwise, \"Enter\" on an input would trigger a form submit, the default browser behavior\n if (key === 'Enter' && onSubmit) {\n e.preventDefault();\n onSubmit(state.value);\n }\n\n if (key === 'Escape') {\n if (state.value === '') {\n e.continuePropagation();\n } else {\n state.setValue('');\n if (onClear) {\n onClear();\n }\n }\n }\n };\n\n let onClearButtonClick = () => {\n state.setValue('');\n\n if (onClear) {\n onClear();\n }\n };\n\n let onPressStart = () => {\n // this is in PressStart for mobile so that touching the clear button doesn't remove focus from\n // the input and close the keyboard\n inputRef.current?.focus();\n };\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps, ...validation} = useTextField({\n ...props,\n value: state.value,\n onChange: state.setValue,\n onKeyDown: !isReadOnly ? chain(onKeyDown, props.onKeyDown) : props.onKeyDown,\n type\n }, inputRef);\n\n return {\n labelProps,\n inputProps: {\n ...inputProps,\n // already handled by useSearchFieldState\n defaultValue: undefined\n },\n clearButtonProps: {\n 'aria-label': stringFormatter.format('Clear search'),\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: isDisabled || isReadOnly,\n onPress: onClearButtonClick,\n onPressStart\n },\n descriptionProps,\n errorMessageProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchField.main.js.map"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import $kTEqN$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {chain as $kTEqN$chain} from "@react-aria/utils";
|
|
3
|
+
import {useLocalizedStringFormatter as $kTEqN$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useTextField as $kTEqN$useTextField} from "@react-aria/textfield";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $4d52238874b24f86$export$9bb30bbe003b82e0(props, state, inputRef) {
|
|
25
|
+
let stringFormatter = (0, $kTEqN$useLocalizedStringFormatter)((0, ($parcel$interopDefault($kTEqN$intlStringsmodulejs))), '@react-aria/searchfield');
|
|
26
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit, onClear: onClear, type: type = 'search' } = props;
|
|
27
|
+
let onKeyDown = (e)=>{
|
|
28
|
+
const key = e.key;
|
|
29
|
+
if (key === 'Enter' && (isDisabled || isReadOnly)) e.preventDefault();
|
|
30
|
+
if (isDisabled || isReadOnly) return;
|
|
31
|
+
// for backward compatibility;
|
|
32
|
+
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior
|
|
33
|
+
if (key === 'Enter' && onSubmit) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
onSubmit(state.value);
|
|
36
|
+
}
|
|
37
|
+
if (key === 'Escape') {
|
|
38
|
+
if (state.value === '') e.continuePropagation();
|
|
39
|
+
else {
|
|
40
|
+
state.setValue('');
|
|
41
|
+
if (onClear) onClear();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let onClearButtonClick = ()=>{
|
|
46
|
+
state.setValue('');
|
|
47
|
+
if (onClear) onClear();
|
|
48
|
+
};
|
|
49
|
+
let onPressStart = ()=>{
|
|
50
|
+
var // this is in PressStart for mobile so that touching the clear button doesn't remove focus from
|
|
51
|
+
// the input and close the keyboard
|
|
52
|
+
_inputRef_current;
|
|
53
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
54
|
+
};
|
|
55
|
+
let { labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, ...validation } = (0, $kTEqN$useTextField)({
|
|
56
|
+
...props,
|
|
57
|
+
value: state.value,
|
|
58
|
+
onChange: state.setValue,
|
|
59
|
+
onKeyDown: !isReadOnly ? (0, $kTEqN$chain)(onKeyDown, props.onKeyDown) : props.onKeyDown,
|
|
60
|
+
type: type
|
|
61
|
+
}, inputRef);
|
|
62
|
+
return {
|
|
63
|
+
labelProps: labelProps,
|
|
64
|
+
inputProps: {
|
|
65
|
+
...inputProps,
|
|
66
|
+
// already handled by useSearchFieldState
|
|
67
|
+
defaultValue: undefined
|
|
68
|
+
},
|
|
69
|
+
clearButtonProps: {
|
|
70
|
+
'aria-label': stringFormatter.format('Clear search'),
|
|
71
|
+
excludeFromTabOrder: true,
|
|
72
|
+
preventFocusOnPress: true,
|
|
73
|
+
isDisabled: isDisabled || isReadOnly,
|
|
74
|
+
onPress: onClearButtonClick,
|
|
75
|
+
onPressStart: onPressStart
|
|
76
|
+
},
|
|
77
|
+
descriptionProps: descriptionProps,
|
|
78
|
+
errorMessageProps: errorMessageProps,
|
|
79
|
+
...validation
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export {$4d52238874b24f86$export$9bb30bbe003b82e0 as useSearchField};
|
|
85
|
+
//# sourceMappingURL=useSearchField.module.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import $kTEqN$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {chain as $kTEqN$chain} from "@react-aria/utils";
|
|
3
|
+
import {useLocalizedStringFormatter as $kTEqN$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useTextField as $kTEqN$useTextField} from "@react-aria/textfield";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $4d52238874b24f86$export$9bb30bbe003b82e0(props, state, inputRef) {
|
|
25
|
+
let stringFormatter = (0, $kTEqN$useLocalizedStringFormatter)((0, ($parcel$interopDefault($kTEqN$intlStringsmodulejs))), '@react-aria/searchfield');
|
|
26
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit, onClear: onClear, type: type = 'search' } = props;
|
|
27
|
+
let onKeyDown = (e)=>{
|
|
28
|
+
const key = e.key;
|
|
29
|
+
if (key === 'Enter' && (isDisabled || isReadOnly)) e.preventDefault();
|
|
30
|
+
if (isDisabled || isReadOnly) return;
|
|
31
|
+
// for backward compatibility;
|
|
32
|
+
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior
|
|
33
|
+
if (key === 'Enter' && onSubmit) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
onSubmit(state.value);
|
|
36
|
+
}
|
|
37
|
+
if (key === 'Escape') {
|
|
38
|
+
if (state.value === '') e.continuePropagation();
|
|
39
|
+
else {
|
|
40
|
+
state.setValue('');
|
|
41
|
+
if (onClear) onClear();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let onClearButtonClick = ()=>{
|
|
46
|
+
state.setValue('');
|
|
47
|
+
if (onClear) onClear();
|
|
48
|
+
};
|
|
49
|
+
let onPressStart = ()=>{
|
|
50
|
+
var // this is in PressStart for mobile so that touching the clear button doesn't remove focus from
|
|
51
|
+
// the input and close the keyboard
|
|
52
|
+
_inputRef_current;
|
|
53
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
54
|
+
};
|
|
55
|
+
let { labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, ...validation } = (0, $kTEqN$useTextField)({
|
|
56
|
+
...props,
|
|
57
|
+
value: state.value,
|
|
58
|
+
onChange: state.setValue,
|
|
59
|
+
onKeyDown: !isReadOnly ? (0, $kTEqN$chain)(onKeyDown, props.onKeyDown) : props.onKeyDown,
|
|
60
|
+
type: type
|
|
61
|
+
}, inputRef);
|
|
62
|
+
return {
|
|
63
|
+
labelProps: labelProps,
|
|
64
|
+
inputProps: {
|
|
65
|
+
...inputProps,
|
|
66
|
+
// already handled by useSearchFieldState
|
|
67
|
+
defaultValue: undefined
|
|
68
|
+
},
|
|
69
|
+
clearButtonProps: {
|
|
70
|
+
'aria-label': stringFormatter.format('Clear search'),
|
|
71
|
+
excludeFromTabOrder: true,
|
|
72
|
+
preventFocusOnPress: true,
|
|
73
|
+
isDisabled: isDisabled || isReadOnly,
|
|
74
|
+
onPress: onClearButtonClick,
|
|
75
|
+
onPressStart: onPressStart
|
|
76
|
+
},
|
|
77
|
+
descriptionProps: descriptionProps,
|
|
78
|
+
errorMessageProps: errorMessageProps,
|
|
79
|
+
...validation
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export {$4d52238874b24f86$export$9bb30bbe003b82e0 as useSearchField};
|
|
85
|
+
//# sourceMappingURL=useSearchField.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAgCM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,cACF,UAAU,cACV,UAAU,YACV,QAAQ,WACR,OAAO,QACP,OAAO,UACR,GAAG;IAEJ,IAAI,YAAY,CAAC;QACf,MAAM,MAAM,EAAE,GAAG;QAEjB,IAAI,QAAQ,WAAY,CAAA,cAAc,UAAS,GAC7C,EAAE,cAAc;QAGlB,IAAI,cAAc,YAChB;QAGF,8BAA8B;QAC9B,2FAA2F;QAC3F,IAAI,QAAQ,WAAW,UAAU;YAC/B,EAAE,cAAc;YAChB,SAAS,MAAM,KAAK;QACtB;QAEA,IAAI,QAAQ;YACV,IAAI,MAAM,KAAK,KAAK,IAClB,EAAE,mBAAmB;iBAChB;gBACL,MAAM,QAAQ,CAAC;gBACf,IAAI,SACF;YAEJ;;IAEJ;IAEA,IAAI,qBAAqB;QACvB,MAAM,QAAQ,CAAC;QAEf,IAAI,SACF;IAEJ;IAEA,IAAI,eAAe;YACjB,+FAA+F;QAC/F,mCAAmC;QACnC;SAAA,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK;IACzB;IAEA,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,mBAAW,EAAE;QAC9F,GAAG,KAAK;QACR,OAAO,MAAM,KAAK;QAClB,UAAU,MAAM,QAAQ;QACxB,WAAW,CAAC,aAAa,CAAA,GAAA,YAAI,EAAE,WAAW,MAAM,SAAS,IAAI,MAAM,SAAS;cAC5E;IACF,GAAG;IAEH,OAAO;oBACL;QACA,YAAY;YACV,GAAG,UAAU;YACb,yCAAyC;YACzC,cAAc;QAChB;QACA,kBAAkB;YAChB,cAAc,gBAAgB,MAAM,CAAC;YACrC,qBAAqB;YACrB,qBAAqB;YACrB,YAAY,cAAc;YAC1B,SAAS;0BACT;QACF;0BACA;2BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/searchfield/src/useSearchField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaSearchFieldProps} from '@react-types/searchfield';\nimport {chain} from '@react-aria/utils';\nimport {DOMAttributes, RefObject, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, LabelHTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SearchFieldState} from '@react-stately/searchfield';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useTextField} from '@react-aria/textfield';\n\nexport interface SearchFieldAria extends ValidationResult {\n /** Props for the text field's visible label element (if any). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the searchfield's description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the searchfield's error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search field.\n * @param props - Props for the search field.\n * @param state - State for the search field, as returned by `useSearchFieldState`.\n * @param inputRef - A ref to the input element.\n */\nexport function useSearchField(\n props: AriaSearchFieldProps,\n state: SearchFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): SearchFieldAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/searchfield');\n let {\n isDisabled,\n isReadOnly,\n onSubmit,\n onClear,\n type = 'search'\n } = props;\n\n let onKeyDown = (e) => {\n const key = e.key;\n\n if (key === 'Enter' && (isDisabled || isReadOnly)) {\n e.preventDefault();\n }\n\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // for backward compatibility;\n // otherwise, \"Enter\" on an input would trigger a form submit, the default browser behavior\n if (key === 'Enter' && onSubmit) {\n e.preventDefault();\n onSubmit(state.value);\n }\n\n if (key === 'Escape') {\n if (state.value === '') {\n e.continuePropagation();\n } else {\n state.setValue('');\n if (onClear) {\n onClear();\n }\n }\n }\n };\n\n let onClearButtonClick = () => {\n state.setValue('');\n\n if (onClear) {\n onClear();\n }\n };\n\n let onPressStart = () => {\n // this is in PressStart for mobile so that touching the clear button doesn't remove focus from\n // the input and close the keyboard\n inputRef.current?.focus();\n };\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps, ...validation} = useTextField({\n ...props,\n value: state.value,\n onChange: state.setValue,\n onKeyDown: !isReadOnly ? chain(onKeyDown, props.onKeyDown) : props.onKeyDown,\n type\n }, inputRef);\n\n return {\n labelProps,\n inputProps: {\n ...inputProps,\n // already handled by useSearchFieldState\n defaultValue: undefined\n },\n clearButtonProps: {\n 'aria-label': stringFormatter.format('Clear search'),\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: isDisabled || isReadOnly,\n onPress: onClearButtonClick,\n onPressStart\n },\n descriptionProps,\n errorMessageProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchField.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,gBAAgB,CAAC,gCAAI,CAAC;AAC1C","sources":["packages/@react-aria/searchfield/intl/zh-CN.json"],"sourcesContent":["{\n \"Clear search\": \"清除搜索\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|