@casinogate/ui 2.0.1 → 2.0.3

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.
Files changed (96) hide show
  1. package/dist/assets/css/root.css +330 -0
  2. package/dist/atomic/icons/calendar.svelte +13 -0
  3. package/dist/atomic/icons/calendar.svelte.d.ts +3 -0
  4. package/dist/atomic/icons/exports.d.ts +1 -0
  5. package/dist/atomic/icons/exports.js +1 -0
  6. package/dist/composed/calendar/api/format-caption.d.ts +5 -0
  7. package/dist/composed/calendar/api/format-caption.js +13 -0
  8. package/dist/composed/calendar/api/index.d.ts +1 -0
  9. package/dist/composed/calendar/api/index.js +1 -0
  10. package/dist/composed/calendar/index.d.ts +2 -0
  11. package/dist/composed/calendar/index.js +1 -0
  12. package/dist/composed/calendar/root/calendar.root.svelte +91 -0
  13. package/dist/composed/calendar/root/calendar.root.svelte.d.ts +4 -0
  14. package/dist/composed/calendar/root/index.d.ts +1 -0
  15. package/dist/composed/calendar/root/index.js +1 -0
  16. package/dist/composed/calendar/types.d.ts +32 -0
  17. package/dist/composed/calendar/types.js +1 -0
  18. package/dist/composed/combobox/creatable/combobox.creatable.svelte +1 -1
  19. package/dist/composed/combobox/types.d.ts +12 -12
  20. package/dist/composed/date-picker/index.d.ts +2 -0
  21. package/dist/composed/date-picker/index.js +1 -0
  22. package/dist/composed/date-picker/root/date-picker.root.svelte +144 -0
  23. package/dist/composed/date-picker/root/date-picker.root.svelte.d.ts +4 -0
  24. package/dist/composed/date-picker/root/index.d.ts +1 -0
  25. package/dist/composed/date-picker/root/index.js +1 -0
  26. package/dist/composed/date-picker/types.d.ts +45 -0
  27. package/dist/composed/date-picker/types.js +1 -0
  28. package/dist/composed/index.d.ts +2 -0
  29. package/dist/composed/index.js +2 -0
  30. package/dist/internal/utils/tailwindcss.d.ts +1 -1
  31. package/dist/primitives/calendar/components/calendar.body.svelte +20 -0
  32. package/dist/primitives/calendar/components/calendar.body.svelte.d.ts +4 -0
  33. package/dist/primitives/calendar/components/calendar.cell.svelte +10 -0
  34. package/dist/primitives/calendar/components/calendar.cell.svelte.d.ts +4 -0
  35. package/dist/primitives/calendar/components/calendar.day.svelte +10 -0
  36. package/dist/primitives/calendar/components/calendar.day.svelte.d.ts +4 -0
  37. package/dist/primitives/calendar/components/calendar.grid-body.svelte +10 -0
  38. package/dist/primitives/calendar/components/calendar.grid-body.svelte.d.ts +4 -0
  39. package/dist/primitives/calendar/components/calendar.grid-head.svelte +10 -0
  40. package/dist/primitives/calendar/components/calendar.grid-head.svelte.d.ts +4 -0
  41. package/dist/primitives/calendar/components/calendar.grid-row.svelte +10 -0
  42. package/dist/primitives/calendar/components/calendar.grid-row.svelte.d.ts +4 -0
  43. package/dist/primitives/calendar/components/calendar.grid.svelte +10 -0
  44. package/dist/primitives/calendar/components/calendar.grid.svelte.d.ts +4 -0
  45. package/dist/primitives/calendar/components/calendar.head-cell.svelte +10 -0
  46. package/dist/primitives/calendar/components/calendar.head-cell.svelte.d.ts +4 -0
  47. package/dist/primitives/calendar/components/calendar.header.svelte +10 -0
  48. package/dist/primitives/calendar/components/calendar.header.svelte.d.ts +4 -0
  49. package/dist/primitives/calendar/components/calendar.heading.svelte +10 -0
  50. package/dist/primitives/calendar/components/calendar.heading.svelte.d.ts +4 -0
  51. package/dist/primitives/calendar/components/calendar.month-select.svelte +37 -0
  52. package/dist/primitives/calendar/components/calendar.month-select.svelte.d.ts +4 -0
  53. package/dist/primitives/calendar/components/calendar.next-button.svelte +26 -0
  54. package/dist/primitives/calendar/components/calendar.next-button.svelte.d.ts +4 -0
  55. package/dist/primitives/calendar/components/calendar.prev-button.svelte +26 -0
  56. package/dist/primitives/calendar/components/calendar.prev-button.svelte.d.ts +4 -0
  57. package/dist/primitives/calendar/components/calendar.root.svelte +35 -0
  58. package/dist/primitives/calendar/components/calendar.root.svelte.d.ts +4 -0
  59. package/dist/primitives/calendar/components/calendar.year-select.svelte +37 -0
  60. package/dist/primitives/calendar/components/calendar.year-select.svelte.d.ts +4 -0
  61. package/dist/primitives/calendar/components/index.d.ts +15 -0
  62. package/dist/primitives/calendar/components/index.js +15 -0
  63. package/dist/primitives/calendar/index.d.ts +2 -0
  64. package/dist/primitives/calendar/index.js +2 -0
  65. package/dist/primitives/calendar/styles.d.ts +59 -0
  66. package/dist/primitives/calendar/styles.js +72 -0
  67. package/dist/primitives/calendar/types.d.ts +30 -0
  68. package/dist/primitives/calendar/types.js +1 -0
  69. package/dist/primitives/combobox/components/combobox.item.svelte +10 -24
  70. package/dist/primitives/combobox/components/combobox.root.svelte +1 -16
  71. package/dist/primitives/combobox/components/combobox.svelte.d.ts +1 -1
  72. package/dist/primitives/combobox/types.d.ts +7 -35
  73. package/dist/primitives/date-picker/components/date-picker.calendar.svelte +10 -0
  74. package/dist/primitives/date-picker/components/date-picker.calendar.svelte.d.ts +4 -0
  75. package/dist/primitives/date-picker/components/date-picker.content.svelte +28 -0
  76. package/dist/primitives/date-picker/components/date-picker.content.svelte.d.ts +4 -0
  77. package/dist/primitives/date-picker/components/date-picker.input.svelte +28 -0
  78. package/dist/primitives/date-picker/components/date-picker.input.svelte.d.ts +4 -0
  79. package/dist/primitives/date-picker/components/date-picker.portal.svelte +10 -0
  80. package/dist/primitives/date-picker/components/date-picker.portal.svelte.d.ts +3 -0
  81. package/dist/primitives/date-picker/components/date-picker.root.svelte +21 -0
  82. package/dist/primitives/date-picker/components/date-picker.root.svelte.d.ts +4 -0
  83. package/dist/primitives/date-picker/components/date-picker.segment.svelte +10 -0
  84. package/dist/primitives/date-picker/components/date-picker.segment.svelte.d.ts +4 -0
  85. package/dist/primitives/date-picker/components/date-picker.trigger.svelte +61 -0
  86. package/dist/primitives/date-picker/components/date-picker.trigger.svelte.d.ts +4 -0
  87. package/dist/primitives/date-picker/components/index.d.ts +7 -0
  88. package/dist/primitives/date-picker/components/index.js +7 -0
  89. package/dist/primitives/date-picker/index.d.ts +2 -0
  90. package/dist/primitives/date-picker/index.js +2 -0
  91. package/dist/primitives/date-picker/styles.d.ts +171 -0
  92. package/dist/primitives/date-picker/styles.js +143 -0
  93. package/dist/primitives/date-picker/types.d.ts +14 -0
  94. package/dist/primitives/date-picker/types.js +1 -0
  95. package/dist/primitives/select/styles.js +3 -0
  96. package/package.json +2 -1
