@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,411 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { mergeRefs as t } from "../../lib/mergeRefs.js";
|
|
3
|
+
import { useFocusTrap as n } from "../../hooks/useFocusTrap.js";
|
|
4
|
+
import { OverlayContext as r, useBodyScrollLock as i, useOverlayEscape as a } from "../../hooks/useOverlayStack.js";
|
|
5
|
+
import { PortalContainerContext as o, usePortalContainerRef as s } from "../../hooks/usePortalContainer.js";
|
|
6
|
+
import { placeAgainstAnchor as c } from "../../lib/anchorPlacement.js";
|
|
7
|
+
import { useControlSize as l } from "../../providers/ControlSizeContext.js";
|
|
8
|
+
import { Button as u } from "./Button.js";
|
|
9
|
+
import { clampDragOffset as d, dragMarginFromSpacing as f, dragTranslate as p, nudgeDelta as m } from "../../lib/dialogDrag.js";
|
|
10
|
+
import { clampDialogSize as h, resizeDelta as g, resizeLimits as _ } from "../../lib/dialogResize.js";
|
|
11
|
+
import { useId as v, useLayoutEffect as y, useMemo as b, useRef as x } from "react";
|
|
12
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
13
|
+
import { GripVertical as w, HandleBottomRight as T, X as E } from "lucide-react";
|
|
14
|
+
import { createPortal as D } from "react-dom";
|
|
15
|
+
//#region src/components/ui/Dialog.tsx
|
|
16
|
+
var O = {
|
|
17
|
+
sm: "max-w-[400px]",
|
|
18
|
+
md: "max-w-[576px]",
|
|
19
|
+
lg: "max-w-[768px]",
|
|
20
|
+
xl: "max-w-[1024px]"
|
|
21
|
+
}, k = "(min-width: 48rem)", A = "a[href], button, input, select, textarea, label, summary, [contenteditable]:not([contenteditable=\"false\"]), [role=\"button\"], [role=\"link\"], [tabindex]:not([tabindex=\"-1\"])", j = {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0
|
|
24
|
+
};
|
|
25
|
+
function M(e) {
|
|
26
|
+
let t = e.getBoundingClientRect();
|
|
27
|
+
return {
|
|
28
|
+
left: t.left,
|
|
29
|
+
top: t.top,
|
|
30
|
+
right: t.left + e.clientWidth,
|
|
31
|
+
bottom: t.top + e.clientHeight
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
var N = {
|
|
35
|
+
top: "bottom",
|
|
36
|
+
bottom: "top",
|
|
37
|
+
left: "right",
|
|
38
|
+
right: "left"
|
|
39
|
+
};
|
|
40
|
+
function P(e, t) {
|
|
41
|
+
return {
|
|
42
|
+
x: e.x + t.x,
|
|
43
|
+
y: e.y + t.y
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function F(e, t) {
|
|
47
|
+
let n = t.getBoundingClientRect();
|
|
48
|
+
return {
|
|
49
|
+
left: n.left + e.offsetLeft - t.scrollLeft,
|
|
50
|
+
top: n.top + e.offsetTop - t.scrollTop,
|
|
51
|
+
width: e.offsetWidth,
|
|
52
|
+
height: e.offsetHeight
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function I(e, t) {
|
|
56
|
+
if (!(e instanceof HTMLElement) || !e.isConnected) return null;
|
|
57
|
+
let n = e.ownerDocument;
|
|
58
|
+
return e === n.body || e === n.documentElement || t.contains(e) ? null : e.getClientRects().length > 0 ? e : null;
|
|
59
|
+
}
|
|
60
|
+
function L(e) {
|
|
61
|
+
return e.ownerDocument.defaultView?.matchMedia(k).matches ?? !1;
|
|
62
|
+
}
|
|
63
|
+
function R(e) {
|
|
64
|
+
let t = e.ownerDocument.defaultView;
|
|
65
|
+
return t ? f(t.getComputedStyle(e).getPropertyValue("--spacing"), parseFloat(t.getComputedStyle(e.ownerDocument.documentElement).fontSize)) : 8;
|
|
66
|
+
}
|
|
67
|
+
function z(e, t, n) {
|
|
68
|
+
e.style.width = n ? `${n.width}px` : "", e.style.height = n ? `${n.height}px` : "", e.style.maxWidth = n ? "none" : "", t && (t.style.flex = n ? "1 1 0%" : "", t.style.minHeight = n ? "0" : "", t.style.overflowY = n ? "auto" : "");
|
|
69
|
+
}
|
|
70
|
+
function B(e, t) {
|
|
71
|
+
return {
|
|
72
|
+
width: 280,
|
|
73
|
+
height: e.offsetHeight - (t?.offsetHeight ?? 0) + 48
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function V({ open: e, draggable: t, resizable: n, remember: r, placement: i, anchorRef: a }, o, s, l) {
|
|
77
|
+
let u = x(j), f = x(j), v = x(8), b = x(null), S = x(null), C = x(null), w = x(!1), T = x(null), E = e && t, D = e && n, O = r && (t || n);
|
|
78
|
+
y(() => {
|
|
79
|
+
let t = o.current, r = E ? s.current : null, m = l.current, g = t?.parentElement, y = t?.ownerDocument.defaultView, x = i !== "center";
|
|
80
|
+
if (O || (C.current = null), (!e && !O || !n) && (T.current = null), !e || !t || !g || !y || !r && !x && !D) return;
|
|
81
|
+
let k = x ? I(t.ownerDocument.activeElement, t) : null, A = () => x ? I(a?.current, t) ?? I(k, t) : null, V = () => P(f.current, u.current), H = () => {
|
|
82
|
+
t.style.translate = p(V());
|
|
83
|
+
}, U = () => {
|
|
84
|
+
let e = F(t, g);
|
|
85
|
+
if (w.current && C.current) {
|
|
86
|
+
f.current = {
|
|
87
|
+
x: C.current.left - e.left,
|
|
88
|
+
y: C.current.top - e.top
|
|
89
|
+
}, u.current = j, t.dataset.placement = "remembered", t.style.transformOrigin = "";
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let n = L(t) ? A() : null, r = x && n ? c(i, n.getBoundingClientRect(), {
|
|
93
|
+
size: {
|
|
94
|
+
width: e.width,
|
|
95
|
+
height: e.height
|
|
96
|
+
},
|
|
97
|
+
bounds: M(g),
|
|
98
|
+
margin: v.current,
|
|
99
|
+
gap: v.current
|
|
100
|
+
}) : null;
|
|
101
|
+
f.current = r ? {
|
|
102
|
+
x: r.left - e.left,
|
|
103
|
+
y: r.top - e.top
|
|
104
|
+
} : j, t.dataset.placement = r?.side ?? "center", t.style.transformOrigin = r ? N[r.side] : "";
|
|
105
|
+
}, W = () => {
|
|
106
|
+
let e = u.current;
|
|
107
|
+
if (!r && !w.current || !w.current && e.x === 0 && e.y === 0) return;
|
|
108
|
+
let n = V(), i = d(n, n, t.getBoundingClientRect(), (r ?? s.current ?? t).getBoundingClientRect(), M(g), v.current);
|
|
109
|
+
if (u.current = {
|
|
110
|
+
x: i.x - f.current.x,
|
|
111
|
+
y: i.y - f.current.y
|
|
112
|
+
}, H(), w.current) {
|
|
113
|
+
let e = F(t, g);
|
|
114
|
+
C.current = {
|
|
115
|
+
left: e.left + i.x,
|
|
116
|
+
top: e.top + i.y
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, G = () => {
|
|
120
|
+
v.current = R(t), L(t) || (b.current = null, S.current = null, u.current = j, w.current = !1, C.current = null, T.current && z(t, m, null), T.current = null);
|
|
121
|
+
let e = T.current;
|
|
122
|
+
if (e && !S.current) {
|
|
123
|
+
let n = M(g), r = v.current, i = w.current && C.current ? C.current : {
|
|
124
|
+
left: n.left + r,
|
|
125
|
+
top: n.top + r
|
|
126
|
+
}, a = h(e, _(i, e, B(t, m), n, r)), o = Math.max(n.left + r, Math.min(i.left, n.right - r - a.width)), s = Math.max(n.top + r, Math.min(i.top, n.bottom - r - a.height));
|
|
127
|
+
(a.width !== e.width || a.height !== e.height) && (T.current = a, z(t, m, a)), w.current && (o !== i.left || s !== i.top) && (C.current = {
|
|
128
|
+
left: o,
|
|
129
|
+
top: s
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
b.current || U(), H(), W();
|
|
133
|
+
}, K = 0, q = () => {
|
|
134
|
+
K ||= y.requestAnimationFrame(() => {
|
|
135
|
+
K = 0, G();
|
|
136
|
+
});
|
|
137
|
+
}, J = (e) => {
|
|
138
|
+
e.target === t && W();
|
|
139
|
+
}, Y = "ResizeObserver" in y ? new y.ResizeObserver(q) : null;
|
|
140
|
+
return w.current = O && C.current !== null, D && T.current && z(t, m, T.current), G(), y.addEventListener("resize", q), y.addEventListener("scroll", q, {
|
|
141
|
+
capture: !0,
|
|
142
|
+
passive: !0
|
|
143
|
+
}), t.addEventListener("animationend", J), Y?.observe(t), () => {
|
|
144
|
+
y.cancelAnimationFrame(K), y.removeEventListener("resize", q), y.removeEventListener("scroll", q, { capture: !0 }), t.removeEventListener("animationend", J), Y?.disconnect(), b.current = null, S.current = null, f.current = j, u.current = j, w.current = !1, t.style.translate = "", t.style.transformOrigin = "", D && (t.style.userSelect = "", z(t, m, null)), delete t.dataset.placement;
|
|
145
|
+
};
|
|
146
|
+
}, [
|
|
147
|
+
e,
|
|
148
|
+
E,
|
|
149
|
+
D,
|
|
150
|
+
n,
|
|
151
|
+
O,
|
|
152
|
+
i,
|
|
153
|
+
a,
|
|
154
|
+
o,
|
|
155
|
+
s,
|
|
156
|
+
l
|
|
157
|
+
]);
|
|
158
|
+
let k = (e, t) => {
|
|
159
|
+
let n = P(f.current, u.current), r = F(e, t);
|
|
160
|
+
C.current = {
|
|
161
|
+
left: r.left + n.x,
|
|
162
|
+
top: r.top + n.y
|
|
163
|
+
}, f.current = n, u.current = j, w.current = !0, e.dataset.placement = "remembered", e.style.transformOrigin = "";
|
|
164
|
+
}, V = (e) => s.current ?? e, H = (e) => {
|
|
165
|
+
let t = o.current, n = e.currentTarget, r = t?.parentElement;
|
|
166
|
+
if (!t || !r || e.button !== 0 || !e.isPrimary || S.current) return;
|
|
167
|
+
let i = e.target.closest(A);
|
|
168
|
+
i && i !== n && n.contains(i) || !L(t) || (e.preventDefault(), n.setPointerCapture(e.pointerId), n.style.cursor = "grabbing", b.current = {
|
|
169
|
+
pointerId: e.pointerId,
|
|
170
|
+
startX: e.clientX,
|
|
171
|
+
startY: e.clientY,
|
|
172
|
+
origin: P(f.current, u.current),
|
|
173
|
+
dialog: t.getBoundingClientRect(),
|
|
174
|
+
handle: V(n).getBoundingClientRect(),
|
|
175
|
+
bounds: M(r),
|
|
176
|
+
margin: v.current,
|
|
177
|
+
moved: !1
|
|
178
|
+
});
|
|
179
|
+
}, U = (e) => {
|
|
180
|
+
let t = b.current, n = o.current;
|
|
181
|
+
if (!t || t.pointerId !== e.pointerId || !n) return;
|
|
182
|
+
let r = d({
|
|
183
|
+
x: t.origin.x + e.clientX - t.startX,
|
|
184
|
+
y: t.origin.y + e.clientY - t.startY
|
|
185
|
+
}, t.origin, t.dialog, t.handle, t.bounds, t.margin);
|
|
186
|
+
t.moved ||= r.x !== t.origin.x || r.y !== t.origin.y, u.current = {
|
|
187
|
+
x: r.x - f.current.x,
|
|
188
|
+
y: r.y - f.current.y
|
|
189
|
+
}, n.style.translate = p(r);
|
|
190
|
+
}, W = (e) => {
|
|
191
|
+
let t = b.current, n = e.currentTarget;
|
|
192
|
+
if ((!t || t.pointerId === e.pointerId) && n.style.cursor === "grabbing" && (n.style.cursor = ""), t?.pointerId !== e.pointerId) return;
|
|
193
|
+
b.current = null;
|
|
194
|
+
let r = o.current, i = r?.parentElement;
|
|
195
|
+
!(O || w.current) || !t.moved || !r || !i || k(r, i);
|
|
196
|
+
}, G = (e) => {
|
|
197
|
+
let t = m(e.key, e.shiftKey), n = o.current, r = n?.parentElement;
|
|
198
|
+
if (!t || e.altKey || e.ctrlKey || e.metaKey || !n || !r || b.current || S.current || !L(n)) return;
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
let i = P(f.current, u.current), a = d({
|
|
201
|
+
x: i.x + t.x,
|
|
202
|
+
y: i.y + t.y
|
|
203
|
+
}, i, n.getBoundingClientRect(), V(e.currentTarget).getBoundingClientRect(), M(r), v.current);
|
|
204
|
+
a.x === i.x && a.y === i.y || (u.current = {
|
|
205
|
+
x: a.x - f.current.x,
|
|
206
|
+
y: a.y - f.current.y
|
|
207
|
+
}, n.style.translate = p(a), (O || w.current) && k(n, r));
|
|
208
|
+
}, K = (e, t, n) => {
|
|
209
|
+
(!w.current || !C.current) && k(e, t);
|
|
210
|
+
let r = C.current;
|
|
211
|
+
if (!r) return;
|
|
212
|
+
T.current = n, z(e, l.current, n);
|
|
213
|
+
let i = F(e, t);
|
|
214
|
+
f.current = {
|
|
215
|
+
x: r.left - i.left,
|
|
216
|
+
y: r.top - i.top
|
|
217
|
+
}, u.current = j, e.style.translate = p(f.current);
|
|
218
|
+
}, q = (e, t) => {
|
|
219
|
+
let n = F(e, t), r = P(f.current, u.current), i = {
|
|
220
|
+
width: n.width,
|
|
221
|
+
height: n.height
|
|
222
|
+
};
|
|
223
|
+
return {
|
|
224
|
+
current: i,
|
|
225
|
+
limits: _({
|
|
226
|
+
left: n.left + r.x,
|
|
227
|
+
top: n.top + r.y
|
|
228
|
+
}, i, B(e, l.current), M(t), v.current)
|
|
229
|
+
};
|
|
230
|
+
}, J = (e) => {
|
|
231
|
+
let t = o.current, n = t?.parentElement;
|
|
232
|
+
if (!t || !n || e.button !== 0 || !e.isPrimary || b.current || !L(t)) return;
|
|
233
|
+
e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), t.style.userSelect = "none";
|
|
234
|
+
let { current: r, limits: i } = q(t, n);
|
|
235
|
+
S.current = {
|
|
236
|
+
pointerId: e.pointerId,
|
|
237
|
+
startX: e.clientX,
|
|
238
|
+
startY: e.clientY,
|
|
239
|
+
start: r,
|
|
240
|
+
limits: i,
|
|
241
|
+
moved: !1
|
|
242
|
+
};
|
|
243
|
+
}, Y = (e) => {
|
|
244
|
+
let t = S.current, n = o.current, r = n?.parentElement;
|
|
245
|
+
if (!t || t.pointerId !== e.pointerId || !n || !r) return;
|
|
246
|
+
let i = h({
|
|
247
|
+
width: t.start.width + e.clientX - t.startX,
|
|
248
|
+
height: t.start.height + e.clientY - t.startY
|
|
249
|
+
}, t.limits), a = t.moved ? T.current : t.start;
|
|
250
|
+
i.width === a?.width && i.height === a.height || (t.moved = !0, K(n, r, i));
|
|
251
|
+
}, X = (e) => {
|
|
252
|
+
let t = S.current;
|
|
253
|
+
if (t && t.pointerId !== e.pointerId) return;
|
|
254
|
+
S.current = null;
|
|
255
|
+
let n = o.current;
|
|
256
|
+
n && (n.style.userSelect = "");
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
drag: E ? {
|
|
260
|
+
pointer: {
|
|
261
|
+
onPointerDown: H,
|
|
262
|
+
onPointerMove: U,
|
|
263
|
+
onPointerUp: W,
|
|
264
|
+
onPointerCancel: W,
|
|
265
|
+
onLostPointerCapture: W
|
|
266
|
+
},
|
|
267
|
+
onKeyDown: G
|
|
268
|
+
} : void 0,
|
|
269
|
+
resize: D ? {
|
|
270
|
+
pointer: {
|
|
271
|
+
onPointerDown: J,
|
|
272
|
+
onPointerMove: Y,
|
|
273
|
+
onPointerUp: X,
|
|
274
|
+
onPointerCancel: X,
|
|
275
|
+
onLostPointerCapture: X
|
|
276
|
+
},
|
|
277
|
+
onKeyDown: (e) => {
|
|
278
|
+
let t = g(e.key, e.shiftKey), n = o.current, r = n?.parentElement;
|
|
279
|
+
if (!t || e.altKey || e.ctrlKey || e.metaKey || !n || !r || b.current || S.current || !L(n)) return;
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
let { current: i, limits: a } = q(n, r), s = h({
|
|
282
|
+
width: i.width + t.width,
|
|
283
|
+
height: i.height + t.height
|
|
284
|
+
}, a);
|
|
285
|
+
s.width === i.width && s.height === i.height || K(n, r, s);
|
|
286
|
+
}
|
|
287
|
+
} : void 0
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function H({ open: c, onClose: d, title: f, children: p, footer: m, className: h, size: g = "sm", draggable: _ = !1, resizable: y = !1, rememberPosition: k = !1, placement: A = "center", anchorRef: j, role: M = "dialog", description: N, "aria-label": P, "aria-describedby": F, initialFocusRef: I, returnFocusRef: L, busy: R = !1, closeOnEscape: z = !0, closeOnOverlayClick: B = !0, hideCloseButton: H = !1, ref: U, ...W }) {
|
|
291
|
+
let G = l(), K = x(null), [q, J] = s(K), Y = b(() => t(U, J), [U, J]), X = x(null), ee = x(null), te = v(), ne = v();
|
|
292
|
+
n(K, c, {
|
|
293
|
+
initialFocusRef: I,
|
|
294
|
+
returnFocusRef: L
|
|
295
|
+
});
|
|
296
|
+
let { drag: Z, resize: Q } = V({
|
|
297
|
+
open: c,
|
|
298
|
+
draggable: _,
|
|
299
|
+
resizable: y,
|
|
300
|
+
remember: k,
|
|
301
|
+
placement: A,
|
|
302
|
+
anchorRef: j
|
|
303
|
+
}, K, X, ee), re = a(c, (e) => {
|
|
304
|
+
!z || R || (e.preventDefault(), d());
|
|
305
|
+
});
|
|
306
|
+
if (i(c), !c) return null;
|
|
307
|
+
let $ = Z && /* @__PURE__ */ S("button", {
|
|
308
|
+
type: "button",
|
|
309
|
+
"aria-label": "Move dialog",
|
|
310
|
+
title: "Move dialog: drag, or use the arrow keys (Shift for larger steps)",
|
|
311
|
+
"data-dialog-grip": "",
|
|
312
|
+
className: "text-text-tertiary hover:text-text-secondary hover:bg-bg-hover focus-visible:outline-accent order-first hidden h-5 w-5 shrink-0 cursor-grab items-center justify-center rounded-md transition-colors duration-[100ms] focus-visible:outline-2 focus-visible:outline-offset-2 md:flex md:touch-none md:select-none",
|
|
313
|
+
...Z.pointer,
|
|
314
|
+
onKeyDown: Z.onKeyDown,
|
|
315
|
+
children: /* @__PURE__ */ S(w, {
|
|
316
|
+
className: "h-3.5 w-3.5",
|
|
317
|
+
"aria-hidden": "true"
|
|
318
|
+
})
|
|
319
|
+
}), ie = Q && /* @__PURE__ */ S("button", {
|
|
320
|
+
type: "button",
|
|
321
|
+
"aria-label": "Resize dialog",
|
|
322
|
+
title: "Resize dialog: drag, or use the arrow keys (Shift for larger steps)",
|
|
323
|
+
"data-dialog-resize": "",
|
|
324
|
+
className: "text-text-tertiary hover:text-text-primary focus-visible:outline-accent absolute right-0.5 bottom-0.5 hidden h-4 w-4 cursor-nwse-resize items-center justify-center rounded-md transition-colors duration-[100ms] focus-visible:outline-2 focus-visible:outline-offset-0 md:flex md:touch-none md:select-none",
|
|
325
|
+
...Q.pointer,
|
|
326
|
+
onKeyDown: Q.onKeyDown,
|
|
327
|
+
children: /* @__PURE__ */ S(T, {
|
|
328
|
+
className: "h-4 w-4",
|
|
329
|
+
"aria-hidden": "true"
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
return D(/* @__PURE__ */ S(r.Provider, {
|
|
333
|
+
value: re,
|
|
334
|
+
children: /* @__PURE__ */ S(o.Provider, {
|
|
335
|
+
value: q,
|
|
336
|
+
children: /* @__PURE__ */ C("div", {
|
|
337
|
+
className: "fixed inset-0 z-50 flex items-start justify-center overflow-y-auto pt-4 md:pt-[5vh]",
|
|
338
|
+
children: [/* @__PURE__ */ S("div", {
|
|
339
|
+
className: "bg-bg-overlay fixed inset-0",
|
|
340
|
+
onClick: () => {
|
|
341
|
+
B && !R && d();
|
|
342
|
+
},
|
|
343
|
+
"aria-hidden": "true"
|
|
344
|
+
}), /* @__PURE__ */ C("div", {
|
|
345
|
+
...W,
|
|
346
|
+
ref: Y,
|
|
347
|
+
className: e(`relative z-50 mx-1 mb-8 flex w-full ${O[g]} flex-col`, "ui-glass bg-bg-secondary border-border rounded-lg border", "animate-scale-in shadow-lg", h),
|
|
348
|
+
role: M,
|
|
349
|
+
tabIndex: -1,
|
|
350
|
+
"aria-busy": R || void 0,
|
|
351
|
+
"aria-modal": "true",
|
|
352
|
+
"aria-labelledby": f ? te : W["aria-labelledby"],
|
|
353
|
+
"aria-label": P ?? (f ? void 0 : "Dialog"),
|
|
354
|
+
"aria-describedby": [N ? ne : void 0, F].filter(Boolean).join(" ") || void 0,
|
|
355
|
+
children: [
|
|
356
|
+
(f || !H || _) && /* @__PURE__ */ C("div", {
|
|
357
|
+
ref: X,
|
|
358
|
+
"data-control-size": G,
|
|
359
|
+
className: e("ui-bar border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2.5", _ && "md:cursor-move md:touch-none md:select-none"),
|
|
360
|
+
...Z?.pointer,
|
|
361
|
+
children: [f && /* @__PURE__ */ S("h3", {
|
|
362
|
+
id: te,
|
|
363
|
+
className: "text-text-primary min-w-0 text-sm font-medium",
|
|
364
|
+
children: f
|
|
365
|
+
}), !H && /* @__PURE__ */ S(u, {
|
|
366
|
+
type: "button",
|
|
367
|
+
variant: "icon",
|
|
368
|
+
size: "sm",
|
|
369
|
+
"aria-disabled": R || void 0,
|
|
370
|
+
onClick: () => {
|
|
371
|
+
R || d();
|
|
372
|
+
},
|
|
373
|
+
className: "ml-auto shrink-0",
|
|
374
|
+
"aria-label": "Close",
|
|
375
|
+
children: /* @__PURE__ */ S(E, { className: "h-4 w-4" })
|
|
376
|
+
})]
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ C("div", {
|
|
379
|
+
ref: ee,
|
|
380
|
+
className: "ui-surface-body p-3",
|
|
381
|
+
children: [N && /* @__PURE__ */ S("div", {
|
|
382
|
+
id: ne,
|
|
383
|
+
className: "text-text-secondary mb-3 text-xs",
|
|
384
|
+
children: N
|
|
385
|
+
}), p]
|
|
386
|
+
}),
|
|
387
|
+
m && /* @__PURE__ */ C("div", {
|
|
388
|
+
"data-control-size": G,
|
|
389
|
+
className: e("ui-bar border-border bg-bg-primary/50 flex shrink-0 rounded-b-lg border-t px-3 py-2.5", ie && "md:pr-6", $ ? "items-center gap-2" : "flex-col justify-center"),
|
|
390
|
+
children: [$ ? /* @__PURE__ */ S("div", {
|
|
391
|
+
className: "flex min-w-0 flex-1 flex-col justify-center",
|
|
392
|
+
children: m
|
|
393
|
+
}) : m, $]
|
|
394
|
+
}),
|
|
395
|
+
$ && !m && /* @__PURE__ */ S("div", {
|
|
396
|
+
className: "hidden px-3 pb-2 md:flex",
|
|
397
|
+
children: $
|
|
398
|
+
}),
|
|
399
|
+
ie && !m && !$ && /* @__PURE__ */ S("div", {
|
|
400
|
+
"data-dialog-resize-spacer": "",
|
|
401
|
+
className: "hidden h-5 md:block"
|
|
402
|
+
}),
|
|
403
|
+
ie
|
|
404
|
+
]
|
|
405
|
+
})]
|
|
406
|
+
})
|
|
407
|
+
})
|
|
408
|
+
}), document.body);
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
export { H as Dialog };
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
* />
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
import type { Ref } from "react";
|
|
37
|
+
import type { ComponentPropsWithRef, Ref } from "react";
|
|
38
38
|
import { type ButtonProps } from "./Button";
|
|
39
|
-
export interface DialogActionsProps {
|
|
39
|
+
export interface DialogActionsProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
40
40
|
/** Called when the Cancel button is clicked. */
|
|
41
41
|
onCancel: () => void;
|
|
42
42
|
/** Called when the Confirm button is clicked. */
|
|
@@ -64,4 +64,4 @@ export interface DialogActionsProps {
|
|
|
64
64
|
/** Disable the confirm button without showing the busy state. */
|
|
65
65
|
confirmDisabled?: boolean;
|
|
66
66
|
}
|
|
67
|
-
export declare function DialogActions({ onCancel, onConfirm, cancelLabel, confirmLabel, confirmVariant, className, busy, busyLabel, cancelRef, confirmRef, confirmDisabled, }: DialogActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export declare function DialogActions({ onCancel, onConfirm, cancelLabel, confirmLabel, confirmVariant, className, busy, busyLabel, cancelRef, confirmRef, confirmDisabled, ref, ...rest }: DialogActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { Button as t } from "./Button.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/DialogActions.tsx
|
|
5
|
+
function i({ onCancel: i, onConfirm: a, cancelLabel: o = "Cancel", confirmLabel: s = "Confirm", confirmVariant: c = "primary", className: l, busy: u = !1, busyLabel: d = "Working…", cancelRef: f, confirmRef: p, confirmDisabled: m = !1, ref: h, ...g }) {
|
|
6
|
+
return /* @__PURE__ */ r("div", {
|
|
7
|
+
...g,
|
|
8
|
+
ref: h,
|
|
9
|
+
className: e("flex justify-end gap-2", l),
|
|
10
|
+
"aria-busy": u || void 0,
|
|
11
|
+
children: [/* @__PURE__ */ n(t, {
|
|
12
|
+
ref: f,
|
|
13
|
+
type: "button",
|
|
14
|
+
variant: "ghost",
|
|
15
|
+
size: "sm",
|
|
16
|
+
"aria-disabled": u || void 0,
|
|
17
|
+
onClick: () => {
|
|
18
|
+
u || i();
|
|
19
|
+
},
|
|
20
|
+
children: o
|
|
21
|
+
}), /* @__PURE__ */ n(t, {
|
|
22
|
+
ref: p,
|
|
23
|
+
type: "button",
|
|
24
|
+
variant: c,
|
|
25
|
+
size: "sm",
|
|
26
|
+
"aria-disabled": u || m || void 0,
|
|
27
|
+
onClick: () => {
|
|
28
|
+
!u && !m && a();
|
|
29
|
+
},
|
|
30
|
+
children: u ? d : s
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { i as DialogActions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export interface DisclosureProps {
|
|
1
|
+
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
2
|
+
export interface DisclosureProps extends Omit<ComponentPropsWithRef<"div">, "title"> {
|
|
3
3
|
/** Summary content; use non-interactive content inside the trigger. */
|
|
4
4
|
title: ReactNode;
|
|
5
5
|
/** Current expanded state when controlled. */
|
|
@@ -16,4 +16,4 @@ export interface DisclosureProps {
|
|
|
16
16
|
/** Preserve child state while closed. Defaults to true. */
|
|
17
17
|
keepMounted?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare function Disclosure({ title, open, defaultOpen, onOpenChange, meta, children, className, keepMounted, }: DisclosureProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function Disclosure({ title, open, defaultOpen, onOpenChange, meta, children, className, keepMounted, ref, ...rest }: DisclosureProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { useId as t, useState as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronDown as a } from "lucide-react";
|
|
5
|
+
//#region src/components/ui/Disclosure.tsx
|
|
6
|
+
function o({ title: o, open: s, defaultOpen: c = !1, onOpenChange: l, meta: u, children: d, className: f, keepMounted: p = !0, ref: m, ...h }) {
|
|
7
|
+
let [g, _] = n(c), v = s ?? g, y = t();
|
|
8
|
+
function b() {
|
|
9
|
+
s === void 0 && _(!v), l?.(!v);
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ i("div", {
|
|
12
|
+
...h,
|
|
13
|
+
ref: m,
|
|
14
|
+
className: e("border-border rounded-md border", f),
|
|
15
|
+
children: [/* @__PURE__ */ i("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
id: `${y}-trigger`,
|
|
18
|
+
"aria-expanded": v,
|
|
19
|
+
"aria-controls": `${y}-content`,
|
|
20
|
+
onClick: b,
|
|
21
|
+
className: "text-text-primary hover:bg-bg-hover flex w-full cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-left text-sm font-medium transition-colors duration-[100ms] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r(a, {
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
className: e("text-text-tertiary h-3.5 w-3.5 shrink-0 transition-transform duration-[100ms]", !v && "-rotate-90")
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ r("span", {
|
|
28
|
+
className: "min-w-0 flex-1",
|
|
29
|
+
children: o
|
|
30
|
+
}),
|
|
31
|
+
u != null && /* @__PURE__ */ r("span", {
|
|
32
|
+
className: "text-text-tertiary shrink-0 text-xs font-normal",
|
|
33
|
+
children: u
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
}), /* @__PURE__ */ r("div", {
|
|
37
|
+
id: `${y}-content`,
|
|
38
|
+
hidden: !v,
|
|
39
|
+
className: "text-text-secondary px-3 py-2 text-xs",
|
|
40
|
+
children: (v || p) && d
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { o as Disclosure };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export interface DividerLabelProps {
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
export interface DividerLabelProps extends ComponentPropsWithRef<"div"> {
|
|
3
3
|
/** Label shown centred between the two rules. */
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
/** Additional utility classes for the root element. */
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function DividerLabel({ children, className }: DividerLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function DividerLabel({ children, className, ref, ...rest }: DividerLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/DividerLabel.tsx
|
|
4
|
+
function r({ children: r, className: i, ref: a, ...o }) {
|
|
5
|
+
return /* @__PURE__ */ n("div", {
|
|
6
|
+
...o,
|
|
7
|
+
ref: a,
|
|
8
|
+
className: e("my-6 flex items-center gap-3", i),
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ t("div", { className: "border-border flex-1 border-t" }),
|
|
11
|
+
/* @__PURE__ */ t("span", {
|
|
12
|
+
className: "text-text-tertiary text-xs",
|
|
13
|
+
children: r
|
|
14
|
+
}),
|
|
15
|
+
/* @__PURE__ */ t("div", { className: "border-border flex-1 border-t" })
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as DividerLabel };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnchorHTMLAttributes, type ElementType, type ReactNode, type RefAttributes } from "react";
|
|
1
|
+
import { type AnchorHTMLAttributes, type ComponentPropsWithRef, type ElementType, type ReactNode, type RefAttributes } from "react";
|
|
2
2
|
import { type ButtonProps } from "./Button";
|
|
3
3
|
interface DropdownItemContent {
|
|
4
4
|
label: string;
|
|
@@ -42,7 +42,7 @@ interface DropdownDivider {
|
|
|
42
42
|
divider: true;
|
|
43
43
|
}
|
|
44
44
|
export type DropdownItem = DropdownContentItem | DropdownDivider;
|
|
45
|
-
interface DropdownMenuBaseProps {
|
|
45
|
+
interface DropdownMenuBaseProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
46
46
|
/** Menu entries: actions, links (`label` + `href`), and dividers. */
|
|
47
47
|
items: DropdownItem[];
|
|
48
48
|
/** Informational content above, and outside, the menu items. */
|
|
@@ -87,5 +87,5 @@ export type DropdownMenuProps = DropdownMenuBaseProps & ({
|
|
|
87
87
|
* Space activates. Escape closes and returns focus to the trigger, as does
|
|
88
88
|
* choosing an item; Tab closes and moves on. Disabled items are skipped.
|
|
89
89
|
*/
|
|
90
|
-
export declare function DropdownMenu({ trigger, triggerIcon, triggerLabel, triggerSize, items, header, renderLink, align, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
export declare function DropdownMenu({ trigger, triggerIcon, triggerLabel, triggerSize, items, header, renderLink, align, ref, id, className, style, onKeyDown, onFocus, onBlur, ...rest }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
91
91
|
export {};
|