@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
2 lines (1 loc) • 2.32 kB
JavaScript
;const b=require("react"),u=require("react/jsx-runtime");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const i=R(b);function m(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function p(...e){return t=>{let r=!1;const o=e.map(n=>{const l=m(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<o.length;n++){const l=o[n];typeof l=="function"?l():m(e[n],null)}}}}function C(...e){return i.useCallback(p(...e),e)}function y(e){const t=E(e),r=i.forwardRef((o,n)=>{const{children:l,...c}=o,s=i.Children.toArray(l),f=s.find(O);if(f){const a=f.props.children,g=s.map(d=>d===f?i.Children.count(a)>1?i.Children.only(null):i.isValidElement(a)?a.props.children:null:d);return u.jsx(t,{...c,ref:n,children:i.isValidElement(a)?i.cloneElement(a,void 0,g):null})}return u.jsx(t,{...c,ref:n,children:l})});return r.displayName=`${e}.Slot`,r}var j=y("Slot");function E(e){const t=i.forwardRef((r,o)=>{const{children:n,...l}=r;if(i.isValidElement(n)){const c=x(n),s=_(l,n.props);return n.type!==i.Fragment&&(s.ref=o?p(o,c):c),i.cloneElement(n,s)}return i.Children.count(n)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S=Symbol("radix.slottable");function h(e){const t=({children:r})=>u.jsx(u.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=S,t}function O(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S}function _(e,t){const r={...t};for(const o in t){const n=e[o],l=t[o];/^on[A-Z]/.test(o)?n&&l?r[o]=(...s)=>{l(...s),n(...s)}:n&&(r[o]=n):o==="style"?r[o]={...n,...l}:o==="className"&&(r[o]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function x(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}exports.Slot=j;exports.composeRefs=p;exports.createSlot=y;exports.createSlottable=h;exports.useComposedRefs=C;