@react-spectrum/button 3.16.1 → 3.16.3
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/dist/ActionButton.main.js +97 -0
- package/dist/ActionButton.main.js.map +1 -0
- package/dist/ActionButton.mjs +92 -0
- package/dist/ActionButton.module.js +92 -0
- package/dist/ActionButton.module.js.map +1 -0
- package/dist/Button.main.js +177 -0
- package/dist/Button.main.js.map +1 -0
- package/dist/Button.mjs +172 -0
- package/dist/Button.module.js +172 -0
- package/dist/Button.module.js.map +1 -0
- package/dist/ClearButton.main.js +75 -0
- package/dist/ClearButton.main.js.map +1 -0
- package/dist/ClearButton.mjs +70 -0
- package/dist/ClearButton.module.js +70 -0
- package/dist/ClearButton.module.js.map +1 -0
- package/dist/FieldButton.main.js +72 -0
- package/dist/FieldButton.main.js.map +1 -0
- package/dist/FieldButton.mjs +67 -0
- package/dist/FieldButton.module.js +67 -0
- package/dist/FieldButton.module.js.map +1 -0
- package/dist/LogicButton.main.js +70 -0
- package/dist/LogicButton.main.js.map +1 -0
- package/dist/LogicButton.mjs +65 -0
- package/dist/LogicButton.module.js +65 -0
- package/dist/LogicButton.module.js.map +1 -0
- package/dist/ToggleButton.main.js +90 -0
- package/dist/ToggleButton.main.js.map +1 -0
- package/dist/ToggleButton.mjs +85 -0
- package/dist/ToggleButton.module.js +85 -0
- package/dist/ToggleButton.module.js.map +1 -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/button_vars_css.main.js +122 -0
- package/dist/button_vars_css.main.js.map +1 -0
- package/dist/button_vars_css.mjs +124 -0
- package/dist/button_vars_css.module.js +124 -0
- package/dist/button_vars_css.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 +6 -814
- 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 +12 -816
- package/dist/main.js.map +1 -1
- package/dist/module.js +6 -814
- package/dist/module.js.map +1 -1
- 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 +6 -6
- package/dist/types.d.ts.map +1 -1
- 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/vars.4fe44343.css +1645 -0
- package/dist/vars.4fe44343.css.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 +15 -15
- package/src/ActionButton.tsx +27 -15
- package/dist/main.css +0 -1
@@ -0,0 +1,72 @@
|
|
1
|
+
require("./vars.4fe44343.css");
|
2
|
+
var $afc5a4514aca2340$exports = require("./button_vars_css.main.js");
|
3
|
+
var $7mUYa$reactspectrumutils = require("@react-spectrum/utils");
|
4
|
+
var $7mUYa$reactariafocus = require("@react-aria/focus");
|
5
|
+
var $7mUYa$reactariautils = require("@react-aria/utils");
|
6
|
+
var $7mUYa$react = require("react");
|
7
|
+
var $7mUYa$reactariabutton = require("@react-aria/button");
|
8
|
+
var $7mUYa$reactariainteractions = require("@react-aria/interactions");
|
9
|
+
|
10
|
+
|
11
|
+
function $parcel$interopDefault(a) {
|
12
|
+
return a && a.__esModule ? a.default : a;
|
13
|
+
}
|
14
|
+
|
15
|
+
function $parcel$export(e, n, v, s) {
|
16
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
17
|
+
}
|
18
|
+
|
19
|
+
$parcel$export(module.exports, "FieldButton", () => $5931ec1ea1ec1b0d$export$47dc48f595b075da);
|
20
|
+
/*
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
25
|
+
*
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
29
|
+
* governing permissions and limitations under the License.
|
30
|
+
*/
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
// @private
|
38
|
+
function $5931ec1ea1ec1b0d$var$FieldButton(props, ref) {
|
39
|
+
props = (0, $7mUYa$reactspectrumutils.useSlotProps)(props, "button");
|
40
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, isInvalid: isInvalid, children: children, autoFocus: autoFocus, isActive: isActive, focusRingClass: focusRingClass, ...otherProps } = props;
|
41
|
+
let domRef = (0, $7mUYa$reactspectrumutils.useFocusableRef)(ref);
|
42
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $7mUYa$reactariabutton.useButton)(props, domRef);
|
43
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7mUYa$reactariainteractions.useHover)({
|
44
|
+
isDisabled: isDisabled
|
45
|
+
});
|
46
|
+
let { styleProps: styleProps } = (0, $7mUYa$reactspectrumutils.useStyleProps)(otherProps);
|
47
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7mUYa$react))).createElement((0, $7mUYa$reactariafocus.FocusRing), {
|
48
|
+
focusRingClass: (0, $7mUYa$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "focus-ring", focusRingClass),
|
49
|
+
autoFocus: autoFocus
|
50
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7mUYa$react))).createElement("button", {
|
51
|
+
...(0, $7mUYa$reactariautils.mergeProps)(buttonProps, hoverProps),
|
52
|
+
ref: domRef,
|
53
|
+
className: (0, $7mUYa$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-FieldButton", {
|
54
|
+
"spectrum-FieldButton--quiet": isQuiet,
|
55
|
+
"is-active": isActive || isPressed,
|
56
|
+
"is-disabled": isDisabled,
|
57
|
+
"spectrum-FieldButton--invalid": isInvalid || validationState === "invalid",
|
58
|
+
"is-hovered": isHovered
|
59
|
+
}, styleProps.className)
|
60
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7mUYa$react))).createElement((0, $7mUYa$reactspectrumutils.SlotProvider), {
|
61
|
+
slots: {
|
62
|
+
icon: {
|
63
|
+
size: "S",
|
64
|
+
UNSAFE_className: (0, $7mUYa$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-Icon")
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}, children)));
|
68
|
+
}
|
69
|
+
let $5931ec1ea1ec1b0d$export$47dc48f595b075da = /*#__PURE__*/ (0, ($parcel$interopDefault($7mUYa$react))).forwardRef($5931ec1ea1ec1b0d$var$FieldButton);
|
70
|
+
|
71
|
+
|
72
|
+
//# sourceMappingURL=FieldButton.main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAoBD,WAAW;AACX,SAAS,kCAAY,KAAuB,EAAE,GAAiB;IAC7D,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,IAAI,WACF,OAAO,cACP,UAAU,mBACV,eAAe,aACf,SAAS,YACT,QAAQ,aACR,SAAS,YACT,QAAQ,kBACR,cAAc,EACd,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gCAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,qBACE,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QAAiB,WAAW;qBACtF,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,+BAA+B;YAC/B,aAAa,YAAY;YACzB,eAAe;YACf,iCAAiC,aAAa,oBAAoB;YAClE,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC;AAKX;AAEA,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/button/src/FieldButton.tsx"],"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 {ButtonProps} from '@react-types/button';\nimport {classNames, SlotProvider, useFocusableRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {RefObject} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useButton} from '@react-aria/button';\nimport {useHover} from '@react-aria/interactions';\n\ninterface FieldButtonProps extends ButtonProps, DOMProps, StyleProps {\n isQuiet?: boolean,\n isActive?: boolean,\n validationState?: 'valid' | 'invalid',\n isInvalid?: boolean,\n focusRingClass?: string\n}\n\n// @private\nfunction FieldButton(props: FieldButtonProps, ref: FocusableRef) {\n props = useSlotProps(props, 'button');\n let {\n isQuiet,\n isDisabled,\n validationState,\n isInvalid,\n children,\n autoFocus,\n isActive,\n focusRingClass,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref) as RefObject<HTMLButtonElement>;\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring', focusRingClass)} autoFocus={autoFocus}>\n <button\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-FieldButton',\n {\n 'spectrum-FieldButton--quiet': isQuiet,\n 'is-active': isActive || isPressed,\n 'is-disabled': isDisabled,\n 'spectrum-FieldButton--invalid': isInvalid || validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <SlotProvider\n slots={{\n icon: {\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n }\n }}>\n {children}\n </SlotProvider>\n </button>\n </FocusRing>\n );\n}\n\nlet _FieldButton = React.forwardRef(FieldButton);\nexport {_FieldButton as FieldButton};\n"],"names":[],"version":3,"file":"FieldButton.main.js.map"}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import "./vars.4fe44343.css";
|
2
|
+
import $b8ZoF$button_vars_cssmodulejs from "./button_vars_css.mjs";
|
3
|
+
import {useSlotProps as $b8ZoF$useSlotProps, useFocusableRef as $b8ZoF$useFocusableRef, useStyleProps as $b8ZoF$useStyleProps, classNames as $b8ZoF$classNames, SlotProvider as $b8ZoF$SlotProvider} from "@react-spectrum/utils";
|
4
|
+
import {FocusRing as $b8ZoF$FocusRing} from "@react-aria/focus";
|
5
|
+
import {mergeProps as $b8ZoF$mergeProps} from "@react-aria/utils";
|
6
|
+
import $b8ZoF$react from "react";
|
7
|
+
import {useButton as $b8ZoF$useButton} from "@react-aria/button";
|
8
|
+
import {useHover as $b8ZoF$useHover} from "@react-aria/interactions";
|
9
|
+
|
10
|
+
|
11
|
+
function $parcel$interopDefault(a) {
|
12
|
+
return a && a.__esModule ? a.default : a;
|
13
|
+
}
|
14
|
+
/*
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
*
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
23
|
+
* governing permissions and limitations under the License.
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
// @private
|
32
|
+
function $b43bd559b476d0c4$var$FieldButton(props, ref) {
|
33
|
+
props = (0, $b8ZoF$useSlotProps)(props, "button");
|
34
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, isInvalid: isInvalid, children: children, autoFocus: autoFocus, isActive: isActive, focusRingClass: focusRingClass, ...otherProps } = props;
|
35
|
+
let domRef = (0, $b8ZoF$useFocusableRef)(ref);
|
36
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $b8ZoF$useButton)(props, domRef);
|
37
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $b8ZoF$useHover)({
|
38
|
+
isDisabled: isDisabled
|
39
|
+
});
|
40
|
+
let { styleProps: styleProps } = (0, $b8ZoF$useStyleProps)(otherProps);
|
41
|
+
return /*#__PURE__*/ (0, $b8ZoF$react).createElement((0, $b8ZoF$FocusRing), {
|
42
|
+
focusRingClass: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "focus-ring", focusRingClass),
|
43
|
+
autoFocus: autoFocus
|
44
|
+
}, /*#__PURE__*/ (0, $b8ZoF$react).createElement("button", {
|
45
|
+
...(0, $b8ZoF$mergeProps)(buttonProps, hoverProps),
|
46
|
+
ref: domRef,
|
47
|
+
className: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "spectrum-FieldButton", {
|
48
|
+
"spectrum-FieldButton--quiet": isQuiet,
|
49
|
+
"is-active": isActive || isPressed,
|
50
|
+
"is-disabled": isDisabled,
|
51
|
+
"spectrum-FieldButton--invalid": isInvalid || validationState === "invalid",
|
52
|
+
"is-hovered": isHovered
|
53
|
+
}, styleProps.className)
|
54
|
+
}, /*#__PURE__*/ (0, $b8ZoF$react).createElement((0, $b8ZoF$SlotProvider), {
|
55
|
+
slots: {
|
56
|
+
icon: {
|
57
|
+
size: "S",
|
58
|
+
UNSAFE_className: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "spectrum-Icon")
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}, children)));
|
62
|
+
}
|
63
|
+
let $b43bd559b476d0c4$export$47dc48f595b075da = /*#__PURE__*/ (0, $b8ZoF$react).forwardRef($b43bd559b476d0c4$var$FieldButton);
|
64
|
+
|
65
|
+
|
66
|
+
export {$b43bd559b476d0c4$export$47dc48f595b075da as FieldButton};
|
67
|
+
//# sourceMappingURL=FieldButton.mjs.map
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import "./vars.4fe44343.css";
|
2
|
+
import $b8ZoF$button_vars_cssmodulejs from "./button_vars_css.module.js";
|
3
|
+
import {useSlotProps as $b8ZoF$useSlotProps, useFocusableRef as $b8ZoF$useFocusableRef, useStyleProps as $b8ZoF$useStyleProps, classNames as $b8ZoF$classNames, SlotProvider as $b8ZoF$SlotProvider} from "@react-spectrum/utils";
|
4
|
+
import {FocusRing as $b8ZoF$FocusRing} from "@react-aria/focus";
|
5
|
+
import {mergeProps as $b8ZoF$mergeProps} from "@react-aria/utils";
|
6
|
+
import $b8ZoF$react from "react";
|
7
|
+
import {useButton as $b8ZoF$useButton} from "@react-aria/button";
|
8
|
+
import {useHover as $b8ZoF$useHover} from "@react-aria/interactions";
|
9
|
+
|
10
|
+
|
11
|
+
function $parcel$interopDefault(a) {
|
12
|
+
return a && a.__esModule ? a.default : a;
|
13
|
+
}
|
14
|
+
/*
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
*
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
23
|
+
* governing permissions and limitations under the License.
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
// @private
|
32
|
+
function $b43bd559b476d0c4$var$FieldButton(props, ref) {
|
33
|
+
props = (0, $b8ZoF$useSlotProps)(props, "button");
|
34
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, isInvalid: isInvalid, children: children, autoFocus: autoFocus, isActive: isActive, focusRingClass: focusRingClass, ...otherProps } = props;
|
35
|
+
let domRef = (0, $b8ZoF$useFocusableRef)(ref);
|
36
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $b8ZoF$useButton)(props, domRef);
|
37
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $b8ZoF$useHover)({
|
38
|
+
isDisabled: isDisabled
|
39
|
+
});
|
40
|
+
let { styleProps: styleProps } = (0, $b8ZoF$useStyleProps)(otherProps);
|
41
|
+
return /*#__PURE__*/ (0, $b8ZoF$react).createElement((0, $b8ZoF$FocusRing), {
|
42
|
+
focusRingClass: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "focus-ring", focusRingClass),
|
43
|
+
autoFocus: autoFocus
|
44
|
+
}, /*#__PURE__*/ (0, $b8ZoF$react).createElement("button", {
|
45
|
+
...(0, $b8ZoF$mergeProps)(buttonProps, hoverProps),
|
46
|
+
ref: domRef,
|
47
|
+
className: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "spectrum-FieldButton", {
|
48
|
+
"spectrum-FieldButton--quiet": isQuiet,
|
49
|
+
"is-active": isActive || isPressed,
|
50
|
+
"is-disabled": isDisabled,
|
51
|
+
"spectrum-FieldButton--invalid": isInvalid || validationState === "invalid",
|
52
|
+
"is-hovered": isHovered
|
53
|
+
}, styleProps.className)
|
54
|
+
}, /*#__PURE__*/ (0, $b8ZoF$react).createElement((0, $b8ZoF$SlotProvider), {
|
55
|
+
slots: {
|
56
|
+
icon: {
|
57
|
+
size: "S",
|
58
|
+
UNSAFE_className: (0, $b8ZoF$classNames)((0, ($parcel$interopDefault($b8ZoF$button_vars_cssmodulejs))), "spectrum-Icon")
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}, children)));
|
62
|
+
}
|
63
|
+
let $b43bd559b476d0c4$export$47dc48f595b075da = /*#__PURE__*/ (0, $b8ZoF$react).forwardRef($b43bd559b476d0c4$var$FieldButton);
|
64
|
+
|
65
|
+
|
66
|
+
export {$b43bd559b476d0c4$export$47dc48f595b075da as FieldButton};
|
67
|
+
//# sourceMappingURL=FieldButton.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAoBD,WAAW;AACX,SAAS,kCAAY,KAAuB,EAAE,GAAiB;IAC7D,QAAQ,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC5B,IAAI,WACF,OAAO,cACP,UAAU,mBACV,eAAe,aACf,SAAS,YACT,QAAQ,aACR,SAAS,YACT,QAAQ,kBACR,cAAc,EACd,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IAEjC,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG,cAAc;QAAiB,WAAW;qBACtF,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,wDAAK,GACL,wBACA;YACE,+BAA+B;YAC/B,aAAa,YAAY;YACzB,eAAe;YACf,iCAAiC,aAAa,oBAAoB;YAClE,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,MAAM;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;YACvC;QACF;OACC;AAKX;AAEA,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/button/src/FieldButton.tsx"],"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 {ButtonProps} from '@react-types/button';\nimport {classNames, SlotProvider, useFocusableRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {RefObject} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useButton} from '@react-aria/button';\nimport {useHover} from '@react-aria/interactions';\n\ninterface FieldButtonProps extends ButtonProps, DOMProps, StyleProps {\n isQuiet?: boolean,\n isActive?: boolean,\n validationState?: 'valid' | 'invalid',\n isInvalid?: boolean,\n focusRingClass?: string\n}\n\n// @private\nfunction FieldButton(props: FieldButtonProps, ref: FocusableRef) {\n props = useSlotProps(props, 'button');\n let {\n isQuiet,\n isDisabled,\n validationState,\n isInvalid,\n children,\n autoFocus,\n isActive,\n focusRingClass,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref) as RefObject<HTMLButtonElement>;\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring', focusRingClass)} autoFocus={autoFocus}>\n <button\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-FieldButton',\n {\n 'spectrum-FieldButton--quiet': isQuiet,\n 'is-active': isActive || isPressed,\n 'is-disabled': isDisabled,\n 'spectrum-FieldButton--invalid': isInvalid || validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <SlotProvider\n slots={{\n icon: {\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n }\n }}>\n {children}\n </SlotProvider>\n </button>\n </FocusRing>\n );\n}\n\nlet _FieldButton = React.forwardRef(FieldButton);\nexport {_FieldButton as FieldButton};\n"],"names":[],"version":3,"file":"FieldButton.module.js.map"}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require("./vars.4fe44343.css");
|
2
|
+
var $afc5a4514aca2340$exports = require("./button_vars_css.main.js");
|
3
|
+
var $adWKT$reactspectrumutils = require("@react-spectrum/utils");
|
4
|
+
var $adWKT$reactariafocus = require("@react-aria/focus");
|
5
|
+
var $adWKT$reactariautils = require("@react-aria/utils");
|
6
|
+
var $adWKT$react = require("react");
|
7
|
+
var $adWKT$reactariabutton = require("@react-aria/button");
|
8
|
+
var $adWKT$reactariainteractions = require("@react-aria/interactions");
|
9
|
+
var $adWKT$reactspectrumprovider = require("@react-spectrum/provider");
|
10
|
+
|
11
|
+
|
12
|
+
function $parcel$interopDefault(a) {
|
13
|
+
return a && a.__esModule ? a.default : a;
|
14
|
+
}
|
15
|
+
|
16
|
+
function $parcel$export(e, n, v, s) {
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
18
|
+
}
|
19
|
+
|
20
|
+
$parcel$export(module.exports, "LogicButton", () => $3bd294eda342b0c4$export$9b0b80fed00ba8b1);
|
21
|
+
/*
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
26
|
+
*
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
30
|
+
* governing permissions and limitations under the License.
|
31
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
function $3bd294eda342b0c4$var$LogicButton(props, ref) {
|
40
|
+
props = (0, $adWKT$reactspectrumprovider.useProviderProps)(props);
|
41
|
+
let { variant: variant, children: children, isDisabled: isDisabled, autoFocus: autoFocus, ...otherProps } = props;
|
42
|
+
let domRef = (0, $adWKT$reactspectrumutils.useFocusableRef)(ref);
|
43
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $adWKT$reactariabutton.useButton)(props, domRef);
|
44
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $adWKT$reactariainteractions.useHover)({
|
45
|
+
isDisabled: isDisabled
|
46
|
+
});
|
47
|
+
let { styleProps: styleProps } = (0, $adWKT$reactspectrumutils.useStyleProps)(otherProps);
|
48
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($adWKT$react))).createElement((0, $adWKT$reactariafocus.FocusRing), {
|
49
|
+
focusRingClass: (0, $adWKT$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "focus-ring"),
|
50
|
+
autoFocus: autoFocus
|
51
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($adWKT$react))).createElement("button", {
|
52
|
+
...styleProps,
|
53
|
+
...(0, $adWKT$reactariautils.mergeProps)(buttonProps, hoverProps),
|
54
|
+
ref: domRef,
|
55
|
+
className: (0, $adWKT$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-LogicButton", {
|
56
|
+
[`spectrum-LogicButton--${variant}`]: variant,
|
57
|
+
"is-disabled": isDisabled,
|
58
|
+
"is-active": isPressed,
|
59
|
+
"is-hovered": isHovered
|
60
|
+
}, styleProps.className)
|
61
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($adWKT$react))).createElement("span", {
|
62
|
+
className: (0, $adWKT$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-Button-label")
|
63
|
+
}, children)));
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* A LogicButton displays an operator within a boolean logic sequence.
|
67
|
+
*/ let $3bd294eda342b0c4$export$9b0b80fed00ba8b1 = /*#__PURE__*/ (0, ($parcel$interopDefault($adWKT$react))).forwardRef($3bd294eda342b0c4$var$LogicButton);
|
68
|
+
|
69
|
+
|
70
|
+
//# sourceMappingURL=LogicButton.main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,kCAAY,KAA+B,EAAE,GAAoC;IACxF,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,WACF,OAAO,YACP,QAAQ,cACR,UAAU,aACV,SAAS,EACT,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gCAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,qBACE,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAAe,WAAW;qBACtE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2B;AAIvE;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/button/src/LogicButton.tsx"],"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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React from 'react';\nimport {SpectrumLogicButtonProps} from '@react-types/button';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useButton} from '@react-aria/button';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction LogicButton(props: SpectrumLogicButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n props = useProviderProps(props);\n let {\n variant,\n children,\n isDisabled,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <button\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-LogicButton',\n {\n [`spectrum-LogicButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <span className={classNames(styles, 'spectrum-Button-label')}>{children}</span>\n </button>\n </FocusRing>\n );\n}\n\n/**\n * A LogicButton displays an operator within a boolean logic sequence.\n */\nlet _LogicButton = React.forwardRef(LogicButton);\nexport {_LogicButton as LogicButton};\n"],"names":[],"version":3,"file":"LogicButton.main.js.map"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import "./vars.4fe44343.css";
|
2
|
+
import $g8O0d$button_vars_cssmodulejs from "./button_vars_css.mjs";
|
3
|
+
import {useFocusableRef as $g8O0d$useFocusableRef, useStyleProps as $g8O0d$useStyleProps, classNames as $g8O0d$classNames} from "@react-spectrum/utils";
|
4
|
+
import {FocusRing as $g8O0d$FocusRing} from "@react-aria/focus";
|
5
|
+
import {mergeProps as $g8O0d$mergeProps} from "@react-aria/utils";
|
6
|
+
import $g8O0d$react from "react";
|
7
|
+
import {useButton as $g8O0d$useButton} from "@react-aria/button";
|
8
|
+
import {useHover as $g8O0d$useHover} from "@react-aria/interactions";
|
9
|
+
import {useProviderProps as $g8O0d$useProviderProps} from "@react-spectrum/provider";
|
10
|
+
|
11
|
+
|
12
|
+
function $parcel$interopDefault(a) {
|
13
|
+
return a && a.__esModule ? a.default : a;
|
14
|
+
}
|
15
|
+
/*
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
*
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
24
|
+
* governing permissions and limitations under the License.
|
25
|
+
*/
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
function $45108e3c482ee88b$var$LogicButton(props, ref) {
|
34
|
+
props = (0, $g8O0d$useProviderProps)(props);
|
35
|
+
let { variant: variant, children: children, isDisabled: isDisabled, autoFocus: autoFocus, ...otherProps } = props;
|
36
|
+
let domRef = (0, $g8O0d$useFocusableRef)(ref);
|
37
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $g8O0d$useButton)(props, domRef);
|
38
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $g8O0d$useHover)({
|
39
|
+
isDisabled: isDisabled
|
40
|
+
});
|
41
|
+
let { styleProps: styleProps } = (0, $g8O0d$useStyleProps)(otherProps);
|
42
|
+
return /*#__PURE__*/ (0, $g8O0d$react).createElement((0, $g8O0d$FocusRing), {
|
43
|
+
focusRingClass: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "focus-ring"),
|
44
|
+
autoFocus: autoFocus
|
45
|
+
}, /*#__PURE__*/ (0, $g8O0d$react).createElement("button", {
|
46
|
+
...styleProps,
|
47
|
+
...(0, $g8O0d$mergeProps)(buttonProps, hoverProps),
|
48
|
+
ref: domRef,
|
49
|
+
className: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "spectrum-LogicButton", {
|
50
|
+
[`spectrum-LogicButton--${variant}`]: variant,
|
51
|
+
"is-disabled": isDisabled,
|
52
|
+
"is-active": isPressed,
|
53
|
+
"is-hovered": isHovered
|
54
|
+
}, styleProps.className)
|
55
|
+
}, /*#__PURE__*/ (0, $g8O0d$react).createElement("span", {
|
56
|
+
className: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "spectrum-Button-label")
|
57
|
+
}, children)));
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* A LogicButton displays an operator within a boolean logic sequence.
|
61
|
+
*/ let $45108e3c482ee88b$export$9b0b80fed00ba8b1 = /*#__PURE__*/ (0, $g8O0d$react).forwardRef($45108e3c482ee88b$var$LogicButton);
|
62
|
+
|
63
|
+
|
64
|
+
export {$45108e3c482ee88b$export$9b0b80fed00ba8b1 as LogicButton};
|
65
|
+
//# sourceMappingURL=LogicButton.mjs.map
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import "./vars.4fe44343.css";
|
2
|
+
import $g8O0d$button_vars_cssmodulejs from "./button_vars_css.module.js";
|
3
|
+
import {useFocusableRef as $g8O0d$useFocusableRef, useStyleProps as $g8O0d$useStyleProps, classNames as $g8O0d$classNames} from "@react-spectrum/utils";
|
4
|
+
import {FocusRing as $g8O0d$FocusRing} from "@react-aria/focus";
|
5
|
+
import {mergeProps as $g8O0d$mergeProps} from "@react-aria/utils";
|
6
|
+
import $g8O0d$react from "react";
|
7
|
+
import {useButton as $g8O0d$useButton} from "@react-aria/button";
|
8
|
+
import {useHover as $g8O0d$useHover} from "@react-aria/interactions";
|
9
|
+
import {useProviderProps as $g8O0d$useProviderProps} from "@react-spectrum/provider";
|
10
|
+
|
11
|
+
|
12
|
+
function $parcel$interopDefault(a) {
|
13
|
+
return a && a.__esModule ? a.default : a;
|
14
|
+
}
|
15
|
+
/*
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
*
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
24
|
+
* governing permissions and limitations under the License.
|
25
|
+
*/
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
function $45108e3c482ee88b$var$LogicButton(props, ref) {
|
34
|
+
props = (0, $g8O0d$useProviderProps)(props);
|
35
|
+
let { variant: variant, children: children, isDisabled: isDisabled, autoFocus: autoFocus, ...otherProps } = props;
|
36
|
+
let domRef = (0, $g8O0d$useFocusableRef)(ref);
|
37
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $g8O0d$useButton)(props, domRef);
|
38
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $g8O0d$useHover)({
|
39
|
+
isDisabled: isDisabled
|
40
|
+
});
|
41
|
+
let { styleProps: styleProps } = (0, $g8O0d$useStyleProps)(otherProps);
|
42
|
+
return /*#__PURE__*/ (0, $g8O0d$react).createElement((0, $g8O0d$FocusRing), {
|
43
|
+
focusRingClass: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "focus-ring"),
|
44
|
+
autoFocus: autoFocus
|
45
|
+
}, /*#__PURE__*/ (0, $g8O0d$react).createElement("button", {
|
46
|
+
...styleProps,
|
47
|
+
...(0, $g8O0d$mergeProps)(buttonProps, hoverProps),
|
48
|
+
ref: domRef,
|
49
|
+
className: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "spectrum-LogicButton", {
|
50
|
+
[`spectrum-LogicButton--${variant}`]: variant,
|
51
|
+
"is-disabled": isDisabled,
|
52
|
+
"is-active": isPressed,
|
53
|
+
"is-hovered": isHovered
|
54
|
+
}, styleProps.className)
|
55
|
+
}, /*#__PURE__*/ (0, $g8O0d$react).createElement("span", {
|
56
|
+
className: (0, $g8O0d$classNames)((0, ($parcel$interopDefault($g8O0d$button_vars_cssmodulejs))), "spectrum-Button-label")
|
57
|
+
}, children)));
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* A LogicButton displays an operator within a boolean logic sequence.
|
61
|
+
*/ let $45108e3c482ee88b$export$9b0b80fed00ba8b1 = /*#__PURE__*/ (0, $g8O0d$react).forwardRef($45108e3c482ee88b$var$LogicButton);
|
62
|
+
|
63
|
+
|
64
|
+
export {$45108e3c482ee88b$export$9b0b80fed00ba8b1 as LogicButton};
|
65
|
+
//# sourceMappingURL=LogicButton.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,kCAAY,KAA+B,EAAE,GAAoC;IACxF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,WACF,OAAO,YACP,QAAQ,cACR,UAAU,aACV,SAAS,EACT,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IAEjC,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;QAAe,WAAW;qBACtE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,wDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;OAA2B;AAIvE;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/button/src/LogicButton.tsx"],"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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React from 'react';\nimport {SpectrumLogicButtonProps} from '@react-types/button';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useButton} from '@react-aria/button';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction LogicButton(props: SpectrumLogicButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n props = useProviderProps(props);\n let {\n variant,\n children,\n isDisabled,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <button\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-LogicButton',\n {\n [`spectrum-LogicButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <span className={classNames(styles, 'spectrum-Button-label')}>{children}</span>\n </button>\n </FocusRing>\n );\n}\n\n/**\n * A LogicButton displays an operator within a boolean logic sequence.\n */\nlet _LogicButton = React.forwardRef(LogicButton);\nexport {_LogicButton as LogicButton};\n"],"names":[],"version":3,"file":"LogicButton.module.js.map"}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require("./vars.4fe44343.css");
|
2
|
+
var $afc5a4514aca2340$exports = require("./button_vars_css.main.js");
|
3
|
+
var $58xyJ$reactspectrumutils = require("@react-spectrum/utils");
|
4
|
+
var $58xyJ$reactariafocus = require("@react-aria/focus");
|
5
|
+
var $58xyJ$reactariautils = require("@react-aria/utils");
|
6
|
+
var $58xyJ$react = require("react");
|
7
|
+
var $58xyJ$reactspectrumtext = require("@react-spectrum/text");
|
8
|
+
var $58xyJ$reactariainteractions = require("@react-aria/interactions");
|
9
|
+
var $58xyJ$reactspectrumprovider = require("@react-spectrum/provider");
|
10
|
+
var $58xyJ$reactariabutton = require("@react-aria/button");
|
11
|
+
var $58xyJ$reactstatelytoggle = require("@react-stately/toggle");
|
12
|
+
|
13
|
+
|
14
|
+
function $parcel$interopDefault(a) {
|
15
|
+
return a && a.__esModule ? a.default : a;
|
16
|
+
}
|
17
|
+
|
18
|
+
function $parcel$export(e, n, v, s) {
|
19
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
20
|
+
}
|
21
|
+
|
22
|
+
$parcel$export(module.exports, "ToggleButton", () => $b5c927da7d8f1be6$export$d2b052e7b4be1756);
|
23
|
+
/*
|
24
|
+
* Copyright 2020 Adobe. All rights reserved.
|
25
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
26
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
27
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
28
|
+
*
|
29
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
30
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
31
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
32
|
+
* governing permissions and limitations under the License.
|
33
|
+
*/
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
function $b5c927da7d8f1be6$var$ToggleButton(props, ref) {
|
44
|
+
props = (0, $58xyJ$reactspectrumprovider.useProviderProps)(props);
|
45
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, isEmphasized: isEmphasized, staticColor: staticColor, children: children, autoFocus: autoFocus, ...otherProps } = props;
|
46
|
+
let domRef = (0, $58xyJ$reactspectrumutils.useFocusableRef)(ref);
|
47
|
+
let state = (0, $58xyJ$reactstatelytoggle.useToggleState)(props);
|
48
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $58xyJ$reactariabutton.useToggleButton)(props, state, domRef);
|
49
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $58xyJ$reactariainteractions.useHover)({
|
50
|
+
isDisabled: isDisabled
|
51
|
+
});
|
52
|
+
let { styleProps: styleProps } = (0, $58xyJ$reactspectrumutils.useStyleProps)(otherProps);
|
53
|
+
let isTextOnly = (0, ($parcel$interopDefault($58xyJ$react))).Children.toArray(props.children).every((c)=>!/*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).isValidElement(c));
|
54
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).createElement((0, $58xyJ$reactariafocus.FocusRing), {
|
55
|
+
focusRingClass: (0, $58xyJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "focus-ring"),
|
56
|
+
autoFocus: autoFocus
|
57
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).createElement("button", {
|
58
|
+
...styleProps,
|
59
|
+
...(0, $58xyJ$reactariautils.mergeProps)(buttonProps, hoverProps),
|
60
|
+
ref: domRef,
|
61
|
+
className: (0, $58xyJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-ActionButton", {
|
62
|
+
"spectrum-ActionButton--quiet": isQuiet,
|
63
|
+
"spectrum-ActionButton--emphasized": isEmphasized,
|
64
|
+
"spectrum-ActionButton--staticColor": !!staticColor,
|
65
|
+
"spectrum-ActionButton--staticWhite": staticColor === "white",
|
66
|
+
"spectrum-ActionButton--staticBlack": staticColor === "black",
|
67
|
+
"is-active": isPressed,
|
68
|
+
"is-disabled": isDisabled,
|
69
|
+
"is-hovered": isHovered,
|
70
|
+
"is-selected": state.isSelected
|
71
|
+
}, styleProps.className)
|
72
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).createElement((0, $58xyJ$reactspectrumutils.SlotProvider), {
|
73
|
+
slots: {
|
74
|
+
icon: {
|
75
|
+
size: "S",
|
76
|
+
UNSAFE_className: (0, $58xyJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-Icon")
|
77
|
+
},
|
78
|
+
text: {
|
79
|
+
UNSAFE_className: (0, $58xyJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), "spectrum-ActionButton-label")
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}, typeof children === "string" || isTextOnly ? /*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).createElement((0, $58xyJ$reactspectrumtext.Text), null, children) : children)));
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* ToggleButtons allow users to toggle a selection on or off, for example
|
86
|
+
* switching between two states or modes.
|
87
|
+
*/ let $b5c927da7d8f1be6$export$d2b052e7b4be1756 = /*#__PURE__*/ (0, ($parcel$interopDefault($58xyJ$react))).forwardRef($b5c927da7d8f1be6$var$ToggleButton);
|
88
|
+
|
89
|
+
|
90
|
+
//# sourceMappingURL=ToggleButton.main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAeD,SAAS,mCAAa,KAAgC,EAAE,GAAoC;IAC1F,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,WACF,OAAO,cACP,UAAU,gBACV,YAAY,eACZ,WAAW,YACX,QAAQ,aACR,SAAS,EACT,GAAG,YACJ,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,QAAQ,CAAA,GAAA,wCAAa,EAAE;IAC3B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,sCAAc,EAAE,OAAO,OAAO;IAC7D,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,aAAa,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,KAAK,CAAC,CAAA,IAAK,eAAC,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC;IAEzF,qBACE,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAAe,WAAW;qBACtE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,yBACA;YACE,gCAAgC;YAChC,qCAAqC;YACrC,sCAAsC,CAAC,CAAC;YACxC,sCAAsC,gBAAgB;YACtD,sCAAsC,gBAAgB;YACtD,aAAa;YACb,eAAe;YACf,cAAc;YACd,eAAe,MAAM,UAAU;QACjC,GACA,WAAW,SAAS;qBAGxB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,MAAM;gBACJ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC,OAAO,aAAa,YAAY,2BAC7B,0DAAC,CAAA,GAAA,6BAAG,SAAG,YACP;AAKd;AAEA;;;CAGC,GACD,IAAI,0DAAgB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/button/src/ToggleButton.tsx"],"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 {classNames, SlotProvider, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React from 'react';\nimport {SpectrumToggleButtonProps} from '@react-types/button';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useToggleButton} from '@react-aria/button';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction ToggleButton(props: SpectrumToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n props = useProviderProps(props);\n let {\n isQuiet,\n isDisabled,\n isEmphasized,\n staticColor,\n children,\n autoFocus,\n ...otherProps\n } = props;\n\n let domRef = useFocusableRef(ref);\n let state = useToggleState(props);\n let {buttonProps, isPressed} = useToggleButton(props, state, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n let isTextOnly = React.Children.toArray(props.children).every(c => !React.isValidElement(c));\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <button\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-ActionButton',\n {\n 'spectrum-ActionButton--quiet': isQuiet,\n 'spectrum-ActionButton--emphasized': isEmphasized,\n 'spectrum-ActionButton--staticColor': !!staticColor,\n 'spectrum-ActionButton--staticWhite': staticColor === 'white',\n 'spectrum-ActionButton--staticBlack': staticColor === 'black',\n 'is-active': isPressed,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-selected': state.isSelected\n },\n styleProps.className\n )\n }>\n <SlotProvider\n slots={{\n icon: {\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n UNSAFE_className: classNames(styles, 'spectrum-ActionButton-label')\n }\n }}>\n {typeof children === 'string' || isTextOnly\n ? <Text>{children}</Text>\n : children}\n </SlotProvider>\n </button>\n </FocusRing>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = React.forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.main.js.map"}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import "./vars.4fe44343.css";
|
2
|
+
import $3XyjH$button_vars_cssmodulejs from "./button_vars_css.mjs";
|
3
|
+
import {useFocusableRef as $3XyjH$useFocusableRef, useStyleProps as $3XyjH$useStyleProps, classNames as $3XyjH$classNames, SlotProvider as $3XyjH$SlotProvider} from "@react-spectrum/utils";
|
4
|
+
import {FocusRing as $3XyjH$FocusRing} from "@react-aria/focus";
|
5
|
+
import {mergeProps as $3XyjH$mergeProps} from "@react-aria/utils";
|
6
|
+
import $3XyjH$react from "react";
|
7
|
+
import {Text as $3XyjH$Text} from "@react-spectrum/text";
|
8
|
+
import {useHover as $3XyjH$useHover} from "@react-aria/interactions";
|
9
|
+
import {useProviderProps as $3XyjH$useProviderProps} from "@react-spectrum/provider";
|
10
|
+
import {useToggleButton as $3XyjH$useToggleButton} from "@react-aria/button";
|
11
|
+
import {useToggleState as $3XyjH$useToggleState} from "@react-stately/toggle";
|
12
|
+
|
13
|
+
|
14
|
+
function $parcel$interopDefault(a) {
|
15
|
+
return a && a.__esModule ? a.default : a;
|
16
|
+
}
|
17
|
+
/*
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
22
|
+
*
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
26
|
+
* governing permissions and limitations under the License.
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
function $3979c7c23b0bd270$var$ToggleButton(props, ref) {
|
38
|
+
props = (0, $3XyjH$useProviderProps)(props);
|
39
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, isEmphasized: isEmphasized, staticColor: staticColor, children: children, autoFocus: autoFocus, ...otherProps } = props;
|
40
|
+
let domRef = (0, $3XyjH$useFocusableRef)(ref);
|
41
|
+
let state = (0, $3XyjH$useToggleState)(props);
|
42
|
+
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $3XyjH$useToggleButton)(props, state, domRef);
|
43
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $3XyjH$useHover)({
|
44
|
+
isDisabled: isDisabled
|
45
|
+
});
|
46
|
+
let { styleProps: styleProps } = (0, $3XyjH$useStyleProps)(otherProps);
|
47
|
+
let isTextOnly = (0, $3XyjH$react).Children.toArray(props.children).every((c)=>!/*#__PURE__*/ (0, $3XyjH$react).isValidElement(c));
|
48
|
+
return /*#__PURE__*/ (0, $3XyjH$react).createElement((0, $3XyjH$FocusRing), {
|
49
|
+
focusRingClass: (0, $3XyjH$classNames)((0, ($parcel$interopDefault($3XyjH$button_vars_cssmodulejs))), "focus-ring"),
|
50
|
+
autoFocus: autoFocus
|
51
|
+
}, /*#__PURE__*/ (0, $3XyjH$react).createElement("button", {
|
52
|
+
...styleProps,
|
53
|
+
...(0, $3XyjH$mergeProps)(buttonProps, hoverProps),
|
54
|
+
ref: domRef,
|
55
|
+
className: (0, $3XyjH$classNames)((0, ($parcel$interopDefault($3XyjH$button_vars_cssmodulejs))), "spectrum-ActionButton", {
|
56
|
+
"spectrum-ActionButton--quiet": isQuiet,
|
57
|
+
"spectrum-ActionButton--emphasized": isEmphasized,
|
58
|
+
"spectrum-ActionButton--staticColor": !!staticColor,
|
59
|
+
"spectrum-ActionButton--staticWhite": staticColor === "white",
|
60
|
+
"spectrum-ActionButton--staticBlack": staticColor === "black",
|
61
|
+
"is-active": isPressed,
|
62
|
+
"is-disabled": isDisabled,
|
63
|
+
"is-hovered": isHovered,
|
64
|
+
"is-selected": state.isSelected
|
65
|
+
}, styleProps.className)
|
66
|
+
}, /*#__PURE__*/ (0, $3XyjH$react).createElement((0, $3XyjH$SlotProvider), {
|
67
|
+
slots: {
|
68
|
+
icon: {
|
69
|
+
size: "S",
|
70
|
+
UNSAFE_className: (0, $3XyjH$classNames)((0, ($parcel$interopDefault($3XyjH$button_vars_cssmodulejs))), "spectrum-Icon")
|
71
|
+
},
|
72
|
+
text: {
|
73
|
+
UNSAFE_className: (0, $3XyjH$classNames)((0, ($parcel$interopDefault($3XyjH$button_vars_cssmodulejs))), "spectrum-ActionButton-label")
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}, typeof children === "string" || isTextOnly ? /*#__PURE__*/ (0, $3XyjH$react).createElement((0, $3XyjH$Text), null, children) : children)));
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* ToggleButtons allow users to toggle a selection on or off, for example
|
80
|
+
* switching between two states or modes.
|
81
|
+
*/ let $3979c7c23b0bd270$export$d2b052e7b4be1756 = /*#__PURE__*/ (0, $3XyjH$react).forwardRef($3979c7c23b0bd270$var$ToggleButton);
|
82
|
+
|
83
|
+
|
84
|
+
export {$3979c7c23b0bd270$export$d2b052e7b4be1756 as ToggleButton};
|
85
|
+
//# sourceMappingURL=ToggleButton.mjs.map
|