UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 2.44 kB
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import"react";import"../../style/utils/filter-styled-system-padding-props.js";import o from"../../style/utils/filter-styled-system-margin-props.js";import n from"../../hooks/useMediaQuery/useMediaQuery.js";import i from"../../hooks/__internal__/useLocale/useLocale.js";import s from"../../__internal__/utils/helpers/tags/tags.js";import a from"./loader.style.js";import l,{StyledLoaderPlaceholder as c}from"./loader-square.style.js";import{Typography as p}from"../typography/typography.component.js";function u(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),o.forEach((function(r){u(e,r,t[r])}))}return e}const f=u=>{var{variant:f="default",size:y="medium",isInsideButton:m=!1,isActive:b=!0,loaderLabel:O}=u,j=function(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}(u,["variant","size","isInsideButton","isActive","loaderLabel"]);const g=i(),v=n("screen and (prefers-reduced-motion: no-preference)");if(void 0===v)return e(c,{});const h={isInsideButton:m,isActive:b,size:y,variant:f};return e(a,(P=d({},s("loader",j),o(j)),w=null!=(w={children:v?r(t,{children:[["#13A038","#0092DB","#8F49FE"].map((r=>e(l,d({"data-role":"loader-square",backgroundColor:"gradient"===f?r:"var(--colorsActionMajor500)"},h),r))),e(p,{"data-role":"hidden-label",variant:"span",screenReaderOnly:!0,children:O||g.loader.loading()})]}):O||g.loader.loading()})?w:{},Object.getOwnPropertyDescriptors?Object.defineProperties(P,Object.getOwnPropertyDescriptors(w)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(w)).forEach((function(e){Object.defineProperty(P,e,Object.getOwnPropertyDescriptor(w,e))})),P));var P,w};export{f as Loader,f as default};