@selfdecode/sd-component-library 4.0.138 → 4.0.140

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.
Files changed (230) hide show
  1. package/lib/components/buttons/button/interfaces.d.ts +1 -0
  2. package/lib/sd-component-library100.js +2 -2
  3. package/lib/sd-component-library101.js +3 -3
  4. package/lib/sd-component-library102.js +2 -2
  5. package/lib/sd-component-library106.js +2 -2
  6. package/lib/sd-component-library112.js +1 -1
  7. package/lib/sd-component-library117.js +1 -1
  8. package/lib/sd-component-library118.js +2 -2
  9. package/lib/sd-component-library120.js +1 -1
  10. package/lib/sd-component-library121.js +1 -1
  11. package/lib/sd-component-library126.js +2 -2
  12. package/lib/sd-component-library127.js +2 -2
  13. package/lib/sd-component-library129.js +1 -1
  14. package/lib/sd-component-library130.js +15 -14
  15. package/lib/sd-component-library130.js.map +1 -1
  16. package/lib/sd-component-library133.js +3 -3
  17. package/lib/sd-component-library134.js +1 -1
  18. package/lib/sd-component-library136.js +2 -2
  19. package/lib/sd-component-library16.js +1 -1
  20. package/lib/sd-component-library167.js +1 -1
  21. package/lib/sd-component-library168.js +1 -1
  22. package/lib/sd-component-library171.js +1 -1
  23. package/lib/sd-component-library172.js +4 -4
  24. package/lib/sd-component-library202.js +1 -1
  25. package/lib/sd-component-library203.js +1 -1
  26. package/lib/sd-component-library204.js +26 -3
  27. package/lib/sd-component-library204.js.map +1 -1
  28. package/lib/sd-component-library205.js +3 -57
  29. package/lib/sd-component-library205.js.map +1 -1
  30. package/lib/sd-component-library206.js +17 -25
  31. package/lib/sd-component-library206.js.map +1 -1
  32. package/lib/sd-component-library207.js +21 -18
  33. package/lib/sd-component-library207.js.map +1 -1
  34. package/lib/sd-component-library208.js +3 -64
  35. package/lib/sd-component-library208.js.map +1 -1
  36. package/lib/sd-component-library209.js +3 -23
  37. package/lib/sd-component-library209.js.map +1 -1
  38. package/lib/sd-component-library210.js +55 -31
  39. package/lib/sd-component-library210.js.map +1 -1
  40. package/lib/sd-component-library211.js +21 -127
  41. package/lib/sd-component-library211.js.map +1 -1
  42. package/lib/sd-component-library212.js +57 -13
  43. package/lib/sd-component-library212.js.map +1 -1
  44. package/lib/sd-component-library213.js +40 -14
  45. package/lib/sd-component-library213.js.map +1 -1
  46. package/lib/sd-component-library214.js +129 -3
  47. package/lib/sd-component-library214.js.map +1 -1
  48. package/lib/sd-component-library215.js +13 -3
  49. package/lib/sd-component-library215.js.map +1 -1
  50. package/lib/sd-component-library216.js +3 -65
  51. package/lib/sd-component-library216.js.map +1 -1
  52. package/lib/sd-component-library217.js +52 -3
  53. package/lib/sd-component-library217.js.map +1 -1
  54. package/lib/sd-component-library218.js +14 -3
  55. package/lib/sd-component-library218.js.map +1 -1
  56. package/lib/sd-component-library219.js +3 -52
  57. package/lib/sd-component-library219.js.map +1 -1
  58. package/lib/sd-component-library220.js +3 -46
  59. package/lib/sd-component-library220.js.map +1 -1
  60. package/lib/sd-component-library221.js +46 -17
  61. package/lib/sd-component-library221.js.map +1 -1
  62. package/lib/sd-component-library222.js +64 -20
  63. package/lib/sd-component-library222.js.map +1 -1
  64. package/lib/sd-component-library223.js +2 -2
  65. package/lib/sd-component-library223.js.map +1 -1
  66. package/lib/sd-component-library224.js +17 -3
  67. package/lib/sd-component-library224.js.map +1 -1
  68. package/lib/sd-component-library225.js +3 -26
  69. package/lib/sd-component-library225.js.map +1 -1
  70. package/lib/sd-component-library226.js +31 -3
  71. package/lib/sd-component-library226.js.map +1 -1
  72. package/lib/sd-component-library227.js +19 -31
  73. package/lib/sd-component-library227.js.map +1 -1
  74. package/lib/sd-component-library228.js +20 -19
  75. package/lib/sd-component-library228.js.map +1 -1
  76. package/lib/sd-component-library229.js +28 -20
  77. package/lib/sd-component-library229.js.map +1 -1
  78. package/lib/sd-component-library230.js +32 -27
  79. package/lib/sd-component-library230.js.map +1 -1
  80. package/lib/sd-component-library231.js +3 -33
  81. package/lib/sd-component-library231.js.map +1 -1
  82. package/lib/sd-component-library232.js +129 -3
  83. package/lib/sd-component-library232.js.map +1 -1
  84. package/lib/sd-component-library233.js +43 -129
  85. package/lib/sd-component-library233.js.map +1 -1
  86. package/lib/sd-component-library234.js +45 -41
  87. package/lib/sd-component-library234.js.map +1 -1
  88. package/lib/sd-component-library235.js +7 -46
  89. package/lib/sd-component-library235.js.map +1 -1
  90. package/lib/sd-component-library236.js +64 -8
  91. package/lib/sd-component-library236.js.map +1 -1
  92. package/lib/sd-component-library237.js +41 -62
  93. package/lib/sd-component-library237.js.map +1 -1
  94. package/lib/sd-component-library238.js +13 -43
  95. package/lib/sd-component-library238.js.map +1 -1
  96. package/lib/sd-component-library239.js +47 -12
  97. package/lib/sd-component-library239.js.map +1 -1
  98. package/lib/sd-component-library24.js +88 -87
  99. package/lib/sd-component-library24.js.map +1 -1
  100. package/lib/sd-component-library240.js +75 -21
  101. package/lib/sd-component-library240.js.map +1 -1
  102. package/lib/sd-component-library241.js +35 -103
  103. package/lib/sd-component-library241.js.map +1 -1
  104. package/lib/sd-component-library242.js +27 -47
  105. package/lib/sd-component-library242.js.map +1 -1
  106. package/lib/sd-component-library243.js +21 -24
  107. package/lib/sd-component-library243.js.map +1 -1
  108. package/lib/sd-component-library244.js +103 -47
  109. package/lib/sd-component-library244.js.map +1 -1
  110. package/lib/sd-component-library245.js +45 -46
  111. package/lib/sd-component-library245.js.map +1 -1
  112. package/lib/sd-component-library246.js +23 -74
  113. package/lib/sd-component-library246.js.map +1 -1
  114. package/lib/sd-component-library247.js +52 -40
  115. package/lib/sd-component-library247.js.map +1 -1
  116. package/lib/sd-component-library248.js +21 -27
  117. package/lib/sd-component-library248.js.map +1 -1
  118. package/lib/sd-component-library249.js +19 -20
  119. package/lib/sd-component-library249.js.map +1 -1
  120. package/lib/sd-component-library250.js +2 -20
  121. package/lib/sd-component-library250.js.map +1 -1
  122. package/lib/sd-component-library251.js +325 -2
  123. package/lib/sd-component-library251.js.map +1 -1
  124. package/lib/sd-component-library252.js +5 -325
  125. package/lib/sd-component-library252.js.map +1 -1
  126. package/lib/sd-component-library253.js +26 -5
  127. package/lib/sd-component-library253.js.map +1 -1
  128. package/lib/sd-component-library258.js +127 -18
  129. package/lib/sd-component-library258.js.map +1 -1
  130. package/lib/sd-component-library259.js +26 -18
  131. package/lib/sd-component-library259.js.map +1 -1
  132. package/lib/sd-component-library260.js +51 -30
  133. package/lib/sd-component-library260.js.map +1 -1
  134. package/lib/sd-component-library261.js +62 -39
  135. package/lib/sd-component-library261.js.map +1 -1
  136. package/lib/sd-component-library262.js +62 -120
  137. package/lib/sd-component-library262.js.map +1 -1
  138. package/lib/sd-component-library263.js +9 -74
  139. package/lib/sd-component-library263.js.map +1 -1
  140. package/lib/sd-component-library264.js +47 -72
  141. package/lib/sd-component-library264.js.map +1 -1
  142. package/lib/sd-component-library265.js +85 -25
  143. package/lib/sd-component-library265.js.map +1 -1
  144. package/lib/sd-component-library266.js +90 -19
  145. package/lib/sd-component-library266.js.map +1 -1
  146. package/lib/sd-component-library267.js +25 -120
  147. package/lib/sd-component-library267.js.map +1 -1
  148. package/lib/sd-component-library268.js +16 -117
  149. package/lib/sd-component-library268.js.map +1 -1
  150. package/lib/sd-component-library269.js +125 -10
  151. package/lib/sd-component-library269.js.map +1 -1
  152. package/lib/sd-component-library270.js +9 -49
  153. package/lib/sd-component-library270.js.map +1 -1
  154. package/lib/sd-component-library271.js +49 -8
  155. package/lib/sd-component-library271.js.map +1 -1
  156. package/lib/sd-component-library272.js +117 -46
  157. package/lib/sd-component-library272.js.map +1 -1
  158. package/lib/sd-component-library273.js +2 -90
  159. package/lib/sd-component-library273.js.map +1 -1
  160. package/lib/sd-component-library274.js +2 -92
  161. package/lib/sd-component-library274.js.map +1 -1
  162. package/lib/sd-component-library275.js +25 -2
  163. package/lib/sd-component-library275.js.map +1 -1
  164. package/lib/sd-component-library276.js +22 -2
  165. package/lib/sd-component-library276.js.map +1 -1
  166. package/lib/sd-component-library279.js +10 -70
  167. package/lib/sd-component-library279.js.map +1 -1
  168. package/lib/sd-component-library280.js +69 -101
  169. package/lib/sd-component-library280.js.map +1 -1
  170. package/lib/sd-component-library281.js +91 -95
  171. package/lib/sd-component-library281.js.map +1 -1
  172. package/lib/sd-component-library282.js +106 -10
  173. package/lib/sd-component-library282.js.map +1 -1
  174. package/lib/sd-component-library286.js +4 -4
  175. package/lib/sd-component-library287.js +3 -2
  176. package/lib/sd-component-library287.js.map +1 -1
  177. package/lib/sd-component-library288.js +3 -8
  178. package/lib/sd-component-library288.js.map +1 -1
  179. package/lib/sd-component-library289.js +3 -328
  180. package/lib/sd-component-library289.js.map +1 -1
  181. package/lib/sd-component-library290.js +2 -51
  182. package/lib/sd-component-library290.js.map +1 -1
  183. package/lib/sd-component-library291.js +8 -3
  184. package/lib/sd-component-library291.js.map +1 -1
  185. package/lib/sd-component-library292.js +328 -3
  186. package/lib/sd-component-library292.js.map +1 -1
  187. package/lib/sd-component-library293.js +51 -3
  188. package/lib/sd-component-library293.js.map +1 -1
  189. package/lib/sd-component-library311.js +89 -47
  190. package/lib/sd-component-library311.js.map +1 -1
  191. package/lib/sd-component-library312.js +47 -89
  192. package/lib/sd-component-library312.js.map +1 -1
  193. package/lib/sd-component-library313.js +33 -23
  194. package/lib/sd-component-library313.js.map +1 -1
  195. package/lib/sd-component-library314.js +23 -33
  196. package/lib/sd-component-library314.js.map +1 -1
  197. package/lib/sd-component-library318.js +1 -1
  198. package/lib/sd-component-library48.js +1 -1
  199. package/lib/sd-component-library49.js +1 -1
  200. package/lib/sd-component-library51.js +3 -3
  201. package/lib/sd-component-library52.js +2 -2
  202. package/lib/sd-component-library53.js +2 -2
  203. package/lib/sd-component-library6.js +1 -1
  204. package/lib/sd-component-library60.js +1 -1
  205. package/lib/sd-component-library62.js +3 -3
  206. package/lib/sd-component-library63.js +1 -1
  207. package/lib/sd-component-library64.js +2 -2
  208. package/lib/sd-component-library65.js +1 -1
  209. package/lib/sd-component-library7.js +1 -1
  210. package/lib/sd-component-library70.js +2 -2
  211. package/lib/sd-component-library72.js +3 -3
  212. package/lib/sd-component-library74.js +2 -2
  213. package/lib/sd-component-library75.js +3 -3
  214. package/lib/sd-component-library76.js +1 -1
  215. package/lib/sd-component-library77.js +1 -1
  216. package/lib/sd-component-library79.js +1 -1
  217. package/lib/sd-component-library80.js +1 -1
  218. package/lib/sd-component-library85.js +1 -1
  219. package/lib/sd-component-library86.js +6 -6
  220. package/lib/sd-component-library87.js +2 -2
  221. package/lib/sd-component-library88.js +1 -1
  222. package/lib/sd-component-library89.js +5 -5
  223. package/lib/sd-component-library90.js +1 -1
  224. package/lib/sd-component-library92.js +6 -6
  225. package/lib/sd-component-library93.js +1 -1
  226. package/lib/sd-component-library94.js +7 -7
  227. package/lib/sd-component-library95.js +1 -1
  228. package/lib/sd-component-library98.js +2 -2
  229. package/lib/sd-component-library99.js +3 -3
  230. package/package.json +1 -1
