monobill-mintui 0.6.702 → 0.6.703
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/bin/component-dependencies.json +5 -1
- package/dist/components/tabs/Tab.d.ts +2 -0
- package/dist/components/tabs/Tab.d.ts.map +1 -1
- package/dist/components/tabs/TabList.d.ts.map +1 -1
- package/dist/components/tabs/browser.js +39 -11
- package/dist/components/tabs/index.cjs +1 -1
- package/dist/components/tabs/index.js +39 -11
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +35 -11
- package/dist/tabs.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tab.ts"],"names":[],"mappings":"AAGA,cAAM,OAAQ,SAAQ,WAAW;IAC/B,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,aAAa,CAAyC;;
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tab.ts"],"names":[],"mappings":"AAGA,OAAO,iBAAiB,CAAA;AAExB,cAAM,OAAQ,SAAQ,WAAW;IAC/B,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,cAAc,CAAgC;;IAMtD,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAM5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAO9F,SAAS,IAAI,MAAM;IAInB,QAAQ,IAAI,OAAO;IAKnB,UAAU,IAAI,OAAO;IAKrB,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAMxB;IAED,MAAM,IAAI,IAAI;IAmCd,mBAAmB,IAAI,IAAI;IAW3B,oBAAoB,IAAI,IAAI;IAO5B,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAgCrC;AAOD,eAAe,OAAO,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/TabList.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,CAAA;AAEd,KAAK,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;AAE/C,cAAM,WAAY,SAAQ,WAAW;IACnC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;;IAMD,iBAAiB,IAAI,IAAI;IAIzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,WAAW,IAAI,eAAe;IAK9B,MAAM,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/TabList.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,CAAA;AAEd,KAAK,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;AAE/C,cAAM,WAAY,SAAQ,WAAW;IACnC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;;IAMD,iBAAiB,IAAI,IAAI;IAIzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,WAAW,IAAI,eAAe;IAK9B,MAAM,IAAI,IAAI;CAYf;AAOD,eAAe,WAAW,CAAA"}
|
|
@@ -11,8 +11,12 @@ const __mintLoadStyle = (key, url) => {
|
|
|
11
11
|
document.head.append(link)
|
|
12
12
|
}
|
|
13
13
|
__mintLoadStyle('theme', '../../theme.css')
|
|
14
|
+
__mintLoadStyle('button', '../../button.css')
|
|
15
|
+
__mintLoadStyle('spinner', '../../spinner.css')
|
|
16
|
+
__mintLoadStyle('icon', '../../icon.css')
|
|
14
17
|
__mintLoadStyle('tabs', '../../tabs.css')
|
|
15
18
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
19
|
+
import "../chunks/button-CUWUQAt8.js";
|
|
16
20
|
//#region src/components/tabs/Tab.ts
|
|
17
21
|
var t = class extends HTMLElement {
|
|
18
22
|
static get observedAttributes() {
|
|
@@ -23,16 +27,20 @@ var t = class extends HTMLElement {
|
|
|
23
27
|
];
|
|
24
28
|
}
|
|
25
29
|
constructor() {
|
|
26
|
-
super(), this._clickHandler = null;
|
|
30
|
+
super(), this._clickHandler = null, this._childObserver = null;
|
|
27
31
|
}
|
|
28
32
|
connectedCallback() {
|
|
29
|
-
this.render(), this.setupEventListeners()
|
|
33
|
+
this.render(), this.setupEventListeners(), this._childObserver = new MutationObserver(() => this.render()), this._childObserver.observe(this, {
|
|
34
|
+
childList: !0,
|
|
35
|
+
characterData: !0,
|
|
36
|
+
subtree: !0
|
|
37
|
+
});
|
|
30
38
|
}
|
|
31
39
|
disconnectedCallback() {
|
|
32
|
-
this.removeEventListeners();
|
|
40
|
+
this.removeEventListeners(), this._childObserver?.disconnect(), this._childObserver = null;
|
|
33
41
|
}
|
|
34
42
|
attributeChangedCallback(e, t, n) {
|
|
35
|
-
t !== n && this.render();
|
|
43
|
+
t !== n && (this.render(), this.setupEventListeners());
|
|
36
44
|
}
|
|
37
45
|
getTarget() {
|
|
38
46
|
return this.getAttribute("target") || "";
|
|
@@ -50,19 +58,31 @@ var t = class extends HTMLElement {
|
|
|
50
58
|
set active(e) {
|
|
51
59
|
e ? this.setAttribute("active", "true") : this.setAttribute("active", "false");
|
|
52
60
|
}
|
|
53
|
-
render() {
|
|
61
|
+
render() {
|
|
62
|
+
let e = this.querySelector(":scope > mint-button[data-mint-tab-button=\"true\"]");
|
|
63
|
+
e || (e = document.createElement("mint-button"), e.setAttribute("data-mint-tab-button", "true"), e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", "-1")), Array.from(this.childNodes).forEach((t) => {
|
|
64
|
+
t !== e && e.appendChild(t);
|
|
65
|
+
}), e.parentElement !== this && this.appendChild(e), e.setAttribute("variant", this.isActive() ? "solid" : "ghost"), e.setAttribute("tone", "neutral"), this.isDisabled() ? e.setAttribute("disabled", "true") : e.removeAttribute("disabled");
|
|
66
|
+
let t = this.closest("mint-tab-list")?.getAttribute("full-width");
|
|
67
|
+
t !== null && t !== "false" ? e.setAttribute("full-width", "true") : e.removeAttribute("full-width");
|
|
68
|
+
let n = e.querySelector("button");
|
|
69
|
+
n && (n.tabIndex = -1);
|
|
70
|
+
let r = e.textContent?.trim();
|
|
71
|
+
r && (!this.hasAttribute("aria-label") || this.hasAttribute("data-mint-tab-auto-label")) && (this.setAttribute("aria-label", r), this.setAttribute("data-mint-tab-auto-label", "true"));
|
|
72
|
+
}
|
|
54
73
|
setupEventListeners() {
|
|
55
|
-
this.isDisabled() || this._clickHandler || (this._clickHandler = this.handleClick.bind(this), this.addEventListener("click", this._clickHandler));
|
|
74
|
+
this.isDisabled() || this._clickHandler || (this._clickHandler = this.handleClick.bind(this), this.addEventListener("click", this._clickHandler, !0));
|
|
56
75
|
}
|
|
57
76
|
removeEventListeners() {
|
|
58
|
-
this._clickHandler &&= (this.removeEventListener("click", this._clickHandler), null);
|
|
77
|
+
this._clickHandler &&= (this.removeEventListener("click", this._clickHandler, !0), null);
|
|
59
78
|
}
|
|
60
79
|
handleClick(e) {
|
|
61
80
|
if (this.isDisabled()) {
|
|
62
81
|
e.preventDefault(), e.stopPropagation();
|
|
63
82
|
return;
|
|
64
83
|
}
|
|
65
|
-
|
|
84
|
+
if (e.__mintTabsSynthetic) return;
|
|
85
|
+
e.stopPropagation(), this.dispatchEvent(new CustomEvent("tab-click", {
|
|
66
86
|
detail: {
|
|
67
87
|
tab: this,
|
|
68
88
|
target: this.getTarget()
|
|
@@ -70,7 +90,13 @@ var t = class extends HTMLElement {
|
|
|
70
90
|
bubbles: !0,
|
|
71
91
|
cancelable: !0,
|
|
72
92
|
composed: !0
|
|
73
|
-
}))
|
|
93
|
+
}));
|
|
94
|
+
let t = new MouseEvent("click", {
|
|
95
|
+
bubbles: !0,
|
|
96
|
+
cancelable: !0,
|
|
97
|
+
composed: !0
|
|
98
|
+
});
|
|
99
|
+
t.__mintTabsSynthetic = !0, this.dispatchEvent(t);
|
|
74
100
|
}
|
|
75
101
|
};
|
|
76
102
|
customElements.get("mint-tab") || e("mint-tab", t);
|
|
@@ -78,7 +104,7 @@ customElements.get("mint-tab") || e("mint-tab", t);
|
|
|
78
104
|
//#region src/components/tabs/TabList.ts
|
|
79
105
|
var n = class extends HTMLElement {
|
|
80
106
|
static get observedAttributes() {
|
|
81
|
-
return ["position"];
|
|
107
|
+
return ["position", "full-width"];
|
|
82
108
|
}
|
|
83
109
|
constructor() {
|
|
84
110
|
super();
|
|
@@ -93,7 +119,9 @@ var n = class extends HTMLElement {
|
|
|
93
119
|
return this.getAttribute("position") || "top";
|
|
94
120
|
}
|
|
95
121
|
render() {
|
|
96
|
-
this.setAttribute("role", "tablist"), !this.hasAttribute("aria-label") && !this.hasAttribute("aria-labelledby") && this.setAttribute("aria-label", "Tabs"), this.setAttribute("aria-orientation", this.getPosition() === "top" ? "horizontal" : "vertical")
|
|
122
|
+
this.setAttribute("role", "tablist"), !this.hasAttribute("aria-label") && !this.hasAttribute("aria-labelledby") && this.setAttribute("aria-label", "Tabs"), this.setAttribute("aria-orientation", this.getPosition() === "top" ? "horizontal" : "vertical"), this.querySelectorAll("mint-tab").forEach((e) => {
|
|
123
|
+
e.render?.();
|
|
124
|
+
});
|
|
97
125
|
}
|
|
98
126
|
};
|
|
99
127
|
customElements.get("mint-tab-list") || e("mint-tab-list", n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunks/register-element-tCL_F1YI.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/button-imX8FM_Q.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null,this._childObserver=null}connectedCallback(){this.render(),this.setupEventListeners(),this._childObserver=new MutationObserver(()=>this.render()),this._childObserver.observe(this,{childList:!0,characterData:!0,subtree:!0})}disconnectedCallback(){this.removeEventListeners(),this._childObserver?.disconnect(),this._childObserver=null}attributeChangedCallback(e,t,n){t!==n&&(this.render(),this.setupEventListeners())}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.querySelector(`:scope > mint-button[data-mint-tab-button="true"]`);e||(e=document.createElement(`mint-button`),e.setAttribute(`data-mint-tab-button`,`true`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`tabindex`,`-1`)),Array.from(this.childNodes).forEach(t=>{t!==e&&e.appendChild(t)}),e.parentElement!==this&&this.appendChild(e),e.setAttribute(`variant`,this.isActive()?`solid`:`ghost`),e.setAttribute(`tone`,`neutral`),this.isDisabled()?e.setAttribute(`disabled`,`true`):e.removeAttribute(`disabled`);let t=this.closest(`mint-tab-list`)?.getAttribute(`full-width`);t!==null&&t!==`false`?e.setAttribute(`full-width`,`true`):e.removeAttribute(`full-width`);let n=e.querySelector(`button`);n&&(n.tabIndex=-1);let r=e.textContent?.trim();r&&(!this.hasAttribute(`aria-label`)||this.hasAttribute(`data-mint-tab-auto-label`))&&(this.setAttribute(`aria-label`,r),this.setAttribute(`data-mint-tab-auto-label`,`true`))}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler,!0))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler,!0),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}if(e.__mintTabsSynthetic)return;e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0}));let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0});t.__mintTabsSynthetic=!0,this.dispatchEvent(t)}};customElements.get(`mint-tab`)||e.t(`mint-tab`,t);var n=class extends HTMLElement{static get observedAttributes(){return[`position`,`full-width`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){this.setAttribute(`role`,`tablist`),!this.hasAttribute(`aria-label`)&&!this.hasAttribute(`aria-labelledby`)&&this.setAttribute(`aria-label`,`Tabs`),this.setAttribute(`aria-orientation`,this.getPosition()===`top`?`horizontal`:`vertical`),this.querySelectorAll(`mint-tab`).forEach(e=>{e.render?.()})}};customElements.get(`mint-tab-list`)||e.t(`mint-tab-list`,n);var r=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.removeAttribute(`hidden`)}hide(){this.setAttribute(`hidden`,``)}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.hide();return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.show():this.hide()}render(){this.setAttribute(`role`,`tabpanel`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`)}};customElements.get(`mint-tab-content`)||e.t(`mint-tab-content`,r);var i=class e extends HTMLElement{static{this._id=0}constructor(){super(),this._tabClickHandler=null,this._tabKeydownHandler=null,this._mutationObserver=null}connectedCallback(){this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}this.syncAccessibility()}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.syncAccessibility(),this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler)),this._tabKeydownHandler||(this._tabKeydownHandler=e=>{let t=e.target?.closest(`mint-tab`),n=t?.closest(`mint-tab-list`);if(!t||!n)return;let r=Array.from(n.querySelectorAll(`mint-tab:not([disabled="true"])`)),i=r.indexOf(t);if(i<0||r.length===0)return;let a=n.getAttribute(`position`)===`left`||n.getAttribute(`position`)===`right`,o=i;if(e.key===(a?`ArrowDown`:`ArrowRight`))o=(i+1)%r.length;else if(e.key===(a?`ArrowUp`:`ArrowLeft`))o=(i-1+r.length)%r.length;else if(e.key===`Home`)o=0;else if(e.key===`End`)o=r.length-1;else return;e.preventDefault();let s=r[o];s.focus(),this.activateTab(s)},this.addEventListener(`keydown`,this._tabKeydownHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null),this._tabKeydownHandler&&=(this.removeEventListener(`keydown`,this._tabKeydownHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab;t&&this.activateTab(t)}activateTab(e){let t=e.getAttribute(`target`),n=e.closest(`mint-tab-list`);n&&(n.querySelectorAll(`mint-tab`).forEach(t=>{let n=t;t===e?n.active=!0:n.active=!1}),t&&this.showContent(t),this.syncAccessibility())}syncAccessibility(){this.id||=(e._id+=1,`mint-tabs-${e._id}`),Array.from(this.querySelectorAll(`mint-tab-list`)).forEach((e,t)=>{e.setAttribute(`role`,`tablist`),e.setAttribute(`aria-orientation`,e.getAttribute(`position`)===`left`||e.getAttribute(`position`)===`right`?`vertical`:`horizontal`),!e.hasAttribute(`aria-label`)&&!e.hasAttribute(`aria-labelledby`)&&e.setAttribute(`aria-label`,`Tabs`),Array.from(e.querySelectorAll(`mint-tab`)).forEach((e,n)=>{let r=e.id||`${this.id}-tab-${t+1}-${n+1}`;e.id=r,e.setAttribute(`role`,`tab`);let i=e.getAttribute(`active`)===`true`;e.setAttribute(`aria-selected`,String(i)),e.setAttribute(`aria-disabled`,String(e.getAttribute(`disabled`)===`true`)),e.tabIndex=i?0:-1;let a=e.getAttribute(`target`);a?e.setAttribute(`aria-controls`,a):e.removeAttribute(`aria-controls`);let o=a?Array.from(this.querySelectorAll(`mint-tab-content`)).find(e=>e.id===a)??null:null;o&&(o.setAttribute(`role`,`tabpanel`),o.setAttribute(`aria-labelledby`,r),o.hasAttribute(`tabindex`)||(o.tabIndex=0))})})}};customElements.get(`mint-tabs`)||e.t(`mint-tabs`,i),exports.Tab=t,exports.TabContent=r,exports.TabList=n,exports.Tabs=i;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import '../../theme.css'
|
|
2
|
+
import '../../button.css'
|
|
3
|
+
import '../../spinner.css'
|
|
4
|
+
import '../../icon.css'
|
|
2
5
|
import '../../tabs.css'
|
|
3
6
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
7
|
+
import "../chunks/button-CUWUQAt8.js";
|
|
4
8
|
//#region src/components/tabs/Tab.ts
|
|
5
9
|
var t = class extends HTMLElement {
|
|
6
10
|
static get observedAttributes() {
|
|
@@ -11,16 +15,20 @@ var t = class extends HTMLElement {
|
|
|
11
15
|
];
|
|
12
16
|
}
|
|
13
17
|
constructor() {
|
|
14
|
-
super(), this._clickHandler = null;
|
|
18
|
+
super(), this._clickHandler = null, this._childObserver = null;
|
|
15
19
|
}
|
|
16
20
|
connectedCallback() {
|
|
17
|
-
this.render(), this.setupEventListeners()
|
|
21
|
+
this.render(), this.setupEventListeners(), this._childObserver = new MutationObserver(() => this.render()), this._childObserver.observe(this, {
|
|
22
|
+
childList: !0,
|
|
23
|
+
characterData: !0,
|
|
24
|
+
subtree: !0
|
|
25
|
+
});
|
|
18
26
|
}
|
|
19
27
|
disconnectedCallback() {
|
|
20
|
-
this.removeEventListeners();
|
|
28
|
+
this.removeEventListeners(), this._childObserver?.disconnect(), this._childObserver = null;
|
|
21
29
|
}
|
|
22
30
|
attributeChangedCallback(e, t, n) {
|
|
23
|
-
t !== n && this.render();
|
|
31
|
+
t !== n && (this.render(), this.setupEventListeners());
|
|
24
32
|
}
|
|
25
33
|
getTarget() {
|
|
26
34
|
return this.getAttribute("target") || "";
|
|
@@ -38,19 +46,31 @@ var t = class extends HTMLElement {
|
|
|
38
46
|
set active(e) {
|
|
39
47
|
e ? this.setAttribute("active", "true") : this.setAttribute("active", "false");
|
|
40
48
|
}
|
|
41
|
-
render() {
|
|
49
|
+
render() {
|
|
50
|
+
let e = this.querySelector(":scope > mint-button[data-mint-tab-button=\"true\"]");
|
|
51
|
+
e || (e = document.createElement("mint-button"), e.setAttribute("data-mint-tab-button", "true"), e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", "-1")), Array.from(this.childNodes).forEach((t) => {
|
|
52
|
+
t !== e && e.appendChild(t);
|
|
53
|
+
}), e.parentElement !== this && this.appendChild(e), e.setAttribute("variant", this.isActive() ? "solid" : "ghost"), e.setAttribute("tone", "neutral"), this.isDisabled() ? e.setAttribute("disabled", "true") : e.removeAttribute("disabled");
|
|
54
|
+
let t = this.closest("mint-tab-list")?.getAttribute("full-width");
|
|
55
|
+
t !== null && t !== "false" ? e.setAttribute("full-width", "true") : e.removeAttribute("full-width");
|
|
56
|
+
let n = e.querySelector("button");
|
|
57
|
+
n && (n.tabIndex = -1);
|
|
58
|
+
let r = e.textContent?.trim();
|
|
59
|
+
r && (!this.hasAttribute("aria-label") || this.hasAttribute("data-mint-tab-auto-label")) && (this.setAttribute("aria-label", r), this.setAttribute("data-mint-tab-auto-label", "true"));
|
|
60
|
+
}
|
|
42
61
|
setupEventListeners() {
|
|
43
|
-
this.isDisabled() || this._clickHandler || (this._clickHandler = this.handleClick.bind(this), this.addEventListener("click", this._clickHandler));
|
|
62
|
+
this.isDisabled() || this._clickHandler || (this._clickHandler = this.handleClick.bind(this), this.addEventListener("click", this._clickHandler, !0));
|
|
44
63
|
}
|
|
45
64
|
removeEventListeners() {
|
|
46
|
-
this._clickHandler &&= (this.removeEventListener("click", this._clickHandler), null);
|
|
65
|
+
this._clickHandler &&= (this.removeEventListener("click", this._clickHandler, !0), null);
|
|
47
66
|
}
|
|
48
67
|
handleClick(e) {
|
|
49
68
|
if (this.isDisabled()) {
|
|
50
69
|
e.preventDefault(), e.stopPropagation();
|
|
51
70
|
return;
|
|
52
71
|
}
|
|
53
|
-
|
|
72
|
+
if (e.__mintTabsSynthetic) return;
|
|
73
|
+
e.stopPropagation(), this.dispatchEvent(new CustomEvent("tab-click", {
|
|
54
74
|
detail: {
|
|
55
75
|
tab: this,
|
|
56
76
|
target: this.getTarget()
|
|
@@ -58,7 +78,13 @@ var t = class extends HTMLElement {
|
|
|
58
78
|
bubbles: !0,
|
|
59
79
|
cancelable: !0,
|
|
60
80
|
composed: !0
|
|
61
|
-
}))
|
|
81
|
+
}));
|
|
82
|
+
let t = new MouseEvent("click", {
|
|
83
|
+
bubbles: !0,
|
|
84
|
+
cancelable: !0,
|
|
85
|
+
composed: !0
|
|
86
|
+
});
|
|
87
|
+
t.__mintTabsSynthetic = !0, this.dispatchEvent(t);
|
|
62
88
|
}
|
|
63
89
|
};
|
|
64
90
|
customElements.get("mint-tab") || e("mint-tab", t);
|
|
@@ -66,7 +92,7 @@ customElements.get("mint-tab") || e("mint-tab", t);
|
|
|
66
92
|
//#region src/components/tabs/TabList.ts
|
|
67
93
|
var n = class extends HTMLElement {
|
|
68
94
|
static get observedAttributes() {
|
|
69
|
-
return ["position"];
|
|
95
|
+
return ["position", "full-width"];
|
|
70
96
|
}
|
|
71
97
|
constructor() {
|
|
72
98
|
super();
|
|
@@ -81,7 +107,9 @@ var n = class extends HTMLElement {
|
|
|
81
107
|
return this.getAttribute("position") || "top";
|
|
82
108
|
}
|
|
83
109
|
render() {
|
|
84
|
-
this.setAttribute("role", "tablist"), !this.hasAttribute("aria-label") && !this.hasAttribute("aria-labelledby") && this.setAttribute("aria-label", "Tabs"), this.setAttribute("aria-orientation", this.getPosition() === "top" ? "horizontal" : "vertical")
|
|
110
|
+
this.setAttribute("role", "tablist"), !this.hasAttribute("aria-label") && !this.hasAttribute("aria-labelledby") && this.setAttribute("aria-label", "Tabs"), this.setAttribute("aria-orientation", this.getPosition() === "top" ? "horizontal" : "vertical"), this.querySelectorAll("mint-tab").forEach((e) => {
|
|
111
|
+
e.render?.();
|
|
112
|
+
});
|
|
85
113
|
}
|
|
86
114
|
};
|
|
87
115
|
customElements.get("mint-tab-list") || e("mint-tab-list", n);
|