najm-kit 2.10.0 → 2.11.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 +71 -0
- package/README.md +188 -2
- package/dist/{formFill-BcH-m9Kf.d.ts → NNotFoundState-D1CLLLxc.d.ts} +84 -2
- package/dist/{NajmUIProvider-BnReyojl.d.ts → NajmUIProvider-cNCb8Tpn.d.ts} +75 -2
- package/dist/adapters/app.d.ts +4 -2
- package/dist/adapters/app.mjs +6 -3
- package/dist/adapters/next.d.ts +1 -1
- package/dist/adapters/next.mjs +2 -2
- package/dist/chunk-2GFWF46W.mjs +650 -0
- package/dist/{chunk-EUQOTPLV.mjs → chunk-CE7MVEJ2.mjs} +1 -1
- package/dist/{chunk-FDONJASN.mjs → chunk-EEBLEDNI.mjs} +67 -4
- package/dist/chunk-K7T7X6PX.mjs +117 -0
- package/dist/{chunk-JUYT2ISO.mjs → chunk-XZL32HFR.mjs} +2 -112
- package/dist/index.d.ts +80 -35
- package/dist/index.mjs +290 -155
- package/dist/json.mjs +2 -2
- package/dist/theme.css +5 -5
- package/package.json +3 -1
- package/dist/chunk-HML2JZXT.mjs +0 -333
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.11.0 - 2026-08-10
|
|
4
|
+
|
|
5
|
+
- Gave every keyboard-focusable primitive a visible focus ring, from one shared
|
|
6
|
+
source: `focusRingClasses` and `focusRingWithinClasses`, exported from the
|
|
7
|
+
root barrel so consumers stop hand-rolling app-level focus CSS. `TabsContent`
|
|
8
|
+
is keyboard-focusable (Radix sets `tabIndex={0}`) and previously showed no
|
|
9
|
+
indicator at all; `CollapsibleTrigger` now carries its own ring rather than
|
|
10
|
+
relying on whatever it wraps. `BaseInput` paints the ring on the wrapper via
|
|
11
|
+
`has-[:focus-visible]:`, which is what finally gives `NumberInput` and the
|
|
12
|
+
multi-select trigger an indicator — both suppress the inner control's ring,
|
|
13
|
+
so focusing the child element used to change only the border colour.
|
|
14
|
+
- Fixed `Dialog` focus restoration. The opener is captured in
|
|
15
|
+
`onOpenAutoFocus` and refocused on close when focus would otherwise land on
|
|
16
|
+
`<body>`, so dismissing a dialog with Escape returns the keyboard to the
|
|
17
|
+
control that opened it (WCAG 2.4.3) instead of stranding it at the top of
|
|
18
|
+
the document. A caller that calls `preventDefault()` on the close event still
|
|
19
|
+
owns focus entirely.
|
|
20
|
+
- Added `NCredentialsCard`, a one-time handover surface for freshly generated
|
|
21
|
+
secrets. Renders a description list of fields with monospaced, break-all
|
|
22
|
+
values, an optional header icon that defaults to a check mark, an optional
|
|
23
|
+
consumer `actions` slot, and a built-in Copy button. The Copy action resolves
|
|
24
|
+
text through `copyText` when supplied or joins `${label}: ${value}` with
|
|
25
|
+
`\n` in field order otherwise. The button is disabled while a clipboard
|
|
26
|
+
write is pending; on success it swaps to a check icon and `copiedLabel`,
|
|
27
|
+
on failure to a warning icon and `copyErrorLabel`, and either state reverts
|
|
28
|
+
to idle after roughly two seconds. Header and field icons are marked
|
|
29
|
+
decorative, status is announced through a polite `aria-live` region, and
|
|
30
|
+
the Copy button renders before consumer actions so a Done-style dismiss
|
|
31
|
+
stays the last tab stop. The component never rethrows: a missing
|
|
32
|
+
`navigator.clipboard`, a rejected or synchronously thrown `writeText`, and
|
|
33
|
+
a synchronously thrown `copyText` all land in the error state with
|
|
34
|
+
`onCopyError` invoked. State updates and revert timers are guarded so
|
|
35
|
+
unmounting during a pending copy, or starting a second copy while the
|
|
36
|
+
first success state is still showing, never fire stale setters. Logical
|
|
37
|
+
spacing properties keep the layout correct under `dir="rtl"` without a
|
|
38
|
+
consumer override, and each value carries `dir="auto"` so it resolves its own
|
|
39
|
+
text direction: credentials are weak-directionality strings, and inheriting an
|
|
40
|
+
ambient `rtl` paints `+1 555 0100` as `0100 555 1+` and `p@ssw0rd!` as
|
|
41
|
+
`!p@ssw0rd` while the DOM and the copied text stay correct. A genuinely Arabic
|
|
42
|
+
value still renders right-to-left. Packaged English fallbacks ship for the three action
|
|
43
|
+
labels only; every field label, title, and description is the consumer's
|
|
44
|
+
text. Exported as `NCredentialsCard`, `NCredentialField`,
|
|
45
|
+
`NCredentialsCardProps`, and `NCredentialsCardClassNames` from the root
|
|
46
|
+
barrel and from `packages/najm-kit/src/components/data-display`.
|
|
47
|
+
- Added a shared `surface` contract across `NLoadingState`, `NErrorState`, and
|
|
48
|
+
`NEmptyState`. `inline` (default) preserves existing behavior; `panel` adds a
|
|
49
|
+
centered minimum-height frame for table, card, dialog, and sheet bodies
|
|
50
|
+
without a page gutter or a landmark; `page` uses the configured page
|
|
51
|
+
spacing through `NPageLayout as="div"` so it never introduces a nested
|
|
52
|
+
`<main>`. `NLoadingState.fullScreen` keeps precedence over `surface`.
|
|
53
|
+
- Added `NForbiddenState` and `NNotFoundState` as first-class generic Kit
|
|
54
|
+
components. Both default to the page surface, ship token-backed default
|
|
55
|
+
icons (`ShieldOff`, `Compass`), and resolve title and description through
|
|
56
|
+
the new provider defaults. Neither knows the dashboard URL, renders a Next
|
|
57
|
+
`Link`, redirects, or writes route metadata.
|
|
58
|
+
- Added `feedbackDefaults` to `NajmUIProvider`. It is inherited by
|
|
59
|
+
`NajmNextUIProvider` and `NajmAppProvider` through TypeScript — no second
|
|
60
|
+
adapter prop or translation source. Labels resolve through the existing
|
|
61
|
+
structural `t` (most specific: explicit prop > literal default > translated
|
|
62
|
+
key > packaged English). Generic error body copy and empty description
|
|
63
|
+
deliberately have no packaged fallback so the no-provider render is
|
|
64
|
+
unchanged.
|
|
65
|
+
- Exported the new feedback components and props (`NLoadingStateProps`,
|
|
66
|
+
`NErrorStateProps`, `NEmptyStateProps`, `NForbiddenStateProps`,
|
|
67
|
+
`NNotFoundStateProps`, `NFeedbackSurface`, `NFeedbackDefaults`,
|
|
68
|
+
`NFeedbackLabels`, `NFeedbackLabelKeys`, `NFeedbackIconSize`) from the root
|
|
69
|
+
barrel and re-exported them directly from `najm-kit/app` so a Next Server
|
|
70
|
+
Component route can render them without authoring a local `"use client"`
|
|
71
|
+
wrapper. The root entry stays free of `"use client"` and continues to
|
|
72
|
+
share a single `NFeedbackDefaultsContext` across `index` and the adapters.
|
|
73
|
+
|
|
3
74
|
## 2.10.0 - 2026-08-10
|
|
4
75
|
|
|
5
76
|
- Added a shared, failure-aware media source chain for `NAvatar`, `NImage`, and
|
package/README.md
CHANGED
|
@@ -142,9 +142,9 @@ import { Form, FormInput, useNForm } from 'najm-kit';
|
|
|
142
142
|
|----------|-----------|
|
|
143
143
|
| Actions | NButton, IconButton, toggleVariants |
|
|
144
144
|
| Forms | Input, Textarea, Label, Select, Checkbox, RadioGroup, Switch, DateInput, FileInput, ImageInput, AvatarInput |
|
|
145
|
-
| Feedback | Alert, Badge, Progress, Spinner, Toast |
|
|
145
|
+
| Feedback | Alert, Badge, Progress, Spinner, Toast, NLoadingState, NErrorState, NEmptyState, NForbiddenState, NNotFoundState |
|
|
146
146
|
| Layout | Card, Sheet, Dialog, Popover, DropdownMenu, Tabs |
|
|
147
|
-
| Data | Table (NTable), StatCard, DetailList |
|
|
147
|
+
| Data | Table (NTable), StatCard, DetailList, CredentialsCard |
|
|
148
148
|
| Overlays | Command palette, Tooltip, Toast |
|
|
149
149
|
|
|
150
150
|
## Images and avatars
|
|
@@ -275,6 +275,128 @@ Statuses are matched through one rule, exported as `normalizeStatusToken`, so
|
|
|
275
275
|
key for colors, icons, and labels alike. Badge text is presentation: it renames
|
|
276
276
|
nothing in the backend and validates no lifecycle transition.
|
|
277
277
|
|
|
278
|
+
## Feedback states
|
|
279
|
+
|
|
280
|
+
Five public state components cover the reusable cases every application
|
|
281
|
+
otherwise repeats: `NLoadingState`, `NErrorState`, `NEmptyState`,
|
|
282
|
+
`NForbiddenState`, and `NNotFoundState`. They share one layout frame and one
|
|
283
|
+
provider-defaults channel, so an application configures its copy once and
|
|
284
|
+
every consumer below inherits it.
|
|
285
|
+
|
|
286
|
+
### Surfaces
|
|
287
|
+
|
|
288
|
+
Three layouts, one prop. `surface` selects the frame:
|
|
289
|
+
|
|
290
|
+
| `surface` | Use it for | What it does |
|
|
291
|
+
| --- | --- | --- |
|
|
292
|
+
| `"inline"` (default) | A small slot inside an existing component | Legacy sizing, no landmark |
|
|
293
|
+
| `"panel"` | A table body, card body, dialog, or sheet | Centered with a minimum height, no page gutter, no landmark |
|
|
294
|
+
| `"page"` | A real route-level state | Uses page spacing from the design config; renders through a non-`<main>` root |
|
|
295
|
+
|
|
296
|
+
`NLoadingState.fullScreen` keeps its fixed viewport overlay regardless of
|
|
297
|
+
surface — it always wins.
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
import { NLoadingState, NErrorState, NEmptyState } from 'najm-kit';
|
|
301
|
+
|
|
302
|
+
// Inline (default): drop into a card or section.
|
|
303
|
+
<NLoadingState label="Loading orders..." />
|
|
304
|
+
|
|
305
|
+
// Panel: table body or dialog content.
|
|
306
|
+
<NEmptyState surface="panel" title="No orders yet" icon={Inbox} />
|
|
307
|
+
|
|
308
|
+
// Page: route-level empty state. Never introduces a second <main>.
|
|
309
|
+
<NErrorState
|
|
310
|
+
surface="page"
|
|
311
|
+
title="Dashboard unavailable"
|
|
312
|
+
message="We are working on it."
|
|
313
|
+
onRetry={() => refetch()}
|
|
314
|
+
/>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Provider defaults
|
|
318
|
+
|
|
319
|
+
Pass one `feedbackDefaults` map to `NajmUIProvider` (or to `NajmAppProvider`
|
|
320
|
+
through it) and every feedback state beneath uses it. There is one place for
|
|
321
|
+
loading, empty, error, retry, forbidden, and not-found labels, and a single
|
|
322
|
+
language change recomputes them all without remounting the tree.
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
import { NajmAppProvider } from 'najm-kit/app';
|
|
326
|
+
|
|
327
|
+
<NajmAppProvider
|
|
328
|
+
feedbackDefaults={{
|
|
329
|
+
labels: {
|
|
330
|
+
loadingLabel: 'Chargement…',
|
|
331
|
+
emptyTitle: 'Aucune donnée',
|
|
332
|
+
errorTitle: 'Une erreur est survenue',
|
|
333
|
+
retryLabel: 'Réessayer',
|
|
334
|
+
forbiddenTitle: 'Accès refusé',
|
|
335
|
+
forbiddenDescription: 'Vous n\'avez pas la permission.',
|
|
336
|
+
notFoundTitle: 'Page introuvable',
|
|
337
|
+
notFoundDescription: 'La page demandée n\'existe pas.',
|
|
338
|
+
},
|
|
339
|
+
labelKeys: {
|
|
340
|
+
emptyTitle: 'common.empty',
|
|
341
|
+
errorTitle: 'common.error',
|
|
342
|
+
},
|
|
343
|
+
}}
|
|
344
|
+
>
|
|
345
|
+
<App />
|
|
346
|
+
</NajmAppProvider>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Resolution order, most specific first:
|
|
350
|
+
|
|
351
|
+
1. An explicit component prop.
|
|
352
|
+
2. A literal in `feedbackDefaults.labels`.
|
|
353
|
+
3. A translated `feedbackDefaults.labelKeys` value resolved through the
|
|
354
|
+
provider's existing structural `t` function.
|
|
355
|
+
4. The current packaged English fallback, when that field has one.
|
|
356
|
+
|
|
357
|
+
Generic `NErrorState.message` and `NEmptyState.description` deliberately have
|
|
358
|
+
no packaged fallback — the no-provider render must look the same as it did
|
|
359
|
+
before this contract shipped. A configured `errorMessage` opts the generic
|
|
360
|
+
error state into rendering a body; absent that opt-in, the existing
|
|
361
|
+
no-body render is preserved.
|
|
362
|
+
|
|
363
|
+
### Forbidden and not-found
|
|
364
|
+
|
|
365
|
+
Two first-class preset states for the routes every application grows:
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
import { NForbiddenState, NNotFoundState } from 'najm-kit';
|
|
369
|
+
|
|
370
|
+
// Forbidden: provider copy + ShieldOff icon + page surface by default.
|
|
371
|
+
<NForbiddenState
|
|
372
|
+
action={<Link href="/dashboard">Back to dashboard</Link>}
|
|
373
|
+
/>
|
|
374
|
+
|
|
375
|
+
// Not found: provider copy + Compass icon + page surface by default.
|
|
376
|
+
<NNotFoundState
|
|
377
|
+
action={<Link href="/dashboard">Back to dashboard</Link>}
|
|
378
|
+
/>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Both are presentation only. They do not know the dashboard URL, render a
|
|
382
|
+
Next `Link`, redirect, or write route metadata — those belong to the
|
|
383
|
+
application's `not-found.tsx` / `forbidden/page.tsx` files.
|
|
384
|
+
|
|
385
|
+
### Root and `najm-kit/app` imports
|
|
386
|
+
|
|
387
|
+
Both entries export the same five state components. Pick the one that matches
|
|
388
|
+
your boundary:
|
|
389
|
+
|
|
390
|
+
```tsx
|
|
391
|
+
// Client feature code: import from the root barrel.
|
|
392
|
+
import { NEmptyState } from 'najm-kit';
|
|
393
|
+
|
|
394
|
+
// Next Server Component route: import from najm-kit/app, which is the
|
|
395
|
+
// Client Component boundary. A route file can render a state component
|
|
396
|
+
// without authoring a local "use client" wrapper.
|
|
397
|
+
import { NNotFoundState } from 'najm-kit/app';
|
|
398
|
+
```
|
|
399
|
+
|
|
278
400
|
## Global form development tools
|
|
279
401
|
|
|
280
402
|
Enable schema-driven test values once on the full application provider. Every
|
|
@@ -378,6 +500,70 @@ Key behaviors:
|
|
|
378
500
|
`AvatarInput` forwards every preview and accessibility prop unchanged while
|
|
379
501
|
preserving its circular, size, fill, and camera-icon defaults.
|
|
380
502
|
|
|
503
|
+
## Credentials handover
|
|
504
|
+
|
|
505
|
+
`NCredentialsCard` renders the recurring "show a freshly generated secret
|
|
506
|
+
once, let the operator hand it over, never show it again" surface. It owns
|
|
507
|
+
the frame, the description-list semantics, the copy flow, the failure
|
|
508
|
+
handling, and the accessible feedback. Every domain label — title,
|
|
509
|
+
description, field labels, action labels, and any translated toast — stays
|
|
510
|
+
with the application.
|
|
511
|
+
|
|
512
|
+
```tsx
|
|
513
|
+
import { NCredentialsCard, NButton } from "najm-kit";
|
|
514
|
+
import { KeyRound, Phone } from "lucide-react";
|
|
515
|
+
|
|
516
|
+
<NCredentialsCard
|
|
517
|
+
title={t("staff.access.created")}
|
|
518
|
+
description={t("staff.access.oneTimeHint")}
|
|
519
|
+
fields={[
|
|
520
|
+
{ label: t("common.phone"), value: credentials.phone, icon: Phone },
|
|
521
|
+
{ label: t("staff.access.initialPassword"), value: credentials.password, icon: KeyRound },
|
|
522
|
+
]}
|
|
523
|
+
copyLabel={t("common.copyDetails")}
|
|
524
|
+
copiedLabel={t("common.copied")}
|
|
525
|
+
copyErrorLabel={t("common.copyError")}
|
|
526
|
+
actions={<NButton onClick={() => pop()}>{t("common.done")}</NButton>}
|
|
527
|
+
/>
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Behaviour worth knowing:
|
|
531
|
+
|
|
532
|
+
- `fields` renders as a `<dl>` of `<dt>`/`<dd>` pairs. Values default to
|
|
533
|
+
monospaced and mid-string wrapping so secrets stay readable on every
|
|
534
|
+
width.
|
|
535
|
+
- The header icon defaults to a check mark and is always rendered when a
|
|
536
|
+
header is shown. Pass `icon={SomeLucideIcon}` to replace it; pass any
|
|
537
|
+
supported `NIconSource` to swap in a logo, image, or remote URL.
|
|
538
|
+
- The Copy button resolves text through `copyText` when supplied, otherwise
|
|
539
|
+
joins `${label}: ${value}` with `\n` in field order. The button is
|
|
540
|
+
disabled while the clipboard write is pending. Success swaps the label to
|
|
541
|
+
`copiedLabel` and a check icon; failure swaps to `copyErrorLabel` and a
|
|
542
|
+
warning icon. Either state reverts to idle after roughly two seconds.
|
|
543
|
+
- The copy button renders before any consumer `actions` so a Done-style
|
|
544
|
+
dismiss stays the last tab stop and never gets pressed before the secret
|
|
545
|
+
is actually copied.
|
|
546
|
+
- Missing `navigator.clipboard`, rejected `writeText`, and synchronously
|
|
547
|
+
thrown `copyText` / `writeText` all land in the error state and call
|
|
548
|
+
`onCopyError` instead of rethrowing. State updates and revert timers are
|
|
549
|
+
guarded, so unmounting during a pending copy, or starting a second copy
|
|
550
|
+
while the first success state is still showing, never fire stale setters.
|
|
551
|
+
- Status is announced through a polite `aria-live` region. The visible swap
|
|
552
|
+
is the primary feedback — no toast is emitted by the component.
|
|
553
|
+
- Packaged English fallbacks exist for `copyLabel`, `copiedLabel`, and
|
|
554
|
+
`copyErrorLabel` only. Title, description, and every field label are the
|
|
555
|
+
application's text; a consumer that omits them gets no text, not English.
|
|
556
|
+
- Spacing uses logical properties only, so a `dir="rtl"` tree needs no
|
|
557
|
+
override. Each value also carries `dir="auto"`, isolating it from the
|
|
558
|
+
surrounding paragraph direction: a phone number or password inherited into an
|
|
559
|
+
RTL tree otherwise *paints* reordered (`+1 555 0100` as `0100 555 1+`) even
|
|
560
|
+
though the DOM and the copied text are correct. A value whose first strong
|
|
561
|
+
character is Arabic still renders right-to-left.
|
|
562
|
+
|
|
563
|
+
When you only want consumer buttons and no built-in copy, pass
|
|
564
|
+
`hideCopyAction`. Pass `copyText` to format the copied text differently
|
|
565
|
+
(one CSV line per field, a JSON blob, a single concatenated value, …).
|
|
566
|
+
|
|
381
567
|
## Formatting
|
|
382
568
|
|
|
383
569
|
Pure formatters are available from the server-safe `najm-kit/format` entry.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
3
3
|
import { ZodTypeAny, TypeOf } from 'zod';
|
|
4
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
interface NBrandingValue {
|
|
6
7
|
/** Used as the logo's `alt` when the logo does not set one. */
|
|
@@ -94,4 +95,85 @@ type FormDevTools<T extends ZodTypeAny = ZodTypeAny> = boolean | FormDevToolsCon
|
|
|
94
95
|
/** Build form-shaped test values from a Zod object schema. */
|
|
95
96
|
declare function buildFormFill<TSchema extends ZodTypeAny>(schema: TSchema, overrides?: FormFillOverrides): Partial<TypeOf<TSchema>>;
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Shared surface a feedback state renders into.
|
|
100
|
+
*
|
|
101
|
+
* - `inline` (default) keeps each component's existing padding and sizing. No
|
|
102
|
+
* landmark, no page gutter.
|
|
103
|
+
* - `panel` is for table bodies, card bodies, dialogs, sheets, and nested
|
|
104
|
+
* surfaces. Centered with a minimum height, no landmark, no page gutter.
|
|
105
|
+
* - `page` is for actual route-level states. Uses page spacing from the design
|
|
106
|
+
* config, but renders through `NPageLayout as="div"` so it never introduces
|
|
107
|
+
* another `<main>` inside an already-paged shell.
|
|
108
|
+
*/
|
|
109
|
+
type NFeedbackSurface = "inline" | "panel" | "page";
|
|
110
|
+
|
|
111
|
+
interface NLoadingStateProps {
|
|
112
|
+
label?: string;
|
|
113
|
+
className?: string;
|
|
114
|
+
fullScreen?: boolean;
|
|
115
|
+
spinnerVariant?: "default" | "circle" | "pinwheel" | "circle-filled" | "ellipsis" | "ring" | "bars";
|
|
116
|
+
spinnerSize?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Layout surface. `inline` is the default and preserves the legacy look;
|
|
119
|
+
* `panel` is for table/dialog/sheet bodies; `page` uses page spacing
|
|
120
|
+
* without introducing a `<main>`. `fullScreen` takes precedence and renders
|
|
121
|
+
* the fixed viewport overlay regardless of surface.
|
|
122
|
+
*/
|
|
123
|
+
surface?: NFeedbackSurface;
|
|
124
|
+
}
|
|
125
|
+
declare function NLoadingState({ label, className, fullScreen, spinnerVariant, spinnerSize, surface, }: NLoadingStateProps): react_jsx_runtime.JSX.Element;
|
|
126
|
+
|
|
127
|
+
interface NErrorStateProps {
|
|
128
|
+
title?: string;
|
|
129
|
+
message?: string;
|
|
130
|
+
onRetry?: () => void;
|
|
131
|
+
retryLabel?: string;
|
|
132
|
+
className?: string;
|
|
133
|
+
icon?: React__default.ReactNode;
|
|
134
|
+
/** Layout surface. See `NLoadingStateProps.surface`. */
|
|
135
|
+
surface?: NFeedbackSurface;
|
|
136
|
+
}
|
|
137
|
+
declare function NErrorState({ title, message, onRetry, retryLabel, className, icon, surface, }: NErrorStateProps): react_jsx_runtime.JSX.Element;
|
|
138
|
+
|
|
139
|
+
interface NEmptyStateProps {
|
|
140
|
+
title?: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
icon?: React__default.ReactNode | LucideIcon;
|
|
143
|
+
action?: React__default.ReactNode;
|
|
144
|
+
className?: string;
|
|
145
|
+
/** Layout surface. See `NLoadingStateProps.surface`. */
|
|
146
|
+
surface?: NFeedbackSurface;
|
|
147
|
+
}
|
|
148
|
+
declare function NEmptyState({ title, description, icon, action, className, surface, }: NEmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* First-class "access denied" state.
|
|
152
|
+
*
|
|
153
|
+
* Thin preset over `NEmptyState`. Defaults to the page surface and a token-
|
|
154
|
+
* backed `ShieldOff` icon, with title and description resolved from the
|
|
155
|
+
* provider's forbidden defaults. None of the routing, authorization,
|
|
156
|
+
* metadata, or framework-link behavior lives here — that is the
|
|
157
|
+
* application's responsibility.
|
|
158
|
+
*/
|
|
159
|
+
interface NForbiddenStateProps extends NEmptyStateProps {
|
|
160
|
+
title?: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
}
|
|
163
|
+
declare function NForbiddenState(props: NForbiddenStateProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* First-class "page not found" state.
|
|
167
|
+
*
|
|
168
|
+
* Thin preset over `NEmptyState`. Defaults to the page surface and a `Compass`
|
|
169
|
+
* icon, with title and description resolved from the provider's not-found
|
|
170
|
+
* defaults. None of the route-target, metadata, redirect, or framework-link
|
|
171
|
+
* behavior lives here.
|
|
172
|
+
*/
|
|
173
|
+
interface NNotFoundStateProps extends NEmptyStateProps {
|
|
174
|
+
title?: string;
|
|
175
|
+
description?: string;
|
|
176
|
+
}
|
|
177
|
+
declare function NNotFoundState(props: NNotFoundStateProps): react_jsx_runtime.JSX.Element;
|
|
178
|
+
|
|
179
|
+
export { type FormDevToolsOptions as F, type NBrandingInput as N, NEmptyState as a, type NEmptyStateProps as b, NErrorState as c, type NErrorStateProps as d, type NFeedbackSurface as e, NForbiddenState as f, type NForbiddenStateProps as g, NLoadingState as h, type NLoadingStateProps as i, NNotFoundState as j, type NNotFoundStateProps as k, type FormDevTools as l, type FormDevToolsConfig as m, type FormFillOverride as n, type FormFillOverrides as o, type NBrandingEditorValue as p, type NBrandingPayload as q, NBrandingProvider as r, NBrandingStateProvider as s, type NBrandingStateProviderProps as t, type NBrandingValue as u, buildFormFill as v, normalizeBranding as w, useNBranding as x, useNBrandingEditor as y };
|
|
@@ -113,6 +113,69 @@ interface NBadgeDefaults {
|
|
|
113
113
|
statusLabelKeys?: Record<string, string>;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Optional literal labels, supplied as `feedbackDefaults.labels`. Each field
|
|
118
|
+
* is independent: an application can localize one feedback label without
|
|
119
|
+
* touching the others.
|
|
120
|
+
*
|
|
121
|
+
* `errorMessage` is the only key without a packaged fallback. A consumer that
|
|
122
|
+
* supplies one opts a generic error state into rendering a body; absent that
|
|
123
|
+
* opt-in, the no-provider behavior is unchanged.
|
|
124
|
+
*/
|
|
125
|
+
interface NFeedbackLabels {
|
|
126
|
+
loadingLabel?: string;
|
|
127
|
+
emptyTitle?: string;
|
|
128
|
+
errorTitle?: string;
|
|
129
|
+
errorMessage?: string;
|
|
130
|
+
retryLabel?: string;
|
|
131
|
+
forbiddenTitle?: string;
|
|
132
|
+
forbiddenDescription?: string;
|
|
133
|
+
notFoundTitle?: string;
|
|
134
|
+
notFoundDescription?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Map from a feedback field to a translation catalog key. Resolved through the
|
|
138
|
+
* provider's structural `t`. Optional per-field; a missing key falls through
|
|
139
|
+
* to the literal default, then to packaged English.
|
|
140
|
+
*/
|
|
141
|
+
interface NFeedbackLabelKeys {
|
|
142
|
+
loadingLabel?: string;
|
|
143
|
+
emptyTitle?: string;
|
|
144
|
+
errorTitle?: string;
|
|
145
|
+
errorMessage?: string;
|
|
146
|
+
retryLabel?: string;
|
|
147
|
+
forbiddenTitle?: string;
|
|
148
|
+
forbiddenDescription?: string;
|
|
149
|
+
notFoundTitle?: string;
|
|
150
|
+
notFoundDescription?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Provider-level defaults for the shared feedback components.
|
|
154
|
+
*
|
|
155
|
+
* Threaded through `NajmUIProvider.feedbackDefaults` and inherited by the
|
|
156
|
+
* `next` and `app` adapters. No second adapter prop or translation source:
|
|
157
|
+
* the same structural `t` every table and badge reads is what these labels
|
|
158
|
+
* route through.
|
|
159
|
+
*/
|
|
160
|
+
interface NFeedbackDefaults {
|
|
161
|
+
/**
|
|
162
|
+
* Literal overrides. A field that is `undefined` here still resolves through
|
|
163
|
+
* `labelKeys` and the packaged English fallback.
|
|
164
|
+
*/
|
|
165
|
+
labels?: NFeedbackLabels;
|
|
166
|
+
/**
|
|
167
|
+
* Catalog keys resolved through the provider's `t`. Memoize the object: a
|
|
168
|
+
* fresh identity on every render rebuilds the label bundle and re-renders
|
|
169
|
+
* every feedback state beneath the provider.
|
|
170
|
+
*/
|
|
171
|
+
labelKeys?: NFeedbackLabelKeys;
|
|
172
|
+
/**
|
|
173
|
+
* Catalog prefix for translated keys. Keys are read as `<prefix>.<field>`.
|
|
174
|
+
* Defaults to `"common.feedback"`.
|
|
175
|
+
*/
|
|
176
|
+
prefix?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
116
179
|
/**
|
|
117
180
|
* Theme and time zone, the two preferences that outlive a render.
|
|
118
181
|
*
|
|
@@ -229,6 +292,16 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
|
|
|
229
292
|
* for the same reason as `t`.
|
|
230
293
|
*/
|
|
231
294
|
badgeDefaults?: NBadgeDefaults;
|
|
295
|
+
/**
|
|
296
|
+
* Defaults for the shared feedback state components — loading, empty, error,
|
|
297
|
+
* forbidden, and not-found. Each label resolves through the provider's `t`
|
|
298
|
+
* the same way pagination and badge labels do, so the same translator
|
|
299
|
+
* reaches every state without a second bridge.
|
|
300
|
+
*
|
|
301
|
+
* Memoize the object: a fresh identity rebuilds the resolved bundle and
|
|
302
|
+
* re-renders every feedback state beneath.
|
|
303
|
+
*/
|
|
304
|
+
feedbackDefaults?: NFeedbackDefaults;
|
|
232
305
|
}
|
|
233
306
|
/**
|
|
234
307
|
* The one provider a Najm application mounts for UI concerns.
|
|
@@ -249,6 +322,6 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
|
|
|
249
322
|
* an application with a runtime theme editor hoist preferences above its
|
|
250
323
|
* design context without forking this component.
|
|
251
324
|
*/
|
|
252
|
-
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, badgeDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
325
|
+
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, badgeDefaults, feedbackDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
253
326
|
|
|
254
|
-
export { type BadgeColor as B, DEFAULT_TIME_ZONE as D, type
|
|
327
|
+
export { useNajmPreferencesContext as A, type BadgeColor as B, useNajmTheme as C, DEFAULT_TIME_ZONE as D, useNajmTimeZone as E, type NFeedbackDefaults as N, type NFeedbackLabelKeys as a, type NFeedbackLabels as b, type NajmUIProviderProps as c, type NIconSource as d, type BadgeShape as e, Badge as f, type BadgeIcon as g, type BadgeLook as h, type BadgeProps as i, type BadgeSize as j, type BadgeVariant as k, NBadge as l, type NBadgeDefaults as m, type NBadgeLook as n, type NBadgeProps as o, NIcon as p, type NIconProps as q, type NTableDefaults as r, NTableDefaultsProvider as s, type NajmPreferencesContextValue as t, NajmPreferencesProvider as u, type NajmPreferencesProviderProps as v, NajmUIProvider as w, badgeColorVariants as x, badgeVariants as y, useNTableDefaults as z };
|
package/dist/adapters/app.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Translations } from 'najm-i18n';
|
|
3
|
-
import { F as FormDevToolsOptions, N as NBrandingInput } from '../
|
|
3
|
+
import { F as FormDevToolsOptions, N as NBrandingInput } from '../NNotFoundState-D1CLLLxc.js';
|
|
4
|
+
export { a as NEmptyState, b as NEmptyStateProps, c as NErrorState, d as NErrorStateProps, e as NFeedbackSurface, f as NForbiddenState, g as NForbiddenStateProps, h as NLoadingState, i as NLoadingStateProps, j as NNotFoundState, k as NNotFoundStateProps } from '../NNotFoundState-D1CLLLxc.js';
|
|
4
5
|
import { NajmNextUIProviderProps } from './next.js';
|
|
6
|
+
export { N as NFeedbackDefaults, a as NFeedbackLabelKeys, b as NFeedbackLabels } from '../NajmUIProvider-cNCb8Tpn.js';
|
|
5
7
|
import 'react';
|
|
6
8
|
import 'zod';
|
|
9
|
+
import 'lucide-react';
|
|
7
10
|
import 'next/image';
|
|
8
|
-
import '../NajmUIProvider-BnReyojl.js';
|
|
9
11
|
import '../design-types-Rkpt8Pg1.js';
|
|
10
12
|
import '../paginationLabels-dZLSNxfo.js';
|
|
11
13
|
import 'class-variance-authority/types';
|
package/dist/adapters/app.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-
|
|
3
|
-
|
|
4
|
-
import '../chunk-
|
|
2
|
+
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-2GFWF46W.mjs';
|
|
3
|
+
export { NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState } from '../chunk-2GFWF46W.mjs';
|
|
4
|
+
import { NajmNextUIProvider } from '../chunk-CE7MVEJ2.mjs';
|
|
5
|
+
import '../chunk-EEBLEDNI.mjs';
|
|
6
|
+
import '../chunk-XZL32HFR.mjs';
|
|
5
7
|
import '../chunk-KVZACF4G.mjs';
|
|
6
8
|
import '../chunk-JABLSOQN.mjs';
|
|
9
|
+
import '../chunk-TFHWLE7N.mjs';
|
|
7
10
|
import * as React from 'react';
|
|
8
11
|
import { I18nProvider, useTranslation } from 'najm-i18n/react';
|
|
9
12
|
import { jsx } from 'react/jsx-runtime';
|
package/dist/adapters/next.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { ImageProps } from 'next/image';
|
|
4
|
-
import {
|
|
4
|
+
import { c as NajmUIProviderProps } from '../NajmUIProvider-cNCb8Tpn.js';
|
|
5
5
|
import '../design-types-Rkpt8Pg1.js';
|
|
6
6
|
import '../paginationLabels-dZLSNxfo.js';
|
|
7
7
|
import 'class-variance-authority/types';
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { NNextImage, NajmNextUIProvider, NextLinkAdapter, useNextNavigationAdapter } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { NNextImage, NajmNextUIProvider, NextLinkAdapter, useNextNavigationAdapter } from '../chunk-CE7MVEJ2.mjs';
|
|
2
|
+
import '../chunk-EEBLEDNI.mjs';
|
|
3
3
|
import '../chunk-KVZACF4G.mjs';
|