<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
                xmlns:o="http://omnifaces.org/ui">

    <!--
        Composant bouton icône seule réutilisable (WOU/DRY)
        Usage: <ui:include src="/templates/components/buttons/button-icon.xhtml">
                  <ui:param name="icon" value="pi pi-icon-name" />
                  <ui:param name="action" value="#{bean.method}" />
                  <ui:param name="outcome" value="/page" />
                  <ui:param name="update" value="componentId" />
                  <ui:param name="onclick" value="javascript" />
                  <ui:param name="severity" value="info|success|warning|danger" />
                  <ui:param name="rounded" value="true" />
                  <ui:param name="text" value="true" />
                </ui:include>
        action="#{bean.method}" supporté via o:methodParam (void ou retour String)
    -->

    <o:methodParam name="actionMethod" value="#{action}" />

    <ui:fragment rendered="#{empty rendered or rendered}">
        <!-- Navigation GET (p:button) -->
        <p:button rendered="#{not empty outcome}"
            icon="#{icon}"
            outcome="#{outcome}"
            styleClass="#{not empty rounded and rounded ? 'ui-button-rounded' : ''} #{not empty text and text ? 'ui-button-text' : ''} #{not empty severity ? 'ui-button-' += severity : ''} #{not empty styleClass ? styleClass : ''}"
            title="#{title}" />
        <!-- Avec action AJAX (commandButton) -->
        <p:commandButton rendered="#{empty outcome and not empty action}"
            icon="#{icon}"
            action="#{actionMethod}"
            update="#{update}"
            onclick="#{onclick}"
            oncomplete="#{oncomplete}"
            disabled="#{not empty disabled and disabled}"
            styleClass="#{not empty rounded and rounded ? 'ui-button-rounded' : ''} #{not empty text and text ? 'ui-button-text' : ''} #{not empty severity ? 'ui-button-' += severity : ''} #{not empty styleClass ? styleClass : ''}"
            title="#{title}" />
        <!-- Sans action ni outcome (bouton non-submit) -->
        <p:commandButton rendered="#{empty outcome and empty action}" type="button"
            icon="#{icon}"
            onclick="#{onclick}"
            disabled="#{not empty disabled and disabled}"
            styleClass="#{not empty rounded and rounded ? 'ui-button-rounded' : ''} #{not empty text and text ? 'ui-button-text' : ''} #{not empty severity ? 'ui-button-' += severity : ''} #{not empty styleClass ? styleClass : ''}"
            title="#{title}" />
    </ui:fragment>
</ui:composition>
