@ifsworld/granite-components 3.4.0 → 3.5.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.
@@ -2779,6 +2779,106 @@
2779
2779
  },] }
2780
2780
  ];
2781
2781
 
2782
+ var GraniteCheckboxComponent = /** @class */ (function () {
2783
+ function GraniteCheckboxComponent(_focusMonitor) {
2784
+ this._focusMonitor = _focusMonitor;
2785
+ this.id = null;
2786
+ this.checked = false;
2787
+ this.disabled = false;
2788
+ this.readonly = false;
2789
+ this.labelPosition = 'after';
2790
+ this.ariaLabel = null;
2791
+ this.ariaLabelledby = null;
2792
+ this.valueChange = new core.EventEmitter();
2793
+ this.checkboxChange = new core.EventEmitter();
2794
+ this.checkboxBlur = new core.EventEmitter();
2795
+ this._positionBefore = false;
2796
+ this._checkboxDisabled = false;
2797
+ }
2798
+ GraniteCheckboxComponent.prototype.ngOnChanges = function (changes) {
2799
+ if (changes.checked) {
2800
+ this.checked = coercion.coerceBooleanProperty(changes.checked.currentValue);
2801
+ }
2802
+ if (changes.disabled) {
2803
+ this.disabled = coercion.coerceBooleanProperty(changes.disabled.currentValue);
2804
+ }
2805
+ if (changes.readonly) {
2806
+ this.readonly = coercion.coerceBooleanProperty(changes.readonly.currentValue);
2807
+ }
2808
+ if (changes.labelPosition != null) {
2809
+ this._positionBefore =
2810
+ changes.labelPosition.currentValue != null &&
2811
+ changes.labelPosition.currentValue === 'before';
2812
+ }
2813
+ if ((changes.disabled || changes.readonly) &&
2814
+ (this.disabled || this.readonly)) {
2815
+ this._checkboxDisabled = true;
2816
+ }
2817
+ };
2818
+ GraniteCheckboxComponent.prototype.focus = function (origin, options) {
2819
+ if (origin === void 0) { origin = 'program'; }
2820
+ this._focusMonitor.focusVia(this._getInputElement(), origin, options);
2821
+ };
2822
+ GraniteCheckboxComponent.prototype._onBlur = function () {
2823
+ this.checkboxBlur.emit();
2824
+ };
2825
+ GraniteCheckboxComponent.prototype._checkboxChange = function () {
2826
+ this.checked = this._getInputElement().checked;
2827
+ this.valueChange.emit(this.checked);
2828
+ };
2829
+ GraniteCheckboxComponent.prototype._checkboxClick = function () {
2830
+ this.checkboxChange.emit();
2831
+ };
2832
+ GraniteCheckboxComponent.prototype._getInputElement = function () {
2833
+ return this._inputElement.nativeElement;
2834
+ };
2835
+ return GraniteCheckboxComponent;
2836
+ }());
2837
+ GraniteCheckboxComponent.decorators = [
2838
+ { type: core.Component, args: [{
2839
+ selector: 'granite-checkbox',
2840
+ exportAs: 'graniteCheckbox',
2841
+ host: {
2842
+ class: 'granite-checkbox',
2843
+ '[class.granite-checkbox-checked]': 'checked',
2844
+ '[class.granite-checkbox-disabled]': 'disabled',
2845
+ '[class.granite-checkbox-readonly]': 'readonly',
2846
+ '[class.granite-checkbox-label-before]': '_positionBefore',
2847
+ },
2848
+ template: "<label [attr.for]=\"id\" class=\"granite-checkbox-label\">\n <div class=\"granite-checkbox-box\">\n <input\n #input\n [id]=\"id\"\n class=\"granite-checkbox-input cdk-visually-hidden\"\n role=\"checkbox\"\n type=\"checkbox\"\n [attr.aria-checked]=\"checked.toString()\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [checked]=\"checked\"\n [disabled]=\"_checkboxDisabled\"\n [readonly]=\"readonly\"\n (click)=\"_checkboxClick()\"\n (change)=\"_checkboxChange()\"\n (blur)=\"_onBlur()\"\n />\n <div class=\"granite-checkbox-check\"></div>\n </div>\n <span class=\"granite-checkbox-text\"><ng-content></ng-content></span>\n</label>\n",
2849
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2850
+ styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none}:host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit;cursor:pointer}:host(.granite-checkbox){color:var(--granite-color-text)}:host(.granite-checkbox):not(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-label:hover .granite-checkbox-box{border-color:var(--granite-color-background-active)}:host(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-label:hover .granite-checkbox-box{background-color:var(--granite-color-background-active-hover);border-color:var(--granite-color-background-active-hover)}:host(.granite-checkbox-checked) .granite-checkbox-box{border-color:var(--granite-color-background-active);background-color:var(--granite-color-background-active)}:host(.granite-checkbox-checked) .granite-checkbox-box:focus-within{border-color:var(--granite-color-focus)}:host(.granite-checkbox-checked) .granite-checkbox-check{display:flex}:host(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-box{-webkit-animation:fadeInAnimation .2s;animation:fadeInAnimation .2s;-webkit-animation-iteration-count:1;animation-iteration-count:1}:host(:not(.granite-checkbox-checked)) .granite-checkbox-box{-webkit-animation:fadeOutAnimation .2s;animation:fadeOutAnimation .2s;-webkit-animation-iteration-count:1;animation-iteration-count:1}:host(.granite-checkbox-readonly.granite-checkbox-checked) .granite-checkbox-box{background-color:var(--granite-color-text);border-color:var(--granite-color-text)}:host(.granite-checkbox-readonly.granite-checkbox-checked) .granite-checkbox-box .granite-checkbox-check{border-color:var(--granite-color-background)}:host(.granite-checkbox-disabled) .granite-checkbox-box{opacity:.3;background-color:var(--granite-color-border-soft)}:host(.granite-checkbox-disabled) .granite-checkbox-label{opacity:.6}:host(.granite-checkbox-disabled) *,:host(.granite-checkbox-readonly) *{cursor:default}:host(.granite-checkbox-label-before) .granite-checkbox-label{flex-direction:row-reverse}:host(.granite-checkbox-label-before) .granite-checkbox-text{-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:var(--granite-spacing-s);padding-inline-end:var(--granite-spacing-s)}.granite-checkbox-label{display:flex;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content}.granite-checkbox-box{width:var(--granite-spacing-m);height:var(--granite-spacing-m);border:solid var(--granite-color-background-inactive);border-width:calc(var(--granite-spacing-xs) / 4);border-radius:var(--granite-spacing-xs);display:flex;justify-content:center;position:relative}.granite-checkbox-box:focus-within{border:calc(var(--granite-spacing-xs) / 4) solid var(--granite-color-focus)}.granite-checkbox-check{position:relative;display:none;width:calc(var(--granite-spacing-s) + (var(--granite-spacing-xs) / 4));height:calc(var(--granite-spacing-xs) + (var(--granite-spacing-xs) / 4));background-color:transparent;border:solid var(--granite-color-text-static-light);transform:rotate(-45deg);margin-top:var(--granite-spacing-xs);border-left-width:calc(var(--granite-spacing-xs) / 2);border-bottom-width:calc(var(--granite-spacing-xs) / 2);border-right-width:0;border-top-width:0}.granite-checkbox-text{-webkit-padding-start:var(--granite-spacing-s);padding-inline-start:var(--granite-spacing-s)}.granite-checkbox-text:empty{display:none}@-webkit-keyframes fadeInAnimation{0%{opacity:0}to{opacity:1}}@keyframes fadeInAnimation{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeOutAnimation{0%{opacity:1}to{opacity:0}}@keyframes fadeOutAnimation{0%{opacity:1}to{opacity:0}}"]
2851
+ },] }
2852
+ ];
2853
+ GraniteCheckboxComponent.ctorParameters = function () { return [
2854
+ { type: a11y.FocusMonitor }
2855
+ ]; };
2856
+ GraniteCheckboxComponent.propDecorators = {
2857
+ id: [{ type: core.Input }],
2858
+ checked: [{ type: core.Input }],
2859
+ disabled: [{ type: core.Input }],
2860
+ readonly: [{ type: core.Input }],
2861
+ labelPosition: [{ type: core.Input }],
2862
+ ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
2863
+ ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
2864
+ valueChange: [{ type: core.Output }],
2865
+ checkboxChange: [{ type: core.Output }],
2866
+ checkboxBlur: [{ type: core.Output }],
2867
+ _inputElement: [{ type: core.ViewChild, args: ['input',] }]
2868
+ };
2869
+
2870
+ var GraniteCheckboxModule = /** @class */ (function () {
2871
+ function GraniteCheckboxModule() {
2872
+ }
2873
+ return GraniteCheckboxModule;
2874
+ }());
2875
+ GraniteCheckboxModule.decorators = [
2876
+ { type: core.NgModule, args: [{
2877
+ declarations: [GraniteCheckboxComponent],
2878
+ exports: [GraniteCheckboxComponent],
2879
+ },] }
2880
+ ];
2881
+
2782
2882
  var disabledMixin = function (Base) {
2783
2883
  if (Base === void 0) { Base = /** @class */ (function () {
2784
2884
  function class_1() {
@@ -3368,6 +3468,8 @@
3368
3468
  exports.GraniteBadgeModule = GraniteBadgeModule;
3369
3469
  exports.GraniteButtonComponent = GraniteButtonComponent;
3370
3470
  exports.GraniteButtonModule = GraniteButtonModule;
3471
+ exports.GraniteCheckboxComponent = GraniteCheckboxComponent;
3472
+ exports.GraniteCheckboxModule = GraniteCheckboxModule;
3371
3473
  exports.GraniteCoreModule = GraniteCoreModule;
3372
3474
  exports.GraniteDividerDirective = GraniteDividerDirective;
3373
3475
  exports.GraniteGridComponent = GraniteGridComponent;