@salutejs/plasma-new-hope 0.87.1-canary.1232.9463821288.0 → 0.87.1-canary.1232.9495527667.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Switch/Switch.js +6 -4
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/es/components/Switch/Switch.js +6 -4
- package/es/components/Switch/Switch.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Switch/Switch.js +6 -4
- package/styled-components/es/components/Switch/Switch.js +6 -4
- package/types/components/Switch/Switch.d.ts.map +1 -1
- package/types/components/Switch/Switch.types.d.ts +13 -0
- package/types/components/Switch/Switch.types.d.ts.map +1 -1
@@ -13,13 +13,14 @@ var base$5 = require('./_label-position/base.js');
|
|
13
13
|
var Switch_styles = require('./Switch.styles.js');
|
14
14
|
|
15
15
|
var _StyledTrigger;
|
16
|
-
var _excluded = ["size", "view", "focused", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "defaultChecked"];
|
16
|
+
var _excluded = ["size", "view", "focused", "outlined", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
17
17
|
var base = "bagv7wj";
|
18
18
|
var switchRoot = function switchRoot(Root) {
|
19
19
|
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
20
20
|
var size = props.size,
|
21
21
|
view = props.view,
|
22
22
|
focused = props.focused,
|
23
|
+
outlined = props.outlined,
|
23
24
|
disabled = props.disabled,
|
24
25
|
labelPosition = props.labelPosition,
|
25
26
|
label = props.label,
|
@@ -27,16 +28,17 @@ var switchRoot = function switchRoot(Root) {
|
|
27
28
|
style = props.style,
|
28
29
|
className = props.className,
|
29
30
|
checked = props.checked,
|
31
|
+
pressed = props.pressed,
|
30
32
|
defaultChecked = props.defaultChecked,
|
31
33
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
32
|
-
var exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
|
34
|
+
var exactChecked = Boolean((checked !== null && checked !== void 0 ? checked : pressed) !== undefined ? checked !== null && checked !== void 0 ? checked : pressed : defaultChecked);
|
33
35
|
// const singleLineClass = singleLine ? 'single-line' : '';
|
34
36
|
|
35
37
|
return /*#__PURE__*/React.createElement(Root, {
|
36
38
|
view: view,
|
37
39
|
size: size,
|
38
40
|
disabled: disabled,
|
39
|
-
focused: focused,
|
41
|
+
focused: focused !== null && focused !== void 0 ? focused : outlined,
|
40
42
|
labelPosition: labelPosition,
|
41
43
|
id: id,
|
42
44
|
style: style,
|
@@ -46,7 +48,7 @@ var switchRoot = function switchRoot(Root) {
|
|
46
48
|
role: "switch",
|
47
49
|
"aria-checked": exactChecked,
|
48
50
|
type: "checkbox",
|
49
|
-
checked: checked,
|
51
|
+
checked: checked !== null && checked !== void 0 ? checked : pressed,
|
50
52
|
defaultChecked: defaultChecked,
|
51
53
|
disabled: disabled
|
52
54
|
})), /*#__PURE__*/React.createElement(Switch_styles.StyledLabel, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { RootProps } from '../../engines';\nimport { base as sizeCSS } from '../Switch/_size/base';\nimport { base as viewCSS } from '../Switch/_view/base';\nimport { base as focusedCSS } from '../Switch/_focused/base';\nimport { base as disabledCSS } from '../Switch/_disabled/base';\nimport { base as labelPositionCSS } from '../Switch/_label-position/base';\n\nimport { StyledInput, StyledLabel, StyledTrigger } from './Switch.styles';\nimport { SwitchProps } from './Switch.types';\n\nconst base = css`\n position: relative;\n display: flex;\n align-items: center;\n\n cursor: pointer;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n &:focus {\n outline: 0 none;\n }\n`;\n\nexport const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>\n forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n size,\n view,\n focused,\n disabled,\n labelPosition,\n\n label,\n\n id,\n style,\n className,\n\n // singleLine,\n\n checked,\n defaultChecked,\n\n ...rest\n } = props;\n\n const exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);\n // const singleLineClass = singleLine ? 'single-line' : '';\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n focused={focused}\n labelPosition={labelPosition}\n id={id}\n style={style}\n className={className}\n >\n <StyledInput\n {...rest}\n ref={ref}\n role=\"switch\"\n aria-checked={exactChecked}\n type=\"checkbox\"\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n />\n <StyledLabel tabIndex={-1}>{label}</StyledLabel>\n <StyledTrigger aria-hidden />\n </Root>\n );\n });\n\nexport const switchConfig = {\n name: 'Switch',\n tag: 'label',\n base,\n layout: switchRoot,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n labelPosition: {\n css: labelPositionCSS,\n },\n },\n defaults: {\n size: 's',\n view: 'default',\n },\n};\n"],"names":["base","switchRoot","Root","forwardRef","props","ref","size","view","focused","disabled","labelPosition","label","id","style","className","checked","defaultChecked","rest","_excluded","exactChecked","Boolean","undefined","React","createElement","StyledInput","_extends","role","type","StyledLabel","tabIndex","_StyledTrigger","StyledTrigger","switchConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","focusedCSS","labelPositionCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAMA,IAAI,GAWT,SAAA,CAAA;IAEYC,UAAU,GAAGA,SAAbA,UAAUA,CAAIC,IAA8C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CAAgC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACtD,IAAA,IACIC,IAAI,
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { RootProps } from '../../engines';\nimport { base as sizeCSS } from '../Switch/_size/base';\nimport { base as viewCSS } from '../Switch/_view/base';\nimport { base as focusedCSS } from '../Switch/_focused/base';\nimport { base as disabledCSS } from '../Switch/_disabled/base';\nimport { base as labelPositionCSS } from '../Switch/_label-position/base';\n\nimport { StyledInput, StyledLabel, StyledTrigger } from './Switch.styles';\nimport { SwitchProps } from './Switch.types';\n\nconst base = css`\n position: relative;\n display: flex;\n align-items: center;\n\n cursor: pointer;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n &:focus {\n outline: 0 none;\n }\n`;\n\nexport const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>\n forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n size,\n view,\n focused,\n outlined,\n disabled,\n labelPosition,\n\n label,\n\n id,\n style,\n className,\n\n // singleLine,\n\n checked,\n pressed,\n defaultChecked,\n\n ...rest\n } = props;\n\n const exactChecked = Boolean((checked ?? pressed) !== undefined ? checked ?? pressed : defaultChecked);\n // const singleLineClass = singleLine ? 'single-line' : '';\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n focused={focused ?? outlined}\n labelPosition={labelPosition}\n id={id}\n style={style}\n className={className}\n >\n <StyledInput\n {...rest}\n ref={ref}\n role=\"switch\"\n aria-checked={exactChecked}\n type=\"checkbox\"\n checked={checked ?? pressed}\n defaultChecked={defaultChecked}\n disabled={disabled}\n />\n <StyledLabel tabIndex={-1}>{label}</StyledLabel>\n <StyledTrigger aria-hidden />\n </Root>\n );\n });\n\nexport const switchConfig = {\n name: 'Switch',\n tag: 'label',\n base,\n layout: switchRoot,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n labelPosition: {\n css: labelPositionCSS,\n },\n },\n defaults: {\n size: 's',\n view: 'default',\n },\n};\n"],"names":["base","switchRoot","Root","forwardRef","props","ref","size","view","focused","outlined","disabled","labelPosition","label","id","style","className","checked","pressed","defaultChecked","rest","_excluded","exactChecked","Boolean","undefined","React","createElement","StyledInput","_extends","role","type","StyledLabel","tabIndex","_StyledTrigger","StyledTrigger","switchConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","focusedCSS","labelPositionCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAMA,IAAI,GAWT,SAAA,CAAA;IAEYC,UAAU,GAAGA,SAAbA,UAAUA,CAAIC,IAA8C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CAAgC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACtD,IAAA,IACIC,IAAI,GAoBJF,KAAK,CApBLE,IAAI;MACJC,IAAI,GAmBJH,KAAK,CAnBLG,IAAI;MACJC,OAAO,GAkBPJ,KAAK,CAlBLI,OAAO;MACPC,QAAQ,GAiBRL,KAAK,CAjBLK,QAAQ;MACRC,QAAQ,GAgBRN,KAAK,CAhBLM,QAAQ;MACRC,aAAa,GAebP,KAAK,CAfLO,aAAa;MAEbC,KAAK,GAaLR,KAAK,CAbLQ,KAAK;MAELC,EAAE,GAWFT,KAAK,CAXLS,EAAE;MACFC,KAAK,GAULV,KAAK,CAVLU,KAAK;MACLC,SAAS,GASTX,KAAK,CATLW,SAAS;MAITC,OAAO,GAKPZ,KAAK,CALLY,OAAO;MACPC,OAAO,GAIPb,KAAK,CAJLa,OAAO;MACPC,cAAc,GAGdd,KAAK,CAHLc,cAAc;AAEXC,MAAAA,IAAAA,GAAAA,iDAAAA,CACHf,KAAK,EAAAgB,SAAA,CAAA,CAAA;IAET,IAAMC,YAAY,GAAGC,OAAO,CAAC,CAACN,OAAO,KAAPA,IAAAA,IAAAA,OAAO,KAAPA,KAAAA,CAAAA,GAAAA,OAAO,GAAIC,OAAO,MAAMM,SAAS,GAAGP,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAPA,OAAO,GAAIC,OAAO,GAAGC,cAAc,CAAC,CAAA;AACtG;;AAEA,IAAA,oBACIM,KAAA,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;AAClBqC,EAAAA,UAAU,EAAE;AACRhC,IAAAA,IAAI,EAAE;AACFiC,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDjC,IAAAA,IAAI,EAAE;AACFgC,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACD/B,IAAAA,QAAQ,EAAE;AACN6B,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDnC,IAAAA,OAAO,EAAE;AACL+B,MAAAA,GAAG,EAAEK,WAAAA;KACR;AACDjC,IAAAA,aAAa,EAAE;AACX4B,MAAAA,GAAG,EAAEM,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxC,IAAAA,IAAI,EAAE,GAAG;AACTC,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -9,13 +9,14 @@ import { base as base$5 } from './_label-position/base.js';
|
|
9
9
|
import { StyledInput, StyledLabel, StyledTrigger } from './Switch.styles.js';
|
10
10
|
|
11
11
|
var _StyledTrigger;
|
12
|
-
var _excluded = ["size", "view", "focused", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "defaultChecked"];
|
12
|
+
var _excluded = ["size", "view", "focused", "outlined", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
13
13
|
var base = "bagv7wj";
|
14
14
|
var switchRoot = function switchRoot(Root) {
|
15
15
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
16
16
|
var size = props.size,
|
17
17
|
view = props.view,
|
18
18
|
focused = props.focused,
|
19
|
+
outlined = props.outlined,
|
19
20
|
disabled = props.disabled,
|
20
21
|
labelPosition = props.labelPosition,
|
21
22
|
label = props.label,
|
@@ -23,16 +24,17 @@ var switchRoot = function switchRoot(Root) {
|
|
23
24
|
style = props.style,
|
24
25
|
className = props.className,
|
25
26
|
checked = props.checked,
|
27
|
+
pressed = props.pressed,
|
26
28
|
defaultChecked = props.defaultChecked,
|
27
29
|
rest = _objectWithoutProperties(props, _excluded);
|
28
|
-
var exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
|
30
|
+
var exactChecked = Boolean((checked !== null && checked !== void 0 ? checked : pressed) !== undefined ? checked !== null && checked !== void 0 ? checked : pressed : defaultChecked);
|
29
31
|
// const singleLineClass = singleLine ? 'single-line' : '';
|
30
32
|
|
31
33
|
return /*#__PURE__*/React.createElement(Root, {
|
32
34
|
view: view,
|
33
35
|
size: size,
|
34
36
|
disabled: disabled,
|
35
|
-
focused: focused,
|
37
|
+
focused: focused !== null && focused !== void 0 ? focused : outlined,
|
36
38
|
labelPosition: labelPosition,
|
37
39
|
id: id,
|
38
40
|
style: style,
|
@@ -42,7 +44,7 @@ var switchRoot = function switchRoot(Root) {
|
|
42
44
|
role: "switch",
|
43
45
|
"aria-checked": exactChecked,
|
44
46
|
type: "checkbox",
|
45
|
-
checked: checked,
|
47
|
+
checked: checked !== null && checked !== void 0 ? checked : pressed,
|
46
48
|
defaultChecked: defaultChecked,
|
47
49
|
disabled: disabled
|
48
50
|
})), /*#__PURE__*/React.createElement(StyledLabel, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { RootProps } from '../../engines';\nimport { base as sizeCSS } from '../Switch/_size/base';\nimport { base as viewCSS } from '../Switch/_view/base';\nimport { base as focusedCSS } from '../Switch/_focused/base';\nimport { base as disabledCSS } from '../Switch/_disabled/base';\nimport { base as labelPositionCSS } from '../Switch/_label-position/base';\n\nimport { StyledInput, StyledLabel, StyledTrigger } from './Switch.styles';\nimport { SwitchProps } from './Switch.types';\n\nconst base = css`\n position: relative;\n display: flex;\n align-items: center;\n\n cursor: pointer;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n &:focus {\n outline: 0 none;\n }\n`;\n\nexport const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>\n forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n size,\n view,\n focused,\n disabled,\n labelPosition,\n\n label,\n\n id,\n style,\n className,\n\n // singleLine,\n\n checked,\n defaultChecked,\n\n ...rest\n } = props;\n\n const exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);\n // const singleLineClass = singleLine ? 'single-line' : '';\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n focused={focused}\n labelPosition={labelPosition}\n id={id}\n style={style}\n className={className}\n >\n <StyledInput\n {...rest}\n ref={ref}\n role=\"switch\"\n aria-checked={exactChecked}\n type=\"checkbox\"\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n />\n <StyledLabel tabIndex={-1}>{label}</StyledLabel>\n <StyledTrigger aria-hidden />\n </Root>\n );\n });\n\nexport const switchConfig = {\n name: 'Switch',\n tag: 'label',\n base,\n layout: switchRoot,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n labelPosition: {\n css: labelPositionCSS,\n },\n },\n defaults: {\n size: 's',\n view: 'default',\n },\n};\n"],"names":["base","switchRoot","Root","forwardRef","props","ref","size","view","focused","disabled","labelPosition","label","id","style","className","checked","defaultChecked","rest","_excluded","exactChecked","Boolean","undefined","React","createElement","StyledInput","_extends","role","type","StyledLabel","tabIndex","_StyledTrigger","StyledTrigger","switchConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","focusedCSS","labelPositionCSS","defaults"],"mappings":";;;;;;;;;;;AAaA,IAAMA,IAAI,GAWT,SAAA,CAAA;IAEYC,UAAU,GAAGA,SAAbA,UAAUA,CAAIC,IAA8C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CAAgC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACtD,IAAA,IACIC,IAAI,
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { RootProps } from '../../engines';\nimport { base as sizeCSS } from '../Switch/_size/base';\nimport { base as viewCSS } from '../Switch/_view/base';\nimport { base as focusedCSS } from '../Switch/_focused/base';\nimport { base as disabledCSS } from '../Switch/_disabled/base';\nimport { base as labelPositionCSS } from '../Switch/_label-position/base';\n\nimport { StyledInput, StyledLabel, StyledTrigger } from './Switch.styles';\nimport { SwitchProps } from './Switch.types';\n\nconst base = css`\n position: relative;\n display: flex;\n align-items: center;\n\n cursor: pointer;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n &:focus {\n outline: 0 none;\n }\n`;\n\nexport const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>\n forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n size,\n view,\n focused,\n outlined,\n disabled,\n labelPosition,\n\n label,\n\n id,\n style,\n className,\n\n // singleLine,\n\n checked,\n pressed,\n defaultChecked,\n\n ...rest\n } = props;\n\n const exactChecked = Boolean((checked ?? pressed) !== undefined ? checked ?? pressed : defaultChecked);\n // const singleLineClass = singleLine ? 'single-line' : '';\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n focused={focused ?? outlined}\n labelPosition={labelPosition}\n id={id}\n style={style}\n className={className}\n >\n <StyledInput\n {...rest}\n ref={ref}\n role=\"switch\"\n aria-checked={exactChecked}\n type=\"checkbox\"\n checked={checked ?? pressed}\n defaultChecked={defaultChecked}\n disabled={disabled}\n />\n <StyledLabel tabIndex={-1}>{label}</StyledLabel>\n <StyledTrigger aria-hidden />\n </Root>\n );\n });\n\nexport const switchConfig = {\n name: 'Switch',\n tag: 'label',\n base,\n layout: switchRoot,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n labelPosition: {\n css: labelPositionCSS,\n },\n },\n defaults: {\n size: 's',\n view: 'default',\n },\n};\n"],"names":["base","switchRoot","Root","forwardRef","props","ref","size","view","focused","outlined","disabled","labelPosition","label","id","style","className","checked","pressed","defaultChecked","rest","_excluded","exactChecked","Boolean","undefined","React","createElement","StyledInput","_extends","role","type","StyledLabel","tabIndex","_StyledTrigger","StyledTrigger","switchConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","focusedCSS","labelPositionCSS","defaults"],"mappings":";;;;;;;;;;;AAaA,IAAMA,IAAI,GAWT,SAAA,CAAA;IAEYC,UAAU,GAAGA,SAAbA,UAAUA,CAAIC,IAA8C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CAAgC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACtD,IAAA,IACIC,IAAI,GAoBJF,KAAK,CApBLE,IAAI;MACJC,IAAI,GAmBJH,KAAK,CAnBLG,IAAI;MACJC,OAAO,GAkBPJ,KAAK,CAlBLI,OAAO;MACPC,QAAQ,GAiBRL,KAAK,CAjBLK,QAAQ;MACRC,QAAQ,GAgBRN,KAAK,CAhBLM,QAAQ;MACRC,aAAa,GAebP,KAAK,CAfLO,aAAa;MAEbC,KAAK,GAaLR,KAAK,CAbLQ,KAAK;MAELC,EAAE,GAWFT,KAAK,CAXLS,EAAE;MACFC,KAAK,GAULV,KAAK,CAVLU,KAAK;MACLC,SAAS,GASTX,KAAK,CATLW,SAAS;MAITC,OAAO,GAKPZ,KAAK,CALLY,OAAO;MACPC,OAAO,GAIPb,KAAK,CAJLa,OAAO;MACPC,cAAc,GAGdd,KAAK,CAHLc,cAAc;AAEXC,MAAAA,IAAAA,GAAAA,wBAAAA,CACHf,KAAK,EAAAgB,SAAA,CAAA,CAAA;IAET,IAAMC,YAAY,GAAGC,OAAO,CAAC,CAACN,OAAO,KAAPA,IAAAA,IAAAA,OAAO,KAAPA,KAAAA,CAAAA,GAAAA,OAAO,GAAIC,OAAO,MAAMM,SAAS,GAAGP,OAAO,KAAA,IAAA,IAAPA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AAQ;AACdC,EAAAA,GAAG,EAAE,OAAO;AACZpC,EAAAA,IAAI,EAAJA,IAAI;AACJqC,EAAAA,MAAM,EAAEpC,UAAU;AAClBqC,EAAAA,UAAU,EAAE;AACRhC,IAAAA,IAAI,EAAE;AACFiC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDjC,IAAAA,IAAI,EAAE;AACFgC,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACD/B,IAAAA,QAAQ,EAAE;AACN6B,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDnC,IAAAA,OAAO,EAAE;AACL+B,MAAAA,GAAG,EAAEK,MAAAA;KACR;AACDjC,IAAAA,aAAa,EAAE;AACX4B,MAAAA,GAAG,EAAEM,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxC,IAAAA,IAAI,EAAE,GAAG;AACTC,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.87.1-canary.1232.
|
3
|
+
"version": "0.87.1-canary.1232.9495527667.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -103,5 +103,5 @@
|
|
103
103
|
"react-popper": "2.3.0",
|
104
104
|
"storeon": "3.1.5"
|
105
105
|
},
|
106
|
-
"gitHead": "
|
106
|
+
"gitHead": "e7762bb22a983185f228ce96cf97c64a3a754f3d"
|
107
107
|
}
|
@@ -14,7 +14,7 @@ var _base4 = /*#__PURE__*/require("../Switch/_disabled/base");
|
|
14
14
|
var _base5 = /*#__PURE__*/require("../Switch/_label-position/base");
|
15
15
|
var _Switch = /*#__PURE__*/require("./Switch.styles");
|
16
16
|
var _StyledTrigger;
|
17
|
-
var _excluded = ["size", "view", "focused", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "defaultChecked"];
|
17
|
+
var _excluded = ["size", "view", "focused", "outlined", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
20
20
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -26,6 +26,7 @@ var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
|
26
26
|
var size = props.size,
|
27
27
|
view = props.view,
|
28
28
|
focused = props.focused,
|
29
|
+
outlined = props.outlined,
|
29
30
|
disabled = props.disabled,
|
30
31
|
labelPosition = props.labelPosition,
|
31
32
|
label = props.label,
|
@@ -33,16 +34,17 @@ var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
|
33
34
|
style = props.style,
|
34
35
|
className = props.className,
|
35
36
|
checked = props.checked,
|
37
|
+
pressed = props.pressed,
|
36
38
|
defaultChecked = props.defaultChecked,
|
37
39
|
rest = _objectWithoutProperties(props, _excluded);
|
38
|
-
var exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
|
40
|
+
var exactChecked = Boolean((checked !== null && checked !== void 0 ? checked : pressed) !== undefined ? checked !== null && checked !== void 0 ? checked : pressed : defaultChecked);
|
39
41
|
// const singleLineClass = singleLine ? 'single-line' : '';
|
40
42
|
|
41
43
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
42
44
|
view: view,
|
43
45
|
size: size,
|
44
46
|
disabled: disabled,
|
45
|
-
focused: focused,
|
47
|
+
focused: focused !== null && focused !== void 0 ? focused : outlined,
|
46
48
|
labelPosition: labelPosition,
|
47
49
|
id: id,
|
48
50
|
style: style,
|
@@ -52,7 +54,7 @@ var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
|
52
54
|
role: "switch",
|
53
55
|
"aria-checked": exactChecked,
|
54
56
|
type: "checkbox",
|
55
|
-
checked: checked,
|
57
|
+
checked: checked !== null && checked !== void 0 ? checked : pressed,
|
56
58
|
defaultChecked: defaultChecked,
|
57
59
|
disabled: disabled
|
58
60
|
})), /*#__PURE__*/_react["default"].createElement(_Switch.StyledLabel, {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var _StyledTrigger;
|
2
|
-
var _excluded = ["size", "view", "focused", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "defaultChecked"];
|
2
|
+
var _excluded = ["size", "view", "focused", "outlined", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
@@ -17,6 +17,7 @@ export var switchRoot = function switchRoot(Root) {
|
|
17
17
|
var size = props.size,
|
18
18
|
view = props.view,
|
19
19
|
focused = props.focused,
|
20
|
+
outlined = props.outlined,
|
20
21
|
disabled = props.disabled,
|
21
22
|
labelPosition = props.labelPosition,
|
22
23
|
label = props.label,
|
@@ -24,16 +25,17 @@ export var switchRoot = function switchRoot(Root) {
|
|
24
25
|
style = props.style,
|
25
26
|
className = props.className,
|
26
27
|
checked = props.checked,
|
28
|
+
pressed = props.pressed,
|
27
29
|
defaultChecked = props.defaultChecked,
|
28
30
|
rest = _objectWithoutProperties(props, _excluded);
|
29
|
-
var exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
|
31
|
+
var exactChecked = Boolean((checked !== null && checked !== void 0 ? checked : pressed) !== undefined ? checked !== null && checked !== void 0 ? checked : pressed : defaultChecked);
|
30
32
|
// const singleLineClass = singleLine ? 'single-line' : '';
|
31
33
|
|
32
34
|
return /*#__PURE__*/React.createElement(Root, {
|
33
35
|
view: view,
|
34
36
|
size: size,
|
35
37
|
disabled: disabled,
|
36
|
-
focused: focused,
|
38
|
+
focused: focused !== null && focused !== void 0 ? focused : outlined,
|
37
39
|
labelPosition: labelPosition,
|
38
40
|
id: id,
|
39
41
|
style: style,
|
@@ -43,7 +45,7 @@ export var switchRoot = function switchRoot(Root) {
|
|
43
45
|
role: "switch",
|
44
46
|
"aria-checked": exactChecked,
|
45
47
|
type: "checkbox",
|
46
|
-
checked: checked,
|
48
|
+
checked: checked !== null && checked !== void 0 ? checked : pressed,
|
47
49
|
defaultChecked: defaultChecked,
|
48
50
|
disabled: disabled
|
49
51
|
})), /*#__PURE__*/React.createElement(StyledLabel, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAe7C,eAAO,MAAM,UAAU,SAAU,UAAU,gBAAgB,EAAE,WAAW,CAAC,
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAe7C,eAAO,MAAM,UAAU,SAAU,UAAU,gBAAgB,EAAE,WAAW,CAAC,wMAqDnE,CAAC;AAEP,eAAO,MAAM,YAAY;;;;mBAvDQ,UAAU,gBAAgB,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAkFxE,CAAC"}
|
@@ -18,7 +18,20 @@ export interface SwitchPropsVariations extends SwitchPropsPropsBase {
|
|
18
18
|
* Расположение подпись
|
19
19
|
*/
|
20
20
|
labelPosition?: 'before' | 'after';
|
21
|
+
/**
|
22
|
+
* Добавить рамку при фокусе
|
23
|
+
*/
|
21
24
|
focused?: boolean;
|
25
|
+
/**
|
26
|
+
* Нажатие на компонент
|
27
|
+
* @deprecated
|
28
|
+
*/
|
29
|
+
pressed?: boolean;
|
30
|
+
/**
|
31
|
+
* Добавить рамку при фокусе
|
32
|
+
* @deprecated
|
33
|
+
*/
|
34
|
+
outlined?: boolean;
|
22
35
|
}
|
23
36
|
export declare type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & SwitchPropsVariations;
|
24
37
|
//# sourceMappingURL=Switch.types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEnC,OAAO,CAAC,EAAE,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"Switch.types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,oBAAY,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC"}
|