UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

2 lines (1 loc) 2.42 kB
"use strict";const b=require("react"),f=require("./jsx-runtime-DUiatUiq.cjs");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 s=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 x(...e){return s.useCallback(p(...e),e)}function y(e){const t=E(e),r=s.forwardRef((o,n)=>{const{children:l,...c}=o,i=s.Children.toArray(l),u=i.find(h);if(u){const a=u.props.children,g=i.map(d=>d===u?s.Children.count(a)>1?s.Children.only(null):s.isValidElement(a)?a.props.children:null:d);return f.jsxRuntimeExports.jsx(t,{...c,ref:n,children:s.isValidElement(a)?s.cloneElement(a,void 0,g):null})}return f.jsxRuntimeExports.jsx(t,{...c,ref:n,children:l})});return r.displayName=`${e}.Slot`,r}var j=y("Slot");function E(e){const t=s.forwardRef((r,o)=>{const{children:n,...l}=r;if(s.isValidElement(n)){const c=_(n),i=O(l,n.props);return n.type!==s.Fragment&&(i.ref=o?p(o,c):c),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S=Symbol("radix.slottable");function C(e){const t=({children:r})=>f.jsxRuntimeExports.jsx(f.jsxRuntimeExports.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=S,t}function h(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S}function O(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]=(...i)=>{const u=l(...i);return n(...i),u}:n&&(r[o]=n):o==="style"?r[o]={...n,...l}:o==="className"&&(r[o]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function _(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=C;exports.useComposedRefs=x;