najm-kit 2.7.0 → 2.7.2
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 +112 -112
- package/dist/NBrandingContext-dkADu8JS.d.ts +82 -0
- package/dist/{NajmUIProvider-BsCoDjHH.d.ts → NajmUIProvider-ClpHD-55.d.ts} +33 -146
- package/dist/adapters/app.d.ts +58 -5
- package/dist/adapters/app.mjs +55 -19
- package/dist/adapters/next.d.ts +2 -1
- package/dist/adapters/next.mjs +3 -3
- package/dist/{chunk-4DLRXB2W.mjs → chunk-6OOBAEH2.mjs} +2 -7
- package/dist/chunk-7J7DWGKB.mjs +93 -0
- package/dist/{chunk-4MRUJ2ZO.mjs → chunk-IRFFSAO2.mjs} +1 -1
- package/dist/{chunk-YBM5CTE6.mjs → chunk-KVZACF4G.mjs} +6 -1
- package/dist/chunk-QOP7L6RD.mjs +218 -0
- package/dist/{chunk-7F65QM43.mjs → chunk-USZUOJMK.mjs} +89 -10
- package/dist/index.d.ts +193 -28
- package/dist/index.mjs +9 -8
- package/dist/json.mjs +3 -3
- package/dist/pagination-BvukSZir.d.ts +130 -0
- package/dist/paginationLabels-CY2PvbMj.d.ts +143 -0
- package/dist/query.d.ts +299 -0
- package/dist/query.mjs +131 -0
- package/package.json +11 -1
- package/dist/chunk-IGUQGT3G.mjs +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.6.2
|
|
4
|
-
|
|
5
|
-
- 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.
|
|
6
|
-
- `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.
|
|
7
|
-
- `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`.
|
|
8
|
-
|
|
9
|
-
## 2.6.1
|
|
10
|
-
|
|
11
|
-
- 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.
|
|
12
|
-
|
|
13
|
-
## 2.6.0
|
|
14
|
-
|
|
15
|
-
- 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.
|
|
16
|
-
- **`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.
|
|
17
|
-
- `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`.
|
|
18
|
-
- 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.
|
|
19
|
-
|
|
20
|
-
## 2.5.0
|
|
21
|
-
|
|
22
|
-
- 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.
|
|
23
|
-
- `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
|
|
24
|
-
|
|
25
|
-
## 2.4.0
|
|
26
|
-
|
|
27
|
-
- `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.
|
|
28
|
-
- 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`.**
|
|
29
|
-
- 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.
|
|
30
|
-
- 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.
|
|
31
|
-
- 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.
|
|
32
|
-
- 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.
|
|
33
|
-
- Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
|
|
34
|
-
- The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
|
|
35
|
-
- Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
|
|
36
|
-
|
|
37
|
-
## 2.2.1
|
|
38
|
-
|
|
39
|
-
- 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.
|
|
40
|
-
|
|
41
|
-
## 2.2.0
|
|
42
|
-
|
|
43
|
-
- 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.
|
|
44
|
-
- 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.
|
|
45
|
-
- `cardPagination: { mode: "all" }` is now honored in table mode as well as cards: every supplied row renders and no pagination controls are shown.
|
|
46
|
-
- `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.
|
|
47
|
-
- 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.
|
|
48
|
-
- Removed the deprecated `baseUrl` compiler option from the package tsconfig; `paths` resolves relative to the config file.
|
|
49
|
-
|
|
50
|
-
## 2.1.56
|
|
51
|
-
|
|
52
|
-
- 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.
|
|
53
|
-
|
|
54
|
-
## 2.1.55
|
|
55
|
-
|
|
56
|
-
- Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
|
|
57
|
-
|
|
58
|
-
## 2.1.53 - 2026-08-05
|
|
59
|
-
|
|
60
|
-
- Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
|
|
61
|
-
components with caller-formatted generic data, accessible summaries, empty
|
|
62
|
-
states, responsive RTL-safe layouts, and shape-matched loading skeletons.
|
|
63
|
-
- Default chart colors to the live `--chart-1` through `--chart-5` theme
|
|
64
|
-
variables, cycle deterministically after five items, and retain explicit
|
|
65
|
-
per-series/item color overrides.
|
|
66
|
-
- Add preset and numeric chart diameter contracts to `NPieChart` and
|
|
67
|
-
`NDonutCard`, including narrow-container shrinking without clipped legends.
|
|
68
|
-
- Make `NDonutCard` item colors optional and add accessible loading states to
|
|
69
|
-
`NDonutCard` and `NStatCard`.
|
|
70
|
-
- Add public API tests, component tests, README guidance, and playground
|
|
71
|
-
examples for the chart and loading contracts.
|
|
72
|
-
|
|
73
|
-
## 2.1.49 - 2026-08-04
|
|
74
|
-
|
|
75
|
-
### ImageInput and AvatarInput
|
|
76
|
-
|
|
77
|
-
- Add `previewAlt`, `fallbackImage`, `fallbackAlt`, `unavailableContent`,
|
|
78
|
-
`imageClassName`, `onPreviewError`, `replaceAriaLabel`, and `clearAriaLabel`
|
|
79
|
-
to `ImageInputProps`. `AvatarInput` forwards every new prop unchanged.
|
|
80
|
-
- Preview sources resolve in this priority order: `value`, `fallbackImage`,
|
|
81
|
-
`defaultImage`. Candidate URLs are deduplicated so a failing primary URL is
|
|
82
|
-
never retried through multiple stages. When every candidate fails, the
|
|
83
|
-
broken `<img>` is unmounted and `unavailableContent` (or a neutral default)
|
|
84
|
-
is rendered in its place.
|
|
85
|
-
- `imageVersion` is appended safely to relative, absolute, queried, and
|
|
86
|
-
fragmented URLs. `data:`, `blob:`, `javascript:`, and `file:` URLs are
|
|
87
|
-
left unchanged.
|
|
88
|
-
- Expose `data-image-input-state="empty" | "preview" | "fallback" | "unavailable"`
|
|
89
|
-
on the preview container for styling, testing, and consumer diagnostics.
|
|
90
|
-
- File selection is race-safe: stale `FileReader` completions cannot replace
|
|
91
|
-
a newer value. Object URLs created by the component are tracked so
|
|
92
|
-
consumer-owned blob URLs are never revoked.
|
|
93
|
-
- Replace and clear controls are real `<button>` elements, are reachable
|
|
94
|
-
with the keyboard, and stay visible on touch and coarse-pointer devices.
|
|
95
|
-
Only on `(hover: hover) and (pointer: fine)` desktops do the controls fall
|
|
96
|
-
back to a hover/focus reveal. `focus-visible` always restores visibility.
|
|
97
|
-
- Use logical positioning (`end-*`) so the clear button works correctly in
|
|
98
|
-
RTL layouts.
|
|
99
|
-
- Re-export `ImageInputPreviewSource` and `ImageInputPreviewError` from
|
|
100
|
-
`najm-kit/components/inputs` and the package root.
|
|
101
|
-
|
|
102
|
-
## 2.1.48 - 2026-08-04
|
|
103
|
-
|
|
104
|
-
- Keep responsive card row actions visible on phone, tablet, and touch input,
|
|
105
|
-
while retaining hover and keyboard-focus reveal on fine-pointer desktops.
|
|
106
|
-
- Size table and card loading skeletons from the measured body and active grid,
|
|
107
|
-
and keep loading borders, radius, color, and shadow aligned with loaded
|
|
108
|
-
surfaces.
|
|
109
|
-
- Add the exported `NTableCardPagination` and `NTableLoadMorePagination`
|
|
110
|
-
contracts for paged, complete supplied-data, and explicit server-backed Load
|
|
111
|
-
more card presentation, including guarded append/retry behavior and accessible
|
|
112
|
-
loading, result, error, and terminal feedback.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.6.2
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
- `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.
|
|
7
|
+
- `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`.
|
|
8
|
+
|
|
9
|
+
## 2.6.1
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
|
|
13
|
+
## 2.6.0
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
- **`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.
|
|
17
|
+
- `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`.
|
|
18
|
+
- 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.
|
|
19
|
+
|
|
20
|
+
## 2.5.0
|
|
21
|
+
|
|
22
|
+
- 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.
|
|
23
|
+
- `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
|
|
24
|
+
|
|
25
|
+
## 2.4.0
|
|
26
|
+
|
|
27
|
+
- `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.
|
|
28
|
+
- 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`.**
|
|
29
|
+
- 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.
|
|
30
|
+
- 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.
|
|
31
|
+
- 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.
|
|
32
|
+
- 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.
|
|
33
|
+
- Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
|
|
34
|
+
- The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
|
|
35
|
+
- Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
|
|
36
|
+
|
|
37
|
+
## 2.2.1
|
|
38
|
+
|
|
39
|
+
- 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.
|
|
40
|
+
|
|
41
|
+
## 2.2.0
|
|
42
|
+
|
|
43
|
+
- 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.
|
|
44
|
+
- 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.
|
|
45
|
+
- `cardPagination: { mode: "all" }` is now honored in table mode as well as cards: every supplied row renders and no pagination controls are shown.
|
|
46
|
+
- `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.
|
|
47
|
+
- 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.
|
|
48
|
+
- Removed the deprecated `baseUrl` compiler option from the package tsconfig; `paths` resolves relative to the config file.
|
|
49
|
+
|
|
50
|
+
## 2.1.56
|
|
51
|
+
|
|
52
|
+
- 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.
|
|
53
|
+
|
|
54
|
+
## 2.1.55
|
|
55
|
+
|
|
56
|
+
- Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
|
|
57
|
+
|
|
58
|
+
## 2.1.53 - 2026-08-05
|
|
59
|
+
|
|
60
|
+
- Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
|
|
61
|
+
components with caller-formatted generic data, accessible summaries, empty
|
|
62
|
+
states, responsive RTL-safe layouts, and shape-matched loading skeletons.
|
|
63
|
+
- Default chart colors to the live `--chart-1` through `--chart-5` theme
|
|
64
|
+
variables, cycle deterministically after five items, and retain explicit
|
|
65
|
+
per-series/item color overrides.
|
|
66
|
+
- Add preset and numeric chart diameter contracts to `NPieChart` and
|
|
67
|
+
`NDonutCard`, including narrow-container shrinking without clipped legends.
|
|
68
|
+
- Make `NDonutCard` item colors optional and add accessible loading states to
|
|
69
|
+
`NDonutCard` and `NStatCard`.
|
|
70
|
+
- Add public API tests, component tests, README guidance, and playground
|
|
71
|
+
examples for the chart and loading contracts.
|
|
72
|
+
|
|
73
|
+
## 2.1.49 - 2026-08-04
|
|
74
|
+
|
|
75
|
+
### ImageInput and AvatarInput
|
|
76
|
+
|
|
77
|
+
- Add `previewAlt`, `fallbackImage`, `fallbackAlt`, `unavailableContent`,
|
|
78
|
+
`imageClassName`, `onPreviewError`, `replaceAriaLabel`, and `clearAriaLabel`
|
|
79
|
+
to `ImageInputProps`. `AvatarInput` forwards every new prop unchanged.
|
|
80
|
+
- Preview sources resolve in this priority order: `value`, `fallbackImage`,
|
|
81
|
+
`defaultImage`. Candidate URLs are deduplicated so a failing primary URL is
|
|
82
|
+
never retried through multiple stages. When every candidate fails, the
|
|
83
|
+
broken `<img>` is unmounted and `unavailableContent` (or a neutral default)
|
|
84
|
+
is rendered in its place.
|
|
85
|
+
- `imageVersion` is appended safely to relative, absolute, queried, and
|
|
86
|
+
fragmented URLs. `data:`, `blob:`, `javascript:`, and `file:` URLs are
|
|
87
|
+
left unchanged.
|
|
88
|
+
- Expose `data-image-input-state="empty" | "preview" | "fallback" | "unavailable"`
|
|
89
|
+
on the preview container for styling, testing, and consumer diagnostics.
|
|
90
|
+
- File selection is race-safe: stale `FileReader` completions cannot replace
|
|
91
|
+
a newer value. Object URLs created by the component are tracked so
|
|
92
|
+
consumer-owned blob URLs are never revoked.
|
|
93
|
+
- Replace and clear controls are real `<button>` elements, are reachable
|
|
94
|
+
with the keyboard, and stay visible on touch and coarse-pointer devices.
|
|
95
|
+
Only on `(hover: hover) and (pointer: fine)` desktops do the controls fall
|
|
96
|
+
back to a hover/focus reveal. `focus-visible` always restores visibility.
|
|
97
|
+
- Use logical positioning (`end-*`) so the clear button works correctly in
|
|
98
|
+
RTL layouts.
|
|
99
|
+
- Re-export `ImageInputPreviewSource` and `ImageInputPreviewError` from
|
|
100
|
+
`najm-kit/components/inputs` and the package root.
|
|
101
|
+
|
|
102
|
+
## 2.1.48 - 2026-08-04
|
|
103
|
+
|
|
104
|
+
- Keep responsive card row actions visible on phone, tablet, and touch input,
|
|
105
|
+
while retaining hover and keyboard-focus reveal on fine-pointer desktops.
|
|
106
|
+
- Size table and card loading skeletons from the measured body and active grid,
|
|
107
|
+
and keep loading borders, radius, color, and shadow aligned with loaded
|
|
108
|
+
surfaces.
|
|
109
|
+
- Add the exported `NTableCardPagination` and `NTableLoadMorePagination`
|
|
110
|
+
contracts for paged, complete supplied-data, and explicit server-backed Load
|
|
111
|
+
more card presentation, including guarded append/retry behavior and accessible
|
|
112
|
+
loading, result, error, and terminal feedback.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NBrandingValue {
|
|
5
|
+
/** Used as the logo's `alt` when the logo does not set one. */
|
|
6
|
+
appName?: string;
|
|
7
|
+
logoExpanded?: ReactNode | string;
|
|
8
|
+
/** Falls back to `logoExpanded`. */
|
|
9
|
+
logoCollapsed?: ReactNode | string;
|
|
10
|
+
/** Swapped in when a `string` logo fails to load. */
|
|
11
|
+
logoFallback?: string;
|
|
12
|
+
logoHref?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What a Najm branding endpoint returns, as the marks the chrome needs.
|
|
16
|
+
*
|
|
17
|
+
* Accepted anywhere branding goes *in* so an application hands over its API
|
|
18
|
+
* payload unchanged instead of renaming two fields at every call site. Fields
|
|
19
|
+
* beyond these are ignored: excess-property checks only fire on object
|
|
20
|
+
* literals, so passing a wider response object — auth logos, a revision — type
|
|
21
|
+
* checks and drops what the chrome has no use for.
|
|
22
|
+
*/
|
|
23
|
+
interface NBrandingPayload {
|
|
24
|
+
sidebarLogoExpandedPath?: string | null;
|
|
25
|
+
sidebarLogoCollapsedPath?: string | null;
|
|
26
|
+
}
|
|
27
|
+
/** Resolved marks, an endpoint payload, or both. */
|
|
28
|
+
type NBrandingInput = NBrandingValue & NBrandingPayload;
|
|
29
|
+
/**
|
|
30
|
+
* Projects an input onto the marks `useNBranding` publishes.
|
|
31
|
+
*
|
|
32
|
+
* Explicit marks win over payload fields, so an application already passing
|
|
33
|
+
* `logoExpanded` — or a `ReactNode` logo, which no payload can express — is
|
|
34
|
+
* unaffected by the wider input type.
|
|
35
|
+
*/
|
|
36
|
+
declare function normalizeBranding(input?: NBrandingInput): NBrandingValue;
|
|
37
|
+
/** Returns `null` outside a provider, so every consumer stays optional. */
|
|
38
|
+
declare function useNBranding(): NBrandingValue | null;
|
|
39
|
+
/**
|
|
40
|
+
* Publishes the app's marks once, so shells stop threading a `logo` through
|
|
41
|
+
* every surface that shows one. `NSidebar` reads this when no `logo` prop is
|
|
42
|
+
* given; an explicit `logo` always wins.
|
|
43
|
+
*
|
|
44
|
+
* Unlike `NSidebarProvider` this owns no state — the values are resolved by the
|
|
45
|
+
* app (usually server-side) and only forwarded, so memoizing on the fields is
|
|
46
|
+
* correct here.
|
|
47
|
+
*/
|
|
48
|
+
declare function NBrandingProvider({ children, appName, logoExpanded, logoCollapsed, logoFallback, logoHref, }: Readonly<NBrandingValue & {
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
51
|
+
interface NBrandingEditorValue {
|
|
52
|
+
branding: NBrandingValue;
|
|
53
|
+
/**
|
|
54
|
+
* Merges a patch over the current marks. Inert while controlled.
|
|
55
|
+
*
|
|
56
|
+
* Takes the endpoint payload shape too, so a settings surface hands back the
|
|
57
|
+
* response it just received rather than renaming its fields first.
|
|
58
|
+
*/
|
|
59
|
+
setBranding: (patch: NBrandingInput) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Lets a settings surface swap the app's marks without a reload.
|
|
63
|
+
*
|
|
64
|
+
* Returns `null` outside `NBrandingStateProvider`, so a branding editor stays
|
|
65
|
+
* mountable in an app that resolves its logos once and never changes them.
|
|
66
|
+
*
|
|
67
|
+
* Only the *display* values live here. Where the assets are stored, who may
|
|
68
|
+
* replace them, and what happens to a superseded upload are the application's
|
|
69
|
+
* concerns, and folding them in would make this a branding backend.
|
|
70
|
+
*/
|
|
71
|
+
declare function useNBrandingEditor(): NBrandingEditorValue | null;
|
|
72
|
+
interface NBrandingStateProviderProps {
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
/** Controlled marks. When given, `setBranding` is inert. */
|
|
75
|
+
branding?: NBrandingInput;
|
|
76
|
+
/** Seeds marks this provider owns from then on; ignored after mount. */
|
|
77
|
+
initialBranding?: NBrandingInput;
|
|
78
|
+
}
|
|
79
|
+
/** `NBrandingProvider` with the marks held as state an editor can write. */
|
|
80
|
+
declare function NBrandingStateProvider({ children, branding, initialBranding, }: Readonly<NBrandingStateProviderProps>): react_jsx_runtime.JSX.Element;
|
|
81
|
+
|
|
82
|
+
export { type NBrandingInput as N, type NBrandingEditorValue as a, type NBrandingPayload as b, NBrandingProvider as c, NBrandingStateProvider as d, type NBrandingStateProviderProps as e, type NBrandingValue as f, useNBrandingEditor as g, normalizeBranding as n, useNBranding as u };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { a as NTablePaginationLabels, e as NajmTranslate } from './paginationLabels-CY2PvbMj.js';
|
|
4
5
|
|
|
5
6
|
type NajmMode = 'light' | 'dark';
|
|
6
7
|
type NajmAccent = 'neutral' | 'emerald' | 'green' | 'slate' | 'blue' | 'violet';
|
|
@@ -160,121 +161,6 @@ declare const NAJM_COMPONENT_NAMES: readonly NajmComponentName[];
|
|
|
160
161
|
declare const RADIUS_VALUE_MAP: Record<string, string>;
|
|
161
162
|
declare function resolveRadiusValue(radius: NajmComponentRadius | undefined): string | undefined;
|
|
162
163
|
|
|
163
|
-
/**
|
|
164
|
-
* How the page controls present position within the result.
|
|
165
|
-
*
|
|
166
|
-
* `numbered` renders a windowed list of page buttons. `compact` renders the
|
|
167
|
-
* `Page X of Y` text with first/previous/next/last controls.
|
|
168
|
-
*
|
|
169
|
-
* `numbered` needs a trustworthy page count. Under `manualPagination` that
|
|
170
|
-
* means the application must pass a `pageCount` derived from a real result
|
|
171
|
-
* total, or — when its endpoint reports no total — pass `hasNextPage` and no
|
|
172
|
-
* `pageCount` at all, which renders the unbounded bar described on the NTable
|
|
173
|
-
* prop. With neither, the bar falls back to `compact` on its own rather than
|
|
174
|
-
* inviting clicks on pages that may not exist.
|
|
175
|
-
*
|
|
176
|
-
* What it must never be handed is a `pageCount` that is really a lower bound,
|
|
177
|
-
* such as `pageIndex + 2`. That reads as a two-page result on page one and a
|
|
178
|
-
* three-page result on page two, so the bar grows a number per click with
|
|
179
|
-
* nothing to say why. NTable warns in development when it catches a count
|
|
180
|
-
* moving in lockstep with the page index.
|
|
181
|
-
*/
|
|
182
|
-
type NTablePaginationVariant = "numbered" | "compact";
|
|
183
|
-
/**
|
|
184
|
-
* Accessible names and visible copy for the page controls.
|
|
185
|
-
*
|
|
186
|
-
* Every field is optional and falls back to English. Supply them to localize —
|
|
187
|
-
* the numbered variant is mostly digits, but its controls still need names.
|
|
188
|
-
*/
|
|
189
|
-
interface NTablePaginationLabels {
|
|
190
|
-
/** Labels the rows-per-page select. Defaults to `"Rows/page"`. */
|
|
191
|
-
rowsPerPage?: string;
|
|
192
|
-
/** Accessible name of the whole page control group. Defaults to `"Pagination"`. */
|
|
193
|
-
pagination?: string;
|
|
194
|
-
/** Accessible name for one page button, given a 1-based page. */
|
|
195
|
-
goToPage?: (page: number) => string;
|
|
196
|
-
/** Accessible name of the current page button, given a 1-based page. */
|
|
197
|
-
currentPage?: (page: number) => string;
|
|
198
|
-
firstPage?: string;
|
|
199
|
-
previousPage?: string;
|
|
200
|
-
nextPage?: string;
|
|
201
|
-
lastPage?: string;
|
|
202
|
-
/** The `compact` variant's position text, given 1-based values. */
|
|
203
|
-
pageOf?: (page: number, pageCount: number) => string;
|
|
204
|
-
/**
|
|
205
|
-
* The position text when the result has no known total, given the 1-based
|
|
206
|
-
* page. Defaults to `"Page X"` — there is no `of Y` to state, and repeating
|
|
207
|
-
* the moving lower bound there would be the same lie the numbered bar avoids.
|
|
208
|
-
*/
|
|
209
|
-
pageOfUnknown?: (page: number) => string;
|
|
210
|
-
/** The selection summary, given selected and total row counts. */
|
|
211
|
-
rowsSelected?: (selected: number, total: number) => string;
|
|
212
|
-
}
|
|
213
|
-
interface NTableLoadMorePagination {
|
|
214
|
-
/** Render the supplied rows as one card list with an explicit continuation control. */
|
|
215
|
-
mode: "load-more";
|
|
216
|
-
/** Whether the owning application has another server page available. */
|
|
217
|
-
hasNextPage: boolean;
|
|
218
|
-
/** True while the owning application is appending the next page. */
|
|
219
|
-
loadingMore?: boolean;
|
|
220
|
-
/** A controlled append error. Existing rows remain rendered and the control becomes Retry. */
|
|
221
|
-
loadMoreError?: ReactNode;
|
|
222
|
-
/** Fetch exactly one additional page. Najm Kit never constructs or owns the request. */
|
|
223
|
-
onLoadMore: () => unknown | Promise<unknown>;
|
|
224
|
-
loadMoreLabel?: string;
|
|
225
|
-
loadingMoreLabel?: string;
|
|
226
|
-
retryLabel?: string;
|
|
227
|
-
endLabel?: string;
|
|
228
|
-
loadMoreErrorLabel?: string;
|
|
229
|
-
/** Localize the polite announcement made after appended rows arrive. */
|
|
230
|
-
itemsLoadedLabel?: (count: number) => string;
|
|
231
|
-
}
|
|
232
|
-
interface NTableInfinitePagination {
|
|
233
|
-
/**
|
|
234
|
-
* Render the supplied rows as one card list that continues automatically when
|
|
235
|
-
* the end of the list scrolls into view. No control and no end-of-list
|
|
236
|
-
* element are rendered while the list is healthy; the continuation button
|
|
237
|
-
* appears only after an append failure, as the retry target.
|
|
238
|
-
*/
|
|
239
|
-
mode: "infinite";
|
|
240
|
-
/** Whether the owning application has another server page available. */
|
|
241
|
-
hasNextPage: boolean;
|
|
242
|
-
/** True while the owning application is appending the next page. */
|
|
243
|
-
loadingMore?: boolean;
|
|
244
|
-
/** A controlled append error. Existing rows remain rendered and Retry appears. */
|
|
245
|
-
loadMoreError?: ReactNode;
|
|
246
|
-
/** Fetch exactly one additional page. Najm Kit never constructs or owns the request. */
|
|
247
|
-
onLoadMore: () => unknown | Promise<unknown>;
|
|
248
|
-
/**
|
|
249
|
-
* Distance ahead of the list end at which the next page is requested.
|
|
250
|
-
* Defaults to `"80px"`.
|
|
251
|
-
*/
|
|
252
|
-
rootMargin?: string;
|
|
253
|
-
loadingMoreLabel?: string;
|
|
254
|
-
retryLabel?: string;
|
|
255
|
-
loadMoreErrorLabel?: string;
|
|
256
|
-
/** Localize the polite announcement made after appended rows arrive. */
|
|
257
|
-
itemsLoadedLabel?: (count: number) => string;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Presentation policy used while NTable is actually rendering cards.
|
|
261
|
-
*
|
|
262
|
-
* `paged` preserves the existing page controls. `all` renders every supplied
|
|
263
|
-
* row without a footer, in card and table modes alike. `load-more` renders
|
|
264
|
-
* every supplied row and adds a guarded, accessible continuation control.
|
|
265
|
-
* `infinite` renders every supplied row and continues on scroll instead.
|
|
266
|
-
*
|
|
267
|
-
* Applications remain responsible for fetching, accumulating, filtering,
|
|
268
|
-
* sorting, authorization, and privacy. `all` renders exactly the rows it is
|
|
269
|
-
* given and never fetches, so a caller that has not loaded the whole set must
|
|
270
|
-
* not select it.
|
|
271
|
-
*/
|
|
272
|
-
type NTableCardPagination = {
|
|
273
|
-
mode?: "paged";
|
|
274
|
-
} | {
|
|
275
|
-
mode: "all";
|
|
276
|
-
} | NTableLoadMorePagination | NTableInfinitePagination;
|
|
277
|
-
|
|
278
164
|
/**
|
|
279
165
|
* Defaults every `NTable` beneath the provider inherits.
|
|
280
166
|
*
|
|
@@ -328,7 +214,13 @@ interface NajmPreferencesProviderProps {
|
|
|
328
214
|
onThemeChange?: (theme: NajmMode) => void | Promise<void>;
|
|
329
215
|
/** Persist the new time zone. Rejections propagate to `setTimeZone`. */
|
|
330
216
|
onTimeZoneChange?: (timeZone: string) => void | Promise<void>;
|
|
331
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Sanitize a time zone before it is stored.
|
|
219
|
+
*
|
|
220
|
+
* Defaults to an IANA check that falls back to `DEFAULT_TIME_ZONE`, which is
|
|
221
|
+
* what every application wanted from the callback it used to have to supply.
|
|
222
|
+
* Pass one to narrow further — a fixed set backing a picker, say.
|
|
223
|
+
*/
|
|
332
224
|
normalizeTimeZone?: (value: string) => string;
|
|
333
225
|
}
|
|
334
226
|
/**
|
|
@@ -354,42 +246,37 @@ declare function useNajmTheme(): Pick<NajmPreferencesContextValue, "theme" | "se
|
|
|
354
246
|
/** The live time zone and a setter that persists through `onTimeZoneChange`. */
|
|
355
247
|
declare function useNajmTimeZone(): Pick<NajmPreferencesContextValue, "timeZone" | "setTimeZone">;
|
|
356
248
|
|
|
357
|
-
/**
|
|
358
|
-
* The translator shape `NajmUIProvider` accepts.
|
|
359
|
-
*
|
|
360
|
-
* Deliberately structural rather than an import from `najm-i18n`: the kit
|
|
361
|
-
* depends on no `najm-*` package, and this signature is satisfied by every
|
|
362
|
-
* mainstream i18n library. The application keeps its catalog and its own
|
|
363
|
-
* language provider.
|
|
364
|
-
*/
|
|
365
|
-
type NajmTranslate = (key: string, params?: Record<string, string | number>) => string;
|
|
366
|
-
declare const DEFAULT_PAGINATION_KEY_PREFIX = "common.pagination";
|
|
367
|
-
/**
|
|
368
|
-
* Projects a translator onto the ten pagination labels.
|
|
369
|
-
*
|
|
370
|
-
* Keys are `<prefix>.<field>`, matching the `NTablePaginationLabels` field
|
|
371
|
-
* names one-for-one, so a catalog is readable next to the type. Interpolation
|
|
372
|
-
* params are named for what they are: `page`, `pageCount`, `selected`, `total`.
|
|
373
|
-
*
|
|
374
|
-
* No result is inspected or second-guessed. A translator that echoes missing
|
|
375
|
-
* keys will render those keys — that is the translator's contract to define,
|
|
376
|
-
* and quietly swapping in English would hide the missing entry rather than
|
|
377
|
-
* surface it. Applications that want the packaged English for a given label
|
|
378
|
-
* should omit the key from the prefix and override it via `tableDefaults`.
|
|
379
|
-
*/
|
|
380
|
-
declare function buildPaginationLabels(t: NajmTranslate, prefix?: string): NTablePaginationLabels;
|
|
381
|
-
|
|
382
249
|
interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "children"> {
|
|
383
250
|
children: React$1.ReactNode;
|
|
384
251
|
/**
|
|
385
|
-
* The design config handed to `NajmDesignProvider
|
|
252
|
+
* The design config handed to `NajmDesignProvider`, owned by the application.
|
|
386
253
|
*
|
|
387
254
|
* Optional, and deliberately so: an application with no runtime theme editor
|
|
388
255
|
* has nothing to put here, and requiring it was the only reason such an
|
|
389
256
|
* application still had to author a provider file just to hold a constant.
|
|
257
|
+
*
|
|
258
|
+
* Prefer `initialDesign` for a theme editor. Passing `design` means the
|
|
259
|
+
* application holds the draft state itself, which is the file this provider
|
|
260
|
+
* exists to delete.
|
|
390
261
|
*/
|
|
391
262
|
design?: NajmDesignConfig;
|
|
392
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* Seeds design state this provider owns from then on; ignored after mount.
|
|
265
|
+
* A theme editor drives it through `useNajmDesignEditor`.
|
|
266
|
+
*/
|
|
267
|
+
initialDesign?: NajmDesignConfig;
|
|
268
|
+
/**
|
|
269
|
+
* Forwarded to `NajmDesignProvider`, merged over a `min-h-full` default.
|
|
270
|
+
*
|
|
271
|
+
* The default is not decoration. `NajmThemeProvider` renders a real `div`
|
|
272
|
+
* between the document body and the application, and a block box of
|
|
273
|
+
* automatic height severs any `h-full` chain below it — every application
|
|
274
|
+
* mounting this at the root was passing the same class back to repair that.
|
|
275
|
+
* It is inert where it is not needed: a percentage `min-height` against an
|
|
276
|
+
* auto-height parent imposes no constraint.
|
|
277
|
+
*
|
|
278
|
+
* Merged with `cn`, so a conflicting utility here still wins.
|
|
279
|
+
*/
|
|
393
280
|
className?: string;
|
|
394
281
|
/**
|
|
395
282
|
* Translator for the pagination labels. Omit it and the packaged English
|
|
@@ -426,6 +313,6 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
|
|
|
426
313
|
* an application with a runtime theme editor hoist preferences above its
|
|
427
314
|
* design context without forking this component.
|
|
428
315
|
*/
|
|
429
|
-
declare function NajmUIProvider({ children, design, className, t, paginationKeyPrefix, tableDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
316
|
+
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
430
317
|
|
|
431
|
-
export {
|
|
318
|
+
export { resolveRadiusValue as A, useNTableDefaults as B, useNajmPreferencesContext as C, DEFAULT_TIME_ZONE as D, useNajmTheme as E, useNajmTimeZone as F, type NajmUIProviderProps as N, RADIUS_VALUE_MAP as R, type NajmDesignConfig as a, type NajmThemeProviderProps as b, type NajmAppearance as c, type NajmMode as d, type NajmThemeConfig as e, type NajmAccent as f, type NajmThemeTokens as g, type NajmPreset as h, type NajmComponentName as i, type NajmComponentStyleConfig as j, type NajmComponentThemeConfig as k, type NajmTypographyConfig as l, type NajmLayoutConfig as m, type NajmVariantStyle as n, type NajmResponsiveBreakpoint as o, type NajmResponsiveValue as p, NAJM_COMPONENT_NAMES as q, type NTableDefaults as r, NTableDefaultsProvider as s, type NajmComponentRadius as t, type NajmDensity as u, type NajmPreferencesContextValue as v, NajmPreferencesProvider as w, type NajmPreferencesProviderProps as x, type NajmSlotStyle as y, NajmUIProvider as z };
|
package/dist/adapters/app.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Translations } from 'najm-i18n';
|
|
3
|
+
import { N as NBrandingInput } from '../NBrandingContext-dkADu8JS.js';
|
|
3
4
|
import { NajmNextUIProviderProps } from './next.js';
|
|
4
5
|
import 'react';
|
|
5
|
-
import '../NajmUIProvider-
|
|
6
|
+
import '../NajmUIProvider-ClpHD-55.js';
|
|
7
|
+
import '../paginationLabels-CY2PvbMj.js';
|
|
6
8
|
|
|
7
9
|
/** Branding shown by the kit's chrome. Purely presentational values. */
|
|
8
10
|
interface NajmAppBranding {
|
|
@@ -29,7 +31,54 @@ interface NajmAppProviderProps extends Omit<NajmNextUIProviderProps, 't'> {
|
|
|
29
31
|
* would discard that work to re-render the same strings from the server.
|
|
30
32
|
*/
|
|
31
33
|
languageEndpoint?: string;
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The product name, used as the logo's `alt` and by the kit's chrome.
|
|
36
|
+
*
|
|
37
|
+
* Separate from `initialBranding` because it is a constant rather than
|
|
38
|
+
* something a branding editor swaps, and because it is the one mark no
|
|
39
|
+
* branding endpoint returns. An `appName` inside `initialBranding` wins.
|
|
40
|
+
*/
|
|
41
|
+
appName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* ISO 4217 code for `useNajmFormat().money`, e.g. `"MAD"`.
|
|
44
|
+
*
|
|
45
|
+
* Omitted means the application does not format currency. It is not defaulted
|
|
46
|
+
* to anything: rendering an amount in the wrong currency is worse than the
|
|
47
|
+
* error thrown for the missing code.
|
|
48
|
+
*/
|
|
49
|
+
currency?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Maps a `najm-i18n` language onto the BCP 47 tag used for formatting, e.g.
|
|
52
|
+
* `{ en: "en-MA", fr: "fr-MA" }`.
|
|
53
|
+
*
|
|
54
|
+
* The distinction matters because language and region are separate choices:
|
|
55
|
+
* `fr` alone formats dates and separators the French way, which is not how
|
|
56
|
+
* they are written in Morocco. Unmapped languages are used as-is.
|
|
57
|
+
*/
|
|
58
|
+
locales?: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Fixes the formatting locale, ignoring the active language. Escape hatch for
|
|
61
|
+
* an application whose language and number formats are genuinely independent.
|
|
62
|
+
*/
|
|
63
|
+
locale?: string;
|
|
64
|
+
/** Rendered for absent values. Defaults to an em dash. */
|
|
65
|
+
formatPlaceholder?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Controlled marks. Prefer `initialBranding` — passing this means the
|
|
68
|
+
* application holds the state itself, which is the file this provider exists
|
|
69
|
+
* to delete.
|
|
70
|
+
*/
|
|
71
|
+
branding?: NBrandingInput;
|
|
72
|
+
/**
|
|
73
|
+
* Seeds marks this provider owns from then on; ignored after mount. A
|
|
74
|
+
* branding editor swaps them through `useNBrandingEditor`.
|
|
75
|
+
*
|
|
76
|
+
* Takes a branding endpoint's payload as-is — `sidebarLogoExpandedPath` and
|
|
77
|
+
* `sidebarLogoCollapsedPath` are read straight off it, and unrelated fields
|
|
78
|
+
* are ignored — so the application forwards its response rather than
|
|
79
|
+
* renaming two keys here.
|
|
80
|
+
*/
|
|
81
|
+
initialBranding?: NBrandingInput;
|
|
33
82
|
}
|
|
34
83
|
/**
|
|
35
84
|
* The whole UI provider stack for a Najm application, as one component.
|
|
@@ -43,9 +92,13 @@ interface NajmAppProviderProps extends Omit<NajmNextUIProviderProps, 't'> {
|
|
|
43
92
|
* and an application that wants different query policy should not have to fork
|
|
44
93
|
* a provider to get it. Mount them above this, from their own packages.
|
|
45
94
|
*
|
|
46
|
-
* Design
|
|
47
|
-
*
|
|
95
|
+
* Design and branding are optional, and both are *uncontrolled* through their
|
|
96
|
+
* `initial*` props: an application with a runtime theme or branding editor
|
|
97
|
+
* seeds them from the server once and drives them afterwards through
|
|
98
|
+
* `useNajmDesignEditor` and `useNBrandingEditor`, rather than holding a draft
|
|
99
|
+
* state machine of its own above this provider. The controlled `design` and
|
|
100
|
+
* `branding` props still work for applications that already do.
|
|
48
101
|
*/
|
|
49
|
-
declare function NajmAppProvider({ translations, initialLanguage, defaultLanguage, languageEndpoint, ...props }: NajmAppProviderProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function NajmAppProvider({ translations, initialLanguage, defaultLanguage, languageEndpoint, appName, initialBranding, ...props }: NajmAppProviderProps): react_jsx_runtime.JSX.Element;
|
|
50
103
|
|
|
51
104
|
export { type NajmAppBranding, NajmAppProvider, type NajmAppProviderProps };
|