UNPKG

@undp/design-system-react

Version:

React based design system for UNDP

2 lines 2.77 kB
const e=require("./rolldown-runtime-mLOUI7ql.cjs");let t=require("react");t=e.r(t,1);function n(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function r(...e){return t=>{let r=!1,i=e.map(e=>{let i=n(e,t);return!r&&typeof i==`function`&&(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){let r=i[t];typeof r==`function`?r():n(e[t],null)}}}}function i(...e){return t.useCallback(r(...e),e)}function a(e){let n=t.forwardRef((n,r)=>{let{children:a,...o}=n,s=null,c=!1,p=[];m(a)&&typeof v==`function`&&(a=v(a._payload)),t.Children.forEach(a,e=>{if(f(e)){c=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;m(n)&&typeof v==`function`&&(n=v(n._payload)),s=l(t,n),p.push(s?.props?.children)}else p.push(e)}),s?s=t.cloneElement(s,void 0,p):!c&&t.Children.count(a)===1&&t.isValidElement(a)&&(s=a);let h=s?d(s):void 0,y=i(r,h);if(!s){if(a||a===0)throw Error(c?_(e):g(e));return a}let b=u(o,s.props??{});return s.type!==t.Fragment&&(b.ref=r?y:h),t.cloneElement(s,b)});return n.displayName=`${e}.Slot`,n}var o=a(`Slot`),s=Symbol.for(`radix.slottable`);function c(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=s,t}var l=(e,n)=>{if(`child`in e.props){let n=e.props.child;return t.isValidElement(n)?t.cloneElement(n,void 0,e.props.children(n.props.children)):null}return t.isValidElement(n)?n:null};function u(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function d(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function f(e){return t.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===s}var p=Symbol.for(`react.lazy`);function m(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===p&&`_payload`in e&&h(e._payload)}function h(e){return typeof e==`object`&&!!e&&`then`in e}var g=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,_=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,v=t.use;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}}); //# sourceMappingURL=dist--OhUIyHO.cjs.map