@immich/ui 0.15.0 → 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 +1 -0
- 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 +7 -7
- 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 +11 -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,4 +1,11 @@
|
|
|
1
1
|
import type { FieldContext } from '../types.js';
|
|
2
2
|
export declare const setFieldContext: (field: FieldContext) => FieldContext;
|
|
3
3
|
export declare const hasFieldContext: () => boolean;
|
|
4
|
-
export declare const getFieldContext: () =>
|
|
4
|
+
export declare const getFieldContext: () => {
|
|
5
|
+
label: string | undefined;
|
|
6
|
+
color: "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "muted";
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
readOnly: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
};
|
|
@@ -3,4 +3,7 @@ import { getContext, hasContext, setContext } from 'svelte';
|
|
|
3
3
|
const fieldKey = Symbol(withPrefix('field'));
|
|
4
4
|
export const setFieldContext = (field) => setContext(fieldKey, field);
|
|
5
5
|
export const hasFieldContext = () => hasContext(fieldKey);
|
|
6
|
-
export const getFieldContext = () =>
|
|
6
|
+
export const getFieldContext = () => {
|
|
7
|
+
const { label, color = 'secondary', invalid = false, readOnly = false, required = false, disabled = false, } = getContext(fieldKey) || {};
|
|
8
|
+
return { label, color, invalid, readOnly, required, disabled };
|
|
9
|
+
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
mdiAlertOutline,
|
|
11
11
|
mdiCheckCircleOutline,
|
|
12
12
|
mdiCloseCircleOutline,
|
|
13
|
-
|
|
13
|
+
mdiInformationVariantCircleOutline,
|
|
14
14
|
} from '@mdi/js';
|
|
15
15
|
import type { Snippet } from 'svelte';
|
|
16
16
|
|
|
@@ -73,7 +73,9 @@
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
const icon = $derived(
|
|
76
|
-
iconOverride === false
|
|
76
|
+
iconOverride === false
|
|
77
|
+
? undefined
|
|
78
|
+
: iconOverride || (icons[color] ?? mdiInformationVariantCircleOutline),
|
|
77
79
|
);
|
|
78
80
|
</script>
|
|
79
81
|
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
</div>
|
|
89
91
|
{/if}
|
|
90
92
|
|
|
91
|
-
<div class="flex flex-col gap-2">
|
|
93
|
+
<div class="flex flex-col gap-2 self-center">
|
|
92
94
|
{#if title}
|
|
93
95
|
<Text {size} fontWeight={children ? 'bold' : undefined}>{title}</Text>
|
|
94
96
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Color, Size } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
color?: Color;
|
|
5
5
|
size?: Size;
|
|
6
6
|
icon?: string | false;
|
|
@@ -11,5 +11,7 @@ declare const Alert: import("svelte").Component<{
|
|
|
11
11
|
controlled?: boolean;
|
|
12
12
|
onClose?: () => void;
|
|
13
13
|
children?: Snippet;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
|
+
declare const Alert: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type Alert = ReturnType<typeof Alert>;
|
|
15
17
|
export default Alert;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children?: Snippet;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const AppShell: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type AppShell = ReturnType<typeof AppShell>;
|
|
6
8
|
export default AppShell;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
|
+
declare const AppShellHeader: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type AppShellHeader = ReturnType<typeof AppShellHeader>;
|
|
5
7
|
export default AppShellHeader;
|
|
@@ -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
|
noBorder?: boolean;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const AppShellSidebar: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type AppShellSidebar = ReturnType<typeof AppShellSidebar>;
|
|
7
9
|
export default AppShellSidebar;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
description?: string | undefined;
|
|
5
5
|
scrollbar?: boolean;
|
|
6
6
|
buttons?: Snippet;
|
|
7
7
|
children?: Snippet;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
declare const PageLayout: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type PageLayout = ReturnType<typeof PageLayout>;
|
|
9
11
|
export default PageLayout;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Size } from '../../types.js';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
size?: Size;
|
|
4
|
-
color?:
|
|
4
|
+
color?: 'primary' | 'pink' | 'red' | 'yellow' | 'blue' | 'green' | 'purple' | 'orange' | 'gray' | 'amber';
|
|
5
5
|
name: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const Avatar: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Avatar = ReturnType<typeof Avatar>;
|
|
7
9
|
export default Avatar;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Color } from '../../types.js';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
4
|
+
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
color?: Color;
|
|
6
|
-
shape?:
|
|
6
|
+
shape?: 'round' | 'rectangle';
|
|
7
7
|
expanded?: boolean;
|
|
8
8
|
expandable?: boolean;
|
|
9
9
|
children: Snippet;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
|
+
declare const Card: import("svelte").Component<Props, {}, "expanded">;
|
|
12
|
+
type Card = ReturnType<typeof Card>;
|
|
11
13
|
export default Card;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children: Snippet;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const CardBody: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CardBody = ReturnType<typeof CardBody>;
|
|
6
8
|
export default CardBody;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children: Snippet;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const CardDescription: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CardDescription = ReturnType<typeof CardDescription>;
|
|
6
8
|
export default CardDescription;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children: Snippet;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const CardFooter: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CardFooter = ReturnType<typeof CardFooter>;
|
|
6
8
|
export default CardFooter;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
class?: string;
|
|
4
4
|
children: Snippet;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const CardHeader: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CardHeader = ReturnType<typeof CardHeader>;
|
|
6
8
|
export default CardHeader;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { HeadingSize } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
class?: string;
|
|
5
5
|
size?: HeadingSize;
|
|
6
6
|
children: Snippet;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
declare const CardTitle: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type CardTitle = ReturnType<typeof CardTitle>;
|
|
8
10
|
export default CardTitle;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Size, TextColor } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
color?: TextColor;
|
|
6
6
|
size?: Size;
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: 'filled';
|
|
8
8
|
class?: string;
|
|
9
9
|
children: Snippet;
|
|
10
|
-
} & HTMLAttributes<HTMLElement
|
|
10
|
+
} & HTMLAttributes<HTMLElement>;
|
|
11
|
+
declare const Code: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Code = ReturnType<typeof Code>;
|
|
11
13
|
export default Code;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Size } from '../../types.js';
|
|
3
|
+
import { cleanClass } from '../../utils.js';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
size?: Size | 'full';
|
|
9
|
+
class?: string;
|
|
10
|
+
center?: boolean;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { center, class: className, size = 'full', children }: Props = $props();
|
|
15
|
+
|
|
16
|
+
const styles = tv({
|
|
17
|
+
base: '',
|
|
18
|
+
variants: {
|
|
19
|
+
size: {
|
|
20
|
+
tiny: 'max-w-lg',
|
|
21
|
+
small: 'max-w-screen-sm',
|
|
22
|
+
medium: 'max-w-screen-md',
|
|
23
|
+
large: 'max-w-screen-lg',
|
|
24
|
+
giant: 'max-w-screen-xl',
|
|
25
|
+
full: 'w-full',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<div class={cleanClass(styles({ size }), center && 'mx-auto w-full', className)}>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Size } from '../../types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
size?: Size | 'full';
|
|
5
|
+
class?: string;
|
|
6
|
+
center?: boolean;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const Container: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Container = ReturnType<typeof Container>;
|
|
11
|
+
export default Container;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getFieldContext } from '../../common/context.svelte.js';
|
|
3
3
|
import Icon from '../Icon/Icon.svelte';
|
|
4
|
+
import Label from '../Label/Label.svelte';
|
|
4
5
|
import type { Color, Shape, Size } from '../../types.js';
|
|
5
6
|
import { cleanClass, generateId } from '../../utils.js';
|
|
6
7
|
import { mdiCheck, mdiMinus } from '@mdi/js';
|
|
@@ -23,13 +24,8 @@
|
|
|
23
24
|
...restProps
|
|
24
25
|
}: CheckboxProps = $props();
|
|
25
26
|
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
readOnly = false,
|
|
29
|
-
required = false,
|
|
30
|
-
invalid = false,
|
|
31
|
-
disabled = false,
|
|
32
|
-
} = $derived(getFieldContext());
|
|
27
|
+
const { readOnly, required, invalid, disabled, label, ...labelProps } =
|
|
28
|
+
$derived(getFieldContext());
|
|
33
29
|
|
|
34
30
|
const containerStyles = tv({
|
|
35
31
|
base: 'ring-offset-background focus-visible:ring-ring peer box-content overflow-hidden border-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[state=checked]:bg-primary data-[disabled=true]:opacity-50',
|
|
@@ -80,19 +76,6 @@
|
|
|
80
76
|
},
|
|
81
77
|
});
|
|
82
78
|
|
|
83
|
-
const labelStyles = tv({
|
|
84
|
-
base: '',
|
|
85
|
-
variants: {
|
|
86
|
-
size: {
|
|
87
|
-
tiny: 'text-xs',
|
|
88
|
-
small: 'text-sm',
|
|
89
|
-
medium: 'text-md',
|
|
90
|
-
large: 'text-lg',
|
|
91
|
-
giant: 'text-xl',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
79
|
const id = generateId();
|
|
97
80
|
const inputId = `input-${id}`;
|
|
98
81
|
const labelId = `label-${id}`;
|
|
@@ -100,7 +83,7 @@
|
|
|
100
83
|
|
|
101
84
|
<div class="flex flex-col gap-1">
|
|
102
85
|
{#if label}
|
|
103
|
-
<
|
|
86
|
+
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
104
87
|
{/if}
|
|
105
88
|
|
|
106
89
|
<CheckboxPrimitive.Root
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Color, Shape, Size } from '../../types.js';
|
|
2
|
-
import { Checkbox as CheckboxPrimitive } from 'bits-ui';
|
|
3
|
-
|
|
2
|
+
import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
type CheckboxProps = WithoutChildrenOrChild<CheckboxPrimitive.RootProps> & {
|
|
4
4
|
color?: Color;
|
|
5
5
|
shape?: Shape;
|
|
6
6
|
size?: Size;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "checked" | "ref">;
|
|
9
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
8
10
|
export default Checkbox;
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
import { type Snippet } from 'svelte';
|
|
8
8
|
|
|
9
9
|
type Props = FieldContext & {
|
|
10
|
+
class?: string;
|
|
10
11
|
children: Snippet;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
const { children, ...props }: Props = $props();
|
|
14
|
+
const { class: className, children, ...props }: Props = $props();
|
|
14
15
|
|
|
15
16
|
const state = $state(props);
|
|
16
17
|
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
const helperTextChildren = $derived(getChildSnippet(ChildKey.HelperText));
|
|
21
22
|
</script>
|
|
22
23
|
|
|
23
|
-
<div class=
|
|
24
|
+
<div class={cleanClass('w-full', className)}>
|
|
24
25
|
{@render children()}
|
|
25
26
|
{#if helperTextChildren}
|
|
26
27
|
<div class={cleanClass('pt-1', helperTextChildren.class)}>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { FieldContext } from '../../types.js';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
type Props = FieldContext & {
|
|
4
|
+
class?: string;
|
|
4
5
|
children: Snippet;
|
|
5
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const Field: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Field = ReturnType<typeof Field>;
|
|
6
9
|
export default Field;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { 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
|
children?: Snippet;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
declare const HelperText: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type HelperText = ReturnType<typeof HelperText>;
|
|
8
10
|
export default HelperText;
|
|
@@ -1,5 +1,6 @@
|
|
|
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 { InputProps } from '../../types.js';
|
|
4
5
|
import { cleanClass, generateId } from '../../utils.js';
|
|
5
6
|
import { tv } from 'tailwind-variants';
|
|
@@ -14,26 +15,8 @@
|
|
|
14
15
|
...restProps
|
|
15
16
|
}: InputProps = $props();
|
|
16
17
|
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
readOnly = false,
|
|
20
|
-
required = false,
|
|
21
|
-
invalid = false,
|
|
22
|
-
disabled = false,
|
|
23
|
-
} = $derived(getFieldContext());
|
|
24
|
-
|
|
25
|
-
const labelStyles = tv({
|
|
26
|
-
base: '',
|
|
27
|
-
variants: {
|
|
28
|
-
size: {
|
|
29
|
-
tiny: 'text-xs',
|
|
30
|
-
small: 'text-sm',
|
|
31
|
-
medium: 'text-md',
|
|
32
|
-
large: 'text-lg',
|
|
33
|
-
giant: 'text-xl',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
18
|
+
const { label, readOnly, required, invalid, disabled, ...labelProps } =
|
|
19
|
+
$derived(getFieldContext());
|
|
37
20
|
|
|
38
21
|
const inputStyles = tv({
|
|
39
22
|
base: 'w-full bg-gray-200 outline-none disabled:cursor-not-allowed disabled:bg-gray-300 disabled:text-gray-200 aria-readonly:text-dark/50 dark:bg-gray-600 dark:disabled:bg-gray-800 dark:aria-readonly:text-dark/75',
|
|
@@ -54,6 +37,14 @@
|
|
|
54
37
|
large: 'rounded-2xl',
|
|
55
38
|
giant: 'rounded-2xl',
|
|
56
39
|
},
|
|
40
|
+
// match with Button `iconSize` variants
|
|
41
|
+
paddingRight: {
|
|
42
|
+
tiny: 'pr-6',
|
|
43
|
+
small: 'pr-8',
|
|
44
|
+
medium: 'pr-10',
|
|
45
|
+
large: 'pr-12',
|
|
46
|
+
giant: 'pr-14',
|
|
47
|
+
},
|
|
57
48
|
textSize: {
|
|
58
49
|
tiny: 'text-xs',
|
|
59
50
|
small: 'text-sm',
|
|
@@ -75,12 +66,12 @@
|
|
|
75
66
|
|
|
76
67
|
<div class="flex w-full flex-col gap-1" bind:this={containerRef}>
|
|
77
68
|
{#if label}
|
|
78
|
-
<
|
|
69
|
+
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
79
70
|
{/if}
|
|
80
71
|
|
|
81
72
|
<div class="relative mt-1.5 w-full">
|
|
82
73
|
<input
|
|
83
|
-
id={
|
|
74
|
+
id={inputId}
|
|
84
75
|
aria-labelledby={label && labelId}
|
|
85
76
|
{required}
|
|
86
77
|
aria-required={required}
|
|
@@ -93,10 +84,10 @@
|
|
|
93
84
|
shape,
|
|
94
85
|
textSize: size,
|
|
95
86
|
padding: shape === 'round' ? 'round' : 'base',
|
|
87
|
+
paddingRight: trailingIcon ? size : undefined,
|
|
96
88
|
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
97
89
|
invalid,
|
|
98
90
|
}),
|
|
99
|
-
trailingIcon && '!pr-10',
|
|
100
91
|
className,
|
|
101
92
|
)}
|
|
102
93
|
bind:value
|
|
@@ -10,22 +10,25 @@
|
|
|
10
10
|
translations,
|
|
11
11
|
isVisible = $bindable<boolean>(false),
|
|
12
12
|
color = 'secondary',
|
|
13
|
+
size,
|
|
13
14
|
...props
|
|
14
15
|
}: PasswordInputProps = $props();
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
|
-
<Input bind:value type={isVisible ? 'text' : 'password'} {color} {...props}>
|
|
18
|
+
<Input bind:value {size} type={isVisible ? 'text' : 'password'} {color} {...props}>
|
|
18
19
|
{#snippet trailingIcon()}
|
|
19
20
|
{#if value?.length > 0}
|
|
20
21
|
<IconButton
|
|
21
22
|
variant="ghost"
|
|
22
23
|
shape="round"
|
|
23
24
|
color="secondary"
|
|
24
|
-
|
|
25
|
+
{size}
|
|
26
|
+
class="mr-1"
|
|
25
27
|
icon={isVisible ? mdiEyeOffOutline : mdiEyeOutline}
|
|
26
28
|
onclick={() => (isVisible = !isVisible)}
|
|
27
29
|
title={isVisible ? t('hidePassword', translations) : t('showPassword', translations)}
|
|
28
|
-
|
|
30
|
+
aria-label={t('showPassword', translations)}
|
|
31
|
+
/>
|
|
29
32
|
{/if}
|
|
30
33
|
{/snippet}
|
|
31
34
|
</Input>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
type Props = {
|
|
2
2
|
bytes: number;
|
|
3
3
|
precision?: number;
|
|
4
|
-
variant?:
|
|
5
|
-
}
|
|
4
|
+
variant?: 'short' | 'narrow';
|
|
5
|
+
};
|
|
6
|
+
declare const FormatBytes: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type FormatBytes = ReturnType<typeof FormatBytes>;
|
|
6
8
|
export default FormatBytes;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { HeadingColor, HeadingSize } 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: HeadingSize;
|
|
6
6
|
color?: HeadingColor;
|
|
7
7
|
class?: string;
|
|
8
8
|
children: Snippet;
|
|
9
|
-
} & HTMLAttributes<HTMLHeadingElement
|
|
9
|
+
} & HTMLAttributes<HTMLHeadingElement>;
|
|
10
|
+
declare const Heading: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Heading = ReturnType<typeof Heading>;
|
|
10
12
|
export default Heading;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IconProps } from '../../types.js';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
3
|
+
type $$ComponentProps = IconProps & HTMLAttributes<EventTarget>;
|
|
4
|
+
declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Icon = ReturnType<typeof Icon>;
|
|
4
6
|
export default Icon;
|
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
import Icon from '../Icon/Icon.svelte';
|
|
4
4
|
import type { IconButtonProps } from '../../types.js';
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
icon,
|
|
8
|
+
flipped,
|
|
9
|
+
flopped,
|
|
10
|
+
title,
|
|
11
|
+
'aria-label': ariaLabel,
|
|
12
|
+
...buttonProps
|
|
13
|
+
}: IconButtonProps = $props();
|
|
14
|
+
|
|
15
|
+
const buttonTitle = title || ariaLabel;
|
|
7
16
|
</script>
|
|
8
17
|
|
|
9
|
-
<Button icon {...buttonProps}>
|
|
10
|
-
<Icon {icon} {flipped} {flopped} size="45%"
|
|
18
|
+
<Button icon {...buttonProps} title={buttonTitle} aria-label={ariaLabel}>
|
|
19
|
+
<Icon {icon} {flipped} {flopped} size="45%" aria-hidden />
|
|
11
20
|
</Button>
|
|
@@ -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;
|