@ims360/svelte-ivory 0.0.33 → 0.0.35

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 (48) hide show
  1. package/dist/components/basic/checkbox/Checkbox.svelte +8 -8
  2. package/dist/components/basic/checkbox/Checkbox.svelte.d.ts +1 -3
  3. package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -1
  4. package/dist/components/layout/drawer/Drawer.svelte +8 -3
  5. package/dist/components/layout/drawer/Drawer.svelte.d.ts +2 -2
  6. package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
  7. package/dist/components/layout/hiddenBackground/HiddenBackground.svelte +9 -9
  8. package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts +2 -4
  9. package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts.map +1 -1
  10. package/dist/components/layout/hiddenBackground/index.d.ts +1 -1
  11. package/dist/components/layout/hiddenBackground/index.d.ts.map +1 -1
  12. package/dist/components/layout/hiddenBackground/index.js +3 -3
  13. package/dist/components/layout/index.d.ts +6 -11
  14. package/dist/components/layout/index.d.ts.map +1 -1
  15. package/dist/components/layout/index.js +2 -7
  16. package/dist/components/layout/modal/Modal.svelte +13 -5
  17. package/dist/components/layout/modal/Modal.svelte.d.ts +3 -3
  18. package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
  19. package/dist/components/layout/portal/index.d.ts +6 -0
  20. package/dist/components/layout/portal/index.d.ts.map +1 -0
  21. package/dist/components/layout/portal/index.js +5 -0
  22. package/dist/components/layout/tabs/Tab.svelte +9 -7
  23. package/dist/components/layout/tabs/Tab.svelte.d.ts +1 -0
  24. package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -1
  25. package/dist/components/layout/tabs/index.d.ts +2 -0
  26. package/dist/components/layout/tabs/index.d.ts.map +1 -1
  27. package/dist/components/layout/tabs/index.js +3 -2
  28. package/dist/components/layout/tooltip/Tooltip.svelte +2 -2
  29. package/dist/components/layout/tooltip/Tooltip.svelte.d.ts +2 -2
  30. package/dist/components/layout/tooltip/Tooltip.svelte.d.ts.map +1 -1
  31. package/dist/types.d.ts +5 -0
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/utils/functions/transitionProps.d.ts +1 -0
  34. package/dist/utils/functions/transitionProps.d.ts.map +1 -0
  35. package/dist/utils/functions/transitionProps.js +1 -0
  36. package/package.json +1 -1
  37. package/src/lib/components/basic/checkbox/Checkbox.svelte +8 -8
  38. package/src/lib/components/layout/drawer/Drawer.svelte +8 -3
  39. package/src/lib/components/layout/hiddenBackground/HiddenBackground.svelte +9 -9
  40. package/src/lib/components/layout/hiddenBackground/index.ts +3 -3
  41. package/src/lib/components/layout/index.ts +16 -17
  42. package/src/lib/components/layout/modal/Modal.svelte +13 -5
  43. package/src/lib/components/layout/portal/index.ts +7 -0
  44. package/src/lib/components/layout/tabs/Tab.svelte +9 -7
  45. package/src/lib/components/layout/tabs/index.ts +4 -2
  46. package/src/lib/components/layout/tooltip/Tooltip.svelte +2 -2
  47. package/src/lib/types.ts +6 -0
  48. package/src/lib/utils/functions/transitionProps.ts +1 -0
@@ -1,5 +1,10 @@
1
1
  <script lang="ts" module>
2
2
  import type { IvoryComponent } from '../../../types';
3
+ import { Check, type Icon as LucideIcon, Minus } from '@lucide/svelte';
4
+ import clsx from 'clsx';
5
+ import type { ClassValue } from 'svelte/elements';
6
+ import { scale } from 'svelte/transition';
7
+ import { twMerge } from 'tailwind-merge';
3
8
 
4
9
  export interface CheckboxProps extends IvoryComponent<HTMLElement> {
5
10
  class?: ClassValue;
@@ -11,8 +16,6 @@
11
16
  /** if true, the onclick handler will not be called */
12
17
  disabled?: boolean;
13
18
  onclick?: () => void;
14
- /** data-testid */
15
- testId?: string;
16
19
  }
17
20
  </script>
18
21
 
@@ -22,11 +25,6 @@
22
25
  -->
23
26
 
24
27
  <script lang="ts">
