@fluentui-copilot/react-attachments 0.13.2 → 0.13.3

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.
Files changed (133) hide show
  1. package/CHANGELOG.json +16 -1
  2. package/CHANGELOG.md +11 -2
  3. package/lib/AgentTag.js +0 -1
  4. package/lib/Attachment.js +0 -1
  5. package/lib/AttachmentList.js +0 -1
  6. package/lib/AttachmentOverflowMenu.js +0 -1
  7. package/lib/AttachmentOverflowMenuButton.js +0 -1
  8. package/lib/AttachmentOverflowMenuItem.js +0 -1
  9. package/lib/components/AgentTag/AgentTag.js +4 -5
  10. package/lib/components/AgentTag/AgentTag.types.js +1 -2
  11. package/lib/components/AgentTag/index.js +0 -1
  12. package/lib/components/AgentTag/renderAgentTag.js +3 -5
  13. package/lib/components/AgentTag/useAgentTag.js +7 -9
  14. package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js +66 -0
  15. package/lib/components/AgentTag/useAgentTagStyles.styles.raw.js.map +1 -0
  16. package/lib/components/Attachment/Attachment.js +5 -6
  17. package/lib/components/Attachment/Attachment.types.js +1 -2
  18. package/lib/components/Attachment/index.js +0 -1
  19. package/lib/components/Attachment/renderAttachment.js +36 -31
  20. package/lib/components/Attachment/useAttachment.js +85 -95
  21. package/lib/components/Attachment/useAttachmentStyles.styles.raw.js +317 -0
  22. package/lib/components/Attachment/useAttachmentStyles.styles.raw.js.map +1 -0
  23. package/lib/components/AttachmentList/AttachmentList.js +6 -7
  24. package/lib/components/AttachmentList/AttachmentList.types.js +1 -2
  25. package/lib/components/AttachmentList/index.js +0 -1
  26. package/lib/components/AttachmentList/renderAttachmentList.js +25 -25
  27. package/lib/components/AttachmentList/useAttachmentList.js +113 -124
  28. package/lib/components/AttachmentList/useAttachmentListContextValues.js +10 -15
  29. package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js +44 -0
  30. package/lib/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +1 -0
  31. package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js +8 -9
  32. package/lib/components/AttachmentOverflowMenu/AttachmentOverflowMenu.types.js +1 -2
  33. package/lib/components/AttachmentOverflowMenu/index.js +0 -1
  34. package/lib/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js +8 -13
  35. package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js +9 -15
  36. package/lib/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js +10 -15
  37. package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js +5 -6
  38. package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js +1 -2
  39. package/lib/components/AttachmentOverflowMenuButton/index.js +0 -1
  40. package/lib/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +11 -10
  41. package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +51 -59
  42. package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +102 -0
  43. package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +1 -0
  44. package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js +4 -5
  45. package/lib/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.types.js +1 -2
  46. package/lib/components/AttachmentOverflowMenuItem/index.js +0 -1
  47. package/lib/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js +9 -8
  48. package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +41 -49
  49. package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +57 -0
  50. package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +1 -0
  51. package/lib/components/index.js +0 -1
  52. package/lib/components/utils/useProgressBarStyles.styles.raw.js +42 -0
  53. package/lib/components/utils/useProgressBarStyles.styles.raw.js.map +1 -0
  54. package/lib/contexts/attachmentListContext.js +4 -5
  55. package/lib/contexts/attachmentOverflowMenuContext.js +4 -5
  56. package/lib/index.js +0 -1
  57. package/lib-commonjs/AgentTag.js +0 -1
  58. package/lib-commonjs/Attachment.js +0 -1
  59. package/lib-commonjs/AttachmentList.js +0 -1
  60. package/lib-commonjs/AttachmentOverflowMenu.js +0 -1
  61. package/lib-commonjs/AttachmentOverflowMenuButton.js +0 -1
  62. package/lib-commonjs/AttachmentOverflowMenuItem.js +0 -1
  63. package/lib-commonjs/components/AgentTag/AgentTag.js +1 -1
  64. package/lib-commonjs/components/AgentTag/AgentTag.js.map +1 -1
  65. package/lib-commonjs/components/AgentTag/AgentTag.types.js +0 -1
  66. package/lib-commonjs/components/AgentTag/index.js +0 -1
  67. package/lib-commonjs/components/AgentTag/renderAgentTag.js +1 -1
  68. package/lib-commonjs/components/AgentTag/renderAgentTag.js.map +1 -1
  69. package/lib-commonjs/components/AgentTag/useAgentTag.js +1 -1
  70. package/lib-commonjs/components/AgentTag/useAgentTag.js.map +1 -1
  71. package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js +82 -0
  72. package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.raw.js.map +1 -0
  73. package/lib-commonjs/components/Attachment/Attachment.js +1 -1
  74. package/lib-commonjs/components/Attachment/Attachment.js.map +1 -1
  75. package/lib-commonjs/components/Attachment/Attachment.types.js +0 -1
  76. package/lib-commonjs/components/Attachment/index.js +0 -1
  77. package/lib-commonjs/components/Attachment/renderAttachment.js +1 -1
  78. package/lib-commonjs/components/Attachment/renderAttachment.js.map +1 -1
  79. package/lib-commonjs/components/Attachment/useAttachment.js +1 -1
  80. package/lib-commonjs/components/Attachment/useAttachment.js.map +1 -1
  81. package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js +336 -0
  82. package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.raw.js.map +1 -0
  83. package/lib-commonjs/components/AttachmentList/AttachmentList.js +1 -1
  84. package/lib-commonjs/components/AttachmentList/AttachmentList.js.map +1 -1
  85. package/lib-commonjs/components/AttachmentList/AttachmentList.types.js +0 -1
  86. package/lib-commonjs/components/AttachmentList/index.js +0 -1
  87. package/lib-commonjs/components/AttachmentList/renderAttachmentList.js +1 -1
  88. package/lib-commonjs/components/AttachmentList/renderAttachmentList.js.map +1 -1
  89. package/lib-commonjs/components/AttachmentList/useAttachmentList.js +1 -1
  90. package/lib-commonjs/components/AttachmentList/useAttachmentList.js.map +1 -1
  91. package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js +1 -1
  92. package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js.map +1 -1
  93. package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js +60 -0
  94. package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.styles.raw.js.map +1 -0
  95. package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js +1 -1
  96. package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.js.map +1 -1
  97. package/lib-commonjs/components/AttachmentOverflowMenu/AttachmentOverflowMenu.types.js +0 -1
  98. package/lib-commonjs/components/AttachmentOverflowMenu/index.js +0 -1
  99. package/lib-commonjs/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js +1 -1
  100. package/lib-commonjs/components/AttachmentOverflowMenu/renderAttachmentOverflowMenu.js.map +1 -1
  101. package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js +1 -1
  102. package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenu.js.map +1 -1
  103. package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js +1 -1
  104. package/lib-commonjs/components/AttachmentOverflowMenu/useAttachmentOverflowMenuContextValues.js.map +1 -1
  105. package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js +1 -1
  106. package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.js.map +1 -1
  107. package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js +0 -1
  108. package/lib-commonjs/components/AttachmentOverflowMenuButton/index.js +0 -1
  109. package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +1 -1
  110. package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js.map +1 -1
  111. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +1 -1
  112. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js.map +1 -1
  113. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js +118 -0
  114. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles.styles.raw.js.map +1 -0
  115. package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js +1 -1
  116. package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.js.map +1 -1
  117. package/lib-commonjs/components/AttachmentOverflowMenuItem/AttachmentOverflowMenuItem.types.js +0 -1
  118. package/lib-commonjs/components/AttachmentOverflowMenuItem/index.js +0 -1
  119. package/lib-commonjs/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js +1 -1
  120. package/lib-commonjs/components/AttachmentOverflowMenuItem/renderAttachmentOverflowMenuItem.js.map +1 -1
  121. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +1 -1
  122. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js.map +1 -1
  123. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js +73 -0
  124. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItemStyles.styles.raw.js.map +1 -0
  125. package/lib-commonjs/components/index.js +0 -1
  126. package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js +50 -0
  127. package/lib-commonjs/components/utils/useProgressBarStyles.styles.raw.js.map +1 -0
  128. package/lib-commonjs/contexts/attachmentListContext.js +1 -1
  129. package/lib-commonjs/contexts/attachmentListContext.js.map +1 -1
  130. package/lib-commonjs/contexts/attachmentOverflowMenuContext.js +1 -1
  131. package/lib-commonjs/contexts/attachmentOverflowMenuContext.js.map +1 -1
  132. package/lib-commonjs/index.js +0 -1
  133. package/package.json +4 -4
