@synerise/ds-estimation 1.1.0
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 +10 -0
- package/LICENSE.md +21 -0
- package/README.md +40 -0
- package/dist/Estimation.d.ts +4 -0
- package/dist/Estimation.js +66 -0
- package/dist/Estimation.spec.d.ts +1 -0
- package/dist/Estimation.styles.d.ts +17 -0
- package/dist/Estimation.styles.js +61 -0
- package/dist/Estimation.types.d.ts +54 -0
- package/dist/Estimation.types.js +1 -0
- package/dist/components/EstimationProgressBar.d.ts +7 -0
- package/dist/components/EstimationProgressBar.js +29 -0
- package/dist/components/EstimationProgressBar.styles.d.ts +5 -0
- package/dist/components/EstimationProgressBar.styles.js +18 -0
- package/dist/components/EstimationProgressBarSkeleton.d.ts +2 -0
- package/dist/components/EstimationProgressBarSkeleton.js +20 -0
- package/dist/hooks/useDefaultTexts.d.ts +2 -0
- package/dist/hooks/useDefaultTexts.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/modules.d.js +1 -0
- package/package.json +53 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.1.0 (2025-12-16)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **estimation:** new component ([e5cfacf](https://github.com/Synerise/synerise-design/commit/e5cfacf5362656114e9ce83fcf0631118ff88993))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Synerise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: estimation
|
|
3
|
+
title: Estimation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Estimation UI Component
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
```
|
|
10
|
+
npm i @synerise/ds-estimation
|
|
11
|
+
or
|
|
12
|
+
yarn add @synerise/ds-estimation
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
```
|
|
17
|
+
import Estimation from '@synerise/ds-estimation'
|
|
18
|
+
|
|
19
|
+
<Estimation />
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Demo
|
|
24
|
+
|
|
25
|
+
<iframe src="/storybook-static/iframe.html?id=components-estimation--default"></iframe>
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
| Property | Description | Type | Default | |
|
|
29
|
+
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|---------|---|
|
|
30
|
+
| value | Main estimation value | `ReactNode` | - | |
|
|
31
|
+
| label | Label above the field field | `ReactNode` | - | |
|
|
32
|
+
| tooltip | Label tooltip content | `ReactNode` | - | |
|
|
33
|
+
| tooltipConfig | Configuration for tooltip, see ds-tooltip | `TooltipConfig` | - | |
|
|
34
|
+
| total | Top right corner value (number or formatted content). | `number` | - | |
|
|
35
|
+
| isLoading | Renders loading state (skeletons). Can be boolean or object with `total` and `progressBar` flags in order to render skeletons in place of those components | `boolean \ { total?: boolean; progressBar?: boolean }` | - | |
|
|
36
|
+
| errorMessage | Renders an inline alert in footer with this message | `ReactNode` | - | |
|
|
37
|
+
| footerButtons | Custom buttons to render in footer right side | `ReactNode` | - | |
|
|
38
|
+
| texts | Translations to overwrite DS defaults (`calculated`, `loading`) | `Partial<EstimationTexts>` | - | |
|
|
39
|
+
| calculatedDate | Renders "calculated date" as relative (if recent) or absolute date using FormattedDate. Alternatively provide any ReactNode to render as calculated date | `Date \ ReactNode` | - | |
|
|
40
|
+
| progressBarValues | Render multivalue progressbar. Provide label for each entry to render a legend below multivalue bar | `EstimationProgressValue[]` | - | |
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EstimationProps } from './Estimation.types';
|
|
3
|
+
declare const Estimation: ({ value, tooltip, tooltipConfig, label, total, footerButtons, isLoading, progressBarValues, errorMessage, texts: customTexts, calculatedDate, ...rest }: EstimationProps) => React.JSX.Element;
|
|
4
|
+
export default Estimation;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var _excluded = ["value", "tooltip", "tooltipConfig", "label", "total", "footerButtons", "isLoading", "progressBarValues", "errorMessage", "texts", "calculatedDate"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { FormattedRelativeDateTimeTo } from '@synerise/ds-core';
|
|
6
|
+
import { FormFieldLabel } from '@synerise/ds-form-field';
|
|
7
|
+
import InlineAlert from '@synerise/ds-inline-alert';
|
|
8
|
+
import * as S from './Estimation.styles';
|
|
9
|
+
import { EstimationProgressBar } from './components/EstimationProgressBar';
|
|
10
|
+
import { EstimationProgressBarSkeleton } from './components/EstimationProgressBarSkeleton';
|
|
11
|
+
import { useDefaultTexts } from './hooks/useDefaultTexts';
|
|
12
|
+
var Estimation = function Estimation(_ref) {
|
|
13
|
+
var value = _ref.value,
|
|
14
|
+
tooltip = _ref.tooltip,
|
|
15
|
+
tooltipConfig = _ref.tooltipConfig,
|
|
16
|
+
label = _ref.label,
|
|
17
|
+
total = _ref.total,
|
|
18
|
+
footerButtons = _ref.footerButtons,
|
|
19
|
+
isLoading = _ref.isLoading,
|
|
20
|
+
progressBarValues = _ref.progressBarValues,
|
|
21
|
+
errorMessage = _ref.errorMessage,
|
|
22
|
+
customTexts = _ref.texts,
|
|
23
|
+
calculatedDate = _ref.calculatedDate,
|
|
24
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
|
+
var texts = useDefaultTexts(customTexts);
|
|
26
|
+
var estimationDate = calculatedDate instanceof Date ? /*#__PURE__*/React.createElement(FormattedRelativeDateTimeTo, {
|
|
27
|
+
value: calculatedDate
|
|
28
|
+
}) : calculatedDate;
|
|
29
|
+
var footerLeftSide = errorMessage ? /*#__PURE__*/React.createElement(InlineAlert, {
|
|
30
|
+
type: "alert",
|
|
31
|
+
message: errorMessage
|
|
32
|
+
}) : isLoading ? texts.loading : /*#__PURE__*/React.createElement(React.Fragment, null, texts.calculated, ' ', /*#__PURE__*/React.createElement(S.EstimationCalculatedDate, {
|
|
33
|
+
level: 6
|
|
34
|
+
}, estimationDate));
|
|
35
|
+
var loadingParts = typeof isLoading === 'object' ? isLoading : undefined;
|
|
36
|
+
var showTotalSkeleton = loadingParts == null ? void 0 : loadingParts.total;
|
|
37
|
+
var showProgressBarSkeleton = loadingParts == null ? void 0 : loadingParts.progressBar;
|
|
38
|
+
var shouldRenderTotal = total !== undefined && (!isLoading || showTotalSkeleton);
|
|
39
|
+
var shouldRenderFooterLeftSide = Boolean(isLoading || errorMessage || calculatedDate);
|
|
40
|
+
return /*#__PURE__*/React.createElement(S.EstimationWrapper, _extends({
|
|
41
|
+
isLoading: !!isLoading
|
|
42
|
+
}, rest), label && /*#__PURE__*/React.createElement(FormFieldLabel, {
|
|
43
|
+
label: label,
|
|
44
|
+
tooltip: tooltip,
|
|
45
|
+
tooltipConfig: tooltipConfig
|
|
46
|
+
}), /*#__PURE__*/React.createElement(S.EstimationContent, null, /*#__PURE__*/React.createElement(S.EstimationHead, null, /*#__PURE__*/React.createElement(S.EstimationLeftSide, null, isLoading ? /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
47
|
+
numberOfSkeletons: 1,
|
|
48
|
+
size: "L",
|
|
49
|
+
width: "L",
|
|
50
|
+
height: 28
|
|
51
|
+
}) : /*#__PURE__*/React.createElement(S.EstimationTitle, {
|
|
52
|
+
level: 1
|
|
53
|
+
}, value)), shouldRenderTotal && /*#__PURE__*/React.createElement(S.EstimationRightSide, null, showTotalSkeleton ? /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
54
|
+
numberOfSkeletons: 1,
|
|
55
|
+
size: "L",
|
|
56
|
+
width: "L",
|
|
57
|
+
height: 18
|
|
58
|
+
}) : total)), /*#__PURE__*/React.createElement(S.EstimationBody, null, showProgressBarSkeleton ? /*#__PURE__*/React.createElement(EstimationProgressBarSkeleton, null) : (progressBarValues == null ? void 0 : progressBarValues.length) && !isLoading && /*#__PURE__*/React.createElement(EstimationProgressBar, {
|
|
59
|
+
values: progressBarValues
|
|
60
|
+
})), (footerButtons || shouldRenderFooterLeftSide) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.EstimationDivider, {
|
|
61
|
+
dashed: true
|
|
62
|
+
}), /*#__PURE__*/React.createElement(S.EstimationFooter, {
|
|
63
|
+
"data-testid": "estimation-footer"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(S.EstimationCalculated, null, footerLeftSide), footerButtons && /*#__PURE__*/React.createElement(S.EstimationRightSide, null, footerButtons)))));
|
|
65
|
+
};
|
|
66
|
+
export default Estimation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const Skeleton: import("styled-components").StyledComponent<({ size, numberOfSkeletons, width, height, className, }: import("@synerise/ds-skeleton").SkeletonProps) => React.JSX.Element, any, {
|
|
2
|
+
$width?: number;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const EstimationDivider: import("styled-components").StyledComponent<(props: import("@synerise/ds-divider").DividerProps) => React.JSX.Element, any, {}, never>;
|
|
5
|
+
export declare const EstimationTitle: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => React.JSX.Element, any, {}, never>;
|
|
6
|
+
export declare const EstimationWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const Bold: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
|
+
export declare const EstimationContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const EstimationHead: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const EstimationBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const EstimationFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const EstimationCalculated: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
|
+
export declare const EstimationCalculatedDate: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => React.JSX.Element, any, {}, never>;
|
|
16
|
+
export declare const EstimationLeftSide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const EstimationRightSide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Divider from '@synerise/ds-divider';
|
|
3
|
+
import DSSkeleton from '@synerise/ds-skeleton';
|
|
4
|
+
import { Title } from '@synerise/ds-typography';
|
|
5
|
+
var splitStyles = css(["display:flex;align-items:center;justify-content:space-between;"]);
|
|
6
|
+
export var Skeleton = styled(DSSkeleton).withConfig({
|
|
7
|
+
displayName: "Estimationstyles__Skeleton",
|
|
8
|
+
componentId: "sc-scc0bk-0"
|
|
9
|
+
})(["padding:0;width:", "px;"], function (props) {
|
|
10
|
+
return props.$width || '100';
|
|
11
|
+
});
|
|
12
|
+
export var EstimationDivider = styled(Divider).withConfig({
|
|
13
|
+
displayName: "Estimationstyles__EstimationDivider",
|
|
14
|
+
componentId: "sc-scc0bk-1"
|
|
15
|
+
})(["margin:8px 0;"]);
|
|
16
|
+
export var EstimationTitle = styled(Title).withConfig({
|
|
17
|
+
displayName: "Estimationstyles__EstimationTitle",
|
|
18
|
+
componentId: "sc-scc0bk-2"
|
|
19
|
+
})(["margin:0;"]);
|
|
20
|
+
export var EstimationWrapper = styled.div.withConfig({
|
|
21
|
+
displayName: "Estimationstyles__EstimationWrapper",
|
|
22
|
+
componentId: "sc-scc0bk-3"
|
|
23
|
+
})(["display:flex;flex-direction:column;gap:8px;"]);
|
|
24
|
+
export var Bold = styled.span.withConfig({
|
|
25
|
+
displayName: "Estimationstyles__Bold",
|
|
26
|
+
componentId: "sc-scc0bk-4"
|
|
27
|
+
})(["font-weight:500;"]);
|
|
28
|
+
export var EstimationContent = styled.div.withConfig({
|
|
29
|
+
displayName: "Estimationstyles__EstimationContent",
|
|
30
|
+
componentId: "sc-scc0bk-5"
|
|
31
|
+
})(["border-radius:8px;border:solid 1px ", ";padding:16px 16px 12px;display:flex;flex-direction:column;gap:4px;"], function (props) {
|
|
32
|
+
return props.theme.palette['grey-200'];
|
|
33
|
+
});
|
|
34
|
+
export var EstimationHead = styled.div.withConfig({
|
|
35
|
+
displayName: "Estimationstyles__EstimationHead",
|
|
36
|
+
componentId: "sc-scc0bk-6"
|
|
37
|
+
})(["", ""], splitStyles);
|
|
38
|
+
export var EstimationBody = styled.div.withConfig({
|
|
39
|
+
displayName: "Estimationstyles__EstimationBody",
|
|
40
|
+
componentId: "sc-scc0bk-7"
|
|
41
|
+
})([""]);
|
|
42
|
+
export var EstimationFooter = styled.div.withConfig({
|
|
43
|
+
displayName: "Estimationstyles__EstimationFooter",
|
|
44
|
+
componentId: "sc-scc0bk-8"
|
|
45
|
+
})(["", ""], splitStyles);
|
|
46
|
+
export var EstimationCalculated = styled.div.withConfig({
|
|
47
|
+
displayName: "Estimationstyles__EstimationCalculated",
|
|
48
|
+
componentId: "sc-scc0bk-9"
|
|
49
|
+
})([""]);
|
|
50
|
+
export var EstimationCalculatedDate = styled(Title).withConfig({
|
|
51
|
+
displayName: "Estimationstyles__EstimationCalculatedDate",
|
|
52
|
+
componentId: "sc-scc0bk-10"
|
|
53
|
+
})(["margin:0;display:inline;"]);
|
|
54
|
+
export var EstimationLeftSide = styled.div.withConfig({
|
|
55
|
+
displayName: "Estimationstyles__EstimationLeftSide",
|
|
56
|
+
componentId: "sc-scc0bk-11"
|
|
57
|
+
})([""]);
|
|
58
|
+
export var EstimationRightSide = styled.div.withConfig({
|
|
59
|
+
displayName: "Estimationstyles__EstimationRightSide",
|
|
60
|
+
componentId: "sc-scc0bk-12"
|
|
61
|
+
})(["display:flex;gap:8px;"]);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BaseLabelProps } from '@synerise/ds-form-field';
|
|
3
|
+
import { type ProgressValue } from '@synerise/ds-progress-bar';
|
|
4
|
+
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
5
|
+
export type EstimationProgressValue = ProgressValue & {
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
type SkeletonConfig = {
|
|
9
|
+
total?: boolean;
|
|
10
|
+
progressBar?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type EstimationBaseProps = BaseLabelProps & {
|
|
13
|
+
/**
|
|
14
|
+
* main estimation value
|
|
15
|
+
*/
|
|
16
|
+
value?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* renders loading state (skeletons)
|
|
19
|
+
*/
|
|
20
|
+
isLoading?: boolean | SkeletonConfig;
|
|
21
|
+
/**
|
|
22
|
+
* top right corner value / values. provide preformatted content here
|
|
23
|
+
* provide any value to render skeleton in place of the total in loading mode
|
|
24
|
+
*/
|
|
25
|
+
total?: number;
|
|
26
|
+
/**
|
|
27
|
+
* renders an inline alert in footer with this message
|
|
28
|
+
*/
|
|
29
|
+
errorMessage?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* refresh / show conditions buttons to render in footer right side
|
|
32
|
+
*/
|
|
33
|
+
footerButtons?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* translations to overwrite DS defaults
|
|
36
|
+
*/
|
|
37
|
+
texts?: Partial<EstimationTexts>;
|
|
38
|
+
/**
|
|
39
|
+
* renders "calculated date" a relative (if recent) or absolute date using FormattedDate
|
|
40
|
+
* alternatively provide any reactNode to render as calculated date
|
|
41
|
+
*/
|
|
42
|
+
calculatedDate?: Date | ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* render multivalue progressbar.
|
|
45
|
+
* provide label for each entry to render a legend below multivalue bar
|
|
46
|
+
*/
|
|
47
|
+
progressBarValues?: EstimationProgressValue[];
|
|
48
|
+
};
|
|
49
|
+
export type EstimationProps = WithHTMLAttributes<HTMLDivElement, EstimationBaseProps>;
|
|
50
|
+
export type EstimationTexts = {
|
|
51
|
+
calculated: ReactNode;
|
|
52
|
+
loading: ReactNode;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type EstimationProgressValue } from '../Estimation.types';
|
|
3
|
+
type EstimationProgressBarProps = {
|
|
4
|
+
values: EstimationProgressValue[];
|
|
5
|
+
};
|
|
6
|
+
export declare const EstimationProgressBar: ({ values: progressBarValues, }: EstimationProgressBarProps) => React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import * as S from './EstimationProgressBar.styles';
|
|
4
|
+
export var EstimationProgressBar = function EstimationProgressBar(_ref) {
|
|
5
|
+
var progressBarValues = _ref.values;
|
|
6
|
+
var _useMemo = useMemo(function () {
|
|
7
|
+
var values = [];
|
|
8
|
+
var legend = [];
|
|
9
|
+
progressBarValues.forEach(function (value) {
|
|
10
|
+
values.push(_extends({}, value));
|
|
11
|
+
if (value.label) {
|
|
12
|
+
legend.push(/*#__PURE__*/React.createElement(S.EstimationProgressBarLegendItem, {
|
|
13
|
+
dotColor: value.color
|
|
14
|
+
}, /*#__PURE__*/React.createElement("span", null, value.label)));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
progressValues: values,
|
|
19
|
+
progressLegend: legend
|
|
20
|
+
};
|
|
21
|
+
}, [progressBarValues]),
|
|
22
|
+
progressValues = _useMemo.progressValues,
|
|
23
|
+
progressLegend = _useMemo.progressLegend;
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.EstimationProgressBar, {
|
|
25
|
+
"data-testid": "estimation-progressbar",
|
|
26
|
+
values: progressValues,
|
|
27
|
+
stackedBars: false
|
|
28
|
+
}), (progressLegend == null ? void 0 : progressLegend.length) > 0 && /*#__PURE__*/React.createElement(S.EstimationProgressBarLegend, null, progressLegend));
|
|
29
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const EstimationProgressBar: import("styled-components").StyledComponent<({ values, stackedBars, ...htmlAttributes }: import("@synerise/ds-progress-bar").MultivalueProps) => React.JSX.Element, any, {}, never>;
|
|
2
|
+
export declare const EstimationProgressBarLegend: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const EstimationProgressBarLegendItem: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
dotColor: string;
|
|
5
|
+
}, never>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Multivalue } from '@synerise/ds-progress-bar';
|
|
3
|
+
export var EstimationProgressBar = styled(Multivalue).withConfig({
|
|
4
|
+
displayName: "EstimationProgressBarstyles__EstimationProgressBar",
|
|
5
|
+
componentId: "sc-10gbufd-0"
|
|
6
|
+
})(["height:auto;padding:0;margin:14px 0 8px;"]);
|
|
7
|
+
export var EstimationProgressBarLegend = styled.div.withConfig({
|
|
8
|
+
displayName: "EstimationProgressBarstyles__EstimationProgressBarLegend",
|
|
9
|
+
componentId: "sc-10gbufd-1"
|
|
10
|
+
})(["display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding-top:4px;"]);
|
|
11
|
+
export var EstimationProgressBarLegendItem = styled.div.withConfig({
|
|
12
|
+
displayName: "EstimationProgressBarstyles__EstimationProgressBarLegendItem",
|
|
13
|
+
componentId: "sc-10gbufd-2"
|
|
14
|
+
})(["display:flex;align-items:center;gap:8px;&:before{content:'';width:10px;height:10px;background:", ";border-radius:0.5em;border:solid 2px ", ";}"], function (props) {
|
|
15
|
+
return props.dotColor;
|
|
16
|
+
}, function (props) {
|
|
17
|
+
return props.theme.palette['white'];
|
|
18
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTheme } from '@synerise/ds-core';
|
|
3
|
+
import { Skeleton } from '../Estimation.styles';
|
|
4
|
+
import * as S from './EstimationProgressBar.styles';
|
|
5
|
+
export var EstimationProgressBarSkeleton = function EstimationProgressBarSkeleton() {
|
|
6
|
+
var theme = useTheme();
|
|
7
|
+
var EMPTY_VALUE = {
|
|
8
|
+
percent: 100,
|
|
9
|
+
color: theme.palette['grey-200']
|
|
10
|
+
};
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.EstimationProgressBar, {
|
|
12
|
+
"data-testid": "estimation-progressbar-skeleton",
|
|
13
|
+
values: [EMPTY_VALUE],
|
|
14
|
+
stackedBars: false
|
|
15
|
+
}), /*#__PURE__*/React.createElement(S.EstimationProgressBarLegend, null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
16
|
+
height: 18,
|
|
17
|
+
numberOfSkeletons: 1,
|
|
18
|
+
$width: 142
|
|
19
|
+
})));
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
export var useDefaultTexts = function useDefaultTexts(defaultTexts) {
|
|
5
|
+
return _extends({
|
|
6
|
+
loading: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
7
|
+
id: "DS.ESTIMATION.LOADING",
|
|
8
|
+
defaultMessage: "Loading..."
|
|
9
|
+
}),
|
|
10
|
+
calculated: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
11
|
+
id: "DS.ESTIMATION.CALCULATED",
|
|
12
|
+
defaultMessage: "Calculated:"
|
|
13
|
+
})
|
|
14
|
+
}, defaultTexts || {});
|
|
15
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Estimation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@synerise/ds-estimation",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Estimation UI Component for the Synerise Design System",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"repository": "Synerise/synerise-design",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"README.md",
|
|
12
|
+
"package.json",
|
|
13
|
+
"LICENSE.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "npm run build:js && npm run build:css && npm run defs",
|
|
20
|
+
"build:css": "node ../../../scripts/style/less.js",
|
|
21
|
+
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
+
"build:watch": "npm run build:js -- --watch",
|
|
23
|
+
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
|
+
"prepublish": "npm run build",
|
|
25
|
+
"types": "tsc --noEmit",
|
|
26
|
+
"pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:watch": "npm run test -- --watchAll",
|
|
29
|
+
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
30
|
+
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"dist/style/*",
|
|
34
|
+
"*.less"
|
|
35
|
+
],
|
|
36
|
+
"types": "dist/index.d.ts",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@synerise/ds-divider": "^1.2.3",
|
|
39
|
+
"@synerise/ds-form-field": "^1.2.0",
|
|
40
|
+
"@synerise/ds-inline-alert": "^1.1.2",
|
|
41
|
+
"@synerise/ds-progress-bar": "^1.1.25",
|
|
42
|
+
"@synerise/ds-skeleton": "^1.0.27",
|
|
43
|
+
"@synerise/ds-typography": "^1.0.25",
|
|
44
|
+
"@synerise/ds-utils": "^1.5.1"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@synerise/ds-core": "*",
|
|
48
|
+
"react": ">=16.9.0 <= 18.3.1",
|
|
49
|
+
"react-intl": ">=3.12.0 <= 6.8",
|
|
50
|
+
"styled-components": "^5.3.3"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "c610279aef2d2139973075117de1bb281b9393b6"
|
|
53
|
+
}
|