@ims360/svelte-ivory 0.4.21 → 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 (72) hide show
  1. package/dist/components/basic/checkbox/Checkbox.svelte +3 -8
  2. package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -1
  3. package/dist/components/buttons/CopyToClipboardButton.svelte +1 -1
  4. package/dist/components/buttons/CopyToClipboardButton.svelte.d.ts.map +1 -1
  5. package/dist/components/inputs/FileInput.svelte +5 -2
  6. package/dist/components/inputs/FileInput.svelte.d.ts.map +1 -1
  7. package/dist/components/inputs/PasswordCreateInput.svelte +1 -1
  8. package/dist/components/layout/dialog/Dialog.svelte +19 -20
  9. package/dist/components/layout/dialog/Dialog.svelte.d.ts +1 -4
  10. package/dist/components/layout/dialog/Dialog.svelte.d.ts.map +1 -1
  11. package/dist/components/layout/drawer/Drawer.svelte +21 -41
  12. package/dist/components/layout/drawer/Drawer.svelte.d.ts +4 -5
  13. package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
  14. package/dist/components/layout/index.d.ts +0 -1
  15. package/dist/components/layout/index.d.ts.map +1 -1
  16. package/dist/components/layout/index.js +0 -1
  17. package/dist/components/layout/modal/Modal.svelte +19 -84
  18. package/dist/components/layout/modal/Modal.svelte.d.ts +5 -14
  19. package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
  20. package/dist/components/layout/popover/Popover.svelte +1 -2
  21. package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -1
  22. package/dist/components/layout/tabs/Tab.svelte +0 -2
  23. package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -1
  24. package/dist/components/table/Column.svelte +0 -2
  25. package/dist/components/table/Column.svelte.d.ts.map +1 -1
  26. package/dist/components/table/ColumnHead.svelte +1 -2
  27. package/dist/components/table/ColumnHead.svelte.d.ts.map +1 -1
  28. package/dist/components/table/Table.svelte +9 -13
  29. package/dist/components/table/Table.svelte.d.ts +3 -3
  30. package/dist/components/table/Table.svelte.d.ts.map +1 -1
  31. package/dist/components/table/VirtualList.svelte +9 -5
  32. package/dist/components/table/VirtualList.svelte.d.ts +2 -2
  33. package/dist/components/table/VirtualList.svelte.d.ts.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -0
  37. package/dist/theme.svelte.d.ts +0 -36
  38. package/dist/theme.svelte.d.ts.map +1 -1
  39. package/dist/{components/toast/toasts.svelte.d.ts → toasts.svelte.d.ts} +2 -1
  40. package/dist/toasts.svelte.d.ts.map +1 -0
  41. package/dist/{components/toast/toasts.svelte.js → toasts.svelte.js} +2 -2
  42. package/package.json +9 -13
  43. package/src/lib/components/basic/checkbox/Checkbox.svelte +3 -8
  44. package/src/lib/components/buttons/CopyToClipboardButton.svelte +1 -1
  45. package/src/lib/components/inputs/FileInput.svelte +5 -2
  46. package/src/lib/components/inputs/PasswordCreateInput.svelte +1 -1
  47. package/src/lib/components/layout/dialog/Dialog.svelte +19 -20
  48. package/src/lib/components/layout/drawer/Drawer.svelte +21 -41
  49. package/src/lib/components/layout/index.ts +0 -1
  50. package/src/lib/components/layout/modal/Modal.svelte +19 -84
  51. package/src/lib/components/layout/popover/Popover.svelte +1 -2
  52. package/src/lib/components/layout/tabs/Tab.svelte +0 -2
  53. package/src/lib/components/table/Column.svelte +0 -2
  54. package/src/lib/components/table/ColumnHead.svelte +1 -2
  55. package/src/lib/components/table/Table.svelte +9 -13
  56. package/src/lib/components/table/VirtualList.svelte +9 -5
  57. package/src/lib/index.ts +1 -0
  58. package/src/lib/theme.svelte.ts +0 -36
  59. package/src/lib/{components/toast/toasts.svelte.ts → toasts.svelte.ts} +3 -2
  60. package/dist/components/layout/Heading.svelte +0 -25
  61. package/dist/components/layout/Heading.svelte.d.ts +0 -9
  62. package/dist/components/layout/Heading.svelte.d.ts.map +0 -1
  63. package/dist/components/toast/Toast.svelte +0 -105
  64. package/dist/components/toast/Toast.svelte.d.ts +0 -18
  65. package/dist/components/toast/Toast.svelte.d.ts.map +0 -1
  66. package/dist/components/toast/index.d.ts +0 -3
  67. package/dist/components/toast/index.d.ts.map +0 -1
  68. package/dist/components/toast/index.js +0 -2
  69. package/dist/components/toast/toasts.svelte.d.ts.map +0 -1
  70. package/src/lib/components/layout/Heading.svelte +0 -25
  71. package/src/lib/components/toast/Toast.svelte +0 -105
  72. package/src/lib/components/toast/index.ts +0 -2