25
- import { Check, type Icon as LucideIcon, Minus } from '@lucide/svelte';
26
- import clsx from 'clsx';
27
- import type { ClassValue } from 'svelte/elements';
28
- import { twMerge } from 'tailwind-merge';
29
-
30
28
  let {
31
29
  class: clazz,
32
30
  checked = false,
@@ -76,6 +74,8 @@
76
74
  {...rest}
77
75
  >
78
76
  {#if Icon}
79
- <Icon class="h-full w-full" size={16} strokeWidth={3} />
77
+ <div class="h-full w-full" transition:scale={{ duration: 150 }}>
78
+ <Icon class="h-full w-full" size={16} strokeWidth={3} />
79
+ </div>
80
80
  {/if}
81
81
  </svelte:element>
@@ -1,4 +1,5 @@
1
1
  import type { IvoryComponent } from '../../../types';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  export interface CheckboxProps extends IvoryComponent<HTMLElement> {
3
4
  class?: ClassValue;
4
5
  /** `checked` has prioriy over `partial` */
@@ -9,10 +10,7 @@ export interface CheckboxProps extends IvoryComponent<HTMLElement> {
9
10
  /** if true, the onclick handler will not be called */
10
11
  disabled?: boolean;
11
12
  onclick?: () => void;
12
- /** data-testid */
13
- testId?: string;
14
13
  }
15
- import type { ClassValue } from 'svelte/elements';
16
14
  /** It's a checkbox */
17
15
  declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "">;
18
16
  type Checkbox = ReturnType<typeof Checkbox>;
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/basic/checkbox/Checkbox.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAKL,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA2DlD,sBAAsB;AACtB,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/basic/checkbox/Checkbox.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAuDL,sBAAsB;AACtB,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '../../../types';
2
+ import type { IvoryComponent, TransitionProps } from '../../../types';
3
3
  import { X } from '@lucide/svelte';
4
4
  import clsx from 'clsx';
5
5
  import type { Snippet } from 'svelte';
@@ -11,7 +11,7 @@
11
11
 
12
12
  export type DrawerPlacement = 'left' | 'right';
13
13
 
14
- export interface DrawerProps extends IvoryComponent<HTMLDivElement> {
14
+ export interface DrawerProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
15
15
  class?: string;
16
16
  b_open: boolean;
17
17
  title?: string;
@@ -27,6 +27,10 @@
27
27
  children,
28
28
  title,
29
29
  placement = 'right',
30
+ inTransition = (e) =>
31
+ fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
32
+ outTransition = (e) =>
33
+ fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
30
34
  ...rest
31
35
  }: DrawerProps = $props();
32
36
 
@@ -49,8 +53,9 @@
49
53
  clazz
50
54
  ])
51
55
  )}
52
- transition:fly={{ x: placement === 'right' ? '100%' : '-100%', duration: 200 }}
53
56
  onclick={(e) => e.stopPropagation()}
57
+ in:inTransition
58
+ out:outTransition
54
59
  {...rest}
55
60
  >
56
61
  <div class="flex flex-row items-center justify-between gap-8">
@@ -1,7 +1,7 @@
1
- import type { IvoryComponent } from '../../../types';
1
+ import type { IvoryComponent, TransitionProps } from '../../../types';
2
2
  import type { Snippet } from 'svelte';
3
3
  export type DrawerPlacement = 'left' | 'right';
4
- export interface DrawerProps extends IvoryComponent<HTMLDivElement> {
4
+ export interface DrawerProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
5
5
  class?: string;
6
6
  b_open: boolean;
7
7
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAOtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAgDL,QAAA,MAAM,MAAM,uDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAOtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,cAAc,CAAC,EAAE,eAAe;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAoDL,QAAA,MAAM,MAAM,uDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '../../../types';
2
+ import type { IvoryComponent, TransitionProps } from '../../../types';
3
3
  import clsx from 'clsx';
4
4
  import type { ClassValue } from 'svelte/elements';
5
5
  import { fade } from 'svelte/transition';
@@ -12,12 +12,11 @@
12
12
  globalClass = value;
13
13
  }
14
14
 
15
- export const TEST_ID = 'background';
16
-
17
- export interface HiddenBackgroundProps extends IvoryComponent<HTMLDialogElement> {
15
+ export interface HiddenBackgroundProps
16
+ extends IvoryComponent<HTMLDialogElement>,
17
+ TransitionProps {
18
18
  /** Gets called when the dialog is clicked */
19
19
  onclose?: () => void;
20
- duration?: number;
21
20
  }
22
21
  </script>
23
22
 
@@ -26,7 +25,8 @@
26
25
  class: clazz,
27
26
  onclose,
28
27
  children,
29
- duration = 300,
28
+ inTransition = (e) => fade(e, { duration: 200 }),
29
+ outTransition = (e) => fade(e, { duration: 100 }),
30
30
  ...rest
31
31
  }: HiddenBackgroundProps = $props();
32
32
  </script>
@@ -34,7 +34,7 @@
34
34
  <dialog
