import{T as f,c as I,u as w,j as p,A,d as C,b as R}from"./dataProvider-3f13e24d.js";import{r as T}from"./index-76fb7be0.js";import{P as l}from"./index-8d47fad6.js";import{g as k}from"./_baseAssignValue-4b27bc5d.js";import{f as L,s as v}from"./sanitizeFieldRestProps-fb2f7069.js";import{g as z}from"./genericMemo-8de5a1aa.js";import{u as M}from"./useRecordContext-3e1d0ecf.js";import{L as B}from"./Labeled-920c48dc.js";var s=globalThis&&globalThis.__assign||function(){return s=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},s.apply(this,arguments)},q=globalThis&&globalThis.__rest||function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]]);return t},m=function(r){var e=r.className,t=r.emptyText,n=r.source,o=r.locales,U=r.options;r.textAlign;var d=r.transform,g=d===void 0?G:d,b=q(r,["className","emptyText","source","locales","options","textAlign","transform"]),_=M(r),E=I();if(!_)return null;var a=k(_,n);return a==null?t?T.createElement(f,s({component:"span",variant:"body2",className:e},v(b)),t&&E(t,{_:t})):null:(g&&(a=g(a)),T.createElement(f,s({variant:"body2",component:"span",className:e},v(b)),H&&typeof a=="number"?a.toLocaleString(o,U):a))},G=function(r){return r&&typeof r=="string"&&!isNaN(r)?+r:r};m.propTypes=s(s(s({},f.propTypes),L),{locales:l.oneOfType([l.string,l.arrayOf(l.string)]),options:l.object});m.displayName="NumberFieldImpl";m.defaultProps={textAlign:"right"};var y=z(m),H=!!(typeof Intl=="object"&&Intl&&typeof Intl.NumberFormat=="function");const J={title:"Blocks/Fields/NumberField",component:y,parameters:{layout:"centered"},decorators:[r=>K(r)],args:{record:w[0]}},i={render:r=>p(y,{source:"day_offs",...r})},c={render:({currency:r,...e})=>p(y,{source:"day_offs",options:{style:"currency",currency:r},...e}),args:{currency:"USD"},argTypes:{currency:{options:["USD","EUR"],control:{type:"select"}}}},u={render:({unit:r,unitDisplay:e,...t})=>p(y,{source:"day_offs",options:{style:"unit",unit:r,unitDisplay:e},...t}),args:{unit:"liter",unitDisplay:"short"},argTypes:{unit:{options:["liter","gallon","kilometer"],control:{type:"select"}},unitDisplay:{options:["short","narrow","long"],control:{type:"select"}}}},K=r=>p(A,{dataProvider:C,i18nProvider:R,children:p(B,{children:r()})});var N,h,O;i.parameters={...i.parameters,docs:{...(N=i.parameters)==null?void 0:N.docs,source:{originalSource:`{
  render: props => {
    return <NumberField source="day_offs" {...props} />;
  }
}`,...(O=(h=i.parameters)==null?void 0:h.docs)==null?void 0:O.source}}};var x,D,P;c.parameters={...c.parameters,docs:{...(x=c.parameters)==null?void 0:x.docs,source:{originalSource:`{
  render: ({
    currency,
    ...props
  }) => {
    return <NumberField source="day_offs" options={{
      style: 'currency',
      currency
    }} {...props} />;
  },
  args: {
    currency: 'USD'
  },
  argTypes: {
    currency: {
      options: ['USD', 'EUR'],
      control: {
        type: 'select'
      }
    }
  }
}`,...(P=(D=c.parameters)==null?void 0:D.docs)==null?void 0:P.source}}};var S,j,F;u.parameters={...u.parameters,docs:{...(S=u.parameters)==null?void 0:S.docs,source:{originalSource:`{
  render: ({
    unit,
    unitDisplay,
    ...props
  }) => {
    return <NumberField source="day_offs" options={{
      style: 'unit',
      unit,
      unitDisplay
    }} {...props} />;
  },
  args: {
    unit: 'liter',
    unitDisplay: 'short'
  },
  argTypes: {
    unit: {
      options: ['liter', 'gallon', 'kilometer'],
      control: {
        type: 'select'
      }
    },
    unitDisplay: {
      options: ['short', 'narrow', 'long'],
      control: {
        type: 'select'
      }
    }
  }
}`,...(F=(j=u.parameters)==null?void 0:j.docs)==null?void 0:F.source}}};const Q=["Default","Currency","Unit"],tr=Object.freeze(Object.defineProperty({__proto__:null,Currency:c,Default:i,Unit:u,__namedExportsOrder:Q,default:J},Symbol.toStringTag,{value:"Module"}));export{c as C,i as D,tr as N,u as U};
