@bixlab/mtone 0.2.0 → 0.3.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 CHANGED
@@ -2,162 +2,85 @@ import * as _base_ui_react from '@base-ui/react';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import { Button as Button$1 } from '@base-ui/react/button';
5
+ import * as _rc_component_table_es_Footer_Cell from '@rc-component/table/es/Footer/Cell';
6
+ import * as _rc_component_table_es_Footer_Row from '@rc-component/table/es/Footer/Row';
7
+ import * as _rc_component_table_es_Footer_Summary from '@rc-component/table/es/Footer/Summary';
8
+ import { TableProps as TableProps$1, ColumnType, ExpandableConfig, Reference } from '@rc-component/table';
5
9
  import { ToastManagerAddOptions, ToastManagerUpdateOptions, ToastObject } from '@base-ui/react/toast';
6
10
 
7
- declare const cn: (...v: (string | false | null | undefined)[]) => string;
8
- type Locale = "zh" | "en";
9
- type Tokens = React.CSSProperties & Record<`--mt-${string}`, string | number>;
10
- type Context = {
11
- locale: Locale;
12
- density: "compact" | "comfortable";
13
- tokens?: Tokens;
14
- };
15
- declare const useMtone: () => Context;
16
- declare function MtoneScope({ children, className, style, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
17
- declare function MtoneProvider({ children, locale, density, tokens, }: Partial<Context> & {
18
- children: React.ReactNode;
19
- }): React.JSX.Element;
20
- type ButtonProps = Omit<React.ComponentPropsWithoutRef<typeof Button$1>, "className"> & {
21
- className?: string;
22
- variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
23
- size?: "sm" | "md" | "lg";
24
- danger?: boolean;
25
- loading?: boolean;
26
- icon?: React.ReactNode;
27
- };
28
- declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.ButtonProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "className"> & {
29
- className?: string;
30
- variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
31
- size?: "sm" | "md" | "lg";
32
- danger?: boolean;
33
- loading?: boolean;
34
- icon?: React.ReactNode;
35
- } & React.RefAttributes<HTMLButtonElement>>;
36
- declare const IconButton: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.ButtonProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "className"> & {
37
- className?: string;
38
- variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
39
- size?: "sm" | "md" | "lg";
40
- danger?: boolean;
41
- loading?: boolean;
42
- icon?: React.ReactNode;
43
- } & {
44
- "aria-label": string;
45
- } & React.RefAttributes<HTMLButtonElement>>;
46
- declare const ButtonGroup: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
47
- declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
48
- declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
49
- declare const SearchInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
50
- declare function FormField({ label, error, description, required, children, }: {
51
- label: React.ReactNode;
52
- error?: React.ReactNode;
53
- description?: React.ReactNode;
11
+ type FormValues = Record<string, unknown>;
12
+ interface FormRule {
54
13
  required?: boolean;
55
- children: React.ReactElement;
56
- }): React.JSX.Element;
57
- declare const Form: ({ className, ...p }: React.FormHTMLAttributes<HTMLFormElement>) => React.JSX.Element;
58
- type Tone = "neutral" | "blue" | "green" | "orange" | "red" | "purple";
59
- declare function Badge({ children, tone, onRemove, className, ...p }: React.HTMLAttributes<HTMLSpanElement> & {
60
- tone?: Tone;
61
- onRemove?: () => void;
62
- }): React.JSX.Element;
63
- declare const Status: ({ children, tone, }: {
64
- children: React.ReactNode;
65
- tone?: Tone;
66
- }) => React.JSX.Element;
67
- declare function Avatar({ src, name, size, }: {
68
- src?: string;
69
- name?: string;
70
- size?: number;
71
- }): React.JSX.Element;
72
- declare function AvatarGroup({ items, max, }: {
73
- items: {
74
- name: string;
75
- src?: string;
76
- }[];
14
+ type?: "string" | "number" | "boolean" | "array" | "email" | "url" | "integer";
15
+ min?: number;
77
16
  max?: number;
78
- }): React.JSX.Element;
79
- declare function Progress({ value, label }: {
80
- value: number;
81
- label?: string;
82
- }): React.JSX.Element;
83
- declare const Text: ({ muted, className, ...p }: React.HTMLAttributes<HTMLSpanElement> & {
84
- muted?: boolean;
85
- }) => React.JSX.Element;
86
- declare const Divider: () => React.JSX.Element;
87
- declare const Card: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
88
- declare const List: ({ className, ...p }: React.HTMLAttributes<HTMLUListElement>) => React.JSX.Element;
89
- declare function ListItem({ children, icon, description, actions, ...p }: React.LiHTMLAttributes<HTMLLIElement> & {
90
- icon?: React.ReactNode;
91
- description?: React.ReactNode;
92
- actions?: React.ReactNode;
93
- }): React.JSX.Element;
94
- type DocumentItem = {
95
- id: string;
96
- title: string;
97
- description?: string;
98
- updatedAt?: string;
99
- icon?: React.ReactNode;
100
- onClick?: () => void;
101
- };
102
- declare function DocumentList({ items }: {
103
- items: DocumentItem[];
104
- }): React.JSX.Element;
105
- declare function DocumentCard({ title, description, icon, updatedAt, onClick, }: DocumentItem): React.JSX.Element;
106
- declare const PropertyList: ({ children }: {
107
- children: React.ReactNode;
108
- }) => React.JSX.Element;
109
- declare const PropertyItem: ({ label, children, }: {
110
- label: React.ReactNode;
111
- children: React.ReactNode;
112
- }) => React.JSX.Element;
113
- declare function Alert({ tone, title, children, onClose, }: {
114
- tone?: "info" | "success" | "warning" | "error";
115
- title?: React.ReactNode;
116
- children?: React.ReactNode;
117
- onClose?: () => void;
118
- }): React.JSX.Element;
119
- declare function Empty({ title, description, action, }: {
120
- title?: React.ReactNode;
121
- description?: React.ReactNode;
122
- action?: React.ReactNode;
123
- }): React.JSX.Element;
124
- declare const Skeleton: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
125
- declare function Spinner({ label }: {
126
- label?: string;
127
- }): React.JSX.Element;
17
+ len?: number;
18
+ pattern?: RegExp;
19
+ whitespace?: boolean;
20
+ message?: string;
21
+ validator?: (rule: FormRule, value: unknown, values: FormValues) => void | string | Promise<void | string>;
22
+ }
23
+ interface FormFieldError {
24
+ name: string;
25
+ errors: string[];
26
+ }
27
+ interface FormValidationError {
28
+ values: FormValues;
29
+ errorFields: FormFieldError[];
30
+ outOfDate: boolean;
31
+ }
32
+ interface FieldRegistration {
33
+ rules?: FormRule[];
34
+ initialValue?: unknown;
35
+ }
36
+ interface FormInstance {
37
+ getFieldValue(name: string): unknown;
38
+ getFieldsValue(): FormValues;
39
+ setFieldValue(name: string, value: unknown): void;
40
+ setFieldsValue(values: FormValues): void;
41
+ getFieldError(name: string): string[];
42
+ getFieldsError(names?: string[]): FormFieldError[];
43
+ isFieldValidating(name: string): boolean;
44
+ validateFields(names?: string[]): Promise<FormValues>;
45
+ resetFields(names?: string[]): void;
46
+ subscribe(listener: () => void): () => void;
47
+ getSnapshot(): number;
48
+ register(name: string, config: FieldRegistration): () => void;
49
+ /** Updates reset defaults; only absent values are initialized, never edited values. */
50
+ setInitialValues(values: FormValues): void;
51
+ }
128
52
 
129
- type SidebarProps = React.HTMLAttributes<HTMLElement> & {
130
- header?: React.ReactNode | ((collapsed: boolean) => React.ReactNode);
131
- footer?: React.ReactNode | ((collapsed: boolean) => React.ReactNode);
132
- collapsePlacement?: "header" | "footer";
133
- collapsible?: boolean;
134
- collapsed?: boolean;
135
- defaultCollapsed?: boolean;
136
- onCollapsedChange?: (collapsed: boolean) => void;
137
- collapseLabel?: string;
138
- expandLabel?: string;
53
+ type FormValidateTrigger = "onChange" | "onBlur" | ("onChange" | "onBlur")[] | false;
54
+ declare function useForm(): [FormInstance];
55
+ interface FormFieldProps {
56
+ label: React__default.ReactNode;
57
+ error?: React__default.ReactNode;
58
+ description?: React__default.ReactNode;
59
+ required?: boolean;
60
+ children: React__default.ReactElement;
61
+ /** Flat field key. Omit to retain manual error/controlled-value behavior. */
62
+ name?: string;
63
+ rules?: FormRule[];
64
+ initialValue?: unknown;
65
+ validateTrigger?: FormValidateTrigger;
66
+ valuePropName?: string;
67
+ trigger?: string;
68
+ getValueFromEvent?: (...args: any[]) => unknown;
69
+ }
70
+ declare function FormField({ label, error, description, required, children, name, rules, initialValue, validateTrigger, valuePropName, trigger: triggerProp, getValueFromEvent }: FormFieldProps): React__default.JSX.Element;
71
+ interface FormProps extends React__default.FormHTMLAttributes<HTMLFormElement> {
72
+ form?: FormInstance;
73
+ initialValues?: FormValues;
74
+ validateTrigger?: FormValidateTrigger;
75
+ onFinish?: (values: FormValues) => void;
76
+ onFinishFailed?: (error: FormValidationError) => void;
77
+ onValuesChange?: (changed: FormValues, values: FormValues) => void;
78
+ }
79
+ declare function FormRoot({ form: supplied, initialValues, validateTrigger, onFinish, onFinishFailed, onValuesChange, className, onSubmit, onReset, noValidate, children, ...props }: FormProps): React__default.JSX.Element;
80
+ declare const Form: typeof FormRoot & {
81
+ useForm: typeof useForm;
82
+ Item: typeof FormField;
139
83
  };
140
- declare function Sidebar({ className, children, header, footer, collapsePlacement, collapsible, collapsed, defaultCollapsed, onCollapsedChange, collapseLabel, expandLabel, ...p }: SidebarProps): React.JSX.Element;
141
- declare const NavItem: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
142
- active?: boolean;
143
- icon?: React.ReactNode;
144
- } & React.RefAttributes<HTMLButtonElement>>;
145
- declare function NavGroup({ label, children, }: {
146
- label?: React.ReactNode;
147
- children: React.ReactNode;
148
- }): React.JSX.Element;
149
- declare function Breadcrumb({ items, "aria-label": label, }: {
150
- items: {
151
- label: React.ReactNode;
152
- href?: string;
153
- }[];
154
- "aria-label"?: string;
155
- }): React.JSX.Element;
156
- declare function FilterChip({ children, onRemove, }: {
157
- children: React.ReactNode;
158
- onRemove: () => void;
159
- }): React.JSX.Element;
160
- declare const FilterBar: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
161
84
 
162
85
  type ToastPosition = "top-right" | "bottom-right" | "top-left" | "bottom-left" | "top-center" | "bottom-center" | "center" | "center-top";
163
86
  type ToastType = "success" | "error" | "info" | "loading";
@@ -234,16 +157,30 @@ interface RadioGroupProps extends Common, ValueProps<string> {
234
157
  orientation?: "horizontal" | "vertical";
235
158
  }
236
159
  declare function RadioGroup({ options, label, className, orientation, ...props }: RadioGroupProps): React__default.JSX.Element;
237
- interface SelectProps extends Common, ValueProps<string | null>, OpenProps {
160
+ interface FieldControlProps {
161
+ id?: string;
162
+ "aria-invalid"?: React__default.AriaAttributes["aria-invalid"];
163
+ "aria-describedby"?: string;
164
+ "aria-labelledby"?: string;
165
+ "aria-busy"?: boolean;
166
+ onBlur?: React__default.FocusEventHandler<HTMLElement>;
167
+ }
168
+ interface SelectProps extends Common, ValueProps<string | null>, OpenProps, FieldControlProps {
238
169
  options: Option[];
239
170
  placeholder?: string;
240
171
  }
241
- declare function Select({ options, label, placeholder, className, ...props }: SelectProps): React__default.JSX.Element;
242
- interface MultiSelectProps extends Common, ValueProps<string[]>, OpenProps {
172
+ declare function Select({ options, label, placeholder, className, id, onBlur, "aria-invalid": invalid, "aria-describedby": describedBy, "aria-labelledby": labelledBy, "aria-busy": busy, ...props }: SelectProps): React__default.JSX.Element;
173
+ declare namespace Select {
174
+ var formValueType: "nullable";
175
+ }
176
+ interface MultiSelectProps extends Common, ValueProps<string[]>, OpenProps, FieldControlProps {
243
177
  options: Option[];
244
178
  placeholder?: string;
245
179
  }
246
- declare function MultiSelect({ options, label, placeholder, className, ...props }: MultiSelectProps): React__default.JSX.Element;
180
+ declare function MultiSelect({ options, label, placeholder, className, id, onBlur, "aria-invalid": invalid, "aria-describedby": describedBy, "aria-labelledby": labelledBy, "aria-busy": busy, ...props }: MultiSelectProps): React__default.JSX.Element;
181
+ declare namespace MultiSelect {
182
+ var formValueType: "array";
183
+ }
247
184
  interface SliderProps extends Common, ValueProps<number> {
248
185
  min?: number;
249
186
  max?: number;
@@ -294,7 +231,7 @@ declare function Popover({ trigger, content, title, side, ...props }: PopoverPro
294
231
  declare function Tooltip({ children, content, side, ...props }: Omit<PopoverProps, "trigger" | "title"> & {
295
232
  children: React__default.ReactElement;
296
233
  }): React__default.JSX.Element;
297
- interface ModalProps extends OpenProps {
234
+ interface DialogFrameProps extends OpenProps {
298
235
  title: React__default.ReactNode;
299
236
  description?: React__default.ReactNode;
300
237
  children?: React__default.ReactNode;
@@ -302,32 +239,244 @@ interface ModalProps extends OpenProps {
302
239
  trigger?: React__default.ReactElement;
303
240
  className?: string;
304
241
  }
305
- declare function Modal({ title, description, children, footer, trigger, className, ...props }: ModalProps): React__default.JSX.Element;
306
- interface ConfirmDialogProps extends ModalProps {
242
+ interface DialogProps extends DialogFrameProps {
243
+ /** Whether outside clicks are blocked from dismissing the dialog. Does not change focus trapping, scroll locking, Escape, or the close button. @default true */
244
+ modal?: boolean;
245
+ }
246
+ declare function Dialog({ modal, title, description, children, footer, trigger, className, ...props }: DialogProps): React__default.JSX.Element;
247
+ /** @deprecated Use DialogProps instead. */
248
+ type ModalProps = DialogProps;
249
+ /** @deprecated Use Dialog instead. */
250
+ declare const Modal: typeof Dialog;
251
+ interface ConfirmDialogProps extends DialogFrameProps {
307
252
  onConfirm?: () => void | Promise<void>;
308
253
  confirmText?: string;
309
254
  cancelText?: string;
310
255
  danger?: boolean;
311
256
  }
312
257
  declare function ConfirmDialog({ title, description, children, trigger, confirmText, cancelText, onConfirm, danger, open, defaultOpen, onOpenChange, }: ConfirmDialogProps): React__default.JSX.Element;
313
- declare function Drawer({ title, description, children, footer, trigger, className, ...props }: ModalProps): React__default.JSX.Element;
258
+ declare function Drawer({ title, description, children, footer, trigger, className, ...props }: DialogFrameProps): React__default.JSX.Element;
314
259
 
315
- type PaginationProps = {
316
- total: number;
317
- pageSize?: number;
318
- page: number;
319
- onPageChange: (page: number) => void;
260
+ type CardSemantic = "root" | "header" | "title" | "extra" | "cover" | "body" | "actions" | "tabs";
261
+ type CardSemanticValue<K extends string, V, P> = Partial<Record<K, V>> | ((info: {
262
+ props: P;
263
+ }) => Partial<Record<K, V>>);
264
+ interface CardTokens {
265
+ bodyPadding?: number | string;
266
+ bodyPaddingSM?: number | string;
267
+ headerPadding?: number | string;
268
+ headerPaddingSM?: number | string;
269
+ headerHeight?: number | string;
270
+ headerHeightSM?: number | string;
271
+ headerFontSize?: number | string;
272
+ headerFontSizeSM?: number | string;
273
+ headerBg?: string;
274
+ actionsBg?: string;
275
+ actionsPadding?: number | string;
276
+ borderRadius?: number | string;
277
+ gridMinWidth?: number | string;
278
+ }
279
+ interface CardTabItem {
280
+ key: string;
281
+ label: React.ReactNode;
282
+ content?: React.ReactNode;
283
+ disabled?: boolean;
284
+ }
285
+ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
286
+ title?: React.ReactNode;
287
+ /** Native HTML tooltip, formerly supplied through title. */
288
+ htmlTitle?: string;
289
+ extra?: React.ReactNode;
290
+ cover?: React.ReactNode;
291
+ actions?: React.ReactNode[];
292
+ loading?: boolean;
293
+ loadingLabel?: string;
294
+ size?: "medium" | "small";
295
+ variant?: "outlined" | "borderless";
296
+ hoverable?: boolean;
297
+ type?: "inner";
298
+ tabList?: CardTabItem[];
299
+ activeTabKey?: string;
300
+ defaultActiveTabKey?: string;
301
+ onTabChange?: (key: string) => void;
302
+ tabBarExtraContent?: React.ReactNode;
303
+ tabProps?: Pick<TabsProps, "className">;
304
+ classNames?: CardSemanticValue<CardSemantic, string, CardProps>;
305
+ styles?: CardSemanticValue<CardSemantic, React.CSSProperties, CardProps>;
306
+ tokens?: CardTokens;
307
+ }
308
+ declare function CardRoot(props: CardProps): React.JSX.Element;
309
+ type CardMetaSemantic = "root" | "section" | "avatar" | "title" | "description";
310
+ interface CardMetaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
311
+ avatar?: React.ReactNode;
312
+ title?: React.ReactNode;
313
+ htmlTitle?: string;
314
+ description?: React.ReactNode;
315
+ classNames?: CardSemanticValue<CardMetaSemantic, string, CardMetaProps>;
316
+ styles?: CardSemanticValue<CardMetaSemantic, React.CSSProperties, CardMetaProps>;
317
+ }
318
+ declare function CardMeta(props: CardMetaProps): React.JSX.Element;
319
+ interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {
320
+ hoverable?: boolean;
321
+ }
322
+ declare function CardGrid({ hoverable, className, ...props }: CardGridProps): React.JSX.Element;
323
+ declare const Card: typeof CardRoot & {
324
+ Meta: typeof CardMeta;
325
+ Grid: typeof CardGrid;
326
+ };
327
+
328
+ declare const cn: (...v: (string | false | null | undefined)[]) => string;
329
+ type Locale = "zh" | "en";
330
+ type Tokens = React.CSSProperties & Record<`--mt-${string}`, string | number>;
331
+ type Context = {
332
+ locale: Locale;
333
+ density: "compact" | "comfortable";
334
+ tokens?: Tokens;
335
+ };
336
+ declare const useMtone: () => Context;
337
+ declare function MtoneScope({ children, className, style, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
338
+ declare function MtoneProvider({ children, locale, density, tokens, }: Partial<Context> & {
339
+ children: React.ReactNode;
340
+ }): React.JSX.Element;
341
+ type ButtonProps = Omit<React.ComponentPropsWithoutRef<typeof Button$1>, "className"> & {
320
342
  className?: string;
343
+ variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
344
+ size?: "sm" | "md" | "lg";
345
+ danger?: boolean;
346
+ loading?: boolean;
347
+ icon?: React.ReactNode;
321
348
  };
322
- declare function Pagination({ total, pageSize, page, onPageChange, className, }: PaginationProps): React.JSX.Element;
323
- type TableColumn<T> = {
324
- key: string;
325
- title: React.ReactNode;
326
- dataIndex?: keyof T;
327
- render?: (value: unknown, row: T, index: number) => React.ReactNode;
328
- sortable?: boolean;
329
- filterable?: boolean;
349
+ declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.ButtonProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "className"> & {
350
+ className?: string;
351
+ variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
352
+ size?: "sm" | "md" | "lg";
353
+ danger?: boolean;
354
+ loading?: boolean;
355
+ icon?: React.ReactNode;
356
+ } & React.RefAttributes<HTMLButtonElement>>;
357
+ declare const IconButton: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.ButtonProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "className"> & {
358
+ className?: string;
359
+ variant?: "blue" | "solid" | "outline" | "soft" | "ghost";
360
+ size?: "sm" | "md" | "lg";
361
+ danger?: boolean;
362
+ loading?: boolean;
363
+ icon?: React.ReactNode;
364
+ } & {
365
+ "aria-label": string;
366
+ } & React.RefAttributes<HTMLButtonElement>>;
367
+ declare const ButtonGroup: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
368
+ declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
369
+ declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
370
+ declare const SearchInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
371
+
372
+ type Tone = "neutral" | "blue" | "green" | "orange" | "red" | "purple";
373
+ declare function Badge({ children, tone, onRemove, className, ...p }: React.HTMLAttributes<HTMLSpanElement> & {
374
+ tone?: Tone;
375
+ onRemove?: () => void;
376
+ }): React.JSX.Element;
377
+ declare const Status: ({ children, tone, }: {
378
+ children: React.ReactNode;
379
+ tone?: Tone;
380
+ }) => React.JSX.Element;
381
+ declare function Avatar({ src, name, size, }: {
382
+ src?: string;
383
+ name?: string;
384
+ size?: number;
385
+ }): React.JSX.Element;
386
+ declare function AvatarGroup({ items, max, }: {
387
+ items: {
388
+ name: string;
389
+ src?: string;
390
+ }[];
391
+ max?: number;
392
+ }): React.JSX.Element;
393
+ declare function Progress({ value, label }: {
394
+ value: number;
395
+ label?: string;
396
+ }): React.JSX.Element;
397
+ declare const Text: ({ muted, className, ...p }: React.HTMLAttributes<HTMLSpanElement> & {
398
+ muted?: boolean;
399
+ }) => React.JSX.Element;
400
+ declare const Divider: () => React.JSX.Element;
401
+
402
+ declare const List: ({ className, ...p }: React.HTMLAttributes<HTMLUListElement>) => React.JSX.Element;
403
+ declare function ListItem({ children, icon, description, actions, ...p }: React.LiHTMLAttributes<HTMLLIElement> & {
404
+ icon?: React.ReactNode;
405
+ description?: React.ReactNode;
406
+ actions?: React.ReactNode;
407
+ }): React.JSX.Element;
408
+ type DocumentItem = {
409
+ id: string;
410
+ title: string;
411
+ description?: string;
412
+ updatedAt?: string;
413
+ icon?: React.ReactNode;
414
+ onClick?: () => void;
415
+ };
416
+ declare function DocumentList({ items }: {
417
+ items: DocumentItem[];
418
+ }): React.JSX.Element;
419
+ declare function DocumentCard({ title, description, icon, updatedAt, onClick, }: DocumentItem): React.JSX.Element;
420
+ declare const PropertyList: ({ children }: {
421
+ children: React.ReactNode;
422
+ }) => React.JSX.Element;
423
+ declare const PropertyItem: ({ label, children, }: {
424
+ label: React.ReactNode;
425
+ children: React.ReactNode;
426
+ }) => React.JSX.Element;
427
+ declare function Alert({ tone, title, children, onClose, }: {
428
+ tone?: "info" | "success" | "warning" | "error";
429
+ title?: React.ReactNode;
430
+ children?: React.ReactNode;
431
+ onClose?: () => void;
432
+ }): React.JSX.Element;
433
+ declare function Empty({ title, description, action, }: {
434
+ title?: React.ReactNode;
435
+ description?: React.ReactNode;
436
+ action?: React.ReactNode;
437
+ }): React.JSX.Element;
438
+ declare const Skeleton: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
439
+ declare function Spinner({ label }: {
440
+ label?: string;
441
+ }): React.JSX.Element;
442
+
443
+ type SidebarProps = React.HTMLAttributes<HTMLElement> & {
444
+ header?: React.ReactNode | ((collapsed: boolean) => React.ReactNode);
445
+ footer?: React.ReactNode | ((collapsed: boolean) => React.ReactNode);
446
+ collapsePlacement?: "header" | "footer";
447
+ collapsible?: boolean;
448
+ collapsed?: boolean;
449
+ defaultCollapsed?: boolean;
450
+ onCollapsedChange?: (collapsed: boolean) => void;
451
+ collapseLabel?: string;
452
+ expandLabel?: string;
330
453
  };
454
+ declare function Sidebar({ className, children, header, footer, collapsePlacement, collapsible, collapsed, defaultCollapsed, onCollapsedChange, collapseLabel, expandLabel, ...p }: SidebarProps): React.JSX.Element;
455
+ declare const NavItem: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
456
+ active?: boolean;
457
+ icon?: React.ReactNode;
458
+ } & React.RefAttributes<HTMLButtonElement>>;
459
+ declare function NavGroup({ label, children, }: {
460
+ label?: React.ReactNode;
461
+ children: React.ReactNode;
462
+ }): React.JSX.Element;
463
+ declare function Breadcrumb({ items, "aria-label": label, }: {
464
+ items: {
465
+ label: React.ReactNode;
466
+ href?: string;
467
+ }[];
468
+ "aria-label"?: string;
469
+ }): React.JSX.Element;
470
+ declare function FilterChip({ children, onRemove, }: {
471
+ children: React.ReactNode;
472
+ onRemove: () => void;
473
+ }): React.JSX.Element;
474
+ declare const FilterBar: ({ className, ...p }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
475
+
476
+ type TableRef = Reference;
477
+ type SortOrder = "ascend" | "descend" | null;
478
+ type TableFilterValue = React.Key | boolean;
479
+ type TableFilters = Record<string, TableFilterValue[] | null>;
331
480
  type TableState = {
332
481
  sort?: {
333
482
  key: string;
@@ -337,29 +486,238 @@ type TableState = {
337
486
  page: number;
338
487
  pageSize: number;
339
488
  };
340
- /** Set sort to null to explicitly clear controlled sorting; omit sort for internal sorting. Row-key values retain their original type. */
341
- type TableProps<T> = {
342
- data: T[];
343
- columns: TableColumn<T>[];
344
- rowKey: keyof T | ((row: T) => React.Key);
489
+ type TableFilterItem = {
490
+ text: React.ReactNode;
491
+ value: TableFilterValue;
492
+ children?: TableFilterItem[];
493
+ };
494
+ type TableFilterDropdownProps = {
495
+ prefixCls: string;
496
+ selectedKeys: TableFilterValue[];
497
+ setSelectedKeys: (keys: TableFilterValue[]) => void;
498
+ confirm: (options?: {
499
+ closeDropdown?: boolean;
500
+ }) => void;
501
+ clearFilters: (options?: {
502
+ confirm?: boolean;
503
+ closeDropdown?: boolean;
504
+ }) => void;
505
+ close: () => void;
506
+ filters?: TableFilterItem[];
507
+ visible: boolean;
508
+ };
509
+ type TableSortResult<T> = {
510
+ column?: TableColumn<T>;
511
+ order?: SortOrder;
512
+ field?: TableColumn<T>["dataIndex"];
513
+ columnKey?: React.Key;
514
+ };
515
+ type TableColumnTitleProps<T> = {
516
+ sortColumns: {
517
+ column: TableColumn<T>;
518
+ order: SortOrder;
519
+ }[];
520
+ filters: TableFilters;
521
+ };
522
+ type TableColumn<T> = Omit<ColumnType<T>, "title" | "dataIndex"> & {
523
+ dataIndex?: keyof T | string | number | (string | number)[];
524
+ title?: React.ReactNode | ((props: TableColumnTitleProps<T>) => React.ReactNode);
525
+ children?: TableColumn<T>[];
526
+ sortable?: boolean;
527
+ filterable?: boolean;
528
+ sorter?: boolean | ((a: T, b: T, order?: SortOrder) => number) | {
529
+ compare?: (a: T, b: T, order?: SortOrder) => number;
530
+ multiple?: number;
531
+ };
532
+ sortOrder?: SortOrder;
533
+ defaultSortOrder?: SortOrder;
534
+ sortDirections?: Exclude<SortOrder, null>[];
535
+ sortIcon?: (props: {
536
+ sortOrder: SortOrder;
537
+ }) => React.ReactNode;
538
+ showSorterTooltip?: boolean | {
539
+ title?: React.ReactNode;
540
+ target?: "full-header" | "sorter-icon";
541
+ };
542
+ filters?: TableFilterItem[];
543
+ filteredValue?: TableFilterValue[] | null;
544
+ defaultFilteredValue?: TableFilterValue[] | null;
545
+ filtered?: boolean;
546
+ filterMultiple?: boolean;
547
+ filterMode?: "menu" | "tree";
548
+ filterSearch?: boolean | ((input: string, item: TableFilterItem) => boolean);
549
+ filterResetToDefaultFilteredValue?: boolean;
550
+ filterOnClose?: boolean;
551
+ filterDropdown?: React.ReactNode | ((props: TableFilterDropdownProps) => React.ReactNode);
552
+ filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode);
553
+ filterDropdownProps?: {
554
+ open?: boolean;
555
+ onOpenChange?: (open: boolean) => void;
556
+ className?: string;
557
+ style?: React.CSSProperties;
558
+ };
559
+ onFilter?: (value: TableFilterValue, record: T) => boolean;
560
+ responsive?: ("xs" | "sm" | "md" | "lg" | "xl" | "xxl")[];
561
+ };
562
+ type TableColumnsType<T> = TableColumn<T>[];
563
+ type TableSelectionType = "all" | "none" | "invert" | "single" | "multiple";
564
+ type TableRowSelection<T> = {
565
+ type?: "checkbox" | "radio";
566
+ selectedRowKeys?: React.Key[];
567
+ defaultSelectedRowKeys?: React.Key[];
568
+ onChange?: (keys: React.Key[], rows: T[], info: {
569
+ type: TableSelectionType;
570
+ }) => void;
571
+ onSelect?: (record: T, selected: boolean, rows: T[], event: Event) => void;
572
+ onSelectAll?: (selected: boolean, rows: T[], changeRows: T[]) => void;
573
+ onSelectInvert?: (keys: React.Key[]) => void;
574
+ onSelectNone?: () => void;
575
+ onSelectMultiple?: (selected: boolean, rows: T[], changeRows: T[]) => void;
576
+ getCheckboxProps?: (record: T) => Omit<React.InputHTMLAttributes<HTMLInputElement>, "checked" | "defaultChecked">;
577
+ getTitleCheckboxProps?: () => Omit<React.InputHTMLAttributes<HTMLInputElement>, "checked" | "defaultChecked">;
578
+ checkStrictly?: boolean;
579
+ preserveSelectedRowKeys?: boolean;
580
+ hideSelectAll?: boolean;
581
+ columnTitle?: React.ReactNode | ((original: React.ReactNode) => React.ReactNode);
582
+ columnWidth?: number | string;
583
+ align?: "left" | "right" | "center";
584
+ fixed?: boolean;
585
+ renderCell?: (checked: boolean, record: T, index: number, origin: React.ReactNode) => React.ReactNode;
586
+ onCell?: ColumnType<T>["onCell"];
587
+ selections?: boolean | ("all" | "none" | "invert" | {
588
+ key: string;
589
+ text: React.ReactNode;
590
+ onSelect: (keys: React.Key[]) => void;
591
+ })[];
592
+ };
593
+ type TablePagination = {
594
+ page?: number;
595
+ current?: number;
596
+ defaultCurrent?: number;
597
+ pageSize?: number;
598
+ defaultPageSize?: number;
599
+ total?: number;
600
+ onPageChange?: (page: number) => void;
601
+ onChange?: (page: number, size: number) => void;
602
+ onShowSizeChange?: (page: number, size: number) => void;
603
+ showSizeChanger?: boolean;
604
+ pageSizeOptions?: (number | string)[];
605
+ showQuickJumper?: boolean;
606
+ hideOnSinglePage?: boolean;
607
+ simple?: boolean;
608
+ disabled?: boolean;
609
+ showTotal?: (total: number, range: [number, number]) => React.ReactNode;
610
+ itemRender?: (page: number, type: "page" | "prev" | "next", original: React.ReactNode) => React.ReactNode;
611
+ position?: ("topLeft" | "topCenter" | "topRight" | "bottomLeft" | "bottomCenter" | "bottomRight" | "none")[];
612
+ placement?: ("topStart" | "topCenter" | "topEnd" | "bottomStart" | "bottomCenter" | "bottomEnd" | "none")[];
613
+ className?: string;
614
+ style?: React.CSSProperties;
615
+ };
616
+ type TableLocale = {
617
+ emptyText?: React.ReactNode;
618
+ filterTitle?: string;
619
+ filterConfirm?: string;
620
+ filterReset?: string;
621
+ filterSearchPlaceholder?: string;
622
+ selectAll?: string;
623
+ selectInvert?: string;
624
+ selectNone?: string;
625
+ selectionAll?: string;
626
+ selectRow?: string | ((key: React.Key) => string);
627
+ selectionActions?: string;
628
+ selectionPlaceholder?: string;
629
+ sortTitle?: string;
630
+ triggerAsc?: string;
631
+ triggerDesc?: string;
632
+ cancelSort?: string;
633
+ expand?: string;
634
+ collapse?: string;
635
+ };
636
+ type RcSemantics = NonNullable<TableProps$1["classNames"]>;
637
+ type RcStyles = NonNullable<TableProps$1["styles"]>;
638
+ type TableClassNames = RcSemantics & {
639
+ root?: string;
640
+ pagination?: string;
641
+ };
642
+ type TableStyles = RcStyles & {
643
+ root?: React.CSSProperties;
644
+ pagination?: React.CSSProperties;
645
+ };
646
+ type TableProps<T> = Omit<TableProps$1<T>, "data" | "columns" | "children" | "onChange" | "scroll" | "classNames" | "styles" | "emptyText"> & {
647
+ data?: T[];
648
+ dataSource?: T[];
649
+ columns?: TableColumn<T>[];
650
+ children?: React.ReactNode;
651
+ column?: Partial<TableColumn<T>>;
345
652
  manual?: boolean;
346
- loading?: boolean;
653
+ loading?: boolean | {
654
+ spinning?: boolean;
655
+ tip?: React.ReactNode;
656
+ delay?: number;
657
+ indicator?: React.ReactNode;
658
+ };
347
659
  onChange?: (state: TableState) => void;
660
+ onTableChange?: (pagination: TablePagination, filters: TableFilters, sorter: TableSortResult<T> | TableSortResult<T>[], extra: {
661
+ currentDataSource: T[];
662
+ action: "paginate" | "sort" | "filter";
663
+ }) => void;
348
664
  sort?: TableState["sort"];
349
665
  filters?: Record<string, string>;
350
666
  selectable?: boolean;
351
667
  selectedKeys?: React.Key[];
352
668
  onSelectionChange?: (keys: React.Key[]) => void;
353
- pagination?: false | {
354
- pageSize?: number;
355
- page?: number;
356
- total?: number;
357
- onPageChange?: (page: number) => void;
358
- };
669
+ rowSelection?: TableRowSelection<T>;
670
+ pagination?: false | TablePagination;
359
671
  empty?: React.ReactNode;
672
+ locale?: TableLocale;
673
+ size?: "small" | "middle" | "medium" | "large";
674
+ bordered?: boolean;
675
+ sortDirections?: Exclude<SortOrder, null>[];
676
+ showSorterTooltip?: TableColumn<T>["showSorterTooltip"];
677
+ getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
678
+ scroll?: NonNullable<TableProps$1<T>["scroll"]> & {
679
+ scrollToFirstRowOnChange?: boolean;
680
+ };
681
+ virtual?: boolean;
682
+ virtualItemHeight?: number;
683
+ classNames?: TableClassNames | ((info: {
684
+ props: TableProps<T>;
685
+ }) => TableClassNames);
686
+ styles?: TableStyles | ((info: {
687
+ props: TableProps<T>;
688
+ }) => TableStyles);
689
+ };
690
+ type TableExpandableConfig<T> = ExpandableConfig<T>;
691
+
692
+ declare function Column<T>(_props: TableColumn<T>): null;
693
+ declare function ColumnGroup<T>(_props: Omit<TableColumn<T>, "children"> & {
694
+ children: React.ReactNode;
695
+ }): null;
696
+ declare const Table: (<T>(props: TableProps<T> & React.RefAttributes<Reference>) => React.ReactElement) & {
697
+ Column: typeof Column;
698
+ ColumnGroup: typeof ColumnGroup;
699
+ Summary: React.FC<React.PropsWithChildren<_rc_component_table_es_Footer_Summary.SummaryProps>> & {
700
+ Row: React.FC<React.PropsWithChildren<_rc_component_table_es_Footer_Row.FooterRowProps>>;
701
+ Cell: React.FC<React.PropsWithChildren<_rc_component_table_es_Footer_Cell.SummaryCellProps>>;
702
+ };
703
+ EXPAND_COLUMN: {};
704
+ SELECTION_COLUMN: Readonly<{
705
+ key: "__mt_selection_column";
706
+ }>;
707
+ SELECTION_ALL: "all";
708
+ SELECTION_INVERT: "invert";
709
+ SELECTION_NONE: "none";
710
+ };
711
+
712
+ type PaginationProps = {
713
+ total: number;
714
+ pageSize?: number;
715
+ page: number;
716
+ onPageChange: (page: number) => void;
360
717
  className?: string;
361
718
  };
362
- declare function Table<T>({ data, columns, rowKey, manual, loading, onChange, sort: controlledSort, filters: controlledFilters, selectable, selectedKeys, onSelectionChange, pagination, empty, className, }: TableProps<T>): React.JSX.Element;
719
+ declare function Pagination({ total, pageSize, page, onPageChange, className, }: PaginationProps): React.JSX.Element;
720
+
363
721
  type TreeItem = {
364
722
  id: string;
365
723
  label: React.ReactNode;
@@ -453,4 +811,71 @@ declare const Layout: typeof LayoutRoot & {
453
811
  Footer: typeof LayoutFooter;
454
812
  };
455
813
 
456
- export { Alert, Avatar, AvatarGroup, Badge, Breadcrumb, Button, ButtonGroup, type ButtonProps, Card, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogProps, ContextMenu, DatePicker, type DatePickerProps, Divider, DocumentCard, type DocumentItem, DocumentList, Drawer, DropdownMenu, type DropdownMenuProps, Dropzone, Empty, FilterBar, FilterChip, Form, FormField, IconButton, Input, Layout, type LayoutContentProps, type LayoutHeaderProps, type LayoutProps, type LayoutSiderProps, List, ListItem, type Locale, type MenuItem, Modal, type ModalProps, MtoneProvider, MtoneScope, MultiSelect, type MultiSelectProps, NavGroup, NavItem, NumberInput, type NumberInputProps, type OpenProps, type Option, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, PropertyItem, PropertyList, RadioGroup, type RadioGroupProps, SearchInput, Segmented, Select, type SelectProps, Sidebar, type SidebarProps, Skeleton, Slider, type SliderProps, Spinner, Status, Switch, type TabItem, Table, type TableColumn, type TableProps, type TableState, Tabs, type TabsProps, Text, Textarea, Toast, type ToastOptions, type ToastPosition, type ToastPromiseOptions, ToastProvider, type ToastProviderProps, type ToastType, type ToastUpdateOptions, type Tokens, type Tone, Tooltip, Tree, type TreeItem, type TreeProps, Upload, type UploadAdapter, type UploadContext, type UploadFile, type UploadProps, cn, useMtone, useToast };
814
+ interface SpotlightAction {
815
+ /** Unique within this Spotlight. */
816
+ id: string;
817
+ label: string;
818
+ description?: string;
819
+ keywords?: string | string[];
820
+ group?: string;
821
+ icon?: React__default.ReactNode;
822
+ rightSection?: React__default.ReactNode;
823
+ disabled?: boolean;
824
+ onSelect?: () => void;
825
+ }
826
+ interface SpotlightProps {
827
+ actions: SpotlightAction[];
828
+ trigger?: React__default.ReactElement;
829
+ open?: boolean;
830
+ defaultOpen?: boolean;
831
+ onOpenChange?: (open: boolean) => void;
832
+ query?: string;
833
+ defaultQuery?: string;
834
+ onQueryChange?: (query: string) => void;
835
+ /** Match a KeyboardEvent.key with Ctrl or Meta, e.g. k. false disables. */
836
+ shortcut?: string | false;
837
+ /** Shortcuts do not intercept text editing by default. */
838
+ enableInInputs?: boolean;
839
+ title?: string;
840
+ placeholder?: string;
841
+ nothingFound?: React__default.ReactNode;
842
+ limit?: number;
843
+ filter?: (query: string, action: SpotlightAction) => boolean;
844
+ onActionSelect?: (action: SpotlightAction) => void;
845
+ closeOnSelect?: boolean;
846
+ resetQueryOnClose?: boolean;
847
+ className?: string;
848
+ }
849
+ declare function Spotlight({ actions, trigger, open, defaultOpen, onOpenChange, query, defaultQuery, onQueryChange, shortcut, enableInInputs, title, placeholder, nothingFound, limit, filter, onActionSelect, closeOnSelect, resetQueryOnClose, className }: SpotlightProps): React__default.JSX.Element;
850
+
851
+ type SplitterSize = number | `${number}%` | `${number}px`;
852
+
853
+ interface SplitterPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onResize"> {
854
+ id?: string;
855
+ label?: string;
856
+ defaultSize?: SplitterSize;
857
+ min?: SplitterSize;
858
+ max?: SplitterSize;
859
+ resizable?: boolean;
860
+ collapsible?: boolean;
861
+ collapsedSize?: SplitterSize;
862
+ groupResizeBehavior?: "preserve-relative-size" | "preserve-pixel-size";
863
+ }
864
+ interface SplitterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onResize"> {
865
+ orientation?: "horizontal" | "vertical";
866
+ sizes?: SplitterSize[];
867
+ disabled?: boolean;
868
+ lazy?: boolean;
869
+ onResize?: (sizes: number[]) => void;
870
+ onResizeStart?: (sizes: number[]) => void;
871
+ onResizeEnd?: (sizes: number[]) => void;
872
+ onCollapse?: (collapsed: boolean[], sizes: number[]) => void;
873
+ onDraggerDoubleClick?: (index: number) => void;
874
+ }
875
+ declare function SplitterPanel(_props: SplitterPanelProps): null;
876
+ declare function SplitterRoot(props: SplitterProps): React.JSX.Element;
877
+ declare const Splitter: typeof SplitterRoot & {
878
+ Panel: typeof SplitterPanel;
879
+ };
880
+
881
+ export { Alert, Avatar, AvatarGroup, Badge, Breadcrumb, Button, ButtonGroup, type ButtonProps, Card, type CardGridProps, type CardMetaProps, type CardMetaSemantic, type CardProps, type CardSemantic, type CardTabItem, type CardTokens, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogProps, ContextMenu, DatePicker, type DatePickerProps, Dialog, type DialogProps, Divider, DocumentCard, type DocumentItem, DocumentList, Drawer, DropdownMenu, type DropdownMenuProps, Dropzone, Empty, FilterBar, FilterChip, Form, FormField, type FormFieldProps, type FormInstance, type FormProps, type FormRule, type FormValidateTrigger, type FormValidationError, type FormValues, IconButton, Input, Layout, type LayoutContentProps, type LayoutHeaderProps, type LayoutProps, type LayoutSiderProps, List, ListItem, type Locale, type MenuItem, Modal, type ModalProps, MtoneProvider, MtoneScope, MultiSelect, type MultiSelectProps, NavGroup, NavItem, NumberInput, type NumberInputProps, type OpenProps, type Option, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, PropertyItem, PropertyList, RadioGroup, type RadioGroupProps, SearchInput, Segmented, Select, type SelectProps, Sidebar, type SidebarProps, Skeleton, Slider, type SliderProps, type SortOrder, Spinner, Splitter, type SplitterPanelProps, type SplitterProps, type SplitterSize, Spotlight, type SpotlightAction, type SpotlightProps, Status, Switch, type TabItem, Table, type TableClassNames, type TableColumn, type TableColumnTitleProps, type TableColumnsType, type TableExpandableConfig, type TableFilterDropdownProps, type TableFilterItem, type TableFilterValue, type TableFilters, type TableLocale, type TablePagination, type TableProps, type TableRef, type TableRowSelection, type TableSelectionType, type TableSortResult, type TableState, type TableStyles, Tabs, type TabsProps, Text, Textarea, Toast, type ToastOptions, type ToastPosition, type ToastPromiseOptions, ToastProvider, type ToastProviderProps, type ToastType, type ToastUpdateOptions, type Tokens, type Tone, Tooltip, Tree, type TreeItem, type TreeProps, Upload, type UploadAdapter, type UploadContext, type UploadFile, type UploadProps, cn, useMtone, useToast };