@lo-ink/ui 0.4.1 → 0.4.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/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +3 -1
- package/package.json +1 -1
- package/src/Tabs.tsx +5 -1
package/dist/Tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../src/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,CACX;IACC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,kFAAkF;AAClF,wBAAgB,IAAI,CAAC,EACnB,OAAO,EACP,KAAK,EACL,aAAa,EACb,EAAE,EAAE,UAAU,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,SAAS,+
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../src/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,CACX;IACC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,kFAAkF;AAClF,wBAAgB,IAAI,CAAC,EACnB,OAAO,EACP,KAAK,EACL,aAAa,EACb,EAAE,EAAE,UAAU,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,SAAS,+BAkFX"}
|
package/dist/Tabs.js
CHANGED
|
@@ -9,6 +9,8 @@ export function Tabs({ options, value, onValueChange, id: providedId, className,
|
|
|
9
9
|
const focusValue = options.some((option) => option.value === value && !option.disabled)
|
|
10
10
|
? value
|
|
11
11
|
: options.find((option) => !option.disabled)?.value;
|
|
12
|
+
// Recreated arrays and labels must not override a user's manual scrolling.
|
|
13
|
+
const optionStructure = JSON.stringify(options.map((option) => [option.value, Boolean(option.disabled)]));
|
|
12
14
|
useEffect(() => {
|
|
13
15
|
const selected = row.current?.querySelector('[aria-selected="true"]');
|
|
14
16
|
if (!selected || !row.current)
|
|
@@ -20,7 +22,7 @@ export function Tabs({ options, value, onValueChange, id: providedId, className,
|
|
|
20
22
|
viewport.scrollLeft += bounds.left - visible.left;
|
|
21
23
|
else if (bounds.right > visible.right)
|
|
22
24
|
viewport.scrollLeft += bounds.right - visible.right;
|
|
23
|
-
}, [value,
|
|
25
|
+
}, [value, optionStructure]);
|
|
24
26
|
return (_jsx("div", { ...props, id: id, ref: row, role: "tablist", "aria-orientation": "horizontal", className: classes("lo-ui-tabs", className), children: options.map((option, index) => (_jsx("button", { id: `${id}-tab-${index}`, type: "button", role: "tab", "aria-selected": option.value === value, "aria-controls": option.panelId, tabIndex: option.value === focusValue ? 0 : -1, disabled: option.disabled, className: "lo-ui-tab", onClick: () => onValueChange(option.value), onKeyDown: (event) => {
|
|
25
27
|
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key))
|
|
26
28
|
return;
|
package/package.json
CHANGED
package/src/Tabs.tsx
CHANGED
|
@@ -39,6 +39,10 @@ export function Tabs({
|
|
|
39
39
|
)
|
|
40
40
|
? value
|
|
41
41
|
: options.find((option) => !option.disabled)?.value;
|
|
42
|
+
// Recreated arrays and labels must not override a user's manual scrolling.
|
|
43
|
+
const optionStructure = JSON.stringify(
|
|
44
|
+
options.map((option) => [option.value, Boolean(option.disabled)]),
|
|
45
|
+
);
|
|
42
46
|
useEffect(() => {
|
|
43
47
|
const selected = row.current?.querySelector<HTMLElement>(
|
|
44
48
|
'[aria-selected="true"]',
|
|
@@ -51,7 +55,7 @@ export function Tabs({
|
|
|
51
55
|
viewport.scrollLeft += bounds.left - visible.left;
|
|
52
56
|
else if (bounds.right > visible.right)
|
|
53
57
|
viewport.scrollLeft += bounds.right - visible.right;
|
|
54
|
-
}, [value,
|
|
58
|
+
}, [value, optionStructure]);
|
|
55
59
|
return (
|
|
56
60
|
<div
|
|
57
61
|
{...props}
|