@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,124 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const DatePicker = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onInputRef = useRef(props.onInput);
|
|
7
|
+
onInputRef.current = props.onInput;
|
|
8
|
+
const onChangeRef = useRef(props.onChange);
|
|
9
|
+
onChangeRef.current = props.onChange;
|
|
10
|
+
const onFocusRef = useRef(props.onFocus);
|
|
11
|
+
onFocusRef.current = props.onFocus;
|
|
12
|
+
const onBlurRef = useRef(props.onBlur);
|
|
13
|
+
onBlurRef.current = props.onBlur;
|
|
14
|
+
const onKeydownRef = useRef(props.onKeydown);
|
|
15
|
+
onKeydownRef.current = props.onKeydown;
|
|
16
|
+
const onKeyupRef = useRef(props.onKeyup);
|
|
17
|
+
onKeyupRef.current = props.onKeyup;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const el = ref.current;
|
|
20
|
+
if (!el)
|
|
21
|
+
return;
|
|
22
|
+
const handler = (e) => onInputRef.current?.(e);
|
|
23
|
+
el.addEventListener('cx-input', handler);
|
|
24
|
+
return () => el.removeEventListener('cx-input', handler);
|
|
25
|
+
}, []);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const el = ref.current;
|
|
28
|
+
if (!el)
|
|
29
|
+
return;
|
|
30
|
+
const handler = (e) => onChangeRef.current?.(e);
|
|
31
|
+
el.addEventListener('cx-change', handler);
|
|
32
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const el = ref.current;
|
|
36
|
+
if (!el)
|
|
37
|
+
return;
|
|
38
|
+
const handler = (e) => onFocusRef.current?.(e);
|
|
39
|
+
el.addEventListener('cx-focus', handler);
|
|
40
|
+
return () => el.removeEventListener('cx-focus', handler);
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const el = ref.current;
|
|
44
|
+
if (!el)
|
|
45
|
+
return;
|
|
46
|
+
const handler = (e) => onBlurRef.current?.(e);
|
|
47
|
+
el.addEventListener('cx-blur', handler);
|
|
48
|
+
return () => el.removeEventListener('cx-blur', handler);
|
|
49
|
+
}, []);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const el = ref.current;
|
|
52
|
+
if (!el)
|
|
53
|
+
return;
|
|
54
|
+
const handler = (e) => onKeydownRef.current?.(e);
|
|
55
|
+
el.addEventListener('cx-keydown', handler);
|
|
56
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
57
|
+
}, []);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const el = ref.current;
|
|
60
|
+
if (!el)
|
|
61
|
+
return;
|
|
62
|
+
const handler = (e) => onKeyupRef.current?.(e);
|
|
63
|
+
el.addEventListener('cx-keyup', handler);
|
|
64
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const el = ref.current;
|
|
68
|
+
if (!el)
|
|
69
|
+
return;
|
|
70
|
+
if (props.name != null) {
|
|
71
|
+
el.setAttribute('name', String(props.name));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
el.removeAttribute('name');
|
|
75
|
+
}
|
|
76
|
+
}, [props.name]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const el = ref.current;
|
|
79
|
+
if (!el)
|
|
80
|
+
return;
|
|
81
|
+
if (props.disabledDates != null) {
|
|
82
|
+
el.setAttribute('disabled-dates', typeof props.disabledDates === 'object' ? JSON.stringify(props.disabledDates) : String(props.disabledDates));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
el.removeAttribute('disabled-dates');
|
|
86
|
+
}
|
|
87
|
+
}, [props.disabledDates]);
|
|
88
|
+
// Build attribute object
|
|
89
|
+
const attrs = {};
|
|
90
|
+
if (props.id != null)
|
|
91
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
92
|
+
if (props.label != null)
|
|
93
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
94
|
+
if (props.variant != null)
|
|
95
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
96
|
+
if (props.shape != null)
|
|
97
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
98
|
+
if (props.size != null)
|
|
99
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
100
|
+
if (props.selected != null)
|
|
101
|
+
attrs['selected'] = typeof props.selected === 'object' ? JSON.stringify(props.selected) : String(props.selected);
|
|
102
|
+
if (props.min != null)
|
|
103
|
+
attrs['min'] = typeof props.min === 'object' ? JSON.stringify(props.min) : String(props.min);
|
|
104
|
+
if (props.max != null)
|
|
105
|
+
attrs['max'] = typeof props.max === 'object' ? JSON.stringify(props.max) : String(props.max);
|
|
106
|
+
if (props.format != null)
|
|
107
|
+
attrs['format'] = typeof props.format === 'object' ? JSON.stringify(props.format) : String(props.format);
|
|
108
|
+
if (props.firstDay != null)
|
|
109
|
+
attrs['first-day'] = typeof props.firstDay === 'object' ? JSON.stringify(props.firstDay) : String(props.firstDay);
|
|
110
|
+
if (props.placeholder != null)
|
|
111
|
+
attrs['placeholder'] = typeof props.placeholder === 'object' ? JSON.stringify(props.placeholder) : String(props.placeholder);
|
|
112
|
+
if (props.helperText != null)
|
|
113
|
+
attrs['helper-text'] = typeof props.helperText === 'object' ? JSON.stringify(props.helperText) : String(props.helperText);
|
|
114
|
+
if (props.error != null)
|
|
115
|
+
attrs['error'] = typeof props.error === 'object' ? JSON.stringify(props.error) : String(props.error);
|
|
116
|
+
if (props.disabled)
|
|
117
|
+
attrs['disabled'] = '';
|
|
118
|
+
if (props.required)
|
|
119
|
+
attrs['required'] = '';
|
|
120
|
+
if (props.readonly)
|
|
121
|
+
attrs['readonly'] = '';
|
|
122
|
+
return (_jsx("cx-date-picker", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
123
|
+
});
|
|
124
|
+
DatePicker.displayName = 'DatePicker';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CloseDetail } from './types.js';
|
|
3
|
+
export interface DialogRef extends HTMLElement {
|
|
4
|
+
/** Opens the dialog modal with entrance animation. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Closes the dialog modal with exit animation. */
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface DialogProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
variant?: 'standard' | 'alert';
|
|
13
|
+
description?: string;
|
|
14
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
15
|
+
closeButton?: string;
|
|
16
|
+
drawer?: string;
|
|
17
|
+
/** Declarative open/close. When true, the dialog opens after WASM renders.
|
|
18
|
+
* When false (or omitted), the dialog closes. Works reliably regardless
|
|
19
|
+
* of WASM load timing — the Custom Element queues the open for after
|
|
20
|
+
* first render if WASM hasn't loaded yet. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onClose?: (event: CustomEvent<CloseDetail>) => void;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
footer?: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<DialogRef>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Dialog = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onCloseRef = useRef(props.onClose);
|
|
7
|
+
onCloseRef.current = props.onClose;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const handler = (e) => onCloseRef.current?.(e);
|
|
13
|
+
el.addEventListener('cx-close', handler);
|
|
14
|
+
return () => el.removeEventListener('cx-close', handler);
|
|
15
|
+
}, []);
|
|
16
|
+
// Title must be set via setAttribute to avoid collision with
|
|
17
|
+
// HTMLElement.title (tooltip) which React sets as a property.
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const el = ref.current;
|
|
20
|
+
if (!el)
|
|
21
|
+
return;
|
|
22
|
+
if (props.title != null) {
|
|
23
|
+
el.setAttribute('title', String(props.title));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
el.removeAttribute('title');
|
|
27
|
+
}
|
|
28
|
+
}, [props.title]);
|
|
29
|
+
// Declarative open/close via boolean attribute.
|
|
30
|
+
// The Custom Element's attributeChangedCallback intercepts 'open' and
|
|
31
|
+
// queues the dialog open for after WASM render — no timing issues.
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const el = ref.current;
|
|
34
|
+
if (!el)
|
|
35
|
+
return;
|
|
36
|
+
if (props.open) {
|
|
37
|
+
el.setAttribute('open', '');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
el.removeAttribute('open');
|
|
41
|
+
}
|
|
42
|
+
}, [props.open]);
|
|
43
|
+
// Build attribute object
|
|
44
|
+
const attrs = {};
|
|
45
|
+
if (props.id != null)
|
|
46
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
47
|
+
if (props.variant != null)
|
|
48
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
49
|
+
if (props.description != null)
|
|
50
|
+
attrs['description'] = typeof props.description === 'object' ? JSON.stringify(props.description) : String(props.description);
|
|
51
|
+
if (props.size != null)
|
|
52
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
53
|
+
if (props.closeButton != null)
|
|
54
|
+
attrs['close-button'] = typeof props.closeButton === 'object' ? JSON.stringify(props.closeButton) : String(props.closeButton);
|
|
55
|
+
if (props.drawer != null)
|
|
56
|
+
attrs['drawer'] = typeof props.drawer === 'object' ? JSON.stringify(props.drawer) : String(props.drawer);
|
|
57
|
+
return (_jsxs("cx-dialog", { ref: ref, ...attrs, className: props.className, style: props.style, children: [props.footer && _jsx("div", { slot: "footer", style: { display: 'contents' }, children: props.footer }), props.children] }));
|
|
58
|
+
});
|
|
59
|
+
Dialog.displayName = 'Dialog';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CloseDetail } from './types.js';
|
|
3
|
+
export interface DrawerRef extends HTMLElement {
|
|
4
|
+
/** Opens the drawer panel with slide-in animation. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Closes the drawer panel with slide-out animation. */
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface DrawerProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
14
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
15
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
16
|
+
closeButton?: string;
|
|
17
|
+
/** Declarative open/close. When true, the drawer opens after WASM renders.
|
|
18
|
+
* When false (or omitted), the drawer closes. Works reliably regardless
|
|
19
|
+
* of WASM load timing — the Custom Element queues the open for after
|
|
20
|
+
* first render if WASM hasn't loaded yet. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onClose?: (event: CustomEvent<CloseDetail>) => void;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
footer?: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<DrawerRef>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Drawer = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onCloseRef = useRef(props.onClose);
|
|
7
|
+
onCloseRef.current = props.onClose;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const handler = (e) => onCloseRef.current?.(e);
|
|
13
|
+
el.addEventListener('cx-close', handler);
|
|
14
|
+
return () => el.removeEventListener('cx-close', handler);
|
|
15
|
+
}, []);
|
|
16
|
+
// Title must be set via setAttribute to avoid collision with
|
|
17
|
+
// HTMLElement.title (tooltip) which React sets as a property.
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const el = ref.current;
|
|
20
|
+
if (!el)
|
|
21
|
+
return;
|
|
22
|
+
if (props.title != null) {
|
|
23
|
+
el.setAttribute('title', String(props.title));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
el.removeAttribute('title');
|
|
27
|
+
}
|
|
28
|
+
}, [props.title]);
|
|
29
|
+
// Declarative open/close via boolean attribute.
|
|
30
|
+
// The Custom Element's attributeChangedCallback intercepts 'open' and
|
|
31
|
+
// queues the drawer open for after WASM render — no timing issues.
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const el = ref.current;
|
|
34
|
+
if (!el)
|
|
35
|
+
return;
|
|
36
|
+
if (props.open) {
|
|
37
|
+
el.setAttribute('open', '');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
el.removeAttribute('open');
|
|
41
|
+
}
|
|
42
|
+
}, [props.open]);
|
|
43
|
+
// Build attribute object
|
|
44
|
+
const attrs = {};
|
|
45
|
+
if (props.id != null)
|
|
46
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
47
|
+
if (props.description != null)
|
|
48
|
+
attrs['description'] = typeof props.description === 'object' ? JSON.stringify(props.description) : String(props.description);
|
|
49
|
+
if (props.side != null)
|
|
50
|
+
attrs['side'] = typeof props.side === 'object' ? JSON.stringify(props.side) : String(props.side);
|
|
51
|
+
if (props.size != null)
|
|
52
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
53
|
+
if (props.shape != null)
|
|
54
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
55
|
+
if (props.closeButton != null)
|
|
56
|
+
attrs['close-button'] = typeof props.closeButton === 'object' ? JSON.stringify(props.closeButton) : String(props.closeButton);
|
|
57
|
+
return (_jsxs("cx-drawer", { ref: ref, ...attrs, className: props.className, style: props.style, children: [props.footer && _jsx("div", { slot: "footer", style: { display: 'contents' }, children: props.footer }), props.children] }));
|
|
58
|
+
});
|
|
59
|
+
Drawer.displayName = 'Drawer';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ClickDetail } from './types.js';
|
|
3
|
+
export interface FabProps {
|
|
4
|
+
icon?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
variant?: 'filled' | 'outline' | 'ghost';
|
|
8
|
+
intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
9
|
+
shape?: 'rounded' | 'pill';
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hasPopup?: boolean;
|
|
13
|
+
expanded?: boolean;
|
|
14
|
+
controls?: string;
|
|
15
|
+
onClick?: (event: CustomEvent<ClickDetail>) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
export declare const Fab: React.ForwardRefExoticComponent<FabProps & 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 Fab = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onClickRef = useRef(props.onClick);
|
|
7
|
+
onClickRef.current = props.onClick;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const handler = (e) => onClickRef.current?.(e);
|
|
13
|
+
el.addEventListener('cx-click', handler);
|
|
14
|
+
return () => el.removeEventListener('cx-click', handler);
|
|
15
|
+
}, []);
|
|
16
|
+
// Build attribute object
|
|
17
|
+
const attrs = {};
|
|
18
|
+
if (props.icon != null)
|
|
19
|
+
attrs['icon'] = typeof props.icon === 'object' ? JSON.stringify(props.icon) : String(props.icon);
|
|
20
|
+
if (props.label != null)
|
|
21
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
22
|
+
if (props.ariaLabel != null)
|
|
23
|
+
attrs['aria-label'] = typeof props.ariaLabel === 'object' ? JSON.stringify(props.ariaLabel) : String(props.ariaLabel);
|
|
24
|
+
if (props.variant != null)
|
|
25
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
26
|
+
if (props.intent != null)
|
|
27
|
+
attrs['intent'] = typeof props.intent === 'object' ? JSON.stringify(props.intent) : String(props.intent);
|
|
28
|
+
if (props.shape != null)
|
|
29
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
30
|
+
if (props.size != null)
|
|
31
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
32
|
+
if (props.disabled)
|
|
33
|
+
attrs['disabled'] = '';
|
|
34
|
+
if (props.hasPopup)
|
|
35
|
+
attrs['has-popup'] = '';
|
|
36
|
+
if (props.expanded)
|
|
37
|
+
attrs['expanded'] = '';
|
|
38
|
+
if (props.controls != null)
|
|
39
|
+
attrs['controls'] = typeof props.controls === 'object' ? JSON.stringify(props.controls) : String(props.controls);
|
|
40
|
+
return (_jsx("cx-fab", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
41
|
+
});
|
|
42
|
+
Fab.displayName = 'Fab';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface FileUploadProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
mode?: 'inline' | 'overlay';
|
|
6
|
+
variant?: 'outline' | 'filled' | 'subtle';
|
|
7
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
accept?: string;
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
heading?: string;
|
|
14
|
+
browseText?: string;
|
|
15
|
+
hint?: string;
|
|
16
|
+
capture?: string;
|
|
17
|
+
preview?: boolean;
|
|
18
|
+
onChange?: (event: CustomEvent) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
export declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & 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 FileUpload = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
const onChangeRef = useRef(props.onChange);
|
|
7
|
+
onChangeRef.current = props.onChange;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
const handler = (e) => onChangeRef.current?.(e);
|
|
13
|
+
el.addEventListener('cx-change', handler);
|
|
14
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
15
|
+
}, []);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
if (props.maxSize != null) {
|
|
21
|
+
el.setAttribute('max-size', String(props.maxSize));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
el.removeAttribute('max-size');
|
|
25
|
+
}
|
|
26
|
+
}, [props.maxSize]);
|
|
27
|
+
// Build attribute object
|
|
28
|
+
const attrs = {};
|
|
29
|
+
if (props.id != null)
|
|
30
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
31
|
+
if (props.label != null)
|
|
32
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
33
|
+
if (props.mode != null)
|
|
34
|
+
attrs['mode'] = typeof props.mode === 'object' ? JSON.stringify(props.mode) : String(props.mode);
|
|
35
|
+
if (props.variant != null)
|
|
36
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
37
|
+
if (props.shape != null)
|
|
38
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
39
|
+
if (props.size != null)
|
|
40
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
41
|
+
if (props.disabled)
|
|
42
|
+
attrs['disabled'] = '';
|
|
43
|
+
if (props.multiple)
|
|
44
|
+
attrs['multiple'] = '';
|
|
45
|
+
if (props.accept != null)
|
|
46
|
+
attrs['accept'] = typeof props.accept === 'object' ? JSON.stringify(props.accept) : String(props.accept);
|
|
47
|
+
if (props.heading != null)
|
|
48
|
+
attrs['heading'] = typeof props.heading === 'object' ? JSON.stringify(props.heading) : String(props.heading);
|
|
49
|
+
if (props.browseText != null)
|
|
50
|
+
attrs['browse-text'] = typeof props.browseText === 'object' ? JSON.stringify(props.browseText) : String(props.browseText);
|
|
51
|
+
if (props.hint != null)
|
|
52
|
+
attrs['hint'] = typeof props.hint === 'object' ? JSON.stringify(props.hint) : String(props.hint);
|
|
53
|
+
if (props.capture != null)
|
|
54
|
+
attrs['capture'] = typeof props.capture === 'object' ? JSON.stringify(props.capture) : String(props.capture);
|
|
55
|
+
if (props.preview)
|
|
56
|
+
attrs['preview'] = '';
|
|
57
|
+
return (_jsx("cx-file-upload", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
58
|
+
});
|
|
59
|
+
FileUpload.displayName = 'FileUpload';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export { init, componentNames } from '@colletdev/core';
|
|
2
|
+
export type { InitOptions, ComponentName } from '@colletdev/core';
|
|
3
|
+
export type { SelectOption, OptionGroup, TabItem, TableColumn, TableCell, TableRow, SortState, PaginationConfig, FooterRow, EmptyStateConfig, AccordionItem, MenuEntry, MenuRadioItem, SidebarNavItem, SidebarGroup, BreadcrumbItem, RadioOption, ToggleItem, SplitMenuEntry, SpeedDialAction, CarouselSlide, MessageGroupPart, StepperStep, } from './types.js';
|
|
4
|
+
export type { InputDetail, SelectDetail, CheckedDetail, SliderDetail, ToggleDetail, AccordionDetail, CollapsibleDetail, MenuActionDetail, MenuChangeDetail, SortDetail, TableSelectDetail, TableExpandDetail, PageDetail, NavigateDetail, ClickDetail, CloseDetail, DismissDetail, FocusDetail, KeyboardDetail, CarouselDetail, FileChangeDetail, FileInfo, } from './types.js';
|
|
5
|
+
export { Accordion } from './accordion.js';
|
|
6
|
+
export { ActivityGroup } from './activity-group.js';
|
|
7
|
+
export { Alert } from './alert.js';
|
|
8
|
+
export { Autocomplete, type AutocompleteRef } from './autocomplete.js';
|
|
9
|
+
export { Avatar } from './avatar.js';
|
|
10
|
+
export { Backdrop } from './backdrop.js';
|
|
11
|
+
export { Badge } from './badge.js';
|
|
12
|
+
export { Breadcrumb } from './breadcrumb.js';
|
|
13
|
+
export { Button } from './button.js';
|
|
14
|
+
export { Card } from './card.js';
|
|
15
|
+
export { Carousel, type CarouselRef } from './carousel.js';
|
|
16
|
+
export { ChatInput, type ChatInputRef } from './chat-input.js';
|
|
17
|
+
export { Checkbox, type CheckboxRef } from './checkbox.js';
|
|
18
|
+
export { CodeBlock } from './code-block.js';
|
|
19
|
+
export { Collapsible, type CollapsibleRef } from './collapsible.js';
|
|
20
|
+
export { DatePicker, type DatePickerRef } from './date-picker.js';
|
|
21
|
+
export { Dialog, type DialogRef } from './dialog.js';
|
|
22
|
+
export { Drawer, type DrawerRef } from './drawer.js';
|
|
23
|
+
export { Fab } from './fab.js';
|
|
24
|
+
export { FileUpload } from './file-upload.js';
|
|
25
|
+
export { Listbox } from './listbox.js';
|
|
26
|
+
export { Menu, type MenuRef } from './menu.js';
|
|
27
|
+
export { MessageBubble } from './message-bubble.js';
|
|
28
|
+
export { MessageGroup } from './message-group.js';
|
|
29
|
+
export { MessagePart } from './message-part.js';
|
|
30
|
+
export { Pagination } from './pagination.js';
|
|
31
|
+
export { Popover, type PopoverRef } from './popover.js';
|
|
32
|
+
export { ProfileMenu, type ProfileMenuRef } from './profile-menu.js';
|
|
33
|
+
export { Progress } from './progress.js';
|
|
34
|
+
export { RadioGroup } from './radio-group.js';
|
|
35
|
+
export { Scrollbar } from './scrollbar.js';
|
|
36
|
+
export { SearchBar, type SearchBarRef } from './search-bar.js';
|
|
37
|
+
export { Select, type SelectRef } from './select.js';
|
|
38
|
+
export { Sidebar, type SidebarRef } from './sidebar.js';
|
|
39
|
+
export { Skeleton } from './skeleton.js';
|
|
40
|
+
export { Slider, type SliderRef } from './slider.js';
|
|
41
|
+
export { SpeedDial, type SpeedDialRef } from './speed-dial.js';
|
|
42
|
+
export { Spinner } from './spinner.js';
|
|
43
|
+
export { SplitButton, type SplitButtonRef } from './split-button.js';
|
|
44
|
+
export { Stepper } from './stepper.js';
|
|
45
|
+
export { Switch, type SwitchRef } from './switch.js';
|
|
46
|
+
export { Table } from './table.js';
|
|
47
|
+
export { Tabs, type TabsRef } from './tabs.js';
|
|
48
|
+
export { Text } from './text.js';
|
|
49
|
+
export { TextInput, type TextInputRef } from './text-input.js';
|
|
50
|
+
export { Thinking } from './thinking.js';
|
|
51
|
+
export { Toast, type ToastRef } from './toast.js';
|
|
52
|
+
export { ToggleGroup } from './toggle-group.js';
|
|
53
|
+
export { Tooltip } from './tooltip.js';
|
|
54
|
+
export { type MessagePartRef } from './message-part.js';
|
|
55
|
+
export { useMarkdown } from './use-markdown.js';
|
|
56
|
+
export { useMarkdownStream, type MarkdownStreamRef } from './use-markdown-stream.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-react.mjs — DO NOT EDIT
|
|
2
|
+
// Consumers must call `init()` from @colletdev/core before using these wrappers.
|
|
3
|
+
// Shared JSX IntrinsicElements declarations
|
|
4
|
+
/// <reference path="./elements.d.ts" />
|
|
5
|
+
// Re-export init and types from core
|
|
6
|
+
export { init, componentNames } from '@colletdev/core';
|
|
7
|
+
export { Accordion } from './accordion.js';
|
|
8
|
+
export { ActivityGroup } from './activity-group.js';
|
|
9
|
+
export { Alert } from './alert.js';
|
|
10
|
+
export { Autocomplete } from './autocomplete.js';
|
|
11
|
+
export { Avatar } from './avatar.js';
|
|
12
|
+
export { Backdrop } from './backdrop.js';
|
|
13
|
+
export { Badge } from './badge.js';
|
|
14
|
+
export { Breadcrumb } from './breadcrumb.js';
|
|
15
|
+
export { Button } from './button.js';
|
|
16
|
+
export { Card } from './card.js';
|
|
17
|
+
export { Carousel } from './carousel.js';
|
|
18
|
+
export { ChatInput } from './chat-input.js';
|
|
19
|
+
export { Checkbox } from './checkbox.js';
|
|
20
|
+
export { CodeBlock } from './code-block.js';
|
|
21
|
+
export { Collapsible } from './collapsible.js';
|
|
22
|
+
export { DatePicker } from './date-picker.js';
|
|
23
|
+
export { Dialog } from './dialog.js';
|
|
24
|
+
export { Drawer } from './drawer.js';
|
|
25
|
+
export { Fab } from './fab.js';
|
|
26
|
+
export { FileUpload } from './file-upload.js';
|
|
27
|
+
export { Listbox } from './listbox.js';
|
|
28
|
+
export { Menu } from './menu.js';
|
|
29
|
+
export { MessageBubble } from './message-bubble.js';
|
|
30
|
+
export { MessageGroup } from './message-group.js';
|
|
31
|
+
export { MessagePart } from './message-part.js';
|
|
32
|
+
export { Pagination } from './pagination.js';
|
|
33
|
+
export { Popover } from './popover.js';
|
|
34
|
+
export { ProfileMenu } from './profile-menu.js';
|
|
35
|
+
export { Progress } from './progress.js';
|
|
36
|
+
export { RadioGroup } from './radio-group.js';
|
|
37
|
+
export { Scrollbar } from './scrollbar.js';
|
|
38
|
+
export { SearchBar } from './search-bar.js';
|
|
39
|
+
export { Select } from './select.js';
|
|
40
|
+
export { Sidebar } from './sidebar.js';
|
|
41
|
+
export { Skeleton } from './skeleton.js';
|
|
42
|
+
export { Slider } from './slider.js';
|
|
43
|
+
export { SpeedDial } from './speed-dial.js';
|
|
44
|
+
export { Spinner } from './spinner.js';
|
|
45
|
+
export { SplitButton } from './split-button.js';
|
|
46
|
+
export { Stepper } from './stepper.js';
|
|
47
|
+
export { Switch } from './switch.js';
|
|
48
|
+
export { Table } from './table.js';
|
|
49
|
+
export { Tabs } from './tabs.js';
|
|
50
|
+
export { Text } from './text.js';
|
|
51
|
+
export { TextInput } from './text-input.js';
|
|
52
|
+
export { Thinking } from './thinking.js';
|
|
53
|
+
export { Toast } from './toast.js';
|
|
54
|
+
export { ToggleGroup } from './toggle-group.js';
|
|
55
|
+
export { Tooltip } from './tooltip.js';
|
|
56
|
+
// Markdown utilities
|
|
57
|
+
export { useMarkdown } from './use-markdown.js';
|
|
58
|
+
export { useMarkdownStream } from './use-markdown-stream.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FocusDetail, KeyboardDetail, OptionGroup, SelectOption } from './types.js';
|
|
3
|
+
export interface ListboxProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
|
+
selectionMode?: string;
|
|
9
|
+
selected?: string[] | string;
|
|
10
|
+
items?: SelectOption[] | string;
|
|
11
|
+
groups?: OptionGroup[] | string;
|
|
12
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
13
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
14
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
15
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
export declare const Listbox: React.ForwardRefExoticComponent<ListboxProps & React.RefAttributes<HTMLElement>>;
|