@@ -1,30 +1,17 @@
1
1
  <script lang="ts" module>
2
- import type { Variant } from '$lib';
3
- import { theme } from '$lib/theme.svelte';
2
+ import type { IvoryComponent } from '$lib/types';
4
3
  import { merge } from '$lib/utils/functions';
5
- import { X } from '@lucide/svelte';
6
4
  import { type Snippet } from 'svelte';
7
5
  import type { ClassValue, MouseEventHandler } from 'svelte/elements';
8
- import { Heading } from '..';
9
- import { Dialog } from '../dialog';
6
+ import { Dialog, type DialogProps } from '../dialog';
10
7
 
11
8
  /** Props for the modal, expose if you overwrite the defaults in a custom component */
12
- export type ModalProps = {
9
+ export type ModalProps = IvoryComponent<HTMLDivElement> & {
13
10
  /** Class of the modal itself, does not apply to the inner div */
14
11
  class?: ClassValue;
15
- /** Class of the div wrapping the children */
16
- innerClass?: ClassValue;
12
+ dialog?: DialogProps;
17
13
  /** Content of the modal */
18
14
  children?: Snippet;
19
- /**
20
- * If `true` the modal will not close when clicking outside of it
21
- *
22
- * Defaults to `true`
23
- * */
24
- closeOnOutsideClick?: boolean;
25
- /** Variant of the modal, applies styling to the header */
26
- variant?: Variant;
27
- title?: string | Snippet;
28
15
  onclick?: MouseEventHandler<HTMLDivElement>;
29
16
  };
30
17
  </script>
@@ -35,16 +22,7 @@
35
22
  inner?: Snippet;
36
23
  }
37
24
 
38
- let {
39
- class: clazz = 'flex flex-col',
40
- title,
41
- children,
42
- inner,
43
- closeOnOutsideClick = true,
44
- variant,
45
- innerClass,
46
- ...rest
47
- }: Props = $props();
25
+ let { children, dialog: dialogProps = {}, ...props }: Props = $props();
48
26
 
49
27
  let dialog = $state<Dialog>();
50
28
 
@@ -59,72 +37,29 @@
59
37
 
60
38
  const onclick: MouseEventHandler<HTMLDivElement> = (e) => {
61
39
  e.stopPropagation();
62
- rest.onclick?.(e);
40
+ props.onclick?.(e);
63
41
  };
64
42
  </script>
65
43
 
66
44
  <!--
67
45
  @component
68
- A modal, comes with a title, close button and different variants per default.
46
+ A modal inside a dialog element
69
47
  -->
70
48
  <Dialog
71
49
  bind:this={dialog}
72
- onclose={() => {
73
- if (closeOnOutsideClick) close();
74
- }}
75
- class="flex h-full w-full flex-col items-center justify-center p-2 sm:p-4 md:p-8 lg:p-12 xl:p-16"
50
+ {...dialogProps}
51
+ class={merge(
52
+ 'flex h-full w-full flex-col items-center justify-center p-2 sm:p-4 md:p-8 lg:p-12 xl:p-16',
53
+ dialogProps?.class
54
+ )}
76
55
  >
