@oxyhq/bloom 0.29.6 → 0.30.0

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 (183) hide show
  1. package/lib/commonjs/activity-heatmap/ActivityHeatmap.js +304 -0
  2. package/lib/commonjs/activity-heatmap/ActivityHeatmap.js.map +1 -0
  3. package/lib/commonjs/activity-heatmap/bucketByDay.js +51 -0
  4. package/lib/commonjs/activity-heatmap/bucketByDay.js.map +1 -0
  5. package/lib/commonjs/activity-heatmap/index.js +20 -0
  6. package/lib/commonjs/activity-heatmap/index.js.map +1 -0
  7. package/lib/commonjs/activity-heatmap/types.js +6 -0
  8. package/lib/commonjs/activity-heatmap/types.js.map +1 -0
  9. package/lib/commonjs/avatar-group/AvatarGroupBase.js +42 -18
  10. package/lib/commonjs/avatar-group/AvatarGroupBase.js.map +1 -1
  11. package/lib/commonjs/composition-bar/CompositionBar.js +159 -0
  12. package/lib/commonjs/composition-bar/CompositionBar.js.map +1 -0
  13. package/lib/commonjs/composition-bar/index.js +13 -0
  14. package/lib/commonjs/composition-bar/index.js.map +1 -0
  15. package/lib/commonjs/composition-bar/types.js +6 -0
  16. package/lib/commonjs/composition-bar/types.js.map +1 -0
  17. package/lib/commonjs/dot-grid-meter/DotGridMeter.js +69 -0
  18. package/lib/commonjs/dot-grid-meter/DotGridMeter.js.map +1 -0
  19. package/lib/commonjs/dot-grid-meter/index.js +13 -0
  20. package/lib/commonjs/dot-grid-meter/index.js.map +1 -0
  21. package/lib/commonjs/dot-grid-meter/types.js +6 -0
  22. package/lib/commonjs/dot-grid-meter/types.js.map +1 -0
  23. package/lib/commonjs/index.js +59 -12
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/index.web.js +59 -12
  26. package/lib/commonjs/index.web.js.map +1 -1
  27. package/lib/commonjs/profile-card/ProfileCard.js +301 -0
  28. package/lib/commonjs/profile-card/ProfileCard.js.map +1 -0
  29. package/lib/commonjs/profile-card/index.js +13 -0
  30. package/lib/commonjs/profile-card/index.js.map +1 -0
  31. package/lib/commonjs/profile-card/types.js +6 -0
  32. package/lib/commonjs/profile-card/types.js.map +1 -0
  33. package/lib/commonjs/stat-bar/StatBar.js +210 -0
  34. package/lib/commonjs/stat-bar/StatBar.js.map +1 -0
  35. package/lib/commonjs/stat-bar/index.js +13 -0
  36. package/lib/commonjs/stat-bar/index.js.map +1 -0
  37. package/lib/commonjs/stat-bar/types.js +6 -0
  38. package/lib/commonjs/stat-bar/types.js.map +1 -0
  39. package/lib/module/activity-heatmap/ActivityHeatmap.js +299 -0
  40. package/lib/module/activity-heatmap/ActivityHeatmap.js.map +1 -0
  41. package/lib/module/activity-heatmap/bucketByDay.js +47 -0
  42. package/lib/module/activity-heatmap/bucketByDay.js.map +1 -0
  43. package/lib/module/activity-heatmap/index.js +5 -0
  44. package/lib/module/activity-heatmap/index.js.map +1 -0
  45. package/lib/module/activity-heatmap/types.js +4 -0
  46. package/lib/module/activity-heatmap/types.js.map +1 -0
  47. package/lib/module/avatar-group/AvatarGroupBase.js +42 -18
  48. package/lib/module/avatar-group/AvatarGroupBase.js.map +1 -1
  49. package/lib/module/composition-bar/CompositionBar.js +154 -0
  50. package/lib/module/composition-bar/CompositionBar.js.map +1 -0
  51. package/lib/module/composition-bar/index.js +4 -0
  52. package/lib/module/composition-bar/index.js.map +1 -0
  53. package/lib/module/composition-bar/types.js +4 -0
  54. package/lib/module/composition-bar/types.js.map +1 -0
  55. package/lib/module/dot-grid-meter/DotGridMeter.js +64 -0
  56. package/lib/module/dot-grid-meter/DotGridMeter.js.map +1 -0
  57. package/lib/module/dot-grid-meter/index.js +4 -0
  58. package/lib/module/dot-grid-meter/index.js.map +1 -0
  59. package/lib/module/dot-grid-meter/types.js +4 -0
  60. package/lib/module/dot-grid-meter/types.js.map +1 -0
  61. package/lib/module/index.js +6 -0
  62. package/lib/module/index.js.map +1 -1
  63. package/lib/module/index.web.js +6 -0
  64. package/lib/module/index.web.js.map +1 -1
  65. package/lib/module/profile-card/ProfileCard.js +296 -0
  66. package/lib/module/profile-card/ProfileCard.js.map +1 -0
  67. package/lib/module/profile-card/index.js +4 -0
  68. package/lib/module/profile-card/index.js.map +1 -0
  69. package/lib/module/profile-card/types.js +4 -0
  70. package/lib/module/profile-card/types.js.map +1 -0
  71. package/lib/module/stat-bar/StatBar.js +205 -0
  72. package/lib/module/stat-bar/StatBar.js.map +1 -0
  73. package/lib/module/stat-bar/index.js +4 -0
  74. package/lib/module/stat-bar/index.js.map +1 -0
  75. package/lib/module/stat-bar/types.js +4 -0
  76. package/lib/module/stat-bar/types.js.map +1 -0
  77. package/lib/typescript/commonjs/activity-heatmap/ActivityHeatmap.d.ts +4 -0
  78. package/lib/typescript/commonjs/activity-heatmap/ActivityHeatmap.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/activity-heatmap/bucketByDay.d.ts +9 -0
  80. package/lib/typescript/commonjs/activity-heatmap/bucketByDay.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/activity-heatmap/index.d.ts +4 -0
  82. package/lib/typescript/commonjs/activity-heatmap/index.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/activity-heatmap/types.d.ts +73 -0
  84. package/lib/typescript/commonjs/activity-heatmap/types.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/avatar-group/AvatarGroupBase.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/avatar-group/types.d.ts +15 -1
  87. package/lib/typescript/commonjs/avatar-group/types.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/composition-bar/CompositionBar.d.ts +4 -0
  89. package/lib/typescript/commonjs/composition-bar/CompositionBar.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/composition-bar/index.d.ts +3 -0
  91. package/lib/typescript/commonjs/composition-bar/index.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/composition-bar/types.d.ts +29 -0
  93. package/lib/typescript/commonjs/composition-bar/types.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/dot-grid-meter/DotGridMeter.d.ts +4 -0
  95. package/lib/typescript/commonjs/dot-grid-meter/DotGridMeter.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/dot-grid-meter/index.d.ts +3 -0
  97. package/lib/typescript/commonjs/dot-grid-meter/index.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/dot-grid-meter/types.d.ts +36 -0
  99. package/lib/typescript/commonjs/dot-grid-meter/types.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/index.d.ts +10 -0
  101. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/index.web.d.ts +10 -0
  103. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/profile-card/ProfileCard.d.ts +4 -0
  105. package/lib/typescript/commonjs/profile-card/ProfileCard.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/profile-card/index.d.ts +3 -0
  107. package/lib/typescript/commonjs/profile-card/index.d.ts.map +1 -0
  108. package/lib/typescript/commonjs/profile-card/types.d.ts +86 -0
  109. package/lib/typescript/commonjs/profile-card/types.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/stat-bar/StatBar.d.ts +4 -0
  111. package/lib/typescript/commonjs/stat-bar/StatBar.d.ts.map +1 -0
  112. package/lib/typescript/commonjs/stat-bar/index.d.ts +3 -0
  113. package/lib/typescript/commonjs/stat-bar/index.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/stat-bar/types.d.ts +62 -0
  115. package/lib/typescript/commonjs/stat-bar/types.d.ts.map +1 -0
  116. package/lib/typescript/module/activity-heatmap/ActivityHeatmap.d.ts +4 -0
  117. package/lib/typescript/module/activity-heatmap/ActivityHeatmap.d.ts.map +1 -0
  118. package/lib/typescript/module/activity-heatmap/bucketByDay.d.ts +9 -0
  119. package/lib/typescript/module/activity-heatmap/bucketByDay.d.ts.map +1 -0
  120. package/lib/typescript/module/activity-heatmap/index.d.ts +4 -0
  121. package/lib/typescript/module/activity-heatmap/index.d.ts.map +1 -0
  122. package/lib/typescript/module/activity-heatmap/types.d.ts +73 -0
  123. package/lib/typescript/module/activity-heatmap/types.d.ts.map +1 -0
  124. package/lib/typescript/module/avatar-group/AvatarGroupBase.d.ts.map +1 -1
  125. package/lib/typescript/module/avatar-group/types.d.ts +15 -1
  126. package/lib/typescript/module/avatar-group/types.d.ts.map +1 -1
  127. package/lib/typescript/module/composition-bar/CompositionBar.d.ts +4 -0
  128. package/lib/typescript/module/composition-bar/CompositionBar.d.ts.map +1 -0
  129. package/lib/typescript/module/composition-bar/index.d.ts +3 -0
  130. package/lib/typescript/module/composition-bar/index.d.ts.map +1 -0
  131. package/lib/typescript/module/composition-bar/types.d.ts +29 -0
  132. package/lib/typescript/module/composition-bar/types.d.ts.map +1 -0
  133. package/lib/typescript/module/dot-grid-meter/DotGridMeter.d.ts +4 -0
  134. package/lib/typescript/module/dot-grid-meter/DotGridMeter.d.ts.map +1 -0
  135. package/lib/typescript/module/dot-grid-meter/index.d.ts +3 -0
  136. package/lib/typescript/module/dot-grid-meter/index.d.ts.map +1 -0
  137. package/lib/typescript/module/dot-grid-meter/types.d.ts +36 -0
  138. package/lib/typescript/module/dot-grid-meter/types.d.ts.map +1 -0
  139. package/lib/typescript/module/index.d.ts +10 -0
  140. package/lib/typescript/module/index.d.ts.map +1 -1
  141. package/lib/typescript/module/index.web.d.ts +10 -0
  142. package/lib/typescript/module/index.web.d.ts.map +1 -1
  143. package/lib/typescript/module/profile-card/ProfileCard.d.ts +4 -0
  144. package/lib/typescript/module/profile-card/ProfileCard.d.ts.map +1 -0
  145. package/lib/typescript/module/profile-card/index.d.ts +3 -0
  146. package/lib/typescript/module/profile-card/index.d.ts.map +1 -0
  147. package/lib/typescript/module/profile-card/types.d.ts +86 -0
  148. package/lib/typescript/module/profile-card/types.d.ts.map +1 -0
  149. package/lib/typescript/module/stat-bar/StatBar.d.ts +4 -0
  150. package/lib/typescript/module/stat-bar/StatBar.d.ts.map +1 -0
  151. package/lib/typescript/module/stat-bar/index.d.ts +3 -0
  152. package/lib/typescript/module/stat-bar/index.d.ts.map +1 -0
  153. package/lib/typescript/module/stat-bar/types.d.ts +62 -0
  154. package/lib/typescript/module/stat-bar/types.d.ts.map +1 -0
  155. package/package.json +56 -1
  156. package/src/__tests__/StatWidgets.test.tsx +184 -0
  157. package/src/__tests__/public-api-contract.test.ts +15 -0
  158. package/src/activity-heatmap/ActivityHeatmap.stories.tsx +108 -0
  159. package/src/activity-heatmap/ActivityHeatmap.tsx +289 -0
  160. package/src/activity-heatmap/bucketByDay.ts +49 -0
  161. package/src/activity-heatmap/index.ts +3 -0
  162. package/src/activity-heatmap/types.ts +74 -0
  163. package/src/avatar-group/AvatarGroup.stories.tsx +14 -0
  164. package/src/avatar-group/AvatarGroupBase.tsx +39 -18
  165. package/src/avatar-group/types.ts +15 -1
  166. package/src/composition-bar/CompositionBar.stories.tsx +70 -0
  167. package/src/composition-bar/CompositionBar.tsx +161 -0
  168. package/src/composition-bar/index.ts +2 -0
  169. package/src/composition-bar/types.ts +30 -0
  170. package/src/dot-grid-meter/DotGridMeter.stories.tsx +47 -0
  171. package/src/dot-grid-meter/DotGridMeter.tsx +71 -0
  172. package/src/dot-grid-meter/index.ts +2 -0
  173. package/src/dot-grid-meter/types.ts +36 -0
  174. package/src/index.ts +24 -0
  175. package/src/index.web.ts +24 -0
  176. package/src/profile-card/ProfileCard.stories.tsx +210 -0
  177. package/src/profile-card/ProfileCard.tsx +303 -0
  178. package/src/profile-card/index.ts +9 -0
  179. package/src/profile-card/types.ts +86 -0
  180. package/src/stat-bar/StatBar.stories.tsx +61 -0
  181. package/src/stat-bar/StatBar.tsx +156 -0
  182. package/src/stat-bar/index.ts +7 -0
  183. package/src/stat-bar/types.ts +65 -0
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+
3
+ import React, { memo } from 'react';
4
+ import { View, StyleSheet } from 'react-native';
5
+ import { Card } from "../card/index.js";
6
+ import { Avatar } from "../avatar/index.js";
7
+ import { AvatarGroup } from "../avatar-group/index.js";
8
+ import { DotGridMeter } from "../dot-grid-meter/index.js";
9
+ import { StatBar } from "../stat-bar/index.js";
10
+ import { Text } from "../typography/index.js";
11
+ import { useTheme } from "../theme/use-theme.js";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ const WIDGET_WIDTH = 240;
14
+ const CARD_PADDING = 16;
15
+ const CARD_RADIUS = 24;
16
+ const AVATAR_SIZE = 52;
17
+ const FOOTER_AVATAR_SIZE = 28;
18
+ function variantAccents(variant, colors) {
19
+ switch (variant) {
20
+ case 'wallet':
21
+ return {
22
+ ring: colors.success,
23
+ fill: colors.primary,
24
+ dots: colors.success
25
+ };
26
+ case 'shopping':
27
+ return {
28
+ ring: colors.info,
29
+ fill: colors.info,
30
+ dots: colors.info
31
+ };
32
+ case 'social':
33
+ return {
34
+ ring: colors.primary,
35
+ fill: colors.primary,
36
+ dots: colors.primary
37
+ };
38
+ case 'stat':
39
+ default:
40
+ return {
41
+ ring: colors.primary,
42
+ fill: colors.primary,
43
+ dots: colors.primary
44
+ };
45
+ }
46
+ }
47
+ function AvatarWithBadge({
48
+ source,
49
+ name,
50
+ ring,
51
+ badge
52
+ }) {
53
+ return /*#__PURE__*/_jsxs(View, {
54
+ style: styles.avatarWrap,
55
+ children: [/*#__PURE__*/_jsx(Avatar, {
56
+ source: source ?? undefined,
57
+ name: name,
58
+ size: AVATAR_SIZE,
59
+ ring: ring
60
+ }), badge != null && /*#__PURE__*/_jsx(View, {
61
+ style: [styles.badge, {
62
+ width: Math.round(AVATAR_SIZE * 0.34),
63
+ height: Math.round(AVATAR_SIZE * 0.34)
64
+ }],
65
+ children: badge
66
+ })]
67
+ });
68
+ }
69
+ function MetricSection({
70
+ metric,
71
+ accents,
72
+ labelColor
73
+ }) {
74
+ switch (metric.kind) {
75
+ case 'dots':
76
+ return /*#__PURE__*/_jsxs(View, {
77
+ style: styles.section,
78
+ children: [metric.label != null && /*#__PURE__*/_jsx(Text, {
79
+ style: [styles.sectionLabel, {
80
+ color: labelColor
81
+ }],
82
+ numberOfLines: 1,
83
+ children: metric.label
84
+ }), /*#__PURE__*/_jsx(DotGridMeter, {
85
+ filled: metric.filled,
86
+ total: metric.total,
87
+ filledColor: metric.filledColor ?? accents.dots
88
+ })]
89
+ });
90
+ case 'progress':
91
+ return /*#__PURE__*/_jsx(StatBar, {
92
+ variant: "progress",
93
+ label: metric.label,
94
+ value: metric.value,
95
+ max: metric.max,
96
+ minLabel: metric.minLabel,
97
+ maxLabel: metric.maxLabel,
98
+ icon: metric.icon,
99
+ fillColor: metric.fillColor ?? accents.fill
100
+ });
101
+ case 'split':
102
+ return /*#__PURE__*/_jsx(StatBar, {
103
+ variant: "split",
104
+ label: metric.label,
105
+ percent: metric.percent,
106
+ leftValue: metric.leftValue,
107
+ rightValue: metric.rightValue,
108
+ fillColor: metric.fillColor ?? accents.fill
109
+ });
110
+ case 'custom':
111
+ default:
112
+ return /*#__PURE__*/_jsx(_Fragment, {
113
+ children: metric.node
114
+ });
115
+ }
116
+ }
117
+
118
+ /**
119
+ * A composed profile "widget" card — the Apple-Watch-style stat card. Fully
120
+ * app-agnostic: it takes pre-formatted strings, colors, and `ReactNode` icons
121
+ * (no domain/currency logic). Built on {@link Card}, {@link Avatar} (ring +
122
+ * badge), {@link DotGridMeter}/{@link StatBar}, and a {@link AvatarGroup} row.
123
+ *
124
+ * `variant` only picks sensible accent defaults (ring + metric fill); every
125
+ * accent stays overridable via the individual props.
126
+ */
127
+ const ProfileCardComponent = ({
128
+ layout = 'widget',
129
+ variant = 'stat',
130
+ avatar,
131
+ value,
132
+ subtitle,
133
+ headlineIcon,
134
+ metric,
135
+ footer,
136
+ onPress,
137
+ style,
138
+ testID
139
+ }) => {
140
+ const {
141
+ colors
142
+ } = useTheme();
143
+ const accents = variantAccents(variant, colors);
144
+ const isWide = layout === 'wide';
145
+ const ring = avatar.ring ?? {
146
+ colors: accents.ring,
147
+ width: 2,
148
+ gap: 2
149
+ };
150
+ const surfaceStyle = {
151
+ width: isWide ? '100%' : WIDGET_WIDTH,
152
+ padding: CARD_PADDING,
153
+ borderRadius: CARD_RADIUS,
154
+ borderCurve: 'continuous'
155
+ };
156
+ const headline = /*#__PURE__*/_jsxs(_Fragment, {
157
+ children: [/*#__PURE__*/_jsx(Text, {
158
+ style: [styles.value, {
159
+ color: colors.text
160
+ }],
161
+ numberOfLines: 1,
162
+ children: value
163
+ }), subtitle != null && /*#__PURE__*/_jsx(Text, {
164
+ style: [styles.subtitle, {
165
+ color: colors.textTertiary
166
+ }],
167
+ numberOfLines: 1,
168
+ children: subtitle
169
+ })]
170
+ });
171
+ const metricNode = metric != null ? /*#__PURE__*/_jsx(MetricSection, {
172
+ metric: metric,
173
+ accents: accents,
174
+ labelColor: colors.textTertiary
175
+ }) : null;
176
+ const footerNode = footer != null ? /*#__PURE__*/_jsxs(View, {
177
+ style: styles.section,
178
+ children: [footer.label != null && /*#__PURE__*/_jsx(Text, {
179
+ style: [styles.sectionLabel, {
180
+ color: colors.textTertiary
181
+ }],
182
+ numberOfLines: 1,
183
+ children: footer.label
184
+ }), /*#__PURE__*/_jsx(AvatarGroup, {
185
+ layout: "row",
186
+ items: footer.items,
187
+ size: FOOTER_AVATAR_SIZE,
188
+ max: footer.max ?? 4
189
+ })]
190
+ }) : null;
191
+ return /*#__PURE__*/_jsxs(Card, {
192
+ variant: "filled",
193
+ onPress: onPress,
194
+ style: [surfaceStyle, style],
195
+ testID: testID,
196
+ children: [/*#__PURE__*/_jsxs(View, {
197
+ style: styles.body,
198
+ children: [isWide ? /*#__PURE__*/_jsxs(View, {
199
+ style: styles.headerRowWide,
200
+ children: [/*#__PURE__*/_jsx(AvatarWithBadge, {
201
+ source: avatar.source,
202
+ name: avatar.name,
203
+ ring: ring,
204
+ badge: avatar.badge
205
+ }), /*#__PURE__*/_jsxs(View, {
206
+ style: styles.wideValueRow,
207
+ children: [/*#__PURE__*/_jsx(View, {
208
+ style: styles.headlineColumn,
209
+ children: headline
210
+ }), headlineIcon != null && /*#__PURE__*/_jsx(View, {
211
+ style: styles.wideIcon,
212
+ children: headlineIcon
213
+ })]
214
+ })]
215
+ }) : /*#__PURE__*/_jsxs(View, {
216
+ style: styles.headerRow,
217
+ children: [/*#__PURE__*/_jsx(AvatarWithBadge, {
218
+ source: avatar.source,
219
+ name: avatar.name,
220
+ ring: ring,
221
+ badge: avatar.badge
222
+ }), /*#__PURE__*/_jsx(View, {
223
+ style: styles.headlineColumn,
224
+ children: headline
225
+ })]
226
+ }), metricNode, footerNode]
227
+ }), !isWide && headlineIcon != null && /*#__PURE__*/_jsx(View, {
228
+ style: styles.floatingIcon,
229
+ children: headlineIcon
230
+ })]
231
+ });
232
+ };
233
+ const styles = StyleSheet.create({
234
+ body: {
235
+ gap: 16
236
+ },
237
+ headerRow: {
238
+ flexDirection: 'row',
239
+ alignItems: 'center',
240
+ gap: 12
241
+ },
242
+ headerRowWide: {
243
+ flexDirection: 'row',
244
+ alignItems: 'center',
245
+ gap: 16
246
+ },
247
+ headlineColumn: {
248
+ flex: 1,
249
+ minWidth: 0
250
+ },
251
+ wideValueRow: {
252
+ flex: 1,
253
+ flexDirection: 'row',
254
+ alignItems: 'center',
255
+ gap: 8
256
+ },
257
+ wideIcon: {
258
+ marginLeft: 8
259
+ },
260
+ value: {
261
+ fontSize: 26,
262
+ fontWeight: '800',
263
+ letterSpacing: -0.5,
264
+ fontVariant: ['tabular-nums']
265
+ },
266
+ subtitle: {
267
+ marginTop: 2,
268
+ fontSize: 13,
269
+ fontVariant: ['tabular-nums']
270
+ },
271
+ section: {
272
+ gap: 8
273
+ },
274
+ sectionLabel: {
275
+ fontSize: 12,
276
+ fontWeight: '500'
277
+ },
278
+ avatarWrap: {
279
+ position: 'relative'
280
+ },
281
+ badge: {
282
+ position: 'absolute',
283
+ right: -2,
284
+ bottom: -2,
285
+ alignItems: 'center',
286
+ justifyContent: 'center'
287
+ },
288
+ floatingIcon: {
289
+ position: 'absolute',
290
+ top: CARD_PADDING,
291
+ right: CARD_PADDING
292
+ }
293
+ });
294
+ export const ProfileCard = /*#__PURE__*/memo(ProfileCardComponent);
295
+ ProfileCard.displayName = 'ProfileCard';
296
+ //# sourceMappingURL=ProfileCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","View","StyleSheet","Card","Avatar","AvatarGroup","DotGridMeter","StatBar","Text","useTheme","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","WIDGET_WIDTH","CARD_PADDING","CARD_RADIUS","AVATAR_SIZE","FOOTER_AVATAR_SIZE","variantAccents","variant","colors","ring","success","fill","primary","dots","info","AvatarWithBadge","source","name","badge","style","styles","avatarWrap","children","undefined","size","width","Math","round","height","MetricSection","metric","accents","labelColor","kind","section","label","sectionLabel","color","numberOfLines","filled","total","filledColor","value","max","minLabel","maxLabel","icon","fillColor","percent","leftValue","rightValue","node","ProfileCardComponent","layout","avatar","subtitle","headlineIcon","footer","onPress","testID","isWide","gap","surfaceStyle","padding","borderRadius","borderCurve","headline","text","textTertiary","metricNode","footerNode","items","body","headerRowWide","wideValueRow","headlineColumn","wideIcon","headerRow","floatingIcon","create","flexDirection","alignItems","flex","minWidth","marginLeft","fontSize","fontWeight","letterSpacing","fontVariant","marginTop","position","right","bottom","justifyContent","top","ProfileCard","displayName"],"sourceRoot":"../../../src","sources":["profile-card/ProfileCard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,IAAI,EAAEC,UAAU,QAAwB,cAAc;AAE/D,SAASC,IAAI,QAAQ,kBAAS;AAC9B,SAASC,MAAM,QAAQ,oBAAW;AAClC,SAASC,WAAW,QAAQ,0BAAiB;AAC7C,SAASC,YAAY,QAAQ,4BAAmB;AAChD,SAASC,OAAO,QAAQ,sBAAa;AACrC,SAASC,IAAI,QAAQ,wBAAe;AACpC,SAASC,QAAQ,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAA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AAO,EAAE;IACP2B,GAAG,EAAE;EACP,CAAC;EACDzB,YAAY,EAAE;IACZiD,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDjE,UAAU,EAAE;IACVqE,QAAQ,EAAE;EACZ,CAAC;EACDxE,KAAK,EAAE;IACLwE,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,CAAC,CAAC;IACTC,MAAM,EAAE,CAAC,CAAC;IACVX,UAAU,EAAE,QAAQ;IACpBY,cAAc,EAAE;EAClB,CAAC;EACDf,YAAY,EAAE;IACZY,QAAQ,EAAE,UAAU;IACpBI,GAAG,EAAE5F,YAAY;IACjByF,KAAK,EAAEzF;EACT;AACF,CAAC,CAAC;AAEF,OAAO,MAAM6F,WAAW,gBAAG9G,IAAI,CAACmE,oBAAoB,CAAC;AACrD2C,WAAW,CAACC,WAAW,GAAG,aAAa","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { ProfileCard } from "./ProfileCard.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ProfileCard"],"sourceRoot":"../../../src","sources":["profile-card/index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["profile-card/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+
3
+ import React, { memo } from 'react';
4
+ import { View, StyleSheet } from 'react-native';
5
+ import { useTheme } from "../theme/use-theme.js";
6
+ import { Text } from "../typography/index.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ function clampPercent(value) {
9
+ if (Number.isNaN(value)) return 0;
10
+ return Math.max(0, Math.min(100, value));
11
+ }
12
+
13
+ /**
14
+ * A horizontal labeled value bar with two variants:
15
+ *
16
+ * - `progress` — a rounded capsule track with a proportional `value / max`
17
+ * fill, an optional top-right `icon`, and an optional min/max footer row.
18
+ * - `split` — a capsule split at `percent` (left portion active, remainder the
19
+ * track color), a bold percentage right of the label, and a two-sided footer
20
+ * of opposing values (inflow/outflow style).
21
+ *
22
+ * Pure `<View>` composition, so it renders identically on web and native.
23
+ */
24
+ const StatBarComponent = props => {
25
+ const {
26
+ colors
27
+ } = useTheme();
28
+ const {
29
+ label,
30
+ fillColor,
31
+ trackColor,
32
+ height = 6,
33
+ icon,
34
+ style,
35
+ testID
36
+ } = props;
37
+ const fill = fillColor ?? colors.primary;
38
+ const track = trackColor ?? colors.backgroundSecondary;
39
+ const radius = height / 2;
40
+ if (props.variant === 'split') {
41
+ const {
42
+ percent,
43
+ leftValue,
44
+ rightValue,
45
+ leftColor,
46
+ rightColor
47
+ } = props;
48
+ const leftPercent = clampPercent(percent);
49
+ const activeLeft = leftColor ?? fill;
50
+ const remainder = rightColor ?? track;
51
+ return /*#__PURE__*/_jsxs(View, {
52
+ style: [styles.wrap, style],
53
+ testID: testID,
54
+ children: [/*#__PURE__*/_jsxs(View, {
55
+ style: styles.labelRow,
56
+ children: [/*#__PURE__*/_jsx(Text, {
57
+ style: [styles.label, {
58
+ color: colors.textSecondary
59
+ }],
60
+ numberOfLines: 1,
61
+ children: label
62
+ }), /*#__PURE__*/_jsxs(Text, {
63
+ style: [styles.percent, {
64
+ color: colors.text
65
+ }],
66
+ numberOfLines: 1,
67
+ children: [Math.round(leftPercent), "%"]
68
+ })]
69
+ }), /*#__PURE__*/_jsx(View, {
70
+ style: [styles.track, {
71
+ height,
72
+ borderRadius: radius,
73
+ backgroundColor: remainder
74
+ }],
75
+ children: /*#__PURE__*/_jsx(View, {
76
+ style: {
77
+ width: `${leftPercent}%`,
78
+ height,
79
+ borderRadius: radius,
80
+ backgroundColor: activeLeft
81
+ }
82
+ })
83
+ }), /*#__PURE__*/_jsxs(View, {
84
+ style: styles.footerRow,
85
+ children: [/*#__PURE__*/_jsx(Text, {
86
+ style: [styles.footerValue, {
87
+ color: colors.textTertiary
88
+ }],
89
+ numberOfLines: 1,
90
+ children: leftValue
91
+ }), /*#__PURE__*/_jsx(Text, {
92
+ style: [styles.footerValue, {
93
+ color: colors.textTertiary
94
+ }],
95
+ numberOfLines: 1,
96
+ children: rightValue
97
+ })]
98
+ })]
99
+ });
100
+ }
101
+ const {
102
+ value,
103
+ max,
104
+ minLabel,
105
+ maxLabel
106
+ } = props;
107
+ const ratio = max > 0 ? clampPercent(value / max * 100) : 0;
108
+ const hasFooter = minLabel != null || maxLabel != null;
109
+ return /*#__PURE__*/_jsxs(View, {
110
+ style: [styles.wrap, style],
111
+ testID: testID,
112
+ children: [/*#__PURE__*/_jsxs(View, {
113
+ style: styles.labelRow,
114
+ children: [/*#__PURE__*/_jsx(Text, {
115
+ style: [styles.label, {
116
+ color: colors.textSecondary
117
+ }],
118
+ numberOfLines: 1,
119
+ children: label
120
+ }), icon != null && /*#__PURE__*/_jsx(View, {
121
+ style: styles.icon,
122
+ children: icon
123
+ })]
124
+ }), /*#__PURE__*/_jsx(View, {
125
+ style: [styles.track, {
126
+ height,
127
+ borderRadius: radius,
128
+ backgroundColor: track
129
+ }],
130
+ accessibilityRole: "progressbar",
131
+ accessibilityValue: {
132
+ min: 0,
133
+ max,
134
+ now: value
135
+ },
136
+ children: /*#__PURE__*/_jsx(View, {
137
+ style: {
138
+ width: `${ratio}%`,
139
+ height,
140
+ borderRadius: radius,
141
+ backgroundColor: fill
142
+ }
143
+ })
144
+ }), hasFooter && /*#__PURE__*/_jsxs(View, {
145
+ style: styles.footerRow,
146
+ children: [/*#__PURE__*/_jsx(Text, {
147
+ style: [styles.footerValue, {
148
+ color: colors.textTertiary
149
+ }],
150
+ numberOfLines: 1,
151
+ children: minLabel ?? ''
152
+ }), /*#__PURE__*/_jsx(Text, {
153
+ style: [styles.footerValue, {
154
+ color: colors.textTertiary
155
+ }],
156
+ numberOfLines: 1,
157
+ children: maxLabel ?? ''
158
+ })]
159
+ })]
160
+ });
161
+ };
162
+ const styles = StyleSheet.create({
163
+ wrap: {
164
+ gap: 8
165
+ },
166
+ labelRow: {
167
+ flexDirection: 'row',
168
+ alignItems: 'center',
169
+ justifyContent: 'space-between',
170
+ gap: 8
171
+ },
172
+ label: {
173
+ flexShrink: 1,
174
+ fontSize: 13,
175
+ fontWeight: '500'
176
+ },
177
+ percent: {
178
+ fontSize: 14,
179
+ fontWeight: '700',
180
+ letterSpacing: -0.2,
181
+ fontVariant: ['tabular-nums']
182
+ },
183
+ icon: {
184
+ marginLeft: 8
185
+ },
186
+ track: {
187
+ width: '100%',
188
+ overflow: 'hidden',
189
+ flexDirection: 'row',
190
+ borderCurve: 'continuous'
191
+ },
192
+ footerRow: {
193
+ flexDirection: 'row',
194
+ alignItems: 'center',
195
+ justifyContent: 'space-between',
196
+ gap: 8
197
+ },
198
+ footerValue: {
199
+ fontSize: 12,
200
+ fontVariant: ['tabular-nums']
201
+ }
202
+ });
203
+ export const StatBar = /*#__PURE__*/memo(StatBarComponent);
204
+ StatBar.displayName = 'StatBar';
205
+ //# sourceMappingURL=StatBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","View","StyleSheet","useTheme","Text","jsx","_jsx","jsxs","_jsxs","clampPercent","value","Number","isNaN","Math","max","min","StatBarComponent","props","colors","label","fillColor","trackColor","height","icon","style","testID","fill","primary","track","backgroundSecondary","radius","variant","percent","leftValue","rightValue","leftColor","rightColor","leftPercent","activeLeft","remainder","styles","wrap","children","labelRow","color","textSecondary","numberOfLines","text","round","borderRadius","backgroundColor","width","footerRow","footerValue","textTertiary","minLabel","maxLabel","ratio","hasFooter","accessibilityRole","accessibilityValue","now","create","gap","flexDirection","alignItems","justifyContent","flexShrink","fontSize","fontWeight","letterSpacing","fontVariant","marginLeft","overflow","borderCurve","StatBar","displayName"],"sourceRoot":"../../../src","sources":["stat-bar/StatBar.tsx"],"mappings":";;AA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E;EACd,CAAC;EACDrC,OAAO,EAAE;IACPoC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,CAAC,GAAG;IACnBC,WAAW,EAAE,CAAC,cAAc;EAC9B,CAAC;EACDhD,IAAI,EAAE;IACJiD,UAAU,EAAE;EACd,CAAC;EACD5C,KAAK,EAAE;IACLuB,KAAK,EAAE,MAAM;IACbsB,QAAQ,EAAE,QAAQ;IAClBT,aAAa,EAAE,KAAK;IACpBU,WAAW,EAAE;EACf,CAAC;EACDtB,SAAS,EAAE;IACTY,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,eAAe;IAC/BH,GAAG,EAAE;EACP,CAAC;EACDV,WAAW,EAAE;IACXe,QAAQ,EAAE,EAAE;IACZG,WAAW,EAAE,CAAC,cAAc;EAC9B;AACF,CAAC,CAAC;AAEF,OAAO,MAAMI,OAAO,gBAAG3E,IAAI,CAACgB,gBAAgB,CAAC;AAC7C2D,OAAO,CAACC,WAAW,GAAG,SAAS","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { StatBar } from "./StatBar.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StatBar"],"sourceRoot":"../../../src","sources":["stat-bar/index.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,cAAW","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["stat-bar/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ActivityHeatmapProps } from './types';
3
+ export declare const ActivityHeatmap: React.NamedExoticComponent<ActivityHeatmapProps>;
4
+ //# sourceMappingURL=ActivityHeatmap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityHeatmap.d.ts","sourceRoot":"","sources":["../../../../src/activity-heatmap/ActivityHeatmap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAK7C,OAAO,KAAK,EAAsB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA0RxE,eAAO,MAAM,eAAe,kDAAiC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ActivityHeatmapDay } from './types';
2
+ /**
3
+ * Group arbitrary items by their `YYYY-MM-DD` day and count how many fall on
4
+ * each day. Returns entries sorted ascending by date — ready to hand to
5
+ * {@link ActivityHeatmap}'s `data` prop. Items whose date can't be parsed are
6
+ * skipped.
7
+ */
8
+ export declare function bucketByDay<T>(items: T[], getDate: (item: T) => string | Date): ActivityHeatmapDay[];
9
+ //# sourceMappingURL=bucketByDay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucketByDay.d.ts","sourceRoot":"","sources":["../../../../src/activity-heatmap/bucketByDay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA6BlD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,GAClC,kBAAkB,EAAE,CAUtB"}
@@ -0,0 +1,4 @@
1
+ export { ActivityHeatmap } from './ActivityHeatmap';
2
+ export { bucketByDay } from './bucketByDay';
3
+ export type { ActivityHeatmapProps, ActivityHeatmapDay } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/activity-heatmap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,73 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+ /** A single day cell in the {@link ActivityHeatmap}. */
3
+ export interface ActivityHeatmapDay {
4
+ /** ISO `YYYY-MM-DD` date (parsed in UTC). */
5
+ date: string;
6
+ /** Activity count for that day. */
7
+ count: number;
8
+ }
9
+ export interface ActivityHeatmapProps {
10
+ /** Per-day activity counts. Days not present are treated as count 0. */
11
+ data: ActivityHeatmapDay[];
12
+ /**
13
+ * Number of days to render, ending at `endDate`.
14
+ * @default 364
15
+ */
16
+ numDays?: number;
17
+ /**
18
+ * Last (rightmost) day of the grid as `YYYY-MM-DD`. Defaults to the latest
19
+ * date present in `data`. The component never reads the system clock, so pass
20
+ * `endDate` explicitly to anchor the grid to "today".
21
+ */
22
+ endDate?: string;
23
+ /**
24
+ * Ascending count thresholds partitioning positive counts into color levels.
25
+ * With N thresholds a positive count maps to `colorScale[number of thresholds
26
+ * met]` (clamped to the scale). Count 0 always uses `emptyColor`.
27
+ * @default [1, 3, 6, 10]
28
+ */
29
+ levels?: number[];
30
+ /**
31
+ * Colors low→high. Index 0 is the faintest activity shade, the last index the
32
+ * strongest. Defaults to five opacity steps of `theme.colors.primary`.
33
+ */
34
+ colorScale?: string[];
35
+ /**
36
+ * Color for zero-activity days.
37
+ * @default theme.colors.backgroundSecondary
38
+ */
39
+ emptyColor?: string;
40
+ /**
41
+ * Side length of each day cell in px.
42
+ * @default 12
43
+ */
44
+ cellSize?: number;
45
+ /**
46
+ * Gap between cells in px (both axes).
47
+ * @default 3
48
+ */
49
+ gap?: number;
50
+ /**
51
+ * First day of the week: 0 = Sunday, 1 = Monday. Controls both the row order
52
+ * and how the leading partial week aligns.
53
+ * @default 0
54
+ */
55
+ weekStartsOn?: 0 | 1;
56
+ /**
57
+ * 12 short month names indexed by month (0 = January), for the month-label
58
+ * row. Pass localized names; defaults to English abbreviations.
59
+ */
60
+ monthLabels?: string[];
61
+ /**
62
+ * 7 short weekday names indexed by day of week (0 = Sunday). When provided, a
63
+ * weekday-label column is rendered to the left of the grid. Omit for no
64
+ * weekday column. Pass empty strings for rows you want left blank.
65
+ */
66
+ weekdayLabels?: string[];
67
+ /** Called with the pressed day. When set, each populated cell is pressable. */
68
+ onPressDay?: (day: ActivityHeatmapDay) => void;
69
+ /** Container style override. */
70
+ style?: StyleProp<ViewStyle>;
71
+ testID?: string;
72
+ }
73
+ //# sourceMappingURL=types.d.ts.map