@box/blueprint-web 13.19.0 → 14.0.1
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/THIRD_PARTY_LICENSES +206 -27
- package/dist/lib-esm/button/button.d.ts +0 -2
- package/dist/lib-esm/button/button.js +2 -4
- package/dist/lib-esm/button/types.d.ts +0 -4
- package/dist/lib-esm/card-tooltip/card-tooltip.d.ts +3 -6
- package/dist/lib-esm/card-tooltip/card-tooltip.js +96 -42
- package/dist/lib-esm/card-tooltip/card-tooltip.module.js +1 -1
- package/dist/lib-esm/card-tooltip/types.d.ts +21 -36
- package/dist/lib-esm/combobox/chips-group.js +1 -5
- package/dist/lib-esm/combobox/combobox.js +64 -55
- package/dist/lib-esm/combobox/combobox.module.js +1 -1
- package/dist/lib-esm/combobox/types.d.ts +2 -2
- package/dist/lib-esm/combobox-group/combobox-group-combobox.js +0 -1
- package/dist/lib-esm/data-table/data-table-wrapper.js +2 -0
- package/dist/lib-esm/data-table/use-table-scroll-correction.d.ts +15 -0
- package/dist/lib-esm/data-table/use-table-scroll-correction.js +211 -0
- package/dist/lib-esm/empty-state/empty-state.d.ts +0 -2
- package/dist/lib-esm/guided-tooltip/guided-tooltip-footer.d.ts +0 -4
- package/dist/lib-esm/guided-tooltip/guided-tooltip.d.ts +0 -4
- package/dist/lib-esm/index.css +105 -289
- package/dist/lib-esm/index.d.ts +0 -3
- package/dist/lib-esm/index.js +0 -3
- package/dist/lib-esm/list-item/table-header-dropdown.js +1 -1
- package/dist/lib-esm/modal/alert-modal.d.ts +0 -4
- package/dist/lib-esm/modal/modal-footer.d.ts +0 -4
- package/dist/lib-esm/modal/modal.d.ts +0 -4
- package/dist/lib-esm/primitives/context-menu/context-menu.module.js +1 -1
- package/dist/lib-esm/primitives/select-menu-grid/select-menu-grid-option.js +0 -1
- package/dist/lib-esm/side-panel/side-panel-footer.d.ts +0 -4
- package/dist/lib-esm/side-panel/side-panel.d.ts +0 -4
- package/dist/lib-esm/tooltip/tooltip.d.ts +3 -2
- package/dist/lib-esm/tooltip/tooltip.js +2 -36
- package/dist/lib-esm/tooltip/types.d.ts +0 -9
- package/dist/lib-esm/util-components/base-grid-list-item/types.d.ts +2 -2
- package/dist/lib-esm/utils/useMedia.js +13 -1
- package/package.json +14 -14
- package/dist/lib-esm/card-tooltip-v2/card-tooltip-v2.d.ts +0 -10
- package/dist/lib-esm/card-tooltip-v2/card-tooltip-v2.js +0 -119
- package/dist/lib-esm/card-tooltip-v2/card-tooltip-v2.module.js +0 -4
- package/dist/lib-esm/card-tooltip-v2/index.d.ts +0 -2
- package/dist/lib-esm/card-tooltip-v2/types.d.ts +0 -30
- package/dist/lib-esm/content-field/content-field.d.ts +0 -4
- package/dist/lib-esm/content-field/content-field.js +0 -126
- package/dist/lib-esm/content-field/content-field.module.js +0 -4
- package/dist/lib-esm/content-field/index.d.ts +0 -2
- package/dist/lib-esm/content-field/messages.d.ts +0 -7
- package/dist/lib-esm/content-field/messages.js +0 -8
- package/dist/lib-esm/content-field/types.d.ts +0 -35
- package/dist/lib-esm/util-components/focus-trap/focus-trap.d.ts +0 -2
- package/dist/lib-esm/util-components/focus-trap/focus-trap.js +0 -52
- package/dist/lib-esm/util-components/focus-trap/index.d.ts +0 -1
- package/dist/lib-esm/util-components/focus-trap/types.d.ts +0 -8
- package/dist/lib-esm/utils/useIsTriggerInteractive.d.ts +0 -4
- package/dist/lib-esm/utils/useIsTriggerInteractive.js +0 -21
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Button } from '@ariakit/react';
|
|
3
|
-
import { FolderShared } from '@box/blueprint-web-assets/icons/Content';
|
|
4
|
-
import { XMark, Folder } from '@box/blueprint-web-assets/icons/Fill';
|
|
5
|
-
import { Space6, Space4 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import { forwardRef, createRef } from 'react';
|
|
8
|
-
import { InlineError } from '../primitives/inline-error/inline-error.js';
|
|
9
|
-
import { useFullTextTooltip } from '../utils/useFullTextTooltip.js';
|
|
10
|
-
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
11
|
-
import styles from './content-field.module.js';
|
|
12
|
-
import { messages } from './messages.js';
|
|
13
|
-
|
|
14
|
-
const ContentIconContainer = ({
|
|
15
|
-
children
|
|
16
|
-
}) => jsx("div", {
|
|
17
|
-
className: styles.contentIconContainer,
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
const ContentIcon = ({
|
|
21
|
-
isSharedFolder,
|
|
22
|
-
itemIcon
|
|
23
|
-
}) => {
|
|
24
|
-
if (itemIcon) {
|
|
25
|
-
return itemIcon;
|
|
26
|
-
}
|
|
27
|
-
if (isSharedFolder) {
|
|
28
|
-
return jsx(FolderShared, {
|
|
29
|
-
"aria-label": messages.sharedFolderIconLabel,
|
|
30
|
-
className: styles.contentIconShared,
|
|
31
|
-
height: Space6,
|
|
32
|
-
width: Space6
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return jsx(ContentIconContainer, {
|
|
36
|
-
children: jsx(Folder, {
|
|
37
|
-
"aria-label": messages.folderIconLabel,
|
|
38
|
-
height: Space4,
|
|
39
|
-
width: Space4
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
const handleOnClickClearButton = ({
|
|
44
|
-
ref,
|
|
45
|
-
onClickClearButton
|
|
46
|
-
}) => e => {
|
|
47
|
-
ref.current?.focus();
|
|
48
|
-
onClickClearButton(e);
|
|
49
|
-
};
|
|
50
|
-
const contentFieldButtonTestId = 'ContentField-button';
|
|
51
|
-
/** @deprecated Use ContentField from @box/content-field package */
|
|
52
|
-
const ContentField = /*#__PURE__*/forwardRef(({
|
|
53
|
-
clearButtonAriaLabel,
|
|
54
|
-
itemIcon,
|
|
55
|
-
hintText,
|
|
56
|
-
isSharedFolder,
|
|
57
|
-
onClick,
|
|
58
|
-
onClickClearButton,
|
|
59
|
-
title,
|
|
60
|
-
error,
|
|
61
|
-
...rest
|
|
62
|
-
}, forwardedRef) => {
|
|
63
|
-
const labelRef = /*#__PURE__*/createRef();
|
|
64
|
-
const {
|
|
65
|
-
Wrapper: Tooltip,
|
|
66
|
-
wrapperProps
|
|
67
|
-
} = useFullTextTooltip({
|
|
68
|
-
ref: labelRef,
|
|
69
|
-
textValue: title ?? hintText
|
|
70
|
-
});
|
|
71
|
-
const inlineErrorId = useUniqueId('inline-error-');
|
|
72
|
-
return jsxs("div", {
|
|
73
|
-
className: styles.contentFieldWrapper,
|
|
74
|
-
children: [jsxs("div", {
|
|
75
|
-
className: styles.contentField,
|
|
76
|
-
children: [jsx(Tooltip, {
|
|
77
|
-
...wrapperProps,
|
|
78
|
-
children: jsxs(Button, {
|
|
79
|
-
ref: forwardedRef,
|
|
80
|
-
"aria-describedby": inlineErrorId,
|
|
81
|
-
className: clsx(styles.contentButton, {
|
|
82
|
-
[styles.hasSelection]: title,
|
|
83
|
-
[styles.error]: !!error
|
|
84
|
-
}),
|
|
85
|
-
"data-testid": contentFieldButtonTestId,
|
|
86
|
-
onClick: onClick,
|
|
87
|
-
type: "button",
|
|
88
|
-
...rest,
|
|
89
|
-
children: [jsx(ContentIcon, {
|
|
90
|
-
isSharedFolder: isSharedFolder,
|
|
91
|
-
itemIcon: itemIcon
|
|
92
|
-
}), jsx("div", {
|
|
93
|
-
className: styles.contentLabelWrapper,
|
|
94
|
-
children: jsx("div", {
|
|
95
|
-
ref: labelRef,
|
|
96
|
-
className: styles.contentLabel,
|
|
97
|
-
children: title ?? hintText
|
|
98
|
-
})
|
|
99
|
-
})]
|
|
100
|
-
})
|
|
101
|
-
}), title && jsx(Button, {
|
|
102
|
-
"aria-label": clearButtonAriaLabel ?? messages.clearContentFieldButtonLabel,
|
|
103
|
-
className: clsx(styles.clearButton, {
|
|
104
|
-
[styles.hasSelection]: title,
|
|
105
|
-
[styles.error]: !!error
|
|
106
|
-
}),
|
|
107
|
-
onClick: handleOnClickClearButton({
|
|
108
|
-
ref: labelRef,
|
|
109
|
-
onClickClearButton
|
|
110
|
-
}),
|
|
111
|
-
type: "button",
|
|
112
|
-
children: jsx(XMark, {
|
|
113
|
-
"aria-label": messages.clearContentFieldIconLabel,
|
|
114
|
-
height: Space6,
|
|
115
|
-
width: Space6
|
|
116
|
-
})
|
|
117
|
-
})]
|
|
118
|
-
}), jsx(InlineError, {
|
|
119
|
-
className: styles.inlineError,
|
|
120
|
-
id: inlineErrorId,
|
|
121
|
-
children: error
|
|
122
|
-
})]
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
export { ContentField, contentFieldButtonTestId };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import '../index.css';
|
|
2
|
-
var styles = {"contentFieldWrapper":"bp_content_field_module_contentFieldWrapper--67a59","contentField":"bp_content_field_module_contentField--67a59","inlineError":"bp_content_field_module_inlineError--67a59","contentButton":"bp_content_field_module_contentButton--67a59","error":"bp_content_field_module_error--67a59","hasSelection":"bp_content_field_module_hasSelection--67a59","contentIconContainer":"bp_content_field_module_contentIconContainer--67a59","contentIconShared":"bp_content_field_module_contentIconShared--67a59","contentLabelWrapper":"bp_content_field_module_contentLabelWrapper--67a59","contentLabel":"bp_content_field_module_contentLabel--67a59","clearButton":"bp_content_field_module_clearButton--67a59"};
|
|
3
|
-
|
|
4
|
-
export { styles as default };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type ReactElement } from 'react';
|
|
2
|
-
export interface ContentFieldProps {
|
|
3
|
-
/**
|
|
4
|
-
* custom aria label for the content field clear button.
|
|
5
|
-
*/
|
|
6
|
-
clearButtonAriaLabel?: string;
|
|
7
|
-
/**
|
|
8
|
-
* placeholder text for the content field.
|
|
9
|
-
*/
|
|
10
|
-
hintText: string;
|
|
11
|
-
/**
|
|
12
|
-
* type of the selected content(document, folder, etc.)
|
|
13
|
-
*/
|
|
14
|
-
itemIcon?: ReactElement;
|
|
15
|
-
/**
|
|
16
|
-
* whether or not the selected content is a shared folder.
|
|
17
|
-
*/
|
|
18
|
-
isSharedFolder?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* callback used by consumer to open content picker or equivalent.
|
|
21
|
-
*/
|
|
22
|
-
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
23
|
-
/**
|
|
24
|
-
* callback to clear selected content
|
|
25
|
-
*/
|
|
26
|
-
onClickClearButton: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
27
|
-
/**
|
|
28
|
-
* title of the selected content selected content
|
|
29
|
-
*/
|
|
30
|
-
title?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The content of the error message
|
|
33
|
-
*/
|
|
34
|
-
error?: React.ReactNode;
|
|
35
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useCallback, useEffect } from 'react';
|
|
3
|
-
import tabbable from 'tabbable';
|
|
4
|
-
|
|
5
|
-
// TODO(DISC-1141): write unit tests
|
|
6
|
-
const FocusTrap = ({
|
|
7
|
-
containerRef,
|
|
8
|
-
children,
|
|
9
|
-
customInitialFocus
|
|
10
|
-
}) => {
|
|
11
|
-
const previousFocusEl = useRef(null);
|
|
12
|
-
const getTabbableElements = useCallback(() => {
|
|
13
|
-
if (!containerRef.current) {
|
|
14
|
-
throw new Error('Could not initialize focus-trapping - container is missing');
|
|
15
|
-
}
|
|
16
|
-
const tabbableEls = tabbable(containerRef.current);
|
|
17
|
-
if (!tabbableEls.length) {
|
|
18
|
-
throw new Error('Could not initialize focus-trapping - focusable elements are missing');
|
|
19
|
-
}
|
|
20
|
-
return tabbableEls;
|
|
21
|
-
}, [containerRef]);
|
|
22
|
-
const focusFirstTabbableElement = useCallback(() => {
|
|
23
|
-
const tabbableEls = getTabbableElements();
|
|
24
|
-
tabbableEls[0].focus();
|
|
25
|
-
}, [getTabbableElements]);
|
|
26
|
-
const focusLastTabbableElement = useCallback(() => {
|
|
27
|
-
const tabbableEls = getTabbableElements();
|
|
28
|
-
tabbableEls[tabbableEls.length - 1].focus();
|
|
29
|
-
}, [getTabbableElements]);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
previousFocusEl.current = document.activeElement;
|
|
32
|
-
customInitialFocus ? customInitialFocus(getTabbableElements()) : focusFirstTabbableElement();
|
|
33
|
-
return () => {
|
|
34
|
-
if (previousFocusEl.current) {
|
|
35
|
-
previousFocusEl.current.focus();
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}, [customInitialFocus, focusFirstTabbableElement, getTabbableElements]);
|
|
39
|
-
return jsxs(Fragment, {
|
|
40
|
-
children: [jsx("i", {
|
|
41
|
-
"aria-hidden": true,
|
|
42
|
-
onFocus: focusLastTabbableElement,
|
|
43
|
-
tabIndex: 0
|
|
44
|
-
}), children, jsx("i", {
|
|
45
|
-
"aria-hidden": true,
|
|
46
|
-
onFocus: focusFirstTabbableElement,
|
|
47
|
-
tabIndex: 0
|
|
48
|
-
})]
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export { FocusTrap };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { FocusTrap } from './focus-trap';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type MutableRefObject } from 'react';
|
|
2
|
-
export interface FocusTrapProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/** Reference to the container element */
|
|
5
|
-
containerRef: MutableRefObject<HTMLDivElement | null>;
|
|
6
|
-
/** Function to set the focus to a desired element when the focus trap is activated */
|
|
7
|
-
customInitialFocus?: (tabbableEls: (HTMLElement | SVGElement)[]) => void;
|
|
8
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
-
import { isTabbable } from 'tabbable';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* React helper hook, which checks interactivity of Tooltip trigger
|
|
6
|
-
*/
|
|
7
|
-
const useIsTriggerInteractive = () => {
|
|
8
|
-
// We assert button type for compatibility with ref type of radix trigger
|
|
9
|
-
const triggerRef = useRef(null);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const triggerElement = triggerRef.current;
|
|
12
|
-
if (!triggerElement || !isTabbable(triggerElement)) {
|
|
13
|
-
const tagName = triggerElement?.tagName ? `<${triggerElement.tagName}>`.toLowerCase() : 'element';
|
|
14
|
-
/* eslint-disable-next-line no-console */
|
|
15
|
-
console.error(`${tagName} which acts as a tooltip trigger is not interactive. Make sure that trigger element is focusable, visible, and with a tabindex !== -1. More about tooltip accessibility in the Design System Portal.`);
|
|
16
|
-
}
|
|
17
|
-
}, []);
|
|
18
|
-
return triggerRef;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { useIsTriggerInteractive };
|