@immich/ui 0.4.0 → 0.6.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.
Files changed (39) hide show
  1. package/dist/common/context.svelte.d.ts +4 -0
  2. package/dist/common/context.svelte.js +6 -0
  3. package/dist/common/use-child.svelte.d.ts +5 -0
  4. package/dist/common/{use-context.svelte.js → use-child.svelte.js} +1 -1
  5. package/dist/components/Card/Card.svelte +6 -6
  6. package/dist/components/Card/CardBody.svelte +3 -3
  7. package/dist/components/Card/CardFooter.svelte +2 -2
  8. package/dist/components/Card/CardHeader.svelte +2 -2
  9. package/dist/components/CloseButton/CloseButton.svelte +9 -0
  10. package/dist/components/CloseButton/CloseButton.svelte.d.ts +3 -0
  11. package/dist/components/Form/Field.svelte +29 -0
  12. package/dist/components/Form/Field.svelte.d.ts +6 -0
  13. package/dist/components/Form/HelperText.svelte +24 -0
  14. package/dist/components/Form/HelperText.svelte.d.ts +8 -0
  15. package/dist/components/Form/Input.svelte +101 -14
  16. package/dist/components/Form/Input.svelte.d.ts +8 -2
  17. package/dist/components/Heading/Heading.svelte +8 -7
  18. package/dist/components/Link/Link.svelte +17 -0
  19. package/dist/components/Link/Link.svelte.d.ts +8 -0
  20. package/dist/components/Stack/HStack.svelte +1 -1
  21. package/dist/components/Stack/HStack.svelte.d.ts +2 -1
  22. package/dist/components/Stack/Stack.svelte +0 -10
  23. package/dist/components/Stack/VStack.svelte +1 -1
  24. package/dist/components/Stack/VStack.svelte.d.ts +2 -1
  25. package/dist/components/SupporterBadge/SupporterBadge.svelte +94 -0
  26. package/dist/components/SupporterBadge/SupporterBadge.svelte.d.ts +9 -0
  27. package/dist/components/Text/Text.svelte +1 -1
  28. package/dist/components/Text/Text.svelte.d.ts +1 -1
  29. package/dist/constants.d.ts +3 -1
  30. package/dist/constants.js +9 -7
  31. package/dist/index.d.ts +5 -0
  32. package/dist/index.js +5 -0
  33. package/dist/internal/Child.svelte +4 -4
  34. package/dist/internal/Child.svelte.d.ts +3 -3
  35. package/dist/types.d.ts +15 -4
  36. package/dist/utils.d.ts +2 -2
  37. package/dist/utils.js +2 -0
  38. package/package.json +1 -1
  39. package/dist/common/use-context.svelte.d.ts +0 -5
@@ -0,0 +1,4 @@
1
+ import type { FieldContext } from '../types.js';
2
+ export declare const setFieldContext: (field: FieldContext) => FieldContext;
3
+ export declare const hasFieldContext: () => boolean;
4
+ export declare const getFieldContext: () => FieldContext;
@@ -0,0 +1,6 @@
1
+ import { withPrefix } from '../utils.js';
2
+ import { getContext, hasContext, setContext } from 'svelte';
3
+ const fieldKey = Symbol(withPrefix('field'));
4
+ export const setFieldContext = (field) => setContext(fieldKey, field);
5
+ export const hasFieldContext = () => hasContext(fieldKey);
6
+ export const getFieldContext = () => (getContext(fieldKey) || {});
@@ -0,0 +1,5 @@
1
+ import { ChildKey } from '../constants.js';
2
+ import { type Snippet } from 'svelte';
3
+ export declare const withChildrenSnippets: (key: ChildKey) => {
4
+ getChildren: (key: ChildKey) => Snippet<[]> | undefined;
5
+ };
@@ -1,4 +1,4 @@
1
- import { ContextKey } from '../constants.js';
1
+ import { ChildKey } from '../constants.js';
2
2
  import { withPrefix } from '../utils.js';
3
3
  import { setContext } from 'svelte';