@@ -1,11 +1,67 @@
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
- };
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-library225.js";
4
+ import { getRangeProperties as Y } from "./sd-component-library315.js";
5
+ import { BaseOutlineArc as b } from "./sd-component-library314.js";
6
+ import { DiscreteMeterLabelPointer as w } from "./sd-component-library316.js";
7
+ function z(s) {
8
+ const {
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,
37
+ {
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
47
+ }
48
+ ),
49
+ h && o && !x && /* @__PURE__ */ a.jsx(
50
+ w,
51
+ {
52
+ alpha: M,
53
+ pointerLength: A,
54
+ pointerWidth: f,
55
+ radius: t,
56
+ color: n,
57
+ textBottomMargin: X,
58
+ label: o,
59
+ horizontal: u
60
+ }
61
+ )
62
+ ] });
63
+ }
8
64
  export {
9
- g as OutlineMeterLabelBox
65
+ z as DiscreteRange
10
66
  };
11
67
  //# sourceMappingURL=sd-component-library236.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"sd-component-library236.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,67 +1,46 @@
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-library315.js";
5
- import { BaseOutlineArc as b } from "./sd-component-library313.js";
6
- import { DiscreteMeterLabelPointer as w } from "./sd-component-library316.js";
7
- function z(s) {
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-library313.js";
4
+ function E(p) {
8
5
  const {
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,
37
- {
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
47
- }
48
- ),
49
- h && o && !x && /* @__PURE__ */ a.jsx(
50
- w,
51
- {
52
- alpha: M,
53
- pointerLength: A,
54
- pointerWidth: f,
55
- radius: t,
56
- color: n,
57
- textBottomMargin: X,
58
- label: o,
59
- horizontal: u
60
- }
61
- )
62
- ] });
6
+ needleColor: u,
7
+ options: n,
8
+ value: h,
9
+ needleWidth: e,
10
+ innerCircleRadius: m,
11
+ innerCircleStrokeWidth: x,
12
+ diameter: R,
13
+ arc: a,
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(
20
+ C,
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,
30
+ {
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
40
+ }
41
+ );
63
42
  }
