@fluentui/react-switch 9.0.0-nightly.46b9ea7036.0 → 9.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +265 -30
- package/CHANGELOG.md +69 -17
- package/Spec.md +4 -4
- package/dist/react-switch.d.ts +14 -17
- package/lib/components/Switch/Switch.js +7 -7
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Switch/Switch.types.d.ts +10 -9
- package/lib/components/Switch/renderSwitch.d.ts +1 -1
- package/lib/components/Switch/renderSwitch.js +12 -8
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.d.ts +2 -6
- package/lib/components/Switch/useSwitch.js +21 -25
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitchState.js +48 -56
- package/lib/components/Switch/useSwitchState.js.map +1 -1
- package/lib/components/Switch/useSwitchStyles.d.ts +2 -1
- package/lib/components/Switch/useSwitchStyles.js +69 -63
- package/lib/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/Switch.js +1 -1
- package/lib-commonjs/components/Switch/Switch.js +8 -8
- package/lib-commonjs/components/Switch/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.types.d.ts +10 -9
- package/lib-commonjs/components/Switch/index.js +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.d.ts +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js +16 -14
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.d.ts +2 -6
- package/lib-commonjs/components/Switch/useSwitch.js +26 -31
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchState.js +51 -59
- package/lib-commonjs/components/Switch/useSwitchState.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +2 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.js +78 -71
- package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/package.json +10 -15
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
@@ -1,32 +1,32 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import type { ComponentProps, ComponentState,
|
2
|
+
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
3
3
|
export declare type SwitchSlots = {
|
4
4
|
/**
|
5
5
|
* The root of the Switch.
|
6
6
|
*/
|
7
|
-
root:
|
7
|
+
root: Slot<'div'>;
|
8
8
|
/**
|
9
9
|
* The bar indicating the status of the Switch.
|
10
10
|
*/
|
11
|
-
track:
|
11
|
+
track: NonNullable<Slot<'div'>>;
|
12
12
|
/**
|
13
13
|
* The wrapper around the thumb. It is used as the active area for the thumb to position itself.
|
14
14
|
*/
|
15
|
-
thumbWrapper:
|
15
|
+
thumbWrapper: NonNullable<Slot<'div'>>;
|
16
16
|
/**
|
17
17
|
* The circular icon indicating the status of the Switch.
|
18
18
|
*/
|
19
|
-
thumb:
|
19
|
+
thumb: NonNullable<Slot<'div'>>;
|
20
20
|
/**
|
21
21
|
* The hidden input that handles the Switch's internal functionality.
|
22
22
|
*/
|
23
|
-
input:
|
23
|
+
input: NonNullable<Slot<'input'>>;
|
24
24
|
/**
|
25
25
|
* The area in which the Switch's rail allows for the thumb to be dragged.
|
26
26
|
*/
|
27
|
-
activeRail:
|
27
|
+
activeRail: NonNullable<Slot<'div'>>;
|
28
28
|
};
|
29
|
-
|
29
|
+
interface SwitchCommons {
|
30
30
|
/**
|
31
31
|
* The starting value for a uncontrolled Switch. If `true` then the Switch will be enabled.
|
32
32
|
* Mutually exclusive with `checked` prop.
|
@@ -52,7 +52,8 @@ export interface SwitchCommons {
|
|
52
52
|
checked: boolean;
|
53
53
|
}) => void;
|
54
54
|
}
|
55
|
-
export interface SwitchProps extends Omit<ComponentProps<SwitchSlots
|
55
|
+
export interface SwitchProps extends Omit<ComponentProps<Partial<SwitchSlots>>, 'onChange'>, SwitchCommons {
|
56
56
|
}
|
57
57
|
export interface SwitchState extends ComponentState<SwitchSlots>, SwitchCommons {
|
58
58
|
}
|
59
|
+
export {};
|
@@ -1,16 +1,20 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
|
-
import { switchShorthandProps } from './useSwitch';
|
5
3
|
/**
|
6
4
|
* Render the final JSX of Switch
|
7
5
|
*/
|
8
6
|
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
7
|
+
export const renderSwitch_unstable = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state);
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
13
|
+
}, /*#__PURE__*/React.createElement(slots.track, { ...slotProps.track
|
14
|
+
}), /*#__PURE__*/React.createElement(slots.thumbWrapper, { ...slotProps.thumbWrapper
|
15
|
+
}, /*#__PURE__*/React.createElement(slots.thumb, { ...slotProps.thumb
|
16
|
+
})), /*#__PURE__*/React.createElement(slots.input, { ...slotProps.input
|
17
|
+
}), /*#__PURE__*/React.createElement(slots.activeRail, { ...slotProps.activeRail
|
18
|
+
}));
|
15
19
|
};
|
16
20
|
//# sourceMappingURL=renderSwitch.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Switch/renderSwitch.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../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;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAc,KAAd,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CADF,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,YAAP,EAAmB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAnB,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CADF,CAFF,eAKE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CALF,eAME,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAjB,CANF,CADF;AAUD,CAbM","sourceRoot":""}
|
@@ -1,10 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import type { SwitchProps,
|
3
|
-
/**
|
4
|
-
* Array of all shorthand properties listed in SwitchSlots
|
5
|
-
*/
|
6
|
-
export declare const switchShorthandProps: (keyof SwitchSlots)[];
|
2
|
+
import type { SwitchProps, SwitchState } from './Switch.types';
|
7
3
|
/**
|
8
4
|
* Given user props, returns state and render function for a Switch.
|
9
5
|
*/
|
10
|
-
export declare const
|
6
|
+
export declare const useSwitch_unstable: (props: SwitchProps, ref: React.Ref<HTMLElement>) => SwitchState;
|
@@ -1,35 +1,31 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
3
2
|
import { useSwitchState } from './useSwitchState';
|
4
|
-
/**
|
5
|
-
* Array of all shorthand properties listed in SwitchSlots
|
6
|
-
*/
|
7
|
-
|
8
|
-
export var switchShorthandProps = ['root', 'track', 'thumbWrapper', 'thumb', 'activeRail', 'input'];
|
9
3
|
/**
|
10
4
|
* Given user props, returns state and render function for a Switch.
|
11
5
|
*/
|
12
6
|
|
13
|
-
export
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
export const useSwitch_unstable = (props, ref) => {
|
8
|
+
const {
|
9
|
+
track,
|
10
|
+
thumbWrapper,
|
11
|
+
thumb,
|
12
|
+
activeRail,
|
13
|
+
input,
|
14
|
+
defaultChecked,
|
15
|
+
checked,
|
16
|
+
disabled,
|
17
|
+
onChange
|
18
|
+
} = props;
|
19
|
+
const state = {
|
20
|
+
defaultChecked,
|
21
|
+
checked,
|
22
|
+
disabled,
|
23
|
+
onChange,
|
24
|
+
root: getNativeElementProps('span', {
|
25
|
+
ref,
|
26
|
+
...props,
|
31
27
|
id: useId('switch-', props.id)
|
32
|
-
})
|
28
|
+
}),
|
33
29
|
components: {
|
34
30
|
root: 'div',
|
35
31
|
track: 'div',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Switch/useSwitch.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/Switch/useSwitch.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAGA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAAC,KAAD,EAAqB,GAArB,KAAiE;AACjG,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA,YAAT;A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AD,CAAd;AAEA,SAAO,KAAP;AACD,CAnCM","sourceRoot":""}
|
@@ -3,51 +3,43 @@ import { clamp, useBoolean, useControllableState, useEventCallback, useMergedRef
|
|
3
3
|
import { useFluent } from '@fluentui/react-shared-contexts'; // TODO: This should be replaced with a useEvent hook
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5
5
|
|
6
|
-
|
6
|
+
const on = (element, eventName, callback) => {
|
7
7
|
element.addEventListener(eventName, callback);
|
8
|
-
return
|
9
|
-
return element.removeEventListener(eventName, callback);
|
10
|
-
};
|
8
|
+
return () => element.removeEventListener(eventName, callback);
|
11
9
|
};
|
12
10
|
|
13
|
-
export
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
11
|
+
export const useSwitchState = state => {
|
12
|
+
const {
|
13
|
+
defaultChecked = false,
|
14
|
+
checked,
|
15
|
+
disabled = false,
|
16
|
+
onChange
|
17
|
+
} = state;
|
18
|
+
const {
|
19
|
+
onPointerDown: onPointerDownCallback,
|
20
|
+
onKeyUp: onKeyUpCallback
|
21
|
+
} = state.root;
|
22
|
+
const {
|
23
|
+
dir
|
24
|
+
} = useFluent();
|
25
|
+
const inputRef = useMergedRefs(state.input.ref);
|
26
|
+
const railRef = React.useRef(null);
|
27
|
+
const internalState = React.useRef({
|
27
28
|
internalValue: checked ? checked : defaultChecked,
|
28
29
|
thumbIsDragging: false,
|
29
30
|
disposables: []
|
30
31
|
});
|
31
|
-
|
32
|
-
var _d = useControllableState({
|
32
|
+
const [currentValue, setCurrentValue] = useControllableState({
|
33
33
|
defaultState: defaultChecked,
|
34
34
|
state: checked,
|
35
35
|
initialState: false
|
36
|
-
})
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
showThumbAnimation = _f.setTrue,
|
44
|
-
hideThumbAnimation = _f.setFalse;
|
45
|
-
|
46
|
-
var _g = React.useState(currentValue === true ? 100 : 0),
|
47
|
-
renderedPosition = _g[0],
|
48
|
-
setRenderedPosition = _g[1];
|
49
|
-
|
50
|
-
var setChecked = useEventCallback(function (ev, incomingValue) {
|
36
|
+
});
|
37
|
+
const [thumbAnimation, {
|
38
|
+
setTrue: showThumbAnimation,
|
39
|
+
setFalse: hideThumbAnimation
|
40
|
+
}] = useBoolean(true);
|
41
|
+
const [renderedPosition, setRenderedPosition] = React.useState(currentValue === true ? 100 : 0);
|
42
|
+
const setChecked = useEventCallback((ev, incomingValue) => {
|
51
43
|
ev.stopPropagation();
|
52
44
|
ev.preventDefault();
|
53
45
|
internalState.current.internalValue = incomingValue;
|
@@ -57,17 +49,17 @@ export var useSwitchState = function (state) {
|
|
57
49
|
setCurrentValue(incomingValue);
|
58
50
|
setRenderedPosition(undefined);
|
59
51
|
});
|
60
|
-
|
52
|
+
const calculatePosition = React.useCallback(ev => {
|
61
53
|
var _a;
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
55
|
+
const currentBounds = (_a = railRef === null || railRef === void 0 ? void 0 : railRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
56
|
+
const railWidth = currentBounds.width;
|
57
|
+
const railPosition = dir === 'rtl' ? currentBounds.right : currentBounds.left;
|
58
|
+
const distance = dir === 'rtl' ? railPosition - ev.clientX : ev.clientX - railPosition;
|
67
59
|
return clamp(distance / railWidth * 100, 0, 100);
|
68
60
|
}, [dir]);
|
69
|
-
|
70
|
-
|
61
|
+
const onPointerMove = React.useCallback(ev => {
|
62
|
+
const incomingPosition = calculatePosition(ev);
|
71
63
|
internalState.current.thumbIsDragging = true;
|
72
64
|
hideThumbAnimation();
|
73
65
|
setRenderedPosition(incomingPosition); // If the Switch reaches a new position of 0% or 100%, update the state and fire change.
|
@@ -78,15 +70,13 @@ export var useSwitchState = function (state) {
|
|
78
70
|
setChecked(ev, false);
|
79
71
|
}
|
80
72
|
}, [calculatePosition, hideThumbAnimation, setChecked]);
|
81
|
-
|
82
|
-
internalState.current.disposables.forEach(
|
83
|
-
return dispose();
|
84
|
-
});
|
73
|
+
const onPointerUp = React.useCallback(ev => {
|
74
|
+
internalState.current.disposables.forEach(dispose => dispose());
|
85
75
|
internalState.current.disposables = [];
|
86
76
|
inputRef.current.focus();
|
87
77
|
|
88
78
|
if (internalState.current.thumbIsDragging) {
|
89
|
-
|
79
|
+
const roundedPosition = Math.round(calculatePosition(ev) / 100) * 100;
|
90
80
|
showThumbAnimation();
|
91
81
|
|
92
82
|
if (roundedPosition === 100) {
|
@@ -98,35 +88,37 @@ export var useSwitchState = function (state) {
|
|
98
88
|
setChecked(ev, !internalState.current.internalValue);
|
99
89
|
}
|
100
90
|
}, [calculatePosition, inputRef, setChecked, showThumbAnimation]);
|
101
|
-
|
91
|
+
const onPointerDown = React.useCallback(ev => {
|
102
92
|
var _a;
|
103
93
|
|
104
|
-
|
105
|
-
|
94
|
+
const {
|
95
|
+
pointerId
|
96
|
+
} = ev;
|
97
|
+
const target = ev.target;
|
106
98
|
onPointerDownCallback === null || onPointerDownCallback === void 0 ? void 0 : onPointerDownCallback(ev);
|
107
99
|
showThumbAnimation();
|
108
100
|
(_a = target.setPointerCapture) === null || _a === void 0 ? void 0 : _a.call(target, pointerId);
|
109
101
|
internalState.current.thumbIsDragging = false;
|
110
|
-
internalState.current.disposables.push(on(target, 'pointermove', onPointerMove), on(target, 'pointerup', onPointerUp),
|
102
|
+
internalState.current.disposables.push(on(target, 'pointermove', onPointerMove), on(target, 'pointerup', onPointerUp), () => {
|
111
103
|
var _a;
|
112
104
|
|
113
105
|
(_a = target.releasePointerCapture) === null || _a === void 0 ? void 0 : _a.call(target, pointerId);
|
114
106
|
});
|
115
107
|
}, [onPointerDownCallback, onPointerMove, onPointerUp, showThumbAnimation]);
|
116
|
-
|
108
|
+
const onKeyUp = React.useCallback(ev => {
|
117
109
|
onKeyUpCallback === null || onKeyUpCallback === void 0 ? void 0 : onKeyUpCallback(ev);
|
118
110
|
|
119
111
|
if (ev.key === ' ') {
|
120
112
|
setChecked(ev, !internalState.current.internalValue);
|
121
113
|
}
|
122
114
|
}, [onKeyUpCallback, setChecked]);
|
123
|
-
|
124
|
-
|
115
|
+
const currentPosition = renderedPosition !== undefined ? renderedPosition : currentValue ? 100 : 0;
|
116
|
+
const rootStyles = {
|
125
117
|
'--switch-checked-opacity': currentPosition / 100,
|
126
118
|
'--switch-unchecked-opacity': (100 - currentPosition) / 100
|
127
119
|
};
|
128
|
-
|
129
|
-
transform:
|
120
|
+
const thumbWrapperStyles = {
|
121
|
+
transform: `translate(${dir === 'rtl' ? -currentPosition : currentPosition}%)`,
|
130
122
|
transition: thumbAnimation ? 'transform .1s cubic-bezier(0.33, 0.0, 0.67, 1), opacity .1s cubic-bezier(0.33, 0.0, 0.67, 1)' : 'none'
|
131
123
|
}; // Root Props
|
132
124
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Switch/useSwitchState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,KAAT,EAAgB,UAAhB,EAA4B,oBAA5B,EAAkD,gBAAlD,EAAoE,aAApE,QAAyF,2BAAzF;AACA,SAAS,SAAT,QAA0B,iCAA1B,C,CAoBA;AACA;;AACA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Switch/useSwitchState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,KAAT,EAAgB,UAAhB,EAA4B,oBAA5B,EAAkD,gBAAlD,EAAoE,aAApE,QAAyF,2BAAzF;AACA,SAAS,SAAT,QAA0B,iCAA1B,C,CAoBA;AACA;;AACA,MAAM,EAAE,GAAG,CAAC,OAAD,EAAmB,SAAnB,EAAsC,QAAtC,KAAqE;AAC9E,EAAA,OAAO,CAAC,gBAAR,CAAyB,SAAzB,EAAoC,QAApC;AACA,SAAO,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1,5 +1,6 @@
|
|
1
1
|
import type { SwitchState } from './Switch.types';
|
2
|
+
export declare const switchClassName = "fui-Switch";
|
2
3
|
/**
|
3
4
|
* Apply styling to the Switch slots based on the state
|
4
5
|
*/
|
5
|
-
export declare const
|
6
|
+
export declare const useSwitchStyles_unstable: (state: SwitchState) => SwitchState;
|