@react-spectrum/switch 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 ADDED
@@ -0,0 +1,3 @@
1
+ # @react-spectrum/switch
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
@@ -0,0 +1,78 @@
1
+ require("./vars.f7257b6a.css");
2
+ var $faeb9d1b92049ba7$exports = require("./toggle_vars_css.main.js");
3
+ var $3aWe4$reactspectrumutils = require("@react-spectrum/utils");
4
+ var $3aWe4$reactariafocus = require("@react-aria/focus");
5
+ var $3aWe4$react = require("react");
6
+ var $3aWe4$reactariainteractions = require("@react-aria/interactions");
7
+ var $3aWe4$reactspectrumprovider = require("@react-spectrum/provider");
8
+ var $3aWe4$reactariaswitch = require("@react-aria/switch");
9
+ var $3aWe4$reactstatelytoggle = require("@react-stately/toggle");
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, "Switch", () => $e216104aee091306$export$b5d5cf8927ab7262);
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 $e216104aee091306$var$Switch(props, ref) {
40
+ props = (0, $3aWe4$reactspectrumprovider.useProviderProps)(props);
41
+ let { isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
42
+ let { styleProps: styleProps } = (0, $3aWe4$reactspectrumutils.useStyleProps)(otherProps);
43
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $3aWe4$reactariainteractions.useHover)({
44
+ isDisabled: isDisabled
45
+ });
46
+ let inputRef = (0, $3aWe4$react.useRef)(null);
47
+ let domRef = (0, $3aWe4$reactspectrumutils.useFocusableRef)(ref, inputRef);
48
+ let state = (0, $3aWe4$reactstatelytoggle.useToggleState)(props);
49
+ let { inputProps: inputProps } = (0, $3aWe4$reactariaswitch.useSwitch)(props, state, inputRef);
50
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($3aWe4$react))).createElement("label", {
51
+ ...styleProps,
52
+ ...hoverProps,
53
+ ref: domRef,
54
+ className: (0, $3aWe4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($faeb9d1b92049ba7$exports))), 'spectrum-ToggleSwitch', {
55
+ 'spectrum-ToggleSwitch--quiet': !isEmphasized,
56
+ 'is-disabled': isDisabled,
57
+ 'is-hovered': isHovered
58
+ }, styleProps.className)
59
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($3aWe4$react))).createElement((0, $3aWe4$reactariafocus.FocusRing), {
60
+ focusRingClass: (0, $3aWe4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($faeb9d1b92049ba7$exports))), 'focus-ring'),
61
+ autoFocus: autoFocus
62
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($3aWe4$react))).createElement("input", {
63
+ ...inputProps,
64
+ ref: inputRef,
65
+ className: (0, $3aWe4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($faeb9d1b92049ba7$exports))), 'spectrum-ToggleSwitch-input')
66
+ })), /*#__PURE__*/ (0, ($parcel$interopDefault($3aWe4$react))).createElement("span", {
67
+ className: (0, $3aWe4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($faeb9d1b92049ba7$exports))), 'spectrum-ToggleSwitch-switch')
68
+ }), children && /*#__PURE__*/ (0, ($parcel$interopDefault($3aWe4$react))).createElement("span", {
69
+ className: (0, $3aWe4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($faeb9d1b92049ba7$exports))), 'spectrum-ToggleSwitch-label')
70
+ }, children));
71
+ }
72
+ /**
73
+ * Switches allow users to turn an individual option on or off.
74
+ * They are usually used to activate or deactivate a specific setting.
75
+ */ const $e216104aee091306$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $3aWe4$react.forwardRef)($e216104aee091306$var$Switch);
76
+
77
+
78
+ //# sourceMappingURL=Switch.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,6BAAO,KAA0B,EAAE,GAAmC;IAC7E,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,gBACF,eAAe,mBACf,aAAa,kBACb,SAAS,YACT,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAElD,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE,KAAK;IAClC,IAAI,QAAQ,CAAA,GAAA,wCAAa,EAAE;IAC3B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,gCAAQ,EAAE,OAAO,OAAO;IAG3C,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,yBACA;YACE,gCAAgC,CAAC;YACjC,eAAe;YACf,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAAe,WAAW;qBACtE,0DAAC;QACE,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;uBAElC,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACnC,0BACC,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACjC;AAKX;AAEA;;;CAGC,GACD,MAAM,0DAAU,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/switch/src/Switch.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 React, {forwardRef, useRef} from 'react';\nimport {SpectrumSwitchProps} from '@react-types/switch';\nimport styles from '@adobe/spectrum-css-temp/components/toggle/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useSwitch} from '@react-aria/switch';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Switch(props: SpectrumSwitchProps, ref: FocusableRef<HTMLLabelElement>) {\n props = useProviderProps(props);\n let {\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n let state = useToggleState(props);\n let {inputProps} = useSwitch(props, state, inputRef);\n\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-ToggleSwitch',\n {\n 'spectrum-ToggleSwitch--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-ToggleSwitch-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-ToggleSwitch-switch')} />\n {children && (\n <span className={classNames(styles, 'spectrum-ToggleSwitch-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Switches allow users to turn an individual option on or off.\n * They are usually used to activate or deactivate a specific setting.\n */\nconst _Switch = forwardRef(Switch);\nexport {_Switch as Switch};\n"],"names":[],"version":3,"file":"Switch.main.js.map"}
@@ -0,0 +1,73 @@
1
+ import "./vars.f7257b6a.css";
2
+ import $cEq2J$toggle_vars_cssmodulejs from "./toggle_vars_css.mjs";
3
+ import {useStyleProps as $cEq2J$useStyleProps, useFocusableRef as $cEq2J$useFocusableRef, classNames as $cEq2J$classNames} from "@react-spectrum/utils";
4
+ import {FocusRing as $cEq2J$FocusRing} from "@react-aria/focus";
5
+ import $cEq2J$react, {useRef as $cEq2J$useRef, forwardRef as $cEq2J$forwardRef} from "react";
6
+ import {useHover as $cEq2J$useHover} from "@react-aria/interactions";
7
+ import {useProviderProps as $cEq2J$useProviderProps} from "@react-spectrum/provider";
8
+ import {useSwitch as $cEq2J$useSwitch} from "@react-aria/switch";
9
+ import {useToggleState as $cEq2J$useToggleState} from "@react-stately/toggle";
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 $8341c396cee1c5fc$var$Switch(props, ref) {
34
+ props = (0, $cEq2J$useProviderProps)(props);
35
+ let { isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
36
+ let { styleProps: styleProps } = (0, $cEq2J$useStyleProps)(otherProps);
37
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $cEq2J$useHover)({
38
+ isDisabled: isDisabled
39
+ });
40
+ let inputRef = (0, $cEq2J$useRef)(null);
41
+ let domRef = (0, $cEq2J$useFocusableRef)(ref, inputRef);
42
+ let state = (0, $cEq2J$useToggleState)(props);
43
+ let { inputProps: inputProps } = (0, $cEq2J$useSwitch)(props, state, inputRef);
44
+ return /*#__PURE__*/ (0, $cEq2J$react).createElement("label", {
45
+ ...styleProps,
46
+ ...hoverProps,
47
+ ref: domRef,
48
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch', {
49
+ 'spectrum-ToggleSwitch--quiet': !isEmphasized,
50
+ 'is-disabled': isDisabled,
51
+ 'is-hovered': isHovered
52
+ }, styleProps.className)
53
+ }, /*#__PURE__*/ (0, $cEq2J$react).createElement((0, $cEq2J$FocusRing), {
54
+ focusRingClass: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'focus-ring'),
55
+ autoFocus: autoFocus
56
+ }, /*#__PURE__*/ (0, $cEq2J$react).createElement("input", {
57
+ ...inputProps,
58
+ ref: inputRef,
59
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-input')
60
+ })), /*#__PURE__*/ (0, $cEq2J$react).createElement("span", {
61
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-switch')
62
+ }), children && /*#__PURE__*/ (0, $cEq2J$react).createElement("span", {
63
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-label')
64
+ }, children));
65
+ }
66
+ /**
67
+ * Switches allow users to turn an individual option on or off.
68
+ * They are usually used to activate or deactivate a specific setting.
69
+ */ const $8341c396cee1c5fc$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $cEq2J$forwardRef)($8341c396cee1c5fc$var$Switch);
70
+
71
+
72
+ export {$8341c396cee1c5fc$export$b5d5cf8927ab7262 as Switch};
73
+ //# sourceMappingURL=Switch.module.js.map
@@ -0,0 +1,73 @@
1
+ import "./vars.f7257b6a.css";
2
+ import $cEq2J$toggle_vars_cssmodulejs from "./toggle_vars_css.module.js";
3
+ import {useStyleProps as $cEq2J$useStyleProps, useFocusableRef as $cEq2J$useFocusableRef, classNames as $cEq2J$classNames} from "@react-spectrum/utils";
4
+ import {FocusRing as $cEq2J$FocusRing} from "@react-aria/focus";
5
+ import $cEq2J$react, {useRef as $cEq2J$useRef, forwardRef as $cEq2J$forwardRef} from "react";
6
+ import {useHover as $cEq2J$useHover} from "@react-aria/interactions";
7
+ import {useProviderProps as $cEq2J$useProviderProps} from "@react-spectrum/provider";
8
+ import {useSwitch as $cEq2J$useSwitch} from "@react-aria/switch";
9
+ import {useToggleState as $cEq2J$useToggleState} from "@react-stately/toggle";
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 $8341c396cee1c5fc$var$Switch(props, ref) {
34
+ props = (0, $cEq2J$useProviderProps)(props);
35
+ let { isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
36
+ let { styleProps: styleProps } = (0, $cEq2J$useStyleProps)(otherProps);
37
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $cEq2J$useHover)({
38
+ isDisabled: isDisabled
39
+ });
40
+ let inputRef = (0, $cEq2J$useRef)(null);
41
+ let domRef = (0, $cEq2J$useFocusableRef)(ref, inputRef);
42
+ let state = (0, $cEq2J$useToggleState)(props);
43
+ let { inputProps: inputProps } = (0, $cEq2J$useSwitch)(props, state, inputRef);
44
+ return /*#__PURE__*/ (0, $cEq2J$react).createElement("label", {
45
+ ...styleProps,
46
+ ...hoverProps,
47
+ ref: domRef,
48
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch', {
49
+ 'spectrum-ToggleSwitch--quiet': !isEmphasized,
50
+ 'is-disabled': isDisabled,
51
+ 'is-hovered': isHovered
52
+ }, styleProps.className)
53
+ }, /*#__PURE__*/ (0, $cEq2J$react).createElement((0, $cEq2J$FocusRing), {
54
+ focusRingClass: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'focus-ring'),
55
+ autoFocus: autoFocus
56
+ }, /*#__PURE__*/ (0, $cEq2J$react).createElement("input", {
57
+ ...inputProps,
58
+ ref: inputRef,
59
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-input')
60
+ })), /*#__PURE__*/ (0, $cEq2J$react).createElement("span", {
61
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-switch')
62
+ }), children && /*#__PURE__*/ (0, $cEq2J$react).createElement("span", {
63
+ className: (0, $cEq2J$classNames)((0, ($parcel$interopDefault($cEq2J$toggle_vars_cssmodulejs))), 'spectrum-ToggleSwitch-label')
64
+ }, children));
65
+ }
66
+ /**
67
+ * Switches allow users to turn an individual option on or off.
68
+ * They are usually used to activate or deactivate a specific setting.
69
+ */ const $8341c396cee1c5fc$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $cEq2J$forwardRef)($8341c396cee1c5fc$var$Switch);
70
+
71
+
72
+ export {$8341c396cee1c5fc$export$b5d5cf8927ab7262 as Switch};
73
+ //# sourceMappingURL=Switch.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,6BAAO,KAA0B,EAAE,GAAmC;IAC7E,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,gBACF,eAAe,mBACf,aAAa,kBACb,SAAS,YACT,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAElD,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE,KAAK;IAClC,IAAI,QAAQ,CAAA,GAAA,qBAAa,EAAE;IAC3B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,OAAO,OAAO;IAG3C,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,wDAAK,GACL,yBACA;YACE,gCAAgC,CAAC;YACjC,eAAe;YACf,cAAc;QAChB,GACA,WAAW,SAAS;qBAGxB,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;QAAe,WAAW;qBACtE,gCAAC;QACE,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;uBAElC,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;QACnC,0BACC,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;OACjC;AAKX;AAEA;;;CAGC,GACD,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/switch/src/Switch.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 React, {forwardRef, useRef} from 'react';\nimport {SpectrumSwitchProps} from '@react-types/switch';\nimport styles from '@adobe/spectrum-css-temp/components/toggle/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useSwitch} from '@react-aria/switch';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Switch(props: SpectrumSwitchProps, ref: FocusableRef<HTMLLabelElement>) {\n props = useProviderProps(props);\n let {\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n let state = useToggleState(props);\n let {inputProps} = useSwitch(props, state, inputRef);\n\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-ToggleSwitch',\n {\n 'spectrum-ToggleSwitch--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-ToggleSwitch-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-ToggleSwitch-switch')} />\n {children && (\n <span className={classNames(styles, 'spectrum-ToggleSwitch-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Switches allow users to turn an individual option on or off.\n * They are usually used to activate or deactivate a specific setting.\n */\nconst _Switch = forwardRef(Switch);\nexport {_Switch as Switch};\n"],"names":[],"version":3,"file":"Switch.module.js.map"}
@@ -0,0 +1,18 @@
1
+ import {Switch as $8341c396cee1c5fc$export$b5d5cf8927ab7262} from "./Switch.mjs";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */ /// <reference types="css-module-types" />
14
+
15
+
16
+
17
+ export {$8341c396cee1c5fc$export$b5d5cf8927ab7262 as Switch};
18
+ //# sourceMappingURL=module.js.map
package/dist/main.js ADDED
@@ -0,0 +1,23 @@
1
+ var $e216104aee091306$exports = require("./Switch.main.js");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "Switch", () => $e216104aee091306$exports.Switch);
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */ /// <reference types="css-module-types" />
20
+
21
+
22
+
23
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/switch/src/index.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\n/// <reference types=\"css-module-types\" />\n\nexport {Switch} from './Switch';\nexport type {SpectrumSwitchProps} from '@react-types/switch';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js ADDED
@@ -0,0 +1,18 @@
1
+ import {Switch as $8341c396cee1c5fc$export$b5d5cf8927ab7262} from "./Switch.module.js";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */ /// <reference types="css-module-types" />
14
+
15
+
16
+
17
+ export {$8341c396cee1c5fc$export$b5d5cf8927ab7262 as Switch};
18
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/switch/src/index.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\n/// <reference types=\"css-module-types\" />\n\nexport {Switch} from './Switch';\nexport type {SpectrumSwitchProps} from '@react-types/switch';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,44 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "focus-ring", () => $faeb9d1b92049ba7$export$f39a09f249340e2a, (v) => $faeb9d1b92049ba7$export$f39a09f249340e2a = v);
7
+ $parcel$export(module.exports, "i18nFontFamily", () => $faeb9d1b92049ba7$export$8c4ee2c50c22c514, (v) => $faeb9d1b92049ba7$export$8c4ee2c50c22c514 = v);
8
+ $parcel$export(module.exports, "is-hovered", () => $faeb9d1b92049ba7$export$b8813cd5d7824ce7, (v) => $faeb9d1b92049ba7$export$b8813cd5d7824ce7 = v);
9
+ $parcel$export(module.exports, "spectrum-FocusRing-ring", () => $faeb9d1b92049ba7$export$4109102f950813a6, (v) => $faeb9d1b92049ba7$export$4109102f950813a6 = v);
10
+ $parcel$export(module.exports, "spectrum-FocusRing", () => $faeb9d1b92049ba7$export$24c7f46a6e3605dd, (v) => $faeb9d1b92049ba7$export$24c7f46a6e3605dd = v);
11
+ $parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $faeb9d1b92049ba7$export$2927016961429360, (v) => $faeb9d1b92049ba7$export$2927016961429360 = v);
12
+ $parcel$export(module.exports, "spectrum-ToggleSwitch", () => $faeb9d1b92049ba7$export$89a9162656c0c38c, (v) => $faeb9d1b92049ba7$export$89a9162656c0c38c = v);
13
+ $parcel$export(module.exports, "spectrum-ToggleSwitch--ab", () => $faeb9d1b92049ba7$export$dc5a33fddabf5882, (v) => $faeb9d1b92049ba7$export$dc5a33fddabf5882 = v);
14
+ $parcel$export(module.exports, "spectrum-ToggleSwitch--quiet", () => $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4, (v) => $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4 = v);
15
+ $parcel$export(module.exports, "spectrum-ToggleSwitch-input", () => $faeb9d1b92049ba7$export$38df7ea4ffef819a, (v) => $faeb9d1b92049ba7$export$38df7ea4ffef819a = v);
16
+ $parcel$export(module.exports, "spectrum-ToggleSwitch-label", () => $faeb9d1b92049ba7$export$8f1a69021a3897b2, (v) => $faeb9d1b92049ba7$export$8f1a69021a3897b2 = v);
17
+ $parcel$export(module.exports, "spectrum-ToggleSwitch-switch", () => $faeb9d1b92049ba7$export$b82d06d1b520a22f, (v) => $faeb9d1b92049ba7$export$b82d06d1b520a22f = v);
18
+ var $faeb9d1b92049ba7$export$f39a09f249340e2a;
19
+ var $faeb9d1b92049ba7$export$8c4ee2c50c22c514;
20
+ var $faeb9d1b92049ba7$export$b8813cd5d7824ce7;
21
+ var $faeb9d1b92049ba7$export$4109102f950813a6;
22
+ var $faeb9d1b92049ba7$export$24c7f46a6e3605dd;
23
+ var $faeb9d1b92049ba7$export$2927016961429360;
24
+ var $faeb9d1b92049ba7$export$89a9162656c0c38c;
25
+ var $faeb9d1b92049ba7$export$dc5a33fddabf5882;
26
+ var $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4;
27
+ var $faeb9d1b92049ba7$export$38df7ea4ffef819a;
28
+ var $faeb9d1b92049ba7$export$8f1a69021a3897b2;
29
+ var $faeb9d1b92049ba7$export$b82d06d1b520a22f;
30
+ $faeb9d1b92049ba7$export$f39a09f249340e2a = `XHynUq_focus-ring`;
31
+ $faeb9d1b92049ba7$export$8c4ee2c50c22c514 = `XHynUq_i18nFontFamily`;
32
+ $faeb9d1b92049ba7$export$b8813cd5d7824ce7 = `XHynUq_is-hovered`;
33
+ $faeb9d1b92049ba7$export$4109102f950813a6 = `XHynUq_spectrum-FocusRing-ring`;
34
+ $faeb9d1b92049ba7$export$24c7f46a6e3605dd = `XHynUq_spectrum-FocusRing ${$faeb9d1b92049ba7$export$4109102f950813a6}`;
35
+ $faeb9d1b92049ba7$export$2927016961429360 = `XHynUq_spectrum-FocusRing--quiet`;
36
+ $faeb9d1b92049ba7$export$89a9162656c0c38c = `XHynUq_spectrum-ToggleSwitch`;
37
+ $faeb9d1b92049ba7$export$dc5a33fddabf5882 = `XHynUq_spectrum-ToggleSwitch--ab`;
38
+ $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4 = `XHynUq_spectrum-ToggleSwitch--quiet`;
39
+ $faeb9d1b92049ba7$export$38df7ea4ffef819a = `XHynUq_spectrum-ToggleSwitch-input`;
40
+ $faeb9d1b92049ba7$export$8f1a69021a3897b2 = `XHynUq_spectrum-ToggleSwitch-label`;
41
+ $faeb9d1b92049ba7$export$b82d06d1b520a22f = `XHynUq_spectrum-ToggleSwitch-switch`;
42
+
43
+
44
+ //# sourceMappingURL=toggle_vars_css.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAXA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,0CAA0C,CAAC;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAAiD,CAAC,mCAAmC,CAAC;AACtF,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAiD,CAAC,mCAAmC,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/toggle/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"toggle_vars_css.main.js.map"}
@@ -0,0 +1,46 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $dfcff93ab25bb9b3$exports = {};
6
+
7
+ $parcel$export($dfcff93ab25bb9b3$exports, "focus-ring", () => $dfcff93ab25bb9b3$export$f39a09f249340e2a, (v) => $dfcff93ab25bb9b3$export$f39a09f249340e2a = v);
8
+ $parcel$export($dfcff93ab25bb9b3$exports, "i18nFontFamily", () => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514, (v) => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = v);
9
+ $parcel$export($dfcff93ab25bb9b3$exports, "is-hovered", () => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7, (v) => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = v);
10
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing-ring", () => $dfcff93ab25bb9b3$export$4109102f950813a6, (v) => $dfcff93ab25bb9b3$export$4109102f950813a6 = v);
11
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing", () => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd, (v) => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd = v);
12
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing--quiet", () => $dfcff93ab25bb9b3$export$2927016961429360, (v) => $dfcff93ab25bb9b3$export$2927016961429360 = v);
13
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch", () => $dfcff93ab25bb9b3$export$89a9162656c0c38c, (v) => $dfcff93ab25bb9b3$export$89a9162656c0c38c = v);
14
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--ab", () => $dfcff93ab25bb9b3$export$dc5a33fddabf5882, (v) => $dfcff93ab25bb9b3$export$dc5a33fddabf5882 = v);
15
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--quiet", () => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4, (v) => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = v);
16
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-input", () => $dfcff93ab25bb9b3$export$38df7ea4ffef819a, (v) => $dfcff93ab25bb9b3$export$38df7ea4ffef819a = v);
17
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-label", () => $dfcff93ab25bb9b3$export$8f1a69021a3897b2, (v) => $dfcff93ab25bb9b3$export$8f1a69021a3897b2 = v);
18
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-switch", () => $dfcff93ab25bb9b3$export$b82d06d1b520a22f, (v) => $dfcff93ab25bb9b3$export$b82d06d1b520a22f = v);
19
+ var $dfcff93ab25bb9b3$export$f39a09f249340e2a;
20
+ var $dfcff93ab25bb9b3$export$8c4ee2c50c22c514;
21
+ var $dfcff93ab25bb9b3$export$b8813cd5d7824ce7;
22
+ var $dfcff93ab25bb9b3$export$4109102f950813a6;
23
+ var $dfcff93ab25bb9b3$export$24c7f46a6e3605dd;
24
+ var $dfcff93ab25bb9b3$export$2927016961429360;
25
+ var $dfcff93ab25bb9b3$export$89a9162656c0c38c;
26
+ var $dfcff93ab25bb9b3$export$dc5a33fddabf5882;
27
+ var $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4;
28
+ var $dfcff93ab25bb9b3$export$38df7ea4ffef819a;
29
+ var $dfcff93ab25bb9b3$export$8f1a69021a3897b2;
30
+ var $dfcff93ab25bb9b3$export$b82d06d1b520a22f;
31
+ $dfcff93ab25bb9b3$export$f39a09f249340e2a = `XHynUq_focus-ring`;
32
+ $dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = `XHynUq_i18nFontFamily`;
33
+ $dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = `XHynUq_is-hovered`;
34
+ $dfcff93ab25bb9b3$export$4109102f950813a6 = `XHynUq_spectrum-FocusRing-ring`;
35
+ $dfcff93ab25bb9b3$export$24c7f46a6e3605dd = `XHynUq_spectrum-FocusRing ${$dfcff93ab25bb9b3$export$4109102f950813a6}`;
36
+ $dfcff93ab25bb9b3$export$2927016961429360 = `XHynUq_spectrum-FocusRing--quiet`;
37
+ $dfcff93ab25bb9b3$export$89a9162656c0c38c = `XHynUq_spectrum-ToggleSwitch`;
38
+ $dfcff93ab25bb9b3$export$dc5a33fddabf5882 = `XHynUq_spectrum-ToggleSwitch--ab`;
39
+ $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = `XHynUq_spectrum-ToggleSwitch--quiet`;
40
+ $dfcff93ab25bb9b3$export$38df7ea4ffef819a = `XHynUq_spectrum-ToggleSwitch-input`;
41
+ $dfcff93ab25bb9b3$export$8f1a69021a3897b2 = `XHynUq_spectrum-ToggleSwitch-label`;
42
+ $dfcff93ab25bb9b3$export$b82d06d1b520a22f = `XHynUq_spectrum-ToggleSwitch-switch`;
43
+
44
+
45
+ export {$dfcff93ab25bb9b3$exports as default};
46
+ //# sourceMappingURL=toggle_vars_css.module.js.map
@@ -0,0 +1,46 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $dfcff93ab25bb9b3$exports = {};
6
+
7
+ $parcel$export($dfcff93ab25bb9b3$exports, "focus-ring", () => $dfcff93ab25bb9b3$export$f39a09f249340e2a, (v) => $dfcff93ab25bb9b3$export$f39a09f249340e2a = v);
8
+ $parcel$export($dfcff93ab25bb9b3$exports, "i18nFontFamily", () => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514, (v) => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = v);
9
+ $parcel$export($dfcff93ab25bb9b3$exports, "is-hovered", () => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7, (v) => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = v);
10
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing-ring", () => $dfcff93ab25bb9b3$export$4109102f950813a6, (v) => $dfcff93ab25bb9b3$export$4109102f950813a6 = v);
11
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing", () => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd, (v) => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd = v);
12
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing--quiet", () => $dfcff93ab25bb9b3$export$2927016961429360, (v) => $dfcff93ab25bb9b3$export$2927016961429360 = v);
13
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch", () => $dfcff93ab25bb9b3$export$89a9162656c0c38c, (v) => $dfcff93ab25bb9b3$export$89a9162656c0c38c = v);
14
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--ab", () => $dfcff93ab25bb9b3$export$dc5a33fddabf5882, (v) => $dfcff93ab25bb9b3$export$dc5a33fddabf5882 = v);
15
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--quiet", () => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4, (v) => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = v);
16
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-input", () => $dfcff93ab25bb9b3$export$38df7ea4ffef819a, (v) => $dfcff93ab25bb9b3$export$38df7ea4ffef819a = v);
17
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-label", () => $dfcff93ab25bb9b3$export$8f1a69021a3897b2, (v) => $dfcff93ab25bb9b3$export$8f1a69021a3897b2 = v);
18
+ $parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-switch", () => $dfcff93ab25bb9b3$export$b82d06d1b520a22f, (v) => $dfcff93ab25bb9b3$export$b82d06d1b520a22f = v);
19
+ var $dfcff93ab25bb9b3$export$f39a09f249340e2a;
20
+ var $dfcff93ab25bb9b3$export$8c4ee2c50c22c514;
21
+ var $dfcff93ab25bb9b3$export$b8813cd5d7824ce7;
22
+ var $dfcff93ab25bb9b3$export$4109102f950813a6;
23
+ var $dfcff93ab25bb9b3$export$24c7f46a6e3605dd;
24
+ var $dfcff93ab25bb9b3$export$2927016961429360;
25
+ var $dfcff93ab25bb9b3$export$89a9162656c0c38c;
26
+ var $dfcff93ab25bb9b3$export$dc5a33fddabf5882;
27
+ var $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4;
28
+ var $dfcff93ab25bb9b3$export$38df7ea4ffef819a;
29
+ var $dfcff93ab25bb9b3$export$8f1a69021a3897b2;
30
+ var $dfcff93ab25bb9b3$export$b82d06d1b520a22f;
31
+ $dfcff93ab25bb9b3$export$f39a09f249340e2a = `XHynUq_focus-ring`;
32
+ $dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = `XHynUq_i18nFontFamily`;
33
+ $dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = `XHynUq_is-hovered`;
34
+ $dfcff93ab25bb9b3$export$4109102f950813a6 = `XHynUq_spectrum-FocusRing-ring`;
35
+ $dfcff93ab25bb9b3$export$24c7f46a6e3605dd = `XHynUq_spectrum-FocusRing ${$dfcff93ab25bb9b3$export$4109102f950813a6}`;
36
+ $dfcff93ab25bb9b3$export$2927016961429360 = `XHynUq_spectrum-FocusRing--quiet`;
37
+ $dfcff93ab25bb9b3$export$89a9162656c0c38c = `XHynUq_spectrum-ToggleSwitch`;
38
+ $dfcff93ab25bb9b3$export$dc5a33fddabf5882 = `XHynUq_spectrum-ToggleSwitch--ab`;
39
+ $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = `XHynUq_spectrum-ToggleSwitch--quiet`;
40
+ $dfcff93ab25bb9b3$export$38df7ea4ffef819a = `XHynUq_spectrum-ToggleSwitch-input`;
41
+ $dfcff93ab25bb9b3$export$8f1a69021a3897b2 = `XHynUq_spectrum-ToggleSwitch-label`;
42
+ $dfcff93ab25bb9b3$export$b82d06d1b520a22f = `XHynUq_spectrum-ToggleSwitch-switch`;
43
+
44
+
45
+ export {$dfcff93ab25bb9b3$exports as default};
46
+ //# sourceMappingURL=toggle_vars_css.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAXA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,0CAA0C,CAAC;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAAiD,CAAC,mCAAmC,CAAC;AACtF,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAiD,CAAC,mCAAmC,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/toggle/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"toggle_vars_css.module.js.map"}
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { SpectrumSwitchProps } from "@react-types/switch";
3
+ import { FocusableRefValue } from "@react-types/shared";
4
+ /**
5
+ * Switches allow users to turn an individual option on or off.
6
+ * They are usually used to activate or deactivate a specific setting.
7
+ */
8
+ export const Switch: React.ForwardRefExoticComponent<SpectrumSwitchProps & React.RefAttributes<FocusableRefValue<HTMLLabelElement, HTMLLabelElement>>>;
9
+ export type { SpectrumSwitchProps } from '@react-types/switch';
10
+
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AA0EA;;;GAGG;AACH,OAAA,MAAM,yIAA4B,CAAC;AC/DnC,YAAY,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/switch/src/packages/@react-spectrum/switch/src/Switch.tsx","packages/@react-spectrum/switch/src/packages/@react-spectrum/switch/src/index.ts","packages/@react-spectrum/switch/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 */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Switch} from './Switch';\nexport type {SpectrumSwitchProps} from '@react-types/switch';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,447 @@
1
+ .XHynUq_i18nFontFamily {
2
+ font-synthesis: weight;
3
+ font-family: adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
4
+ }
5
+
6
+ .XHynUq_i18nFontFamily:lang(ar) {
7
+ font-family: myriad-arabic, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
8
+ }
9
+
10
+ .XHynUq_i18nFontFamily:lang(he) {
11
+ font-family: myriad-hebrew, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
12
+ }
13
+
14
+ .XHynUq_i18nFontFamily:lang(zh) {
15
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
16
+ }
17
+
18
+ .XHynUq_i18nFontFamily:lang(zh-Hans) {
19
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
20
+ }
21
+
22
+ .XHynUq_i18nFontFamily:lang(zh-Hant) {
23
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
24
+ }
25
+
26
+ .XHynUq_i18nFontFamily:lang(zh-SG), .XHynUq_i18nFontFamily:lang(zh-CN) {
27
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
28
+ }
29
+
30
+ .XHynUq_i18nFontFamily:lang(ko) {
31
+ font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
32
+ }
33
+
34
+ .XHynUq_i18nFontFamily:lang(ja) {
35
+ font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
36
+ }
37
+
38
+ .XHynUq_spectrum-FocusRing-ring {
39
+ --spectrum-focus-ring-border-radius: var(--spectrum-textfield-border-radius, var(--spectrum-alias-border-radius-regular));
40
+ --spectrum-focus-ring-gap: var(--spectrum-alias-input-focusring-gap);
41
+ --spectrum-focus-ring-size: var(--spectrum-alias-input-focusring-size);
42
+ --spectrum-focus-ring-border-size: 0px;
43
+ --spectrum-focus-ring-color: var(--spectrum-high-contrast-focus-ring-color, var(--spectrum-alias-focus-ring-color, var(--spectrum-alias-focus-color)));
44
+ }
45
+
46
+ .XHynUq_spectrum-FocusRing-ring:after {
47
+ border-radius: calc(var(--spectrum-focus-ring-border-radius) + var(--spectrum-focus-ring-gap));
48
+ content: "";
49
+ margin: calc(-1 * var(--spectrum-focus-ring-border-size));
50
+ pointer-events: none;
51
+ transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out, margin var(--spectrum-global-animation-duration-100, .13s) ease-out;
52
+ display: block;
53
+ position: absolute;
54
+ inset: 0;
55
+ }
56
+
57
+ .XHynUq_spectrum-FocusRing.XHynUq_focus-ring:after {
58
+ margin: calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size));
59
+ box-shadow: 0 0 0 var(--spectrum-focus-ring-size) var(--spectrum-focus-ring-color);
60
+ }
61
+
62
+ .XHynUq_spectrum-FocusRing--quiet:after {
63
+ border-radius: 0;
64
+ }
65
+
66
+ .XHynUq_spectrum-FocusRing--quiet.XHynUq_focus-ring:after {
67
+ margin: 0 0 calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size)) 0;
68
+ box-shadow: 0 var(--spectrum-focus-ring-size) 0 var(--spectrum-focus-ring-color);
69
+ }
70
+
71
+ @media (forced-colors: active) {
72
+ .XHynUq_spectrum-FocusRing, .XHynUq_spectrum-FocusRing-ring, .XHynUq_spectrum-FocusRing--quiet {
73
+ --spectrum-high-contrast-focus-ring-color: Highlight;
74
+ }
75
+
76
+ :is(.XHynUq_spectrum-FocusRing, .XHynUq_spectrum-FocusRing-ring, .XHynUq_spectrum-FocusRing--quiet):after {
77
+ forced-color-adjust: none;
78
+ }
79
+ }
80
+
81
+ .XHynUq_spectrum-ToggleSwitch {
82
+ min-block-size: var(--spectrum-switch-height, var(--spectrum-global-dimension-size-400));
83
+ vertical-align: top;
84
+ isolation: isolate;
85
+ align-items: flex-start;
86
+ max-inline-size: 100%;
87
+ margin-inline-end: calc(var(--spectrum-switch-cursor-hit-x, var(--spectrum-global-dimension-size-100)) * 2);
88
+ display: inline-flex;
89
+ position: relative;
90
+ }
91
+
92
+ .XHynUq_spectrum-ToggleSwitch-input {
93
+ box-sizing: border-box;
94
+ opacity: .0001;
95
+ z-index: 1;
96
+ cursor: default;
97
+ block-size: 100%;
98
+ inline-size: 100%;
99
+ margin: 0;
100
+ padding: 0;
101
+ position: absolute;
102
+ top: 0;
103
+ }
104
+
105
+ .XHynUq_spectrum-ToggleSwitch-input:not(:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))) {
106
+ left: 0;
107
+ }
108
+
109
+ .XHynUq_spectrum-ToggleSwitch-input:not(:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))) {
110
+ left: 0;
111
+ }
112
+
113
+ .XHynUq_spectrum-ToggleSwitch-input:-webkit-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)) {
114
+ right: 0;
115
+ }
116
+
117
+ .XHynUq_spectrum-ToggleSwitch-input:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)) {
118
+ right: 0;
119
+ }
120
+
121
+ [dir="ltr"] :is(.XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch):before {
122
+ transform: translateX(calc(var(--spectrum-switch-track-width) - 100%));
123
+ }
124
+
125
+ [dir="rtl"] :is(.XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch):before {
126
+ transform: translateX(calc(100% - var(--spectrum-switch-track-width)));
127
+ }
128
+
129
+ .XHynUq_spectrum-ToggleSwitch-input:disabled, .XHynUq_spectrum-ToggleSwitch-input[disabled] {
130
+ cursor: default;
131
+ }
132
+
133
+ .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring + .XHynUq_spectrum-ToggleSwitch-switch:after {
134
+ margin: calc(var(--spectrum-alias-focus-ring-gap, var(--spectrum-global-dimension-static-size-25)) * -1);
135
+ }
136
+
137
+ .XHynUq_spectrum-ToggleSwitch-label {
138
+ text-align: start;
139
+ margin: 0 var(--spectrum-switch-text-gap, var(--spectrum-global-dimension-size-125));
140
+ font-size: var(--spectrum-switch-text-size, var(--spectrum-alias-font-size-default));
141
+ transition: color var(--spectrum-global-animation-duration-200, .16s) ease-in-out;
142
+ margin-block-start: var(--spectrum-global-dimension-size-65);
143
+ line-height: 1.49;
144
+ }
145
+
146
+ .XHynUq_spectrum-ToggleSwitch-switch {
147
+ box-sizing: border-box;
148
+ inline-size: var(--spectrum-switch-track-width);
149
+ margin: calc((var(--spectrum-switch-height, var(--spectrum-global-dimension-size-400)) - var(--spectrum-switch-track-height, var(--spectrum-global-dimension-size-175))) / 2) 0;
150
+ vertical-align: middle;
151
+ will-change: transform;
152
+ transition: background var(--spectrum-global-animation-duration-100, .13s) ease-in-out, border var(--spectrum-global-animation-duration-100, .13s) ease-in-out;
153
+ block-size: var(--spectrum-switch-track-height, var(--spectrum-global-dimension-size-175));
154
+ border-radius: calc(var(--spectrum-switch-track-height, var(--spectrum-global-dimension-size-175)) / 2);
155
+ flex-grow: 0;
156
+ flex-shrink: 0;
157
+ display: inline-block;
158
+ position: relative;
159
+ left: 0;
160
+ right: 0;
161
+ }
162
+
163
+ .XHynUq_spectrum-ToggleSwitch-switch:before {
164
+ content: "";
165
+ box-sizing: border-box;
166
+ transition: background var(--spectrum-global-animation-duration-100, .13s) ease-in-out, border var(--spectrum-global-animation-duration-100, .13s) ease-in-out, transform var(--spectrum-global-animation-duration-100, .13s) ease-in-out, box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-in-out;
167
+ inline-size: var(--spectrum-switch-handle-size, var(--spectrum-global-dimension-size-175));
168
+ block-size: var(--spectrum-switch-handle-size, var(--spectrum-global-dimension-size-175));
169
+ border-width: var(--spectrum-switch-handle-border-size, var(--spectrum-alias-border-size-thick));
170
+ border-radius: calc(var(--spectrum-switch-handle-size, var(--spectrum-global-dimension-size-175)) / 2);
171
+ border-style: solid;
172
+ display: block;
173
+ position: absolute;
174
+ top: 0;
175
+ }
176
+
177
+ .XHynUq_spectrum-ToggleSwitch-switch:not(:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))):before {
178
+ left: 0;
179
+ }
180
+
181
+ .XHynUq_spectrum-ToggleSwitch-switch:not(:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))):before {
182
+ left: 0;
183
+ }
184
+
185
+ .XHynUq_spectrum-ToggleSwitch-switch:-webkit-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)):before {
186
+ right: 0;
187
+ }
188
+
189
+ .XHynUq_spectrum-ToggleSwitch-switch:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)):before {
190
+ right: 0;
191
+ }
192
+
193
+ .XHynUq_spectrum-ToggleSwitch-switch:after {
194
+ border-radius: calc(calc(var(--spectrum-switch-track-height, var(--spectrum-global-dimension-size-175)) / 2) + var(--spectrum-alias-focus-ring-gap, var(--spectrum-global-dimension-static-size-25)) * 2);
195
+ content: "";
196
+ transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out, margin var(--spectrum-global-animation-duration-100, .13s) ease-out;
197
+ margin: 0;
198
+ display: block;
199
+ position: absolute;
200
+ inset: 0;
201
+ transform: translateX(0);
202
+ }
203
+
204
+ .XHynUq_spectrum-ToggleSwitch {
205
+ --spectrum-switch-emphasized-handle-border-color: var(--spectrum-alias-toggle-color-default);
206
+ --spectrum-switch-emphasized-handle-border-color-hover: var(--spectrum-alias-toggle-color-hover);
207
+ --spectrum-switch-emphasized-handle-border-color-key-focus: var(--spectrum-alias-toggle-color-key-focus);
208
+ --spectrum-switch-quiet-track-color-selected: var(--spectrum-alias-toggle-color-selected);
209
+ --spectrum-switch-quiet-track-color-selected-hover: var(--spectrum-alias-toggle-color-selected-hover);
210
+ --spectrum-switch-quiet-track-color-selected-key-focus: var(--spectrum-alias-toggle-color-selected-key-focus);
211
+ --spectrum-switch-quiet-handle-border-color-selected: var(--spectrum-alias-toggle-color-selected);
212
+ --spectrum-switch-quiet-handle-border-color-selected-hover: var(--spectrum-alias-toggle-color-selected-hover);
213
+ --spectrum-switch-quiet-handle-border-color-selected-key-focus: var(--spectrum-alias-toggle-color-selected-key-focus);
214
+ --spectrum-switch-emphasized-track-color-selected: var(--spectrum-accent-color-900);
215
+ --spectrum-switch-emphasized-handle-border-color-selected: var(--spectrum-accent-color-900);
216
+ --spectrum-switch-emphasized-track-color-selected-hover: var(--spectrum-accent-color-1000);
217
+ --spectrum-switch-emphasized-handle-border-color-selected-hover: var(--spectrum-accent-color-1000);
218
+ --spectrum-switch-emphasized-track-color-selected-key-focus: var(--spectrum-accent-color-1000);
219
+ --spectrum-switch-emphasized-handle-border-color-selected-key-focus: var(--spectrum-accent-color-1000);
220
+ --spectrum-switch-emphasized-track-color-selected-down: var(--spectrum-accent-color-1100);
221
+ --spectrum-switch-emphasized-handle-border-color-selected-down: var(--spectrum-accent-color-1100);
222
+ }
223
+
224
+ .XHynUq_spectrum-ToggleSwitch-switch {
225
+ background-color: var(--spectrum-switch-emphasized-track-color, var(--spectrum-global-color-gray-300));
226
+ }
227
+
228
+ .XHynUq_spectrum-ToggleSwitch-switch:before {
229
+ background-color: var(--spectrum-switch-emphasized-handle-background-color, var(--spectrum-global-color-gray-75));
230
+ border-color: var(--spectrum-switch-emphasized-handle-border-color, var(--spectrum-global-color-gray-600));
231
+ }
232
+
233
+ .XHynUq_spectrum-ToggleSwitch-input ~ .XHynUq_spectrum-ToggleSwitch-label {
234
+ color: var(--spectrum-switch-emphasized-text-color, var(--spectrum-alias-text-color));
235
+ }
236
+
237
+ .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch {
238
+ background-color: var(--spectrum-switch-emphasized-track-color-selected, var(--spectrum-global-color-blue-500));
239
+ }
240
+
241
+ .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
242
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-selected, var(--spectrum-global-color-blue-500));
243
+ }
244
+
245
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input + .XHynUq_spectrum-ToggleSwitch-switch:before {
246
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-hover, var(--spectrum-global-color-gray-700));
247
+ box-shadow: none;
248
+ }
249
+
250
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input ~ .XHynUq_spectrum-ToggleSwitch-label {
251
+ color: var(--spectrum-switch-emphasized-text-color-hover, var(--spectrum-alias-text-color-hover));
252
+ }
253
+
254
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
255
+ background-color: var(--spectrum-switch-emphasized-track-color-selected-hover, var(--spectrum-global-color-blue-600));
256
+ }
257
+
258
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
259
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-selected-hover, var(--spectrum-global-color-blue-600));
260
+ }
261
+
262
+ .XHynUq_spectrum-ToggleSwitch:active .XHynUq_spectrum-ToggleSwitch-input + .XHynUq_spectrum-ToggleSwitch-switch:before {
263
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-down, var(--spectrum-global-color-gray-800));
264
+ }
265
+
266
+ .XHynUq_spectrum-ToggleSwitch:active .XHynUq_spectrum-ToggleSwitch-input ~ .XHynUq_spectrum-ToggleSwitch-label {
267
+ color: var(--spectrum-switch-emphasized-text-color-down, var(--spectrum-alias-text-color-down));
268
+ }
269
+
270
+ .XHynUq_spectrum-ToggleSwitch:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
271
+ background-color: var(--spectrum-switch-emphasized-track-color-selected-down, var(--spectrum-global-color-blue-700));
272
+ }
273
+
274
+ .XHynUq_spectrum-ToggleSwitch:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
275
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-selected-down, var(--spectrum-global-color-blue-700));
276
+ }
277
+
278
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled + .XHynUq_spectrum-ToggleSwitch-switch {
279
+ background-color: var(--spectrum-switch-emphasized-track-color-disabled, var(--spectrum-global-color-gray-300));
280
+ }
281
+
282
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
283
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-disabled, var(--spectrum-global-color-gray-400));
284
+ }
285
+
286
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled ~ .XHynUq_spectrum-ToggleSwitch-label {
287
+ color: var(--spectrum-switch-emphasized-text-color-disabled, var(--spectrum-alias-text-color-disabled));
288
+ }
289
+
290
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled:checked + .XHynUq_spectrum-ToggleSwitch-switch {
291
+ background-color: var(--spectrum-switch-emphasized-track-color-selected-disabled, var(--spectrum-global-color-gray-400));
292
+ }
293
+
294
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
295
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-selected-disabled, var(--spectrum-global-color-gray-400));
296
+ }
297
+
298
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled:checked ~ .XHynUq_spectrum-ToggleSwitch-label {
299
+ color: var(--spectrum-switch-emphasized-text-color-selected-disabled, var(--spectrum-alias-text-color-disabled));
300
+ }
301
+
302
+ .XHynUq_spectrum-ToggleSwitch--quiet .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch {
303
+ background-color: var(--spectrum-switch-quiet-track-color-selected, var(--spectrum-global-color-gray-700));
304
+ }
305
+
306
+ .XHynUq_spectrum-ToggleSwitch--quiet .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
307
+ border-color: var(--spectrum-switch-quiet-handle-border-color-selected, var(--spectrum-global-color-gray-700));
308
+ }
309
+
310
+ .XHynUq_spectrum-ToggleSwitch--quiet.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
311
+ background-color: var(--spectrum-switch-quiet-track-color-selected-hover, var(--spectrum-global-color-gray-800));
312
+ }
313
+
314
+ .XHynUq_spectrum-ToggleSwitch--quiet.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
315
+ border-color: var(--spectrum-switch-quiet-handle-border-color-selected-hover, var(--spectrum-global-color-gray-800));
316
+ }
317
+
318
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_spectrum-ToggleSwitch--quiet:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
319
+ background-color: var(--spectrum-switch-quiet-track-color-selected-down, var(--spectrum-global-color-gray-900));
320
+ }
321
+
322
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_spectrum-ToggleSwitch--quiet:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
323
+ border-color: var(--spectrum-switch-quiet-handle-border-color-selected-down, var(--spectrum-global-color-gray-900));
324
+ }
325
+
326
+ :is(.XHynUq_spectrum-ToggleSwitch, .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring + .XHynUq_spectrum-ToggleSwitch-switch:after {
327
+ box-shadow: 0 0 0 var(--spectrum-switch-focus-ring-size-key-focus, var(--spectrum-alias-focus-ring-size)) var(--spectrum-switch-focus-ring-color-key-focus, var(--spectrum-alias-focus-ring-color));
328
+ }
329
+
330
+ :is(.XHynUq_spectrum-ToggleSwitch, .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring + .XHynUq_spectrum-ToggleSwitch-switch:before {
331
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-key-focus, var(--spectrum-global-color-gray-700));
332
+ }
333
+
334
+ :is(.XHynUq_spectrum-ToggleSwitch, .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch {
335
+ background-color: var(--spectrum-switch-emphasized-track-color-selected-key-focus, var(--spectrum-global-color-blue-600));
336
+ }
337
+
338
+ :is(.XHynUq_spectrum-ToggleSwitch, .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
339
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-selected-key-focus, var(--spectrum-global-color-blue-600));
340
+ }
341
+
342
+ :is(.XHynUq_spectrum-ToggleSwitch--quiet, .XHynUq_spectrum-ToggleSwitch--quiet.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch {
343
+ background-color: var(--spectrum-switch-quiet-track-color-selected-key-focus, var(--spectrum-global-color-gray-800));
344
+ }
345
+
346
+ :is(.XHynUq_spectrum-ToggleSwitch--quiet, .XHynUq_spectrum-ToggleSwitch--quiet.XHynUq_is-hovered) .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
347
+ border-color: var(--spectrum-switch-quiet-handle-border-color-selected-key-focus, var(--spectrum-global-color-gray-800));
348
+ }
349
+
350
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch {
351
+ background-color: var(--spectrum-switch-track-color, var(--spectrum-global-color-gray-300));
352
+ }
353
+
354
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
355
+ border-color: var(--spectrum-switch-handle-border-color, var(--spectrum-global-color-gray-600));
356
+ }
357
+
358
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch {
359
+ background-color: var(--spectrum-switch-track-color, var(--spectrum-global-color-gray-300));
360
+ }
361
+
362
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input.XHynUq_focus-ring:checked + .XHynUq_spectrum-ToggleSwitch-switch:before {
363
+ border-color: var(--spectrum-switch-handle-border-color-selected, var(--spectrum-global-color-gray-700));
364
+ }
365
+
366
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input:disabled:checked + .XHynUq_spectrum-ToggleSwitch-switch, .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input:disabled + .XHynUq_spectrum-ToggleSwitch-switch {
367
+ background-color: var(--spectrum-switch-emphasized-track-color-disabled, var(--spectrum-global-color-gray-300));
368
+ }
369
+
370
+ .XHynUq_spectrum-ToggleSwitch--ab .XHynUq_spectrum-ToggleSwitch-input:disabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
371
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-disabled, var(--spectrum-global-color-gray-400));
372
+ }
373
+
374
+ .XHynUq_spectrum-ToggleSwitch--ab.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
375
+ background-color: var(--spectrum-switch-emphasized-track-color, var(--spectrum-global-color-gray-300));
376
+ }
377
+
378
+ .XHynUq_spectrum-ToggleSwitch--ab.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
379
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-hover, var(--spectrum-global-color-gray-700));
380
+ }
381
+
382
+ .XHynUq_spectrum-ToggleSwitch--ab:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch {
383
+ background-color: var(--spectrum-switch-emphasized-track-color, var(--spectrum-global-color-gray-300));
384
+ }
385
+
386
+ .XHynUq_spectrum-ToggleSwitch--ab:active .XHynUq_spectrum-ToggleSwitch-input:checked:enabled + .XHynUq_spectrum-ToggleSwitch-switch:before {
387
+ border-color: var(--spectrum-switch-emphasized-handle-border-color-down, var(--spectrum-global-color-gray-800));
388
+ }
389
+
390
+ @media (forced-colors: active) {
391
+ .XHynUq_spectrum-ToggleSwitch {
392
+ forced-color-adjust: none;
393
+ --spectrum-switch-emphasized-handle-background-color: ButtonFace;
394
+ --spectrum-switch-emphasized-handle-border-color: ButtonText;
395
+ --spectrum-switch-emphasized-handle-border-color-disabled: GrayText;
396
+ --spectrum-switch-emphasized-handle-border-color-down: Highlight;
397
+ --spectrum-switch-emphasized-handle-border-color-hover: Highlight;
398
+ --spectrum-switch-emphasized-handle-border-color-key-focus: Highlight;
399
+ --spectrum-switch-emphasized-handle-border-color-selected: Highlight;
400
+ --spectrum-switch-emphasized-handle-border-color-selected-disabled: GrayText;
401
+ --spectrum-switch-emphasized-handle-border-color-selected-down: Highlight;
402
+ --spectrum-switch-emphasized-handle-border-color-selected-hover: Highlight;
403
+ --spectrum-switch-emphasized-handle-border-color-selected-key-focus: Highlight;
404
+ --spectrum-switch-emphasized-text-color: CanvasText;
405
+ --spectrum-switch-emphasized-text-color-disabled: GrayText;
406
+ --spectrum-switch-emphasized-text-color-down: CanvasText;
407
+ --spectrum-switch-emphasized-text-color-hover: CanvasText;
408
+ --spectrum-switch-emphasized-text-color-selected-disabled: GrayText;
409
+ --spectrum-switch-emphasized-track-color: ButtonFace;
410
+ --spectrum-switch-emphasized-track-color-disabled: ButtonFace;
411
+ --spectrum-switch-emphasized-track-color-selected: Highlight;
412
+ --spectrum-switch-emphasized-track-color-selected-disabled: GrayText;
413
+ --spectrum-switch-emphasized-track-color-selected-down: Highlight;
414
+ --spectrum-switch-emphasized-track-color-selected-hover: Highlight;
415
+ --spectrum-switch-emphasized-track-color-selected-key-focus: Highlight;
416
+ --spectrum-switch-focus-ring-color-key-focus: ButtonText;
417
+ --spectrum-switch-handle-border-color: ButtonText;
418
+ --spectrum-switch-handle-border-color-selected: Highlight;
419
+ --spectrum-switch-quiet-handle-border-color-selected: Highlight;
420
+ --spectrum-switch-quiet-handle-border-color-selected-down: Highlight;
421
+ --spectrum-switch-quiet-handle-border-color-selected-hover: Highlight;
422
+ --spectrum-switch-quiet-handle-border-color-selected-key-focus: Highlight;
423
+ --spectrum-switch-quiet-track-color-selected: Highlight;
424
+ --spectrum-switch-quiet-track-color-selected-down: Highlight;
425
+ --spectrum-switch-quiet-track-color-selected-hover: Highlight;
426
+ --spectrum-switch-quiet-track-color-selected-key-focus: Highlight;
427
+ --spectrum-switch-track-color: ButtonFace;
428
+ --spectrum-switch-track-color-disabled: ButtonFace;
429
+ }
430
+
431
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:not(:checked) + .XHynUq_spectrum-ToggleSwitch-switch {
432
+ box-shadow: inset 0 0 0 1px var(--spectrum-switch-handle-border-color, var(--spectrum-global-color-gray-600));
433
+ }
434
+
435
+ .XHynUq_spectrum-ToggleSwitch.XHynUq_is-hovered .XHynUq_spectrum-ToggleSwitch-input:not(:checked) + .XHynUq_spectrum-ToggleSwitch-switch {
436
+ box-shadow: inset 0 0 0 1px var(--spectrum-switch-emphasized-handle-border-color-hover, var(--spectrum-global-color-gray-700));
437
+ }
438
+
439
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:not(:checked):focus + .XHynUq_spectrum-ToggleSwitch-switch {
440
+ box-shadow: inset 0 0 0 1px var(--spectrum-switch-emphasized-handle-border-color-key-focus, var(--spectrum-global-color-gray-700));
441
+ }
442
+
443
+ .XHynUq_spectrum-ToggleSwitch .XHynUq_spectrum-ToggleSwitch-input:disabled + .XHynUq_spectrum-ToggleSwitch-switch {
444
+ box-shadow: inset 0 0 0 1px var(--spectrum-switch-emphasized-handle-border-color-disabled, var(--spectrum-global-color-gray-400));
445
+ }
446
+ }
447
+ /*# sourceMappingURL=vars.f7257b6a.css.map */
@@ -0,0 +1 @@
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;;;AAgBA;;;;;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAqBI;;;;AAGA;;;;AAKF;;;;AAOI;;;;AAON;;;;;;;;;AASA;;;;;;;;;;;;;;;;;AA6BE;;;;;;;;;;;;;;AAQA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAeA;;;;;;;;;;;AA6BF;;;;;;;;;;;;;;;;;;;;AAuBA;;;;AAIE;;;;;AAMF;;;;AAOE;;;;AAEE;;;;AAWE;;;;;AAKF;;;;AAIA;;;;AAEE;;;;AAYA;;;;AAIF;;;;AAIA;;;;AAEE;;;;AAUJ;;;;AAEE;;;;AAIF;;;;AAKE;;;;AAEE;;;;AAIF;;;;AAWF;;;;AAEE;;;;AASF;;;;AAEE;;;;AASF;;;;AAEE;;;;AAYE;;;;AAGA;;;;AAMA;;;;AAEE;;;;AAaF;;;;AAEE;;;;AAUJ;;;;AAKE;;;;AAOA;;;;AAGE;;;;AAOF;;;;AAOE;;;;AASF;;;;AAEE;;;;AASF;;;;AAEE;;;;AAQR;EACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCE;;;;EAIE;;;;EAIF;;;;EAIA","sources":["packages/@adobe/spectrum-css-temp/components/toggle/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.f7257b6a.css.map"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@react-spectrum/switch",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
13
+ "types": "dist/types.d.ts",
14
+ "source": "src/index.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "targets": {
23
+ "main": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ },
28
+ "module": {
29
+ "includeNodeModules": [
30
+ "@adobe/spectrum-css-temp"
31
+ ]
32
+ }
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/adobe/react-spectrum"
37
+ },
38
+ "dependencies": {
39
+ "@react-aria/focus": "^3.0.0-nightly-641446f65-240905",
40
+ "@react-aria/interactions": "^3.0.0-nightly-641446f65-240905",
41
+ "@react-aria/switch": "^3.0.0-nightly-641446f65-240905",
42
+ "@react-spectrum/utils": "^3.0.0-nightly-641446f65-240905",
43
+ "@react-stately/toggle": "^3.0.0-nightly-641446f65-240905",
44
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905",
45
+ "@react-types/switch": "^3.0.0-nightly-641446f65-240905",
46
+ "@swc/helpers": "^0.5.0"
47
+ },
48
+ "devDependencies": {
49
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
50
+ },
51
+ "peerDependencies": {
52
+ "@react-spectrum/provider": "^3.0.0-nightly-641446f65-240905",
53
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "stableVersion": "3.5.7"
59
+ }
package/src/Switch.tsx ADDED
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';
14
+ import {FocusableRef} from '@react-types/shared';
15
+ import {FocusRing} from '@react-aria/focus';
16
+ import React, {forwardRef, useRef} from 'react';
17
+ import {SpectrumSwitchProps} from '@react-types/switch';
18
+ import styles from '@adobe/spectrum-css-temp/components/toggle/vars.css';
19
+ import {useHover} from '@react-aria/interactions';
20
+ import {useProviderProps} from '@react-spectrum/provider';
21
+ import {useSwitch} from '@react-aria/switch';
22
+ import {useToggleState} from '@react-stately/toggle';
23
+
24
+ function Switch(props: SpectrumSwitchProps, ref: FocusableRef<HTMLLabelElement>) {
25
+ props = useProviderProps(props);
26
+ let {
27
+ isEmphasized = false,
28
+ isDisabled = false,
29
+ autoFocus,
30
+ children,
31
+ ...otherProps
32
+ } = props;
33
+ let {styleProps} = useStyleProps(otherProps);
34
+ let {hoverProps, isHovered} = useHover({isDisabled});
35
+
36
+ let inputRef = useRef<HTMLInputElement>(null);
37
+ let domRef = useFocusableRef(ref, inputRef);
38
+ let state = useToggleState(props);
39
+ let {inputProps} = useSwitch(props, state, inputRef);
40
+
41
+
42
+ return (
43
+ <label
44
+ {...styleProps}
45
+ {...hoverProps}
46
+ ref={domRef}
47
+ className={
48
+ classNames(
49
+ styles,
50
+ 'spectrum-ToggleSwitch',
51
+ {
52
+ 'spectrum-ToggleSwitch--quiet': !isEmphasized,
53
+ 'is-disabled': isDisabled,
54
+ 'is-hovered': isHovered
55
+ },
56
+ styleProps.className
57
+ )
58
+ }>
59
+ <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>
60
+ <input
61
+ {...inputProps}
62
+ ref={inputRef}
63
+ className={classNames(styles, 'spectrum-ToggleSwitch-input')} />
64
+ </FocusRing>
65
+ <span className={classNames(styles, 'spectrum-ToggleSwitch-switch')} />
66
+ {children && (
67
+ <span className={classNames(styles, 'spectrum-ToggleSwitch-label')}>
68
+ {children}
69
+ </span>
70
+ )}
71
+ </label>
72
+ );
73
+ }
74
+
75
+ /**
76
+ * Switches allow users to turn an individual option on or off.
77
+ * They are usually used to activate or deactivate a specific setting.
78
+ */
79
+ const _Switch = forwardRef(Switch);
80
+ export {_Switch as Switch};
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ /// <reference types="css-module-types" />
14
+
15
+ export {Switch} from './Switch';
16
+ export type {SpectrumSwitchProps} from '@react-types/switch';