@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,88 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { sortRows as t } from "./sortRows.js";
|
|
3
|
+
import { Table as n, TableBody as r, TableCell as i, TableEmptyRow as a, TableHead as o, TableHeaderCell as s, TableRow as c } from "./Table.js";
|
|
4
|
+
import { createElement as l, useMemo as u, useState as d } from "react";
|
|
5
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
import { ArrowDown as m, ArrowUp as h } from "lucide-react";
|
|
7
|
+
//#region src/components/tables/ResourceTable.tsx
|
|
8
|
+
var g = { "--ui-table-cell-padding-y": "0px" };
|
|
9
|
+
function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x = "No data", sortKey: S, sortDir: C, onSortChange: w, caption: T, loading: E = !1, loadingMessage: D = "Loading…", className: O, tableProps: k, getRowProps: A, isRowSelected: j, ref: M, ...N }) {
|
|
10
|
+
let P = w !== void 0, [F, I] = d(null), [L, R] = d("asc"), z = P ? S ?? null : F, B = P ? C ?? "asc" : L, V = u(() => P ? _ : t(_, v, z, B), [
|
|
11
|
+
P,
|
|
12
|
+
_,
|
|
13
|
+
v,
|
|
14
|
+
z,
|
|
15
|
+
B
|
|
16
|
+
]);
|
|
17
|
+
function H(e) {
|
|
18
|
+
let t = z === e && B === "asc" ? "desc" : "asc";
|
|
19
|
+
if (P) {
|
|
20
|
+
w(e, t);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
I(e), R(t);
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ p(n, {
|
|
26
|
+
...k,
|
|
27
|
+
wrapperProps: {
|
|
28
|
+
...N,
|
|
29
|
+
ref: M
|
|
30
|
+
},
|
|
31
|
+
wrapperClassName: O,
|
|
32
|
+
beforeTable: E && /* @__PURE__ */ f("span", {
|
|
33
|
+
role: "status",
|
|
34
|
+
className: "sr-only",
|
|
35
|
+
children: D
|
|
36
|
+
}),
|
|
37
|
+
caption: T || void 0,
|
|
38
|
+
captionClassName: "text-text-secondary px-3 py-2 text-left text-xs",
|
|
39
|
+
"aria-busy": E || k?.["aria-busy"],
|
|
40
|
+
className: e("font-data text-xs", k?.className),
|
|
41
|
+
style: {
|
|
42
|
+
...g,
|
|
43
|
+
...k?.style
|
|
44
|
+
},
|
|
45
|
+
children: [/* @__PURE__ */ f(o, { children: /* @__PURE__ */ f(c, { children: v.map((t) => /* @__PURE__ */ f(s, {
|
|
46
|
+
className: e("text-2xs h-7", t.sortable && "hover:text-text-table-header-hover cursor-pointer select-none"),
|
|
47
|
+
style: { width: t.width },
|
|
48
|
+
sort: t.sortable ? z === t.key ? B === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
49
|
+
children: t.sortable ? /* @__PURE__ */ p("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
onClick: () => H(t.key),
|
|
52
|
+
"aria-label": t.sortLabel,
|
|
53
|
+
className: "inline-flex cursor-pointer items-center gap-1 text-left focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
54
|
+
children: [t.header, z === t.key && f(B === "asc" ? h : m, {
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
className: "h-3 w-3"
|
|
57
|
+
})]
|
|
58
|
+
}) : t.header
|
|
59
|
+
}, t.key)) }) }), /* @__PURE__ */ f(r, { children: V.length === 0 ? /* @__PURE__ */ f(a, {
|
|
60
|
+
colSpan: v.length,
|
|
61
|
+
cellClassName: "h-32 px-0 text-center",
|
|
62
|
+
children: E ? D : x
|
|
63
|
+
}) : V.map((t) => {
|
|
64
|
+
let n = A?.(t) ?? {}, r = j?.(t) ?? n["aria-selected"], a = r === !0 || r === "true";
|
|
65
|
+
return /* @__PURE__ */ l(c, {
|
|
66
|
+
tabIndex: b ? 0 : void 0,
|
|
67
|
+
...n,
|
|
68
|
+
key: y(t),
|
|
69
|
+
selected: a,
|
|
70
|
+
interactive: !!b,
|
|
71
|
+
className: e("h-8", !a && "hover:bg-bg-hover", b && "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-[-2px]", n.className),
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
n.onClick?.(e), e.defaultPrevented || b?.(t);
|
|
74
|
+
},
|
|
75
|
+
onKeyDown: (e) => {
|
|
76
|
+
n.onKeyDown?.(e), !(!b || e.defaultPrevented || e.repeat || e.target !== e.currentTarget || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), b(t));
|
|
77
|
+
}
|
|
78
|
+
}, v.map((e) => /* @__PURE__ */ f(i, {
|
|
79
|
+
nowrap: !0,
|
|
80
|
+
className: e.cellClassName,
|
|
81
|
+
onClick: e.interactive ? (e) => e.stopPropagation() : void 0,
|
|
82
|
+
children: e.render(t)
|
|
83
|
+
}, e.key)));
|
|
84
|
+
}) })]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { _ as ResourceTable };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDown as r, ArrowUp as i, ArrowUpDown as a } from "lucide-react";
|
|
4
|
+
//#region src/components/tables/Table.tsx
|
|
5
|
+
function o({ caption: r, captionHidden: i = !1, captionClassName: a, stickyHeader: o = !1, maxHeight: s, wrapperClassName: c, wrapperProps: l, beforeTable: u, className: d, children: f, ...p }) {
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
...l,
|
|
8
|
+
className: e("ui-table-wrap", l?.className, c),
|
|
9
|
+
style: {
|
|
10
|
+
maxHeight: s,
|
|
11
|
+
...s ? { overflow: "auto" } : {},
|
|
12
|
+
...l?.style
|
|
13
|
+
},
|
|
14
|
+
children: [u, /* @__PURE__ */ n("table", {
|
|
15
|
+
...p,
|
|
16
|
+
className: e("ui-table", o && "ui-table-sticky", d),
|
|
17
|
+
children: [r != null && /* @__PURE__ */ t("caption", {
|
|
18
|
+
className: e(i && "sr-only", a),
|
|
19
|
+
children: r
|
|
20
|
+
}), f]
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function s({ className: n, ...r }) {
|
|
25
|
+
return /* @__PURE__ */ t("thead", {
|
|
26
|
+
...r,
|
|
27
|
+
className: e("ui-table-head", n)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function c({ className: n, ...r }) {
|
|
31
|
+
return /* @__PURE__ */ t("tbody", {
|
|
32
|
+
...r,
|
|
33
|
+
className: e("ui-table-body", n)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function l({ selected: n, interactive: r = !1, className: i, ...a }) {
|
|
37
|
+
return /* @__PURE__ */ t("tr", {
|
|
38
|
+
...a,
|
|
39
|
+
"data-selected": n ? "" : void 0,
|
|
40
|
+
className: e("ui-table-row", r && "ui-table-interactive", i)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function u({ numeric: o = !1, align: s, sort: c, onSort: l, scope: u = "col", className: d, style: f, children: p, ...m }) {
|
|
44
|
+
let h = c ?? m["aria-sort"], g = h === "ascending" ? "descending" : "ascending";
|
|
45
|
+
return /* @__PURE__ */ t("th", {
|
|
46
|
+
...m,
|
|
47
|
+
scope: u,
|
|
48
|
+
"aria-sort": h ?? (l ? "none" : void 0),
|
|
49
|
+
className: e("ui-table-header-cell", o && "ui-table-numeric", d),
|
|
50
|
+
style: {
|
|
51
|
+
...s ? { textAlign: s } : {},
|
|
52
|
+
...f
|
|
53
|
+
},
|
|
54
|
+
children: l ? /* @__PURE__ */ n("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "ui-table-sort-button",
|
|
57
|
+
onClick: () => l(g),
|
|
58
|
+
children: [
|
|
59
|
+
p,
|
|
60
|
+
/* @__PURE__ */ n("span", {
|
|
61
|
+
className: "sr-only",
|
|
62
|
+
children: [" Sort ", g]
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ t("span", {
|
|
65
|
+
className: "ui-table-sort-indicator",
|
|
66
|
+
"aria-hidden": "true",
|
|
67
|
+
children: t(h === "ascending" ? i : h === "descending" ? r : a, {})
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}) : p
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function d({ numeric: n = !1, align: r, nowrap: i = !1, className: a, style: o, ...s }) {
|
|
74
|
+
return /* @__PURE__ */ t("td", {
|
|
75
|
+
...s,
|
|
76
|
+
className: e("ui-table-cell", n && "ui-table-numeric", i && "ui-table-nowrap", a),
|
|
77
|
+
style: {
|
|
78
|
+
...r ? { textAlign: r } : {},
|
|
79
|
+
...o
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function f({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
|
|
84
|
+
return /* @__PURE__ */ t("tr", {
|
|
85
|
+
...o,
|
|
86
|
+
className: e("ui-table-empty-row", a),
|
|
87
|
+
children: /* @__PURE__ */ t("td", {
|
|
88
|
+
colSpan: n,
|
|
89
|
+
className: e("ui-table-empty-cell", r),
|
|
90
|
+
children: i
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { o as Table, c as TableBody, d as TableCell, f as TableEmptyRow, s as TableHead, u as TableHeaderCell, l as TableRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/components/tables/sortRows.ts
|
|
2
|
+
function e(e, t, n, r) {
|
|
3
|
+
if (!n) return e;
|
|
4
|
+
let i = t.find((e) => e.key === n)?.getValue;
|
|
5
|
+
return i ? [...e].sort((e, t) => {
|
|
6
|
+
let n = String(i(e)), a = String(i(t)), o = n.localeCompare(a, void 0, { numeric: !0 });
|
|
7
|
+
return r === "asc" ? o : -o;
|
|
8
|
+
}) : e;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as sortRows };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
1
2
|
import { type DisclosureProps } from "./Disclosure";
|
|
2
3
|
export interface AccordionItem extends Omit<DisclosureProps, "open" | "defaultOpen" | "onOpenChange"> {
|
|
3
4
|
/** Unique, stable identifier within the accordion. */
|
|
4
5
|
value: string;
|
|
5
6
|
}
|
|
6
|
-
interface AccordionBaseProps {
|
|
7
|
+
interface AccordionBaseProps extends Omit<ComponentPropsWithRef<"div">, "children" | "defaultValue" | "onChange"> {
|
|
7
8
|
/** Sections in display order. */
|
|
8
9
|
items: AccordionItem[];
|
|
9
10
|
/** Additional classes on the group. */
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { Disclosure as t } from "./Disclosure.js";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/Accordion.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let [a, o] = n(i.defaultValue ?? (i.type === "multiple" ? [] : "")), { ref: s, items: c, className: l, ...u } = i;
|
|
8
|
+
delete u.value, delete u.defaultValue, delete u.onValueChange, delete u.type;
|
|
9
|
+
let d = i.value ?? a;
|
|
10
|
+
function f(e, t) {
|
|
11
|
+
if (i.type === "multiple") {
|
|
12
|
+
let n = Array.isArray(d) ? d : [], r = t ? [...n, e] : n.filter((t) => t !== e);
|
|
13
|
+
i.value === void 0 && o(r), i.onValueChange?.(r);
|
|
14
|
+
} else {
|
|
15
|
+
let n = t ? e : "";
|
|
16
|
+
i.value === void 0 && o(n), i.onValueChange?.(n);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ r("div", {
|
|
20
|
+
ref: s,
|
|
21
|
+
...u,
|
|
22
|
+
className: e("space-y-2", l),
|
|
23
|
+
children: c.map((e) => /* @__PURE__ */ r(t, {
|
|
24
|
+
title: e.title,
|
|
25
|
+
meta: e.meta,
|
|
26
|
+
className: e.className,
|
|
27
|
+
keepMounted: e.keepMounted,
|
|
28
|
+
open: i.type === "multiple" ? Array.isArray(d) && d.includes(e.value) : d === e.value,
|
|
29
|
+
onOpenChange: (t) => f(e.value, t),
|
|
30
|
+
children: e.children
|
|
31
|
+
}, e.value))
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { i as Accordion };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
1
2
|
type AlertType = "success" | "warning" | "error" | "danger" | "info" | "neutral";
|
|
2
|
-
export interface AlertProps extends Omit<
|
|
3
|
+
export interface AlertProps extends Omit<ComponentPropsWithRef<"div">, "title" | "children"> {
|
|
3
4
|
/** Sets the icon and colours. "danger" and "error" are equivalent. */
|
|
4
5
|
type: AlertType;
|
|
5
6
|
/** Bold heading shown above the content. */
|
|
@@ -16,5 +17,5 @@ export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
16
17
|
/** Additional utility classes for the root element. */
|
|
17
18
|
className?: string;
|
|
18
19
|
}
|
|
19
|
-
export declare function Alert({ type, title, children, dismissible, onDismiss, className, actions, toneBody, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
export declare function Alert({ type, title, children, dismissible, onDismiss, className, actions, toneBody, ref, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
21
|
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { toneClasses as t } from "../../lib/tones.js";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { AlertTriangle as a, CheckCircle2 as o, Info as s, X as c, XCircle as l } from "lucide-react";
|
|
6
|
+
//#region src/components/ui/Alert.tsx
|
|
7
|
+
var u = {
|
|
8
|
+
neutral: s,
|
|
9
|
+
success: o,
|
|
10
|
+
warning: a,
|
|
11
|
+
danger: l,
|
|
12
|
+
info: s
|
|
13
|
+
};
|
|
14
|
+
function d({ type: a, title: o, children: s, dismissible: l, onDismiss: d, className: f, actions: p, toneBody: m = !1, ref: h, ...g }) {
|
|
15
|
+
let [_, v] = n(!1);
|
|
16
|
+
if (_) return null;
|
|
17
|
+
let y = a === "error" ? "danger" : a, b = t(y), x = u[y], S = y === "neutral" ? "text-text-primary" : b.text;
|
|
18
|
+
return /* @__PURE__ */ i("div", {
|
|
19
|
+
ref: h,
|
|
20
|
+
...g,
|
|
21
|
+
className: e("flex gap-2.5 rounded-md border p-3", b.fill, b.border, f),
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r(x, { className: e("mt-0.5 h-4 w-4 shrink-0", b.text) }),
|
|
24
|
+
/* @__PURE__ */ i("div", {
|
|
25
|
+
className: "min-w-0 flex-1",
|
|
26
|
+
children: [o && /* @__PURE__ */ r("p", {
|
|
27
|
+
className: e(m ? S : "text-text-primary", "mb-0.5 text-xs font-semibold"),
|
|
28
|
+
children: o
|
|
29
|
+
}), /* @__PURE__ */ r("div", {
|
|
30
|
+
className: e(m ? S : "text-text-secondary", "text-xs"),
|
|
31
|
+
children: s
|
|
32
|
+
})]
|
|
33
|
+
}),
|
|
34
|
+
p ? /* @__PURE__ */ r("div", {
|
|
35
|
+
className: "shrink-0 self-center",
|
|
36
|
+
children: p
|
|
37
|
+
}) : null,
|
|
38
|
+
l && /* @__PURE__ */ r("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
d ? d() : v(!0);
|
|
42
|
+
},
|
|
43
|
+
className: "ui-alert-dismiss text-text-tertiary hover:text-text-primary flex shrink-0 cursor-pointer items-center justify-center self-start rounded-md transition-colors duration-[100ms]",
|
|
44
|
+
"aria-label": "Dismiss",
|
|
45
|
+
children: /* @__PURE__ */ r(c, { className: "h-3 w-3" })
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { d as Alert };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
2
|
export type AttachmentStatus = "pending" | "uploading" | "processing" | "ready" | "error";
|
|
3
|
-
export interface AttachmentItemProps extends Omit<
|
|
3
|
+
export interface AttachmentItemProps extends Omit<ComponentPropsWithRef<"li">, "id"> {
|
|
4
4
|
/** File name shown in the row and used in action labels. */
|
|
5
5
|
name: string;
|
|
6
6
|
/** Size in bytes; omitted when unknown. */
|
|
@@ -22,9 +22,9 @@ export interface AttachmentItemProps extends Omit<HTMLAttributes<HTMLLIElement>,
|
|
|
22
22
|
/** Disable the retry, download and remove actions. */
|
|
23
23
|
actionsDisabled?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare function AttachmentItem({ name, size, status, statusLabel, error, onRetry, onRemove, onDownload, downloadHref, actionsDisabled, className, ...props }: AttachmentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export interface AttachmentListProps extends
|
|
25
|
+
export declare function AttachmentItem({ name, size, status, statusLabel, error, onRetry, onRemove, onDownload, downloadHref, actionsDisabled, className, ref, ...props }: AttachmentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export interface AttachmentListProps extends ComponentPropsWithRef<"ul"> {
|
|
27
27
|
children?: ReactNode;
|
|
28
28
|
}
|
|
29
29
|
/** Controlled presentation only. Keep transport, scanning, authorization and send policy in the application. */
|
|
30
|
-
export declare function AttachmentList({ children, className, "aria-label": label, ...props }: AttachmentListProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function AttachmentList({ children, className, ref, "aria-label": label, ...props }: AttachmentListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
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/AttachmentList.tsx
|
|
5
|
+
var i = {
|
|
6
|
+
pending: "Pending",
|
|
7
|
+
uploading: "Uploading",
|
|
8
|
+
processing: "Processing",
|
|
9
|
+
ready: "Ready",
|
|
10
|
+
error: "Upload failed"
|
|
11
|
+
};
|
|
12
|
+
function a(e) {
|
|
13
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
14
|
+
}
|
|
15
|
+
function o({ name: o, size: s, status: c = "ready", statusLabel: l, error: u, onRetry: d, onRemove: f, onDownload: p, downloadHref: m, actionsDisabled: h, className: g, ref: _, ...v }) {
|
|
16
|
+
return /* @__PURE__ */ r("li", {
|
|
17
|
+
ref: _,
|
|
18
|
+
...v,
|
|
19
|
+
className: e("ui-attachment-item border-border flex items-center justify-between gap-3 rounded-md border p-3", g),
|
|
20
|
+
children: [/* @__PURE__ */ r("div", {
|
|
21
|
+
className: "min-w-0",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ n("p", {
|
|
24
|
+
className: "text-text-primary text-xs",
|
|
25
|
+
children: o
|
|
26
|
+
}),
|
|
27
|
+
s !== void 0 && /* @__PURE__ */ n("p", {
|
|
28
|
+
className: "text-text-tertiary text-2xs",
|
|
29
|
+
children: a(s)
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ r("div", {
|
|
32
|
+
role: "status",
|
|
33
|
+
"aria-atomic": "true",
|
|
34
|
+
className: e("text-2xs", c === "error" ? "text-danger-fg" : "text-text-secondary"),
|
|
35
|
+
children: [
|
|
36
|
+
o,
|
|
37
|
+
": ",
|
|
38
|
+
u ?? l ?? i[c]
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}), /* @__PURE__ */ r("div", {
|
|
43
|
+
className: "flex items-center gap-1.5",
|
|
44
|
+
children: [
|
|
45
|
+
d && /* @__PURE__ */ n(t, {
|
|
46
|
+
type: "button",
|
|
47
|
+
size: "sm",
|
|
48
|
+
disabled: h,
|
|
49
|
+
onClick: d,
|
|
50
|
+
"aria-label": `Retry ${o}`,
|
|
51
|
+
children: "Retry"
|
|
52
|
+
}),
|
|
53
|
+
m && !h && /* @__PURE__ */ n("a", {
|
|
54
|
+
href: m,
|
|
55
|
+
download: !0,
|
|
56
|
+
"aria-label": `Download ${o}`,
|
|
57
|
+
className: "text-accent-fg text-xs",
|
|
58
|
+
children: "Download"
|
|
59
|
+
}),
|
|
60
|
+
p && /* @__PURE__ */ n(t, {
|
|
61
|
+
type: "button",
|
|
62
|
+
size: "sm",
|
|
63
|
+
disabled: h,
|
|
64
|
+
onClick: p,
|
|
65
|
+
"aria-label": `Download ${o}`,
|
|
66
|
+
children: "Download"
|
|
67
|
+
}),
|
|
68
|
+
f && /* @__PURE__ */ n(t, {
|
|
69
|
+
type: "button",
|
|
70
|
+
size: "sm",
|
|
71
|
+
disabled: h,
|
|
72
|
+
onClick: f,
|
|
73
|
+
"aria-label": `Remove ${o}`,
|
|
74
|
+
children: "Remove"
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function s({ children: t, className: r, ref: i, "aria-label": a = "Attachments", ...o }) {
|
|
81
|
+
return /* @__PURE__ */ n("ul", {
|
|
82
|
+
ref: i,
|
|
83
|
+
...o,
|
|
84
|
+
"aria-label": a,
|
|
85
|
+
className: e("space-y-2", r),
|
|
86
|
+
children: t
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { o as AttachmentItem, s as AttachmentList };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type Ref } from "react";
|
|
1
2
|
export interface AudioPlayerHandle {
|
|
2
3
|
/** Seek in seconds, clamped to the recording. Queued until metadata loads. */
|
|
3
4
|
seekTo: (seconds: number) => void;
|
|
4
5
|
}
|
|
5
6
|
export type AudioPart = "skipBack" | "play" | "skipForward" | "time" | "currentTime" | "progress" | "duration" | "speed" | "mute" | "volume" | "download";
|
|
6
7
|
export type AudioPlayerVariant = "plain" | "card";
|
|
7
|
-
export interface AudioPlayerProps {
|
|
8
|
+
export interface AudioPlayerProps extends Omit<ComponentPropsWithoutRef<"div">, "title" | "children" | "onError" | "onTimeUpdate"> {
|
|
9
|
+
/** Imperative handle (seekTo), not a DOM ref. */
|
|
10
|
+
ref?: Ref<AudioPlayerHandle>;
|
|
8
11
|
src: string;
|
|
9
12
|
/** Accessible group name; visible only with variant="card". */
|
|
10
13
|
title?: string;
|
|
@@ -32,4 +35,4 @@ export interface AudioPlayerProps {
|
|
|
32
35
|
*/
|
|
33
36
|
controls?: readonly AudioPart[];
|
|
34
37
|
}
|
|
35
|
-
export declare
|
|
38
|
+
export declare function AudioPlayer(props: AudioPlayerProps): import("react/jsx-runtime").JSX.Element;
|