@jsenv/navi 0.29.468 → 0.29.470

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.
@@ -47811,8 +47811,10 @@ const createControlInfo = (props, {
47811
47811
  } else if (controlType === "details") {
47812
47812
  statePropName = "open";
47813
47813
  defaultStatePropName = "defaultOpen";
47814
- stateInitial = props.open || props.defaultOpen;
47815
47814
  value = props.value || "open";
47815
+ // Held like a checkbox: the value while open, nothing while closed — the
47816
+ // shape the toggle writes back (see details.jsx).
47817
+ stateInitial = props.open || props.defaultOpen ? value : undefined;
47816
47818
  } else if (controlType === "picker" || controlType === "select") {
47817
47819
  statePropName = "value";
47818
47820
  defaultStatePropName = "defaultValue";
@@ -55877,6 +55879,9 @@ const DetailsField = props => {
55877
55879
  value,
55878
55880
  children
55879
55881
  } = detailsProps;
55882
+ const {
55883
+ uiStateController
55884
+ } = controlChildrenWrapperProps;
55880
55885
  const open = Boolean(value);
55881
55886
  useFocusGroup(ref, {
55882
55887
  enabled: focusGroup,
@@ -55958,6 +55963,10 @@ const DetailsField = props => {
55958
55963
  return;
55959
55964
  }
55960
55965
  const details = ref.current;
55966
+ // The browser has already toggled the element (a summary press, the
55967
+ // arrow shortcuts): the state follows it whatever the gate says, or the
55968
+ // marker and whoever reads the value keep the old one.
55969
+ uiStateController.setUIState(details.open ? uiStateController.value : undefined, e);
55961
55970
  dispatchRequestInteraction(details, {
55962
55971
  event: e,
55963
55972
  wantAction: true,
@@ -78871,6 +78880,13 @@ const useListScrollSync = ({
78871
78880
  // the selected item for as long as the hold takes to put it back.
78872
78881
  return;
78873
78882
  }
78883
+ if (getScroller() === document.scrollingElement) {
78884
+ // Where the document opens is the arrival's (see scroll_restoration.js),
78885
+ // and a list asks for a place in it through `defaultScrolled`. A box
78886
+ // around the list (a popup's body) has no other owner, so the selected
78887
+ // item is still centered there.
78888
+ return;
78889
+ }
78874
78890
  const items = listItems.itemsSignal.peek();
78875
78891
  const firstSelected = items.find(i => {
78876
78892
  if (i.selected) {
@@ -87951,7 +87967,42 @@ const Spin = ({
87951
87967
  variant: "discrete",
87952
87968
  outlineWidth: group ? undefined : "0",
87953
87969
  textAlign: "center",
87954
- expandX: true,
87970
+ expandX: true
87971
+ // The arrow keys are the chevrons at the keyboard: one step the way
87972
+ // the spin steps (`valueAtStep`, round at the ends when it loops),
87973
+ // refused at a bound in the chevron's words. The field's own
87974
+ // stepping (input_resolver_mode) stands down on a prevented keydown.
87975
+ ,
87976
+ onKeyDown: e => {
87977
+ controlProps?.onKeyDown?.(e);
87978
+ if (e.defaultPrevented) {
87979
+ return;
87980
+ }
87981
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") {
87982
+ return;
87983
+ }
87984
+ // Up is towards the bigger values however the spin lies: what a
87985
+ // field means by it, and what ▲ means on a NumberSpin.
87986
+ const isNext = e.key === "ArrowUp";
87987
+ if (!(isNext ? nextAllowed : previousAllowed)) {
87988
+ e.preventDefault();
87989
+ openCallout(boundMessage(isNext), {
87990
+ anchorElement: middleRef.current,
87991
+ status: "info",
87992
+ openingEvent: e
87993
+ });
87994
+ return;
87995
+ }
87996
+ dispatchRequestInteraction(e.currentTarget, {
87997
+ event: e,
87998
+ name: "--navi-arrow-up-down",
87999
+ prevented: () => e.preventDefault(),
88000
+ allowed: () => {
88001
+ setValue(isNext ? valueNext : valuePrevious, e);
88002
+ e.preventDefault();
88003
+ }
88004
+ });
88005
+ },
87955
88006
  uiAction: (valueNext, event) => {
87956
88007
  uiAction?.(valueNext, stepEventRef.current ?? event);
87957
88008
  }