@fluentui/react-switch 0.0.0-nightly-20230223-2115.1 → 0.0.0-nightly-20230228-0425.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.
Files changed (41) hide show
  1. package/CHANGELOG.json +15 -15
  2. package/CHANGELOG.md +10 -10
  3. package/lib/Switch.js.map +1 -1
  4. package/lib/SwitchField.js.map +1 -1
  5. package/lib/components/Switch/Switch.js.map +1 -1
  6. package/lib/components/Switch/Switch.types.js +1 -1
  7. package/lib/components/Switch/Switch.types.js.map +1 -1
  8. package/lib/components/Switch/index.js.map +1 -1
  9. package/lib/components/Switch/renderSwitch.js +11 -2
  10. package/lib/components/Switch/renderSwitch.js.map +1 -1
  11. package/lib/components/Switch/useSwitch.js +3 -5
  12. package/lib/components/Switch/useSwitch.js.map +1 -1
  13. package/lib/components/Switch/useSwitchStyles.js.map +1 -1
  14. package/lib/components/SwitchField/SwitchField.js +2 -1
  15. package/lib/components/SwitchField/SwitchField.js.map +1 -1
  16. package/lib/components/SwitchField/index.js.map +1 -1
  17. package/lib/index.js.map +1 -1
  18. package/lib-commonjs/Switch.js +4 -5
  19. package/lib-commonjs/Switch.js.map +1 -1
  20. package/lib-commonjs/SwitchField.js +4 -5
  21. package/lib-commonjs/SwitchField.js.map +1 -1
  22. package/lib-commonjs/components/Switch/Switch.js +15 -16
  23. package/lib-commonjs/components/Switch/Switch.js.map +1 -1
  24. package/lib-commonjs/components/Switch/Switch.types.js +2 -5
  25. package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
  26. package/lib-commonjs/components/Switch/index.js +8 -9
  27. package/lib-commonjs/components/Switch/index.js.map +1 -1
  28. package/lib-commonjs/components/Switch/renderSwitch.js +29 -16
  29. package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
  30. package/lib-commonjs/components/Switch/useSwitch.js +85 -78
  31. package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
  32. package/lib-commonjs/components/Switch/useSwitchStyles.js +89 -176
  33. package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
  34. package/lib-commonjs/components/SwitchField/SwitchField.js +11 -17
  35. package/lib-commonjs/components/SwitchField/SwitchField.js.map +1 -1
  36. package/lib-commonjs/components/SwitchField/index.js +4 -5
  37. package/lib-commonjs/components/SwitchField/index.js.map +1 -1
  38. package/lib-commonjs/index.js +56 -23
  39. package/lib-commonjs/index.js.map +1 -1
  40. package/package.json +9 -9
  41. package/.swcrc +0 -33
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-switch",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 23 Feb 2023 21:23:18 GMT",
6
- "tag": "@fluentui/react-switch_v0.0.0-nightly-20230223-2115.1",
7
- "version": "0.0.0-nightly-20230223-2115.1",
5
+ "date": "Tue, 28 Feb 2023 04:34:41 GMT",
6
+ "tag": "@fluentui/react-switch_v0.0.0-nightly-20230228-0425.1",
7
+ "version": "0.0.0-nightly-20230228-0425.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,38 +16,38 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-switch",
19
- "comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230223-2115.1",
20
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
19
+ "comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230228-0425.1",
20
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-switch",
25
- "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230223-2115.1",
26
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
25
+ "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230228-0425.1",
26
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-switch",
31
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230223-2115.1",
32
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
31
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230228-0425.1",
32
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
33
33
  },
34
34
  {
35
35
  "author": "beachball",
36
36
  "package": "@fluentui/react-switch",
37
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230223-2115.1",
38
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
37
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230228-0425.1",
38
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
39
39
  },
40
40
  {
41
41
  "author": "beachball",
42
42
  "package": "@fluentui/react-switch",
43
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230223-2115.1",
44
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
43
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230228-0425.1",
44
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
45
45
  },
46
46
  {
47
47
  "author": "beachball",
48
48
  "package": "@fluentui/react-switch",
49
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230223-2115.1",
50
- "commit": "a400eb0e4c7e02093ab7fb103c74a8dcca00f17b"
49
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230228-0425.1",
50
+ "commit": "8c1594112af8a99c5f4d2da191968d9247bdb269"
51
51
  }
52
52
  ]
53
53
  }
package/CHANGELOG.md CHANGED
@@ -1,23 +1,23 @@
1
1
  # Change Log - @fluentui/react-switch
2
2
 
