@ifsworld/granite-components 3.0.0-beta.3 → 3.0.0-beta.4

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.
@@ -2917,6 +2917,110 @@
2917
2917
  },] }
2918
2918
  ];
2919
2919
 
2920
+ var GraniteCheckboxComponent = /** @class */ (function () {
2921
+ function GraniteCheckboxComponent(_focusMonitor) {
2922
+ this._focusMonitor = _focusMonitor;
2923
+ this.id = null;
2924
+ this.checked = false;
2925
+ this.disabled = false;
2926
+ this.readonly = false;
2927
+ this.labelPosition = 'after';
2928
+ this.ariaLabel = null;
2929
+ this.ariaLabelledby = null;
2930
+ this.valueChange = new core.EventEmitter();
2931
+ this.checkboxChange = new core.EventEmitter();
2932
+ // eslint-disable-next-line @angular-eslint/no-output-native
2933
+ this.blur = new core.EventEmitter();
2934
+ this._positionBefore = false;
2935
+ this._checkboxDisabled = false;
2936
+ this._unchecked = false;
2937
+ }
2938
+ GraniteCheckboxComponent.prototype.ngOnChanges = function (changes) {
2939
+ if (changes.checked) {
2940
+ this.checked = coercion.coerceBooleanProperty(changes.checked.currentValue);
2941
+ }
2942
+ if (changes.disabled) {
2943
+ this.disabled = coercion.coerceBooleanProperty(changes.disabled.currentValue);
2944
+ }
2945
+ if (changes.readonly) {
2946
+ this.readonly = coercion.coerceBooleanProperty(changes.readonly.currentValue);
2947
+ }
2948
+ if (changes.labelPosition != null) {
2949
+ this._positionBefore =
2950
+ changes.labelPosition.currentValue != null &&
2951
+ changes.labelPosition.currentValue === 'before';
2952
+ }
2953
+ if ((changes.disabled || changes.readonly) &&
2954
+ (this.disabled || this.readonly)) {
2955
+ this._checkboxDisabled = true;
2956
+ }
2957
+ };
2958
+ GraniteCheckboxComponent.prototype.focus = function (origin, options) {
2959
+ if (origin === void 0) { origin = 'program'; }
2960
+ this._focusMonitor.focusVia(this._getInputElement(), origin, options);
2961
+ };
2962
+ GraniteCheckboxComponent.prototype._onBlur = function () {
2963
+ this.blur.emit();
2964
+ };
2965
+ GraniteCheckboxComponent.prototype._checkboxChange = function () {
2966
+ this._unchecked = this.checked ? true : false;
2967
+ this.checked = this._getInputElement().checked;
2968
+ this.valueChange.emit(this.checked);
2969
+ };
2970
+ GraniteCheckboxComponent.prototype._checkboxClick = function () {
2971
+ this.checkboxChange.emit();
2972
+ };
2973
+ GraniteCheckboxComponent.prototype._getInputElement = function () {
2974
+ return this._inputElement.nativeElement;
2975
+ };
2976
+ return GraniteCheckboxComponent;
2977
+ }());
2978
+ GraniteCheckboxComponent.decorators = [
2979
+ { type: core.Component, args: [{
2980
+ selector: 'granite-checkbox',
2981
+ exportAs: 'graniteCheckbox',
2982
+ host: {
2983
+ class: 'granite-checkbox',
2984
+ '[class.granite-checkbox-checked]': 'checked',
2985
+ '[class.granite-checkbox-disabled]': 'disabled',
2986
+ '[class.granite-checkbox-readonly]': 'readonly',
2987
+ '[class.granite-checkbox-label-before]': '_positionBefore',
2988
+ '[class.granite-checkbox-unchecked]': '_unchecked',
2989
+ },
2990
+ 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=\"switch\"\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",
2991
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2992
+ 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-box:hover{border-color:var(--granite-color-background-active)}:host(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-box:hover{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(.granite-checkbox-unchecked) .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-tiny);padding-inline-end:var(--granite-spacing-tiny)}.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-small);height:var(--granite-spacing-small);border:solid var(--granite-color-background-inactive);border-width:calc(var(--granite-spacing-micro) / 4);border-radius:var(--granite-spacing-micro);display:flex;justify-content:center;position:relative}.granite-checkbox-box:focus-within{border:calc(var(--granite-spacing-micro) / 4) solid var(--granite-color-focus)}.granite-checkbox-check{position:relative;display:none;width:calc(var(--granite-spacing-tiny) + (var(--granite-spacing-micro) / 4));height:calc(var(--granite-spacing-micro) + (var(--granite-spacing-micro) / 4));background-color:transparent;border:solid var(--granite-color-text-static-light);transform:rotate(-45deg);margin-top:var(--granite-spacing-micro);border-left-width:calc(var(--granite-spacing-micro) / 2);border-bottom-width:calc(var(--granite-spacing-micro) / 2);border-right-width:0;border-top-width:0}.granite-checkbox-text{-webkit-padding-start:var(--granite-spacing-tiny);padding-inline-start:var(--granite-spacing-tiny)}.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}}"]
2993
+ },] }
2994
+ ];
2995
+ GraniteCheckboxComponent.ctorParameters = function () { return [
2996
+ { type: a11y.FocusMonitor }
2997
+ ]; };
2998
+ GraniteCheckboxComponent.propDecorators = {
2999
+ id: [{ type: core.Input }],
3000
+ checked: [{ type: core.Input }],
3001
+ disabled: [{ type: core.Input }],
3002
+ readonly: [{ type: core.Input }],
3003
+ labelPosition: [{ type: core.Input }],
3004
+ ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
3005
+ ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
3006
+ valueChange: [{ type: core.Output }],
3007
+ checkboxChange: [{ type: core.Output }],
3008
+ blur: [{ type: core.Output }],
3009
+ _inputElement: [{ type: core.ViewChild, args: ['input',] }]
3010
+ };
3011
+
3012
+ var GraniteCheckboxModule = /** @class */ (function () {
3013
+ function GraniteCheckboxModule() {
3014
+ }
3015
+ return GraniteCheckboxModule;
3016
+ }());
3017
+ GraniteCheckboxModule.decorators = [
3018
+ { type: core.NgModule, args: [{
3019
+ declarations: [GraniteCheckboxComponent],
3020
+ exports: [GraniteCheckboxComponent],
3021
+ },] }
3022
+ ];
3023
+
2920
3024
  var ɵ0 = deviceDesktop.output;
2921
3025
  /**
2922
3026
  * Directive used to tell components and their sub components that client output
@@ -3051,6 +3155,8 @@
3051
3155
  exports.GraniteBadgeModule = GraniteBadgeModule;
3052
3156
  exports.GraniteButtonComponent = GraniteButtonComponent;
3053
3157
  exports.GraniteButtonModule = GraniteButtonModule;
3158
+ exports.GraniteCheckboxComponent = GraniteCheckboxComponent;
3159
+ exports.GraniteCheckboxModule = GraniteCheckboxModule;
3054
3160
  exports.GraniteCoreModule = GraniteCoreModule;
3055
3161
  exports.GraniteDividerDirective = GraniteDividerDirective;
3056
3162
  exports.GraniteGridComponent = GraniteGridComponent;