35
35
  class={twMerge(
36
36
  clsx(
37
- 'bg-surface-950-50/40 absolute top-0 left-0 z-40 m-0 h-full w-full p-0',
37
+ 'bg-surface-950-50/40 pointer-events-auto absolute top-0 left-0 z-40 m-0 h-full w-full p-0',
38
38
  globalClass,
39
39
  clazz
40
40
  )
@@ -46,8 +46,8 @@
46
46
  callback: onclose ?? (() => {})
47
47
  }}
48
48
  onclick={onclose}
49
- transition:fade={{ duration }}
50
- data-testid={TEST_ID}
49
+ in:inTransition
50
+ out:outTransition
51
51
  {...rest}
52
52
  >
53
53
  {@render children?.()}
@@ -1,11 +1,9 @@
1
- import type { IvoryComponent } from '../../../types';
1
+ import type { IvoryComponent, TransitionProps } from '../../../types';
2
2
  import type { ClassValue } from 'svelte/elements';
3
3
  export declare function setClasses(value: ClassValue): void;
4
- export declare const TEST_ID = "background";
5
- export interface HiddenBackgroundProps extends IvoryComponent<HTMLDialogElement> {
4
+ export interface HiddenBackgroundProps extends IvoryComponent<HTMLDialogElement>, TransitionProps {
6
5
  /** Gets called when the dialog is clicked */
7
6
  onclose?: () => void;
8
- duration?: number;
9
7
  }
10
8
  declare const HiddenBackground: import("svelte").Component<HiddenBackgroundProps, {}, "">;
11
9
  type HiddenBackground = ReturnType<typeof HiddenBackground>;
@@ -1 +1 @@
1
- {"version":3,"file":"HiddenBackground.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/HiddenBackground.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOlD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,QAE3C;AAED,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAC5E,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AA6BL,QAAA,MAAM,gBAAgB,2DAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"HiddenBackground.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/HiddenBackground.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOlD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,QAE3C;AAED,MAAM,WAAW,qBACb,SAAQ,cAAc,CAAC,iBAAiB,CAAC,EACrC,eAAe;IACnB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AA8BL,QAAA,MAAM,gBAAgB,2DAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { setClasses } from './HiddenBackground.svelte';
2
2
  declare const HiddenBackground: import("svelte").Component<import("./HiddenBackground.svelte").HiddenBackgroundProps, {}, ""> & {
3
3
  setClasses: typeof setClasses;
4
- TEST_ID: string;
5
4
  };
6
5
  export default HiddenBackground;
6
+ export { type HiddenBackgroundProps } from './HiddenBackground.svelte';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAW,MAAM,2BAA2B,CAAC;AAErF,QAAA,MAAM,gBAAgB;;;CAGpB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5E,QAAA,MAAM,gBAAgB;;CAEpB,CAAC;AAEH,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,6 +1,6 @@
1
- import { default as HiddenBg, setClasses, TEST_ID } from './HiddenBackground.svelte';
1
+ import { default as HiddenBg, setClasses } from './HiddenBackground.svelte';
2
2
  const HiddenBackground = Object.assign(HiddenBg, {
3
- setClasses,
4
- TEST_ID
3
+ setClasses
5
4
  });
6
5
  export default HiddenBackground;
6
+ export {} from './HiddenBackground.svelte';
@@ -1,14 +1,9 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
2
  export { default as Heading } from './heading';
3
- export * from './hiddenBackground';
4
- export { default as HiddenBackground } from './hiddenBackground';
5
- export * from './modal/Modal.svelte';
6
- export { default as Modal } from './modal/Modal.svelte';
7
- export { default as Popover } from './popover/Popover.svelte';
8
- export * from './portal/Portal.svelte';
9
- export { default as Portal } from './portal/Portal.svelte';
10
- export * from './tabs';
11
- export { default as Tabs } from './tabs';
12
- export * from './tooltip/Tooltip.svelte';
13
- export { default as Tooltip } from './tooltip/Tooltip.svelte';
3
+ export { default as HiddenBackground, type HiddenBackgroundProps } from './hiddenBackground';
4
+ export { default as Modal, type ModalProps, type ModalVariant } from './modal/Modal.svelte';
5
+ export { default as Popover, type PopoverPlacement, type PopoverProps } from './popover/Popover.svelte';
6
+ export { default as Portal } from './portal';
7
+ export { getTabContext, default as Tabs, type TabPanelProps, type TabProps, type TabsProps } from './tabs';
8
+ export { default as Tooltip, type TooltipProps } from './tooltip/Tooltip.svelte';
14
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE3D,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EACH,OAAO,IAAI,OAAO,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACH,aAAa,EACb,OAAO,IAAI,IAAI,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,13 +1,8 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
2
  export { default as Heading } from './heading';
3
- export * from './hiddenBackground';
4
3
  export { default as HiddenBackground } from './hiddenBackground';
5
- export * from './modal/Modal.svelte';
6
4
  export { default as Modal } from './modal/Modal.svelte';
7
5
  export { default as Popover } from './popover/Popover.svelte';
8
- export * from './portal/Portal.svelte';
9
- export { default as Portal } from './portal/Portal.svelte';
10
- export * from './tabs';
11
- export { default as Tabs } from './tabs';
12
- export * from './tooltip/Tooltip.svelte';
6
+ export { default as Portal } from './portal';
7
+ export { getTabContext, default as Tabs } from './tabs';
13
8
  export { default as Tooltip } from './tooltip/Tooltip.svelte';
@@ -1,14 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '../../../types';
2
+ import type { IvoryComponent, TransitionProps } from '../../../types';
3
3
  import { X } from '@lucide/svelte';
4
4
  import clsx from 'clsx';
5
- import type { Snippet } from 'svelte';
5
+ import { type Snippet } from 'svelte';
6
6
  import type { ClassValue, MouseEventHandler } from 'svelte/elements';
7
+ import { fade } from 'svelte/transition';
7
8
  import { twMerge } from 'tailwind-merge';
8
9
  import { Heading, HiddenBackground, Portal } from '..';
9
10
 
10
11
  /** Props for the modal, expose if you overwrite the defaults in a custom component */
11
- export interface ModalProps extends IvoryComponent<HTMLDivElement> {
12
+ export interface ModalProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
12
13
  /** Class of the modal itself, does not apply to the inner div */
13
14
  class?: ClassValue;
14
15
  /** Class of the div wrapping the children */
@@ -42,6 +43,11 @@
42
43
  preventClosing = false,
43
44
  variant,
44
45
  innerClass,
46
+ inTransition = (e) =>
47
+ fade(e, {
48
+ duration: 200
49
+ }),
50
+ outTransition = () => ({}),
45
51
  ...rest
46
52
  }: Props = $props();
47
53
 
@@ -84,6 +90,8 @@
84
90
  )}
