@sjvair/monitor-map 3.0.3 → 3.0.5
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/lib/LoadScreen.svelte +68 -0
- package/dist/lib/LoadScreen.svelte.d.ts +25 -0
- package/dist/lib/MainMapView.svelte +1 -0
- package/dist/lib/MainMapView.svelte.d.ts +26 -0
- package/dist/lib/MapLegend.svelte +15 -0
- package/dist/lib/MapLegend.svelte.d.ts +18 -0
- package/dist/lib/MonitorDetailPanel.svelte +152 -0
- package/dist/lib/MonitorDetailPanel.svelte.d.ts +3 -0
- package/dist/lib/MonitorMapLayout.svelte +193 -0
- package/dist/lib/MonitorMapLayout.svelte.d.ts +7 -0
- package/dist/lib/actions.d.ts +3 -0
- package/dist/lib/actions.js +12 -8
- package/dist/lib/assets/icons/adjustment-horizontal.svg +3 -0
- package/dist/lib/assets/logos/airgradient-blue.svg +63 -0
- package/dist/lib/assets/logos/airnow-compact.jpg +0 -0
- package/dist/lib/assets/logos/carb-compact.jpg +0 -0
- package/dist/lib/assets/logos/purpleair-compact.png +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-air.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-icon.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-sjv.webp +0 -0
- package/dist/lib/assets/logos/sjvair-white.svg +115 -0
- package/dist/lib/assets/logos/sjvair.svg +96 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte +98 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocation-utils.d.ts +3 -0
- package/dist/lib/collocation-sites/collocation-utils.js +30 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.js +17 -20
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.d.ts +18 -0
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +98 -83
- package/dist/lib/collocation-sites/collocations.svelte.d.ts +9 -0
- package/dist/lib/collocation-sites/collocations.svelte.js +17 -26
- package/dist/lib/collocation-sites/types.d.ts +8 -0
- package/dist/lib/collocation-sites/types.js +1 -0
- package/dist/lib/colors.d.ts +17 -0
- package/dist/lib/colors.js +29 -23
- package/dist/lib/components/DataBox.svelte +29 -0
- package/dist/lib/components/DataBox.svelte.d.ts +9 -0
- package/dist/lib/components/DisplayOption.svelte +7 -0
- package/dist/lib/components/DisplayOption.svelte.d.ts +5 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte +42 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/components/SegmentedControl.svelte +61 -0
- package/dist/lib/components/SegmentedControl.svelte.d.ts +11 -0
- package/dist/lib/components/ToggleSwitch.svelte +93 -0
- package/dist/lib/components/ToggleSwitch.svelte.d.ts +9 -0
- package/dist/lib/components/ui/button/button.svelte +89 -0
- package/dist/lib/components/ui/button/button.svelte.d.ts +70 -0
- package/dist/lib/components/ui/button/index.d.ts +2 -0
- package/dist/lib/components/ui/button/index.js +4 -0
- package/dist/lib/components/ui/range-calendar/index.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/index.js +21 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte +76 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte +44 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte +15 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte +43 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte +112 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte.d.ts +21 -0
- package/dist/lib/data-chart/DataChart.svelte +303 -0
- package/dist/lib/data-chart/DataChart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/DateRange.d.ts +6 -0
- package/dist/lib/data-chart/DateRange.js +15 -14
- package/dist/lib/data-chart/chart-utils.d.ts +3 -0
- package/dist/lib/data-chart/chart-utils.js +157 -93
- package/dist/lib/data-chart/data-chart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/data-chart.svelte.js +7 -28
- package/dist/lib/data-chart/requests.d.ts +3 -0
- package/dist/lib/data-chart/requests.js +36 -28
- package/dist/lib/data-chart/tooltip.d.ts +10 -0
- package/dist/lib/data-chart/tooltip.js +160 -98
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte +16 -0
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte +127 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte +46 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/ev-stations/data-maps.d.ts +5 -0
- package/dist/lib/ev-stations/data-maps.js +152 -4
- package/dist/lib/ev-stations/ev-station-icons.d.ts +16 -0
- package/dist/lib/ev-stations/ev-station-icons.js +21 -27
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.d.ts +19 -0
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.js +130 -117
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.d.ts +31 -0
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.js +206 -180
- package/dist/lib/ev-stations/ev-stations.svelte.d.ts +9 -0
- package/dist/lib/ev-stations/ev-stations.svelte.js +54 -32
- package/dist/lib/ev-stations/types.d.ts +53 -0
- package/dist/lib/ev-stations/types.js +1 -0
- package/dist/lib/ev-stations/zip-codes.d.ts +13 -0
- package/dist/lib/ev-stations/zip-codes.js +457 -135
- package/dist/lib/hms/components/HMSFireLegend.svelte +21 -0
- package/dist/lib/hms/components/HMSFireLegend.svelte.d.ts +18 -0
- package/dist/lib/hms/hms-fire-icon-manager.d.ts +5 -0
- package/dist/lib/hms/hms-fire-icon-manager.js +28 -37
- package/dist/lib/hms/hms-fire-map-integration.svelte.d.ts +23 -0
- package/dist/lib/hms/hms-fire-map-integration.svelte.js +94 -97
- package/dist/lib/hms/hms-smoke-map-integration.svelte.d.ts +19 -0
- package/dist/lib/hms/hms-smoke-map-integration.svelte.js +68 -84
- package/dist/lib/hms/hms.svelte.d.ts +19 -0
- package/dist/lib/hms/hms.svelte.js +225 -76
- package/dist/lib/index.d.ts +68 -0
- package/dist/lib/index.js +56 -21
- package/dist/lib/map/Map.svelte +13 -0
- package/dist/lib/map/Map.svelte.d.ts +8 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte +61 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/map/Menu.svelte +64 -0
- package/dist/lib/map/Menu.svelte.d.ts +5 -0
- package/dist/lib/map/icons.d.ts +7 -0
- package/dist/lib/map/icons.js +24 -22
- package/dist/lib/map/integrations/base-layer-seperator.d.ts +9 -0
- package/dist/lib/map/integrations/base-layer-seperator.js +11 -12
- package/dist/lib/map/integrations/click-manager.d.ts +14 -0
- package/dist/lib/map/integrations/click-manager.js +52 -33
- package/dist/lib/map/integrations/integrations-manager.d.ts +8 -0
- package/dist/lib/map/integrations/integrations-manager.js +20 -12
- package/dist/lib/map/integrations/map-display-option.svelte.d.ts +7 -0
- package/dist/lib/map/integrations/map-display-option.svelte.js +10 -18
- package/dist/lib/map/integrations/map-geojson-integration.svelte.d.ts +13 -0
- package/dist/lib/map/integrations/map-geojson-integration.svelte.js +21 -17
- package/dist/lib/map/integrations/map-icon-manager.d.ts +15 -0
- package/dist/lib/map/integrations/map-icon-manager.js +52 -46
- package/dist/lib/map/integrations/map-integration.svelte.d.ts +6 -0
- package/dist/lib/map/integrations/map-integration.svelte.js +2 -5
- package/dist/lib/map/integrations/map-layer-integration.svelte.d.ts +11 -0
- package/dist/lib/map/integrations/map-layer-integration.svelte.js +36 -23
- package/dist/lib/map/integrations/tooltip.svelte.d.ts +28 -0
- package/dist/lib/map/integrations/tooltip.svelte.js +120 -78
- package/dist/lib/map/integrations/types.d.ts +14 -0
- package/dist/lib/map/integrations/types.js +1 -0
- package/dist/lib/map/map.svelte.d.ts +14 -0
- package/dist/lib/map/map.svelte.js +48 -50
- package/dist/lib/map/utils.d.ts +7 -0
- package/dist/lib/map/utils.js +32 -29
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte +112 -0
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte +41 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte.d.ts +3 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +128 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte +61 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte +100 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte +79 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/monitors/monitor-utils.d.ts +4 -0
- package/dist/lib/monitors/monitor-utils.js +33 -23
- package/dist/lib/monitors/monitors-cluster-renderer.d.ts +33 -0
- package/dist/lib/monitors/monitors-cluster-renderer.js +218 -209
- package/dist/lib/monitors/monitors-icon-manager.svelte.d.ts +13 -0
- package/dist/lib/monitors/monitors-icon-manager.svelte.js +75 -70
- package/dist/lib/monitors/monitors-map-integration.svelte.d.ts +40 -0
- package/dist/lib/monitors/monitors-map-integration.svelte.js +278 -270
- package/dist/lib/monitors/monitors.svelte.d.ts +16 -0
- package/dist/lib/monitors/monitors.svelte.js +38 -63
- package/dist/lib/monitors/types.d.ts +26 -0
- package/dist/lib/monitors/types.js +1 -0
- package/dist/lib/reactivity.svelte.d.ts +0 -0
- package/dist/lib/reactivity.svelte.js +83 -0
- package/dist/lib/router-context.d.ts +27 -0
- package/dist/lib/router-context.js +11 -11
- package/dist/lib/routes.d.ts +2 -0
- package/dist/lib/routes.js +10 -9
- package/dist/lib/search/Search.svelte +189 -0
- package/dist/lib/search/Search.svelte.d.ts +3 -0
- package/dist/lib/search/service.d.ts +17 -0
- package/dist/lib/search/service.js +75 -85
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.js +10 -12
- package/dist/lib/weather.d.ts +1 -0
- package/dist/lib/weather.js +11 -7
- package/dist/lib/wind/wind.svelte.d.ts +10 -0
- package/dist/lib/wind/wind.svelte.js +13 -21
- package/package.json +9 -7
- package/src/lib/LoadScreen.svelte +3 -3
- package/src/lib/hms/components/HMSFireLegend.svelte +1 -1
- package/src/lib/hms/hms.svelte.ts +8 -9
- package/src/lib/index.ts +18 -0
- package/src/lib/routes.ts +6 -1
- package/src/lib/utils.ts +1 -1
- package/dist/lib/LoadScreen.js +0 -73
- package/dist/lib/MainMapView.js +0 -7
- package/dist/lib/MapLegend.js +0 -13
- package/dist/lib/MonitorDetailPanel.js +0 -169
- package/dist/lib/MonitorMapLayout.js +0 -91
- package/dist/lib/_virtual/_rolldown/runtime.js +0 -11
- package/dist/lib/assets/logos/airgradient-blue.js +0 -4
- package/dist/lib/assets/logos/airnow-compact.js +0 -4
- package/dist/lib/assets/logos/carb-compact.js +0 -4
- package/dist/lib/assets/logos/purpleair-compact.js +0 -4
- package/dist/lib/assets/logos/sjvair.js +0 -4
- package/dist/lib/collocation-sites/CollocationTooltip.js +0 -105
- package/dist/lib/components/DataBox.js +0 -30
- package/dist/lib/components/DisplayOption.js +0 -10
- package/dist/lib/components/MapLayersDisplayOptions.js +0 -87
- package/dist/lib/components/SegmentedControl.js +0 -37
- package/dist/lib/components/ToggleSwitch.js +0 -17
- package/dist/lib/components/ui/button/button.js +0 -34
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.js +0 -82
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-day.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-header.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.js +0 -61
- package/dist/lib/components/ui/range-calendar/range-calendar-month.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-months.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.js +0 -59
- package/dist/lib/components/ui/range-calendar/range-calendar.js +0 -272
- package/dist/lib/data-chart/DataChart.js +0 -142
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.js +0 -16
- package/dist/lib/ev-stations/components/EvStationTooltip.js +0 -120
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.js +0 -41
- package/dist/lib/hms/components/HMSFireLegend.js +0 -35
- package/dist/lib/map/Map.js +0 -14
- package/dist/lib/map/MapStyleDisplayOptions.js +0 -43
- package/dist/lib/map/Menu.js +0 -44
- package/dist/lib/monitors/components/MonitorClusterTooltip.js +0 -83
- package/dist/lib/monitors/components/MonitorMarkersLegend.js +0 -35
- package/dist/lib/monitors/components/MonitorSubscriptionManager.js +0 -104
- package/dist/lib/monitors/components/MonitorTooltip.js +0 -59
- package/dist/lib/monitors/components/MonitorWidgetModal.js +0 -40
- package/dist/lib/monitors/components/MonitorsDisplayOptions.js +0 -76
- package/dist/lib/search/Search.js +0 -124
- package/dist/lib/sjvair-air.avif +0 -0
- package/dist/lib/sjvair-air.png +0 -0
- package/dist/lib/sjvair-air.webp +0 -0
- package/dist/lib/sjvair-air2.avif +0 -0
- package/dist/lib/sjvair-air2.png +0 -0
- package/dist/lib/sjvair-air2.webp +0 -0
- package/dist/lib/sjvair-icon.avif +0 -0
- package/dist/lib/sjvair-icon.png +0 -0
- package/dist/lib/sjvair-icon.webp +0 -0
- package/dist/lib/sjvair-icon2.avif +0 -0
- package/dist/lib/sjvair-icon2.png +0 -0
- package/dist/lib/sjvair-icon2.webp +0 -0
- package/dist/lib/sjvair-sjv.avif +0 -0
- package/dist/lib/sjvair-sjv.png +0 -0
- package/dist/lib/sjvair-sjv.webp +0 -0
- package/dist/lib/sjvair-sjv2.avif +0 -0
- package/dist/lib/sjvair-sjv2.png +0 -0
- package/dist/lib/sjvair-sjv2.webp +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from "svelte";
|
|
3
|
+
import type RangeCalendar from "./range-calendar.svelte";
|
|
4
|
+
import RangeCalendarMonthSelect from "./range-calendar-month-select.svelte";
|
|
5
|
+
import RangeCalendarYearSelect from "./range-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 RangeCalendar>["captionLayout"];
|
|
20
|
+
months: ComponentProps<typeof RangeCalendarMonthSelect>["months"];
|
|
21
|
+
monthFormat: ComponentProps<typeof RangeCalendarMonthSelect>["monthFormat"];
|
|
22
|
+
years: ComponentProps<typeof RangeCalendarYearSelect>["years"];
|
|
23
|
+
yearFormat: ComponentProps<typeof RangeCalendarYearSelect>["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
|
+
<RangeCalendarMonthSelect
|
|
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
|
+
<RangeCalendarYearSelect {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 RangeCalendar from "./range-calendar.svelte";
|
|
3
|
+
import RangeCalendarMonthSelect from "./range-calendar-month-select.svelte";
|
|
4
|
+
import RangeCalendarYearSelect from "./range-calendar-year-select.svelte";
|
|
5
|
+
import { type DateValue } from "@internationalized/date";
|
|
6
|
+
type $$ComponentProps = {
|
|
7
|
+
captionLayout: ComponentProps<typeof RangeCalendar>["captionLayout"];
|
|
8
|
+
months: ComponentProps<typeof RangeCalendarMonthSelect>["months"];
|
|
9
|
+
monthFormat: ComponentProps<typeof RangeCalendarMonthSelect>["monthFormat"];
|
|
10
|
+
years: ComponentProps<typeof RangeCalendarYearSelect>["years"];
|
|
11
|
+
yearFormat: ComponentProps<typeof RangeCalendarYearSelect>["yearFormat"];
|
|
12
|
+
month: DateValue;
|
|
13
|
+
placeholder: DateValue | undefined;
|
|
14
|
+
locale: string;
|
|
15
|
+
monthIndex: number;
|
|
16
|
+
};
|
|
17
|
+
declare const RangeCalendarCaption: import("svelte").Component<$$ComponentProps, {}, "placeholder">;
|
|
18
|
+
type RangeCalendarCaption = ReturnType<typeof RangeCalendarCaption>;
|
|
19
|
+
export default RangeCalendarCaption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.CellProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.Cell
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
"dark:[&:has([data-range-start])]:hover:bg-accent dark:[&:has([data-range-end])]:hover:bg-accent [&:has([data-range-middle])]:bg-accent dark:[&:has([data-range-middle])]:hover:bg-accent/50 [&:has([data-selected])]:bg-accent relative size-(--cell-size) p-0 text-center text-sm focus-within:z-20 data-[range-middle]:rounded-e-(--cell-radius) [&:first-child[data-selected]_[data-bits-day]]:rounded-s-(--cell-radius) [&:has([data-range-end])]:rounded-e-(--cell-radius) [&:has([data-range-middle])]:rounded-none first:[&:has([data-range-middle])]:rounded-s-(--cell-radius) last:[&:has([data-range-middle])]:rounded-e-(--cell-radius) [&:has([data-range-start])]:rounded-s-(--cell-radius) [&:last-child[data-selected]_[data-bits-day]]:rounded-e-(--cell-radius)",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarCell: import("svelte").Component<RangeCalendarPrimitive.CellProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarCell = ReturnType<typeof RangeCalendarCell>;
|
|
4
|
+
export default RangeCalendarCell;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.DayProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.Day
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
"flex size-(--cell-size) flex-col items-center justify-center gap-1 rounded-(--cell-radius) p-0 leading-none font-normal whitespace-nowrap select-none",
|
|
16
|
+
"not-data-selected:hover:bg-accent/50 not-data-selected:hover:text-accent-foreground",
|
|
17
|
+
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground data-[range-middle]:rounded-none",
|
|
18
|
+
// range Start
|
|
19
|
+
"data-[range-start]:bg-primary data-[range-start]:text-primary-foreground data-[range-start]:hover:text-foreground",
|
|
20
|
+
// range End
|
|
21
|
+
"data-[range-end]:bg-primary data-[range-end]:text-primary-foreground data-[range-end]:hover:text-foreground",
|
|
22
|
+
// Outside months
|
|
23
|
+
"[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground",
|
|
24
|
+
// Disabled
|
|
25
|
+
"data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
26
|
+
// Unavailable
|
|
27
|
+
"data-[unavailable]:line-through",
|
|
28
|
+
"dark:data-[range-middle]:hover:bg-accent/0",
|
|
29
|
+
// focus
|
|
30
|
+
"focus:border-ring focus:ring-ring/50 focus:relative",
|
|
31
|
+
// inner spans
|
|
32
|
+
"[&>span]:text-xs [&>span]:opacity-70",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...restProps}
|
|
36
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarGridBody: import("svelte").Component<RangeCalendarPrimitive.GridBodyProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarGridBody = ReturnType<typeof RangeCalendarGridBody>;
|
|
4
|
+
export default RangeCalendarGridBody;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarGridHead: import("svelte").Component<RangeCalendarPrimitive.GridHeadProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarGridHead = ReturnType<typeof RangeCalendarGridHead>;
|
|
4
|
+
export default RangeCalendarGridHead;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.GridRowProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.GridRow bind:ref class={cn("flex", className)} {...restProps} />
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarGridRow: import("svelte").Component<RangeCalendarPrimitive.GridRowProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarGridRow = ReturnType<typeof RangeCalendarGridRow>;
|
|
4
|
+
export default RangeCalendarGridRow;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.GridProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.Grid
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn("mt-4 flex w-full border-collapse flex-col gap-1", className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarGrid: import("svelte").Component<RangeCalendarPrimitive.GridProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarGrid = ReturnType<typeof RangeCalendarGrid>;
|
|
4
|
+
export default RangeCalendarGrid;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.HeadCellProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.HeadCell
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
"text-muted-foreground w-(--cell-size) rounded-md text-[0.8rem] font-normal",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarHeadCell: import("svelte").Component<RangeCalendarPrimitive.HeadCellProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarHeadCell = ReturnType<typeof RangeCalendarHeadCell>;
|
|
4
|
+
export default RangeCalendarHeadCell;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.HeaderProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.Header
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarHeader: import("svelte").Component<RangeCalendarPrimitive.HeaderProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarHeader = ReturnType<typeof RangeCalendarHeader>;
|
|
4
|
+
export default RangeCalendarHeader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: RangeCalendarPrimitive.HeadingProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RangeCalendarPrimitive.Heading
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn("px-(--cell-size) text-sm font-medium", className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarHeading: import("svelte").Component<RangeCalendarPrimitive.HeadingProps, {}, "ref">;
|
|
3
|
+
type RangeCalendarHeading = ReturnType<typeof RangeCalendarHeading>;
|
|
4
|
+
export default RangeCalendarHeading;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } 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<RangeCalendarPrimitive.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
|
+
<RangeCalendarPrimitive.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
|
|
28
|
+
? monthItem.value === value
|
|
29
|
+
: monthItem.value === selectedMonthItem.value}
|
|
30
|
+
>
|
|
31
|
+
{monthItem.label}
|
|
32
|
+
</option>
|
|
33
|
+
{/each}
|
|
34
|
+
</select>
|
|
35
|
+
<span
|
|
36
|
+
class="[&>svg]:text-muted-foreground flex h-(--cell-size) items-center gap-1 rounded-md ps-2 pe-1 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
>
|
|
39
|
+
{monthItems.find((item) => item.value === value)?.label || selectedMonthItem.label}
|
|
40
|
+
<ChevronDownIcon class={cn("size-4", className)} />
|
|
41
|
+
</span>
|
|
42
|
+
{/snippet}
|
|
43
|
+
</RangeCalendarPrimitive.MonthSelect>
|
|
44
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarMonthSelect: import("svelte").Component<Omit<Omit<RangeCalendarPrimitive.MonthSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type RangeCalendarMonthSelect = ReturnType<typeof RangeCalendarMonthSelect>;
|
|
4
|
+
export default RangeCalendarMonthSelect;
|
|
@@ -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 RangeCalendarMonth: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type RangeCalendarMonth = ReturnType<typeof RangeCalendarMonth>;
|
|
5
|
+
export default RangeCalendarMonth;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
class={cn("relative flex flex-col gap-4 md:flex-row", className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
3
|
+
declare const RangeCalendarMonths: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type RangeCalendarMonths = ReturnType<typeof RangeCalendarMonths>;
|
|
5
|
+
export default RangeCalendarMonths;
|
|
@@ -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 RangeCalendarNav: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type RangeCalendarNav = ReturnType<typeof RangeCalendarNav>;
|
|
5
|
+
export default RangeCalendarNav;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import ChevronRightIcon from "@lucide/svelte/icons/chevron-right";
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from "../button/index.js";
|
|
5
|
+
import { cn } from "../../../utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = "ghost",
|
|
12
|
+
...restProps
|
|
13
|
+
}: RangeCalendarPrimitive.NextButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet Fallback()}
|
|
19
|
+
<ChevronRightIcon class={cn("size-4", className)} />
|
|
20
|
+
{/snippet}
|
|
21
|
+
|
|
22
|
+
<RangeCalendarPrimitive.NextButton
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn(
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180",
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...restProps}
|
|
30
|
+
>
|
|
31
|
+
{#if children}
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
{:else}
|
|
34
|
+
{@render Fallback()}
|
|
35
|
+
{/if}
|
|
36
|
+
</RangeCalendarPrimitive.NextButton>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
import { type ButtonVariant } from "../button/index.js";
|
|
3
|
+
type $$ComponentProps = RangeCalendarPrimitive.NextButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const RangeCalendarNextButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type RangeCalendarNextButton = ReturnType<typeof RangeCalendarNextButton>;
|
|
8
|
+
export default RangeCalendarNextButton;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
3
|
+
import ChevronLeftIcon from "@lucide/svelte/icons/chevron-left";
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from "../button/index.js";
|
|
5
|
+
import { cn } from "../../../utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = "ghost",
|
|
12
|
+
...restProps
|
|
13
|
+
}: RangeCalendarPrimitive.PrevButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet Fallback()}
|
|
19
|
+
<ChevronLeftIcon class={cn("size-4", className)} />
|
|
20
|
+
{/snippet}
|
|
21
|
+
|
|
22
|
+
<RangeCalendarPrimitive.PrevButton
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn(
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180",
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...restProps}
|
|
30
|
+
>
|
|
31
|
+
{#if children}
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
{:else}
|
|
34
|
+
{@render Fallback()}
|
|
35
|
+
{/if}
|
|
36
|
+
</RangeCalendarPrimitive.PrevButton>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
import { type ButtonVariant } from "../button/index.js";
|
|
3
|
+
type $$ComponentProps = RangeCalendarPrimitive.PrevButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const RangeCalendarPrevButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type RangeCalendarPrevButton = ReturnType<typeof RangeCalendarPrevButton>;
|
|
8
|
+
export default RangeCalendarPrevButton;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RangeCalendar as RangeCalendarPrimitive } 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<RangeCalendarPrimitive.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
|
+
<RangeCalendarPrimitive.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
|
|
27
|
+
? yearItem.value === value
|
|
28
|
+
: yearItem.value === selectedYearItem.value}
|
|
29
|
+
>
|
|
30
|
+
{yearItem.label}
|
|
31
|
+
</option>
|
|
32
|
+
{/each}
|
|
33
|
+
</select>
|
|
34
|
+
<span
|
|
35
|
+
class="[&>svg]:text-muted-foreground flex h-(--cell-size) items-center gap-1 rounded-md ps-2 pe-1 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
>
|
|
38
|
+
{yearItems.find((item) => item.value === value)?.label || selectedYearItem.label}
|
|
39
|
+
<ChevronDownIcon class={cn("size-4", className)} />
|
|
40
|
+
</span>
|
|
41
|
+
{/snippet}
|
|
42
|
+
</RangeCalendarPrimitive.YearSelect>
|
|
43
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
|
+
declare const RangeCalendarYearSelect: import("svelte").Component<Omit<Omit<RangeCalendarPrimitive.YearSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type RangeCalendarYearSelect = ReturnType<typeof RangeCalendarYearSelect>;
|
|
4
|
+
export default RangeCalendarYearSelect;
|