najm-kit 2.7.3 → 2.8.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 +20 -3
- package/README.md +87 -4
- package/dist/{NajmUIProvider-IFU3dFkn.d.ts → NajmUIProvider-BSbXaqak.d.ts} +1 -1
- package/dist/adapters/app.d.ts +2 -2
- package/dist/adapters/app.mjs +2 -2
- package/dist/adapters/next.d.ts +2 -2
- package/dist/{cardPagination-A6h8vXuk.d.ts → cardPagination-Bwf3tEeN.d.ts} +16 -4
- package/dist/{chunk-GPHWBOSP.mjs → chunk-JABLSOQN.mjs} +11 -1
- package/dist/{chunk-XGDMPI5U.mjs → chunk-OUS7OYVA.mjs} +11 -9
- package/dist/{chunk-VKQIRB7F.mjs → chunk-PCPMAEKP.mjs} +1 -1
- package/dist/format.d.ts +34 -1
- package/dist/format.mjs +1 -1
- package/dist/index.d.ts +64 -7
- package/dist/index.mjs +98 -22
- package/dist/{paginationLabels-DgHutNWz.d.ts → paginationLabels-dZLSNxfo.d.ts} +8 -1
- package/dist/query.d.ts +3 -3
- package/dist/query.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.8.0 - 2026-08-08
|
|
4
|
+
|
|
5
|
+
- Added server-safe `najm-kit/format` helpers for currency minor units,
|
|
6
|
+
numbers, percentages, dates, times, relative time, tokens, local date inputs,
|
|
7
|
+
and slugs. Client applications can use the same contract reactively through
|
|
8
|
+
`NajmFormatProvider` and `useNajmFormat`.
|
|
9
|
+
- Added the server-safe `najm-kit/pagination` offset protocol, including bounded
|
|
10
|
+
page creation, total-aware continuation, probe-row continuation for APIs
|
|
11
|
+
without totals, and query cleanup that preserves meaningful `false` and `0`.
|
|
12
|
+
- Added the optional-peer `najm-kit/query` entry with offset infinite-query and
|
|
13
|
+
responsive paged/card-list hooks, plus shared card-pagination adapters and
|
|
14
|
+
localized continuation labels.
|
|
15
|
+
- Extended `NajmAppProvider` with formatting locale, currency, and placeholder
|
|
16
|
+
configuration so applications can bind language, time zone, and formatting
|
|
17
|
+
without another host bridge provider.
|
|
18
|
+
- Added shared media-query/card-viewport helpers and avatar-source utilities.
|
|
19
|
+
|
|
20
|
+
## 2.6.2
|
|
4
21
|
|
|
5
22
|
- Added `NSidebarProvider` and `useNSidebar`, so sidebar state can be read from a distance. `NSidebar` renders beside the page content rather than around it, which left applications hand-rolling a context to hand `setMobileOpen` down to a page header — a wrapper component plus an aliased import at every call site. Wrap the shell in `NSidebarProvider` and `NPageHeader` now resolves both `onSidebarOpen` and `mobileBreakpoint` from it, so a header nested anywhere below renders a working mobile trigger with no props threaded to it. Also exports the `NSidebarContextValue` type.
|
|
6
23
|
- `NSidebar` resolves its open and collapsed state as explicit prop → surrounding provider → internal state. Passing `collapsed`, `mobileOpen`, `onCollapsedChange`, or `onMobileOpenChange` keeps behaving exactly as before, and a sidebar with no provider around it still owns its own state, so this is additive for every existing consumer.
|
package/README.md
CHANGED
|
@@ -212,10 +212,93 @@ Key behaviors:
|
|
|
212
212
|
a newer value, and object URLs created by the component are tracked so
|
|
213
213
|
consumer-owned blob URLs are never revoked.
|
|
214
214
|
|
|
215
|
-
`AvatarInput` forwards every preview and accessibility prop unchanged while
|
|
216
|
-
preserving its circular, size, fill, and camera-icon defaults.
|
|
217
|
-
|
|
218
|
-
##
|
|
215
|
+
`AvatarInput` forwards every preview and accessibility prop unchanged while
|
|
216
|
+
preserving its circular, size, fill, and camera-icon defaults.
|
|
217
|
+
|
|
218
|
+
## Formatting
|
|
219
|
+
|
|
220
|
+
Pure formatters are available from the server-safe `najm-kit/format` entry.
|
|
221
|
+
Money values are integer minor units and use the currency's own exponent (for
|
|
222
|
+
example MAD has two decimals, JPY zero, and KWD three).
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
import { formatCurrency, formatDate, slugify } from 'najm-kit/format';
|
|
226
|
+
|
|
227
|
+
formatCurrency(12_500, { locale: 'fr-MA', currency: 'MAD' });
|
|
228
|
+
formatDate('2026-08-08T20:00:00Z', {
|
|
229
|
+
locale: 'fr-MA',
|
|
230
|
+
timeZone: 'Africa/Casablanca',
|
|
231
|
+
});
|
|
232
|
+
slugify('Najm Format & Pagination');
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Client code can use the active locale, time zone, currency, and placeholder
|
|
236
|
+
through `useNajmFormat`. `NajmAppProvider` mounts the format provider for you:
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import { NajmAppProvider } from 'najm-kit/app';
|
|
240
|
+
import { useNajmFormat } from 'najm-kit';
|
|
241
|
+
|
|
242
|
+
<NajmAppProvider
|
|
243
|
+
translations={translations}
|
|
244
|
+
currency="MAD"
|
|
245
|
+
locales={{ en: 'en-MA', fr: 'fr-MA' }}
|
|
246
|
+
>
|
|
247
|
+
<App />
|
|
248
|
+
</NajmAppProvider>
|
|
249
|
+
|
|
250
|
+
function Total({ value }: { value: number }) {
|
|
251
|
+
return <span>{useNajmFormat().money(value)}</span>;
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Offset pagination and queries
|
|
256
|
+
|
|
257
|
+
`najm-kit/pagination` is server-safe and framework-independent. It accepts
|
|
258
|
+
endpoints that return either `{ rows, total }` or a bare row array. When no
|
|
259
|
+
total exists it probes for one extra row; when a total exists continuation is
|
|
260
|
+
calculated without another request.
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
import {
|
|
264
|
+
createOffsetPagination,
|
|
265
|
+
fetchOffsetPage,
|
|
266
|
+
} from 'najm-kit/pagination';
|
|
267
|
+
|
|
268
|
+
const pagination = createOffsetPagination(pageIndex, pageSize);
|
|
269
|
+
const page = await fetchOffsetPage(
|
|
270
|
+
({ limit, offset }) => api.orders.list({ limit, offset }),
|
|
271
|
+
pagination,
|
|
272
|
+
);
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
React Query consumers install the optional `@tanstack/react-query` peer and use
|
|
276
|
+
the isolated `najm-kit/query` entry. `useResponsiveOffsetList` resolves numbered
|
|
277
|
+
desktop paging versus card continuation and exposes props that plug directly
|
|
278
|
+
into `NTable` and `createCardPagination`.
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
import { NTable, createCardPagination } from 'najm-kit';
|
|
282
|
+
import { useResponsiveOffsetList } from 'najm-kit/query';
|
|
283
|
+
|
|
284
|
+
const list = useResponsiveOffsetList({
|
|
285
|
+
queryKey: ['orders'],
|
|
286
|
+
fetchPage: ({ limit, offset }) => api.orders.list({ limit, offset }),
|
|
287
|
+
strategy: 'paged',
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
<NTable
|
|
291
|
+
data={list.data}
|
|
292
|
+
columns={columns}
|
|
293
|
+
manualPagination
|
|
294
|
+
pageCount={list.pageCount}
|
|
295
|
+
pagination={list.pagination}
|
|
296
|
+
onPaginationChange={list.onPaginationChange}
|
|
297
|
+
cardPagination={createCardPagination(list, labels)}
|
|
298
|
+
/>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Hooks
|
|
219
302
|
|
|
220
303
|
```tsx
|
|
221
304
|
import { useKeyboard } from 'najm-kit';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { b as NTablePaginationLabels, N as NajmTranslate } from './paginationLabels-
|
|
4
|
+
import { b as NTablePaginationLabels, N as NajmTranslate } from './paginationLabels-dZLSNxfo.js';
|
|
5
5
|
|
|
6
6
|
type NajmMode = 'light' | 'dark';
|
|
7
7
|
type NajmAccent = 'neutral' | 'emerald' | 'green' | 'slate' | 'blue' | 'violet';
|
package/dist/adapters/app.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Translations } from 'najm-i18n';
|
|
|
3
3
|
import { N as NBrandingInput } from '../NBrandingContext-dkADu8JS.js';
|
|
4
4
|
import { NajmNextUIProviderProps } from './next.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '../NajmUIProvider-
|
|
7
|
-
import '../paginationLabels-
|
|
6
|
+
import '../NajmUIProvider-BSbXaqak.js';
|
|
7
|
+
import '../paginationLabels-dZLSNxfo.js';
|
|
8
8
|
|
|
9
9
|
/** Branding shown by the kit's chrome. Purely presentational values. */
|
|
10
10
|
interface NajmAppBranding {
|
package/dist/adapters/app.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { NBrandingStateProvider, NajmFormatProvider } from '../chunk-
|
|
2
|
+
import { NBrandingStateProvider, NajmFormatProvider } from '../chunk-PCPMAEKP.mjs';
|
|
3
3
|
import { NajmNextUIProvider } from '../chunk-IRFFSAO2.mjs';
|
|
4
4
|
import '../chunk-USZUOJMK.mjs';
|
|
5
5
|
import '../chunk-KVZACF4G.mjs';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-JABLSOQN.mjs';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { I18nProvider, useTranslation } from 'najm-i18n/react';
|
|
9
9
|
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
|
-
import { N as NajmUIProviderProps } from '../NajmUIProvider-
|
|
4
|
-
import '../paginationLabels-
|
|
3
|
+
import { N as NajmUIProviderProps } from '../NajmUIProvider-BSbXaqak.js';
|
|
4
|
+
import '../paginationLabels-dZLSNxfo.js';
|
|
5
5
|
|
|
6
6
|
interface NextLinkAdapterProps extends Record<string, any> {
|
|
7
7
|
href: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NajmTranslate, a as NTableCardPagination } from './paginationLabels-
|
|
1
|
+
import { N as NajmTranslate, a as NTableCardPagination } from './paginationLabels-dZLSNxfo.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* How a list continues.
|
|
@@ -34,11 +34,18 @@ interface CardPaginationLabels {
|
|
|
34
34
|
itemsLoaded?: (count: number) => string;
|
|
35
35
|
}
|
|
36
36
|
declare const DEFAULT_CARD_PAGINATION_KEY_PREFIX = "common.pagination";
|
|
37
|
+
type DefaultCardPaginationPrefix = typeof DEFAULT_CARD_PAGINATION_KEY_PREFIX;
|
|
38
|
+
/** The three catalog keys `buildCardPaginationLabels` reads under `Prefix`. */
|
|
39
|
+
type CardPaginationKey<Prefix extends string = DefaultCardPaginationPrefix> = `${Prefix}.itemsLoaded` | `${Prefix}.loadMoreError` | `${Prefix}.retryLoadMore`;
|
|
37
40
|
/**
|
|
38
41
|
* Projects a translator onto the three card-continuation labels, matching
|
|
39
42
|
* `buildPaginationLabels` — same prefix convention, same key-per-field naming.
|
|
43
|
+
*
|
|
44
|
+
* The keys are named in the type, not just built at runtime, so an application
|
|
45
|
+
* whose `t` is typed to a generated union of its catalog can pass it directly
|
|
46
|
+
* and have the three keys verified against that union.
|
|
40
47
|
*/
|
|
41
|
-
declare function buildCardPaginationLabels(t: NajmTranslate
|
|
48
|
+
declare function buildCardPaginationLabels<Prefix extends string = DefaultCardPaginationPrefix>(t: NajmTranslate<CardPaginationKey<Prefix>>, prefix?: Prefix): CardPaginationLabels;
|
|
42
49
|
/**
|
|
43
50
|
* Builds the `cardPagination` prop from the state a paged list already holds.
|
|
44
51
|
*
|
|
@@ -47,7 +54,12 @@ declare function buildCardPaginationLabels(t: NajmTranslate, prefix?: string): C
|
|
|
47
54
|
* reports the size it wants through `onPaginationChange`; `all` renders exactly
|
|
48
55
|
* what it is given and shows no controls; `infinite` is the only one that needs
|
|
49
56
|
* continuation wiring, which is why the other two ignore the labels entirely.
|
|
57
|
+
*
|
|
58
|
+
* The second argument takes a translator as well as a label bundle. That is the
|
|
59
|
+
* common case — a list page has `t` in hand and nothing else to say about these
|
|
60
|
+
* three strings — and passing it here rather than pre-building labels also means
|
|
61
|
+
* the lookups only happen in `infinite` mode, where they are rendered.
|
|
50
62
|
*/
|
|
51
|
-
declare function createCardPagination(state: CardPaginationState, labels?: CardPaginationLabels): NTableCardPagination;
|
|
63
|
+
declare function createCardPagination<Prefix extends string = DefaultCardPaginationPrefix>(state: CardPaginationState, labels?: CardPaginationLabels | NajmTranslate<CardPaginationKey<Prefix>>, prefix?: Prefix): NTableCardPagination;
|
|
52
64
|
|
|
53
|
-
export { type
|
|
65
|
+
export { type CardPaginationKey as C, DEFAULT_CARD_PAGINATION_KEY_PREFIX as D, type ListStrategy as L, type ResolvedListMode as R, type CardPaginationLabels as a, type CardPaginationState as b, buildCardPaginationLabels as c, createCardPagination as d };
|
|
@@ -100,5 +100,15 @@ function formatRelativeTime(value, { locale, placeholder = DEFAULT_PLACEHOLDER }
|
|
|
100
100
|
function humanizeToken(value) {
|
|
101
101
|
return value.trim().replace(/[_-]+/g, " ").replace(/\s+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
102
102
|
}
|
|
103
|
+
function localDateInput(date = /* @__PURE__ */ new Date()) {
|
|
104
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
105
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
106
|
+
return `${date.getFullYear()}-${month}-${day}`;
|
|
107
|
+
}
|
|
108
|
+
function slugify(value, { upperCase = false, maxLength = 160 } = {}) {
|
|
109
|
+
const normalized = value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxLength);
|
|
110
|
+
const slug = normalized || crypto.randomUUID().slice(0, 8);
|
|
111
|
+
return upperCase ? slug.toUpperCase() : slug;
|
|
112
|
+
}
|
|
103
113
|
|
|
104
|
-
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken };
|
|
114
|
+
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken, localDateInput, slugify };
|
|
@@ -26,26 +26,28 @@ function useDesktopTableMode(breakpoint = DEFAULT_CARD_BREAKPOINT) {
|
|
|
26
26
|
|
|
27
27
|
// src/components/table/cardPagination.ts
|
|
28
28
|
var DEFAULT_CARD_PAGINATION_KEY_PREFIX = "common.pagination";
|
|
29
|
-
function buildCardPaginationLabels(t, prefix
|
|
29
|
+
function buildCardPaginationLabels(t, prefix) {
|
|
30
|
+
const scope = prefix ?? DEFAULT_CARD_PAGINATION_KEY_PREFIX;
|
|
30
31
|
return {
|
|
31
|
-
loadMoreError: t(`${
|
|
32
|
-
retryLabel: t(`${
|
|
33
|
-
itemsLoaded: (count) => t(`${
|
|
32
|
+
loadMoreError: t(`${scope}.loadMoreError`),
|
|
33
|
+
retryLabel: t(`${scope}.retryLoadMore`),
|
|
34
|
+
itemsLoaded: (count) => t(`${scope}.itemsLoaded`, { count })
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function createCardPagination(state, labels = {}) {
|
|
37
|
+
function createCardPagination(state, labels = {}, prefix) {
|
|
37
38
|
const mode = state.mode ?? (state.cardViewport ? "infinite" : "paged");
|
|
38
39
|
if (mode === "paged") return { mode: "paged" };
|
|
39
40
|
if (mode === "all") return { mode: "all" };
|
|
41
|
+
const resolved = typeof labels === "function" ? buildCardPaginationLabels(labels, prefix) : labels;
|
|
40
42
|
return {
|
|
41
43
|
mode: "infinite",
|
|
42
44
|
hasNextPage: state.hasNextPage,
|
|
43
45
|
loadingMore: state.loadingMore,
|
|
44
|
-
loadMoreError: state.loadMoreError ?
|
|
46
|
+
loadMoreError: state.loadMoreError ? resolved.loadMoreError : void 0,
|
|
45
47
|
onLoadMore: state.onLoadMore,
|
|
46
|
-
retryLabel:
|
|
47
|
-
loadMoreErrorLabel:
|
|
48
|
-
itemsLoadedLabel:
|
|
48
|
+
retryLabel: resolved.retryLabel,
|
|
49
|
+
loadMoreErrorLabel: resolved.loadMoreError,
|
|
50
|
+
itemsLoadedLabel: resolved.itemsLoaded
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useNajmPreferencesContext } from './chunk-USZUOJMK.mjs';
|
|
2
|
-
import { humanizeToken, DEFAULT_PLACEHOLDER, formatRelativeTime, formatTime, formatDateTime, formatDate, formatPercent, formatNumber, formatCurrency } from './chunk-
|
|
2
|
+
import { humanizeToken, DEFAULT_PLACEHOLDER, formatRelativeTime, formatTime, formatDateTime, formatDate, formatPercent, formatNumber, formatCurrency } from './chunk-JABLSOQN.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createContext, useContext, useMemo, useState, useCallback } from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
package/dist/format.d.ts
CHANGED
|
@@ -49,5 +49,38 @@ declare function formatRelativeTime(value: Date | number | string | null | undef
|
|
|
49
49
|
* Anything user-visible and known in advance belongs in the translations.
|
|
50
50
|
*/
|
|
51
51
|
declare function humanizeToken(value: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Today as `YYYY-MM-DD` in the host's zone, for `<input type="date">`.
|
|
54
|
+
*
|
|
55
|
+
* Not `toISOString().slice(0, 10)`, which is the same line everyone writes and
|
|
56
|
+
* is wrong west of UTC for the first hours of the day: it converts to UTC
|
|
57
|
+
* first, so a date picker in Casablanca opens on tomorrow. The parts are read
|
|
58
|
+
* off the local calendar instead.
|
|
59
|
+
*
|
|
60
|
+
* Deliberately host-zone rather than preference-zone. This produces the value a
|
|
61
|
+
* date *input* round-trips, and that control is bound to the machine the user
|
|
62
|
+
* is typing on; `formatDate` is what renders a date for reading.
|
|
63
|
+
*/
|
|
64
|
+
declare function localDateInput(date?: Date): string;
|
|
65
|
+
interface SlugifyOptions {
|
|
66
|
+
/** Uppercases the result, for an identifier conventionally read in caps. */
|
|
67
|
+
upperCase?: boolean;
|
|
68
|
+
/** Longest slug produced, before the case change. Defaults to 160. */
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Turns a label into a URL- and identifier-safe token: `Épicerie Fine` →
|
|
73
|
+
* `epicerie-fine`.
|
|
74
|
+
*
|
|
75
|
+
* Accents are folded rather than dropped. Stripping them outright is the usual
|
|
76
|
+
* one-liner and it silently eats letters — `Épicerie` becomes `picerie` — which
|
|
77
|
+
* is a poor slug in exactly the languages most likely to need one.
|
|
78
|
+
*
|
|
79
|
+
* A value with nothing to transliterate — Arabic or CJK, where folding has no
|
|
80
|
+
* ASCII to fall back to — yields a random token rather than an empty string.
|
|
81
|
+
* Empty is never a usable slug, and returning one pushes the failure to a
|
|
82
|
+
* uniqueness constraint far from the cause.
|
|
83
|
+
*/
|
|
84
|
+
declare function slugify(value: string, { upperCase, maxLength }?: SlugifyOptions): string;
|
|
52
85
|
|
|
53
|
-
export { DEFAULT_PLACEHOLDER, type NajmFormatConfig, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken };
|
|
86
|
+
export { DEFAULT_PLACEHOLDER, type NajmFormatConfig, type SlugifyOptions, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken, localDateInput, slugify };
|
package/dist/format.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './chunk-F5KXJCCJ.mjs';
|
|
2
|
-
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken } from './chunk-
|
|
2
|
+
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken, localDateInput, slugify } from './chunk-JABLSOQN.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as NajmDesignConfig, b as NajmThemeProviderProps, c as NajmAppearance, d as NajmMode, e as NajmThemeConfig, f as NajmAccent, g as NajmThemeTokens, h as NajmPreset, i as NajmComponentName, j as NajmComponentStyleConfig, k as NajmComponentThemeConfig, l as NajmTypographyConfig, m as NajmLayoutConfig, n as NajmVariantStyle, o as NajmResponsiveBreakpoint, p as NajmResponsiveValue } from './NajmUIProvider-
|
|
3
|
-
export { D as DEFAULT_TIME_ZONE, q as NAJM_COMPONENT_NAMES, r as NTableDefaults, s as NTableDefaultsProvider, t as NajmComponentRadius, u as NajmDensity, v as NajmPreferencesContextValue, w as NajmPreferencesProvider, x as NajmPreferencesProviderProps, y as NajmSlotStyle, z as NajmUIProvider, N as NajmUIProviderProps, R as RADIUS_VALUE_MAP, A as resolveRadiusValue, B as useNTableDefaults, C as useNajmPreferencesContext, E as useNajmTheme, F as useNajmTimeZone } from './NajmUIProvider-
|
|
2
|
+
import { a as NajmDesignConfig, b as NajmThemeProviderProps, c as NajmAppearance, d as NajmMode, e as NajmThemeConfig, f as NajmAccent, g as NajmThemeTokens, h as NajmPreset, i as NajmComponentName, j as NajmComponentStyleConfig, k as NajmComponentThemeConfig, l as NajmTypographyConfig, m as NajmLayoutConfig, n as NajmVariantStyle, o as NajmResponsiveBreakpoint, p as NajmResponsiveValue } from './NajmUIProvider-BSbXaqak.js';
|
|
3
|
+
export { D as DEFAULT_TIME_ZONE, q as NAJM_COMPONENT_NAMES, r as NTableDefaults, s as NTableDefaultsProvider, t as NajmComponentRadius, u as NajmDensity, v as NajmPreferencesContextValue, w as NajmPreferencesProvider, x as NajmPreferencesProviderProps, y as NajmSlotStyle, z as NajmUIProvider, N as NajmUIProviderProps, R as RADIUS_VALUE_MAP, A as resolveRadiusValue, B as useNTableDefaults, C as useNajmPreferencesContext, E as useNajmTheme, F as useNajmTimeZone } from './NajmUIProvider-BSbXaqak.js';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { RefObject, ReactNode, ComponentType, InputHTMLAttributes, Ref, ImgHTMLAttributes, CSSProperties, MouseEvent, MouseEventHandler } from 'react';
|
|
6
|
-
import { c as NTablePaginationVariant, b as NTablePaginationLabels, a as NTableCardPagination } from './paginationLabels-
|
|
7
|
-
export { D as DEFAULT_PAGINATION_KEY_PREFIX, d as NTableInfinitePagination, e as NTableLoadMorePagination, N as NajmTranslate, f as buildPaginationLabels } from './paginationLabels-
|
|
6
|
+
import { c as NTablePaginationVariant, b as NTablePaginationLabels, a as NTableCardPagination } from './paginationLabels-dZLSNxfo.js';
|
|
7
|
+
export { D as DEFAULT_PAGINATION_KEY_PREFIX, d as NTableInfinitePagination, e as NTableLoadMorePagination, N as NajmTranslate, f as buildPaginationLabels } from './paginationLabels-dZLSNxfo.js';
|
|
8
8
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
9
9
|
import { VariantProps } from 'class-variance-authority';
|
|
10
10
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
@@ -39,11 +39,11 @@ import { ZodTypeAny, TypeOf } from 'zod';
|
|
|
39
39
|
import { SortingState, ExpandedState, ColumnDef, Row, ColumnFiltersState, VisibilityState, RowSelectionState } from '@tanstack/react-table';
|
|
40
40
|
export { N as NTableJson } from './NTableJson-tXqgfZI1.js';
|
|
41
41
|
import * as _tanstack_table_core from '@tanstack/table-core';
|
|
42
|
-
export { C as
|
|
42
|
+
export { C as CardPaginationKey, a as CardPaginationLabels, b as CardPaginationState, D as DEFAULT_CARD_PAGINATION_KEY_PREFIX, L as ListStrategy, R as ResolvedListMode, c as buildCardPaginationLabels, d as createCardPagination } from './cardPagination-Bwf3tEeN.js';
|
|
43
43
|
import { ClassValue } from 'clsx';
|
|
44
44
|
export { ApiPage, DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, OffsetPage, OffsetPageFetcher, OffsetPageOptions, OffsetPagination, QueryValue, cleanQuery, createOffsetPagination, fetchOffsetPage, getPageIndex } from './pagination.js';
|
|
45
45
|
import { NajmFormatConfig } from './format.js';
|
|
46
|
-
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken } from './format.js';
|
|
46
|
+
export { DEFAULT_PLACEHOLDER, SlugifyOptions, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken, localDateInput, slugify } from './format.js';
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Shared so the identity is stable across renders — `NajmDesignProvider`
|
|
@@ -503,6 +503,47 @@ declare const NBadge: typeof Badge;
|
|
|
503
503
|
type NBadgeLook = BadgeDisplayLook;
|
|
504
504
|
type NBadgeProps = BadgeProps;
|
|
505
505
|
|
|
506
|
+
/**
|
|
507
|
+
* The status vocabulary every dashboard ends up retyping: lifecycle, review,
|
|
508
|
+
* fulfilment and money states mapped onto the semantic badge colors.
|
|
509
|
+
*
|
|
510
|
+
* Shipped as a default so `<NBadge status="approved" />` is already correct
|
|
511
|
+
* without a per-app table. A consumer's own `statusMap` is consulted first and
|
|
512
|
+
* merges rather than replaces, so overriding one key costs only that key.
|
|
513
|
+
*/
|
|
514
|
+
declare const NAJM_STATUS_COLORS: Record<string, BadgeColor>;
|
|
515
|
+
/**
|
|
516
|
+
* Text-only colors per badge color, for the `text`/`minimal` looks and for
|
|
517
|
+
* plain text that has to agree with a nearby badge — an amount rendered in the
|
|
518
|
+
* color of the payment it belongs to, say.
|
|
519
|
+
*
|
|
520
|
+
* `neutral` is `text-muted-foreground`, not `text-neutral-foreground`: the
|
|
521
|
+
* `-foreground` token is the contrast color *on* a solid neutral fill, so it
|
|
522
|
+
* reads as near-white in light mode and near-black in dark, and is unreadable
|
|
523
|
+
* anywhere else.
|
|
524
|
+
*/
|
|
525
|
+
declare const NAJM_COLOR_TEXT_CLASSES: Record<BadgeColor, string>;
|
|
526
|
+
/** The looked-up color, or `undefined` when nothing claims this status. */
|
|
527
|
+
declare function findStatusColor(status: string | undefined, statusMap?: Record<string, BadgeColor>): BadgeColor | undefined;
|
|
528
|
+
/**
|
|
529
|
+
* Resolves a status token to a badge color: the consumer's map first, then the
|
|
530
|
+
* built-in vocabulary, then `fallback`.
|
|
531
|
+
*
|
|
532
|
+
* The fallback is `neutral` rather than `primary` because an unrecognized
|
|
533
|
+
* status is exactly the thing that must not shout.
|
|
534
|
+
*/
|
|
535
|
+
declare function resolveStatusColor(status: string | undefined, statusMap?: Record<string, BadgeColor>, fallback?: BadgeColor): BadgeColor;
|
|
536
|
+
/** The text-only class for a badge color. */
|
|
537
|
+
declare function colorTextClass(color: BadgeColor): string;
|
|
538
|
+
/**
|
|
539
|
+
* The text-only class for a status token, for text that is *not* a badge — an
|
|
540
|
+
* amount that should carry the color of the payment beside it.
|
|
541
|
+
*
|
|
542
|
+
* An unmapped status returns `""` so the text keeps the surrounding color;
|
|
543
|
+
* pass `fallback` to color it anyway.
|
|
544
|
+
*/
|
|
545
|
+
declare function statusTextClass(status: string | undefined, statusMap?: Record<string, BadgeColor>, fallback?: BadgeColor): string;
|
|
546
|
+
|
|
506
547
|
type IndicatorVertical = "top" | "middle" | "bottom";
|
|
507
548
|
type IndicatorHorizontal = "start" | "center" | "end";
|
|
508
549
|
type IndicatorPosition = `${IndicatorVertical}-${IndicatorHorizontal}`;
|
|
@@ -3731,6 +3772,22 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
3731
3772
|
|
|
3732
3773
|
declare function resolveSlot<T>(slot: T | ((ctx: any) => ReactNode), ctx?: any): ReactNode;
|
|
3733
3774
|
|
|
3775
|
+
/** True when `src` is absent, blank, or the seeded placeholder. */
|
|
3776
|
+
declare function isPlaceholderAvatar(src: string | null | undefined): boolean;
|
|
3777
|
+
/**
|
|
3778
|
+
* The image to render, or `fallback` when there is no real one.
|
|
3779
|
+
*
|
|
3780
|
+
* ```ts
|
|
3781
|
+
* resolveAvatarSrc(child.image, childPlaceholder(child.gender))
|
|
3782
|
+
* ```
|
|
3783
|
+
*
|
|
3784
|
+
* The fallback is a parameter rather than a package default because which stock
|
|
3785
|
+
* image belongs to a record is the application's to decide — a child, a family
|
|
3786
|
+
* and a sponsor do not share one. What is shared is the question of whether the
|
|
3787
|
+
* stored value counts as an image at all, which is all this answers.
|
|
3788
|
+
*/
|
|
3789
|
+
declare function resolveAvatarSrc<Fallback extends string | null | undefined>(src: string | null | undefined, fallback: Fallback): string | Fallback;
|
|
3790
|
+
|
|
3734
3791
|
interface NajmFormatContextValue extends Required<Pick<NajmFormatConfig, "locale" | "timeZone" | "placeholder">> {
|
|
3735
3792
|
currency?: string;
|
|
3736
3793
|
/** Formats an integer count of minor units as `currency`. */
|
|
@@ -4212,4 +4269,4 @@ interface NGridItemProps extends Omit<React$1.AllHTMLAttributes<HTMLDivElement>,
|
|
|
4212
4269
|
declare function NGrid({ as: Comp, children, cols, smCols, mdCols, lgCols, xlCols, gap, className, style, ...props }: NGridProps): react_jsx_runtime.JSX.Element;
|
|
4213
4270
|
declare function NGridItem({ children, span, smSpan, mdSpan, lgSpan, xlSpan, className, ...props }: NGridItemProps): react_jsx_runtime.JSX.Element;
|
|
4214
4271
|
|
|
4215
|
-
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, type AvatarFormInputProps, AvatarGroup, type AvatarGroupProps, AvatarImage, AvatarInput, type AvatarInputProps, type AvatarInputRadius, type AvatarProps$1 as AvatarProps, type AvatarShape$1 as AvatarShape, type AvatarSize, AvatarStatus, type AvatarStatusType, Badge, type BadgeColor, type BadgeIcon, type BadgeLook, type BadgeProps, type BadgeShape, type BadgeSize, type BadgeVariant, BaseInput, type BuildDefaultFileColumnsOptions, Button, type ButtonConfig, type ButtonIcon, type ButtonLoaderPosition, type ButtonProps, type ButtonRounded, type ButtonSize, type ButtonVariant, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, type CheckboxGroupInputProps, CheckboxInput, type CheckboxInputProps, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorArrayInput, type ColorArrayInputProps, type ColorFormat, ColorPickerInput, type ColorPickerInputProps, Combobox, ComboboxInput, type ComboboxInputProps, type ComboboxOption, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ContextMenuItem, DEFAULT_CARD_BREAKPOINT, DEFAULT_THEME_FILE_NAME, DateInput, type DateInputProps, type DeleteDialogOptions, Dialog, type DialogActionMode, type DialogApi, DialogClose, type DialogConfig, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, type DialogHeight, DialogOverlay, type DialogPadding, DialogPortal, type DialogRenderContext, type DialogRenderer, type DialogSize, type DialogStore, DialogTitle, DialogTrigger, type DialogVariant, type DialogWidth, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray, type DynamicArrayProps, EMPTY_DESIGN, EmojiInput, type EmojiInputProps, type FileBrowserMode, FileImportButton, FileInput, type FileInputProps, type FileNode, Form, FormControl, FormDescription, FormField, FormInput, type FormInputBackground, type FormInputProps, FormItem, FormLabel, FormMessage, type FormProps, type FormSlotClassNames, type FormVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, ImageInput, type ImageInputPreviewError, type ImageInputPreviewSource, type ImageInputProps, Indicator, type IndicatorHorizontal, type IndicatorOverlay, type IndicatorPosition, type IndicatorProps, type IndicatorResponsivePosition, type IndicatorSize, type IndicatorVertical, Input, type InputIcon, Label, LangInput, type LangInputProps, type LinkComponentType, MultiSelectInput, type MultiSelectInputProps, NAJM_SAVED_THEME_VALUE, NAlert, type NAppCommandItem, NAppShell, type NAppShellAction, type NAppShellClassNames, type NAppShellProps, type NAppShellUser, NCard as NAsyncCard, type CardClassNames as NAsyncCardClassNames, type CardProps as NAsyncCardProps, NAvatar, type NAvatarClassNames, type NAvatarProps, type AvatarShape as NAvatarShape, NBadge, type NBadgeLook, type NBadgeProps, NBarChart, type NBarChartProps, type NBulkAction, type NBulkActionButton, type NBulkActionSelect, NBulkActionsBar, type NBulkActionsBarProps, NButton, type NButtonProps, NCard, NCardAction, type CardClassNames as NCardClassNames, type NCardDensity, NCardFooter, NCardInfo, type NCardInfoProps, NCardMedia, type NCardMediaAspect, type NCardMediaPlacement, type NCardMediaProps, type NCardMediaSize, type NCardMediaVariant, type CardProps as NCardProps, NCardSection, type NCardSectionProps, type NCardSectionSurface, type NCartesianChartProps, type NChartCardProps, type NChartDatum, type NChartItem, type NChartSeries, type NChartSize, NChartSkeleton, type NChartSkeletonProps, type NChartSkeletonVariant, NCommandPalette, type NCommandPaletteProps, NConfirmDialog, type NConfirmDialogProps, NContextMenu, type NContextMenuItem, type NContextMenuProps, NDataCardShell, type NDataCardShellActions, type NDataCardShellProps, NDeleteDialog, NDeleteDialogContent, type NDeleteDialogContentProps, type NDeleteDialogProps, NDetailCard, type NDetailCardClassNames, type NDetailCardProps, NDetailItem, type NDetailItemProps, NDetailList, type NDetailListItem, type NDetailListProps, NDialog, type NDialogActionProps, NDialogDescription, type NDialogDescriptionProps, type NDialogDirectProps, NDialogHeader, type NDialogHeaderProps, NDialogPrimaryButton, type NDialogProps, NDialogSecondaryButton, NDonutCard, type NDonutCardClassNames, type NDonutCardItem, type NDonutCardLayout, type NDonutCardLegendMarker, type NDonutCardProps, type NDonutCardVariant, type NEditorTab, NEditorTabs, type NEditorTabsProps, NEmptyState, type NEmptyStateProps, NErrorBoundary, NErrorState, type NErrorStateProps, NFileBrowser, type NFileBrowserCardProps, type NFileBrowserProps, type NFileBrowserRenderThumbProps, NFileTypeIcon, type NFileTypeIconProps, NFilterBar, NFolderIcon, type NFolderIconProps, NForm, NFormSectionHeader, type NFormSectionHeaderProps, NGrid, type NGridCols, NGridItem, type NGridItemProps, type NGridProps, type NGridSpan, NIcon, type NIconProps, type NIconSource, NImage, type NImageProps, NIndicator, NInspectorSheet, NLineChart, type NLineChartProps, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, type NPageHeaderBreakpoint, NPageHeaderCompactActions, NPageHeaderFilters, type NPageHeaderProps, NPageHeaderTop, NPageLayout, type NPageLayoutProps, NPieChart, type NPieChartProps, NPortalScopeProvider, NProgress, type NProgressProps, NRowActions, NSection, NSectionHeader, type NSectionHeaderActionsProps, type NSectionHeaderContentProps, type NSectionHeaderProps, type NSectionHeaderSubtitleProps, type NSectionHeaderTitleProps, NSectionInfo, type NSectionInfoProps, type NSectionProps, NSectionWithInfo, type NSectionWithInfoItem, type NSectionWithInfoProps, NSheet, type NSheetClassNames, type NSheetProps, NSidebar, NSidebarBrand, type NSidebarBrandProps, NSidebarContent, type NSidebarContentProps, type NSidebarContextValue, NSidebarFooter, type NSidebarFooterProps, NSidebarHeader, type NSidebarHeaderProps, NSidebarItem, NSidebarMobile, type NSidebarMobileProps, NSidebarProvider, NSidebarSection, type NSidebarSectionProps, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, type NSliderProps, NSmartPasteDialog, type NSmartPasteDialogProps, NSpinner, type NSpinnerProps, NStatCard, type NStatCardClassNames, type NStatCardProps, NStatCardSkeleton, type NStatCardVariant, NStatusBreakdown, type NStatusBreakdownProps, Swap as NSwap, type NSwapProps, NTable, NTableCardPagination, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, type NTableColumnBreakpoint, type NTableColumnDef, type NTableColumnMeta, NTableContent, NTableHeader, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, type NTablePageItem, NTablePagination, NTablePaginationLabels, NTablePaginationVariant, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NThemeCustomizer, type NThemeCustomizerFontOption, type NThemeCustomizerLabels, type NThemeCustomizerProps, type NThemeCustomizerTab, type NThemePreset, NThemePresets, type NThemePresetsLabels, type NThemePresetsProps, type NThemePresetsStatus, NUploader, type NUploaderItem, type NUploaderItemStatus, type NUploaderProps, NViewBody, NViewToggle, NajmAccent, NajmAppearance, type NajmBorderSide, NajmComponentName, NajmComponentStyleConfig, NajmComponentThemeConfig, NajmDesignConfig, NajmDesignEditorProvider, type NajmDesignEditorProviderProps, type NajmDesignEditorValue, NajmDesignProvider, type NajmDesignProviderProps, NajmFormatConfig, type NajmFormatContextValue, NajmFormatProvider, type NajmFormatProviderProps, NajmLayoutConfig, NajmMode, NajmPreset, NajmResponsiveBreakpoint, NajmResponsiveValue, NajmScroll, type NajmScrollProps, NajmThemeConfig, NajmThemeProvider, NajmThemeProviderProps, NajmThemeTokens, NajmTypographyConfig, NajmVariantStyle, NativeSelect, type NativeSelectOption, type NativeSelectProps, type NavItem, type NavItemGroup, NumberInput, type NumberInputProps, OtpInput, type OtpInputProps, PasswordInput, type PasswordInputProps, PhoneInput, type PhoneInputProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, type ProgressColor, type ProgressLabelPosition, type ProgressProps, type ProgressSize, type PushDialogOptions, RadioGroup, RadioGroupInput, type RadioGroupInputProps, RadioGroupItem, type RenderSlot, RepeatingFields, type RepeatingFieldsProps, ScrollArea, type ScrollAreaProps, SearchField, SearchField as SearchInput, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectInput, type SelectInputProps, SelectItem, type SelectItemType$1 as SelectItemDataType, type SelectItemType, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type SidebarItemProps, type SidebarLogo, type SidebarLogoRender, type SidebarProps, type SidebarWidth, type SidebarWidths, SimpleTooltip, type SimpleTooltipProps, NSkeleton as Skeleton, Slider, SliderInput, type SliderInputProps, type SliderOrientation, type SliderProps, type SliderSize, type SliderVariant, type SmartPastePreview, type SpinnerVariant, StarRatingInput, type StarRatingInputProps, StatusPill, type StatusPillProps, type StatusPillTone, type StepConfig, StepIndicator, type StepMeta, StepsHeader, StepsProgress, type StorageMenuAction, type StorageSortOption, type StorageTarget, Swap, type SwapEffect, SwapIndeterminate, SwapOff, SwapOn, type SwapProps, type SwapSize, type SwapState, Switch, type SwitchColor, SwitchInput, type SwitchInputProps, type SwitchSize, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableHeaderColor, TableRow, type TableState, type TableStore, TableStoreContext, Tabs, TabsContent, TabsList, type TabsListProps, type TabsOrientation, type TabsProps, TabsTrigger, type TabsTriggerProps, type TabsVariant, TextAreaInput, type TextAreaInputProps, TextInput, type TextInputProps, Textarea, TimeInput, type TimeInputProps, TimeZoneInput, type TimeZoneInputProps, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseContextMenuResult, type UseNFormOptions, type UseStorageContextMenuOptions, type UseStorageContextMenuResult, type UserMenuAction, VariantProvider, type WizardClassNames, WizardForm, type WizardFormProps, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buildPageItems, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveHiddenBelowClass, resolvePreset, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useCardViewport, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDesktopTableMode, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useMediaQuery, useNForm, useNPortalScope, useNSidebar, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmDesignEditor, useNajmFormat, useNajmFormatContext, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
|
4272
|
+
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, type AvatarFormInputProps, AvatarGroup, type AvatarGroupProps, AvatarImage, AvatarInput, type AvatarInputProps, type AvatarInputRadius, type AvatarProps$1 as AvatarProps, type AvatarShape$1 as AvatarShape, type AvatarSize, AvatarStatus, type AvatarStatusType, Badge, type BadgeColor, type BadgeIcon, type BadgeLook, type BadgeProps, type BadgeShape, type BadgeSize, type BadgeVariant, BaseInput, type BuildDefaultFileColumnsOptions, Button, type ButtonConfig, type ButtonIcon, type ButtonLoaderPosition, type ButtonProps, type ButtonRounded, type ButtonSize, type ButtonVariant, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, type CheckboxGroupInputProps, CheckboxInput, type CheckboxInputProps, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorArrayInput, type ColorArrayInputProps, type ColorFormat, ColorPickerInput, type ColorPickerInputProps, Combobox, ComboboxInput, type ComboboxInputProps, type ComboboxOption, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ContextMenuItem, DEFAULT_CARD_BREAKPOINT, DEFAULT_THEME_FILE_NAME, DateInput, type DateInputProps, type DeleteDialogOptions, Dialog, type DialogActionMode, type DialogApi, DialogClose, type DialogConfig, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, type DialogHeight, DialogOverlay, type DialogPadding, DialogPortal, type DialogRenderContext, type DialogRenderer, type DialogSize, type DialogStore, DialogTitle, DialogTrigger, type DialogVariant, type DialogWidth, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray, type DynamicArrayProps, EMPTY_DESIGN, EmojiInput, type EmojiInputProps, type FileBrowserMode, FileImportButton, FileInput, type FileInputProps, type FileNode, Form, FormControl, FormDescription, FormField, FormInput, type FormInputBackground, type FormInputProps, FormItem, FormLabel, FormMessage, type FormProps, type FormSlotClassNames, type FormVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, ImageInput, type ImageInputPreviewError, type ImageInputPreviewSource, type ImageInputProps, Indicator, type IndicatorHorizontal, type IndicatorOverlay, type IndicatorPosition, type IndicatorProps, type IndicatorResponsivePosition, type IndicatorSize, type IndicatorVertical, Input, type InputIcon, Label, LangInput, type LangInputProps, type LinkComponentType, MultiSelectInput, type MultiSelectInputProps, NAJM_COLOR_TEXT_CLASSES, NAJM_SAVED_THEME_VALUE, NAJM_STATUS_COLORS, NAlert, type NAppCommandItem, NAppShell, type NAppShellAction, type NAppShellClassNames, type NAppShellProps, type NAppShellUser, NCard as NAsyncCard, type CardClassNames as NAsyncCardClassNames, type CardProps as NAsyncCardProps, NAvatar, type NAvatarClassNames, type NAvatarProps, type AvatarShape as NAvatarShape, NBadge, type NBadgeLook, type NBadgeProps, NBarChart, type NBarChartProps, type NBulkAction, type NBulkActionButton, type NBulkActionSelect, NBulkActionsBar, type NBulkActionsBarProps, NButton, type NButtonProps, NCard, NCardAction, type CardClassNames as NCardClassNames, type NCardDensity, NCardFooter, NCardInfo, type NCardInfoProps, NCardMedia, type NCardMediaAspect, type NCardMediaPlacement, type NCardMediaProps, type NCardMediaSize, type NCardMediaVariant, type CardProps as NCardProps, NCardSection, type NCardSectionProps, type NCardSectionSurface, type NCartesianChartProps, type NChartCardProps, type NChartDatum, type NChartItem, type NChartSeries, type NChartSize, NChartSkeleton, type NChartSkeletonProps, type NChartSkeletonVariant, NCommandPalette, type NCommandPaletteProps, NConfirmDialog, type NConfirmDialogProps, NContextMenu, type NContextMenuItem, type NContextMenuProps, NDataCardShell, type NDataCardShellActions, type NDataCardShellProps, NDeleteDialog, NDeleteDialogContent, type NDeleteDialogContentProps, type NDeleteDialogProps, NDetailCard, type NDetailCardClassNames, type NDetailCardProps, NDetailItem, type NDetailItemProps, NDetailList, type NDetailListItem, type NDetailListProps, NDialog, type NDialogActionProps, NDialogDescription, type NDialogDescriptionProps, type NDialogDirectProps, NDialogHeader, type NDialogHeaderProps, NDialogPrimaryButton, type NDialogProps, NDialogSecondaryButton, NDonutCard, type NDonutCardClassNames, type NDonutCardItem, type NDonutCardLayout, type NDonutCardLegendMarker, type NDonutCardProps, type NDonutCardVariant, type NEditorTab, NEditorTabs, type NEditorTabsProps, NEmptyState, type NEmptyStateProps, NErrorBoundary, NErrorState, type NErrorStateProps, NFileBrowser, type NFileBrowserCardProps, type NFileBrowserProps, type NFileBrowserRenderThumbProps, NFileTypeIcon, type NFileTypeIconProps, NFilterBar, NFolderIcon, type NFolderIconProps, NForm, NFormSectionHeader, type NFormSectionHeaderProps, NGrid, type NGridCols, NGridItem, type NGridItemProps, type NGridProps, type NGridSpan, NIcon, type NIconProps, type NIconSource, NImage, type NImageProps, NIndicator, NInspectorSheet, NLineChart, type NLineChartProps, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, type NPageHeaderBreakpoint, NPageHeaderCompactActions, NPageHeaderFilters, type NPageHeaderProps, NPageHeaderTop, NPageLayout, type NPageLayoutProps, NPieChart, type NPieChartProps, NPortalScopeProvider, NProgress, type NProgressProps, NRowActions, NSection, NSectionHeader, type NSectionHeaderActionsProps, type NSectionHeaderContentProps, type NSectionHeaderProps, type NSectionHeaderSubtitleProps, type NSectionHeaderTitleProps, NSectionInfo, type NSectionInfoProps, type NSectionProps, NSectionWithInfo, type NSectionWithInfoItem, type NSectionWithInfoProps, NSheet, type NSheetClassNames, type NSheetProps, NSidebar, NSidebarBrand, type NSidebarBrandProps, NSidebarContent, type NSidebarContentProps, type NSidebarContextValue, NSidebarFooter, type NSidebarFooterProps, NSidebarHeader, type NSidebarHeaderProps, NSidebarItem, NSidebarMobile, type NSidebarMobileProps, NSidebarProvider, NSidebarSection, type NSidebarSectionProps, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, type NSliderProps, NSmartPasteDialog, type NSmartPasteDialogProps, NSpinner, type NSpinnerProps, NStatCard, type NStatCardClassNames, type NStatCardProps, NStatCardSkeleton, type NStatCardVariant, NStatusBreakdown, type NStatusBreakdownProps, Swap as NSwap, type NSwapProps, NTable, NTableCardPagination, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, type NTableColumnBreakpoint, type NTableColumnDef, type NTableColumnMeta, NTableContent, NTableHeader, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, type NTablePageItem, NTablePagination, NTablePaginationLabels, NTablePaginationVariant, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NThemeCustomizer, type NThemeCustomizerFontOption, type NThemeCustomizerLabels, type NThemeCustomizerProps, type NThemeCustomizerTab, type NThemePreset, NThemePresets, type NThemePresetsLabels, type NThemePresetsProps, type NThemePresetsStatus, NUploader, type NUploaderItem, type NUploaderItemStatus, type NUploaderProps, NViewBody, NViewToggle, NajmAccent, NajmAppearance, type NajmBorderSide, NajmComponentName, NajmComponentStyleConfig, NajmComponentThemeConfig, NajmDesignConfig, NajmDesignEditorProvider, type NajmDesignEditorProviderProps, type NajmDesignEditorValue, NajmDesignProvider, type NajmDesignProviderProps, NajmFormatConfig, type NajmFormatContextValue, NajmFormatProvider, type NajmFormatProviderProps, NajmLayoutConfig, NajmMode, NajmPreset, NajmResponsiveBreakpoint, NajmResponsiveValue, NajmScroll, type NajmScrollProps, NajmThemeConfig, NajmThemeProvider, NajmThemeProviderProps, NajmThemeTokens, NajmTypographyConfig, NajmVariantStyle, NativeSelect, type NativeSelectOption, type NativeSelectProps, type NavItem, type NavItemGroup, NumberInput, type NumberInputProps, OtpInput, type OtpInputProps, PasswordInput, type PasswordInputProps, PhoneInput, type PhoneInputProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, type ProgressColor, type ProgressLabelPosition, type ProgressProps, type ProgressSize, type PushDialogOptions, RadioGroup, RadioGroupInput, type RadioGroupInputProps, RadioGroupItem, type RenderSlot, RepeatingFields, type RepeatingFieldsProps, ScrollArea, type ScrollAreaProps, SearchField, SearchField as SearchInput, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectInput, type SelectInputProps, SelectItem, type SelectItemType$1 as SelectItemDataType, type SelectItemType, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type SidebarItemProps, type SidebarLogo, type SidebarLogoRender, type SidebarProps, type SidebarWidth, type SidebarWidths, SimpleTooltip, type SimpleTooltipProps, NSkeleton as Skeleton, Slider, SliderInput, type SliderInputProps, type SliderOrientation, type SliderProps, type SliderSize, type SliderVariant, type SmartPastePreview, type SpinnerVariant, StarRatingInput, type StarRatingInputProps, StatusPill, type StatusPillProps, type StatusPillTone, type StepConfig, StepIndicator, type StepMeta, StepsHeader, StepsProgress, type StorageMenuAction, type StorageSortOption, type StorageTarget, Swap, type SwapEffect, SwapIndeterminate, SwapOff, SwapOn, type SwapProps, type SwapSize, type SwapState, Switch, type SwitchColor, SwitchInput, type SwitchInputProps, type SwitchSize, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableHeaderColor, TableRow, type TableState, type TableStore, TableStoreContext, Tabs, TabsContent, TabsList, type TabsListProps, type TabsOrientation, type TabsProps, TabsTrigger, type TabsTriggerProps, type TabsVariant, TextAreaInput, type TextAreaInputProps, TextInput, type TextInputProps, Textarea, TimeInput, type TimeInputProps, TimeZoneInput, type TimeZoneInputProps, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseContextMenuResult, type UseNFormOptions, type UseStorageContextMenuOptions, type UseStorageContextMenuResult, type UserMenuAction, VariantProvider, type WizardClassNames, WizardForm, type WizardFormProps, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buildPageItems, buttonVariants, cn, colorTextClass, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, filterResponsiveColumns, findStatusColor, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, isPlaceholderAvatar, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveAvatarSrc, resolveHiddenBelowClass, resolvePreset, resolveSlot, resolveStatusColor, resolveVariantAlias, sidebarBorderClasses, sliderVariants, statusTextClass, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useCardViewport, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDesktopTableMode, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useMediaQuery, useNForm, useNPortalScope, useNSidebar, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmDesignEditor, useNajmFormat, useNajmFormatContext, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useNBranding } from './chunk-
|
|
2
|
-
export { NBrandingProvider, NBrandingStateProvider, NajmFormatProvider, normalizeBranding, useNBranding, useNBrandingEditor, useNajmFormat, useNajmFormatContext } from './chunk-
|
|
1
|
+
import { useNBranding } from './chunk-PCPMAEKP.mjs';
|
|
2
|
+
export { NBrandingProvider, NBrandingStateProvider, NajmFormatProvider, normalizeBranding, useNBranding, useNBrandingEditor, useNajmFormat, useNajmFormatContext } from './chunk-PCPMAEKP.mjs';
|
|
3
3
|
import { useResolvedPaginationLabels } from './chunk-USZUOJMK.mjs';
|
|
4
4
|
export { DEFAULT_PAGINATION_KEY_PREFIX, DEFAULT_TIME_ZONE, EMPTY_DESIGN, NTableDefaultsProvider, NajmDesignEditorProvider, NajmPreferencesProvider, NajmUIProvider, buildPaginationLabels, useNTableDefaults, useNajmDesignEditor, useNajmPreferencesContext, useNajmTheme, useNajmTimeZone } from './chunk-USZUOJMK.mjs';
|
|
5
5
|
import { resolveRadiusValue, inputBorderClasses, Button, NIcon, NajmScroll, surfaceBorderClasses, useNajmScrollViewport, resolveVariantAlias, buttonVariants, NButton, parseNajmDesignConfig, useTableStore, TableStoreContext, sidebarBorderClasses, NTableJson } from './chunk-6OOBAEH2.mjs';
|
|
6
6
|
export { Button, NAJM_COMPONENT_NAMES, NButton, NIcon, NTableJson, NajmScroll, RADIUS_VALUE_MAP, TableStoreContext, buttonVariants, defineNajmDesignConfig, defineNajmThemeConfig, inputBorderClasses, parseNajmDesignConfig, parseNajmThemeConfig, resolveRadiusValue, resolveVariantAlias, sidebarBorderClasses, stringifyNajmDesignConfig, stringifyNajmThemeConfig, surfaceBorderClasses, useTableStore } from './chunk-6OOBAEH2.mjs';
|
|
7
7
|
import { useNajmComponentStyle, cn, NajmThemeContainerCtx, useNajmThemeMode, useNajmDesign, composePreset } from './chunk-KVZACF4G.mjs';
|
|
8
8
|
export { NajmDesignProvider, NajmThemeProvider, cn, composePreset, resolvePreset, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode } from './chunk-KVZACF4G.mjs';
|
|
9
|
-
export { DEFAULT_CARD_BREAKPOINT, DEFAULT_CARD_PAGINATION_KEY_PREFIX, buildCardPaginationLabels, createCardPagination, useCardViewport, useDesktopTableMode, useMediaQuery } from './chunk-
|
|
9
|
+
export { DEFAULT_CARD_BREAKPOINT, DEFAULT_CARD_PAGINATION_KEY_PREFIX, buildCardPaginationLabels, createCardPagination, useCardViewport, useDesktopTableMode, useMediaQuery } from './chunk-OUS7OYVA.mjs';
|
|
10
10
|
import './chunk-F5KXJCCJ.mjs';
|
|
11
|
-
|
|
11
|
+
import { humanizeToken } from './chunk-JABLSOQN.mjs';
|
|
12
|
+
export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatTime, humanizeToken, localDateInput, slugify } from './chunk-JABLSOQN.mjs';
|
|
12
13
|
export { DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, cleanQuery, createOffsetPagination, fetchOffsetPage, getPageIndex } from './chunk-2NX2VKS2.mjs';
|
|
13
14
|
import * as React60 from 'react';
|
|
14
15
|
import React60__default, { createContext, useRef, useMemo, useState, useEffect, useContext, useCallback, useLayoutEffect, isValidElement } from 'react';
|
|
@@ -2403,6 +2404,77 @@ function Checkbox({ className, ...props }) {
|
|
|
2403
2404
|
}
|
|
2404
2405
|
);
|
|
2405
2406
|
}
|
|
2407
|
+
|
|
2408
|
+
// src/components/Badge/status.ts
|
|
2409
|
+
var NAJM_STATUS_COLORS = {
|
|
2410
|
+
active: "success",
|
|
2411
|
+
approved: "success",
|
|
2412
|
+
completed: "success",
|
|
2413
|
+
confirmed: "success",
|
|
2414
|
+
delivered: "success",
|
|
2415
|
+
paid: "success",
|
|
2416
|
+
published: "success",
|
|
2417
|
+
succeeded: "success",
|
|
2418
|
+
validated: "success",
|
|
2419
|
+
verified: "success",
|
|
2420
|
+
in_preparation: "warning",
|
|
2421
|
+
in_progress: "warning",
|
|
2422
|
+
out_for_delivery: "warning",
|
|
2423
|
+
pending: "warning",
|
|
2424
|
+
pending_email_verification: "warning",
|
|
2425
|
+
pending_review: "warning",
|
|
2426
|
+
processing: "warning",
|
|
2427
|
+
submitted: "warning",
|
|
2428
|
+
paused: "info",
|
|
2429
|
+
purchased: "info",
|
|
2430
|
+
scheduled: "info",
|
|
2431
|
+
archived: "neutral",
|
|
2432
|
+
cancelled: "neutral",
|
|
2433
|
+
canceled: "neutral",
|
|
2434
|
+
closed: "neutral",
|
|
2435
|
+
draft: "neutral",
|
|
2436
|
+
inactive: "neutral",
|
|
2437
|
+
stopped: "neutral",
|
|
2438
|
+
unknown: "neutral",
|
|
2439
|
+
blocked: "destructive",
|
|
2440
|
+
expired: "destructive",
|
|
2441
|
+
failed: "destructive",
|
|
2442
|
+
refunded: "destructive",
|
|
2443
|
+
rejected: "destructive",
|
|
2444
|
+
suspended: "destructive"
|
|
2445
|
+
};
|
|
2446
|
+
var NAJM_COLOR_TEXT_CLASSES = {
|
|
2447
|
+
primary: "text-primary",
|
|
2448
|
+
secondary: "text-secondary-foreground",
|
|
2449
|
+
accent: "text-accent-foreground",
|
|
2450
|
+
neutral: "text-muted-foreground",
|
|
2451
|
+
info: "text-info",
|
|
2452
|
+
success: "text-success",
|
|
2453
|
+
warning: "text-warning",
|
|
2454
|
+
destructive: "text-destructive"
|
|
2455
|
+
};
|
|
2456
|
+
function normalizeStatus(status) {
|
|
2457
|
+
return status.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
2458
|
+
}
|
|
2459
|
+
function lookup(map, status, normalized) {
|
|
2460
|
+
if (!map) return void 0;
|
|
2461
|
+
return map[status] ?? map[normalized];
|
|
2462
|
+
}
|
|
2463
|
+
function findStatusColor(status, statusMap) {
|
|
2464
|
+
if (!status) return void 0;
|
|
2465
|
+
const normalized = normalizeStatus(status);
|
|
2466
|
+
return lookup(statusMap, status, normalized) ?? lookup(NAJM_STATUS_COLORS, status, normalized);
|
|
2467
|
+
}
|
|
2468
|
+
function resolveStatusColor(status, statusMap, fallback = "neutral") {
|
|
2469
|
+
return findStatusColor(status, statusMap) ?? fallback;
|
|
2470
|
+
}
|
|
2471
|
+
function colorTextClass(color) {
|
|
2472
|
+
return NAJM_COLOR_TEXT_CLASSES[color] ?? "text-foreground";
|
|
2473
|
+
}
|
|
2474
|
+
function statusTextClass(status, statusMap, fallback) {
|
|
2475
|
+
const color = findStatusColor(status, statusMap) ?? fallback;
|
|
2476
|
+
return color ? colorTextClass(color) : "";
|
|
2477
|
+
}
|
|
2406
2478
|
var badgeVariants = cva(
|
|
2407
2479
|
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
2408
2480
|
{
|
|
@@ -2461,8 +2533,11 @@ var badgeColorVariants = cva(
|
|
|
2461
2533
|
{ color: "accent", look: "soft", class: "bg-accent/10 text-accent-foreground border-accent/30" },
|
|
2462
2534
|
{ color: "accent", look: ["outline", "dash"], class: "text-accent-foreground border-accent/40" },
|
|
2463
2535
|
{ color: "neutral", look: "solid", class: "bg-neutral text-neutral-foreground" },
|
|
2464
|
-
|
|
2465
|
-
|
|
2536
|
+
// Not `text-neutral-foreground`: that token is the contrast color on a
|
|
2537
|
+
// solid neutral fill, so on a tinted or transparent one it inverts with
|
|
2538
|
+
// the theme and disappears.
|
|
2539
|
+
{ color: "neutral", look: "soft", class: "bg-neutral/10 text-muted-foreground border-neutral/30" },
|
|
2540
|
+
{ color: "neutral", look: ["outline", "dash"], class: "text-muted-foreground border-neutral/40" },
|
|
2466
2541
|
{ color: "info", look: "solid", class: "bg-info text-info-foreground" },
|
|
2467
2542
|
{ color: "info", look: "soft", class: "bg-info/10 text-info border-info/20" },
|
|
2468
2543
|
{ color: "info", look: ["outline", "dash"], class: "text-info border-info/60" },
|
|
@@ -2479,14 +2554,6 @@ var badgeColorVariants = cva(
|
|
|
2479
2554
|
defaultVariants: { color: "primary", look: "solid", size: "md", shape: "default" }
|
|
2480
2555
|
}
|
|
2481
2556
|
);
|
|
2482
|
-
var COLOR_TEXT_MAP = {
|
|
2483
|
-
success: "text-success",
|
|
2484
|
-
warning: "text-warning",
|
|
2485
|
-
accent: "text-accent-foreground",
|
|
2486
|
-
info: "text-info",
|
|
2487
|
-
neutral: "text-neutral-foreground",
|
|
2488
|
-
destructive: "text-destructive"
|
|
2489
|
-
};
|
|
2490
2557
|
var SIZE_TEXT_MAP = {
|
|
2491
2558
|
sm: "text-xs",
|
|
2492
2559
|
md: "text-sm",
|
|
@@ -2524,14 +2591,14 @@ function Badge({
|
|
|
2524
2591
|
const effVariant = variant ?? aliased.variant ?? recipe?.defaultVariant;
|
|
2525
2592
|
const recipeRadius = shape === void 0 ? resolveRadiusValue(recipe?.radius) : void 0;
|
|
2526
2593
|
const recipeStyle = recipeRadius ? { borderRadius: recipeRadius, ...style } : style;
|
|
2527
|
-
const resolvedColor =
|
|
2528
|
-
const resolvedLabel = label ?? (typeof children === "string" ? children : void 0) ?? status;
|
|
2594
|
+
const resolvedColor = status ? resolveStatusColor(status, statusMap, color ?? "neutral") : color ?? "primary";
|
|
2595
|
+
const resolvedLabel = label ?? (typeof children === "string" ? children : void 0) ?? (status ? humanizeToken(status) : void 0);
|
|
2529
2596
|
const content = typeof children !== "string" && children ? children : resolvedLabel ?? children;
|
|
2530
2597
|
const resolvedIcon = icon ?? (resolvedColor ? iconMap?.[resolvedColor] : void 0);
|
|
2531
2598
|
const iconNode = renderIcon(showIcon ? resolvedIcon : icon);
|
|
2532
2599
|
const isMinimal = look === "minimal" || look === "text";
|
|
2533
2600
|
if (isMinimal) {
|
|
2534
|
-
const textColor =
|
|
2601
|
+
const textColor = colorTextClass(resolvedColor);
|
|
2535
2602
|
const sizeClass = SIZE_TEXT_MAP[size ?? "md"] ?? "text-sm";
|
|
2536
2603
|
return /* @__PURE__ */ jsxs(
|
|
2537
2604
|
Comp,
|
|
@@ -8281,6 +8348,17 @@ function NSkeletonWidget() {
|
|
|
8281
8348
|
function NSkeletonWidgets({ count = 5 }) {
|
|
8282
8349
|
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-3", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx(NSkeletonWidget, {}, i)) });
|
|
8283
8350
|
}
|
|
8351
|
+
|
|
8352
|
+
// src/lib/avatar.ts
|
|
8353
|
+
var PLACEHOLDER_AVATAR = /(^|\/)noavatar\.png(?:$|[?#])/i;
|
|
8354
|
+
function isPlaceholderAvatar(src) {
|
|
8355
|
+
const trimmed = src?.trim() ?? "";
|
|
8356
|
+
return !trimmed || PLACEHOLDER_AVATAR.test(trimmed);
|
|
8357
|
+
}
|
|
8358
|
+
function resolveAvatarSrc(src, fallback) {
|
|
8359
|
+
const trimmed = src?.trim() ?? "";
|
|
8360
|
+
return trimmed && !PLACEHOLDER_AVATAR.test(trimmed) ? trimmed : fallback;
|
|
8361
|
+
}
|
|
8284
8362
|
var AVATAR_COLORS = [
|
|
8285
8363
|
["#3b82f6", "#1d4ed8"],
|
|
8286
8364
|
["#8b5cf6", "#6d28d9"],
|
|
@@ -8322,9 +8400,6 @@ function nameToColor(name) {
|
|
|
8322
8400
|
function getInitials(name) {
|
|
8323
8401
|
return name.split(" ").map((part) => part.charAt(0)).join("").toUpperCase().slice(0, 2);
|
|
8324
8402
|
}
|
|
8325
|
-
function shouldUseSrc(src) {
|
|
8326
|
-
return Boolean(src && src !== "noavatar.png");
|
|
8327
|
-
}
|
|
8328
8403
|
function withVersion(src, version) {
|
|
8329
8404
|
if (!version || src.startsWith("data:") || src.startsWith("blob:")) return src;
|
|
8330
8405
|
const separator = src.includes("?") ? "&" : "?";
|
|
@@ -8347,7 +8422,8 @@ function NAvatar({
|
|
|
8347
8422
|
}) {
|
|
8348
8423
|
const label = title || fallback || "";
|
|
8349
8424
|
const imageVersion = srcVersion ?? version;
|
|
8350
|
-
const
|
|
8425
|
+
const resolvedSrc = resolveAvatarSrc(src, void 0);
|
|
8426
|
+
const imageSrc = resolvedSrc ? withVersion(resolvedSrc, imageVersion) : fallbackSrc;
|
|
8351
8427
|
const { bg, text } = nameToColor(label);
|
|
8352
8428
|
const hasText = Boolean(title || subtitle || meta);
|
|
8353
8429
|
const fallbackText = fallback && !title ? fallback : label ? getInitials(label) : "?";
|
|
@@ -15173,4 +15249,4 @@ function NGridItem({
|
|
|
15173
15249
|
return /* @__PURE__ */ jsx("div", { className: itemClassName, ...props, children });
|
|
15174
15250
|
}
|
|
15175
15251
|
|
|
15176
|
-
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, AvatarGroup, AvatarImage, AvatarInput, AvatarStatus, Badge, BaseInput, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, CheckboxInput, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorArrayInput, ColorPickerInput, Combobox, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DEFAULT_THEME_FILE_NAME, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray_default as DynamicArray, EmojiInput, FileImportButton, FileInput, Form, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, IconButton, ImageInput, Indicator4 as Indicator, Input, Label2 as Label, LangInput, MultiSelectInput, NAJM_SAVED_THEME_VALUE, NAlert, NAppShell, NCard as NAsyncCard, NAvatar, NBadge, NBarChart, NBulkActionsBar, NCard, NCardAction, NCardFooter, NCardInfo, NCardMedia, NCardSection, NChartSkeleton, NCommandPalette, NConfirmDialog, NContextMenu, NDataCardShell, NDeleteDialog, NDeleteDialogContent, NDetailCard, NDetailItem, NDetailList, NDialog, NDialogDescription, NDialogHeader, NDialogPrimaryButton, NDialogSecondaryButton, NDonutCard, NEditorTabs, NEmptyState, NErrorBoundary, NErrorState, NFileBrowser, NFileTypeIcon, NFilterBar, NFolderIcon, NForm, NFormSectionHeader, NGrid, NGridItem, NImage, NIndicator, NInspectorSheet, NLineChart, NLoadingState, NMultiDialog, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderCompactActions, NPageHeaderFilters, NPageHeaderTop, NPageLayout, NPieChart, NPortalScopeProvider, NProgress, NRowActions, NSection, NSectionHeader, NSectionInfo, NSectionWithInfo, NSheet, NSidebar, NSidebarBrand, NSidebarContent, NSidebarFooter, NSidebarHeader, NSidebarItem, NSidebarMobile, NSidebarProvider, NSidebarSection, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, NSmartPasteDialog, NSpinner, NStatCard, NStatCardSkeleton, NStatusBreakdown, Swap as NSwap, NTable, NTableCardRoot, NTableCards, NTableContent, NTableHeader, NTableLoadingSkeleton, NTablePagination, NTableRowSkeleton, NTableSkeleton, NTabs, NThemeCustomizer, NThemePresets, NUploader, NViewBody, NViewToggle, NativeSelect, NumberInput, OtpInput, PasswordInput, PhoneInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, RadioGroup, RadioGroupInput, RadioGroupItem, RepeatingFields, ScrollArea, SearchField, SearchField as SearchInput, SegmentedControl, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleTooltip, NSkeleton as Skeleton, Slider, SliderInput, StarRatingInput, StatusPill, StepIndicator, StepsHeader, StepsProgress, Swap, SwapIndeterminate, SwapOff, SwapOn, Switch, SwitchInput, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaInput, TextInput, Textarea, TimeInput, TimeZoneInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buildPageItems, createDialogStore, createTableStore, detectFormat, dialogVariants, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, normalizeThemeFileName, parseColor, parseThemeFile, resolveHiddenBelowClass, resolveSlot, sliderVariants, stringifyThemeFile, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNSidebar, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useVariant, useVariantPreset };
|
|
15252
|
+
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, AvatarGroup, AvatarImage, AvatarInput, AvatarStatus, Badge, BaseInput, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, CheckboxInput, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorArrayInput, ColorPickerInput, Combobox, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DEFAULT_THEME_FILE_NAME, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray_default as DynamicArray, EmojiInput, FileImportButton, FileInput, Form, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, IconButton, ImageInput, Indicator4 as Indicator, Input, Label2 as Label, LangInput, MultiSelectInput, NAJM_COLOR_TEXT_CLASSES, NAJM_SAVED_THEME_VALUE, NAJM_STATUS_COLORS, NAlert, NAppShell, NCard as NAsyncCard, NAvatar, NBadge, NBarChart, NBulkActionsBar, NCard, NCardAction, NCardFooter, NCardInfo, NCardMedia, NCardSection, NChartSkeleton, NCommandPalette, NConfirmDialog, NContextMenu, NDataCardShell, NDeleteDialog, NDeleteDialogContent, NDetailCard, NDetailItem, NDetailList, NDialog, NDialogDescription, NDialogHeader, NDialogPrimaryButton, NDialogSecondaryButton, NDonutCard, NEditorTabs, NEmptyState, NErrorBoundary, NErrorState, NFileBrowser, NFileTypeIcon, NFilterBar, NFolderIcon, NForm, NFormSectionHeader, NGrid, NGridItem, NImage, NIndicator, NInspectorSheet, NLineChart, NLoadingState, NMultiDialog, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderCompactActions, NPageHeaderFilters, NPageHeaderTop, NPageLayout, NPieChart, NPortalScopeProvider, NProgress, NRowActions, NSection, NSectionHeader, NSectionInfo, NSectionWithInfo, NSheet, NSidebar, NSidebarBrand, NSidebarContent, NSidebarFooter, NSidebarHeader, NSidebarItem, NSidebarMobile, NSidebarProvider, NSidebarSection, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, NSmartPasteDialog, NSpinner, NStatCard, NStatCardSkeleton, NStatusBreakdown, Swap as NSwap, NTable, NTableCardRoot, NTableCards, NTableContent, NTableHeader, NTableLoadingSkeleton, NTablePagination, NTableRowSkeleton, NTableSkeleton, NTabs, NThemeCustomizer, NThemePresets, NUploader, NViewBody, NViewToggle, NativeSelect, NumberInput, OtpInput, PasswordInput, PhoneInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, RadioGroup, RadioGroupInput, RadioGroupItem, RepeatingFields, ScrollArea, SearchField, SearchField as SearchInput, SegmentedControl, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleTooltip, NSkeleton as Skeleton, Slider, SliderInput, StarRatingInput, StatusPill, StepIndicator, StepsHeader, StepsProgress, Swap, SwapIndeterminate, SwapOff, SwapOn, Switch, SwitchInput, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaInput, TextInput, Textarea, TimeInput, TimeZoneInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buildPageItems, colorTextClass, createDialogStore, createTableStore, detectFormat, dialogVariants, filterResponsiveColumns, findStatusColor, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, isPlaceholderAvatar, normalizeThemeFileName, parseColor, parseThemeFile, resolveAvatarSrc, resolveHiddenBelowClass, resolveSlot, resolveStatusColor, sliderVariants, statusTextClass, stringifyThemeFile, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNSidebar, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useVariant, useVariantPreset };
|
|
@@ -122,8 +122,15 @@ type NTableCardPagination = {
|
|
|
122
122
|
* depends on no `najm-*` package, and this signature is satisfied by every
|
|
123
123
|
* mainstream i18n library. The application keeps its catalog and its own
|
|
124
124
|
* language provider.
|
|
125
|
+
*
|
|
126
|
+
* `Key` narrows the accepted keys. It exists for the application that types its
|
|
127
|
+
* translator to a generated union of its catalog — such a `t` is *not*
|
|
128
|
+
* assignable to `NajmTranslate<string>`, since a parameter position accepting
|
|
129
|
+
* fewer values is the wrong way round. Builders below name the exact keys they
|
|
130
|
+
* pass, so a narrow translator satisfies them without a cast and the keys stay
|
|
131
|
+
* checked against the catalog.
|
|
125
132
|
*/
|
|
126
|
-
type NajmTranslate = (key:
|
|
133
|
+
type NajmTranslate<Key extends string = string> = (key: Key, params?: Record<string, string | number>) => string;
|
|
127
134
|
declare const DEFAULT_PAGINATION_KEY_PREFIX = "common.pagination";
|
|
128
135
|
/**
|
|
129
136
|
* Projects a translator onto the ten pagination labels.
|
package/dist/query.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
2
2
|
import { OffsetPageFetcher, OffsetPage } from './pagination.js';
|
|
3
3
|
export { ApiPage, DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, OffsetPageOptions, OffsetPagination, QueryValue, cleanQuery, createOffsetPagination, fetchOffsetPage, getPageIndex } from './pagination.js';
|
|
4
|
-
import { L as ListStrategy, R as ResolvedListMode } from './cardPagination-
|
|
5
|
-
export { C as
|
|
6
|
-
import './paginationLabels-
|
|
4
|
+
import { L as ListStrategy, R as ResolvedListMode } from './cardPagination-Bwf3tEeN.js';
|
|
5
|
+
export { C as CardPaginationKey, a as CardPaginationLabels, b as CardPaginationState, c as buildCardPaginationLabels, d as createCardPagination } from './cardPagination-Bwf3tEeN.js';
|
|
6
|
+
import './paginationLabels-dZLSNxfo.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
|
|
9
9
|
interface UseOffsetInfiniteQueryOptions<T> {
|
package/dist/query.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCardViewport } from './chunk-
|
|
2
|
-
export { buildCardPaginationLabels, createCardPagination } from './chunk-
|
|
1
|
+
import { useCardViewport } from './chunk-OUS7OYVA.mjs';
|
|
2
|
+
export { buildCardPaginationLabels, createCardPagination } from './chunk-OUS7OYVA.mjs';
|
|
3
3
|
import { fetchOffsetPage, DEFAULT_MAX_PAGE_SIZE } from './chunk-2NX2VKS2.mjs';
|
|
4
4
|
export { DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, cleanQuery, createOffsetPagination, fetchOffsetPage, getPageIndex } from './chunk-2NX2VKS2.mjs';
|
|
5
5
|
import { useInfiniteQuery } from '@tanstack/react-query';
|