cps-ui-kit 21.22.0 → 21.23.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.
@@ -11694,6 +11694,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
11694
11694
  type: Output
11695
11695
  }] } });
11696
11696
 
11697
+ const RESIZE_STEP_REM = 1.5;
11697
11698
  /**
11698
11699
  * CpsTextareaComponent is a textarea component.
11699
11700
  * @group Components
@@ -11713,6 +11714,15 @@ class CpsTextareaComponent {
11713
11714
  get value() {
11714
11715
  return this._value;
11715
11716
  }
11717
+ get describedBy() {
11718
+ if (this.hideDetails)
11719
+ return null;
11720
+ if (this.error)
11721
+ return this.errorId;
11722
+ if (this.hint)
11723
+ return this.hintId;
11724
+ return null;
11725
+ }
11716
11726
  constructor(_control, _elementRef) {
11717
11727
  this._control = _control;
11718
11728
  this._elementRef = _elementRef;
@@ -11721,6 +11731,11 @@ class CpsTextareaComponent {
11721
11731
  * @group Props
11722
11732
  */
11723
11733
  this.label = '';
11734
+ /**
11735
+ * Aria label for the textarea component, used for accessibility, it takes precedence over label.
11736
+ * @group Props
11737
+ */
11738
+ this.ariaLabel = '';
11724
11739
  /**
11725
11740
  * Placeholder text for the textarea.
11726
11741
  * @group Props
@@ -11741,6 +11756,16 @@ class CpsTextareaComponent {
11741
11756
  * @group Props
11742
11757
  */
11743
11758
  this.autofocus = false;
11759
+ /**
11760
+ * Determines whether the value of the textarea may be checked for spelling errors.
11761
+ * @group Props
11762
+ */
11763
+ this.spellcheck = false;
11764
+ /**
11765
+ * Determines whether the value of the textarea can be automatically completed by the browser.
11766
+ * @group Props
11767
+ */
11768
+ this.autocomplete = 'off';
11744
11769
  /**
11745
11770
  * Bottom hint text for the textarea.
11746
11771
  * @group Props
@@ -11751,6 +11776,11 @@ class CpsTextareaComponent {
11751
11776
  * @group Props
11752
11777
  */
11753
11778
  this.disabled = false;
11779
+ /**
11780
+ * Determines whether the textarea is readonly.
11781
+ * @group Props
11782
+ */
11783
+ this.readonly = false;
11754
11784
  /**
11755
11785
  * Width of the textarea, it can be of type number denoting pixels or string.
11756
11786
  * @group Props
@@ -11781,6 +11811,12 @@ class CpsTextareaComponent {
11781
11811
  * @group Props
11782
11812
  */
11783
11813
  this.resizable = 'vertical';
11814
+ /**
11815
+ * Maximum height of the textarea during resize, of type number denoting pixels or string.
11816
+ * Accepts only units of px, rem and em. When resizable is set to 'none', this prop has no effect.
11817
+ * @group Props
11818
+ */
11819
+ this.maxHeight = Infinity;
11784
11820
  /**
11785
11821
  * When it is not an empty string, an info icon is displayed to show text for more info.
11786
11822
  * @group Props
@@ -11831,7 +11867,16 @@ class CpsTextareaComponent {
11831
11867
  */
11832
11868
  this.blurred = new EventEmitter();
11833
11869
  this._value = '';
11870
+ this.hintId = generateUniqueId('cps-textarea-hint');
11871
+ this.errorId = generateUniqueId('cps-textarea-error');
11834
11872
  this.cvtWidth = '';
11873
+ this.maxHeightPx = null;
11874
+ this.isKeyboardFocused = false;
11875
+ this._singleRowHeightPx = 0;
11876
+ this._mouseActivated = false;
11877
+ this._cpsRootFontSizeService = inject(CPS_ROOT_FONT_SIZE_SERVICE);
11878
+ this._platformId = inject(PLATFORM_ID);
11879
+ this._resizeStepPx = computed(() => RESIZE_STEP_REM * (this._cpsRootFontSizeService?.fontSize() || 16), ...(ngDevMode ? [{ debugName: "_resizeStepPx" }] : /* istanbul ignore next */ []));
11835
11880
  // eslint-disable-next-line @typescript-eslint/no-empty-function
11836
11881
  this.onChange = (_event) => { };
11837
11882
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -11839,16 +11884,61 @@ class CpsTextareaComponent {
11839
11884
  if (this._control) {
11840
11885
  this._control.valueAccessor = this;
11841
11886
  }
11887
+ effect(() => this._updateMaxHeight());
11842
11888
  }
