@tailor-platform/app-shell 1.5.0 → 1.6.1

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.
@@ -188,6 +188,44 @@ export declare interface ActivityCardRootProps<T extends ActivityCardBaseItem> {
188
188
  */
189
189
  declare function ActivityCardStandalone({ items, title, maxVisible, overflowLabel, groupBy, className, }: ActivityCardProps): JSX.Element;
190
190
 
191
+ export declare type AIChatCompletionEvent = {
192
+ type: "text-delta";
193
+ text: string;
194
+ } | {
195
+ type: "done";
196
+ finishReason?: string;
197
+ };
198
+
199
+ export declare interface AIChatMessage {
200
+ id: string;
201
+ role: "user" | "assistant";
202
+ content: string;
203
+ }
204
+
205
+ export declare type AIChatStatus = "ready" | "submitted" | "streaming" | "error";
206
+
207
+ export declare type AIGatewayChatMessage = {
208
+ role: "system" | "user";
209
+ content: string;
210
+ } | {
211
+ role: "assistant";
212
+ content?: string;
213
+ };
214
+
215
+ export declare interface AIGatewayChatRequest {
216
+ model: string;
217
+ messages: AIGatewayChatMessage[];
218
+ stream?: boolean;
219
+ signal?: AbortSignal;
220
+ }
221
+
222
+ export declare interface AIGatewayClient {
223
+ /**
224
+ * Honor request.signal when possible so callers can stop work early.
225
+ */
226
+ streamChatCompletion(request: AIGatewayChatRequest): AsyncIterable<AIChatCompletionEvent>;
227
+ }
228
+
191
229
  export declare const Alert: {
192
230
  Root: typeof Root;
193
231
  Title: typeof Title;
@@ -784,6 +822,12 @@ declare namespace Body_2 {
784
822
  var displayName: string;
785
823
  }
786
824
 
825
+ /**
826
+ * Responsive breakpoints, aligned with Tailwind's default breakpoints.
827
+ * `initial` is the base (mobile-first) value applied below the `sm` breakpoint.
828
+ */
829
+ declare type Breakpoint = "initial" | "sm" | "md" | "lg" | "xl" | "2xl";
830
+
787
831
  /**
788
832
  * Builds a Tailor Platform QueryInput-compatible type from table metadata.
789
833
  */
@@ -838,12 +882,18 @@ export declare const Card: {
838
882
  };
839
883
 
840
884
  /** A table data cell (`<td>`). */
841
- declare function Cell({ className, ...props }: React_2.ComponentProps<"td">): JSX.Element;
885
+ declare function Cell({ className, align, ...props }: CellProps): JSX.Element;
842
886
 
843
887
  declare namespace Cell {
844
888
  var displayName: string;
845
889
  }
846
890
 
891
+ declare type CellAlign = "left" | "center" | "right";
892
+
893
+ declare type CellProps = React_2.ComponentProps<"td"> & {
894
+ align?: CellAlign;
895
+ };
896
+
847
897
  /** A menu item that toggles a setting on or off. */
848
898
  declare function CheckboxItem({ className, ...props }: React_2.ComponentProps<typeof Menu_2.CheckboxItem>): JSX.Element;
849
899
 
@@ -949,6 +999,35 @@ export declare function CollectionControlProvider({ value, children, }: {
949
999
  children: ReactNode;
950
1000
  }): JSX.Element;
951
1001
 
1002
+ /**
1003
+ * Partial initial state used to seed `useCollectionVariables`.
1004
+ */
1005
+ export declare type CollectionInitialState<TFieldName extends string = string, TFilter extends Filter<TFieldName> = Filter<TFieldName>> = Partial<CollectionPersistedState<TFieldName, TFilter>>;
1006
+
1007
+ /**
1008
+ * Initial and change payload shape for `useCollectionVariables`.
1009
+ */
1010
+ export declare interface CollectionParams<TFieldName extends string = string, TFilter extends Filter<TFieldName> = Filter<TFieldName>> {
1011
+ initialFilters?: TFilter[];
1012
+ initialSort?: {
1013
+ field: TFieldName;
1014
+ direction: "Asc" | "Desc";
1015
+ }[];
1016
+ pageSize?: number;
1017
+ }
1018
+
1019
+ /**
1020
+ * Serializable subset of collection state used for initialization and persistence.
1021
+ */
1022
+ export declare interface CollectionPersistedState<TFieldName extends string = string, TFilter extends Filter<TFieldName> = Filter<TFieldName>> {
1023
+ filters: TFilter[];
1024
+ sortStates: {
1025
+ field: TFieldName;
1026
+ direction: "Asc" | "Desc";
1027
+ }[];
1028
+ pageSize: number;
1029
+ }
1030
+
952
1031
  /**
953
1032
  * GraphQL collection result format (Tailor Platform standard).
954
1033
  */
@@ -1592,6 +1671,11 @@ declare interface CreatableProps<T extends object> {
1592
1671
  formatCreateLabel?: (value: string) => string;
1593
1672
  }
1594
1673
 
1674
+ export declare function createAIGatewayClient(config: {
1675
+ gatewayUri: string;
1676
+ authClient: AuthClient;
1677
+ }): AIGatewayClient;
1678
+
1595
1679
  /**
1596
1680
  * Create an enhanced authentication client.
1597
1681
  *
@@ -2343,6 +2427,76 @@ declare type DialogRootProps = Pick<React_2.ComponentProps<typeof Dialog_2.Root>
2343
2427
  children: React_2.ReactNode;
2344
2428
  };
2345
2429
 
2430
+ /**
2431
+ * DocumentProgressCard — a generic, presentational card for a document's
2432
+ * lifecycle/fulfilment state: an optional headline percentage, a stacked
2433
+ * progress bar, and a status legend.
2434
+ *
2435
+ * View-only and domain-agnostic — pass an arbitrary set of `segments` (e.g.
2436
+ * shipped / returned / pending, or cancelled / blocked / …) plus an explicit
2437
+ * `percent`. Derive the percentage and, where buckets overlap, the bar
2438
+ * breakdown in the consumer (see the docs for a purchase-order example).
2439
+ *
2440
+ * @example
2441
+ * ```tsx
2442
+ * <DocumentProgressCard
2443
+ * title="Shipment status"
2444
+ * percent={60}
2445
+ * segments={[
2446
+ * { label: "Shipped", value: 30, color: "green" },
2447
+ * { label: "Returned", value: 3, color: "red" },
2448
+ * { label: "Pending", value: 17, color: "neutral" },
2449
+ * ]}
2450
+ * />
2451
+ * ```
2452
+ */
2453
+ export declare function DocumentProgressCard({ title, percent, segments, legend, total, className, }: DocumentProgressCardProps): JSX.Element;
2454
+
2455
+ /**
2456
+ * Props for the generic DocumentProgressCard.
2457
+ */
2458
+ export declare interface DocumentProgressCardProps {
2459
+ /** Optional card title shown top-left. */
2460
+ title?: ReactNode;
2461
+ /**
2462
+ * Headline percentage shown top-right (0–100). Optional and explicit — the
2463
+ * generic card has no notion of "complete", so the consumer supplies it.
2464
+ */
2465
+ percent?: number;
2466
+ /** Status segments rendered as a single stacked bar (and, by default, the legend). */
2467
+ segments: DocumentProgressSegment[];
2468
+ /**
2469
+ * Legend rows. Defaults to `segments`. Provide this only when the legend
2470
+ * should differ from the bar (e.g. overlapping buckets shown distinctly).
2471
+ */
2472
+ legend?: DocumentProgressSegment[];
2473
+ /**
2474
+ * Denominator used to size the bar. Defaults to the sum of segment values
2475
+ * (the bar is fully tiled). A larger value leaves an unfilled track remainder.
2476
+ */
2477
+ total?: number;
2478
+ /** Additional CSS classes for the card root. */
2479
+ className?: string;
2480
+ }
2481
+
2482
+ /**
2483
+ * Curated palette for progress segments. Each value maps to a fixed fill used
2484
+ * for both the stacked bar and the legend marker.
2485
+ */
2486
+ declare type DocumentProgressColor = "indigo" | "pink" | "green" | "amber" | "red" | "blue" | "neutral";
2487
+
2488
+ /**
2489
+ * A single status segment: its amount, a legend label, and a color.
2490
+ */
2491
+ declare interface DocumentProgressSegment {
2492
+ /** Legend label (e.g. "Shipped"). */
2493
+ label: string;
2494
+ /** Amount — shown in the legend and used to size the bar. */
2495
+ value: number;
2496
+ /** Bar / legend-marker color. */
2497
+ color: DocumentProgressColor;
2498
+ }
2499
+
2346
2500
  declare type DynamicLocales<Def extends Record<string, LabelValue>> = {
2347
2501
  [locale: string]: Partial<LabelDefinition<Def>> | undefined;
2348
2502
  };
@@ -2845,6 +2999,69 @@ export declare type FormProps<FormValues extends Record<string, any> = Record<st
2845
2999
 
2846
3000
  declare type FormSubmitEventDetails = NonNullable<React_2.ComponentProps<typeof Form_2>["onFormSubmit"]> extends (values: any, details: infer D) => any ? D : never;
2847
3001
 
3002
+ export declare const Grid: React_2.ForwardRefExoticComponent<Omit<GridProps, "ref"> & React_2.RefAttributes<HTMLDivElement>> & {
3003
+ Item: React_2.ForwardRefExoticComponent<Omit<GridItemProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
3004
+ };
3005
+
3006
+ /**
3007
+ * Props for {@link Grid.Item} — a grid cell that spans or is placed explicitly.
3008
+ *
3009
+ * Only needed when a child must span multiple tracks or be positioned; plain
3010
+ * children render in a single cell without it.
3011
+ */
3012
+ export declare interface GridItemProps extends React_2.ComponentProps<"div"> {
3013
+ /** Number of columns to span, or `"full"` to span all columns. Responsive. */
3014
+ colSpan?: Responsive<number | "full">;
3015
+ /** Number of rows to span, or `"full"` to span all rows. Responsive. */
3016
+ rowSpan?: Responsive<number | "full">;
3017
+ /** 1-based column line to start at (`grid-column-start`). Responsive. */
3018
+ colStart?: Responsive<number>;
3019
+ /** 1-based column line to end at (`grid-column-end`). Responsive. */
3020
+ colEnd?: Responsive<number>;
3021
+ }
3022
+
3023
+ /**
3024
+ * Props for the {@link Grid} component.
3025
+ *
3026
+ * `Grid` is a generic, presentational CSS-Grid container. It does not assume
3027
+ * any data shape — children flow into the tracks defined by `columns`/`rows`.
3028
+ */
3029
+ export declare interface GridProps extends React_2.ComponentProps<"div"> {
3030
+ /**
3031
+ * Column tracks. A number creates that many equal columns
3032
+ * (`repeat(n, minmax(0, 1fr))`); a string is used verbatim as a
3033
+ * `grid-template-columns` value (e.g. `"280px 1fr"`). Responsive.
3034
+ */
3035
+ columns?: Responsive<number | string>;
3036
+ /**
3037
+ * Row tracks. A number creates that many equal rows
3038
+ * (`repeat(n, minmax(0, 1fr))`); a string is used verbatim as a
3039
+ * `grid-template-rows` value. Responsive.
3040
+ */
3041
+ rows?: Responsive<number | string>;
3042
+ /**
3043
+ * Gap between rows and columns, in spacing-scale units (`4` = `1rem`).
3044
+ * Defaults to `3` (12px). Responsive.
3045
+ */
3046
+ gap?: Responsive<number>;
3047
+ /** Horizontal (column) gap override, in spacing-scale units. Responsive. */
3048
+ gapX?: Responsive<number>;
3049
+ /** Vertical (row) gap override, in spacing-scale units. Responsive. */
3050
+ gapY?: Responsive<number>;
3051
+ /**
3052
+ * Auto-fit columns: each child is at least this wide and as many as fit are
3053
+ * placed per row (`repeat(auto-fit, minmax(w, 1fr))`). A number is treated as
3054
+ * pixels. **Overrides `columns`** when set.
3055
+ */
3056
+ minChildWidth?: number | string;
3057
+ /** `grid-auto-flow` direction. */
3058
+ flow?: "row" | "column" | "dense" | "row-dense" | "column-dense";
3059
+ /** `align-items` — block-axis alignment of children within their tracks. */
3060
+ align?: "start" | "center" | "end" | "stretch" | "baseline";
3061
+ /** `justify-content` — inline-axis distribution of tracks within the grid. */
3062
+ justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
3063
+ }
3064
+
2848
3065
  /** Groups related menu items with the corresponding label. */
2849
3066
  declare function Group({ ...props }: React_2.ComponentProps<typeof Menu_2.Group>): JSX.Element;
2850
3067
 
@@ -2892,7 +3109,7 @@ export declare type GuardResult =
2892
3109
  };
2893
3110
 
2894
3111
  /** A table header cell (`<th>`). */
2895
- declare function Head({ className, ...props }: React_2.ComponentProps<"th">): JSX.Element;
3112
+ declare function Head({ className, align, ...props }: HeadProps): JSX.Element;
2896
3113
 
2897
3114
  declare namespace Head {
2898
3115
  var displayName: string;
@@ -2975,6 +3192,10 @@ declare type HeaderProps = Omit<React_2.ComponentProps<"div">, "title"> & {
2975
3192
  description?: React_2.ReactNode;
2976
3193
  };
2977
3194
 
3195
+ declare type HeadProps = React_2.ComponentProps<"th"> & {
3196
+ align?: CellAlign;
3197
+ };
3198
+
2978
3199
  /**
2979
3200
  * Deny access and show 404 Not Found.
2980
3201
  *
@@ -3608,6 +3829,18 @@ declare type ResourceMeta = {
3608
3829
  breadcrumbTitle?: string | ((segment: string) => string);
3609
3830
  };
3610
3831
 
3832
+ /**
3833
+ * A value that can either be a single value applied at all breakpoints, or an
3834
+ * object keyed by breakpoint for responsive behavior.
3835
+ *
3836
+ * @example
3837
+ * ```tsx
3838
+ * columns={4} // same at every breakpoint
3839
+ * columns={{ initial: 1, md: 2, xl: 4 }} // responsive
3840
+ * ```
3841
+ */
3842
+ declare type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
3843
+
3611
3844
  declare function Root({ className, variant, action, dismissible, onDismiss, children, ...props }: RootProps): JSX.Element | null;
3612
3845
 
3613
3846
  declare namespace Root {
@@ -3904,6 +4137,16 @@ export declare interface RowAction<TRow extends Record<string, unknown>> {
3904
4137
  onClick: (row: TRow) => void;
3905
4138
  }
3906
4139
 
4140
+ /**
4141
+ * Setter shape compatible with `useSearchParams()`.
4142
+ */
4143
+ declare type SearchParamsBinding = readonly [
4144
+ URLSearchParams,
4145
+ (next: URLSearchParams | ((prev: URLSearchParams) => URLSearchParams), options?: {
4146
+ replace?: boolean;
4147
+ }) => void
4148
+ ];
4149
+
3907
4150
  /**
3908
4151
  * An async search source that can be plugged into the CommandPalette.
3909
4152
  *
@@ -4693,6 +4936,18 @@ declare namespace Trigger_4 {
4693
4936
  var displayName: string;
4694
4937
  }
4695
4938
 
4939
+ /**
4940
+ * Metadata-aware collection variables that remain assignable to the broad
4941
+ * `CollectionVariables` shape expected by GraphQL clients.
4942
+ */
4943
+ declare type TypedCollectionVariables<TTable extends TableMetadata> = CollectionVariables & {
4944
+ query: BuildQueryVariables<TTable> | undefined;
4945
+ order: {
4946
+ field: TableOrderableFieldName<TTable>;
4947
+ direction: "Asc" | "Desc";
4948
+ }[] | undefined;
4949
+ };
4950
+
4696
4951
  /**
4697
4952
  * Type-safe path builder interface.
4698
4953
  *
@@ -4721,6 +4976,22 @@ declare type TypedPaths<TRoutes extends Record<string, Record<string, string>>>
4721
4976
  for<T extends (keyof TRoutes & string) | `${keyof TRoutes & string}?${string}`>(path: T, ...params: ExtractBasePath<T> extends keyof TRoutes ? IsEmptyObject<TRoutes[ExtractBasePath<T>]> extends true ? [] : [TRoutes[ExtractBasePath<T>]] : never): string;
4722
4977
  };
4723
4978
 
4979
+ export declare function useAIChat(config: {
4980
+ client: AIGatewayClient;
4981
+ model: string;
4982
+ stream?: boolean;
4983
+ }): {
4984
+ messages: AIChatMessage[];
4985
+ status: AIChatStatus;
4986
+ error?: Error;
4987
+ /**
4988
+ * Returns true when the message is sent and the stream finishes successfully.
4989
+ * Returns false when the call is ignored, aborted, or the request fails.
4990
+ */
4991
+ sendMessage: (message: string) => Promise<boolean>;
4992
+ stop: () => void;
4993
+ };
4994
+
4724
4995
  /**
4725
4996
  * Hook to access the full AppShell context (both config and data).
4726
4997
  * For better performance, prefer useAppShellConfig() or useAppShellData()
@@ -5034,14 +5305,8 @@ export declare function useCollectionControl<TFieldName extends string = string>
5034
5305
  * Options for `useCollectionVariables` hook.
5035
5306
  */
5036
5307
  export declare interface UseCollectionOptions<TFieldName extends string = string, TFilter extends Filter<TFieldName> = Filter<TFieldName>> {
5037
- params?: {
5038
- initialFilters?: TFilter[];
5039
- initialSort?: {
5040
- field: TFieldName;
5041
- direction: "Asc" | "Desc";
5042
- }[];
5043
- pageSize?: number;
5044
- };
5308
+ params?: CollectionParams<TFieldName, TFilter>;
5309
+ onParamsChange?(params: CollectionParams<TFieldName, TFilter>): void;
5045
5310
  }
5046
5311
 
5047
5312
  /**
@@ -5076,14 +5341,7 @@ export declare interface UseCollectionReturn<TFieldName extends string = string,
5076
5341
  */
5077
5342
  export declare function useCollectionVariables<const TTable extends TableMetadata>(options: UseCollectionOptions<TableFieldName<TTable>, TableMetadataFilter<TTable>> & {
5078
5343
  tableMetadata: TTable;
5079
- }): UseCollectionReturn<TableFieldName<TTable>, {
5080
- query: BuildQueryVariables<TTable> | undefined;
5081
- order: {
5082
- field: TableOrderableFieldName<TTable>;
5083
- direction: "Asc" | "Desc";
5084
- }[] | undefined;
5085
- pagination: PaginationVariables;
5086
- }, TableMetadataFilter<TTable>>;
5344
+ }): UseCollectionReturn<TableFieldName<TTable>, TypedCollectionVariables<TTable>, TableMetadataFilter<TTable>>;
5087
5345
 
