@nice2dev/ui 1.1.9 → 1.1.10

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +17 -16
  3. package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
  4. package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
  5. package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
  6. package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
  7. package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
  8. package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
  9. package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
  10. package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
  11. package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
  12. package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
  13. package/dist/NiceForm-DVc0Xoly.js +4819 -0
  14. package/dist/NiceForm-qD_RKPYz.cjs +1 -0
  15. package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
  16. package/dist/NiceGantt-B_1lwEsp.js +328 -0
  17. package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
  18. package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
  19. package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
  20. package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
  21. package/dist/NiceMention-Dds9GQzk.cjs +430 -0
  22. package/dist/NiceMention-DlLXWddO.js +11268 -0
  23. package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
  24. package/dist/NiceModal-sihGCfDy.js +95 -0
  25. package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
  26. package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
  27. package/dist/NicePagination-D44waj9o.cjs +1 -0
  28. package/dist/NicePagination-DdxH8KMG.js +179 -0
  29. package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
  30. package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
  31. package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
  32. package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
  33. package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
  34. package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
  35. package/dist/NiceSelect-BCbWtu1v.js +433 -0
  36. package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
  37. package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
  38. package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
  39. package/dist/charts-C44vJber.cjs +768 -0
  40. package/dist/charts-XVlDwU0y.js +4732 -0
  41. package/dist/charts.cjs +1 -1
  42. package/dist/charts.mjs +8 -8
  43. package/dist/core-BxiH7vkV.cjs +1 -0
  44. package/dist/core-DMV6_SEE.js +795 -0
  45. package/dist/data-branching-oEH04O3i.js +6273 -0
  46. package/dist/data-branching-wmsbLNfa.cjs +1 -0
  47. package/dist/data-branching.cjs +1 -1
  48. package/dist/data-branching.mjs +1 -1
  49. package/dist/data.cjs +1 -1
  50. package/dist/data.d.ts +2 -2
  51. package/dist/data.mjs +3 -3
  52. package/dist/devops-Bt6EsfPa.cjs +17 -0
  53. package/dist/devops-CnZQ1rU5.js +8312 -0
  54. package/dist/devops.cjs +1 -1
  55. package/dist/devops.mjs +1 -1
  56. package/dist/editors.cjs +1 -1
  57. package/dist/editors.d.ts +2 -1
  58. package/dist/editors.mjs +7 -7
  59. package/dist/feedback.cjs +1 -1
  60. package/dist/feedback.mjs +3 -3
  61. package/dist/index.cjs +142 -142
  62. package/dist/index.d.ts +45 -26
  63. package/dist/index.mjs +7480 -7459
  64. package/dist/lazy.cjs +1 -1
  65. package/dist/lazy.mjs +24 -24
  66. package/dist/navigation.cjs +1 -1
  67. package/dist/navigation.d.ts +4 -4
  68. package/dist/navigation.mjs +69 -69
  69. package/dist/no-code-4GtIBr6f.js +7503 -0
  70. package/dist/no-code-Bdwh1vyS.cjs +332 -0
  71. package/dist/no-code.cjs +1 -1
  72. package/dist/no-code.mjs +1 -1
  73. package/dist/overlays.cjs +1 -1
  74. package/dist/overlays.mjs +102 -102
  75. package/dist/pickerCommons-31hyz1gs.js +1122 -0
  76. package/dist/pickerCommons-BifIkPdk.cjs +1 -0
  77. package/package.json +4 -4
