@descope/web-components-ui 1.0.93 → 1.0.95

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(4988),r=n(4447),o=n(7361),d=n(9063),a=n(2061),l=n(4567);const p=(0,l.iY)("passcode"),{borderStyle:s,borderWidth:c,...u}=r.Z,{digitField:g,label:h,requiredIndicator:f,internalWrapper:m,focusedValidDigitField:b}={focusedValidDigitField:{selector:()=>`${d.Z.componentName}[focused="true"]:not([invalid="true"])`},digitField:{selector:()=>d.Z.componentName},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},internalWrapper:{selector:"descope-passcode-internal .wrapper"}},y=d.Z.cssVarList,x=(0,a.qC)((0,i.yk)({mappings:{...u,borderColor:{...g,property:y.borderColor},outlineColor:{...g,property:y.outlineColor},outlineWidth:[{...g,property:y.outlineWidth},{...m,property:"padding"}],color:[u.color,h,f],padding:{...g,property:y.padding},margin:{...g,property:y.margin},textAlign:{...g,property:y.textAlign},caretColor:{...g,property:y.caretColor},digitsGap:{...m,property:"gap"},focusedValidDigitFieldBorderColor:{...b,property:y.borderColor}}}),i.e4,i.dj,i.Ae,(t=>class extends t{constructor(){super()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t<${o.f} \n\t\t\t\tbordered="true" \n\t\t\t\tname="code" \n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n\t\t\t></${o.f}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(o.f),(0,l.oP)(this,this.inputElement,{includeAttrs:["digits","size"]})}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n :host {\n --vaadin-field-default-width: auto;\n\t\t\tdisplay: inline-block;\n }\n\n descope-passcode-internal {\n\t\t-webkit-mask-image: none;\n\t\tpadding: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tmin-height: initial;\n }\n\n\tdescope-passcode-internal .wrapper {\n\t\tbox-sizing: border-box;\n\t\tmin-height: initial;\n\t\theight: 100%;\n\t\tjustify-content: center;\n }\n\n\tdescope-passcode-internal descope-text-field {\n\t\twidth: var(${y.height})\t\t\t\n\t}\n\n vaadin-text-field::part(input-field) {\n\t\tbackground-color: transparent;\n\t\tpadding: 0;\n\t\toverflow: hidden;\n\t\t-webkit-mask-image: none;\n }\n\n\tvaadin-text-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\twidth: 100%\n\t}\n\n\tvaadin-text-field::before {\n\t\theight: initial;\n\t}\n\n\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\n\tvaadin-text-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\n\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t}\n\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n `,excludeAttrsSync:["tabindex"],componentName:p}));n(9357),n(4775),customElements.define(p,x)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(4988),r=n(4447),o=n(7361),d=n(9063),a=n(2061),l=n(4567);const p=(0,l.iY)("passcode"),{borderStyle:s,borderWidth:c,...u}=r.Z,{digitField:g,label:h,requiredIndicator:f,internalWrapper:m,focusedValidDigitField:b}={focusedValidDigitField:{selector:()=>`${d.Z.componentName}[focused="true"]:not([invalid="true"])`},digitField:{selector:()=>d.Z.componentName},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},internalWrapper:{selector:"descope-passcode-internal .wrapper"}},y=d.Z.cssVarList,x=(0,a.qC)((0,i.yk)({mappings:{...u,borderColor:{...g,property:y.borderColor},outlineColor:{...g,property:y.outlineColor},outlineWidth:[{...g,property:y.outlineWidth},{...m,property:"padding"}],color:[u.color,h,f],padding:{...g,property:y.padding},margin:{...g,property:y.margin},textAlign:{...g,property:y.textAlign},caretColor:{...g,property:y.caretColor},digitsGap:{...m,property:"gap"},focusedValidDigitFieldBorderColor:{...b,property:y.borderColor}}}),i.e4,i.dj,i.Ae,(t=>class extends t{constructor(){super()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t<${o.f} \n\t\t\t\tbordered="true" \n\t\t\t\tname="code" \n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n\t\t\t></${o.f}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(o.f),(0,l.oP)(this,this.inputElement,{includeAttrs:["digits","size"]})}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n :host {\n --vaadin-field-default-width: auto;\n\t\t\tdisplay: inline-block;\n }\n\n descope-passcode-internal {\n\t\t-webkit-mask-image: none;\n\t\tpadding: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tmin-height: initial;\n }\n\n\tdescope-passcode-internal .wrapper {\n\t\tbox-sizing: border-box;\n\t\tmin-height: initial;\n\t\theight: 100%;\n\t\tjustify-content: center;\n }\n\n\tdescope-passcode-internal descope-text-field {\n\t\twidth: var(${y.height})\t\t\t\n\t}\n\n vaadin-text-field::part(input-field) {\n\t\tbackground-color: transparent;\n\t\tpadding: 0;\n\t\toverflow: hidden;\n\t\t-webkit-mask-image: none;\n }\n\n\tvaadin-text-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\twidth: 100%\n\t}\n\n\tvaadin-text-field::before {\n\t\theight: 0;\n\t}\n\n\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\n\tvaadin-text-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\n\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t}\n\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n `,excludeAttrsSync:["tabindex"],componentName:p}));n(9357),n(4775),customElements.define(p,x)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -125,7 +125,7 @@ const Passcode = compose(
125
125
  }
126
126
 
127
127
  vaadin-text-field::before {
128
- height: initial;
128
+ height: 0;
129
129
  }
