@humanforest/charts 0.1.2 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanforest/charts",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -24,7 +24,7 @@
24
24
  "vue": "^3.5.22"
25
25
  },
26
26
  "dependencies": {
27
- "@humanforest/tokens": "^0.1.2"
27
+ "@humanforest/tokens": "^0.2.0"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
@@ -269,7 +269,7 @@ const hasEmpty = computed(() =>
269
269
  >{{ m.label }}</span>
270
270
  </div>
271
271
 
272
- <UTooltip :text="tip.text" :reference="tip.el" :open="tipOpen">
272
+ <UTooltip :text="tip.text" :reference="tip.el ?? undefined" :open="tipOpen">
273
273
  <div class="relative" :role="interactive ? 'group' : 'img'" :aria-label="gridLabel">
274
274
  <div class="flex" :style="{ gap: `${cellGap}px` }">
275
275
  <div v-for="(week, wi) in weeks" :key="wi" class="flex flex-col" :style="{ gap: `${cellGap}px` }">
@@ -159,7 +159,7 @@ const hideTip = () => {
159
159
  wrong the moment the segments are buttons — the buttons would be hidden from the very
160
160
  readers the role is for. Interactive, it becomes a labelled group whose children stay
161
161
  reachable, and each segment states itself. -->
162
- <UTooltip :text="tip.text" :reference="tip.el" :open="tipOpen">
162
+ <UTooltip :text="tip.text" :reference="tip.el ?? undefined" :open="tipOpen">
163
163
  <div
164
164
  class="grid w-full"
165
165
  :role="interactive ? 'group' : 'img'"
@@ -247,7 +247,9 @@ const tipOpen = ref(false);
247
247
  const tipReference = computed(() =>
248
248
  tip.value.box
249
249
  ? { getBoundingClientRect: () => new DOMRect(tip.value.box!.x, tip.value.box!.y, tip.value.box!.w, tip.value.box!.h) }
250
- : null,
250
+ // `undefined`, not `null`: UTooltip's `reference` is `ReferenceElement | undefined`, and a
251
+ // consumer's own typecheck reads this source — `null` is an error they cannot fix.
252
+ : undefined,
251
253
  );
252
254
 
253
255
  // One listener on an overlay, rather than one per dot. The grid is regular, so the dot under the
@@ -310,7 +310,7 @@ const labelled = computed<AreaDatum[]>(() => {
310
310
  package, so a class used only here is never generated and the rule silently does
311
311
  nothing. width and height stay attributes for the intrinsic size, and height:auto is
312
312
  what keeps the aspect once max-width takes over in a container narrower than the map. -->
313
- <UTooltip :text="tip.text" :reference="tip.el" :open="tipOpen">
313
+ <UTooltip :text="tip.text" :reference="tip.el ?? undefined" :open="tipOpen">
314
314
  <svg
315
315
  :width="width"
316
316
  :height="height"
@@ -32,7 +32,16 @@ const props = withDefaults(
32
32
  * this period sits above day one of the last. A shorter run simply stops early.
33
33
  */
34
34
  compare?: (number | null)[];
35
- /** Any CSS colour. Defaults to the current text colour, so it inherits the tile's intent. */
35
+ /**
36
+ * Any CSS colour. Defaults to the brand accent, which flips with the mode on its own.
37
+ *
38
+ * ★ `currentColor` WAS THE DEFAULT AND IT WAS WRONG. A tile does not pass its intent down to the
39
+ * `visual` slot — FKpi colours `metric` and `delta`, never the root — so inheriting there picks
40
+ * up body ink whatever the tile's status, and a sparkline dropped on any surface renders in the
41
+ * surrounding text colour. That shipped: one chart in near-black beside four in Forest green.
42
+ * Every call site in this repo already passed `var(--ui-primary)` by hand, which is the tell.
43
+ * Pass `currentColor` explicitly for one set inline in a sentence, where inking as text is right.
44
+ */
36
45
  color?: string;
37
46
  /** The comparison line's colour. Defaults to the series colour at low opacity. */
38
47
  compareColor?: string;
@@ -62,7 +71,7 @@ const props = withDefaults(
62
71
  */
63
72
  mark?: 'line' | 'bar';
64
73
  }>(),
65
- { height: 32, color: 'currentColor', area: false, endpoint: false, curve: true, mark: 'line', compare: undefined, compareColor: undefined },
74
+ { height: 32, color: 'var(--ui-primary)', area: false, endpoint: false, curve: true, mark: 'line', compare: undefined, compareColor: undefined },
66
75
  );
67
76
 
68
77
  if (import.meta.env.DEV) {
@@ -109,7 +109,7 @@ const hideTip = () => {
109
109
  <div class="flex w-full flex-col gap-2">
110
110
  <div class="flex items-center gap-3">
111
111
  <span v-if="label && showChrome" class="type-label shrink-0 text-default">{{ label }}</span>
112
- <UTooltip :text="tip.text" :reference="tip.el" :open="tipOpen">
112
+ <UTooltip :text="tip.text" :reference="tip.el ?? undefined" :open="tipOpen">
113
113
  <div
114
114
  class="flex min-w-0 flex-1"
115
115
  :role="interactive ? 'group' : 'img'"