@po-ui/ng-components 6.7.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17034,10 +17034,18 @@ var PoKeyCodeEnum;
17034
17034
  * O componente `po-checkbox` exibe uma caixa de opção com um texto ao lado, na qual é possível marcar e desmarcar através tanto
17035
17035
  * no *click* do *mouse* quanto por meio da tecla *space* quando estiver com foco.
17036
17036
  *
17037
- * Cada opção poderá receber um estado de marcado, desmarcado, indeterminado e desabilitado, como também uma ação que será disparada quando
17037
+ * Cada opção poderá receber um estado de marcado, desmarcado, indeterminado/mixed e desabilitado, como também uma ação que será disparada quando
17038
17038
  * ocorrer mudanças do valor.
17039
17039
  *
17040
- * > O *model* deste componente aceitará valores igual à `true`, `false` ou `null` para quando for indeterminado.
17040
+ * > O *model* deste componente aceitará valores igual à `true`, `false` ou `null` para quando for indeterminado/mixed.
17041
+ *
17042
+ * **Acessibilidade tratada no componente:**
17043
+ *
17044
+ * Algumas diretrizes de acessibilidade já são tratadas no componente, internamente, e não podem ser alteradas pelo proprietário do conteúdo. São elas:
17045
+ *
17046
+ * - O componente foi desenvolvido utilizando controles padrões HTML para permitir a identificação do mesmo na interface por tecnologias assistivas. [WCAG 4.1.2: Name, Role, Value](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value)
17047
+ * - A área do foco precisar ter uma espessura de pelo menos 2 pixels CSS e o foco não pode ficar escondido por outros elementos da tela. [WCAG 2.4.12: Focus Appearance](https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance-enhanced)
17048
+ * - A cor não deve ser o único meio para diferenciar o componente do seu estado marcado e desmarcado. [WGAG 1.4.1: Use of Color, 3.2.4: Consistent Identification](https://www.w3.org/WAI/WCAG21/Understanding/use-of-color)
17041
17049
  */
17042
17050
  class PoCheckboxBaseComponent {
17043
17051
  constructor() {
@@ -17087,7 +17095,7 @@ class PoCheckboxBaseComponent {
17087
17095
  }
17088
17096
  checkOption(value) {
17089
17097
  if (!this.disabled) {
17090
- this.changeModelValue(!value);
17098
+ value === 'mixed' ? this.changeModelValue(true) : this.changeModelValue(!value);
17091
17099
  this.changeValue();
17092
17100
  }
17093
17101
  }
@@ -17197,7 +17205,12 @@ class PoCheckboxComponent extends PoCheckboxBaseComponent {
17197
17205
  }
17198
17206
  }
17199
17207
  changeModelValue(value) {
17200
- this.checkboxValue = typeof value === 'boolean' || value === null ? value : false;
17208
+ if (value === null) {
17209
+ this.checkboxValue = 'mixed';
17210
+ }
17211
+ else {
17212
+ this.checkboxValue = typeof value === 'boolean' || value === null ? value : false;
17213
+ }
17201
17214
  this.changeDetector.detectChanges();
17202
17215
  }
17203
17216
  }
@@ -17213,20 +17226,20 @@ PoCheckboxComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PoCheck
17213
17226
  useExisting: forwardRef(() => PoCheckboxComponent),
17214
17227
  multi: true
17215
17228
  }
