@nice2dev/ui 1.4.17 → 1.4.18
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 +23 -0
- package/dist/{NiceDataGrid-DpSADM9L.cjs → NiceDataGrid-Cszjz8NV.cjs} +1 -1
- package/dist/{NiceForm-CzH9IPmZ.cjs → NiceForm-DM2tARZT.cjs} +1 -1
- package/dist/{NiceMention-CrJJtDJx.cjs → NiceMention-DhaTUqvR.cjs} +1 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-C40zmo8O.cjs → NiceSavedQueryPanel-DJKEOqy5.cjs} +1 -1
- package/dist/{NiceScheduler-CSWtLS5G.cjs → NiceScheduler-Dff8fuq_.cjs} +1 -1
- package/dist/{core-lazy-DUKT6R8d.cjs → core-lazy-BhQxFuLf.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/editors/pickers/NiceLanguagePicker.mjs +129 -125
- package/dist/editors/pickers/NiceThemePicker.mjs +1 -1
- package/dist/editors/pickers/pickerCommons.mjs +155 -203
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.d.ts +10 -3
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/pickerCommons-CQnae2FM.cjs +1 -0
- package/dist/style.css +2 -2
- package/dist/tools/NiceThemeGalleryPicker.mjs +168 -265
- package/package.json +4 -4
- package/dist/NiceModuleLifecyclePanel-CxVQOIIA.cjs +0 -1
- package/dist/pickerCommons-CwcCc8Qi.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),g=require("@nice2dev/ui-core"),y=require("react"),K=require("country-flag-icons/string/3x2");function U(f){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const i in f)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(f,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:()=>f[i]})}}return n.default=f,Object.freeze(n)}const F=U(K),O=[],Z=({tabs:f=O,activeTab:n,onChange:i,variant:r="default",vertical:l,size:d="md",iconOnly:t=!1,centered:c="auto",countLocation:b="right",showHints:s,id:o,className:h,"data-testid":a,style:m,displayStyle:x})=>{const{t:p}=g.useNiceTranslation(),v=g.useControlId(o),_=c==="auto"?t:c,S=g.useComponentDisplayStyle("tab",x),T=g.useComponentDisplayClass("tab",x),[C,D]=y.useState(n||f[0]?.id),w=n??C,j=y.useRef(null),A=y.useRef(null),[R]=g.useInputPreferences(),k=g.useHintsVisible(),$=y.useCallback(u=>{D(u),i?.(u)},[i]);g.useRovingFocus(A,{orientation:l?"vertical":"horizontal",wrap:!0,onMove:u=>{const N=u.getAttribute("data-tab-id");N&&$(N)}}),g.useIntent(["sectionPrev","sectionNext"],u=>{const N=f.filter(I=>!I.disabled);if(N.length<2)return!1;const H=N.findIndex(I=>I.id===w),G=u.intent==="sectionNext"?1:-1,P=N[(H+G+N.length)%N.length];return $(P.id),[...A.current?.querySelectorAll("[data-tab-id]")??[]].find(I=>I.getAttribute("data-tab-id")===P.id)?.focus(),!0},{ref:j}),g.useInputHints(j,f.length>1?[{intent:"sectionPrev",label:p("input.intent.sectionPrev","Previous section")},{intent:"sectionNext",label:p("input.intent.sectionNext","Next section")}]:[]);const E=f.length>1&&k&&(s??R.hintDensity==="bar-and-controls"),L=f.find(u=>u.id===w)?.content;return e.jsxs("div",{ref:j,className:`nice-tabs nice-tabs--${d} ${l?"nice-tabs--vertical":""} ${t?"nice-tabs--icon-only":""} nice-tabs--ds-${T} ${h||""}`,style:{...S,...m},"data-testid":a,children:[e.jsxs("div",{ref:A,className:`nice-tabs__list ${r!=="default"?`nice-tabs__list--${r}`:""} ${l?"nice-tabs__list--vertical":""} ${_?"nice-tabs__list--centered":""}`,role:"tablist","aria-orientation":l?"vertical":"horizontal",children:[E&&e.jsx("span",{className:"nice-tabs__hint","aria-hidden":"true",children:e.jsx(g.NiceButtonPrompt,{intent:"sectionPrev",size:"sm"})}),f.map(u=>e.jsxs("button",{type:"button",role:"tab",id:`${v}-tab-${u.id}`,"data-tab-id":u.id,"aria-selected":w===u.id,"aria-controls":`${v}-panel`,"aria-label":t?u.label:void 0,title:t?u.label:void 0,className:`nice-tabs__tab ${w===u.id?"nice-tabs__tab--active":""} ${u.disabled?"nice-tabs__tab--disabled":""} ${b==="bottom"?"nice-tabs__tab--count-bottom":""}`,disabled:u.disabled,onClick:()=>$(u.id),children:[u.icon,!t&&e.jsx("span",{children:u.label}),u.badge!==void 0&&e.jsx("span",{className:`nice-tabs__badge${b==="bottom"?" nice-tabs__badge--pill":""}`,children:u.badge})]},u.id)),E&&e.jsx("span",{className:"nice-tabs__hint","aria-hidden":"true",children:e.jsx(g.NiceButtonPrompt,{intent:"sectionNext",size:"sm"})})]}),e.jsx("div",{className:"nice-tabs__panel",role:"tabpanel",id:`${v}-panel`,"aria-labelledby":w?`${v}-tab-${w}`:void 0,children:L})]})};function V(f,{open:n,onSelect:i,onClose:r,onOpen:l,loop:d=!1,pageSize:t=10,intentRef:c}){const[b,s]=y.useState(0);y.useEffect(()=>{s(a=>f.length===0?0:Math.min(Math.max(a,0),f.length-1))},[f.length]);const o=y.useCallback((a,m)=>s(x=>{const p=f.length;if(p===0)return 0;const v=a(x);return m?(v%p+p)%p:Math.min(Math.max(v,0),p-1)}),[f.length]),h=y.useCallback(a=>{if(!n){(a.key==="ArrowDown"||a.key==="ArrowUp")&&(a.preventDefault(),l?.());return}const m=a.target instanceof HTMLTextAreaElement||a.target instanceof HTMLInputElement&&a.target.type!=="checkbox";if(a.key==="ArrowDown")a.preventDefault(),o(x=>x+1,d);else if(a.key==="ArrowUp")a.preventDefault(),o(x=>x-1,d);else if(a.key==="PageDown")a.preventDefault(),o(x=>x+t,!1);else if(a.key==="PageUp")a.preventDefault(),o(x=>x-t,!1);else if(!m&&(a.key==="Home"||a.key==="End"))a.preventDefault(),o(()=>a.key==="Home"?0:f.length-1,!1);else if(a.key==="Enter"){const x=f[b];x!==void 0&&(a.preventDefault(),i(x,b))}else a.key==="Escape"&&r?.()},[n,f,b,d,t,o,i,r,l]);return g.useIntent(["navigate","activate"],a=>{if(a.source==="keyboard")return!1;if(a.intent==="activate"){const m=f[b];if(m===void 0)return!1;i(m,b);return}if(a.direction!=="up"&&a.direction!=="down")return!1;o(m=>m+(a.direction==="down"?1:-1),d)},{ref:c,enabled:n&&!!c}),{activeIndex:b,setActiveIndex:s,handleKeyDown:h}}const Y=Object.assign(y.forwardRef(({label:f,checked:n=!1,onChange:i,disabled:r,readOnly:l,loading:d,required:t,size:c="md",name:b,id:s,className:o,style:h,accessMode:a,displayStyle:m,showKeyboardHints:x,error:p,helperText:v,labelPlacement:_,errorPlacement:S,labelWidth:T,controlWidth:C,"data-testid":D},w)=>{const j=g.useNiceAccessMode(a,s),A=j==="hidden";(j==="disabled"||j==="readOnly")&&(r=!0);const{t:R}=g.useNiceTranslation(),k=g.useControlId(s);g.useComponentDisplayStyle("toggle",m);const $=g.useComponentDisplayClass("toggle",m),E=y.useMemo(()=>[{key:"Space",description:R("shortcuts.toggle","Toggle on/off")}],[R]);return A?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--${c} ${_==="left"?"nice-field--label-left":""} ${d?"nice-field--loading":""} ${o||""}`,style:{...h,...T!=null&&{"--nice-field-label-width":typeof T=="number"?`${T}px`:T},...C!=null&&{"--nice-field-control-width":typeof C=="number"?`${C}px`:C}},"data-testid":D,"aria-busy":d||void 0,children:[_==="left"&&f&&e.jsx("span",{className:`nice-field__label ${t?"nice-field__label--required":""}`,children:f}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("label",{className:`nice-toggle nice-toggle--ds-${$} ${c!=="md"?`nice-toggle--${c}`:""} ${r||d?"nice-toggle--disabled":""}`,htmlFor:k,children:[e.jsx("input",{ref:w,id:k,type:"checkbox",className:"nice-toggle__input",name:b,checked:n,disabled:r||d,readOnly:l,role:"switch","aria-checked":n,"aria-invalid":!!p,onChange:L=>{l||d||i?.(L.target.checked)}}),e.jsx("span",{className:"nice-toggle__track",children:e.jsx("span",{className:"nice-toggle__thumb"})}),_!=="left"&&f&&e.jsx("span",{children:f}),x&&e.jsx(g.NiceKeyboardHint,{shortcuts:E,size:"sm"})]}),d&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),S==="right"&&p&&e.jsx("div",{id:`${k}-error`,className:"nice-field__error",role:"alert",children:p}),S==="right"&&!p&&v&&e.jsx("div",{id:`${k}-helper`,className:"nice-field__helper",children:v})]}),S!=="right"&&p&&e.jsx("div",{id:`${k}-error`,className:"nice-field__error",role:"alert",children:p}),S!=="right"&&!p&&v&&e.jsx("div",{id:`${k}-helper`,className:"nice-field__helper",children:v})]})}),{displayName:"NiceToggle"}),J=Object.freeze({AR:["#74acdf","#ffffff","#74acdf"],AT:["#ed2939","#ffffff","#ed2939"],AU:["#012169","#ffffff","#e4002b"],BE:["#000000","#fae042","#ed2939"],BR:["#009c3b","#ffdf00","#002776"],CA:["#ff0000","#ffffff","#ff0000"],CH:["#d52b1e","#ffffff","#d52b1e"],CN:["#de2910","#ffde00","#de2910"],CZ:["#11457e","#ffffff","#d7141a"],DE:["#000000","#dd0000","#ffce00"],DK:["#c8102e","#ffffff","#c8102e"],EE:["#0072ce","#000000","#ffffff"],EG:["#ce1126","#ffffff","#000000"],ES:["#aa151b","#f1bf00","#aa151b"],FI:["#ffffff","#003580","#ffffff"],FR:["#0055a4","#ffffff","#ef4135"],GB:["#012169","#ffffff","#c8102e"],GR:["#0d5eaf","#ffffff","#0d5eaf"],HR:["#171796","#ffffff","#ff0000"],HU:["#ce2939","#ffffff","#477050"],IE:["#169b62","#ffffff","#ff883e"],IL:["#ffffff","#0038b8","#ffffff"],IN:["#ff9933","#ffffff","#138808"],IS:["#02529c","#ffffff","#dc1e35"],IT:["#009246","#ffffff","#ce2b37"],JP:["#ffffff","#bc002d","#ffffff"],KR:["#ffffff","#cd2e3a","#0047a0"],LT:["#fdb913","#006a44","#c1272d"],LU:["#ed2939","#ffffff","#00a1de"],LV:["#9e3039","#ffffff","#9e3039"],MX:["#006847","#ffffff","#ce1126"],NL:["#ae1c28","#ffffff","#21468b"],NO:["#ef2b2d","#ffffff","#002868"],NZ:["#012169","#ffffff","#cc142b"],PL:["#ffffff","#dc143c"],PT:["#006600","#ff0000"],RO:["#002b7f","#fcd116","#ce1126"],RU:["#ffffff","#0039a6","#d52b1e"],SE:["#006aa7","#fecc00","#006aa7"],SK:["#ffffff","#0b4ea2","#ee1c25"],TR:["#e30a17","#ffffff","#e30a17"],UA:["#005bbb","#ffd500"],US:["#b22234","#ffffff","#3c3b6e"],VN:["#da251d","#ffff00","#da251d"],ZA:["#007a4d","#ffffff","#de3831"],AD:["#10069f","#fedf00","#d50032"],AE:["#00732f","#ffffff","#000000"],AF:["#000000","#d32011","#007a36"],AG:["#ce1126","#fcd116","#000000"],AL:["#e41e20","#000000","#e41e20"],AM:["#d90012","#0033a0","#f2a800"],AO:["#ce1126","#000000","#ffc500"],AZ:["#0092bc","#ed2939","#509e2f"],BA:["#002395","#fecb00","#ffffff"],BB:["#00267f","#ffc726","#00267f"],BD:["#006a4e","#f42a41","#006a4e"],BF:["#ef2b2d","#009e49","#fcd116"],BG:["#ffffff","#00966e","#d62612"],BH:["#ffffff","#ce1126","#ce1126"],BI:["#1eb53a","#ffffff","#ce1126"],BJ:["#008751","#fcd116","#e8112d"],BN:["#f7e017","#ffffff","#000000"],BO:["#d52b1e","#f9e300","#007934"],BS:["#00778b","#ffc72c","#000000"],BT:["#ffcc33","#ff4e12","#ffcc33"],BW:["#75aadb","#ffffff","#000000"],BY:["#c8313e","#007c30","#ffffff"],BZ:["#003f87","#ce1126","#003f87"],CD:["#007fff","#f7d618","#ce1021"],CF:["#003082","#ffffff","#289728"],CG:["#009543","#fbde4a","#dc241f"],CI:["#f77f00","#ffffff","#009e60"],CM:["#007a5e","#ce1126","#fcd116"],CO:["#fcd116","#003893","#ce1126"],CR:["#002b7f","#ffffff","#ce1126"],CU:["#002590","#ffffff","#cf142b"],CV:["#003893","#ffffff","#cf2027"],CY:["#ffffff","#d57800","#ffffff"],DJ:["#6ab2e7","#ffffff","#12ad2b"],DM:["#006b3f","#ffffff","#000000"],DO:["#002d62","#ffffff","#ce1126"],DZ:["#006233","#ffffff","#d21034"],EC:["#ffd100","#034ea2","#ed1c24"],ER:["#ea0437","#0084c9","#418fde"],ET:["#078930","#fcdd09","#da121a"],FJ:["#68bfe5","#cc0000","#ffffff"],GA:["#3a75c4","#ffe700","#009e60"],GD:["#ce1126","#fcd116","#007a5e"],GE:["#ffffff","#ff0000","#ffffff"],GH:["#ce1126","#fcd116","#006b3f"],GM:["#ce1126","#ffffff","#0c1c8c"],GN:["#ce1126","#fcd116","#009460"],GQ:["#3e9a00","#ffffff","#e32118"],GT:["#4997d0","#ffffff","#4997d0"],GW:["#ce1126","#fcd116","#009e49"],GY:["#009e49","#ffffff","#fcd116"],HK:["#de2910","#ffffff","#de2910"],HN:["#0073cf","#ffffff","#0073cf"],HT:["#00209f","#d21034","#00209f"],ID:["#ff0000","#ffffff","#ff0000"],IQ:["#ce1126","#ffffff","#000000"],IR:["#239f40","#ffffff","#da0000"],JM:["#000000","#fed100","#009b3a"],JO:["#000000","#ffffff","#007a3d"],KE:["#000000","#bb0000","#006600"],KG:["#ff0000","#fcd116","#ff0000"],KH:["#032ea1","#e00025","#032ea1"],KM:["#fcd116","#ffffff","#ce1126"],KP:["#024fa2","#ed1c27","#024fa2"],KW:["#007a3d","#ffffff","#ce1126"],KZ:["#00afca","#fec50c","#00afca"],LA:["#ce1126","#002868","#ce1126"],LB:["#ed1c24","#ffffff","#ed1c24"],LI:["#002780","#ce1126","#002780"],LK:["#ffbe29","#8d153a","#00534e"],LR:["#bf0a30","#ffffff","#002868"],LS:["#00209f","#ffffff","#009543"],LY:["#e70013","#000000","#239e46"],MA:["#c1272d","#006233","#c1272d"],MD:["#0046ae","#ffd200","#cc092f"],ME:["#d4af37","#cc0033","#d4af37"],MG:["#ffffff","#fc3d32","#007e3a"],MH:["#003893","#dd7500","#ffffff"],MK:["#d20000","#ffe600","#d20000"],ML:["#14b53a","#fcd116","#ce1126"],MM:["#fecb00","#34b233","#ea2839"],MN:["#c4272f","#015197","#c4272f"],MO:["#00785a","#ffd700","#ffffff"],MR:["#006233","#ffc400","#d01c1f"],MT:["#ffffff","#cf142b","#ffffff"],MU:["#ea2839","#1a206d","#00a04d"],MV:["#d21034","#007e3a","#ffffff"],MW:["#000000","#ce1126","#339e35"],MY:["#cc0000","#ffffff","#010066"],MZ:["#009a44","#ffffff","#000000"],NA:["#003580","#ffffff","#009543"],NE:["#ff8000","#ffffff","#0db02b"],NG:["#008753","#ffffff","#008753"],NI:["#0067c6","#ffffff","#0067c6"],NP:["#dc143c","#003893","#dc143c"],OM:["#dc241f","#ffffff","#008000"],PA:["#ffffff","#cc0033","#005aa7"],PE:["#d91023","#ffffff","#d91023"],PG:["#ce1126","#000000","#fcd116"],PH:["#0038a8","#ffffff","#ce1126"],PK:["#ffffff","#01411c","#01411c"],PS:["#000000","#ffffff","#007a3d"],PY:["#d52b1e","#ffffff","#0038a8"],QA:["#ffffff","#8a1538","#8a1538"],RS:["#c6363c","#0c4076","#ffffff"],RW:["#00a1de","#fad201","#00a651"],SA:["#006c35","#ffffff","#006c35"],SB:["#0051ba","#fcd116","#215b33"],SC:["#003f87","#fcd116","#d62828"],SD:["#d21034","#ffffff","#000000"],SG:["#ed2939","#ffffff","#ed2939"],SI:["#ffffff","#0000ff","#ff0000"],SL:["#1eb53a","#ffffff","#0072c6"],SM:["#ffffff","#5eb6e4","#ffffff"],SN:["#00853f","#fdef42","#e31b23"],SO:["#4189dd","#ffffff","#4189dd"],SR:["#377e3f","#ffffff","#b40a2d"],SS:["#000000","#ce1126","#078930"],ST:["#12ad2b","#ffce00","#d21034"],SV:["#0047ab","#ffffff","#0047ab"],SY:["#ce1126","#ffffff","#000000"],SZ:["#3e5eb9","#ffd900","#b10c0c"],TD:["#002664","#fecb00","#c60c30"],TG:["#006a4e","#fcd116","#d21034"],TH:["#ed1c24","#ffffff","#241d4f"],TJ:["#cc0000","#ffffff","#006600"],TL:["#dc241f","#ffc726","#000000"],TM:["#00853e","#ffffff","#cc0000"],TN:["#e70013","#ffffff","#e70013"],TO:["#ffffff","#c10000","#c10000"],TT:["#ce1126","#ffffff","#000000"],TW:["#fe0000","#000095","#fe0000"],TZ:["#1eb53a","#fcd116","#00a3dd"],UG:["#000000","#fcdc04","#d90000"],UY:["#ffffff","#0038a8","#ffffff"],UZ:["#1eb53a","#ffffff","#0099b5"],VA:["#ffe000","#ffffff","#ffe000"],VE:["#fcd116","#00247d","#cf142b"],VU:["#000000","#ce1126","#009543"],WS:["#002b7f","#ffffff","#cc0033"],YE:["#ce1126","#ffffff","#000000"],ZM:["#198a00","#de2010","#ef7d00"],ZW:["#078930","#fcd116","#cf2027"]}),B=["#cbd5e1","#94a3b8","#cbd5e1"];function q(f){return f?J[f.toUpperCase()]??B:B}const z=F,W=({code:f,size:n=22,className:i})=>{const{t:r}=g.useNiceTranslation(),l=f?.toUpperCase(),d=l?z[l]:void 0,t=n,c=Math.round(n*2/3);return d?e.jsx("span",{className:i,role:"img","aria-label":r("pickerCommons.flag","{upper} flag").replace("{upper}",String(l)),style:{display:"inline-block",width:t,height:c,boxSizing:"content-box",border:"1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle",lineHeight:0},dangerouslySetInnerHTML:{__html:d.replace("<svg ",`<svg width="${t}" height="${c}" preserveAspectRatio="xMidYMid slice" `)}}):e.jsx(Q,{code:f,size:n,className:i})},Q=({code:f,size:n=18,className:i})=>{const{t:r}=g.useNiceTranslation(),l=q(f);return e.jsx("span",{className:i,role:"img","aria-label":r("pickerCommons.flag2","{code} flag").replace("{code}",String(f)),style:{display:"inline-flex",width:n,height:Math.round(n*.7),boxSizing:"content-box",border:"1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:l.map((d,t)=>e.jsx("span",{style:{flex:1,background:d}},t))})};function X(f,n,i,r=280){const[l,d]=y.useState(i==="left"?"left":"right"),t=y.useCallback(()=>{if(i!=="auto"){d(i);return}const c=n.current;if(!c||typeof window>"u")return;const b=c.getBoundingClientRect(),o=window.innerWidth-b.left,h=b.right;o>=r&&o>h?d("left"):d("right")},[i,n,r]);return y.useEffect(()=>{if(f)return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[f,t]),l}const M=(f,n)=>({backgroundColor:f,backgroundImage:n});function ff({roles:f,w:n,h:i,border:r,className:l,label:d}){const t=[{key:"side",style:M(f.sideNav,f.sideNavImage),stripes:f.headers},{key:"top",style:M(f.topNav,f.topNavImage)},{key:"body",style:M(f.body,f.bodyImage)},{key:"panel",style:M(f.panel,f.panelImage)},{key:"highlight",style:M(f.highlight)}];return e.jsx("span",{className:l,role:"img","aria-label":d,"data-preview":"columns",style:{display:"inline-flex",width:n,height:i,border:`1px solid ${r}`,borderRadius:Math.max(2,Math.round(i*.14)),overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:t.map(c=>e.jsx("span",{"data-role":c.key,style:{flex:1,display:"flex",flexDirection:"column",...c.style},children:c.stripes?.map((b,s)=>e.jsx("span",{style:{flex:"0 0 20%",background:b}},s))},c.key))})}function ef({roles:f,w:n,h:i,border:r,className:l,label:d}){const t=Math.max(3,Math.round(i*.18)),c=Math.max(4,Math.round(n*.28)),b=Math.max(2,Math.round((i-t)*.13)),s=Math.max(2,Math.round(n*.06)),o=Math.max(1,Math.round(i*.06)),h=a=>({position:"absolute",...a});return e.jsxs("span",{className:l,role:"img","aria-label":d,"data-preview":"layout",style:{position:"relative",display:"inline-block",width:n,height:i,boxSizing:"content-box",...M(f.body,f.bodyImage),border:`1px solid ${r}`,borderRadius:Math.max(2,Math.round(i*.08)),overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:[e.jsx("span",{style:h({top:0,left:0,right:0,height:t,...M(f.topNav,f.topNavImage)})}),e.jsx("span",{style:h({top:Math.round(t*.3),left:s,width:Math.round(t*.4),height:Math.round(t*.4),borderRadius:"50%",background:f.primary})}),e.jsx("span",{style:h({top:Math.round(t*.42),left:s+t,width:Math.round(n*.22),height:o,background:f.topNavText,opacity:.8})}),e.jsx("span",{style:h({top:t,bottom:0,left:0,width:c,...M(f.sideNav,f.sideNavImage)})}),f.headers.map((a,m)=>e.jsx("span",{style:h({top:t+m*b,left:0,width:c,height:b,background:a})},m)),e.jsx("span",{style:h({top:t+f.headers.length*b+Math.round(b*.4),left:0,width:c,height:b,background:f.highlight})}),e.jsx("span",{style:h({top:t+s,left:c+s,right:s,bottom:s,...M(f.panel,f.panelImage),border:`1px solid ${f.panelBorder}`,borderRadius:2})}),e.jsx("span",{style:h({top:t+s*2.2,left:c+s*2,right:s*3,height:o,background:f.text,opacity:.85})}),e.jsx("span",{style:h({top:t+s*2.2+o*2.5,left:c+s*2,width:Math.round((n-c)*.4),height:o,background:f.text,opacity:.55})}),e.jsx("span",{style:h({bottom:s*2,right:s*2,width:Math.round((n-c)*.22),height:Math.max(2,o*2),borderRadius:2,background:f.primary})})]})}const tf=({colors:f,size:n=28,shape:i="page",className:r})=>{const{t:l}=g.useNiceTranslation(),d=n,t=Math.round(n*.75),c=f.border??"color-mix(in srgb, currentColor 30%, transparent)",b=l("pickerCommons.themePreview","Theme preview");if(f.roles){const p={roles:f.roles,w:d,h:t,border:c,className:r,label:b};return i==="swatch"||i==="columns"?e.jsx(ff,{...p}):e.jsx(ef,{...p})}if(i==="swatch"||i==="columns"){const p=[f.primary,f.background,f.backgroundSecondary??f.background,f.textColor];return e.jsx("span",{className:r,role:"img","aria-label":l("pickerCommons.themePreview","Theme preview"),style:{display:"inline-flex",width:d,height:t,border:`1px solid ${c}`,borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:p.map((v,_)=>e.jsx("span",{style:{flex:1,background:v}},_))})}const s=Math.max(2,Math.round(t*.17)),o=Math.max(2,Math.round(d*.14)),h=d-o*2,a=Math.max(2,Math.round(h*.16)),m=Math.max(1,Math.round(t*.07)),x=t-s;return e.jsxs("span",{className:r,role:"img","aria-label":l("pickerCommons.themePreview","Theme preview"),style:{position:"relative",display:"inline-block",width:d,height:t,boxSizing:"content-box",background:f.backgroundSecondary??f.background,border:`1px solid ${c}`,borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:[e.jsx("span",{style:{position:"absolute",top:0,left:0,right:0,height:s,background:f.primary}}),e.jsx("span",{style:{position:"absolute",top:s,bottom:0,left:o,right:o,background:f.background,borderLeft:`1px solid ${c}`,borderRight:`1px solid ${c}`}}),e.jsx("span",{style:{position:"absolute",top:s+Math.round(x*.28),left:o+a,right:o+a,height:m,background:f.textColor}}),e.jsx("span",{style:{position:"absolute",top:s+Math.round(x*.55),left:o+a,width:Math.max(3,Math.round((h-a*2)*.6)),height:m,background:f.textColor}})]})};exports.FlagIcon=W;exports.NiceTabs=Z;exports.NiceToggle=Y;exports.ThemePreviewSwatch=tf;exports.useDropdownAlignment=X;exports.useListKeyboardNav=V;
|