@fluentui/react-switch 0.0.0-nightly-20220509-0421.1 → 0.0.0-nightly-20220512-0418.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 +25 -13
- package/CHANGELOG.md +11 -9
- package/dist/index.d.ts +17 -18
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Switch/Switch.types.js.map +1 -1
- package/package.json +7 -7
- package/lib/Switch.d.ts +0 -1
- package/lib/components/Switch/Switch.d.ts +0 -6
- package/lib/components/Switch/Switch.types.d.ts +0 -65
- package/lib/components/Switch/index.d.ts +0 -5
- package/lib/components/Switch/renderSwitch.d.ts +0 -5
- package/lib/components/Switch/useSwitch.d.ts +0 -12
- package/lib/components/Switch/useSwitchStyles.d.ts +0 -11
- package/lib/index.d.ts +0 -2
- package/lib-commonjs/Switch.d.ts +0 -1
- package/lib-commonjs/components/Switch/Switch.d.ts +0 -6
- package/lib-commonjs/components/Switch/Switch.types.d.ts +0 -65
- package/lib-commonjs/components/Switch/index.d.ts +0 -5
- package/lib-commonjs/components/Switch/renderSwitch.d.ts +0 -5
- package/lib-commonjs/components/Switch/useSwitch.d.ts +0 -12
- package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +0 -11
- package/lib-commonjs/index.d.ts +0 -2
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": "Thu, 12 May 2022 04:32:32 GMT",
|
6
|
+
"tag": "@fluentui/react-switch_v0.0.0-nightly-20220512-0418.1",
|
7
|
+
"version": "0.0.0-nightly-20220512-0418.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -19,35 +19,47 @@
|
|
19
19
|
"commit": "0fac2d7a6f35c5fcebaf30da68b9604410fe0eb9",
|
20
20
|
"comment": "Updated react-label package version to RC."
|
21
21
|
},
|
22
|
+
{
|
23
|
+
"author": "martinhochel@microsoft.com",
|
24
|
+
"package": "@fluentui/react-switch",
|
25
|
+
"commit": "eb1084fd607c0d1086f9d465168be5822daa5e40",
|
26
|
+
"comment": "feat: ship rolluped only dts"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
30
|
+
"package": "@fluentui/react-switch",
|
31
|
+
"commit": "ec6c1a33b3c4cec9422d07bcffc48b85928c22d2",
|
32
|
+
"comment": "Removing SwitchCommons type in @fluentui/react-switch."
|
33
|
+
},
|
22
34
|
{
|
23
35
|
"author": "beachball",
|
24
36
|
"package": "@fluentui/react-switch",
|
25
|
-
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-
|
26
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220512-0418.1",
|
38
|
+
"commit": "ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42"
|
27
39
|
},
|
28
40
|
{
|
29
41
|
"author": "beachball",
|
30
42
|
"package": "@fluentui/react-switch",
|
31
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-
|
32
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220512-0418.1",
|
44
|
+
"commit": "ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42"
|
33
45
|
},
|
34
46
|
{
|
35
47
|
"author": "beachball",
|
36
48
|
"package": "@fluentui/react-switch",
|
37
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
38
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220512-0418.1",
|
50
|
+
"commit": "ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42"
|
39
51
|
},
|
40
52
|
{
|
41
53
|
"author": "beachball",
|
42
54
|
"package": "@fluentui/react-switch",
|
43
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
44
|
-
"commit": "
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220512-0418.1",
|
56
|
+
"commit": "ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42"
|
45
57
|
},
|
46
58
|
{
|
47
59
|
"author": "beachball",
|
48
60
|
"package": "@fluentui/react-switch",
|
49
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
50
|
-
"commit": "
|
61
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220512-0418.1",
|
62
|
+
"commit": "ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42"
|
51
63
|
}
|
52
64
|
]
|
53
65
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
# Change Log - @fluentui/react-switch
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 12 May 2022 04:32:32 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-20220512-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v0.0.0-nightly-20220512-0418.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.9..@fluentui/react-switch_v0.0.0-nightly-
|
9
|
+
Thu, 12 May 2022 04:32:32 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.9..@fluentui/react-switch_v0.0.0-nightly-20220512-0418.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined)
|
15
15
|
- Updated react-label package version to RC. ([PR #22865](https://github.com/microsoft/fluentui/pull/22865) by esteban.230@hotmail.com)
|
16
|
-
-
|
17
|
-
-
|
18
|
-
- Bump @fluentui/react-
|
19
|
-
- Bump @fluentui/react-
|
20
|
-
- Bump @fluentui/react-
|
16
|
+
- feat: ship rolluped only dts ([PR #22874](https://github.com/microsoft/fluentui/pull/22874) by martinhochel@microsoft.com)
|
17
|
+
- Removing SwitchCommons type in @fluentui/react-switch. ([PR #22943](https://github.com/microsoft/fluentui/pull/22943) by Humberto.Morimoto@microsoft.com)
|
18
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20220512-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42) by beachball)
|
19
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20220512-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42) by beachball)
|
20
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20220512-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42) by beachball)
|
21
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220512-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42) by beachball)
|
22
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220512-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ed0dd6a9e40d9cfe7e3e822d726d109c935c8d42) by beachball)
|
21
23
|
|
22
24
|
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.9)
|
23
25
|
|
package/dist/index.d.ts
CHANGED
@@ -23,36 +23,35 @@ export declare const switchClassName: string;
|
|
23
23
|
|
24
24
|
export declare const switchClassNames: SlotClassNames<SwitchSlots>;
|
25
25
|
|
26
|
-
declare type
|
26
|
+
export declare type SwitchOnChangeData = {
|
27
|
+
checked: boolean;
|
28
|
+
};
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Switch Props
|
32
|
+
*/
|
33
|
+
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & {
|
27
34
|
/**
|
28
35
|
* Defines the controlled checked state of the Switch.
|
29
36
|
* If passed, Switch ignores the `defaultChecked` property.
|
30
37
|
* This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
|
31
38
|
* correct value based on handling `onChange` events and re-rendering.
|
39
|
+
*
|
32
40
|
* @default false
|
33
41
|
*/
|
34
42
|
checked?: boolean;
|
35
|
-
/**
|
36
|
-
* The position of the label relative to the Switch.
|
37
|
-
*
|
38
|
-
* @default after
|
39
|
-
*/
|
40
|
-
labelPosition: 'above' | 'after' | 'before';
|
41
|
-
};
|
42
|
-
|
43
|
-
export declare type SwitchOnChangeData = {
|
44
|
-
checked: boolean;
|
45
|
-
};
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Switch Props
|
49
|
-
*/
|
50
|
-
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & Partial<SwitchCommons> & {
|
51
43
|
/**
|
52
44
|
* Defines whether the Switch is initially in a checked state or not when rendered.
|
45
|
+
*
|
53
46
|
* @default false
|
54
47
|
*/
|
55
48
|
defaultChecked?: boolean;
|
49
|
+
/**
|
50
|
+
* The position of the label relative to the Switch.
|
51
|
+
*
|
52
|
+
* @default after
|
53
|
+
*/
|
54
|
+
labelPosition?: 'above' | 'after' | 'before';
|
56
55
|
/**
|
57
56
|
* Callback to be called when the checked state value changes.
|
58
57
|
*/
|
@@ -87,7 +86,7 @@ export declare type SwitchSlots = {
|
|
87
86
|
/**
|
88
87
|
* State used in rendering Switch
|
89
88
|
*/
|
90
|
-
export declare type SwitchState = ComponentState<SwitchSlots> &
|
89
|
+
export declare type SwitchState = ComponentState<SwitchSlots> & Required<Pick<SwitchProps, 'labelPosition'>>;
|
91
90
|
|
92
91
|
/**
|
93
92
|
* Create the state required to render Switch.
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.types.js","sourceRoot":"../src/","sources":["components/Switch/Switch.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SwitchSlots = {\n /**\n * The root element of the Switch.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.\n * All other native props will be applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The track and the thumb sliding over it indicating the on and off status of the Switch.\n */\n indicator: NonNullable<Slot<'div'>>;\n\n /**\n * Hidden input that handles the Switch's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this\n * slot, except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The Switch's label.\n */\n label?: Slot<typeof Label>;\n};\n\
|
1
|
+
{"version":3,"file":"Switch.types.js","sourceRoot":"../src/","sources":["components/Switch/Switch.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SwitchSlots = {\n /**\n * The root element of the Switch.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.\n * All other native props will be applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The track and the thumb sliding over it indicating the on and off status of the Switch.\n */\n indicator: NonNullable<Slot<'div'>>;\n\n /**\n * Hidden input that handles the Switch's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this\n * slot, except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The Switch's label.\n */\n label?: Slot<typeof Label>;\n};\n\nexport type SwitchOnChangeData = {\n checked: boolean;\n};\n\n/**\n * Switch Props\n */\nexport type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & {\n /**\n * Defines the controlled checked state of the Switch.\n * If passed, Switch ignores the `defaultChecked` property.\n * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the\n * correct value based on handling `onChange` events and re-rendering.\n *\n * @default false\n */\n checked?: boolean;\n\n /**\n * Defines whether the Switch is initially in a checked state or not when rendered.\n *\n * @default false\n */\n defaultChecked?: boolean;\n\n /**\n * The position of the label relative to the Switch.\n *\n * @default after\n */\n labelPosition?: 'above' | 'after' | 'before';\n\n /**\n * Callback to be called when the checked state value changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;\n};\n\n/**\n * State used in rendering Switch\n */\nexport type SwitchState = ComponentState<SwitchSlots> & Required<Pick<SwitchProps, 'labelPosition'>>;\n"]}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-switch",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20220512-0418.1",
|
4
4
|
"description": "Fluent UI React Switch component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
|
-
"typings": "
|
7
|
+
"typings": "dist/index.d.ts",
|
8
8
|
"sideEffects": false,
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -28,15 +28,15 @@
|
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
30
|
"@fluentui/react-conformance": "*",
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20220512-0418.1",
|
32
32
|
"@fluentui/scripts": "^1.0.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
35
|
"@fluentui/react-icons": "^2.0.166-rc.3",
|
36
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
37
|
-
"@fluentui/react-tabster": "0.0.0-nightly-
|
38
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
39
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-label": "0.0.0-nightly-20220512-0418.1",
|
37
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20220512-0418.1",
|
38
|
+
"@fluentui/react-theme": "0.0.0-nightly-20220512-0418.1",
|
39
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20220512-0418.1",
|
40
40
|
"@griffel/react": "1.0.3",
|
41
41
|
"tslib": "^2.1.0"
|
42
42
|
},
|
package/lib/Switch.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components/Switch/index';
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { SwitchProps } from './Switch.types';
|
2
|
-
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
3
|
-
/**
|
4
|
-
* Switches enable users to trigger an option on or off through pressing the component.
|
5
|
-
*/
|
6
|
-
export declare const Switch: ForwardRefComponent<SwitchProps>;
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Label } from '@fluentui/react-label';
|
3
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
4
|
-
export declare type SwitchSlots = {
|
5
|
-
/**
|
6
|
-
* The root element of the Switch.
|
7
|
-
*
|
8
|
-
* The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.
|
9
|
-
* All other native props will be applied to the primary slot: `input`.
|
10
|
-
*/
|
11
|
-
root: NonNullable<Slot<'div'>>;
|
12
|
-
/**
|
13
|
-
* The track and the thumb sliding over it indicating the on and off status of the Switch.
|
14
|
-
*/
|
15
|
-
indicator: NonNullable<Slot<'div'>>;
|
16
|
-
/**
|
17
|
-
* Hidden input that handles the Switch's functionality.
|
18
|
-
*
|
19
|
-
* This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this
|
20
|
-
* slot, except `className` and `style`, which remain on the root slot.
|
21
|
-
*/
|
22
|
-
input: NonNullable<Slot<'input'>>;
|
23
|
-
/**
|
24
|
-
* The Switch's label.
|
25
|
-
*/
|
26
|
-
label?: Slot<typeof Label>;
|
27
|
-
};
|
28
|
-
declare type SwitchCommons = {
|
29
|
-
/**
|
30
|
-
* Defines the controlled checked state of the Switch.
|
31
|
-
* If passed, Switch ignores the `defaultChecked` property.
|
32
|
-
* This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
|
33
|
-
* correct value based on handling `onChange` events and re-rendering.
|
34
|
-
* @default false
|
35
|
-
*/
|
36
|
-
checked?: boolean;
|
37
|
-
/**
|
38
|
-
* The position of the label relative to the Switch.
|
39
|
-
*
|
40
|
-
* @default after
|
41
|
-
*/
|
42
|
-
labelPosition: 'above' | 'after' | 'before';
|
43
|
-
};
|
44
|
-
export declare type SwitchOnChangeData = {
|
45
|
-
checked: boolean;
|
46
|
-
};
|
47
|
-
/**
|
48
|
-
* Switch Props
|
49
|
-
*/
|
50
|
-
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & Partial<SwitchCommons> & {
|
51
|
-
/**
|
52
|
-
* Defines whether the Switch is initially in a checked state or not when rendered.
|
53
|
-
* @default false
|
54
|
-
*/
|
55
|
-
defaultChecked?: boolean;
|
56
|
-
/**
|
57
|
-
* Callback to be called when the checked state value changes.
|
58
|
-
*/
|
59
|
-
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;
|
60
|
-
};
|
61
|
-
/**
|
62
|
-
* State used in rendering Switch
|
63
|
-
*/
|
64
|
-
export declare type SwitchState = ComponentState<SwitchSlots> & SwitchCommons;
|
65
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { SwitchProps, SwitchState } from './Switch.types';
|
3
|
-
/**
|
4
|
-
* Create the state required to render Switch.
|
5
|
-
*
|
6
|
-
* The returned state can be modified with hooks such as useSwitchStyles_unstable,
|
7
|
-
* before being passed to renderSwitch_unstable.
|
8
|
-
*
|
9
|
-
* @param props - props from this instance of Switch
|
10
|
-
* @param ref - reference to `<input>` element of Switch
|
11
|
-
*/
|
12
|
-
export declare const useSwitch_unstable: (props: SwitchProps, ref: React.Ref<HTMLInputElement>) => SwitchState;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
2
|
-
import type { SwitchSlots, SwitchState } from './Switch.types';
|
3
|
-
export declare const switchClassNames: SlotClassNames<SwitchSlots>;
|
4
|
-
/**
|
5
|
-
* @deprecated Use `switchClassNames.root` instead.
|
6
|
-
*/
|
7
|
-
export declare const switchClassName: string;
|
8
|
-
/**
|
9
|
-
* Apply styling to the Switch slots based on the state
|
10
|
-
*/
|
11
|
-
export declare const useSwitchStyles_unstable: (state: SwitchState) => SwitchState;
|
package/lib/index.d.ts
DELETED
package/lib-commonjs/Switch.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components/Switch/index';
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { SwitchProps } from './Switch.types';
|
2
|
-
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
3
|
-
/**
|
4
|
-
* Switches enable users to trigger an option on or off through pressing the component.
|
5
|
-
*/
|
6
|
-
export declare const Switch: ForwardRefComponent<SwitchProps>;
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Label } from '@fluentui/react-label';
|
3
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
4
|
-
export declare type SwitchSlots = {
|
5
|
-
/**
|
6
|
-
* The root element of the Switch.
|
7
|
-
*
|
8
|
-
* The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.
|
9
|
-
* All other native props will be applied to the primary slot: `input`.
|
10
|
-
*/
|
11
|
-
root: NonNullable<Slot<'div'>>;
|
12
|
-
/**
|
13
|
-
* The track and the thumb sliding over it indicating the on and off status of the Switch.
|
14
|
-
*/
|
15
|
-
indicator: NonNullable<Slot<'div'>>;
|
16
|
-
/**
|
17
|
-
* Hidden input that handles the Switch's functionality.
|
18
|
-
*
|
19
|
-
* This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this
|
20
|
-
* slot, except `className` and `style`, which remain on the root slot.
|
21
|
-
*/
|
22
|
-
input: NonNullable<Slot<'input'>>;
|
23
|
-
/**
|
24
|
-
* The Switch's label.
|
25
|
-
*/
|
26
|
-
label?: Slot<typeof Label>;
|
27
|
-
};
|
28
|
-
declare type SwitchCommons = {
|
29
|
-
/**
|
30
|
-
* Defines the controlled checked state of the Switch.
|
31
|
-
* If passed, Switch ignores the `defaultChecked` property.
|
32
|
-
* This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
|
33
|
-
* correct value based on handling `onChange` events and re-rendering.
|
34
|
-
* @default false
|
35
|
-
*/
|
36
|
-
checked?: boolean;
|
37
|
-
/**
|
38
|
-
* The position of the label relative to the Switch.
|
39
|
-
*
|
40
|
-
* @default after
|
41
|
-
*/
|
42
|
-
labelPosition: 'above' | 'after' | 'before';
|
43
|
-
};
|
44
|
-
export declare type SwitchOnChangeData = {
|
45
|
-
checked: boolean;
|
46
|
-
};
|
47
|
-
/**
|
48
|
-
* Switch Props
|
49
|
-
*/
|
50
|
-
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & Partial<SwitchCommons> & {
|
51
|
-
/**
|
52
|
-
* Defines whether the Switch is initially in a checked state or not when rendered.
|
53
|
-
* @default false
|
54
|
-
*/
|
55
|
-
defaultChecked?: boolean;
|
56
|
-
/**
|
57
|
-
* Callback to be called when the checked state value changes.
|
58
|
-
*/
|
59
|
-
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;
|
60
|
-
};
|
61
|
-
/**
|
62
|
-
* State used in rendering Switch
|
63
|
-
*/
|
64
|
-
export declare type SwitchState = ComponentState<SwitchSlots> & SwitchCommons;
|
65
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { SwitchProps, SwitchState } from './Switch.types';
|
3
|
-
/**
|
4
|
-
* Create the state required to render Switch.
|
5
|
-
*
|
6
|
-
* The returned state can be modified with hooks such as useSwitchStyles_unstable,
|
7
|
-
* before being passed to renderSwitch_unstable.
|
8
|
-
*
|
9
|
-
* @param props - props from this instance of Switch
|
10
|
-
* @param ref - reference to `<input>` element of Switch
|
11
|
-
*/
|
12
|
-
export declare const useSwitch_unstable: (props: SwitchProps, ref: React.Ref<HTMLInputElement>) => SwitchState;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
2
|
-
import type { SwitchSlots, SwitchState } from './Switch.types';
|
3
|
-
export declare const switchClassNames: SlotClassNames<SwitchSlots>;
|
4
|
-
/**
|
5
|
-
* @deprecated Use `switchClassNames.root` instead.
|
6
|
-
*/
|
7
|
-
export declare const switchClassName: string;
|
8
|
-
/**
|
9
|
-
* Apply styling to the Switch slots based on the state
|
10
|
-
*/
|
11
|
-
export declare const useSwitchStyles_unstable: (state: SwitchState) => SwitchState;
|
package/lib-commonjs/index.d.ts
DELETED