@descope/web-components-ui 1.0.73 → 1.0.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/index.esm.js +2425 -622
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/umd/447.js +1 -1
  4. package/dist/umd/744.js +1 -1
  5. package/dist/umd/878.js +1 -0
  6. package/dist/umd/descope-combo-box-index-js.js +1 -1
  7. package/dist/umd/descope-logo-index-js.js +1 -1
  8. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  9. package/dist/umd/descope-passcode-index-js.js +1 -1
  10. package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +1 -0
  11. package/dist/umd/descope-phone-field-index-js.js +1 -0
  12. package/dist/umd/descope-text-field-index-js.js +1 -1
  13. package/dist/umd/index.js +1 -1
  14. package/package.json +1 -1
  15. package/src/components/descope-combo-box/ComboBox.js +85 -50
  16. package/src/components/descope-logo/Logo.js +1 -1
  17. package/src/components/descope-passcode/Passcode.js +2 -5
  18. package/src/components/descope-phone-field/CountryCodes.js +1212 -0
  19. package/src/components/descope-phone-field/PhoneField.js +179 -0
  20. package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +213 -0
  21. package/src/components/descope-phone-field/descope-phone-field-internal/index.js +6 -0
  22. package/src/components/descope-phone-field/helpers.js +23 -0
  23. package/src/components/descope-phone-field/index.js +9 -0
  24. package/src/components/descope-text-field/TextField.js +31 -3
  25. package/src/components/descope-text-field/textFieldMappings.js +4 -1
  26. package/src/index.js +1 -0
  27. package/src/mixins/inputValidationMixin.js +21 -2
  28. package/src/mixins/portalMixin.js +8 -3
  29. package/src/theme/components/comboBox.js +39 -9
  30. package/src/theme/components/index.js +3 -1
  31. package/src/theme/components/phoneField.js +74 -0
  32. package/src/theme/components/textField.js +2 -2
package/dist/index.esm.js CHANGED
@@ -6,6 +6,7 @@ import '@vaadin/number-field';
6
6
  import '@vaadin/text-field';
7
7
  import '@vaadin/password-field';
8
8
  import '@vaadin/text-area';
9
+ import '@vaadin/combo-box';
9
10
  import merge from 'lodash.merge';
10
11
  import set from 'lodash.set';
11
12
  import Color from 'color';
