var $81dc1c05bf045ce0$exports = require("./Input.cjs");
var $N0sZu$reactariaprivateutilsfilterDOMProps = require("react-aria/private/utils/filterDOMProps");
var $N0sZu$reactariaprivateutilsshadowdomDOMFunctions = require("react-aria/private/utils/shadowdom/DOMFunctions");
var $N0sZu$reactariaprivateinteractionsPressResponder = require("react-aria/private/interactions/PressResponder");
var $N0sZu$react = require("react");
var $N0sZu$reactariauseObjectRef = require("react-aria/useObjectRef");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "FileTrigger", function () { return $40f6f61555adb35f$export$6fb4a10d2c950550; });
/*
 * Copyright 2023 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.
 */ 





const $40f6f61555adb35f$export$6fb4a10d2c950550 = /*#__PURE__*/ (0, $N0sZu$react.forwardRef)(function FileTrigger(props, ref) {
    let { onSelect: onSelect, acceptedFileTypes: acceptedFileTypes, allowsMultiple: allowsMultiple, defaultCamera: defaultCamera, children: children, acceptDirectory: acceptDirectory, ...rest } = props;
    let inputRef = (0, $N0sZu$reactariauseObjectRef.useObjectRef)(ref);
    let domProps = (0, $N0sZu$reactariaprivateutilsfilterDOMProps.filterDOMProps)(rest, {
        global: true
    });
    return /*#__PURE__*/ (0, ($parcel$interopDefault($N0sZu$react))).createElement((0, ($parcel$interopDefault($N0sZu$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($N0sZu$react))).createElement((0, $N0sZu$reactariaprivateinteractionsPressResponder.PressResponder), {
        onPress: ()=>{
            if (inputRef.current?.value) inputRef.current.value = '';
            inputRef.current?.click();
        }
    }, children), /*#__PURE__*/ (0, ($parcel$interopDefault($N0sZu$react))).createElement((0, $81dc1c05bf045ce0$exports.Input), {
        ...domProps,
        className: "",
        type: "file",
        ref: inputRef,
        style: {
            display: 'none'
        },
        accept: acceptedFileTypes?.toString(),
        onChange: (e)=>onSelect?.((0, $N0sZu$reactariaprivateutilsshadowdomDOMFunctions.getEventTarget)(e).files),
        capture: defaultCamera,
        multiple: allowsMultiple,
        // @ts-expect-error
        webkitdirectory: acceptDirectory ? '' : undefined
    }));
});


//# sourceMappingURL=FileTrigger.cjs.map
