@colletdev/svelte 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 +58 -0
- package/package.json +33 -0
- package/src/accordion.svelte +52 -0
- package/src/accordion.svelte.d.ts +19 -0
- package/src/activity-group.svelte +34 -0
- package/src/activity-group.svelte.d.ts +16 -0
- package/src/alert.svelte +61 -0
- package/src/alert.svelte.d.ts +24 -0
- package/src/autocomplete.svelte +126 -0
- package/src/autocomplete.svelte.d.ts +47 -0
- package/src/avatar.svelte +32 -0
- package/src/avatar.svelte.d.ts +15 -0
- package/src/backdrop.svelte +24 -0
- package/src/backdrop.svelte.d.ts +11 -0
- package/src/badge.svelte +45 -0
- package/src/badge.svelte.d.ts +19 -0
- package/src/breadcrumb.svelte +42 -0
- package/src/breadcrumb.svelte.d.ts +16 -0
- package/src/button.svelte +52 -0
- package/src/button.svelte.d.ts +23 -0
- package/src/card.svelte +67 -0
- package/src/card.svelte.d.ts +22 -0
- package/src/carousel.svelte +59 -0
- package/src/carousel.svelte.d.ts +29 -0
- package/src/chat-input.svelte +76 -0
- package/src/chat-input.svelte.d.ts +28 -0
- package/src/checkbox.svelte +83 -0
- package/src/checkbox.svelte.d.ts +29 -0
- package/src/code-block.svelte +40 -0
- package/src/code-block.svelte.d.ts +19 -0
- package/src/collapsible.svelte +56 -0
- package/src/collapsible.svelte.d.ts +27 -0
- package/src/date-picker.svelte +110 -0
- package/src/date-picker.svelte.d.ts +40 -0
- package/src/dialog.svelte +56 -0
- package/src/dialog.svelte.d.ts +24 -0
- package/src/drawer.svelte +56 -0
- package/src/drawer.svelte.d.ts +24 -0
- package/src/elements.d.ts +715 -0
- package/src/fab.svelte +48 -0
- package/src/fab.svelte.d.ts +21 -0
- package/src/file-upload.svelte +55 -0
- package/src/file-upload.svelte.d.ts +24 -0
- package/src/index.ts +85 -0
- package/src/label.svelte +29 -0
- package/src/label.svelte.d.ts +20 -0
- package/src/listbox.svelte +75 -0
- package/src/listbox.svelte.d.ts +21 -0
- package/src/menu.svelte +76 -0
- package/src/menu.svelte.d.ts +27 -0
- package/src/message-bubble.svelte +49 -0
- package/src/message-bubble.svelte.d.ts +20 -0
- package/src/message-group.svelte +41 -0
- package/src/message-group.svelte.d.ts +16 -0
- package/src/message-part.svelte +20 -0
- package/src/message-part.svelte.d.ts +9 -0
- package/src/pagination.svelte +40 -0
- package/src/pagination.svelte.d.ts +19 -0
- package/src/popover.svelte +66 -0
- package/src/popover.svelte.d.ts +28 -0
- package/src/profile-menu.svelte +55 -0
- package/src/profile-menu.svelte.d.ts +24 -0
- package/src/progress.svelte +33 -0
- package/src/progress.svelte.d.ts +16 -0
- package/src/radio-group.svelte +91 -0
- package/src/radio-group.svelte.d.ts +26 -0
- package/src/scrollbar.svelte +41 -0
- package/src/scrollbar.svelte.d.ts +16 -0
- package/src/search-bar.svelte +94 -0
- package/src/search-bar.svelte.d.ts +34 -0
- package/src/select.svelte +112 -0
- package/src/select.svelte.d.ts +37 -0
- package/src/separator.svelte +25 -0
- package/src/separator.svelte.d.ts +18 -0
- package/src/sidebar.svelte +65 -0
- package/src/sidebar.svelte.d.ts +26 -0
- package/src/skeleton.svelte +30 -0
- package/src/skeleton.svelte.d.ts +14 -0
- package/src/slider.svelte +100 -0
- package/src/slider.svelte.d.ts +35 -0
- package/src/speed-dial.svelte +66 -0
- package/src/speed-dial.svelte.d.ts +30 -0
- package/src/spinner.svelte +26 -0
- package/src/spinner.svelte.d.ts +12 -0
- package/src/split-button.svelte +64 -0
- package/src/split-button.svelte.d.ts +28 -0
- package/src/stepper.svelte +48 -0
- package/src/stepper.svelte.d.ts +19 -0
- package/src/switch.svelte +85 -0
- package/src/switch.svelte.d.ts +30 -0
- package/src/table.svelte +133 -0
- package/src/table.svelte.d.ts +33 -0
- package/src/tabs.svelte +51 -0
- package/src/tabs.svelte.d.ts +21 -0
- package/src/text-input.svelte +126 -0
- package/src/text-input.svelte.d.ts +49 -0
- package/src/text.svelte +63 -0
- package/src/text.svelte.d.ts +23 -0
- package/src/thinking.svelte +30 -0
- package/src/thinking.svelte.d.ts +14 -0
- package/src/toast.svelte +58 -0
- package/src/toast.svelte.d.ts +25 -0
- package/src/toggle-group.svelte +64 -0
- package/src/toggle-group.svelte.d.ts +23 -0
- package/src/tooltip.svelte +38 -0
- package/src/tooltip.svelte.d.ts +17 -0
- package/src/types.ts +334 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { ClickDetail, MenuActionDetail, SplitMenuEntry } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface SplitButtonProps {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
entries?: SplitMenuEntry[] | string;
|
|
9
|
+
variant?: 'filled' | 'outline' | 'ghost';
|
|
10
|
+
intent?: 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
11
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
iconLeading?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
primaryDisabled?: boolean;
|
|
16
|
+
triggerDisabled?: boolean;
|
|
17
|
+
triggerLabel?: string;
|
|
18
|
+
onClick?: (event: CustomEvent<ClickDetail>) => void;
|
|
19
|
+
onAction?: (event: CustomEvent<MenuActionDetail>) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare const SplitButton: Component<SplitButtonProps, {
|
|
23
|
+
/** Opens the dropdown menu. */
|
|
24
|
+
open(): void;
|
|
25
|
+
/** Closes the dropdown menu. */
|
|
26
|
+
close(): void;
|
|
27
|
+
}>;
|
|
28
|
+
export default SplitButton;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!-- Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT -->
|
|
2
|
+
<!-- Svelte 5 wrapper for <cx-stepper> -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type { SelectDetail, StepperStep } from './types.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
steps?: StepperStep[] | string;
|
|
10
|
+
current?: number;
|
|
11
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
12
|
+
shape?: 'sharp' | 'rounded';
|
|
13
|
+
orientation?: 'horizontal' | 'vertical';
|
|
14
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
linear?: boolean;
|
|
16
|
+
onChange?: (event: CustomEvent<SelectDetail>) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { id, label, steps, current, variant, shape, orientation, size, linear, onChange }: Props = $props();
|
|
20
|
+
|
|
21
|
+
let el: HTMLElement;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
if (!el) return;
|
|
26
|
+
if (steps != null) el.setAttribute('steps', typeof steps === 'object' ? JSON.stringify(steps) : String(steps));
|
|
27
|
+
else el.removeAttribute('steps');
|
|
28
|
+
});
|
|
29
|
+
$effect(() => {
|
|
30
|
+
if (!el) return;
|
|
31
|
+
const handler = (e: Event) => onChange?.(e as CustomEvent);
|
|
32
|
+
el.addEventListener('cx-change', handler);
|
|
33
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<cx-stepper
|
|
39
|
+
bind:this={el}
|
|
40
|
+
id={typeof id === 'object' && id != null ? JSON.stringify(id) : id}
|
|
41
|
+
label={typeof label === 'object' && label != null ? JSON.stringify(label) : label}
|
|
42
|
+
current={typeof current === 'object' && current != null ? JSON.stringify(current) : current}
|
|
43
|
+
variant={typeof variant === 'object' && variant != null ? JSON.stringify(variant) : variant}
|
|
44
|
+
shape={typeof shape === 'object' && shape != null ? JSON.stringify(shape) : shape}
|
|
45
|
+
orientation={typeof orientation === 'object' && orientation != null ? JSON.stringify(orientation) : orientation}
|
|
46
|
+
size={typeof size === 'object' && size != null ? JSON.stringify(size) : size}
|
|
47
|
+
linear={linear || undefined}
|
|
48
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { SelectDetail, StepperStep } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface StepperProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
steps?: StepperStep[] | string;
|
|
9
|
+
current?: number;
|
|
10
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
11
|
+
shape?: 'sharp' | 'rounded';
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
+
linear?: boolean;
|
|
15
|
+
onChange?: (event: CustomEvent<SelectDetail>) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const Stepper: Component<StepperProps, {}>;
|
|
19
|
+
export default Stepper;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!-- Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT -->
|
|
2
|
+
<!-- Svelte 5 wrapper for <cx-switch> -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
/** Boolean checked state (unlike Checkbox, which uses a string). */
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
helperText?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
description?: 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
|
+
}
|
|
26
|
+
|
|
27
|
+
let { id, label, shape, size, checked, disabled, required, helperText, error, description, unlabeled, onInput, onChange, onFocus, onBlur, onKeydown, onKeyup }: Props = $props();
|
|
28
|
+
|
|
29
|
+
let el: HTMLElement;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
$effect(() => {
|
|
33
|
+
if (!el) return;
|
|
34
|
+
const handler = (e: Event) => onInput?.(e as CustomEvent);
|
|
35
|
+
el.addEventListener('cx-input', handler);
|
|
36
|
+
return () => el.removeEventListener('cx-input', handler);
|
|
37
|
+
});
|
|
38
|
+
$effect(() => {
|
|
39
|
+
if (!el) return;
|
|
40
|
+
const handler = (e: Event) => onChange?.(e as CustomEvent);
|
|
41
|
+
el.addEventListener('cx-change', handler);
|
|
42
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
43
|
+
});
|
|
44
|
+
$effect(() => {
|
|
45
|
+
if (!el) return;
|
|
46
|
+
const handler = (e: Event) => onFocus?.(e as CustomEvent);
|
|
47
|
+
el.addEventListener('cx-focus', handler);
|
|
48
|
+
return () => el.removeEventListener('cx-focus', handler);
|
|
49
|
+
});
|
|
50
|
+
$effect(() => {
|
|
51
|
+
if (!el) return;
|
|
52
|
+
const handler = (e: Event) => onBlur?.(e as CustomEvent);
|
|
53
|
+
el.addEventListener('cx-blur', handler);
|
|
54
|
+
return () => el.removeEventListener('cx-blur', handler);
|
|
55
|
+
});
|
|
56
|
+
$effect(() => {
|
|
57
|
+
if (!el) return;
|
|
58
|
+
const handler = (e: Event) => onKeydown?.(e as CustomEvent);
|
|
59
|
+
el.addEventListener('cx-keydown', handler);
|
|
60
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
61
|
+
});
|
|
62
|
+
$effect(() => {
|
|
63
|
+
if (!el) return;
|
|
64
|
+
const handler = (e: Event) => onKeyup?.(e as CustomEvent);
|
|
65
|
+
el.addEventListener('cx-keyup', handler);
|
|
66
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
67
|
+
});
|
|
68
|
+
/** Focuses the switch input. */
|
|
69
|
+
export function focus() { (el as any)?.focus(); }
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<cx-switch
|
|
73
|
+
bind:this={el}
|
|
74
|
+
id={typeof id === 'object' && id != null ? JSON.stringify(id) : id}
|
|
75
|
+
label={typeof label === 'object' && label != null ? JSON.stringify(label) : label}
|
|
76
|
+
shape={typeof shape === 'object' && shape != null ? JSON.stringify(shape) : shape}
|
|
77
|
+
size={typeof size === 'object' && size != null ? JSON.stringify(size) : size}
|
|
78
|
+
checked={checked || undefined}
|
|
79
|
+
disabled={disabled || undefined}
|
|
80
|
+
required={required || undefined}
|
|
81
|
+
helper-text={typeof helperText === 'object' && helperText != null ? JSON.stringify(helperText) : helperText}
|
|
82
|
+
error={typeof error === 'object' && error != null ? JSON.stringify(error) : error}
|
|
83
|
+
description={typeof description === 'object' && description != null ? JSON.stringify(description) : description}
|
|
84
|
+
unlabeled={unlabeled || undefined}
|
|
85
|
+
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface SwitchProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
9
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
/** Boolean checked state (unlike Checkbox, which uses a string). */
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
unlabeled?: boolean;
|
|
18
|
+
onInput?: (event: CustomEvent<CheckedDetail>) => void;
|
|
19
|
+
onChange?: (event: CustomEvent<CheckedDetail>) => void;
|
|
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
|
+
}
|
|
25
|
+
|
|
26
|
+
declare const Switch: Component<SwitchProps, {
|
|
27
|
+
/** Focuses the switch input. */
|
|
28
|
+
focus(): void;
|
|
29
|
+
}>;
|
|
30
|
+
export default Switch;
|
package/src/table.svelte
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!-- Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT -->
|
|
2
|
+
<!-- Svelte 5 wrapper for <cx-table> -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type { EmptyStateConfig, FooterRow, KeyboardDetail, PageDetail, PaginationConfig, SortDetail, SortState, TableColumn, TableExpandDetail, TableRow, TableSelectDetail } from './types.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
id?: string;
|
|
8
|
+
caption: string;
|
|
9
|
+
columns?: TableColumn[] | string;
|
|
10
|
+
rows?: TableRow[] | string;
|
|
11
|
+
variant?: 'plain' | 'striped' | 'bordered';
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
selectable?: string;
|
|
14
|
+
selected?: string[] | string;
|
|
15
|
+
sorts?: SortState[] | string;
|
|
16
|
+
pagination?: PaginationConfig | string;
|
|
17
|
+
hoverable?: boolean;
|
|
18
|
+
stickyHeader?: boolean;
|
|
19
|
+
footer?: FooterRow[] | string;
|
|
20
|
+
emptyState?: EmptyStateConfig | string;
|
|
21
|
+
columnOrder?: string[] | string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
loading?: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
onSort?: (event: CustomEvent<SortDetail>) => void;
|
|
26
|
+
onSelect?: (event: CustomEvent<TableSelectDetail>) => void;
|
|
27
|
+
onExpand?: (event: CustomEvent<TableExpandDetail>) => void;
|
|
28
|
+
onPage?: (event: CustomEvent<PageDetail>) => void;
|
|
29
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
30
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let { id, caption, columns, rows, variant, size, selectable, selected, sorts, pagination, hoverable, stickyHeader, footer, emptyState, columnOrder, disabled, loading, error, onSort, onSelect, onExpand, onPage, onKeydown, onKeyup }: Props = $props();
|
|
34
|
+
|
|
35
|
+
let el: HTMLElement;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
$effect(() => {
|
|
39
|
+
if (!el) return;
|
|
40
|
+
if (loading != null) el.setAttribute('loading', String(loading));
|
|
41
|
+
else el.removeAttribute('loading');
|
|
42
|
+
});
|
|
43
|
+
$effect(() => {
|
|
44
|
+
if (!el) return;
|
|
45
|
+
if (columns != null) el.setAttribute('columns', typeof columns === 'object' ? JSON.stringify(columns) : String(columns));
|
|
46
|
+
else el.removeAttribute('columns');
|
|
47
|
+
});
|
|
48
|
+
$effect(() => {
|
|
49
|
+
if (!el) return;
|
|
50
|
+
if (rows != null) el.setAttribute('rows', typeof rows === 'object' ? JSON.stringify(rows) : String(rows));
|
|
51
|
+
else el.removeAttribute('rows');
|
|
52
|
+
});
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (!el) return;
|
|
55
|
+
if (selected != null) el.setAttribute('selected', typeof selected === 'object' ? JSON.stringify(selected) : String(selected));
|
|
56
|
+
else el.removeAttribute('selected');
|
|
57
|
+
});
|
|
58
|
+
$effect(() => {
|
|
59
|
+
if (!el) return;
|
|
60
|
+
if (sorts != null) el.setAttribute('sorts', typeof sorts === 'object' ? JSON.stringify(sorts) : String(sorts));
|
|
61
|
+
else el.removeAttribute('sorts');
|
|
62
|
+
});
|
|
63
|
+
$effect(() => {
|
|
64
|
+
if (!el) return;
|
|
65
|
+
if (pagination != null) el.setAttribute('pagination', typeof pagination === 'object' ? JSON.stringify(pagination) : String(pagination));
|
|
66
|
+
else el.removeAttribute('pagination');
|
|
67
|
+
});
|
|
68
|
+
$effect(() => {
|
|
69
|
+
if (!el) return;
|
|
70
|
+
if (footer != null) el.setAttribute('footer', typeof footer === 'object' ? JSON.stringify(footer) : String(footer));
|
|
71
|
+
else el.removeAttribute('footer');
|
|
72
|
+
});
|
|
73
|
+
$effect(() => {
|
|
74
|
+
if (!el) return;
|
|
75
|
+
if (emptyState != null) el.setAttribute('empty-state', typeof emptyState === 'object' ? JSON.stringify(emptyState) : String(emptyState));
|
|
76
|
+
else el.removeAttribute('empty-state');
|
|
77
|
+
});
|
|
78
|
+
$effect(() => {
|
|
79
|
+
if (!el) return;
|
|
80
|
+
if (columnOrder != null) el.setAttribute('column-order', typeof columnOrder === 'object' ? JSON.stringify(columnOrder) : String(columnOrder));
|
|
81
|
+
else el.removeAttribute('column-order');
|
|
82
|
+
});
|
|
83
|
+
$effect(() => {
|
|
84
|
+
if (!el) return;
|
|
85
|
+
const handler = (e: Event) => onSort?.(e as CustomEvent);
|
|
86
|
+
el.addEventListener('cx-sort', handler);
|
|
87
|
+
return () => el.removeEventListener('cx-sort', handler);
|
|
88
|
+
});
|
|
89
|
+
$effect(() => {
|
|
90
|
+
if (!el) return;
|
|
91
|
+
const handler = (e: Event) => onSelect?.(e as CustomEvent);
|
|
92
|
+
el.addEventListener('cx-select', handler);
|
|
93
|
+
return () => el.removeEventListener('cx-select', handler);
|
|
94
|
+
});
|
|
95
|
+
$effect(() => {
|
|
96
|
+
if (!el) return;
|
|
97
|
+
const handler = (e: Event) => onExpand?.(e as CustomEvent);
|
|
98
|
+
el.addEventListener('cx-expand', handler);
|
|
99
|
+
return () => el.removeEventListener('cx-expand', handler);
|
|
100
|
+
});
|
|
101
|
+
$effect(() => {
|
|
102
|
+
if (!el) return;
|
|
103
|
+
const handler = (e: Event) => onPage?.(e as CustomEvent);
|
|
104
|
+
el.addEventListener('cx-page', handler);
|
|
105
|
+
return () => el.removeEventListener('cx-page', handler);
|
|
106
|
+
});
|
|
107
|
+
$effect(() => {
|
|
108
|
+
if (!el) return;
|
|
109
|
+
const handler = (e: Event) => onKeydown?.(e as CustomEvent);
|
|
110
|
+
el.addEventListener('cx-keydown', handler);
|
|
111
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
112
|
+
});
|
|
113
|
+
$effect(() => {
|
|
114
|
+
if (!el) return;
|
|
115
|
+
const handler = (e: Event) => onKeyup?.(e as CustomEvent);
|
|
116
|
+
el.addEventListener('cx-keyup', handler);
|
|
117
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<cx-table
|
|
123
|
+
bind:this={el}
|
|
124
|
+
id={typeof id === 'object' && id != null ? JSON.stringify(id) : id}
|
|
125
|
+
caption={typeof caption === 'object' && caption != null ? JSON.stringify(caption) : caption}
|
|
126
|
+
variant={typeof variant === 'object' && variant != null ? JSON.stringify(variant) : variant}
|
|
127
|
+
size={typeof size === 'object' && size != null ? JSON.stringify(size) : size}
|
|
128
|
+
selectable={typeof selectable === 'object' && selectable != null ? JSON.stringify(selectable) : selectable}
|
|
129
|
+
hoverable={hoverable || undefined}
|
|
130
|
+
sticky-header={stickyHeader || undefined}
|
|
131
|
+
disabled={disabled || undefined}
|
|
132
|
+
error={typeof error === 'object' && error != null ? JSON.stringify(error) : error}
|
|
133
|
+
/>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { EmptyStateConfig, FooterRow, KeyboardDetail, PageDetail, PaginationConfig, SortDetail, SortState, TableColumn, TableExpandDetail, TableRow, TableSelectDetail } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface TableProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
caption: string;
|
|
8
|
+
columns?: TableColumn[] | string;
|
|
9
|
+
rows?: TableRow[] | string;
|
|
10
|
+
variant?: 'plain' | 'striped' | 'bordered';
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
selectable?: string;
|
|
13
|
+
selected?: string[] | string;
|
|
14
|
+
sorts?: SortState[] | string;
|
|
15
|
+
pagination?: PaginationConfig | string;
|
|
16
|
+
hoverable?: boolean;
|
|
17
|
+
stickyHeader?: boolean;
|
|
18
|
+
footer?: FooterRow[] | string;
|
|
19
|
+
emptyState?: EmptyStateConfig | string;
|
|
20
|
+
columnOrder?: string[] | string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
loading?: number;
|
|
23
|
+
error?: string;
|
|
24
|
+
onSort?: (event: CustomEvent<SortDetail>) => void;
|
|
25
|
+
onSelect?: (event: CustomEvent<TableSelectDetail>) => void;
|
|
26
|
+
onExpand?: (event: CustomEvent<TableExpandDetail>) => void;
|
|
27
|
+
onPage?: (event: CustomEvent<PageDetail>) => void;
|
|
28
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
29
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare const Table: Component<TableProps, {}>;
|
|
33
|
+
export default Table;
|
package/src/tabs.svelte
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT -->
|
|
2
|
+
<!-- Svelte 5 wrapper for <cx-tabs> -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type { SelectDetail, TabItem } from './types.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
items?: TabItem[] | string;
|
|
10
|
+
defaultTab?: string;
|
|
11
|
+
variant?: 'underline' | 'enclosed' | 'pill';
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
width?: 'auto' | 'full';
|
|
14
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
onChange?: (event: CustomEvent<SelectDetail>) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { id, label, items, defaultTab, variant, orientation, width, size, onChange }: Props = $props();
|
|
19
|
+
|
|
20
|
+
let el: HTMLElement;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
$effect(() => {
|
|
24
|
+
if (!el) return;
|
|
25
|
+
if (width != null) el.setAttribute('width', String(width));
|
|
26
|
+
else el.removeAttribute('width');
|
|
27
|
+
});
|
|
28
|
+
$effect(() => {
|
|
29
|
+
if (!el) return;
|
|
30
|
+
if (items != null) el.setAttribute('items', typeof items === 'object' ? JSON.stringify(items) : String(items));
|
|
31
|
+
else el.removeAttribute('items');
|
|
32
|
+
});
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (!el) return;
|
|
35
|
+
const handler = (e: Event) => onChange?.(e as CustomEvent);
|
|
36
|
+
el.addEventListener('cx-change', handler);
|
|
37
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
38
|
+
});
|
|
39
|
+
/** Focuses the active tab. */
|
|
40
|
+
export function focus() { (el as any)?.focus(); }
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<cx-tabs
|
|
44
|
+
bind:this={el}
|
|
45
|
+
id={typeof id === 'object' && id != null ? JSON.stringify(id) : id}
|
|
46
|
+
label={typeof label === 'object' && label != null ? JSON.stringify(label) : label}
|
|
47
|
+
default-tab={typeof defaultTab === 'object' && defaultTab != null ? JSON.stringify(defaultTab) : defaultTab}
|
|
48
|
+
variant={typeof variant === 'object' && variant != null ? JSON.stringify(variant) : variant}
|
|
49
|
+
orientation={typeof orientation === 'object' && orientation != null ? JSON.stringify(orientation) : orientation}
|
|
50
|
+
size={typeof size === 'object' && size != null ? JSON.stringify(size) : size}
|
|
51
|
+
/>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { SelectDetail, TabItem } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface TabsProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
items?: TabItem[] | string;
|
|
9
|
+
defaultTab?: string;
|
|
10
|
+
variant?: 'underline' | 'enclosed' | 'pill';
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
width?: 'auto' | 'full';
|
|
13
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
+
onChange?: (event: CustomEvent<SelectDetail>) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const Tabs: Component<TabsProps, {
|
|
18
|
+
/** Focuses the active tab. */
|
|
19
|
+
focus(): void;
|
|
20
|
+
}>;
|
|
21
|
+
export default Tabs;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!-- Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT -->
|
|
2
|
+
<!-- Svelte 5 wrapper for <cx-text-input> -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type { FocusDetail, InputDetail, KeyboardDetail } from './types.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
10
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
/** Input type. Use 'multiline' for textarea behavior with optional rows and autoGrow. */
|
|
13
|
+
kind?: 'text' | 'email' | 'password' | 'search' | 'multiline';
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** Controlled value. Set via onInput callback. */
|
|
16
|
+
value?: string;
|
|
17
|
+
helperText?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
clearable?: boolean;
|
|
23
|
+
prefixIcon?: string;
|
|
24
|
+
suffixIcon?: string;
|
|
25
|
+
passwordToggle?: boolean;
|
|
26
|
+
passwordVisible?: boolean;
|
|
27
|
+
name?: string;
|
|
28
|
+
minLength?: number;
|
|
29
|
+
maxLength?: number;
|
|
30
|
+
pattern?: string;
|
|
31
|
+
autocomplete?: string;
|
|
32
|
+
rows?: number;
|
|
33
|
+
autoGrow?: boolean;
|
|
34
|
+
onInput?: (event: CustomEvent<InputDetail>) => void;
|
|
35
|
+
onChange?: (event: CustomEvent<InputDetail>) => void;
|
|
36
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
37
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
38
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
39
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let { id, label, variant, shape, size, kind, placeholder, value, helperText, error, disabled, readonly, required, clearable, prefixIcon, suffixIcon, passwordToggle, passwordVisible, name, minLength, maxLength, pattern, autocomplete, rows, autoGrow, onInput, onChange, onFocus, onBlur, onKeydown, onKeyup }: Props = $props();
|
|
43
|
+
|
|
44
|
+
let el: HTMLElement;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (!el) return;
|
|
49
|
+
if (value != null) el.setAttribute('value', String(value));
|
|
50
|
+
else el.removeAttribute('value');
|
|
51
|
+
});
|
|
52
|
+
$effect(() => {
|
|
53
|
+
if (!el) return;
|
|
54
|
+
if (name != null) el.setAttribute('name', String(name));
|
|
55
|
+
else el.removeAttribute('name');
|
|
56
|
+
});
|
|
57
|
+
$effect(() => {
|
|
58
|
+
if (!el) return;
|
|
59
|
+
const handler = (e: Event) => onInput?.(e as CustomEvent);
|
|
60
|
+
el.addEventListener('cx-input', handler);
|
|
61
|
+
return () => el.removeEventListener('cx-input', handler);
|
|
62
|
+
});
|
|
63
|
+
$effect(() => {
|
|
64
|
+
if (!el) return;
|
|
65
|
+
const handler = (e: Event) => onChange?.(e as CustomEvent);
|
|
66
|
+
el.addEventListener('cx-change', handler);
|
|
67
|
+
return () => el.removeEventListener('cx-change', handler);
|
|
68
|
+
});
|
|
69
|
+
$effect(() => {
|
|
70
|
+
if (!el) return;
|
|
71
|
+
const handler = (e: Event) => onFocus?.(e as CustomEvent);
|
|
72
|
+
el.addEventListener('cx-focus', handler);
|
|
73
|
+
return () => el.removeEventListener('cx-focus', handler);
|
|
74
|
+
});
|
|
75
|
+
$effect(() => {
|
|
76
|
+
if (!el) return;
|
|
77
|
+
const handler = (e: Event) => onBlur?.(e as CustomEvent);
|
|
78
|
+
el.addEventListener('cx-blur', handler);
|
|
79
|
+
return () => el.removeEventListener('cx-blur', handler);
|
|
80
|
+
});
|
|
81
|
+
$effect(() => {
|
|
82
|
+
if (!el) return;
|
|
83
|
+
const handler = (e: Event) => onKeydown?.(e as CustomEvent);
|
|
84
|
+
el.addEventListener('cx-keydown', handler);
|
|
85
|
+
return () => el.removeEventListener('cx-keydown', handler);
|
|
86
|
+
});
|
|
87
|
+
$effect(() => {
|
|
88
|
+
if (!el) return;
|
|
89
|
+
const handler = (e: Event) => onKeyup?.(e as CustomEvent);
|
|
90
|
+
el.addEventListener('cx-keyup', handler);
|
|
91
|
+
return () => el.removeEventListener('cx-keyup', handler);
|
|
92
|
+
});
|
|
93
|
+
/** Focuses the inner input or textarea. */
|
|
94
|
+
export function focus() { (el as any)?.focus(); }
|
|
95
|
+
/** Blurs the inner input or textarea. */
|
|
96
|
+
export function blur() { (el as any)?.blur(); }
|
|
97
|
+
/** Selects all text in the input. */
|
|
98
|
+
export function select() { (el as any)?.select(); }
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<cx-text-input
|
|
102
|
+
bind:this={el}
|
|
103
|
+
id={typeof id === 'object' && id != null ? JSON.stringify(id) : id}
|
|
104
|
+
label={typeof label === 'object' && label != null ? JSON.stringify(label) : label}
|
|
105
|
+
variant={typeof variant === 'object' && variant != null ? JSON.stringify(variant) : variant}
|
|
106
|
+
shape={typeof shape === 'object' && shape != null ? JSON.stringify(shape) : shape}
|
|
107
|
+
size={typeof size === 'object' && size != null ? JSON.stringify(size) : size}
|
|
108
|
+
kind={typeof kind === 'object' && kind != null ? JSON.stringify(kind) : kind}
|
|
109
|
+
placeholder={typeof placeholder === 'object' && placeholder != null ? JSON.stringify(placeholder) : placeholder}
|
|
110
|
+
helper-text={typeof helperText === 'object' && helperText != null ? JSON.stringify(helperText) : helperText}
|
|
111
|
+
error={typeof error === 'object' && error != null ? JSON.stringify(error) : error}
|
|
112
|
+
disabled={disabled || undefined}
|
|
113
|
+
readonly={readonly || undefined}
|
|
114
|
+
required={required || undefined}
|
|
115
|
+
clearable={clearable || undefined}
|
|
116
|
+
prefix-icon={typeof prefixIcon === 'object' && prefixIcon != null ? JSON.stringify(prefixIcon) : prefixIcon}
|
|
117
|
+
suffix-icon={typeof suffixIcon === 'object' && suffixIcon != null ? JSON.stringify(suffixIcon) : suffixIcon}
|
|
118
|
+
password-toggle={passwordToggle || undefined}
|
|
119
|
+
password-visible={passwordVisible || undefined}
|
|
120
|
+
min-length={typeof minLength === 'object' && minLength != null ? JSON.stringify(minLength) : minLength}
|
|
121
|
+
max-length={typeof maxLength === 'object' && maxLength != null ? JSON.stringify(maxLength) : maxLength}
|
|
122
|
+
pattern={typeof pattern === 'object' && pattern != null ? JSON.stringify(pattern) : pattern}
|
|
123
|
+
autocomplete={typeof autocomplete === 'object' && autocomplete != null ? JSON.stringify(autocomplete) : autocomplete}
|
|
124
|
+
rows={typeof rows === 'object' && rows != null ? JSON.stringify(rows) : rows}
|
|
125
|
+
auto-grow={autoGrow || undefined}
|
|
126
|
+
/>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-svelte.mjs — DO NOT EDIT
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { FocusDetail, InputDetail, KeyboardDetail } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface TextInputProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
variant?: 'outline' | 'filled' | 'ghost';
|
|
9
|
+
shape?: 'sharp' | 'rounded' | 'pill';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
/** Input type. Use 'multiline' for textarea behavior with optional rows and autoGrow. */
|
|
12
|
+
kind?: 'text' | 'email' | 'password' | 'search' | 'multiline';
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Controlled value. Set via onInput callback. */
|
|
15
|
+
value?: string;
|
|
16
|
+
helperText?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
readonly?: boolean;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
clearable?: boolean;
|
|
22
|
+
prefixIcon?: string;
|
|
23
|
+
suffixIcon?: string;
|
|
24
|
+
passwordToggle?: boolean;
|
|
25
|
+
passwordVisible?: boolean;
|
|
26
|
+
name?: string;
|
|
27
|
+
minLength?: number;
|
|
28
|
+
maxLength?: number;
|
|
29
|
+
pattern?: string;
|
|
30
|
+
autocomplete?: string;
|
|
31
|
+
rows?: number;
|
|
32
|
+
autoGrow?: boolean;
|
|
33
|
+
onInput?: (event: CustomEvent<InputDetail>) => void;
|
|
34
|
+
onChange?: (event: CustomEvent<InputDetail>) => void;
|
|
35
|
+
onFocus?: (event: CustomEvent<FocusDetail>) => void;
|
|
36
|
+
onBlur?: (event: CustomEvent<FocusDetail>) => void;
|
|
37
|
+
onKeydown?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
38
|
+
onKeyup?: (event: CustomEvent<KeyboardDetail>) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const TextInput: Component<TextInputProps, {
|
|
42
|
+
/** Focuses the inner input or textarea. */
|
|
43
|
+
focus(): void;
|
|
44
|
+
/** Blurs the inner input or textarea. */
|
|
45
|
+
blur(): void;
|
|
46
|
+
/** Selects all text in the input. */
|
|
47
|
+
select(): void;
|
|
48
|
+
}>;
|
|
49
|
+
export default TextInput;
|