@immich/ui 0.57.1 → 0.57.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/dist/common/context.svelte.d.ts +1 -0
- package/dist/common/context.svelte.js +2 -2
- package/dist/components/Heading/Heading.svelte +7 -7
- package/dist/components/Input/Input.svelte +8 -2
- package/dist/components/Table/Table.svelte +41 -5
- package/dist/components/Table/Table.svelte.d.ts +3 -0
- package/dist/components/Table/TableCell.svelte +7 -4
- package/dist/components/Table/TableCell.svelte.d.ts +2 -1
- package/dist/components/Table/TableHeading.svelte +4 -3
- package/dist/components/Table/TableHeading.svelte.d.ts +2 -1
- package/dist/components/Table/TableRow.svelte +4 -3
- package/dist/components/Table/TableRow.svelte.d.ts +2 -1
- package/dist/internal/Select.svelte +42 -48
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -452,5 +452,6 @@ export declare const getFieldContext: () => () => {
|
|
|
452
452
|
export declare const setTableContext: (context: () => TableContext) => () => TableContext;
|
|
453
453
|
export declare const getTableContext: () => () => {
|
|
454
454
|
spacing: import("../types.js").Size;
|
|
455
|
+
size: import("../types.js").Size;
|
|
455
456
|
striped: boolean;
|
|
456
457
|
};
|
|
@@ -14,7 +14,7 @@ export const setTableContext = (context) => setContext(tableKey, context);
|
|
|
14
14
|
export const getTableContext = () => {
|
|
15
15
|
return () => {
|
|
16
16
|
const context = getContext(tableKey);
|
|
17
|
-
const { spacing = 'medium', striped = false } = context?.() || {};
|
|
18
|
-
return { spacing, striped };
|
|
17
|
+
const { spacing = 'medium', size = 'medium', striped = false } = context?.() || {};
|
|
18
|
+
return { spacing, size, striped };
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Text from '../../internal/Text.svelte';
|
|
2
3
|
import type { FontWeight, HeadingColor, HeadingSize, HeadingTag, TextVariant } from '../../types.js';
|
|
3
4
|
import { cleanClass } from '../../utilities/internal.js';
|
|
4
|
-
import Text from '../../internal/Text.svelte';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
7
|
import { tv } from 'tailwind-variants';
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
base: 'leading-none tracking-tight',
|
|
27
27
|
variants: {
|
|
28
28
|
size: {
|
|
29
|
-
tiny: 'text-base',
|
|
30
|
-
small: 'text-lg',
|
|
31
|
-
medium: 'text-xl',
|
|
32
|
-
large: 'text-3xl',
|
|
33
|
-
giant: 'text-5xl',
|
|
34
|
-
title: 'text-
|
|
29
|
+
tiny: 'text-sm md:text-base',
|
|
30
|
+
small: 'text-lg md:text-xl',
|
|
31
|
+
medium: 'text-xl md:text-2xl',
|
|
32
|
+
large: 'text-3xl md:text-4xl',
|
|
33
|
+
giant: 'text-4xl md:text-5xl',
|
|
34
|
+
title: 'text-5xl md:text-6xl',
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
});
|
|
@@ -49,11 +49,15 @@
|
|
|
49
49
|
true: 'focus-within:ring-danger dark:focus-within:ring-danger dark:ring-danger-300 ring-danger-300 ring-1',
|
|
50
50
|
false: '',
|
|
51
51
|
},
|
|
52
|
+
disabled: {
|
|
53
|
+
true: 'bg-light-300 dark:bg-gray-900',
|
|
54
|
+
false: '',
|
|
55
|
+
},
|
|
52
56
|
},
|
|
53
57
|
});
|
|
54
58
|
|
|
55
59
|
const inputStyles = tv({
|
|
56
|
-
base: cleanClass(styleVariants.inputCommon, 'flex-1 py-2.5'),
|
|
60
|
+
base: cleanClass(styleVariants.inputCommon, 'w-full flex-1 py-2.5'),
|
|
57
61
|
variants: {
|
|
58
62
|
textSize: styleVariants.textSize,
|
|
59
63
|
leadingPadding: {
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
const descriptionId = $derived(description ? `description-${id}` : undefined);
|
|
90
94
|
</script>
|
|
91
95
|
|
|
92
|
-
<div class="flex w-full flex-col gap-1"
|
|
96
|
+
<div class="flex w-full flex-col gap-1">
|
|
93
97
|
{#if label}
|
|
94
98
|
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} {size} />
|
|
95
99
|
{/if}
|
|
@@ -99,8 +103,10 @@
|
|
|
99
103
|
{/if}
|
|
100
104
|
|
|
101
105
|
<div
|
|
106
|
+
bind:this={containerRef}
|
|
102
107
|
class={cleanClass(
|
|
103
108
|
containerStyles({
|
|
109
|
+
disabled,
|
|
104
110
|
shape,
|
|
105
111
|
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
106
112
|
invalid,
|
|
@@ -11,13 +11,26 @@
|
|
|
11
11
|
type Props = {
|
|
12
12
|
class?: string;
|
|
13
13
|
ref?: HTMLTableElement | null;
|
|
14
|
+
rounded?: boolean;
|
|
15
|
+
shape?: 'semi-round' | 'rectangle';
|
|
16
|
+
border?: boolean;
|
|
14
17
|
children?: Snippet;
|
|
15
18
|
} & TableContext &
|
|
16
19
|
Omit<HTMLAttributes<HTMLTableElement>, 'color' | 'size'>;
|
|
17
20
|
|
|
18
|
-
let {
|
|
21
|
+
let {
|
|
22
|
+
ref = $bindable(null),
|
|
23
|
+
class: className,
|
|
24
|
+
size,
|
|
25
|
+
striped = false,
|
|
26
|
+
spacing,
|
|
27
|
+
border = true,
|
|
28
|
+
shape = 'semi-round',
|
|
29
|
+
children,
|
|
30
|
+
...restProps
|
|
31
|
+
}: Props = $props();
|
|
19
32
|
|
|
20
|
-
setTableContext(() => ({ spacing, striped }));
|
|
33
|
+
setTableContext(() => ({ spacing, striped, size }));
|
|
21
34
|
|
|
22
35
|
const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Table);
|
|
23
36
|
const headerChild = $derived(getChildSnippet(ChildKey.TableHeader));
|
|
@@ -28,13 +41,31 @@
|
|
|
28
41
|
base: 'bg-dark-900 flex w-full place-items-center',
|
|
29
42
|
variants: {
|
|
30
43
|
spacing: styleVariants.tableSpacing,
|
|
44
|
+
shape: {
|
|
45
|
+
'semi-round': 'rounded-md',
|
|
46
|
+
rectangle: 'rounded-none',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const commonStyles = tv({
|
|
52
|
+
base: '',
|
|
53
|
+
variants: {
|
|
54
|
+
shape: {
|
|
55
|
+
'semi-round': 'rounded-md',
|
|
56
|
+
rectangle: 'rounded-none',
|
|
57
|
+
},
|
|
58
|
+
border: {
|
|
59
|
+
true: 'border',
|
|
60
|
+
false: '',
|
|
61
|
+
},
|
|
31
62
|
},
|
|
32
63
|
});
|
|
33
64
|
</script>
|
|
34
65
|
|
|
35
66
|
<table bind:this={ref} class={cleanClass('w-full text-center', className)} {...restProps}>
|
|
36
67
|
{#if headerChild}
|
|
37
|
-
<thead class=
|
|
68
|
+
<thead class={cleanClass('text-primary mb-4 flex w-full overflow-hidden', commonStyles({ shape, border }))}>
|
|
38
69
|
<tr class={headerRowStyles({ spacing })}>
|
|
39
70
|
{@render headerChild?.snippet()}
|
|
40
71
|
</tr>
|
|
@@ -42,7 +73,7 @@
|
|
|
42
73
|
{/if}
|
|
43
74
|
|
|
44
75
|
{#if bodyChild}
|
|
45
|
-
<tbody class={cleanClass('block w-full overflow-y-auto
|
|
76
|
+
<tbody class={cleanClass('block w-full overflow-y-auto', bodyChild.class, commonStyles({ shape, border }))}>
|
|
46
77
|
{@render bodyChild?.snippet()}
|
|
47
78
|
</tbody>
|
|
48
79
|
{/if}
|
|
@@ -51,7 +82,12 @@
|
|
|
51
82
|
</table>
|
|
52
83
|
|
|
53
84
|
{#if footerChild}
|
|
54
|
-
<div
|
|
85
|
+
<div
|
|
86
|
+
class={cleanClass(
|
|
87
|
+
'text-primary bg-subtle mt-4 flex h-12 w-full place-items-center p-4',
|
|
88
|
+
commonStyles({ shape, border }),
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
55
91
|
{@render footerChild?.snippet()}
|
|
56
92
|
</div>
|
|
57
93
|
{/if}
|
|
@@ -4,6 +4,9 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
4
4
|
type Props = {
|
|
5
5
|
class?: string;
|
|
6
6
|
ref?: HTMLTableElement | null;
|
|
7
|
+
rounded?: boolean;
|
|
8
|
+
shape?: 'semi-round' | 'rectangle';
|
|
9
|
+
border?: boolean;
|
|
7
10
|
children?: Snippet;
|
|
8
11
|
} & TableContext & Omit<HTMLAttributes<HTMLTableElement>, 'color' | 'size'>;
|
|
9
12
|
declare const Table: import("svelte").Component<Props, {}, "ref">;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getTableContext } from '../../common/context.svelte.js';
|
|
3
|
+
import { styleVariants } from '../../styles.js';
|
|
3
4
|
import { cleanClass } from '../../utilities/internal.js';
|
|
4
5
|
import type { Snippet } from 'svelte';
|
|
6
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
7
|
import { tv } from 'tailwind-variants';
|
|
6
8
|
|
|
7
9
|
type Props = {
|
|
8
10
|
class?: string;
|
|
9
11
|
children?: Snippet;
|
|
10
|
-
}
|
|
12
|
+
} & HTMLAttributes<HTMLTableCellElement>;
|
|
11
13
|
|
|
12
|
-
const { class: className, children }: Props = $props();
|
|
14
|
+
const { class: className, children, ...restProps }: Props = $props();
|
|
13
15
|
|
|
14
16
|
const context = getTableContext();
|
|
15
17
|
|
|
16
|
-
const { spacing } = $derived(context());
|
|
18
|
+
const { spacing, size } = $derived(context());
|
|
17
19
|
|
|
18
20
|
const styles = tv({
|
|
19
21
|
base: 'line-clamp-3 w-full overflow-hidden py-2 break-all text-ellipsis',
|
|
20
22
|
variants: {
|
|
23
|
+
size: styleVariants.textSize,
|
|
21
24
|
spacing: {
|
|
22
25
|
tiny: 'px-0.5',
|
|
23
26
|
small: 'px-1',
|
|
@@ -29,6 +32,6 @@
|
|
|
29
32
|
});
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
|
-
<td class={cleanClass(styles({ spacing }), className)}>
|
|
35
|
+
<td class={cleanClass(styles({ spacing, size }), className)} {...restProps}>
|
|
33
36
|
{@render children?.()}
|
|
34
37
|
</td>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
type Props = {
|
|
3
4
|
class?: string;
|
|
4
5
|
children?: Snippet;
|
|
5
|
-
}
|
|
6
|
+
} & HTMLAttributes<HTMLTableCellElement>;
|
|
6
7
|
declare const TableCell: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type TableCell = ReturnType<typeof TableCell>;
|
|
8
9
|
export default TableCell;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cleanClass } from '../../utilities/internal.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
class?: string;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
+
} & HTMLAttributes<HTMLTableCellElement>;
|
|
9
10
|
|
|
10
|
-
const { class: className, children }: Props = $props();
|
|
11
|
+
const { class: className, children, ...restProps }: Props = $props();
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
|
-
<th class={cleanClass('w-full px-4 py-2', className)}>
|
|
14
|
+
<th class={cleanClass('w-full px-4 py-2', className)} {...restProps}>
|
|
14
15
|
{@render children?.()}
|
|
15
16
|
</th>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
type Props = {
|
|
3
4
|
class?: string;
|
|
4
5
|
children?: Snippet;
|
|
5
|
-
}
|
|
6
|
+
} & HTMLAttributes<HTMLTableCellElement>;
|
|
6
7
|
declare const TableHeading: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type TableHeading = ReturnType<typeof TableHeading>;
|
|
8
9
|
export default TableHeading;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { Color } from '../../types.js';
|
|
5
5
|
import { cleanClass } from '../../utilities/internal.js';
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
7
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
8
|
import { tv } from 'tailwind-variants';
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
@@ -11,9 +12,9 @@
|
|
|
11
12
|
children?: Snippet;
|
|
12
13
|
center?: boolean;
|
|
13
14
|
color?: Color;
|
|
14
|
-
}
|
|
15
|
+
} & HTMLAttributes<HTMLTableRowElement>;
|
|
15
16
|
|
|
16
|
-
const { color, class: className, children }: Props = $props();
|
|
17
|
+
const { color, class: className, children, ...restProps }: Props = $props();
|
|
17
18
|
|
|
18
19
|
const context = getTableContext();
|
|
19
20
|
|
|
@@ -40,6 +41,6 @@
|
|
|
40
41
|
});
|
|
41
42
|
</script>
|
|
42
43
|
|
|
43
|
-
<tr class={cleanClass(styles({ color, striped, spacing }), className)}>
|
|
44
|
+
<tr class={cleanClass(styles({ color, striped, spacing }), className)} {...restProps}>
|
|
44
45
|
{@render children?.()}
|
|
45
46
|
</tr>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Color } from '../../types.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
4
|
type Props = {
|
|
4
5
|
class?: string;
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
center?: boolean;
|
|
7
8
|
color?: Color;
|
|
8
|
-
}
|
|
9
|
+
} & HTMLAttributes<HTMLTableRowElement>;
|
|
9
10
|
declare const TableRow: import("svelte").Component<Props, {}, "">;
|
|
10
11
|
type TableRow = ReturnType<typeof TableRow>;
|
|
11
12
|
export default TableRow;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getFieldContext } from '../common/context.svelte.js';
|
|
3
|
-
import Field from '../components/Field/Field.svelte';
|
|
4
3
|
import Icon from '../components/Icon/Icon.svelte';
|
|
5
4
|
import IconButton from '../components/IconButton/IconButton.svelte';
|
|
6
5
|
import Input from '../components/Input/Input.svelte';
|
|
7
|
-
import Label from '../components/Label/Label.svelte';
|
|
8
6
|
import { zIndex } from '../constants.js';
|
|
9
7
|
import type { SelectCommonProps, SelectItem } from '../types.js';
|
|
10
|
-
import { cleanClass
|
|
11
|
-
import { mdiArrowDown, mdiArrowUp, mdiCheck,
|
|
8
|
+
import { cleanClass } from '../utilities/internal.js';
|
|
9
|
+
import { mdiArrowDown, mdiArrowUp, mdiCheck, mdiChevronDown } from '@mdi/js';
|
|
12
10
|
import { Select } from 'bits-ui';
|
|
11
|
+
import { tv } from 'tailwind-variants';
|
|
13
12
|
|
|
14
13
|
type T = SelectItem;
|
|
15
14
|
|
|
@@ -46,16 +45,22 @@
|
|
|
46
45
|
const options = $derived(asOptions(data));
|
|
47
46
|
|
|
48
47
|
const context = getFieldContext();
|
|
49
|
-
const {
|
|
48
|
+
const { invalid, disabled, ...labelProps } = $derived(context());
|
|
50
49
|
const size = $derived(initialSize ?? labelProps.size ?? 'small');
|
|
51
50
|
|
|
52
|
-
const id = generateId();
|
|
53
|
-
const inputId = `input-${id}`;
|
|
54
|
-
const labelId = `label-${id}`;
|
|
55
|
-
|
|
56
51
|
const selectedLabel = $derived(asLabel(values));
|
|
57
52
|
|
|
58
|
-
|
|
53
|
+
const triggerStyles = tv({
|
|
54
|
+
base: 'w-full gap-1 rounded-lg py-0 text-start focus-visible:outline-none',
|
|
55
|
+
variants: {
|
|
56
|
+
invalid: {
|
|
57
|
+
true: 'border-danger border',
|
|
58
|
+
false: '',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
let inputRef = $state<HTMLInputElement | null>(null);
|
|
59
64
|
let contentRef = $state<HTMLElement | null>(null);
|
|
60
65
|
let ref = $state<HTMLElement | null>(null);
|
|
61
66
|
|
|
@@ -79,48 +84,37 @@
|
|
|
79
84
|
</script>
|
|
80
85
|
|
|
81
86
|
<div class={cleanClass('flex flex-col gap-1', className)} bind:this={ref}>
|
|
82
|
-
{#if label}
|
|
83
|
-
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} {size} />
|
|
84
|
-
{/if}
|
|
85
|
-
|
|
86
87
|
<Select.Root type={multiple ? 'multiple' : 'single'} bind:value={internalValue as never} {onValueChange}>
|
|
87
|
-
<Select.Trigger
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class="m-1"
|
|
111
|
-
icon={mdiUnfoldMoreHorizontal}
|
|
112
|
-
{disabled}
|
|
113
|
-
aria-label="Expand"
|
|
114
|
-
/>
|
|
115
|
-
{/snippet}
|
|
116
|
-
</Input>
|
|
117
|
-
</Field>
|
|
88
|
+
<Select.Trigger {disabled} class={cleanClass(triggerStyles({ invalid: false }))} aria-label={placeholder}>
|
|
89
|
+
<Input
|
|
90
|
+
bind:containerRef={inputRef}
|
|
91
|
+
{size}
|
|
92
|
+
{shape}
|
|
93
|
+
{placeholder}
|
|
94
|
+
value={selectedLabel}
|
|
95
|
+
readonly
|
|
96
|
+
class={cleanClass('text-start', invalid && 'border-danger')}
|
|
97
|
+
>
|
|
98
|
+
{#snippet trailingIcon()}
|
|
99
|
+
<IconButton
|
|
100
|
+
variant="ghost"
|
|
101
|
+
shape="round"
|
|
102
|
+
color="secondary"
|
|
103
|
+
size="tiny"
|
|
104
|
+
class="m-1"
|
|
105
|
+
icon={mdiChevronDown}
|
|
106
|
+
{disabled}
|
|
107
|
+
aria-label="Expand"
|
|
108
|
+
/>
|
|
109
|
+
{/snippet}
|
|
110
|
+
</Input>
|
|
118
111
|
</Select.Trigger>
|
|
119
112
|
<Select.Portal>
|
|
120
113
|
<Select.Content
|
|
121
114
|
bind:ref={contentRef}
|
|
122
|
-
class="bg-
|
|
123
|
-
|
|
115
|
+
class="text-dark dark:bg-primary-100 bg-light-100 max-h-96 rounded-xl border py-3 outline-none select-none {zIndex.SelectDropdown}"
|
|
116
|
+
customAnchor={inputRef}
|
|
117
|
+
sideOffset={4}
|
|
124
118
|
>
|
|
125
119
|
<Select.ScrollUpButton class="flex w-full items-center justify-center">
|
|
126
120
|
<Icon icon={mdiArrowUp} />
|
|
@@ -129,7 +123,7 @@
|
|
|
129
123
|
{#each options as { value, label, disabled }, i (i + value)}
|
|
130
124
|
<Select.Item
|
|
131
125
|
class={cleanClass(
|
|
132
|
-
'hover:bg-
|
|
126
|
+
'hover:bg-light-200 hover:dark:bg-primary-200 data-selected:bg-light-200 dark:data-selected:bg-primary-200 flex h-10 w-full items-center px-5 py-3 text-sm duration-75 outline-none select-none data-disabled:opacity-50',
|
|
133
127
|
disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
|
134
128
|
)}
|
|
135
129
|
{value}
|
package/dist/types.d.ts
CHANGED