nnews-react 0.3.7 → 0.3.8

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,9 +3,11 @@ 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 { i18n } from 'i18next';
6
7
  import { JSX as JSX_2 } from 'react/jsx-runtime';
7
8
  import * as LabelPrimitive from '@radix-ui/react-label';
8
9
  import * as React_2 from 'react';
10
+ import { UseTranslationResponse } from 'react-i18next';
9
11
  import { VariantProps } from 'class-variance-authority';
10
12
 
11
13
  export declare function AIArticleGenerator({ mode, articleId, isOpen, onSuccess, onClose, }: AIArticleGeneratorProps): JSX_2.Element | null;
@@ -310,11 +312,473 @@ export declare interface CategoryUpdate extends CategoryInput {
310
312
 
311
313
  export declare function cn(...inputs: ClassValue[]): string;
312
314
 
315
+ export declare function createI18nInstance(language?: string, customTranslations?: Record<string, Record<string, unknown>>): i18n;
316
+
313
317
  /**
314
318
  * Debounce function
315
319
  */
316
320
  export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
317
321
 
322
+ export declare const defaultTranslations: {
323
+ en: {
324
+ common: {
325
+ cancel: string;
326
+ save: string;
327
+ saving: string;
328
+ create: string;
329
+ update: string;
330
+ delete: string;
331
+ edit: string;
332
+ back: string;
333
+ close: string;
334
+ loading: string;
335
+ title: string;
336
+ titleRequired: string;
337
+ slug: string;
338
+ actions: string;
339
+ noCategory: string;
340
+ pleaseWait: string;
341
+ };
342
+ validation: {
343
+ titleRequired: string;
344
+ contentRequired: string;
345
+ imageFileType: string;
346
+ imageSizeLimit: string;
347
+ imageUploadFailed: string;
348
+ promptRequired: string;
349
+ promptMinLength: string;
350
+ promptMaxLength: string;
351
+ articleIdRequired: string;
352
+ targetTagRequired: string;
353
+ tagFormatInvalid: string;
354
+ tagEmpty: string;
355
+ tagTooLong: string;
356
+ passwordMinLength: string;
357
+ passwordUppercase: string;
358
+ passwordLowercase: string;
359
+ passwordNumber: string;
360
+ passwordSpecialChar: string;
361
+ };
362
+ articleEditor: {
363
+ enterTitle: string;
364
+ publicationDate: string;
365
+ category: string;
366
+ status: string;
367
+ statusDraft: string;
368
+ statusPublished: string;
369
+ statusArchived: string;
370
+ statusScheduled: string;
371
+ statusReview: string;
372
+ featuredImage: string;
373
+ uploading: string;
374
+ imageHint: string;
375
+ contentLabel: string;
376
+ contentPlaceholder: string;
377
+ tags: string;
378
+ tagsPlaceholder: string;
379
+ tagsHint: string;
380
+ visibility: string;
381
+ visibleToAll: string;
382
+ loadingRoles: string;
383
+ selectRolesHint: string;
384
+ noRolesAvailable: string;
385
+ updateArticle: string;
386
+ createArticle: string;
387
+ preview: string;
388
+ };
389
+ articleList: {
390
+ loadingArticles: string;
391
+ errorLoading: string;
392
+ noArticles: string;
393
+ showingArticles: string;
394
+ aiEdit: string;
395
+ };
396
+ aiGenerator: {
397
+ createTitle: string;
398
+ updateTitle: string;
399
+ createDescription: string;
400
+ updateDescription: string;
401
+ descriptionLabel: string;
402
+ createPlaceholder: string;
403
+ updatePlaceholder: string;
404
+ characterCount: string;
405
+ generateImage: string;
406
+ generateImageHint: string;
407
+ creatingWithAI: string;
408
+ updatingWithAI: string;
409
+ generatingContentImage: string;
410
+ generating: string;
411
+ createWithAI: string;
412
+ updateWithAI: string;
413
+ generationFailed: string;
414
+ };
415
+ categoryList: {
416
+ loadingCategories: string;
417
+ errorLoading: string;
418
+ noCategories: string;
419
+ articles: string;
420
+ parent: string;
421
+ parentId: string;
422
+ };
423
+ categoryModal: {
424
+ editCategory: string;
425
+ createCategory: string;
426
+ enterTitle: string;
427
+ parentCategory: string;
428
+ noneTopLevel: string;
429
+ };
430
+ tagList: {
431
+ loadingTags: string;
432
+ errorLoading: string;
433
+ noTags: string;
434
+ merge: string;
435
+ };
436
+ tagModal: {
437
+ editTag: string;
438
+ createTag: string;
439
+ enterTitle: string;
440
+ slugPlaceholder: string;
441
+ slugHint: string;
442
+ };
443
+ tagMerge: {
444
+ title: string;
445
+ description: string;
446
+ sourceTag: string;
447
+ targetTag: string;
448
+ selectTarget: string;
449
+ targetHint: string;
450
+ noTagsAvailable: string;
451
+ merging: string;
452
+ mergeTags: string;
453
+ };
454
+ markdownEditor: {
455
+ editTab: string;
456
+ previewTab: string;
457
+ placeholder: string;
458
+ nothingToPreview: string;
459
+ syntaxHelp: string;
460
+ heading1: string;
461
+ heading2: string;
462
+ bold: string;
463
+ italic: string;
464
+ link: string;
465
+ image: string;
466
+ bulletList: string;
467
+ numberedList: string;
468
+ inlineCode: string;
469
+ codeBlock: string;
470
+ };
471
+ richTextEditor: {
472
+ placeholder: string;
473
+ };
474
+ };
475
+ pt: {
476
+ common: {
477
+ cancel: string;
478
+ save: string;
479
+ saving: string;
480
+ create: string;
481
+ update: string;
482
+ delete: string;
483
+ edit: string;
484
+ back: string;
485
+ close: string;
486
+ loading: string;
487
+ title: string;
488
+ titleRequired: string;
489
+ slug: string;
490
+ actions: string;
491
+ noCategory: string;
492
+ pleaseWait: string;
493
+ };
494
+ validation: {
495
+ titleRequired: string;
496
+ contentRequired: string;
497
+ imageFileType: string;
498
+ imageSizeLimit: string;
499
+ imageUploadFailed: string;
500
+ promptRequired: string;
501
+ promptMinLength: string;
502
+ promptMaxLength: string;
503
+ articleIdRequired: string;
504
+ targetTagRequired: string;
505
+ tagFormatInvalid: string;
506
+ tagEmpty: string;
507
+ tagTooLong: string;
508
+ passwordMinLength: string;
509
+ passwordUppercase: string;
510
+ passwordLowercase: string;
511
+ passwordNumber: string;
512
+ passwordSpecialChar: string;
513
+ };
514
+ articleEditor: {
515
+ enterTitle: string;
516
+ publicationDate: string;
517
+ category: string;
518
+ status: string;
519
+ statusDraft: string;
520
+ statusPublished: string;
521
+ statusArchived: string;
522
+ statusScheduled: string;
523
+ statusReview: string;
524
+ featuredImage: string;
525
+ uploading: string;
526
+ imageHint: string;
527
+ contentLabel: string;
528
+ contentPlaceholder: string;
529
+ tags: string;
530
+ tagsPlaceholder: string;
531
+ tagsHint: string;
532
+ visibility: string;
533
+ visibleToAll: string;
534
+ loadingRoles: string;
535
+ selectRolesHint: string;
536
+ noRolesAvailable: string;
537
+ updateArticle: string;
538
+ createArticle: string;
539
+ preview: string;
540
+ };
541
+ articleList: {
542
+ loadingArticles: string;
543
+ errorLoading: string;
544
+ noArticles: string;
545
+ showingArticles: string;
546
+ aiEdit: string;
547
+ };
548
+ aiGenerator: {
549
+ createTitle: string;
550
+ updateTitle: string;
551
+ createDescription: string;
552
+ updateDescription: string;
553
+ descriptionLabel: string;
554
+ createPlaceholder: string;
555
+ updatePlaceholder: string;
556
+ characterCount: string;
557
+ generateImage: string;
558
+ generateImageHint: string;
559
+ creatingWithAI: string;
560
+ updatingWithAI: string;
561
+ generatingContentImage: string;
562
+ generating: string;
563
+ createWithAI: string;
564
+ updateWithAI: string;
565
+ generationFailed: string;
566
+ };
567
+ categoryList: {
568
+ loadingCategories: string;
569
+ errorLoading: string;
570
+ noCategories: string;
571
+ articles: string;
572
+ parent: string;
573
+ parentId: string;
574
+ };
575
+ categoryModal: {
576
+ editCategory: string;
577
+ createCategory: string;
578
+ enterTitle: string;
579
+ parentCategory: string;
580
+ noneTopLevel: string;
581
+ };
582
+ tagList: {
583
+ loadingTags: string;
584
+ errorLoading: string;
585
+ noTags: string;
586
+ merge: string;
587
+ };
588
+ tagModal: {
589
+ editTag: string;
590
+ createTag: string;
591
+ enterTitle: string;
592
+ slugPlaceholder: string;
593
+ slugHint: string;
594
+ };
595
+ tagMerge: {
596
+ title: string;
597
+ description: string;
598
+ sourceTag: string;
599
+ targetTag: string;
600
+ selectTarget: string;
601
+ targetHint: string;
602
+ noTagsAvailable: string;
603
+ merging: string;
604
+ mergeTags: string;
605
+ };
606
+ markdownEditor: {
607
+ editTab: string;
608
+ previewTab: string;
609
+ placeholder: string;
610
+ nothingToPreview: string;
611
+ syntaxHelp: string;
612
+ heading1: string;
613
+ heading2: string;
614
+ bold: string;
615
+ italic: string;
616
+ link: string;
617
+ image: string;
618
+ bulletList: string;
619
+ numberedList: string;
620
+ inlineCode: string;
621
+ codeBlock: string;
622
+ };
623
+ richTextEditor: {
624
+ placeholder: string;
625
+ };
626
+ };
627
+ };
628
+
629
+ export declare const enTranslations: {
630
+ common: {
631
+ cancel: string;
632
+ save: string;
633
+ saving: string;
634
+ create: string;
635
+ update: string;
636
+ delete: string;
637
+ edit: string;
638
+ back: string;
639
+ close: string;
640
+ loading: string;
641
+ title: string;
642
+ titleRequired: string;
643
+ slug: string;
644
+ actions: string;
645
+ noCategory: string;
646
+ pleaseWait: string;
647
+ };
648
+ validation: {
649
+ titleRequired: string;
650
+ contentRequired: string;
651
+ imageFileType: string;
652
+ imageSizeLimit: string;
653
+ imageUploadFailed: string;
654
+ promptRequired: string;
655
+ promptMinLength: string;
656
+ promptMaxLength: string;
657
+ articleIdRequired: string;
658
+ targetTagRequired: string;
659
+ tagFormatInvalid: string;
660
+ tagEmpty: string;
661
+ tagTooLong: string;
662
+ passwordMinLength: string;
663
+ passwordUppercase: string;
664
+ passwordLowercase: string;
665
+ passwordNumber: string;
666
+ passwordSpecialChar: string;
667
+ };
668
+ articleEditor: {
669
+ enterTitle: string;
670
+ publicationDate: string;
671
+ category: string;
672
+ status: string;
673
+ statusDraft: string;
674
+ statusPublished: string;
675
+ statusArchived: string;
676
+ statusScheduled: string;
677
+ statusReview: string;
678
+ featuredImage: string;
679
+ uploading: string;
680
+ imageHint: string;
681
+ contentLabel: string;
682
+ contentPlaceholder: string;
683
+ tags: string;
684
+ tagsPlaceholder: string;
685
+ tagsHint: string;
686
+ visibility: string;
687
+ visibleToAll: string;
688
+ loadingRoles: string;
689
+ selectRolesHint: string;
690
+ noRolesAvailable: string;
691
+ updateArticle: string;
692
+ createArticle: string;
693
+ preview: string;
694
+ };
695
+ articleList: {
696
+ loadingArticles: string;
697
+ errorLoading: string;
698
+ noArticles: string;
699
+ showingArticles: string;
700
+ aiEdit: string;
701
+ };
702
+ aiGenerator: {
703
+ createTitle: string;
704
+ updateTitle: string;
705
+ createDescription: string;
706
+ updateDescription: string;
707
+ descriptionLabel: string;
708
+ createPlaceholder: string;
709
+ updatePlaceholder: string;
710
+ characterCount: string;
711
+ generateImage: string;
712
+ generateImageHint: string;
713
+ creatingWithAI: string;
714
+ updatingWithAI: string;
715
+ generatingContentImage: string;
716
+ generating: string;
717
+ createWithAI: string;
718
+ updateWithAI: string;
719
+ generationFailed: string;
720
+ };
721
+ categoryList: {
722
+ loadingCategories: string;
723
+ errorLoading: string;
724
+ noCategories: string;
725
+ articles: string;
726
+ parent: string;
727
+ parentId: string;
728
+ };
729
+ categoryModal: {
730
+ editCategory: string;
731
+ createCategory: string;
732
+ enterTitle: string;
733
+ parentCategory: string;
734
+ noneTopLevel: string;
735
+ };
736
+ tagList: {
737
+ loadingTags: string;
738
+ errorLoading: string;
739
+ noTags: string;
740
+ merge: string;
741
+ };
742
+ tagModal: {
743
+ editTag: string;
744
+ createTag: string;
745
+ enterTitle: string;
746
+ slugPlaceholder: string;
747
+ slugHint: string;
748
+ };
749
+ tagMerge: {
750
+ title: string;
751
+ description: string;
752
+ sourceTag: string;
753
+ targetTag: string;
754
+ selectTarget: string;
755
+ targetHint: string;
756
+ noTagsAvailable: string;
757
+ merging: string;
758
+ mergeTags: string;
759
+ };
760
+ markdownEditor: {
761
+ editTab: string;
762
+ previewTab: string;
763
+ placeholder: string;
764
+ nothingToPreview: string;
765
+ syntaxHelp: string;
766
+ heading1: string;
767
+ heading2: string;
768
+ bold: string;
769
+ italic: string;
770
+ link: string;
771
+ image: string;
772
+ bulletList: string;
773
+ numberedList: string;
774
+ inlineCode: string;
775
+ codeBlock: string;
776
+ };
777
+ richTextEditor: {
778
+ placeholder: string;
779
+ };
780
+ };
781
+
318
782
  /**
319
783
  * Format document (CPF or CNPJ)
320
784
  */
@@ -347,10 +811,14 @@ declare interface MarkdownEditorProps {
347
811
  minHeight?: string;
348
812
  }
349
813
 
814
+ export declare const NAMESPACE = "nnews";
815
+
350
816
  export declare interface NNewsConfig {
351
817
  apiUrl: string;
352
818
  apiClient?: AxiosInstance;
353
819
  headers?: Record<string, string>;
820
+ language?: string;
821
+ translations?: Record<string, Record<string, unknown>>;
354
822
  }
355
823
 
356
824
  export declare interface NNewsContextValue {
@@ -387,6 +855,159 @@ export declare interface PasswordStrength {
387
855
  isValid: boolean;
388
856
  }
389
857
 
858
+ export declare const ptTranslations: {
859
+ common: {
860
+ cancel: string;
861
+ save: string;
862
+ saving: string;
863
+ create: string;
864
+ update: string;
865
+ delete: string;
866
+ edit: string;
867
+ back: string;
868
+ close: string;
869
+ loading: string;
870
+ title: string;
871
+ titleRequired: string;
872
+ slug: string;
873
+ actions: string;
874
+ noCategory: string;
875
+ pleaseWait: string;
876
+ };
877
+ validation: {
878
+ titleRequired: string;
879
+ contentRequired: string;
880
+ imageFileType: string;
881
+ imageSizeLimit: string;
882
+ imageUploadFailed: string;
883
+ promptRequired: string;
884
+ promptMinLength: string;
885
+ promptMaxLength: string;
886
+ articleIdRequired: string;
887
+ targetTagRequired: string;
888
+ tagFormatInvalid: string;
889
+ tagEmpty: string;
890
+ tagTooLong: string;
891
+ passwordMinLength: string;
892
+ passwordUppercase: string;
893
+ passwordLowercase: string;
894
+ passwordNumber: string;
895
+ passwordSpecialChar: string;
896
+ };
897
+ articleEditor: {
898
+ enterTitle: string;
899
+ publicationDate: string;
900
+ category: string;
901
+ status: string;
902
+ statusDraft: string;
903
+ statusPublished: string;
904
+ statusArchived: string;
905
+ statusScheduled: string;
906
+ statusReview: string;
907
+ featuredImage: string;
908
+ uploading: string;
909
+ imageHint: string;
910
+ contentLabel: string;
911
+ contentPlaceholder: string;
912
+ tags: string;
913
+ tagsPlaceholder: string;
914
+ tagsHint: string;
915
+ visibility: string;
916
+ visibleToAll: string;
917
+ loadingRoles: string;
918
+ selectRolesHint: string;
919
+ noRolesAvailable: string;
920
+ updateArticle: string;
921
+ createArticle: string;
922
+ preview: string;
923
+ };
924
+ articleList: {
925
+ loadingArticles: string;
926
+ errorLoading: string;
927
+ noArticles: string;
928
+ showingArticles: string;
929
+ aiEdit: string;
930
+ };
931
+ aiGenerator: {
932
+ createTitle: string;
933
+ updateTitle: string;
934
+ createDescription: string;
935
+ updateDescription: string;
936
+ descriptionLabel: string;
937
+ createPlaceholder: string;
938
+ updatePlaceholder: string;
939
+ characterCount: string;
940
+ generateImage: string;
941
+ generateImageHint: string;
942
+ creatingWithAI: string;
943
+ updatingWithAI: string;
944
+ generatingContentImage: string;
945
+ generating: string;
946
+ createWithAI: string;
947
+ updateWithAI: string;
948
+ generationFailed: string;
949
+ };
950
+ categoryList: {
951
+ loadingCategories: string;
952
+ errorLoading: string;
953
+ noCategories: string;
954
+ articles: string;
955
+ parent: string;
956
+ parentId: string;
957
+ };
958
+ categoryModal: {
959
+ editCategory: string;
960
+ createCategory: string;
961
+ enterTitle: string;
962
+ parentCategory: string;
963
+ noneTopLevel: string;
964
+ };
965
+ tagList: {
966
+ loadingTags: string;
967
+ errorLoading: string;
968
+ noTags: string;
969
+ merge: string;
970
+ };
971
+ tagModal: {
972
+ editTag: string;
973
+ createTag: string;
974
+ enterTitle: string;
975
+ slugPlaceholder: string;
976
+ slugHint: string;
977
+ };
978
+ tagMerge: {
979
+ title: string;
980
+ description: string;
981
+ sourceTag: string;
982
+ targetTag: string;
983
+ selectTarget: string;
984
+ targetHint: string;
985
+ noTagsAvailable: string;
986
+ merging: string;
987
+ mergeTags: string;
988
+ };
989
+ markdownEditor: {
990
+ editTab: string;
991
+ previewTab: string;
992
+ placeholder: string;
993
+ nothingToPreview: string;
994
+ syntaxHelp: string;
995
+ heading1: string;
996
+ heading2: string;
997
+ bold: string;
998
+ italic: string;
999
+ link: string;
1000
+ image: string;
1001
+ bulletList: string;
1002
+ numberedList: string;
1003
+ inlineCode: string;
1004
+ codeBlock: string;
1005
+ };
1006
+ richTextEditor: {
1007
+ placeholder: string;
1008
+ };
1009
+ };
1010
+
390
1011
  export declare function RichTextEditor({ value, onChange, placeholder, error, }: RichTextEditorProps): JSX_2.Element;
391
1012
 
392
1013
  declare interface RichTextEditorProps {
@@ -554,6 +1175,8 @@ export declare interface UseCategoriesResult {
554
1175
 
555
1176
  export declare function useNNews(): NNewsContextValue;
556
1177
 
1178
+ export declare function useNNewsTranslation(): UseTranslationResponse<"nnews", undefined>;
1179
+
557
1180
  export declare function useTags(): UseTagsResult;
558
1181
 
559
1182
  export declare interface UseTagsResult {
@@ -590,6 +1213,7 @@ export declare function validatePasswordStrength(password: string, options?: {
590
1213
  requireLowercase?: boolean;
591
1214
  requireNumbers?: boolean;
592
1215
  requireSpecialChars?: boolean;
1216
+ t?: (key: string, opts?: Record<string, unknown>) => string;
593
1217
  }): PasswordStrength;
594
1218
 
595
1219
  /**
@@ -600,7 +1224,7 @@ export declare function validatePhone(phone: string): boolean;
600
1224
  /**
601
1225
  * Validate AI prompt
602
1226
  */
603
- export declare function validatePrompt(prompt: string): {
1227
+ export declare function validatePrompt(prompt: string, t?: (key: string, opts?: Record<string, unknown>) => string): {
604
1228
  valid: boolean;
605
1229
  error?: string;
606
1230
  };
@@ -608,7 +1232,7 @@ export declare function validatePrompt(prompt: string): {
608
1232
  /**
609
1233
  * Validate tag list string
610
1234
  */
611
- export declare function validateTagList(tagList: string): {
1235
+ export declare function validateTagList(tagList: string, t?: (key: string, opts?: Record<string, unknown>) => string): {
612
1236
  valid: boolean;
613
1237
  error?: string;
614
1238
  tags?: string[];