@jsenv/navi 0.23.3 → 0.23.5
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 +61 -5
- package/dist/jsenv_navi.js.map +20 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -21447,7 +21447,8 @@ const useUIState = (uiStateController) => {
|
|
|
21447
21447
|
return trackedUIState;
|
|
21448
21448
|
};
|
|
21449
21449
|
|
|
21450
|
-
installImportMetaCssBuild(import.meta)
|
|
21450
|
+
installImportMetaCssBuild(import.meta);/* eslint-disable jsenv/no-unknown-params */
|
|
21451
|
+
const css$r = /* css */`
|
|
21451
21452
|
@layer navi {
|
|
21452
21453
|
.navi_button {
|
|
21453
21454
|
--button-outline-width: 1px;
|
|
@@ -21508,6 +21509,13 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
|
|
|
21508
21509
|
}
|
|
21509
21510
|
}
|
|
21510
21511
|
|
|
21512
|
+
a.navi_button {
|
|
21513
|
+
color: inherit;
|
|
21514
|
+
text-decoration: none;
|
|
21515
|
+
display: inline-block;
|
|
21516
|
+
text-align: center;
|
|
21517
|
+
}
|
|
21518
|
+
|
|
21511
21519
|
.navi_button {
|
|
21512
21520
|
/* Internal vars — prefixed with --x- to signal they are private, do not use from outside */
|
|
21513
21521
|
--x-button-outline-width: var(--button-outline-width);
|
|
@@ -21706,11 +21714,40 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
|
|
|
21706
21714
|
const Button = props => {
|
|
21707
21715
|
import.meta.css = [css$r, "@jsenv/navi/src/field/button.jsx"];
|
|
21708
21716
|
return renderActionableComponent(props, {
|
|
21709
|
-
Basic:
|
|
21717
|
+
Basic: ButtonBasicDispatch,
|
|
21710
21718
|
WithAction: ButtonWithAction,
|
|
21711
21719
|
WithActionInsideForm: ButtonWithActionInsideForm
|
|
21712
21720
|
});
|
|
21713
21721
|
};
|
|
21722
|
+
const ButtonBasicDispatch = props => {
|
|
21723
|
+
if (props.route) {
|
|
21724
|
+
return jsx(ButtonWithRoute, {
|
|
21725
|
+
...props
|
|
21726
|
+
});
|
|
21727
|
+
}
|
|
21728
|
+
return jsx(ButtonBasic, {
|
|
21729
|
+
...props
|
|
21730
|
+
});
|
|
21731
|
+
};
|
|
21732
|
+
const ButtonWithRoute = ({
|
|
21733
|
+
route,
|
|
21734
|
+
routeParams,
|
|
21735
|
+
children,
|
|
21736
|
+
...rest
|
|
21737
|
+
}) => {
|
|
21738
|
+
const url = route.buildUrl(routeParams);
|
|
21739
|
+
const {
|
|
21740
|
+
matching
|
|
21741
|
+
} = useRouteStatus(route);
|
|
21742
|
+
const paramsAreMatching = route.matchesParams(routeParams);
|
|
21743
|
+
const linkMatching = matching && paramsAreMatching;
|
|
21744
|
+
return jsx(ButtonBasic, {
|
|
21745
|
+
href: url,
|
|
21746
|
+
"data-href-current": linkMatching ? "" : undefined,
|
|
21747
|
+
...rest,
|
|
21748
|
+
children: children || route.buildRelativeUrl(routeParams)
|
|
21749
|
+
});
|
|
21750
|
+
};
|
|
21714
21751
|
const ButtonStyleCSSVars = {
|
|
21715
21752
|
"outlineWidth": "--button-outline-width",
|
|
21716
21753
|
"borderWidth": "--button-border-width",
|
|
@@ -21758,6 +21795,10 @@ const ButtonBasic = props => {
|
|
|
21758
21795
|
disabled,
|
|
21759
21796
|
loading,
|
|
21760
21797
|
autoFocus,
|
|
21798
|
+
// href/link
|
|
21799
|
+
href,
|
|
21800
|
+
target,
|
|
21801
|
+
rel,
|
|
21761
21802
|
// visual
|
|
21762
21803
|
icon,
|
|
21763
21804
|
revealOnInteraction = icon,
|
|
@@ -21773,6 +21814,18 @@ const ButtonBasic = props => {
|
|
|
21773
21814
|
const innerLoading = loading || contextLoading && contextLoadingElement === ref.current;
|
|
21774
21815
|
const innerReadOnly = readOnly || contextReadOnly || innerLoading;
|
|
21775
21816
|
const innerDisabled = disabled || contextDisabled;
|
|
21817
|
+
const isLink = href !== undefined;
|
|
21818
|
+
let as = "button";
|
|
21819
|
+
let innerTarget;
|
|
21820
|
+
let innerRel;
|
|
21821
|
+
if (isLink) {
|
|
21822
|
+
as = "a";
|
|
21823
|
+
const {
|
|
21824
|
+
isSameSite
|
|
21825
|
+
} = getHrefTargetInfo(href);
|
|
21826
|
+
innerTarget = target === undefined ? isSameSite ? undefined : "_blank" : target;
|
|
21827
|
+
innerRel = rel === undefined ? isSameSite ? undefined : "noopener noreferrer" : rel;
|
|
21828
|
+
}
|
|
21776
21829
|
const renderButtonContent = buttonProps => {
|
|
21777
21830
|
return jsxs(Text, {
|
|
21778
21831
|
...buttonProps,
|
|
@@ -21785,7 +21838,10 @@ const ButtonBasic = props => {
|
|
|
21785
21838
|
return jsxs(Box, {
|
|
21786
21839
|
"data-readonly-silent": innerLoading ? "" : undefined,
|
|
21787
21840
|
...remainingProps,
|
|
21788
|
-
as:
|
|
21841
|
+
as: as,
|
|
21842
|
+
href: href,
|
|
21843
|
+
target: innerTarget,
|
|
21844
|
+
rel: innerRel,
|
|
21789
21845
|
ref: ref,
|
|
21790
21846
|
onContextMenu: e => {
|
|
21791
21847
|
if (e.pointerType === "touch") {
|
|
@@ -21859,7 +21915,7 @@ const ButtonWithAction = props => {
|
|
|
21859
21915
|
onError: onActionError,
|
|
21860
21916
|
onEnd: onActionEnd
|
|
21861
21917
|
});
|
|
21862
|
-
return jsx(
|
|
21918
|
+
return jsx(ButtonBasicDispatch
|
|
21863
21919
|
// put data-action first to help find it in devtools
|
|
21864
21920
|
, {
|
|
21865
21921
|
"data-action": boundAction.name,
|
|
@@ -21918,7 +21974,7 @@ const ButtonWithActionInsideForm = props => {
|
|
|
21918
21974
|
}
|
|
21919
21975
|
}
|
|
21920
21976
|
});
|
|
21921
|
-
return jsx(
|
|
21977
|
+
return jsx(ButtonBasicDispatch, {
|
|
21922
21978
|
"data-action": actionBoundToFormParams.name,
|
|
21923
21979
|
...rest,
|
|
21924
21980
|
ref: ref,
|