4
4
  import { SvelteMap } from 'svelte/reactivity';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { withChildrenSnippets } from '../../common/use-context.svelte.js';
2
+ import { withChildrenSnippets } from '../../common/use-child.svelte.js';
3
3
  import IconButton from '../IconButton/IconButton.svelte';
4
- import { ContextKey } from '../../constants.js';
4
+ import { ChildKey } from '../../constants.js';
5
5
  import type { Color, Shape } from '../../types.js';
6
6
  import { cleanClass } from '../../utils.js';
7
7
  import { mdiChevronDown } from '@mdi/js';
@@ -104,10 +104,10 @@
104
104
  expanded = !expanded;
105
105
  };
106
106
 
107
- const { getChildren: getChildSnippet } = withChildrenSnippets(ContextKey.Card);
108
- const headerChildren = $derived(getChildSnippet(ContextKey.CardHeader));
109
- const bodyChildren = $derived(getChildSnippet(ContextKey.CardBody));
110
- const footerChildren = $derived(getChildSnippet(ContextKey.CardFooter));
107
+ const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Card);
108
+ const headerChildren = $derived(getChildSnippet(ChildKey.CardHeader));
109
+ const bodyChildren = $derived(getChildSnippet(ChildKey.CardBody));
110
+ const footerChildren = $derived(getChildSnippet(ChildKey.CardFooter));
111
111
 
112
112
  const headerClasses = 'flex flex-col space-y-1.5';
