@jsenv/navi 0.12.31 → 0.12.33
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 +180 -49
- package/dist/jsenv_navi.js.map +11 -5
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -15247,6 +15247,11 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
15247
15247
|
&[data-disabled] > * {
|
|
15248
15248
|
opacity: 0.5;
|
|
15249
15249
|
}
|
|
15250
|
+
&[data-discrete] {
|
|
15251
|
+
--link-color: inherit;
|
|
15252
|
+
--link-text-decoration: none;
|
|
15253
|
+
--x-link-color: var(--link-color);
|
|
15254
|
+
}
|
|
15250
15255
|
/* Reveal on interaction */
|
|
15251
15256
|
&[data-reveal-on-interaction] {
|
|
15252
15257
|
position: absolute !important;
|
|
@@ -15346,6 +15351,7 @@ const LinkPlain = props => {
|
|
|
15346
15351
|
preventDefault,
|
|
15347
15352
|
anchor,
|
|
15348
15353
|
// visual
|
|
15354
|
+
discrete,
|
|
15349
15355
|
blankTargetIcon,
|
|
15350
15356
|
anchorIcon,
|
|
15351
15357
|
icon,
|
|
@@ -15410,6 +15416,7 @@ const LinkPlain = props => {
|
|
|
15410
15416
|
,
|
|
15411
15417
|
"data-anchor": anchor ? "" : undefined,
|
|
15412
15418
|
"data-reveal-on-interaction": revealOnInteraction ? "" : undefined,
|
|
15419
|
+
"data-discrete": discrete ? "" : undefined,
|
|
15413
15420
|
baseClassName: "navi_link",
|
|
15414
15421
|
styleCSSVars: LinkStyleCSSVars,
|
|
15415
15422
|
pseudoClasses: LinkPseudoClasses,
|
|
@@ -15624,104 +15631,228 @@ const RouteLink = ({
|
|
|
15624
15631
|
});
|
|
15625
15632
|
};
|
|
15626
15633
|
|
|
15627
|
-
installImportMetaCss(import.meta);
|
|
15634
|
+
installImportMetaCss(import.meta);Object.assign(PSEUDO_CLASSES, {
|
|
15635
|
+
":-navi-selected": {
|
|
15636
|
+
attribute: "data-selected"
|
|
15637
|
+
}
|
|
15638
|
+
});
|
|
15639
|
+
import.meta.css = /* css */`
|
|
15640
|
+
@layer navi {
|
|
15641
|
+
.navi_tablist {
|
|
15642
|
+
--tablist-border-radius: 8px;
|
|
15643
|
+
--tablist-background: transparent;
|
|
15644
|
+
--tab-border-radius: calc(var(--tablist-border-radius) - 2px);
|
|
15645
|
+
|
|
15646
|
+
--tab-background: transparent;
|
|
15647
|
+
--tab-background-hover: #dae0e7;
|
|
15648
|
+
--tab-background-selected: transparent;
|
|
15649
|
+
--tab-color: inherit;
|
|
15650
|
+
--tab-color-hover: #010409;
|
|
15651
|
+
--tab-color-selected: inherit;
|
|
15652
|
+
--tab-marker-height: 2px;
|
|
15653
|
+
--tab-marker-color: rgb(205, 52, 37);
|
|
15654
|
+
}
|
|
15655
|
+
}
|
|
15656
|
+
|
|
15628
15657
|
.navi_tablist {
|
|
15629
15658
|
display: flex;
|
|
15630
|
-
|
|
15659
|
+
line-height: 2em;
|
|
15660
|
+
background: var(--tablist-background);
|
|
15661
|
+
border-radius: var(--tablist-border-radius);
|
|
15631
15662
|
overflow-x: auto;
|
|
15632
15663
|
overflow-y: hidden;
|
|
15633
15664
|
}
|
|
15634
|
-
|
|
15635
15665
|
.navi_tablist > ul {
|
|
15636
15666
|
display: flex;
|
|
15667
|
+
width: 100%;
|
|
15637
15668
|
margin: 0;
|
|
15638
15669
|
padding: 0;
|
|
15639
15670
|
align-items: center;
|
|
15640
15671
|
gap: 0.5rem;
|
|
15641
15672
|
list-style: none;
|
|
15642
15673
|
}
|
|
15643
|
-
|
|
15644
15674
|
.navi_tablist > ul > li {
|
|
15645
15675
|
position: relative;
|
|
15646
15676
|
display: inline-flex;
|
|
15647
15677
|
}
|
|
15648
15678
|
|
|
15649
15679
|
.navi_tab {
|
|
15680
|
+
--x-tab-background: var(--tab-background);
|
|
15681
|
+
--x-tab-color: var(--tab-color);
|
|
15682
|
+
|
|
15650
15683
|
display: flex;
|
|
15651
15684
|
flex-direction: column;
|
|
15652
15685
|
white-space: nowrap;
|
|
15653
|
-
|
|
15686
|
+
border-radius: var(--tab-border-radius);
|
|
15654
15687
|
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15688
|
+
.navi_tab_content {
|
|
15689
|
+
display: flex;
|
|
15690
|
+
padding: 0 0.5rem;
|
|
15691
|
+
color: var(--x-tab-color);
|
|
15692
|
+
background: var(--x-tab-background);
|
|
15693
|
+
border-radius: inherit;
|
|
15694
|
+
transition: background 0.12s ease-out;
|
|
15695
|
+
}
|
|
15696
|
+
/* Hidden bold clone to reserve space for bold width without affecting height */
|
|
15697
|
+
.navi_tab_content_bold_clone {
|
|
15698
|
+
display: block; /* in-flow so it contributes to width */
|
|
15699
|
+
height: 0; /* zero height so it doesn't change layout height */
|
|
15700
|
+
font-weight: 600; /* force bold to compute max width */
|
|
15701
|
+
visibility: hidden; /* not visible */
|
|
15702
|
+
pointer-events: none; /* inert */
|
|
15703
|
+
overflow: hidden; /* avoid any accidental height */
|
|
15704
|
+
}
|
|
15705
|
+
.navi_tab_selected_marker {
|
|
15706
|
+
z-index: 1;
|
|
15707
|
+
display: flex;
|
|
15708
|
+
width: 100%;
|
|
15709
|
+
height: var(--tab-marker-height);
|
|
15710
|
+
margin-top: 5px;
|
|
15711
|
+
background: transparent;
|
|
15712
|
+
border-radius: 0.1px;
|
|
15713
|
+
}
|
|
15668
15714
|
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15715
|
+
/* Interactive */
|
|
15716
|
+
&[data-interactive] {
|
|
15717
|
+
cursor: pointer;
|
|
15718
|
+
}
|
|
15719
|
+
/* Hover */
|
|
15720
|
+
&:hover {
|
|
15721
|
+
--x-tab-background: var(--tab-background-hover);
|
|
15722
|
+
--x-tab-color: var(--tab-color-hover);
|
|
15723
|
+
}
|
|
15724
|
+
/* Selected */
|
|
15725
|
+
&[data-selected] {
|
|
15726
|
+
--x-tab-background: var(--tab-background-selected);
|
|
15727
|
+
--x-tab-color: var(--tab-color-selected);
|
|
15678
15728
|
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
overflow: hidden; /* avoid any accidental height */
|
|
15729
|
+
.navi_tab_content {
|
|
15730
|
+
font-weight: 600;
|
|
15731
|
+
}
|
|
15732
|
+
.navi_tab_selected_marker {
|
|
15733
|
+
background: var(--tab-marker-color);
|
|
15734
|
+
}
|
|
15735
|
+
}
|
|
15687
15736
|
}
|
|
15688
15737
|
|
|
15689
|
-
.
|
|
15690
|
-
|
|
15691
|
-
|
|
15738
|
+
.navi_tablist[data-expand] {
|
|
15739
|
+
.navi_tab {
|
|
15740
|
+
flex: 1;
|
|
15741
|
+
align-items: center;
|
|
15742
|
+
}
|
|
15692
15743
|
|
|
15693
|
-
|
|
15694
|
-
|
|
15744
|
+
.navi_tab_content {
|
|
15745
|
+
width: 100%;
|
|
15746
|
+
justify-content: center;
|
|
15747
|
+
}
|
|
15695
15748
|
}
|
|
15696
15749
|
`;
|
|
15750
|
+
const TabListUnderlinerContext = createContext();
|
|
15751
|
+
const TabListStyleCSSVars = {
|
|
15752
|
+
borderRadius: "--tablist-border-radius",
|
|
15753
|
+
background: "--tablist-background"
|
|
15754
|
+
};
|
|
15697
15755
|
const TabList = ({
|
|
15698
15756
|
children,
|
|
15757
|
+
spacing,
|
|
15758
|
+
underline,
|
|
15759
|
+
expand,
|
|
15760
|
+
expandX,
|
|
15699
15761
|
...props
|
|
15700
15762
|
}) => {
|
|
15701
15763
|
return jsx(Box, {
|
|
15702
15764
|
as: "nav",
|
|
15703
15765
|
baseClassName: "navi_tablist",
|
|
15704
15766
|
role: "tablist",
|
|
15767
|
+
"data-expand": expand || expandX ? "" : undefined,
|
|
15768
|
+
expand: expand,
|
|
15769
|
+
expandX: expandX,
|
|
15705
15770
|
...props,
|
|
15706
|
-
|
|
15771
|
+
styleCSSVars: TabListStyleCSSVars,
|
|
15772
|
+
children: jsx(Box, {
|
|
15773
|
+
as: "ul",
|
|
15774
|
+
column: true,
|
|
15707
15775
|
role: "list",
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15776
|
+
spacing: spacing,
|
|
15777
|
+
children: jsx(TabListUnderlinerContext.Provider, {
|
|
15778
|
+
value: underline,
|
|
15779
|
+
children: children.map(child => {
|
|
15780
|
+
return jsx(Box, {
|
|
15781
|
+
as: "li",
|
|
15782
|
+
column: true,
|
|
15783
|
+
expandX: expandX,
|
|
15784
|
+
expand: expand,
|
|
15785
|
+
children: child
|
|
15786
|
+
}, child.props.key);
|
|
15787
|
+
})
|
|
15712
15788
|
})
|
|
15713
15789
|
})
|
|
15714
15790
|
});
|
|
15715
15791
|
};
|
|
15716
|
-
const
|
|
15792
|
+
const TAB_STYLE_CSS_VARS = {
|
|
15793
|
+
"background": "--tab-background",
|
|
15794
|
+
"color": "--tab-color",
|
|
15795
|
+
":hover": {
|
|
15796
|
+
background: "--tab-background-hover",
|
|
15797
|
+
color: "--tab-color-hover"
|
|
15798
|
+
},
|
|
15799
|
+
":-navi-selected": {
|
|
15800
|
+
background: "--tab-color-selected",
|
|
15801
|
+
color: "--tab-color-selected"
|
|
15802
|
+
}
|
|
15803
|
+
};
|
|
15804
|
+
const TAB_PSEUDO_CLASSES = [":hover", ":-navi-selected"];
|
|
15805
|
+
const TAB_PSEUDO_ELEMENTS = ["::-navi-marker"];
|
|
15806
|
+
const Tab = props => {
|
|
15807
|
+
if (props.route) {
|
|
15808
|
+
return jsx(TabRoute, {
|
|
15809
|
+
...props
|
|
15810
|
+
});
|
|
15811
|
+
}
|
|
15812
|
+
return jsx(TabBasic, {
|
|
15813
|
+
...props
|
|
15814
|
+
});
|
|
15815
|
+
};
|
|
15816
|
+
const TabRoute = ({
|
|
15817
|
+
route,
|
|
15818
|
+
children,
|
|
15819
|
+
...props
|
|
15820
|
+
}) => {
|
|
15821
|
+
const {
|
|
15822
|
+
active
|
|
15823
|
+
} = useRouteStatus(route);
|
|
15824
|
+
return jsx(TabBasic, {
|
|
15825
|
+
selected: active,
|
|
15826
|
+
...props,
|
|
15827
|
+
children: jsx(RouteLink, {
|
|
15828
|
+
route: route,
|
|
15829
|
+
underline: false,
|
|
15830
|
+
color: "inherit",
|
|
15831
|
+
children: children
|
|
15832
|
+
})
|
|
15833
|
+
});
|
|
15834
|
+
};
|
|
15835
|
+
const TabBasic = ({
|
|
15717
15836
|
children,
|
|
15718
15837
|
selected,
|
|
15838
|
+
onClick,
|
|
15719
15839
|
...props
|
|
15720
15840
|
}) => {
|
|
15841
|
+
const tabListUnderline = useContext(TabListUnderlinerContext);
|
|
15721
15842
|
return jsxs(Box, {
|
|
15722
|
-
baseClassName: "navi_tab",
|
|
15723
15843
|
role: "tab",
|
|
15724
15844
|
"aria-selected": selected ? "true" : "false",
|
|
15845
|
+
"data-interactive": onClick ? "" : undefined,
|
|
15846
|
+
onClick: onClick
|
|
15847
|
+
// Style system
|
|
15848
|
+
,
|
|
15849
|
+
baseClassName: "navi_tab",
|
|
15850
|
+
styleCSSVars: TAB_STYLE_CSS_VARS,
|
|
15851
|
+
pseudoClasses: TAB_PSEUDO_CLASSES,
|
|
15852
|
+
pseudoElements: TAB_PSEUDO_ELEMENTS,
|
|
15853
|
+
basePseudoState: {
|
|
15854
|
+
":-navi-selected": selected
|
|
15855
|
+
},
|
|
15725
15856
|
...props,
|
|
15726
15857
|
children: [jsx("div", {
|
|
15727
15858
|
className: "navi_tab_content",
|
|
@@ -15730,8 +15861,8 @@ const Tab = ({
|
|
|
15730
15861
|
className: "navi_tab_content_bold_clone",
|
|
15731
15862
|
"aria-hidden": "true",
|
|
15732
15863
|
children: children
|
|
15733
|
-
}), jsx("span", {
|
|
15734
|
-
className: "
|
|
15864
|
+
}), tabListUnderline && jsx("span", {
|
|
15865
|
+
className: "navi_tab_selected_marker"
|
|
15735
15866
|
})]
|
|
15736
15867
|
});
|
|
15737
15868
|
};
|