@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,5 +1,5 @@
|
|
1
1
|
.base_1vjakah_b15waymg__f123ad8a{color:var(--plasma-counter-color);background-color:var(--plasma-counter-background);}
|
2
2
|
|
3
|
-
.
|
3
|
+
.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);}
|
4
4
|
|
5
5
|
.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;}
|
@@ -4,24 +4,34 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
6
6
|
var React = require('react');
|
7
|
+
var index = require('../../utils/index.js');
|
7
8
|
var base = require('./variations/_view/base.js');
|
8
9
|
var base$1 = require('./variations/_size/base.js');
|
9
10
|
var Counter_styles = require('./Counter.styles.js');
|
11
|
+
var Counter_tokens = require('./Counter.tokens.js');
|
10
12
|
|
11
|
-
var _excluded = ["count", "maxCount", "size", "view"];
|
13
|
+
var _excluded = ["count", "maxCount", "size", "view", "className"];
|
14
|
+
var MIN_COUNT = 1;
|
12
15
|
var counterRoot = function counterRoot(Root) {
|
13
16
|
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
14
17
|
var count = props.count,
|
15
18
|
maxCount = props.maxCount,
|
16
19
|
size = props.size,
|
17
20
|
view = props.view,
|
21
|
+
className = props.className,
|
18
22
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
19
|
-
var
|
23
|
+
var currentCount = count < MIN_COUNT ? MIN_COUNT : count;
|
24
|
+
var currentMaxCount = maxCount && maxCount < MIN_COUNT ? MIN_COUNT : maxCount;
|
25
|
+
var isCurrentCountOneDigit = currentCount >= 0 && currentCount < 10;
|
26
|
+
var isCurrentMaxCountExceeded = currentMaxCount && currentCount > currentMaxCount;
|
27
|
+
var content = isCurrentMaxCountExceeded ? "".concat(currentMaxCount, "+") : currentCount;
|
28
|
+
var roundClass = !isCurrentMaxCountExceeded && isCurrentCountOneDigit ? Counter_tokens.classes.round : undefined;
|
20
29
|
return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
|
21
30
|
ref: ref,
|
22
31
|
view: view,
|
23
32
|
size: size,
|
24
|
-
count: count
|
33
|
+
count: count,
|
34
|
+
className: index.cx(roundClass, className)
|
25
35
|
}, rest), content);
|
26
36
|
});
|
27
37
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Counter.js","sources":["../../../src/components/Counter/Counter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport type { RootProps } from '../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport type { CounterProps } from './Counter.types';\nimport { base } from './Counter.styles';\n\nexport const counterRoot = (Root: RootProps<HTMLDivElement, CounterProps>) =>\n forwardRef<HTMLDivElement, CounterProps>((props, ref) => {\n const { count, maxCount, size, view, ...rest } = props;\n\n const
|
1
|
+
{"version":3,"file":"Counter.js","sources":["../../../src/components/Counter/Counter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport type { CounterProps } from './Counter.types';\nimport { base } from './Counter.styles';\nimport { classes } from './Counter.tokens';\n\nconst MIN_COUNT = 1;\n\nexport const counterRoot = (Root: RootProps<HTMLDivElement, CounterProps>) =>\n forwardRef<HTMLDivElement, CounterProps>((props, ref) => {\n const { count, maxCount, size, view, className, ...rest } = props;\n\n const currentCount = count < MIN_COUNT ? MIN_COUNT : count;\n const currentMaxCount = maxCount && maxCount < MIN_COUNT ? MIN_COUNT : maxCount;\n\n const isCurrentCountOneDigit = currentCount >= 0 && currentCount < 10;\n const isCurrentMaxCountExceeded = currentMaxCount && currentCount > currentMaxCount;\n\n const content = isCurrentMaxCountExceeded ? `${currentMaxCount}+` : currentCount;\n\n const roundClass = !isCurrentMaxCountExceeded && isCurrentCountOneDigit ? classes.round : undefined;\n\n return (\n <Root ref={ref} view={view} size={size} count={count} className={cx(roundClass, className)} {...rest}>\n {content}\n </Root>\n );\n });\n\nexport const counterConfig = {\n name: 'Counter',\n tag: 'div',\n layout: counterRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'xs',\n },\n};\n"],"names":["MIN_COUNT","counterRoot","Root","forwardRef","props","ref","count","maxCount","size","view","className","rest","_objectWithoutProperties","_excluded","currentCount","currentMaxCount","isCurrentCountOneDigit","isCurrentMaxCountExceeded","content","concat","roundClass","classes","round","undefined","React","createElement","_extends","cx","counterConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;AAWA,IAAMA,SAAS,GAAG,CAAC,CAAA;IAENC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CAA+B,UAACC,KAAK,EAAEC,GAAG,EAAK;AACrD,IAAA,IAAQC,KAAK,GAA+CF,KAAK,CAAzDE,KAAK;MAAEC,QAAQ,GAAqCH,KAAK,CAAlDG,QAAQ;MAAEC,IAAI,GAA+BJ,KAAK,CAAxCI,IAAI;MAAEC,IAAI,GAAyBL,KAAK,CAAlCK,IAAI;MAAEC,SAAS,GAAcN,KAAK,CAA5BM,SAAS;AAAKC,MAAAA,IAAI,GAAAC,iDAAA,CAAKR,KAAK,EAAAS,SAAA,CAAA,CAAA;IAEjE,IAAMC,YAAY,GAAGR,KAAK,GAAGN,SAAS,GAAGA,SAAS,GAAGM,KAAK,CAAA;IAC1D,IAAMS,eAAe,GAAGR,QAAQ,IAAIA,QAAQ,GAAGP,SAAS,GAAGA,SAAS,GAAGO,QAAQ,CAAA;IAE/E,IAAMS,sBAAsB,GAAGF,YAAY,IAAI,CAAC,IAAIA,YAAY,GAAG,EAAE,CAAA;AACrE,IAAA,IAAMG,yBAAyB,GAAGF,eAAe,IAAID,YAAY,GAAGC,eAAe,CAAA;IAEnF,IAAMG,OAAO,GAAGD,yBAAyB,GAAA,EAAA,CAAAE,MAAA,CAAMJ,eAAe,SAAMD,YAAY,CAAA;IAEhF,IAAMM,UAAU,GAAG,CAACH,yBAAyB,IAAID,sBAAsB,GAAGK,sBAAO,CAACC,KAAK,GAAGC,SAAS,CAAA;AAEnG,IAAA,oBACIC,KAAA,CAAAC,aAAA,CAACvB,IAAI,EAAAwB,iCAAA,CAAA;AAACrB,MAAAA,GAAG,EAAEA,GAAI;AAACI,MAAAA,IAAI,EAAEA,IAAK;AAACD,MAAAA,IAAI,EAAEA,IAAK;AAACF,MAAAA,KAAK,EAAEA,KAAM;AAACI,MAAAA,SAAS,EAAEiB,QAAE,CAACP,UAAU,EAAEV,SAAS,CAAA;KAAOC,EAAAA,IAAI,CAC/FO,EAAAA,OACC,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMU,aAAa,GAAG;AACzBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE9B,WAAW;AACnB+B,EAAAA,IAAI,EAAJA,mBAAI;AACJC,EAAAA,UAAU,EAAE;AACRxB,IAAAA,IAAI,EAAE;AACFyB,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD3B,IAAAA,IAAI,EAAE;AACF0B,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN5B,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
+
var classes = {
|
6
|
+
round: '--plasma-counter-round'
|
7
|
+
};
|
5
8
|
var tokens = {
|
6
9
|
background: '--plasma-counter-background',
|
7
10
|
color: '--plasma-counter-color',
|
@@ -19,5 +22,6 @@ var tokens = {
|
|
19
22
|
lineHeight: '--plasma-counter-lineheight'
|
20
23
|
};
|
21
24
|
|
25
|
+
exports.classes = classes;
|
22
26
|
exports.tokens = tokens;
|
23
27
|
//# sourceMappingURL=Counter.tokens.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Counter.tokens.js","sources":["../../../src/components/Counter/Counter.tokens.ts"],"sourcesContent":["export const tokens = {\n background: '--plasma-counter-background',\n color: '--plasma-counter-color',\n\n borderRadius: '--plasma-counter-border-radius',\n height: '--plasma-counter-height',\n paddingTop: '--plasma-counter-padding-top',\n paddingRight: '--plasma-counter-padding-right',\n paddingBottom: '--plasma-counter-padding-bottom',\n paddingLeft: '--plasma-counter-padding-left',\n\n fontFamily: '--plasma-counter-font-family',\n fontSize: '--plasma-counter-font-size',\n fontStyle: '--plasma-counter-font-style',\n fontWeight: '--plasma-counter-font-weight',\n letterSpacing: '--plasma-counter-letter-spacing',\n lineHeight: '--plasma-counter-lineheight',\n};\n"],"names":["tokens","background","color","borderRadius","height","paddingTop","paddingRight","paddingBottom","paddingLeft","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight"],"mappings":";;;;AAAO,IAAMA,MAAM,GAAG;AAClBC,EAAAA,UAAU,EAAE,6BAA6B;AACzCC,EAAAA,KAAK,EAAE,wBAAwB;AAE/BC,EAAAA,YAAY,EAAE,gCAAgC;AAC9CC,EAAAA,MAAM,EAAE,yBAAyB;AACjCC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,YAAY,EAAE,gCAAgC;AAC9CC,EAAAA,aAAa,EAAE,iCAAiC;AAChDC,EAAAA,WAAW,EAAE,+BAA+B;AAE5CC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,QAAQ,EAAE,4BAA4B;AACtCC,EAAAA,SAAS,EAAE,6BAA6B;AACxCC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,aAAa,EAAE,iCAAiC;AAChDC,EAAAA,UAAU,EAAE,6BAAA;AAChB
|
1
|
+
{"version":3,"file":"Counter.tokens.js","sources":["../../../src/components/Counter/Counter.tokens.ts"],"sourcesContent":["export const classes = {\n round: '--plasma-counter-round',\n};\n\nexport const tokens = {\n background: '--plasma-counter-background',\n color: '--plasma-counter-color',\n\n borderRadius: '--plasma-counter-border-radius',\n height: '--plasma-counter-height',\n paddingTop: '--plasma-counter-padding-top',\n paddingRight: '--plasma-counter-padding-right',\n paddingBottom: '--plasma-counter-padding-bottom',\n paddingLeft: '--plasma-counter-padding-left',\n\n fontFamily: '--plasma-counter-font-family',\n fontSize: '--plasma-counter-font-size',\n fontStyle: '--plasma-counter-font-style',\n fontWeight: '--plasma-counter-font-weight',\n letterSpacing: '--plasma-counter-letter-spacing',\n lineHeight: '--plasma-counter-lineheight',\n};\n"],"names":["classes","round","tokens","background","color","borderRadius","height","paddingTop","paddingRight","paddingBottom","paddingLeft","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight"],"mappings":";;;;AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,KAAK,EAAE,wBAAA;AACX,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,UAAU,EAAE,6BAA6B;AACzCC,EAAAA,KAAK,EAAE,wBAAwB;AAE/BC,EAAAA,YAAY,EAAE,gCAAgC;AAC9CC,EAAAA,MAAM,EAAE,yBAAyB;AACjCC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,YAAY,EAAE,gCAAgC;AAC9CC,EAAAA,aAAa,EAAE,iCAAiC;AAChDC,EAAAA,WAAW,EAAE,+BAA+B;AAE5CC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,QAAQ,EAAE,4BAA4B;AACtCC,EAAAA,SAAS,EAAE,6BAA6B;AACxCC,EAAAA,UAAU,EAAE,8BAA8B;AAC1CC,EAAAA,aAAa,EAAE,iCAAiC;AAChDC,EAAAA,UAAU,EAAE,6BAAA;AAChB;;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Counter/variations/_size/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { tokens } from '../../Counter.tokens';\n\nexport const base = css`\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.letterSpacing});\n line-height: var(${tokens.lineHeight});\n\n border-radius: var(${tokens.borderRadius});\n\n height: var(${tokens.height});\n\n padding-top: var(${tokens.paddingTop});\n padding-right: var(${tokens.paddingRight});\n padding-bottom: var(${tokens.paddingBottom});\n padding-left: var(${tokens.paddingLeft});\n`;\n"],"names":["base"],"mappings":";;;;AAIO,IAAMA,IAAI,
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Counter/variations/_size/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Counter.tokens';\n\nexport const base = css`\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.letterSpacing});\n line-height: var(${tokens.lineHeight});\n\n border-radius: var(${tokens.borderRadius});\n\n height: var(${tokens.height});\n\n padding-top: var(${tokens.paddingTop});\n padding-right: var(${tokens.paddingRight});\n padding-bottom: var(${tokens.paddingBottom});\n padding-left: var(${tokens.paddingLeft});\n\n &.${classes.round} {\n width: var(${tokens.height});\n }\n`;\n"],"names":["base"],"mappings":";;;;AAIO,IAAMA,IAAI,GAoBhB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
.b1t6e429{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);}
|
1
|
+
.b1t6e429{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);}.b1t6e429.--plasma-counter-round{width:var(--plasma-counter-height);}
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
6
|
var React = require('react');
|
7
|
+
var plasmaCore = require('@salutejs/plasma-core');
|
7
8
|
var base = require('./variations/_view/base.js');
|
8
9
|
var base$1 = require('./variations/_size/base.js');
|
9
10
|
var DropdownDivider_styles = require('./DropdownDivider.styles.js');
|
10
|
-
var react = require('../../../../utils/react.js');
|
11
11
|
|
12
12
|
var _excluded = ["id", "className", "view", "size"];
|
13
13
|
/**
|
@@ -20,7 +20,7 @@ var dropdownDividerRoot = function dropdownDividerRoot(Root) {
|
|
20
20
|
view = _ref.view,
|
21
21
|
size = _ref.size,
|
22
22
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
23
|
-
var uniqId =
|
23
|
+
var uniqId = plasmaCore.useUniqId();
|
24
24
|
var innerId = id || uniqId;
|
25
25
|
return /*#__PURE__*/React.createElement(Root, {
|
26
26
|
id: innerId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownDivider.js","sources":["../../../../../src/components/Dropdown/ui/DropdownDivider/DropdownDivider.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\
|
1
|
+
{"version":3,"file":"DropdownDivider.js","sources":["../../../../../src/components/Dropdown/ui/DropdownDivider/DropdownDivider.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 { StyledDropdownDivider } from './DropdownDivider.styles';\nimport type { DropdownDividerProps } from './DropdownDivider.types';\n\n/**\n * Элемент выпадающего списка\n */\nexport const dropdownDividerRoot = (Root: RootProps<HTMLDivElement, DropdownDividerProps>) =>\n forwardRef<HTMLDivElement, DropdownDividerProps>(({ id, className, 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 <StyledDropdownDivider className={className} {...rest} />\n </Root>\n );\n });\n\nexport const dropdownDividerConfig = {\n name: 'DropdownDivider',\n tag: 'div',\n layout: dropdownDividerRoot,\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":["dropdownDividerRoot","Root","forwardRef","_ref","outerRootRef","id","className","view","size","rest","_objectWithoutProperties","_excluded","uniqId","useUniqId","innerId","React","createElement","ref","StyledDropdownDivider","_extends","dropdownDividerConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;AAUA;AACA;AACA;IACaA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACrFC,gBAAU,CAAuC,UAAAC,IAAA,EAAyCC,YAAY,EAAK;AAAA,IAAA,IAAvDC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;MAAEC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MAAEC,IAAI,GAAAL,IAAA,CAAJK,IAAI;AAAKC,MAAAA,IAAI,GAAAC,iDAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AAClF,IAAA,IAAMC,MAAM,GAAGC,oBAAS,EAAE,CAAA;AAC1B,IAAA,IAAMC,OAAO,GAAGT,EAAE,IAAIO,MAAM,CAAA;AAE5B,IAAA,oBACIG,KAAA,CAAAC,aAAA,CAACf,IAAI,EAAA;AAACI,MAAAA,EAAE,EAAES,OAAQ;AAACG,MAAAA,GAAG,EAAEb,YAAa;AAACG,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,eACzDO,KAAA,CAAAC,aAAA,CAACE,4CAAqB,EAAAC,iCAAA,CAAA;AAACb,MAAAA,SAAS,EAAEA,SAAAA;KAAeG,EAAAA,IAAI,CAAG,CACtD,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMW,qBAAqB,GAAG;AACjCC,EAAAA,IAAI,EAAE,iBAAiB;AACvBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEvB,mBAAmB;AAC3BwB,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRlB,IAAAA,IAAI,EAAE;AACFmB,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDnB,IAAAA,IAAI,EAAE;AACFkB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
6
|
var React = require('react');
|
7
|
+
var plasmaCore = require('@salutejs/plasma-core');
|
7
8
|
var base = require('./variations/_view/base.js');
|
8
9
|
var base$1 = require('./variations/_size/base.js');
|
9
10
|
var DropdownFooter_styles = require('./DropdownFooter.styles.js');
|
10
|
-
var react = require('../../../../utils/react.js');
|
11
11
|
|
12
12
|
var _excluded = ["id", "className", "children", "view", "size"];
|
13
13
|
/**
|
@@ -21,7 +21,7 @@ var dropdownFooterRoot = function dropdownFooterRoot(Root) {
|
|
21
21
|
view = _ref.view,
|
22
22
|
size = _ref.size,
|
23
23
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
24
|
-
var uniqId =
|
24
|
+
var uniqId = plasmaCore.useUniqId();
|
25
25
|
var innerId = id || uniqId;
|
26
26
|
return /*#__PURE__*/React.createElement(Root, {
|
27
27
|
id: innerId,
|
@@ -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,gBAAU,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,iDAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAC3C,IAAA,IAAMC,MAAM,GAAGC,oBAAS,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,0CAAoB,EAAAC,iCAAA,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,SAAAA;KACR;AACDnB,IAAAA,IAAI,EAAE;AACFkB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
6
|
var React = require('react');
|
7
|
+
var plasmaCore = require('@salutejs/plasma-core');
|
7
8
|
var base = require('./variations/_view/base.js');
|
8
9
|
var base$1 = require('./variations/_size/base.js');
|
9
10
|
var DropdownGroup_styles = require('./DropdownGroup.styles.js');
|
10
|
-
var react = require('../../../../utils/react.js');
|
11
11
|
|
12
12
|
var _excluded = ["id", "labelClassName", "groupClassName", "label", "children", "role", "view", "size"];
|
13
13
|
/**
|
@@ -24,7 +24,7 @@ var dropdownGroupRoot = function dropdownGroupRoot(Root) {
|
|
24
24
|
view = _ref.view,
|
25
25
|
size = _ref.size,
|
26
26
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
27
|
-
var uniqId =
|
27
|
+
var uniqId = plasmaCore.useUniqId();
|
28
28
|
var innerId = id || uniqId;
|
29
29
|
return /*#__PURE__*/React.createElement(Root, {
|
30
30
|
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,gBAAU,CACN,UAAAC,IAAA,EAAqFC,YAAY,E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AACRC,EAAAA,UAAU,EAAE;AACRpB,IAAAA,IAAI,EAAE;AACFqB,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDrB,IAAAA,IAAI,EAAE;AACFoB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
6
|
var React = require('react');
|
7
|
+
var plasmaCore = require('@salutejs/plasma-core');
|
7
8
|
var base = require('./variations/_view/base.js');
|
8
9
|
var base$1 = require('./variations/_size/base.js');
|
9
10
|
var DropdownHeader_styles = require('./DropdownHeader.styles.js');
|
10
|
-
var react = require('../../../../utils/react.js');
|
11
11
|
|
12
12
|
var _excluded = ["id", "className", "view", "size", "children"];
|
13
13
|
/**
|
@@ -21,7 +21,7 @@ var dropdownHeaderRoot = function dropdownHeaderRoot(Root) {
|
|
21
21
|
size = _ref.size,
|
22
22
|
children = _ref.children,
|
23
23
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
24
|
-
var uniqId =
|
24
|
+
var uniqId = plasmaCore.useUniqId();
|
25
25
|
var innerId = id || uniqId;
|
26
26
|
return /*#__PURE__*/React.createElement(Root, {
|
27
27
|
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,gBAAU,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,iDAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAC3C,IAAA,IAAMC,MAAM,GAAGC,oBAAS,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,0CAAoB,EAAAC,iCAAA,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,SAAAA;KACR;AACDpB,IAAAA,IAAI,EAAE;AACFmB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvB,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -9,8 +9,6 @@ var base = require('./variations/_view/base.js');
|
|
9
9
|
var base$1 = require('./variations/_size/base.js');
|
10
10
|
var Dropdown_styles = require('./Dropdown.styles.js');
|
11
11
|
var index = require('./utils/index.js');
|
12
|
-
var react = require('../../../../utils/react.js');
|
13
|
-
var useFocusTrap = require('../../../../hooks/useFocusTrap.js');
|
14
12
|
|
15
13
|
var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "opened", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
|
16
14
|
/**
|
@@ -47,12 +45,12 @@ var dropdownOldRoot = function dropdownOldRoot(Root) {
|
|
47
45
|
closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
|
48
46
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
49
47
|
var innerIsOpen = Boolean(isOpen || opened);
|
50
|
-
var uniqId =
|
48
|
+
var uniqId = plasmaCore.useUniqId();
|
51
49
|
var innerId = id || uniqId;
|
52
50
|
var rootRef = React.useRef(null);
|
53
51
|
var dropdownRef = React.useRef(null);
|
54
52
|
var handleRef = plasmaCore.useForkRef(rootRef, outerRootRef);
|
55
|
-
var trapRef =
|
53
|
+
var trapRef = plasmaCore.useFocusTrap(innerIsOpen && isFocusTrapped);
|
56
54
|
var dropdownForkRef = plasmaCore.useForkRef(dropdownRef, trapRef);
|
57
55
|
return /*#__PURE__*/React.createElement(Dropdown_styles.StyledPopover, {
|
58
56
|
role: role,
|
@@ -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,gBAAU,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,KA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AAAA,QAAyB,CACxC,CACK,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMmD,iBAAiB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,UAAU;AAChBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7D,eAAe;AACvB8D,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRrD,IAAAA,IAAI,EAAE;AACFsD,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDtD,IAAAA,IAAI,EAAE;AACFqD,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNzD,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -10,7 +10,6 @@ var index = require('../../utils/index.js');
|
|
10
10
|
var base = require('./variations/_view/base.js');
|
11
11
|
var Popover_styles = require('./Popover.styles.js');
|
12
12
|
var Popover_tokens = require('./Popover.tokens.js');
|
13
|
-
var useFocusTrap = require('../../hooks/useFocusTrap.js');
|
14
13
|
var Portal = require('../Portal/Portal.js');
|
15
14
|
|
16
15
|
var _excluded = ["target", "children", "isOpen", "opened", "trigger", "hasArrow", "frame", "className", "placement", "offset", "zIndex", "isFocusTrapped", "closeOnEsc", "preventOverflow", "usePortal", "view", "onToggle", "closeOnOverlayClick"];
|
@@ -56,7 +55,7 @@ var popoverRoot = function popoverRoot(Root) {
|
|
56
55
|
var popoverRef = React.useRef(null);
|
57
56
|
var handleRef = plasmaCore.useForkRef(rootRef, outerRootRef);
|
58
57
|
var portalRef = React.useRef(null);
|
59
|
-
var trapRef =
|
58
|
+
var trapRef = plasmaCore.useFocusTrap(innerIsOpen && isFocusTrapped);
|
60
59
|
var popoverForkRef = plasmaCore.useForkRef(popoverRef, trapRef);
|
61
60
|
var _useState = React.useState(null),
|
62
61
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
@@ -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;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CACN,UAAAC,IAAA,EAsBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IArBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MACNC,MAAM,GAAAN,IAAA,CAANM,MAAM;MAAAC,YAAA,GAAAP,IAAA,CACNQ,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MAAAC,UAAA,GAAAV,IAAA,CACRW,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;MAClBE,SAAS,GAAAZ,IAAA,CAATY,SAAS;MAAAC,cAAA,GAAAb,IAAA,CACTc,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,cAAA;MAAAE,WAAA,GAAAf,IAAA,CAClBgB,MAAM;MAANA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAAA,WAAA;MACfE,MAAM,GAAAjB,IAAA,CAANiB,MAAM;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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;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CACN,UAAAC,IAAA,EAsBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IArBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MACNC,MAAM,GAAAN,IAAA,CAANM,MAAM;MAAAC,YAAA,GAAAP,IAAA,CACNQ,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MAAAC,UAAA,GAAAV,IAAA,CACRW,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;MAClBE,SAAS,GAAAZ,IAAA,CAATY,SAAS;MAAAC,cAAA,GAAAb,IAAA,CACTc,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,cAAA;MAAAE,WAAA,GAAAf,IAAA,CAClBgB,MAAM;MAANA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAA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,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEC,SAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN1G,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;;"}
|
package/cjs/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
|
|
@@ -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',
|