3
- This log was last generated on Thu, 23 Feb 2023 21:23:18 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 28 Feb 2023 04:34:41 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230223-2115.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v0.0.0-nightly-20230223-2115.1)
7
+ ## [0.0.0-nightly-20230228-0425.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v0.0.0-nightly-20230228-0425.1)
8
8
 
9
- Thu, 23 Feb 2023 21:23:18 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.26..@fluentui/react-switch_v0.0.0-nightly-20230223-2115.1)
9
+ Tue, 28 Feb 2023 04:34:41 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.26..@fluentui/react-switch_v0.0.0-nightly-20230228-0425.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-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
16
- - Bump @fluentui/react-label to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
17
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
18
- - Bump @fluentui/react-theme to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
19
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
20
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230223-2115.1 ([commit](https://github.com/microsoft/fluentui/commit/a400eb0e4c7e02093ab7fb103c74a8dcca00f17b) by beachball)
15
+ - Bump @fluentui/react-field to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
16
+ - Bump @fluentui/react-label to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
17
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
18
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
20
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/8c1594112af8a99c5f4d2da191968d9247bdb269) by beachball)
21
21
 
22
22
  ## [9.0.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.26)
23
23
 
package/lib/Switch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,cAAc","names":[],"sources":["../src/Switch.ts"],"sourcesContent":["export * from './components/Switch/index';\n"]}
1
+ {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/Switch.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './components/Switch/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,cAAc","names":[],"sources":["../src/SwitchField.ts"],"sourcesContent":["export * from './components/SwitchField/index';\n"]}
1
+ {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/SwitchField.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/SwitchField/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,YAAYA,WAAW;AACvB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,wBAAwB,QAAQ;AAIzC;;;AAGA,OAAO,MAAMC,sBAA2CJ,MAAMK,UAAU,CAAC,CAACC,OAAOC,QAAQ;EACvF,MAAMC,QAAQP,mBAAmBK,OAAOC;EAExCJ,yBAAyBK;EAEzB,OAAON,sBAAsBM;AAC/B;AAEAJ,OAAOK,WAAW,GAAG","names":["React","useSwitch_unstable","renderSwitch_unstable","useSwitchStyles_unstable","Switch","forwardRef","props","ref","state","displayName"],"sources":["../../../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"]}
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":"","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"]}
@@ -1,2 +1,2 @@
1
- import * as React from 'react';
1
+ export {};
2
2
  //# sourceMappingURL=Switch.types.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,YAAYA,WAAW","names":["React"],"sources":["../../../src/components/Switch/Switch.types.ts"],"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<\n ComponentProps<Partial<SwitchSlots>, 'input'>,\n 'checked' | 'defaultChecked' | 'onChange'\n> & {\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"]}
1
+ {"version":3,"file":"Switch.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/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<\n ComponentProps<Partial<SwitchSlots>, 'input'>,\n 'checked' | 'defaultChecked' | 'onChange'\n> & {\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"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","names":[],"sources":["../../../src/components/Switch/index.ts"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@swc/helpers/src/_extends.mjs";
2
1
  import * as React from 'react';
3
2
  import { getSlots } from '@fluentui/react-utilities';
4
3
  /**
@@ -12,6 +11,16 @@ export const renderSwitch_unstable = state => {
12
11
  const {
13
12
  labelPosition
14
13
  } = state;
15
- return /*#__PURE__*/React.createElement(slots.root, _extends({}, slotProps.root), /*#__PURE__*/React.createElement(slots.input, _extends({}, slotProps.input)), labelPosition !== 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, _extends({}, slotProps.label)), /*#__PURE__*/React.createElement(slots.indicator, _extends({}, slotProps.indicator)), labelPosition === 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, _extends({}, 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
24
+ }));
16
25
  };
17
26
  //# sourceMappingURL=renderSwitch.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";AAAA,YAAYA,WAAW;AACvB,SAASC,QAAQ,QAAQ;AAGzB;;;AAGA,OAAO,MAAMC,wBAAyBC,SAAuB;EAC3D,MAAM;IAAEC;IAAOC;EAAS,CAAE,GAAGJ,SAAsBE;EACnD,MAAM;IAAEG;EAAa,CAAE,GAAGH;EAE1B,oBACEH,oBAACI,MAAMG,IAAI,eAAKF,UAAUE,IAAI,gBAC5BP,oBAACI,MAAMI,KAAK,eAAKH,UAAUG,KAAK,IAC/BF,kBAAkB,WAAWF,MAAMK,KAAK,iBAAIT,oBAACI,MAAMK,KAAK,eAAKJ,UAAUI,KAAK,iBAC7ET,oBAACI,MAAMM,SAAS,eAAKL,UAAUK,SAAS,IACvCJ,kBAAkB,WAAWF,MAAMK,KAAK,iBAAIT,oBAACI,MAAMK,KAAK,eAAKJ,UAAUI,KAAK;AAGnF","names":["React","getSlots","renderSwitch_unstable","state","slots","slotProps","labelPosition","root","input","label","indicator"],"sources":["../../../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"]}
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":"","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"]}
@@ -53,11 +53,9 @@ export const useSwitch_unstable = (props, ref) => {
53
53
  },
