Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/async-callback-rejections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

Rejected async callbacks no longer surface as unhandled rejections: `Wizard` marks the step as having errors when `validate`, `onValidateStep` or `onComplete` rejects, `LoadMore` shows "Couldn’t load more. Try again." and keeps its button, and the `CommentThread` composer keeps the text and shows an error.
5 changes: 5 additions & 0 deletions .changeset/avatar-upload-transparency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`AvatarUpload` and `cropImage` no longer give transparent images a black background in JPEG output (transparent areas are white), and the cropped avatar file's extension now matches its type, e.g. `.png` with `cropOptions={{ type: "image/png" }}`.
5 changes: 5 additions & 0 deletions .changeset/excel-local-dates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

Excel exports now write `date` and `datetime` cells in local time, like CSV and PDF. Before, a user east of UTC saw dates a day early and times shifted by their UTC offset.
5 changes: 5 additions & 0 deletions .changeset/export-nan-dates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

A `NaN` or out-of-range timestamp in a `date` or `datetime` export column now leaves the cell empty. It used to stop the PDF export with an error and write `NaN-NaN-NaN` to CSV.
5 changes: 5 additions & 0 deletions .changeset/image-cropper-aspect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`ImageCropper` follows a changed `aspect` prop instead of keeping the ratio it was mounted with.
5 changes: 5 additions & 0 deletions .changeset/map-chart-selected-readout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`MapChart` updates the selected region's read-out when `data` or `geojson` changes, instead of showing the value from when it was selected.
5 changes: 5 additions & 0 deletions .changeset/maps-edits-live-region.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

Maps: editing a shape on the map no longer deletes a `MapPolygon` or `MapRoute` shape that is still being entered with the keyboard; `LiveMap` lets a newer `markers` prop replace an earlier streamed update, drops markers that leave `markers`, and its `subscribe` gets a `remove(id)` callback; place search on Google Maps uses the `MapProvider` `region` instead of always the Maldives.
5 changes: 5 additions & 0 deletions .changeset/media-player-src-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`MediaPlayer` now plays the new media when `src` changes. Before, it kept playing the first source.
5 changes: 5 additions & 0 deletions .changeset/qr-code-downloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`QrCode` downloads: `tone="transparent"` in dark mode now saves dark modules on white instead of light modules that do not scan, the SVG download embeds the logo instead of linking to it, and a failed download shows an error under the buttons.
5 changes: 5 additions & 0 deletions .changeset/qr-scanner-repeats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`QrCodeScanner` in `continuous` mode reports a code once while it stays in view instead of four times a second, and when the decoder fails to load it shows a new `decoder-error` status with the Start button to try again.
5 changes: 5 additions & 0 deletions .changeset/signature-pad-dark-ink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`SignaturePad` now draws with black ink by default (`penColor`), so a signature made in dark mode no longer exports as near-white strokes; in dark mode the canvas is shown inverted so the ink stays visible. A saved signature from `defaultValue` is no longer erased when the pad resizes.
5 changes: 5 additions & 0 deletions .changeset/time-series-interval-buckets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/onu": patch
---

`TimeSeriesChart` with `interval` no longer drops rows: rows in the same hour, day, week or month are added up (or averaged with the new `aggregate="mean"`), weekly data no longer needs to fall a whole number of weeks after the first date, and a range too long to fill keeps its newest rows.
7 changes: 5 additions & 2 deletions docs/charts/time-series-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Rows may come in any order; they are sorted oldest first. Dates can be `Date` ob

`null` values break the line. With `interval` (`"hour" | "day" | "week" | "month"`), missing steps are inserted too (3 September above), so a missing day is a visible gap rather than a straight line across it. `connectNulls` bridges gaps instead.

`interval` also groups the data: each point sits at the start of its hour, day, week (counted from the first date) or month, and rows that fall in the same step are added up, so no row is dropped. Set `aggregate="mean"` to average them instead (for rates or temperatures). A range longer than 10,000 steps is drawn without the gap rows rather than cut short.

## Stacked areas and bars

