@fluentui/react-overflow 9.0.10 → 9.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +67 -1
  3. package/CHANGELOG.md +26 -2
  4. package/lib/components/Overflow.js.map +1 -1
  5. package/lib/components/OverflowItem/OverflowItem.js.map +1 -1
  6. package/lib/components/OverflowItem/OverflowItem.types.js +1 -1
  7. package/lib/components/OverflowItem/OverflowItem.types.js.map +1 -1
  8. package/lib/components/OverflowItem/index.js.map +1 -1
  9. package/lib/constants.js.map +1 -1
  10. package/lib/index.js.map +1 -1
  11. package/lib/overflowContext.js.map +1 -1
  12. package/lib/types.js +1 -1
  13. package/lib/types.js.map +1 -1
  14. package/lib/useIsOverflowGroupVisible.js.map +1 -1
  15. package/lib/useIsOverflowItemVisible.js.map +1 -1
  16. package/lib/useOverflowContainer.js.map +1 -1
  17. package/lib/useOverflowCount.js.map +1 -1
  18. package/lib/useOverflowItem.js.map +1 -1
  19. package/lib/useOverflowMenu.js.map +1 -1
  20. package/lib-commonjs/components/Overflow.js +62 -70
  21. package/lib-commonjs/components/Overflow.js.map +1 -1
  22. package/lib-commonjs/components/OverflowItem/OverflowItem.js +16 -21
  23. package/lib-commonjs/components/OverflowItem/OverflowItem.js.map +1 -1
  24. package/lib-commonjs/components/OverflowItem/OverflowItem.types.js +5 -2
  25. package/lib-commonjs/components/OverflowItem/OverflowItem.types.js.map +1 -1
  26. package/lib-commonjs/components/OverflowItem/index.js +6 -8
  27. package/lib-commonjs/components/OverflowItem/index.js.map +1 -1
  28. package/lib-commonjs/constants.js +16 -6
  29. package/lib-commonjs/constants.js.map +1 -1
  30. package/lib-commonjs/index.js +34 -86
  31. package/lib-commonjs/index.js.map +1 -1
  32. package/lib-commonjs/overflowContext.js +21 -16
  33. package/lib-commonjs/overflowContext.js.map +1 -1
  34. package/lib-commonjs/types.js +5 -2
  35. package/lib-commonjs/types.js.map +1 -1
  36. package/lib-commonjs/useIsOverflowGroupVisible.js +9 -11
  37. package/lib-commonjs/useIsOverflowGroupVisible.js.map +1 -1
  38. package/lib-commonjs/useIsOverflowItemVisible.js +9 -11
  39. package/lib-commonjs/useIsOverflowItemVisible.js.map +1 -1
  40. package/lib-commonjs/useOverflowContainer.js +87 -80
  41. package/lib-commonjs/useOverflowContainer.js.map +1 -1
  42. package/lib-commonjs/useOverflowCount.js +14 -15
  43. package/lib-commonjs/useOverflowCount.js.map +1 -1
  44. package/lib-commonjs/useOverflowItem.js +27 -27
  45. package/lib-commonjs/useOverflowItem.js.map +1 -1
  46. package/lib-commonjs/useOverflowMenu.js +41 -30
  47. package/lib-commonjs/useOverflowMenu.js.map +1 -1
  48. package/package.json +8 -7
  49. package/lib-amd/components/Overflow.js +0 -60
  50. package/lib-amd/components/Overflow.js.map +0 -1
  51. package/lib-amd/components/OverflowItem/OverflowItem.js +0 -17
  52. package/lib-amd/components/OverflowItem/OverflowItem.js.map +0 -1
  53. package/lib-amd/components/OverflowItem/OverflowItem.types.js +0 -5
  54. package/lib-amd/components/OverflowItem/OverflowItem.types.js.map +0 -1
  55. package/lib-amd/constants.js +0 -9
  56. package/lib-amd/constants.js.map +0 -1
  57. package/lib-amd/index.js +0 -18
  58. package/lib-amd/index.js.map +0 -1
  59. package/lib-amd/overflowContext.js +0 -25
  60. package/lib-amd/overflowContext.js.map +0 -1
  61. package/lib-amd/types.js +0 -5
  62. package/lib-amd/types.js.map +0 -1
  63. package/lib-amd/useIsOverflowGroupVisible.js +0 -14
  64. package/lib-amd/useIsOverflowGroupVisible.js.map +0 -1
  65. package/lib-amd/useIsOverflowItemVisible.js +0 -14
  66. package/lib-amd/useIsOverflowItemVisible.js.map +0 -1
  67. package/lib-amd/useOverflowContainer.js +0 -84
  68. package/lib-amd/useOverflowContainer.js.map +0 -1
  69. package/lib-amd/useOverflowCount.js +0 -21
  70. package/lib-amd/useOverflowCount.js.map +0 -1
  71. package/lib-amd/useOverflowItem.js +0 -30
  72. package/lib-amd/useOverflowItem.js.map +0 -1
  73. package/lib-amd/useOverflowMenu.js +0 -26
  74. package/lib-amd/useOverflowMenu.js.map +0 -1
