nnews-react 0.4.4 → 0.4.9
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/README.md +393 -418
- package/dist/index.cjs +130 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +93 -11
- package/dist/index.js +9679 -7943
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AxiosInstance } from 'axios';
|
|
|
3
3
|
import { ClassProp } from 'class-variance-authority/types';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
import { default as default_2 } from 'react';
|
|
6
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
7
|
import { i18n } from 'i18next';
|
|
7
8
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
8
9
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
@@ -10,7 +11,7 @@ import * as React_2 from 'react';
|
|
|
10
11
|
import { UseTranslationResponse } from 'react-i18next';
|
|
11
12
|
import { VariantProps } from 'class-variance-authority';
|
|
12
13
|
|
|
13
|
-
export declare function AIArticleGenerator({ mode, articleId, isOpen, onSuccess, onClose, }: AIArticleGeneratorProps): JSX_2.Element
|
|
14
|
+
export declare function AIArticleGenerator({ mode, articleId, isOpen, onSuccess, onClose, }: AIArticleGeneratorProps): JSX_2.Element;
|
|
14
15
|
|
|
15
16
|
export declare interface AIArticleGeneratorProps {
|
|
16
17
|
mode: 'create' | 'update';
|
|
@@ -52,13 +53,25 @@ export declare class ArticleAPI {
|
|
|
52
53
|
*/
|
|
53
54
|
uploadImage(file: File): Promise<string>;
|
|
54
55
|
/**
|
|
55
|
-
* List articles with optional filtering by category
|
|
56
|
+
* List articles with optional filtering by category and status
|
|
56
57
|
*/
|
|
57
|
-
listArticles(categoryId?: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
58
|
+
listArticles(categoryId?: number, status?: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
+
* List articles by category
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
+
listByCategory(categoryId: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
63
|
+
/**
|
|
64
|
+
* List articles filtered by user roles
|
|
65
|
+
*/
|
|
66
|
+
listByRoles(page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
67
|
+
/**
|
|
68
|
+
* List articles by tag slug
|
|
69
|
+
*/
|
|
70
|
+
listByTag(tagSlug: string, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
71
|
+
/**
|
|
72
|
+
* Search articles by keyword
|
|
73
|
+
*/
|
|
74
|
+
search(keyword: string, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
|
|
62
75
|
/**
|
|
63
76
|
* Get a single article by ID
|
|
64
77
|
*/
|
|
@@ -131,7 +144,7 @@ export declare interface ArticleInput {
|
|
|
131
144
|
roles?: string[];
|
|
132
145
|
}
|
|
133
146
|
|
|
134
|
-
export declare function ArticleList({ articles, loading, error, onArticleClick, onEditClick, onAIClick, showActions, emptyMessage, }: ArticleListProps_2): JSX_2.Element;
|
|
147
|
+
export declare function ArticleList({ articles, loading, error, onArticleClick, onEditClick, onAIClick, onDeleteClick, showActions, emptyMessage, }: ArticleListProps_2): JSX_2.Element;
|
|
135
148
|
|
|
136
149
|
export declare interface ArticleListProps {
|
|
137
150
|
categoryId?: number;
|
|
@@ -152,6 +165,7 @@ declare interface ArticleListProps_2 {
|
|
|
152
165
|
onArticleClick?: (article: Article) => void;
|
|
153
166
|
onEditClick?: (article: Article) => void;
|
|
154
167
|
onAIClick?: (article: Article) => void;
|
|
168
|
+
onDeleteClick?: (article: Article) => void;
|
|
155
169
|
showActions?: boolean;
|
|
156
170
|
emptyMessage?: string;
|
|
157
171
|
}
|
|
@@ -230,9 +244,9 @@ export declare class CategoryAPI {
|
|
|
230
244
|
*/
|
|
231
245
|
listCategories(): Promise<Category[]>;
|
|
232
246
|
/**
|
|
233
|
-
*
|
|
247
|
+
* List categories by parent, optionally filtered by roles
|
|
234
248
|
*/
|
|
235
|
-
|
|
249
|
+
listByParent(roles?: string[], parentId?: number): Promise<Category[]>;
|
|
236
250
|
/**
|
|
237
251
|
* Get a single category by ID
|
|
238
252
|
*/
|
|
@@ -290,7 +304,7 @@ declare interface CategoryListProps_2 {
|
|
|
290
304
|
emptyMessage?: string;
|
|
291
305
|
}
|
|
292
306
|
|
|
293
|
-
export declare function CategoryModal({ category, categories, isOpen, onClose, onSave, loading, }: CategoryModalProps_2): JSX_2.Element
|
|
307
|
+
export declare function CategoryModal({ category, categories, isOpen, onClose, onSave, loading, }: CategoryModalProps_2): JSX_2.Element;
|
|
294
308
|
|
|
295
309
|
export declare interface CategoryModalProps {
|
|
296
310
|
isOpen: boolean;
|
|
@@ -314,6 +328,22 @@ export declare interface CategoryUpdate extends CategoryInput {
|
|
|
314
328
|
|
|
315
329
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
316
330
|
|
|
331
|
+
export declare function ConfirmModal({ open, onOpenChange, onConfirm, title, description, confirmLabel, cancelLabel, variant, loading, }: ConfirmModalProps): JSX_2.Element;
|
|
332
|
+
|
|
333
|
+
export declare interface ConfirmModalProps {
|
|
334
|
+
open: boolean;
|
|
335
|
+
onOpenChange: (open: boolean) => void;
|
|
336
|
+
onConfirm: () => void | Promise<void>;
|
|
337
|
+
title: string;
|
|
338
|
+
description?: string;
|
|
339
|
+
confirmLabel?: string;
|
|
340
|
+
cancelLabel?: string;
|
|
341
|
+
variant?: ConfirmVariant;
|
|
342
|
+
loading?: boolean;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare type ConfirmVariant = "danger" | "warning" | "default";
|
|
346
|
+
|
|
317
347
|
export declare enum ContentType {
|
|
318
348
|
PlainText = 1,
|
|
319
349
|
Html = 2,
|
|
@@ -831,6 +861,37 @@ declare interface MarkdownEditorProps {
|
|
|
831
861
|
minHeight?: string;
|
|
832
862
|
}
|
|
833
863
|
|
|
864
|
+
export declare const Modal: React_2.FC<DialogPrimitive.DialogProps>;
|
|
865
|
+
|
|
866
|
+
export declare const ModalBody: {
|
|
867
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX_2.Element;
|
|
868
|
+
displayName: string;
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
export declare const ModalClose: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
872
|
+
|
|
873
|
+
export declare const ModalContent: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
874
|
+
|
|
875
|
+
export declare const ModalDescription: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
876
|
+
|
|
877
|
+
export declare const ModalFooter: {
|
|
878
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX_2.Element;
|
|
879
|
+
displayName: string;
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
export declare const ModalHeader: {
|
|
883
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX_2.Element;
|
|
884
|
+
displayName: string;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
export declare const ModalOverlay: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
888
|
+
|
|
889
|
+
export declare const ModalPortal: React_2.FC<DialogPrimitive.DialogPortalProps>;
|
|
890
|
+
|
|
891
|
+
export declare const ModalTitle: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React_2.RefAttributes<HTMLHeadingElement>, "ref"> & React_2.RefAttributes<HTMLHeadingElement>>;
|
|
892
|
+
|
|
893
|
+
export declare const ModalTrigger: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
894
|
+
|
|
834
895
|
export declare const NAMESPACE = "nnews";
|
|
835
896
|
|
|
836
897
|
export declare interface NNewsConfig {
|
|
@@ -840,6 +901,7 @@ export declare interface NNewsConfig {
|
|
|
840
901
|
headers?: Record<string, string>;
|
|
841
902
|
language?: string;
|
|
842
903
|
translations?: Record<string, Record<string, unknown>>;
|
|
904
|
+
theme?: NNewsTheme;
|
|
843
905
|
}
|
|
844
906
|
|
|
845
907
|
export declare interface NNewsContextValue {
|
|
@@ -848,6 +910,8 @@ export declare interface NNewsContextValue {
|
|
|
848
910
|
articleApi: ArticleAPI;
|
|
849
911
|
categoryApi: CategoryAPI;
|
|
850
912
|
tagApi: TagAPI;
|
|
913
|
+
theme: NNewsTheme;
|
|
914
|
+
resolvedMode: 'light' | 'dark';
|
|
851
915
|
}
|
|
852
916
|
|
|
853
917
|
export declare function NNewsProvider({ config, children }: NNewsProviderProps): JSX_2.Element;
|
|
@@ -857,6 +921,20 @@ export declare interface NNewsProviderProps {
|
|
|
857
921
|
children: default_2.ReactNode;
|
|
858
922
|
}
|
|
859
923
|
|
|
924
|
+
export declare interface NNewsTheme {
|
|
925
|
+
mode?: NNewsThemeMode;
|
|
926
|
+
classNames?: {
|
|
927
|
+
root?: string;
|
|
928
|
+
card?: string;
|
|
929
|
+
table?: string;
|
|
930
|
+
modal?: string;
|
|
931
|
+
button?: string;
|
|
932
|
+
input?: string;
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
export declare type NNewsThemeMode = 'light' | 'dark' | 'system';
|
|
937
|
+
|
|
860
938
|
declare interface PagedResult<T> {
|
|
861
939
|
items: T[];
|
|
862
940
|
page: number;
|
|
@@ -1072,6 +1150,10 @@ export declare class TagAPI {
|
|
|
1072
1150
|
* List all tags
|
|
1073
1151
|
*/
|
|
1074
1152
|
listTags(): Promise<Tag[]>;
|
|
1153
|
+
/**
|
|
1154
|
+
* List tags filtered by user roles
|
|
1155
|
+
*/
|
|
1156
|
+
listByRoles(): Promise<Tag[]>;
|
|
1075
1157
|
/**
|
|
1076
1158
|
* Get a single tag by ID
|
|
1077
1159
|
*/
|
|
@@ -1121,7 +1203,7 @@ declare interface TagListProps_2 {
|
|
|
1121
1203
|
emptyMessage?: string;
|
|
1122
1204
|
}
|
|
1123
1205
|
|
|
1124
|
-
export declare function TagMerge({ sourceTag, availableTags, isOpen, onClose, onMerge, loading, }: TagMergeProps): JSX_2.Element
|
|
1206
|
+
export declare function TagMerge({ sourceTag, availableTags, isOpen, onClose, onMerge, loading, }: TagMergeProps): JSX_2.Element;
|
|
1125
1207
|
|
|
1126
1208
|
export declare interface TagMergeProps {
|
|
1127
1209
|
sourceTag: Tag;
|
|
@@ -1132,7 +1214,7 @@ export declare interface TagMergeProps {
|
|
|
1132
1214
|
loading?: boolean;
|
|
1133
1215
|
}
|
|
1134
1216
|
|
|
1135
|
-
export declare function TagModal({ tag, isOpen, onClose, onSave, loading, }: TagModalProps_2): JSX_2.Element
|
|
1217
|
+
export declare function TagModal({ tag, isOpen, onClose, onSave, loading, }: TagModalProps_2): JSX_2.Element;
|
|
1136
1218
|
|
|
1137
1219
|
export declare interface TagModalProps {
|
|
1138
1220
|
isOpen: boolean;
|