@descope/web-components-ui 1.135.0 → 1.137.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.
Files changed (65) hide show
  1. package/dist/cjs/index.cjs.js +305 -253
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +290 -253
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/{2739.js → 3685.js} +2 -2
  6. package/dist/umd/3685.js.map +1 -0
  7. package/dist/umd/8961.js +1 -1
  8. package/dist/umd/8961.js.map +1 -1
  9. package/dist/umd/9365.js +1 -1
  10. package/dist/umd/9365.js.map +1 -1
  11. package/dist/umd/DescopeDev.js +1 -1
  12. package/dist/umd/DescopeDev.js.map +1 -1
  13. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
  14. package/dist/umd/boolean-fields-descope-checkbox-index-js.js.map +1 -1
  15. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
  16. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js.map +1 -1
  17. package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js +1 -1
  18. package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js.map +1 -1
  19. package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js +1 -1
  20. package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js.map +1 -1
  21. package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
  22. package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
  23. package/dist/umd/descope-email-field-index-js.js +4 -4
  24. package/dist/umd/descope-email-field-index-js.js.map +1 -1
  25. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
  26. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js.map +1 -1
  27. package/dist/umd/descope-grid-index-js.js +1 -1
  28. package/dist/umd/descope-grid-index-js.js.map +1 -1
  29. package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
  30. package/dist/umd/descope-multi-select-combo-box-index-js.js.map +1 -1
  31. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
  32. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js.map +1 -1
  33. package/dist/umd/descope-new-password-index-js.js +1 -1
  34. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  35. package/dist/umd/descope-number-field-index-js.js +1 -1
  36. package/dist/umd/descope-number-field-index-js.js.map +1 -1
  37. package/dist/umd/descope-passcode-index-js.js +2 -2
  38. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  39. package/dist/umd/descope-password-index-js.js +1 -1
  40. package/dist/umd/descope-password-index-js.js.map +1 -1
  41. package/dist/umd/descope-radio-group-index-js.js +1 -1
  42. package/dist/umd/descope-radio-group-index-js.js.map +1 -1
  43. package/dist/umd/descope-scopes-list-index-js.js +1 -1
  44. package/dist/umd/descope-scopes-list-index-js.js.map +1 -1
  45. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  46. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  47. package/dist/umd/descope-security-questions-verify-index-js.js +2 -2
  48. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  49. package/dist/umd/descope-text-area-index-js.js +1 -1
  50. package/dist/umd/descope-text-area-index-js.js.map +1 -1
  51. package/dist/umd/descope-text-field-index-js.js +2 -2
  52. package/dist/umd/descope-text-field-index-js.js.map +1 -1
  53. package/dist/umd/index.js +1 -1
  54. package/dist/umd/index.js.map +1 -1
  55. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  56. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  57. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  58. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  59. package/package.json +24 -24
  60. package/src/constants.js +1 -1
  61. package/src/helpers/themeHelpers/index.js +33 -4
  62. package/src/mixins/createStyleMixin/helpers.js +1 -1
  63. package/src/mixins/createStyleMixin/index.js +7 -1
  64. package/src/theme/components/container.js +2 -1
  65. package/dist/umd/2739.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -100,7 +100,7 @@ const toTitle = (str) =>
100
100
  .join(' ');
101
101
 
102
102
  const DESCOPE_PREFIX$1 = 'descope';
103
- const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 3;
103
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 5;
104
104
  const BASE_THEME_SECTION$1 = 'host';
105
105
  const PORTAL_THEME_PREFIX$1 = '@';
106
106
 
@@ -279,7 +279,7 @@ const compose =
279
279
  const isFunction = (maybeFunc) => typeof maybeFunc === 'function';
280
280
 
281
281
  const DESCOPE_PREFIX = 'descope';
282
- const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
282
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY = 5;
283
283
  const BASE_THEME_SECTION = 'host';
284
284
 
