@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/dev/jsenv_navi.js
CHANGED
|
@@ -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,
|
|
@@ -87958,7 +87967,42 @@ const Spin = ({
|
|
|
87958
87967
|
variant: "discrete",
|
|
87959
87968
|
outlineWidth: group ? undefined : "0",
|
|
87960
87969
|
textAlign: "center",
|
|
87961
|
-
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
|
+
},
|
|
87962
88006
|
uiAction: (valueNext, event) => {
|
|
87963
88007
|
uiAction?.(valueNext, stepEventRef.current ?? event);
|
|
87964
88008
|
}
|