@@ -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,598 @@
1
+ import { jsxs as N, jsx as i, Fragment as he } from "react/jsx-runtime";
2
+ import { normalizeVariant as be, normalizeSize as ve, useNiceAccessMode as ee, useComponentDisplayStyle as _e, useComponentDisplayClass as ne, useNiceTranslation as ge, useControlId as ye, NiceKeyboardHint as Ne } from "@nice2dev/ui-core";
3
+ import { forwardRef as te, useCallback as ke, useState as Y, useRef as Z, useLayoutEffect as xe, useEffect as $e, useMemo as Me } from "react";
4
+ import we from "react-dom";
5
+ import { s as Ce } from "./NiceSelect-BCbWtu1v.js";
6
+ const Pe = te(
7
+ ({
8
+ children: o,
9
+ variant: l = "primary",
10
+ size: p = "md",
11
+ type: d = "button",
12
+ disabled: n,
13
+ loading: e,
14
+ fullWidth: t,
15
+ onClick: h,
16
+ leftIcon: a,
17
+ rightIcon: c,
18
+ error: s,
19
+ errorPlacement: _ = "bottom",
20
+ ariaLabel: j,
21
+ className: K,
22
+ style: U,
23
+ id: E,
24
+ accessMode: O,
25
+ displayStyle: B,
26
+ ...V
27
+ }, q) => {
28
+ const w = be(l), S = ve(p), L = ee(O, E), D = L === "hidden";
29
+ (L === "disabled" || L === "readOnly") && (n = !0);
30
+ const H = _e("button", B), z = ne("button", B);
31
+ let A = H;
32
+ if (w !== "primary") {
33
+ const y = { ...H };
34
+ delete y.background, delete y.color, (w === "outline" || w === "ghost") && (delete y.border, delete y.borderColor, delete y.borderWidth, delete y.borderStyle, delete y.boxShadow), A = y;
35
+ }
36
+ const g = o != null && o !== !1 && !(typeof o == "string" && o.trim() === ""), C = !g && !!(a || c), F = /* @__PURE__ */ N(
37
+ "button",
38
+ {
39
+ ref: q,
40
+ type: d,
41
+ id: E,
42
+ className: `nice-btn nice-btn--${w} nice-btn--${S} nice-btn--ds-${z} ${C ? "nice-btn--icon-only" : ""} ${t ? "nice-btn--full-width" : ""} ${e ? "nice-btn--loading" : ""} ${s && !_ ? "nice-btn--has-error" : ""} ${K || ""}`,
43
+ style: { ...A, ...U },
44
+ disabled: n || e,
45
+ "aria-busy": e || void 0,
46
+ "aria-disabled": n || e || void 0,
47
+ "aria-label": j,
48
+ onClick: h,
49
+ ...V,
50
+ children: [
51
+ e && /* @__PURE__ */ i(
52
+ "svg",
53
+ {
54
+ className: "nice-btn__spinner",
55
+ viewBox: "0 0 24 24",
56
+ fill: "none",
57
+ stroke: "currentColor",
58
+ strokeWidth: "3",
59
+ "aria-hidden": "true",
60
+ children: /* @__PURE__ */ i("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
61
+ }
62
+ ),
63
+ !e && a && /* @__PURE__ */ i("span", { className: "nice-btn__icon", "aria-hidden": "true", children: a }),
64
+ !e && g && /* @__PURE__ */ i("span", { children: o }),
65
+ e && g && /* @__PURE__ */ i("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: o }),
66
+ e && C && /* @__PURE__ */ i("span", { className: "nice-btn__icon", style: { visibility: "hidden" }, "aria-hidden": "true", children: a || c }),
67
+ !e && c && /* @__PURE__ */ i("span", { className: "nice-btn__icon", "aria-hidden": "true", children: c })
68
+ ]
69
+ }
70
+ );
71
+ if (D)
72
+ return null;
73
+ if (!s)
74
+ return F;
75
+ const P = /* @__PURE__ */ i("div", { className: "nice-field__error", role: "alert", children: s });
76
+ return _ === "right" ? /* @__PURE__ */ N(
77
+ "span",
78
+ {
79
+ className: `nice-btn-field nice-btn-field--right nice-field--${S}`,
80
+ style: {
81
+ display: "inline-flex",
82
+ flexDirection: "row",
83
+ alignItems: "center",
84
+ gap: "8px",
85
+ width: "fit-content"
86
+ },
87
+ children: [
88
+ F,
89
+ P
90
+ ]
91
+ }
92
+ ) : D ? null : /* @__PURE__ */ N(
93
+ "span",
94
+ {
95
+ className: `nice-btn-field nice-btn-field--bottom nice-field--${S}`,
96
+ style: {
97
+ display: "inline-flex",
98
+ flexDirection: "column",
99
+ alignItems: "flex-start",
100
+ gap: "4px",
101
+ width: "fit-content"
102
+ },
103
+ children: [
104
+ F,
105
+ P
106
+ ]
107
+ }
108
+ );
109
+ }
110
+ );
111
+ Pe.displayName = "NiceButton";
112
+ const Ee = [
113
+ "#ef4444",
114
+ "#f97316",
115
+ "#f59e0b",
116
+ "#84cc16",
117
+ "#10b981",
118
+ "#06b6d4",
119
+ "#3b82f6",
120
+ "#6366f1",
121
+ "#8b5cf6",
122
+ "#ec4899",
123
+ "#64748b",
124
+ "#1e293b"
125
+ ];
126
+ function Se() {
127
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
128
+ }
129
+ function Le(o) {
130
+ const l = /^#?([0-9a-f]{6})$/i.exec(o.trim());
131
+ if (!l)
132
+ return { r: 0, g: 0, b: 0 };
133
+ const p = parseInt(l[1], 16);
134
+ return { r: p >> 16 & 255, g: p >> 8 & 255, b: p & 255 };
135
+ }
136
+ function Re(o, l, p) {
137
+ const d = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
138
+ return `#${d(o)}${d(l)}${d(p)}`;
139
+ }
140
+ function He(o, l, p) {
141
+ const d = o / 255, n = l / 255, e = p / 255, t = Math.max(d, n, e), h = Math.min(d, n, e), a = (t + h) / 2;
142
+ let c = 0, s = 0;
143
+ if (t !== h) {
144
+ const _ = t - h;
145
+ switch (s = a > 0.5 ? _ / (2 - t - h) : _ / (t + h), t) {
146
+ case d:
147
+ c = (n - e) / _ + (n < e ? 6 : 0);
148
+ break;
149
+ case n:
150
+ c = (e - d) / _ + 2;
151
+ break;
152
+ case e:
153
+ c = (d - n) / _ + 4;
154
+ break;
155
+ }
156
+ c *= 60;
157
+ }
158
+ return { h: Math.round(c), s: Math.round(s * 100), l: Math.round(a * 100) };
159
+ }
160
+ function De(o, l, p) {
161
+ const d = l / 100, n = p / 100, e = (1 - Math.abs(2 * n - 1)) * d, t = e * (1 - Math.abs(o / 60 % 2 - 1)), h = n - e / 2;
162
+ let a = 0, c = 0, s = 0;
163
+ return o < 60 ? [a, c, s] = [e, t, 0] : o < 120 ? [a, c, s] = [t, e, 0] : o < 180 ? [a, c, s] = [0, e, t] : o < 240 ? [a, c, s] = [0, t, e] : o < 300 ? [a, c, s] = [t, 0, e] : [a, c, s] = [e, 0, t], {
164
+ r: Math.round((a + h) * 255),
165
+ g: Math.round((c + h) * 255),
166
+ b: Math.round((s + h) * 255)
167
+ };
168
+ }
169
+ function Te(o, l, p) {
170
+ const d = o / 255, n = l / 255, e = p / 255, t = Math.max(d, n, e), h = Math.min(d, n, e), a = t - h;
171
+ let c = 0;
172
+ a !== 0 && (t === d ? c = (n - e) / a % 6 : t === n ? c = (e - d) / a + 2 : c = (d - n) / a + 4, c *= 60, c < 0 && (c += 360));
173
+ const s = t === 0 ? 0 : a / t;
174
+ return { h: Math.round(c), s: Math.round(s * 100), v: Math.round(t * 100) };
175
+ }
176
+ function Oe(o, l, p) {
177
+ const d = l / 100, n = p / 100, e = n * d, t = e * (1 - Math.abs(o / 60 % 2 - 1)), h = n - e;
178
+ let a = 0, c = 0, s = 0;
179
+ return o < 60 ? [a, c, s] = [e, t, 0] : o < 120 ? [a, c, s] = [t, e, 0] : o < 180 ? [a, c, s] = [0, e, t] : o < 240 ? [a, c, s] = [0, t, e] : o < 300 ? [a, c, s] = [t, 0, e] : [a, c, s] = [e, 0, t], {
180
+ r: Math.round((a + h) * 255),
181
+ g: Math.round((c + h) * 255),
182
+ b: Math.round((s + h) * 255)
183
+ };
184
+ }
185
+ function ze(o) {
186
+ let l = o.trim();
187
+ const p = /var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);
188
+ p && (l = p[1]);
189
+ const d = /^#?([0-9a-f]{3})$/i.exec(l);
190
+ d && (l = `#${d[1].split("").map((t) => t + t).join("")}`);
191
+ const n = /^#?([0-9a-f]{6})$/i.exec(l), e = /^#?([0-9a-f]{8})$/i.exec(l);
192
+ if (e) {
193
+ const t = e[1];
194
+ return {
195
+ r: parseInt(t.slice(0, 2), 16),
196
+ g: parseInt(t.slice(2, 4), 16),
197
+ b: parseInt(t.slice(4, 6), 16),
198
+ a: parseInt(t.slice(6, 8), 16) / 255
199
+ };
200
+ }
201
+ if (n) {
202
+ const t = parseInt(n[1], 16);
203
+ return { r: t >> 16 & 255, g: t >> 8 & 255, b: t & 255, a: 1 };
204
+ }
205
+ return { r: 0, g: 0, b: 0, a: 1 };
206
+ }
207
+ function Fe(o, l, p, d, n) {
208
+ const e = (h) => Math.max(0, Math.min(255, Math.round(h))).toString(16).padStart(2, "0"), t = `#${e(o)}${e(l)}${e(p)}`;
209
+ return n ? `${t}${e(d * 255)}` : t;
210
+ }
211
+ const re = te(
212
+ ({
213
+ label: o,
214
+ helperText: l,
215
+ error: p,
216
+ required: d,
217
+ disabled: n,
218
+ id: e,
219
+ className: t,
220
+ style: h,
221
+ accessMode: a,
222
+ displayStyle: c,
223
+ value: s = "#3b82f6",
224
+ onChange: _,
225
+ presets: j = Ee,
226
+ showInput: K = !1,
227
+ showRandom: U = !1,
228
+ withAlpha: E = !1,
229
+ compact: O = !1,
230
+ showKeyboardHints: B,
231
+ size: V = "md",
232
+ labelPlacement: q,
233
+ errorPlacement: w,
234
+ labelWidth: S,
235
+ controlWidth: L,
236
+ loading: D
237
+ }, H) => {
238
+ const z = ee(a, e), A = z === "hidden";
239
+ (z === "disabled" || z === "readOnly") && (n = !0);
240
+ const { t: g } = ge(), C = ye(e);
241
+ ne("input", c);
242
+ const F = ke(() => {
243
+ n || _?.(Se());
244
+ }, [n, _]), [P, y] = Y(!1), [W, ie] = Y(null), [X, oe] = Y(""), G = Z(null), I = Z(null);
245
+ xe(() => {
246
+ if (!P || !I.current)
247
+ return;
248
+ oe(Ce(I.current));
249
+ const m = () => {
250
+ const u = I.current?.getBoundingClientRect();
251
+ if (!u)
252
+ return;
253
+ const x = 280, $ = 360;
254
+ let k = u.left, R = u.bottom + 6;
255
+ k + x > window.innerWidth - 8 && (k = Math.max(8, window.innerWidth - x - 8)), R + $ > window.innerHeight - 8 && (R = Math.max(8, u.top - $ - 6)), ie({ left: k, top: R });
256
+ };
257
+ return m(), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
258
+ window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
259
+ };
260
+ }, [P]), $e(() => {
261
+ if (!P)
262
+ return;
263
+ const m = (x) => {
264
+ const $ = x.target;
265
+ G.current?.contains($) || I.current?.contains($) || y(!1);
266
+ }, u = (x) => {
267
+ x.key === "Escape" && y(!1);
268
+ };
269
+ return document.addEventListener("mousedown", m), document.addEventListener("keydown", u), () => {
270
+ document.removeEventListener("mousedown", m), document.removeEventListener("keydown", u);
271
+ };
272
+ }, [P]);
273
+ const ce = Me(
274
+ () => [
275
+ { key: "Enter", description: g("shortcuts.openPicker", "Open color picker") },
276
+ { key: "Arrow keys", description: g("shortcuts.navigatePresets", "Navigate presets") }
277
+ ],
278
+ [g]
279
+ );
280
+ return A ? null : /* @__PURE__ */ N(
281
+ "div",
282
+ {
283
+ className: `nice-field nice-field--${V} ${q === "left" ? "nice-field--label-left" : ""} ${O ? "nice-color-picker--compact" : ""} ${D ? "nice-field--loading" : ""} ${t || ""}`,
284
+ style: {
285
+ ...h,
286
+ ...S != null && {
287
+ "--nice-field-label-width": typeof S == "number" ? `${S}px` : S
288
+ },
289
+ ...L != null && {
290
+ "--nice-field-control-width": typeof L == "number" ? `${L}px` : L
291
+ }
292
+ },
293
+ "aria-busy": D || void 0,
294
+ children: [
295
+ o && /* @__PURE__ */ N(
296
+ "label",
297
+ {
298
+ htmlFor: C,
299
+ className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
300
+ children: [
301
+ o,
302
+ B && /* @__PURE__ */ i(Ne, { shortcuts: ce, size: "sm" })
303
+ ]
304
+ }
305
+ ),
306
+ /* @__PURE__ */ i("div", { className: "nice-field__control", children: /* @__PURE__ */ N("div", { className: "nice-color-picker", children: [
307
+ /* @__PURE__ */ N("div", { className: "nice-color-picker__preview-row", children: [
308
+ /* @__PURE__ */ i(
309
+ "div",
310
+ {
311
+ ref: I,
312
+ className: "nice-color-picker__swatch",
313
+ id: C,
314
+ style: { background: s },
315
+ onClick: (m) => {
316
+ m.stopPropagation(), n || y((u) => !u);
317
+ },
318
+ onKeyDown: (m) => {
319
+ !n && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), y((u) => !u));
320
+ },
321
+ role: "button",
322
+ tabIndex: 0,
323
+ "aria-label": g("colorPicker.openPalette", "Open color palette"),
324
+ "aria-haspopup": "dialog",
325
+ "aria-expanded": P,
326
+ children: /* @__PURE__ */ i(
327
+ "input",
328
+ {
329
+ ref: (m) => {
330
+ typeof H == "function" ? H(m) : H && (H.current = m);
331
+ },
332
+ type: "hidden",
333
+ value: s,
334
+ disabled: n,
335
+ readOnly: !0
336
+ }
337
+ )
338
+ }
339
+ ),
340
+ K && /* @__PURE__ */ i(
341
+ "div",
342
+ {
343
+ className: "nice-input nice-input--sm",
344
+ style: O ? { flex: 1, minWidth: 0 } : { width: 100 },
345
+ children: /* @__PURE__ */ i(
346
+ "input",
347
+ {
348
+ className: "nice-input__native",
349
+ type: "text",
350
+ value: s,
351
+ disabled: n,
352
+ onChange: (m) => _?.(m.target.value),
353
+ maxLength: E ? 9 : 7
354
+ }
355
+ )
356
+ }
357
+ ),
358
+ U && !O && /* @__PURE__ */ i(
359
+ "button",
360
+ {
361
+ type: "button",
362
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
363
+ onClick: F,
364
+ disabled: n,
365
+ title: g("colorPicker.random", "Random"),
366
+ "aria-label": g("colorPicker.random", "Random"),
367
+ style: {
368
+ fontSize: "0.65rem",
369
+ textTransform: "uppercase",
370
+ letterSpacing: "0.05em"
371
+ },
372
+ children: g("colorPicker.random", "Random")
373
+ }
374
+ ),
375
+ D && /* @__PURE__ */ i("span", { className: "nice-field__spinner", children: /* @__PURE__ */ i("span", { className: "nice-spinner nice-spinner--sm" }) }),
376
+ w === "right" && p && /* @__PURE__ */ i("div", { id: `${C}-error`, className: "nice-field__error", role: "alert", children: p }),
377
+ w === "right" && !p && l && /* @__PURE__ */ i("div", { id: `${C}-helper`, className: "nice-field__helper", children: l })
378
+ ] }),
379
+ P && W && typeof document < "u" && we.createPortal(
380
+ /* @__PURE__ */ i(
381
+ "div",
382
+ {
383
+ ref: G,
384
+ className: `nice-color-picker__popup nice-color-picker__popup--portal ${X}`,
385
+ "data-theme": X === "nice-dark" ? "dark" : X === "nice-light" ? "light" : void 0,
386
+ role: "dialog",
387
+ "aria-label": g("colorPicker.palette", "Color palette"),
388
+ style: { position: "fixed", left: W.left, top: W.top },
389
+ onClick: (m) => m.stopPropagation(),
390
+ children: (() => {
391
+ const m = ze(s), u = { r: m.r, g: m.g, b: m.b }, x = E ? m.a : 1, $ = He(u.r, u.g, u.b), k = Te(u.r, u.g, u.b), R = (r, b, v, f = x) => _?.(Fe(r, b, v, f, E)), ae = (r, b, v) => R(r, b, v), se = (r, b, v) => {
392
+ const f = De(r, b, v);
393
+ R(f.r, f.g, f.b);
394
+ }, J = (r, b, v) => {
395
+ const f = Oe(r, b, v);
396
+ R(f.r, f.g, f.b);
397
+ }, Q = (r) => R(u.r, u.g, u.b, r), le = (r) => {
398
+ if (n)
399
+ return;
400
+ const b = r.currentTarget, v = (M) => {
401
+ const T = b.getBoundingClientRect(), ue = Math.max(0, Math.min(T.width, M.clientX - T.left)), pe = Math.max(0, Math.min(T.height, M.clientY - T.top)), me = Math.round(ue / T.width * 100), fe = 100 - Math.round(pe / T.height * 100);
402
+ J(k.h, me, fe);
403
+ };
404
+ v(r);
405
+ const f = () => {
406
+ document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", f);
407
+ };
408
+ document.addEventListener("pointermove", v), document.addEventListener("pointerup", f);
409
+ }, de = `hsl(${k.h}, 100%, 50%)`;
410
+ return /* @__PURE__ */ N(he, { children: [
411
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ i(
412
+ "input",
413
+ {
414
+ type: "text",
415
+ className: "nice-input__native nice-color-picker__popup-hex",
416
+ value: s,
417
+ disabled: n,
418
+ onChange: (r) => _?.(r.target.value),
419
+ maxLength: E ? 9 : 7,
420
+ "aria-label": g("colorPicker.hexValue", "Hex value")
421
+ }
422
+ ) }),
423
+ /* @__PURE__ */ i(
424
+ "input",
425
+ {
426
+ type: "range",
427
+ min: 0,
428
+ max: 360,
429
+ value: k.h,
430
+ disabled: n,
431
+ onChange: (r) => J(Number(r.target.value), k.s, k.v),
432
+ className: "nice-color-picker__hue-slider",
433
+ "aria-label": g("colorPicker.hue", "Hue")
434
+ }
435
+ ),
436
+ /* @__PURE__ */ i(
437
+ "div",
438
+ {
439
+ className: "nice-color-picker__sv",
440
+ style: {
441
+ /* audit-allow: token-role — black letterbox / canvas fill. A video frame or a
442
+ drawing surface is not a themed surface, so it stays black in both themes. */
443
+ background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${de})`
444
+ },
445
+ onPointerDown: le,
446
+ role: "application",
447
+ "aria-label": g("colorPicker.svPalette", "Saturation/value palette"),
448
+ children: /* @__PURE__ */ i(
449
+ "span",
450
+ {
451
+ className: "nice-color-picker__sv-marker",
452
+ style: { left: `${k.s}%`, top: `${100 - k.v}%` }
453
+ }
454
+ )
455
+ }
456
+ ),
457
+ /* @__PURE__ */ N("div", { className: "nice-color-picker__sliders", children: [
458
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((r) => {
459
+ const b = r === "h" ? 360 : 100, v = $[r], f = (M) => se(
460
+ r === "h" ? M : $.h,
461
+ r === "s" ? M : $.s,
462
+ r === "l" ? M : $.l
463
+ );
464
+ return /* @__PURE__ */ N("div", { className: "nice-color-picker__slider-row", children: [
465
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
466
+ /* @__PURE__ */ i(
467
+ "input",
468
+ {
469
+ type: "range",
470
+ min: 0,
471
+ max: b,
472
+ value: v,
473
+ disabled: n,
474
+ onChange: (M) => f(Number(M.target.value))
475
+ }
476
+ ),
477
+ /* @__PURE__ */ i(
478
+ "input",
479
+ {
480
+ type: "number",
481
+ min: 0,
482
+ max: b,
483
+ value: v,
484
+ disabled: n,
485
+ onChange: (M) => f(Number(M.target.value) || 0),
486
+ className: "nice-input__native nice-color-picker__slider-num"
487
+ }
488
+ )
489
+ ] }, r);
490
+ }) }),
491
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((r) => {
492
+ const b = u[r], v = (f) => ae(
493
+ r === "r" ? f : u.r,
494
+ r === "g" ? f : u.g,
495
+ r === "b" ? f : u.b
496
+ );
497
+ return /* @__PURE__ */ N("div", { className: "nice-color-picker__slider-row", children: [
498
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
499
+ /* @__PURE__ */ i(
500
+ "input",
501
+ {
502
+ type: "range",
503
+ min: 0,
504
+ max: 255,
505
+ value: b,
506
+ disabled: n,
507
+ onChange: (f) => v(Number(f.target.value))
508
+ }
509
+ ),
510
+ /* @__PURE__ */ i(
511
+ "input",
512
+ {
513
+ type: "number",
514
+ min: 0,
515
+ max: 255,
516
+ value: b,
517
+ disabled: n,
518
+ onChange: (f) => v(Number(f.target.value) || 0),
519
+ className: "nice-input__native nice-color-picker__slider-num"
520
+ }
521
+ )
522
+ ] }, r);
523
+ }) })
524
+ ] }),
525
+ E && /* @__PURE__ */ N("div", { className: "nice-color-picker__alpha-row", children: [
526
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: "A" }),
527
+ /* @__PURE__ */ i(
528
+ "input",
529
+ {
530
+ type: "range",
531
+ min: 0,
532
+ max: 100,
533
+ value: Math.round(x * 100),
534
+ disabled: n,
535
+ onChange: (r) => Q(Number(r.target.value) / 100),
536
+ className: "nice-color-picker__alpha-slider",
537
+ style: {
538
+ background: `linear-gradient(to right, transparent, rgb(${u.r},${u.g},${u.b}))`
539
+ },
540
+ "aria-label": g("colorPicker.alpha", "Alpha")
541
+ }
542
+ ),
543
+ /* @__PURE__ */ i(
544
+ "input",
545
+ {
546
+ type: "number",
547
+ min: 0,
548
+ max: 100,
549
+ value: Math.round(x * 100),
550
+ disabled: n,
551
+ onChange: (r) => Q((Number(r.target.value) || 0) / 100),
552
+ className: "nice-input__native nice-color-picker__slider-num"
553
+ }
554
+ )
555
+ ] }),
556
+ j.length > 0 && /* @__PURE__ */ i("div", { className: "nice-color-picker__popup-presets", children: j.map((r) => /* @__PURE__ */ i(
557
+ "div",
558
+ {
559
+ className: `nice-color-picker__preset ${s === r ? "nice-color-picker__preset--active" : ""}`,
560
+ style: { background: r },
561
+ onClick: () => {
562
+ _?.(r), y(!1);
563
+ },
564
+ role: "button",
565
+ tabIndex: 0,
566
+ "aria-label": r,
567
+ onKeyDown: (b) => {
568
+ (b.key === "Enter" || b.key === " ") && (b.preventDefault(), _?.(r), y(!1));
569
+ }
570
+ },
571
+ r
572
+ )) })
573
+ ] });
574
+ })()
575
+ }
576
+ ),
577
+ document.body
578
+ )
579
+ ] }) }),
580
+ w !== "right" && p && /* @__PURE__ */ i("div", { id: `${C}-error`, className: "nice-field__error", role: "alert", children: p }),
581
+ w !== "right" && !p && l && /* @__PURE__ */ i("div", { id: `${C}-helper`, className: "nice-field__helper", children: l })
582
+ ]
583
+ }
584
+ );
585
+ }
586
+ );
587
+ re.displayName = "NiceColorPicker";
588
+ const Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
589
+ __proto__: null,
590
+ NiceColorPicker: re,
591
+ hexToRgb: Le,
592
+ rgbToHex: Re
593
+ }, Symbol.toStringTag, { value: "Module" }));
594
+ export {
595
+ re as N,
596
+ Pe as a,
597
+ Ue as b
598
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),N=require("@nice2dev/ui-core"),d=require("react"),_={info:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),error:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),success:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})},b=({visible:i,message:m,header:o,icon:a,variant:n="warning",acceptLabel:h,rejectLabel:f,onAccept:u,onReject:c,closeOnOverlay:v=!1,closeOnEscape:s=!0,size:x="md",className:g,style:j})=>{const{t}=N.useNiceTranslation();if(d.useEffect(()=>{if(!i||!s)return;const r=C=>{C.key==="Escape"&&c()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[i,s,c]),d.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i]),!i)return null;const l=a??_[n],w=h??t("confirm.accept","Yes"),y=f??t("confirm.reject","No");return e.jsx("div",{className:"nice-modal-overlay",onClick:v?c:void 0,children:e.jsxs("div",{className:`nice-confirm nice-confirm--${n} nice-confirm--${x} ${g||""}`,style:j,role:"alertdialog","aria-modal":"true","aria-label":o,"aria-describedby":"nice-confirm-message",onClick:r=>r.stopPropagation(),children:[o&&e.jsx("div",{className:"nice-confirm__header",children:e.jsx("h3",{className:"nice-confirm__title",children:o})}),e.jsxs("div",{className:"nice-confirm__body",children:[l&&e.jsx("div",{className:`nice-confirm__icon nice-confirm__icon--${n}`,children:l}),e.jsx("div",{id:"nice-confirm-message",className:"nice-confirm__message",children:m})]}),e.jsxs("div",{className:"nice-confirm__footer",children:[e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--md",onClick:c,children:y}),e.jsx("button",{type:"button",className:`nice-btn nice-btn--${n==="error"?"error":"primary"} nice-btn--md`,onClick:u,autoFocus:!0,children:w})]})]})})};exports.NiceConfirmDialog=b;