@mercurjs/dashboard-shared 2.0.0-canary.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.ts +1102 -0
- package/dist/index.js +13568 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, Ref, RefCallback } from 'react';
|
|
5
|
+
import { Tooltip, Heading, Text, DataTableColumnDef, DataTableFilter, DataTableCommand, DataTableEmptyStateProps, DataTableRowSelectionState, DataTableRow, Drawer, FocusModal, ProgressStatus } from '@medusajs/ui';
|
|
6
|
+
import { HttpTypes } from '@mercurjs/types';
|
|
7
|
+
import * as react_hook_form from 'react-hook-form';
|
|
8
|
+
import { FieldValues, FieldPath, ControllerProps, UseFormReturn, Control } from 'react-hook-form';
|
|
9
|
+
import { Label, Slot } from 'radix-ui';
|
|
10
|
+
import { Link, Path } from 'react-router-dom';
|
|
11
|
+
import { UniqueIdentifier } from '@dnd-kit/core';
|
|
12
|
+
import * as _tanstack_react_table from '@tanstack/react-table';
|
|
13
|
+
import { CellContext, Row, ColumnDef, ColumnDefTemplate, HeaderContext, Table, RowSelectionState, OnChangeFn } from '@tanstack/react-table';
|
|
14
|
+
import { TFunction } from 'i18next';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { ClientError } from '@mercurjs/client';
|
|
17
|
+
|
|
18
|
+
type TQueryKey<TKey, TListQuery = any, TDetailQuery = string> = {
|
|
19
|
+
all: readonly [TKey];
|
|
20
|
+
lists: () => readonly [...TQueryKey<TKey>["all"], "list"];
|
|
21
|
+
list: (query?: TListQuery) => readonly [...ReturnType<TQueryKey<TKey>["lists"]>, {
|
|
22
|
+
query: TListQuery;
|
|
23
|
+
}];
|
|
24
|
+
details: () => readonly [...TQueryKey<TKey>["all"], "detail"];
|
|
25
|
+
detail: (id: TDetailQuery, query?: TListQuery) => readonly [
|
|
26
|
+
...ReturnType<TQueryKey<TKey>["details"]>,
|
|
27
|
+
TDetailQuery,
|
|
28
|
+
{
|
|
29
|
+
query: TListQuery;
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
type UseQueryOptionsWrapper<TQueryFn = unknown, E = Error, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFn, E, TQueryFn, TQueryKey>, "queryKey" | "queryFn">;
|
|
34
|
+
declare const queryKeysFactory: <T, TListQueryType = any, TDetailQueryType = string>(globalKey: T) => TQueryKey<T, TListQueryType, TDetailQueryType>;
|
|
35
|
+
|
|
36
|
+
type Action = {
|
|
37
|
+
icon: ReactNode;
|
|
38
|
+
label: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional tooltip to display when a disabled action is hovered.
|
|
42
|
+
*/
|
|
43
|
+
disabledTooltip?: string | ReactNode;
|
|
44
|
+
} & ({
|
|
45
|
+
to: string;
|
|
46
|
+
onClick?: never;
|
|
47
|
+
} | {
|
|
48
|
+
onClick: () => void;
|
|
49
|
+
to?: never;
|
|
50
|
+
});
|
|
51
|
+
type ActionGroup = {
|
|
52
|
+
actions: Action[];
|
|
53
|
+
};
|
|
54
|
+
type ActionMenuProps = PropsWithChildren<{
|
|
55
|
+
groups: ActionGroup[];
|
|
56
|
+
variant?: "transparent" | "primary";
|
|
57
|
+
}>;
|
|
58
|
+
declare const ActionMenu: ({ groups, variant, children, }: ActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
|
|
60
|
+
type BadgeListSummaryProps = {
|
|
61
|
+
/**
|
|
62
|
+
* Number of initial items to display
|
|
63
|
+
* @default 2
|
|
64
|
+
*/
|
|
65
|
+
n?: number;
|
|
66
|
+
/**
|
|
67
|
+
* List of strings to display as abbreviated list
|
|
68
|
+
*/
|
|
69
|
+
list: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Is the summary displayed inline.
|
|
72
|
+
* Determines whether the center text is truncated if there is no space in the container
|
|
73
|
+
*/
|
|
74
|
+
inline?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the badges should be rounded
|
|
77
|
+
*/
|
|
78
|
+
rounded?: boolean;
|
|
79
|
+
className?: string;
|
|
80
|
+
};
|
|
81
|
+
declare const BadgeListSummary: ({ list, className, inline, rounded, n, }: BadgeListSummaryProps) => react_jsx_runtime.JSX.Element;
|
|
82
|
+
|
|
83
|
+
type ChipGroupVariant = "base" | "component";
|
|
84
|
+
type ChipGroupProps = PropsWithChildren<{
|
|
85
|
+
onClearAll?: () => void;
|
|
86
|
+
onRemove?: (index: number) => void;
|
|
87
|
+
variant?: ChipGroupVariant;
|
|
88
|
+
className?: string;
|
|
89
|
+
}>;
|
|
90
|
+
type ChipProps = PropsWithChildren<{
|
|
91
|
+
index: number;
|
|
92
|
+
className?: string;
|
|
93
|
+
}>;
|
|
94
|
+
declare const ChipGroup: (({ onClearAll, onRemove, variant, className, children, }: ChipGroupProps) => react_jsx_runtime.JSX.Element) & {
|
|
95
|
+
Chip: ({ index, className, children }: ChipProps) => react_jsx_runtime.JSX.Element;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type ConditionalTooltipProps = PropsWithChildren<ComponentPropsWithoutRef<typeof Tooltip> & {
|
|
99
|
+
showTooltip?: boolean;
|
|
100
|
+
}>;
|
|
101
|
+
declare const ConditionalTooltip: ({ children, showTooltip, ...props }: ConditionalTooltipProps) => string | number | boolean | Iterable<React$1.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
102
|
+
|
|
103
|
+
declare const CustomerInfo: {
|
|
104
|
+
ID: ({ data }: {
|
|
105
|
+
data: HttpTypes.AdminOrder;
|
|
106
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
107
|
+
Company: ({ data }: {
|
|
108
|
+
data: HttpTypes.AdminOrder;
|
|
109
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
110
|
+
Contact: ({ data }: {
|
|
111
|
+
data: HttpTypes.AdminOrder;
|
|
112
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
113
|
+
Addresses: ({ data }: {
|
|
114
|
+
data: HttpTypes.AdminOrder;
|
|
115
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type DateRangeDisplayProps = {
|
|
119
|
+
startsAt?: Date | string | null;
|
|
120
|
+
endsAt?: Date | string | null;
|
|
121
|
+
showTime?: boolean;
|
|
122
|
+
};
|
|
123
|
+
declare const DateRangeDisplay: ({ startsAt, endsAt, showTime, }: DateRangeDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
124
|
+
|
|
125
|
+
type NoResultsProps = {
|
|
126
|
+
title?: string;
|
|
127
|
+
message?: string;
|
|
128
|
+
className?: string;
|
|
129
|
+
};
|
|
130
|
+
declare const NoResults: ({ title, message, className }: NoResultsProps) => react_jsx_runtime.JSX.Element;
|
|
131
|
+
type ActionProps = {
|
|
132
|
+
action?: {
|
|
133
|
+
to: string;
|
|
134
|
+
label: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
type NoRecordsProps = {
|
|
138
|
+
title?: string;
|
|
139
|
+
message?: string;
|
|
140
|
+
className?: string;
|
|
141
|
+
buttonVariant?: string;
|
|
142
|
+
icon?: React__default.ReactNode;
|
|
143
|
+
} & ActionProps;
|
|
144
|
+
declare const NoRecords: ({ title, message, action, className, buttonVariant, icon, }: NoRecordsProps) => react_jsx_runtime.JSX.Element;
|
|
145
|
+
|
|
146
|
+
declare const FilePreview: ({ filename, url, loading, activity, actions, hideThumbnail, }: {
|
|
147
|
+
filename: string;
|
|
148
|
+
url?: string;
|
|
149
|
+
loading?: boolean;
|
|
150
|
+
activity?: string;
|
|
151
|
+
actions?: ActionGroup[];
|
|
152
|
+
hideThumbnail?: boolean;
|
|
153
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
154
|
+
|
|
155
|
+
interface FileType {
|
|
156
|
+
id: string;
|
|
157
|
+
url: string;
|
|
158
|
+
file: File;
|
|
159
|
+
}
|
|
160
|
+
interface FileUploadProps {
|
|
161
|
+
label: string;
|
|
162
|
+
multiple?: boolean;
|
|
163
|
+
hint?: string;
|
|
164
|
+
hasError?: boolean;
|
|
165
|
+
formats: string[];
|
|
166
|
+
onUploaded: (files: FileType[]) => void;
|
|
167
|
+
uploadedImage?: string | null;
|
|
168
|
+
}
|
|
169
|
+
declare const FileUpload: ({ label, hint, multiple, hasError, formats, onUploaded, uploadedImage, }: FileUploadProps) => react_jsx_runtime.JSX.Element;
|
|
170
|
+
|
|
171
|
+
declare const Form: (<TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React__default.JSX.Element) & {
|
|
172
|
+
Item: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
|
|
173
|
+
Label: React__default.ForwardRefExoticComponent<Omit<Label.LabelProps & React__default.RefAttributes<HTMLLabelElement>, "ref"> & {
|
|
174
|
+
optional?: boolean;
|
|
175
|
+
tooltip?: ReactNode;
|
|
176
|
+
icon?: ReactNode;
|
|
177
|
+
} & React__default.RefAttributes<HTMLLabelElement>>;
|
|
178
|
+
Control: React__default.ForwardRefExoticComponent<Omit<Slot.SlotProps & React__default.RefAttributes<HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
|
|
179
|
+
Hint: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
180
|
+
ErrorMessage: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
181
|
+
Field: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
type IconAvatarProps = PropsWithChildren<{
|
|
185
|
+
className?: string;
|
|
186
|
+
size?: "small" | "large" | "xlarge";
|
|
187
|
+
variant?: "squared" | "rounded";
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Use this component when a design calls for an avatar with an icon.
|
|
191
|
+
*
|
|
192
|
+
* The `<Avatar/>` component from `@medusajs/ui` does not support passing an icon as a child.
|
|
193
|
+
*/
|
|
194
|
+
declare const IconAvatar: ({ size, variant, children, className, }: IconAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare function ImageAvatar({ src, size, rounded, }: {
|
|
197
|
+
src: string;
|
|
198
|
+
size?: number;
|
|
199
|
+
rounded?: boolean;
|
|
200
|
+
}): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
type InfiniteListProps<TResponse, TEntity, TParams> = {
|
|
203
|
+
queryKey: QueryKey;
|
|
204
|
+
queryFn: (params: TParams) => Promise<TResponse>;
|
|
205
|
+
queryOptions?: {
|
|
206
|
+
enabled?: boolean;
|
|
207
|
+
};
|
|
208
|
+
renderItem: (item: TEntity) => ReactNode;
|
|
209
|
+
renderEmpty: () => ReactNode;
|
|
210
|
+
responseKey: keyof TResponse;
|
|
211
|
+
pageSize?: number;
|
|
212
|
+
};
|
|
213
|
+
declare const InfiniteList: <TResponse extends {
|
|
214
|
+
count: number;
|
|
215
|
+
offset: number;
|
|
216
|
+
limit: number;
|
|
217
|
+
}, TEntity extends {
|
|
218
|
+
id: string;
|
|
219
|
+
}, TParams extends {
|
|
220
|
+
offset?: number;
|
|
221
|
+
limit?: number;
|
|
222
|
+
}>({ queryKey, queryFn, queryOptions, renderItem, renderEmpty, responseKey, pageSize, }: InfiniteListProps<TResponse, TEntity, TParams>) => react_jsx_runtime.JSX.Element;
|
|
223
|
+
|
|
224
|
+
type JsonViewSectionProps = {
|
|
225
|
+
data: object;
|
|
226
|
+
title?: string;
|
|
227
|
+
};
|
|
228
|
+
declare const JsonViewSection: ({ data }: JsonViewSectionProps) => react_jsx_runtime.JSX.Element;
|
|
229
|
+
|
|
230
|
+
interface LinkButtonProps extends ComponentPropsWithoutRef<typeof Link> {
|
|
231
|
+
variant?: "primary" | "interactive";
|
|
232
|
+
}
|
|
233
|
+
declare const LinkButton: ({ className, variant, ...props }: LinkButtonProps) => react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
235
|
+
type ListSummaryProps = {
|
|
236
|
+
/**
|
|
237
|
+
* Number of initial items to display
|
|
238
|
+
* @default 2
|
|
239
|
+
*/
|
|
240
|
+
n?: number;
|
|
241
|
+
/**
|
|
242
|
+
* List of strings to display as abbreviated list
|
|
243
|
+
*/
|
|
244
|
+
list: string[];
|
|
245
|
+
/**
|
|
246
|
+
* Is the summary displayed inline.
|
|
247
|
+
* Determines whether the center text is truncated if there is no space in the container
|
|
248
|
+
*/
|
|
249
|
+
inline?: boolean;
|
|
250
|
+
variant?: "base" | "compact";
|
|
251
|
+
className?: string;
|
|
252
|
+
};
|
|
253
|
+
declare const ListSummary: ({ list, className, variant, inline, n, }: ListSummaryProps) => react_jsx_runtime.JSX.Element;
|
|
254
|
+
|
|
255
|
+
interface ListicleProps {
|
|
256
|
+
labelKey: string;
|
|
257
|
+
descriptionKey: string;
|
|
258
|
+
children?: ReactNode;
|
|
259
|
+
}
|
|
260
|
+
declare const Listicle: ({ labelKey, descriptionKey, children, }: ListicleProps) => react_jsx_runtime.JSX.Element;
|
|
261
|
+
|
|
262
|
+
type MetadataSectionProps<TData extends object> = {
|
|
263
|
+
data: TData;
|
|
264
|
+
href?: string;
|
|
265
|
+
};
|
|
266
|
+
declare const MetadataSection: <TData extends object>({ data, href, }: MetadataSectionProps<TData>) => react_jsx_runtime.JSX.Element | null;
|
|
267
|
+
|
|
268
|
+
interface ProgressBarProps {
|
|
269
|
+
/**
|
|
270
|
+
* The duration of the animation in seconds.
|
|
271
|
+
*
|
|
272
|
+
* @default 2
|
|
273
|
+
*/
|
|
274
|
+
duration?: number;
|
|
275
|
+
}
|
|
276
|
+
declare const ProgressBar: ({ duration }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
277
|
+
|
|
278
|
+
type SectionRowProps = {
|
|
279
|
+
title: string;
|
|
280
|
+
value?: ReactNode | string | null;
|
|
281
|
+
actions?: ReactNode;
|
|
282
|
+
};
|
|
283
|
+
declare const SectionRow: ({ title, value, actions }: SectionRowProps) => react_jsx_runtime.JSX.Element;
|
|
284
|
+
|
|
285
|
+
type SegmentedControlOption = {
|
|
286
|
+
value: string;
|
|
287
|
+
label: ReactNode;
|
|
288
|
+
};
|
|
289
|
+
type SegmentedControlProps = {
|
|
290
|
+
value: string;
|
|
291
|
+
onValueChange: (value: string) => void;
|
|
292
|
+
options: SegmentedControlOption[];
|
|
293
|
+
className?: string;
|
|
294
|
+
};
|
|
295
|
+
declare const SegmentedControl: ({ value, onValueChange, options, className, }: SegmentedControlProps) => react_jsx_runtime.JSX.Element;
|
|
296
|
+
|
|
297
|
+
interface SidebarLinkProps {
|
|
298
|
+
to: string;
|
|
299
|
+
labelKey: string;
|
|
300
|
+
descriptionKey: string;
|
|
301
|
+
icon: ReactNode;
|
|
302
|
+
}
|
|
303
|
+
declare const SidebarLink: ({ to, labelKey, descriptionKey, icon, }: SidebarLinkProps) => react_jsx_runtime.JSX.Element;
|
|
304
|
+
|
|
305
|
+
type SkeletonProps = {
|
|
306
|
+
className?: string;
|
|
307
|
+
style?: CSSProperties;
|
|
308
|
+
};
|
|
309
|
+
declare const Skeleton: ({ className, style }: SkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
310
|
+
type TextSkeletonProps = {
|
|
311
|
+
size?: ComponentPropsWithoutRef<typeof Text>["size"];
|
|
312
|
+
leading?: ComponentPropsWithoutRef<typeof Text>["leading"];
|
|
313
|
+
characters?: number;
|
|
314
|
+
};
|
|
315
|
+
type HeadingSkeletonProps = {
|
|
316
|
+
level?: ComponentPropsWithoutRef<typeof Heading>["level"];
|
|
317
|
+
characters?: number;
|
|
318
|
+
};
|
|
319
|
+
declare const HeadingSkeleton: ({ level, characters, }: HeadingSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
320
|
+
declare const TextSkeleton: ({ size, leading, characters, }: TextSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
321
|
+
declare const IconButtonSkeleton: () => react_jsx_runtime.JSX.Element;
|
|
322
|
+
type GeneralSectionSkeletonProps = {
|
|
323
|
+
rowCount?: number;
|
|
324
|
+
};
|
|
325
|
+
declare const GeneralSectionSkeleton: ({ rowCount, }: GeneralSectionSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
326
|
+
declare const TableFooterSkeleton: ({ layout }: {
|
|
327
|
+
layout: "fill" | "fit";
|
|
328
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
329
|
+
type TableSkeletonProps = {
|
|
330
|
+
rowCount?: number;
|
|
331
|
+
search?: boolean;
|
|
332
|
+
filters?: boolean;
|
|
333
|
+
orderBy?: boolean;
|
|
334
|
+
pagination?: boolean;
|
|
335
|
+
layout?: "fit" | "fill";
|
|
336
|
+
};
|
|
337
|
+
declare const TableSkeleton: ({ rowCount, search, filters, orderBy, pagination, layout, }: TableSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
338
|
+
declare const TableSectionSkeleton: (props: TableSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
339
|
+
declare const JsonViewSectionSkeleton: () => react_jsx_runtime.JSX.Element;
|
|
340
|
+
type SingleColumnPageSkeletonProps = {
|
|
341
|
+
sections?: number;
|
|
342
|
+
showJSON?: boolean;
|
|
343
|
+
showMetadata?: boolean;
|
|
344
|
+
};
|
|
345
|
+
declare const SingleColumnPageSkeleton: ({ sections, showJSON, showMetadata, }: SingleColumnPageSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
346
|
+
type TwoColumnPageSkeletonProps = {
|
|
347
|
+
mainSections?: number;
|
|
348
|
+
sidebarSections?: number;
|
|
349
|
+
showJSON?: boolean;
|
|
350
|
+
showMetadata?: boolean;
|
|
351
|
+
};
|
|
352
|
+
declare const TwoColumnPageSkeleton: ({ mainSections, sidebarSections, showJSON, showMetadata, }: TwoColumnPageSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
353
|
+
|
|
354
|
+
type SortableBaseItem = {
|
|
355
|
+
id: UniqueIdentifier;
|
|
356
|
+
};
|
|
357
|
+
interface SortableListProps<TItem extends SortableBaseItem> {
|
|
358
|
+
items: TItem[];
|
|
359
|
+
onChange: (items: TItem[]) => void;
|
|
360
|
+
renderItem: (item: TItem, index: number) => ReactNode;
|
|
361
|
+
}
|
|
362
|
+
type SortableItemProps<TItem extends SortableBaseItem> = PropsWithChildren<{
|
|
363
|
+
id: TItem["id"];
|
|
364
|
+
className?: string;
|
|
365
|
+
}>;
|
|
366
|
+
declare const SortableList: (<TItem extends SortableBaseItem>({ items, onChange, renderItem, }: SortableListProps<TItem>) => react_jsx_runtime.JSX.Element) & {
|
|
367
|
+
Item: <TItem extends SortableBaseItem>({ id, className, children, }: SortableItemProps<TItem>) => react_jsx_runtime.JSX.Element;
|
|
368
|
+
DragHandle: () => react_jsx_runtime.JSX.Element;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
interface TreeItem extends Record<string, unknown> {
|
|
372
|
+
id: UniqueIdentifier;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
interface Props<T extends TreeItem> {
|
|
376
|
+
collapsible?: boolean;
|
|
377
|
+
childrenProp?: string;
|
|
378
|
+
items: T[];
|
|
379
|
+
indentationWidth?: number;
|
|
380
|
+
/**
|
|
381
|
+
* Enable drag for all items or provide a function to enable drag for specific items.
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
384
|
+
enableDrag?: boolean | ((item: T) => boolean);
|
|
385
|
+
onChange: (updatedItem: {
|
|
386
|
+
id: UniqueIdentifier;
|
|
387
|
+
parentId: UniqueIdentifier | null;
|
|
388
|
+
index: number;
|
|
389
|
+
}, items: T[]) => void;
|
|
390
|
+
renderValue: (item: T) => ReactNode;
|
|
391
|
+
}
|
|
392
|
+
declare function SortableTree<T extends TreeItem>({ collapsible, childrenProp, // "children" is the default children prop name
|
|
393
|
+
enableDrag, items, indentationWidth, onChange, renderValue, }: Props<T>): react_jsx_runtime.JSX.Element;
|
|
394
|
+
|
|
395
|
+
interface HeadlessControllerProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<ControllerProps<TFieldValues, TName>, "render"> {
|
|
396
|
+
}
|
|
397
|
+
interface SwitchBoxProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends HeadlessControllerProps<TFieldValues, TName> {
|
|
398
|
+
label: string;
|
|
399
|
+
description: string;
|
|
400
|
+
optional?: boolean;
|
|
401
|
+
tooltip?: ReactNode;
|
|
402
|
+
/**
|
|
403
|
+
* Callback for performing additional actions when the checked state changes.
|
|
404
|
+
* This does not intercept the form control, it is only used for injecting side-effects.
|
|
405
|
+
*/
|
|
406
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Wrapper for the Switch component to be used with `react-hook-form`.
|
|
410
|
+
*
|
|
411
|
+
* Use this component whenever a design calls for wrapping the Switch component
|
|
412
|
+
* in a container with a label and description.
|
|
413
|
+
*/
|
|
414
|
+
declare const SwitchBox: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, description, optional, tooltip, onCheckedChange, ...props }: SwitchBoxProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
415
|
+
|
|
416
|
+
type IncludesTaxTooltipProps = {
|
|
417
|
+
includesTax?: boolean;
|
|
418
|
+
};
|
|
419
|
+
declare const IncludesTaxTooltip: ({ includesTax, }: IncludesTaxTooltipProps) => react_jsx_runtime.JSX.Element;
|
|
420
|
+
|
|
421
|
+
type ThumbnailProps = {
|
|
422
|
+
src?: string | null;
|
|
423
|
+
alt?: string;
|
|
424
|
+
size?: "small" | "base";
|
|
425
|
+
};
|
|
426
|
+
declare const Thumbnail: ({ src, alt, size }: ThumbnailProps) => react_jsx_runtime.JSX.Element;
|
|
427
|
+
|
|
428
|
+
type DataGridColumnType = "text" | "multiline-text" | "number" | "boolean" | "togglable-number";
|
|
429
|
+
interface DataGridCellProps<TData = unknown, TValue = any> {
|
|
430
|
+
context: CellContext<TData, TValue>;
|
|
431
|
+
}
|
|
432
|
+
type FieldContext<TData> = {
|
|
433
|
+
row: Row<TData>;
|
|
434
|
+
column: ColumnDef<TData>;
|
|
435
|
+
};
|
|
436
|
+
type FieldFunction<TData, TFieldValues extends FieldValues> = (context: FieldContext<TData>) => FieldPath<TFieldValues> | null;
|
|
437
|
+
|
|
438
|
+
interface DataGridCurrencyCellProps<TData, TValue = any> extends DataGridCellProps<TData, TValue> {
|
|
439
|
+
code: string;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
interface DataGridRootProps<TData, TFieldValues extends FieldValues = FieldValues> {
|
|
443
|
+
data?: TData[];
|
|
444
|
+
columns: ColumnDef<TData>[];
|
|
445
|
+
state: UseFormReturn<TFieldValues>;
|
|
446
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
447
|
+
onEditingChange?: (isEditing: boolean) => void;
|
|
448
|
+
disableInteractions?: boolean;
|
|
449
|
+
multiColumnSelection?: boolean;
|
|
450
|
+
showColumnsDropdown?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Custom content to render in the header, positioned between the column visibility
|
|
453
|
+
* controls and the error/shortcuts section.
|
|
454
|
+
*/
|
|
455
|
+
headerContent?: ReactNode;
|
|
456
|
+
/**
|
|
457
|
+
* Lazy loading props - when totalRowCount is provided, the grid enters lazy loading mode.
|
|
458
|
+
* In this mode, the virtualizer will size based on totalRowCount and trigger onFetchMore
|
|
459
|
+
* when the user scrolls near the end of loaded data.
|
|
460
|
+
*/
|
|
461
|
+
/** Total count of rows for scroll sizing (enables lazy loading mode when provided) */
|
|
462
|
+
totalRowCount?: number;
|
|
463
|
+
/** Called when more data should be fetched */
|
|
464
|
+
onFetchMore?: () => void;
|
|
465
|
+
/** Whether more data is currently being fetched */
|
|
466
|
+
isFetchingMore?: boolean;
|
|
467
|
+
/** Whether there is more data to fetch */
|
|
468
|
+
hasNextPage?: boolean;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
interface DataGridProps<TData, TFieldValues extends FieldValues = FieldValues> extends DataGridRootProps<TData, TFieldValues> {
|
|
472
|
+
isLoading?: boolean;
|
|
473
|
+
}
|
|
474
|
+
declare const DataGrid: (<TData, TFieldValues extends FieldValues = FieldValues>({ isLoading, totalRowCount, onFetchMore, isFetchingMore, hasNextPage, ...props }: DataGridProps<TData, TFieldValues>) => react_jsx_runtime.JSX.Element) & {
|
|
475
|
+
BooleanCell: <TData, TValue = any>({ context, disabled, }: DataGridCellProps<TData, TValue> & {
|
|
476
|
+
disabled?: boolean;
|
|
477
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
478
|
+
TextCell: <TData, TValue = any>({ context, }: DataGridCellProps<TData, TValue>) => react_jsx_runtime.JSX.Element;
|
|
479
|
+
MultilineCell: <TData, TValue = any>({ context, }: DataGridCellProps<TData, TValue>) => react_jsx_runtime.JSX.Element;
|
|
480
|
+
ExpandableTextCell: <TData, TValue = any>({ context, fieldLabel, }: DataGridCellProps<TData, TValue> & {
|
|
481
|
+
fieldLabel?: string;
|
|
482
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
483
|
+
NumberCell: <TData, TValue = any>({ context, ...rest }: DataGridCellProps<TData, TValue> & {
|
|
484
|
+
min?: number;
|
|
485
|
+
max?: number;
|
|
486
|
+
placeholder?: string;
|
|
487
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
488
|
+
CurrencyCell: <TData, TValue = any>({ context, code, }: DataGridCurrencyCellProps<TData, TValue>) => react_jsx_runtime.JSX.Element;
|
|
489
|
+
ReadonlyCell: <TData, TValue = any>({ context, color, children, isMultiLine, }: DataGridCellProps<TData, TValue> & {
|
|
490
|
+
children?: React$1.ReactNode | undefined;
|
|
491
|
+
} & {
|
|
492
|
+
color?: "muted" | "normal";
|
|
493
|
+
isMultiLine?: boolean;
|
|
494
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
type DataGridHelperColumnsProps<TData, TFieldValues extends FieldValues> = {
|
|
498
|
+
/**
|
|
499
|
+
* The id of the column.
|
|
500
|
+
*/
|
|
501
|
+
id: string;
|
|
502
|
+
/**
|
|
503
|
+
* The name of the column, shown in the column visibility menu.
|
|
504
|
+
*/
|
|
505
|
+
name?: string;
|
|
506
|
+
/**
|
|
507
|
+
* The header template for the column.
|
|
508
|
+
*/
|
|
509
|
+
header: ColumnDefTemplate<HeaderContext<TData, unknown>> | undefined;
|
|
510
|
+
/**
|
|
511
|
+
* The cell template for the column.
|
|
512
|
+
*/
|
|
513
|
+
cell: ColumnDefTemplate<CellContext<TData, unknown>> | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Callback to set the field path for each cell in the column.
|
|
516
|
+
* If a callback is not provided, or returns null, the cell will not be editable.
|
|
517
|
+
*/
|
|
518
|
+
field?: FieldFunction<TData, TFieldValues>;
|
|
519
|
+
/**
|
|
520
|
+
* Whether the column cannot be hidden by the user.
|
|
521
|
+
*
|
|
522
|
+
* @default false
|
|
523
|
+
*/
|
|
524
|
+
disableHiding?: boolean;
|
|
525
|
+
/**
|
|
526
|
+
* The size of the column in pixels.
|
|
527
|
+
*/
|
|
528
|
+
size?: number;
|
|
529
|
+
/**
|
|
530
|
+
* The minimum size of the column in pixels.
|
|
531
|
+
*/
|
|
532
|
+
minSize?: number;
|
|
533
|
+
/**
|
|
534
|
+
* The maximum size of the column in pixels.
|
|
535
|
+
*/
|
|
536
|
+
maxSize?: number;
|
|
537
|
+
} & ({
|
|
538
|
+
field: FieldFunction<TData, TFieldValues>;
|
|
539
|
+
type: DataGridColumnType;
|
|
540
|
+
} | {
|
|
541
|
+
field?: null | undefined;
|
|
542
|
+
type?: never;
|
|
543
|
+
});
|
|
544
|
+
declare function createDataGridHelper<TData, TFieldValues extends FieldValues>(): {
|
|
545
|
+
column: ({ id, name, header, cell, disableHiding, field, type, size, minSize, maxSize, }: DataGridHelperColumnsProps<TData, TFieldValues>) => _tanstack_react_table.DisplayColumnDef<TData, unknown>;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
type CreateDataGridPriceColumnsProps<TData, TFieldValues extends FieldValues> = {
|
|
549
|
+
currencies?: string[];
|
|
550
|
+
regions?: HttpTypes.AdminRegion[];
|
|
551
|
+
pricePreferences?: HttpTypes.AdminPricePreference[];
|
|
552
|
+
isReadyOnly?: (context: FieldContext<TData>) => boolean;
|
|
553
|
+
getFieldName: (context: FieldContext<TData>, value: string) => FieldPath<TFieldValues> | null;
|
|
554
|
+
t: TFunction;
|
|
555
|
+
};
|
|
556
|
+
declare const createDataGridPriceColumns: <TData, TFieldValues extends FieldValues>({ currencies, regions, pricePreferences, isReadyOnly, getFieldName, t, }: CreateDataGridPriceColumnsProps<TData, TFieldValues>) => ColumnDef<TData, unknown>[];
|
|
557
|
+
|
|
558
|
+
type VisibilityState = Record<string, boolean>;
|
|
559
|
+
type ColumnOrderState = string[];
|
|
560
|
+
type DataTableActionProps = {
|
|
561
|
+
label: string;
|
|
562
|
+
disabled?: boolean;
|
|
563
|
+
} & ({
|
|
564
|
+
to: string;
|
|
565
|
+
} | {
|
|
566
|
+
onClick: () => void;
|
|
567
|
+
});
|
|
568
|
+
type DataTableActionMenuActionProps = {
|
|
569
|
+
label: string;
|
|
570
|
+
icon: ReactNode;
|
|
571
|
+
disabled?: boolean;
|
|
572
|
+
} & ({
|
|
573
|
+
to: string;
|
|
574
|
+
} | {
|
|
575
|
+
onClick: () => void;
|
|
576
|
+
});
|
|
577
|
+
type DataTableActionMenuGroupProps = {
|
|
578
|
+
actions: DataTableActionMenuActionProps[];
|
|
579
|
+
};
|
|
580
|
+
type DataTableActionMenuProps = {
|
|
581
|
+
groups: DataTableActionMenuGroupProps[];
|
|
582
|
+
};
|
|
583
|
+
interface DataTableProps$1<TData> {
|
|
584
|
+
data?: TData[];
|
|
585
|
+
columns: DataTableColumnDef<TData, any>[];
|
|
586
|
+
filters?: DataTableFilter[];
|
|
587
|
+
commands?: DataTableCommand[];
|
|
588
|
+
action?: DataTableActionProps;
|
|
589
|
+
actions?: DataTableActionProps[];
|
|
590
|
+
actionMenu?: DataTableActionMenuProps;
|
|
591
|
+
rowCount?: number;
|
|
592
|
+
getRowId: (row: TData) => string;
|
|
593
|
+
enablePagination?: boolean;
|
|
594
|
+
enableSearch?: boolean;
|
|
595
|
+
autoFocusSearch?: boolean;
|
|
596
|
+
enableFilterMenu?: boolean;
|
|
597
|
+
rowHref?: (row: TData) => string;
|
|
598
|
+
emptyState?: DataTableEmptyStateProps;
|
|
599
|
+
heading?: string;
|
|
600
|
+
headingLevel?: "h1" | "h2" | "h3";
|
|
601
|
+
subHeading?: string;
|
|
602
|
+
prefix?: string;
|
|
603
|
+
pageSize?: number;
|
|
604
|
+
isLoading?: boolean;
|
|
605
|
+
rowSelection?: {
|
|
606
|
+
state: DataTableRowSelectionState;
|
|
607
|
+
onRowSelectionChange: (value: DataTableRowSelectionState) => void;
|
|
608
|
+
enableRowSelection?: boolean | ((row: DataTableRow<TData>) => boolean);
|
|
609
|
+
};
|
|
610
|
+
layout?: "fill" | "auto";
|
|
611
|
+
enableColumnVisibility?: boolean;
|
|
612
|
+
initialColumnVisibility?: VisibilityState;
|
|
613
|
+
onColumnVisibilityChange?: (visibility: VisibilityState) => void;
|
|
614
|
+
columnOrder?: ColumnOrderState;
|
|
615
|
+
onColumnOrderChange?: (order: ColumnOrderState) => void;
|
|
616
|
+
enableViewSelector?: boolean;
|
|
617
|
+
entity?: string;
|
|
618
|
+
currentColumns?: {
|
|
619
|
+
visible: string[];
|
|
620
|
+
order: string[];
|
|
621
|
+
};
|
|
622
|
+
filterBarContent?: React__default.ReactNode;
|
|
623
|
+
}
|
|
624
|
+
declare const DataTable: <TData>({ data, columns, filters, commands, action, actions, actionMenu, getRowId, rowCount, enablePagination, enableSearch, autoFocusSearch, enableFilterMenu, rowHref, heading, headingLevel, subHeading, prefix, pageSize, emptyState, rowSelection, isLoading, layout, enableColumnVisibility, initialColumnVisibility, onColumnVisibilityChange, columnOrder, onColumnOrderChange, filterBarContent, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
625
|
+
|
|
626
|
+
type FilterGroupProps = {
|
|
627
|
+
filters: {
|
|
628
|
+
[key: string]: ReactNode;
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
declare const FilterGroup: ({ filters }: FilterGroupProps) => react_jsx_runtime.JSX.Element | null;
|
|
632
|
+
|
|
633
|
+
type OrderByProps = {
|
|
634
|
+
keys: string[];
|
|
635
|
+
};
|
|
636
|
+
declare const OrderBy: ({ keys }: OrderByProps) => react_jsx_runtime.JSX.Element;
|
|
637
|
+
|
|
638
|
+
type QueryProps = {
|
|
639
|
+
placeholder?: string;
|
|
640
|
+
};
|
|
641
|
+
declare const Query: ({ placeholder }: QueryProps) => react_jsx_runtime.JSX.Element;
|
|
642
|
+
|
|
643
|
+
declare const AddressSchema: z.ZodObject<{
|
|
644
|
+
first_name: z.ZodString;
|
|
645
|
+
last_name: z.ZodString;
|
|
646
|
+
company: z.ZodOptional<z.ZodString>;
|
|
647
|
+
address_1: z.ZodString;
|
|
648
|
+
address_2: z.ZodOptional<z.ZodString>;
|
|
649
|
+
city: z.ZodString;
|
|
650
|
+
postal_code: z.ZodString;
|
|
651
|
+
province: z.ZodOptional<z.ZodString>;
|
|
652
|
+
country_code: z.ZodString;
|
|
653
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
654
|
+
}, "strip", z.ZodTypeAny, {
|
|
655
|
+
first_name: string;
|
|
656
|
+
last_name: string;
|
|
657
|
+
address_1: string;
|
|
658
|
+
city: string;
|
|
659
|
+
postal_code: string;
|
|
660
|
+
country_code: string;
|
|
661
|
+
company?: string | undefined;
|
|
662
|
+
address_2?: string | undefined;
|
|
663
|
+
province?: string | undefined;
|
|
664
|
+
phone?: string | undefined;
|
|
665
|
+
}, {
|
|
666
|
+
first_name: string;
|
|
667
|
+
last_name: string;
|
|
668
|
+
address_1: string;
|
|
669
|
+
city: string;
|
|
670
|
+
postal_code: string;
|
|
671
|
+
country_code: string;
|
|
672
|
+
company?: string | undefined;
|
|
673
|
+
address_2?: string | undefined;
|
|
674
|
+
province?: string | undefined;
|
|
675
|
+
phone?: string | undefined;
|
|
676
|
+
}>;
|
|
677
|
+
declare const EmailSchema: z.ZodObject<{
|
|
678
|
+
email: z.ZodString;
|
|
679
|
+
}, "strip", z.ZodTypeAny, {
|
|
680
|
+
email: string;
|
|
681
|
+
}, {
|
|
682
|
+
email: string;
|
|
683
|
+
}>;
|
|
684
|
+
|
|
685
|
+
type AddressFieldValues = z.infer<typeof AddressSchema>;
|
|
686
|
+
type AddressFormProps = {
|
|
687
|
+
control: Control<AddressFieldValues>;
|
|
688
|
+
countries?: HttpTypes.AdminRegionCountry[];
|
|
689
|
+
layout: "grid" | "stack";
|
|
690
|
+
};
|
|
691
|
+
declare const AddressForm: ({ control, countries, layout, }: AddressFormProps) => react_jsx_runtime.JSX.Element;
|
|
692
|
+
|
|
693
|
+
type EmailFieldValues = z.infer<typeof EmailSchema>;
|
|
694
|
+
type EmailFormProps = {
|
|
695
|
+
control: Control<EmailFieldValues>;
|
|
696
|
+
layout?: "grid" | "stack";
|
|
697
|
+
};
|
|
698
|
+
declare const EmailForm: ({ control, layout }: EmailFormProps) => react_jsx_runtime.JSX.Element;
|
|
699
|
+
|
|
700
|
+
type MetaDataSubmitHook<TRes> = (params: {
|
|
701
|
+
metadata?: Record<string, any> | null;
|
|
702
|
+
}, callbacks: {
|
|
703
|
+
onSuccess: () => void;
|
|
704
|
+
onError: (error: ClientError) => void;
|
|
705
|
+
}) => Promise<TRes>;
|
|
706
|
+
type MetadataFormProps<TRes> = {
|
|
707
|
+
metadata?: Record<string, any> | null;
|
|
708
|
+
hook: MetaDataSubmitHook<TRes>;
|
|
709
|
+
isPending: boolean;
|
|
710
|
+
isMutating: boolean;
|
|
711
|
+
};
|
|
712
|
+
declare const MetadataForm: <TRes>(props: MetadataFormProps<TRes>) => react_jsx_runtime.JSX.Element;
|
|
713
|
+
|
|
714
|
+
interface PageProps<TData> {
|
|
715
|
+
children: ReactNode;
|
|
716
|
+
data?: TData;
|
|
717
|
+
showJSON?: boolean;
|
|
718
|
+
showMetadata?: boolean;
|
|
719
|
+
hasOutlet?: boolean;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
declare const SingleColumnPage: <TData>({ children, data, hasOutlet, showJSON, showMetadata, }: PageProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
723
|
+
|
|
724
|
+
interface TwoColumnPageProps<TData> extends PageProps<TData> {
|
|
725
|
+
}
|
|
726
|
+
declare const TwoColumnPage: (<TData>({ children, data, showJSON, showMetadata, hasOutlet, }: TwoColumnPageProps<TData>) => react_jsx_runtime.JSX.Element) & {
|
|
727
|
+
Main: ({ children, className, ...props }: ComponentPropsWithoutRef<"div">) => react_jsx_runtime.JSX.Element;
|
|
728
|
+
Sidebar: ({ children, className, ...props }: ComponentPropsWithoutRef<"div">) => react_jsx_runtime.JSX.Element;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
type RouteModalFormProps<TFieldValues extends FieldValues> = PropsWithChildren<{
|
|
732
|
+
form: UseFormReturn<TFieldValues>;
|
|
733
|
+
blockSearchParams?: boolean;
|
|
734
|
+
onClose?: (isSubmitSuccessful: boolean) => void;
|
|
735
|
+
}>;
|
|
736
|
+
declare const RouteModalForm: <TFieldValues extends FieldValues = any>({ form, blockSearchParams: blockSearch, children, onClose, }: RouteModalFormProps<TFieldValues>) => react_jsx_runtime.JSX.Element;
|
|
737
|
+
|
|
738
|
+
type RouteDrawerProps = PropsWithChildren<{
|
|
739
|
+
prev?: string | Partial<Path>;
|
|
740
|
+
}>;
|
|
741
|
+
declare const Root$4: ComponentType<RouteDrawerProps>;
|
|
742
|
+
/**
|
|
743
|
+
* Drawer that is used to render a form on a separate route.
|
|
744
|
+
*
|
|
745
|
+
* Typically used for forms editing a resource.
|
|
746
|
+
*/
|
|
747
|
+
declare const RouteDrawer: typeof Root$4 & {
|
|
748
|
+
Header: typeof Drawer.Header;
|
|
749
|
+
Title: typeof Drawer.Title;
|
|
750
|
+
Body: typeof Drawer.Body;
|
|
751
|
+
Description: typeof Drawer.Description;
|
|
752
|
+
Footer: typeof Drawer.Footer;
|
|
753
|
+
Close: typeof Drawer.Close;
|
|
754
|
+
Form: typeof RouteModalForm;
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
type RouteFocusModalProps = PropsWithChildren<{
|
|
758
|
+
prev?: string | Partial<Path> | number;
|
|
759
|
+
}>;
|
|
760
|
+
declare const Root$3: ComponentType<RouteFocusModalProps>;
|
|
761
|
+
/**
|
|
762
|
+
* FocusModal that is used to render a form on a separate route.
|
|
763
|
+
*
|
|
764
|
+
* Typically used for forms creating a resource or forms that require
|
|
765
|
+
* a lot of space.
|
|
766
|
+
*/
|
|
767
|
+
declare const RouteFocusModal: typeof Root$3 & {
|
|
768
|
+
Header: typeof FocusModal.Header;
|
|
769
|
+
Title: typeof FocusModal.Title;
|
|
770
|
+
Body: typeof FocusModal.Body;
|
|
771
|
+
Description: typeof FocusModal.Description;
|
|
772
|
+
Footer: typeof FocusModal.Footer;
|
|
773
|
+
Close: typeof FocusModal.Close;
|
|
774
|
+
Form: typeof RouteModalForm;
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
declare const useRouteModal: () => {
|
|
778
|
+
handleSuccess: (path?: string) => void;
|
|
779
|
+
setCloseOnEscape: (value: boolean) => void;
|
|
780
|
+
__internal: {
|
|
781
|
+
closeOnEscape: boolean;
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
type StackedDrawerProps = PropsWithChildren<{
|
|
786
|
+
/**
|
|
787
|
+
* A unique identifier for the modal. This is used to differentiate stacked modals,
|
|
788
|
+
* when multiple stacked modals are registered to the same parent modal.
|
|
789
|
+
*/
|
|
790
|
+
id: string;
|
|
791
|
+
}>;
|
|
792
|
+
/**
|
|
793
|
+
* A stacked modal that can be rendered above a parent modal.
|
|
794
|
+
*/
|
|
795
|
+
declare const Root$2: ComponentType<StackedDrawerProps>;
|
|
796
|
+
declare const StackedDrawer: typeof Root$2 & {
|
|
797
|
+
Close: typeof Drawer.Close;
|
|
798
|
+
Header: typeof Drawer.Header;
|
|
799
|
+
Body: typeof Drawer.Body;
|
|
800
|
+
Content: typeof Drawer.Content;
|
|
801
|
+
Trigger: typeof Drawer.Trigger;
|
|
802
|
+
Footer: typeof Drawer.Footer;
|
|
803
|
+
Description: typeof Drawer.Description;
|
|
804
|
+
Title: typeof Drawer.Title;
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
type StackedFocusModalProps = PropsWithChildren<{
|
|
808
|
+
/**
|
|
809
|
+
* A unique identifier for the modal. This is used to differentiate stacked modals,
|
|
810
|
+
* when multiple stacked modals are registered to the same parent modal.
|
|
811
|
+
*/
|
|
812
|
+
id: string;
|
|
813
|
+
/**
|
|
814
|
+
* An optional callback that is called when the modal is opened or closed.
|
|
815
|
+
*/
|
|
816
|
+
onOpenChangeCallback?: (open: boolean) => void;
|
|
817
|
+
}>;
|
|
818
|
+
/**
|
|
819
|
+
* A stacked modal that can be rendered above a parent modal.
|
|
820
|
+
*/
|
|
821
|
+
declare const Root$1: ComponentType<StackedFocusModalProps>;
|
|
822
|
+
declare const StackedFocusModal: typeof Root$1 & {
|
|
823
|
+
Close: typeof FocusModal.Close;
|
|
824
|
+
Header: typeof FocusModal.Header;
|
|
825
|
+
Body: typeof FocusModal.Body;
|
|
826
|
+
Content: typeof FocusModal.Content;
|
|
827
|
+
Trigger: typeof FocusModal.Trigger;
|
|
828
|
+
Footer: typeof FocusModal.Footer;
|
|
829
|
+
Description: typeof FocusModal.Description;
|
|
830
|
+
Title: typeof FocusModal.Title;
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
declare const useStackedModal: () => {
|
|
834
|
+
getIsOpen: (id: string) => boolean;
|
|
835
|
+
setIsOpen: (id: string, open: boolean) => void;
|
|
836
|
+
register: (id: string) => void;
|
|
837
|
+
unregister: (id: string) => void;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
interface TabDefinition<T extends FieldValues = FieldValues> {
|
|
841
|
+
id: string;
|
|
842
|
+
labelKey: string;
|
|
843
|
+
label?: string;
|
|
844
|
+
validationFields?: FieldPath<T>[];
|
|
845
|
+
isVisible?: (form: UseFormReturn<T>) => boolean;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
declare const useTabbedForm: <T extends FieldValues = FieldValues>() => UseFormReturn<T>;
|
|
849
|
+
type FooterRenderProps = {
|
|
850
|
+
isLastTab: boolean;
|
|
851
|
+
onNext: () => void;
|
|
852
|
+
isLoading?: boolean;
|
|
853
|
+
};
|
|
854
|
+
type TabbedFormProps<T extends FieldValues> = {
|
|
855
|
+
form: UseFormReturn<T>;
|
|
856
|
+
onSubmit: (e?: React.BaseSyntheticEvent) => void;
|
|
857
|
+
children: ReactNode;
|
|
858
|
+
isLoading?: boolean;
|
|
859
|
+
footer?: (props: FooterRenderProps) => ReactNode;
|
|
860
|
+
transformTabs?: (tabs: TabDefinition<T>[]) => TabDefinition<T>[];
|
|
861
|
+
};
|
|
862
|
+
declare function Root<T extends FieldValues>({ form, onSubmit, children, isLoading, footer, transformTabs, }: TabbedFormProps<T>): react_jsx_runtime.JSX.Element;
|
|
863
|
+
declare const TabbedForm: typeof Root & {
|
|
864
|
+
Tab: ({ children, }: {
|
|
865
|
+
id: string;
|
|
866
|
+
label: string;
|
|
867
|
+
children?: ReactNode;
|
|
868
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
869
|
+
useForm: <T extends FieldValues = FieldValues>() => UseFormReturn<T>;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
type TabState = Record<string, ProgressStatus>;
|
|
873
|
+
declare const useTabManagement: <T extends FieldValues>({ tabs, form, }: {
|
|
874
|
+
tabs: TabDefinition<T>[];
|
|
875
|
+
form: UseFormReturn<T>;
|
|
876
|
+
}) => {
|
|
877
|
+
activeTabId: string;
|
|
878
|
+
setActiveTabId: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
879
|
+
tabState: TabState;
|
|
880
|
+
visibleTabs: TabDefinition<T>[];
|
|
881
|
+
isLastTab: boolean;
|
|
882
|
+
onNext: () => Promise<void>;
|
|
883
|
+
onTabChange: (tabId: string) => Promise<void>;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
type DataTableOrderByKey<TData> = {
|
|
887
|
+
key: keyof TData;
|
|
888
|
+
label: string;
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
interface DataTableQueryProps<TData> {
|
|
892
|
+
search?: boolean | "autofocus";
|
|
893
|
+
orderBy?: DataTableOrderByKey<TData>[];
|
|
894
|
+
filters?: Filter[];
|
|
895
|
+
prefix?: string;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
type BulkCommand = {
|
|
899
|
+
label: string;
|
|
900
|
+
shortcut: string;
|
|
901
|
+
action: (selection: Record<string, boolean>) => Promise<void>;
|
|
902
|
+
};
|
|
903
|
+
interface DataTableRootProps<TData> {
|
|
904
|
+
/**
|
|
905
|
+
* The table instance to render
|
|
906
|
+
*/
|
|
907
|
+
table: Table<TData>;
|
|
908
|
+
/**
|
|
909
|
+
* The columns to render
|
|
910
|
+
*/
|
|
911
|
+
columns: ColumnDef<TData, any>[];
|
|
912
|
+
/**
|
|
913
|
+
* Function to generate a link to navigate to when clicking on a row
|
|
914
|
+
*/
|
|
915
|
+
navigateTo?: (row: Row<TData>) => string;
|
|
916
|
+
/**
|
|
917
|
+
* Bulk actions to render
|
|
918
|
+
*/
|
|
919
|
+
commands?: BulkCommand[];
|
|
920
|
+
/**
|
|
921
|
+
* The total number of items in the table
|
|
922
|
+
*/
|
|
923
|
+
count?: number;
|
|
924
|
+
/**
|
|
925
|
+
* Whether to display pagination controls
|
|
926
|
+
*/
|
|
927
|
+
pagination?: boolean;
|
|
928
|
+
/**
|
|
929
|
+
* Whether the table is empty due to no results from the active query
|
|
930
|
+
*/
|
|
931
|
+
noResults?: boolean;
|
|
932
|
+
/**
|
|
933
|
+
* Whether to display the tables header
|
|
934
|
+
*/
|
|
935
|
+
noHeader?: boolean;
|
|
936
|
+
/**
|
|
937
|
+
* The layout of the table
|
|
938
|
+
*/
|
|
939
|
+
layout?: "fill" | "fit";
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
interface DataTableProps<TData> extends Omit<DataTableRootProps<TData>, "noResults">, DataTableQueryProps<TData> {
|
|
943
|
+
isLoading?: boolean;
|
|
944
|
+
pageSize: number;
|
|
945
|
+
queryObject?: Record<string, any>;
|
|
946
|
+
noRecords?: Pick<NoResultsProps, "title" | "message">;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* @deprecated Use the DataTable component from "/components/data-table" instead
|
|
950
|
+
*/
|
|
951
|
+
declare const _DataTable: <TData>({ table, columns, pagination, navigateTo, commands, count, search, orderBy, filters, prefix, queryObject, pageSize, isLoading, noHeader, layout, noRecords: noRecordsProps, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
952
|
+
|
|
953
|
+
type Option = {
|
|
954
|
+
label: string;
|
|
955
|
+
value: unknown;
|
|
956
|
+
};
|
|
957
|
+
type Filter = {
|
|
958
|
+
key: string;
|
|
959
|
+
label: string;
|
|
960
|
+
} & ({
|
|
961
|
+
type: "select";
|
|
962
|
+
options: Option[];
|
|
963
|
+
multiple?: boolean;
|
|
964
|
+
searchable?: boolean;
|
|
965
|
+
} | {
|
|
966
|
+
type: "date";
|
|
967
|
+
options?: never;
|
|
968
|
+
} | {
|
|
969
|
+
type: "string";
|
|
970
|
+
options?: never;
|
|
971
|
+
} | {
|
|
972
|
+
type: "number";
|
|
973
|
+
options?: never;
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
type CellProps$1 = {
|
|
977
|
+
code: string;
|
|
978
|
+
};
|
|
979
|
+
type HeaderProps$1 = {
|
|
980
|
+
text: string;
|
|
981
|
+
};
|
|
982
|
+
declare const CodeCell: ({ code }: CellProps$1) => react_jsx_runtime.JSX.Element;
|
|
983
|
+
declare const CodeHeader: ({ text }: HeaderProps$1) => react_jsx_runtime.JSX.Element;
|
|
984
|
+
|
|
985
|
+
type DateCellProps$1 = {
|
|
986
|
+
date: Date | string | undefined;
|
|
987
|
+
};
|
|
988
|
+
declare const CreatedAtCell: ({ date }: DateCellProps$1) => react_jsx_runtime.JSX.Element;
|
|
989
|
+
declare const CreatedAtHeader: () => react_jsx_runtime.JSX.Element;
|
|
990
|
+
|
|
991
|
+
type DateCellProps = {
|
|
992
|
+
date?: Date | string | null;
|
|
993
|
+
};
|
|
994
|
+
declare const DateCell: ({ date }: DateCellProps) => react_jsx_runtime.JSX.Element;
|
|
995
|
+
declare const DateHeader: () => react_jsx_runtime.JSX.Element;
|
|
996
|
+
|
|
997
|
+
type EmailCellProps = {
|
|
998
|
+
email?: string | null;
|
|
999
|
+
};
|
|
1000
|
+
declare const EmailCell: ({ email }: EmailCellProps) => react_jsx_runtime.JSX.Element;
|
|
1001
|
+
declare const EmailHeader: () => react_jsx_runtime.JSX.Element;
|
|
1002
|
+
|
|
1003
|
+
type MoneyAmountCellProps = {
|
|
1004
|
+
currencyCode: string;
|
|
1005
|
+
amount?: number | null;
|
|
1006
|
+
align?: "left" | "right";
|
|
1007
|
+
className?: string;
|
|
1008
|
+
};
|
|
1009
|
+
declare const MoneyAmountCell: ({ currencyCode, amount, align, className, }: MoneyAmountCellProps) => react_jsx_runtime.JSX.Element;
|
|
1010
|
+
|
|
1011
|
+
type NameCellProps = {
|
|
1012
|
+
firstName?: string | null;
|
|
1013
|
+
lastName?: string | null;
|
|
1014
|
+
};
|
|
1015
|
+
declare const NameCell: ({ firstName, lastName }: NameCellProps) => react_jsx_runtime.JSX.Element;
|
|
1016
|
+
declare const NameHeader: () => react_jsx_runtime.JSX.Element;
|
|
1017
|
+
|
|
1018
|
+
declare const PlaceholderCell: () => react_jsx_runtime.JSX.Element;
|
|
1019
|
+
|
|
1020
|
+
type StatusCellProps = PropsWithChildren<{
|
|
1021
|
+
color?: "green" | "red" | "blue" | "orange" | "grey" | "purple";
|
|
1022
|
+
}>;
|
|
1023
|
+
/**
|
|
1024
|
+
* @deprecated Use the new DataTable and DataTableStatusCell instead
|
|
1025
|
+
*/
|
|
1026
|
+
declare const StatusCell: ({ color, children }: StatusCellProps) => react_jsx_runtime.JSX.Element;
|
|
1027
|
+
|
|
1028
|
+
type CellProps = {
|
|
1029
|
+
text?: string | number;
|
|
1030
|
+
align?: "left" | "center" | "right";
|
|
1031
|
+
maxWidth?: number;
|
|
1032
|
+
};
|
|
1033
|
+
type HeaderProps = {
|
|
1034
|
+
text: string;
|
|
1035
|
+
align?: "left" | "center" | "right";
|
|
1036
|
+
};
|
|
1037
|
+
declare const TextCell: ({ text, align, maxWidth }: CellProps) => react_jsx_runtime.JSX.Element;
|
|
1038
|
+
declare const TextHeader: ({ text, align }: HeaderProps) => react_jsx_runtime.JSX.Element;
|
|
1039
|
+
|
|
1040
|
+
declare const useCombinedRefs: <T>(...refs: (Ref<T> | undefined)[]) => RefCallback<T>;
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Base interface for a command that can be managed
|
|
1044
|
+
* by the `useCommandHistory` hook.
|
|
1045
|
+
*/
|
|
1046
|
+
interface Command {
|
|
1047
|
+
execute: () => void;
|
|
1048
|
+
undo: () => void;
|
|
1049
|
+
redo: () => void;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Hook to manage a history of commands that can be undone, redone, and executed.
|
|
1053
|
+
*/
|
|
1054
|
+
declare const useCommandHistory: (maxHistory?: number) => {
|
|
1055
|
+
undo: () => void;
|
|
1056
|
+
redo: () => void;
|
|
1057
|
+
execute: (command: Command) => void;
|
|
1058
|
+
canUndo: boolean;
|
|
1059
|
+
canRedo: boolean;
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
type UseDataTableProps<TData> = {
|
|
1063
|
+
data?: TData[];
|
|
1064
|
+
columns: ColumnDef<TData, any>[];
|
|
1065
|
+
count?: number;
|
|
1066
|
+
pageSize?: number;
|
|
1067
|
+
enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
|
|
1068
|
+
rowSelection?: {
|
|
1069
|
+
state: RowSelectionState;
|
|
1070
|
+
updater: OnChangeFn<RowSelectionState>;
|
|
1071
|
+
};
|
|
1072
|
+
enablePagination?: boolean;
|
|
1073
|
+
enableExpandableRows?: boolean;
|
|
1074
|
+
getRowId?: (original: TData, index: number) => string;
|
|
1075
|
+
getSubRows?: (original: TData) => TData[];
|
|
1076
|
+
meta?: Record<string, unknown>;
|
|
1077
|
+
prefix?: string;
|
|
1078
|
+
};
|
|
1079
|
+
declare const useDataTable: <TData>({ data, columns, count, pageSize: _pageSize, enablePagination, enableRowSelection, enableExpandableRows, rowSelection: _rowSelection, getSubRows, getRowId, meta, prefix, }: UseDataTableProps<TData>) => {
|
|
1080
|
+
table: _tanstack_react_table.Table<TData>;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
declare const useDate: () => {
|
|
1084
|
+
getFullDate: ({ date, includeTime, }: {
|
|
1085
|
+
date: string | Date;
|
|
1086
|
+
includeTime?: boolean;
|
|
1087
|
+
}) => string;
|
|
1088
|
+
getRelativeDate: (date: string | Date) => string;
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Hook to get the current document direction (ltr/rtl) and listen for changes
|
|
1093
|
+
* @returns The current document direction as "ltr" | "rtl" | undefined
|
|
1094
|
+
*/
|
|
1095
|
+
declare const useDocumentDirection: () => "ltr" | "rtl" | undefined;
|
|
1096
|
+
|
|
1097
|
+
type QueryParams<T extends string> = {
|
|
1098
|
+
[key in T]: string | undefined;
|
|
1099
|
+
};
|
|
1100
|
+
declare function useQueryParams<T extends string>(keys: T[], prefix?: string): QueryParams<T>;
|
|
1101
|
+
|
|
1102
|
+
export { type Action, type ActionGroup, ActionMenu, AddressForm, BadgeListSummary, ChipGroup, CodeCell, CodeHeader, type Command, ConditionalTooltip, CreatedAtCell, CreatedAtHeader, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, EmailCell, EmailForm, EmailHeader, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, GeneralSectionSkeleton, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, LinkButton, ListSummary, Listicle, type ListicleProps, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, NoRecords, NoResults, type NoResultsProps, OrderBy, PlaceholderCell, ProgressBar, Query, RouteDrawer, RouteFocusModal, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TwoColumnPage, TwoColumnPageSkeleton, type UseQueryOptionsWrapper, _DataTable, createDataGridHelper, createDataGridPriceColumns, queryKeysFactory, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDocumentDirection, useQueryParams, useRouteModal, useStackedModal, useTabManagement, useTabbedForm };
|