@jsenv/navi 0.18.0 → 0.18.1
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 +53 -47
- package/dist/jsenv_navi.js.map +17 -11
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -18033,6 +18033,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
18033
18033
|
.navi_icon_foreground {
|
|
18034
18034
|
position: absolute;
|
|
18035
18035
|
inset: 0;
|
|
18036
|
+
display: inline-flex;
|
|
18036
18037
|
}
|
|
18037
18038
|
.navi_icon_foreground > .navi_text {
|
|
18038
18039
|
display: flex;
|
|
@@ -20650,6 +20651,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
20650
20651
|
--link-text-decoration-hover: var(--link-text-decoration);
|
|
20651
20652
|
--link-cursor: pointer;
|
|
20652
20653
|
--link-loading-outline-size: 1px;
|
|
20654
|
+
--link-color-current: var(--link-color);
|
|
20653
20655
|
}
|
|
20654
20656
|
}
|
|
20655
20657
|
|
|
@@ -21106,6 +21108,8 @@ const LinkWithAction = props => {
|
|
|
21106
21108
|
});
|
|
21107
21109
|
};
|
|
21108
21110
|
|
|
21111
|
+
const ReportSelectedOnTabContext = createContext();
|
|
21112
|
+
|
|
21109
21113
|
const RouteLink = ({
|
|
21110
21114
|
route,
|
|
21111
21115
|
routeParams,
|
|
@@ -21115,13 +21119,16 @@ const RouteLink = ({
|
|
|
21115
21119
|
if (!route) {
|
|
21116
21120
|
throw new Error("route prop is required");
|
|
21117
21121
|
}
|
|
21122
|
+
const url = route.buildUrl(routeParams);
|
|
21123
|
+
const reportSelectedOnTab = useContext(ReportSelectedOnTabContext);
|
|
21118
21124
|
const {
|
|
21119
21125
|
matching
|
|
21120
21126
|
} = useRouteStatus(route);
|
|
21121
21127
|
const paramsAreMatching = route.matchesParams(routeParams);
|
|
21122
|
-
const
|
|
21128
|
+
const linkMatching = matching && paramsAreMatching;
|
|
21129
|
+
reportSelectedOnTab?.(linkMatching);
|
|
21123
21130
|
return jsx(Link, {
|
|
21124
|
-
matching:
|
|
21131
|
+
matching: linkMatching,
|
|
21125
21132
|
href: url,
|
|
21126
21133
|
...rest,
|
|
21127
21134
|
children: children || route.buildRelativeUrl(routeParams)
|
|
@@ -21427,6 +21434,50 @@ const Tab = props => {
|
|
|
21427
21434
|
});
|
|
21428
21435
|
};
|
|
21429
21436
|
TabList.Tab = Tab;
|
|
21437
|
+
const TabBasic = ({
|
|
21438
|
+
children,
|
|
21439
|
+
icon,
|
|
21440
|
+
selected,
|
|
21441
|
+
boldWhenSelected = !icon,
|
|
21442
|
+
onClick,
|
|
21443
|
+
...props
|
|
21444
|
+
}) => {
|
|
21445
|
+
const tabListIndicator = useContext(TabListIndicatorContext);
|
|
21446
|
+
const tabListAlignX = useContext(TabListAlignXContext);
|
|
21447
|
+
const [selectedFromChild, setSelectedFromChild] = useState(false);
|
|
21448
|
+
const innerSelected = selected || selectedFromChild;
|
|
21449
|
+
return jsxs(Box, {
|
|
21450
|
+
role: "tab",
|
|
21451
|
+
"aria-selected": innerSelected ? "true" : "false",
|
|
21452
|
+
"data-interactive": onClick ? "" : undefined,
|
|
21453
|
+
"data-bold-when-selected": boldWhenSelected ? "" : undefined,
|
|
21454
|
+
onClick: onClick
|
|
21455
|
+
// Style system
|
|
21456
|
+
,
|
|
21457
|
+
baseClassName: "navi_tab",
|
|
21458
|
+
styleCSSVars: TAB_STYLE_CSS_VARS,
|
|
21459
|
+
pseudoClasses: TAB_PSEUDO_CLASSES,
|
|
21460
|
+
pseudoElements: TAB_PSEUDO_ELEMENTS,
|
|
21461
|
+
basePseudoState: {
|
|
21462
|
+
":-navi-tab-selected": innerSelected
|
|
21463
|
+
},
|
|
21464
|
+
selfAlignX: tabListAlignX,
|
|
21465
|
+
"data-align-x": tabListAlignX,
|
|
21466
|
+
...props,
|
|
21467
|
+
children: [(tabListIndicator === "start" || tabListIndicator === "end") && jsx("span", {
|
|
21468
|
+
className: "navi_tab_indicator",
|
|
21469
|
+
"data-position": tabListIndicator
|
|
21470
|
+
}), jsx(ReportSelectedOnTabContext.Provider, {
|
|
21471
|
+
value: setSelectedFromChild,
|
|
21472
|
+
children: boldWhenSelected ? jsx(Text, {
|
|
21473
|
+
preventBoldLayoutShift: true
|
|
21474
|
+
// boldTransition
|
|
21475
|
+
,
|
|
21476
|
+
children: children
|
|
21477
|
+
}) : children
|
|
21478
|
+
})]
|
|
21479
|
+
});
|
|
21480
|
+
};
|
|
21430
21481
|
const TabRoute = ({
|
|
21431
21482
|
circle,
|
|
21432
21483
|
route,
|
|
@@ -21443,13 +21494,7 @@ const TabRoute = ({
|
|
|
21443
21494
|
alignY,
|
|
21444
21495
|
...props
|
|
21445
21496
|
}) => {
|
|
21446
|
-
const {
|
|
21447
|
-
matching
|
|
21448
|
-
} = useRouteStatus(route);
|
|
21449
|
-
const paramsAreMatching = route.matchesParams(routeParams);
|
|
21450
|
-
const selected = matching && paramsAreMatching;
|
|
21451
21497
|
return jsx(TabBasic, {
|
|
21452
|
-
selected: selected,
|
|
21453
21498
|
...props,
|
|
21454
21499
|
circle: circle,
|
|
21455
21500
|
padding: "0",
|
|
@@ -21475,45 +21520,6 @@ const TabRoute = ({
|
|
|
21475
21520
|
})
|
|
21476
21521
|
});
|
|
21477
21522
|
};
|
|
21478
|
-
const TabBasic = ({
|
|
21479
|
-
children,
|
|
21480
|
-
icon,
|
|
21481
|
-
selected,
|
|
21482
|
-
boldWhenSelected = !icon,
|
|
21483
|
-
onClick,
|
|
21484
|
-
...props
|
|
21485
|
-
}) => {
|
|
21486
|
-
const tabListIndicator = useContext(TabListIndicatorContext);
|
|
21487
|
-
const tabListAlignX = useContext(TabListAlignXContext);
|
|
21488
|
-
return jsxs(Box, {
|
|
21489
|
-
role: "tab",
|
|
21490
|
-
"aria-selected": selected ? "true" : "false",
|
|
21491
|
-
"data-interactive": onClick ? "" : undefined,
|
|
21492
|
-
"data-bold-when-selected": boldWhenSelected ? "" : undefined,
|
|
21493
|
-
onClick: onClick
|
|
21494
|
-
// Style system
|
|
21495
|
-
,
|
|
21496
|
-
baseClassName: "navi_tab",
|
|
21497
|
-
styleCSSVars: TAB_STYLE_CSS_VARS,
|
|
21498
|
-
pseudoClasses: TAB_PSEUDO_CLASSES,
|
|
21499
|
-
pseudoElements: TAB_PSEUDO_ELEMENTS,
|
|
21500
|
-
basePseudoState: {
|
|
21501
|
-
":-navi-tab-selected": selected
|
|
21502
|
-
},
|
|
21503
|
-
selfAlignX: tabListAlignX,
|
|
21504
|
-
"data-align-x": tabListAlignX,
|
|
21505
|
-
...props,
|
|
21506
|
-
children: [(tabListIndicator === "start" || tabListIndicator === "end") && jsx("span", {
|
|
21507
|
-
className: "navi_tab_indicator",
|
|
21508
|
-
"data-position": tabListIndicator
|
|
21509
|
-
}), boldWhenSelected ? jsx(Text, {
|
|
21510
|
-
preventBoldLayoutShift: true
|
|
21511
|
-
// boldTransition
|
|
21512
|
-
,
|
|
21513
|
-
children: children
|
|
21514
|
-
}) : children]
|
|
21515
|
-
});
|
|
21516
|
-
};
|
|
21517
21523
|
|
|
21518
21524
|
const useFocusGroup = (
|
|
21519
21525
|
elementRef,
|