hazo_ui 3.4.1 → 4.1.1

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/CHANGE_LOG.md CHANGED
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## v4.1.1 (2026-06-14)
9
+
10
+ ### New
11
+ - `Slider` — Radix-backed (`@radix-ui/react-slider`) range slider primitive following the shadcn pattern; styled via theme tokens (`bg-primary`/`bg-secondary`) so consumers re-skin via CSS variables. Closes FR-003.
12
+ - `InputAffix` — input with optional `prefix`/`suffix` slots (e.g. a `$` affix) sharing the `Input` primitive's border/height styling; numeric-friendly. Closes FR-004.
13
+ - **ETA Progress Bar** — determinate progress with rolling-window time estimation:
14
+ - `HazoUiProgressBar` — controlled determinate bar driven by a `0..1` `value` prop.
15
+ - `useEtaProgress` — driver hook (`{ value, start, unitDone, finish }`) that estimates remaining time from a rolling window of past run durations.
16
+ - `HazoUiEtaProgress` — storage-backed self-estimating bar that persists its duration window via **`hazo_state`**.
17
+ - Pure estimation helpers `median`, `computeEta`, `easeToward` are exported for direct use/testing.
18
+
19
+ ### Dependencies
20
+ - **`hazo_state` (^0.1.0) is now a required peer dependency.** The `hazo_ui` barrel statically imports `hazo_state/client` (for `HazoUiEtaProgress`), so consumers must install `hazo_state` alongside `hazo_ui`. (It was briefly declared optional, which was incorrect — the import is unconditional.)
21
+
22
+ ### Fixed
23
+ - test-app: `hazo_state` webpack alias now uses an exact (`$`) match so subpath imports (`hazo_state/client`) resolve instead of being rewritten into the bare-package path.
24
+ - test-app autotest: `Slider` / `InputAffix` export-contract scenarios now accept `forwardRef`/`memo` components (which are objects, not functions); added `eta_progress_estimation` (pure-helper behaviour) and `eta_progress_ui` (progress-bar export contract) scenarios.
25
+
26
+ ## v4.0.0 (2026-06-13)
27
+
28
+ ### BREAKING
29
+
30
+ - **`LineChart` and `MultiLineChart` removed.** These components (along with their prop types
31
+ `LineChartProps`, `MultiLineChartProps`, and the `MultiSeries` type) have been extracted from
32
+ `hazo_ui` and re-implemented in `hazo_dataviz` on recharts with the same prop API. Consumers
33
+ must update their imports:
34
+
35
+ ```ts
36
+ // Before (hazo_ui ≤ 3.x)
37
+ import { LineChart, MultiLineChart, type MultiSeries } from "hazo_ui";
38
+
39
+ // After (hazo_ui 4.x)
40
+ import { LineChart, MultiLineChart, type MultiSeries } from "hazo_dataviz/client";
41
+ ```
42
+
43
+ All other chart primitives are **unchanged**: `Sparkline`, `InverseSparkline`, `StackedBars`,
44
+ `DateRangeSelector`, and `FunnelChart` remain in `hazo_ui` along with their shared types
45
+ (`ChartDataPoint`, `ChartDataSeries`, `StackedBar`, `DateRangeOption`, `FunnelStep`).
46
+
47
+ ## v3.5.0 (2026-06-12)
48
+
49
+ ### New
50
+ - `FunnelChart` — horizontal centered-bar conversion funnel with optional segment breakdown, hover tooltip (% of first / % of previous / drop-off), and edge-case handling (empty steps, zero values, single step). Closes FR-002.
51
+
8
52
  ## v3.4.1 — 2026-06-12
9
53
 
10
54
  **Fix:** Webpack compatibility in test-harness format.ts + source sync.
