carbon-react
Version:
A library of reusable React components for easily building user interfaces.
2 lines (1 loc) • 2.09 kB
JavaScript
import{jsx as e}from"react/jsx-runtime";import{useRef as t}from"react";import r from"./navigation-bar.style.js";import{FixedNavigationBarContextProvider as n}from"./__internal__/fixed-navigation-bar.context.js";import o from"../../__internal__/utils/helpers/tags/tags.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const c=i=>{var{navigationType:c="light",isLoading:f=!1,children:p,ariaLabel:s,position:b,offset:u="0px",orientation:O,isGlobal:y}=i,g=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(i,["navigationType","isLoading","children","ariaLabel","position","offset","orientation","isGlobal"]);const j=t(null);return e(r,l(a(l(a({role:"navigation","aria-label":y?s||"Global Header":s,navigationType:y?"black":c,orientation:y?"top":O,offset:y?"0px":u,position:y?"fixed":b},g),{isGlobal:y,ref:j}),o(y?"global-header":"navigation-bar",g)),{children:e(n,{orientation:y?"top":O,offset:y?"0px":u,position:y?"fixed":b,navbarRef:j,children:!f&&p})}))};export{c as NavigationBar,c as default};