85
91
  {...rest}
86
92
  {onclick}
93
+ in:inTransition|global
94
+ out:outTransition|global
87
95
  >
88
96
  <div
89
97
  class={[
@@ -101,7 +109,7 @@
101
109
  <button
102
110
  class="group ml-auto flex justify-end"
103
111
  type="button"
104
- onclick={close}
112
+ onclick={() => close()}
105
113
  >
106
114
  <X
107
115
  class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
@@ -111,7 +119,7 @@
111
119
  <div
112
120
  class={twMerge(
113
121
  clsx(
114
- 'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
122
+ 'flex flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
115
123
  innerClass
116
124
  )
117
125
  )}
@@ -1,8 +1,8 @@
1
- import type { IvoryComponent } from '../../../types';
2
- import type { Snippet } from 'svelte';
1
+ import type { IvoryComponent, TransitionProps } from '../../../types';
2
+ import { type Snippet } from 'svelte';
3
3
  import type { ClassValue } from 'svelte/elements';
4
4
  /** Props for the modal, expose if you overwrite the defaults in a custom component */
5
- export interface ModalProps extends IvoryComponent<HTMLDivElement> {
5
+ export interface ModalProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
6
6
  /** Class of the modal itself, does not apply to the inner div */
7
7
  class?: ClassValue;
8
8
  /** Class of the div wrapping the children */
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAIrE,sFAAsF;AACtF,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC9D,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AA+EL,oFAAoF;AACpF,QAAA,MAAM,KAAK,iDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAKrE,sFAAsF;AACtF,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC,EAAE,eAAe;IAC/E,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAoFL,oFAAoF;AACpF,QAAA,MAAM,KAAK,iDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { setConfig } from './Portal.svelte';
2
+ declare const portal: import("svelte").Component<import("./Portal.svelte").PortalProps, {}, ""> & {
3
+ setConfig: typeof setConfig;
4
+ };
5
+ export default portal;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/portal/index.ts"],"names":[],"mappings":"AAAA,OAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEpD,QAAA,MAAM,MAAM;;CAEV,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ import Portal, { setConfig } from './Portal.svelte';
2
+ const portal = Object.assign(Portal, {
3
+ setConfig
4
+ });
5
+ export default portal;
@@ -8,6 +8,14 @@
8
8
  import { twMerge } from 'tailwind-merge';
9
9
  import { getTabContext } from './Tabs.svelte';
10
10
 
11
+ let defaultClass = $state(
12
+ (selected: boolean): ClassValue => [selected ? 'text-primary-500' : '']
13
+ );
14
+
15
+ export function setDefaultClass(clazz: (selected: boolean) => ClassValue) {
16
+ defaultClass = clazz;
17
+ }
18
+
11
19
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
12
20
  class?: ClassValue | ((selected: boolean) => ClassValue);
13
21
  id?: string | undefined;
@@ -24,13 +32,7 @@
24
32
  </script>
25
33
 
26
34
  <script lang="ts">
27
- let {
28
- class: clazz = (selected: boolean) => [selected && 'text-primary-500 underline'],
29
- id,
30
- href,
31
- children,
32
- active
33
- }: TabProps = $props();
35
+ let { class: clazz = defaultClass, id, href, children, active }: TabProps = $props();
34
36
 
35
37
  const tab = pseudoRandomId('tab-');
36
38
  const tabs = getTabContext();
@@ -1,6 +1,7 @@
1
1
  import type { IvoryComponent } from '../../../types';
2
2
  import { type Snippet } from 'svelte';
3
3
  import type { ClassValue } from 'svelte/elements';
4
+ export declare function setDefaultClass(clazz: (selected: boolean) => ClassValue): void;
4
5
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
5
6
  class?: ClassValue | ((selected: boolean) => ClassValue);
6
7
  id?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/Tab.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC3E,KAAK,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC;IACzD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAqDL,QAAA,MAAM,GAAG,8CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"Tab.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/Tab.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD,wBAAgB,eAAe,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,QAEvE;AAED,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC3E,KAAK,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC;IACzD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AA+CL,QAAA,MAAM,GAAG,8CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
@@ -1,9 +1,11 @@
1
+ import { setDefaultClass } from './Tab.svelte';
1
2
  declare const Tabs: import("svelte").Component<import("./Tabs.svelte").TabsProps, {
2
3
  forward: () => void;
3
4
  back: () => void;
4
5
  }, "b_index"> & {
5
6
  Tab: import("svelte").Component<import("./Tab.svelte").TabProps, {}, "">;
6
7
  Panel: import("svelte").Component<import("./TabPanel.svelte").TabPanelProps, {}, "">;
8
+ setDefaultTabClass: typeof setDefaultClass;
7
9
  };
8
10
  export default Tabs;
9
11
  export { type TabProps } from './Tab.svelte';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,IAAI;;;;;;CAGR,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,QAAA,MAAM,IAAI;;;;;;;CAIR,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -1,9 +1,10 @@
1
- import Tab from './Tab.svelte';
1
+ import Tab, { setDefaultClass } from './Tab.svelte';
2
2
  import TabPanel from './TabPanel.svelte';
3
3
  import { default as TabsComponent } from './Tabs.svelte';
4
4
  const Tabs = Object.assign(TabsComponent, {
5
5
  Tab: Tab,
6
- Panel: TabPanel
6
+ Panel: TabPanel,
7
+ setDefaultTabClass: setDefaultClass
7
8
  });
8
9
  export default Tabs;
9
10
  export {} from './Tab.svelte';
@@ -7,7 +7,7 @@
7
7
  import Popover, { type PopoverPlacement } from '../popover/Popover.svelte';
8
8
  import Portal from '../portal/Portal.svelte';
9
9
 
10
- export interface Props extends IvoryComponent<HTMLElement> {
10
+ export interface TooltipProps extends IvoryComponent<HTMLElement> {
11
11
  children?: Snippet;
12
12
  /** The content of the tooltip */
13
13
  tooltip: string | Snippet;
@@ -39,7 +39,7 @@
39
39
  tooltipClass,
40
40
  placement = 'top',
41
41
  ...rest
42
- }: Props = $props();
42
+ }: TooltipProps = $props();
43
43
 
44
44
  let target = $state<HTMLElement>();
45
45
 
@@ -2,7 +2,7 @@ import type { IvoryComponent } from '../../../types';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { ClassValue } from 'svelte/elements';
4
4
  import { type PopoverPlacement } from '../popover/Popover.svelte';
5
- export interface Props extends IvoryComponent<HTMLElement> {
5
+ export interface TooltipProps extends IvoryComponent<HTMLElement> {
6
6
  children?: Snippet;
7
7
  /** The content of the tooltip */
8
8
  tooltip: string | Snippet;
@@ -24,7 +24,7 @@ export interface Props extends IvoryComponent<HTMLElement> {
24
24
  placement?: PopoverPlacement;
25
25
  }
26
26
  /** Shows additional information when hovering over an element. */
27
- declare const Tooltip: import("svelte").Component<Props, {}, "">;
27
+ declare const Tooltip: import("svelte").Component<TooltipProps, {}, "">;
28
28
  type Tooltip = ReturnType<typeof Tooltip>;
29
29
  export default Tooltip;
30
30
  //# sourceMappingURL=Tooltip.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tooltip/Tooltip.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG3E,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,sCAAsC;IACtC,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAChC;AA+DL,kEAAkE;AAClE,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Tooltip.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tooltip/Tooltip.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG3E,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,sCAAsC;IACtC,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAChC;AA+DL,kEAAkE;AAClE,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { TransitionConfig } from 'svelte/transition';
2
3
  export interface IvoryComponent<RootElement extends EventTarget> extends HTMLAttributes<RootElement> {
3
4
  }
5
+ export interface TransitionProps {
6
+ inTransition?: (node: Element) => TransitionConfig;
7
+ outTransition?: (node: Element) => TransitionConfig;
8
+ }
4
9
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,WAAW,cAAc,CAAC,WAAW,SAAS,WAAW,CAC3D,SAAQ,cAAc,CAAC,WAAW,CAAC;CAAG"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,WAAW,cAAc,CAAC,WAAW,SAAS,WAAW,CAC3D,SAAQ,cAAc,CAAC,WAAW,CAAC;CAAG;AAE1C,MAAM,WAAW,eAAe;IAC5B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,gBAAgB,CAAC;IACnD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,gBAAgB,CAAC;CACvD"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=transitionProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transitionProps.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/functions/transitionProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ims360/svelte-ivory",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "keywords": [
5
5
  "svelte"
6
6
  ],
@@ -1,5 +1,10 @@
1
1
  <script lang="ts" module>
2
2
  import type { IvoryComponent } from '$lib/types';
3
+ import { Check, type Icon as LucideIcon, Minus } from '@lucide/svelte';
4
+ import clsx from 'clsx';
5
+ import type { ClassValue } from 'svelte/elements';
6
+ import { scale } from 'svelte/transition';
7
+ import { twMerge } from 'tailwind-merge';
3
8
 
4
9
  export interface CheckboxProps extends IvoryComponent<HTMLElement> {
5
10
  class?: ClassValue;
@@ -11,8 +16,6 @@
11
16
  /** if true, the onclick handler will not be called */
12
17
  disabled?: boolean;
13
18
  onclick?: () => void;
14
- /** data-testid */
15
- testId?: string;
16
19
  }
17
20
  </script>
18
21
 
@@ -22,11 +25,6 @@
22
25
  -->
23
26
 
24
27
  <script lang="ts">
25
- import { Check, type Icon as LucideIcon, Minus } from '@lucide/svelte';
26
- import clsx from 'clsx';
27
- import type { ClassValue } from 'svelte/elements';
28
- import { twMerge } from 'tailwind-merge';
29
-
30
28
  let {
31
29
  class: clazz,
32
30
  checked = false,
@@ -76,6 +74,8 @@
76
74
  {...rest}
77
75
  >
78
76
  {#if Icon}
79
- <Icon class="h-full w-full" size={16} strokeWidth={3} />
77
+ <div class="h-full w-full" transition:scale={{ duration: 150 }}>
78
+ <Icon class="h-full w-full" size={16} strokeWidth={3} />
79
+ </div>
80
80
  {/if}
81
81
  </svelte:element>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '$lib/types';
2
+ import type { IvoryComponent, TransitionProps } from '$lib/types';
3
3
  import { X } from '@lucide/svelte';
4
4
  import clsx from 'clsx';
5
5
  import type { Snippet } from 'svelte';
@@ -11,7 +11,7 @@
11
11
 
12
12
  export type DrawerPlacement = 'left' | 'right';
13
13
 
14
- export interface DrawerProps extends IvoryComponent<HTMLDivElement> {
14
+ export interface DrawerProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
15
15
  class?: string;
16
16
  b_open: boolean;
17
17
  title?: string;
@@ -27,6 +27,10 @@
27
27
  children,
28
28
  title,
29
29
  placement = 'right',
30
+ inTransition = (e) =>
31
+ fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
32
+ outTransition = (e) =>
33
+ fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
30
34
  ...rest
31
35
  }: DrawerProps = $props();
32
36
 
@@ -49,8 +53,9 @@
49
53
  clazz
50
54
  ])
51
55
  )}
52
- transition:fly={{ x: placement === 'right' ? '100%' : '-100%', duration: 200 }}
53
56
  onclick={(e) => e.stopPropagation()}
57
+ in:inTransition
58
+ out:outTransition
54
59
  {...rest}
55
60
  >
56
61
  <div class="flex flex-row items-center justify-between gap-8">
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '$lib/types';
2
+ import type { IvoryComponent, TransitionProps } from '$lib/types';
3
3
  import clsx from 'clsx';
4
4
  import type { ClassValue } from 'svelte/elements';
5
5
  import { fade } from 'svelte/transition';
@@ -12,12 +12,11 @@
12
12
  globalClass = value;
13
13
  }
14
14
 
15
- export const TEST_ID = 'background';
16
-
17
- export interface HiddenBackgroundProps extends IvoryComponent<HTMLDialogElement> {
15
+ export interface HiddenBackgroundProps
16
+ extends IvoryComponent<HTMLDialogElement>,
17
+ TransitionProps {
18
18
  /** Gets called when the dialog is clicked */
19
19
  onclose?: () => void;
20
- duration?: number;
21
20
  }
22
21
  </script>
23
22
 
@@ -26,7 +25,8 @@
26
25
  class: clazz,
27
26
  onclose,
28
27
  children,
29
- duration = 300,
28
+ inTransition = (e) => fade(e, { duration: 200 }),
29
+ outTransition = (e) => fade(e, { duration: 100 }),
30
30
  ...rest
31
31
  }: HiddenBackgroundProps = $props();
32
32
  </script>
@@ -34,7 +34,7 @@
34
34
  <dialog
35
35
  class={twMerge(
36
36
  clsx(
37
- 'bg-surface-950-50/40 absolute top-0 left-0 z-40 m-0 h-full w-full p-0',
37
+ 'bg-surface-950-50/40 pointer-events-auto absolute top-0 left-0 z-40 m-0 h-full w-full p-0',
38
38
  globalClass,
39
39
  clazz
40
40
  )
@@ -46,8 +46,8 @@
46
46
  callback: onclose ?? (() => {})
47
47
  }}
48
48
  onclick={onclose}
49
- transition:fade={{ duration }}
50
- data-testid={TEST_ID}
49
+ in:inTransition
50
+ out:outTransition
51
51
  {...rest}
52
52
  >
53
53
  {@render children?.()}
@@ -1,8 +1,8 @@
1
- import { default as HiddenBg, setClasses, TEST_ID } from './HiddenBackground.svelte';
1
+ import { default as HiddenBg, setClasses } from './HiddenBackground.svelte';
2
2
 
3
3
  const HiddenBackground = Object.assign(HiddenBg, {
4
- setClasses,
5
- TEST_ID
4
+ setClasses
6
5
  });
7
6
 
8
7
  export default HiddenBackground;
8
+ export { type HiddenBackgroundProps } from './HiddenBackground.svelte';
@@ -1,19 +1,18 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
2
  export { default as Heading } from './heading';
3
-
4
- export * from './hiddenBackground';
5
- export { default as HiddenBackground } from './hiddenBackground';
6
-
7
- export * from './modal/Modal.svelte';
8
- export { default as Modal } from './modal/Modal.svelte';
9
-
10
- export { default as Popover } from './popover/Popover.svelte';
11
-
12
- export * from './portal/Portal.svelte';
13
- export { default as Portal } from './portal/Portal.svelte';
14
-
15
- export * from './tabs';
16
- export { default as Tabs } from './tabs';
17
-
18
- export * from './tooltip/Tooltip.svelte';
19
- export { default as Tooltip } from './tooltip/Tooltip.svelte';
3
+ export { default as HiddenBackground, type HiddenBackgroundProps } from './hiddenBackground';
4
+ export { default as Modal, type ModalProps, type ModalVariant } from './modal/Modal.svelte';
5
+ export {
6
+ default as Popover,
7
+ type PopoverPlacement,
8
+ type PopoverProps
9
+ } from './popover/Popover.svelte';
10
+ export { default as Portal } from './portal';
11
+ export {
12
+ getTabContext,
13
+ default as Tabs,
14
+ type TabPanelProps,
15
+ type TabProps,
16
+ type TabsProps
17
+ } from './tabs';
18
+ export { default as Tooltip, type TooltipProps } from './tooltip/Tooltip.svelte';
@@ -1,14 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type { IvoryComponent } from '$lib/types';
2
+ import type { IvoryComponent, TransitionProps } from '$lib/types';
3
3
  import { X } from '@lucide/svelte';
4
4
  import clsx from 'clsx';
5
- import type { Snippet } from 'svelte';
5
+ import { type Snippet } from 'svelte';
6
6
  import type { ClassValue, MouseEventHandler } from 'svelte/elements';
7
+ import { fade } from 'svelte/transition';
7
8
  import { twMerge } from 'tailwind-merge';
8
9
  import { Heading, HiddenBackground, Portal } from '..';
9
10
 
10
11
  /** Props for the modal, expose if you overwrite the defaults in a custom component */
11
- export interface ModalProps extends IvoryComponent<HTMLDivElement> {
12
+ export interface ModalProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
12
13
  /** Class of the modal itself, does not apply to the inner div */
13
14
  class?: ClassValue;
14
15
  /** Class of the div wrapping the children */
@@ -42,6 +43,11 @@
42
43
  preventClosing = false,
43
44
  variant,
44
45
  innerClass,
46
+ inTransition = (e) =>
47
+ fade(e, {
48
+ duration: 200
49
+ }),
50
+ outTransition = () => ({}),
45
51
  ...rest
46
52
  }: Props = $props();
47
53
 
@@ -84,6 +90,8 @@
84
90
  )}
