@ims360/svelte-ivory 0.0.33 → 0.0.34
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.
- package/dist/components/basic/checkbox/Checkbox.svelte +8 -8
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts +1 -3
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -1
- package/dist/components/layout/drawer/Drawer.svelte +8 -3
- package/dist/components/layout/drawer/Drawer.svelte.d.ts +2 -2
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte +9 -9
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts +2 -4
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts.map +1 -1
- package/dist/components/layout/hiddenBackground/index.d.ts +1 -1
- package/dist/components/layout/hiddenBackground/index.d.ts.map +1 -1
- package/dist/components/layout/hiddenBackground/index.js +3 -3
- package/dist/components/layout/index.d.ts +6 -11
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +2 -7
- package/dist/components/layout/modal/Modal.svelte +9 -4
- package/dist/components/layout/modal/Modal.svelte.d.ts +3 -3
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/layout/portal/index.d.ts +6 -0
- package/dist/components/layout/portal/index.d.ts.map +1 -0
- package/dist/components/layout/portal/index.js +5 -0
- package/dist/components/layout/tabs/Tab.svelte +9 -7
- package/dist/components/layout/tabs/Tab.svelte.d.ts +1 -0
- package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -1
- package/dist/components/layout/tabs/index.d.ts +2 -0
- package/dist/components/layout/tabs/index.d.ts.map +1 -1
- package/dist/components/layout/tabs/index.js +3 -2
- package/dist/components/layout/tooltip/Tooltip.svelte +2 -2
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts +2 -2
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/functions/transitionProps.d.ts +1 -0
- package/dist/utils/functions/transitionProps.d.ts.map +1 -0
- package/dist/utils/functions/transitionProps.js +1 -0
- package/package.json +1 -1
- package/src/lib/components/basic/checkbox/Checkbox.svelte +8 -8
- package/src/lib/components/layout/drawer/Drawer.svelte +8 -3
- package/src/lib/components/layout/hiddenBackground/HiddenBackground.svelte +9 -9
- package/src/lib/components/layout/hiddenBackground/index.ts +3 -3
- package/src/lib/components/layout/index.ts +16 -17
- package/src/lib/components/layout/modal/Modal.svelte +9 -4
- package/src/lib/components/layout/portal/index.ts +7 -0
- package/src/lib/components/layout/tabs/Tab.svelte +9 -7
- package/src/lib/components/layout/tabs/index.ts +3 -2
- package/src/lib/components/layout/tooltip/Tooltip.svelte +2 -2
- package/src/lib/types.ts +6 -0
- 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
|
-
<
|
|
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;
|
|
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;
|
|
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
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
|
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;
|
|
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,
|
|
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
|
|
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
|
|
4
|
-
export { default as
|
|
5
|
-
export
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export
|
|
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;
|
|
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
|
|
9
|
-
export { default as
|
|
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
|
|
5
|
+
import { type Snippet } from 'svelte';
|
|
6
6
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
7
|
+
import { slide } 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,8 @@
|
|
|
42
43
|
preventClosing = false,
|
|
43
44
|
variant,
|
|
44
45
|
innerClass,
|
|
46
|
+
inTransition = (e) => slide(e, { axis: 'y', duration: 200 }),
|
|
47
|
+
outTransition = () => ({}),
|
|
45
48
|
...rest
|
|
46
49
|
}: Props = $props();
|
|
47
50
|
|
|
@@ -84,6 +87,8 @@
|
|
|
84
87
|
)}
|
|
85
88
|
{...rest}
|
|
86
89
|
{onclick}
|
|
90
|
+
in:inTransition|global
|
|
91
|
+
out:outTransition|global
|
|
87
92
|
>
|
|
88
93
|
<div
|
|
89
94
|
class={[
|
|
@@ -101,7 +106,7 @@
|
|
|
101
106
|
<button
|
|
102
107
|
class="group ml-auto flex justify-end"
|
|
103
108
|
type="button"
|
|
104
|
-
onclick={close}
|
|
109
|
+
onclick={() => close()}
|
|
105
110
|
>
|
|
106
111
|
<X
|
|
107
112
|
class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { IvoryComponent } from '../../../types';
|
|
2
|
-
import type
|
|
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;
|
|
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;AAiFL,oFAAoF;AACpF,QAAA,MAAM,KAAK,iDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -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"}
|
|
@@ -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;
|
|
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":"
|
|
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
|
|
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
|
-
}:
|
|
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
|
|
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<
|
|
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,
|
|
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
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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;
|
|
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,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
|
-
<
|
|
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
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
|
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
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { default as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
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
|
|
5
|
+
import { type Snippet } from 'svelte';
|
|
6
6
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
7
|
+
import { slide } 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,8 @@
|
|
|
42
43
|
preventClosing = false,
|
|
43
44
|
variant,
|
|
44
45
|
innerClass,
|
|
46
|
+
inTransition = (e) => slide(e, { axis: 'y', duration: 200 }),
|
|
47
|
+
outTransition = () => ({}),
|
|
45
48
|
...rest
|
|
46
49
|
}: Props = $props();
|
|
47
50
|
|
|
@@ -84,6 +87,8 @@
|
|
|
84
87
|
)}
|
|
85
88
|
{...rest}
|
|
86
89
|
{onclick}
|
|
90
|
+
in:inTransition|global
|
|
91
|
+
out:outTransition|global
|
|
87
92
|
>
|
|
88
93
|
<div
|
|
89
94
|
class={[
|
|
@@ -101,7 +106,7 @@
|
|
|
101
106
|
<button
|
|
102
107
|
class="group ml-auto flex justify-end"
|
|
103
108
|
type="button"
|
|
104
|
-
onclick={close}
|
|
109
|
+
onclick={() => close()}
|
|
105
110
|
>
|
|
106
111
|
<X
|
|
107
112
|
class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
|
|
@@ -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,10 +1,11 @@
|
|
|
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;
|
|
@@ -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
|
|
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
|
-
}:
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|