@fluentui-copilot/react-attachments 0.12.4 → 0.12.5-hotfix.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 +46 -1
- package/CHANGELOG.md +20 -2
- package/lib/AgentTag.js +0 -1
- package/lib/Attachment.js +0 -1
- package/lib/AttachmentList.js +0 -1
- package/lib/AttachmentOverflowMenu.js +0 -1
- package/lib/AttachmentOverflowMenuButton.js +0 -1
- package/lib/AttachmentOverflowMenuItem.js +0 -1
- package/lib/AttachmentTag.js +0 -1
- package/lib/AttachmentTagItem.js +0 -1
- package/lib/AttachmentTagList.js +0 -1
- package/lib/components/AgentTag/AgentTag.js +4 -5
- package/lib/components/AgentTag/AgentTag.types.js +1 -2
- package/lib/components/AgentTag/index.js +0 -1
- package/lib/components/AgentTag/renderAgentTag.js +3 -5
- package/lib/components/AgentTag/useAgentTag.js +7 -9
- package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js +66 -0
- package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js.map +1 -0
- package/lib/components/Attachment/Attachment.js +5 -6
- package/lib/components/Attachment/Attachment.types.js +1 -2
- package/lib/components/Attachment/index.js +0 -1
- package/lib/components/Attachment/renderAttachment.js +36 -31
- package/lib/components/Attachment/useAttachment.js +85 -95
- package/lib/components/Attachment/useAttachmentStyles.styles.js +34 -12
- package/lib/components/Attachment/useAttachmentStyles.styles.js.map +1 -1
- package/lib/components/Attachment/useAttachmentStyles.styles.raw.js +317 -0
- package/lib/components/Attachment/useAttachmentStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentList/AttachmentList.js +6 -7
- package/lib/components/AttachmentList/AttachmentList.types.js +1 -2
- package/lib/components/AttachmentList/index.js +0 -1
- package/lib/components/AttachmentList/renderAttachmentList.js +25 -25
- package/lib/components/AttachmentList/useAttachmentList.js +113 -124
- package/lib/components/AttachmentList/useAttachmentListContextValues.js +10 -15
- package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js +44 -0
- package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js +8 -9
- package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.types.js +1 -2
- package/lib/components/AttachmentOverflowMenu/index.js +0 -1
- package/lib/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js +8 -13
- package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js +9 -15
- package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js +10 -15
- package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js +5 -6
- package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js +1 -2
- package/lib/components/AttachmentOverflowMenuButton/index.js +0 -1
- package/lib/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +11 -10
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +51 -59
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +102 -0
- package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js +4 -5
- package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.types.js +1 -2
- package/lib/components/AttachmentOverflowMenuItem/index.js +0 -1
- package/lib/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js +9 -8
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +41 -49
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +57 -0
- package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentTag/AttachmentTag.js +5 -7
- package/lib/components/AttachmentTag/AttachmentTag.types.js +1 -2
- package/lib/components/AttachmentTag/index.js +0 -1
- package/lib/components/AttachmentTag/renderAttachmentTag.js +10 -8
- package/lib/components/AttachmentTag/useAttachmentTag.js +9 -11
- package/lib/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js +98 -0
- package/lib/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentTagItem/AttachmentTagItem.js +4 -6
- package/lib/components/AttachmentTagItem/AttachmentTagItem.types.js +1 -2
- package/lib/components/AttachmentTagItem/index.js +0 -1
- package/lib/components/AttachmentTagItem/renderAttachmentTagItem.js +10 -8
- package/lib/components/AttachmentTagItem/useAttachmentTagItem.js +9 -11
- package/lib/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js +34 -0
- package/lib/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js.map +1 -0
- package/lib/components/AttachmentTagList/AttachmentTagList.js +6 -8
- package/lib/components/AttachmentTagList/AttachmentTagList.types.js +1 -2
- package/lib/components/AttachmentTagList/index.js +0 -1
- package/lib/components/AttachmentTagList/renderAttachmentTagList.js +7 -9
- package/lib/components/AttachmentTagList/useAttachmentTagList.js +21 -25
- package/lib/components/AttachmentTagList/useAttachmentTagListContextValues.js +8 -11
- package/lib/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js +21 -0
- package/lib/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js.map +1 -0
- package/lib/components/index.js +0 -1
- package/lib/components/utils/useAttachmentTagSlots.js +45 -52
- package/lib/components/utils/useProgressBarStyles.styles.raw.js +42 -0
- package/lib/components/utils/useProgressBarStyles.styles.raw.js.map +1 -0
- package/lib/contexts/attachmentListContext.js +4 -5
- package/lib/contexts/attachmentOverflowMenuContext.js +4 -5
- package/lib/contexts/attachmentTagListContext.js +2 -3
- package/lib/index.js +0 -1
- package/lib-commonjs/AgentTag.js +0 -1
- package/lib-commonjs/Attachment.js +0 -1
- package/lib-commonjs/AttachmentList.js +0 -1
- package/lib-commonjs/AttachmentOverflowMenu.js +0 -1
- package/lib-commonjs/AttachmentOverflowMenuButton.js +0 -1
- package/lib-commonjs/AttachmentOverflowMenuItem.js +0 -1
- package/lib-commonjs/AttachmentTag.js +0 -1
- package/lib-commonjs/AttachmentTagItem.js +0 -1
- package/lib-commonjs/AttachmentTagList.js +0 -1
- 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 +0 -1
- package/lib-commonjs/components/AgentTag/index.js +0 -1
- 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 +82 -0
- package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/Attachment/index.js +0 -1
- 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.js +52 -26
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js +336 -0
- package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentList/index.js +0 -1
- 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 +60 -0
- package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentOverflowMenu/index.js +0 -1
- 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 +0 -1
- package/lib-commonjs/components/AttachmentOverflowMenuButton/index.js +0 -1
- 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 +118 -0
- package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentOverflowMenuItem/index.js +0 -1
- 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 +73 -0
- package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentTag/index.js +0 -1
- 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 +118 -0
- package/lib-commonjs/components/AttachmentTag/useAttachmentTagStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentTagItem/index.js +0 -1
- 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 +50 -0
- package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.raw.js.map +1 -0
- 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 +0 -1
- package/lib-commonjs/components/AttachmentTagList/index.js +0 -1
- 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 +37 -0
- package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/index.js +0 -1
- 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 +50 -0
- package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js.map +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/contexts/attachmentTagListContext.js +1 -1
- package/lib-commonjs/contexts/attachmentTagListContext.js.map +1 -1
- package/lib-commonjs/index.js +0 -1
- package/package.json +5 -9
|
@@ -12,66 +12,58 @@ 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
|
-
}
|
|
53
|
-
fullyOverflowed,
|
|
54
|
-
isOverflowing,
|
|
55
|
-
overflowCount,
|
|
56
|
-
isLoading,
|
|
57
|
-
designVersion,
|
|
58
|
-
mode
|
|
59
|
-
};
|
|
15
|
+
*/ export const useAttachmentOverflowMenuButton_unstable = (props, ref)=>{
|
|
16
|
+
const { isOverflowing, overflowCount, overflowButtonRef } = useAttachmentOverflowMenuContext_unstable((context)=>context);
|
|
17
|
+
const { numberOfAttachments } = useAttachmentListContext_unstable((context)=>context);
|
|
18
|
+
const fullyOverflowed = overflowCount >= numberOfAttachments;
|
|
19
|
+
const isLoading = !!props.isLoading;
|
|
20
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
21
|
+
const mode = useCopilotMode(props.mode);
|
|
22
|
+
const buttonText = defaultButtonText(props, overflowCount, designVersion, mode, fullyOverflowed);
|
|
23
|
+
return {
|
|
24
|
+
components: {
|
|
25
|
+
root: 'button',
|
|
26
|
+
progress: ProgressBar
|
|
27
|
+
},
|
|
28
|
+
root: slot.always(getIntrinsicElementProps('button', {
|
|
29
|
+
ref: useMergedRefs(ref, overflowButtonRef),
|
|
30
|
+
...props
|
|
31
|
+
}), {
|
|
32
|
+
defaultProps: {
|
|
33
|
+
children: buttonText
|
|
34
|
+
},
|
|
35
|
+
elementType: 'button'
|
|
36
|
+
}),
|
|
37
|
+
progress: slot.always(props.progress, {
|
|
38
|
+
defaultProps: {
|
|
39
|
+
value: undefined,
|
|
40
|
+
shape: 'square',
|
|
41
|
+
thickness: 'large',
|
|
42
|
+
'aria-label': 'Loading'
|
|
43
|
+
},
|
|
44
|
+
elementType: ProgressBar
|
|
45
|
+
}),
|
|
46
|
+
fullyOverflowed,
|
|
47
|
+
isOverflowing,
|
|
48
|
+
overflowCount,
|
|
49
|
+
isLoading,
|
|
50
|
+
designVersion,
|
|
51
|
+
mode
|
|
52
|
+
};
|
|
60
53
|
};
|
|
61
54
|
function defaultButtonText(props, overflowCount, designVersion, copilotMode, fullyOverflowed) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
if (props.text) {
|
|
66
|
-
if (typeof props.text === 'function') {
|
|
67
|
-
return props.text(overflowCount);
|
|
68
|
-
} else {
|
|
69
|
-
return props.text;
|
|
55
|
+
if (props.children) {
|
|
56
|
+
return props.children;
|
|
70
57
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
if (props.text) {
|
|
59
|
+
if (typeof props.text === 'function') {
|
|
60
|
+
return props.text(overflowCount);
|
|
61
|
+
} else {
|
|
62
|
+
return props.text;
|
|
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}`;
|
|
76
69
|
}
|
|
77
|
-
//# sourceMappingURL=useAttachmentOverflowMenuButton.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses, shorthands, slot } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
import { useProgressBarStyles } from '../utils/useProgressBarStyles.styles';
|
|
4
|
+
export const attachmentOverflowMenuButtonClassNames = {
|
|
5
|
+
root: 'fai-AttachmentOverflowMenuButton',
|
|
6
|
+
progress: 'fai-AttachmentOverflowMenuButton__progress'
|
|
7
|
+
};
|
|
8
|
+
const useRootBaseClassName = makeResetStyles({
|
|
9
|
+
color: tokens.colorNeutralForeground1,
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
backgroundColor: tokens.colorSubtleBackground,
|
|
12
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
|
|
13
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
columnGap: tokens.spacingHorizontalSNudge,
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
display: 'inline-flex',
|
|
18
|
+
flexWrap: 'nowrap',
|
|
19
|
+
fontFamily: typographyStyles.body1.fontFamily,
|
|
20
|
+
fontSize: typographyStyles.body1.fontSize,
|
|
21
|
+
fontWeight: typographyStyles.body1.fontWeight,
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS}`,
|
|
24
|
+
verticalAlign: 'middle',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
':hover': {
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
backgroundColor: tokens.colorSubtleBackgroundHover,
|
|
29
|
+
color: tokens.colorNeutralForeground2Hover
|
|
30
|
+
},
|
|
31
|
+
':active': {
|
|
32
|
+
backgroundColor: tokens.colorSubtleBackgroundPressed,
|
|
33
|
+
color: tokens.colorNeutralForeground2Pressed
|
|
34
|
+
},
|
|
35
|
+
'@media (forced-colors: active)': {
|
|
36
|
+
':hover': {
|
|
37
|
+
backgroundColor: 'HighlightText'
|
|
38
|
+
},
|
|
39
|
+
':active': {
|
|
40
|
+
backgroundColor: 'HighlightText'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const useNextStyles = makeStyles({
|
|
45
|
+
root: {
|
|
46
|
+
borderRadius: tokens.borderRadiusXLarge,
|
|
47
|
+
...shorthands.borderColor(tokens.colorTransparentStroke),
|
|
48
|
+
color: tokens.colorNeutralForeground2,
|
|
49
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
50
|
+
':hover': {
|
|
51
|
+
cursor: 'pointer',
|
|
52
|
+
color: tokens.colorNeutralForeground2Hover,
|
|
53
|
+
backgroundColor: tokens.colorNeutralBackground3Hover
|
|
54
|
+
},
|
|
55
|
+
':active': {
|
|
56
|
+
color: tokens.colorNeutralForeground2Pressed,
|
|
57
|
+
backgroundColor: tokens.colorNeutralBackground3Pressed
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
canvas: {
|
|
61
|
+
minHeight: '40px',
|
|
62
|
+
padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalS}`
|
|
63
|
+
},
|
|
64
|
+
sidecar: {
|
|
65
|
+
minHeight: '32px',
|
|
66
|
+
padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalS}`
|
|
67
|
+
},
|
|
68
|
+
fullyOverflowed_canvas: {
|
|
69
|
+
padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalL}`,
|
|
70
|
+
...typographyStyles.subtitle2
|
|
71
|
+
},
|
|
72
|
+
fullyOverflowed_sidecar: {
|
|
73
|
+
padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalM}`,
|
|
74
|
+
...typographyStyles.body1Strong
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Apply styling to the AttachmentOverflowMenuButton slots based on the state
|
|
79
|
+
*/ export const useAttachmentOverflowMenuButtonStyles_unstable = (state)=>{
|
|
80
|
+
'use no memo';
|
|
81
|
+
const { designVersion, mode, fullyOverflowed } = state;
|
|
82
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
83
|
+
const progressBarStyles = useProgressBarStyles();
|
|
84
|
+
const nextStyles = useNextStyles();
|
|
85
|
+
state.root.className = mergeClasses(attachmentOverflowMenuButtonClassNames.root, rootBaseClassName, designVersion === 'next' && nextStyles.root, designVersion === 'next' && nextStyles[mode], designVersion === 'next' && fullyOverflowed && nextStyles[`fullyOverflowed_${mode}`], state.root.className);
|
|
86
|
+
if (state.progress) {
|
|
87
|
+
state.progress.className = mergeClasses(attachmentOverflowMenuButtonClassNames.progress, progressBarStyles.progress, state.progress.className);
|
|
88
|
+
const bar = slot.optional(state.progress.bar, {
|
|
89
|
+
elementType: 'div',
|
|
90
|
+
renderByDefault: true
|
|
91
|
+
});
|
|
92
|
+
if (bar) {
|
|
93
|
+
if (state.progress.value === undefined) {
|
|
94
|
+
bar.className = mergeClasses(progressBarStyles.indeterminateProgressBar, bar.className);
|
|
95
|
+
} else {
|
|
96
|
+
bar.className = mergeClasses(progressBarStyles.regularProgressBar, bar.className);
|
|
97
|
+
}
|
|
98
|
+
state.progress.bar = bar;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return state;
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useAttachmentOverflowMenuButtonStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands, slot } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport { useProgressBarStyles } from '../utils/useProgressBarStyles.styles';\nimport type {\n AttachmentOverflowMenuButtonSlots,\n AttachmentOverflowMenuButtonState,\n} from './AttachmentOverflowMenuButton.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const attachmentOverflowMenuButtonClassNames: SlotClassNames<AttachmentOverflowMenuButtonSlots> = {\n root: 'fai-AttachmentOverflowMenuButton',\n progress: 'fai-AttachmentOverflowMenuButton__progress',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n alignItems: 'center',\n backgroundColor: tokens.colorSubtleBackground,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n columnGap: tokens.spacingHorizontalSNudge,\n cursor: 'pointer',\n display: 'inline-flex',\n flexWrap: 'nowrap',\n fontFamily: typographyStyles.body1.fontFamily,\n fontSize: typographyStyles.body1.fontSize,\n fontWeight: typographyStyles.body1.fontWeight,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS}`,\n verticalAlign: 'middle',\n position: 'relative',\n\n ':hover': {\n cursor: 'pointer',\n backgroundColor: tokens.colorSubtleBackgroundHover,\n color: tokens.colorNeutralForeground2Hover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n color: tokens.colorNeutralForeground2Pressed,\n },\n '@media (forced-colors: active)': {\n ':hover': {\n backgroundColor: 'HighlightText',\n },\n ':active': {\n backgroundColor: 'HighlightText',\n },\n },\n});\n\nconst useNextStyles = makeStyles({\n root: {\n borderRadius: tokens.borderRadiusXLarge,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n color: tokens.colorNeutralForeground2,\n backgroundColor: tokens.colorNeutralBackground3,\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorNeutralBackground3Hover,\n },\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n },\n canvas: {\n minHeight: '40px',\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalS}`,\n },\n sidecar: {\n minHeight: '32px',\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalS}`,\n },\n fullyOverflowed_canvas: {\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalL}`,\n ...typographyStyles.subtitle2,\n },\n fullyOverflowed_sidecar: {\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalM}`,\n ...typographyStyles.body1Strong,\n },\n});\n\n/**\n * Apply styling to the AttachmentOverflowMenuButton slots based on the state\n */\nexport const useAttachmentOverflowMenuButtonStyles_unstable = (\n state: AttachmentOverflowMenuButtonState,\n): AttachmentOverflowMenuButtonState => {\n 'use no memo';\n\n const { designVersion, mode, fullyOverflowed } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const progressBarStyles = useProgressBarStyles();\n const nextStyles = useNextStyles();\n\n state.root.className = mergeClasses(\n attachmentOverflowMenuButtonClassNames.root,\n rootBaseClassName,\n designVersion === 'next' && nextStyles.root,\n designVersion === 'next' && nextStyles[mode],\n designVersion === 'next' && fullyOverflowed && nextStyles[`fullyOverflowed_${mode}`],\n state.root.className,\n );\n\n if (state.progress) {\n state.progress.className = mergeClasses(\n attachmentOverflowMenuButtonClassNames.progress,\n progressBarStyles.progress,\n state.progress.className,\n );\n\n const bar = slot.optional(state.progress.bar, { elementType: 'div', renderByDefault: true });\n if (bar) {\n if (state.progress.value === undefined) {\n bar.className = mergeClasses(progressBarStyles.indeterminateProgressBar, bar.className);\n } else {\n bar.className = mergeClasses(progressBarStyles.regularProgressBar, bar.className);\n }\n state.progress.bar = bar;\n }\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","slot","tokens","typographyStyles","useProgressBarStyles","attachmentOverflowMenuButtonClassNames","root","progress","useRootBaseClassName","color","colorNeutralForeground1","alignItems","backgroundColor","colorSubtleBackground","border","strokeWidthThin","colorNeutralStroke1","borderRadius","borderRadiusMedium","boxSizing","columnGap","spacingHorizontalSNudge","cursor","display","flexWrap","fontFamily","body1","fontSize","fontWeight","justifyContent","padding","spacingVerticalXS","spacingHorizontalS","verticalAlign","position","colorSubtleBackgroundHover","colorNeutralForeground2Hover","colorSubtleBackgroundPressed","colorNeutralForeground2Pressed","useNextStyles","borderRadiusXLarge","borderColor","colorTransparentStroke","colorNeutralForeground2","colorNeutralBackground3","colorNeutralBackground3Hover","colorNeutralBackground3Pressed","canvas","minHeight","spacingVerticalNone","sidecar","fullyOverflowed_canvas","spacingHorizontalL","subtitle2","fullyOverflowed_sidecar","spacingHorizontalM","body1Strong","useAttachmentOverflowMenuButtonStyles_unstable","state","designVersion","mode","fullyOverflowed","rootBaseClassName","progressBarStyles","nextStyles","className","bar","optional","elementType","renderByDefault","value","undefined","indeterminateProgressBar","regularProgressBar"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAgB,EAAEJ,KAAK,CAAC,CAAC,EACpFF,MAAMpD,IAAI,CAAC2D,SAAS;IAGtB,IAAIP,MAAMnD,QAAQ,EAAE;QAClBmD,MAAMnD,QAAQ,CAAC0D,SAAS,GAAGlE,aACzBM,uCAAuCE,QAAQ,EAC/CwD,kBAAkBxD,QAAQ,EAC1BmD,MAAMnD,QAAQ,CAAC0D,SAAS;QAG1B,MAAMC,MAAMjE,KAAKkE,QAAQ,CAACT,MAAMnD,QAAQ,CAAC2D,GAAG,EAAE;YAAEE,aAAa;YAAOC,iBAAiB;QAAK;QAC1F,IAAIH,KAAK;YACP,IAAIR,MAAMnD,QAAQ,CAAC+D,KAAK,KAAKC,WAAW;gBACtCL,IAAID,SAAS,GAAGlE,aAAagE,kBAAkBS,wBAAwB,EAAEN,IAAID,SAAS;YACxF,OAAO;gBACLC,IAAID,SAAS,GAAGlE,aAAagE,kBAAkBU,kBAAkB,EAAEP,IAAID,SAAS;YAClF;YACAP,MAAMnD,QAAQ,CAAC2D,GAAG,GAAGA;QACvB;IACF;IAEA,OAAOR;AACT,EAAE"}
|
|
@@ -2,10 +2,9 @@ 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__*/React.forwardRef((props, ref)
|
|
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,4 +2,3 @@ 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,12 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
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
|
-
|
|
5
|
+
*/ export const renderAttachmentOverflowMenuItem_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
return !state.isVisible ? /*#__PURE__*/ _jsxs(state.root, {
|
|
8
|
+
children: [
|
|
9
|
+
state.root.children,
|
|
10
|
+
state.progress && /*#__PURE__*/ _jsx(state.progress, {})
|
|
11
|
+
]
|
|
12
|
+
}) : null;
|
|
11
13
|
};
|
|
12
|
-
//# sourceMappingURL=renderAttachmentOverflowMenuItem.js.map
|
|
@@ -11,54 +11,46 @@ import { useDesignVersion } from '@fluentui-copilot/react-provider';
|
|
|
11
11
|
*
|
|
12
12
|
* @param props - props from this instance of AttachmentOverflowMenuItem
|
|
13
13
|
* @param ref - reference to root HTMLElement of AttachmentOverflowMenuItem
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ref,
|
|
30
|
-
icon: media,
|
|
31
|
-
secondaryContent: /*#__PURE__*/React.createElement(Dismiss20Regular, null),
|
|
32
|
-
...props,
|
|
33
|
-
id: menuItemId
|
|
34
|
-
}, {
|
|
35
|
-
elementType: MenuItem
|
|
36
|
-
});
|
|
37
|
-
root.onClick = mergeCallbacks(root.onClick, ev => {
|
|
38
|
-
onAttachmentDismiss === null || onAttachmentDismiss === void 0 ? void 0 : onAttachmentDismiss(ev, {
|
|
39
|
-
content: props.children,
|
|
40
|
-
media,
|
|
41
|
-
id: menuItemId
|
|
14
|
+
*/ export const useAttachmentOverflowMenuItem_unstable = (props, ref)=>{
|
|
15
|
+
'use no memo';
|
|
16
|
+
const { imageOnly, media } = props;
|
|
17
|
+
const menuItemId = useId('attachment-', props.id);
|
|
18
|
+
const isVisible = useIsOverflowItemVisible(menuItemId);
|
|
19
|
+
const { onAttachmentDismiss } = useAttachmentListContext_unstable((context)=>context);
|
|
20
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
21
|
+
const root = slot.always({
|
|
22
|
+
ref,
|
|
23
|
+
icon: media,
|
|
24
|
+
secondaryContent: /*#__PURE__*/ React.createElement(Dismiss20Regular, null),
|
|
25
|
+
...props,
|
|
26
|
+
id: menuItemId
|
|
27
|
+
}, {
|
|
28
|
+
elementType: MenuItem
|
|
42
29
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
root.onClick = mergeCallbacks(root.onClick, (ev)=>{
|
|
31
|
+
onAttachmentDismiss === null || onAttachmentDismiss === void 0 ? void 0 : onAttachmentDismiss(ev, {
|
|
32
|
+
content: props.children,
|
|
33
|
+
media,
|
|
34
|
+
id: menuItemId
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
const progress = slot.optional(props.progress, {
|
|
38
|
+
defaultProps: {
|
|
39
|
+
shape: 'square',
|
|
40
|
+
thickness: 'large',
|
|
41
|
+
'aria-labelledby': props.id
|
|
42
|
+
},
|
|
43
|
+
elementType: ProgressBar
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
components: {
|
|
47
|
+
root: MenuItem,
|
|
48
|
+
progress: ProgressBar
|
|
49
|
+
},
|
|
50
|
+
root,
|
|
51
|
+
progress,
|
|
52
|
+
isVisible,
|
|
53
|
+
imageOnly,
|
|
54
|
+
designVersion
|
|
55
|
+
};
|
|
63
56
|
};
|
|
64
|
-
//# sourceMappingURL=useAttachmentOverflowMenuItem.js.map
|
package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { makeStyles, mergeClasses, slot, tokens } from '@fluentui/react-components';
|
|
2
|
+
import { useProgressBarStyles } from '../utils/useProgressBarStyles.styles';
|
|
3
|
+
export const attachmentOverflowMenuItemClassNames = {
|
|
4
|
+
root: 'fai-AttachmentOverflowMenuItem',
|
|
5
|
+
progress: 'fai-AttachmentOverflowMenuItem__progress'
|
|
6
|
+
};
|
|
7
|
+
const FOCUS_VISIBLE_ATTR = 'data-fui-focus-visible';
|
|
8
|
+
const useStyles = makeStyles({
|
|
9
|
+
imageOnly: {
|
|
10
|
+
alignItems: 'center'
|
|
11
|
+
},
|
|
12
|
+
secondaryContent: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const useNextStyles = makeStyles({
|
|
18
|
+
nextStyles: {
|
|
19
|
+
[`[${FOCUS_VISIBLE_ATTR}]::after`]: {
|
|
20
|
+
borderRadius: tokens.borderRadiusXLarge
|
|
21
|
+
},
|
|
22
|
+
outline: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Apply styling to the AttachmentList slots based on the state
|
|
27
|
+
*/ export const useAttachmentOverflowMenuItemStyles_unstable = (state)=>{
|
|
28
|
+
'use no memo';
|
|
29
|
+
const { imageOnly, designVersion } = state;
|
|
30
|
+
const styles = useStyles();
|
|
31
|
+
const nextStyles = useNextStyles();
|
|
32
|
+
const progressBarStyles = useProgressBarStyles();
|
|
33
|
+
state.root.className = mergeClasses(attachmentOverflowMenuItemClassNames.root, imageOnly && styles.imageOnly, designVersion === 'next' && nextStyles.nextStyles, state.root.className);
|
|
34
|
+
const secondaryContent = slot.optional(state.root.secondaryContent, {
|
|
35
|
+
elementType: 'span'
|
|
36
|
+
});
|
|
37
|
+
if (secondaryContent) {
|
|
38
|
+
secondaryContent.className = mergeClasses(styles.secondaryContent, secondaryContent.className);
|
|
39
|
+
state.root.secondaryContent = secondaryContent;
|
|
40
|
+
}
|
|
41
|
+
if (state.progress) {
|
|
42
|
+
state.progress.className = mergeClasses(attachmentOverflowMenuItemClassNames.progress, progressBarStyles.progress, state.progress.className);
|
|
43
|
+
const bar = slot.optional(state.progress.bar, {
|
|
44
|
+
elementType: 'div',
|
|
45
|
+
renderByDefault: true
|
|
46
|
+
});
|
|
47
|
+
if (bar) {
|
|
48
|
+
if (state.progress.value === undefined) {
|
|
49
|
+
bar.className = mergeClasses(progressBarStyles.indeterminateProgressBar, bar.className);
|
|
50
|
+
} else {
|
|
51
|
+
bar.className = mergeClasses(progressBarStyles.regularProgressBar, bar.className);
|
|
52
|
+
}
|
|
53
|
+
state.progress.bar = bar;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return state;
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useAttachmentOverflowMenuItemStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, slot, tokens } from '@fluentui/react-components';\nimport { useProgressBarStyles } from '../utils/useProgressBarStyles.styles';\nimport type {\n AttachmentOverflowMenuItemSlots,\n AttachmentOverflowMenuItemState,\n} from './AttachmentOverflowMenuItem.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const attachmentOverflowMenuItemClassNames: SlotClassNames<AttachmentOverflowMenuItemSlots> = {\n root: 'fai-AttachmentOverflowMenuItem',\n progress: 'fai-AttachmentOverflowMenuItem__progress',\n};\n\nconst FOCUS_VISIBLE_ATTR = 'data-fui-focus-visible';\n\nconst useStyles = makeStyles({\n imageOnly: {\n alignItems: 'center',\n },\n secondaryContent: {\n display: 'flex',\n alignItems: 'center',\n },\n});\n\nconst useNextStyles = makeStyles({\n nextStyles: {\n [`[${FOCUS_VISIBLE_ATTR}]::after`]: {\n borderRadius: tokens.borderRadiusXLarge,\n },\n outline: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n },\n});\n\n/**\n * Apply styling to the AttachmentList slots based on the state\n */\nexport const useAttachmentOverflowMenuItemStyles_unstable = (\n state: AttachmentOverflowMenuItemState,\n): AttachmentOverflowMenuItemState => {\n 'use no memo';\n\n const { imageOnly, designVersion } = state;\n const styles = useStyles();\n const nextStyles = useNextStyles();\n const progressBarStyles = useProgressBarStyles();\n\n state.root.className = mergeClasses(\n attachmentOverflowMenuItemClassNames.root,\n imageOnly && styles.imageOnly,\n designVersion === 'next' && nextStyles.nextStyles,\n state.root.className,\n );\n\n const secondaryContent = slot.optional(state.root.secondaryContent, {\n elementType: 'span',\n });\n if (secondaryContent) {\n secondaryContent.className = mergeClasses(styles.secondaryContent, secondaryContent.className);\n state.root.secondaryContent = secondaryContent;\n }\n\n if (state.progress) {\n state.progress.className = mergeClasses(\n attachmentOverflowMenuItemClassNames.progress,\n progressBarStyles.progress,\n state.progress.className,\n );\n\n const bar = slot.optional(state.progress.bar, { elementType: 'div', renderByDefault: true });\n if (bar) {\n if (state.progress.value === undefined) {\n bar.className = mergeClasses(progressBarStyles.indeterminateProgressBar, bar.className);\n } else {\n bar.className = mergeClasses(progressBarStyles.regularProgressBar, bar.className);\n }\n state.progress.bar = bar;\n }\n }\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","slot","tokens","useProgressBarStyles","attachmentOverflowMenuItemClassNames","root","progress","FOCUS_VISIBLE_ATTR","useStyles","imageOnly","alignItems","secondaryContent","display","useNextStyles","nextStyles","borderRadius","borderRadiusXLarge","outline","strokeWidthThin","colorTransparentStroke","useAttachmentOverflowMenuItemStyles_unstable","state","designVersion","styles","progressBarStyles","className","optional","elementType","bar","renderByDefault","value","undefined","indeterminateProgressBar","regularProgressBar"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,EAAEC,IAAI,EAAEC,MAAM,QAAQ,6BAA6B;AACpF,SAASC,oBAAoB,QAAQ,uCAAuC;AAO5E,OAAO,MAAMC,uCAAwF;IACnGC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,MAAMC,qBAAqB;AAE3B,MAAMC,YAAYT,WAAW;IAC3BU,WAAW;QACTC,YAAY;IACd;IACAC,kBAAkB;QAChBC,SAAS;QACTF,YAAY;IACd;AACF;AAEA,MAAMG,gBAAgBd,WAAW;IAC/Be,YAAY;QACV,CAAC,CAAC,CAAC,EAAEP,mBAAmB,QAAQ,CAAC,CAAC,EAAE;YAClCQ,cAAcb,OAAOc,kBAAkB;QACzC;QACAC,SAAS,CAAC,EAAEf,OAAOgB,eAAe,CAAC,OAAO,EAAEhB,OAAOiB,sBAAsB,CAAC,CAAC;IAC7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} from '@fluentui-copilot/react-provider';
|
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated use new Attachment component exported from \@fluentui-copilot/react-attachments package instead.
|
|
8
8
|
* Deprecated on 4/9/2024.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return renderAttachmentTag_unstable(state);
|
|
9
|
+
*/ export const AttachmentTag = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
10
|
+
const state = useAttachmentTag_unstable(props, ref);
|
|
11
|
+
useAttachmentTagStyles_unstable(state);
|
|
12
|
+
useCustomStyleHook('useAttachmentTagStyles')(state);
|
|
13
|
+
return renderAttachmentTag_unstable(state);
|
|
15
14
|
});
|
|
16
15
|
AttachmentTag.displayName = 'AttachmentTag';
|
|
17
|
-
//# sourceMappingURL=AttachmentTag.js.map
|
|
@@ -2,4 +2,3 @@ export { AttachmentTag } from './AttachmentTag';
|
|
|
2
2
|
export { renderAttachmentTag_unstable } from './renderAttachmentTag';
|
|
3
3
|
export { useAttachmentTag_unstable } from './useAttachmentTag';
|
|
4
4
|
export { ATTACHMENTTAG_MAXWIDTH, attachmentTagClassNames, useAttachmentTagStyles_unstable, useContentBaseClassName, useIconBaseClassName, useMediaBaseClassName } from './useAttachmentTagStyles.styles';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
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 AttachmentTag
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
*/ export const renderAttachmentTag_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
return /*#__PURE__*/ _jsxs(state.root, {
|
|
8
|
+
children: [
|
|
9
|
+
state.media && /*#__PURE__*/ _jsx(state.media, {}),
|
|
10
|
+
/*#__PURE__*/ _jsx(state.content, {}),
|
|
11
|
+
/*#__PURE__*/ _jsx(state.icon, {})
|
|
12
|
+
]
|
|
13
|
+
});
|
|
11
14
|
};
|
|
12
|
-
//# sourceMappingURL=renderAttachmentTag.js.map
|
|
@@ -7,15 +7,13 @@ import { useAttachmentTagSlots } from '../utils/useAttachmentTagSlots';
|
|
|
7
7
|
*
|
|
8
8
|
* @param props - props from this instance of AttachmentTag
|
|
9
9
|
* @param ref - reference to root HTMLElement of AttachmentTag
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
});
|
|
10
|
+
*/ export const useAttachmentTag_unstable = (props, ref)=>{
|
|
11
|
+
return useAttachmentTagSlots(props, ref, {
|
|
12
|
+
elementType: {
|
|
13
|
+
root: 'button',
|
|
14
|
+
media: 'span',
|
|
15
|
+
content: 'span',
|
|
16
|
+
icon: 'span'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
20
19
|
};
|
|
21
|
-
//# sourceMappingURL=useAttachmentTag.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { makeResetStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const attachmentTagClassNames = {
|
|
4
|
+
root: 'fai-AttachmentTag',
|
|
5
|
+
media: 'fai-AttachmentTag__media',
|
|
6
|
+
content: 'fai-AttachmentTag__content',
|
|
7
|
+
icon: 'fai-AttachmentTag__icon'
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/ export const ATTACHMENTTAG_MAXWIDTH = '180px';
|
|
12
|
+
const ATTACHMENTTAG_SIZE = '20px';
|
|
13
|
+
const useRootBaseClassName = makeResetStyles({
|
|
14
|
+
color: tokens.colorNeutralForeground1,
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
17
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
|
|
18
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
columnGap: tokens.spacingHorizontalSNudge,
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
flexWrap: 'nowrap',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
maxWidth: ATTACHMENTTAG_MAXWIDTH,
|
|
26
|
+
padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS} ${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS}`,
|
|
27
|
+
verticalAlign: 'middle',
|
|
28
|
+
':hover': {
|
|
29
|
+
borderColor: tokens.colorNeutralStroke1Hover,
|
|
30
|
+
[`& .${attachmentTagClassNames.icon}`]: {
|
|
31
|
+
color: tokens.colorBrandForegroundLinkHover
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
':hover:active': {
|
|
35
|
+
borderColor: tokens.colorNeutralStroke1Pressed,
|
|
36
|
+
[`& .${attachmentTagClassNames.icon}`]: {
|
|
37
|
+
color: tokens.colorNeutralForeground2BrandPressed
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
':focus': {
|
|
41
|
+
[`& .${attachmentTagClassNames.icon}`]: {
|
|
42
|
+
color: tokens.colorNeutralForeground2BrandHover
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
':focus:active': {
|
|
46
|
+
[`& .${attachmentTagClassNames.icon}`]: {
|
|
47
|
+
color: tokens.colorNeutralForeground2BrandPressed
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/ export const useMediaBaseClassName = makeResetStyles({
|
|
54
|
+
fontSize: ATTACHMENTTAG_SIZE,
|
|
55
|
+
height: ATTACHMENTTAG_SIZE,
|
|
56
|
+
lineHeight: ATTACHMENTTAG_SIZE,
|
|
57
|
+
width: ATTACHMENTTAG_SIZE
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/ export const useContentBaseClassName = makeResetStyles({
|
|
62
|
+
overflowX: 'hidden',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
whiteSpace: 'nowrap',
|
|
65
|
+
...typographyStyles.body1
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/ export const useIconBaseClassName = makeResetStyles({
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
borderRadius: tokens.borderRadiusCircular,
|
|
72
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,
|
|
73
|
+
boxSizing: 'border-box',
|
|
74
|
+
color: tokens.colorNeutralForeground1,
|
|
75
|
+
display: 'inline-flex',
|
|
76
|
+
fontSize: ATTACHMENTTAG_SIZE,
|
|
77
|
+
height: `calc(${ATTACHMENTTAG_SIZE} + ${tokens.strokeWidthThin} * 2 + ${tokens.spacingVerticalXXS})`,
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
maxWidth: `calc(${ATTACHMENTTAG_SIZE} + ${tokens.strokeWidthThin} * 2 + ${tokens.spacingHorizontalXXS})`,
|
|
80
|
+
minWidth: `calc(${ATTACHMENTTAG_SIZE} + ${tokens.strokeWidthThin} * 2 + ${tokens.spacingHorizontalXXS})`,
|
|
81
|
+
padding: `calc(${tokens.spacingVerticalXXS} / 2) calc(${tokens.spacingHorizontalXXS} / 2)`
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Apply styling to the AttachmentTag slots based on the state
|
|
85
|
+
*/ export const useAttachmentTagStyles_unstable = (state)=>{
|
|
86
|
+
'use no memo';
|
|
87
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
88
|
+
const mediaBaseClassName = useMediaBaseClassName();
|
|
89
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
90
|
+
const iconBaseClassName = useIconBaseClassName();
|
|
91
|
+
state.root.className = mergeClasses(attachmentTagClassNames.root, rootBaseClassName, state.root.className);
|
|
92
|
+
if (state.media) {
|
|
93
|
+
state.media.className = mergeClasses(attachmentTagClassNames.media, mediaBaseClassName, state.media.className);
|
|
94
|
+
}
|
|
95
|
+
state.content.className = mergeClasses(attachmentTagClassNames.content, contentBaseClassName, state.content.className);
|
|
96
|
+
state.icon.className = mergeClasses(attachmentTagClassNames.icon, iconBaseClassName, state.icon.className);
|
|
97
|
+
return state;
|
|
98
|
+
};
|