@descope/web-components-ui 1.134.0 → 1.136.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 (73) hide show
  1. package/dist/cjs/index.cjs.js +360 -308
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +358 -321
  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-date-field-index-js.js +1 -1
  24. package/dist/umd/descope-date-field-index-js.js.map +1 -1
  25. package/dist/umd/descope-email-field-index-js.js +4 -4
  26. package/dist/umd/descope-email-field-index-js.js.map +1 -1
  27. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
  28. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js.map +1 -1
  29. package/dist/umd/descope-grid-index-js.js +1 -1
  30. package/dist/umd/descope-grid-index-js.js.map +1 -1
  31. package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
  32. package/dist/umd/descope-multi-select-combo-box-index-js.js.map +1 -1
  33. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
  34. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js.map +1 -1
  35. package/dist/umd/descope-new-password-index-js.js +1 -1
  36. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  37. package/dist/umd/descope-number-field-index-js.js +1 -1
  38. package/dist/umd/descope-number-field-index-js.js.map +1 -1
  39. package/dist/umd/descope-passcode-index-js.js +2 -2
  40. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  41. package/dist/umd/descope-password-index-js.js +1 -1
  42. package/dist/umd/descope-password-index-js.js.map +1 -1
  43. package/dist/umd/descope-radio-group-index-js.js +1 -1
  44. package/dist/umd/descope-radio-group-index-js.js.map +1 -1
  45. package/dist/umd/descope-scopes-list-index-js.js +1 -1
  46. package/dist/umd/descope-scopes-list-index-js.js.map +1 -1
  47. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  48. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  49. package/dist/umd/descope-security-questions-verify-index-js.js +2 -2
  50. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  51. package/dist/umd/descope-text-area-index-js.js +1 -1
  52. package/dist/umd/descope-text-area-index-js.js.map +1 -1
  53. package/dist/umd/descope-text-field-index-js.js +2 -2
  54. package/dist/umd/descope-text-field-index-js.js.map +1 -1
  55. package/dist/umd/index.js +1 -1
  56. package/dist/umd/index.js.map +1 -1
  57. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  58. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  59. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  60. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  61. package/package.json +24 -24
  62. package/src/components/descope-date-field/DateFieldClass.js +1 -1
  63. package/src/components/descope-date-field/date-utils.js +24 -0
  64. package/src/components/descope-date-field/descope-calendar/CalendarClass.js +1 -1
  65. package/src/components/descope-date-field/descope-calendar/helpers.js +2 -1
  66. package/src/components/descope-date-field/formats.js +1 -1
  67. package/src/components/descope-date-field/helpers.js +1 -25
  68. package/src/constants.js +1 -1
  69. package/src/helpers/themeHelpers/index.js +33 -4
  70. package/src/mixins/createStyleMixin/helpers.js +1 -1
  71. package/src/mixins/createStyleMixin/index.js +7 -1
  72. package/src/theme/components/container.js +2 -1
  73. package/dist/umd/2739.js.map +0 -1
