Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ export class PoButtonBaseComponent {
* @description
* Ícone exibido ao lado esquerdo do label do botão.
*
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons). conforme exemplo abaixo:
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons), conforme exemplo:
* ```
* <po-button p-icon="an an-user" p-label="PO button"></po-button>
* ```
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, da seguinte forma:
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, desde que a biblioteca
* esteja carregada no projeto:
* ```
* <po-button p-icon="fa fa-podcast" p-label="PO button"></po-button>
* ```
Expand Down
9 changes: 6 additions & 3 deletions projects/ui/src/lib/components/po-icon/po-icon-dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export const AnimaliaIconDictionary: { [key: string]: string } = {
ICON_ALIGN_JUSTIFY: 'an an-text-align-justify',
ICON_ALIGN_LEFT: 'an an-text-align-left',
ICON_ALIGN_RIGHT: 'an an-text-align-right',
ICON_ARROW_ARC_LEFT: 'an an-arrow-arc-left',
ICON_ARROW_DOWN: 'an an-caret-down',
ICON_ARROW_LEFT: 'an an-caret-left',
ICON_ARROW_RIGHT: 'an an-caret-right',
Expand Down Expand Up @@ -223,14 +224,16 @@ export const AnimaliaIconDictionary: { [key: string]: string } = {
ICON_PARAMETERS: 'an an-sliders-horizontal',
ICON_PICTURE: 'an an-image',
ICON_PICTURE_BROKEN: 'an an-image-broken',
ICON_PLUS: 'an an-plus',
ICON_PROHIBIT: 'an an-prohibit',
ICON_PUSH_PIN: 'an an-push-pin',
ICON_PUSH_PIN_SLASH: 'an an-push-pin-slash',
ICON_REFRESH: 'an an-arrow-clockwise',
ICON_SEARCH: 'an an-magnifying-glass',
ICON_SETTINGS: 'an an-gear-six',
ICON_SORT: 'an an-caret-up-down ',
ICON_SORT_ASC: 'an an-caret-up',
ICON_SORT_DESC: 'an an-caret-down',
ICON_SORT: 'an an-arrows-down-up',
ICON_SORT_ASC: 'an an-arrow-up',
ICON_SORT_DESC: 'an an-arrow-down',
ICON_STAR: 'an an-star',
ICON_TELEPHONE: 'an an-phone',
ICON_TEXT_BOLD: 'an an-text-b',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TemplateRef } from '@angular/core';

/**
* @usedBy PoModalComponent
*
Expand All @@ -19,6 +21,50 @@ export interface PoModalAction {
/** Desabilita o botão impossibilitando que sua ação seja executada. */
disabled?: boolean;

/**
* Ícone exibido ao lado esquerdo do label do botão.
*
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons), conforme exemplo:
* ```
* modalAction: PoModalAction = {
* action: () => {},
* label: 'Botão com ícone PO',
* icon: 'an an-user'
* };
* ```
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, desde que a biblioteca
* esteja carregada no projeto:
* ```
* modalAction: PoModalAction = {
* action: () => {},
* label: 'Botão com ícone Font Awesome',
* icon: 'fa fa-user'
* };
* ```
* Outra opção seria a customização do ícone através do `TemplateRef`, conforme exemplo abaixo:
* ```
* // Template HTML
* <ng-template #customIcon>
* <span class="fa fa-user"></span>
* </ng-template>
*
* // Componente TypeScript
* @ViewChild('customIcon', { static: true }) customIcon: TemplateRef<void>;
*
* modalAction: PoModalAction = {
* action: () => {},
* label: 'Botão com ícone customizado',
* };
*
* // Atribuição do TemplateRef à propriedade icon após a inicialização da view
* ngAfterViewInit() {
* this.modalAction.icon = this.customIcon;
* }
* ```
* > Para o ícone enquadrar corretamente, deve-se utilizar `font-size: inherit` caso o ícone utilizado não aplique-o.
*/
icon?: string | TemplateRef<void>;

/** Rótulo do botão. */
label: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<po-button
[p-danger]="getSecondaryActionButtonDanger()"
[p-disabled]="secondaryAction.disabled"
[p-icon]="secondaryAction.icon"
[p-label]="secondaryAction.label"
[p-loading]="secondaryAction.loading"
p-kind="secondary"
Expand All @@ -48,6 +49,7 @@
class="po-button-modal-first-action"
[p-danger]="primaryAction.danger"
[p-disabled]="primaryAction.disabled"
[p-icon]="primaryAction.icon"
[p-label]="primaryAction.label"
[p-loading]="primaryAction.loading"
p-kind="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[p-options]="iconOptions"
></po-select>

<po-input class="po-md-6" name="Content" [(ngModel)]="content" p-clean p-label="Content" p-maxlength="200">
<po-input class="po-md-12 po-lg-6" name="Content" [(ngModel)]="content" p-clean p-label="Content" p-maxlength="200">
</po-input>

<po-input
Expand All @@ -36,12 +36,22 @@
[(ngModel)]="primaryActionLabel"
p-clean
p-label="Primary action label"
p-maxlength="30"
p-maxlength="50"
>
</po-input>

<po-input
class="po-md-6 po-lg-3"
name="primaryActionIcon"
[(ngModel)]="primaryActionIcon"
p-clean
p-label="Primary action icon"
p-maxlength="50"
>
</po-input>

<po-checkbox-group
class="po-md-12 po-lg-9"
class="po-md-12 po-lg-6"
name="primaryActionProperties"
[(ngModel)]="primaryActionProperties"
p-columns="3"
Expand All @@ -56,12 +66,22 @@
[(ngModel)]="secondaryActionLabel"
p-clean
p-label="Secondary action label"
p-maxlength="100"
p-maxlength="50"
>
</po-input>

<po-input
class="po-md-6 po-lg-3"
name="secondaryActionIcon"
[(ngModel)]="secondaryActionIcon"
p-clean
p-label="Secondary action icon"
p-maxlength="50"
>
</po-input>

<po-checkbox-group
class="po-md-12 po-lg-9"
class="po-md-12 po-lg-6"
name="secondaryActionProperties"
[(ngModel)]="secondaryActionProperties"
p-columns="3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class SamplePoModalLabsComponent implements OnInit {
};

