@casinogate/ui 2.0.2 → 2.0.4
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/assets/css/root.css +330 -0
- package/dist/atomic/icons/calendar.svelte +13 -0
- package/dist/atomic/icons/calendar.svelte.d.ts +3 -0
- package/dist/atomic/icons/exports.d.ts +1 -0
- package/dist/atomic/icons/exports.js +1 -0
- package/dist/composed/calendar/api/format-caption.d.ts +5 -0
- package/dist/composed/calendar/api/format-caption.js +13 -0
- package/dist/composed/calendar/api/index.d.ts +1 -0
- package/dist/composed/calendar/api/index.js +1 -0
- package/dist/composed/calendar/index.d.ts +2 -0
- package/dist/composed/calendar/index.js +1 -0
- package/dist/composed/calendar/root/calendar.root.svelte +91 -0
- package/dist/composed/calendar/root/calendar.root.svelte.d.ts +4 -0
- package/dist/composed/calendar/root/index.d.ts +1 -0
- package/dist/composed/calendar/root/index.js +1 -0
- package/dist/composed/calendar/types.d.ts +32 -0
- package/dist/composed/calendar/types.js +1 -0
- package/dist/composed/date-picker/index.d.ts +2 -0
- package/dist/composed/date-picker/index.js +1 -0
- package/dist/composed/date-picker/root/date-picker.root.svelte +144 -0
- package/dist/composed/date-picker/root/date-picker.root.svelte.d.ts +4 -0
- package/dist/composed/date-picker/root/index.d.ts +1 -0
- package/dist/composed/date-picker/root/index.js +1 -0
- package/dist/composed/date-picker/types.d.ts +45 -0
- package/dist/composed/date-picker/types.js +1 -0
- package/dist/composed/index.d.ts +2 -0
- package/dist/composed/index.js +2 -0
- package/dist/internal/utils/tailwindcss.d.ts +1 -1
- package/dist/primitives/calendar/components/calendar.body.svelte +20 -0
- package/dist/primitives/calendar/components/calendar.body.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.cell.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.cell.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.day.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.day.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.grid-body.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.grid-body.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.grid-head.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.grid-head.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.grid-row.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.grid-row.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.grid.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.grid.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.head-cell.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.head-cell.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.header.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.header.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.heading.svelte +10 -0
- package/dist/primitives/calendar/components/calendar.heading.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.month-select.svelte +37 -0
- package/dist/primitives/calendar/components/calendar.month-select.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.next-button.svelte +26 -0
- package/dist/primitives/calendar/components/calendar.next-button.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.prev-button.svelte +26 -0
- package/dist/primitives/calendar/components/calendar.prev-button.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.root.svelte +35 -0
- package/dist/primitives/calendar/components/calendar.root.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/calendar.year-select.svelte +37 -0
- package/dist/primitives/calendar/components/calendar.year-select.svelte.d.ts +4 -0
- package/dist/primitives/calendar/components/index.d.ts +15 -0
- package/dist/primitives/calendar/components/index.js +15 -0
- package/dist/primitives/calendar/index.d.ts +2 -0
- package/dist/primitives/calendar/index.js +2 -0
- package/dist/primitives/calendar/styles.d.ts +59 -0
- package/dist/primitives/calendar/styles.js +72 -0
- package/dist/primitives/calendar/types.d.ts +30 -0
- package/dist/primitives/calendar/types.js +1 -0
- package/dist/primitives/date-picker/components/date-picker.calendar.svelte +10 -0
- package/dist/primitives/date-picker/components/date-picker.calendar.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/date-picker.content.svelte +28 -0
- package/dist/primitives/date-picker/components/date-picker.content.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/date-picker.input.svelte +28 -0
- package/dist/primitives/date-picker/components/date-picker.input.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/date-picker.portal.svelte +10 -0
- package/dist/primitives/date-picker/components/date-picker.portal.svelte.d.ts +3 -0
- package/dist/primitives/date-picker/components/date-picker.root.svelte +21 -0
- package/dist/primitives/date-picker/components/date-picker.root.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/date-picker.segment.svelte +10 -0
- package/dist/primitives/date-picker/components/date-picker.segment.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/date-picker.trigger.svelte +61 -0
- package/dist/primitives/date-picker/components/date-picker.trigger.svelte.d.ts +4 -0
- package/dist/primitives/date-picker/components/index.d.ts +7 -0
- package/dist/primitives/date-picker/components/index.js +7 -0
- package/dist/primitives/date-picker/index.d.ts +2 -0
- package/dist/primitives/date-picker/index.js +2 -0
- package/dist/primitives/date-picker/styles.d.ts +171 -0
- package/dist/primitives/date-picker/styles.js +143 -0
- package/dist/primitives/date-picker/types.d.ts +14 -0
- package/dist/primitives/date-picker/types.js +1 -0
- package/dist/primitives/index.d.ts +5 -3
- package/dist/primitives/index.js +5 -3
- package/dist/primitives/select/styles.js +3 -0
- package/package.json +22 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { Calendar as Primitive } from 'bits-ui';
|
|
4
|
+
// import { calendarMonthSelectStyles } from '../styles.js';
|
|
5
|
+
import { Select } from '../../select/index.js';
|
|
6
|
+
import type { CalendarYearSelectProps } from '../types.js';
|
|
7
|
+
|
|
8
|
+
let { ref = $bindable(null), class: className, ...restProps }: CalendarYearSelectProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Primitive.YearSelect bind:ref class={cn(className)} {...restProps}>
|
|
12
|
+
{#snippet child({ yearItems, selectedYearItem, props })}
|
|
13
|
+
<Select.Root
|
|
14
|
+
type="single"
|
|
15
|
+
value={String(selectedYearItem.value)}
|
|
16
|
+
onValueChange={(v) => {
|
|
17
|
+
if ('onchange' in props && typeof props.onchange === 'function') {
|
|
18
|
+
props.onchange?.({ target: { value: String(v) } } as unknown as Event);
|
|
19
|
+
}
|
|
20
|
+
}}
|
|
21
|
+
disabled={props?.disabled as boolean}
|
|
22
|
+
>
|
|
23
|
+
<Select.Trigger class="cgui:shrink">
|
|
24
|
+
{selectedYearItem.label}
|
|
25
|
+
</Select.Trigger>
|
|
26
|
+
<Select.Content class="cgui:max-h-40">
|
|
27
|
+
<Select.Viewport>
|
|
28
|
+
{#each yearItems as yearItem, i (i)}
|
|
29
|
+
<Select.Item value={yearItem.value.toString()}>
|
|
30
|
+
{yearItem.label}
|
|
31
|
+
</Select.Item>
|
|
32
|
+
{/each}
|
|
33
|
+
</Select.Viewport>
|
|
34
|
+
</Select.Content>
|
|
35
|
+
</Select.Root>
|
|
36
|
+
{/snippet}
|
|
37
|
+
</Primitive.YearSelect>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as Body } from './calendar.body.svelte';
|
|
2
|
+
export { default as Cell } from './calendar.cell.svelte';
|
|
3
|
+
export { default as Day } from './calendar.day.svelte';
|
|
4
|
+
export { default as GridBody } from './calendar.grid-body.svelte';
|
|
5
|
+
export { default as GridHead } from './calendar.grid-head.svelte';
|
|
6
|
+
export { default as GridRow } from './calendar.grid-row.svelte';
|
|
7
|
+
export { default as Grid } from './calendar.grid.svelte';
|
|
8
|
+
export { default as HeadCell } from './calendar.head-cell.svelte';
|
|
9
|
+
export { default as Header } from './calendar.header.svelte';
|
|
10
|
+
export { default as Heading } from './calendar.heading.svelte';
|
|
11
|
+
export { default as MonthSelect } from './calendar.month-select.svelte';
|
|
12
|
+
export { default as NextButton } from './calendar.next-button.svelte';
|
|
13
|
+
export { default as PrevButton } from './calendar.prev-button.svelte';
|
|
14
|
+
export { default as Root } from './calendar.root.svelte';
|
|
15
|
+
export { default as YearSelect } from './calendar.year-select.svelte';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as Body } from './calendar.body.svelte';
|
|
2
|
+
export { default as Cell } from './calendar.cell.svelte';
|
|
3
|
+
export { default as Day } from './calendar.day.svelte';
|
|
4
|
+
export { default as GridBody } from './calendar.grid-body.svelte';
|
|
5
|
+
export { default as GridHead } from './calendar.grid-head.svelte';
|
|
6
|
+
export { default as GridRow } from './calendar.grid-row.svelte';
|
|
7
|
+
export { default as Grid } from './calendar.grid.svelte';
|
|
8
|
+
export { default as HeadCell } from './calendar.head-cell.svelte';
|
|
9
|
+
export { default as Header } from './calendar.header.svelte';
|
|
10
|
+
export { default as Heading } from './calendar.heading.svelte';
|
|
11
|
+
export { default as MonthSelect } from './calendar.month-select.svelte';
|
|
12
|
+
export { default as NextButton } from './calendar.next-button.svelte';
|
|
13
|
+
export { default as PrevButton } from './calendar.prev-button.svelte';
|
|
14
|
+
export { default as Root } from './calendar.root.svelte';
|
|
15
|
+
export { default as YearSelect } from './calendar.year-select.svelte';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type VariantProps } from '../../internal/utils/tailwindcss.js';
|
|
2
|
+
import { Context } from 'runed';
|
|
3
|
+
import type { ReadableBoxedValues } from 'svelte-toolbelt';
|
|
4
|
+
type CalendarRounded = 'none' | 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
+
export declare const calendarRootVariants: import("tailwind-variants").TVReturnType<{
|
|
6
|
+
rounded: {
|
|
7
|
+
none: never[];
|
|
8
|
+
xs: string[];
|
|
9
|
+
sm: string[];
|
|
10
|
+
md: string[];
|
|
11
|
+
lg: string[];
|
|
12
|
+
};
|
|
13
|
+
}, undefined, string[], {
|
|
14
|
+
rounded: {
|
|
15
|
+
none: never[];
|
|
16
|
+
xs: string[];
|
|
17
|
+
sm: string[];
|
|
18
|
+
md: string[];
|
|
19
|
+
lg: string[];
|
|
20
|
+
};
|
|
21
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
22
|
+
rounded: {
|
|
23
|
+
none: never[];
|
|
24
|
+
xs: string[];
|
|
25
|
+
sm: string[];
|
|
26
|
+
md: string[];
|
|
27
|
+
lg: string[];
|
|
28
|
+
};
|
|
29
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
30
|
+
export declare const calendarHeaderVariants: import("tailwind-variants").TVReturnType<{}, undefined, string[], {}, undefined, import("tailwind-variants").TVReturnType<{}, undefined, string[], unknown, unknown, undefined>>;
|
|
31
|
+
export declare const calendarHeaderButtonVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
32
|
+
export declare const calendarHeadingVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
33
|
+
export declare const calendarBodyVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
34
|
+
export declare const calendarGridVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
35
|
+
export declare const calendarGridHeadVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, never[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, never[], unknown, unknown, undefined>>;
|
|
36
|
+
export declare const calendarGridBodyVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, never[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, never[], unknown, unknown, undefined>>;
|
|
37
|
+
export declare const calendarGridRowVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
38
|
+
export declare const calendarHeadCellVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
39
|
+
export declare const calendarCellVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
40
|
+
export declare const calendarDayVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
41
|
+
export type CalendarRootVariants = VariantProps<typeof calendarRootVariants>;
|
|
42
|
+
export type CalendarHeaderVariants = VariantProps<typeof calendarHeaderVariants>;
|
|
43
|
+
export type CalendarHeaderButtonVariants = VariantProps<typeof calendarHeaderButtonVariants>;
|
|
44
|
+
export type CalendarHeadingVariants = VariantProps<typeof calendarHeadingVariants>;
|
|
45
|
+
export type CalendarBodyVariants = VariantProps<typeof calendarBodyVariants>;
|
|
46
|
+
export type CalendarGridVariants = VariantProps<typeof calendarGridVariants>;
|
|
47
|
+
export type CalendarGridHeadVariants = VariantProps<typeof calendarGridHeadVariants>;
|
|
48
|
+
export type CalendarGridBodyVariants = VariantProps<typeof calendarGridBodyVariants>;
|
|
49
|
+
export type CalendarGridRowVariants = VariantProps<typeof calendarGridRowVariants>;
|
|
50
|
+
export type CalendarHeadCellVariants = VariantProps<typeof calendarHeadCellVariants>;
|
|
51
|
+
export type CalendarCellVariants = VariantProps<typeof calendarCellVariants>;
|
|
52
|
+
export type CalendarDayVariants = VariantProps<typeof calendarDayVariants>;
|
|
53
|
+
export type { CalendarRounded };
|
|
54
|
+
export type CalendarRootContextValue = ReadableBoxedValues<{
|
|
55
|
+
rounded: CalendarRounded;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const CalendarRootStylesContext: Context<ReadableBoxedValues<{
|
|
58
|
+
rounded: CalendarRounded;
|
|
59
|
+
}>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { keyWithPrefix } from '../../internal/utils/common.js';
|
|
2
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { Context } from 'runed';
|
|
4
|
+
export const calendarRootVariants = tv({
|
|
5
|
+
base: ['cgui:bg-surface-white cgui:shadow-popover cgui:p-4 cgui:overflow-hidden'],
|
|
6
|
+
variants: {
|
|
7
|
+
rounded: {
|
|
8
|
+
none: [],
|
|
9
|
+
xs: ['cgui:rounded-xs'],
|
|
10
|
+
sm: ['cgui:rounded-sm'],
|
|
11
|
+
md: ['cgui:rounded-md'],
|
|
12
|
+
lg: ['cgui:rounded-lg'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const calendarHeaderVariants = tv({
|
|
17
|
+
base: ['cgui:flex cgui:items-center cgui:justify-between'],
|
|
18
|
+
variants: {},
|
|
19
|
+
});
|
|
20
|
+
export const calendarHeaderButtonVariants = tv({
|
|
21
|
+
base: [
|
|
22
|
+
'cgui:inline-flex cgui:items-center cgui:justify-center cgui:gap-1 cgui:cursor-pointer cgui:size-6 cgui:text-center cgui:overflow-hidden',
|
|
23
|
+
'cgui:text-icon-default',
|
|
24
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
25
|
+
'cgui:select-none cgui:font-medium cgui:outline-none',
|
|
26
|
+
'cgui:data-disabled:cursor-not-allowed cgui:data-disabled:opacity-50',
|
|
27
|
+
'cgui:[&_svg]:shrink-0 cgui:[&_svg]:size-5',
|
|
28
|
+
'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed',
|
|
29
|
+
'cgui:focus-visible:ring-stroke-primary/50 cgui:focus-visible:ring-2 cgui:bg-clip-padding cgui:rounded-xs',
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
export const calendarHeadingVariants = tv({
|
|
33
|
+
base: ['cgui:text-body cgui:text-fg-darkest cgui:font-medium'],
|
|
34
|
+
});
|
|
35
|
+
export const calendarBodyVariants = tv({
|
|
36
|
+
base: ['cgui:flex cgui:flex-col cgui:space-y-2 cgui:pt-3'],
|
|
37
|
+
});
|
|
38
|
+
export const calendarGridVariants = tv({
|
|
39
|
+
base: ['cgui:w-full cgui:border-collapse cgui:select-none cgui:space-y-1'],
|
|
40
|
+
});
|
|
41
|
+
export const calendarGridHeadVariants = tv({
|
|
42
|
+
base: [],
|
|
43
|
+
});
|
|
44
|
+
export const calendarGridBodyVariants = tv({
|
|
45
|
+
base: [],
|
|
46
|
+
});
|
|
47
|
+
export const calendarGridRowVariants = tv({
|
|
48
|
+
base: ['cgui:flex cgui:w-full cgui:justify-between'],
|
|
49
|
+
});
|
|
50
|
+
export const calendarHeadCellVariants = tv({
|
|
51
|
+
base: ['cgui:font-medium cgui:w-10 cgui:rounded-xs cgui:text-body-2 cgui:text-fg-semilight'],
|
|
52
|
+
});
|
|
53
|
+
export const calendarCellVariants = tv({
|
|
54
|
+
base: ['cgui:p-0! cgui:relative cgui:size-10 cgui:text-center cgui:text-body-2 cgui:text-fg-darkest'],
|
|
55
|
+
});
|
|
56
|
+
export const calendarDayVariants = tv({
|
|
57
|
+
base: [
|
|
58
|
+
'cgui:relative cgui:inline-flex cgui:size-10 cgui:items-center cgui:justify-center cgui:p-0',
|
|
59
|
+
'cgui:before:absolute cgui:data-today:before:block cgui:before:hidden cgui:before:top-1 cgui:before:left-1/2 cgui:before:-translate-x-1/2 cgui:before:size-1 cgui:before:bg-stroke-primary cgui:before:rounded-full',
|
|
60
|
+
'cgui:rounded-full cgui:text-body-2 cgui:text-fg-darkest cgui:font-normal cgui:whitespace-nowrap',
|
|
61
|
+
'cgui:bg-transparent cgui:border cgui:border-transparent',
|
|
62
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
63
|
+
'cgui:cursor-pointer cgui:outline-none',
|
|
64
|
+
'cgui:focus-visible:ring-stroke-primary/50 cgui:focus-visible:ring-2 cgui:bg-clip-padding',
|
|
65
|
+
'cgui:data-selected:bg-surface-primary cgui:data-selected:text-fg-white cgui:data-selected:font-medium',
|
|
66
|
+
'cgui:data-outside-month:pointer-events-none',
|
|
67
|
+
'cgui:data-unavailable:text-fg-semilight cgui:data-unavailable:line-through',
|
|
68
|
+
'cgui:data-disabled:text-fg-semilight/30 cgui:data-disabled:pointer-events-none',
|
|
69
|
+
'cgui:data-today:data-selected:before:bg-surface-light',
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
export const CalendarRootStylesContext = new Context(keyWithPrefix('calendar-root-styles'));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Calendar as Primitive, CalendarMultipleRootProps as PrimitiveMultipleRootProps, CalendarSingleRootProps as PrimitiveSingleRootProps } from 'bits-ui';
|
|
2
|
+
import type { CalendarBodyVariants, CalendarCellVariants, CalendarDayVariants, CalendarGridBodyVariants, CalendarGridHeadVariants, CalendarGridRowVariants, CalendarGridVariants, CalendarHeadCellVariants, CalendarHeaderButtonVariants, CalendarHeaderVariants, CalendarHeadingVariants, CalendarRootVariants } from './styles.js';
|
|
3
|
+
import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
|
|
4
|
+
import type { WithVariants } from '../../internal/utils/tailwindcss.js';
|
|
5
|
+
import type { WithChild, WithElementRef, Without, WithoutChildrenOrChild } from 'svelte-toolbelt';
|
|
6
|
+
export type CalendarSingleRootProps = WithElementRef<WithVariants<PrimitiveSingleRootProps & {
|
|
7
|
+
child?: Primitive.RootProps['child'];
|
|
8
|
+
children?: Primitive.RootProps['children'];
|
|
9
|
+
}, CalendarRootVariants>>;
|
|
10
|
+
export type CalendarMultipleRootProps = WithElementRef<WithVariants<PrimitiveMultipleRootProps & {
|
|
11
|
+
child?: Primitive.RootProps['child'];
|
|
12
|
+
children?: Primitive.RootProps['children'];
|
|
13
|
+
}, CalendarRootVariants>>;
|
|
14
|
+
export type CalendarRootProps = CalendarSingleRootProps | CalendarMultipleRootProps;
|
|
15
|
+
export type CalendarHeaderProps = WithVariants<Primitive.HeaderProps, CalendarHeaderVariants>;
|
|
16
|
+
export type CalendarNextButtonProps = WithVariants<Primitive.NextButtonProps, CalendarHeaderButtonVariants>;
|
|
17
|
+
export type CalendarPrevButtonProps = WithVariants<Primitive.PrevButtonProps, CalendarHeaderButtonVariants>;
|
|
18
|
+
export type CalendarHeadingProps = WithVariants<Primitive.HeadingProps, CalendarHeadingVariants>;
|
|
19
|
+
export type CalendarGridProps = WithVariants<Primitive.GridProps, CalendarGridVariants>;
|
|
20
|
+
export type CalendarGridHeadProps = WithVariants<Primitive.GridHeadProps, CalendarGridHeadVariants>;
|
|
21
|
+
export type CalendarGridBodyProps = WithVariants<Primitive.GridBodyProps, CalendarGridBodyVariants>;
|
|
22
|
+
export type CalendarGridRowProps = WithVariants<Primitive.GridRowProps, CalendarGridRowVariants>;
|
|
23
|
+
export type CalendarHeadCellProps = WithVariants<Primitive.HeadCellProps, CalendarHeadCellVariants>;
|
|
24
|
+
export type CalendarCellProps = WithVariants<Primitive.CellProps, CalendarCellVariants>;
|
|
25
|
+
export type CalendarDayProps = WithVariants<Primitive.DayProps, CalendarDayVariants>;
|
|
26
|
+
export type CalendarMonthSelectProps = WithoutChildrenOrChild<Primitive.MonthSelectProps>;
|
|
27
|
+
export type CalendarYearSelectProps = WithoutChildrenOrChild<Primitive.YearSelectProps>;
|
|
28
|
+
type CalendarBodyWithoutHTML = WithElementRef<WithChild<WithVariants<{}, CalendarBodyVariants>>>;
|
|
29
|
+
export type CalendarBodyProps = CalendarBodyWithoutHTML & Without<PrimitiveDivAttributes, CalendarBodyWithoutHTML>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
4
|
+
import { datePickerCalendarVariants } from '../styles.js';
|
|
5
|
+
import type { DatePickerCalendarProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
let { ref = $bindable(null), class: className, ...restProps }: DatePickerCalendarProps = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Primitive.Calendar bind:ref class={cn(datePickerCalendarVariants(), className)} {...restProps} />
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
4
|
+
import { datePickerContentVariants, DatePickerRootStylesContext } from '../styles.js';
|
|
5
|
+
import type { DatePickerContentProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
side = 'bottom',
|
|
11
|
+
sideOffset = 8,
|
|
12
|
+
align = 'start',
|
|
13
|
+
rounded,
|
|
14
|
+
...restProps
|
|
15
|
+
}: DatePickerContentProps = $props();
|
|
16
|
+
|
|
17
|
+
const stylesContext = DatePickerRootStylesContext.getOr(null);
|
|
18
|
+
const resolvedRounded = $derived(rounded ?? stylesContext?.rounded.current ?? 'md');
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Primitive.Content
|
|
22
|
+
bind:ref
|
|
23
|
+
{side}
|
|
24
|
+
{sideOffset}
|
|
25
|
+
{align}
|
|
26
|
+
class={cn(datePickerContentVariants({ rounded: resolvedRounded }), className)}
|
|
27
|
+
{...restProps}
|
|
28
|
+
/>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
4
|
+
import { datePickerInputVariants } from '../styles.js';
|
|
5
|
+
import type { DatePickerInputProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = 'primary',
|
|
12
|
+
size = 'md',
|
|
13
|
+
rounded = 'sm',
|
|
14
|
+
fullWidth = false,
|
|
15
|
+
...restProps
|
|
16
|
+
}: DatePickerInputProps = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Primitive.Input
|
|
20
|
+
bind:ref
|
|
21
|
+
data-slot="date-picker-input"
|
|
22
|
+
class={cn(datePickerInputVariants({ variant, size, rounded, fullWidth }), className)}
|
|
23
|
+
{...restProps}
|
|
24
|
+
>
|
|
25
|
+
{#snippet children({ segments })}
|
|
26
|
+
{@render children?.({ segments })}
|
|
27
|
+
{/snippet}
|
|
28
|
+
</Primitive.Input>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
3
|
+
import type { DatePickerPortalProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
let { children, ...restProps }: DatePickerPortalProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<Primitive.Portal {...restProps}>
|
|
9
|
+
{@render children?.()}
|
|
10
|
+
</Primitive.Portal>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
3
|
+
import { boxWith } from 'svelte-toolbelt';
|
|
4
|
+
import { DatePickerRootStylesContext } from '../styles.js';
|
|
5
|
+
import type { DatePickerRootProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
open = $bindable(false),
|
|
10
|
+
placeholder = $bindable(),
|
|
11
|
+
//
|
|
12
|
+
rounded = 'md',
|
|
13
|
+
...restProps
|
|
14
|
+
}: DatePickerRootProps = $props();
|
|
15
|
+
|
|
16
|
+
DatePickerRootStylesContext.set({
|
|
17
|
+
rounded: boxWith(() => rounded),
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Primitive.Root bind:value bind:open bind:placeholder {...restProps} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
4
|
+
import { datePickerSegmentVariants } from '../styles.js';
|
|
5
|
+
import type { DatePickerSegmentProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
let { ref = $bindable(null), class: className, ...restProps }: DatePickerSegmentProps = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Primitive.Segment bind:ref class={cn(datePickerSegmentVariants(), className)} {...restProps} />
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Icon } from '../../../atomic/icons/index.js';
|
|
3
|
+
import { boolAttr } from '../../../internal/utils/attrs.js';
|
|
4
|
+
import { cn } from '../../../internal/utils/tailwindcss.js';
|
|
5
|
+
import { DatePicker as Primitive } from 'bits-ui';
|
|
6
|
+
import { datePickerTriggerVariants } from '../styles.js';
|
|
7
|
+
import type { DatePickerTriggerProps } from '../types.js';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
class: className,
|
|
12
|
+
child: childSnippet,
|
|
13
|
+
children,
|
|
14
|
+
hasChevron = true,
|
|
15
|
+
size = 'md',
|
|
16
|
+
variant = 'primary',
|
|
17
|
+
rounded = 'sm',
|
|
18
|
+
fullWidth = true,
|
|
19
|
+
...restProps
|
|
20
|
+
}: DatePickerTriggerProps = $props();
|
|
21
|
+
|
|
22
|
+
const attrs = $derived({
|
|
23
|
+
'data-slot': 'trigger',
|
|
24
|
+
'data-has-chevron': boolAttr(hasChevron),
|
|
25
|
+
class: cn(
|
|
26
|
+
datePickerTriggerVariants({
|
|
27
|
+
size,
|
|
28
|
+
variant,
|
|
29
|
+
rounded,
|
|
30
|
+
fullWidth,
|
|
31
|
+
hasChevron,
|
|
32
|
+
}),
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...restProps,
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Primitive.Trigger bind:ref {...attrs}>
|
|
40
|
+
{#snippet child({ props })}
|
|
41
|
+
{#if childSnippet}
|
|
42
|
+
{@render childSnippet({ props })}
|
|
43
|
+
{:else}
|
|
44
|
+
<button {...props}>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
|
|
47
|
+
{#if hasChevron}
|
|
48
|
+
<span
|
|
49
|
+
data-slot="chevron"
|
|
50
|
+
class={cn(
|
|
51
|
+
'cgui:absolute cgui:top-1/2 cgui:-translate-y-1/2 cgui:right-2',
|
|
52
|
+
'cgui:ms-auto cgui:text-fg-regular'
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
<Icon.Calendar width={18} height={18} />
|
|
56
|
+
</span>
|
|
57
|
+
{/if}
|
|
58
|
+
</button>
|
|
59
|
+
{/if}
|
|
60
|
+
{/snippet}
|
|
61
|
+
</Primitive.Trigger>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Calendar } from './date-picker.calendar.svelte';
|
|
2
|
+
export { default as Content } from './date-picker.content.svelte';
|
|
3
|
+
export { default as Input } from './date-picker.input.svelte';
|
|
4
|
+
export { default as Portal } from './date-picker.portal.svelte';
|
|
5
|
+
export { default as Root } from './date-picker.root.svelte';
|
|
6
|
+
export { default as Segment } from './date-picker.segment.svelte';
|
|
7
|
+
export { default as Trigger } from './date-picker.trigger.svelte';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Calendar } from './date-picker.calendar.svelte';
|
|
2
|
+
export { default as Content } from './date-picker.content.svelte';
|
|
3
|
+
export { default as Input } from './date-picker.input.svelte';
|
|
4
|
+
export { default as Portal } from './date-picker.portal.svelte';
|
|
5
|
+
export { default as Root } from './date-picker.root.svelte';
|
|
6
|
+
export { default as Segment } from './date-picker.segment.svelte';
|
|
7
|
+
export { default as Trigger } from './date-picker.trigger.svelte';
|