@box/blueprint-web 9.3.0 → 9.4.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/lib-esm/index.css +27 -28
- package/lib-esm/radio-tiles/radio-tiles.d.ts +1 -1
- package/lib-esm/radio-tiles/radio-tiles.js +3 -2
- package/lib-esm/radio-tiles/types.d.ts +1 -0
- package/lib-esm/toolbar/toolbar.module.js +1 -1
- package/lib-esm/toolbar/utils/horizontal-scroll-context.js +8 -71
- package/lib-esm/toolbar/utils/use-scroll-state.d.ts +5 -0
- package/lib-esm/toolbar/utils/use-scroll-state.js +84 -0
- package/package.json +2 -2
package/lib-esm/index.css
CHANGED
|
@@ -6797,7 +6797,7 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6797
6797
|
--z-index-card-tooltip:2147483647;
|
|
6798
6798
|
}
|
|
6799
6799
|
|
|
6800
|
-
.bp_toolbar_module_toolbarRoot--
|
|
6800
|
+
.bp_toolbar_module_toolbarRoot--b6b06{
|
|
6801
6801
|
background:var(--surface-surface);
|
|
6802
6802
|
border:var(--border-1) solid var(--border-card-border);
|
|
6803
6803
|
border-radius:var(--radius-4);
|
|
@@ -6805,16 +6805,16 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6805
6805
|
padding:calc(var(--space-1) - var(--border-1));
|
|
6806
6806
|
}
|
|
6807
6807
|
|
|
6808
|
-
.bp_toolbar_module_scrollButtonWrapper--
|
|
6808
|
+
.bp_toolbar_module_scrollButtonWrapper--b6b06,.bp_toolbar_module_toolbarRoot--b6b06{
|
|
6809
6809
|
align-items:center;
|
|
6810
6810
|
display:flex;
|
|
6811
6811
|
gap:var(--space-1);
|
|
6812
6812
|
}
|
|
6813
|
-
.bp_toolbar_module_scrollButtonWrapper--
|
|
6813
|
+
.bp_toolbar_module_scrollButtonWrapper--b6b06.bp_toolbar_module_hidden--b6b06{
|
|
6814
6814
|
display:none;
|
|
6815
6815
|
}
|
|
6816
6816
|
|
|
6817
|
-
.bp_toolbar_module_scrollableChildrenWrapper--
|
|
6817
|
+
.bp_toolbar_module_scrollableChildrenWrapper--b6b06{
|
|
6818
6818
|
-ms-overflow-style:none;
|
|
6819
6819
|
align-items:center;
|
|
6820
6820
|
display:flex;
|
|
@@ -6827,27 +6827,26 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6827
6827
|
scrollbar-width:none;
|
|
6828
6828
|
white-space:nowrap;
|
|
6829
6829
|
}
|
|
6830
|
-
.bp_toolbar_module_scrollableChildrenWrapper--
|
|
6830
|
+
.bp_toolbar_module_scrollableChildrenWrapper--b6b06::-webkit-scrollbar{
|
|
6831
6831
|
display:none;
|
|
6832
6832
|
}
|
|
6833
|
-
.bp_toolbar_module_scrollableChildrenWrapper--
|
|
6834
|
-
flex
|
|
6835
|
-
flex-shrink:0;
|
|
6833
|
+
.bp_toolbar_module_scrollableChildrenWrapper--b6b06 > *{
|
|
6834
|
+
flex:none;
|
|
6836
6835
|
}
|
|
6837
6836
|
|
|
6838
|
-
.bp_toolbar_module_separator--
|
|
6837
|
+
.bp_toolbar_module_separator--b6b06{
|
|
6839
6838
|
background-color:var(--border-divider-border);
|
|
6840
6839
|
border-radius:var(--radius-2);
|
|
6841
6840
|
height:var(--size-6);
|
|
6842
6841
|
width:1px;
|
|
6843
6842
|
}
|
|
6844
6843
|
|
|
6845
|
-
.bp_toolbar_module_toggleGroup--
|
|
6844
|
+
.bp_toolbar_module_toggleGroup--b6b06{
|
|
6846
6845
|
display:flex;
|
|
6847
6846
|
gap:var(--space-1);
|
|
6848
6847
|
}
|
|
6849
6848
|
|
|
6850
|
-
.bp_toolbar_module_toolbarItem--
|
|
6849
|
+
.bp_toolbar_module_toolbarItem--b6b06{
|
|
6851
6850
|
--toolbar-item-hover-opacity:0.3;
|
|
6852
6851
|
align-items:center;
|
|
6853
6852
|
background:var(--toolbar-button-color, var(--surface-toggle-surface));
|
|
@@ -6865,45 +6864,45 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6865
6864
|
-webkit-user-select:none;
|
|
6866
6865
|
user-select:none;
|
|
6867
6866
|
}
|
|
6868
|
-
.bp_toolbar_module_toolbarItem--
|
|
6867
|
+
.bp_toolbar_module_toolbarItem--b6b06[data-disabled]{
|
|
6869
6868
|
background:var(--surface-toggle-surface);
|
|
6870
6869
|
opacity:var(--toolbar-item-hover-opacity);
|
|
6871
6870
|
pointer-events:none;
|
|
6872
6871
|
}
|
|
6873
|
-
.bp_toolbar_module_toolbarItem--
|
|
6872
|
+
.bp_toolbar_module_toolbarItem--b6b06:not([data-disabled]):focus-visible{
|
|
6874
6873
|
box-shadow:0 0 0 var(--border-1, 1px) var(--background-background), 0 0 0 var(--border-3) #2486fc;
|
|
6875
6874
|
}
|
|
6876
|
-
.bp_toolbar_module_toolbarItem--
|
|
6875
|
+
.bp_toolbar_module_toolbarItem--b6b06:not([data-disabled]):hover{
|
|
6877
6876
|
background:var(--toolbar-button-color, var(--surface-toggle-surface-hover));
|
|
6878
6877
|
border:var(--border-1) solid var(--toolbar-button-color, var(--surface-toggle-surface-hover));
|
|
6879
6878
|
}
|
|
6880
6879
|
|
|
6881
|
-
.bp_toolbar_module_toolbarToggle--
|
|
6880
|
+
.bp_toolbar_module_toolbarToggle--b6b06[data-state=on]{
|
|
6882
6881
|
background:var(--surface-toggle-surface-pressed);
|
|
6883
6882
|
}
|
|
6884
|
-
.bp_toolbar_module_toolbarToggle--
|
|
6883
|
+
.bp_toolbar_module_toolbarToggle--b6b06[data-state=on] svg *{
|
|
6885
6884
|
fill:var(--icon-icon-on-dark);
|
|
6886
6885
|
}
|
|
6887
|
-
.bp_toolbar_module_toolbarToggle--
|
|
6886
|
+
.bp_toolbar_module_toolbarToggle--b6b06[data-state=on]:not([data-disabled]):hover{
|
|
6888
6887
|
background:var(--surface-toggle-surface-on-hover);
|
|
6889
6888
|
border:var(--border-1) solid var(--surface-toggle-surface-on-hover);
|
|
6890
6889
|
}
|
|
6891
6890
|
|
|
6892
|
-
.bp_toolbar_module_dropdownIndicator--
|
|
6891
|
+
.bp_toolbar_module_dropdownIndicator--b6b06.bp_toolbar_module_invertCaret--b6b06{
|
|
6893
6892
|
transform:rotate(.5turn);
|
|
6894
6893
|
}
|
|
6895
6894
|
|
|
6896
|
-
.bp_toolbar_module_triggerButtonSelectedWithColor--
|
|
6895
|
+
.bp_toolbar_module_triggerButtonSelectedWithColor--b6b06{
|
|
6897
6896
|
--trigger-button-hover-opacity:0.7;
|
|
6898
6897
|
}
|
|
6899
|
-
.bp_toolbar_module_triggerButtonSelectedWithColor--
|
|
6898
|
+
.bp_toolbar_module_triggerButtonSelectedWithColor--b6b06[data-state=on] .bp_toolbar_module_dropdownIndicator--b6b06 path{
|
|
6900
6899
|
fill:var(--icon-icon-on-light);
|
|
6901
6900
|
}
|
|
6902
|
-
.bp_toolbar_module_triggerButtonSelectedWithColor--
|
|
6901
|
+
.bp_toolbar_module_triggerButtonSelectedWithColor--b6b06[data-state=on]:hover{
|
|
6903
6902
|
opacity:var(--trigger-button-hover-opacity);
|
|
6904
6903
|
}
|
|
6905
6904
|
|
|
6906
|
-
.bp_toolbar_module_toolbarIcon--
|
|
6905
|
+
.bp_toolbar_module_toolbarIcon--b6b06{
|
|
6907
6906
|
align-items:center;
|
|
6908
6907
|
display:flex;
|
|
6909
6908
|
height:var(--size-5);
|
|
@@ -6911,7 +6910,7 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6911
6910
|
width:var(--size-5);
|
|
6912
6911
|
}
|
|
6913
6912
|
|
|
6914
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6913
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06{
|
|
6915
6914
|
border:var(--border-1) solid var(--border-toggletext-border-off);
|
|
6916
6915
|
color:var(--text-text-on-light);
|
|
6917
6916
|
font-family:Lato, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
@@ -6925,24 +6924,24 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
6925
6924
|
text-transform:none;
|
|
6926
6925
|
white-space:nowrap;
|
|
6927
6926
|
}
|
|
6928
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6927
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06:hover{
|
|
6929
6928
|
background:var(--surface-toggle-surface-off-hover);
|
|
6930
6929
|
border-color:var(--border-toggletext-border-off-hover);
|
|
6931
6930
|
}
|
|
6932
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6931
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06:active{
|
|
6933
6932
|
background:var(--surface-toggle-surface-off-pressed);
|
|
6934
6933
|
border-color:var(--border-toggletext-border-off-pressed);
|
|
6935
6934
|
}
|
|
6936
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6935
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06[aria-checked=true]{
|
|
6937
6936
|
background:var(--surface-toggletext-surface-on);
|
|
6938
6937
|
border:var(--border-1) solid var(--border-toggletext-border-on);
|
|
6939
6938
|
color:var(--text-toggletext-text);
|
|
6940
6939
|
}
|
|
6941
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6940
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06[aria-checked=true]:hover{
|
|
6942
6941
|
background:var(--surface-toggletext-surface-on-hover);
|
|
6943
6942
|
border-color:var(--border-toggletext-border-on-hover);
|
|
6944
6943
|
}
|
|
6945
|
-
.bp_toolbar_module_toolbarTextToggleItem--
|
|
6944
|
+
.bp_toolbar_module_toolbarTextToggleItem--b6b06[aria-checked=true]:active{
|
|
6946
6945
|
background:var(--surface-toggletext-surface-on-pressed);
|
|
6947
6946
|
border-color:var(--border-toggletext-border-on-pressed);
|
|
6948
6947
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type RadioTilesProps } from './types';
|
|
2
|
-
export declare const RadioTiles: (<T extends string | null = string>({ children, name, value, variant, columns, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onChange, }: RadioTilesProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
2
|
+
export declare const RadioTiles: (<T extends string | null = string>({ children, name, value, variant, columns, disabled, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onChange, }: RadioTilesProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
3
|
Option: <T extends string>({ children, value, label, icon, disabled: disabledProp, className, "aria-label": ariaLabel, }: import("./types").RadioTilesOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
import clsx from 'clsx';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
4
|
import { RadioTilesOption } from './radio-tiles-option.js';
|
|
5
5
|
import { RadioTilesContext } from './radio-tiles.context.js';
|
|
6
6
|
import styles from './radio-tiles.module.js';
|
|
@@ -12,6 +12,7 @@ const RadioTilesRoot = ({
|
|
|
12
12
|
variant = 'default',
|
|
13
13
|
columns,
|
|
14
14
|
disabled,
|
|
15
|
+
className,
|
|
15
16
|
'aria-label': ariaLabel,
|
|
16
17
|
'aria-labelledby': ariaLabelledBy,
|
|
17
18
|
onChange
|
|
@@ -22,7 +23,7 @@ const RadioTilesRoot = ({
|
|
|
22
23
|
const containerClassNames = clsx(styles.radioTiles, {
|
|
23
24
|
[styles.hasColumns]: Number(columns) > 0,
|
|
24
25
|
[variant === 'compact' ? styles.compact : styles.default]: true
|
|
25
|
-
});
|
|
26
|
+
}, className);
|
|
26
27
|
const contextValue = useMemo(() => ({
|
|
27
28
|
name,
|
|
28
29
|
selectedValue: value,
|
|
@@ -18,6 +18,7 @@ export type RadioTilesProps<T extends string | null = string | null> = {
|
|
|
18
18
|
columns?: number;
|
|
19
19
|
variant?: 'default' | 'compact';
|
|
20
20
|
disabled?: boolean;
|
|
21
|
+
className?: string;
|
|
21
22
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
22
23
|
} & (WithAriaLabel | WithAriaLabelledBy);
|
|
23
24
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"toolbarRoot":"bp_toolbar_module_toolbarRoot--
|
|
2
|
+
var styles = {"toolbarRoot":"bp_toolbar_module_toolbarRoot--b6b06","scrollButtonWrapper":"bp_toolbar_module_scrollButtonWrapper--b6b06","hidden":"bp_toolbar_module_hidden--b6b06","scrollableChildrenWrapper":"bp_toolbar_module_scrollableChildrenWrapper--b6b06","separator":"bp_toolbar_module_separator--b6b06","toggleGroup":"bp_toolbar_module_toggleGroup--b6b06","toolbarItem":"bp_toolbar_module_toolbarItem--b6b06","toolbarToggle":"bp_toolbar_module_toolbarToggle--b6b06","dropdownIndicator":"bp_toolbar_module_dropdownIndicator--b6b06","invertCaret":"bp_toolbar_module_invertCaret--b6b06","triggerButtonSelectedWithColor":"bp_toolbar_module_triggerButtonSelectedWithColor--b6b06","toolbarIcon":"bp_toolbar_module_toolbarIcon--b6b06","toolbarTextToggleItem":"bp_toolbar_module_toolbarTextToggleItem--b6b06"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import noop from 'lodash/noop';
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useCallback, useMemo, createContext, useContext } from 'react';
|
|
4
|
+
import { useScrollState } from './use-scroll-state.js';
|
|
4
5
|
|
|
5
6
|
const HorizontalScrollContext = /*#__PURE__*/createContext({
|
|
6
7
|
scrollPosition: 'none',
|
|
@@ -12,79 +13,15 @@ const HorizontalScrollProvider = ({
|
|
|
12
13
|
children,
|
|
13
14
|
scrollStep = 50
|
|
14
15
|
}) => {
|
|
15
|
-
const [scrollPosition, setScrollPosition] = useState('none');
|
|
16
16
|
const [scrollableElement, setScrollableElement] = useState(null);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
scrollWidth,
|
|
23
|
-
clientWidth
|
|
24
|
-
} = scrollableElement;
|
|
25
|
-
if (scrollWidth <= clientWidth) {
|
|
26
|
-
setScrollPosition('none');
|
|
27
|
-
} else if (scrollLeft === 0) {
|
|
28
|
-
setScrollPosition('start');
|
|
29
|
-
} else if (scrollLeft + clientWidth >= scrollWidth) {
|
|
30
|
-
setScrollPosition('end');
|
|
31
|
-
} else {
|
|
32
|
-
setScrollPosition('intermediate');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, [scrollableElement]);
|
|
36
|
-
const handleScroll = useCallback(() => {
|
|
37
|
-
if (scrollAnimationFrame.current !== null) {
|
|
38
|
-
cancelAnimationFrame(scrollAnimationFrame.current);
|
|
39
|
-
}
|
|
40
|
-
scrollAnimationFrame.current = requestAnimationFrame(updateScrollState);
|
|
41
|
-
}, [updateScrollState]);
|
|
42
|
-
const scrollLeft = useCallback(() => {
|
|
43
|
-
if (scrollableElement) {
|
|
44
|
-
scrollableElement.scrollBy({
|
|
45
|
-
left: -scrollStep,
|
|
46
|
-
behavior: 'smooth'
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, [scrollStep, scrollableElement]);
|
|
50
|
-
const scrollRight = useCallback(() => {
|
|
51
|
-
if (scrollableElement) {
|
|
52
|
-
scrollableElement.scrollBy({
|
|
53
|
-
left: scrollStep,
|
|
54
|
-
behavior: 'smooth'
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, [scrollStep, scrollableElement]);
|
|
17
|
+
const {
|
|
18
|
+
scrollPosition,
|
|
19
|
+
scrollLeft,
|
|
20
|
+
scrollRight
|
|
21
|
+
} = useScrollState(scrollableElement, scrollStep);
|
|
58
22
|
const onAttach = useCallback(node => {
|
|
59
23
|
setScrollableElement(node);
|
|
60
|
-
|
|
61
|
-
updateScrollState();
|
|
62
|
-
}
|
|
63
|
-
}, [updateScrollState]);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (!scrollableElement) {
|
|
66
|
-
return noop;
|
|
67
|
-
}
|
|
68
|
-
const handleFocusIn = event => {
|
|
69
|
-
const target = event.target;
|
|
70
|
-
if (scrollableElement.contains(target)) {
|
|
71
|
-
target.scrollIntoView({
|
|
72
|
-
behavior: 'smooth',
|
|
73
|
-
inline: 'nearest'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
scrollableElement.addEventListener('focusin', handleFocusIn);
|
|
78
|
-
scrollableElement.addEventListener('scroll', handleScroll);
|
|
79
|
-
updateScrollState();
|
|
80
|
-
return () => {
|
|
81
|
-
scrollableElement.removeEventListener('focusin', handleFocusIn);
|
|
82
|
-
scrollableElement.removeEventListener('scroll', handleScroll);
|
|
83
|
-
if (scrollAnimationFrame.current !== null) {
|
|
84
|
-
cancelAnimationFrame(scrollAnimationFrame.current);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}, [scrollableElement, handleScroll, updateScrollState]);
|
|
24
|
+
}, []);
|
|
88
25
|
const contextValue = useMemo(() => ({
|
|
89
26
|
scrollPosition,
|
|
90
27
|
scrollLeft,
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import noop from 'lodash/noop';
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
// The hook that manages the scroll position logic and provides scroll control functions
|
|
5
|
+
const useScrollState = (scrollableElement, scrollStep = 50) => {
|
|
6
|
+
const [scrollPosition, setScrollPosition] = useState('none');
|
|
7
|
+
const scrollAnimationFrame = useRef(null);
|
|
8
|
+
const updateScrollState = useCallback(() => {
|
|
9
|
+
if (!scrollableElement) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const {
|
|
13
|
+
scrollLeft,
|
|
14
|
+
scrollWidth,
|
|
15
|
+
clientWidth
|
|
16
|
+
} = scrollableElement;
|
|
17
|
+
if (scrollWidth <= clientWidth) {
|
|
18
|
+
setScrollPosition('none');
|
|
19
|
+
} else if (scrollLeft === 0) {
|
|
20
|
+
setScrollPosition('start');
|
|
21
|
+
} else if (scrollLeft + clientWidth >= scrollWidth) {
|
|
22
|
+
setScrollPosition('end');
|
|
23
|
+
} else {
|
|
24
|
+
setScrollPosition('intermediate');
|
|
25
|
+
}
|
|
26
|
+
}, [scrollableElement]);
|
|
27
|
+
const handleScroll = useCallback(() => {
|
|
28
|
+
if (scrollAnimationFrame.current !== null) {
|
|
29
|
+
cancelAnimationFrame(scrollAnimationFrame.current);
|
|
30
|
+
}
|
|
31
|
+
scrollAnimationFrame.current = requestAnimationFrame(updateScrollState);
|
|
32
|
+
}, [updateScrollState]);
|
|
33
|
+
const scrollLeft = useCallback(() => {
|
|
34
|
+
if (!scrollableElement) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
scrollableElement.scrollBy({
|
|
38
|
+
left: -scrollStep,
|
|
39
|
+
behavior: 'smooth'
|
|
40
|
+
});
|
|
41
|
+
}, [scrollStep, scrollableElement]);
|
|
42
|
+
const scrollRight = useCallback(() => {
|
|
43
|
+
if (!scrollableElement) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
scrollableElement.scrollBy({
|
|
47
|
+
left: scrollStep,
|
|
48
|
+
behavior: 'smooth'
|
|
49
|
+
});
|
|
50
|
+
}, [scrollStep, scrollableElement]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!scrollableElement) {
|
|
53
|
+
return noop;
|
|
54
|
+
}
|
|
55
|
+
const handleFocusIn = event => {
|
|
56
|
+
const {
|
|
57
|
+
target
|
|
58
|
+
} = event;
|
|
59
|
+
if (target instanceof HTMLElement && scrollableElement.contains(target)) {
|
|
60
|
+
target.scrollIntoView({
|
|
61
|
+
behavior: 'smooth',
|
|
62
|
+
inline: 'nearest'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
scrollableElement.addEventListener('focusin', handleFocusIn);
|
|
67
|
+
scrollableElement.addEventListener('scroll', handleScroll);
|
|
68
|
+
updateScrollState();
|
|
69
|
+
return () => {
|
|
70
|
+
scrollableElement.removeEventListener('focusin', handleFocusIn);
|
|
71
|
+
scrollableElement.removeEventListener('scroll', handleScroll);
|
|
72
|
+
if (scrollAnimationFrame.current !== null) {
|
|
73
|
+
cancelAnimationFrame(scrollAnimationFrame.current);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, [scrollableElement, handleScroll, updateScrollState]);
|
|
77
|
+
return {
|
|
78
|
+
scrollPosition,
|
|
79
|
+
scrollLeft,
|
|
80
|
+
scrollRight
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { useScrollState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-stately": "^3.31.1",
|
|
64
64
|
"tsx": "^4.16.5"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "54b7ea2666cfeaedb3792148822d4b50578a565b",
|
|
67
67
|
"module": "lib-esm/index.js",
|
|
68
68
|
"main": "lib-esm/index.js",
|
|
69
69
|
"exports": {
|