5088
5346
  /**
5089
5347
  * Hook for managing collection query parameters (filters, sort, pagination).
@@ -5561,6 +5819,37 @@ export declare const useTheme: () => {
5561
5819
 
5562
5820
  export declare const useToast: () => typeof toast;
5563
5821
 
5822
+ /**
5823
+ * Hook for managing collection query parameters (filters, sort, pagination)
5824
+ * with state persisted to the URL query string.
5825
+ *
5826
+ * This is the one-call convenience over {@link useCollectionVariables}: it seeds
5827
+ * the initial filter/sort/page-size state from the current router search params
5828
+ * and writes changes back as the user filters, sorts, or pages (using `replace`
5829
+ * so each change doesn't push a new history entry).
5830
+ *
5831
+ * Reach for the bare {@link useCollectionVariables} when you don't want URL
5832
+ * persistence, or the pure {@link withURLCollectionState} decorator when you
5833
+ * need to supply a non-react-router search-params binding.
5834
+ *
5835
+ * @example
5836
+ * ```tsx
5837
+ * import { tableMetadata } from "./generated/data-viewer-metadata.generated";
5838
+ *
5839
+ * const { variables, control } = useURLCollectionVariables({
5840
+ * tableMetadata: tableMetadata.task,
5841
+ * params: { pageSize: 20 },
5842
+ * });
5843
+ * ```
5844
+ */
5845
+ export declare function useURLCollectionVariables<const TTable extends TableMetadata>(options: UseCollectionOptions<TableFieldName<TTable>, TableMetadataFilter<TTable>> & {
5846
+ tableMetadata: TTable;
5847
+ }): UseCollectionReturn<TableFieldName<TTable>, TypedCollectionVariables<TTable>, TableMetadataFilter<TTable>>;
5848
+
5849
+ export declare function useURLCollectionVariables(options: UseCollectionOptions & {
5850
+ tableMetadata?: never;
5851
+ }): UseCollectionReturn<string, CollectionVariables>;
5852
+
5564
5853
  /**
5565
5854
  * Used to display a custom message based on the field's validity state.
5566
5855
  *
@@ -5678,4 +5967,17 @@ export declare type WithGuardProps = {
5678
5967
  loading?: ReactNode;
5679
5968
  };
5680
5969
 
5970
+ /**
5971
+ * Decorate `useCollectionVariables` options with URL-backed collection state.
5972
+ */
5973
+ export declare function withURLCollectionState<const TTable extends TableMetadata>(options: UseCollectionOptions<TableFieldName<TTable>, TableMetadataFilter<TTable>> & {
5974
+ tableMetadata: TTable;
5975
+ }, [searchParams, setSearchParams]: SearchParamsBinding): UseCollectionOptions<TableFieldName<TTable>, TableMetadataFilter<TTable>> & {
5976
+ tableMetadata: TTable;
5977
+ };
5978
+
5979
+ export declare function withURLCollectionState(options: UseCollectionOptions & {
5980
+ tableMetadata?: never;
5981
+ }, [searchParams, setSearchParams]: SearchParamsBinding): UseCollectionOptions;
5982
+
5681
5983
  export { }