@assure-one/design-system 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +112 -8
- package/dist/index.js +547 -55
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React36 from 'react';
|
|
3
|
-
import { forwardRef, useState, useCallback, useId, useRef, useImperativeHandle, useEffect, createContext, Fragment as Fragment$1, useContext
|
|
3
|
+
import { forwardRef, useState, useCallback, useId, useRef, useImperativeHandle, useMemo, useEffect, createContext, Fragment as Fragment$1, useContext } from 'react';
|
|
4
4
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -3777,31 +3777,8 @@ var CopyButton = forwardRef(function CopyButton2({ value, feedbackDuration = 2e3
|
|
|
3777
3777
|
);
|
|
3778
3778
|
});
|
|
3779
3779
|
CopyButton.displayName = "CopyButton";
|
|
3780
|
-
var Popover = PopoverPrimitive.Root;
|
|
3781
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3782
|
-
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
3783
|
-
var PopoverPortal = PopoverPrimitive.Portal;
|
|
3784
|
-
var PopoverClose = PopoverPrimitive.Close;
|
|
3785
|
-
var PopoverContent = React36.forwardRef(({ className, align = "center", side = "bottom", sideOffset = 8, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3786
|
-
PopoverPrimitive.Content,
|
|
3787
|
-
{
|
|
3788
|
-
ref,
|
|
3789
|
-
align,
|
|
3790
|
-
side,
|
|
3791
|
-
sideOffset,
|
|
3792
|
-
className: cn(
|
|
3793
|
-
"rounded-card border-rule bg-surface text-fg shadow-pop z-[var(--z-dropdown)] w-72 border p-4 outline-none",
|
|
3794
|
-
"transition-[opacity,transform] duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]",
|
|
3795
|
-
"data-[state=closed]:scale-95 data-[state=closed]:opacity-0",
|
|
3796
|
-
"data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
3797
|
-
"motion-reduce:transition-none",
|
|
3798
|
-
className
|
|
3799
|
-
),
|
|
3800
|
-
...props
|
|
3801
|
-
}
|
|
3802
|
-
) }));
|
|
3803
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
3804
3780
|
var DATE_DISPLAY_PLACEHOLDER = "MM/DD/YYYY";
|
|
3781
|
+
var YEAR_DISPLAY_PLACEHOLDER = "YYYY";
|
|
3805
3782
|
var ISO_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
3806
3783
|
var DISPLAY_RE = /^(\d{2})\/(\d{2})\/(\d{4})$/;
|
|
3807
3784
|
function isoToDisplay(iso) {
|
|
@@ -3835,6 +3812,129 @@ function isoToDate(iso) {
|
|
|
3835
3812
|
function dateToIso(d) {
|
|
3836
3813
|
return format(d, "yyyy-MM-dd");
|
|
3837
3814
|
}
|
|
3815
|
+
function isoToYear(iso) {
|
|
3816
|
+
if (!iso) return "";
|
|
3817
|
+
const m = /^(\d{4})/.exec(iso);
|
|
3818
|
+
return m ? m[1] : "";
|
|
3819
|
+
}
|
|
3820
|
+
function yearToIso(year) {
|
|
3821
|
+
return /^\d{4}$/.test(year) ? `${year}-01-01` : "";
|
|
3822
|
+
}
|
|
3823
|
+
function applyYearMask(input) {
|
|
3824
|
+
return input.replace(/\D/g, "").slice(0, 4);
|
|
3825
|
+
}
|
|
3826
|
+
var Popover = PopoverPrimitive.Root;
|
|
3827
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3828
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
3829
|
+
var PopoverPortal = PopoverPrimitive.Portal;
|
|
3830
|
+
var PopoverClose = PopoverPrimitive.Close;
|
|
3831
|
+
var PopoverContent = React36.forwardRef(({ className, align = "center", side = "bottom", sideOffset = 8, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3832
|
+
PopoverPrimitive.Content,
|
|
3833
|
+
{
|
|
3834
|
+
ref,
|
|
3835
|
+
align,
|
|
3836
|
+
side,
|
|
3837
|
+
sideOffset,
|
|
3838
|
+
className: cn(
|
|
3839
|
+
"rounded-card border-rule bg-surface text-fg shadow-pop z-[var(--z-dropdown)] w-72 border p-4 outline-none",
|
|
3840
|
+
"transition-[opacity,transform] duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]",
|
|
3841
|
+
"data-[state=closed]:scale-95 data-[state=closed]:opacity-0",
|
|
3842
|
+
"data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
3843
|
+
"motion-reduce:transition-none",
|
|
3844
|
+
className
|
|
3845
|
+
),
|
|
3846
|
+
...props
|
|
3847
|
+
}
|
|
3848
|
+
) }));
|
|
3849
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
3850
|
+
function YearGrid({ selected, onSelect, minYear, maxYear, formatLabel, autoFocus }) {
|
|
3851
|
+
const today = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3852
|
+
const anchor = selected ?? today;
|
|
3853
|
+
const [startYear, setStartYear] = useState(() => anchor - anchor % 12);
|
|
3854
|
+
const years = Array.from({ length: 12 }, (_, i) => startYear + i);
|
|
3855
|
+
const canGoPrev = !minYear || startYear > minYear;
|
|
3856
|
+
const canGoNext = !maxYear || startYear + 11 < maxYear;
|
|
3857
|
+
const focusYear = selected && years.includes(selected) ? selected : years.includes(today) ? today : years[0];
|
|
3858
|
+
const focusRef = useRef(null);
|
|
3859
|
+
useEffect(() => {
|
|
3860
|
+
if (autoFocus) {
|
|
3861
|
+
const raf = requestAnimationFrame(() => focusRef.current?.focus());
|
|
3862
|
+
return () => cancelAnimationFrame(raf);
|
|
3863
|
+
}
|
|
3864
|
+
}, [autoFocus]);
|
|
3865
|
+
return /* @__PURE__ */ jsxs("div", { className: "font-body text-fg min-w-[280px] p-3 select-none", children: [
|
|
3866
|
+
/* @__PURE__ */ jsxs("div", { className: "relative mb-3 flex h-8 items-center justify-center", children: [
|
|
3867
|
+
/* @__PURE__ */ jsx(
|
|
3868
|
+
"button",
|
|
3869
|
+
{
|
|
3870
|
+
type: "button",
|
|
3871
|
+
onClick: () => setStartYear((y) => y - 12),
|
|
3872
|
+
disabled: !canGoPrev,
|
|
3873
|
+
"aria-label": "Previous decade",
|
|
3874
|
+
className: cn(
|
|
3875
|
+
"rounded-input text-fg-3 absolute left-0 inline-flex size-7 items-center justify-center",
|
|
3876
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
3877
|
+
"hover:bg-bg-2 hover:text-fg",
|
|
3878
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
3879
|
+
"disabled:text-fg-disabled disabled:pointer-events-none disabled:cursor-not-allowed"
|
|
3880
|
+
),
|
|
3881
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "text-fg-3 size-4", "aria-hidden": "true" })
|
|
3882
|
+
}
|
|
3883
|
+
),
|
|
3884
|
+
/* @__PURE__ */ jsxs("span", { className: "font-display text-fg text-[13px] font-medium tabular-nums", children: [
|
|
3885
|
+
startYear,
|
|
3886
|
+
" \u2013 ",
|
|
3887
|
+
startYear + 11
|
|
3888
|
+
] }),
|
|
3889
|
+
/* @__PURE__ */ jsx(
|
|
3890
|
+
"button",
|
|
3891
|
+
{
|
|
3892
|
+
type: "button",
|
|
3893
|
+
onClick: () => setStartYear((y) => y + 12),
|
|
3894
|
+
disabled: !canGoNext,
|
|
3895
|
+
"aria-label": "Next decade",
|
|
3896
|
+
className: cn(
|
|
3897
|
+
"rounded-input text-fg-3 absolute right-0 inline-flex size-7 items-center justify-center",
|
|
3898
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
3899
|
+
"hover:bg-bg-2 hover:text-fg",
|
|
3900
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
3901
|
+
"disabled:text-fg-disabled disabled:pointer-events-none disabled:cursor-not-allowed"
|
|
3902
|
+
),
|
|
3903
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "text-fg-3 size-4", "aria-hidden": "true" })
|
|
3904
|
+
}
|
|
3905
|
+
)
|
|
3906
|
+
] }),
|
|
3907
|
+
/* @__PURE__ */ jsx("div", { role: "group", "aria-label": "Pick a year", className: "grid grid-cols-3 gap-1.5", children: years.map((year) => {
|
|
3908
|
+
const isSelected = year === selected;
|
|
3909
|
+
const isToday = year === today;
|
|
3910
|
+
const isFocusTarget = year === focusYear;
|
|
3911
|
+
const isDisabled = minYear !== void 0 && year < minYear || maxYear !== void 0 && year > maxYear;
|
|
3912
|
+
return /* @__PURE__ */ jsx(
|
|
3913
|
+
"button",
|
|
3914
|
+
{
|
|
3915
|
+
ref: isFocusTarget ? focusRef : void 0,
|
|
3916
|
+
type: "button",
|
|
3917
|
+
onClick: () => !isDisabled && onSelect(year),
|
|
3918
|
+
disabled: isDisabled,
|
|
3919
|
+
"aria-pressed": isSelected,
|
|
3920
|
+
"aria-current": isToday ? "date" : void 0,
|
|
3921
|
+
className: cn(
|
|
3922
|
+
"rounded-input font-mono text-[13px] tabular-nums",
|
|
3923
|
+
"inline-flex h-10 items-center justify-center",
|
|
3924
|
+
"transition-colors duration-[var(--duration-instant)] motion-reduce:transition-none",
|
|
3925
|
+
"hover:bg-bg-2",
|
|
3926
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
3927
|
+
"disabled:text-fg-disabled disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
3928
|
+
isToday && !isSelected && "text-accent font-semibold",
|
|
3929
|
+
isSelected && "bg-pro-fg text-fg-on-pro hover:bg-pro-hover focus-visible:bg-pro-fg"
|
|
3930
|
+
),
|
|
3931
|
+
children: formatLabel ? formatLabel(year) : year
|
|
3932
|
+
},
|
|
3933
|
+
year
|
|
3934
|
+
);
|
|
3935
|
+
}) })
|
|
3936
|
+
] });
|
|
3937
|
+
}
|
|
3838
3938
|
var DatePicker = forwardRef(function DatePicker2({
|
|
3839
3939
|
value,
|
|
3840
3940
|
defaultValue,
|
|
@@ -3846,12 +3946,25 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3846
3946
|
disabled,
|
|
3847
3947
|
required,
|
|
3848
3948
|
autoFocus,
|
|
3849
|
-
placeholder
|
|
3949
|
+
placeholder,
|
|
3850
3950
|
className,
|
|
3851
3951
|
min,
|
|
3852
3952
|
max,
|
|
3853
|
-
"aria-label": ariaLabel
|
|
3953
|
+
"aria-label": ariaLabel,
|
|
3954
|
+
picker = "day",
|
|
3955
|
+
formatLabel,
|
|
3956
|
+
iconPosition = "right"
|
|
3854
3957
|
}, ref) {
|
|
3958
|
+
const isYearMode = picker === "year";
|
|
3959
|
+
const hasCustomYearLabel = isYearMode && !!formatLabel;
|
|
3960
|
+
const effectivePlaceholder = placeholder ?? (isYearMode ? YEAR_DISPLAY_PLACEHOLDER : DATE_DISPLAY_PLACEHOLDER);
|
|
3961
|
+
const toDisplayFromIso = isYearMode ? (iso2) => {
|
|
3962
|
+
const y = isoToYear(iso2);
|
|
3963
|
+
if (!y) return "";
|
|
3964
|
+
return formatLabel ? formatLabel(Number(y)) : y;
|
|
3965
|
+
} : isoToDisplay;
|
|
3966
|
+
const toIsoFromDisplay = isYearMode ? yearToIso : displayToIso;
|
|
3967
|
+
const maskInput = isYearMode ? applyYearMask : applyMask;
|
|
3855
3968
|
const generatedId = useId();
|
|
3856
3969
|
const id = providedId ?? generatedId;
|
|
3857
3970
|
const errorId = `${id}-error`;
|
|
@@ -3860,7 +3973,7 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3860
3973
|
isControlled ? value ?? "" : defaultValue ?? ""
|
|
3861
3974
|
);
|
|
3862
3975
|
const [display, setDisplay] = useState(
|
|
3863
|
-
() =>
|
|
3976
|
+
() => toDisplayFromIso(isControlled ? value : defaultValue)
|
|
3864
3977
|
);
|
|
3865
3978
|
const [open, setOpen] = useState(false);
|
|
3866
3979
|
const [lastPropValue, setLastPropValue] = useState(value);
|
|
@@ -3868,8 +3981,8 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3868
3981
|
setLastPropValue(value);
|
|
3869
3982
|
const nextIso = value ?? "";
|
|
3870
3983
|
setInternalIso(nextIso);
|
|
3871
|
-
if (
|
|
3872
|
-
setDisplay(
|
|
3984
|
+
if (toIsoFromDisplay(display) !== nextIso) {
|
|
3985
|
+
setDisplay(toDisplayFromIso(nextIso));
|
|
3873
3986
|
}
|
|
3874
3987
|
}
|
|
3875
3988
|
const iso = isControlled ? value ?? "" : internalIso;
|
|
@@ -3883,9 +3996,9 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3883
3996
|
);
|
|
3884
3997
|
const handleTextChange = useCallback(
|
|
3885
3998
|
(e) => {
|
|
3886
|
-
const masked =
|
|
3999
|
+
const masked = maskInput(e.target.value);
|
|
3887
4000
|
setDisplay(masked);
|
|
3888
|
-
const nextIso =
|
|
4001
|
+
const nextIso = toIsoFromDisplay(masked);
|
|
3889
4002
|
if (nextIso !== iso) {
|
|
3890
4003
|
if (!isControlled) setInternalIso(nextIso);
|
|
3891
4004
|
emit(nextIso);
|
|
@@ -3894,7 +4007,7 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3894
4007
|
emit("");
|
|
3895
4008
|
}
|
|
3896
4009
|
},
|
|
3897
|
-
[iso, isControlled, emit]
|
|
4010
|
+
[iso, isControlled, emit, maskInput, toIsoFromDisplay]
|
|
3898
4011
|
);
|
|
3899
4012
|
const handleCalendarSelect = useCallback(
|
|
3900
4013
|
(d) => {
|
|
@@ -3907,9 +4020,23 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3907
4020
|
},
|
|
3908
4021
|
[isControlled, emit]
|
|
3909
4022
|
);
|
|
4023
|
+
const handleYearSelect = useCallback(
|
|
4024
|
+
(year) => {
|
|
4025
|
+
const nextIso = yearToIso(String(year));
|
|
4026
|
+
setDisplay(formatLabel ? formatLabel(year) : String(year));
|
|
4027
|
+
if (!isControlled) setInternalIso(nextIso);
|
|
4028
|
+
emit(nextIso);
|
|
4029
|
+
setOpen(false);
|
|
4030
|
+
requestAnimationFrame(() => textRef.current?.focus());
|
|
4031
|
+
},
|
|
4032
|
+
[isControlled, emit, formatLabel]
|
|
4033
|
+
);
|
|
3910
4034
|
const minDate = isoToDate(min ?? "");
|
|
3911
4035
|
const maxDate = isoToDate(max ?? "");
|
|
3912
4036
|
const selectedDate = isoToDate(iso);
|
|
4037
|
+
const selectedYear = isYearMode ? Number(isoToYear(iso)) || void 0 : void 0;
|
|
4038
|
+
const minYear = min ? Number(isoToYear(min)) : void 0;
|
|
4039
|
+
const maxYear = max ? Number(isoToYear(max)) : void 0;
|
|
3913
4040
|
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
|
|
3914
4041
|
label && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: "text-fg mb-1.5 block text-[13px] leading-none font-medium", children: [
|
|
3915
4042
|
label,
|
|
@@ -3922,20 +4049,23 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3922
4049
|
ref: textRef,
|
|
3923
4050
|
id,
|
|
3924
4051
|
type: "text",
|
|
3925
|
-
inputMode: "numeric",
|
|
4052
|
+
inputMode: hasCustomYearLabel ? void 0 : "numeric",
|
|
3926
4053
|
autoComplete: "off",
|
|
3927
4054
|
value: display,
|
|
3928
4055
|
onChange: handleTextChange,
|
|
3929
|
-
placeholder,
|
|
4056
|
+
placeholder: effectivePlaceholder,
|
|
3930
4057
|
disabled,
|
|
3931
4058
|
required,
|
|
4059
|
+
readOnly: hasCustomYearLabel,
|
|
4060
|
+
onClick: hasCustomYearLabel && !disabled ? () => setOpen(true) : void 0,
|
|
3932
4061
|
autoFocus,
|
|
3933
4062
|
"aria-invalid": !!error || void 0,
|
|
3934
4063
|
"aria-describedby": error ? errorId : void 0,
|
|
3935
4064
|
"aria-label": ariaLabel,
|
|
3936
4065
|
className: cn(
|
|
3937
4066
|
"rounded-input bg-surface text-fg flex h-9 w-full border font-mono text-[13px] tabular-nums",
|
|
3938
|
-
"border-rule-strong
|
|
4067
|
+
"border-rule-strong py-2",
|
|
4068
|
+
iconPosition === "left" ? "pl-10 pr-3" : "pl-3 pr-10",
|
|
3939
4069
|
"transition-[color,background-color,border-color,box-shadow] duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]",
|
|
3940
4070
|
"motion-reduce:transition-none",
|
|
3941
4071
|
"placeholder:font-body placeholder:text-fg-4",
|
|
@@ -3943,7 +4073,8 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3943
4073
|
"focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
3944
4074
|
"disabled:bg-bg-disabled disabled:text-fg-disabled disabled:cursor-not-allowed",
|
|
3945
4075
|
"aria-[invalid=true]:border-danger-line aria-[invalid=true]:focus-visible:border-danger-fg",
|
|
3946
|
-
"aria-[invalid=true]:focus-visible:[box-shadow:0_0_0_2px_var(--color-danger-bg)]"
|
|
4076
|
+
"aria-[invalid=true]:focus-visible:[box-shadow:0_0_0_2px_var(--color-danger-bg)]",
|
|
4077
|
+
hasCustomYearLabel && "cursor-pointer"
|
|
3947
4078
|
)
|
|
3948
4079
|
}
|
|
3949
4080
|
),
|
|
@@ -3956,12 +4087,13 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3956
4087
|
tabIndex: -1,
|
|
3957
4088
|
"aria-label": "Open calendar",
|
|
3958
4089
|
className: cn(
|
|
3959
|
-
"
|
|
4090
|
+
"text-fg-3 absolute inset-y-0 flex w-10 cursor-pointer items-center justify-center",
|
|
4091
|
+
iconPosition === "left" ? "left-0 rounded-l-input" : "right-0 rounded-r-input",
|
|
3960
4092
|
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]",
|
|
3961
4093
|
"motion-reduce:transition-none",
|
|
3962
|
-
"hover:text-fg",
|
|
4094
|
+
"hover:bg-bg-2 hover:text-fg",
|
|
3963
4095
|
"focus-visible:[box-shadow:var(--shadow-focus-ring)] focus-visible:outline-none",
|
|
3964
|
-
"disabled:text-fg-disabled disabled:cursor-not-allowed"
|
|
4096
|
+
"disabled:text-fg-disabled disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
|
3965
4097
|
),
|
|
3966
4098
|
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4", "aria-hidden": "true" })
|
|
3967
4099
|
}
|
|
@@ -3969,18 +4101,29 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3969
4101
|
/* @__PURE__ */ jsx(
|
|
3970
4102
|
PopoverContent,
|
|
3971
4103
|
{
|
|
3972
|
-
align: "end",
|
|
4104
|
+
align: iconPosition === "left" ? "start" : "end",
|
|
3973
4105
|
sideOffset: 6,
|
|
3974
4106
|
className: "w-auto p-0",
|
|
3975
4107
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3976
|
-
children: /* @__PURE__ */ jsx(
|
|
4108
|
+
children: isYearMode ? /* @__PURE__ */ jsx(
|
|
4109
|
+
YearGrid,
|
|
4110
|
+
{
|
|
4111
|
+
selected: selectedYear,
|
|
4112
|
+
onSelect: handleYearSelect,
|
|
4113
|
+
minYear,
|
|
4114
|
+
maxYear,
|
|
4115
|
+
formatLabel,
|
|
4116
|
+
autoFocus: true
|
|
4117
|
+
}
|
|
4118
|
+
) : /* @__PURE__ */ jsx(
|
|
3977
4119
|
Calendar,
|
|
3978
4120
|
{
|
|
3979
4121
|
selected: selectedDate ?? null,
|
|
3980
4122
|
onSelect: handleCalendarSelect,
|
|
3981
4123
|
minDate,
|
|
3982
4124
|
maxDate,
|
|
3983
|
-
defaultMonth: selectedDate ?? minDate ?? void 0
|
|
4125
|
+
defaultMonth: selectedDate ?? minDate ?? void 0,
|
|
4126
|
+
autoFocus: true
|
|
3984
4127
|
}
|
|
3985
4128
|
)
|
|
3986
4129
|
}
|
|
@@ -3992,6 +4135,224 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
3992
4135
|
] });
|
|
3993
4136
|
});
|
|
3994
4137
|
DatePicker.displayName = "DatePicker";
|
|
4138
|
+
var DateRangePicker = forwardRef(
|
|
4139
|
+
function DateRangePicker2({
|
|
4140
|
+
value,
|
|
4141
|
+
defaultValue,
|
|
4142
|
+
onChange,
|
|
4143
|
+
name,
|
|
4144
|
+
id: providedId,
|
|
4145
|
+
label,
|
|
4146
|
+
error,
|
|
4147
|
+
disabled,
|
|
4148
|
+
required,
|
|
4149
|
+
placeholder = "Select date range",
|
|
4150
|
+
className,
|
|
4151
|
+
min,
|
|
4152
|
+
max,
|
|
4153
|
+
iconPosition = "right",
|
|
4154
|
+
"aria-label": ariaLabel
|
|
4155
|
+
}, ref) {
|
|
4156
|
+
const generatedId = useId();
|
|
4157
|
+
const id = providedId ?? generatedId;
|
|
4158
|
+
const errorId = `${id}-error`;
|
|
4159
|
+
const isControlled = value !== void 0;
|
|
4160
|
+
const [internalValue, setInternalValue] = useState(
|
|
4161
|
+
isControlled ? value ?? {} : defaultValue ?? {}
|
|
4162
|
+
);
|
|
4163
|
+
const [open, setOpen] = useState(false);
|
|
4164
|
+
const [lastFromProp, setLastFromProp] = useState(value?.from);
|
|
4165
|
+
const [lastToProp, setLastToProp] = useState(value?.to);
|
|
4166
|
+
if (isControlled && value?.from !== lastFromProp) {
|
|
4167
|
+
setLastFromProp(value?.from);
|
|
4168
|
+
setInternalValue((prev) => ({ ...prev, from: value?.from ?? "" }));
|
|
4169
|
+
}
|
|
4170
|
+
if (isControlled && value?.to !== lastToProp) {
|
|
4171
|
+
setLastToProp(value?.to);
|
|
4172
|
+
setInternalValue((prev) => ({ ...prev, to: value?.to ?? "" }));
|
|
4173
|
+
}
|
|
4174
|
+
const current = useMemo(
|
|
4175
|
+
() => isControlled ? value ?? {} : internalValue,
|
|
4176
|
+
[isControlled, value, internalValue]
|
|
4177
|
+
);
|
|
4178
|
+
const triggerRef = useRef(null);
|
|
4179
|
+
useImperativeHandle(ref, () => triggerRef.current);
|
|
4180
|
+
const [draftRange, setDraftRange] = useState();
|
|
4181
|
+
const emit = useCallback(
|
|
4182
|
+
(next) => {
|
|
4183
|
+
onChange?.({ from: next.from ?? "", to: next.to ?? "" });
|
|
4184
|
+
},
|
|
4185
|
+
[onChange]
|
|
4186
|
+
);
|
|
4187
|
+
const handleCalendarSelect = useCallback(
|
|
4188
|
+
(range) => {
|
|
4189
|
+
setDraftRange(range);
|
|
4190
|
+
const fromIso = range?.from ? dateToIso(range.from) : "";
|
|
4191
|
+
const toIso = range?.to ? dateToIso(range.to) : "";
|
|
4192
|
+
if (fromIso && toIso && fromIso !== toIso) {
|
|
4193
|
+
const next = { from: fromIso, to: toIso };
|
|
4194
|
+
if (!isControlled) setInternalValue(next);
|
|
4195
|
+
emit(next);
|
|
4196
|
+
setDraftRange(void 0);
|
|
4197
|
+
setOpen(false);
|
|
4198
|
+
}
|
|
4199
|
+
},
|
|
4200
|
+
[isControlled, emit]
|
|
4201
|
+
);
|
|
4202
|
+
const handleOpenChange = useCallback((next) => {
|
|
4203
|
+
setOpen(next);
|
|
4204
|
+
if (!next) setDraftRange(void 0);
|
|
4205
|
+
}, []);
|
|
4206
|
+
const minDate = isoToDate(min ?? "");
|
|
4207
|
+
const maxDate = isoToDate(max ?? "");
|
|
4208
|
+
const committedRange = {
|
|
4209
|
+
from: isoToDate(current.from ?? ""),
|
|
4210
|
+
to: isoToDate(current.to ?? "")
|
|
4211
|
+
};
|
|
4212
|
+
const selectedRange = draftRange ?? committedRange;
|
|
4213
|
+
const disabledMatcher = (() => {
|
|
4214
|
+
if (!minDate && !maxDate) return void 0;
|
|
4215
|
+
if (minDate && maxDate) return [{ before: minDate }, { after: maxDate }];
|
|
4216
|
+
if (minDate) return { before: minDate };
|
|
4217
|
+
return { after: maxDate };
|
|
4218
|
+
})();
|
|
4219
|
+
const fromDisplay = isoToDisplay(current.from);
|
|
4220
|
+
const toDisplay = isoToDisplay(current.to);
|
|
4221
|
+
const hasValue = !!(fromDisplay || toDisplay);
|
|
4222
|
+
const displayText = hasValue ? `${fromDisplay || DATE_DISPLAY_PLACEHOLDER} \u2013 ${toDisplay || DATE_DISPLAY_PLACEHOLDER}` : "";
|
|
4223
|
+
const iconNode = /* @__PURE__ */ jsx(
|
|
4224
|
+
CalendarIcon,
|
|
4225
|
+
{
|
|
4226
|
+
className: cn("size-4 shrink-0", disabled ? "text-fg-disabled" : "text-fg-3"),
|
|
4227
|
+
"aria-hidden": "true"
|
|
4228
|
+
}
|
|
4229
|
+
);
|
|
4230
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
|
|
4231
|
+
label && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: "text-fg mb-1.5 block text-[13px] leading-none font-medium", children: [
|
|
4232
|
+
label,
|
|
4233
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-danger-fg ml-0.5", "aria-hidden": "true", children: "*" })
|
|
4234
|
+
] }),
|
|
4235
|
+
/* @__PURE__ */ jsxs(Popover, { open: open && !disabled, onOpenChange: handleOpenChange, children: [
|
|
4236
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
4237
|
+
"button",
|
|
4238
|
+
{
|
|
4239
|
+
ref: triggerRef,
|
|
4240
|
+
id,
|
|
4241
|
+
type: "button",
|
|
4242
|
+
disabled,
|
|
4243
|
+
"data-invalid": !!error || void 0,
|
|
4244
|
+
"aria-describedby": error ? errorId : void 0,
|
|
4245
|
+
"aria-label": ariaLabel ?? label ?? "Date range",
|
|
4246
|
+
"aria-haspopup": "dialog",
|
|
4247
|
+
"aria-expanded": open,
|
|
4248
|
+
className: cn(
|
|
4249
|
+
"rounded-input bg-surface flex h-9 w-full cursor-pointer items-center border font-mono text-[13px] tabular-nums",
|
|
4250
|
+
"border-rule-strong px-3 py-2 gap-2",
|
|
4251
|
+
"transition-[color,background-color,border-color,box-shadow] duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]",
|
|
4252
|
+
"motion-reduce:transition-none",
|
|
4253
|
+
"hover:bg-bg-2",
|
|
4254
|
+
"focus-visible:border-accent focus-visible:outline-none",
|
|
4255
|
+
"focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
4256
|
+
"disabled:bg-bg-disabled disabled:text-fg-disabled disabled:cursor-not-allowed disabled:hover:bg-bg-disabled",
|
|
4257
|
+
"data-[invalid=true]:border-danger-line data-[invalid=true]:focus-visible:border-danger-fg",
|
|
4258
|
+
"data-[invalid=true]:focus-visible:[box-shadow:0_0_0_2px_var(--color-danger-bg)]"
|
|
4259
|
+
),
|
|
4260
|
+
children: [
|
|
4261
|
+
iconPosition === "left" && iconNode,
|
|
4262
|
+
/* @__PURE__ */ jsx(
|
|
4263
|
+
"span",
|
|
4264
|
+
{
|
|
4265
|
+
className: cn(
|
|
4266
|
+
"font-mono flex-1 truncate text-left",
|
|
4267
|
+
hasValue ? "text-fg" : "font-body text-fg-4"
|
|
4268
|
+
),
|
|
4269
|
+
children: displayText || placeholder
|
|
4270
|
+
}
|
|
4271
|
+
),
|
|
4272
|
+
iconPosition === "right" && iconNode
|
|
4273
|
+
]
|
|
4274
|
+
}
|
|
4275
|
+
) }),
|
|
4276
|
+
/* @__PURE__ */ jsx(
|
|
4277
|
+
PopoverContent,
|
|
4278
|
+
{
|
|
4279
|
+
align: iconPosition === "right" ? "end" : "start",
|
|
4280
|
+
sideOffset: 6,
|
|
4281
|
+
className: "w-auto p-0",
|
|
4282
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
4283
|
+
children: /* @__PURE__ */ jsx(
|
|
4284
|
+
DayPicker,
|
|
4285
|
+
{
|
|
4286
|
+
mode: "range",
|
|
4287
|
+
numberOfMonths: 2,
|
|
4288
|
+
navLayout: "around",
|
|
4289
|
+
selected: selectedRange.from ? { from: selectedRange.from, to: selectedRange.to } : void 0,
|
|
4290
|
+
onSelect: handleCalendarSelect,
|
|
4291
|
+
disabled: disabledMatcher,
|
|
4292
|
+
showOutsideDays: true,
|
|
4293
|
+
autoFocus: true,
|
|
4294
|
+
defaultMonth: selectedRange.from ?? minDate ?? void 0,
|
|
4295
|
+
components: {
|
|
4296
|
+
Chevron: ({ orientation, className: chevClass }) => {
|
|
4297
|
+
const Icon3 = orientation === "right" ? ChevronRightIcon : ChevronLeftIcon;
|
|
4298
|
+
return /* @__PURE__ */ jsx(Icon3, { className: cn("text-fg-3 size-4", chevClass), "aria-hidden": "true" });
|
|
4299
|
+
}
|
|
4300
|
+
},
|
|
4301
|
+
className: "font-body text-fg select-none",
|
|
4302
|
+
classNames: {
|
|
4303
|
+
root: "p-3",
|
|
4304
|
+
months: "flex flex-col gap-6 sm:flex-row sm:gap-4",
|
|
4305
|
+
month: "relative space-y-3 w-[16rem] flex-none",
|
|
4306
|
+
// With navLayout="around", the chevron buttons live inside
|
|
4307
|
+
// the caption row, one on each side of the month title.
|
|
4308
|
+
// The caption row distributes them via space-between so
|
|
4309
|
+
// each chevron stays in its natural inline flow — no
|
|
4310
|
+
// absolute positioning gymnastics.
|
|
4311
|
+
month_caption: "flex h-7 items-center justify-center font-display text-[13px] font-medium text-fg",
|
|
4312
|
+
caption_label: "tabular-nums",
|
|
4313
|
+
nav: "contents",
|
|
4314
|
+
// navLayout="around" renders Prev as a sibling BEFORE the
|
|
4315
|
+
// left month's caption, and Next as a sibling AFTER the
|
|
4316
|
+
// right month's caption. Absolute-position each so they
|
|
4317
|
+
// sit at their own month's top corners without disturbing
|
|
4318
|
+
// the centered caption row.
|
|
4319
|
+
button_previous: "absolute left-0 top-0 z-10 inline-flex size-7 items-center justify-center rounded-input text-fg-3 transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none hover:bg-bg-2 hover:text-fg focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)] disabled:cursor-not-allowed disabled:text-fg-disabled disabled:pointer-events-none",
|
|
4320
|
+
button_next: "absolute right-0 top-0 z-10 inline-flex size-7 items-center justify-center rounded-input text-fg-3 transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none hover:bg-bg-2 hover:text-fg focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)] disabled:cursor-not-allowed disabled:text-fg-disabled disabled:pointer-events-none",
|
|
4321
|
+
month_grid: "w-full border-collapse",
|
|
4322
|
+
weekdays: "flex",
|
|
4323
|
+
weekday: "flex-1 text-center text-[11px] font-medium uppercase tracking-wide text-fg-4 pb-1",
|
|
4324
|
+
weeks: "",
|
|
4325
|
+
week: "flex w-full mt-1",
|
|
4326
|
+
day: "flex-1 text-center relative p-0",
|
|
4327
|
+
day_button: cn(
|
|
4328
|
+
"inline-flex size-8 w-full items-center justify-center rounded-input font-mono tabular-nums text-[13px] text-fg",
|
|
4329
|
+
"transition-colors duration-[var(--duration-instant)] motion-reduce:transition-none",
|
|
4330
|
+
"hover:bg-bg-2",
|
|
4331
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
4332
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:text-fg-disabled"
|
|
4333
|
+
),
|
|
4334
|
+
today: "[&_button]:font-semibold [&_button]:text-accent",
|
|
4335
|
+
range_start: "[&_button]:bg-pro-fg [&_button]:text-fg-on-pro [&_button]:hover:bg-pro-hover rounded-l-input",
|
|
4336
|
+
range_end: "[&_button]:bg-pro-fg [&_button]:text-fg-on-pro [&_button]:hover:bg-pro-hover rounded-r-input",
|
|
4337
|
+
range_middle: "[&_button]:bg-pro-bg [&_button]:text-pro-fg [&_button]:hover:bg-pro-bg-hover [&_button]:rounded-none",
|
|
4338
|
+
outside: "[&_button]:text-fg-5",
|
|
4339
|
+
disabled: "[&_button]:text-fg-disabled",
|
|
4340
|
+
hidden: "invisible"
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
)
|
|
4344
|
+
}
|
|
4345
|
+
)
|
|
4346
|
+
] }),
|
|
4347
|
+
name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4348
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}_from`, value: current.from ?? "" }),
|
|
4349
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}_to`, value: current.to ?? "" })
|
|
4350
|
+
] }),
|
|
4351
|
+
error && /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-danger-fg mt-1.5 text-xs", children: error })
|
|
4352
|
+
] });
|
|
4353
|
+
}
|
|
4354
|
+
);
|
|
4355
|
+
DateRangePicker.displayName = "DateRangePicker";
|
|
3995
4356
|
var chipVariants = cva(
|
|
3996
4357
|
cn(
|
|
3997
4358
|
"inline-flex items-center gap-1 rounded-full px-2.5 py-1",
|
|
@@ -5568,20 +5929,52 @@ var SearchInput = React36.forwardRef(
|
|
|
5568
5929
|
SearchInput.displayName = "SearchInput";
|
|
5569
5930
|
function SearchSelect({
|
|
5570
5931
|
options,
|
|
5571
|
-
selected,
|
|
5572
|
-
onSelect,
|
|
5573
|
-
onRemove,
|
|
5932
|
+
selected: selectedProp,
|
|
5933
|
+
onSelect: onSelectProp,
|
|
5934
|
+
onRemove: onRemoveProp,
|
|
5935
|
+
value,
|
|
5936
|
+
onValueChange,
|
|
5574
5937
|
onCreate,
|
|
5575
5938
|
placeholder = "Search...",
|
|
5576
5939
|
className,
|
|
5577
5940
|
disabled = false,
|
|
5578
5941
|
groupFilter = false,
|
|
5579
5942
|
pinnedGroups,
|
|
5580
|
-
closeOnSelect = false,
|
|
5943
|
+
closeOnSelect: closeOnSelectProp = false,
|
|
5581
5944
|
showGroupCounts = false,
|
|
5582
5945
|
onCreateNew,
|
|
5583
5946
|
createNewLabel = "Create new"
|
|
5584
5947
|
}) {
|
|
5948
|
+
const isSingleMode = value !== void 0 || onValueChange !== void 0;
|
|
5949
|
+
const singleSelectedOption = React36.useMemo(
|
|
5950
|
+
() => isSingleMode && value ? options.find((o) => o.id === value) ?? null : null,
|
|
5951
|
+
[isSingleMode, value, options]
|
|
5952
|
+
);
|
|
5953
|
+
const selected = React36.useMemo(
|
|
5954
|
+
() => isSingleMode ? singleSelectedOption ? [singleSelectedOption] : [] : selectedProp ?? [],
|
|
5955
|
+
[isSingleMode, singleSelectedOption, selectedProp]
|
|
5956
|
+
);
|
|
5957
|
+
const onSelect = React36.useCallback(
|
|
5958
|
+
(option) => {
|
|
5959
|
+
if (isSingleMode) {
|
|
5960
|
+
onValueChange?.(option.id);
|
|
5961
|
+
} else {
|
|
5962
|
+
onSelectProp?.(option);
|
|
5963
|
+
}
|
|
5964
|
+
},
|
|
5965
|
+
[isSingleMode, onValueChange, onSelectProp]
|
|
5966
|
+
);
|
|
5967
|
+
const onRemove = React36.useCallback(
|
|
5968
|
+
(option) => {
|
|
5969
|
+
if (isSingleMode) {
|
|
5970
|
+
onValueChange?.("");
|
|
5971
|
+
} else {
|
|
5972
|
+
onRemoveProp?.(option);
|
|
5973
|
+
}
|
|
5974
|
+
},
|
|
5975
|
+
[isSingleMode, onValueChange, onRemoveProp]
|
|
5976
|
+
);
|
|
5977
|
+
const closeOnSelect = isSingleMode || closeOnSelectProp;
|
|
5585
5978
|
const [search, setSearch] = React36.useState("");
|
|
5586
5979
|
const [open, setOpen] = React36.useState(false);
|
|
5587
5980
|
const [activeChip, setActiveChip] = React36.useState(null);
|
|
@@ -7338,7 +7731,10 @@ var NOOP_CONTEXT = {
|
|
|
7338
7731
|
},
|
|
7339
7732
|
toggle: () => {
|
|
7340
7733
|
},
|
|
7341
|
-
collapsible: false
|
|
7734
|
+
collapsible: false,
|
|
7735
|
+
peekLockCount: 0,
|
|
7736
|
+
acquirePeekLock: () => () => {
|
|
7737
|
+
}
|
|
7342
7738
|
};
|
|
7343
7739
|
function useSidebarState() {
|
|
7344
7740
|
return React36.useContext(SidebarContext) ?? NOOP_CONTEXT;
|
|
@@ -7386,6 +7782,16 @@ function SidebarProvider({
|
|
|
7386
7782
|
const toggle = React36.useCallback(() => {
|
|
7387
7783
|
setState(state === "expanded" ? "rail" : "expanded");
|
|
7388
7784
|
}, [state, setState]);
|
|
7785
|
+
const [peekLockCount, setPeekLockCount] = React36.useState(0);
|
|
7786
|
+
const acquirePeekLock = React36.useCallback(() => {
|
|
7787
|
+
setPeekLockCount((n) => n + 1);
|
|
7788
|
+
let released = false;
|
|
7789
|
+
return () => {
|
|
7790
|
+
if (released) return;
|
|
7791
|
+
released = true;
|
|
7792
|
+
setPeekLockCount((n) => Math.max(0, n - 1));
|
|
7793
|
+
};
|
|
7794
|
+
}, []);
|
|
7389
7795
|
React36.useEffect(() => {
|
|
7390
7796
|
if (!shortcut) return;
|
|
7391
7797
|
const parts = shortcut.split("+");
|
|
@@ -7407,8 +7813,8 @@ function SidebarProvider({
|
|
|
7407
7813
|
return () => window.removeEventListener("keydown", onKey);
|
|
7408
7814
|
}, [shortcut, toggle]);
|
|
7409
7815
|
const value = React36.useMemo(
|
|
7410
|
-
() => ({ state, setState, toggle, collapsible: true }),
|
|
7411
|
-
[state, setState, toggle]
|
|
7816
|
+
() => ({ state, setState, toggle, collapsible: true, peekLockCount, acquirePeekLock }),
|
|
7817
|
+
[state, setState, toggle, peekLockCount, acquirePeekLock]
|
|
7412
7818
|
);
|
|
7413
7819
|
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children });
|
|
7414
7820
|
}
|
|
@@ -7418,6 +7824,7 @@ var PEEK_LEAVE_DELAY_MS = 200;
|
|
|
7418
7824
|
var Sidebar = React36.forwardRef(function Sidebar2({ className, collapsible = false, onMouseEnter, onMouseLeave, style, ...props }, ref) {
|
|
7419
7825
|
const ctx = React36.useContext(SidebarContext);
|
|
7420
7826
|
const state = collapsible && ctx ? ctx.state : "expanded";
|
|
7827
|
+
const peekLockCount = collapsible && ctx ? ctx.peekLockCount : 0;
|
|
7421
7828
|
const [peek, setPeek] = React36.useState(false);
|
|
7422
7829
|
const enterTimer = React36.useRef(null);
|
|
7423
7830
|
const leaveTimer = React36.useRef(null);
|
|
@@ -7458,7 +7865,8 @@ var Sidebar = React36.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
7458
7865
|
if (!peek) return;
|
|
7459
7866
|
leaveTimer.current = window.setTimeout(() => setPeek(false), PEEK_LEAVE_DELAY_MS);
|
|
7460
7867
|
};
|
|
7461
|
-
const
|
|
7868
|
+
const overlay = state === "rail" && (peek || peekLockCount > 0);
|
|
7869
|
+
const labelsHidden = state === "rail" && !peek && peekLockCount === 0;
|
|
7462
7870
|
const effectiveWidth = labelsHidden ? "var(--shell-sidebar-w-rail)" : "var(--shell-sidebar-w)";
|
|
7463
7871
|
return (
|
|
7464
7872
|
// Hover-peek is *enhancement only*: the canonical way to toggle the
|
|
@@ -7473,6 +7881,7 @@ var Sidebar = React36.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
7473
7881
|
ref,
|
|
7474
7882
|
"data-state": state,
|
|
7475
7883
|
"data-peek": peek ? "true" : void 0,
|
|
7884
|
+
"data-overlay": overlay ? "true" : void 0,
|
|
7476
7885
|
"data-labels": labelsHidden ? "hide" : "show",
|
|
7477
7886
|
"data-collapsible": collapsible ? "true" : void 0,
|
|
7478
7887
|
onMouseEnter: handleEnter,
|
|
@@ -7488,9 +7897,11 @@ var Sidebar = React36.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
7488
7897
|
// doesn't repaint every frame mid-transition.
|
|
7489
7898
|
"transition-[width,box-shadow] duration-[220ms] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
7490
7899
|
"[will-change:width]",
|
|
7491
|
-
//
|
|
7492
|
-
|
|
7493
|
-
|
|
7900
|
+
// Overlay (hover-peek OR programmatic peek-lock): float above the
|
|
7901
|
+
// canvas without reflowing layout. Driven by `data-overlay` so a
|
|
7902
|
+
// single rule handles both transient sources.
|
|
7903
|
+
"data-[overlay=true]:fixed data-[overlay=true]:top-0 data-[overlay=true]:left-0",
|
|
7904
|
+
"data-[overlay=true]:z-[var(--z-overlay)] data-[overlay=true]:shadow-pop",
|
|
7494
7905
|
// Padding is held constant across states so icons keep their
|
|
7495
7906
|
// horizontal anchor when the column widens — peek expands the
|
|
7496
7907
|
// labels rightward rather than shifting the icons leftward.
|
|
@@ -7540,6 +7951,87 @@ var SidebarTrigger = React36.forwardRef(
|
|
|
7540
7951
|
}
|
|
7541
7952
|
);
|
|
7542
7953
|
SidebarTrigger.displayName = "SidebarTrigger";
|
|
7954
|
+
function useSidebarPeekLock(active) {
|
|
7955
|
+
const ctx = React36.useContext(SidebarContext);
|
|
7956
|
+
React36.useEffect(() => {
|
|
7957
|
+
if (!active || !ctx) return;
|
|
7958
|
+
const release = ctx.acquirePeekLock();
|
|
7959
|
+
return release;
|
|
7960
|
+
}, [active, ctx]);
|
|
7961
|
+
}
|
|
7962
|
+
var SidebarPinButton = React36.forwardRef(
|
|
7963
|
+
function SidebarPinButton2({
|
|
7964
|
+
pinLabel = "Pin sidebar",
|
|
7965
|
+
unpinLabel = "Unpin sidebar",
|
|
7966
|
+
className,
|
|
7967
|
+
onClick,
|
|
7968
|
+
...props
|
|
7969
|
+
}, ref) {
|
|
7970
|
+
const ctx = React36.useContext(SidebarContext);
|
|
7971
|
+
if (!ctx || !ctx.collapsible) return null;
|
|
7972
|
+
const { state, setState } = ctx;
|
|
7973
|
+
const isPinned = state === "expanded";
|
|
7974
|
+
return /* @__PURE__ */ jsx(
|
|
7975
|
+
"button",
|
|
7976
|
+
{
|
|
7977
|
+
ref,
|
|
7978
|
+
type: "button",
|
|
7979
|
+
"aria-label": isPinned ? unpinLabel : pinLabel,
|
|
7980
|
+
"aria-pressed": isPinned,
|
|
7981
|
+
onClick: (e) => {
|
|
7982
|
+
onClick?.(e);
|
|
7983
|
+
if (!e.defaultPrevented) setState(isPinned ? "rail" : "expanded");
|
|
7984
|
+
},
|
|
7985
|
+
className: cn(
|
|
7986
|
+
"inline-flex size-7 shrink-0 items-center justify-center rounded-md",
|
|
7987
|
+
"text-fg-4 hover:bg-bg-3 hover:text-fg aria-pressed:text-fg",
|
|
7988
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
7989
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
7990
|
+
// Hidden when labels are hidden (rail-no-peek-no-lock). Visible
|
|
7991
|
+
// in every overlay state so users can pin during hover or while
|
|
7992
|
+
// a dropdown holds the column open.
|
|
7993
|
+
"group-data-[labels=hide]/sidebar:hidden",
|
|
7994
|
+
className
|
|
7995
|
+
),
|
|
7996
|
+
...props,
|
|
7997
|
+
children: /* @__PURE__ */ jsx(PinGlyph, { size: 14, filled: isPinned, className: "rotate-45" })
|
|
7998
|
+
}
|
|
7999
|
+
);
|
|
8000
|
+
}
|
|
8001
|
+
);
|
|
8002
|
+
SidebarPinButton.displayName = "SidebarPinButton";
|
|
8003
|
+
function PinGlyph({
|
|
8004
|
+
size = 16,
|
|
8005
|
+
filled = false,
|
|
8006
|
+
className
|
|
8007
|
+
}) {
|
|
8008
|
+
return /* @__PURE__ */ jsxs(
|
|
8009
|
+
"svg",
|
|
8010
|
+
{
|
|
8011
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8012
|
+
width: size,
|
|
8013
|
+
height: size,
|
|
8014
|
+
viewBox: "0 0 24 24",
|
|
8015
|
+
fill: "none",
|
|
8016
|
+
stroke: "currentColor",
|
|
8017
|
+
strokeWidth: 2,
|
|
8018
|
+
strokeLinecap: "round",
|
|
8019
|
+
strokeLinejoin: "round",
|
|
8020
|
+
"aria-hidden": "true",
|
|
8021
|
+
className,
|
|
8022
|
+
children: [
|
|
8023
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17v5" }),
|
|
8024
|
+
/* @__PURE__ */ jsx(
|
|
8025
|
+
"path",
|
|
8026
|
+
{
|
|
8027
|
+
d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",
|
|
8028
|
+
fill: filled ? "currentColor" : "none"
|
|
8029
|
+
}
|
|
8030
|
+
)
|
|
8031
|
+
]
|
|
8032
|
+
}
|
|
8033
|
+
);
|
|
8034
|
+
}
|
|
7543
8035
|
var SidebarBrand = React36.forwardRef(
|
|
7544
8036
|
function SidebarBrand2({ className, ...props }, ref) {
|
|
7545
8037
|
return /* @__PURE__ */ jsx(
|
|
@@ -9006,6 +9498,6 @@ var KbdHint = forwardRef(function KbdHint2({ className, children, ...props }, re
|
|
|
9006
9498
|
});
|
|
9007
9499
|
KbdHint.displayName = "KbdHint";
|
|
9008
9500
|
|
|
9009
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityItem, ActivityList, Alert, AlertCircleIcon, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTriangleIcon, AlertTriangleSolidIcon, AppHeader, AppHeaderActions, AppHeaderBreadcrumb, AppHeaderSearch, AppHeaderTitle, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowRightSmallIcon, ArrowUpIcon, AspectRatio, AtSignIcon, Avatar, Badge, BarChartIcon, BellIcon, Blockquote, BoldIcon, Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BriefcaseIcon, Building2Icon, BuildingIcon, Button, Calendar, CalendarIcon, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatBubbleIcon, CheckCircle2Icon, CheckCircleSolidIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleDotIcon, CircleIcon, ClientSelect, ClipboardCheckIcon, ClockIcon, CloseIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, ComingSoon, CommandIcon, CommandPalette, ConfirmActionButton, Content15 as Content, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, CopyIcon, CornerDownLeftIcon, CreditCardIcon, DATE_DISPLAY_PLACEHOLDER, DangerAction, DataItem, DataTable, DataTableBody, DataTableCell, DataTableCellDue, DataTableCellId, DataTableCellMono, DataTableCellName, DataTableCheckbox, DataTableHead, DataTableHeader, DataTablePagination, DataTableResultsCount, DataTableRow, DataTableSearch, DataTableSpacer, DataTableToolbar, DatePicker, DetailGrid, DetailMain, DetailSpine, DetailSpineHeader, DetailSpineSection, DetailSpineStats, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DismissibleChip, DocumentIcon, DollarSignIcon, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EyeIcon, EyeOffIcon, Eyebrow, FileIcon, FileReturnIcon, FileTextIcon, FileUpload, FilterChip, FilterIcon, FlagIcon, FolderClosedIcon, FolderOpenIcon, FolderPlusIcon, FormError, FormSection, FormSuccess, GlobeIcon, GoogleBrandIcon, HelpCircleIcon, HistoryIcon, HomeIcon, HoverCard, HoverCardContent, HoverCardPortal, HoverCardTrigger, IconAction, InboxIcon, InfoCircleSolidIcon, InfoIcon, Input, ItalicIcon, Kanban, KanbanCard, KanbanColumn, KanbanIcon, KbdHint, KeyIcon, KeyboardShortcutsDialog, KpiCard, Label4 as Label, LayoutDashboardIcon, LayoutGridIcon, LayoutListIcon, LightningIcon, Link2Icon, LinkAction, LinkButton, LinkIcon, ListChecksIcon, ListIcon, ListOrderedIcon, LoaderIcon, LoadingRows, LockIcon, LockKeyholeIcon, LockOpenIcon, LogOutIcon, Logo, MailIcon, Main, MapPinIcon, MenuIcon, MessageCircleIcon, MessageCircleWarningIcon, MetadataGrid, MicrosoftBrandIcon, MinusIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoveIcon, MultiFilterPill, MultiSelectField, MutedSpec, NotificationFilter, NotificationItem, NotificationList, NotificationPanel, NotificationPanelHeader, Numeric, OTPInput, PageHeader, PageHeaderSep, PageHeaderSpec, Pagination, PaletteIcon, PanelLeftCloseIcon, PanelLeftIcon, PaperclipIcon, PenSignIcon, PencilIcon, PhoneIcon, PhoneInput, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, PrimaryAction, PriorityIcon, ProgressBar, ProgressRing, RadioGroup3 as RadioGroup, RadioGroupItem, ReceiptIcon, ReplyIcon, RotateCcwIcon, SaveIcon, ScrollArea, ScrollBar, SearchIcon, SearchInput, SearchSelect, SecondaryAction, Section, SectionHead, SectionHeader, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator4 as Separator, SettingsIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shell, ShieldIcon, SideDrawer, Sidebar, SidebarBrand, SidebarBrandText, SidebarFooter, SidebarLink, SidebarLinkAction, SidebarLinkBadge, SidebarLinkGroup, SidebarLinkLabel, SidebarProvider, SidebarSection, SidebarTrigger, SidebarUser, Skeleton, SkeletonCircle, SkeletonText, SlashIcon, Slider, SmartphoneIcon, SparkleIcon, SparklesIcon, StarIcon, StarRating, Stat, StatusIcon, Stepper, StrikethroughIcon, SubmitButton, SunIcon, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableIcon, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagIcon, TeamIcon, TeamMemberSelect, Textarea, ToastProvider, ToggleGroup, ToggleGroupItem, Toolbar, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Trash2Icon, TrashIcon, TrendingDownIcon, TrendingUpIcon, UnderlineIcon, UploadIcon, UserCircleIcon, UserIcon, UsersIcon, VisuallyHidden, WorkflowIcon, XCircleSolidIcon, XIcon, ZoomInIcon, ZoomOutIcon, alertVariants, badgeVariants, buttonVariants, cardVariants, cn, colors, displayToIso, filterChipVariants, inputVariants, isoToDisplay, labelVariants, progressBarVariants, progressRingVariants, radii, reference, searchInputVariants, shadows, sidebarLinkBadgeVariants, spacing, starRatingVariants, surfaces, systemTokens, textareaVariants, typography, useSidebarState, useToast };
|
|
9501
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityItem, ActivityList, Alert, AlertCircleIcon, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTriangleIcon, AlertTriangleSolidIcon, AppHeader, AppHeaderActions, AppHeaderBreadcrumb, AppHeaderSearch, AppHeaderTitle, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowRightSmallIcon, ArrowUpIcon, AspectRatio, AtSignIcon, Avatar, Badge, BarChartIcon, BellIcon, Blockquote, BoldIcon, Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BriefcaseIcon, Building2Icon, BuildingIcon, Button, Calendar, CalendarIcon, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatBubbleIcon, CheckCircle2Icon, CheckCircleSolidIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleDotIcon, CircleIcon, ClientSelect, ClipboardCheckIcon, ClockIcon, CloseIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, ComingSoon, CommandIcon, CommandPalette, ConfirmActionButton, Content15 as Content, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, CopyIcon, CornerDownLeftIcon, CreditCardIcon, DATE_DISPLAY_PLACEHOLDER, DangerAction, DataItem, DataTable, DataTableBody, DataTableCell, DataTableCellDue, DataTableCellId, DataTableCellMono, DataTableCellName, DataTableCheckbox, DataTableHead, DataTableHeader, DataTablePagination, DataTableResultsCount, DataTableRow, DataTableSearch, DataTableSpacer, DataTableToolbar, DatePicker, DateRangePicker, DetailGrid, DetailMain, DetailSpine, DetailSpineHeader, DetailSpineSection, DetailSpineStats, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DismissibleChip, DocumentIcon, DollarSignIcon, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EyeIcon, EyeOffIcon, Eyebrow, FileIcon, FileReturnIcon, FileTextIcon, FileUpload, FilterChip, FilterIcon, FlagIcon, FolderClosedIcon, FolderOpenIcon, FolderPlusIcon, FormError, FormSection, FormSuccess, GlobeIcon, GoogleBrandIcon, HelpCircleIcon, HistoryIcon, HomeIcon, HoverCard, HoverCardContent, HoverCardPortal, HoverCardTrigger, IconAction, InboxIcon, InfoCircleSolidIcon, InfoIcon, Input, ItalicIcon, Kanban, KanbanCard, KanbanColumn, KanbanIcon, KbdHint, KeyIcon, KeyboardShortcutsDialog, KpiCard, Label4 as Label, LayoutDashboardIcon, LayoutGridIcon, LayoutListIcon, LightningIcon, Link2Icon, LinkAction, LinkButton, LinkIcon, ListChecksIcon, ListIcon, ListOrderedIcon, LoaderIcon, LoadingRows, LockIcon, LockKeyholeIcon, LockOpenIcon, LogOutIcon, Logo, MailIcon, Main, MapPinIcon, MenuIcon, MessageCircleIcon, MessageCircleWarningIcon, MetadataGrid, MicrosoftBrandIcon, MinusIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoveIcon, MultiFilterPill, MultiSelectField, MutedSpec, NotificationFilter, NotificationItem, NotificationList, NotificationPanel, NotificationPanelHeader, Numeric, OTPInput, PageHeader, PageHeaderSep, PageHeaderSpec, Pagination, PaletteIcon, PanelLeftCloseIcon, PanelLeftIcon, PaperclipIcon, PenSignIcon, PencilIcon, PhoneIcon, PhoneInput, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, PrimaryAction, PriorityIcon, ProgressBar, ProgressRing, RadioGroup3 as RadioGroup, RadioGroupItem, ReceiptIcon, ReplyIcon, RotateCcwIcon, SaveIcon, ScrollArea, ScrollBar, SearchIcon, SearchInput, SearchSelect, SecondaryAction, Section, SectionHead, SectionHeader, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator4 as Separator, SettingsIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shell, ShieldIcon, SideDrawer, Sidebar, SidebarBrand, SidebarBrandText, SidebarFooter, SidebarLink, SidebarLinkAction, SidebarLinkBadge, SidebarLinkGroup, SidebarLinkLabel, SidebarPinButton, SidebarProvider, SidebarSection, SidebarTrigger, SidebarUser, Skeleton, SkeletonCircle, SkeletonText, SlashIcon, Slider, SmartphoneIcon, SparkleIcon, SparklesIcon, StarIcon, StarRating, Stat, StatusIcon, Stepper, StrikethroughIcon, SubmitButton, SunIcon, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableIcon, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagIcon, TeamIcon, TeamMemberSelect, Textarea, ToastProvider, ToggleGroup, ToggleGroupItem, Toolbar, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Trash2Icon, TrashIcon, TrendingDownIcon, TrendingUpIcon, UnderlineIcon, UploadIcon, UserCircleIcon, UserIcon, UsersIcon, VisuallyHidden, WorkflowIcon, XCircleSolidIcon, XIcon, YEAR_DISPLAY_PLACEHOLDER, ZoomInIcon, ZoomOutIcon, alertVariants, applyMask, applyYearMask, badgeVariants, buttonVariants, cardVariants, cn, colors, dateToIso, displayToIso, filterChipVariants, inputVariants, isoToDate, isoToDisplay, isoToYear, labelVariants, progressBarVariants, progressRingVariants, radii, reference, searchInputVariants, shadows, sidebarLinkBadgeVariants, spacing, starRatingVariants, surfaces, systemTokens, textareaVariants, typography, useSidebarPeekLock, useSidebarState, useToast, yearToIso };
|
|
9010
9502
|
//# sourceMappingURL=index.js.map
|
|
9011
9503
|
//# sourceMappingURL=index.js.map
|