@aquera/nile-elements 0.0.19 → 0.0.21
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js +2 -5
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js +8 -16
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.js +80 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.d.ts +55 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.js +129 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.js +245 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.d.ts +82 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.js +392 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.js +32 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.d.ts +38 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.js +71 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +460 -86
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +2 -5
- package/dist/nile-calendar/nile-calendar.esm.js +8 -16
- package/dist/nile-content-editor/nile-content-editor.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.esm.js +1 -1
- package/dist/nile-tab/index.cjs.js +2 -0
- package/dist/nile-tab/index.cjs.js.map +1 -0
- package/dist/nile-tab/index.esm.js +1 -0
- package/dist/nile-tab/nile-tab.cjs.js +2 -0
- package/dist/nile-tab/nile-tab.cjs.js.map +1 -0
- package/dist/nile-tab/nile-tab.css.cjs.js +2 -0
- package/dist/nile-tab/nile-tab.css.cjs.js.map +1 -0
- package/dist/nile-tab/nile-tab.css.esm.js +68 -0
- package/dist/nile-tab/nile-tab.esm.js +21 -0
- package/dist/nile-tab-group/index.cjs.js +2 -0
- package/dist/nile-tab-group/index.cjs.js.map +1 -0
- package/dist/nile-tab-group/index.esm.js +1 -0
- package/dist/nile-tab-group/nile-tab-group.cjs.js +2 -0
- package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -0
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js +2 -0
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js.map +1 -0
- package/dist/nile-tab-group/nile-tab-group.css.esm.js +233 -0
- package/dist/nile-tab-group/nile-tab-group.esm.js +43 -0
- package/dist/nile-tab-panel/index.cjs.js +2 -0
- package/dist/nile-tab-panel/index.cjs.js.map +1 -0
- package/dist/nile-tab-panel/index.esm.js +1 -0
- package/dist/nile-tab-panel/nile-tab-panel.cjs.js +2 -0
- package/dist/nile-tab-panel/nile-tab-panel.cjs.js.map +1 -0
- package/dist/nile-tab-panel/nile-tab-panel.css.cjs.js +2 -0
- package/dist/nile-tab-panel/nile-tab-panel.css.cjs.js.map +1 -0
- package/dist/nile-tab-panel/nile-tab-panel.css.esm.js +20 -0
- package/dist/nile-tab-panel/nile-tab-panel.esm.js +6 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +2 -5
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.d.ts +1 -0
- package/dist/src/nile-calendar/nile-calendar.js +8 -16
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.js +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/dist/src/nile-tab/index.d.ts +1 -0
- package/dist/src/nile-tab/index.js +2 -0
- package/dist/src/nile-tab/index.js.map +1 -0
- package/dist/src/nile-tab/nile-tab.css.d.ts +12 -0
- package/dist/src/nile-tab/nile-tab.css.js +80 -0
- package/dist/src/nile-tab/nile-tab.css.js.map +1 -0
- package/dist/src/nile-tab/nile-tab.d.ts +55 -0
- package/dist/src/nile-tab/nile-tab.js +129 -0
- package/dist/src/nile-tab/nile-tab.js.map +1 -0
- package/dist/src/nile-tab-group/index.d.ts +1 -0
- package/dist/src/nile-tab-group/index.js +2 -0
- package/dist/src/nile-tab-group/index.js.map +1 -0
- package/dist/src/nile-tab-group/nile-tab-group.css.d.ts +12 -0
- package/dist/src/nile-tab-group/nile-tab-group.css.js +245 -0
- package/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -0
- package/dist/src/nile-tab-group/nile-tab-group.d.ts +82 -0
- package/dist/src/nile-tab-group/nile-tab-group.js +392 -0
- package/dist/src/nile-tab-group/nile-tab-group.js.map +1 -0
- package/dist/src/nile-tab-panel/index.d.ts +1 -0
- package/dist/src/nile-tab-panel/index.js +2 -0
- package/dist/src/nile-tab-panel/index.js.map +1 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.css.d.ts +12 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.css.js +32 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.css.js.map +1 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.d.ts +38 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.js +71 -0
- package/dist/src/nile-tab-panel/nile-tab-panel.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/nile-calendar/nile-calendar.css.ts +2 -5
- package/src/nile-calendar/nile-calendar.ts +9 -16
- package/src/nile-content-editor/nile-content-editor.ts +1 -1
- package/src/nile-tab/index.ts +1 -0
- package/src/nile-tab/nile-tab.css.ts +82 -0
- package/src/nile-tab/nile-tab.ts +129 -0
- package/src/nile-tab-group/index.ts +1 -0
- package/src/nile-tab-group/nile-tab-group.css.ts +247 -0
- package/src/nile-tab-group/nile-tab-group.ts +441 -0
- package/src/nile-tab-panel/index.ts +1 -0
- package/src/nile-tab-panel/nile-tab-panel.css.ts +34 -0
- package/src/nile-tab-panel/nile-tab-panel.ts +74 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { css } from 'lit-element';
|
8
|
+
/**
|
9
|
+
* Tab CSS
|
10
|
+
*/
|
11
|
+
export const styles = css `
|
12
|
+
[hidden] {
|
13
|
+
display: none !important;
|
14
|
+
}
|
15
|
+
|
16
|
+
:host {
|
17
|
+
display: inline-block;
|
18
|
+
}
|
19
|
+
|
20
|
+
.tab {
|
21
|
+
display: inline-flex;
|
22
|
+
align-items: center;
|
23
|
+
border-radius: 8px;
|
24
|
+
color: var(--nile-colors-dark-500);
|
25
|
+
padding: 4px 4px 12px 4px;
|
26
|
+
white-space: nowrap;
|
27
|
+
user-select: none;
|
28
|
+
cursor: pointer;
|
29
|
+
transition: 0.2s box-shadow, 0.2s color;
|
30
|
+
font-family: Colfax-regular;
|
31
|
+
font-size: 16px;
|
32
|
+
font-style: normal;
|
33
|
+
font-weight: 500;
|
34
|
+
line-height: 16px;
|
35
|
+
letter-spacing: 0.2px;
|
36
|
+
}
|
37
|
+
|
38
|
+
.tab:hover:not(.tab--disabled) {
|
39
|
+
color: var(--nile-colors-dark-500);
|
40
|
+
}
|
41
|
+
|
42
|
+
.tab:focus {
|
43
|
+
outline: none;
|
44
|
+
}
|
45
|
+
|
46
|
+
.tab:focus-visible:not(.tab--disabled) {
|
47
|
+
color: var(--nile-colors-primary-600);
|
48
|
+
}
|
49
|
+
|
50
|
+
.tab.tab--active:not(.tab--disabled) {
|
51
|
+
color: var(--nile-colors-primary-600);
|
52
|
+
}
|
53
|
+
|
54
|
+
.tab.tab--closable {
|
55
|
+
padding-inline-end: 4px;
|
56
|
+
}
|
57
|
+
|
58
|
+
.tab.tab--disabled {
|
59
|
+
opacity: 0.5;
|
60
|
+
cursor: not-allowed;
|
61
|
+
}
|
62
|
+
|
63
|
+
.tab__close-button {
|
64
|
+
font-size: 14px;
|
65
|
+
margin-inline-start: 4px;
|
66
|
+
}
|
67
|
+
|
68
|
+
.tab__close-button::part(base) {
|
69
|
+
padding: 3px;
|
70
|
+
}
|
71
|
+
|
72
|
+
@media (forced-colors: active) {
|
73
|
+
.tab.tab--active:not(.tab--disabled) {
|
74
|
+
outline: solid 1px transparent;
|
75
|
+
outline-offset: -3px;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
`;
|
79
|
+
export default [styles];
|
80
|
+
//# sourceMappingURL=nile-tab.css.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-tab.css.js","sourceRoot":"","sources":["../../../src/nile-tab/nile-tab.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmExB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit-element';\n\n/**\n * Tab CSS\n */\nexport const styles = css`\n [hidden] {\n display: none !important;\n }\n\n :host {\n display: inline-block;\n }\n\n .tab {\n display: inline-flex;\n align-items: center;\n border-radius: 8px;\n color: var(--nile-colors-dark-500);\n padding: 4px 4px 12px 4px;\n white-space: nowrap;\n user-select: none;\n cursor: pointer;\n transition: 0.2s box-shadow, 0.2s color;\n font-family: Colfax-regular;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n letter-spacing: 0.2px;\n }\n\n .tab:hover:not(.tab--disabled) {\n color: var(--nile-colors-dark-500);\n }\n\n .tab:focus {\n outline: none;\n }\n\n .tab:focus-visible:not(.tab--disabled) {\n color: var(--nile-colors-primary-600);\n }\n\n .tab.tab--active:not(.tab--disabled) {\n color: var(--nile-colors-primary-600);\n }\n\n .tab.tab--closable {\n padding-inline-end: 4px;\n }\n\n .tab.tab--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .tab__close-button {\n font-size: 14px;\n margin-inline-start: 4px;\n }\n\n .tab__close-button::part(base) {\n padding: 3px;\n }\n\n @media (forced-colors: active) {\n .tab.tab--active:not(.tab--disabled) {\n outline: solid 1px transparent;\n outline-offset: -3px;\n }\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { TemplateResult } from 'lit-element';
|
8
|
+
import '../nile-icon-button/nile-icon-button';
|
9
|
+
import NileElement from '../internal/nile-element';
|
10
|
+
import type { CSSResultGroup } from 'lit';
|
11
|
+
/**
|
12
|
+
* Nile icon component.
|
13
|
+
*
|
14
|
+
* @tag nile-tab
|
15
|
+
*
|
16
|
+
*
|
17
|
+
* @dependency nile-icon-button
|
18
|
+
*
|
19
|
+
* @slot - The tab's label.
|
20
|
+
*
|
21
|
+
* @event nile-close - Emitted when the tab is closable and the close button is activated.
|
22
|
+
*
|
23
|
+
* @csspart base - The component's base wrapper.
|
24
|
+
* @csspart close-button - The close button, an `<nile-icon-button>`.
|
25
|
+
* @csspart close-button__base - The close button's exported `base` part.
|
26
|
+
*/
|
27
|
+
export declare class NileTab extends NileElement {
|
28
|
+
static styles: CSSResultGroup;
|
29
|
+
private readonly attrId;
|
30
|
+
private readonly componentId;
|
31
|
+
tab: HTMLElement;
|
32
|
+
/** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */
|
33
|
+
panel: string;
|
34
|
+
/** Draws the tab in an active state. */
|
35
|
+
active: boolean;
|
36
|
+
/** Makes the tab closable and shows a close button. */
|
37
|
+
closable: boolean;
|
38
|
+
/** Disables the tab and prevents selection. */
|
39
|
+
disabled: boolean;
|
40
|
+
connectedCallback(): void;
|
41
|
+
private handleCloseClick;
|
42
|
+
handleActiveChange(): void;
|
43
|
+
handleDisabledChange(): void;
|
44
|
+
/** Sets focus to the tab. */
|
45
|
+
focus(options?: FocusOptions): void;
|
46
|
+
/** Removes focus from the tab. */
|
47
|
+
blur(): void;
|
48
|
+
render(): TemplateResult<1>;
|
49
|
+
}
|
50
|
+
export default NileTab;
|
51
|
+
declare global {
|
52
|
+
interface HTMLElementTagNameMap {
|
53
|
+
'nile-tab': NileTab;
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { __decorate } from "tslib";
|
8
|
+
import { html, property } from 'lit-element';
|
9
|
+
import { customElement } from 'lit/decorators.js';
|
10
|
+
import { styles } from './nile-tab.css';
|
11
|
+
import '../nile-icon-button/nile-icon-button';
|
12
|
+
import { classMap } from 'lit/directives/class-map.js';
|
13
|
+
import { query } from 'lit/decorators.js';
|
14
|
+
import { watch } from '../internal/watch';
|
15
|
+
import NileElement from '../internal/nile-element';
|
16
|
+
let id = 0;
|
17
|
+
/**
|
18
|
+
* Nile icon component.
|
19
|
+
*
|
20
|
+
* @tag nile-tab
|
21
|
+
*
|
22
|
+
*
|
23
|
+
* @dependency nile-icon-button
|
24
|
+
*
|
25
|
+
* @slot - The tab's label.
|
26
|
+
*
|
27
|
+
* @event nile-close - Emitted when the tab is closable and the close button is activated.
|
28
|
+
*
|
29
|
+
* @csspart base - The component's base wrapper.
|
30
|
+
* @csspart close-button - The close button, an `<nile-icon-button>`.
|
31
|
+
* @csspart close-button__base - The close button's exported `base` part.
|
32
|
+
*/
|
33
|
+
let NileTab = class NileTab extends NileElement {
|
34
|
+
constructor() {
|
35
|
+
super(...arguments);
|
36
|
+
this.attrId = ++id;
|
37
|
+
this.componentId = `nile-tab-${this.attrId}`;
|
38
|
+
/** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */
|
39
|
+
this.panel = '';
|
40
|
+
/** Draws the tab in an active state. */
|
41
|
+
this.active = false;
|
42
|
+
/** Makes the tab closable and shows a close button. */
|
43
|
+
this.closable = false;
|
44
|
+
/** Disables the tab and prevents selection. */
|
45
|
+
this.disabled = false;
|
46
|
+
}
|
47
|
+
connectedCallback() {
|
48
|
+
super.connectedCallback();
|
49
|
+
this.setAttribute('role', 'tab');
|
50
|
+
}
|
51
|
+
handleCloseClick(event) {
|
52
|
+
event.stopPropagation();
|
53
|
+
this.emit('nile-close');
|
54
|
+
}
|
55
|
+
handleActiveChange() {
|
56
|
+
this.setAttribute('aria-selected', this.active ? 'true' : 'false');
|
57
|
+
}
|
58
|
+
handleDisabledChange() {
|
59
|
+
this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
|
60
|
+
}
|
61
|
+
/** Sets focus to the tab. */
|
62
|
+
focus(options) {
|
63
|
+
this.tab.focus(options);
|
64
|
+
}
|
65
|
+
/** Removes focus from the tab. */
|
66
|
+
blur() {
|
67
|
+
this.tab.blur();
|
68
|
+
}
|
69
|
+
render() {
|
70
|
+
// If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels
|
71
|
+
this.id = this.id.length > 0 ? this.id : this.componentId;
|
72
|
+
return html `
|
73
|
+
<div
|
74
|
+
part="base"
|
75
|
+
class=${classMap({
|
76
|
+
tab: true,
|
77
|
+
'tab--active': this.active,
|
78
|
+
'tab--closable': this.closable,
|
79
|
+
'tab--disabled': this.disabled
|
80
|
+
})}
|
81
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
82
|
+
>
|
83
|
+
<slot></slot>
|
84
|
+
${this.closable
|
85
|
+
? html `
|
86
|
+
<nile-icon-button
|
87
|
+
part="close-button"
|
88
|
+
exportparts="base:close-button__base"
|
89
|
+
name="x-lg"
|
90
|
+
library="system"
|
91
|
+
label="close"
|
92
|
+
class="tab__close-button"
|
93
|
+
@click=${this.handleCloseClick}
|
94
|
+
tabindex="-1"
|
95
|
+
></nile-icon-button>
|
96
|
+
`
|
97
|
+
: ''}
|
98
|
+
</div>
|
99
|
+
`;
|
100
|
+
}
|
101
|
+
};
|
102
|
+
NileTab.styles = styles;
|
103
|
+
__decorate([
|
104
|
+
query('.tab')
|
105
|
+
], NileTab.prototype, "tab", void 0);
|
106
|
+
__decorate([
|
107
|
+
property({ reflect: true })
|
108
|
+
], NileTab.prototype, "panel", void 0);
|
109
|
+
__decorate([
|
110
|
+
property({ type: Boolean, reflect: true })
|
111
|
+
], NileTab.prototype, "active", void 0);
|
112
|
+
__decorate([
|
113
|
+
property({ type: Boolean })
|
114
|
+
], NileTab.prototype, "closable", void 0);
|
115
|
+
__decorate([
|
116
|
+
property({ type: Boolean, reflect: true })
|
117
|
+
], NileTab.prototype, "disabled", void 0);
|
118
|
+
__decorate([
|
119
|
+
watch('active')
|
120
|
+
], NileTab.prototype, "handleActiveChange", null);
|
121
|
+
__decorate([
|
122
|
+
watch('disabled')
|
123
|
+
], NileTab.prototype, "handleDisabledChange", null);
|
124
|
+
NileTab = __decorate([
|
125
|
+
customElement('nile-tab')
|
126
|
+
], NileTab);
|
127
|
+
export { NileTab };
|
128
|
+
export default NileTab;
|
129
|
+
//# sourceMappingURL=nile-tab.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-tab.js","sourceRoot":"","sources":["../../../src/nile-tab/nile-tab.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport {styles} from './nile-tab.css';\n\nimport '../nile-icon-button/nile-icon-button';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n\nlet id = 0;\n\n/**\n * Nile icon component.\n *\n * @tag nile-tab\n *\n *\n * @dependency nile-icon-button\n *\n * @slot - The tab's label.\n *\n * @event nile-close - Emitted when the tab is closable and the close button is activated.\n *\n * @csspart base - The component's base wrapper.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n */\n@customElement('nile-tab')\nexport class NileTab extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly attrId = ++id;\n private readonly componentId = `nile-tab-${this.attrId}`;\n\n @query('.tab') tab: HTMLElement;\n\n /** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */\n @property({ reflect: true }) panel = '';\n\n /** Draws the tab in an active state. */\n @property({ type: Boolean, reflect: true }) active = false;\n\n /** Makes the tab closable and shows a close button. */\n @property({ type: Boolean }) closable = false;\n\n /** Disables the tab and prevents selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'tab');\n }\n\n private handleCloseClick(event: Event) {\n event.stopPropagation();\n this.emit('nile-close');\n }\n\n @watch('active')\n handleActiveChange() {\n this.setAttribute('aria-selected', this.active ? 'true' : 'false');\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n /** Sets focus to the tab. */\n focus(options?: FocusOptions) {\n this.tab.focus(options);\n }\n\n /** Removes focus from the tab. */\n blur() {\n this.tab.blur();\n }\n\n render() {\n // If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels\n this.id = this.id.length > 0 ? this.id : this.componentId;\n\n return html`\n <div\n part=\"base\"\n class=${classMap({\n tab: true,\n 'tab--active': this.active,\n 'tab--closable': this.closable,\n 'tab--disabled': this.disabled\n })}\n tabindex=${this.disabled ? '-1' : '0'}\n >\n <slot></slot>\n ${this.closable\n ? html`\n <nile-icon-button\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n name=\"x-lg\"\n library=\"system\"\n label=\"close\"\n class=\"tab__close-button\"\n @click=${this.handleCloseClick}\n tabindex=\"-1\"\n ></nile-icon-button>\n `\n : ''}\n </div>\n `;\n }\n}\n\nexport default NileTab;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-tab': NileTab;\n }\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileTabGroup } from './nile-tab-group';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-tab-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { NileTabGroup } from './nile-tab-group';\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* TabGroup CSS
|
9
|
+
*/
|
10
|
+
export declare const styles: import("lit-element").CSSResult;
|
11
|
+
declare const _default: import("lit-element").CSSResult[];
|
12
|
+
export default _default;
|
@@ -0,0 +1,245 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { css } from 'lit-element';
|
8
|
+
/**
|
9
|
+
* TabGroup CSS
|
10
|
+
*/
|
11
|
+
export const styles = css `
|
12
|
+
[hidden] {
|
13
|
+
display: none !important;
|
14
|
+
}
|
15
|
+
|
16
|
+
:host {
|
17
|
+
--indicator-color: var(--nile-colors-primary-600);
|
18
|
+
--track-color: #e5e9eb;
|
19
|
+
--track-width: 1px;
|
20
|
+
|
21
|
+
display: block;
|
22
|
+
}
|
23
|
+
|
24
|
+
.tab-group {
|
25
|
+
display: flex;
|
26
|
+
border-radius: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
.tab-group__tabs {
|
30
|
+
display: flex;
|
31
|
+
position: relative;
|
32
|
+
gap: 24px;
|
33
|
+
}
|
34
|
+
|
35
|
+
.tab-group__indicator {
|
36
|
+
position: absolute;
|
37
|
+
transition: 0.3s translate ease, 0.3s width ease;
|
38
|
+
}
|
39
|
+
|
40
|
+
.tab-group--has-scroll-controls .tab-group__nav-container {
|
41
|
+
position: relative;
|
42
|
+
padding: 0 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.tab-group__body {
|
46
|
+
display: block;
|
47
|
+
overflow: auto;
|
48
|
+
}
|
49
|
+
|
50
|
+
.tab-group__scroll-button {
|
51
|
+
display: flex;
|
52
|
+
align-items: center;
|
53
|
+
justify-content: center;
|
54
|
+
position: absolute;
|
55
|
+
top: 0;
|
56
|
+
bottom: 0;
|
57
|
+
width: 20px;
|
58
|
+
}
|
59
|
+
|
60
|
+
.tab-group__scroll-button--start {
|
61
|
+
left: 0;
|
62
|
+
}
|
63
|
+
|
64
|
+
.tab-group__scroll-button--end {
|
65
|
+
right: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
.tab-group--rtl .tab-group__scroll-button--start {
|
69
|
+
left: auto;
|
70
|
+
right: 0;
|
71
|
+
}
|
72
|
+
|
73
|
+
.tab-group--rtl .tab-group__scroll-button--end {
|
74
|
+
left: 0;
|
75
|
+
right: auto;
|
76
|
+
}
|
77
|
+
|
78
|
+
/*
|
79
|
+
* Top
|
80
|
+
*/
|
81
|
+
|
82
|
+
.tab-group--top {
|
83
|
+
flex-direction: column;
|
84
|
+
}
|
85
|
+
|
86
|
+
.tab-group--top .tab-group__nav-container {
|
87
|
+
order: 1;
|
88
|
+
}
|
89
|
+
|
90
|
+
.tab-group--top .tab-group__nav {
|
91
|
+
display: flex;
|
92
|
+
overflow-x: auto;
|
93
|
+
|
94
|
+
/* Hide scrollbar in Firefox */
|
95
|
+
scrollbar-width: none;
|
96
|
+
}
|
97
|
+
|
98
|
+
/* Hide scrollbar in Chrome/Safari */
|
99
|
+
.tab-group--top .tab-group__nav::-webkit-scrollbar {
|
100
|
+
width: 0;
|
101
|
+
height: 0;
|
102
|
+
}
|
103
|
+
|
104
|
+
.tab-group--top .tab-group__tabs {
|
105
|
+
flex: 1 1 auto;
|
106
|
+
position: relative;
|
107
|
+
flex-direction: row;
|
108
|
+
border-bottom: solid var(--track-width) var(--track-color);
|
109
|
+
}
|
110
|
+
|
111
|
+
.tab-group--top .tab-group__indicator {
|
112
|
+
bottom: calc(-1 * var(--track-width));
|
113
|
+
border-bottom: solid 3px var(--indicator-color);
|
114
|
+
}
|
115
|
+
|
116
|
+
.tab-group--top .tab-group__body {
|
117
|
+
order: 2;
|
118
|
+
}
|
119
|
+
|
120
|
+
.tab-group--top ::slotted(nile-tab-panel) {
|
121
|
+
--padding: 10px 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
/*
|
125
|
+
* Bottom
|
126
|
+
*/
|
127
|
+
|
128
|
+
.tab-group--bottom {
|
129
|
+
flex-direction: column;
|
130
|
+
}
|
131
|
+
|
132
|
+
.tab-group--bottom .tab-group__nav-container {
|
133
|
+
order: 2;
|
134
|
+
}
|
135
|
+
|
136
|
+
.tab-group--bottom .tab-group__nav {
|
137
|
+
display: flex;
|
138
|
+
overflow-x: auto;
|
139
|
+
|
140
|
+
/* Hide scrollbar in Firefox */
|
141
|
+
scrollbar-width: none;
|
142
|
+
}
|
143
|
+
|
144
|
+
/* Hide scrollbar in Chrome/Safari */
|
145
|
+
.tab-group--bottom .tab-group__nav::-webkit-scrollbar {
|
146
|
+
width: 0;
|
147
|
+
height: 0;
|
148
|
+
}
|
149
|
+
|
150
|
+
.tab-group--bottom .tab-group__tabs {
|
151
|
+
flex: 1 1 auto;
|
152
|
+
position: relative;
|
153
|
+
flex-direction: row;
|
154
|
+
border-top: solid var(--track-width) var(--track-color);
|
155
|
+
}
|
156
|
+
|
157
|
+
.tab-group--bottom .tab-group__indicator {
|
158
|
+
top: calc(-1 * var(--track-width));
|
159
|
+
border-top: solid var(--track-width) var(--indicator-color);
|
160
|
+
}
|
161
|
+
|
162
|
+
.tab-group--bottom .tab-group__body {
|
163
|
+
order: 1;
|
164
|
+
}
|
165
|
+
|
166
|
+
.tab-group--bottom ::slotted(nile-tab-panel) {
|
167
|
+
--padding: 10px 0;
|
168
|
+
}
|
169
|
+
|
170
|
+
/*
|
171
|
+
* Start
|
172
|
+
*/
|
173
|
+
|
174
|
+
.tab-group--start {
|
175
|
+
flex-direction: row;
|
176
|
+
}
|
177
|
+
|
178
|
+
.tab-group--start .tab-group__nav-container {
|
179
|
+
order: 1;
|
180
|
+
}
|
181
|
+
|
182
|
+
.tab-group--start .tab-group__tabs {
|
183
|
+
flex: 0 0 auto;
|
184
|
+
flex-direction: column;
|
185
|
+
border-inline-end: solid var(--track-width) var(--track-color);
|
186
|
+
}
|
187
|
+
|
188
|
+
.tab-group--start .tab-group__indicator {
|
189
|
+
right: calc(-1 * var(--track-width));
|
190
|
+
border-right: solid var(--track-width) var(--indicator-color);
|
191
|
+
}
|
192
|
+
|
193
|
+
.tab-group--start.tab-group--rtl .tab-group__indicator {
|
194
|
+
right: auto;
|
195
|
+
left: calc(-1 * var(--track-width));
|
196
|
+
}
|
197
|
+
|
198
|
+
.tab-group--start .tab-group__body {
|
199
|
+
flex: 1 1 auto;
|
200
|
+
order: 2;
|
201
|
+
}
|
202
|
+
|
203
|
+
.tab-group--start ::slotted(nile-tab-panel) {
|
204
|
+
--padding: 0 10px;
|
205
|
+
}
|
206
|
+
|
207
|
+
/*
|
208
|
+
* End
|
209
|
+
*/
|
210
|
+
|
211
|
+
.tab-group--end {
|
212
|
+
flex-direction: row;
|
213
|
+
}
|
214
|
+
|
215
|
+
.tab-group--end .tab-group__nav-container {
|
216
|
+
order: 2;
|
217
|
+
}
|
218
|
+
|
219
|
+
.tab-group--end .tab-group__tabs {
|
220
|
+
flex: 0 0 auto;
|
221
|
+
flex-direction: column;
|
222
|
+
border-left: solid var(--track-width) var(--track-color);
|
223
|
+
}
|
224
|
+
|
225
|
+
.tab-group--end .tab-group__indicator {
|
226
|
+
left: calc(-1 * var(--track-width));
|
227
|
+
border-inline-start: solid var(--track-width) var(--indicator-color);
|
228
|
+
}
|
229
|
+
|
230
|
+
.tab-group--end.tab-group--rtl .tab-group__indicator {
|
231
|
+
right: calc(-1 * var(--track-width));
|
232
|
+
left: auto;
|
233
|
+
}
|
234
|
+
|
235
|
+
.tab-group--end .tab-group__body {
|
236
|
+
flex: 1 1 auto;
|
237
|
+
order: 1;
|
238
|
+
}
|
239
|
+
|
240
|
+
.tab-group--end ::slotted(nile-tab-panel) {
|
241
|
+
--padding: 0 10px;
|
242
|
+
}
|
243
|
+
`;
|
244
|
+
export default [styles];
|
245
|
+
//# sourceMappingURL=nile-tab-group.css.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-tab-group.css.js","sourceRoot":"","sources":["../../../src/nile-tab-group/nile-tab-group.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwOxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * TabGroup CSS\n */\nexport const styles = css`\n [hidden] {\n display: none !important;\n }\n\n :host {\n --indicator-color: var(--nile-colors-primary-600);\n --track-color: #e5e9eb;\n --track-width: 1px;\n\n display: block;\n }\n\n .tab-group {\n display: flex;\n border-radius: 0;\n }\n\n .tab-group__tabs {\n display: flex;\n position: relative;\n gap: 24px;\n }\n\n .tab-group__indicator {\n position: absolute;\n transition: 0.3s translate ease, 0.3s width ease;\n }\n\n .tab-group--has-scroll-controls .tab-group__nav-container {\n position: relative;\n padding: 0 10px;\n }\n\n .tab-group__body {\n display: block;\n overflow: auto;\n }\n\n .tab-group__scroll-button {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n bottom: 0;\n width: 20px;\n }\n\n .tab-group__scroll-button--start {\n left: 0;\n }\n\n .tab-group__scroll-button--end {\n right: 0;\n }\n\n .tab-group--rtl .tab-group__scroll-button--start {\n left: auto;\n right: 0;\n }\n\n .tab-group--rtl .tab-group__scroll-button--end {\n left: 0;\n right: auto;\n }\n\n /*\n * Top\n */\n\n .tab-group--top {\n flex-direction: column;\n }\n\n .tab-group--top .tab-group__nav-container {\n order: 1;\n }\n\n .tab-group--top .tab-group__nav {\n display: flex;\n overflow-x: auto;\n\n /* Hide scrollbar in Firefox */\n scrollbar-width: none;\n }\n\n /* Hide scrollbar in Chrome/Safari */\n .tab-group--top .tab-group__nav::-webkit-scrollbar {\n width: 0;\n height: 0;\n }\n\n .tab-group--top .tab-group__tabs {\n flex: 1 1 auto;\n position: relative;\n flex-direction: row;\n border-bottom: solid var(--track-width) var(--track-color);\n }\n\n .tab-group--top .tab-group__indicator {\n bottom: calc(-1 * var(--track-width));\n border-bottom: solid 3px var(--indicator-color);\n }\n\n .tab-group--top .tab-group__body {\n order: 2;\n }\n\n .tab-group--top ::slotted(nile-tab-panel) {\n --padding: 10px 0;\n }\n\n /*\n * Bottom\n */\n\n .tab-group--bottom {\n flex-direction: column;\n }\n\n .tab-group--bottom .tab-group__nav-container {\n order: 2;\n }\n\n .tab-group--bottom .tab-group__nav {\n display: flex;\n overflow-x: auto;\n\n /* Hide scrollbar in Firefox */\n scrollbar-width: none;\n }\n\n /* Hide scrollbar in Chrome/Safari */\n .tab-group--bottom .tab-group__nav::-webkit-scrollbar {\n width: 0;\n height: 0;\n }\n\n .tab-group--bottom .tab-group__tabs {\n flex: 1 1 auto;\n position: relative;\n flex-direction: row;\n border-top: solid var(--track-width) var(--track-color);\n }\n\n .tab-group--bottom .tab-group__indicator {\n top: calc(-1 * var(--track-width));\n border-top: solid var(--track-width) var(--indicator-color);\n }\n\n .tab-group--bottom .tab-group__body {\n order: 1;\n }\n\n .tab-group--bottom ::slotted(nile-tab-panel) {\n --padding: 10px 0;\n }\n\n /*\n * Start\n */\n\n .tab-group--start {\n flex-direction: row;\n }\n\n .tab-group--start .tab-group__nav-container {\n order: 1;\n }\n\n .tab-group--start .tab-group__tabs {\n flex: 0 0 auto;\n flex-direction: column;\n border-inline-end: solid var(--track-width) var(--track-color);\n }\n\n .tab-group--start .tab-group__indicator {\n right: calc(-1 * var(--track-width));\n border-right: solid var(--track-width) var(--indicator-color);\n }\n\n .tab-group--start.tab-group--rtl .tab-group__indicator {\n right: auto;\n left: calc(-1 * var(--track-width));\n }\n\n .tab-group--start .tab-group__body {\n flex: 1 1 auto;\n order: 2;\n }\n\n .tab-group--start ::slotted(nile-tab-panel) {\n --padding: 0 10px;\n }\n\n /*\n * End\n */\n\n .tab-group--end {\n flex-direction: row;\n }\n\n .tab-group--end .tab-group__nav-container {\n order: 2;\n }\n\n .tab-group--end .tab-group__tabs {\n flex: 0 0 auto;\n flex-direction: column;\n border-left: solid var(--track-width) var(--track-color);\n }\n\n .tab-group--end .tab-group__indicator {\n left: calc(-1 * var(--track-width));\n border-inline-start: solid var(--track-width) var(--indicator-color);\n }\n\n .tab-group--end.tab-group--rtl .tab-group__indicator {\n right: calc(-1 * var(--track-width));\n left: auto;\n }\n\n .tab-group--end .tab-group__body {\n flex: 1 1 auto;\n order: 1;\n }\n\n .tab-group--end ::slotted(nile-tab-panel) {\n --padding: 0 10px;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { TemplateResult } from 'lit-element';
|
8
|
+
import '../nile-icon-button/nile-icon-button';
|
9
|
+
import NileElement from '../internal/nile-element';
|
10
|
+
import type { CSSResultGroup } from 'lit';
|
11
|
+
/**
|
12
|
+
* Nile icon component.
|
13
|
+
*
|
14
|
+
* @tag nile-tab-group
|
15
|
+
*
|
16
|
+
* @slot - Used for grouping tab panels in the tab group. Must be `<nile-tab-panel>` elements.
|
17
|
+
* @slot nav - Used for grouping tabs in the tab group. Must be `<nile-tab>` elements.
|
18
|
+
*
|
19
|
+
* @event {{ name: String }} nile-tab-show - Emitted when a tab is shown.
|
20
|
+
* @event {{ name: String }} nile-tab-hide - Emitted when a tab is hidden.
|
21
|
+
*
|
22
|
+
* @csspart base - The component's base wrapper.
|
23
|
+
* @csspart nav - The tab group's navigation container where tabs are slotted in.
|
24
|
+
* @csspart tabs - The container that wraps the tabs.
|
25
|
+
* @csspart active-tab-indicator - The line that highlights the currently selected tab.
|
26
|
+
* @csspart body - The tab group's body where tab panels are slotted in.
|
27
|
+
* @csspart scroll-button - The previous/next scroll buttons that show when tabs are scrollable, an `<nile-icon-button>`.
|
28
|
+
* @csspart scroll-button--start - The starting scroll button.
|
29
|
+
* @csspart scroll-button--end - The ending scroll button.
|
30
|
+
* @csspart scroll-button__base - The scroll button's exported `base` part.
|
31
|
+
*
|
32
|
+
* @cssproperty --indicator-color - The color of the active tab indicator.
|
33
|
+
* @cssproperty --track-color - The color of the indicator's track (the line that separates tabs from panels).
|
34
|
+
* @cssproperty --track-width - The width of the indicator's track (the line that separates tabs from panels).
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
export declare class NileTabGroup extends NileElement {
|
38
|
+
static styles: CSSResultGroup;
|
39
|
+
private activeTab?;
|
40
|
+
private mutationObserver;
|
41
|
+
private resizeObserver;
|
42
|
+
private tabs;
|
43
|
+
private panels;
|
44
|
+
tabGroup: HTMLElement;
|
45
|
+
body: HTMLSlotElement;
|
46
|
+
nav: HTMLElement;
|
47
|
+
indicator: HTMLElement;
|
48
|
+
private hasScrollControls;
|
49
|
+
/** The placement of the tabs. */
|
50
|
+
placement: 'top' | 'bottom' | 'start' | 'end';
|
51
|
+
/**
|
52
|
+
* When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel. When set to
|
53
|
+
* manual, the tab will receive focus but will not show until the user presses spacebar or enter.
|
54
|
+
*/
|
55
|
+
activation: 'auto' | 'manual';
|
56
|
+
/** Disables the scroll arrows that appear when tabs overflow. */
|
57
|
+
noScrollControls: boolean;
|
58
|
+
connectedCallback(): void;
|
59
|
+
disconnectedCallback(): void;
|
60
|
+
private getAllTabs;
|
61
|
+
private getAllPanels;
|
62
|
+
private getActiveTab;
|
63
|
+
private handleClick;
|
64
|
+
private handleKeyDown;
|
65
|
+
private handleScrollToStart;
|
66
|
+
private handleScrollToEnd;
|
67
|
+
private setActiveTab;
|
68
|
+
private setAriaLabels;
|
69
|
+
private repositionIndicator;
|
70
|
+
private syncTabsAndPanels;
|
71
|
+
updateScrollControls(): void;
|
72
|
+
syncIndicator(): void;
|
73
|
+
/** Shows the specified tab panel. */
|
74
|
+
show(panel: string): void;
|
75
|
+
render(): TemplateResult<1>;
|
76
|
+
}
|
77
|
+
export default NileTabGroup;
|
78
|
+
declare global {
|
79
|
+
interface HTMLElementTagNameMap {
|
80
|
+
'nile-tab-group': NileTabGroup;
|
81
|
+
}
|
82
|
+
}
|