113
113
  const headerContainerClasses = $derived(
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { ContextKey } from '../../constants.js';
2
+ import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
4
  import { cleanClass } from '../../utils.js';
5
5
  import type { Snippet } from 'svelte';
@@ -13,8 +13,8 @@
13
13
  let { class: className, children }: Props = $props();
14
14
  </script>
15
15
 
16
- <Child for={ContextKey.Card} as={ContextKey.CardBody}>
17
- <div class={twMerge(cleanClass('p-4', className))}>
16
+ <Child for={ChildKey.Card} as={ChildKey.CardBody}>
17
+ <div class={twMerge(cleanClass('w-full p-4', className))}>
18
18
  {@render children?.()}
19
19
  </div>
20
20
  </Child>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { ContextKey } from '../../constants.js';
2
+ import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
4
  import type { Snippet } from 'svelte';
5
5
 
@@ -10,6 +10,6 @@
10
10
  let { children }: Props = $props();
11
11
  </script>
12
12
 
13
- <Child for={ContextKey.Card} as={ContextKey.CardFooter}>
13
+ <Child for={ChildKey.Card} as={ChildKey.CardFooter}>
14
14
  {@render children?.()}
15
15
  </Child>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { ContextKey } from '../../constants.js';
2
+ import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
4
  import type { Snippet } from 'svelte';
5
5
 
@@ -10,6 +10,6 @@
10
10
  let { children }: Props = $props();
11
11
  </script>
12
12
 
13
- <Child for={ContextKey.Card} as={ContextKey.CardHeader}>
13
+ <Child for={ChildKey.Card} as={ChildKey.CardHeader}>
14
14
  {@render children?.()}
15
15
  </Child>
@@ -0,0 +1,9 @@
1
+ <script lang="ts">
2
+ import IconButton from '../IconButton/IconButton.svelte';
3
+ import type { CloseButtonProps } from '../../types.js';
4
+ import { mdiClose } from '@mdi/js';
5
+
6
+ const { size = 'medium', variant = 'ghost' }: CloseButtonProps = $props();
7
+ </script>
8
+
9
+ <IconButton icon={mdiClose} color="secondary" shape="round" {variant} {size} />
@@ -0,0 +1,3 @@
1
+ import type { CloseButtonProps } from '../../types.js';
2
+ declare const CloseButton: import("svelte").Component<CloseButtonProps, {}, "">;
3
+ export default CloseButton;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { setFieldContext } from '../../common/context.svelte.js';
3
+ import { withChildrenSnippets } from '../../common/use-child.svelte.js';
4
+ import { ChildKey } from '../../constants.js';
5
+ import type { FieldContext } from '../../types.js';
6
+ import { type Snippet } from 'svelte';
7
+
8
+ type Props = FieldContext & {
9
+ children: Snippet;
10
+ };
11
+
12
+ const { children, ...props }: Props = $props();
13
+
14
+ const state = $state(props);
15
+
16
+ setFieldContext(state);
17
+
18
+ const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Field);
19
+ const helperTextChildren = $derived(getChildSnippet(ChildKey.HelperText));
20
+ </script>
21
+
22
+ <div>
23
+ {@render children()}
24
+ {#if helperTextChildren}
25
+ <div class="pt-1">
26
+ {@render helperTextChildren?.()}
27
+ </div>
28
+ {/if}
29
+ </div>
@@ -0,0 +1,6 @@
1
+ import type { FieldContext } from '../../types.js';
2
+ import { type Snippet } from 'svelte';
3
+ declare const Field: import("svelte").Component<FieldContext & {
4
+ children: Snippet;
5
+ }, {}, "">;
6
+ export default Field;
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import Text from '../Text/Text.svelte';
3
+ import { ChildKey } from '../../constants.js';
4
+ import Child from '../../internal/Child.svelte';
5
+ import type { Color } from '../../types.js';
6
+ import { cleanClass } from '../../utils.js';
7
+ import type { Snippet } from 'svelte';
8
+
9
+ type Props = {
10
+ color?: Color;
11
+ class?: string;
12
+ children?: Snippet;
13
+ };
14
+
15
+ let { class: className, children, color }: Props = $props();
16
+ </script>
17
+
18
+ <Child for={ChildKey.Field} as={ChildKey.HelperText}>
19
+ <div class={cleanClass(className)}>
20
+ <Text {color} size="small">
21
+ {@render children?.()}
22
+ </Text>
23
+ </div>
24
+ </Child>
@@ -0,0 +1,8 @@
1
+ import type { Color } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ declare const HelperText: import("svelte").Component<{
4
+ color?: Color;
5
+ class?: string;
6
+ children?: Snippet;
7
+ }, {}, "">;
8
+ export default HelperText;
@@ -1,22 +1,109 @@
1
1
  <script lang="ts">
2
+ import { getFieldContext } from '../../common/context.svelte.js';
3
+ import type { Shape, Size } from '../../types.js';
4
+ import { cleanClass, generateId } from '../../utils.js';
2
5
  import type { HTMLInputAttributes } from 'svelte/elements';
3
- import type { WithElementRef } from 'bits-ui';
4
- import { cleanClass } from '../../utils.js';
6
+ import { tv } from 'tailwind-variants';
7
+
8
+ type Props = {
9
+ class?: string;
10
+ value?: string;
11
+ size?: Size;
12
+ shape?: Shape;
13
+ inputSize?: HTMLInputAttributes['size'];
14
+ } & Omit<HTMLInputAttributes, 'size'>;
5
15
 
6
16
  let {
7
- ref = $bindable(null),
8
- value = $bindable(),
17
+ shape = 'semi-round',
18
+ size = 'medium',
9
19
  class: className,
20
+ value = $bindable<string>(),
10
21
  ...restProps
11
- }: WithElementRef<HTMLInputAttributes> = $props();
22
+ }: Props = $props();
23
+
24
+ const {
25
+ label,
26
+ readOnly = false,
27
+ required = false,
28
+ invalid = false,
29
+ disabled = false,
30
+ } = $derived(getFieldContext());
31
+
32
+ const labelStyles = tv({
33
+ base: '',
34
+ variants: {
35
+ size: {
36
+ tiny: 'text-xs',
37
+ small: 'text-sm',
38
+ medium: 'text-md',
39
+ large: 'text-lg',
40
+ giant: 'text-xl',
41
+ },
42
+ },
43
+ });
44
+
45
+ const inputStyles = tv({
46
+ base: 'outline-none disabled:cursor-not-allowed bg-gray-200 dark:bg-gray-600 disabled:bg-gray-300 disabled:text-gray-200 dark:disabled:bg-gray-800 aria-readonly:text-dark/50 dark:aria-readonly:text-dark/75',
47
+ variants: {
48
+ shape: {
49
+ rectangle: 'rounded-none',
50
+ 'semi-round': '',
51
+ round: 'rounded-full',
52
+ },
53
+ padding: {
54
+ base: 'px-3 py-2',
55
+ round: 'px-4 py-2',
56
+ },
57
+ roundedSize: {
58
+ tiny: 'rounded-xl',
59
+ small: 'rounded-xl',
60
+ medium: 'rounded-2xl',
61
+ large: 'rounded-2xl',
62
+ giant: 'rounded-2xl',
63
+ },
64
+ textSize: {
65
+ tiny: 'text-xs',
66
+ small: 'text-sm',
67
+ medium: 'text-md',
68
+ large: 'text-lg',
69
+ giant: 'text-xl',
70
+ },
71
+ invalid: {
72
+ true: 'border border-danger/80',
73
+ false: '',
74
+ },
75
+ },
76
+ });
77
+
78
+ const id = generateId();
79
+ const inputId = `input-${id}`;
80
+ const labelId = `label-${id}`;
12
81
  </script>