`stacked` adds the series up, so the top edge is the total: use `variant="area"` for stacked areas or `variant="bar"` for stacked bars (a stacked `"line"` chart is drawn as stacked areas). Bars are centred on their date, and the axis is padded by half a step so the first and last bars are whole. The data table and summary still list each series on its own, and the time axis is mirrored in RTL as usual.
Expand Down Expand Up @@ -93,7 +95,8 @@ Also takes the common chart props (`title` (required), `description`, `hideTitle
| ------------------- | -------------------------------------- | ----------- | --------------------------------------- |
| `data` | `Record<string, unknown>[]` | required | One object per point in time |
| `dateKey` | `string` | `"date"` | Key of the date |
| `interval` | `"hour" \| "day" \| "week" \| "month"` | | Fill missing steps with gaps |
| `interval` | `"hour" \| "day" \| "week" \| "month"` | | Group by step and fill missing steps with gaps |
| `aggregate` | `"sum" \| "mean"` | `"sum"` | With `interval`, how rows in one step combine |
| `dateFormat` | `string` (date-fns) | by interval | Tick format (`d MMM`, `MMM yyyy`, time) |
| `tooltipDateFormat` | `string` (date-fns) | by interval | Tooltip and table format |
| `variant` | `"line" \| "area" \| "bar"` | `"line"` | How series are drawn |
Expand All @@ -104,7 +107,7 @@ Also takes the common chart props (`title` (required), `description`, `hideTitle
| `gradient` | `boolean` | `true` | Gradient area and bar fills |
| `comparison` | `ChartComparison` | | This period against the previous one; see [Comparison](#comparison) |

Hourly data uses the locale's `hourCycle`. `normalizeTimeSeries(data, dateKey, interval)` and `toTimestamp(value)` are exported.
Hourly data uses the locale's `hourCycle`. `normalizeTimeSeries(data, dateKey, interval, aggregate)` and `toTimestamp(value)` are exported.

## RTL

Expand Down
2 changes: 2 additions & 0 deletions docs/display-and-feedback/comment-thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { CommentThread } from "@javaabu/onu"

As in the thread, only the author may delete a note; pass `canDelete={() => true}` to let anyone delete.

If `onAdd` or `onEdit` returns a promise that rejects, the composer keeps the text and shows "Couldn’t save. Try again." as an alert.

## Props

| Prop | Type | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion docs/files-and-media/avatar-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { AvatarUpload } from "@javaabu/onu/media"
</FormField>
```

The cropped image is a square JPEG, 512px by default (`cropOptions`), returned as a `File` through `onValueChange` and kept on the hidden file input for plain form submits. If cropping fails (for example a cross-origin image), the original file is used.
The cropped image is a square JPEG, 512px by default (`cropOptions`), with transparent areas filled white; pass `cropOptions={{ type: "image/png" }}` to keep transparency. The file is named after the picked one with the output type's extension (`me.png` → `me.jpg`). It is returned as a `File` through `onValueChange` and kept on the hidden file input for plain form submits. If cropping fails (for example a cross-origin image), the original file is used.

## Props

Expand Down
2 changes: 1 addition & 1 deletion docs/files-and-media/image-cropper.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The canvas helpers are exported for use without the component: `cropImage(src, p
| --------------------- | -------------------------------------- | ---------- | -------------------------------------------------------------------- |
| `src` | `string \| Blob` | | Image URL or picked file |
| `alt` | `string` | (required) | Names the crop area |
| `aspect` | `number` | `1` | Initial aspect ratio |
| `aspect` | `number` | `1` | Aspect ratio; a new value replaces the one in use |
| `aspectOptions` | `{ label, value }[]` | | Aspect presets (`undefined` = free, image ratio) |
| `onAspectChange` | `(aspect) => void` | | A preset was chosen |
| `cropShape` | `"rect" \| "round"` | `"rect"` | Crop shape |
Expand Down
6 changes: 3 additions & 3 deletions docs/files-and-media/qr-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ The code never mirrors and is rendered with tokens through the `tone` variant (`
| `theme` | Follows the theme: light modules on a dark ground in dark mode. Most phone cameras scan this, some older readers do not |
| `transparent` | No background; modules use the current text colour. Keep enough contrast with what is behind |

Recolour with `classNames.svg`, e.g. `classNames={{ svg: "text-primary" }}`. Downloads use the colours as rendered (read with `getComputedStyle`).
Recolour with `classNames.svg`, e.g. `classNames={{ svg: "text-primary" }}`. Downloads use the colours as rendered (read with `getComputedStyle`). Without a background of its own (`tone="transparent"`) the file gets a white one, and light modules (such as the text colour in dark mode) are saved black so the file still scans.

## Logo

`logo` takes a URL or `{ src, size?, excavate? }`. `size` is the logo width as a fraction of the code (0.1–0.3, default 0.22). The modules behind it are cleared unless `excavate={false}`. A logo always uses error-correction level H, so the code still scans with the centre covered. For the PNG download the image must allow CORS; otherwise the PNG has the cleared area without the logo.
`logo` takes a URL or `{ src, size?, excavate? }`. `size` is the logo width as a fraction of the code (0.1–0.3, default 0.22). The modules behind it are cleared unless `excavate={false}`. A logo always uses error-correction level H, so the code still scans with the centre covered. For downloads the image must allow CORS: the SVG download embeds it as a data URL so the saved file stands alone, and the PNG draws it. When it cannot be fetched, the file has the cleared area without the logo.

## Props

Expand Down Expand Up @@ -74,7 +74,7 @@ Also exported for custom rendering: `encodeQrCode(value, level)`, `qrCodePath(mo

- The code is an `img` named by `label` (default "QR code"); give it a label that says what it is for, e.g. "QR code to verify licence BL-2026-04417".
- Put the information in text as well (`showValue`, `caption` or nearby text) for people who cannot scan.
- Download and copy buttons have visible, translated labels and are 44px tall on touch screens. Copying is announced in a polite live region.
- Download and copy buttons have visible, translated labels and are 44px tall on touch screens. Copying is announced in a polite live region. A failed download shows "Could not download the QR code" as an alert under the buttons.
- Text that is too long is reported with `role="alert"`.

| Key | Action |
Expand Down
2 changes: 1 addition & 1 deletion docs/layout-and-navigation/wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Wizard } from "@javaabu/onu"

## Navigation

- **Next** validates the current step (`validate`, then `onValidateStep`) and moves on; on the last step it calls `onComplete`.
- **Next** validates the current step (`validate`, then `onValidateStep`) and moves on; on the last step it calls `onComplete`. A `validate`, `onValidateStep` or `onComplete` that rejects marks the step as having errors, as a failed validation does.
- **Back** never validates.
- With `linear` (default), users can jump back to completed steps, and forward to the furthest unlocked step. `linear={false}` lets them jump anywhere.
- `errorSteps={["address"]}` marks steps with server-side errors.
Expand Down
2 changes: 1 addition & 1 deletion docs/listing-pages/export-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ The export runs from the [`ExportMenu`](export-menu), which announces "Exporting
## RTL and Dhivehi

- With `dir: "rtl"` (automatic for Dhivehi through `useExportRows`), Excel sheets are right to left and the PDF document is `dir="rtl" lang="dv"`.
- Dates use the locale's date-fns locale in the PDF ("12 މާޗު 2026"); CSV and Excel use ISO dates and real date cells.
- Dates use the locale's date-fns locale in the PDF ("12 މާޗު 2026"); CSV and Excel use ISO dates and real date cells. All three show the same local date and time: a `date` of `"2026-03-12"` is 12 March in every format, whatever the user's time zone. An invalid date (an Invalid `Date`, or a timestamp such as `NaN`) is left empty.
- Currency follows `common.currency` ("MVR 1,250.00" / "ރ. 1,250.00"); booleans use `common.yes` / `common.no`.
- Text cells are wrapped in `<bdi>` in the PDF, so Latin and Thaana values each read in their own direction while the column keeps the page alignment.
2 changes: 1 addition & 1 deletion docs/listing-pages/load-more.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { LoadMore } from "@javaabu/onu"
/>
```

If `onLoadMore` returns a promise, the button shows a spinner until it settles (no `loading` prop needed).
If `onLoadMore` returns a promise, the button shows a spinner until it settles (no `loading` prop needed). If the promise rejects, "Couldn’t load more. Try again." appears as an alert and the button stays for another try.

## Props

Expand Down
13 changes: 8 additions & 5 deletions docs/maps/live-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ import { LiveMap } from "@javaabu/onu/maps"

<LiveMap
markers={vessels}
subscribe={(push) => {
const channel = echo.channel("fleet").listen("PositionUpdated", (e) => push(e.vessel))
return () => channel.stopListening("PositionUpdated")
subscribe={(push, remove) => {
const channel = echo
.channel("fleet")
.listen("PositionUpdated", (e) => push(e.vessel))
.listen("VesselDocked", (e) => remove(e.vessel.id))
return () => channel.stopListening("PositionUpdated").stopListening("VesselDocked")
}}
overlay={<MapInfoPanel open={!!selected} … />}
/>
```

Each marker: `{ id, position, title, heading?, tone?, status?, updatedAt? }`. Updates from `subscribe` merge into `markers` by `id`.
Each marker: `{ id, position, title, heading?, tone?, status?, updatedAt? }`. Updates from `subscribe` merge into `markers` by `id`, and `remove(id)` takes a streamed marker off the map. When a marker changes in `markers` (a new position, heading or `updatedAt`, e.g. from polling) or leaves it, that is newer than its streamed update, so the prop wins.

When the selection changes from the built-in list or from outside the map (a controlled `selectedId`, e.g. picking a vessel in your own table), the map pans to centre that marker. It does not turn on follow mode, and a tap on the marker itself does not move the map. Without `center` or `zoom`, the map fits all the markers once (also when they arrive after the first render, e.g. from a stream).

Expand All @@ -33,7 +36,7 @@ Verified on the real Google Maps JavaScript API (see [MapProvider](./map-provide
| Prop | Type | Default | Description |
| ------------------------------------------------- | --------------------------- | ------- | --------------------------------------------------------- |
| `markers` | `LiveMapMarker[]` | `[]` | Current markers |
| `subscribe` | `(push) => unsubscribe` | | Stream of updates |
| `subscribe` | `(push, remove) => unsubscribe` | | Stream of updates |
| `selectedId` / `defaultSelectedId` / `onSelect` | `string \| null` | | Selected marker |
| `followId` / `defaultFollowId` / `onFollowChange` | `string \| null` | | Marker the camera follows |
| `animationDuration` | `number` | `1000` | Glide time in ms (`0` jumps; reduced motion always jumps) |
Expand Down
2 changes: 1 addition & 1 deletion docs/maps/map-polygon.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Verified on the real Google Maps JavaScript API (see [MapProvider](./map-provide

## Accessibility

- Every area can be created, reviewed and edited from the list with the keyboard; changes are announced ("Point 3 added").
- Every area can be created, reviewed and edited from the list with the keyboard; changes are announced ("Point 3 added"). An area still being entered (fewer than 3 points, so not yet on the map) is kept when another area is edited on the map.
- Toolbar buttons are toggle buttons (`aria-pressed`).

| Key | Action |
Expand Down
3 changes: 3 additions & 0 deletions docs/text-inputs/qr-code-scanner.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { QrCodeScanner } from "@javaabu/onu/media"

The camera only starts after the user presses **Start camera** (or with `autoStart`), and browsers only allow it on HTTPS or `localhost`.

With `continuous`, a code that stays in front of the camera is reported once; the same code counts again after it has been out of view for a second.

## States

| Status | Shown |
Expand All @@ -32,6 +34,7 @@ The camera only starts after the user presses **Start camera** (or with `autoSta
| `denied` | How to allow the camera, plus manual entry |
| `no-camera` | No camera found, plus manual entry |
| `unsupported` | The browser cannot scan, plus manual entry |
| `decoder-error` | The code reader could not be loaded; Start tries again |
| `error` | The camera could not be started |

## Props
Expand Down
4 changes: 2 additions & 2 deletions docs/text-inputs/signature-pad.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { SignaturePad } from "@javaabu/onu/media"
| --------------------------------------- | ----------------------------------- | --------------- | ------------------------------------------------------------- |
| `onValueChange` | `(dataUrl: string \| null) => void` | | Called after each stroke or typed change; `null` when cleared |
| `defaultValue` | `string \| null` | | A saved data URL to start from |
| `penColor` | `string` | text colour | Ink colour |
| `penColor` | `string` | `"#000"` | Ink colour, on screen and in the image |
| `backgroundColor` | `string` | transparent | Fill of the exported image |
| `minWidth` / `maxWidth` | `number` | `0.75` / `2.75` | Stroke width range |
| `disabled` | `boolean` | `false` | Stop drawing and disable the buttons |
Expand All @@ -39,7 +39,7 @@ import { SignaturePad } from "@javaabu/onu/media"
Also exported: `renderTypedSignature(text, options?)`.

:::info
The ink follows the theme's text colour by default, so a signature drawn in dark mode exports with light ink. Pass `penColor` (and `backgroundColor`) when the image will be printed or shown on a fixed background.
The ink is black by default, so the exported image reads on a white document in either theme. In dark mode the canvas is shown inverted (with the hue turned back), so dark ink appears light on screen while the saved image keeps the real colours. A saved signature passed as `defaultValue` is drawn again when the canvas resizes.
:::

## RTL and Thaana
Expand Down
Loading
Loading