@present-day/scroll-area 0.1.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/LICENSE +21 -0
- package/README.md +110 -0
- package/dist/base-ui.d.mts +23 -0
- package/dist/base-ui.d.ts +23 -0
- package/dist/base-ui.js +319 -0
- package/dist/base-ui.js.map +1 -0
- package/dist/base-ui.mjs +179 -0
- package/dist/base-ui.mjs.map +1 -0
- package/dist/chunk-GSHKDU53.mjs +117 -0
- package/dist/chunk-GSHKDU53.mjs.map +1 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +145 -0
- package/dist/index.mjs.map +1 -0
- package/dist/props-CCrZyXhY.d.mts +83 -0
- package/dist/props-CCrZyXhY.d.ts +83 -0
- package/dist/styles.css +157 -0
- package/dist/styles.css.map +1 -0
- package/package.json +118 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Present Day
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @present-day/scroll-area
|
|
2
|
+
|
|
3
|
+
A Radix or Base UI scroll area that shows where more content is hidden, using an edge fade or a theme-aware shadow. It supports light and dark mode, RTL, and never re-renders while scrolling.
|
|
4
|
+
|
|
5
|
+
**[▶ Try it in Storybook](https://present-day.github.io/scroll-area/)**
|
|
6
|
+
|
|
7
|
+
Install it with the primitive library you use. Both are optional peer dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @present-day/scroll-area @radix-ui/react-scroll-area
|
|
11
|
+
# or
|
|
12
|
+
bun add @present-day/scroll-area @base-ui/react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { ScrollArea } from '@present-day/scroll-area' // Radix (also '/radix')
|
|
17
|
+
import { ScrollArea } from '@present-day/scroll-area/base-ui' // Base UI
|
|
18
|
+
|
|
19
|
+
<div style={{ height: 320 }}>
|
|
20
|
+
<ScrollArea edgeEffect="shadow">{items}</ScrollArea>
|
|
21
|
+
</div>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Both adapters take the same props and produce the same DOM contract, so switching is an import change. Styles load automatically with either entry. To load them yourself instead, import `@present-day/scroll-area/styles.css`.
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| `axis` | `"vertical" \| "horizontal" \| "both"` | `"vertical"` | Which directions scroll |
|
|
31
|
+
| `edgeEffect` | `"fade" \| "shadow" \| "none"` | `"fade"` | How hidden content is signaled |
|
|
32
|
+
| `edgeSize` | `number \| string` | `24px` (token) | Depth of the edge effect; numbers are px |
|
|
33
|
+
| `scrollbars` | `"hover" \| "scroll" \| "auto" \| "always" \| "hidden"` | `"hover"` | When scrollbars show; `"hidden"` still scrolls |
|
|
34
|
+
| `dir` | `"ltr" \| "rtl"` | inherited | Reading direction |
|
|
35
|
+
| `classNames` | `{ root, viewport, scrollbar, thumb }` | | Classes for internal parts (Base UI adds `content`) |
|
|
36
|
+
| `viewportRef` | `Ref<HTMLDivElement>` | | The scrolling element (object or callback ref) |
|
|
37
|
+
| `ref` | `Ref<HTMLDivElement>` | | The root element |
|
|
38
|
+
|
|
39
|
+
Every other `Root` prop of the underlying library passes through. That includes `scrollHideDelay` and `asChild` for Radix, and `render` and `overflowEdgeThreshold` for Base UI.
|
|
40
|
+
|
|
41
|
+
### Option objects
|
|
42
|
+
|
|
43
|
+
Every union prop also has an `as const` object in SCREAMING_SNAKE_CASE, next to its PascalCase type. Either form works:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { SCROLL_AREA_EDGE_EFFECT, ScrollArea } from '@present-day/scroll-area'
|
|
47
|
+
|
|
48
|
+
<ScrollArea edgeEffect={SCROLL_AREA_EDGE_EFFECT.SHADOW} />
|
|
49
|
+
<ScrollArea edgeEffect="shadow" />
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Object | Type |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `SCROLL_AREA_AXIS` | `ScrollAreaAxis` |
|
|
55
|
+
| `SCROLL_AREA_EDGE_EFFECT` | `ScrollAreaEdgeEffect` |
|
|
56
|
+
| `SCROLL_AREA_SCROLLBARS` | `ScrollAreaScrollbars` |
|
|
57
|
+
|
|
58
|
+
`Object.values(...)` lists the allowed values.
|
|
59
|
+
|
|
60
|
+
### Adapter differences
|
|
61
|
+
|
|
62
|
+
| | Radix | Base UI |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| Composition | `asChild` | `render` |
|
|
65
|
+
| Content wrapper | hidden `display: table` div | `Content` part (`classNames.content`) |
|
|
66
|
+
| `scrollbar="hover" \| "scroll"` | handled by Radix (`scrollHideDelay`) | CSS, keyed off Base UI's `data-hovering` / `data-scrolling` |
|
|
67
|
+
| RTL | `dir` attribute | `dir` attribute plus a `DirectionProvider` when `dir` is set |
|
|
68
|
+
| Keyboard | viewport not focusable | viewport focusable while it overflows |
|
|
69
|
+
|
|
70
|
+
## Edge effects
|
|
71
|
+
|
|
72
|
+
- **fade** masks the content itself, so it blends into any background with no color setup.
|
|
73
|
+
- **shadow** draws `--scroll-area-shadow-color` over the edge. Use it when content should stay fully opaque.
|
|
74
|
+
- **none** draws nothing.
|
|
75
|
+
|
|
76
|
+
The root always carries `data-overflow-top|right|bottom|left` attributes for your own styling. It also carries `data-edge-effect`, `data-scrollbars`, and `data-primitive` (`radix` or `base-ui`).
|
|
77
|
+
|
|
78
|
+
## Theming
|
|
79
|
+
|
|
80
|
+
Colors use `light-dark()` and follow the inherited `color-scheme`. The package never sets `color-scheme` itself:
|
|
81
|
+
|
|
82
|
+
```css
|
|
83
|
+
:root { color-scheme: light dark; } /* follow the OS */
|
|
84
|
+
[data-theme="dark"] { color-scheme: dark; } /* or force a mode */
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Override these tokens on any ancestor:
|
|
88
|
+
|
|
89
|
+
| Token | Default |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `--scroll-area-edge-size` | `24px` |
|
|
92
|
+
| `--scroll-area-edge-fade-min` | `transparent` |
|
|
93
|
+
| `--scroll-area-shadow-color` | `light-dark(rgb(0 0 0 / .16), rgb(0 0 0 / .6))` |
|
|
94
|
+
| `--scroll-area-thumb-color` | `light-dark(rgb(0 0 0 / .28), rgb(255 255 255 / .28))` |
|
|
95
|
+
| `--scroll-area-thumb-color-hover` | `light-dark(rgb(0 0 0 / .45), rgb(255 255 255 / .45))` |
|
|
96
|
+
| `--scroll-area-thumb-size` | `6px` |
|
|
97
|
+
| `--scroll-area-touch-target` | `24px` |
|
|
98
|
+
| `--scroll-area-content-display` | `table` (Radix) / `block` (Base UI) |
|
|
99
|
+
|
|
100
|
+
## Building blocks
|
|
101
|
+
|
|
102
|
+
`useScrollEdges(targetRef, { horizontal, vertical })` returns a callback ref for any scrolling element and mirrors its edges as `data-overflow-*` on the target. Each entry also exports its parts (`Root`, `Viewport`, `Scrollbar`, `Thumb`, `Corner`, and `Content` for Base UI) with the `sa-` classes applied, plus `mergeRefs`, for custom layouts.
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bun run storybook # http://localhost:6006 (toolbar: Theme, Adapter)
|
|
108
|
+
bun run test
|
|
109
|
+
bun run build
|
|
110
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { S as ScrollAreaClassNames, a as ScrollAreaSharedProps } from './props-CCrZyXhY.mjs';
|
|
2
|
+
export { E as EDGE_SIDES, b as EdgeSide, c as Edges, d as SCROLL_AREA_AXIS, e as SCROLL_AREA_EDGE_EFFECT, f as SCROLL_AREA_SCROLLBARS, g as ScrollAreaAxis, h as ScrollAreaEdgeEffect, i as ScrollAreaScrollbars, j as ScrollAxes, m as measureEdges, k as mergeRefs, u as useScrollEdges } from './props-CCrZyXhY.mjs';
|
|
3
|
+
import * as _base_ui_react_scroll_area from '@base-ui/react/scroll-area';
|
|
4
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
declare const Root: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const Viewport: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const Content: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Scrollbar: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaScrollbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const Thumb: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const Corner: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaCornerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
|
|
14
|
+
type BaseUIScrollAreaClassNames = ScrollAreaClassNames & {
|
|
15
|
+
/** The Content part that wraps `children` inside the viewport. */
|
|
16
|
+
content?: string;
|
|
17
|
+
};
|
|
18
|
+
interface ScrollAreaProps extends Omit<ScrollAreaSharedProps, 'classNames'>, Omit<ScrollArea$1.Root.Props, keyof ScrollAreaSharedProps> {
|
|
19
|
+
classNames?: BaseUIScrollAreaClassNames;
|
|
20
|
+
}
|
|
21
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
|
|
23
|
+
export { type BaseUIScrollAreaClassNames, Content, Corner, Root, ScrollArea, ScrollAreaClassNames, type ScrollAreaProps, ScrollAreaSharedProps, Scrollbar, Thumb, Viewport };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { S as ScrollAreaClassNames, a as ScrollAreaSharedProps } from './props-CCrZyXhY.js';
|
|
2
|
+
export { E as EDGE_SIDES, b as EdgeSide, c as Edges, d as SCROLL_AREA_AXIS, e as SCROLL_AREA_EDGE_EFFECT, f as SCROLL_AREA_SCROLLBARS, g as ScrollAreaAxis, h as ScrollAreaEdgeEffect, i as ScrollAreaScrollbars, j as ScrollAxes, m as measureEdges, k as mergeRefs, u as useScrollEdges } from './props-CCrZyXhY.js';
|
|
3
|
+
import * as _base_ui_react_scroll_area from '@base-ui/react/scroll-area';
|
|
4
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
declare const Root: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const Viewport: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const Content: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Scrollbar: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaScrollbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const Thumb: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const Corner: React.ForwardRefExoticComponent<Omit<_base_ui_react_scroll_area.ScrollAreaCornerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
|
|
14
|
+
type BaseUIScrollAreaClassNames = ScrollAreaClassNames & {
|
|
15
|
+
/** The Content part that wraps `children` inside the viewport. */
|
|
16
|
+
content?: string;
|
|
17
|
+
};
|
|
18
|
+
interface ScrollAreaProps extends Omit<ScrollAreaSharedProps, 'classNames'>, Omit<ScrollArea$1.Root.Props, keyof ScrollAreaSharedProps> {
|
|
19
|
+
classNames?: BaseUIScrollAreaClassNames;
|
|
20
|
+
}
|
|
21
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
|
|
23
|
+
export { type BaseUIScrollAreaClassNames, Content, Corner, Root, ScrollArea, ScrollAreaClassNames, type ScrollAreaProps, ScrollAreaSharedProps, Scrollbar, Thumb, Viewport };
|
package/dist/base-ui.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("./styles.css");
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/base-ui/index.ts
|
|
33
|
+
var base_ui_exports = {};
|
|
34
|
+
__export(base_ui_exports, {
|
|
35
|
+
Content: () => Content,
|
|
36
|
+
Corner: () => Corner,
|
|
37
|
+
EDGE_SIDES: () => EDGE_SIDES,
|
|
38
|
+
Root: () => Root,
|
|
39
|
+
SCROLL_AREA_AXIS: () => SCROLL_AREA_AXIS,
|
|
40
|
+
SCROLL_AREA_EDGE_EFFECT: () => SCROLL_AREA_EDGE_EFFECT,
|
|
41
|
+
SCROLL_AREA_SCROLLBARS: () => SCROLL_AREA_SCROLLBARS,
|
|
42
|
+
ScrollArea: () => ScrollArea,
|
|
43
|
+
Scrollbar: () => Scrollbar,
|
|
44
|
+
Thumb: () => Thumb,
|
|
45
|
+
Viewport: () => Viewport,
|
|
46
|
+
measureEdges: () => measureEdges,
|
|
47
|
+
mergeRefs: () => mergeRefs,
|
|
48
|
+
useScrollEdges: () => useScrollEdges
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(base_ui_exports);
|
|
51
|
+
|
|
52
|
+
// src/core/mergeRefs.ts
|
|
53
|
+
function mergeRefs(...refs) {
|
|
54
|
+
return (node) => {
|
|
55
|
+
for (const ref of refs) {
|
|
56
|
+
if (typeof ref === "function") ref(node);
|
|
57
|
+
else if (ref) ref.current = node;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/core/props.ts
|
|
63
|
+
var SCROLL_AREA_AXIS = {
|
|
64
|
+
VERTICAL: "vertical",
|
|
65
|
+
HORIZONTAL: "horizontal",
|
|
66
|
+
BOTH: "both"
|
|
67
|
+
};
|
|
68
|
+
var SCROLL_AREA_EDGE_EFFECT = {
|
|
69
|
+
/** Fades the content itself toward the edge (color-independent). */
|
|
70
|
+
FADE: "fade",
|
|
71
|
+
/** Draws `--scroll-area-shadow-color` over the edge. */
|
|
72
|
+
SHADOW: "shadow",
|
|
73
|
+
/** Draws nothing; `data-overflow-*` attributes are still set. */
|
|
74
|
+
NONE: "none"
|
|
75
|
+
};
|
|
76
|
+
var SCROLL_AREA_SCROLLBARS = {
|
|
77
|
+
/** While scrolling or hovering the area. */
|
|
78
|
+
HOVER: "hover",
|
|
79
|
+
/** While scrolling. */
|
|
80
|
+
SCROLL: "scroll",
|
|
81
|
+
/** While the content overflows. */
|
|
82
|
+
AUTO: "auto",
|
|
83
|
+
/** Even when the content doesn't overflow. */
|
|
84
|
+
ALWAYS: "always",
|
|
85
|
+
/** Never; the area still scrolls by wheel, touch, and keyboard. */
|
|
86
|
+
HIDDEN: "hidden"
|
|
87
|
+
};
|
|
88
|
+
function axesFor(axis) {
|
|
89
|
+
return {
|
|
90
|
+
horizontal: axis !== "vertical",
|
|
91
|
+
vertical: axis !== "horizontal"
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function rootStyle(style, edgeSize) {
|
|
95
|
+
const result = { ...style };
|
|
96
|
+
if (edgeSize !== void 0) {
|
|
97
|
+
result["--scroll-area-edge-size"] = typeof edgeSize === "number" ? `${edgeSize}px` : edgeSize;
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/core/useScrollEdges.ts
|
|
103
|
+
var import_react = require("react");
|
|
104
|
+
var EDGE_SIDES = [
|
|
105
|
+
"top",
|
|
106
|
+
"right",
|
|
107
|
+
"bottom",
|
|
108
|
+
"left"
|
|
109
|
+
];
|
|
110
|
+
var TOLERANCE = 1;
|
|
111
|
+
function measureEdges(el, axes) {
|
|
112
|
+
const { scrollTop, scrollHeight, clientHeight, scrollWidth, clientWidth } = el;
|
|
113
|
+
const maxLeft = scrollWidth - clientWidth;
|
|
114
|
+
const rtl = getComputedStyle(el).direction === "rtl";
|
|
115
|
+
const fromLeft = rtl ? maxLeft + el.scrollLeft : el.scrollLeft;
|
|
116
|
+
return {
|
|
117
|
+
top: axes.vertical && scrollTop > TOLERANCE,
|
|
118
|
+
right: axes.horizontal && maxLeft - fromLeft > TOLERANCE,
|
|
119
|
+
bottom: axes.vertical && scrollHeight - clientHeight - scrollTop > TOLERANCE,
|
|
120
|
+
left: axes.horizontal && fromLeft > TOLERANCE
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function useScrollEdges(targetRef, { horizontal, vertical }) {
|
|
124
|
+
const [viewport, setViewport] = (0, import_react.useState)(null);
|
|
125
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
126
|
+
if (!viewport) return;
|
|
127
|
+
let frame = 0;
|
|
128
|
+
const apply = () => {
|
|
129
|
+
frame = 0;
|
|
130
|
+
const target = targetRef.current;
|
|
131
|
+
if (!target) return;
|
|
132
|
+
const edges = measureEdges(viewport, { horizontal, vertical });
|
|
133
|
+
for (const side of EDGE_SIDES) {
|
|
134
|
+
target.toggleAttribute(`data-overflow-${side}`, edges[side]);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const schedule = () => {
|
|
138
|
+
if (!frame) frame = requestAnimationFrame(apply);
|
|
139
|
+
};
|
|
140
|
+
apply();
|
|
141
|
+
viewport.addEventListener("scroll", schedule, { passive: true });
|
|
142
|
+
const observer = new ResizeObserver(schedule);
|
|
143
|
+
observer.observe(viewport);
|
|
144
|
+
if (viewport.firstElementChild) observer.observe(viewport.firstElementChild);
|
|
145
|
+
return () => {
|
|
146
|
+
cancelAnimationFrame(frame);
|
|
147
|
+
viewport.removeEventListener("scroll", schedule);
|
|
148
|
+
observer.disconnect();
|
|
149
|
+
};
|
|
150
|
+
}, [viewport, targetRef, horizontal, vertical]);
|
|
151
|
+
return setViewport;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/base-ui/parts.tsx
|
|
155
|
+
var import_scroll_area = require("@base-ui/react/scroll-area");
|
|
156
|
+
var import_clsx = __toESM(require("clsx"));
|
|
157
|
+
var React = __toESM(require("react"));
|
|
158
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
159
|
+
function withBase(base, className) {
|
|
160
|
+
return typeof className === "function" ? (state) => (0, import_clsx.default)(base, className(state)) : (0, import_clsx.default)(base, className);
|
|
161
|
+
}
|
|
162
|
+
var Root = React.forwardRef(function Root2({ className, ...props }, ref) {
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_scroll_area.ScrollArea.Root,
|
|
165
|
+
{
|
|
166
|
+
ref,
|
|
167
|
+
"data-primitive": "base-ui",
|
|
168
|
+
className: withBase("sa-root", className),
|
|
169
|
+
...props
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
var Viewport = React.forwardRef(function Viewport2({ className, ...props }, ref) {
|
|
174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
175
|
+
import_scroll_area.ScrollArea.Viewport,
|
|
176
|
+
{
|
|
177
|
+
ref,
|
|
178
|
+
className: withBase("sa-viewport", className),
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
var Content = React.forwardRef(function Content2({ className, ...props }, ref) {
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
185
|
+
import_scroll_area.ScrollArea.Content,
|
|
186
|
+
{
|
|
187
|
+
ref,
|
|
188
|
+
className: withBase("sa-content", className),
|
|
189
|
+
...props
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
var Scrollbar = React.forwardRef(function Scrollbar2({ className, ...props }, ref) {
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
import_scroll_area.ScrollArea.Scrollbar,
|
|
196
|
+
{
|
|
197
|
+
ref,
|
|
198
|
+
className: withBase("sa-scrollbar", className),
|
|
199
|
+
...props
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
var Thumb = React.forwardRef(function Thumb2({ className, ...props }, ref) {
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
+
import_scroll_area.ScrollArea.Thumb,
|
|
206
|
+
{
|
|
207
|
+
ref,
|
|
208
|
+
className: withBase("sa-thumb", className),
|
|
209
|
+
...props
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
var Corner = React.forwardRef(function Corner2({ className, ...props }, ref) {
|
|
214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
|
+
import_scroll_area.ScrollArea.Corner,
|
|
216
|
+
{
|
|
217
|
+
ref,
|
|
218
|
+
className: withBase("sa-corner", className),
|
|
219
|
+
...props
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// src/base-ui/ScrollArea.tsx
|
|
225
|
+
var import_direction_provider = require("@base-ui/react/direction-provider");
|
|
226
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
227
|
+
var React2 = __toESM(require("react"));
|
|
228
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
229
|
+
var ScrollArea = React2.forwardRef(
|
|
230
|
+
function ScrollArea2({
|
|
231
|
+
children,
|
|
232
|
+
axis = "vertical",
|
|
233
|
+
edgeEffect = "fade",
|
|
234
|
+
edgeSize,
|
|
235
|
+
scrollbars = "hover",
|
|
236
|
+
dir,
|
|
237
|
+
classNames = {},
|
|
238
|
+
className,
|
|
239
|
+
style,
|
|
240
|
+
viewportRef,
|
|
241
|
+
onScroll,
|
|
242
|
+
...rootProps
|
|
243
|
+
}, ref) {
|
|
244
|
+
const rootRef = React2.useRef(null);
|
|
245
|
+
const { horizontal, vertical } = axesFor(axis);
|
|
246
|
+
const edgesRef = useScrollEdges(rootRef, {
|
|
247
|
+
horizontal,
|
|
248
|
+
vertical
|
|
249
|
+
});
|
|
250
|
+
const mergedRootRef = React2.useMemo(() => mergeRefs(ref, rootRef), [ref]);
|
|
251
|
+
const mergedViewportRef = React2.useMemo(
|
|
252
|
+
() => mergeRefs(viewportRef, edgesRef),
|
|
253
|
+
[viewportRef, edgesRef]
|
|
254
|
+
);
|
|
255
|
+
const keepMounted = scrollbars === "always";
|
|
256
|
+
const area = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
257
|
+
Root,
|
|
258
|
+
{
|
|
259
|
+
...rootProps,
|
|
260
|
+
ref: mergedRootRef,
|
|
261
|
+
dir,
|
|
262
|
+
"data-edge-effect": edgeEffect,
|
|
263
|
+
"data-scrollbars": scrollbars,
|
|
264
|
+
className: (0, import_clsx2.default)(className, classNames.root),
|
|
265
|
+
style: rootStyle(style, edgeSize),
|
|
266
|
+
children: [
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
268
|
+
Viewport,
|
|
269
|
+
{
|
|
270
|
+
ref: mergedViewportRef,
|
|
271
|
+
className: classNames.viewport,
|
|
272
|
+
onScroll,
|
|
273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, { className: classNames.content, children })
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
edgeEffect === "shadow" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "sa-edge-shadow", "aria-hidden": "true" }) : null,
|
|
277
|
+
vertical ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
278
|
+
Scrollbar,
|
|
279
|
+
{
|
|
280
|
+
orientation: "vertical",
|
|
281
|
+
keepMounted,
|
|
282
|
+
className: classNames.scrollbar,
|
|
283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Thumb, { className: classNames.thumb })
|
|
284
|
+
}
|
|
285
|
+
) : null,
|
|
286
|
+
horizontal ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
287
|
+
Scrollbar,
|
|
288
|
+
{
|
|
289
|
+
orientation: "horizontal",
|
|
290
|
+
keepMounted,
|
|
291
|
+
className: classNames.scrollbar,
|
|
292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Thumb, { className: classNames.thumb })
|
|
293
|
+
}
|
|
294
|
+
) : null,
|
|
295
|
+
vertical && horizontal ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Corner, {}) : null
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
return dir ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_direction_provider.DirectionProvider, { direction: dir, children: area }) : area;
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
303
|
+
0 && (module.exports = {
|
|
304
|
+
Content,
|
|
305
|
+
Corner,
|
|
306
|
+
EDGE_SIDES,
|
|
307
|
+
Root,
|
|
308
|
+
SCROLL_AREA_AXIS,
|
|
309
|
+
SCROLL_AREA_EDGE_EFFECT,
|
|
310
|
+
SCROLL_AREA_SCROLLBARS,
|
|
311
|
+
ScrollArea,
|
|
312
|
+
Scrollbar,
|
|
313
|
+
Thumb,
|
|
314
|
+
Viewport,
|
|
315
|
+
measureEdges,
|
|
316
|
+
mergeRefs,
|
|
317
|
+
useScrollEdges
|
|
318
|
+
});
|
|
319
|
+
//# sourceMappingURL=base-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base-ui/index.ts","../src/core/mergeRefs.ts","../src/core/props.ts","../src/core/useScrollEdges.ts","../src/base-ui/parts.tsx","../src/base-ui/ScrollArea.tsx"],"sourcesContent":["export * from '../core'\nexport { Content, Corner, Root, Scrollbar, Thumb, Viewport } from './parts'\nexport {\n type BaseUIScrollAreaClassNames,\n ScrollArea,\n type ScrollAreaProps,\n} from './ScrollArea'\n","import type { Ref, RefCallback } from 'react'\n\n/** Combines several refs into one callback ref. */\nexport function mergeRefs<T>(\n ...refs: Array<Ref<T> | undefined>\n): RefCallback<T> {\n return (node) => {\n for (const ref of refs) {\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: T | null }).current = node\n }\n }\n}\n","import type { CSSProperties, ReactNode, Ref, UIEventHandler } from 'react'\n\nimport type { ScrollAxes } from './useScrollEdges'\n\n/*\n * Each option set is an `as const` object in SCREAMING_SNAKE_CASE plus a\n * PascalCase union type derived from it, so `axis={SCROLL_AREA_AXIS.BOTH}` and\n * `axis=\"both\"` are equivalent.\n */\n\n/** Which directions scroll. */\nexport const SCROLL_AREA_AXIS = {\n VERTICAL: 'vertical',\n HORIZONTAL: 'horizontal',\n BOTH: 'both',\n} as const\nexport type ScrollAreaAxis =\n (typeof SCROLL_AREA_AXIS)[keyof typeof SCROLL_AREA_AXIS]\n\n/** How edges with more content beyond them are signaled. */\nexport const SCROLL_AREA_EDGE_EFFECT = {\n /** Fades the content itself toward the edge (color-independent). */\n FADE: 'fade',\n /** Draws `--scroll-area-shadow-color` over the edge. */\n SHADOW: 'shadow',\n /** Draws nothing; `data-overflow-*` attributes are still set. */\n NONE: 'none',\n} as const\nexport type ScrollAreaEdgeEffect =\n (typeof SCROLL_AREA_EDGE_EFFECT)[keyof typeof SCROLL_AREA_EDGE_EFFECT]\n\n/** When scrollbars are visible. */\nexport const SCROLL_AREA_SCROLLBARS = {\n /** While scrolling or hovering the area. */\n HOVER: 'hover',\n /** While scrolling. */\n SCROLL: 'scroll',\n /** While the content overflows. */\n AUTO: 'auto',\n /** Even when the content doesn't overflow. */\n ALWAYS: 'always',\n /** Never; the area still scrolls by wheel, touch, and keyboard. */\n HIDDEN: 'hidden',\n} as const\nexport type ScrollAreaScrollbars =\n (typeof SCROLL_AREA_SCROLLBARS)[keyof typeof SCROLL_AREA_SCROLLBARS]\n\nexport type ScrollAreaClassNames = {\n root?: string\n viewport?: string\n scrollbar?: string\n thumb?: string\n}\n\n/** Props every adapter's `ScrollArea` accepts, with the same meaning. */\nexport interface ScrollAreaSharedProps {\n children?: ReactNode\n /** Which directions scroll. Defaults to `\"vertical\"`. */\n axis?: ScrollAreaAxis\n /** How edges with more content beyond them are signaled. Defaults to `\"fade\"`. */\n edgeEffect?: ScrollAreaEdgeEffect\n /** Depth of the edge effect: a number of pixels or any CSS length. */\n edgeSize?: number | string\n /** When scrollbars are visible. Defaults to `\"hover\"`. */\n scrollbars?: ScrollAreaScrollbars\n /** Reading direction; flips horizontal scrolling and the scrollbar side. */\n dir?: 'ltr' | 'rtl'\n className?: string\n style?: CSSProperties\n /** Classes for the internal parts. */\n classNames?: ScrollAreaClassNames\n /** Ref to the scrolling viewport element. */\n viewportRef?: Ref<HTMLDivElement>\n onScroll?: UIEventHandler<HTMLDivElement>\n}\n\ntype StyleWithVars = CSSProperties & Record<`--${string}`, string>\n\nexport function axesFor(axis: ScrollAreaAxis): ScrollAxes {\n return {\n horizontal: axis !== 'vertical',\n vertical: axis !== 'horizontal',\n }\n}\n\n/** The root's inline style, with `edgeSize` applied as the size token. */\nexport function rootStyle(\n style: CSSProperties | undefined,\n edgeSize: number | string | undefined,\n): StyleWithVars {\n const result: StyleWithVars = { ...style }\n if (edgeSize !== undefined) {\n result['--scroll-area-edge-size'] =\n typeof edgeSize === 'number' ? `${edgeSize}px` : edgeSize\n }\n return result\n}\n","import { type RefObject, useLayoutEffect, useState } from 'react'\n\nexport type ScrollAxes = { horizontal: boolean; vertical: boolean }\nexport type EdgeSide = 'top' | 'right' | 'bottom' | 'left'\nexport type Edges = Record<EdgeSide, boolean>\n\nexport const EDGE_SIDES: readonly EdgeSide[] = [\n 'top',\n 'right',\n 'bottom',\n 'left',\n]\n\n/** Absorbs fractional scroll positions from zoom and high-DPI displays. */\nconst TOLERANCE = 1\n\n/** Which physical edges of `el` have more content beyond them. */\nexport function measureEdges(el: HTMLElement, axes: ScrollAxes): Edges {\n const { scrollTop, scrollHeight, clientHeight, scrollWidth, clientWidth } = el\n const maxLeft = scrollWidth - clientWidth\n // In RTL, scrollLeft is 0 at the right edge and goes negative toward the left.\n const rtl = getComputedStyle(el).direction === 'rtl'\n const fromLeft = rtl ? maxLeft + el.scrollLeft : el.scrollLeft\n\n return {\n top: axes.vertical && scrollTop > TOLERANCE,\n right: axes.horizontal && maxLeft - fromLeft > TOLERANCE,\n bottom:\n axes.vertical && scrollHeight - clientHeight - scrollTop > TOLERANCE,\n left: axes.horizontal && fromLeft > TOLERANCE,\n }\n}\n\n/**\n * Tracks which edges of a scrolling element have hidden content and mirrors\n * them as `data-overflow-{side}` attributes on `targetRef`. Writes go straight\n * to the DOM, so scrolling never re-renders React.\n *\n * Returns a callback ref for the scrolling element.\n */\nexport function useScrollEdges<T extends HTMLElement = HTMLDivElement>(\n targetRef: RefObject<HTMLElement | null>,\n { horizontal, vertical }: ScrollAxes,\n): (node: T | null) => void {\n const [viewport, setViewport] = useState<T | null>(null)\n\n useLayoutEffect(() => {\n if (!viewport) return\n\n let frame = 0\n const apply = () => {\n frame = 0\n const target = targetRef.current\n if (!target) return\n const edges = measureEdges(viewport, { horizontal, vertical })\n for (const side of EDGE_SIDES) {\n target.toggleAttribute(`data-overflow-${side}`, edges[side])\n }\n }\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(apply)\n }\n\n apply()\n viewport.addEventListener('scroll', schedule, { passive: true })\n const observer = new ResizeObserver(schedule)\n observer.observe(viewport)\n if (viewport.firstElementChild) observer.observe(viewport.firstElementChild)\n\n return () => {\n cancelAnimationFrame(frame)\n viewport.removeEventListener('scroll', schedule)\n observer.disconnect()\n }\n }, [viewport, targetRef, horizontal, vertical])\n\n return setViewport\n}\n","import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area'\nimport clsx from 'clsx'\nimport * as React from 'react'\n\ntype ClassName<State> =\n | string\n | ((state: State) => string | undefined)\n | undefined\n\n/** Prepends a base class, preserving Base UI's state-callback form. */\nfunction withBase<State>(base: string, className: ClassName<State>) {\n return typeof className === 'function'\n ? (state: State) => clsx(base, className(state))\n : clsx(base, className)\n}\n\nexport const Root = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Root.Props\n>(function Root({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n data-primitive=\"base-ui\"\n className={withBase('sa-root', className)}\n {...props}\n />\n )\n})\n\nexport const Viewport = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Viewport.Props\n>(function Viewport({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Viewport\n ref={ref}\n className={withBase('sa-viewport', className)}\n {...props}\n />\n )\n})\n\nexport const Content = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Content.Props\n>(function Content({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Content\n ref={ref}\n className={withBase('sa-content', className)}\n {...props}\n />\n )\n})\n\nexport const Scrollbar = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Scrollbar.Props\n>(function Scrollbar({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n className={withBase('sa-scrollbar', className)}\n {...props}\n />\n )\n})\n\nexport const Thumb = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Thumb.Props\n>(function Thumb({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Thumb\n ref={ref}\n className={withBase('sa-thumb', className)}\n {...props}\n />\n )\n})\n\nexport const Corner = React.forwardRef<\n HTMLDivElement,\n ScrollAreaPrimitive.Corner.Props\n>(function Corner({ className, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Corner\n ref={ref}\n className={withBase('sa-corner', className)}\n {...props}\n />\n )\n})\n","import { DirectionProvider } from '@base-ui/react/direction-provider'\nimport type { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area'\nimport clsx from 'clsx'\nimport * as React from 'react'\n\nimport { mergeRefs } from '../core/mergeRefs'\nimport {\n axesFor,\n rootStyle,\n type ScrollAreaClassNames,\n type ScrollAreaSharedProps,\n} from '../core/props'\nimport { useScrollEdges } from '../core/useScrollEdges'\nimport { Content, Corner, Root, Scrollbar, Thumb, Viewport } from './parts'\n\nexport type BaseUIScrollAreaClassNames = ScrollAreaClassNames & {\n /** The Content part that wraps `children` inside the viewport. */\n content?: string\n}\n\nexport interface ScrollAreaProps\n extends Omit<ScrollAreaSharedProps, 'classNames'>,\n Omit<ScrollAreaPrimitive.Root.Props, keyof ScrollAreaSharedProps> {\n classNames?: BaseUIScrollAreaClassNames\n}\n\nexport const ScrollArea = React.forwardRef<HTMLDivElement, ScrollAreaProps>(\n function ScrollArea(\n {\n children,\n axis = 'vertical',\n edgeEffect = 'fade',\n edgeSize,\n scrollbars = 'hover',\n dir,\n classNames = {},\n className,\n style,\n viewportRef,\n onScroll,\n ...rootProps\n },\n ref,\n ) {\n const rootRef = React.useRef<HTMLDivElement>(null)\n const { horizontal, vertical } = axesFor(axis)\n // Base UI sets its own logical `data-overflow-x-start` etc. The shared hook\n // adds the physical `data-overflow-*` attributes the stylesheet keys off.\n const edgesRef = useScrollEdges<HTMLDivElement>(rootRef, {\n horizontal,\n vertical,\n })\n // Memoized so React doesn't detach and reattach the refs on every render.\n const mergedRootRef = React.useMemo(() => mergeRefs(ref, rootRef), [ref])\n const mergedViewportRef = React.useMemo(\n () => mergeRefs(viewportRef, edgesRef),\n [viewportRef, edgesRef],\n )\n\n // Base UI mounts scrollbars only while content overflows (\"auto\"), and\n // exposes hover/scroll state that the stylesheet uses for the other modes.\n const keepMounted = scrollbars === 'always'\n\n const area = (\n <Root\n {...rootProps}\n ref={mergedRootRef}\n dir={dir}\n data-edge-effect={edgeEffect}\n data-scrollbars={scrollbars}\n className={clsx(className, classNames.root)}\n style={rootStyle(style, edgeSize)}\n >\n <Viewport\n ref={mergedViewportRef}\n className={classNames.viewport}\n onScroll={onScroll}\n >\n <Content className={classNames.content}>{children}</Content>\n </Viewport>\n {edgeEffect === 'shadow' ? (\n <div className=\"sa-edge-shadow\" aria-hidden=\"true\" />\n ) : null}\n {vertical ? (\n <Scrollbar\n orientation=\"vertical\"\n keepMounted={keepMounted}\n className={classNames.scrollbar}\n >\n <Thumb className={classNames.thumb} />\n </Scrollbar>\n ) : null}\n {horizontal ? (\n <Scrollbar\n orientation=\"horizontal\"\n keepMounted={keepMounted}\n className={classNames.scrollbar}\n >\n <Thumb className={classNames.thumb} />\n </Scrollbar>\n ) : null}\n {vertical && horizontal ? <Corner /> : null}\n </Root>\n )\n\n // Base UI reads direction from context, not the `dir` attribute. Only\n // provide it when set, so an app-level DirectionProvider still applies.\n return dir ? (\n <DirectionProvider direction={dir}>{area}</DirectionProvider>\n ) : (\n area\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,SAAS,aACX,MACa;AAChB,SAAO,CAAC,SAAS;AACf,eAAW,OAAO,MAAM;AACtB,UAAI,OAAO,QAAQ,WAAY,KAAI,IAAI;AAAA,eAC9B,IAAK,CAAC,IAA8B,UAAU;AAAA,IACzD;AAAA,EACF;AACF;;;ACDO,IAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,MAAM;AACR;AAKO,IAAM,0BAA0B;AAAA;AAAA,EAErC,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,MAAM;AACR;AAKO,IAAM,yBAAyB;AAAA;AAAA,EAEpC,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,QAAQ;AACV;AAmCO,SAAS,QAAQ,MAAkC;AACxD,SAAO;AAAA,IACL,YAAY,SAAS;AAAA,IACrB,UAAU,SAAS;AAAA,EACrB;AACF;AAGO,SAAS,UACd,OACA,UACe;AACf,QAAM,SAAwB,EAAE,GAAG,MAAM;AACzC,MAAI,aAAa,QAAW;AAC1B,WAAO,yBAAyB,IAC9B,OAAO,aAAa,WAAW,GAAG,QAAQ,OAAO;AAAA,EACrD;AACA,SAAO;AACT;;;AChG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BAAiB;AAAA,QACjB,eAAW,aAAAC,SAAK,WAAW,WAAW,IAAI;AAAA,QAC1C,OAAO,UAAU,OAAO,QAAQ;AAAA,QAEhC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL,WAAW,WAAW;AAAA,cACtB;AAAA,cAEA,uDAAC,WAAQ,WAAW,WAAW,SAAU,UAAS;AAAA;AAAA,UACpD;AAAA,UACC,eAAe,WACd,6CAAC,SAAI,WAAU,kBAAiB,eAAY,QAAO,IACjD;AAAA,UACH,WACC;AAAA,YAAC;AAAA;AAAA,cACC,aAAY;AAAA,cACZ;AAAA,cACA,WAAW,WAAW;AAAA,cAEtB,uDAAC,SAAM,WAAW,WAAW,OAAO;AAAA;AAAA,UACtC,IACE;AAAA,UACH,aACC;AAAA,YAAC;AAAA;AAAA,cACC,aAAY;AAAA,cACZ;AAAA,cACA,WAAW,WAAW;AAAA,cAEtB,uDAAC,SAAM,WAAW,WAAW,OAAO;AAAA;AAAA,UACtC,IACE;AAAA,UACH,YAAY,aAAa,6CAAC,UAAO,IAAK;AAAA;AAAA;AAAA,IACzC;AAKF,WAAO,MACL,6CAAC,+CAAkB,WAAW,KAAM,gBAAK,IAEzC;AAAA,EAEJ;AACF;","names":["clsx","Root","ScrollAreaPrimitive","Viewport","Content","Scrollbar","Thumb","Corner","import_clsx","React","import_jsx_runtime","ScrollArea","clsx"]}
|