@factorialco/f0-react 6.14.0 → 6.15.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.
@@ -3350,15 +3350,32 @@ declare const daytimePageVariants: (props?: ({
3350
3350
  className?: ClassValue;
3351
3351
  })) | undefined) => string;
3352
3352
 
3353
+ /**
3354
+ * How many placeholder items a slot draws when it doesn't say (its
3355
+ * `expectedItemsCount`). Three: enough to read as a list, short enough that a
3356
+ * widget which turns out to hold one item barely jumps.
3357
+ */
3358
+ export declare const DEFAULT_EXPECTED_ITEMS_COUNT = 3;
3359
+
3353
3360
  /**
3354
3361
  * Built-in renderers for the standard visualizations. `list` covers every
3355
3362
  * row-based slot through its schema; `event-list` and `indicators` spread
3356
3363
  * their params onto the matching f0 content component. Bespoke visualizations
3357
3364
  * (e.g. `clock-in`, `carousel`) are intentionally absent — supply them via
3358
3365
  * `slotRenderers`.
3366
+ *
3367
+ * Each ships its own `skeleton` beside its `render`, so a widget's loading
3368
+ * state is drawn by the same thing that draws its content.
3359
3369
  */
3360
3370
  export declare const defaultSlotRenderers: SlotRenderers;
3361
3371
 
