@descope/flow-components 2.1.9 → 2.1.11

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.cjs.js CHANGED
@@ -4396,7 +4396,7 @@ function requireColor () {
4396
4396
  return color;
4397
4397
  }
4398
4398
 
4399
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
4399
+ /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
4400
4400
 
4401
4401
  var purify_cjs;
4402
4402
  var hasRequiredPurify_cjs;
@@ -4432,12 +4432,18 @@ function requirePurify_cjs () {
4432
4432
  };
4433
4433
  }
4434
4434
  if (!apply) {
4435
- apply = function apply(fun, thisValue, args) {
4436
- return fun.apply(thisValue, args);
4435
+ apply = function apply(func, thisArg) {
4436
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
4437
+ args[_key - 2] = arguments[_key];
4438
+ }
4439
+ return func.apply(thisArg, args);
4437
4440
  };
4438
4441
  }
4439
4442
  if (!construct) {
4440
- construct = function construct(Func, args) {
4443
+ construct = function construct(Func) {
4444
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
4445
+ args[_key2 - 1] = arguments[_key2];
4446
+ }
4441
4447
  return new Func(...args);
4442
4448
  };
4443
4449
  }
@@ -4466,8 +4472,8 @@ function requirePurify_cjs () {
4466
4472
  if (thisArg instanceof RegExp) {
4467
4473
  thisArg.lastIndex = 0;
4468
4474
  }
4469
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4470
- args[_key - 1] = arguments[_key];
4475
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4476
+ args[_key3 - 1] = arguments[_key3];
4471
4477
  }
4472
4478
  return apply(func, thisArg, args);
4473
4479
  };
@@ -4478,12 +4484,12 @@ function requirePurify_cjs () {
4478
4484
  * @param func - The constructor function to be wrapped and called.
4479
4485
  * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
4480
4486
  */
4481
- function unconstruct(func) {
4487
+ function unconstruct(Func) {
4482
4488
  return function () {
4483
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4484
- args[_key2] = arguments[_key2];
4489
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
4490
+ args[_key4] = arguments[_key4];
4485
4491
  }
4486
- return construct(func, args);
4492
+ return construct(Func, args);
4487
4493
  };
4488
4494
  }
4489
4495
  /**
@@ -4582,8 +4588,8 @@ function requirePurify_cjs () {
4582
4588
  return fallbackValue;
4583
4589
  }
4584
4590
 
4585
- const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
4586
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
4591
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
4592
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'slot', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
4587
4593
  const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
4588
4594
  // List of SVG elements that are disallowed by default.
4589
4595
  // We still need to know them so that we can do namespace
@@ -4596,7 +4602,7 @@ function requirePurify_cjs () {
4596
4602
  const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
4597
4603
  const text = freeze(['#text']);
4598
4604
 
4599
- const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
4605
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
4600
4606
  const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
4601
4607
  const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
4602
4608
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
@@ -4704,7 +4710,7 @@ function requirePurify_cjs () {
4704
4710
  function createDOMPurify() {
4705
4711
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
4706
4712
  const DOMPurify = root => createDOMPurify(root);
4707
- DOMPurify.version = '3.2.6';
4713
+ DOMPurify.version = '3.2.7';
4708
4714
  DOMPurify.removed = [];
4709
4715
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
4710
4716
  // Not running in a browser, provide a factory function
@@ -5401,7 +5407,7 @@ function requirePurify_cjs () {
5401
5407
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
5402
5408
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
5403
5409
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
5404
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
5410
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
5405
5411
  // Alternative, second condition checks if it's an `is`-attribute, AND
5406
5412
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
5407
5413
  lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
@@ -5480,7 +5486,12 @@ function requirePurify_cjs () {
5480
5486
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
5481
5487
  }
5482
5488
  /* Work around a security issue with comments inside attributes */
5483
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
5489
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
5490
+ _removeAttribute(name, currentNode);
5491
+ continue;
5492
+ }
5493
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
5494
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
5484
5495
  _removeAttribute(name, currentNode);
