@talex-touch/tuffex-react 0.0.0-stage → 0.1.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/LICENSE +373 -0
- package/README.md +46 -2
- package/dist/components/TxAlert.d.ts +15 -0
- package/dist/components/TxAvatar.d.ts +19 -0
- package/dist/components/TxBadge.d.ts +10 -0
- package/dist/components/TxButton.d.ts +26 -0
- package/dist/components/TxCard.d.ts +22 -0
- package/dist/components/TxCheckbox.d.ts +15 -0
- package/dist/components/TxCollapse.d.ts +15 -0
- package/dist/components/TxDialog.d.ts +21 -0
- package/dist/components/TxDivider.d.ts +9 -0
- package/dist/components/TxDotIndicator.d.ts +8 -0
- package/dist/components/TxDrawer.d.ts +29 -0
- package/dist/components/TxEmpty.d.ts +10 -0
- package/dist/components/TxInput.d.ts +26 -0
- package/dist/components/TxKbd.d.ts +6 -0
- package/dist/components/TxMarkdownView.d.ts +8 -0
- package/dist/components/TxPopover.d.ts +31 -0
- package/dist/components/TxProgress.d.ts +12 -0
- package/dist/components/TxProgressBar.d.ts +36 -0
- package/dist/components/TxRadio.d.ts +26 -0
- package/dist/components/TxSelect.d.ts +55 -0
- package/dist/components/TxSkeleton.d.ts +12 -0
- package/dist/components/TxSlider.d.ts +22 -0
- package/dist/components/TxSpinner.d.ts +9 -0
- package/dist/components/TxStatCard.d.ts +24 -0
- package/dist/components/TxStatusBadge.d.ts +15 -0
- package/dist/components/TxStatusHint.d.ts +13 -0
- package/dist/components/TxStreamText.d.ts +42 -0
- package/dist/components/TxSwitch.d.ts +15 -0
- package/dist/components/TxTabs.d.ts +27 -0
- package/dist/components/TxTag.d.ts +21 -0
- package/dist/components/TxTextarea.d.ts +16 -0
- package/dist/components/TxTooltip.d.ts +24 -0
- package/dist/components/base-a/feedback.d.ts +136 -0
- package/dist/components/base-a/index.d.ts +11 -0
- package/dist/components/base-a/layout.d.ts +219 -0
- package/dist/components/base-a/manifest.d.ts +7 -0
- package/dist/components/base-a/navigation.d.ts +168 -0
- package/dist/components/base-a/primitives.d.ts +62 -0
- package/dist/components/base-a/states.d.ts +53 -0
- package/dist/components/base-b/data.d.ts +189 -0
- package/dist/components/base-b/forms.d.ts +207 -0
- package/dist/components/base-b/index.d.ts +13 -0
- package/dist/components/base-b/inputs.d.ts +169 -0
- package/dist/components/base-b/manifest.d.ts +7 -0
- package/dist/components/base-b/media.d.ts +178 -0
- package/dist/components/base-b/menus.d.ts +163 -0
- package/dist/components/base-b/selection.d.ts +240 -0
- package/dist/components/stream-pacer.d.ts +87 -0
- package/dist/hooks/useControllableState.d.ts +10 -0
- package/dist/hooks/useDismissableLayer.d.ts +17 -0
- package/dist/hooks/useFloating.d.ts +30 -0
- package/dist/hooks/useReactivity.d.ts +17 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +11095 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest-CPuEzbSP.js +722 -0
- package/dist/manifest-CPuEzbSP.js.map +1 -0
- package/dist/manifest.d.ts +15 -0
- package/dist/manifest.js +6 -0
- package/dist/manifest.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/icons.d.ts +10 -0
- package/package.json +79 -3
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface TxFileUploaderFile {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
size: number;
|
|
6
|
+
type: string;
|
|
7
|
+
file: File;
|
|
8
|
+
}
|
|
9
|
+
export interface TxFileUploaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
10
|
+
value?: TxFileUploaderFile[];
|
|
11
|
+
defaultValue?: TxFileUploaderFile[];
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
accept?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
max?: number;
|
|
16
|
+
showSize?: boolean;
|
|
17
|
+
allowDrop?: boolean;
|
|
18
|
+
buttonText?: string;
|
|
19
|
+
dropText?: string;
|
|
20
|
+
hintText?: string;
|
|
21
|
+
onChange?: (files: TxFileUploaderFile[]) => void;
|
|
22
|
+
onAdd?: (added: TxFileUploaderFile[]) => void;
|
|
23
|
+
onRemove?: (payload: {
|
|
24
|
+
id: string;
|
|
25
|
+
value: TxFileUploaderFile[];
|
|
26
|
+
}) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const TxFileUploader: import('react').ForwardRefExoticComponent<TxFileUploaderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export interface TxImageUploaderFile {
|
|
30
|
+
id: string;
|
|
31
|
+
url: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
file?: File;
|
|
34
|
+
}
|
|
35
|
+
export interface TxImageUploaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
36
|
+
value?: TxImageUploaderFile[];
|
|
37
|
+
defaultValue?: TxImageUploaderFile[];
|
|
38
|
+
multiple?: boolean;
|
|
39
|
+
accept?: string;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
max?: number;
|
|
42
|
+
uploadText?: string;
|
|
43
|
+
removeLabel?: (name?: string) => string;
|
|
44
|
+
onChange?: (files: TxImageUploaderFile[]) => void;
|
|
45
|
+
onRemove?: (payload: {
|
|
46
|
+
id: string;
|
|
47
|
+
value: TxImageUploaderFile[];
|
|
48
|
+
}) => void;
|
|
49
|
+
}
|
|
50
|
+
export declare const TxImageUploader: import('react').ForwardRefExoticComponent<TxImageUploaderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
51
|
+
export type TxImagePreviewAction = 'rotate' | 'copy' | 'share' | 'download';
|
|
52
|
+
export type TxImagePreviewIndicator = 'thumbnails' | 'dots' | 'none';
|
|
53
|
+
export interface TxImagePreviewItem {
|
|
54
|
+
type?: 'image' | 'custom';
|
|
55
|
+
url?: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
alt?: string;
|
|
58
|
+
thumbnail?: string;
|
|
59
|
+
width?: number;
|
|
60
|
+
height?: number;
|
|
61
|
+
}
|
|
62
|
+
export type TxImagePreviewSource = string | TxImagePreviewItem;
|
|
63
|
+
export interface TxImagePreviewActionEvent {
|
|
64
|
+
action: TxImagePreviewAction;
|
|
65
|
+
index: number;
|
|
66
|
+
item: TxImagePreviewItem;
|
|
67
|
+
preventDefault: () => void;
|
|
68
|
+
readonly defaultPrevented: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface TxImagePreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {
|
|
71
|
+
open?: boolean;
|
|
72
|
+
visible?: boolean;
|
|
73
|
+
defaultOpen?: boolean;
|
|
74
|
+
index?: number;
|
|
75
|
+
defaultIndex?: number;
|
|
76
|
+
images?: readonly TxImagePreviewSource[];
|
|
77
|
+
items?: readonly TxImagePreviewSource[];
|
|
78
|
+
maxScale?: number;
|
|
79
|
+
failed?: ReadonlySet<string> | readonly string[];
|
|
80
|
+
actions?: readonly TxImagePreviewAction[];
|
|
81
|
+
indicator?: TxImagePreviewIndicator;
|
|
82
|
+
label?: string;
|
|
83
|
+
closeLabel?: string;
|
|
84
|
+
previousLabel?: string;
|
|
85
|
+
nextLabel?: string;
|
|
86
|
+
zoomInLabel?: string;
|
|
87
|
+
zoomOutLabel?: string;
|
|
88
|
+
resetLabel?: string;
|
|
89
|
+
rotateLabel?: string;
|
|
90
|
+
copyLabel?: string;
|
|
91
|
+
shareLabel?: string;
|
|
92
|
+
downloadLabel?: string;
|
|
93
|
+
failedText?: string;
|
|
94
|
+
counterFormatter?: (current: number, total: number) => string;
|
|
95
|
+
scaleFormatter?: (scale: number) => string;
|
|
96
|
+
renderItem?: (ctx: {
|
|
97
|
+
item: TxImagePreviewItem;
|
|
98
|
+
index: number;
|
|
99
|
+
scale: number;
|
|
100
|
+
turns: number;
|
|
101
|
+
}) => ReactNode;
|
|
102
|
+
onOpenChange?: (open: boolean) => void;
|
|
103
|
+
onIndexChange?: (index: number) => void;
|
|
104
|
+
onClose?: () => void;
|
|
105
|
+
onError?: (url: string, index: number) => void;
|
|
106
|
+
onAction?: (event: TxImagePreviewActionEvent) => void;
|
|
107
|
+
}
|
|
108
|
+
export declare const TxImagePreview: import('react').ForwardRefExoticComponent<TxImagePreviewProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
109
|
+
export interface TxImageGalleryItem {
|
|
110
|
+
id: string;
|
|
111
|
+
url: string;
|
|
112
|
+
name?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface TxImageGalleryProps extends HTMLAttributes<HTMLDivElement> {
|
|
115
|
+
items: TxImageGalleryItem[];
|
|
116
|
+
startIndex?: number;
|
|
117
|
+
previousLabel?: string;
|
|
118
|
+
nextLabel?: string;
|
|
119
|
+
previewTitle?: string;
|
|
120
|
+
closeLabel?: string;
|
|
121
|
+
zoomInLabel?: string;
|
|
122
|
+
zoomOutLabel?: string;
|
|
123
|
+
resetLabel?: string;
|
|
124
|
+
failedText?: string;
|
|
125
|
+
itemLabelFormatter?: (index: number) => string;
|
|
126
|
+
openLabelFormatter?: (label: string) => string;
|
|
127
|
+
previewProps?: Partial<TxImagePreviewProps>;
|
|
128
|
+
onOpen?: (payload: {
|
|
129
|
+
index: number;
|
|
130
|
+
item: TxImageGalleryItem;
|
|
131
|
+
}) => void;
|
|
132
|
+
onClose?: () => void;
|
|
133
|
+
onAction?: (event: TxImagePreviewActionEvent) => void;
|
|
134
|
+
}
|
|
135
|
+
export declare const TxImageGallery: import('react').ForwardRefExoticComponent<TxImageGalleryProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
136
|
+
export type TxIconPickerShape = 'circle' | 'squircle' | 'rounded' | 'square' | 'diamond' | 'pentagon' | 'hexagon' | 'arch' | 'cookie' | 'clover' | 'burst' | 'heart';
|
|
137
|
+
export type TxIconPickerSection = 'emoji' | 'icon' | 'brand' | 'ai' | 'file';
|
|
138
|
+
export type TxIconPickerCatalogSection = Exclude<TxIconPickerSection, 'file'>;
|
|
139
|
+
export interface TxIconPickerEntry {
|
|
140
|
+
id: string;
|
|
141
|
+
glyph: string;
|
|
142
|
+
label: string;
|
|
143
|
+
keywords: string;
|
|
144
|
+
category?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface TxIconPickerLabels {
|
|
147
|
+
emoji: string;
|
|
148
|
+
icon: string;
|
|
149
|
+
brand: string;
|
|
150
|
+
ai: string;
|
|
151
|
+
file: string;
|
|
152
|
+
search: string;
|
|
153
|
+
empty: string;
|
|
154
|
+
clear: string;
|
|
155
|
+
chooseFile: string;
|
|
156
|
+
shape: string;
|
|
157
|
+
}
|
|
158
|
+
export declare const TX_ICON_PICKER_DEFAULT_LABELS: TxIconPickerLabels;
|
|
159
|
+
export interface TxIconPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
160
|
+
value?: string;
|
|
161
|
+
defaultValue?: string;
|
|
162
|
+
shape?: TxIconPickerShape;
|
|
163
|
+
defaultShape?: TxIconPickerShape;
|
|
164
|
+
sections?: TxIconPickerSection[];
|
|
165
|
+
catalog?: Partial<Record<TxIconPickerCatalogSection, TxIconPickerEntry[]>>;
|
|
166
|
+
shapeSelectable?: boolean;
|
|
167
|
+
fileChooser?: () => Promise<string | null>;
|
|
168
|
+
accept?: string;
|
|
169
|
+
disabled?: boolean;
|
|
170
|
+
size?: number;
|
|
171
|
+
placeholder?: string;
|
|
172
|
+
inline?: boolean;
|
|
173
|
+
labels?: Partial<TxIconPickerLabels>;
|
|
174
|
+
onChange?: (value: string) => void;
|
|
175
|
+
onShapeChange?: (shape: TxIconPickerShape) => void;
|
|
176
|
+
onFileError?: (error: unknown) => void;
|
|
177
|
+
}
|
|
178
|
+
export declare const TxIconPicker: import('react').ForwardRefExoticComponent<TxIconPickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { FloatingPlacement } from '../../hooks/useFloating';
|
|
3
|
+
export type TxContextMenuTrigger = 'contextmenu' | 'click' | 'both' | 'manual';
|
|
4
|
+
export interface TxContextMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
x?: number;
|
|
8
|
+
y?: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
minWidth?: number;
|
|
11
|
+
maxWidth?: number;
|
|
12
|
+
maxHeight?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
trigger?: TxContextMenuTrigger;
|
|
15
|
+
preventDefault?: boolean;
|
|
16
|
+
closeOnEsc?: boolean;
|
|
17
|
+
closeOnClickOutside?: boolean;
|
|
18
|
+
closeOnSelect?: boolean;
|
|
19
|
+
/** Menu items rendered inside the floating context menu panel. */
|
|
20
|
+
menu?: ReactNode;
|
|
21
|
+
/** Alias for `menu` when `children` is the trigger target. */
|
|
22
|
+
items?: ReactNode;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const TxContextMenu: import('react').ForwardRefExoticComponent<TxContextMenuProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export interface TxContextMenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onSelect'> {
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
danger?: boolean;
|
|
29
|
+
color?: string;
|
|
30
|
+
shortcut?: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
submenu?: boolean;
|
|
33
|
+
closeOnSelect?: boolean;
|
|
34
|
+
onSelect?: () => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const TxContextMenuItem: import('react').ForwardRefExoticComponent<TxContextMenuItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
export interface TxContextMenuDividerProps extends HTMLAttributes<HTMLDivElement> {
|
|
38
|
+
dashed?: boolean;
|
|
39
|
+
inset?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const TxContextMenuDivider: import('react').ForwardRefExoticComponent<TxContextMenuDividerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export type TxDropdownPlacement = FloatingPlacement;
|
|
43
|
+
export interface TxDropdownMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
44
|
+
open?: boolean;
|
|
45
|
+
defaultOpen?: boolean;
|
|
46
|
+
placement?: TxDropdownPlacement;
|
|
47
|
+
trigger?: 'click' | 'hover';
|
|
48
|
+
offset?: number;
|
|
49
|
+
closeOnSelect?: boolean;
|
|
50
|
+
minWidth?: number;
|
|
51
|
+
maxHeight?: number;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/** Trigger node when `children` holds `<TxDropdownItem>` entries. */
|
|
54
|
+
reference?: ReactNode;
|
|
55
|
+
/** Label for an automatic trigger button when neither `reference` nor `content` is given. */
|
|
56
|
+
label?: ReactNode;
|
|
57
|
+
/** Menu items when `children` is the trigger element. */
|
|
58
|
+
content?: ReactNode;
|
|
59
|
+
onOpenChange?: (open: boolean) => void;
|
|
60
|
+
}
|
|
61
|
+
export declare const TxDropdownMenu: import('react').ForwardRefExoticComponent<TxDropdownMenuProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export interface TxDropdownItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onSelect'> {
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
danger?: boolean;
|
|
65
|
+
arrow?: boolean;
|
|
66
|
+
closeOnSelect?: boolean;
|
|
67
|
+
checked?: boolean;
|
|
68
|
+
checkType?: 'checkbox' | 'radio';
|
|
69
|
+
icon?: ReactNode;
|
|
70
|
+
shortcut?: string;
|
|
71
|
+
onSelect?: () => void;
|
|
72
|
+
}
|
|
73
|
+
export declare const TxDropdownItem: import('react').ForwardRefExoticComponent<TxDropdownItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
74
|
+
export type TxFlatDropdownTrigger = 'hover' | 'click' | 'manual';
|
|
75
|
+
export interface TxFlatDropdownTriggerRenderProps {
|
|
76
|
+
open: boolean;
|
|
77
|
+
toggle: () => void;
|
|
78
|
+
show: () => void;
|
|
79
|
+
hide: () => void;
|
|
80
|
+
}
|
|
81
|
+
export interface TxFlatDropdownContentRenderProps {
|
|
82
|
+
open: boolean;
|
|
83
|
+
close: () => void;
|
|
84
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
85
|
+
}
|
|
86
|
+
export interface TxFlatDropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
87
|
+
open?: boolean;
|
|
88
|
+
defaultOpen?: boolean;
|
|
89
|
+
trigger?: TxFlatDropdownTrigger;
|
|
90
|
+
placement?: FloatingPlacement;
|
|
91
|
+
offset?: number;
|
|
92
|
+
openDelay?: number;
|
|
93
|
+
closeDelay?: number;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
teleport?: boolean;
|
|
96
|
+
matchTriggerWidth?: boolean;
|
|
97
|
+
width?: number | string;
|
|
98
|
+
closeOnClickOutside?: boolean;
|
|
99
|
+
closeOnEsc?: boolean;
|
|
100
|
+
closeOnContentClick?: boolean;
|
|
101
|
+
panelClass?: string;
|
|
102
|
+
reference?: ReactNode | ((props: TxFlatDropdownTriggerRenderProps) => ReactNode);
|
|
103
|
+
content?: ReactNode | ((props: TxFlatDropdownContentRenderProps) => ReactNode);
|
|
104
|
+
onOpenChange?: (open: boolean) => void;
|
|
105
|
+
}
|
|
106
|
+
export declare const TxFlatDropdown: import('react').ForwardRefExoticComponent<TxFlatDropdownProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
107
|
+
export interface TxSelectionPayload {
|
|
108
|
+
text: string;
|
|
109
|
+
rects: Array<{
|
|
110
|
+
left: number;
|
|
111
|
+
top: number;
|
|
112
|
+
right: number;
|
|
113
|
+
bottom: number;
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
}>;
|
|
117
|
+
range?: Range;
|
|
118
|
+
}
|
|
119
|
+
export type TxSelectionActionState = 'idle' | 'thinking' | 'streaming' | 'result';
|
|
120
|
+
export interface TxSelectionActionItem {
|
|
121
|
+
id: string;
|
|
122
|
+
label: string;
|
|
123
|
+
more?: boolean;
|
|
124
|
+
busyLabel?: string;
|
|
125
|
+
}
|
|
126
|
+
export declare const TX_SELECTION_DEFAULT_ACTIONS: TxSelectionActionItem[];
|
|
127
|
+
export interface TxSelectionActionsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
|
|
128
|
+
selection?: TxSelectionPayload | null;
|
|
129
|
+
state?: TxSelectionActionState;
|
|
130
|
+
actions?: TxSelectionActionItem[];
|
|
131
|
+
activeActionId?: string;
|
|
132
|
+
expanded?: boolean;
|
|
133
|
+
defaultExpanded?: boolean;
|
|
134
|
+
prompt?: string;
|
|
135
|
+
defaultPrompt?: string;
|
|
136
|
+
hidePrompt?: boolean;
|
|
137
|
+
placeholder?: string;
|
|
138
|
+
ariaLabel?: string;
|
|
139
|
+
keepLabel?: string;
|
|
140
|
+
discardLabel?: string;
|
|
141
|
+
retryLabel?: string;
|
|
142
|
+
sendLabel?: string;
|
|
143
|
+
expandLabel?: string;
|
|
144
|
+
collapseLabel?: string;
|
|
145
|
+
busyLabel?: string;
|
|
146
|
+
offset?: number;
|
|
147
|
+
inline?: boolean;
|
|
148
|
+
onAction?: (payload: {
|
|
149
|
+
id: string;
|
|
150
|
+
action: TxSelectionActionItem;
|
|
151
|
+
selection: TxSelectionPayload;
|
|
152
|
+
}) => void;
|
|
153
|
+
onSubmit?: (payload: {
|
|
154
|
+
prompt: string;
|
|
155
|
+
selection: TxSelectionPayload;
|
|
156
|
+
}) => void;
|
|
157
|
+
onKeep?: () => void;
|
|
158
|
+
onDiscard?: () => void;
|
|
159
|
+
onRetry?: () => void;
|
|
160
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
161
|
+
onPromptChange?: (prompt: string) => void;
|
|
162
|
+
}
|
|
163
|
+
export declare const TxSelectionActions: import('react').ForwardRefExoticComponent<TxSelectionActionsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { FloatingPlacement } from '../../hooks/useFloating';
|
|
3
|
+
export type TxFlatRadioValue = string | number;
|
|
4
|
+
export type TxFlatRadioSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
export interface TxFlatRadioProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
6
|
+
value?: TxFlatRadioValue | TxFlatRadioValue[];
|
|
7
|
+
defaultValue?: TxFlatRadioValue | TxFlatRadioValue[];
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
size?: TxFlatRadioSize;
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
onChange?: (value: TxFlatRadioValue | TxFlatRadioValue[]) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const TxFlatRadio: import('react').ForwardRefExoticComponent<TxFlatRadioProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export interface TxFlatRadioItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'type'> {
|
|
16
|
+
value: TxFlatRadioValue;
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
icon?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const TxFlatRadioItem: import('react').ForwardRefExoticComponent<TxFlatRadioItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export type TxFlatSelectValue = string | number;
|
|
23
|
+
export interface TxFlatSelectOption {
|
|
24
|
+
value: TxFlatSelectValue;
|
|
25
|
+
label: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TxFlatSelectItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
value: TxFlatSelectValue;
|
|
30
|
+
label?: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const TxFlatSelectItem: import('react').ForwardRefExoticComponent<TxFlatSelectItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export interface TxFlatSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
35
|
+
value?: TxFlatSelectValue;
|
|
36
|
+
defaultValue?: TxFlatSelectValue;
|
|
37
|
+
options?: TxFlatSelectOption[];
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
ariaLabelledby?: string;
|
|
42
|
+
open?: boolean;
|
|
43
|
+
defaultOpen?: boolean;
|
|
44
|
+
onChange?: (value: TxFlatSelectValue) => void;
|
|
45
|
+
onOpenChange?: (open: boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
export declare const TxFlatSelect: import('react').ForwardRefExoticComponent<TxFlatSelectProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
48
|
+
export interface TxSearchSelectOption {
|
|
49
|
+
value: string | number;
|
|
50
|
+
label: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface TxSearchSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'onSelect'> {
|
|
54
|
+
value?: string | number;
|
|
55
|
+
defaultValue?: string | number;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
clearable?: boolean;
|
|
59
|
+
options?: TxSearchSelectOption[];
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
remote?: boolean;
|
|
62
|
+
searchDebounce?: number;
|
|
63
|
+
dropdownMaxHeight?: number;
|
|
64
|
+
dropdownOffset?: number;
|
|
65
|
+
emptyText?: string;
|
|
66
|
+
onChange?: (value: string | number) => void;
|
|
67
|
+
onSearch?: (query: string) => void;
|
|
68
|
+
onSelect?: (option: TxSearchSelectOption) => void;
|
|
69
|
+
onOpen?: () => void;
|
|
70
|
+
onClose?: () => void;
|
|
71
|
+
}
|
|
72
|
+
export declare const TxSearchSelect: import('react').ForwardRefExoticComponent<TxSearchSelectProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
73
|
+
export type TxCascaderKey = string | number;
|
|
74
|
+
export type TxCascaderPath = TxCascaderKey[];
|
|
75
|
+
export type TxCascaderValue = TxCascaderPath | TxCascaderPath[] | undefined;
|
|
76
|
+
export interface TxCascaderNode {
|
|
77
|
+
value: TxCascaderKey;
|
|
78
|
+
label: string;
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
leaf?: boolean;
|
|
81
|
+
children?: TxCascaderNode[];
|
|
82
|
+
}
|
|
83
|
+
export interface TxCascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
84
|
+
value?: TxCascaderValue;
|
|
85
|
+
defaultValue?: TxCascaderValue;
|
|
86
|
+
options?: TxCascaderNode[];
|
|
87
|
+
multiple?: boolean;
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
searchable?: boolean;
|
|
91
|
+
clearable?: boolean;
|
|
92
|
+
placement?: FloatingPlacement;
|
|
93
|
+
dropdownOffset?: number;
|
|
94
|
+
dropdownMaxHeight?: number;
|
|
95
|
+
expandTrigger?: 'click' | 'hover' | 'both';
|
|
96
|
+
load?: (node: TxCascaderNode | null, level: number) => Promise<TxCascaderNode[]>;
|
|
97
|
+
onChange?: (value: TxCascaderValue) => void;
|
|
98
|
+
onOpen?: () => void;
|
|
99
|
+
onClose?: () => void;
|
|
100
|
+
onLoadError?: (payload: {
|
|
101
|
+
path: TxCascaderPath;
|
|
102
|
+
error: unknown;
|
|
103
|
+
}) => void;
|
|
104
|
+
}
|
|
105
|
+
export declare const TxCascader: import('react').ForwardRefExoticComponent<TxCascaderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
106
|
+
export type TxTreeKey = string | number;
|
|
107
|
+
export interface TxTreeNode {
|
|
108
|
+
key: TxTreeKey;
|
|
109
|
+
label: string;
|
|
110
|
+
children?: TxTreeNode[];
|
|
111
|
+
leaf?: boolean;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
icon?: string;
|
|
114
|
+
}
|
|
115
|
+
export type TxTreeValue = TxTreeKey | TxTreeKey[];
|
|
116
|
+
export interface TxTreeNodeRenderContext {
|
|
117
|
+
node: TxTreeNode;
|
|
118
|
+
level: number;
|
|
119
|
+
expanded: boolean;
|
|
120
|
+
selected: boolean;
|
|
121
|
+
hasChildren: boolean;
|
|
122
|
+
toggle: () => void;
|
|
123
|
+
select: () => void;
|
|
124
|
+
}
|
|
125
|
+
export interface TxTreeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'onSelect' | 'onToggle'> {
|
|
126
|
+
nodes?: TxTreeNode[];
|
|
127
|
+
value?: TxTreeValue;
|
|
128
|
+
defaultValue?: TxTreeValue;
|
|
129
|
+
defaultSelectedKeys?: TxTreeKey[];
|
|
130
|
+
expandedKeys?: TxTreeKey[];
|
|
131
|
+
defaultExpandedKeys?: TxTreeKey[];
|
|
132
|
+
multiple?: boolean;
|
|
133
|
+
selectable?: boolean;
|
|
134
|
+
checkable?: boolean;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
indent?: number;
|
|
137
|
+
filterText?: string;
|
|
138
|
+
filterMethod?: (node: TxTreeNode, query: string) => boolean;
|
|
139
|
+
emptyText?: string;
|
|
140
|
+
expandLabel?: string;
|
|
141
|
+
collapseLabel?: string;
|
|
142
|
+
selectLabel?: string;
|
|
143
|
+
renderNode?: (context: TxTreeNodeRenderContext) => ReactNode;
|
|
144
|
+
onChange?: (value: TxTreeValue) => void;
|
|
145
|
+
onSelect?: (payload: {
|
|
146
|
+
key: TxTreeKey;
|
|
147
|
+
node: TxTreeNode;
|
|
148
|
+
}) => void;
|
|
149
|
+
onToggle?: (payload: {
|
|
150
|
+
key: TxTreeKey;
|
|
151
|
+
expanded: boolean;
|
|
152
|
+
}) => void;
|
|
153
|
+
onExpandedKeysChange?: (keys: TxTreeKey[]) => void;
|
|
154
|
+
}
|
|
155
|
+
export declare const TxTree: import('react').ForwardRefExoticComponent<TxTreeProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
156
|
+
export type TxTreeSelectKey = TxTreeKey;
|
|
157
|
+
export type TxTreeSelectNode = TxTreeNode;
|
|
158
|
+
export type TxTreeSelectValue = TxTreeSelectKey | TxTreeSelectKey[] | undefined;
|
|
159
|
+
export interface TxTreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
160
|
+
value?: TxTreeSelectValue;
|
|
161
|
+
defaultValue?: TxTreeSelectValue;
|
|
162
|
+
nodes?: TxTreeSelectNode[];
|
|
163
|
+
multiple?: boolean;
|
|
164
|
+
disabled?: boolean;
|
|
165
|
+
placeholder?: string;
|
|
166
|
+
searchable?: boolean;
|
|
167
|
+
clearable?: boolean;
|
|
168
|
+
placement?: FloatingPlacement;
|
|
169
|
+
dropdownOffset?: number;
|
|
170
|
+
dropdownWidth?: number;
|
|
171
|
+
dropdownMaxWidth?: number;
|
|
172
|
+
dropdownMaxHeight?: number;
|
|
173
|
+
defaultExpandedKeys?: TxTreeSelectKey[];
|
|
174
|
+
onChange?: (value: TxTreeSelectValue) => void;
|
|
175
|
+
onOpen?: () => void;
|
|
176
|
+
onClose?: () => void;
|
|
177
|
+
}
|
|
178
|
+
export declare const TxTreeSelect: import('react').ForwardRefExoticComponent<TxTreeSelectProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
179
|
+
export type TxDatePickerVariant = 'picker' | 'field' | 'adaptive';
|
|
180
|
+
export type TxDateRangeValue = [string, string];
|
|
181
|
+
export type TxDatePickerValue = string | TxDateRangeValue;
|
|
182
|
+
export interface TxDatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
183
|
+
value?: TxDatePickerValue;
|
|
184
|
+
defaultValue?: TxDatePickerValue;
|
|
185
|
+
open?: boolean;
|
|
186
|
+
visible?: boolean;
|
|
187
|
+
defaultOpen?: boolean;
|
|
188
|
+
popup?: boolean;
|
|
189
|
+
variant?: TxDatePickerVariant;
|
|
190
|
+
title?: string;
|
|
191
|
+
placeholder?: string;
|
|
192
|
+
min?: string;
|
|
193
|
+
max?: string;
|
|
194
|
+
disabled?: boolean;
|
|
195
|
+
showToolbar?: boolean;
|
|
196
|
+
confirmText?: string;
|
|
197
|
+
cancelText?: string;
|
|
198
|
+
closeOnClickMask?: boolean;
|
|
199
|
+
weekStartsOn?: 0 | 1;
|
|
200
|
+
range?: boolean;
|
|
201
|
+
rangeSeparator?: string;
|
|
202
|
+
onChange?: (value: TxDatePickerValue) => void;
|
|
203
|
+
onOpenChange?: (open: boolean) => void;
|
|
204
|
+
onConfirm?: (value: TxDatePickerValue) => void;
|
|
205
|
+
onCancel?: () => void;
|
|
206
|
+
}
|
|
207
|
+
export declare const TxDatePicker: import('react').ForwardRefExoticComponent<TxDatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
208
|
+
export type TxPickerPrimitive = string | number;
|
|
209
|
+
export interface TxPickerOption {
|
|
210
|
+
value: TxPickerPrimitive;
|
|
211
|
+
label: string;
|
|
212
|
+
disabled?: boolean;
|
|
213
|
+
}
|
|
214
|
+
export interface TxPickerColumn {
|
|
215
|
+
key?: string;
|
|
216
|
+
options: TxPickerOption[];
|
|
217
|
+
}
|
|
218
|
+
export type TxPickerValue = TxPickerPrimitive[];
|
|
219
|
+
export interface TxPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
220
|
+
value?: TxPickerValue;
|
|
221
|
+
defaultValue?: TxPickerValue;
|
|
222
|
+
columns?: TxPickerColumn[];
|
|
223
|
+
open?: boolean;
|
|
224
|
+
visible?: boolean;
|
|
225
|
+
defaultOpen?: boolean;
|
|
226
|
+
popup?: boolean;
|
|
227
|
+
title?: string;
|
|
228
|
+
showToolbar?: boolean;
|
|
229
|
+
confirmText?: string;
|
|
230
|
+
cancelText?: string;
|
|
231
|
+
disabled?: boolean;
|
|
232
|
+
itemHeight?: number;
|
|
233
|
+
visibleItemCount?: number;
|
|
234
|
+
closeOnClickMask?: boolean;
|
|
235
|
+
onChange?: (value: TxPickerValue) => void;
|
|
236
|
+
onOpenChange?: (open: boolean) => void;
|
|
237
|
+
onConfirm?: (value: TxPickerValue) => void;
|
|
238
|
+
onCancel?: () => void;
|
|
239
|
+
}
|
|
240
|
+
export declare const TxPicker: import('react').ForwardRefExoticComponent<TxPickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ShallowRef } from '@vue/reactivity';
|
|
2
|
+
export type TxStreamRevealPreset = 'aurora' | 'hue' | 'blur' | 'languid' | 'none';
|
|
3
|
+
export type TxStreamState = 'idle' | 'streaming' | 'paused' | 'draining' | 'done';
|
|
4
|
+
export type TxStreamMark = 'strong' | 'em' | 'del' | 'code';
|
|
5
|
+
export interface TxStreamSourceItem {
|
|
6
|
+
id: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export type TxStreamInline = {
|
|
12
|
+
type: 'text';
|
|
13
|
+
text: string;
|
|
14
|
+
marks?: TxStreamMark[];
|
|
15
|
+
href?: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'citation';
|
|
18
|
+
source: TxStreamSourceItem;
|
|
19
|
+
label?: string;
|
|
20
|
+
index?: number;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'custom';
|
|
23
|
+
name: string;
|
|
24
|
+
props?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
export interface StreamRun {
|
|
27
|
+
marks: TxStreamMark[];
|
|
28
|
+
href?: string;
|
|
29
|
+
}
|
|
30
|
+
export type StreamAtom = Exclude<TxStreamInline, {
|
|
31
|
+
type: 'text';
|
|
32
|
+
}>;
|
|
33
|
+
export interface StreamUnit {
|
|
34
|
+
kind: 'word' | 'atom';
|
|
35
|
+
text: string;
|
|
36
|
+
ws: string;
|
|
37
|
+
run: number;
|
|
38
|
+
atom?: StreamAtom;
|
|
39
|
+
}
|
|
40
|
+
export interface StreamModel {
|
|
41
|
+
runs: StreamRun[];
|
|
42
|
+
units: StreamUnit[];
|
|
43
|
+
}
|
|
44
|
+
export declare const STREAM_REVEAL_DURATION_MS: Readonly<Record<TxStreamRevealPreset, number>>;
|
|
45
|
+
export declare const STREAM_PACING_DEFAULTS: {
|
|
46
|
+
readonly wordMs: 24;
|
|
47
|
+
readonly maxLagMs: 600;
|
|
48
|
+
readonly drainMs: 320;
|
|
49
|
+
readonly pauseMs: 400;
|
|
50
|
+
};
|
|
51
|
+
export declare function streamRevealDuration(preset: TxStreamRevealPreset | undefined): number;
|
|
52
|
+
export declare function segmentWords(text: string, locale?: string): Array<{
|
|
53
|
+
text: string;
|
|
54
|
+
ws: string;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function safeHref(href: string | undefined): string | undefined;
|
|
57
|
+
export declare function buildStreamModel(content: string | TxStreamInline[] | undefined, locale?: string): StreamModel;
|
|
58
|
+
export interface ReactiveStreamPacerOptions {
|
|
59
|
+
total: () => number;
|
|
60
|
+
streaming: () => boolean;
|
|
61
|
+
wordMs?: () => number | undefined;
|
|
62
|
+
maxLagMs?: () => number | undefined;
|
|
63
|
+
drainMs?: () => number | undefined;
|
|
64
|
+
pauseMs?: () => number | undefined;
|
|
65
|
+
settleMs?: () => number;
|
|
66
|
+
appear?: boolean;
|
|
67
|
+
paced?: () => boolean;
|
|
68
|
+
onState?: (state: TxStreamState, previous: TxStreamState) => void;
|
|
69
|
+
now?: () => number;
|
|
70
|
+
requestFrame?: ((cb: (time: number) => void) => number) | null;
|
|
71
|
+
cancelFrame?: (id: number) => void;
|
|
72
|
+
}
|
|
73
|
+
export interface ReactiveStreamPacer {
|
|
74
|
+
revealed: ShallowRef<number>;
|
|
75
|
+
settled: ShallowRef<number>;
|
|
76
|
+
state: ShallowRef<TxStreamState>;
|
|
77
|
+
sync: () => void;
|
|
78
|
+
replay: () => void;
|
|
79
|
+
skip: () => void;
|
|
80
|
+
rewind: (index: number) => void;
|
|
81
|
+
stop: () => void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Framework-agnostic reactive stream pacer backed by `@vue/reactivity` `shallowRef`.
|
|
85
|
+
* Bridged into React via `useSignal` (`useSyncExternalStore` + `effect`).
|
|
86
|
+
*/
|
|
87
|
+
export declare function createReactiveStreamPacer(options: ReactiveStreamPacerOptions): ReactiveStreamPacer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UseControllableStateOptions<T> {
|
|
2
|
+
value?: T;
|
|
3
|
+
defaultValue: T;
|
|
4
|
+
onChange?: (value: T) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Supports both controlled (`value` provided) and uncontrolled (`defaultValue`)
|
|
8
|
+
* React component patterns with a single setter.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useControllableState<T>({ value, defaultValue, onChange, }: UseControllableStateOptions<T>): [T, (next: T | ((prev: T) => T)) => void];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function allocateZIndex(minSeed?: number): number;
|
|
2
|
+
export declare function trapFocusInContainer(event: KeyboardEvent, container: HTMLElement | null): void;
|
|
3
|
+
export interface DismissableLayerOptions {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onDismiss: (reason: 'escape' | 'outside') => void;
|
|
6
|
+
closeOnEscape?: boolean;
|
|
7
|
+
closeOnOutsideClick?: boolean;
|
|
8
|
+
containerRefs?: Array<React.RefObject<HTMLElement | null>>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Handles Escape key dismissal and outside pointerdown dismissal for overlays.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDismissableLayer({ open, onDismiss, closeOnEscape, closeOnOutsideClick, containerRefs, }: DismissableLayerOptions): void;
|
|
14
|
+
/**
|
|
15
|
+
* Saves focus when a modal layer opens and restores it when it closes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useFocusReturn(open: boolean, containerRef: React.RefObject<HTMLElement | null>): void;
|