@immich/ui 0.14.2 → 0.16.0
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/dist/common/context.svelte.d.ts +8 -1
- package/dist/common/context.svelte.js +4 -1
- package/dist/components/Alert/Alert.svelte +5 -3
- package/dist/components/Alert/Alert.svelte.d.ts +4 -2
- package/dist/components/AppShell/AppShell.svelte.d.ts +4 -2
- package/dist/components/AppShell/AppShellHeader.svelte.d.ts +4 -2
- package/dist/components/AppShell/AppShellSidebar.svelte +1 -0
- package/dist/components/AppShell/AppShellSidebar.svelte.d.ts +4 -2
- package/dist/components/AppShell/PageLayout.svelte.d.ts +4 -2
- package/dist/components/Avatar/Avatar.svelte.d.ts +5 -3
- package/dist/components/Button/Button.svelte.d.ts +1 -0
- package/dist/components/Card/Card.svelte +3 -11
- package/dist/components/Card/Card.svelte.d.ts +5 -3
- package/dist/components/Card/CardBody.svelte.d.ts +4 -2
- package/dist/components/Card/CardDescription.svelte.d.ts +4 -2
- package/dist/components/Card/CardFooter.svelte.d.ts +4 -2
- package/dist/components/Card/CardHeader.svelte.d.ts +4 -2
- package/dist/components/Card/CardTitle.svelte.d.ts +4 -2
- package/dist/components/CloseButton/CloseButton.svelte +1 -1
- package/dist/components/CloseButton/CloseButton.svelte.d.ts +1 -0
- package/dist/components/Code/Code.svelte.d.ts +5 -3
- package/dist/components/Container/Container.svelte +33 -0
- package/dist/components/Container/Container.svelte.d.ts +11 -0
- package/dist/components/Form/Checkbox.svelte +4 -21
- package/dist/components/Form/Checkbox.svelte.d.ts +5 -3
- package/dist/components/Form/Field.svelte +3 -2
- package/dist/components/Form/Field.svelte.d.ts +5 -2
- package/dist/components/Form/HelperText.svelte.d.ts +4 -2
- package/dist/components/Form/Input.svelte +14 -23
- package/dist/components/Form/Input.svelte.d.ts +1 -0
- package/dist/components/Form/PasswordInput.svelte +6 -3
- package/dist/components/Form/PasswordInput.svelte.d.ts +1 -0
- package/dist/components/FormatBytes/FormatBytes.svelte.d.ts +5 -3
- package/dist/components/Heading/Heading.svelte.d.ts +4 -2
- package/dist/components/Icon/Icon.svelte.d.ts +3 -1
- package/dist/components/IconButton/IconButton.svelte +12 -3
- package/dist/components/IconButton/IconButton.svelte.d.ts +1 -0
- package/dist/components/Kbd/Kbd.svelte.d.ts +4 -2
- package/dist/components/Label/Label.svelte +12 -0
- package/dist/components/Label/Label.svelte.d.ts +4 -0
- package/dist/components/Link/Link.svelte.d.ts +4 -2
- package/dist/components/LoadingSpinner/LoadingSpinner.svelte.d.ts +4 -2
- package/dist/components/Logo/Logo.svelte.d.ts +6 -4
- package/dist/components/Modal/Modal.svelte +10 -9
- package/dist/components/Modal/Modal.svelte.d.ts +4 -7
- package/dist/components/Modal/ModalBody.svelte.d.ts +4 -2
- package/dist/components/Modal/ModalFooter.svelte.d.ts +4 -2
- package/dist/components/Modal/ModalHeader.svelte.d.ts +4 -2
- package/dist/components/MultiSelect/MultiSelect.svelte.d.ts +1 -0
- package/dist/components/Navbar/NavbarGroup.svelte.d.ts +4 -2
- package/dist/components/Navbar/NavbarItem.svelte +2 -2
- package/dist/components/Navbar/NavbarItem.svelte.d.ts +6 -4
- package/dist/components/Scrollable/Scrollable.svelte.d.ts +4 -2
- package/dist/components/Select/Select.svelte.d.ts +1 -0
- package/dist/components/Stack/HStack.svelte.d.ts +1 -0
- package/dist/components/Stack/Stack.svelte.d.ts +1 -0
- package/dist/components/Stack/VStack.svelte.d.ts +1 -0
- package/dist/components/SupporterBadge/SupporterBadge.svelte.d.ts +5 -3
- package/dist/components/Switch/Switch.svelte +20 -12
- package/dist/components/Switch/Switch.svelte.d.ts +5 -2
- package/dist/components/Text/Text.svelte.d.ts +6 -4
- package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +13 -1
- package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte.d.ts +6 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/internal/Button.svelte +35 -10
- package/dist/internal/Button.svelte.d.ts +4 -2
- package/dist/internal/Child.svelte.d.ts +4 -2
- package/dist/internal/Select.svelte +5 -22
- package/dist/internal/Select.svelte.d.ts +8 -5
- package/dist/services/translation.svelte.d.ts +1 -0
- package/dist/services/translation.svelte.js +1 -0
- package/dist/styles.d.ts +122 -0
- package/dist/styles.js +24 -0
- package/dist/types.d.ts +13 -2
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/components/Form/Label.svelte +0 -19
- package/dist/components/Form/Label.svelte.d.ts +0 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Color, Size } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
size?: Size;
|
|
6
6
|
color?: Color;
|
|
7
7
|
class?: string;
|
|
8
8
|
children?: Snippet;
|
|
9
|
-
} & HTMLAttributes<HTMLElement
|
|
9
|
+
} & HTMLAttributes<HTMLElement>;
|
|
10
|
+
declare const Kbd: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Kbd = ReturnType<typeof Kbd>;
|
|
10
12
|
export default Kbd;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { styles } from '../../styles.js';
|
|
3
|
+
import type { LabelProps } from '../../types.js';
|
|
4
|
+
import { cleanClass } from '../../utils.js';
|
|
5
|
+
|
|
6
|
+
const { label, size, color, class: className, children, ...restProps }: LabelProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<label class={cleanClass(styles.label({ size, color }), className)} {...restProps}>
|
|
10
|
+
{#if label}{label}{/if}
|
|
11
|
+
{@render children?.()}
|
|
12
|
+
</label>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
class?: string;
|
|
5
5
|
children: Snippet;
|
|
6
6
|
href: string;
|
|
7
|
-
} & HTMLAnchorAttributes
|
|
7
|
+
} & HTMLAnchorAttributes;
|
|
8
|
+
declare const Link: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type Link = ReturnType<typeof Link>;
|
|
8
10
|
export default Link;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Color, Size } from '../../types.js';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
size?: Size;
|
|
4
4
|
color?: Color;
|
|
5
5
|
class?: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
declare const LoadingSpinner: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type LoadingSpinner = ReturnType<typeof LoadingSpinner>;
|
|
7
9
|
export default LoadingSpinner;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Size } from '../../types.js';
|
|
2
|
-
|
|
3
|
-
size?: Size |
|
|
4
|
-
variant?:
|
|
2
|
+
type Props = {
|
|
3
|
+
size?: Size | 'landing';
|
|
4
|
+
variant?: 'stacked' | 'inline' | 'logo' | 'icon';
|
|
5
5
|
class?: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const Logo: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Logo = ReturnType<typeof Logo>;
|
|
7
9
|
export default Logo;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { type Snippet } from 'svelte';
|
|
14
14
|
import { tv } from 'tailwind-variants';
|
|
15
15
|
|
|
16
|
-
type Props =
|
|
16
|
+
type Props = {
|
|
17
17
|
title: string;
|
|
18
18
|
size?: ModalSize;
|
|
19
19
|
class?: string;
|
|
@@ -26,11 +26,10 @@
|
|
|
26
26
|
let {
|
|
27
27
|
title,
|
|
28
28
|
size = 'medium',
|
|
29
|
-
open =
|
|
29
|
+
open = true,
|
|
30
30
|
onClose,
|
|
31
31
|
class: className,
|
|
32
32
|
children,
|
|
33
|
-
...restProps
|
|
34
33
|
}: Props = $props();
|
|
35
34
|
|
|
36
35
|
const modalStyles = tv({
|
|
@@ -51,14 +50,14 @@
|
|
|
51
50
|
const bodyChildren = $derived(getChildSnippet(ChildKey.ModalBody));
|
|
52
51
|
const footerChildren = $derived(getChildSnippet(ChildKey.ModalFooter));
|
|
53
52
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const onChange = (value: boolean) => {
|
|
54
|
+
if (!value) {
|
|
55
|
+
onClose?.();
|
|
56
|
+
}
|
|
58
57
|
};
|
|
59
58
|
</script>
|
|
60
59
|
|
|
61
|
-
<Dialog.Root
|
|
60
|
+
<Dialog.Root {open} onOpenChange={onChange}>
|
|
62
61
|
<Dialog.Portal>
|
|
63
62
|
<Dialog.Overlay class="absolute left-0 top-0 flex h-dvh w-screen backdrop-blur" />
|
|
64
63
|
<Dialog.Content
|
|
@@ -71,7 +70,9 @@
|
|
|
71
70
|
<CardHeader class="border-0 py-2">
|
|
72
71
|
<div class="flex items-center justify-between">
|
|
73
72
|
<CardTitle>{title}</CardTitle>
|
|
74
|
-
<
|
|
73
|
+
<Dialog.Close>
|
|
74
|
+
<CloseButton size="large" onclick={() => onChange(false)} />
|
|
75
|
+
</Dialog.Close>
|
|
75
76
|
</div>
|
|
76
77
|
</CardHeader>
|
|
77
78
|
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { ModalSize } from '../../types.js';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
open?: boolean;
|
|
5
|
-
onOpenChange?: import("bits-ui/dist/internal/types").OnChangeFn<boolean>;
|
|
6
|
-
} & {
|
|
7
|
-
children?: Snippet | undefined;
|
|
8
|
-
} & {
|
|
3
|
+
type Props = {
|
|
9
4
|
title: string;
|
|
10
5
|
size?: ModalSize;
|
|
11
6
|
class?: string;
|
|
@@ -13,5 +8,7 @@ declare const Modal: import("svelte").Component<{
|
|
|
13
8
|
expandable?: boolean;
|
|
14
9
|
children: Snippet;
|
|
15
10
|
onClose?: () => void;
|
|
16
|
-
}
|
|
11
|
+
};
|
|
12
|
+
declare const Modal: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type Modal = ReturnType<typeof Modal>;
|
|
17
14
|
export default Modal;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
|
+
declare const ModalBody: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type ModalBody = ReturnType<typeof ModalBody>;
|
|
5
7
|
export default ModalBody;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
|
+
declare const ModalFooter: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type ModalFooter = ReturnType<typeof ModalFooter>;
|
|
5
7
|
export default ModalFooter;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
|
+
declare const ModalHeader: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type ModalHeader = ReturnType<typeof ModalHeader>;
|
|
5
7
|
export default ModalHeader;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
isActive?: () => boolean;
|
|
13
13
|
} & { icon?: string & Omit<IconProps, 'icon'> };
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const matchesPath = () => page.url.pathname === href;
|
|
16
16
|
|
|
17
17
|
let {
|
|
18
18
|
href,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
...iconProps
|
|
24
24
|
}: Props = $props();
|
|
25
25
|
|
|
26
|
-
const isActive = isActiveOverride ??
|
|
26
|
+
const isActive = isActiveOverride ?? matchesPath;
|
|
27
27
|
let active = $derived(activeOverride ?? isActive());
|
|
28
28
|
|
|
29
29
|
const styles = tv({
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { IconProps } from '../../types.js';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
title: string;
|
|
4
4
|
active?: boolean;
|
|
5
5
|
href: string;
|
|
6
|
-
variant?:
|
|
6
|
+
variant?: 'compact';
|
|
7
7
|
isActive?: () => boolean;
|
|
8
8
|
} & {
|
|
9
|
-
icon?: string & Omit<IconProps,
|
|
10
|
-
}
|
|
9
|
+
icon?: string & Omit<IconProps, 'icon'>;
|
|
10
|
+
};
|
|
11
|
+
declare const NavbarItem: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type NavbarItem = ReturnType<typeof NavbarItem>;
|
|
11
13
|
export default NavbarItem;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children?: Snippet;
|
|
5
5
|
transition?: TransitionEvent;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const Scrollable: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Scrollable = ReturnType<typeof Scrollable>;
|
|
7
9
|
export default Scrollable;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Size } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
effect?:
|
|
3
|
+
type Props = {
|
|
4
|
+
effect?: 'hover' | 'always';
|
|
5
5
|
text?: string;
|
|
6
6
|
size?: Size;
|
|
7
7
|
children?: Snippet;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
declare const SupporterBadge: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type SupporterBadge = ReturnType<typeof SupporterBadge>;
|
|
9
11
|
export default SupporterBadge;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getFieldContext } from '../../common/context.svelte.js';
|
|
3
|
+
import Label from '../Label/Label.svelte';
|
|
3
4
|
import type { Color } from '../../types.js';
|
|
4
|
-
import { cleanClass } from '../../utils.js';
|
|
5
|
+
import { cleanClass, generateId } from '../../utils.js';
|
|
5
6
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
6
7
|
import { tv } from 'tailwind-variants';
|
|
7
8
|
|
|
@@ -11,22 +12,19 @@
|
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
class?: string;
|
|
13
14
|
onToggle?: ((checked: boolean) => void) | undefined;
|
|
14
|
-
|
|
15
|
+
inputSize?: HTMLInputAttributes['size'];
|
|
16
|
+
} & Omit<HTMLInputAttributes, 'size'>;
|
|
15
17
|
|
|
16
18
|
let {
|
|
17
19
|
checked = $bindable(false),
|
|
18
20
|
class: className,
|
|
19
21
|
color = 'primary',
|
|
20
22
|
onToggle = undefined,
|
|
23
|
+
inputSize,
|
|
21
24
|
...restProps
|
|
22
25
|
}: Props = $props();
|
|
23
26
|
|
|
24
|
-
const {
|
|
25
|
-
label,
|
|
26
|
-
readOnly = false,
|
|
27
|
-
required = false,
|
|
28
|
-
disabled = false,
|
|
29
|
-
} = $derived(getFieldContext());
|
|
27
|
+
const { readOnly, required, disabled, label, ...labelProps } = $derived(getFieldContext());
|
|
30
28
|
|
|
31
29
|
const enabled = $derived(checked && !disabled);
|
|
32
30
|
|
|
@@ -75,12 +73,21 @@
|
|
|
75
73
|
},
|
|
76
74
|
},
|
|
77
75
|
});
|
|
76
|
+
|
|
77
|
+
const id = generateId();
|
|
78
|
+
const inputId = `input-${id}`;
|
|
79
|
+
const labelId = `label-${id}`;
|
|
78
80
|
</script>
|
|
79
81
|
|
|
80
|
-
<
|
|
81
|
-
{label}
|
|
82
|
-
|
|
82
|
+
<div class="flex w-full justify-between gap-1">
|
|
83
|
+
{#if label}
|
|
84
|
+
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
<span class={cleanClass(wrapper({ disabled }), className)}>
|
|
83
88
|
<input
|
|
89
|
+
id={inputId}
|
|
90
|
+
aria-labelledby={label && labelId}
|
|
84
91
|
class="hidden"
|
|
85
92
|
type="checkbox"
|
|
86
93
|
bind:checked
|
|
@@ -91,9 +98,10 @@
|
|
|
91
98
|
aria-disabled={disabled}
|
|
92
99
|
readonly={readOnly}
|
|
93
100
|
aria-readonly={readOnly}
|
|
101
|
+
size={inputSize}
|
|
94
102
|
{...restProps}
|
|
95
103
|
/>
|
|
96
104
|
<span class={bar({ fillColor: enabled ? color : 'default' })}> </span>
|
|
97
105
|
<span class={dot({ checked: enabled, fillColor: enabled ? color : 'default' })}></span>
|
|
98
106
|
</span>
|
|
99
|
-
</
|
|
107
|
+
</div>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Color } from '../../types.js';
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
checked?: boolean;
|
|
5
5
|
color?: Color;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
class?: string;
|
|
8
8
|
onToggle?: ((checked: boolean) => void) | undefined;
|
|
9
|
-
|
|
9
|
+
inputSize?: HTMLInputAttributes['size'];
|
|
10
|
+
} & Omit<HTMLInputAttributes, 'size'>;
|
|
11
|
+
declare const Switch: import("svelte").Component<Props, {}, "checked">;
|
|
12
|
+
type Switch = ReturnType<typeof Switch>;
|
|
10
13
|
export default Switch;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Size, TextColor } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
color?: TextColor;
|
|
5
5
|
class?: string;
|
|
6
6
|
size?: Size;
|
|
7
7
|
children: Snippet;
|
|
8
|
-
variant?:
|
|
9
|
-
fontWeight?:
|
|
10
|
-
}
|
|
8
|
+
variant?: 'italic';
|
|
9
|
+
fontWeight?: 'light' | 'normal' | 'semi-bold' | 'bold';
|
|
10
|
+
};
|
|
11
|
+
declare const Text: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Text = ReturnType<typeof Text>;
|
|
11
13
|
export default Text;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import IconButton from '../IconButton/IconButton.svelte';
|
|
3
3
|
import { theme } from '../../services/theme.svelte.js';
|
|
4
|
-
import {
|
|
4
|
+
import { t } from '../../services/translation.svelte.js';
|
|
5
|
+
import {
|
|
6
|
+
Theme,
|
|
7
|
+
type Color,
|
|
8
|
+
type Size,
|
|
9
|
+
type TranslationProps,
|
|
10
|
+
type Variants,
|
|
11
|
+
} from '../../types.js';
|
|
5
12
|
import { cleanClass } from '../../utils.js';
|
|
6
13
|
import { mdiWeatherNight, mdiWeatherSunny } from '@mdi/js';
|
|
7
14
|
|
|
@@ -10,6 +17,7 @@
|
|
|
10
17
|
class?: string;
|
|
11
18
|
color?: Color;
|
|
12
19
|
variant?: Variants;
|
|
20
|
+
translations?: TranslationProps<'darkTheme'>;
|
|
13
21
|
onChange?: (theme: Theme) => void;
|
|
14
22
|
};
|
|
15
23
|
|
|
@@ -18,6 +26,7 @@
|
|
|
18
26
|
variant = 'ghost',
|
|
19
27
|
size,
|
|
20
28
|
class: className,
|
|
29
|
+
translations,
|
|
21
30
|
onChange,
|
|
22
31
|
}: Props = $props();
|
|
23
32
|
|
|
@@ -37,4 +46,7 @@
|
|
|
37
46
|
icon={themeIcon}
|
|
38
47
|
onclick={handleToggleTheme}
|
|
39
48
|
class={cleanClass(className)}
|
|
49
|
+
aria-label={t('darkTheme', translations)}
|
|
50
|
+
role="switch"
|
|
51
|
+
aria-checked={theme.value === Theme.Dark}
|
|
40
52
|
/>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { Theme, type Color, type Size, type Variants } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import { Theme, type Color, type Size, type TranslationProps, type Variants } from '../../types.js';
|
|
2
|
+
type Props = {
|
|
3
3
|
size?: Size;
|
|
4
4
|
class?: string;
|
|
5
5
|
color?: Color;
|
|
6
6
|
variant?: Variants;
|
|
7
|
+
translations?: TranslationProps<'darkTheme'>;
|
|
7
8
|
onChange?: (theme: Theme) => void;
|
|
8
|
-
}
|
|
9
|
+
};
|
|
10
|
+
declare const ThemeSwitcher: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type ThemeSwitcher = ReturnType<typeof ThemeSwitcher>;
|
|
9
12
|
export default ThemeSwitcher;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,17 +21,18 @@ export { default as CardHeader } from './components/Card/CardHeader.svelte';
|
|
|
21
21
|
export { default as CardTitle } from './components/Card/CardTitle.svelte';
|
|
22
22
|
export { default as CloseButton } from './components/CloseButton/CloseButton.svelte';
|
|
23
23
|
export { default as Code } from './components/Code/Code.svelte';
|
|
24
|
+
export { default as Container } from './components/Container/Container.svelte';
|
|
24
25
|
export { default as Checkbox } from './components/Form/Checkbox.svelte';
|
|
25
26
|
export { default as Field } from './components/Form/Field.svelte';
|
|
26
27
|
export { default as HelperText } from './components/Form/HelperText.svelte';
|
|
27
28
|
export { default as Input } from './components/Form/Input.svelte';
|
|
28
|
-
export { default as Label } from './components/Form/Label.svelte';
|
|
29
29
|
export { default as PasswordInput } from './components/Form/PasswordInput.svelte';
|
|
30
30
|
export { default as FormatBytes } from './components/FormatBytes/FormatBytes.svelte';
|
|
31
31
|
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
32
32
|
export { default as Icon } from './components/Icon/Icon.svelte';
|
|
33
33
|
export { default as IconButton } from './components/IconButton/IconButton.svelte';
|
|
34
34
|
export { default as Kbd } from './components/Kbd/Kbd.svelte';
|
|
35
|
+
export { default as Label } from './components/Label/Label.svelte';
|
|
35
36
|
export { default as Link } from './components/Link/Link.svelte';
|
|
36
37
|
export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
|
|
37
38
|
export { default as Logo } from './components/Logo/Logo.svelte';
|
|
@@ -51,6 +52,6 @@ export { default as Switch } from './components/Switch/Switch.svelte';
|
|
|
51
52
|
export { default as Text } from './components/Text/Text.svelte';
|
|
52
53
|
export { default as ThemeSwitcher } from './components/ThemeSwitcher/ThemeSwitcher.svelte';
|
|
53
54
|
export * from './services/theme.svelte.js';
|
|
55
|
+
export * from './services/translation.svelte.js';
|
|
54
56
|
export * from './types.js';
|
|
55
57
|
export * from './utilities/byte-units.js';
|
|
56
|
-
export * from './services/translation.svelte.js';
|
package/dist/index.js
CHANGED
|
@@ -23,17 +23,18 @@ export { default as CardHeader } from './components/Card/CardHeader.svelte';
|
|
|
23
23
|
export { default as CardTitle } from './components/Card/CardTitle.svelte';
|
|
24
24
|
export { default as CloseButton } from './components/CloseButton/CloseButton.svelte';
|
|
25
25
|
export { default as Code } from './components/Code/Code.svelte';
|
|
26
|
+
export { default as Container } from './components/Container/Container.svelte';
|
|
26
27
|
export { default as Checkbox } from './components/Form/Checkbox.svelte';
|
|
27
28
|
export { default as Field } from './components/Form/Field.svelte';
|
|
28
29
|
export { default as HelperText } from './components/Form/HelperText.svelte';
|
|
29
30
|
export { default as Input } from './components/Form/Input.svelte';
|
|
30
|
-
export { default as Label } from './components/Form/Label.svelte';
|
|
31
31
|
export { default as PasswordInput } from './components/Form/PasswordInput.svelte';
|
|
32
32
|
export { default as FormatBytes } from './components/FormatBytes/FormatBytes.svelte';
|
|
33
33
|
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
34
34
|
export { default as Icon } from './components/Icon/Icon.svelte';
|
|
35
35
|
export { default as IconButton } from './components/IconButton/IconButton.svelte';
|
|
36
36
|
export { default as Kbd } from './components/Kbd/Kbd.svelte';
|
|
37
|
+
export { default as Label } from './components/Label/Label.svelte';
|
|
37
38
|
export { default as Link } from './components/Link/Link.svelte';
|
|
38
39
|
export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
|
|
39
40
|
export { default as Logo } from './components/Logo/Logo.svelte';
|
|
@@ -54,6 +55,6 @@ export { default as Text } from './components/Text/Text.svelte';
|
|
|
54
55
|
export { default as ThemeSwitcher } from './components/ThemeSwitcher/ThemeSwitcher.svelte';
|
|
55
56
|
// helpers
|
|
56
57
|
export * from './services/theme.svelte.js';
|
|
58
|
+
export * from './services/translation.svelte.js';
|
|
57
59
|
export * from './types.js';
|
|
58
60
|
export * from './utilities/byte-units.js';
|
|
59
|
-
export * from './services/translation.svelte.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Icon from '../components/Icon/Icon.svelte';
|
|
2
3
|
import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner.svelte';
|
|
3
4
|
import type { ButtonProps, Size } from '../types.js';
|
|
4
5
|
import { cleanClass } from '../utils.js';
|
|
@@ -21,6 +22,8 @@
|
|
|
21
22
|
size = 'medium',
|
|
22
23
|
loading = false,
|
|
23
24
|
fullWidth = false,
|
|
25
|
+
leadingIcon,
|
|
26
|
+
trailingIcon,
|
|
24
27
|
icon = false,
|
|
25
28
|
class: className = '',
|
|
26
29
|
children,
|
|
@@ -30,8 +33,12 @@
|
|
|
30
33
|
const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
|
|
31
34
|
|
|
32
35
|
const buttonVariants = tv({
|
|
33
|
-
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-
|
|
36
|
+
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-1 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
34
37
|
variants: {
|
|
38
|
+
disabled: {
|
|
39
|
+
true: 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50',
|
|
40
|
+
false: '',
|
|
41
|
+
},
|
|
35
42
|
shape: {
|
|
36
43
|
rectangle: 'rounded-none',
|
|
37
44
|
'semi-round': 'rounded-xl',
|
|
@@ -55,11 +62,11 @@
|
|
|
55
62
|
giant: 'text-xl',
|
|
56
63
|
},
|
|
57
64
|
iconSize: {
|
|
58
|
-
tiny: 'h-
|
|
59
|
-
small: 'h-
|
|
60
|
-
medium: '
|
|
61
|
-
large: 'h-
|
|
62
|
-
giant: 'h-
|
|
65
|
+
tiny: 'h-6 w-6',
|
|
66
|
+
small: 'h-8 w-8',
|
|
67
|
+
medium: 'h-10 w-10',
|
|
68
|
+
large: 'h-12 w-12',
|
|
69
|
+
giant: 'h-14 w-14',
|
|
63
70
|
},
|
|
64
71
|
roundedSize: {
|
|
65
72
|
tiny: 'rounded-lg',
|
|
@@ -112,6 +119,7 @@
|
|
|
112
119
|
textPadding: icon ? undefined : size,
|
|
113
120
|
textSize: size,
|
|
114
121
|
iconSize: icon ? size : undefined,
|
|
122
|
+
disabled,
|
|
115
123
|
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
116
124
|
filledColor: variant === 'filled' ? color : undefined,
|
|
117
125
|
outlineColor: variant === 'outline' ? color : undefined,
|
|
@@ -123,9 +131,26 @@
|
|
|
123
131
|
);
|
|
124
132
|
</script>
|
|
125
133
|
|
|
134
|
+
{#snippet content()}
|
|
135
|
+
{#if leadingIcon && !loading}
|
|
136
|
+
<Icon size="1.15rem" icon={leadingIcon} aria-hidden />
|
|
137
|
+
{/if}
|
|
138
|
+
{@render children?.()}
|
|
139
|
+
{#if trailingIcon}
|
|
140
|
+
<Icon size="1.15rem" icon={trailingIcon} aria-hidden />
|
|
141
|
+
{/if}
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
126
144
|
{#if href}
|
|
127
|
-
<a {href} class={classList} {...restProps as HTMLAnchorAttributes}>
|
|
128
|
-
{
|
|
145
|
+
<a {href} class={classList} aria-disabled={disabled} {...restProps as HTMLAnchorAttributes}>
|
|
146
|
+
{#if loading}
|
|
147
|
+
<div class="flex items-center justify-center gap-2">
|
|
148
|
+
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
149
|
+
{@render content()}
|
|
150
|
+
</div>
|
|
151
|
+
{:else}
|
|
152
|
+
{@render content()}
|
|
153
|
+
{/if}
|
|
129
154
|
</a>
|
|
130
155
|
{:else}
|
|
131
156
|
<ButtonPrimitive.Root
|
|
@@ -138,10 +163,10 @@
|
|
|
138
163
|
{#if loading}
|
|
139
164
|
<div class="flex items-center justify-center gap-2">
|
|
140
165
|
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
141
|
-
{@render
|
|
166
|
+
{@render content()}
|
|
142
167
|
</div>
|
|
143
168
|
{:else}
|
|
144
|
-
{@render
|
|
169
|
+
{@render content()}
|
|
145
170
|
{/if}
|
|
146
171
|
</ButtonPrimitive.Root>
|
|
147
172
|
{/if}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ButtonProps } from '../types.js';
|
|
2
|
-
|
|
2
|
+
type InternalButtonProps = ButtonProps & {
|
|
3
3
|
/** when true, button width to height ratio is 1:1 */
|
|
4
4
|
icon?: boolean;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const Button: import("svelte").Component<InternalButtonProps, {}, "">;
|
|
7
|
+
type Button = ReturnType<typeof Button>;
|
|
6
8
|
export default Button;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ChildKey } from '../constants.js';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
for: ChildKey;
|
|
5
5
|
as: ChildKey;
|
|
6
6
|
class?: string;
|
|
7
7
|
children: Snippet;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
declare const Child: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Child = ReturnType<typeof Child>;
|
|
9
11
|
export default Child;
|