17216
- ]), i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 13, consts: [[1, "po-checkbox"], ["type", "checkbox", 1, "po-input", "po-checkbox-input", 3, "checked", "disabled", "id", "value"], [1, "po-checkbox-label", 3, "for", "tabindex", "blur", "click", "keydown"], ["checkboxLabel", ""]], template: function PoCheckboxComponent_Template(rf, ctx) { if (rf & 1) {
17229
+ ]), i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 8, consts: [[1, "container-po-checkbox", 3, "click", "keydown"], ["role", "checkbox", 1, "po-checkbox", 3, "id", "tabindex"], ["tabindex", "-1", 1, "po-checkbox-label", 3, "for"], ["checkboxLabel", ""]], template: function PoCheckboxComponent_Template(rf, ctx) { if (rf & 1) {
17217
17230
  i0.ɵɵelementStart(0, "div", 0);
17218
- i0.ɵɵelement(1, "input", 1);
17231
+ i0.ɵɵlistener("click", function PoCheckboxComponent_Template_div_click_0_listener() { return ctx.checkOption(ctx.checkboxValue); })("keydown", function PoCheckboxComponent_Template_div_keydown_0_listener($event) { return ctx.onKeyDown($event, ctx.checkboxValue); });
17232
+ i0.ɵɵelement(1, "span", 1);
17219
17233
  i0.ɵɵelementStart(2, "label", 2, 3);
17220
- i0.ɵɵlistener("blur", function PoCheckboxComponent_Template_label_blur_2_listener() { return ctx.onBlur(); })("click", function PoCheckboxComponent_Template_label_click_2_listener() { return ctx.checkOption(ctx.checkboxValue); })("keydown", function PoCheckboxComponent_Template_label_keydown_2_listener($event) { return ctx.onKeyDown($event, ctx.checkboxValue); });
17221
17234
  i0.ɵɵtext(4);
17222
17235
  i0.ɵɵelementEnd()();
17223
17236
  } if (rf & 2) {
17237
+ i0.ɵɵattribute("checked", ctx.checkboxValue);
17224
17238
  i0.ɵɵadvance(1);
17225
- i0.ɵɵclassProp("po-checkbox-input-checked", ctx.checkboxValue)("po-checkbox-input-indeterminate", ctx.checkboxValue === null);
17226
- i0.ɵɵproperty("checked", ctx.checkboxValue)("disabled", ctx.disabled)("id", ctx.id)("value", ctx.checkboxValue);
17239
+ i0.ɵɵproperty("id", ctx.id)("tabindex", ctx.disabled ? -1 : 0);
17240
+ i0.ɵɵattribute("aria-checked", ctx.checkboxValue)("aria-label", ctx.label)("aria-disabled", ctx.disabled);
17227
17241
  i0.ɵɵadvance(1);
17228
- i0.ɵɵclassProp("po-clickable", !ctx.disabled);
17229
- i0.ɵɵproperty("for", ctx.id)("tabindex", ctx.disabled ? -1 : 0);
17242
+ i0.ɵɵproperty("for", ctx.id);
17230
17243
  i0.ɵɵadvance(2);
17231
17244
  i0.ɵɵtextInterpolate1(" ", ctx.label, " ");
17232
17245
  } }, encapsulation: 2, changeDetection: 0 });
@@ -17238,7 +17251,7 @@ PoCheckboxComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PoCheck
17238
17251
  useExisting: forwardRef(() => PoCheckboxComponent),
17239
17252
  multi: true
17240
17253
  }
17241
- ], template: "<div class=\"po-checkbox\">\n <input\n class=\"po-input po-checkbox-input\"\n type=\"checkbox\"\n [class.po-checkbox-input-checked]=\"checkboxValue\"\n [class.po-checkbox-input-indeterminate]=\"checkboxValue === null\"\n [checked]=\"checkboxValue\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n [value]=\"checkboxValue\"\n />\n\n <label\n #checkboxLabel\n class=\"po-checkbox-label\"\n [class.po-clickable]=\"!disabled\"\n [for]=\"id\"\n [tabindex]=\"disabled ? -1 : 0\"\n (blur)=\"onBlur()\"\n (click)=\"checkOption(checkboxValue)\"\n (keydown)=\"onKeyDown($event, checkboxValue)\"\n >\n {{ label }}\n </label>\n</div>\n" }]
17254
+ ], template: "<div\n class=\"container-po-checkbox\"\n [attr.checked]=\"checkboxValue\"\n (click)=\"checkOption(checkboxValue)\"\n (keydown)=\"onKeyDown($event, checkboxValue)\"\n>\n <span\n [attr.aria-checked]=\"checkboxValue\"\n [attr.aria-label]=\"label\"\n [id]=\"id\"\n class=\"po-checkbox\"\n role=\"checkbox\"\n [attr.aria-disabled]=\"disabled\"\n [tabindex]=\"disabled ? -1 : 0\"\n >\n </span>\n\n <label #checkboxLabel [for]=\"id\" class=\"po-checkbox-label\" tabindex=\"-1\">\n {{ label }}\n </label>\n</div>\n" }]
17242
17255
  }], function () { return [{ type: i0.ChangeDetectorRef }]; }, { checkboxLabel: [{
17243
17256
  type: ViewChild,
17244
17257
  args: ['checkboxLabel', { static: true }]