@motionmetrics/mmpro-storybook-components-schema 2.0.32 → 2.0.34
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/lib/storybook/components/Icon/Icon.d.ts +3 -3
- package/lib/storybook/components/Schema/BaseSchema/index.d.ts +3 -3
- package/lib/storybook/components/Schema/BaseSchema/types.js +1 -0
- package/lib/storybook/components/Schema/OfflineSchema/index.d.ts +1 -1
- package/lib/storybook/components/Schema/Schema.d.ts +1 -1
- package/lib/storybook/components/Schema/Schema.js +44 -0
- package/lib/storybook/components/Schema/Schema.styles.js +51 -0
- package/lib/storybook/components/Schema/Schema.types.js +1 -0
- package/lib/storybook/components/Schema/ToothWearSchema/index.d.ts +1 -1
- package/lib/storybook/components/Schema/assets/colors.js +21 -0
- package/lib/storybook/components/Schema/assets/utils.js +59 -0
- package/lib/storybook/components/Schema/constants.d.ts +3 -3
- package/lib/storybook/components/Schema/constants.js +19 -0
- package/lib/storybook/components/Schema/utils.js +66 -0
- package/lib/storybook/schema-entry.js +56599 -0
- package/package.json +18 -6
- package/lib/storybook/components/Tooltip/RichTooltip/index.d.ts +0 -40
- package/lib/storybook/tokensV2/index.js +0 -2
- package/lib/storybook/utils/emptyDataStructures.d.ts +0 -2
- package/lib/storybook/utils/formatDateWithAt.d.ts +0 -9
- package/lib/storybook/utils/i18Translation.d.ts +0 -1
- package/lib/storybook/utils/styles.d.ts +0 -16
- package/lib/storybook/utils/time.d.ts +0 -10
- package/lib/storybook/utils/tss.d.ts +0 -4
- package/lib/storybook/utils/zustand.d.ts +0 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Icon } from "./renderers/Icon";
|
|
2
2
|
export { Icon };
|
|
3
|
-
export declare const ProductIcon: ({ iconType, name, className, size, handleClick, style, }: import("
|
|
4
|
-
export declare const ModuleIcon: ({ iconType, name, className, size, handleClick, style, }: import("
|
|
5
|
-
export declare const ModuleOutlinedIcon: ({ iconType, name, className, size, handleClick, style, }: import("
|
|
3
|
+
export declare const ProductIcon: ({ iconType, name, className, size, handleClick, style, }: import(":storybook").IconPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const ModuleIcon: ({ iconType, name, className, size, handleClick, style, }: import(":storybook").IconPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ModuleOutlinedIcon: ({ iconType, name, className, size, handleClick, style, }: import(":storybook").IconPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,10 +8,10 @@ export declare const BaseSchema: import("react").MemoExoticComponent<import("rea
|
|
|
8
8
|
reverseTeeth?: boolean;
|
|
9
9
|
disableTooltip?: boolean;
|
|
10
10
|
showToothNum?: boolean;
|
|
11
|
-
toothSettings?: Pick<import("
|
|
12
|
-
toothWearPredictions?: Pick<import("
|
|
11
|
+
toothSettings?: Pick<import(":models").ToothSetting, "length" | "maxLength" | "minLength">[];
|
|
12
|
+
toothWearPredictions?: Pick<import(":models").ToothWearPrediction, "projectedWearOutUtcTime">[];
|
|
13
13
|
toothWearLastUpdated?: number;
|
|
14
14
|
toothCount: number;
|
|
15
15
|
getToothOption: SchemaElementOptionGetter;
|
|
16
16
|
getLipShroudOption: SchemaElementOptionGetter;
|
|
17
|
-
} & import("
|
|
17
|
+
} & import(":storybook").CommonStylingProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export type OfflineSchemaPropsType = ExtendedSchemaProps<{
|
|
|
4
4
|
toothCount: number;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const OfflineSchema: import("react").ForwardRefExoticComponent<Omit<import("../BaseSchema/types").BaseSchemaPropsType, "toothCount" | "getToothOption" | "getLipShroudOption"> & {
|
|
7
|
-
equipmentType: import("
|
|
7
|
+
equipmentType: import(":models").EquipmentTypeName;
|
|
8
8
|
} & {
|
|
9
9
|
toothCount: number;
|
|
10
10
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Schema: import("react").ForwardRefExoticComponent<Omit<import("./BaseSchema/types").BaseSchemaPropsType, "toothCount" | "getToothOption" | "getLipShroudOption"> & {
|
|
3
|
-
equipmentType: import("
|
|
3
|
+
equipmentType: import(":models").EquipmentTypeName;
|
|
4
4
|
} & {
|
|
5
5
|
schemaType: "tooth" | "lipShroud";
|
|
6
6
|
statusArray: number[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EMPTY_ARRAY } from ":utils";
|
|
3
|
+
import { forwardRef, useCallback } from "react";
|
|
4
|
+
import { BaseSchema } from "./BaseSchema";
|
|
5
|
+
import { getSchemaColors } from "./assets/colors";
|
|
6
|
+
import { getLipShroudComponent, getMissingToothComponent, getToothComponent, } from "./constants";
|
|
7
|
+
import { getToothIntactRatio } from "./utils";
|
|
8
|
+
export const Schema = forwardRef(({ statusArray = [], schemaType, equipmentType, isDarkMode, ...props }, ref) => {
|
|
9
|
+
const isToothSchema = schemaType === "tooth";
|
|
10
|
+
const toothCount = statusArray.length + (isToothSchema ? 0 : 1);
|
|
11
|
+
const toothSettings = props.toothSettings ?? EMPTY_ARRAY;
|
|
12
|
+
const colorVariant = isDarkMode ? "darkTheme" : "default";
|
|
13
|
+
const schemaColorSet = getSchemaColors(colorVariant);
|
|
14
|
+
const getStatusColor = (status) => status ? schemaColorSet.alarm : schemaColorSet.safe;
|
|
15
|
+
const getToothOption = useCallback((index) => {
|
|
16
|
+
if (!isToothSchema) {
|
|
17
|
+
return {
|
|
18
|
+
Component: getToothComponent(toothCount, equipmentType, colorVariant),
|
|
19
|
+
color: schemaColorSet.offline,
|
|
20
|
+
intactRatio: 1,
|
|
21
|
+
criticalRatio: 0,
|
|
22
|
+
disableTooltip: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const missing = statusArray[index];
|
|
26
|
+
return {
|
|
27
|
+
Component: missing
|
|
28
|
+
? getMissingToothComponent(toothCount, equipmentType, colorVariant)
|
|
29
|
+
: getToothComponent(toothCount, equipmentType, colorVariant),
|
|
30
|
+
color: getStatusColor(missing),
|
|
31
|
+
intactRatio: missing ? 1 : getToothIntactRatio(toothSettings[index]),
|
|
32
|
+
};
|
|
33
|
+
}, [equipmentType, isToothSchema, statusArray, toothCount, toothSettings, colorVariant, schemaColorSet]);
|
|
34
|
+
const getLipShroudOption = useCallback((index) => ({
|
|
35
|
+
Component: getLipShroudComponent(toothCount, colorVariant),
|
|
36
|
+
color: isToothSchema
|
|
37
|
+
? schemaColorSet.offline
|
|
38
|
+
: getStatusColor(statusArray[index]),
|
|
39
|
+
intactRatio: 1,
|
|
40
|
+
criticalRatio: 0,
|
|
41
|
+
disableTooltip: isToothSchema,
|
|
42
|
+
}), [toothCount, isToothSchema, statusArray, colorVariant, schemaColorSet]);
|
|
43
|
+
return (_jsx(BaseSchema, { ...props, ref: ref, toothCount: toothCount, getToothOption: getToothOption, getLipShroudOption: getLipShroudOption, isDarkMode: isDarkMode }));
|
|
44
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { palette } from ":storybook/tokensV2";
|
|
2
|
+
import { css } from "@emotion/css";
|
|
3
|
+
import { SCHEMA_DEFAULT_HEIGHT } from "./constants";
|
|
4
|
+
export const container = css `
|
|
5
|
+
height: ${SCHEMA_DEFAULT_HEIGHT}px;
|
|
6
|
+
background: ${palette.background.darkBase.default};
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
`;
|
|
11
|
+
export const toothSchemaContainer = css `
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
margin: auto;
|
|
15
|
+
padding: 0 16px;
|
|
16
|
+
vertical-align: bottom;
|
|
17
|
+
align-items: self-end;
|
|
18
|
+
height: auto;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
position: relative;
|
|
21
|
+
column-gap: 2px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
|
|
24
|
+
& svg {
|
|
25
|
+
height: auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& > * {
|
|
29
|
+
flex: 0 1 auto;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const gridItemDetails = css `
|
|
34
|
+
&.MuiGrid-root.MuiGrid-item {
|
|
35
|
+
padding: 0;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
max-width: fit-content;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
export const heightAdjustedTooth = css `
|
|
42
|
+
display: flex;
|
|
43
|
+
transform-origin: bottom center;
|
|
44
|
+
`;
|
|
45
|
+
export const criticalLine = css `
|
|
46
|
+
border-top: 1px dashed #a17ff8;
|
|
47
|
+
position: absolute;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export type ToothWearSchemaPropsType = ExtendedSchemaProps<{
|
|
|
4
4
|
customWidth?: number;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const ToothWearSchema: import("react").ForwardRefExoticComponent<Omit<import("../BaseSchema/types").BaseSchemaPropsType, "toothCount" | "getToothOption" | "getLipShroudOption"> & {
|
|
7
|
-
equipmentType: import("
|
|
7
|
+
equipmentType: import(":models").EquipmentTypeName;
|
|
8
8
|
} & {
|
|
9
9
|
customWidth?: number;
|
|
10
10
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { palette } from ":storybook/tokensV2";
|
|
2
|
+
export const getSchemaColors = (colorVariant) => {
|
|
3
|
+
return {
|
|
4
|
+
safe: {
|
|
5
|
+
fill: palette.schema.normal[colorVariant],
|
|
6
|
+
stroke: palette.schema.normalBorder[colorVariant]
|
|
7
|
+
},
|
|
8
|
+
offline: {
|
|
9
|
+
fill: palette.schema.offline[colorVariant],
|
|
10
|
+
stroke: palette.schema.offlineBorder[colorVariant]
|
|
11
|
+
},
|
|
12
|
+
alarm: {
|
|
13
|
+
fill: palette.schema.alarm[colorVariant],
|
|
14
|
+
stroke: palette.schema.alarmBorder[colorVariant]
|
|
15
|
+
},
|
|
16
|
+
warning: {
|
|
17
|
+
fill: palette.schema.warning[colorVariant],
|
|
18
|
+
stroke: palette.schema.warningBorder[colorVariant]
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react/display-name */
|
|
3
|
+
import { uniqueId } from "lodash";
|
|
4
|
+
import { forwardRef, useMemo } from "react";
|
|
5
|
+
import { getSchemaColors } from "./colors";
|
|
6
|
+
import { palette } from ":storybook/tokensV2";
|
|
7
|
+
import { tss } from ":storybook/utils";
|
|
8
|
+
const useStyles = tss.create(({ colorVariant }) => {
|
|
9
|
+
return {
|
|
10
|
+
thresholdLine: {
|
|
11
|
+
stroke: palette.schema.threshold[colorVariant],
|
|
12
|
+
strokeWidth: 2,
|
|
13
|
+
strokeDasharray: "3, 3",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Create a component template from a sample Schema element (tooth or lip shroud)
|
|
19
|
+
* SVG. The resulting template can be used to create new components with different
|
|
20
|
+
* sizes compared to the original SVG.
|
|
21
|
+
*/
|
|
22
|
+
const createSchemaComponentTemplate = ({ path, originalWidth, originalHeight, colorVariant }) => ({ width = originalWidth, height = originalHeight }) => {
|
|
23
|
+
/**
|
|
24
|
+
* We use 1px stroke for the border, and stroke is centered on the line. So
|
|
25
|
+
* for the stroke to be fully visible, the svg path is actually drawn in a box
|
|
26
|
+
* 1px smaller (horizontally & vertically) than the actual viewBox. This is the
|
|
27
|
+
* reason why we need to subtract 1 when calculating the transformation scales.
|
|
28
|
+
*/
|
|
29
|
+
const xScale = (width - 1) / (originalWidth - 1);
|
|
30
|
+
const yScale = (height - 1) / (originalHeight - 1);
|
|
31
|
+
const viewBox = `-${width / 2} -${height / 2} ${width} ${height}`;
|
|
32
|
+
const transform = `
|
|
33
|
+
scale(${xScale}, ${yScale})
|
|
34
|
+
translate(${-originalWidth / 2}, ${-originalHeight / 2})
|
|
35
|
+
`;
|
|
36
|
+
return forwardRef(({ fill, stroke, intactRatio = 1, criticalRatio = 0, ...props }, ref) => {
|
|
37
|
+
const commonPathProps = {
|
|
38
|
+
vectorEffect: "non-scaling-stroke",
|
|
39
|
+
d: path,
|
|
40
|
+
transform: transform,
|
|
41
|
+
};
|
|
42
|
+
const fullyIntact = intactRatio === 1;
|
|
43
|
+
const { classes } = useStyles();
|
|
44
|
+
const clipPathId = useMemo(() => (fullyIntact ? undefined : `mmpro-schema-clippath-${uniqueId()}`), [fullyIntact]);
|
|
45
|
+
const clipLineId = useMemo(() => (criticalRatio <= 0 ? undefined : `mmpro-schema-linepath-${uniqueId()}`), [criticalRatio]);
|
|
46
|
+
return (_jsxs("svg", { ...props, ref: ref, width: width, height: height, viewBox: viewBox, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [fullyIntact || (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx("clipPath", { id: clipPathId, children: _jsx("rect", { x: "0", y: (1 - intactRatio) * originalHeight, width: originalWidth, height: originalHeight }) }) }), _jsx("path", { ...commonPathProps, ...getSchemaColors(colorVariant).offline })] })), _jsx("path", { ...commonPathProps, fill: fill, stroke: stroke, clipPath: fullyIntact ? undefined : `url(#${clipPathId})` }), criticalRatio > 0 &&
|
|
47
|
+
_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx("clipPath", { id: clipLineId, children: _jsx("path", { ...commonPathProps }) }) }), _jsx("line", { "clip-path": `url(#${clipLineId})`, x1: -originalWidth, y1: originalHeight * (0.5 - criticalRatio), x2: originalWidth, y2: originalHeight * (0.5 - criticalRatio), className: classes.thresholdLine })] })] }));
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export function createElementSets({ path, originalWidth, originalHeight, widths, colorVariant }) {
|
|
51
|
+
const template = createSchemaComponentTemplate({
|
|
52
|
+
path,
|
|
53
|
+
originalWidth,
|
|
54
|
+
originalHeight,
|
|
55
|
+
colorVariant,
|
|
56
|
+
});
|
|
57
|
+
const components = widths.map((width) => template({ width }));
|
|
58
|
+
return components;
|
|
59
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EquipmentTypeName } from ":models";
|
|
2
2
|
import type { ColorVariantKey } from ":storybook/tokensV2";
|
|
3
3
|
export declare const SCHEMA_DEFAULT_HEIGHT = 60;
|
|
4
|
-
export declare const getToothComponent: (numberOfTeeth: number, equipmentType: EquipmentTypeName, colorVariant: ColorVariantKey, widthsOverride?: number) => import("
|
|
5
|
-
export declare const getMissingToothComponent: (numberOfTeeth: number, equipmentType: EquipmentTypeName, colorVariant: ColorVariantKey) => import("
|
|
6
|
-
export declare const getLipShroudComponent: (numberOfTeeth: number, colorVariant: ColorVariantKey) => import("
|
|
4
|
+
export declare const getToothComponent: (numberOfTeeth: number, equipmentType: EquipmentTypeName, colorVariant: ColorVariantKey, widthsOverride?: number) => import(":storybook/components/Schema/assets/utils").SchemaElementComponent;
|
|
5
|
+
export declare const getMissingToothComponent: (numberOfTeeth: number, equipmentType: EquipmentTypeName, colorVariant: ColorVariantKey) => import(":storybook/components/Schema/assets/utils").SchemaElementComponent;
|
|
6
|
+
export declare const getLipShroudComponent: (numberOfTeeth: number, colorVariant: ColorVariantKey) => import(":storybook/components/Schema/assets/utils").SchemaElementComponent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EquipmentTypeName } from ":models";
|
|
2
|
+
import { lipShroud, toothCableShovel, toothCableShovelMissing, toothHydraulicShovel, toothHydraulicShovelMissing, } from "./assets";
|
|
3
|
+
export const SCHEMA_DEFAULT_HEIGHT = 60;
|
|
4
|
+
export const getToothComponent = (numberOfTeeth, equipmentType, colorVariant, widthsOverride) => {
|
|
5
|
+
const set = equipmentType === EquipmentTypeName.hydraulicShovel
|
|
6
|
+
? toothHydraulicShovel
|
|
7
|
+
: toothCableShovel;
|
|
8
|
+
return set(colorVariant, {
|
|
9
|
+
count: numberOfTeeth,
|
|
10
|
+
width: widthsOverride,
|
|
11
|
+
})[numberOfTeeth];
|
|
12
|
+
};
|
|
13
|
+
export const getMissingToothComponent = (numberOfTeeth, equipmentType, colorVariant) => {
|
|
14
|
+
const set = equipmentType === EquipmentTypeName.hydraulicShovel
|
|
15
|
+
? toothHydraulicShovelMissing
|
|
16
|
+
: toothCableShovelMissing;
|
|
17
|
+
return set(colorVariant)[numberOfTeeth];
|
|
18
|
+
};
|
|
19
|
+
export const getLipShroudComponent = (numberOfTeeth, colorVariant) => lipShroud(colorVariant)[numberOfTeeth];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as classes from "./Schema.styles";
|
|
3
|
+
import { Typography } from ":storybook/tokensV2";
|
|
4
|
+
import { convertAndRoundLength, getWearOutPredictionTextAndColor, } from ":storybook/utils";
|
|
5
|
+
import { t } from "i18next";
|
|
6
|
+
const SOURCE_UNIT = "m";
|
|
7
|
+
export const DECIMAL_PLACES = {
|
|
8
|
+
in: 3, // inch has 3 decimals because client uses 1/8, 5/8 in target size
|
|
9
|
+
m: 3,
|
|
10
|
+
cm: 1,
|
|
11
|
+
mm: 0,
|
|
12
|
+
};
|
|
13
|
+
export const getLipShroudMessage = ({ index }) => {
|
|
14
|
+
return (_jsx(Typography, { variant: "tooltipTitle", children: t("ID_LIP_SHROUD_NO_0", { 0: index + 1 }) + "\n" }));
|
|
15
|
+
};
|
|
16
|
+
export const getToothMessage = ({ index, toothSettings, toothWearPredictions, unit,
|
|
17
|
+
// toothWearLastUpdated,
|
|
18
|
+
}) => {
|
|
19
|
+
const settings = toothSettings?.[index];
|
|
20
|
+
const toothLength = settings && convertAndRound(settings.length, unit);
|
|
21
|
+
const critLength = settings && convertAndRound(settings.minLength, unit);
|
|
22
|
+
const prediction = toothWearPredictions?.[index];
|
|
23
|
+
const wearOutText = prediction &&
|
|
24
|
+
getWearOutPredictionTextAndColor(prediction.projectedWearOutUtcTime);
|
|
25
|
+
const content = [];
|
|
26
|
+
if (toothLength && critLength) {
|
|
27
|
+
content.push(`${t("ID_LENGTH")}: ${toothLength} ${unit} (${t("ID_CRIT")} ${critLength} ${unit})\n`);
|
|
28
|
+
}
|
|
29
|
+
if (wearOutText) {
|
|
30
|
+
content.push(`${t("ID_WEAR_OUT_IN")}: ${wearOutText.wearOutIn} ${wearOutText.suffix ?? ""}\n`);
|
|
31
|
+
}
|
|
32
|
+
// const lastUpdated = toothWearLastUpdated != null && (
|
|
33
|
+
// <Typography variant="tooltipText" style={{ lineHeight: "24px" }}>
|
|
34
|
+
// {capitalize(unix(toothWearLastUpdated).fromNow())}
|
|
35
|
+
// </Typography>
|
|
36
|
+
// );
|
|
37
|
+
return (_jsx("div", { style: { whiteSpace: "pre-line" }, children: _jsx(Typography, { variant: "tooltipTitle", children: t("ID_TOOTH_NO_0", { 0: index + 1 }) + "\n" }) }));
|
|
38
|
+
};
|
|
39
|
+
export const getToothIntactRatio = (setting) => {
|
|
40
|
+
if (!setting)
|
|
41
|
+
return 1;
|
|
42
|
+
const { length, maxLength } = setting;
|
|
43
|
+
const ratio = Math.min(length / maxLength, 1);
|
|
44
|
+
return ratio;
|
|
45
|
+
};
|
|
46
|
+
export const getToothCriticalRatio = (setting) => {
|
|
47
|
+
if (!setting)
|
|
48
|
+
return 0;
|
|
49
|
+
const { minLength, maxLength } = setting;
|
|
50
|
+
const ratio = Math.max(minLength / maxLength, 0);
|
|
51
|
+
return ratio;
|
|
52
|
+
};
|
|
53
|
+
export const renderCriticalLine = (toothSettings) => {
|
|
54
|
+
const firstSetting = toothSettings?.[0];
|
|
55
|
+
if (!firstSetting) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const { minLength, maxLength } = firstSetting;
|
|
59
|
+
const ratio = (minLength / maxLength) * 100;
|
|
60
|
+
return (_jsx("div", { className: classes.criticalLine, style: { bottom: `${ratio}%` } }));
|
|
61
|
+
};
|
|
62
|
+
const convertAndRound = (value, unit) => convertAndRoundLength(value, {
|
|
63
|
+
from: SOURCE_UNIT,
|
|
64
|
+
to: unit,
|
|
65
|
+
decimalPlaces: DECIMAL_PLACES,
|
|
66
|
+
});
|