@immich/ui 0.57.3 → 0.58.1

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.
@@ -11,7 +11,7 @@
11
11
  const { color = 'primary', size = 'medium', name }: Props = $props();
12
12
 
13
13
  const styles = tv({
14
- base: 'flex h-full w-full items-center justify-center font-medium text-white select-none',
14
+ base: 'flex items-center justify-center font-medium text-white select-none',
15
15
  variants: {
16
16
  size: {
17
17
  tiny: 'h-5 w-5 text-xs',
@@ -36,7 +36,7 @@
36
36
  });
37
37
 
38
38
  const wrapper = tv({
39
- base: 'overflow-hidden rounded-full shadow-md',
39
+ base: 'block w-full overflow-hidden rounded-full shadow-md',
40
40
  });
41
41
 
42
42
  const getInitials = (name: string) => {
@@ -2,7 +2,7 @@
2
2
  import Button from '../../internal/Button.svelte';
3
3
  import type { ButtonProps } from '../../types.js';
4
4
 
5
- let { ref = $bindable(null), ...props }: ButtonProps = $props();
5
+ let { ref = $bindable(null), color = 'primary', ...props }: ButtonProps = $props();
6
6
  </script>
7
7
 
8
- <Button bind:ref {...props} />
8
+ <Button bind:ref {color} {...props} />
@@ -3,11 +3,19 @@
3
3
  import Button from '../../internal/Button.svelte';
4
4
  import type { IconButtonProps } from '../../types.js';
5
5
 
6
- const { icon, flipped, flopped, title, 'aria-label': ariaLabel, ...buttonProps }: IconButtonProps = $props();
6
+ const {
7
+ icon,
8
+ flipped,
9
+ flopped,
10
+ title,
11
+ 'aria-label': ariaLabel,
12
+ color = 'primary',
13
+ ...buttonProps
14
+ }: IconButtonProps = $props();
7
15
 
8
16
  const buttonTitle = $derived(title ?? ariaLabel);
9
17
  </script>
10
18
 
11
- <Button icon {...buttonProps} title={buttonTitle} aria-label={ariaLabel}>
19
+ <Button icon {color} {...buttonProps} title={buttonTitle} aria-label={ariaLabel}>
12
20
  <Icon {icon} {flipped} {flopped} size="60%" aria-hidden />
13
21
  </Button>
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import Icon from '../Icon/Icon.svelte';
3
+ import HStack from '../Stack/HStack.svelte';
4
+ import Button from '../../internal/Button.svelte';
5
+ import type { ButtonProps, IconLike } from '../../types.js';
6
+ import { cleanClass, isIconLike } from '../../utilities/internal.js';
7
+ import { mdiCheck } from '@mdi/js';
8
+ import type { Snippet } from 'svelte';
9
+ import { tv } from 'tailwind-variants';
10
+
11
+ let {
12
+ ref = $bindable(null),
13
+ selected = false,
14
+ class: className,
15
+ selectedIcon = mdiCheck,
16
+ children,
17
+ ...props
18
+ }: ButtonProps & {
19
+ color?: never;
20
+ selected?: boolean;
21
+ disabled?: boolean;
22
+ selectedIcon?: IconLike | Snippet | false;
23
+ } = $props();
24
+
25
+ const styles = tv({
26
+ base: 'hover:bg-light-200 dark:hover:bg-light-300 text-dark',
27
+ variants: {
28
+ selected: {
29
+ true: 'bg-light-200 dark:bg-light-300',
30
+ false: '',
31
+ },
32
+ },
33
+ });
34
+ </script>
35
+
36
+ <Button bind:ref fullWidth class={cleanClass(styles({ selected }), className)} {...props}>
37
+ {#if selectedIcon}
38
+ <HStack fullWidth class="justify-between">
39
+ {@render children?.()}
40
+ {#if selected}
41
+ {#if isIconLike(selectedIcon)}
42
+ <Icon icon={selectedIcon} />
43
+ {:else}
44
+ {@render selectedIcon()}
45
+ {/if}
46
+ {/if}
47
+ </HStack>
48
+ {:else}
49
+ {@render children?.()}
50
+ {/if}
51
+ </Button>
@@ -0,0 +1,11 @@
1
+ import type { ButtonProps, IconLike } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ type $$ComponentProps = ButtonProps & {
4
+ color?: never;
5
+ selected?: boolean;
6
+ disabled?: boolean;
7
+ selectedIcon?: IconLike | Snippet | false;
8
+ };
9
+ declare const ListButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
10
+ type ListButton = ReturnType<typeof ListButton>;
11
+ export default ListButton;
@@ -1,12 +1,10 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="T extends string">
2
2
  import InternalSelect from '../../internal/Select.svelte';
3
3
  import type { MultiSelectProps, SelectItem } from '../../types.js';
4
4
 
5
- type T = SelectItem;
6
-
7
5
  let { onChange, values = $bindable([]), ...restProps }: MultiSelectProps<T> = $props();
8
6
 
9
- const handleChange = (items: T[]) => {
7
+ const handleChange = (items: SelectItem<T>[]) => {
10
8
  onChange?.(items);
11
9
  };
12
10
  </script>
@@ -1,4 +1,25 @@
1
- import type { MultiSelectProps, SelectItem } from '../../types.js';
2
- declare const MultiSelect: import("svelte").Component<MultiSelectProps<SelectItem>, {}, "values">;
3
- type MultiSelect = ReturnType<typeof MultiSelect>;
1
+ import type { MultiSelectProps } from '../../types.js';
2
+ declare function $$render<T extends string>(): {
3
+ props: MultiSelectProps<T>;
4
+ exports: {};
5
+ bindings: "values";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<T extends string> {
10
+ props(): ReturnType<typeof $$render<T>>['props'];
11
+ events(): ReturnType<typeof $$render<T>>['events'];
12
+ slots(): ReturnType<typeof $$render<T>>['slots'];
13
+ bindings(): "values";
14
+ exports(): {};
15
+ }
16
+ interface $$IsomorphicComponent {
17
+ new <T extends string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
18
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
19
+ } & ReturnType<__sveltets_Render<T>['exports']>;
20
+ <T extends string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
21
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
+ }
23
+ declare const MultiSelect: $$IsomorphicComponent;
24
+ type MultiSelect<T extends string> = InstanceType<typeof MultiSelect<T>>;
4
25
  export default MultiSelect;
@@ -1,14 +1,12 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="T extends string">
2
2
  import InternalSelect from '../../internal/Select.svelte';
3
3
  import type { SelectItem, SelectProps } from '../../types.js';
4
4
 
5
- type T = SelectItem;
6
-
7
5
  let { onChange, value = $bindable(), ...restProps }: SelectProps<T> = $props();
8
6
 
9
7
  let values = $derived(value ? [value] : []);
10
8
 
11
- const handleChange = (items: T[]) => {
9
+ const handleChange = (items: SelectItem<T>[]) => {
12
10
  value = items[0];
13
11
  onChange?.(value);
14
12
  };
@@ -1,4 +1,25 @@
1
- import type { SelectItem, SelectProps } from '../../types.js';
2
- declare const Select: import("svelte").Component<SelectProps<SelectItem>, {}, "value">;
3
- type Select = ReturnType<typeof Select>;
1
+ import type { SelectProps } from '../../types.js';
2
+ declare function $$render<T extends string>(): {
3
+ props: SelectProps<T>;
4
+ exports: {};
5
+ bindings: "value";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<T extends string> {
10
+ props(): ReturnType<typeof $$render<T>>['props'];
11
+ events(): ReturnType<typeof $$render<T>>['events'];
12
+ slots(): ReturnType<typeof $$render<T>>['slots'];
13
+ bindings(): "value";
14
+ exports(): {};
15
+ }
16
+ interface $$IsomorphicComponent {
17
+ new <T extends string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
18
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
19
+ } & ReturnType<__sveltets_Render<T>['exports']>;
20
+ <T extends string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
21
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
+ }
23
+ declare const Select: $$IsomorphicComponent;
24
+ type Select<T extends string> = InstanceType<typeof Select<T>>;
4
25
  export default Select;
@@ -12,11 +12,12 @@
12
12
  color?: TextColor;
13
13
  fontWeight?: FontWeight;
14
14
  variant?: TextVariant;
15
+ inline?: boolean;
15
16
  class?: string;
16
17
  children: Snippet;
17
18
  } & HTMLAttributes<HTMLElement>;
18
19
 
19
- const { color, size, fontWeight = 'normal', children, class: className, ...restProps }: Props = $props();
20
+ const { color, inline, size, fontWeight = 'normal', children, class: className, ...restProps }: Props = $props();
20
21
 
21
22
  const styles = tv({
22
23
  variants: {
@@ -25,6 +26,6 @@
25
26
  });
26
27
  </script>
27
28
 
28
- <Text tag="p" {color} {fontWeight} class={cleanClass(styles({ size }), className)} {...restProps}>
29
+ <Text tag={inline ? 'span' : 'p'} {color} {fontWeight} class={cleanClass(styles({ size }), className)} {...restProps}>
29
30
  {@render children()}
30
31
  </Text>
@@ -7,6 +7,7 @@ type Props = {
7
7
  color?: TextColor;
8
8
  fontWeight?: FontWeight;
9
9
  variant?: TextVariant;
10
+ inline?: boolean;
10
11
  class?: string;
11
12
  children: Snippet;
12
13
  } & HTMLAttributes<HTMLElement>;
package/dist/index.d.ts CHANGED
@@ -48,6 +48,7 @@ export { default as Input } from './components/Input/Input.svelte';
48
48
  export { default as Kbd } from './components/Kbd/Kbd.svelte';
49
49
  export { default as Label } from './components/Label/Label.svelte';
50
50
  export { default as Link } from './components/Link/Link.svelte';
51
+ export { default as ListButton } from './components/ListButton/ListButton.svelte';
51
52
  export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
52
53
  export { default as Logo } from './components/Logo/Logo.svelte';
53
54
  export { Markdown } from './components/Markdown/index.js';
package/dist/index.js CHANGED
@@ -50,6 +50,7 @@ export { default as Input } from './components/Input/Input.svelte';
50
50
  export { default as Kbd } from './components/Kbd/Kbd.svelte';
51
51
  export { default as Label } from './components/Label/Label.svelte';
52
52
  export { default as Link } from './components/Link/Link.svelte';
53
+ export { default as ListButton } from './components/ListButton/ListButton.svelte';
53
54
  export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
54
55
  export { default as Logo } from './components/Logo/Logo.svelte';
55
56
  export { Markdown } from './components/Markdown/index.js';
@@ -20,7 +20,7 @@
20
20
  type = 'button',
21
21
  href,
22
22
  variant = 'filled',
23
- color = 'primary',
23
+ color,
24
24
  shape = 'semi-round',
25
25
  size = 'medium',
26
26
  loading = false,
@@ -1,4 +1,4 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="T extends string">
2
2
  import { getFieldContext } from '../common/context.svelte.js';
3
3
  import Icon from '../components/Icon/Icon.svelte';
4
4
  import IconButton from '../components/IconButton/IconButton.svelte';
@@ -10,13 +10,11 @@
10
10
  import { Select } from 'bits-ui';
11
11
  import { tv } from 'tailwind-variants';
12
12
 
13
- type T = SelectItem;
14
-
15
13
  type Props = {
16
14
  multiple?: boolean;
17
- values: T[];
18
- asLabel?: (items: T[]) => string;
19
- onChange?: (values: T[]) => void;
15
+ values: SelectItem<T>[];
16
+ asLabel?: (items: SelectItem<T>[]) => string;
17
+ onChange?: (values: SelectItem<T>[]) => void;
20
18
  } & SelectCommonProps<T>;
21
19
 
22
20
  let {
@@ -26,15 +24,15 @@
26
24
  multiple = false,
27
25
  values = $bindable([]),
28
26
  onChange,
29
- asLabel = (options: T[]) => options.map(({ label }) => label).join(', '),
27
+ asLabel = (options: SelectItem<T>[]) => options.map(({ label }) => label).join(', '),
30
28
  placeholder,
31
29
  class: className,
32
30
  }: Props = $props();
33
31
 
34
- const asOptions = (items: string[] | T[]) => {
32
+ const asOptions = (items: string[] | SelectItem<T>[]) => {
35
33
  return items.map((item) => {
36
34
  if (typeof item === 'string') {
37
- return { value: item, label: item } as T;
35
+ return { value: item, label: item } as SelectItem<T>;
38
36
  }
39
37
 
40
38
  const label = item.label ?? item.value;
@@ -73,9 +71,7 @@
73
71
  const findOption = (value: string) => options.find((option) => option.value === value);
74
72
 
75
73
  const onValueChange = (items: string[] | string) => {
76
- values = multiple
77
- ? ((items as string[]).map(findOption) as T[])
78
- : [findOption(items as string) as T].filter(Boolean);
74
+ values = (Array.isArray(items) ? items : [items]).map(findOption).filter((item) => item !== undefined);
79
75
 
80
76
  onChange?.(values);
81
77
  };
@@ -1,12 +1,31 @@
1
1
  import type { SelectCommonProps, SelectItem } from '../types.js';
2
2
  import { Select } from 'bits-ui';
3
- type T = SelectItem;
4
- type Props = {
5
- multiple?: boolean;
6
- values: T[];
7
- asLabel?: (items: T[]) => string;
8
- onChange?: (values: T[]) => void;
9
- } & SelectCommonProps<T>;
10
- declare const Select: import("svelte").Component<Props, {}, "values">;
11
- type Select = ReturnType<typeof Select>;
3
+ declare function $$render<T extends string>(): {
4
+ props: {
5
+ multiple?: boolean;
6
+ values: SelectItem<T>[];
7
+ asLabel?: (items: SelectItem<T>[]) => string;
8
+ onChange?: (values: SelectItem<T>[]) => void;
9
+ } & SelectCommonProps<T>;
10
+ exports: {};
11
+ bindings: "values";
12
+ slots: {};
13
+ events: {};
14
+ };
15
+ declare class __sveltets_Render<T extends string> {
16
+ props(): ReturnType<typeof $$render<T>>['props'];
17
+ events(): ReturnType<typeof $$render<T>>['events'];
18
+ slots(): ReturnType<typeof $$render<T>>['slots'];
19
+ bindings(): "values";
20
+ exports(): {};
21
+ }
22
+ interface $$IsomorphicComponent {
23
+ new <T extends string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
24
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
25
+ } & ReturnType<__sveltets_Render<T>['exports']>;
26
+ <T extends string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
27
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
28
+ }
29
+ declare const Select: $$IsomorphicComponent;
30
+ type Select<T extends string> = InstanceType<typeof Select<T>>;
12
31
  export default Select;
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * The HTML element type.
12
12
  */
13
- tag?: HeadingTag;
13
+ tag?: HeadingTag | 'span';
14
14
  fontWeight?: FontWeight;
15
15
  variant?: TextVariant;
16
16
  color?: HeadingColor;
@@ -5,7 +5,7 @@ type Props = {
5
5
  /**
6
6
  * The HTML element type.
7
7
  */
8
- tag?: HeadingTag;
8
+ tag?: HeadingTag | 'span';
9
9
  fontWeight?: FontWeight;
10
10
  variant?: TextVariant;
11
11
  color?: HeadingColor;
package/dist/styles.d.ts CHANGED
@@ -74,11 +74,15 @@ export declare const styleVariants: {
74
74
  giant: string;
75
75
  };
76
76
  fontWeight: {
77
+ thin: string;
78
+ 'extra-light': string;
77
79
  light: string;
78
80
  normal: string;
81
+ medium: string;
79
82
  'semi-bold': string;
80
83
  bold: string;
81
84
  'extra-bold': string;
85
+ black: string;
82
86
  };
83
87
  tableSpacing: {
84
88
  tiny: string;
package/dist/styles.js CHANGED
@@ -70,11 +70,15 @@ export const styleVariants = {
70
70
  giant: 'text-xl',
71
71
  },
72
72
  fontWeight: {
73
+ thin: 'font-thin',
74
+ 'extra-light': 'font-extralight',
73
75
  light: 'font-light',
74
76
  normal: 'font-normal',
77
+ medium: 'font-medium',
75
78
  'semi-bold': 'font-semibold',
76
79
  bold: 'font-bold',
77
80
  'extra-bold': 'font-extrabold',
81
+ black: 'font-black',
78
82
  },
79
83
  tableSpacing: {
80
84
  tiny: '',
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes, HTMLIn
6
6
  export type Color = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
7
7
  export type TextColor = Color | 'muted';
8
8
  export type TextVariant = 'italic';
9
- export type FontWeight = 'light' | 'normal' | 'semi-bold' | 'bold' | 'extra-bold';
9
+ export type FontWeight = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
10
10
  export type HeadingColor = TextColor;
11
11
  export type Size = 'tiny' | 'small' | 'medium' | 'large' | 'giant';
12
12
  export type ModalSize = Size | 'full';
@@ -152,25 +152,25 @@ export type TextareaProps = {
152
152
  shape?: Shape;
153
153
  grow?: boolean;
154
154
  } & HTMLTextareaAttributes;
155
- export type SelectItem = {
155
+ export type SelectItem<T extends string = string> = {
156
156
  label?: string;
157
- value: string;
157
+ value: T;
158
158
  disabled?: boolean;
159
159
  };
160
- export type SelectCommonProps<T extends SelectItem> = {
161
- data: string[] | T[];
160
+ export type SelectCommonProps<T extends string> = {
161
+ data: string[] | SelectItem<T>[];
162
162
  size?: Size;
163
163
  shape?: Shape;
164
164
  placeholder?: string;
165
165
  class?: string;
166
166
  };
167
- export type SelectProps<T extends SelectItem> = SelectCommonProps<T> & {
168
- value?: T;
169
- onChange?: (value: T) => void;
167
+ export type SelectProps<T extends string> = SelectCommonProps<T> & {
168
+ value?: SelectItem<T>;
169
+ onChange?: (value: SelectItem<T>) => void;
170
170
  };
171
- export type MultiSelectProps<T extends SelectItem> = SelectCommonProps<T> & {
172
- values?: T[];
173
- onChange?: (values: T[]) => void;
171
+ export type MultiSelectProps<T extends string> = SelectCommonProps<T> & {
172
+ values?: SelectItem<T>[];
173
+ onChange?: (values: SelectItem<T>[]) => void;
174
174
  };
175
175
  export type ToastId = {
176
176
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.57.3",
3
+ "version": "0.58.1",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "@tailwindcss/vite": "^4.1.7",
38
38
  "@types/luxon": "^3.7.1",
39
39
  "autoprefixer": "^10.4.20",
40
- "globals": "^16.0.0",
40
+ "globals": "^17.0.0",
41
41
  "publint": "^0.3.0",
42
42
  "svelte": "^5.37.0",
43
43
  "svelte-check": "^4.0.0",