myoperator-mcp 0.2.390 → 0.2.392
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 +62 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3595,7 +3595,8 @@ const dateTimePickerTriggerVariants = cva(
|
|
|
3595
3595
|
},
|
|
3596
3596
|
state: {
|
|
3597
3597
|
default: "",
|
|
3598
|
-
error:
|
|
3598
|
+
error:
|
|
3599
|
+
"border-[var(--semantic-error-primary,#F04438)] hover:border-[var(--semantic-error-primary,#F04438)]",
|
|
3599
3600
|
},
|
|
3600
3601
|
},
|
|
3601
3602
|
defaultVariants: {
|
|
@@ -3650,6 +3651,16 @@ export interface DateTimePickerProps
|
|
|
3650
3651
|
defaultOpen?: boolean;
|
|
3651
3652
|
onOpenChange?: (open: boolean) => void;
|
|
3652
3653
|
portalContainer?: HTMLElement | null;
|
|
3654
|
+
/** Shows a footer with Cancel and OK actions */
|
|
3655
|
+
showActions?: boolean;
|
|
3656
|
+
/** Label for the OK action */
|
|
3657
|
+
okLabel?: string;
|
|
3658
|
+
/** Label for the Cancel action */
|
|
3659
|
+
cancelLabel?: string;
|
|
3660
|
+
/** Called when OK is pressed, with the confirmed value */
|
|
3661
|
+
onOk?: (value: DateTimePickerValue) => void;
|
|
3662
|
+
/** Called when Cancel is pressed, after the value is restored */
|
|
3663
|
+
onCancel?: () => void;
|
|
3653
3664
|
}
|
|
3654
3665
|
|
|
3655
3666
|
type DateTimePickerVariant = NonNullable<
|
|
@@ -4958,6 +4969,11 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
4958
4969
|
defaultOpen = false,
|
|
4959
4970
|
onOpenChange,
|
|
4960
4971
|
portalContainer,
|
|
4972
|
+
showActions = false,
|
|
4973
|
+
okLabel = "OK",
|
|
4974
|
+
cancelLabel = "Cancel",
|
|
4975
|
+
onOk,
|
|
4976
|
+
onCancel,
|
|
4961
4977
|
id,
|
|
4962
4978
|
...props
|
|
4963
4979
|
},
|
|
@@ -5081,8 +5097,8 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
5081
5097
|
);
|
|
5082
5098
|
const hasValue = Boolean(
|
|
5083
5099
|
currentValue.date ||
|
|
5084
|
-
|
|
5085
|
-
|
|
5100
|
+
currentValue.startTime ||
|
|
5101
|
+
(resolvedShowEndTime && currentValue.endTime)
|
|
5086
5102
|
);
|
|
5087
5103
|
const effectiveMinDate = React.useMemo(() => {
|
|
5088
5104
|
if (!disablePastDates) return minDate;
|
|
@@ -5182,6 +5198,26 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
5182
5198
|
[isValueControlled, onValueChange]
|
|
5183
5199
|
);
|
|
5184
5200
|
|
|
5201
|
+
// Value at the moment the popover opened, so Cancel can restore it.
|
|
5202
|
+
const openSnapshotRef = React.useRef<DateTimePickerValue | null>(null);
|
|
5203
|
+
React.useEffect(() => {
|
|
5204
|
+
openSnapshotRef.current = open ? currentValue : null;
|
|
5205
|
+
// Only re-snapshot when the popover opens, not on every value change.
|
|
5206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5207
|
+
}, [open]);
|
|
5208
|
+
|
|
5209
|
+
const handleCancel = () => {
|
|
5210
|
+
const snapshot = openSnapshotRef.current;
|
|
5211
|
+
if (snapshot) updateValue(snapshot);
|
|
5212
|
+
setOpen(false);
|
|
5213
|
+
onCancel?.();
|
|
5214
|
+
};
|
|
5215
|
+
|
|
5216
|
+
const handleOk = () => {
|
|
5217
|
+
setOpen(false);
|
|
5218
|
+
onOk?.(currentValue);
|
|
5219
|
+
};
|
|
5220
|
+
|
|
5185
5221
|
const clearValue = (event: React.MouseEvent<HTMLElement>) => {
|
|
5186
5222
|
event.stopPropagation();
|
|
5187
5223
|
if (readOnly) return;
|
|
@@ -5661,6 +5697,26 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
5661
5697
|
</div>
|
|
5662
5698
|
)}
|
|
5663
5699
|
|
|
5700
|
+
{showActions && (
|
|
5701
|
+
<div className="flex items-center justify-end gap-2 border-t border-solid border-[var(--semantic-border-layout,#E9EAEB)] px-3 py-2">
|
|
5702
|
+
<div className="flex items-center gap-2">
|
|
5703
|
+
<button
|
|
5704
|
+
type="button"
|
|
5705
|
+
className="rounded px-2 py-1.5 text-sm font-semibold text-[var(--semantic-text-link,#4275D6)] transition-colors hover:bg-[var(--semantic-bg-ui,#F5F5F5)]"
|
|
5706
|
+
onClick={handleCancel}
|
|
5707
|
+
>
|
|
5708
|
+
{cancelLabel}
|
|
5709
|
+
</button>
|
|
5710
|
+
<button
|
|
5711
|
+
type="button"
|
|
5712
|
+
className="rounded px-2 py-1.5 text-sm font-semibold text-[var(--semantic-text-link,#4275D6)] transition-colors hover:bg-[var(--semantic-bg-ui,#F5F5F5)]"
|
|
5713
|
+
onClick={handleOk}
|
|
5714
|
+
>
|
|
5715
|
+
{okLabel}
|
|
5716
|
+
</button>
|
|
5717
|
+
</div>
|
|
5718
|
+
</div>
|
|
5719
|
+
)}
|
|
5664
5720
|
</div>,
|
|
5665
5721
|
portalMount
|
|
5666
5722
|
);
|
|
@@ -5701,7 +5757,9 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
5701
5757
|
>
|
|
5702
5758
|
{label}
|
|
5703
5759
|
{required && (
|
|
5704
|
-
<span className="text-[var(--semantic-error-primary,#F04438)] ml-0.5"
|
|
5760
|
+
<span className="text-[var(--semantic-error-primary,#F04438)] ml-0.5">
|
|
5761
|
+
*
|
|
5762
|
+
</span>
|
|
5705
5763
|
)}
|
|
5706
5764
|
</label>
|
|
5707
5765
|
)}
|
package/package.json
CHANGED