@immich/ui 0.57.2 → 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.
@@ -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
  };
@@ -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 { ref = $bindable(null), class: className, striped = false, spacing, children, ...restProps }: Props = $props();
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="text-primary mb-4 flex w-full overflow-hidden rounded-md border">
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 rounded-md border', bodyChild.class)}>
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 class="text-primary bg-subtle mt-4 flex h-12 w-full place-items-center rounded-md border p-4">
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;
package/dist/types.d.ts CHANGED
@@ -120,6 +120,7 @@ export type FieldContext = {
120
120
  export type TableSpacing = Size;
121
121
  export type TableContext = {
122
122
  spacing?: TableSpacing;
123
+ size?: Size;
123
124
  striped?: boolean;
124
125
  };
125
126
  type BaseInputProps<T> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.57.2",
3
+ "version": "0.57.3",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "repository": {
6
6
  "type": "git",