Skip to content

Commit

Permalink
Add sonner component and improve components typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jeannemas committed May 4, 2024
1 parent 887c221 commit be79515
Show file tree
Hide file tree
Showing 99 changed files with 798 additions and 210 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-bikes-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jeanne-mas/svelte-ui': patch
---

Added sonner component + improved components typing
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"clsx": "^2.1.0",
"formsnap": "^1.0.0",
"lucide-svelte": "^0.368.0",
"mode-watcher": "^0.3.0",
"svelte-sonner": "^0.3.22",
"sveltekit-superforms": "^2.12.5",
"tailwind-merge": "^2.2.2",
"tailwind-variants": "^0.2.1",
Expand Down Expand Up @@ -104,6 +106,10 @@
"types": "./dist/components/separator/index.d.ts",
"svelte": "./dist/components/separator/index.js"
},
"./components/sonner": {
"types": "./dist/components/sonner/index.d.ts",
"svelte": "./dist/components/sonner/index.js"
},
"./components/switch": {
"types": "./dist/components/switch/index.d.ts",
"svelte": "./dist/components/switch/index.js"
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogAction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { tv, type VariantProps } from 'tailwind-variants';
import { styles as buttonStyles } from '$lib/components/button/index.js';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the action.
Expand Down Expand Up @@ -65,7 +65,7 @@
</script>

<script lang="ts">
type $$Events = AlertDialogPrimitive.ActionEvents;
type $$Events = Events<AlertDialogPrimitive.ActionEvents>;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogCancel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { tv, type VariantProps } from 'tailwind-variants';
import { styles as buttonStyles } from '$lib/components/button/index.js';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the cancel.
Expand Down Expand Up @@ -69,7 +69,7 @@
</script>

<script lang="ts">
type $$Events = AlertDialogPrimitive.CancelEvents;
type $$Events = Events<AlertDialogPrimitive.CancelEvents>;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
7 changes: 3 additions & 4 deletions src/lib/components/alert-dialog/AlertDialogContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { tv } from 'tailwind-variants';
import { flyAndScale } from '$lib/transition/flyAndScale.js';
import type { ComponentSlots, Transition } from '$lib/utils/types.js';
import type { ComponentSlots, Events, Transition } from '$lib/utils/types.js';
import * as AlertDialog from './index.js';
Expand Down Expand Up @@ -50,11 +50,10 @@
"
lang="ts"
>
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & TypedProps;
type $$Slots = TypedSlots;
type $$Slots = Slots<TTransition, TTransitionIn, TTransitionOut>;
type TypedProps = Props<TTransition, TTransitionIn, TTransitionOut>;
type TypedSlots = Slots<TTransition, TTransitionIn, TTransitionOut>;
export let asChild: Props['asChild'] = undefined;
export let el: Props['el'] = undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogDescription.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the description.
Expand All @@ -27,7 +27,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv, type VariantProps } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the footer.
Expand Down Expand Up @@ -60,7 +60,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv, type VariantProps } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the header.
Expand Down Expand Up @@ -60,7 +60,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
7 changes: 3 additions & 4 deletions src/lib/components/alert-dialog/AlertDialogOverlay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { fade } from 'svelte/transition';
import { tv } from 'tailwind-variants';
import type { ComponentSlots, Transition } from '$lib/utils/types.js';
import type { ComponentSlots, Events, Transition } from '$lib/utils/types.js';
/**
* The attributes of the overlay.
Expand Down Expand Up @@ -46,11 +46,10 @@
"
lang="ts"
>
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & TypedProps;
type $$Slots = TypedSlots;
type $$Slots = Slots<TTransition, TTransitionIn, TTransitionOut>;
type TypedProps = Props<TTransition, TTransitionIn, TTransitionOut>;
type TypedSlots = Slots<TTransition, TTransitionIn, TTransitionOut>;
export let asChild: Props['asChild'] = undefined;
export let el: Props['el'] = undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogPortal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the portal.
Expand All @@ -27,7 +27,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogRoot.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script context="module" lang="ts">
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the root.
Expand All @@ -18,7 +18,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogTitle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { ComponentSlots, HeadingLevel } from '$lib/utils/types.js';
import type { ComponentSlots, Events, HeadingLevel } from '$lib/utils/types.js';
/**
* The attributes of the title.
Expand All @@ -28,7 +28,7 @@
</script>

<script generics="THeadingLevel extends HeadingLevel = 'h3'" lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = TypedAttributes & Props;
type $$Slots = Slots;
type TypedAttributes = Attributes<THeadingLevel>;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert-dialog/AlertDialogTrigger.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { ComponentSlots } from '$lib/utils/types.js';
import type { ComponentSlots, Events } from '$lib/utils/types.js';
/**
* The attributes of the trigger.
Expand All @@ -27,7 +27,7 @@
</script>

<script lang="ts">
type $$Events = AlertDialogPrimitive.TriggerEvents;
type $$Events = Events<AlertDialogPrimitive.TriggerEvents>;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert/AlertDescription.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the description.
Expand All @@ -28,7 +28,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert/AlertRoot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv, type VariantProps } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the root.
Expand Down Expand Up @@ -65,7 +65,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/alert/AlertTitle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { HeadingLevel, Slot } from '$lib/utils/types.js';
import type { Events, HeadingLevel, Slot } from '$lib/utils/types.js';
/**
* The attributes of the title.
Expand Down Expand Up @@ -34,7 +34,7 @@
</script>

<script generics="THeadingLevel extends HeadingLevel = 'h5'" lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = TypedAttributes & TypedProps;
type $$Slots = Slots;
type TypedAttributes = Attributes<THeadingLevel>;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/breadcrumb/BreadcrumbEllipsis.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the ellipsis.
Expand Down Expand Up @@ -37,7 +37,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/breadcrumb/BreadcrumbItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { SvelteHTMLElements } from 'svelte/elements';
import { tv } from 'tailwind-variants';
import type { Slot } from '$lib/utils/types.js';
import type { Events, Slot } from '$lib/utils/types.js';
/**
* The attributes of the item.
Expand Down Expand Up @@ -36,7 +36,7 @@
</script>

<script lang="ts">
type $$Events = Record<never, never>;
type $$Events = Events;
type $$Props = Attributes & Props;
type $$Slots = Slots;
Expand Down
Loading

0 comments on commit be79515

Please sign in to comment.