85
91
  {...rest}
86
92
  {onclick}
93
+ in:inTransition|global
94
+ out:outTransition|global
87
95
  >
88
96
  <div
89
97
  class={[
@@ -101,7 +109,7 @@
101
109
  <button
102
110
  class="group ml-auto flex justify-end"
103
111
  type="button"
104
- onclick={close}
112
+ onclick={() => close()}
105
113
  >
106
114
  <X
107
115
  class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
@@ -111,7 +119,7 @@
111
119
  <div
112
120
  class={twMerge(
113
121
  clsx(
114
- 'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
122
+ 'flex flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
115
123
  innerClass
116
124
  )
117
125
  )}
@@ -0,0 +1,7 @@
1
+ import Portal, { setConfig } from './Portal.svelte';
2
+
3
+ const portal = Object.assign(Portal, {
4
+ setConfig
5
+ });
6
+
7
+ export default portal;
@@ -8,6 +8,14 @@
8
8
  import { twMerge } from 'tailwind-merge';
9
9
  import { getTabContext } from './Tabs.svelte';
10
10
 
11
+ let defaultClass = $state(
12
+ (selected: boolean): ClassValue => [selected ? 'text-primary-500' : '']
13
+ );
14
+
15
+ export function setDefaultClass(clazz: (selected: boolean) => ClassValue) {
16
+ defaultClass = clazz;
17
+ }
18
+
11
19
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
12
20
  class?: ClassValue | ((selected: boolean) => ClassValue);
13
21
  id?: string | undefined;
@@ -24,13 +32,7 @@
24
32
  </script>
25
33
 
26
34
  <script lang="ts">
27
- let {
28
- class: clazz = (selected: boolean) => [selected && 'text-primary-500 underline'],
29
- id,
30
- href,
31
- children,
32
- active
33
- }: TabProps = $props();
35
+ let { class: clazz = defaultClass, id, href, children, active }: TabProps = $props();
34
36
 
35
37
  const tab = pseudoRandomId('tab-');
36
38
  const tabs = getTabContext();
@@ -1,13 +1,15 @@
1
- import Tab from './Tab.svelte';
1
+ import Tab, { setDefaultClass } from './Tab.svelte';
2
2
  import TabPanel from './TabPanel.svelte';
3
3
  import { default as TabsComponent } from './Tabs.svelte';
4
4
 
5
5
  const Tabs = Object.assign(TabsComponent, {
6
6
  Tab: Tab,
7
- Panel: TabPanel
7
+ Panel: TabPanel,
8
+ setDefaultTabClass: setDefaultClass
8
9
  });
9
10
 
10
11
  export default Tabs;
11
12
  export { type TabProps } from './Tab.svelte';
12
13
  export { type TabPanelProps } from './TabPanel.svelte';
13
14
  export { getTabContext, type TabContext, type TabsProps } from './Tabs.svelte';
15
+
@@ -7,7 +7,7 @@
7
7
  import Popover, { type PopoverPlacement } from '../popover/Popover.svelte';
8
8
  import Portal from '../portal/Portal.svelte';
9
9
 
10
- export interface Props extends IvoryComponent<HTMLElement> {
10
+ export interface TooltipProps extends IvoryComponent<HTMLElement> {
11
11
  children?: Snippet;
12
12
  /** The content of the tooltip */
13
13
  tooltip: string | Snippet;
@@ -39,7 +39,7 @@
39
39
  tooltipClass,
40
40
  placement = 'top',
41
41
  ...rest
42
- }: Props = $props();
42
+ }: TooltipProps = $props();
43
43
 
44
44
  let target = $state<HTMLElement>();
45
45
 
package/src/lib/types.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { TransitionConfig } from 'svelte/transition';
2
3
 
3
4
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
5
  export interface IvoryComponent<RootElement extends EventTarget>
5
6
  extends HTMLAttributes<RootElement> {}
7
+
8
+ export interface TransitionProps {
9
+ inTransition?: (node: Element) => TransitionConfig;
10
+ outTransition?: (node: Element) => TransitionConfig;
11
+ }