npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mamba/dialog

v11.0.2

Published

O módulo `Dialog` é composto por 3 componentes: `Dialog`, `ConfirmationDialog` e `PromisedDialog`. Cada um deles cria um modal próprio de tela cheia com suas especificações. O `PromisedDialog` é exibido durante a execução de uma `Promise` e após sua concl

Downloads

439

Readme

Dialog

O módulo Dialog é composto por 3 componentes: Dialog, ConfirmationDialog e PromisedDialog. Cada um deles cria um modal próprio de tela cheia com suas especificações. O PromisedDialog é exibido durante a execução de uma Promise e após sua conclusão fecha o modal. Já o ConfirmationDialog exibe uma tela com dois botões que controlam o fluxo da aplicação. Para casos de apenas uma exibição de mensagem durante um período de tempo, o uso do Dialog é aconselhável.

<Dialog ...props />

| Propriedades | Descrição | Tipo | Padrão | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------- | | align | Alinhamento vertical do conteúdo (top, center) | string | center | | bgColor | Define a cor de fundo do modal | string | '#e3e3e3' | | textColor | Define a cor do texto do modal | boolean | '#4a4a4a' | | isOpen | Define se o modal vai estar aberto por padrão | boolean | 'false' | | title | Título do modal | string | undefined | | fullscreen | Define se o modal ocupará a tela inteira | boolean | false | | className | Classe a ser adicionado ao elemento pai do componente | string | `` | | freezeKeystrokes | Define se congela os eventos de <Keystroke /> do pai do componente. Pode ser um valor booleano, ou uma lista de teclas separa por vírgula | string | false |

<ConfirmationDialog ...props />

| Propriedades | Descrição | Tipo | Padrão | | ------------- | ----------------------------------------------------- | --------- | ------------- | | negativeLabel | Texto no Botão de Confirmação Negativa | string | 'Cancelar' | | positiveLabel | Texto no Botão de Confirmação Positiva | string | 'Confirmar' | | isOpen | Define se o modal vai estar aberto por padrão | boolean | 'false' | | title | Título do modal | string | undefined | | className | Classe a ser adicionado ao elemento pai do componente | string | `` |

<PromisedDialog ...props />

| Propriedades | Descrição | Tipo | Padrão | | ------------ | ----------------------------------------------------- | --------- | ----------- | | delay | Tempo de espera depois de executar a Promise | string | 'right' | | promise | A Promise a ser executada | boolean | false | | isOpen | Define se o modal vai estar aberto por padrão | boolean | 'false' | | title | Título do modal | string | undefined | | className | Classe a ser adicionado ao elemento pai do componente | string | `` |

<Popup ...props />

| Propriedades | Descrição | Tipo | Padrão | | ------------ | ---------------------------------------------- | --------- | --------- | | isOpen | Define se o pop-up vai estar aberto por padrão | boolean | 'false' |

Eventos

<Dialog ... on:event="..." />

| Eventos | Disparado quando ... | Tipo | | ------- | --------------------- | ------------ | | open | O diálogo for exibido | function() | | close | O diálogo fechar | function() |

Exemplos:

Chama myMethod() quando o diálogo for exibido.

<dialog on:open="myMethod()" />

Chama o console.log quando o diálogo fechar.

<dialog on:close="console.log('Dialog fechou')" />

<PromisedDialog ... on:event="..." />

| Eventos | Descrição | Tipo | | ------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | success | Especifique uma função que será chamada quando a Promise do diálogo for de sucesso(.then). Recebe o valor da Promise.resolve | function(event) | | failure | Especifique uma função que será chamada quando a Promise do diálogo for de falha(.catch). Recebe o valor da Promise.reject | function(event) |

Exemplos:

Chama console.log quando a Promise for de sucesso.

<PromisedDialog on:success="console.log('promise success', event)" />

Chama o método promiseFailed quando o Promise falhar.

<PromisedDialog on:failure="promiseFailed(event)" />

... methods: { promiseFailed(event) { console.log(event) }, } ...

<ConfirmationDialog ... on:event="..." />

| Eventos | Descrição | Tipo | | -------- | ---------------------------------------------------------------------------------------------------------------- | ------------ | | negative | Especifique uma função que será chamada quando o diálogo receber a ação negativa ou do botão vermelho do teclado | function() | | positive | Especifique uma função que será chamada quando o diálogo receber a ação positiva ou do botão verde do teclado | function() |

Exemplos:

Chama myMethod() quando o diálogo receber ação positiva.

<ConfirmationDialog on:positive="myMethod()" />

Chama o console.log quando o diálogo receber ação negativa.

<ConfirmationDialog on:negative="console.log('on:negative')" />

<Popup ... on:event="..." />

| Eventos | Disparado quando ... | Tipo | | ------- | -------------------- | ------------ | | open | O pop-up for exibido | function() | | close | O pop-up fechar | function() |

Exemplos:

Chama myMethod() quando o diálogo for exibido.

<Popup on:open="myMethod()" />

Chama o console.log quando o diálogo fechar.

<Popup on:close="console.log('Dialog fechou')" />

Métodos

Dialog.open(duration)

Abre o Dialog e o mantém aberto pelo tempo (duration em milissegundos) especificado.

Dialog.close(delay)

Fecha o Dialog após o tempo (delay em milissegundos) especificado.

ConfirmationDialog.open(duration)

Abre o ConfirmationDialog e o mantém aberto pelo tempo (duration em milissegundos) especificado.

ConfirmationDialog.close()

Fecha o ConfirmationDialog.

Popup.open()

Abre o Popup.

Popup.close()

Fecha o Popup.

Slots

<Dialog ... />

| Slot | Descrição | | ----- | ------------------------------------------------------------------------------------------- | | extra | O slot extra pode ser usado para adicionar conteúdo adicional após a mensagem do diálogo. |

Exemplo:

<dialog>
  Minha mensagem
  <div slot="extra">Conteúdo extra</div>
</dialog>

<ConfirmationDialog ... />

| Slot | Descrição | | ------ | ---------------------------------------------------------------------------------------------- | | footer | O slot footer pode ser usado para adicionar conteúdo no final do diálogo, ou terceiro botão. |

Exemplo:

<ConfirmationDialog>
  <div slot="footer">Conteúdo final</div>
</ConfirmationDialog>

<Popup ... />

| Slot | Descrição | | ---- | --------------------------------------------------------------- | | Html | O slot pode ser usado para adicionar conteúdo dentro do pop-up. |

Exemplo:

<Popup>
  <h1>Component Pop-up<h1>
  <p>Texto de descrição</p>
</Popup>