13
82
 
14
- <input
15
- bind:this={ref}
16
- class={cleanClass(
17
- 'border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
18
- className,
19
- )}
20
- bind:value
21
- {...restProps}
22
- />
83
+ <div class="flex flex-col gap-1">
84
+ {#if label}
85
+ <label id={labelId} for={inputId} class={labelStyles({ size })}>{label}</label>
86
+ {/if}
87
+ <input
88
+ id={label && inputId}
89
+ aria-labelledby={label && labelId}
90
+ {required}
91
+ aria-required={required}
92
+ {disabled}
93
+ aria-disabled={disabled}
94
+ readonly={readOnly}
95
+ aria-readonly={readOnly}
96
+ class={cleanClass(
97
+ inputStyles({
98
+ shape,
99
+ textSize: size,
100
+ padding: shape === 'round' ? 'round' : 'base',
101
+ roundedSize: shape === 'semi-round' ? size : undefined,
102
+ invalid,
103
+ }),
104
+ className,
105
+ )}
106
+ bind:value
107
+ {...restProps}
108
+ />
109
+ </div>
@@ -1,4 +1,10 @@
1
+ import type { Shape, Size } from '../../types.js';
1
2
  import type { HTMLInputAttributes } from 'svelte/elements';
2
- import type { WithElementRef } from 'bits-ui';
3
- declare const Input: import("svelte").Component<WithElementRef<HTMLInputAttributes>, {}, "value" | "ref">;
3
+ declare const Input: import("svelte").Component<{
4
+ class?: string;
5
+ value?: string;
6
+ size?: Size;
7
+ shape?: Shape;
8
+ inputSize?: HTMLInputAttributes["size"];
9
+ } & Omit<HTMLInputAttributes, "size">, {}, "value">;
4
10
  export default Input;
@@ -8,6 +8,7 @@
8
8
  size: HeadingSize;
9
9
  color?: Color;
10
10
  class?: string;
11
+
11
12
  children: Snippet;
12
13
  };
13
14
 
@@ -23,7 +24,7 @@
23
24
  };
24
25
 
