@jsenv/navi 0.26.1 → 0.26.2
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/jsenv_navi.js +20 -8
- package/dist/jsenv_navi.js.map +21 -16
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -6836,9 +6836,9 @@ const TYPO_SIZE_MAP = {
|
|
|
6836
6836
|
xxl: "var(--navi-typo-xxl)",
|
|
6837
6837
|
};
|
|
6838
6838
|
Object.assign(TYPO_SIZE_MAP, negativeEntries(TYPO_SIZE_MAP));
|
|
6839
|
-
const
|
|
6840
|
-
const
|
|
6841
|
-
return
|
|
6839
|
+
const sizeSpacingKeySet = new Set(Object.keys(SIZE_MAP));
|
|
6840
|
+
const isSizeSpacingKey = (key) => {
|
|
6841
|
+
return sizeSpacingKeySet.has(key);
|
|
6842
6842
|
};
|
|
6843
6843
|
const resolveSpacingSize = (size, property = "padding") => {
|
|
6844
6844
|
return stringifyStyle(SIZE_MAP[size] || size, property);
|
|
@@ -20962,6 +20962,13 @@ const CustomWidthSpace = ({
|
|
|
20962
20962
|
useRealSpaceChar
|
|
20963
20963
|
}) => {
|
|
20964
20964
|
if (useRealSpaceChar) {
|
|
20965
|
+
// Two-span trick: we want a real space character in the DOM so that
|
|
20966
|
+
// copy-pasting the text produces an actual space, but we also want
|
|
20967
|
+
// full control over the visual width of that gap.
|
|
20968
|
+
// - First span: contains the real space but rendered at font-size:0 so it
|
|
20969
|
+
// takes up zero visual space.
|
|
20970
|
+
// - Second span: a zero-width joiner (​) with padding-left set to
|
|
20971
|
+
// the desired gap size. This is the only visible part.
|
|
20965
20972
|
return jsxs("span", {
|
|
20966
20973
|
children: [jsx("span", {
|
|
20967
20974
|
style: "font-size: 0",
|
|
@@ -20994,7 +21001,13 @@ const applySpacingOnTextChildren = (children, spacing, defaultSpace) => {
|
|
|
20994
21001
|
if (spacing === REGULAR_SPACE || spacing === FAKE_SPACE) {
|
|
20995
21002
|
separator = defaultSpace;
|
|
20996
21003
|
} else if (typeof spacing === "string") {
|
|
20997
|
-
if (
|
|
21004
|
+
if (isSizeSpacingKey(spacing)) {
|
|
21005
|
+
const value = resolveSpacingSize(spacing);
|
|
21006
|
+
separator = jsx(CustomWidthSpace, {
|
|
21007
|
+
value: value,
|
|
21008
|
+
useRealSpaceChar: useRealSpaceChar
|
|
21009
|
+
});
|
|
21010
|
+
} else if (hasCSSSizeUnit(spacing) || spacing.startsWith("var(")) {
|
|
20998
21011
|
separator = jsx(CustomWidthSpace, {
|
|
20999
21012
|
value: spacing,
|
|
21000
21013
|
useRealSpaceChar: useRealSpaceChar
|
|
@@ -22782,7 +22795,9 @@ const ButtonDispatcher = props => {
|
|
|
22782
22795
|
});
|
|
22783
22796
|
};
|
|
22784
22797
|
const ButtonUI = props => {
|
|
22798
|
+
import.meta.css = [css$x, "@jsenv/navi/src/field/button.jsx"];
|
|
22785
22799
|
const {
|
|
22800
|
+
ref,
|
|
22786
22801
|
readOnly,
|
|
22787
22802
|
disabled,
|
|
22788
22803
|
loading,
|
|
@@ -22799,13 +22814,10 @@ const ButtonUI = props => {
|
|
|
22799
22814
|
children,
|
|
22800
22815
|
...rest
|
|
22801
22816
|
} = props;
|
|
22802
|
-
import.meta.css = [css$x, "@jsenv/navi/src/field/button.jsx"];
|
|
22803
22817
|
const contextLoading = useContext(LoadingContext);
|
|
22804
22818
|
const contextLoadingElement = useContext(LoadingElementContext);
|
|
22805
22819
|
const contextReadOnly = useContext(ReadOnlyContext);
|
|
22806
22820
|
const contextDisabled = useContext(DisabledContext);
|
|
22807
|
-
const defaultRef = useRef();
|
|
22808
|
-
const ref = props.ref || defaultRef;
|
|
22809
22821
|
useAutoFocus(ref, autoFocus);
|
|
22810
22822
|
const remainingProps = useConstraints(ref, rest);
|
|
22811
22823
|
const innerLoading = loading || contextLoading && contextLoadingElement === ref.current;
|
|
@@ -22839,6 +22851,7 @@ const ButtonUI = props => {
|
|
|
22839
22851
|
return jsxs(Box, {
|
|
22840
22852
|
"data-readonly-silent": innerLoading ? "" : undefined,
|
|
22841
22853
|
...remainingProps,
|
|
22854
|
+
ref: ref,
|
|
22842
22855
|
autFocus: undefined // See use_auto_focus.js
|
|
22843
22856
|
,
|
|
22844
22857
|
|
|
@@ -22846,7 +22859,6 @@ const ButtonUI = props => {
|
|
|
22846
22859
|
href: href,
|
|
22847
22860
|
target: innerTarget,
|
|
22848
22861
|
rel: innerRel,
|
|
22849
|
-
ref: ref,
|
|
22850
22862
|
onContextMenu: e => {
|
|
22851
22863
|
if (as === "a") {
|
|
22852
22864
|
// For link we keep context menu to allow "open in new tab" and other browser features
|