@factorialco/f0-react 6.14.0 → 6.16.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";
@@ -6865,6 +6882,7 @@ export declare interface F0SegmentedControlProps {
6865
6882
  */
6866
6883
  declare type F0SelectBaseProps<T extends string, R = unknown> = {
6867
6884
  withApplySelection?: boolean;
6885
+ applySelectionLabel?: string;
6868
6886
  onChangeSelectedOption?: (option: F0SelectItemObject<T, ResolvedRecordType<R>> | undefined, checked: boolean) => void;
6869
6887
  children?: React.ReactNode;
6870
6888
  open?: boolean;
@@ -7922,6 +7940,14 @@ export declare interface HomeRenderCtx {
7922
7940
  isLastSlot?: boolean;
7923
7941
  }
7924
7942
 
7943
+ /**
7944
+ * The ctx a SKELETON is drawn with: the render ctx plus how many placeholder
7945
+ * items to draw — the slot's `expectedItemsCount`, already defaulted.
7946
+ */
7947
+ export declare type HomeSkeletonCtx = HomeRenderCtx & {
7948
+ expectedItemsCount: number;
7949
+ };
7950
+
7925
7951
  /**
7926
7952
  * Builds a slot with its params CHECKED against its visualization.
7927
7953
  * `HomeWidgetSlot`'s `params` is `unknown` (bespoke slots need it to be), so a
@@ -7929,7 +7955,7 @@ export declare interface HomeRenderCtx {
7929
7955
  * the built-in vocabulary (and {@link listSlot} for `list` slots), keeping
7930
7956
  * literals for bespoke visualizations.
7931
7957
  */
7932
- export declare const homeSlot: <V extends keyof HomeSlotParamsMap>(visualization: V, params: HomeSlotParamsMap[V]) => HomeWidgetSlot;
7958
+ export declare const homeSlot: <V extends keyof HomeSlotParamsMap>(visualization: V, params: HomeSlotParamsMap[V], options?: SlotOptions) => HomeWidgetSlot;
7933
7959
 
7934
7960
  /** The built-in slot vocabulary: each visualization and its params shape. */
7935
7961
  export declare interface HomeSlotParamsMap {
@@ -7974,12 +8000,24 @@ export declare type HomeWidgetItem = HomeWidgetChrome & {
7974
8000
  */
7975
8001
  hasUpdates?: boolean;
7976
8002
  slots: HomeWidgetSlot[];
8003
+ /**
8004
+ * The widget is waiting on its data: every slot draws its skeleton instead of
8005
+ * its content (see `SlotWidget`'s `loading`).
8006
+ */
8007
+ loading?: boolean;
7977
8008
  };
7978
8009
 
7979
8010
  /** One slot of a widget: a visualization tag + its params (opaque to the layout). */
7980
8011
  export declare interface HomeWidgetSlot {
7981
8012
  visualization: string;
7982
8013
  params: unknown;
8014
+ /**
8015
+ * How many items this slot expects to hold — the number of PLACEHOLDER items
8016
+ * its skeleton draws while the widget is `loading`, so the loading card is
8017
+ * about as tall as the one that replaces it. Defaults to
8018
+ * {@link DEFAULT_EXPECTED_ITEMS_COUNT}.
8019
+ */
8020
+ expectedItemsCount?: number;
7983
8021
  }
7984
8022
 
7985
8023
  declare type HTMLString = string;
@@ -8535,7 +8573,7 @@ export declare interface ListSchema {
8535
8573
  * CHECKED against it — a `left: "person"` slot only takes person data, a
8536
8574
  * `clickBehavior: "link"` slot demands an `href` on every row.
8537
8575
  */
8538
- export declare const listSlot: <const S extends ListSchema>(schema: S, items: Array<ListItem<S>>) => HomeWidgetSlot;
8576
+ export declare const listSlot: <const S extends ListSchema>(schema: S, items: Array<ListItem<S>>, options?: SlotOptions) => HomeWidgetSlot;
8539
8577
 
8540
8578
  declare type ListTextData<S extends ListSchema> = {
8541
8579
  title: string;
@@ -10339,6 +10377,12 @@ declare type RequisitionProfile = {
10339
10377
 
10340
10378
  export declare type ResolvedRecordType<R> = R extends RecordType ? R : RecordType;
10341
10379
 
10380
+ /** A renderer entry in its full form — a bare function is just its `render`. */
10381
+ export declare const resolveSlotRenderer: (entry: SlotRendererEntry | undefined) => {
10382
+ render: SlotRenderer;
10383
+ skeleton?: SlotSkeletonRenderer;
10384
+ } | undefined;
10385
+
10342
10386
  /**
10343
10387
  * Header for a resource detail page: avatar, title, description, status,
10344
10388
  * metadata and its primary, secondary and overflow actions.
@@ -11055,10 +11099,28 @@ declare const skeletonVariants: (props?: ({
11055
11099
  */
11056
11100
  export declare const SLOT_ROW_BLEED = "-m-2";
11057
11101
 
11102
+ /**
11103
+ * Marks ONE placeholder item, whatever the visualization draws as an item — a
11104
+ * list row, an event, an indicator. `expectedItemsCount` of these appear.
11105
+ */
11106
+ export declare const SLOT_SKELETON_ITEM_TESTID = "slot-skeleton-item";
11107
+
11108
+ /** What a slot carries beyond its params. Taken by both slot builders. */
11109
+ export declare type SlotOptions = Pick<HomeWidgetSlot, "expectedItemsCount">;
11110
+
11058
11111
  /** Draws ONE slot from its params. Keyed by `visualization` in a renderer map. */
11059
11112
  export declare type SlotRenderer<P = unknown> = (params: P, ctx: HomeRenderCtx) => ReactNode;
11060
11113
 
11061
- export declare type SlotRenderers = Record<string, SlotRenderer>;
11114
+ /**
11115
+ * How a visualization is drawn: the render function on its own, or that
11116
+ * function PAIRED with the skeleton to draw while the slot loads.
11117
+ */
11118
+ export declare type SlotRendererEntry<P = unknown> = SlotRenderer<P> | {
11119
+ render: SlotRenderer<P>;
11120
+ skeleton?: SlotSkeletonRenderer<P>;
11121
+ };
11122
+
11123
+ export declare type SlotRenderers = Record<string, SlotRendererEntry>;
11062
11124
 
11063
11125
  /**
11064
11126
  * The bleed a row-based slot applies to itself: `SLOT_ROW_BLEED` with its
@@ -11068,6 +11130,14 @@ export declare type SlotRenderers = Record<string, SlotRenderer>;
11068
11130
  */
11069
11131
  export declare const slotRowBleed: (ctx: HomeRenderCtx) => string;
11070
11132
 
11133
+ /**
11134
+ * Draws the slot's PLACEHOLDER, before its data lands. It gets the same params
11135
+ * the renderer will get — a loading slot still carries its static config (a
11136
+ * `list`'s schema, say), just no items — so the placeholder can be shaped like
11137
+ * what is coming.
11138
+ */
11139
+ export declare type SlotSkeletonRenderer<P = unknown> = (params: P, ctx: HomeSkeletonCtx) => ReactNode;
11140
+
11071
11141
  /**
11072
11142
  * Type helper to extract keys from a SortingsDefinition
11073
11143
  */
@@ -12621,9 +12691,16 @@ export declare interface WidgetProps {
12621
12691
  info?: string;
12622
12692
  canBeBlurred?: boolean;
12623
12693
  link?: {
12694
+ /**
12695
+ * What following the link DOES, in words — "Go to Communities". The
12696
+ * control is icon-only, so this is the only thing that says where it
12697
+ * goes: it is its tooltip and its accessible name, and it is required
12698
+ * for exactly that reason.
12699
+ */
12624
12700
  title: string;
12625
12701
  url?: string;
12626
12702
  onClick?: () => void;
12703
+ /** Defaults to the external-link glyph. */
12627
12704
  icon?: IconType;
12628
12705
  };
12629
12706
  count?: number;
@@ -12849,9 +12926,11 @@ declare module "@tiptap/core" {
12849
12926
 
12850
12927
  declare module "@tiptap/core" {
12851
12928
  interface Commands<ReturnType> {
12852
- fontSize: {
12853
- setFontSize: (fontSize: string) => ReturnType;
12854
- unsetFontSize: () => ReturnType;
12929
+ enhanceHighlight: {
12930
+ setEnhanceHighlight: (from: number, to: number, options?: {
12931
+ placeholder?: string;
12932
+ }) => ReturnType;
12933
+ clearEnhanceHighlight: () => ReturnType;
12855
12934
  };
12856
12935
  }
12857
12936
  }
@@ -12859,11 +12938,9 @@ declare module "@tiptap/core" {
12859
12938
 
12860
12939
  declare module "@tiptap/core" {
12861
12940
  interface Commands<ReturnType> {
12862
- enhanceHighlight: {
12863
- setEnhanceHighlight: (from: number, to: number, options?: {
12864
- placeholder?: string;
12865
- }) => ReturnType;
12866
- clearEnhanceHighlight: () => ReturnType;
12941
+ fontSize: {
12942
+ setFontSize: (fontSize: string) => ReturnType;
12943
+ unsetFontSize: () => ReturnType;
12867
12944
  };
12868
12945
  }
12869
12946
  }