najm-kit 2.7.3 → 2.8.1
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 +29 -3
- package/README.md +124 -6
- package/dist/{NajmUIProvider-IFU3dFkn.d.ts → NajmUIProvider-BSbXaqak.d.ts} +1 -1
- package/dist/adapters/app.d.ts +10 -4
- package/dist/adapters/app.mjs +8 -5
- package/dist/adapters/next.d.ts +2 -2
- package/dist/{cardPagination-A6h8vXuk.d.ts → cardPagination-Bwf3tEeN.d.ts} +16 -4
- package/dist/chunk-GHMR45H3.mjs +333 -0
- package/dist/{chunk-GPHWBOSP.mjs → chunk-JABLSOQN.mjs} +11 -1
- package/dist/{chunk-XGDMPI5U.mjs → chunk-OUS7OYVA.mjs} +11 -9
- package/dist/{NBrandingContext-dkADu8JS.d.ts → formFill-BcH-m9Kf.d.ts} +16 -1
- package/dist/format.d.ts +34 -1
- package/dist/format.mjs +1 -1
- package/dist/index.d.ts +74 -13
- package/dist/index.mjs +138 -29
- 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/dist/chunk-VKQIRB7F.mjs +0 -116
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';
|
package/package.json
CHANGED
package/dist/chunk-VKQIRB7F.mjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { useNajmPreferencesContext } from './chunk-USZUOJMK.mjs';
|
|
2
|
-
import { humanizeToken, DEFAULT_PLACEHOLDER, formatRelativeTime, formatTime, formatDateTime, formatDate, formatPercent, formatNumber, formatCurrency } from './chunk-GPHWBOSP.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { createContext, useContext, useMemo, useState, useCallback } from 'react';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function normalizeBranding(input) {
|
|
8
|
-
if (!input) return {};
|
|
9
|
-
const value = {};
|
|
10
|
-
const expanded = input.logoExpanded ?? input.sidebarLogoExpandedPath;
|
|
11
|
-
const collapsed = input.logoCollapsed ?? input.sidebarLogoCollapsedPath;
|
|
12
|
-
if (input.appName !== void 0) value.appName = input.appName;
|
|
13
|
-
if (input.logoFallback !== void 0) value.logoFallback = input.logoFallback;
|
|
14
|
-
if (input.logoHref !== void 0) value.logoHref = input.logoHref;
|
|
15
|
-
if (expanded !== void 0) value.logoExpanded = expanded;
|
|
16
|
-
if (collapsed !== void 0) value.logoCollapsed = collapsed;
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
var NBrandingContext = createContext(null);
|
|
20
|
-
function useNBranding() {
|
|
21
|
-
return useContext(NBrandingContext);
|
|
22
|
-
}
|
|
23
|
-
function NBrandingProvider({
|
|
24
|
-
children,
|
|
25
|
-
appName,
|
|
26
|
-
logoExpanded,
|
|
27
|
-
logoCollapsed,
|
|
28
|
-
logoFallback,
|
|
29
|
-
logoHref
|
|
30
|
-
}) {
|
|
31
|
-
const value = useMemo(
|
|
32
|
-
() => ({ appName, logoExpanded, logoCollapsed, logoFallback, logoHref }),
|
|
33
|
-
[appName, logoExpanded, logoCollapsed, logoFallback, logoHref]
|
|
34
|
-
);
|
|
35
|
-
return /* @__PURE__ */ jsx(NBrandingContext.Provider, { value, children });
|
|
36
|
-
}
|
|
37
|
-
var NBrandingEditorContext = createContext(null);
|
|
38
|
-
function useNBrandingEditor() {
|
|
39
|
-
return useContext(NBrandingEditorContext);
|
|
40
|
-
}
|
|
41
|
-
function NBrandingStateProvider({
|
|
42
|
-
children,
|
|
43
|
-
branding,
|
|
44
|
-
initialBranding
|
|
45
|
-
}) {
|
|
46
|
-
const [state, setState] = useState(
|
|
47
|
-
() => normalizeBranding(initialBranding ?? branding)
|
|
48
|
-
);
|
|
49
|
-
const setBranding = useCallback((patch) => {
|
|
50
|
-
const marks = normalizeBranding(patch);
|
|
51
|
-
setState((current) => ({ ...current, ...marks }));
|
|
52
|
-
}, []);
|
|
53
|
-
const controlled = useMemo(
|
|
54
|
-
() => branding ? normalizeBranding(branding) : void 0,
|
|
55
|
-
[branding]
|
|
56
|
-
);
|
|
57
|
-
const resolved = controlled ?? state;
|
|
58
|
-
const editor = useMemo(
|
|
59
|
-
() => ({ branding: resolved, setBranding: branding ? noop : setBranding }),
|
|
60
|
-
[resolved, branding, setBranding]
|
|
61
|
-
);
|
|
62
|
-
return /* @__PURE__ */ jsx(NBrandingEditorContext.Provider, { value: editor, children: /* @__PURE__ */ jsx(NBrandingProvider, { ...resolved, children }) });
|
|
63
|
-
}
|
|
64
|
-
function noop() {
|
|
65
|
-
}
|
|
66
|
-
var NajmFormatContext = React.createContext(
|
|
67
|
-
null
|
|
68
|
-
);
|
|
69
|
-
function NajmFormatProvider({
|
|
70
|
-
children,
|
|
71
|
-
locale,
|
|
72
|
-
currency,
|
|
73
|
-
timeZone,
|
|
74
|
-
placeholder = DEFAULT_PLACEHOLDER
|
|
75
|
-
}) {
|
|
76
|
-
const preferences = useNajmPreferencesContext();
|
|
77
|
-
const resolvedTimeZone = timeZone ?? preferences?.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
78
|
-
const value = React.useMemo(() => {
|
|
79
|
-
const config = {
|
|
80
|
-
locale,
|
|
81
|
-
timeZone: resolvedTimeZone,
|
|
82
|
-
currency,
|
|
83
|
-
placeholder
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
locale,
|
|
87
|
-
timeZone: resolvedTimeZone,
|
|
88
|
-
currency,
|
|
89
|
-
placeholder,
|
|
90
|
-
config,
|
|
91
|
-
money: (minorUnits) => formatCurrency(minorUnits, config),
|
|
92
|
-
number: (value_, options) => formatNumber(value_, config, options),
|
|
93
|
-
percent: (value_, digits) => formatPercent(value_, config, digits),
|
|
94
|
-
date: (value_, options) => formatDate(value_, config, options),
|
|
95
|
-
dateTime: (value_) => formatDateTime(value_, config),
|
|
96
|
-
time: (value_) => formatTime(value_, config),
|
|
97
|
-
relativeTime: (value_) => formatRelativeTime(value_, config),
|
|
98
|
-
humanize: humanizeToken
|
|
99
|
-
};
|
|
100
|
-
}, [locale, resolvedTimeZone, currency, placeholder]);
|
|
101
|
-
return /* @__PURE__ */ jsx(NajmFormatContext.Provider, { value, children });
|
|
102
|
-
}
|
|
103
|
-
function useNajmFormatContext() {
|
|
104
|
-
return React.useContext(NajmFormatContext);
|
|
105
|
-
}
|
|
106
|
-
function useNajmFormat() {
|
|
107
|
-
const value = React.useContext(NajmFormatContext);
|
|
108
|
-
if (!value) {
|
|
109
|
-
throw new Error(
|
|
110
|
-
"useNajmFormat must be rendered under a NajmFormatProvider or NajmAppProvider."
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return value;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export { NBrandingProvider, NBrandingStateProvider, NajmFormatProvider, normalizeBranding, useNBranding, useNBrandingEditor, useNajmFormat, useNajmFormatContext };
|