najm-kit 2.9.0 → 2.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 +192 -174
- package/README.md +477 -349
- package/dist/{NajmUIProvider-CI_73GEp.d.ts → NajmUIProvider-BnReyojl.d.ts} +95 -2
- package/dist/adapters/app.d.ts +4 -1
- package/dist/adapters/app.mjs +3 -3
- package/dist/adapters/next.d.ts +27 -2
- package/dist/adapters/next.mjs +2 -2
- package/dist/{chunk-IRFFSAO2.mjs → chunk-EUQOTPLV.mjs} +26 -2
- package/dist/{chunk-USZUOJMK.mjs → chunk-FDONJASN.mjs} +163 -3
- package/dist/{chunk-GHMR45H3.mjs → chunk-HML2JZXT.mjs} +1 -1
- package/dist/index.d.ts +57 -62
- package/dist/index.mjs +196 -216
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,174 +1,192 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.
|
|
4
|
-
|
|
5
|
-
- Added
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
the
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- `
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.10.0 - 2026-08-10
|
|
4
|
+
|
|
5
|
+
- Added a shared, failure-aware media source chain for `NAvatar`, `NImage`, and
|
|
6
|
+
the new Next-only `NNextImage` export. Sources reset cleanly when inputs or
|
|
7
|
+
cache versions change, duplicate candidates are tried once, consumer event
|
|
8
|
+
handlers are preserved, and failed avatars return to initials without a
|
|
9
|
+
broken-image glyph.
|
|
10
|
+
- `NAvatar` now uses a native lazy-loaded image so loading and error events are
|
|
11
|
+
observable, keeps initials visible until the image paints, supports native
|
|
12
|
+
`imageProps`, and actually tries `fallbackSrc` after a primary failure.
|
|
13
|
+
- Added provider-level status badge defaults and the public
|
|
14
|
+
`normalizeStatusToken` helper. Applications can configure translated status
|
|
15
|
+
labels, colors, icons, look, shape, and size once while explicit badge props
|
|
16
|
+
retain precedence.
|
|
17
|
+
- Added `NNextImage` and `NNextImageProps` to `najm-kit/next` only, preserving
|
|
18
|
+
Next Image `fill`, `sizes`, optimizer, and `unoptimized` controls without
|
|
19
|
+
adding Next.js to the root runtime graph.
|
|
20
|
+
|
|
21
|
+
## 2.9.0 - 2026-08-09
|
|
22
|
+
|
|
23
|
+
- Added `najm-kit/server`, a pure UI bootstrap loader. `createUiBootstrapLoader()`
|
|
24
|
+
takes the application's own fetcher, endpoint paths, payload parsers, and
|
|
25
|
+
factory values, then runs the resources concurrently, unwraps the `{ data }`
|
|
26
|
+
envelope (or one the application selects), and falls back per resource so a
|
|
27
|
+
branding outage never discards a valid appearance. Failures are reported
|
|
28
|
+
through an optional structured `onDiagnostic` callback carrying resource,
|
|
29
|
+
reason, path, and status — never a response body, header, cookie, or raw
|
|
30
|
+
thrown value. A `fallback()` that throws stays a visible error. The entry
|
|
31
|
+
imports no React, no Next.js, and no Node built-in, and re-exports
|
|
32
|
+
`parseNajmDesignConfig` so an appearance payload can be parsed without
|
|
33
|
+
reaching the root barrel.
|
|
34
|
+
- Added `najm-kit/server/react`, the React Server Component adapter.
|
|
35
|
+
`createReactServerUiBootstrap()` memoizes one bootstrap per request with
|
|
36
|
+
React's `cache()` and derives the per-resource accessors from it, so a root
|
|
37
|
+
layout, a nested layout, and a page share one resolution and one stable
|
|
38
|
+
snapshot for the whole render. Resolution is request-scoped only: separate
|
|
39
|
+
requests share no snapshot, failure, or diagnostic, and a transient outage is
|
|
40
|
+
retried on the next request. The `browser` export condition resolves to a
|
|
41
|
+
module that throws, so importing the adapter from a Client Component fails at
|
|
42
|
+
build time instead of shipping the application's fetcher and factory values
|
|
43
|
+
into a browser bundle.
|
|
44
|
+
- The root `najm-kit`, `najm-kit/next`, and `najm-kit/app` entries are unchanged
|
|
45
|
+
and do not reach either server entry.
|
|
46
|
+
|
|
47
|
+
## 2.8.2 - 2026-08-08
|
|
48
|
+
|
|
49
|
+
- Added the framework-neutral `najm-kit/person-images` subpath. It ships a
|
|
50
|
+
built-in resolver for `child`, `adult`, `parent`, and `family` roles with
|
|
51
|
+
the seven WebP illustrations embedded as base64 data URLs, plus
|
|
52
|
+
`createPersonImageResolver` so an application can declare its own role
|
|
53
|
+
names (`teacher`, `student`, `doctor`, `driver`, …) and TypeScript catches
|
|
54
|
+
unknown role strings at the call site. The root `najm-kit` entry stays
|
|
55
|
+
unchanged and does not pull in the person images.
|
|
56
|
+
|
|
57
|
+
## 2.8.1 - 2026-08-08
|
|
58
|
+
|
|
59
|
+
- Added schema-driven form development tools to `NajmAppProvider`. Passing
|
|
60
|
+
`formDevTools` enables F8 filling for every `NForm` and `WizardForm` without
|
|
61
|
+
an application helper or additional provider.
|
|
62
|
+
- Added built-in Zod 4 form-value generation with per-form overrides for
|
|
63
|
+
relation fields and other application-owned values. Existing explicit
|
|
64
|
+
`devTools.enabled` and `devTools.fill` usage remains supported.
|
|
65
|
+
|
|
66
|
+
## 2.8.0 - 2026-08-08
|
|
67
|
+
|
|
68
|
+
- Added server-safe `najm-kit/format` helpers for currency minor units,
|
|
69
|
+
numbers, percentages, dates, times, relative time, tokens, local date inputs,
|
|
70
|
+
and slugs. Client applications can use the same contract reactively through
|
|
71
|
+
`NajmFormatProvider` and `useNajmFormat`.
|
|
72
|
+
- Added the server-safe `najm-kit/pagination` offset protocol, including bounded
|
|
73
|
+
page creation, total-aware continuation, probe-row continuation for APIs
|
|
74
|
+
without totals, and query cleanup that preserves meaningful `false` and `0`.
|
|
75
|
+
- Added the optional-peer `najm-kit/query` entry with offset infinite-query and
|
|
76
|
+
responsive paged/card-list hooks, plus shared card-pagination adapters and
|
|
77
|
+
localized continuation labels.
|
|
78
|
+
- Extended `NajmAppProvider` with formatting locale, currency, and placeholder
|
|
79
|
+
configuration so applications can bind language, time zone, and formatting
|
|
80
|
+
without another host bridge provider.
|
|
81
|
+
- Added shared media-query/card-viewport helpers and avatar-source utilities.
|
|
82
|
+
|
|
83
|
+
## 2.6.2
|
|
84
|
+
|
|
85
|
+
- Added `NSidebarProvider` and `useNSidebar`, so sidebar state can be read from a distance. `NSidebar` renders beside the page content rather than around it, which left applications hand-rolling a context to hand `setMobileOpen` down to a page header — a wrapper component plus an aliased import at every call site. Wrap the shell in `NSidebarProvider` and `NPageHeader` now resolves both `onSidebarOpen` and `mobileBreakpoint` from it, so a header nested anywhere below renders a working mobile trigger with no props threaded to it. Also exports the `NSidebarContextValue` type.
|
|
86
|
+
- `NSidebar` resolves its open and collapsed state as explicit prop → surrounding provider → internal state. Passing `collapsed`, `mobileOpen`, `onCollapsedChange`, or `onMobileOpenChange` keeps behaving exactly as before, and a sidebar with no provider around it still owns its own state, so this is additive for every existing consumer.
|
|
87
|
+
- `logo` accepts a render prop, `({ collapsed, isMobile }) => ReactNode`, alongside the existing node. It receives the state the sidebar actually resolved — including whatever `autoCollapseAt` decided — which consumers previously had to approximate with their own responsive classes, guessing at a breakpoint the sidebar had already computed. The mobile drawer always reports `collapsed: false`, matching how it renders. Exported as `SidebarLogoRender`.
|
|
88
|
+
|
|
89
|
+
## 2.6.1
|
|
90
|
+
|
|
91
|
+
- Fixed the non-card `NPageHeader` bleed never taking effect. 2.6.0 cancelled the page padding with the Tailwind utilities `-mt-[var(--najm-section-gap,0px)]` and `-mx-[var(--najm-page-gutter,0px)]`, which only work if the consuming app's Tailwind build happens to emit those arbitrary classes — they exist nowhere but inside this package's bundle, so a consumer could load a stylesheet without them and the header stayed exactly where it was. The offsets are inline styles now and no longer depend on the consumer's CSS pipeline.
|
|
92
|
+
|
|
93
|
+
## 2.6.0
|
|
94
|
+
|
|
95
|
+
- Added `NThemePresets`, and wired it into `NThemeCustomizer` through `presets`, `selectedPresetId`, `presetsStatus`, `savedDesign`, `onPresetSelect`, `onPresetSave`, `onPresetDelete`, and `presetLabels`. The picker renders only when a host supplies both `presets` and `onPresetSelect`. It is presentational: the host owns where presets live and what saving one means, and selecting a row hands the design back so it can be previewed before anything is stored. Each row draws a swatch strip from the design's own `sidebar`, `primary`, `secondary`, `accent`, and `background` tokens; the selected row's check sits left in the success colour and per-row delete sits right. Omit `onPresetSave` or `onPresetDelete` to hide those controls. Deleting is pointer-only — Radix owns roving focus inside the listbox.
|
|
96
|
+
- **`NPageHeader` in non-card mode is now flush.** It rendered as a full-bleed bar (`border-b`, no radius) but still sat inside the padding `NPageLayout` applies, so it floated below and inside the page gutter and its bottom rule never met the sidebar header's. It now cancels that padding, and its base height goes `min-h-12` → `min-h-14` to match `NSidebarHeader`. **Non-card page headers move up and out to the page edges, and grow 8px below `sm`.** Card mode is unchanged.
|
|
97
|
+
- `NPageLayout` publishes its resolved spacing as `--najm-page-gutter` and `--najm-section-gap`. Descendants could not previously cancel the page padding: a design config resolves the gutter to a literal, so the pre-existing `--page-gutter` / `--section-gap` variables only ever held the fallbacks. Full-bleed children should negate these, with `0px` fallbacks so they stay inert outside `NPageLayout`.
|
|
98
|
+
- Fixed `SelectInput` discarding `SelectItemType.icon`. The prop was declared but `renderItems` rendered the label alone, so every per-item icon was silently dropped. Items with an icon now render it before a truncating label; items without one are unchanged.
|
|
99
|
+
|
|
100
|
+
## 2.5.0
|
|
101
|
+
|
|
102
|
+
- Added `NTableDefaultsProvider`, so an application supplies `paginationLabels` once instead of at every table. Labels merge per key, most specific first: a table's own `paginationLabels` override the provider's for the keys it sets, the provider covers the rest, and anything neither supplies falls back to the packaged English. Also exports `useNTableDefaults` and the `NTableDefaults` type.
|
|
103
|
+
- `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
|
|
104
|
+
|
|
105
|
+
## 2.4.0
|
|
106
|
+
|
|
107
|
+
- `NTablePagination` renders numbered page buttons instead of `Page X of Y`. The window shows the first and last page, the current page, and one page either side, collapsing the rest into at most two gaps. The slot count is constant for any result longer than the window, so the bar does not change width as the reader pages through it, and a gap never stands in for a single page — that slot goes to the page instead.
|
|
108
|
+
- Added `paginationVariant`, defaulting to `"numbered"`. Pass `"compact"` to keep the previous position text with first/previous/next/last controls. **This changes the default appearance of every paginated `NTable`.**
|
|
109
|
+
- The numbered variant drops the first/last double chevrons, because page 1 and page N are now single-click targets of their own. Previous and next remain. The compact variant is unchanged.
|
|
110
|
+
- Numbered pages fall back to compact on their own when the page count is not trustworthy — that is, under `manualPagination` with no `pageCount` supplied, where TanStack infers a count from the rows it happens to hold rather than from a result total. Numbering that would invite clicks on pages that may not exist is not rendered.
|
|
111
|
+
- Below the `sm` breakpoint the numbers give way to the position text; seven page buttons plus the rows-per-page select do not fit a phone.
|
|
112
|
+
- Added `paginationLabels` so the bar can be localized: `rowsPerPage`, `pagination`, `goToPage`, `currentPage`, `firstPage`, `previousPage`, `nextPage`, `lastPage`, `pageOf`, and `rowsSelected`. All optional, all falling back to the previous English strings.
|
|
113
|
+
- Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
|
|
114
|
+
- The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
|
|
115
|
+
- Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
|
|
116
|
+
|
|
117
|
+
## 2.2.1
|
|
118
|
+
|
|
119
|
+
- Fixed a regression in 2.2.0: the dynamic page size reported under `manualPagination` could oscillate. Card row height is measured from rendered cards, so it grows as images decode; feeding that back into the page size refetched, re-rendered, re-measured, and refetched again. A list visibly settled from one page size to another with the loading skeleton flashing twice. The report is now allowed once per container geometry, which does not depend on the rows inside it, so it terminates. A resize still re-arms it, and the debounce still waits for the measurement to settle before reporting.
|
|
120
|
+
|
|
121
|
+
## 2.2.0
|
|
122
|
+
|
|
123
|
+
- Added `cardPagination` mode `infinite`: card lists continue on scroll instead of behind a button. No control and no end-of-list element render while the list is healthy. The continuation button appears only after an append failure, as the retry target.
|
|
124
|
+
- Infinite continuation is owned by `NTableCards`, so the sentinel lives inside the card list's own `NajmScroll` viewport and uses it as the observer root. An appending page renders shaped card placeholders at the grid tail rather than a spinner in a fixed strip, and the polite `aria-live` announcement of appended row counts is preserved.
|
|
125
|
+
- `cardPagination: { mode: "all" }` is now honored in table mode as well as cards: every supplied row renders and no pagination controls are shown.
|
|
126
|
+
- `dynamicHeight` now takes effect under `manualPagination`. The measured page size is reported through the ordinary `onPaginationChange` callback, debounced, so server-paginated tables fill their container while the consumer keeps ownership of fetching. `maxHeight` stays caller-owned under manual pagination, and no page size is reported before the first measurement.
|
|
127
|
+
- Added `calculateCardPageSize`, floored to whole card rows, published as `calculatedCardPageSize`. A card grid page no longer ends in a ragged partial row. This deliberately differs from `calculateCardSkeletonCount`, which ceils because overfilling placeholders is harmless.
|
|
128
|
+
- Removed the deprecated `baseUrl` compiler option from the package tsconfig; `paths` resolves relative to the config file.
|
|
129
|
+
|
|
130
|
+
## 2.1.56
|
|
131
|
+
|
|
132
|
+
- Honor `showIcon` on NTable `select` and `combobox` filters. The leading filter icon is still shown by default; pass `showIcon: false` on a filter to hide it.
|
|
133
|
+
|
|
134
|
+
## 2.1.55
|
|
135
|
+
|
|
136
|
+
- Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
|
|
137
|
+
|
|
138
|
+
## 2.1.53 - 2026-08-05
|
|
139
|
+
|
|
140
|
+
- Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
|
|
141
|
+
components with caller-formatted generic data, accessible summaries, empty
|
|
142
|
+
states, responsive RTL-safe layouts, and shape-matched loading skeletons.
|
|
143
|
+
- Default chart colors to the live `--chart-1` through `--chart-5` theme
|
|
144
|
+
variables, cycle deterministically after five items, and retain explicit
|
|
145
|
+
per-series/item color overrides.
|
|
146
|
+
- Add preset and numeric chart diameter contracts to `NPieChart` and
|
|
147
|
+
`NDonutCard`, including narrow-container shrinking without clipped legends.
|
|
148
|
+
- Make `NDonutCard` item colors optional and add accessible loading states to
|
|
149
|
+
`NDonutCard` and `NStatCard`.
|
|
150
|
+
- Add public API tests, component tests, README guidance, and playground
|
|
151
|
+
examples for the chart and loading contracts.
|
|
152
|
+
|
|
153
|
+
## 2.1.49 - 2026-08-04
|
|
154
|
+
|
|
155
|
+
### ImageInput and AvatarInput
|
|
156
|
+
|
|
157
|
+
- Add `previewAlt`, `fallbackImage`, `fallbackAlt`, `unavailableContent`,
|
|
158
|
+
`imageClassName`, `onPreviewError`, `replaceAriaLabel`, and `clearAriaLabel`
|
|
159
|
+
to `ImageInputProps`. `AvatarInput` forwards every new prop unchanged.
|
|
160
|
+
- Preview sources resolve in this priority order: `value`, `fallbackImage`,
|
|
161
|
+
`defaultImage`. Candidate URLs are deduplicated so a failing primary URL is
|
|
162
|
+
never retried through multiple stages. When every candidate fails, the
|
|
163
|
+
broken `<img>` is unmounted and `unavailableContent` (or a neutral default)
|
|
164
|
+
is rendered in its place.
|
|
165
|
+
- `imageVersion` is appended safely to relative, absolute, queried, and
|
|
166
|
+
fragmented URLs. `data:`, `blob:`, `javascript:`, and `file:` URLs are
|
|
167
|
+
left unchanged.
|
|
168
|
+
- Expose `data-image-input-state="empty" | "preview" | "fallback" | "unavailable"`
|
|
169
|
+
on the preview container for styling, testing, and consumer diagnostics.
|
|
170
|
+
- File selection is race-safe: stale `FileReader` completions cannot replace
|
|
171
|
+
a newer value. Object URLs created by the component are tracked so
|
|
172
|
+
consumer-owned blob URLs are never revoked.
|
|
173
|
+
- Replace and clear controls are real `<button>` elements, are reachable
|
|
174
|
+
with the keyboard, and stay visible on touch and coarse-pointer devices.
|
|
175
|
+
Only on `(hover: hover) and (pointer: fine)` desktops do the controls fall
|
|
176
|
+
back to a hover/focus reveal. `focus-visible` always restores visibility.
|
|
177
|
+
- Use logical positioning (`end-*`) so the clear button works correctly in
|
|
178
|
+
RTL layouts.
|
|
179
|
+
- Re-export `ImageInputPreviewSource` and `ImageInputPreviewError` from
|
|
180
|
+
`najm-kit/components/inputs` and the package root.
|
|
181
|
+
|
|
182
|
+
## 2.1.48 - 2026-08-04
|
|
183
|
+
|
|
184
|
+
- Keep responsive card row actions visible on phone, tablet, and touch input,
|
|
185
|
+
while retaining hover and keyboard-focus reveal on fine-pointer desktops.
|
|
186
|
+
- Size table and card loading skeletons from the measured body and active grid,
|
|
187
|
+
and keep loading borders, radius, color, and shadow aligned with loaded
|
|
188
|
+
surfaces.
|
|
189
|
+
- Add the exported `NTableCardPagination` and `NTableLoadMorePagination`
|
|
190
|
+
contracts for paged, complete supplied-data, and explicit server-backed Load
|
|
191
|
+
more card presentation, including guarded append/retry behavior and accessible
|
|
192
|
+
loading, result, error, and terminal feedback.
|