package/README.md CHANGED
@@ -224,6 +224,20 @@ Lightweight, opinionated components for the four ubiquitous async states: **load
224
224
  - **[useLoadingState](#useloadingstate)** hook - `{ isLoading, setLoading, withLoading }` with an async wrapper.
225
225
  - **[useErrorDisplay](#useerrordisplay)** hook - Passive `{ error, setError, clearError }` that coerces `Error` instances to strings.
226
226
 
227
+ ### Form & Feedback Primitives (v4.1)
228
+
229
+ - **Slider** - Radix-backed (`@radix-ui/react-slider`) range slider following the shadcn pattern. Styled via theme tokens (`bg-primary` / `bg-secondary`) so consumers re-skin through CSS variables.
230
+ - **InputAffix** - Input with optional `prefix` / `suffix` slots (e.g. a `$` affix) sharing the base `Input` primitive's border/height styling; numeric-friendly.
231
+ - **ETA Progress Bar** - Determinate progress with rolling-window time estimation:
232
+ - `HazoUiProgressBar` - controlled determinate bar driven by a `0..1` `value` prop.
233
+ - `useEtaProgress` - driver hook returning `{ value, start, unitDone, finish }` that estimates remaining time from past run durations.
234
+ - `HazoUiEtaProgress` - storage-backed self-estimating bar that persists its duration window via `hazo_state` (a **required** peer dependency of hazo_ui — see Setup).
235
+ - Pure helpers `median`, `computeEta`, `easeToward` are exported for direct use/testing.
236
+
237
+ ```tsx
238
+ import { Slider, InputAffix, HazoUiProgressBar, HazoUiEtaProgress, useEtaProgress } from 'hazo_ui';
239
+ ```
240
+
227
241
  ### shadcn/ui Primitive Re-exports
228
242
 
229
243
  All shadcn/ui base components are re-exported from hazo_ui, so sibling hazo_* packages (and consumers) can import UI primitives from a single source without installing shadcn/ui separately:
@@ -3362,6 +3376,66 @@ return error ? <ErrorBanner message={error} onDismiss={clearError} /> : null;
3362
3376
 
3363
3377
  Returns `{ error: string | null; setError: (v: unknown) => void; clearError: () => void }`. Pass `null` (or any nullish value) to `setError` to clear.
3364
3378
 
3379
+ ### HazoUiEtaProgress (Requires optional `hazo_state` peer dependency)
3380
+
3381
+ Smart ETA progress bar that learns from historical operation durations. Fetches a rolling window of past durations from `hazo_state`, estimates completion time based on remaining work units and concurrency, and animates smoothly toward the estimate. Requires `hazo_state` to be installed.
3382
+
3383
+ ```tsx
3384
+ import { HazoUiEtaProgress, type EtaProgressHandle } from "hazo_ui";
3385
+ import { useRef } from "react";
3386
+
3387
+ function FileProcessor() {
3388
+ const handleRef = useRef<EtaProgressHandle>(null);
3389
+
3390
+ async function processFiles(files: File[]) {
3391
+ handleRef.current?.start();
3392
+
3393
+ for (let i = 0; i < files.length; i++) {
3394
+ await processFile(files[i]);
3395
+ handleRef.current?.unitDone();
3396
+ }
3397
+
3398
+ handleRef.current?.finish();
3399
+ }
3400
+
3401
+ return (
3402
+ <>
3403
+ <HazoUiEtaProgress
3404
+ estimateKey="file_processing"
3405
+ unitCount={totalFiles}
3406
+ concurrency={3}
3407
+ windowSize={10}
3408
+ fallbackUnitMs={2000}
3409
+ label="Processing files…"
3410
+ handleRef={handleRef}
3411
+ />
3412
+ <button onClick={() => processFiles(files)}>Start</button>
3413
+ </>
3414
+ );
3415
+ }
3416
+ ```
3417
+
3418
+ **Installation requirement:** This component requires `hazo_state` as a peer dependency. Install it before using `HazoUiEtaProgress`:
3419
+
3420
+ ```bash
3421
+ npm install hazo_state
3422
+ ```
3423
+
3424
+ | Prop | Type | Default | Description |
3425
+ |---|---|---|---|
3426
+ | `estimateKey` | `string` | **required** | Unique key for storing duration history in `hazo_state` |
3427
+ | `unitCount` | `number` | **required** | Total number of work units |
3428
+ | `concurrency` | `number` | `1` | How many units run in parallel |
3429
+ | `windowSize` | `number` | `5` | Number of past durations to average over |
3430
+ | `fallbackUnitMs` | `number` | `5000` | Per-unit estimate (ms) on cold start when no history exists |
3431
+ | `level` | `"global" \| "session" \| "local"` | `"global"` | hazo_state visibility level |
3432
+ | `label` | `string` | — | Label shown above the progress bar |
3433
+ | `endpoint` | `string` | `"/api/hazo-state"` | hazo_state API endpoint (for fetching history) |
3434
+ | `handleRef` | `RefObject<EtaProgressHandle>` | — | Ref exposing `start()`, `unitDone()`, `finish()` methods |
3435
+ | `className` | `string` | — | Additional classes |
3436
+
3437
+ **Headless hook alternative:** For more control, use `useEtaProgress` directly without the component.
3438
+
3365
3439
  ---
3366
3440
 
3367
3441
  ## HazoUiKanban — Drag-Drop Kanban (v2.13.0+)
@@ -3764,6 +3838,38 @@ Props:
3764
3838
  | `showYAxis` | `boolean` | `true` | Render Y-axis ticks (max / mid / 0). |
3765
3839
  | `className` | `string` | — | Container className passthrough. |
3766
3840
 
3841
+ ### FunnelChart
3842
+
3843
+ Conversion-funnel visualization. Horizontal centered bars, one row per step.
3844
+
3845
+ ```tsx
3846
+ import { FunnelChart } from 'hazo_ui';
3847
+
3848
+ <FunnelChart
3849
+ steps={[
3850
+ { label: 'Landing', value: 1000 },
3851
+ { label: 'Timer start', value: 420 },
3852
+ { label: 'Timer complete', value: 180 },
3853
+ ]}
3854
+ showDropoff
3855
+ />
3856
+ ```
3857
+
3858
+ Optional `segments` prop splits each bar into colored sub-bands (mobile/desktop split, traffic-source mix, etc.).
3859
+
3860
+ Props:
3861
+
3862
+ | Prop | Type | Default | Description |
3863
+ |----------------|-------------------------------|----------------|----------------------------------------------------------|
3864
+ | `steps` | `FunnelStep[]` | — | Ordered funnel steps. Each has `label`, optional `value`, optional `segments`. |
3865
+ | `width` | `number` | `360` | viewBox width. |
3866
+ | `height` | `number` | auto | viewBox height. Defaults to `PAD_TOP + steps.length * 44 + PAD_BOTTOM`. |
3867
+ | `color` | `string` | `"#3b82f6"` | Bar fill for steps without segments. |
3868
+ | `valueFormat` | `(n: number) => string` | `format_num` | Override value formatting. |
3869
+ | `showDropoff` | `boolean` | `true` | Show per-step drop-off count below the value label. |
3870
+ | `showTooltip` | `boolean` | `true` | Enable hover tooltip with full step metrics. |
3871
+ | `className` | `string` | — | Container className passthrough. |
3872
+
3767
3873
  ### DateRangeSelector
3768
3874
 
3769
3875
  Framework-agnostic segmented control (`value` + `onChange`) for picking
@@ -98,11 +98,13 @@ The following peer dependencies are required:
98
98
 
99
99
  - [ ] React (^18.0.0 or ^19.0.0)
100
100
  - [ ] React DOM (^18.0.0 or ^19.0.0)
101
+ - [ ] hazo_core (^1.2.0)
102
+ - [ ] hazo_state (^0.1.0) — the `hazo_ui` barrel statically imports `hazo_state/client` (for `HazoUiEtaProgress`), so this is **required** even if you don't use the ETA progress bar.
101
103
 
102
104
  If not already installed:
103
105
 
104
106
  ```bash
105
- npm install react react-dom
107
+ npm install react react-dom hazo_core hazo_state
106
108
  ```
107
109
 
108
110
  ### 3. Install Required Dependencies
@@ -137,6 +139,11 @@ npm install @radix-ui/react-dialog @radix-ui/react-popover @radix-ui/react-selec
137
139
  - **useLoadingState, useErrorDisplay** hooks: No additional dependencies
138
140
  - **Celebration (v2.18.0)**:
139
141
  - **CelebrationProvider, celebrate, CELEBRATION_GRADIENT**: No additional peer deps — `canvas-confetti` and `html-to-image` are bundled direct dependencies
142
+ - **Form & Feedback primitives (v4.1)**:
143
+ - **Slider**: `@radix-ui/react-slider`
144
+ - **InputAffix**: No additional dependencies (uses the base shadcn/ui `Input` component)
145
+ - **HazoUiProgressBar, useEtaProgress, median, computeEta, easeToward**: No additional dependencies
146
+ - **HazoUiEtaProgress**: `hazo_state` (^0.1.0) — a **required** peer dep of hazo_ui (the barrel imports it unconditionally), so it is always installed regardless of which components you use.
140
147
 
141
148
  ### 4. Configure Tailwind CSS
142
149