@cloud-ru/ds-toggles 1.0.0 → 1.0.1-preview-5c3d69b8.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/README.md +4 -0
- package/dist/cjs/components/Switch/Switch.d.ts +5 -2
- package/dist/cjs/components/Switch/Switch.js +2 -2
- package/dist/esm/components/Switch/Switch.d.ts +5 -2
- package/dist/esm/components/Switch/Switch.js +2 -2
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/Switch/Switch.tsx +6 -2
|
@@ -9,7 +9,10 @@ import { ToggleProps } from '../../types';
|
|
|
9
9
|
import { getIconSize, getVisualStateAttributes } from '../../utils';
|
|
10
10
|
import styles from './styles.module.scss';
|
|
11
11
|
|
|
12
|
-
export type SwitchProps = ToggleProps
|
|
12
|
+
export type SwitchProps = ToggleProps & {
|
|
13
|
+
/** Показывать ли иконку внутри ползунка. Спиннер в состоянии `loading` показывается независимо */
|
|
14
|
+
showIcon?: boolean;
|
|
15
|
+
};
|
|
13
16
|
|
|
14
17
|
const SPINNER_SIZE_MAP = {
|
|
15
18
|
[SIZE.XS]: LOADER_SIZE.XS,
|
|
@@ -35,6 +38,7 @@ export function Switch({
|
|
|
35
38
|
onFocus,
|
|
36
39
|
disabled = false,
|
|
37
40
|
loading = false,
|
|
41
|
+
showIcon = false,
|
|
38
42
|
size = SIZE.S,
|
|
39
43
|
className,
|
|
40
44
|
'data-test-id': dataTestId,
|
|
@@ -63,7 +67,7 @@ export function Switch({
|
|
|
63
67
|
<div className={styles.backgroundStateLayer} data-state='emptyDarkOnAccent' />
|
|
64
68
|
<div className={styles.flag}>
|
|
65
69
|
<div className={styles.surface} {...stateDataAttributes}>
|
|
66
|
-
<Icon size={size} loading={Boolean(loading)} />
|
|
70
|
+
{(showIcon || loading) && <Icon size={size} loading={Boolean(loading)} />}
|
|
67
71
|
</div>
|
|
68
72
|
</div>
|
|
69
73
|
</div>
|