import{T as O,s as X,c as G,u as J,j as v,A as K,d as Q,b as W}from"./dataProvider-3f13e24d.js";import{r as g,i as T,a as y}from"./jsx-runtime_commonjs-proxy-8cae6ccb.js";import{L as Y}from"./Labeled-920c48dc.js";import{r as l}from"./index-76fb7be0.js";import{P as c}from"./index-8d47fad6.js";import{g as Z}from"./_baseAssignValue-4b27bc5d.js";import{d as ee}from"./Clear-da86992f.js";import{g as ae}from"./genericMemo-8de5a1aa.js";import{f as re,s as B}from"./sanitizeFieldRestProps-fb2f7069.js";import{T as ne}from"./Tooltip-459141a0.js";import{u as oe}from"./useRecordContext-3e1d0ecf.js";var _={},le=T;Object.defineProperty(_,"__esModule",{value:!0});var U=_.default=void 0,te=le(g()),se=y;U=_.default=(0,te.default)((0,se.jsx)("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done");var t=globalThis&&globalThis.__assign||function(){return t=Object.assign||function(e){for(var a,n=1,r=arguments.length;n<r;n++){a=arguments[n];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},t.apply(this,arguments)},ce=globalThis&&globalThis.__rest||function(e,a){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&a.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)a.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},p,F=function(e){var a=e.className,n=e.emptyText,r=e.source,o=e.valueLabelTrue,k=e.valueLabelFalse,x=e.TrueIcon,h=x===void 0?U:x,P=e.FalseIcon,S=P===void 0?ee:P,z=e.looseValue,E=z===void 0?!1:z,R=ce(e,["className","emptyText","source","valueLabelTrue","valueLabelFalse","TrueIcon","FalseIcon","looseValue"]),H=oe(e),M=G(),s=Z(H,r),$=s===!0||E&&s,d=s?o:k;return d||(d=$?"ra.boolean.true":"ra.boolean.false"),E||s===!1||s===!0?l.createElement(ue,t({component:"span",variant:"body2",className:a},B(R)),l.createElement(ne,{title:M(d,{_:d})},$?h?l.createElement(h,{"data-testid":"true",fontSize:"small",className:I.trueIcon}):l.createElement(l.Fragment,null):S?l.createElement(S,{"data-testid":"false",fontSize:"small",className:I.falseIcon}):l.createElement(l.Fragment,null))):l.createElement(O,t({component:"span",variant:"body2",className:a},B(R)),n&&M(n,{_:n}))};F.propTypes=t(t(t({},O.propTypes),re),{valueLabelFalse:c.string,valueLabelTrue:c.string,TrueIcon:c.elementType,FalseIcon:c.elementType,looseValue:c.bool});F.displayName="BooleanFieldImpl";var A=ae(F),b="RaBooleanField",I={trueIcon:"".concat(b,"-trueIcon"),falseIcon:"".concat(b,"-falseIcon")},ue=X(O,{name:b,overridesResolver:function(e,a){return a.root}})((p={display:"inline-flex",verticalAlign:"middle",lineHeight:0},p["& .".concat(I.trueIcon)]={},p["& .".concat(I.falseIcon)]={},p)),L={},ie=T;Object.defineProperty(L,"__esModule",{value:!0});var u=L.default=void 0,me=ie(g()),fe=y;u=L.default=(0,me.default)((0,fe.jsx)("path",{d:"m22 5.72-4.6-3.86-1.29 1.53 4.6 3.86zM7.88 3.39 6.6 1.86 2 5.71l1.29 1.53zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9m0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7m-1.46-5.47L8.41 12.4l-1.06 1.06 3.18 3.18 6-6-1.06-1.06z"}),"AlarmOn");var j={},de=T;Object.defineProperty(j,"__esModule",{value:!0});var i=j.default=void 0,pe=de(g()),ve=y;i=j.default=(0,pe.default)((0,ve.jsx)("path",{d:"M12 6c3.87 0 7 3.13 7 7 0 .84-.16 1.65-.43 2.4l1.52 1.52c.58-1.19.91-2.51.91-3.92 0-4.97-4.03-9-9-9-1.41 0-2.73.33-3.92.91L9.6 6.43C10.35 6.16 11.16 6 12 6m10-.28-4.6-3.86-1.29 1.53 4.6 3.86zM2.92 2.29 1.65 3.57 2.98 4.9l-1.11.93 1.42 1.42 1.11-.94.8.8C3.83 8.69 3 10.75 3 13c0 4.97 4.02 9 9 9 2.25 0 4.31-.83 5.89-2.2l2.2 2.2 1.27-1.27L3.89 3.27zm13.55 16.1C15.26 19.39 13.7 20 12 20c-3.87 0-7-3.13-7-7 0-1.7.61-3.26 1.61-4.47zM8.02 3.28 6.6 1.86l-.86.71 1.42 1.42z"}),"AlarmOff");const Ie={title:"Blocks/Fields/BooleanField",component:A,parameters:{layout:"centered"},decorators:[e=>be(e)],args:{record:J[0]}},m={render:e=>v(A,{source:"active",...e})},f={render:({valueLabelTrue:e,valueLabelFalse:a,...n})=>v(A,{source:"active",valueLabelTrue:e,valueLabelFalse:a,TrueIcon:u,FalseIcon:i,...n}),args:{valueLabelTrue:"User is active",valueLabelFalse:"User is banned",TrueIcon:u,FalseIcon:i},argTypes:{TrueIcon:{options:["AlarmOnIcon","AlarmOffIcon"],mapping:{AlarmOnIcon:u,AlarmOffIcon:i}},FalseIcon:{options:["AlarmOnIcon","AlarmOffIcon"],mapping:{AlarmOnIcon:u,AlarmOffIcon:i}}}},be=e=>v(K,{dataProvider:Q,i18nProvider:W,children:v(Y,{children:e()})});var D,C,N;m.parameters={...m.parameters,docs:{...(D=m.parameters)==null?void 0:D.docs,source:{originalSource:`{
  render: props => {
    return <BooleanField source="active" {...props} />;
  }
}`,...(N=(C=m.parameters)==null?void 0:C.docs)==null?void 0:N.source}}};var q,V,w;f.parameters={...f.parameters,docs:{...(q=f.parameters)==null?void 0:q.docs,source:{originalSource:`{
  render: ({
    valueLabelTrue,
    valueLabelFalse,
    ...props
  }) => {
    return <BooleanField source="active" valueLabelTrue={valueLabelTrue} valueLabelFalse={valueLabelFalse} TrueIcon={AlarmOnIcon} FalseIcon={AlarmOffIcon} {...props} />;
  },
  args: {
    valueLabelTrue: "User is active",
    valueLabelFalse: "User is banned",
    TrueIcon: AlarmOnIcon,
    FalseIcon: AlarmOffIcon
  },
  argTypes: {
    TrueIcon: {
      options: ['AlarmOnIcon', 'AlarmOffIcon'],
      mapping: {
        'AlarmOnIcon': AlarmOnIcon,
        'AlarmOffIcon': AlarmOffIcon
      }
    },
    FalseIcon: {
      options: ['AlarmOnIcon', 'AlarmOffIcon'],
      mapping: {
        'AlarmOnIcon': AlarmOnIcon,
        'AlarmOffIcon': AlarmOffIcon
      }
    }
  }
}`,...(w=(V=f.parameters)==null?void 0:V.docs)==null?void 0:w.source}}};const Oe=["Default","Custom"],Se=Object.freeze(Object.defineProperty({__proto__:null,Custom:f,Default:m,__namedExportsOrder:Oe,default:Ie},Symbol.toStringTag,{value:"Module"}));export{Se as B,f as C,m as D};