54
54
  required: true
55
55
  });
56
- input.onChange = mergeCallbacks(input.onChange, ev => {
57
- return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
58
- checked: ev.currentTarget.checked
59
- });
60
- });
56
+ input.onChange = mergeCallbacks(input.onChange, ev => onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
57
+ checked: ev.currentTarget.checked
58
+ }));
61
59
  const label = resolveShorthand(props.label, {
62
60
  defaultProps: {
63
61
  disabled,
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,YAAYA,WAAW;AACvB,SAASC,YAAY,QAAQ;AAC7B,SAASC,KAAK,QAAQ;AACtB,SAASC,cAAc,QAAQ;AAC/B,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ;AAGnF;;;;;;;;;AASA,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC,QAAkD;EACvG,MAAM;IAAEC;IAASC;IAAgBC;IAAUC,gBAAgB;IAASC;IAAUC;EAAQ,CAAE,GAAGP;EAE3F,MAAMQ,cAAcb,0BAA0B;IAC5CK;IACAS,oBAAoB;IACpBC,mBAAmB,CAAC,WAAW,kBAAkB;EACnD;EAEA,MAAMC,KAAKb,MAAM,WAAWU,YAAYI,OAAO,CAACD,EAAE;EAElD,MAAME,OAAOhB,iBAAiBG,MAAMa,IAAI,EAAE;IACxCC,cAAc;MAAEb,KAAKP;MAAkC,GAAGc,YAAYK;IAAK;IAC3EN,UAAU;EACZ;EAEA,MAAMQ,YAAYlB,iBAAiBG,MAAMe,SAAS,EAAE;IAClDD,cAAc;MACZ,eAAe,IAAI;MACnBE,uBAAUzB,oBAACC;IACb;IACAe,UAAU;EACZ;EAEA,MAAMU,QAAQpB,iBAAiBG,MAAMiB,KAAK,EAAE;IAC1CH,cAAc;MACZZ;MACAC;MACAQ;MACAV;MACAiB,MAAM;MACNC,MAAM;MACN,GAAGX,YAAYI;IACjB;IACAL,UAAU;EACZ;EACAU,MAAMX,QAAQ,GAAGV,eAAeqB,MAAMX,QAAQ,EAAEc;IAAMd,oEAAWc,IAAI;MAAElB,SAASkB,GAAGC,aAAa,CAACnB;IAAQ;;EAEzG,MAAMoB,QAAQzB,iBAAiBG,MAAMsB,KAAK,EAAE;IAC1CR,cAAc;MACZV;MACAmB,SAASZ;MACTJ;MACAiB,MAAM;IACR;EACF;EAEA,OAAO;IACLnB;IAEA;IACAoB,YAAY;MACVZ,MAAM;MACNE,WAAW;MACXE,OAAO;MACPK,OAAO7B;IACT;IAEAoB;IACAE;IACAE;IACAK;EACF;AACF","names":["React","CircleFilled","Label","useFocusWithin","getPartitionedNativeProps","mergeCallbacks","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"],"sources":["../../../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"]}
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,gBAAgB,CAACG,KAAK,CAACa,IAAI,EAAE;IACxCC,YAAY,EAAE;MAAEb,GAAG,EAAEP,cAAc,EAAkB;MAAE,GAAGc,WAAW,CAACK;IAAI,CAAE;IAC5EN,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMQ,SAAS,GAAGlB,gBAAgB,CAACG,KAAK,CAACe,SAAS,EAAE;IAClDD,YAAY,EAAE;MACZ,aAAa,EAAE,IAAI;MACnBE,QAAQ,eAAEzB,oBAACC,YAAY;KACxB;IACDe,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMU,KAAK,GAAGpB,gBAAgB,CAACG,KAAK,CAACiB,KAAK,EAAE;IAC1CH,YAAY,EAAE;MACZZ,OAAO;MACPC,cAAc;MACdQ,EAAE;MACFV,GAAG;MACHiB,IAAI,EAAE,QAAQ;MACdC,IAAI,EAAE,UAAU;MAChB,GAAGX,WAAW,CAACI;KAChB;IACDL,QAAQ,EAAE;GACX,CAAC;EACFU,KAAK,CAACX,QAAQ,GAAGV,cAAc,CAACqB,KAAK,CAACX,QAAQ,EAAEc,EAAE,IAAId,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAGc,EAAE,EAAE;IAAElB,OAAO,EAAEkB,EAAE,CAACC,aAAa,CAACnB;EAAO,CAAE,CAAC,CAAC;EAE5G,MAAMoB,KAAK,GAAGzB,gBAAgB,CAACG,KAAK,CAACsB,KAAK,EAAE;IAC1CR,YAAY,EAAE;MACZV,QAAQ;MACRmB,OAAO,EAAEZ,EAAE;MACXJ,QAAQ;MACRiB,IAAI,EAAE;;GAET,CAAC;EAEF,OAAO;IACLnB,aAAa;IAEb;IACAoB,UAAU,EAAE;MACVZ,IAAI,EAAE,KAAK;MACXE,SAAS,EAAE,KAAK;MAChBE,KAAK,EAAE,OAAO;MACdK,KAAK,EAAE7B;KACR;IAEDoB,IAAI;IACJE,SAAS;IACTE,KAAK;IACLK;GACD;AACH,CAAC","names":["React","CircleFilled","Label","useFocusWithin","getPartitionedNativeProps","mergeCallbacks","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":"","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"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,MAAM,QAAQ;AACvB,kCAAsCC,YAAY,EAAEC,UAAU,QAAQ;AAItE,OAAO,MAAMC,mBAAgD;EAC3DC,MAAM;EACNC,WAAW;EACXC,OAAO;EACPC,OAAO;AACT;AAEA;;;AAGA,OAAO,MAAMC,kBAAkBL,iBAAiBC,IAAI;AAEpD;AACA,MAAMK,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAEhC,MAAMI,oCAAuBC,6+EAO7B;AAEA,MAAMC,6BAAgBC;EAAAA;IAAAA;EAAAA;AAAAA;EAAAA;AAAAA,EAItB;AAEA,MAAMC,yCAA4BH,yxBA6BlC;AAEA,MAAMI,kCAAqBF;EAAAA;IAAAA;EAAAA;AAAAA;EAAAA;AAAAA,EAI3B;AAEA,MAAMG,qCAAwBL,6qIA+G9B;AAEA,MAAMM,8BAAiBJ;EAAAA;IAAAA;IAAAA;EAAAA;EAAAA;IAAAA;IAAAA;EAAAA;EAAAA;IAAAA;IAAAA;IAAAA;EAAAA;AAAAA;EAAAA;AAAAA,EAcvB;AAEA;AACA,MAAMK,8BAAiBL;EAAAA;IAAAA;IAAAA;IAAAA;IAAAA;IAAAA;IAAAA;IAAAA;EAAAA;EAAAA;IAAAA;IAAAA;IAAAA;EAAAA;EAAAA;IAAAA;EAAAA;EAAAA;IAAAA;EAAAA;AAAAA;EAAAA;AAAAA,EAsBvB;AAEA;;;AAGA,OAAO,MAAMM,2BAA4BC,SAAoC;EAC3E,MAAMC,oBAAoBX;EAC1B,MAAMY,aAAaV;EACnB,MAAMW,yBAAyBT;EAC/B,MAAMU,kBAAkBT;EACxB,MAAMU,qBAAqBT;EAC3B,MAAMU,cAAcT;EACpB,MAAMU,cAAcT;EAEpB,MAAM;IAAEd;IAAOwB;EAAa,CAAE,GAAGR;EAEjCA,MAAMnB,IAAI,CAAC4B,SAAS,GAAG/B,aACrBE,iBAAiBC,IAAI,EACrBoB,mBACAO,kBAAkB,WAAWN,WAAWQ,QAAQ,EAChDV,MAAMnB,IAAI,CAAC4B,SAAS;EAGtBT,MAAMlB,SAAS,CAAC2B,SAAS,GAAG/B,aAC1BE,iBAAiBE,SAAS,EAC1BqB,wBACAnB,SAASwB,kBAAkB,WAAWJ,gBAAgBO,UAAU,EAChEX,MAAMlB,SAAS,CAAC2B,SAAS;EAG3BT,MAAMjB,KAAK,CAAC0B,SAAS,GAAG/B,aACtBE,iBAAiBG,KAAK,EACtBsB,oBACArB,SAASsB,WAAW,CAACE,cAAc,EACnCR,MAAMjB,KAAK,CAAC0B,SAAS;EAGvB,IAAIT,MAAMhB,KAAK,EAAE;IACfgB,MAAMhB,KAAK,CAACyB,SAAS,GAAG/B,aACtBE,iBAAiBI,KAAK,EACtBuB,YAAYK,IAAI,EAChBL,WAAW,CAACC,cAAc,EAC1BR,MAAMhB,KAAK,CAACyB,SAAS;EAEzB;EAEA,OAAOT;AACT","names":["createFocusOutlineStyle","tokens","mergeClasses","shorthands","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","makeResetStyles","useRootStyles","makeStyles","useIndicatorBaseClassName","useIndicatorStyles","useInputBaseClassName","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","vertical","labelAbove","base"],"sources":["../../../src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\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\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\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\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\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\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\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\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\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\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\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/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\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\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
1
+ {"version":3,"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,kCAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAItF,OAAO,MAAMC,gBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGA,OAAO,MAAMC,eAAe,GAAGL,gBAAgB,CAACC,IAAI;AAEpD;AACA,MAAMK,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WAAW,GAAGD,yBAAyB;AAEzD,MAAMI,oBAAoB,gBAAG,6+EAO3B;AAEF,MAAMC,aAAa,gBAAG;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAIpB;AAEF,MAAMC,yBAAyB,gBAAG,yxBA6BhC;AAEF,MAAMC,kBAAkB,gBAAG;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAIzB;AAEF,MAAMC,qBAAqB,gBAAG,6qIA+G5B;AAEF,MAAMC,cAAc,gBAAG;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAcrB;AAEF;AACA,MAAMC,cAAc,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAsBrB;AAEF;;;AAGA,OAAO,MAAMC,wBAAwB,GAAIC,KAAkB,IAAiB;EAC1E,MAAMC,iBAAiB,GAAGT,oBAAoB,EAAE;EAChD,MAAMU,UAAU,GAAGT,aAAa,EAAE;EAClC,MAAMU,sBAAsB,GAAGT,yBAAyB,EAAE;EAC1D,MAAMU,eAAe,GAAGT,kBAAkB,EAAE;EAC5C,MAAMU,kBAAkB,GAAGT,qBAAqB,EAAE;EAClD,MAAMU,WAAW,GAAGT,cAAc,EAAE;EACpC,MAAMU,WAAW,GAAGT,cAAc,EAAE;EAEpC,MAAM;IAAEZ,KAAK;IAAEsB;EAAa,CAAE,GAAGR,KAAK;EAEtCA,KAAK,CAACjB,IAAI,CAAC0B,SAAS,GAAG7B,YAAY,CACjCE,gBAAgB,CAACC,IAAI,EACrBkB,iBAAiB,EACjBO,aAAa,KAAK,OAAO,IAAIN,UAAU,CAACQ,QAAQ,EAChDV,KAAK,CAACjB,IAAI,CAAC0B,SAAS,CACrB;EAEDT,KAAK,CAAChB,SAAS,CAACyB,SAAS,GAAG7B,YAAY,CACtCE,gBAAgB,CAACE,SAAS,EAC1BmB,sBAAsB,EACtBjB,KAAK,IAAIsB,aAAa,KAAK,OAAO,IAAIJ,eAAe,CAACO,UAAU,EAChEX,KAAK,CAAChB,SAAS,CAACyB,SAAS,CAC1B;EAEDT,KAAK,CAACf,KAAK,CAACwB,SAAS,GAAG7B,YAAY,CAClCE,gBAAgB,CAACG,KAAK,EACtBoB,kBAAkB,EAClBnB,KAAK,IAAIoB,WAAW,CAACE,aAAa,CAAC,EACnCR,KAAK,CAACf,KAAK,CAACwB,SAAS,CACtB;EAED,IAAIT,KAAK,CAACd,KAAK,EAAE;IACfc,KAAK,CAACd,KAAK,CAACuB,SAAS,GAAG7B,YAAY,CAClCE,gBAAgB,CAACI,KAAK,EACtBqB,WAAW,CAACK,IAAI,EAChBL,WAAW,CAACC,aAAa,CAAC,EAC1BR,KAAK,CAACd,KAAK,CAACuB,SAAS,CACtB;;EAGH,OAAOT,KAAK;AACd,CAAC","names":["createFocusOutlineStyle","tokens","mergeClasses","shorthands","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","useRootStyles","useIndicatorBaseClassName","useIndicatorStyles","useInputBaseClassName","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","vertical","labelAbove","base"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\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\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\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\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\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\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\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\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\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\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\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/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\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\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
@@ -1,4 +1,5 @@
1
- /* eslint-disable deprecation/deprecation */import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';
1
+ /* eslint-disable deprecation/deprecation */
2
+ import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';
2
3
  import { Switch, switchClassNames } from '../../Switch';
3
4
  /** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */
4
5
  export const switchFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(switchClassNames.root);
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,4CACA,SAA+BA,4BAA4B,EAAEC,mBAAmB,QAAQ;AAExF,SAASC,MAAM,EAAEC,gBAAgB,QAAqB;AAItD;AACA,OAAO,MAAMC,qCAAwBJ,6BAA6BG,iBAAiBE,IAAI;AACvF;AACA,OAAO,MAAMC,2BAAqDL,oBAAoBC","names":["getDeprecatedFieldClassNames","makeDeprecatedField","Switch","switchClassNames","switchFieldClassNames","root","SwitchField"],"sources":["../../../src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { Switch, switchClassNames, SwitchProps } from '../../Switch';\n\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport type SwitchFieldProps = DeprecatedFieldProps<SwitchProps>;\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const switchFieldClassNames = getDeprecatedFieldClassNames(switchClassNames.root);\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const SwitchField: ForwardRefComponent<SwitchFieldProps> = makeDeprecatedField(Switch);\n"]}
1
+ {"version":3,"mappings":"AAAA;AACA,SAA+BA,4BAA4B,EAAEC,mBAAmB,QAAQ,uBAAuB;AAE/G,SAASC,MAAM,EAAEC,gBAAgB,QAAqB,cAAc;AAIpE;AACA,OAAO,MAAMC,qBAAqB,gBAAGJ,4BAA4B,CAACG,gBAAgB,CAACE,IAAI,CAAC;AACxF;AACA,OAAO,MAAMC,WAAW,gBAA0CL,mBAAmB,CAACC,MAAM,CAAC","names":["getDeprecatedFieldClassNames","makeDeprecatedField","Switch","switchClassNames","switchFieldClassNames","root","SwitchField"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { Switch, switchClassNames, SwitchProps } from '../../Switch';\n\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport type SwitchFieldProps = DeprecatedFieldProps<SwitchProps>;\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const switchFieldClassNames = getDeprecatedFieldClassNames(switchClassNames.root);\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const SwitchField: ForwardRefComponent<SwitchFieldProps> = makeDeprecatedField(Switch);\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,cAAc","names":[],"sources":["../../../src/components/SwitchField/index.ts"],"sourcesContent":["export * from './SwitchField';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/SwitchField/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from './SwitchField';\n"]}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SACEA,MAAM,EACNC,qBAAqB;AACrB;AACAC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBC,kBAAkB,QACb;AAGP;AACA,SAASC,eAAeC,oBAAoB,EAAEC,qBAAqB,QAAQ","names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","SwitchField","SwitchField_unstable","switchFieldClassNames"],"sources":["../src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line deprecation/deprecation\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n} from './Switch';\nexport type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { SwitchField as SwitchField_unstable, switchFieldClassNames } from './SwitchField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { SwitchFieldProps as SwitchFieldProps_unstable } from './SwitchField';\n"]}
1
+ {"version":3,"mappings":"AAAA,SACEA,MAAM,EACNC,qBAAqB;AACrB;AACAC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBC,kBAAkB,QACb,UAAU;AAGjB;AACA,SAASC,WAAW,IAAIC,oBAAoB,EAAEC,qBAAqB,QAAQ,eAAe","names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","SwitchField","SwitchField_unstable","switchFieldClassNames"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line deprecation/deprecation\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n} from './Switch';\nexport type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { SwitchField as SwitchField_unstable, switchFieldClassNames } from './SwitchField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { SwitchFieldProps as SwitchFieldProps_unstable } from './SwitchField';\n"]}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/Switch/index"), exports);
7
- //# sourceMappingURL=Switch.js.map
8
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./components/Switch/index"), exports);
9
8
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/Switch.js"],"sourcesContent":["export * from './components/Switch/index';\n//# sourceMappingURL=Switch.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,kCAAkC"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/Switch.ts"],"sourcesContent":["export * from './components/Switch/index';\n"]}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/SwitchField/index"), exports);
7
- //# sourceMappingURL=SwitchField.js.map
8
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./components/SwitchField/index"), exports);
9
8
  //# sourceMappingURL=SwitchField.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/SwitchField.js"],"sourcesContent":["export * from './components/SwitchField/index';\n//# sourceMappingURL=SwitchField.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,uCAAuC"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/SwitchField.ts"],"sourcesContent":["export * from './components/SwitchField/index';\n"]}
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "Switch", {
6
- enumerable: true,
7
- get: ()=>Switch
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _useSwitch = require("./useSwitch");
12
- const _renderSwitch = require("./renderSwitch");
13
- const _useSwitchStyles = require("./useSwitchStyles");
14
- const Switch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
15
- const state = (0, _useSwitch.useSwitch_unstable)(props, ref);
16
- (0, _useSwitchStyles.useSwitchStyles_unstable)(state);
17
- return (0, _renderSwitch.renderSwitch_unstable)(state);
6
+ exports.Switch = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const useSwitch_1 = /*#__PURE__*/require("./useSwitch");
9
+ const renderSwitch_1 = /*#__PURE__*/require("./renderSwitch");
10
+ const useSwitchStyles_1 = /*#__PURE__*/require("./useSwitchStyles");
11
+ /**
12
+ * Switches enable users to trigger an option on or off through pressing the component.
13
+ */
14
+ exports.Switch = /*#__PURE__*/React.forwardRef((props, ref) => {
15
+ const state = useSwitch_1.useSwitch_unstable(props, ref);
16
+ useSwitchStyles_1.useSwitchStyles_unstable(state);
17
+ return renderSwitch_1.renderSwitch_unstable(state);
18
18
  });
19
- Switch.displayName = 'Switch'; //# sourceMappingURL=Switch.js.map
20
-
19
+ exports.Switch.displayName = 'Switch';
21
20
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Switch/Switch.js"],"sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles';\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */\nexport const Switch = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useSwitch_unstable(props, ref);\n useSwitchStyles_unstable(state);\n return renderSwitch_unstable(state);\n});\nSwitch.displayName = 'Switch';\n//# sourceMappingURL=Switch.js.map"],"names":["Switch","React","forwardRef","props","ref","state","useSwitch_unstable","useSwitchStyles_unstable","renderSwitch_unstable","displayName"],"mappings":";;;;+BAOaA;;aAAAA;;;6DAPU;2BACY;8BACG;iCACG;AAIlC,MAAMA,SAAS,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAClE,MAAMC,QAAQC,IAAAA,6BAAkB,EAACH,OAAOC;IACxCG,IAAAA,yCAAwB,EAACF;IACzB,OAAOG,IAAAA,mCAAqB,EAACH;AAC/B;AACAL,OAAOS,WAAW,GAAG,UACrB,kCAAkC"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,cAAM,gBAAqCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACtF,MAAMC,KAAK,GAAGC,8BAAkB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAE5CG,0CAAwB,CAACF,KAAK,CAAC;EAE/B,OAAOG,oCAAqB,CAACH,KAAK,CAAC;AACrC,CAAC,CAAC;AAEFL,cAAM,CAACS,WAAW,GAAG,QAAQ","names":["exports","React","forwardRef","props","ref","state","useSwitch_1","useSwitchStyles_1","renderSwitch_1","displayName"],"sourceRoot":"","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"]}
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
- //# sourceMappingURL=Switch.types.js.map
8
-
9
6
  //# sourceMappingURL=Switch.types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Switch/Switch.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=Switch.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,wCAAwC"}
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"","sources":[],"sourcesContent":[]}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./Switch"), exports);
7
- _exportStar(require("./Switch.types"), exports);
8
- _exportStar(require("./renderSwitch"), exports);
9
- _exportStar(require("./useSwitch"), exports);
10
- _exportStar(require("./useSwitchStyles"), exports);
11
- //# sourceMappingURL=index.js.map
12
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./Switch"), exports);
8
+ tslib_1.__exportStar(require("./Switch.types"), exports);
9
+ tslib_1.__exportStar(require("./renderSwitch"), exports);
10
+ tslib_1.__exportStar(require("./useSwitch"), exports);
11
+ tslib_1.__exportStar(require("./useSwitchStyles"), exports);
13
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Switch/index.js"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/index.ts"],"sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n"]}
@@ -1,20 +1,33 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "renderSwitch_unstable", {
6
- enumerable: true,
7
- get: ()=>renderSwitch_unstable
4
+ value: true
8
5
  });
9
- const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
10
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
11
- const _extends = require("@swc/helpers/lib/_extends.js").default;
12
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
13
- const _reactUtilities = require("@fluentui/react-utilities");
14
- const renderSwitch_unstable = (state)=>{
15
- const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
16
- const { labelPosition } = state;
17
- return /*#__PURE__*/ _react.createElement(slots.root, _extends({}, slotProps.root), /*#__PURE__*/ _react.createElement(slots.input, _extends({}, slotProps.input)), labelPosition !== 'after' && slots.label && /*#__PURE__*/ _react.createElement(slots.label, _extends({}, slotProps.label)), /*#__PURE__*/ _react.createElement(slots.indicator, _extends({}, slotProps.indicator)), labelPosition === 'after' && slots.label && /*#__PURE__*/ _react.createElement(slots.label, _extends({}, slotProps.label)));
18
- }; //# sourceMappingURL=renderSwitch.js.map
19
-
6
+ exports.renderSwitch_unstable = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ /**
10
+ * Render a Switch component by passing the state defined props to the appropriate slots.
11
+ */
12
+ const renderSwitch_unstable = state => {
13
+ const {
14
+ slots,
15
+ slotProps
16
+ } = react_utilities_1.getSlots(state);
17
+ const {
18
+ labelPosition
19
+ } = state;
20
+ return React.createElement(slots.root, {
21
+ ...slotProps.root
22
+ }, React.createElement(slots.input, {
23
+ ...slotProps.input
24
+ }), labelPosition !== 'after' && slots.label && React.createElement(slots.label, {
25
+ ...slotProps.label
26
+ }), React.createElement(slots.indicator, {
27
+ ...slotProps.indicator
28
+ }), labelPosition === 'after' && slots.label && React.createElement(slots.label, {
29
+ ...slotProps.label
30
+ }));
31
+ };
32
+ exports.renderSwitch_unstable = renderSwitch_unstable;
20
33
  //# sourceMappingURL=renderSwitch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Switch/renderSwitch.js"],"sourcesContent":["import _extends from \"@swc/helpers/src/_extends.mjs\";\nimport * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */\nexport const renderSwitch_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n const {\n labelPosition\n } = state;\n return /*#__PURE__*/React.createElement(slots.root, _extends({}, slotProps.root), /*#__PURE__*/React.createElement(slots.input, _extends({}, slotProps.input)), labelPosition !== 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, _extends({}, slotProps.label)), /*#__PURE__*/React.createElement(slots.indicator, _extends({}, slotProps.indicator)), labelPosition === 'after' && slots.label && /*#__PURE__*/React.createElement(slots.label, _extends({}, slotProps.label)));\n};\n//# sourceMappingURL=renderSwitch.js.map"],"names":["renderSwitch_unstable","state","slots","slotProps","getSlots","labelPosition","React","createElement","root","_extends","input","label","indicator"],"mappings":";;;;+BAMaA;;aAAAA;;;;yBANQ;6DACE;gCACE;AAIlB,MAAMA,wBAAwBC,CAAAA,QAAS;IAC5C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,MAAM,EACJI,cAAa,EACd,GAAGJ;IACJ,OAAO,WAAW,GAAEK,OAAMC,aAAa,CAACL,MAAMM,IAAI,EAAEC,SAAS,CAAC,GAAGN,UAAUK,IAAI,GAAG,WAAW,GAAEF,OAAMC,aAAa,CAACL,MAAMQ,KAAK,EAAED,SAAS,CAAC,GAAGN,UAAUO,KAAK,IAAIL,kBAAkB,WAAWH,MAAMS,KAAK,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACL,MAAMS,KAAK,EAAEF,SAAS,CAAC,GAAGN,UAAUQ,KAAK,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACL,MAAMU,SAAS,EAAEH,SAAS,CAAC,GAAGN,UAAUS,SAAS,IAAIP,kBAAkB,WAAWH,MAAMS,KAAK,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACL,MAAMS,KAAK,EAAEF,SAAS,CAAC,GAAGN,UAAUQ,KAAK;AACxe,GACA,wCAAwC"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,qBAAqB,GAAIC,KAAkB,IAAI;EAC1D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAcH,KAAK,CAAC;EACzD,MAAM;IAAEI;EAAa,CAAE,GAAGJ,KAAK;EAE/B,OACEK,oBAACJ,KAAK,CAACK,IAAI;IAAA,GAAKJ,SAAS,CAACI;EAAI,GAC5BD,oBAACJ,KAAK,CAACM,KAAK;IAAA,GAAKL,SAAS,CAACK;EAAK,EAAI,EACnCH,aAAa,KAAK,OAAO,IAAIH,KAAK,CAACO,KAAK,IAAIH,oBAACJ,KAAK,CAACO,KAAK;IAAA,GAAKN,SAAS,CAACM;EAAK,EAAI,EACjFH,oBAACJ,KAAK,CAACQ,SAAS;IAAA,GAAKP,SAAS,CAACO;EAAS,EAAI,EAC3CL,aAAa,KAAK,OAAO,IAAIH,KAAK,CAACO,KAAK,IAAIH,oBAACJ,KAAK,CAACO,KAAK;IAAA,GAAKN,SAAS,CAACM;EAAK,EAAI,CACtE;AAEjB,CAAC;AAZYE,6BAAqB","names":["renderSwitch_unstable","state","slots","slotProps","react_utilities_1","labelPosition","React","root","input","label","indicator","exports"],"sourceRoot":"","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"]}