@@ -16,130 +16,119 @@ 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
- 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);
19
+ */ export const useAttachmentList_unstable = (props, ref)=>{
20
+ const { children, maxVisibleAttachments, onAttachmentDismiss, overflowMenuProps } = props;
21
+ const innerRef = React.useRef(null);
22
+ const [setTimeout] = useTimeout();
23
+ const { targetDocument } = useFluent();
24
+ const designVersion = useDesignVersion(props.designVersion);
25
+ const { findNextFocusable, findPrevFocusable, findLastFocusable } = useFocusFinders();
26
+ const handleAttachmentDismiss = useEventCallback((e, data)=>{
27
+ var _innerRef_current;
28
+ if (!onAttachmentDismiss) {
29
+ return;
30
+ }
31
+ onAttachmentDismiss(e, data);
32
+ // set focus after attachment dismiss
33
+ const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
34
+ if ((_innerRef_current = innerRef.current) === null || _innerRef_current === void 0 ? void 0 : _innerRef_current.contains(activeElement)) {
35
+ // focus on next attachment only if the active element is within the current attachment list
36
+ const next = findNextFocusable(activeElement, {
37
+ container: innerRef.current
38
+ });
39
+ if (next) {
40
+ // focus on the overflow button if the next focusable element is the overflow button.
41
+ // if overflow button is removed from the DOM, focus on the last focusable element in the attachment list.
42
+ if (next.classList.contains(attachmentOverflowMenuButtonClassNames.root)) {
43
+ setTimeout(()=>{
44
+ var _findLastFocusable;
45
+ (_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
46
+ }, 0);
47
+ } else {
48
+ next.focus();
49
+ }
50
+ } else {
51
+ const prev = findPrevFocusable(activeElement === null || activeElement === void 0 ? void 0 : activeElement.parentElement, {
52
+ container: innerRef.current
53
+ });
54
+ prev === null || prev === void 0 ? void 0 : prev.focus();
55
+ }
59
56
  } else {
60
- next.focus();
57
+ // Handles keyboard focus when attachment removed is in the overflow menu. Also handles focus when the overflow button is removed from the DOM.
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
+ });
61
82
  }
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
- };
83
+ return [];
84
+ }, [
85
+ resolvedChildren
86
+ ]);
87
+ const arrowNavigationProps = useArrowNavigationGroup({
88
+ circular: true,
89
+ axis: 'both',
90
+ memorizeCurrent: true
91
+ });
92
+ const shouldUseOverflow = maxVisibleAttachments !== undefined;
93
+ return {
94
+ designVersion,
95
+ onAttachmentDismiss: handleAttachmentDismiss,
96
+ shouldUseOverflow,
97
+ numberOfAttachments: resolvedChildren.length,
98
+ overflowMenuProps,
99
+ components: {
100
+ root: 'div',
101
+ menuList: MenuList,
102
+ menuPopover: MenuPopover,
103
+ overflowMenuButton: 'span'
104
+ },
105
+ root: slot.always(getIntrinsicElementProps('div', {
106
+ 'aria-label': 'Attachments',
107
+ ref: useMergedRefs(ref, innerRef),
108
+ role: 'toolbar',
109
+ ...arrowNavigationProps,
110
+ ...props,
111
+ children: resolvedChildren
112
+ }), {
113
+ elementType: 'div'
114
+ }),
115
+ menuList: slot.optional(props.menuList, {
116
+ defaultProps: {
117
+ children: attachmentOverflowMenuItems
118
+ },
119
+ elementType: MenuList,
120
+ renderByDefault: true
121
+ }),
122
+ menuPopover: slot.optional(props.menuPopover, {
123
+ elementType: MenuPopover,
124
+ renderByDefault: true
125
+ }),
126
+ overflowMenuButton: slot.optional(props.overflowMenuButton, {
127
+ defaultProps: {
128
+ children: /*#__PURE__*/ React.createElement(AttachmentOverflowMenuButton, null)
129
+ },
130
+ elementType: 'span',
131
+ renderByDefault: true
132
+ })
133
+ };
144
134
  };