25
26
  const styles = tv({
26
- base: 'leading-none tracking-tight',
27
+ base: 'font-bold leading-none tracking-tight',
27
28
  variants: {
28
29
  color: {
29
30
  primary: 'text-primary',
@@ -34,12 +35,12 @@
34
35
  info: 'text-info',
35
36
  },
36
37
  size: {
37
- tiny: 'text-lg font-bold',
38
- small: 'text-xl font-bold',
39
- medium: 'text-2xl font-bold',
40
- large: 'text-3xl font-bold',
41
- giant: 'text-4xl font-bold',
42
- title: 'text-5xl font-bold',
38
+ tiny: 'text-lg',
39
+ small: 'text-xl',
40
+ medium: 'text-2xl',
41
+ large: 'text-3xl',
42
+ giant: 'text-4xl',
43
+ title: 'text-5xl',
43
44
  },
44
45
  },
45
46
  });
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { cleanClass } from '../../utils.js';
3
+ import type { Snippet } from 'svelte';
4
+ import type { HTMLAnchorAttributes } from 'svelte/elements';
5
+
6
+ type Props = {
7
+ class?: string;
8
+ children: Snippet;
9
+ href: string;
10
+ } & HTMLAnchorAttributes;
11
+
12
+ const { href, class: className, children, ...restProps }: Props = $props();
13
+ </script>
14
+
15
+ <a {href} class={cleanClass('underline', className)} {...restProps}>
16
+ {@render children()}
17
+ </a>
@@ -0,0 +1,8 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAnchorAttributes } from 'svelte/elements';
3
+ declare const Link: import("svelte").Component<{
4
+ class?: string;
5
+ children: Snippet;
6
+ href: string;
7
+ } & HTMLAnchorAttributes, {}, "">;
8
+ export default Link;
@@ -5,6 +5,6 @@
5
5
  const { class: className, children, ...props }: HStackProps = $props();
6
6
  </script>
7
7
 
8
- <Stack direction="row" class={className} {...props}>
8
+ <Stack direction="row" align="center" class={className} {...props}>
9
9
  {@render children()}
10
10
  </Stack>
@@ -1,8 +1,9 @@
1
1
  declare const HStack: import("svelte").Component<{
2
2
  class?: string;
3
3
  children: import("svelte").Snippet;
4
- align?: "start" | "center" | "end";
5
4
  gap?: import("../../types.js").Gap;
6
5
  wrap?: boolean;
6
+ fullWidth?: boolean;
7
+ fullHeight?: boolean;
7
8
  }, {}, "">;
8
9
  export default HStack;
@@ -24,14 +24,6 @@
24
24
  center: 'items-center',
25
25
  end: 'items-end',
26
26
  },
27
- fullWidth: {
28
- true: 'w-full',
29
- false: '',
30
- },
31
- fullHeight: {
32
- true: 'h-full',
33
- false: '',
34
- },
35
27
  gap: {
36
28
  0: 'gap-0',
37
29
  1: 'gap-1',
@@ -58,8 +50,6 @@
58
50
  direction,
59
51
  gap,
60
52
  wrap,
61
- fullWidth: direction === 'row',
62
- fullHeight: direction === 'column',
63
53
  }),
64
54
  className,
65
55
  )}
@@ -5,6 +5,6 @@
5
5
  const { class: className, children, ...props }: VStackProps = $props();
6
6
  </script>
7
7
 
8
- <Stack direction="column" class={className} {...props}>
8
+ <Stack direction="column" align="center" class={className} {...props}>
9
9
  {@render children()}
10
10
  </Stack>
@@ -1,8 +1,9 @@
1
1
  declare const VStack: import("svelte").Component<{
2
2
  class?: string;
3
3
  children: import("svelte").Snippet;
4
- align?: "start" | "center" | "end";
5
4
  gap?: import("../../types.js").Gap;
6
5
  wrap?: boolean;
6
+ fullWidth?: boolean;
7
+ fullHeight?: boolean;
7
8
  }, {}, "">;
8
9
  export default VStack;
