@telia/teddy 0.0.70 → 0.0.71

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.
@@ -4,9 +4,13 @@ import { ButtonProps } from './scroll-area-button';
4
4
 
5
5
  export declare const ScrollArea: import('react').ForwardRefExoticComponent<Omit<import('@radix-ui/react-scroll-area').ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
6
6
  variant?: ("button" | "scrollbar") | undefined;
7
+ scrollBehavior?: "auto" | "smooth" | undefined;
7
8
  } & import('react').RefAttributes<HTMLDivElement>> & {
8
9
  Item: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
9
10
  asChild?: boolean | undefined;
11
+ isSelected?: boolean | undefined;
12
+ scrollBehavior?: "auto" | "smooth" | undefined;
13
+ scrollBehaviorOnMount?: "auto" | "smooth" | undefined;
10
14
  } & import('react').RefAttributes<HTMLDivElement>>;
11
15
  Button: import('react').ForwardRefExoticComponent<Omit<Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
12
16
  display?: import('../../utils/generate-styling').DisplayChildren | undefined;
@@ -91,10 +91,13 @@ const Button = React.forwardRef(
91
91
  const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
92
92
  const scrollDirection = direction === "up" || direction === "left" ? -1 : 1;
93
93
  const scrollAxis = direction === "up" || direction === "down" ? "top" : "left";
94
- const scrollAmount = ((direction === "up" || direction === "down" ? scroll == null ? void 0 : scroll.height : scroll == null ? void 0 : scroll.width) || 0) * 0.7;
94
+ const buttonSize = direction === "up" || direction === "down" ? e.currentTarget.offsetHeight : e.currentTarget.offsetWidth;
95
+ const scrollAmount = ((direction === "up" || direction === "down" ? scroll == null ? void 0 : scroll.height : scroll == null ? void 0 : scroll.width) || 0) - buttonSize * 2;
96
+ const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
97
+ const scrollBehavior = hasReducedMotion ? "auto" : (context == null ? void 0 : context.scrollBehavior) ?? "smooth";
95
98
  (_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
96
99
  [scrollAxis]: scrollAmount * scrollDirection,
97
- behavior: "smooth"
100
+ behavior: scrollBehavior
98
101
  });
99
102
  }),
100
103
  ref: forwardRef,
