@xaui/native 0.0.21 → 0.0.24

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 (113) hide show
  1. package/README.md +195 -2
  2. package/dist/alert/index.js +1 -2
  3. package/dist/app-bar/index.cjs +217 -0
  4. package/dist/app-bar/index.d.cts +52 -0
  5. package/dist/app-bar/index.d.ts +52 -0
  6. package/dist/app-bar/index.js +142 -0
  7. package/dist/autocomplete/index.js +48 -36
  8. package/dist/avatar/index.js +1 -2
  9. package/dist/badge/index.js +1 -2
  10. package/dist/bottom-sheet/index.js +1 -2
  11. package/dist/bottom-tab-bar/index.cjs +571 -0
  12. package/dist/bottom-tab-bar/index.d.cts +211 -0
  13. package/dist/bottom-tab-bar/index.d.ts +211 -0
  14. package/dist/bottom-tab-bar/index.js +497 -0
  15. package/dist/button/index.d.cts +102 -5
  16. package/dist/button/index.d.ts +102 -5
  17. package/dist/button/index.js +2 -3
  18. package/dist/button.type-j1ZdkkSl.d.cts +4 -0
  19. package/dist/button.type-j1ZdkkSl.d.ts +4 -0
  20. package/dist/card/index.cjs +2 -0
  21. package/dist/card/index.d.cts +6 -1
  22. package/dist/card/index.d.ts +6 -1
  23. package/dist/card/index.js +4 -2
  24. package/dist/carousel/index.js +1 -1
  25. package/dist/chart/index.cjs +1067 -0
  26. package/dist/chart/index.d.cts +218 -0
  27. package/dist/chart/index.d.ts +218 -0
  28. package/dist/chart/index.js +1026 -0
  29. package/dist/checkbox/index.js +1 -2
  30. package/dist/chip/index.js +1 -2
  31. package/dist/chunk-3XSXTM3G.js +661 -0
  32. package/dist/chunk-4KSZLONZ.js +79 -0
  33. package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
  34. package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
  35. package/dist/chunk-I4V5Y5GD.js +76 -0
  36. package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
  37. package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
  38. package/dist/chunk-URBEEDFX.js +79 -0
  39. package/dist/core/index.js +3 -5
  40. package/dist/datepicker/index.js +1 -2
  41. package/dist/divider/index.js +2 -3
  42. package/dist/drawer/index.cjs +310 -0
  43. package/dist/drawer/index.d.cts +58 -0
  44. package/dist/drawer/index.d.ts +58 -0
  45. package/dist/drawer/index.js +236 -0
  46. package/dist/{accordion → expansion-panel}/index.cjs +45 -45
  47. package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
  48. package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
  49. package/dist/{accordion → expansion-panel}/index.js +40 -41
  50. package/dist/fab/index.d.cts +3 -3
  51. package/dist/fab/index.d.ts +3 -3
  52. package/dist/fab/index.js +3 -4
  53. package/dist/fab-menu/index.d.cts +2 -2
  54. package/dist/fab-menu/index.d.ts +2 -2
  55. package/dist/fab-menu/index.js +3 -4
  56. package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
  57. package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
  58. package/dist/feature-discovery/index.cjs +531 -0
  59. package/dist/feature-discovery/index.d.cts +82 -0
  60. package/dist/feature-discovery/index.d.ts +82 -0
  61. package/dist/feature-discovery/index.js +464 -0
  62. package/dist/indicator/index.js +2 -3
  63. package/dist/input/index.cjs +258 -164
  64. package/dist/input/index.d.cts +15 -1
  65. package/dist/input/index.d.ts +15 -1
  66. package/dist/input/index.js +219 -126
  67. package/dist/list/index.js +1 -2
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +369 -0
  70. package/dist/menubox/index.d.cts +98 -0
  71. package/dist/menubox/index.d.ts +98 -0
  72. package/dist/menubox/index.js +296 -0
  73. package/dist/pager/index.cjs +243 -0
  74. package/dist/pager/index.d.cts +93 -0
  75. package/dist/pager/index.d.ts +93 -0
  76. package/dist/pager/index.js +205 -0
  77. package/dist/progress/index.js +1 -2
  78. package/dist/radio/index.cjs +537 -0
  79. package/dist/radio/index.d.cts +145 -0
  80. package/dist/radio/index.d.ts +145 -0
  81. package/dist/radio/index.js +464 -0
  82. package/dist/segment-button/index.js +2 -2
  83. package/dist/select/index.js +22 -10
  84. package/dist/skeleton/index.js +2 -2
  85. package/dist/slider/index.cjs +655 -0
  86. package/dist/slider/index.d.cts +171 -0
  87. package/dist/slider/index.d.ts +171 -0
  88. package/dist/slider/index.js +575 -0
  89. package/dist/stepper/index.cjs +624 -0
  90. package/dist/stepper/index.d.cts +137 -0
  91. package/dist/stepper/index.d.ts +137 -0
  92. package/dist/stepper/index.js +549 -0
  93. package/dist/switch/index.js +1 -2
  94. package/dist/tabs/index.cjs +523 -0
  95. package/dist/tabs/index.d.cts +176 -0
  96. package/dist/tabs/index.d.ts +176 -0
  97. package/dist/tabs/index.js +438 -0
  98. package/dist/timepicker/index.cjs +1280 -0
  99. package/dist/timepicker/index.d.cts +215 -0
  100. package/dist/timepicker/index.d.ts +215 -0
  101. package/dist/timepicker/index.js +1181 -0
  102. package/dist/toolbar/index.cjs +395 -0
  103. package/dist/toolbar/index.d.cts +100 -0
  104. package/dist/toolbar/index.d.ts +100 -0
  105. package/dist/toolbar/index.js +325 -0
  106. package/dist/typography/index.js +1 -2
  107. package/dist/view/index.cjs +16 -2
  108. package/dist/view/index.js +16 -2
  109. package/package.json +73 -8
  110. package/dist/button.type-D8tzEBo7.d.ts +0 -104
  111. package/dist/button.type-ikaWzhIg.d.cts +0 -104
  112. package/dist/chunk-GBHQCAKW.js +0 -19
  113. package/dist/chunk-JEGEPGVU.js +0 -287
