@eduardoalvarez/arrecife 0.8.0 → 0.10.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/CHANGELOG.md +50 -0
- package/README.md +99 -69
- package/dist/brand/index.js +2 -3
- package/dist/chart/index.cjs +34 -8
- package/dist/chart/index.d.cts +25 -3
- package/dist/chart/index.d.ts +25 -3
- package/dist/chart/index.js +34 -9
- package/dist/chunk-ZSCSKCTY.js +26 -0
- package/dist/form/index.js +0 -1
- package/dist/icons/index.d.cts +19 -10
- package/dist/icons/index.d.ts +19 -10
- package/dist/icons/index.js +2 -27
- package/dist/index.cjs +210 -384
- package/dist/index.d.cts +67 -12
- package/dist/index.d.ts +67 -12
- package/dist/index.js +153 -189
- package/dist/og/index.js +0 -1
- package/dist/shiki/index.js +0 -1
- package/dist/theme/index.js +0 -1
- package/dist/tokens/index.js +0 -1
- package/dist/tokens/theme.css +21 -1
- package/dist/variants/index.js +0 -1
- package/llms.txt +70 -134
- package/package.json +18 -30
- package/dist/chunk-HOADZ6GS.js +0 -72
- package/dist/chunk-LXRGQKMG.js +0 -145
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/index-BbRplw_B.d.cts +0 -58
- package/dist/index-BbRplw_B.d.ts +0 -58
- package/dist/social/data.cjs +0 -161
- package/dist/social/data.d.cts +0 -161
- package/dist/social/data.d.ts +0 -161
- package/dist/social/data.js +0 -2
- package/dist/social/index.cjs +0 -153
- package/dist/social/index.d.cts +0 -2
- package/dist/social/index.d.ts +0 -2
- package/dist/social/index.js +0 -3
- package/dist/{chunk-MPZBF2TZ.js → chunk-IIT3YLYN.js} +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.10.0](https://github.com/Proskynete/arrecife/compare/v0.9.0...v0.10.0) (2026-09-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **icons:** `@phosphor-icons/react` becomes a REQUIRED peer dependency, and `@eduardoalvarez/arrecife/social`, `/social/data` and the root's `social` namespace are removed. Phosphor has all ten marks; the mapping table and the `tone` each one takes are in docs/runbooks/migration-0.10.md.
|
|
9
|
+
|
|
10
|
+
### 🚀 Novedades
|
|
11
|
+
|
|
12
|
+
* **icons:** Phosphor is the only hand the library draws in ([833090e](https://github.com/Proskynete/arrecife/commit/833090e80d8d259f6965f389bc455cc72945a9c0))
|
|
13
|
+
* **primitives:** the alert's four marks come from Phosphor ([0a4c86e](https://github.com/Proskynete/arrecife/commit/0a4c86ef7a8f5375c27bd7cea3afa3ab7ec76c35))
|
|
14
|
+
* **storybook:** a way in, and a generated agent block on every component ([08eb4dd](https://github.com/Proskynete/arrecife/commit/08eb4ddcc8044ce561f88eb30894faaf00ff6e95))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### 🐛 Correcciones
|
|
18
|
+
|
|
19
|
+
* **a11y:** the code block's scroll region is reachable by keyboard ([5de3618](https://github.com/Proskynete/arrecife/commit/5de3618a81badb92a374e7dc40d0d251c133794d))
|
|
20
|
+
* **components:** the audio player's waveform is Phosphor's, not five spans ([a0d92cd](https://github.com/Proskynete/arrecife/commit/a0d92cd99eaecbe1c506b60d03fa4b76f623faf0))
|
|
21
|
+
* **components:** the footer stacks and centres below sm ([723920e](https://github.com/Proskynete/arrecife/commit/723920e0d3513d2834ac6215b6245491ac82be54))
|
|
22
|
+
* **components:** the nav item row scrolls instead of pushing the page sideways ([716bb55](https://github.com/Proskynete/arrecife/commit/716bb55ccdecb796132928a73caa09e980b78015))
|
|
23
|
+
* **components:** ThemeToggle switches the theme without onThemeChange ([c947036](https://github.com/Proskynete/arrecife/commit/c9470363618c3c70948616fb8e1a49b54921a830))
|
|
24
|
+
* **primitives:** the tab list scrolls and the pagination row wraps ([e44a3dc](https://github.com/Proskynete/arrecife/commit/e44a3dc43022e25545c5802543f77e26b5bccdad))
|
|
25
|
+
* **primitives:** the toast carries its tone as a surface, not as a hairline ([f1c6352](https://github.com/Proskynete/arrecife/commit/f1c6352de323acef2cb4ab55555d088da380b8ae))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 📚 Documentación
|
|
29
|
+
|
|
30
|
+
* § 51 names the waveform, and the runbook says it moved ([aea65a1](https://github.com/Proskynete/arrecife/commit/aea65a108e11e3352c4fa35a2f27c19b2b6fac9b))
|
|
31
|
+
* **readme:** the library stops drawing icons of its own ([7d56012](https://github.com/Proskynete/arrecife/commit/7d5601241eef5855148f3075a805585bc56b0fcf))
|
|
32
|
+
* the 0.10 decision log ([254ab6a](https://github.com/Proskynete/arrecife/commit/254ab6a72a662c7303cac690eeb2e887735bd7d4))
|
|
33
|
+
* the 0.10 migration runbook ([1118afd](https://github.com/Proskynete/arrecife/commit/1118afdc6221f6b7a22d5b7d8f7478ea875890dc))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### 📦 Dependencias
|
|
37
|
+
|
|
38
|
+
* ignoreDeprecations, because tsup injects a baseUrl TypeScript 6 rejects ([5eb20c8](https://github.com/Proskynete/arrecife/commit/5eb20c897346ed68b98e03b1c7f1519d57e7b513))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### 🚀 CI/CD
|
|
42
|
+
|
|
43
|
+
* the social scope goes with the subpath that named it ([b02ab52](https://github.com/Proskynete/arrecife/commit/b02ab525f6e30a6114abada71afcd8bb6f3d06a7))
|
|
44
|
+
|
|
45
|
+
## [0.9.0](https://github.com/Proskynete/arrecife/compare/v0.8.0...v0.9.0) (2026-09-08)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### 🚀 Novedades
|
|
49
|
+
|
|
50
|
+
* **chart:** the axes get their own tick formatters ([25e9311](https://github.com/Proskynete/arrecife/commit/25e93118775b9ce0c6091d3a98cd9067f7ddc8cb))
|
|
51
|
+
* **components:** the signature prints the site's domain, not the identity's ([6d9839d](https://github.com/Proskynete/arrecife/commit/6d9839dbf43b8820431a78c9100dac607e6e1b8e))
|
|
52
|
+
|
|
3
53
|
## [0.8.0](https://github.com/Proskynete/arrecife/compare/v0.7.0...v0.8.0) (2026-09-06)
|
|
4
54
|
|
|
5
55
|
|
package/README.md
CHANGED
|
@@ -130,6 +130,22 @@ so the command reports the value on each side and only fails on the ones that
|
|
|
130
130
|
differ. A collision that agrees is worth knowing about and is not worth failing
|
|
131
131
|
over.
|
|
132
132
|
|
|
133
|
+
> **Coming from 0.9.0.** Two breaks and they are the same one twice: the library
|
|
134
|
+
> stopped drawing icons of its own. `@phosphor-icons/react` becomes a REQUIRED
|
|
135
|
+
> peer dependency — even if your project draws no icons, the `Alert` and the
|
|
136
|
+
> `Select` you import do — and `./social` and `./social/data` are removed.
|
|
137
|
+
> Phosphor has all ten marks and `tsc` points at every call site; the mapping
|
|
138
|
+
> table is in the runbook.
|
|
139
|
+
>
|
|
140
|
+
> Everything else is additive and asks nothing of you: the footer centres itself
|
|
141
|
+
> on a phone, `Nav` and `TabsList` scroll instead of pushing the page sideways,
|
|
142
|
+
> `Pagination` wraps, `Toast` carries a real colour again, `Alert`'s four mono
|
|
143
|
+
> characters become Phosphor marks, and `ThemeToggle` toggles without
|
|
144
|
+
> `onThemeChange` — which was a genuine bug.
|
|
145
|
+
>
|
|
146
|
+
> Run `npx arrecife` first, then read
|
|
147
|
+
> [`docs/runbooks/migration-0.10.md`](docs/runbooks/migration-0.10.md).
|
|
148
|
+
|
|
133
149
|
> **Coming from 0.7.0.** Four breaks, and three of them are things the library
|
|
134
150
|
> takes back OUT because nothing in the four projects drew them: the `caret`
|
|
135
151
|
> utility, the footer's row of loose text links, and `SidebarNav`.
|
|
@@ -141,7 +157,7 @@ over.
|
|
|
141
157
|
>
|
|
142
158
|
> Everything else is additive: `Footer variant="full"` with columns, three chart
|
|
143
159
|
> shapes, `./social/data` for a project that mounts no React, and a `Website`
|
|
144
|
-
> glyph.
|
|
160
|
+
> glyph. Both `./social` subpaths were removed again in 0.10.0.
|
|
145
161
|
>
|
|
146
162
|
> Run `npx arrecife` first, then read
|
|
147
163
|
> [`docs/runbooks/migration-0.8.md`](docs/runbooks/migration-0.8.md).
|
|
@@ -346,60 +362,63 @@ Verified by packing the library with `pnpm pack` and installing it in a separate
|
|
|
346
362
|
project: the types resolve from `dist/`, `./tokens` loads without dragging React
|
|
347
363
|
in and `./tokens/theme.css` resolves by subpath.
|
|
348
364
|
|
|
349
|
-
### The social icons come from
|
|
365
|
+
### The social icons are yours too, and they come from Phosphor
|
|
350
366
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
367
|
+
Until 0.10.0 this section documented a catalogue of ten hand-drawn marks at
|
|
368
|
+
`./social`, published a second time as shapes at `./social/data` for a consumer
|
|
369
|
+
that mounts no React. Both are gone.
|
|
354
370
|
|
|
355
|
-
|
|
371
|
+
```tsx
|
|
372
|
+
// ❌ removed in 0.10.0
|
|
356
373
|
import { GitHub, LinkedIn } from '@eduardoalvarez/arrecife/social';
|
|
357
|
-
|
|
358
|
-
// ✅ for iterating the catalogue
|
|
359
374
|
import { social } from '@eduardoalvarez/arrecife';
|
|
360
|
-
|
|
375
|
+
|
|
376
|
+
// ✅
|
|
377
|
+
import { GithubLogo, LinkedinLogo } from '@phosphor-icons/react';
|
|
378
|
+
import { Icon } from '@eduardoalvarez/arrecife/icons';
|
|
379
|
+
|
|
380
|
+
<Icon as={GithubLogo} tone="current" />
|
|
361
381
|
```
|
|
362
382
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
`
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
`icon`.
|
|
383
|
+
| Removed | Phosphor | `tone` |
|
|
384
|
+
| --- | --- | --- |
|
|
385
|
+
| `GitHub` | `GithubLogo` | `current` |
|
|
386
|
+
| `LinkedIn` | `LinkedinLogo` | `current` |
|
|
387
|
+
| `X` | `XLogo` | `current` |
|
|
388
|
+
| `Instagram` | `InstagramLogo` | `current` |
|
|
389
|
+
| `Discord` | `DiscordLogo` | `current` |
|
|
390
|
+
| `YouTube` | `YoutubeLogo` | `current` |
|
|
391
|
+
| `Rss` | `Rss` | `action` |
|
|
392
|
+
| `Email` | `Envelope` | `action` |
|
|
393
|
+
| `Newsletter` | `BellSimple` | `action` |
|
|
394
|
+
| `Website` | `Globe` | `action` |
|
|
395
|
+
|
|
396
|
+
**The `tone` column is the old drawing rule, not a new one.** Six are brands and
|
|
397
|
+
went SOLID, which is `tone="current"` — Phosphor's `fill`. Four were functional
|
|
398
|
+
and used the document's 1.6 stroke, which is the default `action`. Nothing about
|
|
399
|
+
how the row looks changed; what changed is who draws it.
|
|
400
|
+
|
|
401
|
+
**Why they went, when the whole point of `./social/data` was that `links` had
|
|
402
|
+
pasted four `<path>`s by hand.** Because `links` left first. Its `Footer.astro`
|
|
403
|
+
now draws Phosphor through `astro-icon` and its own docstring lists the divergence:
|
|
404
|
+
«every icon on the page — the six in the cards and the four here — is then one set
|
|
405
|
+
at one weight». `eduardoalvarez.dev` did the same in `site-footer.tsx`. Two
|
|
406
|
+
consumers walking away from a subpath built for them is the library being out of
|
|
407
|
+
step, not the consumers. See `docs/decisions/0.10.md` § 51.
|
|
408
|
+
|
|
409
|
+
**In a Next Server Component, take the glyph from `@phosphor-icons/react/ssr`.**
|
|
410
|
+
`./icons` carries no `"use client"` on purpose, so an icon renders on the server
|
|
411
|
+
and ships no client JS. Phosphor's default build reads `IconContext` through
|
|
412
|
+
`useContext` and a hook in a Server Component throws; the `/ssr` entry is the same
|
|
413
|
+
icons without that read, and `Icon` works with either.
|
|
414
|
+
|
|
415
|
+
**There are no internal glyphs left to not export.** `lib/glyphs.tsx` held
|
|
416
|
+
`Close`, `ChevronDown`, `Copy`, `Sun` and fifteen others, and the rule was that
|
|
417
|
+
publishing them would turn it into the icon library the system decided not to
|
|
418
|
+
have. The file is deleted: the primitives draw from Phosphor like everything else.
|
|
419
|
+
A component that needs an icon still takes it as a prop — `Stat` receives `icon`,
|
|
420
|
+
`Footer` receives each social link's `icon` — and the project passes
|
|
421
|
+
`<Icon as={…} />`.
|
|
403
422
|
|
|
404
423
|
### The icons are yours, the way they are drawn is not
|
|
405
424
|
|
|
@@ -427,15 +446,17 @@ names. Measured on the `Minus` path itself, whose regular form is a bar of radiu
|
|
|
427
446
|
| --- | --- | --- |
|
|
428
447
|
| phosphor `regular` | 16 on a 256 grid | **0.0625em** |
|
|
429
448
|
| the document | 1.6 on a 24 grid | **0.0667em** |
|
|
430
|
-
| `lib/glyphs.tsx
|
|
449
|
+
| `lib/glyphs.tsx`, until 0.10.0 | 1.75 on a 16 grid | 0.109em |
|
|
431
450
|
|
|
432
451
|
Six per cent apart, which is no pixel on any screen. Nothing had to be derived and
|
|
433
452
|
no number had to be invented. The `Icons/Icon` → `regular IS the document's
|
|
434
|
-
stroke` story
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
453
|
+
stroke` story shows the bars so the claim can be checked instead of believed.
|
|
454
|
+
|
|
455
|
+
**The third row is history now, and it is left in because it is the argument.**
|
|
456
|
+
`glyphs.tsx` drew at 0.109em — three quarters heavier than both — and 0.7.0
|
|
457
|
+
measured it, said so and left it alone, because aligning it restyles every
|
|
458
|
+
primitive in the library. 0.10.0 is that change: the file is gone and there is
|
|
459
|
+
one line in the system. See `docs/decisions/0.10.md` § 51.
|
|
439
460
|
|
|
440
461
|
**The weight is an axis with three values, and `tone` is how you name them.**
|
|
441
462
|
`weight` is not a prop: Phosphor ships six and this system reads three, because
|
|
@@ -483,16 +504,17 @@ It blocked `cursos` for a whole version, and the workaround there was a
|
|
|
483
504
|
that is a `<span>` with no interaction. It cost 272 KB of client chunk.
|
|
484
505
|
|
|
485
506
|
The five portable subpaths do NOT carry it — `./tokens`, `./theme`,
|
|
486
|
-
`./variants`, `./
|
|
507
|
+
`./variants`, `./og` and `./shiki` — and that is the half that matters more.
|
|
487
508
|
Marking them client would be a lie with a cost: a Server Component importing
|
|
488
509
|
`buttonVariants`, a function that returns a string, would pull a client boundary
|
|
489
510
|
in with it.
|
|
490
511
|
|
|
491
|
-
`./
|
|
492
|
-
portable ones. It renders React — it is
|
|
512
|
+
`./icons` is the third case, and it is why the check stopped looking only at the
|
|
513
|
+
portable ones. It renders React — it is one `<svg>` — so it can never be
|
|
493
514
|
portable, and it holds no state, so it must not be a client entry either. Listed
|
|
494
515
|
in neither set, nothing would have noticed it being marked client by mistake, and
|
|
495
|
-
that mistake undoes the only reason the subpath exists
|
|
516
|
+
that mistake undoes the only reason the subpath exists: an icon in a Server
|
|
517
|
+
Component with no client boundary opened for it.
|
|
496
518
|
|
|
497
519
|
It is stamped by `scripts/add-use-client.mjs` after tsup, and not by tsup's
|
|
498
520
|
`banner`. That was tried first: esbuild writes the directive and the bundling
|
|
@@ -566,8 +588,8 @@ vertical={false}`, two axes with the line and the tick off, a `type="natural"`
|
|
|
566
588
|
and a `strokeWidth` — which `cursos` wrote four times, once per chart. None of
|
|
567
589
|
that is a decision the project made. See `docs/decisions/0.8.md` § 43.
|
|
568
590
|
|
|
569
|
-
`check:exports` verifies that the
|
|
570
|
-
`./variants`, `./
|
|
591
|
+
`check:exports` verifies that the five portable ones — `./tokens`, `./theme`,
|
|
592
|
+
`./variants`, `./og` and `./shiki` — bring no React into the published `dist/`,
|
|
571
593
|
**by following the relative imports**. Without that the check was worthless: with `treeshake`
|
|
572
594
|
on, each portable entry ends up as two lines re-exporting from a
|
|
573
595
|
`chunk-XXXX.js`, and a grep over those two lines finds no React even when the
|
|
@@ -869,12 +891,17 @@ about as library pieces. They get in anyway: the CLI aesthetic — the bar's
|
|
|
869
891
|
|
|
870
892
|
### Phase 3 decisions
|
|
871
893
|
|
|
872
|
-
- **It
|
|
873
|
-
primitives need are inline in
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
894
|
+
- **It shipped no icon set, and by 0.10.0 that position had been abandoned from
|
|
895
|
+
both ends.** Phase 3 said the eight glyphs the primitives need are inline in
|
|
896
|
+
`src/lib/glyphs.tsx` and not exported; 0.7.0 added `@phosphor-icons/react` as an
|
|
897
|
+
optional peer on `./icons` so the set a project chooses is drawn at the system's
|
|
898
|
+
weight; and 0.10.0 deleted `glyphs.tsx` and `./social` and made Phosphor
|
|
899
|
+
required, because a library drawing in three hands cannot say which one is
|
|
900
|
+
right. See «The social icons are yours too» above and `docs/decisions/0.10.md`
|
|
901
|
+
§ 51. What survives verbatim is the part that was always the real rule: the
|
|
902
|
+
icons are the project's, the LINE is the system's. The rest of this bullet is
|
|
903
|
+
the 0.7.0 argument, kept because it is what the reversal was measured against:
|
|
904
|
+
optional and on a subpath was the point, since the two projects that use no
|
|
878
905
|
icons install nothing.
|
|
879
906
|
- **No entrance animations.** Modals, menus, tooltips and toasts appear where
|
|
880
907
|
they will stay. The `Switch` knob changes position without sliding. The
|
|
@@ -968,8 +995,11 @@ skips, the 1 → 1.25 → 1.5 → 1.75 → 2 speed cycle and the volume with mut
|
|
|
968
995
|
portfolio's. What changed:
|
|
969
996
|
|
|
970
997
|
**Two dependencies a package cannot have.** The portfolio's `Icon` became
|
|
971
|
-
`src/lib/glyphs.tsx` with identical paths
|
|
972
|
-
|
|
998
|
+
`src/lib/glyphs.tsx` with identical paths — and since 0.10.0 those eight paths are
|
|
999
|
+
gone too, replaced by `Play`, `Pause`, `SpeakerHigh`, `SpeakerSlash`,
|
|
1000
|
+
`CircleNotch`, `ArrowsClockwise` and the two seek arrows from Phosphor.
|
|
1001
|
+
`trackEvent` became the `onFirstPlay` prop, which still fires exactly once per
|
|
1002
|
+
load.
|
|
973
1003
|
|
|
974
1004
|
**One API change.** `compact`/`banner` as two booleans became
|
|
975
1005
|
`mode="full" | "compact" | "banner"`, which is the vocabulary the three modes were
|
package/dist/brand/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { Isotype, Logo, Mascot, MascotFace } from '../chunk-
|
|
3
|
-
export { ASSETS_PATH, faceList, faceUsage, faces, fins, poseList, poses } from '../chunk-CKRSQPTX.js';
|
|
2
|
+
export { Isotype, Logo, Mascot, MascotFace } from '../chunk-IIT3YLYN.js';
|
|
4
3
|
import '../chunk-FAAGZG7A.js';
|
|
4
|
+
export { ASSETS_PATH, faceList, faceUsage, faces, fins, poseList, poses } from '../chunk-CKRSQPTX.js';
|
|
5
5
|
import '../chunk-FGFNK72B.js';
|
|
6
|
-
import '../chunk-MLKGABMK.js';
|
package/dist/chart/index.cjs
CHANGED
|
@@ -299,6 +299,7 @@ var rows = (data) => data;
|
|
|
299
299
|
var color = (series2, index) => series2.color ?? seriesColor(index);
|
|
300
300
|
var MARGIN = { left: 0, right: 12, top: 8, bottom: 0 };
|
|
301
301
|
var AXIS = { tickLine: false, axisLine: false };
|
|
302
|
+
var tickOf = (format) => format ? { tickFormatter: format } : {};
|
|
302
303
|
var legendOf = (series2, legend) => legend ?? series2.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }, "legend") : null;
|
|
303
304
|
var tooltipOf = (formatter) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
304
305
|
ChartTooltip,
|
|
@@ -313,6 +314,8 @@ function AreaChart({
|
|
|
313
314
|
series: series2,
|
|
314
315
|
xKey,
|
|
315
316
|
formatter,
|
|
317
|
+
xTickFormatter,
|
|
318
|
+
yTickFormatter,
|
|
316
319
|
legend,
|
|
317
320
|
stacked = false,
|
|
318
321
|
...container
|
|
@@ -324,8 +327,8 @@ function AreaChart({
|
|
|
324
327
|
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "95%", stopColor: color(s, i), stopOpacity: 0.05 })
|
|
325
328
|
] }, s.key)) }),
|
|
326
329
|
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { vertical: false }),
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8 }),
|
|
328
|
-
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { ...AXIS, width: 40 }),
|
|
330
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
331
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
329
332
|
tooltipOf(formatter),
|
|
330
333
|
legendOf(series2, legend),
|
|
331
334
|
series2.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -349,6 +352,8 @@ function BarChart({
|
|
|
349
352
|
series: series2,
|
|
350
353
|
xKey,
|
|
351
354
|
formatter,
|
|
355
|
+
xTickFormatter,
|
|
356
|
+
yTickFormatter,
|
|
352
357
|
legend,
|
|
353
358
|
orientation = "vertical",
|
|
354
359
|
stacked = false,
|
|
@@ -364,11 +369,30 @@ function BarChart({
|
|
|
364
369
|
children: [
|
|
365
370
|
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { vertical: lying, horizontal: !lying }),
|
|
366
371
|
lying ? [
|
|
367
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
368
|
-
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
373
|
+
recharts.YAxis,
|
|
374
|
+
{
|
|
375
|
+
dataKey: xKey,
|
|
376
|
+
type: "category",
|
|
377
|
+
...AXIS,
|
|
378
|
+
width: 130,
|
|
379
|
+
...tickOf(xTickFormatter)
|
|
380
|
+
},
|
|
381
|
+
"category"
|
|
382
|
+
),
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { type: "number", hide: true, ...tickOf(yTickFormatter) }, "value")
|
|
369
384
|
] : [
|
|
370
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
371
|
-
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
+
recharts.XAxis,
|
|
387
|
+
{
|
|
388
|
+
dataKey: xKey,
|
|
389
|
+
...AXIS,
|
|
390
|
+
tickMargin: 8,
|
|
391
|
+
...tickOf(xTickFormatter)
|
|
392
|
+
},
|
|
393
|
+
"category"
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }, "value")
|
|
372
396
|
],
|
|
373
397
|
tooltipOf(formatter),
|
|
374
398
|
legendOf(series2, legend),
|
|
@@ -393,13 +417,15 @@ function LineChart({
|
|
|
393
417
|
series: series2,
|
|
394
418
|
xKey,
|
|
395
419
|
formatter,
|
|
420
|
+
xTickFormatter,
|
|
421
|
+
yTickFormatter,
|
|
396
422
|
legend,
|
|
397
423
|
...container
|
|
398
424
|
}) {
|
|
399
425
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartContainer, { ...container, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: rows(data), margin: MARGIN, children: [
|
|
400
426
|
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { vertical: false }),
|
|
401
|
-
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8 }),
|
|
402
|
-
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { ...AXIS, width: 40 }),
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
428
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
403
429
|
tooltipOf(formatter),
|
|
404
430
|
legendOf(series2, legend),
|
|
405
431
|
series2.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/chart/index.d.cts
CHANGED
|
@@ -165,6 +165,28 @@ type SeriesChartProps = Omit<ChartContainerProps, 'children'> & {
|
|
|
165
165
|
xKey: string;
|
|
166
166
|
/** Formats the value in the tooltip. The library imposes no locale. */
|
|
167
167
|
formatter?: ((value: unknown) => ReactNode) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Formats the TICK on the category axis. Returns a string, because an axis
|
|
170
|
+
* tick is an SVG `<text>` and not a place a node can go.
|
|
171
|
+
*
|
|
172
|
+
* It is separate from `formatter` because the two answer different questions.
|
|
173
|
+
* The tooltip has room for «15 de julio de 2026»; a tick on a 30-day series
|
|
174
|
+
* has room for «07-15», and without this the axis prints the raw key —
|
|
175
|
+
* `2026-07-15` repeated thirty times, overlapping into a grey band.
|
|
176
|
+
*
|
|
177
|
+
* The library imposes no format: a date key can be a day, a month or a course
|
|
178
|
+
* name, and only the project knows which. See `docs/decisions/0.9.md` § 50.
|
|
179
|
+
*/
|
|
180
|
+
xTickFormatter?: ((value: unknown) => string) | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Formats the tick on the VALUE axis — the currency symbol, the thousands
|
|
183
|
+
* separator, the percent sign.
|
|
184
|
+
*
|
|
185
|
+
* Same reason as `xTickFormatter` and the same shape. `formatter` reaches the
|
|
186
|
+
* tooltip only, so without this a revenue chart reads «1200» on the axis and
|
|
187
|
+
* «$1200» in the tooltip, and the axis is the one you read while comparing.
|
|
188
|
+
*/
|
|
189
|
+
yTickFormatter?: ((value: unknown) => string) | undefined;
|
|
168
190
|
/**
|
|
169
191
|
* Shows the legend. It defaults to «only when there is more than one series»:
|
|
170
192
|
* a legend naming the one line already named by the chart's own heading is a
|
|
@@ -195,7 +217,7 @@ type AreaChartProps = SeriesChartProps & {
|
|
|
195
217
|
/** Adds the series up instead of overlaying them. */
|
|
196
218
|
stacked?: boolean | undefined;
|
|
197
219
|
};
|
|
198
|
-
declare function AreaChart({ data, series, xKey, formatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
220
|
+
declare function AreaChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
199
221
|
/**
|
|
200
222
|
* Bars, upright or lying down.
|
|
201
223
|
*
|
|
@@ -219,7 +241,7 @@ type BarChartProps = SeriesChartProps & {
|
|
|
219
241
|
/** Stacks the series instead of putting them side by side. */
|
|
220
242
|
stacked?: boolean | undefined;
|
|
221
243
|
};
|
|
222
|
-
declare function BarChart({ data, series, xKey, formatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
244
|
+
declare function BarChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
223
245
|
/**
|
|
224
246
|
* Lines, for comparing series against each other.
|
|
225
247
|
*
|
|
@@ -232,6 +254,6 @@ declare function BarChart({ data, series, xKey, formatter, legend, orientation,
|
|
|
232
254
|
* where it means «this one».
|
|
233
255
|
*/
|
|
234
256
|
type LineChartProps = SeriesChartProps;
|
|
235
|
-
declare function LineChart({ data, series, xKey, formatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
257
|
+
declare function LineChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
236
258
|
|
|
237
259
|
export { AreaChart, type AreaChartProps, BarChart, type BarChartProps, ChartContainer, type ChartContainerProps, type ChartDatum, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, type ChartSeries, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, LineChart, type LineChartProps, SERIES_COLORS, type SeriesChartProps, seriesColor };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -165,6 +165,28 @@ type SeriesChartProps = Omit<ChartContainerProps, 'children'> & {
|
|
|
165
165
|
xKey: string;
|
|
166
166
|
/** Formats the value in the tooltip. The library imposes no locale. */
|
|
167
167
|
formatter?: ((value: unknown) => ReactNode) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Formats the TICK on the category axis. Returns a string, because an axis
|
|
170
|
+
* tick is an SVG `<text>` and not a place a node can go.
|
|
171
|
+
*
|
|
172
|
+
* It is separate from `formatter` because the two answer different questions.
|
|
173
|
+
* The tooltip has room for «15 de julio de 2026»; a tick on a 30-day series
|
|
174
|
+
* has room for «07-15», and without this the axis prints the raw key —
|
|
175
|
+
* `2026-07-15` repeated thirty times, overlapping into a grey band.
|
|
176
|
+
*
|
|
177
|
+
* The library imposes no format: a date key can be a day, a month or a course
|
|
178
|
+
* name, and only the project knows which. See `docs/decisions/0.9.md` § 50.
|
|
179
|
+
*/
|
|
180
|
+
xTickFormatter?: ((value: unknown) => string) | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Formats the tick on the VALUE axis — the currency symbol, the thousands
|
|
183
|
+
* separator, the percent sign.
|
|
184
|
+
*
|
|
185
|
+
* Same reason as `xTickFormatter` and the same shape. `formatter` reaches the
|
|
186
|
+
* tooltip only, so without this a revenue chart reads «1200» on the axis and
|
|
187
|
+
* «$1200» in the tooltip, and the axis is the one you read while comparing.
|
|
188
|
+
*/
|
|
189
|
+
yTickFormatter?: ((value: unknown) => string) | undefined;
|
|
168
190
|
/**
|
|
169
191
|
* Shows the legend. It defaults to «only when there is more than one series»:
|
|
170
192
|
* a legend naming the one line already named by the chart's own heading is a
|
|
@@ -195,7 +217,7 @@ type AreaChartProps = SeriesChartProps & {
|
|
|
195
217
|
/** Adds the series up instead of overlaying them. */
|
|
196
218
|
stacked?: boolean | undefined;
|
|
197
219
|
};
|
|
198
|
-
declare function AreaChart({ data, series, xKey, formatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
220
|
+
declare function AreaChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
199
221
|
/**
|
|
200
222
|
* Bars, upright or lying down.
|
|
201
223
|
*
|
|
@@ -219,7 +241,7 @@ type BarChartProps = SeriesChartProps & {
|
|
|
219
241
|
/** Stacks the series instead of putting them side by side. */
|
|
220
242
|
stacked?: boolean | undefined;
|
|
221
243
|
};
|
|
222
|
-
declare function BarChart({ data, series, xKey, formatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
244
|
+
declare function BarChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
223
245
|
/**
|
|
224
246
|
* Lines, for comparing series against each other.
|
|
225
247
|
*
|
|
@@ -232,6 +254,6 @@ declare function BarChart({ data, series, xKey, formatter, legend, orientation,
|
|
|
232
254
|
* where it means «this one».
|
|
233
255
|
*/
|
|
234
256
|
type LineChartProps = SeriesChartProps;
|
|
235
|
-
declare function LineChart({ data, series, xKey, formatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
257
|
+
declare function LineChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
236
258
|
|
|
237
259
|
export { AreaChart, type AreaChartProps, BarChart, type BarChartProps, ChartContainer, type ChartContainerProps, type ChartDatum, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, type ChartSeries, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, LineChart, type LineChartProps, SERIES_COLORS, type SeriesChartProps, seriesColor };
|
package/dist/chart/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Text } from '../chunk-TRPBID2W.js';
|
|
|
3
3
|
import '../chunk-ODBFN44D.js';
|
|
4
4
|
import { cn } from '../chunk-FAAGZG7A.js';
|
|
5
5
|
import { radius } from '../chunk-FGFNK72B.js';
|
|
6
|
-
import '../chunk-MLKGABMK.js';
|
|
7
6
|
import { useId } from 'react';
|
|
8
7
|
import { ResponsiveContainer, Tooltip, Legend, AreaChart as AreaChart$1, CartesianGrid, XAxis, YAxis, Area, BarChart as BarChart$1, Bar, LineChart as LineChart$1, Line } from 'recharts';
|
|
9
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -106,6 +105,7 @@ var rows = (data) => data;
|
|
|
106
105
|
var color = (series, index) => series.color ?? seriesColor(index);
|
|
107
106
|
var MARGIN = { left: 0, right: 12, top: 8, bottom: 0 };
|
|
108
107
|
var AXIS = { tickLine: false, axisLine: false };
|
|
108
|
+
var tickOf = (format) => format ? { tickFormatter: format } : {};
|
|
109
109
|
var legendOf = (series, legend) => legend ?? series.length > 1 ? /* @__PURE__ */ jsx(ChartLegend, { content: /* @__PURE__ */ jsx(ChartLegendContent, {}) }, "legend") : null;
|
|
110
110
|
var tooltipOf = (formatter) => /* @__PURE__ */ jsx(
|
|
111
111
|
ChartTooltip,
|
|
@@ -120,6 +120,8 @@ function AreaChart({
|
|
|
120
120
|
series,
|
|
121
121
|
xKey,
|
|
122
122
|
formatter,
|
|
123
|
+
xTickFormatter,
|
|
124
|
+
yTickFormatter,
|
|
123
125
|
legend,
|
|
124
126
|
stacked = false,
|
|
125
127
|
...container
|
|
@@ -131,8 +133,8 @@ function AreaChart({
|
|
|
131
133
|
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: color(s, i), stopOpacity: 0.05 })
|
|
132
134
|
] }, s.key)) }),
|
|
133
135
|
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false }),
|
|
134
|
-
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8 }),
|
|
135
|
-
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40 }),
|
|
136
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
137
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
136
138
|
tooltipOf(formatter),
|
|
137
139
|
legendOf(series, legend),
|
|
138
140
|
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
@@ -156,6 +158,8 @@ function BarChart({
|
|
|
156
158
|
series,
|
|
157
159
|
xKey,
|
|
158
160
|
formatter,
|
|
161
|
+
xTickFormatter,
|
|
162
|
+
yTickFormatter,
|
|
159
163
|
legend,
|
|
160
164
|
orientation = "vertical",
|
|
161
165
|
stacked = false,
|
|
@@ -171,11 +175,30 @@ function BarChart({
|
|
|
171
175
|
children: [
|
|
172
176
|
/* @__PURE__ */ jsx(CartesianGrid, { vertical: lying, horizontal: !lying }),
|
|
173
177
|
lying ? [
|
|
174
|
-
/* @__PURE__ */ jsx(
|
|
175
|
-
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
YAxis,
|
|
180
|
+
{
|
|
181
|
+
dataKey: xKey,
|
|
182
|
+
type: "category",
|
|
183
|
+
...AXIS,
|
|
184
|
+
width: 130,
|
|
185
|
+
...tickOf(xTickFormatter)
|
|
186
|
+
},
|
|
187
|
+
"category"
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsx(XAxis, { type: "number", hide: true, ...tickOf(yTickFormatter) }, "value")
|
|
176
190
|
] : [
|
|
177
|
-
/* @__PURE__ */ jsx(
|
|
178
|
-
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
XAxis,
|
|
193
|
+
{
|
|
194
|
+
dataKey: xKey,
|
|
195
|
+
...AXIS,
|
|
196
|
+
tickMargin: 8,
|
|
197
|
+
...tickOf(xTickFormatter)
|
|
198
|
+
},
|
|
199
|
+
"category"
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }, "value")
|
|
179
202
|
],
|
|
180
203
|
tooltipOf(formatter),
|
|
181
204
|
legendOf(series, legend),
|
|
@@ -200,13 +223,15 @@ function LineChart({
|
|
|
200
223
|
series,
|
|
201
224
|
xKey,
|
|
202
225
|
formatter,
|
|
226
|
+
xTickFormatter,
|
|
227
|
+
yTickFormatter,
|
|
203
228
|
legend,
|
|
204
229
|
...container
|
|
205
230
|
}) {
|
|
206
231
|
return /* @__PURE__ */ jsx(ChartContainer, { ...container, children: /* @__PURE__ */ jsxs(LineChart$1, { data: rows(data), margin: MARGIN, children: [
|
|
207
232
|
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false }),
|
|
208
|
-
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8 }),
|
|
209
|
-
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40 }),
|
|
233
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
234
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
210
235
|
tooltipOf(formatter),
|
|
211
236
|
legendOf(series, legend),
|
|
212
237
|
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from './chunk-FAAGZG7A.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var ICON_WEIGHT = "regular";
|
|
5
|
+
var TONE_WEIGHT = {
|
|
6
|
+
action: ICON_WEIGHT,
|
|
7
|
+
current: "fill",
|
|
8
|
+
quiet: "light"
|
|
9
|
+
};
|
|
10
|
+
function Icon({ as: Glyph, tone = "action", label, className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Glyph,
|
|
13
|
+
{
|
|
14
|
+
size: "1em",
|
|
15
|
+
weight: TONE_WEIGHT[tone],
|
|
16
|
+
"aria-hidden": label ? void 0 : true,
|
|
17
|
+
"aria-label": label,
|
|
18
|
+
role: label ? "img" : void 0,
|
|
19
|
+
focusable: "false",
|
|
20
|
+
className: cn("shrink-0", className),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { ICON_WEIGHT, Icon, TONE_WEIGHT };
|