@immich/ui 0.19.1 → 0.21.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.
@@ -3,7 +3,7 @@ export declare const setFieldContext: (field: FieldContext) => FieldContext;
3
3
  export declare const hasFieldContext: () => boolean;
4
4
  export declare const getFieldContext: () => {
5
5
  label: string | undefined;
6
- color: "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "muted";
6
+ color: "primary" | "success" | "danger" | "warning" | "info" | "secondary" | "muted";
7
7
  invalid: boolean;
8
8
  readOnly: boolean;
9
9
  required: boolean;
@@ -1,48 +1,25 @@
1
1
  <script lang="ts">
2
- import { afterNavigate } from '$app/navigation';
3
- import IconButton from '../IconButton/IconButton.svelte';
4
2
  import Scrollable from '../Scrollable/Scrollable.svelte';
5
3
  import { ChildKey } from '../../constants.js';
6
4
  import Child from '../../internal/Child.svelte';
7
5
  import { cleanClass } from '../../utils.js';
8
- import { mdiClose, mdiMenu } from '@mdi/js';
9
- import type { Snippet } from 'svelte';
6
+ import { type Snippet } from 'svelte';
10
7
 
11
8
  type Props = {
12
9
  class?: string;
13
10
  children: Snippet;
14
- noBorder?: boolean;
11
+ open?: boolean;
15
12
  };
16
13
 
17
- let { class: className, children, noBorder = false }: Props = $props();
18
-
19
- afterNavigate(() => {
20
- if (!hidden) {
21
- hidden = true;
22
- }
23
- });
24
-
25
- let hidden = $state(true);
14
+ let { class: className, children, open = $bindable(true) }: Props = $props();
26
15
  </script>
27
16
 
28
17
  <Child for={ChildKey.AppShell} as={ChildKey.AppShellSidebar}>
29
- <IconButton
30
- size="giant"
31
- onclick={() => (hidden = !hidden)}
32
- icon={hidden ? mdiMenu : mdiClose}
33
- shape="round"
34
- color={hidden ? 'primary' : 'secondary'}
35
- variant="filled"
36
- class="absolute bottom-2 end-4 m-2 opacity-100 md:hidden"
37
- aria-label="Menu"
38
- />
39
18
  <Scrollable
40
19
  class={cleanClass(
41
- 'h-dvh w-full shrink-0 bg-light pb-16 text-dark md:relative md:block md:w-min md:pb-0',
42
-
43
- hidden ? 'hidden' : '',
20
+ 'relative shrink-0 bg-light text-dark transition-all duration-200',
21
+ open ? 'w-[min(100vw,16rem)]' : 'w-[0px]',
44
22
  className,
45
- noBorder || 'border-e',
46
23
  )}
47
24
  >
48
25
  {@render children?.()}
@@ -1,9 +1,9 @@
1
- import type { Snippet } from 'svelte';
1
+ import { type Snippet } from 'svelte';
2
2
  type Props = {
3
3
  class?: string;
4
4
  children: Snippet;
5
- noBorder?: boolean;
5
+ open?: boolean;
6
6
  };
7
- declare const AppShellSidebar: import("svelte").Component<Props, {}, "">;
7
+ declare const AppShellSidebar: import("svelte").Component<Props, {}, "open">;
8
8
  type AppShellSidebar = ReturnType<typeof AppShellSidebar>;
9
9
  export default AppShellSidebar;
@@ -23,7 +23,7 @@
23
23
  shape="round"
24
24
  color="secondary"
25
25
  {size}
26
- class="mr-1"
26
+ class="me-1"
27
27
  icon={isVisible ? mdiEyeOffOutline : mdiEyeOutline}
28
28
  onclick={() => (isVisible = !isVisible)}
29
29
  title={isVisible ? t('hidePassword', translations) : t('showPassword', translations)}
@@ -10,9 +10,11 @@
10
10
  href: string;
11
11
  variant?: 'compact';
12
12
  isActive?: () => boolean;
13
- } & { icon?: string & Omit<IconProps, 'icon'> };
13
+ icon?: string | IconProps;
14
+ activeIcon?: string | IconProps;
15
+ };
14
16
 
15
- const matchesPath = () => page.url.pathname === href;
17
+ const startsWithHref = () => page.url.pathname.startsWith(href);
16
18
 
17
19
  let {
18
20
  href,
@@ -20,14 +22,20 @@
20
22
  title,
21
23
  variant,
22
24
  active: activeOverride,
23
- ...iconProps
25
+ icon,
26
+ activeIcon,
24
27
  }: Props = $props();
25
28
 
26
- const isActive = isActiveOverride ?? matchesPath;
29
+ const isActive = isActiveOverride ?? startsWithHref;
27
30
  let active = $derived(activeOverride ?? isActive());
28
31
 