@@ -0,0 +1,1067 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/chart/index.ts
31
+ var chart_exports = {};
32
+ __export(chart_exports, {
33
+ DonutChartCard: () => DonutChartCard,
34
+ HeatmapChartCard: () => HeatmapChartCard,
35
+ LineChartCard: () => LineChartCard,
36
+ PieChartCard: () => PieChartCard,
37
+ VerticalBarChartCard: () => VerticalBarChartCard
38
+ });
39
+ module.exports = __toCommonJS(chart_exports);
40
+
41
+ // src/components/chart/donut-chart-card.tsx
42
+ var import_react = __toESM(require("react"), 1);
43
+ var import_react_native2 = require("react-native");
44
+ var import_react_native_svg = __toESM(require("react-native-svg"), 1);
45
+
46
+ // src/components/chart/chart.style.ts
47
+ var import_react_native = require("react-native");
48
+ var styles = import_react_native.StyleSheet.create({
49
+ card: {
50
+ borderRadius: 22,
51
+ paddingHorizontal: 20,
52
+ paddingVertical: 18,
53
+ width: "100%"
54
+ },
55
+ contentVertical: {
56
+ flexDirection: "column",
57
+ alignItems: "center",
58
+ gap: 20
59
+ },
60
+ contentHorizontal: {
61
+ flexDirection: "row",
62
+ alignItems: "center",
63
+ justifyContent: "space-between",
64
+ gap: 18
65
+ },
66
+ pieContentVertical: {
67
+ flexDirection: "column",
68
+ alignItems: "center",
69
+ gap: 0
70
+ },
71
+ pieContentHorizontal: {
72
+ flexDirection: "row",
73
+ alignItems: "center",
74
+ justifyContent: "space-between",
75
+ gap: 0
76
+ },
77
+ chartWrapper: {
78
+ alignItems: "center",
79
+ justifyContent: "center"
80
+ },
81
+ pieHeader: {
82
+ width: "100%",
83
+ flexDirection: "row",
84
+ alignItems: "center",
85
+ justifyContent: "space-between",
86
+ marginBottom: 10
87
+ },
88
+ pieHeaderTitle: {
89
+ fontSize: 16,
90
+ fontWeight: "600",
91
+ flex: 1
92
+ },
93
+ pieHeaderTotal: {
94
+ fontSize: 16,
95
+ fontWeight: "600",
96
+ marginLeft: 12,
97
+ textAlign: "right"
98
+ },
99
+ centerContent: {
100
+ position: "absolute",
101
+ alignItems: "center",
102
+ justifyContent: "center",
103
+ width: "62%"
104
+ },
105
+ centerTitle: {
106
+ fontSize: 17,
107
+ color: "#aeb7c2",
108
+ fontWeight: "500",
109
+ textAlign: "center",
110
+ includeFontPadding: false
111
+ },
112
+ centerTotal: {
113
+ marginTop: 6,
114
+ fontSize: 44,
115
+ fontWeight: "600",
116
+ color: "#ffffff",
117
+ lineHeight: 50,
118
+ includeFontPadding: false
119
+ },
120
+ legend: {
121
+ width: "100%",
122
+ gap: 10
123
+ },
124
+ legendCompact: {
125
+ width: "auto",
126
+ minWidth: 180,
127
+ flexShrink: 1
128
+ },
129
+ legendItem: {
130
+ flexDirection: "row",
131
+ alignItems: "center",
132
+ justifyContent: "space-between",
133
+ gap: 14
134
+ },
135
+ legendLeft: {
136
+ flexDirection: "row",
137
+ alignItems: "center",
138
+ gap: 10,
139
+ flex: 1
140
+ },
141
+ legendDot: {
142
+ width: 14,
143
+ height: 14,
144
+ borderRadius: 14
145
+ },
146
+ legendTitle: {
147
+ fontSize: 16,
148
+ fontWeight: "500",
149
+ color: "#f4f6f8",
150
+ flexShrink: 1
151
+ },
152
+ legendValue: {
153
+ fontSize: 16,
154
+ fontWeight: "500",
155
+ color: "#ffffff",
156
+ minWidth: 34,
157
+ textAlign: "right"
158
+ },
159
+ barCard: {
160
+ borderRadius: 22,
161
+ paddingHorizontal: 18,
162
+ paddingTop: 16,
163
+ paddingBottom: 14,
164
+ width: "100%"
165
+ },
166
+ barTitle: {
167
+ fontSize: 16,
168
+ fontWeight: "600",
169
+ marginBottom: 14
170
+ },
171
+ barChartRow: {
172
+ flexDirection: "row",
173
+ alignItems: "stretch",
174
+ marginTop: 15
175
+ },
176
+ yAxis: {
177
+ width: 44,
178
+ justifyContent: "space-between",
179
+ paddingRight: 8
180
+ },
181
+ yAxisLabel: {
182
+ fontSize: 12,
183
+ fontWeight: "500",
184
+ textAlign: "right"
185
+ },
186
+ chartAndLabels: {
187
+ flex: 1
188
+ },
189
+ xAxisRow: {
190
+ flexDirection: "row",
191
+ alignItems: "flex-start",
192
+ marginTop: 8
193
+ },
194
+ xAxisLabel: {
195
+ fontSize: 12,
196
+ fontWeight: "500",
197
+ textAlign: "center",
198
+ includeFontPadding: false
199
+ },
200
+ legendBelow: {
201
+ marginTop: 20,
202
+ flexDirection: "row",
203
+ flexWrap: "wrap",
204
+ gap: 8
205
+ },
206
+ legendBelowItem: {
207
+ flexDirection: "row",
208
+ alignItems: "center",
209
+ gap: 6,
210
+ marginRight: 12
211
+ },
212
+ legendBelowDot: {
213
+ width: 8,
214
+ height: 8,
215
+ borderRadius: 8
216
+ },
217
+ legendBelowText: {
218
+ fontSize: 12,
219
+ fontWeight: "500"
220
+ },
221
+ legendBelowValue: {
222
+ fontSize: 12,
223
+ fontWeight: "600",
224
+ marginLeft: 2
225
+ },
226
+ lineChartArea: {
227
+ flex: 1
228
+ },
229
+ lineChartGrid: {
230
+ position: "absolute",
231
+ left: 0,
232
+ right: 0,
233
+ height: 1,
234
+ backgroundColor: "rgba(255,255,255,0.12)"
235
+ },
236
+ chartHeader: {
237
+ width: "100%",
238
+ marginBottom: 16
239
+ },
240
+ chartTitle: {
241
+ fontSize: 16,
242
+ fontWeight: "600"
243
+ },
244
+ heatmapContainer: {
245
+ alignItems: "flex-start"
246
+ },
247
+ heatmapGrid: {
248
+ flexDirection: "row",
249
+ alignItems: "center"
250
+ },
251
+ heatmapRow: {
252
+ flexDirection: "row",
253
+ alignItems: "center"
254
+ },
255
+ heatmapCell: {
256
+ alignItems: "center",
257
+ justifyContent: "center",
258
+ borderRadius: 4
259
+ },
260
+ heatmapCellText: {
261
+ fontSize: 10,
262
+ fontWeight: "600",
263
+ color: "#ffffff"
264
+ },
265
+ heatmapXLabel: {
266
+ alignItems: "center",
267
+ justifyContent: "center"
268
+ },
269
+ heatmapYLabel: {
270
+ alignItems: "flex-end",
271
+ justifyContent: "center",
272
+ paddingRight: 4
273
+ },
274
+ heatmapLabelText: {
275
+ fontSize: 12,
276
+ fontWeight: "500"
277
+ },
278
+ heatmapLegend: {
279
+ marginTop: 20,
280
+ width: "100%"
281
+ },
282
+ heatmapLegendGradient: {
283
+ flexDirection: "row",
284
+ justifyContent: "space-between",
285
+ gap: 8
286
+ },
287
+ heatmapLegendItem: {
288
+ alignItems: "center",
289
+ gap: 6
290
+ },
291
+ heatmapLegendBox: {
292
+ width: 24,
293
+ height: 24,
294
+ borderRadius: 4
295
+ },
296
+ heatmapLegendValue: {
297
+ fontSize: 11,
298
+ fontWeight: "500"
299
+ }
300
+ });
301
+
302
+ // src/components/chart/chart.shared.ts
303
+ var DEFAULT_CHART_BACKGROUND = "#6a6a6a30";
304
+ var resolveElevationStyles = (elevation) => {
305
+ if (elevation <= 0) {
306
+ return {
307
+ shadowOpacity: 0,
308
+ elevation: 0
309
+ };
310
+ }
311
+ return {
312
+ shadowColor: "#000000",
313
+ shadowOpacity: Math.min(0.18 + elevation * 0.04, 0.34),
314
+ shadowOffset: {
315
+ width: 0,
316
+ height: elevation * 2
317
+ },
318
+ shadowRadius: 6 + elevation * 2,
319
+ elevation
320
+ };
321
+ };
322
+ var formatAxisValue = (value) => {
323
+ if (Number.isInteger(value)) {
324
+ return `${value}`;
325
+ }
326
+ return value.toFixed(1);
327
+ };
328
+ var abbreviateLabel = (label, length) => {
329
+ const compact = label.trim();
330
+ if (compact.length <= length) {
331
+ return compact;
332
+ }
333
+ return `${compact.slice(0, length)}.`;
334
+ };
335
+ var isLegendHorizontal = (position) => position === "left" || position === "right";
336
+
337
+ // src/components/chart/donut-chart-card.tsx
338
+ var DonutChartCard = ({
339
+ data,
340
+ showLegend = true,
341
+ legendPosition = "top",
342
+ total,
343
+ title,
344
+ elevation = 0,
345
+ backgroundColor = DEFAULT_CHART_BACKGROUND,
346
+ textColor = "#ffffff",
347
+ size = 250,
348
+ strokeWidth,
349
+ style
350
+ }) => {
351
+ const normalizedData = import_react.default.useMemo(
352
+ () => data.filter((item) => item.value > 0),
353
+ [data]
354
+ );
355
+ const totalValue = import_react.default.useMemo(
356
+ () => normalizedData.reduce((sum, item) => sum + item.value, 0),
357
+ [normalizedData]
358
+ );
359
+ const effectiveStrokeWidth = import_react.default.useMemo(() => {
360
+ const autoStroke = Math.max(8, Math.min(24, Math.round(size * 0.082)));
361
+ if (strokeWidth === void 0) {
362
+ return autoStroke;
363
+ }
364
+ return Math.max(6, Math.min(strokeWidth, Math.round(size * 0.22)));
365
+ }, [size, strokeWidth]);
366
+ const radius = import_react.default.useMemo(
367
+ () => (size - effectiveStrokeWidth) / 2,
368
+ [effectiveStrokeWidth, size]
369
+ );
370
+ const circumference = import_react.default.useMemo(() => 2 * Math.PI * radius, [radius]);
371
+ const internalGapDegrees = import_react.default.useMemo(
372
+ () => Math.max(6.5, Math.min(12.5, 8.1 * (250 / size))),
373
+ [size]
374
+ );
375
+ const centerTitleFontSize = import_react.default.useMemo(
376
+ () => Math.max(12, Math.round(size * 0.058)),
377
+ [size]
378
+ );
379
+ const centerTotalFontSize = import_react.default.useMemo(
380
+ () => Math.max(24, Math.round(size * 0.128)),
381
+ [size]
382
+ );
383
+ const segments = import_react.default.useMemo(() => {
384
+ if (!normalizedData.length || totalValue <= 0) {
385
+ return [];
386
+ }
387
+ const requestedGap = internalGapDegrees / 360 * circumference;
388
+ const capCompensation = effectiveStrokeWidth * 0.66;
389
+ const maxGap = circumference / (normalizedData.length * 1.55);
390
+ const gapLength = Math.min(requestedGap + capCompensation, maxGap);
391
+ const availableArcLength = circumference - normalizedData.length * gapLength;
392
+ let offset = 0;
393
+ return normalizedData.map((item, index) => {
394
+ const segmentLength = item.value / totalValue * availableArcLength;
395
+ const segment = {
396
+ key: `${item.label}-${index}`,
397
+ color: item.color,
398
+ strokeDasharray: `${segmentLength} ${circumference}`,
399
+ strokeDashoffset: -offset
400
+ };
401
+ offset += segmentLength + gapLength;
402
+ return segment;
403
+ });
404
+ }, [
405
+ circumference,
406
+ effectiveStrokeWidth,
407
+ internalGapDegrees,
408
+ normalizedData,
409
+ totalValue
410
+ ]);
411
+ const chart = /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: [styles.chartWrapper, { width: size, height: size }] }, /* @__PURE__ */ import_react.default.createElement(import_react_native_svg.default, { width: size, height: size }, /* @__PURE__ */ import_react.default.createElement(
412
+ import_react_native_svg.Circle,
413
+ {
414
+ cx: size / 2,
415
+ cy: size / 2,
416
+ r: radius,
417
+ stroke: "rgba(255,255,255,0.06)",
418
+ strokeWidth: effectiveStrokeWidth,
419
+ fill: "none"
420
+ }
421
+ ), /* @__PURE__ */ import_react.default.createElement(
422
+ import_react_native_svg.default,
423
+ {
424
+ width: size,
425
+ height: size,
426
+ style: { transform: [{ rotate: "-90deg" }] }
427
+ },
428
+ segments.map((segment) => /* @__PURE__ */ import_react.default.createElement(
429
+ import_react_native_svg.Circle,
430
+ {
431
+ key: segment.key,
432
+ cx: size / 2,
433
+ cy: size / 2,
434
+ r: radius,
435
+ stroke: segment.color,
436
+ strokeWidth: effectiveStrokeWidth,
437
+ strokeDasharray: segment.strokeDasharray,
438
+ strokeDashoffset: segment.strokeDashoffset,
439
+ strokeLinecap: "round",
440
+ fill: "none"
441
+ }
442
+ ))
443
+ )), (title !== void 0 || total !== void 0) && /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: styles.centerContent, pointerEvents: "none" }, title !== void 0 && /* @__PURE__ */ import_react.default.createElement(
444
+ import_react_native2.Text,
445
+ {
446
+ style: [
447
+ styles.centerTitle,
448
+ { fontSize: centerTitleFontSize, color: textColor }
449
+ ]
450
+ },
451
+ title
452
+ ), total !== void 0 && /* @__PURE__ */ import_react.default.createElement(
453
+ import_react_native2.Text,
454
+ {
455
+ style: [
456
+ styles.centerTotal,
457
+ {
458
+ color: textColor,
459
+ fontSize: centerTotalFontSize,
460
+ lineHeight: Math.round(centerTotalFontSize * 1.14)
461
+ }
462
+ ]
463
+ },
464
+ total
465
+ )));
466
+ const legend = showLegend ? /* @__PURE__ */ import_react.default.createElement(
467
+ import_react_native2.View,
468
+ {
469
+ style: [
470
+ styles.legend,
471
+ isLegendHorizontal(legendPosition) && styles.legendCompact
472
+ ]
473
+ },
474
+ data.map((item, index) => /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: styles.legendItem, key: `${item.label}-${index}-legend` }, /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: styles.legendLeft }, /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: [styles.legendDot, { backgroundColor: item.color }] }), /* @__PURE__ */ import_react.default.createElement(
475
+ import_react_native2.Text,
476
+ {
477
+ style: [styles.legendTitle, { color: item.labelColor ?? textColor }]
478
+ },
479
+ item.label
480
+ )), /* @__PURE__ */ import_react.default.createElement(import_react_native2.Text, { style: [styles.legendValue, { color: textColor }] }, item.value)))
481
+ ) : null;
482
+ const content = isLegendHorizontal(legendPosition) ? /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: styles.contentHorizontal }, legendPosition === "left" && legend, chart, legendPosition === "right" && legend) : /* @__PURE__ */ import_react.default.createElement(import_react_native2.View, { style: styles.contentVertical }, legendPosition === "top" && legend, chart, legendPosition === "bottom" && legend);
483
+ return /* @__PURE__ */ import_react.default.createElement(
484
+ import_react_native2.View,
485
+ {
486
+ style: [
487
+ styles.barCard,
488
+ { backgroundColor },
489
+ resolveElevationStyles(elevation),
490
+ style
491
+ ]
492
+ },
493
+ content
494
+ );
495
+ };
496
+
497
+ // src/components/chart/vertical-bar-chart-card.tsx
498
+ var import_react2 = __toESM(require("react"), 1);
499
+ var import_react_native3 = require("react-native");
500
+ var VerticalBarChartCard = ({
501
+ data,
502
+ title,
503
+ elevation = 0,
504
+ backgroundColor = DEFAULT_CHART_BACKGROUND,
505
+ textColor = "#ffffff",
506
+ size = 260,
507
+ showAxes = true,
508
+ abbreviateXAxisLabels = true,
509
+ xAxisAbbreviationLength = 3,
510
+ showFullLegendBelow = true,
511
+ justifyBars = true,
512
+ style
513
+ }) => {
514
+ const normalizedData = import_react2.default.useMemo(
515
+ () => data.filter((item) => item.value >= 0),
516
+ [data]
517
+ );
518
+ const minValue = import_react2.default.useMemo(() => {
519
+ if (!normalizedData.length) {
520
+ return 0;
521
+ }
522
+ return Math.min(...normalizedData.map((item) => item.value));
523
+ }, [normalizedData]);
524
+ const maxValue = import_react2.default.useMemo(() => {
525
+ if (!normalizedData.length) {
526
+ return 1;
527
+ }
528
+ return Math.max(...normalizedData.map((item) => item.value), 1);
529
+ }, [normalizedData]);
530
+ const meanValue = import_react2.default.useMemo(() => {
531
+ if (!normalizedData.length) {
532
+ return 0;
533
+ }
534
+ const total = normalizedData.reduce((sum, item) => sum + item.value, 0);
535
+ return total / normalizedData.length;
536
+ }, [normalizedData]);
537
+ const chartWidth = Math.max(170, size);
538
+ const chartHeight = Math.max(130, Math.min(220, Math.round(size * 0.56)));
539
+ const horizontalPadding = justifyBars ? 0 : Math.max(10, Math.round(size * 0.045));
540
+ const barsCount = Math.max(normalizedData.length, 1);
541
+ const usableWidth = chartWidth - horizontalPadding * 2;
542
+ const slotWidth = usableWidth / barsCount;
543
+ const dynamicBarWidth = Math.max(8, Math.min(30, slotWidth * 0.52));
544
+ const cornerRadius = Math.min(dynamicBarWidth / 2, 10);
545
+ const graphHeight = chartHeight - 8;
546
+ return /* @__PURE__ */ import_react2.default.createElement(
547
+ import_react_native3.View,
548
+ {
549
+ style: [
550
+ styles.barCard,
551
+ { backgroundColor },
552
+ resolveElevationStyles(elevation),
553
+ style
554
+ ]
555
+ },
556
+ title !== void 0 && /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.barTitle, { color: textColor }] }, title),
557
+ /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: styles.barChartRow }, showAxes && /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: [styles.yAxis, { height: chartHeight }] }, /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(maxValue)), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(meanValue)), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(minValue))), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: styles.chartAndLabels }, /* @__PURE__ */ import_react2.default.createElement(
558
+ import_react_native3.View,
559
+ {
560
+ style: {
561
+ width: chartWidth,
562
+ height: chartHeight,
563
+ position: "relative",
564
+ justifyContent: "flex-end"
565
+ }
566
+ },
567
+ showAxes && /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(
568
+ import_react_native3.View,
569
+ {
570
+ style: {
571
+ position: "absolute",
572
+ left: 0,
573
+ right: 0,
574
+ top: 0,
575
+ height: 1,
576
+ backgroundColor: "rgba(255,255,255,0.15)"
577
+ }
578
+ }
579
+ ), /* @__PURE__ */ import_react2.default.createElement(
580
+ import_react_native3.View,
581
+ {
582
+ style: {
583
+ position: "absolute",
584
+ left: 0,
585
+ right: 0,
586
+ top: Math.round((chartHeight - 1) / 2),
587
+ height: 1,
588
+ backgroundColor: "rgba(255,255,255,0.12)"
589
+ }
590
+ }
591
+ ), /* @__PURE__ */ import_react2.default.createElement(
592
+ import_react_native3.View,
593
+ {
594
+ style: {
595
+ position: "absolute",
596
+ left: 0,
597
+ right: 0,
598
+ bottom: 0,
599
+ height: 1,
600
+ backgroundColor: "rgba(255,255,255,0.15)"
601
+ }
602
+ }
603
+ )),
604
+ /* @__PURE__ */ import_react2.default.createElement(
605
+ import_react_native3.View,
606
+ {
607
+ style: {
608
+ flexDirection: "row",
609
+ alignItems: "flex-end",
610
+ height: chartHeight,
611
+ paddingHorizontal: horizontalPadding,
612
+ justifyContent: justifyBars ? "space-between" : "flex-start"
613
+ }
614
+ },
615
+ normalizedData.map((item, index) => {
616
+ const valueRatio = Math.max(0, Math.min(1, item.value / maxValue));
617
+ const barHeight = Math.max(2, Math.round(valueRatio * graphHeight));
618
+ return /* @__PURE__ */ import_react2.default.createElement(
619
+ import_react_native3.View,
620
+ {
621
+ key: `${item.label}-${index}-bar`,
622
+ style: {
623
+ width: slotWidth,
624
+ height: "100%",
625
+ alignItems: "center",
626
+ justifyContent: "flex-end"
627
+ }
628
+ },
629
+ /* @__PURE__ */ import_react2.default.createElement(
630
+ import_react_native3.View,
631
+ {
632
+ style: {
633
+ width: dynamicBarWidth,
634
+ height: barHeight,
635
+ borderRadius: cornerRadius,
636
+ backgroundColor: item.color ?? "#57C9ED"
637
+ }
638
+ }
639
+ )
640
+ );
641
+ })
642
+ )
643
+ ), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: [styles.xAxisRow, { width: chartWidth }] }, normalizedData.map((item, index) => /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { key: `${item.label}-${index}-x`, style: { width: slotWidth } }, /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.xAxisLabel, { color: textColor }] }, abbreviateXAxisLabels ? abbreviateLabel(item.label, xAxisAbbreviationLength) : item.label)))))),
644
+ showFullLegendBelow && /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: [styles.legend, { marginTop: 18 }] }, normalizedData.map((item, index) => /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { key: `${item.label}-${index}-legend`, style: styles.legendItem }, /* @__PURE__ */ import_react2.default.createElement(import_react_native3.View, { style: styles.legendLeft }, /* @__PURE__ */ import_react2.default.createElement(
645
+ import_react_native3.View,
646
+ {
647
+ style: [
648
+ styles.legendDot,
649
+ { backgroundColor: item.color ?? "#57C9ED" }
650
+ ]
651
+ }
652
+ ), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.legendTitle, { color: textColor }] }, item.label)), /* @__PURE__ */ import_react2.default.createElement(import_react_native3.Text, { style: [styles.legendValue, { color: textColor }] }, item.value))))
653
+ );
654
+ };
655
+
656
+ // src/components/chart/pie-chart-card.tsx
657
+ var import_react3 = __toESM(require("react"), 1);
658
+ var import_react_native4 = require("react-native");
659
+ var import_react_native_svg2 = __toESM(require("react-native-svg"), 1);
660
+ var SvgElements = __toESM(require("react-native-svg"), 1);
661
+ var polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
662
+ const angleInRadians = (angleInDegrees - 90) * Math.PI / 180;
663
+ return {
664
+ x: centerX + radius * Math.cos(angleInRadians),
665
+ y: centerY + radius * Math.sin(angleInRadians)
666
+ };
667
+ };
668
+ var createSectorPath = (centerX, centerY, radius, startAngle, endAngle) => {
669
+ const start = polarToCartesian(centerX, centerY, radius, endAngle);
670
+ const end = polarToCartesian(centerX, centerY, radius, startAngle);
671
+ const largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
672
+ return [
673
+ `M ${centerX} ${centerY}`,
674
+ `L ${start.x} ${start.y}`,
675
+ `A ${radius} ${radius} 0 ${largeArcFlag} 0 ${end.x} ${end.y}`,
676
+ "Z"
677
+ ].join(" ");
678
+ };
679
+ var PieChartCard = ({
680
+ data,
681
+ title,
682
+ total,
683
+ showLegend = true,
684
+ legendPosition = "bottom",
685
+ elevation = 0,
686
+ backgroundColor = DEFAULT_CHART_BACKGROUND,
687
+ textColor = "#ffffff",
688
+ size = 220,
689
+ style
690
+ }) => {
691
+ const normalizedData = import_react3.default.useMemo(
692
+ () => data.filter((item) => item.value > 0),
693
+ [data]
694
+ );
695
+ const totalValue = import_react3.default.useMemo(
696
+ () => normalizedData.reduce((sum, item) => sum + item.value, 0),
697
+ [normalizedData]
698
+ );
699
+ const chartSize = Math.max(120, size);
700
+ const center = chartSize / 2;
701
+ const radius = chartSize * 0.44;
702
+ const gapDegrees = 1;
703
+ const sectors = import_react3.default.useMemo(() => {
704
+ if (!normalizedData.length || totalValue <= 0) {
705
+ return [];
706
+ }
707
+ let startAngle = 0;
708
+ return normalizedData.map((item, index) => {
709
+ const portion = item.value / totalValue * 360;
710
+ const sweep = Math.max(0, portion - gapDegrees);
711
+ const endAngle = startAngle + sweep;
712
+ const path = createSectorPath(center, center, radius, startAngle, endAngle);
713
+ startAngle += portion;
714
+ return {
715
+ key: `${item.label}-${index}-sector`,
716
+ color: item.color,
717
+ path
718
+ };
719
+ });
720
+ }, [center, gapDegrees, normalizedData, radius, totalValue]);
721
+ const PathElement = SvgElements.Path;
722
+ const chart = /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: [styles.chartWrapper, { width: chartSize, height: chartSize }] }, /* @__PURE__ */ import_react3.default.createElement(import_react_native_svg2.default, { width: chartSize, height: chartSize }, PathElement ? sectors.map((sector) => /* @__PURE__ */ import_react3.default.createElement(PathElement, { key: sector.key, d: sector.path, fill: sector.color })) : sectors.map((sector, index) => /* @__PURE__ */ import_react3.default.createElement(
723
+ import_react_native_svg2.Circle,
724
+ {
725
+ key: `${sector.key}-fallback`,
726
+ cx: chartSize / 2,
727
+ cy: chartSize / 2,
728
+ r: Math.max(8, radius - index * 8),
729
+ fill: sector.color
730
+ }
731
+ ))));
732
+ const legend = showLegend ? /* @__PURE__ */ import_react3.default.createElement(
733
+ import_react_native4.View,
734
+ {
735
+ style: [
736
+ styles.legend,
737
+ isLegendHorizontal(legendPosition) && styles.legendCompact
738
+ ]
739
+ },
740
+ data.map((item, index) => /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: styles.legendItem, key: `${item.label}-${index}-legend` }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: styles.legendLeft }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: [styles.legendDot, { backgroundColor: item.color }] }), /* @__PURE__ */ import_react3.default.createElement(
741
+ import_react_native4.Text,
742
+ {
743
+ style: [styles.legendTitle, { color: item.labelColor ?? textColor }]
744
+ },
745
+ item.label
746
+ )), /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Text, { style: [styles.legendValue, { color: textColor }] }, item.value)))
747
+ ) : null;
748
+ const content = isLegendHorizontal(legendPosition) ? /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: styles.pieContentHorizontal }, legendPosition === "left" && legend, chart, legendPosition === "right" && legend) : /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: styles.pieContentVertical }, legendPosition === "top" && legend, chart, legendPosition === "bottom" && legend);
749
+ return /* @__PURE__ */ import_react3.default.createElement(
750
+ import_react_native4.View,
751
+ {
752
+ style: [
753
+ styles.card,
754
+ { backgroundColor },
755
+ resolveElevationStyles(elevation),
756
+ style
757
+ ]
758
+ },
759
+ (title !== void 0 || total !== void 0) && /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: styles.pieHeader }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Text, { style: [styles.pieHeaderTitle, { color: textColor }] }, title ?? ""), /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Text, { style: [styles.pieHeaderTotal, { color: textColor }] }, total ?? "")),
760
+ content
761
+ );
762
+ };
763
+
764
+ // src/components/chart/line-chart-card.tsx
765
+ var import_react4 = __toESM(require("react"), 1);
766
+ var import_react_native5 = require("react-native");
767
+ var import_react_native_svg3 = __toESM(require("react-native-svg"), 1);
768
+ var SvgElements2 = __toESM(require("react-native-svg"), 1);
769
+ var buildSmoothPath = (points) => {
770
+ if (points.length < 2) {
771
+ return "";
772
+ }
773
+ let path = `M ${points[0].x} ${points[0].y}`;
774
+ for (let index = 1; index < points.length; index += 1) {
775
+ const prev = points[index - 1];
776
+ const current = points[index];
777
+ const controlX = (prev.x + current.x) / 2;
778
+ path += ` C ${controlX} ${prev.y}, ${controlX} ${current.y}, ${current.x} ${current.y}`;
779
+ }
780
+ return path;
781
+ };
782
+ var buildDirectPath = (points) => {
783
+ if (!points.length) {
784
+ return "";
785
+ }
786
+ const [first, ...rest] = points;
787
+ return rest.reduce(
788
+ (path, point) => `${path} L ${point.x} ${point.y}`,
789
+ `M ${first.x} ${first.y}`
790
+ );
791
+ };
792
+ var LineChartCard = ({
793
+ data,
794
+ title,
795
+ elevation = 0,
796
+ backgroundColor = DEFAULT_CHART_BACKGROUND,
797
+ textColor = "#ffffff",
798
+ size = 280,
799
+ showAxes = true,
800
+ showPoints = true,
801
+ lineMode = "smooth",
802
+ lineColor = "#57C9ED",
803
+ areaColor = "rgba(87,201,237,0.16)",
804
+ abbreviateXAxisLabels = true,
805
+ xAxisAbbreviationLength = 3,
806
+ style
807
+ }) => {
808
+ const normalizedData = import_react4.default.useMemo(
809
+ () => data.filter((item) => Number.isFinite(item.value)),
810
+ [data]
811
+ );
812
+ const minValue = import_react4.default.useMemo(() => {
813
+ if (!normalizedData.length) {
814
+ return 0;
815
+ }
816
+ return Math.min(...normalizedData.map((item) => item.value));
817
+ }, [normalizedData]);
818
+ const maxValue = import_react4.default.useMemo(() => {
819
+ if (!normalizedData.length) {
820
+ return 1;
821
+ }
822
+ return Math.max(...normalizedData.map((item) => item.value), 1);
823
+ }, [normalizedData]);
824
+ const meanValue = import_react4.default.useMemo(() => {
825
+ if (!normalizedData.length) {
826
+ return 0;
827
+ }
828
+ return normalizedData.reduce((sum, item) => sum + item.value, 0) / normalizedData.length;
829
+ }, [normalizedData]);
830
+ const chartWidth = Math.max(190, size);
831
+ const chartHeight = Math.max(130, Math.min(220, Math.round(size * 0.56)));
832
+ const paddingX = Math.max(10, Math.round(size * 0.05));
833
+ const rightPadding = paddingX + 8;
834
+ const graphHeight = chartHeight - 10;
835
+ const dataRange = Math.max(1, maxValue - minValue);
836
+ const points = import_react4.default.useMemo(() => {
837
+ if (!normalizedData.length) {
838
+ return [];
839
+ }
840
+ const slots = Math.max(normalizedData.length - 1, 1);
841
+ return normalizedData.map((item, index) => {
842
+ const x = paddingX + index * (chartWidth - paddingX - rightPadding) / slots;
843
+ const ratio = (item.value - minValue) / dataRange;
844
+ const y = graphHeight - ratio * graphHeight;
845
+ return { x, y };
846
+ });
847
+ }, [
848
+ chartWidth,
849
+ dataRange,
850
+ graphHeight,
851
+ minValue,
852
+ normalizedData,
853
+ paddingX,
854
+ rightPadding
855
+ ]);
856
+ const linePath = lineMode === "smooth" ? buildSmoothPath(points) : buildDirectPath(points);
857
+ const areaPath = points.length ? `${linePath} L ${points[points.length - 1].x} ${graphHeight} L ${points[0].x} ${graphHeight} Z` : "";
858
+ const PathElement = SvgElements2.Path;
859
+ return /* @__PURE__ */ import_react4.default.createElement(
860
+ import_react_native5.View,
861
+ {
862
+ style: [
863
+ styles.barCard,
864
+ { backgroundColor },
865
+ resolveElevationStyles(elevation),
866
+ style
867
+ ]
868
+ },
869
+ title !== void 0 && /* @__PURE__ */ import_react4.default.createElement(import_react_native5.Text, { style: [styles.barTitle, { color: textColor }] }, title),
870
+ /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: styles.barChartRow }, showAxes && /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: styles.yAxis }, /* @__PURE__ */ import_react4.default.createElement(import_react_native5.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(maxValue)), /* @__PURE__ */ import_react4.default.createElement(import_react_native5.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(meanValue)), /* @__PURE__ */ import_react4.default.createElement(import_react_native5.Text, { style: [styles.yAxisLabel, { color: textColor }] }, formatAxisValue(minValue))), /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: styles.chartAndLabels }, /* @__PURE__ */ import_react4.default.createElement(
871
+ import_react_native5.View,
872
+ {
873
+ style: [
874
+ styles.lineChartArea,
875
+ { width: chartWidth, height: chartHeight }
876
+ ]
877
+ },
878
+ showAxes && /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: [styles.lineChartGrid, { top: 0 }] }), /* @__PURE__ */ import_react4.default.createElement(
879
+ import_react_native5.View,
880
+ {
881
+ style: [
882
+ styles.lineChartGrid,
883
+ { top: Math.round(chartHeight / 2) }
884
+ ]
885
+ }
886
+ ), /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: [styles.lineChartGrid, { top: chartHeight - 1 }] })),
887
+ /* @__PURE__ */ import_react4.default.createElement(import_react_native_svg3.default, { width: chartWidth, height: chartHeight }, !!areaPath && (PathElement ? /* @__PURE__ */ import_react4.default.createElement(PathElement, { d: areaPath, fill: areaColor }) : null), !!linePath && (PathElement ? /* @__PURE__ */ import_react4.default.createElement(
888
+ PathElement,
889
+ {
890
+ d: linePath,
891
+ fill: "none",
892
+ stroke: lineColor,
893
+ strokeWidth: 2.5,
894
+ strokeLinecap: "round",
895
+ strokeLinejoin: "round"
896
+ }
897
+ ) : null), showPoints && points.map((point, index) => /* @__PURE__ */ import_react4.default.createElement(
898
+ import_react_native_svg3.Circle,
899
+ {
900
+ key: `line-point-${index}`,
901
+ cx: point.x,
902
+ cy: point.y,
903
+ r: 3.8,
904
+ fill: lineColor
905
+ }
906
+ )))
907
+ ), /* @__PURE__ */ import_react4.default.createElement(import_react_native5.View, { style: [styles.xAxisRow, { width: chartWidth }] }, normalizedData.map((item, index) => /* @__PURE__ */ import_react4.default.createElement(
908
+ import_react_native5.View,
909
+ {
910
+ key: `${item.label}-${index}-line-x`,
911
+ style: { width: chartWidth / Math.max(normalizedData.length, 1) }
912
+ },
913
+ /* @__PURE__ */ import_react4.default.createElement(import_react_native5.Text, { style: [styles.xAxisLabel, { color: textColor }] }, abbreviateXAxisLabels ? abbreviateLabel(item.label, xAxisAbbreviationLength) : item.label)
914
+ )))))
915
+ );
916
+ };
917
+
918
+ // src/components/chart/heatmap-chart-card.tsx
919
+ var import_react5 = __toESM(require("react"), 1);
920
+ var import_react_native6 = require("react-native");
921
+ var getHeatmapColor = (value, min, max, startColor, endColor) => {
922
+ if (max === min) {
923
+ return startColor;
924
+ }
925
+ const ratio = (value - min) / (max - min);
926
+ const parseColor = (color) => {
927
+ const hex = color.replace("#", "");
928
+ return {
929
+ r: Number.parseInt(hex.substring(0, 2), 16),
930
+ g: Number.parseInt(hex.substring(2, 4), 16),
931
+ b: Number.parseInt(hex.substring(4, 6), 16)
932
+ };
933
+ };
934
+ const start = parseColor(startColor);
935
+ const end = parseColor(endColor);
936
+ const r = Math.round(start.r + (end.r - start.r) * ratio);
937
+ const g = Math.round(start.g + (end.g - start.g) * ratio);
938
+ const b = Math.round(start.b + (end.b - start.b) * ratio);
939
+ return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
940
+ };
941
+ var HeatmapChartCard = ({
942
+ data,
943
+ title,
944
+ xLabels,
945
+ yLabels,
946
+ showValues = false,
947
+ showLegend = true,
948
+ startColor = "#3B82F6",
949
+ endColor = "#EF4444",
950
+ elevation = 0,
951
+ backgroundColor = DEFAULT_CHART_BACKGROUND,
952
+ textColor = "#ffffff",
953
+ cellSize = 32,
954
+ cellGap = 4,
955
+ style
956
+ }) => {
957
+ const { minValue, maxValue } = import_react5.default.useMemo(() => {
958
+ let min = Number.POSITIVE_INFINITY;
959
+ let max = Number.NEGATIVE_INFINITY;
960
+ for (const row of data) {
961
+ for (const value of row) {
962
+ if (value < min) {
963
+ min = value;
964
+ }
965
+ if (value > max) {
966
+ max = value;
967
+ }
968
+ }
969
+ }
970
+ return { minValue: min, maxValue: max };
971
+ }, [data]);
972
+ const rows = data.length;
973
+ const cols = data[0]?.length ?? 0;
974
+ const labelWidth = 50;
975
+ const labelHeight = 30;
976
+ return /* @__PURE__ */ import_react5.default.createElement(
977
+ import_react_native6.View,
978
+ {
979
+ style: [
980
+ styles.card,
981
+ { backgroundColor },
982
+ resolveElevationStyles(elevation),
983
+ style
984
+ ]
985
+ },
986
+ title && /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: styles.chartHeader }, /* @__PURE__ */ import_react5.default.createElement(import_react_native6.Text, { style: [styles.chartTitle, { color: textColor }] }, title)),
987
+ /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: styles.heatmapContainer }, /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: styles.heatmapGrid }, /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: { width: labelWidth, height: labelHeight } }), xLabels?.map((label, index) => /* @__PURE__ */ import_react5.default.createElement(
988
+ import_react_native6.View,
989
+ {
990
+ key: `x-label-${index}`,
991
+ style: [
992
+ styles.heatmapXLabel,
993
+ {
994
+ width: cellSize,
995
+ height: labelHeight,
996
+ marginRight: index < cols - 1 ? cellGap : 0
997
+ }
998
+ ]
999
+ },
1000
+ /* @__PURE__ */ import_react5.default.createElement(
1001
+ import_react_native6.Text,
1002
+ {
1003
+ style: [styles.heatmapLabelText, { color: textColor }],
1004
+ numberOfLines: 1
1005
+ },
1006
+ abbreviateLabel(label, 3)
1007
+ )
1008
+ ))), data.map((row, rowIndex) => /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { key: `row-${rowIndex}`, style: styles.heatmapRow }, yLabels?.[rowIndex] && /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: [styles.heatmapYLabel, { width: labelWidth }] }, /* @__PURE__ */ import_react5.default.createElement(
1009
+ import_react_native6.Text,
1010
+ {
1011
+ style: [styles.heatmapLabelText, { color: textColor }],
1012
+ numberOfLines: 1
1013
+ },
1014
+ abbreviateLabel(yLabels[rowIndex], 5)
1015
+ )), row.map((value, colIndex) => {
1016
+ const cellColor = getHeatmapColor(
1017
+ value,
1018
+ minValue,
1019
+ maxValue,
1020
+ startColor,
1021
+ endColor
1022
+ );
1023
+ return /* @__PURE__ */ import_react5.default.createElement(
1024
+ import_react_native6.View,
1025
+ {
1026
+ key: `cell-${rowIndex}-${colIndex}`,
1027
+ style: [
1028
+ styles.heatmapCell,
1029
+ {
1030
+ width: cellSize,
1031
+ height: cellSize,
1032
+ backgroundColor: cellColor,
1033
+ marginRight: colIndex < cols - 1 ? cellGap : 0,
1034
+ marginBottom: rowIndex < rows - 1 ? cellGap : 0
1035
+ }
1036
+ ]
1037
+ },
1038
+ showValues && /* @__PURE__ */ import_react5.default.createElement(import_react_native6.Text, { style: styles.heatmapCellText }, value)
1039
+ );
1040
+ })))),
1041
+ showLegend && /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: styles.heatmapLegend }, /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { style: styles.heatmapLegendGradient }, Array.from({ length: 5 }).map((_, index) => {
1042
+ const ratio = index / 4;
1043
+ const value = minValue + (maxValue - minValue) * ratio;
1044
+ const color = getHeatmapColor(
1045
+ value,
1046
+ minValue,
1047
+ maxValue,
1048
+ startColor,
1049
+ endColor
1050
+ );
1051
+ return /* @__PURE__ */ import_react5.default.createElement(import_react_native6.View, { key: `legend-${index}`, style: styles.heatmapLegendItem }, /* @__PURE__ */ import_react5.default.createElement(
1052
+ import_react_native6.View,
1053
+ {
1054
+ style: [styles.heatmapLegendBox, { backgroundColor: color }]
1055
+ }
1056
+ ), /* @__PURE__ */ import_react5.default.createElement(import_react_native6.Text, { style: [styles.heatmapLegendValue, { color: textColor }] }, value.toFixed(1)));
1057
+ })))
1058
+ );
1059
+ };
1060
+ // Annotate the CommonJS export names for ESM import in node:
1061
+ 0 && (module.exports = {
1062
+ DonutChartCard,
1063
+ HeatmapChartCard,
1064
+ LineChartCard,
1065
+ PieChartCard,
1066
+ VerticalBarChartCard
1067
+ });