@fluentui/react-switch 9.1.35 → 9.1.37
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/CHANGELOG.json +103 -1
- package/CHANGELOG.md +32 -2
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Switch/renderSwitch.js +10 -3
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.js +3 -2
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitchStyles.styles.js.map +1 -1
- package/lib-commonjs/Switch.js +2 -2
- package/lib-commonjs/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.js +9 -7
- package/lib-commonjs/components/Switch/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.types.js +2 -2
- package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
- package/lib-commonjs/components/Switch/index.js +6 -6
- package/lib-commonjs/components/Switch/index.js.map +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js +16 -7
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.js +25 -22
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.styles.js +17 -11
- package/lib-commonjs/components/Switch/useSwitchStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +19 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,109 @@
|
|
2
2
|
"name": "@fluentui/react-switch",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Tue,
|
5
|
+
"date": "Tue, 05 Sep 2023 15:35:07 GMT",
|
6
|
+
"tag": "@fluentui/react-switch_v9.1.37",
|
7
|
+
"version": "9.1.37",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-switch",
|
13
|
+
"comment": "Bump @fluentui/react-field to v9.1.24",
|
14
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-switch",
|
19
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.5",
|
20
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-switch",
|
25
|
+
"comment": "Bump @fluentui/react-label to v9.1.32",
|
26
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-switch",
|
31
|
+
"comment": "Bump @fluentui/react-tabster to v9.12.7",
|
32
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-switch",
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.2",
|
38
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"date": "Tue, 05 Sep 2023 13:29:05 GMT",
|
45
|
+
"tag": "@fluentui/react-switch_v9.1.36",
|
46
|
+
"version": "9.1.36",
|
47
|
+
"comments": {
|
48
|
+
"patch": [
|
49
|
+
{
|
50
|
+
"author": "bernardo.sunderhus@gmail.com",
|
51
|
+
"package": "@fluentui/react-switch",
|
52
|
+
"commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
|
53
|
+
"comment": "chore: migrate package to use JSX importSource"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"author": "bernardo.sunderhus@gmail.com",
|
57
|
+
"package": "@fluentui/react-switch",
|
58
|
+
"commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
|
59
|
+
"comment": "bumps @swc/helpers version to 0.5.1"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-switch",
|
64
|
+
"comment": "Bump @fluentui/react-field to v9.1.23",
|
65
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-switch",
|
70
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.4",
|
71
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-switch",
|
76
|
+
"comment": "Bump @fluentui/react-label to v9.1.31",
|
77
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-switch",
|
82
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.7.3",
|
83
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-switch",
|
88
|
+
"comment": "Bump @fluentui/react-tabster to v9.12.6",
|
89
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-switch",
|
94
|
+
"comment": "Bump @fluentui/react-theme to v9.1.12",
|
95
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"author": "beachball",
|
99
|
+
"package": "@fluentui/react-switch",
|
100
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.1",
|
101
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
102
|
+
}
|
103
|
+
]
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"date": "Tue, 29 Aug 2023 12:57:36 GMT",
|
6
108
|
"tag": "@fluentui/react-switch_v9.1.35",
|
7
109
|
"version": "9.1.35",
|
8
110
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,42 @@
|
|
1
1
|
# Change Log - @fluentui/react-switch
|
2
2
|
|
3
|
-
This log was last generated on Tue,
|
3
|
+
This log was last generated on Tue, 05 Sep 2023 15:35:07 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.37](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.1.37)
|
8
|
+
|
9
|
+
Tue, 05 Sep 2023 15:35:07 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.36..@fluentui/react-switch_v9.1.37)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- Bump @fluentui/react-field to v9.1.24 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.5 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
16
|
+
- Bump @fluentui/react-label to v9.1.32 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
17
|
+
- Bump @fluentui/react-tabster to v9.12.7 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
19
|
+
|
20
|
+
## [9.1.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.1.36)
|
21
|
+
|
22
|
+
Tue, 05 Sep 2023 13:29:05 GMT
|
23
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.35..@fluentui/react-switch_v9.1.36)
|
24
|
+
|
25
|
+
### Patches
|
26
|
+
|
27
|
+
- chore: migrate package to use JSX importSource ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
|
28
|
+
- bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
|
29
|
+
- Bump @fluentui/react-field to v9.1.23 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
30
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
31
|
+
- Bump @fluentui/react-label to v9.1.31 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
32
|
+
- Bump @fluentui/react-shared-contexts to v9.7.3 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
33
|
+
- Bump @fluentui/react-tabster to v9.12.6 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
34
|
+
- Bump @fluentui/react-theme to v9.1.12 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
35
|
+
- Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
36
|
+
|
7
37
|
## [9.1.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.1.35)
|
8
38
|
|
9
|
-
Tue, 29 Aug 2023 12:
|
39
|
+
Tue, 29 Aug 2023 12:57:36 GMT
|
10
40
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.34..@fluentui/react-switch_v9.1.35)
|
11
41
|
|
12
42
|
### Patches
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles.styles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */\nexport const Switch: ForwardRefComponent<SwitchProps> = React.forwardRef((props, ref) => {\n const state = useSwitch_unstable(props, ref);\n\n useSwitchStyles_unstable(state);\n\n useCustomStyleHook_unstable('useSwitchStyles_unstable')(state);\n\n return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"],"names":["React","useSwitch_unstable","renderSwitch_unstable","useSwitchStyles_unstable","useCustomStyleHook_unstable","Switch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,2BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC
|
1
|
+
{"version":3,"sources":["Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles.styles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */\nexport const Switch: ForwardRefComponent<SwitchProps> = React.forwardRef((props, ref) => {\n const state = useSwitch_unstable(props, ref);\n\n useSwitchStyles_unstable(state);\n\n useCustomStyleHook_unstable('useSwitchStyles_unstable')(state);\n\n return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"],"names":["React","useSwitch_unstable","renderSwitch_unstable","useSwitchStyles_unstable","useCustomStyleHook_unstable","Switch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,2BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQR,mBAAmBM,OAAOC;IAExCL,yBAAyBM;IAEzBL,4BAA4B,4BAA4BK;IAExD,OAAOP,sBAAsBO;AAC/B,GAAG;AAEHJ,OAAOK,WAAW,GAAG"}
|
@@ -1,9 +1,16 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
2
2
|
import { assertSlots } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Render a Switch component by passing the state defined props to the appropriate slots.
|
5
5
|
*/ export const renderSwitch_unstable = (state)=>{
|
6
6
|
assertSlots(state);
|
7
|
-
const { labelPosition
|
8
|
-
return /*#__PURE__*/
|
7
|
+
const { labelPosition } = state;
|
8
|
+
return /*#__PURE__*/ _jsxs(state.root, {
|
9
|
+
children: [
|
10
|
+
/*#__PURE__*/ _jsx(state.input, {}),
|
11
|
+
labelPosition !== 'after' && state.label && /*#__PURE__*/ _jsx(state.label, {}),
|
12
|
+
/*#__PURE__*/ _jsx(state.indicator, {}),
|
13
|
+
labelPosition === 'after' && state.label && /*#__PURE__*/ _jsx(state.label, {})
|
14
|
+
]
|
15
|
+
});
|
9
16
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { SwitchState, SwitchSlots } from './Switch.types';\n\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */\nexport const renderSwitch_unstable = (state: SwitchState) => {\n assertSlots<SwitchSlots>(state);\n const { labelPosition } = state;\n\n return (\n <state.root>\n <state.input />\n {labelPosition !== 'after' && state.label && <state.label />}\n <state.indicator />\n {labelPosition === 'after' && state.label && <state.label />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderSwitch_unstable","state","labelPosition","root","input","label","indicator"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,qBACE,MAACA,MAAME,IAAI;;0BACT,KAACF,MAAMG,KAAK;YACXF,kBAAkB,WAAWD,MAAMI,KAAK,kBAAI,KAACJ,MAAMI,KAAK;0BACzD,KAACJ,MAAMK,SAAS;YACfJ,kBAAkB,WAAWD,MAAMI,KAAK,kBAAI,KAACJ,MAAMI,KAAK;;;AAG/D,EAAE"}
|
@@ -18,7 +18,7 @@ import { getPartitionedNativeProps, mergeCallbacks, useId, slot } from '@fluentu
|
|
18
18
|
supportsLabelFor: true,
|
19
19
|
supportsRequired: true
|
20
20
|
});
|
21
|
-
const { checked
|
21
|
+
const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;
|
22
22
|
const nativeProps = getPartitionedNativeProps({
|
23
23
|
props,
|
24
24
|
primarySlotTagName: 'input',
|
@@ -56,7 +56,8 @@ import { getPartitionedNativeProps, mergeCallbacks, useId, slot } from '@fluentu
|
|
56
56
|
elementType: 'input'
|
57
57
|
});
|
58
58
|
input.onChange = mergeCallbacks(input.onChange, (ev)=>{
|
59
|
-
|
59
|
+
var _onChange;
|
60
|
+
return (_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(ev, {
|
60
61
|
checked: ev.currentTarget.checked
|
61
62
|
});
|
62
63
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport type { SwitchProps, SwitchState } from './Switch.types';\n\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: SwitchProps, ref: React.Ref<HTMLInputElement>): SwitchState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true });\n\n const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const id = useId('switch-', nativeProps.primary.id);\n\n const root = slot.always(props.root, {\n defaultProps: { ref: useFocusWithin<HTMLDivElement>(), ...nativeProps.root },\n elementType: 'div',\n });\n const indicator = slot.always(props.indicator, {\n defaultProps: { 'aria-hidden': true, children: <CircleFilled /> },\n elementType: 'div',\n });\n const input = slot.always(props.input, {\n defaultProps: { checked, defaultChecked, id, ref, role: 'switch', type: 'checkbox', ...nativeProps.primary },\n elementType: 'input',\n });\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n const label = slot.optional(props.label, {\n defaultProps: { disabled, htmlFor: id, required, size: 'medium' },\n elementType: Label,\n });\n return {\n labelPosition, //Slots definition\n components: { root: 'div', indicator: 'div', input: 'input', label: Label },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"],"names":["React","useFieldControlProps_unstable","CircleFilled","Label","useFocusWithin","getPartitionedNativeProps","mergeCallbacks","useId","slot","useSwitch_unstable","props","ref","supportsLabelFor","supportsRequired","checked","defaultChecked","disabled","labelPosition","onChange","required","nativeProps","primarySlotTagName","excludedPropNames","id","primary","root","always","defaultProps","elementType","indicator","children","input","role","type","ev","currentTarget","label","optional","htmlFor","size","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAGnG;;;;;;;;CAQC,GACD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC
|
1
|
+
{"version":3,"sources":["useSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport type { SwitchProps, SwitchState } from './Switch.types';\n\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: SwitchProps, ref: React.Ref<HTMLInputElement>): SwitchState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true });\n\n const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const id = useId('switch-', nativeProps.primary.id);\n\n const root = slot.always(props.root, {\n defaultProps: { ref: useFocusWithin<HTMLDivElement>(), ...nativeProps.root },\n elementType: 'div',\n });\n const indicator = slot.always(props.indicator, {\n defaultProps: { 'aria-hidden': true, children: <CircleFilled /> },\n elementType: 'div',\n });\n const input = slot.always(props.input, {\n defaultProps: { checked, defaultChecked, id, ref, role: 'switch', type: 'checkbox', ...nativeProps.primary },\n elementType: 'input',\n });\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n const label = slot.optional(props.label, {\n defaultProps: { disabled, htmlFor: id, required, size: 'medium' },\n elementType: Label,\n });\n return {\n labelPosition, //Slots definition\n components: { root: 'div', indicator: 'div', input: 'input', label: Label },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"],"names":["React","useFieldControlProps_unstable","CircleFilled","Label","useFocusWithin","getPartitionedNativeProps","mergeCallbacks","useId","slot","useSwitch_unstable","props","ref","supportsLabelFor","supportsRequired","checked","defaultChecked","disabled","labelPosition","onChange","required","nativeProps","primarySlotTagName","excludedPropNames","id","primary","root","always","defaultProps","elementType","indicator","children","input","role","type","ev","currentTarget","label","optional","htmlFor","size","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAGnG;;;;;;;;CAQC,GACD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,+CAA+C;IAC/CD,QAAQT,8BAA8BS,OAAO;QAAEE,kBAAkB;QAAMC,kBAAkB;IA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
|
1
|
-
{"version":3,"names":["createFocusOutlineStyle","tokens","__resetStyles","__styles","mergeClasses","shorthands","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","useRootStyles","vertical","Beiy3e4","d","useIndicatorBaseClassName","r","s","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className"],"sources":["useSwitchStyles.styles.js"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const switchClassNames = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label'\n};\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */ export const switchClassName = switchClassNames.root;\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({\n style: {},\n selector: 'focus-within'\n })\n});\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column'\n }\n});\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n },\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n }\n }\n});\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0\n }\n});\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`\n }\n }\n },\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled\n },\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled\n }\n },\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible\n },\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1\n },\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover\n }\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed\n }\n }\n },\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke\n },\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive\n }\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive\n }\n }\n },\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled\n }\n },\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled\n }\n },\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText'\n },\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText'\n }\n },\n ':enabled:checked': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas'\n }\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas'\n }\n }\n }\n});\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0\n },\n after: {\n left: 0,\n top: 0\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%'\n }\n});\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS)\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%'\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS\n }\n});\n/**\n * Apply styling to the Switch slots based on the state\n */ export const useSwitchStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n const { label , labelPosition } = state;\n state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);\n state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAAAC,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,OAAO,MAAMC,gBAAgB,GAAG;EAC5BC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;AACX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AACrC,KAAK,CAAC8C,SAAS,CAAC;EACrI;EACA,OAAOT,KAAK;AAChB,CAAC"}
|
1
|
+
{"version":3,"names":["createFocusOutlineStyle","tokens","__resetStyles","__styles","mergeClasses","shorthands","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","useRootStyles","vertical","Beiy3e4","d","useIndicatorBaseClassName","r","s","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className"],"sources":["useSwitchStyles.styles.js"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const switchClassNames = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label'\n};\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */ export const switchClassName = switchClassNames.root;\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({\n style: {},\n selector: 'focus-within'\n })\n});\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column'\n }\n});\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n },\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n }\n }\n});\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0\n }\n});\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`\n }\n }\n },\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled\n },\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled\n }\n },\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible\n },\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1\n },\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover\n }\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed\n }\n }\n },\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke\n },\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive\n }\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive\n }\n }\n },\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled\n }\n },\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled\n }\n },\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText'\n },\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText'\n }\n },\n ':enabled:checked': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas'\n }\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas'\n }\n }\n }\n});\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0\n },\n after: {\n left: 0,\n top: 0\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%'\n }\n});\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS)\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%'\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS\n }\n});\n/**\n * Apply styling to the Switch slots based on the state\n */ export const useSwitchStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n const { label, labelPosition } = state;\n state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);\n state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAAAC,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,OAAO,MAAMC,gBAAgB,GAAG;EAC5BC,IAAI,EAAE,YAAY;EAClBC,SA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AAE4C,WAAW,CAACf,IAAI,EAAEe,WAAW,CAACC,aAAa,CAAC,EAAER,KAAK,CAACrC,KAAK,CAAC8C,SAAS,CAAC;EACrI;EACA,OAAOT,KAAK;AAChB,CAAC"}
|
package/lib-commonjs/Switch.js
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./components/Switch/index"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Switch.js"],"sourcesContent":["export * from './components/Switch/index';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Switch.js"],"sourcesContent":["export * from './components/Switch/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
@@ -4,18 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "Switch", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return Switch;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _useSwitch = require("./useSwitch");
|
12
14
|
const _renderSwitch = require("./renderSwitch");
|
13
|
-
const
|
14
|
-
const
|
15
|
+
const _useSwitchStylesstyles = require("./useSwitchStyles.styles");
|
16
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
15
17
|
const Switch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
16
18
|
const state = (0, _useSwitch.useSwitch_unstable)(props, ref);
|
17
|
-
(0,
|
18
|
-
(0,
|
19
|
+
(0, _useSwitchStylesstyles.useSwitchStyles_unstable)(state);
|
20
|
+
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useSwitchStyles_unstable')(state);
|
19
21
|
return (0, _renderSwitch.renderSwitch_unstable)(state);
|
20
22
|
});
|
21
23
|
Switch.displayName = 'Switch';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Switch.js"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */ export const Switch = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useSwitch_unstable(props, ref);\n useSwitchStyles_unstable(state);\n useCustomStyleHook_unstable('useSwitchStyles_unstable')(state);\n return renderSwitch_unstable(state);\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","forwardRef","props","ref","state","useSwitch_unstable","useSwitchStyles_unstable","useCustomStyleHook_unstable","renderSwitch_unstable","displayName"],"mappings":";;;;+BAOiBA
|
1
|
+
{"version":3,"sources":["Switch.js"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */ export const Switch = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useSwitch_unstable(props, ref);\n useSwitchStyles_unstable(state);\n useCustomStyleHook_unstable('useSwitchStyles_unstable')(state);\n return renderSwitch_unstable(state);\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","forwardRef","props","ref","state","useSwitch_unstable","useSwitchStyles_unstable","useCustomStyleHook_unstable","renderSwitch_unstable","displayName"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;2BACY;8BACG;uCACG;qCACG;AAGjC,MAAMA,SAAS,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC7D,MAAMC,QAAQC,IAAAA,6BAAkB,EAACH,OAAOC;IACxCG,IAAAA,+CAAwB,EAACF;IACzBG,IAAAA,gDAA2B,EAAC,4BAA4BH;IACxD,OAAOI,IAAAA,mCAAqB,EAACJ;AACjC;AACAL,OAAOU,WAAW,GAAG"}
|
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
const _react = /*#__PURE__*/
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Switch.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Switch.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./Switch"), exports);
|
7
|
+
_export_star._(require("./Switch.types"), exports);
|
8
|
+
_export_star._(require("./renderSwitch"), exports);
|
9
|
+
_export_star._(require("./useSwitch"), exports);
|
10
|
+
_export_star._(require("./useSwitchStyles.styles"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles.styles';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles.styles';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
@@ -1,15 +1,24 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ "use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "renderSwitch_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return renderSwitch_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
12
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
11
13
|
const renderSwitch_unstable = (state)=>{
|
12
|
-
(0,
|
13
|
-
const { labelPosition
|
14
|
-
return /*#__PURE__*/ (0,
|
14
|
+
(0, _reactutilities.assertSlots)(state);
|
15
|
+
const { labelPosition } = state;
|
16
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
17
|
+
children: [
|
18
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.input, {}),
|
19
|
+
labelPosition !== 'after' && state.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.label, {}),
|
20
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.indicator, {}),
|
21
|
+
labelPosition === 'after' && state.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.label, {})
|
22
|
+
]
|
23
|
+
});
|
15
24
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderSwitch.js"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderSwitch.js"],"sourcesContent":["/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */ export const renderSwitch_unstable = (state)=>{\n assertSlots(state);\n const { labelPosition } = state;\n return /*#__PURE__*/ _jsxs(state.root, {\n children: [\n /*#__PURE__*/ _jsx(state.input, {}),\n labelPosition !== 'after' && state.label && /*#__PURE__*/ _jsx(state.label, {}),\n /*#__PURE__*/ _jsx(state.indicator, {}),\n labelPosition === 'after' && state.label && /*#__PURE__*/ _jsx(state.label, {})\n ]\n });\n};\n"],"names":["renderSwitch_unstable","state","assertSlots","labelPosition","_jsxs","root","children","_jsx","input","label","indicator"],"mappings":"AAAA,0BAA0B,GAAG,iDAAiD;;;;+BAI7DA;;;eAAAA;;;4BAJ2G;gCAChG;AAGjB,MAAMA,wBAAwB,CAACC;IACtCC,IAAAA,2BAAW,EAACD;IACZ,MAAM,EAAEE,aAAa,EAAE,GAAGF;IAC1B,OAAO,WAAW,GAAGG,IAAAA,gBAAK,EAACH,MAAMI,IAAI,EAAE;QACnCC,UAAU;YACN,WAAW,GAAGC,IAAAA,eAAI,EAACN,MAAMO,KAAK,EAAE,CAAC;YACjCL,kBAAkB,WAAWF,MAAMQ,KAAK,IAAI,WAAW,GAAGF,IAAAA,eAAI,EAACN,MAAMQ,KAAK,EAAE,CAAC;YAC7E,WAAW,GAAGF,IAAAA,eAAI,EAACN,MAAMS,SAAS,EAAE,CAAC;YACrCP,kBAAkB,WAAWF,MAAMQ,KAAK,IAAI,WAAW,GAAGF,IAAAA,eAAI,EAACN,MAAMQ,KAAK,EAAE,CAAC;SAChF;IACL;AACJ"}
|
@@ -4,23 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useSwitch_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useSwitch_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
15
|
-
const
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
+
const _reactfield = require("@fluentui/react-field");
|
14
|
+
const _reacticons = require("@fluentui/react-icons");
|
15
|
+
const _reactlabel = require("@fluentui/react-label");
|
16
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
17
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
16
18
|
const useSwitch_unstable = (props, ref)=>{
|
17
19
|
// Merge props from surrounding <Field>, if any
|
18
|
-
props = (0,
|
20
|
+
props = (0, _reactfield.useFieldControlProps_unstable)(props, {
|
19
21
|
supportsLabelFor: true,
|
20
22
|
supportsRequired: true
|
21
23
|
});
|
22
|
-
const { checked
|
23
|
-
const nativeProps = (0,
|
24
|
+
const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;
|
25
|
+
const nativeProps = (0, _reactutilities.getPartitionedNativeProps)({
|
24
26
|
props,
|
25
27
|
primarySlotTagName: 'input',
|
26
28
|
excludedPropNames: [
|
@@ -29,22 +31,22 @@ const useSwitch_unstable = (props, ref)=>{
|
|
29
31
|
'onChange'
|
30
32
|
]
|
31
33
|
});
|
32
|
-
const id = (0,
|
33
|
-
const root =
|
34
|
+
const id = (0, _reactutilities.useId)('switch-', nativeProps.primary.id);
|
35
|
+
const root = _reactutilities.slot.always(props.root, {
|
34
36
|
defaultProps: {
|
35
|
-
ref: (0,
|
37
|
+
ref: (0, _reacttabster.useFocusWithin)(),
|
36
38
|
...nativeProps.root
|
37
39
|
},
|
38
40
|
elementType: 'div'
|
39
41
|
});
|
40
|
-
const indicator =
|
42
|
+
const indicator = _reactutilities.slot.always(props.indicator, {
|
41
43
|
defaultProps: {
|
42
44
|
'aria-hidden': true,
|
43
|
-
children: /*#__PURE__*/ _react.createElement(
|
45
|
+
children: /*#__PURE__*/ _react.createElement(_reacticons.CircleFilled, null)
|
44
46
|
},
|
45
47
|
elementType: 'div'
|
46
48
|
});
|
47
|
-
const input =
|
49
|
+
const input = _reactutilities.slot.always(props.input, {
|
48
50
|
defaultProps: {
|
49
51
|
checked,
|
50
52
|
defaultChecked,
|
@@ -56,19 +58,20 @@ const useSwitch_unstable = (props, ref)=>{
|
|
56
58
|
},
|
57
59
|
elementType: 'input'
|
58
60
|
});
|
59
|
-
input.onChange = (0,
|
60
|
-
|
61
|
+
input.onChange = (0, _reactutilities.mergeCallbacks)(input.onChange, (ev)=>{
|
62
|
+
var _onChange;
|
63
|
+
return (_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(ev, {
|
61
64
|
checked: ev.currentTarget.checked
|
62
65
|
});
|
63
66
|
});
|
64
|
-
const label =
|
67
|
+
const label = _reactutilities.slot.optional(props.label, {
|
65
68
|
defaultProps: {
|
66
69
|
disabled,
|
67
70
|
htmlFor: id,
|
68
71
|
required,
|
69
72
|
size: 'medium'
|
70
73
|
},
|
71
|
-
elementType:
|
74
|
+
elementType: _reactlabel.Label
|
72
75
|
});
|
73
76
|
return {
|
74
77
|
labelPosition,
|
@@ -76,7 +79,7 @@ const useSwitch_unstable = (props, ref)=>{
|
|
76
79
|
root: 'div',
|
77
80
|
indicator: 'div',
|
78
81
|
input: 'input',
|
79
|
-
label:
|
82
|
+
label: _reactlabel.Label
|
80
83
|
},
|
81
84
|
root,
|
82
85
|
indicator,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, useId, slot } 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 */ export const useSwitch_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true\n });\n const { checked
|
1
|
+
{"version":3,"sources":["useSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, useId, slot } 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 */ export const useSwitch_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true\n });\n const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: [\n 'checked',\n 'defaultChecked',\n 'onChange'\n ]\n });\n const id = useId('switch-', nativeProps.primary.id);\n const root = slot.always(props.root, {\n defaultProps: {\n ref: useFocusWithin(),\n ...nativeProps.root\n },\n elementType: 'div'\n });\n const indicator = slot.always(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: /*#__PURE__*/ React.createElement(CircleFilled, null)\n },\n elementType: 'div'\n });\n const input = slot.always(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary\n },\n elementType: 'input'\n });\n input.onChange = mergeCallbacks(input.onChange, (ev)=>{\n var _onChange;\n return (_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(ev, {\n checked: ev.currentTarget.checked\n });\n });\n const label = slot.optional(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium'\n },\n elementType: Label\n });\n return {\n labelPosition,\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"],"names":["useSwitch_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","supportsRequired","checked","defaultChecked","disabled","labelPosition","onChange","required","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","id","useId","primary","root","slot","always","defaultProps","useFocusWithin","elementType","indicator","children","React","createElement","CircleFilled","input","role","type","mergeCallbacks","ev","_onChange","currentTarget","label","optional","htmlFor","size","Label","components"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;4BACuB;4BACjB;4BACP;8BACS;gCACwC;AAS5D,MAAMA,qBAAqB,CAACC,OAAOC;IAC1C,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF,OAAO;QACzCG,kBAAkB;QAClBC,kBAAkB;IACtB;IACA,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,gBAAgB,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGV;IAC3F,MAAMW,cAAcC,IAAAA,yCAAyB,EAAC;QAC1CZ;QACAa,oBAAoB;QACpBC,mBAAmB;YACf;YACA;YACA;SACH;IACL;IACA,MAAMC,KAAKC,IAAAA,qBAAK,EAAC,WAAWL,YAAYM,OAAO,CAACF,EAAE;IAClD,MAAMG,OAAOC,oBAAI,CAACC,MAAM,CAACpB,MAAMkB,IAAI,EAAE;QACjCG,cAAc;YACVpB,KAAKqB,IAAAA,4BAAc;YACnB,GAAGX,YAAYO,IAAI;QACvB;QACAK,aAAa;IACjB;IACA,MAAMC,YAAYL,oBAAI,CAACC,MAAM,CAACpB,MAAMwB,SAAS,EAAE;QAC3CH,cAAc;YACV,eAAe;YACfI,UAAU,WAAW,GAAGC,OAAMC,aAAa,CAACC,wBAAY,EAAE;QAC9D;QACAL,aAAa;IACjB;IACA,MAAMM,QAAQV,oBAAI,CAACC,MAAM,CAACpB,MAAM6B,KAAK,EAAE;QACnCR,cAAc;YACVhB;YACAC;YACAS;YACAd;YACA6B,MAAM;YACNC,MAAM;YACN,GAAGpB,YAAYM,OAAO;QAC1B;QACAM,aAAa;IACjB;IACAM,MAAMpB,QAAQ,GAAGuB,IAAAA,8BAAc,EAACH,MAAMpB,QAAQ,EAAE,CAACwB;QAC7C,IAAIC;QACJ,OAAO,AAACA,CAAAA,YAAYzB,QAAO,MAAO,QAAQyB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUD,IAAI;YACpF5B,SAAS4B,GAAGE,aAAa,CAAC9B,OAAO;QACrC;IACJ;IACA,MAAM+B,QAAQjB,oBAAI,CAACkB,QAAQ,CAACrC,MAAMoC,KAAK,EAAE;QACrCf,cAAc;YACVd;YACA+B,SAASvB;YACTL;YACA6B,MAAM;QACV;QACAhB,aAAaiB,iBAAK;IACtB;IACA,OAAO;QACHhC;QACAiC,YAAY;YACRvB,MAAM;YACNM,WAAW;YACXK,OAAO;YACPO,OAAOI,iBAAK;QAChB;QACAtB;QACAM;QACAK;QACAO;IACJ;AACJ"}
|
@@ -9,9 +9,15 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
switchClassNames: ()
|
13
|
-
|
14
|
-
|
12
|
+
switchClassNames: function() {
|
13
|
+
return switchClassNames;
|
14
|
+
},
|
15
|
+
switchClassName: function() {
|
16
|
+
return switchClassName;
|
17
|
+
},
|
18
|
+
useSwitchStyles_unstable: function() {
|
19
|
+
return useSwitchStyles_unstable;
|
20
|
+
}
|
15
21
|
});
|
16
22
|
const _react = require("@griffel/react");
|
17
23
|
const switchClassNames = {
|
@@ -26,7 +32,7 @@ const spaceBetweenThumbAndTrack = 2;
|
|
26
32
|
const trackHeight = 20;
|
27
33
|
const trackWidth = 40;
|
28
34
|
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
29
|
-
const useRootBaseClassName = /*#__PURE__*/ (0, _react
|
35
|
+
const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rugt7u1", "rqv95o1", [
|
30
36
|
".rugt7u1{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}",
|
31
37
|
".rugt7u1:focus{outline-style:none;}",
|
32
38
|
".rugt7u1:focus-visible{outline-style:none;}",
|
@@ -38,7 +44,7 @@ const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rugt7u1
|
|
38
44
|
".rqv95o1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}",
|
39
45
|
".rqv95o1[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:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}"
|
40
46
|
]);
|
41
|
-
const useRootStyles = /*#__PURE__*/ (0, _react
|
47
|
+
const useRootStyles = /*#__PURE__*/ (0, _react.__styles)({
|
42
48
|
vertical: {
|
43
49
|
Beiy3e4: "f1vx9l62"
|
44
50
|
}
|
@@ -47,7 +53,7 @@ const useRootStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
47
53
|
".f1vx9l62{flex-direction:column;}"
|
48
54
|
]
|
49
55
|
});
|
50
|
-
const useIndicatorBaseClassName = /*#__PURE__*/ (0, _react
|
56
|
+
const useIndicatorBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r13wlxb8", null, {
|
51
57
|
r: [
|
52
58
|
".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;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;}",
|
53
59
|
".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"
|
@@ -57,7 +63,7 @@ const useIndicatorBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r1
|
|
57
63
|
"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}"
|
58
64
|
]
|
59
65
|
});
|
60
|
-
const useIndicatorStyles = /*#__PURE__*/ (0, _react
|
66
|
+
const useIndicatorStyles = /*#__PURE__*/ (0, _react.__styles)({
|
61
67
|
labelAbove: {
|
62
68
|
B6of3ja: "f1hu3pq6"
|
63
69
|
}
|
@@ -66,7 +72,7 @@ const useIndicatorStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
66
72
|
".f1hu3pq6{margin-top:0;}"
|
67
73
|
]
|
68
74
|
});
|
69
|
-
const useInputBaseClassName = /*#__PURE__*/ (0, _react
|
75
|
+
const useInputBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rw4brat", "r1f4bxyr", {
|
70
76
|
r: [
|
71
77
|
".rw4brat{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",
|
72
78
|
".rw4brat:checked~.fui-Switch__indicator>*{transform:translateX(20px);}",
|
@@ -102,7 +108,7 @@ const useInputBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rw4bra
|
|
102
108
|
"@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;}}"
|
103
109
|
]
|
104
110
|
});
|
105
|
-
const useInputStyles = /*#__PURE__*/ (0, _react
|
111
|
+
const useInputStyles = /*#__PURE__*/ (0, _react.__styles)({
|
106
112
|
before: {
|
107
113
|
j35jbq: [
|
108
114
|
"f1e31b4d",
|
@@ -133,7 +139,7 @@ const useInputStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
133
139
|
]
|
134
140
|
});
|
135
141
|
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
136
|
-
const useLabelStyles = /*#__PURE__*/ (0, _react
|
142
|
+
const useLabelStyles = /*#__PURE__*/ (0, _react.__styles)({
|
137
143
|
base: {
|
138
144
|
Bceei9c: "f1k6fduh",
|
139
145
|
jrapky: "f49ad5g",
|
@@ -190,7 +196,7 @@ const useSwitchStyles_unstable = (state)=>{
|
|
190
196
|
const inputBaseClassName = useInputBaseClassName();
|
191
197
|
const inputStyles = useInputStyles();
|
192
198
|
const labelStyles = useLabelStyles();
|
193
|
-
const { label
|
199
|
+
const { label, labelPosition } = state;
|
194
200
|
state.root.className = (0, _react.mergeClasses)(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
|
195
201
|
state.indicator.className = (0, _react.mergeClasses)(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
|
196
202
|
state.input.className = (0, _react.mergeClasses)(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useSwitchStyles.styles.js"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nexport const switchClassNames = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label'\n};\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rugt7u1\", \"rqv95o1\", [\".rugt7u1{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}\", \".rugt7u1:focus{outline-style:none;}\", \".rugt7u1:focus-visible{outline-style:none;}\", \".rugt7u1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}\", \".rugt7u1[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:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}\", \".rqv95o1{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}\", \".rqv95o1:focus{outline-style:none;}\", \".rqv95o1:focus-visible{outline-style:none;}\", \".rqv95o1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}\", \".rqv95o1[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:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}\"]);\nconst useRootStyles = /*#__PURE__*/__styles({\n vertical: {\n Beiy3e4: \"f1vx9l62\"\n }\n}, {\n d: [\".f1vx9l62{flex-direction:column;}\"]\n});\nconst useIndicatorBaseClassName = /*#__PURE__*/__resetStyles(\"r13wlxb8\", null, {\n r: [\".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;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;}\", \".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}\"],\n s: [\"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}\", \"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}\"]\n});\nconst useIndicatorStyles = /*#__PURE__*/__styles({\n labelAbove: {\n B6of3ja: \"f1hu3pq6\"\n }\n}, {\n d: [\".f1hu3pq6{margin-top:0;}\"]\n});\nconst useInputBaseClassName = /*#__PURE__*/__resetStyles(\"rw4brat\", \"r1f4bxyr\", {\n r: [\".rw4brat{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".rw4brat:checked~.fui-Switch__indicator>*{transform:translateX(20px);}\", \".rw4brat:disabled{cursor:default;}\", \".rw4brat:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".rw4brat:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".rw4brat:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".rw4brat:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".rw4brat:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\", \".r1f4bxyr{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".r1f4bxyr:checked~.fui-Switch__indicator>*{transform:translateX(-20px);}\", \".r1f4bxyr:disabled{cursor:default;}\", \".r1f4bxyr:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".r1f4bxyr:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".r1f4bxyr:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".r1f4bxyr:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\"],\n s: [\"@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;}}\", \"@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;}}\"]\n});\nconst useInputStyles = /*#__PURE__*/__styles({\n before: {\n j35jbq: [\"f1e31b4d\", \"f1vgc2s3\"],\n Bhzewxz: \"f15twtuk\"\n },\n after: {\n oyh7mz: [\"f1vgc2s3\", \"f1e31b4d\"],\n Bhzewxz: \"f15twtuk\"\n },\n above: {\n B5kzvoi: \"f1yab3r1\",\n Bqenvij: \"f1aar7gd\",\n a9b677: \"fly5x3f\"\n }\n}, {\n d: [\".f1e31b4d{right:0;}\", \".f1vgc2s3{left:0;}\", \".f15twtuk{top:0;}\", \".f1yab3r1{bottom:0;}\", \".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}\", \".fly5x3f{width:100%;}\"]\n});\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n Bceei9c: \"f1k6fduh\",\n jrapky: \"f49ad5g\",\n B6of3ja: \"f1xlvstr\",\n z8tnut: \"f1kwiid1\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f5b47ha\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"]\n },\n above: {\n z8tnut: \"f1ywm7hm\",\n Byoj8tv: \"f14wxoun\",\n a9b677: \"fly5x3f\"\n },\n after: {\n uwmqm3: [\"fruq291\", \"f7x41pl\"]\n },\n before: {\n z189sj: [\"f7x41pl\", \"fruq291\"]\n }\n}, {\n d: [\".f1k6fduh{cursor:pointer;}\", \".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1kwiid1{padding-top:var(--spacingVerticalS);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f5b47ha{padding-bottom:var(--spacingVerticalS);}\", \".f1ywm7hm{padding-top:var(--spacingVerticalXS);}\", \".f14wxoun{padding-bottom:var(--spacingVerticalXS);}\", \".fly5x3f{width:100%;}\", \".fruq291{padding-left:var(--spacingHorizontalXS);}\", \".f7x41pl{padding-right:var(--spacingHorizontalXS);}\"]\n});\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n const {\n label,\n labelPosition\n } = state;\n state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);\n state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);\n }\n return state;\n};\n//# sourceMappingURL=useSwitchStyles.styles.js.map"],"names":["switchClassNames","switchClassName","useSwitchStyles_unstable","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","__resetStyles","useRootStyles","__styles","vertical","Beiy3e4","d","useIndicatorBaseClassName","r","s","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","state","rootBaseClassName","rootStyles","indicatorBase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B,QAAQ,EAAE4B,MAAMxC,IAAI,CAACiD,SAAS;IACpJT,MAAMvC,SAAS,CAACgD,SAAS,GAAGC,IAAAA,mBAAY,EAACrD,iBAAiBI,SAAS,EAAE0C,wBAAwBxC,SAAS6C,kBAAkB,WAAWJ,gBAAgBzB,UAAU,EAAEqB,MAAMvC,SAAS,CAACgD,SAAS;IACxLT,MAAMtC,KAAK,CAAC+C,SAAS,GAAGC,IAAAA,mBAAY,EAACrD,iBAAiBK,KAAK,EAAE2C,oBAAoB1C,SAAS2C,WAAW,CAACE,cAAc,EAAER,MAAMtC,KAAK,CAAC+C,SAAS;IAC3I,IAAIT,MAAMrC,KAAK,EAAE;QACfqC,MAAMrC,KAAK,CAAC8C,SAAS,GAAGC,IAAAA,mBAAY,EAACrD,iBAAiBM,KAAK,EAAE4C,YAAYd,IAAI,EAAEc,WAAW,CAACC,cAAc,EAAER,MAAMrC,KAAK,CAAC8C,SAAS;IAClI,CAAC;IACD,OAAOT;AACT,GACA,kDAAkD"}
|
1
|
+
{"version":3,"sources":["useSwitchStyles.styles.js"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nexport const switchClassNames = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label'\n};\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rugt7u1\", \"rqv95o1\", [\".rugt7u1{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}\", \".rugt7u1:focus{outline-style:none;}\", \".rugt7u1:focus-visible{outline-style:none;}\", \".rugt7u1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}\", \".rugt7u1[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:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}\", \".rqv95o1{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}\", \".rqv95o1:focus{outline-style:none;}\", \".rqv95o1:focus-visible{outline-style:none;}\", \".rqv95o1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}\", \".rqv95o1[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:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}\"]);\nconst useRootStyles = /*#__PURE__*/__styles({\n vertical: {\n Beiy3e4: \"f1vx9l62\"\n }\n}, {\n d: [\".f1vx9l62{flex-direction:column;}\"]\n});\nconst useIndicatorBaseClassName = /*#__PURE__*/__resetStyles(\"r13wlxb8\", null, {\n r: [\".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;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;}\", \".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}\"],\n s: [\"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}\", \"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}\"]\n});\nconst useIndicatorStyles = /*#__PURE__*/__styles({\n labelAbove: {\n B6of3ja: \"f1hu3pq6\"\n }\n}, {\n d: [\".f1hu3pq6{margin-top:0;}\"]\n});\nconst useInputBaseClassName = /*#__PURE__*/__resetStyles(\"rw4brat\", \"r1f4bxyr\", {\n r: [\".rw4brat{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".rw4brat:checked~.fui-Switch__indicator>*{transform:translateX(20px);}\", \".rw4brat:disabled{cursor:default;}\", \".rw4brat:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".rw4brat:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".rw4brat:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".rw4brat:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".rw4brat:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\", \".r1f4bxyr{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".r1f4bxyr:checked~.fui-Switch__indicator>*{transform:translateX(-20px);}\", \".r1f4bxyr:disabled{cursor:default;}\", \".r1f4bxyr:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".r1f4bxyr:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".r1f4bxyr:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".r1f4bxyr:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\"],\n s: [\"@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;}}\", \"@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;}}\"]\n});\nconst useInputStyles = /*#__PURE__*/__styles({\n before: {\n j35jbq: [\"f1e31b4d\", \"f1vgc2s3\"],\n Bhzewxz: \"f15twtuk\"\n },\n after: {\n oyh7mz: [\"f1vgc2s3\", \"f1e31b4d\"],\n Bhzewxz: \"f15twtuk\"\n },\n above: {\n B5kzvoi: \"f1yab3r1\",\n Bqenvij: \"f1aar7gd\",\n a9b677: \"fly5x3f\"\n }\n}, {\n d: [\".f1e31b4d{right:0;}\", \".f1vgc2s3{left:0;}\", \".f15twtuk{top:0;}\", \".f1yab3r1{bottom:0;}\", \".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}\", \".fly5x3f{width:100%;}\"]\n});\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n Bceei9c: \"f1k6fduh\",\n jrapky: \"f49ad5g\",\n B6of3ja: \"f1xlvstr\",\n z8tnut: \"f1kwiid1\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f5b47ha\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"]\n },\n above: {\n z8tnut: \"f1ywm7hm\",\n Byoj8tv: \"f14wxoun\",\n a9b677: \"fly5x3f\"\n },\n after: {\n uwmqm3: [\"fruq291\", \"f7x41pl\"]\n },\n before: {\n z189sj: [\"f7x41pl\", \"fruq291\"]\n }\n}, {\n d: [\".f1k6fduh{cursor:pointer;}\", \".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1kwiid1{padding-top:var(--spacingVerticalS);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f5b47ha{padding-bottom:var(--spacingVerticalS);}\", \".f1ywm7hm{padding-top:var(--spacingVerticalXS);}\", \".f14wxoun{padding-bottom:var(--spacingVerticalXS);}\", \".fly5x3f{width:100%;}\", \".fruq291{padding-left:var(--spacingHorizontalXS);}\", \".f7x41pl{padding-right:var(--spacingHorizontalXS);}\"]\n});\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n const {\n label,\n labelPosition\n } = state;\n state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);\n state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);\n }\n return state;\n};\n//# sourceMappingURL=useSwitchStyles.styles.js.map"],"names":["switchClassNames","switchClassName","useSwitchStyles_unstable","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","__resetStyles","useRootStyles","__styles","vertical","Beiy3e4","d","useIndicatorBaseClassName","r","s","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,gBAAgB;eAAhBA;;IASAC,eAAe;eAAfA;;IA0EAC,wBAAwB;eAAxBA;;;uBApFqD;AAC3D,MAAMF,mBAAmB;IAC9BG,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT;AAIO,MAAML,kBAAkBD,iBAAiBG,IAAI;AACpD,+CAA+C;AAC/C,MAAMI,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAChC,MAAMI,uBAAuB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,WAAW,WAAW;IAAC;IAAiG;IAAuC;IAA+C;IAA4K;IAA8vB;IAAiG;IAAuC;IAA+C;IAA4K;CAA6vB;AAChxE,MAAMC,gBAAgB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AK,CAAC8C,SAAS;IAClI;IACA,OAAOT;AACT,GACA,kDAAkD"}
|
package/lib-commonjs/index.js
CHANGED
@@ -9,11 +9,23 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
Switch: ()
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
Switch: function() {
|
13
|
+
return _Switch.Switch;
|
14
|
+
},
|
15
|
+
renderSwitch_unstable: function() {
|
16
|
+
return _Switch.renderSwitch_unstable;
|
17
|
+
},
|
18
|
+
switchClassName: function() {
|
19
|
+
return _Switch.switchClassName;
|
20
|
+
},
|
21
|
+
switchClassNames: function() {
|
22
|
+
return _Switch.switchClassNames;
|
23
|
+
},
|
24
|
+
useSwitchStyles_unstable: function() {
|
25
|
+
return _Switch.useSwitchStyles_unstable;
|
26
|
+
},
|
27
|
+
useSwitch_unstable: function() {
|
28
|
+
return _Switch.useSwitch_unstable;
|
29
|
+
}
|
18
30
|
});
|
19
|
-
const
|
31
|
+
const _Switch = require("./Switch");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { Switch, renderSwitch_unstable, // eslint-disable-next-line deprecation/deprecation\nswitchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable } from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable"],"mappings":";;;;;;;;;;;IAASA,MAAM,
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { Switch, renderSwitch_unstable, // eslint-disable-next-line deprecation/deprecation\nswitchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable } from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable"],"mappings":";;;;;;;;;;;IAASA,MAAM;eAANA,cAAM;;IAAEC,qBAAqB;eAArBA,6BAAqB;;IACtCC,eAAe;eAAfA,uBAAe;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,wBAAwB;eAAxBA,gCAAwB;;IAAEC,kBAAkB;eAAlBA,0BAAkB;;;wBAAQ"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-switch",
|
3
|
-
"version": "9.1.
|
3
|
+
"version": "9.1.37",
|
4
4
|
"description": "Fluent UI React Switch component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,22 +33,22 @@
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-field": "^9.1.
|
36
|
+
"@fluentui/react-field": "^9.1.24",
|
37
37
|
"@fluentui/react-icons": "^2.0.207",
|
38
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
39
|
-
"@fluentui/react-label": "^9.1.
|
40
|
-
"@fluentui/react-shared-contexts": "^9.7.
|
41
|
-
"@fluentui/react-tabster": "^9.12.
|
42
|
-
"@fluentui/react-theme": "^9.1.
|
43
|
-
"@fluentui/react-utilities": "^9.13.
|
38
|
+
"@fluentui/react-jsx-runtime": "^9.0.5",
|
39
|
+
"@fluentui/react-label": "^9.1.32",
|
40
|
+
"@fluentui/react-shared-contexts": "^9.7.3",
|
41
|
+
"@fluentui/react-tabster": "^9.12.7",
|
42
|
+
"@fluentui/react-theme": "^9.1.12",
|
43
|
+
"@fluentui/react-utilities": "^9.13.2",
|
44
44
|
"@griffel/react": "^1.5.14",
|
45
|
-
"@swc/helpers": "^0.
|
45
|
+
"@swc/helpers": "^0.5.1"
|
46
46
|
},
|
47
47
|
"peerDependencies": {
|
48
|
-
"@types/react": ">=16.
|
49
|
-
"@types/react-dom": ">=16.
|
50
|
-
"react": ">=16.
|
51
|
-
"react-dom": ">=16.
|
48
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
49
|
+
"@types/react-dom": ">=16.14.0 <19.0.0",
|
50
|
+
"react": ">=16.14.0 <19.0.0",
|
51
|
+
"react-dom": ">=16.14.0 <19.0.0"
|
52
52
|
},
|
53
53
|
"beachball": {
|
54
54
|
"disallowedChangeTypes": [
|