@ifsworld/granite-components 3.0.0 → 3.1.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.
Files changed (27) hide show
  1. package/bundles/ifsworld-granite-components.umd.js +126 -4
  2. package/bundles/ifsworld-granite-components.umd.js.map +1 -1
  3. package/bundles/ifsworld-granite-components.umd.min.js +3 -3
  4. package/bundles/ifsworld-granite-components.umd.min.js.map +1 -1
  5. package/esm2015/index.js +2 -0
  6. package/esm2015/index.js.map +1 -1
  7. package/esm2015/index.metadata.json +1 -1
  8. package/esm2015/lib/core/types.js +2 -0
  9. package/esm2015/lib/core/types.js.map +1 -0
  10. package/esm2015/lib/core/types.metadata.json +1 -0
  11. package/esm2015/lib/radio-button/radio-button.component.js +109 -0
  12. package/esm2015/lib/radio-button/radio-button.component.js.map +1 -0
  13. package/esm2015/lib/radio-button/radio-button.component.metadata.json +1 -0
  14. package/esm2015/lib/radio-button/radio-button.module.js +11 -0
  15. package/esm2015/lib/radio-button/radio-button.module.js.map +1 -0
  16. package/esm2015/lib/radio-button/radio-button.module.metadata.json +1 -0
  17. package/esm2015/lib/toggle-switch/toggle-switch.component.js.map +1 -1
  18. package/esm2015/lib/toggle-switch/toggle-switch.component.metadata.json +1 -1
  19. package/fesm2015/ifsworld-granite-components.js +116 -1
  20. package/fesm2015/ifsworld-granite-components.js.map +1 -1
  21. package/ifsworld-granite-components.metadata.json +1 -1
  22. package/index.d.ts +2 -0
  23. package/lib/core/types.d.ts +1 -0
  24. package/lib/radio-button/radio-button.component.d.ts +32 -0
  25. package/lib/radio-button/radio-button.module.d.ts +2 -0
  26. package/lib/toggle-switch/toggle-switch.component.d.ts +1 -1
  27. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/testing'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/cdk/a11y'), require('@angular/cdk/keycodes'), require('@angular/animations'), require('@angular/cdk/bidi'), require('@angular/cdk/platform')) :
