@fluentui/react-switch 0.0.0-nightly-20230804-0415.1 → 0.0.0-nightly-20230808-0415.1
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 +72 -21
- package/CHANGELOG.md +28 -13
- package/lib/components/Switch/renderSwitch.js +3 -3
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.js +10 -10
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js +2 -2
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.js +9 -9
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-switch",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-switch_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 08 Aug 2023 04:22:12 GMT",
|
6
|
+
"tag": "@fluentui/react-switch_v0.0.0-nightly-20230808-0415.1",
|
7
|
+
"version": "0.0.0-nightly-20230808-0415.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,56 +16,107 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-switch",
|
19
|
-
"comment": "Bump @fluentui/react-field to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230808-0415.1",
|
20
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-switch",
|
25
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1",
|
26
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-switch",
|
31
|
-
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230808-0415.1",
|
32
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-switch",
|
37
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230808-0415.1",
|
38
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-switch",
|
43
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230808-0415.1",
|
44
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
45
45
|
},
|
46
46
|
{
|
47
47
|
"author": "beachball",
|
48
48
|
"package": "@fluentui/react-switch",
|
49
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
50
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1",
|
50
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"author": "beachball",
|
54
54
|
"package": "@fluentui/react-switch",
|
55
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
56
|
-
"commit": "
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1",
|
56
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
57
57
|
},
|
58
58
|
{
|
59
59
|
"author": "beachball",
|
60
60
|
"package": "@fluentui/react-switch",
|
61
|
-
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-
|
62
|
-
"commit": "
|
61
|
+
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1",
|
62
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
63
63
|
},
|
64
64
|
{
|
65
65
|
"author": "beachball",
|
66
66
|
"package": "@fluentui/react-switch",
|
67
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
68
|
-
"commit": "
|
67
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1",
|
68
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"date": "Fri, 04 Aug 2023 08:52:58 GMT",
|
75
|
+
"tag": "@fluentui/react-switch_v9.1.28",
|
76
|
+
"version": "9.1.28",
|
77
|
+
"comments": {
|
78
|
+
"patch": [
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-switch",
|
82
|
+
"comment": "Bump @fluentui/react-field to v9.1.15",
|
83
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-switch",
|
88
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.13",
|
89
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-switch",
|
94
|
+
"comment": "Bump @fluentui/react-label to v9.1.23",
|
95
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"author": "beachball",
|
99
|
+
"package": "@fluentui/react-switch",
|
100
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.7.1",
|
101
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"author": "beachball",
|
105
|
+
"package": "@fluentui/react-switch",
|
106
|
+
"comment": "Bump @fluentui/react-tabster to v9.12.0",
|
107
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"author": "beachball",
|
111
|
+
"package": "@fluentui/react-switch",
|
112
|
+
"comment": "Bump @fluentui/react-theme to v9.1.10",
|
113
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"author": "beachball",
|
117
|
+
"package": "@fluentui/react-switch",
|
118
|
+
"comment": "Bump @fluentui/react-utilities to v9.11.0",
|
119
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
69
120
|
}
|
70
121
|
]
|
71
122
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,26 +1,41 @@
|
|
1
1
|
# Change Log - @fluentui/react-switch
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 08 Aug 2023 04:22:12 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230808-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v0.0.0-nightly-20230808-0415.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.
|
9
|
+
Tue, 08 Aug 2023 04:22:12 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.28..@fluentui/react-switch_v0.0.0-nightly-20230808-0415.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-field to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-label to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-
|
20
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
21
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
22
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
23
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-field to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
17
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
18
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
19
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
20
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
21
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
22
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
23
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
24
|
+
|
25
|
+
## [9.1.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.1.28)
|
26
|
+
|
27
|
+
Fri, 04 Aug 2023 08:52:58 GMT
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.1.27..@fluentui/react-switch_v9.1.28)
|
29
|
+
|
30
|
+
### Patches
|
31
|
+
|
32
|
+
- Bump @fluentui/react-field to v9.1.15 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
33
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.13 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
34
|
+
- Bump @fluentui/react-label to v9.1.23 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
35
|
+
- Bump @fluentui/react-shared-contexts to v9.7.1 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
36
|
+
- Bump @fluentui/react-tabster to v9.12.0 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
37
|
+
- Bump @fluentui/react-theme to v9.1.10 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
38
|
+
- Bump @fluentui/react-utilities to v9.11.0 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
24
39
|
|
25
40
|
## [9.1.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.1.27)
|
26
41
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
2
|
-
import {
|
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
7
|
const { labelPosition } = state;
|
8
|
-
return /*#__PURE__*/ createElement(
|
8
|
+
return /*#__PURE__*/ createElement(state.root, null, /*#__PURE__*/ createElement(state.input, null), labelPosition !== 'after' && state.label && /*#__PURE__*/ createElement(state.label, null), /*#__PURE__*/ createElement(state.indicator, null), labelPosition === 'after' && state.label && /*#__PURE__*/ createElement(state.label, null));
|
9
9
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport {
|
1
|
+
{"version":3,"sources":["renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@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":["createElement","assertSlots","renderSwitch_unstable","state","labelPosition","root","input","label","indicator"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC,QAAuB;IAC3DF,YAAyBE;IACzB,MAAM,EAAEC,cAAa,EAAE,GAAGD;IAE1B,qBACE,AAfJ,cAeKA,MAAME,IAAI,sBACT,AAhBN,cAgBOF,MAAMG,KAAK,SACXF,kBAAkB,WAAWD,MAAMI,KAAK,kBAAI,AAjBnD,cAiBoDJ,MAAMI,KAAK,uBACzD,AAlBN,cAkBOJ,MAAMK,SAAS,SACfJ,kBAAkB,WAAWD,MAAMI,KAAK,kBAAI,AAnBnD,cAmBoDJ,MAAMI,KAAK;AAG/D,EAAE"}
|
@@ -3,7 +3,7 @@ import { useFieldControlProps_unstable } from '@fluentui/react-field';
|
|
3
3
|
import { CircleFilled } from '@fluentui/react-icons';
|
4
4
|
import { Label } from '@fluentui/react-label';
|
5
5
|
import { useFocusWithin } from '@fluentui/react-tabster';
|
6
|
-
import { getPartitionedNativeProps, mergeCallbacks,
|
6
|
+
import { getPartitionedNativeProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';
|
7
7
|
/**
|
8
8
|
* Create the state required to render Switch.
|
9
9
|
*
|
@@ -29,21 +29,21 @@ import { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } fr
|
|
29
29
|
]
|
30
30
|
});
|
31
31
|
const id = useId('switch-', nativeProps.primary.id);
|
32
|
-
const root =
|
32
|
+
const root = slot.always(props.root, {
|
33
33
|
defaultProps: {
|
34
34
|
ref: useFocusWithin(),
|
35
35
|
...nativeProps.root
|
36
36
|
},
|
37
|
-
|
37
|
+
elementType: 'div'
|
38
38
|
});
|
39
|
-
const indicator =
|
39
|
+
const indicator = slot.always(props.indicator, {
|
40
40
|
defaultProps: {
|
41
41
|
'aria-hidden': true,
|
42
42
|
children: /*#__PURE__*/ React.createElement(CircleFilled, null)
|
43
43
|
},
|
44
|
-
|
44
|
+
elementType: 'div'
|
45
45
|
});
|
46
|
-
const input =
|
46
|
+
const input = slot.always(props.input, {
|
47
47
|
defaultProps: {
|
48
48
|
checked,
|
49
49
|
defaultChecked,
|
@@ -53,24 +53,24 @@ import { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } fr
|
|
53
53
|
type: 'checkbox',
|
54
54
|
...nativeProps.primary
|
55
55
|
},
|
56
|
-
|
56
|
+
elementType: 'input'
|
57
57
|
});
|
58
58
|
input.onChange = mergeCallbacks(input.onChange, (ev)=>{
|
59
59
|
return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
|
60
60
|
checked: ev.currentTarget.checked
|
61
61
|
});
|
62
62
|
});
|
63
|
-
const label =
|
63
|
+
const label = slot.optional(props.label, {
|
64
64
|
defaultProps: {
|
65
65
|
disabled,
|
66
66
|
htmlFor: id,
|
67
67
|
required,
|
68
68
|
size: 'medium'
|
69
|
-
}
|
69
|
+
},
|
70
|
+
elementType: Label
|
70
71
|
});
|
71
72
|
return {
|
72
73
|
labelPosition,
|
73
|
-
//Slots definition
|
74
74
|
components: {
|
75
75
|
root: 'div',
|
76
76
|
indicator: 'div',
|
@@ -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,
|
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,MAAkD;IACvG,+CAA+C;IAC/CD,QAAQT,8BAA8BS,OAAO;QAAEE,kBAAkB,IAAI;QAAEC,kBAAkB,IAAI;IAAC;IAE9F,MAAM,EAAEC,QAAO,EAAEC,eAAc,EAAEC,SAAQ,EAAEC,eAAgB,QAAO,EAAEC,SAAQ,EAAEC,SAAQ,EAAE,GAAGT;IAE3F,MAAMU,cAAcf,0BAA0B;QAC5CK;QACAW,oBAAoB;QACpBC,mBAAmB;YAAC;YAAW;YAAkB;SAAW;IAC9D;IAEA,MAAMC,KAAKhB,MAAM,WAAWa,YAAYI,OAAO,CAACD,EAAE;IAElD,MAAME,OAAOjB,KAAKkB,MAAM,CAAChB,MAAMe,IAAI,EAAE;QACnCE,cAAc;YAAEhB,KAAKP;YAAkC,GAAGgB,YAAYK,IAAI;QAAC;QAC3EG,aAAa;IACf;IACA,MAAMC,YAAYrB,KAAKkB,MAAM,CAAChB,MAAMmB,SAAS,EAAE;QAC7CF,cAAc;YAAE,eAAe,IAAI;YAAEG,wBAAU,oBAAC5B;QAAgB;QAChE0B,aAAa;IACf;IACA,MAAMG,QAAQvB,KAAKkB,MAAM,CAAChB,MAAMqB,KAAK,EAAE;QACrCJ,cAAc;YAAEb;YAASC;YAAgBQ;YAAIZ;YAAKqB,MAAM;YAAUC,MAAM;YAAY,GAAGb,YAAYI,OAAO;QAAC;QAC3GI,aAAa;IACf;IACAG,MAAMb,QAAQ,GAAGZ,eAAeyB,MAAMb,QAAQ,EAAEgB,CAAAA;QAAMhB,OAAAA,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWgB,IAAI;YAAEpB,SAASoB,GAAGC,aAAa,CAACrB,OAAO;QAAC;;IACzG,MAAMsB,QAAQ5B,KAAK6B,QAAQ,CAAC3B,MAAM0B,KAAK,EAAE;QACvCT,cAAc;YAAEX;YAAUsB,SAASf;YAAIJ;YAAUoB,MAAM;QAAS;QAChEX,aAAazB;IACf;IACA,OAAO;QACLc;QACAuB,YAAY;YAAEf,MAAM;YAAOI,WAAW;YAAOE,OAAO;YAASK,OAAOjC;QAAM;QAE1EsB;QACAI;QACAE;QACAK;IACF;AACF,EAAE"}
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "renderSwitch_unstable", {
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
11
11
|
const renderSwitch_unstable = (state)=>{
|
12
|
-
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
13
13
|
const { labelPosition } = state;
|
14
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
14
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.input, null), labelPosition !== 'after' && state.label && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.label, null), /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.indicator, null), labelPosition === 'after' && state.label && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.label, null));
|
15
15
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderSwitch.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
1
|
+
{"version":3,"sources":["renderSwitch.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-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__*/ createElement(state.root, null, /*#__PURE__*/ createElement(state.input, null), labelPosition !== 'after' && state.label && /*#__PURE__*/ createElement(state.label, null), /*#__PURE__*/ createElement(state.indicator, null), labelPosition === 'after' && state.label && /*#__PURE__*/ createElement(state.label, null));\n};\n"],"names":["renderSwitch_unstable","state","assertSlots","labelPosition","createElement","root","input","label","indicator"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,wBAAwB,CAACC,QAAQ;IAC9CC,IAAAA,2BAAW,EAACD;IACZ,MAAM,EAAEE,cAAa,EAAG,GAAGF;IAC3B,OAAO,WAAW,GAAGG,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAE,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACH,MAAMK,KAAK,EAAE,IAAI,GAAGH,kBAAkB,WAAWF,MAAMM,KAAK,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMM,KAAK,EAAE,IAAI,GAAG,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMO,SAAS,EAAE,IAAI,GAAGL,kBAAkB,WAAWF,MAAMM,KAAK,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMM,KAAK,EAAE,IAAI;AAClV"}
|
@@ -30,21 +30,21 @@ const useSwitch_unstable = (props, ref)=>{
|
|
30
30
|
]
|
31
31
|
});
|
32
32
|
const id = (0, _reactUtilities.useId)('switch-', nativeProps.primary.id);
|
33
|
-
const root =
|
33
|
+
const root = _reactUtilities.slot.always(props.root, {
|
34
34
|
defaultProps: {
|
35
35
|
ref: (0, _reactTabster.useFocusWithin)(),
|
36
36
|
...nativeProps.root
|
37
37
|
},
|
38
|
-
|
38
|
+
elementType: 'div'
|
39
39
|
});
|
40
|
-
const indicator =
|
40
|
+
const indicator = _reactUtilities.slot.always(props.indicator, {
|
41
41
|
defaultProps: {
|
42
42
|
'aria-hidden': true,
|
43
43
|
children: /*#__PURE__*/ _react.createElement(_reactIcons.CircleFilled, null)
|
44
44
|
},
|
45
|
-
|
45
|
+
elementType: 'div'
|
46
46
|
});
|
47
|
-
const input =
|
47
|
+
const input = _reactUtilities.slot.always(props.input, {
|
48
48
|
defaultProps: {
|
49
49
|
checked,
|
50
50
|
defaultChecked,
|
@@ -54,24 +54,24 @@ const useSwitch_unstable = (props, ref)=>{
|
|
54
54
|
type: 'checkbox',
|
55
55
|
...nativeProps.primary
|
56
56
|
},
|
57
|
-
|
57
|
+
elementType: 'input'
|
58
58
|
});
|
59
59
|
input.onChange = (0, _reactUtilities.mergeCallbacks)(input.onChange, (ev)=>{
|
60
60
|
return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
|
61
61
|
checked: ev.currentTarget.checked
|
62
62
|
});
|
63
63
|
});
|
64
|
-
const label =
|
64
|
+
const label = _reactUtilities.slot.optional(props.label, {
|
65
65
|
defaultProps: {
|
66
66
|
disabled,
|
67
67
|
htmlFor: id,
|
68
68
|
required,
|
69
69
|
size: 'medium'
|
70
|
-
}
|
70
|
+
},
|
71
|
+
elementType: _reactLabel.Label
|
71
72
|
});
|
72
73
|
return {
|
73
74
|
labelPosition,
|
74
|
-
//Slots definition
|
75
75
|
components: {
|
76
76
|
root: 'div',
|
77
77
|
indicator: 'div',
|
@@ -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,
|
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 return 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","currentTarget","label","optional","htmlFor","size","Label","components"],"mappings":";;;;+BAciBA;;aAAAA;;;6DAdM;4BACuB;4BACjB;4BACP;8BACS;gCACwC;AAS5D,MAAMA,qBAAqB,CAACC,OAAOC,MAAM;IAChD,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF,OAAO;QACzCG,kBAAkB,IAAI;QACtBC,kBAAkB,IAAI;IAC1B;IACA,MAAM,EAAEC,QAAO,EAAGC,eAAc,EAAGC,SAAQ,EAAGC,eAAe,QAAO,EAAGC,SAAQ,EAAGC,SAAQ,EAAG,GAAGV;IAChG,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,IAAI;YACnBI,UAAU,WAAW,GAAGC,OAAMC,aAAa,CAACC,wBAAY,EAAE,IAAI;QAClE;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,KAAK;QAClD,OAAOxB,aAAa,IAAI,IAAIA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASwB,IAAI;YACpE5B,SAAS4B,GAAGC,aAAa,CAAC7B,OAAO;QACrC,EAAE;IACN;IACA,MAAM8B,QAAQhB,oBAAI,CAACiB,QAAQ,CAACpC,MAAMmC,KAAK,EAAE;QACrCd,cAAc;YACVd;YACA8B,SAAStB;YACTL;YACA4B,MAAM;QACV;QACAf,aAAagB,iBAAK;IACtB;IACA,OAAO;QACH/B;QACAgC,YAAY;YACRtB,MAAM;YACNM,WAAW;YACXK,OAAO;YACPM,OAAOI,iBAAK;QAChB;QACArB;QACAM;QACAK;QACAM;IACJ;AACJ"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-switch",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230808-0415.1",
|
4
4
|
"description": "Fluent UI React Switch component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,20 +27,20 @@
|
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
30
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20230808-0415.1",
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230808-0415.1",
|
32
32
|
"@fluentui/scripts-api-extractor": "*",
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-field": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-field": "0.0.0-nightly-20230808-0415.1",
|
37
37
|
"@fluentui/react-icons": "^2.0.207",
|
38
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
39
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
40
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
41
|
-
"@fluentui/react-tabster": "0.0.0-nightly-
|
42
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
43
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
38
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230808-0415.1",
|
39
|
+
"@fluentui/react-label": "0.0.0-nightly-20230808-0415.1",
|
40
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230808-0415.1",
|
41
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20230808-0415.1",
|
42
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230808-0415.1",
|
43
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230808-0415.1",
|
44
44
|
"@griffel/react": "^1.5.7",
|
45
45
|
"@swc/helpers": "^0.4.14"
|
46
46
|
},
|