@colletdev/react 0.1.3
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/README.md +67 -0
- package/dist/generated/accordion.d.ts +17 -0
- package/dist/generated/accordion.js +56 -0
- package/dist/generated/activity-group.d.ts +14 -0
- package/dist/generated/activity-group.js +26 -0
- package/dist/generated/alert.d.ts +22 -0
- package/dist/generated/alert.js +55 -0
- package/dist/generated/autocomplete.d.ts +46 -0
- package/dist/generated/autocomplete.js +144 -0
- package/dist/generated/avatar.d.ts +13 -0
- package/dist/generated/avatar.js +24 -0
- package/dist/generated/backdrop.d.ts +9 -0
- package/dist/generated/backdrop.js +16 -0
- package/dist/generated/badge.d.ts +17 -0
- package/dist/generated/badge.js +40 -0
- package/dist/generated/breadcrumb.d.ts +14 -0
- package/dist/generated/breadcrumb.js +41 -0
- package/dist/generated/button.d.ts +21 -0
- package/dist/generated/button.js +46 -0
- package/dist/generated/card.d.ts +20 -0
- package/dist/generated/card.js +54 -0
- package/dist/generated/carousel.d.ts +28 -0
- package/dist/generated/carousel.js +62 -0
- package/dist/generated/chat-input.d.ts +27 -0
- package/dist/generated/chat-input.js +92 -0
- package/dist/generated/checkbox.d.ts +28 -0
- package/dist/generated/checkbox.js +93 -0
- package/dist/generated/code-block.d.ts +17 -0
- package/dist/generated/code-block.js +32 -0
- package/dist/generated/collapsible.d.ts +26 -0
- package/dist/generated/collapsible.js +36 -0
- package/dist/generated/date-picker.d.ts +39 -0
- package/dist/generated/date-picker.js +124 -0
- package/dist/generated/dialog.d.ts +28 -0
- package/dist/generated/dialog.js +59 -0
- package/dist/generated/drawer.d.ts +28 -0
- package/dist/generated/drawer.js +59 -0
- package/dist/generated/fab.d.ts +19 -0
- package/dist/generated/fab.js +42 -0
- package/dist/generated/file-upload.d.ts +22 -0
- package/dist/generated/file-upload.js +59 -0
- package/dist/generated/index.d.ts +56 -0
- package/dist/generated/index.js +58 -0
- package/dist/generated/listbox.d.ts +19 -0
- package/dist/generated/listbox.js +93 -0
- package/dist/generated/menu.d.ts +26 -0
- package/dist/generated/menu.js +86 -0
- package/dist/generated/message-bubble.d.ts +18 -0
- package/dist/generated/message-bubble.js +41 -0
- package/dist/generated/message-group.d.ts +14 -0
- package/dist/generated/message-group.js +42 -0
- package/dist/generated/message-part.d.ts +20 -0
- package/dist/generated/message-part.js +36 -0
- package/dist/generated/pagination.d.ts +17 -0
- package/dist/generated/pagination.js +59 -0
- package/dist/generated/popover.d.ts +27 -0
- package/dist/generated/popover.js +65 -0
- package/dist/generated/profile-menu.d.ts +23 -0
- package/dist/generated/profile-menu.js +56 -0
- package/dist/generated/progress.d.ts +14 -0
- package/dist/generated/progress.js +33 -0
- package/dist/generated/radio-group.d.ts +24 -0
- package/dist/generated/radio-group.js +110 -0
- package/dist/generated/scrollbar.d.ts +14 -0
- package/dist/generated/scrollbar.js +33 -0
- package/dist/generated/search-bar.d.ts +33 -0
- package/dist/generated/search-bar.js +118 -0
- package/dist/generated/select.d.ts +36 -0
- package/dist/generated/select.js +136 -0
- package/dist/generated/serialize.d.ts +2 -0
- package/dist/generated/serialize.js +13 -0
- package/dist/generated/sidebar.d.ts +25 -0
- package/dist/generated/sidebar.js +55 -0
- package/dist/generated/skeleton.d.ts +12 -0
- package/dist/generated/skeleton.js +31 -0
- package/dist/generated/slider.d.ts +34 -0
- package/dist/generated/slider.js +140 -0
- package/dist/generated/speed-dial.d.ts +29 -0
- package/dist/generated/speed-dial.js +63 -0
- package/dist/generated/spinner.d.ts +10 -0
- package/dist/generated/spinner.js +18 -0
- package/dist/generated/split-button.d.ts +27 -0
- package/dist/generated/split-button.js +63 -0
- package/dist/generated/stepper.d.ts +17 -0
- package/dist/generated/stepper.js +56 -0
- package/dist/generated/switch.d.ts +29 -0
- package/dist/generated/switch.js +92 -0
- package/dist/generated/table.d.ts +31 -0
- package/dist/generated/table.js +187 -0
- package/dist/generated/tabs.d.ts +20 -0
- package/dist/generated/tabs.js +54 -0
- package/dist/generated/text-input.d.ts +48 -0
- package/dist/generated/text-input.js +165 -0
- package/dist/generated/text.d.ts +21 -0
- package/dist/generated/text.js +74 -0
- package/dist/generated/thinking.d.ts +12 -0
- package/dist/generated/thinking.js +22 -0
- package/dist/generated/toast.d.ts +24 -0
- package/dist/generated/toast.js +60 -0
- package/dist/generated/toggle-group.d.ts +21 -0
- package/dist/generated/toggle-group.js +70 -0
- package/dist/generated/tooltip.d.ts +18 -0
- package/dist/generated/tooltip.js +42 -0
- package/dist/generated/types.d.ts +300 -0
- package/dist/generated/types.js +6 -0
- package/dist/generated/use-markdown-stream.d.ts +45 -0
- package/dist/generated/use-markdown-stream.js +48 -0
- package/dist/generated/use-markdown.d.ts +20 -0
- package/dist/generated/use-markdown.js +49 -0
- package/package.json +38 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Listbox = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onFocusRef = useRef(props.onFocus);
|
|
7
|
+
onFocusRef.current = props.onFocus;
|
|
8
|
+
const onBlurRef = useRef(props.onBlur);
|
|
9
|
+
onBlurRef.current = props.onBlur;
|
|
10
|
+
const onKeydownRef = useRef(props.onKeydown);
|
|
11
|
+
onKeydownRef.current = props.onKeydown;
|
|
12
|
+
const onKeyupRef = useRef(props.onKeyup);
|
|
13
|
+
onKeyupRef.current = props.onKeyup;
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const el = ref.current;
|
|
16
|
+
if (!el)
|
|
17
|
+
return;
|
|
18
|
+
const handler = (e) => onFocusRef.current?.(e);
|
|
19
|
+
el.addEventListener('cx-focus', handler);
|
|
20
|
+
return () => el.removeEventListener('cx-focus', handler);
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const el = ref.current;
|
|
24
|
+
if (!el)
|
|
25
|
+
return;
|
|
26
|
+
const handler = (e) => onBlurRef.current?.(e);
|
|
27
|
+
el.addEventListener('cx-blur', handler);
|
|
28
|
+
return () => el.removeEventListener('cx-blur', handler);
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const el = ref.current;
|
|
32
|
+
if (!el)
|
|
33
|
+
return;
|
|
34
|
+
const handler = (e) => onKeydownRef.current?.(e);
|
|
35
|
+
el.addEventListener('cx-keydown', handler);
|
|
36
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
37
|
+
}, []);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const el = ref.current;
|
|
40
|
+
if (!el)
|
|
41
|
+
return;
|
|
42
|
+
const handler = (e) => onKeyupRef.current?.(e);
|
|
43
|
+
el.addEventListener('cx-keyup', handler);
|
|
44
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
45
|
+
}, []);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const el = ref.current;
|
|
48
|
+
if (!el)
|
|
49
|
+
return;
|
|
50
|
+
if (props.selected != null) {
|
|
51
|
+
el.setAttribute('selected', typeof props.selected === 'object' ? JSON.stringify(props.selected) : String(props.selected));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
el.removeAttribute('selected');
|
|
55
|
+
}
|
|
56
|
+
}, [props.selected]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const el = ref.current;
|
|
59
|
+
if (!el)
|
|
60
|
+
return;
|
|
61
|
+
if (props.items != null) {
|
|
62
|
+
el.setAttribute('items', typeof props.items === 'object' ? JSON.stringify(props.items) : String(props.items));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
el.removeAttribute('items');
|
|
66
|
+
}
|
|
67
|
+
}, [props.items]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const el = ref.current;
|
|
70
|
+
if (!el)
|
|
71
|
+
return;
|
|
72
|
+
if (props.groups != null) {
|
|
73
|
+
el.setAttribute('groups', typeof props.groups === 'object' ? JSON.stringify(props.groups) : String(props.groups));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
el.removeAttribute('groups');
|
|
77
|
+
}
|
|
78
|
+
}, [props.groups]);
|
|
79
|
+
// Build attribute object
|
|
80
|
+
const attrs = {};
|
|
81
|
+
if (props.id != null)
|
|
82
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
83
|
+
if (props.label != null)
|
|
84
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
85
|
+
if (props.shape != null)
|
|
86
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
87
|
+
if (props.size != null)
|
|
88
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
89
|
+
if (props.selectionMode != null)
|
|
90
|
+
attrs['selection-mode'] = typeof props.selectionMode === 'object' ? JSON.stringify(props.selectionMode) : String(props.selectionMode);
|
|
91
|
+
return (_jsx("cx-listbox", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
92
|
+
});
|
|
93
|
+
Listbox.displayName = 'Listbox';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { KeyboardDetail, MenuActionDetail, MenuChangeDetail, MenuEntry } from './types.js';
|
|
3
|
+
export interface MenuRef extends HTMLElement {
|
|
4
|
+
/** Opens the menu dropdown. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Closes the menu dropdown. */
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface MenuProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
triggerLabel: string;
|
|
12
|
+
entries?: MenuEntry[] | string;
|
|
13
|
+
variant?: 'filled' | 'outline' | 'ghost';
|
|
14
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
15
|
+
width?: 'auto' | 'sm' | 'md' | 'lg';
|
|
16
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
17
|
+
icon?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onAction?: (event: CustomEvent<MenuActionDetail>) => void;
|
|
20
|
+
onChange?: (event: CustomEvent<MenuChangeDetail>) => void;
|
|
21
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
22
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<MenuRef>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Menu = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onActionRef = useRef(props.onAction);
|
|
7
|
+
onActionRef.current = props.onAction;
|
|
8
|
+
const onChangeRef = useRef(props.onChange);
|
|
9
|
+
onChangeRef.current = props.onChange;
|
|
10
|
+
const onKeydownRef = useRef(props.onKeydown);
|
|
11
|
+
onKeydownRef.current = props.onKeydown;
|
|
12
|
+
const onKeyupRef = useRef(props.onKeyup);
|
|
13
|
+
onKeyupRef.current = props.onKeyup;
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const el = ref.current;
|
|
16
|
+
if (!el)
|
|
17
|
+
return;
|
|
18
|
+
const handler = (e) => onActionRef.current?.(e);
|
|
19
|
+
el.addEventListener('cx-action', handler);
|
|
20
|
+
return () => el.removeEventListener('cx-action', handler);
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const el = ref.current;
|
|
24
|
+
if (!el)
|
|
25
|
+
return;
|
|
26
|
+
const handler = (e) => onChangeRef.current?.(e);
|
|
27
|
+
el.addEventListener('cx-change', handler);
|
|
28
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const el = ref.current;
|
|
32
|
+
if (!el)
|
|
33
|
+
return;
|
|
34
|
+
const handler = (e) => onKeydownRef.current?.(e);
|
|
35
|
+
el.addEventListener('cx-keydown', handler);
|
|
36
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
37
|
+
}, []);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const el = ref.current;
|
|
40
|
+
if (!el)
|
|
41
|
+
return;
|
|
42
|
+
const handler = (e) => onKeyupRef.current?.(e);
|
|
43
|
+
el.addEventListener('cx-keyup', handler);
|
|
44
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
45
|
+
}, []);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const el = ref.current;
|
|
48
|
+
if (!el)
|
|
49
|
+
return;
|
|
50
|
+
if (props.width != null) {
|
|
51
|
+
el.setAttribute('width', String(props.width));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
el.removeAttribute('width');
|
|
55
|
+
}
|
|
56
|
+
}, [props.width]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const el = ref.current;
|
|
59
|
+
if (!el)
|
|
60
|
+
return;
|
|
61
|
+
if (props.entries != null) {
|
|
62
|
+
el.setAttribute('entries', typeof props.entries === 'object' ? JSON.stringify(props.entries) : String(props.entries));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
el.removeAttribute('entries');
|
|
66
|
+
}
|
|
67
|
+
}, [props.entries]);
|
|
68
|
+
// Build attribute object
|
|
69
|
+
const attrs = {};
|
|
70
|
+
if (props.id != null)
|
|
71
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
72
|
+
if (props.triggerLabel != null)
|
|
73
|
+
attrs['trigger-label'] = typeof props.triggerLabel === 'object' ? JSON.stringify(props.triggerLabel) : String(props.triggerLabel);
|
|
74
|
+
if (props.variant != null)
|
|
75
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
76
|
+
if (props.shape != null)
|
|
77
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
78
|
+
if (props.size != null)
|
|
79
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
80
|
+
if (props.icon != null)
|
|
81
|
+
attrs['icon'] = typeof props.icon === 'object' ? JSON.stringify(props.icon) : String(props.icon);
|
|
82
|
+
if (props.disabled)
|
|
83
|
+
attrs['disabled'] = '';
|
|
84
|
+
return (_jsx("cx-menu", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
85
|
+
});
|
|
86
|
+
Menu.displayName = 'Menu';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface MessageBubbleProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
role?: 'user' | 'assistant';
|
|
5
|
+
variant?: 'filled' | 'ghost';
|
|
6
|
+
shape?: 'sharp' | 'rounded';
|
|
7
|
+
alignment?: 'auto' | 'start' | 'end';
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
htmlContent?: string;
|
|
10
|
+
senderName?: string;
|
|
11
|
+
timestamp?: string;
|
|
12
|
+
border?: string;
|
|
13
|
+
animated?: boolean;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
export declare const MessageBubble: React.ForwardRefExoticComponent<MessageBubbleProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const MessageBubble = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const el = ref.current;
|
|
8
|
+
if (!el)
|
|
9
|
+
return;
|
|
10
|
+
if (props.role != null) {
|
|
11
|
+
el.setAttribute('role', String(props.role));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
el.removeAttribute('role');
|
|
15
|
+
}
|
|
16
|
+
}, [props.role]);
|
|
17
|
+
// Build attribute object
|
|
18
|
+
const attrs = {};
|
|
19
|
+
if (props.id != null)
|
|
20
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
21
|
+
if (props.variant != null)
|
|
22
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
23
|
+
if (props.shape != null)
|
|
24
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
25
|
+
if (props.alignment != null)
|
|
26
|
+
attrs['alignment'] = typeof props.alignment === 'object' ? JSON.stringify(props.alignment) : String(props.alignment);
|
|
27
|
+
if (props.size != null)
|
|
28
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
29
|
+
if (props.htmlContent != null)
|
|
30
|
+
attrs['html-content'] = typeof props.htmlContent === 'object' ? JSON.stringify(props.htmlContent) : String(props.htmlContent);
|
|
31
|
+
if (props.senderName != null)
|
|
32
|
+
attrs['sender-name'] = typeof props.senderName === 'object' ? JSON.stringify(props.senderName) : String(props.senderName);
|
|
33
|
+
if (props.timestamp != null)
|
|
34
|
+
attrs['timestamp'] = typeof props.timestamp === 'object' ? JSON.stringify(props.timestamp) : String(props.timestamp);
|
|
35
|
+
if (props.border != null)
|
|
36
|
+
attrs['border'] = typeof props.border === 'object' ? JSON.stringify(props.border) : String(props.border);
|
|
37
|
+
if (props.animated)
|
|
38
|
+
attrs['animated'] = '';
|
|
39
|
+
return (_jsx("cx-message-bubble", { ref: ref, ...attrs, className: props.className, style: props.style, children: props.children }));
|
|
40
|
+
});
|
|
41
|
+
MessageBubble.displayName = 'MessageBubble';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { MessageGroupPart } from './types.js';
|
|
3
|
+
export interface MessageGroupProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
role?: 'user' | 'assistant';
|
|
6
|
+
alignment?: 'auto' | 'start' | 'end';
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
|
+
senderName?: string;
|
|
9
|
+
animated?: boolean;
|
|
10
|
+
parts?: MessageGroupPart[] | string;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export declare const MessageGroup: React.ForwardRefExoticComponent<MessageGroupProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const MessageGroup = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const el = ref.current;
|
|
8
|
+
if (!el)
|
|
9
|
+
return;
|
|
10
|
+
if (props.role != null) {
|
|
11
|
+
el.setAttribute('role', String(props.role));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
el.removeAttribute('role');
|
|
15
|
+
}
|
|
16
|
+
}, [props.role]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (!el)
|
|
20
|
+
return;
|
|
21
|
+
if (props.parts != null) {
|
|
22
|
+
el.setAttribute('parts', typeof props.parts === 'object' ? JSON.stringify(props.parts) : String(props.parts));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
el.removeAttribute('parts');
|
|
26
|
+
}
|
|
27
|
+
}, [props.parts]);
|
|
28
|
+
// Build attribute object
|
|
29
|
+
const attrs = {};
|
|
30
|
+
if (props.id != null)
|
|
31
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
32
|
+
if (props.alignment != null)
|
|
33
|
+
attrs['alignment'] = typeof props.alignment === 'object' ? JSON.stringify(props.alignment) : String(props.alignment);
|
|
34
|
+
if (props.size != null)
|
|
35
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
36
|
+
if (props.senderName != null)
|
|
37
|
+
attrs['sender-name'] = typeof props.senderName === 'object' ? JSON.stringify(props.senderName) : String(props.senderName);
|
|
38
|
+
if (props.animated)
|
|
39
|
+
attrs['animated'] = '';
|
|
40
|
+
return (_jsx("cx-message-group", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
41
|
+
});
|
|
42
|
+
MessageGroup.displayName = 'MessageGroup';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface MessagePartProps {
|
|
3
|
+
/** Enable streaming mode. Pauses WASM rendering. */
|
|
4
|
+
stream?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
/** Fired when streaming ends (after sanitization pass). */
|
|
8
|
+
onStreamEnd?: (e: CustomEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface MessagePartRef {
|
|
11
|
+
/** The underlying DOM element. */
|
|
12
|
+
element: HTMLElement;
|
|
13
|
+
/** Initialize the streaming markdown parser. */
|
|
14
|
+
startStream: () => Promise<void>;
|
|
15
|
+
/** Feed markdown tokens (rAF-batched). */
|
|
16
|
+
appendTokens: (text: string) => void;
|
|
17
|
+
/** End stream, sanitize, remove cursor. */
|
|
18
|
+
endStream: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const MessagePart: React.ForwardRefExoticComponent<MessagePartProps & React.RefAttributes<MessagePartRef>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const MessagePart = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
6
|
+
get element() { return ref.current; },
|
|
7
|
+
async startStream() {
|
|
8
|
+
const el = ref.current;
|
|
9
|
+
if (el?.startStream)
|
|
10
|
+
await el.startStream();
|
|
11
|
+
},
|
|
12
|
+
appendTokens(text) {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (el?.appendTokens)
|
|
15
|
+
el.appendTokens(text);
|
|
16
|
+
},
|
|
17
|
+
async endStream() {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (el?.endStream)
|
|
20
|
+
await el.endStream();
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
// Build attribute object
|
|
24
|
+
const attrs = {};
|
|
25
|
+
if (props.stream)
|
|
26
|
+
attrs.stream = '';
|
|
27
|
+
// Event listener setup
|
|
28
|
+
const handleRef = (el) => {
|
|
29
|
+
ref.current = el;
|
|
30
|
+
if (el && props.onStreamEnd) {
|
|
31
|
+
el.addEventListener('cx-stream-end', props.onStreamEnd);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (_jsx("cx-message-part", { ref: handleRef, ...attrs, className: props.className, style: props.style }));
|
|
35
|
+
});
|
|
36
|
+
MessagePart.displayName = 'MessagePart';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
totalItems: number;
|
|
7
|
+
label?: string;
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
showInfo?: boolean;
|
|
10
|
+
showPrevNext?: boolean;
|
|
11
|
+
prevLabel?: string;
|
|
12
|
+
nextLabel?: string;
|
|
13
|
+
pageSizeOptions?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
export declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Pagination = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const el = ref.current;
|
|
8
|
+
if (!el)
|
|
9
|
+
return;
|
|
10
|
+
if (props.currentPage != null) {
|
|
11
|
+
el.setAttribute('current-page', String(props.currentPage));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
el.removeAttribute('current-page');
|
|
15
|
+
}
|
|
16
|
+
}, [props.currentPage]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (!el)
|
|
20
|
+
return;
|
|
21
|
+
if (props.pageSize != null) {
|
|
22
|
+
el.setAttribute('page-size', String(props.pageSize));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
el.removeAttribute('page-size');
|
|
26
|
+
}
|
|
27
|
+
}, [props.pageSize]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const el = ref.current;
|
|
30
|
+
if (!el)
|
|
31
|
+
return;
|
|
32
|
+
if (props.totalItems != null) {
|
|
33
|
+
el.setAttribute('total-items', String(props.totalItems));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
el.removeAttribute('total-items');
|
|
37
|
+
}
|
|
38
|
+
}, [props.totalItems]);
|
|
39
|
+
// Build attribute object
|
|
40
|
+
const attrs = {};
|
|
41
|
+
if (props.id != null)
|
|
42
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
43
|
+
if (props.label != null)
|
|
44
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
45
|
+
if (props.size != null)
|
|
46
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
47
|
+
if (props.showInfo)
|
|
48
|
+
attrs['show-info'] = '';
|
|
49
|
+
if (props.showPrevNext)
|
|
50
|
+
attrs['show-prev-next'] = '';
|
|
51
|
+
if (props.prevLabel != null)
|
|
52
|
+
attrs['prev-label'] = typeof props.prevLabel === 'object' ? JSON.stringify(props.prevLabel) : String(props.prevLabel);
|
|
53
|
+
if (props.nextLabel != null)
|
|
54
|
+
attrs['next-label'] = typeof props.nextLabel === 'object' ? JSON.stringify(props.nextLabel) : String(props.nextLabel);
|
|
55
|
+
if (props.pageSizeOptions != null)
|
|
56
|
+
attrs['page-size-options'] = typeof props.pageSizeOptions === 'object' ? JSON.stringify(props.pageSizeOptions) : String(props.pageSizeOptions);
|
|
57
|
+
return (_jsx("cx-pagination", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
58
|
+
});
|
|
59
|
+
Pagination.displayName = 'Pagination';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface PopoverRef extends HTMLElement {
|
|
3
|
+
/** Opens the popover panel. */
|
|
4
|
+
open(): void;
|
|
5
|
+
/** Closes the popover panel. */
|
|
6
|
+
close(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface PopoverProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
triggerLabel: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
width?: 'sm' | 'md' | 'lg' | 'xl' | 'auto';
|
|
14
|
+
placement?: 'top' | 'bottom';
|
|
15
|
+
align?: 'start' | 'center' | 'end';
|
|
16
|
+
arrow?: boolean;
|
|
17
|
+
closeButton?: boolean;
|
|
18
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
19
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
20
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
21
|
+
icon?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<PopoverRef>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Popover = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const el = ref.current;
|
|
8
|
+
if (!el)
|
|
9
|
+
return;
|
|
10
|
+
if (props.title != null) {
|
|
11
|
+
el.setAttribute('title', String(props.title));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
el.removeAttribute('title');
|
|
15
|
+
}
|
|
16
|
+
}, [props.title]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (!el)
|
|
20
|
+
return;
|
|
21
|
+
if (props.width != null) {
|
|
22
|
+
el.setAttribute('width', String(props.width));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
el.removeAttribute('width');
|
|
26
|
+
}
|
|
27
|
+
}, [props.width]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const el = ref.current;
|
|
30
|
+
if (!el)
|
|
31
|
+
return;
|
|
32
|
+
if (props.align != null) {
|
|
33
|
+
el.setAttribute('align', String(props.align));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
el.removeAttribute('align');
|
|
37
|
+
}
|
|
38
|
+
}, [props.align]);
|
|
39
|
+
// Build attribute object
|
|
40
|
+
const attrs = {};
|
|
41
|
+
if (props.id != null)
|
|
42
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
43
|
+
if (props.triggerLabel != null)
|
|
44
|
+
attrs['trigger-label'] = typeof props.triggerLabel === 'object' ? JSON.stringify(props.triggerLabel) : String(props.triggerLabel);
|
|
45
|
+
if (props.description != null)
|
|
46
|
+
attrs['description'] = typeof props.description === 'object' ? JSON.stringify(props.description) : String(props.description);
|
|
47
|
+
if (props.placement != null)
|
|
48
|
+
attrs['placement'] = typeof props.placement === 'object' ? JSON.stringify(props.placement) : String(props.placement);
|
|
49
|
+
if (props.arrow)
|
|
50
|
+
attrs['arrow'] = '';
|
|
51
|
+
if (props.closeButton)
|
|
52
|
+
attrs['close-button'] = '';
|
|
53
|
+
if (props.variant != null)
|
|
54
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
55
|
+
if (props.shape != null)
|
|
56
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
57
|
+
if (props.size != null)
|
|
58
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
59
|
+
if (props.icon != null)
|
|
60
|
+
attrs['icon'] = typeof props.icon === 'object' ? JSON.stringify(props.icon) : String(props.icon);
|
|
61
|
+
if (props.disabled)
|
|
62
|
+
attrs['disabled'] = '';
|
|
63
|
+
return (_jsx("cx-popover", { ref: ref, ...attrs, className: props.className, style: props.style, children: props.children }));
|
|
64
|
+
});
|
|
65
|
+
Popover.displayName = 'Popover';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { MenuActionDetail, MenuEntry } from './types.js';
|
|
3
|
+
export interface ProfileMenuRef extends HTMLElement {
|
|
4
|
+
/** Opens the profile menu dropdown. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Closes the profile menu dropdown. */
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ProfileMenuProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
label: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
initials?: string;
|
|
14
|
+
shape?: 'circle' | 'rounded';
|
|
15
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
16
|
+
width?: 'auto' | 'sm' | 'md' | 'lg';
|
|
17
|
+
entries?: MenuEntry[] | string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onAction?: (event: CustomEvent<MenuActionDetail>) => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
}
|
|
23
|
+
export declare const ProfileMenu: React.ForwardRefExoticComponent<ProfileMenuProps & React.RefAttributes<ProfileMenuRef>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const ProfileMenu = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onActionRef = useRef(props.onAction);
|
|
7
|
+
onActionRef.current = props.onAction;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const handler = (e) => onActionRef.current?.(e);
|
|
13
|
+
el.addEventListener('cx-action', handler);
|
|
14
|
+
return () => el.removeEventListener('cx-action', handler);
|
|
15
|
+
}, []);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
if (props.width != null) {
|
|
21
|
+
el.setAttribute('width', String(props.width));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
el.removeAttribute('width');
|
|
25
|
+
}
|
|
26
|
+
}, [props.width]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const el = ref.current;
|
|
29
|
+
if (!el)
|
|
30
|
+
return;
|
|
31
|
+
if (props.entries != null) {
|
|
32
|
+
el.setAttribute('entries', typeof props.entries === 'object' ? JSON.stringify(props.entries) : String(props.entries));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
el.removeAttribute('entries');
|
|
36
|
+
}
|
|
37
|
+
}, [props.entries]);
|
|
38
|
+
// Build attribute object
|
|
39
|
+
const attrs = {};
|
|
40
|
+
if (props.id != null)
|
|
41
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
42
|
+
if (props.label != null)
|
|
43
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
44
|
+
if (props.image != null)
|
|
45
|
+
attrs['image'] = typeof props.image === 'object' ? JSON.stringify(props.image) : String(props.image);
|
|
46
|
+
if (props.initials != null)
|
|
47
|
+
attrs['initials'] = typeof props.initials === 'object' ? JSON.stringify(props.initials) : String(props.initials);
|
|
48
|
+
if (props.shape != null)
|
|
49
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
50
|
+
if (props.size != null)
|
|
51
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
52
|
+
if (props.disabled)
|
|
53
|
+
attrs['disabled'] = '';
|
|
54
|
+
return (_jsx("cx-profile-menu", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
55
|
+
});
|
|
56
|
+
ProfileMenu.displayName = 'ProfileMenu';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface ProgressProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Percentage 0–100. No `max` prop — the component assumes max=100. */
|
|
6
|
+
value?: number;
|
|
7
|
+
valueText?: string;
|
|
8
|
+
intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
9
|
+
shape?: 'rounded' | 'sharp' | 'pill';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLElement>>;
|