najm-kit 2.11.10 → 2.11.12
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/dist/{NNotFoundState-D1CLLLxc.d.ts → NNotFoundState-CgU76llk.d.ts} +8 -8
- package/dist/NTableJson-BHXwRVvL.d.ts +5 -0
- package/dist/{NajmUIProvider-cNCb8Tpn.d.ts → NajmUIProvider-DSjvh4x2.d.ts} +95 -6
- package/dist/adapters/app.d.ts +5 -6
- package/dist/adapters/app.mjs +4 -4
- package/dist/adapters/next.d.ts +3 -4
- package/dist/adapters/next.mjs +2 -2
- package/dist/{chunk-6UDJNTJ6.mjs → chunk-3J24TPLA.mjs} +61 -4
- package/dist/{chunk-W2HMBUZ4.mjs → chunk-56JQI3VL.mjs} +1 -1
- package/dist/{chunk-T6RL7TSQ.mjs → chunk-VSK75GSS.mjs} +1 -1
- package/dist/index.d.ts +270 -253
- package/dist/index.mjs +64 -39
- package/dist/json.d.ts +3 -4
- package/package.json +2 -1
- package/dist/NTableJson-tXqgfZI1.d.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
3
|
import { ZodTypeAny, TypeOf } from 'zod';
|
|
4
4
|
import { LucideIcon } from 'lucide-react';
|
|
@@ -49,7 +49,7 @@ declare function useNBranding(): NBrandingValue | null;
|
|
|
49
49
|
*/
|
|
50
50
|
declare function NBrandingProvider({ children, appName, logoExpanded, logoCollapsed, logoFallback, logoHref, }: Readonly<NBrandingValue & {
|
|
51
51
|
children: ReactNode;
|
|
52
|
-
}>):
|
|
52
|
+
}>): React.JSX.Element;
|
|
53
53
|
interface NBrandingEditorValue {
|
|
54
54
|
branding: NBrandingValue;
|
|
55
55
|
/**
|
|
@@ -79,7 +79,7 @@ interface NBrandingStateProviderProps {
|
|
|
79
79
|
initialBranding?: NBrandingInput;
|
|
80
80
|
}
|
|
81
81
|
/** `NBrandingProvider` with the marks held as state an editor can write. */
|
|
82
|
-
declare function NBrandingStateProvider({ children, branding, initialBranding, }: Readonly<NBrandingStateProviderProps>):
|
|
82
|
+
declare function NBrandingStateProvider({ children, branding, initialBranding, }: Readonly<NBrandingStateProviderProps>): React.JSX.Element;
|
|
83
83
|
|
|
84
84
|
type FormFillOverride = unknown | readonly unknown[] | ((fieldName: string) => unknown);
|
|
85
85
|
type FormFillOverrides = Record<string, FormFillOverride>;
|
|
@@ -122,7 +122,7 @@ interface NLoadingStateProps {
|
|
|
122
122
|
*/
|
|
123
123
|
surface?: NFeedbackSurface;
|
|
124
124
|
}
|
|
125
|
-
declare function NLoadingState({ label, className, fullScreen, spinnerVariant, spinnerSize, surface, }: NLoadingStateProps):
|
|
125
|
+
declare function NLoadingState({ label, className, fullScreen, spinnerVariant, spinnerSize, surface, }: NLoadingStateProps): React__default.JSX.Element;
|
|
126
126
|
|
|
127
127
|
interface NErrorStateProps {
|
|
128
128
|
title?: string;
|
|
@@ -134,7 +134,7 @@ interface NErrorStateProps {
|
|
|
134
134
|
/** Layout surface. See `NLoadingStateProps.surface`. */
|
|
135
135
|
surface?: NFeedbackSurface;
|
|
136
136
|
}
|
|
137
|
-
declare function NErrorState({ title, message, onRetry, retryLabel, className, icon, surface, }: NErrorStateProps):
|
|
137
|
+
declare function NErrorState({ title, message, onRetry, retryLabel, className, icon, surface, }: NErrorStateProps): React__default.JSX.Element;
|
|
138
138
|
|
|
139
139
|
interface NEmptyStateProps {
|
|
140
140
|
title?: string;
|
|
@@ -145,7 +145,7 @@ interface NEmptyStateProps {
|
|
|
145
145
|
/** Layout surface. See `NLoadingStateProps.surface`. */
|
|
146
146
|
surface?: NFeedbackSurface;
|
|
147
147
|
}
|
|
148
|
-
declare function NEmptyState({ title, description, icon, action, className, surface, }: NEmptyStateProps):
|
|
148
|
+
declare function NEmptyState({ title, description, icon, action, className, surface, }: NEmptyStateProps): React__default.JSX.Element;
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* First-class "access denied" state.
|
|
@@ -160,7 +160,7 @@ interface NForbiddenStateProps extends NEmptyStateProps {
|
|
|
160
160
|
title?: string;
|
|
161
161
|
description?: string;
|
|
162
162
|
}
|
|
163
|
-
declare function NForbiddenState(props: NForbiddenStateProps):
|
|
163
|
+
declare function NForbiddenState(props: NForbiddenStateProps): React__default.JSX.Element;
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* First-class "page not found" state.
|
|
@@ -174,6 +174,6 @@ interface NNotFoundStateProps extends NEmptyStateProps {
|
|
|
174
174
|
title?: string;
|
|
175
175
|
description?: string;
|
|
176
176
|
}
|
|
177
|
-
declare function NNotFoundState(props: NNotFoundStateProps):
|
|
177
|
+
declare function NNotFoundState(props: NNotFoundStateProps): React__default.JSX.Element;
|
|
178
178
|
|
|
179
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 };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import React__default from 'react';
|
|
4
3
|
import { e as NajmMode, a as NajmDesignConfig } from './design-types-Rkpt8Pg1.js';
|
|
@@ -6,6 +5,48 @@ import { b as NTablePaginationLabels, N as NajmTranslate } from './paginationLab
|
|
|
6
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
6
|
import { VariantProps } from 'class-variance-authority';
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Accessible names and visible copy for the toolbar above the rows.
|
|
10
|
+
*
|
|
11
|
+
* Every field is optional and falls back to English, matching
|
|
12
|
+
* `NTablePaginationLabels`. The settings menu is the motivating case: its
|
|
13
|
+
* headings and view-mode options are the only chrome in a localized table that
|
|
14
|
+
* a catalog could not previously reach, because they are built inside the kit
|
|
15
|
+
* rather than supplied per column.
|
|
16
|
+
*/
|
|
17
|
+
interface NTableToolbarLabels {
|
|
18
|
+
/** Accessible name of the settings trigger. Defaults to `"Table settings"`. */
|
|
19
|
+
settings?: string;
|
|
20
|
+
/** Heading above the view-mode group. Defaults to `"View"`. */
|
|
21
|
+
view?: string;
|
|
22
|
+
/** Heading above the column-visibility list. Defaults to `"Columns"`. */
|
|
23
|
+
columns?: string;
|
|
24
|
+
/** Visible name of the table view mode. Defaults to `"Table"`. */
|
|
25
|
+
modeTable?: string;
|
|
26
|
+
/** Visible name of the cards view mode. Defaults to `"Cards"`. */
|
|
27
|
+
modeCards?: string;
|
|
28
|
+
/** Visible name of the JSON view mode. Defaults to `"JSON"`. */
|
|
29
|
+
modeJson?: string;
|
|
30
|
+
/** Visible name of the files view mode. Defaults to `"Files"`. */
|
|
31
|
+
modeFiles?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Accessible name of one view-mode option, given its visible name. Defaults
|
|
34
|
+
* to `` `${mode} view` ``.
|
|
35
|
+
*
|
|
36
|
+
* It must contain the visible name — voice control matches on what is on
|
|
37
|
+
* screen — so a translation reorders around the mode rather than replacing it.
|
|
38
|
+
*/
|
|
39
|
+
modeOption?: (mode: string) => string;
|
|
40
|
+
/** Accessible name and tooltip of the mobile filters trigger. Defaults to `"Filters"`. */
|
|
41
|
+
filters?: string;
|
|
42
|
+
/** Accessible name of the filter row. Defaults to `"Table filters"`. */
|
|
43
|
+
filterRegion?: string;
|
|
44
|
+
/** The option that clears a select filter. Defaults to `"All"`. */
|
|
45
|
+
allOption?: string;
|
|
46
|
+
/** Accessible name of the add control when `addButtonText` is empty. Defaults to `"Create"`. */
|
|
47
|
+
create?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
9
50
|
/**
|
|
10
51
|
* Defaults every `NTable` beneath the provider inherits.
|
|
11
52
|
*
|
|
@@ -15,6 +56,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
15
56
|
*/
|
|
16
57
|
interface NTableDefaults {
|
|
17
58
|
paginationLabels?: NTablePaginationLabels;
|
|
59
|
+
toolbarLabels?: NTableToolbarLabels;
|
|
18
60
|
}
|
|
19
61
|
/**
|
|
20
62
|
* Supply table defaults to everything below.
|
|
@@ -27,8 +69,13 @@ interface NTableDefaults {
|
|
|
27
69
|
declare function NTableDefaultsProvider({ children, value, }: {
|
|
28
70
|
children: React__default.ReactNode;
|
|
29
71
|
value: NTableDefaults;
|
|
30
|
-
}):
|
|
72
|
+
}): React__default.JSX.Element;
|
|
31
73
|
declare function useNTableDefaults(): NTableDefaults;
|
|
74
|
+
/**
|
|
75
|
+
* Per-key merge for the toolbar copy, on the same terms as
|
|
76
|
+
* `useResolvedPaginationLabels`.
|
|
77
|
+
*/
|
|
78
|
+
declare function useResolvedToolbarLabels(own: NTableToolbarLabels | undefined): NTableToolbarLabels;
|
|
32
79
|
|
|
33
80
|
type NIconSource = React__default.ReactElement | React__default.ComponentType<any> | React__default.ExoticComponent<any> | string | {
|
|
34
81
|
src: string;
|
|
@@ -81,7 +128,7 @@ type BadgeProps = React.ComponentProps<"span"> & {
|
|
|
81
128
|
iconMap?: Record<string, BadgeIcon>;
|
|
82
129
|
iconPosition?: "left" | "right";
|
|
83
130
|
};
|
|
84
|
-
declare function Badge({ className, variant, status, statusMap, label, showIcon, color, look, size, shape, icon, iconMap, iconPosition, asChild, children, style, ...props }: BadgeProps):
|
|
131
|
+
declare function Badge({ className, variant, status, statusMap, label, showIcon, color, look, size, shape, icon, iconMap, iconPosition, asChild, children, style, ...props }: BadgeProps): React.JSX.Element;
|
|
85
132
|
declare const NBadge: typeof Badge;
|
|
86
133
|
type NBadgeLook = BadgeDisplayLook;
|
|
87
134
|
type NBadgeProps = BadgeProps;
|
|
@@ -223,7 +270,7 @@ interface NajmPreferencesProviderProps {
|
|
|
223
270
|
* config and therefore has to sit above the provider consuming it. Hoisting
|
|
224
271
|
* preferences out is then a reorder rather than a fork.
|
|
225
272
|
*/
|
|
226
|
-
declare function NajmPreferencesProvider({ children, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmPreferencesProviderProps):
|
|
273
|
+
declare function NajmPreferencesProvider({ children, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmPreferencesProviderProps): React.JSX.Element;
|
|
227
274
|
/**
|
|
228
275
|
* Returns the context when one is mounted, or `null`.
|
|
229
276
|
*
|
|
@@ -237,6 +284,28 @@ declare function useNajmTheme(): Pick<NajmPreferencesContextValue, "theme" | "se
|
|
|
237
284
|
/** The live time zone and a setter that persists through `onTimeZoneChange`. */
|
|
238
285
|
declare function useNajmTimeZone(): Pick<NajmPreferencesContextValue, "timeZone" | "setTimeZone">;
|
|
239
286
|
|
|
287
|
+
type NajmDirection = "ltr" | "rtl";
|
|
288
|
+
/**
|
|
289
|
+
* The document's writing direction, kept in sync with the `dir` attribute.
|
|
290
|
+
*
|
|
291
|
+
* Radix reads direction from its own `DirectionProvider` and defaults to
|
|
292
|
+
* `"ltr"`. It never consults the DOM, and it stamps that default onto every
|
|
293
|
+
* portaled `Content` element — so in an application that sets
|
|
294
|
+
* `<html dir="rtl">`, a dropdown or select popup renders LTR inside an
|
|
295
|
+
* otherwise RTL page, and the logical padding and inset utilities on its items
|
|
296
|
+
* resolve against the wrong side. Nothing bridged the two until this hook and
|
|
297
|
+
* the `DirectionProvider` above it.
|
|
298
|
+
*
|
|
299
|
+
* Reading the attribute rather than a language preference is deliberate: `dir`
|
|
300
|
+
* is what the browser itself lays out against, applications already set it, and
|
|
301
|
+
* a kit that inferred direction from a locale list would disagree with the page
|
|
302
|
+
* the moment an application supported a language the kit had not heard of.
|
|
303
|
+
*
|
|
304
|
+
* Server renders return `"ltr"` and the first client effect corrects it. That
|
|
305
|
+
* is not a hydration risk for the popups, which mount only on open.
|
|
306
|
+
*/
|
|
307
|
+
declare function useDocumentDirection(override?: NajmDirection): NajmDirection;
|
|
308
|
+
|
|
240
309
|
interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "children"> {
|
|
241
310
|
children: React.ReactNode;
|
|
242
311
|
/**
|
|
@@ -279,6 +348,26 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
|
|
|
279
348
|
t?: NajmTranslate;
|
|
280
349
|
/** Catalog prefix for the labels. Defaults to `"common.pagination"`. */
|
|
281
350
|
paginationKeyPrefix?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Catalog prefix for the table toolbar and settings menu. Defaults to
|
|
353
|
+
* `"common.table"`.
|
|
354
|
+
*
|
|
355
|
+
* These labels are built inside the kit rather than supplied per column, so
|
|
356
|
+
* this prefix is the only way a catalog reaches the view-mode options, the
|
|
357
|
+
* column-visibility heading, and the filter controls' accessible names.
|
|
358
|
+
*/
|
|
359
|
+
toolbarKeyPrefix?: string;
|
|
360
|
+
/**
|
|
361
|
+
* Writing direction for the Radix popups beneath — menus, selects, and the
|
|
362
|
+
* rest of the portaled content.
|
|
363
|
+
*
|
|
364
|
+
* Omit it and the direction follows `<html dir>`, which is what an
|
|
365
|
+
* application already sets and what the browser lays the page out against.
|
|
366
|
+
* Radix defaults its own context to `"ltr"` and stamps that on every portaled
|
|
367
|
+
* element, so without this bridge an RTL page gets LTR popups. Pass a value
|
|
368
|
+
* only to pin one region against the document.
|
|
369
|
+
*/
|
|
370
|
+
dir?: NajmDirection;
|
|
282
371
|
/**
|
|
283
372
|
* Per-key overrides layered over the translated labels. Memoize it, for the
|
|
284
373
|
* same reason as `t`.
|
|
@@ -322,6 +411,6 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
|
|
|
322
411
|
* an application with a runtime theme editor hoist preferences above its
|
|
323
412
|
* design context without forking this component.
|
|
324
413
|
*/
|
|
325
|
-
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, badgeDefaults, feedbackDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps):
|
|
414
|
+
declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, toolbarKeyPrefix, dir, tableDefaults, badgeDefaults, feedbackDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): React.JSX.Element;
|
|
326
415
|
|
|
327
|
-
export {
|
|
416
|
+
export { useDocumentDirection as A, type BadgeColor as B, useNTableDefaults as C, DEFAULT_TIME_ZONE as D, useNajmPreferencesContext as E, useNajmTheme as F, useNajmTimeZone as G, useResolvedToolbarLabels as H, type NFeedbackDefaults as N, type NFeedbackLabelKeys as a, type NFeedbackLabels as b, type NajmUIProviderProps as c, type NTableToolbarLabels as d, type NIconSource as e, type BadgeShape as f, Badge as g, type BadgeIcon as h, type BadgeLook as i, type BadgeProps as j, type BadgeSize as k, type BadgeVariant as l, NBadge as m, type NBadgeDefaults as n, type NBadgeLook as o, type NBadgeProps as p, NIcon as q, type NIconProps as r, type NTableDefaults as s, NTableDefaultsProvider as t, type NajmPreferencesContextValue as u, NajmPreferencesProvider as v, type NajmPreferencesProviderProps as w, NajmUIProvider as x, badgeColorVariants as y, badgeVariants as z };
|
package/dist/adapters/app.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Translations } from 'najm-i18n';
|
|
3
|
-
import { F as FormDevToolsOptions, N as NBrandingInput } from '../NNotFoundState-
|
|
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-
|
|
3
|
+
import { F as FormDevToolsOptions, N as NBrandingInput } from '../NNotFoundState-CgU76llk.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-CgU76llk.js';
|
|
5
5
|
import { NajmNextUIProviderProps } from './next.js';
|
|
6
|
-
export { N as NFeedbackDefaults, a as NFeedbackLabelKeys, b as NFeedbackLabels } from '../NajmUIProvider-
|
|
7
|
-
import 'react';
|
|
6
|
+
export { N as NFeedbackDefaults, a as NFeedbackLabelKeys, b as NFeedbackLabels } from '../NajmUIProvider-DSjvh4x2.js';
|
|
8
7
|
import 'zod';
|
|
9
8
|
import 'lucide-react';
|
|
10
9
|
import 'next/image';
|
|
@@ -111,6 +110,6 @@ interface NajmAppProviderProps extends Omit<NajmNextUIProviderProps, 't'> {
|
|
|
111
110
|
* state machine of its own above this provider. The controlled `design` and
|
|
112
111
|
* `branding` props still work for applications that already do.
|
|
113
112
|
*/
|
|
114
|
-
declare function NajmAppProvider({ translations, initialLanguage, defaultLanguage, languageEndpoint, appName, initialBranding, formDevTools, ...props }: NajmAppProviderProps):
|
|
113
|
+
declare function NajmAppProvider({ translations, initialLanguage, defaultLanguage, languageEndpoint, appName, initialBranding, formDevTools, ...props }: NajmAppProviderProps): React.JSX.Element;
|
|
115
114
|
|
|
116
115
|
export { type NajmAppBranding, NajmAppProvider, type NajmAppProviderProps };
|
package/dist/adapters/app.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-
|
|
3
|
-
export { NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState } from '../chunk-
|
|
4
|
-
import { NajmNextUIProvider } from '../chunk-
|
|
5
|
-
import '../chunk-
|
|
2
|
+
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-56JQI3VL.mjs';
|
|
3
|
+
export { NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState } from '../chunk-56JQI3VL.mjs';
|
|
4
|
+
import { NajmNextUIProvider } from '../chunk-VSK75GSS.mjs';
|
|
5
|
+
import '../chunk-3J24TPLA.mjs';
|
|
6
6
|
import '../chunk-M5VGBZ7R.mjs';
|
|
7
7
|
import '../chunk-LK3SMYUP.mjs';
|
|
8
8
|
import '../chunk-JABLSOQN.mjs';
|
package/dist/adapters/next.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React__default from 'react';
|
|
3
2
|
import { ImageProps } from 'next/image';
|
|
4
|
-
import { c as NajmUIProviderProps } from '../NajmUIProvider-
|
|
3
|
+
import { c as NajmUIProviderProps } from '../NajmUIProvider-DSjvh4x2.js';
|
|
5
4
|
import '../design-types-Rkpt8Pg1.js';
|
|
6
5
|
import '../paginationLabels-dZLSNxfo.js';
|
|
7
6
|
import 'class-variance-authority/types';
|
|
@@ -44,7 +43,7 @@ interface NNextImageProps extends Omit<ImageProps, 'src' | 'onError'> {
|
|
|
44
43
|
* validation, permissions, and what bytes come back remain entirely the
|
|
45
44
|
* backend's.
|
|
46
45
|
*/
|
|
47
|
-
declare function NNextImage({ src, fallbackSrc, loading, priority, onError, ...props }: NNextImageProps):
|
|
46
|
+
declare function NNextImage({ src, fallbackSrc, loading, priority, onError, ...props }: NNextImageProps): React__default.JSX.Element;
|
|
48
47
|
/** Where `NajmNextUIProvider` POSTs each preference. */
|
|
49
48
|
interface NajmNextUIEndpoints {
|
|
50
49
|
/** Defaults to `/api/ui-theme`. Receives `{ theme }`. */
|
|
@@ -73,6 +72,6 @@ interface NajmNextUIProviderProps extends Omit<NajmUIProviderProps, 'onThemeChan
|
|
|
73
72
|
* `next` is an *optional* peer dependency: consumers of the root entry never
|
|
74
73
|
* reach this file.
|
|
75
74
|
*/
|
|
76
|
-
declare function NajmNextUIProvider({ endpoints, refreshOnChange, ...props }: NajmNextUIProviderProps):
|
|
75
|
+
declare function NajmNextUIProvider({ endpoints, refreshOnChange, ...props }: NajmNextUIProviderProps): React__default.JSX.Element;
|
|
77
76
|
|
|
78
77
|
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 { NNextImage, NajmNextUIProvider, NextLinkAdapter, useNextNavigationAdapter } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { NNextImage, NajmNextUIProvider, NextLinkAdapter, useNextNavigationAdapter } from '../chunk-VSK75GSS.mjs';
|
|
2
|
+
import '../chunk-3J24TPLA.mjs';
|
|
3
3
|
import '../chunk-LK3SMYUP.mjs';
|
|
@@ -2,6 +2,7 @@ import { NajmDesignProvider, cn } from './chunk-LK3SMYUP.mjs';
|
|
|
2
2
|
import * as React2 from 'react';
|
|
3
3
|
import React2__default from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
5
6
|
|
|
6
7
|
// src/components/Badge/status.ts
|
|
7
8
|
var NAJM_STATUS_COLORS = {
|
|
@@ -91,6 +92,14 @@ function useResolvedPaginationLabels(own) {
|
|
|
91
92
|
[inherited, own]
|
|
92
93
|
);
|
|
93
94
|
}
|
|
95
|
+
function useResolvedToolbarLabels(own) {
|
|
96
|
+
const defaults = useNTableDefaults();
|
|
97
|
+
const inherited = defaults.toolbarLabels;
|
|
98
|
+
return React2__default.useMemo(
|
|
99
|
+
() => ({ ...inherited, ...own }),
|
|
100
|
+
[inherited, own]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
94
103
|
var NajmPreferencesContext = React2.createContext(null);
|
|
95
104
|
var DEFAULT_TIME_ZONE = "UTC";
|
|
96
105
|
function isValidTimeZone(value) {
|
|
@@ -195,6 +204,44 @@ function buildPaginationLabels(t, prefix = DEFAULT_PAGINATION_KEY_PREFIX) {
|
|
|
195
204
|
rowsSelected: (selected, total) => t(key("rowsSelected"), { selected, total })
|
|
196
205
|
};
|
|
197
206
|
}
|
|
207
|
+
|
|
208
|
+
// src/providers/toolbarLabels.ts
|
|
209
|
+
var DEFAULT_TOOLBAR_KEY_PREFIX = "common.table";
|
|
210
|
+
function buildToolbarLabels(t, prefix) {
|
|
211
|
+
const scope = prefix ?? DEFAULT_TOOLBAR_KEY_PREFIX;
|
|
212
|
+
return {
|
|
213
|
+
settings: t(`${scope}.settings`),
|
|
214
|
+
view: t(`${scope}.view`),
|
|
215
|
+
columns: t(`${scope}.columns`),
|
|
216
|
+
modeTable: t(`${scope}.modeTable`),
|
|
217
|
+
modeCards: t(`${scope}.modeCards`),
|
|
218
|
+
modeJson: t(`${scope}.modeJson`),
|
|
219
|
+
modeFiles: t(`${scope}.modeFiles`),
|
|
220
|
+
modeOption: (mode) => t(`${scope}.modeOption`, { mode }),
|
|
221
|
+
filters: t(`${scope}.filters`),
|
|
222
|
+
filterRegion: t(`${scope}.filterRegion`),
|
|
223
|
+
allOption: t(`${scope}.allOption`),
|
|
224
|
+
create: t(`${scope}.create`)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function useDocumentDirection(override) {
|
|
228
|
+
const [direction, setDirection] = React2.useState(
|
|
229
|
+
override ?? "ltr"
|
|
230
|
+
);
|
|
231
|
+
React2.useEffect(() => {
|
|
232
|
+
if (override) {
|
|
233
|
+
setDirection(override);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const root = document.documentElement;
|
|
237
|
+
const read = () => setDirection(root.getAttribute("dir") === "rtl" ? "rtl" : "ltr");
|
|
238
|
+
read();
|
|
239
|
+
const observer = new MutationObserver(read);
|
|
240
|
+
observer.observe(root, { attributes: true, attributeFilter: ["dir"] });
|
|
241
|
+
return () => observer.disconnect();
|
|
242
|
+
}, [override]);
|
|
243
|
+
return direction;
|
|
244
|
+
}
|
|
198
245
|
var EMPTY_DESIGN = Object.freeze({
|
|
199
246
|
version: 1,
|
|
200
247
|
theme: {},
|
|
@@ -349,18 +396,24 @@ function NajmUICore({
|
|
|
349
396
|
className,
|
|
350
397
|
t,
|
|
351
398
|
paginationKeyPrefix = DEFAULT_PAGINATION_KEY_PREFIX,
|
|
399
|
+
toolbarKeyPrefix = DEFAULT_TOOLBAR_KEY_PREFIX,
|
|
400
|
+
dir,
|
|
352
401
|
tableDefaults,
|
|
353
402
|
badgeDefaults,
|
|
354
403
|
feedbackDefaults
|
|
355
404
|
}) {
|
|
356
405
|
const { theme } = useNajmTheme();
|
|
406
|
+
const direction = useDocumentDirection(dir);
|
|
357
407
|
const design = useNajmDesignEditor()?.design ?? EMPTY_DESIGN;
|
|
358
408
|
const defaults = React2.useMemo(() => {
|
|
359
409
|
const translated = t ? buildPaginationLabels(t, paginationKeyPrefix) : void 0;
|
|
360
410
|
const overrides = tableDefaults?.paginationLabels;
|
|
361
411
|
const paginationLabels = translated || overrides ? { ...translated, ...overrides } : void 0;
|
|
362
|
-
|
|
363
|
-
|
|
412
|
+
const translatedToolbar = t ? buildToolbarLabels(t, toolbarKeyPrefix) : void 0;
|
|
413
|
+
const toolbarOverrides = tableDefaults?.toolbarLabels;
|
|
414
|
+
const toolbarLabels = translatedToolbar || toolbarOverrides ? { ...translatedToolbar, ...toolbarOverrides } : void 0;
|
|
415
|
+
return { ...tableDefaults, paginationLabels, toolbarLabels };
|
|
416
|
+
}, [t, paginationKeyPrefix, toolbarKeyPrefix, tableDefaults]);
|
|
364
417
|
const feedbackValue = React2.useMemo(
|
|
365
418
|
() => resolveFeedbackDefaultsValue(feedbackDefaults, t),
|
|
366
419
|
[feedbackDefaults, t]
|
|
@@ -371,7 +424,7 @@ function NajmUICore({
|
|
|
371
424
|
config: design,
|
|
372
425
|
mode: theme,
|
|
373
426
|
className: cn("min-h-full", className),
|
|
374
|
-
children: /* @__PURE__ */ jsx(NTableDefaultsProvider, { value: defaults, children: /* @__PURE__ */ jsx(NBadgeDefaultsProvider, { defaults: badgeDefaults, t, children: /* @__PURE__ */ jsx(NFeedbackDefaultsProvider, { value: feedbackValue, children }) }) })
|
|
427
|
+
children: /* @__PURE__ */ jsx(DirectionProvider, { dir: direction, children: /* @__PURE__ */ jsx(NTableDefaultsProvider, { value: defaults, children: /* @__PURE__ */ jsx(NBadgeDefaultsProvider, { defaults: badgeDefaults, t, children: /* @__PURE__ */ jsx(NFeedbackDefaultsProvider, { value: feedbackValue, children }) }) }) })
|
|
375
428
|
}
|
|
376
429
|
);
|
|
377
430
|
}
|
|
@@ -382,6 +435,8 @@ function NajmUIProvider({
|
|
|
382
435
|
className,
|
|
383
436
|
t,
|
|
384
437
|
paginationKeyPrefix,
|
|
438
|
+
toolbarKeyPrefix,
|
|
439
|
+
dir,
|
|
385
440
|
tableDefaults,
|
|
386
441
|
badgeDefaults,
|
|
387
442
|
feedbackDefaults,
|
|
@@ -398,6 +453,8 @@ function NajmUIProvider({
|
|
|
398
453
|
className,
|
|
399
454
|
t,
|
|
400
455
|
paginationKeyPrefix,
|
|
456
|
+
toolbarKeyPrefix,
|
|
457
|
+
dir,
|
|
401
458
|
tableDefaults,
|
|
402
459
|
badgeDefaults,
|
|
403
460
|
feedbackDefaults,
|
|
@@ -477,4 +534,4 @@ function useImageChain(sources) {
|
|
|
477
534
|
};
|
|
478
535
|
}
|
|
479
536
|
|
|
480
|
-
export { DEFAULT_PAGINATION_KEY_PREFIX, DEFAULT_TIME_ZONE, EMPTY_DESIGN, NAJM_COLOR_TEXT_CLASSES, NAJM_STATUS_COLORS, NTableDefaultsProvider, NajmDesignEditorProvider, NajmPreferencesProvider, NajmUIProvider, buildPaginationLabels, colorTextClass, findStatusColor, mergeBadgeMaps, normalizeImageSources, normalizeStatusToken, resolveBadgeStatusLabel, resolveStatusColor, statusTextClass, useImageChain, useNBadgeDefaults, useNTableDefaults, useNajmDesignEditor, useNajmPreferencesContext, useNajmTheme, useNajmTimeZone, useResolvedFeedbackLabels, useResolvedPaginationLabels };
|
|
537
|
+
export { DEFAULT_PAGINATION_KEY_PREFIX, DEFAULT_TIME_ZONE, DEFAULT_TOOLBAR_KEY_PREFIX, EMPTY_DESIGN, NAJM_COLOR_TEXT_CLASSES, NAJM_STATUS_COLORS, NTableDefaultsProvider, NajmDesignEditorProvider, NajmPreferencesProvider, NajmUIProvider, buildPaginationLabels, buildToolbarLabels, colorTextClass, findStatusColor, mergeBadgeMaps, normalizeImageSources, normalizeStatusToken, resolveBadgeStatusLabel, resolveStatusColor, statusTextClass, useDocumentDirection, useImageChain, useNBadgeDefaults, useNTableDefaults, useNajmDesignEditor, useNajmPreferencesContext, useNajmTheme, useNajmTimeZone, useResolvedFeedbackLabels, useResolvedPaginationLabels, useResolvedToolbarLabels };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useResolvedFeedbackLabels, useNajmPreferencesContext } from './chunk-
|
|
1
|
+
import { useResolvedFeedbackLabels, useNajmPreferencesContext } from './chunk-3J24TPLA.mjs';
|
|
2
2
|
import { Button } from './chunk-M5VGBZ7R.mjs';
|
|
3
3
|
import { useNajmDesign, cn } from './chunk-LK3SMYUP.mjs';
|
|
4
4
|
import { humanizeToken, DEFAULT_PLACEHOLDER, formatRelativeTime, formatTime, formatDateTime, formatDate, formatPercent, formatNumber, formatCurrency } from './chunk-JABLSOQN.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useImageChain, normalizeImageSources, NajmUIProvider } from './chunk-
|
|
1
|
+
import { useImageChain, normalizeImageSources, NajmUIProvider } from './chunk-3J24TPLA.mjs';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useRouter } from 'next/navigation';
|
|
4
4
|
import NextImage from 'next/image';
|