UNPKG

dgz-ui

Version:

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

7 lines (5 loc) 5.86 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../jsx-runtime-h4oGeKUK.cjs"),I=require("react");require("react-dom");const V=require("../index-C1oWDt_I.cjs"),A=require("../utils-BeXF6FlA.cjs");function M(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const a=M(I);function D(e,t=[]){let o=[];function n(i,u){const s=a.createContext(u);s.displayName=i+"Context";const l=o.length;o=[...o,u];const c=f=>{var S;const{scope:d,children:P,...m}=f,v=((S=d==null?void 0:d[e])==null?void 0:S[l])||s,O=a.useMemo(()=>m,Object.values(m));return p.jsxRuntimeExports.jsx(v.Provider,{value:O,children:P})};c.displayName=i+"Provider";function x(f,d){var v;const P=((v=d==null?void 0:d[e])==null?void 0:v[l])||s,m=a.useContext(P);if(m)return m;if(u!==void 0)return u;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[c,x]}const r=()=>{const i=o.map(u=>a.createContext(u));return function(s){const l=(s==null?void 0:s[e])||i;return a.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return r.scopeName=e,[n,T(r,...t)]}function T(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const u=n.reduce((s,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...s,...f}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return o.scopeName=t.scopeName,o}var L=Symbol.for("react.lazy"),g=a[" use ".trim().toString()];function q(e){return typeof e=="object"&&e!==null&&"then"in e}function R(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===L&&"_payload"in e&&q(e._payload)}function W(e){const t=k(e),o=a.forwardRef((n,r)=>{let{children:i,...u}=n;R(i)&&typeof g=="function"&&(i=g(i._payload));const s=a.Children.toArray(i),l=s.find(B);if(l){const c=l.props.children,x=s.map(f=>f===l?a.Children.count(c)>1?a.Children.only(null):a.isValidElement(c)?c.props.children:null:f);return p.jsxRuntimeExports.jsx(t,{...u,ref:r,children:a.isValidElement(c)?a.cloneElement(c,void 0,x):null})}return p.jsxRuntimeExports.jsx(t,{...u,ref:r,children:i})});return o.displayName=`${e}.Slot`,o}function k(e){const t=a.forwardRef((o,n)=>{let{children:r,...i}=o;if(R(r)&&typeof g=="function"&&(r=g(r._payload)),a.isValidElement(r)){const u=H(r),s=F(i,r.props);return r.type!==a.Fragment&&(s.ref=n?V.composeRefs(n,u):u),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var z=Symbol("radix.slottable");function B(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z}function F(e,t){const o={...t};for(const n in t){const r=e[n],i=t[n];/^on[A-Z]/.test(n)?r&&i?o[n]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(o[n]=r):n==="style"?o[n]={...r,...i}:n==="className"&&(o[n]=[r,i].filter(Boolean).join(" "))}return{...e,...o}}function H(e){var n,r;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_=G.reduce((e,t)=>{const o=W(`Primitive.${t}`),n=a.forwardRef((r,i)=>{const{asChild:u,...s}=r,l=u?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsxRuntimeExports.jsx(l,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),b="Progress",j=100,[X,re]=D(b),[Y,Z]=X(b),C=a.forwardRef((e,t)=>{const{__scopeProgress:o,value:n=null,max:r,getValueLabel:i=U,...u}=e;(r||r===0)&&!E(r)&&console.error(J(`${r}`,"Progress"));const s=E(r)?r:j;n!==null&&!h(n,s)&&console.error(K(`${n}`,"Progress"));const l=h(n,s)?n:null,c=y(l)?i(l,s):void 0;return p.jsxRuntimeExports.jsx(Y,{scope:o,value:l,max:s,children:p.jsxRuntimeExports.jsx(_.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":y(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":w(l,s),"data-value":l??void 0,"data-max":s,...u,ref:t})})});C.displayName=b;var N="ProgressIndicator",$=a.forwardRef((e,t)=>{const{__scopeProgress:o,...n}=e,r=Z(N,o);return p.jsxRuntimeExports.jsx(_.div,{"data-state":w(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...n,ref:t})});$.displayName=N;function U(e,t){return`${Math.round(e/t*100)}%`}function w(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function y(e){return typeof e=="number"}function E(e){return y(e)&&!isNaN(e)&&e>0}function h(e,t){return y(e)&&!isNaN(e)&&e<=t&&e>=0}function J(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${j}\`.`}function K(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${j} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var Q=C,ee=$;function te({className:e,value:t,children:o,...n}){return p.jsxRuntimeExports.jsxs(Q,{"data-slot":"progress",className:A.cn("bg-primary/20 relative h-3 w-full overflow-hidden rounded-full",e),...n,children:[p.jsxRuntimeExports.jsx(ee,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}}),p.jsxRuntimeExports.jsx("div",{className:"text-body-2xs-semi-bold text-inverted absolute top-0 left-1 leading-3.5",children:o})]})}exports.Progress=te;