@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,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Button = 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.label != null)
|
|
19
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
20
|
+
if (props.variant != null)
|
|
21
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
22
|
+
if (props.intent != null)
|
|
23
|
+
attrs['intent'] = typeof props.intent === 'object' ? JSON.stringify(props.intent) : String(props.intent);
|
|
24
|
+
if (props.shape != null)
|
|
25
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
26
|
+
if (props.size != null)
|
|
27
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
28
|
+
if (props.disabled)
|
|
29
|
+
attrs['disabled'] = '';
|
|
30
|
+
if (props.iconLeading != null)
|
|
31
|
+
attrs['icon-leading'] = typeof props.iconLeading === 'object' ? JSON.stringify(props.iconLeading) : String(props.iconLeading);
|
|
32
|
+
if (props.iconTrailing != null)
|
|
33
|
+
attrs['icon-trailing'] = typeof props.iconTrailing === 'object' ? JSON.stringify(props.iconTrailing) : String(props.iconTrailing);
|
|
34
|
+
if (props.iconOnly != null)
|
|
35
|
+
attrs['icon-only'] = typeof props.iconOnly === 'object' ? JSON.stringify(props.iconOnly) : String(props.iconOnly);
|
|
36
|
+
if (props.ariaLabel != null)
|
|
37
|
+
attrs['aria-label'] = typeof props.ariaLabel === 'object' ? JSON.stringify(props.ariaLabel) : String(props.ariaLabel);
|
|
38
|
+
if (props.kind != null)
|
|
39
|
+
attrs['kind'] = typeof props.kind === 'object' ? JSON.stringify(props.kind) : String(props.kind);
|
|
40
|
+
if (props.pressed)
|
|
41
|
+
attrs['pressed'] = '';
|
|
42
|
+
if (props.href != null)
|
|
43
|
+
attrs['href'] = typeof props.href === 'object' ? JSON.stringify(props.href) : String(props.href);
|
|
44
|
+
return (_jsx("cx-button", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
45
|
+
});
|
|
46
|
+
Button.displayName = 'Button';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ClickDetail, KeyboardDetail } from './types.js';
|
|
3
|
+
export interface CardProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
variant?: 'elevated' | 'outlined' | 'filled';
|
|
7
|
+
shape?: 'rounded' | 'sharp' | 'soft';
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
clickable?: boolean;
|
|
10
|
+
texture?: boolean;
|
|
11
|
+
onClick?: (event: CustomEvent<ClickDetail>) => void;
|
|
12
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
13
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
header?: React.ReactNode;
|
|
16
|
+
footer?: React.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Card = 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
|
+
const onKeydownRef = useRef(props.onKeydown);
|
|
9
|
+
onKeydownRef.current = props.onKeydown;
|
|
10
|
+
const onKeyupRef = useRef(props.onKeyup);
|
|
11
|
+
onKeyupRef.current = props.onKeyup;
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el)
|
|
15
|
+
return;
|
|
16
|
+
const handler = (e) => onClickRef.current?.(e);
|
|
17
|
+
el.addEventListener('cx-click', handler);
|
|
18
|
+
return () => el.removeEventListener('cx-click', handler);
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const el = ref.current;
|
|
22
|
+
if (!el)
|
|
23
|
+
return;
|
|
24
|
+
const handler = (e) => onKeydownRef.current?.(e);
|
|
25
|
+
el.addEventListener('cx-keydown', handler);
|
|
26
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
27
|
+
}, []);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const el = ref.current;
|
|
30
|
+
if (!el)
|
|
31
|
+
return;
|
|
32
|
+
const handler = (e) => onKeyupRef.current?.(e);
|
|
33
|
+
el.addEventListener('cx-keyup', handler);
|
|
34
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
35
|
+
}, []);
|
|
36
|
+
// Build attribute object
|
|
37
|
+
const attrs = {};
|
|
38
|
+
if (props.id != null)
|
|
39
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
40
|
+
if (props.label != null)
|
|
41
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
42
|
+
if (props.variant != null)
|
|
43
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
44
|
+
if (props.shape != null)
|
|
45
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
46
|
+
if (props.size != null)
|
|
47
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
48
|
+
if (props.clickable)
|
|
49
|
+
attrs['clickable'] = '';
|
|
50
|
+
if (props.texture)
|
|
51
|
+
attrs['texture'] = '';
|
|
52
|
+
return (_jsxs("cx-card", { ref: ref, ...attrs, className: props.className, style: props.style, children: [props.header && _jsx("div", { slot: "header", style: { display: 'contents' }, children: props.header }), props.footer && _jsx("div", { slot: "footer", style: { display: 'contents' }, children: props.footer }), props.children] }));
|
|
53
|
+
});
|
|
54
|
+
Card.displayName = 'Card';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CarouselDetail, CarouselSlide } from './types.js';
|
|
3
|
+
export interface CarouselRef extends HTMLElement {
|
|
4
|
+
/** Advances to the next slide. */
|
|
5
|
+
next(): void;
|
|
6
|
+
/** Returns to the previous slide. */
|
|
7
|
+
prev(): void;
|
|
8
|
+
/** Navigates to the slide at the given index. */
|
|
9
|
+
goTo(index: number): void;
|
|
10
|
+
}
|
|
11
|
+
export interface CarouselProps {
|
|
12
|
+
id?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
variant?: 'editorial' | 'card';
|
|
15
|
+
shape?: 'sharp' | 'rounded';
|
|
16
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
17
|
+
slides?: CarouselSlide[] | string;
|
|
18
|
+
autoplay?: 'off' | 'on';
|
|
19
|
+
autoplayInterval?: number;
|
|
20
|
+
loopMode?: boolean;
|
|
21
|
+
motionBlur?: boolean;
|
|
22
|
+
customCursor?: boolean;
|
|
23
|
+
indicator?: string;
|
|
24
|
+
onChange?: (event: CustomEvent<CarouselDetail>) => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<CarouselRef>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Carousel = 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.autoplayInterval != null) {
|
|
21
|
+
el.setAttribute('autoplay-interval', String(props.autoplayInterval));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
el.removeAttribute('autoplay-interval');
|
|
25
|
+
}
|
|
26
|
+
}, [props.autoplayInterval]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const el = ref.current;
|
|
29
|
+
if (!el)
|
|
30
|
+
return;
|
|
31
|
+
if (props.slides != null) {
|
|
32
|
+
el.setAttribute('slides', typeof props.slides === 'object' ? JSON.stringify(props.slides) : String(props.slides));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
el.removeAttribute('slides');
|
|
36
|
+
}
|
|
37
|
+
}, [props.slides]);
|
|
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.variant != null)
|
|
45
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
46
|
+
if (props.shape != null)
|
|
47
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
48
|
+
if (props.size != null)
|
|
49
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
50
|
+
if (props.autoplay != null)
|
|
51
|
+
attrs['autoplay'] = typeof props.autoplay === 'object' ? JSON.stringify(props.autoplay) : String(props.autoplay);
|
|
52
|
+
if (props.loopMode)
|
|
53
|
+
attrs['loop-mode'] = '';
|
|
54
|
+
if (props.motionBlur)
|
|
55
|
+
attrs['motion-blur'] = '';
|
|
56
|
+
if (props.customCursor)
|
|
57
|
+
attrs['custom-cursor'] = '';
|
|
58
|
+
if (props.indicator != null)
|
|
59
|
+
attrs['indicator'] = typeof props.indicator === 'object' ? JSON.stringify(props.indicator) : String(props.indicator);
|
|
60
|
+
return (_jsx("cx-carousel", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
61
|
+
});
|
|
62
|
+
Carousel.displayName = 'Carousel';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FocusDetail, KeyboardDetail } from './types.js';
|
|
3
|
+
export interface ChatInputRef extends HTMLElement {
|
|
4
|
+
/** Focuses the textarea. */
|
|
5
|
+
focus(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface ChatInputProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
maxRows?: number;
|
|
15
|
+
showActionButton?: boolean;
|
|
16
|
+
actionLabel?: string;
|
|
17
|
+
submitLabel?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
slotted?: boolean;
|
|
20
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
21
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
22
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
23
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
export declare const ChatInput: React.ForwardRefExoticComponent<ChatInputProps & React.RefAttributes<ChatInputRef>>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const ChatInput = 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.value != null) {
|
|
51
|
+
el.setAttribute('value', String(props.value));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
el.removeAttribute('value');
|
|
55
|
+
}
|
|
56
|
+
}, [props.value]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const el = ref.current;
|
|
59
|
+
if (!el)
|
|
60
|
+
return;
|
|
61
|
+
if (props.maxRows != null) {
|
|
62
|
+
el.setAttribute('max-rows', String(props.maxRows));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
el.removeAttribute('max-rows');
|
|
66
|
+
}
|
|
67
|
+
}, [props.maxRows]);
|
|
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.shape != null)
|
|
73
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
74
|
+
if (props.size != null)
|
|
75
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
76
|
+
if (props.placeholder != null)
|
|
77
|
+
attrs['placeholder'] = typeof props.placeholder === 'object' ? JSON.stringify(props.placeholder) : String(props.placeholder);
|
|
78
|
+
if (props.disabled)
|
|
79
|
+
attrs['disabled'] = '';
|
|
80
|
+
if (props.showActionButton)
|
|
81
|
+
attrs['show-action-button'] = '';
|
|
82
|
+
if (props.actionLabel != null)
|
|
83
|
+
attrs['action-label'] = typeof props.actionLabel === 'object' ? JSON.stringify(props.actionLabel) : String(props.actionLabel);
|
|
84
|
+
if (props.submitLabel != null)
|
|
85
|
+
attrs['submit-label'] = typeof props.submitLabel === 'object' ? JSON.stringify(props.submitLabel) : String(props.submitLabel);
|
|
86
|
+
if (props.label != null)
|
|
87
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
88
|
+
if (props.slotted)
|
|
89
|
+
attrs['slotted'] = '';
|
|
90
|
+
return (_jsx("cx-chat-input", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
91
|
+
});
|
|
92
|
+
ChatInput.displayName = 'ChatInput';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js';
|
|
3
|
+
export interface CheckboxRef extends HTMLElement {
|
|
4
|
+
/** Focuses the checkbox input. */
|
|
5
|
+
focus(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckboxProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
shape?: 'sharp' | 'rounded';
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
/** Three-state check. Accepts `true`/`false` as aliases for `'checked'`/unchecked, and keeps `'indeterminate'` for the third state. */
|
|
13
|
+
checked?: boolean | '' | 'checked' | 'indeterminate';
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
helperText?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
unlabeled?: boolean;
|
|
19
|
+
onInput?: (event: CustomEvent<CheckedDetail>) => void;
|
|
20
|
+
onChange?: (event: CustomEvent<CheckedDetail>) => void;
|
|
21
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
22
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
23
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
24
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<CheckboxRef>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Checkbox = 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
|
+
// Build attribute object
|
|
67
|
+
const attrs = {};
|
|
68
|
+
if (props.id != null)
|
|
69
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
70
|
+
if (props.label != null)
|
|
71
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
72
|
+
if (props.shape != null)
|
|
73
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
74
|
+
if (props.size != null)
|
|
75
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
76
|
+
{
|
|
77
|
+
const value = props.checked === true ? 'checked' : props.checked === false ? undefined : props.checked;
|
|
78
|
+
if (value != null)
|
|
79
|
+
attrs['checked'] = value;
|
|
80
|
+
}
|
|
81
|
+
if (props.disabled)
|
|
82
|
+
attrs['disabled'] = '';
|
|
83
|
+
if (props.required)
|
|
84
|
+
attrs['required'] = '';
|
|
85
|
+
if (props.helperText != null)
|
|
86
|
+
attrs['helper-text'] = typeof props.helperText === 'object' ? JSON.stringify(props.helperText) : String(props.helperText);
|
|
87
|
+
if (props.error != null)
|
|
88
|
+
attrs['error'] = typeof props.error === 'object' ? JSON.stringify(props.error) : String(props.error);
|
|
89
|
+
if (props.unlabeled)
|
|
90
|
+
attrs['unlabeled'] = '';
|
|
91
|
+
return (_jsx("cx-checkbox", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
92
|
+
});
|
|
93
|
+
Checkbox.displayName = 'Checkbox';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface CodeBlockProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
content?: string;
|
|
5
|
+
variant?: string;
|
|
6
|
+
shape?: string;
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
|
+
language?: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
lineNumbers?: boolean;
|
|
11
|
+
copyButton?: boolean;
|
|
12
|
+
trafficLights?: boolean;
|
|
13
|
+
slotted?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
export declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const CodeBlock = forwardRef((props, forwardedRef) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6
|
+
// Build attribute object
|
|
7
|
+
const attrs = {};
|
|
8
|
+
if (props.id != null)
|
|
9
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
10
|
+
if (props.content != null)
|
|
11
|
+
attrs['content'] = typeof props.content === 'object' ? JSON.stringify(props.content) : String(props.content);
|
|
12
|
+
if (props.variant != null)
|
|
13
|
+
attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
|
|
14
|
+
if (props.shape != null)
|
|
15
|
+
attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
|
|
16
|
+
if (props.size != null)
|
|
17
|
+
attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
|
|
18
|
+
if (props.language != null)
|
|
19
|
+
attrs['language'] = typeof props.language === 'object' ? JSON.stringify(props.language) : String(props.language);
|
|
20
|
+
if (props.filename != null)
|
|
21
|
+
attrs['filename'] = typeof props.filename === 'object' ? JSON.stringify(props.filename) : String(props.filename);
|
|
22
|
+
if (props.lineNumbers)
|
|
23
|
+
attrs['line-numbers'] = '';
|
|
24
|
+
if (props.copyButton)
|
|
25
|
+
attrs['copy-button'] = '';
|
|
26
|
+
if (props.trafficLights)
|
|
27
|
+
attrs['traffic-lights'] = '';
|
|
28
|
+
if (props.slotted)
|
|
29
|
+
attrs['slotted'] = '';
|
|
30
|
+
return (_jsx("cx-code-block", { ref: ref, ...attrs, className: props.className, style: props.style }));
|
|
31
|
+
});
|
|
32
|
+
CodeBlock.displayName = 'CodeBlock';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CollapsibleDetail } from './types.js';
|
|
3
|
+
export interface CollapsibleRef extends HTMLElement {
|
|
4
|
+
/** Expands the collapsible content. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Collapses the content. */
|
|
7
|
+
close(): void;
|
|
8
|
+
/** Toggles the collapsible state. */
|
|
9
|
+
toggle(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface CollapsibleProps {
|
|
12
|
+
id?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
triggerHtml?: string;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
icon?: string;
|
|
17
|
+
noIcon?: boolean;
|
|
18
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
onChange?: (event: CustomEvent<CollapsibleDetail>) => void;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
trigger?: React.ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
export declare const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<CollapsibleRef>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
export const Collapsible = 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
|
+
// Build attribute object
|
|
17
|
+
const attrs = {};
|
|
18
|
+
if (props.id != null)
|
|
19
|
+
attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
|
|
20
|
+
if (props.label != null)
|
|
21
|
+
attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
|
|
22
|
+
if (props.triggerHtml != null)
|
|
23
|
+
attrs['trigger-html'] = typeof props.triggerHtml === 'object' ? JSON.stringify(props.triggerHtml) : String(props.triggerHtml);
|
|
24
|
+
if (props.open)
|
|
25
|
+
attrs['open'] = '';
|
|
26
|
+
if (props.icon != null)
|
|
27
|
+
attrs['icon'] = typeof props.icon === 'object' ? JSON.stringify(props.icon) : String(props.icon);
|
|
28
|
+
if (props.noIcon)
|
|
29
|
+
attrs['no-icon'] = '';
|
|
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
|
+
return (_jsxs("cx-collapsible", { ref: ref, ...attrs, className: props.className, style: props.style, children: [props.trigger && _jsx("div", { slot: "trigger", style: { display: 'contents' }, children: props.trigger }), props.children] }));
|
|
35
|
+
});
|
|
36
|
+
Collapsible.displayName = 'Collapsible';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FocusDetail, InputDetail, KeyboardDetail } from './types.js';
|
|
3
|
+
export interface DatePickerRef extends HTMLElement {
|
|
4
|
+
/** Opens the calendar panel. */
|
|
5
|
+
open(): void;
|
|
6
|
+
/** Closes the calendar panel. */
|
|
7
|
+
close(): void;
|
|
8
|
+
/** Focuses the trigger button. */
|
|
9
|
+
focus(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface DatePickerProps {
|
|
12
|
+
id?: string;
|
|
13
|
+
label: string;
|
|
14
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
15
|
+
shape?: 'sharp' | 'rounded';
|
|
16
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
17
|
+
selected?: string;
|
|
18
|
+
min?: string;
|
|
19
|
+
max?: string;
|
|
20
|
+
disabledDates?: string[] | string;
|
|
21
|
+
format?: 'iso' | 'us-short' | 'eu-short' | 'eu-dot';
|
|
22
|
+
firstDay?: 'monday' | 'sunday';
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
helperText?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
readonly?: boolean;
|
|
29
|
+
name?: string;
|
|
30
|
+
onInput?: (event: CustomEvent<InputDetail>) => void;
|
|
31
|
+
onChange?: (event: CustomEvent<InputDetail>) => void;
|
|
32
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
33
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
34
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
35
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<DatePickerRef>>;
|