@descope/web-components-ui 1.0.275 → 1.0.277

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.esm.js CHANGED
@@ -2316,17 +2316,27 @@ customElements.define(componentName$B, TextClass);
2316
2316
 
2317
2317
  customElements.define(componentName$A, DividerClass);
2318
2318
 
2319
- const { host: host$c, label: label$9, placeholder: placeholder$3, requiredIndicator: requiredIndicator$9, inputField: inputField$6, input, helperText: helperText$7, errorMessage: errorMessage$9 } =
2320
- {
2321
- host: { selector: () => ':host' },
2322
- label: { selector: '::part(label)' },
2323
- requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
2324
- placeholder: { selector: '> input:placeholder-shown' },
2325
- inputField: { selector: '::part(input-field)' },
2326
- input: { selector: 'input' },
2327
- helperText: { selector: '::part(helper-text)' },
2328
- errorMessage: { selector: '::part(error-message)' },
2329
- };
2319
+ const {
2320
+ host: host$c,
2321
+ label: label$9,
2322
+ placeholder: placeholder$3,
2323
+ requiredIndicator: requiredIndicator$9,
2324
+ inputField: inputField$6,
2325
+ input,
2326
+ helperText: helperText$7,
2327
+ errorMessage: errorMessage$9,
2328
+ disabledPlaceholder,
2329
+ } = {
2330
+ host: { selector: () => ':host' },
2331
+ label: { selector: '::part(label)' },
2332
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
2333
+ placeholder: { selector: '> input:placeholder-shown' },
2334
+ disabledPlaceholder: { selector: '> input:disabled::placeholder' },
2335
+ inputField: { selector: '::part(input-field)' },
2336
+ input: { selector: 'input' },
2337
+ helperText: { selector: '::part(helper-text)' },
2338
+ errorMessage: { selector: '::part(error-message)' },
2339
+ };
2330
2340
 
