@wavemaker/react-native-echarts 1.0.0-dev.5 → 1.0.0-dev.8

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 (179) hide show
  1. package/README.md +29 -3
  2. package/area/area-chart.d.ts +1 -1
  3. package/area/area-chart.d.ts.map +1 -1
  4. package/area/area-chart.js +48 -23
  5. package/area/area-chart.props.d.ts +4 -0
  6. package/area/area-chart.props.d.ts.map +1 -1
  7. package/area/index.d.ts +1 -1
  8. package/area/index.d.ts.map +1 -1
  9. package/bubble/bubble-chart.d.ts.map +1 -1
  10. package/bubble/bubble-chart.js +50 -31
  11. package/cartesian/tooltip/axis-tooltip-presets.d.ts +5 -0
  12. package/cartesian/tooltip/axis-tooltip-presets.d.ts.map +1 -0
  13. package/cartesian/tooltip/axis-tooltip-presets.js +46 -0
  14. package/cartesian/tooltip/axis-tooltip.types.d.ts +38 -0
  15. package/cartesian/tooltip/axis-tooltip.types.d.ts.map +1 -0
  16. package/cartesian/tooltip/axis-tooltip.types.js +4 -0
  17. package/cartesian/tooltip/axis-tooltip.utils.d.ts +10 -0
  18. package/cartesian/tooltip/axis-tooltip.utils.d.ts.map +1 -0
  19. package/cartesian/tooltip/axis-tooltip.utils.js +121 -0
  20. package/cartesian/tooltip/default-axis-tooltip.d.ts +9 -0
  21. package/cartesian/tooltip/default-axis-tooltip.d.ts.map +1 -0
  22. package/cartesian/tooltip/default-axis-tooltip.js +53 -0
  23. package/cartesian/tooltip/index.d.ts +7 -0
  24. package/cartesian/tooltip/index.d.ts.map +1 -0
  25. package/cartesian/tooltip/index.js +4 -0
  26. package/cartesian/tooltip/use-axis-tooltip.d.ts +38 -0
  27. package/cartesian/tooltip/use-axis-tooltip.d.ts.map +1 -0
  28. package/cartesian/tooltip/use-axis-tooltip.js +54 -0
  29. package/column/column-chart.d.ts.map +1 -1
  30. package/column/column-chart.js +73 -20
  31. package/geo/geo-chart.d.ts.map +1 -1
  32. package/geo/geo-chart.js +56 -24
  33. package/geo/geo-chart.props.d.ts +11 -5
  34. package/geo/geo-chart.props.d.ts.map +1 -1
  35. package/geo/index.d.ts +1 -0
  36. package/geo/index.d.ts.map +1 -1
  37. package/geo/index.js +1 -0
  38. package/geo/tooltip/default-geo-tooltip.d.ts +6 -0
  39. package/geo/tooltip/default-geo-tooltip.d.ts.map +1 -0
  40. package/geo/tooltip/default-geo-tooltip.js +47 -0
  41. package/geo/tooltip/geo-item-tooltip-presets.d.ts +5 -0
  42. package/geo/tooltip/geo-item-tooltip-presets.d.ts.map +1 -0
  43. package/geo/tooltip/geo-item-tooltip-presets.js +35 -0
  44. package/geo/tooltip/geo-item-tooltip.types.d.ts +19 -0
  45. package/geo/tooltip/geo-item-tooltip.types.d.ts.map +1 -0
  46. package/geo/tooltip/geo-item-tooltip.types.js +3 -0
  47. package/geo/tooltip/geo-item-tooltip.utils.d.ts +14 -0
  48. package/geo/tooltip/geo-item-tooltip.utils.d.ts.map +1 -0
  49. package/geo/tooltip/geo-item-tooltip.utils.js +220 -0
  50. package/geo/tooltip/index.d.ts +7 -0
  51. package/geo/tooltip/index.d.ts.map +1 -0
  52. package/geo/tooltip/index.js +4 -0
  53. package/geo/tooltip/use-geo-item-tooltip.d.ts +26 -0
  54. package/geo/tooltip/use-geo-item-tooltip.d.ts.map +1 -0
  55. package/geo/tooltip/use-geo-item-tooltip.js +59 -0
  56. package/geo/us-chart.js +1 -1
  57. package/geo/us-states.json +54 -0
  58. package/geo/world.json +1 -0
  59. package/index.d.ts +2 -0
  60. package/index.d.ts.map +1 -1
  61. package/index.js +2 -0
  62. package/line/index.d.ts +1 -1
  63. package/line/index.d.ts.map +1 -1
  64. package/line/line-chart.d.ts +1 -1
  65. package/line/line-chart.d.ts.map +1 -1
  66. package/line/line-chart.props.d.ts +5 -0
  67. package/line/line-chart.props.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/pie/index.d.ts +1 -0
  70. package/pie/index.d.ts.map +1 -1
  71. package/pie/index.js +1 -0
  72. package/pie/pie-chart.d.ts.map +1 -1
  73. package/pie/pie-chart.js +59 -36
  74. package/pie/pie-chart.props.d.ts +12 -6
  75. package/pie/pie-chart.props.d.ts.map +1 -1
  76. package/pie/tooltip/default-pie-tooltip.d.ts +5 -0
  77. package/pie/tooltip/default-pie-tooltip.d.ts.map +1 -0
  78. package/pie/tooltip/default-pie-tooltip.js +57 -0
  79. package/pie/tooltip/index.d.ts +7 -0
  80. package/pie/tooltip/index.d.ts.map +1 -0
  81. package/pie/tooltip/index.js +4 -0
  82. package/pie/tooltip/pie-item-tooltip-presets.d.ts +5 -0
  83. package/pie/tooltip/pie-item-tooltip-presets.d.ts.map +1 -0
  84. package/pie/tooltip/pie-item-tooltip-presets.js +39 -0
  85. package/pie/tooltip/pie-item-tooltip.types.d.ts +28 -0
  86. package/pie/tooltip/pie-item-tooltip.types.d.ts.map +1 -0
  87. package/pie/tooltip/pie-item-tooltip.types.js +3 -0
  88. package/pie/tooltip/pie-item-tooltip.utils.d.ts +9 -0
  89. package/pie/tooltip/pie-item-tooltip.utils.d.ts.map +1 -0
  90. package/pie/tooltip/pie-item-tooltip.utils.js +139 -0
  91. package/pie/tooltip/use-pie-item-tooltip.d.ts +24 -0
  92. package/pie/tooltip/use-pie-item-tooltip.d.ts.map +1 -0
  93. package/pie/tooltip/use-pie-item-tooltip.js +45 -0
  94. package/props/cartesian.d.ts +18 -2
  95. package/props/cartesian.d.ts.map +1 -1
  96. package/radar/index.d.ts +1 -0
  97. package/radar/index.d.ts.map +1 -1
  98. package/radar/index.js +1 -0
  99. package/radar/radar-chart.d.ts.map +1 -1
  100. package/radar/radar-chart.js +52 -10
  101. package/radar/radar-chart.props.d.ts +13 -0
  102. package/radar/radar-chart.props.d.ts.map +1 -1
  103. package/radar/tooltip/default-radar-tooltip.d.ts +6 -0
  104. package/radar/tooltip/default-radar-tooltip.d.ts.map +1 -0
  105. package/radar/tooltip/default-radar-tooltip.js +47 -0
  106. package/radar/tooltip/index.d.ts +7 -0
  107. package/radar/tooltip/index.d.ts.map +1 -0
  108. package/radar/tooltip/index.js +4 -0
  109. package/radar/tooltip/radar-item-tooltip-presets.d.ts +5 -0
  110. package/radar/tooltip/radar-item-tooltip-presets.d.ts.map +1 -0
  111. package/radar/tooltip/radar-item-tooltip-presets.js +50 -0
  112. package/radar/tooltip/radar-item-tooltip.types.d.ts +28 -0
  113. package/radar/tooltip/radar-item-tooltip.types.d.ts.map +1 -0
  114. package/radar/tooltip/radar-item-tooltip.types.js +3 -0
  115. package/radar/tooltip/radar-item-tooltip.utils.d.ts +9 -0
  116. package/radar/tooltip/radar-item-tooltip.utils.d.ts.map +1 -0
  117. package/radar/tooltip/radar-item-tooltip.utils.js +77 -0
  118. package/radar/tooltip/use-radar-item-tooltip.d.ts +22 -0
  119. package/radar/tooltip/use-radar-item-tooltip.d.ts.map +1 -0
  120. package/radar/tooltip/use-radar-item-tooltip.js +43 -0
  121. package/radial/index.d.ts +1 -0
  122. package/radial/index.d.ts.map +1 -1
  123. package/radial/index.js +1 -0
  124. package/radial/radial-chart.d.ts.map +1 -1
  125. package/radial/radial-chart.js +42 -10
  126. package/radial/radial-chart.props.d.ts +14 -1
  127. package/radial/radial-chart.props.d.ts.map +1 -1
  128. package/radial/tooltip/default-radial-tooltip.d.ts +6 -0
  129. package/radial/tooltip/default-radial-tooltip.d.ts.map +1 -0
  130. package/radial/tooltip/default-radial-tooltip.js +52 -0
  131. package/radial/tooltip/index.d.ts +7 -0
  132. package/radial/tooltip/index.d.ts.map +1 -0
  133. package/radial/tooltip/index.js +4 -0
  134. package/radial/tooltip/radial-item-tooltip-presets.d.ts +5 -0
  135. package/radial/tooltip/radial-item-tooltip-presets.d.ts.map +1 -0
  136. package/radial/tooltip/radial-item-tooltip-presets.js +43 -0
  137. package/radial/tooltip/radial-item-tooltip.types.d.ts +23 -0
  138. package/radial/tooltip/radial-item-tooltip.types.d.ts.map +1 -0
  139. package/radial/tooltip/radial-item-tooltip.types.js +3 -0
  140. package/radial/tooltip/radial-item-tooltip.utils.d.ts +9 -0
  141. package/radial/tooltip/radial-item-tooltip.utils.d.ts.map +1 -0
  142. package/radial/tooltip/radial-item-tooltip.utils.js +122 -0
  143. package/radial/tooltip/use-radial-item-tooltip.d.ts +22 -0
  144. package/radial/tooltip/use-radial-item-tooltip.d.ts.map +1 -0
  145. package/radial/tooltip/use-radial-item-tooltip.js +43 -0
  146. package/scatter/index.d.ts +1 -0
  147. package/scatter/index.d.ts.map +1 -1
  148. package/scatter/index.js +1 -0
  149. package/scatter/scatter-chart.d.ts.map +1 -1
  150. package/scatter/scatter-chart.js +46 -12
  151. package/scatter/scatter-chart.props.d.ts +7 -1
  152. package/scatter/scatter-chart.props.d.ts.map +1 -1
  153. package/scatter/tooltip/default-scatter-tooltip.d.ts +8 -0
  154. package/scatter/tooltip/default-scatter-tooltip.d.ts.map +1 -0
  155. package/scatter/tooltip/default-scatter-tooltip.js +57 -0
  156. package/scatter/tooltip/index.d.ts +7 -0
  157. package/scatter/tooltip/index.d.ts.map +1 -0
  158. package/scatter/tooltip/index.js +4 -0
  159. package/scatter/tooltip/scatter-item-tooltip-presets.d.ts +5 -0
  160. package/scatter/tooltip/scatter-item-tooltip-presets.d.ts.map +1 -0
  161. package/scatter/tooltip/scatter-item-tooltip-presets.js +49 -0
  162. package/scatter/tooltip/scatter-item-tooltip.types.d.ts +22 -0
  163. package/scatter/tooltip/scatter-item-tooltip.types.d.ts.map +1 -0
  164. package/scatter/tooltip/scatter-item-tooltip.types.js +3 -0
  165. package/scatter/tooltip/scatter-item-tooltip.utils.d.ts +9 -0
  166. package/scatter/tooltip/scatter-item-tooltip.utils.d.ts.map +1 -0
  167. package/scatter/tooltip/scatter-item-tooltip.utils.js +83 -0
  168. package/scatter/tooltip/use-scatter-item-tooltip.d.ts +25 -0
  169. package/scatter/tooltip/use-scatter-item-tooltip.d.ts.map +1 -0
  170. package/scatter/tooltip/use-scatter-item-tooltip.js +46 -0
  171. package/tooltip/chart-pointer-tooltip-overlay.d.ts +11 -0
  172. package/tooltip/chart-pointer-tooltip-overlay.d.ts.map +1 -0
  173. package/tooltip/chart-pointer-tooltip-overlay.js +88 -0
  174. package/tooltip/chart-tooltip-preset-shells.d.ts +66 -0
  175. package/tooltip/chart-tooltip-preset-shells.d.ts.map +1 -0
  176. package/tooltip/chart-tooltip-preset-shells.js +409 -0
  177. package/tooltip/index.d.ts +7 -0
  178. package/tooltip/index.d.ts.map +1 -0
  179. package/tooltip/index.js +1 -0