@@ -563,7 +564,9 @@ const observedAttributes$2 = [
563
564
 
564
565
  const errorAttributes = {
565
566
  valueMissing: 'data-errormessage-value-missing',
566
- patternMismatch: 'data-errormessage-pattern-mismatch'
567
+ patternMismatch: 'data-errormessage-pattern-mismatch',
568
+ tooShort: 'data-errormessage-pattern-mismatch-too-short',
569
+ tooLong: 'data-errormessage-pattern-mismatch-too-long',
567
570
  };
568
571
  const inputValidationMixin = (superclass) => class InputValidationMixinClass extends superclass {
569
572
  static get observedAttributes() {
@@ -593,6 +596,14 @@ const inputValidationMixin = (superclass) => class InputValidationMixinClass ext
593
596
  return 'Please match the requested format.'
594
597
  }
595
598
 
599
+ get defaultErrorMsgTooShort() {
600
+ return `Minimum length is ${this.getAttribute('minlength')}.`
601
+ }
602
+
603
+ get defaultErrorMsgTooLong() {
604
+ return `Maximum length is ${this.getAttribute('maxlength')}. `
605
+ }
606
+
596
607
  getErrorMessage(flags) {
597
608
  switch (true) {
598
609
  case flags.valueMissing:
@@ -601,6 +612,12 @@ const inputValidationMixin = (superclass) => class InputValidationMixinClass ext
601
612
  case flags.patternMismatch || flags.typeMismatch:
602
613
  return this.getAttribute(errorAttributes.patternMismatch) ||
603
614
  this.defaultErrorMsgPatternMismatch
615
+ case flags.tooShort:
616
+ return this.getAttribute(errorAttributes.tooShort) ||
617
+ this.defaultErrorMsgTooShort
618
+ case flags.tooLong:
619
+ return this.getAttribute(errorAttributes.tooLong) ||
620
+ this.defaultErrorMsgTooLong
604
621
  case flags.customError:
605
622
  return this.validationMessage
606
623
  default:
@@ -668,7 +685,10 @@ const inputValidationMixin = (superclass) => class InputValidationMixinClass ext
668
685
  this.addEventListener('invalid', (e) => e.stopPropagation());
669
686
  this.addEventListener('input', this.#setValidity);
670
687
 
671
- this.#setValidity();
688
+ // The attribute sync takes time, so getValidity returns valid,
689
+ // even when it shouldn't. This way allows all attributes to sync
690
+ // after render, before checking the validity.
691
+ setTimeout(() => this.#setValidity());
672
692
  }
673
693
  };
674
694
 
@@ -896,7 +916,12 @@ const sanitizeSelector = (selector) => selector.replace(/[^\w\s]/gi, '');
896
916
 
897
917
  const getDomNode = (maybeDomNode) => maybeDomNode.host || maybeDomNode;
898
918
 
899
- const portalMixin = ({ name, selector, mappings = {} }) => (superclass) => {
919
+ const portalMixin = ({
920
+ name,
921
+ selector,
922
+ mappings = {},
923
+ forward: { attributes = [], include = true } = {}
924
+ }) => (superclass) => {
900
925
  const eleDisplayName = name || sanitizeSelector(selector);
901
926
 
902
927
  const BaseClass = createStyleMixin({
@@ -939,7 +964,7 @@ const portalMixin = ({ name, selector, mappings = {} }) => (superclass) => {
939
964
 
940
965
  init() {
941
966
  super.init?.();
942
- forwardAttrs(this, this.#portalEle, { excludeAttrs: ['hover'] });
967
+ forwardAttrs(this, this.#portalEle, { [include ? 'includeAttrs' : 'excludeAttrs']: attributes });
943
968
 
944
969
  this.#handleHoverAttribute();
945
970
  }
@@ -997,7 +1022,7 @@ const readOnlyMixin = (superclass) => class ReadOnlyMixinClass extends superclas
997
1022
  }
998
1023
  };
999
1024
 
1000
- const componentName$j = getComponentName('button');
1025
+ const componentName$l = getComponentName('button');
1001
1026
 
1002
1027
  const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
1003
1028
  const resetStyles = `
@@ -1020,7 +1045,7 @@ const iconStyles = `
1020
1045
  }
1021
1046
  `;
1022
1047
 
1023
- const { label: label$1, host: host$3 } = {
1048
+ const { label: label$2, host: host$4 } = {
1024
1049
  label: { selector: '::part(label)' },
1025
1050
  host: { selector: () => ':host' }
1026
1051
  };
@@ -1030,16 +1055,16 @@ const Button = compose(
1030
1055
  mappings: {
1031
1056
  backgroundColor: {},
1032
1057
  borderRadius: {},
1033
- color: label$1,
1058
+ color: label$2,
1034
1059
  borderColor: {},
1035
1060
  borderStyle: {},
1036
1061
  borderWidth: {},
1037
1062
  fontSize: {},
1038
1063
  height: {},
1039
- width: host$3,
1064
+ width: host$4,
1040
1065
  cursor: {},
1041
- padding: label$1,
1042
- textDecoration: label$1
1066
+ padding: label$2,
1067
+ textDecoration: label$2
1043
1068
  }
1044
1069
  }),
1045
1070
  draggableMixin,
@@ -1051,7 +1076,7 @@ const Button = compose(
1051
1076
  style: () =>
1052
1077
  `${resetStyles} ${editorOverrides} ${iconStyles} ${loadingIndicatorStyles}`,
1053
1078
  excludeAttrsSync: ['tabindex'],
1054
- componentName: componentName$j
1079
+ componentName: componentName$l
1055
1080
  })
1056
1081
  );
1057
1082
 
@@ -1088,9 +1113,9 @@ const loadingIndicatorStyles = `
1088
1113
  }
1089
1114
  `;
1090
1115
 
1091
- customElements.define(componentName$j, Button);
1116
+ customElements.define(componentName$l, Button);
1092
1117
 
1093
- const componentName$i = getComponentName('checkbox');
1118
+ const componentName$k = getComponentName('checkbox');
1094
1119
 
1095
1120
  const Checkbox = compose(
1096
1121
  createStyleMixin({
@@ -1116,17 +1141,17 @@ const Checkbox = compose(
1116
1141
  }
1117
1142
  `,
1118
1143
  excludeAttrsSync: ['tabindex'],
1119
- componentName: componentName$i
1144
+ componentName: componentName$k
1120
1145
  })
1121
1146
  );
1122
1147
 
1123
- customElements.define(componentName$i, Checkbox);
1148
+ customElements.define(componentName$k, Checkbox);
1124
1149
 
1125
- const componentName$h = getComponentName('loader-linear');
1150
+ const componentName$j = getComponentName('loader-linear');
1126
1151
 
1127
- class RawLoaderLinear extends createBaseClass({ componentName: componentName$h, baseSelector: ':host > div' }) {
1152
+ class RawLoaderLinear extends createBaseClass({ componentName: componentName$j, baseSelector: ':host > div' }) {
1128
1153
  static get componentName() {
1129
- return componentName$h;
1154
+ return componentName$j;
1130
1155
  }
1131
1156
  constructor() {
1132
1157
  super();
@@ -1157,19 +1182,19 @@ class RawLoaderLinear extends createBaseClass({ componentName: componentName$h,
1157
1182
  }
1158
1183
  }
1159
1184
 
1160
- const selectors$5 = {
1185
+ const selectors$4 = {
1161
1186
  root: {},
1162
1187
  after: { selector: '::after' },
1163
1188
  host: { selector: () => ':host' }
1164
1189
  };
1165
1190
 
1166
- const { root: root$1, after: after$1, host: host$2 } = selectors$5;
1191
+ const { root: root$1, after: after$1, host: host$3 } = selectors$4;
1167
1192
 
1168
1193
  const LoaderLinear = compose(
1169
1194
  createStyleMixin({
1170
1195
  mappings: {
1171
1196
  display: root$1,
1172
- width: host$2,
1197
+ width: host$3,
1173
1198
  height: [root$1, after$1],
1174
1199
  borderRadius: [root$1, after$1],
1175
1200
  surfaceColor: [{ property: 'background-color' }],
@@ -1184,11 +1209,11 @@ const LoaderLinear = compose(
1184
1209
  componentNameValidationMixin
1185
1210
  )(RawLoaderLinear);
1186
1211
 
1187
- customElements.define(componentName$h, LoaderLinear);
1212
+ customElements.define(componentName$j, LoaderLinear);
1188
1213
 
1189
- const componentName$g = getComponentName('loader-radial');
1214
+ const componentName$i = getComponentName('loader-radial');
1190
1215
 
1191
- class RawLoaderRadial extends createBaseClass({ componentName: componentName$g, baseSelector: ':host > div' }) {
1216
+ class RawLoaderRadial extends createBaseClass({ componentName: componentName$i, baseSelector: ':host > div' }) {
1192
1217
  constructor() {
1193
1218
  super();
1194
1219
 
@@ -1234,11 +1259,11 @@ const LoaderRadial = compose(
1234
1259
  componentNameValidationMixin
1235
1260
  )(RawLoaderRadial);
1236
1261
 
1237
- customElements.define(componentName$g, LoaderRadial);
1262
+ customElements.define(componentName$i, LoaderRadial);
1238
1263
 
1239
- const componentName$f = getComponentName('container');
1264
+ const componentName$h = getComponentName('container');
1240
1265
 
1241
- class RawContainer extends createBaseClass({componentName: componentName$f, baseSelector: ':host > slot'}) {
1266
+ class RawContainer extends createBaseClass({componentName: componentName$h, baseSelector: ':host > slot'}) {
1242
1267
  constructor() {
1243
1268
  super();
1244
1269
 
@@ -1294,26 +1319,26 @@ const Container = compose(
1294
1319
  componentNameValidationMixin
1295
1320
  )(RawContainer);
1296
1321
 
1297
- customElements.define(componentName$f, Container);
1322
+ customElements.define(componentName$h, Container);
1298
1323
 
1299
- const componentName$e = getComponentName('date-picker');
1324
+ const componentName$g = getComponentName('date-picker');
1300
1325
 
1301
1326
  const DatePicker = compose(
1302
1327
  draggableMixin,
1303
1328
  componentNameValidationMixin
1304
1329
  )(
1305
1330
  createProxy({
1306
- componentName: componentName$e,
1331
+ componentName: componentName$g,
1307
1332
  slots: ['prefix', 'suffix'],
1308
1333
  wrappedEleName: 'vaadin-date-picker',
1309
1334
  style: ``
1310
1335
  })
1311
1336
  );
1312
1337
 
1313
- customElements.define(componentName$e, DatePicker);
1338
+ customElements.define(componentName$g, DatePicker);
1314
1339
 
1315
- const componentName$d = getComponentName('divider');
1316
- class RawDivider extends createBaseClass({ componentName: componentName$d, baseSelector: ':host > div' }) {
1340
+ const componentName$f = getComponentName('divider');
1341
+ class RawDivider extends createBaseClass({ componentName: componentName$f, baseSelector: ':host > div' }) {
1317
1342
  constructor() {
1318
1343
  super();
1319
1344
 
@@ -1359,7 +1384,7 @@ class RawDivider extends createBaseClass({ componentName: componentName$d, baseS
1359
1384
  }
1360
1385
  }
1361
1386
 
1362
- const selectors$4 = {
1387
+ const selectors$3 = {
1363
1388
  root: { selector: '' },
1364
1389
  before: { selector: '::before' },
1365
1390
  after: { selector: '::after' },
@@ -1367,7 +1392,7 @@ const selectors$4 = {
1367
1392
  host: { selector: () => ':host' },
1368
1393
  };
1369
1394
 
1370
- const { root, before, after, text: text$2, host: host$1 } = selectors$4;
1395
+ const { root, before, after, text: text$2, host: host$2 } = selectors$3;
1371
1396
 
1372
1397
  const Divider = compose(
1373
1398
  createStyleMixin({
@@ -1378,8 +1403,8 @@ const Divider = compose(
1378
1403
  alignSelf: root,
1379
1404
  flexDirection: root,
1380
1405
  textPadding: { ...text$2, property: 'padding' },
1381
- width: host$1,
1382
- padding: host$1,
1406
+ width: host$2,
1407
+ padding: host$2,
1383
1408
  backgroundColor: [before, after],
1384
1409
  opacity: [before, after],
1385
1410
  textWidth: { ...text$2, property: 'width' },
@@ -1391,9 +1416,9 @@ const Divider = compose(
1391
1416
  componentNameValidationMixin
1392
1417
  )(RawDivider);
1393
1418
 
1394
- const componentName$c = getComponentName('text');
1419
+ const componentName$e = getComponentName('text');
1395
1420
 
1396
- class RawText extends createBaseClass({ componentName: componentName$c, baseSelector: ':host > slot' }) {
1421
+ class RawText extends createBaseClass({ componentName: componentName$e, baseSelector: ':host > slot' }) {
1397
1422
  constructor() {
1398
1423
  super();
1399
1424
 
@@ -1435,11 +1460,11 @@ const Text = compose(
1435
1460
  componentNameValidationMixin
1436
1461
  )(RawText);
1437
1462
 
1438
- customElements.define(componentName$c, Text);
1463
+ customElements.define(componentName$e, Text);
1439
1464
 
1440
- customElements.define(componentName$d, Divider);
1465
+ customElements.define(componentName$f, Divider);
1441
1466
 
1442
- const selectors$3 = {
1467
+ const selectors$2 = {
1443
1468
  label: '::part(label)',
1444
1469
  input: '::part(input-field)',
1445
1470
  readOnlyInput: '[readonly]::part(input-field)::after',
@@ -1448,33 +1473,36 @@ const selectors$3 = {
1448
1473
  };
1449
1474
 
1450
1475
  var textFieldMappings = {
1451
- backgroundColor: { selector: selectors$3.input },
1452
- color: { selector: selectors$3.input },
1453
- width: { selector: selectors$3.host },
1476
+ backgroundColor: { selector: selectors$2.input },
1477
+ color: { selector: selectors$2.input },
1478
+ width: { selector: selectors$2.host },
1454
1479
  borderColor: [
1455
- { selector: selectors$3.input },
1456
- { selector: selectors$3.readOnlyInput }
1480
+ { selector: selectors$2.input },
1481
+ { selector: selectors$2.readOnlyInput }
1457
1482
  ],
1458
1483
  borderWidth: [
1459
- { selector: selectors$3.input },
1460
- { selector: selectors$3.readOnlyInput }
1484
+ { selector: selectors$2.input },
1485
+ { selector: selectors$2.readOnlyInput }
1461
1486
  ],
1462
1487
  borderStyle: [
1463
- { selector: selectors$3.input },
1464
- { selector: selectors$3.readOnlyInput }
1488
+ { selector: selectors$2.input },
1489
+ { selector: selectors$2.readOnlyInput }
1465
1490
  ],
1466
- borderRadius: { selector: selectors$3.input },
1467
- boxShadow: { selector: selectors$3.input },
1468
- fontSize: {},
1469
- height: { selector: selectors$3.input },
1470
- padding: { selector: selectors$3.input },
1471
- outline: { selector: selectors$3.input },
1472
- outlineOffset: { selector: selectors$3.input },
1491
+ borderRadius: { selector: selectors$2.input },
1492
+ boxShadow: { selector: selectors$2.input },
1493
+
1494
+ // we apply font-size also on the host so we can set its width with em
1495
+ fontSize: [{}, { selector: selectors$2.host }],
1496
+
1497
+ height: { selector: selectors$2.input },
1498
+ padding: { selector: selectors$2.input },
1499
+ outline: { selector: selectors$2.input },
1500
+ outlineOffset: { selector: selectors$2.input },
1473
1501
 
1474
- placeholderColor: { selector: selectors$3.placeholder, property: 'color' }
1502
+ placeholderColor: { selector: selectors$2.placeholder, property: 'color' }
1475
1503
  };
1476
1504
 
1477
- const componentName$b = getComponentName('email-field');
1505
+ const componentName$d = getComponentName('email-field');
1478
1506
 
1479
1507
  let overrides$5 = ``;
1480
1508
 
@@ -1493,7 +1521,7 @@ const EmailField = compose(
1493
1521
  wrappedEleName: 'vaadin-email-field',
1494
1522
  style: () => overrides$5,
1495
1523
  excludeAttrsSync: ['tabindex'],
1496
- componentName: componentName$b
1524
+ componentName: componentName$d
1497
1525
  })
1498
1526
  );
1499
1527
 
@@ -1537,10 +1565,10 @@ overrides$5 = `
1537
1565
  }
1538
1566
  `;
1539
1567
 
1540
- customElements.define(componentName$b, EmailField);
1568
+ customElements.define(componentName$d, EmailField);
1541
1569
 
1542
- const componentName$a = getComponentName('link');
1543
- class RawLink extends createBaseClass({ componentName: componentName$a, baseSelector: ':host a' }) {
1570
+ const componentName$c = getComponentName('link');
1571
+ class RawLink extends createBaseClass({ componentName: componentName$c, baseSelector: ':host a' }) {
1544
1572
  constructor() {
1545
1573
  super();
1546
1574
  document.createElement('template');
@@ -1576,19 +1604,19 @@ class RawLink extends createBaseClass({ componentName: componentName$a, baseSele
1576
1604
  }
1577
1605
  }
1578
1606
 
1579
- const selectors$2 = {
1607
+ const selectors$1 = {
1580
1608
  host: { selector: () => 'host' },
1581
1609
  anchor: {},
1582
1610
  wrapper: {selector: () => ':host > div'},
1583
1611
  text: { selector: () => Text.componentName }
1584
1612
  };
1585
1613
 
1586
- const { anchor, text: text$1, host, wrapper } = selectors$2;
1614
+ const { anchor, text: text$1, host: host$1, wrapper } = selectors$1;
1587
1615
 
1588
1616
  const Link = compose(
1589
1617
  createStyleMixin({
1590
1618
  mappings: {
1591
- width: host,
1619
+ width: host$1,
1592
1620
  textAlign: wrapper,
1593
1621
  color: [anchor, { ...text$1, property: Text.cssVarList.color }],
1594
1622
  cursor: anchor,
@@ -1601,14 +1629,14 @@ const Link = compose(
1601
1629
  componentNameValidationMixin
1602
1630
  )(RawLink);
1603
1631
 
1604
- customElements.define(componentName$a, Link);
1632
+ customElements.define(componentName$c, Link);
1605
1633
 
1606
- const componentName$9 = getComponentName('logo');
1634
+ const componentName$b = getComponentName('logo');
1607
1635
 
1608
1636
  let style;
1609
1637
  const getStyle = () => style;
1610
1638
 
1611
- class RawLogo extends createBaseClass({ componentName: componentName$9, baseSelector: ':host > div' }) {
1639
+ class RawLogo extends createBaseClass({ componentName: componentName$b, baseSelector: ':host > div' }) {
1612
1640
  constructor() {
1613
1641
  super();
1614
1642
 
@@ -1641,14 +1669,14 @@ style = `
1641
1669
  display: inline-block;
1642
1670
  content: var(${Logo.cssVarList.url}, var(${Logo.cssVarList.fallbackUrl}));
1643
1671
  }
1644
- :host[draggable="true"] > div {
1672
+ :host([draggable="true"]) > div {
1645
1673
  pointer-events: none
1646
1674
  }
1647
1675
  `;
1648
1676
 
1649
- customElements.define(componentName$9, Logo);
1677
+ customElements.define(componentName$b, Logo);
1650
1678
 
1651
- const componentName$8 = getComponentName('number-field');
1679
+ const componentName$a = getComponentName('number-field');
1652
1680
 
1653
1681
  let overrides$4 = ``;
1654
1682
 
@@ -1667,7 +1695,7 @@ const NumberField = compose(
1667
1695
  wrappedEleName: 'vaadin-number-field',
1668
1696
  style: () => overrides$4,
1669
1697
  excludeAttrsSync: ['tabindex'],
1670
- componentName: componentName$8
1698
+ componentName: componentName$a
1671
1699
  })
1672
1700
  );
1673
1701
 
@@ -1711,7 +1739,7 @@ overrides$4 = `
1711
1739
  }
1712
1740
  `;
1713
1741
 
1714
- customElements.define(componentName$8, NumberField);
1742
+ customElements.define(componentName$a, NumberField);
1715
1743
 
1716
1744
  const createBaseInputClass = (...args) => compose(
1717
1745
  focusMixin,
@@ -1734,7 +1762,7 @@ const getSanitizedCharacters = (str) => {
1734
1762
  return [...pin]; // creating array of chars
1735
1763
  };
1736
1764
 
1737
- const componentName$7 = getComponentName('passcode-internal');
1765
+ const componentName$9 = getComponentName('passcode-internal');
1738
1766
 
1739
1767
  const observedAttributes$1 = [
1740
1768
  'disabled',
@@ -1744,15 +1772,15 @@ const observedAttributes$1 = [
1744
1772
  'readonly'
1745
1773
  ];
1746
1774
 
1747
- const BaseInputClass = createBaseInputClass({ componentName: componentName$7, baseSelector: 'div' });
1775
+ const BaseInputClass$1 = createBaseInputClass({ componentName: componentName$9, baseSelector: 'div' });
1748
1776
 
1749
- class PasscodeInternal extends BaseInputClass {
1777
+ class PasscodeInternal extends BaseInputClass$1 {
1750
1778
  static get observedAttributes() {
1751
- return observedAttributes$1.concat(BaseInputClass.observedAttributes || []);
1779
+ return observedAttributes$1.concat(BaseInputClass$1.observedAttributes || []);
1752
1780
  }
1753
1781
 
1754
1782
  static get componentName() {
1755
- return componentName$7;
1783
+ return componentName$9;
1756
1784
  }
1757
1785
 
1758
1786
  #dispatchBlur = createDispatchEvent.bind(this, 'blur')
@@ -1930,38 +1958,67 @@ class PasscodeInternal extends BaseInputClass {
1930
1958
  }
1931
1959
  }
1932
1960
 
1933
- const componentName$6 = getComponentName('text-field');
1961
+ const componentName$8 = getComponentName('text-field');
1934
1962
 
1935
1963
  let overrides$3 = ``;
1936
1964
 
1965
+ const observedAttrs = ['type'];
1966
+
1967
+ const customMixin$2 = (superclass) =>
1968
+ class TextFieldClass extends superclass {
1969
+ static get observedAttributes() {
1970
+ return observedAttrs.concat(superclass.observedAttributes || []);
1971
+ }
1972
+
1973
+ attributeChangedCallback(attrName, oldVal, newVal) {
1974
+ super.attributeChangeCallback?.(attrName, oldVal, newVal);
1975
+
1976
+ // Vaadin doesn't allow to change the input type attribute.
1977
+ // We need the ability to do that, so we're overriding their
1978
+ // behavior with their private API.
1979
+ // When receiving a `type` attribute, we use their private API
1980
+ // to set it on the input.
1981
+ if (attrName === 'type') {
1982
+ this.baseElement._setType(newVal);
1983
+ }
1984
+ }
1985
+ };
1986
+
1937
1987
  const TextField = compose(
1938
1988
  createStyleMixin({
1939
1989
  mappings: textFieldMappings
1940
1990
  }),
1941
1991
  draggableMixin,
1942
1992
  proxyInputMixin,
1943
- componentNameValidationMixin
1993
+ componentNameValidationMixin,
1994
+ customMixin$2
1944
1995
  )(
1945
1996
  createProxy({
1946
1997
  slots: ['prefix', 'suffix'],
1947
1998
  wrappedEleName: 'vaadin-text-field',
1948
1999
  style: () => overrides$3,
1949
2000
  excludeAttrsSync: ['tabindex'],
1950
- componentName: componentName$6
2001
+ componentName: componentName$8
1951
2002
  })
1952
2003
  );
1953
2004
 
1954
2005
  overrides$3 = `
1955
2006
  :host {
1956
2007
  display: inline-block;
2008
+ --vaadin-field-default-width: auto;
1957
2009
  }
1958
-
1959
2010
  vaadin-text-field {
1960
2011
  margin: 0;
1961
2012
  padding: 0;
2013
+ width: 100%;
2014
+ height: 100%;
2015
+ }
2016
+ vaadin-text-field input {
2017
+ min-height: 0;
1962
2018
  }
1963
2019
  vaadin-text-field::part(input-field) {
1964
2020
  overflow: hidden;
2021
+ padding: 0;
1965
2022
  }
1966
2023
  vaadin-text-field[readonly] > input:placeholder-shown {
1967
2024
  opacity: 1;
@@ -1976,7 +2033,6 @@ overrides$3 = `
1976
2033
  }
1977
2034
  vaadin-text-field > label,
1978
2035
  vaadin-text-field::part(input-field) {
1979
- cursor: pointer;
1980
2036
  color: var(${TextField.cssVarList.color});
1981
2037
  }
1982
2038
  vaadin-text-field::part(input-field):focus {
@@ -1992,10 +2048,10 @@ overrides$3 = `
1992
2048
  }
1993
2049
  `;
1994
2050
 
1995
- const componentName$5 = getComponentName('passcode');
2051
+ const componentName$7 = getComponentName('passcode');
1996
2052
 
1997
- const customMixin = (superclass) =>
1998
- class DraggableMixinClass extends superclass {
2053
+ const customMixin$1 = (superclass) =>
2054
+ class PasscodeClass extends superclass {
1999
2055
  constructor() {
2000
2056
  super();
2001
2057
  }
@@ -2009,46 +2065,43 @@ const customMixin = (superclass) =>
2009
2065
  const template = document.createElement('template');
2010
2066
 
2011
2067
  template.innerHTML = `
2012
- <${componentName$7}
2068
+ <${componentName$9}
2013
2069
  bordered="true"
2014
2070
  name="code"
2015
2071
  tabindex="-1"
2016
2072
  slot="input"
2017
- ></${componentName$7}>
2073
+ ></${componentName$9}>
2018
2074
  `;
2019
2075
 
2020
2076
  this.baseElement.appendChild(template.content.cloneNode(true));
2021
2077
 
2022
- this.inputElement = this.shadowRoot.querySelector(componentName$7);
2023
-
2024
- forwardAttrs(this.shadowRoot.host, this.inputElement, { includeAttrs: ['required', 'pattern'] });
2025
-
2078
+ this.inputElement = this.shadowRoot.querySelector(componentName$9);
2026
2079
  }
2027
2080
  };
2028
2081
 
2029
2082
  const { borderStyle, borderWidth, ...restTextFieldMappings } =
2030
2083
  textFieldMappings;
2031
2084
 
2032
- const { digitField, label, requiredIndicator } = {
2085
+ const { digitField, label: label$1, requiredIndicator: requiredIndicator$1 } = {
2033
2086
  digitField: { selector: () => TextField.componentName },
2034
2087
  label: { selector: '> label' },
2035
2088
  requiredIndicator: { selector: '[required]::part(required-indicator)::after' }
2036
2089
  };
2037
2090
 
2038
- const textVars = TextField.cssVarList;
2091
+ const textVars$1 = TextField.cssVarList;
2039
2092
 
2040
2093
  const Passcode = compose(
2041
2094
  createStyleMixin({
2042
2095
  mappings: {
2043
2096
  ...restTextFieldMappings,
2044
- borderColor: { ...digitField, property: textVars.borderColor },
2045
- color: [restTextFieldMappings.color, label, requiredIndicator],
2097
+ borderColor: { ...digitField, property: textVars$1.borderColor },
2098
+ color: [restTextFieldMappings.color, label$1, requiredIndicator$1],
2046
2099
  },
2047
2100
  }),
2048
2101
  draggableMixin,
2049
2102
  proxyInputMixin,
2050
2103
  componentNameValidationMixin,
2051
- customMixin
2104
+ customMixin$1
2052
2105
  )(
2053
2106
  createProxy({
2054
2107
  slots: [],
@@ -2094,17 +2147,17 @@ const Passcode = compose(
2094
2147
  }
2095
2148
  `,
2096
2149
  excludeAttrsSync: ['tabindex'],
2097
- componentName: componentName$5
2150
+ componentName: componentName$7
2098
2151
  })
2099
2152
  );
2100
2153
 
2101
- customElements.define(componentName$6, TextField);
2154
+ customElements.define(componentName$8, TextField);
2102
2155
 
2103
- customElements.define(componentName$7, PasscodeInternal);
2156
+ customElements.define(componentName$9, PasscodeInternal);
2104
2157
 
2105
- customElements.define(componentName$5, Passcode);
2158
+ customElements.define(componentName$7, Passcode);
2106
2159
 
2107
- const componentName$4 = getComponentName('password-field');
2160
+ const componentName$6 = getComponentName('password-field');
2108
2161
 
2109
2162
  let overrides$2 = ``;
2110
2163
 
@@ -2129,7 +2182,7 @@ const PasswordField = compose(
2129
2182
  wrappedEleName: 'vaadin-password-field',
2130
2183
  style: () => overrides$2,
2131
2184
  excludeAttrsSync: ['tabindex'],
2132
- componentName: componentName$4
2185
+ componentName: componentName$6
2133
2186
  })
2134
2187
  );
2135
2188
 
@@ -2173,9 +2226,9 @@ overrides$2 = `
2173
2226
  }
2174
2227
  `;
2175
2228
 
2176
- customElements.define(componentName$4, PasswordField);
2229
+ customElements.define(componentName$6, PasswordField);
2177
2230
 
2178
- const componentName$3 = getComponentName('switch-toggle');
2231
+ const componentName$5 = getComponentName('switch-toggle');
2179
2232
 
2180
2233
  let overrides$1 = ``;
2181
2234
 
@@ -2195,7 +2248,7 @@ const SwitchToggle = compose(
2195
2248
  wrappedEleName: 'vaadin-checkbox',
2196
2249
  style: () => overrides$1,
2197
2250
  excludeAttrsSync: ['tabindex'],
2198
- componentName: componentName$3
2251
+ componentName: componentName$5
2199
2252
  })
2200
2253
  );
2201
2254
 
@@ -2253,11 +2306,11 @@ overrides$1 = `
2253
2306
  }
2254
2307
  `;
2255
2308
 
2256
- customElements.define(componentName$3, SwitchToggle);
2309
+ customElements.define(componentName$5, SwitchToggle);
2257
2310
 
2258
- const componentName$2 = getComponentName('text-area');
2311
+ const componentName$4 = getComponentName('text-area');
2259
2312
 
2260
- const selectors$1 = {
2313
+ const selectors = {
2261
2314
  label: '::part(label)',
2262
2315
  input: '::part(input-field)',
2263
2316
  required: '::part(required-indicator)::after',
@@ -2270,16 +2323,16 @@ const TextArea = compose(
2270
2323
  createStyleMixin({
2271
2324
  mappings: {
2272
2325
  resize: { selector: '> textarea' },
2273
- color: { selector: selectors$1.label },
2326
+ color: { selector: selectors.label },
2274
2327
  cursor: {},
2275
- width: { selector: selectors$1.host },
2276
- backgroundColor: { selector: selectors$1.input },
2277
- borderWidth: { selector: selectors$1.input },
2278
- borderStyle: { selector: selectors$1.input },
2279
- borderColor: { selector: selectors$1.input },
2280
- borderRadius: { selector: selectors$1.input },
2281
- outline: { selector: selectors$1.input },
2282
- outlineOffset: { selector: selectors$1.input }
2328
+ width: { selector: selectors.host },
2329
+ backgroundColor: { selector: selectors.input },
2330
+ borderWidth: { selector: selectors.input },
2331
+ borderStyle: { selector: selectors.input },
2332
+ borderColor: { selector: selectors.input },
2333
+ borderRadius: { selector: selectors.input },
2334
+ outline: { selector: selectors.input },
2335
+ outlineOffset: { selector: selectors.input }
2283
2336
  }
2284
2337
  }),
2285
2338
  draggableMixin,
@@ -2291,7 +2344,7 @@ const TextArea = compose(
2291
2344
  wrappedEleName: 'vaadin-text-area',
2292
2345
  style: () => overrides,
2293
2346
  excludeAttrsSync: ['tabindex'],
2294
- componentName: componentName$2
2347
+ componentName: componentName$4
2295
2348
  })
2296
2349
  );
2297
2350
 
@@ -2317,13 +2370,13 @@ overrides = `
2317
2370
  }
2318
2371
  `;
2319
2372
 
2320
- customElements.define(componentName$2, TextArea);
2373
+ customElements.define(componentName$4, TextArea);
2321
2374
 
2322
2375
  const observedAttributes = ['src', 'alt'];
2323
2376
 
2324
- const componentName$1 = getComponentName('image');
2377
+ const componentName$3 = getComponentName('image');
2325
2378
 
2326
- const BaseClass = createBaseClass({ componentName: componentName$1, baseSelector: ':host > img' });
2379
+ const BaseClass = createBaseClass({ componentName: componentName$3, baseSelector: ':host > img' });
2327
2380
  class RawImage extends BaseClass {
2328
2381
  static get observedAttributes() {
2329
2382
  return observedAttributes.concat(BaseClass.observedAttributes || []);
@@ -2363,160 +2416,1922 @@ const Image = compose(
2363
2416
  draggableMixin,
2364
2417
  )(RawImage);
2365
2418
 
2366
- customElements.define(componentName$1, Image);
2367
-
2368
- const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
2369
-
2370
- const transformTheme = (theme, path, getTransformation) => {
2371
- return Object.entries(theme).reduce((acc, [key, val]) => {
2372
- if (val?.constructor !== Object) {
2373
- return merge(acc, getTransformation(path.concat(key), val));
2374
- } else {
2375
- return merge(acc, transformTheme(val, [...path, key], getTransformation));
2376
- }
2377
- }, {});
2378
- };
2419
+ customElements.define(componentName$3, Image);
2379
2420
 
2380
- const stringifyArray = (strArr) =>
2381
- strArr.map((str) => (str.includes(' ') ? `"${str}"` : str)).join(', ');
2421
+ const componentName$2 = getComponentName('combo-box');
2382
2422
 
2383
- const themeToCSSVarsObj = (theme) =>
2384
- transformTheme(theme, [], (path, val) => ({
2385
- [getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
2386
- }));
2387
2423
 
2388
- const getThemeRefs = (theme, prefix) =>
2389
- transformTheme(theme, [], (path) =>
2390
- set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)
2391
- );
2424
+ const ComboBoxMixin = (superclass) => class ComboBoxMixinClass extends superclass {
2425
+ constructor() {
2426
+ super();
2427
+ }
2392
2428
 
2393
- const globalsThemeToStyle = (theme, themeName = '') => `
2394
- *[data-theme="${themeName}"] {
2395
- ${Object.entries(themeToCSSVarsObj(theme)).reduce(
2396
- (acc, entry) => (acc += `${entry.join(':')};\n`),
2397
- ''
2398
- )}
2399
- }
2400
- `;
2429
+ // vaadin api is to set props on their combo box node,
2430
+ // in order to avoid it, we are passing the children of this component
2431
+ // to the items & renderer props, so it will be used as the combo box items
2432
+ #onChildrenChange() {
2433
+ const baseElement = this.shadowRoot.querySelector(this.baseSelector);
2434
+ const items = Array.from(this.children);
2401
2435
 
2402
- const componentsThemeToStyleObj = (componentsTheme) =>
2403
- transformTheme(componentsTheme, [], (path, val) => {
2404
- const [component, ...restPath] = path;
2405
- const property = restPath.pop();
2406
- const componentName = getComponentName(component);
2436
+ // we want the data-name attribute to be accessible as an object attribute
2437
+ if (items.length) {
2438
+ items.forEach((node) => {
2439
+ Object.defineProperty(node, 'data-name', {
2440
+ value: node.getAttribute('data-name'),
2441
+ });
2442
+ Object.defineProperty(node, 'data-id', {
2443
+ value: node.getAttribute('data-id')
2444
+ });
2445
+ });
2407
2446
 
2408
- // we need a support for portal components theme (e.g. overlay)
2409
- // this allows us to generate those themes under different sections
2410
- // if the theme has root level attribute that starts with #
2411
- // we are generating a new theme
2412
- let themeName = BASE_THEME_SECTION;
2447
+ baseElement.items = items;
2413
2448
 
2414
- if (restPath[0] && restPath[0].startsWith(PORTAL_THEME_PREFIX)) {
2415
- themeName = restPath.shift();
2449
+ baseElement.renderer = (root, combo, model) => {
2450
+ root.innerHTML = model.item.outerHTML;
2451
+ };
2416
2452
  }
2453
+ }
2417
2454
 
2418
- // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
2419
- // starts with underscore -> attribute selector
2420
- const attrsSelector = restPath.reduce((acc, section, idx) => {
2421
- if (section.startsWith('_'))
2422
- return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
2423
-
2424
- const nextSection = restPath[idx + 1];
2425
-
2426
- if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
2427
- console.error(
2428
- 'theme generator',
2429
- `your theme structure is invalid, attribute "${section}" is followed by "${nextSection}" which is not allowed`
2430
- );
2431
- return acc;
2432
- }
2433
-
2434
- return (acc += `[${kebabCase(section)}="${restPath
2435
- .splice(idx + 1, 1)
2436
- .join('')}"]`);
2437
- }, '');
2438
-
2439
- let selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
2440
-
2441
- return {
2442
- [componentName]: {
2443
- [themeName]: {
2444
- [selector]: {
2445
- [property]: val
2446
- }
2447
- }
2448
- }
2449
- };
2450
- });
2455
+ // the default vaadin behavior is to attach the overlay to the body when opened
2456
+ // we do not want that because it's difficult to style the overlay in this way
2457
+ // so we override it to open inside the shadow DOM
2458
+ #overrideOverlaySettings() {
2459
+ const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
2451
2460
 
2461
+ overlay._attachOverlay = function () { this.bringToFront(); };
2462
+ overlay._detachOverlay = function () { };
2463
+ overlay._enterModalState = function () { };
2464
+ }
2452
2465
 
2453
- const createComponentsTheme = (componentsTheme) => {
2454
- const styleObj = componentsThemeToStyleObj(componentsTheme);
2466
+ connectedCallback() {
2467
+ super.connectedCallback?.();
2455
2468
 
2456
- return Object.keys(styleObj).reduce(
2457
- (acc, componentName) => {
2458
- const componentThemes = styleObj[componentName];
2469
+ this.#overrideOverlaySettings();
2470
+ observeChildren(this, this.#onChildrenChange.bind(this));
2471
+ }
2472
+ };
2459
2473
 
2460
- return Object.assign(acc, {
2461
- [componentName]: Object.keys(componentThemes)
2462
- .reduce((acc, theme) =>
2463
- Object.assign(acc, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
2464
- {})
2465
- })
2466
- },
2467
- {}
2468
- );
2474
+ const { host, input, placeholder, toggle } = {
2475
+ host: { selector: () => ':host' },
2476
+ input: { selector: '::part(input-field)' },
2477
+ placeholder: { selector: '> input:placeholder-shown' },
2478
+ toggle: { selector: '::part(toggle-button)' }
2469
2479
  };
2470
2480
 
2471
- const componentsThemeToStyle = (componentsTheme) =>
2472
- Object.entries(componentsTheme).reduce(
2473
- (acc, [selector, vars]) =>
2474
- (acc += `${selector} { \n${Object.entries(
2475
- vars
2476
- )
2477
- .map(([key, val]) => `${key}: ${val}`)
2478
- .join(';\n')} \n}\n\n`),
2479
- ''
2480
- );
2481
+ // const { slotted, selected } = {
2482
+ // slotted: { selector: () => '::slotted(*)' },
2483
+ // selected: { selector: () => '::slotted([selected])' }
2484
+ // }
2481
2485
 
2482
- const themeToStyle = ({ globals, components }, themeName) => ({
2483
- globals: globalsThemeToStyle(globals, themeName),
2484
- components: createComponentsTheme(components)
2485
- });
2486
+ const ComboBox = compose(
2487
+ createStyleMixin({
2488
+ mappings: {
2489
+ width: host,
2490
+ height: input,
2491
+ padding: input,
2486
2492
 
2487
- const useVar = (varName) => `var(${varName})`;
2493
+ backgroundColor: input,
2494
+ boxShadow: input,
2488
2495
 
2489
- const createHelperVars = (theme, prefix) => {
2490
- const res = transformTheme(theme, [], (path, value) => {
2491
- const modifiedPath = [...path];
2492
- const property = modifiedPath.splice(-1);
2493
- const varName = getCssVarName(prefix, property);
2496
+ borderColor: input,
2497
+ borderWidth: input,
2498
+ borderStyle: input,
2499
+ borderRadius: input,
2494
2500
 
2495
- const vars = { [property]: varName };
2496
- const theme = set({}, [...modifiedPath, varName], value);
2497
- const useVars = { [property]: useVar(varName) };
2501
+ color: input,
2498
2502
 
2499
- return { theme, useVars, vars };
2500
- });
2503
+ // we apply font-size also on the host so we can set its width with em
2504
+ fontSize: [{}, host],
2501
2505
 
2502
- return [res.theme, res.useVars, res.vars];
2503
- };
2506
+ placeholderColor: { ...placeholder, property: 'color' },
2504
2507
 
2505
- const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
2506
- const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
2507
- const genContrast = (c, percentage = 0.9) => {
2508
- const isDark = c.isDark();
2509
- return c
2510
- .mix(Color(isDark ? 'white' : 'black'), percentage)
2511
- .saturate(1)
2512
- .hex();
2513
- };
2508
+ toggleCursor: { ...toggle, property: 'cursor' },
2509
+ toggleColor: { ...toggle, property: 'color' },
2514
2510
 
2515
- const genColor = (color) => {
2516
- const mainColor = new Color(color.main || color);
2511
+ // we need to use the variables from the portal mixin
2512
+ // so we need to use an arrow function on the selector
2513
+ // for that to work, because ComboBox is not available
2514
+ // at this time.
2515
+ overlayBackground: { property: () => ComboBox.cssVarList.overlay.backgroundColor },
2516
+ overlayBorder: { property: () => ComboBox.cssVarList.overlay.border }
2517
+ }
2518
+ }),
2519
+ draggableMixin,
2520
+ portalMixin({
2521
+ name: 'overlay',
2522
+ selector: '',
2523
+ mappings: {
2524
+ backgroundColor: { selector: 'vaadin-combo-box-scroller' },
2525
+ // TODO: this mapping doesn't work, needs fixing.
2526
+ cursor: { selector: 'vaadin-combo-box-item' },
2527
+ },
2528
+ forward: {
2529
+ include: false,
2530
+ attributes: ['size']
2531
+ },
2532
+ }),
2533
+ proxyInputMixin,
2534
+ componentNameValidationMixin,
2535
+ ComboBoxMixin
2536
+ )(
2537
+ createProxy({
2538
+ slots: ['prefix'],
2539
+ wrappedEleName: 'vaadin-combo-box',
2540
+ style: () => `
2541
+ :host {
2542
+ display: inline-flex;
2543
+ box-sizing: border-box;
2544
+ -webkit-mask-image: none;
2545
+ }
2546
+ vaadin-combo-box {
2547
+ padding: 0;
2548
+ }
2549
+ vaadin-combo-box [slot="input"] {
2550
+ -webkit-mask-image: none;
2551
+ min-height: 0;
2552
+ }
2553
+ vaadin-combo-box::part(input-field) {
2554
+ -webkit-mask-image: none;
2555
+ border-radius: 0;
2556
+ padding: 0;
2557
+ }
2558
+ `,
2559
+ // Note: we exclude `size` to avoid overriding Vaadin's ComboBox property
2560
+ // with the same name. Including it will cause Vaadin to calculate NaN size,
2561
+ // and reset items to an empty array, and opening the list box with no items
2562
+ // to display.
2563
+ excludeAttrsSync: ['tabindex', 'size'],
2564
+ componentName: componentName$2,
2565
+ includeForwardProps: ['items', 'renderer']
2566
+ })
2567
+ );
2517
2568
 
2518
- return {
2519
- main: mainColor.hex(),
2569
+ customElements.define(componentName$2, ComboBox);
2570
+
2571
+ var CountryCodes = [
2572
+ {
2573
+ name: 'Afghanistan',
2574
+ dialCode: '+93',
2575
+ code: 'AF'
2576
+ },
2577
+ {
2578
+ name: 'Aland Islands',
2579
+ dialCode: '+358',
2580
+ code: 'AX'
2581
+ },
2582
+ {
2583
+ name: 'Albania',
2584
+ dialCode: '+355',
2585
+ code: 'AL'
2586
+ },
2587
+ {
2588
+ name: 'Algeria',
2589
+ dialCode: '+213',
2590
+ code: 'DZ'
2591
+ },
2592
+ {
2593
+ name: 'AmericanSamoa',
2594
+ dialCode: '+1684',
2595
+ code: 'AS'
2596
+ },
2597
+ {
2598
+ name: 'Andorra',
2599
+ dialCode: '+376',
2600
+ code: 'AD'
2601
+ },
2602
+ {
2603
+ name: 'Angola',
2604
+ dialCode: '+244',
2605
+ code: 'AO'
2606
+ },
2607
+ {
2608
+ name: 'Anguilla',
2609
+ dialCode: '+1264',
2610
+ code: 'AI'
2611
+ },
2612
+ {
2613
+ name: 'Antarctica',
2614
+ dialCode: '+672',
2615
+ code: 'AQ'
2616
+ },
2617
+ {
2618
+ name: 'Antigua and Barbuda',
2619
+ dialCode: '+1268',
2620
+ code: 'AG'
2621
+ },
2622
+ {
2623
+ name: 'Argentina',
2624
+ dialCode: '+54',
2625
+ code: 'AR'
2626
+ },
2627
+ {
2628
+ name: 'Armenia',
2629
+ dialCode: '+374',
2630
+ code: 'AM'
2631
+ },
2632
+ {
2633
+ name: 'Aruba',
2634
+ dialCode: '+297',
2635
+ code: 'AW'
2636
+ },
2637
+ {
2638
+ name: 'Australia',
2639
+ dialCode: '+61',
2640
+ code: 'AU'
2641
+ },
2642
+ {
2643
+ name: 'Austria',
2644
+ dialCode: '+43',
2645
+ code: 'AT'
2646
+ },
2647
+ {
2648
+ name: 'Azerbaijan',
2649
+ dialCode: '+994',
2650
+ code: 'AZ'
2651
+ },
2652
+ {
2653
+ name: 'Bahamas',
2654
+ dialCode: '+1242',
2655
+ code: 'BS'
2656
+ },
2657
+ {
2658
+ name: 'Bahrain',
2659
+ dialCode: '+973',
2660
+ code: 'BH'
2661
+ },
2662
+ {
2663
+ name: 'Bangladesh',
2664
+ dialCode: '+880',
2665
+ code: 'BD'
2666
+ },
2667
+ {
2668
+ name: 'Barbados',
2669
+ dialCode: '+1246',
2670
+ code: 'BB'
2671
+ },
2672
+ {
2673
+ name: 'Belarus',
2674
+ dialCode: '+375',
2675
+ code: 'BY'
2676
+ },
2677
+ {
2678
+ name: 'Belgium',
2679
+ dialCode: '+32',
2680
+ code: 'BE'
2681
+ },
2682
+ {
2683
+ name: 'Belize',
2684
+ dialCode: '+501',
2685
+ code: 'BZ'
2686
+ },
2687
+ {
2688
+ name: 'Benin',
2689
+ dialCode: '+229',
2690
+ code: 'BJ'
2691
+ },
2692
+ {
2693
+ name: 'Bermuda',
2694
+ dialCode: '+1441',
2695
+ code: 'BM'
2696
+ },
2697
+ {
2698
+ name: 'Bhutan',
2699
+ dialCode: '+975',
2700
+ code: 'BT'
2701
+ },
2702
+ {
2703
+ name: 'Bolivia, Plurinational State of',
2704
+ dialCode: '+591',
2705
+ code: 'BO'
2706
+ },
2707
+ {
2708
+ name: 'Bosnia and Herzegovina',
2709
+ dialCode: '+387',
2710
+ code: 'BA'
2711
+ },
2712
+ {
2713
+ name: 'Botswana',
2714
+ dialCode: '+267',
2715
+ code: 'BW'
2716
+ },
2717
+ {
2718
+ name: 'Brazil',
2719
+ dialCode: '+55',
2720
+ code: 'BR'
2721
+ },
2722
+ {
2723
+ name: 'British Indian Ocean Territory',
2724
+ dialCode: '+246',
2725
+ code: 'IO'
2726
+ },
2727
+ {
2728
+ name: 'Brunei Darussalam',
2729
+ dialCode: '+673',
2730
+ code: 'BN'
2731
+ },
2732
+ {
2733
+ name: 'Bulgaria',
2734
+ dialCode: '+359',
2735
+ code: 'BG'
2736
+ },
2737
+ {
2738
+ name: 'Burkina Faso',
2739
+ dialCode: '+226',
2740
+ code: 'BF'
2741
+ },
2742
+ {
2743
+ name: 'Burundi',
2744
+ dialCode: '+257',
2745
+ code: 'BI'
2746
+ },
2747
+ {
2748
+ name: 'Cambodia',
2749
+ dialCode: '+855',
2750
+ code: 'KH'
2751
+ },
2752
+ {
2753
+ name: 'Cameroon',
2754
+ dialCode: '+237',
2755
+ code: 'CM'
2756
+ },
2757
+ {
2758
+ name: 'Canada',
2759
+ dialCode: '+1',
2760
+ code: 'CA'
2761
+ },
2762
+ {
2763
+ name: 'Cape Verde',
2764
+ dialCode: '+238',
2765
+ code: 'CV'
2766
+ },
2767
+ {
2768
+ name: 'Cayman Islands',
2769
+ dialCode: '+345',
2770
+ code: 'KY'
2771
+ },
2772
+ {
2773
+ name: 'Central African Republic',
2774
+ dialCode: '+236',
2775
+ code: 'CF'
2776
+ },
2777
+ {
2778
+ name: 'Chad',
2779
+ dialCode: '+235',
2780
+ code: 'TD'
2781
+ },
2782
+ {
2783
+ name: 'Chile',
2784
+ dialCode: '+56',
2785
+ code: 'CL'
2786
+ },
2787
+ {
2788
+ name: 'China',
2789
+ dialCode: '+86',
2790
+ code: 'CN'
2791
+ },
2792
+ {
2793
+ name: 'Christmas Island',
2794
+ dialCode: '+61',
2795
+ code: 'CX'
2796
+ },
2797
+ {
2798
+ name: 'Cocos (Keeling) Islands',
2799
+ dialCode: '+61',
2800
+ code: 'CC'
2801
+ },
2802
+ {
2803
+ name: 'Colombia',
2804
+ dialCode: '+57',
2805
+ code: 'CO'
2806
+ },
2807
+ {
2808
+ name: 'Comoros',
2809
+ dialCode: '+269',
2810
+ code: 'KM'
2811
+ },
2812
+ {
2813
+ name: 'Congo',
2814
+ dialCode: '+242',
2815
+ code: 'CG'
2816
+ },
2817
+ {
2818
+ name: 'Congo, The Democratic Republic of the Congo',
2819
+ dialCode: '+243',
2820
+ code: 'CD'
2821
+ },
2822
+ {
2823
+ name: 'Cook Islands',
2824
+ dialCode: '+682',
2825
+ code: 'CK'
2826
+ },
2827
+ {
2828
+ name: 'Costa Rica',
2829
+ dialCode: '+506',
2830
+ code: 'CR'
2831
+ },
2832
+ {
2833
+ name: "Cote d'Ivoire",
2834
+ dialCode: '+225',
2835
+ code: 'CI'
2836
+ },
2837
+ {
2838
+ name: 'Croatia',
2839
+ dialCode: '+385',
2840
+ code: 'HR'
2841
+ },
2842
+ {
2843
+ name: 'Cuba',
2844
+ dialCode: '+53',
2845
+ code: 'CU'
2846
+ },
2847
+ {
2848
+ name: 'Cyprus',
2849
+ dialCode: '+357',
2850
+ code: 'CY'
2851
+ },
2852
+ {
2853
+ name: 'Czech Republic',
2854
+ dialCode: '+420',
2855
+ code: 'CZ'
2856
+ },
2857
+ {
2858
+ name: 'Denmark',
2859
+ dialCode: '+45',
2860
+ code: 'DK'
2861
+ },
2862
+ {
2863
+ name: 'Djibouti',
2864
+ dialCode: '+253',
2865
+ code: 'DJ'
2866
+ },
2867
+ {
2868
+ name: 'Dominica',
2869
+ dialCode: '+1767',
2870
+ code: 'DM'
2871
+ },
2872
+ {
2873
+ name: 'Dominican Republic',
2874
+ dialCode: '+1849',
2875
+ code: 'DO'
2876
+ },
2877
+ {
2878
+ name: 'Ecuador',
2879
+ dialCode: '+593',
2880
+ code: 'EC'
2881
+ },
2882
+ {
2883
+ name: 'Egypt',
2884
+ dialCode: '+20',
2885
+ code: 'EG'
2886
+ },
2887
+ {
2888
+ name: 'El Salvador',
2889
+ dialCode: '+503',
2890
+ code: 'SV'
2891
+ },
2892
+ {
2893
+ name: 'Equatorial Guinea',
2894
+ dialCode: '+240',
2895
+ code: 'GQ'
2896
+ },
2897
+ {
2898
+ name: 'Eritrea',
2899
+ dialCode: '+291',
2900
+ code: 'ER'
2901
+ },
2902
+ {
2903
+ name: 'Estonia',
2904
+ dialCode: '+372',
2905
+ code: 'EE'
2906
+ },
2907
+ {
2908
+ name: 'Ethiopia',
2909
+ dialCode: '+251',
2910
+ code: 'ET'
2911
+ },
2912
+ {
2913
+ name: 'Falkland Islands (Malvinas)',
2914
+ dialCode: '+500',
2915
+ code: 'FK'
2916
+ },
2917
+ {
2918
+ name: 'Faroe Islands',
2919
+ dialCode: '+298',
2920
+ code: 'FO'
2921
+ },
2922
+ {
2923
+ name: 'Fiji',
2924
+ dialCode: '+679',
2925
+ code: 'FJ'
2926
+ },
2927
+ {
2928
+ name: 'Finland',
2929
+ dialCode: '+358',
2930
+ code: 'FI'
2931
+ },
2932
+ {
2933
+ name: 'France',
2934
+ dialCode: '+33',
2935
+ code: 'FR'
2936
+ },
2937
+ {
2938
+ name: 'French Guiana',
2939
+ dialCode: '+594',
2940
+ code: 'GF'
2941
+ },
2942
+ {
2943
+ name: 'French Polynesia',
2944
+ dialCode: '+689',
2945
+ code: 'PF'
2946
+ },
2947
+ {
2948
+ name: 'Gabon',
2949
+ dialCode: '+241',
2950
+ code: 'GA'
2951
+ },
2952
+ {
2953
+ name: 'Gambia',
2954
+ dialCode: '+220',
2955
+ code: 'GM'
2956
+ },
2957
+ {
2958
+ name: 'Georgia',
2959
+ dialCode: '+995',
2960
+ code: 'GE'
2961
+ },
2962
+ {
2963
+ name: 'Germany',
2964
+ dialCode: '+49',
2965
+ code: 'DE'
2966
+ },
2967
+ {
2968
+ name: 'Ghana',
2969
+ dialCode: '+233',
2970
+ code: 'GH'
2971
+ },
2972
+ {
2973
+ name: 'Gibraltar',
2974
+ dialCode: '+350',
2975
+ code: 'GI'
2976
+ },
2977
+ {
2978
+ name: 'Greece',
2979
+ dialCode: '+30',
2980
+ code: 'GR'
2981
+ },
2982
+ {
2983
+ name: 'Greenland',
2984
+ dialCode: '+299',
2985
+ code: 'GL'
2986
+ },
2987
+ {
2988
+ name: 'Grenada',
2989
+ dialCode: '+1473',
2990
+ code: 'GD'
2991
+ },
2992
+ {
2993
+ name: 'Guadeloupe',
2994
+ dialCode: '+590',
2995
+ code: 'GP'
2996
+ },
2997
+ {
2998
+ name: 'Guam',
2999
+ dialCode: '+1671',
3000
+ code: 'GU'
3001
+ },
3002
+ {
3003
+ name: 'Guatemala',
3004
+ dialCode: '+502',
3005
+ code: 'GT'
3006
+ },
3007
+ {
3008
+ name: 'Guernsey',
3009
+ dialCode: '+44',
3010
+ code: 'GG'
3011
+ },
3012
+ {
3013
+ name: 'Guinea',
3014
+ dialCode: '+224',
3015
+ code: 'GN'
3016
+ },
3017
+ {
3018
+ name: 'Guinea-Bissau',
3019
+ dialCode: '+245',
3020
+ code: 'GW'
3021
+ },
3022
+ {
3023
+ name: 'Guyana',
3024
+ dialCode: '+595',
3025
+ code: 'GY'
3026
+ },
3027
+ {
3028
+ name: 'Haiti',
3029
+ dialCode: '+509',
3030
+ code: 'HT'
3031
+ },
3032
+ {
3033
+ name: 'Holy See (Vatican City State)',
3034
+ dialCode: '+379',
3035
+ code: 'VA'
3036
+ },
3037
+ {
3038
+ name: 'Honduras',
3039
+ dialCode: '+504',
3040
+ code: 'HN'
3041
+ },
3042
+ {
3043
+ name: 'Hong Kong',
3044
+ dialCode: '+852',
3045
+ code: 'HK'
3046
+ },
3047
+ {
3048
+ name: 'Hungary',
3049
+ dialCode: '+36',
3050
+ code: 'HU'
3051
+ },
3052
+ {
3053
+ name: 'Iceland',
3054
+ dialCode: '+354',
3055
+ code: 'IS'
3056
+ },
3057
+ {
3058
+ name: 'India',
3059
+ dialCode: '+91',
3060
+ code: 'IN'
3061
+ },
3062
+ {
3063
+ name: 'Indonesia',
3064
+ dialCode: '+62',
3065
+ code: 'ID'
3066
+ },
3067
+ {
3068
+ name: 'Iran, Islamic Republic of Persian Gulf',
3069
+ dialCode: '+98',
3070
+ code: 'IR'
3071
+ },
3072
+ {
3073
+ name: 'Iraq',
3074
+ dialCode: '+964',
3075
+ code: 'IQ'
3076
+ },
3077
+ {
3078
+ name: 'Ireland',
3079
+ dialCode: '+353',
3080
+ code: 'IE'
3081
+ },
3082
+ {
3083
+ name: 'Isle of Man',
3084
+ dialCode: '+44',
3085
+ code: 'IM'
3086
+ },
3087
+ {
3088
+ name: 'Israel',
3089
+ dialCode: '+972',
3090
+ code: 'IL'
3091
+ },
3092
+ {
3093
+ name: 'Italy',
3094
+ dialCode: '+39',
3095
+ code: 'IT'
3096
+ },
3097
+ {
3098
+ name: 'Jamaica',
3099
+ dialCode: '+1876',
3100
+ code: 'JM'
3101
+ },
3102
+ {
3103
+ name: 'Japan',
3104
+ dialCode: '+81',
3105
+ code: 'JP'
3106
+ },
3107
+ {
3108
+ name: 'Jersey',
3109
+ dialCode: '+44',
3110
+ code: 'JE'
3111
+ },
3112
+ {
3113
+ name: 'Jordan',
3114
+ dialCode: '+962',
3115
+ code: 'JO'
3116
+ },
3117
+ {
3118
+ name: 'Kazakhstan',
3119
+ dialCode: '+77',
3120
+ code: 'KZ'
3121
+ },
3122
+ {
3123
+ name: 'Kenya',
3124
+ dialCode: '+254',
3125
+ code: 'KE'
3126
+ },
3127
+ {
3128
+ name: 'Kiribati',
3129
+ dialCode: '+686',
3130
+ code: 'KI'
3131
+ },
3132
+ {
3133
+ name: "Korea, Democratic People's Republic of Korea",
3134
+ dialCode: '+850',
3135
+ code: 'KP'
3136
+ },
3137
+ {
3138
+ name: 'Korea, Republic of South Korea',
3139
+ dialCode: '+82',
3140
+ code: 'KR'
3141
+ },
3142
+ {
3143
+ name: 'Kuwait',
3144
+ dialCode: '+965',
3145
+ code: 'KW'
3146
+ },
3147
+ {
3148
+ name: 'Kyrgyzstan',
3149
+ dialCode: '+996',
3150
+ code: 'KG'
3151
+ },
3152
+ {
3153
+ name: 'Laos',
3154
+ dialCode: '+856',
3155
+ code: 'LA'
3156
+ },
3157
+ {
3158
+ name: 'Latvia',
3159
+ dialCode: '+371',
3160
+ code: 'LV'
3161
+ },
3162
+ {
3163
+ name: 'Lebanon',
3164
+ dialCode: '+961',
3165
+ code: 'LB'
3166
+ },
3167
+ {
3168
+ name: 'Lesotho',
3169
+ dialCode: '+266',
3170
+ code: 'LS'
3171
+ },
3172
+ {
3173
+ name: 'Liberia',
3174
+ dialCode: '+231',
3175
+ code: 'LR'
3176
+ },
3177
+ {
3178
+ name: 'Libyan Arab Jamahiriya',
3179
+ dialCode: '+218',
3180
+ code: 'LY'
3181
+ },
3182
+ {
3183
+ name: 'Liechtenstein',
3184
+ dialCode: '+423',
3185
+ code: 'LI'
3186
+ },
3187
+ {
3188
+ name: 'Lithuania',
3189
+ dialCode: '+370',
3190
+ code: 'LT'
3191
+ },
3192
+ {
3193
+ name: 'Luxembourg',
3194
+ dialCode: '+352',
3195
+ code: 'LU'
3196
+ },
3197
+ {
3198
+ name: 'Macao',
3199
+ dialCode: '+853',
3200
+ code: 'MO'
3201
+ },
3202
+ {
3203
+ name: 'Macedonia',
3204
+ dialCode: '+389',
3205
+ code: 'MK'
3206
+ },
3207
+ {
3208
+ name: 'Madagascar',
3209
+ dialCode: '+261',
3210
+ code: 'MG'
3211
+ },
3212
+ {
3213
+ name: 'Malawi',
3214
+ dialCode: '+265',
3215
+ code: 'MW'
3216
+ },
3217
+ {
3218
+ name: 'Malaysia',
3219
+ dialCode: '+60',
3220
+ code: 'MY'
3221
+ },
3222
+ {
3223
+ name: 'Maldives',
3224
+ dialCode: '+960',
3225
+ code: 'MV'
3226
+ },
3227
+ {
3228
+ name: 'Mali',
3229
+ dialCode: '+223',
3230
+ code: 'ML'
3231
+ },
3232
+ {
3233
+ name: 'Malta',
3234
+ dialCode: '+356',
3235
+ code: 'MT'
3236
+ },
3237
+ {
3238
+ name: 'Marshall Islands',
3239
+ dialCode: '+692',
3240
+ code: 'MH'
3241
+ },
3242
+ {
3243
+ name: 'Martinique',
3244
+ dialCode: '+596',
3245
+ code: 'MQ'
3246
+ },
3247
+ {
3248
+ name: 'Mauritania',
3249
+ dialCode: '+222',
3250
+ code: 'MR'
3251
+ },
3252
+ {
3253
+ name: 'Mauritius',
3254
+ dialCode: '+230',
3255
+ code: 'MU'
3256
+ },
3257
+ {
3258
+ name: 'Mayotte',
3259
+ dialCode: '+262',
3260
+ code: 'YT'
3261
+ },
3262
+ {
3263
+ name: 'Mexico',
3264
+ dialCode: '+52',
3265
+ code: 'MX'
3266
+ },
3267
+ {
3268
+ name: 'Micronesia, Federated States of Micronesia',
3269
+ dialCode: '+691',
3270
+ code: 'FM'
3271
+ },
3272
+ {
3273
+ name: 'Moldova',
3274
+ dialCode: '+373',
3275
+ code: 'MD'
3276
+ },
3277
+ {
3278
+ name: 'Monaco',
3279
+ dialCode: '+377',
3280
+ code: 'MC'
3281
+ },
3282
+ {
3283
+ name: 'Mongolia',
3284
+ dialCode: '+976',
3285
+ code: 'MN'
3286
+ },
3287
+ {
3288
+ name: 'Montenegro',
3289
+ dialCode: '+382',
3290
+ code: 'ME'
3291
+ },
3292
+ {
3293
+ name: 'Montserrat',
3294
+ dialCode: '+1664',
3295
+ code: 'MS'
3296
+ },
3297
+ {
3298
+ name: 'Morocco',
3299
+ dialCode: '+212',
3300
+ code: 'MA'
3301
+ },
3302
+ {
3303
+ name: 'Mozambique',
3304
+ dialCode: '+258',
3305
+ code: 'MZ'
3306
+ },
3307
+ {
3308
+ name: 'Myanmar',
3309
+ dialCode: '+95',
3310
+ code: 'MM'
3311
+ },
3312
+ {
3313
+ name: 'Namibia',
3314
+ dialCode: '+264',
3315
+ code: 'NA'
3316
+ },
3317
+ {
3318
+ name: 'Nauru',
3319
+ dialCode: '+674',
3320
+ code: 'NR'
3321
+ },
3322
+ {
3323
+ name: 'Nepal',
3324
+ dialCode: '+977',
3325
+ code: 'NP'
3326
+ },
3327
+ {
3328
+ name: 'Netherlands',
3329
+ dialCode: '+31',
3330
+ code: 'NL'
3331
+ },
3332
+ {
3333
+ name: 'Netherlands Antilles',
3334
+ dialCode: '+599',
3335
+ code: 'AN'
3336
+ },
3337
+ {
3338
+ name: 'New Caledonia',
3339
+ dialCode: '+687',
3340
+ code: 'NC'
3341
+ },
3342
+ {
3343
+ name: 'New Zealand',
3344
+ dialCode: '+64',
3345
+ code: 'NZ'
3346
+ },
3347
+ {
3348
+ name: 'Nicaragua',
3349
+ dialCode: '+505',
3350
+ code: 'NI'
3351
+ },
3352
+ {
3353
+ name: 'Niger',
3354
+ dialCode: '+227',
3355
+ code: 'NE'
3356
+ },
3357
+ {
3358
+ name: 'Nigeria',
3359
+ dialCode: '+234',
3360
+ code: 'NG'
3361
+ },
3362
+ {
3363
+ name: 'Niue',
3364
+ dialCode: '+683',
3365
+ code: 'NU'
3366
+ },
3367
+ {
3368
+ name: 'Norfolk Island',
3369
+ dialCode: '+672',
3370
+ code: 'NF'
3371
+ },
3372
+ {
3373
+ name: 'Northern Mariana Islands',
3374
+ dialCode: '+1670',
3375
+ code: 'MP'
3376
+ },
3377
+ {
3378
+ name: 'Norway',
3379
+ dialCode: '+47',
3380
+ code: 'NO'
3381
+ },
3382
+ {
3383
+ name: 'Oman',
3384
+ dialCode: '+968',
3385
+ code: 'OM'
3386
+ },
3387
+ {
3388
+ name: 'Pakistan',
3389
+ dialCode: '+92',
3390
+ code: 'PK'
3391
+ },
3392
+ {
3393
+ name: 'Palau',
3394
+ dialCode: '+680',
3395
+ code: 'PW'
3396
+ },
3397
+ {
3398
+ name: 'Palestinian Territory, Occupied',
3399
+ dialCode: '+970',
3400
+ code: 'PS'
3401
+ },
3402
+ {
3403
+ name: 'Panama',
3404
+ dialCode: '+507',
3405
+ code: 'PA'
3406
+ },
3407
+ {
3408
+ name: 'Papua New Guinea',
3409
+ dialCode: '+675',
3410
+ code: 'PG'
3411
+ },
3412
+ {
3413
+ name: 'Paraguay',
3414
+ dialCode: '+595',
3415
+ code: 'PY'
3416
+ },
3417
+ {
3418
+ name: 'Peru',
3419
+ dialCode: '+51',
3420
+ code: 'PE'
3421
+ },
3422
+ {
3423
+ name: 'Philippines',
3424
+ dialCode: '+63',
3425
+ code: 'PH'
3426
+ },
3427
+ {
3428
+ name: 'Pitcairn',
3429
+ dialCode: '+872',
3430
+ code: 'PN'
3431
+ },
3432
+ {
3433
+ name: 'Poland',
3434
+ dialCode: '+48',
3435
+ code: 'PL'
3436
+ },
3437
+ {
3438
+ name: 'Portugal',
3439
+ dialCode: '+351',
3440
+ code: 'PT'
3441
+ },
3442
+ {
3443
+ name: 'Puerto Rico',
3444
+ dialCode: '+1939',
3445
+ code: 'PR'
3446
+ },
3447
+ {
3448
+ name: 'Qatar',
3449
+ dialCode: '+974',
3450
+ code: 'QA'
3451
+ },
3452
+ {
3453
+ name: 'Romania',
3454
+ dialCode: '+40',
3455
+ code: 'RO'
3456
+ },
3457
+ {
3458
+ name: 'Russia',
3459
+ dialCode: '+7',
3460
+ code: 'RU'
3461
+ },
3462
+ {
3463
+ name: 'Rwanda',
3464
+ dialCode: '+250',
3465
+ code: 'RW'
3466
+ },
3467
+ {
3468
+ name: 'Reunion',
3469
+ dialCode: '+262',
3470
+ code: 'RE'
3471
+ },
3472
+ {
3473
+ name: 'Saint Barthelemy',
3474
+ dialCode: '+590',
3475
+ code: 'BL'
3476
+ },
3477
+ {
3478
+ name: 'Saint Helena, Ascension and Tristan Da Cunha',
3479
+ dialCode: '+290',
3480
+ code: 'SH'
3481
+ },
3482
+ {
3483
+ name: 'Saint Kitts and Nevis',
3484
+ dialCode: '+1869',
3485
+ code: 'KN'
3486
+ },
3487
+ {
3488
+ name: 'Saint Lucia',
3489
+ dialCode: '+1758',
3490
+ code: 'LC'
3491
+ },
3492
+ {
3493
+ name: 'Saint Martin',
3494
+ dialCode: '+590',
3495
+ code: 'MF'
3496
+ },
3497
+ {
3498
+ name: 'Saint Pierre and Miquelon',
3499
+ dialCode: '+508',
3500
+ code: 'PM'
3501
+ },
3502
+ {
3503
+ name: 'Saint Vincent and the Grenadines',
3504
+ dialCode: '+1784',
3505
+ code: 'VC'
3506
+ },
3507
+ {
3508
+ name: 'Samoa',
3509
+ dialCode: '+685',
3510
+ code: 'WS'
3511
+ },
3512
+ {
3513
+ name: 'San Marino',
3514
+ dialCode: '+378',
3515
+ code: 'SM'
3516
+ },
3517
+ {
3518
+ name: 'Sao Tome and Principe',
3519
+ dialCode: '+239',
3520
+ code: 'ST'
3521
+ },
3522
+ {
3523
+ name: 'Saudi Arabia',
3524
+ dialCode: '+966',
3525
+ code: 'SA'
3526
+ },
3527
+ {
3528
+ name: 'Senegal',
3529
+ dialCode: '+221',
3530
+ code: 'SN'
3531
+ },
3532
+ {
3533
+ name: 'Serbia',
3534
+ dialCode: '+381',
3535
+ code: 'RS'
3536
+ },
3537
+ {
3538
+ name: 'Seychelles',
3539
+ dialCode: '+248',
3540
+ code: 'SC'
3541
+ },
3542
+ {
3543
+ name: 'Sierra Leone',
3544
+ dialCode: '+232',
3545
+ code: 'SL'
3546
+ },
3547
+ {
3548
+ name: 'Singapore',
3549
+ dialCode: '+65',
3550
+ code: 'SG'
3551
+ },
3552
+ {
3553
+ name: 'Slovakia',
3554
+ dialCode: '+421',
3555
+ code: 'SK'
3556
+ },
3557
+ {
3558
+ name: 'Slovenia',
3559
+ dialCode: '+386',
3560
+ code: 'SI'
3561
+ },
3562
+ {
3563
+ name: 'Solomon Islands',
3564
+ dialCode: '+677',
3565
+ code: 'SB'
3566
+ },
3567
+ {
3568
+ name: 'Somalia',
3569
+ dialCode: '+252',
3570
+ code: 'SO'
3571
+ },
3572
+ {
3573
+ name: 'South Africa',
3574
+ dialCode: '+27',
3575
+ code: 'ZA'
3576
+ },
3577
+ {
3578
+ name: 'South Sudan',
3579
+ dialCode: '+211',
3580
+ code: 'SS'
3581
+ },
3582
+ {
3583
+ name: 'South Georgia and the South Sandwich Islands',
3584
+ dialCode: '+500',
3585
+ code: 'GS'
3586
+ },
3587
+ {
3588
+ name: 'Spain',
3589
+ dialCode: '+34',
3590
+ code: 'ES'
3591
+ },
3592
+ {
3593
+ name: 'Sri Lanka',
3594
+ dialCode: '+94',
3595
+ code: 'LK'
3596
+ },
3597
+ {
3598
+ name: 'Sudan',
3599
+ dialCode: '+249',
3600
+ code: 'SD'
3601
+ },
3602
+ {
3603
+ name: 'Suriname',
3604
+ dialCode: '+597',
3605
+ code: 'SR'
3606
+ },
3607
+ {
3608
+ name: 'Svalbard and Jan Mayen',
3609
+ dialCode: '+47',
3610
+ code: 'SJ'
3611
+ },
3612
+ {
3613
+ name: 'Swaziland',
3614
+ dialCode: '+268',
3615
+ code: 'SZ'
3616
+ },
3617
+ {
3618
+ name: 'Sweden',
3619
+ dialCode: '+46',
3620
+ code: 'SE'
3621
+ },
3622
+ {
3623
+ name: 'Switzerland',
3624
+ dialCode: '+41',
3625
+ code: 'CH'
3626
+ },
3627
+ {
3628
+ name: 'Syrian Arab Republic',
3629
+ dialCode: '+963',
3630
+ code: 'SY'
3631
+ },
3632
+ {
3633
+ name: 'Taiwan',
3634
+ dialCode: '+886',
3635
+ code: 'TW'
3636
+ },
3637
+ {
3638
+ name: 'Tajikistan',
3639
+ dialCode: '+992',
3640
+ code: 'TJ'
3641
+ },
3642
+ {
3643
+ name: 'Tanzania, United Republic of Tanzania',
3644
+ dialCode: '+255',
3645
+ code: 'TZ'
3646
+ },
3647
+ {
3648
+ name: 'Thailand',
3649
+ dialCode: '+66',
3650
+ code: 'TH'
3651
+ },
3652
+ {
3653
+ name: 'Timor-Leste',
3654
+ dialCode: '+670',
3655
+ code: 'TL'
3656
+ },
3657
+ {
3658
+ name: 'Togo',
3659
+ dialCode: '+228',
3660
+ code: 'TG'
3661
+ },
3662
+ {
3663
+ name: 'Tokelau',
3664
+ dialCode: '+690',
3665
+ code: 'TK'
3666
+ },
3667
+ {
3668
+ name: 'Tonga',
3669
+ dialCode: '+676',
3670
+ code: 'TO'
3671
+ },
3672
+ {
3673
+ name: 'Trinidad and Tobago',
3674
+ dialCode: '+1868',
3675
+ code: 'TT'
3676
+ },
3677
+ {
3678
+ name: 'Tunisia',
3679
+ dialCode: '+216',
3680
+ code: 'TN'
3681
+ },
3682
+ {
3683
+ name: 'Turkey',
3684
+ dialCode: '+90',
3685
+ code: 'TR'
3686
+ },
3687
+ {
3688
+ name: 'Turkmenistan',
3689
+ dialCode: '+993',
3690
+ code: 'TM'
3691
+ },
3692
+ {
3693
+ name: 'Turks and Caicos Islands',
3694
+ dialCode: '+1649',
3695
+ code: 'TC'
3696
+ },
3697
+ {
3698
+ name: 'Tuvalu',
3699
+ dialCode: '+688',
3700
+ code: 'TV'
3701
+ },
3702
+ {
3703
+ name: 'Uganda',
3704
+ dialCode: '+256',
3705
+ code: 'UG'
3706
+ },
3707
+ {
3708
+ name: 'Ukraine',
3709
+ dialCode: '+380',
3710
+ code: 'UA'
3711
+ },
3712
+ {
3713
+ name: 'United Arab Emirates',
3714
+ dialCode: '+971',
3715
+ code: 'AE'
3716
+ },
3717
+ {
3718
+ name: 'United Kingdom',
3719
+ dialCode: '+44',
3720
+ code: 'GB'
3721
+ },
3722
+ {
3723
+ name: 'United States',
3724
+ dialCode: '+1',
3725
+ code: 'US'
3726
+ },
3727
+ {
3728
+ name: 'Uruguay',
3729
+ dialCode: '+598',
3730
+ code: 'UY'
3731
+ },
3732
+ {
3733
+ name: 'Uzbekistan',
3734
+ dialCode: '+998',
3735
+ code: 'UZ'
3736
+ },
3737
+ {
3738
+ name: 'Vanuatu',
3739
+ dialCode: '+678',
3740
+ code: 'VU'
3741
+ },
3742
+ {
3743
+ name: 'Venezuela, Bolivarian Republic of Venezuela',
3744
+ dialCode: '+58',
3745
+ code: 'VE'
3746
+ },
3747
+ {
3748
+ name: 'Vietnam',
3749
+ dialCode: '+84',
3750
+ code: 'VN'
3751
+ },
3752
+ {
3753
+ name: 'Virgin Islands, British',
3754
+ dialCode: '+1284',
3755
+ code: 'VG'
3756
+ },
3757
+ {
3758
+ name: 'Virgin Islands, U.S.',
3759
+ dialCode: '+1340',
3760
+ code: 'VI'
3761
+ },
3762
+ {
3763
+ name: 'Wallis and Futuna',
3764
+ dialCode: '+681',
3765
+ code: 'WF'
3766
+ },
3767
+ {
3768
+ name: 'Yemen',
3769
+ dialCode: '+967',
3770
+ code: 'YE'
3771
+ },
3772
+ {
3773
+ name: 'Zambia',
3774
+ dialCode: '+260',
3775
+ code: 'ZM'
3776
+ },
3777
+ {
3778
+ name: 'Zimbabwe',
3779
+ dialCode: '+263',
3780
+ code: 'ZW'
3781
+ }
3782
+ ].sort((a, b) => (a.name < b.name ? -1 : 1));
3783
+
3784
+ // We use JSDelivr in order to fetch the images as image file from this library (svg-country-flags)
3785
+ // This reduces our bundle size, and we use it as a static remote resource.
3786
+ const getCountryFlag = (code) =>
3787
+ `https://cdn.jsdelivr.net/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
3788
+
3789
+ const comboBoxItem = ({ code, dialCode, name: country }) => (`
3790
+ <div
3791
+ style="display:flex; flex-direction: column;"
3792
+ data-id="${code}"
3793
+ data-name="${code} ${dialCode} ${country}"
3794
+ >
3795
+ <div>
3796
+ <span>
3797
+ <img src="${getCountryFlag(code)}" width="20"/>
3798
+ </span>
3799
+ <span>${country}</span>
3800
+ </div>
3801
+ <div>
3802
+ <span>${code}</span>
3803
+ <span>${dialCode}</span>
3804
+ </div>
3805
+ </div>
3806
+ `);
3807
+
3808
+ const componentName$1 = getComponentName('phone-field-internal');
3809
+
3810
+ const commonAttrs = [
3811
+ 'disabled',
3812
+ 'size',
3813
+ 'bordered',
3814
+ 'invalid',
3815
+ ];
3816
+ const countryAttrs = ['country-input-placeholder', 'default-code'];
3817
+ const phoneAttrs = ['phone-input-placeholder', 'maxlength'];
3818
+ const mapAttrs = {
3819
+ 'country-input-placeholder': 'placeholder',
3820
+ 'phone-input-placeholder': 'placeholder',
3821
+ };
3822
+
3823
+ const inputRelatedAttrs = [].concat(commonAttrs, countryAttrs, phoneAttrs);
3824
+
3825
+ const BaseInputClass = createBaseInputClass({ componentName: componentName$1, baseSelector: 'div' });
3826
+
3827
+ class PhoneFieldInternal extends BaseInputClass {
3828
+ static get observedAttributes() {
3829
+ return [].concat(
3830
+ BaseInputClass.observedAttributes || [],
3831
+ inputRelatedAttrs,
3832
+ );
3833
+ }
3834
+
3835
+ #dispatchBlur = createDispatchEvent.bind(this, 'blur');
3836
+ #dispatchFocus = createDispatchEvent.bind(this, 'focus');
3837
+
3838
+ constructor() {
3839
+ super();
3840
+
3841
+ this.innerHTML = `
3842
+ <div>
3843
+ <descope-combo-box
3844
+ item-label-path="data-name"
3845
+ item-value-path="data-id"
3846
+ >
3847
+ ${CountryCodes.map(item => comboBoxItem(item)).join('')}
3848
+ </descope-combo-box>
3849
+ <div class="separator"></div>
3850
+ <descope-text-field type="tel"></descope-text-field>
3851
+ </div>`;
3852
+
3853
+ this.countryCodeInput = this.querySelector('descope-combo-box');
3854
+ this.phoneNumberInput = this.querySelector('descope-text-field');
3855
+ this.inputs = [
3856
+ this.countryCodeInput,
3857
+ this.phoneNumberInput
3858
+ ];
3859
+ }
3860
+
3861
+ get value() {
3862
+ return this.inputs.map(({ value }) => value).join('-');
3863
+ }
3864
+
3865
+ set value(val) {
3866
+ const [countryCode = '', phoneNumber = ''] = val.split('-');
3867
+ this.countryCodeInput.value = countryCode;
3868
+ this.phoneNumberInput.value = phoneNumber;
3869
+ }
3870
+
3871
+ get phoneNumberValue() {
3872
+ return this.phoneNumberInput.value;
3873
+ }
3874
+
3875
+ get countryCodeValue() {
3876
+ return this.countryCodeInput.shadowRoot.querySelector('input').value;
3877
+ }
3878
+
3879
+ get minLength() {
3880
+ return parseInt(this.getAttribute('minlength'), 10) || 0;
3881
+ }
3882
+
3883
+ getValidity() {
3884
+ const hasCode = this.countryCodeInput.value;
3885
+ const hasPhone = this.phoneNumberInput.value;
3886
+ const emptyValue = !hasCode || !hasPhone;
3887
+ const hasMinPhoneLength = this.phoneNumberInput.value.length && this.phoneNumberInput.value.length < this.minLength;
3888
+
3889
+ if (this.isRequired && emptyValue) {
3890
+ return { valueMissing: true };
3891
+ }
3892
+ if (hasMinPhoneLength) {
3893
+ return { tooShort: true };
3894
+ }
3895
+ if ((hasCode && !hasPhone) || (!hasCode && hasPhone)) {
3896
+ return { valueMissing: true };
3897
+ }
3898
+ return {}
3899
+ };
3900
+
3901
+ init() {
3902
+ super.init();
3903
+ this.initInputs();
3904
+ this.setComboBoxDescriptor();
3905
+ }
3906
+
3907
+ handleDefaultCountryCode(countryCode) {
3908
+ if (!this.countryCodeInput.value) {
3909
+ const countryData = this.countryCodeInput.items.find(c => c['data-id'] === countryCode)?.['data-name'];
3910
+
3911
+ // When replacing the input component (inserting internal component into text-field) -
3912
+ // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
3913
+ // after the reset.
3914
+ if (countryData) {
3915
+ setTimeout(() => this.countryCodeInput.value = countryData);
3916
+ }
3917
+ }
3918
+ }
3919
+
3920
+ // We want to override Vaadin's Combo Box value setter. This is needed since Vaadin couples between the
3921
+ // field that it searches the value, and the finaly display value of the input. We want to search ALL
3922
+ // the values (so we made a field with all the values), but display ONLY the dial code, so we added
3923
+ // this setter, which does that.
3924
+ setComboBoxDescriptor() {
3925
+ const comboBox = this.countryCodeInput;
3926
+ const input = comboBox.shadowRoot.querySelector('input');
3927
+ const valueDescriptor = Object.getOwnPropertyDescriptor(
3928
+ input.constructor.prototype,
3929
+ 'value'
3930
+ );
3931
+ Object.defineProperties(input, {
3932
+ value: {
3933
+ ...valueDescriptor,
3934
+ set(val) {
3935
+ if (!comboBox.items?.length) {
3936
+ return;
3937
+ }
3938
+
3939
+ const [_code, dialCode] = val.split(' ');
3940
+
3941
+ if (val === this.value) {
3942
+ return;
3943
+ }
3944
+
3945
+ valueDescriptor.set.call(this, dialCode || '');
3946
+ }
3947
+ }
3948
+ });
3949
+ }
3950
+
3951
+ initInputs() {
3952
+ let prevVal = this.value;
3953
+ let blurTimerId;
3954
+
3955
+ // Sanitize phone input value to filter everything but digits
3956
+ this.phoneNumberInput.addEventListener('input', (e) => {
3957
+ const telDigitsRegExp = /^\d$/;
3958
+ const sanitizedInput = e.target.value
3959
+ .split('')
3960
+ .filter(char => telDigitsRegExp.test(char))
3961
+ .join('');
3962
+ e.target.value = sanitizedInput;
3963
+ });
3964
+
3965
+ this.inputs.forEach(input => {
3966
+ input.addEventListener('blur', (e) => {
3967
+ e.stopImmediatePropagation();
3968
+ blurTimerId = setTimeout(() => {
3969
+ blurTimerId = null;
3970
+ this.#dispatchBlur();
3971
+ });
3972
+ });
3973
+
3974
+ input.addEventListener('focus', (e) => {
3975
+ e.stopImmediatePropagation();
3976
+ clearTimeout(blurTimerId);
3977
+ if (!blurTimerId) {
3978
+ this.#dispatchFocus();
3979
+ }
3980
+ });
3981
+
3982
+ input.addEventListener('input', (e) => {
3983
+ if (prevVal === this.value) {
3984
+ e.stopImmediatePropagation();
3985
+ }
3986
+ });
3987
+ });
3988
+ }
3989
+
3990
+ attributeChangedCallback(attrName, oldValue, newValue) {
3991
+ super.attributeChangedCallback(attrName, oldValue, newValue);
3992
+
3993
+ if (oldValue !== newValue) {
3994
+ if (attrName === 'default-code' && newValue) {
3995
+ this.handleDefaultCountryCode(newValue);
3996
+ }
3997
+ else if (inputRelatedAttrs.includes(attrName)) {
3998
+ const attr = mapAttrs[attrName] || attrName;
3999
+
4000
+ if (commonAttrs.includes(attrName)) {
4001
+ this.inputs.forEach(input => input.setAttribute(attr, newValue));
4002
+ }
4003
+ else if (countryAttrs.includes(attrName)) {
4004
+ this.countryCodeInput.setAttribute(attr, newValue);
4005
+ }
4006
+ else if (phoneAttrs.includes(attrName)) {
4007
+ this.phoneNumberInput.setAttribute(attr, newValue);
4008
+ }
4009
+ }
4010
+ }
4011
+ }
4012
+ }
4013
+
4014
+ customElements.define(componentName$1, PhoneFieldInternal);
4015
+
4016
+ const textVars = TextField.cssVarList;
4017
+ const comboVars = ComboBox.cssVarList;
4018
+
4019
+ const componentName = getComponentName('phone-field');
4020
+
4021
+ const customMixin = (superclass) =>
4022
+ class PhoneFieldClass extends superclass {
4023
+ constructor() {
4024
+ super();
4025
+ }
4026
+
4027
+ init() {
4028
+ super.init?.();
4029
+
4030
+ const template = document.createElement('template');
4031
+
4032
+ template.innerHTML = `
4033
+ <${componentName$1}
4034
+ tabindex="-1"
4035
+ slot="input"
4036
+ ></${componentName$1}>
4037
+ `;
4038
+
4039
+ this.baseElement.appendChild(template.content.cloneNode(true));
4040
+
4041
+ this.inputElement = this.shadowRoot.querySelector(componentName$1);
4042
+
4043
+ forwardAttrs(this.shadowRoot.host, this.inputElement, {
4044
+ includeAttrs: [
4045
+ 'size',
4046
+ 'bordered',
4047
+ 'invalid',
4048
+ 'minlength',
4049
+ 'maxlength',
4050
+ 'default-code',
4051
+ 'country-input-placeholder',
4052
+ 'phone-input-placeholder',
4053
+ ]
4054
+ });
4055
+ }
4056
+ };
4057
+
4058
+ const {
4059
+ inputWrapper,
4060
+ countryCodeInput,
4061
+ phoneInput,
4062
+ label,
4063
+ requiredIndicator,
4064
+ separator
4065
+ } = {
4066
+ inputWrapper: { selector: '::part(input-field)' },
4067
+ phoneInput: { selector: () => 'descope-text-field' },
4068
+ countryCodeInput: { selector: () => 'descope-combo-box' },
4069
+ label: { selector: '> label' },
4070
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
4071
+ separator: { selector: 'descope-phone-field-internal .separator' }
4072
+ };
4073
+
4074
+ const PhoneField = compose(
4075
+ createStyleMixin({
4076
+ mappings: {
4077
+ componentWidth: { selector: () => ':host', property: 'width' },
4078
+
4079
+ wrapperBorderStyle: [
4080
+ { ...inputWrapper, property: 'border-style' },
4081
+ { ...separator, property: 'border-left-style' }
4082
+ ],
4083
+ wrapperBorderWidth: [
4084
+ { ...inputWrapper, property: 'border-width' },
4085
+ { ...separator, property: 'border-left-width' }
4086
+ ],
4087
+ wrapperBorderColor: [
4088
+ { ...inputWrapper, property: 'border-color' },
4089
+ { ...separator, property: 'border-left-color' }
4090
+ ],
4091
+ wrapperBorderRadius: { ...inputWrapper, property: 'border-radius' },
4092
+
4093
+ inputHeight: { ...inputWrapper, property: 'height' },
4094
+
4095
+ countryCodeInputWidth: { ...countryCodeInput, property: comboVars.width },
4096
+ countryCodeDropdownWidth: {
4097
+ ...countryCodeInput,
4098
+ property: '--vaadin-combo-box-overlay-width'
4099
+ },
4100
+
4101
+ phoneInputWidth: { ...phoneInput, property: 'width' },
4102
+
4103
+ color: [label, requiredIndicator],
4104
+
4105
+ placeholderColor: {
4106
+ ...phoneInput,
4107
+ property: textVars.placeholderColor
4108
+ },
4109
+
4110
+ overlayItemBackgroundColor: {
4111
+ selector: 'descope-combo-box',
4112
+ property: comboVars.overlayItemBackgroundColor
4113
+ },
4114
+ },
4115
+ }),
4116
+ draggableMixin,
4117
+ proxyInputMixin,
4118
+ customMixin,
4119
+ )(
4120
+ createProxy({
4121
+ slots: [],
4122
+ wrappedEleName: 'vaadin-text-field',
4123
+ style: () => `
4124
+ :host {
4125
+ --vaadin-field-default-width: auto;
4126
+ display: inline-block;
4127
+ }
4128
+ div {
4129
+ display: inline-flex;
4130
+ }
4131
+ vaadin-text-field {
4132
+ padding: 0;
4133
+ width: 100%;
4134
+ height: 100%;
4135
+ }
4136
+ vaadin-text-field::part(input-field) {
4137
+ padding: 0;
4138
+ min-height: 0;
4139
+ background: transparent;
4140
+ overflow: hidden;
4141
+ }
4142
+ descope-phone-field-internal {
4143
+ -webkit-mask-image: none;
4144
+ padding: 0;
4145
+ min-height: 0;
4146
+ width: 100%;
4147
+ height: 100%;
4148
+ }
4149
+ descope-phone-field-internal > div {
4150
+ width: 100%;
4151
+ height: 100%;
4152
+ }
4153
+ descope-phone-field-internal .separator {
4154
+ flex: 0;
4155
+ border: none;
4156
+ }
4157
+ descope-combo-box {
4158
+ flex-shrink: 0;
4159
+ height: 100%;
4160
+ ${comboVars.borderWidth}: 0;
4161
+ }
4162
+ descope-text-field {
4163
+ flex-grow: 1;
4164
+ min-height: 0;
4165
+ height: 100%;
4166
+ ${textVars.borderWidth}: 0;
4167
+ ${textVars.borderRadius}: 0;
4168
+ }
4169
+ vaadin-text-field[required]::part(required-indicator)::after {
4170
+ content: "*";
4171
+ }
4172
+ vaadin-text-field[readonly] > input:placeholder-shown {
4173
+ opacity: 1;
4174
+ }
4175
+ `,
4176
+ excludeAttrsSync: ['tabindex'],
4177
+ componentName
4178
+ })
4179
+ );
4180
+
4181
+ customElements.define(componentName, PhoneField);
4182
+
4183
+ const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
4184
+
4185
+ const transformTheme = (theme, path, getTransformation) => {
4186
+ return Object.entries(theme).reduce((acc, [key, val]) => {
4187
+ if (val?.constructor !== Object) {
4188
+ return merge(acc, getTransformation(path.concat(key), val));
4189
+ } else {
4190
+ return merge(acc, transformTheme(val, [...path, key], getTransformation));
4191
+ }
4192
+ }, {});
4193
+ };
4194
+
4195
+ const stringifyArray = (strArr) =>
4196
+ strArr.map((str) => (str.includes(' ') ? `"${str}"` : str)).join(', ');
4197
+
4198
+ const themeToCSSVarsObj = (theme) =>
4199
+ transformTheme(theme, [], (path, val) => ({
4200
+ [getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
4201
+ }));
4202
+
4203
+ const getThemeRefs = (theme, prefix) =>
4204
+ transformTheme(theme, [], (path) =>
4205
+ set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)
4206
+ );
4207
+
4208
+ const globalsThemeToStyle = (theme, themeName = '') => `
4209
+ *[data-theme="${themeName}"] {
4210
+ ${Object.entries(themeToCSSVarsObj(theme)).reduce(
4211
+ (acc, entry) => (acc += `${entry.join(':')};\n`),
4212
+ ''
4213
+ )}
4214
+ }
4215
+ `;
4216
+
4217
+ const componentsThemeToStyleObj = (componentsTheme) =>
4218
+ transformTheme(componentsTheme, [], (path, val) => {
4219
+ const [component, ...restPath] = path;
4220
+ const property = restPath.pop();
4221
+ const componentName = getComponentName(component);
4222
+
4223
+ // we need a support for portal components theme (e.g. overlay)
4224
+ // this allows us to generate those themes under different sections
4225
+ // if the theme has root level attribute that starts with #
4226
+ // we are generating a new theme
4227
+ let themeName = BASE_THEME_SECTION;
4228
+
4229
+ if (restPath[0] && restPath[0].startsWith(PORTAL_THEME_PREFIX)) {
4230
+ themeName = restPath.shift();
4231
+ }
4232
+
4233
+ // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
4234
+ // starts with underscore -> attribute selector
4235
+ const attrsSelector = restPath.reduce((acc, section, idx) => {
4236
+ if (section.startsWith('_'))
4237
+ return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
4238
+
4239
+ const nextSection = restPath[idx + 1];
4240
+
4241
+ if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
4242
+ console.error(
4243
+ 'theme generator',
4244
+ `your theme structure is invalid, attribute "${section}" is followed by "${nextSection}" which is not allowed`
4245
+ );
4246
+ return acc;
4247
+ }
4248
+
4249
+ return (acc += `[${kebabCase(section)}="${restPath
4250
+ .splice(idx + 1, 1)
4251
+ .join('')}"]`);
4252
+ }, '');
4253
+
4254
+ let selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
4255
+
4256
+ return {
4257
+ [componentName]: {
4258
+ [themeName]: {
4259
+ [selector]: {
4260
+ [property]: val
4261
+ }
4262
+ }
4263
+ }
4264
+ };
4265
+ });
4266
+
4267
+
4268
+ const createComponentsTheme = (componentsTheme) => {
4269
+ const styleObj = componentsThemeToStyleObj(componentsTheme);
4270
+
4271
+ return Object.keys(styleObj).reduce(
4272
+ (acc, componentName) => {
4273
+ const componentThemes = styleObj[componentName];
4274
+
4275
+ return Object.assign(acc, {
4276
+ [componentName]: Object.keys(componentThemes)
4277
+ .reduce((acc, theme) =>
4278
+ Object.assign(acc, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
4279
+ {})
4280
+ })
4281
+ },
4282
+ {}
4283
+ );
4284
+ };
4285
+
4286
+ const componentsThemeToStyle = (componentsTheme) =>
4287
+ Object.entries(componentsTheme).reduce(
4288
+ (acc, [selector, vars]) =>
4289
+ (acc += `${selector} { \n${Object.entries(
4290
+ vars
4291
+ )
4292
+ .map(([key, val]) => `${key}: ${val}`)
4293
+ .join(';\n')} \n}\n\n`),
4294
+ ''
4295
+ );
4296
+
4297
+ const themeToStyle = ({ globals, components }, themeName) => ({
4298
+ globals: globalsThemeToStyle(globals, themeName),
4299
+ components: createComponentsTheme(components)
4300
+ });
4301
+
4302
+ const useVar = (varName) => `var(${varName})`;
4303
+
4304
+ const createHelperVars = (theme, prefix) => {
4305
+ const res = transformTheme(theme, [], (path, value) => {
4306
+ const modifiedPath = [...path];
4307
+ const property = modifiedPath.splice(-1);
4308
+ const varName = getCssVarName(prefix, property);
4309
+
4310
+ const vars = { [property]: varName };
4311
+ const theme = set({}, [...modifiedPath, varName], value);
4312
+ const useVars = { [property]: useVar(varName) };
4313
+
4314
+ return { theme, useVars, vars };
4315
+ });
4316
+
4317
+ return [res.theme, res.useVars, res.vars];
4318
+ };
4319
+
4320
+ const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
4321
+ const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
4322
+ const genContrast = (c, percentage = 0.9) => {
4323
+ const isDark = c.isDark();
4324
+ return c
4325
+ .mix(Color(isDark ? 'white' : 'black'), percentage)
4326
+ .saturate(1)
4327
+ .hex();
4328
+ };
4329
+
4330
+ const genColor = (color) => {
4331
+ const mainColor = new Color(color.main || color);
4332
+
4333
+ return {
4334
+ main: mainColor.hex(),
2520
4335
  dark: color.dark || genDark(mainColor),
2521
4336
  light: color.light || genLight(mainColor),
2522
4337
  contrast: color.contrast || genContrast(mainColor)
@@ -2636,146 +4451,146 @@ var globals = {
2636
4451
  fonts
2637
4452
  };
2638
4453
 
2639
- const globalRefs$7 = getThemeRefs(globals);
2640
- const vars$d = Button.cssVarList;
4454
+ const globalRefs$9 = getThemeRefs(globals);
4455
+ const vars$e = Button.cssVarList;
2641
4456
 
2642
4457
  const mode = {
2643
- primary: globalRefs$7.colors.primary,
2644
- secondary: globalRefs$7.colors.secondary,
2645
- success: globalRefs$7.colors.success,
2646
- error: globalRefs$7.colors.error,
2647
- surface: globalRefs$7.colors.surface
4458
+ primary: globalRefs$9.colors.primary,
4459
+ secondary: globalRefs$9.colors.secondary,
4460
+ success: globalRefs$9.colors.success,
4461
+ error: globalRefs$9.colors.error,
4462
+ surface: globalRefs$9.colors.surface
2648
4463
  };
2649
4464
 
2650
- const [helperTheme$2, helperRefs$2] = createHelperVars({ mode }, componentName$j);
4465
+ const [helperTheme$2, helperRefs$2] = createHelperVars({ mode }, componentName$l);
2651
4466
 
2652
4467
  const button = {
2653
4468
  ...helperTheme$2,
2654
- [vars$d.width]: 'fit-content',
4469
+ [vars$e.width]: 'fit-content',
2655
4470
  size: {
2656
4471
  xs: {
2657
- [vars$d.height]: '10px',
2658
- [vars$d.fontSize]: '10px',
2659
- [vars$d.padding]: `0 ${globalRefs$7.spacing.xs}`
4472
+ [vars$e.height]: '10px',
4473
+ [vars$e.fontSize]: '10px',
4474
+ [vars$e.padding]: `0 ${globalRefs$9.spacing.xs}`
2660
4475
  },
2661
4476
  sm: {
2662
- [vars$d.height]: '20px',
2663
- [vars$d.fontSize]: '10px',
2664
- [vars$d.padding]: `0 ${globalRefs$7.spacing.sm}`
4477
+ [vars$e.height]: '20px',
4478
+ [vars$e.fontSize]: '10px',
4479
+ [vars$e.padding]: `0 ${globalRefs$9.spacing.sm}`
2665
4480
  },
2666
4481
  md: {
2667
- [vars$d.height]: '30px',
2668
- [vars$d.fontSize]: '14px',
2669
- [vars$d.padding]: `0 ${globalRefs$7.spacing.md}`
4482
+ [vars$e.height]: '30px',
4483
+ [vars$e.fontSize]: '14px',
4484
+ [vars$e.padding]: `0 ${globalRefs$9.spacing.md}`
2670
4485
  },
2671
4486
  lg: {
2672
- [vars$d.height]: '40px',
2673
- [vars$d.fontSize]: '20px',
2674
- [vars$d.padding]: `0 ${globalRefs$7.spacing.lg}`
4487
+ [vars$e.height]: '40px',
4488
+ [vars$e.fontSize]: '20px',
4489
+ [vars$e.padding]: `0 ${globalRefs$9.spacing.lg}`
2675
4490
  },
2676
4491
  xl: {
2677
- [vars$d.height]: '50px',
2678
- [vars$d.fontSize]: '25px',
2679
- [vars$d.padding]: `0 ${globalRefs$7.spacing.xl}`
4492
+ [vars$e.height]: '50px',
4493
+ [vars$e.fontSize]: '25px',
4494
+ [vars$e.padding]: `0 ${globalRefs$9.spacing.xl}`
2680
4495
  }
2681
4496
  },
2682
4497
 
2683
- [vars$d.borderRadius]: globalRefs$7.radius.lg,
2684
- [vars$d.cursor]: 'pointer',
2685
- [vars$d.borderWidth]: '2px',
2686
- [vars$d.borderStyle]: 'solid',
2687
- [vars$d.borderColor]: 'transparent',
4498
+ [vars$e.borderRadius]: globalRefs$9.radius.lg,
4499
+ [vars$e.cursor]: 'pointer',
4500
+ [vars$e.borderWidth]: '2px',
4501
+ [vars$e.borderStyle]: 'solid',
4502
+ [vars$e.borderColor]: 'transparent',
2688
4503
 
2689
4504
  _fullWidth: {
2690
- [vars$d.width]: '100%'
4505
+ [vars$e.width]: '100%'
2691
4506
  },
2692
4507
  _loading: {
2693
- [vars$d.cursor]: 'wait'
4508
+ [vars$e.cursor]: 'wait'
2694
4509
  },
2695
4510
 
2696
4511
  variant: {
2697
4512
  contained: {
2698
- [vars$d.color]: helperRefs$2.contrast,
2699
- [vars$d.backgroundColor]: helperRefs$2.main,
4513
+ [vars$e.color]: helperRefs$2.contrast,
4514
+ [vars$e.backgroundColor]: helperRefs$2.main,
2700
4515
  _hover: {
2701
- [vars$d.backgroundColor]: helperRefs$2.dark
4516
+ [vars$e.backgroundColor]: helperRefs$2.dark
2702
4517
  },
2703
4518
  _loading: {
2704
- [vars$d.backgroundColor]: helperRefs$2.main
4519
+ [vars$e.backgroundColor]: helperRefs$2.main
2705
4520
  }
2706
4521
  },
2707
4522
  outline: {
2708
- [vars$d.color]: helperRefs$2.main,
2709
- [vars$d.borderColor]: helperRefs$2.main,
4523
+ [vars$e.color]: helperRefs$2.main,
4524
+ [vars$e.borderColor]: helperRefs$2.main,
2710
4525
  _hover: {
2711
- [vars$d.color]: helperRefs$2.dark,
2712
- [vars$d.borderColor]: helperRefs$2.dark,
4526
+ [vars$e.color]: helperRefs$2.dark,
4527
+ [vars$e.borderColor]: helperRefs$2.dark,
2713
4528
  _error: {
2714
- [vars$d.color]: helperRefs$2.error
4529
+ [vars$e.color]: helperRefs$2.error
2715
4530
  }
2716
4531
  }
2717
4532
  },
2718
4533
  link: {
2719
- [vars$d.color]: helperRefs$2.main,
2720
- [vars$d.padding]: 0,
2721
- [vars$d.margin]: 0,
2722
- [vars$d.lineHeight]: helperRefs$2.height,
2723
- [vars$d.borderRadius]: 0,
4534
+ [vars$e.color]: helperRefs$2.main,
4535
+ [vars$e.padding]: 0,
4536
+ [vars$e.margin]: 0,
4537
+ [vars$e.lineHeight]: helperRefs$2.height,
4538
+ [vars$e.borderRadius]: 0,
2724
4539
  _hover: {
2725
- [vars$d.color]: helperRefs$2.main,
2726
- [vars$d.textDecoration]: 'underline'
4540
+ [vars$e.color]: helperRefs$2.main,
4541
+ [vars$e.textDecoration]: 'underline'
2727
4542
  }
2728
4543
  }
2729
4544
  }
2730
4545
  };
2731
4546
 
2732
- const globalRefs$6 = getThemeRefs(globals);
4547
+ const globalRefs$8 = getThemeRefs(globals);
2733
4548
 
2734
- const vars$c = TextField.cssVarList;
4549
+ const vars$d = TextField.cssVarList;
2735
4550
 
2736
4551
  const textField = (vars) => ({
2737
4552
  size: {
2738
4553
  xs: {
2739
4554
  [vars.height]: '14px',
2740
4555
  [vars.fontSize]: '8px',
2741
- [vars.padding]: `0 ${globalRefs$6.spacing.xs}`
4556
+ [vars.padding]: `0 ${globalRefs$8.spacing.xs}`
2742
4557
  },
2743
4558
  sm: {
2744
4559
  [vars.height]: '20px',
2745
4560
  [vars.fontSize]: '10px',
2746
- [vars.padding]: `0 ${globalRefs$6.spacing.sm}`
4561
+ [vars.padding]: `0 ${globalRefs$8.spacing.sm}`
2747
4562
  },
2748
4563
  md: {
2749
4564
  [vars.height]: '30px',
2750
4565
  [vars.fontSize]: '14px',
2751
- [vars.padding]: `0 ${globalRefs$6.spacing.md}`
4566
+ [vars.padding]: `0 ${globalRefs$8.spacing.md}`
2752
4567
  },
2753
4568
  lg: {
2754
4569
  [vars.height]: '40px',
2755
- [vars.fontSize]: '16px',
2756
- [vars.padding]: `0 ${globalRefs$6.spacing.lg}`
4570
+ [vars.fontSize]: '20px',
4571
+ [vars.padding]: `0 ${globalRefs$8.spacing.lg}`
2757
4572
  },
2758
4573
  xl: {
2759
4574
  [vars.height]: '50px',
2760
4575
  [vars.fontSize]: '25px',
2761
- [vars.padding]: `0 ${globalRefs$6.spacing.xl}`
4576
+ [vars.padding]: `0 ${globalRefs$8.spacing.xl}`
2762
4577
  }
2763
4578
  },
2764
4579
 
2765
- [vars.color]: globalRefs$6.colors.surface.contrast,
2766
- [vars.placeholderColor]: globalRefs$6.colors.surface.contrast,
4580
+ [vars.color]: globalRefs$8.colors.surface.contrast,
4581
+ [vars.placeholderColor]: globalRefs$8.colors.surface.main,
2767
4582
 
2768
- [vars.backgroundColor]: globalRefs$6.colors.surface.light,
4583
+ [vars.backgroundColor]: globalRefs$8.colors.surface.light,
2769
4584
 
2770
4585
  [vars.borderWidth]: '1px',
2771
4586
  [vars.borderStyle]: 'solid',
2772
4587
  [vars.borderColor]: 'transparent',
2773
- [vars.borderRadius]: globalRefs$6.radius.sm,
4588
+ [vars.borderRadius]: globalRefs$8.radius.sm,
2774
4589
 
2775
4590
  _disabled: {
2776
- [vars.color]: globalRefs$6.colors.surface.dark,
2777
- [vars.placeholderColor]: globalRefs$6.colors.surface.light,
2778
- [vars.backgroundColor]: globalRefs$6.colors.surface.main
4591
+ [vars.color]: globalRefs$8.colors.surface.dark,
4592
+ [vars.placeholderColor]: globalRefs$8.colors.surface.light,
4593
+ [vars.backgroundColor]: globalRefs$8.colors.surface.main
2779
4594
  },
2780
4595
 
2781
4596
  _fullWidth: {
@@ -2783,27 +4598,27 @@ const textField = (vars) => ({
2783
4598
  },
2784
4599
 
2785
4600
  _focused: {
2786
- [vars.outline]: `2px solid ${globalRefs$6.colors.surface.main}`
4601
+ [vars.outline]: `2px solid ${globalRefs$8.colors.surface.main}`
2787
4602
  },
2788
4603
 
2789
4604
  _bordered: {
2790
- [vars.borderColor]: globalRefs$6.colors.surface.main
4605
+ [vars.borderColor]: globalRefs$8.colors.surface.main
2791
4606
  },
2792
4607
 
2793
4608
  _invalid: {
2794
- [vars.borderColor]: globalRefs$6.colors.error.main,
2795
- [vars.color]: globalRefs$6.colors.error.main,
2796
- [vars.placeholderColor]: globalRefs$6.colors.error.light
4609
+ [vars.borderColor]: globalRefs$8.colors.error.main,
4610
+ [vars.color]: globalRefs$8.colors.error.main,
4611
+ [vars.placeholderColor]: globalRefs$8.colors.error.light
2797
4612
  }
2798
4613
  });
2799
4614
 
2800
- var textField$1 = textField(vars$c);
4615
+ var textField$1 = textField(vars$d);
2801
4616
 
2802
- const vars$b = PasswordField.cssVarList;
4617
+ const vars$c = PasswordField.cssVarList;
2803
4618
 
2804
4619
  const passwordField = {
2805
- ...textField(vars$b),
2806
- [vars$b.revealCursor]: 'pointer'
4620
+ ...textField(vars$c),
4621
+ [vars$c.revealCursor]: 'pointer'
2807
4622
  };
2808
4623
 
2809
4624
  const numberField = {
@@ -2814,58 +4629,58 @@ const emailField = {
2814
4629
  ...textField(EmailField.cssVarList)
2815
4630
  };
2816
4631
 
2817
- const globalRefs$5 = getThemeRefs(globals);
2818
- const vars$a = TextArea.cssVarList;
4632
+ const globalRefs$7 = getThemeRefs(globals);
4633
+ const vars$b = TextArea.cssVarList;
2819
4634
 
2820
4635
  const textArea = {
2821
- [vars$a.width]: '100%',
2822
- [vars$a.color]: globalRefs$5.colors.primary.main,
2823
- [vars$a.backgroundColor]: globalRefs$5.colors.surface.light,
2824
- [vars$a.resize]: 'vertical',
4636
+ [vars$b.width]: '100%',
4637
+ [vars$b.color]: globalRefs$7.colors.primary.main,
4638
+ [vars$b.backgroundColor]: globalRefs$7.colors.surface.light,
4639
+ [vars$b.resize]: 'vertical',
2825
4640
 
2826
- [vars$a.borderRadius]: globalRefs$5.radius.sm,
2827
- [vars$a.borderWidth]: '1px',
2828
- [vars$a.borderStyle]: 'solid',
2829
- [vars$a.borderColor]: 'transparent',
4641
+ [vars$b.borderRadius]: globalRefs$7.radius.sm,
4642
+ [vars$b.borderWidth]: '1px',
4643
+ [vars$b.borderStyle]: 'solid',
4644
+ [vars$b.borderColor]: 'transparent',
2830
4645
 
2831
4646
  _bordered: {
2832
- [vars$a.borderColor]: globalRefs$5.colors.surface.main
4647
+ [vars$b.borderColor]: globalRefs$7.colors.surface.main
2833
4648
  },
2834
4649
 
2835
4650
  _focused: {
2836
- [vars$a.outline]: `2px solid ${globalRefs$5.colors.surface.main}`
4651
+ [vars$b.outline]: `2px solid ${globalRefs$7.colors.surface.main}`
2837
4652
  },
2838
4653
 
2839
4654
  _fullWidth: {
2840
- [vars$a.width]: '100%'
4655
+ [vars$b.width]: '100%'
2841
4656
  },
2842
4657
 
2843
4658
  _disabled: {
2844
- [vars$a.cursor]: 'not-allowed'
4659
+ [vars$b.cursor]: 'not-allowed'
2845
4660
  },
2846
4661
 
2847
4662
  _invalid: {
2848
- [vars$a.outline]: `2px solid ${globalRefs$5.colors.error.main}`
4663
+ [vars$b.outline]: `2px solid ${globalRefs$7.colors.error.main}`
2849
4664
  }
2850
4665
  };
2851
4666
 
2852
- const vars$9 = Checkbox.cssVarList;
4667
+ const vars$a = Checkbox.cssVarList;
2853
4668
 
2854
4669
  const checkbox = {
2855
- [vars$9.cursor]: 'pointer',
2856
- [vars$9.width]: 'fit-content'
4670
+ [vars$a.cursor]: 'pointer',
4671
+ [vars$a.width]: 'fit-content'
2857
4672
  };
2858
4673
 
2859
- const vars$8 = SwitchToggle.cssVarList;
4674
+ const vars$9 = SwitchToggle.cssVarList;
2860
4675
 
2861
4676
  const swtichToggle = {
2862
- [vars$8.width]: '70px',
2863
- [vars$8.cursor]: [{}, { selector: '> label' }]
4677
+ [vars$9.width]: '70px',
4678
+ [vars$9.cursor]: [{}, { selector: '> label' }]
2864
4679
  };
2865
4680
 
2866
- const globalRefs$4 = getThemeRefs(globals);
4681
+ const globalRefs$6 = getThemeRefs(globals);
2867
4682
 
2868
- const vars$7 = Container.cssVarList;
4683
+ const vars$8 = Container.cssVarList;
2869
4684
 
2870
4685
  const verticalAlignment = {
2871
4686
  start: { verticalAlignment: 'start' },
@@ -2888,31 +4703,31 @@ const [helperTheme$1, helperRefs$1, helperVars] =
2888
4703
 
2889
4704
  const container = {
2890
4705
  ...helperTheme$1,
2891
- [vars$7.width]: '100%',
4706
+ [vars$8.width]: '100%',
2892
4707
  verticalPadding: {
2893
- sm: { [vars$7.verticalPadding]: '5px' },
2894
- md: { [vars$7.verticalPadding]: '10px' },
2895
- lg: { [vars$7.verticalPadding]: '20px' },
4708
+ sm: { [vars$8.verticalPadding]: '5px' },
4709
+ md: { [vars$8.verticalPadding]: '10px' },
4710
+ lg: { [vars$8.verticalPadding]: '20px' },
2896
4711
  },
2897
4712
  horizontalPadding: {
2898
- sm: { [vars$7.horizontalPadding]: '5px' },
2899
- md: { [vars$7.horizontalPadding]: '10px' },
2900
- lg: { [vars$7.horizontalPadding]: '20px' },
4713
+ sm: { [vars$8.horizontalPadding]: '5px' },
4714
+ md: { [vars$8.horizontalPadding]: '10px' },
4715
+ lg: { [vars$8.horizontalPadding]: '20px' },
2901
4716
  },
2902
4717
  direction: {
2903
4718
  row: {
2904
- [vars$7.flexDirection]: 'row',
2905
- [vars$7.alignItems]: helperRefs$1.verticalAlignment,
2906
- [vars$7.justifyContent]: helperRefs$1.horizontalAlignment,
4719
+ [vars$8.flexDirection]: 'row',
4720
+ [vars$8.alignItems]: helperRefs$1.verticalAlignment,
4721
+ [vars$8.justifyContent]: helperRefs$1.horizontalAlignment,
2907
4722
  horizontalAlignment: {
2908
4723
  spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
2909
4724
  }
2910
4725
  },
2911
4726
 
2912
4727
  column: {
2913
- [vars$7.flexDirection]: 'column',
2914
- [vars$7.alignItems]: helperRefs$1.horizontalAlignment,
2915
- [vars$7.justifyContent]: helperRefs$1.verticalAlignment,
4728
+ [vars$8.flexDirection]: 'column',
4729
+ [vars$8.alignItems]: helperRefs$1.horizontalAlignment,
4730
+ [vars$8.justifyContent]: helperRefs$1.verticalAlignment,
2916
4731
  verticalAlignment: {
2917
4732
  spaceBetween: { [helperVars.verticalAlignment]: 'space-between' }
2918
4733
  }
@@ -2921,214 +4736,214 @@ const container = {
2921
4736
 
2922
4737
  spaceBetween: {
2923
4738
  sm: {
2924
- [vars$7.gap]: '10px'
4739
+ [vars$8.gap]: '10px'
2925
4740
  },
2926
4741
  md: {
2927
- [vars$7.gap]: '20px'
4742
+ [vars$8.gap]: '20px'
2928
4743
  },
2929
4744
  lg: {
2930
- [vars$7.gap]: '30px'
4745
+ [vars$8.gap]: '30px'
2931
4746
  }
2932
4747
  },
2933
4748
 
2934
4749
  shadow: {
2935
4750
  sm: {
2936
- [vars$7.boxShadow]: `${globalRefs$4.shadow.wide.sm} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.sm} ${helperRefs$1.shadowColor}`
4751
+ [vars$8.boxShadow]: `${globalRefs$6.shadow.wide.sm} ${helperRefs$1.shadowColor}, ${globalRefs$6.shadow.narrow.sm} ${helperRefs$1.shadowColor}`
2937
4752
  },
2938
4753
  md: {
2939
- [vars$7.boxShadow]: `${globalRefs$4.shadow.wide.md} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.md} ${helperRefs$1.shadowColor}`
4754
+ [vars$8.boxShadow]: `${globalRefs$6.shadow.wide.md} ${helperRefs$1.shadowColor}, ${globalRefs$6.shadow.narrow.md} ${helperRefs$1.shadowColor}`
2940
4755
  },
2941
4756
  lg: {
2942
- [vars$7.boxShadow]: `${globalRefs$4.shadow.wide.lg} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.lg} ${helperRefs$1.shadowColor}`
4757
+ [vars$8.boxShadow]: `${globalRefs$6.shadow.wide.lg} ${helperRefs$1.shadowColor}, ${globalRefs$6.shadow.narrow.lg} ${helperRefs$1.shadowColor}`
2943
4758
  },
2944
4759
  xl: {
2945
- [vars$7.boxShadow]: `${globalRefs$4.shadow.wide.xl} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.xl} ${helperRefs$1.shadowColor}`
4760
+ [vars$8.boxShadow]: `${globalRefs$6.shadow.wide.xl} ${helperRefs$1.shadowColor}, ${globalRefs$6.shadow.narrow.xl} ${helperRefs$1.shadowColor}`
2946
4761
  },
2947
4762
  '2xl': {
2948
4763
  [helperVars.shadowColor]: '#00000050',
2949
- [vars$7.boxShadow]: `${globalRefs$4.shadow.wide['2xl']} ${helperRefs$1.shadowColor}`
4764
+ [vars$8.boxShadow]: `${globalRefs$6.shadow.wide['2xl']} ${helperRefs$1.shadowColor}`
2950
4765
  },
2951
4766
  },
2952
4767
 
2953
4768
  borderRadius: {
2954
4769
  sm: {
2955
- [vars$7.borderRadius]: globalRefs$4.radius.sm
4770
+ [vars$8.borderRadius]: globalRefs$6.radius.sm
2956
4771
  },
2957
4772
  md: {
2958
- [vars$7.borderRadius]: globalRefs$4.radius.md
4773
+ [vars$8.borderRadius]: globalRefs$6.radius.md
2959
4774
  },
2960
4775
  lg: {
2961
- [vars$7.borderRadius]: globalRefs$4.radius.lg
4776
+ [vars$8.borderRadius]: globalRefs$6.radius.lg
2962
4777
  },
2963
4778
  }
2964
4779
  };
2965
4780
 
2966
- const vars$6 = Logo.cssVarList;
4781
+ const vars$7 = Logo.cssVarList;
2967
4782
 
2968
4783
  const logo = {
2969
- [vars$6.fallbackUrl]: 'url(https://content.app.descope.com/assets/flows/noLogoPlaceholder.svg)'
4784
+ [vars$7.fallbackUrl]: 'url(https://content.app.descope.com/assets/flows/noLogoPlaceholder.svg)'
2970
4785
  };
2971
4786
 
2972
- const globalRefs$3 = getThemeRefs(globals);
4787
+ const globalRefs$5 = getThemeRefs(globals);
2973
4788
 
2974
- const vars$5 = Text.cssVarList;
4789
+ const vars$6 = Text.cssVarList;
2975
4790
 
2976
4791
  const text = {
2977
- [vars$5.lineHeight]: '1em',
2978
- [vars$5.display]: 'inline-block',
2979
- [vars$5.textAlign]: 'left',
2980
- [vars$5.color]: globalRefs$3.colors.surface.dark,
4792
+ [vars$6.lineHeight]: '1em',
4793
+ [vars$6.display]: 'inline-block',
4794
+ [vars$6.textAlign]: 'left',
4795
+ [vars$6.color]: globalRefs$5.colors.surface.dark,
2981
4796
  variant: {
2982
4797
  h1: {
2983
- [vars$5.fontSize]: globalRefs$3.typography.h1.size,
2984
- [vars$5.fontWeight]: globalRefs$3.typography.h1.weight,
2985
- [vars$5.fontFamily]: globalRefs$3.typography.h1.font
4798
+ [vars$6.fontSize]: globalRefs$5.typography.h1.size,
4799
+ [vars$6.fontWeight]: globalRefs$5.typography.h1.weight,
4800
+ [vars$6.fontFamily]: globalRefs$5.typography.h1.font
2986
4801
  },
2987
4802
  h2: {
2988
- [vars$5.fontSize]: globalRefs$3.typography.h2.size,
2989
- [vars$5.fontWeight]: globalRefs$3.typography.h2.weight,
2990
- [vars$5.fontFamily]: globalRefs$3.typography.h2.font
4803
+ [vars$6.fontSize]: globalRefs$5.typography.h2.size,
4804
+ [vars$6.fontWeight]: globalRefs$5.typography.h2.weight,
4805
+ [vars$6.fontFamily]: globalRefs$5.typography.h2.font
2991
4806
  },
2992
4807
  h3: {
2993
- [vars$5.fontSize]: globalRefs$3.typography.h3.size,
2994
- [vars$5.fontWeight]: globalRefs$3.typography.h3.weight,
2995
- [vars$5.fontFamily]: globalRefs$3.typography.h3.font
4808
+ [vars$6.fontSize]: globalRefs$5.typography.h3.size,
4809
+ [vars$6.fontWeight]: globalRefs$5.typography.h3.weight,
4810
+ [vars$6.fontFamily]: globalRefs$5.typography.h3.font
2996
4811
  },
2997
4812
  subtitle1: {
2998
- [vars$5.fontSize]: globalRefs$3.typography.subtitle1.size,
2999
- [vars$5.fontWeight]: globalRefs$3.typography.subtitle1.weight,
3000
- [vars$5.fontFamily]: globalRefs$3.typography.subtitle1.font
4813
+ [vars$6.fontSize]: globalRefs$5.typography.subtitle1.size,
4814
+ [vars$6.fontWeight]: globalRefs$5.typography.subtitle1.weight,
4815
+ [vars$6.fontFamily]: globalRefs$5.typography.subtitle1.font
3001
4816
  },
3002
4817
  subtitle2: {
3003
- [vars$5.fontSize]: globalRefs$3.typography.subtitle2.size,
3004
- [vars$5.fontWeight]: globalRefs$3.typography.subtitle2.weight,
3005
- [vars$5.fontFamily]: globalRefs$3.typography.subtitle2.font
4818
+ [vars$6.fontSize]: globalRefs$5.typography.subtitle2.size,
4819
+ [vars$6.fontWeight]: globalRefs$5.typography.subtitle2.weight,
4820
+ [vars$6.fontFamily]: globalRefs$5.typography.subtitle2.font
3006
4821
  },
3007
4822
  body1: {
3008
- [vars$5.fontSize]: globalRefs$3.typography.body1.size,
3009
- [vars$5.fontWeight]: globalRefs$3.typography.body1.weight,
3010
- [vars$5.fontFamily]: globalRefs$3.typography.body1.font
4823
+ [vars$6.fontSize]: globalRefs$5.typography.body1.size,
4824
+ [vars$6.fontWeight]: globalRefs$5.typography.body1.weight,
4825
+ [vars$6.fontFamily]: globalRefs$5.typography.body1.font
3011
4826
  },
3012
4827
  body2: {
3013
- [vars$5.fontSize]: globalRefs$3.typography.body2.size,
3014
- [vars$5.fontWeight]: globalRefs$3.typography.body2.weight,
3015
- [vars$5.fontFamily]: globalRefs$3.typography.body2.font
4828
+ [vars$6.fontSize]: globalRefs$5.typography.body2.size,
4829
+ [vars$6.fontWeight]: globalRefs$5.typography.body2.weight,
4830
+ [vars$6.fontFamily]: globalRefs$5.typography.body2.font
3016
4831
  }
3017
4832
  },
3018
4833
  mode: {
3019
4834
  primary: {
3020
- [vars$5.color]: globalRefs$3.colors.primary.main
4835
+ [vars$6.color]: globalRefs$5.colors.primary.main
3021
4836
  },
3022
4837
  secondary: {
3023
- [vars$5.color]: globalRefs$3.colors.secondary.main
4838
+ [vars$6.color]: globalRefs$5.colors.secondary.main
3024
4839
  },
3025
4840
  error: {
3026
- [vars$5.color]: globalRefs$3.colors.error.main
4841
+ [vars$6.color]: globalRefs$5.colors.error.main
3027
4842
  },
3028
4843
  success: {
3029
- [vars$5.color]: globalRefs$3.colors.success.main
4844
+ [vars$6.color]: globalRefs$5.colors.success.main
3030
4845
  }
3031
4846
  },
3032
4847
  textAlign: {
3033
- right: { [vars$5.textAlign]: 'right' },
3034
- left: { [vars$5.textAlign]: 'left' },
3035
- center: { [vars$5.textAlign]: 'center' }
4848
+ right: { [vars$6.textAlign]: 'right' },
4849
+ left: { [vars$6.textAlign]: 'left' },
4850
+ center: { [vars$6.textAlign]: 'center' }
3036
4851
  },
3037
4852
  _fullWidth: {
3038
- [vars$5.width]: '100%',
3039
- [vars$5.display]: 'block'
4853
+ [vars$6.width]: '100%',
4854
+ [vars$6.display]: 'block'
3040
4855
  },
3041
4856
  _italic: {
3042
- [vars$5.fontStyle]: 'italic'
4857
+ [vars$6.fontStyle]: 'italic'
3043
4858
  },
3044
4859
  _uppercase: {
3045
- [vars$5.textTransform]: 'uppercase'
4860
+ [vars$6.textTransform]: 'uppercase'
3046
4861
  },
3047
4862
  _lowercase: {
3048
- [vars$5.textTransform]: 'lowercase'
4863
+ [vars$6.textTransform]: 'lowercase'
3049
4864
  }
3050
4865
  };
3051
4866
 
3052
- const globalRefs$2 = getThemeRefs(globals);
3053
- const vars$4 = Link.cssVarList;
4867
+ const globalRefs$4 = getThemeRefs(globals);
4868
+ const vars$5 = Link.cssVarList;
3054
4869
 
3055
4870
  const link = {
3056
- [vars$4.cursor]: 'pointer',
3057
- [vars$4.borderBottomWidth]: '2px',
3058
- [vars$4.borderBottomStyle]: 'solid',
3059
- [vars$4.borderBottomColor]: 'transparent',
3060
- [vars$4.color]: globalRefs$2.colors.primary.main,
4871
+ [vars$5.cursor]: 'pointer',
4872
+ [vars$5.borderBottomWidth]: '2px',
4873
+ [vars$5.borderBottomStyle]: 'solid',
4874
+ [vars$5.borderBottomColor]: 'transparent',
4875
+ [vars$5.color]: globalRefs$4.colors.primary.main,
3061
4876
 
3062
4877
  _hover: {
3063
- [vars$4.borderBottomColor]: globalRefs$2.colors.primary.main
4878
+ [vars$5.borderBottomColor]: globalRefs$4.colors.primary.main
3064
4879
  },
3065
4880
 
3066
4881
  textAlign: {
3067
- right: { [vars$4.textAlign]: 'right' },
3068
- left: { [vars$4.textAlign]: 'left' },
3069
- center: { [vars$4.textAlign]: 'center' }
4882
+ right: { [vars$5.textAlign]: 'right' },
4883
+ left: { [vars$5.textAlign]: 'left' },
4884
+ center: { [vars$5.textAlign]: 'center' }
3070
4885
  },
3071
4886
 
3072
4887
  _fullWidth: {
3073
- [vars$4.width]: '100%'
4888
+ [vars$5.width]: '100%'
3074
4889
  },
3075
4890
 
3076
4891
  mode: {
3077
4892
  primary: {
3078
- [vars$4.color]: globalRefs$2.colors.primary.main,
4893
+ [vars$5.color]: globalRefs$4.colors.primary.main,
3079
4894
  _hover: {
3080
- [vars$4.borderBottomColor]: globalRefs$2.colors.primary.main
4895
+ [vars$5.borderBottomColor]: globalRefs$4.colors.primary.main
3081
4896
  }
3082
4897
  },
3083
4898
  secondary: {
3084
- [vars$4.color]: globalRefs$2.colors.secondary.main,
4899
+ [vars$5.color]: globalRefs$4.colors.secondary.main,
3085
4900
  _hover: {
3086
- [vars$4.borderBottomColor]: globalRefs$2.colors.secondary.main
4901
+ [vars$5.borderBottomColor]: globalRefs$4.colors.secondary.main
3087
4902
  }
3088
4903
  },
3089
4904
  error: {
3090
- [vars$4.color]: globalRefs$2.colors.error.main,
4905
+ [vars$5.color]: globalRefs$4.colors.error.main,
3091
4906
  _hover: {
3092
- [vars$4.borderBottomColor]: globalRefs$2.colors.error.main
4907
+ [vars$5.borderBottomColor]: globalRefs$4.colors.error.main
3093
4908
  }
3094
4909
  },
3095
4910
  success: {
3096
- [vars$4.color]: globalRefs$2.colors.success.main,
4911
+ [vars$5.color]: globalRefs$4.colors.success.main,
3097
4912
  _hover: {
3098
- [vars$4.borderBottomColor]: globalRefs$2.colors.success.main
4913
+ [vars$5.borderBottomColor]: globalRefs$4.colors.success.main
3099
4914
  }
3100
4915
  }
3101
4916
  }
3102
4917
  };
3103
4918
 
3104
- const vars$3 = Divider.cssVarList;
4919
+ const vars$4 = Divider.cssVarList;
3105
4920
 
3106
4921
  const thickness = '2px';
3107
4922
  const textPaddingSize = '10px';
3108
- const [helperTheme, helperRefs] = createHelperVars({ thickness, textPaddingSize }, componentName$d);
4923
+ const [helperTheme, helperRefs] = createHelperVars({ thickness, textPaddingSize }, componentName$f);
3109
4924
 
3110
4925
 
3111
4926
  const divider = {
3112
4927
  ...helperTheme,
3113
- [vars$3.alignItems]: 'center',
3114
- [vars$3.dividerHeight]: helperRefs.thickness,
3115
- [vars$3.backgroundColor]: 'currentColor',
3116
- [vars$3.opacity]: '0.2',
3117
- [vars$3.textPadding]: `0 ${helperRefs.textPaddingSize}`,
3118
- [vars$3.width]: '100%',
3119
- [vars$3.flexDirection]: 'row',
3120
- [vars$3.alignSelf]: 'strech',
3121
- [vars$3.textWidth]: 'fit-content',
3122
- [vars$3.maxTextWidth]: 'calc(100% - 100px)',
4928
+ [vars$4.alignItems]: 'center',
4929
+ [vars$4.dividerHeight]: helperRefs.thickness,
4930
+ [vars$4.backgroundColor]: 'currentColor',
4931
+ [vars$4.opacity]: '0.2',
4932
+ [vars$4.textPadding]: `0 ${helperRefs.textPaddingSize}`,
4933
+ [vars$4.width]: '100%',
4934
+ [vars$4.flexDirection]: 'row',
4935
+ [vars$4.alignSelf]: 'strech',
4936
+ [vars$4.textWidth]: 'fit-content',
4937
+ [vars$4.maxTextWidth]: 'calc(100% - 100px)',
3123
4938
  _vertical: {
3124
- [vars$3.padding]: `0 calc(${thickness} * 3)`,
3125
- [vars$3.width]: 'fit-content',
3126
- [vars$3.textPadding]: `${helperRefs.textPaddingSize} 0`,
3127
- [vars$3.flexDirection]: 'column',
3128
- [vars$3.minHeight]: '200px',
3129
- [vars$3.textWidth]: 'fit-content',
3130
- [vars$3.dividerWidth]: helperRefs.thickness,
3131
- [vars$3.maxTextWidth]: '100%',
4939
+ [vars$4.padding]: `0 calc(${thickness} * 3)`,
4940
+ [vars$4.width]: 'fit-content',
4941
+ [vars$4.textPadding]: `${helperRefs.textPaddingSize} 0`,
4942
+ [vars$4.flexDirection]: 'column',
4943
+ [vars$4.minHeight]: '200px',
4944
+ [vars$4.textWidth]: 'fit-content',
4945
+ [vars$4.dividerWidth]: helperRefs.thickness,
4946
+ [vars$4.maxTextWidth]: '100%',
3132
4947
  }
3133
4948
  };
3134
4949
 
@@ -3136,242 +4951,229 @@ const passcode = {
3136
4951
  ...textField(Passcode.cssVarList),
3137
4952
  };
3138
4953
 
3139
- const globalRefs$1 = getThemeRefs(globals);
4954
+ const globalRefs$3 = getThemeRefs(globals);
3140
4955
 
3141
- const vars$2 = LoaderLinear.cssVarList;
4956
+ const vars$3 = LoaderLinear.cssVarList;
3142
4957
 
3143
4958
  const loaderLinear = {
3144
- [vars$2.display]: 'inline-block',
3145
- [vars$2.barColor]: globalRefs$1.colors.surface.contrast,
3146
- [vars$2.barWidth]: '20%',
3147
- [vars$2.surfaceColor]: globalRefs$1.colors.surface.main,
3148
- [vars$2.borderRadius]: '4px',
3149
- [vars$2.animationDuration]: '2s',
3150
- [vars$2.animationTimingFunction]: 'linear',
3151
- [vars$2.animationIterationCount]: 'infinite',
3152
- [vars$2.width]: '100%',
4959
+ [vars$3.display]: 'inline-block',
4960
+ [vars$3.barColor]: globalRefs$3.colors.surface.contrast,
4961
+ [vars$3.barWidth]: '20%',
4962
+ [vars$3.surfaceColor]: globalRefs$3.colors.surface.main,
4963
+ [vars$3.borderRadius]: '4px',
4964
+ [vars$3.animationDuration]: '2s',
4965
+ [vars$3.animationTimingFunction]: 'linear',
4966
+ [vars$3.animationIterationCount]: 'infinite',
4967
+ [vars$3.width]: '100%',
3153
4968
  size: {
3154
4969
  xs: {
3155
- [vars$2.height]: '6px'
4970
+ [vars$3.height]: '6px'
3156
4971
  },
3157
4972
  sm: {
3158
- [vars$2.height]: '8px'
4973
+ [vars$3.height]: '8px'
3159
4974
  },
3160
4975
  md: {
3161
- [vars$2.height]: '10px'
4976
+ [vars$3.height]: '10px'
3162
4977
  },
3163
4978
  lg: {
3164
- [vars$2.height]: '12px'
4979
+ [vars$3.height]: '12px'
3165
4980
  },
3166
4981
  xl: {
3167
- [vars$2.height]: '14px'
4982
+ [vars$3.height]: '14px'
3168
4983
  }
3169
4984
  },
3170
4985
  mode: {
3171
4986
  primary: {
3172
- [vars$2.barColor]: globalRefs$1.colors.primary.main
4987
+ [vars$3.barColor]: globalRefs$3.colors.primary.main
3173
4988
  },
3174
4989
  secondary: {
3175
- [vars$2.barColor]: globalRefs$1.colors.secondary.main
4990
+ [vars$3.barColor]: globalRefs$3.colors.secondary.main
3176
4991
  }
3177
4992
  },
3178
4993
  _hidden: {
3179
- [vars$2.display]: 'none'
4994
+ [vars$3.display]: 'none'
3180
4995
  }
3181
4996
  };
3182
4997
 
3183
- const globalRefs = getThemeRefs(globals);
4998
+ const globalRefs$2 = getThemeRefs(globals);
3184
4999
 
3185
- const vars$1 = LoaderRadial.cssVarList;
5000
+ const vars$2 = LoaderRadial.cssVarList;
3186
5001
 
3187
5002
  const loaderRadial = {
3188
- [vars$1.display]: 'inline-block',
3189
- [vars$1.color]: globalRefs.colors.surface.contrast,
3190
- [vars$1.animationDuration]: '2s',
3191
- [vars$1.animationTimingFunction]: 'linear',
3192
- [vars$1.animationIterationCount]: 'infinite',
3193
- [vars$1.spinnerStyle]: 'solid',
3194
- [vars$1.spinnerWidth]: '4px',
3195
- [vars$1.spinnerRadius]: '50%',
3196
- [vars$1.spinnerTopColor]: 'currentColor',
3197
- [vars$1.spinnerBottomColor]: 'transparent',
3198
- [vars$1.spinnerRightColor]: 'currentColor',
3199
- [vars$1.spinnerLeftColor]: 'transparent',
5003
+ [vars$2.display]: 'inline-block',
5004
+ [vars$2.color]: globalRefs$2.colors.surface.contrast,
5005
+ [vars$2.animationDuration]: '2s',
5006
+ [vars$2.animationTimingFunction]: 'linear',
5007
+ [vars$2.animationIterationCount]: 'infinite',
5008
+ [vars$2.spinnerStyle]: 'solid',
5009
+ [vars$2.spinnerWidth]: '4px',
5010
+ [vars$2.spinnerRadius]: '50%',
5011
+ [vars$2.spinnerTopColor]: 'currentColor',
5012
+ [vars$2.spinnerBottomColor]: 'transparent',
5013
+ [vars$2.spinnerRightColor]: 'currentColor',
5014
+ [vars$2.spinnerLeftColor]: 'transparent',
3200
5015
  size: {
3201
5016
  xs: {
3202
- [vars$1.width]: '20px',
3203
- [vars$1.height]: '20px',
3204
- [vars$1.spinnerWidth]: '2px'
5017
+ [vars$2.width]: '20px',
5018
+ [vars$2.height]: '20px',
5019
+ [vars$2.spinnerWidth]: '2px'
3205
5020
  },
3206
5021
  sm: {
3207
- [vars$1.width]: '30px',
3208
- [vars$1.height]: '30px',
3209
- [vars$1.spinnerWidth]: '3px'
5022
+ [vars$2.width]: '30px',
5023
+ [vars$2.height]: '30px',
5024
+ [vars$2.spinnerWidth]: '3px'
3210
5025
  },
3211
5026
  md: {
3212
- [vars$1.width]: '40px',
3213
- [vars$1.height]: '40px',
3214
- [vars$1.spinnerWidth]: '4px'
5027
+ [vars$2.width]: '40px',
5028
+ [vars$2.height]: '40px',
5029
+ [vars$2.spinnerWidth]: '4px'
3215
5030
  },
3216
5031
  lg: {
3217
- [vars$1.width]: '60px',
3218
- [vars$1.height]: '60px',
3219
- [vars$1.spinnerWidth]: '5px'
5032
+ [vars$2.width]: '60px',
5033
+ [vars$2.height]: '60px',
5034
+ [vars$2.spinnerWidth]: '5px'
3220
5035
  },
3221
5036
  xl: {
3222
- [vars$1.width]: '80px',
3223
- [vars$1.height]: '80px',
3224
- [vars$1.spinnerWidth]: '6px'
5037
+ [vars$2.width]: '80px',
5038
+ [vars$2.height]: '80px',
5039
+ [vars$2.spinnerWidth]: '6px'
3225
5040
  }
3226
5041
  },
3227
5042
  mode: {
3228
5043
  primary: {
3229
- [vars$1.color]: globalRefs.colors.primary.main
5044
+ [vars$2.color]: globalRefs$2.colors.primary.main
3230
5045
  },
3231
5046
  secondary: {
3232
- [vars$1.color]: globalRefs.colors.secondary.main
5047
+ [vars$2.color]: globalRefs$2.colors.secondary.main
3233
5048
  }
3234
5049
  },
3235
5050
  _hidden: {
3236
- [vars$1.display]: 'none'
5051
+ [vars$2.display]: 'none'
3237
5052
  }
3238
5053
  };
3239
5054
 
3240
- const componentName = getComponentName('combo-box');
3241
-
3242
- const selectors = {
3243
- input: { selector: '::part(input-field)' },
3244
- toggle: { selector: '::part(toggle-button)' }
3245
- };
5055
+ const globalRefs$1 = getThemeRefs(globals);
3246
5056
 
3247
- const { input, toggle } = selectors;
5057
+ const vars$1 = ComboBox.cssVarList;
3248
5058
 
3249
- const borderRadius = {
3250
- topRightRadius: {
3251
- selector: input.selector,
3252
- property: 'border-top-right-radius'
3253
- },
3254
- bottomRightRadius: {
3255
- selector: input.selector,
3256
- property: 'border-bottom-right-radius'
5059
+ const comboBox = {
5060
+ [vars$1.borderColor]: globalRefs$1.colors.surface.main,
5061
+ [vars$1.borderWidth]: '1px',
5062
+ [vars$1.borderStyle]: 'solid',
5063
+ [vars$1.cursor]: 'pointer',
5064
+ [vars$1.padding]: '0',
5065
+ [vars$1.placeholderColor]: globalRefs$1.colors.surface.main,
5066
+ [vars$1.toggleColor]: globalRefs$1.colors.surface.contrast,
5067
+ [vars$1.toggleCursor]: 'pointer',
5068
+ size: {
5069
+ xs: {
5070
+ [vars$1.height]: '14px',
5071
+ [vars$1.fontSize]: '8px',
5072
+ [vars$1.padding]: `0 ${globalRefs$1.spacing.xs}`
5073
+ },
5074
+ sm: {
5075
+ [vars$1.height]: '20px',
5076
+ [vars$1.fontSize]: '10px',
5077
+ [vars$1.padding]: `0 ${globalRefs$1.spacing.sm}`
5078
+ },
5079
+ md: {
5080
+ [vars$1.height]: '30px',
5081
+ [vars$1.fontSize]: '14px',
5082
+ [vars$1.padding]: `0 ${globalRefs$1.spacing.md}`
5083
+ },
5084
+ lg: {
5085
+ [vars$1.height]: '40px',
5086
+ [vars$1.fontSize]: '20px',
5087
+ [vars$1.padding]: `0 ${globalRefs$1.spacing.lg}`
5088
+ },
5089
+ xl: {
5090
+ [vars$1.height]: '50px',
5091
+ [vars$1.fontSize]: '25px',
5092
+ [vars$1.padding]: `0 ${globalRefs$1.spacing.xl}`
5093
+ }
3257
5094
  },
3258
- topLeftRadius: {
3259
- selector: input.selector,
3260
- property: 'border-top-left-radius'
5095
+ _invalid: {
5096
+ [vars$1.borderColor]: globalRefs$1.colors.error.main,
5097
+ [vars$1.placeholderColor]: globalRefs$1.colors.error.light,
5098
+ [vars$1.toggleColor]: globalRefs$1.colors.error.main,
3261
5099
  },
3262
- bottomLeftRadius: {
3263
- selector: input.selector,
3264
- property: 'border-bottom-left-radius'
3265
- }
5100
+ // [vars.overlayCursor]: 'pointer',
5101
+ // [vars.overlayBackground]: globalRefs.colors.surface.light,
5102
+ // [vars.overlayBorder]: `2px solid red`,
3266
5103
  };
3267
5104
 
3268
- const ComboBoxMixin = (superclass) => class ComboBoxMixinClass extends superclass {
3269
-
3270
- // vaadin api is to set props on their combo box node,
3271
- // in order to avoid it, we are passing the children of this component
3272
- // to the items & renderer props, so it will be used as the combo box items
3273
- #onChildrenChange() {
3274
- const baseElement = this.shadowRoot.querySelector(this.baseSelector);
3275
- const items = Array.from(this.children);
3276
-
3277
- // we want the data-name attribute to be accessible as an object attribute
3278
- baseElement.items = items.map((node) =>
3279
- Object.defineProperty(node, 'data-name', {
3280
- value: node.getAttribute('data-name')
3281
- })
3282
- );
3283
-
3284
- baseElement.renderer = (root, combo, model) => {
3285
- root.innerHTML = items[model.index].outerHTML;
3286
- };
3287
- }
3288
-
3289
- // the default vaadin behavior is to attach the overlay to the body when opened
3290
- // we do not want that because it's difficult to style the overlay in this way
3291
- // so we override it to open inside the shadow DOM
3292
- #overrideOverlaySettings() {
3293
- const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
3294
-
3295
- overlay._attachOverlay = function () { this.bringToFront(); };
3296
- overlay._detachOverlay = function () { };
3297
- overlay._enterModalState = function () { };
3298
- }
5105
+ Image.cssVarList;
3299
5106
 
3300
- init() {
3301
- super.init?.();
5107
+ const image = {};
3302
5108
 
3303
- this.#overrideOverlaySettings();
3304
- observeChildren(this, this.#onChildrenChange.bind(this));
3305
- }
3306
- };
5109
+ const globalRefs = getThemeRefs(globals);
5110
+ const vars = PhoneField.cssVarList;
3307
5111
 
3308
- const ComboBox = compose(
3309
- createStyleMixin({
3310
- mappings: {
3311
- ...borderRadius,
3312
- backgroundColor: input,
3313
- width: input,
3314
- color: input,
3315
- padding: input,
3316
- borderColor: input,
3317
- borderStyle: input,
3318
- borderWidth: input,
3319
- cursor: toggle,
3320
- height: input,
3321
- // overlayBackground: { property: () => ComboBox.cssVarList.overlay.backgroundColor },
3322
- // overlayBorder: { property: () => ComboBox.cssVarList.overlay.border }
3323
- }
3324
- }),
3325
- draggableMixin,
3326
- portalMixin({
3327
- name: 'overlay',
3328
- selector: '',
3329
- mappings: {
3330
- // border: { selector: 'vaadin-combo-box-scroller' },
3331
- // backgroundColor: { selector: 'vaadin-combo-box-item' },
3332
- }
3333
- }),
3334
- proxyInputMixin,
3335
- componentNameValidationMixin,
3336
- ComboBoxMixin
3337
- )(
3338
- createProxy({
3339
- slots: ['prefix'],
3340
- wrappedEleName: 'vaadin-combo-box',
3341
- style: () => `
3342
- :host {
3343
- -webkit-mask-image: none;
3344
- }
3345
- `,
3346
- excludeAttrsSync: ['tabindex'],
3347
- includeAttrsSync: [],
3348
- componentName,
3349
- includeForwardProps: ['items', 'renderer']
3350
- })
3351
- );
5112
+ const phoneField = {
5113
+ [vars.wrapperBorderStyle]: 'solid',
5114
+ [vars.wrapperBorderWidth]: '1px',
5115
+ [vars.wrapperBorderColor]: 'transparent',
5116
+ [vars.wrapperBorderRadius]: globalRefs.radius.sm,
5117
+ [vars.placeholderColor]: globalRefs.colors.surface.main,
3352
5118
 
3353
- getThemeRefs(globals);
5119
+ [vars.padding]: '0',
3354
5120
 
3355
- const vars = ComboBox.cssVarList;
5121
+ [vars.phoneInputWidth]: '15em',
5122
+ [vars.countryCodeInputWidth]: '7em',
3356
5123
 
3357
- const comboBox = {
3358
- ...textField(ComboBox.cssVarList),
3359
5124
  size: {
3360
5125
  xs: {
3361
- [vars.width]: '30px'
5126
+ [vars.inputHeight]: '14px',
5127
+ [vars.fontSize]: '8px',
5128
+ [vars.padding]: `0 ${globalRefs.spacing.xs}`,
5129
+ [vars.countryCodeDropdownWidth]: '200px',
5130
+ },
5131
+ sm: {
5132
+ [vars.inputHeight]: '20px',
5133
+ [vars.fontSize]: '10px',
5134
+ [vars.padding]: `0 ${globalRefs.spacing.sm}`,
5135
+ [vars.countryCodeDropdownWidth]: '240px',
5136
+ },
5137
+ md: {
5138
+ [vars.inputHeight]: '30px',
5139
+ [vars.fontSize]: '14px',
5140
+ [vars.padding]: `0 ${globalRefs.spacing.md}`,
5141
+ [vars.countryCodeDropdownWidth]: '250px',
5142
+ },
5143
+ lg: {
5144
+ [vars.inputHeight]: '40px',
5145
+ [vars.fontSize]: '46px',
5146
+ [vars.padding]: `0 ${globalRefs.spacing.lg}`,
5147
+ [vars.countryCodeDropdownWidth]: '250px',
5148
+ },
5149
+ xl: {
5150
+ [vars.inputHeight]: '50px',
5151
+ [vars.fontSize]: '25px',
5152
+ [vars.padding]: `0 ${globalRefs.spacing.xl}`,
5153
+ [vars.countryCodeDropdownWidth]: '400px',
3362
5154
  }
3363
5155
  },
3364
- [vars.borderColor]: 'green',
3365
- [vars.borderWidth]: '0',
3366
- [vars.cursor]: 'pointer',
3367
- [vars.padding]: '0',
3368
- // [vars.overlayBackground]: 'blue',
3369
- // [vars.overlayBorder]: '3px solid red',
3370
- };
3371
5156
 
3372
- Image.cssVarList;
5157
+ _fullWidth: {
5158
+ [vars.componentWidth]: '100%',
5159
+ [vars.phoneInputWidth]: '100%',
5160
+ [vars.countryCodeDropdownWidth]: '100%',
5161
+ },
3373
5162
 
3374
- const image = {};
5163
+ _bordered: {
5164
+ [vars.wrapperBorderColor]: globalRefs.colors.surface.main
5165
+ },
5166
+
5167
+ _invalid: {
5168
+ [vars.color]: globalRefs.colors.error.main,
5169
+ [vars.placeholderColor]: globalRefs.colors.error.light,
5170
+ [vars.wrapperBorderColor]: globalRefs.colors.error.main
5171
+ },
5172
+
5173
+ // '@overlay': {
5174
+ // overlayItemBackgroundColor: 'red'
5175
+ // }
5176
+ };
3375
5177
 
3376
5178
  var components = {
3377
5179
  button,
@@ -3391,7 +5193,8 @@ var components = {
3391
5193
  loaderRadial,
3392
5194
  loaderLinear,
3393
5195
  comboBox,
3394
- image
5196
+ image,
5197
+ phoneField
3395
5198
  };
3396
5199
 
3397
5200
  var index = { globals, components };