@@ -0,0 +1,94 @@
1
+ <script lang="ts">
2
+ import Logo from '../Logo/Logo.svelte';
3
+ import Text from '../Text/Text.svelte';
4
+ import type { Size } from '../../types.js';
5
+ import { cleanClass } from '../../utils.js';
6
+ import type { Snippet } from 'svelte';
7
+ import { tv } from 'tailwind-variants';
8
+
9
+ type Props = {
10
+ effect?: 'hover' | 'always';
11
+ text?: string;
12
+ size?: Size;
13
+ children?: Snippet;
14
+ };
15
+
16
+ const { effect = 'hover', text = 'Supporter', size = 'medium', children }: Props = $props();
17
+
18
+ const iconSize: Record<Size, Size> = {
19
+ tiny: 'tiny',
20
+ small: 'tiny',
21
+ medium: 'small',
22
+ large: 'medium',
23
+ giant: 'medium',
24
+ };
25
+
26
+ const containerStyles = tv({
27
+ base: 'bg-secondary flex place-items-center gap-2 overflow-hidden rounded-lg transition-all',
28
+ variants: {
29
+ size: {
30
+ tiny: 'px-2 py-1',
31
+ small: 'px-2 py-1',
32
+ medium: 'px-3 py-2',
33
+ large: 'px-3 py-2',
34
+ giant: 'px-3 py-2',
35
+ },
36
+ effect: {
37
+ hover: 'border border-dark/25 supporter-effect-hover',
38
+ always: 'shadow supporter-effect',
39
+ },
40
+ },
41
+ });
42
+ </script>
43
+
44
+ <div class={cleanClass(containerStyles({ effect, size }))}>
45
+ {#if children}
46
+ {@render children()}
47
+ {:else}
48
+ <Logo size={iconSize[size]} variant="icon" />
49
+ <Text fontWeight="normal" color="secondary" {size}>{text}</Text>
50
+ {/if}
51
+ </div>
52
+
53
+ <style>
54
+ .supporter-effect,
55
+ .supporter-effect-hover:hover {
56
+ position: relative;
57
+ background-clip: padding-box;
58
+ animation: gradient 10s ease infinite;
59
+ z-index: 1;
60
+ }
61
+
62
+ .supporter-effect:after,
63
+ .supporter-effect-hover:hover:after {
64
+ position: absolute;
65
+ top: 0px;
66
+ bottom: 0px;
67
+ left: 0px;
68
+ right: 0px;
69
+ background: linear-gradient(
70
+ to right,
71
+ rgba(16, 132, 254, 0.15),
72
+ rgba(229, 125, 175, 0.15),
73
+ rgba(254, 36, 29, 0.15),
74
+ rgba(255, 183, 0, 0.15),
75
+ rgba(22, 193, 68, 0.15)
76
+ );
77
+ content: '';
78
+ animation: gradient 10s ease infinite;
79
+ background-size: 400% 400%;
80
+ z-index: -1;
81
+ }
82
+
83
+ @keyframes gradient {
84
+ 0% {
85
+ background-position: 0% 50%;
86
+ }
87
+ 50% {
88
+ background-position: 100% 50%;
89
+ }
90
+ 100% {
91
+ background-position: 0% 50%;
92
+ }
93
+ }
94
+ </style>
@@ -0,0 +1,9 @@
1
+ import type { Size } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ declare const SupporterBadge: import("svelte").Component<{
4
+ effect?: "hover" | "always";
5
+ text?: string;
6
+ size?: Size;
7
+ children?: Snippet;
8
+ }, {}, "">;
9
+ export default SupporterBadge;
@@ -6,11 +6,11 @@
6
6
 
7
7
  type Props = {
8
8
  color?: Color;
9
+ class?: string;
9
10
  size?: Size;
10
11
  children: Snippet;
11
12
  variant?: 'italic';
12
13
  fontWeight?: 'light' | 'normal' | 'semi-bold' | 'bold';
13
- class?: string;
14
14
  };
15
15
 
16
16
  const { color, size, fontWeight = 'normal', children, class: className }: Props = $props();
@@ -2,10 +2,10 @@ import type { Color, Size } from '../../types.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  declare const Text: import("svelte").Component<{
4
4
  color?: Color;
5
+ class?: string;
5
6
  size?: Size;
6
7
  children: Snippet;
7
8
  variant?: "italic";
8
9
  fontWeight?: "light" | "normal" | "semi-bold" | "bold";
9
- class?: string;
10
10
  }, {}, "">;
11
11
  export default Text;