@@ -112,40 +115,56 @@ const Button = React.forwardRef(
112
115
  components_button_button.Button.displayName = "Button";
113
116
  const rootClassName = "teddy-scroll-area";
114
117
  const RootContext = React.createContext(void 0);
118
+ function isScrollable(element) {
119
+ if (!element)
120
+ return null;
121
+ const buffer = 1;
122
+ const scrollLeft = element.scrollLeft;
123
+ const scrollWidth = element.scrollWidth;
124
+ const offsetWidth = element.offsetWidth;
125
+ const maxScrollLeft = scrollWidth - offsetWidth;
126
+ const isRtl = getComputedStyle(element).direction === "rtl";
127
+ let left;
128
+ let right;
129
+ if (isRtl) {
130
+ const normalizedScrollLeft = Math.abs(scrollLeft);
131
+ left = normalizedScrollLeft < maxScrollLeft - buffer;
132
+ right = normalizedScrollLeft > buffer;
133
+ } else {
134
+ left = scrollLeft > buffer;
135
+ right = scrollLeft < maxScrollLeft - buffer;
136
+ }
137
+ const scrollTop = element.scrollTop;
138
+ const maxScrollTop = element.scrollHeight - element.offsetHeight;
139
+ const top = scrollTop > buffer;
140
+ const bottom = scrollTop < maxScrollTop - buffer;
141
+ return {
142
+ left,
143
+ right,
144
+ top,
145
+ bottom
146
+ };
147
+ }
115
148
  const Root = React.forwardRef(
116
- ({ className, variant, children, ...props }, forwardRef) => {
149
+ ({ className, variant, scrollBehavior = "smooth", children, ...props }, forwardRef) => {
117
150
  const [scrollRef, setScrollRef] = React.useState(null);
118
151
  const [hasScroll, setHasScroll] = React.useState(null);
119
- const initialHasScrollLeft = scrollRef ? scrollRef.scrollLeft > 0 : null;
120
- const initialHasScrollRight = scrollRef ? scrollRef.scrollLeft < scrollRef.scrollWidth - scrollRef.clientWidth : null;
121
- const initialHasScrollTop = scrollRef ? scrollRef.scrollTop > 0 : null;
122
- const initialHasScrollBottom = scrollRef ? scrollRef.scrollTop < scrollRef.scrollHeight - scrollRef.clientHeight : null;
123
- const hasScrollLeft = hasScroll ? hasScroll.left : initialHasScrollLeft;
124
- const hasScrollRight = hasScroll ? hasScroll.right : initialHasScrollRight;
125
- const hasScrollTop = hasScroll ? hasScroll.top : initialHasScrollTop;
126
- const hasScrollBottom = hasScroll ? hasScroll.bottom : initialHasScrollBottom;
152
+ const initialScrollable = isScrollable(scrollRef);
153
+ const hasScrollLeft = hasScroll ? hasScroll.left : initialScrollable == null ? void 0 : initialScrollable.left;
154
+ const hasScrollRight = hasScroll ? hasScroll.right : initialScrollable == null ? void 0 : initialScrollable.right;
155
+ const hasScrollTop = hasScroll ? hasScroll.top : initialScrollable == null ? void 0 : initialScrollable.top;
156
+ const hasScrollBottom = hasScroll ? hasScroll.bottom : initialScrollable == null ? void 0 : initialScrollable.bottom;
127
157
  const hasScrollHorizontal = hasScrollLeft || hasScrollRight;
128
158
  const hasScrollVertical = hasScrollTop || hasScrollBottom;
129
- const classes = clsx([styles[`${rootClassName}`]], className);
130
159
  function handleScroll(e) {
131
160
  const target = e.currentTarget;
132
- const { scrollLeft, scrollWidth, clientWidth, scrollTop, scrollHeight, clientHeight } = target;
133
- const buffer = 1;
134
- const hasScrollLeft2 = scrollLeft > 0;
135
- const hasScrollRight2 = scrollLeft < scrollWidth - clientWidth - buffer;
136
- const hasScrollTop2 = scrollTop > 0;
137
- const hasScrollBottom2 = scrollTop < scrollHeight - clientHeight - buffer;
138
- setHasScroll({
139
- left: hasScrollLeft2,
140
- right: hasScrollRight2,
141
- top: hasScrollTop2,
142
- bottom: hasScrollBottom2
143
- });
161
+ setHasScroll(isScrollable(target));
144
162
  }
163
+ const classes = clsx([styles[`${rootClassName}`]], className);
145
164
  return /* @__PURE__ */ jsxRuntime.jsx(
146
165
  RootContext.Provider,
147
166
  {
148
- value: { scrollRef, variant, hasScrollTop, hasScrollBottom, hasScrollLeft, hasScrollRight },
167
+ value: { scrollRef, variant, hasScrollTop, hasScrollBottom, hasScrollLeft, hasScrollRight, scrollBehavior },
149
168
  children: /* @__PURE__ */ jsxRuntime.jsxs(ScrollAreaPrimitive__namespace.Root, { ...props, ref: forwardRef, className: classes, children: [
150
169
  /* @__PURE__ */ jsxRuntime.jsx(
151
170
  ScrollAreaPrimitive__namespace.Viewport,
@@ -72,10 +72,13 @@ const Button = React__default.forwardRef(
72
72
  const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
73
73
  const scrollDirection = direction === "up" || direction === "left" ? -1 : 1;
74
74
  const scrollAxis = direction === "up" || direction === "down" ? "top" : "left";
75
- const scrollAmount = ((direction === "up" || direction === "down" ? scroll == null ? void 0 : scroll.height : scroll == null ? void 0 : scroll.width) || 0) * 0.7;
75
+ const buttonSize = direction === "up" || direction === "down" ? e.currentTarget.offsetHeight : e.currentTarget.offsetWidth;
76
+ const scrollAmount = ((direction === "up" || direction === "down" ? scroll == null ? void 0 : scroll.height : scroll == null ? void 0 : scroll.width) || 0) - buttonSize * 2;
77
+ const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
78
+ const scrollBehavior = hasReducedMotion ? "auto" : (context == null ? void 0 : context.scrollBehavior) ?? "smooth";
76
79
  (_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
77
80
  [scrollAxis]: scrollAmount * scrollDirection,
78
- behavior: "smooth"
81
+ behavior: scrollBehavior
79
82
  });
80
83
  }),
81
84
  ref: forwardRef,
@@ -93,40 +96,56 @@ const Button = React__default.forwardRef(
93
96
  Button$1.displayName = "Button";
94
97
  const rootClassName = "teddy-scroll-area";
95
98
  const RootContext = React__default.createContext(void 0);
99
+ function isScrollable(element) {
100
+ if (!element)
101
+ return null;
102
+ const buffer = 1;
103
+ const scrollLeft = element.scrollLeft;
104
+ const scrollWidth = element.scrollWidth;
105
+ const offsetWidth = element.offsetWidth;
106
+ const maxScrollLeft = scrollWidth - offsetWidth;
107
+ const isRtl = getComputedStyle(element).direction === "rtl";
108
+ let left;
109
+ let right;
110
+ if (isRtl) {
111
+ const normalizedScrollLeft = Math.abs(scrollLeft);
112
+ left = normalizedScrollLeft < maxScrollLeft - buffer;
113
+ right = normalizedScrollLeft > buffer;
114
+ } else {
115
+ left = scrollLeft > buffer;
116
+ right = scrollLeft < maxScrollLeft - buffer;
117
+ }
118
+ const scrollTop = element.scrollTop;
119
+ const maxScrollTop = element.scrollHeight - element.offsetHeight;
120
+ const top = scrollTop > buffer;
121
+ const bottom = scrollTop < maxScrollTop - buffer;
122
+ return {
123
+ left,
124
+ right,
125
+ top,
126
+ bottom
127
+ };
128
+ }
96
129
  const Root = React__default.forwardRef(
97
- ({ className, variant, children, ...props }, forwardRef) => {
130
+ ({ className, variant, scrollBehavior = "smooth", children, ...props }, forwardRef) => {
98
131
  const [scrollRef, setScrollRef] = React__default.useState(null);
99
132
  const [hasScroll, setHasScroll] = React__default.useState(null);
100
- const initialHasScrollLeft = scrollRef ? scrollRef.scrollLeft > 0 : null;
101
- const initialHasScrollRight = scrollRef ? scrollRef.scrollLeft < scrollRef.scrollWidth - scrollRef.clientWidth : null;
102
- const initialHasScrollTop = scrollRef ? scrollRef.scrollTop > 0 : null;
103
- const initialHasScrollBottom = scrollRef ? scrollRef.scrollTop < scrollRef.scrollHeight - scrollRef.clientHeight : null;
104
- const hasScrollLeft = hasScroll ? hasScroll.left : initialHasScrollLeft;
105
- const hasScrollRight = hasScroll ? hasScroll.right : initialHasScrollRight;
106
- const hasScrollTop = hasScroll ? hasScroll.top : initialHasScrollTop;
107
- const hasScrollBottom = hasScroll ? hasScroll.bottom : initialHasScrollBottom;
133
+ const initialScrollable = isScrollable(scrollRef);
134
+ const hasScrollLeft = hasScroll ? hasScroll.left : initialScrollable == null ? void 0 : initialScrollable.left;
135
+ const hasScrollRight = hasScroll ? hasScroll.right : initialScrollable == null ? void 0 : initialScrollable.right;
136
+ const hasScrollTop = hasScroll ? hasScroll.top : initialScrollable == null ? void 0 : initialScrollable.top;
137
+ const hasScrollBottom = hasScroll ? hasScroll.bottom : initialScrollable == null ? void 0 : initialScrollable.bottom;
108
138
  const hasScrollHorizontal = hasScrollLeft || hasScrollRight;
109
139
  const hasScrollVertical = hasScrollTop || hasScrollBottom;
110
- const classes = clsx([styles[`${rootClassName}`]], className);
111
140
  function handleScroll(e) {
112
141
  const target = e.currentTarget;
113
- const { scrollLeft, scrollWidth, clientWidth, scrollTop, scrollHeight, clientHeight } = target;
114
- const buffer = 1;
115
- const hasScrollLeft2 = scrollLeft > 0;
116
- const hasScrollRight2 = scrollLeft < scrollWidth - clientWidth - buffer;
117
- const hasScrollTop2 = scrollTop > 0;
118
- const hasScrollBottom2 = scrollTop < scrollHeight - clientHeight - buffer;
119
- setHasScroll({
120
- left: hasScrollLeft2,
121
- right: hasScrollRight2,
122
- top: hasScrollTop2,
123
- bottom: hasScrollBottom2
124
- });
142
+ setHasScroll(isScrollable(target));
125
143
  }
144
+ const classes = clsx([styles[`${rootClassName}`]], className);
126
145
  return /* @__PURE__ */ jsx(
127
146
  RootContext.Provider,
128
147
  {
129
- value: { scrollRef, variant, hasScrollTop, hasScrollBottom, hasScrollLeft, hasScrollRight },
148
+ value: { scrollRef, variant, hasScrollTop, hasScrollBottom, hasScrollLeft, hasScrollRight, scrollBehavior },
130
149
  children: /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, { ...props, ref: forwardRef, className: classes, children: [
131
150
  /* @__PURE__ */ jsx(
132
151
  ScrollAreaPrimitive.Viewport,
@@ -6,33 +6,46 @@ const clsx = require("clsx");
6
6
  const components_scrollArea_scrollAreaBar = require("./scroll-area-bar.cjs");
7
7
  const reactSlot = require("@radix-ui/react-slot");
8
8
  const utils_composeEventHandlers = require("../../utils/composeEventHandlers.cjs");
9
+ const utils_composeRefs = require("../../utils/composeRefs.cjs");
10
+ function scrollItemToCenter(item, scrollArea, scrollBehavior) {
11
+ const itemRect = item.getBoundingClientRect();
12
+ const scrollAreaRect = scrollArea.getBoundingClientRect();
13
+ const scrollViewVerticalCenter = (scrollAreaRect.top || 0) + (scrollAreaRect.height || 0) / 2;
14
+ const itemVerticalCenter = (itemRect.top || 0) + (itemRect.height || 0) / 2;
15
+ const scrollViewHorizontalCenter = (scrollAreaRect.left || 0) + (scrollAreaRect.width || 0) / 2;
16
+ const itemHorizontalCenter = (itemRect.left || 0) + (itemRect.width || 0) / 2;
17
+ const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
18
+ scrollArea.scrollBy({
19
+ top: itemVerticalCenter - scrollViewVerticalCenter,
20
+ left: itemHorizontalCenter - scrollViewHorizontalCenter,
21
+ behavior: hasReducedMotion ? "auto" : scrollBehavior
22
+ });
23
+ }
9
24
  const Item = React.forwardRef(
10
- ({ className, asChild, ...props }, forwardRef) => {
25
+ ({ className, asChild, isSelected, scrollBehavior, scrollBehaviorOnMount, ...props }, forwardRef) => {
11
26
  const classes = clsx([components_scrollArea_scrollAreaBar.styles[`${components_scrollArea_scrollAreaBar.rootClassName}__item`]], className);
12
27
  const Comp = asChild ? reactSlot.Slot : "div";
28
+ const ref = React.useRef(null);
29
+ const composedRef = utils_composeRefs.useComposedRefs(ref, forwardRef);
13
30
  const context = React.useContext(components_scrollArea_scrollAreaBar.RootContext);
31
+ const internalScrollBehavior = scrollBehavior ?? (context == null ? void 0 : context.scrollBehavior) ?? "smooth";
32
+ React.useEffect(() => {
33
+ if (isSelected && ref.current && (context == null ? void 0 : context.scrollRef)) {
34
+ scrollItemToCenter(ref.current, context == null ? void 0 : context.scrollRef, scrollBehaviorOnMount ?? "smooth");
35
+ }
36
+ }, [isSelected, ref, context == null ? void 0 : context.scrollRef, scrollBehaviorOnMount]);
14
37
  return /* @__PURE__ */ jsxRuntime.jsx(
15
38
  Comp,
16
39
  {
17
40
  ...props,
18
41
  onClick: utils_composeEventHandlers.composeEventHandlers(props.onClick, (e) => {
19
- var _a, _b;
20
42
  if (e.defaultPrevented)
21
43
  return;
22
- const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
23
- const item = e.currentTarget.getBoundingClientRect();
24
- const scrollViewVerticalCenter = ((scroll == null ? void 0 : scroll.top) || 0) + ((scroll == null ? void 0 : scroll.height) || 0) / 2;
25
- const itemVerticalCenter = ((item == null ? void 0 : item.top) || 0) + ((item == null ? void 0 : item.height) || 0) / 2;
26
- const scrollViewHorizontalCenter = ((scroll == null ? void 0 : scroll.left) || 0) + ((scroll == null ? void 0 : scroll.width) || 0) / 2;
27
- const itemHorizontalCenter = ((item == null ? void 0 : item.left) || 0) + ((item == null ? void 0 : item.width) || 0) / 2;
28
- const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
29
- (_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
30
- top: itemVerticalCenter - scrollViewVerticalCenter,
31
- left: itemHorizontalCenter - scrollViewHorizontalCenter,
32
- behavior: hasReducedMotion ? "auto" : "smooth"
33
- });
44
+ if (!ref.current || !(context == null ? void 0 : context.scrollRef))
45
+ return;
46
+ scrollItemToCenter(ref.current, context == null ? void 0 : context.scrollRef, internalScrollBehavior);
34
47
  }),
35
- ref: forwardRef,
48
+ ref: composedRef,
36
49
  className: classes
37
50
  }
38
51
  );
@@ -2,7 +2,13 @@ import { default as React } from 'react';
2
2
 
3
3
  export type ItemProps = React.ComponentPropsWithoutRef<'div'> & {
4
4
  asChild?: boolean;
5
+ isSelected?: boolean;
6
+ scrollBehavior?: 'smooth' | 'auto';
7
+ scrollBehaviorOnMount?: 'smooth' | 'auto';
5
8
  };
6
9
  export declare const Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
10
  asChild?: boolean | undefined;
11
+ isSelected?: boolean | undefined;
12
+ scrollBehavior?: "auto" | "smooth" | undefined;
13
+ scrollBehaviorOnMount?: "auto" | "smooth" | undefined;
8
14
  } & React.RefAttributes<HTMLDivElement>>;
@@ -4,33 +4,46 @@ import clsx from "clsx";
4
4
  import { s as styles, r as rootClassName, a as RootContext } from "./scroll-area-bar.js";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
7
+ import { useComposedRefs } from "../../utils/composeRefs.js";
8
+ function scrollItemToCenter(item, scrollArea, scrollBehavior) {
9
+ const itemRect = item.getBoundingClientRect();
10
+ const scrollAreaRect = scrollArea.getBoundingClientRect();
11
+ const scrollViewVerticalCenter = (scrollAreaRect.top || 0) + (scrollAreaRect.height || 0) / 2;
12
+ const itemVerticalCenter = (itemRect.top || 0) + (itemRect.height || 0) / 2;
13
+ const scrollViewHorizontalCenter = (scrollAreaRect.left || 0) + (scrollAreaRect.width || 0) / 2;
14
+ const itemHorizontalCenter = (itemRect.left || 0) + (itemRect.width || 0) / 2;
15
+ const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
16
+ scrollArea.scrollBy({
17
+ top: itemVerticalCenter - scrollViewVerticalCenter,
18
+ left: itemHorizontalCenter - scrollViewHorizontalCenter,
19
+ behavior: hasReducedMotion ? "auto" : scrollBehavior
20
+ });
21
+ }
7
22
  const Item = React__default.forwardRef(
8
- ({ className, asChild, ...props }, forwardRef) => {
23
+ ({ className, asChild, isSelected, scrollBehavior, scrollBehaviorOnMount, ...props }, forwardRef) => {
9
24
  const classes = clsx([styles[`${rootClassName}__item`]], className);
10
25
  const Comp = asChild ? Slot : "div";
26
+ const ref = React__default.useRef(null);
27
+ const composedRef = useComposedRefs(ref, forwardRef);
11
28
  const context = React__default.useContext(RootContext);
29
+ const internalScrollBehavior = scrollBehavior ?? (context == null ? void 0 : context.scrollBehavior) ?? "smooth";
30
+ React__default.useEffect(() => {
31
+ if (isSelected && ref.current && (context == null ? void 0 : context.scrollRef)) {
32
+ scrollItemToCenter(ref.current, context == null ? void 0 : context.scrollRef, scrollBehaviorOnMount ?? "smooth");
33
+ }
34
+ }, [isSelected, ref, context == null ? void 0 : context.scrollRef, scrollBehaviorOnMount]);
12
35
  return /* @__PURE__ */ jsx(
13
36
  Comp,
14
37
  {
15
38
  ...props,
16
39
  onClick: composeEventHandlers(props.onClick, (e) => {
17
- var _a, _b;
18
40
  if (e.defaultPrevented)
19
41
  return;
20
- const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
21
- const item = e.currentTarget.getBoundingClientRect();
22
- const scrollViewVerticalCenter = ((scroll == null ? void 0 : scroll.top) || 0) + ((scroll == null ? void 0 : scroll.height) || 0) / 2;
23
- const itemVerticalCenter = ((item == null ? void 0 : item.top) || 0) + ((item == null ? void 0 : item.height) || 0) / 2;
24
- const scrollViewHorizontalCenter = ((scroll == null ? void 0 : scroll.left) || 0) + ((scroll == null ? void 0 : scroll.width) || 0) / 2;
25
- const itemHorizontalCenter = ((item == null ? void 0 : item.left) || 0) + ((item == null ? void 0 : item.width) || 0) / 2;
26
- const hasReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
27
- (_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
28
- top: itemVerticalCenter - scrollViewVerticalCenter,
29
- left: itemHorizontalCenter - scrollViewHorizontalCenter,
30
- behavior: hasReducedMotion ? "auto" : "smooth"
31
- });
42
+ if (!ref.current || !(context == null ? void 0 : context.scrollRef))
43
+ return;
44
+ scrollItemToCenter(ref.current, context == null ? void 0 : context.scrollRef, internalScrollBehavior);
32
45
  }),
33
- ref: forwardRef,
46
+ ref: composedRef,
34
47
  className: classes
35
48
  }
36
49
  );
@@ -10,14 +10,16 @@ export type RootProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitiv
10
10
  * - `undefined`: The scrollbar will not be visible
11
11
  */
12
12
  variant?: Variant | undefined;
13
+ scrollBehavior?: 'smooth' | 'auto';
13
14
  };
14
15
  type RootContextType = {
15
16
  scrollRef: HTMLDivElement | null;
16
17
  variant?: Variant;
17
- hasScrollTop: boolean | null;
18
- hasScrollBottom: boolean | null;
19
- hasScrollLeft: boolean | null;
20
- hasScrollRight: boolean | null;
18
+ hasScrollTop: boolean | undefined;
19
+ hasScrollBottom: boolean | undefined;
20
+ hasScrollLeft: boolean | undefined;
21
+ hasScrollRight: boolean | undefined;
22
+ scrollBehavior: 'smooth' | 'auto';
21
23
  };
22
24
  export declare const RootContext: React.Context<RootContextType | undefined>;
23
25
  export declare const Root: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
@@ -27,5 +29,6 @@ export declare const Root: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimit
27
29
  * - `undefined`: The scrollbar will not be visible
28
30
  */
29
31
  variant?: Variant | undefined;
32
+ scrollBehavior?: "auto" | "smooth" | undefined;
30
33
  } & React.RefAttributes<HTMLDivElement>>;
31
34
  export {};
@@ -25,6 +25,7 @@ export declare const Tabs: import('react').ForwardRefExoticComponent<Omit<Omit<i
25
25
  } & import('react').RefAttributes<HTMLDivElement>>;
26
26
  Scroll: import('react').ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-scroll-area').ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
27
27
  variant?: ("button" | "scrollbar") | undefined;
28
+ scrollBehavior?: "auto" | "smooth" | undefined;
28
29
  } & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
29
30
  ScrollButton: import('react').ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
30
31
  display?: import('../../utils/generate-styling').DisplayChildren | undefined;
@@ -6,4 +6,5 @@ export declare const ScrollContext: React.Context<boolean>;
6
6
  /** */
7
7
  export declare const Scroll: React.ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-scroll-area').ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
8
8
  variant?: ("button" | "scrollbar") | undefined;
9
+ scrollBehavior?: "auto" | "smooth" | undefined;
9
10
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=8"
21
21
  },
22
22
  "private": false,
23
- "version": "0.0.70",
23
+ "version": "0.0.71",
24
24
  "sideEffects": [
25
25
  "**/*.css"
26
26
  ],