@fluentui/react-switch 9.0.15 → 9.0.16

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.
Files changed (35) hide show
  1. package/CHANGELOG.json +60 -1
  2. package/CHANGELOG.md +16 -2
  3. package/lib/components/Switch/Switch.js +0 -1
  4. package/lib/components/Switch/Switch.js.map +1 -1
  5. package/lib/components/Switch/renderSwitch.js +10 -6
  6. package/lib/components/Switch/renderSwitch.js.map +1 -1
  7. package/lib/components/Switch/useSwitch.js +0 -1
  8. package/lib/components/Switch/useSwitch.js.map +1 -1
  9. package/lib/components/Switch/useSwitchStyles.js +180 -189
  10. package/lib/components/Switch/useSwitchStyles.js.map +1 -1
  11. package/lib/components/SwitchField/SwitchField.js.map +1 -1
  12. package/lib/index.js +2 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib-commonjs/Switch.js +0 -2
  15. package/lib-commonjs/Switch.js.map +1 -1
  16. package/lib-commonjs/SwitchField.js +0 -2
  17. package/lib-commonjs/SwitchField.js.map +1 -1
  18. package/lib-commonjs/components/Switch/Switch.js +0 -6
  19. package/lib-commonjs/components/Switch/Switch.js.map +1 -1
  20. package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
  21. package/lib-commonjs/components/Switch/index.js +0 -6
  22. package/lib-commonjs/components/Switch/index.js.map +1 -1
  23. package/lib-commonjs/components/Switch/renderSwitch.js +10 -10
  24. package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
  25. package/lib-commonjs/components/Switch/useSwitch.js +0 -8
  26. package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
  27. package/lib-commonjs/components/Switch/useSwitchStyles.js +180 -194
  28. package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
  29. package/lib-commonjs/components/SwitchField/SwitchField.js +0 -4
  30. package/lib-commonjs/components/SwitchField/SwitchField.js.map +1 -1
  31. package/lib-commonjs/components/SwitchField/index.js +0 -2
  32. package/lib-commonjs/components/SwitchField/index.js.map +1 -1
  33. package/lib-commonjs/index.js +2 -6
  34. package/lib-commonjs/index.js.map +1 -1
  35. package/package.json +8 -8
package/CHANGELOG.json CHANGED
@@ -2,7 +2,66 @@
2
2
  "name": "@fluentui/react-switch",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 21 Dec 2022 10:17:14 GMT",