5485
5496
  continue;
5486
5497
  }
@@ -77427,7 +77438,7 @@ function requireIndex_cjs () {
77427
77438
  var zxcvbnEnPackage__namespace = /*#__PURE__*/_interopNamespaceDefault(zxcvbnEnPackage);
77428
77439
 
77429
77440
  const DESCOPE_PREFIX$1 = 'descope';
77430
- const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 3;
77441
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 5;
77431
77442
  const BASE_THEME_SECTION$1 = 'host';
77432
77443
  const PORTAL_THEME_PREFIX$1 = '@';
77433
77444
 
@@ -77594,7 +77605,7 @@ function requireIndex_cjs () {
77594
77605
  };
77595
77606
 
77596
77607
  const DESCOPE_PREFIX = 'descope';
77597
- const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
77608
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY = 5;
77598
77609
  const BASE_THEME_SECTION = 'host';
77599
77610
 
77600
77611
  const kebabCase = (str) =>
@@ -78038,6 +78049,241 @@ function requireIndex_cjs () {
78038
78049
  return [res.theme, res.useVars, res.vars];
78039
78050
  };
78040
78051
 
78052
+ const colorGaps = {
78053
+ darkLight: 0.4,
78054
+ highlight: 0.8,
78055
+ contrast: 1,
78056
+ edgeColor: {
78057
+ darkLight: 0.25,
78058
+ highlight: 0.1,
78059
+ },
78060
+ };
78061
+
78062
+ const darken = (c, percentage) => c.darken(percentage).hex();
78063
+
78064
+ const contrast = (c) => {
78065
+ const isDark = c.isDark();
78066
+ return c
78067
+ .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
78068
+ .saturate(1)
78069
+ .hex();
78070
+ };
78071
+
78072
+ const lighten = (c, percentage) => {
78073
+ const isDark = c.lightness() < 0.5;
78074
+
78075
+ if (isDark) {
78076
+ return c.lightness(percentage * 100).hex();
78077
+ }
78078
+
78079
+ return c.lighten(percentage).hex();
78080
+ };
78081
+
78082
+ const isNearBlack = (color) => color.luminosity() < 0.01;
78083
+ const isNearWhite = (color) => color.luminosity() > 0.99;
78084
+
78085
+ const generateDarkColor = (color, theme) => {
78086
+ if (theme === 'dark') {
78087
+ return isNearWhite(color)
78088
+ ? darken(color, colorGaps.edgeColor.darkLight)
78089
+ : lighten(color, colorGaps.darkLight);
78090
+ }
78091
+
78092
+ return isNearBlack(color)
78093
+ ? lighten(color, colorGaps.edgeColor.darkLight)
78094
+ : darken(color, colorGaps.darkLight);
78095
+ };
78096
+
78097
+ const generateLightColor = (color, theme) => {
78098
+ if (theme === 'dark') {
78099
+ return isNearBlack(color)
78100
+ ? lighten(color, colorGaps.edgeColor.darkLight)
78101
+ : darken(color, colorGaps.darkLight);
78102
+ }
78103
+
78104
+ return isNearWhite(color)
78105
+ ? darken(color, colorGaps.edgeColor.darkLight)
78106
+ : lighten(color, colorGaps.darkLight);
78107
+ };
78108
+
78109
+ const generateHighlightColor = (color, theme) => {
78110
+ if (theme === 'dark') {
78111
+ return isNearBlack(color)
78112
+ ? lighten(color, colorGaps.edgeColor.highlight)
78113
+ : darken(color, colorGaps.highlight);
78114
+ }
78115
+
78116
+ return isNearWhite(color)
78117
+ ? darken(color, colorGaps.edgeColor.highlight)
78118
+ : lighten(color, colorGaps.highlight);
78119
+ };
78120
+
78121
+ const genColor = (color, theme) => {
78122
+ const mainColor = new Color(color.main || color);
78123
+
78124
+ const res = {
78125
+ main: mainColor.hex(),
78126
+ dark: color.dark || generateDarkColor(mainColor, theme),
78127
+ light: color.light || generateLightColor(mainColor, theme),
78128
+ highlight: color.highlight || generateHighlightColor(mainColor, theme),
78129
+ contrast: color.contrast || contrast(mainColor),
78130
+ };
78131
+
78132
+ return res;
78133
+ };
78134
+
78135
+ const genColors = (colors) => {
78136
+ return Object.keys(colors).reduce((acc, colorName) => {
78137
+ const currentColor = colors[colorName];
78138
+
78139
+ return Object.assign(acc, {
78140
+ [colorName]: genColor(currentColor),
78141
+ });
78142
+ }, {});
78143
+ };
78144
+
78145
+ const useHostExternalPadding = (cssVarList) => `
78146
+ :host {
78147
+ padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
78148
+ }
78149
+ `;
78150
+
78151
+ const resetInputFieldUnderlayingBorder = (name) => `
78152
+ ${name}::part(input-field)::after {
78153
+ border: none;
78154
+ }
78155
+ `;
78156
+
78157
+ const resetInitialHeight = (name) => `
78158
+ ${name}::before {
78159
+ height: unset;
78160
+ }
78161
+ `;
78162
+
78163
+ const resetInputElement = (name) => `
78164
+ ${name} > input {
78165
+ -webkit-mask-image: none;
78166
+ min-height: 0;
78167
+ box-sizing: border-box;
78168
+ }
78169
+ `;
78170
+
78171
+ const resetInputContainer = (name) => `
78172
+ ${name} {
78173
+ margin: 0;
78174
+ padding: 0;
78175
+ width: 100%;
78176
+ height: 100%;
78177
+ box-sizing: border-box;
78178
+ }
78179
+ `;
78180
+
78181
+ const resetInputField = (name) => `
78182
+ ${name}::part(input-field) {
78183
+ overflow: hidden;
78184
+ padding: 0;
78185
+ box-shadow: none;
78186
+ }
78187
+ `;
78188
+
78189
+ const resetInputCursor = (name) => `
78190
+ ${name} > label,
78191
+ ${name}::part(label),
78192
+ ${name}::part(required-indicator) {
78193
+ cursor: pointer;
78194
+ }
78195
+ `;
78196
+
78197
+ const resetInputPlaceholder = (name, ele = 'input') => `
78198
+ ${name}[disabled] > ${ele}:placeholder-shown,
78199
+ ${name}[readonly] > ${ele}:placeholder-shown {
78200
+ opacity: 1;
78201
+ }
78202
+ `;
78203
+
78204
+ const resetInputAutoFill = (name, cssVarList) => `
78205
+ ${name} input:-webkit-autofill,
78206
+ ${name} input:-webkit-autofill::first-line,
78207
+ ${name} input:-webkit-autofill:hover,
78208
+ ${name} input:-webkit-autofill:active,
78209
+ ${name} input:-webkit-autofill:focus {
78210
+ -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
78211
+ box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
78212
+ }
78213
+ `;
78214
+
78215
+ const resetInputFieldDefaultWidth = () => `
78216
+ :host {
78217
+ --vaadin-field-default-width: auto;
78218
+ box-sizing: border-box;
78219
+ }
78220
+ `;
78221
+
78222
+ const resetInputReadonlyStyle = (name) => `
78223
+ ${name}::part(input-field)::after {
78224
+ opacity: 0;
78225
+ }
78226
+ `;
78227
+
78228
+ const resetInputFieldInvalidBackgroundColor = (name) => `
78229
+ ${name}::part(input-field)::after {
78230
+ background: none;
78231
+ }
78232
+ `;
78233
+
78234
+ const resetInputOverrides = (name, cssVarList) => `
78235
+ ${resetInputContainer(name)}
78236
+ ${resetInputCursor(name)}
78237
+ ${resetInputPlaceholder(name)}
78238
+ ${resetInputField(name)}
78239
+ ${resetInputAutoFill(name, cssVarList)}
78240
+ ${resetInputFieldInvalidBackgroundColor(name)}
78241
+ ${resetInitialHeight(name)}
78242
+ ${resetInputElement(name)}
78243
+ ${resetInputFieldUnderlayingBorder(name)}
78244
+ `;
78245
+
78246
+ // This function is used to support RTL correctly for input components.
78247
+ // It also fixes the error message to be displayed LTR since we currently
78248
+ // don't support RTL for error messages.
78249
+ const resetInputLabelPosition = (name) => `
78250
+ :host ::part(error-message) {
78251
+ direction: ltr;
78252
+ }
78253
+ :host([required]) ::part(required-indicator) {
78254
+ width: 1em;
78255
+ display: inline-flex;
78256
+ }
78257
+ :host([required]) ::part(required-indicator)::after {
78258
+ position: static;
78259
+ }
78260
+ :host([has-label]) ::part(label) {
78261
+ padding-right: 0;
78262
+ padding-bottom: 0;
78263
+ display: flex;
78264
+ width: 100%;
78265
+ }
78266
+ ${name} [slot="label"] {
78267
+ max-width: calc(100% - 1em);
78268
+ overflow: hidden;
78269
+ text-overflow: ellipsis;
78270
+ padding-bottom: 0.5em;
78271
+ }
78272
+ `;
78273
+
78274
+ const inputFloatingLabelStyle = () => {
78275
+ return `
78276
+ :host([label-type="floating"]) {
78277
+ position: relative;
78278
+ }
78279
+ :host([label-type="floating"][has-label]) > ::part(label) {
78280
+ z-index: 1;
78281
+ padding: 0;
78282
+ width: auto;
78283
+ }
78284
+ `;
78285
+ };
78286
+
78041
78287
  const getVarName = (path) => getCssVarName$1(DESCOPE_PREFIX$1, ...path);
78042
78288
 
78043
78289
  // lodash.set alternative
@@ -78100,6 +78346,15 @@ function requireIndex_cjs () {
78100
78346
  return `*[data-theme="${themeName}"] {${style}}`;
78101
78347
  };
78102
78348
 
78349
+ function splitAmpersands(str) {
78350
+ const match = str.match(/^(&+)?(.*)$/);
78351
+ return [match[1] || '', match[2] || ''];
78352
+ }
78353
+
78354
+ // st attributes are also using selector multiplication
78355
+ // so we need to limit the multiplication
78356
+ const MAX_SELECTOR_MULTIPLY = 3;
78357
+
78103
78358
  const componentsThemeToStyleObj = (componentsTheme) =>
78104
78359
  transformTheme(componentsTheme, [], (path, val) => {
78105
78360
  const [component, ...restPath] = path;
@@ -78124,11 +78379,22 @@ function requireIndex_cjs () {
78124
78379
  // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
78125
78380
  // starts with underscore -> attribute selector
78126
78381
  const attrsSelector = restPath.reduce((acc, section, idx) => {
78127
- if (section.startsWith('_')) return `${acc}[${kebabCase$1(section.replace(/^_/, ''))}="true"]`;
78382
+ const [ampersands, content] = splitAmpersands(section);
78383
+ const selectorMultiplier = Math.min(
78384
+ ampersands.length + 1, // if there are no & we need to multiply by 1
78385
+ MAX_SELECTOR_MULTIPLY
78386
+ );
78387
+
78388
+ if (content.startsWith('_'))
78389
+ return acc + `[${kebabCase$1(content.replace(/^_/, ''))}="true"]`.repeat(selectorMultiplier);
78128
78390
 
78129
78391
  const nextSection = restPath[idx + 1];
78130
78392
 
78131
- if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
78393
+ if (
78394
+ typeof nextSection !== 'string' ||
78395
+ nextSection.startsWith('_') ||
78396
+ nextSection.startsWith('&')
78397
+ ) {
78132
78398
  // eslint-disable-next-line no-console
78133
78399
  console.error(
78134
78400
  'theme generator',
@@ -78137,7 +78403,12 @@ function requireIndex_cjs () {
78137
78403
  return acc;
78138
78404
  }
78139
78405
 
78140
- return `${acc}[${kebabCase$1(section)}="${restPath.splice(idx + 1, 1).join('')}"]`;
78406
+ return (
78407
+ acc +
78408
+ `[${kebabCase$1(content)}="${restPath.splice(idx + 1, 1).join('')}"]`.repeat(
78409
+ selectorMultiplier
78410
+ )
78411
+ );
78141
78412
  }, '');
78142
78413
 
78143
78414
  const selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
@@ -78171,7 +78442,9 @@ function requireIndex_cjs () {
78171
78442
  return Object.assign(acc, {
78172
78443
  [componentName]: Object.keys(componentThemes).reduce(
78173
78444
  (res, theme) =>
78174
- Object.assign(res, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
78445
+ Object.assign(res, {
78446
+ [theme]: componentsThemeToStyle(componentThemes[theme]),
78447
+ }),
78175
78448
  {}
78176
78449
  ),
78177
78450
  });
@@ -78207,99 +78480,6 @@ function requireIndex_cjs () {
78207
78480
  return [res.theme, res.useVars, res.vars];
78208
78481
  };
78209
78482
 
78210
- const colorGaps = {
78211
- darkLight: 0.4,
78212
- highlight: 0.8,
78213
- contrast: 1,
78214
- edgeColor: {
78215
- darkLight: 0.25,
78216
- highlight: 0.1,
78217
- },
78218
- };
78219
-
78220
- const darken = (c, percentage) => c.darken(percentage).hex();
78221
-
78222
- const contrast = (c) => {
78223
- const isDark = c.isDark();
78224
- return c
78225
- .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
78226
- .saturate(1)
78227
- .hex();
78228
- };
78229
-
78230
- const lighten = (c, percentage) => {
78231
- const isDark = c.lightness() < 0.5;
78232
-
78233
- if (isDark) {
78234
- return c.lightness(percentage * 100).hex();
78235
- }
78236
-
78237
- return c.lighten(percentage).hex();
78238
- };
78239
-
78240
- const isNearBlack = (color) => color.luminosity() < 0.01;
78241
- const isNearWhite = (color) => color.luminosity() > 0.99;
78242
-
78243
- const generateDarkColor = (color, theme) => {
78244
- if (theme === 'dark') {
78245
- return isNearWhite(color)
78246
- ? darken(color, colorGaps.edgeColor.darkLight)
78247
- : lighten(color, colorGaps.darkLight);
78248
- }
78249
-
78250
- return isNearBlack(color)
78251
- ? lighten(color, colorGaps.edgeColor.darkLight)
78252
- : darken(color, colorGaps.darkLight);
78253
- };
78254
-
78255
- const generateLightColor = (color, theme) => {
78256
- if (theme === 'dark') {
78257
- return isNearBlack(color)
78258
- ? lighten(color, colorGaps.edgeColor.darkLight)
78259
- : darken(color, colorGaps.darkLight);
78260
- }
78261
-
78262
- return isNearWhite(color)
78263
- ? darken(color, colorGaps.edgeColor.darkLight)
78264
- : lighten(color, colorGaps.darkLight);
78265
- };
78266
-
78267
- const generateHighlightColor = (color, theme) => {
78268
- if (theme === 'dark') {
78269
- return isNearBlack(color)
78270
- ? lighten(color, colorGaps.edgeColor.highlight)
78271
- : darken(color, colorGaps.highlight);
78272
- }
78273
-
78274
- return isNearWhite(color)
78275
- ? darken(color, colorGaps.edgeColor.highlight)
78276
- : lighten(color, colorGaps.highlight);
78277
- };
78278
-
78279
- const genColor = (color, theme) => {
78280
- const mainColor = new Color(color.main || color);
78281
-
78282
- const res = {
78283
- main: mainColor.hex(),
78284
- dark: color.dark || generateDarkColor(mainColor, theme),
78285
- light: color.light || generateLightColor(mainColor, theme),
78286
- highlight: color.highlight || generateHighlightColor(mainColor, theme),
78287
- contrast: color.contrast || contrast(mainColor),
78288
- };
78289
-
78290
- return res;
78291
- };
78292
-
78293
- const genColors = (colors) => {
78294
- return Object.keys(colors).reduce((acc, colorName) => {
78295
- const currentColor = colors[colorName];
78296
-
78297
- return Object.assign(acc, {
78298
- [colorName]: genColor(currentColor),
78299
- });
78300
- }, {});
78301
- };
78302
-
78303
78483
  const direction$1 = 'ltr';
78304
78484
 
78305
78485
  const colors$2 = genColors({
@@ -78769,8 +78949,7 @@ function requireIndex_cjs () {
78769
78949
 
78770
78950
  // on some cases we need a selector to be more specific than another
78771
78951
  // for this we have this fn that generate a class selector multiple times
78772
- const createClassSelectorSpecifier$1 = (className, numOfRepeats) =>
78773
- Array(numOfRepeats).fill(`.${className}`).join('');
78952
+ const createClassSelectorSpecifier$1 = (className, numOfRepeats) => `.${className}`.repeat(numOfRepeats);
78774
78953
 
78775
78954
  const STYLE_OVERRIDE_ATTR_PREFIX$1 = 'st';
78776
78955
 
@@ -78857,18 +79036,22 @@ function requireIndex_cjs () {
78857
79036
 
78858
79037
  #createOverridesStyle() {
78859
79038
  if (this.#styleAttributes.length) {
78860
- const classSpecifier = createClassSelectorSpecifier$1(
79039
+ let classSpecifier = createClassSelectorSpecifier$1(
78861
79040
  componentName,
78862
- CSS_SELECTOR_SPECIFIER_MULTIPLY,
79041
+ CSS_SELECTOR_SPECIFIER_MULTIPLY
78863
79042
  );
79043
+ const elementId = this.getAttribute('id');
79044
+ if (elementId) {
79045
+ // basically this is enough to make the selector more specific
79046
+ // but just in case there is no id, we will also add the class multiple times
79047
+ classSpecifier += `#${elementId}`;
79048
+ }
78864
79049
 
78865
- this.#overrideStyleEle = injectStyle(
78866
- `:host(${classSpecifier}) {}`,
78867
- this.#rootElement,
78868
- );
79050
+ this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
78869
79051
  }
78870
79052
  }
78871
79053
 
79054
+
78872
79055
  #setAttrOverride(attrName, value) {
78873
79056
  const style = this.#overrideStyleEle?.cssRules[0].style;
78874
79057
 
@@ -80772,7 +80955,7 @@ function requireIndex_cjs () {
80772
80955
  // on some cases we need a selector to be more specific than another
80773
80956
  // for this we have this fn that generate a class selector multiple times
80774
80957
  const createClassSelectorSpecifier = (className, numOfRepeats) =>
80775
- Array(numOfRepeats).fill(`.${className}`).join('');
80958
+ `.${className}`.repeat(numOfRepeats);
80776
80959
 
80777
80960
  const STYLE_OVERRIDE_ATTR_PREFIX = 'st';
80778
80961
 
@@ -80848,10 +81031,16 @@ function requireIndex_cjs () {
80848
81031
 
80849
81032
  #createOverridesStyle() {
80850
81033
  if (this.#styleAttributes.length) {
80851
- const classSpecifier = createClassSelectorSpecifier(
81034
+ let classSpecifier = createClassSelectorSpecifier(
80852
81035
  componentName,
80853
81036
  CSS_SELECTOR_SPECIFIER_MULTIPLY$1
80854
81037
  );
81038
+ const elementId = this.getAttribute('id');
81039
+ if (elementId) {
81040
+ // basically this is enough to make the selector more specific
81041
+ // but just in case there is no id, we will also add the class multiple times
81042
+ classSpecifier += `#${elementId}`;
81043
+ }
80855
81044
 
80856
81045
  this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
80857
81046
  }
@@ -82274,148 +82463,6 @@ function requireIndex_cjs () {
82274
82463
  inputIconColor: { ...inputIcon, property: 'color' },
82275
82464
  };
82276
82465
 
82277
- const useHostExternalPadding = (cssVarList) => `
82278
- :host {
82279
- padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
82280
- }
82281
- `;
82282
-
82283
- const resetInputFieldUnderlayingBorder = (name) => `
82284
- ${name}::part(input-field)::after {
82285
- border: none;
82286
- }
82287
- `;
82288
-
82289
- const resetInitialHeight = (name) => `
82290
- ${name}::before {
82291
- height: unset;
82292
- }
82293
- `;
82294
-
82295
- const resetInputElement = (name) => `
82296
- ${name} > input {
82297
- -webkit-mask-image: none;
82298
- min-height: 0;
82299
- box-sizing: border-box;
82300
- }
82301
- `;
82302
-
82303
- const resetInputContainer = (name) => `
82304
- ${name} {
82305
- margin: 0;
82306
- padding: 0;
82307
- width: 100%;
82308
- height: 100%;
82309
- box-sizing: border-box;
82310
- }
82311
- `;
82312
-
82313
- const resetInputField = (name) => `
82314
- ${name}::part(input-field) {
82315
- overflow: hidden;
82316
- padding: 0;
82317
- box-shadow: none;
82318
- }
82319
- `;
82320
-
82321
- const resetInputCursor = (name) => `
82322
- ${name} > label,
82323
- ${name}::part(label),
82324
- ${name}::part(required-indicator) {
82325
- cursor: pointer;
82326
- }
82327
- `;
82328
-
82329
- const resetInputPlaceholder = (name, ele = 'input') => `
82330
- ${name}[disabled] > ${ele}:placeholder-shown,
82331
- ${name}[readonly] > ${ele}:placeholder-shown {
82332
- opacity: 1;
82333
- }
82334
- `;
82335
-
82336
- const resetInputAutoFill = (name, cssVarList) => `
82337
- ${name} input:-webkit-autofill,
82338
- ${name} input:-webkit-autofill::first-line,
82339
- ${name} input:-webkit-autofill:hover,
82340
- ${name} input:-webkit-autofill:active,
82341
- ${name} input:-webkit-autofill:focus {
82342
- -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
82343
- box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
82344
- }
82345
- `;
82346
-
82347
- const resetInputFieldDefaultWidth = () => `
82348
- :host {
82349
- --vaadin-field-default-width: auto;
82350
- box-sizing: border-box;
82351
- }
82352
- `;
82353
-
82354
- const resetInputReadonlyStyle = (name) => `
82355
- ${name}::part(input-field)::after {
82356
- opacity: 0;
82357
- }
82358
- `;
82359
-
82360
- const resetInputFieldInvalidBackgroundColor = (name) => `
82361
- ${name}::part(input-field)::after {
82362
- background: none;
82363
- }
82364
- `;
82365
-
82366
- const resetInputOverrides = (name, cssVarList) => `
82367
- ${resetInputContainer(name)}
82368
- ${resetInputCursor(name)}
82369
- ${resetInputPlaceholder(name)}
82370
- ${resetInputField(name)}
82371
- ${resetInputAutoFill(name, cssVarList)}
82372
- ${resetInputFieldInvalidBackgroundColor(name)}
82373
- ${resetInitialHeight(name)}
82374
- ${resetInputElement(name)}
82375
- ${resetInputFieldUnderlayingBorder(name)}
82376
- `;
82377
-
82378
- // This function is used to support RTL correctly for input components.
82379
- // It also fixes the error message to be displayed LTR since we currently
82380
- // don't support RTL for error messages.
82381
- const resetInputLabelPosition = (name) => `
82382
- :host ::part(error-message) {
82383
- direction: ltr;
82384
- }
82385
- :host([required]) ::part(required-indicator) {
82386
- width: 1em;
82387
- display: inline-flex;
82388
- }
82389
- :host([required]) ::part(required-indicator)::after {
82390
- position: static;
82391
- }
82392
- :host([has-label]) ::part(label) {
82393
- padding-right: 0;
82394
- padding-bottom: 0;
82395
- display: flex;
82396
- width: 100%;
82397
- }
82398
- ${name} [slot="label"] {
82399
- max-width: calc(100% - 1em);
82400
- overflow: hidden;
82401
- text-overflow: ellipsis;
82402
- padding-bottom: 0.5em;
82403
- }
82404
- `;
82405
-
82406
- const inputFloatingLabelStyle = () => {
82407
- return `
82408
- :host([label-type="floating"]) {
82409
- position: relative;
82410
- }
82411
- :host([label-type="floating"][has-label]) > ::part(label) {
82412
- z-index: 1;
82413
- padding: 0;
82414
- width: auto;
82415
- }
82416
- `;
82417
- };
82418
-
82419
82466
  const componentName$1c = getComponentName$1('text-field');
82420
82467
 
82421
82468
  const observedAttrs$4 = ['type', 'label-type', 'copy-to-clipboard'];
@@ -84129,7 +84176,8 @@ descope-boolean-field-internal {
84129
84176
  },
84130
84177
  },
84131
84178
 
84132
- borderRadius: {
84179
+ // we must add & to override the root container style (applied via the styles page)
84180
+ '&borderRadius': {
84133
84181
  sm: { [compVars$8.borderRadius]: globalRefs$B.radius.sm },
84134
84182
  md: { [compVars$8.borderRadius]: globalRefs$B.radius.md },
84135
84183
  lg: { [compVars$8.borderRadius]: globalRefs$B.radius.lg },
@@ -100800,9 +100848,24 @@ descope-boolean-field-internal {
100800
100848
  index_cjs$4.getThemeRefs = getThemeRefs;
100801
100849
  index_cjs$4.getThemeVars = getThemeVars;
100802
100850
  index_cjs$4.globalsThemeToStyle = globalsThemeToStyle;
100851
+ index_cjs$4.inputFloatingLabelStyle = inputFloatingLabelStyle;
100852
+ index_cjs$4.resetInitialHeight = resetInitialHeight;
100853
+ index_cjs$4.resetInputAutoFill = resetInputAutoFill;
100854
+ index_cjs$4.resetInputContainer = resetInputContainer;
100855
+ index_cjs$4.resetInputCursor = resetInputCursor;
100856
+ index_cjs$4.resetInputElement = resetInputElement;
100857
+ index_cjs$4.resetInputField = resetInputField;
100858
+ index_cjs$4.resetInputFieldDefaultWidth = resetInputFieldDefaultWidth;
100859
+ index_cjs$4.resetInputFieldInvalidBackgroundColor = resetInputFieldInvalidBackgroundColor;
100860
+ index_cjs$4.resetInputFieldUnderlayingBorder = resetInputFieldUnderlayingBorder;
100861
+ index_cjs$4.resetInputLabelPosition = resetInputLabelPosition;
100862
+ index_cjs$4.resetInputOverrides = resetInputOverrides;
100863
+ index_cjs$4.resetInputPlaceholder = resetInputPlaceholder;
100864
+ index_cjs$4.resetInputReadonlyStyle = resetInputReadonlyStyle;
100803
100865
  index_cjs$4.themeToCSSVarsObj = themeToCSSVarsObj;
100804
100866
  index_cjs$4.themeToStyle = themeToStyle;
100805
100867
  index_cjs$4.themeVars = themeVars;
100868
+ index_cjs$4.useHostExternalPadding = useHostExternalPadding;
100806
100869
  index_cjs$4.useVar = useVar;
100807
100870
 
100808
100871
  return index_cjs$4;