@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.
Files changed (110) hide show
  1. package/README.md +67 -0
  2. package/dist/generated/accordion.d.ts +17 -0
  3. package/dist/generated/accordion.js +56 -0
  4. package/dist/generated/activity-group.d.ts +14 -0
  5. package/dist/generated/activity-group.js +26 -0
  6. package/dist/generated/alert.d.ts +22 -0
  7. package/dist/generated/alert.js +55 -0
  8. package/dist/generated/autocomplete.d.ts +46 -0
  9. package/dist/generated/autocomplete.js +144 -0
  10. package/dist/generated/avatar.d.ts +13 -0
  11. package/dist/generated/avatar.js +24 -0
  12. package/dist/generated/backdrop.d.ts +9 -0
  13. package/dist/generated/backdrop.js +16 -0
  14. package/dist/generated/badge.d.ts +17 -0
  15. package/dist/generated/badge.js +40 -0
  16. package/dist/generated/breadcrumb.d.ts +14 -0
  17. package/dist/generated/breadcrumb.js +41 -0
  18. package/dist/generated/button.d.ts +21 -0
  19. package/dist/generated/button.js +46 -0
  20. package/dist/generated/card.d.ts +20 -0
  21. package/dist/generated/card.js +54 -0
  22. package/dist/generated/carousel.d.ts +28 -0
  23. package/dist/generated/carousel.js +62 -0
  24. package/dist/generated/chat-input.d.ts +27 -0
  25. package/dist/generated/chat-input.js +92 -0
  26. package/dist/generated/checkbox.d.ts +28 -0
  27. package/dist/generated/checkbox.js +93 -0
  28. package/dist/generated/code-block.d.ts +17 -0
  29. package/dist/generated/code-block.js +32 -0
  30. package/dist/generated/collapsible.d.ts +26 -0
  31. package/dist/generated/collapsible.js +36 -0
  32. package/dist/generated/date-picker.d.ts +39 -0
  33. package/dist/generated/date-picker.js +124 -0
  34. package/dist/generated/dialog.d.ts +28 -0
  35. package/dist/generated/dialog.js +59 -0
  36. package/dist/generated/drawer.d.ts +28 -0
  37. package/dist/generated/drawer.js +59 -0
  38. package/dist/generated/fab.d.ts +19 -0
  39. package/dist/generated/fab.js +42 -0
  40. package/dist/generated/file-upload.d.ts +22 -0
  41. package/dist/generated/file-upload.js +59 -0
  42. package/dist/generated/index.d.ts +56 -0
  43. package/dist/generated/index.js +58 -0
  44. package/dist/generated/listbox.d.ts +19 -0
  45. package/dist/generated/listbox.js +93 -0
  46. package/dist/generated/menu.d.ts +26 -0
  47. package/dist/generated/menu.js +86 -0
  48. package/dist/generated/message-bubble.d.ts +18 -0
  49. package/dist/generated/message-bubble.js +41 -0
  50. package/dist/generated/message-group.d.ts +14 -0
  51. package/dist/generated/message-group.js +42 -0
  52. package/dist/generated/message-part.d.ts +20 -0
  53. package/dist/generated/message-part.js +36 -0
  54. package/dist/generated/pagination.d.ts +17 -0
  55. package/dist/generated/pagination.js +59 -0
  56. package/dist/generated/popover.d.ts +27 -0
  57. package/dist/generated/popover.js +65 -0
  58. package/dist/generated/profile-menu.d.ts +23 -0
  59. package/dist/generated/profile-menu.js +56 -0
  60. package/dist/generated/progress.d.ts +14 -0
  61. package/dist/generated/progress.js +33 -0
  62. package/dist/generated/radio-group.d.ts +24 -0
  63. package/dist/generated/radio-group.js +110 -0
  64. package/dist/generated/scrollbar.d.ts +14 -0
  65. package/dist/generated/scrollbar.js +33 -0
  66. package/dist/generated/search-bar.d.ts +33 -0
  67. package/dist/generated/search-bar.js +118 -0
  68. package/dist/generated/select.d.ts +36 -0
  69. package/dist/generated/select.js +136 -0
  70. package/dist/generated/serialize.d.ts +2 -0
  71. package/dist/generated/serialize.js +13 -0
  72. package/dist/generated/sidebar.d.ts +25 -0
  73. package/dist/generated/sidebar.js +55 -0
  74. package/dist/generated/skeleton.d.ts +12 -0
  75. package/dist/generated/skeleton.js +31 -0
  76. package/dist/generated/slider.d.ts +34 -0
  77. package/dist/generated/slider.js +140 -0
  78. package/dist/generated/speed-dial.d.ts +29 -0
  79. package/dist/generated/speed-dial.js +63 -0
  80. package/dist/generated/spinner.d.ts +10 -0
  81. package/dist/generated/spinner.js +18 -0
  82. package/dist/generated/split-button.d.ts +27 -0
  83. package/dist/generated/split-button.js +63 -0
  84. package/dist/generated/stepper.d.ts +17 -0
  85. package/dist/generated/stepper.js +56 -0
  86. package/dist/generated/switch.d.ts +29 -0
  87. package/dist/generated/switch.js +92 -0
  88. package/dist/generated/table.d.ts +31 -0
  89. package/dist/generated/table.js +187 -0
  90. package/dist/generated/tabs.d.ts +20 -0
  91. package/dist/generated/tabs.js +54 -0
  92. package/dist/generated/text-input.d.ts +48 -0
  93. package/dist/generated/text-input.js +165 -0
  94. package/dist/generated/text.d.ts +21 -0
  95. package/dist/generated/text.js +74 -0
  96. package/dist/generated/thinking.d.ts +12 -0
  97. package/dist/generated/thinking.js +22 -0
  98. package/dist/generated/toast.d.ts +24 -0
  99. package/dist/generated/toast.js +60 -0
  100. package/dist/generated/toggle-group.d.ts +21 -0
  101. package/dist/generated/toggle-group.js +70 -0
  102. package/dist/generated/tooltip.d.ts +18 -0
  103. package/dist/generated/tooltip.js +42 -0
  104. package/dist/generated/types.d.ts +300 -0
  105. package/dist/generated/types.js +6 -0
  106. package/dist/generated/use-markdown-stream.d.ts +45 -0
  107. package/dist/generated/use-markdown-stream.js +48 -0
  108. package/dist/generated/use-markdown.d.ts +20 -0
  109. package/dist/generated/use-markdown.js +49 -0
  110. package/package.json +38 -0
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const Skeleton = 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.lines != null) {
11
+ el.setAttribute('lines', String(props.lines));
12
+ }
13
+ else {
14
+ el.removeAttribute('lines');
15
+ }
16
+ }, [props.lines]);
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.animation != null)
24
+ attrs['animation'] = typeof props.animation === 'object' ? JSON.stringify(props.animation) : String(props.animation);
25
+ if (props.label != null)
26
+ attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
27
+ if (props.size != null)
28
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
29
+ return (_jsx("cx-skeleton", { ref: ref, ...attrs, className: props.className, style: props.style }));
30
+ });
31
+ Skeleton.displayName = 'Skeleton';
@@ -0,0 +1,34 @@
1
+ import type React from 'react';
2
+ import type { FocusDetail, KeyboardDetail, SliderDetail } from './types.js';
3
+ export interface SliderRef extends HTMLElement {
4
+ /** Focuses the range input. */
5
+ focus(): void;
6
+ }
7
+ export interface SliderProps {
8
+ id?: string;
9
+ label?: string;
10
+ ariaLabel?: string;
11
+ value?: number;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ orientation?: 'horizontal' | 'vertical';
16
+ shape?: 'sharp' | 'rounded' | 'pill';
17
+ intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
18
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
+ showValue?: boolean;
20
+ valueText?: string;
21
+ helperText?: string;
22
+ errorText?: string;
23
+ disabled?: boolean;
24
+ unlabeled?: boolean;
25
+ onInput?: (event: CustomEvent<SliderDetail>) => void;
26
+ onChange?: (event: CustomEvent) => void;
27
+ onFocus?: (event: CustomEvent<FocusDetail>) => void;
28
+ onBlur?: (event: CustomEvent<FocusDetail>) => void;
29
+ onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
30
+ onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
31
+ className?: string;
32
+ style?: React.CSSProperties;
33
+ }
34
+ export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<SliderRef>>;
@@ -0,0 +1,140 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const Slider = 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.value != null) {
71
+ el.setAttribute('value', String(props.value));
72
+ }
73
+ else {
74
+ el.removeAttribute('value');
75
+ }
76
+ }, [props.value]);
77
+ useEffect(() => {
78
+ const el = ref.current;
79
+ if (!el)
80
+ return;
81
+ if (props.min != null) {
82
+ el.setAttribute('min', String(props.min));
83
+ }
84
+ else {
85
+ el.removeAttribute('min');
86
+ }
87
+ }, [props.min]);
88
+ useEffect(() => {
89
+ const el = ref.current;
90
+ if (!el)
91
+ return;
92
+ if (props.max != null) {
93
+ el.setAttribute('max', String(props.max));
94
+ }
95
+ else {
96
+ el.removeAttribute('max');
97
+ }
98
+ }, [props.max]);
99
+ useEffect(() => {
100
+ const el = ref.current;
101
+ if (!el)
102
+ return;
103
+ if (props.step != null) {
104
+ el.setAttribute('step', String(props.step));
105
+ }
106
+ else {
107
+ el.removeAttribute('step');
108
+ }
109
+ }, [props.step]);
110
+ // Build attribute object
111
+ const attrs = {};
112
+ if (props.id != null)
113
+ attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
114
+ if (props.label != null)
115
+ attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
116
+ if (props.ariaLabel != null)
117
+ attrs['aria-label'] = typeof props.ariaLabel === 'object' ? JSON.stringify(props.ariaLabel) : String(props.ariaLabel);
118
+ if (props.orientation != null)
119
+ attrs['orientation'] = typeof props.orientation === 'object' ? JSON.stringify(props.orientation) : String(props.orientation);
120
+ if (props.shape != null)
121
+ attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
122
+ if (props.intent != null)
123
+ attrs['intent'] = typeof props.intent === 'object' ? JSON.stringify(props.intent) : String(props.intent);
124
+ if (props.size != null)
125
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
126
+ if (props.showValue)
127
+ attrs['show-value'] = '';
128
+ if (props.valueText != null)
129
+ attrs['value-text'] = typeof props.valueText === 'object' ? JSON.stringify(props.valueText) : String(props.valueText);
130
+ if (props.helperText != null)
131
+ attrs['helper-text'] = typeof props.helperText === 'object' ? JSON.stringify(props.helperText) : String(props.helperText);
132
+ if (props.errorText != null)
133
+ attrs['error-text'] = typeof props.errorText === 'object' ? JSON.stringify(props.errorText) : String(props.errorText);
134
+ if (props.disabled)
135
+ attrs['disabled'] = '';
136
+ if (props.unlabeled)
137
+ attrs['unlabeled'] = '';
138
+ return (_jsx("cx-slider", { ref: ref, ...attrs, className: props.className, style: props.style }));
139
+ });
140
+ Slider.displayName = 'Slider';
@@ -0,0 +1,29 @@
1
+ import type React from 'react';
2
+ import type { CollapsibleDetail, MenuActionDetail, SpeedDialAction } from './types.js';
3
+ export interface SpeedDialRef extends HTMLElement {
4
+ /** Opens the speed dial action menu. */
5
+ open(): void;
6
+ /** Closes the speed dial action menu. */
7
+ close(): void;
8
+ /** Toggles the speed dial action menu. */
9
+ toggle(): void;
10
+ }
11
+ export interface SpeedDialProps {
12
+ id: string;
13
+ icon: string;
14
+ ariaLabel?: string;
15
+ closeIcon?: string;
16
+ actions?: SpeedDialAction[] | string;
17
+ variant?: 'filled' | 'outline' | 'ghost';
18
+ shape?: 'rounded' | 'pill';
19
+ size?: 'sm' | 'md' | 'lg';
20
+ direction?: 'up' | 'down' | 'left' | 'right';
21
+ backdrop?: boolean;
22
+ tooltips?: boolean;
23
+ disabled?: boolean;
24
+ onAction?: (event: CustomEvent<MenuActionDetail>) => void;
25
+ onChange?: (event: CustomEvent<CollapsibleDetail>) => void;
26
+ className?: string;
27
+ style?: React.CSSProperties;
28
+ }
29
+ export declare const SpeedDial: React.ForwardRefExoticComponent<SpeedDialProps & React.RefAttributes<SpeedDialRef>>;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const SpeedDial = 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
+ useEffect(() => {
11
+ const el = ref.current;
12
+ if (!el)
13
+ return;
14
+ const handler = (e) => onActionRef.current?.(e);
15
+ el.addEventListener('cx-action', handler);
16
+ return () => el.removeEventListener('cx-action', handler);
17
+ }, []);
18
+ useEffect(() => {
19
+ const el = ref.current;
20
+ if (!el)
21
+ return;
22
+ const handler = (e) => onChangeRef.current?.(e);
23
+ el.addEventListener('cx-change', handler);
24
+ return () => el.removeEventListener('cx-change', handler);
25
+ }, []);
26
+ useEffect(() => {
27
+ const el = ref.current;
28
+ if (!el)
29
+ return;
30
+ if (props.actions != null) {
31
+ el.setAttribute('actions', typeof props.actions === 'object' ? JSON.stringify(props.actions) : String(props.actions));
32
+ }
33
+ else {
34
+ el.removeAttribute('actions');
35
+ }
36
+ }, [props.actions]);
37
+ // Build attribute object
38
+ const attrs = {};
39
+ if (props.id != null)
40
+ attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
41
+ if (props.icon != null)
42
+ attrs['icon'] = typeof props.icon === 'object' ? JSON.stringify(props.icon) : String(props.icon);
43
+ if (props.ariaLabel != null)
44
+ attrs['aria-label'] = typeof props.ariaLabel === 'object' ? JSON.stringify(props.ariaLabel) : String(props.ariaLabel);
45
+ if (props.closeIcon != null)
46
+ attrs['close-icon'] = typeof props.closeIcon === 'object' ? JSON.stringify(props.closeIcon) : String(props.closeIcon);
47
+ if (props.variant != null)
48
+ attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
49
+ if (props.shape != null)
50
+ attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
51
+ if (props.size != null)
52
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
53
+ if (props.direction != null)
54
+ attrs['direction'] = typeof props.direction === 'object' ? JSON.stringify(props.direction) : String(props.direction);
55
+ if (props.backdrop)
56
+ attrs['backdrop'] = '';
57
+ if (props.tooltips)
58
+ attrs['tooltips'] = '';
59
+ if (props.disabled)
60
+ attrs['disabled'] = '';
61
+ return (_jsx("cx-speed-dial", { ref: ref, ...attrs, className: props.className, style: props.style }));
62
+ });
63
+ SpeedDial.displayName = 'SpeedDial';
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+ export interface SpinnerProps {
3
+ id?: string;
4
+ variant?: 'circle' | 'square';
5
+ label?: string;
6
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ }
10
+ export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useImperativeHandle, useRef } from 'react';
3
+ export const Spinner = 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.variant != null)
11
+ attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
12
+ if (props.label != null)
13
+ attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
14
+ if (props.size != null)
15
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
16
+ return (_jsx("cx-spinner", { ref: ref, ...attrs, className: props.className, style: props.style }));
17
+ });
18
+ Spinner.displayName = 'Spinner';
@@ -0,0 +1,27 @@
1
+ import type React from 'react';
2
+ import type { ClickDetail, MenuActionDetail, SplitMenuEntry } from './types.js';
3
+ export interface SplitButtonRef extends HTMLElement {
4
+ /** Opens the dropdown menu. */
5
+ open(): void;
6
+ /** Closes the dropdown menu. */
7
+ close(): void;
8
+ }
9
+ export interface SplitButtonProps {
10
+ id: string;
11
+ label: string;
12
+ entries?: SplitMenuEntry[] | string;
13
+ variant?: 'filled' | 'outline' | 'ghost';
14
+ intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
15
+ shape?: 'sharp' | 'rounded' | 'pill';
16
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
17
+ iconLeading?: string;
18
+ disabled?: boolean;
19
+ primaryDisabled?: boolean;
20
+ triggerDisabled?: boolean;
21
+ triggerLabel?: string;
22
+ onClick?: (event: CustomEvent<ClickDetail>) => void;
23
+ onAction?: (event: CustomEvent<MenuActionDetail>) => void;
24
+ className?: string;
25
+ style?: React.CSSProperties;
26
+ }
27
+ export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<SplitButtonRef>>;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const SplitButton = 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 onActionRef = useRef(props.onAction);
9
+ onActionRef.current = props.onAction;
10
+ useEffect(() => {
11
+ const el = ref.current;
12
+ if (!el)
13
+ return;
14
+ const handler = (e) => onClickRef.current?.(e);
15
+ el.addEventListener('cx-click', handler);
16
+ return () => el.removeEventListener('cx-click', handler);
17
+ }, []);
18
+ useEffect(() => {
19
+ const el = ref.current;
20
+ if (!el)
21
+ return;
22
+ const handler = (e) => onActionRef.current?.(e);
23
+ el.addEventListener('cx-action', handler);
24
+ return () => el.removeEventListener('cx-action', handler);
25
+ }, []);
26
+ useEffect(() => {
27
+ const el = ref.current;
28
+ if (!el)
29
+ return;
30
+ if (props.entries != null) {
31
+ el.setAttribute('entries', typeof props.entries === 'object' ? JSON.stringify(props.entries) : String(props.entries));
32
+ }
33
+ else {
34
+ el.removeAttribute('entries');
35
+ }
36
+ }, [props.entries]);
37
+ // Build attribute object
38
+ const attrs = {};
39
+ if (props.id != null)
40
+ attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
41
+ if (props.label != null)
42
+ attrs['label'] = typeof props.label === 'object' ? JSON.stringify(props.label) : String(props.label);
43
+ if (props.variant != null)
44
+ attrs['variant'] = typeof props.variant === 'object' ? JSON.stringify(props.variant) : String(props.variant);
45
+ if (props.intent != null)
46
+ attrs['intent'] = typeof props.intent === 'object' ? JSON.stringify(props.intent) : String(props.intent);
47
+ if (props.shape != null)
48
+ attrs['shape'] = typeof props.shape === 'object' ? JSON.stringify(props.shape) : String(props.shape);
49
+ if (props.size != null)
50
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
51
+ if (props.iconLeading != null)
52
+ attrs['icon-leading'] = typeof props.iconLeading === 'object' ? JSON.stringify(props.iconLeading) : String(props.iconLeading);
53
+ if (props.disabled)
54
+ attrs['disabled'] = '';
55
+ if (props.primaryDisabled)
56
+ attrs['primary-disabled'] = '';
57
+ if (props.triggerDisabled)
58
+ attrs['trigger-disabled'] = '';
59
+ if (props.triggerLabel != null)
60
+ attrs['trigger-label'] = typeof props.triggerLabel === 'object' ? JSON.stringify(props.triggerLabel) : String(props.triggerLabel);
61
+ return (_jsx("cx-split-button", { ref: ref, ...attrs, className: props.className, style: props.style }));
62
+ });
63
+ SplitButton.displayName = 'SplitButton';
@@ -0,0 +1,17 @@
1
+ import type React from 'react';
2
+ import type { SelectDetail, StepperStep } from './types.js';
3
+ export interface StepperProps {
4
+ id?: string;
5
+ label?: string;
6
+ steps?: StepperStep[] | string;
7
+ current?: number;
8
+ variant?: 'outline' | 'filled' | 'ghost';
9
+ shape?: 'sharp' | 'rounded';
10
+ orientation?: 'horizontal' | 'vertical';
11
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
+ linear?: boolean;
13
+ onChange?: (event: CustomEvent<SelectDetail>) => void;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ }
17
+ export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const Stepper = 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.current != null) {
21
+ el.setAttribute('current', String(props.current));
22
+ }
23
+ else {
24
+ el.removeAttribute('current');
25
+ }
26
+ }, [props.current]);
27
+ useEffect(() => {
28
+ const el = ref.current;
29
+ if (!el)
30
+ return;
31
+ if (props.steps != null) {
32
+ el.setAttribute('steps', typeof props.steps === 'object' ? JSON.stringify(props.steps) : String(props.steps));
33
+ }
34
+ else {
35
+ el.removeAttribute('steps');
36
+ }
37
+ }, [props.steps]);
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.orientation != null)
49
+ attrs['orientation'] = typeof props.orientation === 'object' ? JSON.stringify(props.orientation) : String(props.orientation);
50
+ if (props.size != null)
51
+ attrs['size'] = typeof props.size === 'object' ? JSON.stringify(props.size) : String(props.size);
52
+ if (props.linear)
53
+ attrs['linear'] = '';
54
+ return (_jsx("cx-stepper", { ref: ref, ...attrs, className: props.className, style: props.style }));
55
+ });
56
+ Stepper.displayName = 'Stepper';
@@ -0,0 +1,29 @@
1
+ import type React from 'react';
2
+ import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js';
3
+ export interface SwitchRef extends HTMLElement {
4
+ /** Focuses the switch input. */
5
+ focus(): void;
6
+ }
7
+ export interface SwitchProps {
8
+ id?: string;
9
+ label?: string;
10
+ shape?: 'sharp' | 'rounded' | 'pill';
11
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
+ /** Boolean checked state (unlike Checkbox, which uses a string). */
13
+ checked?: boolean;
14
+ disabled?: boolean;
15
+ required?: boolean;
16
+ helperText?: string;
17
+ error?: string;
18
+ description?: string;
19
+ unlabeled?: boolean;
20
+ onInput?: (event: CustomEvent<CheckedDetail>) => void;
21
+ onChange?: (event: CustomEvent<CheckedDetail>) => void;
22
+ onFocus?: (event: CustomEvent<FocusDetail>) => void;
23
+ onBlur?: (event: CustomEvent<FocusDetail>) => void;
24
+ onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
25
+ onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
26
+ className?: string;
27
+ style?: React.CSSProperties;
28
+ }
29
+ export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<SwitchRef>>;
@@ -0,0 +1,92 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
+ export const Switch = 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
+ if (props.checked)
77
+ attrs['checked'] = '';
78
+ if (props.disabled)
79
+ attrs['disabled'] = '';
80
+ if (props.required)
81
+ attrs['required'] = '';
82
+ if (props.helperText != null)
83
+ attrs['helper-text'] = typeof props.helperText === 'object' ? JSON.stringify(props.helperText) : String(props.helperText);
84
+ if (props.error != null)
85
+ attrs['error'] = typeof props.error === 'object' ? JSON.stringify(props.error) : String(props.error);
86
+ if (props.description != null)
87
+ attrs['description'] = typeof props.description === 'object' ? JSON.stringify(props.description) : String(props.description);
88
+ if (props.unlabeled)
89
+ attrs['unlabeled'] = '';
90
+ return (_jsx("cx-switch", { ref: ref, ...attrs, className: props.className, style: props.style }));
91
+ });
92
+ Switch.displayName = 'Switch';
@@ -0,0 +1,31 @@
1
+ import type React from 'react';
2
+ import type { EmptyStateConfig, FooterRow, KeyboardDetail, PageDetail, PaginationConfig, SortDetail, SortState, TableColumn, TableExpandDetail, TableRow, TableSelectDetail } from './types.js';
3
+ export interface TableProps {
4
+ id?: string;
5
+ caption: string;
6
+ columns?: TableColumn[] | string;
7
+ rows?: TableRow[] | string;
8
+ variant?: 'plain' | 'striped' | 'bordered';
9
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
10
+ selectable?: string;
11
+ selected?: string[] | string;
12
+ sorts?: SortState[] | string;
13
+ pagination?: PaginationConfig | string;
14
+ hoverable?: boolean;
15
+ stickyHeader?: boolean;
16
+ footer?: FooterRow[] | string;
17
+ emptyState?: EmptyStateConfig | string;
18
+ columnOrder?: string[] | string;
19
+ disabled?: boolean;
20
+ loading?: number;
21
+ error?: string;
22
+ onSort?: (event: CustomEvent<SortDetail>) => void;
23
+ onSelect?: (event: CustomEvent<TableSelectDetail>) => void;
24
+ onExpand?: (event: CustomEvent<TableExpandDetail>) => void;
25
+ onPage?: (event: CustomEvent<PageDetail>) => void;
26
+ onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
27
+ onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
28
+ className?: string;
29
+ style?: React.CSSProperties;
30
+ }
31
+ export declare const Table: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<HTMLElement>>;