2331
2341
  var textFieldMappings = {
2332
2342
  // we apply font-size also on the host so we can set its width with em
@@ -2342,6 +2352,8 @@ var textFieldMappings = {
2342
2352
  labelTextColor: [
2343
2353
  { ...label$9, property: 'color' },
2344
2354
  { ...requiredIndicator$9, property: 'color' },
2355
+ { ...label$9, property: '-webkit-text-fill-color' },
2356
+ { ...requiredIndicator$9, property: '-webkit-text-fill-color' },
2345
2357
  ],
2346
2358
  errorMessageTextColor: { ...errorMessage$9, property: 'color' },
2347
2359
 
@@ -2368,7 +2380,10 @@ var textFieldMappings = {
2368
2380
 
2369
2381
  inputTextAlign: { ...input, property: 'text-align' },
2370
2382
 
2371
- inputPlaceholderColor: { ...placeholder$3, property: 'color' },
2383
+ inputPlaceholderColor: [
2384
+ { ...placeholder$3, property: 'color' },
2385
+ { ...disabledPlaceholder, property: '-webkit-text-fill-color' },
2386
+ ],
2372
2387
  };
2373
2388
 
2374
2389
  const componentName$z = getComponentName('email-field');
@@ -8650,101 +8665,45 @@ const createHelperVars = (theme, prefix) => {
8650
8665
  return [res.theme, res.useVars, res.vars];
8651
8666
  };
8652
8667
 
8653
- const colorGaps = {
8654
- darkLight: 0.4,
8655
- highlight: 0.8,
8656
- contrast: 1,
8657
- edgeColor: {
8658
- darkLight: 0.25,
8659
- highlight: 0.1,
8660
- },
8661
- };
8662
-
8663
- const darken = (c, percentage) => c.darken(percentage).hex();
8664
-
8665
- const contrast = (c) => {
8668
+ // TODO: fix generated colors strategy
8669
+ const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
8670
+ const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
8671
+ const genContrast = (c, percentage = 0.9) => {
8666
8672
  const isDark = c.isDark();
8667
8673
  return c
8668
- .mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
8674
+ .mix(Color(isDark ? 'white' : 'black'), percentage)
8669
8675
  .saturate(1)
8670
8676
  .hex();
8671
8677
  };
8672
8678
 
8673
- const lighten = (c, percentage) => {
8674
- const isDark = c.lightness() < 0.5;
8675
-
8676
- if (isDark) {
8677
- return c.lightness(percentage * 100).hex();
8678
- }
8679
-
8680
- return c.lighten(percentage).hex();
8681
- };
8682
-
8683
- const isNearBlack = (color) => color.luminosity() < 0.01;
8684
- const isNearWhite = (color) => color.luminosity() > 0.99;
8685
-
8686
- const generateDarkColor = (color, theme) => {
8687
- if (color.dark) return color.dark;
8688
-
8689
- if (theme === 'dark') {
8690
- return isNearWhite(color)
8691
- ? darken(color, colorGaps.edgeColor.darkLight)
8692
- : lighten(color, colorGaps.darkLight);
8693
- }
8694
-
8695
- return isNearBlack(color)
8696
- ? lighten(color, colorGaps.edgeColor.darkLight)
8697
- : darken(color, colorGaps.darkLight);
8698
- };
8699
-
8700
- const generateLightColor = (color, theme) => {
8701
- if (color.light) return color.light;
8702
-
8703
- if (theme === 'dark') {
8704
- return isNearBlack(color)
8705
- ? lighten(color, colorGaps.edgeColor.darkLight)
8706
- : darken(color, colorGaps.darkLight);
8707
- }
8708
-
8709
- return isNearWhite(color)
8710
- ? darken(color, colorGaps.edgeColor.darkLight)
8711
- : lighten(color, colorGaps.darkLight);
8712
- };
8713
-
8714
- const generateHighlightColor = (color, theme) => {
8715
- if (color.highlight) return color.highlight;
8716
-
8717
- if (theme === 'dark') {
8718
- return isNearBlack(color)
8719
- ? lighten(color, colorGaps.edgeColor.highlight)
8720
- : darken(color, colorGaps.highlight);
8721
- }
8722
-
8723
- return isNearWhite(color)
8724
- ? darken(color, colorGaps.edgeColor.highlight)
8725
- : lighten(color, colorGaps.highlight);
8726
- };
8727
-
8728
- const genColor = (color, theme) => {
8679
+ const genColor = (color) => {
8729
8680
  const mainColor = new Color(color.main || color);
8730
8681
 
8731
- const res = {
8682
+ return {
8732
8683
  main: mainColor.hex(),
8733
- dark: generateDarkColor(mainColor, theme),
8734
- light: generateLightColor(mainColor, theme),
8735
- highlight: generateHighlightColor(mainColor, theme),
8736
- contrast: color.contrast || contrast(mainColor),
8684
+ dark: color.dark || genDark(mainColor),
8685
+ light: color.light || genLight(mainColor),
8686
+ highlight: color.highlight || genLight(mainColor),
8687
+ contrast: color.contrast || genContrast(mainColor),
8737
8688
  };
8689
+ };
8690
+
8691
+ const genColors = (colors) => {
8692
+ return Object.keys(colors).reduce((acc, colorName) => {
8693
+ const currentColor = colors[colorName];
8738
8694
 
8739
- return res;
8695
+ return Object.assign(acc, {
8696
+ [colorName]: genColor(currentColor),
8697
+ });
8698
+ }, {});
8740
8699
  };
8741
8700
 
8742
8701
  const direction = 'ltr';
8743
8702
 
8744
- const colors$1 = {
8703
+ const colors$1 = genColors({
8745
8704
  surface: {
8746
- dark: '#636c74',
8747
8705
  main: '#ffffff',
8706
+ dark: '#636c74',
8748
8707
  light: '#cfd3d7',
8749
8708
  highlight: '#f4f5f6',
8750
8709
  contrast: '#181a1c',
@@ -8757,8 +8716,8 @@ const colors$1 = {
8757
8716
  contrast: '#ffffff',
8758
8717
  },
8759
8718
  secondary: {
8760
- dark: '#6410bc',
8761
8719
  main: '#802ed6',
8720
+ dark: '#6410bc',
8762
8721
  light: '#be89f5',
8763
8722
  highlight: '#ede7f6',
8764
8723
  contrast: '#ffffff',
@@ -8777,7 +8736,7 @@ const colors$1 = {
8777
8736
  highlight: '#fef1f1',
8778
8737
  contrast: '#ffffff',
8779
8738
  },
8780
- };
8739
+ });
8781
8740
 
8782
8741
  const fonts = {
8783
8742
  font1: {