@leonardaustin/ui 0.25.0 → 0.26.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/README.md +11 -0
- package/dist/components/app-shell/AppShell.d.ts +3 -3
- package/dist/components/app-shell/AppShell.js +82 -0
- package/dist/components/app-shell/AuthLayout.d.ts +3 -3
- package/dist/components/app-shell/AuthLayout.js +16 -0
- package/dist/components/app-shell/BackLink.d.ts +3 -3
- package/dist/components/app-shell/BackLink.js +19 -0
- package/dist/components/app-shell/BottomNav.d.ts +3 -2
- package/dist/components/app-shell/BottomNav.js +37 -0
- package/dist/components/app-shell/Breadcrumbs.d.ts +3 -2
- package/dist/components/app-shell/Breadcrumbs.js +46 -0
- package/dist/components/app-shell/CommandPalette.d.ts +3 -2
- package/dist/components/app-shell/CommandPalette.js +119 -0
- package/dist/components/app-shell/MobileDrawer.d.ts +3 -3
- package/dist/components/app-shell/MobileDrawer.js +128 -0
- package/dist/components/app-shell/Sidebar.d.ts +3 -3
- package/dist/components/app-shell/Sidebar.js +355 -0
- package/dist/components/app-shell/ThemeMenu.d.ts +3 -2
- package/dist/components/app-shell/ThemeMenu.js +273 -0
- package/dist/components/app-shell/TopBar.d.ts +3 -3
- package/dist/components/app-shell/TopBar.js +129 -0
- package/dist/components/app-shell/commandPaletteEvents.js +16 -0
- package/dist/components/app-shell/navigation.js +21 -0
- package/dist/components/app-shell/themeMenuEvents.js +7 -0
- package/dist/components/charts/AreaChart.d.ts +4 -3
- package/dist/components/charts/AreaChart.js +217 -0
- package/dist/components/charts/BarChart.d.ts +4 -3
- package/dist/components/charts/BarChart.js +91 -0
- package/dist/components/charts/DonutChart.d.ts +4 -3
- package/dist/components/charts/DonutChart.js +172 -0
- package/dist/components/charts/RadarChart.d.ts +4 -3
- package/dist/components/charts/RadarChart.js +142 -0
- package/dist/components/charts/RadialBarChart.d.ts +4 -3
- package/dist/components/charts/RadialBarChart.js +219 -0
- package/dist/components/charts/SparkLine.d.ts +4 -3
- package/dist/components/charts/SparkLine.js +39 -0
- package/dist/components/charts/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/StackedBarChart.js +249 -0
- package/dist/components/charts/VerticalBarChart.d.ts +4 -3
- package/dist/components/charts/VerticalBarChart.js +143 -0
- package/dist/components/charts/chartUtils.js +68 -0
- package/dist/components/tables/ColumnPicker.d.ts +3 -3
- package/dist/components/tables/ColumnPicker.js +59 -0
- package/dist/components/tables/Pagination.d.ts +3 -3
- package/dist/components/tables/Pagination.js +56 -0
- package/dist/components/tables/ResourceTable.d.ts +3 -3
- package/dist/components/tables/ResourceTable.js +88 -0
- package/dist/components/tables/Table.js +95 -0
- package/dist/components/tables/sortRows.js +11 -0
- package/dist/components/ui/Accordion.d.ts +2 -1
- package/dist/components/ui/Accordion.js +35 -0
- package/dist/components/ui/Alert.d.ts +3 -2
- package/dist/components/ui/Alert.js +51 -0
- package/dist/components/ui/AttachmentList.d.ts +5 -5
- package/dist/components/ui/AttachmentList.js +90 -0
- package/dist/components/ui/AudioPlayer.d.ts +5 -2
- package/dist/components/ui/AudioPlayer.js +447 -0
- package/dist/components/ui/AuthCard.d.ts +3 -3
- package/dist/components/ui/AuthCard.js +39 -0
- package/dist/components/ui/AuthorByline.d.ts +3 -3
- package/dist/components/ui/AuthorByline.js +23 -0
- package/dist/components/ui/Avatar.d.ts +3 -2
- package/dist/components/ui/Avatar.js +36 -0
- package/dist/components/ui/Badge.d.ts +3 -2
- package/dist/components/ui/Badge.js +47 -0
- package/dist/components/ui/Button.d.ts +3 -3
- package/dist/components/ui/Button.js +83 -0
- package/dist/components/ui/Calendar.d.ts +3 -3
- package/dist/components/ui/Calendar.js +344 -0
- package/dist/components/ui/CalendarGrid.d.ts +3 -2
- package/dist/components/ui/CalendarGrid.js +136 -0
- package/dist/components/ui/Card.d.ts +6 -5
- package/dist/components/ui/Card.js +53 -0
- package/dist/components/ui/CharacterCount.d.ts +3 -3
- package/dist/components/ui/CharacterCount.js +27 -0
- package/dist/components/ui/Checkbox.d.ts +10 -8
- package/dist/components/ui/Checkbox.js +52 -0
- package/dist/components/ui/CodeInput.d.ts +7 -4
- package/dist/components/ui/CodeInput.js +97 -0
- package/dist/components/ui/Combobox.d.ts +8 -6
- package/dist/components/ui/Combobox.js +213 -0
- package/dist/components/ui/CopyButton.d.ts +1 -1
- package/dist/components/ui/CopyButton.js +57 -0
- package/dist/components/ui/DangerZone.d.ts +3 -3
- package/dist/components/ui/DangerZone.js +23 -0
- package/dist/components/ui/DatePartsInput.d.ts +6 -4
- package/dist/components/ui/DatePartsInput.js +138 -0
- package/dist/components/ui/DatePicker.d.ts +9 -4
- package/dist/components/ui/DatePicker.js +84 -0
- package/dist/components/ui/DateRangePicker.d.ts +7 -4
- package/dist/components/ui/DateRangePicker.js +143 -0
- package/dist/components/ui/DateTimePicker.d.ts +7 -4
- package/dist/components/ui/DateTimePicker.js +267 -0
- package/dist/components/ui/DetailPanel.d.ts +3 -3
- package/dist/components/ui/DetailPanel.js +183 -0
- package/dist/components/ui/Dialog.d.ts +3 -3
- package/dist/components/ui/Dialog.js +411 -0
- package/dist/components/ui/DialogActions.d.ts +3 -3
- package/dist/components/ui/DialogActions.js +35 -0
- package/dist/components/ui/Disclosure.d.ts +3 -3
- package/dist/components/ui/Disclosure.js +45 -0
- package/dist/components/ui/DividerLabel.d.ts +3 -3
- package/dist/components/ui/DividerLabel.js +20 -0
- package/dist/components/ui/DropdownMenu.d.ts +3 -3
- package/dist/components/ui/DropdownMenu.js +229 -0
- package/dist/components/ui/EmptyState.d.ts +3 -3
- package/dist/components/ui/EmptyState.js +31 -0
- package/dist/components/ui/ErrorBoundary.js +46 -0
- package/dist/components/ui/FieldContext.js +8 -0
- package/dist/components/ui/Fieldset.d.ts +2 -2
- package/dist/components/ui/Fieldset.js +39 -0
- package/dist/components/ui/FilterButton.d.ts +4 -7
- package/dist/components/ui/FilterButton.js +17 -0
- package/dist/components/ui/FilterDropdown.d.ts +4 -4
- package/dist/components/ui/FilterDropdown.js +18 -0
- package/dist/components/ui/FormField.d.ts +4 -4
- package/dist/components/ui/FormField.js +68 -0
- package/dist/components/ui/Grid.d.ts +1 -1
- package/dist/components/ui/Grid.js +19 -0
- package/dist/components/ui/GridItem.d.ts +1 -1
- package/dist/components/ui/GridItem.js +16 -0
- package/dist/components/ui/Inline.d.ts +1 -1
- package/dist/components/ui/Inline.js +24 -0
- package/dist/components/ui/Kbd.d.ts +3 -2
- package/dist/components/ui/Kbd.js +13 -0
- package/dist/components/ui/ListItemLink.d.ts +3 -3
- package/dist/components/ui/ListItemLink.js +44 -0
- package/dist/components/ui/LoadingSpinner.d.ts +3 -2
- package/dist/components/ui/LoadingSpinner.js +19 -0
- package/dist/components/ui/MessageBubble.d.ts +2 -2
- package/dist/components/ui/MessageBubble.js +41 -0
- package/dist/components/ui/MetadataGrid.d.ts +5 -3
- package/dist/components/ui/MetadataGrid.js +76 -0
- package/dist/components/ui/MetricCard.d.ts +3 -3
- package/dist/components/ui/MetricCard.js +51 -0
- package/dist/components/ui/NavTabs.d.ts +2 -2
- package/dist/components/ui/NavTabs.js +29 -0
- package/dist/components/ui/OAuthButton.d.ts +2 -2
- package/dist/components/ui/OAuthButton.js +55 -0
- package/dist/components/ui/OverlineLabel.d.ts +3 -3
- package/dist/components/ui/OverlineLabel.js +13 -0
- package/dist/components/ui/PageHeader.d.ts +3 -3
- package/dist/components/ui/PageHeader.js +33 -0
- package/dist/components/ui/PageSection.d.ts +3 -3
- package/dist/components/ui/PageSection.js +31 -0
- package/dist/components/ui/PaginationBar.d.ts +3 -3
- package/dist/components/ui/PaginationBar.js +62 -0
- package/dist/components/ui/PasswordInput.d.ts +3 -3
- package/dist/components/ui/PasswordInput.js +62 -0
- package/dist/components/ui/PasswordRequirements.d.ts +3 -2
- package/dist/components/ui/PasswordRequirements.js +34 -0
- package/dist/components/ui/Popover.d.ts +3 -3
- package/dist/components/ui/Popover.js +53 -0
- package/dist/components/ui/ProfileHeader.d.ts +3 -3
- package/dist/components/ui/ProfileHeader.js +54 -0
- package/dist/components/ui/ProgressBar.d.ts +3 -3
- package/dist/components/ui/ProgressBar.js +42 -0
- package/dist/components/ui/ProseContent.d.ts +3 -3
- package/dist/components/ui/ProseContent.js +13 -0
- package/dist/components/ui/QrCode.d.ts +3 -3
- package/dist/components/ui/QrCode.js +47 -0
- package/dist/components/ui/Radio.d.ts +9 -6
- package/dist/components/ui/Radio.js +58 -0
- package/dist/components/ui/RadioPill.d.ts +7 -4
- package/dist/components/ui/RadioPill.js +53 -0
- package/dist/components/ui/ReorderList.d.ts +3 -3
- package/dist/components/ui/ReorderList.js +123 -0
- package/dist/components/ui/SearchInput.d.ts +7 -5
- package/dist/components/ui/SearchInput.js +49 -0
- package/dist/components/ui/SectionHeader.d.ts +3 -3
- package/dist/components/ui/SectionHeader.js +13 -0
- package/dist/components/ui/Select.d.ts +4 -4
- package/dist/components/ui/Select.js +117 -0
- package/dist/components/ui/SelectDropdown.d.ts +8 -3
- package/dist/components/ui/SelectDropdown.js +206 -0
- package/dist/components/ui/SettingRow.d.ts +5 -5
- package/dist/components/ui/SettingRow.js +25 -0
- package/dist/components/ui/SideSheet.d.ts +3 -3
- package/dist/components/ui/SideSheet.js +164 -0
- package/dist/components/ui/Skeleton.d.ts +3 -3
- package/dist/components/ui/Skeleton.js +18 -0
- package/dist/components/ui/Slider.d.ts +11 -6
- package/dist/components/ui/Slider.js +58 -0
- package/dist/components/ui/SplitPaneLayout.d.ts +5 -5
- package/dist/components/ui/SplitPaneLayout.js +22 -0
- package/dist/components/ui/Stack.d.ts +1 -1
- package/dist/components/ui/Stack.js +18 -0
- package/dist/components/ui/StatusDot.d.ts +3 -2
- package/dist/components/ui/StatusDot.js +24 -0
- package/dist/components/ui/StepProgress.d.ts +3 -2
- package/dist/components/ui/StepProgress.js +33 -0
- package/dist/components/ui/Tabs.d.ts +5 -5
- package/dist/components/ui/Tabs.js +63 -0
- package/dist/components/ui/TextInput.d.ts +4 -4
- package/dist/components/ui/TextInput.js +57 -0
- package/dist/components/ui/Textarea.d.ts +3 -3
- package/dist/components/ui/Textarea.js +59 -0
- package/dist/components/ui/ThemePreview.d.ts +3 -3
- package/dist/components/ui/ThemePreview.js +28 -0
- package/dist/components/ui/TimeInput.d.ts +7 -6
- package/dist/components/ui/TimeInput.js +22 -0
- package/dist/components/ui/Timeline.d.ts +3 -2
- package/dist/components/ui/Timeline.js +29 -0
- package/dist/components/ui/Toast.js +121 -0
- package/dist/components/ui/Toggle.d.ts +5 -3
- package/dist/components/ui/Toggle.js +34 -0
- package/dist/components/ui/Toolbar.d.ts +3 -3
- package/dist/components/ui/Toolbar.js +70 -0
- package/dist/components/ui/Tooltip.js +91 -0
- package/dist/components/ui/TranscriptLine.d.ts +3 -3
- package/dist/components/ui/TranscriptLine.js +40 -0
- package/dist/components/ui/UploadDropzone.d.ts +3 -5
- package/dist/components/ui/UploadDropzone.js +55 -0
- package/dist/components/ui/badgeColors.js +5 -0
- package/dist/components/ui/calendar/AgendaView.js +140 -0
- package/dist/components/ui/calendar/MonthView.js +321 -0
- package/dist/components/ui/calendar/TimeGrid.js +501 -0
- package/dist/components/ui/calendar/TimelineView.js +311 -0
- package/dist/components/ui/calendar/context.js +10 -0
- package/dist/components/ui/calendar/items.js +152 -0
- package/dist/components/ui/calendar/types.js +38 -0
- package/dist/components/ui/calendar/useGridInteraction.js +393 -0
- package/dist/components/ui/useFieldControl.d.ts +1 -1
- package/dist/components/ui/useFieldControl.js +17 -0
- package/dist/config/theme.js +219 -0
- package/dist/core.css +2933 -0
- package/dist/hooks/useAnchoredPopup.js +162 -0
- package/dist/hooks/useApplyTheme.js +16 -0
- package/dist/hooks/useControllableState.d.ts +14 -0
- package/dist/hooks/useControllableState.js +10 -0
- package/dist/hooks/useDismiss.js +24 -0
- package/dist/hooks/useFocusTrap.js +42 -0
- package/dist/hooks/useOverlayStack.js +23 -0
- package/dist/hooks/usePopover.js +47 -0
- package/dist/hooks/usePortalContainer.js +14 -0
- package/dist/hooks/useSettings.js +8 -0
- package/dist/hooks/useTheme.js +8 -0
- package/dist/hooks/useTypeahead.js +19 -0
- package/dist/index.js +133 -12884
- package/dist/lib/anchorPlacement.js +75 -0
- package/dist/lib/calendar.js +666 -0
- package/dist/lib/cn.js +228 -0
- package/dist/lib/codeInput.js +51 -0
- package/dist/lib/dateParts.js +31 -0
- package/dist/lib/dialogDrag.js +45 -0
- package/dist/lib/dialogResize.js +47 -0
- package/dist/lib/formatDate.js +29 -0
- package/dist/lib/formatMediaTime.js +7 -0
- package/dist/lib/layout.js +29 -0
- package/dist/lib/math.js +6 -0
- package/dist/lib/mergeRefs.d.ts +6 -0
- package/dist/lib/mergeRefs.js +17 -0
- package/dist/lib/months.js +30 -0
- package/dist/lib/overlayStack.js +47 -0
- package/dist/lib/panelResize.js +8 -0
- package/dist/lib/passwordRequirements.js +23 -0
- package/dist/lib/qrCode.js +570 -0
- package/dist/lib/tones.js +104 -0
- package/dist/lib/typeahead.js +31 -0
- package/dist/providers/ControlSizeContext.js +9 -0
- package/dist/providers/ControlSizeProvider.js +11 -0
- package/dist/providers/SettingsContext.js +53 -0
- package/dist/providers/SettingsProvider.js +249 -0
- package/dist/providers/ThemeContext.js +5 -0
- package/dist/providers/ThemeProvider.js +17 -0
- package/dist/providers/accentColors.js +75 -0
- package/dist/providers/themeClasses.d.ts +1 -0
- package/dist/providers/themeClasses.js +20 -0
- package/dist/styles.css +228 -176
- package/dist/themes/cyber-brutal-dark.css +53 -0
- package/dist/themes/cyber-brutal-light.css +75 -0
- package/dist/themes/glass-dark.css +217 -0
- package/dist/themes/glass-light.css +215 -0
- package/dist/themes/hashi.css +66 -0
- package/dist/themes/light-inverted.css +32 -0
- package/dist/themes/light.css +1 -0
- package/dist/themes/monokai.css +51 -0
- package/dist/themes/solarized.css +55 -0
- package/package.json +3 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
2
|
+
import { formatHourLabel as t, formatTime as n, formatTimeOfDay as r, layoutOverlaps as i, matchesResource as a, packLanes as o, selectCalendarTimeAxis as s, subtractIntervals as c } from "../../../lib/calendar.js";
|
|
3
|
+
import { useCalendarContext as l } from "./context.js";
|
|
4
|
+
import { BlockBox as ee, EventBox as u, Ghost as te } from "./items.js";
|
|
5
|
+
import { useGridInteraction as d } from "./useGridInteraction.js";
|
|
6
|
+
import { useEffect as ne, useId as re, useLayoutEffect as ie, useMemo as f, useRef as p, useState as ae } from "react";
|
|
7
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/calendar/TimeGrid.tsx
|
|
9
|
+
var g = 22, oe = 3, _ = 18, se = 36;
|
|
10
|
+
function v(e) {
|
|
11
|
+
let t = e.querySelector(".ui-cal-head")?.offsetHeight ?? 0;
|
|
12
|
+
return (e.clientHeight - t) / 2;
|
|
13
|
+
}
|
|
14
|
+
function y(e, t, n, r, i) {
|
|
15
|
+
let a = i(e.start, e.end, t);
|
|
16
|
+
return a ? a.endMinute <= n && a.startMinute < n ? "before" : a.startMinute >= r ? "after" : {
|
|
17
|
+
item: e,
|
|
18
|
+
start: Math.max(a.startMinute, n),
|
|
19
|
+
end: Math.min(a.endMinute, r),
|
|
20
|
+
continuesBefore: a.continuesBefore || a.startMinute < n,
|
|
21
|
+
continuesAfter: a.continuesAfter || a.endMinute > r
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
function b({ days: b, events: x, availability: S, label: ue }) {
|
|
25
|
+
let C = l(), { daySegment: w, formatLongDate: de, getFormatter: fe, isAllDayLike: T, isSameDay: E, minutesOfDay: pe, toDateKey: D } = C.dates, { bounds: O, resources: k, hourHeight: me } = C, A = me / 60, j = p(null), he = re(), [M, ge] = ae(!1), N = f(() => b.flatMap((e) => k.length ? k.map((t) => ({
|
|
26
|
+
key: `${D(e)}|${t.id}`,
|
|
27
|
+
day: e,
|
|
28
|
+
bounds: C.dates.dayBounds(e, C.bounds),
|
|
29
|
+
resourceId: t.id
|
|
30
|
+
})) : [{
|
|
31
|
+
key: D(e),
|
|
32
|
+
day: e,
|
|
33
|
+
bounds: C.dates.dayBounds(e, C.bounds)
|
|
34
|
+
}]), [
|
|
35
|
+
b,
|
|
36
|
+
k,
|
|
37
|
+
D,
|
|
38
|
+
C.dates,
|
|
39
|
+
C.bounds
|
|
40
|
+
]), _e = f(() => new Map(x.map((e) => [e.id, e])), [x]), ve = f(() => new Map(S.map((e) => [e.id, e])), [S]), ye = N.findIndex((e) => E(e.day, C.now)), P = d({
|
|
41
|
+
axis: "y",
|
|
42
|
+
columns: N,
|
|
43
|
+
pxPerMinute: A,
|
|
44
|
+
scrollRef: j,
|
|
45
|
+
events: _e,
|
|
46
|
+
blocks: ve,
|
|
47
|
+
initialColumn: Math.max(0, ye)
|
|
48
|
+
}), { drag: F, cursor: I } = P, L = C.editLayer === "availability", be = f(() => {
|
|
49
|
+
let e = x.filter((e) => !T(e)), t = _ / A;
|
|
50
|
+
return N.map((n) => {
|
|
51
|
+
let r = n.bounds ?? C.bounds, o = 0, s = 0, l = [];
|
|
52
|
+
for (let t of e) {
|
|
53
|
+
if (!a(t.resourceId, n.resourceId, { emptyMatchesAll: !1 })) continue;
|
|
54
|
+
let e = y(t, n.day, r.min, r.max, w);
|
|
55
|
+
e === "before" ? o++ : e === "after" ? s++ : e && l.push(e);
|
|
56
|
+
}
|
|
57
|
+
let ee = i(l.map((e) => ({
|
|
58
|
+
id: e.item.id,
|
|
59
|
+
start: e.start,
|
|
60
|
+
end: e.end
|
|
61
|
+
})), t), u = [];
|
|
62
|
+
for (let e of S) {
|
|
63
|
+
if (!a(e.resourceId, n.resourceId, { emptyMatchesAll: !0 })) continue;
|
|
64
|
+
let t = y(e, n.day, r.min, r.max, w);
|
|
65
|
+
t && typeof t == "object" && u.push(t);
|
|
66
|
+
}
|
|
67
|
+
let te = L ? i(u.map((e) => ({
|
|
68
|
+
id: e.item.id,
|
|
69
|
+
start: e.start,
|
|
70
|
+
end: e.end
|
|
71
|
+
})), t) : null, d = [];
|
|
72
|
+
return C.hasAvailability && C.shadeOutsideAvailability && (d = c(r.min, r.max, u.map((e) => [e.start, e.end]))), {
|
|
73
|
+
placed: l,
|
|
74
|
+
layout: ee,
|
|
75
|
+
blocks: u,
|
|
76
|
+
blockLayout: te,
|
|
77
|
+
outside: d,
|
|
78
|
+
earlier: o,
|
|
79
|
+
later: s
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}, [
|
|
83
|
+
N,
|
|
84
|
+
x,
|
|
85
|
+
S,
|
|
86
|
+
A,
|
|
87
|
+
L,
|
|
88
|
+
C.hasAvailability,
|
|
89
|
+
C.shadeOutsideAvailability,
|
|
90
|
+
C.bounds,
|
|
91
|
+
w,
|
|
92
|
+
T
|
|
93
|
+
]), R = f(() => {
|
|
94
|
+
let e = [];
|
|
95
|
+
for (let t of x) {
|
|
96
|
+
if (!T(t)) continue;
|
|
97
|
+
let n = -1;
|
|
98
|
+
N.forEach((r, i) => {
|
|
99
|
+
let o = w(t.start, t.end, r.day) !== null && a(t.resourceId, r.resourceId, { emptyMatchesAll: !1 });
|
|
100
|
+
o && n === -1 && (n = i);
|
|
101
|
+
let s = i === N.length - 1;
|
|
102
|
+
if (n !== -1 && (!o || s)) {
|
|
103
|
+
let r = o && s ? i + 1 : i;
|
|
104
|
+
e.push({
|
|
105
|
+
id: `${t.id}#${n}`,
|
|
106
|
+
event: t,
|
|
107
|
+
start: n,
|
|
108
|
+
end: r
|
|
109
|
+
}), n = -1;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
let { lanes: t, count: n } = o(e);
|
|
114
|
+
return {
|
|
115
|
+
runs: e,
|
|
116
|
+
lanes: t,
|
|
117
|
+
count: n
|
|
118
|
+
};
|
|
119
|
+
}, [
|
|
120
|
+
x,
|
|
121
|
+
N,
|
|
122
|
+
w,
|
|
123
|
+
T
|
|
124
|
+
]), z = M ? R.count : Math.min(R.count, oe), xe = R.runs.filter((e) => (R.lanes.get(e.id) ?? 0) >= z).length, B = p(A), Se = p(null);
|
|
125
|
+
ne(() => {
|
|
126
|
+
let e = j.current;
|
|
127
|
+
if (!e) return;
|
|
128
|
+
let t = () => {
|
|
129
|
+
Se.current = (e.scrollTop + v(e)) / B.current;
|
|
130
|
+
};
|
|
131
|
+
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
132
|
+
}, []), ie(() => {
|
|
133
|
+
let e = j.current;
|
|
134
|
+
if (!e || B.current === A) return;
|
|
135
|
+
B.current = A;
|
|
136
|
+
let t = Se.current;
|
|
137
|
+
t !== null && (e.scrollTop = Math.max(0, t * A - v(e)));
|
|
138
|
+
}, [A]);
|
|
139
|
+
let Ce = p(null), V = C.scrollToMinute, { dates: H, timeZone: we, now: Te } = C, Ee = C.scrollAlign;
|
|
140
|
+
ne(() => {
|
|
141
|
+
let e = j.current;
|
|
142
|
+
if (!e || Ce.current === C.view) return;
|
|
143
|
+
Ce.current = C.view;
|
|
144
|
+
let t = b.find((e) => E(e, Te)) ?? b[0], n = we ? H.minutesOfDay(H.wallDateAtMinutes(t, V ?? 480)) : V ?? 480, r = H.dayBounds(t, O), i = e.querySelector(".ui-cal-head"), a = () => {
|
|
145
|
+
let t = Ee === "center" ? v(e) : 8;
|
|
146
|
+
e.scrollTop = Math.max(0, (n - r.min) * A - t);
|
|
147
|
+
};
|
|
148
|
+
if (a(), typeof ResizeObserver > "u") return;
|
|
149
|
+
let o = new ResizeObserver(a);
|
|
150
|
+
o.observe(e), i && o.observe(i);
|
|
151
|
+
let s = !1, c = () => {
|
|
152
|
+
s = !0, o.disconnect();
|
|
153
|
+
}, l = [
|
|
154
|
+
"wheel",
|
|
155
|
+
"pointerdown",
|
|
156
|
+
"touchstart",
|
|
157
|
+
"keydown"
|
|
158
|
+
];
|
|
159
|
+
for (let t of l) e.addEventListener(t, c, {
|
|
160
|
+
once: !0,
|
|
161
|
+
passive: !0
|
|
162
|
+
});
|
|
163
|
+
return () => {
|
|
164
|
+
o.disconnect();
|
|
165
|
+
for (let t of l) e.removeEventListener(t, c);
|
|
166
|
+
s || (Ce.current = null);
|
|
167
|
+
};
|
|
168
|
+
}, [
|
|
169
|
+
C.view,
|
|
170
|
+
V,
|
|
171
|
+
Ee,
|
|
172
|
+
O,
|
|
173
|
+
A,
|
|
174
|
+
b,
|
|
175
|
+
E,
|
|
176
|
+
H,
|
|
177
|
+
we,
|
|
178
|
+
Te
|
|
179
|
+
]);
|
|
180
|
+
let U = b.length > 1, W = k.length > 0, G = !!C.timeZone && C.sharedTimeAxis, K = f(() => s(N.map((e) => ({
|
|
181
|
+
day: e.day,
|
|
182
|
+
bounds: e.bounds ?? C.bounds
|
|
183
|
+
})), C.slotLabelInterval, {
|
|
184
|
+
timeZone: C.timeZone,
|
|
185
|
+
locale: C.locale,
|
|
186
|
+
hour12: C.hour12
|
|
187
|
+
}, C.bounds, G), [
|
|
188
|
+
N,
|
|
189
|
+
C.slotLabelInterval,
|
|
190
|
+
C.timeZone,
|
|
191
|
+
C.locale,
|
|
192
|
+
C.hour12,
|
|
193
|
+
C.bounds,
|
|
194
|
+
G
|
|
195
|
+
]), q = K.reference, J = K.axes.map((e) => !!C.timeZone && (!G || !e.matchesReference)), Y = q ? fe(C.locale, { timeZoneName: "short" }).formatToParts(C.dates.dateAtMinutes(q.day, q.bounds.min)).find((e) => e.type === "timeZoneName")?.value : void 0, De = J.some(Boolean) ? Math.max(W ? C.resourceMinWidth : 0, 180) : W ? C.resourceMinWidth : 44, Oe = Math.max(...N.map((e) => (e.bounds?.max ?? O.max) - (e.bounds?.min ?? O.min))) * A, ke = {
|
|
196
|
+
"--cal-hour": `${me}px`,
|
|
197
|
+
"--cal-offset": `${-(O.min % 60 * A)}px`,
|
|
198
|
+
height: Oe
|
|
199
|
+
}, X = q?.bounds ?? O, Z = [], Q = Math.max(5, C.slotLabelInterval);
|
|
200
|
+
for (let e = Math.ceil(X.min / Q) * Q; e < X.max; e += Q) e > X.min && Z.push(e);
|
|
201
|
+
let Ae = fe(C.locale, { weekday: "short" }), je = pe(C.now), Me = C.nowIndicator, $ = F?.draft, Ne = $ && ($.target === "selection" ? $.resourceId : $.resourceIds), Pe = "";
|
|
202
|
+
if (I) {
|
|
203
|
+
let e = N[I.column];
|
|
204
|
+
if (e) {
|
|
205
|
+
let t = e.resourceId ? C.resourceById.get(e.resourceId) : void 0;
|
|
206
|
+
Pe = `${de(e.day, C.locale)}, ${C.timeZone ? n(C.dates.dateAtMinutes(e.day, I.start), C) : r(I.start)} to ${C.timeZone ? n(C.dates.dateAtMinutes(e.day, I.end), C) : r(I.end)}${t ? `, ${t.title}` : ""}`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return /* @__PURE__ */ m("div", {
|
|
210
|
+
ref: j,
|
|
211
|
+
"data-cal-drag": F?.draft.action,
|
|
212
|
+
className: "ui-cal-scroll relative min-h-0 flex-1 overflow-auto",
|
|
213
|
+
style: C.timeZone && !q ? { "--cal-gutter": "0px" } : void 0,
|
|
214
|
+
children: /* @__PURE__ */ h("div", {
|
|
215
|
+
className: "flex min-h-full flex-col",
|
|
216
|
+
style: { minWidth: `calc(var(--cal-gutter) + ${N.length * De}px)` },
|
|
217
|
+
children: [/* @__PURE__ */ h("div", {
|
|
218
|
+
className: "ui-cal-head border-border border-b",
|
|
219
|
+
children: [
|
|
220
|
+
U && /* @__PURE__ */ h("div", {
|
|
221
|
+
className: "flex",
|
|
222
|
+
children: [/* @__PURE__ */ m("div", {
|
|
223
|
+
className: Y ? "ui-cal-corner text-text-tertiary flex items-center justify-center text-2xs" : "ui-cal-corner",
|
|
224
|
+
title: Y ? C.timeZone : void 0,
|
|
225
|
+
"aria-label": Y ? C.timeZone : void 0,
|
|
226
|
+
children: Y
|
|
227
|
+
}), b.map((e) => /* @__PURE__ */ m(ce, {
|
|
228
|
+
day: e,
|
|
229
|
+
weekday: Ae.format(e),
|
|
230
|
+
isToday: E(e, C.now),
|
|
231
|
+
grow: W ? k.length : 1,
|
|
232
|
+
onOpen: () => C.openDay(e),
|
|
233
|
+
bordered: W
|
|
234
|
+
}, D(e)))]
|
|
235
|
+
}),
|
|
236
|
+
W && /* @__PURE__ */ h("div", {
|
|
237
|
+
className: "flex",
|
|
238
|
+
children: [/* @__PURE__ */ m("div", {
|
|
239
|
+
className: Y && !U ? "ui-cal-corner text-text-tertiary flex items-center justify-center text-2xs" : "ui-cal-corner",
|
|
240
|
+
title: !U && Y ? C.timeZone : void 0,
|
|
241
|
+
"aria-label": !U && Y ? C.timeZone : void 0,
|
|
242
|
+
children: U ? void 0 : Y
|
|
243
|
+
}), N.map((e, t) => /* @__PURE__ */ m(le, {
|
|
244
|
+
resource: C.resourceById.get(e.resourceId ?? ""),
|
|
245
|
+
sub: t % k.length !== 0
|
|
246
|
+
}, e.key))]
|
|
247
|
+
}),
|
|
248
|
+
R.count > 0 && /* @__PURE__ */ h("div", {
|
|
249
|
+
className: "border-border flex border-t",
|
|
250
|
+
children: [/* @__PURE__ */ h("div", {
|
|
251
|
+
className: "ui-cal-corner text-text-tertiary flex flex-col items-end justify-center gap-0.5 pr-2 text-2xs",
|
|
252
|
+
children: [/* @__PURE__ */ m("span", { children: C.labels.allDay }), R.count > oe && /* @__PURE__ */ m("button", {
|
|
253
|
+
type: "button",
|
|
254
|
+
className: "text-accent-fg cursor-pointer hover:underline",
|
|
255
|
+
"aria-expanded": M,
|
|
256
|
+
onClick: () => ge((e) => !e),
|
|
257
|
+
children: M ? C.labels.showLess : C.labels.more(xe)
|
|
258
|
+
})]
|
|
259
|
+
}), /* @__PURE__ */ m("div", {
|
|
260
|
+
className: "relative flex-1",
|
|
261
|
+
style: { height: z * g + 4 },
|
|
262
|
+
children: R.runs.map((e) => {
|
|
263
|
+
let t = R.lanes.get(e.id) ?? 0;
|
|
264
|
+
if (t >= z) return null;
|
|
265
|
+
let n = N[e.start], r = N[e.end - 1];
|
|
266
|
+
return /* @__PURE__ */ m(u, {
|
|
267
|
+
event: e.event,
|
|
268
|
+
compact: !0,
|
|
269
|
+
continuesBefore: !!n && w(e.event.start, e.event.end, n.day)?.continuesBefore,
|
|
270
|
+
continuesAfter: !!r && w(e.event.start, e.event.end, r.day)?.continuesAfter,
|
|
271
|
+
style: {
|
|
272
|
+
top: t * g + 2,
|
|
273
|
+
height: g - 3,
|
|
274
|
+
left: `calc(${e.start / N.length * 100}% + 2px)`,
|
|
275
|
+
width: `calc(${(e.end - e.start) / N.length * 100}% - 4px)`,
|
|
276
|
+
justifyContent: "center"
|
|
277
|
+
},
|
|
278
|
+
onClick: () => C.clickEvent(e.event),
|
|
279
|
+
onKeyDown: (t) => {
|
|
280
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), C.clickEvent(e.event));
|
|
281
|
+
}
|
|
282
|
+
}, e.id);
|
|
283
|
+
})
|
|
284
|
+
})]
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
}), /* @__PURE__ */ h("div", {
|
|
288
|
+
className: "flex flex-1",
|
|
289
|
+
children: [/* @__PURE__ */ h("div", {
|
|
290
|
+
className: "ui-cal-gutter relative",
|
|
291
|
+
style: { height: Oe },
|
|
292
|
+
"aria-hidden": "true",
|
|
293
|
+
children: [
|
|
294
|
+
Y && !U && !W && /* @__PURE__ */ m("span", {
|
|
295
|
+
className: "text-text-tertiary absolute top-0 right-2 text-2xs",
|
|
296
|
+
"aria-hidden": "true",
|
|
297
|
+
children: Y
|
|
298
|
+
}),
|
|
299
|
+
q && Z.map((e) => {
|
|
300
|
+
let n = C.dates.parts(C.dates.dateAtMinutes(q.day, e));
|
|
301
|
+
return /* @__PURE__ */ m("span", {
|
|
302
|
+
className: "text-text-tertiary font-mono absolute right-2 -translate-y-1/2 text-2xs",
|
|
303
|
+
style: { top: (e - q.bounds.min) * A },
|
|
304
|
+
children: t(n.hour * 60 + n.minute, C)
|
|
305
|
+
}, e);
|
|
306
|
+
}),
|
|
307
|
+
!C.timeZone && Z.map((e) => /* @__PURE__ */ m("span", {
|
|
308
|
+
className: "text-text-tertiary font-mono absolute right-2 -translate-y-1/2 text-2xs",
|
|
309
|
+
style: { top: (e - O.min) * A },
|
|
310
|
+
children: t(e, C)
|
|
311
|
+
}, e))
|
|
312
|
+
]
|
|
313
|
+
}), /* @__PURE__ */ h("div", {
|
|
314
|
+
role: "group",
|
|
315
|
+
"aria-roledescription": "time grid",
|
|
316
|
+
"aria-label": ue,
|
|
317
|
+
"aria-describedby": he,
|
|
318
|
+
tabIndex: 0,
|
|
319
|
+
className: "ui-cal-lines ui-cal-surface relative flex flex-1 select-none focus-visible:outline-none",
|
|
320
|
+
style: ke,
|
|
321
|
+
onPointerDown: P.onPointerDown,
|
|
322
|
+
onFocus: P.onGridFocus,
|
|
323
|
+
onBlur: P.onGridBlur,
|
|
324
|
+
onKeyDown: P.onGridKeyDown,
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ m("span", {
|
|
327
|
+
id: he,
|
|
328
|
+
className: "sr-only",
|
|
329
|
+
children: C.labels.gridHelp
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ m("span", {
|
|
332
|
+
className: "sr-only",
|
|
333
|
+
"aria-live": "polite",
|
|
334
|
+
children: Pe
|
|
335
|
+
}),
|
|
336
|
+
N.map((t, r) => {
|
|
337
|
+
let i = be[r], o = t.bounds ?? C.bounds, s = J[r] ? 72 : 0, c = J[r] ? K.axes[r].minutes : [], l = E(t.day, C.now), d = W && r % k.length !== 0;
|
|
338
|
+
return /* @__PURE__ */ h("div", {
|
|
339
|
+
"data-cal-col": r,
|
|
340
|
+
"data-today": l || void 0,
|
|
341
|
+
"data-subcol": d || void 0,
|
|
342
|
+
className: "ui-cal-col flex-1",
|
|
343
|
+
style: {
|
|
344
|
+
minWidth: De,
|
|
345
|
+
height: (o.max - o.min) * A
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
c.map((e) => /* @__PURE__ */ m("span", {
|
|
349
|
+
className: "ui-cal-zone-label",
|
|
350
|
+
style: { top: (e - o.min) * A },
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
children: n(C.dates.dateAtMinutes(t.day, e), C)
|
|
353
|
+
}, `label-${e}`)),
|
|
354
|
+
i.outside.map(([e, t]) => /* @__PURE__ */ m("div", {
|
|
355
|
+
className: "ui-cal-outside",
|
|
356
|
+
"aria-hidden": "true",
|
|
357
|
+
style: {
|
|
358
|
+
left: 0,
|
|
359
|
+
right: 0,
|
|
360
|
+
top: (e - o.min) * A,
|
|
361
|
+
height: (t - e) * A
|
|
362
|
+
}
|
|
363
|
+
}, `o${e}`)),
|
|
364
|
+
i.blocks.map((e) => {
|
|
365
|
+
let t = i.blockLayout?.get(e.item.id);
|
|
366
|
+
return /* @__PURE__ */ m(ee, {
|
|
367
|
+
block: e.item,
|
|
368
|
+
resizeEdge: "bottom",
|
|
369
|
+
continuesAfter: e.continuesAfter,
|
|
370
|
+
dragging: F?.itemId === e.item.id,
|
|
371
|
+
style: {
|
|
372
|
+
top: (e.start - o.min) * A,
|
|
373
|
+
height: Math.max((e.end - e.start) * A, 4),
|
|
374
|
+
left: t ? `calc(${t.column / t.columns * 100}% + ${s * (1 - t.column / t.columns) + 1}px)` : s,
|
|
375
|
+
width: t ? `calc(${t.span / t.columns * 100}% - ${s * t.span / t.columns + 4}px)` : s ? `calc(100% - ${s}px)` : "100%"
|
|
376
|
+
},
|
|
377
|
+
onKeyDown: (t) => P.onItemKeyDown(t, "availability", e.item.id, r),
|
|
378
|
+
onClick: (t) => {
|
|
379
|
+
t.detail === 0 && C.clickBlock(e.item);
|
|
380
|
+
}
|
|
381
|
+
}, e.item.id);
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ m("div", {
|
|
384
|
+
style: s ? { left: s } : void 0,
|
|
385
|
+
className: e("absolute inset-0", L && "ui-cal-muted-layer"),
|
|
386
|
+
children: i.placed.map((e) => {
|
|
387
|
+
let t = i.layout.get(e.item.id), n = Math.max((e.end - e.start) * A, _);
|
|
388
|
+
return /* @__PURE__ */ m(u, {
|
|
389
|
+
event: e.item,
|
|
390
|
+
compact: n < se,
|
|
391
|
+
resizeEdge: "bottom",
|
|
392
|
+
continuesBefore: e.continuesBefore,
|
|
393
|
+
continuesAfter: e.continuesAfter,
|
|
394
|
+
dragging: F?.itemId === e.item.id,
|
|
395
|
+
style: {
|
|
396
|
+
top: (e.start - o.min) * A + 1,
|
|
397
|
+
height: n - 2,
|
|
398
|
+
left: t ? `calc(${t.column / t.columns * 100}% + 1px)` : 1,
|
|
399
|
+
width: t ? `calc(${t.span / t.columns * 100}% - 5px)` : "calc(100% - 5px)"
|
|
400
|
+
},
|
|
401
|
+
onKeyDown: (t) => P.onItemKeyDown(t, "event", e.item.id, r),
|
|
402
|
+
onClick: (t) => {
|
|
403
|
+
t.detail === 0 && C.clickEvent(e.item);
|
|
404
|
+
}
|
|
405
|
+
}, e.item.id);
|
|
406
|
+
})
|
|
407
|
+
}),
|
|
408
|
+
i.earlier > 0 && /* @__PURE__ */ m("span", {
|
|
409
|
+
className: "ui-cal-overflow",
|
|
410
|
+
"data-edge": "top",
|
|
411
|
+
"data-cal-ignore": !0,
|
|
412
|
+
children: C.labels.earlier(i.earlier)
|
|
413
|
+
}),
|
|
414
|
+
i.later > 0 && /* @__PURE__ */ m("span", {
|
|
415
|
+
className: "ui-cal-overflow",
|
|
416
|
+
"data-edge": "bottom",
|
|
417
|
+
"data-cal-ignore": !0,
|
|
418
|
+
children: C.labels.later(i.later)
|
|
419
|
+
}),
|
|
420
|
+
l && Me && je >= o.min && je <= o.max && /* @__PURE__ */ m("div", {
|
|
421
|
+
className: "ui-cal-now",
|
|
422
|
+
"data-axis": "y",
|
|
423
|
+
"data-dot": !d || void 0,
|
|
424
|
+
style: { top: (je - o.min) * A }
|
|
425
|
+
}),
|
|
426
|
+
$ && a(Ne, t.resourceId, { emptyMatchesAll: !0 }) && (() => {
|
|
427
|
+
let e = y($, t.day, o.min, o.max, w);
|
|
428
|
+
return !e || typeof e != "object" ? null : /* @__PURE__ */ m(te, {
|
|
429
|
+
draft: $,
|
|
430
|
+
invalid: F?.invalid,
|
|
431
|
+
style: {
|
|
432
|
+
top: (e.start - o.min) * A + 1,
|
|
433
|
+
height: Math.max((e.end - e.start) * A - 2, _),
|
|
434
|
+
left: s + 1,
|
|
435
|
+
right: 4
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
})(),
|
|
439
|
+
I?.column === r && /* @__PURE__ */ m("div", {
|
|
440
|
+
"data-cal-cursor": !0,
|
|
441
|
+
className: "ui-cal-cursor",
|
|
442
|
+
style: {
|
|
443
|
+
left: s,
|
|
444
|
+
right: 0,
|
|
445
|
+
top: (I.start - o.min) * A,
|
|
446
|
+
height: (I.end - I.start) * A
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
]
|
|
450
|
+
}, t.key);
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
})]
|
|
454
|
+
})]
|
|
455
|
+
})
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
function ce({ day: t, weekday: n, isToday: r, grow: i, bordered: a, onOpen: o }) {
|
|
459
|
+
let s = l();
|
|
460
|
+
return /* @__PURE__ */ m("div", {
|
|
461
|
+
className: e("flex min-w-0 items-center justify-center py-1.5", a && "border-border border-l"),
|
|
462
|
+
style: { flex: `${i} 1 0` },
|
|
463
|
+
children: /* @__PURE__ */ h("button", {
|
|
464
|
+
type: "button",
|
|
465
|
+
onClick: o,
|
|
466
|
+
"aria-label": s.dates.formatLongDate(t, s.locale),
|
|
467
|
+
"aria-current": r ? "date" : void 0,
|
|
468
|
+
className: "hover:bg-bg-hover flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors duration-[100ms]",
|
|
469
|
+
children: [/* @__PURE__ */ m("span", {
|
|
470
|
+
className: e("text-2xs font-medium uppercase", r ? "text-accent-fg" : "text-text-tertiary"),
|
|
471
|
+
children: n
|
|
472
|
+
}), /* @__PURE__ */ m("span", {
|
|
473
|
+
className: e("flex h-6 w-6 items-center justify-center rounded-full text-sm font-semibold", r ? "bg-accent text-text-on-accent" : "text-text-primary"),
|
|
474
|
+
children: s.dates.parts(t).day
|
|
475
|
+
})]
|
|
476
|
+
})
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function le({ resource: t, sub: n }) {
|
|
480
|
+
let r = l();
|
|
481
|
+
return /* @__PURE__ */ h("div", {
|
|
482
|
+
className: e("border-border flex min-w-0 flex-1 items-center gap-1.5 border-l px-2 py-1.5", n && "ui-cal-subhead"),
|
|
483
|
+
style: { minWidth: r.resourceMinWidth },
|
|
484
|
+
title: t?.title,
|
|
485
|
+
children: [t?.color && /* @__PURE__ */ m("span", {
|
|
486
|
+
className: e("ui-cal-dot", `ui-cal-c-${t.color}`),
|
|
487
|
+
"aria-hidden": "true"
|
|
488
|
+
}), /* @__PURE__ */ h("span", {
|
|
489
|
+
className: "min-w-0",
|
|
490
|
+
children: [/* @__PURE__ */ m("span", {
|
|
491
|
+
className: "text-text-primary block truncate text-xs font-medium",
|
|
492
|
+
children: t?.title
|
|
493
|
+
}), t?.subtitle && /* @__PURE__ */ m("span", {
|
|
494
|
+
className: "text-text-tertiary block truncate text-2xs",
|
|
495
|
+
children: t.subtitle
|
|
496
|
+
})]
|
|
497
|
+
})]
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
//#endregion
|
|
501
|
+
export { b as TimeGrid };
|