@alfalab/core-components-switch 2.0.0 → 2.2.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.md CHANGED
@@ -3,31 +3,54 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [2.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@1.7.7...@alfalab/core-components-switch@2.0.0) (2021-07-08)
6
+ ## [2.2.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@2.2.0...@alfalab/core-components-switch@2.2.1) (2021-12-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * актуализируем @alfalab/utils ([#897](https://github.com/alfa-laboratory/core-components/issues/897)) ([30fb88e](https://github.com/alfa-laboratory/core-components/commit/30fb88eee36f68cabf80069e5125d911fabde4a5))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.2.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@2.1.0...@alfalab/core-components-switch@2.2.0) (2021-08-03)
7
18
 
8
19
 
9
20
  ### Features
10
21
 
11
- * upgrade storybook ([#696](https://github.com/alfa-laboratory/core-components/issues/696)) ([bf8350e](https://github.com/alfa-laboratory/core-components/commit/bf8350ebfd238b6c63ac30545ac32ca933f498d6)), closes [#708](https://github.com/alfa-laboratory/core-components/issues/708) [#707](https://github.com/alfa-laboratory/core-components/issues/707) [#714](https://github.com/alfa-laboratory/core-components/issues/714) [#716](https://github.com/alfa-laboratory/core-components/issues/716) [#690](https://github.com/alfa-laboratory/core-components/issues/690) [#701](https://github.com/alfa-laboratory/core-components/issues/701) [#699](https://github.com/alfa-laboratory/core-components/issues/699) [#698](https://github.com/alfa-laboratory/core-components/issues/698) [#693](https://github.com/alfa-laboratory/core-components/issues/693) [#699](https://github.com/alfa-laboratory/core-components/issues/699) [#698](https://github.com/alfa-laboratory/core-components/issues/698) [#693](https://github.com/alfa-laboratory/core-components/issues/693) [#705](https://github.com/alfa-laboratory/core-components/issues/705) [#705](https://github.com/alfa-laboratory/core-components/issues/705) [#709](https://github.com/alfa-laboratory/core-components/issues/709) [#703](https://github.com/alfa-laboratory/core-components/issues/703) [#695](https://github.com/alfa-laboratory/core-components/issues/695) [#673](https://github.com/alfa-laboratory/core-components/issues/673) [#703](https://github.com/alfa-laboratory/core-components/issues/703) [#709](https://github.com/alfa-laboratory/core-components/issues/709) [#673](https://github.com/alfa-laboratory/core-components/issues/673) [#695](https://github.com/alfa-laboratory/core-components/issues/695) [#645](https://github.com/alfa-laboratory/core-components/issues/645) [#642](https://github.com/alfa-laboratory/core-components/issues/642) [#642](https://github.com/alfa-laboratory/core-components/issues/642) [#646](https://github.com/alfa-laboratory/core-components/issues/646) [#646](https://github.com/alfa-laboratory/core-components/issues/646) [#634](https://github.com/alfa-laboratory/core-components/issues/634) [#635](https://github.com/alfa-laboratory/core-components/issues/635) [#634](https://github.com/alfa-laboratory/core-components/issues/634) [#635](https://github.com/alfa-laboratory/core-components/issues/635) [#648](https://github.com/alfa-laboratory/core-components/issues/648) [#647](https://github.com/alfa-laboratory/core-components/issues/647) [#630](https://github.com/alfa-laboratory/core-components/issues/630) [#648](https://github.com/alfa-laboratory/core-components/issues/648) [#630](https://github.com/alfa-laboratory/core-components/issues/630) [#669](https://github.com/alfa-laboratory/core-components/issues/669) [#712](https://github.com/alfa-laboratory/core-components/issues/712) [#713](https://github.com/alfa-laboratory/core-components/issues/713) [#719](https://github.com/alfa-laboratory/core-components/issues/719) [#720](https://github.com/alfa-laboratory/core-components/issues/720) [#718](https://github.com/alfa-laboratory/core-components/issues/718) [#712](https://github.com/alfa-laboratory/core-components/issues/712) [#713](https://github.com/alfa-laboratory/core-components/issues/713) [#719](https://github.com/alfa-laboratory/core-components/issues/719) [#642](https://github.com/alfa-laboratory/core-components/issues/642) [#642](https://github.com/alfa-laboratory/core-components/issues/642) [#646](https://github.com/alfa-laboratory/core-components/issues/646) [#646](https://github.com/alfa-laboratory/core-components/issues/646) [#634](https://github.com/alfa-laboratory/core-components/issues/634) [#635](https://github.com/alfa-laboratory/core-components/issues/635) [#634](https://github.com/alfa-laboratory/core-components/issues/634) [#635](https://github.com/alfa-laboratory/core-components/issues/635) [#648](https://github.com/alfa-laboratory/core-components/issues/648) [#647](https://github.com/alfa-laboratory/core-components/issues/647) [#630](https://github.com/alfa-laboratory/core-components/issues/630) [#648](https://github.com/alfa-laboratory/core-components/issues/648) [#630](https://github.com/alfa-laboratory/core-components/issues/630) [#669](https://github.com/alfa-laboratory/core-components/issues/669) [#720](https://github.com/alfa-laboratory/core-components/issues/720) [#718](https://github.com/alfa-laboratory/core-components/issues/718) [#691](https://github.com/alfa-laboratory/core-components/issues/691) [#691](https://github.com/alfa-laboratory/core-components/issues/691) [#723](https://github.com/alfa-laboratory/core-components/issues/723) [#702](https://github.com/alfa-laboratory/core-components/issues/702) [#723](https://github.com/alfa-laboratory/core-components/issues/723) [#702](https://github.com/alfa-laboratory/core-components/issues/702) [#708](https://github.com/alfa-laboratory/core-components/issues/708) [#707](https://github.com/alfa-laboratory/core-components/issues/707) [#714](https://github.com/alfa-laboratory/core-components/issues/714) [#722](https://github.com/alfa-laboratory/core-components/issues/722)
22
+ * add inactive controls (PDS-266) ([#765](https://github.com/alfa-laboratory/core-components/issues/765)) ([ec02c89](https://github.com/alfa-laboratory/core-components/commit/ec02c89ab6bf038c026ca0a72b3185525334840a))
12
23
 
13
24
 
14
- ### BREAKING CHANGES
15
25
 
16
- * buttonRetryText renamed to buttonReturnText
17
26
 
18
- Co-authored-by: Alexander Soldatov <aesoldatov@alfabank.ru>
19
- * inline-block changes to block
20
27
 
21
- * chore(release): 18.0.0 [skip ci]
28
+ # [2.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@2.0.1...@alfalab/core-components-switch@2.1.0) (2021-07-23)
22
29
 
23
- # [18.0.0](https://github.com/alfa-laboratory/core-components/compare/v17.6.0...v18.0.0) (2021-06-28)
24
30
 
25
- ### Bug Fixes
31
+ ### Features
32
+
33
+ * checkbox/radio/switch design updates (PDS-252) ([#735](https://github.com/alfa-laboratory/core-components/issues/735)) ([62f3c63](https://github.com/alfa-laboratory/core-components/commit/62f3c63279872a80ffb1c018b08addf897597b26))
26
34
 
27
35
 
28
36
 
29
37
 
30
38
 
39
+ ## [2.0.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@2.0.0...@alfalab/core-components-switch@2.0.1) (2021-07-09)
40
+
41
+ **Note:** Version bump only for package @alfalab/core-components-switch
42
+
43
+
44
+
45
+
46
+
47
+ # [2.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@1.7.7...@alfalab/core-components-switch@2.0.0) (2021-07-08)
48
+
49
+
50
+ ### Features
51
+
52
+ * upgrade storybook ([#696](https://github.com/alfa-laboratory/core-components/issues/696))
53
+
31
54
  ## [1.7.7](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-switch@1.7.6...@alfalab/core-components-switch@1.7.7) (2021-04-26)
32
55
 
33
56
  **Note:** Version bump only for package @alfalab/core-components-switch
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { InputHTMLAttributes, ChangeEvent, ReactNode } from "react";
4
4
  type Align = 'start' | 'center';
5
- type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange'> & {
5
+ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange' | 'disabled'> & {
6
6
  /**
7
7
  * Управление состоянием вкл/выкл компонента
8
8
  */
@@ -31,6 +31,14 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
31
31
  * Растягивать ли компонент на всю ширину
32
32
  */
33
33
  block?: boolean;
34
+ /**
35
+ * Управление состоянием включен / выключен
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * Управление состоянием активен / неактивен
40
+ */
41
+ inactive?: boolean;
34
42
  /**
35
43
  * Обработчик переключения компонента
36
44
  */
@@ -43,7 +51,7 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
43
51
  */
44
52
  dataTestId?: string;
45
53
  };
46
- declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
54
+ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
47
55
  /**
48
56
  * Управление состоянием вкл/выкл компонента
49
57
  */
@@ -72,6 +80,14 @@ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttrib
72
80
  * Растягивать ли компонент на всю ширину
73
81
  */
74
82
  block?: boolean | undefined;
83
+ /**
84
+ * Управление состоянием включен / выключен
85
+ */
86
+ disabled?: boolean | undefined;
87
+ /**
88
+ * Управление состоянием активен / неактивен
89
+ */
90
+ inactive?: boolean | undefined;
75
91
  /**
76
92
  * Обработчик переключения компонента
77
93
  */
package/dist/Component.js CHANGED
@@ -52,12 +52,12 @@ function __rest(s, e) {
52
52
  return t;
53
53
  }
54
54
 
55
- var styles = {"component":"switch__component_180ay","start":"switch__start_180ay","center":"switch__center_180ay","addons":"switch__addons_180ay","block":"switch__block_180ay","switch":"switch__switch_180ay","content":"switch__content_180ay","label":"switch__label_180ay","hint":"switch__hint_180ay","reversed":"switch__reversed_180ay","checked":"switch__checked_180ay","disabled":"switch__disabled_180ay","focused":"switch__focused_180ay"};
55
+ var styles = {"component":"switch__component_k3m9x","start":"switch__start_k3m9x","center":"switch__center_k3m9x","addons":"switch__addons_k3m9x","block":"switch__block_k3m9x","switch":"switch__switch_k3m9x","content":"switch__content_k3m9x","label":"switch__label_k3m9x","hint":"switch__hint_k3m9x","reversed":"switch__reversed_k3m9x","checked":"switch__checked_k3m9x","disabled":"switch__disabled_k3m9x","inactive":"switch__inactive_k3m9x","focused":"switch__focused_k3m9x"};
56
56
  require('./index.css')
57
57
 
58
58
  var Switch = React.forwardRef(function (_a, ref) {
59
59
  var _b;
60
- var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
60
+ var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, inactive = _a.inactive, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "inactive", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
61
61
  var labelRef = React.useRef(null);
62
62
  var focused = hooks.useFocus(labelRef, 'keyboard')[0];
63
63
  var handleChange = React.useCallback(function (e) {
@@ -69,12 +69,13 @@ var Switch = React.forwardRef(function (_a, ref) {
69
69
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
70
70
  React__default['default'].createElement("label", { className: cn__default['default'](styles.component, styles[align], className, (_b = {},
71
71
  _b[styles.disabled] = disabled,
72
+ _b[styles.inactive] = inactive,
72
73
  _b[styles.checked] = checked,
73
74
  _b[styles.reversed] = reversed,
74
75
  _b[styles.focused] = focused,
75
76
  _b[styles.block] = block,
76
77
  _b)), ref: mergeRefs__default['default']([labelRef, ref]) },
77
- React__default['default'].createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
78
+ React__default['default'].createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled || inactive, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
78
79
  React__default['default'].createElement("span", { className: styles.switch }),
79
80
  (label || hint) && (React__default['default'].createElement("span", { className: styles.content },
80
81
  label && React__default['default'].createElement("span", { className: styles.label }, label),
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { InputHTMLAttributes, ChangeEvent, ReactNode } from "react";
4
4
  type Align = 'start' | 'center';
5
- type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange'> & {
5
+ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange' | 'disabled'> & {
6
6
  /**
7
7
  * Управление состоянием вкл/выкл компонента
8
8
  */
@@ -31,6 +31,14 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
31
31
  * Растягивать ли компонент на всю ширину
32
32
  */
33
33
  block?: boolean;
34
+ /**
35
+ * Управление состоянием включен / выключен
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * Управление состоянием активен / неактивен
40
+ */
41
+ inactive?: boolean;
34
42
  /**
35
43
  * Обработчик переключения компонента
36
44
  */
@@ -43,7 +51,7 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
43
51
  */
44
52
  dataTestId?: string;
45
53
  };
46
- declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
54
+ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
47
55
  /**
48
56
  * Управление состоянием вкл/выкл компонента
49
57
  */
@@ -72,6 +80,14 @@ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttrib
72
80
  * Растягивать ли компонент на всю ширину
73
81
  */
74
82
  block?: boolean | undefined;
83
+ /**
84
+ * Управление состоянием включен / выключен
85
+ */
86
+ disabled?: boolean | undefined;
87
+ /**
88
+ * Управление состоянием активен / неактивен
89
+ */
90
+ inactive?: boolean | undefined;
75
91
  /**
76
92
  * Обработчик переключения компонента
77
93
  */
@@ -56,7 +56,7 @@ function __rest(s, e) {
56
56
 
57
57
  var Switch = React.forwardRef(function (_a, ref) {
58
58
  var _b;
59
- var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
59
+ var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, inactive = _a.inactive, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "inactive", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
60
60
  var labelRef = React.useRef(null);
61
61
  var focused = hooks.useFocus(labelRef, 'keyboard')[0];
62
62
  var handleChange = React.useCallback(function (e) {
@@ -68,12 +68,13 @@ var Switch = React.forwardRef(function (_a, ref) {
68
68
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
69
69
  React__default['default'].createElement("label", { className: cn__default['default'](styles__default['default'].component, styles__default['default'][align], className, (_b = {},
70
70
  _b[styles__default['default'].disabled] = disabled,
71
+ _b[styles__default['default'].inactive] = inactive,
71
72
  _b[styles__default['default'].checked] = checked,
72
73
  _b[styles__default['default'].reversed] = reversed,
73
74
  _b[styles__default['default'].focused] = focused,
74
75
  _b[styles__default['default'].block] = block,
75
76
  _b)), ref: mergeRefs__default['default']([labelRef, ref]) },
76
- React__default['default'].createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
77
+ React__default['default'].createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled || inactive, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
77
78
  React__default['default'].createElement("span", { className: styles__default['default'].switch }),
78
79
  (label || hint) && (React__default['default'].createElement("span", { className: styles__default['default'].content },
79
80
  label && React__default['default'].createElement("span", { className: styles__default['default'].label }, label),
@@ -1,12 +1,12 @@
1
1
  :root {
2
2
  --color-light-border-link: #007aff;
3
+ --color-light-border-secondary-inverted: #b6bcc3;
3
4
  --color-light-graphic-accent: #ef3124;
4
5
  --color-light-graphic-neutral: #dbdee1;
5
6
  --color-light-graphic-primary-inverted: #fff;
6
7
  --color-light-graphic-secondary: #6d7986;
7
8
  --color-light-text-primary: #0b1f35;
8
9
  --color-light-text-secondary: #546272;
9
- --color-light-text-tertiary: #b6bcc3;
10
10
  }
11
11
  :root {
12
12
 
@@ -41,9 +41,12 @@
41
41
  --switch-checked-border-color: var(--color-light-graphic-accent);
42
42
 
43
43
  /* disabled */
44
- --switch-disabled-color: var(--color-light-text-tertiary);
44
+ --switch-disabled-color: var(--color-light-text-secondary);
45
45
  --switch-disabled-bg-color: var(--color-light-graphic-neutral);
46
46
  --switch-disabled-border-color: var(--color-light-graphic-neutral);
47
+
48
+ /* inactive */
49
+ --switch-inactive-color: var(--color-light-border-secondary-inverted);
47
50
  }
48
51
  .component {
49
52
  display: inline-flex;
@@ -155,6 +158,17 @@
155
158
  .disabled .hint {
156
159
  color: var(--switch-disabled-color);
157
160
  }
161
+ /* Inactive */
162
+ .inactive {
163
+ cursor: var(--disabled-cursor);
164
+ }
165
+ .inactive .switch {
166
+ background-color: var(--switch-disabled-bg-color);
167
+ border-color: var(--switch-disabled-border-color)
168
+ }
169
+ .inactive .switch:before {
170
+ background-color: var(--switch-inactive-color);
171
+ }
158
172
  /* Focused state */
159
173
  .focused .switch {
160
174
  outline: 2px solid var(--focus-color);
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { InputHTMLAttributes, ChangeEvent, ReactNode } from "react";
4
4
  type Align = 'start' | 'center';
5
- type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange'> & {
5
+ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange' | 'disabled'> & {
6
6
  /**
7
7
  * Управление состоянием вкл/выкл компонента
8
8
  */
@@ -31,6 +31,14 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
31
31
  * Растягивать ли компонент на всю ширину
32
32
  */
33
33
  block?: boolean;
34
+ /**
35
+ * Управление состоянием включен / выключен
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * Управление состоянием активен / неактивен
40
+ */
41
+ inactive?: boolean;
34
42
  /**
35
43
  * Обработчик переключения компонента
36
44
  */
@@ -43,7 +51,7 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
43
51
  */
44
52
  dataTestId?: string;
45
53
  };
46
- declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
54
+ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
47
55
  /**
48
56
  * Управление состоянием вкл/выкл компонента
49
57
  */
@@ -72,6 +80,14 @@ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttrib
72
80
  * Растягивать ли компонент на всю ширину
73
81
  */
74
82
  block?: boolean | undefined;
83
+ /**
84
+ * Управление состоянием включен / выключен
85
+ */
86
+ disabled?: boolean | undefined;
87
+ /**
88
+ * Управление состоянием активен / неактивен
89
+ */
90
+ inactive?: boolean | undefined;
75
91
  /**
76
92
  * Обработчик переключения компонента
77
93
  */
@@ -42,12 +42,12 @@ function __rest(s, e) {
42
42
  return t;
43
43
  }
44
44
 
45
- var styles = {"component":"switch__component_180ay","start":"switch__start_180ay","center":"switch__center_180ay","addons":"switch__addons_180ay","block":"switch__block_180ay","switch":"switch__switch_180ay","content":"switch__content_180ay","label":"switch__label_180ay","hint":"switch__hint_180ay","reversed":"switch__reversed_180ay","checked":"switch__checked_180ay","disabled":"switch__disabled_180ay","focused":"switch__focused_180ay"};
45
+ var styles = {"component":"switch__component_k3m9x","start":"switch__start_k3m9x","center":"switch__center_k3m9x","addons":"switch__addons_k3m9x","block":"switch__block_k3m9x","switch":"switch__switch_k3m9x","content":"switch__content_k3m9x","label":"switch__label_k3m9x","hint":"switch__hint_k3m9x","reversed":"switch__reversed_k3m9x","checked":"switch__checked_k3m9x","disabled":"switch__disabled_k3m9x","inactive":"switch__inactive_k3m9x","focused":"switch__focused_k3m9x"};
46
46
  require('./index.css')
47
47
 
48
48
  var Switch = forwardRef(function (_a, ref) {
49
49
  var _b;
50
- var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
50
+ var _c = _a.reversed, reversed = _c === void 0 ? false : _c, _d = _a.checked, checked = _d === void 0 ? false : _d, _e = _a.align, align = _e === void 0 ? 'start' : _e, addons = _a.addons, block = _a.block, disabled = _a.disabled, inactive = _a.inactive, label = _a.label, hint = _a.hint, name = _a.name, value = _a.value, className = _a.className, onChange = _a.onChange, dataTestId = _a.dataTestId, restProps = __rest(_a, ["reversed", "checked", "align", "addons", "block", "disabled", "inactive", "label", "hint", "name", "value", "className", "onChange", "dataTestId"]);
51
51
  var labelRef = useRef(null);
52
52
  var focused = useFocus(labelRef, 'keyboard')[0];
53
53
  var handleChange = useCallback(function (e) {
@@ -59,12 +59,13 @@ var Switch = forwardRef(function (_a, ref) {
59
59
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
60
60
  React.createElement("label", { className: cn(styles.component, styles[align], className, (_b = {},
61
61
  _b[styles.disabled] = disabled,
62
+ _b[styles.inactive] = inactive,
62
63
  _b[styles.checked] = checked,
63
64
  _b[styles.reversed] = reversed,
64
65
  _b[styles.focused] = focused,
65
66
  _b[styles.block] = block,
66
67
  _b)), ref: mergeRefs([labelRef, ref]) },
67
- React.createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
68
+ React.createElement("input", __assign({ type: 'checkbox', onChange: handleChange, disabled: disabled || inactive, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
68
69
  React.createElement("span", { className: styles.switch }),
69
70
  (label || hint) && (React.createElement("span", { className: styles.content },
70
71
  label && React.createElement("span", { className: styles.label }, label),
@@ -1,13 +1,13 @@
1
- /* hash: 180ay */
1
+ /* hash: 1ga9c */
2
2
  :root {
3
3
  --color-light-border-link: #007aff;
4
+ --color-light-border-secondary-inverted: #b6bcc3;
4
5
  --color-light-graphic-accent: #ef3124;
5
6
  --color-light-graphic-neutral: #dbdee1;
6
7
  --color-light-graphic-primary-inverted: #fff;
7
8
  --color-light-graphic-secondary: #6d7986;
8
9
  --color-light-text-primary: #0b1f35;
9
10
  --color-light-text-secondary: #546272;
10
- --color-light-text-tertiary: #b6bcc3;
11
11
  }
12
12
  :root {
13
13
 
@@ -42,11 +42,14 @@
42
42
  --switch-checked-border-color: var(--color-light-graphic-accent);
43
43
 
44
44
  /* disabled */
45
- --switch-disabled-color: var(--color-light-text-tertiary);
45
+ --switch-disabled-color: var(--color-light-text-secondary);
46
46
  --switch-disabled-bg-color: var(--color-light-graphic-neutral);
47
47
  --switch-disabled-border-color: var(--color-light-graphic-neutral);
48
+
49
+ /* inactive */
50
+ --switch-inactive-color: var(--color-light-border-secondary-inverted);
48
51
  }
49
- .switch__component_180ay {
52
+ .switch__component_k3m9x {
50
53
  display: inline-flex;
51
54
  align-items: flex-start;
52
55
  margin: 0;
@@ -55,25 +58,25 @@
55
58
  cursor: pointer;
56
59
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
57
60
  }
58
- .switch__component_180ay input {
61
+ .switch__component_k3m9x input {
59
62
  opacity: 0;
60
63
  position: absolute;
61
64
  }
62
- .switch__start_180ay {
65
+ .switch__start_k3m9x {
63
66
  align-items: flex-start;
64
67
  }
65
- .switch__center_180ay {
68
+ .switch__center_k3m9x {
66
69
  align-items: center;
67
70
  }
68
- .switch__addons_180ay {
71
+ .switch__addons_k3m9x {
69
72
  margin-left: auto;
70
73
  padding-left: var(--gap-m);
71
74
  line-height: 24px;
72
75
  }
73
- .switch__block_180ay {
76
+ .switch__block_k3m9x {
74
77
  width: 100%;
75
78
  }
76
- .switch__switch_180ay {
79
+ .switch__switch_k3m9x {
77
80
  position: relative;
78
81
  border-radius: var(--border-radius-xl);
79
82
  width: 36px;
@@ -85,7 +88,7 @@
85
88
  transition: background-color 0.2s ease, border-color 0.2s ease;
86
89
  box-sizing: border-box;
87
90
  }
88
- .switch__switch_180ay:before {
91
+ .switch__switch_k3m9x:before {
89
92
  content: '';
90
93
  position: absolute;
91
94
  top: 0;
@@ -98,21 +101,21 @@
98
101
  box-sizing: border-box;
99
102
  transition: transform 0.2s ease;
100
103
  }
101
- .switch__content_180ay {
104
+ .switch__content_k3m9x {
102
105
  margin-left: var(--gap-s);
103
106
  flex-grow: 1;
104
107
  }
105
- .switch__label_180ay {
108
+ .switch__label_k3m9x {
106
109
  font-size: 16px;
107
110
  line-height: 24px;
108
111
  font-weight: 400;
109
112
  display: block;
110
113
  color: var(--switch-label-color);
111
114
  }
112
- .switch__label_180ay:not(:only-child) {
115
+ .switch__label_k3m9x:not(:only-child) {
113
116
  margin-bottom: var(--gap-2xs);
114
117
  }
115
- .switch__hint_180ay {
118
+ .switch__hint_k3m9x {
116
119
  font-size: 14px;
117
120
  line-height: 18px;
118
121
  font-weight: 400;
@@ -120,44 +123,55 @@
120
123
  color: var(--switch-hint-color);
121
124
  }
122
125
  /* Reversed state */
123
- .switch__component_180ay.switch__reversed_180ay {
126
+ .switch__component_k3m9x.switch__reversed_k3m9x {
124
127
  flex-direction: row-reverse;
125
128
  }
126
- .switch__reversed_180ay .switch__content_180ay {
129
+ .switch__reversed_k3m9x .switch__content_k3m9x {
127
130
  margin-right: var(--gap-m);
128
131
  margin-left: 0;
129
132
  }
130
- .switch__reversed_180ay .switch__addons_180ay {
133
+ .switch__reversed_k3m9x .switch__addons_k3m9x {
131
134
  margin-left: 0;
132
135
  padding-left: 0;
133
136
  margin-right: auto;
134
137
  padding-right: var(--gap-m);
135
138
  }
136
139
  /* Checked state */
137
- .switch__checked_180ay .switch__switch_180ay {
140
+ .switch__checked_k3m9x .switch__switch_k3m9x {
138
141
  background-color: var(--switch-checked-bg-color);
139
142
  border-color: var(--switch-checked-border-color);
140
143
  }
141
- .switch__checked_180ay .switch__switch_180ay:before {
144
+ .switch__checked_k3m9x .switch__switch_k3m9x:before {
142
145
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
143
146
  transform: translateX(16px);
144
147
  }
145
148
  /* Disabled state */
146
- .switch__disabled_180ay {
149
+ .switch__disabled_k3m9x {
147
150
  cursor: var(--disabled-cursor);
148
151
  }
149
- .switch__disabled_180ay .switch__switch_180ay {
152
+ .switch__disabled_k3m9x .switch__switch_k3m9x {
150
153
  background-color: var(--switch-disabled-bg-color);
151
154
  border-color: var(--switch-disabled-border-color);
152
155
  }
153
- .switch__disabled_180ay .switch__label_180ay {
156
+ .switch__disabled_k3m9x .switch__label_k3m9x {
154
157
  color: var(--switch-disabled-color);
155
158
  }
156
- .switch__disabled_180ay .switch__hint_180ay {
159
+ .switch__disabled_k3m9x .switch__hint_k3m9x {
157
160
  color: var(--switch-disabled-color);
158
161
  }
162
+ /* Inactive */
163
+ .switch__inactive_k3m9x {
164
+ cursor: var(--disabled-cursor);
165
+ }
166
+ .switch__inactive_k3m9x .switch__switch_k3m9x {
167
+ background-color: var(--switch-disabled-bg-color);
168
+ border-color: var(--switch-disabled-border-color)
169
+ }
170
+ .switch__inactive_k3m9x .switch__switch_k3m9x:before {
171
+ background-color: var(--switch-inactive-color);
172
+ }
159
173
  /* Focused state */
160
- .switch__focused_180ay .switch__switch_180ay {
174
+ .switch__focused_k3m9x .switch__switch_k3m9x {
161
175
  outline: 2px solid var(--focus-color);
162
176
  outline-offset: 2px;
163
177
  }
package/dist/index.css CHANGED
@@ -1,13 +1,13 @@
1
- /* hash: 180ay */
1
+ /* hash: 1ga9c */
2
2
  :root {
3
3
  --color-light-border-link: #007aff;
4
+ --color-light-border-secondary-inverted: #b6bcc3;
4
5
  --color-light-graphic-accent: #ef3124;
5
6
  --color-light-graphic-neutral: #dbdee1;
6
7
  --color-light-graphic-primary-inverted: #fff;
7
8
  --color-light-graphic-secondary: #6d7986;
8
9
  --color-light-text-primary: #0b1f35;
9
10
  --color-light-text-secondary: #546272;
10
- --color-light-text-tertiary: #b6bcc3;
11
11
  }
12
12
  :root {
13
13
 
@@ -42,11 +42,14 @@
42
42
  --switch-checked-border-color: var(--color-light-graphic-accent);
43
43
 
44
44
  /* disabled */
45
- --switch-disabled-color: var(--color-light-text-tertiary);
45
+ --switch-disabled-color: var(--color-light-text-secondary);
46
46
  --switch-disabled-bg-color: var(--color-light-graphic-neutral);
47
47
  --switch-disabled-border-color: var(--color-light-graphic-neutral);
48
+
49
+ /* inactive */
50
+ --switch-inactive-color: var(--color-light-border-secondary-inverted);
48
51
  }
49
- .switch__component_180ay {
52
+ .switch__component_k3m9x {
50
53
  display: inline-flex;
51
54
  align-items: flex-start;
52
55
  margin: 0;
@@ -55,25 +58,25 @@
55
58
  cursor: pointer;
56
59
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
57
60
  }
58
- .switch__component_180ay input {
61
+ .switch__component_k3m9x input {
59
62
  opacity: 0;
60
63
  position: absolute;
61
64
  }
62
- .switch__start_180ay {
65
+ .switch__start_k3m9x {
63
66
  align-items: flex-start;
64
67
  }
65
- .switch__center_180ay {
68
+ .switch__center_k3m9x {
66
69
  align-items: center;
67
70
  }
68
- .switch__addons_180ay {
71
+ .switch__addons_k3m9x {
69
72
  margin-left: auto;
70
73
  padding-left: var(--gap-m);
71
74
  line-height: 24px;
72
75
  }
73
- .switch__block_180ay {
76
+ .switch__block_k3m9x {
74
77
  width: 100%;
75
78
  }
76
- .switch__switch_180ay {
79
+ .switch__switch_k3m9x {
77
80
  position: relative;
78
81
  border-radius: var(--border-radius-xl);
79
82
  width: 36px;
@@ -85,7 +88,7 @@
85
88
  transition: background-color 0.2s ease, border-color 0.2s ease;
86
89
  box-sizing: border-box;
87
90
  }
88
- .switch__switch_180ay:before {
91
+ .switch__switch_k3m9x:before {
89
92
  content: '';
90
93
  position: absolute;
91
94
  top: 0;
@@ -98,21 +101,21 @@
98
101
  box-sizing: border-box;
99
102
  transition: transform 0.2s ease;
100
103
  }
101
- .switch__content_180ay {
104
+ .switch__content_k3m9x {
102
105
  margin-left: var(--gap-s);
103
106
  flex-grow: 1;
104
107
  }
105
- .switch__label_180ay {
108
+ .switch__label_k3m9x {
106
109
  font-size: 16px;
107
110
  line-height: 24px;
108
111
  font-weight: 400;
109
112
  display: block;
110
113
  color: var(--switch-label-color);
111
114
  }
112
- .switch__label_180ay:not(:only-child) {
115
+ .switch__label_k3m9x:not(:only-child) {
113
116
  margin-bottom: var(--gap-2xs);
114
117
  }
115
- .switch__hint_180ay {
118
+ .switch__hint_k3m9x {
116
119
  font-size: 14px;
117
120
  line-height: 18px;
118
121
  font-weight: 400;
@@ -120,44 +123,55 @@
120
123
  color: var(--switch-hint-color);
121
124
  }
122
125
  /* Reversed state */
123
- .switch__component_180ay.switch__reversed_180ay {
126
+ .switch__component_k3m9x.switch__reversed_k3m9x {
124
127
  flex-direction: row-reverse;
125
128
  }
126
- .switch__reversed_180ay .switch__content_180ay {
129
+ .switch__reversed_k3m9x .switch__content_k3m9x {
127
130
  margin-right: var(--gap-m);
128
131
  margin-left: 0;
129
132
  }
130
- .switch__reversed_180ay .switch__addons_180ay {
133
+ .switch__reversed_k3m9x .switch__addons_k3m9x {
131
134
  margin-left: 0;
132
135
  padding-left: 0;
133
136
  margin-right: auto;
134
137
  padding-right: var(--gap-m);
135
138
  }
136
139
  /* Checked state */
137
- .switch__checked_180ay .switch__switch_180ay {
140
+ .switch__checked_k3m9x .switch__switch_k3m9x {
138
141
  background-color: var(--switch-checked-bg-color);
139
142
  border-color: var(--switch-checked-border-color);
140
143
  }
141
- .switch__checked_180ay .switch__switch_180ay:before {
144
+ .switch__checked_k3m9x .switch__switch_k3m9x:before {
142
145
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
143
146
  transform: translateX(16px);
144
147
  }
145
148
  /* Disabled state */
146
- .switch__disabled_180ay {
149
+ .switch__disabled_k3m9x {
147
150
  cursor: var(--disabled-cursor);
148
151
  }
149
- .switch__disabled_180ay .switch__switch_180ay {
152
+ .switch__disabled_k3m9x .switch__switch_k3m9x {
150
153
  background-color: var(--switch-disabled-bg-color);
151
154
  border-color: var(--switch-disabled-border-color);
152
155
  }
153
- .switch__disabled_180ay .switch__label_180ay {
156
+ .switch__disabled_k3m9x .switch__label_k3m9x {
154
157
  color: var(--switch-disabled-color);
155
158
  }
156
- .switch__disabled_180ay .switch__hint_180ay {
159
+ .switch__disabled_k3m9x .switch__hint_k3m9x {
157
160
  color: var(--switch-disabled-color);
158
161
  }
162
+ /* Inactive */
163
+ .switch__inactive_k3m9x {
164
+ cursor: var(--disabled-cursor);
165
+ }
166
+ .switch__inactive_k3m9x .switch__switch_k3m9x {
167
+ background-color: var(--switch-disabled-bg-color);
168
+ border-color: var(--switch-disabled-border-color)
169
+ }
170
+ .switch__inactive_k3m9x .switch__switch_k3m9x:before {
171
+ background-color: var(--switch-inactive-color);
172
+ }
159
173
  /* Focused state */
160
- .switch__focused_180ay .switch__switch_180ay {
174
+ .switch__focused_k3m9x .switch__switch_k3m9x {
161
175
  outline: 2px solid var(--focus-color);
162
176
  outline-offset: 2px;
163
177
  }
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { InputHTMLAttributes, ChangeEvent, ReactNode } from "react";
4
4
  type Align = 'start' | 'center';
5
- type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange'> & {
5
+ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' | 'onChange' | 'disabled'> & {
6
6
  /**
7
7
  * Управление состоянием вкл/выкл компонента
8
8
  */
@@ -31,6 +31,14 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
31
31
  * Растягивать ли компонент на всю ширину
32
32
  */
33
33
  block?: boolean;
34
+ /**
35
+ * Управление состоянием включен / выключен
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * Управление состоянием активен / неактивен
40
+ */
41
+ inactive?: boolean;
34
42
  /**
35
43
  * Обработчик переключения компонента
36
44
  */
@@ -43,7 +51,7 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'hint' |
43
51
  */
44
52
  dataTestId?: string;
45
53
  };
46
- declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
54
+ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
47
55
  /**
48
56
  * Управление состоянием вкл/выкл компонента
49
57
  */
@@ -72,6 +80,14 @@ declare const Switch: React.ForwardRefExoticComponent<Pick<React.InputHTMLAttrib
72
80
  * Растягивать ли компонент на всю ширину
73
81
  */
74
82
  block?: boolean | undefined;
83
+ /**
84
+ * Управление состоянием включен / выключен
85
+ */
86
+ disabled?: boolean | undefined;
87
+ /**
88
+ * Управление состоянием активен / неактивен
89
+ */
90
+ inactive?: boolean | undefined;
75
91
  /**
76
92
  * Обработчик переключения компонента
77
93
  */
@@ -3,10 +3,10 @@ import cn from 'classnames';
3
3
  import mergeRefs from 'react-merge-refs';
4
4
  import { useFocus } from '@alfalab/hooks';
5
5
 
6
- var styles = {"component":"switch__component_180ay","start":"switch__start_180ay","center":"switch__center_180ay","addons":"switch__addons_180ay","block":"switch__block_180ay","switch":"switch__switch_180ay","content":"switch__content_180ay","label":"switch__label_180ay","hint":"switch__hint_180ay","reversed":"switch__reversed_180ay","checked":"switch__checked_180ay","disabled":"switch__disabled_180ay","focused":"switch__focused_180ay"};
6
+ var styles = {"component":"switch__component_k3m9x","start":"switch__start_k3m9x","center":"switch__center_k3m9x","addons":"switch__addons_k3m9x","block":"switch__block_k3m9x","switch":"switch__switch_k3m9x","content":"switch__content_k3m9x","label":"switch__label_k3m9x","hint":"switch__hint_k3m9x","reversed":"switch__reversed_k3m9x","checked":"switch__checked_k3m9x","disabled":"switch__disabled_k3m9x","inactive":"switch__inactive_k3m9x","focused":"switch__focused_k3m9x"};
7
7
  require('./index.css')
8
8
 
9
- const Switch = forwardRef(({ reversed = false, checked = false, align = 'start', addons, block, disabled, label, hint, name, value, className, onChange, dataTestId, ...restProps }, ref) => {
9
+ const Switch = forwardRef(({ reversed = false, checked = false, align = 'start', addons, block, disabled, inactive, label, hint, name, value, className, onChange, dataTestId, ...restProps }, ref) => {
10
10
  const labelRef = useRef(null);
11
11
  const [focused] = useFocus(labelRef, 'keyboard');
12
12
  const handleChange = useCallback((e) => {
@@ -18,12 +18,13 @@ const Switch = forwardRef(({ reversed = false, checked = false, align = 'start',
18
18
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
19
19
  React.createElement("label", { className: cn(styles.component, styles[align], className, {
20
20
  [styles.disabled]: disabled,
21
+ [styles.inactive]: inactive,
21
22
  [styles.checked]: checked,
22
23
  [styles.reversed]: reversed,
23
24
  [styles.focused]: focused,
24
25
  [styles.block]: block,
25
26
  }), ref: mergeRefs([labelRef, ref]) },
26
- React.createElement("input", Object.assign({ type: 'checkbox', onChange: handleChange, disabled: disabled, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
27
+ React.createElement("input", Object.assign({ type: 'checkbox', onChange: handleChange, disabled: disabled || inactive, checked: checked, name: name, value: value, "data-test-id": dataTestId }, restProps)),
27
28
  React.createElement("span", { className: styles.switch }),
28
29
  (label || hint) && (React.createElement("span", { className: styles.content },
29
30
  label && React.createElement("span", { className: styles.label }, label),
@@ -1,13 +1,13 @@
1
- /* hash: 180ay */
1
+ /* hash: 1ga9c */
2
2
  :root {
3
3
  --color-light-border-link: #007aff;
4
+ --color-light-border-secondary-inverted: #b6bcc3;
4
5
  --color-light-graphic-accent: #ef3124;
5
6
  --color-light-graphic-neutral: #dbdee1;
6
7
  --color-light-graphic-primary-inverted: #fff;
7
8
  --color-light-graphic-secondary: #6d7986;
8
9
  --color-light-text-primary: #0b1f35;
9
10
  --color-light-text-secondary: #546272;
10
- --color-light-text-tertiary: #b6bcc3;
11
11
  }
12
12
  :root {
13
13
 
@@ -42,11 +42,14 @@
42
42
  --switch-checked-border-color: var(--color-light-graphic-accent);
43
43
 
44
44
  /* disabled */
45
- --switch-disabled-color: var(--color-light-text-tertiary);
45
+ --switch-disabled-color: var(--color-light-text-secondary);
46
46
  --switch-disabled-bg-color: var(--color-light-graphic-neutral);
47
47
  --switch-disabled-border-color: var(--color-light-graphic-neutral);
48
+
49
+ /* inactive */
50
+ --switch-inactive-color: var(--color-light-border-secondary-inverted);
48
51
  }
49
- .switch__component_180ay {
52
+ .switch__component_k3m9x {
50
53
  display: inline-flex;
51
54
  align-items: flex-start;
52
55
  margin: 0;
@@ -55,25 +58,25 @@
55
58
  cursor: pointer;
56
59
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
57
60
  }
58
- .switch__component_180ay input {
61
+ .switch__component_k3m9x input {
59
62
  opacity: 0;
60
63
  position: absolute;
61
64
  }
62
- .switch__start_180ay {
65
+ .switch__start_k3m9x {
63
66
  align-items: flex-start;
64
67
  }
65
- .switch__center_180ay {
68
+ .switch__center_k3m9x {
66
69
  align-items: center;
67
70
  }
68
- .switch__addons_180ay {
71
+ .switch__addons_k3m9x {
69
72
  margin-left: auto;
70
73
  padding-left: var(--gap-m);
71
74
  line-height: 24px;
72
75
  }
73
- .switch__block_180ay {
76
+ .switch__block_k3m9x {
74
77
  width: 100%;
75
78
  }
76
- .switch__switch_180ay {
79
+ .switch__switch_k3m9x {
77
80
  position: relative;
78
81
  border-radius: var(--border-radius-xl);
79
82
  width: 36px;
@@ -85,7 +88,7 @@
85
88
  transition: background-color 0.2s ease, border-color 0.2s ease;
86
89
  box-sizing: border-box;
87
90
  }
88
- .switch__switch_180ay:before {
91
+ .switch__switch_k3m9x:before {
89
92
  content: '';
90
93
  position: absolute;
91
94
  top: 0;
@@ -98,21 +101,21 @@
98
101
  box-sizing: border-box;
99
102
  transition: transform 0.2s ease;
100
103
  }
101
- .switch__content_180ay {
104
+ .switch__content_k3m9x {
102
105
  margin-left: var(--gap-s);
103
106
  flex-grow: 1;
104
107
  }
105
- .switch__label_180ay {
108
+ .switch__label_k3m9x {
106
109
  font-size: 16px;
107
110
  line-height: 24px;
108
111
  font-weight: 400;
109
112
  display: block;
110
113
  color: var(--switch-label-color);
111
114
  }
112
- .switch__label_180ay:not(:only-child) {
115
+ .switch__label_k3m9x:not(:only-child) {
113
116
  margin-bottom: var(--gap-2xs);
114
117
  }
115
- .switch__hint_180ay {
118
+ .switch__hint_k3m9x {
116
119
  font-size: 14px;
117
120
  line-height: 18px;
118
121
  font-weight: 400;
@@ -120,44 +123,55 @@
120
123
  color: var(--switch-hint-color);
121
124
  }
122
125
  /* Reversed state */
123
- .switch__component_180ay.switch__reversed_180ay {
126
+ .switch__component_k3m9x.switch__reversed_k3m9x {
124
127
  flex-direction: row-reverse;
125
128
  }
126
- .switch__reversed_180ay .switch__content_180ay {
129
+ .switch__reversed_k3m9x .switch__content_k3m9x {
127
130
  margin-right: var(--gap-m);
128
131
  margin-left: 0;
129
132
  }
130
- .switch__reversed_180ay .switch__addons_180ay {
133
+ .switch__reversed_k3m9x .switch__addons_k3m9x {
131
134
  margin-left: 0;
132
135
  padding-left: 0;
133
136
  margin-right: auto;
134
137
  padding-right: var(--gap-m);
135
138
  }
136
139
  /* Checked state */
137
- .switch__checked_180ay .switch__switch_180ay {
140
+ .switch__checked_k3m9x .switch__switch_k3m9x {
138
141
  background-color: var(--switch-checked-bg-color);
139
142
  border-color: var(--switch-checked-border-color);
140
143
  }
141
- .switch__checked_180ay .switch__switch_180ay:before {
144
+ .switch__checked_k3m9x .switch__switch_k3m9x:before {
142
145
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
143
146
  transform: translateX(16px);
144
147
  }
145
148
  /* Disabled state */
146
- .switch__disabled_180ay {
149
+ .switch__disabled_k3m9x {
147
150
  cursor: var(--disabled-cursor);
148
151
  }
149
- .switch__disabled_180ay .switch__switch_180ay {
152
+ .switch__disabled_k3m9x .switch__switch_k3m9x {
150
153
  background-color: var(--switch-disabled-bg-color);
151
154
  border-color: var(--switch-disabled-border-color);
152
155
  }
153
- .switch__disabled_180ay .switch__label_180ay {
156
+ .switch__disabled_k3m9x .switch__label_k3m9x {
154
157
  color: var(--switch-disabled-color);
155
158
  }
156
- .switch__disabled_180ay .switch__hint_180ay {
159
+ .switch__disabled_k3m9x .switch__hint_k3m9x {
157
160
  color: var(--switch-disabled-color);
158
161
  }
162
+ /* Inactive */
163
+ .switch__inactive_k3m9x {
164
+ cursor: var(--disabled-cursor);
165
+ }
166
+ .switch__inactive_k3m9x .switch__switch_k3m9x {
167
+ background-color: var(--switch-disabled-bg-color);
168
+ border-color: var(--switch-disabled-border-color)
169
+ }
170
+ .switch__inactive_k3m9x .switch__switch_k3m9x:before {
171
+ background-color: var(--switch-inactive-color);
172
+ }
159
173
  /* Focused state */
160
- .switch__focused_180ay .switch__switch_180ay {
174
+ .switch__focused_k3m9x .switch__switch_k3m9x {
161
175
  outline: 2px solid var(--focus-color);
162
176
  outline-offset: 2px;
163
177
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-switch",
3
- "version": "2.0.0",
3
+ "version": "2.2.1",
4
4
  "description": "",
5
- "gitHead": "e572a1d2a967ae70c2d5f51340946a923e730266",
5
+ "gitHead": "19a2d088b6c18a127940199cfd6e6fc4e8639ec5",
6
6
  "keywords": [],
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "react": "^16.9.0 || ^17.0.1"
21
21
  },
22
22
  "dependencies": {
23
- "@alfalab/hooks": "^1.0.0",
23
+ "@alfalab/hooks": "^1.4.1",
24
24
  "classnames": "^2.2.6",
25
25
  "react-merge-refs": "^1.1.0"
26
26
  }