@ship-it-ui/ui 0.0.2 → 0.0.3
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 +732 -220
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -2
- package/dist/index.d.ts +98 -2
- package/dist/index.js +763 -240
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
- package/src/styles/globals.css +4 -4
package/dist/index.js
CHANGED
|
@@ -837,7 +837,7 @@ function Select({
|
|
|
837
837
|
|
|
838
838
|
// src/components/Slider/Slider.tsx
|
|
839
839
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
840
|
-
import { forwardRef as forwardRef12 } from "react";
|
|
840
|
+
import { forwardRef as forwardRef12, useCallback as useCallback5, useState as useState6 } from "react";
|
|
841
841
|
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
842
842
|
var Slider = forwardRef12(function Slider2({
|
|
843
843
|
showValue,
|
|
@@ -845,6 +845,7 @@ var Slider = forwardRef12(function Slider2({
|
|
|
845
845
|
className,
|
|
846
846
|
value,
|
|
847
847
|
defaultValue,
|
|
848
|
+
onValueChange,
|
|
848
849
|
thumbLabels,
|
|
849
850
|
"aria-label": ariaLabel,
|
|
850
851
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -852,7 +853,20 @@ var Slider = forwardRef12(function Slider2({
|
|
|
852
853
|
}, ref) {
|
|
853
854
|
const arrValue = Array.isArray(value) ? value : value !== void 0 ? [value] : void 0;
|
|
854
855
|
const arrDefault = Array.isArray(defaultValue) ? defaultValue : defaultValue !== void 0 ? [defaultValue] : void 0;
|
|
855
|
-
const
|
|
856
|
+
const isControlled = arrValue !== void 0;
|
|
857
|
+
const [uncontrolledValue, setUncontrolledValue] = useState6(arrDefault);
|
|
858
|
+
const currentValue = isControlled ? arrValue : uncontrolledValue;
|
|
859
|
+
const wasScalar = !Array.isArray(value ?? defaultValue) && (value ?? defaultValue) !== void 0;
|
|
860
|
+
const handleValueChange = useCallback5(
|
|
861
|
+
(next) => {
|
|
862
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
863
|
+
if (onValueChange) {
|
|
864
|
+
onValueChange(wasScalar ? next[0] ?? 0 : next);
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
[isControlled, onValueChange, wasScalar]
|
|
868
|
+
);
|
|
869
|
+
const display = currentValue?.[0] ?? props.min ?? 0;
|
|
856
870
|
const thumbCount = (arrValue ?? arrDefault)?.length ?? 1;
|
|
857
871
|
return /* @__PURE__ */ jsxs10(
|
|
858
872
|
"span",
|
|
@@ -866,6 +880,7 @@ var Slider = forwardRef12(function Slider2({
|
|
|
866
880
|
{
|
|
867
881
|
value: arrValue,
|
|
868
882
|
defaultValue: arrDefault,
|
|
883
|
+
onValueChange: handleValueChange,
|
|
869
884
|
className: "relative flex h-4 flex-1 touch-none items-center select-none",
|
|
870
885
|
...props,
|
|
871
886
|
children: [
|
|
@@ -1868,10 +1883,10 @@ import * as RadixToast from "@radix-ui/react-toast";
|
|
|
1868
1883
|
import {
|
|
1869
1884
|
createContext,
|
|
1870
1885
|
forwardRef as forwardRef33,
|
|
1871
|
-
useCallback as
|
|
1886
|
+
useCallback as useCallback6,
|
|
1872
1887
|
useContext,
|
|
1873
1888
|
useMemo,
|
|
1874
|
-
useState as
|
|
1889
|
+
useState as useState7
|
|
1875
1890
|
} from "react";
|
|
1876
1891
|
import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1877
1892
|
var ToastContext = createContext(null);
|
|
@@ -1899,8 +1914,8 @@ var variantBorderLeft = {
|
|
|
1899
1914
|
var toastIdCounter = 0;
|
|
1900
1915
|
var nextToastId = () => `toast-${++toastIdCounter}`;
|
|
1901
1916
|
function ToastProvider({ children }) {
|
|
1902
|
-
const [toasts, setToasts] =
|
|
1903
|
-
const toast =
|
|
1917
|
+
const [toasts, setToasts] = useState7([]);
|
|
1918
|
+
const toast = useCallback6((t) => {
|
|
1904
1919
|
const explicitId = t.id;
|
|
1905
1920
|
const id = explicitId ?? nextToastId();
|
|
1906
1921
|
const entry = { ...t, id };
|
|
@@ -1912,7 +1927,7 @@ function ToastProvider({ children }) {
|
|
|
1912
1927
|
});
|
|
1913
1928
|
return id;
|
|
1914
1929
|
}, []);
|
|
1915
|
-
const dismiss =
|
|
1930
|
+
const dismiss = useCallback6((id) => {
|
|
1916
1931
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1917
1932
|
}, []);
|
|
1918
1933
|
const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);
|
|
@@ -2154,7 +2169,7 @@ import {
|
|
|
2154
2169
|
useId as useId6,
|
|
2155
2170
|
useMemo as useMemo2,
|
|
2156
2171
|
useRef as useRef4,
|
|
2157
|
-
useState as
|
|
2172
|
+
useState as useState8
|
|
2158
2173
|
} from "react";
|
|
2159
2174
|
import { jsx as jsx39, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2160
2175
|
function normalize(option) {
|
|
@@ -2211,7 +2226,7 @@ var Combobox = forwardRef38(function Combobox2({
|
|
|
2211
2226
|
defaultValue: initialQuery,
|
|
2212
2227
|
onChange: onQueryChange
|
|
2213
2228
|
});
|
|
2214
|
-
const [open, setOpen] =
|
|
2229
|
+
const [open, setOpen] = useState8(false);
|
|
2215
2230
|
const wrapperRef = useRef4(null);
|
|
2216
2231
|
useOutsideClick(wrapperRef, () => setOpen(false));
|
|
2217
2232
|
const filtered = useMemo2(
|
|
@@ -2674,10 +2689,10 @@ function DataTable(props) {
|
|
|
2674
2689
|
// src/patterns/DatePicker/Calendar.tsx
|
|
2675
2690
|
import {
|
|
2676
2691
|
forwardRef as forwardRef40,
|
|
2677
|
-
useCallback as
|
|
2692
|
+
useCallback as useCallback7,
|
|
2678
2693
|
useEffect as useEffect8,
|
|
2679
2694
|
useRef as useRef6,
|
|
2680
|
-
useState as
|
|
2695
|
+
useState as useState9
|
|
2681
2696
|
} from "react";
|
|
2682
2697
|
import { jsx as jsx42, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
2683
2698
|
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
@@ -2703,8 +2718,8 @@ var Calendar = forwardRef40(function Calendar2({
|
|
|
2703
2718
|
className,
|
|
2704
2719
|
...props
|
|
2705
2720
|
}, ref) {
|
|
2706
|
-
const [today] =
|
|
2707
|
-
const [hydrated, setHydrated] =
|
|
2721
|
+
const [today] = useState9(() => /* @__PURE__ */ new Date());
|
|
2722
|
+
const [hydrated, setHydrated] = useState9(false);
|
|
2708
2723
|
useEffect8(() => setHydrated(true), []);
|
|
2709
2724
|
const [selectedDate, setSelectedDate] = useControllableState({
|
|
2710
2725
|
value,
|
|
@@ -2713,12 +2728,12 @@ var Calendar = forwardRef40(function Calendar2({
|
|
|
2713
2728
|
});
|
|
2714
2729
|
const initialMonth = defaultMonth ?? defaultValue?.getMonth() ?? today.getMonth();
|
|
2715
2730
|
const initialYear = defaultYear ?? defaultValue?.getFullYear() ?? today.getFullYear();
|
|
2716
|
-
const [internalMonth, setInternalMonth] =
|
|
2717
|
-
const [internalYear, setInternalYear] =
|
|
2731
|
+
const [internalMonth, setInternalMonth] = useState9(initialMonth);
|
|
2732
|
+
const [internalYear, setInternalYear] = useState9(initialYear);
|
|
2718
2733
|
const month = monthProp ?? internalMonth;
|
|
2719
2734
|
const year = yearProp ?? internalYear;
|
|
2720
2735
|
const isControlled = monthProp !== void 0 && yearProp !== void 0;
|
|
2721
|
-
const setVisible =
|
|
2736
|
+
const setVisible = useCallback7(
|
|
2722
2737
|
(m, y) => {
|
|
2723
2738
|
if (!isControlled) {
|
|
2724
2739
|
setInternalMonth(m);
|
|
@@ -2728,19 +2743,19 @@ var Calendar = forwardRef40(function Calendar2({
|
|
|
2728
2743
|
},
|
|
2729
2744
|
[isControlled, onVisibleMonthChange]
|
|
2730
2745
|
);
|
|
2731
|
-
const goPrev =
|
|
2746
|
+
const goPrev = useCallback7(() => {
|
|
2732
2747
|
const m = month === 0 ? 11 : month - 1;
|
|
2733
2748
|
const y = month === 0 ? year - 1 : year;
|
|
2734
2749
|
setVisible(m, y);
|
|
2735
2750
|
}, [month, year, setVisible]);
|
|
2736
|
-
const goNext =
|
|
2751
|
+
const goNext = useCallback7(() => {
|
|
2737
2752
|
const m = month === 11 ? 0 : month + 1;
|
|
2738
2753
|
const y = month === 11 ? year + 1 : year;
|
|
2739
2754
|
setVisible(m, y);
|
|
2740
2755
|
}, [month, year, setVisible]);
|
|
2741
2756
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
2742
2757
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
2743
|
-
const [focusedDate, setFocusedDate] =
|
|
2758
|
+
const [focusedDate, setFocusedDate] = useState9(() => {
|
|
2744
2759
|
if (selectedDate) return selectedDate;
|
|
2745
2760
|
return new Date(initialYear, initialMonth, 1);
|
|
2746
2761
|
});
|
|
@@ -2757,7 +2772,7 @@ var Calendar = forwardRef40(function Calendar2({
|
|
|
2757
2772
|
const node = dayRefs.current.get(effectiveFocusDay);
|
|
2758
2773
|
node?.focus();
|
|
2759
2774
|
}, [effectiveFocusDay, month, year]);
|
|
2760
|
-
const moveFocus =
|
|
2775
|
+
const moveFocus = useCallback7(
|
|
2761
2776
|
(next) => {
|
|
2762
2777
|
setFocusedDate(next);
|
|
2763
2778
|
shouldFocusRef.current = true;
|
|
@@ -2769,7 +2784,7 @@ var Calendar = forwardRef40(function Calendar2({
|
|
|
2769
2784
|
},
|
|
2770
2785
|
[month, year, setVisible]
|
|
2771
2786
|
);
|
|
2772
|
-
const onCellKeyDown =
|
|
2787
|
+
const onCellKeyDown = useCallback7(
|
|
2773
2788
|
(e, day) => {
|
|
2774
2789
|
const current = new Date(year, month, day);
|
|
2775
2790
|
let next = null;
|
|
@@ -2929,7 +2944,7 @@ Calendar.displayName = "Calendar";
|
|
|
2929
2944
|
|
|
2930
2945
|
// src/patterns/DatePicker/DatePicker.tsx
|
|
2931
2946
|
import * as RadixPopover2 from "@radix-ui/react-popover";
|
|
2932
|
-
import { forwardRef as forwardRef41, useState as
|
|
2947
|
+
import { forwardRef as forwardRef41, useState as useState10 } from "react";
|
|
2933
2948
|
import { jsx as jsx43, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
2934
2949
|
var defaultFormat = (d) => d.toLocaleDateString();
|
|
2935
2950
|
var DatePicker = forwardRef41(function DatePicker2({
|
|
@@ -2946,7 +2961,7 @@ var DatePicker = forwardRef41(function DatePicker2({
|
|
|
2946
2961
|
id,
|
|
2947
2962
|
name
|
|
2948
2963
|
}, ref) {
|
|
2949
|
-
const [open, setOpen] =
|
|
2964
|
+
const [open, setOpen] = useState10(false);
|
|
2950
2965
|
const [value, setValue] = useControllableState({
|
|
2951
2966
|
value: valueProp,
|
|
2952
2967
|
defaultValue,
|
|
@@ -3044,10 +3059,94 @@ var Dots = forwardRef42(function Dots2({ total, current, onChange, className, "a
|
|
|
3044
3059
|
});
|
|
3045
3060
|
Dots.displayName = "Dots";
|
|
3046
3061
|
|
|
3062
|
+
// src/patterns/Dropzone/Dropzone.tsx
|
|
3063
|
+
import {
|
|
3064
|
+
forwardRef as forwardRef43,
|
|
3065
|
+
useState as useState11
|
|
3066
|
+
} from "react";
|
|
3067
|
+
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3068
|
+
function listToArray(list) {
|
|
3069
|
+
if (!list) return [];
|
|
3070
|
+
return Array.from(list);
|
|
3071
|
+
}
|
|
3072
|
+
var Dropzone = forwardRef43(function Dropzone2({
|
|
3073
|
+
onFiles,
|
|
3074
|
+
accept,
|
|
3075
|
+
multiple = true,
|
|
3076
|
+
title = "Drop files to ingest",
|
|
3077
|
+
description,
|
|
3078
|
+
icon = "\u21A5",
|
|
3079
|
+
disabled,
|
|
3080
|
+
className,
|
|
3081
|
+
...props
|
|
3082
|
+
}, ref) {
|
|
3083
|
+
const [isDragging, setIsDragging] = useState11(false);
|
|
3084
|
+
const onDragOver = (e) => {
|
|
3085
|
+
if (disabled) return;
|
|
3086
|
+
e.preventDefault();
|
|
3087
|
+
setIsDragging(true);
|
|
3088
|
+
};
|
|
3089
|
+
const onDragLeave = () => setIsDragging(false);
|
|
3090
|
+
const onDrop = (e) => {
|
|
3091
|
+
if (disabled) return;
|
|
3092
|
+
e.preventDefault();
|
|
3093
|
+
setIsDragging(false);
|
|
3094
|
+
const files = listToArray(e.dataTransfer.files);
|
|
3095
|
+
if (files.length) onFiles?.(files);
|
|
3096
|
+
};
|
|
3097
|
+
return /* @__PURE__ */ jsxs37(
|
|
3098
|
+
"label",
|
|
3099
|
+
{
|
|
3100
|
+
ref,
|
|
3101
|
+
onDragOver,
|
|
3102
|
+
onDragLeave,
|
|
3103
|
+
onDrop,
|
|
3104
|
+
className: cn(
|
|
3105
|
+
"rounded-base flex max-w-[420px] cursor-pointer flex-col items-center border-[1.5px] border-dashed p-8 text-center",
|
|
3106
|
+
"transition-[background,border] duration-(--duration-micro)",
|
|
3107
|
+
"focus-within:ring-accent-dim focus-within:ring-[3px]",
|
|
3108
|
+
isDragging ? "border-accent bg-accent-dim" : "border-border-strong bg-panel hover:bg-panel-2",
|
|
3109
|
+
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
3110
|
+
className
|
|
3111
|
+
),
|
|
3112
|
+
...props,
|
|
3113
|
+
children: [
|
|
3114
|
+
/* @__PURE__ */ jsx45(
|
|
3115
|
+
"input",
|
|
3116
|
+
{
|
|
3117
|
+
type: "file",
|
|
3118
|
+
accept,
|
|
3119
|
+
multiple,
|
|
3120
|
+
disabled,
|
|
3121
|
+
"aria-label": typeof title === "string" ? title : "Upload files",
|
|
3122
|
+
className: "sr-only",
|
|
3123
|
+
onChange: (e) => {
|
|
3124
|
+
const files = listToArray(e.target.files);
|
|
3125
|
+
if (files.length) onFiles?.(files);
|
|
3126
|
+
e.target.value = "";
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
),
|
|
3130
|
+
/* @__PURE__ */ jsx45(
|
|
3131
|
+
"div",
|
|
3132
|
+
{
|
|
3133
|
+
"aria-hidden": true,
|
|
3134
|
+
className: cn("mb-2 text-[28px]", isDragging ? "text-accent" : "text-text-dim"),
|
|
3135
|
+
children: icon
|
|
3136
|
+
}
|
|
3137
|
+
),
|
|
3138
|
+
/* @__PURE__ */ jsx45("div", { className: "mb-1 text-[13px] font-medium", children: title }),
|
|
3139
|
+
description && /* @__PURE__ */ jsx45("div", { className: "text-text-dim text-[11px]", children: description })
|
|
3140
|
+
]
|
|
3141
|
+
}
|
|
3142
|
+
);
|
|
3143
|
+
});
|
|
3144
|
+
Dropzone.displayName = "Dropzone";
|
|
3145
|
+
|
|
3047
3146
|
// src/patterns/EmptyState/EmptyState.tsx
|
|
3048
3147
|
import { cva as cva10 } from "class-variance-authority";
|
|
3049
|
-
import { forwardRef as
|
|
3050
|
-
import { jsx as
|
|
3148
|
+
import { forwardRef as forwardRef44 } from "react";
|
|
3149
|
+
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3051
3150
|
var plateStyles = cva10("grid h-12 w-12 place-items-center rounded-base text-[22px]", {
|
|
3052
3151
|
variants: {
|
|
3053
3152
|
tone: {
|
|
@@ -3060,8 +3159,8 @@ var plateStyles = cva10("grid h-12 w-12 place-items-center rounded-base text-[22
|
|
|
3060
3159
|
},
|
|
3061
3160
|
defaultVariants: { tone: "neutral" }
|
|
3062
3161
|
});
|
|
3063
|
-
var EmptyState =
|
|
3064
|
-
return /* @__PURE__ */
|
|
3162
|
+
var EmptyState = forwardRef44(function EmptyState2({ icon, title, description, action, chips, tone, className, ...props }, ref) {
|
|
3163
|
+
return /* @__PURE__ */ jsxs38(
|
|
3065
3164
|
"div",
|
|
3066
3165
|
{
|
|
3067
3166
|
ref,
|
|
@@ -3071,10 +3170,10 @@ var EmptyState = forwardRef43(function EmptyState2({ icon, title, description, a
|
|
|
3071
3170
|
),
|
|
3072
3171
|
...props,
|
|
3073
3172
|
children: [
|
|
3074
|
-
icon != null && /* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
description && /* @__PURE__ */
|
|
3077
|
-
chips && chips.length > 0 && /* @__PURE__ */
|
|
3173
|
+
icon != null && /* @__PURE__ */ jsx46("span", { "aria-hidden": true, className: plateStyles({ tone: tone ?? "neutral" }), children: icon }),
|
|
3174
|
+
/* @__PURE__ */ jsx46("div", { className: "text-[14px] font-medium", children: title }),
|
|
3175
|
+
description && /* @__PURE__ */ jsx46("div", { className: "text-text-muted max-w-[260px] text-[12px] leading-[1.5]", children: description }),
|
|
3176
|
+
chips && chips.length > 0 && /* @__PURE__ */ jsx46("div", { className: "flex w-full flex-col gap-1", children: chips.map((c, i) => /* @__PURE__ */ jsx46(
|
|
3078
3177
|
"button",
|
|
3079
3178
|
{
|
|
3080
3179
|
type: "button",
|
|
@@ -3096,18 +3195,18 @@ var EmptyState = forwardRef43(function EmptyState2({ icon, title, description, a
|
|
|
3096
3195
|
EmptyState.displayName = "EmptyState";
|
|
3097
3196
|
|
|
3098
3197
|
// src/patterns/FileChip/FileChip.tsx
|
|
3099
|
-
import { forwardRef as
|
|
3100
|
-
import { jsx as
|
|
3198
|
+
import { forwardRef as forwardRef45 } from "react";
|
|
3199
|
+
import { jsx as jsx47, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3101
3200
|
function deriveExt(name) {
|
|
3102
3201
|
const dot = name.lastIndexOf(".");
|
|
3103
3202
|
if (dot < 0) return "FILE";
|
|
3104
3203
|
return name.slice(dot + 1).slice(0, 4).toUpperCase();
|
|
3105
3204
|
}
|
|
3106
|
-
var FileChip =
|
|
3205
|
+
var FileChip = forwardRef45(function FileChip2({ name, size, progress, icon, onRemove, failed, className, ...props }, ref) {
|
|
3107
3206
|
const ext = deriveExt(name);
|
|
3108
3207
|
const showProgress = typeof progress === "number";
|
|
3109
3208
|
const isComplete = showProgress && progress >= 100;
|
|
3110
|
-
return /* @__PURE__ */
|
|
3209
|
+
return /* @__PURE__ */ jsxs39(
|
|
3111
3210
|
"div",
|
|
3112
3211
|
{
|
|
3113
3212
|
ref,
|
|
@@ -3117,7 +3216,7 @@ var FileChip = forwardRef44(function FileChip2({ name, size, progress, icon, onR
|
|
|
3117
3216
|
),
|
|
3118
3217
|
...props,
|
|
3119
3218
|
children: [
|
|
3120
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx47(
|
|
3121
3220
|
"span",
|
|
3122
3221
|
{
|
|
3123
3222
|
"aria-hidden": true,
|
|
@@ -3125,17 +3224,17 @@ var FileChip = forwardRef44(function FileChip2({ name, size, progress, icon, onR
|
|
|
3125
3224
|
children: icon ?? ext
|
|
3126
3225
|
}
|
|
3127
3226
|
),
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3227
|
+
/* @__PURE__ */ jsxs39("div", { className: "min-w-0 flex-1", children: [
|
|
3228
|
+
/* @__PURE__ */ jsx47("div", { className: "truncate text-[12px] font-medium", children: name }),
|
|
3229
|
+
/* @__PURE__ */ jsxs39("div", { className: cn("font-mono text-[10px]", failed ? "text-err" : "text-text-dim"), children: [
|
|
3131
3230
|
size,
|
|
3132
|
-
showProgress && !isComplete && /* @__PURE__ */
|
|
3231
|
+
showProgress && !isComplete && /* @__PURE__ */ jsxs39("span", { children: [
|
|
3133
3232
|
" \xB7 ",
|
|
3134
3233
|
Math.round(progress),
|
|
3135
3234
|
"%"
|
|
3136
3235
|
] })
|
|
3137
3236
|
] }),
|
|
3138
|
-
showProgress && !isComplete && /* @__PURE__ */
|
|
3237
|
+
showProgress && !isComplete && /* @__PURE__ */ jsx47("div", { className: "bg-panel mt-1 h-[2px] overflow-hidden rounded-full", children: /* @__PURE__ */ jsx47(
|
|
3139
3238
|
"div",
|
|
3140
3239
|
{
|
|
3141
3240
|
className: cn(
|
|
@@ -3146,7 +3245,7 @@ var FileChip = forwardRef44(function FileChip2({ name, size, progress, icon, onR
|
|
|
3146
3245
|
}
|
|
3147
3246
|
) })
|
|
3148
3247
|
] }),
|
|
3149
|
-
onRemove && /* @__PURE__ */
|
|
3248
|
+
onRemove && /* @__PURE__ */ jsx47(
|
|
3150
3249
|
"button",
|
|
3151
3250
|
{
|
|
3152
3251
|
type: "button",
|
|
@@ -3167,10 +3266,10 @@ FileChip.displayName = "FileChip";
|
|
|
3167
3266
|
|
|
3168
3267
|
// src/patterns/Menubar/Menubar.tsx
|
|
3169
3268
|
import * as RadixMenubar from "@radix-ui/react-menubar";
|
|
3170
|
-
import { forwardRef as
|
|
3171
|
-
import { jsx as
|
|
3172
|
-
var Menubar =
|
|
3173
|
-
return /* @__PURE__ */
|
|
3269
|
+
import { forwardRef as forwardRef46 } from "react";
|
|
3270
|
+
import { jsx as jsx48, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3271
|
+
var Menubar = forwardRef46(function Menubar2({ className, ...props }, ref) {
|
|
3272
|
+
return /* @__PURE__ */ jsx48(
|
|
3174
3273
|
RadixMenubar.Root,
|
|
3175
3274
|
{
|
|
3176
3275
|
ref,
|
|
@@ -3184,9 +3283,9 @@ var Menubar = forwardRef45(function Menubar2({ className, ...props }, ref) {
|
|
|
3184
3283
|
});
|
|
3185
3284
|
Menubar.displayName = "Menubar";
|
|
3186
3285
|
var MenubarMenu = RadixMenubar.Menu;
|
|
3187
|
-
var MenubarTrigger =
|
|
3286
|
+
var MenubarTrigger = forwardRef46(
|
|
3188
3287
|
function MenubarTrigger2({ className, ...props }, ref) {
|
|
3189
|
-
return /* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ jsx48(
|
|
3190
3289
|
RadixMenubar.Trigger,
|
|
3191
3290
|
{
|
|
3192
3291
|
ref,
|
|
@@ -3203,9 +3302,9 @@ var MenubarTrigger = forwardRef45(
|
|
|
3203
3302
|
}
|
|
3204
3303
|
);
|
|
3205
3304
|
MenubarTrigger.displayName = "MenubarTrigger";
|
|
3206
|
-
var MenubarContent =
|
|
3305
|
+
var MenubarContent = forwardRef46(
|
|
3207
3306
|
function MenubarContent2({ className, sideOffset = 6, align = "start", ...props }, ref) {
|
|
3208
|
-
return /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ jsx48(RadixMenubar.Portal, { children: /* @__PURE__ */ jsx48(
|
|
3209
3308
|
RadixMenubar.Content,
|
|
3210
3309
|
{
|
|
3211
3310
|
ref,
|
|
@@ -3227,24 +3326,24 @@ var itemBase3 = cn(
|
|
|
3227
3326
|
"data-[highlighted]:bg-panel-2",
|
|
3228
3327
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
3229
3328
|
);
|
|
3230
|
-
var MenubarItem =
|
|
3231
|
-
return /* @__PURE__ */
|
|
3329
|
+
var MenubarItem = forwardRef46(function MenubarItem2({ trailing, destructive, className, children, ...props }, ref) {
|
|
3330
|
+
return /* @__PURE__ */ jsxs40(
|
|
3232
3331
|
RadixMenubar.Item,
|
|
3233
3332
|
{
|
|
3234
3333
|
ref,
|
|
3235
3334
|
className: cn(itemBase3, destructive ? "text-err" : "text-text", className),
|
|
3236
3335
|
...props,
|
|
3237
3336
|
children: [
|
|
3238
|
-
/* @__PURE__ */
|
|
3239
|
-
trailing && /* @__PURE__ */
|
|
3337
|
+
/* @__PURE__ */ jsx48("span", { className: "flex-1", children }),
|
|
3338
|
+
trailing && /* @__PURE__ */ jsx48("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
3240
3339
|
]
|
|
3241
3340
|
}
|
|
3242
3341
|
);
|
|
3243
3342
|
});
|
|
3244
3343
|
MenubarItem.displayName = "MenubarItem";
|
|
3245
|
-
var MenubarSeparator =
|
|
3344
|
+
var MenubarSeparator = forwardRef46(
|
|
3246
3345
|
function MenubarSeparator2({ className, ...props }, ref) {
|
|
3247
|
-
return /* @__PURE__ */
|
|
3346
|
+
return /* @__PURE__ */ jsx48(
|
|
3248
3347
|
RadixMenubar.Separator,
|
|
3249
3348
|
{
|
|
3250
3349
|
ref,
|
|
@@ -3256,9 +3355,515 @@ var MenubarSeparator = forwardRef45(
|
|
|
3256
3355
|
);
|
|
3257
3356
|
MenubarSeparator.displayName = "MenubarSeparator";
|
|
3258
3357
|
|
|
3358
|
+
// src/patterns/NavBar/NavBar.tsx
|
|
3359
|
+
import * as RadixNav from "@radix-ui/react-navigation-menu";
|
|
3360
|
+
import {
|
|
3361
|
+
forwardRef as forwardRef48,
|
|
3362
|
+
useCallback as useCallback9,
|
|
3363
|
+
useEffect as useEffect9,
|
|
3364
|
+
useRef as useRef7,
|
|
3365
|
+
useState as useState13
|
|
3366
|
+
} from "react";
|
|
3367
|
+
|
|
3368
|
+
// src/patterns/Sidebar/Sidebar.tsx
|
|
3369
|
+
import {
|
|
3370
|
+
forwardRef as forwardRef47,
|
|
3371
|
+
useCallback as useCallback8,
|
|
3372
|
+
useState as useState12
|
|
3373
|
+
} from "react";
|
|
3374
|
+
import { Fragment as Fragment2, jsx as jsx49, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3375
|
+
var Sidebar = forwardRef47(function Sidebar2({ width = 240, className, style, ...props }, ref) {
|
|
3376
|
+
return /* @__PURE__ */ jsx49(
|
|
3377
|
+
"aside",
|
|
3378
|
+
{
|
|
3379
|
+
ref,
|
|
3380
|
+
style: { width, ...style },
|
|
3381
|
+
className: cn(
|
|
3382
|
+
"border-border bg-panel flex h-full flex-col gap-2 border-r p-[14px]",
|
|
3383
|
+
className
|
|
3384
|
+
),
|
|
3385
|
+
...props
|
|
3386
|
+
}
|
|
3387
|
+
);
|
|
3388
|
+
});
|
|
3389
|
+
Sidebar.displayName = "Sidebar";
|
|
3390
|
+
var NavItem = forwardRef47(
|
|
3391
|
+
function NavItem2({ icon, label, active, badge, href, disabled, className, ...props }, ref) {
|
|
3392
|
+
const inner = /* @__PURE__ */ jsxs41(Fragment2, { children: [
|
|
3393
|
+
icon && /* @__PURE__ */ jsx49("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: icon }),
|
|
3394
|
+
/* @__PURE__ */ jsx49("span", { className: "flex-1 truncate", children: label }),
|
|
3395
|
+
badge != null && /* @__PURE__ */ jsx49(
|
|
3396
|
+
"span",
|
|
3397
|
+
{
|
|
3398
|
+
className: cn(
|
|
3399
|
+
"rounded-xs px-[6px] py-px font-mono text-[10px]",
|
|
3400
|
+
active ? "bg-accent text-on-accent" : "bg-panel-2 text-text-muted"
|
|
3401
|
+
),
|
|
3402
|
+
children: badge
|
|
3403
|
+
}
|
|
3404
|
+
)
|
|
3405
|
+
] });
|
|
3406
|
+
const baseClass = cn(
|
|
3407
|
+
"flex cursor-pointer items-center gap-[10px] rounded-xs px-2 py-[6px] text-[13px] outline-none",
|
|
3408
|
+
"transition-colors duration-(--duration-micro)",
|
|
3409
|
+
"focus-visible:ring-[3px] focus-visible:ring-accent-dim",
|
|
3410
|
+
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3411
|
+
disabled && "opacity-50 pointer-events-none",
|
|
3412
|
+
className
|
|
3413
|
+
);
|
|
3414
|
+
if (href) {
|
|
3415
|
+
const anchorProps = props;
|
|
3416
|
+
return /* @__PURE__ */ jsx49(
|
|
3417
|
+
"a",
|
|
3418
|
+
{
|
|
3419
|
+
ref,
|
|
3420
|
+
href,
|
|
3421
|
+
"aria-current": active ? "page" : void 0,
|
|
3422
|
+
"aria-disabled": disabled || void 0,
|
|
3423
|
+
className: baseClass,
|
|
3424
|
+
...anchorProps,
|
|
3425
|
+
children: inner
|
|
3426
|
+
}
|
|
3427
|
+
);
|
|
3428
|
+
}
|
|
3429
|
+
const buttonProps = props;
|
|
3430
|
+
return /* @__PURE__ */ jsx49(
|
|
3431
|
+
"button",
|
|
3432
|
+
{
|
|
3433
|
+
ref,
|
|
3434
|
+
type: "button",
|
|
3435
|
+
"aria-current": active ? "page" : void 0,
|
|
3436
|
+
disabled,
|
|
3437
|
+
className: cn(baseClass, "w-full text-left"),
|
|
3438
|
+
...buttonProps,
|
|
3439
|
+
children: inner
|
|
3440
|
+
}
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3443
|
+
);
|
|
3444
|
+
NavItem.displayName = "NavItem";
|
|
3445
|
+
var NavSection = forwardRef47(function NavSection2({
|
|
3446
|
+
label,
|
|
3447
|
+
icon,
|
|
3448
|
+
action,
|
|
3449
|
+
collapsible = false,
|
|
3450
|
+
defaultOpen = true,
|
|
3451
|
+
open,
|
|
3452
|
+
onOpenChange,
|
|
3453
|
+
indent = 0,
|
|
3454
|
+
className,
|
|
3455
|
+
children,
|
|
3456
|
+
...props
|
|
3457
|
+
}, ref) {
|
|
3458
|
+
const isControlled = open !== void 0;
|
|
3459
|
+
const [internalOpen, setInternalOpen] = useState12(defaultOpen);
|
|
3460
|
+
const isOpen = !collapsible || (isControlled ? open : internalOpen);
|
|
3461
|
+
const toggle = useCallback8(() => {
|
|
3462
|
+
const next = !isOpen;
|
|
3463
|
+
if (!isControlled) setInternalOpen(next);
|
|
3464
|
+
onOpenChange?.(next);
|
|
3465
|
+
}, [isOpen, isControlled, onOpenChange]);
|
|
3466
|
+
const eyebrowClass = "text-text-dim flex items-center gap-[6px] px-2 pt-2 font-mono text-[9px] tracking-[1.4px] uppercase";
|
|
3467
|
+
return /* @__PURE__ */ jsxs41("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
|
|
3468
|
+
collapsible ? /* @__PURE__ */ jsxs41(
|
|
3469
|
+
"button",
|
|
3470
|
+
{
|
|
3471
|
+
type: "button",
|
|
3472
|
+
"aria-expanded": isOpen,
|
|
3473
|
+
onClick: toggle,
|
|
3474
|
+
className: cn(
|
|
3475
|
+
eyebrowClass,
|
|
3476
|
+
"cursor-pointer rounded-xs outline-none",
|
|
3477
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3478
|
+
"hover:text-text-muted"
|
|
3479
|
+
),
|
|
3480
|
+
children: [
|
|
3481
|
+
icon != null && /* @__PURE__ */ jsx49("span", { "aria-hidden": true, className: "opacity-80", children: icon }),
|
|
3482
|
+
/* @__PURE__ */ jsx49("span", { className: "flex-1 text-left", children: label }),
|
|
3483
|
+
action,
|
|
3484
|
+
/* @__PURE__ */ jsx49("span", { "aria-hidden": true, className: "text-[10px] opacity-70", children: isOpen ? "\u25BE" : "\u25B8" })
|
|
3485
|
+
]
|
|
3486
|
+
}
|
|
3487
|
+
) : /* @__PURE__ */ jsxs41("div", { className: eyebrowClass, children: [
|
|
3488
|
+
icon != null && /* @__PURE__ */ jsx49("span", { "aria-hidden": true, className: "opacity-80", children: icon }),
|
|
3489
|
+
/* @__PURE__ */ jsx49("span", { className: "flex-1", children: label }),
|
|
3490
|
+
action
|
|
3491
|
+
] }),
|
|
3492
|
+
isOpen && /* @__PURE__ */ jsx49(
|
|
3493
|
+
"div",
|
|
3494
|
+
{
|
|
3495
|
+
className: cn("flex flex-col gap-[2px]", indent > 0 && "border-border ml-2 border-l"),
|
|
3496
|
+
style: indent > 0 ? { paddingLeft: indent } : void 0,
|
|
3497
|
+
children
|
|
3498
|
+
}
|
|
3499
|
+
)
|
|
3500
|
+
] });
|
|
3501
|
+
});
|
|
3502
|
+
NavSection.displayName = "NavSection";
|
|
3503
|
+
|
|
3504
|
+
// src/patterns/NavBar/NavBar.tsx
|
|
3505
|
+
import { Fragment as Fragment3, jsx as jsx50, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3506
|
+
function isActiveTree(item, activeId) {
|
|
3507
|
+
if (item.id === activeId) return true;
|
|
3508
|
+
return item.children?.some((c) => isActiveTree(c, activeId)) ?? false;
|
|
3509
|
+
}
|
|
3510
|
+
var NavBar = forwardRef48(function NavBar2({
|
|
3511
|
+
orientation = "horizontal",
|
|
3512
|
+
items,
|
|
3513
|
+
brand,
|
|
3514
|
+
actions,
|
|
3515
|
+
value,
|
|
3516
|
+
defaultValue,
|
|
3517
|
+
onValueChange,
|
|
3518
|
+
width = 240,
|
|
3519
|
+
responsive = true,
|
|
3520
|
+
className,
|
|
3521
|
+
...props
|
|
3522
|
+
}, ref) {
|
|
3523
|
+
const isControlled = value !== void 0;
|
|
3524
|
+
const [internalValue, setInternalValue] = useState13(defaultValue);
|
|
3525
|
+
const activeId = isControlled ? value : internalValue;
|
|
3526
|
+
const [drawerOpen, setDrawerOpen] = useState13(false);
|
|
3527
|
+
const select = useCallback9(
|
|
3528
|
+
(id) => {
|
|
3529
|
+
if (!isControlled) setInternalValue(id);
|
|
3530
|
+
onValueChange?.(id);
|
|
3531
|
+
},
|
|
3532
|
+
[isControlled, onValueChange]
|
|
3533
|
+
);
|
|
3534
|
+
const handleItemActivate = useCallback9(
|
|
3535
|
+
(id) => {
|
|
3536
|
+
select(id);
|
|
3537
|
+
setDrawerOpen(false);
|
|
3538
|
+
},
|
|
3539
|
+
[select]
|
|
3540
|
+
);
|
|
3541
|
+
const drawerBody = (
|
|
3542
|
+
// Distinct aria-label from the desktop <aside>'s <nav> below — when the
|
|
3543
|
+
// drawer is open on a viewport that's resizing past `md`, both navs can
|
|
3544
|
+
// sit in the DOM together. Identical accessible names would trip axe's
|
|
3545
|
+
// `landmark-unique` rule.
|
|
3546
|
+
/* @__PURE__ */ jsx50("nav", { "aria-label": "Mobile navigation", className: "flex flex-col gap-1", children: items.map((item) => /* @__PURE__ */ jsx50(
|
|
3547
|
+
VerticalItem,
|
|
3548
|
+
{
|
|
3549
|
+
item,
|
|
3550
|
+
activeId,
|
|
3551
|
+
onActivate: handleItemActivate
|
|
3552
|
+
},
|
|
3553
|
+
item.id
|
|
3554
|
+
)) })
|
|
3555
|
+
);
|
|
3556
|
+
const mobileBar = responsive ? /* @__PURE__ */ jsxs42(
|
|
3557
|
+
"div",
|
|
3558
|
+
{
|
|
3559
|
+
className: cn(
|
|
3560
|
+
"border-border bg-panel z-overlay sticky top-0 flex h-[52px] items-center gap-4 border-b px-5 md:hidden"
|
|
3561
|
+
),
|
|
3562
|
+
children: [
|
|
3563
|
+
/* @__PURE__ */ jsx50(
|
|
3564
|
+
"button",
|
|
3565
|
+
{
|
|
3566
|
+
type: "button",
|
|
3567
|
+
onClick: () => setDrawerOpen(true),
|
|
3568
|
+
"aria-label": "Open navigation",
|
|
3569
|
+
className: "text-text-muted hover:text-text focus-visible:ring-accent-dim rounded-xs px-2 py-1 text-[18px] outline-none focus-visible:ring-[3px]",
|
|
3570
|
+
children: "\u2630"
|
|
3571
|
+
}
|
|
3572
|
+
),
|
|
3573
|
+
brand && /* @__PURE__ */ jsx50("div", { className: "flex flex-1 items-center text-[13px] font-medium whitespace-nowrap", children: brand }),
|
|
3574
|
+
actions && /* @__PURE__ */ jsx50("div", { className: "flex items-center gap-3", children: actions })
|
|
3575
|
+
]
|
|
3576
|
+
}
|
|
3577
|
+
) : null;
|
|
3578
|
+
if (orientation === "horizontal") {
|
|
3579
|
+
return /* @__PURE__ */ jsxs42(Fragment3, { children: [
|
|
3580
|
+
mobileBar,
|
|
3581
|
+
/* @__PURE__ */ jsxs42(
|
|
3582
|
+
"header",
|
|
3583
|
+
{
|
|
3584
|
+
ref,
|
|
3585
|
+
className: cn(
|
|
3586
|
+
"border-border bg-panel flex h-[52px] items-center gap-4 border-b px-5",
|
|
3587
|
+
responsive && "hidden md:flex",
|
|
3588
|
+
className
|
|
3589
|
+
),
|
|
3590
|
+
...props,
|
|
3591
|
+
children: [
|
|
3592
|
+
brand && /* @__PURE__ */ jsx50("div", { className: "shrink-0 text-[13px] font-medium whitespace-nowrap", children: brand }),
|
|
3593
|
+
/* @__PURE__ */ jsxs42(RadixNav.Root, { className: "relative flex-1", delayDuration: 120, children: [
|
|
3594
|
+
/* @__PURE__ */ jsx50(RadixNav.List, { className: "m-0! flex list-none! items-center gap-1 p-0! [&_li]:m-0!", children: items.map(
|
|
3595
|
+
(item) => item.children?.length ? /* @__PURE__ */ jsx50(
|
|
3596
|
+
HorizontalDropdown,
|
|
3597
|
+
{
|
|
3598
|
+
item,
|
|
3599
|
+
active: isActiveTree(item, activeId),
|
|
3600
|
+
activeId,
|
|
3601
|
+
onActivate: handleItemActivate
|
|
3602
|
+
},
|
|
3603
|
+
item.id
|
|
3604
|
+
) : /* @__PURE__ */ jsx50(RadixNav.Item, { children: /* @__PURE__ */ jsx50(
|
|
3605
|
+
HorizontalLink,
|
|
3606
|
+
{
|
|
3607
|
+
item,
|
|
3608
|
+
active: item.id === activeId,
|
|
3609
|
+
onActivate: handleItemActivate
|
|
3610
|
+
}
|
|
3611
|
+
) }, item.id)
|
|
3612
|
+
) }),
|
|
3613
|
+
/* @__PURE__ */ jsx50("div", { className: "z-popover absolute top-full left-0 flex justify-start", children: /* @__PURE__ */ jsx50(RadixNav.Viewport, { className: "origin-top-left data-[state=open]:animate-[ship-fade-in_120ms_var(--easing-out)]" }) })
|
|
3614
|
+
] }),
|
|
3615
|
+
actions && /* @__PURE__ */ jsx50("div", { className: "flex items-center gap-3", children: actions })
|
|
3616
|
+
]
|
|
3617
|
+
}
|
|
3618
|
+
),
|
|
3619
|
+
responsive && /* @__PURE__ */ jsx50(
|
|
3620
|
+
Drawer,
|
|
3621
|
+
{
|
|
3622
|
+
open: drawerOpen,
|
|
3623
|
+
onOpenChange: setDrawerOpen,
|
|
3624
|
+
side: "left",
|
|
3625
|
+
title: brand ?? "Navigation",
|
|
3626
|
+
width: 300,
|
|
3627
|
+
children: drawerBody
|
|
3628
|
+
}
|
|
3629
|
+
)
|
|
3630
|
+
] });
|
|
3631
|
+
}
|
|
3632
|
+
return /* @__PURE__ */ jsxs42(Fragment3, { children: [
|
|
3633
|
+
mobileBar,
|
|
3634
|
+
/* @__PURE__ */ jsxs42(
|
|
3635
|
+
"aside",
|
|
3636
|
+
{
|
|
3637
|
+
ref,
|
|
3638
|
+
"aria-label": "Primary navigation",
|
|
3639
|
+
style: { width },
|
|
3640
|
+
className: cn(
|
|
3641
|
+
"border-border bg-panel flex h-full flex-col gap-2 border-r p-[14px]",
|
|
3642
|
+
responsive && "hidden md:flex",
|
|
3643
|
+
className
|
|
3644
|
+
),
|
|
3645
|
+
...props,
|
|
3646
|
+
children: [
|
|
3647
|
+
brand && /* @__PURE__ */ jsx50("div", { className: "px-2 py-1 text-[13px] font-medium", children: brand }),
|
|
3648
|
+
/* @__PURE__ */ jsx50("nav", { "aria-label": "Sidebar navigation", className: "flex flex-1 flex-col gap-1 overflow-y-auto", children: items.map((item) => /* @__PURE__ */ jsx50(
|
|
3649
|
+
VerticalItem,
|
|
3650
|
+
{
|
|
3651
|
+
item,
|
|
3652
|
+
activeId,
|
|
3653
|
+
onActivate: handleItemActivate
|
|
3654
|
+
},
|
|
3655
|
+
item.id
|
|
3656
|
+
)) }),
|
|
3657
|
+
actions && /* @__PURE__ */ jsx50("div", { className: "border-border mt-auto flex flex-col gap-2 border-t pt-3", children: actions })
|
|
3658
|
+
]
|
|
3659
|
+
}
|
|
3660
|
+
),
|
|
3661
|
+
responsive && /* @__PURE__ */ jsx50(
|
|
3662
|
+
Drawer,
|
|
3663
|
+
{
|
|
3664
|
+
open: drawerOpen,
|
|
3665
|
+
onOpenChange: setDrawerOpen,
|
|
3666
|
+
side: "left",
|
|
3667
|
+
title: brand ?? "Navigation",
|
|
3668
|
+
width: 300,
|
|
3669
|
+
children: drawerBody
|
|
3670
|
+
}
|
|
3671
|
+
)
|
|
3672
|
+
] });
|
|
3673
|
+
});
|
|
3674
|
+
NavBar.displayName = "NavBar";
|
|
3675
|
+
function HorizontalLink({ item, active, onActivate }) {
|
|
3676
|
+
const baseClass = cn(
|
|
3677
|
+
"flex items-center gap-[6px] rounded-xs px-3 py-[6px] text-[13px] outline-none",
|
|
3678
|
+
"transition-colors duration-(--duration-micro)",
|
|
3679
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3680
|
+
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3681
|
+
item.disabled && "pointer-events-none opacity-50"
|
|
3682
|
+
);
|
|
3683
|
+
const handleClick = (e) => {
|
|
3684
|
+
if (item.disabled) {
|
|
3685
|
+
e.preventDefault();
|
|
3686
|
+
return;
|
|
3687
|
+
}
|
|
3688
|
+
onActivate(item.id);
|
|
3689
|
+
};
|
|
3690
|
+
const inner = /* @__PURE__ */ jsxs42(Fragment3, { children: [
|
|
3691
|
+
item.icon != null && /* @__PURE__ */ jsx50("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
3692
|
+
/* @__PURE__ */ jsx50("span", { children: item.label }),
|
|
3693
|
+
item.badge != null && /* @__PURE__ */ jsx50(ItemBadge, { active, children: item.badge })
|
|
3694
|
+
] });
|
|
3695
|
+
if (item.href) {
|
|
3696
|
+
return /* @__PURE__ */ jsx50(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ jsx50(
|
|
3697
|
+
"a",
|
|
3698
|
+
{
|
|
3699
|
+
href: item.href,
|
|
3700
|
+
"aria-current": active ? "page" : void 0,
|
|
3701
|
+
"aria-disabled": item.disabled || void 0,
|
|
3702
|
+
className: baseClass,
|
|
3703
|
+
onClick: handleClick,
|
|
3704
|
+
children: inner
|
|
3705
|
+
}
|
|
3706
|
+
) });
|
|
3707
|
+
}
|
|
3708
|
+
return /* @__PURE__ */ jsx50(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ jsx50(
|
|
3709
|
+
"button",
|
|
3710
|
+
{
|
|
3711
|
+
type: "button",
|
|
3712
|
+
"aria-current": active ? "page" : void 0,
|
|
3713
|
+
disabled: item.disabled,
|
|
3714
|
+
className: baseClass,
|
|
3715
|
+
onClick: handleClick,
|
|
3716
|
+
children: inner
|
|
3717
|
+
}
|
|
3718
|
+
) });
|
|
3719
|
+
}
|
|
3720
|
+
function HorizontalDropdown({ item, active, activeId, onActivate }) {
|
|
3721
|
+
return /* @__PURE__ */ jsxs42(RadixNav.Item, { children: [
|
|
3722
|
+
/* @__PURE__ */ jsxs42(
|
|
3723
|
+
RadixNav.Trigger,
|
|
3724
|
+
{
|
|
3725
|
+
className: cn(
|
|
3726
|
+
"group flex items-center gap-1 rounded-xs px-3 py-[6px] text-[13px] outline-none",
|
|
3727
|
+
"transition-colors duration-(--duration-micro)",
|
|
3728
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3729
|
+
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3730
|
+
"data-[state=open]:bg-panel-2"
|
|
3731
|
+
),
|
|
3732
|
+
disabled: item.disabled,
|
|
3733
|
+
children: [
|
|
3734
|
+
item.icon != null && /* @__PURE__ */ jsx50("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
3735
|
+
/* @__PURE__ */ jsx50("span", { children: item.label }),
|
|
3736
|
+
/* @__PURE__ */ jsx50(
|
|
3737
|
+
"span",
|
|
3738
|
+
{
|
|
3739
|
+
"aria-hidden": true,
|
|
3740
|
+
className: "ml-1 text-[10px] opacity-70 transition-transform group-data-[state=open]:rotate-180",
|
|
3741
|
+
children: "\u25BE"
|
|
3742
|
+
}
|
|
3743
|
+
)
|
|
3744
|
+
]
|
|
3745
|
+
}
|
|
3746
|
+
),
|
|
3747
|
+
/* @__PURE__ */ jsx50(RadixNav.Content, { className: "border-border bg-panel min-w-[220px] rounded-xs border p-2 shadow-lg", children: /* @__PURE__ */ jsx50("ul", { className: "m-0! flex list-none! flex-col gap-[2px] p-0! [&_li]:m-0!", children: item.children.map((child) => /* @__PURE__ */ jsx50("li", { children: /* @__PURE__ */ jsx50(DropdownLink, { item: child, active: child.id === activeId, onActivate }) }, child.id)) }) })
|
|
3748
|
+
] });
|
|
3749
|
+
}
|
|
3750
|
+
function DropdownLink({ item, active, onActivate }) {
|
|
3751
|
+
const baseClass = cn(
|
|
3752
|
+
"flex w-full items-center gap-2 rounded-xs px-2 py-[6px] text-left text-[13px] outline-none",
|
|
3753
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3754
|
+
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3755
|
+
item.disabled && "pointer-events-none opacity-50"
|
|
3756
|
+
);
|
|
3757
|
+
const handleClick = (e) => {
|
|
3758
|
+
if (item.disabled) {
|
|
3759
|
+
e.preventDefault();
|
|
3760
|
+
return;
|
|
3761
|
+
}
|
|
3762
|
+
onActivate(item.id);
|
|
3763
|
+
};
|
|
3764
|
+
const inner = /* @__PURE__ */ jsxs42(Fragment3, { children: [
|
|
3765
|
+
item.icon != null && /* @__PURE__ */ jsx50("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
3766
|
+
/* @__PURE__ */ jsx50("span", { className: "flex-1", children: item.label }),
|
|
3767
|
+
item.badge != null && /* @__PURE__ */ jsx50(ItemBadge, { active, children: item.badge })
|
|
3768
|
+
] });
|
|
3769
|
+
if (item.href) {
|
|
3770
|
+
return /* @__PURE__ */ jsx50(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ jsx50(
|
|
3771
|
+
"a",
|
|
3772
|
+
{
|
|
3773
|
+
href: item.href,
|
|
3774
|
+
"aria-current": active ? "page" : void 0,
|
|
3775
|
+
"aria-disabled": item.disabled || void 0,
|
|
3776
|
+
className: baseClass,
|
|
3777
|
+
onClick: handleClick,
|
|
3778
|
+
children: inner
|
|
3779
|
+
}
|
|
3780
|
+
) });
|
|
3781
|
+
}
|
|
3782
|
+
return /* @__PURE__ */ jsx50(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ jsx50(
|
|
3783
|
+
"button",
|
|
3784
|
+
{
|
|
3785
|
+
type: "button",
|
|
3786
|
+
"aria-current": active ? "page" : void 0,
|
|
3787
|
+
disabled: item.disabled,
|
|
3788
|
+
className: baseClass,
|
|
3789
|
+
onClick: handleClick,
|
|
3790
|
+
children: inner
|
|
3791
|
+
}
|
|
3792
|
+
) });
|
|
3793
|
+
}
|
|
3794
|
+
function VerticalItem({ item, activeId, onActivate }) {
|
|
3795
|
+
const hasChildren = (item.children?.length ?? 0) > 0;
|
|
3796
|
+
const treeActive = isActiveTree(item, activeId);
|
|
3797
|
+
const [open, setOpen] = useState13(treeActive);
|
|
3798
|
+
const prevTreeActive = useRef7(treeActive);
|
|
3799
|
+
useEffect9(() => {
|
|
3800
|
+
if (treeActive && !prevTreeActive.current) setOpen(true);
|
|
3801
|
+
prevTreeActive.current = treeActive;
|
|
3802
|
+
}, [treeActive]);
|
|
3803
|
+
if (!hasChildren) {
|
|
3804
|
+
const handleClick = (e) => {
|
|
3805
|
+
if (item.disabled) {
|
|
3806
|
+
e.preventDefault();
|
|
3807
|
+
return;
|
|
3808
|
+
}
|
|
3809
|
+
onActivate(item.id);
|
|
3810
|
+
};
|
|
3811
|
+
return /* @__PURE__ */ jsx50(
|
|
3812
|
+
NavItem,
|
|
3813
|
+
{
|
|
3814
|
+
icon: item.icon,
|
|
3815
|
+
label: item.label,
|
|
3816
|
+
active: item.id === activeId,
|
|
3817
|
+
badge: item.badge,
|
|
3818
|
+
disabled: item.disabled,
|
|
3819
|
+
href: item.href,
|
|
3820
|
+
onClick: handleClick
|
|
3821
|
+
}
|
|
3822
|
+
);
|
|
3823
|
+
}
|
|
3824
|
+
return /* @__PURE__ */ jsxs42("div", { className: "flex flex-col", children: [
|
|
3825
|
+
/* @__PURE__ */ jsxs42(
|
|
3826
|
+
"button",
|
|
3827
|
+
{
|
|
3828
|
+
type: "button",
|
|
3829
|
+
"aria-expanded": open,
|
|
3830
|
+
onClick: () => setOpen((o) => !o),
|
|
3831
|
+
disabled: item.disabled,
|
|
3832
|
+
className: cn(
|
|
3833
|
+
"flex w-full items-center gap-[10px] rounded-xs px-2 py-[6px] text-left text-[13px] outline-none",
|
|
3834
|
+
"transition-colors duration-(--duration-micro)",
|
|
3835
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3836
|
+
treeActive ? "text-text" : "text-text-muted",
|
|
3837
|
+
"hover:bg-panel-2",
|
|
3838
|
+
item.disabled && "pointer-events-none opacity-50"
|
|
3839
|
+
),
|
|
3840
|
+
children: [
|
|
3841
|
+
item.icon != null && /* @__PURE__ */ jsx50("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: item.icon }),
|
|
3842
|
+
/* @__PURE__ */ jsx50("span", { className: "flex-1 truncate", children: item.label }),
|
|
3843
|
+
item.badge != null && /* @__PURE__ */ jsx50(ItemBadge, { active: treeActive, children: item.badge }),
|
|
3844
|
+
/* @__PURE__ */ jsx50("span", { "aria-hidden": true, className: "text-[10px] opacity-60", children: open ? "\u25BE" : "\u25B8" })
|
|
3845
|
+
]
|
|
3846
|
+
}
|
|
3847
|
+
),
|
|
3848
|
+
open && /* @__PURE__ */ jsx50("div", { className: "border-border mt-1 ml-[18px] flex flex-col gap-[2px] border-l pl-3", children: item.children.map((child) => /* @__PURE__ */ jsx50(VerticalItem, { item: child, activeId, onActivate }, child.id)) })
|
|
3849
|
+
] });
|
|
3850
|
+
}
|
|
3851
|
+
function ItemBadge({ active, children }) {
|
|
3852
|
+
return /* @__PURE__ */ jsx50(
|
|
3853
|
+
"span",
|
|
3854
|
+
{
|
|
3855
|
+
className: cn(
|
|
3856
|
+
"rounded-xs px-[6px] py-px font-mono text-[10px]",
|
|
3857
|
+
active ? "bg-accent text-on-accent" : "bg-panel-2 text-text-muted"
|
|
3858
|
+
),
|
|
3859
|
+
children
|
|
3860
|
+
}
|
|
3861
|
+
);
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3259
3864
|
// src/patterns/Pagination/Pagination.tsx
|
|
3260
|
-
import { forwardRef as
|
|
3261
|
-
import { jsx as
|
|
3865
|
+
import { forwardRef as forwardRef49 } from "react";
|
|
3866
|
+
import { jsx as jsx51, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3262
3867
|
function buildRange(page, total, siblings) {
|
|
3263
3868
|
if (total <= 0) return [];
|
|
3264
3869
|
const items = [];
|
|
@@ -3271,9 +3876,9 @@ function buildRange(page, total, siblings) {
|
|
|
3271
3876
|
if (total > 1) items.push(total);
|
|
3272
3877
|
return items;
|
|
3273
3878
|
}
|
|
3274
|
-
var Pagination =
|
|
3879
|
+
var Pagination = forwardRef49(function Pagination2({ page, total, onPageChange, siblings = 1, className, ...props }, ref) {
|
|
3275
3880
|
const items = buildRange(page, total, siblings);
|
|
3276
|
-
return /* @__PURE__ */
|
|
3881
|
+
return /* @__PURE__ */ jsxs43(
|
|
3277
3882
|
"nav",
|
|
3278
3883
|
{
|
|
3279
3884
|
ref,
|
|
@@ -3281,7 +3886,7 @@ var Pagination = forwardRef46(function Pagination2({ page, total, onPageChange,
|
|
|
3281
3886
|
className: cn("inline-flex items-center gap-1", className),
|
|
3282
3887
|
...props,
|
|
3283
3888
|
children: [
|
|
3284
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx51(
|
|
3285
3890
|
IconButton,
|
|
3286
3891
|
{
|
|
3287
3892
|
size: "sm",
|
|
@@ -3294,7 +3899,7 @@ var Pagination = forwardRef46(function Pagination2({ page, total, onPageChange,
|
|
|
3294
3899
|
),
|
|
3295
3900
|
items.map((item, i) => {
|
|
3296
3901
|
if (item === "start-ellipsis" || item === "end-ellipsis") {
|
|
3297
|
-
return /* @__PURE__ */
|
|
3902
|
+
return /* @__PURE__ */ jsx51(
|
|
3298
3903
|
"span",
|
|
3299
3904
|
{
|
|
3300
3905
|
"aria-hidden": true,
|
|
@@ -3305,7 +3910,7 @@ var Pagination = forwardRef46(function Pagination2({ page, total, onPageChange,
|
|
|
3305
3910
|
);
|
|
3306
3911
|
}
|
|
3307
3912
|
const isActive = item === page;
|
|
3308
|
-
return /* @__PURE__ */
|
|
3913
|
+
return /* @__PURE__ */ jsx51(
|
|
3309
3914
|
"button",
|
|
3310
3915
|
{
|
|
3311
3916
|
type: "button",
|
|
@@ -3323,7 +3928,7 @@ var Pagination = forwardRef46(function Pagination2({ page, total, onPageChange,
|
|
|
3323
3928
|
item
|
|
3324
3929
|
);
|
|
3325
3930
|
}),
|
|
3326
|
-
/* @__PURE__ */
|
|
3931
|
+
/* @__PURE__ */ jsx51(
|
|
3327
3932
|
IconButton,
|
|
3328
3933
|
{
|
|
3329
3934
|
size: "sm",
|
|
@@ -3342,8 +3947,8 @@ Pagination.displayName = "Pagination";
|
|
|
3342
3947
|
|
|
3343
3948
|
// src/patterns/Progress/Progress.tsx
|
|
3344
3949
|
import { cva as cva11 } from "class-variance-authority";
|
|
3345
|
-
import { forwardRef as
|
|
3346
|
-
import { jsx as
|
|
3950
|
+
import { forwardRef as forwardRef50 } from "react";
|
|
3951
|
+
import { jsx as jsx52, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
3347
3952
|
var trackStyles = cva11("w-full rounded-full bg-panel-2 overflow-hidden", {
|
|
3348
3953
|
variants: {
|
|
3349
3954
|
size: {
|
|
@@ -3365,7 +3970,7 @@ var fillStyles = cva11("h-full rounded-full transition-[width] duration-(--durat
|
|
|
3365
3970
|
},
|
|
3366
3971
|
defaultVariants: { tone: "accent" }
|
|
3367
3972
|
});
|
|
3368
|
-
var Progress =
|
|
3973
|
+
var Progress = forwardRef50(function Progress2({
|
|
3369
3974
|
value = 0,
|
|
3370
3975
|
max = 100,
|
|
3371
3976
|
indeterminate = false,
|
|
@@ -3379,15 +3984,15 @@ var Progress = forwardRef47(function Progress2({
|
|
|
3379
3984
|
const clamped = Math.min(max, Math.max(0, value));
|
|
3380
3985
|
const pct = max > 0 ? clamped / max * 100 : 0;
|
|
3381
3986
|
const display = Math.round(pct);
|
|
3382
|
-
return /* @__PURE__ */
|
|
3383
|
-
label != null && /* @__PURE__ */
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
showValue && !indeterminate && /* @__PURE__ */
|
|
3987
|
+
return /* @__PURE__ */ jsxs44("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3988
|
+
label != null && /* @__PURE__ */ jsxs44("div", { className: "flex text-[12px]", children: [
|
|
3989
|
+
/* @__PURE__ */ jsx52("span", { className: "text-text-muted", children: label }),
|
|
3990
|
+
showValue && !indeterminate && /* @__PURE__ */ jsxs44("span", { className: "text-text ml-auto font-mono tabular-nums", children: [
|
|
3386
3991
|
display,
|
|
3387
3992
|
"%"
|
|
3388
3993
|
] })
|
|
3389
3994
|
] }),
|
|
3390
|
-
/* @__PURE__ */
|
|
3995
|
+
/* @__PURE__ */ jsx52(
|
|
3391
3996
|
"div",
|
|
3392
3997
|
{
|
|
3393
3998
|
role: "progressbar",
|
|
@@ -3396,7 +4001,7 @@ var Progress = forwardRef47(function Progress2({
|
|
|
3396
4001
|
"aria-valuenow": indeterminate ? void 0 : display,
|
|
3397
4002
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
3398
4003
|
className: trackStyles({ size }),
|
|
3399
|
-
children: indeterminate ? /* @__PURE__ */
|
|
4004
|
+
children: indeterminate ? /* @__PURE__ */ jsx52(
|
|
3400
4005
|
"span",
|
|
3401
4006
|
{
|
|
3402
4007
|
"aria-hidden": true,
|
|
@@ -3406,7 +4011,7 @@ var Progress = forwardRef47(function Progress2({
|
|
|
3406
4011
|
"animate-[ship-indeterminate_1.4s_linear_infinite]"
|
|
3407
4012
|
)
|
|
3408
4013
|
}
|
|
3409
|
-
) : /* @__PURE__ */
|
|
4014
|
+
) : /* @__PURE__ */ jsx52("span", { "aria-hidden": true, className: fillStyles({ tone }), style: { width: `${pct}%` } })
|
|
3410
4015
|
}
|
|
3411
4016
|
)
|
|
3412
4017
|
] });
|
|
@@ -3414,15 +4019,15 @@ var Progress = forwardRef47(function Progress2({
|
|
|
3414
4019
|
Progress.displayName = "Progress";
|
|
3415
4020
|
|
|
3416
4021
|
// src/patterns/RadialProgress/RadialProgress.tsx
|
|
3417
|
-
import { forwardRef as
|
|
3418
|
-
import { jsx as
|
|
4022
|
+
import { forwardRef as forwardRef51 } from "react";
|
|
4023
|
+
import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
3419
4024
|
var toneStrokeClass = {
|
|
3420
4025
|
accent: "stroke-accent",
|
|
3421
4026
|
ok: "stroke-ok",
|
|
3422
4027
|
warn: "stroke-warn",
|
|
3423
4028
|
err: "stroke-err"
|
|
3424
4029
|
};
|
|
3425
|
-
var RadialProgress =
|
|
4030
|
+
var RadialProgress = forwardRef51(
|
|
3426
4031
|
function RadialProgress2({
|
|
3427
4032
|
value,
|
|
3428
4033
|
max = 100,
|
|
@@ -3440,7 +4045,7 @@ var RadialProgress = forwardRef48(
|
|
|
3440
4045
|
const c = 2 * Math.PI * r;
|
|
3441
4046
|
const dash = pct / 100 * c;
|
|
3442
4047
|
const resolvedTone = tone ?? (clamped >= max ? "ok" : "accent");
|
|
3443
|
-
return /* @__PURE__ */
|
|
4048
|
+
return /* @__PURE__ */ jsxs45(
|
|
3444
4049
|
"div",
|
|
3445
4050
|
{
|
|
3446
4051
|
ref,
|
|
@@ -3453,8 +4058,8 @@ var RadialProgress = forwardRef48(
|
|
|
3453
4058
|
style: { width: size, height: size },
|
|
3454
4059
|
...props,
|
|
3455
4060
|
children: [
|
|
3456
|
-
/* @__PURE__ */
|
|
3457
|
-
/* @__PURE__ */
|
|
4061
|
+
/* @__PURE__ */ jsxs45("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [
|
|
4062
|
+
/* @__PURE__ */ jsx53(
|
|
3458
4063
|
"circle",
|
|
3459
4064
|
{
|
|
3460
4065
|
cx: size / 2,
|
|
@@ -3465,7 +4070,7 @@ var RadialProgress = forwardRef48(
|
|
|
3465
4070
|
className: "stroke-panel-2"
|
|
3466
4071
|
}
|
|
3467
4072
|
),
|
|
3468
|
-
/* @__PURE__ */
|
|
4073
|
+
/* @__PURE__ */ jsx53(
|
|
3469
4074
|
"circle",
|
|
3470
4075
|
{
|
|
3471
4076
|
cx: size / 2,
|
|
@@ -3483,7 +4088,7 @@ var RadialProgress = forwardRef48(
|
|
|
3483
4088
|
}
|
|
3484
4089
|
)
|
|
3485
4090
|
] }),
|
|
3486
|
-
/* @__PURE__ */
|
|
4091
|
+
/* @__PURE__ */ jsx53("div", { className: "absolute inset-0 grid place-items-center font-mono text-[11px] font-medium tabular-nums", children: children ?? `${Math.round(pct)}%` })
|
|
3487
4092
|
]
|
|
3488
4093
|
}
|
|
3489
4094
|
);
|
|
@@ -3491,93 +4096,9 @@ var RadialProgress = forwardRef48(
|
|
|
3491
4096
|
);
|
|
3492
4097
|
RadialProgress.displayName = "RadialProgress";
|
|
3493
4098
|
|
|
3494
|
-
// src/patterns/Sidebar/Sidebar.tsx
|
|
3495
|
-
import { forwardRef as forwardRef49 } from "react";
|
|
3496
|
-
import { Fragment as Fragment2, jsx as jsx51, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3497
|
-
var Sidebar = forwardRef49(function Sidebar2({ width = 240, className, style, ...props }, ref) {
|
|
3498
|
-
return /* @__PURE__ */ jsx51(
|
|
3499
|
-
"aside",
|
|
3500
|
-
{
|
|
3501
|
-
ref,
|
|
3502
|
-
style: { width, ...style },
|
|
3503
|
-
className: cn(
|
|
3504
|
-
"border-border bg-panel flex h-full flex-col gap-2 border-r p-[14px]",
|
|
3505
|
-
className
|
|
3506
|
-
),
|
|
3507
|
-
...props
|
|
3508
|
-
}
|
|
3509
|
-
);
|
|
3510
|
-
});
|
|
3511
|
-
Sidebar.displayName = "Sidebar";
|
|
3512
|
-
var NavItem = forwardRef49(
|
|
3513
|
-
function NavItem2({ icon, label, active, badge, href, disabled, className, ...props }, ref) {
|
|
3514
|
-
const inner = /* @__PURE__ */ jsxs43(Fragment2, { children: [
|
|
3515
|
-
icon && /* @__PURE__ */ jsx51("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: icon }),
|
|
3516
|
-
/* @__PURE__ */ jsx51("span", { className: "flex-1 truncate", children: label }),
|
|
3517
|
-
badge != null && /* @__PURE__ */ jsx51(
|
|
3518
|
-
"span",
|
|
3519
|
-
{
|
|
3520
|
-
className: cn(
|
|
3521
|
-
"rounded-xs px-[6px] py-px font-mono text-[10px]",
|
|
3522
|
-
active ? "bg-accent text-on-accent" : "bg-panel-2 text-text-muted"
|
|
3523
|
-
),
|
|
3524
|
-
children: badge
|
|
3525
|
-
}
|
|
3526
|
-
)
|
|
3527
|
-
] });
|
|
3528
|
-
const baseClass = cn(
|
|
3529
|
-
"flex cursor-pointer items-center gap-[10px] rounded-xs px-2 py-[6px] text-[13px] outline-none",
|
|
3530
|
-
"transition-colors duration-(--duration-micro)",
|
|
3531
|
-
"focus-visible:ring-[3px] focus-visible:ring-accent-dim",
|
|
3532
|
-
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3533
|
-
disabled && "opacity-50 pointer-events-none",
|
|
3534
|
-
className
|
|
3535
|
-
);
|
|
3536
|
-
if (href) {
|
|
3537
|
-
const anchorProps = props;
|
|
3538
|
-
return /* @__PURE__ */ jsx51(
|
|
3539
|
-
"a",
|
|
3540
|
-
{
|
|
3541
|
-
ref,
|
|
3542
|
-
href,
|
|
3543
|
-
"aria-current": active ? "page" : void 0,
|
|
3544
|
-
"aria-disabled": disabled || void 0,
|
|
3545
|
-
className: baseClass,
|
|
3546
|
-
...anchorProps,
|
|
3547
|
-
children: inner
|
|
3548
|
-
}
|
|
3549
|
-
);
|
|
3550
|
-
}
|
|
3551
|
-
const buttonProps = props;
|
|
3552
|
-
return /* @__PURE__ */ jsx51(
|
|
3553
|
-
"button",
|
|
3554
|
-
{
|
|
3555
|
-
ref,
|
|
3556
|
-
type: "button",
|
|
3557
|
-
"aria-current": active ? "page" : void 0,
|
|
3558
|
-
disabled,
|
|
3559
|
-
className: cn(baseClass, "w-full text-left"),
|
|
3560
|
-
...buttonProps,
|
|
3561
|
-
children: inner
|
|
3562
|
-
}
|
|
3563
|
-
);
|
|
3564
|
-
}
|
|
3565
|
-
);
|
|
3566
|
-
NavItem.displayName = "NavItem";
|
|
3567
|
-
var NavSection = forwardRef49(function NavSection2({ label, action, className, children, ...props }, ref) {
|
|
3568
|
-
return /* @__PURE__ */ jsxs43("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
|
|
3569
|
-
/* @__PURE__ */ jsxs43("div", { className: "text-text-dim flex items-center px-2 pt-2 font-mono text-[9px] tracking-[1.4px] uppercase", children: [
|
|
3570
|
-
/* @__PURE__ */ jsx51("span", { className: "flex-1", children: label }),
|
|
3571
|
-
action
|
|
3572
|
-
] }),
|
|
3573
|
-
/* @__PURE__ */ jsx51("div", { className: "flex flex-col gap-[2px]", children })
|
|
3574
|
-
] });
|
|
3575
|
-
});
|
|
3576
|
-
NavSection.displayName = "NavSection";
|
|
3577
|
-
|
|
3578
4099
|
// src/patterns/Sparkline/Sparkline.tsx
|
|
3579
|
-
import { forwardRef as
|
|
3580
|
-
import { jsx as
|
|
4100
|
+
import { forwardRef as forwardRef52, useMemo as useMemo5 } from "react";
|
|
4101
|
+
import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
3581
4102
|
function buildPath(values, w, h) {
|
|
3582
4103
|
if (values.length === 0) return { line: "", area: "" };
|
|
3583
4104
|
const pad = 2;
|
|
@@ -3596,7 +4117,7 @@ function buildPath(values, w, h) {
|
|
|
3596
4117
|
)} L${pad.toFixed(2)},${(h - pad).toFixed(2)} Z`;
|
|
3597
4118
|
return { line, area };
|
|
3598
4119
|
}
|
|
3599
|
-
var Sparkline =
|
|
4120
|
+
var Sparkline = forwardRef52(function Sparkline2({
|
|
3600
4121
|
values,
|
|
3601
4122
|
width = 160,
|
|
3602
4123
|
height = 32,
|
|
@@ -3608,7 +4129,7 @@ var Sparkline = forwardRef50(function Sparkline2({
|
|
|
3608
4129
|
...props
|
|
3609
4130
|
}, ref) {
|
|
3610
4131
|
const { line, area } = useMemo5(() => buildPath(values, width, height), [values, width, height]);
|
|
3611
|
-
return /* @__PURE__ */
|
|
4132
|
+
return /* @__PURE__ */ jsxs46(
|
|
3612
4133
|
"svg",
|
|
3613
4134
|
{
|
|
3614
4135
|
ref,
|
|
@@ -3620,8 +4141,8 @@ var Sparkline = forwardRef50(function Sparkline2({
|
|
|
3620
4141
|
className: cn("inline-block", className),
|
|
3621
4142
|
...props,
|
|
3622
4143
|
children: [
|
|
3623
|
-
fill && /* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
4144
|
+
fill && /* @__PURE__ */ jsx54("path", { d: area, fill: stroke, fillOpacity: 0.16, stroke: "none" }),
|
|
4145
|
+
/* @__PURE__ */ jsx54(
|
|
3625
4146
|
"path",
|
|
3626
4147
|
{
|
|
3627
4148
|
d: line,
|
|
@@ -3639,16 +4160,16 @@ var Sparkline = forwardRef50(function Sparkline2({
|
|
|
3639
4160
|
Sparkline.displayName = "Sparkline";
|
|
3640
4161
|
|
|
3641
4162
|
// src/patterns/Spinner/Spinner.tsx
|
|
3642
|
-
import { forwardRef as
|
|
3643
|
-
import { jsx as
|
|
4163
|
+
import { forwardRef as forwardRef53 } from "react";
|
|
4164
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
3644
4165
|
var sizes = {
|
|
3645
4166
|
sm: { box: "h-3 w-3", border: "border-[2px]" },
|
|
3646
4167
|
md: { box: "h-4 w-4", border: "border-[2px]" },
|
|
3647
4168
|
lg: { box: "h-5 w-5", border: "border-[2px]" }
|
|
3648
4169
|
};
|
|
3649
|
-
var Spinner2 =
|
|
4170
|
+
var Spinner2 = forwardRef53(function Spinner3({ size = "md", label = "Loading", className, ...props }, ref) {
|
|
3650
4171
|
const s = sizes[size];
|
|
3651
|
-
return /* @__PURE__ */
|
|
4172
|
+
return /* @__PURE__ */ jsx55(
|
|
3652
4173
|
"span",
|
|
3653
4174
|
{
|
|
3654
4175
|
ref,
|
|
@@ -3656,7 +4177,7 @@ var Spinner2 = forwardRef51(function Spinner3({ size = "md", label = "Loading",
|
|
|
3656
4177
|
"aria-label": label,
|
|
3657
4178
|
className: cn("inline-block", className),
|
|
3658
4179
|
...props,
|
|
3659
|
-
children: /* @__PURE__ */
|
|
4180
|
+
children: /* @__PURE__ */ jsx55(
|
|
3660
4181
|
"span",
|
|
3661
4182
|
{
|
|
3662
4183
|
"aria-hidden": true,
|
|
@@ -3673,8 +4194,8 @@ var Spinner2 = forwardRef51(function Spinner3({ size = "md", label = "Loading",
|
|
|
3673
4194
|
Spinner2.displayName = "Spinner";
|
|
3674
4195
|
|
|
3675
4196
|
// src/patterns/Stepper/Stepper.tsx
|
|
3676
|
-
import { forwardRef as
|
|
3677
|
-
import { jsx as
|
|
4197
|
+
import { forwardRef as forwardRef54, Fragment as Fragment4 } from "react";
|
|
4198
|
+
import { jsx as jsx56, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
3678
4199
|
var dotBase = "h-6 w-6 rounded-full grid place-items-center text-[11px] font-mono font-semibold border";
|
|
3679
4200
|
var dotStateClass = {
|
|
3680
4201
|
done: "bg-accent text-on-accent border-accent",
|
|
@@ -3691,8 +4212,8 @@ function stateFor(index, current) {
|
|
|
3691
4212
|
if (index === current) return "current";
|
|
3692
4213
|
return "upcoming";
|
|
3693
4214
|
}
|
|
3694
|
-
var Stepper =
|
|
3695
|
-
return /* @__PURE__ */
|
|
4215
|
+
var Stepper = forwardRef54(function Stepper2({ steps, current, className, ...props }, ref) {
|
|
4216
|
+
return /* @__PURE__ */ jsx56(
|
|
3696
4217
|
"ol",
|
|
3697
4218
|
{
|
|
3698
4219
|
ref,
|
|
@@ -3704,19 +4225,19 @@ var Stepper = forwardRef52(function Stepper2({ steps, current, className, ...pro
|
|
|
3704
4225
|
const id = typeof step === "string" ? void 0 : step.id;
|
|
3705
4226
|
const state = stateFor(i, current);
|
|
3706
4227
|
const connectorActive = i < current;
|
|
3707
|
-
return /* @__PURE__ */
|
|
3708
|
-
/* @__PURE__ */
|
|
4228
|
+
return /* @__PURE__ */ jsxs47(Fragment4, { children: [
|
|
4229
|
+
/* @__PURE__ */ jsxs47(
|
|
3709
4230
|
"li",
|
|
3710
4231
|
{
|
|
3711
4232
|
"aria-current": state === "current" ? "step" : void 0,
|
|
3712
4233
|
className: "flex items-center gap-2",
|
|
3713
4234
|
children: [
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
4235
|
+
/* @__PURE__ */ jsx56("span", { "aria-hidden": true, className: cn(dotBase, dotStateClass[state]), children: state === "done" ? "\u2713" : i + 1 }),
|
|
4236
|
+
/* @__PURE__ */ jsx56("span", { className: cn("text-[12px]", labelStateClass[state]), children: label })
|
|
3716
4237
|
]
|
|
3717
4238
|
}
|
|
3718
4239
|
),
|
|
3719
|
-
i < steps.length - 1 && /* @__PURE__ */
|
|
4240
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx56(
|
|
3720
4241
|
"span",
|
|
3721
4242
|
{
|
|
3722
4243
|
"aria-hidden": true,
|
|
@@ -3733,8 +4254,8 @@ Stepper.displayName = "Stepper";
|
|
|
3733
4254
|
// src/patterns/Tabs/Tabs.tsx
|
|
3734
4255
|
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
3735
4256
|
import { cva as cva12 } from "class-variance-authority";
|
|
3736
|
-
import { createContext as createContext2, forwardRef as
|
|
3737
|
-
import { jsx as
|
|
4257
|
+
import { createContext as createContext2, forwardRef as forwardRef55, useContext as useContext2 } from "react";
|
|
4258
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3738
4259
|
var TabsVariantContext = createContext2("underline");
|
|
3739
4260
|
var tabsListStyles = cva12("", {
|
|
3740
4261
|
variants: {
|
|
@@ -3765,8 +4286,8 @@ var tabsTriggerStyles = cva12(
|
|
|
3765
4286
|
}
|
|
3766
4287
|
}
|
|
3767
4288
|
);
|
|
3768
|
-
var Tabs =
|
|
3769
|
-
return /* @__PURE__ */
|
|
4289
|
+
var Tabs = forwardRef55(function Tabs2({ variant = "underline", className, ...props }, ref) {
|
|
4290
|
+
return /* @__PURE__ */ jsx57(TabsVariantContext.Provider, { value: variant, children: /* @__PURE__ */ jsx57(
|
|
3770
4291
|
RadixTabs.Root,
|
|
3771
4292
|
{
|
|
3772
4293
|
ref,
|
|
@@ -3776,14 +4297,14 @@ var Tabs = forwardRef53(function Tabs2({ variant = "underline", className, ...pr
|
|
|
3776
4297
|
) });
|
|
3777
4298
|
});
|
|
3778
4299
|
Tabs.displayName = "Tabs";
|
|
3779
|
-
var TabsList =
|
|
4300
|
+
var TabsList = forwardRef55(function TabsList2({ className, ...props }, ref) {
|
|
3780
4301
|
const variant = useContext2(TabsVariantContext);
|
|
3781
|
-
return /* @__PURE__ */
|
|
4302
|
+
return /* @__PURE__ */ jsx57(RadixTabs.List, { ref, className: cn(tabsListStyles({ variant }), className), ...props });
|
|
3782
4303
|
});
|
|
3783
4304
|
TabsList.displayName = "TabsList";
|
|
3784
|
-
var Tab =
|
|
4305
|
+
var Tab = forwardRef55(function Tab2({ className, ...props }, ref) {
|
|
3785
4306
|
const variant = useContext2(TabsVariantContext);
|
|
3786
|
-
return /* @__PURE__ */
|
|
4307
|
+
return /* @__PURE__ */ jsx57(
|
|
3787
4308
|
RadixTabs.Trigger,
|
|
3788
4309
|
{
|
|
3789
4310
|
ref,
|
|
@@ -3793,9 +4314,9 @@ var Tab = forwardRef53(function Tab2({ className, ...props }, ref) {
|
|
|
3793
4314
|
);
|
|
3794
4315
|
});
|
|
3795
4316
|
Tab.displayName = "Tab";
|
|
3796
|
-
var TabsContent =
|
|
4317
|
+
var TabsContent = forwardRef55(
|
|
3797
4318
|
function TabsContent2({ className, ...props }, ref) {
|
|
3798
|
-
return /* @__PURE__ */
|
|
4319
|
+
return /* @__PURE__ */ jsx57(
|
|
3799
4320
|
RadixTabs.Content,
|
|
3800
4321
|
{
|
|
3801
4322
|
ref,
|
|
@@ -3811,8 +4332,8 @@ var TabsContent = forwardRef53(
|
|
|
3811
4332
|
TabsContent.displayName = "TabsContent";
|
|
3812
4333
|
|
|
3813
4334
|
// src/patterns/Timeline/Timeline.tsx
|
|
3814
|
-
import { forwardRef as
|
|
3815
|
-
import { jsx as
|
|
4335
|
+
import { forwardRef as forwardRef56 } from "react";
|
|
4336
|
+
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
3816
4337
|
var ringClass = {
|
|
3817
4338
|
accent: "border-accent",
|
|
3818
4339
|
ok: "border-ok",
|
|
@@ -3820,8 +4341,8 @@ var ringClass = {
|
|
|
3820
4341
|
err: "border-err",
|
|
3821
4342
|
muted: "border-text-dim"
|
|
3822
4343
|
};
|
|
3823
|
-
var Timeline =
|
|
3824
|
-
return /* @__PURE__ */
|
|
4344
|
+
var Timeline = forwardRef56(function Timeline2({ events, className, children, ...props }, ref) {
|
|
4345
|
+
return /* @__PURE__ */ jsx58(
|
|
3825
4346
|
"ol",
|
|
3826
4347
|
{
|
|
3827
4348
|
ref,
|
|
@@ -3831,14 +4352,14 @@ var Timeline = forwardRef54(function Timeline2({ events, className, children, ..
|
|
|
3831
4352
|
className
|
|
3832
4353
|
),
|
|
3833
4354
|
...props,
|
|
3834
|
-
children: events ? events.map((e, i) => /* @__PURE__ */
|
|
4355
|
+
children: events ? events.map((e, i) => /* @__PURE__ */ jsx58(TimelineItem, { tone: e.tone, time: e.time, description: e.description, children: e.title }, i)) : children
|
|
3835
4356
|
}
|
|
3836
4357
|
);
|
|
3837
4358
|
});
|
|
3838
4359
|
Timeline.displayName = "Timeline";
|
|
3839
|
-
var TimelineItem =
|
|
3840
|
-
return /* @__PURE__ */
|
|
3841
|
-
/* @__PURE__ */
|
|
4360
|
+
var TimelineItem = forwardRef56(function TimelineItem2({ tone = "accent", description, time, className, children, ...props }, ref) {
|
|
4361
|
+
return /* @__PURE__ */ jsxs48("li", { ref, className: cn("relative mb-[18px] last:mb-0", className), ...props, children: [
|
|
4362
|
+
/* @__PURE__ */ jsx58(
|
|
3842
4363
|
"span",
|
|
3843
4364
|
{
|
|
3844
4365
|
"aria-hidden": true,
|
|
@@ -3848,18 +4369,18 @@ var TimelineItem = forwardRef54(function TimelineItem2({ tone = "accent", descri
|
|
|
3848
4369
|
)
|
|
3849
4370
|
}
|
|
3850
4371
|
),
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
description && /* @__PURE__ */
|
|
3853
|
-
time && /* @__PURE__ */
|
|
4372
|
+
/* @__PURE__ */ jsx58("div", { className: "text-[13px] font-medium", children }),
|
|
4373
|
+
description && /* @__PURE__ */ jsx58("div", { className: "text-text-muted text-[12px]", children: description }),
|
|
4374
|
+
time && /* @__PURE__ */ jsx58("div", { className: "text-text-dim mt-[2px] font-mono text-[10px]", children: time })
|
|
3854
4375
|
] });
|
|
3855
4376
|
});
|
|
3856
4377
|
TimelineItem.displayName = "TimelineItem";
|
|
3857
4378
|
|
|
3858
4379
|
// src/patterns/Topbar/Topbar.tsx
|
|
3859
|
-
import { forwardRef as
|
|
3860
|
-
import { jsx as
|
|
3861
|
-
var Topbar =
|
|
3862
|
-
return /* @__PURE__ */
|
|
4380
|
+
import { forwardRef as forwardRef57 } from "react";
|
|
4381
|
+
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
4382
|
+
var Topbar = forwardRef57(function Topbar2({ title, leading, actions, className, children, ...props }, ref) {
|
|
4383
|
+
return /* @__PURE__ */ jsxs49(
|
|
3863
4384
|
"header",
|
|
3864
4385
|
{
|
|
3865
4386
|
ref,
|
|
@@ -3870,9 +4391,9 @@ var Topbar = forwardRef55(function Topbar2({ title, leading, actions, className,
|
|
|
3870
4391
|
...props,
|
|
3871
4392
|
children: [
|
|
3872
4393
|
leading,
|
|
3873
|
-
title && /* @__PURE__ */
|
|
3874
|
-
/* @__PURE__ */
|
|
3875
|
-
actions && /* @__PURE__ */
|
|
4394
|
+
title && /* @__PURE__ */ jsx59("div", { className: "text-[13px] font-medium", children: title }),
|
|
4395
|
+
/* @__PURE__ */ jsx59("div", { className: "flex flex-1 items-center" }),
|
|
4396
|
+
actions && /* @__PURE__ */ jsx59("div", { className: "flex items-center gap-3", children: actions }),
|
|
3876
4397
|
children
|
|
3877
4398
|
]
|
|
3878
4399
|
}
|
|
@@ -3882,14 +4403,14 @@ Topbar.displayName = "Topbar";
|
|
|
3882
4403
|
|
|
3883
4404
|
// src/patterns/Tree/Tree.tsx
|
|
3884
4405
|
import {
|
|
3885
|
-
forwardRef as
|
|
3886
|
-
useCallback as
|
|
3887
|
-
useEffect as
|
|
4406
|
+
forwardRef as forwardRef58,
|
|
4407
|
+
useCallback as useCallback10,
|
|
4408
|
+
useEffect as useEffect10,
|
|
3888
4409
|
useMemo as useMemo6,
|
|
3889
|
-
useRef as
|
|
3890
|
-
useState as
|
|
4410
|
+
useRef as useRef8,
|
|
4411
|
+
useState as useState14
|
|
3891
4412
|
} from "react";
|
|
3892
|
-
import { jsx as
|
|
4413
|
+
import { jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
3893
4414
|
var EMPTY_SET2 = /* @__PURE__ */ new Set();
|
|
3894
4415
|
function flattenVisible(items, expanded, level, parentId, out) {
|
|
3895
4416
|
for (const item of items) {
|
|
@@ -3900,7 +4421,7 @@ function flattenVisible(items, expanded, level, parentId, out) {
|
|
|
3900
4421
|
}
|
|
3901
4422
|
}
|
|
3902
4423
|
}
|
|
3903
|
-
var Tree =
|
|
4424
|
+
var Tree = forwardRef58(function Tree2({
|
|
3904
4425
|
items,
|
|
3905
4426
|
expanded: expandedProp,
|
|
3906
4427
|
defaultExpanded,
|
|
@@ -3928,8 +4449,8 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3928
4449
|
flattenVisible(items, expandedSet, 1, null, out);
|
|
3929
4450
|
return out;
|
|
3930
4451
|
}, [items, expandedSet]);
|
|
3931
|
-
const [activeId, setActiveId] =
|
|
3932
|
-
|
|
4452
|
+
const [activeId, setActiveId] = useState14(null);
|
|
4453
|
+
useEffect10(() => {
|
|
3933
4454
|
if (activeId && !flatVisible.some((f) => f.id === activeId)) {
|
|
3934
4455
|
setActiveId(null);
|
|
3935
4456
|
}
|
|
@@ -3939,8 +4460,8 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3939
4460
|
if (value && flatVisible.some((f) => f.id === value)) return value;
|
|
3940
4461
|
return flatVisible[0]?.id ?? null;
|
|
3941
4462
|
}, [activeId, flatVisible, value]);
|
|
3942
|
-
const listRef =
|
|
3943
|
-
const setRefs =
|
|
4463
|
+
const listRef = useRef8(null);
|
|
4464
|
+
const setRefs = useCallback10(
|
|
3944
4465
|
(node) => {
|
|
3945
4466
|
listRef.current = node;
|
|
3946
4467
|
if (typeof ref === "function") ref(node);
|
|
@@ -3948,20 +4469,20 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3948
4469
|
},
|
|
3949
4470
|
[ref]
|
|
3950
4471
|
);
|
|
3951
|
-
const focusItem =
|
|
4472
|
+
const focusItem = useCallback10((id) => {
|
|
3952
4473
|
const root = listRef.current;
|
|
3953
4474
|
if (!root) return;
|
|
3954
4475
|
const el = root.querySelector(`[data-treeitem-id="${CSS.escape(id)}"]`);
|
|
3955
4476
|
el?.focus();
|
|
3956
4477
|
}, []);
|
|
3957
|
-
const moveActive =
|
|
4478
|
+
const moveActive = useCallback10(
|
|
3958
4479
|
(id) => {
|
|
3959
4480
|
setActiveId(id);
|
|
3960
4481
|
queueMicrotask(() => focusItem(id));
|
|
3961
4482
|
},
|
|
3962
4483
|
[focusItem]
|
|
3963
4484
|
);
|
|
3964
|
-
const toggle =
|
|
4485
|
+
const toggle = useCallback10(
|
|
3965
4486
|
(id) => {
|
|
3966
4487
|
setExpanded((prev) => {
|
|
3967
4488
|
const next = new Set(prev ?? EMPTY_SET2);
|
|
@@ -3972,7 +4493,7 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3972
4493
|
},
|
|
3973
4494
|
[setExpanded]
|
|
3974
4495
|
);
|
|
3975
|
-
const expand =
|
|
4496
|
+
const expand = useCallback10(
|
|
3976
4497
|
(id) => {
|
|
3977
4498
|
setExpanded((prev) => {
|
|
3978
4499
|
const base = prev ?? EMPTY_SET2;
|
|
@@ -3984,7 +4505,7 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3984
4505
|
},
|
|
3985
4506
|
[setExpanded]
|
|
3986
4507
|
);
|
|
3987
|
-
const collapse =
|
|
4508
|
+
const collapse = useCallback10(
|
|
3988
4509
|
(id) => {
|
|
3989
4510
|
setExpanded((prev) => {
|
|
3990
4511
|
const base = prev ?? EMPTY_SET2;
|
|
@@ -3996,13 +4517,13 @@ var Tree = forwardRef56(function Tree2({
|
|
|
3996
4517
|
},
|
|
3997
4518
|
[setExpanded]
|
|
3998
4519
|
);
|
|
3999
|
-
const selectItem =
|
|
4520
|
+
const selectItem = useCallback10(
|
|
4000
4521
|
(id) => {
|
|
4001
4522
|
setValue(id);
|
|
4002
4523
|
},
|
|
4003
4524
|
[setValue]
|
|
4004
4525
|
);
|
|
4005
|
-
const handleKeyDown =
|
|
4526
|
+
const handleKeyDown = useCallback10(
|
|
4006
4527
|
(e) => {
|
|
4007
4528
|
onKeyDown?.(e);
|
|
4008
4529
|
if (e.defaultPrevented) return;
|
|
@@ -4082,7 +4603,7 @@ var Tree = forwardRef56(function Tree2({
|
|
|
4082
4603
|
toggle
|
|
4083
4604
|
]
|
|
4084
4605
|
);
|
|
4085
|
-
return /* @__PURE__ */
|
|
4606
|
+
return /* @__PURE__ */ jsx60(
|
|
4086
4607
|
"ul",
|
|
4087
4608
|
{
|
|
4088
4609
|
ref: setRefs,
|
|
@@ -4090,7 +4611,7 @@ var Tree = forwardRef56(function Tree2({
|
|
|
4090
4611
|
className: cn("flex flex-col gap-px text-[12px]", className),
|
|
4091
4612
|
onKeyDown: handleKeyDown,
|
|
4092
4613
|
...props,
|
|
4093
|
-
children: items.map((item) => /* @__PURE__ */
|
|
4614
|
+
children: items.map((item) => /* @__PURE__ */ jsx60(
|
|
4094
4615
|
TreeItemRow,
|
|
4095
4616
|
{
|
|
4096
4617
|
item,
|
|
@@ -4125,8 +4646,8 @@ function TreeItemRow({
|
|
|
4125
4646
|
const isExpanded = hasChildren && expanded.has(item.id);
|
|
4126
4647
|
const isSelected = selected === item.id;
|
|
4127
4648
|
const isTabStop = tabStopId === item.id;
|
|
4128
|
-
return /* @__PURE__ */
|
|
4129
|
-
/* @__PURE__ */
|
|
4649
|
+
return /* @__PURE__ */ jsxs50("li", { role: "none", children: [
|
|
4650
|
+
/* @__PURE__ */ jsxs50(
|
|
4130
4651
|
"div",
|
|
4131
4652
|
{
|
|
4132
4653
|
role: "treeitem",
|
|
@@ -4149,14 +4670,14 @@ function TreeItemRow({
|
|
|
4149
4670
|
isSelected ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2"
|
|
4150
4671
|
),
|
|
4151
4672
|
children: [
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
item.icon && /* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */
|
|
4673
|
+
/* @__PURE__ */ jsx60("span", { "aria-hidden": true, className: "text-text-dim grid w-3 place-items-center text-[10px]", children: hasChildren ? isExpanded ? "\u25BE" : "\u25B8" : "" }),
|
|
4674
|
+
item.icon && /* @__PURE__ */ jsx60("span", { "aria-hidden": true, className: "text-[12px] opacity-80", children: item.icon }),
|
|
4675
|
+
/* @__PURE__ */ jsx60("span", { className: "flex-1 truncate", children: item.label }),
|
|
4155
4676
|
item.trailing
|
|
4156
4677
|
]
|
|
4157
4678
|
}
|
|
4158
4679
|
),
|
|
4159
|
-
hasChildren && isExpanded && /* @__PURE__ */
|
|
4680
|
+
hasChildren && isExpanded && /* @__PURE__ */ jsx60("ul", { role: "group", className: "flex flex-col gap-px", children: (item.children ?? []).map((child) => /* @__PURE__ */ jsx60(
|
|
4160
4681
|
TreeItemRow,
|
|
4161
4682
|
{
|
|
4162
4683
|
item: child,
|
|
@@ -4220,6 +4741,7 @@ export {
|
|
|
4220
4741
|
DropdownMenuRadioGroup,
|
|
4221
4742
|
DropdownMenuRoot,
|
|
4222
4743
|
DropdownMenuTrigger,
|
|
4744
|
+
Dropzone,
|
|
4223
4745
|
EmptyState,
|
|
4224
4746
|
FAB,
|
|
4225
4747
|
Field,
|
|
@@ -4241,6 +4763,7 @@ export {
|
|
|
4241
4763
|
MenubarMenu,
|
|
4242
4764
|
MenubarSeparator,
|
|
4243
4765
|
MenubarTrigger,
|
|
4766
|
+
NavBar,
|
|
4244
4767
|
NavItem,
|
|
4245
4768
|
NavSection,
|
|
4246
4769
|
OTP,
|