@six-group/ui-library 4.0.1 → 4.0.2
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/cjs/{scroll-03678de1.js → scroll-2c4200dc.js} +1 -2
- package/dist/cjs/scroll-2c4200dc.js.map +1 -0
- package/dist/cjs/six-button.cjs.entry.js +2 -2
- package/dist/cjs/six-button.cjs.entry.js.map +1 -1
- package/dist/cjs/six-details.cjs.entry.js +1 -1
- package/dist/cjs/six-details.cjs.entry.js.map +1 -1
- package/dist/cjs/six-dialog.cjs.entry.js +1 -1
- package/dist/cjs/six-drawer.cjs.entry.js +1 -1
- package/dist/cjs/six-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/six-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js +2 -1
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js.map +1 -1
- package/dist/cjs/six-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/six-sidebar.cjs.entry.js.map +1 -1
- package/dist/cjs/six-tab-group.cjs.entry.js +45 -50
- package/dist/cjs/six-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/six-tab.cjs.entry.js +19 -3
- package/dist/cjs/six-tab.cjs.entry.js.map +1 -1
- package/dist/collection/components/six-button/six-button.css +5 -30
- package/dist/collection/components/six-button/six-button.js +1 -1
- package/dist/collection/components/six-button/six-button.js.map +1 -1
- package/dist/collection/components/six-details/six-details.css +3 -1
- package/dist/collection/components/six-icon-button/six-icon-button.css +4 -4
- package/dist/collection/components/six-sidebar/six-sidebar.css +0 -1
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.css +4 -0
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js +1 -0
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js.map +1 -1
- package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js +2 -2
- package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js.map +1 -1
- package/dist/collection/components/six-tab/six-tab.css +54 -5
- package/dist/collection/components/six-tab/six-tab.js +18 -2
- package/dist/collection/components/six-tab/six-tab.js.map +1 -1
- package/dist/collection/components/six-tab-group/six-tab-group.css +0 -31
- package/dist/collection/components/six-tab-group/six-tab-group.js +10 -51
- package/dist/collection/components/six-tab-group/six-tab-group.js.map +1 -1
- package/dist/collection/utils/animation.js +34 -0
- package/dist/collection/utils/animation.js.map +1 -0
- package/dist/components/scroll.js +1 -1
- package/dist/components/six-button.js +2 -2
- package/dist/components/six-button.js.map +1 -1
- package/dist/components/six-details2.js +1 -1
- package/dist/components/six-details2.js.map +1 -1
- package/dist/components/six-icon-button2.js +1 -1
- package/dist/components/six-icon-button2.js.map +1 -1
- package/dist/components/six-sidebar-item-group.js +2 -1
- package/dist/components/six-sidebar-item-group.js.map +1 -1
- package/dist/components/six-sidebar.js +1 -1
- package/dist/components/six-sidebar.js.map +1 -1
- package/dist/components/six-tab-group.js +45 -50
- package/dist/components/six-tab-group.js.map +1 -1
- package/dist/components/six-tab.js +19 -3
- package/dist/components/six-tab.js.map +1 -1
- package/dist/components.json +7 -8
- package/dist/esm/{scroll-3fb087a2.js → scroll-774762d6.js} +2 -2
- package/dist/esm/{scroll-3fb087a2.js.map → scroll-774762d6.js.map} +1 -1
- package/dist/esm/six-button.entry.js +2 -2
- package/dist/esm/six-button.entry.js.map +1 -1
- package/dist/esm/six-details.entry.js +1 -1
- package/dist/esm/six-details.entry.js.map +1 -1
- package/dist/esm/six-dialog.entry.js +1 -1
- package/dist/esm/six-drawer.entry.js +1 -1
- package/dist/esm/six-icon-button.entry.js +1 -1
- package/dist/esm/six-icon-button.entry.js.map +1 -1
- package/dist/esm/six-sidebar-item-group.entry.js +2 -1
- package/dist/esm/six-sidebar-item-group.entry.js.map +1 -1
- package/dist/esm/six-sidebar.entry.js +2 -2
- package/dist/esm/six-sidebar.entry.js.map +1 -1
- package/dist/esm/six-tab-group.entry.js +45 -50
- package/dist/esm/six-tab-group.entry.js.map +1 -1
- package/dist/esm/six-tab.entry.js +19 -3
- package/dist/esm/six-tab.entry.js.map +1 -1
- package/dist/types/components/six-tab-group/six-tab-group.d.ts +0 -3
- package/dist/types/utils/animation.d.ts +12 -0
- package/dist/ui-library/{p-1f18768a.js → p-052aa8d3.js} +2 -2
- package/dist/ui-library/p-1286ab62.entry.js +2 -0
- package/dist/ui-library/p-1286ab62.entry.js.map +1 -0
- package/dist/ui-library/p-22c9b8c3.entry.js +2 -0
- package/dist/ui-library/p-22c9b8c3.entry.js.map +1 -0
- package/dist/ui-library/p-3f1a5ecb.entry.js +2 -0
- package/dist/ui-library/p-3f1a5ecb.entry.js.map +1 -0
- package/dist/ui-library/p-5800663b.entry.js +2 -0
- package/dist/ui-library/p-5800663b.entry.js.map +1 -0
- package/dist/ui-library/p-5ba3a0fe.entry.js +2 -0
- package/dist/ui-library/p-5ba3a0fe.entry.js.map +1 -0
- package/dist/ui-library/p-66fe54b3.entry.js +2 -0
- package/dist/ui-library/p-66fe54b3.entry.js.map +1 -0
- package/dist/ui-library/{p-99e24daf.entry.js → p-a2035543.entry.js} +2 -2
- package/dist/ui-library/p-cba69e9d.entry.js +2 -0
- package/dist/ui-library/p-cba69e9d.entry.js.map +1 -0
- package/dist/ui-library/{p-19ed7a4c.entry.js → p-d1bda563.entry.js} +2 -2
- package/dist/ui-library/ui-library.css +2 -2
- package/dist/ui-library/ui-library.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/scroll-03678de1.js.map +0 -1
- package/dist/collection/components/six-tab/test/six-tab.spec.js +0 -20
- package/dist/collection/components/six-tab/test/six-tab.spec.js.map +0 -1
- package/dist/collection/components/six-tab-group/test/six-tab-group.spec.js +0 -45
- package/dist/collection/components/six-tab-group/test/six-tab-group.spec.js.map +0 -1
- package/dist/ui-library/p-1256cc0a.entry.js +0 -2
- package/dist/ui-library/p-1256cc0a.entry.js.map +0 -1
- package/dist/ui-library/p-21b3b321.entry.js +0 -2
- package/dist/ui-library/p-21b3b321.entry.js.map +0 -1
- package/dist/ui-library/p-29ac3d7d.entry.js +0 -2
- package/dist/ui-library/p-29ac3d7d.entry.js.map +0 -1
- package/dist/ui-library/p-2a141e10.entry.js +0 -2
- package/dist/ui-library/p-2a141e10.entry.js.map +0 -1
- package/dist/ui-library/p-4705a51e.entry.js +0 -2
- package/dist/ui-library/p-4705a51e.entry.js.map +0 -1
- package/dist/ui-library/p-83864cfe.entry.js +0 -2
- package/dist/ui-library/p-83864cfe.entry.js.map +0 -1
- package/dist/ui-library/p-ee8342e1.entry.js +0 -2
- package/dist/ui-library/p-ee8342e1.entry.js.map +0 -1
- /package/dist/ui-library/{p-1f18768a.js.map → p-052aa8d3.js.map} +0 -0
- /package/dist/ui-library/{p-99e24daf.entry.js.map → p-a2035543.entry.js.map} +0 -0
- /package/dist/ui-library/{p-19ed7a4c.entry.js.map → p-d1bda563.entry.js.map} +0 -0
|
@@ -43,6 +43,7 @@ export class SixSidebarItemGroup {
|
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
45
|
return (h("six-details", { class: {
|
|
46
|
+
'six-sidebar-item-group': true,
|
|
46
47
|
'six-sidebar-item-group--childless': !this.hasItems,
|
|
47
48
|
'six-sidebar-item-group--subgroup': this.isSubgroup(),
|
|
48
49
|
}, inline: true, open: this.open, "summary-icon": this.summaryIcon, hasContent: this.hasItems }, h("div", { slot: "summary" }, h("div", { class: "six-sidebar-details__header" }, this.icon && h("six-icon", { class: "six-sidebar-details__header-icon" }, this.icon), this.name)), this.provideSlot('summary-icon'), h("slot", null)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-sidebar-item-group.js","sourceRoot":"","sources":["../../../src/components/six-sidebar-item-group/six-sidebar-item-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,E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,IAAI,CAAC,UAAU,EAAE;OACtD,EACD,MAAM,EAAE,IAAI,EACZ,IAAI,EAAE,IAAI,CAAC,IAAI,kBACD,IAAI,CAAC,WAAW,EAC9B,UAAU,EAAE,IAAI,CAAC,QAAQ;MAEzB,WAAK,IAAI,EAAC,SAAS;QACjB,WAAK,KAAK,EAAC,6BAA6B;UACrC,IAAI,CAAC,IAAI,IAAI,gBAAU,KAAK,EAAC,kCAAkC,IAAE,IAAI,CAAC,IAAI,CAAY;UACtF,IAAI,CAAC,IAAI,CACN,CACF;MACL,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;MACjC,eAAQ,CACI,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State } from '@stencil/core';\nimport { hasSlot } from '../../utils/slot';\n\n/**\n * @since 1.0\n * @status stable\n *\n * @slot - Used to define the nested sidebar [group] items.\n */\n\n@Component({\n tag: 'six-sidebar-item-group',\n styleUrl: 'six-sidebar-item-group.scss',\n shadow: true,\n})\nexport class SixSidebarItemGroup {\n @Element() readonly host!: HTMLSixSidebarItemGroupElement;\n\n @State() hasItems = false;\n\n /** Title of item group */\n @Prop() name = '';\n\n /** Icon of the group */\n @Prop() icon = '';\n\n /** A unique value to store in the sidebar item of the group label. This can be used as a way to identify sidebar items when selected. */\n @Prop({ reflect: true }) value = '';\n\n /** Indicates whether the sidebar is shown */\n @Prop({ reflect: true }) open = false;\n\n /** Custom summary icon name. */\n @Prop() summaryIcon?: string;\n\n @State() summaryIconHasContent = false;\n\n connectedCallback() {\n this.handleSlotChange = this.handleSlotChange.bind(this);\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n private handleSlotChange() {\n this.hasItems = hasSlot(this.host);\n }\n\n private isSubgroup() {\n return this.host.parentElement?.closest('six-sidebar-item-group') != null;\n }\n\n private provideSlot = (name: string) => {\n if (this.summaryIconHasContent) {\n return (\n <div slot={name}>\n <slot name={name}></slot>\n </div>\n );\n }\n\n return (\n <slot\n name={name}\n onSlotchange={() => {\n const slot = this.host.shadowRoot?.querySelector<HTMLSlotElement>(`slot[name=\"${name}\"]`);\n if (slot != null) {\n this.summaryIconHasContent = slot.assignedNodes().length > 0;\n }\n }}\n ></slot>\n );\n };\n\n render() {\n return (\n <six-details\n class={{\n 'six-sidebar-item-group--childless': !this.hasItems,\n 'six-sidebar-item-group--subgroup': this.isSubgroup(),\n }}\n inline={true}\n open={this.open}\n summary-icon={this.summaryIcon}\n hasContent={this.hasItems}\n >\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\">\n {this.icon && <six-icon class=\"six-sidebar-details__header-icon\">{this.icon}</six-icon>}\n {this.name}\n </div>\n </div>\n {this.provideSlot('summary-icon')}\n <slot />\n </six-details>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"six-sidebar-item-group.js","sourceRoot":"","sources":["../../../src/components/six-sidebar-item-group/six-sidebar-item-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;;;;GAKG;AAOH,MAAM,OAAO,mBAAmB;;IAsCtB,gBAAW,GAAG,CAAC,IAAY,EAAE,EAAE;MACrC,IAAI,IAAI,CAAC,qBAAqB,EAAE;QAC9B,OAAO,CACL,WAAK,IAAI,EAAE,IAAI;UACb,YAAM,IAAI,EAAE,IAAI,GAAS,CACrB,CACP,CAAC;OACH;MAED,OAAO,CACL,YACE,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,GAAG,EAAE;;UACjB,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAkB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AAQ,CACI,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State } from '@stencil/core';\nimport { hasSlot } from '../../utils/slot';\n\n/**\n * @since 1.0\n * @status stable\n *\n * @slot - Used to define the nested sidebar [group] items.\n */\n\n@Component({\n tag: 'six-sidebar-item-group',\n styleUrl: 'six-sidebar-item-group.scss',\n shadow: true,\n})\nexport class SixSidebarItemGroup {\n @Element() readonly host!: HTMLSixSidebarItemGroupElement;\n\n @State() hasItems = false;\n\n /** Title of item group */\n @Prop() name = '';\n\n /** Icon of the group */\n @Prop() icon = '';\n\n /** A unique value to store in the sidebar item of the group label. This can be used as a way to identify sidebar items when selected. */\n @Prop({ reflect: true }) value = '';\n\n /** Indicates whether the sidebar is shown */\n @Prop({ reflect: true }) open = false;\n\n /** Custom summary icon name. */\n @Prop() summaryIcon?: string;\n\n @State() summaryIconHasContent = false;\n\n connectedCallback() {\n this.handleSlotChange = this.handleSlotChange.bind(this);\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n private handleSlotChange() {\n this.hasItems = hasSlot(this.host);\n }\n\n private isSubgroup() {\n return this.host.parentElement?.closest('six-sidebar-item-group') != null;\n }\n\n private provideSlot = (name: string) => {\n if (this.summaryIconHasContent) {\n return (\n <div slot={name}>\n <slot name={name}></slot>\n </div>\n );\n }\n\n return (\n <slot\n name={name}\n onSlotchange={() => {\n const slot = this.host.shadowRoot?.querySelector<HTMLSlotElement>(`slot[name=\"${name}\"]`);\n if (slot != null) {\n this.summaryIconHasContent = slot.assignedNodes().length > 0;\n }\n }}\n ></slot>\n );\n };\n\n render() {\n return (\n <six-details\n class={{\n 'six-sidebar-item-group': true,\n 'six-sidebar-item-group--childless': !this.hasItems,\n 'six-sidebar-item-group--subgroup': this.isSubgroup(),\n }}\n inline={true}\n open={this.open}\n summary-icon={this.summaryIcon}\n hasContent={this.hasItems}\n >\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\">\n {this.icon && <six-icon class=\"six-sidebar-details__header-icon\">{this.icon}</six-icon>}\n {this.name}\n </div>\n </div>\n {this.provideSlot('summary-icon')}\n <slot />\n </six-details>\n );\n }\n}\n"]}
|
package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js
CHANGED
|
@@ -10,7 +10,7 @@ describe('six-sidebar-item-group', () => {
|
|
|
10
10
|
expect(page.root).toEqualHtml(`
|
|
11
11
|
<six-sidebar-item-group value="">
|
|
12
12
|
<mock:shadow-root>
|
|
13
|
-
<six-details class="six-sidebar-item-group--childless" inline="">
|
|
13
|
+
<six-details class="six-sidebar-item-group six-sidebar-item-group--childless" inline="">
|
|
14
14
|
<div slot="summary">
|
|
15
15
|
<div class="six-sidebar-details__header"></div>
|
|
16
16
|
</div>
|
|
@@ -30,7 +30,7 @@ describe('six-sidebar-item-group', () => {
|
|
|
30
30
|
expect(page.root).toEqualHtml(`
|
|
31
31
|
<six-sidebar-item-group value="">
|
|
32
32
|
<mock:shadow-root>
|
|
33
|
-
<six-details class="six-sidebar-item-group--childless" inline="">
|
|
33
|
+
<six-details class="six-sidebar-item-group six-sidebar-item-group--childless" inline="">
|
|
34
34
|
<div slot="summary">
|
|
35
35
|
<div class="six-sidebar-details__header"></div>
|
|
36
36
|
</div>
|
package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-sidebar-item-group.spec.js","sourceRoot":"","sources":["../../../../src/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;EACtC,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACnC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,mBAAmB,CAAC;MACjC,IAAI,EAAE,mDAAmD;KAC1D,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;KAY7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,mBAAmB,EAAE,cAAc,CAAC;MACjD,IAAI,EAAE,yGAAyG;KAChH,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;KAoB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSidebarItemGroup } from '../six-sidebar-item-group';\nimport { SixSidebarItem } from '../../six-sidebar-item/six-sidebar-item';\n\ndescribe('six-sidebar-item-group', () => {\n it('renders empty group', async () => {\n const page = await newSpecPage({\n components: [SixSidebarItemGroup],\n html: `<six-sidebar-item-group></six-sidebar-item-group>`,\n });\n expect(page.root).toEqualHtml(`\n <six-sidebar-item-group value=\"\">\n <mock:shadow-root>\n <six-details class=\"six-sidebar-item-group--childless\" inline=\"\">\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\"></div>\n </div>\n <slot name=\"summary-icon\"></slot>\n <slot></slot>\n </six-details>\n </mock:shadow-root>\n </six-sidebar-item-group>\n `);\n });\n\n it('renders group with item', async () => {\n const page = await newSpecPage({\n components: [SixSidebarItemGroup, SixSidebarItem],\n html: `<six-sidebar-item-group><six-sidebar-item value=\"data\">Data</six-sidebar-item></six-sidebar-item-group>`,\n });\n\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`\n <six-sidebar-item-group value=\"\">\n <mock:shadow-root>\n <six-details class=\"six-sidebar-item-group--childless\" inline=\"\">\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\"></div>\n </div>\n <slot name=\"summary-icon\"></slot>\n <slot></slot>\n </six-details>\n </mock:shadow-root>\n <six-sidebar-item value=\"data\">\n <mock:shadow-root>\n <div aria-disabled=\"false\" aria-selected=\"false\" class=\"sidebar-item\" role=\"menuitem\">\n <slot></slot>\n </div>\n </mock:shadow-root>\n Data\n </six-sidebar-item>\n </six-sidebar-item-group>\n `);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"six-sidebar-item-group.spec.js","sourceRoot":"","sources":["../../../../src/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;EACtC,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACnC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,mBAAmB,CAAC;MACjC,IAAI,EAAE,mDAAmD;KAC1D,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;KAY7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,mBAAmB,EAAE,cAAc,CAAC;MACjD,IAAI,EAAE,yGAAyG;KAChH,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;KAoB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSidebarItemGroup } from '../six-sidebar-item-group';\nimport { SixSidebarItem } from '../../six-sidebar-item/six-sidebar-item';\n\ndescribe('six-sidebar-item-group', () => {\n it('renders empty group', async () => {\n const page = await newSpecPage({\n components: [SixSidebarItemGroup],\n html: `<six-sidebar-item-group></six-sidebar-item-group>`,\n });\n expect(page.root).toEqualHtml(`\n <six-sidebar-item-group value=\"\">\n <mock:shadow-root>\n <six-details class=\"six-sidebar-item-group six-sidebar-item-group--childless\" inline=\"\">\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\"></div>\n </div>\n <slot name=\"summary-icon\"></slot>\n <slot></slot>\n </six-details>\n </mock:shadow-root>\n </six-sidebar-item-group>\n `);\n });\n\n it('renders group with item', async () => {\n const page = await newSpecPage({\n components: [SixSidebarItemGroup, SixSidebarItem],\n html: `<six-sidebar-item-group><six-sidebar-item value=\"data\">Data</six-sidebar-item></six-sidebar-item-group>`,\n });\n\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`\n <six-sidebar-item-group value=\"\">\n <mock:shadow-root>\n <six-details class=\"six-sidebar-item-group six-sidebar-item-group--childless\" inline=\"\">\n <div slot=\"summary\">\n <div class=\"six-sidebar-details__header\"></div>\n </div>\n <slot name=\"summary-icon\"></slot>\n <slot></slot>\n </six-details>\n </mock:shadow-root>\n <six-sidebar-item value=\"data\">\n <mock:shadow-root>\n <div aria-disabled=\"false\" aria-selected=\"false\" class=\"sidebar-item\" role=\"menuitem\">\n <slot></slot>\n </div>\n </mock:shadow-root>\n Data\n </six-sidebar-item>\n </six-sidebar-item-group>\n `);\n });\n});\n"]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
:host {
|
|
10
|
-
display:
|
|
10
|
+
display: flex;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.tab {
|
|
@@ -16,19 +16,19 @@
|
|
|
16
16
|
font-family: var(--six-font-family);
|
|
17
17
|
font-size: var(--six-font-size-small);
|
|
18
18
|
font-weight: var(--six-font-weight-semibold);
|
|
19
|
-
border-radius: 4px;
|
|
20
19
|
color: var(--six-tab-color);
|
|
21
20
|
padding: var(--six-spacing-medium) var(--six-spacing-large);
|
|
22
21
|
white-space: nowrap;
|
|
23
22
|
user-select: none;
|
|
24
23
|
cursor: pointer;
|
|
25
|
-
|
|
24
|
+
width: 100%;
|
|
26
25
|
}
|
|
27
26
|
.tab:focus {
|
|
28
27
|
outline: none;
|
|
29
28
|
}
|
|
30
|
-
.tab:focus
|
|
31
|
-
|
|
29
|
+
.tab:focus-visible {
|
|
30
|
+
outline: var(--six-focus-ring);
|
|
31
|
+
outline-offset: calc(-1 * var(--six-focus-ring-width) - var(--six-focus-ring-offset));
|
|
32
32
|
}
|
|
33
33
|
.tab.tab--active:not(.tab--disabled) {
|
|
34
34
|
color: var(--six-tab-color-active);
|
|
@@ -51,4 +51,53 @@
|
|
|
51
51
|
}
|
|
52
52
|
.tab__close-button::part(base) {
|
|
53
53
|
padding: var(--six-spacing-xxx-small);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tab__indicator {
|
|
57
|
+
position: absolute;
|
|
58
|
+
}
|
|
59
|
+
.tab__indicator.tab__indicator--active {
|
|
60
|
+
background-color: var(--six-tab-border-color-active);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tab--top {
|
|
64
|
+
margin-bottom: var(--six-spacing-xxx-small);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tab__indicator--top {
|
|
68
|
+
width: 100%;
|
|
69
|
+
bottom: 0;
|
|
70
|
+
height: var(--six-tab-border-width);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tab--bottom {
|
|
74
|
+
margin-top: var(--six-spacing-xxx-small);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.tab__indicator--bottom {
|
|
78
|
+
width: 100%;
|
|
79
|
+
top: 0;
|
|
80
|
+
height: var(--six-tab-border-width);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tab--left {
|
|
84
|
+
margin-right: var(--six-spacing-xxx-small);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tab__indicator--left {
|
|
88
|
+
height: 100%;
|
|
89
|
+
right: 0;
|
|
90
|
+
top: 0;
|
|
91
|
+
width: var(--six-tab-border-width);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tab--right {
|
|
95
|
+
margin-left: var(--six-spacing-xxx-small);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.tab__indicator--right {
|
|
99
|
+
height: 100%;
|
|
100
|
+
left: 0;
|
|
101
|
+
top: 0;
|
|
102
|
+
width: var(--six-tab-border-width);
|
|
54
103
|
}
|
|
@@ -36,15 +36,31 @@ export class SixTab {
|
|
|
36
36
|
this.sixClose.emit();
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
+
var _a;
|
|
40
|
+
const tabGroup = this.host.closest('six-tab-group');
|
|
41
|
+
const placement = (_a = tabGroup === null || tabGroup === void 0 ? void 0 : tabGroup.placement) !== null && _a !== void 0 ? _a : 'top';
|
|
39
42
|
return (
|
|
40
|
-
// If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels
|
|
43
|
+
// If the user didn't provide an ID, we'll set one, so we can link tabs and tab panels with aria labels
|
|
41
44
|
h(Host, { id: this.host.id || this.componentId }, h("div", { part: "base", ref: (el) => (this.tab = el), class: {
|
|
42
45
|
tab: true,
|
|
46
|
+
// Placements
|
|
47
|
+
'tab--top': placement === 'top',
|
|
48
|
+
'tab--bottom': placement === 'bottom',
|
|
49
|
+
'tab--left': placement === 'left',
|
|
50
|
+
'tab--right': placement === 'right',
|
|
43
51
|
// States
|
|
44
52
|
'tab--active': this.active,
|
|
45
53
|
'tab--closable': this.closable,
|
|
46
54
|
'tab--disabled': this.disabled,
|
|
47
|
-
}, role: "tab", "aria-disabled": this.disabled ? 'true' : 'false', "aria-selected": this.active ? 'true' : 'false', tabindex: this.disabled || !this.active ? '-1' : '0' }, h("slot", null), this.closable && (h("six-icon-button", { name: "close", size: "xSmall", exportparts: "base:close-button", class: "tab__close-button", onClick: this.handleCloseClick, tabIndex: -1, "aria-hidden": "true" })))
|
|
55
|
+
}, role: "tab", "aria-disabled": this.disabled ? 'true' : 'false', "aria-selected": this.active ? 'true' : 'false', tabindex: this.disabled || !this.active ? '-1' : '0' }, h("slot", null), this.closable && (h("six-icon-button", { name: "close", size: "xSmall", exportparts: "base:close-button", class: "tab__close-button", onClick: this.handleCloseClick, tabIndex: -1, "aria-hidden": "true" }))), h("div", { class: {
|
|
56
|
+
tab__indicator: true,
|
|
57
|
+
'tab__indicator--active': this.active,
|
|
58
|
+
// Placements
|
|
59
|
+
'tab__indicator--top': placement === 'top',
|
|
60
|
+
'tab__indicator--bottom': placement === 'bottom',
|
|
61
|
+
'tab__indicator--left': placement === 'left',
|
|
62
|
+
'tab__indicator--right': placement === 'right',
|
|
63
|
+
} })));
|
|
48
64
|
}
|
|
49
65
|
static get is() { return "six-tab"; }
|
|
50
66
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-tab.js","sourceRoot":"","sources":["../../../src/components/six-tab/six-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG/F,IAA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AAI,CAAC,CAAC,CAAC,GAAG;QAEpD,eAAQ;QACP,IAAI,CAAC,QAAQ,IAAI,CAChB,uBACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,WAAW,EAAC,mBAAmB,EAC/B,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,QAAQ,EAAE,CAAC,CAAC,iBACA,MAAM,GAClB,CACH,CACG;MACN,WACE,KAAK,EAAE;UACL,cAAc,EAAE,IAAI;UACpB,wBAAwB,EAAE,IAAI,CAAC,MAAM;UAErC,aAAa;UACb,qBAAqB,EAAE,SAAS,KAAK,KAAK;UAC1C,wBAAwB,EAAE,SAAS,KAAK,QAAQ;UAChD,sBAAsB,EAAE,SAAS,KAAK,MAAM;UAC5C,uBAAuB,EAAE,SAAS,KAAK,OAAO;SAC/C,GACI,CACF,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\nimport { EmptyPayload } from '../../utils/types';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot - The tab's label.\n *\n * @part base - The component's base wrapper.\n * @part close-button - The close button, which is the icon button's base wrapper.\n */\n\n@Component({\n tag: 'six-tab',\n styleUrl: 'six-tab.scss',\n shadow: true,\n})\nexport class SixTab {\n private componentId = `tab-${++id}`;\n private tab?: HTMLElement;\n\n @Element() host!: HTMLSixTabElement;\n\n /** The name of the tab panel the tab will control. The panel must be located in the same tab group. */\n @Prop({ reflect: true }) panel = '';\n\n /** Set to true to draw the tab in an active state. */\n @Prop({ reflect: true }) active = false;\n\n /** When true, the tab will be rendered with a close icon. */\n @Prop() closable = false;\n\n /** Set to true to draw the tab in a disabled state. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Emitted when the tab is closable and the close button is activated. */\n @Event({ eventName: 'six-tab-close' }) sixClose!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.handleCloseClick = this.handleCloseClick.bind(this);\n }\n\n /** Sets focus to the tab. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.tab?.focus(options);\n }\n\n /** Removes focus from the tab. */\n @Method()\n async removeFocus() {\n this.tab?.blur();\n }\n\n private handleCloseClick() {\n this.sixClose.emit();\n }\n\n render() {\n const tabGroup: HTMLSixTabGroupElement | null = this.host.closest('six-tab-group');\n const placement = tabGroup?.placement ?? 'top';\n return (\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 <Host id={this.host.id || this.componentId}>\n <div\n part=\"base\"\n ref={(el) => (this.tab = el)}\n class={{\n tab: true,\n\n // Placements\n 'tab--top': placement === 'top',\n 'tab--bottom': placement === 'bottom',\n 'tab--left': placement === 'left',\n 'tab--right': placement === 'right',\n\n // States\n 'tab--active': this.active,\n 'tab--closable': this.closable,\n 'tab--disabled': this.disabled,\n }}\n role=\"tab\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-selected={this.active ? 'true' : 'false'}\n tabindex={this.disabled || !this.active ? '-1' : '0'}\n >\n <slot />\n {this.closable && (\n <six-icon-button\n name=\"close\"\n size=\"xSmall\"\n exportparts=\"base:close-button\"\n class=\"tab__close-button\"\n onClick={this.handleCloseClick}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n )}\n </div>\n <div\n class={{\n tab__indicator: true,\n 'tab__indicator--active': this.active,\n\n // Placements\n 'tab__indicator--top': placement === 'top',\n 'tab__indicator--bottom': placement === 'bottom',\n 'tab__indicator--left': placement === 'left',\n 'tab__indicator--right': placement === 'right',\n }}\n ></div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
box-sizing: inherit;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @prop --tabs-border-color: The color of the border that separates tabs.
|
|
11
|
-
*/
|
|
12
9
|
:host {
|
|
13
|
-
--tabs-border-color: var(--six-tab-border-color);
|
|
14
10
|
display: block;
|
|
15
11
|
}
|
|
16
12
|
|
|
@@ -23,13 +19,6 @@
|
|
|
23
19
|
display: flex;
|
|
24
20
|
position: relative;
|
|
25
21
|
}
|
|
26
|
-
.tab-group .tab-group__active-tab-indicator {
|
|
27
|
-
position: absolute;
|
|
28
|
-
transition: var(--six-transition-fast) transform ease, var(--six-transition-fast) width ease;
|
|
29
|
-
}
|
|
30
|
-
.tab-group:not(.focus-visible) ::slotted(six-tab) {
|
|
31
|
-
--focus-ring: none;
|
|
32
|
-
}
|
|
33
22
|
|
|
34
23
|
.tab-group--has-scroll-controls .tab-group__nav-container {
|
|
35
24
|
position: relative;
|
|
@@ -74,11 +63,6 @@
|
|
|
74
63
|
flex: 1 1 auto;
|
|
75
64
|
position: relative;
|
|
76
65
|
flex-direction: row;
|
|
77
|
-
border-bottom: solid var(--six-tab-border-width) var(--tabs-border-color);
|
|
78
|
-
}
|
|
79
|
-
.tab-group--top .tab-group__active-tab-indicator {
|
|
80
|
-
bottom: -2px;
|
|
81
|
-
border-bottom: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
|
|
82
66
|
}
|
|
83
67
|
.tab-group--top .tab-group__body {
|
|
84
68
|
order: 2;
|
|
@@ -104,11 +88,6 @@
|
|
|
104
88
|
flex: 1 1 auto;
|
|
105
89
|
position: relative;
|
|
106
90
|
flex-direction: row;
|
|
107
|
-
border-top: solid var(--six-tab-border-width) var(--tabs-border-color);
|
|
108
|
-
}
|
|
109
|
-
.tab-group--bottom .tab-group__active-tab-indicator {
|
|
110
|
-
top: -2px;
|
|
111
|
-
border-top: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
|
|
112
91
|
}
|
|
113
92
|
.tab-group--bottom .tab-group__body {
|
|
114
93
|
order: 1;
|
|
@@ -123,11 +102,6 @@
|
|
|
123
102
|
.tab-group--left .tab-group__tabs {
|
|
124
103
|
flex: 0 0 auto;
|
|
125
104
|
flex-direction: column;
|
|
126
|
-
border-right: solid var(--six-tab-border-width) var(--tabs-border-color);
|
|
127
|
-
}
|
|
128
|
-
.tab-group--left .tab-group__active-tab-indicator {
|
|
129
|
-
right: -2px;
|
|
130
|
-
border-right: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
|
|
131
105
|
}
|
|
132
106
|
.tab-group--left .tab-group__body {
|
|
133
107
|
flex: 1 1 auto;
|
|
@@ -143,11 +117,6 @@
|
|
|
143
117
|
.tab-group--right .tab-group__tabs {
|
|
144
118
|
flex: 0 0 auto;
|
|
145
119
|
flex-direction: column;
|
|
146
|
-
border-left: solid var(--six-tab-border-width) var(--tabs-border-color);
|
|
147
|
-
}
|
|
148
|
-
.tab-group--right .tab-group__active-tab-indicator {
|
|
149
|
-
left: -2px;
|
|
150
|
-
border-left: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
|
|
151
120
|
}
|
|
152
121
|
.tab-group--right .tab-group__body {
|
|
153
122
|
flex: 1 1 auto;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { getOffset } from "../../utils/offset";
|
|
3
2
|
import { scrollIntoView } from "../../utils/scroll";
|
|
4
|
-
import {
|
|
3
|
+
import { flipAnimate } from "../../utils/animation";
|
|
5
4
|
/**
|
|
6
5
|
* @since 1.0
|
|
7
6
|
* @status stable
|
|
@@ -42,13 +41,6 @@ export class SixTabGroup {
|
|
|
42
41
|
if (tabGroup !== this.host) {
|
|
43
42
|
return false;
|
|
44
43
|
}
|
|
45
|
-
// Activate a tab
|
|
46
|
-
if (['Enter', ' '].includes(event.key)) {
|
|
47
|
-
if (tab != null) {
|
|
48
|
-
this.setActiveTab(tab);
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
44
|
// Move focus left or right
|
|
53
45
|
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {
|
|
54
46
|
const activeEl = document.activeElement;
|
|
@@ -68,6 +60,7 @@ export class SixTabGroup {
|
|
|
68
60
|
index = Math.min(tabs.length - 1, index + 1);
|
|
69
61
|
}
|
|
70
62
|
tabs[index].setFocus({ preventScroll: true });
|
|
63
|
+
this.setActiveTab(tabs[index]);
|
|
71
64
|
if (['top', 'bottom'].includes(this.placement)) {
|
|
72
65
|
scrollIntoView(tabs[index], this.nav, 'horizontal');
|
|
73
66
|
}
|
|
@@ -91,44 +84,10 @@ export class SixTabGroup {
|
|
|
91
84
|
behavior: 'smooth',
|
|
92
85
|
});
|
|
93
86
|
};
|
|
94
|
-
this.syncActiveTabIndicator = () => {
|
|
95
|
-
if (this.activeTabIndicator == null || this.nav == null)
|
|
96
|
-
return;
|
|
97
|
-
const tab = this.getActiveTab();
|
|
98
|
-
if (tab != null) {
|
|
99
|
-
this.activeTabIndicator.style.display = 'block';
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.activeTabIndicator.style.display = 'none';
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const width = tab.clientWidth;
|
|
106
|
-
const height = tab.clientHeight;
|
|
107
|
-
const offset = getOffset(tab, this.nav);
|
|
108
|
-
const offsetTop = offset.top + this.nav.scrollTop;
|
|
109
|
-
const offsetLeft = offset.left + this.nav.scrollLeft;
|
|
110
|
-
switch (this.placement) {
|
|
111
|
-
case 'top':
|
|
112
|
-
case 'bottom':
|
|
113
|
-
this.activeTabIndicator.style.width = `${width}px`;
|
|
114
|
-
this.activeTabIndicator.style.height = '';
|
|
115
|
-
this.activeTabIndicator.style.transform = `translateX(${offsetLeft}px)`;
|
|
116
|
-
break;
|
|
117
|
-
case 'left':
|
|
118
|
-
case 'right':
|
|
119
|
-
this.activeTabIndicator.style.width = '';
|
|
120
|
-
this.activeTabIndicator.style.height = `${height}px`;
|
|
121
|
-
this.activeTabIndicator.style.transform = `translateY(${offsetTop}px)`;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
87
|
this.hasScrollControls = false;
|
|
126
88
|
this.placement = 'top';
|
|
127
89
|
this.noScrollControls = false;
|
|
128
90
|
}
|
|
129
|
-
handlePlacementChange() {
|
|
130
|
-
this.syncActiveTabIndicator();
|
|
131
|
-
}
|
|
132
91
|
handleNoScrollControlsChange() {
|
|
133
92
|
this.updateScrollControls();
|
|
134
93
|
}
|
|
@@ -144,7 +103,6 @@ export class SixTabGroup {
|
|
|
144
103
|
}
|
|
145
104
|
});
|
|
146
105
|
observer.observe(this.host);
|
|
147
|
-
focusVisible.observe(this.tabGroup);
|
|
148
106
|
this.resizeObserver = new ResizeObserver(() => this.updateScrollControls());
|
|
149
107
|
this.resizeObserver.observe(this.nav);
|
|
150
108
|
requestAnimationFrame(() => this.updateScrollControls());
|
|
@@ -164,7 +122,6 @@ export class SixTabGroup {
|
|
|
164
122
|
return;
|
|
165
123
|
}
|
|
166
124
|
this.mutationObserver.disconnect();
|
|
167
|
-
focusVisible.unobserve(this.tabGroup);
|
|
168
125
|
this.resizeObserver.unobserve(this.nav);
|
|
169
126
|
}
|
|
170
127
|
/** Shows the specified tab panel. */
|
|
@@ -204,15 +161,20 @@ export class SixTabGroup {
|
|
|
204
161
|
: ['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth;
|
|
205
162
|
}
|
|
206
163
|
setActiveTab(tab, emitEvents = true) {
|
|
164
|
+
var _a, _b, _c;
|
|
207
165
|
if (this.nav == null)
|
|
208
166
|
return;
|
|
209
|
-
|
|
167
|
+
const newIndicator = (_a = tab === null || tab === void 0 ? void 0 : tab.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.tab__indicator');
|
|
168
|
+
const oldIndicator = (_c = (_b = this.getActiveTab()) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.tab__indicator');
|
|
169
|
+
if (oldIndicator != null && newIndicator != null) {
|
|
170
|
+
flipAnimate(newIndicator, oldIndicator);
|
|
171
|
+
}
|
|
172
|
+
if (tab !== this.activeTab && !tab.disabled) {
|
|
210
173
|
const previousTab = this.activeTab;
|
|
211
174
|
this.activeTab = tab;
|
|
212
175
|
// Sync tabs and panels
|
|
213
176
|
this.getAllTabs().map((el) => (el.active = el === this.activeTab));
|
|
214
177
|
this.getAllPanels().map((el) => { var _a; return (el.active = el.name === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)); });
|
|
215
|
-
this.syncActiveTabIndicator();
|
|
216
178
|
if (['top', 'bottom'].includes(this.placement)) {
|
|
217
179
|
scrollIntoView(this.activeTab, this.nav, 'horizontal');
|
|
218
180
|
}
|
|
@@ -247,7 +209,7 @@ export class SixTabGroup {
|
|
|
247
209
|
'tab-group--left': this.placement === 'left',
|
|
248
210
|
'tab-group--right': this.placement === 'right',
|
|
249
211
|
'tab-group--has-scroll-controls': this.hasScrollControls,
|
|
250
|
-
}, onClick: this.handleClick, onKeyDown: this.handleKeyDown }, h("div", { class: "tab-group__nav-container" }, this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--left", exportparts: "base:scroll-button", name: "chevron_left", onClick: this.handleScrollLeft })), h("div", { ref: (el) => (this.nav = el), key: "nav", part: "nav", class: "tab-group__nav" }, h("div", { ref: (el) => (this.tabs = el), part: "tabs", class: "tab-group__tabs", role: "tablist" }, h("
|
|
212
|
+
}, onClick: this.handleClick, onKeyDown: this.handleKeyDown }, h("div", { class: "tab-group__nav-container" }, this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--left", exportparts: "base:scroll-button", name: "chevron_left", onClick: this.handleScrollLeft })), h("div", { ref: (el) => (this.nav = el), key: "nav", part: "nav", class: "tab-group__nav" }, h("div", { ref: (el) => (this.tabs = el), part: "tabs", class: "tab-group__tabs", role: "tablist" }, h("slot", { name: "nav" }))), this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--right", exportparts: "base:scroll-button", name: "chevron_right", onClick: this.handleScrollRight }))), h("div", { ref: (el) => (this.body = el), part: "body", class: "tab-group__body" }, h("slot", null))));
|
|
251
213
|
}
|
|
252
214
|
static get is() { return "six-tab-group"; }
|
|
253
215
|
static get encapsulation() { return "shadow"; }
|
|
@@ -378,9 +340,6 @@ export class SixTabGroup {
|
|
|
378
340
|
static get elementRef() { return "host"; }
|
|
379
341
|
static get watchers() {
|
|
380
342
|
return [{
|
|
381
|
-
"propName": "placement",
|
|
382
|
-
"methodName": "handlePlacementChange"
|
|
383
|
-
}, {
|
|
384
343
|
"propName": "noScrollControls",
|
|
385
344
|
"methodName": "handleNoScrollControlsChange"
|
|
386
345
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-tab-group.js","sourceRoot":"","sources":["../../../src/components/six-tab-group/six-tab-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAUzD;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,OAAO,WAAW;;IAgHd,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;MAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;MAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;MACtC,MAAM,QAAQ,GAAG,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CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,iBAAiB;QACrE,YAAM,YAAY,EAAE,IAAI,CAAC,sBAAsB,GAAI,CAC/C,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { getOffset } from '../../utils/offset';\nimport { scrollIntoView } from '../../utils/scroll';\nimport { focusVisible } from '../../utils/focus-visible';\n\nexport interface SixTabShowPayload {\n name: string;\n}\n\nexport interface SixTabHidePayload {\n name: string;\n}\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot nav - Used for grouping tabs in the tab group.\n * @slot - Used for grouping tab panels in the tab group.\n *\n * @part base - The component's base wrapper.\n * @part nav - The tab group navigation container.\n * @part tabs - The container that wraps the slotted tabs.\n * @part active-tab-indicator - An element that displays the currently selected tab. This is a child of the tab's container.\n * @part body - The tab group body where tab panels are slotted in.\n * @part scroll-button - The previous and next scroll buttons that appear when tabs are scrollable.\n */\n@Component({\n tag: 'six-tab-group',\n styleUrl: 'six-tab-group.scss',\n shadow: true,\n})\nexport class SixTabGroup {\n private activeTab?: HTMLSixTabElement;\n private activeTabIndicator?: HTMLElement;\n private body?: HTMLElement;\n private mutationObserver?: MutationObserver;\n private nav?: HTMLElement;\n private resizeObserver?: ResizeObserver;\n private tabGroup?: HTMLElement;\n private tabs?: HTMLElement;\n\n @Element() host!: HTMLSixTabGroupElement;\n\n @State() hasScrollControls = false;\n\n /** The placement of the tabs. */\n @Prop() placement: 'top' | 'bottom' | 'left' | 'right' = 'top';\n\n /** Disables the scroll arrows that appear when tabs overflow. */\n @Prop() noScrollControls = false;\n\n @Watch('placement')\n handlePlacementChange() {\n this.syncActiveTabIndicator();\n }\n\n @Watch('noScrollControls')\n handleNoScrollControlsChange() {\n this.updateScrollControls();\n }\n\n /** Emitted when a tab is shown. */\n @Event({ eventName: 'six-tab-show' }) sixTabShow!: EventEmitter<SixTabShowPayload>;\n\n /** Emitted when a tab is hidden. */\n @Event({ eventName: 'six-tab-hide' }) sixTabHide!: EventEmitter<SixTabHidePayload>;\n\n componentDidLoad() {\n if (this.tabGroup == null || this.nav == null) return;\n\n // Set initial tab state when the tabs first become visible\n const observer = new IntersectionObserver((entries, observer) => {\n if (entries[0].intersectionRatio > 0) {\n this.setAriaLabels();\n this.setActiveTab(this.getActiveTab() || this.getAllTabs()[0], false);\n observer.unobserve(entries[0].target);\n }\n });\n observer.observe(this.host);\n\n focusVisible.observe(this.tabGroup);\n\n this.resizeObserver = new ResizeObserver(() => this.updateScrollControls());\n this.resizeObserver.observe(this.nav);\n requestAnimationFrame(() => this.updateScrollControls());\n\n // Update aria labels if the DOM changes\n this.mutationObserver = new MutationObserver((mutations) => {\n if (\n mutations.some((mutation) => {\n return !['aria-labelledby', 'aria-controls'].includes(mutation.attributeName ?? '');\n })\n ) {\n setTimeout(() => this.setAriaLabels());\n }\n });\n this.mutationObserver.observe(this.host, { attributes: true, childList: true, subtree: true });\n }\n\n disconnectedCallback() {\n if (this.mutationObserver == null || this.tabGroup == null || this.nav == null || this.resizeObserver == null) {\n return;\n }\n\n this.mutationObserver.disconnect();\n focusVisible.unobserve(this.tabGroup);\n this.resizeObserver.unobserve(this.nav);\n }\n\n /** Shows the specified tab panel. */\n @Method()\n async show(panel: string) {\n const tabs = this.getAllTabs();\n const tab = tabs.find((el) => el.panel === panel);\n\n if (tab != null) {\n this.setActiveTab(tab);\n }\n }\n\n private getAllTabs(includeDisabled = false): HTMLSixTabElement[] {\n const slot = this.tabs?.querySelector('slot');\n if (slot == null) return [];\n\n return [...slot.assignedElements()].filter((el: Element) => {\n return includeDisabled\n ? el.tagName.toLowerCase() === 'six-tab'\n : el.tagName.toLowerCase() === 'six-tab' && !(el as HTMLSixTabElement).disabled;\n }) as [HTMLSixTabElement];\n }\n\n private getAllPanels(): HTMLSixTabPanelElement[] {\n const slot = this.body?.querySelector('slot');\n if (slot == null) return [];\n return [...slot.assignedElements()].filter((el: Element) => el.tagName.toLowerCase() === 'six-tab-panel') as [\n HTMLSixTabPanelElement\n ];\n }\n\n private getActiveTab() {\n return this.getAllTabs().find((el) => el.active);\n }\n\n private handleClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n const tab = target.closest('six-tab');\n const tabGroup = tab?.closest('six-tab-group');\n\n // Ensure the target tab is in this tab group\n if (tabGroup !== this.host) {\n return false;\n }\n\n if (tab != null) {\n this.setActiveTab(tab);\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.nav == null) return;\n\n const target = event.target as HTMLElement;\n const tab = target.closest('six-tab');\n const tabGroup = tab?.closest('six-tab-group');\n\n // Ensure the target tab is in this tab group\n if (tabGroup !== this.host) {\n return false;\n }\n\n // Activate a tab\n if (['Enter', ' '].includes(event.key)) {\n if (tab != null) {\n this.setActiveTab(tab);\n event.preventDefault();\n }\n }\n\n // Move focus left or right\n if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n const activeEl = document.activeElement as HTMLSixTabElement;\n\n if (activeEl && activeEl.tagName.toLowerCase() === 'six-tab') {\n const tabs = this.getAllTabs();\n let index = tabs.indexOf(activeEl);\n\n if (event.key === 'Home') {\n index = 0;\n } else if (event.key === 'End') {\n index = tabs.length - 1;\n } else if (event.key === 'ArrowLeft') {\n index = Math.max(0, index - 1);\n } else if (event.key === 'ArrowRight') {\n index = Math.min(tabs.length - 1, index + 1);\n }\n\n tabs[index].setFocus({ preventScroll: true });\n\n if (['top', 'bottom'].includes(this.placement)) {\n scrollIntoView(tabs[index], this.nav, 'horizontal');\n }\n\n event.preventDefault();\n }\n }\n };\n\n private handleScrollLeft = () => {\n if (this.nav == null) return;\n\n this.nav.scroll({\n left: this.nav.scrollLeft - this.nav.clientWidth,\n behavior: 'smooth',\n });\n };\n\n private handleScrollRight = () => {\n if (this.nav == null) return;\n\n this.nav.scroll({\n left: this.nav.scrollLeft + this.nav.clientWidth,\n behavior: 'smooth',\n });\n };\n\n private updateScrollControls() {\n if (this.nav == null) return;\n\n this.hasScrollControls = this.noScrollControls\n ? false\n : ['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth;\n }\n\n private setActiveTab(tab: HTMLSixTabElement, emitEvents = true) {\n if (this.nav == null) return;\n\n if (tab != null && tab !== this.activeTab && !tab.disabled) {\n const previousTab = this.activeTab;\n this.activeTab = tab;\n\n // Sync tabs and panels\n this.getAllTabs().map((el) => (el.active = el === this.activeTab));\n this.getAllPanels().map((el) => (el.active = el.name === this.activeTab?.panel));\n this.syncActiveTabIndicator();\n\n if (['top', 'bottom'].includes(this.placement)) {\n scrollIntoView(this.activeTab, this.nav, 'horizontal');\n }\n\n // Emit events\n if (emitEvents) {\n if (previousTab != null) {\n this.sixTabHide.emit({ name: previousTab.panel });\n }\n\n this.sixTabShow.emit({ name: this.activeTab.panel });\n }\n }\n }\n\n private setAriaLabels() {\n const tabs = this.getAllTabs();\n const panels = this.getAllPanels();\n\n // Link each tab with its corresponding panel\n tabs.map((tab) => {\n const panel = panels.find((el) => el.name === tab.panel);\n if (panel != null) {\n tab.setAttribute('aria-controls', panel.getAttribute('id') ?? '');\n panel.setAttribute('aria-labelledby', tab.getAttribute('id') ?? '');\n }\n });\n }\n\n private syncActiveTabIndicator = () => {\n if (this.activeTabIndicator == null || this.nav == null) return;\n\n const tab = this.getActiveTab();\n\n if (tab != null) {\n this.activeTabIndicator.style.display = 'block';\n } else {\n this.activeTabIndicator.style.display = 'none';\n return;\n }\n\n const width = tab.clientWidth;\n const height = tab.clientHeight;\n const offset = getOffset(tab, this.nav);\n const offsetTop = offset.top + this.nav.scrollTop;\n const offsetLeft = offset.left + this.nav.scrollLeft;\n\n switch (this.placement) {\n case 'top':\n case 'bottom':\n this.activeTabIndicator.style.width = `${width}px`;\n this.activeTabIndicator.style.height = '';\n this.activeTabIndicator.style.transform = `translateX(${offsetLeft}px)`;\n break;\n\n case 'left':\n case 'right':\n this.activeTabIndicator.style.width = '';\n this.activeTabIndicator.style.height = `${height}px`;\n this.activeTabIndicator.style.transform = `translateY(${offsetTop}px)`;\n break;\n }\n };\n\n render() {\n return (\n <div\n part=\"base\"\n ref={(el) => (this.tabGroup = el)}\n class={{\n 'tab-group': true,\n\n // Placements\n 'tab-group--top': this.placement === 'top',\n 'tab-group--bottom': this.placement === 'bottom',\n 'tab-group--left': this.placement === 'left',\n 'tab-group--right': this.placement === 'right',\n\n 'tab-group--has-scroll-controls': this.hasScrollControls,\n }}\n onClick={this.handleClick}\n onKeyDown={this.handleKeyDown}\n >\n <div class=\"tab-group__nav-container\">\n {this.hasScrollControls && (\n <six-icon-button\n class=\"tab-group__scroll-button tab-group__scroll-button--left\"\n exportparts=\"base:scroll-button\"\n name=\"chevron_left\"\n onClick={this.handleScrollLeft}\n />\n )}\n <div ref={(el) => (this.nav = el)} key=\"nav\" part=\"nav\" class=\"tab-group__nav\">\n <div ref={(el) => (this.tabs = el)} part=\"tabs\" class=\"tab-group__tabs\" role=\"tablist\">\n <div\n ref={(el) => (this.activeTabIndicator = el)}\n part=\"active-tab-indicator\"\n class=\"tab-group__active-tab-indicator\"\n />\n <slot name=\"nav\" onSlotchange={this.syncActiveTabIndicator} />\n </div>\n </div>\n {this.hasScrollControls && (\n <six-icon-button\n class=\"tab-group__scroll-button tab-group__scroll-button--right\"\n exportparts=\"base:scroll-button\"\n name=\"chevron_right\"\n onClick={this.handleScrollRight}\n />\n )}\n </div>\n\n <div ref={(el) => (this.body = el)} part=\"body\" class=\"tab-group__body\">\n <slot onSlotchange={this.syncActiveTabIndicator} />\n </div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"six-tab-group.js","sourceRoot":"","sources":["../../../src/components/six-tab-group/six-tab-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAUpD;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,OAAO,WAAW;;IAqGd,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;MAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;MAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;MACtC,MAAM,QAAQ,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC,eAAe,CAAC,CAAC;MAE/C,6CAA6C;MAC7C,IAAI,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE;QAC1B,OAAO,KAAK,CAAC;OACd;MAED,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;OACxB;IACH,CAAC,CAAC;IAEM,kBAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;MAC/C,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI;QAAE,OAAO;MAE7B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;MAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;MACtC,MAAM,QAAQ,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC,eAAe,CAAC,CAAC;MAE/C,6CAA6C;MAC7C,IAAI,QAAQ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AAC,KAAK,GAAG,CACf,CACF;QACL,IAAI,CAAC,iBAAiB,IAAI,CACzB,uBACE,KAAK,EAAC,0DAA0D,EAChE,WAAW,EAAC,oBAAoB,EAChC,IAAI,EAAC,eAAe,EACpB,OAAO,EAAE,IAAI,CAAC,iBAAiB,GAC/B,CACH,CACG;MAEN,WAAK,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,iBAAiB;QACrE,eAAQ,CACJ,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { scrollIntoView } from '../../utils/scroll';\nimport { flipAnimate } from '../../utils/animation';\n\nexport interface SixTabShowPayload {\n name: string;\n}\n\nexport interface SixTabHidePayload {\n name: string;\n}\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot nav - Used for grouping tabs in the tab group.\n * @slot - Used for grouping tab panels in the tab group.\n *\n * @part base - The component's base wrapper.\n * @part nav - The tab group navigation container.\n * @part tabs - The container that wraps the slotted tabs.\n * @part active-tab-indicator - An element that displays the currently selected tab. This is a child of the tab's container.\n * @part body - The tab group body where tab panels are slotted in.\n * @part scroll-button - The previous and next scroll buttons that appear when tabs are scrollable.\n */\n@Component({\n tag: 'six-tab-group',\n styleUrl: 'six-tab-group.scss',\n shadow: true,\n})\nexport class SixTabGroup {\n private activeTab?: HTMLSixTabElement;\n private body?: HTMLElement;\n private mutationObserver?: MutationObserver;\n private nav?: HTMLElement;\n private resizeObserver?: ResizeObserver;\n private tabGroup?: HTMLElement;\n private tabs?: HTMLElement;\n\n @Element() host!: HTMLSixTabGroupElement;\n\n @State() hasScrollControls = false;\n\n /** The placement of the tabs. */\n @Prop() placement: 'top' | 'bottom' | 'left' | 'right' = 'top';\n\n /** Disables the scroll arrows that appear when tabs overflow. */\n @Prop() noScrollControls = false;\n\n @Watch('noScrollControls')\n handleNoScrollControlsChange() {\n this.updateScrollControls();\n }\n\n /** Emitted when a tab is shown. */\n @Event({ eventName: 'six-tab-show' }) sixTabShow!: EventEmitter<SixTabShowPayload>;\n\n /** Emitted when a tab is hidden. */\n @Event({ eventName: 'six-tab-hide' }) sixTabHide!: EventEmitter<SixTabHidePayload>;\n\n componentDidLoad() {\n if (this.tabGroup == null || this.nav == null) return;\n\n // Set initial tab state when the tabs first become visible\n const observer = new IntersectionObserver((entries, observer) => {\n if (entries[0].intersectionRatio > 0) {\n this.setAriaLabels();\n this.setActiveTab(this.getActiveTab() || this.getAllTabs()[0], false);\n observer.unobserve(entries[0].target);\n }\n });\n observer.observe(this.host);\n this.resizeObserver = new ResizeObserver(() => this.updateScrollControls());\n this.resizeObserver.observe(this.nav);\n requestAnimationFrame(() => this.updateScrollControls());\n\n // Update aria labels if the DOM changes\n this.mutationObserver = new MutationObserver((mutations) => {\n if (\n mutations.some((mutation) => {\n return !['aria-labelledby', 'aria-controls'].includes(mutation.attributeName ?? '');\n })\n ) {\n setTimeout(() => this.setAriaLabels());\n }\n });\n this.mutationObserver.observe(this.host, { attributes: true, childList: true, subtree: true });\n }\n\n disconnectedCallback() {\n if (this.mutationObserver == null || this.tabGroup == null || this.nav == null || this.resizeObserver == null) {\n return;\n }\n this.mutationObserver.disconnect();\n this.resizeObserver.unobserve(this.nav);\n }\n\n /** Shows the specified tab panel. */\n @Method()\n async show(panel: string) {\n const tabs = this.getAllTabs();\n const tab = tabs.find((el) => el.panel === panel);\n\n if (tab != null) {\n this.setActiveTab(tab);\n }\n }\n\n private getAllTabs(includeDisabled = false): HTMLSixTabElement[] {\n const slot = this.tabs?.querySelector('slot');\n if (slot == null) return [];\n\n return [...slot.assignedElements()].filter((el: Element) => {\n return includeDisabled\n ? el.tagName.toLowerCase() === 'six-tab'\n : el.tagName.toLowerCase() === 'six-tab' && !(el as HTMLSixTabElement).disabled;\n }) as [HTMLSixTabElement];\n }\n\n private getAllPanels(): HTMLSixTabPanelElement[] {\n const slot = this.body?.querySelector('slot');\n if (slot == null) return [];\n return [...slot.assignedElements()].filter((el: Element) => el.tagName.toLowerCase() === 'six-tab-panel') as [\n HTMLSixTabPanelElement\n ];\n }\n\n private getActiveTab() {\n return this.getAllTabs().find((el) => el.active);\n }\n\n private handleClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n const tab = target.closest('six-tab');\n const tabGroup = tab?.closest('six-tab-group');\n\n // Ensure the target tab is in this tab group\n if (tabGroup !== this.host) {\n return false;\n }\n\n if (tab != null) {\n this.setActiveTab(tab);\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.nav == null) return;\n\n const target = event.target as HTMLElement;\n const tab = target.closest('six-tab');\n const tabGroup = tab?.closest('six-tab-group');\n\n // Ensure the target tab is in this tab group\n if (tabGroup !== this.host) {\n return false;\n }\n\n // Move focus left or right\n if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n const activeEl = document.activeElement as HTMLSixTabElement;\n\n if (activeEl && activeEl.tagName.toLowerCase() === 'six-tab') {\n const tabs = this.getAllTabs();\n let index = tabs.indexOf(activeEl);\n\n if (event.key === 'Home') {\n index = 0;\n } else if (event.key === 'End') {\n index = tabs.length - 1;\n } else if (event.key === 'ArrowLeft') {\n index = Math.max(0, index - 1);\n } else if (event.key === 'ArrowRight') {\n index = Math.min(tabs.length - 1, index + 1);\n }\n\n tabs[index].setFocus({ preventScroll: true });\n this.setActiveTab(tabs[index]);\n\n if (['top', 'bottom'].includes(this.placement)) {\n scrollIntoView(tabs[index], this.nav, 'horizontal');\n }\n\n event.preventDefault();\n }\n }\n };\n\n private handleScrollLeft = () => {\n if (this.nav == null) return;\n\n this.nav.scroll({\n left: this.nav.scrollLeft - this.nav.clientWidth,\n behavior: 'smooth',\n });\n };\n\n private handleScrollRight = () => {\n if (this.nav == null) return;\n\n this.nav.scroll({\n left: this.nav.scrollLeft + this.nav.clientWidth,\n behavior: 'smooth',\n });\n };\n\n private updateScrollControls() {\n if (this.nav == null) return;\n\n this.hasScrollControls = this.noScrollControls\n ? false\n : ['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth;\n }\n\n private setActiveTab(tab: HTMLSixTabElement, emitEvents = true) {\n if (this.nav == null) return;\n\n const newIndicator = tab?.shadowRoot?.querySelector('.tab__indicator');\n const oldIndicator = this.getActiveTab()?.shadowRoot?.querySelector('.tab__indicator');\n\n if (oldIndicator != null && newIndicator != null) {\n flipAnimate(newIndicator, oldIndicator);\n }\n\n if (tab !== this.activeTab && !tab.disabled) {\n const previousTab = this.activeTab;\n this.activeTab = tab;\n\n // Sync tabs and panels\n this.getAllTabs().map((el) => (el.active = el === this.activeTab));\n this.getAllPanels().map((el) => (el.active = el.name === this.activeTab?.panel));\n\n if (['top', 'bottom'].includes(this.placement)) {\n scrollIntoView(this.activeTab, this.nav, 'horizontal');\n }\n\n // Emit events\n if (emitEvents) {\n if (previousTab != null) {\n this.sixTabHide.emit({ name: previousTab.panel });\n }\n\n this.sixTabShow.emit({ name: this.activeTab.panel });\n }\n }\n }\n\n private setAriaLabels() {\n const tabs = this.getAllTabs();\n const panels = this.getAllPanels();\n\n // Link each tab with its corresponding panel\n tabs.map((tab) => {\n const panel = panels.find((el) => el.name === tab.panel);\n if (panel != null) {\n tab.setAttribute('aria-controls', panel.getAttribute('id') ?? '');\n panel.setAttribute('aria-labelledby', tab.getAttribute('id') ?? '');\n }\n });\n }\n\n render() {\n return (\n <div\n part=\"base\"\n ref={(el) => (this.tabGroup = el)}\n class={{\n 'tab-group': true,\n\n // Placements\n 'tab-group--top': this.placement === 'top',\n 'tab-group--bottom': this.placement === 'bottom',\n 'tab-group--left': this.placement === 'left',\n 'tab-group--right': this.placement === 'right',\n\n 'tab-group--has-scroll-controls': this.hasScrollControls,\n }}\n onClick={this.handleClick}\n onKeyDown={this.handleKeyDown}\n >\n <div class=\"tab-group__nav-container\">\n {this.hasScrollControls && (\n <six-icon-button\n class=\"tab-group__scroll-button tab-group__scroll-button--left\"\n exportparts=\"base:scroll-button\"\n name=\"chevron_left\"\n onClick={this.handleScrollLeft}\n />\n )}\n <div ref={(el) => (this.nav = el)} key=\"nav\" part=\"nav\" class=\"tab-group__nav\">\n <div ref={(el) => (this.tabs = el)} part=\"tabs\" class=\"tab-group__tabs\" role=\"tablist\">\n <slot name=\"nav\" />\n </div>\n </div>\n {this.hasScrollControls && (\n <six-icon-button\n class=\"tab-group__scroll-button tab-group__scroll-button--right\"\n exportparts=\"base:scroll-button\"\n name=\"chevron_right\"\n onClick={this.handleScrollRight}\n />\n )}\n </div>\n\n <div ref={(el) => (this.body = el)} part=\"body\" class=\"tab-group__body\">\n <slot />\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animates a given `element` from the position and dimension of `fromElement` to
|
|
3
|
+
* its current position and dimension. Can be useful to implement the FLIP animation technique.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://css-tricks.com/animating-layouts-with-the-flip-technique/} for details on the FLIP technique.
|
|
6
|
+
*
|
|
7
|
+
* @param {Element} element - The element to animate.
|
|
8
|
+
* @param {Element} fromElement - The element representing the initial position and dimensions.
|
|
9
|
+
* @param {KeyframeAnimationOptions} [options={ duration: 150, easing: 'ease', fill: 'both' }] - Optional animation parameters.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export function flipAnimate(element, fromElement, options = {
|
|
13
|
+
duration: 150,
|
|
14
|
+
easing: 'ease',
|
|
15
|
+
fill: 'both',
|
|
16
|
+
}) {
|
|
17
|
+
const dimensionsTo = fromElement.getBoundingClientRect();
|
|
18
|
+
const dimensionsFrom = element.getBoundingClientRect();
|
|
19
|
+
const deltaX = dimensionsTo.left - dimensionsFrom.left;
|
|
20
|
+
const deltaY = dimensionsTo.top - dimensionsFrom.top;
|
|
21
|
+
const deltaW = dimensionsTo.width / dimensionsFrom.width;
|
|
22
|
+
const deltaH = dimensionsTo.height / dimensionsFrom.height;
|
|
23
|
+
element.animate([
|
|
24
|
+
{
|
|
25
|
+
transformOrigin: 'top left',
|
|
26
|
+
transform: `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
transformOrigin: 'top left',
|
|
30
|
+
transform: 'none',
|
|
31
|
+
},
|
|
32
|
+
], options);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../src/utils/animation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,WAAoB,EACpB,UAAoC;EAClC,QAAQ,EAAE,GAAG;EACb,MAAM,EAAE,MAAM;EACd,IAAI,EAAE,MAAM;CACb;EAED,MAAM,YAAY,GAAG,WAAW,CAAC,qBAAqB,EAAE,CAAC;EACzD,MAAM,cAAc,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;EAEvD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;EACvD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC;EACrD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;EACzD,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;EAE3D,OAAO,CAAC,OAAO,CACb;IACE;MACE,eAAe,EAAE,UAAU;MAC3B,SAAS,EAAE,aAAa,MAAM,OAAO,MAAM,aAAa,MAAM,KAAK,MAAM,GAAG;KAC7E;IACD;MACE,eAAe,EAAE,UAAU;MAC3B,SAAS,EAAE,MAAM;KAClB;GACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Animates a given `element` from the position and dimension of `fromElement` to\n * its current position and dimension. Can be useful to implement the FLIP animation technique.\n *\n * @see {@link https://css-tricks.com/animating-layouts-with-the-flip-technique/} for details on the FLIP technique.\n *\n * @param {Element} element - The element to animate.\n * @param {Element} fromElement - The element representing the initial position and dimensions.\n * @param {KeyframeAnimationOptions} [options={ duration: 150, easing: 'ease', fill: 'both' }] - Optional animation parameters.\n *\n */\nexport function flipAnimate(\n element: Element,\n fromElement: Element,\n options: KeyframeAnimationOptions = {\n duration: 150,\n easing: 'ease',\n fill: 'both',\n }\n) {\n const dimensionsTo = fromElement.getBoundingClientRect();\n const dimensionsFrom = element.getBoundingClientRect();\n\n const deltaX = dimensionsTo.left - dimensionsFrom.left;\n const deltaY = dimensionsTo.top - dimensionsFrom.top;\n const deltaW = dimensionsTo.width / dimensionsFrom.width;\n const deltaH = dimensionsTo.height / dimensionsFrom.height;\n\n element.animate(\n [\n {\n transformOrigin: 'top left',\n transform: `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`,\n },\n {\n transformOrigin: 'top left',\n transform: 'none',\n },\n ],\n options\n );\n}\n"]}
|
|
@@ -59,6 +59,6 @@ function scrollIntoView(element, container, direction = 'vertical', behavior = '
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export {
|
|
62
|
+
export { lockBodyScrolling as l, scrollIntoView as s, unlockBodyScrolling as u };
|
|
63
63
|
|
|
64
64
|
//# sourceMappingURL=scroll.js.map
|