@flightlesslabs/dodo-ui 0.23.0 → 0.24.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/index.d.ts +0 -10
- package/dist/index.js +1 -10
- package/dist/styles/components.css +0 -154
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +0 -2
- package/package.json +5 -38
- package/src/lib/index.ts +1 -19
- package/src/lib/styles/components.scss +0 -2
- package/dist/components/Form/DatePicker/DatePicker.scss +0 -55
- package/dist/components/Form/DatePicker/DatePicker.svelte +0 -136
- package/dist/components/Form/DatePicker/DatePicker.svelte.d.ts +0 -64
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte.d.ts +0 -23
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte.d.ts +0 -8
- package/dist/components/Form/DatePicker/DatePickerInput/utils.d.ts +0 -10
- package/dist/components/Form/DatePicker/DatePickerInput/utils.js +0 -26
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte.d.ts +0 -6
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte.d.ts +0 -3
- package/dist/components/Info/Calendar/Calendar.scss +0 -147
- package/dist/components/Info/Calendar/Calendar.svelte +0 -61
- package/dist/components/Info/Calendar/Calendar.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte.d.ts +0 -8
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/Header.svelte +0 -25
- package/dist/components/Info/Calendar/Header.svelte.d.ts +0 -3
- package/src/lib/components/Form/DatePicker/DatePicker.scss +0 -55
- package/src/lib/components/Form/DatePicker/DatePicker.svelte +0 -136
- package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/src/lib/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/src/lib/components/Form/DatePicker/DatePickerInput/utils.ts +0 -55
- package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/src/lib/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- package/src/lib/components/Info/Calendar/Calendar.scss +0 -147
- package/src/lib/components/Info/Calendar/Calendar.svelte +0 -61
- package/src/lib/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/src/lib/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/src/lib/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/src/lib/components/Info/Calendar/Header.svelte +0 -25
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
export type DatePickerInputProps = {
|
|
5
|
-
size?: ComponentSize;
|
|
6
|
-
roundness?: ComponentRoundnessShape;
|
|
7
|
-
outline?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
error?: boolean;
|
|
10
|
-
focused?: boolean;
|
|
11
|
-
before?: Snippet;
|
|
12
|
-
after?: Snippet;
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
15
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
dateFormat?: DatePickerFormat;
|
|
18
|
-
};
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<script lang="ts">
|
|
22
|
-
import { DatePicker, type DateFieldInputProps, type DatePickerTriggerProps } from 'bits-ui';
|
|
23
|
-
import type { ComponentSize } from '../../../../attributes/size.js';
|
|
24
|
-
import type { ComponentRoundnessShape } from '../../../../attributes/roundness.js';
|
|
25
|
-
import Icon from '@iconify/svelte';
|
|
26
|
-
import Segments from './Segments.svelte';
|
|
27
|
-
import InputEnclosure from '../../InputEnclosure/InputEnclosure.svelte';
|
|
28
|
-
import type { DatePickerFormat } from './utils.js';
|
|
29
|
-
|
|
30
|
-
let {
|
|
31
|
-
size = 'normal',
|
|
32
|
-
class: className = '',
|
|
33
|
-
disabled = false,
|
|
34
|
-
error = false,
|
|
35
|
-
focused: forcedFocused = false,
|
|
36
|
-
placeholder,
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
-
after,
|
|
39
|
-
dateFieldInputProps,
|
|
40
|
-
datePickerTriggerProps,
|
|
41
|
-
dateFormat = 'dd/mm/yyyy',
|
|
42
|
-
...restProps
|
|
43
|
-
}: DatePickerInputProps = $props();
|
|
44
|
-
|
|
45
|
-
let isFocused = $state(false);
|
|
46
|
-
|
|
47
|
-
function handleFocus() {
|
|
48
|
-
isFocused = true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function handleBlur() {
|
|
52
|
-
isFocused = false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const classes = $derived(['dodo-ui-DatePicker', className].filter(Boolean));
|
|
56
|
-
|
|
57
|
-
const triggerClasses = $derived(
|
|
58
|
-
[
|
|
59
|
-
'dodo-ui-UtilityButton',
|
|
60
|
-
`size--${size}`,
|
|
61
|
-
'compact',
|
|
62
|
-
'color--primary',
|
|
63
|
-
'roundness--full',
|
|
64
|
-
error && 'error',
|
|
65
|
-
disabled && 'disabled',
|
|
66
|
-
].filter(Boolean),
|
|
67
|
-
);
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<InputEnclosure
|
|
71
|
-
{size}
|
|
72
|
-
{disabled}
|
|
73
|
-
{error}
|
|
74
|
-
class={classes.join(' ')}
|
|
75
|
-
focused={forcedFocused || isFocused}
|
|
76
|
-
{...restProps}
|
|
77
|
-
>
|
|
78
|
-
<DatePicker.Input
|
|
79
|
-
onfocus={handleFocus}
|
|
80
|
-
onblur={handleBlur}
|
|
81
|
-
{placeholder}
|
|
82
|
-
class="InputBox"
|
|
83
|
-
{...dateFieldInputProps}
|
|
84
|
-
>
|
|
85
|
-
{#snippet children({ segments })}
|
|
86
|
-
<Segments {segments} {dateFormat} />
|
|
87
|
-
{/snippet}
|
|
88
|
-
</DatePicker.Input>
|
|
89
|
-
|
|
90
|
-
{#snippet after()}
|
|
91
|
-
<DatePicker.Trigger class={triggerClasses.join(' ')} {...datePickerTriggerProps}>
|
|
92
|
-
<Icon icon="material-symbols:calendar-month-sharp" />
|
|
93
|
-
</DatePicker.Trigger>
|
|
94
|
-
{@render after?.()}
|
|
95
|
-
{/snippet}
|
|
96
|
-
</InputEnclosure>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
export type DatePickerInputProps = {
|
|
3
|
-
size?: ComponentSize;
|
|
4
|
-
roundness?: ComponentRoundnessShape;
|
|
5
|
-
outline?: boolean;
|
|
6
|
-
class?: string;
|
|
7
|
-
error?: boolean;
|
|
8
|
-
focused?: boolean;
|
|
9
|
-
before?: Snippet;
|
|
10
|
-
after?: Snippet;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
13
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
dateFormat?: DatePickerFormat;
|
|
16
|
-
};
|
|
17
|
-
import { type DateFieldInputProps, type DatePickerTriggerProps } from 'bits-ui';
|
|
18
|
-
import type { ComponentSize } from '../../../../attributes/size.js';
|
|
19
|
-
import type { ComponentRoundnessShape } from '../../../../attributes/roundness.js';
|
|
20
|
-
import type { DatePickerFormat } from './utils.js';
|
|
21
|
-
declare const DatePickerInput: import("svelte").Component<DatePickerInputProps, {}, "">;
|
|
22
|
-
type DatePickerInput = ReturnType<typeof DatePickerInput>;
|
|
23
|
-
export default DatePickerInput;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { DatePicker } from 'bits-ui';
|
|
3
|
-
import { formatSegments, type DatePickerFormat, type DateSegment } from './utils.js';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
segments: DateSegment[];
|
|
7
|
-
dateFormat: DatePickerFormat;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let { segments, dateFormat }: Props = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
{#each formatSegments(segments, dateFormat) as { part, value }, i (part + i)}
|
|
14
|
-
<DatePicker.Segment {part}>
|
|
15
|
-
{value}
|
|
16
|
-
</DatePicker.Segment>
|
|
17
|
-
{/each}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type DatePickerFormat, type DateSegment } from './utils.js';
|
|
2
|
-
type Props = {
|
|
3
|
-
segments: DateSegment[];
|
|
4
|
-
dateFormat: DatePickerFormat;
|
|
5
|
-
};
|
|
6
|
-
declare const Segments: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type Segments = ReturnType<typeof Segments>;
|
|
8
|
-
export default Segments;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SegmentPart } from 'bits-ui';
|
|
2
|
-
export type DateSegment = {
|
|
3
|
-
part: SegmentPart;
|
|
4
|
-
value: string;
|
|
5
|
-
};
|
|
6
|
-
export type FormatToken = 'dd' | 'mm' | 'yyyy' | 'hh' | 'min' | 'ss';
|
|
7
|
-
type Separator = '/' | '-' | '.' | ' ';
|
|
8
|
-
export type DatePickerFormat = `${FormatToken}${Separator}${FormatToken}${Separator}${FormatToken}` | `${FormatToken}${Separator}${FormatToken}` | `${FormatToken}`;
|
|
9
|
-
export declare function formatSegments(segments: DateSegment[], format: DatePickerFormat): DateSegment[];
|
|
10
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// ---- Formatter ----
|
|
2
|
-
export function formatSegments(segments, format) {
|
|
3
|
-
const segmentMap = Object.fromEntries(segments.map((s) => [s.part, s]));
|
|
4
|
-
const tokens = format.match(/dd|mm|yyyy|hh|min|ss|./g) ?? [];
|
|
5
|
-
return tokens.map((token) => {
|
|
6
|
-
switch (token) {
|
|
7
|
-
case 'dd':
|
|
8
|
-
return segmentMap.day ?? { part: 'day', value: '' };
|
|
9
|
-
case 'mm':
|
|
10
|
-
return segmentMap.month ?? { part: 'month', value: '' };
|
|
11
|
-
case 'yyyy':
|
|
12
|
-
return segmentMap.year ?? { part: 'year', value: '' };
|
|
13
|
-
case 'hh':
|
|
14
|
-
return segmentMap.hour ?? { part: 'hour', value: '' };
|
|
15
|
-
case 'min':
|
|
16
|
-
return segmentMap.minute ?? { part: 'minute', value: '' };
|
|
17
|
-
case 'ss':
|
|
18
|
-
return segmentMap.second ?? { part: 'second', value: '' };
|
|
19
|
-
default:
|
|
20
|
-
return {
|
|
21
|
-
part: 'literal',
|
|
22
|
-
value: token,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { DatePicker, type CalendarRootSnippetProps } from 'bits-ui';
|
|
3
|
-
|
|
4
|
-
let { months, weekdays }: CalendarRootSnippetProps = $props();
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div class="CalendarGrid">
|
|
8
|
-
{#each months as month (month.value)}
|
|
9
|
-
<DatePicker.Grid>
|
|
10
|
-
<DatePicker.GridHead>
|
|
11
|
-
<DatePicker.GridRow>
|
|
12
|
-
{#each weekdays as day (day)}
|
|
13
|
-
<DatePicker.HeadCell>
|
|
14
|
-
<div>{day.slice(0, 2)}</div>
|
|
15
|
-
</DatePicker.HeadCell>
|
|
16
|
-
{/each}
|
|
17
|
-
</DatePicker.GridRow>
|
|
18
|
-
</DatePicker.GridHead>
|
|
19
|
-
<DatePicker.GridBody>
|
|
20
|
-
{#each month.weeks as weekDates (weekDates)}
|
|
21
|
-
<DatePicker.GridRow>
|
|
22
|
-
{#each weekDates as date (date)}
|
|
23
|
-
<DatePicker.Cell {date} month={month.value}>
|
|
24
|
-
<DatePicker.Day>
|
|
25
|
-
<div></div>
|
|
26
|
-
{date.day}
|
|
27
|
-
</DatePicker.Day>
|
|
28
|
-
</DatePicker.Cell>
|
|
29
|
-
{/each}
|
|
30
|
-
</DatePicker.GridRow>
|
|
31
|
-
{/each}
|
|
32
|
-
</DatePicker.GridBody>
|
|
33
|
-
</DatePicker.Grid>
|
|
34
|
-
{/each}
|
|
35
|
-
</div>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CardProps } from '../../../Layout/Card/Card.svelte';
|
|
3
|
-
import { useThemeContext } from '../../../Layout/Theme/ThemeSystem/context.js';
|
|
4
|
-
|
|
5
|
-
export type DatePickerPopupProps = DatePickerContentProps & Omit<CardProps, 'children' | 'ref'>;
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
import { DatePicker, type DatePickerContentProps } from 'bits-ui';
|
|
10
|
-
import Header from './Header.svelte';
|
|
11
|
-
import CalendarGrid from './CalendarGrid.svelte';
|
|
12
|
-
let {
|
|
13
|
-
roundness = 1,
|
|
14
|
-
outline = false,
|
|
15
|
-
class: className = '',
|
|
16
|
-
theme: cardTheme,
|
|
17
|
-
color = 'default',
|
|
18
|
-
variant = 'text',
|
|
19
|
-
shadow = 2,
|
|
20
|
-
active = false,
|
|
21
|
-
sideOffset = 10,
|
|
22
|
-
align = 'end',
|
|
23
|
-
...restProps
|
|
24
|
-
}: DatePickerPopupProps = $props();
|
|
25
|
-
|
|
26
|
-
const themeContext = useThemeContext();
|
|
27
|
-
const theme = $derived(cardTheme ? cardTheme : themeContext.theme);
|
|
28
|
-
|
|
29
|
-
const popupClasses = $derived(
|
|
30
|
-
[
|
|
31
|
-
'dodo-ui-Card',
|
|
32
|
-
'dodo-ui-Calendar',
|
|
33
|
-
`color--${color}`,
|
|
34
|
-
`variant--${variant}`,
|
|
35
|
-
`roundness--${roundness}`,
|
|
36
|
-
`dodo-shadow-${shadow}`,
|
|
37
|
-
outline && 'outline',
|
|
38
|
-
active && 'active',
|
|
39
|
-
theme ? `dodo-theme--${theme}` : '',
|
|
40
|
-
className,
|
|
41
|
-
].filter(Boolean),
|
|
42
|
-
);
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<DatePicker.Content class={popupClasses.join(' ')} {...restProps} {sideOffset} {align}>
|
|
46
|
-
<DatePicker.Calendar>
|
|
47
|
-
{#snippet children(calendarRootSnippetProps)}
|
|
48
|
-
<Header />
|
|
49
|
-
<CalendarGrid {...calendarRootSnippetProps} />
|
|
50
|
-
{/snippet}
|
|
51
|
-
</DatePicker.Calendar>
|
|
52
|
-
</DatePicker.Content>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CardProps } from '../../../Layout/Card/Card.svelte';
|
|
2
|
-
export type DatePickerPopupProps = DatePickerContentProps & Omit<CardProps, 'children' | 'ref'>;
|
|
3
|
-
import { type DatePickerContentProps } from 'bits-ui';
|
|
4
|
-
declare const DatePickerPopup: import("svelte").Component<DatePickerPopupProps, {}, "">;
|
|
5
|
-
type DatePickerPopup = ReturnType<typeof DatePickerPopup>;
|
|
6
|
-
export default DatePickerPopup;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Icon from '@iconify/svelte';
|
|
3
|
-
import { DatePicker } from 'bits-ui';
|
|
4
|
-
|
|
5
|
-
const triggerClasses = $derived(
|
|
6
|
-
[
|
|
7
|
-
'dodo-ui-Button',
|
|
8
|
-
'compact',
|
|
9
|
-
'size--normal',
|
|
10
|
-
'variant--text',
|
|
11
|
-
'color--primary',
|
|
12
|
-
'roundness--1',
|
|
13
|
-
].filter(Boolean),
|
|
14
|
-
);
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<DatePicker.Header>
|
|
18
|
-
<DatePicker.PrevButton class={triggerClasses.join(' ')}>
|
|
19
|
-
<Icon icon="material-symbols:chevron-left-rounded" />
|
|
20
|
-
</DatePicker.PrevButton>
|
|
21
|
-
<DatePicker.Heading />
|
|
22
|
-
<DatePicker.NextButton class={triggerClasses.join(' ')}>
|
|
23
|
-
<Icon icon="material-symbols:chevron-right-rounded" />
|
|
24
|
-
</DatePicker.NextButton>
|
|
25
|
-
</DatePicker.Header>
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
@use '../../../styles/global/breakpoints' as breakpoints;
|
|
2
|
-
|
|
3
|
-
// ----------------------------------------
|
|
4
|
-
// Theme tokens (global CSS variables)
|
|
5
|
-
// ----------------------------------------
|
|
6
|
-
:root {
|
|
7
|
-
--dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-500);
|
|
8
|
-
--dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-600);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dodo-theme--dark {
|
|
12
|
-
--dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-300);
|
|
13
|
-
--dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-400);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dodo-ui-Calendar {
|
|
17
|
-
font-size: 1rem;
|
|
18
|
-
color: var(--dodo-color-neutral-900);
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
|
|
22
|
-
@include breakpoints.up('sm') {
|
|
23
|
-
padding: var(--dodo-ui-space);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[data-calendar-header] {
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: space-between;
|
|
29
|
-
align-items: center;
|
|
30
|
-
padding: 0 calc(var(--dodo-ui-space) / 2);
|
|
31
|
-
margin-bottom: calc(var(--dodo-ui-space) * 2);
|
|
32
|
-
margin-top: var(--dodo-ui-space);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-calendar-heading] {
|
|
36
|
-
margin: 0 calc(var(--dodo-ui-space) / 2);
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
button[data-calendar-next-button],
|
|
41
|
-
button[data-calendar-prev-button] {
|
|
42
|
-
font-size: 1.4em;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
[data-calendar-grid] {
|
|
46
|
-
width: 100%;
|
|
47
|
-
user-select: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
[data-calendar-grid-row] {
|
|
51
|
-
display: flex;
|
|
52
|
-
width: 100%;
|
|
53
|
-
justify-content: space-around;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
[data-calendar-grid-head] {
|
|
57
|
-
margin-bottom: var(--dodo-ui-space);
|
|
58
|
-
display: block;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[data-calendar-head-cell] {
|
|
62
|
-
display: inline-flex;
|
|
63
|
-
width: var(--dodo-ui-element-height-normal);
|
|
64
|
-
justify-content: center;
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
color: var(--dodo-color-neutral-600);
|
|
67
|
-
font-size: 0.9rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
[data-calendar-cell] {
|
|
71
|
-
display: inline-flex;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
[data-calendar-day] {
|
|
75
|
-
transition:
|
|
76
|
-
background-color 70ms,
|
|
77
|
-
color 70ms,
|
|
78
|
-
border-color 70ms;
|
|
79
|
-
display: inline-flex;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
align-items: center;
|
|
82
|
-
width: var(--dodo-ui-element-height-normal);
|
|
83
|
-
height: var(--dodo-ui-element-height-normal);
|
|
84
|
-
border-radius: var(--dodo-ui-element-roundness-1);
|
|
85
|
-
border: var(--dodo-ui-element-border-width) solid transparent;
|
|
86
|
-
position: relative;
|
|
87
|
-
|
|
88
|
-
&:hover {
|
|
89
|
-
background-color: var(--dodo-color-neutral-100);
|
|
90
|
-
border-color: var(--dodo-color-neutral-400);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&[data-selected] {
|
|
94
|
-
background-color: var(--dodo-ui-Calendar-date-selected-bg);
|
|
95
|
-
color: var(--dodo-color-constant-white);
|
|
96
|
-
|
|
97
|
-
&:hover {
|
|
98
|
-
background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&[data-today] {
|
|
102
|
-
background-color: var(--dodo-ui-Calendar-date-selected-bg);
|
|
103
|
-
color: var(--dodo-color-constant-white);
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
&::after {
|
|
110
|
-
background-color: var(--dodo-color-constant-white);
|
|
111
|
-
|
|
112
|
-
&:hover {
|
|
113
|
-
background-color: var(--dodo-color-constant-white);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&[data-today] {
|
|
120
|
-
background-color: var(--dodo-color-primary-50);
|
|
121
|
-
&::after {
|
|
122
|
-
content: '';
|
|
123
|
-
width: var(--dodo-ui-track-element-height-small);
|
|
124
|
-
height: var(--dodo-ui-track-element-height-small);
|
|
125
|
-
border-radius: 50%;
|
|
126
|
-
display: inline-flex;
|
|
127
|
-
background-color: var(--dodo-color-primary-600);
|
|
128
|
-
position: absolute;
|
|
129
|
-
bottom: 0.2em;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
&[data-outside-month],
|
|
134
|
-
&[data-disabled] {
|
|
135
|
-
color: var(--dodo-color-neutral-400);
|
|
136
|
-
|
|
137
|
-
&:hover {
|
|
138
|
-
background-color: initial;
|
|
139
|
-
border-color: transparent;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&[data-today] {
|
|
143
|
-
background-color: initial;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CardProps } from '../../Layout/Card/Card.svelte';
|
|
3
|
-
import { useThemeContext } from '../../Layout/Theme/ThemeSystem/context.js';
|
|
4
|
-
|
|
5
|
-
export type CalendarProps = Omit<CalendarSingleRootProps, 'type'> &
|
|
6
|
-
Omit<CardProps, 'children' | 'ref'>;
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
import { Calendar as CalendarBitsUi, type CalendarSingleRootProps } from 'bits-ui';
|
|
11
|
-
import Header from './Header.svelte';
|
|
12
|
-
import CalendarGrid from './CalendarGrid/CalendarGrid.svelte';
|
|
13
|
-
let {
|
|
14
|
-
roundness = 1,
|
|
15
|
-
outline = true,
|
|
16
|
-
class: className = '',
|
|
17
|
-
theme: cardTheme,
|
|
18
|
-
color = 'default',
|
|
19
|
-
variant = 'text',
|
|
20
|
-
shadow = 0,
|
|
21
|
-
active = false,
|
|
22
|
-
weekStartsOn = 1,
|
|
23
|
-
weekdayFormat = 'short',
|
|
24
|
-
fixedWeeks = true,
|
|
25
|
-
value = $bindable(undefined),
|
|
26
|
-
...restProps
|
|
27
|
-
}: CalendarProps = $props();
|
|
28
|
-
|
|
29
|
-
const themeContext = useThemeContext();
|
|
30
|
-
const theme = $derived(cardTheme ? cardTheme : themeContext.theme);
|
|
31
|
-
|
|
32
|
-
const popupClasses = $derived(
|
|
33
|
-
[
|
|
34
|
-
'dodo-ui-Card',
|
|
35
|
-
'dodo-ui-Calendar',
|
|
36
|
-
`color--${color}`,
|
|
37
|
-
`variant--${variant}`,
|
|
38
|
-
`roundness--${roundness}`,
|
|
39
|
-
`dodo-shadow-${shadow}`,
|
|
40
|
-
outline && 'outline',
|
|
41
|
-
active && 'active',
|
|
42
|
-
theme ? `dodo-theme--${theme}` : '',
|
|
43
|
-
className,
|
|
44
|
-
].filter(Boolean),
|
|
45
|
-
);
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<CalendarBitsUi.Root
|
|
49
|
-
{...restProps}
|
|
50
|
-
{weekStartsOn}
|
|
51
|
-
{weekdayFormat}
|
|
52
|
-
{fixedWeeks}
|
|
53
|
-
bind:value
|
|
54
|
-
type="single"
|
|
55
|
-
class={popupClasses.join(' ')}
|
|
56
|
-
>
|
|
57
|
-
{#snippet children(calendarRootSnippetProps)}
|
|
58
|
-
<Header />
|
|
59
|
-
<CalendarGrid {...calendarRootSnippetProps} />
|
|
60
|
-
{/snippet}
|
|
61
|
-
</CalendarBitsUi.Root>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CardProps } from '../../Layout/Card/Card.svelte';
|
|
2
|
-
export type CalendarProps = Omit<CalendarSingleRootProps, 'type'> & Omit<CardProps, 'children' | 'ref'>;
|
|
3
|
-
import { type CalendarSingleRootProps } from 'bits-ui';
|
|
4
|
-
declare const Calendar: import("svelte").Component<CalendarProps, {}, "value">;
|
|
5
|
-
type Calendar = ReturnType<typeof Calendar>;
|
|
6
|
-
export default Calendar;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Calendar, type CalendarRootSnippetProps } from 'bits-ui';
|
|
3
|
-
import TableHead from './TableHead.svelte';
|
|
4
|
-
import TableBody from './TableBody.svelte';
|
|
5
|
-
|
|
6
|
-
let { months, weekdays }: CalendarRootSnippetProps = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div class="CalendarGrid">
|
|
10
|
-
{#each months as month (month.value)}
|
|
11
|
-
<Calendar.Grid>
|
|
12
|
-
<TableHead {weekdays} />
|
|
13
|
-
<TableBody {month} />
|
|
14
|
-
</Calendar.Grid>
|
|
15
|
-
{/each}
|
|
16
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { DateValue } from '@internationalized/date';
|
|
3
|
-
import { Calendar, type Month } from 'bits-ui';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
month: Month<DateValue>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let { month }: Props = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<Calendar.GridBody>
|
|
13
|
-
{#each month.weeks as weekDates (weekDates)}
|
|
14
|
-
<Calendar.GridRow>
|
|
15
|
-
{#each weekDates as date (date)}
|
|
16
|
-
<Calendar.Cell {date} month={month.value}>
|
|
17
|
-
<Calendar.Day>
|
|
18
|
-
<div></div>
|
|
19
|
-
{date.day}
|
|
20
|
-
</Calendar.Day>
|
|
21
|
-
</Calendar.Cell>
|
|
22
|
-
{/each}
|
|
23
|
-
</Calendar.GridRow>
|
|
24
|
-
{/each}
|
|
25
|
-
</Calendar.GridBody>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DateValue } from '@internationalized/date';
|
|
2
|
-
import { type Month } from 'bits-ui';
|
|
3
|
-
type Props = {
|
|
4
|
-
month: Month<DateValue>;
|
|
5
|
-
};
|
|
6
|
-
declare const TableBody: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type TableBody = ReturnType<typeof TableBody>;
|
|
8
|
-
export default TableBody;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Calendar } from 'bits-ui';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
weekdays: string[];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
let { weekdays }: Props = $props();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<Calendar.GridHead>
|
|
12
|
-
<Calendar.GridRow>
|
|
13
|
-
{#each weekdays as day (day)}
|
|
14
|
-
<Calendar.HeadCell>
|
|
15
|
-
<div>{day.slice(0, 2)}</div>
|
|
16
|
-
</Calendar.HeadCell>
|
|
17
|
-
{/each}
|
|
18
|
-
</Calendar.GridRow>
|
|
19
|
-
</Calendar.GridHead>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Icon from '@iconify/svelte';
|
|
3
|
-
import { Calendar } from 'bits-ui';
|
|
4
|
-
|
|
5
|
-
const triggerClasses = $derived(
|
|
6
|
-
[
|
|
7
|
-
'dodo-ui-Button',
|
|
8
|
-
'compact',
|
|
9
|
-
'size--normal',
|
|
10
|
-
'variant--text',
|
|
11
|
-
'color--primary',
|
|
12
|
-
'roundness--1',
|
|
13
|
-
].filter(Boolean),
|
|
14
|
-
);
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Calendar.Header>
|
|
18
|
-
<Calendar.PrevButton class={triggerClasses.join(' ')}>
|
|
19
|
-
<Icon icon="material-symbols:chevron-left-rounded" />
|
|
20
|
-
</Calendar.PrevButton>
|
|
21
|
-
<Calendar.Heading />
|
|
22
|
-
<Calendar.NextButton class={triggerClasses.join(' ')}>
|
|
23
|
-
<Icon icon="material-symbols:chevron-right-rounded" />
|
|
24
|
-
</Calendar.NextButton>
|
|
25
|
-
</Calendar.Header>
|