@box/blueprint-web 9.16.0 → 9.16.2
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/avatar/consts.js +1 -1
- package/lib-esm/branding-styles/utils/createTheme.js +2 -0
- package/lib-esm/input-chip/input-chip.js +24 -26
- package/lib-esm/modal/modal-scrollable-container.js +9 -5
- package/lib-esm/util-components/scrollable-container/scrollable-container.d.ts +1 -1
- package/lib-esm/utils/use-debounce.js +1 -1
- package/package.json +6 -6
package/lib-esm/avatar/consts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxBlue50, DarkBlue50, Yellow50, GreenLight50, Yellorange50, LightBlue50, WatermelonRed50, PurpleRain50, Orange50, Grimace50,
|
|
1
|
+
import { Size3, Size4, Size5, Size7, Size9, BoxBlue50, DarkBlue50, Yellow50, GreenLight50, Yellorange50, LightBlue50, WatermelonRed50, PurpleRain50, Orange50, Grimace50, Size2, Size6 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
2
|
|
|
3
3
|
const anonymousAvatarIconSizes = {
|
|
4
4
|
small: Size3,
|
|
@@ -6,6 +6,8 @@ import theme from './theme.js';
|
|
|
6
6
|
import { white, black, bdlGray10, bdlGray, bdlGray80, bdlGray65, bdlGray50 } from './variables.js';
|
|
7
7
|
|
|
8
8
|
// This is a copy of https://github.com/box/box-ui-elements/blob/master/src/utils/createTheme.js
|
|
9
|
+
// Copied on Mar 5 2023
|
|
10
|
+
// Latest commit c7e1560 on Mar 20, 2020
|
|
9
11
|
/* ----------------- Theme ---------------------------*/
|
|
10
12
|
const THEME_VERY_DARK = 'vDark';
|
|
11
13
|
const THEME_DARK = 'dark';
|
|
@@ -29,32 +29,30 @@ const InputChip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
29
29
|
buttonProps.onKeyDown?.(event);
|
|
30
30
|
};
|
|
31
31
|
const hasError = variant === 'error';
|
|
32
|
-
return /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
);
|
|
32
|
+
return /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */jsxs("button", {
|
|
33
|
+
...buttonProps,
|
|
34
|
+
ref: ref,
|
|
35
|
+
"aria-invalid": hasError,
|
|
36
|
+
className: clsx(styles.container, hasError && styles.error, avatar && styles.avatarContainer, onDelete && styles.deleteButton, className),
|
|
37
|
+
onKeyDown: handleKeyDown,
|
|
38
|
+
type: "button",
|
|
39
|
+
children: [avatar, jsx(Text, {
|
|
40
|
+
as: "span",
|
|
41
|
+
className: styles.label,
|
|
42
|
+
children: label
|
|
43
|
+
}), onDelete && (/* Don't use `onClick` handler on icon due to BUIE's "pointer-events: none" style that would cause click event to not trigger */
|
|
44
|
+
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
|
45
|
+
jsx("span", {
|
|
46
|
+
className: styles.deleteIcon,
|
|
47
|
+
onClick: onDelete,
|
|
48
|
+
children: jsx(XMark, {
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
"data-testid": "delete-icon",
|
|
51
|
+
height: Size4,
|
|
52
|
+
width: Size4
|
|
53
|
+
})
|
|
54
|
+
}))]
|
|
55
|
+
});
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
export { InputChip };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { forwardRef, useCallback } from 'react';
|
|
3
|
+
import { forwardRef, useRef, useCallback } from 'react';
|
|
4
|
+
import { composeEventHandlers } from '../utils/composeEventHandlers.js';
|
|
4
5
|
import { useScrollContext } from '../utils/scroll-context.js';
|
|
6
|
+
import { useForkRef } from '../utils/useForkRef.js';
|
|
5
7
|
import styles from './modal.module.js';
|
|
6
|
-
import { composeEventHandlers } from '../utils/composeEventHandlers.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Wrapper for the contents of the modal.
|
|
@@ -19,6 +20,7 @@ const ModalScrollableContainer = /*#__PURE__*/forwardRef(({
|
|
|
19
20
|
onScroll,
|
|
20
21
|
onAttach
|
|
21
22
|
} = useScrollContext();
|
|
23
|
+
const divRef = useRef(null);
|
|
22
24
|
const onMountRef = useCallback(node => {
|
|
23
25
|
onAttach(node);
|
|
24
26
|
if (!forwardedRef) {
|
|
@@ -31,13 +33,15 @@ const ModalScrollableContainer = /*#__PURE__*/forwardRef(({
|
|
|
31
33
|
}
|
|
32
34
|
}, [forwardedRef, onAttach]);
|
|
33
35
|
const handleOnFocus = event => {
|
|
34
|
-
if (event.target.scrollIntoView) {
|
|
35
|
-
event.target.scrollIntoView(
|
|
36
|
+
if (divRef.current?.contains(event.target) && event.target.scrollIntoView) {
|
|
37
|
+
event.target.scrollIntoView({
|
|
38
|
+
block: 'nearest'
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
};
|
|
38
42
|
return jsx("div", {
|
|
39
43
|
...rest,
|
|
40
|
-
ref: onMountRef,
|
|
44
|
+
ref: useForkRef(onMountRef, divRef),
|
|
41
45
|
className: clsx(styles.scrollableContainer, className),
|
|
42
46
|
"data-testid": dataTestId,
|
|
43
47
|
onFocus: composeEventHandlers(rest.onFocus, handleOnFocus),
|
|
@@ -26,6 +26,6 @@ export declare const useScroll: (forwardedRef: RefObject<HTMLDivElement>, scroll
|
|
|
26
26
|
isScrolledToEndY: boolean;
|
|
27
27
|
isScrolledToEndX: boolean;
|
|
28
28
|
};
|
|
29
|
-
onScrollThrottled: import("lodash").
|
|
29
|
+
onScrollThrottled: import("lodash").DebouncedFuncLeading<(e: UIEvent<HTMLElement>) => void>;
|
|
30
30
|
};
|
|
31
31
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
function useDebounce(value, delay) {
|
|
4
4
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5
5
|
useEffect(() => {
|
|
6
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay
|
|
6
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
7
7
|
return () => {
|
|
8
8
|
clearTimeout(timer);
|
|
9
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "9.16.
|
|
3
|
+
"version": "9.16.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ariakit/react": "0.4.15",
|
|
26
26
|
"@ariakit/react-core": "0.4.15",
|
|
27
|
-
"@box/blueprint-web-assets": "^4.32.
|
|
27
|
+
"@box/blueprint-web-assets": "^4.32.1",
|
|
28
28
|
"@internationalized/date": "^3.5.4",
|
|
29
29
|
"@radix-ui/react-accordion": "1.1.2",
|
|
30
30
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"type-fest": "^3.2.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@box/storybook-utils": "^0.8.
|
|
57
|
+
"@box/storybook-utils": "^0.8.2",
|
|
58
58
|
"@types/react": "^18.0.0",
|
|
59
59
|
"@types/react-dom": "^18.0.0",
|
|
60
60
|
"react": "^18.3.0",
|
|
@@ -62,9 +62,10 @@
|
|
|
62
62
|
"react-stately": "^3.31.1",
|
|
63
63
|
"tsx": "^4.16.5"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "9c7b8b2a403ff2bc3d0f313cdc8a7fb3a73079ed",
|
|
66
66
|
"module": "lib-esm/index.js",
|
|
67
67
|
"main": "lib-esm/index.js",
|
|
68
|
+
"types": "lib-esm/index.d.ts",
|
|
68
69
|
"exports": {
|
|
69
70
|
".": {
|
|
70
71
|
"import": "./lib-esm/index.js",
|
|
@@ -83,6 +84,5 @@
|
|
|
83
84
|
"./index.css": {
|
|
84
85
|
"import": "./lib-esm/index.css"
|
|
85
86
|
}
|
|
86
|
-
}
|
|
87
|
-
"types": "lib-esm/index.d.ts"
|
|
87
|
+
}
|
|
88
88
|
}
|