najm-kit 2.9.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 +263 -174
- package/README.md +665 -351
- package/dist/{formFill-BcH-m9Kf.d.ts → NNotFoundState-D1CLLLxc.d.ts} +84 -2
- package/dist/NajmUIProvider-cNCb8Tpn.d.ts +327 -0
- package/dist/adapters/app.d.ts +7 -2
- package/dist/adapters/app.mjs +6 -3
- package/dist/adapters/next.d.ts +27 -2
- package/dist/adapters/next.mjs +2 -2
- package/dist/chunk-2GFWF46W.mjs +650 -0
- package/dist/{chunk-IRFFSAO2.mjs → chunk-CE7MVEJ2.mjs} +26 -2
- package/dist/chunk-EEBLEDNI.mjs +480 -0
- package/dist/chunk-K7T7X6PX.mjs +117 -0
- package/dist/{chunk-JUYT2ISO.mjs → chunk-XZL32HFR.mjs} +2 -112
- package/dist/index.d.ts +134 -94
- package/dist/index.mjs +480 -365
- package/dist/json.mjs +2 -2
- package/dist/theme.css +5 -5
- package/package.json +3 -1
- package/dist/NajmUIProvider-CI_73GEp.d.ts +0 -161
- package/dist/chunk-GHMR45H3.mjs +0 -333
- package/dist/chunk-USZUOJMK.mjs +0 -257
|
@@ -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 };
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { e as NajmMode, a as NajmDesignConfig } from './design-types-Rkpt8Pg1.js';
|
|
5
|
+
import { b as NTablePaginationLabels, N as NajmTranslate } from './paginationLabels-dZLSNxfo.js';
|
|
6
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
|
+
import { VariantProps } from 'class-variance-authority';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Defaults every `NTable` beneath the provider inherits.
|
|
11
|
+
*
|
|
12
|
+
* Localized copy is the motivating case: an application with more than a couple
|
|
13
|
+
* of tables should not repeat the same label bundle at every render site, and
|
|
14
|
+
* an application with more than one locale should not have to remember to.
|
|
15
|
+
*/
|
|
16
|
+
interface NTableDefaults {
|
|
17
|
+
paginationLabels?: NTablePaginationLabels;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Supply table defaults to everything below.
|
|
21
|
+
*
|
|
22
|
+
* `value` is passed straight through, so memoize it in the caller — an inline
|
|
23
|
+
* object literal rebuilds on every render of the shell and re-renders every
|
|
24
|
+
* table beneath it. Most label fields are functions, so `useMemo` on the
|
|
25
|
+
* translator is usually the whole job.
|
|
26
|
+
*/
|
|
27
|
+
declare function NTableDefaultsProvider({ children, value, }: {
|
|
28
|
+
children: React__default.ReactNode;
|
|
29
|
+
value: NTableDefaults;
|
|
30
|
+
}): react_jsx_runtime.JSX.Element;
|
|
31
|
+
declare function useNTableDefaults(): NTableDefaults;
|
|
32
|
+
|
|
33
|
+
type NIconSource = React__default.ReactElement | React__default.ComponentType<any> | React__default.ExoticComponent<any> | string | {
|
|
34
|
+
src: string;
|
|
35
|
+
alt?: string;
|
|
36
|
+
};
|
|
37
|
+
type NIconProps = Omit<React__default.HTMLAttributes<HTMLElement>, "children"> & {
|
|
38
|
+
size?: string | number;
|
|
39
|
+
icon: NIconSource;
|
|
40
|
+
alt?: string;
|
|
41
|
+
color?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
strokeWidth?: number;
|
|
44
|
+
stroke?: string;
|
|
45
|
+
fill?: string;
|
|
46
|
+
onClick?: React__default.MouseEventHandler<HTMLElement>;
|
|
47
|
+
style?: React__default.CSSProperties;
|
|
48
|
+
};
|
|
49
|
+
declare const NIcon: React__default.FC<NIconProps>;
|
|
50
|
+
|
|
51
|
+
declare const badgeVariants: (props?: {
|
|
52
|
+
variant?: "secondary" | "destructive" | "default" | "outline" | "success" | "warning";
|
|
53
|
+
} & class_variance_authority_types.ClassProp) => string;
|
|
54
|
+
declare const badgeColorVariants: (props?: {
|
|
55
|
+
color?: "neutral" | "primary" | "accent" | "secondary" | "destructive" | "success" | "warning" | "info";
|
|
56
|
+
look?: "solid" | "outline" | "soft" | "dash";
|
|
57
|
+
size?: "sm" | "md" | "lg";
|
|
58
|
+
shape?: "default" | "square" | "pill";
|
|
59
|
+
} & class_variance_authority_types.ClassProp) => string;
|
|
60
|
+
type BadgeVariantProps = VariantProps<typeof badgeVariants>;
|
|
61
|
+
type BadgeColorVariantProps = VariantProps<typeof badgeColorVariants>;
|
|
62
|
+
type BadgeColor = NonNullable<BadgeColorVariantProps["color"]>;
|
|
63
|
+
type BadgeLook = NonNullable<BadgeColorVariantProps["look"]>;
|
|
64
|
+
type BadgeDisplayLook = BadgeLook | "minimal" | "text";
|
|
65
|
+
type BadgeSize = NonNullable<BadgeColorVariantProps["size"]>;
|
|
66
|
+
type BadgeShape = NonNullable<BadgeColorVariantProps["shape"]>;
|
|
67
|
+
type BadgeVariant = NonNullable<BadgeVariantProps["variant"]>;
|
|
68
|
+
type BadgeIcon = NIconSource;
|
|
69
|
+
type BadgeProps = React.ComponentProps<"span"> & {
|
|
70
|
+
asChild?: boolean;
|
|
71
|
+
variant?: BadgeVariantProps["variant"];
|
|
72
|
+
status?: string;
|
|
73
|
+
statusMap?: Record<string, BadgeColor>;
|
|
74
|
+
label?: string;
|
|
75
|
+
showIcon?: boolean;
|
|
76
|
+
color?: BadgeColor;
|
|
77
|
+
look?: BadgeDisplayLook;
|
|
78
|
+
size?: BadgeSize;
|
|
79
|
+
shape?: BadgeShape;
|
|
80
|
+
icon?: BadgeIcon;
|
|
81
|
+
iconMap?: Record<string, BadgeIcon>;
|
|
82
|
+
iconPosition?: "left" | "right";
|
|
83
|
+
};
|
|
84
|
+
declare function Badge({ className, variant, status, statusMap, label, showIcon, color, look, size, shape, icon, iconMap, iconPosition, asChild, children, style, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
85
|
+
declare const NBadge: typeof Badge;
|
|
86
|
+
type NBadgeLook = BadgeDisplayLook;
|
|
87
|
+
type NBadgeProps = BadgeProps;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Application-wide presentation policy for `<NBadge status="…" />`.
|
|
91
|
+
*
|
|
92
|
+
* This is the whole reason a project ends up with a `StatusBadge` wrapper: the
|
|
93
|
+
* badge itself is already correct, but every call site has to repeat the same
|
|
94
|
+
* look, the same shape, and the same translation lookup. Declared once on the
|
|
95
|
+
* provider, none of that reaches a call site.
|
|
96
|
+
*
|
|
97
|
+
* What stays in the application: the vocabulary and the catalog. `statusMap`
|
|
98
|
+
* and `statusLabelKeys` take *its* status tokens and *its* catalog keys — this
|
|
99
|
+
* package ships neither.
|
|
100
|
+
*/
|
|
101
|
+
interface NBadgeDefaults {
|
|
102
|
+
look?: NBadgeLook;
|
|
103
|
+
shape?: BadgeShape;
|
|
104
|
+
size?: BadgeSize;
|
|
105
|
+
showIcon?: boolean;
|
|
106
|
+
/** Status token to badge color. Merged over the packaged vocabulary. */
|
|
107
|
+
statusMap?: Record<string, BadgeColor>;
|
|
108
|
+
/** Badge color to icon, used when `showIcon` is on. */
|
|
109
|
+
iconMap?: Record<string, BadgeIcon>;
|
|
110
|
+
/** Status token to finished label text. Wins over `statusLabelKeys`. */
|
|
111
|
+
statusLabels?: Record<string, string>;
|
|
112
|
+
/** Status token to catalog key, resolved through the provider's `t`. */
|
|
113
|
+
statusLabelKeys?: Record<string, string>;
|
|
114
|
+
}
|
|
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
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Theme and time zone, the two preferences that outlive a render.
|
|
181
|
+
*
|
|
182
|
+
* Both are *uncontrolled*: the `initial*` props seed state the provider owns
|
|
183
|
+
* from then on, and later changes to those props are ignored. That is the
|
|
184
|
+
* shape the server hand-off wants — the page is rendered once against a cookie,
|
|
185
|
+
* and every change after that originates here.
|
|
186
|
+
*
|
|
187
|
+
* Persistence is not this provider's business. It applies the change to the
|
|
188
|
+
* document, then hands the new value to a callback the application supplies.
|
|
189
|
+
* See `NajmNextUIProvider` in `najm-kit/next` for the cookie-endpoint wiring.
|
|
190
|
+
*/
|
|
191
|
+
interface NajmPreferencesContextValue {
|
|
192
|
+
theme: NajmMode;
|
|
193
|
+
setTheme: (theme: NajmMode) => Promise<void>;
|
|
194
|
+
timeZone: string;
|
|
195
|
+
setTimeZone: (timeZone: string) => Promise<void>;
|
|
196
|
+
}
|
|
197
|
+
declare const DEFAULT_TIME_ZONE = "UTC";
|
|
198
|
+
interface NajmPreferencesProviderProps {
|
|
199
|
+
children: React.ReactNode;
|
|
200
|
+
/** Seeds theme state; ignored after mount. Defaults to `"light"`. */
|
|
201
|
+
initialTheme?: NajmMode;
|
|
202
|
+
/** Seeds time zone state; ignored after mount. Defaults to `"UTC"`. */
|
|
203
|
+
initialTimeZone?: string;
|
|
204
|
+
/** Persist the new theme. Rejections propagate to the `setTheme` caller. */
|
|
205
|
+
onThemeChange?: (theme: NajmMode) => void | Promise<void>;
|
|
206
|
+
/** Persist the new time zone. Rejections propagate to `setTimeZone`. */
|
|
207
|
+
onTimeZoneChange?: (timeZone: string) => void | Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Sanitize a time zone before it is stored.
|
|
210
|
+
*
|
|
211
|
+
* Defaults to an IANA check that falls back to `DEFAULT_TIME_ZONE`, which is
|
|
212
|
+
* what every application wanted from the callback it used to have to supply.
|
|
213
|
+
* Pass one to narrow further — a fixed set backing a picker, say.
|
|
214
|
+
*/
|
|
215
|
+
normalizeTimeZone?: (value: string) => string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Standalone preferences, without the design and table layers.
|
|
219
|
+
*
|
|
220
|
+
* `NajmUIProvider` renders this internally, so most applications never name it.
|
|
221
|
+
* It is exported for the case where something *above* the design layer needs to
|
|
222
|
+
* read the theme — a runtime theme editor, typically, which owns the design
|
|
223
|
+
* config and therefore has to sit above the provider consuming it. Hoisting
|
|
224
|
+
* preferences out is then a reorder rather than a fork.
|
|
225
|
+
*/
|
|
226
|
+
declare function NajmPreferencesProvider({ children, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmPreferencesProviderProps): react_jsx_runtime.JSX.Element;
|
|
227
|
+
/**
|
|
228
|
+
* Returns the context when one is mounted, or `null`.
|
|
229
|
+
*
|
|
230
|
+
* `NajmUIProvider` uses this to defer to an outer `NajmPreferencesProvider`
|
|
231
|
+
* instead of shadowing it, so nesting the two is well-defined rather than
|
|
232
|
+
* quietly producing two disagreeing themes.
|
|
233
|
+
*/
|
|
234
|
+
declare function useNajmPreferencesContext(): NajmPreferencesContextValue | null;
|
|
235
|
+
/** The live theme and a setter that persists through `onThemeChange`. */
|
|
236
|
+
declare function useNajmTheme(): Pick<NajmPreferencesContextValue, "theme" | "setTheme">;
|
|
237
|
+
/** The live time zone and a setter that persists through `onTimeZoneChange`. */
|
|
238
|
+
declare function useNajmTimeZone(): Pick<NajmPreferencesContextValue, "timeZone" | "setTimeZone">;
|
|
239
|
+
|
|
240
|
+
interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "children"> {
|
|
241
|
+
children: React.ReactNode;
|
|
242
|
+
/**
|
|
243
|
+
* The design config handed to `NajmDesignProvider`, owned by the application.
|
|
244
|
+
*
|
|
245
|
+
* Optional, and deliberately so: an application with no runtime theme editor
|
|
246
|
+
* has nothing to put here, and requiring it was the only reason such an
|
|
247
|
+
* application still had to author a provider file just to hold a constant.
|
|
248
|
+
*
|
|
249
|
+
* Prefer `initialDesign` for a theme editor. Passing `design` means the
|
|
250
|
+
* application holds the draft state itself, which is the file this provider
|
|
251
|
+
* exists to delete.
|
|
252
|
+
*/
|
|
253
|
+
design?: NajmDesignConfig;
|
|
254
|
+
/**
|
|
255
|
+
* Seeds design state this provider owns from then on; ignored after mount.
|
|
256
|
+
* A theme editor drives it through `useNajmDesignEditor`.
|
|
257
|
+
*/
|
|
258
|
+
initialDesign?: NajmDesignConfig;
|
|
259
|
+
/**
|
|
260
|
+
* Forwarded to `NajmDesignProvider`, merged over a `min-h-full` default.
|
|
261
|
+
*
|
|
262
|
+
* The default is not decoration. `NajmThemeProvider` renders a real `div`
|
|
263
|
+
* between the document body and the application, and a block box of
|
|
264
|
+
* automatic height severs any `h-full` chain below it — every application
|
|
265
|
+
* mounting this at the root was passing the same class back to repair that.
|
|
266
|
+
* It is inert where it is not needed: a percentage `min-height` against an
|
|
267
|
+
* auto-height parent imposes no constraint.
|
|
268
|
+
*
|
|
269
|
+
* Merged with `cn`, so a conflicting utility here still wins.
|
|
270
|
+
*/
|
|
271
|
+
className?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Translator for the pagination labels. Omit it and the packaged English
|
|
274
|
+
* applies — the provider is still worth mounting for design and preferences.
|
|
275
|
+
*
|
|
276
|
+
* Memoize it. The labels are rebuilt whenever its identity changes, and
|
|
277
|
+
* rebuilding them re-renders every table beneath.
|
|
278
|
+
*/
|
|
279
|
+
t?: NajmTranslate;
|
|
280
|
+
/** Catalog prefix for the labels. Defaults to `"common.pagination"`. */
|
|
281
|
+
paginationKeyPrefix?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Per-key overrides layered over the translated labels. Memoize it, for the
|
|
284
|
+
* same reason as `t`.
|
|
285
|
+
*/
|
|
286
|
+
tableDefaults?: NTableDefaults;
|
|
287
|
+
/**
|
|
288
|
+
* Presentation policy for `<NBadge status="…" />`: the look, the shape, and
|
|
289
|
+
* the map from the application's status tokens to its catalog keys.
|
|
290
|
+
*
|
|
291
|
+
* This is the prop that deletes a project's `StatusBadge` wrapper. Memoize it
|
|
292
|
+
* for the same reason as `t`.
|
|
293
|
+
*/
|
|
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;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The one provider a Najm application mounts for UI concerns.
|
|
308
|
+
*
|
|
309
|
+
* Composes three things that otherwise get copied between projects: theme and
|
|
310
|
+
* time zone state with async persistence, a `NajmDesignProvider` fed the live
|
|
311
|
+
* theme, and `NTable` pagination labels derived from the application's
|
|
312
|
+
* translator.
|
|
313
|
+
*
|
|
314
|
+
* What it deliberately does not own: auth, react-query, and the translation
|
|
315
|
+
* catalog. Those stay in the application — folding them in would make a UI
|
|
316
|
+
* package depend on `najm-auth` and `@tanstack/react-query` and turn it into a
|
|
317
|
+
* framework. Persistence is injected as callbacks so this entry imports
|
|
318
|
+
* nothing from `next`; see `NajmNextUIProvider` in `najm-kit/next`.
|
|
319
|
+
*
|
|
320
|
+
* Rendering this under an existing `NajmPreferencesProvider` is supported: the
|
|
321
|
+
* outer one wins and the preference props here are ignored. That is what lets
|
|
322
|
+
* an application with a runtime theme editor hoist preferences above its
|
|
323
|
+
* design context without forking this component.
|
|
324
|
+
*/
|
|
325
|
+
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, badgeDefaults, feedbackDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
326
|
+
|
|
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,12 +1,17 @@
|
|
|
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';
|
|
7
|
-
import '
|
|
9
|
+
import 'lucide-react';
|
|
10
|
+
import 'next/image';
|
|
8
11
|
import '../design-types-Rkpt8Pg1.js';
|
|
9
12
|
import '../paginationLabels-dZLSNxfo.js';
|
|
13
|
+
import 'class-variance-authority/types';
|
|
14
|
+
import 'class-variance-authority';
|
|
10
15
|
|
|
11
16
|
/** Branding shown by the kit's chrome. Purely presentational values. */
|
|
12
17
|
interface NajmAppBranding {
|
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,8 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ImageProps } from 'next/image';
|
|
4
|
+
import { c as NajmUIProviderProps } from '../NajmUIProvider-cNCb8Tpn.js';
|
|
4
5
|
import '../design-types-Rkpt8Pg1.js';
|
|
5
6
|
import '../paginationLabels-dZLSNxfo.js';
|
|
7
|
+
import 'class-variance-authority/types';
|
|
8
|
+
import 'class-variance-authority';
|
|
6
9
|
|
|
7
10
|
interface NextLinkAdapterProps extends Record<string, any> {
|
|
8
11
|
href: string;
|
|
@@ -20,6 +23,28 @@ declare function useNextNavigationAdapter(): {
|
|
|
20
23
|
push: (path: string) => void;
|
|
21
24
|
replace: (path: string) => void;
|
|
22
25
|
};
|
|
26
|
+
interface NNextImageProps extends Omit<ImageProps, 'src' | 'onError'> {
|
|
27
|
+
src: string;
|
|
28
|
+
/** Swapped in once `src` fails to load. Tried exactly once. */
|
|
29
|
+
fallbackSrc?: string;
|
|
30
|
+
onError?: ImageProps['onError'];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `next/image` with the fallback behavior of `NImage`, for applications that
|
|
34
|
+
* want the optimizer, the layout reservation, and `fill`/`sizes`.
|
|
35
|
+
*
|
|
36
|
+
* Lives only in `najm-kit/next`. The root entry must stay installable without
|
|
37
|
+
* Next, which is why this cannot be a prop on `NImage`.
|
|
38
|
+
*
|
|
39
|
+
* It classifies nothing. An application that serves an asset from a route the
|
|
40
|
+
* browser must reach directly — an authenticated one, say — passes
|
|
41
|
+
* `unoptimized` at the call site, because whether a route is protected is the
|
|
42
|
+
* application's fact and not something a URL shape can be read for. Note also
|
|
43
|
+
* what `unoptimized` is not: it changes delivery mechanics only. Session
|
|
44
|
+
* validation, permissions, and what bytes come back remain entirely the
|
|
45
|
+
* backend's.
|
|
46
|
+
*/
|
|
47
|
+
declare function NNextImage({ src, fallbackSrc, loading, priority, onError, ...props }: NNextImageProps): react_jsx_runtime.JSX.Element;
|
|
23
48
|
/** Where `NajmNextUIProvider` POSTs each preference. */
|
|
24
49
|
interface NajmNextUIEndpoints {
|
|
25
50
|
/** Defaults to `/api/ui-theme`. Receives `{ theme }`. */
|
|
@@ -50,4 +75,4 @@ interface NajmNextUIProviderProps extends Omit<NajmUIProviderProps, 'onThemeChan
|
|
|
50
75
|
*/
|
|
51
76
|
declare function NajmNextUIProvider({ endpoints, refreshOnChange, ...props }: NajmNextUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
52
77
|
|
|
53
|
-
export { type NajmNextUIEndpoints, NajmNextUIProvider, type NajmNextUIProviderProps, NextLinkAdapter, type NextLinkAdapterProps, useNextNavigationAdapter };
|
|
78
|
+
export { NNextImage, type NNextImageProps, type NajmNextUIEndpoints, NajmNextUIProvider, type NajmNextUIProviderProps, NextLinkAdapter, type NextLinkAdapterProps, useNextNavigationAdapter };
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { 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';
|