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