@aquera/nile-elements 0.0.51 → 0.0.52

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.0.51",
6
+ "version": "0.0.52",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -477,19 +477,35 @@ export const styles = css`
477
477
  }
478
478
 
479
479
  .input__non-printable {
480
- width: 280px;
481
- height: 12px;
482
480
  border-radius: 4px;
483
- background-color: #ffffff;
484
- border: 1px solid grey;
485
- color: red;
481
+ max-width: 400px;
482
+ background-color: var(--nile-colors-white-base);
483
+ border: 1px solid var(--nile-colors-red-500);
484
+ color: var(--nile-colors-red-500);
486
485
  padding: 10px;
487
486
  font-size: 12px;
487
+ max-height: 300px;
488
+ overflow-y: scroll;
488
489
  }
489
490
 
490
491
  .input__remove-non-printable {
491
- color: #035da6;
492
+ color: var(--nile-colors-red-500);
492
493
  margin-left: 10px;
494
+ font-size: 14px;
495
+ color: var(--nile-colors-dark-900);
496
+ }
497
+
498
+ .input__srtiked-text-container {
499
+ margin-top: 4px;
500
+ color: var(--nile-colors-dark-900);
501
+ word-wrap: break-all;
502
+ }
503
+
504
+ .input__srtiked-text {
505
+ text-decoration: line-through;
506
+ text-decoration-color: var(--nile-colors-white-base);
507
+ color: var(--nile-colors-white-base);
508
+ background-color: var(--nile-colors-red-500);
493
509
  }
494
510
  `;
495
511
 
@@ -25,6 +25,7 @@ import { live } from 'lit/directives/live.js';
25
25
  import { watch } from '../internal/watch';
26
26
  import type { CSSResultGroup } from 'lit';
27
27
  import NileElement, { NileFormControl } from '../internal/nile-element';
28
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
28
29
 
29
30
  /**
30
31
  * Nile icon component.
@@ -227,6 +228,8 @@ export class NileInput extends NileElement implements NileFormControl {
227
228
 
228
229
  @state() hasPrintableCharacters: boolean = false;
229
230
 
231
+ @state() markedValue: string;
232
+
230
233
  connectedCallback() {
231
234
  super.connectedCallback();
232
235
  this.emit('nile-init');
@@ -360,29 +363,32 @@ export class NileInput extends NileElement implements NileFormControl {
360
363
  await this.updateComplete;
361
364
 
362
365
  if(this.checkNonPrintableChar){
363
- this.findNonPrintableChar();
366
+ this.markNonPrintableCharacters();
364
367
  }
365
368
  }
366
369
 
367
-
368
370
  /** checks non printable characters in the value. */
369
- findNonPrintableChar() {
371
+ markNonPrintableCharacters() {
372
+ let markedValue = '';
370
373
  this.hasPrintableCharacters = false;
371
-
372
374
  if (this.value) {
373
375
  for (let i = 0, n = this.value.length; i < n; i++) {
374
376
  const charCode = this.value.charCodeAt(i);
375
377
 
376
- // Check if the character is non-printable
377
378
  if ((charCode > 255 && charCode !== 9109) || [129, 143, 144, 157, 160].includes(charCode)) {
379
+ markedValue += `<span class="input__srtiked-text">${this.value.charAt(i)}</span>`;
378
380
  this.hasPrintableCharacters = true;
379
- this.emit('nile-value', { value: this.value , hasPrintableCharacters: true });
380
- break;
381
+ } else {
382
+ markedValue += this.value.charAt(i);
381
383
  }
382
384
  }
383
385
  }
386
+
387
+ this.markedValue = markedValue;
388
+ this.emit('nile-value-marked', { value: this.markedValue, hasNonPrintableCharacters: this.hasPrintableCharacters });
384
389
  }
385
390
 
391
+
386
392
  /** Removes all non printable characters from the value. */
387
393
  removeAllNonPrintableCharacters() {
388
394
  let cleanedValue = '';
@@ -657,9 +663,17 @@ export class NileInput extends NileElement implements NileFormControl {
657
663
  </div>
658
664
 
659
665
  <div class="input__non-printable">
660
- Non-printable character detected.<span class="input__remove-non-printable" @click=${
666
+ Non-printable character detected.
667
+ <nile-badge variant="error" @click=${
661
668
  this.removeAllNonPrintableCharacters
662
- }> Remove All </span>
669
+ } class="input__remove-non-printable" >
670
+ Remove All
671
+ </nile-badge>
672
+
673
+ <div class="input__srtiked-text-container"> ${unsafeHTML(
674
+ this.markedValue
675
+ )} </div>
676
+
663
677
  </div>
664
678
  </nile-popup>
665
679
  </div>