@leonardaustin/ui 0.27.0 → 0.28.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/dist/components/charts/AreaChart.js +113 -114
- package/dist/components/charts/Heatmap.d.ts +20 -0
- package/dist/components/charts/Heatmap.js +46 -0
- package/dist/components/charts/chartUtils.d.ts +2 -0
- package/dist/components/charts/chartUtils.js +14 -9
- package/dist/components/charts/useChartSize.d.ts +5 -0
- package/dist/components/charts/useChartSize.js +18 -0
- package/dist/components/tables/Pagination.d.ts +3 -1
- package/dist/components/tables/Pagination.js +12 -12
- package/dist/components/tables/ResourceTable.d.ts +5 -0
- package/dist/components/tables/ResourceTable.js +11 -9
- package/dist/components/tables/Table.d.ts +22 -3
- package/dist/components/tables/Table.js +41 -35
- package/dist/components/ui/ActionLink.d.ts +14 -0
- package/dist/components/ui/ActionLink.js +12 -0
- package/dist/components/ui/DateRangePicker.js +107 -76
- package/dist/components/ui/EmptyState.d.ts +8 -6
- package/dist/components/ui/EmptyState.js +11 -10
- package/dist/components/ui/ErrorBoundary.d.ts +6 -0
- package/dist/components/ui/ErrorBoundary.js +11 -5
- package/dist/components/ui/Grid.d.ts +1 -1
- package/dist/components/ui/Icon.d.ts +91 -0
- package/dist/components/ui/Icon.js +98 -0
- package/dist/components/ui/Inline.d.ts +1 -1
- package/dist/components/ui/LoadingSpinner.d.ts +7 -3
- package/dist/components/ui/LoadingSpinner.js +19 -11
- package/dist/components/ui/Meter.d.ts +11 -0
- package/dist/components/ui/Meter.js +7 -0
- package/dist/components/ui/MetricCard.d.ts +11 -8
- package/dist/components/ui/MetricCard.js +18 -15
- package/dist/components/ui/PaginationBar.d.ts +3 -3
- package/dist/components/ui/PaginationBar.js +35 -33
- package/dist/components/ui/SideSheet.d.ts +4 -2
- package/dist/components/ui/SideSheet.js +64 -52
- package/dist/components/ui/Stack.d.ts +1 -1
- package/dist/components/ui/Tabs.d.ts +5 -1
- package/dist/components/ui/Tabs.js +23 -21
- package/dist/components/ui/Text.d.ts +19 -0
- package/dist/components/ui/Text.js +20 -0
- package/dist/components/ui/Toolbar.js +13 -13
- package/dist/core.css +105 -0
- package/dist/hooks/useFocusTrap.js +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +134 -129
- package/dist/styles.css +106 -0
- package/package.json +1 -1
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, CSSProperties, ReactNode } from "react";
|
|
2
2
|
export interface TableProps extends ComponentPropsWithRef<"table"> {
|
|
3
|
+
/** Use a borderless table inside an existing card. Defaults to "framed". */
|
|
4
|
+
appearance?: "framed" | "embedded";
|
|
5
|
+
/** Reduce horizontal and vertical cell padding. Defaults to false. */
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
/** Tint alternating body rows. Defaults to false. */
|
|
8
|
+
striped?: boolean;
|
|
9
|
+
/** Use a tinted header with body-sized labels in their original case. */
|
|
10
|
+
headerAppearance?: "default" | "band";
|
|
3
11
|
/** Table caption, rendered as a `<caption>`. */
|
|
4
12
|
caption?: ReactNode;
|
|
5
13
|
/** Visually hide the caption while keeping it available to screen readers. Defaults to `false`. */
|
|
@@ -17,9 +25,10 @@ export interface TableProps extends ComponentPropsWithRef<"table"> {
|
|
|
17
25
|
/** Content rendered inside the wrapper `<div>` before the `<table>`, for example a visually hidden `role="status"` loading message. */
|
|
18
26
|
beforeTable?: ReactNode;
|
|
19
27
|
}
|
|
20
|
-
export declare function Table({ caption, captionHidden, captionClassName, stickyHeader, maxHeight, wrapperClassName, wrapperProps, beforeTable, className, children, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function Table({ appearance, compact, striped, headerAppearance, caption, captionHidden, captionClassName, stickyHeader, maxHeight, wrapperClassName, wrapperProps, beforeTable, className, children, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
21
29
|
export declare function TableHead({ className, ...props }: ComponentPropsWithRef<"thead">): import("react/jsx-runtime").JSX.Element;
|
|
22
30
|
export declare function TableBody({ className, ...props }: ComponentPropsWithRef<"tbody">): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function TableFoot({ className, ...props }: ComponentPropsWithRef<"tfoot">): import("react/jsx-runtime").JSX.Element;
|
|
23
32
|
export interface TableRowProps extends ComponentPropsWithRef<"tr"> {
|
|
24
33
|
/** Marks the row selected via `data-selected`, which applies the selected background. `aria-selected` is not set; pass it yourself only where it is valid (grid/treegrid rows). */
|
|
25
34
|
selected?: boolean;
|
|
@@ -28,6 +37,11 @@ export interface TableRowProps extends ComponentPropsWithRef<"tr"> {
|
|
|
28
37
|
}
|
|
29
38
|
export declare function TableRow({ selected, interactive, className, ...props }: TableRowProps): import("react/jsx-runtime").JSX.Element;
|
|
30
39
|
export interface TableHeaderCellProps extends Omit<ComponentPropsWithRef<"th">, "align"> {
|
|
40
|
+
/**
|
|
41
|
+
* Hide at wrapper widths of 32rem or less.
|
|
42
|
+
* Hiding uses a container query, so place the table in a block-level parent; shrink-to-fit parents such as inline-block collapse it.
|
|
43
|
+
*/
|
|
44
|
+
lowPriority?: boolean;
|
|
31
45
|
/** Horizontal text alignment of the cell. */
|
|
32
46
|
align?: CSSProperties["textAlign"];
|
|
33
47
|
/** Right-align with tabular figures for numeric columns. Defaults to `false`. */
|
|
@@ -37,8 +51,13 @@ export interface TableHeaderCellProps extends Omit<ComponentPropsWithRef<"th">,
|
|
|
37
51
|
/** Reports the requested next direction. Sorting and state updates belong to the caller. */
|
|
38
52
|
onSort?: (direction: "ascending" | "descending") => void;
|
|
39
53
|
}
|
|
40
|
-
export declare function TableHeaderCell({ numeric, align, sort, onSort, scope, className, style, children, ...props }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare function TableHeaderCell({ lowPriority, numeric, align, sort, onSort, scope, className, style, children, ...props }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
|
|
41
55
|
export interface TableCellProps extends Omit<ComponentPropsWithRef<"td">, "align"> {
|
|
56
|
+
/**
|
|
57
|
+
* Hide at wrapper widths of 32rem or less.
|
|
58
|
+
* Hiding uses a container query, so place the table in a block-level parent; shrink-to-fit parents such as inline-block collapse it.
|
|
59
|
+
*/
|
|
60
|
+
lowPriority?: boolean;
|
|
42
61
|
/** Horizontal text alignment of the cell. */
|
|
43
62
|
align?: CSSProperties["textAlign"];
|
|
44
63
|
/** Right-align with tabular figures for numeric columns. Defaults to `false`. */
|
|
@@ -46,7 +65,7 @@ export interface TableCellProps extends Omit<ComponentPropsWithRef<"td">, "align
|
|
|
46
65
|
/** Prevent the cell content from wrapping. Defaults to `false`. */
|
|
47
66
|
nowrap?: boolean;
|
|
48
67
|
}
|
|
49
|
-
export declare function TableCell({ numeric, align, nowrap, className, style, ...props }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
export declare function TableCell({ lowPriority, numeric, align, nowrap, className, style, ...props }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
50
69
|
export interface TableEmptyRowProps extends ComponentPropsWithRef<"tr"> {
|
|
51
70
|
/** Number of columns the empty-state cell spans; set to the table's column count. */
|
|
52
71
|
colSpan: number;
|
|
@@ -2,22 +2,22 @@ import { cn as e } from "../../lib/cn.js";
|
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowDown as r, ArrowUp as i, ArrowUpDown as a } from "lucide-react";
|
|
4
4
|
//#region src/components/tables/Table.tsx
|
|
5
|
-
function o({
|
|
5
|
+
function o({ appearance: r = "framed", compact: i = !1, striped: a = !1, headerAppearance: o = "default", caption: s, captionHidden: c = !1, captionClassName: l, stickyHeader: u = !1, maxHeight: d, wrapperClassName: f, wrapperProps: p, beforeTable: m, className: h, children: g, ..._ }) {
|
|
6
6
|
return /* @__PURE__ */ n("div", {
|
|
7
|
-
...
|
|
8
|
-
className: e("ui-table-wrap",
|
|
7
|
+
...p,
|
|
8
|
+
className: e("ui-table-wrap", r === "embedded" && "ui-table-wrap-embedded", p?.className, f),
|
|
9
9
|
style: {
|
|
10
|
-
maxHeight:
|
|
11
|
-
...
|
|
12
|
-
...
|
|
10
|
+
maxHeight: d,
|
|
11
|
+
...d ? { overflow: "auto" } : {},
|
|
12
|
+
...p?.style
|
|
13
13
|
},
|
|
14
|
-
children: [
|
|
15
|
-
...
|
|
16
|
-
className: e("ui-table", o && "ui-table-sticky",
|
|
17
|
-
children: [
|
|
18
|
-
className: e(
|
|
19
|
-
children:
|
|
20
|
-
}),
|
|
14
|
+
children: [m, /* @__PURE__ */ n("table", {
|
|
15
|
+
..._,
|
|
16
|
+
className: e("ui-table", i && "ui-table-compact", a && "ui-table-striped", o === "band" && "ui-table-header-band", u && "ui-table-sticky", h),
|
|
17
|
+
children: [s != null && /* @__PURE__ */ t("caption", {
|
|
18
|
+
className: e(c && "sr-only", l),
|
|
19
|
+
children: s
|
|
20
|
+
}), g]
|
|
21
21
|
})]
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -33,54 +33,60 @@ function c({ className: n, ...r }) {
|
|
|
33
33
|
className: e("ui-table-body", n)
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
function l({
|
|
36
|
+
function l({ className: n, ...r }) {
|
|
37
|
+
return /* @__PURE__ */ t("tfoot", {
|
|
38
|
+
...r,
|
|
39
|
+
className: e("ui-table-foot", n)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function u({ selected: n, interactive: r = !1, className: i, ...a }) {
|
|
37
43
|
return /* @__PURE__ */ t("tr", {
|
|
38
44
|
...a,
|
|
39
45
|
"data-selected": n ? "" : void 0,
|
|
40
46
|
className: e("ui-table-row", r && "ui-table-interactive", i)
|
|
41
47
|
});
|
|
42
48
|
}
|
|
43
|
-
function
|
|
44
|
-
let
|
|
49
|
+
function d({ lowPriority: o = !1, numeric: s = !1, align: c, sort: l, onSort: u, scope: d = "col", className: f, style: p, children: m, ...h }) {
|
|
50
|
+
let g = l ?? h["aria-sort"], _ = g === "ascending" ? "descending" : "ascending";
|
|
45
51
|
return /* @__PURE__ */ t("th", {
|
|
46
|
-
...
|
|
47
|
-
scope:
|
|
48
|
-
"aria-sort":
|
|
49
|
-
className: e("ui-table-header-cell", o && "ui-table-numeric",
|
|
52
|
+
...h,
|
|
53
|
+
scope: d,
|
|
54
|
+
"aria-sort": g ?? (u ? "none" : void 0),
|
|
55
|
+
className: e("ui-table-header-cell", o && "ui-table-low-priority", s && "ui-table-numeric", f),
|
|
50
56
|
style: {
|
|
51
|
-
...
|
|
52
|
-
...
|
|
57
|
+
...c ? { textAlign: c } : {},
|
|
58
|
+
...p
|
|
53
59
|
},
|
|
54
|
-
children:
|
|
60
|
+
children: u ? /* @__PURE__ */ n("button", {
|
|
55
61
|
type: "button",
|
|
56
62
|
className: "ui-table-sort-button",
|
|
57
|
-
onClick: () =>
|
|
63
|
+
onClick: () => u(_),
|
|
58
64
|
children: [
|
|
59
|
-
|
|
65
|
+
m,
|
|
60
66
|
/* @__PURE__ */ n("span", {
|
|
61
67
|
className: "sr-only",
|
|
62
|
-
children: [" Sort ",
|
|
68
|
+
children: [" Sort ", _]
|
|
63
69
|
}),
|
|
64
70
|
/* @__PURE__ */ t("span", {
|
|
65
71
|
className: "ui-table-sort-indicator",
|
|
66
72
|
"aria-hidden": "true",
|
|
67
|
-
children: t(
|
|
73
|
+
children: t(g === "ascending" ? i : g === "descending" ? r : a, {})
|
|
68
74
|
})
|
|
69
75
|
]
|
|
70
|
-
}) :
|
|
76
|
+
}) : m
|
|
71
77
|
});
|
|
72
78
|
}
|
|
73
|
-
function
|
|
79
|
+
function f({ lowPriority: n = !1, numeric: r = !1, align: i, nowrap: a = !1, className: o, style: s, ...c }) {
|
|
74
80
|
return /* @__PURE__ */ t("td", {
|
|
75
|
-
...
|
|
76
|
-
className: e("ui-table-cell", n && "ui-table-numeric",
|
|
81
|
+
...c,
|
|
82
|
+
className: e("ui-table-cell", n && "ui-table-low-priority", r && "ui-table-numeric", a && "ui-table-nowrap", o),
|
|
77
83
|
style: {
|
|
78
|
-
...
|
|
79
|
-
...
|
|
84
|
+
...i ? { textAlign: i } : {},
|
|
85
|
+
...s
|
|
80
86
|
}
|
|
81
87
|
});
|
|
82
88
|
}
|
|
83
|
-
function
|
|
89
|
+
function p({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
|
|
84
90
|
return /* @__PURE__ */ t("tr", {
|
|
85
91
|
...o,
|
|
86
92
|
className: e("ui-table-empty-row", a),
|
|
@@ -92,4 +98,4 @@ function f({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
|
|
|
92
98
|
});
|
|
93
99
|
}
|
|
94
100
|
//#endregion
|
|
95
|
-
export { o as Table, c as TableBody,
|
|
101
|
+
export { o as Table, c as TableBody, f as TableCell, p as TableEmptyRow, l as TableFoot, s as TableHead, d as TableHeaderCell, u as TableRow };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
type AnchorProps = ComponentPropsWithRef<"a"> & {
|
|
3
|
+
href: string;
|
|
4
|
+
};
|
|
5
|
+
export interface ActionLinkProps extends AnchorProps {
|
|
6
|
+
/** Destination for native navigation, including opening in a new tab. */
|
|
7
|
+
href: string;
|
|
8
|
+
/** Inline text link or bordered secondary action. */
|
|
9
|
+
appearance?: "inline" | "secondary";
|
|
10
|
+
/** Render a router anchor, forwarding the supplied attributes, children and ref. */
|
|
11
|
+
renderLink?: (props: AnchorProps) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function ActionLink({ appearance, renderLink, className, ...props }: ActionLinkProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/ActionLink.tsx
|
|
4
|
+
function n({ appearance: n = "inline", renderLink: r, className: i, ...a }) {
|
|
5
|
+
let o = {
|
|
6
|
+
...a,
|
|
7
|
+
className: e("focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", n === "secondary" ? "bg-bg-secondary text-text-primary border-border hover:bg-bg-hover inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors duration-[100ms]" : "text-accent-fg underline underline-offset-2", i)
|
|
8
|
+
};
|
|
9
|
+
return r ? r(o) : /* @__PURE__ */ t("a", { ...o });
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as ActionLink };
|
|
@@ -5,127 +5,158 @@ import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
|
5
5
|
import { usePopover as i } from "../../hooks/usePopover.js";
|
|
6
6
|
import { formatPickerDate as a } from "../../lib/calendar.js";
|
|
7
7
|
import { CalendarGrid as o } from "./CalendarGrid.js";
|
|
8
|
-
import {
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { Calendar as
|
|
8
|
+
import { useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { Calendar as p } from "lucide-react";
|
|
11
11
|
//#region src/components/ui/DateRangePicker.tsx
|
|
12
|
-
var
|
|
12
|
+
var ee = {
|
|
13
13
|
start: null,
|
|
14
14
|
end: null
|
|
15
15
|
};
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
value:
|
|
19
|
-
defaultValue:
|
|
20
|
-
onChange:
|
|
21
|
-
}), { open:
|
|
16
|
+
function m({ controlSize: m, label: h, value: g, defaultValue: _ = ee, onValueChange: v, placeholder: y = "Select date range...", format: b = a, ref: x, className: te, ...ne }) {
|
|
17
|
+
let re = n(m), [S, ie] = r({
|
|
18
|
+
value: g,
|
|
19
|
+
defaultValue: _,
|
|
20
|
+
onChange: v
|
|
21
|
+
}), { open: C, show: ae, close: w, rootRef: T, anchorRef: oe, triggerRef: E, popupRef: D, labelId: O, popupId: k, triggerAria: A } = i({
|
|
22
22
|
haspopup: "dialog",
|
|
23
|
-
labelled: !!
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
labelled: !!h
|
|
24
|
+
}), j = c(() => t(x, T), [x, T]), M = l(null), N = l(null), [P, F] = u(!0), I = /* @__PURE__ */ new Date(), [L, R] = u(S.start?.getFullYear() ?? I.getFullYear()), [z, B] = u(S.start?.getMonth() ?? I.getMonth()), V = z === 11 ? L + 1 : L, H = z === 11 ? 0 : z + 1;
|
|
25
|
+
s(() => {
|
|
26
|
+
let e = D.current, t = M.current, n = t?.parentElement, r = e?.ownerDocument.defaultView;
|
|
27
|
+
if (!C || !e || !t || !n || !r) return;
|
|
28
|
+
let i = e.ownerDocument, a = () => {
|
|
29
|
+
let a = parseFloat(r.getComputedStyle(n).columnGap), o = e.offsetWidth - n.offsetWidth, s = 2 * t.offsetWidth + a + o + 16 > i.documentElement.clientWidth, c = i.activeElement;
|
|
30
|
+
if (s && e.contains(c) && !t.contains(c)) {
|
|
31
|
+
let e = c?.getAttribute("data-day");
|
|
32
|
+
if (e) N.current = e, R(V), B(H);
|
|
33
|
+
else {
|
|
34
|
+
let e = c?.getAttribute("aria-label");
|
|
35
|
+
Array.from(t.querySelectorAll("button")).find((t) => t.getAttribute("aria-label") === e)?.focus({ preventScroll: !0 });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
F(s);
|
|
39
|
+
}, o = typeof ResizeObserver > "u" ? null : new ResizeObserver(a);
|
|
40
|
+
o?.observe(e);
|
|
41
|
+
let s = o ? 0 : r.requestAnimationFrame(a);
|
|
42
|
+
return r.addEventListener("resize", a), () => {
|
|
43
|
+
o?.disconnect(), r.cancelAnimationFrame(s), r.removeEventListener("resize", a);
|
|
44
|
+
};
|
|
45
|
+
}, [
|
|
46
|
+
C,
|
|
47
|
+
D,
|
|
48
|
+
H,
|
|
49
|
+
V
|
|
50
|
+
]), s(() => {
|
|
51
|
+
let e = N.current;
|
|
52
|
+
!P || !e || (N.current = null, M.current?.querySelector(`[data-day="${e}"]`)?.focus({ preventScroll: !0 }));
|
|
53
|
+
}, [P]);
|
|
54
|
+
let [U, W] = u(null), [G, K] = u("start"), [q, J] = u(S.start), [Y, X] = u(S.end);
|
|
55
|
+
function se() {
|
|
56
|
+
if (C) {
|
|
57
|
+
w("toggle");
|
|
28
58
|
return;
|
|
29
59
|
}
|
|
30
|
-
|
|
60
|
+
J(S.start), X(S.end), K("start"), F(!0), S.start && (R(S.start.getFullYear()), B(S.start.getMonth())), ae();
|
|
31
61
|
}
|
|
32
62
|
function Z(e) {
|
|
33
|
-
|
|
34
|
-
start:
|
|
35
|
-
end:
|
|
36
|
-
}),
|
|
63
|
+
G === "start" ? (J(e), X(null), K("end")) : (q && e < q ? (X(q), J(e)) : X(e), K("start"), ie({
|
|
64
|
+
start: q && e < q ? e : q,
|
|
65
|
+
end: q && e < q ? q : e
|
|
66
|
+
}), w("select"));
|
|
37
67
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
68
|
+
function ce() {
|
|
69
|
+
z === 0 ? (R(L - 1), B(11)) : B(z - 1);
|
|
40
70
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
71
|
+
function le() {
|
|
72
|
+
z === 11 ? (R(L + 1), B(0)) : B(z + 1);
|
|
43
73
|
}
|
|
44
|
-
let { start: Q, end: $ } =
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
...
|
|
47
|
-
ref:
|
|
48
|
-
className: e("flex flex-col gap-1.5",
|
|
49
|
-
children: [
|
|
50
|
-
id:
|
|
74
|
+
let { start: Q, end: $ } = S;
|
|
75
|
+
return /* @__PURE__ */ f("div", {
|
|
76
|
+
...ne,
|
|
77
|
+
ref: j,
|
|
78
|
+
className: e("flex flex-col gap-1.5", te),
|
|
79
|
+
children: [h && /* @__PURE__ */ d("span", {
|
|
80
|
+
id: O,
|
|
51
81
|
className: "ui-field-label text-xs font-medium",
|
|
52
|
-
children:
|
|
53
|
-
}), /* @__PURE__ */
|
|
82
|
+
children: h
|
|
83
|
+
}), /* @__PURE__ */ f("div", {
|
|
54
84
|
className: "relative",
|
|
55
|
-
ref:
|
|
85
|
+
ref: oe,
|
|
56
86
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ d("button", {
|
|
58
88
|
type: "button",
|
|
59
|
-
ref:
|
|
60
|
-
...
|
|
61
|
-
onClick:
|
|
62
|
-
"data-control-size":
|
|
89
|
+
ref: E,
|
|
90
|
+
...A,
|
|
91
|
+
onClick: se,
|
|
92
|
+
"data-control-size": re,
|
|
63
93
|
className: e("ui-sized-control flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
|
|
64
|
-
children: Q ? $ ? `${
|
|
94
|
+
children: Q ? $ ? `${b(Q)} – ${b($)}` : b(Q) : /* @__PURE__ */ d("span", {
|
|
65
95
|
className: "text-text-placeholder",
|
|
66
|
-
children:
|
|
96
|
+
children: y
|
|
67
97
|
})
|
|
68
98
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
ref:
|
|
72
|
-
id:
|
|
99
|
+
/* @__PURE__ */ d(p, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
|
|
100
|
+
C && /* @__PURE__ */ f("div", {
|
|
101
|
+
ref: D,
|
|
102
|
+
id: k,
|
|
73
103
|
role: "dialog",
|
|
74
104
|
"aria-label": "Choose date range",
|
|
75
105
|
className: e("ui-glass ui-glass-popover bg-bg-tertiary border-border-strong animate-scale-in fixed top-0 left-0 z-[100] rounded-md border shadow-lg", "p-3"),
|
|
76
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ f("div", {
|
|
77
107
|
className: "mb-2 flex items-center justify-between",
|
|
78
108
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ d("button", {
|
|
80
110
|
type: "button",
|
|
81
|
-
onClick:
|
|
111
|
+
onClick: ce,
|
|
82
112
|
"aria-label": "Previous month",
|
|
83
|
-
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover
|
|
84
|
-
children: /* @__PURE__ */
|
|
113
|
+
className: e("text-text-tertiary hover:text-text-primary hover:bg-bg-hover h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]", P ? "hidden" : "flex"),
|
|
114
|
+
children: /* @__PURE__ */ d("span", {
|
|
85
115
|
className: "text-xs",
|
|
86
116
|
children: "‹"
|
|
87
117
|
})
|
|
88
118
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
className: "text-text-tertiary text-2xs",
|
|
119
|
+
/* @__PURE__ */ d("span", {
|
|
120
|
+
className: "text-text-tertiary text-2xs flex-1 text-center",
|
|
91
121
|
"aria-live": "polite",
|
|
92
|
-
children:
|
|
122
|
+
children: G === "start" ? "Select start date" : "Select end date"
|
|
93
123
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ d("button", {
|
|
95
125
|
type: "button",
|
|
96
|
-
onClick:
|
|
126
|
+
onClick: le,
|
|
97
127
|
"aria-label": "Next month",
|
|
98
|
-
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover
|
|
99
|
-
children: /* @__PURE__ */
|
|
128
|
+
className: e("text-text-tertiary hover:text-text-primary hover:bg-bg-hover h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]", P ? "hidden" : "flex"),
|
|
129
|
+
children: /* @__PURE__ */ d("span", {
|
|
100
130
|
className: "text-xs",
|
|
101
131
|
children: "›"
|
|
102
132
|
})
|
|
103
133
|
})
|
|
104
134
|
]
|
|
105
|
-
}), /* @__PURE__ */
|
|
106
|
-
className: "flex gap-4",
|
|
107
|
-
children: [/* @__PURE__ */
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
135
|
+
}), /* @__PURE__ */ f("div", {
|
|
136
|
+
className: "flex w-max gap-4",
|
|
137
|
+
children: [/* @__PURE__ */ d(o, {
|
|
138
|
+
ref: M,
|
|
139
|
+
year: L,
|
|
140
|
+
month: z,
|
|
141
|
+
rangeStart: q,
|
|
142
|
+
rangeEnd: Y,
|
|
143
|
+
hoverDate: G === "end" ? U : null,
|
|
113
144
|
onSelect: Z,
|
|
114
145
|
onMonthChange: (e, t) => {
|
|
115
|
-
|
|
146
|
+
R(e), B(t);
|
|
116
147
|
},
|
|
117
|
-
onHover:
|
|
118
|
-
}), /* @__PURE__ */
|
|
119
|
-
year:
|
|
120
|
-
month:
|
|
121
|
-
rangeStart:
|
|
122
|
-
rangeEnd:
|
|
123
|
-
hoverDate:
|
|
148
|
+
onHover: W
|
|
149
|
+
}), !P && /* @__PURE__ */ d(o, {
|
|
150
|
+
year: V,
|
|
151
|
+
month: H,
|
|
152
|
+
rangeStart: q,
|
|
153
|
+
rangeEnd: Y,
|
|
154
|
+
hoverDate: G === "end" ? U : null,
|
|
124
155
|
onSelect: Z,
|
|
125
156
|
onMonthChange: (e, t) => {
|
|
126
|
-
t === 0 ? (
|
|
157
|
+
t === 0 ? (R(e - 1), B(11)) : (R(e), B(t - 1));
|
|
127
158
|
},
|
|
128
|
-
onHover:
|
|
159
|
+
onHover: W
|
|
129
160
|
})]
|
|
130
161
|
})]
|
|
131
162
|
})
|
|
@@ -134,4 +165,4 @@ function p({ controlSize: p, label: m, value: h, defaultValue: g = f, onValueCha
|
|
|
134
165
|
});
|
|
135
166
|
}
|
|
136
167
|
//#endregion
|
|
137
|
-
export {
|
|
168
|
+
export { m as DateRangePicker };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
-
export interface EmptyStateProps extends ComponentPropsWithRef<"div"> {
|
|
2
|
+
export interface EmptyStateProps extends Omit<ComponentPropsWithRef<"div">, "title"> {
|
|
3
3
|
/** Icon shown in the tile above the title. Defaults to an inbox icon. */
|
|
4
4
|
icon?: ReactNode;
|
|
5
|
-
/**
|
|
6
|
-
title:
|
|
7
|
-
/**
|
|
8
|
-
|
|
5
|
+
/** Title content. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Renders the title as a heading at this level. String titles otherwise render as paragraphs. */
|
|
8
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
9
|
+
/** Supporting content below the title, including multiple paragraphs. */
|
|
10
|
+
description?: ReactNode;
|
|
9
11
|
/** Call-to-action, e.g. a Button, shown below the description. */
|
|
10
12
|
action?: ReactNode;
|
|
11
13
|
/** Additional utility classes for the root element. */
|
|
12
14
|
className?: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function EmptyState({ icon, title, description, action, className, ref, ...rest }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function EmptyState({ icon, title, headingLevel, description, action, className, ref, ...rest }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,27 +2,28 @@ import { cn as e } from "../../lib/cn.js";
|
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import { Inbox as r } from "lucide-react";
|
|
4
4
|
//#region src/components/ui/EmptyState.tsx
|
|
5
|
-
function i({ icon: i, title: a,
|
|
5
|
+
function i({ icon: i, title: a, headingLevel: o, description: s, action: c, className: l, ref: u, ...d }) {
|
|
6
|
+
let f = o ? `h${o}` : typeof a == "string" ? "p" : "div", p = typeof s == "string" ? "p" : "div";
|
|
6
7
|
return /* @__PURE__ */ n("div", {
|
|
7
|
-
...
|
|
8
|
-
ref:
|
|
9
|
-
className: e("flex flex-col items-center justify-center px-4 py-12",
|
|
8
|
+
...d,
|
|
9
|
+
ref: u,
|
|
10
|
+
className: e("flex flex-col items-center justify-center px-4 py-12", l),
|
|
10
11
|
children: [
|
|
11
12
|
/* @__PURE__ */ t("div", {
|
|
12
13
|
className: "bg-bg-tertiary text-text-tertiary mb-3 flex h-10 w-10 items-center justify-center rounded-md",
|
|
13
14
|
children: i || /* @__PURE__ */ t(r, { className: "h-5 w-5" })
|
|
14
15
|
}),
|
|
15
|
-
/* @__PURE__ */ t(
|
|
16
|
+
/* @__PURE__ */ t(f, {
|
|
16
17
|
className: "text-text-primary mb-1 text-sm font-medium",
|
|
17
18
|
children: a
|
|
18
19
|
}),
|
|
19
|
-
|
|
20
|
+
s || s === 0 ? /* @__PURE__ */ t(p, {
|
|
20
21
|
className: "text-text-secondary max-w-[300px] text-center text-xs",
|
|
21
|
-
children: o
|
|
22
|
-
}),
|
|
23
|
-
s && /* @__PURE__ */ t("div", {
|
|
24
|
-
className: "mt-4",
|
|
25
22
|
children: s
|
|
23
|
+
}) : null,
|
|
24
|
+
c && /* @__PURE__ */ t("div", {
|
|
25
|
+
className: "mt-4",
|
|
26
|
+
children: c
|
|
26
27
|
})
|
|
27
28
|
]
|
|
28
29
|
});
|
|
@@ -2,6 +2,11 @@ import { Component, type ErrorInfo, type ReactNode } from "react";
|
|
|
2
2
|
/** Props for ErrorBoundary. */
|
|
3
3
|
export interface ErrorBoundaryProps {
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
/** Render a custom recovery UI. Call reset to retry rendering the children. */
|
|
6
|
+
fallback?: (props: {
|
|
7
|
+
error: unknown;
|
|
8
|
+
reset: () => void;
|
|
9
|
+
}) => ReactNode;
|
|
5
10
|
}
|
|
6
11
|
interface State {
|
|
7
12
|
hasError: boolean;
|
|
@@ -11,6 +16,7 @@ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, State>
|
|
|
11
16
|
state: State;
|
|
12
17
|
static getDerivedStateFromError(error: Error): State;
|
|
13
18
|
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
19
|
+
private reset;
|
|
14
20
|
render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
15
21
|
}
|
|
16
22
|
export {};
|
|
@@ -16,8 +16,17 @@ var i = class extends t {
|
|
|
16
16
|
componentDidCatch(e, t) {
|
|
17
17
|
console.error("[ErrorBoundary] Uncaught error:", e, t.componentStack);
|
|
18
18
|
}
|
|
19
|
+
reset = () => {
|
|
20
|
+
this.setState({
|
|
21
|
+
hasError: !1,
|
|
22
|
+
error: null
|
|
23
|
+
});
|
|
24
|
+
};
|
|
19
25
|
render() {
|
|
20
|
-
return this.state.hasError ?
|
|
26
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback({
|
|
27
|
+
error: this.state.error,
|
|
28
|
+
reset: this.reset
|
|
29
|
+
}) : /* @__PURE__ */ r("div", {
|
|
21
30
|
className: "ui-glass-shell bg-bg-primary flex min-h-svh flex-col items-center justify-center p-8 text-center",
|
|
22
31
|
children: [
|
|
23
32
|
/* @__PURE__ */ n("p", {
|
|
@@ -31,10 +40,7 @@ var i = class extends t {
|
|
|
31
40
|
/* @__PURE__ */ n(e, {
|
|
32
41
|
variant: "secondary",
|
|
33
42
|
onClick: () => {
|
|
34
|
-
this.
|
|
35
|
-
hasError: !1,
|
|
36
|
-
error: null
|
|
37
|
-
}), window.location.href = "/";
|
|
43
|
+
this.reset(), window.location.href = "/";
|
|
38
44
|
},
|
|
39
45
|
children: "Go home"
|
|
40
46
|
})
|
|
@@ -14,7 +14,7 @@ export interface GridOptions {
|
|
|
14
14
|
justify?: "start" | "center" | "end" | "stretch";
|
|
15
15
|
}
|
|
16
16
|
export type GridProps<E extends LayoutElement = "div"> = LayoutProps<E, GridOptions>;
|
|
17
|
-
export declare function Grid<E extends LayoutElement = "div">({ as, columns, gap, gapX, gapY, align, justify, className, style, ...props }: GridProps<E>): import("react").DetailedReactHTMLElement<Omit<GridProps<E>, "columns" | "style" | "className" | "gap" | "
|
|
17
|
+
export declare function Grid<E extends LayoutElement = "div">({ as, columns, gap, gapX, gapY, align, justify, className, style, ...props }: GridProps<E>): import("react").DetailedReactHTMLElement<Omit<GridProps<E>, "columns" | "style" | "className" | "gap" | "align" | "justify" | "as" | "gapX" | "gapY"> & {
|
|
18
18
|
className: string;
|
|
19
19
|
style: LayoutStyle;
|
|
20
20
|
}, HTMLElement>;
|