| 1 |
import{a as R,g as U,i as y,cz as m,j as l,h as c,cB as B,cA as v,l as L,cC as M,bG as W,ct as X,cu as q,cD as J,cE as P,cl as Q,aX as Y,ck as Z,cr as _}from"./main-294.js";import{B as k}from"./bf-188-247.js";import{S as V}from"./bf-250-243.js";import{c as tt}from"./bf-908-241.js";import{a as T}from"./bf-764-245.js";import"./bf-487-72.js";import"./bf-176-80.js";import"./bf-867-113.js";import"./bf-986-242.js";import"./bf-22-244.js";import"./bf-934-246.js";import"./bf-5-86.js";function xt({objectPaths:r,id:j}){const{css:o}=R(),{"*":b}=U(),[$,z]=y(Q),[D,F]=y(Y),[H,E]=y(Z),[K,A]=b.split("/"),g=e=>_(e,{themeVars:$,styles:D,themeColors:H}),u=e=>m(g(e.object),L(g(e.object),e.path)),i=[];if(Array.isArray(r))r.forEach(e=>{const{paths:s,object:n}=e;Object.keys(e.paths).forEach(d=>{i[d]={object:n,path:s[d]}})});else{const{paths:e,object:s}=r;Object.keys(e).forEach(a=>{i[a]={object:s,path:e[a]}})}const t={"outline-color":"","outline-width":"","outline-offset":"","outline-style":""},f=Object.keys(i);for(let e=0;e<f.length;e+=1){const s=f[e];if(f.length===2&&s==="outline"){const n=u(i[s]),a=n==null?void 0:n.split(/(?!\(.*)\s(?![^(]*?\))/g);t["outline-width"]=m(i[s],a[0])||"",t["outline-style"]=m(i[s],a[1])||"",t["outline-color"]=m(i[s],a[2])||"";break}s!=="outline-offset"&&(t[s]=u(i[s]))}t["outline-offset"]=u(i["outline-offset"]);const O=(e,s)=>{if(e==="outline-width")return s||"0px";if(e==="outline-style")return s||"solid";if(e==="outline-color")return s||"hsla(0, 0%, 0%, 0.5)"},w=(e,s)=>{var N;let n,a=s;if(f.length===2&&Object.keys(i).includes("outline")&&s!=="outline-offset"){a="outline";const I=st(u(i.outline));n=Object.entries(I).map(([S,G])=>S===s?O(s,e):O(S,G)).join(" ")}Object.keys(i).includes("outline-offset")&&s==="outline-offset"&&(n=e);const{object:d,path:p}=i[a];n=((N=u(i[a]))==null?void 0:N.indexOf("!important"))>=0?`${e} !important`:n,M(d,p,n,{setThemeVars:z,setThemeColors:E,setStyles:F}),W(X(K,A,a,n,{[d]:q(d)}))},h=({unit:e,value:s,prop:n,oldVal:a})=>{if(s){const d=v(a),C=`${J(e,s,d)}${e||"px"}`;w(C,n)}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:o(c.flxcb,c.mb2,{w:200}),children:[l.jsx("span",{className:o(c.fs12,c.fw500),children:"Type"}),l.jsx(tt,{options:et,value:t==null?void 0:t["outline-style"],onChange:e=>w(e,"outline-style"),w:130,h:30,id:`${j}-style`})]}),l.jsxs("div",{className:o(c.flxcb,c.mb2,{w:200}),children:[l.jsx("span",{className:o(c.fs12,c.fs12,c.fw500),children:"Color"}),l.jsx(V,{action:{onChange:e=>w(e,"outline-color")},value:t==null?void 0:t["outline-color"]})]}),l.jsx("div",{className:o(c.mb2,{w:200}),children:l.jsxs("div",{className:o(x.titleContainer),children:[l.jsx("span",{className:o(x.title),children:"Width"}),l.jsx("span",{className:o(c.flxc)}),l.jsx("div",{className:o({p:2}),children:l.jsx(T,{min:"0",inputHandler:({unit:e,value:s})=>h({unit:e,value:s,prop:"outline-width"}),sizeHandler:({unitKey:e,unitValue:s})=>h({value:s,unit:e,prop:"outline-width",oldVal:t==null?void 0:t["outline-width"]}),id:"0",label:l.jsx(k,{size:14}),value:(t==null?void 0:t["outline-width"])&&B(t==null?void 0:t["outline-width"]),unit:(t==null?void 0:t["outline-width"])&&v(t==null?void 0:t["outline-width"]),options:["px","em","rem","%"],width:"128px",dataTestId:"outline-width-control"})})]})}),l.jsx("div",{className:o(c.mb2,{w:200}),children:l.jsxs("div",{className:o(x.titleContainer),children:[l.jsx("span",{className:o(x.title),children:"Offset"}),l.jsx("span",{className:o(c.flxc)}),l.jsx("div",{className:o({p:2}),children:l.jsx(T,{min:"0",inputHandler:({value:e,unit:s})=>h({value:e,unit:s,prop:"outline-offset"}),sizeHandler:({unitKey:e,unitValue:s})=>h({value:s,unit:e,prop:"outline-offset",oldVal:t==null?void 0:t["outline-offset"]}),id:"0",label:l.jsx(k,{size:14}),value:(t==null?void 0:t["outline-offset"])&&B(t==null?void 0:t["outline-offset"]),unit:(t==null?void 0:t["outline-offset"])&&v(t==null?void 0:t["outline-offset"]),options:["px","em","rem","%"],width:"128px",dataTestId:"outline-width-control"})})]})})]})}const x={titleContainer:{flx:"center-between"},title:{fs:12,fw:500}},et=[{label:"Solid",value:"solid"},{label:"Dashed",value:"dashed"},{label:"Dotted",value:"dotted"},{label:"Double",value:"double"},{label:"Groove",value:"groove"},{label:"Ridge",value:"ridge"},{label:"Inset",value:"inset"},{label:"Outset",value:"outset"},{label:"None",value:"none"}],st=r=>{const[j,o,b]=P(r);return{"outline-width":j,"outline-style":o,"outline-color":b}};export{xt as default}; |