@fluentui-copilot/react-attachments 0.9.3 → 0.9.4

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 (56) hide show
  1. package/CHANGELOG.json +16 -1
  2. package/CHANGELOG.md +11 -2
  3. package/dist/index.d.ts +22 -6
  4. package/lib/components/Attachment/Attachment.types.js.map +1 -1
  5. package/lib/components/Attachment/renderAttachment.js +10 -2
  6. package/lib/components/Attachment/renderAttachment.js.map +1 -1
  7. package/lib/components/Attachment/useAttachment.js +19 -7
  8. package/lib/components/Attachment/useAttachment.js.map +1 -1
  9. package/lib/components/Attachment/useAttachmentStyles.js +7 -0
  10. package/lib/components/Attachment/useAttachmentStyles.js.map +1 -1
  11. package/lib/components/AttachmentList/AttachmentList.types.js.map +1 -1
  12. package/lib/components/AttachmentList/renderAttachmentList.js +30 -3
  13. package/lib/components/AttachmentList/renderAttachmentList.js.map +1 -1
  14. package/lib/components/AttachmentList/useAttachmentList.js +79 -11
  15. package/lib/components/AttachmentList/useAttachmentList.js.map +1 -1
  16. package/lib/components/AttachmentList/useAttachmentListContextValues.js +4 -2
  17. package/lib/components/AttachmentList/useAttachmentListContextValues.js.map +1 -1
  18. package/lib/components/AttachmentList/useAttachmentListStyles.js +9 -1
  19. package/lib/components/AttachmentList/useAttachmentListStyles.js.map +1 -1
  20. package/lib/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js.map +1 -1
  21. package/lib/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +1 -1
  22. package/lib/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js.map +1 -1
  23. package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +8 -0
  24. package/lib/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js.map +1 -1
  25. package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +21 -8
  26. package/lib/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js.map +1 -1
  27. package/lib/contexts/attachmentListContext.js +2 -1
  28. package/lib/contexts/attachmentListContext.js.map +1 -1
  29. package/lib/index.js.map +1 -1
  30. package/lib-commonjs/components/Attachment/Attachment.types.js.map +1 -1
  31. package/lib-commonjs/components/Attachment/renderAttachment.js +6 -1
  32. package/lib-commonjs/components/Attachment/renderAttachment.js.map +1 -1
  33. package/lib-commonjs/components/Attachment/useAttachment.js +15 -7
  34. package/lib-commonjs/components/Attachment/useAttachment.js.map +1 -1
  35. package/lib-commonjs/components/Attachment/useAttachmentStyles.js +12 -0
  36. package/lib-commonjs/components/Attachment/useAttachmentStyles.js.map +1 -1
  37. package/lib-commonjs/components/AttachmentList/AttachmentList.types.js.map +1 -1
  38. package/lib-commonjs/components/AttachmentList/renderAttachmentList.js +29 -1
  39. package/lib-commonjs/components/AttachmentList/renderAttachmentList.js.map +1 -1
  40. package/lib-commonjs/components/AttachmentList/useAttachmentList.js +80 -10
  41. package/lib-commonjs/components/AttachmentList/useAttachmentList.js.map +1 -1
  42. package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js +3 -2
  43. package/lib-commonjs/components/AttachmentList/useAttachmentListContextValues.js.map +1 -1
  44. package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.js +9 -1
  45. package/lib-commonjs/components/AttachmentList/useAttachmentListStyles.js.map +1 -1
  46. package/lib-commonjs/components/AttachmentOverflowMenuButton/AttachmentOverflowMenuButton.types.js.map +1 -1
  47. package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js +1 -2
  48. package/lib-commonjs/components/AttachmentOverflowMenuButton/renderAttachmentOverflowMenuButton.js.map +1 -1
  49. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js +5 -0
  50. package/lib-commonjs/components/AttachmentOverflowMenuButton/useAttachmentOverflowMenuButton.js.map +1 -1
  51. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js +18 -7
  52. package/lib-commonjs/components/AttachmentOverflowMenuItem/useAttachmentOverflowMenuItem.js.map +1 -1
  53. package/lib-commonjs/contexts/attachmentListContext.js +2 -1
  54. package/lib-commonjs/contexts/attachmentListContext.js.map +1 -1
  55. package/lib-commonjs/index.js.map +1 -1
  56. package/package.json +2 -1
@@ -9,12 +9,40 @@ Object.defineProperty(exports, "renderAttachmentList_unstable", {
9
9
  }
10
10
  });
11
11
  const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactjsxruntime = require("@fluentui/react-jsx-runtime");
12
13
  const _reactcomponents = require("@fluentui/react-components");
13
14
  const _attachmentListContext = require("../../contexts/attachmentListContext");
15
+ const _AttachmentOverflowMenu = require("../AttachmentOverflowMenu");
16
+ const _AttachmentOverflowMenuItem = require("../AttachmentOverflowMenuItem");
14
17
  const renderAttachmentList_unstable = (state, contextValues)=>{
15
18
  (0, _reactcomponents.assertSlots)(state);
19
+ const { attachments, overflowMenuProps, root, shouldUseOverflow } = state;
16
20
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_attachmentListContext.AttachmentListProvider, {
17
21
  value: contextValues.attachmentList,
18
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
22
+ children: shouldUseOverflow ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.Overflow, {
23
+ ref: root.ref,
24
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
25
+ children: [
26
+ root.children,
27
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_AttachmentOverflowMenu.AttachmentOverflowMenu, {
28
+ positioning: 'above',
29
+ ...overflowMenuProps,
30
+ children: [
31
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(state.overflowMenuButton, {}),
32
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.MenuPopover, {
33
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.MenuList, {
34
+ children: attachments.map((attachment)=>{
35
+ return /*#__PURE__*/ (0, _reactjsxruntime.createElement)(_AttachmentOverflowMenuItem.AttachmentOverflowMenuItem, {
36
+ ...attachment,
37
+ key: attachment.id
38
+ });
39
+ })
40
+ })
41
+ })
42
+ ]
43
+ })
44
+ ]
45
+ })
46
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
19
47
  });
20
48
  }; //# sourceMappingURL=renderAttachmentList.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["renderAttachmentList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport { AttachmentListProvider } from '../../contexts/attachmentListContext';\nimport type { AttachmentListState, AttachmentListSlots, AttachmentListContextValues } from './AttachmentList.types';\n\n/**\n * Render the final JSX of AttachmentList\n */\nexport const renderAttachmentList_unstable = (\n state: AttachmentListState,\n contextValues: AttachmentListContextValues,\n) => {\n assertSlots<AttachmentListSlots>(state);\n\n return (\n <AttachmentListProvider value={contextValues.attachmentList}>\n <state.root />\n </AttachmentListProvider>\n );\n};\n"],"names":["assertSlots","state","value","contextValues","attachmentList"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcEA;;;eAAAA;;;4BAdwB;iCAGE;uCACW;AAUrCA,MAAAA,gCAAiCC,CAAAA,OAAAA;oCAEjC,EAAAA;WAC0BC,WAAOC,GAAAA,IAAAA,eAAAA,EAAAA,6CAA4B,EAAA;6BACzDC,cAACH;;IAGL"}