5
+ "date": "Wed, 04 Jan 2023 01:35:51 GMT",
6
+ "tag": "@fluentui/react-switch_v9.0.16",
7
+ "version": "9.0.16",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-switch",
13
+ "commit": "194b0cf0cc27c1c1233aa945f09b3ad29778d8ca",
14
+ "comment": "chore(scripts): use for @fluentui/scripts version within all package.json"
15
+ },
16
+ {
17
+ "author": "martinhochel@microsoft.com",
18
+ "package": "@fluentui/react-switch",
19
+ "commit": "4ec2b998b294d6d9c3196d3d82893bdd97d0c105",
20
+ "comment": "chore(scripts): move index.ts to to follow sub-folder domain packaging"
21
+ }
22
+ ],
23
+ "patch": [
24
+ {
25
+ "author": "olfedias@microsoft.com",
26
+ "package": "@fluentui/react-switch",
27
+ "commit": "2c38f1e4ae07b2b60df596efe11015a68f166dbf",
28
+ "comment": "chore: Update Griffel to latest version"
29
+ },
30
+ {
31
+ "author": "beachball",
32
+ "package": "@fluentui/react-switch",
33
+ "comment": "Bump @fluentui/react-field to v9.0.0-alpha.13",
34
+ "commit": "3e322d15529451be153e97298873253e21af4082"
35
+ },
36
+ {
37
+ "author": "beachball",
38
+ "package": "@fluentui/react-switch",
39
+ "comment": "Bump @fluentui/react-label to v9.0.15",
40
+ "commit": "3e322d15529451be153e97298873253e21af4082"
41
+ },
42
+ {
43
+ "author": "beachball",
44
+ "package": "@fluentui/react-switch",
45
+ "comment": "Bump @fluentui/react-tabster to v9.3.5",
46
+ "commit": "3e322d15529451be153e97298873253e21af4082"
47
+ },
48
+ {
49
+ "author": "beachball",
50
+ "package": "@fluentui/react-switch",
51
+ "comment": "Bump @fluentui/react-utilities to v9.3.1",
52
+ "commit": "3e322d15529451be153e97298873253e21af4082"
53
+ },
54
+ {
55
+ "author": "beachball",
56
+ "package": "@fluentui/react-switch",
57
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.19",
58
+ "commit": "3e322d15529451be153e97298873253e21af4082"
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ {
64
+ "date": "Wed, 21 Dec 2022 10:20:32 GMT",
6
65
  "tag": "@fluentui/react-switch_v9.0.15",
7
66
  "version": "9.0.15",
8
67
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,26 @@
1
1
  # Change Log - @fluentui/react-switch
2
2
 
3
- This log was last generated on Wed, 21 Dec 2022 10:17:14 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 04 Jan 2023 01:35:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.16)
8
+
9
+ Wed, 04 Jan 2023 01:35:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.15..@fluentui/react-switch_v9.0.16)
11
+
12
+ ### Patches
13
+
14
+ - chore: Update Griffel to latest version ([PR #26045](https://github.com/microsoft/fluentui/pull/26045) by olfedias@microsoft.com)
15
+ - Bump @fluentui/react-field to v9.0.0-alpha.13 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
16
+ - Bump @fluentui/react-label to v9.0.15 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
17
+ - Bump @fluentui/react-tabster to v9.3.5 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
18
+ - Bump @fluentui/react-utilities to v9.3.1 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
19
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.19 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
20
+
7
21
  ## [9.0.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.15)
8
22
 
9
- Wed, 21 Dec 2022 10:17:14 GMT
23
+ Wed, 21 Dec 2022 10:20:32 GMT
10
24
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.14..@fluentui/react-switch_v9.0.15)
11
25
 
12
26
  ### Patches
@@ -5,7 +5,6 @@ import { useSwitchStyles_unstable } from './useSwitchStyles';
5
5
  /**
6
6
  * Switches enable users to trigger an option on or off through pressing the component.
7
7
  */
8
-
9
8
  export const Switch = /*#__PURE__*/React.forwardRef((props, ref) => {
10
9
  const state = useSwitch_unstable(props, ref);
11
10
  useSwitchStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-switch/src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA;;AAEG;;AACH,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtF,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;EAEA,wBAAwB,CAAC,KAAD,CAAxB;EAEA,OAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CANuD,CAAjD;AAQP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\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 return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,QAAQ,aAAa;AAChD,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,wBAAwB,QAAQ,mBAAmB;AAI5D;;;AAGA,OAAO,MAAMC,MAAM,gBAAqCJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACtF,MAAMC,KAAK,GAAGP,kBAAkB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAE5CJ,wBAAwB,CAACK,KAAK,CAAC;EAE/B,OAAON,qBAAqB,CAACM,KAAK,CAAC;AACrC,CAAC,CAAC;AAEFJ,MAAM,CAACK,WAAW,GAAG,QAAQ","names":["React","useSwitch_unstable","renderSwitch_unstable","useSwitchStyles_unstable","Switch","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\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 return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"]}
@@ -3,7 +3,6 @@ import { getSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render a Switch component by passing the state defined props to the appropriate slots.
5
5
  */
6
-
7
6
  export const renderSwitch_unstable = state => {
8
7
  const {
9
8
  slots,
@@ -12,11 +11,16 @@ export const renderSwitch_unstable = state => {
12
11
  const {
13
12
  labelPosition
14
13
  } = state;
15
- return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
16
- }, /*#__PURE__*/React.createElement(slots.input, { ...slotProps.input
17
- }), labelPosition !== 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, { ...slotProps.label
18
- }), /*#__PURE__*/React.createElement(slots.indicator, { ...slotProps.indicator
19
- }), labelPosition === 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, { ...slotProps.label
14
+ return /*#__PURE__*/React.createElement(slots.root, {
15
+ ...slotProps.root
16
+ }, /*#__PURE__*/React.createElement(slots.input, {
17
+ ...slotProps.input
18
+ }), labelPosition !== 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, {
19
+ ...slotProps.label
20
+ }), /*#__PURE__*/React.createElement(slots.indicator, {
21
+ ...slotProps.indicator
22
+ }), labelPosition === 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, {
23
+ ...slotProps.label
20
24
  }));
21
25
  };
22
26
  //# sourceMappingURL=renderSwitch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-switch/src/components/Switch/renderSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;EAC1D,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAc,KAAd,CAArC;EACA,MAAM;IAAE;EAAF,IAAoB,KAA1B;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADF,EAEG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAF/C,eAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,SAAP,EAAgB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAhB,CAHF,EAIG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAJ/C,CADF;AAQD,CAZM","sourcesContent":["import * as React from 'react';\nimport { getSlots } 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 const { slots, slotProps } = getSlots<SwitchSlots>(state);\n const { labelPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n {labelPosition !== 'after' && slots.label && <slots.label {...slotProps.label} />}\n <slots.indicator {...slotProps.indicator} />\n {labelPosition === 'after' && slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,qBAAqB,GAAIC,KAAkB,IAAI;EAC1D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAAcE,KAAK,CAAC;EACzD,MAAM;IAAEG;EAAa,CAAE,GAAGH,KAAK;EAE/B,oBACEH,oBAACI,KAAK,CAACG,IAAI;IAAA,GAAKF,SAAS,CAACE;EAAI,gBAC5BP,oBAACI,KAAK,CAACI,KAAK;IAAA,GAAKH,SAAS,CAACG;EAAK,EAAI,EACnCF,aAAa,KAAK,OAAO,IAAIF,KAAK,CAACK,KAAK,iBAAIT,oBAACI,KAAK,CAACK,KAAK;IAAA,GAAKJ,SAAS,CAACI;EAAK,EAAI,eACjFT,oBAACI,KAAK,CAACM,SAAS;IAAA,GAAKL,SAAS,CAACK;EAAS,EAAI,EAC3CJ,aAAa,KAAK,OAAO,IAAIF,KAAK,CAACK,KAAK,iBAAIT,oBAACI,KAAK,CAACK,KAAK;IAAA,GAAKJ,SAAS,CAACI;EAAK,EAAI,CACtE;AAEjB,CAAC","names":["React","getSlots","renderSwitch_unstable","state","slots","slotProps","labelPosition","root","input","label","indicator"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/renderSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } 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 const { slots, slotProps } = getSlots<SwitchSlots>(state);\n const { labelPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n {labelPosition !== 'after' && slots.label && <slots.label {...slotProps.label} />}\n <slots.indicator {...slotProps.indicator} />\n {labelPosition === 'after' && slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"]}
@@ -12,7 +12,6 @@ import { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } fr
12
12
  * @param props - props from this instance of Switch
13
13
  * @param ref - reference to `<input>` element of Switch
14
14
  */
15
-
16
15
  export const useSwitch_unstable = (props, ref) => {
17
16
  const {
18
17
  checked,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-switch/src/components/Switch/useSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,uBAA7B;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,cAAT,QAA+B,yBAA/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cAAc,CAAC,KAAK,CAAC,QAAP,EAAiB,EAAE,IAAI,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAQ,KAAA,CAAR,GAAA,QAAQ,CAAG,EAAH,EAAO;IAAE,OAAO,EAAE,EAAE,CAAC,aAAH,CAAiB;EAA5B,CAAP,CAA/B,CAA/B;EAEA,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAP,EAAc;IAC1C,YAAY,EAAE;MACZ,QADY;MAEZ,OAAO,EAAE,EAFG;MAGZ,QAHY;MAIZ,IAAI,EAAE;IAJM;EAD4B,CAAd,CAA9B;EASA,OAAO;IACL,aADK;IAGL;IACA,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,SAAS,EAAE,KAFD;MAGV,KAAK,EAAE,OAHG;MAIV,KAAK,EAAE;IAJG,CAJP;IAWL,IAXK;IAYL,SAZK;IAaL,KAbK;IAcL;EAdK,CAAP;AAgBD,CA/DM","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\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 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 = resolveShorthand(props.root, {\n defaultProps: { ref: useFocusWithin<HTMLDivElement>(), ...nativeProps.root },\n required: true,\n });\n\n const indicator = resolveShorthand(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n required: true,\n });\n\n const input = resolveShorthand(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary,\n },\n required: true,\n });\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium',\n },\n });\n\n return {\n labelPosition,\n\n //Slots definition\n components: {\n root: 'div',\n indicator: 'div',\n input: 'input',\n label: Label,\n },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,2BAA2B;AAG9G;;;;;;;;;AASA,OAAO,MAAMC,kBAAkB,GAAG,CAACC,KAAkB,EAAEC,GAAgC,KAAiB;EACtG,MAAM;IAAEC,OAAO;IAAEC,cAAc;IAAEC,QAAQ;IAAEC,aAAa,GAAG,OAAO;IAAEC,QAAQ;IAAEC;EAAQ,CAAE,GAAGP,KAAK;EAEhG,MAAMQ,WAAW,GAAGb,yBAAyB,CAAC;IAC5CK,KAAK;IACLS,kBAAkB,EAAE,OAAO;IAC3BC,iBAAiB,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU;GAC5D,CAAC;EAEF,MAAMC,EAAE,GAAGb,KAAK,CAAC,SAAS,EAAEU,WAAW,CAACI,OAAO,CAACD,EAAE,CAAC;EAEnD,MAAME,IAAI,GAAGhB,gBAAg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allbacks","resolveShorthand","useId","useSwitch_unstable","props","ref","checked","defaultChecked","disabled","labelPosition","onChange","required","nativeProps","primarySlotTagName","excludedPropNames","id","primary","root","defaultProps","indicator","children","input","role","type","ev","currentTarget","label","htmlFor","size","components"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/useSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\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 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 = resolveShorthand(props.root, {\n defaultProps: { ref: useFocusWithin<HTMLDivElement>(), ...nativeProps.root },\n required: true,\n });\n\n const indicator = resolveShorthand(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n required: true,\n });\n\n const input = resolveShorthand(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary,\n },\n required: true,\n });\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium',\n },\n });\n\n return {\n labelPosition,\n\n //Slots definition\n components: {\n root: 'div',\n indicator: 'div',\n input: 'input',\n label: Label,\n },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"]}