ono-react-element 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/FileDropZone-Czdv3XF4.js +1 -0
- package/dist/es/Input-UCScuMXP.js +1 -0
- package/dist/es/{Select-BSNVfoEp.js → Select-D5zgLQ8n.js} +1 -1
- package/dist/es/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/style/FileDropZone.css +1 -0
- package/dist/style/Select.css +1 -1
- package/dist/style/Tooltip.css +1 -1
- package/dist/types/components/FileDropZone/FileDropZone.d.ts +2 -0
- package/dist/types/components/FileDropZone/index.d.ts +2 -0
- package/dist/types/components/FileDropZone/types.d.ts +28 -0
- package/dist/types/components/Input/Input.d.ts +1 -1
- package/dist/types/components/Input/Textarea.d.ts +1 -1
- package/dist/types/components/Input/types.d.ts +5 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.br +0 -0
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +1 -1
- package/dist/umd/index.umd.cjs.br +0 -0
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +1 -1
- package/dist/es/Input-lVK5hctw.js +0 -1
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from "./dependencies-B7YNjh_z.js";import{useState as f,useRef as $,useEffect as q}from "react";import{u as A}from "./useKeyPress.tsx-hgs6v_Jt.js";const H=()=>o.jsx("svg",{className:"ono-input-icon",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",fill:"currentColor","aria-hidden":"true",children:o.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})}),I=({open:x})=>o.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":x ? "eye":"eye-invisible",fill:"currentColor","aria-hidden":"true",className:"ono-input-icon",children:x ? o.jsx("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),o.jsx("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]})}),J=({id:x,name:D,max:R,min:N,maxLength:L,minLength:Q,type:Y="text",className:E,defaultValue:F,placeholder:O,readonly:V,autocomplete:W="off",autofocus:z,form:y,disabled:v,clearable:S,showPassword:B,prepend:p,append:d,prefix:g,suffix:m,showCount:M,border:P="1px solid #5644b8",boxShadow:b="0 0 0 2px #7969d11a",value:w="",onChange:h,onFocus:C,onBlur:s,onClear:j})=>{const [k,t]=f(w),[e,a]=f(!1),[r,i]=f(!1),n=$(null),l=S&&!v&&k,u=B&&!v;return q(()=>{n.current&&(n.current.style.setProperty("--ono-input-border",P),n.current.style.setProperty("--ono-input-box-shadow",b));},[n]),q(()=>{t(w);},[w]),o.jsxs("div",{className:["ono-input","ono-input-border",v ? "ono-input-is-disabled":""].filter(Boolean).join(" "),children:[p&&o.jsx("div",{className:"ono-prepend",children:p}),o.jsxs("div",{ref:n,className:["ono-input-wrapper",e ? "ono-input-is-focus":"",E].filter(Boolean).join(" "),onMouseDown:(c)=>{c.target.tagName!=="INPUT"&&c.preventDefault();},children:[g&&o.jsx("span",{className:"ono-prefix",children:g}),o.jsx("input",{id:x,max:R,min:N,name:D,maxLength:L,minLength:Q,defaultValue:F,className:"ono-input-inner",type:B ? r ? "text":"password":Y,placeholder:O,readOnly:V,autoComplete:W,autoFocus:z,form:y,disabled:v,onFocus:(c)=>{C==null||C(c),a(!0);},onBlur:(c)=>{s==null||s(c),a(!1);},value:k,onChange:(c)=>{h==null||h(c),t(c.target.value);}}),(m||l||u||M)&&o.jsxs("span",{className:"ono-suffix",children:[m,l&&o.jsx("button",{className:"ono-clear-icon",onClick:()=>{j==null||j(),t("");},children:o.jsx(H,{})}),u&&o.jsx("button",{className:"ono-eye-icon",onClick:()=>i(!r),children:o.jsx(I,{open:r})}),M&&L&&o.jsxs("p",{className:"ono-count",children:[k.length,"/",L]})]})]}),d&&o.jsx("div",{className:"ono-append",children:d})]});},K=({id:x,name:D,rows:R,maxLength:N,minLength:L,className:Q,placeholder:Y,readonly:E,resize:F=!0,autocomplete:O="off",autofocus:V,form:W,disabled:z,autoSize:y,showCount:v,border:S="1px solid #5644b8",boxShadow:B="0 0 0 2px #7969d11a",value:p="",onChange:d})=>{const [g,m]=f(p),[M,P]=f(!1),[b,w]=f([p]),[h,C]=f(0),s=$(null),j=(t)=>{const e=b.slice(0,h+1);e.push(t),w(e),C(e.length-1);};return [{key:"CommandOrControl+z",handler:(t)=>{document.activeElement===s.current&&(t.preventDefault(),(()=>{if(h>0&&s.current){const e=h-1,a=b[e];if(s.current.value=a,m(a),C(e),d){const r={target:s.current};d(r);}}})());},deps:[b]},{key:"CommandOrControl+d",handler:(t)=>{if(s.current&&document.activeElement===s.current){t.preventDefault();const e=((a)=>{const{value:r,selectionStart:i,selectionEnd:n}=a,l=r.substring(0,i)+r.substring(n);return a.value=l,a.setSelectionRange(i,i),l;})(s.current);if(m(e),j(e),d){const a={target:s.current};d(a);}}},deps:[b]}].forEach(({key:t,handler:e,deps:a})=>A(t,e,{target:s.current,deps:a})),q(()=>{m(p);},[p]),q(()=>{(()=>{if(!s.current)return;const t=s.current;((e,a,r,i,n)=>{const l=e.parentNode;e.style.resize=a ? "none":r ? "vertical":"none",l.style.setProperty("--ono-input-border",i),l.style.setProperty("--ono-input-box-shadow",n),l.style.setProperty("--ono-input-height","auto");})(t,y||!1,F,S,B),y&&((e,a)=>{const{minRows:r=2,maxRows:i}=typeof a=="object" ? a:{},n=document.createElement("div");n.style.position="absolute",n.style.visibility="hidden",n.style.whiteSpace="pre-wrap",n.style.wordWrap="break-word",n.style.width=`${e.clientWidth}px`,n.style.font=getComputedStyle(e).font,n.style.padding=getComputedStyle(e).padding,n.style.border=getComputedStyle(e).border,n.style.boxSizing="border-box",document.body.appendChild(n);const l=34*r;let u=l;if(e.value){n.textContent=e.value;const c=n.offsetHeight;u=Math.max(l,c),i&&u>34*i ?(u=34*i,e.style.overflowY="auto"):e.style.overflowY="hidden";}else e.style.overflowY="hidden";e.style.height=`${u}px`,e.style.resize=a ? "none":"vertical",document.body.removeChild(n),Math.floor(u/34);})(t,y);})();},[s,y,g]),o.jsxs("div",{className:["ono-textarea",z ? "ono-input-is-disabled":""].filter(Boolean).join(" "),children:[o.jsx("div",{className:["ono-textarea-wrapper",M ? S==="none" ? "":"ono-input-is-focus":"",Q].filter(Boolean).join(" "),onClick:()=>{var t;return(t=s.current)==null ? void 0:t.focus();},children:o.jsx("textarea",{ref:s,className:"ono-textarea-inner",id:x,rows:R,name:D,maxLength:N,minLength:L,placeholder:Y,readOnly:E,autoComplete:O,autoFocus:V,form:W,disabled:z,onFocus:()=>P(!0),onBlur:()=>P(!1),value:g,onChange:(t)=>{m(t.target.value),j(t.target.value),d==null||d(t);}})}),v&&N&&o.jsx("p",{className:"ono-count-bar",onClick:(t)=>t.stopPropagation(),children:g.length+"/"+N})]});};export{J as O,K as a};
|