145
- //# sourceMappingURL=useAttachmentList.js.map
@@ -1,17 +1,12 @@
1
1
  export function useAttachmentListContextValues_unstable(state) {
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
- };
2
+ const { numberOfAttachments, onAttachmentDismiss, shouldUseOverflow } = state;
3
+ // This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
4
+ const attachmentList = {
5
+ numberOfAttachments,
6
+ onAttachmentDismiss,
7
+ shouldUseOverflow
8
+ };
9
+ return {
10
+ attachmentList
11
+ };
16
12
  }
17
- //# sourceMappingURL=useAttachmentListContextValues.js.map
@@ -0,0 +1,44 @@
1
+ import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';
2
+ import { tokens } from '@fluentui-copilot/tokens';
3
+ export const attachmentListClassNames = {
4
+ root: 'fai-AttachmentList',
5
+ menuList: 'fai-AttachmentList__menuList',
6
+ menuPopover: 'fai-AttachmentList__menuPopover',
7
+ overflowMenuButton: 'fai-AttachmentList__overflowMenuButton'
8
+ };
9
+ const useRootBaseClassName = makeResetStyles({
10
+ columnGap: tokens.spacingHorizontalSNudge,
11
+ display: 'flex',
12
+ flexDirection: 'row',
13
+ flexShrink: 0,
14
+ flexWrap: 'wrap',
15
+ rowGap: tokens.spacingVerticalXS
16
+ });
17
+ const useOverflowMenuButtonBaseClassName = makeResetStyles({
18
+ display: 'inline-flex'
19
+ });
20
+ const useOverflowMenuPopoverNextStyles = makeStyles({
21
+ borderRadius: {
22
+ borderRadius: tokens.borderRadius4XL
23
+ }
24
+ });
25
+ /**
26
+ * Apply styling to the AttachmentList slots based on the state
27
+ */ export const useAttachmentListStyles_unstable = (state)=>{
28
+ 'use no memo';
29
+ const rootBaseClassName = useRootBaseClassName();
30
+ const overflowMenuButtonClassName = useOverflowMenuButtonBaseClassName();
31
+ const overflowMenuPopoverNextStyles = useOverflowMenuPopoverNextStyles();
32
+ const { designVersion } = state;
33
+ state.root.className = mergeClasses(attachmentListClassNames.root, rootBaseClassName, state.root.className);
34
+ if (state.menuList) {
35
+ state.menuList.className = mergeClasses(attachmentListClassNames.menuList, state.menuList.className);
36
+ }
37
+ if (state.menuPopover) {
38
+ state.menuPopover.className = mergeClasses(attachmentListClassNames.menuPopover, designVersion === 'next' && overflowMenuPopoverNextStyles.borderRadius, state.menuPopover.className);
39
+ }
40
+ if (state.overflowMenuButton) {
41
+ state.overflowMenuButton.className = mergeClasses(attachmentListClassNames.overflowMenuButton, overflowMenuButtonClassName, state.overflowMenuButton.className);
42
+ }
43
+ return state;
44
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useAttachmentListStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\nimport type { AttachmentListSlots, AttachmentListState } from './AttachmentList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const attachmentListClassNames: SlotClassNames<AttachmentListSlots> = {\n root: 'fai-AttachmentList',\n menuList: 'fai-AttachmentList__menuList',\n menuPopover: 'fai-AttachmentList__menuPopover',\n overflowMenuButton: 'fai-AttachmentList__overflowMenuButton',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'flex',\n flexDirection: 'row',\n flexShrink: 0,\n flexWrap: 'wrap',\n rowGap: tokens.spacingVerticalXS,\n});\n\nconst useOverflowMenuButtonBaseClassName = makeResetStyles({\n display: 'inline-flex',\n});\n\nconst useOverflowMenuPopoverNextStyles = makeStyles({\n borderRadius: {\n borderRadius: tokens.borderRadius4XL,\n },\n});\n\n/**\n * Apply styling to the AttachmentList slots based on the state\n */\nexport const useAttachmentListStyles_unstable = (state: AttachmentListState): AttachmentListState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const overflowMenuButtonClassName = useOverflowMenuButtonBaseClassName();\n const overflowMenuPopoverNextStyles = useOverflowMenuPopoverNextStyles();\n const { designVersion } = state;\n\n state.root.className = mergeClasses(attachmentListClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.menuList) {\n state.menuList.className = mergeClasses(attachmentListClassNames.menuList, state.menuList.className);\n }\n if (state.menuPopover) {\n state.menuPopover.className = mergeClasses(\n attachmentListClassNames.menuPopover,\n designVersion === 'next' && overflowMenuPopoverNextStyles.borderRadius,\n state.menuPopover.className,\n );\n }\n\n if (state.overflowMenuButton) {\n state.overflowMenuButton.className = mergeClasses(\n attachmentListClassNames.overflowMenuButton,\n overflowMenuButtonClassName,\n state.overflowMenuButton.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","attachmentListClassNames","root","menuList","menuPopover","overflowMenuButton","useRootBaseClassName","columnGap","spacingHorizontalSNudge","display","flexDirection","flexShrink","flexWrap","rowGap","spacingVerticalXS","useOverflowMenuButtonBaseClassName","useOverflowMenuPopoverNextStyles","borderRadius","borderRadius4XL","useAttachmentListStyles_unstable","state","rootBaseClassName","overflowMenuButtonClassName","overflowMenuPopoverNextStyles","designVersion","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACvF,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;IACNC,UAAU;IACVC,aAAa;IACbC,oBAAoB;AACtB,EAAE;AAEF,MAAMC,uBAAuBT,gBAAgB;IAC3CU,WAAWP,OAAOQ,uBAAuB;IACzCC,SAAS;IACTC,eAAe;IACfC,YAAY;IACZC,UAAU;IACVC,QAAQb,OAAOc,iBAAiB;AAClC;AAEA,MAAMC,qCAAqClB,gBAAgB;IACzDY,SAAS;AACX;AAEA,MAAMO,mCAAmClB,WAAW;IAClDmB,cAAc;QACZA,cAAcjB,OAAOkB,eAAe;IACtC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,oBAAoBf;IAC1B,MAAMgB,8BAA8BP;IACpC,MAAMQ,gCAAgCP;IACtC,MAAM,EAAEQ,aAAa,EAAE,GAAGJ;IAE1BA,MAAMlB,IAAI,CAACuB,SAAS,GAAG1B,aAAaE,yBAAyBC,IAAI,EAAEmB,mBAAmBD,MAAMlB,IAAI,CAACuB,SAAS;IAE1G,IAAIL,MAAMjB,QAAQ,EAAE;QAClBiB,MAAMjB,QAAQ,CAACsB,SAAS,GAAG1B,aAAaE,yBAAyBE,QAAQ,EAAEiB,MAAMjB,QAAQ,CAACsB,SAAS;IACrG;IACA,IAAIL,MAAMhB,WAAW,EAAE;QACrBgB,MAAMhB,WAAW,CAACqB,SAAS,GAAG1B,aAC5BE,yBAAyBG,WAAW,EACpCoB,kBAAkB,UAAUD,8BAA8BN,YAAY,EACtEG,MAAMhB,WAAW,CAACqB,SAAS;IAE/B;IAEA,IAAIL,MAAMf,kBAAkB,EAAE;QAC5Be,MAAMf,kBAAkB,CAACoB,SAAS,GAAG1B,aACnCE,yBAAyBI,kBAAkB,EAC3CiB,6BACAF,MAAMf,kBAAkB,CAACoB,SAAS;IAEtC;IAEA,OAAOL;AACT,EAAE"}
@@ -2,14 +2,13 @@ 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 = 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
- });
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,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=AttachmentOverflowMenu.types.js.map
1
+ export { };
@@ -2,4 +2,3 @@ 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,18 +1,13 @@
1
- import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
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
- 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;
6
+ */ export const renderAttachmentOverflowMenu_unstable = (state, contextValues)=>{
7
+ const { menuContextValues, attachmentOverflowMenuContextValues } = contextValues;
8
+ assertSlots(state);
9
+ return state.isOverflowing ? /*#__PURE__*/ _jsx(AttachmentOverflowMenuProvider, {
10
+ value: attachmentOverflowMenuContextValues.attachmentOverflowMenu,
11
+ children: renderMenu_unstable(state, menuContextValues)
12
+ }) : null;
17
13
  };
