@ni/ok-components 0.0.2 → 0.0.3
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.
|
@@ -6781,20 +6781,6 @@
|
|
|
6781
6781
|
], BreadcrumbItem$1.prototype, "separator", void 0);
|
|
6782
6782
|
applyMixins(BreadcrumbItem$1, StartEnd, DelegatesARIALink);
|
|
6783
6783
|
|
|
6784
|
-
/**
|
|
6785
|
-
* The template for the {@link @ni/fast-foundation#Breadcrumb} component.
|
|
6786
|
-
* @public
|
|
6787
|
-
*/
|
|
6788
|
-
const breadcrumbTemplate = (context, definition) => html `
|
|
6789
|
-
<template role="navigation">
|
|
6790
|
-
<div role="list" class="list" part="list">
|
|
6791
|
-
<slot
|
|
6792
|
-
${slotted({ property: "slottedBreadcrumbItems", filter: elements() })}
|
|
6793
|
-
></slot>
|
|
6794
|
-
</div>
|
|
6795
|
-
</template>
|
|
6796
|
-
`;
|
|
6797
|
-
|
|
6798
6784
|
/**
|
|
6799
6785
|
* A Breadcrumb Custom HTML Element.
|
|
6800
6786
|
* @slot - The default slot for the breadcrumb items
|
|
@@ -19749,12 +19735,71 @@
|
|
|
19749
19735
|
});
|
|
19750
19736
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
|
|
19751
19737
|
|
|
19738
|
+
/**
|
|
19739
|
+
* The template for the {@link @ni/fast-foundation#Breadcrumb} component.
|
|
19740
|
+
* @public
|
|
19741
|
+
*/
|
|
19742
|
+
// prettier-ignore
|
|
19743
|
+
const breadcrumbTemplate = (_context, _definition) => html `
|
|
19744
|
+
<template role="navigation">
|
|
19745
|
+
${when(x => x.showScrollButtons, html `
|
|
19746
|
+
<${buttonTag}
|
|
19747
|
+
content-hidden
|
|
19748
|
+
class="scroll-button left"
|
|
19749
|
+
appearance="${ButtonAppearance.ghost}"
|
|
19750
|
+
@click="${x => x.onScrollLeftClick()}"
|
|
19751
|
+
${ref('leftScrollButton')}
|
|
19752
|
+
>
|
|
19753
|
+
${x => scrollForwardLabel.getValueFor(x)}
|
|
19754
|
+
<${iconArrowExpanderLeftTag} slot="start"></${iconArrowExpanderLeftTag}>
|
|
19755
|
+
</${buttonTag}>
|
|
19756
|
+
`)}
|
|
19757
|
+
<div ${ref('list')} role="list" class="list" part="list" tabindex="-1">
|
|
19758
|
+
<slot
|
|
19759
|
+
${slotted({ property: 'slottedBreadcrumbItems', filter: elements() })}
|
|
19760
|
+
></slot>
|
|
19761
|
+
</div>
|
|
19762
|
+
${when(x => x.showScrollButtons, html `
|
|
19763
|
+
<${buttonTag}
|
|
19764
|
+
content-hidden
|
|
19765
|
+
class="scroll-button right"
|
|
19766
|
+
appearance="${ButtonAppearance.ghost}"
|
|
19767
|
+
@click="${x => x.onScrollRightClick()}"
|
|
19768
|
+
>
|
|
19769
|
+
${x => scrollBackwardLabel.getValueFor(x)}
|
|
19770
|
+
<${iconArrowExpanderRightTag} slot="start"></${iconArrowExpanderRightTag}>
|
|
19771
|
+
</${buttonTag}>
|
|
19772
|
+
`)}
|
|
19773
|
+
</template>
|
|
19774
|
+
`;
|
|
19775
|
+
|
|
19752
19776
|
const styles$W = css `
|
|
19753
|
-
${display$2('inline-
|
|
19777
|
+
${display$2('inline-flex')}
|
|
19778
|
+
|
|
19779
|
+
:host {
|
|
19780
|
+
flex-direction: row;
|
|
19781
|
+
}
|
|
19782
|
+
|
|
19783
|
+
.scroll-button.left {
|
|
19784
|
+
margin-right: ${smallPadding};
|
|
19785
|
+
}
|
|
19754
19786
|
|
|
19755
19787
|
.list {
|
|
19756
|
-
display: flex;
|
|
19757
|
-
|
|
19788
|
+
display: inline-flex;
|
|
19789
|
+
max-width: 100%;
|
|
19790
|
+
width: max-content;
|
|
19791
|
+
align-self: end;
|
|
19792
|
+
overflow-x: scroll;
|
|
19793
|
+
scrollbar-width: none;
|
|
19794
|
+
}
|
|
19795
|
+
|
|
19796
|
+
.scroll-button.right {
|
|
19797
|
+
margin-left: ${smallPadding};
|
|
19798
|
+
}
|
|
19799
|
+
|
|
19800
|
+
::slotted(*) {
|
|
19801
|
+
flex-shrink: 0;
|
|
19802
|
+
white-space: nowrap;
|
|
19758
19803
|
}
|
|
19759
19804
|
|
|
19760
19805
|
::slotted(:last-child) {
|
|
@@ -19771,10 +19816,63 @@
|
|
|
19771
19816
|
* A nimble-styled breadcrumb
|
|
19772
19817
|
*/
|
|
19773
19818
|
class Breadcrumb extends Breadcrumb$1 {
|
|
19819
|
+
constructor() {
|
|
19820
|
+
super();
|
|
19821
|
+
/**
|
|
19822
|
+
* @internal
|
|
19823
|
+
*/
|
|
19824
|
+
this.showScrollButtons = false;
|
|
19825
|
+
this.listResizeObserver = new ResizeObserver(entries => {
|
|
19826
|
+
let listVisibleWidth = entries[0]?.contentRect.width;
|
|
19827
|
+
if (listVisibleWidth !== undefined) {
|
|
19828
|
+
const buttonWidth = this.leftScrollButton?.clientWidth ?? 0;
|
|
19829
|
+
listVisibleWidth = Math.ceil(listVisibleWidth);
|
|
19830
|
+
if (this.showScrollButtons) {
|
|
19831
|
+
listVisibleWidth += buttonWidth * 2;
|
|
19832
|
+
}
|
|
19833
|
+
this.showScrollButtons = listVisibleWidth < this.list.scrollWidth;
|
|
19834
|
+
}
|
|
19835
|
+
});
|
|
19836
|
+
}
|
|
19837
|
+
/**
|
|
19838
|
+
* @internal
|
|
19839
|
+
*/
|
|
19840
|
+
onScrollLeftClick() {
|
|
19841
|
+
this.list.scrollBy({
|
|
19842
|
+
left: -this.list.clientWidth,
|
|
19843
|
+
behavior: 'smooth'
|
|
19844
|
+
});
|
|
19845
|
+
}
|
|
19846
|
+
/**
|
|
19847
|
+
* @internal
|
|
19848
|
+
*/
|
|
19849
|
+
onScrollRightClick() {
|
|
19850
|
+
this.list.scrollBy({
|
|
19851
|
+
left: this.list.clientWidth,
|
|
19852
|
+
behavior: 'smooth'
|
|
19853
|
+
});
|
|
19854
|
+
}
|
|
19855
|
+
/**
|
|
19856
|
+
* @internal
|
|
19857
|
+
*/
|
|
19858
|
+
connectedCallback() {
|
|
19859
|
+
super.connectedCallback();
|
|
19860
|
+
this.listResizeObserver.observe(this.list);
|
|
19861
|
+
}
|
|
19862
|
+
/**
|
|
19863
|
+
* @internal
|
|
19864
|
+
*/
|
|
19865
|
+
disconnectedCallback() {
|
|
19866
|
+
super.disconnectedCallback();
|
|
19867
|
+
this.listResizeObserver.disconnect();
|
|
19868
|
+
}
|
|
19774
19869
|
}
|
|
19775
19870
|
__decorate([
|
|
19776
19871
|
attr
|
|
19777
19872
|
], Breadcrumb.prototype, "appearance", void 0);
|
|
19873
|
+
__decorate([
|
|
19874
|
+
observable
|
|
19875
|
+
], Breadcrumb.prototype, "showScrollButtons", void 0);
|
|
19778
19876
|
const nimbleBreadcrumb = Breadcrumb.compose({
|
|
19779
19877
|
baseName: 'breadcrumb',
|
|
19780
19878
|
baseClass: Breadcrumb$1,
|