3372
+ /**
3373
+ * What a slot draws while loading when its visualization brings no skeleton of
3374
+ * its own — an unregistered one, or a bespoke renderer passed as a bare
3375
+ * function. Deliberately shapeless: one bar per expected item.
3376
+ */
3377
+ export declare const defaultSlotSkeleton: SlotSkeletonRenderer;
3378
+
3362
3379
  declare const defaultTranslations: {
3363
3380
  readonly common: {
3364
3381
  readonly selectPlaceholder: "Select";
@@ -7922,6 +7939,14 @@ export declare interface HomeRenderCtx {
7922
7939
  isLastSlot?: boolean;
7923
7940
  }
7924
7941
 
7942
+ /**
7943
+ * The ctx a SKELETON is drawn with: the render ctx plus how many placeholder
7944
+ * items to draw — the slot's `expectedItemsCount`, already defaulted.
7945
+ */
7946
+ export declare type HomeSkeletonCtx = HomeRenderCtx & {
7947
+ expectedItemsCount: number;
7948
+ };
7949
+
7925
7950
  /**
7926
7951
  * Builds a slot with its params CHECKED against its visualization.
7927
7952
  * `HomeWidgetSlot`'s `params` is `unknown` (bespoke slots need it to be), so a
@@ -7929,7 +7954,7 @@ export declare interface HomeRenderCtx {
7929
7954
  * the built-in vocabulary (and {@link listSlot} for `list` slots), keeping
7930
7955
  * literals for bespoke visualizations.
7931
7956
  */
7932
- export declare const homeSlot: <V extends keyof HomeSlotParamsMap>(visualization: V, params: HomeSlotParamsMap[V]) => HomeWidgetSlot;
7957
+ export declare const homeSlot: <V extends keyof HomeSlotParamsMap>(visualization: V, params: HomeSlotParamsMap[V], options?: SlotOptions) => HomeWidgetSlot;
7933
7958
 
7934
7959
  /** The built-in slot vocabulary: each visualization and its params shape. */
7935
7960
  export declare interface HomeSlotParamsMap {
@@ -7974,12 +7999,24 @@ export declare type HomeWidgetItem = HomeWidgetChrome & {
7974
7999
  */
7975
8000
  hasUpdates?: boolean;
7976
8001
  slots: HomeWidgetSlot[];
8002
+ /**
8003
+ * The widget is waiting on its data: every slot draws its skeleton instead of
8004
+ * its content (see `SlotWidget`'s `loading`).
8005
+ */
8006
+ loading?: boolean;
7977
8007
  };
7978
8008
 
7979
8009
  /** One slot of a widget: a visualization tag + its params (opaque to the layout). */
7980
8010
  export declare interface HomeWidgetSlot {
7981
8011
  visualization: string;
7982
8012
  params: unknown;
8013
+ /**
8014
+ * How many items this slot expects to hold — the number of PLACEHOLDER items
8015
+ * its skeleton draws while the widget is `loading`, so the loading card is
8016
+ * about as tall as the one that replaces it. Defaults to
8017
+ * {@link DEFAULT_EXPECTED_ITEMS_COUNT}.
8018
+ */
8019
+ expectedItemsCount?: number;
7983
8020
  }
7984
8021
 
7985
8022
  declare type HTMLString = string;
@@ -8535,7 +8572,7 @@ export declare interface ListSchema {
8535
8572
  * CHECKED against it — a `left: "person"` slot only takes person data, a
8536
8573
  * `clickBehavior: "link"` slot demands an `href` on every row.
8537
8574
  */
8538
- export declare const listSlot: <const S extends ListSchema>(schema: S, items: Array<ListItem<S>>) => HomeWidgetSlot;
8575
+ export declare const listSlot: <const S extends ListSchema>(schema: S, items: Array<ListItem<S>>, options?: SlotOptions) => HomeWidgetSlot;
8539
8576
 
8540
8577
  declare type ListTextData<S extends ListSchema> = {
8541
8578
  title: string;
@@ -10339,6 +10376,12 @@ declare type RequisitionProfile = {
10339
10376
 
10340
10377
  export declare type ResolvedRecordType<R> = R extends RecordType ? R : RecordType;
10341
10378
 
10379
+ /** A renderer entry in its full form — a bare function is just its `render`. */
10380
+ export declare const resolveSlotRenderer: (entry: SlotRendererEntry | undefined) => {
10381
+ render: SlotRenderer;
10382
+ skeleton?: SlotSkeletonRenderer;
10383
+ } | undefined;
10384
+
10342
10385
  /**
10343
10386
  * Header for a resource detail page: avatar, title, description, status,
10344
10387
  * metadata and its primary, secondary and overflow actions.
@@ -11055,10 +11098,28 @@ declare const skeletonVariants: (props?: ({
11055
11098
  */
11056
11099
  export declare const SLOT_ROW_BLEED = "-m-2";
11057
11100
 
11101
+ /**
11102
+ * Marks ONE placeholder item, whatever the visualization draws as an item — a
11103
+ * list row, an event, an indicator. `expectedItemsCount` of these appear.
11104
+ */
11105
+ export declare const SLOT_SKELETON_ITEM_TESTID = "slot-skeleton-item";
11106
+
11107
+ /** What a slot carries beyond its params. Taken by both slot builders. */
11108
+ export declare type SlotOptions = Pick<HomeWidgetSlot, "expectedItemsCount">;
11109
+
11058
11110
  /** Draws ONE slot from its params. Keyed by `visualization` in a renderer map. */
11059
11111
  export declare type SlotRenderer<P = unknown> = (params: P, ctx: HomeRenderCtx) => ReactNode;
11060
11112
 
11061
- export declare type SlotRenderers = Record<string, SlotRenderer>;
11113
+ /**
11114
+ * How a visualization is drawn: the render function on its own, or that
11115
+ * function PAIRED with the skeleton to draw while the slot loads.
11116
+ */
11117
+ export declare type SlotRendererEntry<P = unknown> = SlotRenderer<P> | {
11118
+ render: SlotRenderer<P>;
11119
+ skeleton?: SlotSkeletonRenderer<P>;
11120
+ };
11121
+
11122
+ export declare type SlotRenderers = Record<string, SlotRendererEntry>;
11062
11123
 
11063
11124
  /**
11064
11125
  * The bleed a row-based slot applies to itself: `SLOT_ROW_BLEED` with its
@@ -11068,6 +11129,14 @@ export declare type SlotRenderers = Record<string, SlotRenderer>;
11068
11129
  */
11069
11130
  export declare const slotRowBleed: (ctx: HomeRenderCtx) => string;
11070
11131
 
11132
+ /**
11133
+ * Draws the slot's PLACEHOLDER, before its data lands. It gets the same params
11134
+ * the renderer will get — a loading slot still carries its static config (a
11135
+ * `list`'s schema, say), just no items — so the placeholder can be shaped like
11136
+ * what is coming.
11137
+ */
11138
+ export declare type SlotSkeletonRenderer<P = unknown> = (params: P, ctx: HomeSkeletonCtx) => ReactNode;
11139
+
11071
11140
  /**
11072
11141
  * Type helper to extract keys from a SortingsDefinition
11073
11142
  */
@@ -12621,9 +12690,16 @@ export declare interface WidgetProps {
12621
12690
  info?: string;
12622
12691
  canBeBlurred?: boolean;
12623
12692
  link?: {
12693
+ /**
12694
+ * What following the link DOES, in words — "Go to Communities". The
12695
+ * control is icon-only, so this is the only thing that says where it
12696
+ * goes: it is its tooltip and its accessible name, and it is required
12697
+ * for exactly that reason.
12698
+ */
12624
12699
  title: string;
12625
12700
  url?: string;
12626
12701
  onClick?: () => void;
12702
+ /** Defaults to the external-link glyph. */
12627
12703
  icon?: IconType;
12628
12704
  };
12629
12705
  count?: number;
@@ -12849,9 +12925,11 @@ declare module "@tiptap/core" {
12849
12925
 
12850
12926
  declare module "@tiptap/core" {
12851
12927
  interface Commands<ReturnType> {
12852
- fontSize: {
12853
- setFontSize: (fontSize: string) => ReturnType;
12854
- unsetFontSize: () => ReturnType;
12928
+ enhanceHighlight: {
12929
+ setEnhanceHighlight: (from: number, to: number, options?: {
12930
+ placeholder?: string;
12931
+ }) => ReturnType;
12932
+ clearEnhanceHighlight: () => ReturnType;
12855
12933
  };
12856
12934
  }
12857
12935
  }
@@ -12859,11 +12937,9 @@ declare module "@tiptap/core" {
12859
12937
 
12860
12938
  declare module "@tiptap/core" {
12861
12939
  interface Commands<ReturnType> {
12862
- enhanceHighlight: {
12863
- setEnhanceHighlight: (from: number, to: number, options?: {
12864
- placeholder?: string;
12865
- }) => ReturnType;
12866
- clearEnhanceHighlight: () => ReturnType;
12940
+ fontSize: {
12941
+ setFontSize: (fontSize: string) => ReturnType;
12942
+ unsetFontSize: () => ReturnType;
12867
12943
  };
12868
12944
  }
12869
12945
  }