130
130
 
131
131
  vaadin-text-field[readonly] > input:placeholder-shown {
@@ -13,4 +13,14 @@ export const compose = (...fns) =>
13
13
 
14
14
  export const upperFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1)
15
15
 
16
- export const isFunction = (maybeFunc) => typeof maybeFunc === 'function'
16
+ export const isFunction = (maybeFunc) => typeof maybeFunc === 'function';
17
+
18
+ export const isUrl = (maybeUrl) => {
19
+ try {
20
+ new URL(maybeUrl)
21
+
22
+ return true;
23
+ } catch (e) {
24
+ return false;
25
+ }
26
+ }
@@ -1,7 +1,7 @@
1
1
  import merge from 'lodash.merge';
2
2
  import set from 'lodash.set';
3
3
  import { BASE_THEME_SECTION, DESCOPE_PREFIX, PORTAL_THEME_PREFIX } from '../../constants';
4
- import { kebabCase } from '..';
4
+ import { isUrl, kebabCase } from '..';
5
5
  import { getComponentName, getCssVarName } from '../componentHelpers';
6
6
 
7
7
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
@@ -19,9 +19,20 @@ const transformTheme = (theme, path, getTransformation) => {
19
19
  const stringifyArray = (strArr) =>
20
20
  strArr.map((str) => (str.includes(' ') ? `"${str}"` : str)).join(', ');
21
21
 
22
+ const getCssVarValue = (val) => {
23
+ switch (true) {
24
+ case Array.isArray(val):
25
+ return stringifyArray(val)
26
+ case isUrl(val):
27
+ return `url(${val})`
28
+ default:
29
+ return val
30
+ }
31
+ }
32
+
22
33
  export const themeToCSSVarsObj = (theme) =>
23
34
  transformTheme(theme, [], (path, val) => ({
24
- [getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
35
+ [getVarName(path)]: getCssVarValue(val)
25
36
  }));
26
37
 
27
38
  export const getThemeRefs = (theme, prefix) =>
@@ -43,7 +43,7 @@ export const textField = (vars) => ({
43
43
  [vars.borderWidth]: '1px',
44
44
  [vars.borderStyle]: 'solid',
45
45
  [vars.borderColor]: 'transparent',
46
- [vars.borderRadius]: globalRefs.radius.sm,
46
+ [vars.borderRadius]: globalRefs.radius.xs,
47
47
 
48
48
  _disabled: {
49
49
  [vars.color]: globalRefs.colors.surface.dark,
@@ -14,44 +14,82 @@ export const colors = genColors({
14
14
  });
15
15
 
16
16
  const fonts = {
17
- font1: ['Roboto', 'sans-serif'],
18
- font2: ['Oswald', 'serif']
17
+ font1: {
18
+ family: [
19
+ "Roboto",
20
+ "ui-sans-serif",
21
+ "system-ui",
22
+ "-apple-system",
23
+ "BlinkMacSystemFont",
24
+ "Segoe UI",
25
+ "Helvetica Neue",
26
+ "Arial",
27
+ "Noto Sans",
28
+ "sans-serif",
29
+ "Apple Color Emoji",
30
+ "Segoe UI Emoji",
31
+ "Segoe UI Symbol",
32
+ "Noto Color Emoji"
33
+ ],
34
+ label: "Roboto",
35
+ url: "https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900"
36
+ },
37
+ font2: {
38
+ family: [
39
+ "ui-sans-serif",
40
+ "system-ui",
41
+ "-apple-system",
42
+ "BlinkMacSystemFont",
43
+ "Segoe UI",
44
+ "Roboto",
45
+ "Helvetica Neue",
46
+ "Arial",
47
+ "Noto Sans",
48
+ "sans-serif",
49
+ "Apple Color Emoji",
50
+ "Segoe UI Emoji",
51
+ "Segoe UI Symbol",
52
+ "Noto Color Emoji"
53
+ ],
54
+ label: "Sans Serif"
55
+ }
19
56
  };
57
+
20
58
  const fontsRef = getThemeRefs({ fonts }).fonts;
21
59
 
22
60
  const typography = {
23
61
  h1: {
24
- font: fontsRef.font1,
62
+ font: fontsRef.font1.family,
25
63
  weight: '900',
26
64
  size: '48px'
27
65
  },
28
66
  h2: {
29
- font: fontsRef.font1,
67
+ font: fontsRef.font1.family,
30
68
  weight: '800',
31
69
  size: '38px'
32
70
  },
33
71
  h3: {
34
- font: fontsRef.font1,
72
+ font: fontsRef.font1.family,
35
73
  weight: '600',
36
74
  size: '28px'
37
75
  },
38
76
  subtitle1: {
39
- font: fontsRef.font2,
77
+ font: fontsRef.font2.family,
40
78
  weight: '500',
41
79
  size: '22px'
42
80
  },
43
81
  subtitle2: {
44
- font: fontsRef.font2,
82
+ font: fontsRef.font2.family,
45
83
  weight: '400',
46
84
  size: '20px'
47
85
  },
48
86
  body1: {
49
- font: fontsRef.font1,
87
+ font: fontsRef.font1.family,
50
88
  weight: '300',
51
89
  size: '16px'
52
90
  },
53
91
  body2: {
54
- font: fontsRef.font1,
92
+ font: fontsRef.font1.family,
55
93
  weight: '200',
56
94
  size: '14px'
57
95
  }