64
43
  export {
65
- z as DiscreteRange
44
+ E as DiscreteMeterNeedle
66
45
  };
67
46
  //# sourceMappingURL=sd-component-library237.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"sd-component-library237.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,46 +1,16 @@
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-library314.js";
4
- function E(p) {
5
- const {
6
- needleColor: u,
7
- options: n,
8
- value: h,
9
- needleWidth: e,
10
- innerCircleRadius: m,
11
- innerCircleStrokeWidth: x,
12
- diameter: R,
13
- arc: a,
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(
20
- C,
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,
30
- {
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
40
- }
41
- );
42
- }
1
+ import { j as g } from "./sd-component-library197.js";
2
+ import { getRangeProperties as d } from "./sd-component-library315.js";
3
+ import { MatchedRangeLabelBox as x } from "./sd-component-library311.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 });
12
+ };
43
13
  export {
44
- E as DiscreteMeterNeedle
14
+ h as MatchedRangeLabelBox
45
15
  };
46
16
  //# sourceMappingURL=sd-component-library238.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"sd-component-library238.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,16 +1,51 @@
1
- import { j as g } from "./sd-component-library197.js";
2
- import { getRangeProperties as d } from "./sd-component-library315.js";
3
- import { MatchedRangeLabelBox as x } from "./sd-component-library312.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 });
1
+ import { getCoordinateForArc as s } from "./sd-component-library91.js";
2
+ const v = (r) => {
3
+ const a = `Received ${r.map(
4
+ ({ start: e, end: t }) => `(${e},${t})`
5
+ )}`, n = (e) => console.error(e, a);
6
+ if (r.some(
7
+ ({ start: e, end: t }) => [e, t].some((o) => o < 0 || o > 1)
8
+ ))
9
+ return n("Segment values should be between 0 and 1"), !1;
10
+ if (r.reduce(
11
+ (e, { start: t }) => e + (t === 0 ? 1 : 0),
12
+ 0
13
+ ) !== 1)
14
+ return n("One segment should start from 0"), !1;
15
+ if (r.reduce((e, { end: t }) => e + (t === 1 ? 1 : 0), 0) !== 1)
16
+ return n("One segment should end by 1"), !1;
17
+ if (r.some(({ start: e, end: t }) => e >= t))
18
+ return n("Segment start should be smaller than end"), !1;
19
+ for (let e = 1; e < r.length; e++) {
20
+ const t = r[e];
21
+ if (r[e - 1].end !== t.start)
22
+ return n("Previous segment end should be equal to next segment start"), !1;
23
+ }
24
+ return !0;
25
+ }, x = ({ start: r, end: a }, n, e) => {
26
+ const t = n - e, o = Math.round(r * 360), c = Math.round(a * 360), d = c - o, { x: l, y: u } = s(n, o), { x: f, y: m } = s(
27
+ t,
28
+ o,
29
+ n
30
+ ), { x: h, y: i } = s(n, c), { x: g, y: S } = s(
31
+ t,
32
+ c,
33
+ n
34
+ );
35
+ return {
36
+ startX: l,
37
+ startY: u,
38
+ endX: h,
39
+ endY: i,
40
+ startInnerX: f,
41
+ startInnerY: m,
42
+ endInnerX: g,
43
+ endInnerY: S,
44
+ arc: d
45
+ };
12
46
  };