@@ -1,4 +1,6 @@
1
- export declare enum ContextKey {
1
+ export declare enum ChildKey {
2
+ Field = "field",
3
+ HelperText = "helped-text",
2
4
  Card = "card",
3
5
  CardHeader = "card-header",
4
6
  CardBody = "card-body",
package/dist/constants.js CHANGED
@@ -1,7 +1,9 @@
1
- export var ContextKey;
2
- (function (ContextKey) {
3
- ContextKey["Card"] = "card";
4
- ContextKey["CardHeader"] = "card-header";
5
- ContextKey["CardBody"] = "card-body";
6
- ContextKey["CardFooter"] = "card-footer";
7
- })(ContextKey || (ContextKey = {}));
1
+ export var ChildKey;
2
+ (function (ChildKey) {
3
+ ChildKey["Field"] = "field";
4
+ ChildKey["HelperText"] = "helped-text";
5
+ ChildKey["Card"] = "card";
6
+ ChildKey["CardHeader"] = "card-header";
7
+ ChildKey["CardBody"] = "card-body";
8
+ ChildKey["CardFooter"] = "card-footer";
9
+ })(ChildKey || (ChildKey = {}));
package/dist/index.d.ts CHANGED
@@ -6,15 +6,20 @@ export { default as CardDescription } from './components/Card/CardDescription.sv
6
6
  export { default as CardFooter } from './components/Card/CardFooter.svelte';
7
7
  export { default as CardHeader } from './components/Card/CardHeader.svelte';
8
8
  export { default as CardTitle } from './components/Card/CardTitle.svelte';
9
+ export { default as CloseButton } from './components/CloseButton/CloseButton.svelte';
9
10
  export { default as Checkbox } from './components/Form/Checkbox.svelte';
11
+ export { default as Field } from './components/Form/Field.svelte';
12
+ export { default as HelperText } from './components/Form/HelperText.svelte';
10
13
  export { default as Input } from './components/Form/Input.svelte';
11
14
  export { default as Label } from './components/Form/Label.svelte';
12
15
  export { default as Heading } from './components/Heading/Heading.svelte';
13
16
  export { default as Icon } from './components/Icon/Icon.svelte';
14
17
  export { default as IconButton } from './components/IconButton/IconButton.svelte';
18
+ export { default as Link } from './components/Link/Link.svelte';
15
19
  export { default as Logo } from './components/Logo/Logo.svelte';
16
20
  export { default as HStack } from './components/Stack/HStack.svelte';
17
21
  export { default as Stack } from './components/Stack/Stack.svelte';
18
22
  export { default as VStack } from './components/Stack/VStack.svelte';
23
+ export { default as SupporterBadge } from './components/SupporterBadge/SupporterBadge.svelte';
19
24
  export { default as Text } from './components/Text/Text.svelte';
20
25
  export * from './types.js';
package/dist/index.js CHANGED
@@ -6,15 +6,20 @@ export { default as CardDescription } from './components/Card/CardDescription.sv
6
6
  export { default as CardFooter } from './components/Card/CardFooter.svelte';
7
7
  export { default as CardHeader } from './components/Card/CardHeader.svelte';
8
8
  export { default as CardTitle } from './components/Card/CardTitle.svelte';
9
+ export { default as CloseButton } from './components/CloseButton/CloseButton.svelte';
9
10
  export { default as Checkbox } from './components/Form/Checkbox.svelte';
11
+ export { default as Field } from './components/Form/Field.svelte';
12
+ export { default as HelperText } from './components/Form/HelperText.svelte';
10
13
  export { default as Input } from './components/Form/Input.svelte';
11
14
  export { default as Label } from './components/Form/Label.svelte';
12
15
  export { default as Heading } from './components/Heading/Heading.svelte';
13
16
  export { default as Icon } from './components/Icon/Icon.svelte';
14
17
  export { default as IconButton } from './components/IconButton/IconButton.svelte';
18
+ export { default as Link } from './components/Link/Link.svelte';
15
19
  export { default as Logo } from './components/Logo/Logo.svelte';
16
20
  export { default as HStack } from './components/Stack/HStack.svelte';
17
21
  export { default as Stack } from './components/Stack/Stack.svelte';
18
22
  export { default as VStack } from './components/Stack/VStack.svelte';
23
+ export { default as SupporterBadge } from './components/SupporterBadge/SupporterBadge.svelte';
19
24
  export { default as Text } from './components/Text/Text.svelte';
20
25
  export * from './types.js';
@@ -1,12 +1,12 @@
1
1
  <script lang="ts">
2
- import { ContextKey } from '../constants.js';
2
+ import { ChildKey } from '../constants.js';
3
3
  import { withPrefix } from '../utils.js';
4
4
  import { getContext, type Snippet } from 'svelte';
5
5
 
6
- type ContextType = { register: (key: ContextKey, snippet: Snippet) => void };
6
+ type ContextType = { register: (key: ChildKey, snippet: Snippet) => void };
7
7
  type Props = {
8
- for: ContextKey;
9
- as: ContextKey;
8
+ for: ChildKey;
9
+ as: ChildKey;
10
10
  children: Snippet;
11
11
  };
12
12
 
@@ -1,8 +1,8 @@
1
- import { ContextKey } from '../constants.js';
1
+ import { ChildKey } from '../constants.js';
2
2
  import { type Snippet } from 'svelte';
3
3
  declare const Child: import("svelte").Component<{
4
- for: ContextKey;
5
- as: ContextKey;
4
+ for: ChildKey;
5
+ as: ChildKey;
6
6
  children: Snippet;
7
7
  }, {}, "">;
8
8
  export default Child;
package/dist/types.d.ts CHANGED
@@ -11,12 +11,14 @@ type ButtonOrAnchor = ({
11
11
  } & HTMLButtonAttributes) | ({
12
12
  href: string;
13
13
  } & HTMLAnchorAttributes);
14
- type ButtonBaseProps = {
14
+ export type CloseButtonProps = {
15
+ size?: Size;
16
+ variant?: Variants;
17
+ };
18
+ type ButtonBaseProps = CloseButtonProps & {
15
19
  class?: string;
16
20
  color?: Color;
17
- size?: Size;
18
21
  shape?: Shape;
19
- variant?: Variants;
20
22
  } & ButtonOrAnchor;
21
23
  export type IconProps = {
22
24
  icon: string;
@@ -39,13 +41,22 @@ export type ButtonProps = ButtonBaseProps & {
39
41
  type StackBaseProps = {
40
42
  class?: string;
41
43
  children: Snippet;
42
- align?: 'start' | 'center' | 'end';
43
44
  gap?: Gap;
44
45
  wrap?: boolean;
46
+ fullWidth?: boolean;
47
+ fullHeight?: boolean;
45
48
  };
46
49
  export type StackProps = StackBaseProps & {
50
+ align?: 'start' | 'center' | 'end';
47
51
  direction?: 'row' | 'column';
48
52
  };
49
53
  export type HStackProps = StackBaseProps;
50
54
  export type VStackProps = StackBaseProps;
55
+ export type FieldContext = {
56
+ label?: string;
57
+ invalid?: boolean;
58
+ disabled?: boolean;
59
+ required?: boolean;
60
+ readOnly?: boolean;
61
+ };
51
62
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { ContextKey } from './constants.js';
2
1
  export declare const cleanClass: (...classNames: unknown[]) => string;
3
- export declare const withPrefix: (key: ContextKey) => string;
2
+ export declare const withPrefix: (key: string) => string;
3
+ export declare const generateId: () => string;
package/dist/utils.js CHANGED
@@ -9,3 +9,5 @@ export const cleanClass = (...classNames) => {
9
9
  .join(' ');
10
10
  };
11
11
  export const withPrefix = (key) => `immich-ui-${key}`;
12
+ let _count = 0;
13
+ export const generateId = () => `id-${_count++}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "scripts": {
6
6
  "start": "npm run start:dev",
@@ -1,5 +0,0 @@
1
- import { ContextKey } from '../constants.js';
2
- import { type Snippet } from 'svelte';
3
- export declare const withChildrenSnippets: (key: ContextKey) => {
4
- getChildren: (key: ContextKey) => Snippet<[]> | undefined;
5
- };