@nice2dev/ui 1.1.9 → 1.2.0
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/CHANGELOG.md +150 -0
- package/README.md +27 -34
- package/dist/NiceButton-5tWvfXKl.cjs +1 -0
- package/dist/NiceButton-DHSgQT1_.js +112 -0
- package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
- package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
- package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
- package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
- package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
- package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
- package/dist/NiceColorPicker-DK30kJgy.js +486 -0
- package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
- package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
- package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
- package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
- package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
- package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
- package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
- package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
- package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
- package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
- package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
- package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
- package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
- package/dist/NiceForm-BCEXovJR.cjs +1 -0
- package/dist/NiceForm-D7oyWHXg.js +4820 -0
- package/dist/NiceForm-DUhxXArr.js +4817 -0
- package/dist/NiceForm-DVc0Xoly.js +4819 -0
- package/dist/NiceForm-qD_RKPYz.cjs +1 -0
- package/dist/NiceForm-uCeVmTrD.cjs +1 -0
- package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
- package/dist/NiceGantt-B_1lwEsp.js +328 -0
- package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
- package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
- package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
- package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
- package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
- package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
- package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
- package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
- package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
- package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
- package/dist/NiceLoginForm.css +1 -0
- package/dist/NiceMention-CA7CL5BI.js +11263 -0
- package/dist/NiceMention-CHcKRl-L.cjs +430 -0
- package/dist/NiceMention-DJD0BLcp.js +11269 -0
- package/dist/NiceMention-DcaUEMSg.cjs +430 -0
- package/dist/NiceMention-Dds9GQzk.cjs +430 -0
- package/dist/NiceMention-DlLXWddO.js +11268 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-C4p8a82e.cjs +1 -0
- package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
- package/dist/NiceModal-TNlkaL_i.js +85 -0
- package/dist/NiceModal-sihGCfDy.js +95 -0
- package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
- package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
- package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
- package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
- package/dist/NicePagination-8XsBbMNx.js +165 -0
- package/dist/NicePagination-CkOoXf0f.js +165 -0
- package/dist/NicePagination-D44waj9o.cjs +1 -0
- package/dist/NicePagination-D7lek1G7.cjs +1 -0
- package/dist/NicePagination-DdxH8KMG.js +179 -0
- package/dist/NicePagination-OjTEfZJE.cjs +1 -0
- package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
- package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
- package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
- package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
- package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
- package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
- package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
- package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
- package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
- package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
- package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
- package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
- package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
- package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
- package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
- package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
- package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
- package/dist/NiceSelect-BCbWtu1v.js +433 -0
- package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
- package/dist/NiceSelect-DZB1Rs9x.js +435 -0
- package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
- package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
- package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
- package/dist/NiceWindow-BEov3s9F.js +2094 -0
- package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
- package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
- package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-C047IMVn.cjs +768 -0
- package/dist/charts-C44vJber.cjs +768 -0
- package/dist/charts-CCXSb3xk.js +4752 -0
- package/dist/charts-CqETcUhH.js +4752 -0
- package/dist/charts-DouiiHOT.cjs +768 -0
- package/dist/charts-XVlDwU0y.js +4732 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +8 -8
- package/dist/core-BL-KmGYC.js +795 -0
- package/dist/core-BxiH7vkV.cjs +1 -0
- package/dist/core-Chg-oYCr.cjs +1 -0
- package/dist/core-CxBnKAhs.cjs +1 -0
- package/dist/core-DMV6_SEE.js +795 -0
- package/dist/core-D_LRh59n.js +795 -0
- package/dist/data-branching-Km4lc8P_.cjs +1 -0
- package/dist/data-branching-YQtJJEtn.js +6273 -0
- package/dist/data-branching-oEH04O3i.js +6273 -0
- package/dist/data-branching-wmsbLNfa.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +2 -53
- package/dist/data.mjs +3 -3
- package/dist/devops-Bt6EsfPa.cjs +17 -0
- package/dist/devops-CnZQ1rU5.js +8312 -0
- package/dist/devops-D5yIDM3e.js +8312 -0
- package/dist/devops-rVpB0ZAX.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +8 -26
- package/dist/editors.mjs +55 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +290 -290
- package/dist/index.css +1 -1
- package/dist/index.d.ts +239 -234
- package/dist/index.mjs +20262 -19440
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +29 -29
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +69 -69
- package/dist/no-code-4GtIBr6f.js +7503 -0
- package/dist/no-code-6WyYb3hL.cjs +331 -0
- package/dist/no-code-BH5oVFC6.js +8186 -0
- package/dist/no-code-Bdwh1vyS.cjs +332 -0
- package/dist/no-code-CnHG5_Vn.js +8186 -0
- package/dist/no-code-DMKlg1Zl.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.d.ts +25 -18
- package/dist/no-code.mjs +3 -3
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +24 -24
- package/dist/overlays.mjs +24 -490
- package/dist/pickerCommons-0vyK1Knv.js +547 -0
- package/dist/pickerCommons-31hyz1gs.js +1122 -0
- package/dist/pickerCommons-BFbItm8o.cjs +1 -0
- package/dist/pickerCommons-BHirHJyn.js +548 -0
- package/dist/pickerCommons-BifIkPdk.cjs +1 -0
- package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +10 -7
- package/package.json +5 -7
- package/css/legacy-bg-text-aliases.css +0 -87
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),y=require("react"),pe=require("react-dom"),me=require("./NiceSelect-BqtiQbfD.cjs"),ee=y.forwardRef(({children:s,variant:l="primary",size:p="md",type:u="button",disabled:t,loading:n,fullWidth:r,onClick:h,leftIcon:c,rightIcon:o,error:a,errorPlacement:v="bottom",ariaLabel:B,className:K,style:U,id:S,accessMode:O,displayStyle:I,...V},W)=>{const w=M.normalizeVariant(l),E=M.normalizeSize(p),R=M.useNiceAccessMode(O,S),H=R==="hidden";(R==="disabled"||R==="readOnly")&&(t=!0);const D=M.useComponentDisplayStyle("button",I),z=M.useComponentDisplayClass("button",I);let A=D;if(w!=="primary"){const g={...D};delete g.background,delete g.color,(w==="outline"||w==="ghost")&&(delete g.border,delete g.borderColor,delete g.borderWidth,delete g.borderStyle,delete g.boxShadow),A=g}const _=s!=null&&s!==!1&&!(typeof s=="string"&&s.trim()===""),C=!_&&!!(c||o),F=e.jsxs("button",{ref:W,type:u,id:S,className:`nice-btn nice-btn--${w} nice-btn--${E} nice-btn--ds-${z} ${C?"nice-btn--icon-only":""} ${r?"nice-btn--full-width":""} ${n?"nice-btn--loading":""} ${a&&!v?"nice-btn--has-error":""} ${K||""}`,style:{...A,...U},disabled:t||n,"aria-busy":n||void 0,"aria-disabled":t||n||void 0,"aria-label":B,onClick:h,...V,children:[n&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),!n&&c&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:c}),!n&&_&&e.jsx("span",{children:s}),n&&_&&e.jsx("span",{style:{visibility:"hidden"},"aria-hidden":"true",children:s}),n&&C&&e.jsx("span",{className:"nice-btn__icon",style:{visibility:"hidden"},"aria-hidden":"true",children:c||o}),!n&&o&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:o})]});if(H)return null;if(!a)return F;const P=e.jsx("div",{className:"nice-field__error",role:"alert",children:a});return v==="right"?e.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${E}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[F,P]}):H?null:e.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${E}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[F,P]})});ee.displayName="NiceButton";const fe=["#ef4444","#f97316","#f59e0b","#84cc16","#10b981","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#ec4899","#64748b","#1e293b"];function he(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function be(s){const l=/^#?([0-9a-f]{6})$/i.exec(s.trim());if(!l)return{r:0,g:0,b:0};const p=parseInt(l[1],16);return{r:p>>16&255,g:p>>8&255,b:p&255}}function xe(s,l,p){const u=t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0");return`#${u(s)}${u(l)}${u(p)}`}function ve(s,l,p){const u=s/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),c=(r+h)/2;let o=0,a=0;if(r!==h){const v=r-h;switch(a=c>.5?v/(2-r-h):v/(r+h),r){case u:o=(t-n)/v+(t<n?6:0);break;case t:o=(n-u)/v+2;break;case n:o=(u-t)/v+4;break}o*=60}return{h:Math.round(o),s:Math.round(a*100),l:Math.round(c*100)}}function _e(s,l,p){const u=l/100,t=p/100,n=(1-Math.abs(2*t-1))*u,r=n*(1-Math.abs(s/60%2-1)),h=t-n/2;let c=0,o=0,a=0;return s<60?[c,o,a]=[n,r,0]:s<120?[c,o,a]=[r,n,0]:s<180?[c,o,a]=[0,n,r]:s<240?[c,o,a]=[0,r,n]:s<300?[c,o,a]=[r,0,n]:[c,o,a]=[n,0,r],{r:Math.round((c+h)*255),g:Math.round((o+h)*255),b:Math.round((a+h)*255)}}function ge(s,l,p){const u=s/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),c=r-h;let o=0;c!==0&&(r===u?o=(t-n)/c%6:r===t?o=(n-u)/c+2:o=(u-t)/c+4,o*=60,o<0&&(o+=360));const a=r===0?0:c/r;return{h:Math.round(o),s:Math.round(a*100),v:Math.round(r*100)}}function Ne(s,l,p){const u=l/100,t=p/100,n=t*u,r=n*(1-Math.abs(s/60%2-1)),h=t-n;let c=0,o=0,a=0;return s<60?[c,o,a]=[n,r,0]:s<120?[c,o,a]=[r,n,0]:s<180?[c,o,a]=[0,n,r]:s<240?[c,o,a]=[0,r,n]:s<300?[c,o,a]=[r,0,n]:[c,o,a]=[n,0,r],{r:Math.round((c+h)*255),g:Math.round((o+h)*255),b:Math.round((a+h)*255)}}function ye(s){let l=s.trim();const p=/var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);p&&(l=p[1]);const u=/^#?([0-9a-f]{3})$/i.exec(l);u&&(l=`#${u[1].split("").map(r=>r+r).join("")}`);const t=/^#?([0-9a-f]{6})$/i.exec(l),n=/^#?([0-9a-f]{8})$/i.exec(l);if(n){const r=n[1];return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16),a:parseInt(r.slice(6,8),16)/255}}if(t){const r=parseInt(t[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255,a:1}}return{r:0,g:0,b:0,a:1}}function ke(s,l,p,u,t){const n=h=>Math.max(0,Math.min(255,Math.round(h))).toString(16).padStart(2,"0"),r=`#${n(s)}${n(l)}${n(p)}`;return t?`${r}${n(u*255)}`:r}const G=y.forwardRef(({label:s,helperText:l,error:p,required:u,disabled:t,id:n,className:r,style:h,accessMode:c,displayStyle:o,value:a="#3b82f6",onChange:v,presets:B=fe,showInput:K=!1,showRandom:U=!1,withAlpha:S=!1,compact:O=!1,showKeyboardHints:I,size:V="md",labelPlacement:W,errorPlacement:w,labelWidth:E,controlWidth:R,loading:H},D)=>{const z=M.useNiceAccessMode(c,n),A=z==="hidden";(z==="disabled"||z==="readOnly")&&(t=!0);const{t:_}=M.useNiceTranslation(),C=M.useControlId(n);M.useComponentDisplayClass("input",o);const F=y.useCallback(()=>{t||v?.(he())},[t,v]),[P,g]=y.useState(!1),[X,ne]=y.useState(null),[Y,te]=y.useState(""),J=y.useRef(null),q=y.useRef(null);y.useLayoutEffect(()=>{if(!P||!q.current)return;te(me.scopeThemeClass(q.current));const m=()=>{const d=q.current?.getBoundingClientRect();if(!d)return;const k=280,j=360;let N=d.left,L=d.bottom+6;N+k>window.innerWidth-8&&(N=Math.max(8,window.innerWidth-k-8)),L+j>window.innerHeight-8&&(L=Math.max(8,d.top-j-6)),ne({left:N,top:L})};return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[P]),y.useEffect(()=>{if(!P)return;const m=k=>{const j=k.target;J.current?.contains(j)||q.current?.contains(j)||g(!1)},d=k=>{k.key==="Escape"&&g(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d)}},[P]);const re=y.useMemo(()=>[{key:"Enter",description:_("shortcuts.openPicker","Open color picker")},{key:"Arrow keys",description:_("shortcuts.navigatePresets","Navigate presets")}],[_]);return A?null:e.jsxs("div",{className:`nice-field nice-field--${V} ${W==="left"?"nice-field--label-left":""} ${O?"nice-color-picker--compact":""} ${H?"nice-field--loading":""} ${r||""}`,style:{...h,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...R!=null&&{"--nice-field-control-width":typeof R=="number"?`${R}px`:R}},"aria-busy":H||void 0,children:[s&&e.jsxs("label",{htmlFor:C,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[s,I&&e.jsx(M.NiceKeyboardHint,{shortcuts:re,size:"sm"})]}),e.jsx("div",{className:"nice-field__control",children:e.jsxs("div",{className:"nice-color-picker",children:[e.jsxs("div",{className:"nice-color-picker__preview-row",children:[e.jsx("div",{ref:q,className:"nice-color-picker__swatch",id:C,style:{background:a},onClick:m=>{m.stopPropagation(),t||g(d=>!d)},onKeyDown:m=>{!t&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),g(d=>!d))},role:"button",tabIndex:0,"aria-label":_("colorPicker.openPalette","Open color palette"),"aria-haspopup":"dialog","aria-expanded":P,children:e.jsx("input",{ref:m=>{typeof D=="function"?D(m):D&&(D.current=m)},type:"hidden",value:a,disabled:t,readOnly:!0})}),K&&e.jsx("div",{className:"nice-input nice-input--sm",style:O?{flex:1,minWidth:0}:{width:100},children:e.jsx("input",{className:"nice-input__native",type:"text",value:a,disabled:t,onChange:m=>v?.(m.target.value),maxLength:S?9:7})}),U&&!O&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",onClick:F,disabled:t,title:_("colorPicker.random","Random"),"aria-label":_("colorPicker.random","Random"),style:{fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:_("colorPicker.random","Random")}),H&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),w==="right"&&p&&e.jsx("div",{id:`${C}-error`,className:"nice-field__error",role:"alert",children:p}),w==="right"&&!p&&l&&e.jsx("div",{id:`${C}-helper`,className:"nice-field__helper",children:l})]}),P&&X&&typeof document<"u"&&pe.createPortal(e.jsx("div",{ref:J,className:`nice-color-picker__popup nice-color-picker__popup--portal ${Y}`,"data-theme":Y==="nice-dark"?"dark":Y==="nice-light"?"light":void 0,role:"dialog","aria-label":_("colorPicker.palette","Color palette"),style:{position:"fixed",left:X.left,top:X.top},onClick:m=>m.stopPropagation(),children:(()=>{const m=ye(a),d={r:m.r,g:m.g,b:m.b},k=S?m.a:1,j=ve(d.r,d.g,d.b),N=ge(d.r,d.g,d.b),L=(i,b,x,f=k)=>v?.(ke(i,b,x,f,S)),ie=(i,b,x)=>L(i,b,x),se=(i,b,x)=>{const f=_e(i,b,x);L(f.r,f.g,f.b)},Q=(i,b,x)=>{const f=Ne(i,b,x);L(f.r,f.g,f.b)},Z=i=>L(d.r,d.g,d.b,i),oe=i=>{if(t)return;const b=i.currentTarget,x=$=>{const T=b.getBoundingClientRect(),ae=Math.max(0,Math.min(T.width,$.clientX-T.left)),le=Math.max(0,Math.min(T.height,$.clientY-T.top)),ue=Math.round(ae/T.width*100),de=100-Math.round(le/T.height*100);Q(N.h,ue,de)};x(i);const f=()=>{document.removeEventListener("pointermove",x),document.removeEventListener("pointerup",f)};document.addEventListener("pointermove",x),document.addEventListener("pointerup",f)},ce=`hsl(${N.h}, 100%, 50%)`;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-color-picker__popup-header",children:e.jsx("input",{type:"text",className:"nice-input__native nice-color-picker__popup-hex",value:a,disabled:t,onChange:i=>v?.(i.target.value),maxLength:S?9:7,"aria-label":_("colorPicker.hexValue","Hex value")})}),e.jsx("input",{type:"range",min:0,max:360,value:N.h,disabled:t,onChange:i=>Q(Number(i.target.value),N.s,N.v),className:"nice-color-picker__hue-slider","aria-label":_("colorPicker.hue","Hue")}),e.jsx("div",{className:"nice-color-picker__sv",style:{background:`linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ce})`},onPointerDown:oe,role:"application","aria-label":_("colorPicker.svPalette","Saturation/value palette"),children:e.jsx("span",{className:"nice-color-picker__sv-marker",style:{left:`${N.s}%`,top:`${100-N.v}%`}})}),e.jsxs("div",{className:"nice-color-picker__sliders",children:[e.jsx("div",{className:"nice-color-picker__slider-col",children:["h","s","l"].map(i=>{const b=i==="h"?360:100,x=j[i],f=$=>se(i==="h"?$:j.h,i==="s"?$:j.s,i==="l"?$:j.l);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:b,value:x,disabled:t,onChange:$=>f(Number($.target.value))}),e.jsx("input",{type:"number",min:0,max:b,value:x,disabled:t,onChange:$=>f(Number($.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})}),e.jsx("div",{className:"nice-color-picker__slider-col",children:["r","g","b"].map(i=>{const b=d[i],x=f=>ie(i==="r"?f:d.r,i==="g"?f:d.g,i==="b"?f:d.b);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:255,value:b,disabled:t,onChange:f=>x(Number(f.target.value))}),e.jsx("input",{type:"number",min:0,max:255,value:b,disabled:t,onChange:f=>x(Number(f.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})})]}),S&&e.jsxs("div",{className:"nice-color-picker__alpha-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:"A"}),e.jsx("input",{type:"range",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z(Number(i.target.value)/100),className:"nice-color-picker__alpha-slider",style:{background:`linear-gradient(to right, transparent, rgb(${d.r},${d.g},${d.b}))`},"aria-label":_("colorPicker.alpha","Alpha")}),e.jsx("input",{type:"number",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z((Number(i.target.value)||0)/100),className:"nice-input__native nice-color-picker__slider-num"})]}),B.length>0&&e.jsx("div",{className:"nice-color-picker__popup-presets",children:B.map(i=>e.jsx("div",{className:`nice-color-picker__preset ${a===i?"nice-color-picker__preset--active":""}`,style:{background:i},onClick:()=>{v?.(i),g(!1)},role:"button",tabIndex:0,"aria-label":i,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),v?.(i),g(!1))}},i))})]})})()}),document.body)]})}),w!=="right"&&p&&e.jsx("div",{id:`${C}-error`,className:"nice-field__error",role:"alert",children:p}),w!=="right"&&!p&&l&&e.jsx("div",{id:`${C}-helper`,className:"nice-field__helper",children:l})]})});G.displayName="NiceColorPicker";const je=Object.freeze(Object.defineProperty({__proto__:null,NiceColorPicker:G,hexToRgb:be,rgbToHex:xe},Symbol.toStringTag,{value:"Module"}));exports.NiceButton=ee;exports.NiceColorPicker=G;exports.NiceColorPicker$1=je;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),y=require("react"),pe=require("react-dom"),me=require("./NiceSelect-tMz9QQUs.cjs"),ee=y.forwardRef(({children:s,variant:l="primary",size:p="md",type:u="button",disabled:t,loading:n,fullWidth:r,onClick:h,leftIcon:c,rightIcon:o,error:a,errorPlacement:v="bottom",ariaLabel:B,className:K,style:U,id:S,accessMode:O,displayStyle:I,...V},W)=>{const w=M.normalizeVariant(l),E=M.normalizeSize(p),R=M.useNiceAccessMode(O,S),H=R==="hidden";(R==="disabled"||R==="readOnly")&&(t=!0);const D=M.useComponentDisplayStyle("button",I),z=M.useComponentDisplayClass("button",I);let A=D;if(w!=="primary"){const g={...D};delete g.background,delete g.color,(w==="outline"||w==="ghost")&&(delete g.border,delete g.borderColor,delete g.borderWidth,delete g.borderStyle,delete g.boxShadow),A=g}const _=s!=null&&s!==!1&&!(typeof s=="string"&&s.trim()===""),C=!_&&!!(c||o),F=e.jsxs("button",{ref:W,type:u,id:S,className:`nice-btn nice-btn--${w} nice-btn--${E} nice-btn--ds-${z} ${C?"nice-btn--icon-only":""} ${r?"nice-btn--full-width":""} ${n?"nice-btn--loading":""} ${a&&!v?"nice-btn--has-error":""} ${K||""}`,style:{...A,...U},disabled:t||n,"aria-busy":n||void 0,"aria-disabled":t||n||void 0,"aria-label":B,onClick:h,...V,children:[n&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),!n&&c&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:c}),!n&&_&&e.jsx("span",{children:s}),n&&_&&e.jsx("span",{style:{visibility:"hidden"},"aria-hidden":"true",children:s}),n&&C&&e.jsx("span",{className:"nice-btn__icon",style:{visibility:"hidden"},"aria-hidden":"true",children:c||o}),!n&&o&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:o})]});if(H)return null;if(!a)return F;const P=e.jsx("div",{className:"nice-field__error",role:"alert",children:a});return v==="right"?e.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${E}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[F,P]}):H?null:e.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${E}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[F,P]})});ee.displayName="NiceButton";const fe=["#ef4444","#f97316","#f59e0b","#84cc16","#10b981","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#ec4899","#64748b","#1e293b"];function he(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function be(s){const l=/^#?([0-9a-f]{6})$/i.exec(s.trim());if(!l)return{r:0,g:0,b:0};const p=parseInt(l[1],16);return{r:p>>16&255,g:p>>8&255,b:p&255}}function xe(s,l,p){const u=t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0");return`#${u(s)}${u(l)}${u(p)}`}function ve(s,l,p){const u=s/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),c=(r+h)/2;let o=0,a=0;if(r!==h){const v=r-h;switch(a=c>.5?v/(2-r-h):v/(r+h),r){case u:o=(t-n)/v+(t<n?6:0);break;case t:o=(n-u)/v+2;break;case n:o=(u-t)/v+4;break}o*=60}return{h:Math.round(o),s:Math.round(a*100),l:Math.round(c*100)}}function _e(s,l,p){const u=l/100,t=p/100,n=(1-Math.abs(2*t-1))*u,r=n*(1-Math.abs(s/60%2-1)),h=t-n/2;let c=0,o=0,a=0;return s<60?[c,o,a]=[n,r,0]:s<120?[c,o,a]=[r,n,0]:s<180?[c,o,a]=[0,n,r]:s<240?[c,o,a]=[0,r,n]:s<300?[c,o,a]=[r,0,n]:[c,o,a]=[n,0,r],{r:Math.round((c+h)*255),g:Math.round((o+h)*255),b:Math.round((a+h)*255)}}function ge(s,l,p){const u=s/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),c=r-h;let o=0;c!==0&&(r===u?o=(t-n)/c%6:r===t?o=(n-u)/c+2:o=(u-t)/c+4,o*=60,o<0&&(o+=360));const a=r===0?0:c/r;return{h:Math.round(o),s:Math.round(a*100),v:Math.round(r*100)}}function Ne(s,l,p){const u=l/100,t=p/100,n=t*u,r=n*(1-Math.abs(s/60%2-1)),h=t-n;let c=0,o=0,a=0;return s<60?[c,o,a]=[n,r,0]:s<120?[c,o,a]=[r,n,0]:s<180?[c,o,a]=[0,n,r]:s<240?[c,o,a]=[0,r,n]:s<300?[c,o,a]=[r,0,n]:[c,o,a]=[n,0,r],{r:Math.round((c+h)*255),g:Math.round((o+h)*255),b:Math.round((a+h)*255)}}function ye(s){let l=s.trim();const p=/var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);p&&(l=p[1]);const u=/^#?([0-9a-f]{3})$/i.exec(l);u&&(l=`#${u[1].split("").map(r=>r+r).join("")}`);const t=/^#?([0-9a-f]{6})$/i.exec(l),n=/^#?([0-9a-f]{8})$/i.exec(l);if(n){const r=n[1];return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16),a:parseInt(r.slice(6,8),16)/255}}if(t){const r=parseInt(t[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255,a:1}}return{r:0,g:0,b:0,a:1}}function ke(s,l,p,u,t){const n=h=>Math.max(0,Math.min(255,Math.round(h))).toString(16).padStart(2,"0"),r=`#${n(s)}${n(l)}${n(p)}`;return t?`${r}${n(u*255)}`:r}const G=y.forwardRef(({label:s,helperText:l,error:p,required:u,disabled:t,id:n,className:r,style:h,accessMode:c,displayStyle:o,value:a="#3b82f6",onChange:v,presets:B=fe,showInput:K=!1,showRandom:U=!1,withAlpha:S=!1,compact:O=!1,showKeyboardHints:I,size:V="md",labelPlacement:W,errorPlacement:w,labelWidth:E,controlWidth:R,loading:H},D)=>{const z=M.useNiceAccessMode(c,n),A=z==="hidden";(z==="disabled"||z==="readOnly")&&(t=!0);const{t:_}=M.useNiceTranslation(),C=M.useControlId(n);M.useComponentDisplayClass("input",o);const F=y.useCallback(()=>{t||v?.(he())},[t,v]),[P,g]=y.useState(!1),[X,ne]=y.useState(null),[Y,te]=y.useState(""),J=y.useRef(null),q=y.useRef(null);y.useLayoutEffect(()=>{if(!P||!q.current)return;te(me.scopeThemeClass(q.current));const m=()=>{const d=q.current?.getBoundingClientRect();if(!d)return;const k=280,j=360;let N=d.left,L=d.bottom+6;N+k>window.innerWidth-8&&(N=Math.max(8,window.innerWidth-k-8)),L+j>window.innerHeight-8&&(L=Math.max(8,d.top-j-6)),ne({left:N,top:L})};return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[P]),y.useEffect(()=>{if(!P)return;const m=k=>{const j=k.target;J.current?.contains(j)||q.current?.contains(j)||g(!1)},d=k=>{k.key==="Escape"&&g(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d)}},[P]);const re=y.useMemo(()=>[{key:"Enter",description:_("shortcuts.openPicker","Open color picker")},{key:"Arrow keys",description:_("shortcuts.navigatePresets","Navigate presets")}],[_]);return A?null:e.jsxs("div",{className:`nice-field nice-field--${V} ${W==="left"?"nice-field--label-left":""} ${O?"nice-color-picker--compact":""} ${H?"nice-field--loading":""} ${r||""}`,style:{...h,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...R!=null&&{"--nice-field-control-width":typeof R=="number"?`${R}px`:R}},"aria-busy":H||void 0,children:[s&&e.jsxs("label",{htmlFor:C,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[s,I&&e.jsx(M.NiceKeyboardHint,{shortcuts:re,size:"sm"})]}),e.jsx("div",{className:"nice-field__control",children:e.jsxs("div",{className:"nice-color-picker",children:[e.jsxs("div",{className:"nice-color-picker__preview-row",children:[e.jsx("div",{ref:q,className:"nice-color-picker__swatch",id:C,style:{background:a},onClick:m=>{m.stopPropagation(),t||g(d=>!d)},onKeyDown:m=>{!t&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),g(d=>!d))},role:"button",tabIndex:0,"aria-label":_("colorPicker.openPalette","Open color palette"),"aria-haspopup":"dialog","aria-expanded":P,children:e.jsx("input",{ref:m=>{typeof D=="function"?D(m):D&&(D.current=m)},type:"hidden",value:a,disabled:t,readOnly:!0})}),K&&e.jsx("div",{className:"nice-input nice-input--sm",style:O?{flex:1,minWidth:0}:{width:100},children:e.jsx("input",{className:"nice-input__native",type:"text",value:a,disabled:t,onChange:m=>v?.(m.target.value),maxLength:S?9:7})}),U&&!O&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",onClick:F,disabled:t,title:_("colorPicker.random","Random"),"aria-label":_("colorPicker.random","Random"),style:{fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:_("colorPicker.random","Random")}),H&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),w==="right"&&p&&e.jsx("div",{id:`${C}-error`,className:"nice-field__error",role:"alert",children:p}),w==="right"&&!p&&l&&e.jsx("div",{id:`${C}-helper`,className:"nice-field__helper",children:l})]}),P&&X&&typeof document<"u"&&pe.createPortal(e.jsx("div",{ref:J,className:`nice-color-picker__popup nice-color-picker__popup--portal ${Y}`,"data-theme":Y==="nice-dark"?"dark":Y==="nice-light"?"light":void 0,role:"dialog","aria-label":_("colorPicker.palette","Color palette"),style:{position:"fixed",left:X.left,top:X.top},onClick:m=>m.stopPropagation(),children:(()=>{const m=ye(a),d={r:m.r,g:m.g,b:m.b},k=S?m.a:1,j=ve(d.r,d.g,d.b),N=ge(d.r,d.g,d.b),L=(i,b,x,f=k)=>v?.(ke(i,b,x,f,S)),ie=(i,b,x)=>L(i,b,x),se=(i,b,x)=>{const f=_e(i,b,x);L(f.r,f.g,f.b)},Q=(i,b,x)=>{const f=Ne(i,b,x);L(f.r,f.g,f.b)},Z=i=>L(d.r,d.g,d.b,i),oe=i=>{if(t)return;const b=i.currentTarget,x=$=>{const T=b.getBoundingClientRect(),ae=Math.max(0,Math.min(T.width,$.clientX-T.left)),le=Math.max(0,Math.min(T.height,$.clientY-T.top)),ue=Math.round(ae/T.width*100),de=100-Math.round(le/T.height*100);Q(N.h,ue,de)};x(i);const f=()=>{document.removeEventListener("pointermove",x),document.removeEventListener("pointerup",f)};document.addEventListener("pointermove",x),document.addEventListener("pointerup",f)},ce=`hsl(${N.h}, 100%, 50%)`;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-color-picker__popup-header",children:e.jsx("input",{type:"text",className:"nice-input__native nice-color-picker__popup-hex",value:a,disabled:t,onChange:i=>v?.(i.target.value),maxLength:S?9:7,"aria-label":_("colorPicker.hexValue","Hex value")})}),e.jsx("input",{type:"range",min:0,max:360,value:N.h,disabled:t,onChange:i=>Q(Number(i.target.value),N.s,N.v),className:"nice-color-picker__hue-slider","aria-label":_("colorPicker.hue","Hue")}),e.jsx("div",{className:"nice-color-picker__sv",style:{background:`linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ce})`},onPointerDown:oe,role:"application","aria-label":_("colorPicker.svPalette","Saturation/value palette"),children:e.jsx("span",{className:"nice-color-picker__sv-marker",style:{left:`${N.s}%`,top:`${100-N.v}%`}})}),e.jsxs("div",{className:"nice-color-picker__sliders",children:[e.jsx("div",{className:"nice-color-picker__slider-col",children:["h","s","l"].map(i=>{const b=i==="h"?360:100,x=j[i],f=$=>se(i==="h"?$:j.h,i==="s"?$:j.s,i==="l"?$:j.l);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:b,value:x,disabled:t,onChange:$=>f(Number($.target.value))}),e.jsx("input",{type:"number",min:0,max:b,value:x,disabled:t,onChange:$=>f(Number($.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})}),e.jsx("div",{className:"nice-color-picker__slider-col",children:["r","g","b"].map(i=>{const b=d[i],x=f=>ie(i==="r"?f:d.r,i==="g"?f:d.g,i==="b"?f:d.b);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:255,value:b,disabled:t,onChange:f=>x(Number(f.target.value))}),e.jsx("input",{type:"number",min:0,max:255,value:b,disabled:t,onChange:f=>x(Number(f.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})})]}),S&&e.jsxs("div",{className:"nice-color-picker__alpha-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:"A"}),e.jsx("input",{type:"range",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z(Number(i.target.value)/100),className:"nice-color-picker__alpha-slider",style:{background:`linear-gradient(to right, transparent, rgb(${d.r},${d.g},${d.b}))`},"aria-label":_("colorPicker.alpha","Alpha")}),e.jsx("input",{type:"number",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z((Number(i.target.value)||0)/100),className:"nice-input__native nice-color-picker__slider-num"})]}),B.length>0&&e.jsx("div",{className:"nice-color-picker__popup-presets",children:B.map(i=>e.jsx("div",{className:`nice-color-picker__preset ${a===i?"nice-color-picker__preset--active":""}`,style:{background:i},onClick:()=>{v?.(i),g(!1)},role:"button",tabIndex:0,"aria-label":i,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),v?.(i),g(!1))}},i))})]})})()}),document.body)]})}),w!=="right"&&p&&e.jsx("div",{id:`${C}-error`,className:"nice-field__error",role:"alert",children:p}),w!=="right"&&!p&&l&&e.jsx("div",{id:`${C}-helper`,className:"nice-field__helper",children:l})]})});G.displayName="NiceColorPicker";const je=Object.freeze(Object.defineProperty({__proto__:null,NiceColorPicker:G,hexToRgb:be,rgbToHex:xe},Symbol.toStringTag,{value:"Module"}));exports.NiceButton=ee;exports.NiceColorPicker=G;exports.NiceColorPicker$1=je;
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { jsxs as M, jsx as i, Fragment as ue } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceAccessMode as de, useNiceTranslation as me, useControlId as fe, useComponentDisplayClass as he, NiceKeyboardHint as ge } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as ve, useCallback as _e, useState as j, useRef as V, useLayoutEffect as be, useEffect as ke, useMemo as Ne } from "react";
|
|
4
|
+
import xe from "react-dom";
|
|
5
|
+
import { s as ye } from "./NiceSelect-DZB1Rs9x.js";
|
|
6
|
+
const Me = [
|
|
7
|
+
"#ef4444",
|
|
8
|
+
"#f97316",
|
|
9
|
+
"#f59e0b",
|
|
10
|
+
"#84cc16",
|
|
11
|
+
"#10b981",
|
|
12
|
+
"#06b6d4",
|
|
13
|
+
"#3b82f6",
|
|
14
|
+
"#6366f1",
|
|
15
|
+
"#8b5cf6",
|
|
16
|
+
"#ec4899",
|
|
17
|
+
"#64748b",
|
|
18
|
+
"#1e293b"
|
|
19
|
+
];
|
|
20
|
+
function $e() {
|
|
21
|
+
return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
22
|
+
}
|
|
23
|
+
function Oe(c) {
|
|
24
|
+
const l = /^#?([0-9a-f]{6})$/i.exec(c.trim());
|
|
25
|
+
if (!l)
|
|
26
|
+
return { r: 0, g: 0, b: 0 };
|
|
27
|
+
const m = parseInt(l[1], 16);
|
|
28
|
+
return { r: m >> 16 & 255, g: m >> 8 & 255, b: m & 255 };
|
|
29
|
+
}
|
|
30
|
+
function ze(c, l, m) {
|
|
31
|
+
const p = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
32
|
+
return `#${p(c)}${p(l)}${p(m)}`;
|
|
33
|
+
}
|
|
34
|
+
function we(c, l, m) {
|
|
35
|
+
const p = c / 255, n = l / 255, r = m / 255, e = Math.max(p, n, r), h = Math.min(p, n, r), u = (e + h) / 2;
|
|
36
|
+
let o = 0, s = 0;
|
|
37
|
+
if (e !== h) {
|
|
38
|
+
const _ = e - h;
|
|
39
|
+
switch (s = u > 0.5 ? _ / (2 - e - h) : _ / (e + h), e) {
|
|
40
|
+
case p:
|
|
41
|
+
o = (n - r) / _ + (n < r ? 6 : 0);
|
|
42
|
+
break;
|
|
43
|
+
case n:
|
|
44
|
+
o = (r - p) / _ + 2;
|
|
45
|
+
break;
|
|
46
|
+
case r:
|
|
47
|
+
o = (p - n) / _ + 4;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
o *= 60;
|
|
51
|
+
}
|
|
52
|
+
return { h: Math.round(o), s: Math.round(s * 100), l: Math.round(u * 100) };
|
|
53
|
+
}
|
|
54
|
+
function Pe(c, l, m) {
|
|
55
|
+
const p = l / 100, n = m / 100, r = (1 - Math.abs(2 * n - 1)) * p, e = r * (1 - Math.abs(c / 60 % 2 - 1)), h = n - r / 2;
|
|
56
|
+
let u = 0, o = 0, s = 0;
|
|
57
|
+
return c < 60 ? [u, o, s] = [r, e, 0] : c < 120 ? [u, o, s] = [e, r, 0] : c < 180 ? [u, o, s] = [0, r, e] : c < 240 ? [u, o, s] = [0, e, r] : c < 300 ? [u, o, s] = [e, 0, r] : [u, o, s] = [r, 0, e], {
|
|
58
|
+
r: Math.round((u + h) * 255),
|
|
59
|
+
g: Math.round((o + h) * 255),
|
|
60
|
+
b: Math.round((s + h) * 255)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function Ce(c, l, m) {
|
|
64
|
+
const p = c / 255, n = l / 255, r = m / 255, e = Math.max(p, n, r), h = Math.min(p, n, r), u = e - h;
|
|
65
|
+
let o = 0;
|
|
66
|
+
u !== 0 && (e === p ? o = (n - r) / u % 6 : e === n ? o = (r - p) / u + 2 : o = (p - n) / u + 4, o *= 60, o < 0 && (o += 360));
|
|
67
|
+
const s = e === 0 ? 0 : u / e;
|
|
68
|
+
return { h: Math.round(o), s: Math.round(s * 100), v: Math.round(e * 100) };
|
|
69
|
+
}
|
|
70
|
+
function Ee(c, l, m) {
|
|
71
|
+
const p = l / 100, n = m / 100, r = n * p, e = r * (1 - Math.abs(c / 60 % 2 - 1)), h = n - r;
|
|
72
|
+
let u = 0, o = 0, s = 0;
|
|
73
|
+
return c < 60 ? [u, o, s] = [r, e, 0] : c < 120 ? [u, o, s] = [e, r, 0] : c < 180 ? [u, o, s] = [0, r, e] : c < 240 ? [u, o, s] = [0, e, r] : c < 300 ? [u, o, s] = [e, 0, r] : [u, o, s] = [r, 0, e], {
|
|
74
|
+
r: Math.round((u + h) * 255),
|
|
75
|
+
g: Math.round((o + h) * 255),
|
|
76
|
+
b: Math.round((s + h) * 255)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function Le(c) {
|
|
80
|
+
let l = c.trim();
|
|
81
|
+
const m = /var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);
|
|
82
|
+
m && (l = m[1]);
|
|
83
|
+
const p = /^#?([0-9a-f]{3})$/i.exec(l);
|
|
84
|
+
p && (l = `#${p[1].split("").map((e) => e + e).join("")}`);
|
|
85
|
+
const n = /^#?([0-9a-f]{6})$/i.exec(l), r = /^#?([0-9a-f]{8})$/i.exec(l);
|
|
86
|
+
if (r) {
|
|
87
|
+
const e = r[1];
|
|
88
|
+
return {
|
|
89
|
+
r: parseInt(e.slice(0, 2), 16),
|
|
90
|
+
g: parseInt(e.slice(2, 4), 16),
|
|
91
|
+
b: parseInt(e.slice(4, 6), 16),
|
|
92
|
+
a: parseInt(e.slice(6, 8), 16) / 255
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (n) {
|
|
96
|
+
const e = parseInt(n[1], 16);
|
|
97
|
+
return { r: e >> 16 & 255, g: e >> 8 & 255, b: e & 255, a: 1 };
|
|
98
|
+
}
|
|
99
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
100
|
+
}
|
|
101
|
+
function Re(c, l, m, p, n) {
|
|
102
|
+
const r = (h) => Math.max(0, Math.min(255, Math.round(h))).toString(16).padStart(2, "0"), e = `#${r(c)}${r(l)}${r(m)}`;
|
|
103
|
+
return n ? `${e}${r(p * 255)}` : e;
|
|
104
|
+
}
|
|
105
|
+
const Se = ve(
|
|
106
|
+
({
|
|
107
|
+
label: c,
|
|
108
|
+
helperText: l,
|
|
109
|
+
error: m,
|
|
110
|
+
required: p,
|
|
111
|
+
disabled: n,
|
|
112
|
+
id: r,
|
|
113
|
+
className: e,
|
|
114
|
+
style: h,
|
|
115
|
+
accessMode: u,
|
|
116
|
+
displayStyle: o,
|
|
117
|
+
value: s = "#3b82f6",
|
|
118
|
+
onChange: _,
|
|
119
|
+
presets: K = Me,
|
|
120
|
+
showInput: X = !1,
|
|
121
|
+
showRandom: Y = !1,
|
|
122
|
+
withAlpha: L = !1,
|
|
123
|
+
compact: D = !1,
|
|
124
|
+
showKeyboardHints: G,
|
|
125
|
+
size: J = "md",
|
|
126
|
+
labelPlacement: Q,
|
|
127
|
+
errorPlacement: S,
|
|
128
|
+
labelWidth: H,
|
|
129
|
+
controlWidth: T,
|
|
130
|
+
loading: F
|
|
131
|
+
}, I) => {
|
|
132
|
+
const O = de(u, r), Z = O === "hidden";
|
|
133
|
+
(O === "disabled" || O === "readOnly") && (n = !0);
|
|
134
|
+
const { t: b } = me(), w = fe(r);
|
|
135
|
+
he("input", o);
|
|
136
|
+
const W = _e(() => {
|
|
137
|
+
n || _?.($e());
|
|
138
|
+
}, [n, _]), [P, C] = j(!1), [z, ee] = j(null), [A, ne] = j(""), U = V(null), R = V(null);
|
|
139
|
+
be(() => {
|
|
140
|
+
if (!P || !R.current)
|
|
141
|
+
return;
|
|
142
|
+
ne(ye(R.current));
|
|
143
|
+
const d = () => {
|
|
144
|
+
const a = R.current?.getBoundingClientRect();
|
|
145
|
+
if (!a)
|
|
146
|
+
return;
|
|
147
|
+
const N = 280, x = 360;
|
|
148
|
+
let k = a.left, $ = a.bottom + 6;
|
|
149
|
+
k + N > window.innerWidth - 8 && (k = Math.max(8, window.innerWidth - N - 8)), $ + x > window.innerHeight - 8 && ($ = Math.max(8, a.top - x - 6)), ee({ left: k, top: $ });
|
|
150
|
+
};
|
|
151
|
+
return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
|
|
152
|
+
window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
|
|
153
|
+
};
|
|
154
|
+
}, [P]), ke(() => {
|
|
155
|
+
if (!P)
|
|
156
|
+
return;
|
|
157
|
+
const d = (N) => {
|
|
158
|
+
const x = N.target;
|
|
159
|
+
U.current?.contains(x) || R.current?.contains(x) || C(!1);
|
|
160
|
+
}, a = (N) => {
|
|
161
|
+
N.key === "Escape" && C(!1);
|
|
162
|
+
};
|
|
163
|
+
return document.addEventListener("mousedown", d), document.addEventListener("keydown", a), () => {
|
|
164
|
+
document.removeEventListener("mousedown", d), document.removeEventListener("keydown", a);
|
|
165
|
+
};
|
|
166
|
+
}, [P]);
|
|
167
|
+
const te = Ne(
|
|
168
|
+
() => [
|
|
169
|
+
{ key: "Enter", description: b("shortcuts.openPicker", "Open color picker") },
|
|
170
|
+
{ key: "Arrow keys", description: b("shortcuts.navigatePresets", "Navigate presets") }
|
|
171
|
+
],
|
|
172
|
+
[b]
|
|
173
|
+
);
|
|
174
|
+
return Z ? null : /* @__PURE__ */ M(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: `nice-field nice-field--${J} ${Q === "left" ? "nice-field--label-left" : ""} ${D ? "nice-color-picker--compact" : ""} ${F ? "nice-field--loading" : ""} ${e || ""}`,
|
|
178
|
+
style: {
|
|
179
|
+
...h,
|
|
180
|
+
...H != null && {
|
|
181
|
+
"--nice-field-label-width": typeof H == "number" ? `${H}px` : H
|
|
182
|
+
},
|
|
183
|
+
...T != null && {
|
|
184
|
+
"--nice-field-control-width": typeof T == "number" ? `${T}px` : T
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"aria-busy": F || void 0,
|
|
188
|
+
children: [
|
|
189
|
+
c && /* @__PURE__ */ M(
|
|
190
|
+
"label",
|
|
191
|
+
{
|
|
192
|
+
htmlFor: w,
|
|
193
|
+
className: `nice-field__label ${p ? "nice-field__label--required" : ""}`,
|
|
194
|
+
children: [
|
|
195
|
+
c,
|
|
196
|
+
G && /* @__PURE__ */ i(ge, { shortcuts: te, size: "sm" })
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ i("div", { className: "nice-field__control", children: /* @__PURE__ */ M("div", { className: "nice-color-picker", children: [
|
|
201
|
+
/* @__PURE__ */ M("div", { className: "nice-color-picker__preview-row", children: [
|
|
202
|
+
/* @__PURE__ */ i(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
ref: R,
|
|
206
|
+
className: "nice-color-picker__swatch",
|
|
207
|
+
id: w,
|
|
208
|
+
style: { background: s },
|
|
209
|
+
onClick: (d) => {
|
|
210
|
+
d.stopPropagation(), n || C((a) => !a);
|
|
211
|
+
},
|
|
212
|
+
onKeyDown: (d) => {
|
|
213
|
+
!n && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), C((a) => !a));
|
|
214
|
+
},
|
|
215
|
+
role: "button",
|
|
216
|
+
tabIndex: 0,
|
|
217
|
+
"aria-label": b("colorPicker.openPalette", "Open color palette"),
|
|
218
|
+
"aria-haspopup": "dialog",
|
|
219
|
+
"aria-expanded": P,
|
|
220
|
+
children: /* @__PURE__ */ i(
|
|
221
|
+
"input",
|
|
222
|
+
{
|
|
223
|
+
ref: (d) => {
|
|
224
|
+
typeof I == "function" ? I(d) : I && (I.current = d);
|
|
225
|
+
},
|
|
226
|
+
type: "hidden",
|
|
227
|
+
value: s,
|
|
228
|
+
disabled: n,
|
|
229
|
+
readOnly: !0
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
X && /* @__PURE__ */ i(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
className: "nice-input nice-input--sm",
|
|
238
|
+
style: D ? { flex: 1, minWidth: 0 } : { width: 100 },
|
|
239
|
+
children: /* @__PURE__ */ i(
|
|
240
|
+
"input",
|
|
241
|
+
{
|
|
242
|
+
className: "nice-input__native",
|
|
243
|
+
type: "text",
|
|
244
|
+
value: s,
|
|
245
|
+
disabled: n,
|
|
246
|
+
onChange: (d) => _?.(d.target.value),
|
|
247
|
+
maxLength: L ? 9 : 7
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
Y && !D && /* @__PURE__ */ i(
|
|
253
|
+
"button",
|
|
254
|
+
{
|
|
255
|
+
type: "button",
|
|
256
|
+
className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
|
|
257
|
+
onClick: W,
|
|
258
|
+
disabled: n,
|
|
259
|
+
title: b("colorPicker.random", "Random"),
|
|
260
|
+
"aria-label": b("colorPicker.random", "Random"),
|
|
261
|
+
style: {
|
|
262
|
+
fontSize: "0.65rem",
|
|
263
|
+
textTransform: "uppercase",
|
|
264
|
+
letterSpacing: "0.05em"
|
|
265
|
+
},
|
|
266
|
+
children: b("colorPicker.random", "Random")
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
F && /* @__PURE__ */ i("span", { className: "nice-field__spinner", children: /* @__PURE__ */ i("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
270
|
+
S === "right" && m && /* @__PURE__ */ i("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: m }),
|
|
271
|
+
S === "right" && !m && l && /* @__PURE__ */ i("div", { id: `${w}-helper`, className: "nice-field__helper", children: l })
|
|
272
|
+
] }),
|
|
273
|
+
P && z && typeof document < "u" && xe.createPortal(
|
|
274
|
+
/* @__PURE__ */ i(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
ref: U,
|
|
278
|
+
className: `nice-color-picker__popup nice-color-picker__popup--portal ${A}`,
|
|
279
|
+
"data-theme": A === "nice-dark" ? "dark" : A === "nice-light" ? "light" : void 0,
|
|
280
|
+
role: "dialog",
|
|
281
|
+
"aria-label": b("colorPicker.palette", "Color palette"),
|
|
282
|
+
style: { position: "fixed", left: z.left, top: z.top },
|
|
283
|
+
onClick: (d) => d.stopPropagation(),
|
|
284
|
+
children: (() => {
|
|
285
|
+
const d = Le(s), a = { r: d.r, g: d.g, b: d.b }, N = L ? d.a : 1, x = we(a.r, a.g, a.b), k = Ce(a.r, a.g, a.b), $ = (t, g, v, f = N) => _?.(Re(t, g, v, f, L)), re = (t, g, v) => $(t, g, v), ie = (t, g, v) => {
|
|
286
|
+
const f = Pe(t, g, v);
|
|
287
|
+
$(f.r, f.g, f.b);
|
|
288
|
+
}, B = (t, g, v) => {
|
|
289
|
+
const f = Ee(t, g, v);
|
|
290
|
+
$(f.r, f.g, f.b);
|
|
291
|
+
}, q = (t) => $(a.r, a.g, a.b, t), oe = (t) => {
|
|
292
|
+
if (n)
|
|
293
|
+
return;
|
|
294
|
+
const g = t.currentTarget, v = (y) => {
|
|
295
|
+
const E = g.getBoundingClientRect(), ae = Math.max(0, Math.min(E.width, y.clientX - E.left)), se = Math.max(0, Math.min(E.height, y.clientY - E.top)), le = Math.round(ae / E.width * 100), pe = 100 - Math.round(se / E.height * 100);
|
|
296
|
+
B(k.h, le, pe);
|
|
297
|
+
};
|
|
298
|
+
v(t);
|
|
299
|
+
const f = () => {
|
|
300
|
+
document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", f);
|
|
301
|
+
};
|
|
302
|
+
document.addEventListener("pointermove", v), document.addEventListener("pointerup", f);
|
|
303
|
+
}, ce = `hsl(${k.h}, 100%, 50%)`;
|
|
304
|
+
return /* @__PURE__ */ M(ue, { children: [
|
|
305
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ i(
|
|
306
|
+
"input",
|
|
307
|
+
{
|
|
308
|
+
type: "text",
|
|
309
|
+
className: "nice-input__native nice-color-picker__popup-hex",
|
|
310
|
+
value: s,
|
|
311
|
+
disabled: n,
|
|
312
|
+
onChange: (t) => _?.(t.target.value),
|
|
313
|
+
maxLength: L ? 9 : 7,
|
|
314
|
+
"aria-label": b("colorPicker.hexValue", "Hex value")
|
|
315
|
+
}
|
|
316
|
+
) }),
|
|
317
|
+
/* @__PURE__ */ i(
|
|
318
|
+
"input",
|
|
319
|
+
{
|
|
320
|
+
type: "range",
|
|
321
|
+
min: 0,
|
|
322
|
+
max: 360,
|
|
323
|
+
value: k.h,
|
|
324
|
+
disabled: n,
|
|
325
|
+
onChange: (t) => B(Number(t.target.value), k.s, k.v),
|
|
326
|
+
className: "nice-color-picker__hue-slider",
|
|
327
|
+
"aria-label": b("colorPicker.hue", "Hue")
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ i(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
className: "nice-color-picker__sv",
|
|
334
|
+
style: {
|
|
335
|
+
/* audit-allow: token-role — black letterbox / canvas fill. A video frame or a
|
|
336
|
+
drawing surface is not a themed surface, so it stays black in both themes. */
|
|
337
|
+
background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ce})`
|
|
338
|
+
},
|
|
339
|
+
onPointerDown: oe,
|
|
340
|
+
role: "application",
|
|
341
|
+
"aria-label": b("colorPicker.svPalette", "Saturation/value palette"),
|
|
342
|
+
children: /* @__PURE__ */ i(
|
|
343
|
+
"span",
|
|
344
|
+
{
|
|
345
|
+
className: "nice-color-picker__sv-marker",
|
|
346
|
+
style: { left: `${k.s}%`, top: `${100 - k.v}%` }
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ M("div", { className: "nice-color-picker__sliders", children: [
|
|
352
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((t) => {
|
|
353
|
+
const g = t === "h" ? 360 : 100, v = x[t], f = (y) => ie(
|
|
354
|
+
t === "h" ? y : x.h,
|
|
355
|
+
t === "s" ? y : x.s,
|
|
356
|
+
t === "l" ? y : x.l
|
|
357
|
+
);
|
|
358
|
+
return /* @__PURE__ */ M("div", { className: "nice-color-picker__slider-row", children: [
|
|
359
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: t.toUpperCase() }),
|
|
360
|
+
/* @__PURE__ */ i(
|
|
361
|
+
"input",
|
|
362
|
+
{
|
|
363
|
+
type: "range",
|
|
364
|
+
min: 0,
|
|
365
|
+
max: g,
|
|
366
|
+
value: v,
|
|
367
|
+
disabled: n,
|
|
368
|
+
onChange: (y) => f(Number(y.target.value))
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
/* @__PURE__ */ i(
|
|
372
|
+
"input",
|
|
373
|
+
{
|
|
374
|
+
type: "number",
|
|
375
|
+
min: 0,
|
|
376
|
+
max: g,
|
|
377
|
+
value: v,
|
|
378
|
+
disabled: n,
|
|
379
|
+
onChange: (y) => f(Number(y.target.value) || 0),
|
|
380
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
] }, t);
|
|
384
|
+
}) }),
|
|
385
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((t) => {
|
|
386
|
+
const g = a[t], v = (f) => re(
|
|
387
|
+
t === "r" ? f : a.r,
|
|
388
|
+
t === "g" ? f : a.g,
|
|
389
|
+
t === "b" ? f : a.b
|
|
390
|
+
);
|
|
391
|
+
return /* @__PURE__ */ M("div", { className: "nice-color-picker__slider-row", children: [
|
|
392
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: t.toUpperCase() }),
|
|
393
|
+
/* @__PURE__ */ i(
|
|
394
|
+
"input",
|
|
395
|
+
{
|
|
396
|
+
type: "range",
|
|
397
|
+
min: 0,
|
|
398
|
+
max: 255,
|
|
399
|
+
value: g,
|
|
400
|
+
disabled: n,
|
|
401
|
+
onChange: (f) => v(Number(f.target.value))
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
/* @__PURE__ */ i(
|
|
405
|
+
"input",
|
|
406
|
+
{
|
|
407
|
+
type: "number",
|
|
408
|
+
min: 0,
|
|
409
|
+
max: 255,
|
|
410
|
+
value: g,
|
|
411
|
+
disabled: n,
|
|
412
|
+
onChange: (f) => v(Number(f.target.value) || 0),
|
|
413
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
] }, t);
|
|
417
|
+
}) })
|
|
418
|
+
] }),
|
|
419
|
+
L && /* @__PURE__ */ M("div", { className: "nice-color-picker__alpha-row", children: [
|
|
420
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: "A" }),
|
|
421
|
+
/* @__PURE__ */ i(
|
|
422
|
+
"input",
|
|
423
|
+
{
|
|
424
|
+
type: "range",
|
|
425
|
+
min: 0,
|
|
426
|
+
max: 100,
|
|
427
|
+
value: Math.round(N * 100),
|
|
428
|
+
disabled: n,
|
|
429
|
+
onChange: (t) => q(Number(t.target.value) / 100),
|
|
430
|
+
className: "nice-color-picker__alpha-slider",
|
|
431
|
+
style: {
|
|
432
|
+
background: `linear-gradient(to right, transparent, rgb(${a.r},${a.g},${a.b}))`
|
|
433
|
+
},
|
|
434
|
+
"aria-label": b("colorPicker.alpha", "Alpha")
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
/* @__PURE__ */ i(
|
|
438
|
+
"input",
|
|
439
|
+
{
|
|
440
|
+
type: "number",
|
|
441
|
+
min: 0,
|
|
442
|
+
max: 100,
|
|
443
|
+
value: Math.round(N * 100),
|
|
444
|
+
disabled: n,
|
|
445
|
+
onChange: (t) => q((Number(t.target.value) || 0) / 100),
|
|
446
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
] }),
|
|
450
|
+
K.length > 0 && /* @__PURE__ */ i("div", { className: "nice-color-picker__popup-presets", children: K.map((t) => /* @__PURE__ */ i(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
className: `nice-color-picker__preset ${s === t ? "nice-color-picker__preset--active" : ""}`,
|
|
454
|
+
style: { background: t },
|
|
455
|
+
onClick: () => {
|
|
456
|
+
_?.(t), C(!1);
|
|
457
|
+
},
|
|
458
|
+
role: "button",
|
|
459
|
+
tabIndex: 0,
|
|
460
|
+
"aria-label": t,
|
|
461
|
+
onKeyDown: (g) => {
|
|
462
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), _?.(t), C(!1));
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
t
|
|
466
|
+
)) })
|
|
467
|
+
] });
|
|
468
|
+
})()
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
document.body
|
|
472
|
+
)
|
|
473
|
+
] }) }),
|
|
474
|
+
S !== "right" && m && /* @__PURE__ */ i("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: m }),
|
|
475
|
+
S !== "right" && !m && l && /* @__PURE__ */ i("div", { id: `${w}-helper`, className: "nice-field__helper", children: l })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
Se.displayName = "NiceColorPicker";
|
|
482
|
+
export {
|
|
483
|
+
Se as NiceColorPicker,
|
|
484
|
+
Oe as hexToRgb,
|
|
485
|
+
ze as rgbToHex
|
|
486
|
+
};
|