@fluentui/react-switch 9.1.3 → 9.1.5
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/.swcrc +30 -0
- package/CHANGELOG.json +109 -1
- package/CHANGELOG.md +33 -2
- package/lib/Switch.js.map +1 -1
- package/lib/SwitchField.js.map +1 -1
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Switch/Switch.types.js +1 -1
- package/lib/components/Switch/Switch.types.js.map +1 -1
- package/lib/components/Switch/index.js.map +1 -1
- package/lib/components/Switch/renderSwitch.js +1 -11
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.js +5 -3
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitchStyles.js +1 -1
- package/lib/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib/components/SwitchField/SwitchField.js +1 -2
- package/lib/components/SwitchField/SwitchField.js.map +1 -1
- package/lib/components/SwitchField/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Switch.js +5 -4
- package/lib-commonjs/Switch.js.map +1 -1
- package/lib-commonjs/SwitchField.js +5 -4
- package/lib-commonjs/SwitchField.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.js +19 -20
- package/lib-commonjs/components/Switch/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.types.js +5 -2
- package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
- package/lib-commonjs/components/Switch/index.js +9 -8
- package/lib-commonjs/components/Switch/index.js.map +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js +14 -29
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.js +78 -85
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.js +176 -89
- package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/components/SwitchField/SwitchField.js +17 -11
- package/lib-commonjs/components/SwitchField/SwitchField.js.map +1 -1
- package/lib-commonjs/components/SwitchField/index.js +5 -4
- package/lib-commonjs/components/SwitchField/index.js.map +1 -1
- package/lib-commonjs/index.js +23 -56
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +12 -11
- package/lib-amd/Switch.js +0 -6
- package/lib-amd/Switch.js.map +0 -1
- package/lib-amd/SwitchField.js +0 -6
- package/lib-amd/SwitchField.js.map +0 -1
- package/lib-amd/components/Switch/Switch.js +0 -17
- package/lib-amd/components/Switch/Switch.js.map +0 -1
- package/lib-amd/components/Switch/Switch.types.js +0 -5
- package/lib-amd/components/Switch/Switch.types.js.map +0 -1
- package/lib-amd/components/Switch/index.js +0 -10
- package/lib-amd/components/Switch/index.js.map +0 -1
- package/lib-amd/components/Switch/renderSwitch.js +0 -19
- package/lib-amd/components/Switch/renderSwitch.js.map +0 -1
- package/lib-amd/components/Switch/useSwitch.js +0 -63
- package/lib-amd/components/Switch/useSwitch.js.map +0 -1
- package/lib-amd/components/Switch/useSwitchStyles.js +0 -211
- package/lib-amd/components/Switch/useSwitchStyles.js.map +0 -1
- package/lib-amd/components/SwitchField/SwitchField.js +0 -10
- package/lib-amd/components/SwitchField/SwitchField.js.map +0 -1
- package/lib-amd/components/SwitchField/index.js +0 -6
- package/lib-amd/components/SwitchField/index.js.map +0 -1
- package/lib-amd/index.js +0 -15
- package/lib-amd/index.js.map +0 -1
@@ -1,12 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./Switch"), exports);
|
7
|
+
_exportStar(require("./Switch.types"), exports);
|
8
|
+
_exportStar(require("./renderSwitch"), exports);
|
9
|
+
_exportStar(require("./useSwitch"), exports);
|
10
|
+
_exportStar(require("./useSwitchStyles"), exports);
|
11
|
+
//# sourceMappingURL=index.js.map
|
12
|
+
|
12
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Switch/index.js"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
@@ -1,33 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "renderSwitch_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>renderSwitch_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
slotProps
|
16
|
-
} = react_utilities_1.getSlots(state);
|
17
|
-
const {
|
18
|
-
labelPosition
|
19
|
-
} = state;
|
20
|
-
return React.createElement(slots.root, {
|
21
|
-
...slotProps.root
|
22
|
-
}, React.createElement(slots.input, {
|
23
|
-
...slotProps.input
|
24
|
-
}), labelPosition !== 'after' && slots.label && React.createElement(slots.label, {
|
25
|
-
...slotProps.label
|
26
|
-
}), React.createElement(slots.indicator, {
|
27
|
-
...slotProps.indicator
|
28
|
-
}), labelPosition === 'after' && slots.label && React.createElement(slots.label, {
|
29
|
-
...slotProps.label
|
30
|
-
}));
|
31
|
-
};
|
32
|
-
exports.renderSwitch_unstable = renderSwitch_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
12
|
+
const renderSwitch_unstable = (state)=>{
|
13
|
+
const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
|
14
|
+
const { labelPosition } = state;
|
15
|
+
return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, /*#__PURE__*/ _react.createElement(slots.input, slotProps.input), labelPosition !== 'after' && slots.label && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label), /*#__PURE__*/ _react.createElement(slots.indicator, slotProps.indicator), labelPosition === 'after' && slots.label && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label));
|
16
|
+
}; //# sourceMappingURL=renderSwitch.js.map
|
17
|
+
|
33
18
|
//# sourceMappingURL=renderSwitch.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Switch/renderSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */\nexport const renderSwitch_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n const {\n labelPosition\n } = state;\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root, /*#__PURE__*/React.createElement(slots.input, slotProps.input), labelPosition !== 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, slotProps.label), /*#__PURE__*/React.createElement(slots.indicator, slotProps.indicator), labelPosition === 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, slotProps.label));\n};\n//# sourceMappingURL=renderSwitch.js.map"],"names":["renderSwitch_unstable","state","slots","slotProps","getSlots","labelPosition","React","createElement","root","input","label","indicator"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;gCACE;AAIlB,MAAMA,wBAAwBC,CAAAA,QAAS;IAC5C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,MAAM,EACJI,cAAa,EACd,GAAGJ;IACJ,OAAO,WAAW,GAAEK,OAAMC,aAAa,CAACL,MAAMM,IAAI,EAAEL,UAAUK,IAAI,EAAE,WAAW,GAAEF,OAAMC,aAAa,CAACL,MAAMO,KAAK,EAAEN,UAAUM,KAAK,GAAGJ,kBAAkB,WAAWH,MAAMQ,KAAK,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACL,MAAMQ,KAAK,EAAEP,UAAUO,KAAK,GAAG,WAAW,GAAEJ,OAAMC,aAAa,CAACL,MAAMS,SAAS,EAAER,UAAUQ,SAAS,GAAGN,kBAAkB,WAAWH,MAAMQ,KAAK,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACL,MAAMQ,KAAK,EAAEP,UAAUO,KAAK;AACna,GACA,wCAAwC"}
|
@@ -1,89 +1,82 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useSwitch_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useSwitch_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
props,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
input: 'input',
|
80
|
-
label: react_label_1.Label
|
81
|
-
},
|
82
|
-
root,
|
83
|
-
indicator,
|
84
|
-
input,
|
85
|
-
label
|
86
|
-
};
|
87
|
-
};
|
88
|
-
exports.useSwitch_unstable = useSwitch_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactIcons = require("@fluentui/react-icons");
|
12
|
+
const _reactLabel = require("@fluentui/react-label");
|
13
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
14
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
15
|
+
const useSwitch_unstable = (props, ref)=>{
|
16
|
+
const { checked , defaultChecked , disabled , labelPosition ='after' , onChange , required } = props;
|
17
|
+
const nativeProps = (0, _reactUtilities.getPartitionedNativeProps)({
|
18
|
+
props,
|
19
|
+
primarySlotTagName: 'input',
|
20
|
+
excludedPropNames: [
|
21
|
+
'checked',
|
22
|
+
'defaultChecked',
|
23
|
+
'onChange'
|
24
|
+
]
|
25
|
+
});
|
26
|
+
const id = (0, _reactUtilities.useId)('switch-', nativeProps.primary.id);
|
27
|
+
const root = (0, _reactUtilities.resolveShorthand)(props.root, {
|
28
|
+
defaultProps: {
|
29
|
+
ref: (0, _reactTabster.useFocusWithin)(),
|
30
|
+
...nativeProps.root
|
31
|
+
},
|
32
|
+
required: true
|
33
|
+
});
|
34
|
+
const indicator = (0, _reactUtilities.resolveShorthand)(props.indicator, {
|
35
|
+
defaultProps: {
|
36
|
+
'aria-hidden': true,
|
37
|
+
children: /*#__PURE__*/ _react.createElement(_reactIcons.CircleFilled, null)
|
38
|
+
},
|
39
|
+
required: true
|
40
|
+
});
|
41
|
+
const input = (0, _reactUtilities.resolveShorthand)(props.input, {
|
42
|
+
defaultProps: {
|
43
|
+
checked,
|
44
|
+
defaultChecked,
|
45
|
+
id,
|
46
|
+
ref,
|
47
|
+
role: 'switch',
|
48
|
+
type: 'checkbox',
|
49
|
+
...nativeProps.primary
|
50
|
+
},
|
51
|
+
required: true
|
52
|
+
});
|
53
|
+
input.onChange = (0, _reactUtilities.mergeCallbacks)(input.onChange, (ev)=>{
|
54
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
|
55
|
+
checked: ev.currentTarget.checked
|
56
|
+
});
|
57
|
+
});
|
58
|
+
const label = (0, _reactUtilities.resolveShorthand)(props.label, {
|
59
|
+
defaultProps: {
|
60
|
+
disabled,
|
61
|
+
htmlFor: id,
|
62
|
+
required,
|
63
|
+
size: 'medium'
|
64
|
+
}
|
65
|
+
});
|
66
|
+
return {
|
67
|
+
labelPosition,
|
68
|
+
//Slots definition
|
69
|
+
components: {
|
70
|
+
root: 'div',
|
71
|
+
indicator: 'div',
|
72
|
+
input: 'input',
|
73
|
+
label: _reactLabel.Label
|
74
|
+
},
|
75
|
+
root,
|
76
|
+
indicator,
|
77
|
+
input,
|
78
|
+
label
|
79
|
+
};
|
80
|
+
}; //# sourceMappingURL=useSwitch.js.map
|
81
|
+
|
89
82
|
//# sourceMappingURL=useSwitch.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Switch/useSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\n/**\n * Create the state required to render Switch.\n *\n * The returned state can be modified with hooks such as useSwitchStyles_unstable,\n * before being passed to renderSwitch_unstable.\n *\n * @param props - props from this instance of Switch\n * @param ref - reference to `<input>` element of Switch\n */\nexport const useSwitch_unstable = (props, ref) => {\n const {\n checked,\n defaultChecked,\n disabled,\n labelPosition = 'after',\n onChange,\n required\n } = props;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange']\n });\n const id = useId('switch-', nativeProps.primary.id);\n const root = resolveShorthand(props.root, {\n defaultProps: {\n ref: useFocusWithin(),\n ...nativeProps.root\n },\n required: true\n });\n const indicator = resolveShorthand(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: /*#__PURE__*/React.createElement(CircleFilled, null)\n },\n required: true\n });\n const input = resolveShorthand(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary\n },\n required: true\n });\n input.onChange = mergeCallbacks(input.onChange, ev => {\n return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {\n checked: ev.currentTarget.checked\n });\n });\n const label = resolveShorthand(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium'\n }\n });\n return {\n labelPosition,\n //Slots definition\n components: {\n root: 'div',\n indicator: 'div',\n input: 'input',\n label: Label\n },\n root,\n indicator,\n input,\n label\n };\n};\n//# sourceMappingURL=useSwitch.js.map"],"names":["useSwitch_unstable","props","ref","checked","defaultChecked","disabled","labelPosition","onChange","required","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","id","useId","primary","root","resolveShorthand","defaultProps","useFocusWithin","indicator","children","React","createElement","CircleFilled","input","role","type","mergeCallbacks","ev","currentTarget","label","htmlFor","size","components","Label"],"mappings":";;;;+BAcaA;;aAAAA;;;6DAdU;4BACM;4BACP;8BACS;gCACoD;AAU5E,MAAMA,qBAAqB,CAACC,OAAOC,MAAQ;IAChD,MAAM,EACJC,QAAO,EACPC,eAAc,EACdC,SAAQ,EACRC,eAAgB,QAAO,EACvBC,SAAQ,EACRC,SAAQ,EACT,GAAGP;IACJ,MAAMQ,cAAcC,IAAAA,yCAAyB,EAAC;QAC5CT;QACAU,oBAAoB;QACpBC,mBAAmB;YAAC;YAAW;YAAkB;SAAW;IAC9D;IACA,MAAMC,KAAKC,IAAAA,qBAAK,EAAC,WAAWL,YAAYM,OAAO,CAACF,EAAE;IAClD,MAAMG,OAAOC,IAAAA,gCAAgB,EAAChB,MAAMe,IAAI,EAAE;QACxCE,cAAc;YACZhB,KAAKiB,IAAAA,4BAAc;YACnB,GAAGV,YAAYO,IAAI;QACrB;QACAR,UAAU,IAAI;IAChB;IACA,MAAMY,YAAYH,IAAAA,gCAAgB,EAAChB,MAAMmB,SAAS,EAAE;QAClDF,cAAc;YACZ,eAAe,IAAI;YACnBG,UAAU,WAAW,GAAEC,OAAMC,aAAa,CAACC,wBAAY,EAAE,IAAI;QAC/D;QACAhB,UAAU,IAAI;IAChB;IACA,MAAMiB,QAAQR,IAAAA,gCAAgB,EAAChB,MAAMwB,KAAK,EAAE;QAC1CP,cAAc;YACZf;YACAC;YACAS;YACAX;YACAwB,MAAM;YACNC,MAAM;YACN,GAAGlB,YAAYM,OAAO;QACxB;QACAP,UAAU,IAAI;IAChB;IACAiB,MAAMlB,QAAQ,GAAGqB,IAAAA,8BAAc,EAACH,MAAMlB,QAAQ,EAAEsB,CAAAA,KAAM;QACpD,OAAOtB,aAAa,IAAI,IAAIA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASsB,IAAI;YACtE1B,SAAS0B,GAAGC,aAAa,CAAC3B,OAAO;QACnC,EAAE;IACJ;IACA,MAAM4B,QAAQd,IAAAA,gCAAgB,EAAChB,MAAM8B,KAAK,EAAE;QAC1Cb,cAAc;YACZb;YACA2B,SAASnB;YACTL;YACAyB,MAAM;QACR;IACF;IACA,OAAO;QACL3B;QACA,kBAAkB;QAClB4B,YAAY;YACVlB,MAAM;YACNI,WAAW;YACXK,OAAO;YACPM,OAAOI,iBAAK;QACd;QACAnB;QACAI;QACAK;QACAM;IACF;AACF,GACA,qCAAqC"}
|
@@ -1,108 +1,195 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
switchClassNames: ()=>switchClassNames,
|
13
|
+
switchClassName: ()=>switchClassName,
|
14
|
+
useSwitchStyles_unstable: ()=>useSwitchStyles_unstable
|
5
15
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
indicator: 'fui-Switch__indicator',
|
13
|
-
input: 'fui-Switch__input',
|
14
|
-
label: 'fui-Switch__label'
|
16
|
+
const _react = require("@griffel/react");
|
17
|
+
const switchClassNames = {
|
18
|
+
root: 'fui-Switch',
|
19
|
+
indicator: 'fui-Switch__indicator',
|
20
|
+
input: 'fui-Switch__input',
|
21
|
+
label: 'fui-Switch__label'
|
15
22
|
};
|
16
|
-
|
17
|
-
* @deprecated Use `switchClassNames.root` instead.
|
18
|
-
*/
|
19
|
-
exports.switchClassName = exports.switchClassNames.root;
|
23
|
+
const switchClassName = switchClassNames.root;
|
20
24
|
// Thumb and track sizes used by the component.
|
21
25
|
const spaceBetweenThumbAndTrack = 2;
|
22
26
|
const trackHeight = 20;
|
23
27
|
const trackWidth = 40;
|
24
28
|
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
25
|
-
const useRootBaseClassName = /*#__PURE__*/
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r1u7w45w", "rlzel8d", [
|
30
|
+
".r1u7w45w{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}",
|
31
|
+
".r1u7w45w:focus{outline-style:none;}",
|
32
|
+
".r1u7w45w:focus-visible{outline-style:none;}",
|
33
|
+
".r1u7w45w[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}",
|
34
|
+
".r1u7w45w[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;left:-2px;right:-2px;}",
|
35
|
+
".rlzel8d{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}",
|
36
|
+
".rlzel8d:focus{outline-style:none;}",
|
37
|
+
".rlzel8d:focus-visible{outline-style:none;}",
|
38
|
+
".rlzel8d[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}",
|
39
|
+
".rlzel8d[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;right:-2px;left:-2px;}"
|
40
|
+
]);
|
41
|
+
const useRootStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
42
|
+
vertical: {
|
43
|
+
Beiy3e4: "f1vx9l62"
|
44
|
+
}
|
30
45
|
}, {
|
31
|
-
|
46
|
+
d: [
|
47
|
+
".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"
|
48
|
+
]
|
32
49
|
});
|
33
|
-
const useIndicatorBaseClassName = /*#__PURE__*/
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
50
|
+
const useIndicatorBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r13wlxb8", null, [
|
51
|
+
".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}",
|
52
|
+
"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}",
|
53
|
+
".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}",
|
54
|
+
"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}"
|
55
|
+
]);
|
56
|
+
const useIndicatorStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
57
|
+
labelAbove: {
|
58
|
+
B6of3ja: "f1hu3pq6"
|
59
|
+
}
|
38
60
|
}, {
|
39
|
-
|
61
|
+
d: [
|
62
|
+
".f1hu3pq6{margin-top:0;}"
|
63
|
+
]
|
40
64
|
});
|
41
|
-
const useInputBaseClassName = /*#__PURE__*/
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
65
|
+
const useInputBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rw4brat", "r1f4bxyr", [
|
66
|
+
".rw4brat{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",
|
67
|
+
".rw4brat:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}",
|
68
|
+
".rw4brat:disabled{cursor:default;}",
|
69
|
+
".rw4brat:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",
|
70
|
+
".rw4brat:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",
|
71
|
+
".rw4brat:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",
|
72
|
+
".rw4brat:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",
|
73
|
+
".rw4brat:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
|
74
|
+
".rw4brat:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
|
75
|
+
".rw4brat:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",
|
76
|
+
".rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",
|
77
|
+
".rw4brat:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",
|
78
|
+
".rw4brat:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",
|
79
|
+
".rw4brat:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}",
|
80
|
+
"@media (forced-colors: active){.rw4brat:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rw4brat:disabled~.fui-Switch__label{color:GrayText;}.rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rw4brat:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}",
|
81
|
+
".r1f4bxyr{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",
|
82
|
+
".r1f4bxyr:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}",
|
83
|
+
".r1f4bxyr:disabled{cursor:default;}",
|
84
|
+
".r1f4bxyr:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",
|
85
|
+
".r1f4bxyr:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",
|
86
|
+
".r1f4bxyr:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",
|
87
|
+
".r1f4bxyr:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",
|
88
|
+
".r1f4bxyr:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
|
89
|
+
".r1f4bxyr:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
|
90
|
+
".r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",
|
91
|
+
".r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",
|
92
|
+
".r1f4bxyr:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",
|
93
|
+
".r1f4bxyr:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",
|
94
|
+
".r1f4bxyr:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}",
|
95
|
+
"@media (forced-colors: active){.r1f4bxyr:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r1f4bxyr:disabled~.fui-Switch__label{color:GrayText;}.r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}"
|
96
|
+
]);
|
97
|
+
const useInputStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
98
|
+
before: {
|
99
|
+
j35jbq: [
|
100
|
+
"f1e31b4d",
|
101
|
+
"f1vgc2s3"
|
102
|
+
],
|
103
|
+
Bhzewxz: "f15twtuk"
|
104
|
+
},
|
105
|
+
after: {
|
106
|
+
oyh7mz: [
|
107
|
+
"f1vgc2s3",
|
108
|
+
"f1e31b4d"
|
109
|
+
],
|
110
|
+
Bhzewxz: "f15twtuk"
|
111
|
+
},
|
112
|
+
above: {
|
113
|
+
B5kzvoi: "f1yab3r1",
|
114
|
+
Bqenvij: "f1aar7gd",
|
115
|
+
a9b677: "fly5x3f"
|
116
|
+
}
|
56
117
|
}, {
|
57
|
-
|
118
|
+
d: [
|
119
|
+
".f1e31b4d{right:0;}",
|
120
|
+
".f1vgc2s3{left:0;}",
|
121
|
+
".f15twtuk{top:0;}",
|
122
|
+
".f1yab3r1{bottom:0;}",
|
123
|
+
".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}",
|
124
|
+
".fly5x3f{width:100%;}"
|
125
|
+
]
|
58
126
|
});
|
59
127
|
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
60
|
-
const useLabelStyles = /*#__PURE__*/
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
128
|
+
const useLabelStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
129
|
+
base: {
|
130
|
+
Bceei9c: "f1k6fduh",
|
131
|
+
jrapky: "f49ad5g",
|
132
|
+
B6of3ja: "f1xlvstr",
|
133
|
+
z8tnut: "f1kwiid1",
|
134
|
+
z189sj: [
|
135
|
+
"f1vdfbxk",
|
136
|
+
"f1f5gg8d"
|
137
|
+
],
|
138
|
+
Byoj8tv: "f5b47ha",
|
139
|
+
uwmqm3: [
|
140
|
+
"f1f5gg8d",
|
141
|
+
"f1vdfbxk"
|
142
|
+
]
|
143
|
+
},
|
144
|
+
above: {
|
145
|
+
z8tnut: "f1ywm7hm",
|
146
|
+
Byoj8tv: "f14wxoun",
|
147
|
+
a9b677: "fly5x3f"
|
148
|
+
},
|
149
|
+
after: {
|
150
|
+
uwmqm3: [
|
151
|
+
"fruq291",
|
152
|
+
"f7x41pl"
|
153
|
+
]
|
154
|
+
},
|
155
|
+
before: {
|
156
|
+
z189sj: [
|
157
|
+
"f7x41pl",
|
158
|
+
"fruq291"
|
159
|
+
]
|
160
|
+
}
|
81
161
|
}, {
|
82
|
-
|
162
|
+
d: [
|
163
|
+
".f1k6fduh{cursor:pointer;}",
|
164
|
+
".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}",
|
165
|
+
".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}",
|
166
|
+
".f1kwiid1{padding-top:var(--spacingVerticalS);}",
|
167
|
+
".f1vdfbxk{padding-right:var(--spacingHorizontalS);}",
|
168
|
+
".f1f5gg8d{padding-left:var(--spacingHorizontalS);}",
|
169
|
+
".f5b47ha{padding-bottom:var(--spacingVerticalS);}",
|
170
|
+
".f1ywm7hm{padding-top:var(--spacingVerticalXS);}",
|
171
|
+
".f14wxoun{padding-bottom:var(--spacingVerticalXS);}",
|
172
|
+
".fly5x3f{width:100%;}",
|
173
|
+
".fruq291{padding-left:var(--spacingHorizontalXS);}",
|
174
|
+
".f7x41pl{padding-right:var(--spacingHorizontalXS);}"
|
175
|
+
]
|
83
176
|
});
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
const
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
label
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if (state.label) {
|
103
|
-
state.label.className = react_1.mergeClasses(exports.switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
|
104
|
-
}
|
105
|
-
return state;
|
106
|
-
};
|
107
|
-
exports.useSwitchStyles_unstable = useSwitchStyles_unstable;
|
177
|
+
const useSwitchStyles_unstable = (state)=>{
|
178
|
+
const rootBaseClassName = useRootBaseClassName();
|
179
|
+
const rootStyles = useRootStyles();
|
180
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
181
|
+
const indicatorStyles = useIndicatorStyles();
|
182
|
+
const inputBaseClassName = useInputBaseClassName();
|
183
|
+
const inputStyles = useInputStyles();
|
184
|
+
const labelStyles = useLabelStyles();
|
185
|
+
const { label , labelPosition } = state;
|
186
|
+
state.root.className = (0, _react.mergeClasses)(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
|
187
|
+
state.indicator.className = (0, _react.mergeClasses)(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
|
188
|
+
state.input.className = (0, _react.mergeClasses)(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
|
189
|
+
if (state.label) {
|
190
|
+
state.label.className = (0, _react.mergeClasses)(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
|
191
|
+
}
|
192
|
+
return state;
|
193
|
+
}; //# sourceMappingURL=useSwitchStyles.js.map
|
194
|
+
|
108
195
|
//# sourceMappingURL=useSwitchStyles.js.map
|