13
47
  export {
14
- h as MatchedRangeLabelBox
48
+ v as areSegmentsValid,
49
+ x as getSegmentCoordinates
15
50
  };
16
51
  //# sourceMappingURL=sd-component-library239.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"sd-component-library239.js","sources":["../src/components/meters/donut-diagram/utils.ts"],"sourcesContent":["import { getCoordinateForArc } from \"../outline-meter/utils\";\nimport { DonutSegment } from \"./interfaces\";\n\nexport const areSegmentsValid = (\n segments: Pick<DonutSegment, \"start\" | \"end\">[]\n): boolean => {\n const receivedSegments = `Received ${segments.map(\n ({ start, end }) => `(${start},${end})`\n )}`;\n const showError = (text: string) => console.error(text, receivedSegments);\n\n if (\n segments.some(({ start, end }) =>\n [start, end].some((point) => point < 0 || point > 1)\n )\n ) {\n showError(\"Segment values should be between 0 and 1\");\n return false;\n }\n\n if (\n segments.reduce<number>(\n (acc, { start }) => acc + (start === 0 ? 1 : 0),\n 0\n ) !== 1\n ) {\n showError(\"One segment should start from 0\");\n return false;\n }\n\n if (\n segments.reduce<number>((acc, { end }) => acc + (end === 1 ? 1 : 0), 0) !==\n 1\n ) {\n showError(\"One segment should end by 1\");\n return false;\n }\n\n if (segments.some(({ start, end }) => start >= end)) {\n showError(\"Segment start should be smaller than end\");\n return false;\n }\n\n for (let i = 1; i < segments.length; i++) {\n const currentSegment = segments[i];\n const prevSegment = segments[i - 1];\n if (prevSegment.end !== currentSegment.start) {\n showError(\"Previous segment end should be equal to next segment start\");\n return false;\n }\n }\n\n return true;\n};\n\nexport const getSegmentCoordinates = (\n { start, end }: Pick<DonutSegment, \"start\" | \"end\">,\n radius: number,\n segmentWidth: number\n) => {\n const innerRadius = radius - segmentWidth;\n\n const startAlpha = Math.round(start * 360);\n const endAlpha = Math.round(end * 360);\n const arc = endAlpha - startAlpha;\n\n const { x: startX, y: startY } = getCoordinateForArc(radius, startAlpha);\n const { x: startInnerX, y: startInnerY } = getCoordinateForArc(\n innerRadius,\n startAlpha,\n radius\n );\n\n const { x: endX, y: endY } = getCoordinateForArc(radius, endAlpha);\n const { x: endInnerX, y: endInnerY } = getCoordinateForArc(\n innerRadius,\n endAlpha,\n radius\n );\n return {\n startX,\n startY,\n endX,\n endY,\n startInnerX,\n startInnerY,\n endInnerX,\n endInnerY,\n arc,\n };\n};\n"],"names":["areSegmentsValid","segments","receivedSegments","start","end","showError","text","point","acc","i","currentSegment","getSegmentCoordinates","radius","segmentWidth","innerRadius","startAlpha","endAlpha","arc","startX","startY","getCoordinateForArc","startInnerX","startInnerY","endX","endY","endInnerX","endInnerY"],"mappings":";AAGa,MAAAA,IAAmB,CAC9BC,MACY;AACN,QAAAC,IAAmB,YAAYD,EAAS;AAAA,IAC5C,CAAC,EAAE,OAAAE,GAAO,KAAAC,QAAU,IAAID,CAAK,IAAIC,CAAG;AAAA,EACrC,CAAA,IACKC,IAAY,CAACC,MAAiB,QAAQ,MAAMA,GAAMJ,CAAgB;AAExE,MACED,EAAS;AAAA,IAAK,CAAC,EAAE,OAAAE,GAAO,KAAAC,QACtB,CAACD,GAAOC,CAAG,EAAE,KAAK,CAACG,MAAUA,IAAQ,KAAKA,IAAQ,CAAC;AAAA,EAAA;AAGrD,WAAAF,EAAU,0CAA0C,GAC7C;AAGT,MACEJ,EAAS;AAAA,IACP,CAACO,GAAK,EAAE,OAAAL,QAAYK,KAAOL,MAAU,IAAI,IAAI;AAAA,IAC7C;AAAA,QACI;AAEN,WAAAE,EAAU,iCAAiC,GACpC;AAGT,MACEJ,EAAS,OAAe,CAACO,GAAK,EAAE,KAAAJ,EAAI,MAAMI,KAAOJ,MAAQ,IAAI,IAAI,IAAI,CAAC,MACtE;AAEA,WAAAC,EAAU,6BAA6B,GAChC;AAGL,MAAAJ,EAAS,KAAK,CAAC,EAAE,OAAAE,GAAO,KAAAC,QAAUD,KAASC,CAAG;AAChD,WAAAC,EAAU,0CAA0C,GAC7C;AAGT,WAASI,IAAI,GAAGA,IAAIR,EAAS,QAAQQ,KAAK;AAClC,UAAAC,IAAiBT,EAASQ,CAAC;AAE7B,QADgBR,EAASQ,IAAI,CAAC,EAClB,QAAQC,EAAe;AACrC,aAAAL,EAAU,4DAA4D,GAC/D;AAAA,EAEX;AAEO,SAAA;AACT,GAEaM,IAAwB,CACnC,EAAE,OAAAR,GAAO,KAAAC,EAAI,GACbQ,GACAC,MACG;AACH,QAAMC,IAAcF,IAASC,GAEvBE,IAAa,KAAK,MAAMZ,IAAQ,GAAG,GACnCa,IAAW,KAAK,MAAMZ,IAAM,GAAG,GAC/Ba,IAAMD,IAAWD,GAEjB,EAAE,GAAGG,GAAQ,GAAGC,MAAWC,EAAoBR,GAAQG,CAAU,GACjE,EAAE,GAAGM,GAAa,GAAGC,EAAgB,IAAAF;AAAA,IACzCN;AAAA,IACAC;AAAA,IACAH;AAAA,EAAA,GAGI,EAAE,GAAGW,GAAM,GAAGC,MAASJ,EAAoBR,GAAQI,CAAQ,GAC3D,EAAE,GAAGS,GAAW,GAAGC,EAAc,IAAAN;AAAA,IACrCN;AAAA,IACAE;AAAA,IACAJ;AAAA,EAAA;AAEK,SAAA;AAAA,IACL,QAAAM;AAAA,IACA,QAAAC;AAAA,IACA,MAAAI;AAAA,IACA,MAAAC;AAAA,IACA,aAAAH;AAAA,IACA,aAAAC;AAAA,IACA,WAAAG;AAAA,IACA,WAAAC;AAAA,IACA,KAAAT;AAAA,EAAA;AAEJ;"}