@salutejs/plasma-new-hope 0.108.0-dev.0 → 0.109.0-canary.1307.10007524835.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Portal/Portal.js +1 -1
- package/cjs/components/Portal/Portal.js.map +1 -1
- package/cjs/components/Price/Price.css +2 -0
- package/cjs/components/Price/Price.js +65 -0
- package/cjs/components/Price/Price.js.map +1 -0
- package/cjs/components/Price/Price.styles.js +17 -0
- package/cjs/components/Price/Price.styles.js.map +1 -0
- package/cjs/components/Price/Price.styles_15b4mp1.css +2 -0
- package/cjs/components/Price/Price.tokens.js +10 -0
- package/cjs/components/Price/Price.tokens.js.map +1 -0
- package/cjs/components/Price/utils/formatCurrency.js +22 -0
- package/cjs/components/Price/utils/formatCurrency.js.map +1 -0
- package/cjs/components/Price/variations/_view/base.js +9 -0
- package/cjs/components/Price/variations/_view/base.js.map +1 -0
- package/cjs/components/Price/variations/_view/base_x642ct.css +1 -0
- package/cjs/index.css +3 -0
- package/cjs/index.js +5 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Portal/Portal.js +1 -1
- package/emotion/cjs/components/Portal/Portal.template-doc.mdx +1 -1
- package/emotion/cjs/components/Price/Price.js +66 -0
- package/emotion/cjs/components/Price/Price.styles.js +24 -0
- package/emotion/cjs/components/Price/Price.template-doc.mdx +24 -0
- package/emotion/cjs/components/Price/Price.tokens.js +9 -0
- package/emotion/cjs/components/Price/Price.types.js +5 -0
- package/emotion/cjs/components/Price/index.js +25 -0
- package/emotion/cjs/components/Price/utils/formatCurrency.js +21 -0
- package/emotion/cjs/components/Price/variations/_view/base.js +8 -0
- package/emotion/cjs/components/Price/variations/_view/tokens.json +1 -0
- package/emotion/cjs/examples/plasma_b2c/components/Price/Price.config.js +14 -0
- package/emotion/cjs/examples/plasma_b2c/components/Price/Price.js +17 -0
- package/emotion/cjs/examples/plasma_b2c/components/Price/Price.stories.tsx +38 -0
- package/emotion/cjs/examples/plasma_web/components/Price/Price.config.js +14 -0
- package/emotion/cjs/examples/plasma_web/components/Price/Price.js +17 -0
- package/emotion/cjs/examples/plasma_web/components/Price/Price.stories.tsx +38 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Portal/Portal.js +1 -1
- package/emotion/es/components/Portal/Portal.template-doc.mdx +1 -1
- package/emotion/es/components/Price/Price.js +58 -0
- package/emotion/es/components/Price/Price.styles.js +17 -0
- package/emotion/es/components/Price/Price.template-doc.mdx +24 -0
- package/emotion/es/components/Price/Price.tokens.js +3 -0
- package/emotion/es/components/Price/Price.types.js +1 -0
- package/emotion/es/components/Price/index.js +2 -0
- package/emotion/es/components/Price/utils/formatCurrency.js +15 -0
- package/emotion/es/components/Price/variations/_view/base.js +2 -0
- package/emotion/es/components/Price/variations/_view/tokens.json +1 -0
- package/emotion/es/examples/plasma_b2c/components/Price/Price.config.js +8 -0
- package/emotion/es/examples/plasma_b2c/components/Price/Price.js +6 -0
- package/emotion/es/examples/plasma_b2c/components/Price/Price.stories.tsx +38 -0
- package/emotion/es/examples/plasma_web/components/Price/Price.config.js +8 -0
- package/emotion/es/examples/plasma_web/components/Price/Price.js +6 -0
- package/emotion/es/examples/plasma_web/components/Price/Price.stories.tsx +38 -0
- package/emotion/es/index.js +2 -1
- package/es/components/Portal/Portal.js +1 -1
- package/es/components/Portal/Portal.js.map +1 -1
- package/es/components/Price/Price.css +2 -0
- package/es/components/Price/Price.js +60 -0
- package/es/components/Price/Price.js.map +1 -0
- package/es/components/Price/Price.styles.js +12 -0
- package/es/components/Price/Price.styles.js.map +1 -0
- package/es/components/Price/Price.styles_15b4mp1.css +2 -0
- package/es/components/Price/Price.tokens.js +6 -0
- package/es/components/Price/Price.tokens.js.map +1 -0
- package/es/components/Price/utils/formatCurrency.js +18 -0
- package/es/components/Price/utils/formatCurrency.js.map +1 -0
- package/es/components/Price/variations/_view/base.js +5 -0
- package/es/components/Price/variations/_view/base.js.map +1 -0
- package/es/components/Price/variations/_view/base_x642ct.css +1 -0
- package/es/index.css +3 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Portal/Portal.js +1 -1
- package/styled-components/cjs/components/Portal/Portal.template-doc.mdx +1 -1
- package/styled-components/cjs/components/Price/Price.js +66 -0
- package/styled-components/cjs/components/Price/Price.styles.js +15 -0
- package/styled-components/cjs/components/Price/Price.template-doc.mdx +24 -0
- package/styled-components/cjs/components/Price/Price.tokens.js +9 -0
- package/styled-components/cjs/components/Price/Price.types.js +5 -0
- package/styled-components/cjs/components/Price/index.js +25 -0
- package/styled-components/cjs/components/Price/utils/formatCurrency.js +21 -0
- package/styled-components/cjs/components/Price/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Price/variations/_view/tokens.json +1 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Price/Price.config.js +14 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Price/Price.js +17 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Price/Price.stories.tsx +38 -0
- package/styled-components/cjs/examples/plasma_web/components/Price/Price.config.js +14 -0
- package/styled-components/cjs/examples/plasma_web/components/Price/Price.js +17 -0
- package/styled-components/cjs/examples/plasma_web/components/Price/Price.stories.tsx +38 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Portal/Portal.js +1 -1
- package/styled-components/es/components/Portal/Portal.template-doc.mdx +1 -1
- package/styled-components/es/components/Price/Price.js +58 -0
- package/styled-components/es/components/Price/Price.styles.js +7 -0
- package/styled-components/es/components/Price/Price.template-doc.mdx +24 -0
- package/styled-components/es/components/Price/Price.tokens.js +3 -0
- package/styled-components/es/components/Price/Price.types.js +1 -0
- package/styled-components/es/components/Price/index.js +2 -0
- package/styled-components/es/components/Price/utils/formatCurrency.js +15 -0
- package/styled-components/es/components/Price/variations/_view/base.js +2 -0
- package/styled-components/es/components/Price/variations/_view/tokens.json +1 -0
- package/styled-components/es/examples/plasma_b2c/components/Price/Price.config.js +8 -0
- package/styled-components/es/examples/plasma_b2c/components/Price/Price.js +6 -0
- package/styled-components/es/examples/plasma_b2c/components/Price/Price.stories.tsx +38 -0
- package/styled-components/es/examples/plasma_web/components/Price/Price.config.js +8 -0
- package/styled-components/es/examples/plasma_web/components/Price/Price.js +6 -0
- package/styled-components/es/examples/plasma_web/components/Price/Price.stories.tsx +38 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Portal/Portal.d.ts +6 -2
- package/types/components/Portal/Portal.d.ts.map +1 -1
- package/types/components/Portal/index.d.ts.map +1 -1
- package/types/components/Price/Price.d.ts +22 -0
- package/types/components/Price/Price.d.ts.map +1 -0
- package/types/components/Price/Price.styles.d.ts +4 -0
- package/types/components/Price/Price.styles.d.ts.map +1 -0
- package/types/components/Price/Price.tokens.d.ts +4 -0
- package/types/components/Price/Price.tokens.d.ts.map +1 -0
- package/types/components/Price/Price.types.d.ts +41 -0
- package/types/components/Price/Price.types.d.ts.map +1 -0
- package/types/components/Price/index.d.ts +3 -0
- package/types/components/Price/index.d.ts.map +1 -0
- package/types/components/Price/utils/formatCurrency.d.ts +10 -0
- package/types/components/Price/utils/formatCurrency.d.ts.map +1 -0
- package/types/components/Price/variations/_view/base.d.ts +2 -0
- package/types/components/Price/variations/_view/base.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Price/Price.config.d.ts +9 -0
- package/types/examples/plasma_b2c/components/Price/Price.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Price/Price.d.ts +6 -0
- package/types/examples/plasma_b2c/components/Price/Price.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Price/Price.config.d.ts +9 -0
- package/types/examples/plasma_web/components/Price/Price.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Price/Price.d.ts +6 -0
- package/types/examples/plasma_web/components/Price/Price.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
var React = require('react');
|
6
6
|
var ReactDOM = require('react-dom');
|
7
7
|
|
8
|
-
|
8
|
+
/**
|
9
9
|
* Вспомогательный компонент. Используется в Popup, Popover.
|
10
10
|
* Представляет собой ReactDOM.createPortal() в форме компонента.
|
11
11
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Portal.js","sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { PortalProps } from './Portal.types';\n\n
|
1
|
+
{"version":3,"file":"Portal.js","sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { PortalProps } from './Portal.types';\n\n/**\n * Вспомогательный компонент. Используется в Popup, Popover.\n * Представляет собой ReactDOM.createPortal() в форме компонента.\n */\nexport const Portal: FC<PortalProps> = ({ children, container, disabled = false }) => {\n const portalContainer = typeof container === 'function' ? container() : container;\n\n return (\n <>\n {disabled && children}\n {!disabled && ReactDOM.createPortal(children, portalContainer)}\n </>\n );\n};\n"],"names":["Portal","_ref","children","container","_ref$disabled","disabled","portalContainer","React","createElement","Fragment","ReactDOM","createPortal"],"mappings":";;;;;;;AAKA;AACA;AACA;AACA;IACaA,MAAuB,GAAG,SAA1BA,MAAuBA,CAAAC,IAAA,EAAkD;AAAA,EAAA,IAA5CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAAC,aAAA,GAAAH,IAAA,CAAEI,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA,CAAA;EAC3E,IAAME,eAAe,GAAG,OAAOH,SAAS,KAAK,UAAU,GAAGA,SAAS,EAAE,GAAGA,SAAS,CAAA;EAEjF,oBACII,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EACKJ,IAAAA,EAAAA,QAAQ,IAAIH,QAAQ,EACpB,CAACG,QAAQ,iBAAIK,QAAQ,CAACC,YAAY,CAACT,QAAQ,EAAEI,eAAe,CAC/D,CAAC,CAAA;AAEX;;;;"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
6
|
+
var React = require('react');
|
7
|
+
var index = require('../../utils/index.js');
|
8
|
+
var formatCurrency = require('./utils/formatCurrency.js');
|
9
|
+
var Price_styles = require('./Price.styles.js');
|
10
|
+
var base = require('./variations/_view/base.js');
|
11
|
+
var Price_tokens = require('./Price.tokens.js');
|
12
|
+
|
13
|
+
var _excluded = ["children", "locale", "currency", "minimumFractionDigits", "stroked", "periodicity", "view", "className", "stroke"];
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Компонент для отображения цены / стоимости / суммы.
|
17
|
+
*/
|
18
|
+
var priceRoot = function priceRoot(Root) {
|
19
|
+
return /*#__PURE__*/React.forwardRef(function (_ref, outerRootRef) {
|
20
|
+
var children = _ref.children,
|
21
|
+
_ref$locale = _ref.locale,
|
22
|
+
locale = _ref$locale === void 0 ? 'ru' : _ref$locale,
|
23
|
+
_ref$currency = _ref.currency,
|
24
|
+
currency = _ref$currency === void 0 ? 'rub' : _ref$currency,
|
25
|
+
_ref$minimumFractionD = _ref.minimumFractionDigits,
|
26
|
+
minimumFractionDigits = _ref$minimumFractionD === void 0 ? 0 : _ref$minimumFractionD,
|
27
|
+
_ref$stroked = _ref.stroked,
|
28
|
+
stroked = _ref$stroked === void 0 ? false : _ref$stroked,
|
29
|
+
periodicity = _ref.periodicity,
|
30
|
+
view = _ref.view,
|
31
|
+
className = _ref.className,
|
32
|
+
_ref$stroke = _ref.stroke,
|
33
|
+
stroke = _ref$stroke === void 0 ? false : _ref$stroke,
|
34
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
35
|
+
var strokedClass = stroked || stroke ? Price_tokens.classes.stroked : undefined;
|
36
|
+
return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
|
37
|
+
view: view,
|
38
|
+
ref: outerRootRef,
|
39
|
+
className: index.cx(strokedClass, className)
|
40
|
+
}, rest), formatCurrency.formatCurrency({
|
41
|
+
value: children,
|
42
|
+
locale: locale,
|
43
|
+
currency: currency,
|
44
|
+
minimumFractionDigits: minimumFractionDigits
|
45
|
+
}), periodicity && /*#__PURE__*/React.createElement(Price_styles.StyledPeriodicity, null, periodicity));
|
46
|
+
});
|
47
|
+
};
|
48
|
+
var priceConfig = {
|
49
|
+
name: 'Price',
|
50
|
+
tag: 'span',
|
51
|
+
layout: priceRoot,
|
52
|
+
base: Price_styles.base,
|
53
|
+
variations: {
|
54
|
+
view: {
|
55
|
+
css: base.base
|
56
|
+
}
|
57
|
+
},
|
58
|
+
defaults: {
|
59
|
+
view: 'default'
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
exports.priceConfig = priceConfig;
|
64
|
+
exports.priceRoot = priceRoot;
|
65
|
+
//# sourceMappingURL=Price.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Price.js","sources":["../../../src/components/Price/Price.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { formatCurrency } from './utils/formatCurrency';\nimport { PriceProps } from './Price.types';\nimport { base, StyledPeriodicity } from './Price.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { classes } from './Price.tokens';\n\n/**\n * Компонент для отображения цены / стоимости / суммы.\n */\nexport const priceRoot = (Root: RootProps<HTMLSpanElement, Omit<PriceProps, 'children'>>) =>\n forwardRef<HTMLSpanElement, PriceProps>(\n (\n {\n children,\n locale = 'ru',\n currency = 'rub',\n minimumFractionDigits = 0,\n stroked = false,\n periodicity,\n view,\n className,\n stroke = false,\n ...rest\n },\n outerRootRef,\n ) => {\n const strokedClass = stroked || stroke ? classes.stroked : undefined;\n\n return (\n <Root view={view} ref={outerRootRef} className={cx(strokedClass, className)} {...rest}>\n {formatCurrency({ value: children, locale, currency, minimumFractionDigits })}\n {periodicity && <StyledPeriodicity>{periodicity}</StyledPeriodicity>}\n </Root>\n );\n },\n );\n\nexport const priceConfig = {\n name: 'Price',\n tag: 'span',\n layout: priceRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["priceRoot","Root","forwardRef","_ref","outerRootRef","children","_ref$locale","locale","_ref$currency","currency","_ref$minimumFractionD","minimumFractionDigits","_ref$stroked","stroked","periodicity","view","className","_ref$stroke","stroke","rest","_objectWithoutProperties","_excluded","strokedClass","classes","undefined","React","createElement","_extends","ref","cx","formatCurrency","value","StyledPeriodicity","priceConfig","name","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;;AAWA;AACA;AACA;IACaA,SAAS,GAAG,SAAZA,SAASA,CAAIC,IAA8D,EAAA;AAAA,EAAA,oBACpFC,gBAAU,CACN,UAAAC,IAAA,EAaIC,YAAY,EACX;AAAA,IAAA,IAZGC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;MAAAC,WAAA,GAAAH,IAAA,CACRI,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,WAAA;MAAAE,aAAA,GAAAL,IAAA,CACbM,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MAAAE,qBAAA,GAAAP,IAAA,CAChBQ,qBAAqB;AAArBA,MAAAA,qBAAqB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,qBAAA;MAAAE,YAAA,GAAAT,IAAA,CACzBU,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,YAAA;MACfE,WAAW,GAAAX,IAAA,CAAXW,WAAW;MACXC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MACJC,SAAS,GAAAb,IAAA,CAATa,SAAS;MAAAC,WAAA,GAAAd,IAAA,CACTe,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,WAAA;AACXE,MAAAA,IAAI,GAAAC,iDAAA,CAAAjB,IAAA,EAAAkB,SAAA,CAAA,CAAA;IAIX,IAAMC,YAAY,GAAGT,OAAO,IAAIK,MAAM,GAAGK,oBAAO,CAACV,OAAO,GAAGW,SAAS,CAAA;AAEpE,IAAA,oBACIC,KAAA,CAAAC,aAAA,CAACzB,IAAI,EAAA0B,iCAAA,CAAA;AAACZ,MAAAA,IAAI,EAAEA,IAAK;AAACa,MAAAA,GAAG,EAAExB,YAAa;AAACY,MAAAA,SAAS,EAAEa,QAAE,CAACP,YAAY,EAAEN,SAAS,CAAA;KAAOG,EAAAA,IAAI,CAChFW,EAAAA,6BAAc,CAAC;AAAEC,MAAAA,KAAK,EAAE1B,QAAQ;AAAEE,MAAAA,MAAM,EAANA,MAAM;AAAEE,MAAAA,QAAQ,EAARA,QAAQ;AAAEE,MAAAA,qBAAqB,EAArBA,qBAAAA;AAAsB,KAAC,CAAC,EAC5EG,WAAW,iBAAIW,KAAA,CAAAC,aAAA,CAACM,8BAAiB,EAAA,IAAA,EAAElB,WAA+B,CACjE,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMmB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,MAAM;AACXC,EAAAA,MAAM,EAAEpC,SAAS;AACjBqC,EAAAA,IAAI,EAAJA,iBAAI;AACJC,EAAAA,UAAU,EAAE;AACRvB,IAAAA,IAAI,EAAE;AACFwB,MAAAA,GAAG,EAAEC,SAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN1B,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import './Price.styles_15b4mp1.css';
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
5
|
+
|
6
|
+
var react = require('@linaria/react');
|
7
|
+
|
8
|
+
var base = "bvvzdh4";
|
9
|
+
var StyledPeriodicity = /*#__PURE__*/react.styled('span')({
|
10
|
+
name: "StyledPeriodicity",
|
11
|
+
"class": "sqvsx17",
|
12
|
+
propsAsIs: false
|
13
|
+
});
|
14
|
+
|
15
|
+
exports.StyledPeriodicity = StyledPeriodicity;
|
16
|
+
exports.base = base;
|
17
|
+
//# sourceMappingURL=Price.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Price.styles.js","sources":["../../../src/components/Price/Price.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\nimport { css } from '@linaria/core';\n\nimport { classes } from './Price.tokens';\n\nexport const base = css`\n &.${String(classes.stroked)} {\n text-decoration: line-through;\n }\n`;\n\nexport const StyledPeriodicity = styled.span`\n padding-left: 0.25rem;\n`;\n"],"names":["base","StyledPeriodicity","styled","name","class","propsAsIs"],"mappings":";;;;;;AAKO,IAAMA,IAAI,GAIhB,UAAA;AAEM,IAAMC,iBAAiB,gBAAGC,YAAM,CAAA,MAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,mBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAEtC;;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Price.tokens.js","sources":["../../../src/components/Price/Price.tokens.ts"],"sourcesContent":["export const classes = {\n stroked: 'stroked',\n};\n"],"names":["classes","stroked"],"mappings":";;;;AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,OAAO,EAAE,SAAA;AACb;;;;"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Форматирование числа в цену.
|
7
|
+
*/
|
8
|
+
var formatCurrency = function formatCurrency(_ref) {
|
9
|
+
var value = _ref.value,
|
10
|
+
locale = _ref.locale,
|
11
|
+
currency = _ref.currency,
|
12
|
+
minimumFractionDigits = _ref.minimumFractionDigits;
|
13
|
+
var formatter = new Intl.NumberFormat(locale, {
|
14
|
+
style: 'currency',
|
15
|
+
currency: currency,
|
16
|
+
minimumFractionDigits: minimumFractionDigits
|
17
|
+
});
|
18
|
+
return formatter.format(value);
|
19
|
+
};
|
20
|
+
|
21
|
+
exports.formatCurrency = formatCurrency;
|
22
|
+
//# sourceMappingURL=formatCurrency.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatCurrency.js","sources":["../../../../src/components/Price/utils/formatCurrency.ts"],"sourcesContent":["/**\n * Форматирование числа в цену.\n */\nexport const formatCurrency = ({\n value,\n locale,\n currency,\n minimumFractionDigits,\n}: {\n value: number;\n locale: string;\n currency: string;\n minimumFractionDigits: number;\n}): string => {\n const formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits,\n });\n\n return formatter.format(value);\n};\n"],"names":["formatCurrency","_ref","value","locale","currency","minimumFractionDigits","formatter","Intl","NumberFormat","style","format"],"mappings":";;;;AAAA;AACA;AACA;IACaA,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAUb;AAAA,EAAA,IATVC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,qBAAqB,GAAAJ,IAAA,CAArBI,qBAAqB,CAAA;EAOrB,IAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAACL,MAAM,EAAE;AAC5CM,IAAAA,KAAK,EAAE,UAAU;AACjBL,IAAAA,QAAQ,EAARA,QAAQ;AACRC,IAAAA,qBAAqB,EAArBA,qBAAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOC,SAAS,CAACI,MAAM,CAACR,KAAK,CAAC,CAAA;AAClC;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Price/variations/_view/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nexport const base = css``;\n"],"names":["base"],"mappings":";;;;AAEO,IAAMA,IAAI,GAAQ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
package/cjs/index.css
CHANGED
@@ -619,3 +619,6 @@
|
|
619
619
|
|
620
620
|
.RangeDatePopover_styles_wp3vfj_s1ld9lms__b4a8d387{--plasma-calendar-separator-background:var(--plasma-date-picker-calendar__separator-background);padding-top:var(--plasma-date-picker-calendar-padding-top);box-shadow:var(--plasma-date-picker-calendar-shadow);border-radius:var(--plasma-date-picker-calendar-border-radius);--plasma-calendar-background:var(--plasma-date-picker-calendar__background-color);--plasma-calendar-selected-item-background:var(--plasma-date-picker-calendar__selected-item-background);--plasma-calendar-selected-item-color:var(--plasma-date-picker-calendar__selected-item-color);--plasma-calendar-selectable-item-bg-hover:var(--plasma-date-picker-calendar__selectable-item-background-hover);--plasma-calendar-current-item-border-color:var(--plasma-date-picker-calendar__current-item-border-color);--plasma-calendar-current-item-bg-hover:var(--plasma-date-picker-calendar__current-item-background-hover);--plasma-calendar-current-item-color-hover:var(--plasma-date-picker-calendar__current-item-color-hover);--plasma-calendar-current-item-child-bg-hover:var(--plasma-date-picker-calendar__current-item-child-background-hover);--plasma-calendar-active-item-bg:var(--plasma-date-picker-calendar__active-item-background);--plasma-calendar-active-item-color:var(--plasma-date-picker-calendar__active-item-color);--plasma-calendar-hovered-item-bg:var(--plasma-date-picker-calendar__hovered-item-background);--plasma-calendar-hovered-item-color:var(--plasma-date-picker-calendar__hovered-item-color);--plasma-calendar-range-background:var(--plasma-date-picker-calendar__range-background);--plasma-calendar-outline-focus-color:var(--plasma-date-picker-calendar__outline-focus-color);--plasma-calendar-content-primary-color:var(--plasma-date-picker-calendar__content-primary-color);--plasma-calendar-content-secondary-color:var(--plasma-date-picker-calendar__content-secondary-color);--plasma-calendar-icon-button-color:var(--plasma-date-picker-icon-button__color);--plasma-calendar-icon-button-background:var(--plasma-date-picker-icon-button__background-color);--plasma-calendar-icon-button-color-hover:var(--plasma-date-picker-icon-button__color-hover);--plasma-calendar-icon-button-background-hover:var(--plasma-date-picker-icon-button__background-color-hover);--plasma-calendar-icon-button-color-active:var(--plasma-date-picker-icon-button__color-active);--plasma-calendar-icon-button-background-active:var(--plasma-date-picker-icon-button__background-color-active);--plasma-calendar-width:var(--plasma-date-picker-calendar-width);--plasma-calendar-height:var(--plasma-date-picker-calendar-height);--plasma-calendar-years-padding:var(--plasma-date-picker-calendar__years-padding);--plasma-calendar-year-item-border-radius:var(--plasma-date-picker-calendar__year-item-border-radius);--plasma-calendar-year-item-width:var(--plasma-date-picker-calendar__year-item-width);--plasma-calendar-year-item-height:var(--plasma-date-picker-calendar__year-item-height);--plasma-calendar-year-font-family:var(--plasma-date-picker-calendar__year-font-family);--plasma-calendar-year-font-size:var(--plasma-date-picker-calendar__year-font-size);--plasma-calendar-year-font-style:var(--plasma-date-picker-calendar__year-font-style);--plasma-calendar-year-font-letter-spacing:var(--plasma-date-picker-calendar__year-letter-spacing);--plasma-calendar-year-line-height:var(--plasma-date-picker-calendar__year-line-height);--plasma-calendar-year-font-weight:var(--plasma-date-picker-calendar__year-font-weight);--plasma-calendar-year-selected-font-weight:var(--plasma-date-picker-calendar__year-selected-font-weight);--plasma-calendar-months-padding:var(--plasma-date-picker-calendar__months-padding);--plasma-calendar-month-item-border-radius:var(--plasma-date-picker-calendar__month-item-border-radius);--plasma-calendar-month-item-width:var(--plasma-date-picker-calendar__month-item-width);--plasma-calendar-month-item-height:var(--plasma-date-picker-calendar__month-item-height);--plasma-calendar-month-font-family:var(--plasma-date-picker-calendar__month-font-family);--plasma-calendar-month-font-size:var(--plasma-date-picker-calendar__month-font-size);--plasma-calendar-month-font-style:var(--plasma-date-picker-calendar__month-font-style);--plasma-calendar-month-font-letter-spacing:var(--plasma-date-picker-calendar__month-letter-spacing);--plasma-calendar-month-line-height:var(--plasma-date-picker-calendar__month-line-height);--plasma-calendar-month-font-weight:var(--plasma-date-picker-calendar__month-font-weight);--plasma-calendar-month-selected-font-weight:var(--plasma-date-picker-calendar__month-selected-font-weight);--plasma-calendar-days-padding:var(--plasma-date-picker-calendar__days-padding);--plasma-calendar-day-item-border-radius:var(--plasma-date-picker-calendar__day-item-border-radius);--plasma-calendar-day-item-width:var(--plasma-date-picker-calendar__day-item-width);--plasma-calendar-day-item-height:var(--plasma-date-picker-calendar__day-item-height);--plasma-calendar-day-font-family:var(--plasma-date-picker-calendar__day-font-family);--plasma-calendar-day-font-size:var(--plasma-date-picker-calendar__day-font-size);--plasma-calendar-day-font-style:var(--plasma-date-picker-calendar__day-font-style);--plasma-calendar-day-font-letter-spacing:var(--plasma-date-picker-calendar__day-letter-spacing);--plasma-calendar-day-line-height:var(--plasma-date-picker-calendar__day-line-height);--plasma-calendar-day-font-weight:var(--plasma-date-picker-calendar__day-font-weight);--plasma-calendar-day-selected-font-weight:var(--plasma-date-picker-calendar__day-selected-font-weight);--plasma-calendar-header-wrapper-padding:var(--plasma-date-picker-calendar__header-wrapper-padding);--plasma-calendar-arrow-container-gap:var(--plasma-date-picker-calendar__header-arrow-gap);--plasma-calendar-arrow-container-padding:var(--plasma-date-picker-calendar__header-arrow-padding);--plasma-calendar-header-padding:var(--plasma-date-picker-calendar__header-padding);--plasma-calendar-header-date-gap:var(--plasma-date-picker-calendar__header-date-gap);--plasma-calendar-header-font-family:var(--plasma-date-picker-calendar__header-font-family);--plasma-calendar-header-font-size:var(--plasma-date-picker-calendar__header-font-size);--plasma-calendar-header-font-style:var(--plasma-date-picker-calendar__header-font-style);--plasma-calendar-header-font-letter-spacing:var(--plasma-date-picker-calendar__header-letter-spacing);--plasma-calendar-header-line-height:var(--plasma-date-picker-calendar__header-line-height);--plasma-calendar-header-font-weight:var(--plasma-date-picker-calendar__header-font-weight);--plasma-calendar-header-font-weight-bold:var(--plasma-date-picker-calendar__header-font-weight-bold);--plasma-calendar-icon-button-height:var(--plasma-date-picker-icon-button__height);--plasma-calendar-icon-button-width:var(--plasma-date-picker-icon-button__width);--plasma-calendar-icon-button-padding:var(--plasma-date-picker-icon-button__padding);--plasma-calendar-icon-button-radius:var(--plasma-date-picker-icon-button__radius);--plasma-calendar-icon-button-focus-color:var(--plasma-date-picker-icon-button__focus-color);--plasma-calendar-width:calc(var(--plasma-date-picker-calendar-width) * 2 + 2.063rem);}
|
621
621
|
.RangeDatePopover_styles_wp3vfj_s1rn242y__b4a8d387{padding-top:var(--plasma-date-picker-calendar-padding-top);box-shadow:var(--plasma-date-picker-calendar-shadow);border-radius:var(--plasma-date-picker-calendar-border-radius);--plasma-calendar-background:var(--plasma-date-picker-calendar__background-color);--plasma-calendar-selected-item-background:var(--plasma-date-picker-calendar__selected-item-background);--plasma-calendar-selected-item-color:var(--plasma-date-picker-calendar__selected-item-color);--plasma-calendar-selectable-item-bg-hover:var(--plasma-date-picker-calendar__selectable-item-background-hover);--plasma-calendar-current-item-border-color:var(--plasma-date-picker-calendar__current-item-border-color);--plasma-calendar-current-item-bg-hover:var(--plasma-date-picker-calendar__current-item-background-hover);--plasma-calendar-current-item-color-hover:var(--plasma-date-picker-calendar__current-item-color-hover);--plasma-calendar-current-item-child-bg-hover:var(--plasma-date-picker-calendar__current-item-child-background-hover);--plasma-calendar-active-item-bg:var(--plasma-date-picker-calendar__active-item-background);--plasma-calendar-active-item-color:var(--plasma-date-picker-calendar__active-item-color);--plasma-calendar-hovered-item-bg:var(--plasma-date-picker-calendar__hovered-item-background);--plasma-calendar-hovered-item-color:var(--plasma-date-picker-calendar__hovered-item-color);--plasma-calendar-range-background:var(--plasma-date-picker-calendar__range-background);--plasma-calendar-outline-focus-color:var(--plasma-date-picker-calendar__outline-focus-color);--plasma-calendar-content-primary-color:var(--plasma-date-picker-calendar__content-primary-color);--plasma-calendar-content-secondary-color:var(--plasma-date-picker-calendar__content-secondary-color);--plasma-calendar-icon-button-color:var(--plasma-date-picker-icon-button__color);--plasma-calendar-icon-button-background:var(--plasma-date-picker-icon-button__background-color);--plasma-calendar-icon-button-color-hover:var(--plasma-date-picker-icon-button__color-hover);--plasma-calendar-icon-button-background-hover:var(--plasma-date-picker-icon-button__background-color-hover);--plasma-calendar-icon-button-color-active:var(--plasma-date-picker-icon-button__color-active);--plasma-calendar-icon-button-background-active:var(--plasma-date-picker-icon-button__background-color-active);--plasma-calendar-width:var(--plasma-date-picker-calendar-width);--plasma-calendar-height:var(--plasma-date-picker-calendar-height);--plasma-calendar-years-padding:var(--plasma-date-picker-calendar__years-padding);--plasma-calendar-year-item-border-radius:var(--plasma-date-picker-calendar__year-item-border-radius);--plasma-calendar-year-item-width:var(--plasma-date-picker-calendar__year-item-width);--plasma-calendar-year-item-height:var(--plasma-date-picker-calendar__year-item-height);--plasma-calendar-year-font-family:var(--plasma-date-picker-calendar__year-font-family);--plasma-calendar-year-font-size:var(--plasma-date-picker-calendar__year-font-size);--plasma-calendar-year-font-style:var(--plasma-date-picker-calendar__year-font-style);--plasma-calendar-year-font-letter-spacing:var(--plasma-date-picker-calendar__year-letter-spacing);--plasma-calendar-year-line-height:var(--plasma-date-picker-calendar__year-line-height);--plasma-calendar-year-font-weight:var(--plasma-date-picker-calendar__year-font-weight);--plasma-calendar-year-selected-font-weight:var(--plasma-date-picker-calendar__year-selected-font-weight);--plasma-calendar-months-padding:var(--plasma-date-picker-calendar__months-padding);--plasma-calendar-month-item-border-radius:var(--plasma-date-picker-calendar__month-item-border-radius);--plasma-calendar-month-item-width:var(--plasma-date-picker-calendar__month-item-width);--plasma-calendar-month-item-height:var(--plasma-date-picker-calendar__month-item-height);--plasma-calendar-month-font-family:var(--plasma-date-picker-calendar__month-font-family);--plasma-calendar-month-font-size:var(--plasma-date-picker-calendar__month-font-size);--plasma-calendar-month-font-style:var(--plasma-date-picker-calendar__month-font-style);--plasma-calendar-month-font-letter-spacing:var(--plasma-date-picker-calendar__month-letter-spacing);--plasma-calendar-month-line-height:var(--plasma-date-picker-calendar__month-line-height);--plasma-calendar-month-font-weight:var(--plasma-date-picker-calendar__month-font-weight);--plasma-calendar-month-selected-font-weight:var(--plasma-date-picker-calendar__month-selected-font-weight);--plasma-calendar-days-padding:var(--plasma-date-picker-calendar__days-padding);--plasma-calendar-day-item-border-radius:var(--plasma-date-picker-calendar__day-item-border-radius);--plasma-calendar-day-item-width:var(--plasma-date-picker-calendar__day-item-width);--plasma-calendar-day-item-height:var(--plasma-date-picker-calendar__day-item-height);--plasma-calendar-day-font-family:var(--plasma-date-picker-calendar__day-font-family);--plasma-calendar-day-font-size:var(--plasma-date-picker-calendar__day-font-size);--plasma-calendar-day-font-style:var(--plasma-date-picker-calendar__day-font-style);--plasma-calendar-day-font-letter-spacing:var(--plasma-date-picker-calendar__day-letter-spacing);--plasma-calendar-day-line-height:var(--plasma-date-picker-calendar__day-line-height);--plasma-calendar-day-font-weight:var(--plasma-date-picker-calendar__day-font-weight);--plasma-calendar-day-selected-font-weight:var(--plasma-date-picker-calendar__day-selected-font-weight);--plasma-calendar-header-wrapper-padding:var(--plasma-date-picker-calendar__header-wrapper-padding);--plasma-calendar-arrow-container-gap:var(--plasma-date-picker-calendar__header-arrow-gap);--plasma-calendar-arrow-container-padding:var(--plasma-date-picker-calendar__header-arrow-padding);--plasma-calendar-header-padding:var(--plasma-date-picker-calendar__header-padding);--plasma-calendar-header-date-gap:var(--plasma-date-picker-calendar__header-date-gap);--plasma-calendar-header-font-family:var(--plasma-date-picker-calendar__header-font-family);--plasma-calendar-header-font-size:var(--plasma-date-picker-calendar__header-font-size);--plasma-calendar-header-font-style:var(--plasma-date-picker-calendar__header-font-style);--plasma-calendar-header-font-letter-spacing:var(--plasma-date-picker-calendar__header-letter-spacing);--plasma-calendar-header-line-height:var(--plasma-date-picker-calendar__header-line-height);--plasma-calendar-header-font-weight:var(--plasma-date-picker-calendar__header-font-weight);--plasma-calendar-header-font-weight-bold:var(--plasma-date-picker-calendar__header-font-weight-bold);--plasma-calendar-icon-button-height:var(--plasma-date-picker-icon-button__height);--plasma-calendar-icon-button-width:var(--plasma-date-picker-icon-button__width);--plasma-calendar-icon-button-padding:var(--plasma-date-picker-icon-button__padding);--plasma-calendar-icon-button-radius:var(--plasma-date-picker-icon-button__radius);--plasma-calendar-icon-button-focus-color:var(--plasma-date-picker-icon-button__focus-color);}
|
622
|
+
|
623
|
+
.Price_styles_15b4mp1_bvvzdh4__4d09fd16.Price_styles_15b4mp1_stroked__4d09fd16{-webkit-text-decoration:line-through;text-decoration:line-through;}
|
624
|
+
.Price_styles_15b4mp1_sqvsx17__4d09fd16{padding-left:0.25rem;}
|
package/cjs/index.js
CHANGED
@@ -186,6 +186,8 @@ var SingleDate = require('./components/DatePicker/SingleDate/SingleDate.js');
|
|
186
186
|
var RangeDate = require('./components/DatePicker/RangeDate/RangeDate.js');
|
187
187
|
var DatePicker_tokens = require('./components/DatePicker/DatePicker.tokens.js');
|
188
188
|
var Portal = require('./components/Portal/Portal.js');
|
189
|
+
var Price = require('./components/Price/Price.js');
|
190
|
+
var Price_tokens = require('./components/Price/Price.tokens.js');
|
189
191
|
var common = require('./engines/common.js');
|
190
192
|
var canUseDOM = require('./utils/canUseDOM.js');
|
191
193
|
var extractTextFrom = require('./utils/extractTextFrom.js');
|
@@ -548,6 +550,9 @@ exports.datePickerRangeRoot = RangeDate.datePickerRangeRoot;
|
|
548
550
|
exports.datePickerClasses = DatePicker_tokens.classes;
|
549
551
|
exports.datePickerTokens = DatePicker_tokens.tokens;
|
550
552
|
exports.Portal = Portal.Portal;
|
553
|
+
exports.priceConfig = Price.priceConfig;
|
554
|
+
exports.priceRoot = Price.priceRoot;
|
555
|
+
exports.priceClasses = Price_tokens.classes;
|
551
556
|
exports.component = common.component;
|
552
557
|
exports.mergeConfig = common.mergeConfig;
|
553
558
|
exports.canUseDOM = canUseDOM.canUseDOM;
|
package/cjs/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -7,7 +7,7 @@ exports.Portal = void 0;
|
|
7
7
|
var _react = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react"));
|
8
8
|
var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
|
-
|
10
|
+
/**
|
11
11
|
* Вспомогательный компонент. Используется в Popup, Popover.
|
12
12
|
* Представляет собой ReactDOM.createPortal() в форме компонента.
|
13
13
|
*/
|
@@ -0,0 +1,66 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.priceRoot = exports.priceConfig = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
10
|
+
var _formatCurrency = /*#__PURE__*/require("./utils/formatCurrency");
|
11
|
+
var _Price = /*#__PURE__*/require("./Price.styles");
|
12
|
+
var _base = /*#__PURE__*/require("./variations/_view/base");
|
13
|
+
var _Price2 = /*#__PURE__*/require("./Price.tokens");
|
14
|
+
var _excluded = ["children", "locale", "currency", "minimumFractionDigits", "stroked", "periodicity", "view", "className", "stroke"];
|
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); }
|
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; }
|
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); }
|
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; }
|
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
|
+
/**
|
21
|
+
* Компонент для отображения цены / стоимости / суммы.
|
22
|
+
*/
|
23
|
+
var priceRoot = exports.priceRoot = function priceRoot(Root) {
|
24
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
|
25
|
+
var children = _ref.children,
|
26
|
+
_ref$locale = _ref.locale,
|
27
|
+
locale = _ref$locale === void 0 ? 'ru' : _ref$locale,
|
28
|
+
_ref$currency = _ref.currency,
|
29
|
+
currency = _ref$currency === void 0 ? 'rub' : _ref$currency,
|
30
|
+
_ref$minimumFractionD = _ref.minimumFractionDigits,
|
31
|
+
minimumFractionDigits = _ref$minimumFractionD === void 0 ? 0 : _ref$minimumFractionD,
|
32
|
+
_ref$stroked = _ref.stroked,
|
33
|
+
stroked = _ref$stroked === void 0 ? false : _ref$stroked,
|
34
|
+
periodicity = _ref.periodicity,
|
35
|
+
view = _ref.view,
|
36
|
+
className = _ref.className,
|
37
|
+
_ref$stroke = _ref.stroke,
|
38
|
+
stroke = _ref$stroke === void 0 ? false : _ref$stroke,
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
40
|
+
var strokedClass = stroked || stroke ? _Price2.classes.stroked : undefined;
|
41
|
+
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
42
|
+
view: view,
|
43
|
+
ref: outerRootRef,
|
44
|
+
className: (0, _utils.cx)(strokedClass, className)
|
45
|
+
}, rest), (0, _formatCurrency.formatCurrency)({
|
46
|
+
value: children,
|
47
|
+
locale: locale,
|
48
|
+
currency: currency,
|
49
|
+
minimumFractionDigits: minimumFractionDigits
|
50
|
+
}), periodicity && /*#__PURE__*/_react["default"].createElement(_Price.StyledPeriodicity, null, periodicity));
|
51
|
+
});
|
52
|
+
};
|
53
|
+
var priceConfig = exports.priceConfig = {
|
54
|
+
name: 'Price',
|
55
|
+
tag: 'span',
|
56
|
+
layout: priceRoot,
|
57
|
+
base: _Price.base,
|
58
|
+
variations: {
|
59
|
+
view: {
|
60
|
+
css: _base.base
|
61
|
+
}
|
62
|
+
},
|
63
|
+
defaults: {
|
64
|
+
view: 'default'
|
65
|
+
}
|
66
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = exports.StyledPeriodicity = void 0;
|
7
|
+
var _base = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@emotion/styled/base"));
|
8
|
+
var _react = /*#__PURE__*/require("@emotion/react");
|
9
|
+
var _Price = /*#__PURE__*/require("./Price.tokens");
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
12
|
+
var base = exports.base = /*#__PURE__*/(0, _react.css)("&.", /*#__PURE__*/String(_Price.classes.stroked), "{text-decoration:line-through;};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUHJpY2UvUHJpY2Uuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUt1QiIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1ByaWNlL1ByaWNlLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHsgY2xhc3NlcyB9IGZyb20gJy4vUHJpY2UudG9rZW5zJztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgXG4gICAgJi4ke1N0cmluZyhjbGFzc2VzLnN0cm9rZWQpfSB7XG4gICAgICAgIHRleHQtZGVjb3JhdGlvbjogbGluZS10aHJvdWdoO1xuICAgIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQZXJpb2RpY2l0eSA9IHN0eWxlZC5zcGFuYFxuICAgIHBhZGRpbmctbGVmdDogMC4yNXJlbTtcbmA7XG4iXX0= */"));
|
13
|
+
var StyledPeriodicity = exports.StyledPeriodicity = /*#__PURE__*/(0, _base["default"])("span", {
|
14
|
+
target: "eklg8nc0",
|
15
|
+
label: "plasma-new-hope__StyledPeriodicity"
|
16
|
+
})(process.env.NODE_ENV === "production" ? {
|
17
|
+
name: "dw047z",
|
18
|
+
styles: "padding-left:0.25rem"
|
19
|
+
} : {
|
20
|
+
name: "dw047z",
|
21
|
+
styles: "padding-left:0.25rem",
|
22
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUHJpY2UvUHJpY2Uuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVc0QyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1ByaWNlL1ByaWNlLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHsgY2xhc3NlcyB9IGZyb20gJy4vUHJpY2UudG9rZW5zJztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgXG4gICAgJi4ke1N0cmluZyhjbGFzc2VzLnN0cm9rZWQpfSB7XG4gICAgICAgIHRleHQtZGVjb3JhdGlvbjogbGluZS10aHJvdWdoO1xuICAgIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQZXJpb2RpY2l0eSA9IHN0eWxlZC5zcGFuYFxuICAgIHBhZGRpbmctbGVmdDogMC4yNXJlbTtcbmA7XG4iXX0= */",
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
24
|
+
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
id: price
|
3
|
+
title: Price
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Price
|
9
|
+
<Description name="Price" />
|
10
|
+
<PropsTable name="Price" exclude={['css']} />
|
11
|
+
|
12
|
+
```tsx live
|
13
|
+
import React from 'react';
|
14
|
+
import { Price } from '@salutejs/{{ package }}';
|
15
|
+
|
16
|
+
export function App() {
|
17
|
+
return (
|
18
|
+
<div style=\{{ display: 'flex', flexDirection: 'column' }}>
|
19
|
+
<Price currency="rub" minimumFractionDigits={3}>12345.67</Price>
|
20
|
+
<Price locale="en" currency="rub" minimumFractionDigits={3} stroked>12345.67</Price>
|
21
|
+
</div>
|
22
|
+
);
|
23
|
+
}
|
24
|
+
```
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "priceClasses", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _Price2.classes;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "priceConfig", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _Price.priceConfig;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "priceRoot", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _Price.priceRoot;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
var _Price = /*#__PURE__*/require("./Price");
|
25
|
+
var _Price2 = /*#__PURE__*/require("./Price.tokens");
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.formatCurrency = void 0;
|
7
|
+
/**
|
8
|
+
* Форматирование числа в цену.
|
9
|
+
*/
|
10
|
+
var formatCurrency = exports.formatCurrency = function formatCurrency(_ref) {
|
11
|
+
var value = _ref.value,
|
12
|
+
locale = _ref.locale,
|
13
|
+
currency = _ref.currency,
|
14
|
+
minimumFractionDigits = _ref.minimumFractionDigits;
|
15
|
+
var formatter = new Intl.NumberFormat(locale, {
|
16
|
+
style: 'currency',
|
17
|
+
currency: currency,
|
18
|
+
minimumFractionDigits: minimumFractionDigits
|
19
|
+
});
|
20
|
+
return formatter.format(value);
|
21
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _react = /*#__PURE__*/require("@emotion/react");
|
8
|
+
var base = exports.base = /*#__PURE__*/(0, _react.css)(";label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUHJpY2UvdmFyaWF0aW9ucy9fdmlldy9iYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUV1QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1ByaWNlL3ZhcmlhdGlvbnMvX3ZpZXcvYmFzZS50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgYDtcbiJdfQ== */"));
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Price = void 0;
|
7
|
+
Object.defineProperty(exports, "priceClasses", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function get() {
|
10
|
+
return _Price.priceClasses;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
var _Price = /*#__PURE__*/require("../../../../components/Price");
|
14
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
15
|
+
var _Price2 = /*#__PURE__*/require("./Price.config");
|
16
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Price.priceConfig, _Price2.config);
|
17
|
+
var Price = exports.Price = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import { disableProps } from '@salutejs/plasma-sb-utils';
|
4
|
+
|
5
|
+
import { WithTheme } from '../../../_helpers';
|
6
|
+
|
7
|
+
import { Price } from './Price';
|
8
|
+
|
9
|
+
const currencies = ['rub', 'usd', 'eur'];
|
10
|
+
|
11
|
+
const meta: Meta<typeof Price> = {
|
12
|
+
title: 'plasma_b2c/Price',
|
13
|
+
decorators: [WithTheme],
|
14
|
+
argTypes: {
|
15
|
+
currency: {
|
16
|
+
options: currencies,
|
17
|
+
control: {
|
18
|
+
type: 'inline-radio',
|
19
|
+
},
|
20
|
+
},
|
21
|
+
...disableProps(['value', 'theme', 'as', 'forwardedAs']),
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
export default meta;
|
26
|
+
|
27
|
+
type StoryPriceProps = ComponentProps<typeof Price> & { priceLabel: number };
|
28
|
+
|
29
|
+
export const Default: StoryObj<StoryPriceProps> = {
|
30
|
+
args: {
|
31
|
+
locale: 'ru',
|
32
|
+
currency: 'rub',
|
33
|
+
stroked: false,
|
34
|
+
minimumFractionDigits: 0,
|
35
|
+
priceLabel: 12345.67,
|
36
|
+
},
|
37
|
+
render: ({ priceLabel, ...rest }) => <Price {...rest}>{priceLabel}</Price>,
|
38
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Price = void 0;
|
7
|
+
Object.defineProperty(exports, "priceClasses", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function get() {
|
10
|
+
return _Price.priceClasses;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
var _Price = /*#__PURE__*/require("../../../../components/Price");
|
14
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
15
|
+
var _Price2 = /*#__PURE__*/require("./Price.config");
|
16
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Price.priceConfig, _Price2.config);
|
17
|
+
var Price = exports.Price = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import { disableProps } from '@salutejs/plasma-sb-utils';
|
4
|
+
|
5
|
+
import { WithTheme } from '../../../_helpers';
|
6
|
+
|
7
|
+
import { Price } from './Price';
|
8
|
+
|
9
|
+
const currencies = ['rub', 'usd', 'eur'];
|
10
|
+
|
11
|
+
const meta: Meta<typeof Price> = {
|
12
|
+
title: 'plasma_web/Price',
|
13
|
+
decorators: [WithTheme],
|
14
|
+
argTypes: {
|
15
|
+
currency: {
|
16
|
+
options: currencies,
|
17
|
+
control: {
|
18
|
+
type: 'inline-radio',
|
19
|
+
},
|
20
|
+
},
|
21
|
+
...disableProps(['value', 'theme', 'as', 'forwardedAs']),
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
export default meta;
|
26
|
+
|
27
|
+
type StoryPriceProps = ComponentProps<typeof Price> & { priceLabel: number };
|
28
|
+
|
29
|
+
export const Default: StoryObj<StoryPriceProps> = {
|
30
|
+
args: {
|
31
|
+
locale: 'ru',
|
32
|
+
currency: 'rub',
|
33
|
+
stroked: false,
|
34
|
+
minimumFractionDigits: 0,
|
35
|
+
priceLabel: 12345.67,
|
36
|
+
},
|
37
|
+
render: ({ priceLabel, ...rest }) => <Price {...rest}>{priceLabel}</Price>,
|
38
|
+
};
|