285
285
  const observeAttributes = (
@@ -699,6 +699,241 @@ const createHelperVars$1 = (theme, prefix) => {
699
699
  return [res.theme, res.useVars, res.vars];
700
700
  };
701
701
 
702
+ const colorGaps = {
703
+ darkLight: 0.4,
704
+ highlight: 0.8,
705
+ contrast: 1,
706
+ edgeColor: {
707
+ darkLight: 0.25,
708
+ highlight: 0.1,
709
+ },
710
+ };
711
+
712
+ const darken = (c, percentage) => c.darken(percentage).hex();
713
+
714
+ const contrast = (c) => {
715
+ const isDark = c.isDark();
716
+ return c
717
+ .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
718
+ .saturate(1)
719
+ .hex();
720
+ };
721
+
722
+ const lighten = (c, percentage) => {
723
+ const isDark = c.lightness() < 0.5;
724
+
725
+ if (isDark) {
726
+ return c.lightness(percentage * 100).hex();
727
+ }
728
+
729
+ return c.lighten(percentage).hex();
730
+ };
731
+
732
+ const isNearBlack = (color) => color.luminosity() < 0.01;
733
+ const isNearWhite = (color) => color.luminosity() > 0.99;
734
+
735
+ const generateDarkColor = (color, theme) => {
736
+ if (theme === 'dark') {
737
+ return isNearWhite(color)
738
+ ? darken(color, colorGaps.edgeColor.darkLight)
739
+ : lighten(color, colorGaps.darkLight);
740
+ }
741
+
742
+ return isNearBlack(color)
743
+ ? lighten(color, colorGaps.edgeColor.darkLight)
744
+ : darken(color, colorGaps.darkLight);
745
+ };
746
+
747
+ const generateLightColor = (color, theme) => {
748
+ if (theme === 'dark') {
749
+ return isNearBlack(color)
750
+ ? lighten(color, colorGaps.edgeColor.darkLight)
751
+ : darken(color, colorGaps.darkLight);
752
+ }
753
+
754
+ return isNearWhite(color)
755
+ ? darken(color, colorGaps.edgeColor.darkLight)
756
+ : lighten(color, colorGaps.darkLight);
757
+ };
758
+
759
+ const generateHighlightColor = (color, theme) => {
760
+ if (theme === 'dark') {
761
+ return isNearBlack(color)
762
+ ? lighten(color, colorGaps.edgeColor.highlight)
763
+ : darken(color, colorGaps.highlight);
764
+ }
765
+
766
+ return isNearWhite(color)
767
+ ? darken(color, colorGaps.edgeColor.highlight)
768
+ : lighten(color, colorGaps.highlight);
769
+ };
770
+
771
+ const genColor = (color, theme) => {
772
+ const mainColor = new Color(color.main || color);
773
+
774
+ const res = {
775
+ main: mainColor.hex(),
776
+ dark: color.dark || generateDarkColor(mainColor, theme),
777
+ light: color.light || generateLightColor(mainColor, theme),
778
+ highlight: color.highlight || generateHighlightColor(mainColor, theme),
779
+ contrast: color.contrast || contrast(mainColor),
780
+ };
781
+
782
+ return res;
783
+ };
784
+
785
+ const genColors = (colors) => {
786
+ return Object.keys(colors).reduce((acc, colorName) => {
787
+ const currentColor = colors[colorName];
788
+
789
+ return Object.assign(acc, {
790
+ [colorName]: genColor(currentColor),
791
+ });
792
+ }, {});
793
+ };
794
+
795
+ const useHostExternalPadding = (cssVarList) => `
796
+ :host {
797
+ padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
798
+ }
799
+ `;
800
+
801
+ const resetInputFieldUnderlayingBorder = (name) => `
802
+ ${name}::part(input-field)::after {
803
+ border: none;
804
+ }
805
+ `;
806
+
807
+ const resetInitialHeight = (name) => `
808
+ ${name}::before {
809
+ height: unset;
810
+ }
811
+ `;
812
+
813
+ const resetInputElement = (name) => `
814
+ ${name} > input {
815
+ -webkit-mask-image: none;
816
+ min-height: 0;
817
+ box-sizing: border-box;
818
+ }
819
+ `;
820
+
821
+ const resetInputContainer = (name) => `
822
+ ${name} {
823
+ margin: 0;
824
+ padding: 0;
825
+ width: 100%;
826
+ height: 100%;
827
+ box-sizing: border-box;
828
+ }
829
+ `;
830
+
831
+ const resetInputField = (name) => `
832
+ ${name}::part(input-field) {
833
+ overflow: hidden;
834
+ padding: 0;
835
+ box-shadow: none;
836
+ }
837
+ `;
838
+
839
+ const resetInputCursor = (name) => `
840
+ ${name} > label,
841
+ ${name}::part(label),
842
+ ${name}::part(required-indicator) {
843
+ cursor: pointer;
844
+ }
845
+ `;
846
+
847
+ const resetInputPlaceholder = (name, ele = 'input') => `
848
+ ${name}[disabled] > ${ele}:placeholder-shown,
849
+ ${name}[readonly] > ${ele}:placeholder-shown {
850
+ opacity: 1;
851
+ }
852
+ `;
853
+
854
+ const resetInputAutoFill = (name, cssVarList) => `
855
+ ${name} input:-webkit-autofill,
856
+ ${name} input:-webkit-autofill::first-line,
857
+ ${name} input:-webkit-autofill:hover,
858
+ ${name} input:-webkit-autofill:active,
859
+ ${name} input:-webkit-autofill:focus {
860
+ -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
861
+ box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
862
+ }
863
+ `;
864
+
865
+ const resetInputFieldDefaultWidth = () => `
866
+ :host {
867
+ --vaadin-field-default-width: auto;
868
+ box-sizing: border-box;
869
+ }
870
+ `;
871
+
872
+ const resetInputReadonlyStyle = (name) => `
873
+ ${name}::part(input-field)::after {
874
+ opacity: 0;
875
+ }
876
+ `;
877
+
878
+ const resetInputFieldInvalidBackgroundColor = (name) => `
879
+ ${name}::part(input-field)::after {
880
+ background: none;
881
+ }
882
+ `;
883
+
884
+ const resetInputOverrides = (name, cssVarList) => `
885
+ ${resetInputContainer(name)}
886
+ ${resetInputCursor(name)}
887
+ ${resetInputPlaceholder(name)}
888
+ ${resetInputField(name)}
889
+ ${resetInputAutoFill(name, cssVarList)}
890
+ ${resetInputFieldInvalidBackgroundColor(name)}
891
+ ${resetInitialHeight(name)}
892
+ ${resetInputElement(name)}
893
+ ${resetInputFieldUnderlayingBorder(name)}
894
+ `;
895
+
896
+ // This function is used to support RTL correctly for input components.
897
+ // It also fixes the error message to be displayed LTR since we currently
898
+ // don't support RTL for error messages.
899
+ const resetInputLabelPosition = (name) => `
900
+ :host ::part(error-message) {
901
+ direction: ltr;
902
+ }
903
+ :host([required]) ::part(required-indicator) {
904
+ width: 1em;
905
+ display: inline-flex;
906
+ }
907
+ :host([required]) ::part(required-indicator)::after {
908
+ position: static;
909
+ }
910
+ :host([has-label]) ::part(label) {
911
+ padding-right: 0;
912
+ padding-bottom: 0;
913
+ display: flex;
914
+ width: 100%;
915
+ }
916
+ ${name} [slot="label"] {
917
+ max-width: calc(100% - 1em);
918
+ overflow: hidden;
919
+ text-overflow: ellipsis;
920
+ padding-bottom: 0.5em;
921
+ }
922
+ `;
923
+
924
+ const inputFloatingLabelStyle = () => {
925
+ return `
926
+ :host([label-type="floating"]) {
927
+ position: relative;
928
+ }
929
+ :host([label-type="floating"][has-label]) > ::part(label) {
930
+ z-index: 1;
931
+ padding: 0;
932
+ width: auto;
933
+ }
934
+ `;
935
+ };
936
+
702
937
  const getVarName = (path) => getCssVarName$1(DESCOPE_PREFIX$1, ...path);
703
938
 
704
939
  // lodash.set alternative
@@ -761,6 +996,15 @@ const globalsThemeToStyle = (theme, themeName = '') => {
761
996
  return `*[data-theme="${themeName}"] {${style}}`;
762
997
  };
763
998
 
999
+ function splitAmpersands(str) {
1000
+ const match = str.match(/^(&+)?(.*)$/);
1001
+ return [match[1] || '', match[2] || ''];
1002
+ }
1003
+
1004
+ // st attributes are also using selector multiplication
1005
+ // so we need to limit the multiplication
1006
+ const MAX_SELECTOR_MULTIPLY = 3;
1007
+
764
1008
  const componentsThemeToStyleObj = (componentsTheme) =>
765
1009
  transformTheme(componentsTheme, [], (path, val) => {
766
1010
  const [component, ...restPath] = path;
@@ -785,11 +1029,22 @@ const componentsThemeToStyleObj = (componentsTheme) =>
785
1029
  // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
786
1030
  // starts with underscore -> attribute selector
787
1031
  const attrsSelector = restPath.reduce((acc, section, idx) => {
788
- if (section.startsWith('_')) return `${acc}[${kebabCase$1(section.replace(/^_/, ''))}="true"]`;
1032
+ const [ampersands, content] = splitAmpersands(section);
1033
+ const selectorMultiplier = Math.min(
1034
+ ampersands.length + 1, // if there are no & we need to multiply by 1
1035
+ MAX_SELECTOR_MULTIPLY
1036
+ );
1037
+
1038
+ if (content.startsWith('_'))
1039
+ return acc + `[${kebabCase$1(content.replace(/^_/, ''))}="true"]`.repeat(selectorMultiplier);
789
1040
 
790
1041
  const nextSection = restPath[idx + 1];
791
1042
 
792
- if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
1043
+ if (
1044
+ typeof nextSection !== 'string' ||
1045
+ nextSection.startsWith('_') ||
1046
+ nextSection.startsWith('&')
1047
+ ) {
793
1048
  // eslint-disable-next-line no-console
794
1049
  console.error(
795
1050
  'theme generator',
@@ -798,7 +1053,12 @@ const componentsThemeToStyleObj = (componentsTheme) =>
798
1053
  return acc;
799
1054
  }
800
1055
 
801
- return `${acc}[${kebabCase$1(section)}="${restPath.splice(idx + 1, 1).join('')}"]`;
1056
+ return (
1057
+ acc +
1058
+ `[${kebabCase$1(content)}="${restPath.splice(idx + 1, 1).join('')}"]`.repeat(
1059
+ selectorMultiplier
1060
+ )
1061
+ );
802
1062
  }, '');
803
1063
 
804
1064
  const selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
@@ -832,7 +1092,9 @@ const createComponentsTheme = (componentsTheme) => {
832
1092
  return Object.assign(acc, {
833
1093
  [componentName]: Object.keys(componentThemes).reduce(
834
1094
  (res, theme) =>
835
- Object.assign(res, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
1095
+ Object.assign(res, {
1096
+ [theme]: componentsThemeToStyle(componentThemes[theme]),
1097
+ }),
836
1098
  {}
837
1099
  ),
838
1100
  });
@@ -970,7 +1232,7 @@ const createCssVarsList$1 = (componentName, mappings) =>
970
1232
  // on some cases we need a selector to be more specific than another
971
1233
  // for this we have this fn that generate a class selector multiple times
972
1234
  const createClassSelectorSpecifier$1 = (className, numOfRepeats) =>
973
- Array(numOfRepeats).fill(`.${className}`).join('');
1235
+ `.${className}`.repeat(numOfRepeats);
974
1236
 
975
1237
  const STYLE_OVERRIDE_ATTR_PREFIX$1 = 'st';
976
1238
 
@@ -1046,10 +1308,16 @@ const createStyleMixin$1 =
1046
1308
 
1047
1309
  #createOverridesStyle() {
1048
1310
  if (this.#styleAttributes.length) {
1049
- const classSpecifier = createClassSelectorSpecifier$1(
1311
+ let classSpecifier = createClassSelectorSpecifier$1(
1050
1312
  componentName,
1051
1313
  CSS_SELECTOR_SPECIFIER_MULTIPLY$1
1052
1314
  );
1315
+ const elementId = this.getAttribute('id');
1316
+ if (elementId) {
1317
+ // basically this is enough to make the selector more specific
1318
+ // but just in case there is no id, we will also add the class multiple times
1319
+ classSpecifier += `#${elementId}`;
1320
+ }
1053
1321
 
1054
1322
  this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
1055
1323
  }
@@ -2434,148 +2702,6 @@ const booleanFieldMixin = (superclass) =>
2434
2702
  }
2435
2703
  };
2436
2704
 
2437
- const useHostExternalPadding = (cssVarList) => `
2438
- :host {
2439
- padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
2440
- }
2441
- `;
2442
-
2443
- const resetInputFieldUnderlayingBorder = (name) => `
2444
- ${name}::part(input-field)::after {
2445
- border: none;
2446
- }
2447
- `;
2448
-
2449
- const resetInitialHeight = (name) => `
2450
- ${name}::before {
2451
- height: unset;
2452
- }
2453
- `;
2454
-
2455
- const resetInputElement = (name) => `
2456
- ${name} > input {
2457
- -webkit-mask-image: none;
2458
- min-height: 0;
2459
- box-sizing: border-box;
2460
- }
2461
- `;
2462
-
2463
- const resetInputContainer = (name) => `
2464
- ${name} {
2465
- margin: 0;
2466
- padding: 0;
2467
- width: 100%;
2468
- height: 100%;
2469
- box-sizing: border-box;
2470
- }
2471
- `;
2472
-
2473
- const resetInputField = (name) => `
2474
- ${name}::part(input-field) {
2475
- overflow: hidden;
2476
- padding: 0;
2477
- box-shadow: none;
2478
- }
2479
- `;
2480
-
2481
- const resetInputCursor = (name) => `
2482
- ${name} > label,
2483
- ${name}::part(label),
2484
- ${name}::part(required-indicator) {
2485
- cursor: pointer;
2486
- }
2487
- `;
2488
-
2489
- const resetInputPlaceholder = (name, ele = 'input') => `
2490
- ${name}[disabled] > ${ele}:placeholder-shown,
2491
- ${name}[readonly] > ${ele}:placeholder-shown {
2492
- opacity: 1;
2493
- }
2494
- `;
2495
-
2496
- const resetInputAutoFill = (name, cssVarList) => `
2497
- ${name} input:-webkit-autofill,
2498
- ${name} input:-webkit-autofill::first-line,
2499
- ${name} input:-webkit-autofill:hover,
2500
- ${name} input:-webkit-autofill:active,
2501
- ${name} input:-webkit-autofill:focus {
2502
- -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
2503
- box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
2504
- }
2505
- `;
2506
-
2507
- const resetInputFieldDefaultWidth = () => `
2508
- :host {
2509
- --vaadin-field-default-width: auto;
2510
- box-sizing: border-box;
2511
- }
2512
- `;
2513
-
2514
- const resetInputReadonlyStyle = (name) => `
2515
- ${name}::part(input-field)::after {
2516
- opacity: 0;
2517
- }
2518
- `;
2519
-
2520
- const resetInputFieldInvalidBackgroundColor = (name) => `
2521
- ${name}::part(input-field)::after {
2522
- background: none;
2523
- }
2524
- `;
2525
-
2526
- const resetInputOverrides = (name, cssVarList) => `
2527
- ${resetInputContainer(name)}
2528
- ${resetInputCursor(name)}
2529
- ${resetInputPlaceholder(name)}
2530
- ${resetInputField(name)}
2531
- ${resetInputAutoFill(name, cssVarList)}
2532
- ${resetInputFieldInvalidBackgroundColor(name)}
2533
- ${resetInitialHeight(name)}
2534
- ${resetInputElement(name)}
2535
- ${resetInputFieldUnderlayingBorder(name)}
2536
- `;
2537
-
2538
- // This function is used to support RTL correctly for input components.
2539
- // It also fixes the error message to be displayed LTR since we currently
2540
- // don't support RTL for error messages.
2541
- const resetInputLabelPosition = (name) => `
2542
- :host ::part(error-message) {
2543
- direction: ltr;
2544
- }
2545
- :host([required]) ::part(required-indicator) {
2546
- width: 1em;
2547
- display: inline-flex;
2548
- }
2549
- :host([required]) ::part(required-indicator)::after {
2550
- position: static;
2551
- }
2552
- :host([has-label]) ::part(label) {
2553
- padding-right: 0;
2554
- padding-bottom: 0;
2555
- display: flex;
2556
- width: 100%;
2557
- }
2558
- ${name} [slot="label"] {
2559
- max-width: calc(100% - 1em);
2560
- overflow: hidden;
2561
- text-overflow: ellipsis;
2562
- padding-bottom: 0.5em;
2563
- }
2564
- `;
2565
-
2566
- const inputFloatingLabelStyle = () => {
2567
- return `
2568
- :host([label-type="floating"]) {
2569
- position: relative;
2570
- }
2571
- :host([label-type="floating"][has-label]) > ::part(label) {
2572
- z-index: 1;
2573
- padding: 0;
2574
- width: auto;
2575
- }
2576
- `;
2577
- };
2578
-
2579
2705
  var commonStyles = `
2580
2706
  :host {
2581
2707
  display: inline-flex;
@@ -3190,8 +3316,7 @@ const createCssVarsList = (componentName, mappings) =>
3190
3316
 
3191
3317
  // on some cases we need a selector to be more specific than another
3192
3318
  // for this we have this fn that generate a class selector multiple times
3193
- const createClassSelectorSpecifier = (className, numOfRepeats) =>
3194
- Array(numOfRepeats).fill(`.${className}`).join('');
3319
+ const createClassSelectorSpecifier = (className, numOfRepeats) => `.${className}`.repeat(numOfRepeats);
3195
3320
 
3196
3321
  const STYLE_OVERRIDE_ATTR_PREFIX = 'st';
3197
3322
 
@@ -3278,20 +3403,24 @@ const createStyleMixin =
3278
3403
 
3279
3404
  #createOverridesStyle() {
3280
3405
  if (this.#styleAttributes.length) {
3281
- const classSpecifier = createClassSelectorSpecifier(
3406
+ let classSpecifier = createClassSelectorSpecifier(
3282
3407
  componentName,
3283
- CSS_SELECTOR_SPECIFIER_MULTIPLY,
3408
+ CSS_SELECTOR_SPECIFIER_MULTIPLY
3284
3409
  );
3410
+ const elementId = this.getAttribute('id');
3411
+ if (elementId) {
3412
+ // basically this is enough to make the selector more specific
3413
+ // but just in case there is no id, we will also add the class multiple times
3414
+ classSpecifier += `#${elementId}`;
3415
+ }
3285
3416
 
3286
- this.#overrideStyleEle = injectStyle(
3287
- `:host(${classSpecifier}) {}`,
3288
- this.#rootElement,
3289
- );
3417
+ this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
3290
3418
  }
3291
3419
  }
3292
3420
 
3421
+
3293
3422
  #setAttrOverride(attrName, value) {
3294
- const style = this.#overrideStyleEle?.cssRules[0].style;
3423
+ const style = this.#overrideStyleEle?.cssRules[0]?.style;
3295
3424
 
3296
3425
  if (!style) return;
3297
3426
 
@@ -19128,99 +19257,6 @@ const HcaptchaClass = compose$1(
19128
19257
 
19129
19258
  customElements.define(componentName$g, HcaptchaClass);
19130
19259
 
19131
- const colorGaps = {
19132
- darkLight: 0.4,
19133
- highlight: 0.8,
19134
- contrast: 1,
19135
- edgeColor: {
19136
- darkLight: 0.25,
19137
- highlight: 0.1,
19138
- },
19139
- };
19140
-
19141
- const darken = (c, percentage) => c.darken(percentage).hex();
19142
-
19143
- const contrast = (c) => {
19144
- const isDark = c.isDark();
19145
- return c
19146
- .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
19147
- .saturate(1)
19148
- .hex();
19149
- };
19150
-
19151
- const lighten = (c, percentage) => {
19152
- const isDark = c.lightness() < 0.5;
19153
-
19154
- if (isDark) {
19155
- return c.lightness(percentage * 100).hex();
19156
- }
19157
-
19158
- return c.lighten(percentage).hex();
19159
- };
19160
-
19161
- const isNearBlack = (color) => color.luminosity() < 0.01;
19162
- const isNearWhite = (color) => color.luminosity() > 0.99;
19163
-
19164
- const generateDarkColor = (color, theme) => {
19165
- if (theme === 'dark') {
19166
- return isNearWhite(color)
19167
- ? darken(color, colorGaps.edgeColor.darkLight)
19168
- : lighten(color, colorGaps.darkLight);
19169
- }
19170
-
19171
- return isNearBlack(color)
19172
- ? lighten(color, colorGaps.edgeColor.darkLight)
19173
- : darken(color, colorGaps.darkLight);
19174
- };
19175
-
19176
- const generateLightColor = (color, theme) => {
19177
- if (theme === 'dark') {
19178
- return isNearBlack(color)
19179
- ? lighten(color, colorGaps.edgeColor.darkLight)
19180
- : darken(color, colorGaps.darkLight);
19181
- }
19182
-
19183
- return isNearWhite(color)
19184
- ? darken(color, colorGaps.edgeColor.darkLight)
19185
- : lighten(color, colorGaps.darkLight);
19186
- };
19187
-
19188
- const generateHighlightColor = (color, theme) => {
19189
- if (theme === 'dark') {
19190
- return isNearBlack(color)
19191
- ? lighten(color, colorGaps.edgeColor.highlight)
19192
- : darken(color, colorGaps.highlight);
19193
- }
19194
-
19195
- return isNearWhite(color)
19196
- ? darken(color, colorGaps.edgeColor.highlight)
19197
- : lighten(color, colorGaps.highlight);
19198
- };
19199
-
19200
- const genColor = (color, theme) => {
19201
- const mainColor = new Color(color.main || color);
19202
-
19203
- const res = {
19204
- main: mainColor.hex(),
19205
- dark: color.dark || generateDarkColor(mainColor, theme),
19206
- light: color.light || generateLightColor(mainColor, theme),
19207
- highlight: color.highlight || generateHighlightColor(mainColor, theme),
19208
- contrast: color.contrast || contrast(mainColor),
19209
- };
19210
-
19211
- return res;
19212
- };
19213
-
19214
- const genColors = (colors) => {
19215
- return Object.keys(colors).reduce((acc, colorName) => {
19216
- const currentColor = colors[colorName];
19217
-
19218
- return Object.assign(acc, {
19219
- [colorName]: genColor(currentColor),
19220
- });
19221
- }, {});
19222
- };
19223
-
19224
19260
  const direction$1 = 'ltr';
19225
19261
 
19226
19262
  const colors$2 = genColors({
@@ -20357,7 +20393,8 @@ const container = {
20357
20393
  },
20358
20394
  },
20359
20395
 
20360
- borderRadius: {
20396
+ // we must add & to override the root container style (applied via the styles page)
20397
+ '&borderRadius': {
20361
20398
  sm: { [compVars$8.borderRadius]: globalRefs$B.radius.sm },
20362
20399
  md: { [compVars$8.borderRadius]: globalRefs$B.radius.md },
20363
20400
  lg: { [compVars$8.borderRadius]: globalRefs$B.radius.lg },