@kayord/ui 0.20.1 → 1.0.1
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/custom/avatar-group/avatar-group-etc.svelte +17 -0
- package/dist/components/custom/avatar-group/avatar-group-etc.svelte.d.ts +4 -0
- package/dist/components/custom/avatar-group/avatar-group-member.svelte +9 -0
- package/dist/components/custom/avatar-group/avatar-group-member.svelte.d.ts +4 -0
- package/dist/components/custom/avatar-group/avatar-group.svelte +24 -0
- package/dist/components/custom/avatar-group/avatar-group.svelte.d.ts +4 -0
- package/dist/components/custom/avatar-group/index.d.ts +6 -0
- package/dist/components/custom/avatar-group/index.js +5 -0
- package/dist/components/custom/avatar-group/types.d.ts +13 -0
- package/dist/components/custom/avatar-group/types.js +1 -0
- package/dist/components/custom/index.d.ts +1 -0
- package/dist/components/custom/index.js +1 -0
- package/dist/components/ui/accordion/accordion-content.svelte +2 -5
- package/dist/components/ui/accordion/accordion.svelte +7 -0
- package/dist/components/ui/accordion/accordion.svelte.d.ts +4 -0
- package/dist/components/ui/accordion/index.d.ts +1 -1
- package/dist/components/ui/accordion/index.js +1 -1
- package/dist/components/ui/calendar/calendar-caption.svelte +76 -0
- package/dist/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
- package/dist/components/ui/calendar/calendar-cell.svelte +1 -1
- package/dist/components/ui/calendar/calendar-day.svelte +13 -8
- package/dist/components/ui/calendar/calendar-grid.svelte +5 -1
- package/dist/components/ui/calendar/calendar-head-cell.svelte +1 -1
- package/dist/components/ui/calendar/calendar-header.svelte +1 -1
- package/dist/components/ui/calendar/calendar-heading.svelte +1 -1
- package/dist/components/ui/calendar/calendar-month-select.svelte +42 -0
- package/dist/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-month.svelte +15 -0
- package/dist/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
- package/dist/components/ui/calendar/calendar-months.svelte +1 -5
- package/dist/components/ui/calendar/calendar-nav.svelte +19 -0
- package/dist/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
- package/dist/components/ui/calendar/calendar-next-button.svelte +12 -4
- package/dist/components/ui/calendar/calendar-next-button.svelte.d.ts +5 -1
- package/dist/components/ui/calendar/calendar-prev-button.svelte +12 -4
- package/dist/components/ui/calendar/calendar-prev-button.svelte.d.ts +5 -1
- package/dist/components/ui/calendar/calendar-year-select.svelte +41 -0
- package/dist/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar.svelte +82 -28
- package/dist/components/ui/calendar/calendar.svelte.d.ts +16 -1
- package/dist/components/ui/calendar/index.d.ts +6 -1
- package/dist/components/ui/calendar/index.js +6 -1
- package/dist/components/ui/carousel/carousel-next.svelte +1 -1
- package/dist/components/ui/carousel/carousel-previous.svelte +1 -1
- package/dist/components/ui/carousel/carousel.svelte +10 -17
- package/dist/components/ui/carousel/context.d.ts +1 -2
- package/dist/components/ui/chart/chart-container.svelte +1 -4
- package/dist/components/ui/collapsible/collapsible.svelte +1 -1
- package/dist/components/ui/collapsible/index.d.ts +3 -15
- package/dist/components/ui/collapsible/index.js +3 -4
- package/dist/components/ui/dialog/dialog-content.svelte +10 -6
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -0
- package/dist/components/ui/drawer/drawer-content.svelte +1 -1
- package/dist/components/ui/drawer/drawer-footer.svelte +1 -1
- package/dist/components/ui/drawer/drawer-header.svelte +1 -1
- package/dist/components/ui/input/input.svelte +1 -1
- package/dist/components/ui/pagination/pagination-link.svelte +1 -1
- package/dist/components/ui/radio-group/radio-group-item.svelte +1 -1
- package/dist/components/ui/range-calendar/index.d.ts +6 -1
- package/dist/components/ui/range-calendar/index.js +6 -1
- package/dist/components/ui/range-calendar/range-calendar-caption.svelte +76 -0
- package/dist/components/ui/range-calendar/range-calendar-caption.svelte.d.ts +19 -0
- package/dist/components/ui/range-calendar/range-calendar-cell.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-day.svelte +16 -9
- package/dist/components/ui/range-calendar/range-calendar-grid.svelte +5 -1
- package/dist/components/ui/range-calendar/range-calendar-head-cell.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-header.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-heading.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-month-select.svelte +42 -0
- package/dist/components/ui/range-calendar/range-calendar-month-select.svelte.d.ts +4 -0
- package/dist/components/ui/range-calendar/range-calendar-month.svelte +15 -0
- package/dist/components/ui/range-calendar/range-calendar-month.svelte.d.ts +5 -0
- package/dist/components/ui/range-calendar/range-calendar-months.svelte +2 -6
- package/dist/components/ui/range-calendar/range-calendar-months.svelte.d.ts +1 -1
- package/dist/components/ui/range-calendar/range-calendar-nav.svelte +19 -0
- package/dist/components/ui/range-calendar/range-calendar-nav.svelte.d.ts +5 -0
- package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +7 -4
- package/dist/components/ui/range-calendar/range-calendar-next-button.svelte.d.ts +5 -1
- package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +7 -4
- package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +5 -1
- package/dist/components/ui/range-calendar/range-calendar-year-select.svelte +41 -0
- package/dist/components/ui/range-calendar/range-calendar-year-select.svelte.d.ts +4 -0
- package/dist/components/ui/range-calendar/range-calendar.svelte +83 -28
- package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +17 -1
- package/dist/components/ui/select/index.d.ts +2 -1
- package/dist/components/ui/select/index.js +3 -2
- package/dist/components/ui/select/select-group-heading.svelte +15 -2
- package/dist/components/ui/select/select-group-heading.svelte.d.ts +8 -2
- package/dist/components/ui/select/select-trigger.svelte +1 -1
- package/dist/components/ui/separator/separator.svelte +1 -1
- package/dist/hooks/is-mobile.svelte.d.ts +1 -1
- package/dist/hooks/is-mobile.svelte.js +3 -3
- package/package.json +11 -11
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from "../../../utils";
|
|
3
|
+
import type { AvatarGroupEtcProps } from "./types";
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(null), plus, class: className, ...rest }: AvatarGroupEtcProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div
|
|
9
|
+
{...rest}
|
|
10
|
+
bind:this={ref}
|
|
11
|
+
class={cn(
|
|
12
|
+
"bg-accent ring-background relative flex size-8 items-center justify-center rounded-full text-xs ring-2",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
>
|
|
16
|
+
<span>+{plus}</span>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Avatar } from "../../..";
|
|
3
|
+
import { Avatar as AvatarPrimitive } from "bits-ui";
|
|
4
|
+
import { cn } from "../../../utils";
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.RootProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Avatar.Root bind:ref class={cn("bg-accent ring-background ring-2", className)} {...restProps} />
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from "../../../utils";
|
|
3
|
+
import type { AvatarGroupRootProps } from "./types";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...rest
|
|
11
|
+
}: AvatarGroupRootProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
data-orientation={orientation}
|
|
17
|
+
class={cn(
|
|
18
|
+
'group/avatar-group flex items-center data-[orientation="horizontal"]:flex-row data-[orientation="horizontal"]:-space-x-2 data-[orientation="vertical"]:flex-col data-[orientation="vertical"]:-space-y-2',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...rest}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Root from "./avatar-group.svelte";
|
|
2
|
+
import Member from "./avatar-group-member.svelte";
|
|
3
|
+
import Etc from "./avatar-group-etc.svelte";
|
|
4
|
+
import { Fallback, Image } from "../../ui/avatar";
|
|
5
|
+
export { Root, Member, Etc, Image as MemberImage, Fallback as MemberFallback };
|
|
6
|
+
export type * from "./types";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from "./avatar-group.svelte";
|
|
2
|
+
import Member from "./avatar-group-member.svelte";
|
|
3
|
+
import Etc from "./avatar-group-etc.svelte";
|
|
4
|
+
import { Fallback, Image } from "../../ui/avatar";
|
|
5
|
+
export { Root, Member, Etc, Image as MemberImage, Fallback as MemberFallback };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Avatar as AvatarPrimitive, WithChildren, WithoutChildren } from "bits-ui";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
export type AvatarGroupRootPropsWithoutHTML = WithChildren<{
|
|
4
|
+
ref?: HTMLElement | null;
|
|
5
|
+
orientation?: "vertical" | "horizontal";
|
|
6
|
+
}>;
|
|
7
|
+
export type AvatarGroupRootProps = AvatarGroupRootPropsWithoutHTML & WithoutChildren<HTMLAttributes<HTMLDivElement>>;
|
|
8
|
+
export type AvatarGroupMemberProps = AvatarPrimitive.RootProps;
|
|
9
|
+
export type AvatarGroupEtcPropsWithoutHTML = WithChildren<{
|
|
10
|
+
ref?: HTMLElement | null;
|
|
11
|
+
plus: number;
|
|
12
|
+
}>;
|
|
13
|
+
export type AvatarGroupEtcProps = AvatarGroupEtcPropsWithoutHTML & WithoutChildren<HTMLAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,3 +8,4 @@ export * as TreeView from "./tree-view/index.js";
|
|
|
8
8
|
export { ThemeSelector } from "./theme-selector/index.js";
|
|
9
9
|
export { LightSwitch } from "./light-switch.svelte/index.js";
|
|
10
10
|
export * from "./animations/index.js";
|
|
11
|
+
export * as AvatarGroup from "./avatar-group/index.js";
|
|
@@ -8,3 +8,4 @@ export * as TreeView from "./tree-view/index.js";
|
|
|
8
8
|
export { ThemeSelector } from "./theme-selector/index.js";
|
|
9
9
|
export { LightSwitch } from "./light-switch.svelte/index.js";
|
|
10
10
|
export * from "./animations/index.js";
|
|
11
|
+
export * as AvatarGroup from "./avatar-group/index.js";
|
|
@@ -13,13 +13,10 @@
|
|
|
13
13
|
<AccordionPrimitive.Content
|
|
14
14
|
bind:ref
|
|
15
15
|
data-slot="accordion-content"
|
|
16
|
-
class=
|
|
17
|
-
"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
16
|
+
class="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
20
17
|
{...restProps}
|
|
21
18
|
>
|
|
22
|
-
<div class="pt-0 pb-4">
|
|
19
|
+
<div class={cn("pt-0 pb-4", className)}>
|
|
23
20
|
{@render children?.()}
|
|
24
21
|
</div>
|
|
25
22
|
</AccordionPrimitive.Content>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
3
|
+
|
|
4
|
+
let { ref = $bindable(null), value = $bindable(), ...restProps }: AccordionPrimitive.RootProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<AccordionPrimitive.Root bind:ref bind:value={value as never} data-slot="accordion" {...restProps} />
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from "svelte";
|
|
3
|
+
import type Calendar from "./calendar.svelte";
|
|
4
|
+
import CalendarMonthSelect from "./calendar-month-select.svelte";
|
|
5
|
+
import CalendarYearSelect from "./calendar-year-select.svelte";
|
|
6
|
+
import { DateFormatter, getLocalTimeZone, type DateValue } from "@internationalized/date";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
captionLayout,
|
|
10
|
+
months,
|
|
11
|
+
monthFormat,
|
|
12
|
+
years,
|
|
13
|
+
yearFormat,
|
|
14
|
+
month,
|
|
15
|
+
locale,
|
|
16
|
+
placeholder = $bindable(),
|
|
17
|
+
monthIndex = 0,
|
|
18
|
+
}: {
|
|
19
|
+
captionLayout: ComponentProps<typeof Calendar>["captionLayout"];
|
|
20
|
+
months: ComponentProps<typeof CalendarMonthSelect>["months"];
|
|
21
|
+
monthFormat: ComponentProps<typeof CalendarMonthSelect>["monthFormat"];
|
|
22
|
+
years: ComponentProps<typeof CalendarYearSelect>["years"];
|
|
23
|
+
yearFormat: ComponentProps<typeof CalendarYearSelect>["yearFormat"];
|
|
24
|
+
month: DateValue;
|
|
25
|
+
placeholder: DateValue | undefined;
|
|
26
|
+
locale: string;
|
|
27
|
+
monthIndex: number;
|
|
28
|
+
} = $props();
|
|
29
|
+
|
|
30
|
+
function formatYear(date: DateValue) {
|
|
31
|
+
const dateObj = date.toDate(getLocalTimeZone());
|
|
32
|
+
if (typeof yearFormat === "function") return yearFormat(dateObj.getFullYear());
|
|
33
|
+
return new DateFormatter(locale, { year: yearFormat }).format(dateObj);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function formatMonth(date: DateValue) {
|
|
37
|
+
const dateObj = date.toDate(getLocalTimeZone());
|
|
38
|
+
if (typeof monthFormat === "function") return monthFormat(dateObj.getMonth() + 1);
|
|
39
|
+
return new DateFormatter(locale, { month: monthFormat }).format(dateObj);
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{#snippet MonthSelect()}
|
|
44
|
+
<CalendarMonthSelect
|
|
45
|
+
{months}
|
|
46
|
+
{monthFormat}
|
|
47
|
+
value={month.month}
|
|
48
|
+
onchange={(e) => {
|
|
49
|
+
if (!placeholder) return;
|
|
50
|
+
const v = Number.parseInt(e.currentTarget.value);
|
|
51
|
+
const newPlaceholder = placeholder.set({ month: v });
|
|
52
|
+
placeholder = newPlaceholder.subtract({ months: monthIndex });
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
{/snippet}
|
|
56
|
+
|
|
57
|
+
{#snippet YearSelect()}
|
|
58
|
+
<CalendarYearSelect {years} {yearFormat} value={month.year} />
|
|
59
|
+
{/snippet}
|
|
60
|
+
|
|
61
|
+
{#if captionLayout === "dropdown"}
|
|
62
|
+
{@render MonthSelect()}
|
|
63
|
+
{@render YearSelect()}
|
|
64
|
+
{:else if captionLayout === "dropdown-months"}
|
|
65
|
+
{@render MonthSelect()}
|
|
66
|
+
{#if placeholder}
|
|
67
|
+
{formatYear(placeholder)}
|
|
68
|
+
{/if}
|
|
69
|
+
{:else if captionLayout === "dropdown-years"}
|
|
70
|
+
{#if placeholder}
|
|
71
|
+
{formatMonth(placeholder)}
|
|
72
|
+
{/if}
|
|
73
|
+
{@render YearSelect()}
|
|
74
|
+
{:else}
|
|
75
|
+
{formatMonth(month)} {formatYear(month)}
|
|
76
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps } from "svelte";
|
|
2
|
+
import type Calendar from "./calendar.svelte";
|
|
3
|
+
import CalendarMonthSelect from "./calendar-month-select.svelte";
|
|
4
|
+
import CalendarYearSelect from "./calendar-year-select.svelte";
|
|
5
|
+
import { type DateValue } from "@internationalized/date";
|
|
6
|
+
type $$ComponentProps = {
|
|
7
|
+
captionLayout: ComponentProps<typeof Calendar>["captionLayout"];
|
|
8
|
+
months: ComponentProps<typeof CalendarMonthSelect>["months"];
|
|
9
|
+
monthFormat: ComponentProps<typeof CalendarMonthSelect>["monthFormat"];
|
|
10
|
+
years: ComponentProps<typeof CalendarYearSelect>["years"];
|
|
11
|
+
yearFormat: ComponentProps<typeof CalendarYearSelect>["yearFormat"];
|
|
12
|
+
month: DateValue;
|
|
13
|
+
placeholder: DateValue | undefined;
|
|
14
|
+
locale: string;
|
|
15
|
+
monthIndex: number;
|
|
16
|
+
};
|
|
17
|
+
declare const CalendarCaption: import("svelte").Component<$$ComponentProps, {}, "placeholder">;
|
|
18
|
+
type CalendarCaption = ReturnType<typeof CalendarCaption>;
|
|
19
|
+
export default CalendarCaption;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<CalendarPrimitive.Cell
|
|
9
9
|
bind:ref
|
|
10
10
|
class={cn(
|
|
11
|
-
"
|
|
11
|
+
"relative size-(--cell-size) p-0 text-center text-sm focus-within:z-20 [&:first-child[data-selected]_[data-bits-day]]:rounded-l-md [&:last-child[data-selected]_[data-bits-day]]:rounded-r-md",
|
|
12
12
|
className
|
|
13
13
|
)}
|
|
14
14
|
{...restProps}
|
|
@@ -10,16 +10,21 @@
|
|
|
10
10
|
bind:ref
|
|
11
11
|
class={cn(
|
|
12
12
|
buttonVariants({ variant: "ghost" }),
|
|
13
|
-
"size-
|
|
14
|
-
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground",
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"flex size-(--cell-size) flex-col items-center justify-center gap-1 p-0 leading-none font-normal whitespace-nowrap select-none",
|
|
14
|
+
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground",
|
|
15
|
+
"data-[selected]:bg-primary dark:data-[selected]:hover:bg-accent/50 data-[selected]:text-primary-foreground",
|
|
16
|
+
// Outside months
|
|
17
|
+
"[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground",
|
|
17
18
|
// Disabled
|
|
18
|
-
"data-disabled:text-muted-foreground data-disabled:opacity-50",
|
|
19
|
+
"data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
19
20
|
// Unavailable
|
|
20
|
-
"data-unavailable:text-
|
|
21
|
-
//
|
|
22
|
-
"
|
|
21
|
+
"data-[unavailable]:text-muted-foreground data-[unavailable]:line-through",
|
|
22
|
+
// hover
|
|
23
|
+
"dark:hover:text-accent-foreground",
|
|
24
|
+
// focus
|
|
25
|
+
"focus:border-ring focus:ring-ring/50 focus:relative",
|
|
26
|
+
// inner spans
|
|
27
|
+
"[&>span]:text-xs [&>span]:opacity-70",
|
|
23
28
|
className
|
|
24
29
|
)}
|
|
25
30
|
{...restProps}
|
|
@@ -5,4 +5,8 @@
|
|
|
5
5
|
let { ref = $bindable(null), class: className, ...restProps }: CalendarPrimitive.GridProps = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<CalendarPrimitive.Grid
|
|
8
|
+
<CalendarPrimitive.Grid
|
|
9
|
+
bind:ref
|
|
10
|
+
class={cn("mt-4 flex w-full border-collapse flex-col gap-1", className)}
|
|
11
|
+
{...restProps}
|
|
12
|
+
/>
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
let { ref = $bindable(null), class: className, ...restProps }: CalendarPrimitive.HeadingProps = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<CalendarPrimitive.Heading bind:ref class={cn("text-sm font-medium", className)} {...restProps} />
|
|
8
|
+
<CalendarPrimitive.Heading bind:ref class={cn("px-(--cell-size) text-sm font-medium", className)} {...restProps} />
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from "../../../utils.js";
|
|
4
|
+
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
onchange,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChildrenOrChild<CalendarPrimitive.MonthSelectProps> = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<span
|
|
16
|
+
class={cn(
|
|
17
|
+
"has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
<CalendarPrimitive.MonthSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
|
|
22
|
+
{#snippet child({ props, monthItems, selectedMonthItem })}
|
|
23
|
+
<select {...props} {value} {onchange}>
|
|
24
|
+
{#each monthItems as monthItem (monthItem.value)}
|
|
25
|
+
<option
|
|
26
|
+
value={monthItem.value}
|
|
27
|
+
selected={value !== undefined ? monthItem.value === value : monthItem.value === selectedMonthItem.value}
|
|
28
|
+
>
|
|
29
|
+
{monthItem.label}
|
|
30
|
+
</option>
|
|
31
|
+
{/each}
|
|
32
|
+
</select>
|
|
33
|
+
<span
|
|
34
|
+
class="[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
>
|
|
37
|
+
{monthItems.find((item) => item.value === value)?.label || selectedMonthItem.label}
|
|
38
|
+
<ChevronDownIcon class="size-4" />
|
|
39
|
+
</span>
|
|
40
|
+
{/snippet}
|
|
41
|
+
</CalendarPrimitive.MonthSelect>
|
|
42
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const CalendarMonthSelect: import("svelte").Component<Omit<Omit<CalendarPrimitive.MonthSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type CalendarMonthSelect = ReturnType<typeof CalendarMonthSelect>;
|
|
4
|
+
export default CalendarMonthSelect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type WithElementRef, cn } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div {...restProps} bind:this={ref} class={cn("flex flex-col", className)}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const CalendarMonth: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type CalendarMonth = ReturnType<typeof CalendarMonth>;
|
|
5
|
+
export default CalendarMonth;
|
|
@@ -10,10 +10,6 @@
|
|
|
10
10
|
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<div
|
|
14
|
-
bind:this={ref}
|
|
15
|
-
class={cn("mt-4 flex flex-col space-y-4 sm:flex-row sm:space-y-0 sm:space-x-4", className)}
|
|
16
|
-
{...restProps}
|
|
17
|
-
>
|
|
13
|
+
<div bind:this={ref} class={cn("relative flex flex-col gap-4 md:flex-row", className)} {...restProps}>
|
|
18
14
|
{@render children?.()}
|
|
19
15
|
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<nav
|
|
14
|
+
{...restProps}
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
class={cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", className)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</nav>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const CalendarNav: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type CalendarNav = ReturnType<typeof CalendarNav>;
|
|
5
|
+
export default CalendarNav;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
3
3
|
import ChevronRightIcon from "@lucide/svelte/icons/chevron-right";
|
|
4
|
-
import { buttonVariants } from "../button/index.js";
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from "../button/index.js";
|
|
5
5
|
import { cn } from "../../../utils.js";
|
|
6
6
|
|
|
7
|
-
let {
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = "ghost",
|
|
12
|
+
...restProps
|
|
13
|
+
}: CalendarPrimitive.NextButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
8
16
|
</script>
|
|
9
17
|
|
|
10
18
|
{#snippet Fallback()}
|
|
@@ -14,8 +22,8 @@
|
|
|
14
22
|
<CalendarPrimitive.NextButton
|
|
15
23
|
bind:ref
|
|
16
24
|
class={cn(
|
|
17
|
-
buttonVariants({ variant
|
|
18
|
-
"size-
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180",
|
|
19
27
|
className
|
|
20
28
|
)}
|
|
21
29
|
children={children || Fallback}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
2
|
-
|
|
2
|
+
import { type ButtonVariant } from "../button/index.js";
|
|
3
|
+
type $$ComponentProps = CalendarPrimitive.NextButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const CalendarNextButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
3
7
|
type CalendarNextButton = ReturnType<typeof CalendarNextButton>;
|
|
4
8
|
export default CalendarNextButton;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
3
3
|
import ChevronLeftIcon from "@lucide/svelte/icons/chevron-left";
|
|
4
|
-
import { buttonVariants } from "../button/index.js";
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from "../button/index.js";
|
|
5
5
|
import { cn } from "../../../utils.js";
|
|
6
6
|
|
|
7
|
-
let {
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = "ghost",
|
|
12
|
+
...restProps
|
|
13
|
+
}: CalendarPrimitive.PrevButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
8
16
|
</script>
|
|
9
17
|
|
|
10
18
|
{#snippet Fallback()}
|
|
@@ -14,8 +22,8 @@
|
|
|
14
22
|
<CalendarPrimitive.PrevButton
|
|
15
23
|
bind:ref
|
|
16
24
|
class={cn(
|
|
17
|
-
buttonVariants({ variant
|
|
18
|
-
"size-
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180",
|
|
19
27
|
className
|
|
20
28
|
)}
|
|
21
29
|
children={children || Fallback}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
2
|
-
|
|
2
|
+
import { type ButtonVariant } from "../button/index.js";
|
|
3
|
+
type $$ComponentProps = CalendarPrimitive.PrevButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const CalendarPrevButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
3
7
|
type CalendarPrevButton = ReturnType<typeof CalendarPrevButton>;
|
|
4
8
|
export default CalendarPrevButton;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from "../../../utils.js";
|
|
4
|
+
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildrenOrChild<CalendarPrimitive.YearSelectProps> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
class={cn(
|
|
16
|
+
"has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<CalendarPrimitive.YearSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
|
|
21
|
+
{#snippet child({ props, yearItems, selectedYearItem })}
|
|
22
|
+
<select {...props} {value}>
|
|
23
|
+
{#each yearItems as yearItem (yearItem.value)}
|
|
24
|
+
<option
|
|
25
|
+
value={yearItem.value}
|
|
26
|
+
selected={value !== undefined ? yearItem.value === value : yearItem.value === selectedYearItem.value}
|
|
27
|
+
>
|
|
28
|
+
{yearItem.label}
|
|
29
|
+
</option>
|
|
30
|
+
{/each}
|
|
31
|
+
</select>
|
|
32
|
+
<span
|
|
33
|
+
class="[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
>
|
|
36
|
+
{yearItems.find((item) => item.value === value)?.label || selectedYearItem.label}
|
|
37
|
+
<ChevronDownIcon class="size-4" />
|
|
38
|
+
</span>
|
|
39
|
+
{/snippet}
|
|
40
|
+
</CalendarPrimitive.YearSelect>
|
|
41
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const CalendarYearSelect: import("svelte").Component<Omit<Omit<CalendarPrimitive.YearSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type CalendarYearSelect = ReturnType<typeof CalendarYearSelect>;
|
|
4
|
+
export default CalendarYearSelect;
|