@fluentui/react-switch 9.6.1 → 9.7.0

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.md CHANGED
@@ -1,17 +1,26 @@
1
1
  # Change Log - @fluentui/react-switch
2
2
 
3
- This log was last generated on Wed, 11 Mar 2026 09:20:38 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 26 Mar 2026 08:10:43 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.7.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.7.0)
8
+
9
+ Thu, 26 Mar 2026 08:10:43 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.6.1..@fluentui/react-switch_v9.7.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: add base hooks for Switch ([PR #35820](https://github.com/microsoft/fluentui/pull/35820) by dmytrokirpa@microsoft.com)
15
+
7
16
  ## [9.6.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.6.1)
8
17
 
9
- Wed, 11 Mar 2026 09:20:38 GMT
18
+ Wed, 11 Mar 2026 09:22:22 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.6.0..@fluentui/react-switch_v9.6.1)
11
20
 
12
21
  ### Patches
13
22
 
14
- - Bump @fluentui/react-field to v9.4.16 ([PR #35854](https://github.com/microsoft/fluentui/pull/35854) by beachball)
23
+ - Bump @fluentui/react-field to v9.4.16 ([PR #35859](https://github.com/microsoft/fluentui/pull/35859) by beachball)
15
24
 
16
25
  ## [9.6.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.6.0)
17
26
 
package/dist/index.d.ts CHANGED
@@ -10,13 +10,23 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
10
10
  /**
11
11
  * Render a Switch component by passing the state defined props to the appropriate slots.
12
12
  */
13
- export declare const renderSwitch_unstable: (state: SwitchState) => JSXElement;
13
+ export declare const renderSwitch_unstable: (state: SwitchBaseState) => JSXElement;
14
14
 
15
15
  /**
16
16
  * Switches enable users to trigger an option on or off through pressing the component.
17
17
  */
18
18
  export declare const Switch: ForwardRefComponent<SwitchProps>;
19
19
 
20
+ /**
21
+ * Switch base props, excluding design-related props like size
22
+ */
23
+ export declare type SwitchBaseProps = Omit<SwitchProps, 'size'>;
24
+
25
+ /**
26
+ * Switch base state, excluding design-related state like size
27
+ */
28
+ export declare type SwitchBaseState = Omit<SwitchState, 'size'>;
29
+
20
30
  /**
21
31
  * @deprecated Use `switchClassNames.root` instead.
22
32
  */
@@ -113,6 +123,14 @@ export declare type SwitchState = ComponentState<SwitchSlots> & Required<Pick<Sw
113
123
  */
114
124
  export declare const useSwitch_unstable: (props: SwitchProps, ref: React_2.Ref<HTMLInputElement>) => SwitchState;
115
125
 
126
+ /**
127
+ * Base hook for Switch component, manages state and structure common to all variants of Switch
128
+ *
129
+ * @param props - base props from this instance of Switch
130
+ * @param ref - reference to `<input>` element of Switch
131
+ */
132
+ export declare const useSwitchBase_unstable: (props: SwitchBaseProps, ref?: React_2.Ref<HTMLInputElement>) => SwitchBaseState;
133
+
116
134
  /**
117
135
  * Apply styling to the Switch slots based on the state
118
136
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Switch/renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\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;AAIxD;;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"}
1
+ {"version":3,"sources":["../src/components/Switch/renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { SwitchBaseState, 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: SwitchBaseState): JSXElement => {\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;AAIxD;;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"}
package/lib/index.js CHANGED
@@ -1,5 +1,2 @@
1
1
  export { Switch, renderSwitch_unstable, // eslint-disable-next-line @typescript-eslint/no-deprecated
2
- switchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable } from './Switch';
3
- // Experimental APIs - will be uncommented in experimental branch
4
- // export { useSwitchBase_unstable } from './Switch';
5
- // export type { SwitchBaseProps, SwitchBaseState } from './Switch';
2
+ switchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable, useSwitchBase_unstable } from './Switch';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n} from './Switch';\nexport type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';\n\n// Experimental APIs - will be uncommented in experimental branch\n// export { useSwitchBase_unstable } from './Switch';\n// export type { SwitchBaseProps, SwitchBaseState } from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,qBAAqB,EACrB,4DAA4D;AAC5DC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW;CAGlB,iEAAiE;CACjE,qDAAqD;CACrD,oEAAoE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n useSwitchBase_unstable,\n} from './Switch';\nexport type {\n SwitchOnChangeData,\n SwitchProps,\n SwitchSlots,\n SwitchState,\n SwitchBaseProps,\n SwitchBaseState,\n} from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","useSwitchBase_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,qBAAqB,EACrB,4DAA4D;AAC5DC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Switch/renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\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":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,8BAA8B,CAACC;QACpCF,2BAAAA,EAAyBE;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAME,IAAI,EAAA;;8BACT,eAAA,EAACF,MAAMG,KAAK,EAAA,CAAA;YACXF,kBAAkB,WAAWD,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;8BACzD,eAAA,EAACJ,MAAMK,SAAS,EAAA,CAAA;YACfJ,kBAAkB,WAAWD,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;;;AAG/D,EAAE"}
1
+ {"version":3,"sources":["../src/components/Switch/renderSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { SwitchBaseState, 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: SwitchBaseState): JSXElement => {\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":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,8BAA8B,CAACC;QACpCF,2BAAAA,EAAyBE;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAME,IAAI,EAAA;;8BACT,eAAA,EAACF,MAAMG,KAAK,EAAA,CAAA;YACXF,kBAAkB,WAAWD,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;8BACzD,eAAA,EAACJ,MAAMK,SAAS,EAAA,CAAA;YACfJ,kBAAkB,WAAWD,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;;;AAG/D,EAAE"}
@@ -21,6 +21,9 @@ _export(exports, {
21
21
  switchClassNames: function() {
22
22
  return _Switch.switchClassNames;
23
23
  },
24
+ useSwitchBase_unstable: function() {
25
+ return _Switch.useSwitchBase_unstable;
26
+ },
24
27
  useSwitchStyles_unstable: function() {
25
28
  return _Switch.useSwitchStyles_unstable;
26
29
  },
@@ -29,6 +32,3 @@ _export(exports, {
29
32
  }
30
33
  });
31
34
  const _Switch = require("./Switch");
32
- // Experimental APIs - will be uncommented in experimental branch
33
- // export { useSwitchBase_unstable } from './Switch';
34
- // export type { SwitchBaseProps, SwitchBaseState } from './Switch';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n} from './Switch';\nexport type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';\n\n// Experimental APIs - will be uncommented in experimental branch\n// export { useSwitchBase_unstable } from './Switch';\n// export type { SwitchBaseProps, SwitchBaseState } from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable"],"mappings":";;;;;;;;;;;;eACEA,cAAM;;;eACNC,6BAAqB,EACrB,4DAA4D;;;eAC5DC,uBAAe;;;eACfC,wBAAgB;;;eAChBC,gCAAwB;;;eACxBC,0BAAkB;;;wBACb,WAAW;CAGlB,iEAAiE;CACjE,qDAAqD;CACrD,oEAAoE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n useSwitchBase_unstable,\n} from './Switch';\nexport type {\n SwitchOnChangeData,\n SwitchProps,\n SwitchSlots,\n SwitchState,\n SwitchBaseProps,\n SwitchBaseState,\n} from './Switch';\n"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","useSwitchBase_unstable"],"mappings":";;;;;;;;;;;;eACEA,cAAM;;;eACNC,6BAAqB,EACrB,4DAA4D;;;eAC5DC,uBAAe;;;eACfC,wBAAgB;;;eAGhBG,8BAAsB;;;eAFtBF,gCAAwB;;;eACxBC,0BAAkB;;;wBAEb,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-switch",
3
- "version": "9.6.1",
3
+ "version": "9.7.0",
4
4
  "description": "Fluent UI React Switch component.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",