18
- //# sourceMappingURL=renderAttachmentOverflowMenu.js.map
@@ -6,19 +6,13 @@ 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
- 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
- };
9
+ */ export const useAttachmentOverflowMenu_unstable = (props)=>{
10
+ const menuState = useMenu_unstable(props);
11
+ const { isOverflowing, ref: overflowButtonRef, overflowCount } = useOverflowMenu();
12
+ return {
13
+ ...menuState,
14
+ isOverflowing,
15
+ overflowButtonRef,
16
+ overflowCount
17
+ };
23
18
  };
24
- //# sourceMappingURL=useAttachmentOverflowMenu.js.map
@@ -1,17 +1,12 @@
1
1
  export function useAttachmentOverflowMenuContextValues_unstable(state) {
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
- };
2
+ const { isOverflowing, overflowButtonRef, overflowCount } = state;
3
+ // This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
4
+ const attachmentOverflowMenu = {
5
+ isOverflowing,
6
+ overflowButtonRef,
7
+ overflowCount
8
+ };
9
+ return {
10
+ attachmentOverflowMenu
11
+ };
16
12
  }
17
- //# sourceMappingURL=useAttachmentOverflowMenuContextValues.js.map
@@ -3,11 +3,10 @@ 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__*/React.forwardRef((props, ref) => {
7
- const state = useAttachmentOverflowMenuButton_unstable(props, ref);
8
- useAttachmentOverflowMenuButtonStyles_unstable(state);
9
- useCustomStyleHook('useAttachmentOverflowMenuButtonStyles')(state);
10
- return renderAttachmentOverflowMenuButton_unstable(state);
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
@@ -1,4 +1,3 @@
1
1
  /**
2
2
  * State used in rendering AttachmentOverflowMenuButton
3
- */export {};
4
- //# sourceMappingURL=AttachmentOverflowMenuButton.types.js.map
3
+ */ export { };
@@ -2,4 +2,3 @@ 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,14 +1,15 @@
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 { MenuTrigger, assertSlots } from '@fluentui/react-components';
3
3
  /**
4
4
  * Render the final JSX of AttachmentOverflowMenuButton
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;
5
+ */ export const renderAttachmentOverflowMenuButton_unstable = (state)=>{
6
+ assertSlots(state);
7
+ return state.isOverflowing ? /*#__PURE__*/ _jsx(MenuTrigger, {
8
+ children: /*#__PURE__*/ _jsxs(state.root, {
9
+ children: [
10
+ state.root.children,
11
+ state.isLoading && /*#__PURE__*/ _jsx(state.progress, {})
12
+ ]
13
+ })
14
+ }) : null;
13
15
  };
14
- //# sourceMappingURL=renderAttachmentOverflowMenuButton.js.map
@@ -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
- 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
- };
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
- 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;
55
+ if (props.children) {
56
+ return props.children;
70
57
  }
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}`;
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