@ordinatio/ui 1.9.0 → 1.11.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/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { Component, ReactNode, ErrorInfo, ComponentType, CSSProperties, ElementType, RefObject, FormEvent, KeyboardEvent as KeyboardEvent$1 } from 'react';
4
+ import { B as BoardTexts, a as BoardClassNames, b as BoardColumnData, M as MoveHandler, c as BoardCard, d as MoveTarget, A as AddCardHandler, R as RenderCardTitle, e as BoardDnd, C as CardShellProps, f as AddCardInput, g as BoardResult } from './board-types-MZA9M0cR.mjs';
5
+ export { h as BoardColumnKind, i as ColumnShellProps, D as DropRule, j as MoveRequest } from './board-types-MZA9M0cR.mjs';
4
6
 
5
7
  interface ErrorBoundaryProps {
6
8
  children: ReactNode;
@@ -1323,4 +1325,161 @@ declare const ACTIVITY_ICONS: Record<string, IconComponent>;
1323
1325
  /** Return the icon component for a given icon name, or Activity as fallback. */
1324
1326
  declare function resolveActivityIcon(name: string): IconComponent;
1325
1327
 
1326
- export { ACTIVITY_ICONS, ALL_SHORTCUT_CONTEXTS, ARRIVAL_FADE_MS, type ActivityFeedChip, ActivityFeedRow, type ActivityFeedRowClassNames, type ActivityFeedRowProps, ArchiveButton, type ArchiveButtonProps, CLIENT_PROFILE_SHORTCUTS, COPY_NOTE_COPIED, COPY_NOTE_FAILED, type CachedFetchOptions, type ComposeMode, ConfirmAction, type ConfirmActionClassNames, type ConfirmActionProps, type ConfirmActionResult, EmailBodyRenderer, type EmailBodyRendererProps, EmailThreadView, type EmailThreadViewProps, EntityPicker, type EntityPickerClassNames, type EntityPickerProps, ErrorBoundary, type ErrorBoundaryProps, FORM_SHORTCUTS, GLOBAL_SHORTCUTS, GUARDED_ACTION_FAILURE, INBOX_SHORTCUTS, type KeyboardShortcut, KeyboardShortcutsPanel, PICKER_SEARCH_FAILURE, Pager, type PagerClassNames, type PagerLabels, type PagerLinkProps, type PagerProps, type PickerSearchResult, RENDER_ERRORS, REPLY_LAYOUT_OPTIONS, type RenderErrorResult, type ReplyLayout, ReplyPanel, type ReplyPanelProps, type ReplySendOverrides, RestoreButton, type RestoreButtonClassNames, type RestoreButtonLabels, type RestoreButtonProps, RichTextEditor, type RichTextEditorProps, type SchedulePreset, type ShortcutContext, type ShortcutDefinition, ShowOnceSecret, type ShowOnceSecretClassNames, type ShowOnceSecretLabels, type ShowOnceSecretProps, type ThreadMessage, TrashedBanner, type TrashedBannerClassNames, type TrashedBannerLabels, type TrashedBannerProps, UndoNotice, type UndoNoticeClassNames, type UndoNoticeLabels, type UndoNoticeProps, type UseAutoSaveOptions, type UseAutoSaveResult, type UseCopyToClipboardOptions, type UseCopyToClipboardResult, type UseGuardedActionOptions, type UseGuardedActionResult, type UseKeyboardShortcutsOptions, type UsePickerSessionOptions, type UsePickerSessionResult, type UsePollingOptions, type UsePollingResult, type UsePreferencesOptions, type UsePreferencesResult, type UseServerSearchOptions, type UseServerSearchResult, type UseSignedAnswerOptions, type UseSignedAnswerResult, cachedFetch, canViewInline, clearCache, formatDateGroup, formatFileSize, formatPhone, formatPhoneInput, formatTrashedDate, getNextMondayMorning, getNextWeekday, getQuickScheduleOptions, getShortcut, getTomorrowMorning, groupByDate, invalidateCache, isAudio, isDocument, isEmptyHtml, isImage, isInlineLayout, isModalLayout, isPdf, isPopoutLayout, isSpreadsheet, isTypingContext, isValidScheduleDate, isVideo, opensInNewTab, parseCustomSchedule, prefetch, renderError, resolveActivityIcon, resolveContentType, stripHtml, stripPhone, truncatePreview, useArrival, useAutoSave, useContextShortcuts, useCopyToClipboard, useFormActionKeepingInput, useGuardedAction, useIframeFocusReclaim, useKeyboardShortcuts, usePickerSession, usePolling, usePreferences, useSavedNotice, useServerSearch, useSignedAnswer, useSyncedSelect, withErrorBoundary };
1328
+ interface LostReasonChoice {
1329
+ code: string;
1330
+ /** Words for the code; when missing, `humanize(code)` is used. */
1331
+ label?: string;
1332
+ }
1333
+ interface LostStepProps {
1334
+ suggestions: ReadonlyArray<LostReasonChoice>;
1335
+ used: ReadonlyArray<LostReasonChoice>;
1336
+ validateReason: (text: string) => string | null;
1337
+ humanize: (code: string) => string;
1338
+ texts: BoardTexts;
1339
+ classNames?: BoardClassNames;
1340
+ /** The move was refused: the sentence stays visible in the open step. */
1341
+ error?: string;
1342
+ /** The move is running: the buttons are disabled. */
1343
+ busy?: boolean;
1344
+ /** The stage the card is moving to; with `texts.lostTitleFor` it names the target in the title. */
1345
+ stageName?: string;
1346
+ onConfirm: (reasonCode: string) => void;
1347
+ onCancel: () => void;
1348
+ }
1349
+ declare function LostStep({ suggestions, used, validateReason, humanize, texts, classNames, error, busy, stageName, onConfirm, onCancel }: LostStepProps): react_jsx_runtime.JSX.Element;
1350
+
1351
+ interface BoardLostConfig {
1352
+ suggestions: ReadonlyArray<LostReasonChoice>;
1353
+ used: ReadonlyArray<LostReasonChoice>;
1354
+ validateReason: (text: string) => string | null;
1355
+ humanize: (code: string) => string;
1356
+ }
1357
+ interface ReopenOptions {
1358
+ /** True for a deal closed in a Won or Lost stage: it must come back into one of `stages`. False: a plain Reopen with no stage. */
1359
+ needsStage: boolean;
1360
+ stages: ReadonlyArray<MoveTarget>;
1361
+ }
1362
+ interface ReopenRequest {
1363
+ dealId: string;
1364
+ expectedVersion: number;
1365
+ /** Present only when the deal had to come back into a stage. */
1366
+ toStageId?: string;
1367
+ }
1368
+ interface PipelineBoardProps {
1369
+ columns: ReadonlyArray<BoardColumnData>;
1370
+ texts: BoardTexts;
1371
+ classNames?: BoardClassNames;
1372
+ /** Moves in flight that the app knows about (for example from another tab's request): those cards look pending. */
1373
+ pendingDealIds?: ReadonlyArray<string>;
1374
+ /** Refusals the app wants shown under cards, by deal id. */
1375
+ cardErrors?: Readonly<Record<string, string>>;
1376
+ onMove?: MoveHandler;
1377
+ /** The legal stages a card may be moved to; empty or missing hides the menu. The app's rule decides. */
1378
+ legalTargets?: (card: BoardCard) => ReadonlyArray<MoveTarget>;
1379
+ /** Present: a closed card (badge won or lost) shows a Reopen button. Returns null when the card cannot be reopened. */
1380
+ reopenFor?: (card: BoardCard) => ReopenOptions | null;
1381
+ onReopen?: (request: ReopenRequest) => Promise<{
1382
+ error?: string;
1383
+ } | void>;
1384
+ /** Present: a move into a LOST column asks for a reason first. */
1385
+ lost?: BoardLostConfig;
1386
+ onAddCard?: AddCardHandler;
1387
+ currencies?: ReadonlyArray<string>;
1388
+ defaultCurrency?: string;
1389
+ /** True: the add form closes after a card is added (default: it stays open for the next card). */
1390
+ closeOnAdd?: boolean;
1391
+ /** False: columns keep their own height. Default true: every column stretches to the height of the tallest. */
1392
+ stretchColumns?: boolean;
1393
+ onShowMore?: (stageId: string) => void;
1394
+ renderCardTitle?: RenderCardTitle;
1395
+ /** Drawn at the right end of the row (for example the "Add another stage" link). */
1396
+ endSlot?: ReactNode;
1397
+ /** The drag layer from `@ordinatio/ui/board-dnd`. Leave out and the board is complete without it. */
1398
+ dnd?: BoardDnd;
1399
+ }
1400
+ declare function PipelineBoard(props: PipelineBoardProps): react_jsx_runtime.JSX.Element;
1401
+
1402
+ interface BoardColumnProps {
1403
+ column: BoardColumnData;
1404
+ texts: BoardTexts;
1405
+ classNames?: BoardClassNames;
1406
+ /** Draws one card (the board decides the card's controls, pending look and error). */
1407
+ renderCard: (card: BoardColumnData['cards'][number]) => ReactNode;
1408
+ onAddCard?: AddCardHandler;
1409
+ currencies?: ReadonlyArray<string>;
1410
+ defaultCurrency?: string;
1411
+ closeOnAdd?: boolean;
1412
+ /** Drawn first in the card list (for example the marker of a card that is about to arrive). */
1413
+ incoming?: ReactNode;
1414
+ onShowMore?: (stageId: string) => void;
1415
+ dnd?: Pick<BoardDnd, 'Column'>;
1416
+ }
1417
+ declare function BoardColumn({ column, texts, classNames, renderCard, onAddCard, currencies, defaultCurrency, closeOnAdd, incoming, onShowMore, dnd }: BoardColumnProps): react_jsx_runtime.JSX.Element;
1418
+
1419
+ interface DealCardProps {
1420
+ card: BoardCard;
1421
+ texts: BoardTexts;
1422
+ classNames?: BoardClassNames;
1423
+ /** The move is in flight. */
1424
+ pending?: boolean;
1425
+ /** The card is being dragged (set by the drag layer). */
1426
+ dragging?: boolean;
1427
+ /** A refusal a person can read, drawn under the card. */
1428
+ error?: string;
1429
+ /** Wraps the title, for example in a link. */
1430
+ renderTitle?: RenderCardTitle;
1431
+ /** The card's own controls (for example the move menu). Not drawn while pending, unless `keepControls`. */
1432
+ controls?: ReactNode;
1433
+ /** Draw `controls` even while pending (an open step that must stay on screen while its move runs). */
1434
+ keepControls?: boolean;
1435
+ /** Dimmed look without hiding the controls: a step on this card is waiting for its answer. */
1436
+ waiting?: boolean;
1437
+ /** Ref and attributes from the drag layer (the plain board passes none). */
1438
+ shellProps?: CardShellProps;
1439
+ }
1440
+ declare function DealCard({ card, texts, classNames, pending, dragging, error, renderTitle, controls, keepControls, waiting, shellProps }: DealCardProps): react_jsx_runtime.JSX.Element;
1441
+
1442
+ interface AddCardBoxProps {
1443
+ /** Used to tell several boxes apart in the accessible names, for example the column name. */
1444
+ columnName: string;
1445
+ texts: BoardTexts;
1446
+ classNames?: BoardClassNames;
1447
+ /** Currency codes offered; empty hides the currency field. */
1448
+ currencies?: ReadonlyArray<string>;
1449
+ defaultCurrency?: string;
1450
+ /** True: after a successful add the form closes and focus goes back to the "+ Add a card" button. Default false (stays open for the next card). */
1451
+ closeOnAdd?: boolean;
1452
+ onAdd: (input: AddCardInput) => Promise<BoardResult>;
1453
+ }
1454
+ declare function AddCardBox({ columnName, texts, classNames, currencies, defaultCurrency, closeOnAdd, onAdd }: AddCardBoxProps): react_jsx_runtime.JSX.Element;
1455
+
1456
+ interface MoveMenuProps {
1457
+ /** Used in the accessible name so several menus on a page are told apart, for example the card title. */
1458
+ cardTitle: string;
1459
+ targets: ReadonlyArray<MoveTarget>;
1460
+ texts: BoardTexts;
1461
+ classNames?: BoardClassNames;
1462
+ /** Disables the menu while a move runs. */
1463
+ busy?: boolean;
1464
+ onChoose: (stageId: string) => void;
1465
+ }
1466
+ declare function MoveMenu({ cardTitle, targets, texts, classNames, busy, onChoose }: MoveMenuProps): react_jsx_runtime.JSX.Element | null;
1467
+
1468
+ interface ReopenStepProps {
1469
+ needsStage: boolean;
1470
+ /** Live open stages the deal may come back into. */
1471
+ stages: ReadonlyArray<MoveTarget>;
1472
+ texts: BoardTexts;
1473
+ classNames?: BoardClassNames;
1474
+ error?: string;
1475
+ busy?: boolean;
1476
+ /** `toStageId` is given only when `needsStage` is true. */
1477
+ onConfirm: (toStageId?: string) => void;
1478
+ onCancel: () => void;
1479
+ }
1480
+ declare function ReopenStep({ needsStage, stages, texts, classNames, error, busy, onConfirm, onCancel }: ReopenStepProps): react_jsx_runtime.JSX.Element;
1481
+
1482
+ /** The index of the column whose start is nearest to `scrollLeft`. Ties go to the earlier column. */
1483
+ declare function nearestColumnIndex(scrollLeft: number, offsets: ReadonlyArray<number>): number;
1484
+
1485
+ export { ACTIVITY_ICONS, ALL_SHORTCUT_CONTEXTS, ARRIVAL_FADE_MS, type ActivityFeedChip, ActivityFeedRow, type ActivityFeedRowClassNames, type ActivityFeedRowProps, AddCardBox, type AddCardBoxProps, AddCardHandler, AddCardInput, ArchiveButton, type ArchiveButtonProps, BoardCard, BoardClassNames, BoardColumn, BoardColumnData, type BoardColumnProps, BoardDnd, type BoardLostConfig, BoardResult, BoardTexts, CLIENT_PROFILE_SHORTCUTS, COPY_NOTE_COPIED, COPY_NOTE_FAILED, type CachedFetchOptions, CardShellProps, type ComposeMode, ConfirmAction, type ConfirmActionClassNames, type ConfirmActionProps, type ConfirmActionResult, DealCard, type DealCardProps, EmailBodyRenderer, type EmailBodyRendererProps, EmailThreadView, type EmailThreadViewProps, EntityPicker, type EntityPickerClassNames, type EntityPickerProps, ErrorBoundary, type ErrorBoundaryProps, FORM_SHORTCUTS, GLOBAL_SHORTCUTS, GUARDED_ACTION_FAILURE, INBOX_SHORTCUTS, type KeyboardShortcut, KeyboardShortcutsPanel, type LostReasonChoice, LostStep, type LostStepProps, MoveHandler, MoveMenu, type MoveMenuProps, MoveTarget, PICKER_SEARCH_FAILURE, Pager, type PagerClassNames, type PagerLabels, type PagerLinkProps, type PagerProps, type PickerSearchResult, PipelineBoard, type PipelineBoardProps, RENDER_ERRORS, REPLY_LAYOUT_OPTIONS, RenderCardTitle, type RenderErrorResult, type ReopenOptions, type ReopenRequest, ReopenStep, type ReopenStepProps, type ReplyLayout, ReplyPanel, type ReplyPanelProps, type ReplySendOverrides, RestoreButton, type RestoreButtonClassNames, type RestoreButtonLabels, type RestoreButtonProps, RichTextEditor, type RichTextEditorProps, type SchedulePreset, type ShortcutContext, type ShortcutDefinition, ShowOnceSecret, type ShowOnceSecretClassNames, type ShowOnceSecretLabels, type ShowOnceSecretProps, type ThreadMessage, TrashedBanner, type TrashedBannerClassNames, type TrashedBannerLabels, type TrashedBannerProps, UndoNotice, type UndoNoticeClassNames, type UndoNoticeLabels, type UndoNoticeProps, type UseAutoSaveOptions, type UseAutoSaveResult, type UseCopyToClipboardOptions, type UseCopyToClipboardResult, type UseGuardedActionOptions, type UseGuardedActionResult, type UseKeyboardShortcutsOptions, type UsePickerSessionOptions, type UsePickerSessionResult, type UsePollingOptions, type UsePollingResult, type UsePreferencesOptions, type UsePreferencesResult, type UseServerSearchOptions, type UseServerSearchResult, type UseSignedAnswerOptions, type UseSignedAnswerResult, cachedFetch, canViewInline, clearCache, formatDateGroup, formatFileSize, formatPhone, formatPhoneInput, formatTrashedDate, getNextMondayMorning, getNextWeekday, getQuickScheduleOptions, getShortcut, getTomorrowMorning, groupByDate, invalidateCache, isAudio, isDocument, isEmptyHtml, isImage, isInlineLayout, isModalLayout, isPdf, isPopoutLayout, isSpreadsheet, isTypingContext, isValidScheduleDate, isVideo, nearestColumnIndex, opensInNewTab, parseCustomSchedule, prefetch, renderError, resolveActivityIcon, resolveContentType, stripHtml, stripPhone, truncatePreview, useArrival, useAutoSave, useContextShortcuts, useCopyToClipboard, useFormActionKeepingInput, useGuardedAction, useIframeFocusReclaim, useKeyboardShortcuts, usePickerSession, usePolling, usePreferences, useSavedNotice, useServerSearch, useSignedAnswer, useSyncedSelect, withErrorBoundary };