@lo-ink/ui 0.4.0 → 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.
@@ -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,+BA8EX"}
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, options]);
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/dist/styles.css CHANGED
@@ -166,7 +166,6 @@
166
166
  border-color: transparent;
167
167
  border-radius: 6px;
168
168
  background: #76768015;
169
- font-size: 14px;
170
169
  }
171
170
 
172
171
  .lo-ui-tabs {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lo-ink/ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Accessible React components for LO miniapps",
5
5
  "type": "module",
6
6
  "license": "MIT",
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, options]);
58
+ }, [value, optionStructure]);
55
59
  return (
56
60
  <div
57
61
  {...props}
package/src/styles.css CHANGED
@@ -166,7 +166,6 @@
166
166
  border-color: transparent;
167
167
  border-radius: 6px;
168
168
  background: #76768015;
169
- font-size: 14px;
170
169
  }
171
170
 
172
171
  .lo-ui-tabs {