1
+ {"version":3,"sources":["renderAttachmentList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { MenuList, MenuPopover, Overflow, assertSlots } from '@fluentui/react-components';\nimport { AttachmentListProvider } from '../../contexts/attachmentListContext';\nimport { AttachmentOverflowMenu } from '../AttachmentOverflowMenu';\nimport { AttachmentOverflowMenuItem } from '../AttachmentOverflowMenuItem';\nimport type { AttachmentListState, AttachmentListSlots, AttachmentListContextValues } from './AttachmentList.types';\n\n/**\n * Render the final JSX of AttachmentList\n */\nexport const renderAttachmentList_unstable = (\n state: AttachmentListState,\n contextValues: AttachmentListContextValues,\n) => {\n assertSlots<AttachmentListSlots>(state);\n const { attachments, overflowMenuProps, root, shouldUseOverflow } = state;\n\n return (\n <AttachmentListProvider value={contextValues.attachmentList}>\n {shouldUseOverflow ? (\n <Overflow ref={root.ref}>\n <state.root>\n {root.children}\n <AttachmentOverflowMenu positioning={'above'} {...overflowMenuProps}>\n <state.overflowMenuButton />\n <MenuPopover>\n <MenuList>\n {attachments.map(attachment => {\n return <AttachmentOverflowMenuItem {...attachment} key={attachment.id} />;\n })}\n </MenuList>\n </MenuPopover>\n </AttachmentOverflowMenu>\n </state.root>\n </Overflow>\n ) : (\n <state.root />\n )}\n </AttachmentListProvider>\n );\n};\n"],"names":["assertSlots","state","attachments","contextValues","shouldUseOverflow","root","children","positioning","_jsx","Overflow","overflowMenuButton","attachment","MenuList"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBEA;;;eAAAA;;;4BAfF;;iCAE6D;uCACtB;wCACA;4CACI;AAUzCA,MAAAA,gCAAiCC,CAAAA,OAAAA;oCACzBC,EAAAA;UAER,aACiCC,mBAC5BC;sBAGMC,GAAAA,IAAAA,eAAKC,EAAAA,6CAAQ,EAAA;2CACd;sCAAwBC,WAAa,GAAAC,IAAAA,eAAA,EAAAC,yBAAA,EAAA;;;;;+BACnC,GAACR,IAAAA,gBAAAA,EAAMS,8CAAkB,EAAA;;;;uFAGJC,EAAAA,CAAAA;4BAAAA,WAAAA,GAAAA,IAAAA,eAAAA,EAAAA,4BAAAA,EAAAA;6EACfC,yBAAA,EAAA;;+FAAwDD,EAAAA,sDAAa,EAAA;;8DACvE;;;;;;;;;gDAOVV,MAACA,IAAAA,EAAMI,CAAAA;;AAIf"}
@@ -12,21 +12,24 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactcomponents = require("@fluentui/react-components");
14
14
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
15
- const _reactoverflow = require("@fluentui/react-overflow");
15
+ const _reactutilities = require("@fluentui/react-utilities");
16
+ const _Attachment = require("../Attachment");
17
+ const _AttachmentOverflowMenuButton = require("../AttachmentOverflowMenuButton");
18
+ const _AttachmentOverflowMenuItem = require("../AttachmentOverflowMenuItem");
19
+ const _useAttachmentOverflowMenuButtonStyles = require("../AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles");
16
20
  const useAttachmentList_unstable = (props, ref)=>{
17
- const { onAttachmentDismiss } = props;
18
- const attachmentsVisibilityStatus = (0, _reactoverflow.useOverflowContext)((context)=>context.itemVisibility);
21
+ const { children, maxVisibleAttachments, onAttachmentDismiss, overflowMenuProps } = props;
19
22
  const innerRef = _react.useRef(null);
23
+ const [setTimeout] = (0, _reactutilities.useTimeout)();
20
24
  const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
21
- const { findNextFocusable, findPrevFocusable } = (0, _reactcomponents.useFocusFinders)();
25
+ const { findNextFocusable, findPrevFocusable, findLastFocusable } = (0, _reactcomponents.useFocusFinders)();
26
+ const [attachments, setAttachments] = _react.useState([]);
22
27
  const handleAttachmentDismiss = (0, _reactcomponents.useEventCallback)((e, data)=>{
23
28
  var _innerRef_current;
24
29
  if (!onAttachmentDismiss) {
25
30
  return;
26
31
  }
27
32
  onAttachmentDismiss(e, data);
28
- // Remove attachment from overflow context
29
- attachmentsVisibilityStatus === null || attachmentsVisibilityStatus === void 0 ? true : delete attachmentsVisibilityStatus[data.id];
30
33
  // set focus after attachment dismiss
31
34
  const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
32
35
  if ((_innerRef_current = innerRef.current) === null || _innerRef_current === void 0 ? void 0 : _innerRef_current.contains(activeElement)) {
@@ -35,34 +38,101 @@ const useAttachmentList_unstable = (props, ref)=>{
35
38
  container: innerRef.current
36
39
  });
37
40
  if (next) {
38
- next.focus();
39
- return;
41
+ // focus on the overflow button if the next focusable element is the overflow button.
42
+ // if overflow button is removed from the DOM, focus on the last focusable element in the attachment list.
43
+ if (next.classList.contains(_useAttachmentOverflowMenuButtonStyles.attachmentOverflowMenuButtonClassNames.root)) {
44
+ setTimeout(()=>{
45
+ var _findLastFocusable;
46
+ (_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
47
+ }, 0);
48
+ } else {
49
+ next.focus();
50
+ }
40
51
  } else {
41
52
  const prev = findPrevFocusable(activeElement === null || activeElement === void 0 ? void 0 : activeElement.parentElement, {
42
53
  container: innerRef.current
43
54
  });
44
55
  prev === null || prev === void 0 ? void 0 : prev.focus();
45
56
  }
57
+ } else {
58
+ // Handles keyboard focus when attachment removed is in the overflow menu. Also handles focus when the overflow button is removed from the DOM.
59
+ setTimeout(()=>{
60
+ var _findLastFocusable;
61
+ (_findLastFocusable = findLastFocusable(innerRef.current)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
62
+ }, 0);
46
63
  }
47
64
  });
65
+ const attachmentOverflowClassName = (0, _Attachment.useOverflowStyles)().overflow;
66
+ const resolvedChildren = _react.useMemo(()=>{
67
+ if (maxVisibleAttachments !== undefined) {
68
+ const results = [];
69
+ const childrenArray = _react.Children.toArray(children);
70
+ for(let index = 0; index < childrenArray.length; index++){
71
+ const child = childrenArray[index];
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ if (index >= maxVisibleAttachments && /*#__PURE__*/ _react.isValidElement(child)) {
74
+ results.push(/*#__PURE__*/ _react.cloneElement(child, {
75
+ ...child.props,
76
+ className: (0, _reactcomponents.mergeClasses)(child.props.className, attachmentOverflowClassName)
77
+ }));
78
+ } else {
79
+ results.push(child);
80
+ }
81
+ }
82
+ return results;
83
+ }
84
+ return children;
85
+ }, [
86
+ attachmentOverflowClassName,
87
+ children,
88
+ maxVisibleAttachments
89
+ ]);
90
+ _react.useEffect(()=>{
91
+ if (resolvedChildren && Array.isArray(resolvedChildren)) {
92
+ setAttachments(resolvedChildren.map((child)=>child.props));
93
+ }
94
+ }, [
95
+ resolvedChildren
96
+ ]);
48
97
  const arrowNavigationProps = (0, _reactcomponents.useArrowNavigationGroup)({
49
98
  circular: true,
50
99
  axis: 'both',
51
100
  memorizeCurrent: true
52
101
  });
102
+ const shouldUseOverflow = maxVisibleAttachments !== undefined;
53
103
  return {
104
+ attachments,
54
105
  onAttachmentDismiss: handleAttachmentDismiss,
106
+ shouldUseOverflow,
107
+ overflowMenuProps,
55
108
  components: {
56
- root: 'div'
109
+ root: 'div',
110
+ overflowMenuButton: 'span',
111
+ overflowMenuItem: 'span'
57
112
  },
58
113
  root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
59
114
  'aria-label': 'Attachments',
60
115
  ref: (0, _reactcomponents.useMergedRefs)(ref, innerRef),
61
116
  role: 'toolbar',
62
117
  ...arrowNavigationProps,
63
- ...props
118
+ ...props,
119
+ children: resolvedChildren
64
120
  }), {
65
121
  elementType: 'div'
122
+ }),
123
+ overflowMenuButton: _reactcomponents.slot.optional(props.overflowMenuButton, {
124
+ defaultProps: {
125
+ children: /*#__PURE__*/ _react.createElement(_AttachmentOverflowMenuButton.AttachmentOverflowMenuButton, null)
126
+ },
127
+ elementType: 'span',
128
+ renderByDefault: true
129
+ }),
130
+ overflowMenuItem: _reactcomponents.slot.optional(props.overflowMenuItem, {
131
+ defaultProps: {
132
+ children: /*#__PURE__*/ _react.createElement(_AttachmentOverflowMenuItem.AttachmentOverflowMenuItem, null)
133
+ },
134
+ elementType: 'span',
135
+ renderByDefault: true
66
136
  })
67
137
  };
68
138
  }; //# sourceMappingURL=useAttachmentList.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useAttachmentList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n slot,\n useArrowNavigationGroup,\n useEventCallback,\n useFocusFinders,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useOverflowContext } from '@fluentui/react-overflow';\nimport type { AttachmentListProps, AttachmentListState } from './AttachmentList.types';\n\n/**\n * Create the state required to render AttachmentList.\n *\n * The returned state can be modified with hooks such as useAttachmentListStyles_unstable,\n * before being passed to renderAttachmentList_unstable.\n *\n * @param props - props from this instance of AttachmentList\n * @param ref - reference to root HTMLElement of AttachmentList\n */\nexport const useAttachmentList_unstable = (\n props: AttachmentListProps,\n ref: React.Ref<HTMLDivElement>,\n): AttachmentListState => {\n const { onAttachmentDismiss } = props;\n\n const attachmentsVisibilityStatus: Record<string, boolean> = useOverflowContext(context => context.itemVisibility);\n\n const innerRef = React.useRef<HTMLDivElement>(null);\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const handleAttachmentDismiss: AttachmentListState['onAttachmentDismiss'] = useEventCallback((e, data) => {\n if (!onAttachmentDismiss) {\n return;\n }\n\n onAttachmentDismiss(e, data);\n\n // Remove attachment from overflow context\n delete attachmentsVisibilityStatus?.[data.id];\n\n // set focus after attachment dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next attachment only if the active element is within the current attachment list\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n\n if (next) {\n next.focus();\n return;\n } else {\n const prev = findPrevFocusable(activeElement?.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n }\n });\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n return {\n onAttachmentDismiss: handleAttachmentDismiss,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n 'aria-label': 'Attachments',\n ref: useMergedRefs(ref, innerRef),\n role: 'toolbar',\n ...arrowNavigationProps,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["onAttachmentDismiss","props","React","attachmentsVisibilityStatus","findPrevFocusable","useFocusFinders","innerRef","handleAttachmentDismiss","useEventCallback","e","data","_innerRef_current","container","id","targetDocument","activeElement","current","contains","next","focus","arrowNavigationProps","circular","parentElement","axis","memorizeCurrent","prev","useArrowNavigationGroup","root","slot","always","getIntrinsicElementProps","ref","useMergedRefs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA0BUA;;;eAAAA;;;;iEA1Ba;iCAQhB;qCACyC;+BACb;AAgBjC,MAAQA,6BAAwBC,CAAAA,OAAAA;UAEhC,EAEAD,mBAAiBE,KACjBD;UACAE,8BAA2BC,IAAAA,iCAAsBC,EAAAA,CAAAA,UAAAA,QAAAA,cAAAA;UAEjDC,WAAMC,OAAAA,MAAAA,CAAAA;0BACCP,gDACH;UACF,mBAEAA,mBAEA,yCACOG;UAEPI,0BAAAC,IAAAA,iCAAqC,EAAA,CAAAC,GAAAC;YACrCC;YACA,CAAAX,qBAAIM;;;4BAE6DM,GAAWN;kDAAiB;wCAEjF,QAAAH,gCAAA,KAAA,IAAA,OAAA,OAAAA,2BAAA,CAAAO,KAAAG,EAAA,CAAA;6CACE;8BACVC,mBAAA,QAAAA,mBAAA,KAAA,IAAA,KAAA,IAAAA,eAAAC,aAAA;iCACKT,SAAAU,OAAA,MAAA,QAAAL,sBAAA,KAAA,IAAA,KAAA,IAAAA,kBAAAM,QAAA,CAAAF,gBAAA;wGAC0BA;2CAA0DT,eAAgB;2BAACA,SAAAU,OAAA;;sBAE5G;gBACFE,KAAAC,KAAA;gBACF;YAEA,OAAMC;gBACJC,MAAAA,OAAUjB,kBAAAW,kBAAA,QAAAA,kBAAA,KAAA,IAAA,KAAA,IAAAA,cAAAO,aAAA,EAAA;oBACVC,WAAMjB,SAAAU,OAAA;gBACNQ;gBACFC,SAAA,QAAAA,SAAA,KAAA,IAAA,KAAA,IAAAA,KAAAN,KAAA;YAEA;;;iCAGUO,IAAAA,wCAAA,EAAA;kBACR;cACAC;yBAEI;;;6BAGGP;oBACAnB;kBAEL;;cAAqB2B,qBAAA,CAAAC,MAAA,CAAAC,IAAAA,yCAAA,EAAA,OAAA;YAEzB,cAAA;YACAC,KAAAC,IAAAA,8BAAA,EAAAD,KAAAzB"}
