@reblu/site-blocks 0.18.0 → 0.20.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/dist/client.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { DataRequestType, DataRequestInput, DataRequestSubmission } from '@reblu/site-contracts';
4
+ import { ShopProductListItem, AcademyModulePublic, AcademyLessonPublic, DataRequestType, DataRequestInput, DataRequestSubmission } from '@reblu/site-contracts';
5
5
  export { DATA_REQUEST_TYPES } from '@reblu/site-contracts';
6
+ import { H as HeadingLevel } from './_heading-BsNbc1wc.js';
6
7
 
7
8
  /**
8
9
  * `useCollection` — the headless heart of `@reblu/site-blocks`.
@@ -247,6 +248,112 @@ interface CartIconProps {
247
248
  }
248
249
  declare function CartIcon({ itemCount, href, hydrated, bumpOnAdd, labels, className }: CartIconProps): react_jsx_runtime.JSX.Element;
249
250
 
251
+ /**
252
+ * `ProductCarousel` — a horizontal product strip («Productos relacionados»,
253
+ * «También te puede interesar»…) with no carousel dependency.
254
+ *
255
+ * - The track is a native scroll container with CSS scroll-snap, so touch users swipe
256
+ * it and keyboard users scroll it once it has focus (it is a labelled, focusable region).
257
+ * - Previous/next arrows (from `sm` up) scroll by one visible page. They are not rendered
258
+ * when everything fits, and the arrow of the end the track is at is disabled.
259
+ * - Arrow scrolling is instant under `prefers-reduced-motion: reduce`.
260
+ * - Cards: the package's `ProductCard` by default, or the consumer's via `renderProduct`.
261
+ */
262
+ interface ProductCarouselLabels {
263
+ /** Accessible name of the track when there is no `heading`. */
264
+ region: string;
265
+ /** `aria-roledescription` of the track. */
266
+ roleDescription: string;
267
+ previous: string;
268
+ next: string;
269
+ }
270
+ declare const DEFAULT_PRODUCT_CAROUSEL_LABELS: ProductCarouselLabels;
271
+ interface ProductCarouselCommonProps {
272
+ /** Visible heading; when set it also names the track. */
273
+ heading?: string;
274
+ /** Default: 2. */
275
+ headingLevel?: HeadingLevel;
276
+ /** Replaces the heading's typography (see the className rule in the README). */
277
+ headingClassName?: string;
278
+ labels?: Partial<ProductCarouselLabels>;
279
+ className?: string;
280
+ /** Classes for each slide (`<li>`), e.g. a different card width. */
281
+ itemClassName?: string;
282
+ }
283
+ interface ProductCarouselDefaultCardProps extends ProductCarouselCommonProps {
284
+ products: readonly ShopProductListItem[];
285
+ renderProduct?: undefined;
286
+ /** Link target per product (e.g. `(p) => \`/shop/${p.slug}\``). Omit for non-linking cards. */
287
+ productHref?: (product: ShopProductListItem) => string | undefined;
288
+ currencyCode?: string;
289
+ locale?: string;
290
+ }
291
+ interface ProductCarouselCustomCardProps<T extends {
292
+ id: string | number;
293
+ }> extends ProductCarouselCommonProps {
294
+ products: readonly T[];
295
+ /** Renders one slide's card — your own product card. */
296
+ renderProduct: (product: T, index: number) => ReactNode;
297
+ productHref?: undefined;
298
+ currencyCode?: undefined;
299
+ locale?: undefined;
300
+ }
301
+ type ProductCarouselProps<T extends {
302
+ id: string | number;
303
+ } = ShopProductListItem> = ProductCarouselDefaultCardProps | ProductCarouselCustomCardProps<T>;
304
+ declare function ProductCarousel<T extends {
305
+ id: string | number;
306
+ } = ShopProductListItem>(props: ProductCarouselProps<T>): react_jsx_runtime.JSX.Element | null;
307
+
308
+ /**
309
+ * `CourseSyllabus` — the drop-in programme of a public course page, over
310
+ * `AcademyCourseDetail.modules` (`client.academy.bySlug()`), REB-1134.
311
+ *
312
+ * - The header reads the heading, then «N módulos · M lecciones».
313
+ * - Each module with lessons is a `<button>` with `aria-expanded` and
314
+ * `aria-controls`, showing its lesson count and, when every lesson has one,
315
+ * the module's total duration. Expanding it lists the lessons in the order
316
+ * the API returns them, with their duration and the free-preview flag.
317
+ * - A module without lessons is a plain row (title only), never a button.
318
+ *
319
+ * It renders only what the API serves. The API returns published lessons only
320
+ * and no video, playback or attachment data, so nothing here can leak it.
321
+ *
322
+ * Client Component: it holds the open/closed state of each module. Every prop
323
+ * is serialisable (copy is plain strings), so a Server Component page can
324
+ * render it directly.
325
+ */
326
+ interface CourseSyllabusLabels {
327
+ heading: string;
328
+ moduleSingular: string;
329
+ modulePlural: string;
330
+ lessonSingular: string;
331
+ lessonPlural: string;
332
+ /** Badge on a lesson with `isFreePreview`. */
333
+ freePreview: string;
334
+ /** Hours unit in durations («1 h 15 min»). */
335
+ hours: string;
336
+ /** Minutes unit in durations. */
337
+ minutes: string;
338
+ }
339
+ declare const DEFAULT_COURSE_SYLLABUS_LABELS: CourseSyllabusLabels;
340
+ /** A module as served. `lessons` is optional so an older payload still renders. */
341
+ type CourseSyllabusModule = Pick<AcademyModulePublic, 'id' | 'title'> & {
342
+ description?: string | null;
343
+ lessons?: readonly AcademyLessonPublic[];
344
+ };
345
+ interface CourseSyllabusProps {
346
+ /** `AcademyCourseDetail.modules`, in the order the API returns them. */
347
+ modules: readonly CourseSyllabusModule[];
348
+ labels?: Partial<CourseSyllabusLabels>;
349
+ /** Level of the heading. Default `2`. */
350
+ headingLevel?: HeadingLevel;
351
+ /** Replaces the heading's default typography (see the className rule in the README). */
352
+ headingClassName?: string;
353
+ className?: string;
354
+ }
355
+ declare function CourseSyllabus({ modules, labels: labelOverrides, headingLevel, headingClassName, className, }: CourseSyllabusProps): react_jsx_runtime.JSX.Element | null;
356
+
250
357
  /**
251
358
  * `DataRequestForm` — drop-in public GDPR rights form (REB-980) over
252
359
  * `POST /api/site/data-requests` (REB-77). The visitor picks the right they
@@ -326,4 +433,4 @@ interface DataRequestFormProps {
326
433
  }
327
434
  declare function DataRequestForm({ getCaptchaToken, submit, endpoint, onInteract, onSubmitted, requestTypes, labels, locale, className, }: DataRequestFormProps): react_jsx_runtime.JSX.Element;
328
435
 
329
- export { AddToCartButton, type AddToCartButtonLabels, type AddToCartButtonProps, type AddToCartButtonStatus, CartIcon, type CartIconLabels, type CartIconProps, Collection, type CollectionFacet, type CollectionFacetOption, type CollectionFilter, type CollectionLabels, type CollectionProps, DATA_REQUEST_FIELD_LIMITS, DEFAULT_DATA_REQUEST_FORM_LABELS, DataRequestForm, type DataRequestFormLabels, type DataRequestFormProps, type DataRequestSubmitResult, ShareButtons, type ShareButtonsLabels, type ShareButtonsProps, type UseCollectionOptions, type UseCollectionResult, useCollection };
436
+ export { AddToCartButton, type AddToCartButtonLabels, type AddToCartButtonProps, type AddToCartButtonStatus, CartIcon, type CartIconLabels, type CartIconProps, Collection, type CollectionFacet, type CollectionFacetOption, type CollectionFilter, type CollectionLabels, type CollectionProps, CourseSyllabus, type CourseSyllabusLabels, type CourseSyllabusModule, type CourseSyllabusProps, DATA_REQUEST_FIELD_LIMITS, DEFAULT_COURSE_SYLLABUS_LABELS, DEFAULT_DATA_REQUEST_FORM_LABELS, DEFAULT_PRODUCT_CAROUSEL_LABELS, DataRequestForm, type DataRequestFormLabels, type DataRequestFormProps, type DataRequestSubmitResult, ProductCarousel, type ProductCarouselCustomCardProps, type ProductCarouselDefaultCardProps, type ProductCarouselLabels, type ProductCarouselProps, ShareButtons, type ShareButtonsLabels, type ShareButtonsProps, type UseCollectionOptions, type UseCollectionResult, useCollection };