@jsenv/navi 0.29.469 → 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.
- package/dist/dev/jsenv_navi.js +46 -2
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +46 -2
- package/dist/jsenv_navi.js.map +4 -4
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -46639,8 +46639,10 @@ const createControlInfo = (props, {
|
|
|
46639
46639
|
} else if (controlType === "details") {
|
|
46640
46640
|
statePropName = "open";
|
|
46641
46641
|
defaultStatePropName = "defaultOpen";
|
|
46642
|
-
stateInitial = props.open || props.defaultOpen;
|
|
46643
46642
|
value = props.value || "open";
|
|
46643
|
+
// Held like a checkbox: the value while open, nothing while closed — the
|
|
46644
|
+
// shape the toggle writes back (see details.jsx).
|
|
46645
|
+
stateInitial = props.open || props.defaultOpen ? value : undefined;
|
|
46644
46646
|
} else if (controlType === "picker" || controlType === "select") {
|
|
46645
46647
|
statePropName = "value";
|
|
46646
46648
|
defaultStatePropName = "defaultValue";
|
|
@@ -54674,6 +54676,9 @@ const DetailsField = props => {
|
|
|
54674
54676
|
value,
|
|
54675
54677
|
children
|
|
54676
54678
|
} = detailsProps;
|
|
54679
|
+
const {
|
|
54680
|
+
uiStateController
|
|
54681
|
+
} = controlChildrenWrapperProps;
|
|
54677
54682
|
const open = Boolean(value);
|
|
54678
54683
|
useFocusGroup(ref, {
|
|
54679
54684
|
enabled: focusGroup,
|
|
@@ -54755,6 +54760,10 @@ const DetailsField = props => {
|
|
|
54755
54760
|
return;
|
|
54756
54761
|
}
|
|
54757
54762
|
const details = ref.current;
|
|
54763
|
+
// The browser has already toggled the element (a summary press, the
|
|
54764
|
+
// arrow shortcuts): the state follows it whatever the gate says, or the
|
|
54765
|
+
// marker and whoever reads the value keep the old one.
|
|
54766
|
+
uiStateController.setUIState(details.open ? uiStateController.value : undefined, e);
|
|
54758
54767
|
dispatchRequestInteraction(details, {
|
|
54759
54768
|
event: e,
|
|
54760
54769
|
wantAction: true,
|
|
@@ -85708,7 +85717,42 @@ const Spin = ({
|
|
|
85708
85717
|
variant: "discrete",
|
|
85709
85718
|
outlineWidth: group ? undefined : "0",
|
|
85710
85719
|
textAlign: "center",
|
|
85711
|
-
expandX: true
|
|
85720
|
+
expandX: true
|
|
85721
|
+
// The arrow keys are the chevrons at the keyboard: one step the way
|
|
85722
|
+
// the spin steps (`valueAtStep`, round at the ends when it loops),
|
|
85723
|
+
// refused at a bound in the chevron's words. The field's own
|
|
85724
|
+
// stepping (input_resolver_mode) stands down on a prevented keydown.
|
|
85725
|
+
,
|
|
85726
|
+
onKeyDown: e => {
|
|
85727
|
+
controlProps?.onKeyDown?.(e);
|
|
85728
|
+
if (e.defaultPrevented) {
|
|
85729
|
+
return;
|
|
85730
|
+
}
|
|
85731
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") {
|
|
85732
|
+
return;
|
|
85733
|
+
}
|
|
85734
|
+
// Up is towards the bigger values however the spin lies: what a
|
|
85735
|
+
// field means by it, and what ▲ means on a NumberSpin.
|
|
85736
|
+
const isNext = e.key === "ArrowUp";
|
|
85737
|
+
if (!(isNext ? nextAllowed : previousAllowed)) {
|
|
85738
|
+
e.preventDefault();
|
|
85739
|
+
openCallout(boundMessage(isNext), {
|
|
85740
|
+
anchorElement: middleRef.current,
|
|
85741
|
+
status: "info",
|
|
85742
|
+
openingEvent: e
|
|
85743
|
+
});
|
|
85744
|
+
return;
|
|
85745
|
+
}
|
|
85746
|
+
dispatchRequestInteraction(e.currentTarget, {
|
|
85747
|
+
event: e,
|
|
85748
|
+
name: "--navi-arrow-up-down",
|
|
85749
|
+
prevented: () => e.preventDefault(),
|
|
85750
|
+
allowed: () => {
|
|
85751
|
+
setValue(isNext ? valueNext : valuePrevious, e);
|
|
85752
|
+
e.preventDefault();
|
|
85753
|
+
}
|
|
85754
|
+
});
|
|
85755
|
+
},
|
|
85712
85756
|
uiAction: (valueNext, event) => {
|
|
85713
85757
|
uiAction?.(valueNext, stepEventRef.current ?? event);
|
|
85714
85758
|
}
|