3
- typeof define === 'function' && define.amd ? define('@ifsworld/granite-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/cdk/testing', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/cdk/a11y', '@angular/cdk/keycodes', '@angular/animations', '@angular/cdk/bidi', '@angular/cdk/platform'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ifsworld = global.ifsworld || {}, global.ifsworld['granite-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.cdk.testing, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.cdk.a11y, global.ng.cdk.keycodes, global.ng.animations, global.ng.cdk.bidi, global.ng.cdk.platform));
5
- }(this, (function (exports, core, common, coercion, rxjs, operators, testing, overlay, portal, a11y, keycodes, animations, bidi, platform) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/testing'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/cdk/a11y'), require('@angular/cdk/keycodes'), require('@angular/animations'), require('@angular/cdk/bidi'), require('@angular/cdk/platform'), require('@angular/cdk/collections')) :
3
+ typeof define === 'function' && define.amd ? define('@ifsworld/granite-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/cdk/testing', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/cdk/a11y', '@angular/cdk/keycodes', '@angular/animations', '@angular/cdk/bidi', '@angular/cdk/platform', '@angular/cdk/collections'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ifsworld = global.ifsworld || {}, global.ifsworld['granite-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.cdk.testing, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.cdk.a11y, global.ng.cdk.keycodes, global.ng.animations, global.ng.cdk.bidi, global.ng.cdk.platform, global.ng.cdk.collections));
5
+ }(this, (function (exports, core, common, coercion, rxjs, operators, testing, overlay, portal, a11y, keycodes, animations, bidi, platform, collections) { 'use strict';
6
6
 
7
7
  var GraniteArrangeGridItemComponent = /** @class */ (function () {
8
8
  function GraniteArrangeGridItemComponent(element) {
@@ -2659,6 +2659,126 @@
2659
2659
  },] }
2660
2660
  ];
2661
2661
 
2662
+ var GraniteRadioButtonComponent = /** @class */ (function () {
2663
+ function GraniteRadioButtonComponent(_focusMonitor, _radioDispatcher) {
2664
+ var _this = this;
2665
+ this._focusMonitor = _focusMonitor;
2666
+ this._radioDispatcher = _radioDispatcher;
2667
+ this.id = null;
2668
+ this.checked = false;
2669
+ this.required = false;
2670
+ this.disabled = false;
2671
+ this.readonly = false;
2672
+ this.labelPosition = 'after';
2673
+ this.ariaLabel = null;
2674
+ this.ariaLabelledby = null;
2675
+ this.radioChange = new core.EventEmitter();
2676
+ this.radioBlur = new core.EventEmitter();
2677
+ this._positionBefore = false;
2678
+ this._radioDisabled = false;
2679
+ this._removeUniqueSelectionListener = function () {
2680
+ // Function used to deregister listener
2681
+ };
2682
+ this._removeUniqueSelectionListener = _radioDispatcher.listen(function (id, name) {
2683
+ if (id !== _this.id && name === _this.name) {
2684
+ _this.checked = false;
2685
+ }
2686
+ });
2687
+ }
2688
+ GraniteRadioButtonComponent.prototype.ngOnChanges = function (changes) {
2689
+ if (changes.checked) {
2690
+ this.checked = coercion.coerceBooleanProperty(changes.checked.currentValue);
2691
+ }
2692
+ if (changes.required) {
2693
+ this.required = coercion.coerceBooleanProperty(changes.required.currentValue);
2694
+ }
2695
+ if (changes.readonly) {
2696
+ this.readonly = coercion.coerceBooleanProperty(changes.readonly.currentValue);
2697
+ }
2698
+ if (changes.disabled) {
2699
+ this.disabled = coercion.coerceBooleanProperty(changes.disabled.currentValue);
2700
+ }
2701
+ if (changes.labelPosition != null) {
2702
+ this._positionBefore =
2703
+ changes.labelPosition.currentValue != null &&
2704
+ changes.labelPosition.currentValue === 'before';
2705
+ }
2706
+ if ((changes.disabled || changes.readonly) &&
2707
+ (this.disabled || this.readonly)) {
2708
+ this._radioDisabled = true;
2709
+ }
2710
+ };
2711
+ GraniteRadioButtonComponent.prototype.ngOnDestroy = function () {
2712
+ this._removeUniqueSelectionListener();
2713
+ };
2714
+ // Focuses the radio button.
2715
+ GraniteRadioButtonComponent.prototype.focus = function (origin, options) {
2716
+ if (origin === void 0) { origin = 'program'; }
2717
+ this._focusMonitor.focusVia(this._getInputElement(), origin, options);
2718
+ };
2719
+ GraniteRadioButtonComponent.prototype._radioClick = function (targetValue) {
2720
+ this.radioChange.emit(targetValue);
2721
+ };
2722
+ GraniteRadioButtonComponent.prototype._radioChange = function () {
2723
+ this.checked = this._getInputElement().checked;
2724
+ // Notify all radio buttons with the same name to un-check
2725
+ this._radioDispatcher.notify(this.id, this.name);
2726
+ };
2727
+ GraniteRadioButtonComponent.prototype._onBlur = function () {
2728
+ this.radioBlur.emit();
2729
+ };
2730
+ GraniteRadioButtonComponent.prototype._getInputElement = function () {
2731
+ return this._inputElement.nativeElement;
2732
+ };
2733
+ return GraniteRadioButtonComponent;
2734
+ }());
2735
+ GraniteRadioButtonComponent.decorators = [
2736
+ { type: core.Component, args: [{
2737
+ selector: 'granite-radio-button',
2738
+ exportAs: 'graniteRadioButton',
2739
+ host: {
2740
+ class: 'granite-radio-button',
2741
+ '[class.granite-radio-button-disabled]': 'disabled',
2742
+ '[class.granite-radio-button-label-before]': '_positionBefore',
2743
+ '[class.granite-radio-button-checked]': 'checked',
2744
+ '[class.granite-radio-button-readonly]': 'readonly',
2745
+ },
2746
+ template: "<label class=\"granite-radio-button-label\">\n <div class=\"granite-radio-button-outer-circle\">\n <input\n #input\n [id]=\"id\"\n class=\"granite-radio-button-input cdk-visually-hidden\"\n type=\"radio\"\n [attr.name]=\"name\"\n [disabled]=\"_radioDisabled\"\n [checked]=\"checked\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-checked]=\"checked.toString()\"\n [value]=\"value\"\n (click)=\"_radioClick($event.target.value)\"\n (change)=\"_radioChange()\"\n (blur)=\"_onBlur()\"\n />\n <div class=\"granite-radio-button-inner-circle\"></div>\n </div>\n <span class=\"granite-radio-button-text\">\n <ng-content></ng-content>\n </span>\n</label>\n",
2747
+ 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(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover{cursor:pointer}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover .granite-radio-button-outer-circle{border-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover .granite-radio-button-inner-circle{background-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle:focus-within{border:1px solid var(--granite-color-focus)}:host(.granite-radio-button-label-before) .granite-radio-button-label{flex-direction:row-reverse}:host(.granite-radio-button-label-before) .granite-radio-button-text{-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:var(--granite-spacing-s);padding-inline-end:var(--granite-spacing-s)}:host(.granite-radio-button-checked) .granite-radio-button-inner-circle{visibility:visible;-webkit-animation:growAnimation .1s;animation:growAnimation .1s}:host(.granite-radio-button-checked) .granite-radio-button-outer-circle{border-color:var(--granite-color-background-active)}:host(.granite-radio-button-checked).granite-radio-button-disabled .granite-radio-button-inner-circle{background-color:var(--granite-color-text)}:host(.granite-radio-button-checked).granite-radio-button-disabled .granite-radio-button-outer-circle{border:1px solid var(--granite-color-text);background-color:transparent}:host(.granite-radio-button-checked).granite-radio-button-readonly .granite-radio-button-inner-circle{background-color:var(--granite-color-text)}:host(.granite-radio-button-checked).granite-radio-button-readonly .granite-radio-button-outer-circle{border:1px solid var(--granite-color-text)}.granite-radio-button-text{-webkit-padding-start:var(--granite-spacing-s);padding-inline-start:var(--granite-spacing-s);color:var(--granite-color-text)}.granite-radio-button-text:empty{display:none}.granite-radio-button-label{display:flex;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-margin-end:var(--granite-spacing-xl);margin-inline-end:var(--granite-spacing-xl)}:host(.granite-radio-button-disabled) .granite-radio-button-text{opacity:.6}:host(.granite-radio-button-disabled) .granite-radio-button-outer-circle{opacity:.3;background-color:var(--granite-color-border-soft)}.granite-radio-button-outer-circle{height:var(--granite-spacing-m);width:var(--granite-spacing-m);border-radius:50%;box-sizing:border-box;border:1px solid var(--granite-color-border-hard);display:flex;justify-content:center;position:relative;align-items:center}.granite-radio-button-inner-circle{width:calc(var(--granite-spacing-s) * 1.25);height:calc(var(--granite-spacing-s) * 1.25);visibility:hidden;position:absolute;border-radius:50%;background-color:var(--granite-color-background-active);margin:auto}@-webkit-keyframes growAnimation{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes growAnimation{0%{transform:scale(0)}to{transform:scale(1)}}"]
2748
+ },] }
2749
+ ];
2750
+ GraniteRadioButtonComponent.ctorParameters = function () { return [
2751
+ { type: a11y.FocusMonitor },
2752
+ { type: collections.UniqueSelectionDispatcher }
2753
+ ]; };
2754
+ GraniteRadioButtonComponent.propDecorators = {
2755
+ value: [{ type: core.Input }],
2756
+ id: [{ type: core.Input }],
2757
+ name: [{ type: core.Input }],
2758
+ checked: [{ type: core.Input }],
2759
+ required: [{ type: core.Input }],
2760
+ disabled: [{ type: core.Input }],
2761
+ readonly: [{ type: core.Input }],
2762
+ labelPosition: [{ type: core.Input }],
2763
+ ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
2764
+ ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
2765
+ radioChange: [{ type: core.Output }],
2766
+ radioBlur: [{ type: core.Output }],
2767
+ _inputElement: [{ type: core.ViewChild, args: ['input',] }]
2768
+ };
2769
+
2770
+ var GraniteRadioButtonModule = /** @class */ (function () {
2771
+ function GraniteRadioButtonModule() {
2772
+ }
2773
+ return GraniteRadioButtonModule;
2774
+ }());
2775
+ GraniteRadioButtonModule.decorators = [
2776
+ { type: core.NgModule, args: [{
2777
+ declarations: [GraniteRadioButtonComponent],
2778
+ exports: [GraniteRadioButtonComponent],
2779
+ },] }
2780
+ ];
2781
+
2662
2782
  var disabledMixin = function (Base) {
2663
2783
  if (Base === void 0) { Base = /** @class */ (function () {
2664
2784
  function class_1() {
@@ -2954,6 +3074,8 @@
2954
3074
  exports.GraniteMenuTouchCloseComponent = GraniteMenuTouchCloseComponent;
2955
3075
  exports.GraniteMenuTouchTitleItemComponent = GraniteMenuTouchTitleItemComponent;
2956
3076
  exports.GraniteMenuTriggerForDirective = GraniteMenuTriggerForDirective;
3077
+ exports.GraniteRadioButtonComponent = GraniteRadioButtonComponent;
3078
+ exports.GraniteRadioButtonModule = GraniteRadioButtonModule;
2957
3079
  exports.GraniteToggleSwitchComponent = GraniteToggleSwitchComponent;
2958
3080
  exports.GraniteToggleSwitchModule = GraniteToggleSwitchModule;
2959
3081
  exports._MenuBaseComponent = _MenuBaseComponent;