@@ -0,0 +1,409 @@
1
+ import React, { useMemo } from 'react';
2
+ import { StyleSheet, Text, View } from 'react-native';
3
+ import { DARK_THEME, useChartTheme } from '../chart-theme.context';
4
+ function isLightBackground(color) {
5
+ const hex = color.trim().replace(/^#/, '');
6
+ if (!/^[0-9a-f]{3}$|^[0-9a-f]{6}$/i.test(hex))
7
+ return true;
8
+ const h = hex.length === 3 ? hex.split('').map((c) => c + c).join('') : hex;
9
+ const r = parseInt(h.slice(0, 2), 16) / 255;
10
+ const g = parseInt(h.slice(2, 4), 16) / 255;
11
+ const b = parseInt(h.slice(4, 6), 16) / 255;
12
+ const lum = 0.2126 * r + 0.7152 * g + 0.0722 * b;
13
+ return lum > 0.65;
14
+ }
15
+ function hexToRgba(hex, alpha) {
16
+ const h = hex.trim().replace(/^#/, '');
17
+ const full = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
18
+ if (full.length !== 6)
19
+ return `rgba(15,23,42,${alpha})`;
20
+ const r = parseInt(full.slice(0, 2), 16);
21
+ const g = parseInt(full.slice(2, 4), 16);
22
+ const b = parseInt(full.slice(4, 6), 16);
23
+ return `rgba(${r},${g},${b},${alpha})`;
24
+ }
25
+ function parseHexRgb(hex) {
26
+ const raw = hex.trim().replace(/^#/, '');
27
+ if (!/^[0-9a-f]{3}$|^[0-9a-f]{6}$/i.test(raw))
28
+ return null;
29
+ const full = raw.length === 3 ? raw.split('').map((c) => c + c).join('') : raw;
30
+ if (full.length !== 6)
31
+ return null;
32
+ return {
33
+ r: parseInt(full.slice(0, 2), 16),
34
+ g: parseInt(full.slice(2, 4), 16),
35
+ b: parseInt(full.slice(4, 6), 16),
36
+ };
37
+ }
38
+ function rgbToHex(r, g, b) {
39
+ const c = (n) => Math.max(0, Math.min(255, Math.round(n)))
40
+ .toString(16)
41
+ .padStart(2, '0');
42
+ return `#${c(r)}${c(g)}${c(b)}`;
43
+ }
44
+ function rgbMaxChannelDelta(a, b) {
45
+ return Math.max(Math.abs(a.r - b.r), Math.abs(a.g - b.g), Math.abs(a.b - b.b));
46
+ }
47
+ function useTooltipPresetTokens() {
48
+ const { theme } = useChartTheme();
49
+ return useMemo(() => {
50
+ const t = theme.tooltip;
51
+ const ax = theme.axis.x;
52
+ const lightTooltipBg = isLightBackground(t.backgroundColor);
53
+ const dt = DARK_THEME.tooltip;
54
+ const padH = Math.max(12, t.padding * 5);
55
+ const padV = Math.max(10, t.padding * 5);
56
+ const radius = Math.max(8, t.borderRadius);
57
+ const card = {
58
+ shell: {
59
+ alignSelf: 'flex-start',
60
+ paddingHorizontal: padH,
61
+ paddingVertical: padV,
62
+ borderRadius: radius,
63
+ backgroundColor: t.backgroundColor,
64
+ borderWidth: t.borderWidth,
65
+ borderColor: t.borderColor,
66
+ shadowColor: '#000',
67
+ shadowOffset: { width: 0, height: 4 },
68
+ shadowOpacity: 0.12,
69
+ shadowRadius: 8,
70
+ elevation: 4,
71
+ },
72
+ eyebrow: { fontSize: 11, fontWeight: '700', color: t.labelColor, marginBottom: 6 },
73
+ axisCategoryTitle: {
74
+ fontSize: 12,
75
+ fontWeight: '700',
76
+ color: t.labelColor,
77
+ marginBottom: 6,
78
+ },
79
+ cardHeaderTitleSm: { fontSize: 12, fontWeight: '700', color: t.labelColor },
80
+ cardHeaderTitleMd: { fontSize: 13, fontWeight: '700', color: t.valueColor },
81
+ cardSeriesLabel: { fontSize: 14, color: t.labelColor },
82
+ cardSeriesValue: {
83
+ fontSize: 14,
84
+ fontWeight: '700',
85
+ color: t.valueColor,
86
+ flexShrink: 0,
87
+ },
88
+ };
89
+ const kpi = {
90
+ shell: {
91
+ alignSelf: 'flex-start',
92
+ padding: padV,
93
+ borderRadius: radius,
94
+ backgroundColor: t.backgroundColor,
95
+ borderLeftWidth: 4,
96
+ },
97
+ overline: { fontSize: 11, color: t.labelColor, textTransform: 'uppercase' },
98
+ metric: { fontSize: 28, fontWeight: '800', color: t.valueColor, marginTop: 4 },
99
+ caption: { fontSize: 11, color: t.labelColor, marginTop: 2 },
100
+ footerRule: {
101
+ marginTop: 10,
102
+ paddingTop: 10,
103
+ borderTopWidth: StyleSheet.hairlineWidth,
104
+ borderTopColor: t.borderColor,
105
+ },
106
+ footerLeft: { fontSize: 12, color: t.labelColor },
107
+ footerRight: {
108
+ fontSize: 12,
109
+ fontWeight: '600',
110
+ color: t.valueColor,
111
+ flexShrink: 0,
112
+ },
113
+ };
114
+ const compactBg = lightTooltipBg
115
+ ? hexToRgba(dt.backgroundColor, 0.92)
116
+ : hexToRgba(t.backgroundColor, 0.95);
117
+ const compactEmph = lightTooltipBg ? dt.valueColor : t.valueColor;
118
+ const compactDetail = lightTooltipBg ? dt.labelColor : t.labelColor;
119
+ const compact = {
120
+ shell: {
121
+ alignSelf: 'flex-start',
122
+ flexDirection: 'row',
123
+ alignItems: 'center',
124
+ paddingVertical: 6,
125
+ paddingHorizontal: 10,
126
+ borderRadius: Math.max(16, radius + 8),
127
+ backgroundColor: compactBg,
128
+ minWidth: 0,
129
+ },
130
+ emphasis: {
131
+ fontSize: 12,
132
+ fontWeight: '700',
133
+ color: compactEmph,
134
+ marginRight: 8,
135
+ flexShrink: 0,
136
+ },
137
+ detail: { fontSize: 12, color: compactDetail },
138
+ };
139
+ const striped = {
140
+ outer: {
141
+ alignSelf: 'flex-start',
142
+ alignItems: 'flex-start',
143
+ borderRadius: Math.max(6, t.borderRadius - 1),
144
+ overflow: 'hidden',
145
+ borderWidth: t.borderWidth,
146
+ borderColor: t.borderColor,
147
+ },
148
+ headerBand: {
149
+ paddingHorizontal: 10,
150
+ paddingVertical: 8,
151
+ backgroundColor: ax.splitLineColor,
152
+ },
153
+ headerTitle: { fontSize: 13, fontWeight: '700', color: t.valueColor },
154
+ rowRight: { fontSize: 13, fontWeight: '600', color: t.valueColor, flexShrink: 0 },
155
+ rowLeftText: { fontSize: 13, color: t.labelColor },
156
+ };
157
+ return {
158
+ t,
159
+ card,
160
+ kpi,
161
+ compact,
162
+ striped,
163
+ };
164
+ }, [theme]);
165
+ }
166
+ /** White card + shadow (axis category + series, or item header + body). */
167
+ export function TooltipPresetCard({ minWidth, eyebrow, categoryTitle, header, seriesRows, keyValueRows, children, }) {
168
+ const { card, t } = useTooltipPresetTokens();
169
+ return (<View style={[card.shell, minWidth != null && { minWidth }]}>
170
+ {eyebrow != null && eyebrow !== '' ? <Text style={card.eyebrow}>{eyebrow}</Text> : null}
171
+ {categoryTitle != null && categoryTitle !== '' ? (<Text style={card.axisCategoryTitle}>{String(categoryTitle)}</Text>) : null}
172
+ {header != null ? (<View style={[styles.cardHeaderRow, { marginBottom: header.marginBottom ?? 8 }]}>
173
+ {header.swatchColor != null && header.swatchColor !== '' ? (<View style={[styles.swatchRound, { backgroundColor: header.swatchColor }]}/>) : null}
174
+ <View style={styles.cardHeaderTitleCell}>
175
+ <Text style={header.titleVariant === 'emphasis' ? card.cardHeaderTitleMd : card.cardHeaderTitleSm}>
176
+ {header.title}
177
+ </Text>
178
+ </View>
179
+ </View>) : null}
180
+ {seriesRows?.map((r) => (<View key={String(r.key)} style={styles.cardSeriesRow}>
181
+ <View style={[styles.swatchRound, { backgroundColor: r.swatchColor }]}/>
182
+ <View style={styles.cardSeriesLabelCell}>
183
+ <Text style={card.cardSeriesLabel}>{r.label}</Text>
184
+ </View>
185
+ <Text style={card.cardSeriesValue}>{r.value}</Text>
186
+ </View>))}
187
+ {keyValueRows?.map((r) => (<View key={r.key} style={styles.kvRow}>
188
+ <View style={styles.kvRowLeftCell}>
189
+ <Text style={[styles.kvRowText, { color: t.labelColor }]}>{r.left}</Text>
190
+ </View>
191
+ <Text style={[styles.kvRowText, { color: t.valueColor, fontWeight: '700', flexShrink: 0 }]}>
192
+ {r.right}
193
+ </Text>
194
+ </View>))}
195
+ {children}
196
+ </View>);
197
+ }
198
+ /** Pill chip on dark glass. */
199
+ export function TooltipPresetCompact({ emphasis, detail, wrap = true, }) {
200
+ const { compact } = useTooltipPresetTokens();
201
+ return (<View style={[compact.shell, wrap && styles.compactShellWrap]}>
202
+ <Text style={compact.emphasis}>{emphasis}</Text>
203
+ <View style={styles.compactDetailCell}>
204
+ <Text style={compact.detail}>{detail}</Text>
205
+ </View>
206
+ </View>);
207
+ }
208
+ /** KPI strip with optional footer metric rows. */
209
+ export function TooltipPresetKpi({ accentColor, minWidth = 140, overline, metric, caption, footerRows, }) {
210
+ const { kpi } = useTooltipPresetTokens();
211
+ return (<View style={[kpi.shell, { borderLeftColor: accentColor, minWidth }]}>
212
+ <Text style={kpi.overline}>{overline}</Text>
213
+ {typeof metric === 'string' || typeof metric === 'number' ? (<Text style={kpi.metric}>{String(metric)}</Text>) : (metric)}
214
+ {caption != null && caption !== '' ? <Text style={kpi.caption}>{caption}</Text> : null}
215
+ {footerRows != null && footerRows.length > 0 ? (<View style={kpi.footerRule}>
216
+ {footerRows.map((r) => (<View key={String(r.key)} style={styles.kpiFooterRow}>
217
+ <View style={styles.kpiFooterLeftCell}>
218
+ <Text style={kpi.footerLeft}>{r.left}</Text>
219
+ </View>
220
+ <Text style={kpi.footerRight}>{r.right}</Text>
221
+ </View>))}
222
+ </View>) : null}
223
+ </View>);
224
+ }
225
+ /** Banded header + zebra rows. */
226
+ export function TooltipPresetStriped({ header, headerTitle, headerSwatch, rows, }) {
227
+ const { striped, t } = useTooltipPresetTokens();
228
+ let headerNode;
229
+ if (header != null) {
230
+ headerNode = header;
231
+ }
232
+ else if (headerSwatch != null) {
233
+ headerNode = (<View style={styles.stripedHeaderInner}>
234
+ <View style={[styles.swatchSmall, { backgroundColor: headerSwatch.color }]}/>
235
+ <View style={styles.stripedHeaderTitleCell}>
236
+ <Text style={striped.headerTitle}>{headerSwatch.title}</Text>
237
+ </View>
238
+ </View>);
239
+ }
240
+ else if (headerTitle != null) {
241
+ headerNode = <Text style={striped.headerTitle}>{headerTitle}</Text>;
242
+ }
243
+ else {
244
+ headerNode = null;
245
+ }
246
+ return (<View style={striped.outer}>
247
+ <View style={styles.stripedInner}>
248
+ <View style={striped.headerBand}>{headerNode}</View>
249
+ {rows.map((r, i) => (<View key={r.key} style={[
250
+ styles.stripedRow,
251
+ {
252
+ backgroundColor: i % 2 === 0 ? t.backgroundColor : stripedAltRowBg(t.backgroundColor, t.borderColor),
253
+ },
254
+ ]}>
255
+ <View style={styles.stripedRowLeft}>
256
+ {r.left != null ? (r.left) : (<>
257
+ {r.leftSwatchColor != null ? (<View style={[styles.swatchSmall, { backgroundColor: r.leftSwatchColor }]}/>) : null}
258
+ <View style={styles.stripedRowLeftLabelCell}>
259
+ <Text style={striped.rowLeftText}>{r.leftLabel ?? ''}</Text>
260
+ </View>
261
+ </>)}
262
+ </View>
263
+ <Text style={striped.rowRight}>{String(r.right)}</Text>
264
+ </View>))}
265
+ </View>
266
+ </View>);
267
+ }
268
+ /** Between slate-300 and slate-400: zebra when border ≈ bg without overpowering the base row. */
269
+ const STRIPE_NEUTRAL_LIGHT = { r: 176, g: 188, b: 205 };
270
+ /**
271
+ * Alternate striped row fill: opaque blend of tooltip bg toward border.
272
+ * Light themes often use #fff + light gray border; a weak blend matches the base row—use a
273
+ * stronger mix and fall back to a neutral gray when border is missing or too close to bg.
274
+ */
275
+ function stripedAltRowBg(bg, border) {
276
+ const base = parseHexRgb(bg);
277
+ if (base == null) {
278
+ return isLightBackground(bg) ? '#f1f5f9' : '#1e293b';
279
+ }
280
+ const light = isLightBackground(bg);
281
+ const edge = parseHexRgb(border);
282
+ const sameAsBase = edge != null && rgbMaxChannelDelta(base, edge) < 4;
283
+ let mix = edge != null && !sameAsBase ? edge : light ? STRIPE_NEUTRAL_LIGHT : { r: 255, g: 255, b: 255 };
284
+ let t = light ? 0.5 : 0.32;
285
+ let r = base.r * (1 - t) + mix.r * t;
286
+ let g = base.g * (1 - t) + mix.g * t;
287
+ let b = base.b * (1 - t) + mix.b * t;
288
+ if (rgbMaxChannelDelta(base, { r, g, b }) < 14) {
289
+ t = light ? 0.66 : 0.46;
290
+ r = base.r * (1 - t) + mix.r * t;
291
+ g = base.g * (1 - t) + mix.g * t;
292
+ b = base.b * (1 - t) + mix.b * t;
293
+ }
294
+ if (rgbMaxChannelDelta(base, { r, g, b }) < 10) {
295
+ mix = light ? STRIPE_NEUTRAL_LIGHT : { r: 255, g: 255, b: 255 };
296
+ t = light ? 0.28 : 0.3;
297
+ r = base.r * (1 - t) + mix.r * t;
298
+ g = base.g * (1 - t) + mix.g * t;
299
+ b = base.b * (1 - t) + mix.b * t;
300
+ }
301
+ return rgbToHex(r, g, b);
302
+ }
303
+ const styles = StyleSheet.create({
304
+ swatchRound: {
305
+ width: 10,
306
+ height: 10,
307
+ borderRadius: 5,
308
+ marginRight: 10,
309
+ },
310
+ swatchSmall: {
311
+ width: 8,
312
+ height: 8,
313
+ borderRadius: 2,
314
+ marginRight: 8,
315
+ },
316
+ cardHeaderRow: {
317
+ flexDirection: 'row',
318
+ alignItems: 'center',
319
+ minWidth: 0,
320
+ },
321
+ cardHeaderTitleCell: {
322
+ flexGrow: 1,
323
+ flexShrink: 1,
324
+ minWidth: 0,
325
+ },
326
+ cardSeriesRow: {
327
+ flexDirection: 'row',
328
+ alignItems: 'center',
329
+ marginTop: 6,
330
+ minWidth: 0,
331
+ },
332
+ cardSeriesLabelCell: {
333
+ flexGrow: 1,
334
+ flexShrink: 1,
335
+ minWidth: 0,
336
+ marginRight: 8,
337
+ },
338
+ kvRow: {
339
+ flexDirection: 'row',
340
+ justifyContent: 'space-between',
341
+ alignItems: 'center',
342
+ marginTop: 4,
343
+ minWidth: 0,
344
+ },
345
+ kvRowLeftCell: {
346
+ flexGrow: 1,
347
+ flexShrink: 1,
348
+ minWidth: 0,
349
+ marginRight: 8,
350
+ },
351
+ kvRowText: {
352
+ fontSize: 13,
353
+ },
354
+ compactShellWrap: {
355
+ flexWrap: 'wrap',
356
+ },
357
+ compactDetailCell: {
358
+ flexGrow: 1,
359
+ flexShrink: 1,
360
+ minWidth: 0,
361
+ },
362
+ kpiFooterRow: {
363
+ flexDirection: 'row',
364
+ justifyContent: 'space-between',
365
+ alignItems: 'center',
366
+ marginTop: 4,
367
+ minWidth: 0,
368
+ },
369
+ kpiFooterLeftCell: {
370
+ flexGrow: 1,
371
+ flexShrink: 1,
372
+ minWidth: 0,
373
+ marginRight: 8,
374
+ },
375
+ stripedInner: {
376
+ alignItems: 'stretch',
377
+ minWidth: 0,
378
+ },
379
+ stripedHeaderInner: {
380
+ flexDirection: 'row',
381
+ alignItems: 'center',
382
+ minWidth: 0,
383
+ },
384
+ stripedHeaderTitleCell: {
385
+ flexGrow: 1,
386
+ flexShrink: 1,
387
+ minWidth: 0,
388
+ },
389
+ stripedRow: {
390
+ flexDirection: 'row',
391
+ justifyContent: 'space-between',
392
+ alignItems: 'center',
393
+ paddingHorizontal: 10,
394
+ paddingVertical: 6,
395
+ minWidth: 0,
396
+ },
397
+ stripedRowLeft: {
398
+ flexDirection: 'row',
399
+ alignItems: 'center',
400
+ flexGrow: 1,
401
+ flexShrink: 1,
402
+ minWidth: 0,
403
+ marginRight: 8,
404
+ },
405
+ stripedRowLeftLabelCell: {
406
+ flexShrink: 1,
407
+ minWidth: 0,
408
+ },
409
+ });
@@ -0,0 +1,7 @@
1
+ export { ChartPointerTooltipOverlay, } from './chart-pointer-tooltip-overlay';
2
+ export type { ChartPointerTooltipOverlayProps } from './chart-pointer-tooltip-overlay';
3
+ /** Built-in tooltip layout when `renderTooltip` is not provided. */
4
+ export type ChartTooltipPreset = 'card' | 'compact' | 'kpi' | 'striped';
5
+ /** Tooltip preset or `none` to hide the React Native tooltip overlay. */
6
+ export type ChartTooltipOption = ChartTooltipPreset | 'none';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AACvF,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;AAExE,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG,MAAM,CAAC"}
@@ -0,0 +1 @@
1
+ export { ChartPointerTooltipOverlay, } from './chart-pointer-tooltip-overlay';