Buckets:
| import {useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.module.js"; | |
| import {useCallback as $hf0lj$useCallback} from "react"; | |
| import {getOwnerDocument as $hf0lj$getOwnerDocument} from "@react-aria/utils"; | |
| /* | |
| * Copyright 2020 Adobe. All rights reserved. | |
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. You may obtain a copy | |
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software distributed under | |
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | |
| * OF ANY KIND, either express or implied. See the License for the specific language | |
| * governing permissions and limitations under the License. | |
| */ // Portions of the code in this file are based on code from react. | |
| // Original licensing for the following can be found in the | |
| // NOTICE file in the root directory of this source tree. | |
| // See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions | |
| function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) { | |
| let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props; | |
| const onBlur = (0, $hf0lj$useCallback)((e)=>{ | |
| if (e.target === e.currentTarget) { | |
| if (onBlurProp) onBlurProp(e); | |
| if (onFocusChange) onFocusChange(false); | |
| return true; | |
| } | |
| }, [ | |
| onBlurProp, | |
| onFocusChange | |
| ]); | |
| const onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur); | |
| const onFocus = (0, $hf0lj$useCallback)((e)=>{ | |
| // Double check that document.activeElement actually matches e.target in case a previously chained | |
| // focus handler already moved focus somewhere else. | |
| const ownerDocument = (0, $hf0lj$getOwnerDocument)(e.target); | |
| if (e.target === e.currentTarget && ownerDocument.activeElement === e.target) { | |
| if (onFocusProp) onFocusProp(e); | |
| if (onFocusChange) onFocusChange(true); | |
| onSyntheticFocus(e); | |
| } | |
| }, [ | |
| onFocusChange, | |
| onFocusProp, | |
| onSyntheticFocus | |
| ]); | |
| return { | |
| focusProps: { | |
| onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined, | |
| onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined | |
| } | |
| }; | |
| } | |
| export {$a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus}; | |
| //# sourceMappingURL=useFocus.module.js.map | |
Xet Storage Details
- Size:
- 2.66 kB
- Xet hash:
- b0a537abbe63a7685ce56936de0a22c196ebf7d6e6849a3726fc9dafd6de193e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.