| 503 | otherProps.onAction || ctx?.onAction ? chain(otherProps.onAction, ctx?.onAction) : undefined; |
| 504 | |
| 505 | let scroll = (dir: 1 | -1) => { |
| 506 | let el = scrollRef.current; |
| 507 | if (!el) { |
| 508 | return; |
| 509 | } |
| 510 | |
| 511 | // RTL flips the scroll direction convention; flip the sign to match. |
| 512 | let sign = direction === 'rtl' ? -1 : 1; |
| 513 | el.scrollTo({ |
| 514 | left: Math.max( |
| 515 | 0, |
| 516 | Math.min( |
| 517 | el.scrollWidth - el.clientWidth, |
| 518 | el.scrollLeft + sign * dir * (el.clientWidth - 64 * 2) |
| 519 | ) |
| 520 | ), |
| 521 | behavior: 'smooth' |
| 522 | }); |
| 523 | }; |
| 524 | |
| 525 | return ( |
| 526 | <TagGroup |