@u-elements/u-tabs 0.0.9 → 0.0.10
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/u-tabs.cjs +6 -7
- package/dist/u-tabs.d.cts +4 -5
- package/dist/u-tabs.d.ts +4 -5
- package/dist/u-tabs.js +6 -7
- package/package.json +13 -1
package/dist/u-tabs.cjs
CHANGED
|
@@ -11,8 +11,7 @@ var DISPLAY_BLOCK = ":host(:not([hidden])) { display: block }";
|
|
|
11
11
|
var UHTMLElement = typeof HTMLElement === "undefined" ? class {
|
|
12
12
|
} : HTMLElement;
|
|
13
13
|
function attr(el, name, value) {
|
|
14
|
-
|
|
15
|
-
if (value === void 0) return (_a2 = el.getAttribute(name)) != null ? _a2 : null;
|
|
14
|
+
if (value === void 0) return el.getAttribute(name);
|
|
16
15
|
if (value === null) el.removeAttribute(name);
|
|
17
16
|
else if (el.getAttribute(name) !== value) el.setAttribute(name, value);
|
|
18
17
|
return null;
|
|
@@ -36,7 +35,7 @@ var mutationObserver = (element, options) => {
|
|
|
36
35
|
try {
|
|
37
36
|
observers.get(element).disconnect();
|
|
38
37
|
observers.delete(element);
|
|
39
|
-
} catch (
|
|
38
|
+
} catch (_err) {
|
|
40
39
|
}
|
|
41
40
|
if (options) {
|
|
42
41
|
const observer = new MutationObserver(
|
|
@@ -182,8 +181,8 @@ var UHTMLTabElement = class extends UHTMLElement {
|
|
|
182
181
|
const panel = getPanel(tab, panels[index]);
|
|
183
182
|
tab.tabIndex = tab === this ? 0 : -1;
|
|
184
183
|
attr(tab, ARIA_SELECTED, `${tab === this}`);
|
|
184
|
+
attr(tab, ARIA_CONTROLS, (panel == null ? void 0 : panel.id) || null);
|
|
185
185
|
if (panel) panel.hidden = panel !== nextPanel;
|
|
186
|
-
if (panel) attr(tab, ARIA_CONTROLS, panel.id);
|
|
187
186
|
});
|
|
188
187
|
SKIP_ATTR_CHANGE = false;
|
|
189
188
|
}
|
|
@@ -225,9 +224,9 @@ var UHTMLTabPanelElement = class extends UHTMLElement {
|
|
|
225
224
|
this.attributeChangedCallback();
|
|
226
225
|
}
|
|
227
226
|
attributeChangedCallback() {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
const hidden = this.hidden;
|
|
228
|
+
attr(this, "aria-hidden", `${hidden}`);
|
|
229
|
+
attr(this, "tabindex", hidden || isFocusable(this.firstChild) ? null : "0");
|
|
231
230
|
}
|
|
232
231
|
get tabsElement() {
|
|
233
232
|
return this.closest("u-tabs");
|
package/dist/u-tabs.d.cts
CHANGED
|
@@ -64,7 +64,6 @@ declare class UHTMLTabPanelElement extends UHTMLElement {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export { UHTMLTabElement, UHTMLTabListElement, UHTMLTabPanelElement, UHTMLTabsElement };
|
|
67
|
-
|
|
68
67
|
import type * as PreactTypes from 'preact'
|
|
69
68
|
import type * as ReactTypes from 'react'
|
|
70
69
|
import type * as SvelteTypes from 'svelte/elements'
|
|
@@ -73,7 +72,7 @@ import type { JSX as QwikJSX } from '@builder.io/qwik/jsx-runtime'
|
|
|
73
72
|
import type { JSX as SolidJSX } from 'solid-js'
|
|
74
73
|
|
|
75
74
|
|
|
76
|
-
export type PreactUtabs = PreactTypes.JSX.HTMLAttributes<
|
|
75
|
+
export type PreactUtabs = PreactTypes.JSX.HTMLAttributes<UHTMLTabsElement> & { }
|
|
77
76
|
export type ReactUtabs = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabsElement>, UHTMLTabsElement> & { class?: string }
|
|
78
77
|
export type QwikUtabs = QwikJSX.IntrinsicElements['div']
|
|
79
78
|
export type VueUtabs = VueJSX.HTMLAttributes
|
|
@@ -92,7 +91,7 @@ declare module 'solid-js' {
|
|
|
92
91
|
interface CustomEvents { }
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
export type PreactUtablist = PreactTypes.JSX.HTMLAttributes<
|
|
94
|
+
export type PreactUtablist = PreactTypes.JSX.HTMLAttributes<UHTMLTabListElement> & { }
|
|
96
95
|
export type ReactUtablist = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabListElement>, UHTMLTabListElement> & { class?: string }
|
|
97
96
|
export type QwikUtablist = QwikJSX.IntrinsicElements['div']
|
|
98
97
|
export type VueUtablist = VueJSX.HTMLAttributes
|
|
@@ -111,7 +110,7 @@ declare module 'solid-js' {
|
|
|
111
110
|
interface CustomEvents { }
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
export type PreactUtab = PreactTypes.JSX.HTMLAttributes<
|
|
113
|
+
export type PreactUtab = PreactTypes.JSX.HTMLAttributes<UHTMLTabElement> & { }
|
|
115
114
|
export type ReactUtab = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabElement>, UHTMLTabElement> & { class?: string }
|
|
116
115
|
export type QwikUtab = QwikJSX.IntrinsicElements['div']
|
|
117
116
|
export type VueUtab = VueJSX.HTMLAttributes
|
|
@@ -130,7 +129,7 @@ declare module 'solid-js' {
|
|
|
130
129
|
interface CustomEvents { }
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
export type PreactUtabpanel = PreactTypes.JSX.HTMLAttributes<
|
|
132
|
+
export type PreactUtabpanel = PreactTypes.JSX.HTMLAttributes<UHTMLTabPanelElement> & { }
|
|
134
133
|
export type ReactUtabpanel = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabPanelElement>, UHTMLTabPanelElement> & { class?: string }
|
|
135
134
|
export type QwikUtabpanel = QwikJSX.IntrinsicElements['div']
|
|
136
135
|
export type VueUtabpanel = VueJSX.HTMLAttributes
|
package/dist/u-tabs.d.ts
CHANGED
|
@@ -64,7 +64,6 @@ declare class UHTMLTabPanelElement extends UHTMLElement {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export { UHTMLTabElement, UHTMLTabListElement, UHTMLTabPanelElement, UHTMLTabsElement };
|
|
67
|
-
|
|
68
67
|
import type * as PreactTypes from 'preact'
|
|
69
68
|
import type * as ReactTypes from 'react'
|
|
70
69
|
import type * as SvelteTypes from 'svelte/elements'
|
|
@@ -73,7 +72,7 @@ import type { JSX as QwikJSX } from '@builder.io/qwik/jsx-runtime'
|
|
|
73
72
|
import type { JSX as SolidJSX } from 'solid-js'
|
|
74
73
|
|
|
75
74
|
|
|
76
|
-
export type PreactUtabs = PreactTypes.JSX.HTMLAttributes<
|
|
75
|
+
export type PreactUtabs = PreactTypes.JSX.HTMLAttributes<UHTMLTabsElement> & { }
|
|
77
76
|
export type ReactUtabs = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabsElement>, UHTMLTabsElement> & { class?: string }
|
|
78
77
|
export type QwikUtabs = QwikJSX.IntrinsicElements['div']
|
|
79
78
|
export type VueUtabs = VueJSX.HTMLAttributes
|
|
@@ -92,7 +91,7 @@ declare module 'solid-js' {
|
|
|
92
91
|
interface CustomEvents { }
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
export type PreactUtablist = PreactTypes.JSX.HTMLAttributes<
|
|
94
|
+
export type PreactUtablist = PreactTypes.JSX.HTMLAttributes<UHTMLTabListElement> & { }
|
|
96
95
|
export type ReactUtablist = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabListElement>, UHTMLTabListElement> & { class?: string }
|
|
97
96
|
export type QwikUtablist = QwikJSX.IntrinsicElements['div']
|
|
98
97
|
export type VueUtablist = VueJSX.HTMLAttributes
|
|
@@ -111,7 +110,7 @@ declare module 'solid-js' {
|
|
|
111
110
|
interface CustomEvents { }
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
export type PreactUtab = PreactTypes.JSX.HTMLAttributes<
|
|
113
|
+
export type PreactUtab = PreactTypes.JSX.HTMLAttributes<UHTMLTabElement> & { }
|
|
115
114
|
export type ReactUtab = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabElement>, UHTMLTabElement> & { class?: string }
|
|
116
115
|
export type QwikUtab = QwikJSX.IntrinsicElements['div']
|
|
117
116
|
export type VueUtab = VueJSX.HTMLAttributes
|
|
@@ -130,7 +129,7 @@ declare module 'solid-js' {
|
|
|
130
129
|
interface CustomEvents { }
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
export type PreactUtabpanel = PreactTypes.JSX.HTMLAttributes<
|
|
132
|
+
export type PreactUtabpanel = PreactTypes.JSX.HTMLAttributes<UHTMLTabPanelElement> & { }
|
|
134
133
|
export type ReactUtabpanel = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<UHTMLTabPanelElement>, UHTMLTabPanelElement> & { class?: string }
|
|
135
134
|
export type QwikUtabpanel = QwikJSX.IntrinsicElements['div']
|
|
136
135
|
export type VueUtabpanel = VueJSX.HTMLAttributes
|
package/dist/u-tabs.js
CHANGED
|
@@ -9,8 +9,7 @@ var DISPLAY_BLOCK = ":host(:not([hidden])) { display: block }";
|
|
|
9
9
|
var UHTMLElement = typeof HTMLElement === "undefined" ? class {
|
|
10
10
|
} : HTMLElement;
|
|
11
11
|
function attr(el, name, value) {
|
|
12
|
-
|
|
13
|
-
if (value === void 0) return (_a2 = el.getAttribute(name)) != null ? _a2 : null;
|
|
12
|
+
if (value === void 0) return el.getAttribute(name);
|
|
14
13
|
if (value === null) el.removeAttribute(name);
|
|
15
14
|
else if (el.getAttribute(name) !== value) el.setAttribute(name, value);
|
|
16
15
|
return null;
|
|
@@ -34,7 +33,7 @@ var mutationObserver = (element, options) => {
|
|
|
34
33
|
try {
|
|
35
34
|
observers.get(element).disconnect();
|
|
36
35
|
observers.delete(element);
|
|
37
|
-
} catch (
|
|
36
|
+
} catch (_err) {
|
|
38
37
|
}
|
|
39
38
|
if (options) {
|
|
40
39
|
const observer = new MutationObserver(
|
|
@@ -180,8 +179,8 @@ var UHTMLTabElement = class extends UHTMLElement {
|
|
|
180
179
|
const panel = getPanel(tab, panels[index]);
|
|
181
180
|
tab.tabIndex = tab === this ? 0 : -1;
|
|
182
181
|
attr(tab, ARIA_SELECTED, `${tab === this}`);
|
|
182
|
+
attr(tab, ARIA_CONTROLS, (panel == null ? void 0 : panel.id) || null);
|
|
183
183
|
if (panel) panel.hidden = panel !== nextPanel;
|
|
184
|
-
if (panel) attr(tab, ARIA_CONTROLS, panel.id);
|
|
185
184
|
});
|
|
186
185
|
SKIP_ATTR_CHANGE = false;
|
|
187
186
|
}
|
|
@@ -223,9 +222,9 @@ var UHTMLTabPanelElement = class extends UHTMLElement {
|
|
|
223
222
|
this.attributeChangedCallback();
|
|
224
223
|
}
|
|
225
224
|
attributeChangedCallback() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
const hidden = this.hidden;
|
|
226
|
+
attr(this, "aria-hidden", `${hidden}`);
|
|
227
|
+
attr(this, "tabindex", hidden || isFocusable(this.firstChild) ? null : "0");
|
|
229
228
|
}
|
|
230
229
|
get tabsElement() {
|
|
231
230
|
return this.closest("u-tabs");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@u-elements/u-tabs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "HTML tags, just truly accessible",
|
|
6
6
|
"homepage": "https://u-elements.github.io/u-elements/",
|
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
"module": "dist/u-tabs.js",
|
|
10
10
|
"types": "dist/u-tabs.d.ts",
|
|
11
11
|
"customElements": "dist/u-tabs.manifest.json",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/u-tabs.d.ts",
|
|
16
|
+
"default": "./dist/u-tabs.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/u-tabs.d.cts",
|
|
20
|
+
"default": "./dist/u-tabs.cjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
12
24
|
"files": [
|
|
13
25
|
"dist"
|
|
14
26
|
],
|