import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{t as r}from"./jsx-runtime-C2wGStra.js";import{n as i,t as a}from"./Text-DO3xXyuu.js";import{n as o,t as s}from"./Heading-BfSBs5r6.js";import{n as c,t as l}from"./Button-DqcfuOFN.js";import{a as u,r as d}from"./lib-8ue2PVWI.js";import{n as f,t as p}from"./Checkbox-BV4Be-fH.js";import{n as m,t as h}from"./LayoutFlex-BKX2c6Gj.js";import{n as g,t as _}from"./LayoutGrid-lZI3Y0DM.js";import{n as v,t as y}from"./NumberField-DabUVK50.js";import{n as b,t as x}from"./IntlFormattedCurrency-CGIWKpIw.js";import{c as S,f as C,i as w,l as T,o as E,p as D,r as O,s as k,u as A}from"./constants-DqpY9rFL.js";var j,M,N,P,F,I,L,R,z;t((()=>{j=e(n(),1),d(),D(),b(),i(),v(),m(),g(),o(),c(),f(),O(),M=r(),N=[`rounded`,`short`,`explicit`,`range`],P=[`BRL`,`GBP`,`EUR`,`PLN`,`USD`,`UAH`],F=()=>{let[e,t]=(0,j.useState)(``),[n,r]=(0,j.useState)(``),[i,o]=(0,j.useState)(!1),[c,d]=(0,j.useState)(12.34),[f,m]=(0,j.useState)(10),[g,v]=(0,j.useState)(20),[b,D]=(0,j.useState)(!1),O=e=>{e!==void 0&&d(e)},F=e=>{e!==void 0&&m(e)},I=e=>{e!==void 0&&v(e)},L=(e,t)=>e===`range`?(0,M.jsx)(x.CurrencyRange,{currency:t,startValue:f,endValue:g,variant:`short`,showPlusSign:b}):e===`rounded`?(0,M.jsx)(x.CurrencyRounded,{currency:t,value:c,showPlusSign:b}):e===`explicit`?(0,M.jsx)(x.CurrencyExplicit,{currency:t,value:c,showPlusSign:b}):(0,M.jsx)(x.CurrencyShort,{currency:t,value:c,showPlusSign:b}),R=({variant:i,currency:o,isEvenGroup:s,isFirstRow:c})=>(0,M.jsxs)(`tr`,{onMouseEnter:()=>r(`${i}-${o}`),children:[c?(0,M.jsx)(T,{"data-iscentered":!0,"data-isevengroup":s,rowSpan:N.length,"data-ishighlighted":n.includes(o),children:(0,M.jsx)(a,{variant:`large-semibold`,children:o})}):null,(0,M.jsx)(T,{"data-isevengroup":s,"data-ishighlighted":`${i}-${o}`===n,children:i}),w.map(a=>(0,M.jsx)(T,{onMouseEnter:()=>{t(a),r(`${i}-${o}`)},"data-ishighlighted":a===e||`${i}-${o}`===n,"data-isevengroup":s,children:(0,M.jsx)(u,{textComponent:`span`,locale:E[a],children:L(i,o)})},`${i}-${o}-${a}`))]},`${i}-${o}`);return(0,M.jsxs)(_,{padding:`12`,gap:`16`,columns:[`1fr`],children:[(0,M.jsx)(s,{variant:`medium`,tag:`h3`,children:`Currency formatting using Intl.NumberFormat`}),(0,M.jsxs)(h,{direction:`row`,gap:`12`,alignItems:`center`,children:[(0,M.jsx)(y,{label:`Value`,value:c,onValueChange:O,useLegacyRequiredLabel:!0}),(0,M.jsx)(y,{label:`Range start`,value:f,onValueChange:F,useLegacyRequiredLabel:!0}),(0,M.jsx)(y,{label:`Range end`,value:g,onValueChange:I,useLegacyRequiredLabel:!0})]}),(0,M.jsxs)(h,{direction:`row`,gap:`12`,alignItems:`center`,children:[(0,M.jsx)(p,{checked:b,onCheckedChange:()=>D(!b)}),(0,M.jsx)(`label`,{htmlFor:`show-plus-sign`,children:(0,M.jsx)(a,{variant:`default-semibold`,accent:`primary`,children:`Show "+" sign`})})]}),(0,M.jsx)(h,{direction:`row`,children:(0,M.jsx)(l,{size:`small`,onClick:()=>o(!i),children:i?`Hide Options`:`Show my browser options`})}),i?(0,M.jsx)(`pre`,{children:JSON.stringify(new Intl.NumberFormat().resolvedOptions(),null,2)}):null,(0,M.jsx)(h,{direction:`column`,gap:`4`,children:(0,M.jsx)(S,{children:(0,M.jsx)(k,{onMouseLeave:()=>{t(``),r(``)},children:(0,M.jsx)(`tbody`,{children:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(C,{}),(0,M.jsx)(C,{}),w.map(e=>(0,M.jsx)(C,{onMouseEnter:()=>t(e),children:e},e))]}),P.map((e,t)=>(0,M.jsxs)(j.Fragment,{children:[N.map((n,r)=>R({variant:n,currency:e,isEvenGroup:t%2==1,isFirstRow:r===0})),t<P.length-1&&(0,M.jsx)(`tr`,{children:(0,M.jsx)(A,{colSpan:w.length+2})})]},e))]})})})})})]})},I={title:`IntlFormatted/IntlFormattedCurrency`,component:F,parameters:{layout:`fullscreen`,chromatic:{disableSnapshot:!0}}},L=()=>(0,M.jsx)(F,{}),R=L.bind({}),R.tags=[`!autodocs`,`!a11y-test`],R.parameters={...R.parameters,docs:{...R.parameters?.docs,source:{originalSource:`() => <CurrencyTable />`,...R.parameters?.docs?.source}}},z=[`Default`]}))();export{R as Default,z as __namedExportsOrder,I as default};