@bitrise/bitkit 13.125.1-alpha.1 → 13.126.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FormControl,
|
|
4
4
|
FormControlProps,
|
|
@@ -15,11 +15,7 @@ import Skeleton from '../Skeleton/Skeleton';
|
|
|
15
15
|
import SkeletonBox from '../Skeleton/SkeletonBox';
|
|
16
16
|
import ToggleComponent from './ToggleComponent';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
| { variant?: undefined; label?: ReactNode }
|
|
20
|
-
| { variant: 'dynamic'; label?: ReactNode }
|
|
21
|
-
| { variant: 'fixed'; label: ReactNode };
|
|
22
|
-
export type ToggleProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> & {
|
|
18
|
+
export interface ToggleProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
|
|
23
19
|
'data-testid'?: string;
|
|
24
20
|
defaultChecked?: SwitchProps['defaultChecked'];
|
|
25
21
|
id?: SwitchProps['id'];
|
|
@@ -27,25 +23,26 @@ export type ToggleProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'
|
|
|
27
23
|
isDisabled?: SwitchProps['isDisabled'];
|
|
28
24
|
isLoading?: boolean;
|
|
29
25
|
helperText?: ReactNode;
|
|
26
|
+
label: ReactNode;
|
|
30
27
|
name?: string;
|
|
31
28
|
onBlur?: SwitchProps['onBlur'];
|
|
32
29
|
onChange?: SwitchProps['onChange'];
|
|
33
30
|
tooltip?: Omit<TooltipProps, 'children'>;
|
|
34
31
|
value?: SwitchProps['value'];
|
|
35
32
|
valueText?: ReactNode;
|
|
36
|
-
|
|
33
|
+
variant?: 'dynamic' | 'fixed';
|
|
34
|
+
}
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* The Toggle component is used as an alternative for the checkbox component.
|
|
40
38
|
*/
|
|
41
39
|
const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
|
|
42
|
-
const fallbackId = useId();
|
|
43
40
|
const {
|
|
44
41
|
'aria-label': ariaLabel,
|
|
45
42
|
'data-testid': dataTestid,
|
|
46
43
|
defaultChecked,
|
|
47
44
|
helperText,
|
|
48
|
-
id
|
|
45
|
+
id,
|
|
49
46
|
isChecked,
|
|
50
47
|
isDisabled,
|
|
51
48
|
isInvalid,
|
|
@@ -61,7 +58,6 @@ const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
|
|
|
61
58
|
variant = 'dynamic',
|
|
62
59
|
...rest
|
|
63
60
|
} = props;
|
|
64
|
-
const id = externalId || fallbackId;
|
|
65
61
|
const size: 'sm' | 'md' = variant === 'dynamic' ? 'md' : 'sm';
|
|
66
62
|
const css = useMultiStyleConfig('Switch', { withTooltip: !!tooltip, size, variant });
|
|
67
63
|
const formControlProps = {
|