32
+ const iconProps = $derived(typeof icon === 'string' ? { icon } : icon);
33
+ const activeIconProps = $derived(
34
+ typeof activeIcon === 'string' ? { icon: activeIcon } : activeIcon,
35
+ );
36
+
29
37
  const styles = tv({
30
- base: 'flex w-full place-items-center gap-4 transition-[padding] delay-100 duration-100 hover:bg-subtle hover:text-primary group-hover:sm:px-5 md:rounded-e-full md:px-5',
38
+ base: 'flex w-full place-items-center gap-4 rounded-e-full px-5 transition-[padding] delay-100 duration-100 hover:bg-subtle hover:text-primary group-hover:sm:px-5',
31
39
  variants: {
32
40
  active: {
33
41
  true: 'bg-primary/10 text-primary',
@@ -48,13 +56,12 @@
48
56
  class={styles({ active, variant: variant ?? 'default' })}
49
57
  >
50
58
  <div class="flex w-full place-items-center gap-4 overflow-hidden truncate">
51
- {#if iconProps.icon}
59
+ {#if iconProps}
52
60
  <Icon
53
61
  size="1.375em"
54
62
  class="shrink-0"
55
63
  aria-hidden={true}
56
- {...iconProps}
57
- icon={iconProps.icon}
64
+ {...active && activeIconProps ? activeIconProps : iconProps}
58
65
  />
59
66
  {/if}
60
67
  <span class="text-sm font-medium">{title}</span>
@@ -5,8 +5,8 @@ type Props = {
5
5
  href: string;
6
6
  variant?: 'compact';
7
7
  isActive?: () => boolean;
8
- } & {
9
- icon?: string & Omit<IconProps, 'icon'>;
8
+ icon?: string | IconProps;
9
+ activeIcon?: string | IconProps;
10
10
  };
11
11
  declare const NavbarItem: import("svelte").Component<Props, {}, "">;
12
12
  type NavbarItem = ReturnType<typeof NavbarItem>;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { default as immichLogoStackedLight } from './assets/immich-logo-stacked-
7
7
  export { default as immichLogoJson } from './assets/immich-logo.json';
8
8
  export { default as immichLogo } from './assets/immich-logo.svg';
9
9
  export { default as playStoreBadge } from './assets/playstore-badge.png';
10
+ export * from './theme/default.js';
10
11
  export { default as Alert } from './components/Alert/Alert.svelte';
11
12
  export { default as AppShell } from './components/AppShell/AppShell.svelte';
12
13
  export { default as AppShellHeader } from './components/AppShell/AppShellHeader.svelte';
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ export { default as immichLogoStackedLight } from './assets/immich-logo-stacked-
8
8
  export { default as immichLogoJson } from './assets/immich-logo.json';
9
9
  export { default as immichLogo } from './assets/immich-logo.svg';
10
10
  export { default as playStoreBadge } from './assets/playstore-badge.png';
11
+ // theme
12
+ export * from './theme/default.js';
11
13
  // components
12
14
  export { default as Alert } from './components/Alert/Alert.svelte';
13
15
  export { default as AppShell } from './components/AppShell/AppShell.svelte';
@@ -0,0 +1,33 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+ /* light */
8
+ --immich-ui-primary: 66 80 175;
9
+ --immich-ui-dark: 58 58 58;
10
+ --immich-ui-light: 255 255 255;
11
+ --immich-ui-success: 16 188 99;
12
+ --immich-ui-danger: 200 60 60;
13
+ --immich-ui-warning: 216 143 64;
14
+ --immich-ui-info: 8 111 230;
15
+ --immich-ui-gray: 246 246 246;
16
+
17
+ --immich-ui-default-border: 209 213 219;
18
+ }
19
+
20
+ .dark {
21
+ /* dark */
22
+ --immich-ui-primary: 172 203 250;
23
+ --immich-ui-light: 0 0 0;
24
+ --immich-ui-dark: 229 231 235;
25
+ --immich-ui-success: 72 237 152;
26
+ --immich-ui-danger: 246 125 125;
27
+ --immich-ui-warning: 254 197 132;
28
+ --immich-ui-info: 121 183 254;
29
+ --immich-ui-gray: 33 33 33;
30
+
31
+ --immich-ui-default-border: 55 65 81;
32
+ }
33
+ }
@@ -0,0 +1,13 @@
1
+ export declare const tailwindConfig: () => {
2
+ colors: {
3
+ primary: string;
4
+ light: string;
5
+ dark: string;
6
+ success: string;
7
+ danger: string;
8
+ warning: string;
9
+ info: string;
10
+ subtle: string;
11
+ };
12
+ borderColor: ({ theme }: import("tailwindcss/types/config").PluginUtils) => any;
13
+ };
@@ -0,0 +1,16 @@
1
+ export const tailwindConfig = () => ({
2
+ colors: {
3
+ primary: 'rgb(var(--immich-ui-primary) / <alpha-value>)',
4
+ light: 'rgb(var(--immich-ui-light) / <alpha-value>)',
5
+ dark: 'rgb(var(--immich-ui-dark) / <alpha-value>)',
6
+ success: 'rgb(var(--immich-ui-success) / <alpha-value>)',
7
+ danger: 'rgb(var(--immich-ui-danger) / <alpha-value>)',
8
+ warning: 'rgb(var(--immich-ui-warning) / <alpha-value>)',
9
+ info: 'rgb(var(--immich-ui-info) / <alpha-value>)',
10
+ subtle: 'rgb(var(--immich-ui-gray) / <alpha-value>)',
11
+ },
12
+ borderColor: ({ theme }) => ({
13
+ ...theme('colors'),
14
+ DEFAULT: 'rgb(var(--immich-ui-default-border) / <alpha-value>)',
15
+ }),
16
+ });
package/dist/utils.js CHANGED
@@ -1,12 +1,13 @@
1
+ import { twMerge } from 'tailwind-merge';
1
2
  export const cleanClass = (...classNames) => {
2
- return classNames
3
+ return twMerge(classNames
3
4
  .filter((className) => {
4
5
  if (!className || typeof className === 'boolean') {
5
6
  return false;
6
7
  }
7
8
  return typeof className === 'string';
8
9
  })
9
- .join(' ');
10
+ .join(' '));
10
11
  };
11
12
  export const withPrefix = (key) => `immich-ui-${key}`;
12
13
  let _count = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "scripts": {
6
6
  "create": "node scripts/create.js",
@@ -68,5 +68,8 @@
68
68
  "bits-ui": "^1.0.0-next.46",
69
69
  "tailwind-merge": "^2.5.4",
70
70
  "tailwind-variants": "^0.3.0"
71
+ },
72
+ "volta": {
73
+ "node": "22.15.0"
71
74
  }
72
75
  }