@fluentui-copilot/react-attachments 0.0.0-nightly-20250708-1433-52f2b6b1.1 → 0.0.0-nightly-20250709-0404-150e065c.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/CHANGELOG.json +3 -3
- package/CHANGELOG.md +4 -4
- 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/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/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/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/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/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/index.js +1 -0
- package/lib/contexts/attachmentListContext.js +5 -4
- package/lib/contexts/attachmentOverflowMenuContext.js +5 -4
- 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/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/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/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/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/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/index.js +1 -0
- 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/index.js +1 -0
- package/package.json +4 -4
- package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js +0 -66
- package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js.map +0 -1
- package/lib/components/Attachment/useAttachmentStyles.styles.raw.js +0 -317
- package/lib/components/Attachment/useAttachmentStyles.styles.raw.js.map +0 -1
- package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js +0 -44
- package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +0 -1
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +0 -102
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +0 -1
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +0 -57
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +0 -1
- package/lib/components/utils/useProgressBarStyles.styles.raw.js +0 -42
- package/lib/components/utils/useProgressBarStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js +0 -82
- package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js +0 -336
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js +0 -60
- package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +0 -118
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +0 -73
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js +0 -50
- package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js.map +0 -1
|
@@ -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
|
|
@@ -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
|
|
@@ -12,58 +12,66 @@ import { useAttachmentListContext_unstable } from '../../contexts/attachmentList
|
|
|
12
12
|
*
|
|
13
13
|
* @param props - props from this instance of AttachmentOverflowMenuButton
|
|
14
14
|
* @param ref - reference to root HTMLElement of AttachmentOverflowMenuButton
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
15
|
+
*/
|
|
16
|
+
export const useAttachmentOverflowMenuButton_unstable = (props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
isOverflowing,
|
|
19
|
+
overflowCount,
|
|
20
|
+
overflowButtonRef
|
|
21
|
+
} = useAttachmentOverflowMenuContext_unstable(context => context);
|
|
22
|
+
const {
|
|
23
|
+
numberOfAttachments
|
|
24
|
+
} = useAttachmentListContext_unstable(context => context);
|
|
25
|
+
const fullyOverflowed = overflowCount >= numberOfAttachments;
|
|
26
|
+
const isLoading = !!props.isLoading;
|
|
27
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
28
|
+
const mode = useCopilotMode(props.mode);
|
|
29
|
+
const buttonText = defaultButtonText(props, overflowCount, designVersion, mode, fullyOverflowed);
|
|
30
|
+
return {
|
|
31
|
+
components: {
|
|
32
|
+
root: 'button',
|
|
33
|
+
progress: ProgressBar
|
|
34
|
+
},
|
|
35
|
+
root: slot.always(getIntrinsicElementProps('button', {
|
|
36
|
+
ref: useMergedRefs(ref, overflowButtonRef),
|
|
37
|
+
...props
|
|
38
|
+
}), {
|
|
39
|
+
defaultProps: {
|
|
40
|
+
children: buttonText
|
|
41
|
+
},
|
|
42
|
+
elementType: 'button'
|
|
43
|
+
}),
|
|
44
|
+
progress: slot.always(props.progress, {
|
|
45
|
+
defaultProps: {
|
|
46
|
+
value: undefined,
|
|
47
|
+
shape: 'square',
|
|
48
|
+
thickness: 'large',
|
|
49
|
+
'aria-label': 'Loading'
|
|
50
|
+
},
|
|
51
|
+
elementType: ProgressBar
|
|
52
|
+
}),
|
|
53
|
+
fullyOverflowed,
|
|
54
|
+
isOverflowing,
|
|
55
|
+
overflowCount,
|
|
56
|
+
isLoading,
|
|
57
|
+
designVersion,
|
|
58
|
+
mode
|
|
59
|
+
};
|
|
53
60
|
};
|
|
54
61
|
function defaultButtonText(props, overflowCount, designVersion, copilotMode, fullyOverflowed) {
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
if (props.children) {
|
|
63
|
+
return props.children;
|
|
64
|
+
}
|
|
65
|
+
if (props.text) {
|
|
66
|
+
if (typeof props.text === 'function') {
|
|
67
|
+
return props.text(overflowCount);
|
|
68
|
+
} else {
|
|
69
|
+
return props.text;
|
|
57
70
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (designVersion === 'next' && fullyOverflowed) {
|
|
66
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, copilotMode === 'canvas' ? /*#__PURE__*/ React.createElement(Attach24Regular, null) : /*#__PURE__*/ React.createElement(Attach20Regular, null), overflowCount);
|
|
67
|
-
}
|
|
68
|
-
return `+${overflowCount}`;
|
|
71
|
+
}
|
|
72
|
+
if (designVersion === 'next' && fullyOverflowed) {
|
|
73
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, copilotMode === 'canvas' ? /*#__PURE__*/React.createElement(Attach24Regular, null) : /*#__PURE__*/React.createElement(Attach20Regular, null), overflowCount);
|
|
74
|
+
}
|
|
75
|
+
return `+${overflowCount}`;
|
|
69
76
|
}
|
|
77
|
+
//# sourceMappingURL=useAttachmentOverflowMenuButton.js.map
|
|
@@ -2,9 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { useAttachmentOverflowMenuItem_unstable } from './useAttachmentOverflowMenuItem';
|
|
3
3
|
import { renderAttachmentOverflowMenuItem_unstable } from './renderAttachmentOverflowMenuItem';
|
|
4
4
|
import { useAttachmentOverflowMenuItemStyles_unstable } from './useAttachmentOverflowMenuItemStyles.styles';
|
|
5
|
-
export const AttachmentOverflowMenuItem = /*#__PURE__*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const AttachmentOverflowMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useAttachmentOverflowMenuItem_unstable(props, ref);
|
|
7
|
+
useAttachmentOverflowMenuItemStyles_unstable(state);
|
|
8
|
+
return renderAttachmentOverflowMenuItem_unstable(state);
|
|
9
9
|
});
|
|
10
10
|
AttachmentOverflowMenuItem.displayName = 'AttachmentOverflowMenuItem';
|
|
11
|
+
//# sourceMappingURL=AttachmentOverflowMenuItem.js.map
|
|
@@ -2,3 +2,4 @@ export { AttachmentOverflowMenuItem } from './AttachmentOverflowMenuItem';
|
|
|
2
2
|
export { renderAttachmentOverflowMenuItem_unstable } from './renderAttachmentOverflowMenuItem';
|
|
3
3
|
export { useAttachmentOverflowMenuItem_unstable } from './useAttachmentOverflowMenuItem';
|
|
4
4
|
export { attachmentOverflowMenuItemClassNames, useAttachmentOverflowMenuItemStyles_unstable } from './useAttachmentOverflowMenuItemStyles.styles';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots } from '@fluentui/react-components';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of AttachmentOverflowMenuItem
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
]
|
|
12
|
-
}) : null;
|
|
5
|
+
*/
|
|
6
|
+
export const renderAttachmentOverflowMenuItem_unstable = state => {
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return !state.isVisible ? /*#__PURE__*/_jsxs(state.root, {
|
|
9
|
+
children: [state.root.children, state.progress && /*#__PURE__*/_jsx(state.progress, {})]
|
|
10
|
+
}) : null;
|
|
13
11
|
};
|
|
12
|
+
//# sourceMappingURL=renderAttachmentOverflowMenuItem.js.map
|