sveltacular 1.0.6 → 1.0.9
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 +232 -28
- package/dist/forms/bool-box/bool-box.svelte +21 -2
- package/dist/forms/bool-box/bool-box.svelte.d.ts +5 -0
- package/dist/forms/check-box/check-box-group.svelte +1 -0
- package/dist/forms/check-box/check-box.svelte +73 -31
- package/dist/forms/check-box/check-box.svelte.d.ts +7 -0
- package/dist/forms/date-box/date-box.svelte +7 -3
- package/dist/forms/date-box/date-box.svelte.d.ts +3 -0
- package/dist/forms/file-box/file-box.svelte +33 -7
- package/dist/forms/form-field/form-field.svelte +128 -33
- package/dist/forms/form-field/form-field.svelte.d.ts +9 -3
- package/dist/forms/form-label/form-label.svelte +4 -2
- package/dist/forms/form-label/form-label.svelte.d.ts +2 -2
- package/dist/forms/index.d.ts +1 -1
- package/dist/forms/index.js +1 -1
- package/dist/forms/info-box/info-box.svelte +9 -7
- package/dist/forms/list-box/list-box.svelte +270 -89
- package/dist/forms/list-box/list-box.svelte.d.ts +3 -0
- package/dist/forms/money-box/money-box.svelte +20 -16
- package/dist/forms/number-box/number-box.svelte +16 -3
- package/dist/forms/number-box/number-box.svelte.d.ts +6 -0
- package/dist/forms/phone-box/phone-box.svelte +17 -3
- package/dist/forms/phone-box/phone-box.svelte.d.ts +5 -0
- package/dist/forms/radio-group/radio-box.svelte +11 -2
- package/dist/forms/radio-group/radio-box.svelte.d.ts +1 -0
- package/dist/forms/radio-group/radio-group.svelte +10 -4
- package/dist/forms/radio-group/radio-group.svelte.d.ts +4 -0
- package/dist/forms/switch-box/switch-box.svelte +33 -13
- package/dist/forms/switch-box/switch-box.svelte.d.ts +6 -0
- package/dist/forms/tag-box/tag-box.svelte +225 -0
- package/dist/forms/tag-box/tag-box.svelte.d.ts +19 -0
- package/dist/forms/tag-input-box/tag-input-box.svelte +8 -7
- package/dist/forms/tag-input-box/tag-input-box.svelte.d.ts +2 -1
- package/dist/forms/text-area/text-area.svelte +18 -3
- package/dist/forms/text-area/text-area.svelte.d.ts +7 -0
- package/dist/forms/text-box/text-box.svelte +18 -15
- package/dist/forms/text-box/text-box.svelte.d.ts +2 -2
- package/dist/forms/time-box/time-box.svelte +7 -3
- package/dist/forms/time-box/time-box.svelte.d.ts +3 -0
- package/dist/forms/url-box/url-box.svelte +31 -1
- package/dist/forms/url-box/url-box.svelte.d.ts +10 -0
- package/dist/generic/avatar/avatar.svelte +0 -10
- package/dist/generic/badge/badge.svelte +0 -1
- package/dist/generic/chip/chip.svelte +1 -13
- package/dist/generic/header/header.svelte +19 -17
- package/dist/generic/menu/menu.svelte +2 -3
- package/dist/generic/rating/rating.svelte +2 -3
- package/dist/generic/section/section.svelte +7 -3
- package/dist/generic/spinner/spinner.svelte +0 -1
- package/dist/generic/theme-provider/theme-provider-demo.svelte +38 -64
- package/dist/generic/theme-provider/theme-provider.svelte +5 -11
- package/dist/generic/toaster/toaster.svelte +1 -1
- package/dist/helpers/use-position.svelte.js +1 -1
- package/dist/helpers/use-virtual-list.svelte.js +1 -1
- package/dist/icons/check-icon.svelte +0 -2
- package/dist/icons/copy-icon.svelte +0 -1
- package/dist/modals/alert.svelte +6 -1
- package/dist/modals/confirm.svelte +6 -1
- package/dist/modals/modal.svelte +2 -2
- package/dist/modals/prompt.svelte +16 -11
- package/dist/navigation/accordion/accordion.svelte +1 -7
- package/dist/navigation/app-bar/app-bar.svelte +12 -4
- package/dist/navigation/command-palette/command-palette.svelte +34 -41
- package/dist/navigation/context-menu/README.md +34 -55
- package/dist/navigation/context-menu/context-menu-divider.svelte +2 -11
- package/dist/navigation/context-menu/context-menu-item.svelte +10 -11
- package/dist/navigation/context-menu/context-menu.svelte +6 -7
- package/dist/navigation/drawer/drawer.svelte +0 -1
- package/dist/navigation/dropdown-button/dropdown-button.svelte +6 -1
- package/dist/placeholders/skeleton-table.svelte +0 -1
- package/dist/tables/table-row.svelte +2 -6
- package/dist/test-utils/accessibility-helpers.js +2 -3
- package/dist/test-utils/render-helpers.js +4 -7
- package/dist/typography/code.svelte +0 -1
- package/dist/typography/headline.svelte +6 -6
- package/dist/typography/paragraph.svelte +1 -1
- package/dist/typography/subtitle.svelte +1 -1
- package/package.json +4 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { uniqueId } from '../../helpers/unique-id.js';
|
|
4
4
|
import { animateShake, animateScaleIn } from '../../helpers/animations.js';
|
|
5
|
-
import FormField from '../form-field/form-field.svelte';
|
|
5
|
+
import FormField, { type FormFieldFeedback } from '../form-field/form-field.svelte';
|
|
6
6
|
import CheckIcon from '../../icons/check-icon.svelte';
|
|
7
7
|
import type { AllowedTextInputTypes, FormFieldSizeOptions } from '../../types/form.js';
|
|
8
8
|
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
value = $bindable('' as string | null),
|
|
13
13
|
placeholder = '',
|
|
14
14
|
helperText = '',
|
|
15
|
-
|
|
16
|
-
successText = '',
|
|
15
|
+
feedback = undefined,
|
|
17
16
|
isLoading = false,
|
|
18
17
|
showCharacterCount = false,
|
|
19
18
|
size = 'full',
|
|
@@ -37,8 +36,7 @@
|
|
|
37
36
|
value?: string | null;
|
|
38
37
|
placeholder?: string;
|
|
39
38
|
helperText?: string;
|
|
40
|
-
|
|
41
|
-
successText?: string;
|
|
39
|
+
feedback?: FormFieldFeedback;
|
|
42
40
|
isLoading?: boolean;
|
|
43
41
|
showCharacterCount?: boolean;
|
|
44
42
|
size?: FormFieldSizeOptions;
|
|
@@ -60,8 +58,8 @@
|
|
|
60
58
|
label?: string;
|
|
61
59
|
} = $props();
|
|
62
60
|
|
|
63
|
-
let hasError = $derived(!!
|
|
64
|
-
let hasSuccess = $derived(!!
|
|
61
|
+
let hasError = $derived(!!feedback?.isError);
|
|
62
|
+
let hasSuccess = $derived(!!feedback && !feedback.isError);
|
|
65
63
|
let describedByIds = $state<string[]>([]);
|
|
66
64
|
let inputElement: HTMLDivElement | null = $state(null);
|
|
67
65
|
let successIconElement: HTMLDivElement | null = $state(null);
|
|
@@ -74,19 +72,24 @@
|
|
|
74
72
|
: ''
|
|
75
73
|
);
|
|
76
74
|
|
|
77
|
-
// Update describedByIds array when helper/
|
|
75
|
+
// Update describedByIds array when helper/feedback changes
|
|
78
76
|
$effect(() => {
|
|
79
77
|
// Track the dependencies we care about
|
|
80
|
-
const hasHelper = !!helperText;
|
|
81
|
-
const
|
|
82
|
-
const hasSuccessMsg = !!successText;
|
|
78
|
+
const hasHelper = !!helperText && !feedback;
|
|
79
|
+
const hasFeedback = !!feedback;
|
|
83
80
|
|
|
84
81
|
// Use untrack to write to describedByIds without triggering this effect again
|
|
85
82
|
untrack(() => {
|
|
86
83
|
describedByIds = [];
|
|
87
|
-
if (hasHelper)
|
|
88
|
-
|
|
89
|
-
if (
|
|
84
|
+
if (hasHelper) {
|
|
85
|
+
describedByIds.push(`${id}-helper`);
|
|
86
|
+
} else if (hasFeedback) {
|
|
87
|
+
if (feedback.isError) {
|
|
88
|
+
describedByIds.push(`${id}-error`);
|
|
89
|
+
} else {
|
|
90
|
+
describedByIds.push(`${id}-success`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
90
93
|
});
|
|
91
94
|
});
|
|
92
95
|
|
|
@@ -149,7 +152,7 @@
|
|
|
149
152
|
};
|
|
150
153
|
</script>
|
|
151
154
|
|
|
152
|
-
<FormField {size} {label} {id} {required} {disabled} {helperText} {
|
|
155
|
+
<FormField {size} {label} {id} {required} {disabled} {helperText} {feedback}>
|
|
153
156
|
<div
|
|
154
157
|
class="input {disabled ? 'disabled' : 'enabled'}"
|
|
155
158
|
class:error={hasError}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { type FormFieldFeedback } from '../form-field/form-field.svelte';
|
|
1
2
|
import type { AllowedTextInputTypes, FormFieldSizeOptions } from '../../types/form.js';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
value?: string | null;
|
|
4
5
|
placeholder?: string;
|
|
5
6
|
helperText?: string;
|
|
6
|
-
|
|
7
|
-
successText?: string;
|
|
7
|
+
feedback?: FormFieldFeedback;
|
|
8
8
|
isLoading?: boolean;
|
|
9
9
|
showCharacterCount?: boolean;
|
|
10
10
|
size?: FormFieldSizeOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { uniqueId } from '../../helpers/unique-id.js';
|
|
3
|
-
import FormField from '../form-field/form-field.svelte';
|
|
3
|
+
import FormField, { type FormFieldFeedback } from '../form-field/form-field.svelte';
|
|
4
4
|
import type { ComponentSize } from '../../types/size.js';
|
|
5
5
|
|
|
6
6
|
const id = uniqueId();
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
disabled = false,
|
|
12
12
|
required = false,
|
|
13
13
|
onChange = undefined,
|
|
14
|
-
label = undefined
|
|
14
|
+
label = undefined,
|
|
15
|
+
helperText = undefined,
|
|
16
|
+
feedback = undefined
|
|
15
17
|
}: {
|
|
16
18
|
value?: string | null;
|
|
17
19
|
size?: ComponentSize;
|
|
@@ -19,6 +21,8 @@
|
|
|
19
21
|
required?: boolean;
|
|
20
22
|
onChange?: ((value: string) => void) | undefined;
|
|
21
23
|
label?: string;
|
|
24
|
+
helperText?: string;
|
|
25
|
+
feedback?: FormFieldFeedback;
|
|
22
26
|
} = $props();
|
|
23
27
|
|
|
24
28
|
const handleInput = (e: Event) => {
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
};
|
|
29
33
|
</script>
|
|
30
34
|
|
|
31
|
-
<FormField {size} {label} {id} {required} {disabled}>
|
|
35
|
+
<FormField {size} {label} {id} {required} {disabled} {helperText} {feedback}>
|
|
32
36
|
<div class="input" class:disabled>
|
|
33
37
|
<input
|
|
34
38
|
{id}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FormFieldFeedback } from '../form-field/form-field.svelte';
|
|
1
2
|
import type { ComponentSize } from '../../types/size.js';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
value?: string | null;
|
|
@@ -6,6 +7,8 @@ type $$ComponentProps = {
|
|
|
6
7
|
required?: boolean;
|
|
7
8
|
onChange?: ((value: string) => void) | undefined;
|
|
8
9
|
label?: string;
|
|
10
|
+
helperText?: string;
|
|
11
|
+
feedback?: FormFieldFeedback;
|
|
9
12
|
};
|
|
10
13
|
declare const TimeBox: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
11
14
|
type TimeBox = ReturnType<typeof TimeBox>;
|
|
@@ -8,13 +8,33 @@
|
|
|
8
8
|
value = $bindable('' as string | null),
|
|
9
9
|
size = 'lg' as FormFieldSizeOptions,
|
|
10
10
|
placeholder = 'example.com',
|
|
11
|
-
label = undefined
|
|
11
|
+
label = undefined,
|
|
12
|
+
helperText = undefined,
|
|
13
|
+
feedback = undefined,
|
|
14
|
+
disabled = false,
|
|
15
|
+
required = false,
|
|
16
|
+
readonly = false,
|
|
17
|
+
maxlength = undefined,
|
|
18
|
+
minlength = undefined,
|
|
19
|
+
pattern = undefined,
|
|
20
|
+
isLoading = false,
|
|
21
|
+
onChange = undefined
|
|
12
22
|
}: {
|
|
13
23
|
protocol?: HttpProtocol;
|
|
14
24
|
value?: string | null;
|
|
15
25
|
size?: FormFieldSizeOptions;
|
|
16
26
|
placeholder?: string;
|
|
17
27
|
label?: string;
|
|
28
|
+
helperText?: string;
|
|
29
|
+
feedback?: import('../form-field/form-field.svelte').FormFieldFeedback;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
readonly?: boolean;
|
|
33
|
+
maxlength?: number | undefined;
|
|
34
|
+
minlength?: number | undefined;
|
|
35
|
+
pattern?: string | undefined;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
onChange?: ((value: string) => void) | undefined;
|
|
18
38
|
} = $props();
|
|
19
39
|
|
|
20
40
|
// On input, parse the value and set the protocol
|
|
@@ -25,6 +45,7 @@
|
|
|
25
45
|
protocol = urlParts[0] as HttpProtocol;
|
|
26
46
|
value = urlParts[1];
|
|
27
47
|
}
|
|
48
|
+
onChange?.(cleanValue);
|
|
28
49
|
};
|
|
29
50
|
</script>
|
|
30
51
|
|
|
@@ -38,4 +59,13 @@
|
|
|
38
59
|
onChange={handleInput}
|
|
39
60
|
allowSpaces={false}
|
|
40
61
|
{label}
|
|
62
|
+
{helperText}
|
|
63
|
+
{feedback}
|
|
64
|
+
{disabled}
|
|
65
|
+
{required}
|
|
66
|
+
{readonly}
|
|
67
|
+
{maxlength}
|
|
68
|
+
{minlength}
|
|
69
|
+
{pattern}
|
|
70
|
+
{isLoading}
|
|
41
71
|
/>
|
|
@@ -6,6 +6,16 @@ type $$ComponentProps = {
|
|
|
6
6
|
size?: FormFieldSizeOptions;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
label?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
feedback?: import('../form-field/form-field.svelte').FormFieldFeedback;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
maxlength?: number | undefined;
|
|
15
|
+
minlength?: number | undefined;
|
|
16
|
+
pattern?: string | undefined;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
onChange?: ((value: string) => void) | undefined;
|
|
9
19
|
};
|
|
10
20
|
declare const UrlBox: import("svelte").Component<$$ComponentProps, {}, "value" | "protocol">;
|
|
11
21
|
type UrlBox = ReturnType<typeof UrlBox>;
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
<div class="chip {size} {variant}">
|
|
20
20
|
<span class="label">{label}</span>
|
|
21
21
|
{#if removable}
|
|
22
|
-
<button type="button" class="remove" onclick={onRemove} aria-label="Remove {label}">
|
|
23
|
-
×
|
|
24
|
-
</button>
|
|
22
|
+
<button type="button" class="remove" onclick={onRemove} aria-label="Remove {label}"> × </button>
|
|
25
23
|
{/if}
|
|
26
24
|
</div>
|
|
27
25
|
|
|
@@ -83,13 +81,3 @@
|
|
|
83
81
|
background-color: var(--chip-negative-bg, #ffcdd2);
|
|
84
82
|
color: var(--chip-negative-fg, #c62828);
|
|
85
83
|
}</style>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import FlexRow from '../../layout/flex-row.svelte';
|
|
4
3
|
import type { SectionLevel } from '../../types/generic.js';
|
|
5
4
|
import Headline from '../../typography/headline.svelte';
|
|
6
5
|
import Subtitle from '../../typography/subtitle.svelte';
|
|
@@ -24,26 +23,29 @@
|
|
|
24
23
|
</script>
|
|
25
24
|
|
|
26
25
|
<header class:underline data-level={level}>
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
</FlexRow>
|
|
26
|
+
<hgroup>
|
|
27
|
+
<Headline {level}>{title}</Headline>
|
|
28
|
+
{#if subtitle}
|
|
29
|
+
<Subtitle {level}>{subtitle}</Subtitle>
|
|
30
|
+
{/if}
|
|
31
|
+
</hgroup>
|
|
32
|
+
<div>
|
|
33
|
+
{#if children}
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
{/if}
|
|
36
|
+
</div>
|
|
40
37
|
</header>
|
|
41
38
|
|
|
42
39
|
<style>header {
|
|
43
|
-
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
align-items: stretch;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
gap: var(--spacing-base, 1rem);
|
|
45
|
+
margin-bottom: var(--spacing-base, 1rem);
|
|
44
46
|
font-family: var(--base-headline-font-family, sans-serif);
|
|
45
47
|
}
|
|
46
48
|
header.underline {
|
|
47
|
-
padding-bottom: 0.
|
|
48
|
-
border-bottom: solid 1px
|
|
49
|
+
padding-bottom: var(--spacing-xs, 0.25rem);
|
|
50
|
+
border-bottom: solid var(--border-thin, 1px) var(--divider-color, rgba(127, 127, 127, 0.5));
|
|
49
51
|
}</style>
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import FlexItem from '../../layout/flex-item.svelte';
|
|
5
5
|
import FlexRow from '../../layout/flex-row.svelte';
|
|
6
6
|
import { useVirtualList } from '../../helpers/use-virtual-list.svelte.js';
|
|
7
|
-
import { onMount } from 'svelte';
|
|
8
7
|
|
|
9
8
|
let {
|
|
10
9
|
items = [] as MenuOption[],
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
});
|
|
85
84
|
</script>
|
|
86
85
|
|
|
87
|
-
<ul
|
|
86
|
+
<ul
|
|
88
87
|
role="listbox"
|
|
89
88
|
id={listboxId}
|
|
90
89
|
class="menu {open ? 'open' : 'closed'} {size}"
|
|
@@ -94,7 +93,7 @@
|
|
|
94
93
|
{#if instructions}
|
|
95
94
|
<li class="instructions" role="presentation">{instructions}</li>
|
|
96
95
|
{/if}
|
|
97
|
-
|
|
96
|
+
|
|
98
97
|
{#if virtualScroll && virtual}
|
|
99
98
|
<!-- Virtual scrolling mode -->
|
|
100
99
|
<div style="height: {virtual.totalHeight}px; position: relative;">
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
.rating .star.filled {
|
|
60
60
|
color: var(--rating-filled-color, #ffc107);
|
|
61
61
|
}
|
|
62
|
-
.rating .star:hover:not(
|
|
62
|
+
.rating .star:hover:not(:disabled) {
|
|
63
63
|
color: var(--rating-hover-color, #ffb300);
|
|
64
64
|
}
|
|
65
|
-
.rating .star
|
|
65
|
+
.rating .star:disabled {
|
|
66
66
|
cursor: default;
|
|
67
67
|
}
|
|
68
68
|
.rating .star:focus {
|
|
@@ -82,4 +82,3 @@
|
|
|
82
82
|
.rating.xl .star {
|
|
83
83
|
font-size: 2.5rem;
|
|
84
84
|
}</style>
|
|
85
|
-
|
|
@@ -21,9 +21,13 @@
|
|
|
21
21
|
children: Snippet;
|
|
22
22
|
} = $props();
|
|
23
23
|
|
|
24
|
-
setContext('section', {
|
|
25
|
-
get level() {
|
|
26
|
-
|
|
24
|
+
setContext('section', {
|
|
25
|
+
get level() {
|
|
26
|
+
return level;
|
|
27
|
+
},
|
|
28
|
+
get title() {
|
|
29
|
+
return title;
|
|
30
|
+
}
|
|
27
31
|
});
|
|
28
32
|
</script>
|
|
29
33
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* Theme Provider Demo Component
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* Demonstrates theme switching functionality with example components.
|
|
6
6
|
*/
|
|
7
7
|
import ThemeProvider from './theme-provider.svelte';
|
|
@@ -29,43 +29,41 @@
|
|
|
29
29
|
<Card>
|
|
30
30
|
<div style="padding: 1.5rem; margin-bottom: 2rem;">
|
|
31
31
|
<h2 style="margin-top: 0; margin-bottom: 1rem;">Theme Controls</h2>
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
<div style="display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap;">
|
|
34
|
-
<Button
|
|
34
|
+
<Button
|
|
35
35
|
variant={theme.current === 'light' ? 'primary' : 'outline'}
|
|
36
36
|
onClick={() => theme.set('light')}
|
|
37
37
|
>
|
|
38
38
|
☀️ Light
|
|
39
39
|
</Button>
|
|
40
|
-
<Button
|
|
40
|
+
<Button
|
|
41
41
|
variant={theme.current === 'dark' ? 'primary' : 'outline'}
|
|
42
42
|
onClick={() => theme.set('dark')}
|
|
43
43
|
>
|
|
44
44
|
🌙 Dark
|
|
45
45
|
</Button>
|
|
46
|
-
<Button
|
|
46
|
+
<Button
|
|
47
47
|
variant={theme.current === 'system' ? 'primary' : 'outline'}
|
|
48
48
|
onClick={() => theme.set('system')}
|
|
49
49
|
>
|
|
50
50
|
💻 System
|
|
51
51
|
</Button>
|
|
52
|
-
<Button
|
|
53
|
-
variant="secondary"
|
|
54
|
-
onClick={() => theme.toggle()}
|
|
55
|
-
>
|
|
56
|
-
🔄 Toggle
|
|
57
|
-
</Button>
|
|
52
|
+
<Button variant="secondary" onClick={() => theme.toggle()}>🔄 Toggle</Button>
|
|
58
53
|
</div>
|
|
59
54
|
|
|
60
55
|
<div style="display: flex; gap: 1rem; font-size: 0.875rem; color: var(--base-accent-fg);">
|
|
61
56
|
<div>
|
|
62
|
-
<strong>Current:</strong>
|
|
57
|
+
<strong>Current:</strong>
|
|
58
|
+
{theme.current}
|
|
63
59
|
</div>
|
|
64
60
|
<div>
|
|
65
|
-
<strong>Resolved:</strong>
|
|
61
|
+
<strong>Resolved:</strong>
|
|
62
|
+
{theme.resolved}
|
|
66
63
|
</div>
|
|
67
64
|
<div>
|
|
68
|
-
<strong>Is Dark:</strong>
|
|
65
|
+
<strong>Is Dark:</strong>
|
|
66
|
+
{theme.isDark}
|
|
69
67
|
</div>
|
|
70
68
|
</div>
|
|
71
69
|
</div>
|
|
@@ -108,18 +106,10 @@
|
|
|
108
106
|
<div style="padding: 1.5rem;">
|
|
109
107
|
<h4 style="margin-top: 0; margin-bottom: 1rem;">Notices</h4>
|
|
110
108
|
<div style="display: grid; gap: 0.75rem;">
|
|
111
|
-
<Notice variant="info">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Operation completed successfully!
|
|
116
|
-
</Notice>
|
|
117
|
-
<Notice variant="attention">
|
|
118
|
-
Please review your changes carefully.
|
|
119
|
-
</Notice>
|
|
120
|
-
<Notice variant="error">
|
|
121
|
-
An error occurred while processing your request.
|
|
122
|
-
</Notice>
|
|
109
|
+
<Notice variant="info">This is an informational message.</Notice>
|
|
110
|
+
<Notice variant="success">Operation completed successfully!</Notice>
|
|
111
|
+
<Notice variant="attention">Please review your changes carefully.</Notice>
|
|
112
|
+
<Notice variant="error">An error occurred while processing your request.</Notice>
|
|
123
113
|
</div>
|
|
124
114
|
</div>
|
|
125
115
|
</Card>
|
|
@@ -129,28 +119,13 @@
|
|
|
129
119
|
<div style="padding: 1.5rem;">
|
|
130
120
|
<h4 style="margin-top: 0; margin-bottom: 1rem;">Form Inputs</h4>
|
|
131
121
|
<div style="display: grid; gap: 1rem; max-width: 500px;">
|
|
132
|
-
<TextBox
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/>
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
bind:value={textAreaValue}
|
|
140
|
-
label="Text Area"
|
|
141
|
-
rows={4}
|
|
142
|
-
/>
|
|
143
|
-
|
|
144
|
-
<CheckBox
|
|
145
|
-
bind:isChecked={checked}
|
|
146
|
-
label="Check Box Option"
|
|
147
|
-
/>
|
|
148
|
-
|
|
149
|
-
<SwitchBox
|
|
150
|
-
bind:checked={switchOn}
|
|
151
|
-
>
|
|
152
|
-
Switch Option
|
|
153
|
-
</SwitchBox>
|
|
122
|
+
<TextBox bind:value={textValue} label="Text Input" placeholder="Enter some text..." />
|
|
123
|
+
|
|
124
|
+
<TextArea bind:value={textAreaValue} label="Text Area" rows={4} />
|
|
125
|
+
|
|
126
|
+
<CheckBox bind:isChecked={checked} label="Check Box Option" />
|
|
127
|
+
|
|
128
|
+
<SwitchBox bind:checked={switchOn}>Switch Option</SwitchBox>
|
|
154
129
|
</div>
|
|
155
130
|
</div>
|
|
156
131
|
</Card>
|
|
@@ -159,24 +134,23 @@
|
|
|
159
134
|
<Card>
|
|
160
135
|
<div style="padding: 1.5rem;">
|
|
161
136
|
<h4 style="margin-top: 0; margin-bottom: 1rem;">Typography</h4>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
137
|
+
<p style="margin-bottom: 0.5rem;">
|
|
138
|
+
This is regular text using the base foreground color.
|
|
139
|
+
</p>
|
|
140
|
+
<p style="margin-bottom: 0.5rem;">
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
style="background: none; border: none; padding: 0; color: var(--base-link-fg); text-decoration: underline; cursor: pointer; font: inherit;"
|
|
144
|
+
onclick={() => {}}
|
|
145
|
+
>
|
|
146
|
+
This is a link
|
|
147
|
+
</button> with proper link styling.
|
|
148
|
+
</p>
|
|
149
|
+
<p style="margin-bottom: 0; color: var(--base-accent-fg); font-size: 0.875rem;">
|
|
150
|
+
This is accent text using a muted color.
|
|
151
|
+
</p>
|
|
177
152
|
</div>
|
|
178
153
|
</Card>
|
|
179
154
|
</div>
|
|
180
155
|
</div>
|
|
181
156
|
</ThemeProvider>
|
|
182
|
-
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* Theme Provider Component
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* Wraps your application to provide theme management functionality.
|
|
6
6
|
* Automatically applies the selected theme and syncs with system preferences.
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* @component
|
|
9
9
|
* @example
|
|
10
10
|
* ```svelte
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* <App />
|
|
13
13
|
* </ThemeProvider>
|
|
14
14
|
* ```
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* Or with initial theme:
|
|
17
17
|
* ```svelte
|
|
18
18
|
* <ThemeProvider initialTheme="dark">
|
|
@@ -44,12 +44,7 @@
|
|
|
44
44
|
renderWrapper?: boolean;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
let {
|
|
48
|
-
initialTheme,
|
|
49
|
-
children,
|
|
50
|
-
class: className,
|
|
51
|
-
renderWrapper = false
|
|
52
|
-
}: Props = $props();
|
|
47
|
+
let { initialTheme, children, class: className, renderWrapper = false }: Props = $props();
|
|
53
48
|
|
|
54
49
|
const theme = useTheme();
|
|
55
50
|
|
|
@@ -58,7 +53,7 @@
|
|
|
58
53
|
if (initialTheme) {
|
|
59
54
|
theme.set(initialTheme);
|
|
60
55
|
}
|
|
61
|
-
|
|
56
|
+
|
|
62
57
|
// Apply theme to document
|
|
63
58
|
if (typeof document !== 'undefined') {
|
|
64
59
|
document.documentElement.setAttribute('data-theme', theme.resolved);
|
|
@@ -80,4 +75,3 @@
|
|
|
80
75
|
{:else}
|
|
81
76
|
{@render children?.()}
|
|
82
77
|
{/if}
|
|
83
|
-
|
|
@@ -111,7 +111,7 @@ export class PositionManager {
|
|
|
111
111
|
}
|
|
112
112
|
// Store cleanup function
|
|
113
113
|
this.cleanup = () => {
|
|
114
|
-
listeners.forEach(cleanup => cleanup());
|
|
114
|
+
listeners.forEach((cleanup) => cleanup());
|
|
115
115
|
if (this.rafId !== null) {
|
|
116
116
|
cancelAnimationFrame(this.rafId);
|
|
117
117
|
this.rafId = null;
|
|
@@ -171,7 +171,7 @@ export class VirtualList {
|
|
|
171
171
|
// Calculate end index for variable height
|
|
172
172
|
let height = 0;
|
|
173
173
|
endIndex = startIndex;
|
|
174
|
-
const targetHeight = this.containerHeight +
|
|
174
|
+
const targetHeight = this.containerHeight + this.overscan * this.itemHeight * 2;
|
|
175
175
|
while (endIndex < this.items.length && height < targetHeight) {
|
|
176
176
|
height += this.getItemHeight(endIndex);
|
|
177
177
|
endIndex++;
|
package/dist/modals/alert.svelte
CHANGED
|
@@ -38,7 +38,12 @@
|
|
|
38
38
|
|
|
39
39
|
{#if open}
|
|
40
40
|
<Overlay onClick={close}>
|
|
41
|
-
<Dialog
|
|
41
|
+
<Dialog
|
|
42
|
+
{size}
|
|
43
|
+
role="alertdialog"
|
|
44
|
+
aria-modal="true"
|
|
45
|
+
aria-labelledby={title ? 'alert-title' : undefined}
|
|
46
|
+
>
|
|
42
47
|
{#if title}
|
|
43
48
|
<DialogHeader id="alert-title">
|
|
44
49
|
{title}
|
|
@@ -49,7 +49,12 @@
|
|
|
49
49
|
|
|
50
50
|
{#if open}
|
|
51
51
|
<Overlay onClick={no}>
|
|
52
|
-
<Dialog
|
|
52
|
+
<Dialog
|
|
53
|
+
{size}
|
|
54
|
+
role="alertdialog"
|
|
55
|
+
aria-modal="true"
|
|
56
|
+
aria-labelledby={title ? 'confirm-title' : undefined}
|
|
57
|
+
>
|
|
53
58
|
{#if title}
|
|
54
59
|
<DialogHeader id="confirm-title">
|
|
55
60
|
{title}
|