@@ -1,21 +0,0 @@
1
- define(["require", "exports", "./overflowContext"], function (require, exports, overflowContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useOverflowCount = void 0;
5
- /**
6
- * @returns Number of items that are overflowing
7
- */
8
- var useOverflowCount = function () {
9
- return overflowContext_1.useOverflowContext(function (v) {
10
- return Object.entries(v.itemVisibility).reduce(function (acc, _a) {
11
- var id = _a[0], visible = _a[1];
12
- if (!visible) {
13
- acc++;
14
- }
15
- return acc;
16
- }, 0);
17
- });
18
- };
19
- exports.useOverflowCount = useOverflowCount;
20
- });
21
- //# sourceMappingURL=useOverflowCount.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOverflowCount.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-overflow/src/useOverflowCount.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACI,IAAM,gBAAgB,GAAG;QAC9B,OAAA,oCAAkB,CAAC,UAAA,CAAC;YAClB,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,EAAa;oBAAZ,EAAE,QAAA,EAAE,OAAO,QAAA;gBAC/D,IAAI,CAAC,OAAO,EAAE;oBACZ,GAAG,EAAE,CAAC;iBACP;gBAED,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC,CAAC;IARF,CAQE,CAAC;IATQ,QAAA,gBAAgB,oBASxB","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @returns Number of items that are overflowing\n */\nexport const useOverflowCount = () =>\n useOverflowContext(v => {\n return Object.entries(v.itemVisibility).reduce((acc, [id, visible]) => {\n if (!visible) {\n acc++;\n }\n\n return acc;\n }, 0);\n });\n"]}
@@ -1,30 +0,0 @@
1
- define(["require", "exports", "react", "@fluentui/react-utilities", "./overflowContext"], function (require, exports, React, react_utilities_1, overflowContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useOverflowItem = void 0;
5
- /**
6
- * @internal
7
- * Registers an overflow item
8
- * @param id - unique identifier for the item used by the overflow manager
9
- * @param priority - higher priority means the item overflows later
10
- * @param groupId - assigns the item to a group, group visibility can be watched
11
- * @returns ref to assign to an intrinsic HTML element
12
- */
13
- function useOverflowItem(id, priority, groupId) {
14
- var ref = React.useRef(null);
15
- var registerItem = overflowContext_1.useOverflowContext(function (v) { return v.registerItem; });
16
- react_utilities_1.useIsomorphicLayoutEffect(function () {
17
- if (ref.current) {
18
- return registerItem({
19
- element: ref.current,
20
- id: id,
21
- priority: priority !== null && priority !== void 0 ? priority : 0,
22
- groupId: groupId,
23
- });
24
- }
25
- }, [id, priority, registerItem, groupId]);
26
- return ref;
27
- }
28
- exports.useOverflowItem = useOverflowItem;
29
- });
30
- //# sourceMappingURL=useOverflowItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOverflowItem.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-overflow/src/useOverflowItem.ts"],"names":[],"mappings":";;;;IAIA;;;;;;;OAOG;IACH,SAAgB,eAAe,CAA+B,EAAU,EAAE,QAAiB,EAAE,OAAgB;QAC3G,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAW,IAAI,CAAC,CAAC;QACzC,IAAM,YAAY,GAAG,oCAAkB,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,YAAY,EAAd,CAAc,CAAC,CAAC;QAE7D,2CAAyB,CAAC;YACxB,IAAI,GAAG,CAAC,OAAO,EAAE;gBACf,OAAO,YAAY,CAAC;oBAClB,OAAO,EAAE,GAAG,CAAC,OAAO;oBACpB,EAAE,IAAA;oBACF,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC;oBACvB,OAAO,SAAA;iBACR,CAAC,CAAC;aACJ;QACH,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;QAE1C,OAAO,GAAG,CAAC;IACb,CAAC;IAhBD,0CAgBC","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @internal\n * Registers an overflow item\n * @param id - unique identifier for the item used by the overflow manager\n * @param priority - higher priority means the item overflows later\n * @param groupId - assigns the item to a group, group visibility can be watched\n * @returns ref to assign to an intrinsic HTML element\n */\nexport function useOverflowItem<TElement extends HTMLElement>(id: string, priority?: number, groupId?: string) {\n const ref = React.useRef<TElement>(null);\n const registerItem = useOverflowContext(v => v.registerItem);\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerItem({\n element: ref.current,\n id,\n priority: priority ?? 0,\n groupId,\n });\n }\n }, [id, priority, registerItem, groupId]);\n\n return ref;\n}\n"]}
@@ -1,26 +0,0 @@
1
- define(["require", "exports", "react", "@fluentui/react-utilities", "./overflowContext", "./useOverflowCount"], function (require, exports, React, react_utilities_1, overflowContext_1, useOverflowCount_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useOverflowMenu = void 0;
5
- function useOverflowMenu(id) {
6
- var elementId = react_utilities_1.useId('overflow-menu', id);
7
- var overflowCount = useOverflowCount_1.useOverflowCount();
8
- var registerOverflowMenu = overflowContext_1.useOverflowContext(function (v) { return v.registerOverflowMenu; });
9
- var updateOverflow = overflowContext_1.useOverflowContext(function (v) { return v.updateOverflow; });
10
- var ref = React.useRef(null);
11
- var isOverflowing = overflowCount > 0;
12
- react_utilities_1.useIsomorphicLayoutEffect(function () {
13
- if (ref.current) {
14
- return registerOverflowMenu(ref.current);
15
- }
16
- }, [registerOverflowMenu, isOverflowing, elementId]);
17
- react_utilities_1.useIsomorphicLayoutEffect(function () {
18
- if (isOverflowing) {
19
- updateOverflow();
20
- }
21
- }, [isOverflowing, updateOverflow, ref]);
22
- return { ref: ref, overflowCount: overflowCount, isOverflowing: isOverflowing };
23
- }
24
- exports.useOverflowMenu = useOverflowMenu;
25
- });
26
- //# sourceMappingURL=useOverflowMenu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOverflowMenu.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-overflow/src/useOverflowMenu.ts"],"names":[],"mappings":";;;;IAKA,SAAgB,eAAe,CAA+B,EAAW;QACvE,IAAM,SAAS,GAAG,uBAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAC7C,IAAM,aAAa,GAAG,mCAAgB,EAAE,CAAC;QACzC,IAAM,oBAAoB,GAAG,oCAAkB,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,oBAAoB,EAAtB,CAAsB,CAAC,CAAC;QAC7E,IAAM,cAAc,GAAG,oCAAkB,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,cAAc,EAAhB,CAAgB,CAAC,CAAC;QACjE,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAW,IAAI,CAAC,CAAC;QACzC,IAAM,aAAa,GAAG,aAAa,GAAG,CAAC,CAAC;QAExC,2CAAyB,CAAC;YACxB,IAAI,GAAG,CAAC,OAAO,EAAE;gBACf,OAAO,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAC1C;QACH,CAAC,EAAE,CAAC,oBAAoB,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;QAErD,2CAAyB,CAAC;YACxB,IAAI,aAAa,EAAE;gBACjB,cAAc,EAAE,CAAC;aAClB;QACH,CAAC,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;QAEzC,OAAO,EAAE,GAAG,KAAA,EAAE,aAAa,eAAA,EAAE,aAAa,eAAA,EAAE,CAAC;IAC/C,CAAC;IArBD,0CAqBC","sourcesContent":["import * as React from 'react';\nimport { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\nimport { useOverflowCount } from './useOverflowCount';\n\nexport function useOverflowMenu<TElement extends HTMLElement>(id?: string) {\n const elementId = useId('overflow-menu', id);\n const overflowCount = useOverflowCount();\n const registerOverflowMenu = useOverflowContext(v => v.registerOverflowMenu);\n const updateOverflow = useOverflowContext(v => v.updateOverflow);\n const ref = React.useRef<TElement>(null);\n const isOverflowing = overflowCount > 0;\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerOverflowMenu(ref.current);\n }\n }, [registerOverflowMenu, isOverflowing, elementId]);\n\n useIsomorphicLayoutEffect(() => {\n if (isOverflowing) {\n updateOverflow();\n }\n }, [isOverflowing, updateOverflow, ref]);\n\n return { ref, overflowCount, isOverflowing };\n}\n"]}