-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Calendar and Collapsible components, adjust typing of component
- Loading branch information
Showing
34 changed files
with
1,067 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@jeanne-mas/svelte-ui': minor | ||
--- | ||
|
||
Added Calendar and Collapsible components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ export { | |
type Events, | ||
type Props, | ||
type Size, | ||
type Slots, | ||
type Variant, | ||
} from './Button.svelte'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['td']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.CellProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.Cell>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = Record<never, never>; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let date: Props['date']; | ||
export let el: Props['el'] = undefined; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.Cell | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn( | ||
'relative h-9 w-9 p-0 text-center text-sm', | ||
'focus-within:relative focus-within:z-20', | ||
'[&:has([data-selected])]:bg-accent', | ||
'first:[&:has([data-selected])]:rounded-l-md', | ||
'last:[&:has([data-selected])]:rounded-r-md', | ||
'[&:has([data-selected][data-outside-month])]:bg-accent/50', | ||
attributes.class, | ||
)}" | ||
date="{date}" | ||
el="{el}" | ||
let:attrs | ||
> | ||
<slot attrs="{attrs}" /> | ||
</CalendarPrimitive.Cell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { variants } from '$lib/components/button/index.js'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['div']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.DayProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.Day>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = CalendarPrimitive.DayEvents; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let date: Props['date']; | ||
export let el: Props['el'] = undefined; | ||
export let month: Props['month']; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.Day | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn( | ||
variants({ variant: 'ghost' }), | ||
|
||
'h-9 w-9 p-0 font-normal ', | ||
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground', | ||
// Selected | ||
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:opacity-100 data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground', | ||
// Disabled | ||
'data-[disabled]:text-muted-foreground data-[disabled]:opacity-50', | ||
// Unavailable | ||
'data-[unavailable]:text-destructive-foreground data-[unavailable]:line-through', | ||
// Outside months | ||
'data-[outside-month]:pointer-events-none data-[outside-month]:text-muted-foreground data-[outside-month]:opacity-50 [&[data-outside-month][data-selected]]:bg-accent/50 [&[data-outside-month][data-selected]]:text-muted-foreground [&[data-outside-month][data-selected]]:opacity-30', | ||
|
||
attributes.class, | ||
)}" | ||
date="{date}" | ||
el="{el}" | ||
month="{month}" | ||
let:builder | ||
let:disabled | ||
let:selected | ||
let:unavailable | ||
on:click | ||
> | ||
<slot builder="{builder}" disabled="{disabled}" selected="{selected}" unavailable="{unavailable}"> | ||
{date.day} | ||
</slot> | ||
</CalendarPrimitive.Day> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['table']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.GridProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.Grid>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = Record<never, never>; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let el: Props['el'] = undefined; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.Grid | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn('w-full border-collapse space-y-1', attributes.class)}" | ||
el="{el}" | ||
let:builder | ||
> | ||
<slot builder="{builder}" /> | ||
</CalendarPrimitive.Grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['tbody']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.GridBodyProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.GridBody>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = Record<never, never>; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let el: Props['el'] = undefined; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.GridBody | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn(attributes.class)}" | ||
el="{el}" | ||
let:attrs | ||
> | ||
<slot attrs="{attrs}" /> | ||
</CalendarPrimitive.GridBody> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['thead']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.GridHeadProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.GridHead>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = Record<never, never>; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let el: Props['el'] = undefined; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.GridHead | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn(attributes.class)}" | ||
el="{el}" | ||
let:attrs | ||
> | ||
<slot attrs="{attrs}" /> | ||
</CalendarPrimitive.GridHead> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script context="module" lang="ts"> | ||
import { Calendar as CalendarPrimitive } from 'bits-ui'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
import { cn } from '$lib/utils/cn.js'; | ||
import type { ComponentSlots } from '$lib/utils/types.js'; | ||
export type Attributes = SvelteHTMLElements['tr']; | ||
export type Events = Record<never, never>; | ||
export type Props = Omit<CalendarPrimitive.GridRowProps, keyof Attributes>; | ||
export type Slots = ComponentSlots<CalendarPrimitive.GridRow>; | ||
</script> | ||
|
||
<script lang="ts"> | ||
type $$Events = Record<never, never>; | ||
type $$Props = Attributes & Events & Props; | ||
type $$Slots = Slots; | ||
export let asChild: Props['asChild'] = undefined; | ||
export let el: Props['el'] = undefined; | ||
$: attributes = $$restProps as Attributes; | ||
</script> | ||
|
||
<!-- <style lang="postcss"> | ||
</style> --> | ||
|
||
<CalendarPrimitive.GridRow | ||
{...attributes} | ||
asChild="{asChild}" | ||
class="{cn('flex', attributes.class)}" | ||
el="{el}" | ||
let:attrs | ||
> | ||
<slot attrs="{attrs}" /> | ||
</CalendarPrimitive.GridRow> |
Oops, something went wrong.