@@ -32,7 +32,7 @@ var zxcvbnCommonPackage__namespace = /*#__PURE__*/_interopNamespaceDefault(zxcvb
32
32
  var zxcvbnEnPackage__namespace = /*#__PURE__*/_interopNamespaceDefault(zxcvbnEnPackage);
33
33
 
34
34
  const DESCOPE_PREFIX$1 = 'descope';
35
- const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 3;
35
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY$1 = 5;
36
36
  const BASE_THEME_SECTION$1 = 'host';
37
37
  const PORTAL_THEME_PREFIX$1 = '@';
38
38
 
@@ -199,7 +199,7 @@ const forwardProps$3 = (src, target, props = []) => {
199
199
  };
200
200
 
201
201
  const DESCOPE_PREFIX = 'descope';
202
- const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
202
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY = 5;
203
203
  const BASE_THEME_SECTION = 'host';
204
204
 
205
205
  const kebabCase = (str) =>
@@ -643,6 +643,241 @@ const createHelperVars$1 = (theme, prefix) => {
643
643
  return [res.theme, res.useVars, res.vars];
644
644
  };
645
645
 
646
+ const colorGaps = {
647
+ darkLight: 0.4,
648
+ highlight: 0.8,
649
+ contrast: 1,
650
+ edgeColor: {
651
+ darkLight: 0.25,
652
+ highlight: 0.1,
653
+ },
654
+ };
655
+
656
+ const darken = (c, percentage) => c.darken(percentage).hex();
657
+
658
+ const contrast = (c) => {
659
+ const isDark = c.isDark();
660
+ return c
661
+ .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
662
+ .saturate(1)
663
+ .hex();
664
+ };
665
+
666
+ const lighten = (c, percentage) => {
667
+ const isDark = c.lightness() < 0.5;
668
+
669
+ if (isDark) {
670
+ return c.lightness(percentage * 100).hex();
671
+ }
672
+
673
+ return c.lighten(percentage).hex();
674
+ };
675
+
676
+ const isNearBlack = (color) => color.luminosity() < 0.01;
677
+ const isNearWhite = (color) => color.luminosity() > 0.99;
678
+
679
+ const generateDarkColor = (color, theme) => {
680
+ if (theme === 'dark') {
681
+ return isNearWhite(color)
682
+ ? darken(color, colorGaps.edgeColor.darkLight)
683
+ : lighten(color, colorGaps.darkLight);
684
+ }
685
+
686
+ return isNearBlack(color)
687
+ ? lighten(color, colorGaps.edgeColor.darkLight)
688
+ : darken(color, colorGaps.darkLight);
689
+ };
690
+
691
+ const generateLightColor = (color, theme) => {
692
+ if (theme === 'dark') {
693
+ return isNearBlack(color)
694
+ ? lighten(color, colorGaps.edgeColor.darkLight)
695
+ : darken(color, colorGaps.darkLight);
696
+ }
697
+
698
+ return isNearWhite(color)
699
+ ? darken(color, colorGaps.edgeColor.darkLight)
700
+ : lighten(color, colorGaps.darkLight);
701
+ };
702
+
703
+ const generateHighlightColor = (color, theme) => {
704
+ if (theme === 'dark') {
705
+ return isNearBlack(color)
706
+ ? lighten(color, colorGaps.edgeColor.highlight)
707
+ : darken(color, colorGaps.highlight);
708
+ }
709
+
710
+ return isNearWhite(color)
711
+ ? darken(color, colorGaps.edgeColor.highlight)
712
+ : lighten(color, colorGaps.highlight);
713
+ };
714
+
715
+ const genColor = (color, theme) => {
716
+ const mainColor = new Color(color.main || color);
717
+
718
+ const res = {
719
+ main: mainColor.hex(),
720
+ dark: color.dark || generateDarkColor(mainColor, theme),
721
+ light: color.light || generateLightColor(mainColor, theme),
722
+ highlight: color.highlight || generateHighlightColor(mainColor, theme),
723
+ contrast: color.contrast || contrast(mainColor),
724
+ };
725
+
726
+ return res;
727
+ };
728
+
729
+ const genColors = (colors) => {
730
+ return Object.keys(colors).reduce((acc, colorName) => {
731
+ const currentColor = colors[colorName];
732
+
733
+ return Object.assign(acc, {
734
+ [colorName]: genColor(currentColor),
735
+ });
736
+ }, {});
737
+ };
738
+
739
+ const useHostExternalPadding = (cssVarList) => `
740
+ :host {
741
+ padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
742
+ }
743
+ `;
744
+
745
+ const resetInputFieldUnderlayingBorder = (name) => `
746
+ ${name}::part(input-field)::after {
747
+ border: none;
748
+ }
749
+ `;
750
+
751
+ const resetInitialHeight = (name) => `
752
+ ${name}::before {
753
+ height: unset;
754
+ }
755
+ `;
756
+
757
+ const resetInputElement = (name) => `
758
+ ${name} > input {
759
+ -webkit-mask-image: none;
760
+ min-height: 0;
761
+ box-sizing: border-box;
762
+ }
763
+ `;
764
+
765
+ const resetInputContainer = (name) => `
766
+ ${name} {
767
+ margin: 0;
768
+ padding: 0;
769
+ width: 100%;
770
+ height: 100%;
771
+ box-sizing: border-box;
772
+ }
773
+ `;
774
+
775
+ const resetInputField = (name) => `
776
+ ${name}::part(input-field) {
777
+ overflow: hidden;
778
+ padding: 0;
779
+ box-shadow: none;
780
+ }
781
+ `;
782
+
783
+ const resetInputCursor = (name) => `
784
+ ${name} > label,
785
+ ${name}::part(label),
786
+ ${name}::part(required-indicator) {
787
+ cursor: pointer;
788
+ }
789
+ `;
790
+
791
+ const resetInputPlaceholder = (name, ele = 'input') => `
792
+ ${name}[disabled] > ${ele}:placeholder-shown,
793
+ ${name}[readonly] > ${ele}:placeholder-shown {
794
+ opacity: 1;
795
+ }
796
+ `;
797
+
798
+ const resetInputAutoFill = (name, cssVarList) => `
799
+ ${name} input:-webkit-autofill,
800
+ ${name} input:-webkit-autofill::first-line,
801
+ ${name} input:-webkit-autofill:hover,
802
+ ${name} input:-webkit-autofill:active,
803
+ ${name} input:-webkit-autofill:focus {
804
+ -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
805
+ box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
806
+ }
807
+ `;
808
+
809
+ const resetInputFieldDefaultWidth = () => `
810
+ :host {
811
+ --vaadin-field-default-width: auto;
812
+ box-sizing: border-box;
813
+ }
814
+ `;
815
+
816
+ const resetInputReadonlyStyle = (name) => `
817
+ ${name}::part(input-field)::after {
818
+ opacity: 0;
819
+ }
820
+ `;
821
+
822
+ const resetInputFieldInvalidBackgroundColor = (name) => `
823
+ ${name}::part(input-field)::after {
824
+ background: none;
825
+ }
826
+ `;
827
+
828
+ const resetInputOverrides = (name, cssVarList) => `
829
+ ${resetInputContainer(name)}
830
+ ${resetInputCursor(name)}
831
+ ${resetInputPlaceholder(name)}
832
+ ${resetInputField(name)}
833
+ ${resetInputAutoFill(name, cssVarList)}
834
+ ${resetInputFieldInvalidBackgroundColor(name)}
835
+ ${resetInitialHeight(name)}
836
+ ${resetInputElement(name)}
837
+ ${resetInputFieldUnderlayingBorder(name)}
838
+ `;
839
+
840
+ // This function is used to support RTL correctly for input components.
841
+ // It also fixes the error message to be displayed LTR since we currently
842
+ // don't support RTL for error messages.
843
+ const resetInputLabelPosition = (name) => `
844
+ :host ::part(error-message) {
845
+ direction: ltr;
846
+ }
847
+ :host([required]) ::part(required-indicator) {
848
+ width: 1em;
849
+ display: inline-flex;
850
+ }
851
+ :host([required]) ::part(required-indicator)::after {
852
+ position: static;
853
+ }
854
+ :host([has-label]) ::part(label) {
855
+ padding-right: 0;
856
+ padding-bottom: 0;
857
+ display: flex;
858
+ width: 100%;
859
+ }
860
+ ${name} [slot="label"] {
861
+ max-width: calc(100% - 1em);
862
+ overflow: hidden;
863
+ text-overflow: ellipsis;
864
+ padding-bottom: 0.5em;
865
+ }
866
+ `;
867
+
868
+ const inputFloatingLabelStyle = () => {
869
+ return `
870
+ :host([label-type="floating"]) {
871
+ position: relative;
872
+ }
873
+ :host([label-type="floating"][has-label]) > ::part(label) {
874
+ z-index: 1;
875
+ padding: 0;
876
+ width: auto;
877
+ }
878
+ `;
879
+ };
880
+
646
881
  const getVarName = (path) => getCssVarName$1(DESCOPE_PREFIX$1, ...path);
647
882
 
648
883
  // lodash.set alternative
@@ -705,6 +940,15 @@ const globalsThemeToStyle = (theme, themeName = '') => {
705
940
  return `*[data-theme="${themeName}"] {${style}}`;
706
941
  };
707
942
 
943
+ function splitAmpersands(str) {
944
+ const match = str.match(/^(&+)?(.*)$/);
945
+ return [match[1] || '', match[2] || ''];
946
+ }
947
+
948
+ // st attributes are also using selector multiplication
949
+ // so we need to limit the multiplication
950
+ const MAX_SELECTOR_MULTIPLY = 3;
951
+
708
952
  const componentsThemeToStyleObj = (componentsTheme) =>
709
953
  transformTheme(componentsTheme, [], (path, val) => {
710
954
  const [component, ...restPath] = path;
@@ -729,11 +973,22 @@ const componentsThemeToStyleObj = (componentsTheme) =>
729
973
  // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
730
974
  // starts with underscore -> attribute selector
731
975
  const attrsSelector = restPath.reduce((acc, section, idx) => {
732
- if (section.startsWith('_')) return `${acc}[${kebabCase$1(section.replace(/^_/, ''))}="true"]`;
976
+ const [ampersands, content] = splitAmpersands(section);
977
+ const selectorMultiplier = Math.min(
978
+ ampersands.length + 1, // if there are no & we need to multiply by 1
979
+ MAX_SELECTOR_MULTIPLY
980
+ );
981
+
982
+ if (content.startsWith('_'))
983
+ return acc + `[${kebabCase$1(content.replace(/^_/, ''))}="true"]`.repeat(selectorMultiplier);
733
984
 
734
985
  const nextSection = restPath[idx + 1];
735
986
 
736
- if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
987
+ if (
988
+ typeof nextSection !== 'string' ||
989
+ nextSection.startsWith('_') ||
990
+ nextSection.startsWith('&')
991
+ ) {
737
992
  // eslint-disable-next-line no-console
738
993
  console.error(
739
994
  'theme generator',
@@ -742,7 +997,12 @@ const componentsThemeToStyleObj = (componentsTheme) =>
742
997
  return acc;
743
998
  }
744
999
 
745
- return `${acc}[${kebabCase$1(section)}="${restPath.splice(idx + 1, 1).join('')}"]`;
1000
+ return (
1001
+ acc +
1002
+ `[${kebabCase$1(content)}="${restPath.splice(idx + 1, 1).join('')}"]`.repeat(
1003
+ selectorMultiplier
1004
+ )
1005
+ );
746
1006
  }, '');
747
1007
 
748
1008
  const selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
@@ -770,139 +1030,48 @@ const componentsThemeToStyle = (componentsTheme) =>
770
1030
  const createComponentsTheme = (componentsTheme) => {
771
1031
  const styleObj = componentsThemeToStyleObj(componentsTheme);
772
1032
 
773
- return Object.keys(styleObj).reduce((acc, componentName) => {
774
- const componentThemes = styleObj[componentName];
775
-
776
- return Object.assign(acc, {
777
- [componentName]: Object.keys(componentThemes).reduce(
778
- (res, theme) =>
779
- Object.assign(res, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
780
- {}
781
- ),
782
- });
783
- }, {});
784
- };
785
-
786
- const themeToStyle = ({ globals, components }, themeName) => ({
787
- globals: globalsThemeToStyle(globals, themeName),
788
- components: createComponentsTheme(components),
789
- });
790
-
791
- // allows to generate css variables with nested fallbacks
792
- const useVar = (...varNames) => {
793
- return varNames.reduceRight((acc, value) => {
794
- if (value.startsWith('--')) return `var(${value}${acc ? `, ${acc}` : acc})`;
795
-
796
- return `${value}${acc ? `, ${acc}` : acc}`;
797
- }, '');
798
- };
799
-
800
- const createHelperVars = (theme, prefix) => {
801
- const res = transformTheme(theme, [], (path, value) => {
802
- const modifiedPath = [...path];
803
- const property = modifiedPath.splice(-1);
804
- const varName = getCssVarName$1(prefix, property);
805
-
806
- const vars = { [property]: varName };
807
- const useVars = { [property]: useVar(varName) };
808
-
809
- return { theme: set({}, [...modifiedPath, varName], value), useVars, vars };
810
- });
811
-
812
- return [res.theme, res.useVars, res.vars];
813
- };
814
-
815
- const colorGaps = {
816
- darkLight: 0.4,
817
- highlight: 0.8,
818
- contrast: 1,
819
- edgeColor: {
820
- darkLight: 0.25,
821
- highlight: 0.1,
822
- },
823
- };
824
-
825
- const darken = (c, percentage) => c.darken(percentage).hex();
826
-
827
- const contrast = (c) => {
828
- const isDark = c.isDark();
829
- return c
830
- .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
831
- .saturate(1)
832
- .hex();
833
- };
834
-
835
- const lighten = (c, percentage) => {
836
- const isDark = c.lightness() < 0.5;
837
-
838
- if (isDark) {
839
- return c.lightness(percentage * 100).hex();
840
- }
841
-
842
- return c.lighten(percentage).hex();
843
- };
844
-
845
- const isNearBlack = (color) => color.luminosity() < 0.01;
846
- const isNearWhite = (color) => color.luminosity() > 0.99;
847
-
848
- const generateDarkColor = (color, theme) => {
849
- if (theme === 'dark') {
850
- return isNearWhite(color)
851
- ? darken(color, colorGaps.edgeColor.darkLight)
852
- : lighten(color, colorGaps.darkLight);
853
- }
854
-
855
- return isNearBlack(color)
856
- ? lighten(color, colorGaps.edgeColor.darkLight)
857
- : darken(color, colorGaps.darkLight);
858
- };
859
-
860
- const generateLightColor = (color, theme) => {
861
- if (theme === 'dark') {
862
- return isNearBlack(color)
863
- ? lighten(color, colorGaps.edgeColor.darkLight)
864
- : darken(color, colorGaps.darkLight);
865
- }
866
-
867
- return isNearWhite(color)
868
- ? darken(color, colorGaps.edgeColor.darkLight)
869
- : lighten(color, colorGaps.darkLight);
870
- };
871
-
872
- const generateHighlightColor = (color, theme) => {
873
- if (theme === 'dark') {
874
- return isNearBlack(color)
875
- ? lighten(color, colorGaps.edgeColor.highlight)
876
- : darken(color, colorGaps.highlight);
877
- }
1033
+ return Object.keys(styleObj).reduce((acc, componentName) => {
1034
+ const componentThemes = styleObj[componentName];
878
1035
 
879
- return isNearWhite(color)
880
- ? darken(color, colorGaps.edgeColor.highlight)
881
- : lighten(color, colorGaps.highlight);
1036
+ return Object.assign(acc, {
1037
+ [componentName]: Object.keys(componentThemes).reduce(
1038
+ (res, theme) =>
1039
+ Object.assign(res, {
1040
+ [theme]: componentsThemeToStyle(componentThemes[theme]),
1041
+ }),
1042
+ {}
1043
+ ),
1044
+ });
1045
+ }, {});
882
1046
  };
883
1047
 
884
- const genColor = (color, theme) => {
885
- const mainColor = new Color(color.main || color);
1048
+ const themeToStyle = ({ globals, components }, themeName) => ({
1049
+ globals: globalsThemeToStyle(globals, themeName),
1050
+ components: createComponentsTheme(components),
1051
+ });
886
1052
 
887
- const res = {
888
- main: mainColor.hex(),
889
- dark: color.dark || generateDarkColor(mainColor, theme),
890
- light: color.light || generateLightColor(mainColor, theme),
891
- highlight: color.highlight || generateHighlightColor(mainColor, theme),
892
- contrast: color.contrast || contrast(mainColor),
893
- };
1053
+ // allows to generate css variables with nested fallbacks
1054
+ const useVar = (...varNames) => {
1055
+ return varNames.reduceRight((acc, value) => {
1056
+ if (value.startsWith('--')) return `var(${value}${acc ? `, ${acc}` : acc})`;
894
1057
 
895
- return res;
1058
+ return `${value}${acc ? `, ${acc}` : acc}`;
1059
+ }, '');
896
1060
  };
897
1061
 
898
- const genColors = (colors) => {
899
- return Object.keys(colors).reduce((acc, colorName) => {
900
- const currentColor = colors[colorName];
1062
+ const createHelperVars = (theme, prefix) => {
1063
+ const res = transformTheme(theme, [], (path, value) => {
1064
+ const modifiedPath = [...path];
1065
+ const property = modifiedPath.splice(-1);
1066
+ const varName = getCssVarName$1(prefix, property);
901
1067
 
902
- return Object.assign(acc, {
903
- [colorName]: genColor(currentColor),
904
- });
905
- }, {});
1068
+ const vars = { [property]: varName };
1069
+ const useVars = { [property]: useVar(varName) };
1070
+
1071
+ return { theme: set({}, [...modifiedPath, varName], value), useVars, vars };
1072
+ });
1073
+
1074
+ return [res.theme, res.useVars, res.vars];
906
1075
  };
907
1076
 
908
1077
  const direction$1 = 'ltr';
@@ -1374,8 +1543,7 @@ const createCssVarsList$1 = (componentName, mappings) =>
1374
1543
 
1375
1544
  // on some cases we need a selector to be more specific than another
1376
1545
  // for this we have this fn that generate a class selector multiple times
1377
- const createClassSelectorSpecifier$1 = (className, numOfRepeats) =>
1378
- Array(numOfRepeats).fill(`.${className}`).join('');
1546
+ const createClassSelectorSpecifier$1 = (className, numOfRepeats) => `.${className}`.repeat(numOfRepeats);
1379
1547
 
1380
1548
  const STYLE_OVERRIDE_ATTR_PREFIX$1 = 'st';
1381
1549
 
@@ -1462,18 +1630,22 @@ const createStyleMixin$1 =
1462
1630
 
1463
1631
  #createOverridesStyle() {
1464
1632
  if (this.#styleAttributes.length) {
1465
- const classSpecifier = createClassSelectorSpecifier$1(
1633
+ let classSpecifier = createClassSelectorSpecifier$1(
1466
1634
  componentName,
1467
- CSS_SELECTOR_SPECIFIER_MULTIPLY,
1635
+ CSS_SELECTOR_SPECIFIER_MULTIPLY
1468
1636
  );
1637
+ const elementId = this.getAttribute('id');
1638
+ if (elementId) {
1639
+ // basically this is enough to make the selector more specific
1640
+ // but just in case there is no id, we will also add the class multiple times
1641
+ classSpecifier += `#${elementId}`;
1642
+ }
1469
1643
 
1470
- this.#overrideStyleEle = injectStyle(
1471
- `:host(${classSpecifier}) {}`,
1472
- this.#rootElement,
1473
- );
1644
+ this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
1474
1645
  }
1475
1646
  }
1476
1647
 
1648
+
1477
1649
  #setAttrOverride(attrName, value) {
1478
1650
  const style = this.#overrideStyleEle?.cssRules[0].style;
1479
1651
 
@@ -3377,7 +3549,7 @@ const createCssVarsList = (componentName, mappings) =>
3377
3549
  // on some cases we need a selector to be more specific than another
3378
3550
  // for this we have this fn that generate a class selector multiple times
3379
3551
  const createClassSelectorSpecifier = (className, numOfRepeats) =>
3380
- Array(numOfRepeats).fill(`.${className}`).join('');
3552
+ `.${className}`.repeat(numOfRepeats);
3381
3553
 
3382
3554
  const STYLE_OVERRIDE_ATTR_PREFIX = 'st';
3383
3555
 
@@ -3453,10 +3625,16 @@ const createStyleMixin =
3453
3625
 
3454
3626
  #createOverridesStyle() {
3455
3627
  if (this.#styleAttributes.length) {
3456
- const classSpecifier = createClassSelectorSpecifier(
3628
+ let classSpecifier = createClassSelectorSpecifier(
3457
3629
  componentName,
3458
3630
  CSS_SELECTOR_SPECIFIER_MULTIPLY$1
3459
3631
  );
3632
+ const elementId = this.getAttribute('id');
3633
+ if (elementId) {
3634
+ // basically this is enough to make the selector more specific
3635
+ // but just in case there is no id, we will also add the class multiple times
3636
+ classSpecifier += `#${elementId}`;
3637
+ }
3460
3638
 
3461
3639
  this.#overrideStyleEle = injectStyle(`:host(${classSpecifier}) {}`, this.#rootElement);
3462
3640
  }
@@ -4879,148 +5057,6 @@ var textFieldMappings = {
4879
5057
  inputIconColor: { ...inputIcon, property: 'color' },
4880
5058
  };
4881
5059
 
4882
- const useHostExternalPadding = (cssVarList) => `
4883
- :host {
4884
- padding: calc(var(${cssVarList.inputOutlineWidth}) + var(${cssVarList.inputOutlineOffset}))
4885
- }
4886
- `;
4887
-
4888
- const resetInputFieldUnderlayingBorder = (name) => `
4889
- ${name}::part(input-field)::after {
4890
- border: none;
4891
- }
4892
- `;
4893
-
4894
- const resetInitialHeight = (name) => `
4895
- ${name}::before {
4896
- height: unset;
4897
- }
4898
- `;
4899
-
4900
- const resetInputElement = (name) => `
4901
- ${name} > input {
4902
- -webkit-mask-image: none;
4903
- min-height: 0;
4904
- box-sizing: border-box;
4905
- }
4906
- `;
4907
-
4908
- const resetInputContainer = (name) => `
4909
- ${name} {
4910
- margin: 0;
4911
- padding: 0;
4912
- width: 100%;
4913
- height: 100%;
4914
- box-sizing: border-box;
4915
- }
4916
- `;
4917
-
4918
- const resetInputField = (name) => `
4919
- ${name}::part(input-field) {
4920
- overflow: hidden;
4921
- padding: 0;
4922
- box-shadow: none;
4923
- }
4924
- `;
4925
-
4926
- const resetInputCursor = (name) => `
4927
- ${name} > label,
4928
- ${name}::part(label),
4929
- ${name}::part(required-indicator) {
4930
- cursor: pointer;
4931
- }
4932
- `;
4933
-
4934
- const resetInputPlaceholder = (name, ele = 'input') => `
4935
- ${name}[disabled] > ${ele}:placeholder-shown,
4936
- ${name}[readonly] > ${ele}:placeholder-shown {
4937
- opacity: 1;
4938
- }
4939
- `;
4940
-
4941
- const resetInputAutoFill = (name, cssVarList) => `
4942
- ${name} input:-webkit-autofill,
4943
- ${name} input:-webkit-autofill::first-line,
4944
- ${name} input:-webkit-autofill:hover,
4945
- ${name} input:-webkit-autofill:active,
4946
- ${name} input:-webkit-autofill:focus {
4947
- -webkit-text-fill-color: var(${cssVarList.inputValueTextColor});
4948
- box-shadow: 0 0 0 var(${cssVarList.inputHeight}) var(${cssVarList.inputBackgroundColor}) inset;
4949
- }
4950
- `;
4951
-
4952
- const resetInputFieldDefaultWidth = () => `
4953
- :host {
4954
- --vaadin-field-default-width: auto;
4955
- box-sizing: border-box;
4956
- }
4957
- `;
4958
-
4959
- const resetInputReadonlyStyle = (name) => `
4960
- ${name}::part(input-field)::after {
4961
- opacity: 0;
4962
- }
4963
- `;
4964
-
4965
- const resetInputFieldInvalidBackgroundColor = (name) => `
4966
- ${name}::part(input-field)::after {
4967
- background: none;
4968
- }
4969
- `;
4970
-
4971
- const resetInputOverrides = (name, cssVarList) => `
4972
- ${resetInputContainer(name)}
4973
- ${resetInputCursor(name)}
4974
- ${resetInputPlaceholder(name)}
4975
- ${resetInputField(name)}
4976
- ${resetInputAutoFill(name, cssVarList)}
4977
- ${resetInputFieldInvalidBackgroundColor(name)}
4978
- ${resetInitialHeight(name)}
4979
- ${resetInputElement(name)}
4980
- ${resetInputFieldUnderlayingBorder(name)}
4981
- `;
4982
-
4983
- // This function is used to support RTL correctly for input components.
4984
- // It also fixes the error message to be displayed LTR since we currently
4985
- // don't support RTL for error messages.
4986
- const resetInputLabelPosition = (name) => `
4987
- :host ::part(error-message) {
4988
- direction: ltr;
4989
- }
4990
- :host([required]) ::part(required-indicator) {
4991
- width: 1em;
4992
- display: inline-flex;
4993
- }
4994
- :host([required]) ::part(required-indicator)::after {
4995
- position: static;
4996
- }
4997
- :host([has-label]) ::part(label) {
4998
- padding-right: 0;
4999
- padding-bottom: 0;
5000
- display: flex;
5001
- width: 100%;
5002
- }
5003
- ${name} [slot="label"] {
5004
- max-width: calc(100% - 1em);
5005
- overflow: hidden;
5006
- text-overflow: ellipsis;
5007
- padding-bottom: 0.5em;
5008
- }
5009
- `;
5010
-
5011
- const inputFloatingLabelStyle = () => {
5012
- return `
5013
- :host([label-type="floating"]) {
5014
- position: relative;
5015
- }
5016
- :host([label-type="floating"][has-label]) > ::part(label) {
5017
- z-index: 1;
5018
- padding: 0;
5019
- width: auto;
5020
- }
5021
- `;
5022
- };
5023
-
5024
5060
  const componentName$1c = getComponentName$1('text-field');
5025
5061
 
5026
5062
  const observedAttrs$4 = ['type', 'label-type', 'copy-to-clipboard'];
@@ -6734,7 +6770,8 @@ const container = {
6734
6770
  },
6735
6771
  },
6736
6772
 
6737
- borderRadius: {
6773
+ // we must add & to override the root container style (applied via the styles page)
6774
+ '&borderRadius': {
6738
6775
  sm: { [compVars$8.borderRadius]: globalRefs$B.radius.sm },
6739
6776
  md: { [compVars$8.borderRadius]: globalRefs$B.radius.md },
6740
6777
  lg: { [compVars$8.borderRadius]: globalRefs$B.radius.lg },
@@ -15959,6 +15996,31 @@ const CALENDAR_LABEL_TODAY = 'Today';
15959
15996
 
15960
15997
  const MOBILE_DEVICE_INTERACTION_TIMEOUT_MS = 150;
15961
15998
 
15999
+ // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
16000
+ const newDate = (date, isUtcTime) => {
16001
+ if (typeof date === 'number') {
16002
+ return new Date(date);
16003
+ }
16004
+ if (typeof date === 'string') {
16005
+ const d = new Date(date.replace(/-/g, '/'));
16006
+ if (isUtcTime) {
16007
+ return new Date(
16008
+ Date.UTC(
16009
+ d.getFullYear(),
16010
+ d.getMonth(),
16011
+ d.getDate(),
16012
+ d.getHours(),
16013
+ d.getMinutes(),
16014
+ d.getSeconds(),
16015
+ d.getMilliseconds()
16016
+ )
16017
+ );
16018
+ }
16019
+ return new Date(d);
16020
+ }
16021
+ return new Date();
16022
+ };
16023
+
15962
16024
  const patterns = {
15963
16025
  MM: '(0?[1-9]|1[0-2])',
15964
16026
  DD: '(0?[1-9]|[12][0-9]|3[01])',
@@ -16030,31 +16092,6 @@ const formatEpoch = (epoch, format) => {
16030
16092
  return format.replace(/DD|MM|YYYY/g, (match) => parts[match]);
16031
16093
  };
16032
16094
 
16033
- // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
16034
- const newDate = (date, isUtcTime) => {
16035
- if (typeof date === 'number') {
16036
- return new Date(date);
16037
- }
16038
- if (typeof date === 'string') {
16039
- const d = new Date(date.replace(/-/g, '/'));
16040
- if (isUtcTime) {
16041
- return new Date(
16042
- Date.UTC(
16043
- d.getFullYear(),
16044
- d.getMonth(),
16045
- d.getDate(),
16046
- d.getHours(),
16047
- d.getMinutes(),
16048
- d.getSeconds(),
16049
- d.getMilliseconds()
16050
- )
16051
- );
16052
- }
16053
- return new Date(d);
16054
- }
16055
- return new Date();
16056
- };
16057
-
16058
16095
  const getCurrentTime = () => newDate().getTime();
16059
16096
  const getFullYear = (epoch) => newDate(epoch).getFullYear().toString();
16060
16097
  const getMonth = (epoch) => (newDate(epoch).getMonth() + 1).toString();
@@ -23405,8 +23442,23 @@ exports.genColors = genColors;
23405
23442
  exports.getThemeRefs = getThemeRefs;
23406
23443
  exports.getThemeVars = getThemeVars;
23407
23444
  exports.globalsThemeToStyle = globalsThemeToStyle;
23445
+ exports.inputFloatingLabelStyle = inputFloatingLabelStyle;
23446
+ exports.resetInitialHeight = resetInitialHeight;
23447
+ exports.resetInputAutoFill = resetInputAutoFill;
23448
+ exports.resetInputContainer = resetInputContainer;
23449
+ exports.resetInputCursor = resetInputCursor;
23450
+ exports.resetInputElement = resetInputElement;
23451
+ exports.resetInputField = resetInputField;
23452
+ exports.resetInputFieldDefaultWidth = resetInputFieldDefaultWidth;
23453
+ exports.resetInputFieldInvalidBackgroundColor = resetInputFieldInvalidBackgroundColor;
23454
+ exports.resetInputFieldUnderlayingBorder = resetInputFieldUnderlayingBorder;
23455
+ exports.resetInputLabelPosition = resetInputLabelPosition;
23456
+ exports.resetInputOverrides = resetInputOverrides;
23457
+ exports.resetInputPlaceholder = resetInputPlaceholder;
23458
+ exports.resetInputReadonlyStyle = resetInputReadonlyStyle;
23408
23459
  exports.themeToCSSVarsObj = themeToCSSVarsObj;
23409
23460
  exports.themeToStyle = themeToStyle;
23410
23461
  exports.themeVars = themeVars;
23462
+ exports.useHostExternalPadding = useHostExternalPadding;
23411
23463
  exports.useVar = useVar;
23412
23464
  //# sourceMappingURL=index.cjs.js.map