# Ejemplo de código de Item de estado. DESY. Sistema de diseño del Gobierno de Aragón. ## Componentes Índice de páginas Componentes # Item de estado Datos Bloque con listas de descripción o etiquetas, además de información del estado de las aportaciones realizadas. Generalmente utilizado en formularios. # Status-item Mostrar parámetros ## Parámetros Nunjucks del componente: "Status-item" ```yaml params: - name: id type: string required: true description: The id of the item. - name: title type: object required: false description: This is the title - name: text type: string required: true description: If `html` is set, this is not required. Text to use within the title. If `html` is provided, the `text` argument will be ignored. - name: html type: string required: true description: If `text` is set, this is not required. HTML to use within the title. If `html` is provided, the `text` argument will be ignored. - name: classes type: string required: false description: Classes to add to the item title. - name: hint type: object required: false description: Options for the hint component. isComponent: true - name: errorMessage type: object required: false description: Options for the error message component. The error message component will not display if you use a falsy value for `errorMessage`, for example `false` or `null`. - name: errorId type: string required: false description: Custom ID to add to the `aria-errormessage` attribute, used to provide additional descriptive information for screenreader users. - name: describedBy type: string required: false description: One or more element IDs to add to the `aria-describedby` attribute, used to provide additional descriptive information for screenreader users. - name: items type: array required: false description: Description list items params: - name: term type: object required: true description: term in dt. - name: text type: string required: true description: If `html` is set, this is not required. Text to use within each dt item. If `html` is provided, the `text` argument will be ignored. - name: html type: string required: true description: If `text` is set, this is not required. HTML to use within each dt item. If `html` is provided, the `text` argument will be ignored. - name: classes type: string required: false description: Classes to add to the dt. - name: attributes type: object required: false description: HTML attributes (for example data attributes) to add to the dt. - name: definition type: object required: true description: definition in dd. - name: text type: string required: true description: If `html` is set, this is not required. Text to use within each dd item. If `html` is provided, the `text` argument will be ignored. - name: html type: string required: true description: If `text` is set, this is not required. HTML to use within each dd item. If `html` is provided, the `text` argument will be ignored. - name: classes type: string required: false description: Classes to add to the dd. - name: attributes type: object required: false description: HTML attributes (for example data attributes) to add to the dd. - name: classes type: string required: false description: Classes to add to a div container that contain the dt/dd pair. - name: attributes type: object required: false description: HTML attributes (for example data attributes) to add to a div container that contain the dt/dd pair. - name: status type: object required: false description: Options for the status component. - name: classes type: string required: false description: Classes to add to the status container div tag. - name: attributes type: object required: false description: HTML attributes (for example data attributes) to add to the container div tag. - name: caller type: nunjucks-block required: false description: Not strictly a parameter but [Nunjucks code convention](https://mozilla.github.io/nunjucks/templating.html#call). Using a `call` block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire item component in a `call` block. ``` ### Por defecto [#](#por-defecto) Recuerda que los items, por accesibilidad, deben estar rodeados de una etiqueta semántica, normalmente un `
  • `. Mostrar códigodel ejemplo: Por defecto #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "default", "title": { "text": "Título" } }) %} {% endcall %} ``` ##### HTML ```html

    Título

    ``` ### Por defecto sólo items [#](#por-defecto-slo-items) Mostrar códigodel ejemplo: Por defecto sólo items #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "only-items", "items": [ { "term": { "text": "término" }, "definition": { "text": "definición" } }, { "term": { "text": "término" }, "definition": { "text": "definición" } }, { "term": { "text": "término" }, "definition": { "text": "definición" } } ], "status": { "text": "Correcto", "icon": { "type": "success" } } }) %} {% endcall %} ``` ##### HTML ```html
    término
    definición
    término
    definición
    término
    definición

    Correcto

    ``` ### Con título html [#](#con-ttulo-html) Mostrar códigodel ejemplo: Con título html #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-title-html", "title": { "html": "Autorización para la consulta de datos de las personas de la unidad familiar. (Documento condicionado)" } }) %} {% endcall %} ``` ##### HTML ```html

    Autorización para la consulta de datos de las personas de la unidad familiar. (Documento condicionado)

    ``` ### Con pista [#](#con-pista) Mostrar códigodel ejemplo: Con pista #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-hint", "title": { "text": "Personas de la unidad familiar" }, "hint": { "text": "2 personas añadidas" }, "status": { "text": "Aportado", "icon": { "type": "success" } } }) %} {% endcall %} ``` ##### HTML ```html

    Personas de la unidad familiar

    2 personas añadidas

    Aportado

    ``` ### Con pista html [#](#con-pista-html) Mostrar códigodel ejemplo: Con pista html #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-hint-html", "title": { "text": "Autorización para la consulta de datos de las personas de la unidad familiar" }, "hint": { "html": "Descargar modelo" } }) %} {% endcall %} ``` ##### HTML ```html

    Autorización para la consulta de datos de las personas de la unidad familiar

    Descargar modelo

    ``` ### Con estado simple [#](#con-estado-simple) Mostrar códigodel ejemplo: Con estado simple #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-status-simple", "title": { "text": "Datos adicionales del solicitante" }, "status": { "text": "Iniciado" } }) %} {% endcall %} ``` ##### HTML ```html

    Datos adicionales del solicitante

    Iniciado

    ``` ### Con estado éxito [#](#con-estado-xito) Mostrar códigodel ejemplo: Con estado éxito #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-status-success", "title": { "text": "Datos adicionales del solicitante" }, "status": { "text": "Aportado", "icon": { "type": "success" } } }) %} {% endcall %} ``` ##### HTML ```html

    Datos adicionales del solicitante

    Aportado

    ``` ### Con estado alerta [#](#con-estado-alerta) Mostrar códigodel ejemplo: Con estado alerta #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-status-alert", "title": { "text": "Datos adicionales del solicitante" }, "errorMessage": { "text": "Es necesario aportar este documento para enviar el trámite", "classes": "my-sm text-alert-base" }, "status": { "text": "Incompleto", "icon": { "type": "alert" }, "classes": "text-alert-base" }, "classes": "border-l-4 border-alert-base" }) %} {% endcall %} ``` ##### HTML ```html

    Datos adicionales del solicitante

    Error:Es necesario aportar este documento para enviar el trámite

    Incompleto

    ``` ### Con estado cargando [#](#con-estado-cargando) Mostrar códigodel ejemplo: Con estado cargando #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-status-loading", "title": { "text": "Datos adicionales del solicitante" }, "status": { "text": "Subiendo (20%)", "icon": { "type": "loading" } } }) %} {% endcall %} ``` ##### HTML ```html

    Datos adicionales del solicitante

    Subiendo (20%)

    ``` ### Con estado error [#](#con-estado-error) Mostrar códigodel ejemplo: Con estado error #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-status-error", "title": { "text": "Datos adicionales del solicitante" }, "errorMessage": { "text": "Se ha producido un error al subir el archivo", "classes": "my-sm text-alert-base" }, "status": { "text": "Error", "icon": { "type": "error" }, "classes": "text-alert-base" }, "classes": "border-l-4 border-alert-base" }) %} {% endcall %} ``` ##### HTML ```html

    Datos adicionales del solicitante

    Error:Se ha producido un error al subir el archivo

    Error

    ``` ### Con html en la definición [#](#con-html-en-la-definicin) Mostrar códigodel ejemplo: Con html en la definición #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "with-html-in-definition", "items": [ { "term": { "text": "Acreditación" }, "definition": { "html": "Mediante archivo adjunto Modelo de solicitud (PDF, 200Kb)" } } ], "status": { "text": "Completo", "icon": { "type": "success" } } }) %} {% endcall %} ``` ##### HTML ```html
    Acreditación
    Mediante archivo adjunto Modelo de solicitud (PDF, 200Kb)

    Completo

    ``` ### Incompleto [#](#incompleto) Mostrar códigodel ejemplo: Incompleto #### Contenido Nunjucks macro HTML ##### Nunjucks macro ```js {% from "components/status-item/_macro.status-item.njk" import componentStatusItem %} {% call componentStatusItem({ "id": "incompleto-status-item", "items": [ { "term": { "text": "Nombre" }, "definition": { "text": "Ana" } }, { "term": { "text": "Apellidos" }, "definition": { "text": "Pérez Escribano" } }, { "term": { "text": "Número de identificación" }, "definition": { "text": "72882918B" } } ], "status": { "text": "Incompleto", "icon": { "type": "alert" } }, "classes": "border-l-4 border-alert-base" }) %} {% endcall %} ``` ##### HTML ```html
    Nombre
    Ana
    Apellidos
    Pérez Escribano
    Número de identificación
    72882918B

    Incompleto

    ```