@carbonid1/design-system 7.1.1 → 7.2.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/README.md
CHANGED
|
@@ -72,6 +72,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
72
72
|
| `Kbd` | Keyboard key display (`⌘K`, `⇧B`) |
|
|
73
73
|
| `ProgressRing` | Base UI-backed circular task progress indicator, including indeterminate work |
|
|
74
74
|
| `MeterRing` | Base UI-backed circular meter for bounded resource or capacity usage |
|
|
75
|
+
| `ScrollArea` | Overlay scrolling with activity-only scrollbars by default and an explicit `visibility="persistent"` escape hatch |
|
|
75
76
|
| `Slider` | Base UI-backed range slider with a convenience wrapper and compound `Root` / `Control` / `Track` / `Thumb` parts |
|
|
76
77
|
| `Switch` | Boolean setting control with a compound `Root` / `Thumb` API |
|
|
77
78
|
| `ContextMenu` | Right-click / long-press menu (compound API) |
|
|
@@ -3,7 +3,7 @@ export declare const ScrollArea: {
|
|
|
3
3
|
Root: ({ className, ...props }: ScrollAreaRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Viewport: ({ className, ...props }: ScrollAreaViewportProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
Content: ({ className, ...props }: ScrollAreaContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Scrollbar: ({ className, orientation, ...props }: ScrollAreaScrollbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Scrollbar: ({ className, orientation, visibility, ...props }: ScrollAreaScrollbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
Thumb: ({ className, ...props }: ScrollAreaThumbProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
Corner: ({ className, ...props }: ScrollAreaCornerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
};
|
|
@@ -3,11 +3,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { ScrollArea as BaseScrollArea } from '@base-ui/react/scroll-area';
|
|
4
4
|
import { cn } from '../helpers/cn/cn';
|
|
5
5
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
6
|
-
const scrollbarClasses = 'm-1 flex touch-none select-none justify-center rounded-full
|
|
6
|
+
const scrollbarClasses = 'm-1 flex touch-none select-none justify-center rounded-full transition-opacity motion-reduce:transition-none';
|
|
7
|
+
const activityScrollbarClasses = 'pointer-events-none opacity-0 delay-0 duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] data-[scrolling]:pointer-events-auto data-[scrolling]:opacity-100 data-[scrolling]:duration-0';
|
|
8
|
+
const persistentScrollbarClasses = 'pointer-events-auto opacity-100 delay-0 duration-0';
|
|
7
9
|
const Root = ({ className, ...props }) => (_jsx(BaseScrollArea.Root, { className: mergeStatefulClassName('relative overflow-hidden', className), ...props }));
|
|
8
10
|
const Viewport = ({ className, ...props }) => (_jsx(BaseScrollArea.Viewport, { className: mergeStatefulClassName('focus-visible:ring-ring/50 h-full w-full overscroll-contain rounded-[inherit] outline-hidden focus-visible:ring-2', className), ...props }));
|
|
9
11
|
const Content = ({ className, ...props }) => (_jsx(BaseScrollArea.Content, { className: mergeStatefulClassName('', className), ...props }));
|
|
10
|
-
const Scrollbar = ({ className, orientation = 'vertical', ...props }) => (_jsx(BaseScrollArea.Scrollbar, { orientation: orientation, className: mergeStatefulClassName(cn(scrollbarClasses, orientation === 'vertical' && 'w-1.5', orientation === 'horizontal' && 'h-1.5 flex-col'), className), ...props }));
|
|
12
|
+
const Scrollbar = ({ className, orientation = 'vertical', visibility = 'activity', ...props }) => (_jsx(BaseScrollArea.Scrollbar, { orientation: orientation, className: mergeStatefulClassName(cn(scrollbarClasses, visibility === 'activity' && activityScrollbarClasses, visibility === 'persistent' && persistentScrollbarClasses, orientation === 'vertical' && 'w-1.5', orientation === 'horizontal' && 'h-1.5 flex-col'), className), ...props }));
|
|
11
13
|
const Thumb = ({ className, ...props }) => (_jsx(BaseScrollArea.Thumb, { className: mergeStatefulClassName('bg-muted-foreground/30 rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full', className), ...props }));
|
|
12
14
|
const Corner = ({ className, ...props }) => (_jsx(BaseScrollArea.Corner, { className: mergeStatefulClassName('bg-transparent', className), ...props }));
|
|
13
15
|
export const ScrollArea = {
|
|
@@ -9,7 +9,10 @@ export type ScrollAreaViewportProps = BaseViewportProps & {
|
|
|
9
9
|
export type ScrollAreaContentProps = BaseContentProps & {
|
|
10
10
|
ref?: Ref<HTMLDivElement>;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type ScrollAreaScrollbarVisibility = 'activity' | 'persistent';
|
|
13
|
+
export type ScrollAreaScrollbarProps = Omit<BaseScrollbarProps, 'visibility'> & {
|
|
14
|
+
/** Controls whether the scrollbar follows scroll activity or remains visible. @default 'activity' */
|
|
15
|
+
visibility?: ScrollAreaScrollbarVisibility;
|
|
13
16
|
ref?: Ref<HTMLDivElement>;
|
|
14
17
|
};
|
|
15
18
|
export type ScrollAreaThumbProps = BaseThumbProps & {
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type { SwitchRootProps, SwitchThumbProps } from './Switch/Switch.types';
|
|
|
32
32
|
export { SegmentedControl } from './SegmentedControl/SegmentedControl';
|
|
33
33
|
export type { SegmentedControlItemProps, SegmentedControlRootProps, SegmentedControlSize, } from './SegmentedControl/SegmentedControl.types';
|
|
34
34
|
export { ScrollArea } from './ScrollArea/ScrollArea';
|
|
35
|
-
export type { ScrollAreaContentProps, ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaThumbProps, ScrollAreaViewportProps, } from './ScrollArea/ScrollArea.types';
|
|
35
|
+
export type { ScrollAreaContentProps, ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaScrollbarVisibility, ScrollAreaThumbProps, ScrollAreaViewportProps, } from './ScrollArea/ScrollArea.types';
|
|
36
36
|
export { ContextMenu } from './ContextMenu/ContextMenu';
|
|
37
37
|
export { Menu } from './Menu/Menu';
|
|
38
38
|
export { Dialog } from './Dialog/Dialog';
|