@cloud-ru/uikit-product-price-summary 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/cjs/components/ContentBlock/ContentBlock.d.ts +7 -0
- package/dist/cjs/components/ContentBlock/ContentBlock.js +23 -0
- package/dist/cjs/components/ContentBlock/index.d.ts +1 -0
- package/dist/cjs/components/ContentBlock/index.js +17 -0
- package/dist/cjs/components/ContentBlock/styles.module.css +12 -0
- package/dist/cjs/components/PriceSummary/PriceSummary.d.ts +17 -0
- package/dist/cjs/components/PriceSummary/PriceSummary.js +33 -0
- package/dist/cjs/components/PriceSummary/components/DiscountBlock/DiscountBlock.d.ts +6 -0
- package/dist/cjs/components/PriceSummary/components/DiscountBlock/DiscountBlock.js +17 -0
- package/dist/cjs/components/PriceSummary/components/DiscountBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/DiscountBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/DiscountBlock/styles.module.css +16 -0
- package/dist/cjs/components/PriceSummary/components/DiscountPercentCell/DiscountPercentCell.d.ts +6 -0
- package/dist/cjs/components/PriceSummary/components/DiscountPercentCell/DiscountPercentCell.js +16 -0
- package/dist/cjs/components/PriceSummary/components/DiscountPercentCell/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/DiscountPercentCell/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/DiscountPercentCell/styles.module.css +5 -0
- package/dist/cjs/components/PriceSummary/components/Divider/Divider.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/Divider/Divider.js +11 -0
- package/dist/cjs/components/PriceSummary/components/Divider/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/Divider/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/Divider/styles.module.css +6 -0
- package/dist/cjs/components/PriceSummary/components/HeaderBlock/HeaderBlock.d.ts +6 -0
- package/dist/cjs/components/PriceSummary/components/HeaderBlock/HeaderBlock.js +16 -0
- package/dist/cjs/components/PriceSummary/components/HeaderBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/HeaderBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/HeaderBlock/styles.module.css +14 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceBlock/InvoiceBlock.d.ts +7 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceBlock/InvoiceBlock.js +18 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceBlock/styles.module.css +18 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceDetailsBlock/InvoiceDetailsBlock.d.ts +6 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceDetailsBlock/InvoiceDetailsBlock.js +17 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceDetailsBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceDetailsBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceDetailsBlock/styles.module.css +16 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemBlock/InvoiceItemBlock.d.ts +7 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemBlock/InvoiceItemBlock.js +24 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemBlock/styles.module.css +33 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/InvoiceItemLabelCell.d.ts +6 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/InvoiceItemLabelCell.js +16 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/styles.module.css +14 -0
- package/dist/cjs/components/PriceSummary/components/PeriodDropdown/PeriodDropdown.d.ts +8 -0
- package/dist/cjs/components/PriceSummary/components/PeriodDropdown/PeriodDropdown.js +23 -0
- package/dist/cjs/components/PriceSummary/components/PeriodDropdown/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/PeriodDropdown/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/PeriodDropdown/styles.module.css +15 -0
- package/dist/cjs/components/PriceSummary/components/TotalValueBlock/TotalValueBlock.d.ts +24 -0
- package/dist/cjs/components/PriceSummary/components/TotalValueBlock/TotalValueBlock.js +46 -0
- package/dist/cjs/components/PriceSummary/components/TotalValueBlock/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/components/TotalValueBlock/index.js +17 -0
- package/dist/cjs/components/PriceSummary/components/TotalValueBlock/styles.module.css +51 -0
- package/dist/cjs/components/PriceSummary/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummary/index.js +17 -0
- package/dist/cjs/components/PriceSummary/styles.module.css +12 -0
- package/dist/cjs/components/PriceSummarySmall/PriceSummarySmall.d.ts +12 -0
- package/dist/cjs/components/PriceSummarySmall/PriceSummarySmall.js +32 -0
- package/dist/cjs/components/PriceSummarySmall/index.d.ts +1 -0
- package/dist/cjs/components/PriceSummarySmall/index.js +17 -0
- package/dist/cjs/components/PriceSummarySmall/styles.module.css +23 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/helpers/formatters.d.ts +2 -0
- package/dist/cjs/helpers/formatters.js +14 -0
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/index.js +17 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +18 -0
- package/dist/cjs/hooks/usePeriodFormat.d.ts +2 -0
- package/dist/cjs/hooks/usePeriodFormat.js +24 -0
- package/dist/cjs/hooks/usePriceTotalValueFormatter.d.ts +2 -0
- package/dist/cjs/hooks/usePriceTotalValueFormatter.js +10 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/types/index.d.ts +41 -0
- package/dist/cjs/types/index.js +11 -0
- package/dist/esm/components/ContentBlock/ContentBlock.d.ts +7 -0
- package/dist/esm/components/ContentBlock/ContentBlock.js +17 -0
- package/dist/esm/components/ContentBlock/index.d.ts +1 -0
- package/dist/esm/components/ContentBlock/index.js +1 -0
- package/dist/esm/components/ContentBlock/styles.module.css +12 -0
- package/dist/esm/components/PriceSummary/PriceSummary.d.ts +17 -0
- package/dist/esm/components/PriceSummary/PriceSummary.js +27 -0
- package/dist/esm/components/PriceSummary/components/DiscountBlock/DiscountBlock.d.ts +6 -0
- package/dist/esm/components/PriceSummary/components/DiscountBlock/DiscountBlock.js +11 -0
- package/dist/esm/components/PriceSummary/components/DiscountBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/DiscountBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/DiscountBlock/styles.module.css +16 -0
- package/dist/esm/components/PriceSummary/components/DiscountPercentCell/DiscountPercentCell.d.ts +6 -0
- package/dist/esm/components/PriceSummary/components/DiscountPercentCell/DiscountPercentCell.js +10 -0
- package/dist/esm/components/PriceSummary/components/DiscountPercentCell/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/DiscountPercentCell/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/DiscountPercentCell/styles.module.css +5 -0
- package/dist/esm/components/PriceSummary/components/Divider/Divider.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/Divider/Divider.js +5 -0
- package/dist/esm/components/PriceSummary/components/Divider/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/Divider/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/Divider/styles.module.css +6 -0
- package/dist/esm/components/PriceSummary/components/HeaderBlock/HeaderBlock.d.ts +6 -0
- package/dist/esm/components/PriceSummary/components/HeaderBlock/HeaderBlock.js +10 -0
- package/dist/esm/components/PriceSummary/components/HeaderBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/HeaderBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/HeaderBlock/styles.module.css +14 -0
- package/dist/esm/components/PriceSummary/components/InvoiceBlock/InvoiceBlock.d.ts +7 -0
- package/dist/esm/components/PriceSummary/components/InvoiceBlock/InvoiceBlock.js +12 -0
- package/dist/esm/components/PriceSummary/components/InvoiceBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceBlock/styles.module.css +18 -0
- package/dist/esm/components/PriceSummary/components/InvoiceDetailsBlock/InvoiceDetailsBlock.d.ts +6 -0
- package/dist/esm/components/PriceSummary/components/InvoiceDetailsBlock/InvoiceDetailsBlock.js +11 -0
- package/dist/esm/components/PriceSummary/components/InvoiceDetailsBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceDetailsBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceDetailsBlock/styles.module.css +16 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemBlock/InvoiceItemBlock.d.ts +7 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemBlock/InvoiceItemBlock.js +18 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemBlock/styles.module.css +33 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemLabelCell/InvoiceItemLabelCell.d.ts +6 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemLabelCell/InvoiceItemLabelCell.js +10 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemLabelCell/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemLabelCell/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/InvoiceItemLabelCell/styles.module.css +14 -0
- package/dist/esm/components/PriceSummary/components/PeriodDropdown/PeriodDropdown.d.ts +8 -0
- package/dist/esm/components/PriceSummary/components/PeriodDropdown/PeriodDropdown.js +17 -0
- package/dist/esm/components/PriceSummary/components/PeriodDropdown/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/PeriodDropdown/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/PeriodDropdown/styles.module.css +15 -0
- package/dist/esm/components/PriceSummary/components/TotalValueBlock/TotalValueBlock.d.ts +24 -0
- package/dist/esm/components/PriceSummary/components/TotalValueBlock/TotalValueBlock.js +39 -0
- package/dist/esm/components/PriceSummary/components/TotalValueBlock/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/components/TotalValueBlock/index.js +1 -0
- package/dist/esm/components/PriceSummary/components/TotalValueBlock/styles.module.css +51 -0
- package/dist/esm/components/PriceSummary/index.d.ts +1 -0
- package/dist/esm/components/PriceSummary/index.js +1 -0
- package/dist/esm/components/PriceSummary/styles.module.css +12 -0
- package/dist/esm/components/PriceSummarySmall/PriceSummarySmall.d.ts +12 -0
- package/dist/esm/components/PriceSummarySmall/PriceSummarySmall.js +26 -0
- package/dist/esm/components/PriceSummarySmall/index.d.ts +1 -0
- package/dist/esm/components/PriceSummarySmall/index.js +1 -0
- package/dist/esm/components/PriceSummarySmall/styles.module.css +23 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/helpers/formatters.d.ts +2 -0
- package/dist/esm/helpers/formatters.js +10 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/usePeriodFormat.d.ts +2 -0
- package/dist/esm/hooks/usePeriodFormat.js +21 -0
- package/dist/esm/hooks/usePriceTotalValueFormatter.d.ts +2 -0
- package/dist/esm/hooks/usePriceTotalValueFormatter.js +7 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/types/index.d.ts +41 -0
- package/dist/esm/types/index.js +8 -0
- package/package.json +7 -6
package/dist/cjs/components/PriceSummary/components/InvoiceItemLabelCell/InvoiceItemLabelCell.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InvoiceItemLabelCell = InvoiceItemLabelCell;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const uikit_product_mobile_tooltip_1 = require("@sbercloud/uikit-product-mobile-tooltip");
|
|
9
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
10
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
11
|
+
const helpers_1 = require("../../../../helpers");
|
|
12
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
|
+
function InvoiceItemLabelCell({ item, layoutType }) {
|
|
14
|
+
return ('label' in item &&
|
|
15
|
+
item.label !== undefined && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.labelCell, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.label, children: item.labelMaxLines ? (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { text: item.label, maxLines: item.labelMaxLines }) : item.label }), item.labelTooltip && ((0, jsx_runtime_1.jsx)(uikit_product_mobile_tooltip_1.AdaptiveQuestionTooltip, { layoutType: layoutType, tip: item.labelTooltip, trigger: layoutType === 'mobile' ? 'click' : 'hover' }))] }), item.quantity && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.quantity, children: (0, helpers_1.formatQuantity)(item.quantity) }))] })));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './InvoiceItemLabelCell';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./InvoiceItemLabelCell"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WithLayoutType } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { PricePeriod } from '../../../../types';
|
|
3
|
+
export type PeriodDropdownProps = WithLayoutType<{
|
|
4
|
+
period: PricePeriod;
|
|
5
|
+
periodOptions: PricePeriod[];
|
|
6
|
+
onPeriodChanged?: (period: PricePeriod) => void;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function PeriodDropdown({ period, onPeriodChanged, periodOptions, layoutType }: PeriodDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PeriodDropdown = PeriodDropdown;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const uikit_product_button_predefined_1 = require("@sbercloud/uikit-product-button-predefined");
|
|
9
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
10
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
11
|
+
const hooks_1 = require("../../../../hooks");
|
|
12
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
|
+
function PeriodDropdown({ period, onPeriodChanged = () => { }, periodOptions, layoutType }) {
|
|
14
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('PriceSummary');
|
|
15
|
+
const formatPeriod = (0, hooks_1.usePeriodFormat)();
|
|
16
|
+
const actions = periodOptions
|
|
17
|
+
.filter(item => item !== period)
|
|
18
|
+
.map(item => ({
|
|
19
|
+
content: { option: formatPeriod(item) },
|
|
20
|
+
onClick: () => onPeriodChanged(item),
|
|
21
|
+
}));
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.period, "data-single": actions.length === 0 ? true : undefined, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { children: t('total') }), actions.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.single, children: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { children: formatPeriod(period) }) })), actions.length > 0 && ((0, jsx_runtime_1.jsx)(uikit_product_button_predefined_1.ButtonDropdown, { size: 's', label: formatPeriod(period), items: actions, closeDroplistOnItemClick: true, layoutType: layoutType }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PeriodDropdown';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PeriodDropdown"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.period{
|
|
2
|
+
display:flex;
|
|
3
|
+
align-items:center;
|
|
4
|
+
gap:var(--dimension-1m, 8px);
|
|
5
|
+
}
|
|
6
|
+
.period[data-single]{
|
|
7
|
+
gap:var(--dimension-050m, 4px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.single{
|
|
11
|
+
min-height:var(--size-button-s, 32px);
|
|
12
|
+
display:flex;
|
|
13
|
+
align-items:center;
|
|
14
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
3
|
+
import { TotalSumType } from '../../../../types';
|
|
4
|
+
export declare const APPEARANCE_STATE: {
|
|
5
|
+
readonly Default: "default";
|
|
6
|
+
readonly UserError: "userError";
|
|
7
|
+
readonly SystemError: "systemError";
|
|
8
|
+
readonly Warning: "warning";
|
|
9
|
+
};
|
|
10
|
+
export type AppearanceState = ValueOf<typeof APPEARANCE_STATE>;
|
|
11
|
+
export type TotalValueBlockProps = {
|
|
12
|
+
value?: number;
|
|
13
|
+
totalSumType?: TotalSumType;
|
|
14
|
+
hint?: string;
|
|
15
|
+
hintAppearance?: AppearanceState;
|
|
16
|
+
showHintTooltip?: boolean;
|
|
17
|
+
hintTooltipText?: ReactNode;
|
|
18
|
+
hintLink?: {
|
|
19
|
+
href?: string;
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
showHintLink?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function TotalValueBlock({ value, totalSumType, hint, hintAppearance, showHintTooltip, hintTooltipText, hintLink, showHintLink, }: TotalValueBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.APPEARANCE_STATE = void 0;
|
|
7
|
+
exports.TotalValueBlock = TotalValueBlock;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const uikit_product_icons_1 = require("@sbercloud/uikit-product-icons");
|
|
10
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
11
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
12
|
+
const link_1 = require("@snack-uikit/link");
|
|
13
|
+
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
14
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
15
|
+
const helpers_1 = require("../../../../helpers");
|
|
16
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
17
|
+
exports.APPEARANCE_STATE = {
|
|
18
|
+
Default: 'default',
|
|
19
|
+
UserError: 'userError',
|
|
20
|
+
SystemError: 'systemError',
|
|
21
|
+
Warning: 'warning',
|
|
22
|
+
};
|
|
23
|
+
function getAppearanceIcon(appearance) {
|
|
24
|
+
let Component;
|
|
25
|
+
switch (appearance) {
|
|
26
|
+
case exports.APPEARANCE_STATE.Warning:
|
|
27
|
+
Component = icons_1.AlarmFilledSVG;
|
|
28
|
+
break;
|
|
29
|
+
case exports.APPEARANCE_STATE.UserError:
|
|
30
|
+
Component = icons_1.CrossFilledSVG;
|
|
31
|
+
break;
|
|
32
|
+
case exports.APPEARANCE_STATE.SystemError:
|
|
33
|
+
Component = icons_1.QuestionSVG;
|
|
34
|
+
break;
|
|
35
|
+
case exports.APPEARANCE_STATE.Default:
|
|
36
|
+
default:
|
|
37
|
+
Component = uikit_product_icons_1.InfoFilledSVG;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(Component, { size: 16, "data-appearance": appearance, className: styles_module_scss_1.default.hintIcon });
|
|
41
|
+
}
|
|
42
|
+
function TotalValueBlock({ value, totalSumType = 'equal', hint, hintAppearance = exports.APPEARANCE_STATE.Default, showHintTooltip, hintTooltipText, hintLink, showHintLink, }) {
|
|
43
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('PriceSummary');
|
|
44
|
+
const totalSumPrefix = totalSumType === 'from' ? `${t('totalSumFromPrefix')} ` : '';
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, "data-appearance": hintAppearance, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.LightHeadlineS, { children: value !== undefined ? `${totalSumPrefix}${(0, helpers_1.formatCurrency)(Number(value))}` : 'N/A' }), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { open: showHintTooltip && hintTooltipText ? undefined : false, tip: hintTooltipText, placement: 'left-start', children: hint && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.hint, "data-appearance": hintAppearance, children: [getAppearanceIcon(hintAppearance), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { children: hint })] })) }), showHintLink && ((0, jsx_runtime_1.jsx)(link_1.Link, { textMode: 'accent', appearance: 'neutral', size: 's', href: hintLink === null || hintLink === void 0 ? void 0 : hintLink.href, text: hintLink === null || hintLink === void 0 ? void 0 : hintLink.text, className: styles_module_scss_1.default.link }))] }));
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TotalValueBlock';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TotalValueBlock"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.content{
|
|
2
|
+
display:flex;
|
|
3
|
+
flex-direction:column;
|
|
4
|
+
text-align:start;
|
|
5
|
+
}
|
|
6
|
+
.content[data-appearance=userError]{
|
|
7
|
+
color:var(--sys-red-text-main, #7a2d2d);
|
|
8
|
+
}
|
|
9
|
+
.content[data-appearance=warning]{
|
|
10
|
+
color:var(--sys-yellow-text-main, #815f19);
|
|
11
|
+
}
|
|
12
|
+
.content[data-appearance=systemError]{
|
|
13
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.hint{
|
|
17
|
+
display:flex;
|
|
18
|
+
align-items:center;
|
|
19
|
+
gap:var(--dimension-025m, 2px);
|
|
20
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
21
|
+
}
|
|
22
|
+
.hint[data-appearance=userError]{
|
|
23
|
+
color:var(--sys-red-text-main, #7a2d2d);
|
|
24
|
+
}
|
|
25
|
+
.hint[data-appearance=warning]{
|
|
26
|
+
color:var(--sys-yellow-text-main, #815f19);
|
|
27
|
+
}
|
|
28
|
+
.hint[data-appearance=systemError]{
|
|
29
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.hintIcon{
|
|
33
|
+
flex-shrink:0;
|
|
34
|
+
box-sizing:content-box;
|
|
35
|
+
}
|
|
36
|
+
.hintIcon[data-appearance=default]{
|
|
37
|
+
color:var(--sys-neutral-accent-default, #787b8a);
|
|
38
|
+
}
|
|
39
|
+
.hintIcon[data-appearance=userError]{
|
|
40
|
+
color:var(--sys-red-accent-default, #cb3f3e);
|
|
41
|
+
}
|
|
42
|
+
.hintIcon[data-appearance=warning]{
|
|
43
|
+
color:var(--sys-yellow-accent-default, #e2b134);
|
|
44
|
+
}
|
|
45
|
+
.hintIcon[data-appearance=systemError]{
|
|
46
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.link{
|
|
50
|
+
margin-left:18px;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PriceSummary';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PriceSummary"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.priceSummary{
|
|
2
|
+
box-sizing:border-box;
|
|
3
|
+
width:100%;
|
|
4
|
+
min-width:280px;
|
|
5
|
+
display:flex;
|
|
6
|
+
flex-direction:column;
|
|
7
|
+
gap:var(--dimension-050m, 4px);
|
|
8
|
+
padding:var(--dimension-2m, 16px);
|
|
9
|
+
border-radius:var(--dimension-1m, 8px);
|
|
10
|
+
background-color:var(--sys-neutral-background1-level, #fdfdfd);
|
|
11
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WithSupportProps } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { LinkProps } from '@snack-uikit/link';
|
|
3
|
+
import { ContentBlockProps } from '../ContentBlock';
|
|
4
|
+
export type PriceSummarySmallProps = WithSupportProps<ContentBlockProps & {
|
|
5
|
+
value: number | undefined;
|
|
6
|
+
docsLink?: {
|
|
7
|
+
href?: LinkProps['href'];
|
|
8
|
+
text?: LinkProps['text'];
|
|
9
|
+
};
|
|
10
|
+
className?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function PriceSummarySmall({ value, docsLink, loading, dataError, onRetry, className, ...rest }: PriceSummarySmallProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PriceSummarySmall = PriceSummarySmall;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const uikit_product_icons_1 = require("@sbercloud/uikit-product-icons");
|
|
21
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
22
|
+
const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
|
|
23
|
+
const button_1 = require("@snack-uikit/button");
|
|
24
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
25
|
+
const helpers_1 = require("../../helpers");
|
|
26
|
+
const ContentBlock_1 = require("../ContentBlock");
|
|
27
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
28
|
+
function PriceSummarySmall(_a) {
|
|
29
|
+
var { value = 0, docsLink, loading, dataError, onRetry, className } = _a, rest = __rest(_a, ["value", "docsLink", "loading", "dataError", "onRetry", "className"]);
|
|
30
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('PriceSummary');
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.priceSummarySmall, className) }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { children: t('total') }), (0, jsx_runtime_1.jsxs)(ContentBlock_1.ContentBlock, { loading: loading, dataError: dataError, onRetry: onRetry, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.value, children: [(0, jsx_runtime_1.jsx)(uikit_product_icons_1.InfoFilledSVG, { size: 16, className: styles_module_scss_1.default.icon }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: (0, helpers_1.formatCurrency)(value) })] }), (docsLink === null || docsLink === void 0 ? void 0 : docsLink.href) && ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { size: 'xs', label: docsLink.text || t('costLink'), href: docsLink.href, target: '_blank' }))] })] })));
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PriceSummarySmall';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PriceSummarySmall"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.priceSummarySmall{
|
|
2
|
+
box-sizing:border-box;
|
|
3
|
+
width:100%;
|
|
4
|
+
min-width:170px;
|
|
5
|
+
display:flex;
|
|
6
|
+
flex-direction:column;
|
|
7
|
+
gap:var(--dimension-050m, 4px);
|
|
8
|
+
padding:var(--dimension-2m, 16px);
|
|
9
|
+
border-radius:var(--dimension-1m, 8px);
|
|
10
|
+
background-color:var(--sys-neutral-background1-level, #fdfdfd);
|
|
11
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.value{
|
|
15
|
+
display:flex;
|
|
16
|
+
align-items:center;
|
|
17
|
+
gap:var(--dimension-050m, 4px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.icon{
|
|
21
|
+
flex-shrink:0;
|
|
22
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PriceSummary"), exports);
|
|
18
|
+
__exportStar(require("./PriceSummarySmall"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatCurrency = formatCurrency;
|
|
4
|
+
exports.formatQuantity = formatQuantity;
|
|
5
|
+
const ft_formatters_1 = require("@cloud-ru/ft-formatters");
|
|
6
|
+
function formatCurrency(value) {
|
|
7
|
+
return (0, ft_formatters_1.formatNumber)(value.toFixed(2), {
|
|
8
|
+
precision: 2,
|
|
9
|
+
type: ft_formatters_1.formatNumber.types.Currency,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function formatQuantity(value) {
|
|
13
|
+
return typeof value === 'string' ? value : '×' + value;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './formatters';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./formatters"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./usePeriodFormat"), exports);
|
|
18
|
+
__exportStar(require("./usePriceTotalValueFormatter"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePeriodFormat = usePeriodFormat;
|
|
4
|
+
const uikit_product_locale_1 = require("@sbercloud/uikit-product-locale");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
function usePeriodFormat() {
|
|
7
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('PriceSummary');
|
|
8
|
+
return function formatPeriod(period) {
|
|
9
|
+
switch (period) {
|
|
10
|
+
case types_1.PricePeriod.Year:
|
|
11
|
+
return t('pricePeriodYear');
|
|
12
|
+
case types_1.PricePeriod.Month:
|
|
13
|
+
return t('pricePeriodMonth');
|
|
14
|
+
case types_1.PricePeriod.Day:
|
|
15
|
+
return t('pricePeriodDay');
|
|
16
|
+
case types_1.PricePeriod.Hour:
|
|
17
|
+
return t('pricePeriodHour');
|
|
18
|
+
case types_1.PricePeriod.Minute:
|
|
19
|
+
return t('pricePeriodMinute');
|
|
20
|
+
default:
|
|
21
|
+
throw new Error('not reachable');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePriceTotalValueFormatter = usePriceTotalValueFormatter;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
const usePeriodFormat_1 = require("./usePeriodFormat");
|
|
7
|
+
function usePriceTotalValueFormatter() {
|
|
8
|
+
const formatPeriod = (0, usePeriodFormat_1.usePeriodFormat)();
|
|
9
|
+
return (0, react_1.useCallback)((value, period) => `${(0, helpers_1.formatCurrency)(value || 0)} ${formatPeriod(period)}`, [formatPeriod]);
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
18
|
+
__exportStar(require("./hooks/usePriceTotalValueFormatter"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { QuestionTooltipProps } from '@sbercloud/uikit-product-mobile-tooltip';
|
|
2
|
+
export declare enum PricePeriod {
|
|
3
|
+
Year = "year",
|
|
4
|
+
Month = "month",
|
|
5
|
+
Day = "day",
|
|
6
|
+
Hour = "hour",
|
|
7
|
+
Minute = "minute"
|
|
8
|
+
}
|
|
9
|
+
export type TotalSumType = 'equal' | 'from';
|
|
10
|
+
export type DiscountItem = {
|
|
11
|
+
value: number;
|
|
12
|
+
percent?: number;
|
|
13
|
+
tooltip?: QuestionTooltipProps['tip'];
|
|
14
|
+
};
|
|
15
|
+
export type DiscountDetails = {
|
|
16
|
+
price: number;
|
|
17
|
+
discounts: DiscountItem[];
|
|
18
|
+
};
|
|
19
|
+
export type PriceInvoiceItem = {
|
|
20
|
+
label: string;
|
|
21
|
+
discount?: DiscountItem;
|
|
22
|
+
};
|
|
23
|
+
export type DiscountInvoiceItem = {
|
|
24
|
+
discount: DiscountItem;
|
|
25
|
+
};
|
|
26
|
+
export type InvoiceItem = (PriceInvoiceItem | DiscountInvoiceItem) & {
|
|
27
|
+
labelTooltip?: QuestionTooltipProps['tip'];
|
|
28
|
+
price?: number;
|
|
29
|
+
hidePrice?: boolean;
|
|
30
|
+
labelMaxLines?: number;
|
|
31
|
+
quantity?: string | number;
|
|
32
|
+
primary?: boolean;
|
|
33
|
+
topDivider?: boolean;
|
|
34
|
+
bottomDivider?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type InvoiceDetails = {
|
|
37
|
+
title?: string;
|
|
38
|
+
quantity?: string | number;
|
|
39
|
+
price?: number;
|
|
40
|
+
items: InvoiceItem[];
|
|
41
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricePeriod = void 0;
|
|
4
|
+
var PricePeriod;
|
|
5
|
+
(function (PricePeriod) {
|
|
6
|
+
PricePeriod["Year"] = "year";
|
|
7
|
+
PricePeriod["Month"] = "month";
|
|
8
|
+
PricePeriod["Day"] = "day";
|
|
9
|
+
PricePeriod["Hour"] = "hour";
|
|
10
|
+
PricePeriod["Minute"] = "minute";
|
|
11
|
+
})(PricePeriod || (exports.PricePeriod = PricePeriod = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export type ContentBlockProps = {
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
dataError?: boolean;
|
|
5
|
+
onRetry?(): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function ContentBlock({ loading, dataError, onRetry, children }: PropsWithChildren<ContentBlockProps>): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|