@fluentui-copilot/react-attachments 0.12.4 → 0.13.0

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 (116) hide show
  1. package/CHANGELOG.json +54 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/index.d.ts +0 -151
  4. package/lib/components/AgentTag/useAgentTagStyles.styles.js +4 -4
  5. package/lib/components/AgentTag/useAgentTagStyles.styles.js.map +1 -1
  6. package/lib/components/Attachment/useAttachmentStyles.styles.js +34 -12
  7. package/lib/components/Attachment/useAttachmentStyles.styles.js.map +1 -1
  8. package/lib/components/index.js +0 -3
  9. package/lib/components/index.js.map +1 -1
  10. package/lib/index.js +0 -3
  11. package/lib/index.js.map +1 -1
  12. package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.js +2 -2
  13. package/lib-commonjs/components/AgentTag/useAgentTagStyles.styles.js.map +1 -1
  14. package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.js +52 -26
  15. package/lib-commonjs/components/Attachment/useAttachmentStyles.styles.js.map +1 -1
  16. package/lib-commonjs/components/index.js +0 -60
  17. package/lib-commonjs/components/index.js.map +1 -1
  18. package/lib-commonjs/index.js +0 -48
  19. package/lib-commonjs/index.js.map +1 -1
  20. package/package.json +2 -2
  21. package/lib/AttachmentTag.js +0 -2
  22. package/lib/AttachmentTag.js.map +0 -1
  23. package/lib/AttachmentTagItem.js +0 -2
  24. package/lib/AttachmentTagItem.js.map +0 -1
  25. package/lib/AttachmentTagList.js +0 -2
  26. package/lib/AttachmentTagList.js.map +0 -1
  27. package/lib/components/AttachmentTag/AttachmentTag.js +0 -17
  28. package/lib/components/AttachmentTag/AttachmentTag.js.map +0 -1
  29. package/lib/components/AttachmentTag/AttachmentTag.types.js +0 -4
  30. package/lib/components/AttachmentTag/AttachmentTag.types.js.map +0 -1
  31. package/lib/components/AttachmentTag/index.js +0 -5
  32. package/lib/components/AttachmentTag/index.js.map +0 -1
  33. package/lib/components/AttachmentTag/renderAttachmentTag.js +0 -12
  34. package/lib/components/AttachmentTag/renderAttachmentTag.js.map +0 -1
  35. package/lib/components/AttachmentTag/useAttachmentTag.js +0 -21
  36. package/lib/components/AttachmentTag/useAttachmentTag.js.map +0 -1
  37. package/lib/components/AttachmentTag/useAttachmentTagStyles.styles.js +0 -45
  38. package/lib/components/AttachmentTag/useAttachmentTagStyles.styles.js.map +0 -1
  39. package/lib/components/AttachmentTagItem/AttachmentTagItem.js +0 -15
  40. package/lib/components/AttachmentTagItem/AttachmentTagItem.js.map +0 -1
  41. package/lib/components/AttachmentTagItem/AttachmentTagItem.types.js +0 -4
  42. package/lib/components/AttachmentTagItem/AttachmentTagItem.types.js.map +0 -1
  43. package/lib/components/AttachmentTagItem/index.js +0 -5
  44. package/lib/components/AttachmentTagItem/index.js.map +0 -1
  45. package/lib/components/AttachmentTagItem/renderAttachmentTagItem.js +0 -12
  46. package/lib/components/AttachmentTagItem/renderAttachmentTagItem.js.map +0 -1
  47. package/lib/components/AttachmentTagItem/useAttachmentTagItem.js +0 -21
  48. package/lib/components/AttachmentTagItem/useAttachmentTagItem.js.map +0 -1
  49. package/lib/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.js +0 -32
  50. package/lib/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.js.map +0 -1
  51. package/lib/components/AttachmentTagList/AttachmentTagList.js +0 -19
  52. package/lib/components/AttachmentTagList/AttachmentTagList.js.map +0 -1
  53. package/lib/components/AttachmentTagList/AttachmentTagList.types.js +0 -2
  54. package/lib/components/AttachmentTagList/AttachmentTagList.types.js.map +0 -1
  55. package/lib/components/AttachmentTagList/index.js +0 -5
  56. package/lib/components/AttachmentTagList/index.js.map +0 -1
  57. package/lib/components/AttachmentTagList/renderAttachmentTagList.js +0 -14
  58. package/lib/components/AttachmentTagList/renderAttachmentTagList.js.map +0 -1
  59. package/lib/components/AttachmentTagList/useAttachmentTagList.js +0 -35
  60. package/lib/components/AttachmentTagList/useAttachmentTagList.js.map +0 -1
  61. package/lib/components/AttachmentTagList/useAttachmentTagListContextValues.js +0 -13
  62. package/lib/components/AttachmentTagList/useAttachmentTagListContextValues.js.map +0 -1
  63. package/lib/components/AttachmentTagList/useAttachmentTagListStyles.styles.js +0 -17
  64. package/lib/components/AttachmentTagList/useAttachmentTagListStyles.styles.js.map +0 -1
  65. package/lib/components/utils/useAttachmentTagSlots.js +0 -62
  66. package/lib/components/utils/useAttachmentTagSlots.js.map +0 -1
  67. package/lib/contexts/attachmentTagListContext.js +0 -8
  68. package/lib/contexts/attachmentTagListContext.js.map +0 -1
  69. package/lib-commonjs/AttachmentTag.js +0 -41
  70. package/lib-commonjs/AttachmentTag.js.map +0 -1
  71. package/lib-commonjs/AttachmentTagItem.js +0 -29
  72. package/lib-commonjs/AttachmentTagItem.js.map +0 -1
  73. package/lib-commonjs/AttachmentTagList.js +0 -29
  74. package/lib-commonjs/AttachmentTagList.js.map +0 -1
  75. package/lib-commonjs/components/AttachmentTag/AttachmentTag.js +0 -23
  76. package/lib-commonjs/components/AttachmentTag/AttachmentTag.js.map +0 -1
  77. package/lib-commonjs/components/AttachmentTag/AttachmentTag.types.js +0 -7
  78. package/lib-commonjs/components/AttachmentTag/AttachmentTag.types.js.map +0 -1
  79. package/lib-commonjs/components/AttachmentTag/index.js +0 -44
  80. package/lib-commonjs/components/AttachmentTag/index.js.map +0 -1
  81. package/lib-commonjs/components/AttachmentTag/renderAttachmentTag.js +0 -22
  82. package/lib-commonjs/components/AttachmentTag/renderAttachmentTag.js.map +0 -1
  83. package/lib-commonjs/components/AttachmentTag/useAttachmentTag.js +0 -21
  84. package/lib-commonjs/components/AttachmentTag/useAttachmentTag.js.map +0 -1
  85. package/lib-commonjs/components/AttachmentTag/useAttachmentTagStyles.styles.js +0 -78
  86. package/lib-commonjs/components/AttachmentTag/useAttachmentTagStyles.styles.js.map +0 -1
  87. package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.js +0 -21
  88. package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.js.map +0 -1
  89. package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.types.js +0 -7
  90. package/lib-commonjs/components/AttachmentTagItem/AttachmentTagItem.types.js.map +0 -1
  91. package/lib-commonjs/components/AttachmentTagItem/index.js +0 -32
  92. package/lib-commonjs/components/AttachmentTagItem/index.js.map +0 -1
  93. package/lib-commonjs/components/AttachmentTagItem/renderAttachmentTagItem.js +0 -22
  94. package/lib-commonjs/components/AttachmentTagItem/renderAttachmentTagItem.js.map +0 -1
  95. package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItem.js +0 -21
  96. package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItem.js.map +0 -1
  97. package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.js +0 -45
  98. package/lib-commonjs/components/AttachmentTagItem/useAttachmentTagItemStyles.styles.js.map +0 -1
  99. package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.js +0 -25
  100. package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.js.map +0 -1
  101. package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.types.js +0 -5
  102. package/lib-commonjs/components/AttachmentTagList/AttachmentTagList.types.js.map +0 -1
  103. package/lib-commonjs/components/AttachmentTagList/index.js +0 -32
  104. package/lib-commonjs/components/AttachmentTagList/index.js.map +0 -1
  105. package/lib-commonjs/components/AttachmentTagList/renderAttachmentTagList.js +0 -20
  106. package/lib-commonjs/components/AttachmentTagList/renderAttachmentTagList.js.map +0 -1
  107. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagList.js +0 -33
  108. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagList.js.map +0 -1
  109. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListContextValues.js +0 -20
  110. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListContextValues.js.map +0 -1
  111. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListStyles.styles.js +0 -31
  112. package/lib-commonjs/components/AttachmentTagList/useAttachmentTagListStyles.styles.js.map +0 -1
  113. package/lib-commonjs/components/utils/useAttachmentTagSlots.js +0 -62
  114. package/lib-commonjs/components/utils/useAttachmentTagSlots.js.map +0 -1
  115. package/lib-commonjs/contexts/attachmentTagListContext.js +0 -28
  116. package/lib-commonjs/contexts/attachmentTagListContext.js.map +0 -1
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- AttachmentTagList: function() {
13
- return _AttachmentTagList.AttachmentTagList;
14
- },
15
- attachmentTagListClassNames: function() {
16
- return _useAttachmentTagListStylesstyles.attachmentTagListClassNames;
17
- },
18
- renderAttachmentTagList_unstable: function() {
19
- return _renderAttachmentTagList.renderAttachmentTagList_unstable;
20
- },
21
- useAttachmentTagListStyles_unstable: function() {
22
- return _useAttachmentTagListStylesstyles.useAttachmentTagListStyles_unstable;
23
- },
24
- useAttachmentTagList_unstable: function() {
25
- return _useAttachmentTagList.useAttachmentTagList_unstable;
26
- }
27
- });
28
- const _AttachmentTagList = require("./AttachmentTagList");
29
- const _renderAttachmentTagList = require("./renderAttachmentTagList");
30
- const _useAttachmentTagList = require("./useAttachmentTagList");
31
- const _useAttachmentTagListStylesstyles = require("./useAttachmentTagListStyles.styles");
32
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export { AttachmentTagList } from './AttachmentTagList';\nexport type { AttachmentTagDismissedData, AttachmentTagListContextValues, AttachmentTagListProps, AttachmentTagListSlots, AttachmentTagListState } from './AttachmentTagList.types';\nexport { renderAttachmentTagList_unstable } from './renderAttachmentTagList';\nexport { useAttachmentTagList_unstable } from './useAttachmentTagList';\nexport { attachmentTagListClassNames, useAttachmentTagListStyles_unstable } from './useAttachmentTagListStyles.styles';\n"],"names":["AttachmentTagList","attachmentTagListClassNames","renderAttachmentTagList_unstable","useAttachmentTagListStyles_unstable","useAttachmentTagList_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,iBAAiB;eAAjBA,oCAAiB;;IAIjBC,2BAA2B;eAA3BA,6DAA2B;;IAF3BC,gCAAgC;eAAhCA,yDAAgC;;IAEHC,mCAAmC;eAAnCA,qEAAmC;;IADhEC,6BAA6B;eAA7BA,mDAA6B;;;mCAHJ;yCAEe;sCACH;kDACmC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "renderAttachmentTagList_unstable", {
6
- enumerable: true,
7
- get: function() {
8
- return renderAttachmentTagList_unstable;
9
- }
10
- });
11
- const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
- const _reactcomponents = require("@fluentui/react-components");
13
- const _attachmentTagListContext = require("../../contexts/attachmentTagListContext");
14
- const renderAttachmentTagList_unstable = (state, contextValues)=>{
15
- (0, _reactcomponents.assertSlots)(state);
16
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_attachmentTagListContext.AttachmentTagListProvider, {
17
- value: contextValues.tagList,
18
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
19
- });
20
- }; //# sourceMappingURL=renderAttachmentTagList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["renderAttachmentTagList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\n\nimport { AttachmentTagListProvider } from '../../contexts/attachmentTagListContext';\nimport type {\n AttachmentTagListContextValues,\n AttachmentTagListState,\n AttachmentTagListSlots,\n} from './AttachmentTagList.types';\n\n/**\n * Render the final JSX of AttachmentTagList\n */\nexport const renderAttachmentTagList_unstable = (\n state: AttachmentTagListState,\n contextValues: AttachmentTagListContextValues,\n) => {\n assertSlots<AttachmentTagListSlots>(state);\n\n return (\n <AttachmentTagListProvider value={contextValues.tagList}>\n <state.root />\n </AttachmentTagListProvider>\n );\n};\n"],"names":["assertSlots","state","value","contextValues","tagList"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBEA;;;eAAAA;;;4BAnBwB;iCAGE;0CAEc;AAcxCA,MAAAA,mCAAoCC,CAAAA,OAAAA;oCAEpC,EAAAA;WAC6BC,WAAOC,GAAAA,IAAAA,eAAAA,EAAAA,mDAAqB,EAAA;6BACrDC,OAAA;;IAGJ"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useAttachmentTagList_unstable", {
6
- enumerable: true,
7
- get: function() {
8
- return useAttachmentTagList_unstable;
9
- }
10
- });
11
- const _reactcomponents = require("@fluentui/react-components");
12
- const useAttachmentTagList_unstable = (props, ref)=>{
13
- const { onAttachmentTagDismiss } = props;
14
- const focusAttributes = (0, _reactcomponents.useArrowNavigationGroup)({
15
- axis: 'both',
16
- circular: true
17
- });
18
- return {
19
- onAttachmentTagDismiss,
20
- components: {
21
- root: 'div'
22
- },
23
- root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
24
- 'aria-label': 'Attachments',
25
- ref,
26
- role: 'menu',
27
- ...focusAttributes,
28
- ...props
29
- }), {
30
- elementType: 'div'
31
- })
32
- };
33
- }; //# sourceMappingURL=useAttachmentTagList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useAttachmentTagList.ts"],"sourcesContent":["import type * as React from 'react';\n\nimport { getIntrinsicElementProps, slot, useArrowNavigationGroup } from '@fluentui/react-components';\nimport type { AttachmentTagListProps, AttachmentTagListState } from './AttachmentTagList.types';\n\n/**\n * Create the state required to render AttachmentTagList.\n *\n * The returned state can be modified with hooks such as useAttachmentTagListStyles_unstable,\n * before being passed to renderAttachmentTagList_unstable.\n *\n * @param props - props from this instance of AttachmentTagList\n * @param ref - reference to root HTMLElement of AttachmentTagList\n */\nexport const useAttachmentTagList_unstable = (\n props: AttachmentTagListProps,\n ref: React.Ref<HTMLDivElement>,\n): AttachmentTagListState => {\n const { onAttachmentTagDismiss } = props;\n\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n });\n\n return {\n onAttachmentTagDismiss,\n\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n 'aria-label': 'Attachments',\n ref,\n role: 'menu',\n ...focusAttributes,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["onAttachmentTagDismiss","props","focusAttributes","useArrowNavigationGroup","axis","slot","role","getIntrinsicElementProps","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBUA;;;eAAAA;;;iCAhB8D;AAgBtE,MAAQA,gCAA2BC,CAAAA,OAAAA;UAEnC,wBACQ;UAERC,kBAAAC,IAAAA,wCAAA,EAAA;QAEAC,MAAA;kBACEJ;;;;oBAKMK;kBAEF;;mCAEAC,CAAAA,MAAM,CAAAC,IAAAA,yCAAA,EAAA,OAAA;0BACHL;;kBAGL;8BAAEM;eAAmBP,KAAA;QAEzB,IAAA;YACAO,aAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useAttachmentTagListContextValues_unstable", {
6
- enumerable: true,
7
- get: function() {
8
- return useAttachmentTagListContextValues_unstable;
9
- }
10
- });
11
- function useAttachmentTagListContextValues_unstable(state) {
12
- const { onAttachmentTagDismiss } = state;
13
- // This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
14
- const tagList = {
15
- onAttachmentTagDismiss
16
- };
17
- return {
18
- tagList
19
- };
20
- } //# sourceMappingURL=useAttachmentTagListContextValues.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useAttachmentTagListContextValues.ts"],"sourcesContent":["import type { AttachmentTagListContextValues, AttachmentTagListState } from './AttachmentTagList.types';\n\nexport function useAttachmentTagListContextValues_unstable(\n state: AttachmentTagListState,\n): AttachmentTagListContextValues {\n const { onAttachmentTagDismiss } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const tagList = {\n onAttachmentTagDismiss,\n };\n\n return { tagList };\n}\n"],"names":["useAttachmentTagListContextValues_unstable","state","onAttachmentTagDismiss","tagList"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,2CACdC,KAA6B;UAE7B,EAEAC,sBAAA,KACAD;uGACEC;UACFC,UAAA;QAEAD;;WAAiB;QACnBC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- attachmentTagListClassNames: function() {
13
- return attachmentTagListClassNames;
14
- },
15
- useAttachmentTagListStyles_unstable: function() {
16
- return useAttachmentTagListStyles_unstable;
17
- }
18
- });
19
- const _reactcomponents = require("@fluentui/react-components");
20
- const attachmentTagListClassNames = {
21
- root: 'fai-AttachmentTagList'
22
- };
23
- const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r168fwfa", null, [
24
- ".r168fwfa{column-gap:var(--spacingHorizontalSNudge);display:flex;flex-direction:row;flex-shrink:0;flex-wrap:wrap;row-gap:var(--spacingVerticalXS);}"
25
- ]);
26
- const useAttachmentTagListStyles_unstable = (state)=>{
27
- 'use no memo';
28
- const rootBaseClassName = useRootBaseClassName();
29
- state.root.className = (0, _reactcomponents.mergeClasses)(attachmentTagListClassNames.root, rootBaseClassName, state.root.className);
30
- return state;
31
- }; //# sourceMappingURL=useAttachmentTagListStyles.styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useAttachmentTagListStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\nimport type { AttachmentTagListSlots, AttachmentTagListState } from './AttachmentTagList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const attachmentTagListClassNames: SlotClassNames<AttachmentTagListSlots> = {\n root: 'fai-AttachmentTagList',\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 AttachmentTagList slots based on the state\n */\nexport const useAttachmentTagListStyles_unstable = (state: AttachmentTagListState): AttachmentTagListState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(attachmentTagListClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["attachmentTagListClassNames","flexShrink","root","useRootBaseClassName","makeResetStyles","state","rootBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,2BAAAA;eAAAA;;IAQXC,mCAAY;eAAZA;;;iCAboC;AAK/B,MAAMD,8BAAsE;UACjFE;AACF;AAEA,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;CAAA;AAI3CH,MAAAA,sCAAYI,CAAAA;;IAGd,MAAAC,oBAAAH;IAEAE,MAAAH,IAAA,CAAAK,SAAA,GAAAC,IAAAA,6BAAA,EAAAR,4BAAAE,IAAA,EAAAI,mBAAAD,MAAAH,IAAA,CAAAK,SAAA;;gEAIE"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useAttachmentTagSlots", {
6
- enumerable: true,
7
- get: function() {
8
- return useAttachmentTagSlots;
9
- }
10
- });
11
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
- const _reactcomponents = require("@fluentui/react-components");
14
- const _reactcontextselector = require("@fluentui/react-context-selector");
15
- const _reacticons = require("@fluentui/react-icons");
16
- const _attachmentTagListContext = require("../../contexts/attachmentTagListContext");
17
- function useAttachmentTagSlots(props, ref, options) {
18
- const onAttachmentTagDismiss = (0, _attachmentTagListContext.useAttachmentTagListContext_unstable)((context)=>context.onAttachmentTagDismiss);
19
- const { children, role } = props;
20
- const { elementType } = options;
21
- const DismissIcon = (0, _reacticons.bundleIcon)(_reacticons.Dismiss20Filled, _reacticons.Dismiss20Regular);
22
- const hasParentContext = (0, _reactcontextselector.useHasParentContext)(_attachmentTagListContext.AttachmentTagListContext);
23
- const rootRole = role !== null && role !== void 0 ? role : hasParentContext ? 'menuitem' : undefined;
24
- const root = _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)(elementType.root, {
25
- ref,
26
- ...props,
27
- role: rootRole
28
- }), {
29
- elementType: elementType.root
30
- });
31
- root.onClick = (0, _reactcomponents.mergeCallbacks)(root.onClick, (ev)=>onAttachmentTagDismiss === null || onAttachmentTagDismiss === void 0 ? void 0 : onAttachmentTagDismiss(ev, {
32
- content: children,
33
- media
34
- }));
35
- const media = _reactcomponents.slot.optional(props.media, {
36
- elementType: elementType.media
37
- });
38
- const content = _reactcomponents.slot.always(props.content, {
39
- defaultProps: {
40
- children
41
- },
42
- elementType: elementType.content
43
- });
44
- const icon = _reactcomponents.slot.always(props.icon, {
45
- defaultProps: {
46
- children: /*#__PURE__*/ _react.createElement(DismissIcon, null)
47
- },
48
- elementType: elementType.icon
49
- });
50
- return {
51
- components: {
52
- root: elementType.root,
53
- media: elementType.media,
54
- content: elementType.content,
55
- icon: elementType.icon
56
- },
57
- root,
58
- media,
59
- content,
60
- icon
61
- };
62
- } //# sourceMappingURL=useAttachmentTagSlots.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useAttachmentTagSlots.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { getIntrinsicElementProps, mergeCallbacks, slot } from '@fluentui/react-components';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { Dismiss20Regular, Dismiss20Filled, bundleIcon } from '@fluentui/react-icons';\n\nimport { useAttachmentTagListContext_unstable } from '../../contexts/attachmentTagListContext';\n\nimport { AttachmentTagListContext } from '../../contexts/attachmentTagListContext';\nimport type { AttachmentTagProps, AttachmentTagState } from './../AttachmentTag/AttachmentTag.types';\nimport type { AttachmentTagItemProps, AttachmentTagItemState } from './../AttachmentTagItem/AttachmentTagItem.types';\n\n/**\n * @internal\n * Create the slots required to render AttachmentTag or AttachmentTagItem.\n */\nexport function useAttachmentTagSlots<TAttachmentTagState extends AttachmentTagState | AttachmentTagItemState>(\n props: AttachmentTagProps | AttachmentTagItemProps,\n ref: React.Ref<HTMLButtonElement | HTMLDivElement>,\n options: {\n elementType: TAttachmentTagState['components'];\n },\n): TAttachmentTagState {\n const onAttachmentTagDismiss = useAttachmentTagListContext_unstable(context => context.onAttachmentTagDismiss);\n const { children, role } = props;\n const { elementType } = options;\n\n const DismissIcon = bundleIcon(Dismiss20Filled, Dismiss20Regular);\n\n const hasParentContext = useHasParentContext(AttachmentTagListContext);\n const rootRole = role ?? (hasParentContext ? 'menuitem' : undefined);\n\n const root: TAttachmentTagState['root'] = slot.always(\n getIntrinsicElementProps(elementType.root as 'button' | 'div', {\n ref,\n ...props,\n role: rootRole,\n }),\n { elementType: elementType.root as 'button' | 'div' },\n );\n root.onClick = mergeCallbacks(\n root.onClick as React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>,\n (ev: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>\n onAttachmentTagDismiss?.(ev, { content: children, media }),\n );\n\n const media: TAttachmentTagState['media'] = slot.optional(props.media, { elementType: elementType.media });\n\n const content: TAttachmentTagState['content'] = slot.always(props.content, {\n defaultProps: {\n children,\n },\n elementType: elementType.content,\n });\n\n const icon: TAttachmentTagState['icon'] = slot.always(props.icon, {\n defaultProps: {\n children: <DismissIcon />,\n },\n elementType: elementType.icon,\n });\n\n return {\n components: {\n root: elementType.root,\n media: elementType.media,\n content: elementType.content,\n icon: elementType.icon,\n },\n root,\n media,\n content,\n icon,\n } as TAttachmentTagState;\n}\n"],"names":["onAttachmentTagDismiss","useAttachmentTagListContext_unstable","props","children","DismissIcon","role","ref","rootRole","hasParentContext","useHasParentContext","AttachmentTagListContext","elementType","root","undefined","slot","always","getIntrinsicElementProps","content","media","optional","onClick","mergeCallbacks","ev","icon","defaultProps","components","createElement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBQA;;;eAAAA;;;;iEAvBe;iCAEwC;sCAC3B;4BAC0B;0CAET;AAiBnD,SAAMA,sBAAyBC,KAAAA,EAAAA,GAAAA,EAAAA,OAAAA;UAC/BD,yBAA2BE,IAAAA,8DAAAA,EAAAA,CAAAA,UAAAA,QAAAA,sBAAAA;UAC3B,EAEAC,QAAMC,EAENC,IAAA,KACAH;UAEA,aAEII;UAEAD,cAAME,IAAAA,sBAAAA,EAAAA,2BAAAA,EAAAA,4BAAAA;UAERC,mBAAAC,IAAAA,yCAAA,EAAAC,kDAAA;UAAEC,WAAAA,SAAaA,QAAYC,SAAI,KAAA,IAAAP,OAAAG,mBAAA,aAAAK;UAAqBD,OAAAE,qBAAA,CAAAC,MAAA,CAAAC,IAAAA,yCAAA,EAAAL,YAAAC,IAAA,EAAA;QAEtDA;gBAGmCK;;;QAGnCN,aAAMO,YAA2CC,IAASjB;;SAA8CkB,OAAA,GAAAC,IAAAA,+BAAA,EAAAT,KAAAQ,OAAA,EAAAE,CAAAA,KAAAtB,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAsB,IAAA;YAExGL,SAAMA;;;UAGJC,QAAAJ,qBAAA,CAAAK,QAAA,CAAAjB,MAAAgB,KAAA,EAAA;qBACAP,YAAaA,KAAYM;;UAG3BA,UAA0CH,qBAAKC,CAAAA,MAAOb,CAAAA,MAAMqB,OAAM,EAAA;sBAChEC;;;qBAGAb,YAAaA,OAAYY;;UAG3BA,OAAOT,qBAAA,CAAAC,MAAA,CAAAb,MAAAqB,IAAA,EAAA;sBACLE;sBACEb,WAAMD,GAAAA,OAAgBe,aAAA,CAAAtB,aAAA;;qBAEtBa,YAASN,IAAYM;;WAEvB;oBACAL;kBACAM,YAAAA,IAAAA;mBACAD,YAAAA,KAAAA;qBACAM,YAAAA,OAAAA;YACFA,MAAAZ,YAAAY,IAAA;QACF"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- AttachmentTagListContext: function() {
13
- return AttachmentTagListContext;
14
- },
15
- AttachmentTagListProvider: function() {
16
- return AttachmentTagListProvider;
17
- },
18
- useAttachmentTagListContext_unstable: function() {
19
- return useAttachmentTagListContext_unstable;
20
- }
21
- });
22
- const _reactcontextselector = require("@fluentui/react-context-selector");
23
- const AttachmentTagListContext = (0, _reactcontextselector.createContext)(undefined);
24
- const tagListContextDefaultValue = {
25
- onAttachmentTagDismiss: ()=>null
26
- };
27
- const AttachmentTagListProvider = AttachmentTagListContext.Provider;
28
- const useAttachmentTagListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(AttachmentTagListContext, (ctx = tagListContextDefaultValue)=>selector(ctx)); //# sourceMappingURL=attachmentTagListContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["attachmentTagListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { AttachmentTagListProps } from '../components/index';\n\nexport const AttachmentTagListContext: Context<AttachmentTagListContextValue> = createContext<\n AttachmentTagListContextValue | undefined\n>(undefined) as Context<AttachmentTagListContextValue>;\n\nconst tagListContextDefaultValue: AttachmentTagListContextValue = {\n onAttachmentTagDismiss: () => null,\n};\n\n/**\n * Context shared between AttachmentTagList and its children components\n */\nexport type AttachmentTagListContextValue = Pick<AttachmentTagListProps, 'onAttachmentTagDismiss'>;\n\nexport const AttachmentTagListProvider = AttachmentTagListContext.Provider;\n\nexport const useAttachmentTagListContext_unstable = <T>(selector: ContextSelector<AttachmentTagListContextValue, T>) =>\n useContextSelector(AttachmentTagListContext, (ctx = tagListContextDefaultValue) => selector(ctx));\n"],"names":["AttachmentTagListContext","AttachmentTagListProvider","useAttachmentTagListContext_unstable","createContext","undefined","tagListContextDefaultValue","onAttachmentTagDismiss","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAaAC,yBAAAA;eAAAA;;IAEAC,oCAAAA;eAAAA;;;sCAnBqC;AAI3C,MAAMF,2BAAmEG,IAAAA,mCAAAA,EAE9EC;AAEF,MAAMC,6BAA4D;4BAChEC,IAA8B;AAChC;AAOO,MAAML,4BAA4BD,yBAAyBO,QAAQ;AAEnE,MAAML,uCAAuCM,CAAAA,WAClDC,IAAAA,wCAAAA,EAAmBT,0BAA0B,CAACU,MAAML,0BAA0B,GAAKG,SAASE"}