@descope/web-components-ui 1.0.297 → 1.0.299

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/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export { NumberFieldClass } from './components/descope-number-field';
25
25
  export { PasscodeClass } from './components/descope-passcode';
26
26
  export { PasswordClass } from './components/descope-password';
27
27
  export { TextClass } from './components/text-components/descope-text';
28
- export { MarkdownContentClass } from './components/text-components/descope-markdown-content';
28
+ export { EnrichedTextClass } from './components/text-components/descope-enriched-text';
29
29
  export { TextAreaClass } from './components/descope-text-area';
30
30
  export { TextFieldClass } from './components/descope-text-field';
31
31
  export { ImageClass } from './components/descope-image';
package/dist/index.esm.js CHANGED
@@ -3385,14 +3385,14 @@ const onClipboardCopy = (e) => {
3385
3385
  e.preventDefault();
3386
3386
  };
3387
3387
 
3388
- const componentName$z = getComponentName('markdown-content');
3388
+ const componentName$z = getComponentName('enriched-text');
3389
3389
 
3390
- const BaseMarkdownContentClass = createBaseTextClass(componentName$z);
3390
+ const BaseEnrichedTextClass = createBaseTextClass(componentName$z);
3391
3391
 
3392
- const markdownContentMixin = (superclass) =>
3393
- class MarkdownContentMixinClass extends superclass {
3392
+ const EnrichedTextMixin = (superclass) =>
3393
+ class EnrichedTextMixinClass extends superclass {
3394
3394
  static get observedAttributes() {
3395
- return ['disabled-rules', 'line-break'];
3395
+ return ['disabled-rules', 'line-break', 'readonly'];
3396
3396
  }
3397
3397
 
3398
3398
  get lineBreak() {
@@ -3405,7 +3405,7 @@ const markdownContentMixin = (superclass) =>
3405
3405
 
3406
3406
  init() {
3407
3407
  super.init();
3408
- this.#initMarkdown();
3408
+ this.#initProcessor();
3409
3409
  this.textSlot.addEventListener('slotchange', this.#parseChildren.bind(this));
3410
3410
  }
3411
3411
 
@@ -3414,28 +3414,32 @@ const markdownContentMixin = (superclass) =>
3414
3414
 
3415
3415
  if (attrName === 'disabled-rules') {
3416
3416
  if (newValue !== oldValue) {
3417
- this.#initMarkdown(newValue);
3417
+ this.#initProcessor(newValue);
3418
3418
  this.#parseChildren();
3419
3419
  }
3420
3420
  }
3421
+
3422
+ if (attrName === 'readonly') {
3423
+ this.onReadOnlyChange(newValue !== null);
3424
+ }
3421
3425
  }
3422
3426
 
3423
- #initMarkdown() {
3424
- this.markdown = markdownit({ breaks: this.lineBreak }).disable(this.disabledRules);
3427
+ #initProcessor() {
3428
+ this.processor = markdownit({ breaks: this.lineBreak }).disable(this.disabledRules);
3425
3429
  }
3426
3430
 
3427
3431
  #parseChildren() {
3428
3432
  const node = this.textSlot.assignedNodes({ flatten: true })?.[0];
3429
3433
 
3430
3434
  if (node && node.nodeType === Node.TEXT_NODE) {
3431
- const tokens = this.markdown.parse(node.textContent, { references: undefined });
3432
- const result = this.markdown.renderer.render(enrichTokens(tokens), {
3435
+ const tokens = this.processor.parse(node.textContent, { references: undefined });
3436
+ const result = this.processor.renderer.render(enrichTokens(tokens), {
3433
3437
  breaks: this.lineBreak,
3434
3438
  });
3435
3439
 
3436
3440
  if (result !== node.textContent) {
3437
3441
  const span = document.createElement('div');
3438
- span.classList.add('markdown-wrapper');
3442
+ span.classList.add('enriched-text');
3439
3443
  // eslint-disable-next-line no-use-before-define
3440
3444
  span.innerHTML = `${getStyleReset()}${result}`;
3441
3445
  span.addEventListener('copy', onClipboardCopy);
@@ -3443,9 +3447,13 @@ const markdownContentMixin = (superclass) =>
3443
3447
  }
3444
3448
  }
3445
3449
  }
3450
+
3451
+ onReadOnlyChange(val) {
3452
+ this.setAttribute('inert', val);
3453
+ }
3446
3454
  };
3447
3455
 
3448
- const MarkdownContentClass = compose(
3456
+ const EnrichedTextClass = compose(
3449
3457
  createStyleMixin({
3450
3458
  mappings: {
3451
3459
  hostWidth: { selector: () => ':host', property: 'width' },
@@ -3461,22 +3469,22 @@ const MarkdownContentClass = compose(
3461
3469
  }),
3462
3470
  draggableMixin,
3463
3471
  componentNameValidationMixin,
3464
- markdownContentMixin,
3472
+ EnrichedTextMixin,
3465
3473
  hideWhenEmptyMixin
3466
- )(BaseMarkdownContentClass);
3474
+ )(BaseEnrichedTextClass);
3467
3475
 
3468
3476
  function getStyleReset() {
3469
3477
  return `
3470
3478
  <style>
3471
- .markdown-wrapper > * { margin:0 }
3472
- .markdown-wrapper > *:not(:only-child):not(:last-child) {
3473
- margin-bottom: var(${MarkdownContentClass.cssVarList.textLineHeight})
3479
+ .enriched-text > * { margin:0 }
3480
+ .enriched-text > *:not(:only-child):not(:last-child) {
3481
+ margin-bottom: var(${EnrichedTextClass.cssVarList.textLineHeight})
3474
3482
  }
3475
3483
  </style>
3476
3484
  `;
3477
3485
  }
3478
3486
 
3479
- customElements.define(componentName$z, MarkdownContentClass);
3487
+ customElements.define(componentName$z, EnrichedTextClass);
3480
3488
 
3481
3489
  const componentName$y = getComponentName('text-area');
3482
3490
 
@@ -11537,9 +11545,9 @@ var text$1 = /*#__PURE__*/Object.freeze({
11537
11545
  });
11538
11546
 
11539
11547
  const globalRefs$i = getThemeRefs(globals);
11540
- const vars$q = MarkdownContentClass.cssVarList;
11548
+ const vars$q = EnrichedTextClass.cssVarList;
11541
11549
 
11542
- const markdownContent = {
11550
+ const EnrichedText = {
11543
11551
  [vars$q.hostDirection]: globalRefs$i.direction,
11544
11552
 
11545
11553
  [vars$q.fontSize]: globalRefs$i.typography.body1.size,
@@ -11614,9 +11622,9 @@ const markdownContent = {
11614
11622
  },
11615
11623
  };
11616
11624
 
11617
- var markdownContent$1 = /*#__PURE__*/Object.freeze({
11625
+ var EnrichedText$1 = /*#__PURE__*/Object.freeze({
11618
11626
  __proto__: null,
11619
- default: markdownContent,
11627
+ default: EnrichedText,
11620
11628
  vars: vars$q
11621
11629
  });
11622
11630
 
@@ -12567,7 +12575,7 @@ const components = {
12567
12575
  totpImage,
12568
12576
  notpImage,
12569
12577
  text: text$1,
12570
- markdownContent: markdownContent$1,
12578
+ EnrichedText: EnrichedText$1,
12571
12579
  link: link$1,
12572
12580
  divider: divider$1,
12573
12581
  passcode: passcode$1,
@@ -12652,5 +12660,5 @@ const darkTheme = merge({}, defaultTheme, {
12652
12660
  },
12653
12661
  });
12654
12662
 
12655
- export { AvatarClass, BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, ComboBoxClass, ContainerClass, DividerClass, EmailFieldClass, GridClass, ImageClass, LinkClass, LoaderLinearClass, LoaderRadialClass, LogoClass, MappingsFieldClass, MarkdownContentClass, ModalClass, MultiSelectComboBoxClass, NewPasswordClass, NotificationClass, NotpImageClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, PolicyValidationClass, RecaptchaClass, SamlGroupMappingsClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, UserAttributeClass, UserAuthMethodClass, componentsThemeManager, createComponentsTheme, darkTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
12663
+ export { AvatarClass, BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, ComboBoxClass, ContainerClass, DividerClass, EmailFieldClass, EnrichedTextClass, GridClass, ImageClass, LinkClass, LoaderLinearClass, LoaderRadialClass, LogoClass, MappingsFieldClass, ModalClass, MultiSelectComboBoxClass, NewPasswordClass, NotificationClass, NotpImageClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, PolicyValidationClass, RecaptchaClass, SamlGroupMappingsClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, UserAttributeClass, UserAuthMethodClass, componentsThemeManager, createComponentsTheme, darkTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
12656
12664
  //# sourceMappingURL=index.esm.js.map