@factorialco/f0-react 4.58.0 → 4.60.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/f0.d.ts CHANGED
@@ -123,6 +123,7 @@ import { PieChartProps } from './PieChart';
123
123
  import { PopoverContentProps } from '@radix-ui/react-popover';
124
124
  import { ProgressBarCellValue } from './f0';
125
125
  import { ProgressBarCellValue as ProgressBarCellValue_2 } from './types/progressBar';
126
+ import { ProgressSeriesCellValue } from './types/progressSeries';
126
127
  import { Props as Props_2 } from './types';
127
128
  import { RadarChartProps } from './RadarChart';
128
129
  import * as React_2 from 'react';
@@ -1267,6 +1268,38 @@ export declare type AttachedFile = {
1267
1268
  errorMessage?: string;
1268
1269
  };
1269
1270
 
1271
+ /**
1272
+ * Structured detail content for {@link F0AudioPlayerCardProps.content}.
1273
+ *
1274
+ * Pass a `summary` and/or a `transcription` string and the card builds the
1275
+ * tabbed "View detail" panel for you, with labels pulled from translations
1276
+ * (`audioPlayer.summary` / `audioPlayer.transcription`) — you no longer wire up
1277
+ * the tabs yourself as with the deprecated `details` array.
1278
+ *
1279
+ * A transcription is what makes an audio-only recording accessible
1280
+ * (WCAG 2.1 SC 1.2.1, Audio-only). When you omit `transcription`, the card
1281
+ * still tries to derive one from the audio file's own text tracks; if none can
1282
+ * be passed or derived, the recording is flagged in the accessibility checks.
1283
+ *
1284
+ * Both fields are localizable — pass a per-locale list
1285
+ * (`[{ locale, label?, value }]`) to offer several languages, and a language
1286
+ * selector appears in the detail panel (a single selection drives both tabs).
1287
+ */
1288
+ export declare interface AudioPlayerContent {
1289
+ /**
1290
+ * Plain-text summary of the recording, shown in the "Summary" tab.
1291
+ * Localizable.
1292
+ */
1293
+ summary?: Localized<string>;
1294
+ /**
1295
+ * Plain-text transcription of the recording, shown in the "Transcription"
1296
+ * tab. Line breaks are preserved. When omitted, the card attempts to derive
1297
+ * a transcription from the audio file's embedded/attached text tracks.
1298
+ * Localizable.
1299
+ */
1300
+ transcription?: Localized<string>;
1301
+ }
1302
+
1270
1303
  export declare interface AudioPlayerControls extends AudioPlayerState {
1271
1304
  play: () => void;
1272
1305
  pause: () => void;
@@ -1275,6 +1308,11 @@ export declare interface AudioPlayerControls extends AudioPlayerState {
1275
1308
  setPlaybackRate: (rate: number) => void;
1276
1309
  }
1277
1310
 
1311
+ /**
1312
+ * @deprecated Prefer the structured `content` prop
1313
+ * ({@link AudioPlayerContent}). The raw tab array is still honoured for now for
1314
+ * backward compatibility, but will be removed in a future release.
1315
+ */
1278
1316
  export declare interface AudioPlayerDetailTab {
1279
1317
  /** Stable value used to identify the tab. */
1280
1318
  value: string;
@@ -4528,7 +4566,15 @@ export declare const defaultTranslations: {
4528
4566
  readonly position: "{{current}} of {{total}}";
4529
4567
  readonly viewDetail: "View detail";
4530
4568
  readonly hideDetail: "Hide detail";
4569
+ readonly viewTranscription: "View transcription";
4570
+ readonly hideTranscription: "Hide transcription";
4571
+ readonly viewSummary: "View summary";
4572
+ readonly hideSummary: "Hide summary";
4531
4573
  readonly details: "Recording details";
4574
+ readonly summary: "Summary";
4575
+ readonly transcription: "Transcription";
4576
+ readonly language: "Language";
4577
+ readonly audio: "Audio";
4532
4578
  };
4533
4579
  readonly actions: {
4534
4580
  readonly add: "Add";
@@ -5069,6 +5115,10 @@ export declare const defaultTranslations: {
5069
5115
  readonly description: "Try a different date or fewer filters";
5070
5116
  };
5071
5117
  };
5118
+ readonly progressSeries: {
5119
+ readonly noData: "No data";
5120
+ readonly canceled: "Canceled";
5121
+ };
5072
5122
  readonly select: {
5073
5123
  readonly noResults: "No results found";
5074
5124
  readonly loadingMore: "Loading...";
@@ -5341,6 +5391,7 @@ export declare const defaultTranslations: {
5341
5391
  readonly paused: "Paused";
5342
5392
  readonly mute: "Mute";
5343
5393
  readonly unmute: "Unmute";
5394
+ readonly noAudio: "No audio";
5344
5395
  readonly volume: "Volume";
5345
5396
  readonly seekLabel: "Seek";
5346
5397
  readonly enterFullscreen: "Enter fullscreen";
@@ -5348,6 +5399,12 @@ export declare const defaultTranslations: {
5348
5399
  readonly playbackSpeed: "Playback speed ({{rate}})";
5349
5400
  readonly playbackSpeedLabel: "Playback speed";
5350
5401
  readonly timeProgress: "{{current}} of {{total}}";
5402
+ readonly captions: "Captions";
5403
+ readonly audioDescription: "Audio description";
5404
+ readonly audio: "Audio";
5405
+ readonly subtitles: "Subtitles";
5406
+ readonly settings: "Settings";
5407
+ readonly off: "Off";
5351
5408
  };
5352
5409
  };
5353
5410
 
@@ -7108,10 +7165,23 @@ export declare interface F0AudioPlayerCardProps extends F0AudioPlayerProps {
7108
7165
  * is always rendered by the card.
7109
7166
  */
7110
7167
  actions?: AudioPlayerMenuAction[];
7168
+ /**
7169
+ * Structured detail content revealed by a "View detail" toggle in the header:
7170
+ * a `summary` and/or a `transcription`. The card renders the tabs with
7171
+ * translated labels. Providing a `transcription` (or shipping one in the
7172
+ * audio file) keeps the recording accessible. Takes precedence over the
7173
+ * deprecated `details` prop when both are set.
7174
+ */
7175
+ content?: AudioPlayerContent;
7111
7176
  /**
7112
7177
  * Tabbed detail content revealed by a "View detail" toggle in the header
7113
7178
  * (e.g. a Summary and a Transcript tab). When omitted or empty, no toggle and
7114
7179
  * no panel are rendered and the card behaves like a plain recording player.
7180
+ *
7181
+ * @deprecated Use the structured {@link F0AudioPlayerCardProps.content} prop
7182
+ * instead (`{ summary, transcription }`). This raw tab array is still
7183
+ * honoured for backward compatibility but will be removed in a future
7184
+ * release.
7115
7185
  */
7116
7186
  details?: AudioPlayerDetailTab[];
7117
7187
  /**
@@ -7141,8 +7211,19 @@ export declare interface F0AudioPlayerProps extends WithDataTestIdProps, DataAtt
7141
7211
  * the URL the first time playback is requested. Use the function form for
7142
7212
  * on-demand credentials (e.g. presigned URLs) so the URL is only fetched on
7143
7213
  * user intent.
7214
+ *
7215
+ * Localizable — pass a per-locale list of dubbed recordings to offer
7216
+ * selectable audio languages; a language selector then appears (in the card's
7217
+ * kebab menu, or inline on the bare player).
7218
+ */
7219
+ src: Localized<string | (() => Promise<string>)>;
7220
+ /**
7221
+ * Initial language for localized content — the audio `src` and, on the card,
7222
+ * the detail `content` (summary/transcription). Matched against the provided
7223
+ * locales exactly or by primary subtag, then the viewer's browser language,
7224
+ * then the first provided. Only relevant when more than one language is given.
7144
7225
  */
7145
- src: string | (() => Promise<string>);
7226
+ defaultLanguage?: string;
7146
7227
  /**
7147
7228
  * Known total duration in seconds. Lets the player show the total time and an
7148
7229
  * active seek bar before the audio loads (e.g. with `preload="none"`).
@@ -11968,11 +12049,54 @@ export declare const F0VideoPlayer: WithDataTestIdReturnType_3<typeof F0VideoPla
11968
12049
  * useRestrictForwardSeek → blocks seeking past the furthest-watched point.
11969
12050
  * <Controls> → presentation only; interactions delegated back here.
11970
12051
  */
11971
- declare function F0VideoPlayerInternal({ src, autoPlay, autoFocus, restrictForwardSeek, onTrackAction, onMilestone, onComplete, ...dataAttributes }: F0VideoPlayerProps): JSX_2.Element;
12052
+ declare function F0VideoPlayerInternal({ src, poster, silent, persistControls, content, defaultLanguage, autoPlay, autoFocus, restrictForwardSeek, onTrackAction, onMilestone, onComplete, ...dataAttributes }: F0VideoPlayerProps): JSX_2.Element;
11972
12053
 
11973
12054
  export declare interface F0VideoPlayerProps extends DataAttributes_2 {
11974
- /** Video source URL. */
11975
- src: string;
12055
+ /**
12056
+ * Video source URL. Localizable — pass a per-locale list of dubbed renditions
12057
+ * to offer selectable audio languages; an "Audio" selector then appears,
12058
+ * independent of the subtitle/caption language.
12059
+ */
12060
+ src: Localized<string>;
12061
+ /**
12062
+ * Initial language for localized content, matched against the provided
12063
+ * locales exactly or by primary subtag, then the viewer's browser language,
12064
+ * then the first provided. Applies to both the audio (`src`) and the text
12065
+ * (`content`) language selections. Only relevant when more than one language
12066
+ * is available.
12067
+ */
12068
+ defaultLanguage?: string;
12069
+ /**
12070
+ * Image URL shown while the video loads and before playback starts (the
12071
+ * native `<video>` poster). Cleared by the browser once playback begins.
12072
+ */
12073
+ poster?: string;
12074
+ /**
12075
+ * Marks the video as having no audio (video-only). Captions (WCAG 2.1
12076
+ * SC 1.2.2) don't apply to silent media, so this exempts the player from the
12077
+ * captions requirement — `data-video-captions` is set to `"no-audio"` instead
12078
+ * of `"missing"`. Note video-only content may still need a text/audio
12079
+ * alternative for its visual information (SC 1.2.1) — audio description still
12080
+ * works over a silent video (its description audio plays even though the video
12081
+ * itself is muted). Browsers can't reliably detect the absence of audio before
12082
+ * playback, so this is declared explicitly.
12083
+ * @default false
12084
+ */
12085
+ silent?: boolean;
12086
+ /**
12087
+ * Structured content for the player. Currently carries `captions` (a WebVTT
12088
+ * URL or raw WebVTT string) shown over the video during playback and
12089
+ * toggled with the "CC" control. When `captions` is omitted, captions
12090
+ * embedded in the video file are used instead.
12091
+ */
12092
+ content?: VideoPlayerContent;
12093
+ /**
12094
+ * Keep the controls bar visible during playback instead of auto-hiding it.
12095
+ * By default the controls show while the video is paused and auto-hide while
12096
+ * it plays (revealing on hover or keyboard focus); set this to keep them
12097
+ * visible the whole time. Default `false`.
12098
+ */
12099
+ persistControls?: boolean;
11976
12100
  /** Start playing on mount. Default `false`. */
11977
12101
  autoPlay?: boolean;
11978
12102
  /** Focus the player on mount so keyboard shortcuts work immediately. Default `false`. */
@@ -13311,7 +13435,7 @@ export declare function injectSectionEnds(items: FlatFormItem[], inSectionQuesti
13311
13435
  */
13312
13436
  export declare const Input: ForwardRefExoticComponent<Omit<F0TextInputProps, "ref"> & RefAttributes<HTMLInputElement>>;
13313
13437
 
13314
- declare const Input_2: React_2.ForwardRefExoticComponent<Omit<React_2.InputHTMLAttributes<HTMLInputElement>, "onChange" | "size"> & Pick<InputFieldProps<string>, "label" | "onChange" | "size" | "icon" | "role" | "onFocus" | "onBlur" | "transparent" | "status" | "loading" | "disabled" | "maxLength" | "required" | "error" | "append" | "hideLabel" | "hint" | "labelIcon" | "onClickContent" | "readonly" | "clearable" | "autocomplete" | "onClear" | "isEmpty" | "emptyValue" | "hideMaxLength" | "appendTag" | "lengthProvider" | "buttonToggle"> & React_2.RefAttributes<HTMLInputElement>>;
13438
+ declare const Input_2: React_2.ForwardRefExoticComponent<Omit<React_2.InputHTMLAttributes<HTMLInputElement>, "onChange" | "size"> & Pick<InputFieldProps<string>, "label" | "onChange" | "size" | "icon" | "role" | "onFocus" | "onBlur" | "transparent" | "status" | "loading" | "disabled" | "maxLength" | "required" | "error" | "append" | "hideLabel" | "hint" | "isEmpty" | "labelIcon" | "onClickContent" | "readonly" | "clearable" | "autocomplete" | "onClear" | "emptyValue" | "hideMaxLength" | "appendTag" | "lengthProvider" | "buttonToggle"> & React_2.RefAttributes<HTMLInputElement>>;
13315
13439
 
13316
13440
  declare const INPUTFIELD_SIZES: readonly ["sm", "md"];
13317
13441
 
@@ -13697,6 +13821,26 @@ export declare interface LoadingStateProps {
13697
13821
  label: string;
13698
13822
  }
13699
13823
 
13824
+ /** A single value, or the same value provided in multiple languages. */
13825
+ declare type Localized<T> = T | LocalizedOption<T>[];
13826
+
13827
+ /**
13828
+ * Shared helpers for content that can be provided in one language (a plain
13829
+ * value) or several (a list of per-locale entries) — used by the media players
13830
+ * for captions, descriptions, transcriptions and summaries.
13831
+ */
13832
+ declare interface LocalizedOption<T> {
13833
+ /** BCP-47 language tag, e.g. `"en"`, `"es"`, `"en-US"`. */
13834
+ locale: string;
13835
+ /**
13836
+ * Display label for the language picker. Defaults to the language name for
13837
+ * `locale` (via `Intl.DisplayNames`), so this is only needed to override it.
13838
+ */
13839
+ label?: string;
13840
+ /** The value for this locale. */
13841
+ value: T;
13842
+ }
13843
+
13700
13844
  export declare type LockedQuestionNotice = {
13701
13845
  description: string;
13702
13846
  };
@@ -17697,6 +17841,26 @@ export declare interface UseDataSourceItemNavigationReturn<R extends RecordType>
17697
17841
  previousItemUrl: string | null;
17698
17842
  }
17699
17843
 
17844
+ /**
17845
+ * Derives a transcription from the audio element's text tracks, so a recording
17846
+ * that ships its own transcript surfaces one even when the consumer doesn't
17847
+ * pass `content.transcription`.
17848
+ *
17849
+ * Tracks are read in-band-first (embedded in the file), then from out-of-band
17850
+ * `<track>` children as a fallback — both live on `audio.textTracks`. Cues load
17851
+ * asynchronously, so the hook watches for tracks and cue changes and re-reads
17852
+ * until it finds text.
17853
+ *
17854
+ * @param audioRef ref to the player's `<audio>` element
17855
+ * @param currentSrc the resolved source URL; derivation restarts when it
17856
+ * changes so a new file's tracks replace the old ones
17857
+ * @param enabled when `false`, derivation is skipped (e.g. a transcription
17858
+ * was already passed explicitly) and the hook returns
17859
+ * `undefined`
17860
+ * @returns the joined cue text, or `undefined` while none is available
17861
+ */
17862
+ export declare const useDerivedTranscription: (audioRef: RefObject<HTMLAudioElement>, currentSrc: string | undefined, enabled: boolean) => string | undefined;
17863
+
17700
17864
  export declare function useDndEvents(handler: (e: {
17701
17865
  phase: "start" | "over" | "drop" | "cancel";
17702
17866
  source: DragPayload;
@@ -18258,6 +18422,7 @@ declare const valueDisplayRenderers: {
18258
18422
  readonly person: (args: PersonCellValue_2, meta: ValueDisplayRendererContext_2) => JSX_2.Element;
18259
18423
  readonly percentage: (args: PercentageCellValue, meta: ValueDisplayRendererContext_2) => JSX_2.Element | null;
18260
18424
  readonly progressBar: (args: ProgressBarCellValue_2, _meta: ValueDisplayRendererContext_2) => JSX_2.Element | null;
18425
+ readonly progressSeries: (args: ProgressSeriesCellValue, meta: ValueDisplayRendererContext_2) => JSX_2.Element;
18261
18426
  readonly barSeries: (args: BarSeriesCellValue, meta: ValueDisplayRendererContext_2) => JSX_2.Element;
18262
18427
  readonly categoryBarChart: (args: CategoryBarChartCellValue, meta: ValueDisplayRendererContext_2) => JSX_2.Element;
18263
18428
  readonly hourDistribution: (args: HourDistributionCellValue_2, meta: ValueDisplayRendererContext_2) => JSX_2.Element;
@@ -18287,6 +18452,56 @@ showRatio?: boolean;
18287
18452
  valueFormatter?: (value: string | number | undefined) => string | number;
18288
18453
  } & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>>;
18289
18454
 
18455
+ /**
18456
+ * Structured content for the video player.
18457
+ *
18458
+ * Every field accepts either a single value or a localized list
18459
+ * (`[{ locale, label?, value }]`) — pass several languages and a language
18460
+ * selector appears in the controls. A single shared selection drives captions,
18461
+ * descriptions and the described source together (each falls back to its first
18462
+ * entry for languages it doesn't provide). See `F0VideoPlayerProps.defaultLanguage`.
18463
+ *
18464
+ * `captions` are timed text shown over the video during playback (WCAG 2.1
18465
+ * SC 1.2.2, Captions). Pass either a WebVTT resource URL or a raw WebVTT string
18466
+ * (the player turns raw VTT into a blob track, so no CORS setup is needed); a
18467
+ * remote URL requires the video host to allow cross-origin reads. When omitted,
18468
+ * the player uses any caption/subtitle track embedded in the video file. A
18469
+ * captions toggle in the controls shows/hides them (a filled glyph when on, a
18470
+ * line glyph when off).
18471
+ *
18472
+ * Audio description (WCAG 2.1 SC 1.2.5) conveys on-screen visual information as
18473
+ * audio, complementary to captions — both are independent and can be on at
18474
+ * once. Provide it in one of two ways, toggled with the audio-description
18475
+ * control (a filled "AD" badge when on, a line badge when off):
18476
+ * - `describedSrc`: a pre-produced media rendition with description mixed into
18477
+ * the audio. Toggling swaps the source, preserving position and play state.
18478
+ * Highest quality; assumed the same length as `src`.
18479
+ * - `descriptions`: a WebVTT `kind="descriptions"` script (URL or raw VTT),
18480
+ * delivered at runtime — the video pauses on each cue so the description can
18481
+ * be spoken (extended audio description), then resumes. Used only when
18482
+ * `describedSrc` is absent.
18483
+ */
18484
+ export declare interface VideoPlayerContent {
18485
+ /**
18486
+ * WebVTT URL, or raw WebVTT content, for captions shown during playback.
18487
+ * Localizable — pass a per-locale list to offer captions in several languages.
18488
+ */
18489
+ captions?: Localized<string>;
18490
+ /**
18491
+ * A pre-produced described media source (description mixed into the audio),
18492
+ * swapped in when audio description is enabled. Takes precedence over
18493
+ * `descriptions`. Should match `src`'s duration so the position carries
18494
+ * across the swap. Localizable.
18495
+ */
18496
+ describedSrc?: Localized<string>;
18497
+ /**
18498
+ * WebVTT URL, or raw WebVTT content, of a `kind="descriptions"` script.
18499
+ * Delivered at runtime with extended (pausing) audio description when no
18500
+ * `describedSrc` is provided. Localizable.
18501
+ */
18502
+ descriptions?: Localized<string>;
18503
+ }
18504
+
18290
18505
  declare type VisualizacionTypeDefinition<Props, Settings = Record<string, never>> = {
18291
18506
  render: (props: Props) => JSX.Element;
18292
18507
  name: string;