@jsenv/navi 0.29.376 → 0.29.377

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.
@@ -34174,10 +34174,18 @@ registerNaviCommand("--navi-define", (source, event) => {
34174
34174
  implementation: () => executeNaviDefine(source, event, target),
34175
34175
  };
34176
34176
  });
34177
+ // A send whose target is the popup itself: what is around the source IS the
34178
+ // popup's answer, and a picker runs its action with that answer as it closes
34179
+ // (see onRequestClose in picker_custom.jsx) — dispatching the action here too
34180
+ // would run it twice. `isSend` tells this close from a dismissal (the cross,
34181
+ // a press outside, Escape): the person pressed a choice, which a picker may
34182
+ // act on even when the choice is the one it already held.
34177
34183
  const executeNaviDefine = (source, event, target) => {
34178
- // The picker's onClose already dispatches the action with the final value.
34179
- // Dispatching again here would fire the action twice.
34180
- return triggerNaviCommand(target, "--navi-close", event);
34184
+ return dispatchCustomEvent(target, "navi_request_close", {
34185
+ event,
34186
+ source: resolveCommandProxySource(source),
34187
+ isSend: true,
34188
+ });
34181
34189
  };
34182
34190
 
34183
34191
  registerNaviCommand("--navi-scroll", (source, event) => {
@@ -64673,6 +64681,9 @@ const PickerCustom = props => {
64673
64681
  // closed on it. A confirm picker is the one saying something (see
64674
64682
  // picker_confirm.jsx): its press, deferred until the question is answered.
64675
64683
  onConfirm,
64684
+ // A choice pressed inside the popup runs `action` even when it is the one
64685
+ // the picker already held. See the JSDoc.
64686
+ canSendWhileUnchanged,
64676
64687
  // The popup's lifecycle, the same pair Dialog and Popover take. Taken on
64677
64688
  // the picker and chained into its own openController below: the picker
64678
64689
  // hands the popup that controller, and a controlled Dialog/Popover reads
@@ -64715,6 +64726,7 @@ const PickerCustom = props => {
64715
64726
  delete pickerProps.defaultOpen;
64716
64727
  delete pickerProps.escapeEffect;
64717
64728
  delete pickerProps.onConfirm;
64729
+ delete pickerProps.canSendWhileUnchanged;
64718
64730
  delete pickerProps.onOpen;
64719
64731
  delete pickerProps.onClose;
64720
64732
  delete pickerProps.openOn;
@@ -64814,8 +64826,17 @@ const PickerCustom = props => {
64814
64826
  // suggestion to accept, and confirming `undefined` cannot mean
64815
64827
  // anything. A picker on a defaultValue is untouched by this: it
64816
64828
  // shows something, so closing on it still confirms it.
64817
- // No action to run, but still allow the close.
64818
- return;
64829
+ //
64830
+ // Unless the close is a choice PRESSED inside the popup (a row's
64831
+ // `--navi-send`, a `--navi-confirm`) on a picker that asked to
64832
+ // send while unchanged: the person picked what was already picked,
64833
+ // and for that picker the same value said again means something.
64834
+ // A press outside, Escape, the cross say nothing and keep skipping.
64835
+ const said = requestCloseEvent.detail.isSend || confirmEventRef.current;
64836
+ if (!(canSendWhileUnchanged && said)) {
64837
+ // No action to run, but still allow the close.
64838
+ return;
64839
+ }
64819
64840
  }
64820
64841
  dispatchRequestAction(inputEl, {
64821
64842
  event: requestCloseEvent,
@@ -64998,7 +65019,8 @@ const PickerCustom = props => {
64998
65019
  intent: "read",
64999
65020
  allowed: () => {
65000
65021
  const closing = requestClose(e, {
65001
- isCancel: e.detail.isCancel
65022
+ isCancel: e.detail.isCancel,
65023
+ isSend: e.detail.isSend
65002
65024
  });
65003
65025
  if (!closing) {
65004
65026
  e.preventDefault();