@prismicio/react 2.0.6 → 2.1.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/README.md +1 -1
- package/dist/index.cjs +9 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +171 -34
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/package.json +24 -23
- package/src/PrismicLink.tsx +43 -2
- package/src/PrismicRichText.tsx +3 -3
- package/src/PrismicText.tsx +9 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ import * as prismicT from '@prismicio/types';
|
|
|
5
5
|
import * as prismicR from '@prismicio/richtext';
|
|
6
6
|
export { Element } from '@prismicio/richtext';
|
|
7
7
|
|
|
8
|
+
declare module "react" {
|
|
9
|
+
function forwardRef<T, P = Record<string, never>>(render: (props: P, ref: React.Ref<T>) => JSX.Element | null): (props: P & React.RefAttributes<T>) => JSX.Element | null;
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* Props provided to a component when rendered with `<PrismicLink>`.
|
|
10
13
|
*/
|
|
@@ -84,22 +87,7 @@ declare type PrismicLinkProps<InternalComponent extends React.ElementType<LinkPr
|
|
|
84
87
|
*/
|
|
85
88
|
href: string | null | undefined;
|
|
86
89
|
});
|
|
87
|
-
|
|
88
|
-
* React component that renders a link from a Prismic Link field.
|
|
89
|
-
*
|
|
90
|
-
* Different components can be rendered depending on whether the link is
|
|
91
|
-
* internal or external. This is helpful when integrating with client-side
|
|
92
|
-
* routers, such as a router-specific Link component.
|
|
93
|
-
*
|
|
94
|
-
* If a link is configured to open in a new window using `target="_blank"`,
|
|
95
|
-
* `rel="noopener noreferrer"` is set by default.
|
|
96
|
-
*
|
|
97
|
-
* @param props - Props for the component.
|
|
98
|
-
*
|
|
99
|
-
* @returns The internal or external link component depending on whether the
|
|
100
|
-
* link is internal or external.
|
|
101
|
-
*/
|
|
102
|
-
declare const PrismicLink: <InternalComponent extends React.ElementType<LinkProps> = "a", ExternalComponent extends React.ElementType<LinkProps> = "a", LinkResolverFunction extends prismicH.LinkResolverFunction<string> = prismicH.LinkResolverFunction<string>>(props: PrismicLinkProps<InternalComponent, ExternalComponent, LinkResolverFunction>) => JSX.Element | null;
|
|
90
|
+
declare const PrismicLink: <InternalComponent extends React.ElementType<LinkProps> = "a", ExternalComponent extends React.ElementType<LinkProps> = "a", LinkResolverFunction extends prismicH.LinkResolverFunction<string> = prismicH.LinkResolverFunction<string>, Ref extends (InternalComponent extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[InternalComponent] : any) | (ExternalComponent extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ExternalComponent] : any) = (InternalComponent extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[InternalComponent] : any) | (ExternalComponent extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ExternalComponent] : any)>(props: PrismicLinkProps<InternalComponent, ExternalComponent, LinkResolverFunction> & React.RefAttributes<Ref>) => JSX.Element | null;
|
|
103
91
|
|
|
104
92
|
/**
|
|
105
93
|
* A function mapping Rich Text block types to React Components. It is used to
|
|
@@ -219,6 +207,11 @@ declare type PrismicTextProps = {
|
|
|
219
207
|
* The Prismic Rich Text field to render.
|
|
220
208
|
*/
|
|
221
209
|
field: prismicT.RichTextField | null | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* The string rendered when the field is empty. If a fallback is not given,
|
|
212
|
+
* `null` will be rendered.
|
|
213
|
+
*/
|
|
214
|
+
fallback?: string;
|
|
222
215
|
/**
|
|
223
216
|
* The separator used between blocks. Defaults to `\n`.
|
|
224
217
|
*/
|
|
@@ -625,7 +618,15 @@ declare const usePrismicPreviewResolver: (args?: UsePrismicPreviewResolverArgs)
|
|
|
625
618
|
*
|
|
626
619
|
* @see Underlying `@prismicio/client` method {@link proto.get}
|
|
627
620
|
*/
|
|
628
|
-
declare const usePrismicDocuments: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
621
|
+
declare const usePrismicDocuments: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
622
|
+
signal?: {
|
|
623
|
+
aborted: any;
|
|
624
|
+
addEventListener: any;
|
|
625
|
+
removeEventListener: any;
|
|
626
|
+
dispatchEvent: any;
|
|
627
|
+
onabort: any;
|
|
628
|
+
} | undefined;
|
|
629
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
629
630
|
/**
|
|
630
631
|
* A hook that queries content from the Prismic repository and returns only the
|
|
631
632
|
* first result, if any.
|
|
@@ -641,7 +642,15 @@ declare const usePrismicDocuments: <TDocument extends prismicT.PrismicDocument<R
|
|
|
641
642
|
*
|
|
642
643
|
* @see Underlying `@prismicio/client` method {@link proto.getFirst}
|
|
643
644
|
*/
|
|
644
|
-
declare const useFirstPrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
645
|
+
declare const useFirstPrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
646
|
+
signal?: {
|
|
647
|
+
aborted: any;
|
|
648
|
+
addEventListener: any;
|
|
649
|
+
removeEventListener: any;
|
|
650
|
+
dispatchEvent: any;
|
|
651
|
+
onabort: any;
|
|
652
|
+
} | undefined;
|
|
653
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
|
|
645
654
|
/**
|
|
646
655
|
* A hook that queries content from the Prismic repository and returns all
|
|
647
656
|
* matching content. If no predicates are provided, all documents will be fetched.
|
|
@@ -657,8 +666,16 @@ declare const useFirstPrismicDocument: <TDocument extends prismicT.PrismicDocume
|
|
|
657
666
|
*
|
|
658
667
|
* @see Underlying `@prismicio/client` method {@link proto.getAll}
|
|
659
668
|
*/
|
|
660
|
-
declare const useAllPrismicDocumentsDangerously: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
669
|
+
declare const useAllPrismicDocumentsDangerously: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
|
|
661
670
|
limit?: number | undefined;
|
|
671
|
+
} & {
|
|
672
|
+
signal?: {
|
|
673
|
+
aborted: any;
|
|
674
|
+
addEventListener: any;
|
|
675
|
+
removeEventListener: any;
|
|
676
|
+
dispatchEvent: any;
|
|
677
|
+
onabort: any;
|
|
678
|
+
} | undefined;
|
|
662
679
|
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
663
680
|
/**
|
|
664
681
|
* A hook that queries a document from the Prismic repository with a specific ID.
|
|
@@ -675,7 +692,15 @@ declare const useAllPrismicDocumentsDangerously: <TDocument extends prismicT.Pri
|
|
|
675
692
|
*
|
|
676
693
|
* @see Underlying `@prismicio/client` method {@link proto.getByID}
|
|
677
694
|
*/
|
|
678
|
-
declare const usePrismicDocumentByID: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
695
|
+
declare const usePrismicDocumentByID: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string, params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
696
|
+
signal?: {
|
|
697
|
+
aborted: any;
|
|
698
|
+
addEventListener: any;
|
|
699
|
+
removeEventListener: any;
|
|
700
|
+
dispatchEvent: any;
|
|
701
|
+
onabort: any;
|
|
702
|
+
} | undefined;
|
|
703
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
|
|
679
704
|
/**
|
|
680
705
|
* A hook that queries documents from the Prismic repository with specific IDs.
|
|
681
706
|
*
|
|
@@ -691,7 +716,15 @@ declare const usePrismicDocumentByID: <TDocument extends prismicT.PrismicDocumen
|
|
|
691
716
|
*
|
|
692
717
|
* @see Underlying `@prismicio/client` method {@link proto.getByIDs}
|
|
693
718
|
*/
|
|
694
|
-
declare const usePrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
719
|
+
declare const usePrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
720
|
+
signal?: {
|
|
721
|
+
aborted: any;
|
|
722
|
+
addEventListener: any;
|
|
723
|
+
removeEventListener: any;
|
|
724
|
+
dispatchEvent: any;
|
|
725
|
+
onabort: any;
|
|
726
|
+
} | undefined;
|
|
727
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
695
728
|
/**
|
|
696
729
|
* A hook that queries all documents from the Prismic repository with specific IDs.
|
|
697
730
|
*
|
|
@@ -707,7 +740,15 @@ declare const usePrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocum
|
|
|
707
740
|
*
|
|
708
741
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}
|
|
709
742
|
*/
|
|
710
|
-
declare const useAllPrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
743
|
+
declare const useAllPrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
744
|
+
signal?: {
|
|
745
|
+
aborted: any;
|
|
746
|
+
addEventListener: any;
|
|
747
|
+
removeEventListener: any;
|
|
748
|
+
dispatchEvent: any;
|
|
749
|
+
onabort: any;
|
|
750
|
+
} | undefined;
|
|
751
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
711
752
|
/**
|
|
712
753
|
* A hook that queries a document from the Prismic repository with a specific
|
|
713
754
|
* UID and Custom Type.
|
|
@@ -725,7 +766,15 @@ declare const useAllPrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDo
|
|
|
725
766
|
*
|
|
726
767
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
727
768
|
*/
|
|
728
|
-
declare const usePrismicDocumentByUID: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
769
|
+
declare const usePrismicDocumentByUID: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, uid: string, params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
770
|
+
signal?: {
|
|
771
|
+
aborted: any;
|
|
772
|
+
addEventListener: any;
|
|
773
|
+
removeEventListener: any;
|
|
774
|
+
dispatchEvent: any;
|
|
775
|
+
onabort: any;
|
|
776
|
+
} | undefined;
|
|
777
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
|
|
729
778
|
/**
|
|
730
779
|
* A hook that queries documents from the Prismic repository with specific UIDs
|
|
731
780
|
* of a Custom Type.
|
|
@@ -743,7 +792,15 @@ declare const usePrismicDocumentByUID: <TDocument extends prismicT.PrismicDocume
|
|
|
743
792
|
*
|
|
744
793
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
745
794
|
*/
|
|
746
|
-
declare const usePrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
795
|
+
declare const usePrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, uids: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
796
|
+
signal?: {
|
|
797
|
+
aborted: any;
|
|
798
|
+
addEventListener: any;
|
|
799
|
+
removeEventListener: any;
|
|
800
|
+
dispatchEvent: any;
|
|
801
|
+
onabort: any;
|
|
802
|
+
} | undefined;
|
|
803
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
747
804
|
/**
|
|
748
805
|
* A hook that queries all documents from the Prismic repository with specific
|
|
749
806
|
* UIDs of a Custom Type.
|
|
@@ -761,7 +818,15 @@ declare const usePrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocu
|
|
|
761
818
|
*
|
|
762
819
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
763
820
|
*/
|
|
764
|
-
declare const useAllPrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
821
|
+
declare const useAllPrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, uids: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
822
|
+
signal?: {
|
|
823
|
+
aborted: any;
|
|
824
|
+
addEventListener: any;
|
|
825
|
+
removeEventListener: any;
|
|
826
|
+
dispatchEvent: any;
|
|
827
|
+
onabort: any;
|
|
828
|
+
} | undefined;
|
|
829
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
765
830
|
/**
|
|
766
831
|
* A hook that queries a singleton document from the Prismic repository for a
|
|
767
832
|
* specific Custom Type.
|
|
@@ -778,7 +843,15 @@ declare const useAllPrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicD
|
|
|
778
843
|
*
|
|
779
844
|
* @see Underlying `@prismicio/client` method {@link proto.getSingle}
|
|
780
845
|
*/
|
|
781
|
-
declare const useSinglePrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
846
|
+
declare const useSinglePrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
847
|
+
signal?: {
|
|
848
|
+
aborted: any;
|
|
849
|
+
addEventListener: any;
|
|
850
|
+
removeEventListener: any;
|
|
851
|
+
dispatchEvent: any;
|
|
852
|
+
onabort: any;
|
|
853
|
+
} | undefined;
|
|
854
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
|
|
782
855
|
/**
|
|
783
856
|
* A hook that queries documents from the Prismic repository for a specific Custom Type.
|
|
784
857
|
*
|
|
@@ -794,7 +867,15 @@ declare const useSinglePrismicDocument: <TDocument extends prismicT.PrismicDocum
|
|
|
794
867
|
*
|
|
795
868
|
* @see Underlying `@prismicio/client` method {@link proto.getByType}
|
|
796
869
|
*/
|
|
797
|
-
declare const usePrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
870
|
+
declare const usePrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
871
|
+
signal?: {
|
|
872
|
+
aborted: any;
|
|
873
|
+
addEventListener: any;
|
|
874
|
+
removeEventListener: any;
|
|
875
|
+
dispatchEvent: any;
|
|
876
|
+
onabort: any;
|
|
877
|
+
} | undefined;
|
|
878
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
798
879
|
/**
|
|
799
880
|
* A hook that queries all documents from the Prismic repository for a specific
|
|
800
881
|
* Custom Type.
|
|
@@ -811,7 +892,15 @@ declare const usePrismicDocumentsByType: <TDocument extends prismicT.PrismicDocu
|
|
|
811
892
|
*
|
|
812
893
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByType}
|
|
813
894
|
*/
|
|
814
|
-
declare const useAllPrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
895
|
+
declare const useAllPrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: string, params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
|
|
896
|
+
signal?: {
|
|
897
|
+
aborted: any;
|
|
898
|
+
addEventListener: any;
|
|
899
|
+
removeEventListener: any;
|
|
900
|
+
dispatchEvent: any;
|
|
901
|
+
onabort: any;
|
|
902
|
+
} | undefined;
|
|
903
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
815
904
|
/**
|
|
816
905
|
* A hook that queries documents from the Prismic repository with a specific tag.
|
|
817
906
|
*
|
|
@@ -827,7 +916,15 @@ declare const useAllPrismicDocumentsByType: <TDocument extends prismicT.PrismicD
|
|
|
827
916
|
*
|
|
828
917
|
* @see Underlying `@prismicio/client` method {@link proto.getByTag}
|
|
829
918
|
*/
|
|
830
|
-
declare const usePrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
919
|
+
declare const usePrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
920
|
+
signal?: {
|
|
921
|
+
aborted: any;
|
|
922
|
+
addEventListener: any;
|
|
923
|
+
removeEventListener: any;
|
|
924
|
+
dispatchEvent: any;
|
|
925
|
+
onabort: any;
|
|
926
|
+
} | undefined;
|
|
927
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
831
928
|
/**
|
|
832
929
|
* A hook that queries all documents from the Prismic repository with a specific tag.
|
|
833
930
|
*
|
|
@@ -843,7 +940,15 @@ declare const usePrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocum
|
|
|
843
940
|
*
|
|
844
941
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTag}
|
|
845
942
|
*/
|
|
846
|
-
declare const useAllPrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
943
|
+
declare const useAllPrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
|
|
944
|
+
signal?: {
|
|
945
|
+
aborted: any;
|
|
946
|
+
addEventListener: any;
|
|
947
|
+
removeEventListener: any;
|
|
948
|
+
dispatchEvent: any;
|
|
949
|
+
onabort: any;
|
|
950
|
+
} | undefined;
|
|
951
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
847
952
|
/**
|
|
848
953
|
* A hook that queries documents from the Prismic repository with specific tags.
|
|
849
954
|
* A document must be tagged with at least one of the queried tags to be included.
|
|
@@ -860,7 +965,15 @@ declare const useAllPrismicDocumentsByTag: <TDocument extends prismicT.PrismicDo
|
|
|
860
965
|
*
|
|
861
966
|
* @see Underlying `@prismicio/client` method {@link proto.getByTags}
|
|
862
967
|
*/
|
|
863
|
-
declare const usePrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
968
|
+
declare const usePrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
969
|
+
signal?: {
|
|
970
|
+
aborted: any;
|
|
971
|
+
addEventListener: any;
|
|
972
|
+
removeEventListener: any;
|
|
973
|
+
dispatchEvent: any;
|
|
974
|
+
onabort: any;
|
|
975
|
+
} | undefined;
|
|
976
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
864
977
|
/**
|
|
865
978
|
* A hook that queries all documents from the Prismic repository with specific
|
|
866
979
|
* tags. A document must be tagged with at least one of the queried tags to be included.
|
|
@@ -877,7 +990,15 @@ declare const usePrismicDocumentsBySomeTags: <TDocument extends prismicT.Prismic
|
|
|
877
990
|
*
|
|
878
991
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
|
|
879
992
|
*/
|
|
880
|
-
declare const useAllPrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
993
|
+
declare const useAllPrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
|
|
994
|
+
signal?: {
|
|
995
|
+
aborted: any;
|
|
996
|
+
addEventListener: any;
|
|
997
|
+
removeEventListener: any;
|
|
998
|
+
dispatchEvent: any;
|
|
999
|
+
onabort: any;
|
|
1000
|
+
} | undefined;
|
|
1001
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
881
1002
|
/**
|
|
882
1003
|
* A hook that queries documents from the Prismic repository with specific tags.
|
|
883
1004
|
* A document must be tagged with all of the queried tags to be included.
|
|
@@ -894,7 +1015,15 @@ declare const useAllPrismicDocumentsBySomeTags: <TDocument extends prismicT.Pris
|
|
|
894
1015
|
*
|
|
895
1016
|
* @see Underlying `@prismicio/client` method {@link proto.getByTags}
|
|
896
1017
|
*/
|
|
897
|
-
declare const usePrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
1018
|
+
declare const usePrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
|
|
1019
|
+
signal?: {
|
|
1020
|
+
aborted: any;
|
|
1021
|
+
addEventListener: any;
|
|
1022
|
+
removeEventListener: any;
|
|
1023
|
+
dispatchEvent: any;
|
|
1024
|
+
onabort: any;
|
|
1025
|
+
} | undefined;
|
|
1026
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
|
|
898
1027
|
/**
|
|
899
1028
|
* A hook that queries all documents from the Prismic repository with specific
|
|
900
1029
|
* tags. A document must be tagged with all of the queried tags to be included.
|
|
@@ -911,7 +1040,15 @@ declare const usePrismicDocumentsByEveryTag: <TDocument extends prismicT.Prismic
|
|
|
911
1040
|
*
|
|
912
1041
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
|
|
913
1042
|
*/
|
|
914
|
-
declare const useAllPrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string,
|
|
1043
|
+
declare const useAllPrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
|
|
1044
|
+
signal?: {
|
|
1045
|
+
aborted: any;
|
|
1046
|
+
addEventListener: any;
|
|
1047
|
+
removeEventListener: any;
|
|
1048
|
+
dispatchEvent: any;
|
|
1049
|
+
onabort: any;
|
|
1050
|
+
} | undefined;
|
|
1051
|
+
} & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
|
|
915
1052
|
|
|
916
1053
|
/**
|
|
917
1054
|
* @deprecated Renamed to `Element` (without an "s").
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ const isInternalURL = (url) => {
|
|
|
66
66
|
|
|
67
67
|
const defaultInternalComponent = "a";
|
|
68
68
|
const defaultExternalComponent = "a";
|
|
69
|
-
const
|
|
69
|
+
const _PrismicLink = (props, ref) => {
|
|
70
70
|
const context = usePrismicContext();
|
|
71
71
|
const linkResolver = props.linkResolver || context.linkResolver;
|
|
72
72
|
let href;
|
|
@@ -98,21 +98,23 @@ const PrismicLink = (props) => {
|
|
|
98
98
|
}
|
|
99
99
|
return href ? /* @__PURE__ */ React.createElement(Component, {
|
|
100
100
|
...passthroughProps,
|
|
101
|
+
ref,
|
|
101
102
|
href,
|
|
102
103
|
target,
|
|
103
104
|
rel
|
|
104
105
|
}) : null;
|
|
105
106
|
};
|
|
107
|
+
const PrismicLink = React.forwardRef(_PrismicLink);
|
|
106
108
|
|
|
107
109
|
const PrismicText = (props) => {
|
|
108
110
|
return React.useMemo(() => {
|
|
109
|
-
if (props.field) {
|
|
111
|
+
if (prismicH.isFilled.richText(props.field)) {
|
|
110
112
|
const text = prismicH.asText(props.field, props.separator);
|
|
111
113
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, text);
|
|
112
114
|
} else {
|
|
113
|
-
return null;
|
|
115
|
+
return props.fallback != null ? /* @__PURE__ */ React.createElement(React.Fragment, null, props.fallback) : null;
|
|
114
116
|
}
|
|
115
|
-
}, [props.field, props.separator]);
|
|
117
|
+
}, [props.field, props.fallback, props.separator]);
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
const createDefaultSerializer = (args) => prismicR.wrapMapSerializer({
|
|
@@ -218,9 +220,7 @@ const createDefaultSerializer = (args) => prismicR.wrapMapSerializer({
|
|
|
218
220
|
const PrismicRichText = (props) => {
|
|
219
221
|
const context = usePrismicContext();
|
|
220
222
|
return React.useMemo(() => {
|
|
221
|
-
if (
|
|
222
|
-
return null;
|
|
223
|
-
} else {
|
|
223
|
+
if (prismicH.isFilled.richText(props.field)) {
|
|
224
224
|
const linkResolver = props.linkResolver || context.linkResolver;
|
|
225
225
|
const serializer = prismicR.composeSerializers(typeof props.components === "object" ? prismicR.wrapMapSerializer(props.components) : props.components, typeof context.richTextComponents === "object" ? prismicR.wrapMapSerializer(context.richTextComponents) : context.richTextComponents, createDefaultSerializer({
|
|
226
226
|
linkResolver,
|
|
@@ -236,6 +236,8 @@ const PrismicRichText = (props) => {
|
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, serialized);
|
|
239
|
+
} else {
|
|
240
|
+
return null;
|
|
239
241
|
}
|
|
240
242
|
}, [
|
|
241
243
|
props.field,
|