@leonardaustin/ui 0.25.0 → 0.26.0
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 +96 -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 +3 -3
- 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,311 @@
|
|
|
1
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
2
|
+
import { formatHourLabel as t, formatTime as n, formatTimeOfDay as r, matchesResource as i, packLanes as a, subtractIntervals as o } from "../../../lib/calendar.js";
|
|
3
|
+
import { useCalendarContext as s } from "./context.js";
|
|
4
|
+
import { BlockBox as c, EventBox as l, Ghost as u } from "./items.js";
|
|
5
|
+
import { useGridInteraction as ee } from "./useGridInteraction.js";
|
|
6
|
+
import { useEffect as d, useId as te, useMemo as f, useRef as p, useState as m } from "react";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDown as ne, ChevronRight as re } from "lucide-react";
|
|
9
|
+
//#region src/components/ui/calendar/TimelineView.tsx
|
|
10
|
+
var _ = 34, v = 4, y = 28;
|
|
11
|
+
function b(e, t, n, r, i) {
|
|
12
|
+
let a = i(e.start, e.end, t);
|
|
13
|
+
return !a || a.endMinute <= n || a.startMinute >= r ? null : {
|
|
14
|
+
item: e,
|
|
15
|
+
start: Math.max(a.startMinute, n),
|
|
16
|
+
end: Math.min(a.endMinute, r),
|
|
17
|
+
continuesBefore: a.continuesBefore || a.startMinute < n,
|
|
18
|
+
continuesAfter: a.continuesAfter || a.endMinute > r
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function x({ day: x, events: S, availability: C, label: w }) {
|
|
22
|
+
let T = s(), { daySegment: E, isSameDay: ie, minutesOfDay: ae } = T.dates, D = T.dayBounds(x), O = p(null), k = T.resources.length === 0 && S.length === 0 && C.length === 0, [A, j] = m(0);
|
|
23
|
+
d(() => {
|
|
24
|
+
let e = O.current;
|
|
25
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
26
|
+
let t = new ResizeObserver(() => {
|
|
27
|
+
let t = e.querySelector(".ui-cal-row-head");
|
|
28
|
+
j(Math.max(0, e.clientWidth - (t?.offsetWidth ?? 0)));
|
|
29
|
+
});
|
|
30
|
+
return t.observe(e), () => t.disconnect();
|
|
31
|
+
}, [k]);
|
|
32
|
+
let M = (D.max - D.min) / 60, N = Math.max(T.timelineHourWidth, A / M), P = N / 60, F = (D.max - D.min) * P, I = te(), [L, oe] = m(/* @__PURE__ */ new Set()), R = f(() => {
|
|
33
|
+
let e = [], t = T.resources.length ? [...T.resources] : [{
|
|
34
|
+
id: "",
|
|
35
|
+
title: ""
|
|
36
|
+
}];
|
|
37
|
+
for (let n of t) {
|
|
38
|
+
let t = e.find((e) => e.name === n.group);
|
|
39
|
+
t || (t = {
|
|
40
|
+
name: n.group,
|
|
41
|
+
resources: []
|
|
42
|
+
}, e.push(t)), t.resources.push(n);
|
|
43
|
+
}
|
|
44
|
+
return e;
|
|
45
|
+
}, [T.resources]), z = f(() => R.flatMap((e) => e.name !== void 0 && L.has(e.name) ? [] : e.resources.map((e) => ({
|
|
46
|
+
key: e.id,
|
|
47
|
+
day: x,
|
|
48
|
+
resourceId: e.id || void 0
|
|
49
|
+
}))), [
|
|
50
|
+
R,
|
|
51
|
+
L,
|
|
52
|
+
x
|
|
53
|
+
]), B = ee({
|
|
54
|
+
axis: "x",
|
|
55
|
+
columns: z,
|
|
56
|
+
pxPerMinute: P,
|
|
57
|
+
scrollRef: O,
|
|
58
|
+
events: f(() => new Map(S.map((e) => [e.id, e])), [S]),
|
|
59
|
+
blocks: f(() => new Map(C.map((e) => [e.id, e])), [C]),
|
|
60
|
+
initialColumn: 0
|
|
61
|
+
}), { drag: V, cursor: H } = B, U = T.editLayer === "availability", W = f(() => {
|
|
62
|
+
let e = y / P;
|
|
63
|
+
return z.map((t) => {
|
|
64
|
+
let n = S.filter((e) => i(e.resourceId, t.resourceId, { emptyMatchesAll: !1 })).map((e) => b(e, x, D.min, D.max, E)).filter((e) => e !== null), r = a(n.map((t) => ({
|
|
65
|
+
id: t.item.id,
|
|
66
|
+
start: t.start,
|
|
67
|
+
end: Math.max(t.end, t.start + e)
|
|
68
|
+
}))), s = C.filter((e) => i(e.resourceId, t.resourceId, { emptyMatchesAll: !0 })).map((e) => b(e, x, D.min, D.max, E)).filter((e) => e !== null), c = U ? a(s.map((t) => ({
|
|
69
|
+
id: t.item.id,
|
|
70
|
+
start: t.start,
|
|
71
|
+
end: Math.max(t.end, t.start + e)
|
|
72
|
+
}))) : null, l = Math.max(1, r.count, c?.count ?? 0);
|
|
73
|
+
return {
|
|
74
|
+
placed: n,
|
|
75
|
+
lanes: r,
|
|
76
|
+
blocks: s,
|
|
77
|
+
blockLanes: c,
|
|
78
|
+
outside: T.hasAvailability && T.shadeOutsideAvailability ? o(D.min, D.max, s.map((e) => [e.start, e.end])) : [],
|
|
79
|
+
laneCount: l
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}, [
|
|
83
|
+
z,
|
|
84
|
+
S,
|
|
85
|
+
C,
|
|
86
|
+
x,
|
|
87
|
+
D.min,
|
|
88
|
+
D.max,
|
|
89
|
+
P,
|
|
90
|
+
U,
|
|
91
|
+
T.hasAvailability,
|
|
92
|
+
T.shadeOutsideAvailability,
|
|
93
|
+
E
|
|
94
|
+
]), G = p(!1), K = T.timeZone && T.scrollToMinute !== void 0 ? T.dates.minutesOfDay(T.dates.wallDateAtMinutes(x, T.scrollToMinute)) : T.scrollToMinute, q = T.scrollAlign;
|
|
95
|
+
d(() => {
|
|
96
|
+
let e = O.current;
|
|
97
|
+
if (!e || G.current) return;
|
|
98
|
+
G.current = !0;
|
|
99
|
+
let t = e.querySelector(".ui-cal-row-head")?.offsetWidth ?? 0, n = q === "center" ? (e.clientWidth - t) / 2 : 16;
|
|
100
|
+
e.scrollLeft = Math.max(0, ((K ?? 480) - D.min) * P - n);
|
|
101
|
+
}, [
|
|
102
|
+
K,
|
|
103
|
+
q,
|
|
104
|
+
D.min,
|
|
105
|
+
P
|
|
106
|
+
]);
|
|
107
|
+
let J = [], Y = Math.max(15, T.slotLabelInterval);
|
|
108
|
+
for (let e = Math.ceil(D.min / Y) * Y; e < D.max; e += Y) J.push(e);
|
|
109
|
+
let X = ae(T.now), se = T.nowIndicator && ie(x, T.now) && X >= D.min && X <= D.max, Z = V?.draft, ce = Z && (Z.target === "selection" ? Z.resourceId : Z.resourceIds), le = {
|
|
110
|
+
"--cal-hour": `${N}px`,
|
|
111
|
+
"--cal-offset": `${-(D.min % 60 * P)}px`
|
|
112
|
+
}, Q = "";
|
|
113
|
+
if (H) {
|
|
114
|
+
let e = z[H.column], t = e?.resourceId ? T.resourceById.get(e.resourceId) : void 0;
|
|
115
|
+
Q = `${t ? `${t.title}, ` : ""}${T.timeZone ? n(T.dates.dateAtMinutes(x, H.start), T) : r(H.start)} to ${T.timeZone ? n(T.dates.dateAtMinutes(x, H.end), T) : r(H.end)}`;
|
|
116
|
+
}
|
|
117
|
+
function $(e) {
|
|
118
|
+
oe((t) => {
|
|
119
|
+
let n = new Set(t);
|
|
120
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (k) return /* @__PURE__ */ h("div", {
|
|
124
|
+
className: "text-text-tertiary flex flex-1 items-center justify-center p-6 text-xs",
|
|
125
|
+
children: T.labels.noResources
|
|
126
|
+
});
|
|
127
|
+
let ue = 0;
|
|
128
|
+
return /* @__PURE__ */ h("div", {
|
|
129
|
+
ref: O,
|
|
130
|
+
"data-cal-drag": V?.draft.action,
|
|
131
|
+
className: "ui-cal-scroll ui-cal-timeline relative min-h-0 flex-1 overflow-auto",
|
|
132
|
+
children: /* @__PURE__ */ g("div", {
|
|
133
|
+
style: { width: `calc(var(--cal-row-head) + ${F}px)` },
|
|
134
|
+
children: [/* @__PURE__ */ g("div", {
|
|
135
|
+
className: "ui-cal-head border-border flex border-b",
|
|
136
|
+
children: [/* @__PURE__ */ h("div", { className: "ui-cal-row-head ui-cal-corner-x" }), /* @__PURE__ */ h("div", {
|
|
137
|
+
className: "relative h-7",
|
|
138
|
+
style: { width: F },
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
children: J.map((e) => /* @__PURE__ */ h("span", {
|
|
141
|
+
className: "text-text-tertiary font-mono absolute top-1.5 text-2xs",
|
|
142
|
+
style: { left: (e - D.min) * P + 4 },
|
|
143
|
+
children: T.timeZone ? n(T.dates.dateAtMinutes(x, e), T) : t(e, T)
|
|
144
|
+
}, e))
|
|
145
|
+
})]
|
|
146
|
+
}), /* @__PURE__ */ g("div", {
|
|
147
|
+
role: "group",
|
|
148
|
+
"aria-roledescription": "timeline",
|
|
149
|
+
"aria-label": w,
|
|
150
|
+
"aria-describedby": I,
|
|
151
|
+
tabIndex: 0,
|
|
152
|
+
className: "ui-cal-surface select-none focus-visible:outline-none",
|
|
153
|
+
onPointerDown: B.onPointerDown,
|
|
154
|
+
onFocus: B.onGridFocus,
|
|
155
|
+
onBlur: B.onGridBlur,
|
|
156
|
+
onKeyDown: B.onGridKeyDown,
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ h("span", {
|
|
159
|
+
id: I,
|
|
160
|
+
className: "sr-only",
|
|
161
|
+
children: T.labels.gridHelp
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ h("span", {
|
|
164
|
+
className: "sr-only",
|
|
165
|
+
"aria-live": "polite",
|
|
166
|
+
children: Q
|
|
167
|
+
}),
|
|
168
|
+
R.map((t) => {
|
|
169
|
+
let n = t.name !== void 0 && L.has(t.name);
|
|
170
|
+
return /* @__PURE__ */ g("div", { children: [t.name !== void 0 && /* @__PURE__ */ h("div", {
|
|
171
|
+
className: "bg-bg-pinned border-border flex border-b",
|
|
172
|
+
children: /* @__PURE__ */ g("button", {
|
|
173
|
+
type: "button",
|
|
174
|
+
className: "ui-cal-group text-text-secondary hover:text-text-primary flex cursor-pointer items-center gap-1 px-2 py-1 text-2xs font-semibold uppercase transition-colors duration-[100ms]",
|
|
175
|
+
"aria-expanded": !n,
|
|
176
|
+
onClick: () => $(t.name),
|
|
177
|
+
children: [
|
|
178
|
+
h(n ? re : ne, { className: "h-3 w-3" }),
|
|
179
|
+
t.name,
|
|
180
|
+
/* @__PURE__ */ h("span", {
|
|
181
|
+
className: "text-text-tertiary font-normal",
|
|
182
|
+
children: t.resources.length
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
}), !n && t.resources.map((t) => {
|
|
187
|
+
let n = ue++, r = W[n], a = z[n];
|
|
188
|
+
if (!r || !a) return null;
|
|
189
|
+
let o = r.laneCount * _ + v * 2;
|
|
190
|
+
return /* @__PURE__ */ g("div", {
|
|
191
|
+
className: "border-border flex border-b",
|
|
192
|
+
children: [/* @__PURE__ */ g("div", {
|
|
193
|
+
className: "ui-cal-row-head flex items-center gap-1.5 px-2",
|
|
194
|
+
title: t.title,
|
|
195
|
+
children: [t.color && /* @__PURE__ */ h("span", {
|
|
196
|
+
className: e("ui-cal-dot", `ui-cal-c-${t.color}`),
|
|
197
|
+
"aria-hidden": "true"
|
|
198
|
+
}), /* @__PURE__ */ g("span", {
|
|
199
|
+
className: "min-w-0",
|
|
200
|
+
children: [/* @__PURE__ */ h("span", {
|
|
201
|
+
className: "text-text-primary block truncate text-xs font-medium",
|
|
202
|
+
children: t.title
|
|
203
|
+
}), t.subtitle && /* @__PURE__ */ h("span", {
|
|
204
|
+
className: "text-text-tertiary block truncate text-2xs",
|
|
205
|
+
children: t.subtitle
|
|
206
|
+
})]
|
|
207
|
+
})]
|
|
208
|
+
}), /* @__PURE__ */ g("div", {
|
|
209
|
+
"data-cal-col": n,
|
|
210
|
+
className: "ui-cal-lines-x relative shrink-0",
|
|
211
|
+
style: {
|
|
212
|
+
...le,
|
|
213
|
+
width: F,
|
|
214
|
+
height: o
|
|
215
|
+
},
|
|
216
|
+
children: [
|
|
217
|
+
r.outside.map(([e, t]) => /* @__PURE__ */ h("div", {
|
|
218
|
+
className: "ui-cal-outside",
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
style: {
|
|
221
|
+
top: 0,
|
|
222
|
+
bottom: 0,
|
|
223
|
+
left: (e - D.min) * P,
|
|
224
|
+
width: (t - e) * P
|
|
225
|
+
}
|
|
226
|
+
}, `o${e}`)),
|
|
227
|
+
r.blocks.map((e) => {
|
|
228
|
+
let t = r.blockLanes?.lanes.get(e.item.id);
|
|
229
|
+
return /* @__PURE__ */ h(c, {
|
|
230
|
+
block: e.item,
|
|
231
|
+
resizeEdge: "right",
|
|
232
|
+
continuesAfter: e.continuesAfter,
|
|
233
|
+
dragging: V?.itemId === e.item.id,
|
|
234
|
+
style: {
|
|
235
|
+
left: (e.start - D.min) * P,
|
|
236
|
+
width: Math.max((e.end - e.start) * P, 4),
|
|
237
|
+
top: t === void 0 ? 0 : v + t * _,
|
|
238
|
+
height: t === void 0 ? "100%" : _ - 3
|
|
239
|
+
},
|
|
240
|
+
onKeyDown: (t) => B.onItemKeyDown(t, "availability", e.item.id, n),
|
|
241
|
+
onClick: (t) => {
|
|
242
|
+
t.detail === 0 && T.clickBlock(e.item);
|
|
243
|
+
}
|
|
244
|
+
}, e.item.id);
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ h("div", {
|
|
247
|
+
className: e("absolute inset-0", U && "ui-cal-muted-layer"),
|
|
248
|
+
children: r.placed.map((e) => {
|
|
249
|
+
let t = r.lanes.lanes.get(e.item.id) ?? 0;
|
|
250
|
+
return /* @__PURE__ */ h(l, {
|
|
251
|
+
event: e.item,
|
|
252
|
+
compact: !1,
|
|
253
|
+
dense: !0,
|
|
254
|
+
resizeEdge: "right",
|
|
255
|
+
continuesBefore: e.continuesBefore,
|
|
256
|
+
continuesAfter: e.continuesAfter,
|
|
257
|
+
dragging: V?.itemId === e.item.id,
|
|
258
|
+
style: {
|
|
259
|
+
left: (e.start - D.min) * P + 1,
|
|
260
|
+
width: Math.max((e.end - e.start) * P, y) - 2,
|
|
261
|
+
top: v + t * _,
|
|
262
|
+
height: _ - 3,
|
|
263
|
+
justifyContent: "center"
|
|
264
|
+
},
|
|
265
|
+
onKeyDown: (t) => B.onItemKeyDown(t, "event", e.item.id, n),
|
|
266
|
+
onClick: (t) => {
|
|
267
|
+
t.detail === 0 && T.clickEvent(e.item);
|
|
268
|
+
}
|
|
269
|
+
}, e.item.id);
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
se && /* @__PURE__ */ h("div", {
|
|
273
|
+
className: "ui-cal-now",
|
|
274
|
+
"data-axis": "x",
|
|
275
|
+
style: { left: (X - D.min) * P }
|
|
276
|
+
}),
|
|
277
|
+
Z && i(ce, a.resourceId, { emptyMatchesAll: !0 }) && (() => {
|
|
278
|
+
let e = b(Z, x, D.min, D.max, E);
|
|
279
|
+
return e ? /* @__PURE__ */ h(u, {
|
|
280
|
+
draft: Z,
|
|
281
|
+
invalid: V?.invalid,
|
|
282
|
+
style: {
|
|
283
|
+
left: (e.start - D.min) * P + 1,
|
|
284
|
+
width: Math.max((e.end - e.start) * P - 2, y),
|
|
285
|
+
top: v,
|
|
286
|
+
bottom: v
|
|
287
|
+
}
|
|
288
|
+
}) : null;
|
|
289
|
+
})(),
|
|
290
|
+
H?.column === n && /* @__PURE__ */ h("div", {
|
|
291
|
+
"data-cal-cursor": !0,
|
|
292
|
+
className: "ui-cal-cursor",
|
|
293
|
+
style: {
|
|
294
|
+
top: 0,
|
|
295
|
+
bottom: 0,
|
|
296
|
+
left: (H.start - D.min) * P,
|
|
297
|
+
width: (H.end - H.start) * P
|
|
298
|
+
}
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
})]
|
|
302
|
+
}, t.id || "__all");
|
|
303
|
+
})] }, t.name ?? "__ungrouped");
|
|
304
|
+
})
|
|
305
|
+
]
|
|
306
|
+
})]
|
|
307
|
+
})
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { x as TimelineView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
//#region src/components/ui/calendar/context.ts
|
|
3
|
+
var n = e(null);
|
|
4
|
+
function r() {
|
|
5
|
+
let e = t(n);
|
|
6
|
+
if (!e) throw Error("Calendar views must render inside <Calendar>");
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as CalendarContext, r as useCalendarContext };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
2
|
+
import { formatTimeRange as t } from "../../../lib/calendar.js";
|
|
3
|
+
import { useCalendarContext as n } from "./context.js";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/calendar/items.tsx
|
|
6
|
+
function o({ event: o, style: c, resizeEdge: l, compact: u, dense: d, continuesBefore: f, continuesAfter: p, dragging: m, onKeyDown: h, onClick: g }) {
|
|
7
|
+
let _ = n(), v = _.canEditEvent(o), y = o.allDay ? _.labels.allDay : t(o.start, o.end, _), { display: b } = _, x = b.status ? _.statusLabel(o) : void 0, S = [b.time && y, x].filter(Boolean).join(" · "), C = !!o.placeholder, w = _.renderEvent?.(o, {
|
|
8
|
+
view: _.view,
|
|
9
|
+
compact: u,
|
|
10
|
+
timeLabel: y,
|
|
11
|
+
statusLabel: x
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
14
|
+
role: C ? void 0 : "button",
|
|
15
|
+
tabIndex: C ? void 0 : 0,
|
|
16
|
+
"aria-hidden": C || void 0,
|
|
17
|
+
"data-cal-item": C ? void 0 : "event",
|
|
18
|
+
"data-cal-id": o.id,
|
|
19
|
+
"data-status": o.status ?? "confirmed",
|
|
20
|
+
"data-placeholder": C || void 0,
|
|
21
|
+
"data-editable": v || void 0,
|
|
22
|
+
"data-dragging": m || void 0,
|
|
23
|
+
"data-continues-before": f || void 0,
|
|
24
|
+
"data-continues-after": p || void 0,
|
|
25
|
+
"aria-label": C ? void 0 : _.describeEvent(o),
|
|
26
|
+
"aria-describedby": !C && (v || _.hasEventClick) ? _.itemHelpId : void 0,
|
|
27
|
+
title: `${o.title}\n${y}${o.description ? `\n${o.description}` : ""}`,
|
|
28
|
+
className: e("ui-cal-event", `ui-cal-c-${_.eventColor(o)}`),
|
|
29
|
+
style: c,
|
|
30
|
+
onKeyDown: C ? void 0 : h,
|
|
31
|
+
onClick: C ? void 0 : g,
|
|
32
|
+
children: [w ?? (d ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", {
|
|
33
|
+
className: "ui-cal-title",
|
|
34
|
+
children: o.title
|
|
35
|
+
}), S && /* @__PURE__ */ i("span", {
|
|
36
|
+
className: "ui-cal-meta font-mono",
|
|
37
|
+
children: S
|
|
38
|
+
})] }) : /* @__PURE__ */ i(s, {
|
|
39
|
+
event: o,
|
|
40
|
+
compact: u,
|
|
41
|
+
timeLabel: b.time ? y : void 0,
|
|
42
|
+
statusLabel: x,
|
|
43
|
+
description: b.description ? o.description : void 0,
|
|
44
|
+
badge: b.badge ? o.badge : void 0
|
|
45
|
+
})), l && v && !p && /* @__PURE__ */ i("div", {
|
|
46
|
+
"data-cal-resize": !0,
|
|
47
|
+
"data-edge": l,
|
|
48
|
+
className: "ui-cal-resize",
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function s({ event: e, compact: t, timeLabel: n, statusLabel: o, description: s, badge: c }) {
|
|
54
|
+
return t ? /* @__PURE__ */ a("div", {
|
|
55
|
+
className: "flex min-w-0 items-center gap-1",
|
|
56
|
+
children: [/* @__PURE__ */ a("span", {
|
|
57
|
+
className: "ui-cal-title min-w-0",
|
|
58
|
+
children: [e.title, !e.allDay && n && /* @__PURE__ */ a("span", {
|
|
59
|
+
className: "ui-cal-inline-time font-mono",
|
|
60
|
+
children: [", ", n.split("–")[0]]
|
|
61
|
+
})]
|
|
62
|
+
}), o && /* @__PURE__ */ i("span", {
|
|
63
|
+
className: "ui-cal-badge shrink-0",
|
|
64
|
+
children: o
|
|
65
|
+
})]
|
|
66
|
+
}) : /* @__PURE__ */ a(r, { children: [
|
|
67
|
+
/* @__PURE__ */ i("span", {
|
|
68
|
+
className: "ui-cal-title",
|
|
69
|
+
children: e.title
|
|
70
|
+
}),
|
|
71
|
+
n && /* @__PURE__ */ i("span", {
|
|
72
|
+
className: "ui-cal-meta font-mono",
|
|
73
|
+
children: n
|
|
74
|
+
}),
|
|
75
|
+
s && /* @__PURE__ */ i("span", {
|
|
76
|
+
className: "ui-cal-meta",
|
|
77
|
+
children: s
|
|
78
|
+
}),
|
|
79
|
+
(o || c) && /* @__PURE__ */ a("span", {
|
|
80
|
+
className: "flex min-w-0 flex-wrap gap-1",
|
|
81
|
+
children: [o && /* @__PURE__ */ i("span", {
|
|
82
|
+
className: "ui-cal-badge",
|
|
83
|
+
children: o
|
|
84
|
+
}), c && /* @__PURE__ */ i("span", {
|
|
85
|
+
className: "ui-cal-badge",
|
|
86
|
+
children: c
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function c({ block: r, style: o, resizeEdge: s, continuesAfter: c, dragging: l, onKeyDown: u, onClick: d }) {
|
|
92
|
+
let f = n(), p = f.editLayer === "availability", m = p && f.canEditBlock(r), h = r.kind ?? "available", g = r.label ?? (h === "available" ? f.labels.available : f.labels.unavailable), _ = p && !r.placeholder && (m || f.hasBlockClick);
|
|
93
|
+
return h === "available" && !p && !f.display.availableBlocks ? null : /* @__PURE__ */ a("div", {
|
|
94
|
+
role: _ ? "button" : void 0,
|
|
95
|
+
tabIndex: _ ? 0 : void 0,
|
|
96
|
+
"aria-label": _ ? f.describeBlock(r) : void 0,
|
|
97
|
+
"aria-describedby": _ ? f.itemHelpId : void 0,
|
|
98
|
+
"aria-hidden": _ ? void 0 : !0,
|
|
99
|
+
"data-cal-item": _ ? "availability" : void 0,
|
|
100
|
+
"data-cal-id": r.id,
|
|
101
|
+
"data-kind": h,
|
|
102
|
+
"data-placeholder": r.placeholder || void 0,
|
|
103
|
+
"data-edit": p || void 0,
|
|
104
|
+
"data-readonly": p && !m ? !0 : void 0,
|
|
105
|
+
"data-dragging": l || void 0,
|
|
106
|
+
className: e("ui-cal-avail", `ui-cal-c-${f.blockColor(r)}`),
|
|
107
|
+
style: o,
|
|
108
|
+
onKeyDown: _ ? u : void 0,
|
|
109
|
+
onClick: _ ? d : void 0,
|
|
110
|
+
children: [
|
|
111
|
+
f.display.blockLabels && /* @__PURE__ */ i("span", {
|
|
112
|
+
className: "block truncate font-medium",
|
|
113
|
+
children: g
|
|
114
|
+
}),
|
|
115
|
+
p && f.display.time && /* @__PURE__ */ i("span", {
|
|
116
|
+
className: "ui-cal-meta font-mono block",
|
|
117
|
+
children: t(r.start, r.end, f)
|
|
118
|
+
}),
|
|
119
|
+
s && m && !c && /* @__PURE__ */ i("div", {
|
|
120
|
+
"data-cal-resize": !0,
|
|
121
|
+
"data-edge": s,
|
|
122
|
+
className: "ui-cal-resize",
|
|
123
|
+
"aria-hidden": "true"
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function l({ draft: e, invalid: r, style: o }) {
|
|
129
|
+
let s = n(), c = e.target === "event" ? e.event.title : e.target === "availability" ? e.availability.label ?? s.labels.available : void 0;
|
|
130
|
+
return /* @__PURE__ */ a("div", {
|
|
131
|
+
className: "ui-cal-ghost",
|
|
132
|
+
"data-invalid": r ? !0 : void 0,
|
|
133
|
+
style: o,
|
|
134
|
+
"aria-hidden": "true",
|
|
135
|
+
children: [
|
|
136
|
+
c && /* @__PURE__ */ i("div", {
|
|
137
|
+
className: "ui-cal-title",
|
|
138
|
+
children: c
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ i("div", {
|
|
141
|
+
className: "font-mono",
|
|
142
|
+
children: t(e.start, e.end, s)
|
|
143
|
+
}),
|
|
144
|
+
r && /* @__PURE__ */ i("div", {
|
|
145
|
+
className: "text-danger-fg font-medium",
|
|
146
|
+
children: r
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { c as BlockBox, o as EventBox, l as Ghost };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/components/ui/calendar/types.ts
|
|
2
|
+
var e = {
|
|
3
|
+
today: "Today",
|
|
4
|
+
previous: "Previous",
|
|
5
|
+
next: "Next",
|
|
6
|
+
view: "View",
|
|
7
|
+
allDay: "All day",
|
|
8
|
+
more: (e) => `+${e} more`,
|
|
9
|
+
eventCount: (e) => `${e} ${e === 1 ? "event" : "events"}`,
|
|
10
|
+
showLess: "Show less",
|
|
11
|
+
noEvents: "Nothing scheduled",
|
|
12
|
+
noResources: "No resources to show",
|
|
13
|
+
earlier: (e) => `${e} earlier`,
|
|
14
|
+
later: (e) => `${e} later`,
|
|
15
|
+
available: "Available",
|
|
16
|
+
unavailable: "Unavailable",
|
|
17
|
+
loading: "Loading",
|
|
18
|
+
close: "Close",
|
|
19
|
+
views: {
|
|
20
|
+
day: "Day",
|
|
21
|
+
threeDay: "3 days",
|
|
22
|
+
workWeek: "Work week",
|
|
23
|
+
week: "Week",
|
|
24
|
+
month: "Month",
|
|
25
|
+
agenda: "Agenda",
|
|
26
|
+
timeline: "Timeline"
|
|
27
|
+
},
|
|
28
|
+
status: {
|
|
29
|
+
confirmed: "Confirmed",
|
|
30
|
+
tentative: "Tentative",
|
|
31
|
+
held: "Held",
|
|
32
|
+
cancelled: "Cancelled"
|
|
33
|
+
},
|
|
34
|
+
gridHelp: "Arrow keys move the time cursor, Shift with arrows extends it, Enter creates, Escape clears.",
|
|
35
|
+
itemHelp: "Enter opens. Alt with arrow keys moves it, Alt and Shift with arrow keys changes its length."
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { e as DEFAULT_CALENDAR_LABELS };
|