@platned/ui 0.7.0 → 0.7.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/dist/index.cjs +1146 -913
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -15
- package/dist/index.d.ts +79 -15
- package/dist/index.js +1234 -995
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1834,25 +1834,402 @@ var Select = forwardRef8(function Select2({
|
|
|
1834
1834
|
});
|
|
1835
1835
|
|
|
1836
1836
|
// src/components/forms/date-picker.tsx
|
|
1837
|
-
import {
|
|
1838
|
-
|
|
1837
|
+
import {
|
|
1838
|
+
forwardRef as forwardRef10,
|
|
1839
|
+
useId as useId5,
|
|
1840
|
+
useMemo as useMemo3,
|
|
1841
|
+
useRef as useRef8,
|
|
1842
|
+
useState as useState8
|
|
1843
|
+
} from "react";
|
|
1844
|
+
import clsx16 from "clsx";
|
|
1839
1845
|
import { CalendarIcon } from "lucide-react";
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1846
|
+
|
|
1847
|
+
// src/components/overlays/popover.tsx
|
|
1848
|
+
import {
|
|
1849
|
+
createContext as createContext4,
|
|
1850
|
+
forwardRef as forwardRef9,
|
|
1851
|
+
useContext as useContext4,
|
|
1852
|
+
useId as useId3,
|
|
1853
|
+
useMemo,
|
|
1854
|
+
useState as useState6
|
|
1855
|
+
} from "react";
|
|
1856
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
1857
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1858
|
+
var PopoverTriggerNode = createContext4(null);
|
|
1859
|
+
function Popover({ children, open, defaultOpen, onOpenChange, modal = false }) {
|
|
1860
|
+
const [node, setNode] = useState6(null);
|
|
1861
|
+
const trigger = useMemo(() => ({ node, setNode, modal }), [node, modal]);
|
|
1862
|
+
return /* @__PURE__ */ jsx13(
|
|
1863
|
+
PopoverPrimitive.Root,
|
|
1864
|
+
{
|
|
1865
|
+
open,
|
|
1866
|
+
defaultOpen,
|
|
1867
|
+
onOpenChange,
|
|
1868
|
+
modal,
|
|
1869
|
+
children: /* @__PURE__ */ jsx13(PopoverTriggerNode.Provider, { value: trigger, children })
|
|
1870
|
+
}
|
|
1871
|
+
);
|
|
1872
|
+
}
|
|
1873
|
+
var PopoverTrigger = forwardRef9(
|
|
1874
|
+
function PopoverTrigger2(props, ref) {
|
|
1875
|
+
const trigger = useContext4(PopoverTriggerNode);
|
|
1876
|
+
const fallbackId = useId3();
|
|
1877
|
+
return /* @__PURE__ */ jsx13(
|
|
1878
|
+
PopoverPrimitive.Trigger,
|
|
1879
|
+
{
|
|
1880
|
+
ref: composeRefs(ref, trigger?.setNode),
|
|
1881
|
+
id: props.id ?? fallbackId,
|
|
1882
|
+
...props
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
);
|
|
1887
|
+
var PopoverContent = forwardRef9(
|
|
1888
|
+
function PopoverContent2({ children, side = "bottom", align = "center", sideOffset = 8, label, container, className, onOpenAutoFocus, ...rest }, ref) {
|
|
1889
|
+
const trigger = useContext4(PopoverTriggerNode);
|
|
1890
|
+
const inherited = usePortalContainer();
|
|
1891
|
+
return /* @__PURE__ */ jsx13(PopoverPrimitive.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ jsx13(
|
|
1892
|
+
PopoverPrimitive.Content,
|
|
1893
|
+
{
|
|
1894
|
+
ref,
|
|
1895
|
+
side,
|
|
1896
|
+
align,
|
|
1897
|
+
sideOffset,
|
|
1898
|
+
collisionPadding: 8,
|
|
1899
|
+
onOpenAutoFocus,
|
|
1900
|
+
onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
|
|
1901
|
+
"aria-modal": trigger?.modal || void 0,
|
|
1902
|
+
"aria-label": label,
|
|
1903
|
+
"aria-labelledby": label ? void 0 : trigger?.node?.id || void 0,
|
|
1904
|
+
className: cn(
|
|
1905
|
+
"z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400",
|
|
1906
|
+
"focus:outline-none",
|
|
1907
|
+
className
|
|
1908
|
+
),
|
|
1909
|
+
...rest,
|
|
1910
|
+
children
|
|
1911
|
+
}
|
|
1912
|
+
) });
|
|
1913
|
+
}
|
|
1914
|
+
);
|
|
1915
|
+
var PopoverClose = forwardRef9(
|
|
1916
|
+
function PopoverClose2(props, ref) {
|
|
1917
|
+
return /* @__PURE__ */ jsx13(PopoverPrimitive.Close, { ref, ...props });
|
|
1918
|
+
}
|
|
1919
|
+
);
|
|
1920
|
+
var PopoverAnchor = forwardRef9(
|
|
1921
|
+
function PopoverAnchor2(props, ref) {
|
|
1922
|
+
return /* @__PURE__ */ jsx13(PopoverPrimitive.Anchor, { ref, ...props });
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
|
|
1926
|
+
// src/components/forms/calendar.tsx
|
|
1927
|
+
import {
|
|
1928
|
+
useCallback as useCallback3,
|
|
1929
|
+
useEffect as useEffect6,
|
|
1930
|
+
useId as useId4,
|
|
1931
|
+
useMemo as useMemo2,
|
|
1932
|
+
useRef as useRef7,
|
|
1933
|
+
useState as useState7
|
|
1934
|
+
} from "react";
|
|
1935
|
+
import clsx15 from "clsx";
|
|
1936
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
1937
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1938
|
+
var CAPTION_SELECT = clsx15(
|
|
1939
|
+
"h-7 appearance-none rounded-md border border-default bg-default px-2 text-body-xs font-medium text-default",
|
|
1940
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default"
|
|
1941
|
+
);
|
|
1942
|
+
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
1943
|
+
var sameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
1944
|
+
var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
1945
|
+
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
1946
|
+
var isBefore = (a, b) => startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
1947
|
+
var isAfter = (a, b) => startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
1948
|
+
var inRange = (d, from, to) => startOfDay(d).getTime() > startOfDay(from).getTime() && startOfDay(d).getTime() < startOfDay(to).getTime();
|
|
1949
|
+
function monthGrid(month, weekStartsOn) {
|
|
1950
|
+
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
1951
|
+
const offset2 = (first.getDay() - weekStartsOn + 7) % 7;
|
|
1952
|
+
const start = addDays(first, -offset2);
|
|
1953
|
+
return Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
1954
|
+
}
|
|
1955
|
+
function Calendar({
|
|
1956
|
+
mode = "single",
|
|
1957
|
+
value,
|
|
1958
|
+
range,
|
|
1959
|
+
onSelect,
|
|
1960
|
+
onRangeChange,
|
|
1961
|
+
defaultMonth,
|
|
1962
|
+
min,
|
|
1963
|
+
max,
|
|
1964
|
+
isDateDisabled,
|
|
1965
|
+
weekStartsOn = 1,
|
|
1966
|
+
locale,
|
|
1967
|
+
label = "Calendar",
|
|
1968
|
+
captionLayout = "label",
|
|
1969
|
+
startYear,
|
|
1970
|
+
endYear,
|
|
1971
|
+
className,
|
|
1972
|
+
...rest
|
|
1973
|
+
}) {
|
|
1974
|
+
const today = useMemo2(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1975
|
+
const gridId = useId4();
|
|
1976
|
+
const [month, setMonth] = useState7(
|
|
1977
|
+
() => defaultMonth ?? value ?? range?.from ?? today
|
|
1978
|
+
);
|
|
1979
|
+
const [focusedDate, setFocusedDate] = useState7(
|
|
1980
|
+
() => value ?? range?.from ?? today
|
|
1981
|
+
);
|
|
1982
|
+
const cellRefs = useRef7(/* @__PURE__ */ new Map());
|
|
1983
|
+
const monthFormatter = useMemo2(
|
|
1984
|
+
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
1985
|
+
[locale]
|
|
1986
|
+
);
|
|
1987
|
+
const dayNameFormatter = useMemo2(
|
|
1988
|
+
() => new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
1989
|
+
[locale]
|
|
1990
|
+
);
|
|
1991
|
+
const monthNameFormatter = useMemo2(
|
|
1992
|
+
() => new Intl.DateTimeFormat(locale, { month: "long" }),
|
|
1993
|
+
[locale]
|
|
1994
|
+
);
|
|
1995
|
+
const fullDateFormatter = useMemo2(
|
|
1996
|
+
() => new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
1997
|
+
[locale]
|
|
1998
|
+
);
|
|
1999
|
+
const disabled = useCallback3(
|
|
2000
|
+
(date) => {
|
|
2001
|
+
if (min && isBefore(date, min)) return true;
|
|
2002
|
+
if (max && isAfter(date, max)) return true;
|
|
2003
|
+
return isDateDisabled?.(date) ?? false;
|
|
2004
|
+
},
|
|
2005
|
+
[min, max, isDateDisabled]
|
|
2006
|
+
);
|
|
2007
|
+
const key = (d) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
2008
|
+
const pendingFocus = useRef7(false);
|
|
2009
|
+
const focusDate = useCallback3((date) => {
|
|
2010
|
+
pendingFocus.current = true;
|
|
2011
|
+
setFocusedDate(date);
|
|
2012
|
+
setMonth(
|
|
2013
|
+
(current) => current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth() ? current : new Date(date.getFullYear(), date.getMonth(), 1)
|
|
2014
|
+
);
|
|
2015
|
+
}, []);
|
|
2016
|
+
useEffect6(() => {
|
|
2017
|
+
if (!pendingFocus.current) return;
|
|
2018
|
+
const node = cellRefs.current.get(key(focusedDate));
|
|
2019
|
+
if (node) {
|
|
2020
|
+
node.focus();
|
|
2021
|
+
pendingFocus.current = false;
|
|
2022
|
+
}
|
|
2023
|
+
}, [focusedDate, month]);
|
|
2024
|
+
const select = (date) => {
|
|
2025
|
+
if (disabled(date)) return;
|
|
2026
|
+
setFocusedDate(date);
|
|
2027
|
+
if (mode === "single") {
|
|
2028
|
+
onSelect?.(date);
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
const current = range ?? { from: null, to: null };
|
|
2032
|
+
if (!current.from || current.to || isBefore(date, current.from)) {
|
|
2033
|
+
onRangeChange?.({ from: date, to: null });
|
|
2034
|
+
} else {
|
|
2035
|
+
onRangeChange?.({ from: current.from, to: date });
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
const onKeyDown = (event) => {
|
|
2039
|
+
const moves = {
|
|
2040
|
+
ArrowLeft: () => addDays(focusedDate, -1),
|
|
2041
|
+
ArrowRight: () => addDays(focusedDate, 1),
|
|
2042
|
+
ArrowUp: () => addDays(focusedDate, -7),
|
|
2043
|
+
ArrowDown: () => addDays(focusedDate, 7),
|
|
2044
|
+
Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),
|
|
2045
|
+
End: () => addDays(focusedDate, 6 - (focusedDate.getDay() - weekStartsOn + 7) % 7),
|
|
2046
|
+
// Shift moves a year (APG date-picker dialog); without it, a month.
|
|
2047
|
+
PageUp: () => new Date(focusedDate.getFullYear() - (event.shiftKey ? 1 : 0), focusedDate.getMonth() - (event.shiftKey ? 0 : 1), focusedDate.getDate()),
|
|
2048
|
+
PageDown: () => new Date(focusedDate.getFullYear() + (event.shiftKey ? 1 : 0), focusedDate.getMonth() + (event.shiftKey ? 0 : 1), focusedDate.getDate())
|
|
2049
|
+
};
|
|
2050
|
+
const move = moves[event.key];
|
|
2051
|
+
if (move) {
|
|
2052
|
+
event.preventDefault();
|
|
2053
|
+
focusDate(move());
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
const firstYear = startYear ?? min?.getFullYear() ?? today.getFullYear() - 100;
|
|
2057
|
+
const lastYear = endYear ?? max?.getFullYear() ?? today.getFullYear() + 10;
|
|
2058
|
+
const years = Array.from({ length: Math.max(0, lastYear - firstYear) + 1 }, (_, i) => firstYear + i);
|
|
2059
|
+
const monthOutOfRange = (m) => !!min && (month.getFullYear() < min.getFullYear() || month.getFullYear() === min.getFullYear() && m < min.getMonth()) || !!max && (month.getFullYear() > max.getFullYear() || month.getFullYear() === max.getFullYear() && m > max.getMonth());
|
|
2060
|
+
const showMonth = (year, m) => {
|
|
2061
|
+
let next = new Date(year, m, 1);
|
|
2062
|
+
if (min && next < new Date(min.getFullYear(), min.getMonth(), 1)) next = new Date(min.getFullYear(), min.getMonth(), 1);
|
|
2063
|
+
if (max && next > new Date(max.getFullYear(), max.getMonth(), 1)) next = new Date(max.getFullYear(), max.getMonth(), 1);
|
|
2064
|
+
setMonth(next);
|
|
2065
|
+
const day = Math.min(focusedDate.getDate(), new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate());
|
|
2066
|
+
setFocusedDate(new Date(next.getFullYear(), next.getMonth(), day));
|
|
2067
|
+
};
|
|
2068
|
+
const days = monthGrid(month, weekStartsOn);
|
|
2069
|
+
const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));
|
|
2070
|
+
return /* @__PURE__ */ jsxs8(
|
|
2071
|
+
"div",
|
|
2072
|
+
{
|
|
2073
|
+
"data-slot": "calendar",
|
|
2074
|
+
className: cn("w-fit rounded-xl border border-default bg-default p-3", className),
|
|
2075
|
+
...rest,
|
|
2076
|
+
children: [
|
|
2077
|
+
/* @__PURE__ */ jsxs8("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
2078
|
+
/* @__PURE__ */ jsx14(
|
|
2079
|
+
IconButton,
|
|
2080
|
+
{
|
|
2081
|
+
variant: "subtle",
|
|
2082
|
+
size: "sm",
|
|
2083
|
+
"aria-label": "Previous month",
|
|
2084
|
+
disabled: !!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1)),
|
|
2085
|
+
onClick: () => setMonth(addMonths(month, -1)),
|
|
2086
|
+
children: /* @__PURE__ */ jsx14(ChevronLeftIcon, { "aria-hidden": true, size: 16 })
|
|
2087
|
+
}
|
|
2088
|
+
),
|
|
2089
|
+
captionLayout === "dropdown" ? /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1.5", children: [
|
|
2090
|
+
/* @__PURE__ */ jsx14(
|
|
2091
|
+
"select",
|
|
2092
|
+
{
|
|
2093
|
+
"aria-label": "Month",
|
|
2094
|
+
value: month.getMonth(),
|
|
2095
|
+
onChange: (event) => showMonth(month.getFullYear(), Number(event.target.value)),
|
|
2096
|
+
className: CAPTION_SELECT,
|
|
2097
|
+
children: Array.from({ length: 12 }, (_, m) => /* @__PURE__ */ jsx14("option", { value: m, disabled: monthOutOfRange(m), children: monthNameFormatter.format(new Date(2e3, m, 1)) }, m))
|
|
2098
|
+
}
|
|
2099
|
+
),
|
|
2100
|
+
/* @__PURE__ */ jsx14(
|
|
2101
|
+
"select",
|
|
2102
|
+
{
|
|
2103
|
+
"aria-label": "Year",
|
|
2104
|
+
value: month.getFullYear(),
|
|
2105
|
+
onChange: (event) => showMonth(Number(event.target.value), month.getMonth()),
|
|
2106
|
+
className: CAPTION_SELECT,
|
|
2107
|
+
children: years.map((year) => /* @__PURE__ */ jsx14("option", { value: year, children: year }, year))
|
|
2108
|
+
}
|
|
2109
|
+
),
|
|
2110
|
+
/* @__PURE__ */ jsx14("span", { "aria-live": "polite", className: "sr-only", children: monthFormatter.format(month) })
|
|
2111
|
+
] }) : /* @__PURE__ */ jsx14("span", { "aria-live": "polite", className: "text-body-sm font-semibold text-default", children: monthFormatter.format(month) }),
|
|
2112
|
+
/* @__PURE__ */ jsx14(
|
|
2113
|
+
IconButton,
|
|
2114
|
+
{
|
|
2115
|
+
variant: "subtle",
|
|
2116
|
+
size: "sm",
|
|
2117
|
+
"aria-label": "Next month",
|
|
2118
|
+
disabled: !!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1)),
|
|
2119
|
+
onClick: () => setMonth(addMonths(month, 1)),
|
|
2120
|
+
children: /* @__PURE__ */ jsx14(ChevronRightIcon, { "aria-hidden": true, size: 16 })
|
|
2121
|
+
}
|
|
2122
|
+
)
|
|
2123
|
+
] }),
|
|
2124
|
+
/* @__PURE__ */ jsxs8(
|
|
2125
|
+
"div",
|
|
2126
|
+
{
|
|
2127
|
+
role: "grid",
|
|
2128
|
+
"aria-label": label,
|
|
2129
|
+
id: gridId,
|
|
2130
|
+
tabIndex: -1,
|
|
2131
|
+
onKeyDown,
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ jsx14("div", { role: "row", className: "mb-1 grid grid-cols-7", children: weekdayNames.map((name) => /* @__PURE__ */ jsx14(
|
|
2134
|
+
"div",
|
|
2135
|
+
{
|
|
2136
|
+
role: "columnheader",
|
|
2137
|
+
className: "flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary",
|
|
2138
|
+
children: name
|
|
2139
|
+
},
|
|
2140
|
+
name
|
|
2141
|
+
)) }),
|
|
2142
|
+
Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ jsx14("div", { role: "row", className: "grid grid-cols-7", children: days.slice(week * 7, week * 7 + 7).map((date) => {
|
|
2143
|
+
const outside = date.getMonth() !== month.getMonth();
|
|
2144
|
+
const isDisabled = disabled(date);
|
|
2145
|
+
const selected = mode === "single" ? sameDay(date, value) : sameDay(date, range?.from) || sameDay(date, range?.to);
|
|
2146
|
+
const between = mode === "range" && range?.from && range?.to ? inRange(date, range.from, range.to) : false;
|
|
2147
|
+
const isFocused = sameDay(date, focusedDate);
|
|
2148
|
+
return /* @__PURE__ */ jsx14("div", { role: "gridcell", "aria-selected": selected || void 0, children: /* @__PURE__ */ jsx14(
|
|
2149
|
+
"button",
|
|
2150
|
+
{
|
|
2151
|
+
ref: (node) => {
|
|
2152
|
+
if (node) cellRefs.current.set(key(date), node);
|
|
2153
|
+
else cellRefs.current.delete(key(date));
|
|
2154
|
+
},
|
|
2155
|
+
type: "button",
|
|
2156
|
+
tabIndex: isFocused ? 0 : -1,
|
|
2157
|
+
disabled: isDisabled,
|
|
2158
|
+
"aria-label": fullDateFormatter.format(date),
|
|
2159
|
+
"aria-current": sameDay(date, today) ? "date" : void 0,
|
|
2160
|
+
onClick: () => select(date),
|
|
2161
|
+
onFocus: () => setFocusedDate(date),
|
|
2162
|
+
className: clsx15(
|
|
2163
|
+
"flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors",
|
|
2164
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2165
|
+
"disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent",
|
|
2166
|
+
selected ? "bg-brand font-semibold text-brand-on-brand" : between ? "rounded-none bg-brand-tertiary text-default" : outside ? "text-default-tertiary hover:bg-default-secondary" : "text-default hover:bg-default-secondary",
|
|
2167
|
+
// Today is marked by a ring rather than a fill, so it stays legible
|
|
2168
|
+
// when it is also the selected day.
|
|
2169
|
+
sameDay(date, today) && !selected && "ring-1 ring-inset ring-brand-tertiary"
|
|
2170
|
+
),
|
|
2171
|
+
children: date.getDate()
|
|
2172
|
+
}
|
|
2173
|
+
) }, key(date));
|
|
2174
|
+
}) }, week))
|
|
2175
|
+
]
|
|
2176
|
+
}
|
|
2177
|
+
)
|
|
2178
|
+
]
|
|
2179
|
+
}
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
// src/components/forms/date-picker.tsx
|
|
2184
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2185
|
+
var triggerBase = {
|
|
2186
|
+
lg: "h-12 px-5 pr-12 text-body",
|
|
2187
|
+
md: "h-9 px-4 pr-8 text-body-sm",
|
|
2188
|
+
sm: "h-6 px-3 pr-6 text-body-tiny"
|
|
1845
2189
|
};
|
|
1846
2190
|
var iconWrap2 = {
|
|
1847
2191
|
lg: { right: "right-4", size: "size-5" },
|
|
1848
2192
|
md: { right: "right-3", size: "size-4" },
|
|
1849
2193
|
sm: { right: "right-2", size: "size-3" }
|
|
1850
2194
|
};
|
|
1851
|
-
var
|
|
2195
|
+
var ISO = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2196
|
+
function parseIso(value) {
|
|
2197
|
+
const match = value ? ISO.exec(value) : null;
|
|
2198
|
+
if (!match) return null;
|
|
2199
|
+
const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
|
2200
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
2201
|
+
}
|
|
2202
|
+
function toIso(date) {
|
|
2203
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
2204
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
2205
|
+
}
|
|
2206
|
+
var DatePicker = forwardRef10(function DatePicker2({
|
|
2207
|
+
label,
|
|
2208
|
+
description,
|
|
2209
|
+
error,
|
|
2210
|
+
hint,
|
|
2211
|
+
size: sizeProp,
|
|
2212
|
+
className,
|
|
2213
|
+
disabled,
|
|
2214
|
+
required,
|
|
2215
|
+
id,
|
|
2216
|
+
value: valueProp,
|
|
2217
|
+
defaultValue,
|
|
2218
|
+
onChange,
|
|
2219
|
+
onValueChange,
|
|
2220
|
+
onBlur,
|
|
2221
|
+
placeholder = "Pick a date",
|
|
2222
|
+
locale,
|
|
2223
|
+
weekStartsOn,
|
|
2224
|
+
captionLayout = "dropdown",
|
|
2225
|
+
startYear,
|
|
2226
|
+
endYear,
|
|
2227
|
+
min,
|
|
2228
|
+
max,
|
|
2229
|
+
...props
|
|
2230
|
+
}, ref) {
|
|
1852
2231
|
const size2 = useControlSize(sizeProp);
|
|
1853
|
-
|
|
1854
|
-
const iw = iconWrap2[size2];
|
|
1855
|
-
return /* @__PURE__ */ jsxs8(
|
|
2232
|
+
return /* @__PURE__ */ jsxs9(
|
|
1856
2233
|
Field,
|
|
1857
2234
|
{
|
|
1858
2235
|
id,
|
|
@@ -1860,79 +2237,190 @@ var DatePicker = forwardRef9(function DatePicker2({ label, description, error, h
|
|
|
1860
2237
|
disabled,
|
|
1861
2238
|
required,
|
|
1862
2239
|
hasDescription: !!description,
|
|
1863
|
-
hasError,
|
|
2240
|
+
hasError: !!error,
|
|
1864
2241
|
hasHint: !!hint,
|
|
1865
2242
|
className,
|
|
1866
2243
|
children: [
|
|
1867
|
-
label && /* @__PURE__ */
|
|
1868
|
-
description && /* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
] }),
|
|
1896
|
-
hasError && /* @__PURE__ */ jsx13(FieldError, { children: error }),
|
|
1897
|
-
!hasError && hint && /* @__PURE__ */ jsx13(FieldHint, { children: hint })
|
|
2244
|
+
label && /* @__PURE__ */ jsx15(FieldLabel, { children: label }),
|
|
2245
|
+
description && /* @__PURE__ */ jsx15(FieldDescription, { children: description }),
|
|
2246
|
+
/* @__PURE__ */ jsx15(
|
|
2247
|
+
DateControl,
|
|
2248
|
+
{
|
|
2249
|
+
ref,
|
|
2250
|
+
size: size2,
|
|
2251
|
+
invalid: !!error,
|
|
2252
|
+
disabled,
|
|
2253
|
+
required,
|
|
2254
|
+
value: valueProp,
|
|
2255
|
+
defaultValue,
|
|
2256
|
+
onChange,
|
|
2257
|
+
onValueChange,
|
|
2258
|
+
onBlur,
|
|
2259
|
+
placeholder,
|
|
2260
|
+
locale,
|
|
2261
|
+
weekStartsOn,
|
|
2262
|
+
captionLayout,
|
|
2263
|
+
startYear,
|
|
2264
|
+
endYear,
|
|
2265
|
+
min: typeof min === "number" ? String(min) : min,
|
|
2266
|
+
max: typeof max === "number" ? String(max) : max,
|
|
2267
|
+
label,
|
|
2268
|
+
inputProps: props
|
|
2269
|
+
}
|
|
2270
|
+
),
|
|
2271
|
+
error ? /* @__PURE__ */ jsx15(FieldError, { children: error }) : hint && /* @__PURE__ */ jsx15(FieldHint, { children: hint })
|
|
1898
2272
|
]
|
|
1899
2273
|
}
|
|
1900
2274
|
);
|
|
1901
2275
|
});
|
|
1902
|
-
var
|
|
1903
|
-
|
|
2276
|
+
var DateControl = forwardRef10(function DateControl2({
|
|
2277
|
+
size: size2,
|
|
2278
|
+
invalid,
|
|
2279
|
+
disabled,
|
|
2280
|
+
required,
|
|
2281
|
+
value,
|
|
2282
|
+
defaultValue,
|
|
2283
|
+
onChange,
|
|
2284
|
+
onValueChange,
|
|
2285
|
+
onBlur,
|
|
2286
|
+
placeholder,
|
|
2287
|
+
locale,
|
|
2288
|
+
weekStartsOn,
|
|
2289
|
+
captionLayout,
|
|
2290
|
+
startYear,
|
|
2291
|
+
endYear,
|
|
2292
|
+
min,
|
|
2293
|
+
max,
|
|
2294
|
+
label,
|
|
2295
|
+
inputProps: { name, ...inputProps }
|
|
2296
|
+
}, ref) {
|
|
1904
2297
|
const field = useFieldControl();
|
|
2298
|
+
const fieldContext = useFieldContext();
|
|
2299
|
+
const valueId = useId5();
|
|
2300
|
+
const dialogId = useId5();
|
|
2301
|
+
const [open, setOpen] = useState8(false);
|
|
2302
|
+
const [internal, setInternal] = useState8(defaultValue ?? "");
|
|
2303
|
+
const iso = value ?? internal;
|
|
2304
|
+
const date = parseIso(iso);
|
|
2305
|
+
const triggerRef = useRef8(null);
|
|
2306
|
+
const inputRef = useRef8(null);
|
|
2307
|
+
const contentRef = useRef8(null);
|
|
1905
2308
|
const isInvalid = invalid || !!field["aria-invalid"];
|
|
1906
|
-
const isDisabled =
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
"[&::-webkit-calendar-picker-indicator]:opacity-0",
|
|
1918
|
-
"[&::-webkit-calendar-picker-indicator]:absolute",
|
|
1919
|
-
"[&::-webkit-calendar-picker-indicator]:right-0",
|
|
1920
|
-
"[&::-webkit-calendar-picker-indicator]:h-full",
|
|
1921
|
-
"[&::-webkit-calendar-picker-indicator]:w-10",
|
|
1922
|
-
"[&::-webkit-calendar-picker-indicator]:cursor-pointer",
|
|
1923
|
-
inputBase2[size2],
|
|
1924
|
-
isDisabled ? "cursor-not-allowed border-disabled bg-disabled text-disabled" : isInvalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand",
|
|
1925
|
-
className
|
|
1926
|
-
),
|
|
1927
|
-
...props
|
|
2309
|
+
const isDisabled = disabled ?? field.disabled;
|
|
2310
|
+
const iw = iconWrap2[size2];
|
|
2311
|
+
const formatter = useMemo3(() => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }), [locale]);
|
|
2312
|
+
const commit = (next) => {
|
|
2313
|
+
const nextIso = toIso(next);
|
|
2314
|
+
if (value === void 0) setInternal(nextIso);
|
|
2315
|
+
onValueChange?.(nextIso);
|
|
2316
|
+
const input = inputRef.current;
|
|
2317
|
+
if (input) {
|
|
2318
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(input, nextIso);
|
|
2319
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
1928
2320
|
}
|
|
1929
|
-
|
|
2321
|
+
setOpen(false);
|
|
2322
|
+
};
|
|
2323
|
+
return /* @__PURE__ */ jsxs9("div", { className: "relative flex items-center", children: [
|
|
2324
|
+
/* @__PURE__ */ jsxs9(Popover, { open, onOpenChange: setOpen, children: [
|
|
2325
|
+
/* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
|
|
2326
|
+
"button",
|
|
2327
|
+
{
|
|
2328
|
+
ref: triggerRef,
|
|
2329
|
+
type: "button",
|
|
2330
|
+
role: "combobox",
|
|
2331
|
+
"aria-haspopup": "dialog",
|
|
2332
|
+
"aria-expanded": open,
|
|
2333
|
+
"aria-controls": open ? dialogId : void 0,
|
|
2334
|
+
"aria-labelledby": fieldContext ? `${fieldContext.labelId} ${valueId}` : void 0,
|
|
2335
|
+
"aria-label": fieldContext ? void 0 : label,
|
|
2336
|
+
"data-size": size2,
|
|
2337
|
+
...field,
|
|
2338
|
+
disabled: isDisabled,
|
|
2339
|
+
onBlur,
|
|
2340
|
+
className: clsx16(
|
|
2341
|
+
"w-full appearance-none rounded-lg border text-left outline-none transition-colors",
|
|
2342
|
+
"bg-default text-default",
|
|
2343
|
+
"focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2344
|
+
triggerBase[size2],
|
|
2345
|
+
isDisabled ? "cursor-not-allowed border-disabled bg-disabled text-disabled" : isInvalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand"
|
|
2346
|
+
),
|
|
2347
|
+
children: /* @__PURE__ */ jsx15("span", { id: valueId, className: clsx16("block truncate", !date && "text-default-tertiary"), children: date ? formatter.format(date) : placeholder })
|
|
2348
|
+
}
|
|
2349
|
+
) }),
|
|
2350
|
+
/* @__PURE__ */ jsx15(
|
|
2351
|
+
PopoverContent,
|
|
2352
|
+
{
|
|
2353
|
+
ref: contentRef,
|
|
2354
|
+
id: dialogId,
|
|
2355
|
+
label: label ? `Choose ${label.toLowerCase()}` : "Choose date",
|
|
2356
|
+
align: "start",
|
|
2357
|
+
className: "w-auto max-w-none p-0",
|
|
2358
|
+
onOpenAutoFocus: (event) => {
|
|
2359
|
+
event.preventDefault();
|
|
2360
|
+
contentRef.current?.querySelector('[role="grid"] [tabindex="0"]')?.focus();
|
|
2361
|
+
},
|
|
2362
|
+
children: /* @__PURE__ */ jsx15(
|
|
2363
|
+
Calendar,
|
|
2364
|
+
{
|
|
2365
|
+
value: date,
|
|
2366
|
+
onSelect: commit,
|
|
2367
|
+
min: parseIso(min) ?? void 0,
|
|
2368
|
+
max: parseIso(max) ?? void 0,
|
|
2369
|
+
locale,
|
|
2370
|
+
weekStartsOn,
|
|
2371
|
+
captionLayout,
|
|
2372
|
+
startYear,
|
|
2373
|
+
endYear,
|
|
2374
|
+
label: label ?? "Calendar",
|
|
2375
|
+
className: "border-0"
|
|
2376
|
+
}
|
|
2377
|
+
)
|
|
2378
|
+
}
|
|
2379
|
+
)
|
|
2380
|
+
] }),
|
|
2381
|
+
/* @__PURE__ */ jsx15(
|
|
2382
|
+
"span",
|
|
2383
|
+
{
|
|
2384
|
+
"aria-hidden": true,
|
|
2385
|
+
className: clsx16(
|
|
2386
|
+
"pointer-events-none absolute",
|
|
2387
|
+
iw.right,
|
|
2388
|
+
iw.size,
|
|
2389
|
+
"flex items-center justify-center",
|
|
2390
|
+
isDisabled ? "text-icon-disabled" : "text-icon-default-secondary"
|
|
2391
|
+
),
|
|
2392
|
+
children: /* @__PURE__ */ jsx15(CalendarIcon, { className: "size-full" })
|
|
2393
|
+
}
|
|
2394
|
+
),
|
|
2395
|
+
/* @__PURE__ */ jsx15(
|
|
2396
|
+
"input",
|
|
2397
|
+
{
|
|
2398
|
+
ref: composeRefs(ref, inputRef),
|
|
2399
|
+
type: "date",
|
|
2400
|
+
"aria-hidden": true,
|
|
2401
|
+
tabIndex: -1,
|
|
2402
|
+
...inputProps,
|
|
2403
|
+
name,
|
|
2404
|
+
value: iso,
|
|
2405
|
+
min,
|
|
2406
|
+
max,
|
|
2407
|
+
required,
|
|
2408
|
+
disabled: isDisabled,
|
|
2409
|
+
onChange: (event) => {
|
|
2410
|
+
if (value === void 0) setInternal(event.target.value);
|
|
2411
|
+
onChange?.(event);
|
|
2412
|
+
},
|
|
2413
|
+
onFocus: () => triggerRef.current?.focus(),
|
|
2414
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0"
|
|
2415
|
+
}
|
|
2416
|
+
)
|
|
2417
|
+
] });
|
|
1930
2418
|
});
|
|
1931
2419
|
|
|
1932
2420
|
// src/components/forms/stepper.tsx
|
|
1933
|
-
import
|
|
1934
|
-
import { CheckIcon as CheckIcon2, ChevronRightIcon } from "lucide-react";
|
|
1935
|
-
import { jsx as
|
|
2421
|
+
import clsx17 from "clsx";
|
|
2422
|
+
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
|
|
2423
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1936
2424
|
var STATUS_TEXT = {
|
|
1937
2425
|
complete: "completed",
|
|
1938
2426
|
active: "current step",
|
|
@@ -1945,41 +2433,41 @@ var SIZE2 = {
|
|
|
1945
2433
|
function StepIndicator({ status, size: size2 }) {
|
|
1946
2434
|
const s = SIZE2[size2];
|
|
1947
2435
|
if (status === "complete") {
|
|
1948
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ jsx16(
|
|
1949
2437
|
"span",
|
|
1950
2438
|
{
|
|
1951
2439
|
"aria-hidden": true,
|
|
1952
|
-
className:
|
|
2440
|
+
className: clsx17(
|
|
1953
2441
|
"flex shrink-0 items-center justify-center rounded-full bg-brand text-brand-on-brand",
|
|
1954
2442
|
s.indicator
|
|
1955
2443
|
),
|
|
1956
|
-
children: /* @__PURE__ */
|
|
2444
|
+
children: /* @__PURE__ */ jsx16(CheckIcon2, { size: s.glyph })
|
|
1957
2445
|
}
|
|
1958
2446
|
);
|
|
1959
2447
|
}
|
|
1960
2448
|
if (status === "active") {
|
|
1961
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ jsx16(
|
|
1962
2450
|
"span",
|
|
1963
2451
|
{
|
|
1964
2452
|
"aria-hidden": true,
|
|
1965
|
-
className:
|
|
2453
|
+
className: clsx17(
|
|
1966
2454
|
"flex shrink-0 items-center justify-center rounded-full border-2 border-brand-emphasis",
|
|
1967
2455
|
s.indicator
|
|
1968
2456
|
),
|
|
1969
|
-
children: /* @__PURE__ */
|
|
2457
|
+
children: /* @__PURE__ */ jsx16("span", { className: "size-2.5 rounded-full bg-brand" })
|
|
1970
2458
|
}
|
|
1971
2459
|
);
|
|
1972
2460
|
}
|
|
1973
|
-
return /* @__PURE__ */
|
|
2461
|
+
return /* @__PURE__ */ jsx16(
|
|
1974
2462
|
"span",
|
|
1975
2463
|
{
|
|
1976
2464
|
"aria-hidden": true,
|
|
1977
|
-
className:
|
|
2465
|
+
className: clsx17("shrink-0 rounded-full border-2 border-disabled", s.indicator)
|
|
1978
2466
|
}
|
|
1979
2467
|
);
|
|
1980
2468
|
}
|
|
1981
2469
|
function ChevronSeparator() {
|
|
1982
|
-
return /* @__PURE__ */
|
|
2470
|
+
return /* @__PURE__ */ jsx16(ChevronRightIcon2, { className: "mx-1 size-4 shrink-0 text-default-tertiary", "aria-hidden": true });
|
|
1983
2471
|
}
|
|
1984
2472
|
var labelClass = {
|
|
1985
2473
|
complete: "text-brand font-semibold",
|
|
@@ -1990,26 +2478,26 @@ function Stepper({ steps, size: size2 = "md", label = "Progress", className }) {
|
|
|
1990
2478
|
const s = SIZE2[size2];
|
|
1991
2479
|
return (
|
|
1992
2480
|
// An <ol> cannot be wrapped without breaking the list relationship with its <li>s.
|
|
1993
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ jsx16(
|
|
1994
2482
|
"ol",
|
|
1995
2483
|
{
|
|
1996
|
-
className:
|
|
2484
|
+
className: clsx17("flex items-center overflow-x-auto", SCROLLBAR_CLASSES, className),
|
|
1997
2485
|
"aria-label": label,
|
|
1998
|
-
children: steps.map((step, i) => /* @__PURE__ */
|
|
2486
|
+
children: steps.map((step, i) => /* @__PURE__ */ jsxs10(
|
|
1999
2487
|
"li",
|
|
2000
2488
|
{
|
|
2001
2489
|
className: "flex items-center",
|
|
2002
2490
|
"aria-current": step.status === "active" ? "step" : void 0,
|
|
2003
2491
|
children: [
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex items-center gap-1.5", children: [
|
|
2493
|
+
/* @__PURE__ */ jsx16(StepIndicator, { status: step.status, size: size2 }),
|
|
2494
|
+
/* @__PURE__ */ jsx16("span", { className: clsx17("whitespace-nowrap", s.label, labelClass[step.status]), children: step.label }),
|
|
2495
|
+
/* @__PURE__ */ jsxs10("span", { className: "sr-only", children: [
|
|
2008
2496
|
", ",
|
|
2009
2497
|
STATUS_TEXT[step.status]
|
|
2010
2498
|
] })
|
|
2011
2499
|
] }),
|
|
2012
|
-
i < steps.length - 1 && /* @__PURE__ */
|
|
2500
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx16(ChevronSeparator, {})
|
|
2013
2501
|
]
|
|
2014
2502
|
},
|
|
2015
2503
|
step.label
|
|
@@ -2020,9 +2508,9 @@ function Stepper({ steps, size: size2 = "md", label = "Progress", className }) {
|
|
|
2020
2508
|
}
|
|
2021
2509
|
|
|
2022
2510
|
// src/components/forms/multiselect-card.tsx
|
|
2023
|
-
import
|
|
2511
|
+
import clsx18 from "clsx";
|
|
2024
2512
|
import { CheckIcon as CheckIcon3 } from "lucide-react";
|
|
2025
|
-
import { jsx as
|
|
2513
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2026
2514
|
var SIZE3 = {
|
|
2027
2515
|
default: {
|
|
2028
2516
|
pad: "p-4",
|
|
@@ -2052,7 +2540,7 @@ function MultiSelectCard({
|
|
|
2052
2540
|
className
|
|
2053
2541
|
}) {
|
|
2054
2542
|
const s = SIZE3[size2];
|
|
2055
|
-
return /* @__PURE__ */
|
|
2543
|
+
return /* @__PURE__ */ jsxs11(
|
|
2056
2544
|
"button",
|
|
2057
2545
|
{
|
|
2058
2546
|
type: "button",
|
|
@@ -2060,7 +2548,7 @@ function MultiSelectCard({
|
|
|
2060
2548
|
"aria-checked": selected,
|
|
2061
2549
|
disabled,
|
|
2062
2550
|
onClick: onToggle,
|
|
2063
|
-
className:
|
|
2551
|
+
className: clsx18(
|
|
2064
2552
|
"relative w-full rounded-2xl border-2 text-left transition-all",
|
|
2065
2553
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2066
2554
|
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
@@ -2069,40 +2557,40 @@ function MultiSelectCard({
|
|
|
2069
2557
|
className
|
|
2070
2558
|
),
|
|
2071
2559
|
children: [
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2560
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2561
|
+
/* @__PURE__ */ jsx17(
|
|
2074
2562
|
"span",
|
|
2075
2563
|
{
|
|
2076
2564
|
"aria-hidden": true,
|
|
2077
|
-
className:
|
|
2565
|
+
className: clsx18(
|
|
2078
2566
|
"flex shrink-0 items-center justify-center",
|
|
2079
2567
|
s.iconBox,
|
|
2080
2568
|
selected ? "bg-brand" : "bg-brand-tertiary"
|
|
2081
2569
|
),
|
|
2082
|
-
children: /* @__PURE__ */
|
|
2570
|
+
children: /* @__PURE__ */ jsx17("span", { className: clsx18(s.icon, selected ? "text-icon-brand-on-brand" : "text-icon-brand"), children: icon })
|
|
2083
2571
|
}
|
|
2084
2572
|
),
|
|
2085
|
-
selected ? /* @__PURE__ */
|
|
2573
|
+
selected ? /* @__PURE__ */ jsx17(
|
|
2086
2574
|
"span",
|
|
2087
2575
|
{
|
|
2088
2576
|
"aria-hidden": true,
|
|
2089
|
-
className:
|
|
2577
|
+
className: clsx18(
|
|
2090
2578
|
"flex shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand",
|
|
2091
2579
|
s.mark
|
|
2092
2580
|
),
|
|
2093
|
-
children: /* @__PURE__ */
|
|
2581
|
+
children: /* @__PURE__ */ jsx17(CheckIcon3, { className: "size-3", strokeWidth: 2.5 })
|
|
2094
2582
|
}
|
|
2095
|
-
) : /* @__PURE__ */
|
|
2583
|
+
) : /* @__PURE__ */ jsx17(
|
|
2096
2584
|
"span",
|
|
2097
2585
|
{
|
|
2098
2586
|
"aria-hidden": true,
|
|
2099
|
-
className:
|
|
2587
|
+
className: clsx18("shrink-0 rounded-full border-2 border-default", s.mark)
|
|
2100
2588
|
}
|
|
2101
2589
|
)
|
|
2102
2590
|
] }),
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
description && /* @__PURE__ */
|
|
2591
|
+
/* @__PURE__ */ jsxs11("div", { className: s.gap, children: [
|
|
2592
|
+
/* @__PURE__ */ jsx17("p", { className: clsx18("font-semibold", s.title, selected ? "text-brand" : "text-default"), children: title }),
|
|
2593
|
+
description && /* @__PURE__ */ jsx17("p", { className: "mt-0.5 text-body-tiny text-default-secondary", children: description })
|
|
2106
2594
|
] })
|
|
2107
2595
|
]
|
|
2108
2596
|
}
|
|
@@ -2110,8 +2598,8 @@ function MultiSelectCard({
|
|
|
2110
2598
|
}
|
|
2111
2599
|
|
|
2112
2600
|
// src/components/forms/switch.tsx
|
|
2113
|
-
import { forwardRef as
|
|
2114
|
-
import
|
|
2601
|
+
import { forwardRef as forwardRef11, useId as useId6 } from "react";
|
|
2602
|
+
import clsx19 from "clsx";
|
|
2115
2603
|
|
|
2116
2604
|
// src/lib/compose-event-handlers.ts
|
|
2117
2605
|
function composeEventHandlers(theirs, ours) {
|
|
@@ -2122,12 +2610,12 @@ function composeEventHandlers(theirs, ours) {
|
|
|
2122
2610
|
}
|
|
2123
2611
|
|
|
2124
2612
|
// src/components/forms/switch.tsx
|
|
2125
|
-
import { jsx as
|
|
2613
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2126
2614
|
var SIZE4 = {
|
|
2127
2615
|
sm: { track: "h-5 w-9", knob: "size-4", translate: "translate-x-4" },
|
|
2128
2616
|
md: { track: "h-6 w-11", knob: "size-5", translate: "translate-x-5" }
|
|
2129
2617
|
};
|
|
2130
|
-
var Switch =
|
|
2618
|
+
var Switch = forwardRef11(function Switch2({
|
|
2131
2619
|
checked: checkedProp,
|
|
2132
2620
|
defaultChecked = false,
|
|
2133
2621
|
onCheckedChange,
|
|
@@ -2150,11 +2638,11 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2150
2638
|
defaultValue: defaultChecked,
|
|
2151
2639
|
onChange: onCheckedChange
|
|
2152
2640
|
});
|
|
2153
|
-
const generatedId =
|
|
2641
|
+
const generatedId = useId6();
|
|
2154
2642
|
const controlId = id ?? generatedId;
|
|
2155
2643
|
const descriptionId = `${controlId}-description`;
|
|
2156
2644
|
const s = SIZE4[size2];
|
|
2157
|
-
const control = /* @__PURE__ */
|
|
2645
|
+
const control = /* @__PURE__ */ jsxs12(
|
|
2158
2646
|
"button",
|
|
2159
2647
|
{
|
|
2160
2648
|
ref,
|
|
@@ -2168,7 +2656,7 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2168
2656
|
"aria-describedby": description ? descriptionId : void 0,
|
|
2169
2657
|
disabled,
|
|
2170
2658
|
onClick: composeEventHandlers(onClick, () => setChecked(!checked)),
|
|
2171
|
-
className:
|
|
2659
|
+
className: clsx19(
|
|
2172
2660
|
"group flex items-center gap-2",
|
|
2173
2661
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2174
2662
|
disabled && "cursor-not-allowed opacity-50",
|
|
@@ -2176,11 +2664,11 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2176
2664
|
),
|
|
2177
2665
|
...rest,
|
|
2178
2666
|
children: [
|
|
2179
|
-
/* @__PURE__ */
|
|
2667
|
+
/* @__PURE__ */ jsx18(
|
|
2180
2668
|
"span",
|
|
2181
2669
|
{
|
|
2182
2670
|
"aria-hidden": true,
|
|
2183
|
-
className:
|
|
2671
|
+
className: clsx19(
|
|
2184
2672
|
"relative inline-flex shrink-0 rounded-full transition-colors",
|
|
2185
2673
|
s.track,
|
|
2186
2674
|
// The unchecked track is borderless per the spec. A border here would also shift
|
|
@@ -2188,10 +2676,10 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2188
2676
|
// against the padding box.
|
|
2189
2677
|
disabled ? "bg-disabled" : checked ? "bg-brand group-hover:bg-brand-hover" : "bg-default-secondary group-hover:bg-default-secondary-hover"
|
|
2190
2678
|
),
|
|
2191
|
-
children: /* @__PURE__ */
|
|
2679
|
+
children: /* @__PURE__ */ jsx18(
|
|
2192
2680
|
"span",
|
|
2193
2681
|
{
|
|
2194
|
-
className:
|
|
2682
|
+
className: clsx19(
|
|
2195
2683
|
"absolute left-0.5 top-0.5 rounded-full bg-default shadow-100 transition-transform",
|
|
2196
2684
|
s.knob,
|
|
2197
2685
|
checked ? s.translate : "translate-x-0"
|
|
@@ -2200,11 +2688,11 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2200
2688
|
)
|
|
2201
2689
|
}
|
|
2202
2690
|
),
|
|
2203
|
-
label && /* @__PURE__ */
|
|
2691
|
+
label && /* @__PURE__ */ jsx18("span", { className: "text-body-xs text-default", children: label })
|
|
2204
2692
|
]
|
|
2205
2693
|
}
|
|
2206
2694
|
);
|
|
2207
|
-
const formInput = name ? /* @__PURE__ */
|
|
2695
|
+
const formInput = name ? /* @__PURE__ */ jsx18(
|
|
2208
2696
|
"input",
|
|
2209
2697
|
{
|
|
2210
2698
|
type: "checkbox",
|
|
@@ -2221,19 +2709,19 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2221
2709
|
}
|
|
2222
2710
|
) : null;
|
|
2223
2711
|
if (!description) {
|
|
2224
|
-
return formInput ? /* @__PURE__ */
|
|
2712
|
+
return formInput ? /* @__PURE__ */ jsxs12("span", { className: clsx19("relative inline-flex", className), children: [
|
|
2225
2713
|
control,
|
|
2226
2714
|
formInput
|
|
2227
2715
|
] }) : control;
|
|
2228
2716
|
}
|
|
2229
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsxs12("div", { className: clsx19("relative flex flex-col", className), children: [
|
|
2230
2718
|
control,
|
|
2231
2719
|
formInput,
|
|
2232
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ jsx18(
|
|
2233
2721
|
"span",
|
|
2234
2722
|
{
|
|
2235
2723
|
id: descriptionId,
|
|
2236
|
-
className:
|
|
2724
|
+
className: clsx19(
|
|
2237
2725
|
"mt-0.5 text-body-tiny",
|
|
2238
2726
|
size2 === "md" ? "pl-[52px]" : "pl-[44px]",
|
|
2239
2727
|
disabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -2246,14 +2734,14 @@ var Switch = forwardRef10(function Switch2({
|
|
|
2246
2734
|
|
|
2247
2735
|
// src/components/forms/toggle.tsx
|
|
2248
2736
|
import {
|
|
2249
|
-
createContext as
|
|
2250
|
-
forwardRef as
|
|
2251
|
-
useContext as
|
|
2252
|
-
useMemo,
|
|
2253
|
-
useRef as
|
|
2737
|
+
createContext as createContext5,
|
|
2738
|
+
forwardRef as forwardRef12,
|
|
2739
|
+
useContext as useContext5,
|
|
2740
|
+
useMemo as useMemo4,
|
|
2741
|
+
useRef as useRef9
|
|
2254
2742
|
} from "react";
|
|
2255
|
-
import
|
|
2256
|
-
import { jsx as
|
|
2743
|
+
import clsx20 from "clsx";
|
|
2744
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2257
2745
|
var SIZE5 = {
|
|
2258
2746
|
sm: "h-8 min-w-8 px-2 text-body-tiny [&_svg]:size-3.5",
|
|
2259
2747
|
md: "h-9 min-w-9 px-2.5 text-body-xs [&_svg]:size-4",
|
|
@@ -2263,7 +2751,7 @@ var VARIANT = {
|
|
|
2263
2751
|
ghost: "border border-transparent bg-transparent",
|
|
2264
2752
|
outline: "border border-default bg-default"
|
|
2265
2753
|
};
|
|
2266
|
-
var Toggle =
|
|
2754
|
+
var Toggle = forwardRef12(function Toggle2({
|
|
2267
2755
|
pressed: pressedProp,
|
|
2268
2756
|
defaultPressed = false,
|
|
2269
2757
|
onPressedChange,
|
|
@@ -2275,7 +2763,7 @@ var Toggle = forwardRef11(function Toggle2({
|
|
|
2275
2763
|
onClick,
|
|
2276
2764
|
...rest
|
|
2277
2765
|
}, ref) {
|
|
2278
|
-
const group =
|
|
2766
|
+
const group = useContext5(ToggleGroupContext);
|
|
2279
2767
|
const [standalonePressed, setStandalonePressed] = useControllableState({
|
|
2280
2768
|
value: pressedProp,
|
|
2281
2769
|
defaultValue: defaultPressed,
|
|
@@ -2283,7 +2771,7 @@ var Toggle = forwardRef11(function Toggle2({
|
|
|
2283
2771
|
});
|
|
2284
2772
|
const pressed = group ? group.isPressed(rest.value) : standalonePressed;
|
|
2285
2773
|
const isDisabled = disabled ?? group?.disabled;
|
|
2286
|
-
return /* @__PURE__ */
|
|
2774
|
+
return /* @__PURE__ */ jsx19(
|
|
2287
2775
|
"button",
|
|
2288
2776
|
{
|
|
2289
2777
|
ref,
|
|
@@ -2314,7 +2802,7 @@ var Toggle = forwardRef11(function Toggle2({
|
|
|
2314
2802
|
}
|
|
2315
2803
|
);
|
|
2316
2804
|
});
|
|
2317
|
-
var ToggleGroupContext =
|
|
2805
|
+
var ToggleGroupContext = createContext5(null);
|
|
2318
2806
|
function ToggleGroup({
|
|
2319
2807
|
children,
|
|
2320
2808
|
type = "single",
|
|
@@ -2336,8 +2824,8 @@ function ToggleGroup({
|
|
|
2336
2824
|
orientation: orientation === "vertical" ? "vertical" : "horizontal",
|
|
2337
2825
|
loop: true
|
|
2338
2826
|
});
|
|
2339
|
-
const cursor =
|
|
2340
|
-
const context =
|
|
2827
|
+
const cursor = useRef9(0);
|
|
2828
|
+
const context = useMemo4(
|
|
2341
2829
|
() => ({
|
|
2342
2830
|
isPressed: (itemValue) => Array.isArray(value) ? value.includes(itemValue) : value === itemValue,
|
|
2343
2831
|
toggle: (itemValue) => {
|
|
@@ -2357,13 +2845,13 @@ function ToggleGroup({
|
|
|
2357
2845
|
[value, setValue, type, disabled, roving]
|
|
2358
2846
|
);
|
|
2359
2847
|
cursor.current = 0;
|
|
2360
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ jsx19(ToggleGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx19(
|
|
2361
2849
|
"div",
|
|
2362
2850
|
{
|
|
2363
2851
|
role: "group",
|
|
2364
2852
|
"aria-label": label,
|
|
2365
2853
|
"data-slot": "toggle-group",
|
|
2366
|
-
className:
|
|
2854
|
+
className: clsx20(
|
|
2367
2855
|
"inline-flex gap-0.5",
|
|
2368
2856
|
orientation === "vertical" ? "flex-col" : "flex-row items-center",
|
|
2369
2857
|
className
|
|
@@ -2374,16 +2862,16 @@ function ToggleGroup({
|
|
|
2374
2862
|
}
|
|
2375
2863
|
) });
|
|
2376
2864
|
}
|
|
2377
|
-
var ToggleGroupItem =
|
|
2865
|
+
var ToggleGroupItem = forwardRef12(
|
|
2378
2866
|
function ToggleGroupItem2({ value, children, onFocus, ...rest }, ref) {
|
|
2379
|
-
const group =
|
|
2867
|
+
const group = useContext5(ToggleGroupContext);
|
|
2380
2868
|
if (!group) throw new Error("<ToggleGroupItem> must be used inside <ToggleGroup>");
|
|
2381
2869
|
const index = group.claimIndex();
|
|
2382
2870
|
const { ref: rovingRef, ...itemProps } = group.roving.itemProps(index, {
|
|
2383
2871
|
disabled: rest.disabled ?? group.disabled,
|
|
2384
2872
|
label: typeof children === "string" ? children : void 0
|
|
2385
2873
|
});
|
|
2386
|
-
return /* @__PURE__ */
|
|
2874
|
+
return /* @__PURE__ */ jsx19(
|
|
2387
2875
|
Toggle,
|
|
2388
2876
|
{
|
|
2389
2877
|
ref: composeRefs(ref, rovingRef),
|
|
@@ -2403,14 +2891,14 @@ var ToggleGroupItem = forwardRef11(
|
|
|
2403
2891
|
|
|
2404
2892
|
// src/components/forms/input-otp.tsx
|
|
2405
2893
|
import {
|
|
2406
|
-
forwardRef as
|
|
2407
|
-
useId as
|
|
2408
|
-
useRef as
|
|
2409
|
-
useState as
|
|
2894
|
+
forwardRef as forwardRef13,
|
|
2895
|
+
useId as useId7,
|
|
2896
|
+
useRef as useRef10,
|
|
2897
|
+
useState as useState9
|
|
2410
2898
|
} from "react";
|
|
2411
|
-
import
|
|
2412
|
-
import { jsx as
|
|
2413
|
-
var InputOTP =
|
|
2899
|
+
import clsx21 from "clsx";
|
|
2900
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2901
|
+
var InputOTP = forwardRef13(function InputOTP2({
|
|
2414
2902
|
length = 6,
|
|
2415
2903
|
value: valueProp,
|
|
2416
2904
|
defaultValue = "",
|
|
@@ -2429,9 +2917,9 @@ var InputOTP = forwardRef12(function InputOTP2({
|
|
|
2429
2917
|
defaultValue,
|
|
2430
2918
|
onChange: onValueChange
|
|
2431
2919
|
});
|
|
2432
|
-
const inputRef =
|
|
2433
|
-
const [focused, setFocused] =
|
|
2434
|
-
const describedById =
|
|
2920
|
+
const inputRef = useRef10(null);
|
|
2921
|
+
const [focused, setFocused] = useState9(false);
|
|
2922
|
+
const describedById = useId7();
|
|
2435
2923
|
const pattern = mode === "numeric" ? /[^0-9]/g : /[^a-zA-Z0-9]/g;
|
|
2436
2924
|
const commit = (next) => {
|
|
2437
2925
|
const cleaned = next.replace(pattern, "").slice(0, length);
|
|
@@ -2440,14 +2928,14 @@ var InputOTP = forwardRef12(function InputOTP2({
|
|
|
2440
2928
|
};
|
|
2441
2929
|
const chars = value.split("");
|
|
2442
2930
|
const activeIndex = Math.min(value.length, length - 1);
|
|
2443
|
-
return /* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ jsxs13("div", { className: clsx21("inline-flex flex-col gap-1.5", className), children: [
|
|
2932
|
+
/* @__PURE__ */ jsxs13(
|
|
2445
2933
|
"div",
|
|
2446
2934
|
{
|
|
2447
2935
|
className: "relative inline-flex items-center gap-2",
|
|
2448
2936
|
onClick: () => inputRef.current?.focus(),
|
|
2449
2937
|
children: [
|
|
2450
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx20(
|
|
2451
2939
|
"input",
|
|
2452
2940
|
{
|
|
2453
2941
|
ref: composeRefs(inputRef, ref),
|
|
@@ -2476,11 +2964,11 @@ var InputOTP = forwardRef12(function InputOTP2({
|
|
|
2476
2964
|
className: "absolute inset-0 z-raised w-full cursor-default bg-transparent text-transparent caret-transparent outline-none"
|
|
2477
2965
|
}
|
|
2478
2966
|
),
|
|
2479
|
-
Array.from({ length }, (_, index) => /* @__PURE__ */
|
|
2967
|
+
Array.from({ length }, (_, index) => /* @__PURE__ */ jsx20(
|
|
2480
2968
|
"span",
|
|
2481
2969
|
{
|
|
2482
2970
|
"aria-hidden": true,
|
|
2483
|
-
className:
|
|
2971
|
+
className: clsx21(
|
|
2484
2972
|
"flex h-12 w-10 items-center justify-center rounded-lg border text-body font-semibold tabular-nums transition-colors",
|
|
2485
2973
|
groupAfter && index === groupAfter && "ml-3",
|
|
2486
2974
|
disabled ? "border-disabled bg-disabled text-disabled" : invalid ? "border-danger-secondary bg-default text-default" : "border-default bg-default text-default",
|
|
@@ -2493,15 +2981,15 @@ var InputOTP = forwardRef12(function InputOTP2({
|
|
|
2493
2981
|
]
|
|
2494
2982
|
}
|
|
2495
2983
|
),
|
|
2496
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx20("span", { id: describedById, className: "sr-only", children: `Enter the ${length}-character code. ${value.length} of ${length} entered.` })
|
|
2497
2985
|
] });
|
|
2498
2986
|
});
|
|
2499
2987
|
|
|
2500
2988
|
// src/components/forms/file-drop-zone.tsx
|
|
2501
|
-
import { useRef as
|
|
2502
|
-
import
|
|
2989
|
+
import { useRef as useRef11, useState as useState10 } from "react";
|
|
2990
|
+
import clsx22 from "clsx";
|
|
2503
2991
|
import { UploadIcon } from "lucide-react";
|
|
2504
|
-
import { Fragment as Fragment3, jsx as
|
|
2992
|
+
import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2505
2993
|
var DEFAULT_ACCEPT = ".pdf,.jpg,.jpeg,.png";
|
|
2506
2994
|
var DEFAULT_MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
2507
2995
|
function formatFileSize(bytes) {
|
|
@@ -2522,8 +3010,8 @@ function useFilePicker({
|
|
|
2522
3010
|
maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,
|
|
2523
3011
|
onFileSelected
|
|
2524
3012
|
} = {}) {
|
|
2525
|
-
const inputRef =
|
|
2526
|
-
const [error, setError] =
|
|
3013
|
+
const inputRef = useRef11(null);
|
|
3014
|
+
const [error, setError] = useState10(null);
|
|
2527
3015
|
function handleFiles(files) {
|
|
2528
3016
|
const file = files?.[0];
|
|
2529
3017
|
if (!file) return;
|
|
@@ -2563,13 +3051,13 @@ function FileDropZone({
|
|
|
2563
3051
|
onFileSelected,
|
|
2564
3052
|
disabled = false
|
|
2565
3053
|
}) {
|
|
2566
|
-
const [isDragging, setIsDragging] =
|
|
3054
|
+
const [isDragging, setIsDragging] = useState10(false);
|
|
2567
3055
|
const picker = useFilePicker({ accept, maxSizeBytes, onFileSelected });
|
|
2568
3056
|
const { error, handleFiles } = picker;
|
|
2569
3057
|
const inputRef = picker.inputProps.ref;
|
|
2570
|
-
return /* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2572
|
-
/* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
3059
|
+
/* @__PURE__ */ jsx21("input", { ...picker.inputProps, disabled }),
|
|
3060
|
+
/* @__PURE__ */ jsxs14(
|
|
2573
3061
|
"div",
|
|
2574
3062
|
{
|
|
2575
3063
|
role: "button",
|
|
@@ -2599,40 +3087,40 @@ function FileDropZone({
|
|
|
2599
3087
|
setIsDragging(false);
|
|
2600
3088
|
if (!disabled) handleFiles(e.dataTransfer.files);
|
|
2601
3089
|
},
|
|
2602
|
-
className:
|
|
3090
|
+
className: clsx22(
|
|
2603
3091
|
"flex flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed py-4 px-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1",
|
|
2604
|
-
disabled ? "cursor-not-allowed border-disabled bg-disabled" :
|
|
3092
|
+
disabled ? "cursor-not-allowed border-disabled bg-disabled" : clsx22(
|
|
2605
3093
|
"cursor-pointer",
|
|
2606
3094
|
isDragging ? "border-brand bg-brand-tertiary" : "border-default bg-default-secondary hover:border-brand hover:bg-brand-tertiary"
|
|
2607
3095
|
),
|
|
2608
3096
|
className
|
|
2609
3097
|
),
|
|
2610
3098
|
children: [
|
|
2611
|
-
/* @__PURE__ */
|
|
3099
|
+
/* @__PURE__ */ jsx21(
|
|
2612
3100
|
"span",
|
|
2613
3101
|
{
|
|
2614
3102
|
"aria-hidden": true,
|
|
2615
3103
|
className: disabled ? "text-disabled" : isDragging ? "text-brand" : "text-default-secondary",
|
|
2616
|
-
children: /* @__PURE__ */
|
|
3104
|
+
children: /* @__PURE__ */ jsx21(UploadIcon, { className: "size-5" })
|
|
2617
3105
|
}
|
|
2618
3106
|
),
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ jsx21("span", { className: clsx22("text-body-sm font-medium", disabled ? "text-disabled" : "text-default"), children: "Upload file" }),
|
|
3108
|
+
/* @__PURE__ */ jsx21("span", { className: "text-body-xs text-default-secondary text-center", children: description })
|
|
2621
3109
|
]
|
|
2622
3110
|
}
|
|
2623
3111
|
),
|
|
2624
|
-
error && /* @__PURE__ */
|
|
3112
|
+
error && /* @__PURE__ */ jsx21("span", { role: "alert", className: "text-body-xs text-danger", children: error })
|
|
2625
3113
|
] });
|
|
2626
3114
|
}
|
|
2627
3115
|
|
|
2628
3116
|
// src/components/forms/tag-input.tsx
|
|
2629
|
-
import { useEffect as
|
|
2630
|
-
import
|
|
3117
|
+
import { useEffect as useEffect7, useState as useState11 } from "react";
|
|
3118
|
+
import clsx24 from "clsx";
|
|
2631
3119
|
|
|
2632
3120
|
// src/components/status/badge.tsx
|
|
2633
|
-
import
|
|
3121
|
+
import clsx23 from "clsx";
|
|
2634
3122
|
import { XIcon } from "lucide-react";
|
|
2635
|
-
import { jsx as
|
|
3123
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2636
3124
|
var defaultClasses = {
|
|
2637
3125
|
gray: "bg-badge-gray text-badge-gray",
|
|
2638
3126
|
red: "bg-badge-red text-badge-red",
|
|
@@ -2645,15 +3133,15 @@ var defaultClasses = {
|
|
|
2645
3133
|
slate: "bg-badge-slate text-badge-slate"
|
|
2646
3134
|
};
|
|
2647
3135
|
var subtleClasses = {
|
|
2648
|
-
gray: "border border-badge-gray text-
|
|
2649
|
-
red: "border border-badge-red text-
|
|
2650
|
-
yellow: "border border-badge-yellow text-
|
|
2651
|
-
lime: "border border-badge-lime text-
|
|
2652
|
-
green: "border border-badge-green text-
|
|
2653
|
-
teal: "border border-badge-teal text-
|
|
2654
|
-
blue: "border border-badge-blue text-
|
|
2655
|
-
pink: "border border-badge-pink text-
|
|
2656
|
-
slate: "border border-badge-slate text-
|
|
3136
|
+
gray: "border border-badge-gray text-badge-gray",
|
|
3137
|
+
red: "border border-badge-red text-badge-red",
|
|
3138
|
+
yellow: "border border-badge-yellow text-badge-yellow",
|
|
3139
|
+
lime: "border border-badge-lime text-badge-lime",
|
|
3140
|
+
green: "border border-badge-green text-badge-green",
|
|
3141
|
+
teal: "border border-badge-teal text-badge-teal",
|
|
3142
|
+
blue: "border border-badge-blue text-badge-blue",
|
|
3143
|
+
pink: "border border-badge-pink text-badge-pink",
|
|
3144
|
+
slate: "border border-badge-slate text-badge-slate"
|
|
2657
3145
|
};
|
|
2658
3146
|
function Badge({
|
|
2659
3147
|
label,
|
|
@@ -2665,47 +3153,47 @@ function Badge({
|
|
|
2665
3153
|
className
|
|
2666
3154
|
}) {
|
|
2667
3155
|
const isDefault = variant === "default";
|
|
2668
|
-
return /* @__PURE__ */
|
|
3156
|
+
return /* @__PURE__ */ jsxs15(
|
|
2669
3157
|
"span",
|
|
2670
3158
|
{
|
|
2671
3159
|
"data-variant": variant,
|
|
2672
|
-
className:
|
|
3160
|
+
className: clsx23(
|
|
2673
3161
|
"inline-flex items-center rounded-full px-2 py-0.5",
|
|
2674
3162
|
size2 === "sm" ? "gap-1" : "gap-1.5",
|
|
2675
3163
|
isDefault ? defaultClasses[color] : subtleClasses[color],
|
|
2676
3164
|
className
|
|
2677
3165
|
),
|
|
2678
3166
|
children: [
|
|
2679
|
-
indicator && /* @__PURE__ */
|
|
3167
|
+
indicator && /* @__PURE__ */ jsx22(
|
|
2680
3168
|
"span",
|
|
2681
3169
|
{
|
|
2682
|
-
className:
|
|
3170
|
+
className: clsx23(
|
|
2683
3171
|
"shrink-0 rounded-full bg-current",
|
|
2684
3172
|
size2 === "sm" ? "h-1.5 w-1.5" : "h-2 w-2"
|
|
2685
3173
|
)
|
|
2686
3174
|
}
|
|
2687
3175
|
),
|
|
2688
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsx22(
|
|
2689
3177
|
"span",
|
|
2690
3178
|
{
|
|
2691
|
-
className:
|
|
3179
|
+
className: clsx23(
|
|
2692
3180
|
"whitespace-nowrap",
|
|
2693
|
-
size2 === "sm" ?
|
|
3181
|
+
size2 === "sm" ? clsx23("text-body-tiny", isDefault && "font-semibold") : "text-body-xs"
|
|
2694
3182
|
),
|
|
2695
3183
|
children: label
|
|
2696
3184
|
}
|
|
2697
3185
|
),
|
|
2698
|
-
onClose && /* @__PURE__ */
|
|
3186
|
+
onClose && /* @__PURE__ */ jsx22(
|
|
2699
3187
|
"button",
|
|
2700
3188
|
{
|
|
2701
3189
|
type: "button",
|
|
2702
3190
|
onClick: onClose,
|
|
2703
|
-
className:
|
|
3191
|
+
className: clsx23(
|
|
2704
3192
|
"inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100",
|
|
2705
3193
|
size2 === "sm" ? "h-3 w-3" : "h-4 w-4"
|
|
2706
3194
|
),
|
|
2707
3195
|
"aria-label": `Remove ${label}`,
|
|
2708
|
-
children: /* @__PURE__ */
|
|
3196
|
+
children: /* @__PURE__ */ jsx22(XIcon, { className: "h-full w-full", strokeWidth: 2.5, "aria-hidden": true })
|
|
2709
3197
|
}
|
|
2710
3198
|
)
|
|
2711
3199
|
]
|
|
@@ -2714,12 +3202,12 @@ function Badge({
|
|
|
2714
3202
|
}
|
|
2715
3203
|
|
|
2716
3204
|
// src/components/forms/tag-input.tsx
|
|
2717
|
-
import { jsx as
|
|
3205
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2718
3206
|
var defaultParse = (raw) => ({ value: raw.trim() });
|
|
2719
3207
|
function TagInput({ label, hint, error, required, disabled, id, className, ...rest }) {
|
|
2720
|
-
const [parseError, setParseError] =
|
|
3208
|
+
const [parseError, setParseError] = useState11(null);
|
|
2721
3209
|
const shownError = error ?? parseError ?? void 0;
|
|
2722
|
-
return /* @__PURE__ */
|
|
3210
|
+
return /* @__PURE__ */ jsxs16(
|
|
2723
3211
|
Field,
|
|
2724
3212
|
{
|
|
2725
3213
|
id,
|
|
@@ -2729,9 +3217,9 @@ function TagInput({ label, hint, error, required, disabled, id, className, ...re
|
|
|
2729
3217
|
hasHint: Boolean(hint),
|
|
2730
3218
|
className,
|
|
2731
3219
|
children: [
|
|
2732
|
-
label && /* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
shownError ? /* @__PURE__ */
|
|
3220
|
+
label && /* @__PURE__ */ jsx23(FieldLabel, { children: label }),
|
|
3221
|
+
/* @__PURE__ */ jsx23(TagInputControl, { disabled, required, invalid: Boolean(shownError), onParseError: setParseError, ...rest }),
|
|
3222
|
+
shownError ? /* @__PURE__ */ jsx23(FieldError, { children: shownError }) : hint && /* @__PURE__ */ jsx23(FieldHint, { children: hint })
|
|
2735
3223
|
]
|
|
2736
3224
|
}
|
|
2737
3225
|
);
|
|
@@ -2761,9 +3249,9 @@ function TagInputControl({
|
|
|
2761
3249
|
delimiter.lastIndex = 0;
|
|
2762
3250
|
return delimiter.test(text);
|
|
2763
3251
|
};
|
|
2764
|
-
const [draft, setDraft] =
|
|
2765
|
-
const [rejected, setRejected] =
|
|
2766
|
-
|
|
3252
|
+
const [draft, setDraft] = useState11("");
|
|
3253
|
+
const [rejected, setRejected] = useState11(null);
|
|
3254
|
+
useEffect7(() => {
|
|
2767
3255
|
onParseError(rejected);
|
|
2768
3256
|
onInvalidChange?.(rejected !== null);
|
|
2769
3257
|
}, [rejected, onParseError, onInvalidChange]);
|
|
@@ -2808,7 +3296,7 @@ function TagInputControl({
|
|
|
2808
3296
|
event.preventDefault();
|
|
2809
3297
|
commit(`${draft}${text}`);
|
|
2810
3298
|
}
|
|
2811
|
-
return /* @__PURE__ */
|
|
3299
|
+
return /* @__PURE__ */ jsxs16(
|
|
2812
3300
|
"div",
|
|
2813
3301
|
{
|
|
2814
3302
|
"data-invalid": invalid || void 0,
|
|
@@ -2820,7 +3308,7 @@ function TagInputControl({
|
|
|
2820
3308
|
"data-[disabled]:cursor-not-allowed data-[disabled]:border-disabled data-[disabled]:bg-disabled"
|
|
2821
3309
|
),
|
|
2822
3310
|
children: [
|
|
2823
|
-
values.map((value) => /* @__PURE__ */
|
|
3311
|
+
values.map((value) => /* @__PURE__ */ jsx23(
|
|
2824
3312
|
Badge,
|
|
2825
3313
|
{
|
|
2826
3314
|
label: value,
|
|
@@ -2829,7 +3317,7 @@ function TagInputControl({
|
|
|
2829
3317
|
},
|
|
2830
3318
|
value
|
|
2831
3319
|
)),
|
|
2832
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsx23(
|
|
2833
3321
|
"input",
|
|
2834
3322
|
{
|
|
2835
3323
|
...field,
|
|
@@ -2845,30 +3333,30 @@ function TagInputControl({
|
|
|
2845
3333
|
onKeyDown: handleKeyDown,
|
|
2846
3334
|
onPaste: handlePaste,
|
|
2847
3335
|
onBlur: () => commit(draft),
|
|
2848
|
-
className:
|
|
3336
|
+
className: clsx24(
|
|
2849
3337
|
"min-w-[8rem] flex-1 bg-transparent px-1 text-body-sm text-default outline-none",
|
|
2850
3338
|
"placeholder:text-default-tertiary disabled:cursor-not-allowed"
|
|
2851
3339
|
)
|
|
2852
3340
|
}
|
|
2853
3341
|
),
|
|
2854
|
-
name && values.map((value) => /* @__PURE__ */
|
|
3342
|
+
name && values.map((value) => /* @__PURE__ */ jsx23("input", { type: "hidden", name, value }, value))
|
|
2855
3343
|
]
|
|
2856
3344
|
}
|
|
2857
3345
|
);
|
|
2858
3346
|
}
|
|
2859
3347
|
|
|
2860
3348
|
// src/components/forms/form-card.tsx
|
|
2861
|
-
import
|
|
3349
|
+
import clsx25 from "clsx";
|
|
2862
3350
|
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
2863
|
-
import { jsx as
|
|
3351
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2864
3352
|
function FormCard({
|
|
2865
3353
|
children,
|
|
2866
3354
|
className
|
|
2867
3355
|
}) {
|
|
2868
|
-
return /* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsx24(
|
|
2869
3357
|
"div",
|
|
2870
3358
|
{
|
|
2871
|
-
className:
|
|
3359
|
+
className: clsx25(
|
|
2872
3360
|
"overflow-hidden rounded-xl border border-default bg-default",
|
|
2873
3361
|
className
|
|
2874
3362
|
),
|
|
@@ -2877,9 +3365,9 @@ function FormCard({
|
|
|
2877
3365
|
);
|
|
2878
3366
|
}
|
|
2879
3367
|
function FormCardHeader({ title, subtitle }) {
|
|
2880
|
-
return /* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2882
|
-
subtitle && /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsxs17("div", { className: "border-b border-default px-7 py-6", children: [
|
|
3369
|
+
/* @__PURE__ */ jsx24("h2", { className: "text-heading-sm font-semibold text-default leading-snug", children: title }),
|
|
3370
|
+
subtitle && /* @__PURE__ */ jsx24("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
|
|
2883
3371
|
] });
|
|
2884
3372
|
}
|
|
2885
3373
|
function FormCardFooter({
|
|
@@ -2897,8 +3385,8 @@ function FormCardFooter({
|
|
|
2897
3385
|
// opens (WCAG 2.2 SC 2.4.11 Focus Not Obscured). Below `sm` Back/Continue share one
|
|
2898
3386
|
// full-width row and the draft action wraps under them; DOM order stays draft → back →
|
|
2899
3387
|
// continue for keyboards. Ported from SCIC in 0.7.0.
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
onSaveDraft ? /* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center justify-between gap-3 border-t border-default px-4 py-4 sm:px-7 sm:py-5", children: [
|
|
3389
|
+
onSaveDraft ? /* @__PURE__ */ jsx24(
|
|
2902
3390
|
Button,
|
|
2903
3391
|
{
|
|
2904
3392
|
variant: "neutral",
|
|
@@ -2908,25 +3396,25 @@ function FormCardFooter({
|
|
|
2908
3396
|
className: "order-last w-full justify-center sm:order-none sm:w-auto",
|
|
2909
3397
|
children: "Save as draft"
|
|
2910
3398
|
}
|
|
2911
|
-
) : /* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
!backDisabled && /* @__PURE__ */
|
|
3399
|
+
) : /* @__PURE__ */ jsx24("span", { className: "hidden sm:block" }),
|
|
3400
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex w-full items-center gap-2 sm:w-auto", children: [
|
|
3401
|
+
!backDisabled && /* @__PURE__ */ jsx24(
|
|
2914
3402
|
Button,
|
|
2915
3403
|
{
|
|
2916
3404
|
variant: "neutral",
|
|
2917
3405
|
size: "md",
|
|
2918
|
-
leadingIcon: /* @__PURE__ */
|
|
3406
|
+
leadingIcon: /* @__PURE__ */ jsx24(ArrowLeftIcon, { "aria-hidden": true, size: 16 }),
|
|
2919
3407
|
onClick: onBack,
|
|
2920
3408
|
className: "flex-1 justify-center sm:flex-none",
|
|
2921
3409
|
children: "Back"
|
|
2922
3410
|
}
|
|
2923
3411
|
),
|
|
2924
|
-
/* @__PURE__ */
|
|
3412
|
+
/* @__PURE__ */ jsx24(
|
|
2925
3413
|
Button,
|
|
2926
3414
|
{
|
|
2927
3415
|
variant: "primary",
|
|
2928
3416
|
size: "md",
|
|
2929
|
-
trailingIcon: continueIcon === null ? void 0 : continueIcon ?? /* @__PURE__ */
|
|
3417
|
+
trailingIcon: continueIcon === null ? void 0 : continueIcon ?? /* @__PURE__ */ jsx24(ArrowRightIcon, { "aria-hidden": true, size: 16 }),
|
|
2930
3418
|
onClick: onContinue,
|
|
2931
3419
|
disabled: continueDisabled,
|
|
2932
3420
|
className: "flex-1 justify-center sm:flex-none",
|
|
@@ -2939,8 +3427,8 @@ function FormCardFooter({
|
|
|
2939
3427
|
}
|
|
2940
3428
|
|
|
2941
3429
|
// src/components/status/role-badge.tsx
|
|
2942
|
-
import
|
|
2943
|
-
import { jsx as
|
|
3430
|
+
import clsx26 from "clsx";
|
|
3431
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2944
3432
|
var ROLE_TONES = {
|
|
2945
3433
|
"Super Admin": "slate",
|
|
2946
3434
|
"Admin": "slate",
|
|
@@ -2969,11 +3457,11 @@ var HEX6 = /^#[0-9a-fA-F]{6}$/;
|
|
|
2969
3457
|
function RoleBadge({ role, size: size2 = "sm", tone, color }) {
|
|
2970
3458
|
const rawColor = color && HEX6.test(color) ? color : void 0;
|
|
2971
3459
|
const resolved = tone ?? ROLE_TONES[role] ?? FALLBACK_TONE;
|
|
2972
|
-
return /* @__PURE__ */
|
|
3460
|
+
return /* @__PURE__ */ jsx25(
|
|
2973
3461
|
"span",
|
|
2974
3462
|
{
|
|
2975
3463
|
"data-tone": tone,
|
|
2976
|
-
className:
|
|
3464
|
+
className: clsx26(
|
|
2977
3465
|
"inline-flex items-center rounded-full font-medium whitespace-nowrap",
|
|
2978
3466
|
size2 === "sm" ? "px-2 py-0.5 text-body-tiny" : "px-3 py-1 text-body-xs",
|
|
2979
3467
|
!rawColor && TONE_STYLES[resolved]
|
|
@@ -2986,16 +3474,16 @@ function RoleBadge({ role, size: size2 = "sm", tone, color }) {
|
|
|
2986
3474
|
|
|
2987
3475
|
// src/components/forms/combobox.tsx
|
|
2988
3476
|
import {
|
|
2989
|
-
useCallback as
|
|
2990
|
-
useEffect as
|
|
2991
|
-
useId as
|
|
2992
|
-
useMemo as
|
|
2993
|
-
useRef as
|
|
2994
|
-
useState as
|
|
3477
|
+
useCallback as useCallback4,
|
|
3478
|
+
useEffect as useEffect8,
|
|
3479
|
+
useId as useId8,
|
|
3480
|
+
useMemo as useMemo5,
|
|
3481
|
+
useRef as useRef12,
|
|
3482
|
+
useState as useState12
|
|
2995
3483
|
} from "react";
|
|
2996
|
-
import
|
|
3484
|
+
import clsx27 from "clsx";
|
|
2997
3485
|
import { CheckIcon as CheckIcon4, ChevronDownIcon as ChevronDownIcon2 } from "lucide-react";
|
|
2998
|
-
import { Fragment as Fragment4, jsx as
|
|
3486
|
+
import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2999
3487
|
var HEIGHT = {
|
|
3000
3488
|
lg: "h-12 px-4 text-body",
|
|
3001
3489
|
md: "h-9 px-3 text-body-sm",
|
|
@@ -3023,23 +3511,23 @@ function Combobox({
|
|
|
3023
3511
|
defaultValue,
|
|
3024
3512
|
onChange: onValueChange
|
|
3025
3513
|
});
|
|
3026
|
-
const [open, setOpen] =
|
|
3027
|
-
const [query, setQuery] =
|
|
3028
|
-
const [activeIndex, setActiveIndex] =
|
|
3029
|
-
const baseId =
|
|
3514
|
+
const [open, setOpen] = useState12(false);
|
|
3515
|
+
const [query, setQuery] = useState12("");
|
|
3516
|
+
const [activeIndex, setActiveIndex] = useState12(0);
|
|
3517
|
+
const baseId = useId8();
|
|
3030
3518
|
const listboxId = `${baseId}-listbox`;
|
|
3031
3519
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
3032
|
-
const inputRef =
|
|
3033
|
-
const listRef =
|
|
3034
|
-
const rootRef =
|
|
3520
|
+
const inputRef = useRef12(null);
|
|
3521
|
+
const listRef = useRef12(null);
|
|
3522
|
+
const rootRef = useRef12(null);
|
|
3035
3523
|
const field = useFieldControl();
|
|
3036
|
-
const matches =
|
|
3524
|
+
const matches = useMemo5(() => {
|
|
3037
3525
|
const predicate = filter ?? ((option, q) => option.label.toLowerCase().includes(q.toLowerCase()));
|
|
3038
3526
|
return query ? options.filter((option) => predicate(option, query)) : options;
|
|
3039
3527
|
}, [options, query, filter]);
|
|
3040
3528
|
const selected = options.find((option) => option.value === value) ?? null;
|
|
3041
3529
|
const displayValue = open ? query : selected?.label ?? "";
|
|
3042
|
-
const close =
|
|
3530
|
+
const close = useCallback4((restoreFocus = true) => {
|
|
3043
3531
|
setOpen(false);
|
|
3044
3532
|
setQuery("");
|
|
3045
3533
|
if (restoreFocus) inputRef.current?.focus();
|
|
@@ -3068,20 +3556,20 @@ function Combobox({
|
|
|
3068
3556
|
sideOffset: 4,
|
|
3069
3557
|
matchAnchorWidth: true
|
|
3070
3558
|
});
|
|
3071
|
-
|
|
3559
|
+
useEffect8(() => {
|
|
3072
3560
|
refs.setReference(rootRef.current);
|
|
3073
3561
|
}, [refs, open]);
|
|
3074
|
-
|
|
3562
|
+
useEffect8(() => {
|
|
3075
3563
|
setActiveIndex(0);
|
|
3076
3564
|
}, [query, options]);
|
|
3077
|
-
|
|
3565
|
+
useEffect8(() => {
|
|
3078
3566
|
if (!open) return;
|
|
3079
3567
|
const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);
|
|
3080
3568
|
if (node instanceof Element && typeof node.scrollIntoView === "function") {
|
|
3081
3569
|
node.scrollIntoView({ block: "nearest" });
|
|
3082
3570
|
}
|
|
3083
3571
|
});
|
|
3084
|
-
|
|
3572
|
+
useEffect8(() => {
|
|
3085
3573
|
if (!open) return;
|
|
3086
3574
|
function onPointerDown(event) {
|
|
3087
3575
|
const withinRoot = rootRef.current?.contains(event.target);
|
|
@@ -3092,18 +3580,18 @@ function Combobox({
|
|
|
3092
3580
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
3093
3581
|
}, [open, close]);
|
|
3094
3582
|
let renderedGroup;
|
|
3095
|
-
return /* @__PURE__ */
|
|
3096
|
-
/* @__PURE__ */
|
|
3583
|
+
return /* @__PURE__ */ jsxs18("div", { ref: rootRef, className: clsx27("relative w-full", className), children: [
|
|
3584
|
+
/* @__PURE__ */ jsxs18(
|
|
3097
3585
|
"div",
|
|
3098
3586
|
{
|
|
3099
|
-
className:
|
|
3587
|
+
className: clsx27(
|
|
3100
3588
|
"flex w-full items-center gap-2 rounded-lg border transition-colors",
|
|
3101
3589
|
HEIGHT[size2],
|
|
3102
3590
|
"focus-within:ring-2 focus-within:ring-offset-1 focus-within:ring-offset-default",
|
|
3103
3591
|
disabled ? "cursor-not-allowed border-disabled bg-disabled" : invalid || field["aria-invalid"] ? "border-danger-secondary focus-within:border-danger focus-within:ring-danger" : "border-default bg-default focus-within:border-brand focus-within:ring-brand"
|
|
3104
3592
|
),
|
|
3105
3593
|
children: [
|
|
3106
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx26(
|
|
3107
3595
|
"input",
|
|
3108
3596
|
{
|
|
3109
3597
|
ref: inputRef,
|
|
@@ -3165,18 +3653,18 @@ function Combobox({
|
|
|
3165
3653
|
break;
|
|
3166
3654
|
}
|
|
3167
3655
|
},
|
|
3168
|
-
className:
|
|
3656
|
+
className: clsx27(
|
|
3169
3657
|
"min-w-0 flex-1 bg-transparent text-default outline-none",
|
|
3170
3658
|
"placeholder:text-default-tertiary",
|
|
3171
3659
|
"disabled:cursor-not-allowed disabled:text-disabled"
|
|
3172
3660
|
)
|
|
3173
3661
|
}
|
|
3174
3662
|
),
|
|
3175
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsx26(
|
|
3176
3664
|
ChevronDownIcon2,
|
|
3177
3665
|
{
|
|
3178
3666
|
"aria-hidden": true,
|
|
3179
|
-
className:
|
|
3667
|
+
className: clsx27(
|
|
3180
3668
|
"shrink-0 transition-transform",
|
|
3181
3669
|
size2 === "sm" ? "size-3" : "size-4",
|
|
3182
3670
|
disabled ? "text-icon-disabled" : "text-icon-default-secondary",
|
|
@@ -3187,7 +3675,7 @@ function Combobox({
|
|
|
3187
3675
|
]
|
|
3188
3676
|
}
|
|
3189
3677
|
),
|
|
3190
|
-
open && /* @__PURE__ */
|
|
3678
|
+
open && /* @__PURE__ */ jsx26(Portal, { children: /* @__PURE__ */ jsxs18(
|
|
3191
3679
|
"div",
|
|
3192
3680
|
{
|
|
3193
3681
|
ref: (node) => {
|
|
@@ -3198,16 +3686,16 @@ function Combobox({
|
|
|
3198
3686
|
role: "listbox",
|
|
3199
3687
|
"aria-label": label,
|
|
3200
3688
|
style: { ...floatingStyles, width: "var(--panel-anchor-width)" },
|
|
3201
|
-
className:
|
|
3689
|
+
className: clsx27("z-popover", OVERLAY_PANEL, OVERLAY_PANEL_SCROLL),
|
|
3202
3690
|
children: [
|
|
3203
|
-
matches.length === 0 && /* @__PURE__ */
|
|
3691
|
+
matches.length === 0 && /* @__PURE__ */ jsx26("p", { className: "px-2.5 py-2 text-body-xs text-default-secondary", children: emptyMessage }),
|
|
3204
3692
|
matches.map((option, index) => {
|
|
3205
3693
|
const isSelected = option.value === value;
|
|
3206
3694
|
const isActive = index === activeIndex;
|
|
3207
3695
|
const groupHeading = option.group !== renderedGroup ? option.group : void 0;
|
|
3208
3696
|
renderedGroup = option.group;
|
|
3209
|
-
return /* @__PURE__ */
|
|
3210
|
-
groupHeading && /* @__PURE__ */
|
|
3697
|
+
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
3698
|
+
groupHeading && /* @__PURE__ */ jsx26(
|
|
3211
3699
|
"div",
|
|
3212
3700
|
{
|
|
3213
3701
|
role: "presentation",
|
|
@@ -3215,7 +3703,7 @@ function Combobox({
|
|
|
3215
3703
|
children: groupHeading
|
|
3216
3704
|
}
|
|
3217
3705
|
),
|
|
3218
|
-
/* @__PURE__ */
|
|
3706
|
+
/* @__PURE__ */ jsx26(
|
|
3219
3707
|
"div",
|
|
3220
3708
|
{
|
|
3221
3709
|
id: optionId(index),
|
|
@@ -3225,18 +3713,18 @@ function Combobox({
|
|
|
3225
3713
|
onPointerDown: (event) => event.preventDefault(),
|
|
3226
3714
|
onClick: () => commit(option),
|
|
3227
3715
|
onPointerEnter: () => !option.disabled && setActiveIndex(index),
|
|
3228
|
-
className:
|
|
3716
|
+
className: clsx27(
|
|
3229
3717
|
OVERLAY_ITEM_BASE,
|
|
3230
3718
|
OVERLAY_ITEM_SIZE.md,
|
|
3231
3719
|
"items-center",
|
|
3232
|
-
option.disabled ? "cursor-not-allowed text-disabled" : isActive ?
|
|
3720
|
+
option.disabled ? "cursor-not-allowed text-disabled" : isActive ? clsx27(OVERLAY_ITEM_ACTIVE, "text-default") : "text-default"
|
|
3233
3721
|
),
|
|
3234
|
-
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */
|
|
3235
|
-
/* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
option.description && /* @__PURE__ */
|
|
3722
|
+
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3723
|
+
/* @__PURE__ */ jsxs18("span", { className: "min-w-0 flex-1", children: [
|
|
3724
|
+
/* @__PURE__ */ jsx26("span", { className: "block truncate", children: option.label }),
|
|
3725
|
+
option.description && /* @__PURE__ */ jsx26("span", { className: "block truncate text-body-tiny text-default-secondary", children: option.description })
|
|
3238
3726
|
] }),
|
|
3239
|
-
isSelected && /* @__PURE__ */
|
|
3727
|
+
isSelected && /* @__PURE__ */ jsx26(CheckIcon4, { "aria-hidden": true, className: "size-3.5 shrink-0 text-brand", strokeWidth: 3 })
|
|
3240
3728
|
] })
|
|
3241
3729
|
}
|
|
3242
3730
|
)
|
|
@@ -3249,7 +3737,7 @@ function Combobox({
|
|
|
3249
3737
|
}
|
|
3250
3738
|
|
|
3251
3739
|
// src/components/forms/role-combo-box.tsx
|
|
3252
|
-
import { Fragment as Fragment5, jsx as
|
|
3740
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3253
3741
|
var ROLE_COMBO_OPTIONS = [
|
|
3254
3742
|
{ role: "Reviewer", description: "Reviews onboarding requests" },
|
|
3255
3743
|
{ role: "Admin", description: "Full org control" },
|
|
@@ -3272,7 +3760,7 @@ function RoleComboBox({
|
|
|
3272
3760
|
label: option.role,
|
|
3273
3761
|
description: option.description
|
|
3274
3762
|
}));
|
|
3275
|
-
return /* @__PURE__ */
|
|
3763
|
+
return /* @__PURE__ */ jsx27(
|
|
3276
3764
|
Combobox,
|
|
3277
3765
|
{
|
|
3278
3766
|
options: comboboxOptions,
|
|
@@ -3284,17 +3772,17 @@ function RoleComboBox({
|
|
|
3284
3772
|
clearable: false,
|
|
3285
3773
|
emptyMessage: "No roles match",
|
|
3286
3774
|
className,
|
|
3287
|
-
renderOption: (option) => /* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3775
|
+
renderOption: (option) => /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
3776
|
+
/* @__PURE__ */ jsx27(RoleBadge, { role: option.value, size: "sm" }),
|
|
3777
|
+
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 truncate text-body-xs text-default-secondary", children: option.description })
|
|
3290
3778
|
] })
|
|
3291
3779
|
}
|
|
3292
3780
|
);
|
|
3293
3781
|
}
|
|
3294
3782
|
|
|
3295
3783
|
// src/components/forms/country-select.tsx
|
|
3296
|
-
import { useMemo as
|
|
3297
|
-
import { jsx as
|
|
3784
|
+
import { useMemo as useMemo6 } from "react";
|
|
3785
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3298
3786
|
var ISO_3166_ALPHA_2 = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW";
|
|
3299
3787
|
var COUNTRY_CODES = ISO_3166_ALPHA_2.split(" ");
|
|
3300
3788
|
function countryOptions(codes = COUNTRY_CODES, locale) {
|
|
@@ -3314,12 +3802,12 @@ function CountrySelect({
|
|
|
3314
3802
|
}) {
|
|
3315
3803
|
const keep = [props.value, props.defaultValue].filter((v) => !!v);
|
|
3316
3804
|
const keepKey = keep.join("|");
|
|
3317
|
-
const options =
|
|
3805
|
+
const options = useMemo6(() => {
|
|
3318
3806
|
const list = countryOptions(countries, locale);
|
|
3319
3807
|
const missing = keep.filter((v) => !list.some((o) => o.value === v));
|
|
3320
3808
|
return [...countryOptions(missing, locale), ...list];
|
|
3321
3809
|
}, [countries, locale, keepKey]);
|
|
3322
|
-
return /* @__PURE__ */
|
|
3810
|
+
return /* @__PURE__ */ jsx28(
|
|
3323
3811
|
Combobox,
|
|
3324
3812
|
{
|
|
3325
3813
|
...props,
|
|
@@ -3335,8 +3823,8 @@ function CountrySelect({
|
|
|
3335
3823
|
}
|
|
3336
3824
|
|
|
3337
3825
|
// src/components/forms/time-zone-select.tsx
|
|
3338
|
-
import { useMemo as
|
|
3339
|
-
import { jsx as
|
|
3826
|
+
import { useMemo as useMemo7 } from "react";
|
|
3827
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3340
3828
|
var RENAMED = {
|
|
3341
3829
|
"America/Godthab": "America/Nuuk",
|
|
3342
3830
|
"Asia/Calcutta": "Asia/Kolkata",
|
|
@@ -3388,13 +3876,13 @@ function TimeZoneSelect({
|
|
|
3388
3876
|
const atTime = at?.getTime();
|
|
3389
3877
|
const keep = [props.value, props.defaultValue].filter((v) => !!v);
|
|
3390
3878
|
const keepKey = keep.join("|");
|
|
3391
|
-
const options =
|
|
3879
|
+
const options = useMemo7(() => {
|
|
3392
3880
|
const when = atTime === void 0 ? /* @__PURE__ */ new Date() : new Date(atTime);
|
|
3393
3881
|
const list = timeZoneOptions(timeZones, when);
|
|
3394
3882
|
const missing = keep.filter((v) => !list.some((o) => o.value === v));
|
|
3395
3883
|
return [...missing.map((v) => zoneOption(v, when)), ...list];
|
|
3396
3884
|
}, [timeZones, atTime, keepKey]);
|
|
3397
|
-
return /* @__PURE__ */
|
|
3885
|
+
return /* @__PURE__ */ jsx29(
|
|
3398
3886
|
Combobox,
|
|
3399
3887
|
{
|
|
3400
3888
|
...props,
|
|
@@ -3410,10 +3898,10 @@ function TimeZoneSelect({
|
|
|
3410
3898
|
}
|
|
3411
3899
|
|
|
3412
3900
|
// src/components/forms/command.tsx
|
|
3413
|
-
import { useEffect as
|
|
3414
|
-
import
|
|
3901
|
+
import { useEffect as useEffect9, useId as useId9, useMemo as useMemo8, useRef as useRef13, useState as useState13 } from "react";
|
|
3902
|
+
import clsx28 from "clsx";
|
|
3415
3903
|
import { SearchIcon } from "lucide-react";
|
|
3416
|
-
import { jsx as
|
|
3904
|
+
import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3417
3905
|
function Command({
|
|
3418
3906
|
items,
|
|
3419
3907
|
label = "Command palette",
|
|
@@ -3423,13 +3911,13 @@ function Command({
|
|
|
3423
3911
|
autoFocus = true,
|
|
3424
3912
|
className
|
|
3425
3913
|
}) {
|
|
3426
|
-
const [query, setQuery] =
|
|
3427
|
-
const [activeIndex, setActiveIndex] =
|
|
3428
|
-
const baseId =
|
|
3914
|
+
const [query, setQuery] = useState13("");
|
|
3915
|
+
const [activeIndex, setActiveIndex] = useState13(0);
|
|
3916
|
+
const baseId = useId9();
|
|
3429
3917
|
const listboxId = `${baseId}-listbox`;
|
|
3430
3918
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
3431
|
-
const listRef =
|
|
3432
|
-
const matches =
|
|
3919
|
+
const listRef = useRef13(null);
|
|
3920
|
+
const matches = useMemo8(() => {
|
|
3433
3921
|
if (!query) return items;
|
|
3434
3922
|
const q = query.toLowerCase();
|
|
3435
3923
|
return items.filter((item) => {
|
|
@@ -3438,10 +3926,10 @@ function Command({
|
|
|
3438
3926
|
return item.keywords?.some((keyword) => keyword.toLowerCase().includes(q)) ?? false;
|
|
3439
3927
|
});
|
|
3440
3928
|
}, [items, query]);
|
|
3441
|
-
|
|
3929
|
+
useEffect9(() => {
|
|
3442
3930
|
setActiveIndex(0);
|
|
3443
3931
|
}, [query]);
|
|
3444
|
-
|
|
3932
|
+
useEffect9(() => {
|
|
3445
3933
|
const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);
|
|
3446
3934
|
if (node instanceof Element && typeof node.scrollIntoView === "function") {
|
|
3447
3935
|
node.scrollIntoView({ block: "nearest" });
|
|
@@ -3464,10 +3952,10 @@ function Command({
|
|
|
3464
3952
|
});
|
|
3465
3953
|
};
|
|
3466
3954
|
let renderedGroup;
|
|
3467
|
-
return /* @__PURE__ */
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
/* @__PURE__ */
|
|
3470
|
-
/* @__PURE__ */
|
|
3955
|
+
return /* @__PURE__ */ jsxs20("div", { className: clsx28("flex w-full flex-col", className), children: [
|
|
3956
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 border-b border-default px-3.5 py-3", children: [
|
|
3957
|
+
/* @__PURE__ */ jsx30(SearchIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-default-secondary" }),
|
|
3958
|
+
/* @__PURE__ */ jsx30(
|
|
3471
3959
|
"input",
|
|
3472
3960
|
{
|
|
3473
3961
|
role: "combobox",
|
|
@@ -3514,22 +4002,22 @@ function Command({
|
|
|
3514
4002
|
}
|
|
3515
4003
|
)
|
|
3516
4004
|
] }),
|
|
3517
|
-
/* @__PURE__ */
|
|
4005
|
+
/* @__PURE__ */ jsxs20(
|
|
3518
4006
|
"div",
|
|
3519
4007
|
{
|
|
3520
4008
|
ref: listRef,
|
|
3521
4009
|
id: listboxId,
|
|
3522
4010
|
role: "listbox",
|
|
3523
4011
|
"aria-label": label,
|
|
3524
|
-
className:
|
|
4012
|
+
className: clsx28("max-h-80 overflow-y-auto p-1.5", SCROLLBAR_CLASSES),
|
|
3525
4013
|
children: [
|
|
3526
|
-
matches.length === 0 && /* @__PURE__ */
|
|
4014
|
+
matches.length === 0 && /* @__PURE__ */ jsx30("p", { className: "px-2.5 py-6 text-center text-body-sm text-default-secondary", children: emptyMessage }),
|
|
3527
4015
|
matches.map((item, index) => {
|
|
3528
4016
|
const isActive = index === activeIndex;
|
|
3529
4017
|
const groupHeading = item.group !== renderedGroup ? item.group : void 0;
|
|
3530
4018
|
renderedGroup = item.group;
|
|
3531
|
-
return /* @__PURE__ */
|
|
3532
|
-
groupHeading && /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsxs20("div", { children: [
|
|
4020
|
+
groupHeading && /* @__PURE__ */ jsx30(
|
|
3533
4021
|
"div",
|
|
3534
4022
|
{
|
|
3535
4023
|
role: "presentation",
|
|
@@ -3537,7 +4025,7 @@ function Command({
|
|
|
3537
4025
|
children: groupHeading
|
|
3538
4026
|
}
|
|
3539
4027
|
),
|
|
3540
|
-
/* @__PURE__ */
|
|
4028
|
+
/* @__PURE__ */ jsxs20(
|
|
3541
4029
|
"div",
|
|
3542
4030
|
{
|
|
3543
4031
|
id: optionId(index),
|
|
@@ -3547,19 +4035,19 @@ function Command({
|
|
|
3547
4035
|
onPointerDown: (event) => event.preventDefault(),
|
|
3548
4036
|
onClick: () => run(item),
|
|
3549
4037
|
onPointerEnter: () => !item.disabled && setActiveIndex(index),
|
|
3550
|
-
className:
|
|
4038
|
+
className: clsx28(
|
|
3551
4039
|
OVERLAY_ITEM_BASE,
|
|
3552
4040
|
OVERLAY_ITEM_SIZE.md,
|
|
3553
4041
|
"items-center",
|
|
3554
|
-
item.disabled ? "cursor-not-allowed text-disabled" : isActive ?
|
|
4042
|
+
item.disabled ? "cursor-not-allowed text-disabled" : isActive ? clsx28(OVERLAY_ITEM_ACTIVE, "text-default") : "text-default"
|
|
3555
4043
|
),
|
|
3556
4044
|
children: [
|
|
3557
|
-
item.icon && /* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3559
|
-
/* @__PURE__ */
|
|
3560
|
-
item.description && /* @__PURE__ */
|
|
4045
|
+
item.icon && /* @__PURE__ */ jsx30("span", { "aria-hidden": true, className: "flex size-4 shrink-0 items-center justify-center", children: item.icon }),
|
|
4046
|
+
/* @__PURE__ */ jsxs20("span", { className: "min-w-0 flex-1", children: [
|
|
4047
|
+
/* @__PURE__ */ jsx30("span", { className: "block truncate", children: item.label }),
|
|
4048
|
+
item.description && /* @__PURE__ */ jsx30("span", { className: "block truncate text-body-tiny text-default-secondary", children: item.description })
|
|
3561
4049
|
] }),
|
|
3562
|
-
item.shortcut && /* @__PURE__ */
|
|
4050
|
+
item.shortcut && /* @__PURE__ */ jsx30("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: item.shortcut })
|
|
3563
4051
|
]
|
|
3564
4052
|
}
|
|
3565
4053
|
)
|
|
@@ -3568,13 +4056,13 @@ function Command({
|
|
|
3568
4056
|
]
|
|
3569
4057
|
}
|
|
3570
4058
|
),
|
|
3571
|
-
/* @__PURE__ */
|
|
4059
|
+
/* @__PURE__ */ jsx30("span", { "aria-live": "polite", className: "sr-only", children: `${matches.length} ${matches.length === 1 ? "result" : "results"}` })
|
|
3572
4060
|
] });
|
|
3573
4061
|
}
|
|
3574
4062
|
|
|
3575
4063
|
// src/components/status/status-badge.tsx
|
|
3576
|
-
import
|
|
3577
|
-
import { jsx as
|
|
4064
|
+
import clsx29 from "clsx";
|
|
4065
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3578
4066
|
var TONE_STYLES2 = {
|
|
3579
4067
|
neutral: "bg-status-neutral text-status-neutral",
|
|
3580
4068
|
info: "bg-status-info text-status-info",
|
|
@@ -3605,18 +4093,18 @@ function StatusBadge({
|
|
|
3605
4093
|
icon,
|
|
3606
4094
|
className
|
|
3607
4095
|
}) {
|
|
3608
|
-
return /* @__PURE__ */
|
|
4096
|
+
return /* @__PURE__ */ jsxs21(
|
|
3609
4097
|
"span",
|
|
3610
4098
|
{
|
|
3611
4099
|
"data-tone": tone,
|
|
3612
|
-
className:
|
|
4100
|
+
className: clsx29(
|
|
3613
4101
|
"inline-flex items-center gap-1.5 rounded-full font-medium leading-tight whitespace-nowrap",
|
|
3614
4102
|
SIZE_STYLES[size2],
|
|
3615
4103
|
TONE_STYLES2[tone],
|
|
3616
4104
|
className
|
|
3617
4105
|
),
|
|
3618
4106
|
children: [
|
|
3619
|
-
icon ? /* @__PURE__ */
|
|
4107
|
+
icon ? /* @__PURE__ */ jsx31("span", { className: "shrink-0", children: icon }) : dot && /* @__PURE__ */ jsx31("span", { className: clsx29("size-1.5 shrink-0 rounded-full", DOT_STYLES[tone]) }),
|
|
3620
4108
|
label
|
|
3621
4109
|
]
|
|
3622
4110
|
}
|
|
@@ -3624,8 +4112,8 @@ function StatusBadge({
|
|
|
3624
4112
|
}
|
|
3625
4113
|
|
|
3626
4114
|
// src/components/status/status-dot.tsx
|
|
3627
|
-
import
|
|
3628
|
-
import { jsx as
|
|
4115
|
+
import clsx30 from "clsx";
|
|
4116
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3629
4117
|
var dotTones = {
|
|
3630
4118
|
brand: "bg-brand",
|
|
3631
4119
|
positive: "bg-positive",
|
|
@@ -3635,63 +4123,63 @@ var dotTones = {
|
|
|
3635
4123
|
default: "bg-default-tertiary"
|
|
3636
4124
|
};
|
|
3637
4125
|
function StatusDot({ tone = "default", color, className }) {
|
|
3638
|
-
return /* @__PURE__ */
|
|
4126
|
+
return /* @__PURE__ */ jsx32(
|
|
3639
4127
|
"span",
|
|
3640
4128
|
{
|
|
3641
4129
|
"data-tone": tone,
|
|
3642
|
-
className:
|
|
4130
|
+
className: clsx30("inline-block size-1.5 shrink-0 rounded-full", !color && dotTones[tone], className),
|
|
3643
4131
|
style: color ? { backgroundColor: color } : void 0
|
|
3644
4132
|
}
|
|
3645
4133
|
);
|
|
3646
4134
|
}
|
|
3647
4135
|
|
|
3648
4136
|
// src/components/status/status-chip.tsx
|
|
3649
|
-
import
|
|
3650
|
-
import { jsx as
|
|
4137
|
+
import clsx31 from "clsx";
|
|
4138
|
+
import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3651
4139
|
function StatusChip({ label, count, tone = "default", dotColor, bg, className }) {
|
|
3652
|
-
return /* @__PURE__ */
|
|
4140
|
+
return /* @__PURE__ */ jsxs22(
|
|
3653
4141
|
"span",
|
|
3654
4142
|
{
|
|
3655
4143
|
"data-tone": tone,
|
|
3656
|
-
className:
|
|
4144
|
+
className: clsx31(
|
|
3657
4145
|
"inline-flex items-center gap-1.5 rounded-full px-3 py-1",
|
|
3658
4146
|
!bg && "bg-default-secondary",
|
|
3659
4147
|
className
|
|
3660
4148
|
),
|
|
3661
4149
|
style: bg ? { backgroundColor: bg } : void 0,
|
|
3662
4150
|
children: [
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3665
|
-
/* @__PURE__ */
|
|
4151
|
+
/* @__PURE__ */ jsx33(StatusDot, { tone, color: dotColor }),
|
|
4152
|
+
/* @__PURE__ */ jsx33("span", { className: "text-body-xs font-medium text-default", children: count }),
|
|
4153
|
+
/* @__PURE__ */ jsx33("span", { className: "text-body-xs text-default-secondary", children: label })
|
|
3666
4154
|
]
|
|
3667
4155
|
}
|
|
3668
4156
|
);
|
|
3669
4157
|
}
|
|
3670
4158
|
|
|
3671
4159
|
// src/components/status/count-badge.tsx
|
|
3672
|
-
import
|
|
3673
|
-
import { jsx as
|
|
4160
|
+
import clsx32 from "clsx";
|
|
4161
|
+
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3674
4162
|
function CountBadge({ count, label, tone = "positive", className }) {
|
|
3675
|
-
return /* @__PURE__ */
|
|
4163
|
+
return /* @__PURE__ */ jsxs23(
|
|
3676
4164
|
"span",
|
|
3677
4165
|
{
|
|
3678
4166
|
"data-tone": tone,
|
|
3679
|
-
className:
|
|
4167
|
+
className: clsx32(
|
|
3680
4168
|
"inline-flex items-center gap-1.5 rounded-full border border-default px-3 py-1 text-body-xs font-medium text-default",
|
|
3681
4169
|
className
|
|
3682
4170
|
),
|
|
3683
4171
|
children: [
|
|
3684
|
-
/* @__PURE__ */
|
|
4172
|
+
/* @__PURE__ */ jsx34(StatusDot, { tone }),
|
|
3685
4173
|
count,
|
|
3686
|
-
label && /* @__PURE__ */
|
|
4174
|
+
label && /* @__PURE__ */ jsx34("span", { className: "text-default-secondary", children: label })
|
|
3687
4175
|
]
|
|
3688
4176
|
}
|
|
3689
4177
|
);
|
|
3690
4178
|
}
|
|
3691
4179
|
|
|
3692
4180
|
// src/components/status/tag-pill.tsx
|
|
3693
|
-
import
|
|
3694
|
-
import { jsx as
|
|
4181
|
+
import clsx33 from "clsx";
|
|
4182
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3695
4183
|
var toneStyles = {
|
|
3696
4184
|
default: "bg-default-secondary text-default-secondary",
|
|
3697
4185
|
brand: "bg-brand-tertiary text-brand",
|
|
@@ -3700,11 +4188,11 @@ var toneStyles = {
|
|
|
3700
4188
|
danger: "bg-danger-tertiary text-danger"
|
|
3701
4189
|
};
|
|
3702
4190
|
function TagPill({ label, tone = "default", bg, color, className }) {
|
|
3703
|
-
return /* @__PURE__ */
|
|
4191
|
+
return /* @__PURE__ */ jsx35(
|
|
3704
4192
|
"span",
|
|
3705
4193
|
{
|
|
3706
4194
|
"data-tone": tone,
|
|
3707
|
-
className:
|
|
4195
|
+
className: clsx33(
|
|
3708
4196
|
"inline-flex items-center rounded-full px-2 py-0.5 text-body-xs font-medium",
|
|
3709
4197
|
!bg && !color && toneStyles[tone],
|
|
3710
4198
|
className
|
|
@@ -3719,8 +4207,8 @@ function TagPill({ label, tone = "default", bg, color, className }) {
|
|
|
3719
4207
|
}
|
|
3720
4208
|
|
|
3721
4209
|
// src/components/status/trail-chip.tsx
|
|
3722
|
-
import
|
|
3723
|
-
import { jsx as
|
|
4210
|
+
import clsx34 from "clsx";
|
|
4211
|
+
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3724
4212
|
var DOT = {
|
|
3725
4213
|
neutral: "bg-status-dot-neutral",
|
|
3726
4214
|
info: "bg-status-dot-info",
|
|
@@ -3731,31 +4219,31 @@ var DOT = {
|
|
|
3731
4219
|
danger: "bg-status-dot-danger"
|
|
3732
4220
|
};
|
|
3733
4221
|
function TrailChip({ label, value, tone = "info", dotColor, className }) {
|
|
3734
|
-
return /* @__PURE__ */
|
|
4222
|
+
return /* @__PURE__ */ jsxs24(
|
|
3735
4223
|
"div",
|
|
3736
4224
|
{
|
|
3737
4225
|
"data-tone": tone,
|
|
3738
|
-
className:
|
|
4226
|
+
className: clsx34(
|
|
3739
4227
|
"flex items-center gap-2 rounded-full border border-default bg-default px-3 py-1.5",
|
|
3740
4228
|
className
|
|
3741
4229
|
),
|
|
3742
4230
|
children: [
|
|
3743
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx36(
|
|
3744
4232
|
"span",
|
|
3745
4233
|
{
|
|
3746
|
-
className:
|
|
4234
|
+
className: clsx34("size-1.5 shrink-0 rounded-full", !dotColor && DOT[tone]),
|
|
3747
4235
|
style: dotColor ? { backgroundColor: dotColor } : void 0
|
|
3748
4236
|
}
|
|
3749
4237
|
),
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
/* @__PURE__ */
|
|
4238
|
+
/* @__PURE__ */ jsx36("span", { className: "text-body-tiny font-semibold uppercase tracking-wide text-default-secondary", children: label }),
|
|
4239
|
+
/* @__PURE__ */ jsx36("span", { className: "text-body-xs font-medium text-default", children: value })
|
|
3752
4240
|
]
|
|
3753
4241
|
}
|
|
3754
4242
|
);
|
|
3755
4243
|
}
|
|
3756
4244
|
|
|
3757
4245
|
// src/components/status/user-status-pill.tsx
|
|
3758
|
-
import { jsx as
|
|
4246
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3759
4247
|
var STATUS_META = {
|
|
3760
4248
|
active: { label: "Active", tone: "positive" },
|
|
3761
4249
|
// `caution` (pale yellow), not `warning` (orange) — Pending is one step below a
|
|
@@ -3765,13 +4253,13 @@ var STATUS_META = {
|
|
|
3765
4253
|
};
|
|
3766
4254
|
function UserStatusPill({ status }) {
|
|
3767
4255
|
const { label, tone } = STATUS_META[status];
|
|
3768
|
-
return /* @__PURE__ */
|
|
4256
|
+
return /* @__PURE__ */ jsx37(StatusBadge, { label, tone });
|
|
3769
4257
|
}
|
|
3770
4258
|
|
|
3771
4259
|
// src/components/status/check-indicator.tsx
|
|
3772
|
-
import
|
|
4260
|
+
import clsx35 from "clsx";
|
|
3773
4261
|
import { CheckIcon as CheckIcon5, CircleAlertIcon, LoaderCircleIcon, MinusIcon, XIcon as XIcon2 } from "lucide-react";
|
|
3774
|
-
import { jsx as
|
|
4262
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3775
4263
|
var STATUS_STYLES = {
|
|
3776
4264
|
passed: "bg-status-check-passed border-status-check-passed text-status-check-passed",
|
|
3777
4265
|
in_progress: "bg-status-check-progress border-status-check-progress text-status-check-progress",
|
|
@@ -3783,25 +4271,25 @@ var STATUS_STYLES = {
|
|
|
3783
4271
|
function StatusGlyph({ status }) {
|
|
3784
4272
|
switch (status) {
|
|
3785
4273
|
case "passed":
|
|
3786
|
-
return /* @__PURE__ */
|
|
4274
|
+
return /* @__PURE__ */ jsx38(CheckIcon5, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
3787
4275
|
case "failed":
|
|
3788
|
-
return /* @__PURE__ */
|
|
4276
|
+
return /* @__PURE__ */ jsx38(XIcon2, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
3789
4277
|
case "waived":
|
|
3790
|
-
return /* @__PURE__ */
|
|
4278
|
+
return /* @__PURE__ */ jsx38(MinusIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
3791
4279
|
case "in_progress":
|
|
3792
|
-
return /* @__PURE__ */
|
|
4280
|
+
return /* @__PURE__ */ jsx38(LoaderCircleIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
3793
4281
|
case "action_required":
|
|
3794
|
-
return /* @__PURE__ */
|
|
4282
|
+
return /* @__PURE__ */ jsx38(CircleAlertIcon, { className: "size-3.5", strokeWidth: 2.5, "aria-hidden": true });
|
|
3795
4283
|
case "pending":
|
|
3796
4284
|
return null;
|
|
3797
4285
|
}
|
|
3798
4286
|
}
|
|
3799
4287
|
function CheckIndicator({ status, label, className }) {
|
|
3800
|
-
return /* @__PURE__ */
|
|
4288
|
+
return /* @__PURE__ */ jsx38(
|
|
3801
4289
|
"div",
|
|
3802
4290
|
{
|
|
3803
4291
|
"data-status": status,
|
|
3804
|
-
className:
|
|
4292
|
+
className: clsx35(
|
|
3805
4293
|
"flex size-[22px] shrink-0 items-center justify-center rounded-full border-[1.5px]",
|
|
3806
4294
|
STATUS_STYLES[status],
|
|
3807
4295
|
className
|
|
@@ -3809,14 +4297,14 @@ function CheckIndicator({ status, label, className }) {
|
|
|
3809
4297
|
role: label ? "img" : void 0,
|
|
3810
4298
|
"aria-label": label,
|
|
3811
4299
|
"aria-hidden": label ? void 0 : true,
|
|
3812
|
-
children: /* @__PURE__ */
|
|
4300
|
+
children: /* @__PURE__ */ jsx38(StatusGlyph, { status })
|
|
3813
4301
|
}
|
|
3814
4302
|
);
|
|
3815
4303
|
}
|
|
3816
4304
|
|
|
3817
4305
|
// src/components/status/entity-icon-badge.tsx
|
|
3818
|
-
import
|
|
3819
|
-
import { jsx as
|
|
4306
|
+
import clsx36 from "clsx";
|
|
4307
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
3820
4308
|
var sizeStyles4 = {
|
|
3821
4309
|
sm: "size-8",
|
|
3822
4310
|
md: "size-10"
|
|
@@ -3834,11 +4322,11 @@ var toneStyles2 = {
|
|
|
3834
4322
|
neutral: "bg-neutral-tertiary text-icon-neutral"
|
|
3835
4323
|
};
|
|
3836
4324
|
function EntityIconBadge({ size: size2 = "sm", tone = "default", shape = "square", bg, iconColor, children, className }) {
|
|
3837
|
-
return /* @__PURE__ */
|
|
4325
|
+
return /* @__PURE__ */ jsx39(
|
|
3838
4326
|
"span",
|
|
3839
4327
|
{
|
|
3840
4328
|
"data-tone": tone,
|
|
3841
|
-
className:
|
|
4329
|
+
className: clsx36(
|
|
3842
4330
|
"inline-flex shrink-0 items-center justify-center",
|
|
3843
4331
|
sizeStyles4[size2],
|
|
3844
4332
|
shapeStyles[shape][size2],
|
|
@@ -3855,13 +4343,13 @@ function EntityIconBadge({ size: size2 = "sm", tone = "default", shape = "square
|
|
|
3855
4343
|
}
|
|
3856
4344
|
|
|
3857
4345
|
// src/components/forms/checkbox.tsx
|
|
3858
|
-
import { forwardRef as
|
|
3859
|
-
import
|
|
4346
|
+
import { forwardRef as forwardRef14, useEffect as useEffect10, useId as useId10, useRef as useRef14 } from "react";
|
|
4347
|
+
import clsx38 from "clsx";
|
|
3860
4348
|
|
|
3861
4349
|
// src/components/forms/check-control.tsx
|
|
3862
|
-
import
|
|
4350
|
+
import clsx37 from "clsx";
|
|
3863
4351
|
import { CheckIcon as CheckIcon6, MinusIcon as MinusIcon2 } from "lucide-react";
|
|
3864
|
-
import { jsx as
|
|
4352
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3865
4353
|
var CHECK_SIZE = {
|
|
3866
4354
|
sm: { box: "size-4", glyph: "size-2.5", dot: "size-1.5" },
|
|
3867
4355
|
md: { box: "size-[18px]", glyph: "size-3", dot: "size-2" }
|
|
@@ -3876,11 +4364,11 @@ function CheckControl({
|
|
|
3876
4364
|
}) {
|
|
3877
4365
|
const s = CHECK_SIZE[size2];
|
|
3878
4366
|
const on = checked || indeterminate;
|
|
3879
|
-
return /* @__PURE__ */
|
|
4367
|
+
return /* @__PURE__ */ jsx40(
|
|
3880
4368
|
"span",
|
|
3881
4369
|
{
|
|
3882
4370
|
"aria-hidden": true,
|
|
3883
|
-
className:
|
|
4371
|
+
className: clsx37(
|
|
3884
4372
|
"mt-px flex shrink-0 items-center justify-center border-[1.5px] transition-colors",
|
|
3885
4373
|
s.box,
|
|
3886
4374
|
type === "radio" ? "rounded-full" : "rounded-[4px]",
|
|
@@ -3889,18 +4377,18 @@ function CheckControl({
|
|
|
3889
4377
|
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-default",
|
|
3890
4378
|
disabled ? on ? "border-disabled bg-disabled text-disabled-on-disabled" : "border-disabled bg-disabled" : on ? "border-brand-emphasis bg-brand text-brand-on-brand" : invalid ? "border-danger bg-default" : "border-default-secondary bg-default"
|
|
3891
4379
|
),
|
|
3892
|
-
children: type === "checkbox" ? indeterminate ? /* @__PURE__ */
|
|
4380
|
+
children: type === "checkbox" ? indeterminate ? /* @__PURE__ */ jsx40(MinusIcon2, { className: s.glyph, strokeWidth: 3 }) : checked ? /* @__PURE__ */ jsx40(CheckIcon6, { className: s.glyph, strokeWidth: 3 }) : null : checked ? /* @__PURE__ */ jsx40("span", { className: clsx37("rounded-full bg-current", s.dot) }) : null
|
|
3893
4381
|
}
|
|
3894
4382
|
);
|
|
3895
4383
|
}
|
|
3896
4384
|
|
|
3897
4385
|
// src/components/forms/checkbox.tsx
|
|
3898
|
-
import { jsx as
|
|
4386
|
+
import { jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3899
4387
|
var LABEL_TEXT2 = {
|
|
3900
4388
|
sm: "text-body-tiny",
|
|
3901
4389
|
md: "text-body-xs"
|
|
3902
4390
|
};
|
|
3903
|
-
var Checkbox =
|
|
4391
|
+
var Checkbox = forwardRef14(function Checkbox2({
|
|
3904
4392
|
checked: checkedProp,
|
|
3905
4393
|
defaultChecked = false,
|
|
3906
4394
|
onCheckedChange,
|
|
@@ -3919,24 +4407,24 @@ var Checkbox = forwardRef13(function Checkbox2({
|
|
|
3919
4407
|
defaultValue: defaultChecked,
|
|
3920
4408
|
onChange: onCheckedChange
|
|
3921
4409
|
});
|
|
3922
|
-
const inputRef =
|
|
3923
|
-
const generatedId =
|
|
4410
|
+
const inputRef = useRef14(null);
|
|
4411
|
+
const generatedId = useId10();
|
|
3924
4412
|
const controlId = id ?? generatedId;
|
|
3925
4413
|
const descriptionId = `${controlId}-description`;
|
|
3926
|
-
|
|
4414
|
+
useEffect10(() => {
|
|
3927
4415
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
3928
4416
|
}, [indeterminate]);
|
|
3929
|
-
return /* @__PURE__ */
|
|
3930
|
-
/* @__PURE__ */
|
|
4417
|
+
return /* @__PURE__ */ jsxs25("div", { className: clsx38("flex flex-col", className), children: [
|
|
4418
|
+
/* @__PURE__ */ jsxs25(
|
|
3931
4419
|
"label",
|
|
3932
4420
|
{
|
|
3933
4421
|
htmlFor: controlId,
|
|
3934
|
-
className:
|
|
4422
|
+
className: clsx38(
|
|
3935
4423
|
"group inline-flex items-start gap-2.5",
|
|
3936
4424
|
disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"
|
|
3937
4425
|
),
|
|
3938
4426
|
children: [
|
|
3939
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsx41(
|
|
3940
4428
|
"input",
|
|
3941
4429
|
{
|
|
3942
4430
|
ref: composeRefs(inputRef, ref),
|
|
@@ -3951,7 +4439,7 @@ var Checkbox = forwardRef13(function Checkbox2({
|
|
|
3951
4439
|
...props
|
|
3952
4440
|
}
|
|
3953
4441
|
),
|
|
3954
|
-
/* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ jsx41(
|
|
3955
4443
|
CheckControl,
|
|
3956
4444
|
{
|
|
3957
4445
|
type: "checkbox",
|
|
@@ -3962,15 +4450,15 @@ var Checkbox = forwardRef13(function Checkbox2({
|
|
|
3962
4450
|
size: size2
|
|
3963
4451
|
}
|
|
3964
4452
|
),
|
|
3965
|
-
label && /* @__PURE__ */
|
|
4453
|
+
label && /* @__PURE__ */ jsx41("span", { className: clsx38(LABEL_TEXT2[size2], "text-default"), children: label })
|
|
3966
4454
|
]
|
|
3967
4455
|
}
|
|
3968
4456
|
),
|
|
3969
|
-
description && /* @__PURE__ */
|
|
4457
|
+
description && /* @__PURE__ */ jsx41(
|
|
3970
4458
|
"span",
|
|
3971
4459
|
{
|
|
3972
4460
|
id: descriptionId,
|
|
3973
|
-
className:
|
|
4461
|
+
className: clsx38(
|
|
3974
4462
|
"mt-0.5 pl-[26px]",
|
|
3975
4463
|
LABEL_TEXT2[size2],
|
|
3976
4464
|
disabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -3983,15 +4471,15 @@ var Checkbox = forwardRef13(function Checkbox2({
|
|
|
3983
4471
|
|
|
3984
4472
|
// src/components/forms/radio-group.tsx
|
|
3985
4473
|
import {
|
|
3986
|
-
createContext as
|
|
3987
|
-
forwardRef as
|
|
3988
|
-
useContext as
|
|
3989
|
-
useId as
|
|
4474
|
+
createContext as createContext6,
|
|
4475
|
+
forwardRef as forwardRef15,
|
|
4476
|
+
useContext as useContext6,
|
|
4477
|
+
useId as useId11
|
|
3990
4478
|
} from "react";
|
|
3991
|
-
import
|
|
3992
|
-
import { jsx as
|
|
3993
|
-
var RadioGroupContext =
|
|
3994
|
-
var RadioGroup =
|
|
4479
|
+
import clsx39 from "clsx";
|
|
4480
|
+
import { jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4481
|
+
var RadioGroupContext = createContext6(null);
|
|
4482
|
+
var RadioGroup = forwardRef15(function RadioGroup2({
|
|
3995
4483
|
children,
|
|
3996
4484
|
value: valueProp,
|
|
3997
4485
|
defaultValue,
|
|
@@ -4006,13 +4494,13 @@ var RadioGroup = forwardRef14(function RadioGroup2({
|
|
|
4006
4494
|
className,
|
|
4007
4495
|
...rest
|
|
4008
4496
|
}, ref) {
|
|
4009
|
-
const generatedName =
|
|
4497
|
+
const generatedName = useId11();
|
|
4010
4498
|
const [value, setValue] = useControllableState({
|
|
4011
4499
|
value: valueProp,
|
|
4012
4500
|
defaultValue,
|
|
4013
4501
|
onChange: onValueChange
|
|
4014
4502
|
});
|
|
4015
|
-
return /* @__PURE__ */
|
|
4503
|
+
return /* @__PURE__ */ jsx42(
|
|
4016
4504
|
RadioGroupContext.Provider,
|
|
4017
4505
|
{
|
|
4018
4506
|
value: {
|
|
@@ -4023,7 +4511,7 @@ var RadioGroup = forwardRef14(function RadioGroup2({
|
|
|
4023
4511
|
disabled,
|
|
4024
4512
|
invalid
|
|
4025
4513
|
},
|
|
4026
|
-
children: /* @__PURE__ */
|
|
4514
|
+
children: /* @__PURE__ */ jsx42(
|
|
4027
4515
|
"div",
|
|
4028
4516
|
{
|
|
4029
4517
|
ref,
|
|
@@ -4033,7 +4521,7 @@ var RadioGroup = forwardRef14(function RadioGroup2({
|
|
|
4033
4521
|
"aria-invalid": invalid || void 0,
|
|
4034
4522
|
"aria-orientation": orientation,
|
|
4035
4523
|
"data-slot": "radio-group",
|
|
4036
|
-
className:
|
|
4524
|
+
className: clsx39(
|
|
4037
4525
|
"flex",
|
|
4038
4526
|
orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-4",
|
|
4039
4527
|
className
|
|
@@ -4049,25 +4537,25 @@ var LABEL_TEXT3 = {
|
|
|
4049
4537
|
sm: "text-body-tiny",
|
|
4050
4538
|
md: "text-body-xs"
|
|
4051
4539
|
};
|
|
4052
|
-
var Radio =
|
|
4053
|
-
const group =
|
|
4540
|
+
var Radio = forwardRef15(function Radio2({ value, label, description, disabled, id, className, ...props }, ref) {
|
|
4541
|
+
const group = useContext6(RadioGroupContext);
|
|
4054
4542
|
if (!group) throw new Error("<Radio> must be used inside <RadioGroup>");
|
|
4055
|
-
const generatedId =
|
|
4543
|
+
const generatedId = useId11();
|
|
4056
4544
|
const controlId = id ?? generatedId;
|
|
4057
4545
|
const descriptionId = `${controlId}-description`;
|
|
4058
4546
|
const isDisabled = disabled ?? group.disabled;
|
|
4059
4547
|
const checked = group.value === value;
|
|
4060
|
-
return /* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4548
|
+
return /* @__PURE__ */ jsxs26("div", { className: clsx39("flex flex-col", className), children: [
|
|
4549
|
+
/* @__PURE__ */ jsxs26(
|
|
4062
4550
|
"label",
|
|
4063
4551
|
{
|
|
4064
4552
|
htmlFor: controlId,
|
|
4065
|
-
className:
|
|
4553
|
+
className: clsx39(
|
|
4066
4554
|
"group inline-flex items-start gap-2.5",
|
|
4067
4555
|
isDisabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"
|
|
4068
4556
|
),
|
|
4069
4557
|
children: [
|
|
4070
|
-
/* @__PURE__ */
|
|
4558
|
+
/* @__PURE__ */ jsx42(
|
|
4071
4559
|
"input",
|
|
4072
4560
|
{
|
|
4073
4561
|
ref,
|
|
@@ -4083,7 +4571,7 @@ var Radio = forwardRef14(function Radio2({ value, label, description, disabled,
|
|
|
4083
4571
|
...props
|
|
4084
4572
|
}
|
|
4085
4573
|
),
|
|
4086
|
-
/* @__PURE__ */
|
|
4574
|
+
/* @__PURE__ */ jsx42(
|
|
4087
4575
|
CheckControl,
|
|
4088
4576
|
{
|
|
4089
4577
|
type: "radio",
|
|
@@ -4093,15 +4581,15 @@ var Radio = forwardRef14(function Radio2({ value, label, description, disabled,
|
|
|
4093
4581
|
size: group.size
|
|
4094
4582
|
}
|
|
4095
4583
|
),
|
|
4096
|
-
label && /* @__PURE__ */
|
|
4584
|
+
label && /* @__PURE__ */ jsx42("span", { className: clsx39(LABEL_TEXT3[group.size], "text-default"), children: label })
|
|
4097
4585
|
]
|
|
4098
4586
|
}
|
|
4099
4587
|
),
|
|
4100
|
-
description && /* @__PURE__ */
|
|
4588
|
+
description && /* @__PURE__ */ jsx42(
|
|
4101
4589
|
"span",
|
|
4102
4590
|
{
|
|
4103
4591
|
id: descriptionId,
|
|
4104
|
-
className:
|
|
4592
|
+
className: clsx39(
|
|
4105
4593
|
"mt-0.5 pl-[26px]",
|
|
4106
4594
|
LABEL_TEXT3[group.size],
|
|
4107
4595
|
isDisabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -4114,15 +4602,15 @@ var Radio = forwardRef14(function Radio2({ value, label, description, disabled,
|
|
|
4114
4602
|
|
|
4115
4603
|
// src/components/forms/radio-cards.tsx
|
|
4116
4604
|
import {
|
|
4117
|
-
createContext as
|
|
4118
|
-
forwardRef as
|
|
4119
|
-
useContext as
|
|
4120
|
-
useId as
|
|
4605
|
+
createContext as createContext7,
|
|
4606
|
+
forwardRef as forwardRef16,
|
|
4607
|
+
useContext as useContext7,
|
|
4608
|
+
useId as useId12
|
|
4121
4609
|
} from "react";
|
|
4122
|
-
import
|
|
4123
|
-
import { jsx as
|
|
4124
|
-
var RadioCardsContext =
|
|
4125
|
-
var RadioCards =
|
|
4610
|
+
import clsx40 from "clsx";
|
|
4611
|
+
import { jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4612
|
+
var RadioCardsContext = createContext7(null);
|
|
4613
|
+
var RadioCards = forwardRef16(function RadioCards2({
|
|
4126
4614
|
children,
|
|
4127
4615
|
value: valueProp,
|
|
4128
4616
|
defaultValue,
|
|
@@ -4135,17 +4623,17 @@ var RadioCards = forwardRef15(function RadioCards2({
|
|
|
4135
4623
|
className,
|
|
4136
4624
|
...rest
|
|
4137
4625
|
}, ref) {
|
|
4138
|
-
const generatedName =
|
|
4626
|
+
const generatedName = useId12();
|
|
4139
4627
|
const [value, setValue] = useControllableState({
|
|
4140
4628
|
value: valueProp,
|
|
4141
4629
|
defaultValue,
|
|
4142
4630
|
onChange: onValueChange
|
|
4143
4631
|
});
|
|
4144
|
-
return /* @__PURE__ */
|
|
4632
|
+
return /* @__PURE__ */ jsx43(
|
|
4145
4633
|
RadioCardsContext.Provider,
|
|
4146
4634
|
{
|
|
4147
4635
|
value: { name: name ?? generatedName, value, setValue, size: size2, disabled, required },
|
|
4148
|
-
children: /* @__PURE__ */
|
|
4636
|
+
children: /* @__PURE__ */ jsx43(
|
|
4149
4637
|
"div",
|
|
4150
4638
|
{
|
|
4151
4639
|
ref,
|
|
@@ -4165,14 +4653,14 @@ var SIZE6 = {
|
|
|
4165
4653
|
default: { pad: "p-4", iconBox: "size-10 rounded-xl", icon: "size-5", mark: "size-5", gap: "mt-3", title: "text-body-sm" },
|
|
4166
4654
|
sm: { pad: "p-3", iconBox: "size-8 rounded-lg", icon: "size-4", mark: "size-4", gap: "mt-2", title: "text-body-xs" }
|
|
4167
4655
|
};
|
|
4168
|
-
var RadioCardsItem =
|
|
4169
|
-
const group =
|
|
4656
|
+
var RadioCardsItem = forwardRef16(function RadioCardsItem2({ value, title, description, icon, disabled: itemDisabled = false, className }, ref) {
|
|
4657
|
+
const group = useContext7(RadioCardsContext);
|
|
4170
4658
|
if (!group) throw new Error("<RadioCardsItem> must be used inside <RadioCards>");
|
|
4171
4659
|
const s = SIZE6[group.size];
|
|
4172
4660
|
const disabled = group.disabled || itemDisabled;
|
|
4173
|
-
const titleId =
|
|
4174
|
-
const descriptionId =
|
|
4175
|
-
return /* @__PURE__ */
|
|
4661
|
+
const titleId = useId12();
|
|
4662
|
+
const descriptionId = useId12();
|
|
4663
|
+
return /* @__PURE__ */ jsxs27(
|
|
4176
4664
|
"label",
|
|
4177
4665
|
{
|
|
4178
4666
|
"data-slot": "radio-cards-item",
|
|
@@ -4187,7 +4675,7 @@ var RadioCardsItem = forwardRef15(function RadioCardsItem2({ value, title, descr
|
|
|
4187
4675
|
className
|
|
4188
4676
|
),
|
|
4189
4677
|
children: [
|
|
4190
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsx43(
|
|
4191
4679
|
"input",
|
|
4192
4680
|
{
|
|
4193
4681
|
ref,
|
|
@@ -4203,35 +4691,35 @@ var RadioCardsItem = forwardRef15(function RadioCardsItem2({ value, title, descr
|
|
|
4203
4691
|
className: "sr-only"
|
|
4204
4692
|
}
|
|
4205
4693
|
),
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
icon ? /* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4695
|
+
icon ? /* @__PURE__ */ jsx43(
|
|
4208
4696
|
"span",
|
|
4209
4697
|
{
|
|
4210
4698
|
"aria-hidden": true,
|
|
4211
|
-
className:
|
|
4699
|
+
className: clsx40(
|
|
4212
4700
|
"flex shrink-0 items-center justify-center bg-brand-tertiary",
|
|
4213
4701
|
"[label:has(:checked)_&]:bg-brand",
|
|
4214
4702
|
s.iconBox
|
|
4215
4703
|
),
|
|
4216
|
-
children: /* @__PURE__ */
|
|
4704
|
+
children: /* @__PURE__ */ jsx43("span", { className: clsx40(s.icon, "text-icon-brand [label:has(:checked)_&]:text-icon-brand-on-brand"), children: icon })
|
|
4217
4705
|
}
|
|
4218
|
-
) : /* @__PURE__ */
|
|
4219
|
-
/* @__PURE__ */
|
|
4706
|
+
) : /* @__PURE__ */ jsx43("span", {}),
|
|
4707
|
+
/* @__PURE__ */ jsx43(
|
|
4220
4708
|
"span",
|
|
4221
4709
|
{
|
|
4222
4710
|
"aria-hidden": true,
|
|
4223
|
-
className:
|
|
4711
|
+
className: clsx40(
|
|
4224
4712
|
"flex shrink-0 items-center justify-center rounded-full border-2 border-default",
|
|
4225
4713
|
"[label:has(:checked)_&]:border-brand",
|
|
4226
4714
|
s.mark
|
|
4227
4715
|
),
|
|
4228
|
-
children: /* @__PURE__ */
|
|
4716
|
+
children: /* @__PURE__ */ jsx43("span", { className: "size-2 scale-0 rounded-full bg-brand transition-transform [label:has(:checked)_&]:scale-100" })
|
|
4229
4717
|
}
|
|
4230
4718
|
)
|
|
4231
4719
|
] }),
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4234
|
-
description && /* @__PURE__ */
|
|
4720
|
+
/* @__PURE__ */ jsxs27("div", { className: s.gap, children: [
|
|
4721
|
+
/* @__PURE__ */ jsx43("span", { id: titleId, className: clsx40("block font-semibold text-default [label:has(:checked)_&]:text-brand", s.title), children: title }),
|
|
4722
|
+
description && /* @__PURE__ */ jsx43("span", { id: descriptionId, className: "mt-0.5 block text-body-tiny text-default-secondary", children: description })
|
|
4235
4723
|
] })
|
|
4236
4724
|
]
|
|
4237
4725
|
}
|
|
@@ -4239,10 +4727,10 @@ var RadioCardsItem = forwardRef15(function RadioCardsItem2({ value, title, descr
|
|
|
4239
4727
|
});
|
|
4240
4728
|
|
|
4241
4729
|
// src/components/forms/checkbox-group.tsx
|
|
4242
|
-
import { createContext as
|
|
4243
|
-
import { jsx as
|
|
4244
|
-
var CheckboxGroupContext =
|
|
4245
|
-
var CheckboxGroup =
|
|
4730
|
+
import { createContext as createContext8, forwardRef as forwardRef17, useContext as useContext8, useId as useId13 } from "react";
|
|
4731
|
+
import { jsx as jsx44, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4732
|
+
var CheckboxGroupContext = createContext8(null);
|
|
4733
|
+
var CheckboxGroup = forwardRef17(function CheckboxGroup2({
|
|
4246
4734
|
children,
|
|
4247
4735
|
legend,
|
|
4248
4736
|
value: valueProp,
|
|
@@ -4255,7 +4743,7 @@ var CheckboxGroup = forwardRef16(function CheckboxGroup2({
|
|
|
4255
4743
|
required = false,
|
|
4256
4744
|
className
|
|
4257
4745
|
}, ref) {
|
|
4258
|
-
const generatedName =
|
|
4746
|
+
const generatedName = useId13();
|
|
4259
4747
|
const [value, setValue] = useControllableState({
|
|
4260
4748
|
value: valueProp,
|
|
4261
4749
|
defaultValue,
|
|
@@ -4270,8 +4758,8 @@ var CheckboxGroup = forwardRef16(function CheckboxGroup2({
|
|
|
4270
4758
|
disabled,
|
|
4271
4759
|
required: required && value.length === 0
|
|
4272
4760
|
};
|
|
4273
|
-
return /* @__PURE__ */
|
|
4274
|
-
/* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ jsx44(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsxs28(FieldSet, { ref, "data-slot": "checkbox-group", "data-required": required || void 0, className, children: [
|
|
4762
|
+
/* @__PURE__ */ jsx44(
|
|
4275
4763
|
FieldLegend,
|
|
4276
4764
|
{
|
|
4277
4765
|
variant: "label",
|
|
@@ -4279,14 +4767,14 @@ var CheckboxGroup = forwardRef16(function CheckboxGroup2({
|
|
|
4279
4767
|
children: legend
|
|
4280
4768
|
}
|
|
4281
4769
|
),
|
|
4282
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsx44("div", { className: cn("flex", orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-4"), children })
|
|
4283
4771
|
] }) });
|
|
4284
4772
|
});
|
|
4285
|
-
var CheckboxGroupItem =
|
|
4773
|
+
var CheckboxGroupItem = forwardRef17(
|
|
4286
4774
|
function CheckboxGroupItem2({ value, label, description, disabled }, ref) {
|
|
4287
|
-
const group =
|
|
4775
|
+
const group = useContext8(CheckboxGroupContext);
|
|
4288
4776
|
if (!group) throw new Error("<CheckboxGroupItem> must be used inside <CheckboxGroup>");
|
|
4289
|
-
return /* @__PURE__ */
|
|
4777
|
+
return /* @__PURE__ */ jsx44(
|
|
4290
4778
|
Checkbox,
|
|
4291
4779
|
{
|
|
4292
4780
|
ref,
|
|
@@ -4305,8 +4793,8 @@ var CheckboxGroupItem = forwardRef16(
|
|
|
4305
4793
|
);
|
|
4306
4794
|
|
|
4307
4795
|
// src/components/forms/segmented-control.tsx
|
|
4308
|
-
import
|
|
4309
|
-
import { jsx as
|
|
4796
|
+
import clsx41 from "clsx";
|
|
4797
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
4310
4798
|
function SegmentedControl({
|
|
4311
4799
|
options,
|
|
4312
4800
|
value: valueProp,
|
|
@@ -4329,12 +4817,12 @@ function SegmentedControl({
|
|
|
4329
4817
|
loop: true,
|
|
4330
4818
|
defaultIndex: selectedIndex
|
|
4331
4819
|
});
|
|
4332
|
-
return /* @__PURE__ */
|
|
4820
|
+
return /* @__PURE__ */ jsx45(
|
|
4333
4821
|
"div",
|
|
4334
4822
|
{
|
|
4335
4823
|
role: "radiogroup",
|
|
4336
4824
|
"aria-label": label,
|
|
4337
|
-
className:
|
|
4825
|
+
className: clsx41(
|
|
4338
4826
|
"inline-flex items-center rounded-xl border border-default bg-default-secondary p-0.5",
|
|
4339
4827
|
className
|
|
4340
4828
|
),
|
|
@@ -4345,7 +4833,7 @@ function SegmentedControl({
|
|
|
4345
4833
|
disabled: option.disabled,
|
|
4346
4834
|
label: option.label
|
|
4347
4835
|
});
|
|
4348
|
-
return /* @__PURE__ */
|
|
4836
|
+
return /* @__PURE__ */ jsx45(
|
|
4349
4837
|
"button",
|
|
4350
4838
|
{
|
|
4351
4839
|
type: "button",
|
|
@@ -4359,7 +4847,7 @@ function SegmentedControl({
|
|
|
4359
4847
|
if (!option.disabled) setValue(option.value);
|
|
4360
4848
|
},
|
|
4361
4849
|
onClick: () => !option.disabled && setValue(option.value),
|
|
4362
|
-
className:
|
|
4850
|
+
className: clsx41(
|
|
4363
4851
|
"rounded-lg px-3.5 py-1.5 text-body-xs font-medium transition-colors",
|
|
4364
4852
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary",
|
|
4365
4853
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -4375,10 +4863,10 @@ function SegmentedControl({
|
|
|
4375
4863
|
}
|
|
4376
4864
|
|
|
4377
4865
|
// src/components/forms/slider.tsx
|
|
4378
|
-
import { forwardRef as
|
|
4379
|
-
import
|
|
4380
|
-
import { jsx as
|
|
4381
|
-
var Slider =
|
|
4866
|
+
import { forwardRef as forwardRef18, useId as useId14 } from "react";
|
|
4867
|
+
import clsx42 from "clsx";
|
|
4868
|
+
import { jsx as jsx46, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4869
|
+
var Slider = forwardRef18(function Slider2({
|
|
4382
4870
|
value,
|
|
4383
4871
|
defaultValue,
|
|
4384
4872
|
onValueChange,
|
|
@@ -4394,315 +4882,104 @@ var Slider = forwardRef17(function Slider2({
|
|
|
4394
4882
|
className,
|
|
4395
4883
|
...props
|
|
4396
4884
|
}, ref) {
|
|
4397
|
-
const generatedId =
|
|
4885
|
+
const generatedId = useId14();
|
|
4398
4886
|
const controlId = id ?? generatedId;
|
|
4399
4887
|
const descriptionId = `${controlId}-description`;
|
|
4400
4888
|
const current = value ?? defaultValue ?? min;
|
|
4401
4889
|
const display = formatValue ? formatValue(current) : String(current);
|
|
4402
|
-
return /* @__PURE__ */
|
|
4403
|
-
(label || showValue) && /* @__PURE__ */
|
|
4404
|
-
label && /* @__PURE__ */
|
|
4890
|
+
return /* @__PURE__ */ jsxs29("div", { className: clsx42("flex w-full flex-col gap-1.5", className), children: [
|
|
4891
|
+
(label || showValue) && /* @__PURE__ */ jsxs29("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
4892
|
+
label && /* @__PURE__ */ jsx46(
|
|
4405
4893
|
"label",
|
|
4406
4894
|
{
|
|
4407
4895
|
htmlFor: controlId,
|
|
4408
|
-
className:
|
|
4896
|
+
className: clsx42("text-body-sm", disabled ? "text-disabled" : "text-default"),
|
|
4409
4897
|
children: label
|
|
4410
4898
|
}
|
|
4411
4899
|
),
|
|
4412
|
-
showValue && /* @__PURE__ */
|
|
4900
|
+
showValue && /* @__PURE__ */ jsx46("span", { className: "text-body-sm font-medium tabular-nums text-default", children: display })
|
|
4413
4901
|
] }),
|
|
4414
|
-
description && /* @__PURE__ */
|
|
4902
|
+
description && /* @__PURE__ */ jsx46(
|
|
4415
4903
|
"p",
|
|
4416
4904
|
{
|
|
4417
4905
|
id: descriptionId,
|
|
4418
|
-
className:
|
|
4906
|
+
className: clsx42("text-body-xs", disabled ? "text-disabled" : "text-default-secondary"),
|
|
4419
4907
|
children: description
|
|
4420
4908
|
}
|
|
4421
4909
|
),
|
|
4422
|
-
/* @__PURE__ */
|
|
4910
|
+
/* @__PURE__ */ jsx46(
|
|
4423
4911
|
"input",
|
|
4424
|
-
{
|
|
4425
|
-
ref,
|
|
4426
|
-
id: controlId,
|
|
4427
|
-
type: "range",
|
|
4428
|
-
min,
|
|
4429
|
-
max,
|
|
4430
|
-
step,
|
|
4431
|
-
value,
|
|
4432
|
-
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
4433
|
-
disabled,
|
|
4434
|
-
"aria-describedby": description ? descriptionId : void 0,
|
|
4435
|
-
"aria-valuetext": formatValue ? display : void 0,
|
|
4436
|
-
onChange: (event) => onValueChange?.(Number(event.target.value)),
|
|
4437
|
-
className:
|
|
4438
|
-
"h-5 w-full cursor-pointer appearance-none bg-transparent",
|
|
4439
|
-
"focus-visible:outline-none",
|
|
4440
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
4441
|
-
// Track
|
|
4442
|
-
"[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary",
|
|
4443
|
-
"[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary",
|
|
4444
|
-
"[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand",
|
|
4445
|
-
// Thumb. The negative margin centres it on the track, since the input box is
|
|
4446
|
-
// taller than the track to keep a comfortable pointer target.
|
|
4447
|
-
"[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100",
|
|
4448
|
-
"[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default",
|
|
4449
|
-
// Focus ring on the thumb, not the whole 100%-wide input — a ring around the
|
|
4450
|
-
// full track reads as the row being focused rather than the handle.
|
|
4451
|
-
"focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1",
|
|
4452
|
-
"focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand"
|
|
4453
|
-
),
|
|
4454
|
-
...props
|
|
4455
|
-
}
|
|
4456
|
-
)
|
|
4457
|
-
] });
|
|
4458
|
-
});
|
|
4459
|
-
|
|
4460
|
-
// src/components/forms/label.tsx
|
|
4461
|
-
import { forwardRef as
|
|
4462
|
-
import
|
|
4463
|
-
import { jsx as
|
|
4464
|
-
var SIZE7 = {
|
|
4465
|
-
lg: "text-body",
|
|
4466
|
-
md: "text-body-sm",
|
|
4467
|
-
sm: "text-body-tiny"
|
|
4468
|
-
};
|
|
4469
|
-
var Label =
|
|
4470
|
-
const field = useFieldContext();
|
|
4471
|
-
const resolvedSize = size2 ?? field?.size ?? "md";
|
|
4472
|
-
return /* @__PURE__ */
|
|
4473
|
-
"label",
|
|
4474
|
-
{
|
|
4475
|
-
ref,
|
|
4476
|
-
htmlFor: htmlFor ?? field?.controlId,
|
|
4477
|
-
"data-slot": "label",
|
|
4478
|
-
className: clsx42(
|
|
4479
|
-
"select-none",
|
|
4480
|
-
SIZE7[resolvedSize],
|
|
4481
|
-
field?.disabled ? "text-disabled" : "text-default",
|
|
4482
|
-
className
|
|
4483
|
-
),
|
|
4484
|
-
...rest,
|
|
4485
|
-
children
|
|
4486
|
-
}
|
|
4487
|
-
);
|
|
4488
|
-
});
|
|
4489
|
-
|
|
4490
|
-
// src/components/forms/calendar.tsx
|
|
4491
|
-
import {
|
|
4492
|
-
useCallback as useCallback4,
|
|
4493
|
-
useEffect as useEffect10,
|
|
4494
|
-
useId as useId12,
|
|
4495
|
-
useMemo as useMemo6,
|
|
4496
|
-
useRef as useRef13,
|
|
4497
|
-
useState as useState11
|
|
4498
|
-
} from "react";
|
|
4499
|
-
import clsx43 from "clsx";
|
|
4500
|
-
import { ChevronLeftIcon, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
|
|
4501
|
-
import { jsx as jsx46, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4502
|
-
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
4503
|
-
var sameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
4504
|
-
var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
4505
|
-
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
4506
|
-
var isBefore = (a, b) => startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
4507
|
-
var isAfter = (a, b) => startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
4508
|
-
var inRange = (d, from, to) => startOfDay(d).getTime() > startOfDay(from).getTime() && startOfDay(d).getTime() < startOfDay(to).getTime();
|
|
4509
|
-
function monthGrid(month, weekStartsOn) {
|
|
4510
|
-
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
4511
|
-
const offset2 = (first.getDay() - weekStartsOn + 7) % 7;
|
|
4512
|
-
const start = addDays(first, -offset2);
|
|
4513
|
-
return Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
4514
|
-
}
|
|
4515
|
-
function Calendar({
|
|
4516
|
-
mode = "single",
|
|
4517
|
-
value,
|
|
4518
|
-
range,
|
|
4519
|
-
onSelect,
|
|
4520
|
-
onRangeChange,
|
|
4521
|
-
defaultMonth,
|
|
4522
|
-
min,
|
|
4523
|
-
max,
|
|
4524
|
-
isDateDisabled,
|
|
4525
|
-
weekStartsOn = 1,
|
|
4526
|
-
locale,
|
|
4527
|
-
label = "Calendar",
|
|
4528
|
-
className,
|
|
4529
|
-
...rest
|
|
4530
|
-
}) {
|
|
4531
|
-
const today = useMemo6(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
4532
|
-
const gridId = useId12();
|
|
4533
|
-
const [month, setMonth] = useState11(
|
|
4534
|
-
() => defaultMonth ?? value ?? range?.from ?? today
|
|
4535
|
-
);
|
|
4536
|
-
const [focusedDate, setFocusedDate] = useState11(
|
|
4537
|
-
() => value ?? range?.from ?? today
|
|
4538
|
-
);
|
|
4539
|
-
const cellRefs = useRef13(/* @__PURE__ */ new Map());
|
|
4540
|
-
const monthFormatter = useMemo6(
|
|
4541
|
-
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
4542
|
-
[locale]
|
|
4543
|
-
);
|
|
4544
|
-
const dayNameFormatter = useMemo6(
|
|
4545
|
-
() => new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
4546
|
-
[locale]
|
|
4547
|
-
);
|
|
4548
|
-
const fullDateFormatter = useMemo6(
|
|
4549
|
-
() => new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
4550
|
-
[locale]
|
|
4551
|
-
);
|
|
4552
|
-
const disabled = useCallback4(
|
|
4553
|
-
(date) => {
|
|
4554
|
-
if (min && isBefore(date, min)) return true;
|
|
4555
|
-
if (max && isAfter(date, max)) return true;
|
|
4556
|
-
return isDateDisabled?.(date) ?? false;
|
|
4557
|
-
},
|
|
4558
|
-
[min, max, isDateDisabled]
|
|
4559
|
-
);
|
|
4560
|
-
const key = (d) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
4561
|
-
const pendingFocus = useRef13(false);
|
|
4562
|
-
const focusDate = useCallback4((date) => {
|
|
4563
|
-
pendingFocus.current = true;
|
|
4564
|
-
setFocusedDate(date);
|
|
4565
|
-
setMonth(
|
|
4566
|
-
(current) => current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth() ? current : new Date(date.getFullYear(), date.getMonth(), 1)
|
|
4567
|
-
);
|
|
4568
|
-
}, []);
|
|
4569
|
-
useEffect10(() => {
|
|
4570
|
-
if (!pendingFocus.current) return;
|
|
4571
|
-
const node = cellRefs.current.get(key(focusedDate));
|
|
4572
|
-
if (node) {
|
|
4573
|
-
node.focus();
|
|
4574
|
-
pendingFocus.current = false;
|
|
4575
|
-
}
|
|
4576
|
-
}, [focusedDate, month]);
|
|
4577
|
-
const select = (date) => {
|
|
4578
|
-
if (disabled(date)) return;
|
|
4579
|
-
setFocusedDate(date);
|
|
4580
|
-
if (mode === "single") {
|
|
4581
|
-
onSelect?.(date);
|
|
4582
|
-
return;
|
|
4583
|
-
}
|
|
4584
|
-
const current = range ?? { from: null, to: null };
|
|
4585
|
-
if (!current.from || current.to || isBefore(date, current.from)) {
|
|
4586
|
-
onRangeChange?.({ from: date, to: null });
|
|
4587
|
-
} else {
|
|
4588
|
-
onRangeChange?.({ from: current.from, to: date });
|
|
4589
|
-
}
|
|
4590
|
-
};
|
|
4591
|
-
const onKeyDown = (event) => {
|
|
4592
|
-
const moves = {
|
|
4593
|
-
ArrowLeft: () => addDays(focusedDate, -1),
|
|
4594
|
-
ArrowRight: () => addDays(focusedDate, 1),
|
|
4595
|
-
ArrowUp: () => addDays(focusedDate, -7),
|
|
4596
|
-
ArrowDown: () => addDays(focusedDate, 7),
|
|
4597
|
-
Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),
|
|
4598
|
-
End: () => addDays(focusedDate, 6 - (focusedDate.getDay() - weekStartsOn + 7) % 7),
|
|
4599
|
-
PageUp: () => addDays(focusedDate, 0) && new Date(focusedDate.getFullYear(), focusedDate.getMonth() - 1, focusedDate.getDate()),
|
|
4600
|
-
PageDown: () => new Date(focusedDate.getFullYear(), focusedDate.getMonth() + 1, focusedDate.getDate())
|
|
4601
|
-
};
|
|
4602
|
-
const move = moves[event.key];
|
|
4603
|
-
if (move) {
|
|
4604
|
-
event.preventDefault();
|
|
4605
|
-
focusDate(move());
|
|
4606
|
-
}
|
|
4607
|
-
};
|
|
4608
|
-
const days = monthGrid(month, weekStartsOn);
|
|
4609
|
-
const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));
|
|
4610
|
-
return /* @__PURE__ */ jsxs29(
|
|
4611
|
-
"div",
|
|
4912
|
+
{
|
|
4913
|
+
ref,
|
|
4914
|
+
id: controlId,
|
|
4915
|
+
type: "range",
|
|
4916
|
+
min,
|
|
4917
|
+
max,
|
|
4918
|
+
step,
|
|
4919
|
+
value,
|
|
4920
|
+
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
4921
|
+
disabled,
|
|
4922
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
4923
|
+
"aria-valuetext": formatValue ? display : void 0,
|
|
4924
|
+
onChange: (event) => onValueChange?.(Number(event.target.value)),
|
|
4925
|
+
className: clsx42(
|
|
4926
|
+
"h-5 w-full cursor-pointer appearance-none bg-transparent",
|
|
4927
|
+
"focus-visible:outline-none",
|
|
4928
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
4929
|
+
// Track
|
|
4930
|
+
"[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary",
|
|
4931
|
+
"[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary",
|
|
4932
|
+
"[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand",
|
|
4933
|
+
// Thumb. The negative margin centres it on the track, since the input box is
|
|
4934
|
+
// taller than the track to keep a comfortable pointer target.
|
|
4935
|
+
"[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100",
|
|
4936
|
+
"[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default",
|
|
4937
|
+
// Focus ring on the thumb, not the whole 100%-wide input — a ring around the
|
|
4938
|
+
// full track reads as the row being focused rather than the handle.
|
|
4939
|
+
"focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1",
|
|
4940
|
+
"focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand"
|
|
4941
|
+
),
|
|
4942
|
+
...props
|
|
4943
|
+
}
|
|
4944
|
+
)
|
|
4945
|
+
] });
|
|
4946
|
+
});
|
|
4947
|
+
|
|
4948
|
+
// src/components/forms/label.tsx
|
|
4949
|
+
import { forwardRef as forwardRef19 } from "react";
|
|
4950
|
+
import clsx43 from "clsx";
|
|
4951
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
4952
|
+
var SIZE7 = {
|
|
4953
|
+
lg: "text-body",
|
|
4954
|
+
md: "text-body-sm",
|
|
4955
|
+
sm: "text-body-tiny"
|
|
4956
|
+
};
|
|
4957
|
+
var Label = forwardRef19(function Label2({ children, size: size2, className, htmlFor, ...rest }, ref) {
|
|
4958
|
+
const field = useFieldContext();
|
|
4959
|
+
const resolvedSize = size2 ?? field?.size ?? "md";
|
|
4960
|
+
return /* @__PURE__ */ jsx47(
|
|
4961
|
+
"label",
|
|
4612
4962
|
{
|
|
4613
|
-
|
|
4614
|
-
|
|
4963
|
+
ref,
|
|
4964
|
+
htmlFor: htmlFor ?? field?.controlId,
|
|
4965
|
+
"data-slot": "label",
|
|
4966
|
+
className: clsx43(
|
|
4967
|
+
"select-none",
|
|
4968
|
+
SIZE7[resolvedSize],
|
|
4969
|
+
field?.disabled ? "text-disabled" : "text-default",
|
|
4970
|
+
className
|
|
4971
|
+
),
|
|
4615
4972
|
...rest,
|
|
4616
|
-
children
|
|
4617
|
-
/* @__PURE__ */ jsxs29("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
4618
|
-
/* @__PURE__ */ jsx46(
|
|
4619
|
-
IconButton,
|
|
4620
|
-
{
|
|
4621
|
-
variant: "subtle",
|
|
4622
|
-
size: "sm",
|
|
4623
|
-
"aria-label": "Previous month",
|
|
4624
|
-
disabled: !!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1)),
|
|
4625
|
-
onClick: () => setMonth(addMonths(month, -1)),
|
|
4626
|
-
children: /* @__PURE__ */ jsx46(ChevronLeftIcon, { "aria-hidden": true, size: 16 })
|
|
4627
|
-
}
|
|
4628
|
-
),
|
|
4629
|
-
/* @__PURE__ */ jsx46("span", { "aria-live": "polite", className: "text-body-sm font-semibold text-default", children: monthFormatter.format(month) }),
|
|
4630
|
-
/* @__PURE__ */ jsx46(
|
|
4631
|
-
IconButton,
|
|
4632
|
-
{
|
|
4633
|
-
variant: "subtle",
|
|
4634
|
-
size: "sm",
|
|
4635
|
-
"aria-label": "Next month",
|
|
4636
|
-
disabled: !!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1)),
|
|
4637
|
-
onClick: () => setMonth(addMonths(month, 1)),
|
|
4638
|
-
children: /* @__PURE__ */ jsx46(ChevronRightIcon2, { "aria-hidden": true, size: 16 })
|
|
4639
|
-
}
|
|
4640
|
-
)
|
|
4641
|
-
] }),
|
|
4642
|
-
/* @__PURE__ */ jsxs29(
|
|
4643
|
-
"div",
|
|
4644
|
-
{
|
|
4645
|
-
role: "grid",
|
|
4646
|
-
"aria-label": label,
|
|
4647
|
-
id: gridId,
|
|
4648
|
-
tabIndex: -1,
|
|
4649
|
-
onKeyDown,
|
|
4650
|
-
children: [
|
|
4651
|
-
/* @__PURE__ */ jsx46("div", { role: "row", className: "mb-1 grid grid-cols-7", children: weekdayNames.map((name) => /* @__PURE__ */ jsx46(
|
|
4652
|
-
"div",
|
|
4653
|
-
{
|
|
4654
|
-
role: "columnheader",
|
|
4655
|
-
className: "flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary",
|
|
4656
|
-
children: name
|
|
4657
|
-
},
|
|
4658
|
-
name
|
|
4659
|
-
)) }),
|
|
4660
|
-
Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ jsx46("div", { role: "row", className: "grid grid-cols-7", children: days.slice(week * 7, week * 7 + 7).map((date) => {
|
|
4661
|
-
const outside = date.getMonth() !== month.getMonth();
|
|
4662
|
-
const isDisabled = disabled(date);
|
|
4663
|
-
const selected = mode === "single" ? sameDay(date, value) : sameDay(date, range?.from) || sameDay(date, range?.to);
|
|
4664
|
-
const between = mode === "range" && range?.from && range?.to ? inRange(date, range.from, range.to) : false;
|
|
4665
|
-
const isFocused = sameDay(date, focusedDate);
|
|
4666
|
-
return /* @__PURE__ */ jsx46("div", { role: "gridcell", "aria-selected": selected || void 0, children: /* @__PURE__ */ jsx46(
|
|
4667
|
-
"button",
|
|
4668
|
-
{
|
|
4669
|
-
ref: (node) => {
|
|
4670
|
-
if (node) cellRefs.current.set(key(date), node);
|
|
4671
|
-
else cellRefs.current.delete(key(date));
|
|
4672
|
-
},
|
|
4673
|
-
type: "button",
|
|
4674
|
-
tabIndex: isFocused ? 0 : -1,
|
|
4675
|
-
disabled: isDisabled,
|
|
4676
|
-
"aria-label": fullDateFormatter.format(date),
|
|
4677
|
-
"aria-current": sameDay(date, today) ? "date" : void 0,
|
|
4678
|
-
onClick: () => select(date),
|
|
4679
|
-
onFocus: () => setFocusedDate(date),
|
|
4680
|
-
className: clsx43(
|
|
4681
|
-
"flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors",
|
|
4682
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
4683
|
-
"disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent",
|
|
4684
|
-
selected ? "bg-brand font-semibold text-brand-on-brand" : between ? "rounded-none bg-brand-tertiary text-default" : outside ? "text-default-tertiary hover:bg-default-secondary" : "text-default hover:bg-default-secondary",
|
|
4685
|
-
// Today is marked by a ring rather than a fill, so it stays legible
|
|
4686
|
-
// when it is also the selected day.
|
|
4687
|
-
sameDay(date, today) && !selected && "ring-1 ring-inset ring-brand-tertiary"
|
|
4688
|
-
),
|
|
4689
|
-
children: date.getDate()
|
|
4690
|
-
}
|
|
4691
|
-
) }, key(date));
|
|
4692
|
-
}) }, week))
|
|
4693
|
-
]
|
|
4694
|
-
}
|
|
4695
|
-
)
|
|
4696
|
-
]
|
|
4973
|
+
children
|
|
4697
4974
|
}
|
|
4698
4975
|
);
|
|
4699
|
-
}
|
|
4976
|
+
});
|
|
4700
4977
|
|
|
4701
4978
|
// src/components/forms/input-group.tsx
|
|
4702
|
-
import { forwardRef as
|
|
4979
|
+
import { forwardRef as forwardRef20 } from "react";
|
|
4703
4980
|
import clsx44 from "clsx";
|
|
4704
4981
|
import { SearchIcon as SearchIcon2, XIcon as XIcon3 } from "lucide-react";
|
|
4705
|
-
import { jsx as
|
|
4982
|
+
import { jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4706
4983
|
var HEIGHT2 = {
|
|
4707
4984
|
lg: "h-12 text-body",
|
|
4708
4985
|
md: "h-9 text-body-sm",
|
|
@@ -4713,9 +4990,9 @@ var PAD = {
|
|
|
4713
4990
|
md: "px-3 gap-1.5",
|
|
4714
4991
|
sm: "px-2 gap-1"
|
|
4715
4992
|
};
|
|
4716
|
-
var InputGroup =
|
|
4993
|
+
var InputGroup = forwardRef20(function InputGroup2({ children, size: sizeProp, invalid = false, disabled = false, className, ...rest }, ref) {
|
|
4717
4994
|
const size2 = useControlSize(sizeProp);
|
|
4718
|
-
return /* @__PURE__ */
|
|
4995
|
+
return /* @__PURE__ */ jsx48(
|
|
4719
4996
|
"div",
|
|
4720
4997
|
{
|
|
4721
4998
|
ref,
|
|
@@ -4737,10 +5014,10 @@ var InputGroup = forwardRef19(function InputGroup2({ children, size: sizeProp, i
|
|
|
4737
5014
|
}
|
|
4738
5015
|
);
|
|
4739
5016
|
});
|
|
4740
|
-
var InputGroupInput =
|
|
5017
|
+
var InputGroupInput = forwardRef20(
|
|
4741
5018
|
function InputGroupInput2({ className, ...props }, ref) {
|
|
4742
5019
|
const field = useFieldControl();
|
|
4743
|
-
return /* @__PURE__ */
|
|
5020
|
+
return /* @__PURE__ */ jsx48(
|
|
4744
5021
|
"input",
|
|
4745
5022
|
{
|
|
4746
5023
|
ref,
|
|
@@ -4756,9 +5033,9 @@ var InputGroupInput = forwardRef19(
|
|
|
4756
5033
|
);
|
|
4757
5034
|
}
|
|
4758
5035
|
);
|
|
4759
|
-
var InputGroupAddon =
|
|
5036
|
+
var InputGroupAddon = forwardRef20(
|
|
4760
5037
|
function InputGroupAddon2({ children, align = "inline-start", decorative = true, className, ...rest }, ref) {
|
|
4761
|
-
return /* @__PURE__ */
|
|
5038
|
+
return /* @__PURE__ */ jsx48(
|
|
4762
5039
|
"span",
|
|
4763
5040
|
{
|
|
4764
5041
|
ref,
|
|
@@ -4777,9 +5054,9 @@ var InputGroupAddon = forwardRef19(
|
|
|
4777
5054
|
);
|
|
4778
5055
|
}
|
|
4779
5056
|
);
|
|
4780
|
-
var InputGroupText =
|
|
5057
|
+
var InputGroupText = forwardRef20(
|
|
4781
5058
|
function InputGroupText2({ children, className, ...rest }, ref) {
|
|
4782
|
-
return /* @__PURE__ */
|
|
5059
|
+
return /* @__PURE__ */ jsx48(
|
|
4783
5060
|
"span",
|
|
4784
5061
|
{
|
|
4785
5062
|
ref,
|
|
@@ -4790,12 +5067,12 @@ var InputGroupText = forwardRef19(
|
|
|
4790
5067
|
);
|
|
4791
5068
|
}
|
|
4792
5069
|
);
|
|
4793
|
-
var SearchInput =
|
|
5070
|
+
var SearchInput = forwardRef20(function SearchInput2({ size: sizeProp, onClear, label = "Search", disabled, value, className, ...props }, ref) {
|
|
4794
5071
|
const size2 = useControlSize(sizeProp);
|
|
4795
5072
|
const hasValue = value !== void 0 && value !== "";
|
|
4796
5073
|
return /* @__PURE__ */ jsxs30(InputGroup, { size: size2, disabled, className, children: [
|
|
4797
|
-
/* @__PURE__ */
|
|
4798
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsx48(InputGroupAddon, { children: /* @__PURE__ */ jsx48(SearchIcon2, { className: size2 === "sm" ? "size-3" : "size-4" }) }),
|
|
5075
|
+
/* @__PURE__ */ jsx48(
|
|
4799
5076
|
InputGroupInput,
|
|
4800
5077
|
{
|
|
4801
5078
|
ref,
|
|
@@ -4807,7 +5084,7 @@ var SearchInput = forwardRef19(function SearchInput2({ size: sizeProp, onClear,
|
|
|
4807
5084
|
...props
|
|
4808
5085
|
}
|
|
4809
5086
|
),
|
|
4810
|
-
onClear && hasValue && /* @__PURE__ */
|
|
5087
|
+
onClear && hasValue && /* @__PURE__ */ jsx48(InputGroupAddon, { align: "inline-end", decorative: false, children: /* @__PURE__ */ jsx48(
|
|
4811
5088
|
"button",
|
|
4812
5089
|
{
|
|
4813
5090
|
type: "button",
|
|
@@ -4815,7 +5092,7 @@ var SearchInput = forwardRef19(function SearchInput2({ size: sizeProp, onClear,
|
|
|
4815
5092
|
onClick: onClear,
|
|
4816
5093
|
disabled,
|
|
4817
5094
|
className: "flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand",
|
|
4818
|
-
children: /* @__PURE__ */
|
|
5095
|
+
children: /* @__PURE__ */ jsx48(XIcon3, { "aria-hidden": true, className: size2 === "sm" ? "size-3" : "size-4" })
|
|
4819
5096
|
}
|
|
4820
5097
|
) })
|
|
4821
5098
|
] });
|
|
@@ -4823,11 +5100,11 @@ var SearchInput = forwardRef19(function SearchInput2({ size: sizeProp, onClear,
|
|
|
4823
5100
|
|
|
4824
5101
|
// src/components/overlays/modal.tsx
|
|
4825
5102
|
import {
|
|
4826
|
-
createContext as
|
|
4827
|
-
forwardRef as
|
|
4828
|
-
useContext as
|
|
5103
|
+
createContext as createContext9,
|
|
5104
|
+
forwardRef as forwardRef21,
|
|
5105
|
+
useContext as useContext9,
|
|
4829
5106
|
useEffect as useEffect11,
|
|
4830
|
-
useState as
|
|
5107
|
+
useState as useState14
|
|
4831
5108
|
} from "react";
|
|
4832
5109
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
4833
5110
|
import { CircleCheckBigIcon, InfoIcon, OctagonAlertIcon, TriangleAlertIcon, XIcon as XIcon4 } from "lucide-react";
|
|
@@ -4839,7 +5116,7 @@ function isInsideToaster(target) {
|
|
|
4839
5116
|
}
|
|
4840
5117
|
|
|
4841
5118
|
// src/components/overlays/modal.tsx
|
|
4842
|
-
import { jsx as
|
|
5119
|
+
import { jsx as jsx49, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4843
5120
|
var SIZE8 = {
|
|
4844
5121
|
sm: "sm:max-w-[420px]",
|
|
4845
5122
|
md: "sm:max-w-[540px]",
|
|
@@ -4847,10 +5124,10 @@ var SIZE8 = {
|
|
|
4847
5124
|
xl: "sm:max-w-[800px]"
|
|
4848
5125
|
};
|
|
4849
5126
|
var TONE_ICON = {
|
|
4850
|
-
info: /* @__PURE__ */
|
|
4851
|
-
positive: /* @__PURE__ */
|
|
4852
|
-
warning: /* @__PURE__ */
|
|
4853
|
-
danger: /* @__PURE__ */
|
|
5127
|
+
info: /* @__PURE__ */ jsx49(InfoIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5128
|
+
positive: /* @__PURE__ */ jsx49(CircleCheckBigIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5129
|
+
warning: /* @__PURE__ */ jsx49(TriangleAlertIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5130
|
+
danger: /* @__PURE__ */ jsx49(OctagonAlertIcon, { "aria-hidden": true, className: "size-5" })
|
|
4854
5131
|
};
|
|
4855
5132
|
var TONE_BADGE = {
|
|
4856
5133
|
info: "brand",
|
|
@@ -4863,14 +5140,14 @@ var FOOTER_ALIGN = {
|
|
|
4863
5140
|
between: "justify-between",
|
|
4864
5141
|
end: "justify-end"
|
|
4865
5142
|
};
|
|
4866
|
-
var ModalNaming =
|
|
4867
|
-
var Modal =
|
|
5143
|
+
var ModalNaming = createContext9(null);
|
|
5144
|
+
var Modal = forwardRef21(function Modal2({ open, defaultOpen, onOpenChange, container, ...shell }, ref) {
|
|
4868
5145
|
return /* @__PURE__ */ jsxs31(DialogPrimitive.Root, { open, defaultOpen, onOpenChange, children: [
|
|
4869
5146
|
extractTrigger(shell.children),
|
|
4870
|
-
/* @__PURE__ */
|
|
5147
|
+
/* @__PURE__ */ jsx49(DialogPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx49(ModalShell, { ref, ...shell }) })
|
|
4871
5148
|
] });
|
|
4872
5149
|
});
|
|
4873
|
-
var ModalShell =
|
|
5150
|
+
var ModalShell = forwardRef21(
|
|
4874
5151
|
function ModalShell2({
|
|
4875
5152
|
label,
|
|
4876
5153
|
children,
|
|
@@ -4882,13 +5159,13 @@ var ModalShell = forwardRef20(
|
|
|
4882
5159
|
onInteractOutside,
|
|
4883
5160
|
initialFocus
|
|
4884
5161
|
}, ref) {
|
|
4885
|
-
const [hasTitle, setHasTitle] =
|
|
4886
|
-
const [hasDescription, setHasDescription] =
|
|
4887
|
-
const [contentNode, setContentNode] =
|
|
4888
|
-
const [returnFocusTo] =
|
|
5162
|
+
const [hasTitle, setHasTitle] = useState14(false);
|
|
5163
|
+
const [hasDescription, setHasDescription] = useState14(false);
|
|
5164
|
+
const [contentNode, setContentNode] = useState14(null);
|
|
5165
|
+
const [returnFocusTo] = useState14(
|
|
4889
5166
|
() => typeof document === "undefined" ? null : document.activeElement
|
|
4890
5167
|
);
|
|
4891
|
-
return /* @__PURE__ */
|
|
5168
|
+
return /* @__PURE__ */ jsx49(
|
|
4892
5169
|
DialogPrimitive.Overlay,
|
|
4893
5170
|
{
|
|
4894
5171
|
className: cn(
|
|
@@ -4939,22 +5216,22 @@ var ModalShell = forwardRef20(
|
|
|
4939
5216
|
className
|
|
4940
5217
|
),
|
|
4941
5218
|
children: [
|
|
4942
|
-
!hasTitle && label && /* @__PURE__ */
|
|
4943
|
-
showClose && /* @__PURE__ */
|
|
5219
|
+
!hasTitle && label && /* @__PURE__ */ jsx49(DialogPrimitive.Title, { className: "sr-only", children: label }),
|
|
5220
|
+
showClose && /* @__PURE__ */ jsx49(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx49(
|
|
4944
5221
|
IconButton,
|
|
4945
5222
|
{
|
|
4946
5223
|
variant: "subtle",
|
|
4947
5224
|
size: "sm",
|
|
4948
5225
|
"aria-label": "Close dialog",
|
|
4949
5226
|
className: "absolute right-6 top-5 z-raised",
|
|
4950
|
-
children: /* @__PURE__ */
|
|
5227
|
+
children: /* @__PURE__ */ jsx49(XIcon4, { size: 16, "aria-hidden": true })
|
|
4951
5228
|
}
|
|
4952
5229
|
) }),
|
|
4953
|
-
/* @__PURE__ */
|
|
5230
|
+
/* @__PURE__ */ jsx49(
|
|
4954
5231
|
ModalNaming.Provider,
|
|
4955
5232
|
{
|
|
4956
5233
|
value: { registerTitle: setHasTitle, registerDescription: setHasDescription },
|
|
4957
|
-
children: /* @__PURE__ */
|
|
5234
|
+
children: /* @__PURE__ */ jsx49(PortalContainerProvider, { container: contentNode, children: withoutTrigger(children) })
|
|
4958
5235
|
}
|
|
4959
5236
|
)
|
|
4960
5237
|
]
|
|
@@ -4964,15 +5241,15 @@ var ModalShell = forwardRef20(
|
|
|
4964
5241
|
);
|
|
4965
5242
|
}
|
|
4966
5243
|
);
|
|
4967
|
-
var ModalTrigger =
|
|
5244
|
+
var ModalTrigger = forwardRef21(
|
|
4968
5245
|
function ModalTrigger2(props, ref) {
|
|
4969
|
-
return /* @__PURE__ */
|
|
5246
|
+
return /* @__PURE__ */ jsx49(DialogPrimitive.Trigger, { ref, ...props });
|
|
4970
5247
|
}
|
|
4971
5248
|
);
|
|
4972
5249
|
ModalTrigger.__modalTrigger = true;
|
|
4973
|
-
var ModalClose =
|
|
5250
|
+
var ModalClose = forwardRef21(
|
|
4974
5251
|
function ModalClose2(props, ref) {
|
|
4975
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ jsx49(DialogPrimitive.Close, { ref, ...props });
|
|
4976
5253
|
}
|
|
4977
5254
|
);
|
|
4978
5255
|
function isTrigger(node) {
|
|
@@ -4984,7 +5261,7 @@ function extractTrigger(children) {
|
|
|
4984
5261
|
function withoutTrigger(children) {
|
|
4985
5262
|
return Array.isArray(children) ? children.filter((child) => !isTrigger(child)) : isTrigger(children) ? null : children;
|
|
4986
5263
|
}
|
|
4987
|
-
var ModalHeader =
|
|
5264
|
+
var ModalHeader = forwardRef21(function ModalHeader2({ children, tone = "default", divider = true, className, ...rest }, ref) {
|
|
4988
5265
|
return /* @__PURE__ */ jsxs31(
|
|
4989
5266
|
"div",
|
|
4990
5267
|
{
|
|
@@ -4999,43 +5276,43 @@ var ModalHeader = forwardRef20(function ModalHeader2({ children, tone = "default
|
|
|
4999
5276
|
),
|
|
5000
5277
|
...rest,
|
|
5001
5278
|
children: [
|
|
5002
|
-
tone !== "default" && /* @__PURE__ */
|
|
5003
|
-
/* @__PURE__ */
|
|
5279
|
+
tone !== "default" && /* @__PURE__ */ jsx49(EntityIconBadge, { size: "md", shape: "circle", tone: TONE_BADGE[tone], children: TONE_ICON[tone] }),
|
|
5280
|
+
/* @__PURE__ */ jsx49("div", { className: "min-w-0 flex-1", children })
|
|
5004
5281
|
]
|
|
5005
5282
|
}
|
|
5006
5283
|
);
|
|
5007
5284
|
});
|
|
5008
|
-
var ModalTitle =
|
|
5009
|
-
const naming =
|
|
5285
|
+
var ModalTitle = forwardRef21(function ModalTitle2({ children, className, ...rest }, ref) {
|
|
5286
|
+
const naming = useContext9(ModalNaming);
|
|
5010
5287
|
useEffect11(() => {
|
|
5011
5288
|
naming?.registerTitle(true);
|
|
5012
5289
|
return () => naming?.registerTitle(false);
|
|
5013
5290
|
}, [naming]);
|
|
5014
5291
|
const classes = cn("text-heading-sm font-semibold text-default", className);
|
|
5015
5292
|
if (!naming) {
|
|
5016
|
-
return /* @__PURE__ */
|
|
5293
|
+
return /* @__PURE__ */ jsx49("h2", { ref, className: classes, ...rest, children });
|
|
5017
5294
|
}
|
|
5018
|
-
return /* @__PURE__ */
|
|
5295
|
+
return /* @__PURE__ */ jsx49(DialogPrimitive.Title, { ref, className: classes, ...rest, children });
|
|
5019
5296
|
});
|
|
5020
|
-
var ModalDescription =
|
|
5297
|
+
var ModalDescription = forwardRef21(
|
|
5021
5298
|
function ModalDescription2({ children, className, ...rest }, ref) {
|
|
5022
|
-
const naming =
|
|
5299
|
+
const naming = useContext9(ModalNaming);
|
|
5023
5300
|
useEffect11(() => {
|
|
5024
5301
|
naming?.registerDescription(true);
|
|
5025
5302
|
return () => naming?.registerDescription(false);
|
|
5026
5303
|
}, [naming]);
|
|
5027
5304
|
const classes = cn("mt-0.5 text-body-xs text-default-secondary", className);
|
|
5028
5305
|
if (!naming) {
|
|
5029
|
-
return /* @__PURE__ */
|
|
5306
|
+
return /* @__PURE__ */ jsx49("p", { ref, className: classes, ...rest, children });
|
|
5030
5307
|
}
|
|
5031
|
-
return /* @__PURE__ */
|
|
5308
|
+
return /* @__PURE__ */ jsx49(DialogPrimitive.Description, { ref, className: classes, ...rest, children });
|
|
5032
5309
|
}
|
|
5033
5310
|
);
|
|
5034
|
-
var ModalBody =
|
|
5035
|
-
return /* @__PURE__ */
|
|
5311
|
+
var ModalBody = forwardRef21(function ModalBody2({ children, className, ...rest }, ref) {
|
|
5312
|
+
return /* @__PURE__ */ jsx49("div", { ref, className: cn("px-6 py-5", className), ...rest, children });
|
|
5036
5313
|
});
|
|
5037
|
-
var ModalFooter =
|
|
5038
|
-
return /* @__PURE__ */
|
|
5314
|
+
var ModalFooter = forwardRef21(function ModalFooter2({ children, align = "end", divider = true, className, ...rest }, ref) {
|
|
5315
|
+
return /* @__PURE__ */ jsx49(
|
|
5039
5316
|
"div",
|
|
5040
5317
|
{
|
|
5041
5318
|
ref,
|
|
@@ -5052,9 +5329,9 @@ var ModalFooter = forwardRef20(function ModalFooter2({ children, align = "end",
|
|
|
5052
5329
|
});
|
|
5053
5330
|
|
|
5054
5331
|
// src/components/overlays/tooltip.tsx
|
|
5055
|
-
import { useId as
|
|
5332
|
+
import { useId as useId15 } from "react";
|
|
5056
5333
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
5057
|
-
import { Fragment as Fragment6, jsx as
|
|
5334
|
+
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5058
5335
|
function Tooltip({
|
|
5059
5336
|
children,
|
|
5060
5337
|
title,
|
|
@@ -5069,14 +5346,14 @@ function Tooltip({
|
|
|
5069
5346
|
className
|
|
5070
5347
|
}) {
|
|
5071
5348
|
const container = usePortalContainer();
|
|
5072
|
-
const labelId =
|
|
5349
|
+
const labelId = useId15();
|
|
5073
5350
|
const labelled = association === "labelledby";
|
|
5074
5351
|
const content = /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
5075
|
-
title && /* @__PURE__ */
|
|
5076
|
-
body && /* @__PURE__ */
|
|
5352
|
+
title && /* @__PURE__ */ jsx50("p", { className: "font-semibold", children: title }),
|
|
5353
|
+
body && /* @__PURE__ */ jsx50("p", { className: cn(title && "mt-0.5 opacity-80"), children: body })
|
|
5077
5354
|
] });
|
|
5078
|
-
return /* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5355
|
+
return /* @__PURE__ */ jsx50(TooltipPrimitive.Provider, { delayDuration: openDelay, children: /* @__PURE__ */ jsxs32(TooltipPrimitive.Root, { open, defaultOpen, onOpenChange, children: [
|
|
5356
|
+
/* @__PURE__ */ jsx50(
|
|
5080
5357
|
TooltipPrimitive.Trigger,
|
|
5081
5358
|
{
|
|
5082
5359
|
asChild: true,
|
|
@@ -5089,7 +5366,7 @@ function Tooltip({
|
|
|
5089
5366
|
body ? " " : null,
|
|
5090
5367
|
body
|
|
5091
5368
|
] }),
|
|
5092
|
-
/* @__PURE__ */
|
|
5369
|
+
/* @__PURE__ */ jsx50(TooltipPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx50(
|
|
5093
5370
|
TooltipPrimitive.Content,
|
|
5094
5371
|
{
|
|
5095
5372
|
side,
|
|
@@ -5107,86 +5384,8 @@ function Tooltip({
|
|
|
5107
5384
|
] }) });
|
|
5108
5385
|
}
|
|
5109
5386
|
|
|
5110
|
-
// src/components/overlays/popover.tsx
|
|
5111
|
-
import {
|
|
5112
|
-
createContext as createContext9,
|
|
5113
|
-
forwardRef as forwardRef21,
|
|
5114
|
-
useContext as useContext9,
|
|
5115
|
-
useId as useId14,
|
|
5116
|
-
useMemo as useMemo7,
|
|
5117
|
-
useState as useState13
|
|
5118
|
-
} from "react";
|
|
5119
|
-
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5120
|
-
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5121
|
-
var PopoverTriggerNode = createContext9(null);
|
|
5122
|
-
function Popover({ children, open, defaultOpen, onOpenChange, modal = false }) {
|
|
5123
|
-
const [node, setNode] = useState13(null);
|
|
5124
|
-
const trigger = useMemo7(() => ({ node, setNode, modal }), [node, modal]);
|
|
5125
|
-
return /* @__PURE__ */ jsx50(
|
|
5126
|
-
PopoverPrimitive.Root,
|
|
5127
|
-
{
|
|
5128
|
-
open,
|
|
5129
|
-
defaultOpen,
|
|
5130
|
-
onOpenChange,
|
|
5131
|
-
modal,
|
|
5132
|
-
children: /* @__PURE__ */ jsx50(PopoverTriggerNode.Provider, { value: trigger, children })
|
|
5133
|
-
}
|
|
5134
|
-
);
|
|
5135
|
-
}
|
|
5136
|
-
var PopoverTrigger = forwardRef21(
|
|
5137
|
-
function PopoverTrigger2(props, ref) {
|
|
5138
|
-
const trigger = useContext9(PopoverTriggerNode);
|
|
5139
|
-
const fallbackId = useId14();
|
|
5140
|
-
return /* @__PURE__ */ jsx50(
|
|
5141
|
-
PopoverPrimitive.Trigger,
|
|
5142
|
-
{
|
|
5143
|
-
ref: composeRefs(ref, trigger?.setNode),
|
|
5144
|
-
id: props.id ?? fallbackId,
|
|
5145
|
-
...props
|
|
5146
|
-
}
|
|
5147
|
-
);
|
|
5148
|
-
}
|
|
5149
|
-
);
|
|
5150
|
-
var PopoverContent = forwardRef21(
|
|
5151
|
-
function PopoverContent2({ children, side = "bottom", align = "center", sideOffset = 8, label, container, className, ...rest }, ref) {
|
|
5152
|
-
const trigger = useContext9(PopoverTriggerNode);
|
|
5153
|
-
const inherited = usePortalContainer();
|
|
5154
|
-
return /* @__PURE__ */ jsx50(PopoverPrimitive.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ jsx50(
|
|
5155
|
-
PopoverPrimitive.Content,
|
|
5156
|
-
{
|
|
5157
|
-
ref,
|
|
5158
|
-
side,
|
|
5159
|
-
align,
|
|
5160
|
-
sideOffset,
|
|
5161
|
-
collisionPadding: 8,
|
|
5162
|
-
onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
|
|
5163
|
-
"aria-modal": trigger?.modal || void 0,
|
|
5164
|
-
"aria-label": label,
|
|
5165
|
-
"aria-labelledby": label ? void 0 : trigger?.node?.id || void 0,
|
|
5166
|
-
className: cn(
|
|
5167
|
-
"z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400",
|
|
5168
|
-
"focus:outline-none",
|
|
5169
|
-
className
|
|
5170
|
-
),
|
|
5171
|
-
...rest,
|
|
5172
|
-
children
|
|
5173
|
-
}
|
|
5174
|
-
) });
|
|
5175
|
-
}
|
|
5176
|
-
);
|
|
5177
|
-
var PopoverClose = forwardRef21(
|
|
5178
|
-
function PopoverClose2(props, ref) {
|
|
5179
|
-
return /* @__PURE__ */ jsx50(PopoverPrimitive.Close, { ref, ...props });
|
|
5180
|
-
}
|
|
5181
|
-
);
|
|
5182
|
-
var PopoverAnchor = forwardRef21(
|
|
5183
|
-
function PopoverAnchor2(props, ref) {
|
|
5184
|
-
return /* @__PURE__ */ jsx50(PopoverPrimitive.Anchor, { ref, ...props });
|
|
5185
|
-
}
|
|
5186
|
-
);
|
|
5187
|
-
|
|
5188
5387
|
// src/components/overlays/hover-card.tsx
|
|
5189
|
-
import { useId as
|
|
5388
|
+
import { useId as useId16, useState as useState15 } from "react";
|
|
5190
5389
|
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
5191
5390
|
import { jsx as jsx51, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5192
5391
|
function HoverCard({
|
|
@@ -5202,10 +5401,10 @@ function HoverCard({
|
|
|
5202
5401
|
className
|
|
5203
5402
|
}) {
|
|
5204
5403
|
const container = usePortalContainer();
|
|
5205
|
-
const baseId =
|
|
5404
|
+
const baseId = useId16();
|
|
5206
5405
|
const contentId = `${baseId}-content`;
|
|
5207
5406
|
const triggerId = `${baseId}-trigger`;
|
|
5208
|
-
const [openState, setOpenState] =
|
|
5407
|
+
const [openState, setOpenState] = useState15(defaultOpen);
|
|
5209
5408
|
const open = openProp ?? openState;
|
|
5210
5409
|
const handleOpenChange = (next) => {
|
|
5211
5410
|
setOpenState(next);
|
|
@@ -5259,7 +5458,7 @@ import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
|
|
|
5259
5458
|
// src/components/overlays/menu-core.tsx
|
|
5260
5459
|
import {
|
|
5261
5460
|
forwardRef as forwardRef22,
|
|
5262
|
-
useId as
|
|
5461
|
+
useId as useId17
|
|
5263
5462
|
} from "react";
|
|
5264
5463
|
import clsx45 from "clsx";
|
|
5265
5464
|
import { CheckIcon as CheckIcon7, ChevronRightIcon as ChevronRightIcon3 } from "lucide-react";
|
|
@@ -5292,7 +5491,7 @@ function focusMenuEdge(event, edge) {
|
|
|
5292
5491
|
}
|
|
5293
5492
|
function createMenuParts(P) {
|
|
5294
5493
|
const Item = forwardRef22(function MenuItem({ children, onSelect, tone = "default", disabled = false, icon, description, shortcut, textValue, className, ...rest }, ref) {
|
|
5295
|
-
const descriptionId =
|
|
5494
|
+
const descriptionId = useId17();
|
|
5296
5495
|
return /* @__PURE__ */ jsxs34(
|
|
5297
5496
|
P.Item,
|
|
5298
5497
|
{
|
|
@@ -5358,7 +5557,7 @@ function createMenuParts(P) {
|
|
|
5358
5557
|
);
|
|
5359
5558
|
});
|
|
5360
5559
|
const Group = forwardRef22(function MenuGroup({ children, label, className, ...rest }, ref) {
|
|
5361
|
-
const labelId =
|
|
5560
|
+
const labelId = useId17();
|
|
5362
5561
|
return /* @__PURE__ */ jsxs34(P.Group, { ref, "aria-labelledby": label ? labelId : void 0, className, ...rest, children: [
|
|
5363
5562
|
label && /* @__PURE__ */ jsx52("div", { id: labelId, className: OVERLAY_HEADING, children: label }),
|
|
5364
5563
|
children
|
|
@@ -5611,13 +5810,13 @@ import {
|
|
|
5611
5810
|
forwardRef as forwardRef26,
|
|
5612
5811
|
useContext as useContext10,
|
|
5613
5812
|
useEffect as useEffect13,
|
|
5614
|
-
useState as
|
|
5813
|
+
useState as useState17
|
|
5615
5814
|
} from "react";
|
|
5616
5815
|
import { Dialog as DialogPrimitive2 } from "radix-ui";
|
|
5617
5816
|
import { XIcon as XIcon5 } from "lucide-react";
|
|
5618
5817
|
|
|
5619
5818
|
// src/components/cards/scroll-area.tsx
|
|
5620
|
-
import { forwardRef as forwardRef25, useEffect as useEffect12, useRef as
|
|
5819
|
+
import { forwardRef as forwardRef25, useEffect as useEffect12, useRef as useRef15, useState as useState16 } from "react";
|
|
5621
5820
|
import clsx46 from "clsx";
|
|
5622
5821
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
5623
5822
|
var OVERFLOW = {
|
|
@@ -5626,8 +5825,8 @@ var OVERFLOW = {
|
|
|
5626
5825
|
both: "overflow-auto"
|
|
5627
5826
|
};
|
|
5628
5827
|
var ScrollArea = forwardRef25(function ScrollArea2({ children, axis = "vertical", label, className, ...rest }, ref) {
|
|
5629
|
-
const localRef =
|
|
5630
|
-
const [overflows, setOverflows] =
|
|
5828
|
+
const localRef = useRef15(null);
|
|
5829
|
+
const [overflows, setOverflows] = useState16(false);
|
|
5631
5830
|
useEffect12(() => {
|
|
5632
5831
|
const node = localRef.current;
|
|
5633
5832
|
if (!node) return;
|
|
@@ -5708,10 +5907,10 @@ var Drawer = forwardRef26(function Drawer2({
|
|
|
5708
5907
|
] });
|
|
5709
5908
|
});
|
|
5710
5909
|
var DrawerPanel = forwardRef26(function DrawerPanel2({ side = "right", width, label, className, onEscapeKeyDown, onInteractOutside, initialFocus, children }, ref) {
|
|
5711
|
-
const [hasTitle, setHasTitle] =
|
|
5712
|
-
const [hasDescription, setHasDescription] =
|
|
5713
|
-
const [panelNode, setPanelNode] =
|
|
5714
|
-
const [returnFocusTo] =
|
|
5910
|
+
const [hasTitle, setHasTitle] = useState17(false);
|
|
5911
|
+
const [hasDescription, setHasDescription] = useState17(false);
|
|
5912
|
+
const [panelNode, setPanelNode] = useState17(null);
|
|
5913
|
+
const [returnFocusTo] = useState17(
|
|
5715
5914
|
() => typeof document === "undefined" ? null : document.activeElement
|
|
5716
5915
|
);
|
|
5717
5916
|
return /* @__PURE__ */ jsx56(
|
|
@@ -5867,7 +6066,7 @@ var DrawerFooter = forwardRef26(function DrawerFooter2({ align = "end", classNam
|
|
|
5867
6066
|
});
|
|
5868
6067
|
|
|
5869
6068
|
// src/components/overlays/confirm-dialog.tsx
|
|
5870
|
-
import { useRef as
|
|
6069
|
+
import { useRef as useRef16 } from "react";
|
|
5871
6070
|
import { jsx as jsx57, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
5872
6071
|
function ConfirmDialog({
|
|
5873
6072
|
open,
|
|
@@ -5885,7 +6084,7 @@ function ConfirmDialog({
|
|
|
5885
6084
|
onConfirm,
|
|
5886
6085
|
onOpenChange
|
|
5887
6086
|
}) {
|
|
5888
|
-
const cancelRef =
|
|
6087
|
+
const cancelRef = useRef16(null);
|
|
5889
6088
|
const requestOpenChange = (next) => {
|
|
5890
6089
|
if (!next && isConfirming) return;
|
|
5891
6090
|
onOpenChange(next);
|
|
@@ -5940,7 +6139,7 @@ function ConfirmDialog({
|
|
|
5940
6139
|
}
|
|
5941
6140
|
|
|
5942
6141
|
// src/components/overlays/note-confirm-modal.tsx
|
|
5943
|
-
import { useState as
|
|
6142
|
+
import { useState as useState18 } from "react";
|
|
5944
6143
|
import { jsx as jsx58, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
5945
6144
|
function NoteConfirmModal({ open, ...rest }) {
|
|
5946
6145
|
if (!open) return null;
|
|
@@ -5964,7 +6163,7 @@ function NoteConfirmModalShell({
|
|
|
5964
6163
|
onConfirm,
|
|
5965
6164
|
onDiscardNote
|
|
5966
6165
|
}) {
|
|
5967
|
-
const [note, setNote] =
|
|
6166
|
+
const [note, setNote] = useState18("");
|
|
5968
6167
|
const noteMissing = requireNote && !note.trim();
|
|
5969
6168
|
const requestOpenChange = (next) => {
|
|
5970
6169
|
if (!next && isSubmitting) return;
|
|
@@ -6037,8 +6236,8 @@ import {
|
|
|
6037
6236
|
createContext as createContext11,
|
|
6038
6237
|
forwardRef as forwardRef27,
|
|
6039
6238
|
useContext as useContext11,
|
|
6040
|
-
useMemo as
|
|
6041
|
-
useRef as
|
|
6239
|
+
useMemo as useMemo9,
|
|
6240
|
+
useRef as useRef17
|
|
6042
6241
|
} from "react";
|
|
6043
6242
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
6044
6243
|
import { EllipsisIcon } from "lucide-react";
|
|
@@ -6061,8 +6260,8 @@ function DropdownMenu({
|
|
|
6061
6260
|
defaultValue: defaultOpen,
|
|
6062
6261
|
onChange: onOpenChange
|
|
6063
6262
|
});
|
|
6064
|
-
const pendingEdge =
|
|
6065
|
-
const state =
|
|
6263
|
+
const pendingEdge = useRef17("start");
|
|
6264
|
+
const state = useMemo9(() => ({ setOpen, pendingEdge }), [setOpen]);
|
|
6066
6265
|
return /* @__PURE__ */ jsx59(DropdownMenuPrimitive.Root, { open, onOpenChange: setOpen, modal, children: /* @__PURE__ */ jsx59(DropdownMenuStateContext.Provider, { value: state, children }) });
|
|
6067
6266
|
}
|
|
6068
6267
|
var DropdownMenuTrigger = forwardRef27(
|
|
@@ -6178,7 +6377,7 @@ function Scrim({ onClose, label, position = "fixed", open, className }) {
|
|
|
6178
6377
|
}
|
|
6179
6378
|
|
|
6180
6379
|
// src/components/overlays/fullscreen-surface.tsx
|
|
6181
|
-
import { useState as
|
|
6380
|
+
import { useState as useState19 } from "react";
|
|
6182
6381
|
import { Dialog as DialogPrimitive3 } from "radix-ui";
|
|
6183
6382
|
import { XIcon as XIcon6 } from "lucide-react";
|
|
6184
6383
|
import { jsx as jsx61, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -6194,7 +6393,7 @@ function FullscreenSurface({
|
|
|
6194
6393
|
children,
|
|
6195
6394
|
className
|
|
6196
6395
|
}) {
|
|
6197
|
-
const [node, setNode] =
|
|
6396
|
+
const [node, setNode] = useState19(null);
|
|
6198
6397
|
return /* @__PURE__ */ jsx61(DialogPrimitive3.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsx61(DialogPrimitive3.Portal, { children: /* @__PURE__ */ jsxs38(
|
|
6199
6398
|
DialogPrimitive3.Content,
|
|
6200
6399
|
{
|
|
@@ -6497,13 +6696,13 @@ import {
|
|
|
6497
6696
|
createContext as createContext14,
|
|
6498
6697
|
forwardRef as forwardRef30,
|
|
6499
6698
|
useContext as useContext14,
|
|
6500
|
-
useId as
|
|
6699
|
+
useId as useId18
|
|
6501
6700
|
} from "react";
|
|
6502
6701
|
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
|
|
6503
6702
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
6504
6703
|
var CollapsibleState = createContext14(null);
|
|
6505
6704
|
var Collapsible = forwardRef30(function Collapsible2({ children, open: openProp, defaultOpen = false, onOpenChange, disabled, ...rest }, ref) {
|
|
6506
|
-
const triggerId =
|
|
6705
|
+
const triggerId = useId18();
|
|
6507
6706
|
const [open, setOpen] = useControllableState({
|
|
6508
6707
|
value: openProp,
|
|
6509
6708
|
defaultValue: defaultOpen,
|
|
@@ -6838,10 +7037,10 @@ import {
|
|
|
6838
7037
|
useCallback as useCallback5,
|
|
6839
7038
|
useContext as useContext15,
|
|
6840
7039
|
useEffect as useEffect14,
|
|
6841
|
-
useId as
|
|
6842
|
-
useMemo as
|
|
6843
|
-
useRef as
|
|
6844
|
-
useState as
|
|
7040
|
+
useId as useId19,
|
|
7041
|
+
useMemo as useMemo10,
|
|
7042
|
+
useRef as useRef18,
|
|
7043
|
+
useState as useState20
|
|
6845
7044
|
} from "react";
|
|
6846
7045
|
import clsx49 from "clsx";
|
|
6847
7046
|
import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon4 } from "lucide-react";
|
|
@@ -6869,12 +7068,12 @@ function Carousel({
|
|
|
6869
7068
|
defaultValue: defaultIndex,
|
|
6870
7069
|
onChange: onIndexChange
|
|
6871
7070
|
});
|
|
6872
|
-
const baseId =
|
|
6873
|
-
const cursor =
|
|
6874
|
-
const [paused, setPaused] =
|
|
6875
|
-
const [userTookControl, setUserTookControl] =
|
|
7071
|
+
const baseId = useId19();
|
|
7072
|
+
const cursor = useRef18(0);
|
|
7073
|
+
const [paused, setPaused] = useState20(false);
|
|
7074
|
+
const [userTookControl, setUserTookControl] = useState20(false);
|
|
6876
7075
|
const hasAutoplay = autoplayInterval !== void 0 && autoplayInterval > 0;
|
|
6877
|
-
const context =
|
|
7076
|
+
const context = useMemo10(
|
|
6878
7077
|
() => ({
|
|
6879
7078
|
index,
|
|
6880
7079
|
setIndex: (next) => {
|
|
@@ -7043,10 +7242,10 @@ import {
|
|
|
7043
7242
|
useCallback as useCallback6,
|
|
7044
7243
|
useContext as useContext16,
|
|
7045
7244
|
useEffect as useEffect15,
|
|
7046
|
-
useId as
|
|
7047
|
-
useMemo as
|
|
7048
|
-
useRef as
|
|
7049
|
-
useState as
|
|
7245
|
+
useId as useId20,
|
|
7246
|
+
useMemo as useMemo11,
|
|
7247
|
+
useRef as useRef19,
|
|
7248
|
+
useState as useState21
|
|
7050
7249
|
} from "react";
|
|
7051
7250
|
import clsx50 from "clsx";
|
|
7052
7251
|
import { jsx as jsx70, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
@@ -7072,10 +7271,10 @@ function Resizable({
|
|
|
7072
7271
|
defaultValue: defaultSize,
|
|
7073
7272
|
onChange: onSizeChange
|
|
7074
7273
|
});
|
|
7075
|
-
const containerRef =
|
|
7076
|
-
const baseId =
|
|
7077
|
-
const [dragging, setDragging] =
|
|
7078
|
-
const context =
|
|
7274
|
+
const containerRef = useRef19(null);
|
|
7275
|
+
const baseId = useId20();
|
|
7276
|
+
const [dragging, setDragging] = useState21(false);
|
|
7277
|
+
const context = useMemo11(
|
|
7079
7278
|
() => ({
|
|
7080
7279
|
direction,
|
|
7081
7280
|
size: size2,
|
|
@@ -7135,7 +7334,7 @@ function ResizableHandle({
|
|
|
7135
7334
|
}) {
|
|
7136
7335
|
const ctx = useResizable("ResizableHandle");
|
|
7137
7336
|
const horizontal = ctx.direction === "horizontal";
|
|
7138
|
-
const collapsedFrom =
|
|
7337
|
+
const collapsedFrom = useRef19(null);
|
|
7139
7338
|
const fromPointer = useCallback6(
|
|
7140
7339
|
(clientX, clientY) => {
|
|
7141
7340
|
const container = ctx.containerRef.current;
|
|
@@ -7333,7 +7532,7 @@ import {
|
|
|
7333
7532
|
createContext as createContext17,
|
|
7334
7533
|
forwardRef as forwardRef33,
|
|
7335
7534
|
useContext as useContext17,
|
|
7336
|
-
useId as
|
|
7535
|
+
useId as useId21
|
|
7337
7536
|
} from "react";
|
|
7338
7537
|
import clsx54 from "clsx";
|
|
7339
7538
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
@@ -7404,7 +7603,7 @@ function ItemsTabs({
|
|
|
7404
7603
|
label,
|
|
7405
7604
|
className
|
|
7406
7605
|
}) {
|
|
7407
|
-
const generatedPrefix =
|
|
7606
|
+
const generatedPrefix = useId21();
|
|
7408
7607
|
const prefix = idPrefix ?? generatedPrefix;
|
|
7409
7608
|
const [value, setValue] = useControllableState({
|
|
7410
7609
|
value: valueProp,
|
|
@@ -8004,8 +8203,8 @@ function PaginationBar({
|
|
|
8004
8203
|
SelectControl,
|
|
8005
8204
|
{
|
|
8006
8205
|
"aria-label": "Rows per page",
|
|
8007
|
-
size: "
|
|
8008
|
-
className: "w-
|
|
8206
|
+
size: "md",
|
|
8207
|
+
className: "w-20",
|
|
8009
8208
|
value: String(pageSize),
|
|
8010
8209
|
options: options.map((size2) => ({ value: String(size2), label: String(size2) })),
|
|
8011
8210
|
onValueChange: (value) => onPageSizeChange?.(Number(value))
|
|
@@ -8328,21 +8527,21 @@ function slotWidthPx(gridWidthPx, columnGapPx, cols) {
|
|
|
8328
8527
|
}
|
|
8329
8528
|
|
|
8330
8529
|
// src/lib/use-width-tier.ts
|
|
8331
|
-
import { useCallback as useCallback7, useEffect as useEffect16, useLayoutEffect, useRef as
|
|
8530
|
+
import { useCallback as useCallback7, useEffect as useEffect16, useLayoutEffect, useRef as useRef20, useState as useState22 } from "react";
|
|
8332
8531
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect16 : useLayoutEffect;
|
|
8333
8532
|
var TIER_SETTLE_MS = 200;
|
|
8334
8533
|
function useWidthTier({ frozen = false } = {}) {
|
|
8335
|
-
const [node, setNode] =
|
|
8336
|
-
const [{ widthPx, tier }, setMeasured] =
|
|
8534
|
+
const [node, setNode] = useState22(null);
|
|
8535
|
+
const [{ widthPx, tier }, setMeasured] = useState22({
|
|
8337
8536
|
widthPx: null,
|
|
8338
8537
|
tier: "wide"
|
|
8339
8538
|
});
|
|
8340
|
-
const observed =
|
|
8341
|
-
const frozenRef =
|
|
8539
|
+
const observed = useRef20(null);
|
|
8540
|
+
const frozenRef = useRef20(frozen);
|
|
8342
8541
|
frozenRef.current = frozen;
|
|
8343
|
-
const tierRef =
|
|
8542
|
+
const tierRef = useRef20(tier);
|
|
8344
8543
|
tierRef.current = tier;
|
|
8345
|
-
const widthRef =
|
|
8544
|
+
const widthRef = useRef20(widthPx);
|
|
8346
8545
|
widthRef.current = widthPx;
|
|
8347
8546
|
const commit = useCallback7(() => {
|
|
8348
8547
|
const raw = observed.current;
|
|
@@ -8827,7 +9026,7 @@ function RadialGauge({
|
|
|
8827
9026
|
}
|
|
8828
9027
|
|
|
8829
9028
|
// src/components/charts/sparkline.tsx
|
|
8830
|
-
import { useId as
|
|
9029
|
+
import { useId as useId22 } from "react";
|
|
8831
9030
|
import clsx74 from "clsx";
|
|
8832
9031
|
import { Fragment as Fragment12, jsx as jsx94, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
8833
9032
|
var SIZE17 = {
|
|
@@ -8849,7 +9048,7 @@ function Sparkline({
|
|
|
8849
9048
|
label,
|
|
8850
9049
|
className
|
|
8851
9050
|
}) {
|
|
8852
|
-
const gradientId =
|
|
9051
|
+
const gradientId = useId22();
|
|
8853
9052
|
if (data.length < 2) return null;
|
|
8854
9053
|
const w = width ?? SIZE17[size2].width;
|
|
8855
9054
|
const h = height ?? SIZE17[size2].height;
|
|
@@ -9352,7 +9551,7 @@ function ScoredRow({
|
|
|
9352
9551
|
import clsx82 from "clsx";
|
|
9353
9552
|
|
|
9354
9553
|
// src/components/feedback/progress-bar.tsx
|
|
9355
|
-
import { useId as
|
|
9554
|
+
import { useId as useId23 } from "react";
|
|
9356
9555
|
import { jsx as jsx102, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
9357
9556
|
var SIZE20 = {
|
|
9358
9557
|
xs: "h-1",
|
|
@@ -9381,7 +9580,7 @@ function ProgressBar({
|
|
|
9381
9580
|
}) {
|
|
9382
9581
|
const clamped = Math.min(100, Math.max(0, value));
|
|
9383
9582
|
const rounded = radius ? void 0 : "rounded-full";
|
|
9384
|
-
const labelId =
|
|
9583
|
+
const labelId = useId23();
|
|
9385
9584
|
const filledSegments = segments ? Math.round(clamped / 100 * segments) : 0;
|
|
9386
9585
|
const track = segments ? /* @__PURE__ */ jsx102(
|
|
9387
9586
|
"div",
|
|
@@ -9582,7 +9781,7 @@ function DetailGrid({ children, columns = "auto", className }) {
|
|
|
9582
9781
|
}
|
|
9583
9782
|
|
|
9584
9783
|
// src/components/lists/description-list.tsx
|
|
9585
|
-
import { useEffect as useEffect17, useState as
|
|
9784
|
+
import { useEffect as useEffect17, useState as useState23 } from "react";
|
|
9586
9785
|
import clsx87 from "clsx";
|
|
9587
9786
|
import { CheckIcon as CheckIcon9, CopyIcon } from "lucide-react";
|
|
9588
9787
|
import { Fragment as Fragment14, jsx as jsx108, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
@@ -9600,7 +9799,7 @@ function DescriptionItem({ label, value, copyValue, className }) {
|
|
|
9600
9799
|
] });
|
|
9601
9800
|
}
|
|
9602
9801
|
function CopyButton({ value, label, copiedLabel = "Copied", className }) {
|
|
9603
|
-
const [copied, setCopied] =
|
|
9802
|
+
const [copied, setCopied] = useState23(false);
|
|
9604
9803
|
useEffect17(() => {
|
|
9605
9804
|
if (!copied) return;
|
|
9606
9805
|
const timer = window.setTimeout(() => setCopied(false), 2e3);
|
|
@@ -9667,7 +9866,7 @@ function CheckedGroupList({
|
|
|
9667
9866
|
}
|
|
9668
9867
|
|
|
9669
9868
|
// src/components/lists/tree-view.tsx
|
|
9670
|
-
import { useMemo as
|
|
9869
|
+
import { useMemo as useMemo12, useRef as useRef21, useState as useState24 } from "react";
|
|
9671
9870
|
import clsx89 from "clsx";
|
|
9672
9871
|
import { ChevronRightIcon as ChevronRightIcon7 } from "lucide-react";
|
|
9673
9872
|
import { jsx as jsx110, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
@@ -9700,10 +9899,10 @@ function TreeView({
|
|
|
9700
9899
|
value: selectedProp,
|
|
9701
9900
|
defaultValue: defaultSelected
|
|
9702
9901
|
});
|
|
9703
|
-
const [focusedId, setFocusedId] =
|
|
9704
|
-
const rowRefs =
|
|
9705
|
-
const expandedSet =
|
|
9706
|
-
const visible =
|
|
9902
|
+
const [focusedId, setFocusedId] = useState24(null);
|
|
9903
|
+
const rowRefs = useRef21(/* @__PURE__ */ new Map());
|
|
9904
|
+
const expandedSet = useMemo12(() => new Set(expanded), [expanded]);
|
|
9905
|
+
const visible = useMemo12(() => {
|
|
9707
9906
|
const out = [];
|
|
9708
9907
|
const walk = (nodes, level, parentId) => {
|
|
9709
9908
|
for (const item of nodes) {
|
|
@@ -9852,25 +10051,37 @@ import { forwardRef as forwardRef40 } from "react";
|
|
|
9852
10051
|
import clsx90 from "clsx";
|
|
9853
10052
|
import { ChevronDownIcon as ChevronDownIcon4, ChevronsUpDownIcon, ChevronUpIcon } from "lucide-react";
|
|
9854
10053
|
import { jsx as jsx111, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
9855
|
-
var Table = forwardRef40(function Table2({ label, density = "default", fixed = false, className, children, ...rest }, ref) {
|
|
10054
|
+
var Table = forwardRef40(function Table2({ label, density = "default", fixed = false, maxHeight, className, children, ...rest }, ref) {
|
|
9856
10055
|
return (
|
|
9857
10056
|
// The scroll container is separate from the table so the header stays inside the
|
|
9858
10057
|
// scrolling region — a table that is its own scroll container cannot have a sticky
|
|
9859
10058
|
// header.
|
|
9860
10059
|
// The scroll wrapper is required for a <table>, which cannot itself scroll, so this
|
|
9861
10060
|
// takes the scrollbar styling rather than ScrollArea.
|
|
9862
|
-
/* @__PURE__ */ jsx111(
|
|
9863
|
-
"
|
|
10061
|
+
/* @__PURE__ */ jsx111(
|
|
10062
|
+
"div",
|
|
9864
10063
|
{
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
10064
|
+
className: clsx90(
|
|
10065
|
+
"w-full",
|
|
10066
|
+
maxHeight ? clsx90("overflow-auto overscroll-contain", FOCUS_RING_INSET) : "overflow-x-auto",
|
|
10067
|
+
SCROLLBAR_CLASSES
|
|
10068
|
+
),
|
|
10069
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
10070
|
+
...maxHeight ? { role: "region", tabIndex: 0, "aria-label": label ? `${label} (scrolls)` : "Table (scrolls)" } : {},
|
|
10071
|
+
children: /* @__PURE__ */ jsx111(
|
|
10072
|
+
"table",
|
|
10073
|
+
{
|
|
10074
|
+
ref,
|
|
10075
|
+
"aria-label": label,
|
|
10076
|
+
"data-slot": "table",
|
|
10077
|
+
"data-density": density,
|
|
10078
|
+
className: cn("w-full border-collapse", fixed && "table-fixed", className),
|
|
10079
|
+
...rest,
|
|
10080
|
+
children
|
|
10081
|
+
}
|
|
10082
|
+
)
|
|
9872
10083
|
}
|
|
9873
|
-
)
|
|
10084
|
+
)
|
|
9874
10085
|
);
|
|
9875
10086
|
});
|
|
9876
10087
|
var TableCaption = forwardRef40(
|
|
@@ -9993,9 +10204,9 @@ import {
|
|
|
9993
10204
|
useCallback as useCallback8,
|
|
9994
10205
|
useEffect as useEffect19,
|
|
9995
10206
|
useLayoutEffect as useLayoutEffect3,
|
|
9996
|
-
useMemo as
|
|
9997
|
-
useRef as
|
|
9998
|
-
useState as
|
|
10207
|
+
useMemo as useMemo13,
|
|
10208
|
+
useRef as useRef22,
|
|
10209
|
+
useState as useState26
|
|
9999
10210
|
} from "react";
|
|
10000
10211
|
import clsx94 from "clsx";
|
|
10001
10212
|
import {
|
|
@@ -10008,11 +10219,11 @@ import {
|
|
|
10008
10219
|
} from "@tanstack/react-table";
|
|
10009
10220
|
|
|
10010
10221
|
// src/lib/use-element-width.ts
|
|
10011
|
-
import { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as
|
|
10222
|
+
import { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState25 } from "react";
|
|
10012
10223
|
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? useEffect18 : useLayoutEffect2;
|
|
10013
10224
|
function useElementWidth() {
|
|
10014
|
-
const [node, setNode] =
|
|
10015
|
-
const [width, setWidth] =
|
|
10225
|
+
const [node, setNode] = useState25(null);
|
|
10226
|
+
const [width, setWidth] = useState25(void 0);
|
|
10016
10227
|
useIsomorphicLayoutEffect2(() => {
|
|
10017
10228
|
if (!node) return;
|
|
10018
10229
|
const apply = (next) => {
|
|
@@ -10218,7 +10429,7 @@ function DataTableViewOptions({ table, label = "Columns" }) {
|
|
|
10218
10429
|
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
10219
10430
|
if (columns.length === 0) return null;
|
|
10220
10431
|
return /* @__PURE__ */ jsxs75(DropdownMenu, { children: [
|
|
10221
|
-
/* @__PURE__ */ jsx114(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx114(Button, { variant: "neutral", size: "
|
|
10432
|
+
/* @__PURE__ */ jsx114(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx114(Button, { variant: "neutral", size: "md", leadingIcon: /* @__PURE__ */ jsx114(Columns3Icon, { "aria-hidden": true }), children: label }) }),
|
|
10222
10433
|
/* @__PURE__ */ jsxs75(DropdownMenuContent, { align: "end", children: [
|
|
10223
10434
|
/* @__PURE__ */ jsx114(DropdownMenuLabel, { children: "Show columns" }),
|
|
10224
10435
|
columns.map((column) => /* @__PURE__ */ jsx114(
|
|
@@ -10321,18 +10532,18 @@ function TableCellProgress({
|
|
|
10321
10532
|
className
|
|
10322
10533
|
}) {
|
|
10323
10534
|
const clamped = Math.min(100, Math.max(0, percent));
|
|
10324
|
-
return /* @__PURE__ */ jsxs76("div", { className: clsx93("flex
|
|
10535
|
+
return /* @__PURE__ */ jsxs76("div", { className: clsx93("flex w-full min-w-0 items-center gap-2", className), children: [
|
|
10325
10536
|
/* @__PURE__ */ jsx115(
|
|
10326
10537
|
ProgressBar,
|
|
10327
10538
|
{
|
|
10328
10539
|
value: clamped,
|
|
10329
10540
|
tone,
|
|
10330
|
-
size: "sm",
|
|
10331
|
-
className:
|
|
10541
|
+
size: size2 === "sm" ? "xs" : "sm",
|
|
10542
|
+
className: "min-w-12 flex-1",
|
|
10332
10543
|
"aria-label": `${clamped}%`
|
|
10333
10544
|
}
|
|
10334
10545
|
),
|
|
10335
|
-
/* @__PURE__ */ jsxs76("span", { className: "text-body-tiny leading-none text-default-secondary", children: [
|
|
10546
|
+
/* @__PURE__ */ jsxs76("span", { className: "shrink-0 text-body-tiny leading-none tabular-nums text-default-secondary", children: [
|
|
10336
10547
|
percent,
|
|
10337
10548
|
"%"
|
|
10338
10549
|
] })
|
|
@@ -10367,12 +10578,12 @@ function resolve(updater, previous) {
|
|
|
10367
10578
|
return typeof updater === "function" ? updater(previous) : updater;
|
|
10368
10579
|
}
|
|
10369
10580
|
function useTableState(controlled, initial, onChange) {
|
|
10370
|
-
const [inner, setInner] =
|
|
10581
|
+
const [inner, setInner] = useState26(initial);
|
|
10371
10582
|
const value = controlled ?? inner;
|
|
10372
|
-
const latest =
|
|
10583
|
+
const latest = useRef22(value);
|
|
10373
10584
|
latest.current = value;
|
|
10374
10585
|
const isControlled = controlled !== void 0;
|
|
10375
|
-
const onChangeRef =
|
|
10586
|
+
const onChangeRef = useRef22(onChange);
|
|
10376
10587
|
onChangeRef.current = onChange;
|
|
10377
10588
|
const set = useCallback8(
|
|
10378
10589
|
(updater) => {
|
|
@@ -10401,8 +10612,8 @@ function CellInteractionGuard({ children }) {
|
|
|
10401
10612
|
}
|
|
10402
10613
|
var HEADER_PADDING_PX = { default: 32, compact: 24 };
|
|
10403
10614
|
function useHeaderWidths(padding2, deps) {
|
|
10404
|
-
const nodes =
|
|
10405
|
-
const [widths, setWidths] =
|
|
10615
|
+
const nodes = useRef22(/* @__PURE__ */ new Map());
|
|
10616
|
+
const [widths, setWidths] = useState26({});
|
|
10406
10617
|
const measure = useCallback8(() => {
|
|
10407
10618
|
const next = {};
|
|
10408
10619
|
nodes.current.forEach((node, id) => {
|
|
@@ -10432,18 +10643,20 @@ function useHeaderWidths(padding2, deps) {
|
|
|
10432
10643
|
return { widths, register };
|
|
10433
10644
|
}
|
|
10434
10645
|
function useScrollEdges() {
|
|
10435
|
-
const [node, setNode] =
|
|
10436
|
-
const [edges, setEdges] =
|
|
10646
|
+
const [node, setNode] = useState26(null);
|
|
10647
|
+
const [edges, setEdges] = useState26({ overflowing: false, atStart: true, atEnd: true, overflowingY: false, atTop: true });
|
|
10437
10648
|
const measure = useCallback8(() => {
|
|
10438
10649
|
if (!node) return;
|
|
10439
|
-
const { scrollLeft, scrollWidth, clientWidth } = node;
|
|
10650
|
+
const { scrollLeft, scrollWidth, clientWidth, scrollTop, scrollHeight, clientHeight } = node;
|
|
10440
10651
|
const next = {
|
|
10441
10652
|
overflowing: scrollWidth > clientWidth + 1,
|
|
10442
10653
|
atStart: scrollLeft <= 1,
|
|
10443
|
-
atEnd: scrollLeft + clientWidth >= scrollWidth - 1
|
|
10654
|
+
atEnd: scrollLeft + clientWidth >= scrollWidth - 1,
|
|
10655
|
+
overflowingY: scrollHeight > clientHeight + 1,
|
|
10656
|
+
atTop: scrollTop <= 1
|
|
10444
10657
|
};
|
|
10445
10658
|
setEdges(
|
|
10446
|
-
(previous) => previous.overflowing === next.overflowing && previous.atStart === next.atStart && previous.atEnd === next.atEnd ? previous : next
|
|
10659
|
+
(previous) => previous.overflowing === next.overflowing && previous.atStart === next.atStart && previous.atEnd === next.atEnd && previous.overflowingY === next.overflowingY && previous.atTop === next.atTop ? previous : next
|
|
10447
10660
|
);
|
|
10448
10661
|
}, [node]);
|
|
10449
10662
|
useLayoutEffect3(() => {
|
|
@@ -10489,6 +10702,7 @@ function DataTable({
|
|
|
10489
10702
|
density = "default",
|
|
10490
10703
|
align = "center",
|
|
10491
10704
|
responsive = true,
|
|
10705
|
+
maxHeight,
|
|
10492
10706
|
manual = {},
|
|
10493
10707
|
state = {},
|
|
10494
10708
|
onSortingChange,
|
|
@@ -10520,7 +10734,7 @@ function DataTable({
|
|
|
10520
10734
|
onColumnVisibilityChange
|
|
10521
10735
|
);
|
|
10522
10736
|
const [rowSelection, setRowSelection] = useTableState(state.rowSelection, {}, onRowSelectionChange);
|
|
10523
|
-
const allColumns =
|
|
10737
|
+
const allColumns = useMemo13(() => {
|
|
10524
10738
|
const cols = columns;
|
|
10525
10739
|
if (!enableRowSelection || cols.some((column) => column.id === SELECT_COLUMN_ID)) return cols;
|
|
10526
10740
|
return [createSelectColumn({ getRowLabel: getRowLabel && ((row) => `Select ${getRowLabel(row)}`) }), ...cols];
|
|
@@ -10547,7 +10761,7 @@ function DataTable({
|
|
|
10547
10761
|
rowCount: manual.rowCount,
|
|
10548
10762
|
...tableOptions
|
|
10549
10763
|
});
|
|
10550
|
-
const selectionReported =
|
|
10764
|
+
const selectionReported = useRef22(false);
|
|
10551
10765
|
useEffect19(() => {
|
|
10552
10766
|
if (!onSelectionChange) return;
|
|
10553
10767
|
if (!selectionReported.current) {
|
|
@@ -10558,7 +10772,7 @@ function DataTable({
|
|
|
10558
10772
|
}, [rowSelection]);
|
|
10559
10773
|
const [wrapRef, containerWidth] = useElementWidth();
|
|
10560
10774
|
const breakpoint = responsive === false ? 0 : typeof responsive === "object" ? responsive.breakpoint ?? DEFAULT_CARD_BREAKPOINT_PX : DEFAULT_CARD_BREAKPOINT_PX;
|
|
10561
|
-
const modeRef =
|
|
10775
|
+
const modeRef = useRef22("table");
|
|
10562
10776
|
const mode = nextLayoutMode(modeRef.current, containerWidth, breakpoint);
|
|
10563
10777
|
modeRef.current = mode;
|
|
10564
10778
|
const search = searchable === true ? {} : searchable || void 0;
|
|
@@ -10598,14 +10812,15 @@ function DataTable({
|
|
|
10598
10812
|
renderRowLink,
|
|
10599
10813
|
getRowTone,
|
|
10600
10814
|
getRowDimmed,
|
|
10601
|
-
getRowLabel
|
|
10815
|
+
getRowLabel,
|
|
10816
|
+
maxHeight
|
|
10602
10817
|
};
|
|
10603
10818
|
return /* @__PURE__ */ jsxs77("div", { "data-slot": "data-table", className: cn("flex flex-col gap-3", className), children: [
|
|
10604
10819
|
showToolbar && /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
10605
10820
|
search && /* @__PURE__ */ jsx116(
|
|
10606
10821
|
SearchInput,
|
|
10607
10822
|
{
|
|
10608
|
-
size: "
|
|
10823
|
+
size: "md",
|
|
10609
10824
|
label: search.label ?? "Search",
|
|
10610
10825
|
placeholder: search.placeholder ?? "Search\u2026",
|
|
10611
10826
|
value: searchValue,
|
|
@@ -10619,7 +10834,7 @@ function DataTable({
|
|
|
10619
10834
|
] }),
|
|
10620
10835
|
/* @__PURE__ */ jsx116("p", { role: "status", "aria-live": "polite", className: "sr-only", children: filtering && !loading ? `${resultCount} ${resultCount === 1 ? "result" : "results"}` : "" }),
|
|
10621
10836
|
/* @__PURE__ */ jsxs77("div", { ref: wrapRef, className: "overflow-hidden rounded-xl border border-default bg-default", children: [
|
|
10622
|
-
mode === "cards" ? /* @__PURE__ */ jsx116(CardList, { ...view }) : /* @__PURE__ */ jsx116(TableView, { ...view }),
|
|
10837
|
+
mode === "cards" ? maxHeight ? /* @__PURE__ */ jsx116(CardScroll, { label, maxHeight, children: /* @__PURE__ */ jsx116(CardList, { ...view }) }) : /* @__PURE__ */ jsx116(CardList, { ...view }) : /* @__PURE__ */ jsx116(TableView, { ...view }),
|
|
10623
10838
|
showPager && /* @__PURE__ */ jsx116("div", { className: "border-t border-default px-4 py-3", children: /* @__PURE__ */ jsx116(DataTablePagination, { table, pageSizeOptions }) }),
|
|
10624
10839
|
footer && /* @__PURE__ */ jsx116("div", { className: "border-t border-default px-4 py-3", children: footer })
|
|
10625
10840
|
] })
|
|
@@ -10642,7 +10857,8 @@ function TableView({
|
|
|
10642
10857
|
getRowHref,
|
|
10643
10858
|
renderRowLink,
|
|
10644
10859
|
getRowTone,
|
|
10645
|
-
getRowDimmed
|
|
10860
|
+
getRowDimmed,
|
|
10861
|
+
maxHeight
|
|
10646
10862
|
}) {
|
|
10647
10863
|
const d = DENSITY2[density];
|
|
10648
10864
|
const columns = table.getVisibleLeafColumns();
|
|
@@ -10670,15 +10886,23 @@ function TableView({
|
|
|
10670
10886
|
],
|
|
10671
10887
|
(id === stickyStart || id === stickyEnd) && (header ? "bg-default-secondary" : ["bg-default", rowAction && "group-hover:bg-default-secondary"])
|
|
10672
10888
|
);
|
|
10673
|
-
const
|
|
10889
|
+
const scrolls = scroll.overflowing || Boolean(maxHeight) && scroll.overflowingY;
|
|
10890
|
+
const direction = scroll.overflowing && maxHeight && scroll.overflowingY ? "scrolls" : scroll.overflowing ? "scrolls horizontally" : "scrolls vertically";
|
|
10891
|
+
const regionLabel = `${label ?? "Table"} (${direction})`;
|
|
10892
|
+
const pinnedHeader = maxHeight ? clsx94("sticky top-0 z-sticky bg-default-secondary", !scroll.atTop && "shadow-[inset_0_-1px_0_var(--color-border-default-default)]") : void 0;
|
|
10674
10893
|
return /* @__PURE__ */ jsxs77("div", { className: "relative", children: [
|
|
10675
10894
|
/* @__PURE__ */ jsx116(
|
|
10676
10895
|
"div",
|
|
10677
10896
|
{
|
|
10678
10897
|
ref: scroll.ref,
|
|
10679
10898
|
onScroll: scroll.onScroll,
|
|
10680
|
-
className: cn(
|
|
10681
|
-
|
|
10899
|
+
className: cn(
|
|
10900
|
+
maxHeight ? "overflow-auto overscroll-contain" : "overflow-x-auto overscroll-x-contain",
|
|
10901
|
+
SCROLLBAR_CLASSES,
|
|
10902
|
+
scrolls && FOCUS_RING_INSET
|
|
10903
|
+
),
|
|
10904
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
10905
|
+
...scrolls ? { role: "region", tabIndex: 0, "aria-label": regionLabel } : {},
|
|
10682
10906
|
children: /* @__PURE__ */ jsxs77(
|
|
10683
10907
|
"table",
|
|
10684
10908
|
{
|
|
@@ -10715,6 +10939,7 @@ function TableView({
|
|
|
10715
10939
|
TEXT_ALIGN[meta?.align ?? "start"],
|
|
10716
10940
|
!meta?.interactive && "overflow-hidden",
|
|
10717
10941
|
stickyClass(header.column.id, true),
|
|
10942
|
+
pinnedHeader,
|
|
10718
10943
|
meta?.headerClassName
|
|
10719
10944
|
),
|
|
10720
10945
|
children: header.isPlaceholder ? null : typeof definition === "string" || definition === void 0 ? /* @__PURE__ */ jsx116("span", { ref: meta?.hideHeader ? void 0 : headers.register(header.column.id), className: "inline-block", children: /* @__PURE__ */ jsx116(DataTableColumnHeader, { column: header.column }) }) : flexRender(definition, header.getContext())
|
|
@@ -10834,6 +11059,20 @@ function BodyCell({
|
|
|
10834
11059
|
}
|
|
10835
11060
|
);
|
|
10836
11061
|
}
|
|
11062
|
+
function CardScroll({ label, maxHeight, children }) {
|
|
11063
|
+
const scroll = useScrollEdges();
|
|
11064
|
+
return /* @__PURE__ */ jsx116(
|
|
11065
|
+
"div",
|
|
11066
|
+
{
|
|
11067
|
+
ref: scroll.ref,
|
|
11068
|
+
onScroll: scroll.onScroll,
|
|
11069
|
+
style: { maxHeight },
|
|
11070
|
+
className: cn("overflow-y-auto overscroll-contain", SCROLLBAR_CLASSES, scroll.overflowingY && FOCUS_RING_INSET),
|
|
11071
|
+
...scroll.overflowingY ? { role: "region", tabIndex: 0, "aria-label": `${label ?? "Table"} (scrolls vertically)` } : {},
|
|
11072
|
+
children
|
|
11073
|
+
}
|
|
11074
|
+
);
|
|
11075
|
+
}
|
|
10837
11076
|
function CardList({
|
|
10838
11077
|
table,
|
|
10839
11078
|
label,
|
|
@@ -10914,7 +11153,7 @@ function CardList({
|
|
|
10914
11153
|
/* @__PURE__ */ jsx116("div", { className: "flex max-w-[45%] shrink-0 justify-end [&_.whitespace-nowrap]:whitespace-normal", children: render(slots.status.id) }),
|
|
10915
11154
|
slots.actions && /* @__PURE__ */ jsx116("div", { className: "relative z-raised shrink-0", children: /* @__PURE__ */ jsx116(CellInteractionGuard, { children: render(slots.actions.id) }) })
|
|
10916
11155
|
] }),
|
|
10917
|
-
slots.fields.length > 0 && /* @__PURE__ */ jsx116("dl", { className: "grid grid-cols-[repeat(auto-
|
|
11156
|
+
slots.fields.length > 0 && /* @__PURE__ */ jsx116("dl", { className: "grid grid-cols-[repeat(auto-fit,minmax(min(100%,8.5rem),1fr))] gap-x-4 gap-y-2.5", children: slots.fields.map(({ id, column }) => /* @__PURE__ */ jsxs77("div", { className: clsx94("min-w-0", column.columnDef.meta?.interactive && "relative z-raised"), children: [
|
|
10918
11157
|
/* @__PURE__ */ jsx116("dt", { className: "text-body-tiny text-default-secondary", children: columnLabel(column) }),
|
|
10919
11158
|
/* @__PURE__ */ jsx116("dd", { className: "mt-0.5 min-w-0 text-body-xs text-default", children: column.columnDef.meta?.interactive ? /* @__PURE__ */ jsx116(CellInteractionGuard, { children: render(id) }) : render(id) })
|
|
10920
11159
|
] }, id)) })
|
|
@@ -11002,7 +11241,7 @@ var ErrorBoundary = class extends Component {
|
|
|
11002
11241
|
};
|
|
11003
11242
|
|
|
11004
11243
|
// src/components/feedback/banner.tsx
|
|
11005
|
-
import { forwardRef as forwardRef42, useId as
|
|
11244
|
+
import { forwardRef as forwardRef42, useId as useId24 } from "react";
|
|
11006
11245
|
import clsx96 from "clsx";
|
|
11007
11246
|
import { CircleCheckBigIcon as CircleCheckBigIcon3, InfoIcon as InfoIcon3, TriangleAlertIcon as TriangleAlertIcon3, XIcon as XIcon7 } from "lucide-react";
|
|
11008
11247
|
import { jsx as jsx119, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
@@ -11035,7 +11274,7 @@ var Banner = forwardRef42(function Banner2({
|
|
|
11035
11274
|
className,
|
|
11036
11275
|
...rest
|
|
11037
11276
|
}, ref) {
|
|
11038
|
-
const titleId =
|
|
11277
|
+
const titleId = useId24();
|
|
11039
11278
|
const glyph = icon === void 0 ? TONE_ICON2[tone] : icon;
|
|
11040
11279
|
return /* @__PURE__ */ jsxs79(
|
|
11041
11280
|
"div",
|
|
@@ -11081,9 +11320,9 @@ import {
|
|
|
11081
11320
|
useCallback as useCallback9,
|
|
11082
11321
|
useContext as useContext18,
|
|
11083
11322
|
useEffect as useEffect20,
|
|
11084
|
-
useMemo as
|
|
11085
|
-
useRef as
|
|
11086
|
-
useState as
|
|
11323
|
+
useMemo as useMemo14,
|
|
11324
|
+
useRef as useRef23,
|
|
11325
|
+
useState as useState27
|
|
11087
11326
|
} from "react";
|
|
11088
11327
|
import clsx97 from "clsx";
|
|
11089
11328
|
import { CircleCheckBigIcon as CircleCheckBigIcon4, InfoIcon as InfoIcon4, TriangleAlertIcon as TriangleAlertIcon4, XIcon as XIcon8 } from "lucide-react";
|
|
@@ -11120,9 +11359,9 @@ function Toaster({
|
|
|
11120
11359
|
max = 4,
|
|
11121
11360
|
duration = 5e3
|
|
11122
11361
|
}) {
|
|
11123
|
-
const [toasts, setToasts] =
|
|
11124
|
-
const timers =
|
|
11125
|
-
const counter =
|
|
11362
|
+
const [toasts, setToasts] = useState27([]);
|
|
11363
|
+
const timers = useRef23(/* @__PURE__ */ new Map());
|
|
11364
|
+
const counter = useRef23(0);
|
|
11126
11365
|
const dismiss = useCallback9((id) => {
|
|
11127
11366
|
const timer = timers.current.get(id);
|
|
11128
11367
|
if (timer) {
|
|
@@ -11159,7 +11398,7 @@ function Toaster({
|
|
|
11159
11398
|
map.clear();
|
|
11160
11399
|
};
|
|
11161
11400
|
}, []);
|
|
11162
|
-
const context =
|
|
11401
|
+
const context = useMemo14(() => ({ toast, dismiss, dismissAll }), [toast, dismiss, dismissAll]);
|
|
11163
11402
|
return /* @__PURE__ */ jsxs80(ToastContext.Provider, { value: context, children: [
|
|
11164
11403
|
children,
|
|
11165
11404
|
/* @__PURE__ */ jsx120(Portal, { children: /* @__PURE__ */ jsx120(
|
|
@@ -11211,11 +11450,11 @@ function ToastItem({ toast, onDismiss }) {
|
|
|
11211
11450
|
}
|
|
11212
11451
|
|
|
11213
11452
|
// src/components/forms/password-input.tsx
|
|
11214
|
-
import { forwardRef as forwardRef43, useState as
|
|
11453
|
+
import { forwardRef as forwardRef43, useState as useState28 } from "react";
|
|
11215
11454
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
11216
11455
|
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
11217
11456
|
var PasswordInput = forwardRef43(function PasswordInput2(props, ref) {
|
|
11218
|
-
const [visible, setVisible] =
|
|
11457
|
+
const [visible, setVisible] = useState28(false);
|
|
11219
11458
|
return /* @__PURE__ */ jsx121(
|
|
11220
11459
|
Input,
|
|
11221
11460
|
{
|