| 497 | let scrollRef = useRef<HTMLDivElement>(null); |
| 498 | let {direction} = useLocale(); |
| 499 | let scroll = (dir: 1 | -1) => { |
| 500 | let el = scrollRef.current; |
| 501 | if (!el) { |
| 502 | return; |
| 503 | } |
| 504 | |
| 505 | // RTL flips the scroll direction convention; flip the sign to match. |
| 506 | let sign = direction === 'rtl' ? -1 : 1; |
| 507 | el.scrollTo({ |
| 508 | left: Math.max( |
| 509 | 0, |
| 510 | Math.min( |
| 511 | el.scrollWidth - el.clientWidth, |
| 512 | el.scrollLeft + sign * dir * (el.clientWidth - 64 * 2) |
| 513 | ) |
| 514 | ), |
| 515 | behavior: 'smooth' |
| 516 | }); |
| 517 | }; |
| 518 | |
| 519 | return ( |
| 520 | <TagGroup |