myoperator-mcp 0.2.387 → 0.2.389
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.js +37 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2576,7 +2576,7 @@ import {
|
|
|
2576
2576
|
type Strategy,
|
|
2577
2577
|
} from "@floating-ui/react-dom";
|
|
2578
2578
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
2579
|
-
import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
|
|
2579
|
+
import { ChevronDown, ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
2580
2580
|
|
|
2581
2581
|
import { cn } from "@/lib/utils";
|
|
2582
2582
|
import {
|
|
@@ -2682,6 +2682,12 @@ export interface DateRangePickerProps
|
|
|
2682
2682
|
triggerClassName?: string;
|
|
2683
2683
|
/** Additional className merged onto the trigger's label span \u2014 e.g. \`"hidden sm:inline"\` to collapse to an icon-only button below a breakpoint */
|
|
2684
2684
|
triggerLabelClassName?: string;
|
|
2685
|
+
/** Show a clear (x) button in the trigger once a range is selected. */
|
|
2686
|
+
clearable?: boolean;
|
|
2687
|
+
/** Called after the range is cleared. Fires alongside \`onValueChange({})\`. */
|
|
2688
|
+
onClear?: () => void;
|
|
2689
|
+
/** Accessible label for the clear button. Defaults to "Clear date range". */
|
|
2690
|
+
clearLabel?: string;
|
|
2685
2691
|
}
|
|
2686
2692
|
|
|
2687
2693
|
function normalizeValue(value?: DateRangeValue): DateRangeValue {
|
|
@@ -2895,6 +2901,9 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>(
|
|
|
2895
2901
|
formatRange,
|
|
2896
2902
|
triggerClassName,
|
|
2897
2903
|
triggerLabelClassName,
|
|
2904
|
+
clearable = false,
|
|
2905
|
+
onClear,
|
|
2906
|
+
clearLabel = "Clear date range",
|
|
2898
2907
|
id,
|
|
2899
2908
|
...props
|
|
2900
2909
|
},
|
|
@@ -2974,6 +2983,7 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>(
|
|
|
2974
2983
|
[visibleMonth]
|
|
2975
2984
|
);
|
|
2976
2985
|
const displayValue = (formatRange ?? defaultFormatRange)(currentValue);
|
|
2986
|
+
const showClear = clearable && !disabled && Boolean(displayValue);
|
|
2977
2987
|
const effectiveMinDate = React.useMemo(() => {
|
|
2978
2988
|
if (!disablePastDates) return minDate;
|
|
2979
2989
|
|
|
@@ -3109,6 +3119,20 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>(
|
|
|
3109
3119
|
triggerRef.current?.focus();
|
|
3110
3120
|
};
|
|
3111
3121
|
|
|
3122
|
+
const handleClear = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
3123
|
+
// The clear button sits on top of the trigger; without this the click
|
|
3124
|
+
// bubbles to the wrapper and the calendar pops open on clear.
|
|
3125
|
+
event.stopPropagation();
|
|
3126
|
+
|
|
3127
|
+
const cleared: DateRangeValue = { start: undefined, end: undefined };
|
|
3128
|
+
setDraftValue(cleared);
|
|
3129
|
+
setPendingEnd(false);
|
|
3130
|
+
commitValue(cleared);
|
|
3131
|
+
onClear?.();
|
|
3132
|
+
setOpen(false);
|
|
3133
|
+
triggerRef.current?.focus();
|
|
3134
|
+
};
|
|
3135
|
+
|
|
3112
3136
|
const handleDayClick = (day: Date) => {
|
|
3113
3137
|
if (!pendingEnd) {
|
|
3114
3138
|
setDraftValue({ start: day, end: day });
|
|
@@ -3435,6 +3459,7 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>(
|
|
|
3435
3459
|
state !== "error" &&
|
|
3436
3460
|
"border-semantic-border-input-focus/50 shadow-[0_0_0_1px_rgba(43,188,202,0.15)]",
|
|
3437
3461
|
!displayValue && "text-semantic-text-placeholder",
|
|
3462
|
+
showClear && "pr-9",
|
|
3438
3463
|
triggerClassName
|
|
3439
3464
|
)}
|
|
3440
3465
|
onClick={() => setOpen(!open)}
|
|
@@ -3451,6 +3476,17 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>(
|
|
|
3451
3476
|
</span>
|
|
3452
3477
|
</button>
|
|
3453
3478
|
|
|
3479
|
+
{showClear && (
|
|
3480
|
+
<button
|
|
3481
|
+
type="button"
|
|
3482
|
+
aria-label={clearLabel}
|
|
3483
|
+
className="absolute right-3 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center rounded-sm text-semantic-text-secondary outline-none transition-colors hover:text-semantic-text-primary focus-visible:ring-2 focus-visible:ring-semantic-border-focus"
|
|
3484
|
+
onClick={handleClear}
|
|
3485
|
+
>
|
|
3486
|
+
<X className="size-4" />
|
|
3487
|
+
</button>
|
|
3488
|
+
)}
|
|
3489
|
+
|
|
3454
3490
|
{popover}
|
|
3455
3491
|
</div>
|
|
3456
3492
|
);
|
package/package.json
CHANGED