@prismicio/react 2.0.0-beta.5 → 2.0.0-beta.6
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.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +113 -15
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PrismicRichText.tsx +13 -12
- package/src/PrismicText.tsx +2 -1
- package/src/SliceZone.tsx +68 -1
- package/src/clientHooks.ts +54 -0
- package/src/index.ts +1 -0
- package/src/useStatefulPrismicClientMethod.ts +1 -0
package/src/clientHooks.ts
CHANGED
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
14
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
15
|
+
*
|
|
15
16
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
17
|
+
*
|
|
16
18
|
* @param params - Parameters to filter, sort, and paginate results
|
|
17
19
|
*
|
|
18
20
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
21
|
+
*
|
|
19
22
|
* @see Underlying `@prismicio/client` method {@link proto.get}
|
|
20
23
|
*/
|
|
21
24
|
export const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(
|
|
@@ -29,10 +32,13 @@ export const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(
|
|
|
29
32
|
*
|
|
30
33
|
* @remarks
|
|
31
34
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
35
|
+
*
|
|
32
36
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
37
|
+
*
|
|
33
38
|
* @param params - Parameters to filter, sort, and paginate results
|
|
34
39
|
*
|
|
35
40
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
41
|
+
*
|
|
36
42
|
* @see Underlying `@prismicio/client` method {@link proto.getFirst}
|
|
37
43
|
*/
|
|
38
44
|
export const useFirstPrismicDocument = <
|
|
@@ -48,10 +54,13 @@ export const useFirstPrismicDocument = <
|
|
|
48
54
|
*
|
|
49
55
|
* @remarks
|
|
50
56
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
57
|
+
*
|
|
51
58
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
59
|
+
*
|
|
52
60
|
* @param params - Parameters to filter and sort results
|
|
53
61
|
*
|
|
54
62
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
63
|
+
*
|
|
55
64
|
* @see Underlying `@prismicio/client` method {@link proto.getAll}
|
|
56
65
|
*/
|
|
57
66
|
export const useAllPrismicDocumentsDangerously = <
|
|
@@ -69,11 +78,14 @@ export const useAllPrismicDocumentsDangerously = <
|
|
|
69
78
|
*
|
|
70
79
|
* @remarks
|
|
71
80
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
81
|
+
*
|
|
72
82
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
83
|
+
*
|
|
73
84
|
* @param id - ID of the document
|
|
74
85
|
* @param params - Parameters to filter, sort, and paginate results
|
|
75
86
|
*
|
|
76
87
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
88
|
+
*
|
|
77
89
|
* @see Underlying `@prismicio/client` method {@link proto.getByID}
|
|
78
90
|
*/
|
|
79
91
|
export const usePrismicDocumentByID = <
|
|
@@ -91,11 +103,14 @@ export const usePrismicDocumentByID = <
|
|
|
91
103
|
*
|
|
92
104
|
* @remarks
|
|
93
105
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
106
|
+
*
|
|
94
107
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
108
|
+
*
|
|
95
109
|
* @param ids - A list of document IDs
|
|
96
110
|
* @param params - Parameters to filter, sort, and paginate results
|
|
97
111
|
*
|
|
98
112
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
113
|
+
*
|
|
99
114
|
* @see Underlying `@prismicio/client` method {@link proto.getByIDs}
|
|
100
115
|
*/
|
|
101
116
|
export const usePrismicDocumentsByIDs = <
|
|
@@ -113,11 +128,14 @@ export const usePrismicDocumentsByIDs = <
|
|
|
113
128
|
*
|
|
114
129
|
* @remarks
|
|
115
130
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
131
|
+
*
|
|
116
132
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
133
|
+
*
|
|
117
134
|
* @param ids - A list of document IDs
|
|
118
135
|
* @param params - Parameters to filter and sort results
|
|
119
136
|
*
|
|
120
137
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
138
|
+
*
|
|
121
139
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}
|
|
122
140
|
*/
|
|
123
141
|
export const useAllPrismicDocumentsByIDs = <
|
|
@@ -136,12 +154,15 @@ export const useAllPrismicDocumentsByIDs = <
|
|
|
136
154
|
*
|
|
137
155
|
* @remarks
|
|
138
156
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
157
|
+
*
|
|
139
158
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
159
|
+
*
|
|
140
160
|
* @param documentType - The API ID of the document's Custom Type
|
|
141
161
|
* @param uid - UID of the document
|
|
142
162
|
* @param params - Parameters to filter, sort, and paginate results
|
|
143
163
|
*
|
|
144
164
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
165
|
+
*
|
|
145
166
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
146
167
|
*/
|
|
147
168
|
export const usePrismicDocumentByUID = <
|
|
@@ -161,12 +182,15 @@ export const usePrismicDocumentByUID = <
|
|
|
161
182
|
*
|
|
162
183
|
* @remarks
|
|
163
184
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
185
|
+
*
|
|
164
186
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
187
|
+
*
|
|
165
188
|
* @param documentType - The API ID of the document's Custom Type
|
|
166
189
|
* @param uids - A list of document UIDs.
|
|
167
190
|
* @param params - Parameters to filter, sort, and paginate results
|
|
168
191
|
*
|
|
169
192
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
193
|
+
*
|
|
170
194
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
171
195
|
*/
|
|
172
196
|
export const usePrismicDocumentsByUIDs = <
|
|
@@ -186,12 +210,15 @@ export const usePrismicDocumentsByUIDs = <
|
|
|
186
210
|
*
|
|
187
211
|
* @remarks
|
|
188
212
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
213
|
+
*
|
|
189
214
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
215
|
+
*
|
|
190
216
|
* @param documentType - The API ID of the document's Custom Type
|
|
191
217
|
* @param uids - A list of document UIDs.
|
|
192
218
|
* @param params - Parameters to filter, sort, and paginate results
|
|
193
219
|
*
|
|
194
220
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
221
|
+
*
|
|
195
222
|
* @see Underlying `@prismicio/client` method {@link proto.getByUID}
|
|
196
223
|
*/
|
|
197
224
|
export const useAllPrismicDocumentsByUIDs = <
|
|
@@ -211,11 +238,14 @@ export const useAllPrismicDocumentsByUIDs = <
|
|
|
211
238
|
*
|
|
212
239
|
* @remarks
|
|
213
240
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
241
|
+
*
|
|
214
242
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
243
|
+
*
|
|
215
244
|
* @param documentType - The API ID of the singleton Custom Type
|
|
216
245
|
* @param params - Parameters to filter, sort, and paginate results
|
|
217
246
|
*
|
|
218
247
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
248
|
+
*
|
|
219
249
|
* @see Underlying `@prismicio/client` method {@link proto.getSingle}
|
|
220
250
|
*/
|
|
221
251
|
export const useSinglePrismicDocument = <
|
|
@@ -233,11 +263,14 @@ export const useSinglePrismicDocument = <
|
|
|
233
263
|
*
|
|
234
264
|
* @remarks
|
|
235
265
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
266
|
+
*
|
|
236
267
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
268
|
+
*
|
|
237
269
|
* @param documentType - The API ID of the Custom Type
|
|
238
270
|
* @param params - Parameters to filter, sort, and paginate results
|
|
239
271
|
*
|
|
240
272
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
273
|
+
*
|
|
241
274
|
* @see Underlying `@prismicio/client` method {@link proto.getByType}
|
|
242
275
|
*/
|
|
243
276
|
export const usePrismicDocumentsByType = <
|
|
@@ -256,11 +289,14 @@ export const usePrismicDocumentsByType = <
|
|
|
256
289
|
*
|
|
257
290
|
* @remarks
|
|
258
291
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
292
|
+
*
|
|
259
293
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
294
|
+
*
|
|
260
295
|
* @param documentType - The API ID of the Custom Type
|
|
261
296
|
* @param params - Parameters to filter and sort results
|
|
262
297
|
*
|
|
263
298
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
299
|
+
*
|
|
264
300
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByType}
|
|
265
301
|
*/
|
|
266
302
|
export const useAllPrismicDocumentsByType = <
|
|
@@ -278,11 +314,14 @@ export const useAllPrismicDocumentsByType = <
|
|
|
278
314
|
*
|
|
279
315
|
* @remarks
|
|
280
316
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
317
|
+
*
|
|
281
318
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
319
|
+
*
|
|
282
320
|
* @param tag - The tag that must be included on a document
|
|
283
321
|
* @param params - Parameters to filter, sort, and paginate results
|
|
284
322
|
*
|
|
285
323
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
324
|
+
*
|
|
286
325
|
* @see Underlying `@prismicio/client` method {@link proto.getByTag}
|
|
287
326
|
*/
|
|
288
327
|
export const usePrismicDocumentsByTag = <
|
|
@@ -300,11 +339,14 @@ export const usePrismicDocumentsByTag = <
|
|
|
300
339
|
*
|
|
301
340
|
* @remarks
|
|
302
341
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
342
|
+
*
|
|
303
343
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
344
|
+
*
|
|
304
345
|
* @param tag - The tag that must be included on a document
|
|
305
346
|
* @param params - Parameters to filter and sort results
|
|
306
347
|
*
|
|
307
348
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
349
|
+
*
|
|
308
350
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTag}
|
|
309
351
|
*/
|
|
310
352
|
export const useAllPrismicDocumentsByTag = <
|
|
@@ -323,11 +365,14 @@ export const useAllPrismicDocumentsByTag = <
|
|
|
323
365
|
*
|
|
324
366
|
* @remarks
|
|
325
367
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
368
|
+
*
|
|
326
369
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
370
|
+
*
|
|
327
371
|
* @param tags - A list of tags that must be included on a document
|
|
328
372
|
* @param params - Parameters to filter, sort, and paginate results
|
|
329
373
|
*
|
|
330
374
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
375
|
+
*
|
|
331
376
|
* @see Underlying `@prismicio/client` method {@link proto.getByTags}
|
|
332
377
|
*/
|
|
333
378
|
export const usePrismicDocumentsBySomeTags = <
|
|
@@ -346,11 +391,14 @@ export const usePrismicDocumentsBySomeTags = <
|
|
|
346
391
|
*
|
|
347
392
|
* @remarks
|
|
348
393
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
394
|
+
*
|
|
349
395
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
396
|
+
*
|
|
350
397
|
* @param tags - A list of tags that must be included on a document
|
|
351
398
|
* @param params - Parameters to filter and sort results
|
|
352
399
|
*
|
|
353
400
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
401
|
+
*
|
|
354
402
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
|
|
355
403
|
*/
|
|
356
404
|
export const useAllPrismicDocumentsBySomeTags = <
|
|
@@ -369,11 +417,14 @@ export const useAllPrismicDocumentsBySomeTags = <
|
|
|
369
417
|
*
|
|
370
418
|
* @remarks
|
|
371
419
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
420
|
+
*
|
|
372
421
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
422
|
+
*
|
|
373
423
|
* @param tags - A list of tags that must be included on a document
|
|
374
424
|
* @param params - Parameters to filter, sort, and paginate results
|
|
375
425
|
*
|
|
376
426
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
427
|
+
*
|
|
377
428
|
* @see Underlying `@prismicio/client` method {@link proto.getByTags}
|
|
378
429
|
*/
|
|
379
430
|
export const usePrismicDocumentsByEveryTag = <
|
|
@@ -392,11 +443,14 @@ export const usePrismicDocumentsByEveryTag = <
|
|
|
392
443
|
*
|
|
393
444
|
* @remarks
|
|
394
445
|
* An additional `@prismicio/client` instance can be provided at `params.client`.
|
|
446
|
+
*
|
|
395
447
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
448
|
+
*
|
|
396
449
|
* @param tags - A list of tags that must be included on a document
|
|
397
450
|
* @param params - Parameters to filter and sort results
|
|
398
451
|
*
|
|
399
452
|
* @returns The composable payload {@link ClientHookReturnType}
|
|
453
|
+
*
|
|
400
454
|
* @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
|
|
401
455
|
*/
|
|
402
456
|
export const useAllPrismicDocumentsByEveryTag = <
|
package/src/index.ts
CHANGED