11843
11889
  ngOnInit() {
11844
11890
  this.cvtWidth = convertSize(this.width);
11845
11891
  this._statusChangesSubscription = this._control?.statusChanges?.subscribe(() => {
11846
11892
  this._checkErrors();
11847
11893
  });
11894
+ logMissingAriaLabelError('CpsTextareaComponent', this.label, this.ariaLabel);
11895
+ }
11896
+ ngOnChanges(changes) {
11897
+ if (changes.width) {
11898
+ this.cvtWidth = convertSize(this.width);
11899
+ }
11900
+ if (changes.maxHeight || changes.resizable) {
11901
+ this._updateMaxHeight();
11902
+ }
11903
+ logMissingAriaLabelError('CpsTextareaComponent', this.label, this.ariaLabel);
11904
+ }
11905
+ ngAfterViewInit() {
11906
+ if (this.resizable === 'vertical') {
11907
+ const textarea = this._textareaEl?.nativeElement;
11908
+ if (textarea) {
11909
+ this._singleRowHeightPx = textarea.offsetHeight / this.rows;
11910
+ }
11911
+ }
11848
11912
  }
11849
11913
  ngOnDestroy() {
11850
11914
  this._statusChangesSubscription?.unsubscribe();
11851
11915
  }
11916
+ _updateMaxHeight() {
11917
+ if (this.resizable !== 'vertical' || this.maxHeight === Infinity) {
11918
+ this.maxHeightPx = null;
11919
+ return;
11920
+ }
11921
+ const css = convertSize(this.maxHeight);
11922
+ const parsed = parseSize(css);
11923
+ if (!parsed)
11924
+ throw new Error(`Unsupported value for maxHeight.`);
11925
+ const rootFontSizePx = this._cpsRootFontSizeService?.fontSize() || 16;
11926
+ if (parsed.unit === 'px') {
11927
+ this.maxHeightPx = parsed.value;
11928
+ }
11929
+ else if (parsed.unit === 'rem') {
11930
+ this.maxHeightPx = parsed.value * rootFontSizePx;
11931
+ }
11932
+ else if (parsed.unit === 'em') {
11933
+ const emBase = isPlatformBrowser(this._platformId)
11934
+ ? parseFloat(getComputedStyle(this._elementRef.nativeElement).fontSize || '16')
11935
+ : rootFontSizePx;
11936
+ this.maxHeightPx = parsed.value * emBase;
11937
+ }
11938
+ else {
11939
+ throw new Error(`Unsupported unit "${parsed.unit}" for maxHeight.`);
11940
+ }
11941
+ }
11852
11942
  _checkErrors() {
11853
11943
  if (!this._control)
11854
11944
  return;
@@ -11883,6 +11973,9 @@ class CpsTextareaComponent {
11883
11973
  const message = errArr.find((msg) => typeof msg === 'string');
11884
11974
  this.error = message || 'Unknown error';
11885
11975
  }
11976
+ get isRequired() {
11977
+ return this._control?.control?.hasValidator(Validators.required) ?? false;
11978
+ }
11886
11979
  registerOnChange(fn) {
11887
11980
  this.onChange = fn;
11888
11981
  }
@@ -11905,31 +11998,68 @@ class CpsTextareaComponent {
11905
11998
  if (this.value !== '')
11906
11999
  this._updateValue('');
11907
12000
  }
12001
+ onClear(event) {
12002
+ event.preventDefault();
12003
+ event.stopPropagation();
12004
+ this.clear();
12005
+ this.focus();
12006
+ }
12007
+ get isClearButtonVisible() {
12008
+ return this.persistentClear || !!this.value;
12009
+ }
11908
12010
  // eslint-disable-next-line @typescript-eslint/no-empty-function
11909
12011
  setDisabledState(_disabled) { }
11910
12012
  onBlur() {
12013
+ this.isKeyboardFocused = false;
11911
12014
  this._checkErrors();
11912
12015
  this.blurred.emit();
11913
12016
  }
11914
12017
  onFocus() {
12018
+ this.isKeyboardFocused = !this._mouseActivated;
12019
+ this._mouseActivated = false;
11915
12020
  this._control?.control?.markAsTouched();
11916
12021
  this.focused.emit();
11917
12022
  }
12023
+ onTextareaMousedown() {
12024
+ this._mouseActivated = true;
12025
+ }
11918
12026
  focus() {
11919
- this._elementRef?.nativeElement?.querySelector('textarea')?.focus();
12027
+ this._textareaEl?.nativeElement?.focus();
12028
+ }
12029
+ onResizeHandleKeydown(event) {
12030
+ const textarea = this._textareaEl?.nativeElement;
12031
+ if (!textarea)
12032
+ return;
12033
+ const current = textarea.offsetHeight;
12034
+ let next = current;
12035
+ switch (event.key) {
12036
+ case 'ArrowUp':
12037
+ event.preventDefault();
12038
+ next = Math.max(current - this._resizeStepPx(), this._singleRowHeightPx);
12039
+ break;
12040
+ case 'ArrowDown':
12041
+ event.preventDefault();
12042
+ next = Math.min(current + this._resizeStepPx(), this.maxHeightPx ?? Infinity);
12043
+ break;
12044
+ default:
12045
+ return;
12046
+ }
12047
+ textarea.style.height = `${next}px`;
11920
12048
  }
11921
12049
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: CpsTextareaComponent, deps: [{ token: i1$2.NgControl, optional: true, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
11922
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: CpsTextareaComponent, isStandalone: true, selector: "cps-textarea", inputs: { label: "label", placeholder: "placeholder", rows: "rows", cols: "cols", autofocus: "autofocus", hint: "hint", disabled: "disabled", width: "width", clearable: "clearable", hideDetails: "hideDetails", persistentClear: "persistentClear", error: "error", resizable: "resizable", infoTooltip: "infoTooltip", infoTooltipClass: "infoTooltipClass", infoTooltipMaxWidth: "infoTooltipMaxWidth", infoTooltipPersistent: "infoTooltipPersistent", infoTooltipPosition: "infoTooltipPosition", value: "value" }, outputs: { valueChanged: "valueChanged", focused: "focused", prefixIconClicked: "prefixIconClicked", blurred: "blurred" }, ngImport: i0, template: "<div class=\"cps-textarea-container\" [ngStyle]=\"{ width: cvtWidth }\">\n @if (label) {\n <div\n class=\"cps-textarea-label\"\n [ngClass]=\"{ 'cps-textarea-label-disabled': disabled }\">\n <label>{{ label }}</label>\n @if (infoTooltip) {\n <cps-info-circle\n class=\"cps-textarea-label-info-circle\"\n size=\"xsmall\"\n [tooltipPosition]=\"infoTooltipPosition\"\n [tooltipContentClass]=\"infoTooltipClass\"\n [tooltipMaxWidth]=\"infoTooltipMaxWidth\"\n [tooltipPersistent]=\"infoTooltipPersistent\"\n [tooltipText]=\"infoTooltip\">\n </cps-info-circle>\n }\n </div>\n }\n\n <div\n class=\"cps-textarea-wrap\"\n [ngClass]=\"{\n 'cps-textarea-wrap-error': error,\n clearable: clearable,\n 'persistent-clear': persistentClear\n }\">\n <textarea\n spellcheck=\"false\"\n [cols]=\"cols\"\n [rows]=\"rows\"\n [autofocus]=\"autofocus\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [ngStyle]=\"{\n width: cvtWidth,\n resize: resizable\n }\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n (input)=\"updateValueEvent($event)\"></textarea>\n\n @if (clearable && !disabled) {\n <span\n [style.visibility]=\"\n persistentClear || (!persistentClear && value) ? 'visible' : 'hidden'\n \"\n class=\"clear-btn\">\n <cps-icon icon=\"delete\" size=\"small\" (click)=\"clear()\"></cps-icon>\n </span>\n }\n </div>\n @if (!error && !hideDetails) {\n <div class=\"cps-textarea-hint\">\n {{ hint }}\n </div>\n }\n @if (error && !hideDetails) {\n <div class=\"cps-textarea-error\">\n {{ error }}\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-textarea-container{width:100%;gap:.2rem!important;display:flex!important;flex-direction:column!important;font-family:Source Sans Pro,sans-serif}:host .cps-textarea-container .cps-textarea-wrap{position:relative;overflow:hidden}:host .cps-textarea-container .cps-textarea-wrap:hover textarea:enabled{border:1px solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap-error textarea{border-color:var(--cps-state-error)!important}:host .cps-textarea-container .cps-textarea-wrap-error textarea:not(:focus){background:#fef3f2!important}:host .cps-textarea-container .cps-textarea-wrap textarea{display:block;font-family:Source Sans Pro,sans-serif;font-size:1rem;color:var(--cps-color-text-dark);background:#fff;padding:.375rem .75rem;line-height:1.5;min-height:38px;border:1px solid var(--cps-color-line-light);transition-property:border-color;transition-duration:.2s;appearance:none;border-radius:4px;width:100%}:host .cps-textarea-container .cps-textarea-wrap textarea:focus{border:1px solid var(--cps-color-calm);outline:0}:host .cps-textarea-container .cps-textarea-wrap textarea:disabled{color:var(--cps-color-text-light);background-color:var(--cps-color-bg-disabled);opacity:1;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap textarea:focus+.clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap:hover .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap .clear-btn{position:absolute;top:.75rem;right:.75rem;cursor:pointer;color:var(--cps-state-error)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon{opacity:0;transition-duration:.2s}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon:hover{opacity:1!important}:host .cps-textarea-container .persistent-clear .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .clearable>textarea{padding-right:2.2rem}:host .cps-textarea-container .cps-textarea-hint{color:var(--cps-color-text-mild);font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-error{color:var(--cps-state-error);font-weight:700;font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-label{color:var(--cps-color-text-dark);font-size:.875rem;align-items:center;display:inline-flex;font-weight:600}:host .cps-textarea-container .cps-textarea-label .cps-textarea-label-info-circle{margin-left:8px}:host .cps-textarea-container .cps-textarea-label-disabled{color:var(--cps-color-text-mild)}:host .cps-textarea-container ::placeholder{font-family:Source Sans Pro,sans-serif;color:var(--cps-color-text-mild);font-style:italic;opacity:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CpsIconComponent, selector: "cps-icon", inputs: ["icon", "size", "color"] }, { kind: "component", type: CpsInfoCircleComponent, selector: "cps-info-circle", inputs: ["size", "tooltipText", "tooltipPosition", "tooltipContentClass", "tooltipMaxWidth", "tooltipPersistent"] }] }); }
12050
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: CpsTextareaComponent, isStandalone: true, selector: "cps-textarea", inputs: { label: "label", ariaLabel: "ariaLabel", placeholder: "placeholder", rows: "rows", cols: "cols", autofocus: "autofocus", spellcheck: "spellcheck", autocomplete: "autocomplete", hint: "hint", disabled: "disabled", readonly: "readonly", width: "width", clearable: "clearable", hideDetails: "hideDetails", persistentClear: "persistentClear", error: "error", resizable: "resizable", maxHeight: "maxHeight", infoTooltip: "infoTooltip", infoTooltipClass: "infoTooltipClass", infoTooltipMaxWidth: "infoTooltipMaxWidth", infoTooltipPersistent: "infoTooltipPersistent", infoTooltipPosition: "infoTooltipPosition", value: "value" }, outputs: { valueChanged: "valueChanged", focused: "focused", prefixIconClicked: "prefixIconClicked", blurred: "blurred" }, viewQueries: [{ propertyName: "_textareaEl", first: true, predicate: ["textareaEl"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"cps-textarea-container\" [style.width]=\"cvtWidth\">\n @if (label) {\n <div\n class=\"cps-textarea-label\"\n [class.cps-textarea-label-disabled]=\"disabled && !readonly\">\n <label>{{ label }}</label>\n @if (infoTooltip) {\n <cps-info-circle\n class=\"cps-textarea-label-info-circle\"\n size=\"xsmall\"\n [tooltipPosition]=\"infoTooltipPosition\"\n [tooltipContentClass]=\"infoTooltipClass\"\n [tooltipMaxWidth]=\"infoTooltipMaxWidth\"\n [tooltipPersistent]=\"infoTooltipPersistent\"\n [tooltipText]=\"infoTooltip\">\n </cps-info-circle>\n }\n </div>\n }\n\n <div\n class=\"cps-textarea-wrap\"\n [class.cps-textarea-wrap-error]=\"!!error\"\n [class.clearable]=\"clearable\"\n [class.persistent-clear]=\"persistentClear\"\n [class.keyboard-focused]=\"isKeyboardFocused\">\n <textarea\n #textareaEl\n [attr.spellcheck]=\"spellcheck\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-label]=\"ariaLabel || label || null\"\n [attr.aria-invalid]=\"error ? 'true' : null\"\n [attr.aria-required]=\"isRequired || null\"\n [attr.aria-describedby]=\"describedBy\"\n [cols]=\"cols\"\n [rows]=\"rows\"\n [autofocus]=\"autofocus\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [style.width]=\"cvtWidth\"\n [style.max-height.px]=\"maxHeightPx\"\n [style.resize]=\"readonly || disabled ? 'none' : resizable\"\n (mousedown)=\"onTextareaMousedown()\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n (input)=\"updateValueEvent($event)\">\n </textarea>\n\n @if (clearable && !disabled && !readonly) {\n <span\n class=\"clear-btn\"\n role=\"button\"\n [attr.tabindex]=\"isClearButtonVisible ? 0 : null\"\n aria-label=\"Clear\"\n [attr.aria-hidden]=\"isClearButtonVisible ? null : 'true'\"\n [style.visibility]=\"isClearButtonVisible ? 'visible' : 'hidden'\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onClear($event)\"\n (keydown.enter)=\"onClear($event)\"\n (keydown.space)=\"onClear($event)\">\n <cps-icon icon=\"delete\" size=\"small\"></cps-icon>\n </span>\n }\n\n @if (resizable === 'vertical' && !disabled && !readonly) {\n <div\n class=\"cps-textarea-resize-handle\"\n role=\"button\"\n tabindex=\"0\"\n aria-label=\"Vertically resize textarea\"\n aria-description=\"Use up and down arrow keys to resize\"\n (keydown)=\"onResizeHandleKeydown($event)\"></div>\n }\n </div>\n @if (!error && !hideDetails) {\n <div [id]=\"hintId\" class=\"cps-textarea-hint\">\n {{ hint }}\n </div>\n }\n @if (error && !hideDetails) {\n <div\n [id]=\"errorId\"\n class=\"cps-textarea-error\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ error }}\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-textarea-container{width:100%;gap:.2rem!important;display:flex!important;flex-direction:column!important;font-family:Source Sans Pro,sans-serif}:host .cps-textarea-container .cps-textarea-wrap{position:relative;overflow:hidden;border:.0625rem solid var(--cps-color-line-light);border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap:hover:has(textarea:enabled:not(:read-only)){border-color:var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap:focus-within:not(:has(textarea:read-only)),:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:has(textarea:read-only){border-color:var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{content:\"\";position:absolute;border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before{inset:-.0625rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{inset:0;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap-error{border-color:var(--cps-state-error)!important}:host .cps-textarea-container .cps-textarea-wrap-error textarea:not(:focus){background:#fef3f2!important}:host .cps-textarea-container .cps-textarea-wrap textarea{display:block;font-family:Source Sans Pro,sans-serif;font-size:1rem;color:var(--cps-color-text-dark);background:#fff;padding:.375rem .75rem;line-height:1.5;min-height:2.375rem;border:none;transition-property:border-color;transition-duration:.2s;appearance:none;border-radius:0;width:100%}:host .cps-textarea-container .cps-textarea-wrap textarea:focus{outline:0}:host .cps-textarea-container .cps-textarea-wrap textarea:read-only{cursor:default}:host .cps-textarea-container .cps-textarea-wrap textarea:disabled{color:var(--cps-color-text-mild);background-color:var(--cps-color-bg-disabled);opacity:1;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap textarea:focus+.clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap:hover .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle{position:absolute;bottom:0;right:0;width:1.5rem;height:1.5rem;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus{outline:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{content:\"\";position:absolute;border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before{inset:-.0625rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{inset:0;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{margin-left:.6875rem;margin-top:.6875rem}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible{position:absolute;bottom:0;right:0}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn{position:absolute;top:.4375rem;right:.4375rem;display:flex;cursor:pointer;color:var(--cps-state-error);padding:.25rem}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon{opacity:0;transition-duration:.2s}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:hover cps-icon{opacity:1!important}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus{outline:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{content:\"\";position:absolute;border-radius:50%}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before{inset:.125rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{inset:.25rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible{position:absolute;top:.4375rem;right:.4375rem}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible cps-icon{opacity:1}:host .cps-textarea-container .persistent-clear .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .clearable>textarea{padding-right:2.2rem}:host .cps-textarea-container .cps-textarea-hint{color:var(--cps-color-text-mild);font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-error{color:var(--cps-state-error);font-weight:700;font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-label{color:var(--cps-color-text-dark);font-size:.875rem;align-items:center;display:inline-flex;font-weight:600}:host .cps-textarea-container .cps-textarea-label .cps-textarea-label-info-circle{margin-left:.5rem}:host .cps-textarea-container .cps-textarea-label-disabled{color:var(--cps-color-text-mild)}:host .cps-textarea-container ::placeholder{font-family:Source Sans Pro,sans-serif;color:var(--cps-color-text-mild);font-style:italic;opacity:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: CpsIconComponent, selector: "cps-icon", inputs: ["icon", "size", "color"] }, { kind: "component", type: CpsInfoCircleComponent, selector: "cps-info-circle", inputs: ["size", "tooltipText", "tooltipPosition", "tooltipContentClass", "tooltipMaxWidth", "tooltipPersistent"] }] }); }
11923
12051
  }
11924
12052
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: CpsTextareaComponent, decorators: [{
11925
12053
  type: Component,
11926
- args: [{ selector: 'cps-textarea', imports: [CommonModule, CpsIconComponent, CpsInfoCircleComponent], template: "<div class=\"cps-textarea-container\" [ngStyle]=\"{ width: cvtWidth }\">\n @if (label) {\n <div\n class=\"cps-textarea-label\"\n [ngClass]=\"{ 'cps-textarea-label-disabled': disabled }\">\n <label>{{ label }}</label>\n @if (infoTooltip) {\n <cps-info-circle\n class=\"cps-textarea-label-info-circle\"\n size=\"xsmall\"\n [tooltipPosition]=\"infoTooltipPosition\"\n [tooltipContentClass]=\"infoTooltipClass\"\n [tooltipMaxWidth]=\"infoTooltipMaxWidth\"\n [tooltipPersistent]=\"infoTooltipPersistent\"\n [tooltipText]=\"infoTooltip\">\n </cps-info-circle>\n }\n </div>\n }\n\n <div\n class=\"cps-textarea-wrap\"\n [ngClass]=\"{\n 'cps-textarea-wrap-error': error,\n clearable: clearable,\n 'persistent-clear': persistentClear\n }\">\n <textarea\n spellcheck=\"false\"\n [cols]=\"cols\"\n [rows]=\"rows\"\n [autofocus]=\"autofocus\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [ngStyle]=\"{\n width: cvtWidth,\n resize: resizable\n }\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n (input)=\"updateValueEvent($event)\"></textarea>\n\n @if (clearable && !disabled) {\n <span\n [style.visibility]=\"\n persistentClear || (!persistentClear && value) ? 'visible' : 'hidden'\n \"\n class=\"clear-btn\">\n <cps-icon icon=\"delete\" size=\"small\" (click)=\"clear()\"></cps-icon>\n </span>\n }\n </div>\n @if (!error && !hideDetails) {\n <div class=\"cps-textarea-hint\">\n {{ hint }}\n </div>\n }\n @if (error && !hideDetails) {\n <div class=\"cps-textarea-error\">\n {{ error }}\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-textarea-container{width:100%;gap:.2rem!important;display:flex!important;flex-direction:column!important;font-family:Source Sans Pro,sans-serif}:host .cps-textarea-container .cps-textarea-wrap{position:relative;overflow:hidden}:host .cps-textarea-container .cps-textarea-wrap:hover textarea:enabled{border:1px solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap-error textarea{border-color:var(--cps-state-error)!important}:host .cps-textarea-container .cps-textarea-wrap-error textarea:not(:focus){background:#fef3f2!important}:host .cps-textarea-container .cps-textarea-wrap textarea{display:block;font-family:Source Sans Pro,sans-serif;font-size:1rem;color:var(--cps-color-text-dark);background:#fff;padding:.375rem .75rem;line-height:1.5;min-height:38px;border:1px solid var(--cps-color-line-light);transition-property:border-color;transition-duration:.2s;appearance:none;border-radius:4px;width:100%}:host .cps-textarea-container .cps-textarea-wrap textarea:focus{border:1px solid var(--cps-color-calm);outline:0}:host .cps-textarea-container .cps-textarea-wrap textarea:disabled{color:var(--cps-color-text-light);background-color:var(--cps-color-bg-disabled);opacity:1;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap textarea:focus+.clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap:hover .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap .clear-btn{position:absolute;top:.75rem;right:.75rem;cursor:pointer;color:var(--cps-state-error)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon{opacity:0;transition-duration:.2s}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon:hover{opacity:1!important}:host .cps-textarea-container .persistent-clear .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .clearable>textarea{padding-right:2.2rem}:host .cps-textarea-container .cps-textarea-hint{color:var(--cps-color-text-mild);font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-error{color:var(--cps-state-error);font-weight:700;font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-label{color:var(--cps-color-text-dark);font-size:.875rem;align-items:center;display:inline-flex;font-weight:600}:host .cps-textarea-container .cps-textarea-label .cps-textarea-label-info-circle{margin-left:8px}:host .cps-textarea-container .cps-textarea-label-disabled{color:var(--cps-color-text-mild)}:host .cps-textarea-container ::placeholder{font-family:Source Sans Pro,sans-serif;color:var(--cps-color-text-mild);font-style:italic;opacity:1}\n"] }]
12054
+ args: [{ selector: 'cps-textarea', imports: [CommonModule, CpsIconComponent, CpsInfoCircleComponent], template: "<div class=\"cps-textarea-container\" [style.width]=\"cvtWidth\">\n @if (label) {\n <div\n class=\"cps-textarea-label\"\n [class.cps-textarea-label-disabled]=\"disabled && !readonly\">\n <label>{{ label }}</label>\n @if (infoTooltip) {\n <cps-info-circle\n class=\"cps-textarea-label-info-circle\"\n size=\"xsmall\"\n [tooltipPosition]=\"infoTooltipPosition\"\n [tooltipContentClass]=\"infoTooltipClass\"\n [tooltipMaxWidth]=\"infoTooltipMaxWidth\"\n [tooltipPersistent]=\"infoTooltipPersistent\"\n [tooltipText]=\"infoTooltip\">\n </cps-info-circle>\n }\n </div>\n }\n\n <div\n class=\"cps-textarea-wrap\"\n [class.cps-textarea-wrap-error]=\"!!error\"\n [class.clearable]=\"clearable\"\n [class.persistent-clear]=\"persistentClear\"\n [class.keyboard-focused]=\"isKeyboardFocused\">\n <textarea\n #textareaEl\n [attr.spellcheck]=\"spellcheck\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-label]=\"ariaLabel || label || null\"\n [attr.aria-invalid]=\"error ? 'true' : null\"\n [attr.aria-required]=\"isRequired || null\"\n [attr.aria-describedby]=\"describedBy\"\n [cols]=\"cols\"\n [rows]=\"rows\"\n [autofocus]=\"autofocus\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [style.width]=\"cvtWidth\"\n [style.max-height.px]=\"maxHeightPx\"\n [style.resize]=\"readonly || disabled ? 'none' : resizable\"\n (mousedown)=\"onTextareaMousedown()\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n (input)=\"updateValueEvent($event)\">\n </textarea>\n\n @if (clearable && !disabled && !readonly) {\n <span\n class=\"clear-btn\"\n role=\"button\"\n [attr.tabindex]=\"isClearButtonVisible ? 0 : null\"\n aria-label=\"Clear\"\n [attr.aria-hidden]=\"isClearButtonVisible ? null : 'true'\"\n [style.visibility]=\"isClearButtonVisible ? 'visible' : 'hidden'\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onClear($event)\"\n (keydown.enter)=\"onClear($event)\"\n (keydown.space)=\"onClear($event)\">\n <cps-icon icon=\"delete\" size=\"small\"></cps-icon>\n </span>\n }\n\n @if (resizable === 'vertical' && !disabled && !readonly) {\n <div\n class=\"cps-textarea-resize-handle\"\n role=\"button\"\n tabindex=\"0\"\n aria-label=\"Vertically resize textarea\"\n aria-description=\"Use up and down arrow keys to resize\"\n (keydown)=\"onResizeHandleKeydown($event)\"></div>\n }\n </div>\n @if (!error && !hideDetails) {\n <div [id]=\"hintId\" class=\"cps-textarea-hint\">\n {{ hint }}\n </div>\n }\n @if (error && !hideDetails) {\n <div\n [id]=\"errorId\"\n class=\"cps-textarea-error\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ error }}\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-textarea-container{width:100%;gap:.2rem!important;display:flex!important;flex-direction:column!important;font-family:Source Sans Pro,sans-serif}:host .cps-textarea-container .cps-textarea-wrap{position:relative;overflow:hidden;border:.0625rem solid var(--cps-color-line-light);border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap:hover:has(textarea:enabled:not(:read-only)){border-color:var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap:focus-within:not(:has(textarea:read-only)),:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:has(textarea:read-only){border-color:var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{content:\"\";position:absolute;border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before{inset:-.0625rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{inset:0;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:before,:host .cps-textarea-container .cps-textarea-wrap.keyboard-focused:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap-error{border-color:var(--cps-state-error)!important}:host .cps-textarea-container .cps-textarea-wrap-error textarea:not(:focus){background:#fef3f2!important}:host .cps-textarea-container .cps-textarea-wrap textarea{display:block;font-family:Source Sans Pro,sans-serif;font-size:1rem;color:var(--cps-color-text-dark);background:#fff;padding:.375rem .75rem;line-height:1.5;min-height:2.375rem;border:none;transition-property:border-color;transition-duration:.2s;appearance:none;border-radius:0;width:100%}:host .cps-textarea-container .cps-textarea-wrap textarea:focus{outline:0}:host .cps-textarea-container .cps-textarea-wrap textarea:read-only{cursor:default}:host .cps-textarea-container .cps-textarea-wrap textarea:disabled{color:var(--cps-color-text-mild);background-color:var(--cps-color-bg-disabled);opacity:1;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap textarea:focus+.clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap:hover .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle{position:absolute;bottom:0;right:0;width:1.5rem;height:1.5rem;pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus{outline:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{content:\"\";position:absolute;border-radius:.25rem}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before{inset:-.0625rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{inset:0;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{margin-left:.6875rem;margin-top:.6875rem}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible{position:absolute;bottom:0;right:0}:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .cps-textarea-resize-handle:focus-visible:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn{position:absolute;top:.4375rem;right:.4375rem;display:flex;cursor:pointer;color:var(--cps-state-error);padding:.25rem}:host .cps-textarea-container .cps-textarea-wrap .clear-btn cps-icon{opacity:0;transition-duration:.2s}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:hover cps-icon{opacity:1!important}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus{outline:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible{outline:none;position:relative}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{content:\"\";position:absolute;border-radius:50%}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before{inset:.125rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{inset:.25rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible.suppress-focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible.suppress-focus-visible:after{display:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible{position:absolute;top:.4375rem;right:.4375rem}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:before,:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible:after{pointer-events:none}:host .cps-textarea-container .cps-textarea-wrap .clear-btn:focus-visible cps-icon{opacity:1}:host .cps-textarea-container .persistent-clear .clear-btn cps-icon{opacity:.5}:host .cps-textarea-container .clearable>textarea{padding-right:2.2rem}:host .cps-textarea-container .cps-textarea-hint{color:var(--cps-color-text-mild);font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-error{color:var(--cps-state-error);font-weight:700;font-size:.75rem;min-height:1.125rem;line-height:1.125rem;cursor:default}:host .cps-textarea-container .cps-textarea-label{color:var(--cps-color-text-dark);font-size:.875rem;align-items:center;display:inline-flex;font-weight:600}:host .cps-textarea-container .cps-textarea-label .cps-textarea-label-info-circle{margin-left:.5rem}:host .cps-textarea-container .cps-textarea-label-disabled{color:var(--cps-color-text-mild)}:host .cps-textarea-container ::placeholder{font-family:Source Sans Pro,sans-serif;color:var(--cps-color-text-mild);font-style:italic;opacity:1}\n"] }]
11927
12055
  }], ctorParameters: () => [{ type: i1$2.NgControl, decorators: [{
11928
12056
  type: Self
11929
12057
  }, {
11930
12058
  type: Optional
11931
12059
  }] }, { type: i0.ElementRef }], propDecorators: { label: [{
11932
12060
  type: Input
12061
+ }], ariaLabel: [{
12062
+ type: Input
11933
12063
  }], placeholder: [{
11934
12064
  type: Input
11935
12065
  }], rows: [{
@@ -11938,10 +12068,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
11938
12068
  type: Input
11939
12069
  }], autofocus: [{
11940
12070
  type: Input
12071
+ }], spellcheck: [{
12072
+ type: Input
12073
+ }], autocomplete: [{
12074
+ type: Input
11941
12075
  }], hint: [{
11942
12076
  type: Input
11943
12077
  }], disabled: [{
11944
12078
  type: Input
12079
+ }], readonly: [{
12080
+ type: Input
11945
12081
  }], width: [{
11946
12082
  type: Input
11947
12083
  }], clearable: [{
@@ -11954,6 +12090,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
11954
12090
  type: Input
11955
12091
  }], resizable: [{
11956
12092
  type: Input
12093
+ }], maxHeight: [{
12094
+ type: Input
11957
12095
  }], infoTooltip: [{
11958
12096
  type: Input
11959
12097
  }], infoTooltipClass: [{
@@ -11974,6 +12112,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
11974
12112
  type: Output
11975
12113
  }], blurred: [{
11976
12114
  type: Output
12115
+ }], _textareaEl: [{
12116
+ type: ViewChild,
12117
+ args: ['textareaEl']
11977
12118
  }] } });
11978
12119
 
11979
12120
  /**