@selfdecode/sd-component-library 4.0.144 → 4.0.146
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/components/links/link/interfaces.d.ts +1 -1
- package/lib/sd-component-library101.js +1 -1
- package/lib/sd-component-library102.js +2 -2
- package/lib/sd-component-library104.js +2 -2
- package/lib/sd-component-library106.js +2 -2
- package/lib/sd-component-library112.js +1 -1
- package/lib/sd-component-library118.js +1 -1
- package/lib/sd-component-library126.js +1 -1
- package/lib/sd-component-library127.js +1 -1
- package/lib/sd-component-library129.js +1 -1
- package/lib/sd-component-library167.js +1 -1
- package/lib/sd-component-library172.js +1 -1
- package/lib/sd-component-library197.js +3 -3
- package/lib/sd-component-library201.js +2 -3
- package/lib/sd-component-library201.js.map +1 -1
- package/lib/sd-component-library202.js +30 -2
- package/lib/sd-component-library202.js.map +1 -1
- package/lib/sd-component-library203.js +590 -21
- package/lib/sd-component-library203.js.map +1 -1
- package/lib/sd-component-library204.js +3 -599
- package/lib/sd-component-library204.js.map +1 -1
- package/lib/sd-component-library208.js +19 -62
- package/lib/sd-component-library208.js.map +1 -1
- package/lib/sd-component-library209.js +3 -23
- package/lib/sd-component-library209.js.map +1 -1
- package/lib/sd-component-library210.js +3 -40
- package/lib/sd-component-library210.js.map +1 -1
- package/lib/sd-component-library211.js +62 -127
- package/lib/sd-component-library211.js.map +1 -1
- package/lib/sd-component-library212.js +23 -13
- package/lib/sd-component-library212.js.map +1 -1
- package/lib/sd-component-library213.js +40 -14
- package/lib/sd-component-library213.js.map +1 -1
- package/lib/sd-component-library214.js +129 -3
- package/lib/sd-component-library214.js.map +1 -1
- package/lib/sd-component-library215.js +13 -3
- package/lib/sd-component-library215.js.map +1 -1
- package/lib/sd-component-library216.js +12 -63
- package/lib/sd-component-library216.js.map +1 -1
- package/lib/sd-component-library217.js +2 -2
- package/lib/sd-component-library217.js.map +1 -1
- package/lib/sd-component-library218.js +2 -2
- package/lib/sd-component-library218.js.map +1 -1
- package/lib/sd-component-library219.js +3 -46
- package/lib/sd-component-library219.js.map +1 -1
- package/lib/sd-component-library221.js +61 -13
- package/lib/sd-component-library221.js.map +1 -1
- package/lib/sd-component-library222.js +3 -21
- package/lib/sd-component-library222.js.map +1 -1
- package/lib/sd-component-library223.js +46 -3
- package/lib/sd-component-library223.js.map +1 -1
- package/lib/sd-component-library224.js +17 -3
- package/lib/sd-component-library224.js.map +1 -1
- package/lib/sd-component-library225.js +26 -3
- package/lib/sd-component-library225.js.map +1 -1
- package/lib/sd-component-library226.js +3 -31
- package/lib/sd-component-library226.js.map +1 -1
- package/lib/sd-component-library227.js +31 -19
- package/lib/sd-component-library227.js.map +1 -1
- package/lib/sd-component-library228.js +19 -20
- package/lib/sd-component-library228.js.map +1 -1
- package/lib/sd-component-library229.js +20 -28
- package/lib/sd-component-library229.js.map +1 -1
- package/lib/sd-component-library230.js +27 -32
- package/lib/sd-component-library230.js.map +1 -1
- package/lib/sd-component-library231.js +32 -128
- package/lib/sd-component-library231.js.map +1 -1
- package/lib/sd-component-library232.js +3 -43
- package/lib/sd-component-library232.js.map +1 -1
- package/lib/sd-component-library233.js +128 -46
- package/lib/sd-component-library233.js.map +1 -1
- package/lib/sd-component-library234.js +42 -7
- package/lib/sd-component-library234.js.map +1 -1
- package/lib/sd-component-library235.js +47 -3
- package/lib/sd-component-library235.js.map +1 -1
- package/lib/sd-component-library236.js +8 -21
- package/lib/sd-component-library236.js.map +1 -1
- package/lib/sd-component-library237.js +58 -103
- package/lib/sd-component-library237.js.map +1 -1
- package/lib/sd-component-library238.js +37 -41
- package/lib/sd-component-library238.js.map +1 -1
- package/lib/sd-component-library239.js +12 -23
- package/lib/sd-component-library239.js.map +1 -1
- package/lib/sd-component-library240.js +21 -53
- package/lib/sd-component-library240.js.map +1 -1
- package/lib/sd-component-library241.js +103 -58
- package/lib/sd-component-library241.js.map +1 -1
- package/lib/sd-component-library242.js +41 -37
- package/lib/sd-component-library242.js.map +1 -1
- package/lib/sd-component-library243.js +23 -12
- package/lib/sd-component-library243.js.map +1 -1
- package/lib/sd-component-library244.js +52 -47
- package/lib/sd-component-library244.js.map +1 -1
- package/lib/sd-component-library245.js +46 -39
- package/lib/sd-component-library245.js.map +1 -1
- package/lib/sd-component-library246.js +74 -26
- package/lib/sd-component-library246.js.map +1 -1
- package/lib/sd-component-library249.js +2 -75
- package/lib/sd-component-library249.js.map +1 -1
- package/lib/sd-component-library250.js +41 -2
- package/lib/sd-component-library250.js.map +1 -1
- package/lib/sd-component-library251.js +26 -324
- package/lib/sd-component-library251.js.map +1 -1
- package/lib/sd-component-library252.js +325 -5
- package/lib/sd-component-library252.js.map +1 -1
- package/lib/sd-component-library253.js +5 -26
- package/lib/sd-component-library253.js.map +1 -1
- package/lib/sd-component-library254.js +25 -21
- package/lib/sd-component-library254.js.map +1 -1
- package/lib/sd-component-library256.js +24 -22
- package/lib/sd-component-library256.js.map +1 -1
- package/lib/sd-component-library258.js +21 -25
- package/lib/sd-component-library258.js.map +1 -1
- package/lib/sd-component-library259.js +22 -24
- package/lib/sd-component-library259.js.map +1 -1
- package/lib/sd-component-library262.js +1 -1
- package/lib/sd-component-library279.js +70 -10
- package/lib/sd-component-library279.js.map +1 -1
- package/lib/sd-component-library280.js +101 -69
- package/lib/sd-component-library280.js.map +1 -1
- package/lib/sd-component-library281.js +95 -91
- package/lib/sd-component-library281.js.map +1 -1
- package/lib/sd-component-library282.js +10 -106
- package/lib/sd-component-library282.js.map +1 -1
- package/lib/sd-component-library286.js +4 -4
- package/lib/sd-component-library290.js +58 -2
- package/lib/sd-component-library290.js.map +1 -1
- package/lib/sd-component-library291.js +2 -8
- package/lib/sd-component-library291.js.map +1 -1
- package/lib/sd-component-library292.js +7 -327
- package/lib/sd-component-library292.js.map +1 -1
- package/lib/sd-component-library293.js +325 -48
- package/lib/sd-component-library293.js.map +1 -1
- package/lib/sd-component-library294.js +49 -56
- package/lib/sd-component-library294.js.map +1 -1
- package/lib/sd-component-library296.js +1 -1
- package/lib/sd-component-library297.js +2 -2
- package/lib/sd-component-library298.js +23 -33
- package/lib/sd-component-library298.js.map +1 -1
- package/lib/sd-component-library299.js +33 -23
- package/lib/sd-component-library299.js.map +1 -1
- package/lib/sd-component-library300.js +9 -5
- package/lib/sd-component-library300.js.map +1 -1
- package/lib/sd-component-library301.js +5 -4
- package/lib/sd-component-library301.js.map +1 -1
- package/lib/sd-component-library302.js +3 -8
- package/lib/sd-component-library302.js.map +1 -1
- package/lib/sd-component-library303.js +19 -5
- package/lib/sd-component-library303.js.map +1 -1
- package/lib/sd-component-library304.js +3 -4
- package/lib/sd-component-library304.js.map +1 -1
- package/lib/sd-component-library305.js +5 -19
- package/lib/sd-component-library305.js.map +1 -1
- package/lib/sd-component-library306.js +4 -3
- package/lib/sd-component-library306.js.map +1 -1
- package/lib/sd-component-library315.js +1 -1
- package/lib/sd-component-library51.js +3 -3
- package/lib/sd-component-library52.js +2 -2
- package/lib/sd-component-library53.js +2 -2
- package/lib/sd-component-library6.js +1 -1
- package/lib/sd-component-library60.js +1 -1
- package/lib/sd-component-library62.js +3 -3
- package/lib/sd-component-library63.js +1 -1
- package/lib/sd-component-library64.js +2 -2
- package/lib/sd-component-library65.js +1 -1
- package/lib/sd-component-library7.js +1 -1
- package/lib/sd-component-library70.js +2 -2
- package/lib/sd-component-library72.js +3 -3
- package/lib/sd-component-library74.js +1 -1
- package/lib/sd-component-library75.js +3 -3
- package/lib/sd-component-library76.js +1 -1
- package/lib/sd-component-library77.js +1 -1
- package/lib/sd-component-library79.js +1 -1
- package/lib/sd-component-library80.js +1 -1
- package/lib/sd-component-library81.js +1 -1
- package/lib/sd-component-library81.js.map +1 -1
- package/lib/sd-component-library85.js +1 -1
- package/lib/sd-component-library86.js +6 -6
- package/lib/sd-component-library87.js +2 -2
- package/lib/sd-component-library88.js +1 -1
- package/lib/sd-component-library89.js +5 -5
- package/lib/sd-component-library90.js +1 -1
- package/lib/sd-component-library92.js +6 -6
- package/lib/sd-component-library93.js +1 -1
- package/lib/sd-component-library94.js +7 -7
- package/lib/sd-component-library95.js +1 -1
- package/lib/sd-component-library98.js +2 -2
- package/lib/sd-component-library99.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library235.js","sources":["../src/components/meters/
|
|
1
|
+
{"version":3,"file":"sd-component-library235.js","sources":["../src/components/meters/outline-meter/partials/outline-meter-needle/outline-meter-needle.tsx"],"sourcesContent":["import React from \"react\";\n\nimport {\n degToRad,\n getCoordinateForArc,\n getInnerX,\n getInnerY,\n isValueInRange,\n} from \"../../utils\";\nimport { BaseNeedle } from \"../base-needle\";\nimport { OutlineMeterNeedleProps as Props } from \"./interfaces\";\n\nexport const OutlineMeterNeedle: React.FC<Props> = (props) => {\n const {\n diameter,\n value,\n arc,\n ranges,\n useSegmentedBehavior,\n innerCircleRadius,\n innerCircleStrokeWidth,\n distanceFromRange,\n needleWidth,\n needleColor,\n distanceBetweenRanges,\n gaugeWidth,\n } = props;\n\n const matchingRange = ranges.find(({ start, end, bounds }) =>\n isValueInRange(value, start, end, bounds)\n );\n\n if (!matchingRange) return null;\n\n const radius = diameter / 2;\n\n const arcStart = (360 - arc) / 2;\n const arcForRanges = arc - (ranges.length - 1) * distanceBetweenRanges;\n const { start, end, color } = matchingRange;\n const matchingRangeIndex = ranges.findIndex((r) => r === matchingRange);\n const rangeArc = arcForRanges * (end - start);\n\n const rangeArcStart =\n arcStart +\n distanceBetweenRanges * matchingRangeIndex +\n arcForRanges * start;\n\n const valueAlpha = useSegmentedBehavior\n ? rangeArcStart + rangeArc / 2\n : rangeArcStart + ((value - start) / (end - start)) * rangeArc;\n const { x: valueX, y: valueY } = getCoordinateForArc(radius, valueAlpha);\n\n const needleTipX = getInnerX(\n valueX,\n degToRad(valueAlpha),\n distanceFromRange + gaugeWidth + needleWidth / 2\n );\n const needleTipY = getInnerY(\n valueY,\n degToRad(valueAlpha),\n distanceFromRange + gaugeWidth + needleWidth / 2\n );\n\n const dx = (needleWidth / 2) * Math.cos(degToRad(valueAlpha));\n const dy = (needleWidth / 2) * Math.sin(degToRad(valueAlpha));\n\n return (\n <BaseNeedle\n dx={dx}\n dy={dy}\n color={needleColor || color}\n radius={radius}\n tipX={needleTipX}\n tipY={needleTipY}\n innerCircleStrokeWidth={innerCircleStrokeWidth}\n innerCircleRadius={innerCircleRadius}\n needleWidth={needleWidth}\n />\n );\n};\n"],"names":["OutlineMeterNeedle","props","diameter","value","arc","ranges","useSegmentedBehavior","innerCircleRadius","innerCircleStrokeWidth","distanceFromRange","needleWidth","needleColor","distanceBetweenRanges","gaugeWidth","matchingRange","start","end","bounds","isValueInRange","radius","arcStart","arcForRanges","color","matchingRangeIndex","r","rangeArc","rangeArcStart","valueAlpha","valueX","valueY","getCoordinateForArc","needleTipX","getInnerX","degToRad","needleTipY","getInnerY","dx","dy","jsx","BaseNeedle"],"mappings":";;;AAYa,MAAAA,IAAsC,CAACC,MAAU;AACtD,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,QAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,YAAAC;AAAA,EACE,IAAAZ,GAEEa,IAAgBT,EAAO;AAAA,IAAK,CAAC,EAAE,OAAAU,GAAO,KAAAC,GAAK,QAAAC,QAC/CC,EAAef,GAAOY,GAAOC,GAAKC,CAAM;AAAA,EAAA;AAG1C,MAAI,CAACH;AAAsB,WAAA;AAE3B,QAAMK,IAASjB,IAAW,GAEpBkB,KAAY,MAAMhB,KAAO,GACzBiB,IAAejB,KAAOC,EAAO,SAAS,KAAKO,GAC3C,EAAE,OAAAG,GAAO,KAAAC,GAAK,OAAAM,EAAA,IAAUR,GACxBS,IAAqBlB,EAAO,UAAU,CAACmB,MAAMA,MAAMV,CAAa,GAChEW,IAAWJ,KAAgBL,IAAMD,IAEjCW,IACJN,IACAR,IAAwBW,IACxBF,IAAeN,GAEXY,IAAarB,IACfoB,IAAgBD,IAAW,IAC3BC,KAAkBvB,IAAQY,MAAUC,IAAMD,KAAUU,GAClD,EAAE,GAAGG,GAAQ,GAAGC,MAAWC,EAAoBX,GAAQQ,CAAU,GAEjEI,IAAaC;AAAA,IACjBJ;AAAA,IACAK,EAASN,CAAU;AAAA,IACnBlB,IAAoBI,IAAaH,IAAc;AAAA,EAAA,GAE3CwB,IAAaC;AAAA,IACjBN;AAAA,IACAI,EAASN,CAAU;AAAA,IACnBlB,IAAoBI,IAAaH,IAAc;AAAA,EAAA,GAG3C0B,IAAM1B,IAAc,IAAK,KAAK,IAAIuB,EAASN,CAAU,CAAC,GACtDU,IAAM3B,IAAc,IAAK,KAAK,IAAIuB,EAASN,CAAU,CAAC;AAG1D,SAAAW,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,IAAAH;AAAA,MACA,IAAAC;AAAA,MACA,OAAO1B,KAAeW;AAAA,MACtB,QAAAH;AAAA,MACA,MAAMY;AAAA,MACN,MAAMG;AAAA,MACN,wBAAA1B;AAAA,MACA,mBAAAD;AAAA,MACA,aAAAG;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return e;
|
|
9
|
-
if (n && e) {
|
|
10
|
-
const s = a(n), r = a(e), c = s.map((B, f) => Math.round(B * (1 - t) + r[f] * t));
|
|
11
|
-
return c ? u(c[0], c[1], c[2]) : "";
|
|
12
|
-
}
|
|
13
|
-
return "";
|
|
14
|
-
}, u = (t, n, e) => "#" + (16777216 + (t << 16) + (n << 8) + e).toString(16).slice(1), a = (t) => {
|
|
15
|
-
const n = t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
16
|
-
return n ? n.slice(1).map((e) => parseInt(e, 16)) : null;
|
|
17
|
-
}, h = (t, n, e) => Math.floor(t * n) === (e === "left" ? 0 : e === "right" ? n - 1 : 1), _ = (t) => t === "left" ? "right" : t === "top" ? "top" : "left";
|
|
1
|
+
import { j as m } from "./sd-component-library197.js";
|
|
2
|
+
import { isValueInRange as x } from "./sd-component-library91.js";
|
|
3
|
+
import { BaseMeterLabelBox as u } from "./sd-component-library244.js";
|
|
4
|
+
const g = (t) => {
|
|
5
|
+
const { value: o, idx: e, totalRanges: n, start: s, end: r, bounds: a } = t, i = x(o, s, r, a), l = e === 0 ? "left" : e === n - 1 ? "right" : "top";
|
|
6
|
+
return /* @__PURE__ */ m.jsx(u, { isInRange: i, position: l, ...t });
|
|
7
|
+
};
|
|
18
8
|
export {
|
|
19
|
-
|
|
20
|
-
I as getFractionColor,
|
|
21
|
-
h as isLabelActive,
|
|
22
|
-
T as mapAdjacent
|
|
9
|
+
g as OutlineMeterLabelBox
|
|
23
10
|
};
|
|
24
11
|
//# sourceMappingURL=sd-component-library236.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library236.js","sources":["../src/components/meters/
|
|
1
|
+
{"version":3,"file":"sd-component-library236.js","sources":["../src/components/meters/outline-meter/partials/outline-meter-label-box/outline-meter-label-box.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { isValueInRange } from \"../../utils\";\nimport { BaseMeterLabelBox } from \"../base-meter-label-box\";\nimport { OutlineMeterLabelBoxProps as Props } from \"./interfaces\";\n\nexport const OutlineMeterLabelBox: React.FC<Props> = (props) => {\n const { value, idx, totalRanges, start, end, bounds } = props;\n\n const isInRange = isValueInRange(value, start, end, bounds);\n const position =\n idx === 0 ? \"left\" : idx === totalRanges - 1 ? \"right\" : \"top\";\n\n return (\n <BaseMeterLabelBox isInRange={isInRange} position={position} {...props} />\n );\n};\n"],"names":["OutlineMeterLabelBox","props","value","idx","totalRanges","start","end","bounds","isInRange","isValueInRange","position","jsx","BaseMeterLabelBox"],"mappings":";;;AAMa,MAAAA,IAAwC,CAACC,MAAU;AAC9D,QAAM,EAAE,OAAAC,GAAO,KAAAC,GAAK,aAAAC,GAAa,OAAAC,GAAO,KAAAC,GAAK,QAAAC,EAAW,IAAAN,GAElDO,IAAYC,EAAeP,GAAOG,GAAOC,GAAKC,CAAM,GACpDG,IACJP,MAAQ,IAAI,SAASA,MAAQC,IAAc,IAAI,UAAU;AAE3D,SACGO,gBAAAA,EAAAA,IAAAC,GAAA,EAAkB,WAAAJ,GAAsB,UAAAE,GAAqB,GAAGT,EAAO,CAAA;AAE5E;"}
|
|
@@ -1,112 +1,67 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { getCoordinateForArc as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { j as a } from "./sd-component-library197.js";
|
|
2
|
+
import { getCoordinateForArc as i } from "./sd-component-library91.js";
|
|
3
|
+
import { defaultTextBottomMargin as X } from "./sd-component-library226.js";
|
|
4
|
+
import { getRangeProperties as Y } from "./sd-component-library305.js";
|
|
5
|
+
import { BaseOutlineArc as b } from "./sd-component-library298.js";
|
|
6
|
+
import { DiscreteMeterLabelPointer as w } from "./sd-component-library306.js";
|
|
7
|
+
function z(s) {
|
|
6
8
|
const {
|
|
7
|
-
|
|
8
|
-
idx:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
color: n,
|
|
10
|
+
idx: c,
|
|
11
|
+
gaugeWidth: d,
|
|
12
|
+
diameter: g,
|
|
13
|
+
arc: m,
|
|
14
|
+
distanceBetweenRanges: l,
|
|
15
|
+
totalRanges: p,
|
|
16
|
+
showLabel: h,
|
|
17
|
+
label: o,
|
|
18
|
+
isMatchedRange: x,
|
|
19
|
+
pointerWidth: f,
|
|
20
|
+
pointerLength: A,
|
|
21
|
+
horizontal: u
|
|
22
|
+
} = s, t = g / 2, { rangeArcStart: r, rangeArcEnd: e } = Y(
|
|
23
|
+
m,
|
|
24
|
+
p,
|
|
25
|
+
l,
|
|
26
|
+
c
|
|
27
|
+
), { x: R, y: j } = i(
|
|
28
|
+
t,
|
|
29
|
+
r
|
|
30
|
+
), { x: B, y: E } = i(
|
|
31
|
+
t,
|
|
32
|
+
e
|
|
33
|
+
), M = (r + e) / 2;
|
|
34
|
+
return /* @__PURE__ */ a.jsxs("g", { children: [
|
|
35
|
+
/* @__PURE__ */ a.jsx(
|
|
36
|
+
b,
|
|
29
37
|
{
|
|
30
|
-
startX:
|
|
31
|
-
startY:
|
|
32
|
-
endX:
|
|
33
|
-
endY:
|
|
34
|
-
startAlpha:
|
|
35
|
-
endAlpha:
|
|
36
|
-
color:
|
|
37
|
-
radius:
|
|
38
|
-
width:
|
|
38
|
+
startX: R,
|
|
39
|
+
startY: j,
|
|
40
|
+
endX: B,
|
|
41
|
+
endY: E,
|
|
42
|
+
startAlpha: r,
|
|
43
|
+
endAlpha: e,
|
|
44
|
+
color: n,
|
|
45
|
+
radius: t,
|
|
46
|
+
width: d
|
|
39
47
|
}
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */ t.jsx("defs", { children: /* @__PURE__ */ t.jsxs(
|
|
44
|
-
"linearGradient",
|
|
48
|
+
),
|
|
49
|
+
h && o && !x && /* @__PURE__ */ a.jsx(
|
|
50
|
+
w,
|
|
45
51
|
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
y1: 1,
|
|
55
|
-
x2: 0,
|
|
56
|
-
y2: 0
|
|
57
|
-
},
|
|
58
|
-
children: [
|
|
59
|
-
/* @__PURE__ */ t.jsx("stop", { stopColor: f, offset: "0%" }),
|
|
60
|
-
/* @__PURE__ */ t.jsx("stop", { stopColor: p, offset: "100%" })
|
|
61
|
-
]
|
|
52
|
+
alpha: M,
|
|
53
|
+
pointerLength: A,
|
|
54
|
+
pointerWidth: f,
|
|
55
|
+
radius: t,
|
|
56
|
+
color: n,
|
|
57
|
+
textBottomMargin: X,
|
|
58
|
+
label: o,
|
|
59
|
+
horizontal: u
|
|
62
60
|
}
|
|
63
|
-
)
|
|
64
|
-
/* @__PURE__ */ t.jsxs("g", { children: [
|
|
65
|
-
/* @__PURE__ */ t.jsx(
|
|
66
|
-
X,
|
|
67
|
-
{
|
|
68
|
-
startX: u,
|
|
69
|
-
startY: h,
|
|
70
|
-
endX: a,
|
|
71
|
-
endY: s,
|
|
72
|
-
startAlpha: g,
|
|
73
|
-
endAlpha: o,
|
|
74
|
-
color: `url(#value-gradient-${p})`,
|
|
75
|
-
radius: r,
|
|
76
|
-
width: e,
|
|
77
|
-
roundEnd: !1
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
/* @__PURE__ */ t.jsx(
|
|
81
|
-
X,
|
|
82
|
-
{
|
|
83
|
-
startX: a,
|
|
84
|
-
startY: s,
|
|
85
|
-
endX: m,
|
|
86
|
-
endY: y,
|
|
87
|
-
startAlpha: o,
|
|
88
|
-
endAlpha: j,
|
|
89
|
-
color: w,
|
|
90
|
-
radius: r,
|
|
91
|
-
width: e,
|
|
92
|
-
roundStart: !1
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ t.jsx(
|
|
96
|
-
"circle",
|
|
97
|
-
{
|
|
98
|
-
cx: (a + F) / 2,
|
|
99
|
-
cy: (s + B) / 2,
|
|
100
|
-
r: C + W,
|
|
101
|
-
strokeWidth: C,
|
|
102
|
-
stroke: $ || p,
|
|
103
|
-
fill: "white"
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
] })
|
|
61
|
+
)
|
|
107
62
|
] });
|
|
108
|
-
}
|
|
63
|
+
}
|
|
109
64
|
export {
|
|
110
|
-
|
|
65
|
+
z as DiscreteRange
|
|
111
66
|
};
|
|
112
67
|
//# sourceMappingURL=sd-component-library237.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library237.js","sources":["../src/components/meters/
|
|
1
|
+
{"version":3,"file":"sd-component-library237.js","sources":["../src/components/meters/multi-option-discrete-outline-meter/partials/discrete-range/discrete-range.tsx"],"sourcesContent":["import React, { PropsWithChildren } from \"react\";\n\nimport { BaseOutlineArc } from \"../../../outline-meter/partials/base-outline-arc\";\nimport { getCoordinateForArc } from \"../../../outline-meter/utils\";\nimport { defaultTextBottomMargin } from \"../../constants\";\nimport { getRangeProperties } from \"../../utils\";\nimport { DiscreteMeterLabelPointer } from \"../discrete-meter-label-pointer\";\nimport { DiscreteRangeProps as Props } from \"./interfaces\";\n\nexport function DiscreteRange<T>(props: PropsWithChildren<Props<T>>) {\n const {\n color,\n idx,\n gaugeWidth,\n diameter,\n arc,\n distanceBetweenRanges,\n totalRanges,\n showLabel,\n label,\n isMatchedRange,\n pointerWidth,\n pointerLength,\n horizontal,\n } = props;\n\n const radius = diameter / 2;\n\n const { rangeArcStart, rangeArcEnd } = getRangeProperties(\n arc,\n totalRanges,\n distanceBetweenRanges,\n idx\n );\n\n const { x: rangeStartX, y: rangeStartY } = getCoordinateForArc(\n radius,\n rangeArcStart\n );\n const { x: rangeEndX, y: rangeEndY } = getCoordinateForArc(\n radius,\n rangeArcEnd\n );\n\n const middleArcAlpha = (rangeArcStart + rangeArcEnd) / 2;\n\n return (\n <g>\n <BaseOutlineArc\n startX={rangeStartX}\n startY={rangeStartY}\n endX={rangeEndX}\n endY={rangeEndY}\n startAlpha={rangeArcStart}\n endAlpha={rangeArcEnd}\n color={color}\n radius={radius}\n width={gaugeWidth}\n />\n\n {showLabel && label && !isMatchedRange && (\n <DiscreteMeterLabelPointer\n alpha={middleArcAlpha}\n pointerLength={pointerLength}\n pointerWidth={pointerWidth}\n radius={radius}\n color={color}\n textBottomMargin={defaultTextBottomMargin}\n label={label}\n horizontal={horizontal}\n />\n )}\n </g>\n );\n}\n"],"names":["DiscreteRange","props","color","idx","gaugeWidth","diameter","arc","distanceBetweenRanges","totalRanges","showLabel","label","isMatchedRange","pointerWidth","pointerLength","horizontal","radius","rangeArcStart","rangeArcEnd","getRangeProperties","rangeStartX","rangeStartY","getCoordinateForArc","rangeEndX","rangeEndY","middleArcAlpha","jsx","BaseOutlineArc","DiscreteMeterLabelPointer","defaultTextBottomMargin"],"mappings":";;;;;;AASO,SAASA,EAAiBC,GAAoC;AAC7D,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,KAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,EACE,IAAAb,GAEEc,IAASV,IAAW,GAEpB,EAAE,eAAAW,GAAe,aAAAC,EAAA,IAAgBC;AAAA,IACrCZ;AAAA,IACAE;AAAA,IACAD;AAAA,IACAJ;AAAA,EAAA,GAGI,EAAE,GAAGgB,GAAa,GAAGC,EAAgB,IAAAC;AAAA,IACzCN;AAAA,IACAC;AAAA,EAAA,GAEI,EAAE,GAAGM,GAAW,GAAGC,EAAc,IAAAF;AAAA,IACrCN;AAAA,IACAE;AAAA,EAAA,GAGIO,KAAkBR,IAAgBC,KAAe;AAEvD,gCACG,KACC,EAAA,UAAA;AAAA,IAAAQ,gBAAAA,EAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,QAAQP;AAAA,QACR,QAAQC;AAAA,QACR,MAAME;AAAA,QACN,MAAMC;AAAA,QACN,YAAYP;AAAA,QACZ,UAAUC;AAAA,QACV,OAAAf;AAAA,QACA,QAAAa;AAAA,QACA,OAAOX;AAAA,MAAA;AAAA,IACT;AAAA,IAECK,KAAaC,KAAS,CAACC,KACtBc,gBAAAA,EAAA;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,OAAOH;AAAA,QACP,eAAAX;AAAA,QACA,cAAAD;AAAA,QACA,QAAAG;AAAA,QACA,OAAAb;AAAA,QACA,kBAAkB0B;AAAA,QAClB,OAAAlB;AAAA,QACA,YAAAI;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { getInnerX as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const O = (R) => {
|
|
1
|
+
import { j as M } from "./sd-component-library197.js";
|
|
2
|
+
import { getInnerX as T, getInnerY as W, degToRad as r, getCoordinateForArc as y } from "./sd-component-library91.js";
|
|
3
|
+
import { BaseNeedle as B } from "./sd-component-library299.js";
|
|
4
|
+
function E(p) {
|
|
6
5
|
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
needleColor: u,
|
|
7
|
+
options: n,
|
|
8
|
+
value: h,
|
|
9
|
+
needleWidth: e,
|
|
10
|
+
innerCircleRadius: m,
|
|
11
|
+
innerCircleStrokeWidth: x,
|
|
12
|
+
diameter: R,
|
|
12
13
|
arc: a,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
m
|
|
20
|
-
), { x: j, y: F } = i(
|
|
21
|
-
s,
|
|
22
|
-
E
|
|
23
|
-
), o = m + (l - p) / (M - p) * a / r.length, { x: C, y: f } = i(s, o), G = k(
|
|
14
|
+
distanceBetweenRanges: c,
|
|
15
|
+
distanceFromRange: s,
|
|
16
|
+
gaugeWidth: i
|
|
17
|
+
} = p, o = n.findIndex(
|
|
18
|
+
(F) => h === F.value
|
|
19
|
+
), d = R / 2, f = (360 - a) / 2, l = a - (n.length - 1) * c, g = o / n.length, v = (o + 1) / n.length, A = l * (v - g), t = f + c * o + l * g + A / 2, { x: C, y: I } = y(d, t), S = T(
|
|
24
20
|
C,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
),
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
21
|
+
r(t),
|
|
22
|
+
s + i + e / 2
|
|
23
|
+
), X = W(
|
|
24
|
+
I,
|
|
25
|
+
r(t),
|
|
26
|
+
s + i + e / 2
|
|
27
|
+
), Y = e / 2 * Math.cos(r(t)), j = e / 2 * Math.sin(r(t));
|
|
28
|
+
return /* @__PURE__ */ M.jsx(
|
|
29
|
+
B,
|
|
34
30
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
dx: Y,
|
|
32
|
+
dy: j,
|
|
33
|
+
color: u,
|
|
34
|
+
radius: d,
|
|
35
|
+
tipX: S,
|
|
36
|
+
tipY: X,
|
|
37
|
+
innerCircleStrokeWidth: x,
|
|
38
|
+
innerCircleRadius: m,
|
|
39
|
+
needleWidth: e
|
|
44
40
|
}
|
|
45
41
|
);
|
|
46
|
-
}
|
|
42
|
+
}
|
|
47
43
|
export {
|
|
48
|
-
|
|
44
|
+
E as DiscreteMeterNeedle
|
|
49
45
|
};
|
|
50
46
|
//# sourceMappingURL=sd-component-library238.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library238.js","sources":["../src/components/meters/
|
|
1
|
+
{"version":3,"file":"sd-component-library238.js","sources":["../src/components/meters/multi-option-discrete-outline-meter/partials/discrete-meter-needle/discrete-meter-needle.tsx"],"sourcesContent":["import React, { PropsWithChildren } from \"react\";\n\nimport { BaseNeedle } from \"../../../outline-meter/partials/base-needle\";\nimport {\n degToRad,\n getCoordinateForArc,\n getInnerX,\n getInnerY,\n} from \"../../../outline-meter/utils\";\nimport { DiscreteMeterNeedleProps as Props } from \"./interfaces\";\n\nexport function DiscreteMeterNeedle<T>(props: PropsWithChildren<Props<T>>) {\n const {\n needleColor,\n options,\n value,\n needleWidth,\n innerCircleRadius,\n innerCircleStrokeWidth,\n diameter,\n arc,\n distanceBetweenRanges,\n distanceFromRange,\n gaugeWidth,\n } = props;\n\n const matchingRangeIndex = options.findIndex(\n (option) => value === option.value\n );\n\n const radius = diameter / 2;\n\n const arcStart = (360 - arc) / 2;\n const arcForRanges = arc - (options.length - 1) * distanceBetweenRanges;\n\n const start = matchingRangeIndex / options.length;\n const end = (matchingRangeIndex + 1) / options.length;\n\n const rangeArc = arcForRanges * (end - start);\n\n const rangeArcStart =\n arcStart +\n distanceBetweenRanges * matchingRangeIndex +\n arcForRanges * start;\n\n const valueAlpha = rangeArcStart + rangeArc / 2;\n const { x: valueX, y: valueY } = getCoordinateForArc(radius, valueAlpha);\n\n const needleTipX = getInnerX(\n valueX,\n degToRad(valueAlpha),\n distanceFromRange + gaugeWidth + needleWidth / 2\n );\n const needleTipY = getInnerY(\n valueY,\n degToRad(valueAlpha),\n distanceFromRange + gaugeWidth + needleWidth / 2\n );\n\n const dx = (needleWidth / 2) * Math.cos(degToRad(valueAlpha));\n const dy = (needleWidth / 2) * Math.sin(degToRad(valueAlpha));\n\n return (\n <BaseNeedle\n dx={dx}\n dy={dy}\n color={needleColor}\n radius={radius}\n tipX={needleTipX}\n tipY={needleTipY}\n innerCircleStrokeWidth={innerCircleStrokeWidth}\n innerCircleRadius={innerCircleRadius}\n needleWidth={needleWidth}\n />\n );\n}\n"],"names":["DiscreteMeterNeedle","props","needleColor","options","value","needleWidth","innerCircleRadius","innerCircleStrokeWidth","diameter","arc","distanceBetweenRanges","distanceFromRange","gaugeWidth","matchingRangeIndex","option","radius","arcStart","arcForRanges","start","end","rangeArc","valueAlpha","valueX","valueY","getCoordinateForArc","needleTipX","getInnerX","degToRad","needleTipY","getInnerY","dx","dy","jsx","BaseNeedle"],"mappings":";;;AAWO,SAASA,EAAuBC,GAAoC;AACnE,QAAA;AAAA,IACJ,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,KAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,EACE,IAAAX,GAEEY,IAAqBV,EAAQ;AAAA,IACjC,CAACW,MAAWV,MAAUU,EAAO;AAAA,EAAA,GAGzBC,IAASP,IAAW,GAEpBQ,KAAY,MAAMP,KAAO,GACzBQ,IAAeR,KAAON,EAAQ,SAAS,KAAKO,GAE5CQ,IAAQL,IAAqBV,EAAQ,QACrCgB,KAAON,IAAqB,KAAKV,EAAQ,QAEzCiB,IAAWH,KAAgBE,IAAMD,IAOjCG,IAJJL,IACAN,IAAwBG,IACxBI,IAAeC,IAEkBE,IAAW,GACxC,EAAE,GAAGE,GAAQ,GAAGC,MAAWC,EAAoBT,GAAQM,CAAU,GAEjEI,IAAaC;AAAA,IACjBJ;AAAA,IACAK,EAASN,CAAU;AAAA,IACnBV,IAAoBC,IAAaP,IAAc;AAAA,EAAA,GAE3CuB,IAAaC;AAAA,IACjBN;AAAA,IACAI,EAASN,CAAU;AAAA,IACnBV,IAAoBC,IAAaP,IAAc;AAAA,EAAA,GAG3CyB,IAAMzB,IAAc,IAAK,KAAK,IAAIsB,EAASN,CAAU,CAAC,GACtDU,IAAM1B,IAAc,IAAK,KAAK,IAAIsB,EAASN,CAAU,CAAC;AAG1D,SAAAW,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,IAAAH;AAAA,MACA,IAAAC;AAAA,MACA,OAAO7B;AAAA,MACP,QAAAa;AAAA,MACA,MAAMU;AAAA,MACN,MAAMG;AAAA,MACN,wBAAArB;AAAA,MACA,mBAAAD;AAAA,MACA,aAAAD;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
startX: n || t / 2,
|
|
13
|
-
startY: e || 0,
|
|
14
|
-
endX: t / 2,
|
|
15
|
-
endY: -r
|
|
16
|
-
} : {
|
|
17
|
-
startX: n || t,
|
|
18
|
-
startY: e || t / 2 - 0.5,
|
|
19
|
-
endX: t + r,
|
|
20
|
-
endY: t / 2 - 0.5
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ p.jsx("path", { d: `M${d},${i} L${X},${Y}`, stroke: "#CCD0DB" });
|
|
1
|
+
import { j as g } from "./sd-component-library197.js";
|
|
2
|
+
import { getRangeProperties as d } from "./sd-component-library305.js";
|
|
3
|
+
import { MatchedRangeLabelBox as x } from "./sd-component-library296.js";
|
|
4
|
+
const h = (e) => {
|
|
5
|
+
const { idx: t, totalRanges: a, distanceBetweenRanges: r, arc: n } = e, { rangeArcStart: o, rangeArcEnd: s } = d(
|
|
6
|
+
n,
|
|
7
|
+
a,
|
|
8
|
+
r,
|
|
9
|
+
t
|
|
10
|
+
), c = Math.round((o + s) / 2);
|
|
11
|
+
return /* @__PURE__ */ g.jsx(x, { ...e, alpha: c, round: !0 });
|
|
23
12
|
};
|
|
24
13
|
export {
|
|
25
|
-
|
|
14
|
+
h as MatchedRangeLabelBox
|
|
26
15
|
};
|
|
27
16
|
//# sourceMappingURL=sd-component-library239.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library239.js","sources":["../src/components/meters/outline-meter/partials/
|
|
1
|
+
{"version":3,"file":"sd-component-library239.js","sources":["../src/components/meters/multi-option-discrete-outline-meter/partials/matched-range-label-box/matched-range-label-box.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { MatchedRangeLabelBox as LabelBox } from \"../../../common-outline-meter-partials\";\nimport { getRangeProperties } from \"../../utils\";\nimport { MatchedRangeLabelBoxProps as Props } from \"./interfaces\";\n\nexport const MatchedRangeLabelBox: React.FC<Props> = (props) => {\n const { idx, totalRanges, distanceBetweenRanges, arc } = props;\n\n const { rangeArcStart, rangeArcEnd } = getRangeProperties(\n arc,\n totalRanges,\n distanceBetweenRanges,\n idx\n );\n\n const alpha = Math.round((rangeArcStart + rangeArcEnd) / 2);\n\n return <LabelBox {...props} alpha={alpha} round />;\n};\n"],"names":["MatchedRangeLabelBox","props","idx","totalRanges","distanceBetweenRanges","arc","rangeArcStart","rangeArcEnd","getRangeProperties","alpha","LabelBox"],"mappings":";;;AAMa,MAAAA,IAAwC,CAACC,MAAU;AAC9D,QAAM,EAAE,KAAAC,GAAK,aAAAC,GAAa,uBAAAC,GAAuB,KAAAC,MAAQJ,GAEnD,EAAE,eAAAK,GAAe,aAAAC,EAAA,IAAgBC;AAAA,IACrCH;AAAA,IACAF;AAAA,IACAC;AAAA,IACAF;AAAA,EAAA,GAGIO,IAAQ,KAAK,OAAOH,IAAgBC,KAAe,CAAC;AAE1D,+BAAQG,GAAU,EAAA,GAAGT,GAAO,OAAAQ,GAAc,OAAK,GAAC,CAAA;AAClD;"}
|
|
@@ -1,56 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const h = t === "right" ? `${r + p}px` : t === "top" ? `${r / 2}px` : void 0, m = t === "left" ? `${r + p}px` : void 0, f = t === "left" || t === "right" ? `${r / 2}px` : `${-p}px`;
|
|
19
|
-
return /* @__PURE__ */ s.jsx(l, { sx: { position: "absolute", left: h, top: f, right: m }, children: /* @__PURE__ */ s.jsx(
|
|
20
|
-
l,
|
|
21
|
-
{
|
|
22
|
-
sx: {
|
|
23
|
-
position: "relative",
|
|
24
|
-
top: `-${c}px`,
|
|
25
|
-
left: t === "top" ? "-50%" : void 0,
|
|
26
|
-
py: "7px",
|
|
27
|
-
px: e ? `${o}px` : "0",
|
|
28
|
-
borderColor: e ? n : "cl_lightGrey",
|
|
29
|
-
borderWidth: e ? "2px" : "1pt",
|
|
30
|
-
borderStyle: e ? "solid" : "none",
|
|
31
|
-
borderBottomStyle: !e && t === "top" ? "none" : "solid",
|
|
32
|
-
borderRadius: e ? `${o}px ${o}px ${t !== "left" ? `${o}px` : "0"} ${t !== "right" ? `${o}px` : "0"}` : "0",
|
|
33
|
-
bg: "cl_white",
|
|
34
|
-
"& > div": {
|
|
35
|
-
maxWidth: t === "top" ? void 0 : `${u}px`
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
ref: i,
|
|
39
|
-
children: /* @__PURE__ */ s.jsx(
|
|
40
|
-
v,
|
|
41
|
-
{
|
|
42
|
-
width: "max-content",
|
|
43
|
-
fontSizeWeight: [[12, "semi-bold"]],
|
|
44
|
-
color: e && n !== "#CCD0DB" ? n : "cl_darkGrey",
|
|
45
|
-
textTransform: "uppercase",
|
|
46
|
-
letterSpacing: "1.8px",
|
|
47
|
-
children: d
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
) });
|
|
52
|
-
};
|
|
1
|
+
const i = (t, n) => [t, n], T = function* (t = []) {
|
|
2
|
+
for (; t.length > 1; )
|
|
3
|
+
yield i(t[0], t[1]), t = t.slice(1);
|
|
4
|
+
}, I = (t, n, e) => {
|
|
5
|
+
if (n && !e)
|
|
6
|
+
return n;
|
|
7
|
+
if (!n && e)
|
|
8
|
+
return e;
|
|
9
|
+
if (n && e) {
|
|
10
|
+
const s = a(n), r = a(e), c = s.map((B, f) => Math.round(B * (1 - t) + r[f] * t));
|
|
11
|
+
return c ? u(c[0], c[1], c[2]) : "";
|
|
12
|
+
}
|
|
13
|
+
return "";
|
|
14
|
+
}, u = (t, n, e) => "#" + (16777216 + (t << 16) + (n << 8) + e).toString(16).slice(1), a = (t) => {
|
|
15
|
+
const n = t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
16
|
+
return n ? n.slice(1).map((e) => parseInt(e, 16)) : null;
|
|
17
|
+
}, h = (t, n, e) => Math.floor(t * n) === (e === "left" ? 0 : e === "right" ? n - 1 : 1), _ = (t) => t === "left" ? "right" : t === "top" ? "top" : "left";
|
|
53
18
|
export {
|
|
54
|
-
|
|
19
|
+
_ as flipPosition,
|
|
20
|
+
I as getFractionColor,
|
|
21
|
+
h as isLabelActive,
|
|
22
|
+
T as mapAdjacent
|
|
55
23
|
};
|
|
56
24
|
//# sourceMappingURL=sd-component-library240.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-component-library240.js","sources":["../src/components/meters/outline-meter/
|
|
1
|
+
{"version":3,"file":"sd-component-library240.js","sources":["../src/components/meters/gradient-outline-meter/utils.ts"],"sourcesContent":["import { OutlineMeterLabelPosition } from \"../outline-meter\";\n\nconst pair = <T>(a: T, b: T): [T, T] => [a, b];\n\n/**\n * Returns an array of mapped adjacent elements into pairs.\n */\nexport const mapAdjacent = function* <T>(iter: T[] = []) {\n while (iter.length > 1) {\n yield pair<T>(iter[0], iter[1]);\n iter = iter.slice(1);\n }\n};\n\n/**\n * @param fraction numerical value from 0 to 1.\n * @param lowColor initial color of the gradient.\n * @param topColor final color of the gradient.\n * @returns color of gradient at specified fraction point or empty string\n */\nexport const getFractionColor = (\n fraction: number,\n lowColor?: string,\n topColor?: string\n): string => {\n if (lowColor && !topColor) return lowColor;\n if (!lowColor && topColor) return topColor;\n if (lowColor && topColor) {\n const lowRGB = hexToRGB(lowColor);\n const topRGB = hexToRGB(topColor);\n const resultRGB = lowRGB!.map((component, i) => {\n return Math.round(component * (1 - fraction) + topRGB![i] * fraction);\n });\n return resultRGB ? rgbToHex(resultRGB[0], resultRGB[1], resultRGB[2]) : \"\";\n }\n return \"\";\n};\n\n/**\n * Converts rgb color representation into hex representation.\n * @param red component of color.\n * @param green component of color.\n * @param blue component of color.\n */\nconst rgbToHex = (red: number, green: number, blue: number): string => {\n const BITS_IN_BYTE = 8;\n return (\n \"#\" +\n (\n (1 << (3 * BITS_IN_BYTE)) +\n (red << (2 * BITS_IN_BYTE)) +\n (green << BITS_IN_BYTE) +\n blue\n )\n .toString(16)\n .slice(1)\n );\n};\n\n/**\n * Converts hex representation of color into rgb.\n * @param hex complete and correct representation of color\n */\nconst hexToRGB = (hex: string) => {\n const normal = hex.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);\n return normal ? normal.slice(1).map((e) => parseInt(e, 16)) : null;\n};\n\nexport const isLabelActive = (\n value: number,\n totalColors: number,\n position: OutlineMeterLabelPosition\n) =>\n Math.floor(value * totalColors) ===\n (position === \"left\" ? 0 : position === \"right\" ? totalColors - 1 : 1);\n\n/**\n * Mirrors entered position for outline meter label.\n */\nexport const flipPosition = (position: OutlineMeterLabelPosition) =>\n position === \"left\" ? \"right\" : position === \"top\" ? \"top\" : \"left\";\n"],"names":["pair","a","b","mapAdjacent","iter","getFractionColor","fraction","lowColor","topColor","lowRGB","hexToRGB","topRGB","resultRGB","component","i","rgbToHex","red","green","blue","hex","normal","isLabelActive","value","totalColors","position","flipPosition"],"mappings":"AAEA,MAAMA,IAAO,CAAIC,GAAMC,MAAiB,CAACD,GAAGC,CAAC,GAKhCC,IAAc,WAAcC,IAAY,IAAI;AAChD,SAAAA,EAAK,SAAS;AACnB,UAAMJ,EAAQI,EAAK,CAAC,GAAGA,EAAK,CAAC,CAAC,GACvBA,IAAAA,EAAK,MAAM,CAAC;AAEvB,GAQaC,IAAmB,CAC9BC,GACAC,GACAC,MACW;AACX,MAAID,KAAY,CAACC;AAAiB,WAAAD;AAClC,MAAI,CAACA,KAAYC;AAAiB,WAAAA;AAClC,MAAID,KAAYC,GAAU;AAClB,UAAAC,IAASC,EAASH,CAAQ,GAC1BI,IAASD,EAASF,CAAQ,GAC1BI,IAAYH,EAAQ,IAAI,CAACI,GAAWC,MACjC,KAAK,MAAMD,KAAa,IAAIP,KAAYK,EAAQG,CAAC,IAAIR,CAAQ,CACrE;AACM,WAAAM,IAAYG,EAASH,EAAU,CAAC,GAAGA,EAAU,CAAC,GAAGA,EAAU,CAAC,CAAC,IAAI;AAAA,EAC1E;AACO,SAAA;AACT,GAQMG,IAAW,CAACC,GAAaC,GAAeC,MAG1C,OAEG,YACAF,KAAQ,OACRC,KAAS,KACVC,GAEC,SAAS,EAAE,EACX,MAAM,CAAC,GAQRR,IAAW,CAACS,MAAgB;AAC1B,QAAAC,IAASD,EAAI,MAAM,6CAA6C;AACtE,SAAOC,IAASA,EAAO,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI;AAChE,GAEaC,IAAgB,CAC3BC,GACAC,GACAC,MAEA,KAAK,MAAMF,IAAQC,CAAW,OAC7BC,MAAa,SAAS,IAAIA,MAAa,UAAUD,IAAc,IAAI,IAKzDE,IAAe,CAACD,MAC3BA,MAAa,SAAS,UAAUA,MAAa,QAAQ,QAAQ;"}
|