77
- {#if inner}
78
- <div {...rest} {onclick} class={merge('modal-content transition-all ease-in-out', clazz)}>
79
- {@render inner()}
80
- </div>
81
- {:else}
82
- <div
83
- class={merge(
84
- 'modal-content bg-surface-50-950 flex max-h-full max-w-full flex-col overflow-hidden rounded transition-all ease-in-out',
85
- theme.current.modal?.class,
86
- clazz
87
- )}
88
- {...rest}
89
- {onclick}
90
- >
91
- <div
92
- class={[
93
- 'flex flex-row items-center justify-between gap-4 px-4 py-3',
94
- !variant && 'pb-0',
95
- variant === 'primary' && 'preset-tonal-primary',
96
- variant === 'secondary' && 'preset-tonal-secondary',
97
- variant === 'tertiary' && 'preset-tonal-tertiary',
98
- variant === 'success' && 'preset-tonal-success',
99
- variant === 'warning' && 'preset-tonal-warning',
100
- variant === 'error' && 'preset-tonal-error',
101
- variant === 'surface' && 'preset-tonal-surface'
102
- ]}
103
- >
104
- {#if title}
105
- <Heading class="flex grow flex-row items-center gap-4">
106
- {#if typeof title === 'function'}
107
- {@render title()}
108
- {:else}
109
- {title}
110
- {/if}
111
- </Heading>
112
- {/if}
113
- <button class="group ml-auto flex justify-end" type="button" onclick={close}>
114
- <X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
115
- </button>
116
- </div>
117
- <div
118
- class={merge(
119
- 'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
120
- theme.current.modal?.innerClass,
121
- innerClass
122
- )}
123
- >
124
- {@render children?.()}
125
- </div>
126
- </div>
127
- {/if}
56
+ <div
57
+ {...props}
58
+ {onclick}
59
+ class={merge('modal-content transition-all ease-in-out', props.class)}
60
+ >
61
+ {@render children?.()}
62
+ </div>
128
63
  </Dialog>
129
64
 
130
65
  <style>
@@ -1,5 +1,4 @@
1
1
  <script lang="ts" module>
2
- import { theme } from '$lib/theme.svelte';
3
2
  import type { IvoryComponent } from '$lib/types';
4
3
  import { merge, pseudoRandomId } from '$lib/utils/functions';
5
4
 
@@ -173,7 +172,7 @@
173
172
  bind:this={popoverEl}
174
173
  style="{style} {externalStyle}"
175
174
  {popover}
176
- class={merge('bg-transparent not-open:hidden!', theme.current.popover?.class, clazz)}
175
+ class={merge('bg-transparent not-open:hidden!', clazz)}
177
176
  {...rest}
178
177
  >
179
178
  {@render children?.()}
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" module>
2
2
  import { page } from '$app/state';
3
- import { theme } from '$lib/theme.svelte';
4
3
  import type { IvoryComponent } from '$lib/types';
5
4
  import { merge, pseudoRandomId } from '$lib/utils/functions';
6
5
  import { onMount, type Snippet } from 'svelte';
@@ -52,7 +51,6 @@
52
51
  this={href ? 'a' : 'button'}
53
52
  class={merge(
54
53
  'btn flex h-fit w-fit shrink-0 items-center justify-center px-0 text-xl font-bold select-none',
55
- theme.current.tabs?.tab?.class?.(selected),
56
54
  typeof clazz === 'function' ? clazz(selected) : clazz
57
55
  )}
58
56
  onclick={href
@@ -1,5 +1,4 @@
1
1
  <script lang="ts" module>
2
- import { theme } from '$lib/theme.svelte';
3
2
  import { merge } from '$lib/utils/functions';
4
3
  import { type Snippet } from 'svelte';
5
4
  import type { ClassValue } from 'svelte/elements';
@@ -76,7 +75,6 @@
76
75
  class={merge(
77
76
  'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
78
77
  column.width !== 0 && 'border-r-[calc(var(--spacing)*2)] border-transparent',
79
- theme.current.table?.column?.class,
80
78
  clazz
81
79
  )}
82
80
  />
@@ -1,5 +1,4 @@
1
1
  <script lang="ts" module>
2
- import { theme } from '$lib/theme.svelte';
3
2
  import { merge } from '$lib/utils/functions';
4
3
  import { getContext, setContext, type Snippet } from 'svelte';
5
4
  import { resize } from '../../utils/attachments';
@@ -48,7 +47,7 @@
48
47
  </script>
49
48
 
50
49
  <div
51
- class={merge('group flex shrink-0 flex-row justify-start', theme.current.table?.head?.class)}
50
+ class={merge('group flex shrink-0 flex-row justify-start')}
52
51
  bind:this={target}
53
52
  style="width: {column?.width ?? 0}px;"
54
53
  >
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import { theme } from '$lib/theme.svelte';
3
2
  import { merge } from '$lib/utils/functions';
4
3
  import { ChevronRight } from '@lucide/svelte';
5
4
  import { getContext, setContext, untrack, type Snippet } from 'svelte';
6
- import type { ClassValue } from 'svelte/elements';
5
+ import type { ClassValue, HTMLAttributes } from 'svelte/elements';
7
6
  import { SvelteSet } from 'svelte/reactivity';
8
7
  import ColumnComponent from './Column.svelte';
9
8
  import { ColumnController, type ColumnConfig } from './columnController.svelte';
@@ -22,8 +21,8 @@
22
21
  virtualized?: boolean;
23
22
  /** Renders the rows */
24
23
  children?: Snippet<[{ row: T; nestingLevel?: number; index: number }]>;
25
- rowClass?: ClassValue;
26
- headerClass?: ClassValue;
24
+ row?: HTMLAttributes<HTMLDivElement>;
25
+ header?: HTMLAttributes<HTMLDivElement>;
27
26
  search?: {
28
27
  term: string;
29
28
  matches: (row: T) => boolean;
@@ -67,8 +66,8 @@
67
66
  class: clazz,
68
67
  data,
69
68
  children: passedChildren,
70
- rowClass = 'hover:bg-surface-950-50/10 transition-colors',
71
- headerClass,
69
+ row,
70
+ header: headerProps,
72
71
  rowHeight = 64,
73
72
  onclick,
74
73
  href,
@@ -202,20 +201,17 @@
202
201
  bind:this={list}
203
202
  bind:b_scrollTop
204
203
  data={results.entries}
205
- class={merge(
206
- 'flex flex-col overflow-hidden border-transparent',
207
- theme.current.table?.class,
208
- clazz
209
- )}
210
- rowClass={merge('pl-2 pr-4', theme.current.table?.row?.class, rowClass)}
204
+ class={merge('flex flex-col overflow-hidden border-transparent', clazz)}
205
+ {row}
211
206
  {rowHeight}
212
207
  {virtualized}
213
208
  >
214
209
  {#snippet header()}
215
210
  <div
211
+ {...headerProps}
216
212
  class={merge(
217
213
  'flex w-fit min-w-full flex-row border-b border-inherit pr-4 pl-2',
218
- headerClass
214
+ headerProps?.class
219
215
  )}
220
216
  >
221
217
  {#if results.someHaveChildren}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" generics="T extends { id: string }">
2
2
  import { merge } from '$lib/utils/functions';
3
3
  import { onMount, tick, untrack, type Snippet } from 'svelte';
4
- import type { ClassValue } from 'svelte/elements';
4
+ import type { ClassValue, HTMLAttributes } from 'svelte/elements';
5
5
 
6
6
  type Props<T> = {
7
7
  class?: ClassValue;
@@ -11,7 +11,7 @@
11
11
  b_scrollTop?: number;
12
12
  rowHeight: number;
13
13
  overscan?: number;
14
- rowClass?: ClassValue;
14
+ row?: HTMLAttributes<HTMLDivElement>;
15
15
  virtualized?: boolean;
16
16
  };
17
17
 
@@ -23,12 +23,12 @@
23
23
  b_scrollTop = $bindable(),
24
24
  rowHeight,
25
25
  overscan = 2,
26
- rowClass,
26
+ row: rowProps,
27
27
  virtualized = true
28
28
  }: Props<T> = $props();
29
29
 
30
30
  const finalRowClass = $derived(
31
- merge('flex w-full shrink-0 grow flex-row items-center overflow-hidden', rowClass)
31
+ merge('flex w-full shrink-0 grow flex-row items-center overflow-hidden', rowProps?.class)
32
32
  );
33
33
 
34
34
  let viewportReactivity = $state(0);
@@ -131,7 +131,11 @@
131
131
  style="padding-top: {top}px; padding-bottom: {bottom}px; min-width: max(100%, {header_width}px) !important;"
132
132
  >
133
133
  {#each visible as row, i (row.data.id)}
134
- <div class={finalRowClass} style="height: {rowHeight}px !important;">
134
+ <div
135
+ {...rowProps}
136
+ class={finalRowClass}
137
+ style="height: {rowHeight}px !important; {rowProps?.style}"
138
+ >
135
139
  {@render children({
136
140
  row: row.data,
137
141
  domIndex: i,
package/src/lib/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Reexport your entry components here
2
2
  export { ColorTheme, type ColorThemePreference } from './colorTheme.svelte';
3
3
  export { theme, type Theme } from './theme.svelte';
4
+ export { Toasts, type ToastSettings } from './toasts.svelte';
4
5
  export { type IvoryComponent } from './types';
5
6
 
6
7
  export type Variant =
@@ -2,45 +2,9 @@ import type { RemoteFormIssue } from '@sveltejs/kit';
2
2
  import type { ClassValue } from 'svelte/elements';
3
3
 
4
4
  export interface Theme {
5
- checkbox?: {
6
- class?: (checked: boolean, partial: boolean) => ClassValue;
7
- };
8
- heading?: {
9
- class?: ClassValue;
10
- };
11
5
  dialog?: {
12
6
  class?: ClassValue;
13
7
  };
14
- tabs?: {
15
- tab?: {
16
- class?: (active: boolean) => ClassValue;
17
- };
18
- };
19
- table?: {
20
- class?: ClassValue;
21
- column?: {
22
- class?: ClassValue;
23
- };
24
- head?: {
25
- class?: ClassValue;
26
- };
27
- row?: {
28
- class?: ClassValue;
29
- };
30
- };
31
- modal?: {
32
- class?: ClassValue;
33
- innerClass?: ClassValue;
34
- dialog?: {
35
- class?: ClassValue;
36
- };
37
- };
38
- drawer?: {
39
- class?: ClassValue;
40
- };
41
- popover?: {
42
- class?: ClassValue;
43
- };
44
8
  input?: {
45
9
  outerClass?: ClassValue;
46
10
  class?: (value: boolean, issues?: boolean) => ClassValue;
@@ -1,3 +1,4 @@
1
+ import type { Variant } from '$lib';
1
2
  import { pseudoRandomId } from '$lib/utils/functions';
2
3
  import type { Icon } from '@lucide/svelte';
3
4
 
@@ -7,7 +8,7 @@ export interface ToastSettings {
7
8
  timeout?: number;
8
9
  hideDismiss?: boolean;
9
10
  icon?: typeof Icon;
10
- variant: 'info' | 'success' | 'warning' | 'error';
11
+ variant: Variant;
11
12
  }
12
13
 
13
14
  interface Toast extends ToastSettings {
@@ -19,7 +20,7 @@ const TOAST_DEFAULTS: ToastSettings = {
19
20
  message: 'Missing Toast Message',
20
21
  autohide: true,
21
22
  timeout: 3000,
22
- variant: 'info'
23
+ variant: 'primary'
23
24
  };
24
25
 
25
26
  class ToastStore {
@@ -1,25 +0,0 @@
1
- <script lang="ts" module>
2
- import { theme } from '../../theme.svelte';
3
- import type { IvoryComponent } from '../../types';
4
- import { merge } from '../../utils/functions';
5
- import type { ClassValue } from 'svelte/elements';
6
-
7
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
8
- class?: ClassValue;
9
- }
10
- </script>
11
-
12
- <script lang="ts">
13
- let { children, class: clazz, ...rest }: HeadingProps = $props();
14
- </script>
15
-
16
- <h2
17
- class={merge(
18
- 'shrink-0 truncate text-lg font-bold select-none',
19
- theme.current.heading?.class,
20
- clazz
21
- )}
22
- {...rest}
23
- >
24
- {@render children?.()}
25
- </h2>
@@ -1,9 +0,0 @@
1
- import type { IvoryComponent } from '../../types';
2
- import type { ClassValue } from 'svelte/elements';
3
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
4
- class?: ClassValue;
5
- }
6
- declare const Heading: import("svelte").Component<HeadingProps, {}, "">;
7
- type Heading = ReturnType<typeof Heading>;
8
- export default Heading;
9
- //# sourceMappingURL=Heading.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Heading.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/Heading.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IACpE,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAkBL,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -1,105 +0,0 @@
1
- <script lang="ts" module>
2
- export interface Props {
3
- class?: ClassValue;
4
- children?: Snippet<[toast: ToastSettings & { close: () => void }]>;
5
- duration?: number;
6
- }
7
- </script>
8
-
9
- <!--
10
- @component
11
- Renders the toasts that have been triggered by the `Toasts` store.
12
- Make sure to include this component in your root `+layout.svelte` file.
13
- -->
14
- <script lang="ts">
15
- import type { Icon } from '@lucide/svelte';
16
- import { Check, CircleAlert, Info, TriangleAlert, X } from '@lucide/svelte';
17
- import type { Snippet } from 'svelte';
18
- import { flip } from 'svelte/animate';
19
- import type { ClassValue } from 'svelte/elements';
20
- import { fly, scale } from 'svelte/transition';
21
- import { Toasts, type ToastSettings } from './toasts.svelte';
22
-
23
- let { class: clazz = 'px-2 pb-2', children, duration = 200 }: Props = $props();
24
-
25
- function getIcon(
26
- variant: 'info' | 'success' | 'warning' | 'error',
27
- icon?: typeof Icon
28
- ): typeof Icon {
29
- if (icon) return icon;
30
- switch (variant) {
31
- case 'info':
32
- return Info;
33
- case 'success':
34
- return Check;
35
- case 'warning':
36
- return CircleAlert;
37
- case 'error':
38
- return TriangleAlert;
39
- }
40
- }
41
- </script>
42
-
43
- <div
44
- class="pointer-events-none absolute top-0 left-0 z-50 flex h-full w-full flex-col items-center justify-start"
45
- >
46
- <div
47
- class={[
48
- 'flex h-full max-h-full flex-col-reverse items-center justify-end gap-2 overflow-hidden',
49
- clazz
50
- ]}
51
- >
52
- {#each Toasts.toasts as toast (toast.id)}
53
- {@const VariantIcon = getIcon(toast.variant, toast.icon)}
54
- <div
55
- in:fly={{ y: '-100%', duration }}
56
- out:scale={{ duration }}
57
- animate:flip={{ duration }}
58
- onpointerenter={() => {
59
- Toasts.freeze(toast.id);
60
- }}
61
- onpointerleave={() => {
62
- Toasts.unfreeze(toast.id);
63
- }}
64
- class="group pointer-events-auto flex h-fit w-fit flex-row items-center"
65
- >
66
- {#if children}
67
- {@render children({
68
- ...toast,
69
- close: () => Toasts.close(toast.id)
70
- })}
71
- {:else}
72
- <div
73
- class={[
74
- 'bg-opacity-85 flex flex-row items-center gap-4 rounded px-4 py-2 shadow-lg group-last:rounded-t-none',
75
- toast.variant === 'info' &&
76
- 'bg-primary-200-800 text-primary-contrast-50-950',
77
- toast.variant === 'success' &&
78
- 'bg-success-200-800 text-success-contrast-50-950',
79
- toast.variant === 'warning' &&
80
- 'bg-warning-200-800 text-warning-contrast-50-950',
81
- toast.variant === 'error' &&
82
- 'bg-error-200-800 text-error-contrast-50-950'
83
- ]}
84
- >
85
- <VariantIcon />
86
- <p class="font-bold">
87
- {toast.message}
88
- </p>
89
- {#if !toast.hideDismiss}
90
- <button
91
- type="button"
92
- onclick={() => {
93
- Toasts.close(toast.id);
94
- }}
95
- class="group"
96
- >
97
- <X size={20} class="stroke-1 transition-all group-hover:stroke-2" />
98
- </button>
99
- {/if}
100
- </div>
101
- {/if}
102
- </div>
103
- {/each}
104
- </div>
105
- </div>
@@ -1,18 +0,0 @@
1
- export interface Props {
2
- class?: ClassValue;
3
- children?: Snippet<[toast: ToastSettings & {
4
- close: () => void;
5
- }]>;
6
- duration?: number;
7
- }
8
- import type { Snippet } from 'svelte';
9
- import type { ClassValue } from 'svelte/elements';
10
- import { type ToastSettings } from './toasts.svelte';
11
- /**
12
- * Renders the toasts that have been triggered by the `Toasts` store.
13
- * Make sure to include this component in your root `+layout.svelte` file.
14
- */
15
- declare const Toast: import("svelte").Component<Props, {}, "">;
16
- type Toast = ReturnType<typeof Toast>;
17
- export default Toast;
18
- //# sourceMappingURL=Toast.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Toast.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.svelte.ts"],"names":[],"mappings":"AAGI,MAAM,WAAW,KAAK;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAKL,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAmF7D;;;GAGG;AACH,QAAA,MAAM,KAAK,2CAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as ToastUI, type Props as ToastUIProps } from './Toast.svelte';
2
- export { Toasts, type ToastSettings } from './toasts.svelte';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,KAAK,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as ToastUI } from './Toast.svelte';
2
- export { Toasts } from './toasts.svelte';
@@ -1 +0,0 @@
1
- {"version":3,"file":"toasts.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/toasts.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;CACrD;AAED,UAAU,KAAM,SAAQ,aAAa;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAC7C;AASD,cAAM,UAAU;IACZ,MAAM,UAAuB;IAE7B,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,SAA0B;IAW1D,KAAK,CAAC,EAAE,EAAE,MAAM;IAOhB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAiBvC,MAAM,CAAC,EAAE,EAAE,MAAM;IAMjB,QAAQ,CAAC,EAAE,EAAE,MAAM;IAMnB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;CAKvB;AAED,2EAA2E;AAC3E,eAAO,MAAM,MAAM,YAAmB,CAAC"}
@@ -1,25 +0,0 @@
1
- <script lang="ts" module>
2
- import { theme } from '$lib/theme.svelte';
3
- import type { IvoryComponent } from '$lib/types';
4
- import { merge } from '$lib/utils/functions';
5
- import type { ClassValue } from 'svelte/elements';
6
-
7
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
8
- class?: ClassValue;
9
- }
10
- </script>
11
-
12
- <script lang="ts">
13
- let { children, class: clazz, ...rest }: HeadingProps = $props();
14
- </script>
15
-
16
- <h2
17
- class={merge(
18
- 'shrink-0 truncate text-lg font-bold select-none',
19
- theme.current.heading?.class,
20
- clazz
21
- )}
22
- {...rest}
23
- >
24
- {@render children?.()}
25
- </h2>