@fluentui-copilot/react-attachments 0.12.5-hotfix.1 → 0.12.5-hotfix.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/CHANGELOG.json +4 -4
- package/CHANGELOG.md +5 -5
- package/lib/AgentTag.js +1 -0
- package/lib/Attachment.js +1 -0
- package/lib/AttachmentList.js +1 -0
- package/lib/AttachmentOverflowMenu.js +1 -0
- package/lib/AttachmentOverflowMenuButton.js +1 -0
- package/lib/AttachmentOverflowMenuItem.js +1 -0
- package/lib/AttachmentTag.js +1 -0
- package/lib/AttachmentTagItem.js +1 -0
- package/lib/AttachmentTagList.js +1 -0
- package/lib/components/AgentTag/AgentTag.js +5 -4
- package/lib/components/AgentTag/AgentTag.types.js +2 -1
- package/lib/components/AgentTag/index.js +1 -0
- package/lib/components/AgentTag/renderAgentTag.js +5 -3
- package/lib/components/AgentTag/useAgentTag.js +9 -7
- package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js +57 -52
- package/lib/components/Attachment/Attachment.js +6 -5
- package/lib/components/Attachment/Attachment.types.js +2 -1
- package/lib/components/Attachment/index.js +1 -0
- package/lib/components/Attachment/renderAttachment.js +31 -36
- package/lib/components/Attachment/useAttachment.js +95 -85
- package/lib/components/Attachment/useAttachmentStyles.styles.raw.js +268 -258
- package/lib/components/AttachmentList/AttachmentList.js +7 -6
- package/lib/components/AttachmentList/AttachmentList.types.js +2 -1
- package/lib/components/AttachmentList/index.js +1 -0
- package/lib/components/AttachmentList/renderAttachmentList.js +25 -25
- package/lib/components/AttachmentList/useAttachmentList.js +124 -113
- package/lib/components/AttachmentList/useAttachmentListContextValues.js +15 -10
- package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js +36 -31
- package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js +9 -8
- package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.types.js +2 -1
- package/lib/components/AttachmentOverflowMenu/index.js +1 -0
- package/lib/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js +13 -8
- package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js +15 -9
- package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js +15 -10
- package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js +6 -5
- package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js +2 -1
- package/lib/components/AttachmentOverflowMenuButton/index.js +1 -0
- package/lib/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +10 -11
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +59 -51
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +89 -82
- package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js +5 -4
- package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.types.js +2 -1
- package/lib/components/AttachmentOverflowMenuItem/index.js +1 -0
- package/lib/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js +8 -9
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +49 -41
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +49 -43
- package/lib/components/AttachmentTag/AttachmentTag.js +7 -5
- package/lib/components/AttachmentTag/AttachmentTag.types.js +2 -1
- package/lib/components/AttachmentTag/index.js +1 -0
- package/lib/components/AttachmentTag/renderAttachmentTag.js +8 -10
- package/lib/components/AttachmentTag/useAttachmentTag.js +11 -9
- package/lib/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js +83 -76
- package/lib/components/AttachmentTagItem/AttachmentTagItem.js +6 -4
- package/lib/components/AttachmentTagItem/AttachmentTagItem.types.js +2 -1
- package/lib/components/AttachmentTagItem/index.js +1 -0
- package/lib/components/AttachmentTagItem/renderAttachmentTagItem.js +8 -10
- package/lib/components/AttachmentTagItem/useAttachmentTagItem.js +11 -9
- package/lib/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js +27 -23
- package/lib/components/AttachmentTagList/AttachmentTagList.js +8 -6
- package/lib/components/AttachmentTagList/AttachmentTagList.types.js +2 -1
- package/lib/components/AttachmentTagList/index.js +1 -0
- package/lib/components/AttachmentTagList/renderAttachmentTagList.js +9 -7
- package/lib/components/AttachmentTagList/useAttachmentTagList.js +25 -21
- package/lib/components/AttachmentTagList/useAttachmentTagListContextValues.js +11 -8
- package/lib/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js +15 -12
- package/lib/components/index.js +1 -0
- package/lib/components/utils/useAttachmentTagSlots.js +52 -45
- package/lib/components/utils/useProgressBarStyles.styles.raw.js +36 -34
- package/lib/contexts/attachmentListContext.js +5 -4
- package/lib/contexts/attachmentOverflowMenuContext.js +5 -4
- package/lib/contexts/attachmentTagListContext.js +3 -2
- package/lib/index.js +1 -0
- package/lib-commonjs/AgentTag.js +1 -0
- package/lib-commonjs/Attachment.js +1 -0
- package/lib-commonjs/AttachmentList.js +1 -0
- package/lib-commonjs/AttachmentOverflowMenu.js +1 -0
- package/lib-commonjs/AttachmentOverflowMenuButton.js +1 -0
- package/lib-commonjs/AttachmentOverflowMenuItem.js +1 -0
- package/lib-commonjs/AttachmentTag.js +1 -0
- package/lib-commonjs/AttachmentTagItem.js +1 -0
- package/lib-commonjs/AttachmentTagList.js +1 -0
- package/lib-commonjs/components/AgentTag/AgentTag.js +1 -1
- package/lib-commonjs/components/AgentTag/AgentTag.js.map +1 -1
- package/lib-commonjs/components/AgentTag/AgentTag.types.js +1 -0
- package/lib-commonjs/components/AgentTag/index.js +1 -0
- package/lib-commonjs/components/AgentTag/renderAgentTag.js +1 -1
- package/lib-commonjs/components/AgentTag/renderAgentTag.js.map +1 -1
- package/lib-commonjs/components/AgentTag/useAgentTag.js +1 -1
- package/lib-commonjs/components/AgentTag/useAgentTag.js.map +1 -1
- package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Attachment/Attachment.js +1 -1
- package/lib-commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib-commonjs/components/Attachment/Attachment.types.js +1 -0
- package/lib-commonjs/components/Attachment/index.js +1 -0
- package/lib-commonjs/components/Attachment/renderAttachment.js +1 -1
- package/lib-commonjs/components/Attachment/renderAttachment.js.map +1 -1
- package/lib-commonjs/components/Attachment/useAttachment.js +1 -1
- package/lib-commonjs/components/Attachment/useAttachment.js.map +1 -1
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentList/AttachmentList.js +1 -1
- package/lib-commonjs/components/AttachmentList/AttachmentList.js.map +1 -1
- package/lib-commonjs/components/AttachmentList/AttachmentList.types.js +1 -0
- package/lib-commonjs/components/AttachmentList/index.js +1 -0
- package/lib-commonjs/components/AttachmentList/renderAttachmentList.js +1 -1
- package/lib-commonjs/components/AttachmentList/renderAttachmentList.js.map +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentList.js +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentList.js.map +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js.map +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.types.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenu/index.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenuButton/index.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.types.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenuItem/index.js +1 -0
- package/lib-commonjs/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentTag/AttachmentTag.js +1 -1
- package/lib-commonjs/components/AttachmentTag/AttachmentTag.js.map +1 -1
- package/lib-commonjs/components/AttachmentTag/AttachmentTag.types.js +1 -0
- package/lib-commonjs/components/AttachmentTag/index.js +1 -0
- package/lib-commonjs/components/AttachmentTag/renderAttachmentTag.js +1 -1
- package/lib-commonjs/components/AttachmentTag/renderAttachmentTag.js.map +1 -1
- package/lib-commonjs/components/AttachmentTag/useAttachmentTag.js +1 -1
- package/lib-commonjs/components/AttachmentTag/useAttachmentTag.js.map +1 -1
- package/lib-commonjs/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.js +1 -1
- package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.types.js +1 -0
- package/lib-commonjs/components/AttachmentTagItem/index.js +1 -0
- package/lib-commonjs/components/AttachmentTagItem/renderAttachmentTagItem.js +1 -1
- package/lib-commonjs/components/AttachmentTagItem/renderAttachmentTagItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItem.js +1 -1
- package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItem.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.js +1 -1
- package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.types.js +1 -0
- package/lib-commonjs/components/AttachmentTagList/index.js +1 -0
- package/lib-commonjs/components/AttachmentTagList/renderAttachmentTagList.js +1 -1
- package/lib-commonjs/components/AttachmentTagList/renderAttachmentTagList.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagList.js +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagList.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListContextValues.js +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListContextValues.js.map +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/index.js +1 -0
- package/lib-commonjs/components/utils/useAttachmentTagSlots.js +1 -1
- package/lib-commonjs/components/utils/useAttachmentTagSlots.js.map +1 -1
- package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/contexts/attachmentListContext.js +1 -1
- package/lib-commonjs/contexts/attachmentListContext.js.map +1 -1
- package/lib-commonjs/contexts/attachmentOverflowMenuContext.js +1 -1
- package/lib-commonjs/contexts/attachmentOverflowMenuContext.js.map +1 -1
- package/lib-commonjs/contexts/attachmentTagListContext.js +1 -1
- package/lib-commonjs/contexts/attachmentTagListContext.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/package.json +4 -4
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { Overflow, assertSlots } from '@fluentui/react-components';
|
|
3
3
|
import { AttachmentListProvider } from '../../contexts/attachmentListContext';
|
|
4
4
|
import { AttachmentOverflowMenu } from '../AttachmentOverflowMenu';
|
|
5
5
|
/**
|
|
6
6
|
* Render the final JSX of AttachmentList
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
7
|
+
*/
|
|
8
|
+
export const renderAttachmentList_unstable = (state, contextValues) => {
|
|
9
|
+
assertSlots(state);
|
|
10
|
+
const {
|
|
11
|
+
overflowMenuProps,
|
|
12
|
+
root,
|
|
13
|
+
shouldUseOverflow
|
|
14
|
+
} = state;
|
|
15
|
+
return /*#__PURE__*/_jsx(AttachmentListProvider, {
|
|
16
|
+
value: contextValues.attachmentList,
|
|
17
|
+
children: shouldUseOverflow && state.overflowMenuButton && state.menuList && state.menuPopover ? /*#__PURE__*/_jsx(Overflow, {
|
|
18
|
+
ref: root.ref,
|
|
19
|
+
children: /*#__PURE__*/_jsxs(state.root, {
|
|
20
|
+
children: [root.children, /*#__PURE__*/_jsxs(AttachmentOverflowMenu, {
|
|
21
|
+
positioning: 'above',
|
|
22
|
+
...overflowMenuProps,
|
|
23
|
+
children: [/*#__PURE__*/_jsx(state.overflowMenuButton, {}), /*#__PURE__*/_jsx(state.menuPopover, {
|
|
24
|
+
children: /*#__PURE__*/_jsx(state.menuList, {})
|
|
25
|
+
})]
|
|
26
|
+
})]
|
|
27
|
+
})
|
|
28
|
+
}) : /*#__PURE__*/_jsx(state.root, {})
|
|
29
|
+
});
|
|
31
30
|
};
|
|
31
|
+
//# sourceMappingURL=renderAttachmentList.js.map
|
|
@@ -16,119 +16,130 @@ import { useDesignVersion } from '@fluentui-copilot/react-provider';
|
|
|
16
16
|
*
|
|
17
17
|
* @param props - props from this instance of AttachmentList
|
|
18
18
|
* @param ref - reference to root HTMLElement of AttachmentList
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
19
|
+
*/
|
|
20
|
+
export const useAttachmentList_unstable = (props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
maxVisibleAttachments,
|
|
24
|
+
onAttachmentDismiss,
|
|
25
|
+
overflowMenuProps
|
|
26
|
+
} = props;
|
|
27
|
+
const innerRef = React.useRef(null);
|
|
28
|
+
const [setTimeout] = useTimeout();
|
|
29
|
+
const {
|
|
30
|
+
targetDocument
|
|
31
|
+
} = useFluent();
|
|
32
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
33
|
+
const {
|
|
34
|
+
findNextFocusable,
|
|
35
|
+
findPrevFocusable,
|
|
36
|
+
findLastFocusable
|
|
37
|
+
} = useFocusFinders();
|
|
38
|
+
const handleAttachmentDismiss = useEventCallback((e, data) => {
|
|
39
|
+
var _innerRef_current;
|
|
40
|
+
if (!onAttachmentDismiss) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
onAttachmentDismiss(e, data);
|
|
44
|
+
// set focus after attachment dismiss
|
|
45
|
+
const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
|
|
46
|
+
if ((_innerRef_current = innerRef.current) === null || _innerRef_current === void 0 ? void 0 : _innerRef_current.contains(activeElement)) {
|
|
47
|
+
// focus on next attachment only if the active element is within the current attachment list
|
|
48
|
+
const next = findNextFocusable(activeElement, {
|
|
49
|
+
container: innerRef.current
|
|
50
|
+
});
|
|
51
|
+
if (next) {
|
|
52
|
+
// focus on the overflow button if the next focusable element is the overflow button.
|
|
53
|
+
// if overflow button is removed from the DOM, focus on the last focusable element in the attachment list.
|
|
54
|
+
if (next.classList.contains(attachmentOverflowMenuButtonClassNames.root)) {
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
var _findLastFocusable;
|
|
57
|
+
(_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
|
|
58
|
+
}, 0);
|
|
56
59
|
} else {
|
|
57
|
-
|
|
58
|
-
setTimeout(()=>{
|
|
59
|
-
var _findLastFocusable;
|
|
60
|
-
(_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
|
|
61
|
-
}, 0);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const styles = useOverflowStyles();
|
|
65
|
-
const resolvedChildren = useOverflowMaxVisibleItems({
|
|
66
|
-
children,
|
|
67
|
-
maxVisibleItems: maxVisibleAttachments,
|
|
68
|
-
overflowClassName: styles.overflow
|
|
69
|
-
});
|
|
70
|
-
const attachmentOverflowMenuItems = React.useMemo(()=>{
|
|
71
|
-
if (resolvedChildren && Array.isArray(resolvedChildren)) {
|
|
72
|
-
return resolvedChildren.filter((child)=>/*#__PURE__*/ React.isValidElement(child)).map((child)=>child.props).map((attachment)=>{
|
|
73
|
-
const dismissButton = slot.optional(attachment.dismissButton, {
|
|
74
|
-
elementType: 'button'
|
|
75
|
-
});
|
|
76
|
-
return /*#__PURE__*/ React.createElement(AttachmentOverflowMenuItem, {
|
|
77
|
-
...attachment,
|
|
78
|
-
key: attachment.id,
|
|
79
|
-
onClick: dismissButton === null || dismissButton === void 0 ? void 0 : dismissButton.onClick
|
|
80
|
-
});
|
|
81
|
-
});
|
|
60
|
+
next.focus();
|
|
82
61
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
62
|
+
} else {
|
|
63
|
+
const prev = findPrevFocusable(activeElement === null || activeElement === void 0 ? void 0 : activeElement.parentElement, {
|
|
64
|
+
container: innerRef.current
|
|
65
|
+
});
|
|
66
|
+
prev === null || prev === void 0 ? void 0 : prev.focus();
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
// Handles keyboard focus when attachment removed is in the overflow menu. Also handles focus when the overflow button is removed from the DOM.
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
var _findLastFocusable;
|
|
72
|
+
(_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
|
|
73
|
+
}, 0);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const styles = useOverflowStyles();
|
|
77
|
+
const resolvedChildren = useOverflowMaxVisibleItems({
|
|
78
|
+
children,
|
|
79
|
+
maxVisibleItems: maxVisibleAttachments,
|
|
80
|
+
overflowClassName: styles.overflow
|
|
81
|
+
});
|
|
82
|
+
const attachmentOverflowMenuItems = React.useMemo(() => {
|
|
83
|
+
if (resolvedChildren && Array.isArray(resolvedChildren)) {
|
|
84
|
+
return resolvedChildren.filter(child => /*#__PURE__*/React.isValidElement(child)).map(child => child.props).map(attachment => {
|
|
85
|
+
const dismissButton = slot.optional(attachment.dismissButton, {
|
|
86
|
+
elementType: 'button'
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/React.createElement(AttachmentOverflowMenuItem, {
|
|
89
|
+
...attachment,
|
|
90
|
+
key: attachment.id,
|
|
91
|
+
onClick: dismissButton === null || dismissButton === void 0 ? void 0 : dismissButton.onClick
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return [];
|
|
96
|
+
}, [resolvedChildren]);
|
|
97
|
+
const arrowNavigationProps = useArrowNavigationGroup({
|
|
98
|
+
circular: true,
|
|
99
|
+
axis: 'both',
|
|
100
|
+
memorizeCurrent: true
|
|
101
|
+
});
|
|
102
|
+
const shouldUseOverflow = maxVisibleAttachments !== undefined;
|
|
103
|
+
return {
|
|
104
|
+
designVersion,
|
|
105
|
+
onAttachmentDismiss: handleAttachmentDismiss,
|
|
106
|
+
shouldUseOverflow,
|
|
107
|
+
numberOfAttachments: resolvedChildren.length,
|
|
108
|
+
overflowMenuProps,
|
|
109
|
+
components: {
|
|
110
|
+
root: 'div',
|
|
111
|
+
menuList: MenuList,
|
|
112
|
+
menuPopover: MenuPopover,
|
|
113
|
+
overflowMenuButton: 'span'
|
|
114
|
+
},
|
|
115
|
+
root: slot.always(getIntrinsicElementProps('div', {
|
|
116
|
+
'aria-label': 'Attachments',
|
|
117
|
+
ref: useMergedRefs(ref, innerRef),
|
|
118
|
+
role: 'toolbar',
|
|
119
|
+
...arrowNavigationProps,
|
|
120
|
+
...props,
|
|
121
|
+
children: resolvedChildren
|
|
122
|
+
}), {
|
|
123
|
+
elementType: 'div'
|
|
124
|
+
}),
|
|
125
|
+
menuList: slot.optional(props.menuList, {
|
|
126
|
+
defaultProps: {
|
|
127
|
+
children: attachmentOverflowMenuItems
|
|
128
|
+
},
|
|
129
|
+
elementType: MenuList,
|
|
130
|
+
renderByDefault: true
|
|
131
|
+
}),
|
|
132
|
+
menuPopover: slot.optional(props.menuPopover, {
|
|
133
|
+
elementType: MenuPopover,
|
|
134
|
+
renderByDefault: true
|
|
135
|
+
}),
|
|
136
|
+
overflowMenuButton: slot.optional(props.overflowMenuButton, {
|
|
137
|
+
defaultProps: {
|
|
138
|
+
children: /*#__PURE__*/React.createElement(AttachmentOverflowMenuButton, null)
|
|
139
|
+
},
|
|
140
|
+
elementType: 'span',
|
|
141
|
+
renderByDefault: true
|
|
142
|
+
})
|
|
143
|
+
};
|
|
134
144
|
};
|
|
145
|
+
//# sourceMappingURL=useAttachmentList.js.map
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export function useAttachmentListContextValues_unstable(state) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
const {
|
|
3
|
+
numberOfAttachments,
|
|
4
|
+
onAttachmentDismiss,
|
|
5
|
+
shouldUseOverflow
|
|
6
|
+
} = state;
|
|
7
|
+
// This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
|
|
8
|
+
const attachmentList = {
|
|
9
|
+
numberOfAttachments,
|
|
10
|
+
onAttachmentDismiss,
|
|
11
|
+
shouldUseOverflow
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
attachmentList
|
|
15
|
+
};
|
|
12
16
|
}
|
|
17
|
+
//# sourceMappingURL=useAttachmentListContextValues.js.map
|
|
@@ -1,44 +1,49 @@
|
|
|
1
1
|
import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
2
|
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
3
|
export const attachmentListClassNames = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
root: 'fai-AttachmentList',
|
|
5
|
+
menuList: 'fai-AttachmentList__menuList',
|
|
6
|
+
menuPopover: 'fai-AttachmentList__menuPopover',
|
|
7
|
+
overflowMenuButton: 'fai-AttachmentList__overflowMenuButton'
|
|
8
8
|
};
|
|
9
9
|
const useRootBaseClassName = makeResetStyles({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
columnGap: tokens.spacingHorizontalSNudge,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
flexShrink: 0,
|
|
14
|
+
flexWrap: 'wrap',
|
|
15
|
+
rowGap: tokens.spacingVerticalXS
|
|
16
16
|
});
|
|
17
17
|
const useOverflowMenuButtonBaseClassName = makeResetStyles({
|
|
18
|
-
|
|
18
|
+
display: 'inline-flex'
|
|
19
19
|
});
|
|
20
20
|
const useOverflowMenuPopoverNextStyles = makeStyles({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
borderRadius: {
|
|
22
|
+
borderRadius: tokens.borderRadius4XL
|
|
23
|
+
}
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
26
26
|
* Apply styling to the AttachmentList slots based on the state
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
*/
|
|
28
|
+
export const useAttachmentListStyles_unstable = state => {
|
|
29
|
+
'use no memo';
|
|
30
|
+
|
|
31
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
32
|
+
const overflowMenuButtonClassName = useOverflowMenuButtonBaseClassName();
|
|
33
|
+
const overflowMenuPopoverNextStyles = useOverflowMenuPopoverNextStyles();
|
|
34
|
+
const {
|
|
35
|
+
designVersion
|
|
36
|
+
} = state;
|
|
37
|
+
state.root.className = mergeClasses(attachmentListClassNames.root, rootBaseClassName, state.root.className);
|
|
38
|
+
if (state.menuList) {
|
|
39
|
+
state.menuList.className = mergeClasses(attachmentListClassNames.menuList, state.menuList.className);
|
|
40
|
+
}
|
|
41
|
+
if (state.menuPopover) {
|
|
42
|
+
state.menuPopover.className = mergeClasses(attachmentListClassNames.menuPopover, designVersion === 'next' && overflowMenuPopoverNextStyles.borderRadius, state.menuPopover.className);
|
|
43
|
+
}
|
|
44
|
+
if (state.overflowMenuButton) {
|
|
45
|
+
state.overflowMenuButton.className = mergeClasses(attachmentListClassNames.overflowMenuButton, overflowMenuButtonClassName, state.overflowMenuButton.className);
|
|
46
|
+
}
|
|
47
|
+
return state;
|
|
44
48
|
};
|
|
49
|
+
//# sourceMappingURL=useAttachmentListStyles.styles.raw.js.map
|
|
@@ -2,13 +2,14 @@ import { useAttachmentOverflowMenu_unstable } from './useAttachmentOverflowMenu'
|
|
|
2
2
|
import { renderAttachmentOverflowMenu_unstable } from './renderAttachmentOverflowMenu';
|
|
3
3
|
import { useAttachmentOverflowMenuContextValues_unstable } from './useAttachmentOverflowMenuContextValues';
|
|
4
4
|
import { useMenuContextValues_unstable } from '@fluentui/react-components';
|
|
5
|
-
export const AttachmentOverflowMenu =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
export const AttachmentOverflowMenu = props => {
|
|
6
|
+
const state = useAttachmentOverflowMenu_unstable(props);
|
|
7
|
+
const menuContextValues = useMenuContextValues_unstable(state);
|
|
8
|
+
const attachmentOverflowMenuContextValues = useAttachmentOverflowMenuContextValues_unstable(state);
|
|
9
|
+
return renderAttachmentOverflowMenu_unstable(state, {
|
|
10
|
+
menuContextValues,
|
|
11
|
+
attachmentOverflowMenuContextValues
|
|
12
|
+
});
|
|
13
13
|
};
|
|
14
14
|
AttachmentOverflowMenu.displayName = 'AttachmentOverflowMenu';
|
|
15
|
+
//# sourceMappingURL=AttachmentOverflowMenu.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=AttachmentOverflowMenu.types.js.map
|
|
@@ -2,3 +2,4 @@ export { AttachmentOverflowMenu } from './AttachmentOverflowMenu';
|
|
|
2
2
|
export { renderAttachmentOverflowMenu_unstable } from './renderAttachmentOverflowMenu';
|
|
3
3
|
export { useAttachmentOverflowMenu_unstable } from './useAttachmentOverflowMenu';
|
|
4
4
|
export { useAttachmentOverflowMenuContextValues_unstable } from './useAttachmentOverflowMenuContextValues';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots, renderMenu_unstable } from '@fluentui/react-components';
|
|
3
3
|
import { AttachmentOverflowMenuProvider } from '../../contexts/attachmentOverflowMenuContext';
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of AttachmentOverflowMenu
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
*/
|
|
7
|
+
export const renderAttachmentOverflowMenu_unstable = (state, contextValues) => {
|
|
8
|
+
const {
|
|
9
|
+
menuContextValues,
|
|
10
|
+
attachmentOverflowMenuContextValues
|
|
11
|
+
} = contextValues;
|
|
12
|
+
assertSlots(state);
|
|
13
|
+
return state.isOverflowing ? /*#__PURE__*/_jsx(AttachmentOverflowMenuProvider, {
|
|
14
|
+
value: attachmentOverflowMenuContextValues.attachmentOverflowMenu,
|
|
15
|
+
children: renderMenu_unstable(state, menuContextValues)
|
|
16
|
+
}) : null;
|
|
13
17
|
};
|
|
18
|
+
//# sourceMappingURL=renderAttachmentOverflowMenu.js.map
|
|
@@ -6,13 +6,19 @@ import { useMenu_unstable, useOverflowMenu } from '@fluentui/react-components';
|
|
|
6
6
|
* before being passed to renderAttachmentOverflowMenu_unstable.
|
|
7
7
|
*
|
|
8
8
|
* @param props - props from this instance of AttachmentOverflowMenu
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
*/
|
|
10
|
+
export const useAttachmentOverflowMenu_unstable = props => {
|
|
11
|
+
const menuState = useMenu_unstable(props);
|
|
12
|
+
const {
|
|
13
|
+
isOverflowing,
|
|
14
|
+
ref: overflowButtonRef,
|
|
15
|
+
overflowCount
|
|
16
|
+
} = useOverflowMenu();
|
|
17
|
+
return {
|
|
18
|
+
...menuState,
|
|
19
|
+
isOverflowing,
|
|
20
|
+
overflowButtonRef,
|
|
21
|
+
overflowCount
|
|
22
|
+
};
|
|
18
23
|
};
|
|
24
|
+
//# sourceMappingURL=useAttachmentOverflowMenu.js.map
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export function useAttachmentOverflowMenuContextValues_unstable(state) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
const {
|
|
3
|
+
isOverflowing,
|
|
4
|
+
overflowButtonRef,
|
|
5
|
+
overflowCount
|
|
6
|
+
} = state;
|
|
7
|
+
// This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
|
|
8
|
+
const attachmentOverflowMenu = {
|
|
9
|
+
isOverflowing,
|
|
10
|
+
overflowButtonRef,
|
|
11
|
+
overflowCount
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
attachmentOverflowMenu
|
|
15
|
+
};
|
|
12
16
|
}
|
|
17
|
+
//# sourceMappingURL=useAttachmentOverflowMenuContextValues.js.map
|
|
@@ -3,10 +3,11 @@ import { useAttachmentOverflowMenuButton_unstable } from './useAttachmentOverflo
|
|
|
3
3
|
import { renderAttachmentOverflowMenuButton_unstable } from './renderAttachmentOverflowMenuButton';
|
|
4
4
|
import { useAttachmentOverflowMenuButtonStyles_unstable } from './useAttachmentOverflowMenuButtonStyles.styles';
|
|
5
5
|
import { useCustomStyleHook } from '@fluentui-copilot/react-provider';
|
|
6
|
-
export const AttachmentOverflowMenuButton = /*#__PURE__*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export const AttachmentOverflowMenuButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
7
|
+
const state = useAttachmentOverflowMenuButton_unstable(props, ref);
|
|
8
|
+
useAttachmentOverflowMenuButtonStyles_unstable(state);
|
|
9
|
+
useCustomStyleHook('useAttachmentOverflowMenuButtonStyles')(state);
|
|
10
|
+
return renderAttachmentOverflowMenuButton_unstable(state);
|
|
11
11
|
});
|
|
12
12
|
AttachmentOverflowMenuButton.displayName = 'AttachmentOverflowMenuButton';
|
|
13
|
+
//# sourceMappingURL=AttachmentOverflowMenuButton.js.map
|
|
@@ -2,3 +2,4 @@ export { AttachmentOverflowMenuButton } from './AttachmentOverflowMenuButton';
|
|
|
2
2
|
export { renderAttachmentOverflowMenuButton_unstable } from './renderAttachmentOverflowMenuButton';
|
|
3
3
|
export { useAttachmentOverflowMenuButton_unstable } from './useAttachmentOverflowMenuButton';
|
|
4
4
|
export { attachmentOverflowMenuButtonClassNames, useAttachmentOverflowMenuButtonStyles_unstable } from './useAttachmentOverflowMenuButtonStyles.styles';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { MenuTrigger, assertSlots } from '@fluentui/react-components';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of AttachmentOverflowMenuButton
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
}) : null;
|
|
5
|
+
*/
|
|
6
|
+
export const renderAttachmentOverflowMenuButton_unstable = state => {
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return state.isOverflowing ? /*#__PURE__*/_jsx(MenuTrigger, {
|
|
9
|
+
children: /*#__PURE__*/_jsxs(state.root, {
|
|
10
|
+
children: [state.root.children, state.isLoading && /*#__PURE__*/_jsx(state.progress, {})]
|
|
11
|
+
})
|
|
12
|
+
}) : null;
|
|
15
13
|
};
|
|
14
|
+
//# sourceMappingURL=renderAttachmentOverflowMenuButton.js.map
|