@salutejs/plasma-new-hope 0.177.1-dev.0 → 0.178.0-canary.1514.11575933383.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Counter/Counter.css +1 -1
- package/cjs/components/Counter/Counter.js +13 -3
- package/cjs/components/Counter/Counter.js.map +1 -1
- package/cjs/components/Counter/Counter.tokens.js +4 -0
- package/cjs/components/Counter/Counter.tokens.js.map +1 -1
- package/cjs/components/Counter/variations/_size/base.js +1 -1
- package/cjs/components/Counter/variations/_size/base.js.map +1 -1
- package/cjs/components/Counter/variations/_size/{base_1z0ohiy.css → base_4mz17d.css} +1 -1
- package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +2 -4
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
- package/cjs/components/Popover/Popover.js +1 -2
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/index.css +1 -1
- package/emotion/cjs/components/Counter/Counter.js +13 -3
- package/emotion/cjs/components/Counter/Counter.template-doc.mdx +2 -2
- package/emotion/cjs/components/Counter/Counter.tokens.js +4 -1
- package/emotion/cjs/components/Counter/variations/_size/base.js +1 -1
- package/emotion/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/emotion/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/emotion/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/emotion/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/emotion/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -6
- package/emotion/cjs/components/Popover/Popover.js +1 -2
- package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +12 -9
- package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
- package/emotion/cjs/examples/plasma_web/components/Counter/Counter.config.js +12 -9
- package/emotion/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
- package/emotion/es/components/Counter/Counter.js +13 -3
- package/emotion/es/components/Counter/Counter.template-doc.mdx +2 -2
- package/emotion/es/components/Counter/Counter.tokens.js +3 -0
- package/emotion/es/components/Counter/variations/_size/base.js +2 -2
- package/emotion/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/emotion/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/emotion/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/emotion/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/emotion/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +2 -4
- package/emotion/es/components/Popover/Popover.js +1 -2
- package/emotion/es/examples/plasma_b2c/components/Counter/Counter.config.js +12 -9
- package/emotion/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
- package/emotion/es/examples/plasma_web/components/Counter/Counter.config.js +12 -9
- package/emotion/es/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
- package/es/components/Counter/Counter.css +1 -1
- package/es/components/Counter/Counter.js +13 -3
- package/es/components/Counter/Counter.js.map +1 -1
- package/es/components/Counter/Counter.tokens.js +4 -1
- package/es/components/Counter/Counter.tokens.js.map +1 -1
- package/es/components/Counter/variations/_size/base.js +1 -1
- package/es/components/Counter/variations/_size/base.js.map +1 -1
- package/es/components/Counter/variations/_size/{base_1z0ohiy.css → base_4mz17d.css} +1 -1
- package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +2 -4
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
- package/es/components/Popover/Popover.js +1 -2
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/index.css +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Counter/Counter.js +13 -3
- package/styled-components/cjs/components/Counter/Counter.template-doc.mdx +2 -2
- package/styled-components/cjs/components/Counter/Counter.tokens.js +4 -1
- package/styled-components/cjs/components/Counter/variations/_size/base.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -6
- package/styled-components/cjs/components/Popover/Popover.js +1 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +5 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
- package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.config.js +5 -2
- package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
- package/styled-components/es/components/Counter/Counter.js +13 -3
- package/styled-components/es/components/Counter/Counter.template-doc.mdx +2 -2
- package/styled-components/es/components/Counter/Counter.tokens.js +3 -0
- package/styled-components/es/components/Counter/variations/_size/base.js +2 -2
- package/styled-components/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
- package/styled-components/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
- package/styled-components/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
- package/styled-components/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
- package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +2 -4
- package/styled-components/es/components/Popover/Popover.js +1 -2
- package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.config.js +5 -2
- package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
- package/styled-components/es/examples/plasma_web/components/Counter/Counter.config.js +5 -2
- package/styled-components/es/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
- package/types/components/Counter/Counter.d.ts.map +1 -1
- package/types/components/Counter/Counter.tokens.d.ts +3 -0
- package/types/components/Counter/Counter.tokens.d.ts.map +1 -1
- package/types/components/Counter/Counter.types.d.ts +2 -2
- package/types/components/Counter/variations/_size/base.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownDivider/DropdownDivider.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownFooter/DropdownFooter.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownGroup/DropdownGroup.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownHeader/DropdownHeader.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts.map +1 -1
- package/types/components/Popover/Popover.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts +3 -0
- package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Counter/Counter.d.ts +3 -0
- package/types/examples/plasma_b2c/components/Counter/Counter.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Counter/Counter.config.d.ts +3 -0
- package/types/examples/plasma_web/components/Counter/Counter.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Counter/Counter.d.ts +3 -0
- package/types/examples/plasma_web/components/Counter/Counter.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownFooter.js","sources":["../../../../../src/components/Dropdown/ui/DropdownFooter/DropdownFooter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\
|
1
|
+
{"version":3,"file":"DropdownFooter.js","sources":["../../../../../src/components/Dropdown/ui/DropdownFooter/DropdownFooter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { useUniqId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledDropdownFooter } from './DropdownFooter.styles';\nimport type { DropdownFooterProps } from './DropdownFooter.type';\n\n/**\n * Элемент выпадающего списка\n */\nexport const dropdownFooterRoot = (Root: RootProps<HTMLDivElement, DropdownFooterProps>) =>\n forwardRef<HTMLDivElement, DropdownFooterProps>(\n ({ id, className, children, view, size, ...rest }, outerRootRef) => {\n const uniqId = useUniqId();\n const innerId = id || uniqId;\n\n return (\n <Root id={innerId} ref={outerRootRef} view={view} size={size}>\n <StyledDropdownFooter className={className} {...rest}>\n {children}\n </StyledDropdownFooter>\n </Root>\n );\n },\n );\n\nexport const dropdownFooterConfig = {\n name: 'DropdownFooter',\n tag: 'div',\n layout: dropdownFooterRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["dropdownFooterRoot","Root","forwardRef","_ref","outerRootRef","id","className","children","view","size","rest","_objectWithoutProperties","_excluded","uniqId","useUniqId","innerId","React","createElement","ref","StyledDropdownFooter","_extends","dropdownFooterConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;AAUA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAAoD,EAAA;AAAA,EAAA,oBACnFC,UAAU,CACN,UAAAC,IAAA,EAAmDC,YAAY,EAAK;AAAA,IAAA,IAAjEC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;MAAEC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MAAEC,IAAI,GAAAL,IAAA,CAAJK,IAAI;MAAEC,IAAI,GAAAN,IAAA,CAAJM,IAAI;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAC3C,IAAA,IAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAC1B,IAAA,IAAMC,OAAO,GAAGV,EAAE,IAAIQ,MAAM,CAAA;AAE5B,IAAA,oBACIG,KAAA,CAAAC,aAAA,CAAChB,IAAI,EAAA;AAACI,MAAAA,EAAE,EAAEU,OAAQ;AAACG,MAAAA,GAAG,EAAEd,YAAa;AAACI,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,eACzDO,KAAA,CAAAC,aAAA,CAACE,oBAAoB,EAAAC,QAAA,CAAA;AAACd,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KAAA,EAAKI,IAAI,CAAA,EAC/CH,QACiB,CACpB,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMc,oBAAoB,GAAG;AAChCC,EAAAA,IAAI,EAAE,gBAAgB;AACtBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAExB,kBAAkB;AAC1ByB,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRlB,IAAAA,IAAI,EAAE;AACFmB,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDnB,IAAAA,IAAI,EAAE;AACFkB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef } from 'react';
|
3
|
+
import { useUniqId } from '@salutejs/plasma-core';
|
3
4
|
import { base } from './variations/_view/base.js';
|
4
5
|
import { base as base$1 } from './variations/_size/base.js';
|
5
6
|
import { StyledDropdownLabel, StyledDropdownGroup } from './DropdownGroup.styles.js';
|
6
|
-
import { safeUseId } from '../../../../utils/react.js';
|
7
7
|
|
8
8
|
var _excluded = ["id", "labelClassName", "groupClassName", "label", "children", "role", "view", "size"];
|
9
9
|
/**
|
@@ -20,7 +20,7 @@ var dropdownGroupRoot = function dropdownGroupRoot(Root) {
|
|
20
20
|
view = _ref.view,
|
21
21
|
size = _ref.size,
|
22
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
23
|
-
var uniqId =
|
23
|
+
var uniqId = useUniqId();
|
24
24
|
var innerId = id || uniqId;
|
25
25
|
return /*#__PURE__*/React.createElement(Root, {
|
26
26
|
id: innerId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownGroup.js","sources":["../../../../../src/components/Dropdown/ui/DropdownGroup/DropdownGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\
|
1
|
+
{"version":3,"file":"DropdownGroup.js","sources":["../../../../../src/components/Dropdown/ui/DropdownGroup/DropdownGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { useUniqId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledDropdownGroup, StyledDropdownLabel } from './DropdownGroup.styles';\nimport type { DropdownGroupProps } from './DropdownGroup.type';\n\n/**\n * Элемент группы выпадающего списка\n */\nexport const dropdownGroupRoot = (Root: RootProps<HTMLDivElement, DropdownGroupProps>) =>\n forwardRef<HTMLDivElement, DropdownGroupProps>(\n ({ id, labelClassName, groupClassName, label, children, role, view, size, ...rest }, outerRootRef) => {\n const uniqId = useUniqId();\n const innerId = id || uniqId;\n\n return (\n <Root id={innerId} ref={outerRootRef} view={view} size={size} role={role}>\n <StyledDropdownLabel className={labelClassName}>{label}</StyledDropdownLabel>\n <StyledDropdownGroup className={groupClassName} {...rest}>\n {children}\n </StyledDropdownGroup>\n </Root>\n );\n },\n );\n\nexport const dropdownGroupConfig = {\n name: 'DropdownGroup',\n tag: 'div',\n layout: dropdownGroupRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["dropdownGroupRoot","Root","forwardRef","_ref","outerRootRef","id","labelClassName","groupClassName","label","children","role","view","size","rest","_objectWithoutProperties","_excluded","uniqId","useUniqId","innerId","React","createElement","ref","StyledDropdownLabel","className","StyledDropdownGroup","_extends","dropdownGroupConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;AAUA;AACA;AACA;IACaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,IAAmD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EAAqFC,YAAY,EAAK;AAAA,IAAA,IAAnGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAAEC,cAAc,GAAAH,IAAA,CAAdG,cAAc;MAAEC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;MAAEC,KAAK,GAAAL,IAAA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H;AACDC,EAAAA,QAAQ,EAAE;AACNxB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef } from 'react';
|
3
|
+
import { useUniqId } from '@salutejs/plasma-core';
|
3
4
|
import { base } from './variations/_view/base.js';
|
4
5
|
import { base as base$1 } from './variations/_size/base.js';
|
5
6
|
import { StyledDropdownHeader } from './DropdownHeader.styles.js';
|
6
|
-
import { safeUseId } from '../../../../utils/react.js';
|
7
7
|
|
8
8
|
var _excluded = ["id", "className", "view", "size", "children"];
|
9
9
|
/**
|
@@ -17,7 +17,7 @@ var dropdownHeaderRoot = function dropdownHeaderRoot(Root) {
|
|
17
17
|
size = _ref.size,
|
18
18
|
children = _ref.children,
|
19
19
|
rest = _objectWithoutProperties(_ref, _excluded);
|
20
|
-
var uniqId =
|
20
|
+
var uniqId = useUniqId();
|
21
21
|
var innerId = id || uniqId;
|
22
22
|
return /*#__PURE__*/React.createElement(Root, {
|
23
23
|
id: innerId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownHeader.js","sources":["../../../../../src/components/Dropdown/ui/DropdownHeader/DropdownHeader.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\
|
1
|
+
{"version":3,"file":"DropdownHeader.js","sources":["../../../../../src/components/Dropdown/ui/DropdownHeader/DropdownHeader.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { useUniqId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledDropdownHeader } from './DropdownHeader.styles';\nimport type { DropdownHeaderProps } from './DropdownHeader.type';\n\n/**\n * Элемент выпадающего списка\n */\nexport const dropdownHeaderRoot = (Root: RootProps<HTMLDivElement, DropdownHeaderProps>) =>\n forwardRef<HTMLDivElement, DropdownHeaderProps>(\n ({ id, className, view, size, children, ...rest }, outerRootRef) => {\n const uniqId = useUniqId();\n const innerId = id || uniqId;\n\n return (\n <Root id={innerId} ref={outerRootRef} view={view} size={size}>\n <StyledDropdownHeader className={className} {...rest}>\n {children}\n </StyledDropdownHeader>\n </Root>\n );\n },\n );\n\nexport const dropdownHeaderConfig = {\n name: 'DropdownHeader',\n tag: 'div',\n layout: dropdownHeaderRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["dropdownHeaderRoot","Root","forwardRef","_ref","outerRootRef","id","className","view","size","children","rest","_objectWithoutProperties","_excluded","uniqId","useUniqId","innerId","React","createElement","ref","StyledDropdownHeader","_extends","dropdownHeaderConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;AAUA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAAoD,EAAA;AAAA,EAAA,oBACnFC,UAAU,CACN,UAAAC,IAAA,EAAmDC,YAAY,EAAK;AAAA,IAAA,IAAjEC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;MAAEC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MAAEC,IAAI,GAAAL,IAAA,CAAJK,IAAI;MAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAC3C,IAAA,IAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAC1B,IAAA,IAAMC,OAAO,GAAGV,EAAE,IAAIQ,MAAM,CAAA;AAE5B,IAAA,oBACIG,KAAA,CAAAC,aAAA,CAAChB,IAAI,EAAA;AAACI,MAAAA,EAAE,EAAEU,OAAQ;AAACG,MAAAA,GAAG,EAAEd,YAAa;AAACG,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,eACzDQ,KAAA,CAAAC,aAAA,CAACE,oBAAoB,EAAAC,QAAA,CAAA;AAACd,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KAAA,EAAKI,IAAI,CAAA,EAC/CD,QACiB,CACpB,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMY,oBAAoB,GAAG;AAChCC,EAAAA,IAAI,EAAE,gBAAgB;AACtBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAExB,kBAAkB;AAC1ByB,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRnB,IAAAA,IAAI,EAAE;AACFoB,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDpB,IAAAA,IAAI,EAAE;AACFmB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef, useRef } from 'react';
|
3
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
3
|
+
import { useUniqId, useForkRef, useFocusTrap } from '@salutejs/plasma-core';
|
4
4
|
import { base } from './variations/_view/base.js';
|
5
5
|
import { base as base$1 } from './variations/_size/base.js';
|
6
6
|
import { StyledPopover, StyledDropdown } from './Dropdown.styles.js';
|
7
7
|
import { getPlacements } from './utils/index.js';
|
8
|
-
import { safeUseId } from '../../../../utils/react.js';
|
9
|
-
import { useFocusTrap } from '../../../../hooks/useFocusTrap.js';
|
10
8
|
|
11
9
|
var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "opened", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
|
12
10
|
/**
|
@@ -43,7 +41,7 @@ var dropdownOldRoot = function dropdownOldRoot(Root) {
|
|
43
41
|
closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
|
44
42
|
rest = _objectWithoutProperties(_ref, _excluded);
|
45
43
|
var innerIsOpen = Boolean(isOpen || opened);
|
46
|
-
var uniqId =
|
44
|
+
var uniqId = useUniqId();
|
47
45
|
var innerId = id || uniqId;
|
48
46
|
var rootRef = useRef(null);
|
49
47
|
var dropdownRef = useRef(null);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownOld.js","sources":["../../../../../src/components/Dropdown/ui/DropdownOld/DropdownOld.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\nimport { useForkRef } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\
|
1
|
+
{"version":3,"file":"DropdownOld.js","sources":["../../../../../src/components/Dropdown/ui/DropdownOld/DropdownOld.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\nimport { useFocusTrap, useForkRef, useUniqId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledDropdown, StyledPopover } from './Dropdown.styles';\nimport { getPlacements } from './utils';\nimport type { DropdownProps } from './Dropdown.types';\n\n/**\n * Выпадающий список без внешнего контроля видимости.\n */\nexport const dropdownOldRoot = (Root: RootProps<HTMLDivElement, DropdownProps>) =>\n forwardRef<HTMLDivElement, DropdownProps>(\n (\n {\n id,\n target,\n children,\n hasArrow,\n role,\n view,\n size,\n frame,\n onToggle,\n isFocusTrapped = true,\n isOpen = false,\n opened = false,\n placement = 'auto',\n trigger = 'click',\n offset = [0, 6],\n preventOverflow = false,\n closeOnOverlayClick = false,\n closeOnEsc = false,\n ...rest\n },\n outerRootRef,\n ) => {\n const innerIsOpen = Boolean(isOpen || opened);\n\n const uniqId = useUniqId();\n const innerId = id || uniqId;\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n\n const trapRef = useFocusTrap(innerIsOpen && isFocusTrapped);\n\n const dropdownForkRef = useForkRef<HTMLDivElement>(dropdownRef, trapRef);\n\n return (\n <StyledPopover\n role={role}\n opened={innerIsOpen}\n usePortal={false}\n onToggle={(is, event) => onToggle?.(is, event)}\n id={innerId}\n ref={dropdownForkRef}\n target={target}\n offset={offset}\n preventOverflow={preventOverflow}\n hasArrow={hasArrow}\n placement={getPlacements(placement)}\n trigger={trigger}\n closeOnOverlayClick={closeOnOverlayClick}\n closeOnEsc={closeOnEsc}\n isFocusTrapped={isFocusTrapped}\n frame={frame}\n >\n <Root ref={handleRef} view={view} size={size} {...rest}>\n <StyledDropdown>{children}</StyledDropdown>\n </Root>\n </StyledPopover>\n );\n },\n );\n\nexport const dropdownOldConfig = {\n name: 'Dropdown',\n tag: 'div',\n layout: dropdownOldRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["dropdownOldRoot","Root","forwardRef","_ref","outerRootRef","id","target","children","hasArrow","role","view","size","frame","onToggle","_ref$isFocusTrapped","isFocusTrapped","_ref$isOpen","isOpen","_ref$opened","opened","_ref$placement","placement","_ref$trigger","trigger","_ref$offset","offset","_ref$preventOverflow","preventOverflow","_ref$closeOnOverlayCl","closeOnOverlayClick","_ref$closeOnEsc","closeOnEsc","rest","_objectWithoutProperties","_excluded","innerIsOpen","Boolean","uniqId","useUniqId","innerId","rootRef","useRef","dropdownRef","handleRef","useForkRef","trapRef","useFocusTrap","dropdownForkRef","React","createElement","StyledPopover","usePortal","is","event","ref","getPlacements","_extends","StyledDropdown","dropdownOldConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;AAWA;AACA;AACA;IACaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAA8C,EAAA;AAAA,EAAA,oBAC1EC,UAAU,CACN,UAAAC,IAAA,EAsBIC,YAAY,EACX;AAAA,IAAA,IArBGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACRC,IAAI,GAAAN,IAAA,CAAJM,IAAI;MACJC,IAAI,GAAAP,IAAA,CAAJO,IAAI;MACJC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;MACJC,KAAK,GAAAT,IAAA,CAALS,KAAK;MACLC,SAAQ,GAAAV,IAAA,CAARU,QAAQ;MAAAC,mBAAA,GAAAX,IAAA,CACRY,cAAc;AAAdA,MAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;MAAAE,WAAA,GAAAb,IAAA,CACrBc,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,WAAA;MAAAE,WAAA,GAAAf,IAAA,CACdgB,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,WAAA;MAAAE,cAAA,GAAAjB,IAAA,CACdkB,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,cAAA;MAAAE,YAAA,GAAAnB,IAAA,CAClBoB,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,Y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E;AACRrD,IAAAA,IAAI,EAAE;AACFsD,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDtD,IAAAA,IAAI,EAAE;AACFqD,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNzD,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
|
3
3
|
import { usePopper } from 'react-popper';
|
4
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
4
|
+
import { useForkRef, useFocusTrap } from '@salutejs/plasma-core';
|
5
5
|
import { cx } from '../../utils/index.js';
|
6
6
|
import { base } from './variations/_view/base.js';
|
7
7
|
import { StyledWrapper, StyledRoot, StyledPopover, StyledArrow } from './Popover.styles.js';
|
8
8
|
import { classes } from './Popover.tokens.js';
|
9
|
-
import { useFocusTrap } from '../../hooks/useFocusTrap.js';
|
10
9
|
import { Portal } from '../Portal/Portal.js';
|
11
10
|
|
12
11
|
var _excluded = ["target", "children", "isOpen", "opened", "trigger", "hasArrow", "frame", "className", "placement", "offset", "zIndex", "isFocusTrapped", "closeOnEsc", "preventOverflow", "usePortal", "view", "onToggle", "closeOnOverlayClick"];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { useFocusTrap } from '../../hooks';\nimport { cx } from '../../utils';\nimport { Portal } from '../Portal';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n opened,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const innerIsOpen = Boolean(isOpen || opened);\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(innerIsOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: innerIsOpen ? 'visible' : 'hidden',\n opacity: innerIsOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (innerIsOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, innerIsOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (innerIsOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n const popoverRootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget && !popoverRootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, innerIsOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!innerIsOpen, event);\n }\n }\n },\n [trigger, innerIsOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [innerIsOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, innerIsOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!innerIsOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [innerIsOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children && portalRef.current && (\n <Portal container={portalRef.current}>\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: innerIsOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>\n </Portal>\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","opened","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","innerIsOpen","Boolean","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","_popoverRef$current","targetIsRoot","rootHasTarget","contains","popoverRootHasTarget","onClick","_popoverRef$current2","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","Portal","container","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;AAeO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA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EAAA;MACrB1G,SAAS,EAAEiG,OAAO,CAACU,IAAK;AACxBP,MAAAA,GAAG,EAAEtE,cAAe;MACpB8E,KAAK,EAAAC,cAAA,CAAAA,cAAA,CAAAA,cAAA,CACElD,EAAAA,EAAAA,MAAM,CAAC+C,MAAM,CACb,EAAA;AAAEI,QAAAA,OAAO,EAAE1F,WAAW,GAAG,OAAO,GAAG,MAAA;OAAQ,CAAA,EAC3CyB,aAAa,CAClB;AACFxC,MAAAA,MAAM,EAAEA,MAAAA;KAEPR,CAAAA,EAAAA,QAAQ,iBACLkG,KAAA,CAAAR,aAAA,CAACwB,WAAW,EAAAP,QAAA,CAAA;MACRxG,SAAS,EAAEiG,OAAO,CAACe,KAAM;AACzBZ,MAAAA,GAAG,EAAEhE,eAAgB;MACrBwE,KAAK,EAAEjD,MAAM,CAACqD,KAAAA;KACVpD,EAAAA,UAAU,CAACoD,KAAK,CACvB,CACJ,EACAxH,QACU,CACb,CACF,CAED,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMyH,aAAa,GAAG;AACzB5D,EAAAA,IAAI,EAAE,SAAS;AACf6D,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElI,WAAW;AACnBmI,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRvG,IAAAA,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN1G,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\nimport { Portal } from '../Portal';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n opened,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const innerIsOpen = Boolean(isOpen || opened);\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(innerIsOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: innerIsOpen ? 'visible' : 'hidden',\n opacity: innerIsOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (innerIsOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, innerIsOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (innerIsOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n const popoverRootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget && !popoverRootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, innerIsOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!innerIsOpen, event);\n }\n }\n },\n [trigger, innerIsOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [innerIsOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, innerIsOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!innerIsOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [innerIsOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children && portalRef.current && (\n <Portal container={portalRef.current}>\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: innerIsOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>\n </Portal>\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","opened","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","innerIsOpen","Boolean","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","_popoverRef$current","targetIsRoot","rootHasTarget","contains","popoverRootHasTarget","onClick","_popoverRef$current2","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","Portal","container","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEt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MAAM,EAAA;MACrB1G,SAAS,EAAEiG,OAAO,CAACU,IAAK;AACxBP,MAAAA,GAAG,EAAEtE,cAAe;MACpB8E,KAAK,EAAAC,cAAA,CAAAA,cAAA,CAAAA,cAAA,CACElD,EAAAA,EAAAA,MAAM,CAAC+C,MAAM,CACb,EAAA;AAAEI,QAAAA,OAAO,EAAE1F,WAAW,GAAG,OAAO,GAAG,MAAA;OAAQ,CAAA,EAC3CyB,aAAa,CAClB;AACFxC,MAAAA,MAAM,EAAEA,MAAAA;KAEPR,CAAAA,EAAAA,QAAQ,iBACLkG,KAAA,CAAAR,aAAA,CAACwB,WAAW,EAAAP,QAAA,CAAA;MACRxG,SAAS,EAAEiG,OAAO,CAACe,KAAM;AACzBZ,MAAAA,GAAG,EAAEhE,eAAgB;MACrBwE,KAAK,EAAEjD,MAAM,CAACqD,KAAAA;KACVpD,EAAAA,UAAU,CAACoD,KAAK,CACvB,CACJ,EACAxH,QACU,CACb,CACF,CAED,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMyH,aAAa,GAAG;AACzB5D,EAAAA,IAAI,EAAE,SAAS;AACf6D,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElI,WAAW;AACnBmI,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRvG,IAAAA,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN1G,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
package/es/index.css
CHANGED
@@ -475,7 +475,7 @@
|
|
475
475
|
|
476
476
|
.base_1vjakah_b15waymg__f123ad8a{color:var(--plasma-counter-color);background-color:var(--plasma-counter-background);}
|
477
477
|
|
478
|
-
.
|
478
|
+
.base_4mz17d_b1t6e429__b5e2cba4{font-family:var(--plasma-counter-font-family);font-size:var(--plasma-counter-font-size);font-style:var(--plasma-counter-font-style);font-weight:var(--plasma-counter-font-weight);-webkit-letter-spacing:var(--plasma-counter-letter-spacing);-moz-letter-spacing:var(--plasma-counter-letter-spacing);-ms-letter-spacing:var(--plasma-counter-letter-spacing);letter-spacing:var(--plasma-counter-letter-spacing);line-height:var(--plasma-counter-lineheight);border-radius:var(--plasma-counter-border-radius);height:var(--plasma-counter-height);padding-top:var(--plasma-counter-padding-top);padding-right:var(--plasma-counter-padding-right);padding-bottom:var(--plasma-counter-padding-bottom);padding-left:var(--plasma-counter-padding-left);}.base_4mz17d_b1t6e429__b5e2cba4.base_4mz17d__PlasmaCounterRound__b5e2cba4{width:var(--plasma-counter-height);}
|
479
479
|
|
480
480
|
.Counter_styles_1uue90v_b1dqw7l5__00d0b847{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;}
|
481
481
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.178.0-canary.1514.11575933383.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -80,7 +80,7 @@
|
|
80
80
|
"@rollup/plugin-babel": "^6.0.4",
|
81
81
|
"@rollup/plugin-commonjs": "^25.0.4",
|
82
82
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
83
|
-
"@salutejs/plasma-sb-utils": "0.
|
83
|
+
"@salutejs/plasma-sb-utils": "0.182.0-canary.1514.11575933383.0",
|
84
84
|
"@salutejs/plasma-themes": "0.22.0-dev.0",
|
85
85
|
"@storybook/addon-docs": "^7.6.17",
|
86
86
|
"@storybook/addon-essentials": "^7.6.17",
|
@@ -115,7 +115,7 @@
|
|
115
115
|
"@linaria/react": "5.0.3",
|
116
116
|
"@popperjs/core": "2.11.8",
|
117
117
|
"@salutejs/input-core": "2.1.2",
|
118
|
-
"@salutejs/plasma-core": "1.
|
118
|
+
"@salutejs/plasma-core": "1.184.0-canary.1514.11575933383.0",
|
119
119
|
"@salutejs/react-maskinput": "3.2.6",
|
120
120
|
"classnames": "2.5.1",
|
121
121
|
"dayjs": "1.11.11",
|
@@ -128,5 +128,5 @@
|
|
128
128
|
"sideEffects": [
|
129
129
|
"*.css"
|
130
130
|
],
|
131
|
-
"gitHead": "
|
131
|
+
"gitHead": "e7e7d66dbd9ea86554311df2f6581890d68d793f"
|
132
132
|
}
|
@@ -6,28 +6,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.counterRoot = exports.counterConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
9
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
10
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
11
12
|
var _Counter = /*#__PURE__*/require("./Counter.styles");
|
12
|
-
var
|
13
|
+
var _Counter2 = /*#__PURE__*/require("./Counter.tokens");
|
14
|
+
var _excluded = ["count", "maxCount", "size", "view", "className"];
|
13
15
|
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); }
|
14
16
|
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; }
|
15
17
|
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); }
|
16
18
|
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; }
|
17
19
|
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; }
|
20
|
+
var MIN_COUNT = 1;
|
18
21
|
var counterRoot = exports.counterRoot = function counterRoot(Root) {
|
19
22
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
20
23
|
var count = props.count,
|
21
24
|
maxCount = props.maxCount,
|
22
25
|
size = props.size,
|
23
26
|
view = props.view,
|
27
|
+
className = props.className,
|
24
28
|
rest = _objectWithoutProperties(props, _excluded);
|
25
|
-
var
|
29
|
+
var currentCount = count < MIN_COUNT ? MIN_COUNT : count;
|
30
|
+
var currentMaxCount = maxCount && maxCount < MIN_COUNT ? MIN_COUNT : maxCount;
|
31
|
+
var isCurrentCountOneDigit = currentCount >= 0 && currentCount < 10;
|
32
|
+
var isCurrentMaxCountExceeded = currentMaxCount && currentCount > currentMaxCount;
|
33
|
+
var content = isCurrentMaxCountExceeded ? "".concat(currentMaxCount, "+") : currentCount;
|
34
|
+
var roundClass = !isCurrentMaxCountExceeded && isCurrentCountOneDigit ? _Counter2.classes.round : undefined;
|
26
35
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
27
36
|
ref: ref,
|
28
37
|
view: view,
|
29
38
|
size: size,
|
30
|
-
count: count
|
39
|
+
count: count,
|
40
|
+
className: (0, _utils.cx)(roundClass, className)
|
31
41
|
}, rest), content);
|
32
42
|
});
|
33
43
|
};
|
@@ -12,7 +12,7 @@ import { PropsTable, Description } from '@site/src/components';
|
|
12
12
|
## Примеры
|
13
13
|
|
14
14
|
### Максимальное значение числового badge
|
15
|
-
Задается с помощью свойства `maxCount`.
|
15
|
+
Задается с помощью свойства `maxCount`. Как и `count`, не может быть меньше 1.
|
16
16
|
|
17
17
|
```tsx live
|
18
18
|
import React from 'react';
|
@@ -29,7 +29,7 @@ export function App() {
|
|
29
29
|
```
|
30
30
|
|
31
31
|
### Размер числового badge
|
32
|
-
Размер задается с помощью свойства `size`. Возможные значения свойства: `
|
32
|
+
Размер задается с помощью свойства `size`. Возможные значения свойства: `xxs`, `xs`, `s`, `m`, `l`.
|
33
33
|
|
34
34
|
```tsx live
|
35
35
|
import React from 'react';
|
@@ -3,7 +3,10 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.tokens = void 0;
|
6
|
+
exports.tokens = exports.classes = void 0;
|
7
|
+
var classes = exports.classes = {
|
8
|
+
round: '--plasma-counter-round'
|
9
|
+
};
|
7
10
|
var tokens = exports.tokens = {
|
8
11
|
background: '--plasma-counter-background',
|
9
12
|
color: '--plasma-counter-color',
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Counter = /*#__PURE__*/require("../../Counter.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding-top:var(", ");padding-right:var(", ");padding-bottom:var(", ");padding-left:var(", ");"], _Counter.tokens.fontFamily, _Counter.tokens.fontSize, _Counter.tokens.fontStyle, _Counter.tokens.fontWeight, _Counter.tokens.letterSpacing, _Counter.tokens.lineHeight, _Counter.tokens.borderRadius, _Counter.tokens.height, _Counter.tokens.paddingTop, _Counter.tokens.paddingRight, _Counter.tokens.paddingBottom, _Counter.tokens.paddingLeft);
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding-top:var(", ");padding-right:var(", ");padding-bottom:var(", ");padding-left:var(", ");&.", "{width:var(", ");}"], _Counter.tokens.fontFamily, _Counter.tokens.fontSize, _Counter.tokens.fontStyle, _Counter.tokens.fontWeight, _Counter.tokens.letterSpacing, _Counter.tokens.lineHeight, _Counter.tokens.borderRadius, _Counter.tokens.height, _Counter.tokens.paddingTop, _Counter.tokens.paddingRight, _Counter.tokens.paddingBottom, _Counter.tokens.paddingLeft, _Counter.classes.round, _Counter.tokens.height);
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.dropdownDividerRoot = exports.dropdownDividerConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
11
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
12
12
|
var _DropdownDivider = /*#__PURE__*/require("./DropdownDivider.styles");
|
@@ -26,7 +26,7 @@ var dropdownDividerRoot = exports.dropdownDividerRoot = function dropdownDivider
|
|
26
26
|
view = _ref.view,
|
27
27
|
size = _ref.size,
|
28
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
29
|
-
var uniqId = (0,
|
29
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
30
30
|
var innerId = id || uniqId;
|
31
31
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
32
32
|
id: innerId,
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.dropdownFooterRoot = exports.dropdownFooterConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
11
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
12
12
|
var _DropdownFooter = /*#__PURE__*/require("./DropdownFooter.styles");
|
@@ -27,7 +27,7 @@ var dropdownFooterRoot = exports.dropdownFooterRoot = function dropdownFooterRoo
|
|
27
27
|
view = _ref.view,
|
28
28
|
size = _ref.size,
|
29
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
30
|
-
var uniqId = (0,
|
30
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
31
31
|
var innerId = id || uniqId;
|
32
32
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
33
33
|
id: innerId,
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.dropdownGroupRoot = exports.dropdownGroupConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
11
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
12
12
|
var _DropdownGroup = /*#__PURE__*/require("./DropdownGroup.styles");
|
@@ -30,7 +30,7 @@ var dropdownGroupRoot = exports.dropdownGroupRoot = function dropdownGroupRoot(R
|
|
30
30
|
view = _ref.view,
|
31
31
|
size = _ref.size,
|
32
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
33
|
-
var uniqId = (0,
|
33
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
34
34
|
var innerId = id || uniqId;
|
35
35
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
36
36
|
id: innerId,
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.dropdownHeaderRoot = exports.dropdownHeaderConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
11
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
12
12
|
var _DropdownHeader = /*#__PURE__*/require("./DropdownHeader.styles");
|
@@ -27,7 +27,7 @@ var dropdownHeaderRoot = exports.dropdownHeaderRoot = function dropdownHeaderRoo
|
|
27
27
|
size = _ref.size,
|
28
28
|
children = _ref.children,
|
29
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
30
|
-
var uniqId = (0,
|
30
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
31
31
|
var innerId = id || uniqId;
|
32
32
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
33
33
|
id: innerId,
|
@@ -7,12 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.dropdownOldRoot = exports.dropdownOldConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
9
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
|
-
var _hooks = /*#__PURE__*/require("../../../../hooks");
|
11
|
-
var _utils = /*#__PURE__*/require("../../../../utils");
|
12
10
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
13
11
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
14
12
|
var _Dropdown = /*#__PURE__*/require("./Dropdown.styles");
|
15
|
-
var
|
13
|
+
var _utils = /*#__PURE__*/require("./utils");
|
16
14
|
var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "opened", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
|
17
15
|
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); }
|
18
16
|
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; }
|
@@ -53,12 +51,12 @@ var dropdownOldRoot = exports.dropdownOldRoot = function dropdownOldRoot(Root) {
|
|
53
51
|
closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
|
54
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
55
53
|
var innerIsOpen = Boolean(isOpen || opened);
|
56
|
-
var uniqId = (0,
|
54
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
57
55
|
var innerId = id || uniqId;
|
58
56
|
var rootRef = (0, _react.useRef)(null);
|
59
57
|
var dropdownRef = (0, _react.useRef)(null);
|
60
58
|
var handleRef = (0, _plasmaCore.useForkRef)(rootRef, outerRootRef);
|
61
|
-
var trapRef = (0,
|
59
|
+
var trapRef = (0, _plasmaCore.useFocusTrap)(innerIsOpen && isFocusTrapped);
|
62
60
|
var dropdownForkRef = (0, _plasmaCore.useForkRef)(dropdownRef, trapRef);
|
63
61
|
return /*#__PURE__*/_react["default"].createElement(_Dropdown.StyledPopover, {
|
64
62
|
role: role,
|
@@ -73,7 +71,7 @@ var dropdownOldRoot = exports.dropdownOldRoot = function dropdownOldRoot(Root) {
|
|
73
71
|
offset: offset,
|
74
72
|
preventOverflow: preventOverflow,
|
75
73
|
hasArrow: hasArrow,
|
76
|
-
placement: (0,
|
74
|
+
placement: (0, _utils.getPlacements)(placement),
|
77
75
|
trigger: trigger,
|
78
76
|
closeOnOverlayClick: closeOnOverlayClick,
|
79
77
|
closeOnEsc: closeOnEsc,
|
@@ -8,7 +8,6 @@ exports.popoverRoot = exports.popoverConfig = exports.POPOVER_PORTAL_ID = export
|
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
9
|
var _reactPopper = /*#__PURE__*/require("react-popper");
|
10
10
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
11
|
-
var _hooks = /*#__PURE__*/require("../../hooks");
|
12
11
|
var _utils = /*#__PURE__*/require("../../utils");
|
13
12
|
var _Portal = /*#__PURE__*/require("../Portal");
|
14
13
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
@@ -73,7 +72,7 @@ var popoverRoot = exports.popoverRoot = function popoverRoot(Root) {
|
|
73
72
|
var popoverRef = (0, _react.useRef)(null);
|
74
73
|
var handleRef = (0, _plasmaCore.useForkRef)(rootRef, outerRootRef);
|
75
74
|
var portalRef = (0, _react.useRef)(null);
|
76
|
-
var trapRef = (0,
|
75
|
+
var trapRef = (0, _plasmaCore.useFocusTrap)(innerIsOpen && isFocusTrapped);
|
77
76
|
var popoverForkRef = (0, _plasmaCore.useForkRef)(popoverRef, trapRef);
|
78
77
|
var _useState = (0, _react.useState)(null),
|
79
78
|
_useState2 = _slicedToArray(_useState, 2),
|