import { html } from '@microsoft/fast-element';
import { mapStateToControlProps, rankWith } from '@jsonforms/core';
import { isOneOfBoolean } from '../testers/isOneOfBoolean';
import { BOOLEAN_CONTROL_RANK } from './RenderersRanks';
export const BooleanControlRendererTemplate = html `
  <template>
    <control-wrapper
      :control=${(x) => x.control}
      :touched=${(x) => x.touched}
      ?submitted=${(x) => x.submitted}
    >
      <zero-checkbox
        :checked=${(x) => x.control.data}
        ?disabled=${(x) => !x.control.enabled}
        :autofocus=${(x) => x.control.config.focus}
        :placeholder=${(x) => x.control.config.placeholder}
        @change=${(x, c) => {
    x.control.handleChange(x.control.path, c.event.target.checked);
    x.onBlur();
}}
      ></zero-checkbox>
    </control-wrapper>
  </template>
`;
export const BooleanControlEntry = {
    renderer: BooleanControlRendererTemplate,
    tester: rankWith(BOOLEAN_CONTROL_RANK, isOneOfBoolean),
    mapper: mapStateToControlProps,
};
//# sourceMappingURL=BooleanControlRenderer.js.map