@immich/ui 0.3.0 → 0.5.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 (75) hide show
  1. package/dist/common/use-context.svelte.d.ts +5 -0
  2. package/dist/common/use-context.svelte.js +19 -0
  3. package/dist/components/Alert/Alert.svelte +50 -0
  4. package/dist/components/Alert/Alert.svelte.d.ts +9 -0
  5. package/dist/components/Button/Button.svelte +8 -0
  6. package/dist/components/Button/Button.svelte.d.ts +4 -0
  7. package/dist/components/Card/Card.svelte +187 -0
  8. package/dist/components/Card/Card.svelte.d.ts +11 -0
  9. package/dist/components/Card/CardBody.svelte +20 -0
  10. package/dist/components/Card/CardBody.svelte.d.ts +6 -0
  11. package/dist/components/Card/CardDescription.svelte +16 -0
  12. package/dist/components/Card/CardDescription.svelte.d.ts +6 -0
  13. package/dist/components/Card/CardFooter.svelte +15 -0
  14. package/dist/components/Card/CardFooter.svelte.d.ts +5 -0
  15. package/dist/components/Card/CardHeader.svelte +15 -0
  16. package/dist/components/Card/CardHeader.svelte.d.ts +5 -0
  17. package/dist/components/Card/CardTitle.svelte +17 -0
  18. package/dist/components/Card/CardTitle.svelte.d.ts +8 -0
  19. package/dist/components/CloseButton/CloseButton.svelte +9 -0
  20. package/dist/components/CloseButton/CloseButton.svelte.d.ts +3 -0
  21. package/dist/components/{Checkbox.svelte → Form/Checkbox.svelte} +20 -30
  22. package/dist/components/{Checkbox.svelte.d.ts → Form/Checkbox.svelte.d.ts} +1 -1
  23. package/dist/components/{Input.svelte → Form/Input.svelte} +1 -1
  24. package/dist/components/{Label.svelte → Form/Label.svelte} +1 -1
  25. package/dist/components/Heading/Heading.svelte +54 -0
  26. package/dist/components/Heading/Heading.svelte.d.ts +9 -0
  27. package/dist/components/Icon/Icon.svelte +52 -0
  28. package/dist/components/Icon/Icon.svelte.d.ts +4 -0
  29. package/dist/components/IconButton/IconButton.svelte +11 -0
  30. package/dist/components/IconButton/IconButton.svelte.d.ts +3 -0
  31. package/dist/components/Link/Link.svelte +17 -0
  32. package/dist/components/Link/Link.svelte.d.ts +8 -0
  33. package/dist/components/{Logo.svelte → Logo/Logo.svelte} +11 -10
  34. package/dist/components/{Logo.svelte.d.ts → Logo/Logo.svelte.d.ts} +1 -1
  35. package/dist/components/Stack/HStack.svelte +10 -0
  36. package/dist/components/Stack/HStack.svelte.d.ts +8 -0
  37. package/dist/components/Stack/Stack.svelte +68 -0
  38. package/dist/components/Stack/Stack.svelte.d.ts +3 -0
  39. package/dist/components/Stack/VStack.svelte +10 -0
  40. package/dist/components/Stack/VStack.svelte.d.ts +8 -0
  41. package/dist/components/SupporterBadge/SupporterBadge.svelte +94 -0
  42. package/dist/components/SupporterBadge/SupporterBadge.svelte.d.ts +9 -0
  43. package/dist/components/Text/Text.svelte +49 -0
  44. package/dist/components/Text/Text.svelte.d.ts +11 -0
  45. package/dist/constants.d.ts +6 -0
  46. package/dist/constants.js +7 -0
  47. package/dist/index.d.ts +22 -1
  48. package/dist/index.js +22 -1
  49. package/dist/{components → internal}/Button.svelte +79 -71
  50. package/dist/internal/Button.svelte.d.ts +6 -0
  51. package/dist/internal/Child.svelte +21 -0
  52. package/dist/internal/Child.svelte.d.ts +8 -0
  53. package/dist/types.d.ts +50 -0
  54. package/dist/utils.d.ts +2 -0
  55. package/dist/utils.js +1 -0
  56. package/package.json +2 -1
  57. package/dist/components/Button.svelte.d.ts +0 -15
  58. package/dist/components/Card.svelte +0 -20
  59. package/dist/components/Card.svelte.d.ts +0 -4
  60. package/dist/components/CardBody.svelte +0 -16
  61. package/dist/components/CardBody.svelte.d.ts +0 -4
  62. package/dist/components/CardDescription.svelte +0 -16
  63. package/dist/components/CardDescription.svelte.d.ts +0 -4
  64. package/dist/components/CardFooter.svelte +0 -16
  65. package/dist/components/CardFooter.svelte.d.ts +0 -4
  66. package/dist/components/CardHeader.svelte +0 -17
  67. package/dist/components/CardHeader.svelte.d.ts +0 -4
  68. package/dist/components/CardTitle.svelte +0 -25
  69. package/dist/components/CardTitle.svelte.d.ts +0 -7
  70. package/dist/components/Icon.svelte +0 -62
  71. package/dist/components/Icon.svelte.d.ts +0 -20
  72. package/dist/components/index.d.ts +0 -12
  73. package/dist/components/index.js +0 -12
  74. /package/dist/components/{Input.svelte.d.ts → Form/Input.svelte.d.ts} +0 -0
  75. /package/dist/components/{Label.svelte.d.ts → Form/Label.svelte.d.ts} +0 -0
