UNPKG

react-aria-components

Version:

A library of styleable components built using React Aria

82 lines (71 loc) 3.5 kB
var $c5ccf687772c0422$exports = require("./utils.main.js"); var $3vfYa$reactaria = require("react-aria"); var $3vfYa$reactariacollections = require("@react-aria/collections"); var $3vfYa$reactariautils = require("@react-aria/utils"); var $3vfYa$react = require("react"); 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, "ButtonContext", () => $b856e6788a7ea5bf$export$24d547caef80ccd1); $parcel$export(module.exports, "Button", () => $b856e6788a7ea5bf$export$353f5b6fc5456de1); /* * Copyright 2022 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 $b856e6788a7ea5bf$var$additionalButtonHTMLAttributes = new Set([ 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value' ]); const $b856e6788a7ea5bf$export$24d547caef80ccd1 = /*#__PURE__*/ (0, $3vfYa$react.createContext)({}); function $b856e6788a7ea5bf$var$Button(props, ref) { [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $b856e6788a7ea5bf$export$24d547caef80ccd1); let ctx = props; let { buttonProps: buttonProps, isPressed: isPressed } = (0, $3vfYa$reactaria.useButton)(props, ref); let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $3vfYa$reactaria.useFocusRing)(props); let { hoverProps: hoverProps, isHovered: isHovered } = (0, $3vfYa$reactaria.useHover)(props); let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({ ...props, values: { isHovered: isHovered, isPressed: isPressed, isFocused: isFocused, isFocusVisible: isFocusVisible, isDisabled: props.isDisabled || false }, defaultClassName: 'react-aria-Button' }); return /*#__PURE__*/ (0, ($parcel$interopDefault($3vfYa$react))).createElement("button", { ...(0, $3vfYa$reactariautils.filterDOMProps)(props, { propNames: $b856e6788a7ea5bf$var$additionalButtonHTMLAttributes }), ...(0, $3vfYa$reactaria.mergeProps)(buttonProps, focusProps, hoverProps), ...renderProps, ref: ref, slot: props.slot || undefined, "data-disabled": props.isDisabled || undefined, "data-pressed": ctx.isPressed || isPressed || undefined, "data-hovered": isHovered || undefined, "data-focused": isFocused || undefined, "data-focus-visible": isFocusVisible || undefined }); } /** * A button allows a user to perform an action, with mouse, touch, and keyboard interactions. */ const $b856e6788a7ea5bf$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $3vfYa$reactariacollections.createHideableComponent)($b856e6788a7ea5bf$var$Button); //# sourceMappingURL=Button.main.js.map