@harnessio/ui 1.3.7 → 1.3.8

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
@@ -704,6 +704,12 @@ declare interface CardData extends Omit<CardRootProps, 'title' | 'children'> {
704
704
  gripPosition?: 'inside' | 'outside';
705
705
  }
706
706
 
707
+ declare interface CardEntry {
708
+ stepId: string;
709
+ status: CardStatus;
710
+ stateSnapshot: Record<string, unknown>;
711
+ }
712
+
707
713
  declare interface CardImageProps extends ImgHTMLAttributes<HTMLImageElement> {
708
714
  width?: number | string;
709
715
  height?: number | string;
@@ -1244,6 +1250,8 @@ declare namespace components {
1244
1250
  SinglePaneStepper,
1245
1251
  SinglePaneStepperRootProps,
1246
1252
  FlowStepperCardProps as SinglePaneStepperCardProps,
1253
+ FlowEngineProvider,
1254
+ useEngineContext,
1247
1255
  AlertRootProps,
1248
1256
  AlertDescriptionProps,
1249
1257
  AlertTitleProps,
@@ -2481,6 +2489,12 @@ declare interface DrawerResult {
2481
2489
  data?: Record<string, unknown>;
2482
2490
  }
2483
2491
 
2492
+ declare interface DrawerState {
2493
+ id: string;
2494
+ props?: Record<string, unknown>;
2495
+ resolve: (result: DrawerResult) => void;
2496
+ }
2497
+
2484
2498
  declare type DrawerStepProps = {
2485
2499
  value: string;
2486
2500
  title: ReactNode;
@@ -2654,6 +2668,27 @@ declare const encodePath: (path: string) => string;
2654
2668
 
2655
2669
  declare const encodeResourcePath: (resourcePath?: string) => string;
2656
2670
 
2671
+ declare interface EngineContextValue {
2672
+ flow: FlowConfig;
2673
+ state: Record<string, unknown>;
2674
+ cardHistory: CardEntry[];
2675
+ activeStepId: string;
2676
+ predictedPath: string[];
2677
+ drawerState: DrawerState | null;
2678
+ pendingReactivation: string | null;
2679
+ complete: (stepId: string, statePatch?: Record<string, unknown>, nextStepId?: string) => void;
2680
+ error: (stepId: string, nextStepId?: string) => void;
2681
+ skip: (stepId: string, nextStepId?: string) => void;
2682
+ openDrawer: (id: string, props?: Record<string, unknown>) => Promise<DrawerResult>;
2683
+ closeDrawer: (result: DrawerResult) => void;
2684
+ requestReactivation: (stepId: string) => void;
2685
+ confirmReactivation: () => void;
2686
+ cancelReactivation: () => void;
2687
+ scrollToCard: (stepId: string) => void;
2688
+ registerScrollToCard: (fn: (stepId: string) => void) => void;
2689
+ disableAutoScroll: boolean;
2690
+ }
2691
+
2657
2692
  declare const EntityFormLayout: {
2658
2693
  Header: ({ children, className }: {
2659
2694
  children: ReactNode;
@@ -2947,6 +2982,16 @@ declare interface FlowCardContext<TState = Record<string, unknown>> {
2947
2982
 
2948
2983
  declare type FlowConfig = GroupedFlowConfig | FlatFlowConfig;
2949
2984
 
2985
+ declare function FlowEngineProvider({ flow, onComplete, disableAutoScroll, initialEngineState, children }: FlowEngineProviderProps): JSX_2.Element;
2986
+
2987
+ declare interface FlowEngineProviderProps {
2988
+ flow: FlowConfig;
2989
+ onComplete?: (state: Record<string, unknown>) => void;
2990
+ disableAutoScroll?: boolean;
2991
+ initialEngineState?: InitialEngineState;
2992
+ children: ReactNode;
2993
+ }
2994
+
2950
2995
  declare function FlowStepperCard({ title, description, blockedMessage, children, className }: FlowStepperCardProps): JSX_2.Element;
2951
2996
 
2952
2997
  declare function FlowStepperCardAction({ variant, message, actionLabel, onAction, secondaryLabel, onSecondary }: FlowStepperCardActionProps): JSX_2.Element;
@@ -4186,6 +4231,19 @@ declare type InfoToastSeverity = 'Critical' | 'High' | 'Medium' | 'Low';
4186
4231
 
4187
4232
  declare const INITIAL_ZOOM_LEVEL = 1;
4188
4233
 
4234
+ /**
4235
+ * A serialized snapshot of engine state that a host app can pass to `FlowEngineProvider` (or
4236
+ * `SinglePaneStepper.Root`) to resume a flow instead of starting at `flow.initialStep`.
4237
+ *
4238
+ * Canary does not persist this itself — the host app is responsible for storage/validation and
4239
+ * only passes an already-valid snapshot. An unusable snapshot (empty `cardHistory`, or any
4240
+ * `stepId` not present in the current `flow.steps`) is treated as omitted.
4241
+ */
4242
+ declare interface InitialEngineState {
4243
+ state: Record<string, unknown>;
4244
+ cardHistory: CardEntry[];
4245
+ }
4246
+
4189
4247
  /**
4190
4248
  * A form input component with support for labels, captions, and error messages.
4191
4249
  * @example
@@ -6895,7 +6953,7 @@ declare const SinglePaneStepper: {
6895
6953
  CardAction: typeof FlowStepperCardAction;
6896
6954
  };
6897
6955
 
6898
- declare function SinglePaneStepperRoot({ flow, onComplete, disableAutoScroll, ...props }: SinglePaneStepperRootProps): JSX_2.Element;
6956
+ declare function SinglePaneStepperRoot({ flow, onComplete, disableAutoScroll, initialEngineState, children, ...props }: SinglePaneStepperRootProps): JSX_2.Element;
6899
6957
 
6900
6958
  declare interface SinglePaneStepperRootProps {
6901
6959
  flow: FlowConfig;
@@ -6937,6 +6995,11 @@ declare interface SinglePaneStepperRootProps {
6937
6995
  className?: string;
6938
6996
  /** Inline-style escape hatch alongside `className`, for consumers that need computed values. */
6939
6997
  style?: CSSProperties;
6998
+ /** Rendered after the visual content, inside `FlowEngineProvider` — for context-only consumers
6999
+ * (e.g. a persist bridge) that need engine access without affecting layout. */
7000
+ children?: ReactNode;
7001
+ /** Seeds the engine's state and card history on mount, restoring a previously persisted run. */
7002
+ initialEngineState?: InitialEngineState;
6940
7003
  }
6941
7004
 
6942
7005
  declare const Skeleton: {
@@ -8447,6 +8510,8 @@ declare interface UseDragAndDropProps<T> {
8447
8510
  onReorder?: (items: T[]) => void;
8448
8511
  }
8449
8512
 
8513
+ declare function useEngineContext(): EngineContextValue;
8514
+
8450
8515
  declare function useEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown, element?: HTMLElement, options?: boolean | AddEventListenerOptions, parametersCheck?: () => boolean): void;
8451
8516
 
8452
8517
  declare const useExitConfirm: () => ExitConfirmContextType;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as s } from "./index-CdF49wK7.js";
2
- import { i as e } from "./index-Ci0lYeZK.js";
2
+ import { i as e } from "./index-CekmEi-h.js";
3
3
  import { i as a } from "./index-D_eFtVWM.js";
4
4
  import { i as m } from "./index-C4bDY5-3.js";
5
5
  import { i as f } from "./index-DchZrYRY.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harnessio/ui",
3
3
  "description": "Harness Canary UI component library",
4
- "version": "1.3.7",
4
+ "version": "1.3.8",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",