@ifsworld/granite-components 3.2.0 → 3.3.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.
- package/bundles/ifsworld-granite-components.umd.js +158 -0
- package/bundles/ifsworld-granite-components.umd.js.map +1 -1
- package/bundles/ifsworld-granite-components.umd.min.js +3 -3
- package/bundles/ifsworld-granite-components.umd.min.js.map +1 -1
- package/esm2015/index.js +2 -0
- package/esm2015/index.js.map +1 -1
- package/esm2015/index.metadata.json +1 -1
- package/esm2015/lib/input-field/input-field.component.js +144 -0
- package/esm2015/lib/input-field/input-field.component.js.map +1 -0
- package/esm2015/lib/input-field/input-field.component.metadata.json +1 -0
- package/esm2015/lib/input-field/input-field.module.js +15 -0
- package/esm2015/lib/input-field/input-field.module.js.map +1 -0
- package/esm2015/lib/input-field/input-field.module.metadata.json +1 -0
- package/fesm2015/ifsworld-granite-components.js +152 -1
- package/fesm2015/ifsworld-granite-components.js.map +1 -1
- package/ifsworld-granite-components.metadata.json +1 -1
- package/index.d.ts +2 -0
- package/lib/input-field/input-field.component.d.ts +39 -0
- package/lib/input-field/input-field.module.d.ts +2 -0
- package/package.json +1 -1
|
@@ -3077,6 +3077,162 @@
|
|
|
3077
3077
|
},] }
|
|
3078
3078
|
];
|
|
3079
3079
|
|
|
3080
|
+
var GRANITE_INPUT_INCLUDES = ['text', 'number', 'password', 'textarea'];
|
|
3081
|
+
var GraniteInputFieldComponent = /** @class */ (function () {
|
|
3082
|
+
function GraniteInputFieldComponent(_focusMonitor) {
|
|
3083
|
+
this._focusMonitor = _focusMonitor;
|
|
3084
|
+
this.id = null;
|
|
3085
|
+
this.name = null;
|
|
3086
|
+
this.type = 'text';
|
|
3087
|
+
this.value = '';
|
|
3088
|
+
this.required = false;
|
|
3089
|
+
this.readonly = false;
|
|
3090
|
+
this.invalid = false;
|
|
3091
|
+
this.disabled = false;
|
|
3092
|
+
this.placeholder = '';
|
|
3093
|
+
this.maxlength = 255;
|
|
3094
|
+
this.countcharacters = false;
|
|
3095
|
+
this.ariaLabel = null;
|
|
3096
|
+
this.ariaLabelledby = null;
|
|
3097
|
+
this.valueChange = new core.EventEmitter();
|
|
3098
|
+
this._supported = true;
|
|
3099
|
+
this._empty = false;
|
|
3100
|
+
this._passwordFieldIcon = 'view';
|
|
3101
|
+
this._passwordField = false;
|
|
3102
|
+
this._passwordToggled = false;
|
|
3103
|
+
this._currentCharCount = 0;
|
|
3104
|
+
}
|
|
3105
|
+
GraniteInputFieldComponent.prototype.ngOnInit = function () {
|
|
3106
|
+
this._validateType();
|
|
3107
|
+
this._passwordField = this.type == 'password';
|
|
3108
|
+
this._empty = this.value == null || this.value === '';
|
|
3109
|
+
};
|
|
3110
|
+
GraniteInputFieldComponent.prototype.ngOnChanges = function (changes) {
|
|
3111
|
+
if (changes.required) {
|
|
3112
|
+
this.required = coercion.coerceBooleanProperty(changes.required.currentValue);
|
|
3113
|
+
}
|
|
3114
|
+
if (changes.readonly) {
|
|
3115
|
+
this.readonly = coercion.coerceBooleanProperty(changes.readonly.currentValue);
|
|
3116
|
+
}
|
|
3117
|
+
if (changes.invalid) {
|
|
3118
|
+
this.invalid = coercion.coerceBooleanProperty(changes.invalid.currentValue);
|
|
3119
|
+
}
|
|
3120
|
+
if (changes.disabled) {
|
|
3121
|
+
this.disabled = coercion.coerceBooleanProperty(changes.disabled.currentValue);
|
|
3122
|
+
}
|
|
3123
|
+
if (changes.countcharacters) {
|
|
3124
|
+
this.countcharacters = coercion.coerceBooleanProperty(changes.countcharacters.currentValue);
|
|
3125
|
+
}
|
|
3126
|
+
if (changes.value) {
|
|
3127
|
+
this._empty = this.value == null || this.value === '';
|
|
3128
|
+
}
|
|
3129
|
+
if (changes.type) {
|
|
3130
|
+
this._validateType();
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
GraniteInputFieldComponent.prototype.focus = function (origin, options) {
|
|
3134
|
+
if (origin === void 0) { origin = 'program'; }
|
|
3135
|
+
if (this.type === 'text') {
|
|
3136
|
+
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
3137
|
+
}
|
|
3138
|
+
else if (this.type === 'textarea') {
|
|
3139
|
+
this._focusMonitor.focusVia(this._getTextareaElement(), origin, options);
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
GraniteInputFieldComponent.prototype._togglePassword = function () {
|
|
3143
|
+
if (this._passwordToggled) {
|
|
3144
|
+
this._passwordToggled = false;
|
|
3145
|
+
this.type = 'password';
|
|
3146
|
+
this._passwordFieldIcon = 'view';
|
|
3147
|
+
}
|
|
3148
|
+
else {
|
|
3149
|
+
this._passwordToggled = true;
|
|
3150
|
+
this.type = 'text';
|
|
3151
|
+
this._passwordFieldIcon = 'view-disabled';
|
|
3152
|
+
}
|
|
3153
|
+
};
|
|
3154
|
+
GraniteInputFieldComponent.prototype._onKeyUp = function (event) {
|
|
3155
|
+
var inputEvent = event.target;
|
|
3156
|
+
this._applyCharacterCount(inputEvent.value);
|
|
3157
|
+
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
3158
|
+
this.valueChange.emit(inputEvent.value);
|
|
3159
|
+
};
|
|
3160
|
+
GraniteInputFieldComponent.prototype._onInput = function (event) {
|
|
3161
|
+
var inputEvent = event.target;
|
|
3162
|
+
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
3163
|
+
this.valueChange.emit(inputEvent.value);
|
|
3164
|
+
};
|
|
3165
|
+
GraniteInputFieldComponent.prototype._validateType = function () {
|
|
3166
|
+
if (GRANITE_INPUT_INCLUDES.indexOf(this.type) < 0) {
|
|
3167
|
+
this._supported = false;
|
|
3168
|
+
throw Error("Input type \"" + this.type + "\" isn't supported by graniteInputField.");
|
|
3169
|
+
}
|
|
3170
|
+
};
|
|
3171
|
+
GraniteInputFieldComponent.prototype._applyCharacterCount = function (inputString) {
|
|
3172
|
+
if (this.countcharacters) {
|
|
3173
|
+
this._currentCharCount = inputString.length;
|
|
3174
|
+
if (this._currentCharCount > this.maxlength) {
|
|
3175
|
+
inputString = inputString.slice(0, this.maxlength);
|
|
3176
|
+
this._currentCharCount = this.maxlength;
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
GraniteInputFieldComponent.prototype._getInputElement = function () {
|
|
3181
|
+
return this._inputElement.nativeElement;
|
|
3182
|
+
};
|
|
3183
|
+
GraniteInputFieldComponent.prototype._getTextareaElement = function () {
|
|
3184
|
+
return this._textareaElement.nativeElement;
|
|
3185
|
+
};
|
|
3186
|
+
return GraniteInputFieldComponent;
|
|
3187
|
+
}());
|
|
3188
|
+
GraniteInputFieldComponent.decorators = [
|
|
3189
|
+
{ type: core.Component, args: [{
|
|
3190
|
+
selector: 'granite-input-field',
|
|
3191
|
+
exportAs: 'graniteInputField',
|
|
3192
|
+
template: "<div\n *ngIf=\"_supported\"\n class=\"granite-input-container\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n>\n <div\n class=\"granite-input-top-row\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n >\n <div\n *ngIf=\"prefixicon\"\n class=\"granite-input-prepend\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n >\n <granite-icon class=\"granite-input-prepend-icon\">\n {{ prefixicon }}\n </granite-icon>\n </div>\n\n <ng-container\n *ngIf=\"type != 'textarea'; then inputElement; else textareaElement\"\n ></ng-container>\n\n <ng-template #inputElement>\n <input\n #input\n [id]=\"id\"\n class=\"granite-input-base\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n [name]=\"name\"\n [attr.type]=\"type\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [attr.maxlength]=\"maxlength\"\n [value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-invalid]=\"invalid\"\n (keyup)=\"_onKeyUp($event)\"\n (input)=\"_onInput($event)\"\n />\n </ng-template>\n\n <button\n *ngIf=\"_passwordField\"\n class=\"granite-input-append\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n (click)=\"_togglePassword()\"\n >\n <granite-icon class=\"granite-input-password-toggle-icon\">\n {{ _passwordFieldIcon }}\n </granite-icon>\n </button>\n\n <ng-template #textareaElement>\n <textarea\n #textarea\n [id]=\"id\"\n class=\"granite-input-base granite-text-area\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n rows=\"1\"\n [name]=\"name\"\n [attr.type]=\"type\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [attr.maxlength]=\"maxlength\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"invalid\"\n (keyup)=\"_onKeyUp($event)\"\n (input)=\"_onInput($event)\"\n ></textarea>\n </ng-template>\n\n <div\n class=\"granite-input-hover-bar\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n ></div>\n </div>\n\n <div *ngIf=\"countcharacters\" class=\"granite-input-bottom-row\">\n <div class=\"granite-input-char-count\">\n {{ _currentCharCount }}/{{ maxlength }}\n </div>\n </div>\n</div>\n",
|
|
3193
|
+
host: {
|
|
3194
|
+
class: 'granite-input-field',
|
|
3195
|
+
},
|
|
3196
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
3197
|
+
styles: [":host{transition:all .2s ease-out;width:calc(var(--granite-spacing-3-xl) * 3.625);height:var(--granite-spacing-xl);box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit}.granite-input-container{height:inherit;width:inherit;font-size:var(--granite-font-size-body-small)}.granite-input-container .granite-input-top-row{display:inline-flex;width:inherit;height:inherit;position:relative;background:var(--granite-color-background)}.granite-input-container .granite-input-top-row:hover .granite-input-hover-bar{height:calc(var(--granite-spacing-xs)/2)}.granite-input-container .granite-input-top-row:hover .granite-input-hover-bar.granite-input-invalid.granite-input-empty{background-color:var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-text-area{min-width:calc(var(--granite-spacing-3-xl) * 3.625);min-height:var(--granite-spacing-xl)}.granite-input-container .granite-input-top-row.granite-input-disabled,.granite-input-container .granite-input-top-row.granite-input-readonly{background-color:transparent;box-shadow:none}.granite-input-container .granite-input-top-row.granite-input-disabled .granite-input-hover-bar,.granite-input-container .granite-input-top-row.granite-input-readonly .granite-input-hover-bar{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);padding:var(--granite-spacing-s);width:inherit;height:inherit;color:var(--granite-color-text);font:inherit;font-weight:var(--granite-font-weight-regular);line-height:100%}.granite-input-container .granite-input-top-row .granite-input-base:required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-top-row .granite-input-base:required::-moz-placeholder{color:var(--granite-color-text-weak)}.granite-input-container .granite-input-top-row .granite-input-base:required:-ms-input-placeholder{color:var(--granite-color-text-weak)}.granite-input-container .granite-input-top-row .granite-input-base:required::placeholder{color:var(--granite-color-text-weak)}.granite-input-container .granite-input-top-row .granite-input-base:-moz-read-only{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:read-only{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:disabled{opacity:.3}.granite-input-container .granite-input-top-row .granite-input-base::-moz-placeholder{color:var(--granite-color-text-hint)}.granite-input-container .granite-input-top-row .granite-input-base:-ms-input-placeholder{color:var(--granite-color-text-hint)}.granite-input-container .granite-input-top-row .granite-input-base::placeholder{color:var(--granite-color-text-hint)}.granite-input-container .granite-input-top-row .granite-input-base:hover::-moz-placeholder{color:var(--granite-color-text)}.granite-input-container .granite-input-top-row .granite-input-base:hover:-ms-input-placeholder{color:var(--granite-color-text)}.granite-input-container .granite-input-top-row .granite-input-base:hover::placeholder{color:var(--granite-color-text)}.granite-input-container .granite-input-top-row .granite-input-base:focus{box-shadow:inset 0 calc(var(--granite-spacing-xs)/2) var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2) 0 var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2 * -1) 0 var(--granite-color-focus),inset 0 calc(var(--granite-spacing-xs)/2 * -1) var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-input-base:focus.granite-input-invalid{box-shadow:inset 0 calc(var(--granite-spacing-xs)/2 * -1) var(--granite-color-signal-failure),inset 0 calc(var(--granite-spacing-xs)/2) var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2) 0 var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2 * -1) 0 var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-input-base:focus::-moz-placeholder{color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:focus:-ms-input-placeholder{color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:focus::placeholder{color:transparent}.granite-input-container .granite-input-top-row .granite-input-hover-bar{height:calc(var(--granite-spacing-xs)/4);background-color:var(--granite-color-border-hard);position:absolute;width:inherit;bottom:0}.granite-input-container .granite-input-top-row .granite-input-hover-bar.granite-input-invalid{background-color:var(--granite-color-signal-failure)}.granite-input-container .granite-input-top-row:focus-within .granite-input-hover-bar{background-color:transparent}.granite-input-container .granite-input-prepend{display:flex;align-items:center;padding:0 var(--granite-spacing-s);background:var(--granite-color-background-input)}.granite-input-container .granite-input-prepend .granite-input-prepend-icon{width:var(--granite-spacing-m);height:var(--granite-spacing-m);color:var(--granite-color-text);box-shadow:none}.granite-input-container .granite-input-prepend.granite-input-required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-append{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);position:relative}.granite-input-container .granite-input-append:focus{box-shadow:inset 0 calc(var(--granite-spacing-xs)/2) var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2) 0 var(--granite-color-focus),inset calc(var(--granite-spacing-xs)/2 * -1) 0 var(--granite-color-focus),inset 0 calc(var(--granite-spacing-xs)/2 * -1) var(--granite-color-focus)}.granite-input-container .granite-input-append .granite-input-password-toggle-icon{width:-webkit-max-content;width:-moz-max-content;width:max-content;height:-webkit-max-content;height:-moz-max-content;height:max-content;color:var(--granite-color-text);box-shadow:none}.granite-input-container .granite-input-append.granite-input-required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-bottom-row{box-shadow:none}.granite-input-container .granite-input-char-count{background:var(--granite-color-background-warning);border-radius:0 0 var(--granite-spacing-xs) var(--granite-spacing-xs);padding:var(--granite-spacing-s);background-size:contain;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;box-shadow:none}.granite-input-container.granite-input-disabled,.granite-input-container.granite-input-readonly{background-color:transparent}"]
|
|
3198
|
+
},] }
|
|
3199
|
+
];
|
|
3200
|
+
GraniteInputFieldComponent.ctorParameters = function () { return [
|
|
3201
|
+
{ type: a11y.FocusMonitor }
|
|
3202
|
+
]; };
|
|
3203
|
+
GraniteInputFieldComponent.propDecorators = {
|
|
3204
|
+
id: [{ type: core.Input }],
|
|
3205
|
+
name: [{ type: core.Input }],
|
|
3206
|
+
type: [{ type: core.Input }],
|
|
3207
|
+
value: [{ type: core.Input }],
|
|
3208
|
+
required: [{ type: core.Input }],
|
|
3209
|
+
readonly: [{ type: core.Input }],
|
|
3210
|
+
invalid: [{ type: core.Input }],
|
|
3211
|
+
disabled: [{ type: core.Input }],
|
|
3212
|
+
placeholder: [{ type: core.Input }],
|
|
3213
|
+
prefixicon: [{ type: core.Input }],
|
|
3214
|
+
maxlength: [{ type: core.Input }],
|
|
3215
|
+
countcharacters: [{ type: core.Input }],
|
|
3216
|
+
ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
|
|
3217
|
+
ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
|
|
3218
|
+
valueChange: [{ type: core.Output }],
|
|
3219
|
+
_inputElement: [{ type: core.ViewChild, args: ['input',] }],
|
|
3220
|
+
_textareaElement: [{ type: core.ViewChild, args: ['textarea',] }]
|
|
3221
|
+
};
|
|
3222
|
+
|
|
3223
|
+
var GraniteInputFieldModule = /** @class */ (function () {
|
|
3224
|
+
function GraniteInputFieldModule() {
|
|
3225
|
+
}
|
|
3226
|
+
return GraniteInputFieldModule;
|
|
3227
|
+
}());
|
|
3228
|
+
GraniteInputFieldModule.decorators = [
|
|
3229
|
+
{ type: core.NgModule, args: [{
|
|
3230
|
+
imports: [common.CommonModule, GraniteIconModule, GraniteButtonModule],
|
|
3231
|
+
declarations: [GraniteInputFieldComponent],
|
|
3232
|
+
exports: [GraniteInputFieldComponent],
|
|
3233
|
+
},] }
|
|
3234
|
+
];
|
|
3235
|
+
|
|
3080
3236
|
var ɵ0 = deviceDesktop.output;
|
|
3081
3237
|
/**
|
|
3082
3238
|
* Directive used to tell components and their sub components that client output
|
|
@@ -3218,6 +3374,8 @@
|
|
|
3218
3374
|
exports.GraniteGridModule = GraniteGridModule;
|
|
3219
3375
|
exports.GraniteIconComponent = GraniteIconComponent;
|
|
3220
3376
|
exports.GraniteIconModule = GraniteIconModule;
|
|
3377
|
+
exports.GraniteInputFieldComponent = GraniteInputFieldComponent;
|
|
3378
|
+
exports.GraniteInputFieldModule = GraniteInputFieldModule;
|
|
3221
3379
|
exports.GraniteMenuComponent = GraniteMenuComponent;
|
|
3222
3380
|
exports.GraniteMenuHarness = GraniteMenuHarness;
|
|
3223
3381
|
exports.GraniteMenuItemComponent = GraniteMenuItemComponent;
|