@tapestry-ui/tabs 0.1.0 → 0.2.0
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/tabs.js +3 -3
- package/package.json +5 -2
- package/styles.css +5 -5
package/dist/tabs.js
CHANGED
|
@@ -56,10 +56,10 @@ export function Tabs(props) {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
const selected = props.items[selectedIndex];
|
|
59
|
-
return (_jsxs("div", { id: base, class: cx('tui-tabs', props.class), "data-part": "root", children: [_jsx("div", { ref: listRef, class: cx('tui-
|
|
59
|
+
return (_jsxs("div", { id: base, class: cx('tui-tabs', props.class), "data-part": "root", children: [_jsx("div", { ref: listRef, class: cx('tui-tabs__list', props.listClass), "data-part": "list", role: "tablist", "aria-label": props.label, children: props.items.map((item, index) => {
|
|
60
60
|
const isSelected = index === selectedIndex;
|
|
61
|
-
return (_jsx("button", { type: "button", role: "tab", "data-part": "tab", "data-state": isSelected ? 'selected' : 'idle', id: `${base}-tab-${index}`, class: cx('tui-
|
|
62
|
-
}) }), _jsx("div", { role: "tabpanel", "data-part": "panel", id: `${base}-panel-${selectedIndex}`, class: cx('tui-
|
|
61
|
+
return (_jsx("button", { type: "button", role: "tab", "data-part": "tab", "data-state": isSelected ? 'selected' : 'idle', id: `${base}-tab-${index}`, class: cx('tui-tabs__tab', props.tabClass), "aria-selected": isSelected, "aria-controls": `${base}-panel-${index}`, tabIndex: isSelected ? 0 : -1, disabled: item.disabled, onClick: () => select(index), onKeyDown: (event) => handleKey(event, index), children: item.label }, ids[index]));
|
|
62
|
+
}) }), _jsx("div", { role: "tabpanel", "data-part": "panel", id: `${base}-panel-${selectedIndex}`, class: cx('tui-tabs__panel', props.panelClass), "aria-labelledby": `${base}-tab-${selectedIndex}`, tabIndex: 0, children: selected?.content })] }));
|
|
63
63
|
}
|
|
64
64
|
function cx(...parts) {
|
|
65
65
|
return parts.filter(Boolean).join(' ');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapestry-ui/tabs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A WCAG 2.1 AA tab set for Preact
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A WCAG 2.1 AA tab set for Preact \u2014 roving tabindex, arrow-key navigation, headless behavior, skin via CSS. Forged inside a woven-tapestry game; ships with its container contract, not just its markup.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brandon Minton",
|
|
7
7
|
"type": "module",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"./styles.css": "./styles.css"
|
|
17
17
|
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
18
21
|
"files": [
|
|
19
22
|
"dist",
|
|
20
23
|
"styles.css",
|
package/styles.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* @tapestry-ui/tabs — STRUCTURAL styles only. The skin is yours:
|
|
2
2
|
override the custom properties, or ignore this file entirely and
|
|
3
3
|
style [data-part] hooks from scratch. Nothing here picks a color. */
|
|
4
|
-
.tui-
|
|
4
|
+
.tui-tabs__list {
|
|
5
5
|
display: flex;
|
|
6
6
|
gap: var(--tui-tabs-gap, 0.5em);
|
|
7
7
|
flex-wrap: wrap;
|
|
8
8
|
}
|
|
9
|
-
.tui-
|
|
9
|
+
.tui-tabs__tab {
|
|
10
10
|
font: inherit;
|
|
11
11
|
color: inherit;
|
|
12
12
|
background: none;
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
cursor: pointer;
|
|
15
15
|
padding: var(--tui-tabs-tab-pad, 0.4em 0.8em);
|
|
16
16
|
}
|
|
17
|
-
.tui-
|
|
18
|
-
.tui-
|
|
19
|
-
.tui-
|
|
17
|
+
.tui-tabs__tab:disabled { cursor: default; opacity: 0.5; }
|
|
18
|
+
.tui-tabs__tab:focus-visible,
|
|
19
|
+
.tui-tabs__panel:focus-visible {
|
|
20
20
|
outline: var(--tui-tabs-focus, 2px solid currentColor);
|
|
21
21
|
outline-offset: 2px;
|
|
22
22
|
}
|