@assure-one/design-system 0.10.0 → 0.11.2
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 +177 -8
- package/dist/index.js +614 -48
- 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);
|
|
@@ -8033,6 +8426,179 @@ var SidebarUser = React36.forwardRef(function SidebarUser2({ name, subtitle, ava
|
|
|
8033
8426
|
] });
|
|
8034
8427
|
});
|
|
8035
8428
|
SidebarUser.displayName = "SidebarUser";
|
|
8429
|
+
var SidebarBrandSwitcher = React36.forwardRef(
|
|
8430
|
+
function SidebarBrandSwitcher2({
|
|
8431
|
+
brand,
|
|
8432
|
+
label,
|
|
8433
|
+
current,
|
|
8434
|
+
items,
|
|
8435
|
+
onLaunch,
|
|
8436
|
+
currentSectionLabel = "Currently using",
|
|
8437
|
+
switchSectionLabel = "Switch to",
|
|
8438
|
+
menuLabel = "Suite",
|
|
8439
|
+
currentBadge = "Current",
|
|
8440
|
+
unavailableBadge = "Soon",
|
|
8441
|
+
triggerLabel = "Switch product",
|
|
8442
|
+
className,
|
|
8443
|
+
triggerClassName,
|
|
8444
|
+
contentClassName,
|
|
8445
|
+
trailing
|
|
8446
|
+
}, ref) {
|
|
8447
|
+
const [open, setOpen] = React36.useState(false);
|
|
8448
|
+
useSidebarPeekLock(open);
|
|
8449
|
+
const others = items.filter((p) => p.id !== current.id);
|
|
8450
|
+
return (
|
|
8451
|
+
// Geometry mirrors <SidebarBrand>: `px-2 pt-1 pb-4 gap-2`. This is
|
|
8452
|
+
// deliberate — the switcher replaces SidebarBrand, so the brand
|
|
8453
|
+
// glyph must land at the same column x-position that direct children
|
|
8454
|
+
// of <SidebarBrand> sit at, otherwise the brand row drifts off-axis
|
|
8455
|
+
// from the icons below it.
|
|
8456
|
+
/* @__PURE__ */ jsxs(
|
|
8457
|
+
"div",
|
|
8458
|
+
{
|
|
8459
|
+
ref,
|
|
8460
|
+
className: cn("flex min-w-0 items-center gap-2 px-2 pt-1 pb-4", className),
|
|
8461
|
+
children: [
|
|
8462
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
8463
|
+
/* @__PURE__ */ jsxs(
|
|
8464
|
+
DropdownMenuTrigger,
|
|
8465
|
+
{
|
|
8466
|
+
"aria-label": triggerLabel,
|
|
8467
|
+
className: cn(
|
|
8468
|
+
// Negative left margin pulls the trigger's hover-bg toward
|
|
8469
|
+
// the column edge while the inner padding holds the brand
|
|
8470
|
+
// glyph at the same x-position as direct <SidebarBrand>
|
|
8471
|
+
// children — same hover affordance, no glyph drift.
|
|
8472
|
+
"group/brand-trigger -ml-1.5 flex min-w-0 flex-1 items-center gap-2 rounded-md py-1.5 pr-1.5 pl-1.5",
|
|
8473
|
+
"text-fg transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
8474
|
+
"hover:bg-bg-3 data-[state=open]:bg-bg-3",
|
|
8475
|
+
"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-focus-ring)]",
|
|
8476
|
+
triggerClassName
|
|
8477
|
+
),
|
|
8478
|
+
children: [
|
|
8479
|
+
brand,
|
|
8480
|
+
/* @__PURE__ */ jsx(SidebarBrandText, { className: "font-display text-fg text-[17px] font-semibold tracking-tight", children: label }),
|
|
8481
|
+
/* @__PURE__ */ jsx(
|
|
8482
|
+
ChevronDownIcon,
|
|
8483
|
+
{
|
|
8484
|
+
className: cn(
|
|
8485
|
+
"ml-auto size-3.5 shrink-0 text-fg-4",
|
|
8486
|
+
"transition-transform duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
8487
|
+
"group-data-[state=open]/brand-trigger:rotate-180",
|
|
8488
|
+
"group-data-[labels=hide]/sidebar:hidden"
|
|
8489
|
+
)
|
|
8490
|
+
}
|
|
8491
|
+
)
|
|
8492
|
+
]
|
|
8493
|
+
}
|
|
8494
|
+
),
|
|
8495
|
+
/* @__PURE__ */ jsxs(
|
|
8496
|
+
DropdownMenuContent,
|
|
8497
|
+
{
|
|
8498
|
+
side: "right",
|
|
8499
|
+
align: "start",
|
|
8500
|
+
sideOffset: 12,
|
|
8501
|
+
className: cn("w-72 p-1", contentClassName),
|
|
8502
|
+
children: [
|
|
8503
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "px-2 pt-1 pb-1.5", children: menuLabel }),
|
|
8504
|
+
/* @__PURE__ */ jsx(SidebarBrandSwitcherSectionLabel, { children: currentSectionLabel }),
|
|
8505
|
+
/* @__PURE__ */ jsx(SidebarBrandSwitcherCurrentRow, { item: current, badge: currentBadge }),
|
|
8506
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1.5" }),
|
|
8507
|
+
/* @__PURE__ */ jsx(SidebarBrandSwitcherSectionLabel, { children: switchSectionLabel }),
|
|
8508
|
+
others.map((p) => /* @__PURE__ */ jsx(
|
|
8509
|
+
SidebarBrandSwitcherOtherRow,
|
|
8510
|
+
{
|
|
8511
|
+
item: p,
|
|
8512
|
+
onLaunch,
|
|
8513
|
+
unavailableBadge
|
|
8514
|
+
},
|
|
8515
|
+
p.id
|
|
8516
|
+
))
|
|
8517
|
+
]
|
|
8518
|
+
}
|
|
8519
|
+
)
|
|
8520
|
+
] }),
|
|
8521
|
+
trailing
|
|
8522
|
+
]
|
|
8523
|
+
}
|
|
8524
|
+
)
|
|
8525
|
+
);
|
|
8526
|
+
}
|
|
8527
|
+
);
|
|
8528
|
+
SidebarBrandSwitcher.displayName = "SidebarBrandSwitcher";
|
|
8529
|
+
function SidebarBrandSwitcherSectionLabel({ children }) {
|
|
8530
|
+
return /* @__PURE__ */ jsx("div", { className: "px-2 pt-1 pb-0.5 text-[10px] tracking-wider uppercase text-fg-4", children });
|
|
8531
|
+
}
|
|
8532
|
+
function SidebarBrandSwitcherTile({ item }) {
|
|
8533
|
+
if (item.glyph) return /* @__PURE__ */ jsx(Fragment, { children: item.glyph });
|
|
8534
|
+
const initial = (item.short ?? item.name).charAt(0).toUpperCase();
|
|
8535
|
+
return /* @__PURE__ */ jsx(
|
|
8536
|
+
"span",
|
|
8537
|
+
{
|
|
8538
|
+
"aria-hidden": true,
|
|
8539
|
+
className: cn(
|
|
8540
|
+
"inline-flex size-6 shrink-0 items-center justify-center rounded-md",
|
|
8541
|
+
"text-[11px] font-semibold text-white",
|
|
8542
|
+
item.tone
|
|
8543
|
+
),
|
|
8544
|
+
children: initial
|
|
8545
|
+
}
|
|
8546
|
+
);
|
|
8547
|
+
}
|
|
8548
|
+
function SidebarBrandSwitcherCurrentRow({
|
|
8549
|
+
item,
|
|
8550
|
+
badge
|
|
8551
|
+
}) {
|
|
8552
|
+
return /* @__PURE__ */ jsxs("div", { className: "mx-0 flex cursor-default items-center gap-2.5 rounded-md bg-bg-2 px-2 py-1.5", children: [
|
|
8553
|
+
/* @__PURE__ */ jsx(SidebarBrandSwitcherTile, { item }),
|
|
8554
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
8555
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-medium", children: item.name }),
|
|
8556
|
+
item.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px]", children: item.tagline })
|
|
8557
|
+
] }),
|
|
8558
|
+
badge && /* @__PURE__ */ jsx("span", { className: "rounded-sm px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-pro-fg ring-1 ring-pro-fg/30", children: badge })
|
|
8559
|
+
] });
|
|
8560
|
+
}
|
|
8561
|
+
function SidebarBrandSwitcherOtherRow({
|
|
8562
|
+
item,
|
|
8563
|
+
onLaunch,
|
|
8564
|
+
unavailableBadge
|
|
8565
|
+
}) {
|
|
8566
|
+
const reachable = item.available !== false;
|
|
8567
|
+
const [launching, setLaunching] = React36.useState(false);
|
|
8568
|
+
const handleSelect = async () => {
|
|
8569
|
+
if (!reachable || launching || !onLaunch) return;
|
|
8570
|
+
setLaunching(true);
|
|
8571
|
+
try {
|
|
8572
|
+
await onLaunch(item);
|
|
8573
|
+
} finally {
|
|
8574
|
+
setLaunching(false);
|
|
8575
|
+
}
|
|
8576
|
+
};
|
|
8577
|
+
return /* @__PURE__ */ jsxs(
|
|
8578
|
+
DropdownMenuItem,
|
|
8579
|
+
{
|
|
8580
|
+
disabled: !reachable,
|
|
8581
|
+
onSelect: (e) => {
|
|
8582
|
+
if (!reachable) {
|
|
8583
|
+
e.preventDefault();
|
|
8584
|
+
return;
|
|
8585
|
+
}
|
|
8586
|
+
void handleSelect();
|
|
8587
|
+
},
|
|
8588
|
+
"data-item": item.dataAttr ?? item.id,
|
|
8589
|
+
className: "flex items-center gap-2.5 rounded-md px-2 py-1.5",
|
|
8590
|
+
children: [
|
|
8591
|
+
/* @__PURE__ */ jsx(SidebarBrandSwitcherTile, { item }),
|
|
8592
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
8593
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-medium", children: item.name }),
|
|
8594
|
+
item.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px]", children: item.tagline })
|
|
8595
|
+
] }),
|
|
8596
|
+
!reachable && unavailableBadge && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: unavailableBadge }),
|
|
8597
|
+
reachable && launching && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: "Opening\u2026" })
|
|
8598
|
+
]
|
|
8599
|
+
}
|
|
8600
|
+
);
|
|
8601
|
+
}
|
|
8036
8602
|
var AppHeader = forwardRef(function AppHeader2({ className, ...props }, ref) {
|
|
8037
8603
|
return /* @__PURE__ */ jsx(
|
|
8038
8604
|
"header",
|
|
@@ -9105,6 +9671,6 @@ var KbdHint = forwardRef(function KbdHint2({ className, children, ...props }, re
|
|
|
9105
9671
|
});
|
|
9106
9672
|
KbdHint.displayName = "KbdHint";
|
|
9107
9673
|
|
|
9108
|
-
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, 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, 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, useSidebarPeekLock, useSidebarState, useToast };
|
|
9674
|
+
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, SidebarBrandSwitcher, SidebarBrandSwitcherTile, 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 };
|
|
9109
9675
|
//# sourceMappingURL=index.js.map
|
|
9110
9676
|
//# sourceMappingURL=index.js.map
|