@tailor-platform/app-shell 0.33.0 → 0.35.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/app-shell.css +1 -1
- package/dist/app-shell.d.ts +385 -14
- package/dist/app-shell.js +3295 -1971
- package/package.json +13 -8
package/dist/app-shell.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { Menu as Menu_2 } from '@base-ui/react/menu';
|
|
|
20
20
|
import * as React_2 from 'react';
|
|
21
21
|
import { ReactNode } from 'react';
|
|
22
22
|
import { Select as Select_2 } from '@base-ui/react/select';
|
|
23
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
23
24
|
import { toast } from 'sonner';
|
|
24
25
|
import { Tooltip as Tooltip_2 } from '@base-ui/react/tooltip';
|
|
25
26
|
import { useFilter } from 'node_modules/@base-ui/react/esm/combobox/index.parts';
|
|
@@ -59,6 +60,15 @@ declare interface ActionItem {
|
|
|
59
60
|
* When an action has `loading: true`, the row shows a spinner in the icon slot and is
|
|
60
61
|
* non-interactive (useful for backend-driven actions: parent sets loading from mutation/request state).
|
|
61
62
|
*
|
|
63
|
+
* **CommandPalette integration** — Actions that are enabled (not `disabled`,
|
|
64
|
+
* not `loading`, and have an `onClick` handler) are automatically registered
|
|
65
|
+
* to the CommandPalette so users can discover and trigger them via keyboard
|
|
66
|
+
* shortcut. The actions are grouped under the panel's `title`. Registration
|
|
67
|
+
* is cleaned up when the ActionPanel unmounts.
|
|
68
|
+
*
|
|
69
|
+
* NOTE: This component must be rendered inside `AppShell` (which provides
|
|
70
|
+
* `CommandPaletteProvider`). Rendering it outside that tree will throw.
|
|
71
|
+
*
|
|
62
72
|
* @example
|
|
63
73
|
* ```tsx
|
|
64
74
|
* const navigate = useNavigate();
|
|
@@ -417,7 +427,11 @@ declare type AuthProviderProps = {
|
|
|
417
427
|
/**
|
|
418
428
|
* Guard UI component to show when loading or unauthenticated.
|
|
419
429
|
*
|
|
420
|
-
*
|
|
430
|
+
* When provided, AuthProvider renders this component directly while auth
|
|
431
|
+
* is not ready or the user is not authenticated. Children are hidden until
|
|
432
|
+
* auth resolves to an authenticated state.
|
|
433
|
+
*
|
|
434
|
+
* If not provided, children are rendered regardless of auth state.
|
|
421
435
|
*/
|
|
422
436
|
guardComponent?: () => React.ReactNode;
|
|
423
437
|
};
|
|
@@ -459,9 +473,9 @@ export declare const Autocomplete: typeof AutocompleteStandalone & {
|
|
|
459
473
|
GroupLabel: typeof AutocompleteGroupLabel;
|
|
460
474
|
Collection: typeof AutocompleteCollection;
|
|
461
475
|
Status: AutocompleteStatus;
|
|
462
|
-
useFilter: (options?: AutocompleteFilterOptions) => AutocompleteFilter;
|
|
463
|
-
useAsync: typeof useAsync_2;
|
|
464
476
|
};
|
|
477
|
+
useAsync: typeof useAsync_3;
|
|
478
|
+
useFilter: (options?: AutocompleteFilterOptions) => AutocompleteFilter;
|
|
465
479
|
};
|
|
466
480
|
|
|
467
481
|
/** Fetcher type for `Autocomplete.Async`. */
|
|
@@ -492,7 +506,9 @@ declare namespace AutocompleteCollection {
|
|
|
492
506
|
var displayName: string;
|
|
493
507
|
}
|
|
494
508
|
|
|
495
|
-
declare function AutocompleteContent({ className, ...props }: React_2.ComponentProps<typeof Autocomplete_2.Popup>
|
|
509
|
+
declare function AutocompleteContent({ className, container, ...props }: React_2.ComponentProps<typeof Autocomplete_2.Popup> & {
|
|
510
|
+
container?: React_2.ComponentProps<typeof Autocomplete_2.Portal>["container"];
|
|
511
|
+
}): JSX.Element;
|
|
496
512
|
|
|
497
513
|
declare namespace AutocompleteContent {
|
|
498
514
|
var displayName: string;
|
|
@@ -561,6 +577,8 @@ declare interface AutocompletePropsBase<T> {
|
|
|
561
577
|
className?: string;
|
|
562
578
|
/** Whether the autocomplete is disabled */
|
|
563
579
|
disabled?: boolean;
|
|
580
|
+
/** A parent element to render the portal into (e.g. a modal/drawer ref). */
|
|
581
|
+
container?: React_2.ComponentProps<typeof AutocompleteContent>["container"];
|
|
564
582
|
/** Current value (controlled) */
|
|
565
583
|
value?: string;
|
|
566
584
|
/** Default value (uncontrolled) */
|
|
@@ -685,6 +703,11 @@ export declare const buttonVariants: (props?: ({
|
|
|
685
703
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | null | undefined;
|
|
686
704
|
} & ClassProp) | undefined) => string;
|
|
687
705
|
|
|
706
|
+
/**
|
|
707
|
+
* Internal type for tracking OAuth callback handling status.
|
|
708
|
+
*/
|
|
709
|
+
declare type CallbackStatus = "idle" | "pending" | "resolved" | "rejected";
|
|
710
|
+
|
|
688
711
|
/** A table caption element. */
|
|
689
712
|
declare function Caption({ className, ...props }: React_2.ComponentProps<"caption">): JSX.Element;
|
|
690
713
|
|
|
@@ -788,10 +811,10 @@ export declare const Combobox: typeof ComboboxStandalone & {
|
|
|
788
811
|
Value: typeof ComboboxValue;
|
|
789
812
|
Collection: typeof ComboboxCollection;
|
|
790
813
|
Status: ComboboxStatus;
|
|
791
|
-
useFilter: useFilter;
|
|
792
|
-
useCreatable: typeof useCreatable;
|
|
793
|
-
useAsync: typeof useAsync;
|
|
794
814
|
};
|
|
815
|
+
useAsync: typeof useAsync_2;
|
|
816
|
+
useFilter: useFilter;
|
|
817
|
+
useCreatable: typeof useCreatable;
|
|
795
818
|
};
|
|
796
819
|
|
|
797
820
|
declare type ComboboxAsyncCreatableProps<T extends object> = (ComboboxAsyncOwnProps<T> & CreatableProps<T> & Omit<ComboboxPropsSingle<T>, "mapItem">) | (ComboboxAsyncOwnProps<T> & CreatableProps<T> & Omit<ComboboxPropsMultiple<T>, "mapItem">);
|
|
@@ -842,7 +865,9 @@ declare namespace ComboboxCollection {
|
|
|
842
865
|
var displayName: string;
|
|
843
866
|
}
|
|
844
867
|
|
|
845
|
-
declare function ComboboxContent({ className, ...props }: React_2.ComponentProps<typeof Combobox_2.Popup>
|
|
868
|
+
declare function ComboboxContent({ className, container, ...props }: React_2.ComponentProps<typeof Combobox_2.Popup> & {
|
|
869
|
+
container?: React_2.ComponentProps<typeof Combobox_2.Portal>["container"];
|
|
870
|
+
}): JSX.Element;
|
|
846
871
|
|
|
847
872
|
declare namespace ComboboxContent {
|
|
848
873
|
var displayName: string;
|
|
@@ -901,6 +926,8 @@ declare interface ComboboxPropsBase<T> {
|
|
|
901
926
|
className?: string;
|
|
902
927
|
/** Whether the combobox is disabled */
|
|
903
928
|
disabled?: boolean;
|
|
929
|
+
/** A parent element to render the portal into (e.g. a modal/drawer ref). */
|
|
930
|
+
container?: React_2.ComponentProps<typeof ComboboxContent>["container"];
|
|
904
931
|
}
|
|
905
932
|
|
|
906
933
|
declare interface ComboboxPropsMultiple<T> extends ComboboxPropsBase<T> {
|
|
@@ -972,10 +999,52 @@ declare namespace ComboboxValue {
|
|
|
972
999
|
}
|
|
973
1000
|
|
|
974
1001
|
/**
|
|
975
|
-
* CommandPalette
|
|
976
|
-
*
|
|
1002
|
+
* @deprecated CommandPalette is now built into AppShell and rendered automatically.
|
|
1003
|
+
* Remove `<CommandPalette>` from your JSX.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare function CommandPalette(): React.ReactNode;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* An action entry displayed in the CommandPalette.
|
|
1009
|
+
*
|
|
1010
|
+
* Actions registered via `useRegisterCommandPaletteActions` (or implicitly
|
|
1011
|
+
* through `ActionPanel`) appear in the "Actions" section of the palette and
|
|
1012
|
+
* are searchable by `label`.
|
|
1013
|
+
*/
|
|
1014
|
+
export declare type CommandPaletteAction = {
|
|
1015
|
+
/** Unique key for React reconciliation */
|
|
1016
|
+
key: string;
|
|
1017
|
+
/** Visible label shown in the palette (also used for search matching) */
|
|
1018
|
+
label: string;
|
|
1019
|
+
/** Optional icon rendered next to the label */
|
|
1020
|
+
icon?: ReactNode;
|
|
1021
|
+
/**
|
|
1022
|
+
* Group name used to categorise the action (e.g. the ActionPanel title).
|
|
1023
|
+
* When using `useRegisterCommandPaletteActions`, the hook fills this from
|
|
1024
|
+
* its `group` parameter if not already set.
|
|
1025
|
+
*/
|
|
1026
|
+
group?: string;
|
|
1027
|
+
/** Callback invoked when the action is selected */
|
|
1028
|
+
onSelect: () => void | Promise<void>;
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* A single search result returned by a `SearchSource`.
|
|
1033
|
+
*
|
|
1034
|
+
* Selecting a result navigates to `path`.
|
|
977
1035
|
*/
|
|
978
|
-
export declare
|
|
1036
|
+
export declare type CommandPaletteSearchResult = {
|
|
1037
|
+
/** Unique key for React reconciliation */
|
|
1038
|
+
key: string;
|
|
1039
|
+
/** Visible label shown in the palette (e.g. "Order #ORD-1234") */
|
|
1040
|
+
label: string;
|
|
1041
|
+
/** Optional secondary text (e.g. "山田太郎 - 2024/01/15") */
|
|
1042
|
+
description?: string;
|
|
1043
|
+
/** Optional icon for this specific result */
|
|
1044
|
+
icon?: ReactNode;
|
|
1045
|
+
/** Resolved navigation path (e.g. "/orders/abc-123") */
|
|
1046
|
+
path: string;
|
|
1047
|
+
};
|
|
979
1048
|
|
|
980
1049
|
declare type CommonModuleProps = {
|
|
981
1050
|
/**
|
|
@@ -1122,6 +1191,11 @@ declare interface CreatableProps<T extends object> {
|
|
|
1122
1191
|
* This wrapper around the original createAuthClient adds convenience methods
|
|
1123
1192
|
* to reduce duplication of the appUri across your application.
|
|
1124
1193
|
*
|
|
1194
|
+
* **Side effect on call**: If the current URL contains OAuth callback parameters
|
|
1195
|
+
* (`code` or `error`), this function immediately starts `handleCallback()` to
|
|
1196
|
+
* exchange the authorization code. This happens at call time — before any React
|
|
1197
|
+
* render — so it is safe to call at module scope.
|
|
1198
|
+
*
|
|
1125
1199
|
* @example
|
|
1126
1200
|
* ```tsx
|
|
1127
1201
|
* import { createAuthClient, AuthProvider } from '@tailor-platform/app-shell';
|
|
@@ -1179,6 +1253,135 @@ export declare function createAuthClient(config: AuthClientConfig): EnhancedAuth
|
|
|
1179
1253
|
*/
|
|
1180
1254
|
export declare function createTypedPaths<TRoutes extends Record<string, Record<string, string>>>(): TypedPaths<TRoutes>;
|
|
1181
1255
|
|
|
1256
|
+
/** Built-in Standard Schema helpers for common CSV column types. */
|
|
1257
|
+
export declare const csv: {
|
|
1258
|
+
/** Pass-through with optional length constraints. `min: 1` serves as a required check. */
|
|
1259
|
+
string(options?: {
|
|
1260
|
+
min?: number;
|
|
1261
|
+
max?: number;
|
|
1262
|
+
}): StandardSchemaV1<string, string>;
|
|
1263
|
+
/** Coerces the raw CSV string to a number. Rejects `NaN`. */
|
|
1264
|
+
number(options?: {
|
|
1265
|
+
min?: number;
|
|
1266
|
+
max?: number;
|
|
1267
|
+
integer?: boolean;
|
|
1268
|
+
}): StandardSchemaV1<string, number>;
|
|
1269
|
+
/** Coerces common CSV boolean representations to `true`/`false`. Case-insensitive. */
|
|
1270
|
+
boolean(options?: {
|
|
1271
|
+
truthy?: string[];
|
|
1272
|
+
falsy?: string[];
|
|
1273
|
+
}): StandardSchemaV1<string, boolean>;
|
|
1274
|
+
/** Coerces the raw CSV string to a `Date` object. Rejects unparseable values. */
|
|
1275
|
+
date(): StandardSchemaV1<string, Date>;
|
|
1276
|
+
/** Validates the value is one of the allowed strings. Case-sensitive. */
|
|
1277
|
+
enum<T extends string>(values: T[]): StandardSchemaV1<string, T>;
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
/** A single cell-level issue found during validation. */
|
|
1281
|
+
export declare type CsvCellIssue = {
|
|
1282
|
+
/** 0-based row index. */
|
|
1283
|
+
rowIndex: number;
|
|
1284
|
+
/** The schema column key. */
|
|
1285
|
+
columnKey: string;
|
|
1286
|
+
/** "error" blocks import; "warning" allows import but shows a warning. */
|
|
1287
|
+
level: "error" | "warning";
|
|
1288
|
+
/** Human-readable message. */
|
|
1289
|
+
message: string;
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
/** Schema definition for a single column in the CSV. */
|
|
1293
|
+
export declare type CsvColumn = {
|
|
1294
|
+
/** Internal key — becomes the object key in import results. */
|
|
1295
|
+
key: string;
|
|
1296
|
+
/** Display label shown in the mapping UI. */
|
|
1297
|
+
label: string;
|
|
1298
|
+
/** Optional description shown as a hint in the mapping UI. */
|
|
1299
|
+
description?: string;
|
|
1300
|
+
/** Whether this column must be mapped (default: false). */
|
|
1301
|
+
required?: boolean;
|
|
1302
|
+
/** Alternative CSV header names for automatic matching. */
|
|
1303
|
+
aliases?: readonly string[];
|
|
1304
|
+
/**
|
|
1305
|
+
* A Standard Schema-compatible validator for this column.
|
|
1306
|
+
* Handles both coercion (transform) and validation in a single declaration.
|
|
1307
|
+
* The raw CSV string is passed to `schema["~standard"].validate(value)`.
|
|
1308
|
+
* On success, the output value is used for the parsed row.
|
|
1309
|
+
* On failure, each issue is rendered as a cell error in the Review table.
|
|
1310
|
+
*
|
|
1311
|
+
* @see https://github.com/standard-schema/standard-schema
|
|
1312
|
+
*/
|
|
1313
|
+
schema?: StandardSchemaV1;
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
/** A mapping from a CSV header to a schema column key. */
|
|
1317
|
+
export declare type CsvColumnMapping = {
|
|
1318
|
+
/** The header name from the CSV file. */
|
|
1319
|
+
csvHeader: string;
|
|
1320
|
+
/** The schema column key to map to, or null to skip this column. */
|
|
1321
|
+
columnKey: string | null;
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
/** A single correction made by the user in the review step. */
|
|
1325
|
+
export declare type CsvCorrection = {
|
|
1326
|
+
/** 0-based row index. */
|
|
1327
|
+
row: number;
|
|
1328
|
+
/** The schema column key. */
|
|
1329
|
+
columnKey: string;
|
|
1330
|
+
/** The value before correction. */
|
|
1331
|
+
oldValue: unknown;
|
|
1332
|
+
/** The value after correction. */
|
|
1333
|
+
newValue: unknown;
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
export declare function CsvImporter<T extends CsvSchema>({ open, onOpenChange, schema, maxFileSize, onImport, onValidate, }: CsvImporterProps<T>): JSX.Element;
|
|
1337
|
+
|
|
1338
|
+
/** Internal props for the CsvImporter component (managed by useCsvImporter). */
|
|
1339
|
+
declare type CsvImporterProps<T extends CsvSchema = CsvSchema> = {
|
|
1340
|
+
open: boolean;
|
|
1341
|
+
onOpenChange: (open: boolean) => void;
|
|
1342
|
+
schema: T;
|
|
1343
|
+
maxFileSize: number;
|
|
1344
|
+
onImport: (event: CsvImportEvent<T>) => void | Promise<void>;
|
|
1345
|
+
onValidate?: (rows: ParsedRow[]) => Promise<CsvCellIssue[]>;
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
/** The event payload passed to the onImport callback. */
|
|
1349
|
+
export declare type CsvImportEvent<T extends CsvSchema = CsvSchema> = {
|
|
1350
|
+
/** The original file selected by the user. */
|
|
1351
|
+
file: File;
|
|
1352
|
+
/** The confirmed column mappings. */
|
|
1353
|
+
mappings: CsvColumnMapping[];
|
|
1354
|
+
/** The corrections made by the user in the review step. */
|
|
1355
|
+
corrections: CsvCorrection[];
|
|
1356
|
+
/** Any remaining issues (warnings only — errors are resolved before import). */
|
|
1357
|
+
issues: CsvCellIssue[];
|
|
1358
|
+
/** Summary statistics. */
|
|
1359
|
+
summary: {
|
|
1360
|
+
/** Total number of data rows in the CSV (excluding the header row). */
|
|
1361
|
+
totalRows: number;
|
|
1362
|
+
/** Rows with no warning-level issues. */
|
|
1363
|
+
validRows: number;
|
|
1364
|
+
/** Distinct rows where the user made at least one correction. */
|
|
1365
|
+
correctedRows: number;
|
|
1366
|
+
/** Rows that were skipped during import. */
|
|
1367
|
+
skippedRows: number;
|
|
1368
|
+
/** Rows that have at least one warning-level issue. */
|
|
1369
|
+
warningRows: number;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* Reconstruct parsed rows from the original file, applying mappings,
|
|
1373
|
+
* schema coercion, and user corrections.
|
|
1374
|
+
*
|
|
1375
|
+
* The return type is inferred from the schema definition.
|
|
1376
|
+
*/
|
|
1377
|
+
buildRows: () => Promise<InferCsvRow<T>[]>;
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
/** The full schema definition for a CSV import. */
|
|
1381
|
+
export declare type CsvSchema = {
|
|
1382
|
+
columns: readonly CsvColumn[];
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1182
1385
|
/**
|
|
1183
1386
|
* Date format options
|
|
1184
1387
|
*/
|
|
@@ -1187,6 +1390,9 @@ declare type DateFormat = "short" | "medium" | "long" | "relative";
|
|
|
1187
1390
|
/**
|
|
1188
1391
|
* Default sidebar component with auto-generated navigation items.
|
|
1189
1392
|
*
|
|
1393
|
+
* Must be rendered inside `AppShell` (or a `CommandPaletteProvider`) — the
|
|
1394
|
+
* built-in Search button requires the palette context.
|
|
1395
|
+
*
|
|
1190
1396
|
* It works in both auto-generation mode and composition mode.
|
|
1191
1397
|
* - Auto-generation mode: when no children are provided, it automatically generates sidebar items based on the application's resource definitions.
|
|
1192
1398
|
* - Composition mode: when children are provided, it allows developers to manually define the sidebar structure using SidebarItem, SidebarGroup, and other components.
|
|
@@ -1543,6 +1749,8 @@ export declare interface EnhancedAuthClient extends AuthClient {
|
|
|
1543
1749
|
* Same signature as the standard `fetch` API.
|
|
1544
1750
|
*/
|
|
1545
1751
|
fetch: AuthClient["fetch"];
|
|
1752
|
+
/* Excluded from this release type: getCallbackStatusSnapshot */
|
|
1753
|
+
/* Excluded from this release type: subscribeCallbackStatus */
|
|
1546
1754
|
}
|
|
1547
1755
|
|
|
1548
1756
|
/**
|
|
@@ -2054,6 +2262,17 @@ declare namespace Image_2 {
|
|
|
2054
2262
|
var displayName: string;
|
|
2055
2263
|
}
|
|
2056
2264
|
|
|
2265
|
+
/**
|
|
2266
|
+
* Infer the row object type from a CsvSchema definition.
|
|
2267
|
+
* Each column key becomes a property; the value type is derived from the
|
|
2268
|
+
* column's Standard Schema output type (falls back to `unknown`).
|
|
2269
|
+
*/
|
|
2270
|
+
export declare type InferCsvRow<T extends CsvSchema> = {
|
|
2271
|
+
[C in T["columns"][number] as C["key"]]: C extends {
|
|
2272
|
+
schema: StandardSchemaV1<infer _I, infer O>;
|
|
2273
|
+
} ? O : unknown;
|
|
2274
|
+
};
|
|
2275
|
+
|
|
2057
2276
|
/**
|
|
2058
2277
|
* A styled input component.
|
|
2059
2278
|
*
|
|
@@ -2383,6 +2602,14 @@ export declare type PageMeta = {
|
|
|
2383
2602
|
icon?: ReactNode;
|
|
2384
2603
|
};
|
|
2385
2604
|
|
|
2605
|
+
/** The row data passed to `onValidate`, after transforms have been applied. */
|
|
2606
|
+
export declare type ParsedRow = {
|
|
2607
|
+
/** 0-based row index, stable across edits. */
|
|
2608
|
+
rowIndex: number;
|
|
2609
|
+
/** Column key → transformed value. Only mapped columns are included. */
|
|
2610
|
+
data: Record<string, unknown>;
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2386
2613
|
/**
|
|
2387
2614
|
* Allow access to the route. Continue to next guard or render component.
|
|
2388
2615
|
*
|
|
@@ -2726,6 +2953,26 @@ declare namespace Row {
|
|
|
2726
2953
|
var displayName: string;
|
|
2727
2954
|
}
|
|
2728
2955
|
|
|
2956
|
+
/**
|
|
2957
|
+
* An async search source that can be plugged into the CommandPalette.
|
|
2958
|
+
*
|
|
2959
|
+
* Each source is activated by typing its `prefix` followed by `:` in the
|
|
2960
|
+
* search input (e.g. `PO:` for Purchase Orders). The prefix match is
|
|
2961
|
+
* case-sensitive.
|
|
2962
|
+
*/
|
|
2963
|
+
export declare type SearchSource = {
|
|
2964
|
+
/** Mode-switching prefix (e.g. "PO"). Case-sensitive, alphanumeric only. */
|
|
2965
|
+
prefix: string;
|
|
2966
|
+
/** Heading shown above search results (e.g. "Purchase Orders") */
|
|
2967
|
+
title: string;
|
|
2968
|
+
/** Optional icon shown next to each result that lacks its own icon */
|
|
2969
|
+
icon?: ReactNode;
|
|
2970
|
+
/** Async search function. Receives the query after the prefix and an AbortSignal. */
|
|
2971
|
+
search: (query: string, options: {
|
|
2972
|
+
signal: AbortSignal;
|
|
2973
|
+
}) => Promise<CommandPaletteSearchResult[]>;
|
|
2974
|
+
};
|
|
2975
|
+
|
|
2729
2976
|
export declare const Select: typeof SelectStandalone & {
|
|
2730
2977
|
Async: typeof SelectAsyncStandalone;
|
|
2731
2978
|
Parts: {
|
|
@@ -2738,6 +2985,7 @@ export declare const Select: typeof SelectStandalone & {
|
|
|
2738
2985
|
GroupLabel: typeof SelectGroupLabel;
|
|
2739
2986
|
Separator: SelectSeparator;
|
|
2740
2987
|
};
|
|
2988
|
+
useAsync: typeof useAsync;
|
|
2741
2989
|
};
|
|
2742
2990
|
|
|
2743
2991
|
/**
|
|
@@ -2777,7 +3025,9 @@ declare type SelectAsyncProps<T> = (SelectAsyncOwnProps<T> & SelectPropsSingle<T
|
|
|
2777
3025
|
|
|
2778
3026
|
declare function SelectAsyncStandalone<T>(props: SelectAsyncProps<T>): JSX.Element;
|
|
2779
3027
|
|
|
2780
|
-
declare function SelectContent({ className, ...props }: React_2.ComponentProps<typeof Select_2.Popup>
|
|
3028
|
+
declare function SelectContent({ className, container, ...props }: React_2.ComponentProps<typeof Select_2.Popup> & {
|
|
3029
|
+
container?: React_2.ComponentProps<typeof Select_2.Portal>["container"];
|
|
3030
|
+
}): JSX.Element;
|
|
2781
3031
|
|
|
2782
3032
|
declare namespace SelectContent {
|
|
2783
3033
|
var displayName: string;
|
|
@@ -2810,6 +3060,8 @@ declare interface SelectPropsBase<T> {
|
|
|
2810
3060
|
className?: string;
|
|
2811
3061
|
/** Whether the select is disabled */
|
|
2812
3062
|
disabled?: boolean;
|
|
3063
|
+
/** A parent element to render the portal into (e.g. a modal/drawer ref). */
|
|
3064
|
+
container?: React_2.ComponentProps<typeof SelectContent>["container"];
|
|
2813
3065
|
}
|
|
2814
3066
|
|
|
2815
3067
|
declare interface SelectPropsMultiple<T> extends SelectPropsBase<T> {
|
|
@@ -2986,6 +3238,39 @@ declare type SharedAppShellProps = React.PropsWithChildren<{
|
|
|
2986
3238
|
* ```
|
|
2987
3239
|
*/
|
|
2988
3240
|
contextData?: ContextData;
|
|
3241
|
+
/**
|
|
3242
|
+
* Async search sources for the built-in CommandPalette.
|
|
3243
|
+
*
|
|
3244
|
+
* The CommandPalette (opened via Cmd+K / Ctrl+K, or the sidebar Search
|
|
3245
|
+
* button) always searches pages and contextual actions. When
|
|
3246
|
+
* `searchSources` is also provided, those async sources are available
|
|
3247
|
+
* as prefix-activated search modes.
|
|
3248
|
+
*
|
|
3249
|
+
* Note: `DefaultSidebar` always renders a Search entry at the top of
|
|
3250
|
+
* the navigation menu, regardless of whether this prop is supplied.
|
|
3251
|
+
*
|
|
3252
|
+
* @example
|
|
3253
|
+
* ```tsx
|
|
3254
|
+
* <AppShell
|
|
3255
|
+
* modules={modules}
|
|
3256
|
+
* searchSources={[
|
|
3257
|
+
* {
|
|
3258
|
+
* prefix: "PO",
|
|
3259
|
+
* title: "Purchase Orders",
|
|
3260
|
+
* search: async (query, { signal }) => {
|
|
3261
|
+
* const results = await api.searchOrders(query, { signal });
|
|
3262
|
+
* return results.map((o) => ({
|
|
3263
|
+
* key: o.id,
|
|
3264
|
+
* label: o.number,
|
|
3265
|
+
* path: `/orders/${o.id}`,
|
|
3266
|
+
* }));
|
|
3267
|
+
* },
|
|
3268
|
+
* },
|
|
3269
|
+
* ]}
|
|
3270
|
+
* />
|
|
3271
|
+
* ```
|
|
3272
|
+
*/
|
|
3273
|
+
searchSources?: readonly SearchSource[];
|
|
2989
3274
|
}>;
|
|
2990
3275
|
|
|
2991
3276
|
export declare const Sheet: {
|
|
@@ -3328,6 +3613,41 @@ export declare const useAppShellConfig: () => AppShellConfigContextType;
|
|
|
3328
3613
|
*/
|
|
3329
3614
|
export declare const useAppShellData: () => AppShellDataContextType;
|
|
3330
3615
|
|
|
3616
|
+
/**
|
|
3617
|
+
* Hook that encapsulates the async select pattern — fetching on open,
|
|
3618
|
+
* request cancellation via `AbortController`, and loading/error state.
|
|
3619
|
+
*
|
|
3620
|
+
* Unlike `Combobox.useAsync`, this does **not** involve a search query
|
|
3621
|
+
* or debouncing — Select has no text input. The fetcher is called each
|
|
3622
|
+
* time the dropdown opens.
|
|
3623
|
+
*
|
|
3624
|
+
* @example
|
|
3625
|
+
* ```tsx
|
|
3626
|
+
* const countries = Select.useAsync({
|
|
3627
|
+
* fetcher: async ({ signal }) => {
|
|
3628
|
+
* const res = await fetch("/api/countries", { signal });
|
|
3629
|
+
* return res.json();
|
|
3630
|
+
* },
|
|
3631
|
+
* });
|
|
3632
|
+
*
|
|
3633
|
+
* <Select.Parts.Root
|
|
3634
|
+
* onOpenChange={countries.onOpenChange}
|
|
3635
|
+
* >
|
|
3636
|
+
* <Select.Parts.Trigger>
|
|
3637
|
+
* <Select.Parts.Value placeholder="Select a country" />
|
|
3638
|
+
* </Select.Parts.Trigger>
|
|
3639
|
+
* <Select.Parts.Content>
|
|
3640
|
+
* {countries.loading
|
|
3641
|
+
* ? "Loading..."
|
|
3642
|
+
* : countries.items.map((c) => (
|
|
3643
|
+
* <Select.Parts.Item key={c.id} value={c}>{c.name}</Select.Parts.Item>
|
|
3644
|
+
* ))}
|
|
3645
|
+
* </Select.Parts.Content>
|
|
3646
|
+
* </Select.Parts.Root>
|
|
3647
|
+
* ```
|
|
3648
|
+
*/
|
|
3649
|
+
declare function useAsync<T>({ fetcher }: UseSelectAsyncOptions<T>): UseSelectAsyncReturn<T>;
|
|
3650
|
+
|
|
3331
3651
|
/**
|
|
3332
3652
|
* Hook that encapsulates the async combobox pattern — debounced fetching,
|
|
3333
3653
|
* request cancellation via `AbortController`, and loading state.
|
|
@@ -3368,7 +3688,7 @@ export declare const useAppShellData: () => AppShellDataContextType;
|
|
|
3368
3688
|
* </Combobox.Root>
|
|
3369
3689
|
* ```
|
|
3370
3690
|
*/
|
|
3371
|
-
declare function
|
|
3691
|
+
declare function useAsync_2<T>(options: UseAsyncItemsOptions<T>): UseAsyncItemsReturn<T>;
|
|
3372
3692
|
|
|
3373
3693
|
/**
|
|
3374
3694
|
* Hook that encapsulates the async autocomplete pattern — debounced fetching,
|
|
@@ -3412,7 +3732,7 @@ declare function useAsync<T>(options: UseAsyncItemsOptions<T>): UseAsyncItemsRet
|
|
|
3412
3732
|
* </Autocomplete.Root>
|
|
3413
3733
|
* ```
|
|
3414
3734
|
*/
|
|
3415
|
-
declare function
|
|
3735
|
+
declare function useAsync_3<T>(options: UseAsyncItemsOptions<T>): AutocompleteUseAsyncReturn<T>;
|
|
3416
3736
|
|
|
3417
3737
|
declare interface UseAsyncItemsOptions<T> {
|
|
3418
3738
|
/**
|
|
@@ -3688,6 +4008,18 @@ declare interface UseCreatableReturnSingle<T> extends UseCreatableReturnBase<T>
|
|
|
3688
4008
|
multiple: false;
|
|
3689
4009
|
}
|
|
3690
4010
|
|
|
4011
|
+
export declare function useCsvImporter<const T extends CsvSchema>(options: UseCsvImporterOptions<T>): {
|
|
4012
|
+
open: () => void;
|
|
4013
|
+
props: CsvImporterProps<T>;
|
|
4014
|
+
};
|
|
4015
|
+
|
|
4016
|
+
declare type UseCsvImporterOptions<T extends CsvSchema> = {
|
|
4017
|
+
schema: T;
|
|
4018
|
+
onImport: (event: CsvImportEvent<T>) => void | Promise<void>;
|
|
4019
|
+
onValidate?: (rows: ParsedRow[]) => Promise<CsvCellIssue[]>;
|
|
4020
|
+
maxFileSize?: number;
|
|
4021
|
+
};
|
|
4022
|
+
|
|
3691
4023
|
export { useLocation }
|
|
3692
4024
|
|
|
3693
4025
|
export { useNavigate }
|
|
@@ -3729,10 +4061,49 @@ export declare const usePageMeta: (path: string) => PageMeta | null;
|
|
|
3729
4061
|
|
|
3730
4062
|
export { useParams }
|
|
3731
4063
|
|
|
4064
|
+
/**
|
|
4065
|
+
* Declaratively register contextual actions to the CommandPalette.
|
|
4066
|
+
*
|
|
4067
|
+
* Actions are registered while the calling component is mounted and
|
|
4068
|
+
* automatically unregistered on unmount. Re-registering with new actions
|
|
4069
|
+
* replaces the previous set.
|
|
4070
|
+
*
|
|
4071
|
+
* Note: `icon` changes alone do not trigger re-registration. If you need
|
|
4072
|
+
* dynamic icons, also change the action's `key` or `label`.
|
|
4073
|
+
*
|
|
4074
|
+
* @example
|
|
4075
|
+
* ```tsx
|
|
4076
|
+
* import { useRegisterCommandPaletteActions } from "@tailor-platform/app-shell";
|
|
4077
|
+
*
|
|
4078
|
+
* function MyComponent() {
|
|
4079
|
+
* useRegisterCommandPaletteActions("My Page", [
|
|
4080
|
+
* { key: "refresh", label: "Refresh data", onSelect: () => refetch() },
|
|
4081
|
+
* ]);
|
|
4082
|
+
* }
|
|
4083
|
+
* ```
|
|
4084
|
+
*/
|
|
4085
|
+
export declare function useRegisterCommandPaletteActions(group: string, actions: CommandPaletteAction[]): void;
|
|
4086
|
+
|
|
3732
4087
|
export { useRouteError }
|
|
3733
4088
|
|
|
3734
4089
|
export { useSearchParams }
|
|
3735
4090
|
|
|
4091
|
+
declare interface UseSelectAsyncOptions<T> {
|
|
4092
|
+
/** Fetcher for async item loading. Called each time the dropdown is opened. */
|
|
4093
|
+
fetcher: SelectAsyncFetcher<T>;
|
|
4094
|
+
}
|
|
4095
|
+
|
|
4096
|
+
declare interface UseSelectAsyncReturn<T> {
|
|
4097
|
+
/** Fetched items — pass to the Root `items` prop or render manually */
|
|
4098
|
+
items: T[];
|
|
4099
|
+
/** Whether a fetch is currently in-flight */
|
|
4100
|
+
loading: boolean;
|
|
4101
|
+
/** The error thrown by the last fetch, if any */
|
|
4102
|
+
error: unknown;
|
|
4103
|
+
/** Open change handler — pass to the Root `onOpenChange` prop */
|
|
4104
|
+
onOpenChange: (open: boolean) => void;
|
|
4105
|
+
}
|
|
4106
|
+
|
|
3736
4107
|
export declare const useTheme: () => ThemeProviderState;
|
|
3737
4108
|
|
|
3738
4109
|
export declare const useToast: () => typeof toast;
|