nnews-react 0.3.10 → 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/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 | null;
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';
@@ -35,6 +36,7 @@ export declare interface Article {
35
36
  imageName?: string;
36
37
  imageUrl?: string;
37
38
  status: ArticleStatus;
39
+ contentType?: ContentType;
38
40
  dateAt?: string | Date;
39
41
  createdAt?: string | Date;
40
42
  updatedAt?: string | Date;
@@ -51,13 +53,25 @@ export declare class ArticleAPI {
51
53
  */
52
54
  uploadImage(file: File): Promise<string>;
53
55
  /**
54
- * List articles with optional filtering by category
56
+ * List articles with optional filtering by category and status
55
57
  */
56
- listArticles(categoryId?: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
58
+ listArticles(categoryId?: number, status?: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
57
59
  /**
58
- * Filter articles by roles and parent category
60
+ * List articles by category
59
61
  */
60
- filterArticles(roles?: string[], parentId?: number, page?: number, pageSize?: number): Promise<PagedResult<Article>>;
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>>;
61
75
  /**
62
76
  * Get a single article by ID
63
77
  */
@@ -123,13 +137,14 @@ export declare interface ArticleInput {
123
137
  content: string;
124
138
  imageName?: string;
125
139
  status: ArticleStatus;
140
+ contentType?: ContentType;
126
141
  categoryId?: number;
127
142
  dateAt?: string | Date;
128
143
  tagList?: string;
129
144
  roles?: string[];
130
145
  }
131
146
 
132
- 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;
133
148
 
134
149
  export declare interface ArticleListProps {
135
150
  categoryId?: number;
@@ -150,6 +165,7 @@ declare interface ArticleListProps_2 {
150
165
  onArticleClick?: (article: Article) => void;
151
166
  onEditClick?: (article: Article) => void;
152
167
  onAIClick?: (article: Article) => void;
168
+ onDeleteClick?: (article: Article) => void;
153
169
  showActions?: boolean;
154
170
  emptyMessage?: string;
155
171
  }
@@ -228,9 +244,9 @@ export declare class CategoryAPI {
228
244
  */
229
245
  listCategories(): Promise<Category[]>;
230
246
  /**
231
- * Filter categories by roles and parent category
247
+ * List categories by parent, optionally filtered by roles
232
248
  */
233
- filterCategories(roles?: string[], parentId?: number): Promise<Category[]>;
249
+ listByParent(roles?: string[], parentId?: number): Promise<Category[]>;
234
250
  /**
235
251
  * Get a single category by ID
236
252
  */
@@ -288,7 +304,7 @@ declare interface CategoryListProps_2 {
288
304
  emptyMessage?: string;
289
305
  }
290
306
 
291
- export declare function CategoryModal({ category, categories, isOpen, onClose, onSave, loading, }: CategoryModalProps_2): JSX_2.Element | null;
307
+ export declare function CategoryModal({ category, categories, isOpen, onClose, onSave, loading, }: CategoryModalProps_2): JSX_2.Element;
292
308
 
293
309
  export declare interface CategoryModalProps {
294
310
  isOpen: boolean;
@@ -312,6 +328,28 @@ export declare interface CategoryUpdate extends CategoryInput {
312
328
 
313
329
  export declare function cn(...inputs: ClassValue[]): string;
314
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
+
347
+ export declare enum ContentType {
348
+ PlainText = 1,
349
+ Html = 2,
350
+ MarkDown = 3
351
+ }
352
+
315
353
  export declare function createI18nInstance(language?: string, customTranslations?: Record<string, Record<string, unknown>>): i18n;
316
354
 
317
355
  /**
@@ -369,6 +407,10 @@ export declare const defaultTranslations: {
369
407
  statusArchived: string;
370
408
  statusScheduled: string;
371
409
  statusReview: string;
410
+ contentType: string;
411
+ contentTypePlainText: string;
412
+ contentTypeHtml: string;
413
+ contentTypeMarkDown: string;
372
414
  featuredImage: string;
373
415
  uploading: string;
374
416
  imageHint: string;
@@ -521,6 +563,10 @@ export declare const defaultTranslations: {
521
563
  statusArchived: string;
522
564
  statusScheduled: string;
523
565
  statusReview: string;
566
+ contentType: string;
567
+ contentTypePlainText: string;
568
+ contentTypeHtml: string;
569
+ contentTypeMarkDown: string;
524
570
  featuredImage: string;
525
571
  uploading: string;
526
572
  imageHint: string;
@@ -675,6 +721,10 @@ export declare const enTranslations: {
675
721
  statusArchived: string;
676
722
  statusScheduled: string;
677
723
  statusReview: string;
724
+ contentType: string;
725
+ contentTypePlainText: string;
726
+ contentTypeHtml: string;
727
+ contentTypeMarkDown: string;
678
728
  featuredImage: string;
679
729
  uploading: string;
680
730
  imageHint: string;
@@ -811,6 +861,37 @@ declare interface MarkdownEditorProps {
811
861
  minHeight?: string;
812
862
  }
813
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
+
814
895
  export declare const NAMESPACE = "nnews";
815
896
 
816
897
  export declare interface NNewsConfig {
@@ -820,6 +901,7 @@ export declare interface NNewsConfig {
820
901
  headers?: Record<string, string>;
821
902
  language?: string;
822
903
  translations?: Record<string, Record<string, unknown>>;
904
+ theme?: NNewsTheme;
823
905
  }
824
906
 
825
907
  export declare interface NNewsContextValue {
@@ -828,6 +910,8 @@ export declare interface NNewsContextValue {
828
910
  articleApi: ArticleAPI;
829
911
  categoryApi: CategoryAPI;
830
912
  tagApi: TagAPI;
913
+ theme: NNewsTheme;
914
+ resolvedMode: 'light' | 'dark';
831
915
  }
832
916
 
833
917
  export declare function NNewsProvider({ config, children }: NNewsProviderProps): JSX_2.Element;
@@ -837,6 +921,20 @@ export declare interface NNewsProviderProps {
837
921
  children: default_2.ReactNode;
838
922
  }
839
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
+
840
938
  declare interface PagedResult<T> {
841
939
  items: T[];
842
940
  page: number;
@@ -905,6 +1003,10 @@ export declare const ptTranslations: {
905
1003
  statusArchived: string;
906
1004
  statusScheduled: string;
907
1005
  statusReview: string;
1006
+ contentType: string;
1007
+ contentTypePlainText: string;
1008
+ contentTypeHtml: string;
1009
+ contentTypeMarkDown: string;
908
1010
  featuredImage: string;
909
1011
  uploading: string;
910
1012
  imageHint: string;
@@ -1048,6 +1150,10 @@ export declare class TagAPI {
1048
1150
  * List all tags
1049
1151
  */
1050
1152
  listTags(): Promise<Tag[]>;
1153
+ /**
1154
+ * List tags filtered by user roles
1155
+ */
1156
+ listByRoles(): Promise<Tag[]>;
1051
1157
  /**
1052
1158
  * Get a single tag by ID
1053
1159
  */
@@ -1097,7 +1203,7 @@ declare interface TagListProps_2 {
1097
1203
  emptyMessage?: string;
1098
1204
  }
1099
1205
 
1100
- export declare function TagMerge({ sourceTag, availableTags, isOpen, onClose, onMerge, loading, }: TagMergeProps): JSX_2.Element | null;
1206
+ export declare function TagMerge({ sourceTag, availableTags, isOpen, onClose, onMerge, loading, }: TagMergeProps): JSX_2.Element;
1101
1207
 
1102
1208
  export declare interface TagMergeProps {
1103
1209
  sourceTag: Tag;
@@ -1108,7 +1214,7 @@ export declare interface TagMergeProps {
1108
1214
  loading?: boolean;
1109
1215
  }
1110
1216
 
1111
- export declare function TagModal({ tag, isOpen, onClose, onSave, loading, }: TagModalProps_2): JSX_2.Element | null;
1217
+ export declare function TagModal({ tag, isOpen, onClose, onSave, loading, }: TagModalProps_2): JSX_2.Element;
1112
1218
 
1113
1219
  export declare interface TagModalProps {
1114
1220
  isOpen: boolean;