@react-spectrum/switch 3.5.2 → 3.5.4
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/Switch.main.js +78 -0
- package/dist/Switch.main.js.map +1 -0
- package/dist/Switch.mjs +73 -0
- package/dist/Switch.module.js +73 -0
- package/dist/Switch.module.js.map +1 -0
- package/dist/import.mjs +1 -111
- package/dist/main.js +2 -108
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -111
- package/dist/module.js.map +1 -1
- package/dist/toggle_vars_css.main.js +44 -0
- package/dist/toggle_vars_css.main.js.map +1 -0
- package/dist/toggle_vars_css.mjs +46 -0
- package/dist/toggle_vars_css.module.js +46 -0
- package/dist/toggle_vars_css.module.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/vars.f7257b6a.css +447 -0
- package/dist/vars.f7257b6a.css.map +1 -0
- package/package.json +9 -9
- package/dist/main.css +0 -1
|
@@ -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"}
|
package/dist/Switch.mjs
ADDED
|
@@ -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.mjs.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"}
|
package/dist/import.mjs
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {useStyleProps as $8Tpjb$useStyleProps, useFocusableRef as $8Tpjb$useFocusableRef, classNames as $8Tpjb$classNames} from "@react-spectrum/utils";
|
|
3
|
-
import {FocusRing as $8Tpjb$FocusRing} from "@react-aria/focus";
|
|
4
|
-
import $8Tpjb$react, {useRef as $8Tpjb$useRef, forwardRef as $8Tpjb$forwardRef} from "react";
|
|
5
|
-
import {useHover as $8Tpjb$useHover} from "@react-aria/interactions";
|
|
6
|
-
import {useProviderProps as $8Tpjb$useProviderProps} from "@react-spectrum/provider";
|
|
7
|
-
import {useSwitch as $8Tpjb$useSwitch} from "@react-aria/switch";
|
|
8
|
-
import {useToggleState as $8Tpjb$useToggleState} from "@react-stately/toggle";
|
|
1
|
+
import {Switch as $8341c396cee1c5fc$export$b5d5cf8927ab7262} from "./Switch.mjs";
|
|
9
2
|
|
|
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
3
|
/*
|
|
19
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
20
5
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -26,101 +11,6 @@ function $parcel$export(e, n, v, s) {
|
|
|
26
11
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
27
12
|
* governing permissions and limitations under the License.
|
|
28
13
|
*/ /// <reference types="css-module-types" />
|
|
29
|
-
/*
|
|
30
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
31
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
32
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
33
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
34
|
-
*
|
|
35
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
36
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
37
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
38
|
-
* governing permissions and limitations under the License.
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var $dfcff93ab25bb9b3$exports = {};
|
|
43
|
-
|
|
44
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "focus-ring", () => $dfcff93ab25bb9b3$export$f39a09f249340e2a, (v) => $dfcff93ab25bb9b3$export$f39a09f249340e2a = v);
|
|
45
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "i18nFontFamily", () => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514, (v) => $dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = v);
|
|
46
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "is-hovered", () => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7, (v) => $dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = v);
|
|
47
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing-ring", () => $dfcff93ab25bb9b3$export$4109102f950813a6, (v) => $dfcff93ab25bb9b3$export$4109102f950813a6 = v);
|
|
48
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing", () => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd, (v) => $dfcff93ab25bb9b3$export$24c7f46a6e3605dd = v);
|
|
49
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-FocusRing--quiet", () => $dfcff93ab25bb9b3$export$2927016961429360, (v) => $dfcff93ab25bb9b3$export$2927016961429360 = v);
|
|
50
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch", () => $dfcff93ab25bb9b3$export$89a9162656c0c38c, (v) => $dfcff93ab25bb9b3$export$89a9162656c0c38c = v);
|
|
51
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--ab", () => $dfcff93ab25bb9b3$export$dc5a33fddabf5882, (v) => $dfcff93ab25bb9b3$export$dc5a33fddabf5882 = v);
|
|
52
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch--quiet", () => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4, (v) => $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = v);
|
|
53
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-input", () => $dfcff93ab25bb9b3$export$38df7ea4ffef819a, (v) => $dfcff93ab25bb9b3$export$38df7ea4ffef819a = v);
|
|
54
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-label", () => $dfcff93ab25bb9b3$export$8f1a69021a3897b2, (v) => $dfcff93ab25bb9b3$export$8f1a69021a3897b2 = v);
|
|
55
|
-
$parcel$export($dfcff93ab25bb9b3$exports, "spectrum-ToggleSwitch-switch", () => $dfcff93ab25bb9b3$export$b82d06d1b520a22f, (v) => $dfcff93ab25bb9b3$export$b82d06d1b520a22f = v);
|
|
56
|
-
var $dfcff93ab25bb9b3$export$f39a09f249340e2a;
|
|
57
|
-
var $dfcff93ab25bb9b3$export$8c4ee2c50c22c514;
|
|
58
|
-
var $dfcff93ab25bb9b3$export$b8813cd5d7824ce7;
|
|
59
|
-
var $dfcff93ab25bb9b3$export$4109102f950813a6;
|
|
60
|
-
var $dfcff93ab25bb9b3$export$24c7f46a6e3605dd;
|
|
61
|
-
var $dfcff93ab25bb9b3$export$2927016961429360;
|
|
62
|
-
var $dfcff93ab25bb9b3$export$89a9162656c0c38c;
|
|
63
|
-
var $dfcff93ab25bb9b3$export$dc5a33fddabf5882;
|
|
64
|
-
var $dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4;
|
|
65
|
-
var $dfcff93ab25bb9b3$export$38df7ea4ffef819a;
|
|
66
|
-
var $dfcff93ab25bb9b3$export$8f1a69021a3897b2;
|
|
67
|
-
var $dfcff93ab25bb9b3$export$b82d06d1b520a22f;
|
|
68
|
-
$dfcff93ab25bb9b3$export$f39a09f249340e2a = `XHynUq_focus-ring`;
|
|
69
|
-
$dfcff93ab25bb9b3$export$8c4ee2c50c22c514 = `XHynUq_i18nFontFamily`;
|
|
70
|
-
$dfcff93ab25bb9b3$export$b8813cd5d7824ce7 = `XHynUq_is-hovered`;
|
|
71
|
-
$dfcff93ab25bb9b3$export$4109102f950813a6 = `XHynUq_spectrum-FocusRing-ring`;
|
|
72
|
-
$dfcff93ab25bb9b3$export$24c7f46a6e3605dd = `XHynUq_spectrum-FocusRing ${$dfcff93ab25bb9b3$export$4109102f950813a6}`;
|
|
73
|
-
$dfcff93ab25bb9b3$export$2927016961429360 = `XHynUq_spectrum-FocusRing--quiet`;
|
|
74
|
-
$dfcff93ab25bb9b3$export$89a9162656c0c38c = `XHynUq_spectrum-ToggleSwitch`;
|
|
75
|
-
$dfcff93ab25bb9b3$export$dc5a33fddabf5882 = `XHynUq_spectrum-ToggleSwitch--ab`;
|
|
76
|
-
$dfcff93ab25bb9b3$export$ce1b1dcfc10f3df4 = `XHynUq_spectrum-ToggleSwitch--quiet`;
|
|
77
|
-
$dfcff93ab25bb9b3$export$38df7ea4ffef819a = `XHynUq_spectrum-ToggleSwitch-input`;
|
|
78
|
-
$dfcff93ab25bb9b3$export$8f1a69021a3897b2 = `XHynUq_spectrum-ToggleSwitch-label`;
|
|
79
|
-
$dfcff93ab25bb9b3$export$b82d06d1b520a22f = `XHynUq_spectrum-ToggleSwitch-switch`;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function $8341c396cee1c5fc$var$Switch(props, ref) {
|
|
87
|
-
props = (0, $8Tpjb$useProviderProps)(props);
|
|
88
|
-
let { isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
89
|
-
let { styleProps: styleProps } = (0, $8Tpjb$useStyleProps)(otherProps);
|
|
90
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8Tpjb$useHover)({
|
|
91
|
-
isDisabled: isDisabled
|
|
92
|
-
});
|
|
93
|
-
let inputRef = (0, $8Tpjb$useRef)(null);
|
|
94
|
-
let domRef = (0, $8Tpjb$useFocusableRef)(ref, inputRef);
|
|
95
|
-
let state = (0, $8Tpjb$useToggleState)(props);
|
|
96
|
-
let { inputProps: inputProps } = (0, $8Tpjb$useSwitch)(props, state, inputRef);
|
|
97
|
-
return /*#__PURE__*/ (0, $8Tpjb$react).createElement("label", {
|
|
98
|
-
...styleProps,
|
|
99
|
-
...hoverProps,
|
|
100
|
-
ref: domRef,
|
|
101
|
-
className: (0, $8Tpjb$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($dfcff93ab25bb9b3$exports))), "spectrum-ToggleSwitch", {
|
|
102
|
-
"spectrum-ToggleSwitch--quiet": !isEmphasized,
|
|
103
|
-
"is-disabled": isDisabled,
|
|
104
|
-
"is-hovered": isHovered
|
|
105
|
-
}, styleProps.className)
|
|
106
|
-
}, /*#__PURE__*/ (0, $8Tpjb$react).createElement((0, $8Tpjb$FocusRing), {
|
|
107
|
-
focusRingClass: (0, $8Tpjb$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($dfcff93ab25bb9b3$exports))), "focus-ring"),
|
|
108
|
-
autoFocus: autoFocus
|
|
109
|
-
}, /*#__PURE__*/ (0, $8Tpjb$react).createElement("input", {
|
|
110
|
-
...inputProps,
|
|
111
|
-
ref: inputRef,
|
|
112
|
-
className: (0, $8Tpjb$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($dfcff93ab25bb9b3$exports))), "spectrum-ToggleSwitch-input")
|
|
113
|
-
})), /*#__PURE__*/ (0, $8Tpjb$react).createElement("span", {
|
|
114
|
-
className: (0, $8Tpjb$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($dfcff93ab25bb9b3$exports))), "spectrum-ToggleSwitch-switch")
|
|
115
|
-
}), children && /*#__PURE__*/ (0, $8Tpjb$react).createElement("span", {
|
|
116
|
-
className: (0, $8Tpjb$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($dfcff93ab25bb9b3$exports))), "spectrum-ToggleSwitch-label")
|
|
117
|
-
}, children));
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Switches allow users to turn an individual option on or off.
|
|
121
|
-
* They are usually used to activate or deactivate a specific setting.
|
|
122
|
-
*/ const $8341c396cee1c5fc$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $8Tpjb$forwardRef)($8341c396cee1c5fc$var$Switch);
|
|
123
|
-
|
|
124
14
|
|
|
125
15
|
|
|
126
16
|
|
package/dist/main.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
require("./main.
|
|
2
|
-
var $3fKzX$reactspectrumutils = require("@react-spectrum/utils");
|
|
3
|
-
var $3fKzX$reactariafocus = require("@react-aria/focus");
|
|
4
|
-
var $3fKzX$react = require("react");
|
|
5
|
-
var $3fKzX$reactariainteractions = require("@react-aria/interactions");
|
|
6
|
-
var $3fKzX$reactspectrumprovider = require("@react-spectrum/provider");
|
|
7
|
-
var $3fKzX$reactariaswitch = require("@react-aria/switch");
|
|
8
|
-
var $3fKzX$reactstatelytoggle = require("@react-stately/toggle");
|
|
1
|
+
var $e216104aee091306$exports = require("./Switch.main.js");
|
|
9
2
|
|
|
10
3
|
|
|
11
4
|
function $parcel$export(e, n, v, s) {
|
|
12
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
6
|
}
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
return a && a.__esModule ? a.default : a;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$parcel$export(module.exports, "Switch", () => $e216104aee091306$export$b5d5cf8927ab7262);
|
|
8
|
+
$parcel$export(module.exports, "Switch", () => $e216104aee091306$exports.Switch);
|
|
20
9
|
/*
|
|
21
10
|
* Copyright 2020 Adobe. All rights reserved.
|
|
22
11
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -28,101 +17,6 @@ $parcel$export(module.exports, "Switch", () => $e216104aee091306$export$b5d5cf89
|
|
|
28
17
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
18
|
* governing permissions and limitations under the License.
|
|
30
19
|
*/ /// <reference types="css-module-types" />
|
|
31
|
-
/*
|
|
32
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
33
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
34
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
35
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
-
*
|
|
37
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
38
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
39
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
40
|
-
* governing permissions and limitations under the License.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var $faeb9d1b92049ba7$exports = {};
|
|
45
|
-
|
|
46
|
-
$parcel$export($faeb9d1b92049ba7$exports, "focus-ring", () => $faeb9d1b92049ba7$export$f39a09f249340e2a, (v) => $faeb9d1b92049ba7$export$f39a09f249340e2a = v);
|
|
47
|
-
$parcel$export($faeb9d1b92049ba7$exports, "i18nFontFamily", () => $faeb9d1b92049ba7$export$8c4ee2c50c22c514, (v) => $faeb9d1b92049ba7$export$8c4ee2c50c22c514 = v);
|
|
48
|
-
$parcel$export($faeb9d1b92049ba7$exports, "is-hovered", () => $faeb9d1b92049ba7$export$b8813cd5d7824ce7, (v) => $faeb9d1b92049ba7$export$b8813cd5d7824ce7 = v);
|
|
49
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-FocusRing-ring", () => $faeb9d1b92049ba7$export$4109102f950813a6, (v) => $faeb9d1b92049ba7$export$4109102f950813a6 = v);
|
|
50
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-FocusRing", () => $faeb9d1b92049ba7$export$24c7f46a6e3605dd, (v) => $faeb9d1b92049ba7$export$24c7f46a6e3605dd = v);
|
|
51
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-FocusRing--quiet", () => $faeb9d1b92049ba7$export$2927016961429360, (v) => $faeb9d1b92049ba7$export$2927016961429360 = v);
|
|
52
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch", () => $faeb9d1b92049ba7$export$89a9162656c0c38c, (v) => $faeb9d1b92049ba7$export$89a9162656c0c38c = v);
|
|
53
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch--ab", () => $faeb9d1b92049ba7$export$dc5a33fddabf5882, (v) => $faeb9d1b92049ba7$export$dc5a33fddabf5882 = v);
|
|
54
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch--quiet", () => $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4, (v) => $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4 = v);
|
|
55
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch-input", () => $faeb9d1b92049ba7$export$38df7ea4ffef819a, (v) => $faeb9d1b92049ba7$export$38df7ea4ffef819a = v);
|
|
56
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch-label", () => $faeb9d1b92049ba7$export$8f1a69021a3897b2, (v) => $faeb9d1b92049ba7$export$8f1a69021a3897b2 = v);
|
|
57
|
-
$parcel$export($faeb9d1b92049ba7$exports, "spectrum-ToggleSwitch-switch", () => $faeb9d1b92049ba7$export$b82d06d1b520a22f, (v) => $faeb9d1b92049ba7$export$b82d06d1b520a22f = v);
|
|
58
|
-
var $faeb9d1b92049ba7$export$f39a09f249340e2a;
|
|
59
|
-
var $faeb9d1b92049ba7$export$8c4ee2c50c22c514;
|
|
60
|
-
var $faeb9d1b92049ba7$export$b8813cd5d7824ce7;
|
|
61
|
-
var $faeb9d1b92049ba7$export$4109102f950813a6;
|
|
62
|
-
var $faeb9d1b92049ba7$export$24c7f46a6e3605dd;
|
|
63
|
-
var $faeb9d1b92049ba7$export$2927016961429360;
|
|
64
|
-
var $faeb9d1b92049ba7$export$89a9162656c0c38c;
|
|
65
|
-
var $faeb9d1b92049ba7$export$dc5a33fddabf5882;
|
|
66
|
-
var $faeb9d1b92049ba7$export$ce1b1dcfc10f3df4;
|
|
67
|
-
var $faeb9d1b92049ba7$export$38df7ea4ffef819a;
|
|
68
|
-
var $faeb9d1b92049ba7$export$8f1a69021a3897b2;
|
|
69
|
-
var $faeb9d1b92049ba7$export$b82d06d1b520a22f;
|
|
70
|
-
$faeb9d1b92049ba7$export$f39a09f249340e2a = `XHynUq_focus-ring`;
|
|
71
|
-
$faeb9d1b92049ba7$export$8c4ee2c50c22c514 = `XHynUq_i18nFontFamily`;
|
|
72
|
-
$faeb9d1b92049ba7$export$b8813cd5d7824ce7 = `XHynUq_is-hovered`;
|
|
73
|
-
$faeb9d1b92049ba7$export$4109102f950813a6 = `XHynUq_spectrum-FocusRing-ring`;
|
|
74
|
-
$faeb9d1b92049ba7$export$24c7f46a6e3605dd = `XHynUq_spectrum-FocusRing ${$faeb9d1b92049ba7$export$4109102f950813a6}`;
|
|
75
|
-
$faeb9d1b92049ba7$export$2927016961429360 = `XHynUq_spectrum-FocusRing--quiet`;
|
|
76
|
-
$faeb9d1b92049ba7$export$89a9162656c0c38c = `XHynUq_spectrum-ToggleSwitch`;
|
|
77
|
-
$faeb9d1b92049ba7$export$dc5a33fddabf5882 = `XHynUq_spectrum-ToggleSwitch--ab`;
|
|
78
|
-
$faeb9d1b92049ba7$export$ce1b1dcfc10f3df4 = `XHynUq_spectrum-ToggleSwitch--quiet`;
|
|
79
|
-
$faeb9d1b92049ba7$export$38df7ea4ffef819a = `XHynUq_spectrum-ToggleSwitch-input`;
|
|
80
|
-
$faeb9d1b92049ba7$export$8f1a69021a3897b2 = `XHynUq_spectrum-ToggleSwitch-label`;
|
|
81
|
-
$faeb9d1b92049ba7$export$b82d06d1b520a22f = `XHynUq_spectrum-ToggleSwitch-switch`;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
function $e216104aee091306$var$Switch(props, ref) {
|
|
89
|
-
props = (0, $3fKzX$reactspectrumprovider.useProviderProps)(props);
|
|
90
|
-
let { isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
91
|
-
let { styleProps: styleProps } = (0, $3fKzX$reactspectrumutils.useStyleProps)(otherProps);
|
|
92
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $3fKzX$reactariainteractions.useHover)({
|
|
93
|
-
isDisabled: isDisabled
|
|
94
|
-
});
|
|
95
|
-
let inputRef = (0, $3fKzX$react.useRef)(null);
|
|
96
|
-
let domRef = (0, $3fKzX$reactspectrumutils.useFocusableRef)(ref, inputRef);
|
|
97
|
-
let state = (0, $3fKzX$reactstatelytoggle.useToggleState)(props);
|
|
98
|
-
let { inputProps: inputProps } = (0, $3fKzX$reactariaswitch.useSwitch)(props, state, inputRef);
|
|
99
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($3fKzX$react))).createElement("label", {
|
|
100
|
-
...styleProps,
|
|
101
|
-
...hoverProps,
|
|
102
|
-
ref: domRef,
|
|
103
|
-
className: (0, $3fKzX$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($faeb9d1b92049ba7$exports))), "spectrum-ToggleSwitch", {
|
|
104
|
-
"spectrum-ToggleSwitch--quiet": !isEmphasized,
|
|
105
|
-
"is-disabled": isDisabled,
|
|
106
|
-
"is-hovered": isHovered
|
|
107
|
-
}, styleProps.className)
|
|
108
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($3fKzX$react))).createElement((0, $3fKzX$reactariafocus.FocusRing), {
|
|
109
|
-
focusRingClass: (0, $3fKzX$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($faeb9d1b92049ba7$exports))), "focus-ring"),
|
|
110
|
-
autoFocus: autoFocus
|
|
111
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($3fKzX$react))).createElement("input", {
|
|
112
|
-
...inputProps,
|
|
113
|
-
ref: inputRef,
|
|
114
|
-
className: (0, $3fKzX$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($faeb9d1b92049ba7$exports))), "spectrum-ToggleSwitch-input")
|
|
115
|
-
})), /*#__PURE__*/ (0, ($parcel$interopDefault($3fKzX$react))).createElement("span", {
|
|
116
|
-
className: (0, $3fKzX$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($faeb9d1b92049ba7$exports))), "spectrum-ToggleSwitch-switch")
|
|
117
|
-
}), children && /*#__PURE__*/ (0, ($parcel$interopDefault($3fKzX$react))).createElement("span", {
|
|
118
|
-
className: (0, $3fKzX$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($faeb9d1b92049ba7$exports))), "spectrum-ToggleSwitch-label")
|
|
119
|
-
}, children));
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Switches allow users to turn an individual option on or off.
|
|
123
|
-
* They are usually used to activate or deactivate a specific setting.
|
|
124
|
-
*/ const $e216104aee091306$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $3fKzX$react.forwardRef)($e216104aee091306$var$Switch);
|
|
125
|
-
|
|
126
20
|
|
|
127
21
|
|
|
128
22
|
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
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"}
|