@@ -0,0 +1,5 @@
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
+ };
@@ -0,0 +1,19 @@
1
+ import { ContextKey } from '../constants.js';
2
+ import { withPrefix } from '../utils.js';
3
+ import { setContext } from 'svelte';
4
+ import { SvelteMap } from 'svelte/reactivity';
5
+ export const withChildrenSnippets = (key) => {
6
+ const map = $state(new SvelteMap());
7
+ setContext(withPrefix(key), {
8
+ register: async (child, snippet) => {
9
+ if (map.has(child)) {
10
+ console.warn(`Snippet with key ${child} already exists in the context`);
11
+ return;
12
+ }
13
+ map.set(child, snippet);
14
+ },
15
+ });
16
+ return {
17
+ getChildren: (key) => map.get(key),
18
+ };
19
+ };
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ import Card from '../Card/Card.svelte';
3
+ import CardHeader from '../Card/CardHeader.svelte';
4
+ import Icon from '../Icon/Icon.svelte';
5
+ import Text from '../Text/Text.svelte';
6
+ import type { Color } from '../../types.js';
7
+ import {
8
+ mdiAlertOutline,
9
+ mdiCheckCircleOutline,
10
+ mdiCloseCircleOutline,
11
+ mdiInformationOutline,
12
+ } from '@mdi/js';
13
+ import type { Snippet } from 'svelte';
14
+
15
+ type Props = {
16
+ color?: Color;
17
+ icon?: string;
18
+ title: string;
19
+ children?: Snippet;
20
+ };
21
+
22
+ const { color = 'info', icon: iconOverride, title, children }: Props = $props();
23
+
24
+ const icons: Partial<Record<Color, string>> = {
25
+ success: mdiCheckCircleOutline,
26
+ warning: mdiAlertOutline,
27
+ danger: mdiCloseCircleOutline,
28
+ };
29
+
30
+ const icon = $derived(iconOverride || (icons[color] ?? mdiInformationOutline));
31
+ </script>
32
+
33
+ <Card {color} variant="subtle">
34
+ <CardHeader>
35
+ <div class="flex gap-2">
36
+ {#if icon}
37
+ <div>
38
+ <Icon {icon} size="1.5em" class="h-7" />
39
+ </div>
40
+ {/if}
41
+
42
+ <div class="flex flex-col gap-2">
43
+ <Text size="large" fontWeight={children ? 'bold' : undefined}>{title}</Text>
44
+ {#if children}
45
+ {@render children()}
46
+ {/if}
47
+ </div>
48
+ </div>
49
+ </CardHeader>
50
+ </Card>
@@ -0,0 +1,9 @@
1
+ import type { Color } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ declare const Alert: import("svelte").Component<{
4
+ color?: Color;
5
+ icon?: string;
6
+ title: string;
7
+ children?: Snippet;
8
+ }, {}, "">;
9
+ export default Alert;
@@ -0,0 +1,8 @@
1
+ <script lang="ts">
2
+ import Button from '../../internal/Button.svelte';
3
+ import type { ButtonProps } from '../../types.js';
4
+
5
+ const props: ButtonProps = $props();
6
+ </script>
7
+
8
+ <Button {...props} />
@@ -0,0 +1,4 @@
1
+ import Button from '../../internal/Button.svelte';
2
+ import type { ButtonProps } from '../../types.js';
3
+ declare const Button: import("svelte").Component<ButtonProps, {}, "">;
4
+ export default Button;
@@ -0,0 +1,187 @@
1
+ <script lang="ts">
2
+ import { withChildrenSnippets } from '../../common/use-context.svelte.js';
3
+ import IconButton from '../IconButton/IconButton.svelte';
4
+ import { ContextKey } from '../../constants.js';
5
+ import type { Color, Shape } from '../../types.js';
6
+ import { cleanClass } from '../../utils.js';
7
+ import { mdiChevronDown } from '@mdi/js';
8
+ import { type Snippet } from 'svelte';
9
+ import type { HTMLAttributes } from 'svelte/elements';
10
+ import { tv } from 'tailwind-variants';
11
+
12
+ type Props = HTMLAttributes<HTMLDivElement> & {
13
+ color?: Color;
14
+ shape?: Shape;
15
+ variant?: 'filled' | 'outline' | 'subtle';
16
+ expandable?: boolean;
17
+ children: Snippet;
18
+ };
19
+
20
+ let {
21
+ color = 'secondary',
22
+ class: className,
23
+ expandable = false,
24
+ variant,
25
+ children,
26
+ ...restProps
27
+ }: Props = $props();
28
+
29
+ const cardStyles = tv({
30
+ base: 'rounded-2xl bg-light text-dark shadow-sm dark:border-gray-600 w-full overflow-hidden',
31
+ variants: {
32
+ defaultStyle: {
33
+ true: 'border border-gray-300 dark:border-gray-600',
34
+ false: '',
35
+ default: '',
36
+ },
37
+ outlineColor: {
38
+ primary: 'border border-primary',
39
+ secondary: 'border border-gray-300 dark:border-gray-600',
40
+ success: 'border border-success',
41
+ danger: 'border border-danger',
42
+ warning: 'border border-warning',
43
+ info: 'border border-info',
44
+ },
45
+ subtleColor: {
46
+ primary: 'bg-primary/50 dark:bg-primary/25',
47
+ secondary: 'bg-dark/15 text-dark',
48
+ success: 'bg-success/25 dark:bg-success/50',
49
+ danger: 'bg-danger/25 dark:bg-danger/50',
50
+ warning: 'bg-warning/25 dark:bg-warning/50',
51
+ info: 'bg-info/25',
52
+ },
53
+ },
54
+ });
55
+
56
+ const headerContainerStyles = tv({
57
+ variants: {
58
+ bottomPadding: {
59
+ true: '',
60
+ false: 'pb-0',
61
+ },
62
+ filledColor: {
63
+ primary: 'bg-primary text-light rounded-t-xl',
64
+ secondary: 'bg-dark text-light rounded-t-xl',
65
+ success: 'bg-success text-light rounded-t-xl',
66
+ danger: 'bg-danger text-light rounded-t-xl',
67
+ warning: 'bg-warning text-black rounded-t-xl',
68
+ info: 'bg-info text-light rounded-t-xl',
69
+ },
70
+ outlineColor: {
71
+ primary: 'text-primary',
72
+ secondary: 'text-dark',
73
+ success: 'text-success',
74
+ danger: 'text-danger',
75
+ warning: 'text-warning',
76
+ info: 'text-info',
77
+ },
78
+ },
79
+ });
80
+
81
+ const iconStyles = tv({
82
+ variants: {
83
+ filledColor: {
84
+ primary: 'text-light',
85
+ secondary: 'text-light',
86
+ success: 'text-light',
87
+ danger: 'text-light',
88
+ warning: 'text-dark',
89
+ info: 'text-light',
90
+ },
91
+ outlineColor: {
92
+ primary: 'text-primary',
93
+ secondary: 'text-dark',
94
+ success: 'text-success',
95
+ danger: 'text-danger',
96
+ warning: 'text-warning',
97
+ info: 'text-info',
98
+ },
99
+ },
100
+ });
101
+
102
+ let expanded = $state(!expandable);
103
+ const onToggle = () => {
104
+ expanded = !expanded;
105
+ };
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));
111
+
112
+ const headerClasses = 'flex flex-col space-y-1.5';
113
+ const headerContainerClasses = $derived(
114
+ cleanClass(
115
+ headerContainerStyles({
116
+ bottomPadding: variant === 'filled' || !bodyChildren,
117
+ outlineColor: variant === 'outline' ? color : undefined,
118
+ filledColor: variant === 'filled' ? color : undefined,
119
+ }),
120
+ ),
121
+ );
122
+ </script>
123
+
124
+ {#snippet header()}
125
+ {#if expandable}
126
+ <button type="button" onclick={onToggle} class="w-full">
127
+ <div class={cleanClass(headerContainerClasses, 'flex items-center justify-between px-4')}>
128
+ <div class={cleanClass(headerClasses, 'py-4')}>
129
+ {@render headerChildren?.()}
130
+ </div>
131
+ <div>
132
+ <IconButton
133
+ class={iconStyles({
134
+ filledColor: variant === 'filled' ? color : undefined,
135
+ outlineColor: variant === 'outline' ? color : undefined,
136
+ }) as Color}
137
+ icon={mdiChevronDown}
138
+ flopped={expanded}
139
+ variant="ghost"
140
+ shape="round"
141
+ size="large"
142
+ />
143
+ </div>
144
+ </div>
145
+ </button>
146
+ {:else}
147
+ <div class={cleanClass(headerClasses, headerContainerClasses, 'p-4')}>
148
+ {@render headerChildren?.()}
149
+ </div>
150
+ {/if}
151
+ {/snippet}
152
+
153
+ {#snippet body()}
154
+ {@render bodyChildren?.()}
155
+ {/snippet}
156
+
157
+ {#snippet footer()}
158
+ <div class="flex items-center p-4 pt-0">
159
+ {@render footerChildren?.()}
160
+ </div>
161
+ {/snippet}
162
+
163
+ <div
164
+ class={cleanClass(
165
+ cardStyles({
166
+ defaultStyle: variant === undefined,
167
+ outlineColor: variant === 'outline' || variant === 'filled' ? color : undefined,
168
+ subtleColor: variant === 'subtle' ? color : undefined,
169
+ }),
170
+ className,
171
+ )}
172
+ {...restProps}
173
+ >
174
+ {#if headerChildren}
175
+ {@render header()}
176
+ {/if}
177
+
178
+ {#if bodyChildren && expanded}
179
+ {@render body()}
180
+ {/if}
181
+
182
+ {#if footerChildren}
183
+ {@render footer()}
184
+ {/if}
185
+
186
+ {@render children()}
187
+ </div>
@@ -0,0 +1,11 @@
1
+ import type { Color, Shape } from '../../types.js';
2
+ import { type Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ declare const Card: import("svelte").Component<HTMLAttributes<HTMLDivElement> & {
5
+ color?: Color;
6
+ shape?: Shape;
7
+ variant?: "filled" | "outline" | "subtle";
8
+ expandable?: boolean;
9
+ children: Snippet;
10
+ }, {}, "">;
11
+ export default Card;
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { ContextKey } from '../../constants.js';
3
+ import Child from '../../internal/Child.svelte';
4
+ import { cleanClass } from '../../utils.js';
5
+ import type { Snippet } from 'svelte';
6
+ import { twMerge } from 'tailwind-merge';
7
+
8
+ type Props = {
9
+ class?: string;
10
+ children: Snippet;
11
+ };
12
+
13
+ let { class: className, children }: Props = $props();
14
+ </script>
15
+
16
+ <Child for={ContextKey.Card} as={ContextKey.CardBody}>
17
+ <div class={twMerge(cleanClass('p-4', className))}>
18
+ {@render children?.()}
19
+ </div>
20
+ </Child>
@@ -0,0 +1,6 @@
1
+ import type { Snippet } from 'svelte';
2
+ declare const CardBody: import("svelte").Component<{
3
+ class?: string;
4
+ children: Snippet;
5
+ }, {}, "">;
6
+ export default CardBody;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import Text from '../Text/Text.svelte';
3
+ import { cleanClass } from '../../utils.js';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ type Props = {
7
+ class?: string;
8
+ children: Snippet;
9
+ };
10
+
11
+ let { children, class: className }: Props = $props();
12
+ </script>
13
+
14
+ <Text size="small" class={cleanClass('text-dark/75', className)}>
15
+ {@render children?.()}
16
+ </Text>
@@ -0,0 +1,6 @@
1
+ import type { Snippet } from 'svelte';
2
+ declare const CardDescription: import("svelte").Component<{
3
+ class?: string;
4
+ children: Snippet;
5
+ }, {}, "">;
6
+ export default CardDescription;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { ContextKey } from '../../constants.js';
3
+ import Child from '../../internal/Child.svelte';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ type Props = {
7
+ children: Snippet;
8
+ };
9
+
10
+ let { children }: Props = $props();
11
+ </script>
12
+
13
+ <Child for={ContextKey.Card} as={ContextKey.CardFooter}>
14
+ {@render children?.()}
15
+ </Child>
@@ -0,0 +1,5 @@
1
+ import type { Snippet } from 'svelte';
2
+ declare const CardFooter: import("svelte").Component<{
3
+ children: Snippet;
4
+ }, {}, "">;
5
+ export default CardFooter;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { ContextKey } from '../../constants.js';
3
+ import Child from '../../internal/Child.svelte';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ type Props = {
7
+ children: Snippet;
8
+ };
9
+
10
+ let { children }: Props = $props();
11
+ </script>
12
+
13
+ <Child for={ContextKey.Card} as={ContextKey.CardHeader}>
14
+ {@render children?.()}
15
+ </Child>
@@ -0,0 +1,5 @@
1
+ import type { Snippet } from 'svelte';
2
+ declare const CardHeader: import("svelte").Component<{
3
+ children: Snippet;
4
+ }, {}, "">;
5
+ export default CardHeader;
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import Heading from '../Heading/Heading.svelte';
3
+ import type { HeadingSize } from '../../types.js';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ type Props = {
7
+ class?: string;
8
+ size?: HeadingSize;
9
+ children: Snippet;
10
+ };
11
+
12
+ const { size = 'small', class: className, children }: Props = $props();
13
+ </script>
14
+
15
+ <Heading {size} class={className}>
16
+ {@render children?.()}
17
+ </Heading>
@@ -0,0 +1,8 @@
1
+ import type { HeadingSize } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ declare const CardTitle: import("svelte").Component<{
4
+ class?: string;
5
+ size?: HeadingSize;
6
+ children: Snippet;
7
+ }, {}, "">;
8
+ export default CardTitle;
@@ -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;
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
2
  import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
3
3
  import { mdiCheck, mdiMinus } from '@mdi/js';
4
- import Icon from './Icon.svelte';
4
+ import Icon from '../Icon/Icon.svelte';
5
5
  import { tv } from 'tailwind-variants';
6
- import type { Color, Shape, Size } from '../types.js';
7
- import { cleanClass } from '../utils.js';
6
+ import type { Color, Shape, Size } from '../../types.js';
7
+ import { cleanClass } from '../../utils.js';
8
8
 
9
9
  type CheckboxProps = WithoutChildrenOrChild<CheckboxPrimitive.RootProps> & {
10
10
  color?: Color;
@@ -40,30 +40,17 @@
40
40
  },
41
41
  size: {
42
42
  tiny: 'size-4',
43
- small: 'size-6',
44
- medium: 'size-8',
45
- large: 'size-16',
46
- giant: 'size-32',
43
+ small: 'size-5',
44
+ medium: 'size-6',
45
+ large: 'size-8',
46
+ giant: 'size-10',
47
47
  },
48
- },
49
- compoundVariants: [
50
- //
51
- { size: 'tiny', shape: 'semi-round', class: 'rounded' },
52
- { size: 'small', shape: 'semi-round', class: 'rounded-md' },
53
- { size: 'large', shape: 'semi-round', class: 'rounded-xl' },
54
- { size: 'giant', shape: 'semi-round', class: 'rounded-2xl' },
55
- ],
56
- });
57
-
58
- const parent = tv({
59
- base: 'flex items-center justify-center text-current',
60
- variants: {
61
- size: {
62
- tiny: 'size-4',
63
- small: 'size-6',
64
- medium: 'size-8',
65
- large: 'size-16',
66
- giant: 'size-32',
48
+ roundedSize: {
49
+ tiny: 'rounded-md',
50
+ small: 'rounded-md',
51
+ medium: 'rounded-md',
52
+ large: 'rounded-lg',
53
+ giant: 'rounded-xl',
67
54
  },
68
55
  },
69
56
  });
@@ -87,16 +74,19 @@
87
74
 
88
75
  <CheckboxPrimitive.Root
89
76
  bind:ref
90
- class={cleanClass(container({ size, color, shape }), className)}
77
+ class={cleanClass(
78
+ container({ size, color, shape, roundedSize: shape === 'semi-round' ? size : undefined }),
79
+ className,
80
+ )}
91
81
  bind:checked
92
82
  {...restProps}
93
83
  >
94
84
  {#snippet children({ checked })}
95
- <div class={parent({ size })}>
85
+ <div class={cleanClass('flex items-center justify-center text-current')}>
96
86
  {#if checked === true}
97
- <Icon path={mdiCheck} size="100%" class={cleanClass(icon({ color }))} />
87
+ <Icon icon={mdiCheck} size="100%" class={cleanClass(icon({ color }))} />
98
88
  {:else if checked === 'indeterminate'}
99
- <Icon path={mdiMinus} size="100%" class={cleanClass(icon({ color }))} />
89
+ <Icon icon={mdiMinus} size="100%" class={cleanClass(icon({ color }))} />
100
90
  {/if}
101
91
  </div>
102
92
  {/snippet}
@@ -1,5 +1,5 @@
1
1
  import { Checkbox as CheckboxPrimitive } from 'bits-ui';
2
- import type { Color, Shape, Size } from '../types.js';
2
+ import type { Color, Shape, Size } from '../../types.js';
3
3
  declare const Checkbox: import("svelte").Component<Omit<Omit<CheckboxPrimitive.RootProps, "child">, "children"> & {
4
4
  color?: Color;
5
5
  shape?: Shape;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
  import type { WithElementRef } from 'bits-ui';
4
- import { cleanClass } from '../utils.js';
4
+ import { cleanClass } from '../../utils.js';
5
5
 
6
6
  let {
7
7
  ref = $bindable(null),
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { cleanClass } from '../utils.js';
2
+ import { cleanClass } from '../../utils.js';
3
3
  import { Label as LabelPrimitive } from 'bits-ui';
4
4
 
5
5
  let {
@@ -0,0 +1,54 @@
1
+ <script lang="ts">
2
+ import type { Color, HeadingSize } from '../../types.js';
3
+ import { cleanClass } from '../../utils.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { tv } from 'tailwind-variants';
6
+
7
+ type Props = {
8
+ size: HeadingSize;
9
+ color?: Color;
10
+ class?: string;
11
+
12
+ children: Snippet;
13
+ };
14
+
15
+ const { color, size, class: className, children }: Props = $props();
16
+
17
+ const sizes = {
18
+ title: 'h1',
19
+ giant: 'h2',
20
+ large: 'h3',
21
+ medium: 'h4',
22
+ small: 'h5',
23
+ tiny: 'h6',
24
+ };
25
+
26
+ const styles = tv({
27
+ base: 'font-bold leading-none tracking-tight',
28
+ variants: {
29
+ color: {
30
+ primary: 'text-primary',
31
+ secondary: 'text-dark',
32
+ success: 'text-success',
33
+ danger: 'text-danger',
34
+ warning: 'text-warning',
35
+ info: 'text-info',
36
+ },
37
+ size: {
38
+ tiny: 'text-lg',
39
+ small: 'text-xl',
40
+ medium: 'text-2xl',
41
+ large: 'text-3xl',
42
+ giant: 'text-4xl',
43
+ title: 'text-5xl',
44
+ },
45
+ },
46
+ });
47
+
48
+ const tag = $derived(sizes[size] ?? 'h6');
49
+ const classList = $derived(cleanClass(styles({ color, size }), className));
50
+ </script>
51
+
52
+ <svelte:element this={tag} class={classList} role="heading">
53
+ {@render children()}
54
+ </svelte:element>
@@ -0,0 +1,9 @@
1
+ import type { Color, HeadingSize } from '../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ declare const Heading: import("svelte").Component<{
4
+ size: HeadingSize;
5
+ color?: Color;
6
+ class?: string;
7
+ children: Snippet;
8
+ }, {}, "">;
9
+ export default Heading;
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import type { IconProps } from '../../types.js';
3
+ import { cleanClass } from '../../utils.js';
4
+ import type { HTMLAttributes } from 'svelte/elements';
5
+
6
+ const {
7
+ size = '1em',
8
+ viewBox = '0 0 24 24',
9
+ class: className = '',
10
+ flipped = false,
11
+ flopped = false,
12
+ spin = false,
13
+ strokeColor = 'transparent',
14
+ strokeWidth = 2,
15
+ role = 'img',
16
+ title,
17
+ icon,
18
+ color = 'currentColor',
19
+ description,
20
+ ...restProps
21
+ }: IconProps & HTMLAttributes<EventTarget> = $props();
22
+ </script>
23
+
24
+ <svg
25
+ width={size}
26
+ height={size}
27
+ {viewBox}
28
+ class={cleanClass(
29
+ className,
30
+ flipped && '-scale-x-100',
31
+ flopped && 'rotate-180',
32
+ spin && 'animate-spin',
33
+ )}
34
+ stroke={strokeColor}
35
+ stroke-width={strokeWidth}
36
+ {role}
37
+ {...restProps}
38
+ >
39
+ {#if title}
40
+ <title>{title}</title>
41
+ {/if}
42
+ {#if description}
43
+ <desc>{description}</desc>
44
+ {/if}
45
+ <path d={icon} fill={color} />
46
+ </svg>
47
+
48
+ <style>
49
+ svg {
50
+ transition: transform 0.2s ease;
51
+ }
52
+ </style>