@nivaro/react 0.1.229 → 0.1.231

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.ts CHANGED
@@ -17,6 +17,7 @@ import { ReportDateRange } from '@nivaro/sdk';
17
17
  import { ReportEntityFilter } from '@nivaro/sdk';
18
18
  import { ReportQueryWidgetConfig } from '@nivaro/sdk';
19
19
  import { UseMutationResult } from '@tanstack/react-query';
20
+ import { UseQueryResult } from '@tanstack/react-query';
20
21
  import { UserScopesInfo } from '@nivaro/sdk';
21
22
 
22
23
  export declare function AccessDeniedPanel({ collection, itemId, onBack }: {
@@ -268,6 +269,28 @@ export declare function AutolinkedText({ text, plain }: {
268
269
  plain?: boolean;
269
270
  }): JSX.Element;
270
271
 
272
+ /**
273
+ * Registry bulk actions (GET /bulk-actions/available) rendered as buttons in
274
+ * a selection bar. Each button opens an anchored popover — what the action
275
+ * does, how many records, the reason field when the action requires one —
276
+ * and runs it via POST /bulk-actions/run (DB-defined) or
277
+ * POST /bulk-actions/:id/execute (extension-registered). Targets may span
278
+ * collections (queues): one run per collection that offers the action.
279
+ */
280
+ declare interface AvailableBulkAction {
281
+ key: string;
282
+ source: 'db' | 'extension' | 'builtin';
283
+ collection: string | null;
284
+ label: string;
285
+ icon: string | null;
286
+ variant: 'default' | 'danger';
287
+ kind: 'update_fields' | 'transition' | 'extension' | 'builtin';
288
+ require_reason: boolean;
289
+ confirm_text: string | null;
290
+ summary: string;
291
+ surfaces?: Array<'browser' | 'queue'>;
292
+ }
293
+
271
294
  export declare function BaseMap({ pins, bubbles, statusLine, onPinClick, onBubbleClick, minHeight, focus }: {
272
295
  pins: BaseMapPin[];
273
296
  bubbles?: BaseMapBubble[];
@@ -316,6 +339,33 @@ export declare function BroadcastView({ className }: {
316
339
 
317
340
  export declare function buildGroups<T extends QueueGroupingRow>(rows: T[], attribute: string): QueueGroup<T>[];
318
341
 
342
+ export declare function BulkActionButtons({ targets, enabledKeys, tone, disabled, onDone }: {
343
+ targets: BulkTarget[];
344
+ /** Surface allow-list (browser_config.bulk_actions / display_config.bulk_action_keys). */
345
+ enabledKeys?: string[] | null;
346
+ /** 'dark' = the collection browser's navy bar; 'light' = the queue pill. */
347
+ tone?: 'dark' | 'light';
348
+ disabled?: boolean;
349
+ onDone?: (result: BulkRunResult & {
350
+ action: AvailableBulkAction;
351
+ }) => void;
352
+ }): JSX.Element | null;
353
+
354
+ declare interface BulkRunResult {
355
+ succeeded: number;
356
+ failed: number;
357
+ skipped: number;
358
+ errors: Array<{
359
+ item: string;
360
+ error: string;
361
+ }>;
362
+ }
363
+
364
+ declare interface BulkTarget {
365
+ collection: string;
366
+ id: string | number;
367
+ }
368
+
319
369
  export declare function canOpenCatalogItem(collection: string | null | undefined): boolean;
320
370
 
321
371
  export declare function canOpenChatRoom(): boolean;
@@ -969,6 +1019,9 @@ export declare interface DataTableProps<T = Record<string, unknown>> {
969
1019
 
970
1020
  export declare function DateField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
971
1021
 
1022
+ /** Decoder for `?prefill=` (base64 → JSON), tolerant of '+' arriving as ' '. */
1023
+ export declare function decodePrefill(raw: string | null | undefined): Record<string, unknown> | null;
1024
+
972
1025
  /** The admin's route shape — the default when the host supplies no itemUrl. */
973
1026
  export declare function defaultItemUrl(t: ItemLinkTarget): string;
974
1027
 
@@ -1077,6 +1130,9 @@ export declare function EmptyState({ icon: Icon, title, detail, action }: {
1077
1130
  action?: ReactNode;
1078
1131
  }): JSX.Element;
1079
1132
 
1133
+ /** `?prefill=` payload encoder — base64 of the JSON, URL-encoded. */
1134
+ export declare function encodePrefill(values: Record<string, unknown>): string;
1135
+
1080
1136
  export declare function ErpFailureBanner({ collection, itemId }: {
1081
1137
  collection: string;
1082
1138
  itemId: string;
@@ -2002,6 +2058,10 @@ export declare type ItemLinkTarget = {
2002
2058
  itemId: string;
2003
2059
  /** Grouped-layout slug to pin (queue item_layout etc.); null/absent = default. */
2004
2060
  layoutSlug?: string | null;
2061
+ /** New-record seed (itemId 'new'): scalar values plus `__links` (m2m ids
2062
+ * keyed by staging key). Rides the URL as `?prefill=<base64 JSON>`, the
2063
+ * shape both hosts already consume. */
2064
+ prefill?: Record<string, unknown> | null;
2005
2065
  };
2006
2066
 
2007
2067
  export declare function ItemLockBanner({ lockHolder, onTakeOver, takingOver, isAdmin, onRequestLock, requesting }: {
@@ -3119,7 +3179,7 @@ export declare function QueryWidgetView({ config }: {
3119
3179
  config: QueryWidgetConfig;
3120
3180
  }): JSX.Element;
3121
3181
 
3122
- export declare function QueueBulkBar({ count, states, busy, claimsEnabled, onClaim, onRelease, onTransition, onClear }: {
3182
+ export declare function QueueBulkBar({ count, states, busy, claimsEnabled, showClaim, showRelease, showTransition, onClaim, onRelease, onTransition, onClear, children }: {
3123
3183
  count: number;
3124
3184
  states: Array<{
3125
3185
  value: string;
@@ -3127,10 +3187,16 @@ export declare function QueueBulkBar({ count, states, busy, claimsEnabled, onCla
3127
3187
  }>;
3128
3188
  busy: boolean;
3129
3189
  claimsEnabled?: boolean;
3190
+ /** Built-in gates from the bulk-actions registry (useBuiltinGate). */
3191
+ showClaim?: boolean;
3192
+ showRelease?: boolean;
3193
+ showTransition?: boolean;
3130
3194
  onClaim: () => void;
3131
3195
  onRelease: () => void;
3132
3196
  onTransition: (state: string) => void;
3133
3197
  onClear: () => void;
3198
+ /** Registry bulk actions (BulkActionButtons) rendered before Transition. */
3199
+ children?: ReactNode;
3134
3200
  }): JSX.Element | null;
3135
3201
 
3136
3202
  export declare interface QueueGroup<T extends QueueGroupingRow = QueueGroupingRow> {
@@ -3250,6 +3316,55 @@ declare interface QuickFilterDef {
3250
3316
  sort?: string;
3251
3317
  }
3252
3318
 
3319
+ export declare function QuickPicker({ collection, itemId, steps, fieldConfig, relations, draft, getM2M, onChange, onM2MChange, fieldLabels, fieldOptionFilters, onCompleteChange, onFinish, finishLabel, finishRequiresComplete, className }: QuickPickerProps): JSX.Element | null;
3320
+
3321
+ export declare function QuickPickerDialog({ collection, layoutSlug, open, onOpenChange, onDone, noun, anchorEl }: QuickPickerDialogProps): JSX.Element;
3322
+
3323
+ export declare interface QuickPickerDialogProps {
3324
+ collection: string;
3325
+ layoutSlug?: string | null;
3326
+ open: boolean;
3327
+ onOpenChange: (open: boolean) => void;
3328
+ /** Called with the picks: scalar values + `__links` (staging key → ids). */
3329
+ onDone: (prefill: Record<string, unknown>) => void;
3330
+ /** Noun for the title + button ("workflow"). */
3331
+ noun?: string;
3332
+ /**
3333
+ * Element to anchor beside (the "+ New" button). With an anchor the picker
3334
+ * is a compact popover next to it; without one it falls back to a dialog.
3335
+ */
3336
+ anchorEl?: HTMLElement | null;
3337
+ }
3338
+
3339
+ export declare interface QuickPickerProps {
3340
+ collection: string;
3341
+ /** 'new' for an unsaved record. */
3342
+ itemId: string;
3343
+ /** Ordered field keys (the layout's quick_picker). */
3344
+ steps: string[];
3345
+ fieldConfig: CMSField[];
3346
+ relations: CMSRelation[];
3347
+ draft: Record<string, unknown>;
3348
+ /** Effective ids for an M2M alias (committed ± staged); undefined = unknown. */
3349
+ getM2M: (field: string) => string[] | undefined;
3350
+ onChange: (field: string, value: unknown) => void;
3351
+ onM2MChange: (field: string, ids: string[]) => void;
3352
+ /** Layout-effective labels + option filters (ParentDraftContext shape). */
3353
+ fieldLabels?: Record<string, string>;
3354
+ fieldOptionFilters?: Record<string, Record<string, unknown>>;
3355
+ /** Fires whenever completeness changes. */
3356
+ onCompleteChange?: (complete: boolean) => void;
3357
+ /**
3358
+ * Primary action rendered in the Next slot once the chain is complete (or on
3359
+ * the last slide): "Done" in the form, "Create workflow" before a record
3360
+ * exists. Disabled until complete unless `finishRequiresComplete` is false.
3361
+ */
3362
+ onFinish?: () => void;
3363
+ finishLabel?: string;
3364
+ finishRequiresComplete?: boolean;
3365
+ className?: string;
3366
+ }
3367
+
3253
3368
  /**
3254
3369
  * Tier a team against a cell's filter values. `out` carries the human
3255
3370
  * mismatches ("doesn't cover BLT"). Filters without a resolvable id don't
@@ -3848,6 +3963,18 @@ export declare type SectionState = {
3848
3963
  expandAll: () => void;
3849
3964
  };
3850
3965
 
3966
+ export declare function seedQuickPickerSteps(fieldConfig: Array<{
3967
+ field: string;
3968
+ dependency_config?: unknown;
3969
+ hidden?: boolean;
3970
+ }>, relations: Array<{
3971
+ many_collection: string;
3972
+ many_field: string | null;
3973
+ one_collection: string | null;
3974
+ one_field: string | null;
3975
+ junction_field: string | null;
3976
+ }>, collection: string): string[];
3977
+
3851
3978
  export declare function SelectField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
3852
3979
 
3853
3980
  /**
@@ -4141,6 +4268,9 @@ export declare function useApiFetchConfig(): {
4141
4268
 
4142
4269
  export declare function useApiUpdate(): ApiVersionInfo | null;
4143
4270
 
4271
+ /** Available actions per collection, for the viewer. */
4272
+ export declare function useAvailableBulkActions(collections: string[]): UseQueryResult<NoInfer<Record<string, AvailableBulkAction[]>>, Error>;
4273
+
4144
4274
  export declare function useChannelAdmin(channelId: number | null): {
4145
4275
  update: UseMutationResult<unknown, Error, {
4146
4276
  name?: string;
@@ -4439,6 +4569,19 @@ export declare function useOverlayState<T>(key: string): {
4439
4569
 
4440
4570
  export declare function usePeerReadAt(room: string | null): string | null;
4441
4571
 
4572
+ /**
4573
+ * The quick picker BEFORE a record exists — the "+ New" menus open it, and on
4574
+ * Create the host navigates to the new-record page with the picks in
4575
+ * `?prefill=` (scalars) plus `__links` (M2M ids keyed by staging key, the key
4576
+ * ItemEditForm's initialLinks resolves). Reads the layout's `quick_picker`
4577
+ * steps itself, so hosts only need the collection (and optional layout slug).
4578
+ */
4579
+ export declare function useQuickPickerSteps(collection: string | null | undefined, layoutSlug?: string | null): {
4580
+ steps: string[];
4581
+ layoutId: number | null;
4582
+ loading: boolean;
4583
+ };
4584
+
4442
4585
  /**
4443
4586
  * Real profile photo (Microsoft Graph, captured at login) with the caller's
4444
4587
  * initials disc as the fallback. The photo arrives as a small data URI from