@@ -0,0 +1,32 @@
1
+ import type { CalendarMultipleRootProps, CalendarSingleRootProps } from '../../primitives/calendar/types.js';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { Snippet } from 'svelte';
4
+ export type CalendarCaptionLayout = 'label' | 'dropdown' | 'dropdown-months' | 'dropdown-years';
5
+ type CalendarDaySnippetArgs = {
6
+ date: DateValue;
7
+ month: DateValue;
8
+ };
9
+ type CalendarSharedProps = {
10
+ /**
11
+ * How the calendar caption is rendered.
12
+ * - `'label'` – formatted month + year heading (default)
13
+ * - `'dropdown'` – month and year selects
14
+ * - `'dropdown-months'` – month select + formatted year
15
+ * - `'dropdown-years'` – formatted month + year select
16
+ */
17
+ captionLayout?: CalendarCaptionLayout;
18
+ /** Custom render for each day cell. Receives the date and the month it belongs to. */
19
+ day?: Snippet<[CalendarDaySnippetArgs]>;
20
+ /** Forwarded to the wrapping container. */
21
+ class?: string;
22
+ };
23
+ export type CalendarSingleProps = Omit<CalendarSingleRootProps, 'children' | 'child' | 'value' | 'onValueChange'> & CalendarSharedProps & {
24
+ value?: DateValue;
25
+ onValueChange?: (value: DateValue | undefined) => void;
26
+ };
27
+ export type CalendarMultipleProps = Omit<CalendarMultipleRootProps, 'children' | 'child' | 'value' | 'onValueChange'> & CalendarSharedProps & {
28
+ value?: DateValue[];
29
+ onValueChange?: (value: DateValue[]) => void;
30
+ };
31
+ export type CalendarProps = CalendarSingleProps | CalendarMultipleProps;
32
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -103,12 +103,12 @@
103
103
  async function onSelectItem(nextValue: string | string[], item: TItem | null) {
104
104
  if (isCreateOption(item)) {
105
105
  const currentValue = Array.isArray(value) ? value : [];
106
+ searchValue = '';
106
107
  const createdItem = await onCreate(item.inputValue);
107
108
  const createdValue = isMultiple ? [...currentValue, createdItem.value] : createdItem.value;
108
109
 
109
110
  createdItems = [...createdItems.filter((created) => created.value !== createdItem.value), createdItem];
110
111
  value = createdValue;
111
- searchValue = '';
112
112
  onSelect(createdValue, createdItem);
113
113
  return;
114
114
  }
@@ -1,7 +1,7 @@
1
- import type { SELECTION_TYPE } from '../../internal/constants/selection-type.js';
2
- import type { Snippet } from 'svelte';
3
1
  import type { CommandGroup, CommandItem, CommandProps } from '../command/index.js';
2
+ import type { SELECTION_TYPE } from '../../internal/constants/selection-type.js';
4
3
  import type { PrimitivePopoverRootProps } from '../../primitives/popover/types.js';
4
+ import type { Snippet } from 'svelte';
5
5
  import type { ComboboxTriggerVariantsProps } from './styles.js';
6
6
  export type ComboboxRootProps = PrimitivePopoverRootProps;
7
7
  export type ComboboxItem = CommandItem & {
@@ -41,11 +41,11 @@ type ComboboxBaseProps<TItem extends ComboboxItem = ComboboxItem> = PrimitivePop
41
41
  /** Callback when selection changes */
42
42
  onSelect?: (value: string | string[], item: TItem | null) => void;
43
43
  };
44
- type ComboboxSingleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxBaseProps<TItem> & {
45
- type?: typeof SELECTION_TYPE.SINGLE;
44
+ export type ComboboxSingleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxBaseProps<TItem> & {
45
+ type: typeof SELECTION_TYPE.SINGLE;
46
46
  value?: string;
47
47
  };
48
- type ComboboxMultipleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxBaseProps<TItem> & {
48
+ export type ComboboxMultipleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxBaseProps<TItem> & {
49
49
  type: typeof SELECTION_TYPE.MULTIPLE;
50
50
  value?: string[];
51
51
  };
@@ -55,11 +55,11 @@ type ComboboxCreatableBaseProps<TItem extends ComboboxItem = ComboboxItem> = Com
55
55
  isCreatable?: (inputValue: string, items: TItem[]) => boolean;
56
56
  onCreate: (inputValue: string) => TItem | Promise<TItem>;
57
57
  };
58
- type ComboboxCreatableSingleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxCreatableBaseProps<TItem> & {
59
- type?: typeof SELECTION_TYPE.SINGLE;
58
+ export type ComboboxCreatableSingleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxCreatableBaseProps<TItem> & {
59
+ type: typeof SELECTION_TYPE.SINGLE;
60
60
  value?: string;
61
61
  };
62
- type ComboboxCreatableMultipleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxCreatableBaseProps<TItem> & {
62
+ export type ComboboxCreatableMultipleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxCreatableBaseProps<TItem> & {
63
63
  type: typeof SELECTION_TYPE.MULTIPLE;
64
64
  value?: string[];
65
65
  };
@@ -115,12 +115,12 @@ type ComboboxAsyncBaseProps<TItem extends ComboboxItem> = Omit<ComboboxBaseProps
115
115
  clearOnDependencyChange?: boolean;
116
116
  onDependencyChange?: (value: unknown) => void;
117
117
  };
118
- type ComboboxAsyncSingleProps<TItem extends ComboboxItem> = ComboboxAsyncBaseProps<TItem> & {
119
- /** Selection mode (default: 'single') */
120
- type?: 'single';
118
+ export type ComboboxAsyncSingleProps<TItem extends ComboboxItem> = ComboboxAsyncBaseProps<TItem> & {
119
+ /** Selection mode */
120
+ type: 'single';
121
121
  value?: string;
122
122
  };
123
- type ComboboxAsyncMultipleProps<TItem extends ComboboxItem> = ComboboxAsyncBaseProps<TItem> & {
123
+ export type ComboboxAsyncMultipleProps<TItem extends ComboboxItem> = ComboboxAsyncBaseProps<TItem> & {
124
124
  /** Selection mode */
125
125
  type: 'multiple';
126
126
  value?: string[];
@@ -0,0 +1,2 @@
1
+ export * from './root/index.js';
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export * from './root/index.js';
@@ -0,0 +1,144 @@
1
+ <script lang="ts" module>
2
+ import { DateFormatter, getLocalTimeZone, type DateValue } from '@internationalized/date';
3
+
4
+ const defaultFormatter = new DateFormatter('en-US', { dateStyle: 'medium' });
5
+
6
+ const defaultFormatValue = (value: DateValue | undefined): string => {
7
+ if (!value) return '';
8
+ return defaultFormatter.format(value.toDate(getLocalTimeZone()));
9
+ };
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import { Icon } from '../../../atomic/icons/index.js';
14
+ import { formatMonthCaption, formatYearCaption } from '../../calendar/api/index.js';
15
+ import { Calendar } from '../../../primitives/calendar/index.js';
16
+ import { DatePicker as Primitive } from '../../../primitives/date-picker/index.js';
17
+ import type { DatePickerProps } from '../types.js';
18
+
19
+ let {
20
+ value = $bindable(),
21
+ open = $bindable(false),
22
+ placeholder = 'Pick a date',
23
+ formatValue = defaultFormatValue,
24
+ enableSegments = false,
25
+ captionLayout = 'label',
26
+ locale = 'en-US',
27
+ monthFormat = 'long',
28
+ yearFormat = 'numeric',
29
+ name,
30
+ disabledPortal = false,
31
+ triggerVariant = 'primary',
32
+ triggerSize = 'md',
33
+ triggerRounded = 'sm',
34
+ triggerFullWidth = true,
35
+ triggerClass,
36
+ triggerProps,
37
+ inputClass,
38
+ inputProps,
39
+ contentClass,
40
+ contentProps,
41
+ ...restProps
42
+ }: DatePickerProps = $props();
43
+
44
+ const displayLabel = $derived(formatValue(value) || placeholder);
45
+ </script>
46
+
47
+ <Primitive.Root bind:value bind:open {locale} {monthFormat} {yearFormat} {...restProps}>
48
+ {#if enableSegments}
49
+ <Primitive.Input {name} class={inputClass} {...inputProps}>
50
+ {#snippet children({ segments })}
51
+ {#each segments as { part, value: segmentValue }, i (i)}
52
+ <Primitive.Segment {part}>{segmentValue}</Primitive.Segment>
53
+ {/each}
54
+
55
+ <Primitive.Trigger
56
+ variant={triggerVariant}
57
+ size={triggerSize}
58
+ rounded={triggerRounded}
59
+ fullWidth={triggerFullWidth}
60
+ class={triggerClass}
61
+ hasChevron={false}
62
+ {...triggerProps}
63
+ >
64
+ <Icon.Calendar width={18} height={18} />
65
+ </Primitive.Trigger>
66
+ {/snippet}
67
+ </Primitive.Input>
68
+ {:else}
69
+ <Primitive.Trigger
70
+ variant={triggerVariant}
71
+ size={triggerSize}
72
+ rounded={triggerRounded}
73
+ fullWidth={triggerFullWidth}
74
+ class={triggerClass}
75
+ {...triggerProps}
76
+ >
77
+ {displayLabel}
78
+ </Primitive.Trigger>
79
+ {/if}
80
+
81
+ <Primitive.Portal disabled={disabledPortal}>
82
+ <Primitive.Content class={contentClass} {...contentProps}>
83
+ <Primitive.Calendar>
84
+ {#snippet children({ months, weekdays })}
85
+ {@const currentMonth = months[0]?.value}
86
+ <Calendar.Header>
87
+ <Calendar.PrevButton />
88
+
89
+ {#if captionLayout === 'dropdown'}
90
+ <div class="cgui:flex cgui:items-center cgui:gap-2">
91
+ <Calendar.MonthSelect />
92
+ <Calendar.YearSelect />
93
+ </div>
94
+ {:else if captionLayout === 'dropdown-months' && currentMonth}
95
+ <div class="cgui:flex cgui:items-center cgui:gap-2">
96
+ <Calendar.MonthSelect />
97
+ <span class="cgui:text-body cgui:text-fg-darkest cgui:font-medium">
98
+ {formatYearCaption(currentMonth, locale, yearFormat)}
99
+ </span>
100
+ </div>
101
+ {:else if captionLayout === 'dropdown-years' && currentMonth}
102
+ <div class="cgui:flex cgui:items-center cgui:gap-2">
103
+ <span class="cgui:text-body cgui:text-fg-darkest cgui:font-medium">
104
+ {formatMonthCaption(currentMonth, locale, monthFormat)}
105
+ </span>
106
+ <Calendar.YearSelect />
107
+ </div>
108
+ {:else}
109
+ <Calendar.Heading />
110
+ {/if}
111
+
112
+ <Calendar.NextButton />
113
+ </Calendar.Header>
114
+
115
+ <Calendar.Body>
116
+ {#each months as month, i (i)}
117
+ <Calendar.Grid>
118
+ <Calendar.GridHead>
119
+ <Calendar.GridRow>
120
+ {#each weekdays as weekday, j (j)}
121
+ <Calendar.HeadCell>{weekday}</Calendar.HeadCell>
122
+ {/each}
123
+ </Calendar.GridRow>
124
+ </Calendar.GridHead>
125
+
126
+ <Calendar.GridBody>
127
+ {#each month.weeks as weekDates, w (w)}
128
+ <Calendar.GridRow>
129
+ {#each weekDates as date, d (d)}
130
+ <Calendar.Cell {date} month={month.value}>
131
+ <Calendar.Day>{date.day}</Calendar.Day>
132
+ </Calendar.Cell>
133
+ {/each}
134
+ </Calendar.GridRow>
135
+ {/each}
136
+ </Calendar.GridBody>
137
+ </Calendar.Grid>
138
+ {/each}
139
+ </Calendar.Body>
140
+ {/snippet}
141
+ </Primitive.Calendar>
142
+ </Primitive.Content>
143
+ </Primitive.Portal>
144
+ </Primitive.Root>
@@ -0,0 +1,4 @@
1
+ import type { DatePickerProps } from '../types.js';
2
+ declare const DatePicker: import("svelte").Component<DatePickerProps, {}, "value" | "open">;
3
+ type DatePicker = ReturnType<typeof DatePicker>;
4
+ export default DatePicker;
@@ -0,0 +1 @@
1
+ export { default as DatePicker } from './date-picker.root.svelte';
@@ -0,0 +1 @@
1
+ export { default as DatePicker } from './date-picker.root.svelte';
@@ -0,0 +1,45 @@
1
+ import type { DatePickerContentProps, DatePickerInputProps, DatePickerRootProps, DatePickerTriggerProps } from '../../primitives/date-picker/types.js';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { CalendarCaptionLayout } from '../calendar/types.js';
4
+ export type DatePickerFormatValue = (value: DateValue | undefined) => string;
5
+ export type DatePickerProps = Omit<DatePickerRootProps, 'children' | 'child' | 'placeholder'> & {
6
+ /**
7
+ * Formatter used to render the selected date in the trigger label.
8
+ * Receives the current value and returns the string shown to the user.
9
+ * Defaults to a medium-style locale formatter.
10
+ */
11
+ formatValue?: DatePickerFormatValue;
12
+ /**
13
+ * When true, renders a segmented date input (day/month/year) alongside a
14
+ * calendar icon button trigger. When false (default), renders a single
15
+ * Select-style trigger button that shows the formatted value.
16
+ */
17
+ enableSegments?: boolean;
18
+ /**
19
+ * How the calendar caption is rendered inside the popover.
20
+ * - `'label'` – formatted month + year heading (default)
21
+ * - `'dropdown'` – month and year selects
22
+ * - `'dropdown-months'` – month select + formatted year
23
+ * - `'dropdown-years'` – formatted month + year select
24
+ */
25
+ captionLayout?: CalendarCaptionLayout;
26
+ /** Placeholder shown in the trigger when no value is selected. */
27
+ placeholder?: string;
28
+ /** Form field name. Only emitted when `enableSegments` is true. */
29
+ name?: string;
30
+ /** Disable rendering the popover into a portal. */
31
+ disabledPortal?: boolean;
32
+ /** Style overrides forwarded to the trigger primitive. */
33
+ triggerVariant?: DatePickerTriggerProps['variant'];
34
+ triggerSize?: DatePickerTriggerProps['size'];
35
+ triggerRounded?: DatePickerTriggerProps['rounded'];
36
+ triggerFullWidth?: DatePickerTriggerProps['fullWidth'];
37
+ triggerClass?: string;
38
+ triggerProps?: Omit<DatePickerTriggerProps, 'class' | 'children' | 'child' | 'ref' | 'variant' | 'size' | 'rounded' | 'fullWidth'>;
39
+ /** Style overrides forwarded to the segmented input wrapper. */
40
+ inputClass?: string;
41
+ inputProps?: Omit<DatePickerInputProps, 'class' | 'children' | 'child' | 'ref' | 'name'>;
42
+ /** Style overrides forwarded to the popover content. */
43
+ contentClass?: string;
44
+ contentProps?: Omit<DatePickerContentProps, 'class' | 'children' | 'child' | 'ref'>;
45
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,10 @@
1
1
  export * from './breadcrumb/index.js';
2
+ export * from './calendar/index.js';
2
3
  export * from './collapsible/index.js';
3
4
  export * from './combobox/index.js';
4
5
  export * from './command/index.js';
5
6
  export * from './data-table/index.js';
7
+ export * from './date-picker/index.js';
6
8
  export * from './dialog/index.js';
7
9
  export * from './drawer/index.js';
8
10
  export * from './dropdown/index.js';
@@ -1,8 +1,10 @@
1
1
  export * from './breadcrumb/index.js';
2
+ export * from './calendar/index.js';
2
3
  export * from './collapsible/index.js';
3
4
  export * from './combobox/index.js';
4
5
  export * from './command/index.js';
5
6
  export * from './data-table/index.js';
7
+ export * from './date-picker/index.js';
6
8
  export * from './dialog/index.js';
7
9
  export * from './drawer/index.js';
8
10
  export * from './dropdown/index.js';
@@ -5,5 +5,5 @@ export declare function cn(...inputs: CnOptions): string;
5
5
  export declare const tv: TV;
6
6
  export declare const numberToPx: (value: number) => string;
7
7
  export declare const numberToRem: (value: number, base?: number) => string;
8
- export type WithVariants<TSource extends Record<string, any>, TVariants extends VariantProps<any>> = TSource & Without<TVariants, TSource>;
8
+ export type WithVariants<TSource extends Record<string, unknown>, TStyles extends VariantProps<any>> = TSource & Without<TStyles, TSource>;
9
9
  export type { VariantProps };
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { calendarBodyVariants } from '../styles.js';
4
+ import type { CalendarBodyProps } from '../types.js';
5
+
6
+ let { ref = $bindable(null), class: className, child, children, ...restProps }: CalendarBodyProps = $props();
7
+
8
+ const sharedProps = $derived({
9
+ class: cn(calendarBodyVariants(), className),
10
+ ...restProps,
11
+ });
12
+ </script>
13
+
14
+ {#if child}
15
+ {@render child?.({ props: sharedProps })}
16
+ {:else}
17
+ <div bind:this={ref} {...sharedProps}>
18
+ {@render children?.()}
19
+ </div>
20
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { CalendarBodyProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarBodyProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarCellVariants } from '../styles.js';
5
+ import type { CalendarCellProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarCellProps = $props();
8
+ </script>
9
+
10
+ <Primitive.Cell bind:ref class={cn(calendarCellVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarCellProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarCellProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarDayVariants } from '../styles.js';
5
+ import type { CalendarDayProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarDayProps = $props();
8
+ </script>
9
+
10
+ <Primitive.Day bind:ref class={cn(calendarDayVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarDayProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarDayProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarGridBodyVariants } from '../styles.js';
5
+ import type { CalendarGridBodyProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarGridBodyProps = $props();
8
+ </script>
9
+
10
+ <Primitive.GridBody bind:ref class={cn(calendarGridBodyVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarGridBodyProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarGridBodyProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarGridHeadVariants } from '../styles.js';
5
+ import type { CalendarGridHeadProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarGridHeadProps = $props();
8
+ </script>
9
+
10
+ <Primitive.GridHead bind:ref class={cn(calendarGridHeadVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarGridHeadProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarGridHeadProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarGridRowVariants } from '../styles.js';
5
+ import type { CalendarGridRowProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarGridRowProps = $props();
8
+ </script>
9
+
10
+ <Primitive.GridRow bind:ref class={cn(calendarGridRowVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarGridRowProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarGridRowProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarGridVariants } from '../styles.js';
5
+ import type { CalendarGridProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarGridProps = $props();
8
+ </script>
9
+
10
+ <Primitive.Grid bind:ref class={cn(calendarGridVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarGridProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarGridProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarHeadCellVariants } from '../styles.js';
5
+ import type { CalendarHeadCellProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarHeadCellProps = $props();
8
+ </script>
9
+
10
+ <Primitive.HeadCell bind:ref class={cn(calendarHeadCellVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarHeadCellProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarHeadCellProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarHeaderVariants } from '../styles.js';
5
+ import type { CalendarHeaderProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarHeaderProps = $props();
8
+ </script>
9
+
10
+ <Primitive.Header bind:ref class={cn(calendarHeaderVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarHeaderProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarHeaderProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/tailwindcss.js';
3
+ import { Calendar as Primitive } from 'bits-ui';
4
+ import { calendarHeadingVariants } from '../styles.js';
5
+ import type { CalendarHeadingProps } from '../types.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarHeadingProps = $props();
8
+ </script>
9
+
10
+ <Primitive.Heading bind:ref class={cn(calendarHeadingVariants(), className)} {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { CalendarHeadingProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarHeadingProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -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 { CalendarMonthSelectProps } from '../types.js';
7
+
8
+ let { ref = $bindable(null), class: className, ...restProps }: CalendarMonthSelectProps = $props();
9
+ </script>
10
+
11
+ <Primitive.MonthSelect bind:ref class={cn(className)} {...restProps}>
12
+ {#snippet child({ monthItems, selectedMonthItem, props })}
13
+ <Select.Root
14
+ type="single"
15
+ value={String(selectedMonthItem.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:min-w-28 cgui:shrink">
24
+ {selectedMonthItem.label}
25
+ </Select.Trigger>
26
+ <Select.Content class="cgui:max-h-40">
27
+ <Select.Viewport>
28
+ {#each monthItems as monthItem, i (i)}
29
+ <Select.Item value={monthItem.value.toString()}>
30
+ {monthItem.label}
31
+ </Select.Item>
32
+ {/each}
33
+ </Select.Viewport>
34
+ </Select.Content>
35
+ </Select.Root>
36
+ {/snippet}
37
+ </Primitive.MonthSelect>
@@ -0,0 +1,4 @@
1
+ import { Calendar as Primitive } from 'bits-ui';
2
+ declare const Calendar: import("svelte").Component<Omit<Omit<Primitive.MonthSelectProps, "child">, "children">, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import { Icon } from '../../../atomic/icons/index.js';
3
+ import { cn } from '../../../internal/utils/tailwindcss.js';
4
+ import { Calendar as Primitive } from 'bits-ui';
5
+ import { mergeProps } from 'svelte-toolbelt';
6
+ import { calendarHeaderButtonVariants } from '../styles.js';
7
+ import type { CalendarNextButtonProps } from '../types.js';
8
+
9
+ let { class: className, children, ref = $bindable(null), child, ...restProps }: CalendarNextButtonProps = $props();
10
+
11
+ const classNames = $derived(cn(calendarHeaderButtonVariants(), className));
12
+
13
+ const mergedProps = $derived(mergeProps(restProps, { class: classNames }));
14
+ </script>
15
+
16
+ {#if child}
17
+ {@render child?.({ props: mergedProps })}
18
+ {:else}
19
+ <Primitive.NextButton bind:ref {...mergedProps}>
20
+ {#if children}
21
+ {@render children?.()}
22
+ {:else}
23
+ <Icon.ChevronRight />
24
+ {/if}
25
+ </Primitive.NextButton>
26
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { CalendarNextButtonProps } from '../types.js';
2
+ declare const Calendar: import("svelte").Component<CalendarNextButtonProps, {}, "ref">;
3
+ type Calendar = ReturnType<typeof Calendar>;
4
+ export default Calendar;