1
+ {"version":3,"sources":["useAttachmentList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n mergeClasses,\n slot,\n useArrowNavigationGroup,\n useEventCallback,\n useFocusFinders,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useOverflowStyles as useAttachmentOverflowStyles } from '../Attachment';\nimport { AttachmentOverflowMenuButton } from '../AttachmentOverflowMenuButton';\nimport { AttachmentOverflowMenuItem } from '../AttachmentOverflowMenuItem';\nimport { attachmentOverflowMenuButtonClassNames } from '../AttachmentOverflowMenuButton/useAttachmentOverflowMenuButtonStyles';\nimport type { AttachmentListProps, AttachmentListState } from './AttachmentList.types';\nimport type { AttachmentProps } from '../Attachment';\n\n/**\n * Create the state required to render AttachmentList.\n *\n * The returned state can be modified with hooks such as useAttachmentListStyles_unstable,\n * before being passed to renderAttachmentList_unstable.\n *\n * @param props - props from this instance of AttachmentList\n * @param ref - reference to root HTMLElement of AttachmentList\n */\nexport const useAttachmentList_unstable = (\n props: AttachmentListProps,\n ref: React.Ref<HTMLDivElement>,\n): AttachmentListState => {\n const { children, maxVisibleAttachments, onAttachmentDismiss, overflowMenuProps } = props;\n const innerRef = React.useRef<HTMLDivElement>(null);\n const [setTimeout] = useTimeout();\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable, findLastFocusable } = useFocusFinders();\n const [attachments, setAttachments] = React.useState<AttachmentProps[]>([]);\n const handleAttachmentDismiss: AttachmentListState['onAttachmentDismiss'] = useEventCallback((e, data) => {\n if (!onAttachmentDismiss) {\n return;\n }\n\n onAttachmentDismiss(e, data);\n\n // set focus after attachment dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next attachment only if the active element is within the current attachment list\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n if (next) {\n // focus on the overflow button if the next focusable element is the overflow button.\n // if overflow button is removed from the DOM, focus on the last focusable element in the attachment list.\n if (next.classList.contains(attachmentOverflowMenuButtonClassNames.root)) {\n setTimeout(() => {\n findLastFocusable(innerRef.current as HTMLElement)?.focus();\n }, 0);\n } else {\n next.focus();\n }\n } else {\n const prev = findPrevFocusable(activeElement?.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n } else {\n // Handles keyboard focus when attachment removed is in the overflow menu. Also handles focus when the overflow button is removed from the DOM.\n setTimeout(() => {\n findLastFocusable(innerRef.current as HTMLElement)?.focus();\n }, 0);\n }\n });\n\n const attachmentOverflowClassName = useAttachmentOverflowStyles().overflow;\n const resolvedChildren = React.useMemo(() => {\n if (maxVisibleAttachments !== undefined) {\n const results = [];\n const childrenArray = React.Children.toArray(children);\n for (let index = 0; index < childrenArray.length; index++) {\n const child = childrenArray[index] as React.ReactElement;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (index >= maxVisibleAttachments && React.isValidElement<any>(child)) {\n results.push(\n React.cloneElement(child, {\n ...child.props,\n className: mergeClasses(child.props.className, attachmentOverflowClassName),\n }),\n );\n } else {\n results.push(child);\n }\n }\n\n return results;\n }\n return children;\n }, [attachmentOverflowClassName, children, maxVisibleAttachments]);\n\n React.useEffect(() => {\n if (resolvedChildren && Array.isArray(resolvedChildren)) {\n setAttachments(resolvedChildren.map(child => child.props));\n }\n }, [resolvedChildren]);\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n const shouldUseOverflow = maxVisibleAttachments !== undefined;\n\n return {\n attachments,\n onAttachmentDismiss: handleAttachmentDismiss,\n shouldUseOverflow,\n overflowMenuProps,\n components: {\n root: 'div',\n overflowMenuButton: 'span',\n overflowMenuItem: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n 'aria-label': 'Attachments',\n ref: useMergedRefs(ref, innerRef),\n role: 'toolbar',\n ...arrowNavigationProps,\n ...props,\n children: resolvedChildren,\n }),\n { elementType: 'div' },\n ),\n overflowMenuButton: slot.optional(props.overflowMenuButton, {\n defaultProps: { children: <AttachmentOverflowMenuButton /> },\n elementType: 'span',\n renderByDefault: true,\n }),\n overflowMenuItem: slot.optional(props.overflowMenuItem, {\n defaultProps: { children: <AttachmentOverflowMenuItem /> },\n elementType: 'span',\n renderByDefault: true,\n }),\n };\n};\n"],"names":["children","maxVisibleAttachments","props","onAttachmentDismiss","setTimeout","targetDocument","findNextFocusable","overflowMenuProps","attachments","innerRef","activeElement","next","container","current","useState","useEventCallback","e","data","findLastFocusable","_innerRef_current","contains","prev","root","_findLastFocusable","focus","findPrevFocusable","parentElement","attachmentOverflowClassName","undefined","React","isValidElement","useAttachmentOverflowStyles","overflow","useMemo","child","childrenArray","Children","toArray","index","results","useEffect","resolvedChildren","useArrowNavigationGroup","circular","axis","Array","isArray","memorizeCurrent","map","shouldUseOverflow","arrowNavigationProps","components","overflowMenuItem","ref","elementType","overflowMenuButton","slot","defaultProps","optional","createElement","AttachmentOverflowMenuButton","AttachmentOverflowMenuItem"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgCUA;;;eAAAA;;;;iEAhCa;iCAShB;qCACyC;gCACrB;4BACsC;8CACpB;4CACF;uDACY;AAiBrD,MAAQA,6BAAUC,CAAqBC,OAAEC;UACzC,EACAH,QAAOI,EACPH,qBAAQI,EACRF,mBAAQG,EACRC,iBAAOC,KACPN;qBASMO,OAAAA,MAAAA,CAAAA;UARJ,CAAAL,WAAKD,GAAAA,IAAAA,0BAAAA;0BAEL,gDAEAA;UAEA,mBACMO,mBACFD,mBACF,yCACME;wBAAyDC,eAAoBC,GAAAA,OAAOC,QAAA,CAAA,EAAA;oCAACC,IAAAA,iCAAA,EAAA,CAAAC,GAAAC;;kCAEzF;;;4BAGEb,GAAAA;6CACEc;8BAAAA,mBAAAA,QAAAA,mBAAkBT,KAASI,IAAO,KAAA,IAAAR,eAAlCa,aAAAA;iCACCT,SAAAI,OAAA,MAAA,QAAAM,sBAAA,KAAA,IAAA,KAAA,IAAAA,kBAAAC,QAAA,CAAAV,gBAAA;wGACE;2CACKA,eAAA;2BACZD,SAAAI,OAAA;;sBAEA;qGAAyG;0HAAC;yBAC1GQ,SAAAA,CAAAA,QAAAA,CAAAA,6EAAW,CAAAC,IAAA,GAAA;+BACb;wBACF,IAAOC;wBACLA,CAAAA,qBAAAL,kBAAAT,SAAAI,OAAA,CAAA,MAAA,QAAAU,uBAAA,KAAA,IAAA,KAAA,IAAAA,mBAAAC,KAAA;uBACApB;;8BACEc;;mBAEJ;gBACF,MAAAG,OAAAI,kBAAAf,kBAAA,QAAAA,kBAAA,KAAA,IAAA,KAAA,IAAAA,cAAAgB,aAAA,EAAA;oBAEMC,WAAAA,SAAAA,OAAAA;gBACN;gBACEN,SAAIpB,QAAAA,SAAAA,KAA0B2B,IAAAA,KAAAA,IAAWP,KAAAG,KAAA;;;2JAGoB;uBACzD;;sCAEavB,kBAAAA,SAAAA,OAAAA,CAAAA,MAAyB4B,QAAMC,uBAA4B,KAAA,IAAA,KAAA,IAAAP,mBAAAC,KAAA;;;;wCAKpEO,IAAAA,6BAAA,IAAAC,QAAA;6BAEGH,OAAAI,OAAA,CAAA;sCACQC,WAAAA;4BACf,EAAA;kBACFC,gBAAAN,OAAAO,QAAA,CAAAC,OAAA,CAAArC;oBAEAsC,QAAOC,GAAAA,QAAAA,cAAAA,MAAAA,EAAAA,QAAAA;gBACT,MAAAL,QAAAC,aAAA,CAAAG,MAAA;gBACA,8DAAOtC;gBACN,IAAAsC,SAAArC,yBAAA,WAAA,GAAA4B,OAAAC,cAAA,CAAAI,QAAA;oBAACP,QAAAA,IAAAA,CAAAA,WAAAA,GAAAA,OAAAA,YAAAA,CAAAA,OAAAA;wBAA6B3B,GAAAA,MAAAA,KAAAA;wBAAUC,WAAAA,IAAAA,6BAAAA,EAAAA,MAAAA,KAAAA,CAAAA,SAAAA,EAAAA;oBAAsB;gBAEjE4B,OAAMW;oBACJD,QAAIE,IAAAA,CAAAA;;;YAGN,OAAGF;;eAAkBvC;OAErB;QAAA2B;QAA6Be;QAAAA;KAAwB;WACnDC,SAAAA,CAAU;YACVC,oBAAMC,MAAAC,OAAA,CAAAL,mBAAA;2BACNM,iBAAiBC,GAAA,CAAAd,CAAAA,QAAAA,MAAAhC,KAAA;QACnB;OAEA;QAAAuC;KAAMQ;UAENC,uBAAOR,IAAAA,wCAAA,EAAA;kBACLlC;cACAL;yBACA8C;;UAEAE,oBAAYlD,0BAAA2B;;;6BAGVwB;;;oBAIE;kBACAC;gCACM;8BACHH;;mCAEHlD,CAAAA,MAAAA,CAAUyC,IAAAA,yCAAAA,EAAAA,OAAAA;0BAEZ;mDAAEa,EAAaD,KAAA5C;kBAAM;eAEvB8C,oBAAoBC;oBAClBC;sBAAgBzD;;yBAChBsD;;4BAEFE,qBAAA,CAAAE,QAAA,CAAAxD,MAAAqD,kBAAA,EAAA;0BACAH;0BACEK,WAAc,GAAA5B,OAAA8B,aAAA,CAAAC,0DAAA,EAAA;;yBAA2C;6BACzDN;;0BAEFE,qBAAA,CAAAE,QAAA,CAAAxD,MAAAkD,gBAAA,EAAA;YACFK,cAAA;gBACAzD,UAAA,WAAA,GAAA6B,OAAA8B,aAAA,CAAAE,sDAAA,EAAA"}
@@ -9,10 +9,11 @@ Object.defineProperty(exports, "useAttachmentListContextValues_unstable", {
9
9
  }
10
10
  });
11
11
  function useAttachmentListContextValues_unstable(state) {
12
- const { onAttachmentDismiss } = state;
12
+ const { onAttachmentDismiss, shouldUseOverflow } = state;
13
13
  // This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
14
14
  const attachmentList = {
15
- onAttachmentDismiss
15
+ onAttachmentDismiss,
16
+ shouldUseOverflow
16
17
  };
17
18
  return {
18
19
  attachmentList
@@ -1 +1 @@
1
- {"version":3,"sources":["useAttachmentListContextValues.ts"],"sourcesContent":["import type { AttachmentListContextValues, AttachmentListState } from './AttachmentList.types';\n\nexport function useAttachmentListContextValues_unstable(state: AttachmentListState): AttachmentListContextValues {\n const { onAttachmentDismiss } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const attachmentList = {\n onAttachmentDismiss,\n };\n\n return { attachmentList };\n}\n"],"names":["useAttachmentListContextValues_unstable","state","onAttachmentDismiss","attachmentList"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,wCAAwCC,KAA0B;UAChF,EAEAC,mBAAA,KACAD;uGACEC;UACFC,iBAAA;QAEAD;;WAAwB;QAC1BC"}
1
+ {"version":3,"sources":["useAttachmentListContextValues.ts"],"sourcesContent":["import type { AttachmentListContextValues, AttachmentListState } from './AttachmentList.types';\n\nexport function useAttachmentListContextValues_unstable(state: AttachmentListState): AttachmentListContextValues {\n const { onAttachmentDismiss, shouldUseOverflow } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const attachmentList = {\n onAttachmentDismiss,\n shouldUseOverflow,\n };\n\n return { attachmentList };\n}\n"],"names":["useAttachmentListContextValues_unstable","state","onAttachmentDismiss","shouldUseOverflow","attachmentList"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,wCAAwCC,KAA0B;UAChF,EAEAC,mBAAA,EACAC,iBAAMC;uGAEJD;UACFC,iBAAA;QAEAF;;;IACF,OAAA"}
@@ -18,7 +18,9 @@ _export(exports, {
18
18
  });
19
19
  const _reactcomponents = require("@fluentui/react-components");
20
20
  const attachmentListClassNames = {
21
- root: 'fai-AttachmentList'
21
+ root: 'fai-AttachmentList',
22
+ overflowMenuButton: 'fai-AttachmentList__overflowMenuButton',
23
+ overflowMenuItem: 'fai-AttachmentList__overflowMenuItem'
22
24
  };
23
25
  const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r168fwfa", null, [
24
26
  ".r168fwfa{column-gap:var(--spacingHorizontalSNudge);display:flex;flex-direction:row;flex-shrink:0;flex-wrap:wrap;row-gap:var(--spacingVerticalXS);}"
@@ -26,5 +28,11 @@ const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r168fwfa", nul
26
28
  const useAttachmentListStyles_unstable = (state)=>{
27
29
  const rootBaseClassName = useRootBaseClassName();
28
30
  state.root.className = (0, _reactcomponents.mergeClasses)(attachmentListClassNames.root, rootBaseClassName, state.root.className);
31
+ if (state.overflowMenuButton) {
32
+ state.overflowMenuButton.className = (0, _reactcomponents.mergeClasses)(attachmentListClassNames.overflowMenuButton, state.overflowMenuButton.className);
33
+ }
34
+ if (state.overflowMenuItem) {
35
+ state.overflowMenuItem.className = (0, _reactcomponents.mergeClasses)(attachmentListClassNames.overflowMenuItem, state.overflowMenuItem.className);
36
+ }
29
37
  return state;
30
38
  }; //# sourceMappingURL=useAttachmentListStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useAttachmentListStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens } from '@fluentui/react-components';\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};\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\n/**\n * Apply styling to the AttachmentList slots based on the state\n */\nexport const useAttachmentListStyles_unstable = (state: AttachmentListState): AttachmentListState => {\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(attachmentListClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["attachmentListClassNames","flexShrink","root","useRootBaseClassName","makeResetStyles","state","flexWrap","rowGap","tokens","spacingVerticalXS","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAQXC,gCAAY;eAAZA;;;iCAZ4C;AAIvC,MAAMD,2BAAgE;UAC3EE;AACF;AAEA,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;CAAA;AAI3CH,MAAAA,mCAAYI,CAAAA;UACZC,oBAAUH;UACVI,IAAQC,CAAAA,SAAOC,GAAAA,IAAAA,6BAAiB,EAAAT,yBAAAE,IAAA,EAAAQ,mBAAAL,MAAAH,IAAA,CAAAS,SAAA;IAClC,OAAAN;AAEA"}
1
+ {"version":3,"sources":["useAttachmentListStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens } from '@fluentui/react-components';\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 overflowMenuButton: 'fai-AttachmentList__overflowMenuButton',\n overflowMenuItem: 'fai-AttachmentList__overflowMenuItem',\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\n/**\n * Apply styling to the AttachmentList slots based on the state\n */\nexport const useAttachmentListStyles_unstable = (state: AttachmentListState): AttachmentListState => {\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(attachmentListClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.overflowMenuButton) {\n state.overflowMenuButton.className = mergeClasses(\n attachmentListClassNames.overflowMenuButton,\n state.overflowMenuButton.className,\n );\n }\n\n if (state.overflowMenuItem) {\n state.overflowMenuItem.className = mergeClasses(\n attachmentListClassNames.overflowMenuItem,\n state.overflowMenuItem.className,\n );\n }\n return state;\n};\n"],"names":["attachmentListClassNames","flexShrink","root","overflowMenuButton","overflowMenuItem","useRootBaseClassName","makeResetStyles","state","flexWrap","rowGap","tokens","spacingVerticalXS","rootBaseClassName","className","mergeClasses","useAttachmentListStyles_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAUXC,gCAAY;eAAZA;;;iCAd4C;AAIvC,MAAMD,2BAAgE;UAC3EE;wBACAC;sBACAC;AACF;AAEA,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;CAAA;AAI3CL,MAAAA,mCAAYM,CAAAA;UACZC,oBAAUH;UACVI,IAAQC,CAAAA,SAAOC,GAAAA,IAAAA,6BAAiB,EAAAX,yBAAAE,IAAA,EAAAU,mBAAAL,MAAAL,IAAA,CAAAW,SAAA;IAClC,IAAAN,MAAAJ,kBAAA,EAAA;QAEAI,MAAAJ,kBAAA,CAAAU,SAAA,GAAAC,IAAAA,6BAAA,EAAAd,yBAAAG,kBAAA,EAAAI,MAAAJ,kBAAA,CAAAU,SAAA;;IAEC,IACDN,MAAOH,gBAAMW,EAAAA;QACXR,MAAMK,gBAAAA,CAAAA,SAAoBP,GAAAA,IAAAA,6BAAAA,EAAAA,yBAAAA,gBAAAA,EAAAA,MAAAA,gBAAAA,CAAAA,SAAAA;;WAGtBE;sDAKJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["AttachmentOverflowMenuButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ProgressBar, Slot } from '@fluentui/react-components';\nimport type { AttachmentOverflowMenuState } from '../AttachmentOverflowMenu';\n\nexport type AttachmentOverflowMenuButtonSlots = {\n root: NonNullable<Slot<'button'>>;\n progress: NonNullable<Slot<typeof ProgressBar>>;\n};\n\n/**\n * AttachmentOverflowMenuButton Props\n */\nexport type AttachmentOverflowMenuButtonProps = ComponentProps<Partial<AttachmentOverflowMenuButtonSlots>> & {\n /**\n * Toggle prop to indicate that there are Attachments in the overflow menu that's currently loading.\n * Setting this to true will show an indeterminate progress bar on the button.\n * @default false\n */\n isLoading?: boolean;\n};\n\n/**\n * State used in rendering AttachmentOverflowMenuButton\n */\nexport type AttachmentOverflowMenuButtonState = ComponentState<AttachmentOverflowMenuButtonSlots> &\n Pick<AttachmentOverflowMenuState, 'isOverflowing' | 'overflowCount'> &\n Pick<AttachmentOverflowMenuButtonProps, 'isLoading'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAoBA;;CAEC"}
1
+ {"version":3,"sources":["AttachmentOverflowMenuButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ProgressBar, Slot } from '@fluentui/react-components';\nimport type { AttachmentOverflowMenuState } from '../AttachmentOverflowMenu';\n\nexport type AttachmentOverflowMenuButtonSlots = {\n root: NonNullable<Slot<'button'>>;\n progress: NonNullable<Slot<typeof ProgressBar>>;\n};\n\n/**\n * AttachmentOverflowMenuButton Props\n */\nexport type AttachmentOverflowMenuButtonProps = ComponentProps<Partial<AttachmentOverflowMenuButtonSlots>> & {\n /**\n * Toggle prop to indicate that there are Attachments in the overflow menu that's currently loading.\n * Setting this to true will show an indeterminate progress bar on the button.\n * @default false\n */\n isLoading?: boolean;\n text?: string | ((overflowCount: number) => React.ReactNode);\n};\n\n/**\n * State used in rendering AttachmentOverflowMenuButton\n */\nexport type AttachmentOverflowMenuButtonState = ComponentState<AttachmentOverflowMenuButtonSlots> &\n Pick<AttachmentOverflowMenuState, 'isOverflowing' | 'overflowCount'> &\n Pick<AttachmentOverflowMenuButtonProps, 'isLoading'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAqBA;;CAEC"}
@@ -15,8 +15,7 @@ const renderAttachmentOverflowMenuButton_unstable = (state)=>{
15
15
  return state.isOverflowing ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.MenuTrigger, {
16
16
  children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
17
17
  children: [
18
- "+",
19
- state.overflowCount,
18
+ state.root.children,
20
19
  state.isLoading && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.progress, {})
21
20
  ]
22
21
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["renderAttachmentOverflowMenuButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { MenuTrigger, assertSlots } from '@fluentui/react-components';\nimport type {\n AttachmentOverflowMenuButtonState,\n AttachmentOverflowMenuButtonSlots,\n} from './AttachmentOverflowMenuButton.types';\n\n/**\n * Render the final JSX of AttachmentOverflowMenuButton\n */\nexport const renderAttachmentOverflowMenuButton_unstable = (state: AttachmentOverflowMenuButtonState) => {\n assertSlots<AttachmentOverflowMenuButtonSlots>(state);\n\n return state.isOverflowing ? (\n <MenuTrigger>\n <state.root>\n +{state.overflowCount}\n {state.isLoading && <state.progress />}\n </state.root>\n </MenuTrigger>\n ) : null;\n};\n"],"names":["assertSlots","state","root","MenuTrigger","overflowCount","isLoading","_jsx","progress"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaEA;;;eAAAA;;;4BAZF;iCAEyC;AAUvCA,MAAAA,8CAA+CC,CAAAA;oCAExCA,EAAAA;8BAEH,GAAA,WAACA,GAAMC,IAAAA,eAAI,EAAAC,4BAAA,EAAA;;sBAAC;gBAAA;gBAAAF,MAAAG,aAAA;gBAAAH,MAAAI,SAAA,IAAA,WAAA,GAAAC,IAAAA,eAAA,EAAAL,MAAAM,QAAA,EAAA,CAAA;aAAA"}
1
+ {"version":3,"sources":["renderAttachmentOverflowMenuButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { MenuTrigger, assertSlots } from '@fluentui/react-components';\nimport type {\n AttachmentOverflowMenuButtonState,\n AttachmentOverflowMenuButtonSlots,\n} from './AttachmentOverflowMenuButton.types';\n\n/**\n * Render the final JSX of AttachmentOverflowMenuButton\n */\nexport const renderAttachmentOverflowMenuButton_unstable = (state: AttachmentOverflowMenuButtonState) => {\n assertSlots<AttachmentOverflowMenuButtonSlots>(state);\n\n return state.isOverflowing ? (\n <MenuTrigger>\n <state.root>\n {state.root.children}\n {state.isLoading && <state.progress />}\n </state.root>\n </MenuTrigger>\n ) : null;\n};\n"],"names":["assertSlots","state","root","MenuTrigger","children","isLoading","_jsx","progress"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaEA;;;eAAAA;;;4BAZF;iCAEyC;AAUvCA,MAAAA,8CAA+CC,CAAAA;oCAExCA,EAAAA;8BAEH,GAAA,WAACA,GAAMC,IAAAA,eAAI,EAAAC,4BAAA,EAAA;;sBACRF;gBAAAA,MAAMC,IAAKE,CAAAA,QAAQ;gBAAAH,MAAAI,SAAA,IAAA,WAAA,GAAAC,IAAAA,eAAA,EAAAL,MAAAM,QAAA,EAAA,CAAA;aAAA;;;iEAItB"}
@@ -11,8 +11,10 @@ Object.defineProperty(exports, "useAttachmentOverflowMenuButton_unstable", {
11
11
  const _reactcomponents = require("@fluentui/react-components");
12
12
  const _attachmentOverflowMenuContext = require("../../contexts/attachmentOverflowMenuContext");
13
13
  const useAttachmentOverflowMenuButton_unstable = (props, ref)=>{
14
+ const { children, text } = props;
14
15
  const { isOverflowing, overflowCount, overflowButtonRef } = (0, _attachmentOverflowMenuContext.useAttachmentOverflowMenuContext_unstable)((context)=>context);
15
16
  const isLoading = !!props.isLoading;
17
+ const processedText = children !== null && children !== void 0 ? children : typeof text === 'function' ? text(overflowCount) : text;
16
18
  return {
17
19
  components: {
18
20
  root: 'button',
@@ -22,6 +24,9 @@ const useAttachmentOverflowMenuButton_unstable = (props, ref)=>{
22
24
  ref: (0, _reactcomponents.useMergedRefs)(ref, overflowButtonRef),
23
25
  ...props
24
26
  }), {
27
+ defaultProps: {
28
+ children: processedText !== null && processedText !== void 0 ? processedText : `+${overflowCount}`
29
+ },
25
30
  elementType: 'button'
26
31
  }),
27
32
  progress: _reactcomponents.slot.always(props.progress, {
@@ -1 +1 @@
1
- {"version":3,"sources":["useAttachmentOverflowMenuButton.ts"],"sourcesContent":["import { ProgressBar, getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-components';\nimport { useAttachmentOverflowMenuContext_unstable } from '../../contexts/attachmentOverflowMenuContext';\nimport type {\n AttachmentOverflowMenuButtonProps,\n AttachmentOverflowMenuButtonState,\n} from './AttachmentOverflowMenuButton.types';\n\n/**\n * Create the state required to render AttachmentOverflowMenuButton.\n *\n * The returned state can be modified with hooks such as useAttachmentOverflowMenuButtonStyles_unstable,\n * before being passed to renderAttachmentOverflowMenuButton_unstable.\n *\n * @param props - props from this instance of AttachmentOverflowMenuButton\n * @param ref - reference to root HTMLElement of AttachmentOverflowMenuButton\n */\nexport const useAttachmentOverflowMenuButton_unstable = (\n props: AttachmentOverflowMenuButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): AttachmentOverflowMenuButtonState => {\n const { isOverflowing, overflowCount, overflowButtonRef } = useAttachmentOverflowMenuContext_unstable(\n context => context,\n );\n const isLoading = !!props.isLoading;\n\n return {\n components: {\n root: 'button',\n progress: ProgressBar,\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(ref, overflowButtonRef),\n ...props,\n }),\n { elementType: 'button' },\n ),\n progress: slot.always(props.progress, {\n defaultProps: { value: undefined, shape: 'square', thickness: 'large', 'aria-label': 'Loading' },\n elementType: ProgressBar,\n }),\n isOverflowing,\n overflowCount,\n isLoading,\n };\n};\n"],"names":["isOverflowing","overflowButtonRef","useAttachmentOverflowMenuContext_unstable","components","ProgressBar","isLoading","props","root","ref","slot","always","getIntrinsicElementProps","progress","defaultProps","shape","elementType","overflowCount"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBUA;;;eAAAA;;;iCApBiE;+CACjB;AAmBxD,MAAQA,2CAA8BC,CAAAA,OAAsBC;UAG5D,EAEAF,aAAO,eACLG,mBACQ,iFACIC,EAAAA,CAAAA,UAAAA;UACZC,YAAA,CAAA,CAAAC,MAAAD,SAAA;WACAE;oBAEIC;kBACA;sBAEFJ,4BAAA;;cAAwBK,qBAAA,CAAAC,MAAA,CAAAC,IAAAA,yCAAA,EAAA,UAAA;iBAE1BC,IAAAA,8BAAeF,EAAAA,KAAOJ;oBACpBO;;yBAAkCC;;uCAAqC,CAAAJ,MAAA,CAAAJ,MAAcM,QAAA,EAAA;0BAAU;uBAC/FG;gBACFD,OAAA;gBACAd,WAAAA;gBACAgB,cAAAA;;YAEFD,aAAAX,4BAAA;QACA"}
1
+ {"version":3,"sources":["useAttachmentOverflowMenuButton.ts"],"sourcesContent":["import { ProgressBar, getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-components';\nimport { useAttachmentOverflowMenuContext_unstable } from '../../contexts/attachmentOverflowMenuContext';\nimport type {\n AttachmentOverflowMenuButtonProps,\n AttachmentOverflowMenuButtonState,\n} from './AttachmentOverflowMenuButton.types';\n\n/**\n * Create the state required to render AttachmentOverflowMenuButton.\n *\n * The returned state can be modified with hooks such as useAttachmentOverflowMenuButtonStyles_unstable,\n * before being passed to renderAttachmentOverflowMenuButton_unstable.\n *\n * @param props - props from this instance of AttachmentOverflowMenuButton\n * @param ref - reference to root HTMLElement of AttachmentOverflowMenuButton\n */\nexport const useAttachmentOverflowMenuButton_unstable = (\n props: AttachmentOverflowMenuButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): AttachmentOverflowMenuButtonState => {\n const { children, text } = props;\n const { isOverflowing, overflowCount, overflowButtonRef } = useAttachmentOverflowMenuContext_unstable(\n context => context,\n );\n const isLoading = !!props.isLoading;\n\n const processedText = children ?? (typeof text === 'function' ? text(overflowCount) : text);\n return {\n components: {\n root: 'button',\n progress: ProgressBar,\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(ref, overflowButtonRef),\n ...props,\n }),\n { defaultProps: { children: processedText ?? `+${overflowCount}` }, elementType: 'button' },\n ),\n progress: slot.always(props.progress, {\n defaultProps: { value: undefined, shape: 'square', thickness: 'large', 'aria-label': 'Loading' },\n elementType: ProgressBar,\n }),\n isOverflowing,\n overflowCount,\n isLoading,\n };\n};\n"],"names":["children","props","isLoading","text","components","root","progress","getIntrinsicElementProps","context","useMergedRefs","overflowButtonRef","overflowCount","defaultProps","ProgressBar","slot","always","shape","thickness","processedText","isOverflowing"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBUA;;;eAAAA;;;iCApBiE;+CACjB;AAmBxD,MAAQA,2CAAmBC,CAAAA,OAAAA;UAC3B,EAGAD,QAAME,EAENC,IAAA,KACAF;UACEG,eACEC,eACAC,mBACF,iFAEEC,EAAAA,CAAAA,UAAyBC;sBAClBC,CAAAA,CAAAA,MAAAA,SAAmBC;0BAChBV,aAAA,QAAAA,aAAA,KAAA,IAAAA,WAAA,OAAAG,SAAA,aAAAA,KAAAQ,iBAAAR;WACV;oBACES;;sBAA+DC,4BAAA;;cAAyBC,qBAAA,CAAAC,MAAA,CAAAR,IAAAA,yCAAA,EAAA,UAAA;iBAE5FD,IAAAA,8BAAeS,EAAAA,KAAOd;oBACpBW;;0BAAkCI;0BAAiBC,kBAAW,QAAAC,kBAAA,KAAA,IAAAA,gBAAA,CAAA,CAAA,EAAAP,cAAA,CAAA;;yBAAiC;;kBAEjGG,qBAAA,CAAAC,MAAA,CAAAd,MAAAK,QAAA,EAAA;0BACAa;gBACAR,OAAAA;gBACAT,OAAAA;gBACFe,WAAA;gBACA,cAAA"}
@@ -12,23 +12,34 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactcomponents = require("@fluentui/react-components");
14
14
  const _reacticons = require("@fluentui/react-icons");
15
+ const _reactoverflow = require("@fluentui/react-overflow");
15
16
  const _attachmentListContext = require("../../contexts/attachmentListContext");
16
17
  const useAttachmentOverflowMenuItem_unstable = (props, ref)=>{
17
- const { id, imageOnly, media } = props;
18
+ const { imageOnly, media } = props;
18
19
  const DismissIcon = (0, _reacticons.bundleIcon)(_reacticons.Dismiss20Filled, _reacticons.Dismiss20Regular);
19
- const isVisible = (0, _reactcomponents.useIsOverflowItemVisible)(id);
20
- const onAttachmentDismiss = (0, _attachmentListContext.useAttachmentListContext_unstable)((context)=>context.onAttachmentDismiss);
20
+ const menuItemId = (0, _reactcomponents.useId)('attachment-', props.id);
21
+ const isVisible = (0, _reactcomponents.useIsOverflowItemVisible)(menuItemId);
22
+ const { onAttachmentDismiss, shouldUseOverflow } = (0, _attachmentListContext.useAttachmentListContext_unstable)((context)=>context);
23
+ const attachmentsVisibilityStatus = (0, _reactoverflow.useOverflowContext)((context)=>context.itemVisibility);
21
24
  const root = _reactcomponents.slot.always({
22
25
  ref,
23
26
  icon: media,
24
27
  secondaryContent: /*#__PURE__*/ _react.createElement(DismissIcon, null),
25
- ...props
28
+ ...props,
29
+ id: menuItemId
26
30
  }, {
27
31
  elementType: _reactcomponents.MenuItem
28
32
  });
29
- root.onClick = (0, _reactcomponents.mergeCallbacks)(root.onClick, (ev)=>onAttachmentDismiss === null || onAttachmentDismiss === void 0 ? void 0 : onAttachmentDismiss(ev, {
30
- id
31
- }));
33
+ root.onClick = (0, _reactcomponents.mergeCallbacks)(root.onClick, (ev)=>{
34
+ onAttachmentDismiss === null || onAttachmentDismiss === void 0 ? void 0 : onAttachmentDismiss(ev, {
35
+ content: props.children,
36
+ media,
37
+ id: menuItemId
38
+ });
39
+ if (shouldUseOverflow) {
40
+ delete attachmentsVisibilityStatus[menuItemId];
41
+ }
42
+ });
32
43
  const progress = _reactcomponents.slot.optional(props.progress, {
33
44
  defaultProps: {
34
45
  shape: 'square',
@@ -1 +1 @@
1
- {"version":3,"sources":["useAttachmentOverflowMenuItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MenuItem, ProgressBar, mergeCallbacks, slot, useIsOverflowItemVisible } from '@fluentui/react-components';\nimport { Dismiss20Filled, Dismiss20Regular, bundleIcon } from '@fluentui/react-icons';\nimport { useAttachmentListContext_unstable } from '../../contexts/attachmentListContext';\nimport type {\n AttachmentOverflowMenuItemProps,\n AttachmentOverflowMenuItemState,\n} from './AttachmentOverflowMenuItem.types';\n\n/**\n * Create the state required to render AttachmentOverflowMenuItem.\n *\n * The returned state can be modified with hooks such as useAttachmentOverflowMenuItemStyles_unstable,\n * before being passed to renderAttachmentOverflowMenuItem_unstable.\n *\n * @param props - props from this instance of AttachmentOverflowMenuItem\n * @param ref - reference to root HTMLElement of AttachmentOverflowMenuItem\n */\nexport const useAttachmentOverflowMenuItem_unstable = (\n props: AttachmentOverflowMenuItemProps,\n ref: React.Ref<HTMLDivElement>,\n): AttachmentOverflowMenuItemState => {\n const { id, imageOnly, media } = props;\n const DismissIcon = bundleIcon(Dismiss20Filled, Dismiss20Regular);\n const isVisible = useIsOverflowItemVisible(id);\n\n const onAttachmentDismiss = useAttachmentListContext_unstable(context => context.onAttachmentDismiss);\n\n const root = slot.always(\n { ref, icon: media, secondaryContent: <DismissIcon />, ...props },\n { elementType: MenuItem },\n );\n root.onClick = mergeCallbacks(root.onClick, ev =>\n onAttachmentDismiss?.(ev, {\n id,\n }),\n );\n\n const progress = slot.optional(props.progress, {\n defaultProps: {\n shape: 'square',\n thickness: 'large',\n 'aria-labelledby': props.id,\n },\n elementType: ProgressBar,\n });\n\n return {\n components: {\n root: MenuItem,\n progress: ProgressBar,\n },\n root,\n progress,\n isVisible,\n imageOnly,\n };\n};\n"],"names":["id","props","imageOnly","onAttachmentDismiss","media","icon","secondaryContent","useAttachmentListContext_unstable","context","root","slot","always","mergeCallbacks","onClick","elementType","progress","shape","ev","optional","thickness","ProgressBar","isVisible"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBUA;;;eAAAA;;;;iEAtBa;iCAC+D;4BACxB;uCACZ;AAmBhD,MAAQA,yCAAyBC,CAAAA,OAAAA;UACjC,EACAD,EAAA,EAEAE,SAAMC,EAENC,KAAA;UACSC,cAAMD,IAAAA,sBAAAA,EAAAA,2BAAAA,EAAAA,4BAAAA;UAAOE,YAAAA,IAAAA,yCAAkB,EAAAN;UAAiBG,sBAAQI,IAAAA,wDAAA,EAAAC,CAAAA,UAAAA,QAAAL,mBAAA;UAC/DM,OAAAC,qBAAA,CAAAC,MAAA,CAAA;;QAAwBN,MAAAD;QAE1BK,kBAAeG,WAAAA,GAAeH,OAAKI,aACjCV,CAAAA,aAAAA;gBACEH;;QAIJc,aAAMC,yBAAWL;;gBAEbM,GAAAA,IAAAA,+BAAO,EAAAP,KAAAI,OAAA,EAAAI,CAAAA,KAAAd,wBAAA,QAAAA,wBAAA,KAAA,IAAA,KAAA,IAAAA,oBAAAc,IAAA;;;UAGTF,WAAAL,qBAAA,CAAAQ,QAAA,CAAAjB,MAAAc,QAAA,EAAA;sBACAD;YACFE,OAAA;YAEAG,WAAO;+BACOlB,MAAAD,EAAA;;qBAEVe,4BAAUK;;WAEZX;oBACAM;kBACAM,yBAAAA;sBACAnB,4BAAAA;QACF;QACAO"}
1
+ {"version":3,"sources":["useAttachmentOverflowMenuItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n MenuItem,\n ProgressBar,\n mergeCallbacks,\n slot,\n useId,\n useIsOverflowItemVisible,\n} from '@fluentui/react-components';\nimport { Dismiss20Filled, Dismiss20Regular, bundleIcon } from '@fluentui/react-icons';\nimport { useOverflowContext } from '@fluentui/react-overflow';\nimport { useAttachmentListContext_unstable } from '../../contexts/attachmentListContext';\nimport type {\n AttachmentOverflowMenuItemProps,\n AttachmentOverflowMenuItemState,\n} from './AttachmentOverflowMenuItem.types';\n\n/**\n * Create the state required to render AttachmentOverflowMenuItem.\n *\n * The returned state can be modified with hooks such as useAttachmentOverflowMenuItemStyles_unstable,\n * before being passed to renderAttachmentOverflowMenuItem_unstable.\n *\n * @param props - props from this instance of AttachmentOverflowMenuItem\n * @param ref - reference to root HTMLElement of AttachmentOverflowMenuItem\n */\nexport const useAttachmentOverflowMenuItem_unstable = (\n props: AttachmentOverflowMenuItemProps,\n ref: React.Ref<HTMLDivElement>,\n): AttachmentOverflowMenuItemState => {\n const { imageOnly, media } = props;\n const DismissIcon = bundleIcon(Dismiss20Filled, Dismiss20Regular);\n const menuItemId = useId('attachment-', props.id);\n const isVisible = useIsOverflowItemVisible(menuItemId);\n const { onAttachmentDismiss, shouldUseOverflow } = useAttachmentListContext_unstable(context => context);\n\n const attachmentsVisibilityStatus: Record<string, boolean> = useOverflowContext(context => context.itemVisibility);\n\n const root = slot.always(\n { ref, icon: media, secondaryContent: <DismissIcon />, ...props, id: menuItemId },\n { elementType: MenuItem },\n );\n root.onClick = mergeCallbacks(root.onClick, ev => {\n onAttachmentDismiss?.(ev, { content: props.children, media, id: menuItemId });\n if (shouldUseOverflow) {\n delete attachmentsVisibilityStatus[menuItemId];\n }\n });\n\n const progress = slot.optional(props.progress, {\n defaultProps: {\n shape: 'square',\n thickness: 'large',\n 'aria-labelledby': props.id,\n },\n elementType: ProgressBar,\n });\n\n return {\n components: {\n root: MenuItem,\n progress: ProgressBar,\n },\n root,\n progress,\n isVisible,\n imageOnly,\n };\n};\n"],"names":["imageOnly","props","menuItemId","media","DismissIcon","attachmentsVisibilityStatus","useOverflowContext","context","slot","always","id","ref","icon","secondaryContent","itemVisibility","elementType","MenuItem","root","onClick","onAttachmentDismiss","content","mergeCallbacks","ev","children","defaultProps","progress","optional","components","ProgressBar","isVisible"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA8BUA;;;eAAAA;;;;iEA9Ba;iCAQhB;4BACuD;+BAC3B;uCACe;AAmBhD,MAAQA,yCAAqBC,CAAAA,OAAAA;UAC7B,EACAD,SAAME,EACNC,KAAA,KACAF;UAEAG,cAAMC,IAAAA,sBAAAA,EAAAA,2BAAuDC,EAAAA,4BAAmBC;UAEhFL,aAAaM,IAAAA,sBAAKC,EAAAA,eAChBR,MAAAS,EAAA;UAAEC,YAAAA,IAAAA,yCAAAA,EAAAA;UAAKC,qBAAaC,mBAA2C,iEAAMX,EAAAA,CAAAA,UAAAA;UACrEG,8BAAAC,IAAAA,iCAAA,EAAAC,CAAAA,UAAAA,QAAAO,cAAA;UAAEC,OAAAA,qBAAAA,CAAAA,MAAaC,CAAAA;QAASL;QAE1BM,MAAKC;0BACHC,WAAAA,GAAAA,OAAAA,aAAAA,CAAAA,aAAAA;gBAA4BC;;;qBAA+CJ,yBAAA;;gBAEzE,GAAAK,IAAAA,+BAAOhB,EAAAA,KAAAA,OAAAA,EAA2BiB,CAAAA;gCACpC,QAAAH,wBAAA,KAAA,IAAA,KAAA,IAAAA,oBAAAG,IAAA;YACFF,SAAAnB,MAAAsB,QAAA;YAEApB;gBACEqB;;+BAEa;mBACXnB,2BAA2B,CAAAH,WAAA;;;UAG/BuB,WAAAjB,qBAAA,CAAAkB,QAAA,CAAAzB,MAAAwB,QAAA,EAAA;QAEAD,cAAO;mBACLG;uBACEV;+BACUW,MAAAA,EAAAA;;qBAEZX,4BAAAA;;WAEAY;oBACA7B;YACFiB,MAAAD,yBAAA;YACAS,UAAAG,4BAAA"}
@@ -22,7 +22,8 @@ _export(exports, {
22
22
  const _reactcontextselector = require("@fluentui/react-context-selector");
23
23
  const AttachmentListContext = (0, _reactcontextselector.createContext)(undefined);
24
24
  const attachmentListContextDefaultValue = {
25
- onAttachmentDismiss: ()=>null
25
+ onAttachmentDismiss: ()=>null,
26
+ shouldUseOverflow: false
26
27
  };
27
28
  const AttachmentListProvider = AttachmentListContext.Provider;
28
29
  const useAttachmentListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(AttachmentListContext, (ctx = attachmentListContextDefaultValue)=>selector(ctx)); //# sourceMappingURL=attachmentListContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["attachmentListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { AttachmentListProps } from '../components/index';\n\nexport const AttachmentListContext: Context<AttachmentListContextValue> = createContext<\n AttachmentListContextValue | undefined\n>(undefined) as Context<AttachmentListContextValue>;\n\nconst attachmentListContextDefaultValue: AttachmentListContextValue = {\n onAttachmentDismiss: () => null,\n};\n\n/**\n * Context shared between AttachmentList and its children components\n */\nexport type AttachmentListContextValue = Pick<AttachmentListProps, 'onAttachmentDismiss'>;\n\nexport const AttachmentListProvider = AttachmentListContext.Provider;\n\nexport const useAttachmentListContext_unstable = <T>(selector: ContextSelector<AttachmentListContextValue, T>) =>\n useContextSelector(AttachmentListContext, (ctx = attachmentListContextDefaultValue) => selector(ctx));\n"],"names":["AttachmentListContext","AttachmentListProvider","useAttachmentListContext_unstable","createContext","undefined","attachmentListContextDefaultValue","onAttachmentDismiss","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,qBAAAA;eAAAA;;IAaAC,sBAAAA;eAAAA;;IAEAC,iCAAAA;eAAAA;;;sCAnBqC;AAI3C,MAAMF,wBAA6DG,IAAAA,mCAAAA,EAExEC;AAEF,MAAMC,oCAAgE;yBACpEC,IAA2B;AAC7B;AAOO,MAAML,yBAAyBD,sBAAsBO,QAAQ;AAE7D,MAAML,oCAAoCM,CAAAA,WAC/CC,IAAAA,wCAAAA,EAAmBT,uBAAuB,CAACU,MAAML,iCAAiC,GAAKG,SAASE"}
1
+ {"version":3,"sources":["attachmentListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { AttachmentListState } from '../components/index';\n\nexport const AttachmentListContext: Context<AttachmentListContextValue> = createContext<\n AttachmentListContextValue | undefined\n>(undefined) as Context<AttachmentListContextValue>;\n\nconst attachmentListContextDefaultValue: AttachmentListContextValue = {\n onAttachmentDismiss: () => null,\n shouldUseOverflow: false,\n};\n\n/**\n * Context shared between AttachmentList and its children components\n */\nexport type AttachmentListContextValue = Pick<AttachmentListState, 'onAttachmentDismiss' | 'shouldUseOverflow'>;\n\nexport const AttachmentListProvider = AttachmentListContext.Provider;\n\nexport const useAttachmentListContext_unstable = <T>(selector: ContextSelector<AttachmentListContextValue, T>) =>\n useContextSelector(AttachmentListContext, (ctx = attachmentListContextDefaultValue) => selector(ctx));\n"],"names":["AttachmentListContext","AttachmentListProvider","useAttachmentListContext_unstable","createContext","undefined","attachmentListContextDefaultValue","onAttachmentDismiss","shouldUseOverflow","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,qBAAAA;eAAAA;;IAcAC,sBAAAA;eAAAA;;IAEAC,iCAAAA;eAAAA;;;sCApBqC;AAI3C,MAAMF,wBAA6DG,IAAAA,mCAAAA,EAExEC;AAEF,MAAMC,oCAAgE;yBACpEC,IAA2B;uBAC3BC;AACF;AAOO,MAAMN,yBAAyBD,sBAAsBQ,QAAQ;AAE7D,MAAMN,oCAAoCO,CAAAA,WAC/CC,IAAAA,wCAAAA,EAAmBV,uBAAuB,CAACW,MAAMN,iCAAiC,GAAKI,SAASE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export type { AttachmentTagProps, AttachmentTagSlots, AttachmentTagState } from './AttachmentTag';\nexport {\n AttachmentTag,\n attachmentTagClassNames,\n renderAttachmentTag_unstable,\n useAttachmentTagStyles_unstable,\n useAttachmentTag_unstable,\n} from './AttachmentTag';\nexport type {\n AttachmentTagDismissedData,\n AttachmentTagListProps,\n AttachmentTagListSlots,\n AttachmentTagListState,\n} from './AttachmentTagList';\nexport {\n AttachmentTagList,\n attachmentTagListClassNames,\n renderAttachmentTagList_unstable,\n useAttachmentTagListStyles_unstable,\n useAttachmentTagList_unstable,\n} from './AttachmentTagList';\n\nexport type { AttachmentTagItemProps, AttachmentTagItemSlots, AttachmentTagItemState } from './AttachmentTagItem';\nexport {\n AttachmentTagItem,\n attachmentTagItemClassNames,\n renderAttachmentTagItem_unstable,\n useAttachmentTagItemStyles_unstable,\n useAttachmentTagItem_unstable,\n} from './AttachmentTagItem';\n\nexport type { AttachmentListProps, AttachmentListSlots, AttachmentListState } from './AttachmentList';\nexport {\n AttachmentList,\n attachmentListClassNames,\n renderAttachmentList_unstable,\n useAttachmentListStyles_unstable,\n useAttachmentList_unstable,\n} from './AttachmentList';\nexport type { AttachmentListContextValue } from './contexts/attachmentListContext';\nexport {\n AttachmentListContext,\n AttachmentListProvider,\n useAttachmentListContext_unstable,\n} from './contexts/attachmentListContext';\nexport type { AttachmentProps, AttachmentSlots, AttachmentState } from './Attachment';\nexport {\n Attachment,\n attachmentClassNames,\n renderAttachment_unstable,\n useAttachmentStyles_unstable,\n useAttachment_unstable,\n} from './Attachment';\n\nexport type {\n AttachmentOverflowMenuProps,\n AttachmentOverflowMenuSlots,\n AttachmentOverflowMenuState,\n} from './AttachmentOverflowMenu';\nexport {\n AttachmentOverflowMenu,\n renderAttachmentOverflowMenu_unstable,\n useAttachmentOverflowMenu_unstable,\n} from './AttachmentOverflowMenu';\n\nexport type { AttachmentOverflowMenuContextValue } from './contexts/attachmentOverflowMenuContext';\nexport {\n AttachmentOverflowMenuContext,\n AttachmentOverflowMenuProvider,\n useAttachmentOverflowMenuContext_unstable,\n} from './contexts/attachmentOverflowMenuContext';\n\nexport type {\n AttachmentOverflowMenuButtonProps,\n AttachmentOverflowMenuButtonSlots,\n AttachmentOverflowMenuButtonState,\n} from './AttachmentOverflowMenuButton';\nexport {\n AttachmentOverflowMenuButton,\n attachmentOverflowMenuButtonClassNames,\n renderAttachmentOverflowMenuButton_unstable,\n useAttachmentOverflowMenuButtonStyles_unstable,\n useAttachmentOverflowMenuButton_unstable,\n} from './AttachmentOverflowMenuButton';\n\nexport type {\n AttachmentOverflowMenuItemProps,\n AttachmentOverflowMenuItemSlots,\n AttachmentOverflowMenuItemState,\n} from './AttachmentOverflowMenuItem';\nexport {\n AttachmentOverflowMenuItem,\n attachmentOverflowMenuItemClassNames,\n renderAttachmentOverflowMenuItem_unstable,\n useAttachmentOverflowMenuItemStyles_unstable,\n useAttachmentOverflowMenuItem_unstable,\n} from './AttachmentOverflowMenuItem';\n"],"names":["Attachment","AttachmentList","AttachmentListContext","AttachmentListProvider","AttachmentOverflowMenu","AttachmentOverflowMenuButton","AttachmentOverflowMenuContext","AttachmentOverflowMenuItem","AttachmentOverflowMenuProvider","AttachmentTag","AttachmentTagItem","AttachmentTagList","attachmentClassNames","attachmentListClassNames","attachmentOverflowMenuButtonClassNames","attachmentOverflowMenuItemClassNames","attachmentTagClassNames","attachmentTagItemClassNames","attachmentTagListClassNames","renderAttachmentList_unstable","renderAttachmentOverflowMenuButton_unstable","renderAttachmentOverflowMenuItem_unstable","renderAttachmentOverflowMenu_unstable","renderAttachmentTagItem_unstable","renderAttachmentTagList_unstable","renderAttachmentTag_unstable","renderAttachment_unstable","useAttachmentListContext_unstable","useAttachmentListStyles_unstable","useAttachmentList_unstable","useAttachmentOverflowMenuButtonStyles_unstable","useAttachmentOverflowMenuButton_unstable","useAttachmentOverflowMenuContext_unstable","useAttachmentOverflowMenuItemStyles_unstable","useAttachmentOverflowMenuItem_unstable","useAttachmentOverflowMenu_unstable","useAttachmentStyles_unstable","useAttachmentTagItemStyles_unstable","useAttachmentTagItem_unstable","useAttachmentTagListStyles_unstable","useAttachmentTagList_unstable","useAttachmentTagStyles_unstable","useAttachmentTag_unstable","useAttachment_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA+CEA,UAAU;eAAVA,sBAAU;;IAdVC,cAAc;eAAdA,8BAAc;;IAQdC,qBAAqB;eAArBA,4CAAqB;;IACrBC,sBAAsB;eAAtBA,6CAAsB;;IAkBtBC,sBAAsB;eAAtBA,8CAAsB;;IAkBtBC,4BAA4B;eAA5BA,0DAA4B;;IAX5BC,6BAA6B;eAA7BA,4DAA6B;;IAwB7BC,0BAA0B;eAA1BA,sDAA0B;;IAvB1BC,8BAA8B;eAA9BA,6DAA8B;;IAlE9BC,aAAa;eAAbA,4BAAa;;IAsBbC,iBAAiB;eAAjBA,oCAAiB;;IATjBC,iBAAiB;eAAjBA,oCAAiB;;IAiCjBC,oBAAoB;eAApBA,gCAAoB;;IAdpBC,wBAAwB;eAAxBA,wCAAwB;;IA6CxBC,sCAAsC;eAAtCA,oEAAsC;;IAatCC,oCAAoC;eAApCA,gEAAoC;;IAzFpCC,uBAAuB;eAAvBA,sCAAuB;;IAsBvBC,2BAA2B;eAA3BA,8CAA2B;;IAT3BC,2BAA2B;eAA3BA,8CAA2B;;IAmB3BC,6BAA6B;eAA7BA,6CAA6B;;IA6C7BC,2CAA2C;eAA3CA,yEAA2C;;IAa3CC,yCAAyC;eAAzCA,qEAAyC;;IAhCzCC,qCAAqC;eAArCA,6DAAqC;;IAnCrCC,gCAAgC;eAAhCA,mDAAgC;;IAThCC,gCAAgC;eAAhCA,mDAAgC;;IAbhCC,4BAA4B;eAA5BA,2CAA4B;;IA6C5BC,yBAAyB;eAAzBA,qCAAyB;;IANzBC,iCAAiC;eAAjCA,wDAAiC;;IAPjCC,gCAAgC;eAAhCA,gDAAgC;;IAChCC,0BAA0B;eAA1BA,0CAA0B;;IA4C1BC,8CAA8C;eAA9CA,4EAA8C;;IAC9CC,wCAAwC;eAAxCA,sEAAwC;;IAbxCC,yCAAyC;eAAzCA,wEAAyC;;IAyBzCC,4CAA4C;eAA5CA,wEAA4C;;IAC5CC,sCAAsC;eAAtCA,kEAAsC;;IAjCtCC,kCAAkC;eAAlCA,0DAAkC;;IAZlCC,4BAA4B;eAA5BA,wCAA4B;;IAvB5BC,mCAAmC;eAAnCA,sDAAmC;;IACnCC,6BAA6B;eAA7BA,gDAA6B;;IAV7BC,mCAAmC;eAAnCA,sDAAmC;;IACnCC,6BAA6B;eAA7BA,gDAA6B;;IAd7BC,+BAA+B;eAA/BA,8CAA+B;;IAC/BC,yBAAyB;eAAzBA,wCAAyB;;IA6CzBC,sBAAsB;eAAtBA,kCAAsB;;;+BA5CjB;mCAaA;mCASA;gCASA;uCAMA;4BAQA;wCAWA;+CAOA;8CAaA;4CAaA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export type { AttachmentTagProps, AttachmentTagSlots, AttachmentTagState } from './AttachmentTag';\nexport {\n AttachmentTag,\n attachmentTagClassNames,\n renderAttachmentTag_unstable,\n useAttachmentTagStyles_unstable,\n useAttachmentTag_unstable,\n} from './AttachmentTag';\nexport type {\n AttachmentTagDismissedData,\n AttachmentTagListProps,\n AttachmentTagListSlots,\n AttachmentTagListState,\n} from './AttachmentTagList';\nexport {\n AttachmentTagList,\n attachmentTagListClassNames,\n renderAttachmentTagList_unstable,\n useAttachmentTagListStyles_unstable,\n useAttachmentTagList_unstable,\n} from './AttachmentTagList';\n\nexport type { AttachmentTagItemProps, AttachmentTagItemSlots, AttachmentTagItemState } from './AttachmentTagItem';\nexport {\n AttachmentTagItem,\n attachmentTagItemClassNames,\n renderAttachmentTagItem_unstable,\n useAttachmentTagItemStyles_unstable,\n useAttachmentTagItem_unstable,\n} from './AttachmentTagItem';\n\nexport type {\n AttachmentListProps,\n AttachmentListSlots,\n AttachmentListState,\n AttachmentDismissedData,\n} from './AttachmentList';\nexport {\n AttachmentList,\n attachmentListClassNames,\n renderAttachmentList_unstable,\n useAttachmentListStyles_unstable,\n useAttachmentList_unstable,\n} from './AttachmentList';\nexport type { AttachmentListContextValue } from './contexts/attachmentListContext';\nexport {\n AttachmentListContext,\n AttachmentListProvider,\n useAttachmentListContext_unstable,\n} from './contexts/attachmentListContext';\nexport type { AttachmentProps, AttachmentSlots, AttachmentState } from './Attachment';\nexport {\n Attachment,\n attachmentClassNames,\n renderAttachment_unstable,\n useAttachmentStyles_unstable,\n useAttachment_unstable,\n} from './Attachment';\n\nexport type {\n AttachmentOverflowMenuProps,\n AttachmentOverflowMenuSlots,\n AttachmentOverflowMenuState,\n} from './AttachmentOverflowMenu';\nexport {\n AttachmentOverflowMenu,\n renderAttachmentOverflowMenu_unstable,\n useAttachmentOverflowMenu_unstable,\n} from './AttachmentOverflowMenu';\n\nexport type { AttachmentOverflowMenuContextValue } from './contexts/attachmentOverflowMenuContext';\nexport {\n AttachmentOverflowMenuContext,\n AttachmentOverflowMenuProvider,\n useAttachmentOverflowMenuContext_unstable,\n} from './contexts/attachmentOverflowMenuContext';\n\nexport type {\n AttachmentOverflowMenuButtonProps,\n AttachmentOverflowMenuButtonSlots,\n AttachmentOverflowMenuButtonState,\n} from './AttachmentOverflowMenuButton';\nexport {\n AttachmentOverflowMenuButton,\n attachmentOverflowMenuButtonClassNames,\n renderAttachmentOverflowMenuButton_unstable,\n useAttachmentOverflowMenuButtonStyles_unstable,\n useAttachmentOverflowMenuButton_unstable,\n} from './AttachmentOverflowMenuButton';\n\nexport type {\n AttachmentOverflowMenuItemProps,\n AttachmentOverflowMenuItemSlots,\n AttachmentOverflowMenuItemState,\n} from './AttachmentOverflowMenuItem';\nexport {\n AttachmentOverflowMenuItem,\n attachmentOverflowMenuItemClassNames,\n renderAttachmentOverflowMenuItem_unstable,\n useAttachmentOverflowMenuItemStyles_unstable,\n useAttachmentOverflowMenuItem_unstable,\n} from './AttachmentOverflowMenuItem';\n"],"names":["Attachment","AttachmentList","AttachmentListContext","AttachmentListProvider","AttachmentOverflowMenu","AttachmentOverflowMenuButton","AttachmentOverflowMenuContext","AttachmentOverflowMenuItem","AttachmentOverflowMenuProvider","AttachmentTag","AttachmentTagItem","AttachmentTagList","attachmentClassNames","attachmentListClassNames","attachmentOverflowMenuButtonClassNames","attachmentOverflowMenuItemClassNames","attachmentTagClassNames","attachmentTagItemClassNames","attachmentTagListClassNames","renderAttachmentList_unstable","renderAttachmentOverflowMenuButton_unstable","renderAttachmentOverflowMenuItem_unstable","renderAttachmentOverflowMenu_unstable","renderAttachmentTagItem_unstable","renderAttachmentTagList_unstable","renderAttachmentTag_unstable","renderAttachment_unstable","useAttachmentListContext_unstable","useAttachmentListStyles_unstable","useAttachmentList_unstable","useAttachmentOverflowMenuButtonStyles_unstable","useAttachmentOverflowMenuButton_unstable","useAttachmentOverflowMenuContext_unstable","useAttachmentOverflowMenuItemStyles_unstable","useAttachmentOverflowMenuItem_unstable","useAttachmentOverflowMenu_unstable","useAttachmentStyles_unstable","useAttachmentTagItemStyles_unstable","useAttachmentTagItem_unstable","useAttachmentTagListStyles_unstable","useAttachmentTagList_unstable","useAttachmentTagStyles_unstable","useAttachmentTag_unstable","useAttachment_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAoDEA,UAAU;eAAVA,sBAAU;;IAdVC,cAAc;eAAdA,8BAAc;;IAQdC,qBAAqB;eAArBA,4CAAqB;;IACrBC,sBAAsB;eAAtBA,6CAAsB;;IAkBtBC,sBAAsB;eAAtBA,8CAAsB;;IAkBtBC,4BAA4B;eAA5BA,0DAA4B;;IAX5BC,6BAA6B;eAA7BA,4DAA6B;;IAwB7BC,0BAA0B;eAA1BA,sDAA0B;;IAvB1BC,8BAA8B;eAA9BA,6DAA8B;;IAvE9BC,aAAa;eAAbA,4BAAa;;IAsBbC,iBAAiB;eAAjBA,oCAAiB;;IATjBC,iBAAiB;eAAjBA,oCAAiB;;IAsCjBC,oBAAoB;eAApBA,gCAAoB;;IAdpBC,wBAAwB;eAAxBA,wCAAwB;;IA6CxBC,sCAAsC;eAAtCA,oEAAsC;;IAatCC,oCAAoC;eAApCA,gEAAoC;;IA9FpCC,uBAAuB;eAAvBA,sCAAuB;;IAsBvBC,2BAA2B;eAA3BA,8CAA2B;;IAT3BC,2BAA2B;eAA3BA,8CAA2B;;IAwB3BC,6BAA6B;eAA7BA,6CAA6B;;IA6C7BC,2CAA2C;eAA3CA,yEAA2C;;IAa3CC,yCAAyC;eAAzCA,qEAAyC;;IAhCzCC,qCAAqC;eAArCA,6DAAqC;;IAxCrCC,gCAAgC;eAAhCA,mDAAgC;;IAThCC,gCAAgC;eAAhCA,mDAAgC;;IAbhCC,4BAA4B;eAA5BA,2CAA4B;;IAkD5BC,yBAAyB;eAAzBA,qCAAyB;;IANzBC,iCAAiC;eAAjCA,wDAAiC;;IAPjCC,gCAAgC;eAAhCA,gDAAgC;;IAChCC,0BAA0B;eAA1BA,0CAA0B;;IA4C1BC,8CAA8C;eAA9CA,4EAA8C;;IAC9CC,wCAAwC;eAAxCA,sEAAwC;;IAbxCC,yCAAyC;eAAzCA,wEAAyC;;IAyBzCC,4CAA4C;eAA5CA,wEAA4C;;IAC5CC,sCAAsC;eAAtCA,kEAAsC;;IAjCtCC,kCAAkC;eAAlCA,0DAAkC;;IAZlCC,4BAA4B;eAA5BA,wCAA4B;;IA5B5BC,mCAAmC;eAAnCA,sDAAmC;;IACnCC,6BAA6B;eAA7BA,gDAA6B;;IAV7BC,mCAAmC;eAAnCA,sDAAmC;;IACnCC,6BAA6B;eAA7BA,gDAA6B;;IAd7BC,+BAA+B;eAA/BA,8CAA+B;;IAC/BC,yBAAyB;eAAzBA,wCAAyB;;IAkDzBC,sBAAsB;eAAtBA,kCAAsB;;;+BAjDjB;mCAaA;mCASA;gCAcA;uCAMA;4BAQA;wCAWA;+CAOA;8CAaA;4CAaA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-attachments",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "A set of components related to attaching files in Copilot experiences.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -24,6 +24,7 @@
24
24
  "@fluentui/react-jsx-runtime": ">=9.0.37 <10.0.0",
25
25
  "@fluentui/react-overflow": ">=9.1.18 <10.0.0",
26
26
  "@fluentui/react-shared-contexts": ">=9.18.0 <10.0.0",
27
+ "@fluentui/react-utilities": ">=9.18.8 <10.0.0",
27
28
  "@types/react": ">=16.14.0 <19.0.0",
28
29
  "@types/react-dom": ">=16.9.8 <19.0.0",
29
30
  "react": ">=16.14.0 <19.0.0",