primaryActionLabel: string;
primaryActionIcon: string;
primaryActionProperties: Array<string>;
primaryActionOptions: Array<PoCheckboxGroupOption> = [
{ value: 'danger', label: 'Danger' },
Expand All @@ -56,11 +57,12 @@ export class SamplePoModalLabsComponent implements OnInit {
};

secondaryActionLabel: string;
secondaryActionIcon: string;
secondaryActionProperties: Array<string>;
secondaryActionOptions: Array<PoCheckboxGroupOption> = [
{ value: 'danger', label: 'Danger' },
{ value: 'disabled', label: 'Disabled' },
{ value: 'loading', label: 'Loading' },
{ value: 'danger', label: 'Danger' }
{ value: 'loading', label: 'Loading' }
];

propertiesOptions: Array<PoCheckboxGroupOption> = [
Expand All @@ -81,11 +83,13 @@ export class SamplePoModalLabsComponent implements OnInit {
openModal() {
this.primaryAction.disabled = this.primaryActionProperties.includes('disabled');
this.primaryAction.label = this.primaryActionLabel;
this.primaryAction.icon = this.primaryActionIcon;
this.primaryAction.loading = this.primaryActionProperties.includes('loading');
this.primaryAction.danger = this.primaryActionProperties.includes('danger');

this.secondaryAction.disabled = this.secondaryActionProperties.includes('disabled');
this.secondaryAction.label = this.secondaryActionLabel;
this.secondaryAction.icon = this.secondaryActionIcon;
this.secondaryAction.loading = this.secondaryActionProperties.includes('loading');
this.secondaryAction.danger = this.secondaryActionProperties.includes('danger');

Expand All @@ -102,8 +106,10 @@ export class SamplePoModalLabsComponent implements OnInit {
this.title = 'PO Modal';
this.properties = [];
this.primaryActionLabel = undefined;
this.primaryActionIcon = undefined;
this.primaryActionProperties = [];
this.secondaryActionLabel = undefined;
this.secondaryActionIcon = undefined;
this.secondaryActionProperties = [];
this.componentsSize = 'medium';
this.icon = undefined;
Expand Down